Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Merge pull request #5164 from Rutvij97/feat/handoff-waits
milind-soni69cef2401264
diff --cc server/index.tsindex ac1f293fef,fde8ef1b43..4605644d41--- a/server/index.ts+++ b/server/index.ts@@@ -482,10 -482,10 +482,10 @@@ import { listenWebhookIngress, type Webimport { addressFor } from "./webhook-address.ts";import { assertModelVariantSupported, memberTurnSelection } from "./member-turn.ts";import { WebhookManager } from "./webhooks.ts";- import { tieAutomationsToBots } from "./bot-automations.ts"; import { WaitManager } from "./waits.ts"; import { cancelWaitFromCard, createWaitHost, waitRunChat } from "./wait-host.ts"; import { continuedConversation } from "./routine-same-conversation.ts"; import { createWaitRoutes, findWaitPeer, hostWaitRefusal, waitSourceRefusal, type WaitRouteContext } from "./routes/waits.ts";-import { tieAutomationsToBots } from "./bot-automations.ts"; import { WaitManager } from "./waits.ts"; import { cancelWaitFromCard, createWaitHost, waitRunChat } from "./wait-host.ts"; import { createWaitRoutes, findWaitPeer, handedAssignment, hostWaitRefusal, waitSourceRefusal, type WaitRouteContext } from "./routes/waits.ts";++import { tieAutomationsToBots } from "./bot-automations.ts"; import { WaitManager } from "./waits.ts"; import { cancelWaitFromCard, createWaitHost, waitRunChat } from "./wait-host.ts"; import { continuedConversation } from "./routine-same-conversation.ts"; import { createWaitRoutes, findWaitPeer, handedAssignment, hostWaitRefusal, waitSourceRefusal, type WaitRouteContext } from "./routes/waits.ts";import type { WebhookTrigger } from "../shared/webhooks.ts";import { AGENTS_NODE_FLAG, SPAWNED_PROXIES } from "./proxy-paths.ts";-import { agentsProxyLaunch, agentsToolBridgeEnv, applyAgentsBridge, bridgedToolTitle, turnEngine } from "./agents-bridge-switch.ts"; import { agentsServerEnv, COMPUTER_OFF_REFUSAL, computerPickRefusal, directTurnKind, roomSkillsRefusal, type TurnKind } from "./agents-turn.ts";+import { agentsProxyLaunch, agentsToolBridgeEnv, applyAgentsBridge, bridgedToolTitle, turnEngine } from "./agents-bridge-switch.ts"; import { agentsServerEnv, botDrivenConversation, COMPUTER_OFF_REFUSAL, computerPickRefusal, directTurnKind, roomSkillsRefusal, type TurnKind } from "./agents-turn.ts";import { harnessMcpTokenEnv } from "./harness-mcp-token.ts";import {loadBundledSkills,diff --cc server/system-prompt.tsindex aae196a8d4,d530ac888a..875e8f8744--- a/server/system-prompt.ts+++ b/server/system-prompt.ts@@@ -258,13 -249,10 +258,13 @@@ export const JUST_DO_IT_PROMPTexport const CREDENTIAL_PROMPT =" If a supported API key is missing for the service actually needed, use request_credential to create a secure credential request; a 1Password service account token, for signing in with logins from a 1Password vault, is one too (credential_id onePasswordToken). Before requesting a computer-provider key, inspect the configured targets with select_computer; an existing self-hosted VPS does not need Boat credentials. Do not request a different provider's key merely because a task mentions cloud. For any other secret (a Stripe or npm token, a webhook signing secret), give request_credential a label, reason and delivery: ref for mcp_server, file for your own commands. mcp_server sets up MCP servers in the chat: suggest one when a task needs a service you can't reach yet, and add, turn on or change one once the person asks or agrees. A freshly QR-paired mobile app or the desktop app can show the secure entry card. Never claim it opened unless the request succeeded, and never ask the user to paste credentials into chat.";-/** Ten minutes stays inside the 20-minute turn stall watchdog, which sees nothing while a command runs. */-export const BASH_MAX_TIMEOUT_MS = 600_000;+/** A day: a long command that keeps working is not cut short. The turn watchdog stops one whose processes show neither+ * output nor CPU use for its tool limit (OMB_TOOL_STALL_MS, two hours) and names it as looking stuck. */+export const BASH_MAX_TIMEOUT_MS = 24 * 60 * 60_000;+/** The default cap; a person's own BASH_MAX_TIMEOUT_MS can be lower, so the guidance names this as the most it allows. */+export const BASH_MAX_TIMEOUT_TEXT = `${BASH_MAX_TIMEOUT_MS}, which is ${BASH_MAX_TIMEOUT_MS / 60_000} minutes, unless a lower limit is set here`;const LONG_COMMANDS_TEXT =- ` Long-running shell commands: a shell call is stopped after a default limit (2 minutes for a Bash call) and the output of a stopped command is lost. Before running anything that can take more than a minute, such as transcription (whisper), ffmpeg or ffprobe over long media, renders, large builds or big file transfers, pass a longer per-call timeout (Bash takes \`timeout\` in milliseconds, up to ${BASH_MAX_TIMEOUT_TEXT}) and keep the command in the foreground until it exits; split work that cannot finish within that into shorter pieces. A detached job may be killed when the call ends, so keep work whose result you need in the foreground, and trust only the command's own fresh exit code and output, not a launch exit 0 or an old output file. Never scan the whole disk with \`find /\` or similar: search by name with \`mdfind -name\` on macOS, or search a specific folder such as your workspace or home with a depth limit. If a command times out, do not rerun it the same way. Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or repeated polls): check it once, and if it is still running, tell the person what you made (with links). Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn; work handed to you by a bot, a routine or an outside event cannot set a wait, so finish it in this turn. When the person writes while you work, answer them first.`;- ` Long-running shell commands: a shell call is stopped after a default limit (2 minutes for a Bash call) and the output of a stopped command is lost. Before running anything that can take more than a minute, such as transcription (whisper), ffmpeg or ffprobe over long media, renders, large builds or big file transfers, pass a longer per-call timeout (Bash takes \`timeout\` in milliseconds, up to ${BASH_MAX_TIMEOUT_MS}) and keep the command in the foreground until it exits; split work that cannot finish within that into shorter pieces. A detached job may be killed when the call ends, so keep work whose result you need in the foreground, and trust only the command's own fresh exit code and output, not a launch exit 0 or an old output file. Never scan the whole disk with \`find /\` or similar: search by name with \`mdfind -name\` on macOS, or search a specific folder such as your workspace or home with a depth limit. If a command times out, do not rerun it the same way. Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or repeated polls): check it once, and if it is still running, tell the person what you made (with links). Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn. Work a bot handed you for the person's own request may set one wait_until (not a trigger), cannot cancel it, and ends its turn; the wait's message lands in that work's chat. A routine or an outside event cannot set a wait, so finish it in this turn. When the person writes while you work, answer them first.`;++ ` Long-running shell commands: a shell call is stopped after a default limit (2 minutes for a Bash call) and the output of a stopped command is lost. Before running anything that can take more than a minute, such as transcription (whisper), ffmpeg or ffprobe over long media, renders, large builds or big file transfers, pass a longer per-call timeout (Bash takes \`timeout\` in milliseconds, up to ${BASH_MAX_TIMEOUT_TEXT}) and keep the command in the foreground until it exits; split work that cannot finish within that into shorter pieces. A detached job may be killed when the call ends, so keep work whose result you need in the foreground, and trust only the command's own fresh exit code and output, not a launch exit 0 or an old output file. Never scan the whole disk with \`find /\` or similar: search by name with \`mdfind -name\` on macOS, or search a specific folder such as your workspace or home with a depth limit. If a command times out, do not rerun it the same way. Never wait inside a command for CI, a deploy or any other job to finish (no sleep loops or repeated polls): check it once, and if it is still running, tell the person what you made (with links). Only on a turn the person started in their own chat, set wait_until or a one-time trigger to check back and end your turn. Work a bot handed you for the person's own request may set one wait_until (not a trigger), cannot cancel it, and ends its turn; the wait's message lands in that work's chat. A routine or an outside event cannot set a wait, so finish it in this turn. When the person writes while you work, answer them first.`;const VM_LONG_COMMANDS_TEXT =" In your Local VM, vm_exec takes `timeout_seconds` instead (default 60, at most 300). The VM keeps running between calls, so a job longer than that may start detached inside it (`nohup <command> > /tmp/<job>.log 2>&1 &`); check its log with later vm_exec calls.";export function longCommandsPrompt(computer: ComputerPromptKind | null): string {