Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Approval asks keep a tool's raw input off the runtime event
milind-soni6766ba4caaa7
diff --git a/packages/phone-protocol/src/runtime-events.ts b/packages/phone-protocol/src/runtime-events.tsindex d7be3e5fde..7b35fd81db 100644--- a/packages/phone-protocol/src/runtime-events.ts+++ b/packages/phone-protocol/src/runtime-events.ts@@ -147,8 +147,6 @@ export type RuntimeEvent = RuntimeEventBase &/** The files a read tool's ask reads (absolute): a request that reads only the bot's own files is answered* without the person. Like `command`, never broadcast. */reads?: string[];- /** Raw structured tool input forwarded by ACP drivers for non-question permission prompts; never broadcast. */- rawInput?: unknown;choices?: string[];/** A provider's structured ask (Claude's AskUserQuestion): the whole* set of questions, each with its own options, so the card can offerdiff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.tsindex 376f580835..21d6a96a32 100644--- a/server/drivers/acp/core.ts+++ b/server/drivers/acp/core.ts@@ -688,7 +688,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>choices: askQuestions?.[0]?.options.map(option => option.label) ?? (isQuestion ? questionChoices : undefined),...(askQuestions ? { questions: askQuestions } : {}),approvalScope: current.controlsHost ? "local-computer" : undefined,- allowSession: !isQuestion && !current.controlsHost ? true : undefined, ...(!isQuestion && toolCall.rawInput !== undefined ? { rawInput: toolCall.rawInput } : {}),+ allowSession: !isQuestion && !current.controlsHost ? true : undefined,});};diff --git a/server/drivers/antigravity-native-cli.test.ts b/server/drivers/antigravity-native-cli.test.tsindex 64ea5c31aa..aa4458ba4c 100644--- a/server/drivers/antigravity-native-cli.test.ts+++ b/server/drivers/antigravity-native-cli.test.ts@@ -606,13 +606,13 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {const first = await recorder.until((event) => event.turnId === turnId && (event.type === "request.opened" || event.type === "turn.completed"));if (first.type === "request.opened") await instance.adapter.respondToRequest(name, (first as { requestId: string }).requestId, { behavior: "deny" });await recorder.until((event) => event.type === "turn.completed" && event.turnId === turnId);- const opened = recorder.events.find((event) => event.type === "request.opened") as { commandLine?: string; rawInput?: unknown } | undefined;- return { card: opened !== undefined, commandLine: opened?.commandLine, rawInput: opened?.rawInput, answer: readFileSync(answer, "utf8") };+ const opened = recorder.events.find((event) => event.type === "request.opened") as { commandLine?: string } | undefined;+ return { card: opened !== undefined, commandLine: opened?.commandLine, answer: readFileSync(answer, "utf8") };}it("answers a file edit inside the turn's folder itself on Auto-accept edits", async () => {expect(await asked("edits-inside", "edits", (directory) => ({ kind: "edit", title: "Edit notes.md", locations: [{ path: join(directory, "notes.md") }] })))- .toEqual({ card: false, commandLine: undefined, rawInput: undefined, answer: "allow-once" });+ .toEqual({ card: false, commandLine: undefined, answer: "allow-once" });expect(await asked("edits-new-folder", "edits", (directory) => ({ kind: "edit", title: "Edit", locations: [{ path: join(directory, "new", "deep", "notes.md") }] }))).toMatchObject({ card: false, answer: "allow-once" });}, 90_000);@@ -642,9 +642,4 @@ describe.skipIf(WINDOWS)("a native CLI set as the engine's own path", () => {expect(await asked("full-other-kind", "full", () => ({ kind: "other", rawInput: { CommandLine: "rm -rf ~" }, title: "Tool" }))).toMatchObject({ card: true, commandLine: "rm -rf ~" });}, 90_000);- it("forwards structured rawInput on non-shell ACP permission prompts", async () => {- const raw = { pid: 100, steps: [{ tool: "click", args: { x: 10, y: 20 } }] };- expect(await asked("full-non-shell-raw", "full", () => ({ kind: "other", rawInput: raw, title: "Run mcp_computer_run_steps" })))- .toMatchObject({ card: true, commandLine: undefined, rawInput: raw });- }, 90_000);});diff --git a/server/index.ts b/server/index.tsindex 2f0d4c90c5..ce6e5cea51 100644--- a/server/index.ts+++ b/server/index.ts@@ -6296,7 +6296,7 @@ bus.subscribe((event: RuntimeEvent) => {const privateImageEvent = event.type === "item.completed" && event.itemType === "assistant_image";if (!privateImageEvent) {// Exact executable input is internal; the bus's persistence redactor does not scrub the live event.- const publicEvent = event.type === "request.opened" ? { ...event, command: undefined, commandLine: undefined, reads: undefined, rawInput: undefined } : publicReplyEvent(event, groupSpeakers.get(event.threadId)?.botId);+ const publicEvent = event.type === "request.opened" ? { ...event, command: undefined, commandLine: undefined, reads: undefined } : publicReplyEvent(event, groupSpeakers.get(event.threadId)?.botId);broadcast({ kind: "runtime", event: publicEvent });}if (event.type === "turn.completed") { const note = runComputers.turnEnded(event.threadId, event.ok); if (note) store.appendMessage(event.threadId, { role: "bot", kind: "activity", tool: { name: `recovery: ${note}`, ok: true } }); } const routineRun = privateImageEvent ? null : (routines?.handleRuntimeEvent(withHeldReason(event)) ?? null);