Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(acp): main's file-size and comment guards pass again (#3720)
Milind Sonic90f3d6466c7
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.tsindex 744d1ba62d..c17a0281d2 100644--- a/server/drivers/acp/core.ts+++ b/server/drivers/acp/core.ts@@ -59,7 +59,7 @@ import { openQuestionRequest, questionRequestFor, type AcpQuestionRequest } fromimport { commandSummary, toolDetailPreview } from "../../tool-summary.ts";import { acpToolEndEvents } from "./tool-items.ts";import { AcpHost } from "./host.ts";-import type { AcpAskFinish, AcpSession, AcpTurn } from "./turn-state.ts";+import { trackRunningTool, type AcpAskFinish, type AcpSession, type AcpTurn } from "./turn-state.ts";import { recoveryPromptFor } from "../../resume-recovery.ts";import { engineIdleMs, sessionIdlePolicy } from "../session-idle.ts";import { classifyError } from "../retry.ts";@@ -260,14 +260,6 @@ const SHARED_SESSIONS_MAX = 6, SHARED_SESSIONS_LIFETIME = 12;const HEALTHY_CLOSE = new Set(["idle", "reset", "contract", "stop", "stopAll", "dispose", "approval-unconfirmed"]);/** ACP agents may compact their history silently; re-send the full prompt after this many bare turns. */const ACP_PROMPT_RE_ANCHOR_TURNS = 8;-/** A `tool_call` without a status is pending (ACP's default); a `tool_call_update` without one leaves the call as it was. */-function trackRunningTool(current: AcpTurn, update: { toolCallId?: unknown; status?: unknown }, defaultStatus?: "pending"): void {- if (typeof update.toolCallId !== "string" || !update.toolCallId) return;- const status = update.status ?? defaultStatus;- if (status === "completed" || status === "failed") current.runningTools.delete(update.toolCallId);- else if (status === "pending" || status === "in_progress") current.runningTools.add(update.toolCallId);-}-function isHermesReasoningReplay(chunk: string, streamed: string): boolean {const reply = streamed.trim();const replay = chunk.trim();diff --git a/server/drivers/acp/opencode-go.test.ts b/server/drivers/acp/opencode-go.test.tsindex ec1d1ae985..d208f7e95b 100644--- a/server/drivers/acp/opencode-go.test.ts+++ b/server/drivers/acp/opencode-go.test.ts@@ -784,7 +784,7 @@ describe("OpenCode turns without a sign-in gate", () => {vi.spyOn(quietStatus, "sampleProcessTree").mockResolvedValue({ cpuMs: 0, connections: 1 });vi.stubEnv("OMB_ACP_QUIET_NOTICE_MS", "300");vi.stubEnv("OMB_ACP_QUIET_TICK_MS", "50");- // The row format of #3143's opencode log, with a synthetic run and model.+ // The row format of a real opencode log, with a synthetic run and model.const row = (session: string, small: boolean, error: string) =>`timestamp=2026-10-01T00:00:03.000Z level=ERROR run=fixture_run message="stream error" providerID=opencode modelID=mimo-v2.6-flash-free session.id=${session} small=${small} agent=build mode=primary error.error="${error}"`;const f = await open("opencode-rate-limit", () => ({diff --git a/server/drivers/acp/quiet-status.test.ts b/server/drivers/acp/quiet-status.test.tsindex 307edf4364..5121615320 100644--- a/server/drivers/acp/quiet-status.test.ts+++ b/server/drivers/acp/quiet-status.test.ts@@ -61,7 +61,7 @@ describe("classifyQuiet", () => {});});-// The row format of an opencode log quoted in #3143, with synthetic identifiers.+// The row format of a real opencode log, with synthetic identifiers.const openCodeRow = (fields: string) =>`timestamp=2026-10-01T00:00:03.000Z level=ERROR run=fixture_run message="stream error" providerID=opencode modelID=mimo-v2.6-flash-free ${fields}`;diff --git a/server/drivers/acp/turn-state.ts b/server/drivers/acp/turn-state.tsindex 13405e002c..128e1846ff 100644--- a/server/drivers/acp/turn-state.ts+++ b/server/drivers/acp/turn-state.ts@@ -62,3 +62,11 @@ export interface AcpSession {fallbackNotice?: string;launchModel?: string;}++/** A `tool_call` without a status is pending (ACP's default); a `tool_call_update` without one leaves the call as it was. */+export function trackRunningTool(current: AcpTurn, update: { toolCallId?: unknown; status?: unknown }, defaultStatus?: "pending"): void {+ if (typeof update.toolCallId !== "string" || !update.toolCallId) return;+ const status = update.status ?? defaultStatus;+ if (status === "completed" || status === "failed") current.runningTools.delete(update.toolCallId);+ else if (status === "pending" || status === "in_progress") current.runningTools.add(update.toolCallId);+}