Skip to content
预计 1 分钟右侧目录可快速定位

Workspace / Sandbox ​

Grok Bot 的 execution environment 分散在 host/box/、host/local-exec/、runner/tools/、Turn wiring 和 durable state 中。这里不能拿单个 Docker/box 文件代表完整 security boundary。

Runtime 相关映射 ​

文件Symbol / surface观察点
turn-run-shell.tscreateTurnAgentRunContext()shell-watch / scope / resource owner 如何进入 Turn
turn-observation.tslistAsyncTasks()background shell/subagent/cloud-agent 如何统一观察
turn-observation.tsshellRewatchEntries() use sitehost restart 后 reattached shell 如何回到观察面
durable-file-policy.tsdurable filenameshost recovery state 为什么不应混成 workspace snapshot
runner/tools/concrete capabilitiesshell/browser/communication 等“手”如何被独立实现

Reattach 的意义 ​

text
host restart
  ↓
external/background shell 仍可能存在
  ↓
shell rewatch state
  ↓
listAsyncTasks()
  ↓
Runtime 再次看到 running task

这说明 Session State、Workspace State、Process State 不是同一个东西。恢复时需要 reconciliation,而不是只 load 一个 JSON checkpoint 就认为环境完全回来了。

本地定位 ​

bash
rg -n "createTurnAgentRunContext|shellWatchHost|shellRewatchEntries|listAsyncTasks" source/host/runner/turn-run-shell.ts source/host/runner/turn-observation.ts
find source/host/runner/tools -maxdepth 1 -type f | sort
find source/host/box source/host/local-exec -maxdepth 2 -type f | sort | head -80

固定源码 ​

AI Engineering · Agent · Harness · Backend Systems