### Perform first-time local E2E setup Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/specs/2026-06-03-clawmanager-v2-e2e-design.md Install dependencies and the required browser engine before running tests for the first time. ```bash cd e2e npm ci npx playwright install chromium ``` -------------------------------- ### Install dependencies Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/backend/README.md Run this command to install the necessary project dependencies. ```bash make deps ``` -------------------------------- ### Start the server Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/backend/README.md Launches the backend server application. ```bash make run ``` -------------------------------- ### Development Server Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/frontend/README.md Starts the development server for local testing. ```bash npm run dev ``` -------------------------------- ### Configure and start RuntimeScheduler Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-01-clawmanager-v2-runtime-pool.md Initialize Redis services and the scheduler, then start the scheduler if enabled in the configuration. ```go platformRedis, err := services.NewPlatformRedisClient(cfg.Runtime.RedisURL) if err != nil { log.Printf("platform redis disabled: %v", err) } runtimeEvents := services.NewRuntimeEventService(platformRedis) agentClient := services.NewRuntimeAgentClient(cfg.Runtime.AgentControlToken) leader := services.NewRuntimeLeaderService(k8sClient, cfg.Runtime.Namespace, cfg.Runtime.BackendReplicaID) runtimeDeployments := k8s.NewRuntimeDeploymentService(k8sClient) runtimeScheduler := services.NewRuntimeScheduler(instanceRepo, runtimePodRepo, bindingRepo, rolloutRepo, agentClient, runtimeEvents, leader, runtimeDeployments, cfg.Runtime.SchedulerTick) if cfg.Runtime.SchedulerEnabled { runtimeScheduler.Start(ctx) } ``` -------------------------------- ### Environment Configuration Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/frontend/README.md Example content for the .env.development file. ```text VITE_API_URL=http://localhost:9001/api/v1 ``` -------------------------------- ### Install k3s Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/use_guide_en.md Commands to install k3s on standard or mainland China networks. ```bash curl -sfL https://get.k3s.io | sh - ``` ```bash curl -sfL https://rancher-mirror.rancher.cn/k3s/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh - ``` -------------------------------- ### Commit Configuration and Setup Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-03-clawmanager-v2-e2e-p0.md Stage and commit the newly created Playwright configuration and setup files to the repository. ```bash git add e2e/playwright.config.ts e2e/setup git commit -m "test: configure e2e playwright setup" ``` -------------------------------- ### Start MySQL with Docker Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/backend/README.md Initializes the MySQL database container using Docker. ```bash make docker-up ``` -------------------------------- ### Check for Existing Installation Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/deployments/k3s/cluster/README.md Verify that no previous Longhorn or ClawManager resources exist before starting a fresh install. ```sh kubectl get ns longhorn-system clawmanager-system clawmanager-user-1 --ignore-not-found kubectl get sc longhorn longhorn-rwx --ignore-not-found kubectl get crd | grep longhorn.io || true ``` -------------------------------- ### Check Installation State Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/deployments/k8s/single-node/README.md Verify that no existing ClawManager resources are present before proceeding with a fresh installation. ```sh kubectl get ns clawmanager-system clawmanager-user-1 --ignore-not-found kubectl get pv | grep clawmanager || true kubectl get pvc -A | grep clawmanager || true ``` -------------------------------- ### Start Command Execution Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/hermes-runtime-agent-development.md Notify the ClawManager that command execution has begun. ```http POST {CLAWMANAGER_AGENT_BASE_URL}/api/v1/agent/commands/{id}/start Authorization: Bearer {session_token} Content-Type: application/json ``` ```json { "agent_id": "hermes-123-main", "started_at": "2026-04-27T14:31:00Z" } ``` -------------------------------- ### Initialize E2E Test Environment Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/e2e/README.md Install project dependencies and the required Playwright browser binaries. ```bash npm ci npx playwright install chromium ``` -------------------------------- ### Prepare Nodes for Longhorn Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/deployments/k3s/cluster/README.md Install necessary storage and networking packages on cluster nodes. ```sh apt-get update apt-get install -y open-iscsi nfs-common cryptsetup dmsetup systemctl enable --now iscsid || systemctl enable --now open-iscsi ``` ```sh yum install -y iscsi-initiator-utils nfs-utils cryptsetup device-mapper systemctl enable --now iscsid ``` ```sh command -v iscsiadm command -v mount.nfs command -v mount.nfs4 systemctl is-active iscsid || systemctl is-active open-iscsi ``` -------------------------------- ### Prepare Nodes for Longhorn (RHEL/CentOS/Rocky/Alma) Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/deployments/k8s/cluster/README.md Install required storage packages on RHEL-based distributions. ```sh yum install -y iscsi-initiator-utils nfs-utils cryptsetup device-mapper systemctl enable --now iscsid ``` -------------------------------- ### Prepare Nodes for Longhorn (Ubuntu/Debian) Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/deployments/k8s/cluster/README.md Install required storage packages on Ubuntu or Debian nodes. ```sh apt-get update apt-get install -y open-iscsi nfs-common cryptsetup dmsetup systemctl enable --now iscsid || systemctl enable --now open-iscsi ``` -------------------------------- ### Manage V2 Instance Lifecycle Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-01-clawmanager-v2-runtime-pool.md Implements Start and Stop operations for V2 instances, delegating to legacy methods for non-V2 types. ```go func (s *instanceService) Start(ctx context.Context, userID int, instanceID int) error { instance, err := s.mustOwnInstance(ctx, userID, instanceID) if err != nil { return err } if _, ok := NormalizeV2RuntimeType(instance.Type); ok { return s.instanceRepo.UpdateRuntimeState(ctx, instance.ID, "creating", instance.RuntimeGeneration+1, nil) } return s.startLegacy(ctx, instance) } func (s *instanceService) Stop(ctx context.Context, userID int, instanceID int) error { instance, err := s.mustOwnInstance(ctx, userID, instanceID) if err != nil { return err } if _, ok := NormalizeV2RuntimeType(instance.Type); ok { binding, err := s.bindingRepo.GetByInstanceID(ctx, instance.ID) if err == nil { pod, podErr := s.runtimePodRepo.GetByID(ctx, binding.RuntimePodID) if podErr == nil && pod.AgentEndpoint != nil { _ = s.agentClient.DeleteGateway(ctx, *pod.AgentEndpoint, binding.GatewayID) } _ = s.bindingRepo.DeleteByInstanceID(ctx, instance.ID) _ = s.runtimePodRepo.ReleaseSlot(ctx, binding.RuntimePodID) } return s.instanceRepo.UpdateRuntimeState(ctx, instance.ID, "stopped", instance.RuntimeGeneration, nil) } return s.stopLegacy(ctx, instance) } ``` -------------------------------- ### Start MySQL Service via PowerShell Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-03-clawmanager-v2-e2e-p0.md Use this command to initialize the MySQL container for E2E testing in a PowerShell environment. ```powershell docker compose -f docker/docker-compose.e2e.yml up -d mysql ``` -------------------------------- ### Install Lucide React dependency Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-01-clawmanager-v2-runtime-pool.md Run these commands within the frontend directory to add the icon library. ```powershell cd frontend npm install lucide-react cd .. ``` -------------------------------- ### Smoke Test Frontend Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-01-clawmanager-v2-runtime-pool.md Start the frontend development server for local smoke testing. ```powershell cd frontend npm run dev -- --host 127.0.0.1 ``` -------------------------------- ### POST /api/v1/agent/commands/{id}/start Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/hermes-runtime-agent-development.md Notifies the ClawManager that the agent has started executing a specific command. ```APIDOC ## POST /api/v1/agent/commands/{id}/start ### Description Signals the start of command execution. ### Method POST ### Endpoint {CLAWMANAGER_AGENT_BASE_URL}/api/v1/agent/commands/{id}/start ### Request Body - **agent_id** (string) - Required - Current agent ID. - **started_at** (string) - Required - ISO 8601 timestamp of start time. ``` -------------------------------- ### Configure Skill Root Directory Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/hermes-runtime-agent-development.md The default location for installed skills within the instance. ```text /config/.hermes/skills ``` -------------------------------- ### Manage k3s service Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/use_guide_en.md Commands to verify the k3s service status and enable it to start on boot. ```bash sudo systemctl status k3s --no-pager sudo systemctl enable k3s ``` -------------------------------- ### Identify Frontend Port Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/use_guide_en.md Example output showing the NodePort mapping for the frontend service. ```text 443:30443/TCP ``` -------------------------------- ### Zip Structure Example Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/hermes-runtime-agent-development.md The required directory structure for skill packages, containing exactly one top-level directory. ```text hermes-weather/ skill.json main.py README.md ``` -------------------------------- ### GET /api/v1/admin/session-usage/overview Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/session-token-usage.md Provides a cross-instance overview of session usage for admin monitoring. ```APIDOC ## GET /api/v1/admin/session-usage/overview ### Description Returns managed OpenClaw/Hermes running instances sorted by total tokens, including per-instance summaries and global totals. ### Method GET ### Endpoint /api/v1/admin/session-usage/overview ### Parameters #### Query Parameters - **page** (integer) - Optional - Page number for pagination. - **limit** (integer) - Optional - Number of items per page. - **search** (string) - Optional - Filters instances by name or identifier. - **since** (string) - Optional - RFC3339 timestamp filter for start time. - **until** (string) - Optional - RFC3339 timestamp filter for end time. ``` -------------------------------- ### Download Skill Version Package Request Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/hermes-runtime-agent-development.md HTTP request to download a specific skill version package during the installation process. ```http GET {CLAWMANAGER_AGENT_BASE_URL}/api/v1/agent/skills/versions/{skill_version}/download Authorization: Bearer {session_token} ``` -------------------------------- ### Error Response Examples Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/clawmanager-agent-v2-contract.md Plain text error responses for command failures. ```http HTTP/1.1 409 Conflict Content-Type: text/plain no free port ``` ```http HTTP/1.1 500 Internal Server Error Content-Type: text/plain failed to start gateway process ``` -------------------------------- ### Verify Playwright report Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-03-clawmanager-v2-e2e-p0.md Start the Playwright report server to verify test results. ```bash npm run test:report -- --host 127.0.0.1 ``` -------------------------------- ### Download Skill Package via HTTP Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/hermes-runtime-agent-development.md Use this GET request to download a skill zip package when a version identifier is provided. ```http GET {CLAWMANAGER_AGENT_BASE_URL}/api/v1/agent/skills/versions/{external_version_id}/download Authorization: Bearer {session_token} ``` -------------------------------- ### Error Message: Missing NFS Helper Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/deployments/k3s/cluster/README.md Example of an error message when required NFS mount helpers are missing. ```text bad option; you might need a /sbin/mount. helper program ``` -------------------------------- ### Initialize repositories in main.go Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-01-clawmanager-v2-runtime-pool.md Instantiate runtime-related repositories using the existing database session. ```go runtimePodRepo := repository.NewRuntimePodRepository(sess) bindingRepo := repository.NewInstanceRuntimeBindingRepository(sess) rolloutRepo := repository.NewRuntimeRolloutRepository(sess) ``` -------------------------------- ### Runtime Log Output for Inbound-Only Configuration Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/admin-user-guide.md Example of authoritative runtime log output confirming an inbound-only clipboard configuration. ```text clipboard_enabled: (True, True) clipboard_in_enabled: (True, True) clipboard_out_enabled: (False, True) ``` -------------------------------- ### Verify Playwright Configuration Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-03-clawmanager-v2-e2e-p0.md Execute this command within the e2e directory to validate the Playwright configuration and ensure setup projects are correctly registered. ```powershell npx playwright test --list ``` -------------------------------- ### Implement Instance Service Frame Source: https://github.com/yuan-lab-llm/clawmanager/blob/main/docs/superpowers/plans/2026-06-01-clawmanager-v2-runtime-pool.md Renders an iframe for the instance service, with conditional states for starting or unavailable instances. ```tsx interface InstanceServiceFrameProps { instanceId: number; availability: "available" | "starting" | "unavailable"; } export function InstanceServiceFrame({ instanceId, availability }: InstanceServiceFrameProps) { if (availability === "starting") { return
Starting
; } if (availability === "unavailable") { return
Unavailable
; } return (