diff --git a/lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts b/lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts index 1c13e87..ebb0217 100644 --- a/lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts +++ b/lib/mcp/tools/sandbox/registerRunSandboxCommandTool.ts @@ -19,7 +19,7 @@ const runSandboxCommandSchema = z.object({ .string() .optional() .describe( - 'A prompt to pass to OpenCode. Runs `opencode run ""` in the sandbox. Cannot be used with command.', + 'A prompt to pass to OpenClaw. Runs `openclaw agent --agent main --message ""` in the sandbox. Cannot be used with command.', ), account_id: z .string() @@ -40,7 +40,7 @@ export function registerRunSandboxCommandTool(server: McpServer): void { "run_sandbox_command", { description: - 'Create a sandbox and run a command or OpenCode prompt in it. Use prompt to run `opencode run ""`. Returns the sandbox ID and a run ID to track progress.', + 'Create a sandbox and run a command or OpenClaw prompt in it. Use prompt to run `openclaw agent --agent main --message ""`. Returns the sandbox ID and a run ID to track progress.', inputSchema: runSandboxCommandSchema, }, async (args, extra: RequestHandlerExtra) => { diff --git a/lib/sandbox/__tests__/processCreateSandbox.test.ts b/lib/sandbox/__tests__/processCreateSandbox.test.ts index 8511ec9..ee280c9 100644 --- a/lib/sandbox/__tests__/processCreateSandbox.test.ts +++ b/lib/sandbox/__tests__/processCreateSandbox.test.ts @@ -181,7 +181,7 @@ describe("processCreateSandbox", () => { }); }); - it("converts prompt to opencode run command", async () => { + it("converts prompt to openclaw agent command", async () => { vi.mocked(selectAccountSnapshots).mockResolvedValue([]); vi.mocked(createSandbox).mockResolvedValue({ sandboxId: "sbx_123", @@ -215,8 +215,8 @@ describe("processCreateSandbox", () => { runId: "run_prompt123", }); expect(triggerRunSandboxCommand).toHaveBeenCalledWith({ - command: "opencode", - args: ["run", "create a hello world index.html"], + command: "openclaw", + args: ["agent", "--agent", "main", "--message", "create a hello world index.html"], cwd: undefined, sandboxId: "sbx_123", accountId: "acc_123", diff --git a/lib/sandbox/processCreateSandbox.ts b/lib/sandbox/processCreateSandbox.ts index b9da0e8..8c37c31 100644 --- a/lib/sandbox/processCreateSandbox.ts +++ b/lib/sandbox/processCreateSandbox.ts @@ -22,9 +22,9 @@ export async function processCreateSandbox( ): Promise { const { accountId, prompt, cwd } = input; - // Convert prompt shortcut to opencode command - const command = prompt ? "opencode" : input.command; - const args = prompt ? ["run", prompt] : input.args; + // Convert prompt shortcut to openclaw agent command + const command = prompt ? "openclaw" : input.command; + const args = prompt ? ["agent", "--agent", "main", "--message", prompt] : input.args; // Get account's most recent snapshot if available const accountSnapshots = await selectAccountSnapshots(accountId);