@greppleai/grip 0.0.1 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/README.md +13 -7
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/cli.js +4 -2
  5. package/dist/bun/cli.js.map +1 -1
  6. package/dist/bun/embedded-assets.d.ts +3 -0
  7. package/dist/bun/embedded-assets.d.ts.map +1 -0
  8. package/dist/bun/embedded-assets.js +52 -0
  9. package/dist/bun/embedded-assets.js.map +1 -0
  10. package/dist/cli/args.d.ts.map +1 -1
  11. package/dist/cli/args.js +1 -0
  12. package/dist/cli/args.js.map +1 -1
  13. package/dist/config.d.ts.map +1 -1
  14. package/dist/config.js +3 -3
  15. package/dist/config.js.map +1 -1
  16. package/dist/core/agent-session.d.ts.map +1 -1
  17. package/dist/core/agent-session.js +17 -2
  18. package/dist/core/agent-session.js.map +1 -1
  19. package/dist/core/extensions/types.d.ts +5 -1
  20. package/dist/core/extensions/types.d.ts.map +1 -1
  21. package/dist/core/extensions/types.js.map +1 -1
  22. package/dist/core/remote-workspace-protocol/contract.d.ts +13 -4
  23. package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -1
  24. package/dist/core/remote-workspace-protocol/contract.js +17 -1
  25. package/dist/core/remote-workspace-protocol/contract.js.map +1 -1
  26. package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts +16 -0
  27. package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -0
  28. package/dist/core/remote-workspace-protocol/guest-shared-client.js +54 -0
  29. package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -0
  30. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts +23 -0
  31. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -0
  32. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +112 -0
  33. package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -0
  34. package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts +30 -0
  35. package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -0
  36. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +243 -0
  37. package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -0
  38. package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts +3 -0
  39. package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -0
  40. package/dist/core/remote-workspace-protocol/lima-owner-directory.js +31 -0
  41. package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -0
  42. package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts +9 -0
  43. package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -0
  44. package/dist/core/remote-workspace-protocol/lima-owner-lock.js +89 -0
  45. package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -0
  46. package/dist/core/remote-workspace-protocol/session.d.ts +2 -0
  47. package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -1
  48. package/dist/core/remote-workspace-protocol/session.js +3 -0
  49. package/dist/core/remote-workspace-protocol/session.js.map +1 -1
  50. package/dist/core/remote-workspace-protocol/shared-transport.d.ts +71 -0
  51. package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -0
  52. package/dist/core/remote-workspace-protocol/shared-transport.js +68 -0
  53. package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -0
  54. package/dist/core/sandbox/command.d.ts +2 -4
  55. package/dist/core/sandbox/command.d.ts.map +1 -1
  56. package/dist/core/sandbox/command.js +24 -46
  57. package/dist/core/sandbox/command.js.map +1 -1
  58. package/dist/core/sandbox/config.d.ts +91 -0
  59. package/dist/core/sandbox/config.d.ts.map +1 -0
  60. package/dist/core/sandbox/config.js +88 -0
  61. package/dist/core/sandbox/config.js.map +1 -0
  62. package/dist/core/sandbox/lima-guest-binary.d.ts +11 -0
  63. package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -0
  64. package/dist/core/sandbox/lima-guest-binary.js +140 -0
  65. package/dist/core/sandbox/lima-guest-binary.js.map +1 -0
  66. package/dist/core/sandbox/lima.d.ts +22 -3
  67. package/dist/core/sandbox/lima.d.ts.map +1 -1
  68. package/dist/core/sandbox/lima.js +434 -42
  69. package/dist/core/sandbox/lima.js.map +1 -1
  70. package/dist/core/sandbox/shared-lima-roots.d.ts +11 -0
  71. package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -0
  72. package/dist/core/sandbox/shared-lima-roots.js +25 -0
  73. package/dist/core/sandbox/shared-lima-roots.js.map +1 -0
  74. package/dist/core/sandbox/update-shared-guest-binary.d.ts +8 -0
  75. package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -0
  76. package/dist/core/sandbox/update-shared-guest-binary.js +100 -0
  77. package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -0
  78. package/dist/core/settings-manager.d.ts +1 -5
  79. package/dist/core/settings-manager.d.ts.map +1 -1
  80. package/dist/core/settings-manager.js.map +1 -1
  81. package/dist/core/tools/bash.d.ts.map +1 -1
  82. package/dist/core/tools/bash.js +25 -14
  83. package/dist/core/tools/bash.js.map +1 -1
  84. package/dist/core/tools/file-mutation-queue.d.ts +2 -0
  85. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  86. package/dist/core/tools/file-mutation-queue.js +9 -0
  87. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  88. package/dist/core/tools/find.d.ts.map +1 -1
  89. package/dist/core/tools/find.js +2 -3
  90. package/dist/core/tools/find.js.map +1 -1
  91. package/dist/core/tools/grep.d.ts.map +1 -1
  92. package/dist/core/tools/grep.js +2 -3
  93. package/dist/core/tools/grep.js.map +1 -1
  94. package/dist/core/tools/ls.d.ts.map +1 -1
  95. package/dist/core/tools/ls.js +2 -3
  96. package/dist/core/tools/ls.js.map +1 -1
  97. package/dist/core/tools/operations.d.ts +13 -2
  98. package/dist/core/tools/operations.d.ts.map +1 -1
  99. package/dist/core/tools/operations.js +132 -36
  100. package/dist/core/tools/operations.js.map +1 -1
  101. package/dist/core/tools/read.d.ts.map +1 -1
  102. package/dist/core/tools/read.js +3 -3
  103. package/dist/core/tools/read.js.map +1 -1
  104. package/dist/core/tools/render-utils.d.ts +1 -0
  105. package/dist/core/tools/render-utils.d.ts.map +1 -1
  106. package/dist/core/tools/render-utils.js +5 -0
  107. package/dist/core/tools/render-utils.js.map +1 -1
  108. package/dist/core/tools/write.d.ts.map +1 -1
  109. package/dist/core/tools/write.js +2 -3
  110. package/dist/core/tools/write.js.map +1 -1
  111. package/dist/daemon/activity-budget.d.ts +10 -0
  112. package/dist/daemon/activity-budget.d.ts.map +1 -0
  113. package/dist/daemon/activity-budget.js +34 -0
  114. package/dist/daemon/activity-budget.js.map +1 -0
  115. package/dist/daemon/config.d.ts +2 -0
  116. package/dist/daemon/config.d.ts.map +1 -1
  117. package/dist/daemon/config.js +15 -0
  118. package/dist/daemon/config.js.map +1 -1
  119. package/dist/daemon/outbound-budget.d.ts +10 -0
  120. package/dist/daemon/outbound-budget.d.ts.map +1 -0
  121. package/dist/daemon/outbound-budget.js +30 -0
  122. package/dist/daemon/outbound-budget.js.map +1 -0
  123. package/dist/daemon/security.d.ts.map +1 -1
  124. package/dist/daemon/security.js +3 -1
  125. package/dist/daemon/security.js.map +1 -1
  126. package/dist/daemon/server.d.ts.map +1 -1
  127. package/dist/daemon/server.js +104 -24
  128. package/dist/daemon/server.js.map +1 -1
  129. package/dist/daemon/shared-connection.d.ts +33 -0
  130. package/dist/daemon/shared-connection.d.ts.map +1 -0
  131. package/dist/daemon/shared-connection.js +271 -0
  132. package/dist/daemon/shared-connection.js.map +1 -0
  133. package/dist/daemon/shared-revision.d.ts +5 -0
  134. package/dist/daemon/shared-revision.d.ts.map +1 -0
  135. package/dist/daemon/shared-revision.js +61 -0
  136. package/dist/daemon/shared-revision.js.map +1 -0
  137. package/dist/daemon/shared-roots.d.ts +9 -0
  138. package/dist/daemon/shared-roots.d.ts.map +1 -0
  139. package/dist/daemon/shared-roots.js +33 -0
  140. package/dist/daemon/shared-roots.js.map +1 -0
  141. package/dist/daemon/workspace-runtime.d.ts +1 -1
  142. package/dist/daemon/workspace-runtime.d.ts.map +1 -1
  143. package/dist/daemon/workspace-runtime.js +42 -10
  144. package/dist/daemon/workspace-runtime.js.map +1 -1
  145. package/dist/main.d.ts.map +1 -1
  146. package/dist/main.js +5 -3
  147. package/dist/main.js.map +1 -1
  148. package/dist/modes/interactive/components/assistant-message.d.ts +1 -0
  149. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  150. package/dist/modes/interactive/components/assistant-message.js +13 -3
  151. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  152. package/dist/modes/interactive/components/branch-summary-message.d.ts +4 -3
  153. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  154. package/dist/modes/interactive/components/branch-summary-message.js +5 -4
  155. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  156. package/dist/modes/interactive/components/compaction-summary-message.d.ts +4 -3
  157. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  158. package/dist/modes/interactive/components/compaction-summary-message.js +5 -4
  159. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  160. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  161. package/dist/modes/interactive/components/custom-message.js +4 -3
  162. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  163. package/dist/modes/interactive/components/hook-execution.d.ts +3 -0
  164. package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -1
  165. package/dist/modes/interactive/components/hook-execution.js +20 -2
  166. package/dist/modes/interactive/components/hook-execution.js.map +1 -1
  167. package/dist/modes/interactive/components/message-card.d.ts +9 -0
  168. package/dist/modes/interactive/components/message-card.d.ts.map +1 -0
  169. package/dist/modes/interactive/components/message-card.js +24 -0
  170. package/dist/modes/interactive/components/message-card.js.map +1 -0
  171. package/dist/modes/interactive/components/skill-invocation-message.d.ts +4 -3
  172. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  173. package/dist/modes/interactive/components/skill-invocation-message.js +5 -4
  174. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  175. package/dist/modes/interactive/components/tool-execution.d.ts +1 -1
  176. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  177. package/dist/modes/interactive/components/tool-execution.js +27 -21
  178. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  179. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  180. package/dist/modes/interactive/components/user-message.js +3 -2
  181. package/dist/modes/interactive/components/user-message.js.map +1 -1
  182. package/dist/modes/interactive/interactive-mode.d.ts +1 -3
  183. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  184. package/dist/modes/interactive/interactive-mode.js +106 -47
  185. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  186. package/dist/modes/interactive/theme/theme.d.ts +3 -0
  187. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  188. package/dist/modes/interactive/theme/theme.js +10 -0
  189. package/dist/modes/interactive/theme/theme.js.map +1 -1
  190. package/dist/utils/clipboard-native.d.ts.map +1 -1
  191. package/dist/utils/clipboard-native.js +1 -1
  192. package/dist/utils/clipboard-native.js.map +1 -1
  193. package/dist/utils/image-resize.d.ts.map +1 -1
  194. package/dist/utils/image-resize.js +5 -0
  195. package/dist/utils/image-resize.js.map +1 -1
  196. package/dist/utils/photon.d.ts.map +1 -1
  197. package/dist/utils/photon.js +1 -0
  198. package/dist/utils/photon.js.map +1 -1
  199. package/docs/daemon.md +6 -4
  200. package/docs/docs.json +1 -1
  201. package/docs/extensions.md +3 -0
  202. package/docs/index.md +8 -12
  203. package/docs/packages.md +3 -3
  204. package/docs/quickstart.md +11 -19
  205. package/docs/sandbox.md +40 -117
  206. package/docs/settings.md +12 -11
  207. package/docs/termux.md +1 -18
  208. package/docs/usage.md +2 -2
  209. package/examples/README.md +0 -2
  210. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  211. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  212. package/examples/extensions/sandbox/package.json +1 -1
  213. package/examples/extensions/with-deps/package.json +1 -1
  214. package/npm-shrinkwrap.json +12 -12
  215. package/package.json +5 -6
  216. package/dist/core/sandbox/docker.d.ts +0 -169
  217. package/dist/core/sandbox/docker.d.ts.map +0 -1
  218. package/dist/core/sandbox/docker.js +0 -633
  219. package/dist/core/sandbox/docker.js.map +0 -1
  220. package/examples/sandbox-docker/Dockerfile +0 -274
  221. package/examples/sandbox-docker/README.md +0 -88
@@ -1 +0,0 @@
1
- {"version":3,"file":"docker.js","sourceRoot":"","sources":["../../../src/core/sandbox/docker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,uCAAuC,CAAC;AAC7E,MAAM,CAAC,MAAM,+BAA+B,GAAG,YAAY,CAAC;AAC5D,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAChD,MAAM,CAAC,MAAM,6BAA6B,GAAG,QAAQ,CAAC;AACtD,MAAM,CAAC,MAA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G,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;IAC7B,CAAC;IACD,OAAO,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAAA,CAC3D","sourcesContent":["import { createHash, randomBytes } from \"node:crypto\";\nimport { open, readFile, stat, unlink } from \"node:fs/promises\";\nimport { createConnection, createServer } from \"node:net\";\nimport { tmpdir } from \"node:os\";\nimport { basename, join, resolve } from \"node:path\";\nimport { VERSION } from \"../../config.ts\";\nimport { DAEMON_WEBSOCKET_PATH } from \"../../daemon/config.ts\";\nimport { spawnProcess } from \"../../utils/child-process.ts\";\nimport type { SandboxSettings, SettingsManager } from \"../settings-manager.ts\";\n\nexport const DEFAULT_SANDBOX_IMAGE = \"ghcr.io/greppleai/grip-sandbox:latest\";\nexport const DEFAULT_SANDBOX_WORKSPACE_MOUNT = \"/workspace\";\nexport const DEFAULT_SANDBOX_DAEMON_PORT = 8787;\nexport const DEFAULT_SANDBOX_DOCKER_BINARY = \"docker\";\nexport const DEFAULT_SANDBOX_LIMA_BINARY = \"limactl\";\nexport const DEFAULT_SANDBOX_LIMA_TEMPLATE = \"template:docker-rootful\";\nexport const SANDBOX_LABEL_PREFIX = \"ai.greppleai.grip\";\nexport const SANDBOX_LABEL_ENABLED = `${SANDBOX_LABEL_PREFIX}.sandbox`;\nexport const SANDBOX_LABEL_WORKSPACE_HASH = `${SANDBOX_LABEL_PREFIX}.workspace-hash`;\nexport const SANDBOX_LABEL_WORKSPACE_MOUNT = `${SANDBOX_LABEL_PREFIX}.workspace-mount`;\nexport const SANDBOX_LABEL_DAEMON_PORT = `${SANDBOX_LABEL_PREFIX}.daemon-port`;\nexport const SANDBOX_LABEL_OWNER_UID = `${SANDBOX_LABEL_PREFIX}.owner-uid`;\nexport const SANDBOX_LABEL_VERSION = `${SANDBOX_LABEL_PREFIX}.version`;\nexport const SANDBOX_LABEL_SESSION = `${SANDBOX_LABEL_PREFIX}.session`;\n\nconst reservedSandboxDaemonPorts = new Set<number>();\nconst sandboxPortLockPath = join(tmpdir(), `greppleai-grip-sandbox-port-${process.getuid?.() ?? \"user\"}.lock`);\nlet sandboxStartQueue: Promise<void> = Promise.resolve();\n\nfunction isProcessAlive(pid: number): boolean {\n\ttry {\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"EPERM\";\n\t}\n}\nasync function isSandboxPortLockStale(): Promise<boolean> {\n\ttry {\n\t\tconst owner = JSON.parse(await readFile(sandboxPortLockPath, \"utf8\")) as { pid?: unknown };\n\t\treturn typeof owner.pid === \"number\" && !isProcessAlive(owner.pid);\n\t} catch {\n\t\ttry {\n\t\t\treturn Date.now() - (await stat(sandboxPortLockPath)).mtimeMs > 10_000;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\nasync function acquireSandboxPortLock(): Promise<() => Promise<void>> {\n\tconst token = `${process.pid}:${randomBytes(16).toString(\"hex\")}`;\n\tconst deadline = Date.now() + 30_000;\n\twhile (Date.now() < deadline) {\n\t\ttry {\n\t\t\tconst handle = await open(sandboxPortLockPath, \"wx\", 0o600);\n\t\t\tawait handle.writeFile(JSON.stringify({ pid: process.pid, token }));\n\t\t\treturn async () => {\n\t\t\t\tawait handle.close();\n\t\t\t\ttry {\n\t\t\t\t\tconst current = JSON.parse(await readFile(sandboxPortLockPath, \"utf8\")) as { token?: unknown };\n\t\t\t\t\tif (current.token === token) await unlink(sandboxPortLockPath);\n\t\t\t\t} catch {}\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof Error && \"code\" in error && error.code === \"EEXIST\")) throw error;\n\t\t\tconst stale = await isSandboxPortLockStale();\n\t\t\tif (stale) {\n\t\t\t\tawait unlink(sandboxPortLockPath).catch(() => undefined);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tawait new Promise((resolveDelay) => setTimeout(resolveDelay, 50));\n\t\t}\n\t}\n\tthrow new Error(\"Timed out waiting for the sandbox daemon port allocation lock\");\n}\n\nasync function withSandboxStartLock<T>(operation: () => Promise<T>): Promise<T> {\n\tconst previous = sandboxStartQueue;\n\tlet release!: () => void;\n\tsandboxStartQueue = new Promise<void>((resolveQueue) => {\n\t\trelease = resolveQueue;\n\t});\n\tawait previous;\n\tlet releaseFileLock: (() => Promise<void>) | undefined;\n\ttry {\n\t\treleaseFileLock = await acquireSandboxPortLock();\n\t\treturn await operation();\n\t} finally {\n\t\ttry {\n\t\t\tawait releaseFileLock?.();\n\t\t} finally {\n\t\t\trelease();\n\t\t}\n\t}\n}\n\nexport type SandboxCleanupBehavior = \"stop\" | \"remove\";\nexport type SandboxRuntime = \"docker\" | \"lima\";\n\nexport interface SandboxConfig {\n\truntime: SandboxRuntime;\n\timage: string;\n\tdockerBinary: string;\n\tlimaBinary: string;\n\tlimaTemplate: string;\n\tlimaInstanceNamePrefix: string;\n\tworkspaceMountPath: string;\n\tcontainerNamePrefix: string;\n\tdaemonPort: number;\n\tdaemonHostBind: string;\n\tcleanup: SandboxCleanupBehavior;\n\townerUid: string | undefined;\n}\n\nexport type SandboxConfigOverrides = SandboxSettings;\n\nexport interface SandboxEnvironment {\n\tGRIP_SANDBOX_RUNTIME?: string;\n\tGRIP_SANDBOX_IMAGE?: string;\n\tGRIP_SANDBOX_DOCKER?: string;\n\tGRIP_SANDBOX_LIMA?: string;\n\tGRIP_SANDBOX_LIMA_TEMPLATE?: string;\n\tGRIP_SANDBOX_LIMA_INSTANCE_PREFIX?: string;\n\tGRIP_SANDBOX_WORKSPACE_MOUNT?: string;\n\tGRIP_SANDBOX_CONTAINER_PREFIX?: string;\n\tGRIP_SANDBOX_DAEMON_PORT?: string;\n\tGRIP_SANDBOX_DAEMON_HOST_BIND?: string;\n\tGRIP_SANDBOX_CLEANUP?: string;\n}\n\nexport interface SandboxStartOptions extends SandboxConfigOverrides {\n\tworkspaceRoot: string;\n\tsessionId?: string;\n\tname?: string;\n}\n\nexport interface SandboxListOptions {\n\tworkspaceRoot: string;\n\tallWorkspaces?: boolean;\n}\n\nexport interface SandboxStopOptions {\n\tworkspaceRoot: string;\n\ttarget?: string;\n\tcurrentContainerId?: string;\n}\n\nexport interface DockerRunInvocation {\n\tcommand: string;\n\targs: string[];\n\tenv: Record<string, string>;\n\ttoken: string;\n\tcontainerName: string;\n\tlabels: Record<string, string>;\n\tworkspaceRoot: string;\n\tworkspaceHash: string;\n}\n\nexport interface SandboxContainer {\n\tid: string;\n\tname: string;\n\timage: string;\n\tstatus: string;\n\tstate: string | undefined;\n\tcreatedAt: string | undefined;\n\tworkspaceRoot: string | undefined;\n\tworkspaceMountPath: string | undefined;\n\tdaemonPort: number | undefined;\n\tdaemonEndpoint: string | undefined;\n\tlabels: Record<string, string>;\n}\n\nexport interface SandboxStartResult {\n\tcontainerId: string;\n\tcontainerName: string;\n\tworkspaceRoot: string;\n\tworkspaceMountPath: string;\n\tdaemonUrl: string;\n\tdaemonUrlRedacted: string;\n\ttoken: string;\n\tlabels: Record<string, string>;\n}\n\nexport type SandboxStopResult =\n\t| { status: \"stopped\"; container: SandboxContainer }\n\t| { status: \"removed\"; container: SandboxContainer }\n\t| { status: \"already-stopped\"; container: SandboxContainer }\n\t| { status: \"not-found\"; message: string };\n\nexport interface SandboxService {\n\tresolveConfig(overrides?: SandboxConfigOverrides): SandboxConfig;\n\tstart(options: SandboxStartOptions): Promise<SandboxStartResult>;\n\tlist(options: SandboxListOptions): Promise<SandboxContainer[]>;\n\tstop(options: SandboxStopOptions): Promise<SandboxStopResult>;\n}\n\nexport interface DockerCommandResult {\n\texitCode: number | null;\n\tstdout: string;\n\tstderr: string;\n}\n\nexport interface DockerCommandOptions {\n\tenv?: Record<string, string>;\n}\n\nexport interface DockerRunner {\n\trun(command: string, args: string[], options?: DockerCommandOptions): Promise<DockerCommandResult>;\n}\nexport interface ManagedSandboxContainer {\n\tworkspaceRoot: string;\n\tdaemonPort: number;\n\townerId?: string;\n}\n\nexport interface DockerSandboxServiceOptions {\n\tsettingsManager?: Pick<SettingsManager, \"getSandboxSettings\">;\n\tenv?: SandboxEnvironment;\n\trunner?: DockerRunner;\n\ttokenGenerator?: () => string;\n\tportAllocator?: (host: string, preferredPort: number) => Promise<number>;\n\treadinessWaiter?: (host: string, port: number) => Promise<void>;\n\tmanagedContainers?: Map<string, ManagedSandboxContainer>;\n}\n\ninterface DockerPsRecord {\n\tID?: string;\n\tNames?: string;\n\tImage?: string;\n\tStatus?: string;\n\tState?: string;\n\tCreatedAt?: string;\n\tLabels?: string;\n\tPorts?: string;\n}\n\ninterface DockerInspectMount {\n\tType?: string;\n\tSource?: string;\n\tDestination?: string;\n}\n\ninterface DockerInspectPortBinding {\n\tHostIp?: string;\n\tHostPort?: string;\n}\n\ninterface DockerInspectConfig {\n\tImage?: string;\n\tLabels?: Record<string, string>;\n}\n\ninterface DockerInspectState {\n\tStatus?: string;\n\tRunning?: boolean;\n\tStartedAt?: string;\n}\n\ninterface DockerInspectNetworkSettings {\n\tPorts?: Record<string, DockerInspectPortBinding[] | null>;\n}\n\ninterface DockerInspectRecord {\n\tId?: string;\n\tName?: string;\n\tConfig?: DockerInspectConfig;\n\tState?: DockerInspectState;\n\tCreated?: string;\n\tMounts?: DockerInspectMount[];\n\tNetworkSettings?: DockerInspectNetworkSettings;\n}\n\nclass ProcessDockerRunner implements DockerRunner {\n\trun(command: string, args: string[], options: DockerCommandOptions = {}): Promise<DockerCommandResult> {\n\t\treturn new Promise((resolveCommand, reject) => {\n\t\t\tconst child = spawnProcess(command, args, {\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\tenv: { ...process.env, ...options.env },\n\t\t\t});\n\t\t\tlet stdout = \"\";\n\t\t\tlet stderr = \"\";\n\t\t\tchild.stdout?.on(\"data\", (chunk: Buffer) => {\n\t\t\t\tstdout += chunk.toString(\"utf8\");\n\t\t\t});\n\t\t\tchild.stderr?.on(\"data\", (chunk: Buffer) => {\n\t\t\t\tstderr += chunk.toString(\"utf8\");\n\t\t\t});\n\t\t\tchild.once(\"error\", reject);\n\t\t\tchild.once(\"close\", (exitCode) => resolveCommand({ exitCode, stdout, stderr }));\n\t\t});\n\t}\n}\n\nfunction nonEmpty(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nfunction parseRuntime(value: string | undefined, settingName: string): SandboxRuntime | undefined {\n\tif (value === undefined) return undefined;\n\tif (value === \"docker\" || value === \"lima\") return value;\n\tthrow new Error(`Invalid ${settingName}: expected docker or lima`);\n}\n\nfunction parsePositiveInteger(value: string | number | undefined, settingName: string): number | undefined {\n\tif (value === undefined) return undefined;\n\tconst text = String(value).trim();\n\tif (!/^\\d+$/.test(text)) throw new Error(`Invalid ${settingName}: expected a decimal integer`);\n\tconst parsed = Number(text);\n\tif (!Number.isSafeInteger(parsed) || parsed < 1 || parsed > 65535) {\n\t\tthrow new Error(`Invalid ${settingName}: expected a port from 1 to 65535`);\n\t}\n\treturn parsed;\n}\n\nfunction parseCleanup(value: string | undefined, settingName: string): SandboxCleanupBehavior | undefined {\n\tif (value === undefined) return undefined;\n\tif (value === \"stop\" || value === \"remove\") return value;\n\tthrow new Error(`Invalid ${settingName}: expected stop or remove`);\n}\n\nfunction parseLabels(text: string | undefined): Record<string, string> {\n\tconst labels: Record<string, string> = {};\n\tif (!text) return labels;\n\tfor (const entry of text.split(\",\")) {\n\t\tconst separator = entry.indexOf(\"=\");\n\t\tif (separator === -1) continue;\n\t\tlabels[entry.slice(0, separator)] = entry.slice(separator + 1);\n\t}\n\treturn labels;\n}\n\nfunction sanitizeNameSegment(value: string): string {\n\tconst sanitized = value\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9_.-]+/g, \"-\")\n\t\t.replace(/^-+|-+$/g, \"\");\n\treturn sanitized || \"workspace\";\n}\n\nfunction getWorkspaceHash(workspaceRoot: string): string {\n\treturn createHash(\"sha256\").update(resolve(workspaceRoot)).digest(\"hex\").slice(0, 16);\n}\n\nfunction getOwnerUid(): string | undefined {\n\tconst uid = process.getuid?.();\n\treturn uid === undefined ? undefined : String(uid);\n}\n\nfunction generateToken(): string {\n\treturn randomBytes(32).toString(\"base64url\");\n}\n\nasync function tryReservePort(host: string, port: number): Promise<number | undefined> {\n\treturn new Promise((resolvePort) => {\n\t\tconst server = createServer();\n\t\tserver.unref();\n\t\tserver.once(\"error\", () => resolvePort(undefined));\n\t\tserver.listen({ host, port, exclusive: true }, () => {\n\t\t\tconst address = server.address();\n\t\t\tconst selectedPort = typeof address === \"object\" && address ? address.port : undefined;\n\t\t\tserver.close(() => resolvePort(selectedPort));\n\t\t});\n\t});\n}\n\nexport async function allocateSandboxDaemonPort(host: string, preferredPort: number): Promise<number> {\n\tconst preferred = await tryReservePort(host, preferredPort);\n\tif (preferred !== undefined) return preferred;\n\tconst fallback = await tryReservePort(host, 0);\n\tif (fallback === undefined) throw new Error(`Unable to allocate a sandbox daemon port on ${host}`);\n\treturn fallback;\n}\n\nasync function canConnect(host: string, port: number): Promise<boolean> {\n\treturn new Promise((resolveConnection) => {\n\t\tconst socket = createConnection({ host, port });\n\t\tlet settled = false;\n\t\tconst finish = (connected: boolean): void => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tsocket.destroy();\n\t\t\tresolveConnection(connected);\n\t\t};\n\t\tsocket.setTimeout(250, () => finish(false));\n\t\tsocket.once(\"connect\", () => finish(true));\n\t\tsocket.once(\"error\", () => finish(false));\n\t});\n}\n\nasync function waitForSandboxDaemonPort(host: string, port: number): Promise<void> {\n\tconst connectHost = host === \"0.0.0.0\" ? \"127.0.0.1\" : host;\n\tconst deadline = Date.now() + 15_000;\n\twhile (Date.now() < deadline) {\n\t\tif (await canConnect(connectHost, port)) return;\n\t\tawait new Promise((resolveDelay) => setTimeout(resolveDelay, 100));\n\t}\n\tthrow new Error(`Sandbox daemon did not bind ${connectHost}:${port} within 15 seconds`);\n}\n\nfunction ensureSuccessful(result: DockerCommandResult, args: string[]): void {\n\tif (result.exitCode === 0) return;\n\tconst detail = result.stderr.trim() || result.stdout.trim() || `exit code ${result.exitCode ?? \"unknown\"}`;\n\tthrow new Error(redactSecrets(`Docker command failed: docker ${args.join(\" \")}: ${detail}`));\n}\n\nfunction parseJsonLines<T>(text: string): T[] {\n\treturn text\n\t\t.split(/\\r?\\n/)\n\t\t.map((line) => line.trim())\n\t\t.filter((line) => line.length > 0)\n\t\t.map((line) => JSON.parse(line) as T);\n}\n\nfunction parseJsonArray<T>(text: string): T[] {\n\tconst trimmed = text.trim();\n\tif (!trimmed) return [];\n\tconst parsed = JSON.parse(trimmed) as unknown;\n\treturn Array.isArray(parsed) ? (parsed as T[]) : [parsed as T];\n}\n\nfunction getEndpointFromPorts(\n\tports: Record<string, DockerInspectPortBinding[] | null> | undefined,\n\tdaemonPort: number,\n): string | undefined {\n\tconst bindings = ports?.[`${daemonPort}/tcp`];\n\tconst binding = bindings?.[0];\n\tif (!binding?.HostPort) return undefined;\n\tconst host = daemonConnectionHost(binding.HostIp || \"127.0.0.1\");\n\treturn `ws://${urlHost(host)}:${binding.HostPort}${DAEMON_WEBSOCKET_PATH}`;\n}\n\nexport function redactSecrets(value: string): string {\n\treturn value\n\t\t.replace(/(GRIP_DAEMON_TOKEN=)[^\\s,;]+/g, \"$1[REDACTED]\")\n\t\t.replace(/(PI_DAEMON_TOKEN=)[^\\s,;]+/g, \"$1[REDACTED]\")\n\t\t.replace(/(Authorization:\\s*Bearer\\s+)[^\\s,;]+/gi, \"$1[REDACTED]\")\n\t\t.replace(/([?&]token=)[^\\s&]+/gi, \"$1[REDACTED]\");\n}\n\nexport function resolveSandboxConfig(\n\tsettings: SandboxSettings | undefined,\n\tenv: SandboxEnvironment = {},\n\toverrides: SandboxConfigOverrides = {},\n): SandboxConfig {\n\tconst runtime =\n\t\tparseRuntime(overrides.runtime, \"sandbox.runtime\") ??\n\t\tparseRuntime(env.GRIP_SANDBOX_RUNTIME, \"GRIP_SANDBOX_RUNTIME\") ??\n\t\tparseRuntime(settings?.runtime, \"sandbox.runtime\") ??\n\t\t\"docker\";\n\tconst image =\n\t\tnonEmpty(overrides.image) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_IMAGE) ??\n\t\tnonEmpty(settings?.image) ??\n\t\tDEFAULT_SANDBOX_IMAGE;\n\tconst dockerBinary =\n\t\tnonEmpty(overrides.dockerBinary) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_DOCKER) ??\n\t\tnonEmpty(settings?.dockerBinary) ??\n\t\tDEFAULT_SANDBOX_DOCKER_BINARY;\n\tconst limaBinary =\n\t\tnonEmpty(overrides.limaBinary) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_LIMA) ??\n\t\tnonEmpty(settings?.limaBinary) ??\n\t\tDEFAULT_SANDBOX_LIMA_BINARY;\n\tconst limaTemplate =\n\t\tnonEmpty(overrides.limaTemplate) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_LIMA_TEMPLATE) ??\n\t\tnonEmpty(settings?.limaTemplate) ??\n\t\tDEFAULT_SANDBOX_LIMA_TEMPLATE;\n\tconst limaInstanceNamePrefix =\n\t\tnonEmpty(overrides.limaInstanceNamePrefix) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_LIMA_INSTANCE_PREFIX) ??\n\t\tnonEmpty(settings?.limaInstanceNamePrefix) ??\n\t\t\"grip-sandbox\";\n\tconst workspaceMountPath =\n\t\tnonEmpty(overrides.workspaceMountPath) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_WORKSPACE_MOUNT) ??\n\t\tnonEmpty(settings?.workspaceMountPath) ??\n\t\tDEFAULT_SANDBOX_WORKSPACE_MOUNT;\n\tconst containerNamePrefix =\n\t\tnonEmpty(overrides.containerNamePrefix) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_CONTAINER_PREFIX) ??\n\t\tnonEmpty(settings?.containerNamePrefix) ??\n\t\t\"grip-sandbox\";\n\tconst daemonPort =\n\t\toverrides.daemonPort ??\n\t\tparsePositiveInteger(env.GRIP_SANDBOX_DAEMON_PORT, \"GRIP_SANDBOX_DAEMON_PORT\") ??\n\t\tparsePositiveInteger(settings?.daemonPort, \"sandbox.daemonPort\") ??\n\t\tDEFAULT_SANDBOX_DAEMON_PORT;\n\tconst daemonHostBind =\n\t\tnonEmpty(overrides.daemonHostBind) ??\n\t\tnonEmpty(env.GRIP_SANDBOX_DAEMON_HOST_BIND) ??\n\t\tnonEmpty(settings?.daemonHostBind) ??\n\t\t\"127.0.0.1\";\n\tconst cleanup =\n\t\toverrides.cleanup ??\n\t\tparseCleanup(env.GRIP_SANDBOX_CLEANUP, \"GRIP_SANDBOX_CLEANUP\") ??\n\t\tparseCleanup(settings?.cleanup, \"sandbox.cleanup\") ??\n\t\t\"stop\";\n\treturn {\n\t\truntime,\n\t\timage,\n\t\tdockerBinary,\n\t\tlimaBinary,\n\t\tlimaTemplate,\n\t\tlimaInstanceNamePrefix,\n\t\tworkspaceMountPath,\n\t\tcontainerNamePrefix,\n\t\tdaemonPort,\n\t\tdaemonHostBind,\n\t\tcleanup,\n\t\townerUid: getOwnerUid(),\n\t};\n}\n\nfunction dockerPublishHost(host: string): string {\n\treturn host.includes(\":\") && !host.startsWith(\"[\") ? `[${host}]` : host;\n}\n\nfunction daemonConnectionHost(host: string): string {\n\tif (host === \"0.0.0.0\") return \"127.0.0.1\";\n\tif (host === \"::\") return \"::1\";\n\treturn host;\n}\n\nfunction urlHost(host: string): string {\n\treturn host.includes(\":\") && !host.startsWith(\"[\") ? `[${host}]` : host;\n}\n\nexport function createSandboxLabels(\n\tconfig: SandboxConfig,\n\tworkspaceRoot: string,\n\tsessionId: string,\n): Record<string, string> {\n\tconst labels: Record<string, string> = {\n\t\t[SANDBOX_LABEL_ENABLED]: \"true\",\n\t\t[SANDBOX_LABEL_WORKSPACE_HASH]: getWorkspaceHash(workspaceRoot),\n\t\t[SANDBOX_LABEL_WORKSPACE_MOUNT]: config.workspaceMountPath,\n\t\t[SANDBOX_LABEL_DAEMON_PORT]: String(config.daemonPort),\n\t\t[SANDBOX_LABEL_VERSION]: VERSION,\n\t\t[SANDBOX_LABEL_SESSION]: sessionId,\n\t};\n\tif (config.ownerUid) labels[SANDBOX_LABEL_OWNER_UID] = config.ownerUid;\n\treturn labels;\n}\n\nexport function createSandboxContainerName(\n\tconfig: SandboxConfig,\n\tworkspaceRoot: string,\n\tsessionId: string,\n\tinstanceId?: string,\n): string {\n\tconst base = `${sanitizeNameSegment(config.containerNamePrefix)}-${sanitizeNameSegment(basename(resolve(workspaceRoot)))}-${getWorkspaceHash(workspaceRoot)}-${sanitizeNameSegment(sessionId).slice(0, 16)}`;\n\treturn instanceId ? `${base}-${sanitizeNameSegment(instanceId).slice(0, 8)}` : base;\n}\n\nexport function buildDockerRunInvocation(\n\tconfig: SandboxConfig,\n\toptions: SandboxStartOptions,\n\ttoken: string = generateToken(),\n): DockerRunInvocation {\n\tconst workspaceRoot = resolve(options.workspaceRoot);\n\tconst sessionId = options.sessionId ?? randomBytes(8).toString(\"hex\");\n\tconst labels = createSandboxLabels(config, workspaceRoot, sessionId);\n\tconst containerName = createSandboxContainerName(\n\t\tconfig,\n\t\tworkspaceRoot,\n\t\tsessionId,\n\t\tcreateHash(\"sha256\").update(token).digest(\"hex\"),\n\t);\n\tconst args = [\n\t\t\"run\",\n\t\t\"--detach\",\n\t\t\"--network\",\n\t\t\"bridge\",\n\t\t\"--publish\",\n\t\t`${dockerPublishHost(config.daemonHostBind)}:${config.daemonPort}:${config.daemonPort}`,\n\t\t\"--name\",\n\t\tcontainerName,\n\t\t\"--workdir\",\n\t\tconfig.workspaceMountPath,\n\t\t\"--mount\",\n\t\t`type=bind,source=${workspaceRoot},target=${config.workspaceMountPath}`,\n\t\t\"--env\",\n\t\t\"GRIP_DAEMON_TOKEN\",\n\t];\n\tfor (const [key, value] of Object.entries(labels)) args.push(\"--label\", `${key}=${value}`);\n\targs.push(\n\t\tconfig.image,\n\t\t\"grip\",\n\t\t\"--daemon\",\n\t\t\"--daemon-host\",\n\t\t\"0.0.0.0\",\n\t\t\"--daemon-allow-insecure-transport\",\n\t\t\"--daemon-port\",\n\t\tString(config.daemonPort),\n\t\t\"--daemon-cwd\",\n\t\tconfig.workspaceMountPath,\n\t\t\"--daemon-allow-root\",\n\t\t\"--daemon-allow-process-exec\",\n\t);\n\treturn {\n\t\tcommand: config.dockerBinary,\n\t\targs,\n\t\tenv: { GRIP_DAEMON_TOKEN: token },\n\t\ttoken,\n\t\tcontainerName,\n\t\tlabels,\n\t\tworkspaceRoot,\n\t\tworkspaceHash: labels[SANDBOX_LABEL_WORKSPACE_HASH],\n\t};\n}\n\nexport class DockerSandboxService {\n\tprivate readonly settingsManager: Pick<SettingsManager, \"getSandboxSettings\"> | undefined;\n\tprivate readonly env: SandboxEnvironment;\n\tprivate readonly runner: DockerRunner;\n\tprivate readonly tokenGenerator: () => string;\n\tprivate readonly portAllocator: (host: string, preferredPort: number) => Promise<number>;\n\tprivate readonly readinessWaiter: (host: string, port: number) => Promise<void>;\n\tprivate readonly managedContainers: Map<string, ManagedSandboxContainer>;\n\n\tconstructor(options: DockerSandboxServiceOptions = {}) {\n\t\tthis.settingsManager = options.settingsManager;\n\t\tthis.env = options.env ?? process.env;\n\t\tthis.runner = options.runner ?? new ProcessDockerRunner();\n\t\tthis.tokenGenerator = options.tokenGenerator ?? generateToken;\n\t\tthis.portAllocator = options.portAllocator ?? allocateSandboxDaemonPort;\n\t\tthis.readinessWaiter = options.readinessWaiter ?? waitForSandboxDaemonPort;\n\t\tthis.managedContainers = options.managedContainers ?? new Map();\n\t}\n\n\tresolveConfig(overrides: SandboxConfigOverrides = {}): SandboxConfig {\n\t\treturn resolveSandboxConfig(this.settingsManager?.getSandboxSettings(), this.env, overrides);\n\t}\n\n\tbuildStartInvocation(options: SandboxStartOptions): DockerRunInvocation {\n\t\treturn buildDockerRunInvocation(this.resolveConfig(options), options, this.tokenGenerator());\n\t}\n\n\tasync checkDockerAvailable(config: SandboxConfig = this.resolveConfig()): Promise<void> {\n\t\tconst args = [\"version\", \"--format\", \"{{.Server.Version}}\"];\n\t\ttry {\n\t\t\tensureSuccessful(await this.runner.run(config.dockerBinary, args), args);\n\t\t} catch (error) {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\tthrow new Error(\n\t\t\t\tredactSecrets(`Docker is unavailable or not reachable via ${config.dockerBinary}: ${message}`),\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate async reserveDaemonPort(config: SandboxConfig): Promise<number> {\n\t\tfor (let attempt = 0; attempt < 16; attempt++) {\n\t\t\tconst preferredPort = reservedSandboxDaemonPorts.has(config.daemonPort) ? 0 : config.daemonPort;\n\t\t\tconst candidate = await this.portAllocator(config.daemonHostBind, preferredPort);\n\t\t\tif (!reservedSandboxDaemonPorts.has(candidate)) return candidate;\n\t\t}\n\t\tthrow new Error(\"Unable to reserve a unique sandbox daemon port\");\n\t}\n\n\tprivate async waitForStartedSandbox(config: SandboxConfig, containerId: string): Promise<void> {\n\t\ttry {\n\t\t\tawait this.readinessWaiter(config.daemonHostBind, config.daemonPort);\n\t\t} catch (error) {\n\t\t\tconst cleanupArgs = [\"rm\", \"--force\", containerId];\n\t\t\tconst cleanupResult = await this.runner.run(config.dockerBinary, cleanupArgs);\n\t\t\tif (cleanupResult.exitCode !== 0) {\n\t\t\t\tconst cleanupError = new Error(\n\t\t\t\t\tcleanupResult.stderr.trim() || cleanupResult.stdout.trim() || \"Failed to remove unready sandbox\",\n\t\t\t\t);\n\t\t\t\tthrow new AggregateError([error, cleanupError], \"Sandbox readiness and cleanup both failed\");\n\t\t\t}\n\t\t\tthis.managedContainers.delete(containerId);\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate async startWithReservedPort(options: SandboxStartOptions, daemonPort: number): Promise<SandboxStartResult> {\n\t\tconst effectiveOptions = { ...options, daemonPort };\n\t\tconst config = this.resolveConfig(effectiveOptions);\n\t\tconst invocation = buildDockerRunInvocation(config, effectiveOptions, this.tokenGenerator());\n\t\tawait this.checkDockerAvailable(config);\n\t\tconst runResult = await this.runner.run(invocation.command, invocation.args, { env: invocation.env });\n\t\tensureSuccessful(runResult, invocation.args);\n\t\tconst containerId = runResult.stdout.trim();\n\t\tthis.managedContainers.set(containerId, {\n\t\t\tworkspaceRoot: invocation.workspaceRoot,\n\t\t\tdaemonPort: config.daemonPort,\n\t\t\townerId: options.sessionId,\n\t\t});\n\t\tawait this.waitForStartedSandbox(config, containerId);\n\t\tconst daemonHost = daemonConnectionHost(config.daemonHostBind);\n\t\tconst daemonUrl = `ws://${urlHost(daemonHost)}:${config.daemonPort}${DAEMON_WEBSOCKET_PATH}`;\n\t\treturn {\n\t\t\tcontainerId,\n\t\t\tcontainerName: invocation.containerName,\n\t\t\tworkspaceRoot: invocation.workspaceRoot,\n\t\t\tworkspaceMountPath: config.workspaceMountPath,\n\t\t\tdaemonUrl,\n\t\t\tdaemonUrlRedacted: redactSecrets(daemonUrl),\n\t\t\ttoken: invocation.token,\n\t\t\tlabels: invocation.labels,\n\t\t};\n\t}\n\n\tprivate async startLocked(options: SandboxStartOptions): Promise<SandboxStartResult> {\n\t\tconst configured = this.resolveConfig(options);\n\t\tconst daemonPort = await this.reserveDaemonPort(configured);\n\t\treservedSandboxDaemonPorts.add(daemonPort);\n\t\ttry {\n\t\t\treturn await this.startWithReservedPort(options, daemonPort);\n\t\t} catch (error) {\n\t\t\tif (![...this.managedContainers.values()].some((container) => container.daemonPort === daemonPort)) {\n\t\t\t\treservedSandboxDaemonPorts.delete(daemonPort);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync start(options: SandboxStartOptions): Promise<SandboxStartResult> {\n\t\treturn withSandboxStartLock(() => this.startLocked(options));\n\t}\n\n\tasync list(options: SandboxListOptions): Promise<SandboxContainer[]> {\n\t\tconst config = this.resolveConfig();\n\t\tconst args = [\n\t\t\t\"container\",\n\t\t\t\"ls\",\n\t\t\t\"--all\",\n\t\t\t\"--filter\",\n\t\t\t`label=${SANDBOX_LABEL_ENABLED}=true`,\n\t\t\t...(config.ownerUid ? [\"--filter\", `label=${SANDBOX_LABEL_OWNER_UID}=${config.ownerUid}`] : []),\n\t\t];\n\t\tif (!options.allWorkspaces) {\n\t\t\targs.push(\"--filter\", `label=${SANDBOX_LABEL_WORKSPACE_HASH}=${getWorkspaceHash(options.workspaceRoot)}`);\n\t\t}\n\t\targs.push(\"--format\", \"{{json .}}\");\n\t\tconst result = await this.runner.run(config.dockerBinary, args);\n\t\tensureSuccessful(result, args);\n\t\tconst rows = parseJsonLines<DockerPsRecord>(result.stdout);\n\t\treturn rows.filter((row) => row.ID || row.Names).map((row) => this.containerFromPsRecord(row));\n\t}\n\tprivate forgetManagedContainer(reference: string, workspaceRoot: string): void {\n\t\tconst canonicalWorkspaceRoot = resolve(workspaceRoot);\n\t\tfor (const [containerId, container] of this.managedContainers) {\n\t\t\tif (container.workspaceRoot === canonicalWorkspaceRoot && containerIdsMatch(containerId, reference)) {\n\t\t\t\tthis.managedContainers.delete(containerId);\n\t\t\t\treservedSandboxDaemonPorts.delete(container.daemonPort);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate forgetStoppedContainer(container: SandboxContainer, workspaceRoot: string): void {\n\t\tthis.forgetManagedContainer(container.id, workspaceRoot);\n\t\tif (container.daemonPort !== undefined) reservedSandboxDaemonPorts.delete(container.daemonPort);\n\t}\n\n\tasync stop(options: SandboxStopOptions): Promise<SandboxStopResult> {\n\t\tconst containers = await this.list({ workspaceRoot: options.workspaceRoot });\n\t\tconst selected = selectStopTarget(containers, options.target, options.currentContainerId);\n\t\tif (!selected) {\n\t\t\tconst requestedId = options.currentContainerId ?? options.target;\n\t\t\tif (requestedId) this.forgetManagedContainer(requestedId, options.workspaceRoot);\n\t\t\treturn { status: \"not-found\", message: \"No matching Grip sandbox container found\" };\n\t\t}\n\t\tconst config = this.resolveConfig();\n\t\tif (selected.state && selected.state !== \"running\" && config.cleanup === \"stop\") {\n\t\t\tthis.forgetStoppedContainer(selected, options.workspaceRoot);\n\t\t\treturn { status: \"already-stopped\", container: selected };\n\t\t}\n\t\tconst args = [\n\t\t\tconfig.cleanup === \"remove\" ? \"rm\" : \"stop\",\n\t\t\t...(config.cleanup === \"remove\" ? [\"--force\"] : []),\n\t\t\tselected.id,\n\t\t];\n\t\tconst result = await this.runner.run(config.dockerBinary, args);\n\t\tif (result.exitCode !== 0) {\n\t\t\tconst output = `${result.stderr}\\n${result.stdout}`;\n\t\t\tif (/No such container|not found/i.test(output)) {\n\t\t\t\tthis.forgetStoppedContainer(selected, options.workspaceRoot);\n\t\t\t\treturn { status: \"not-found\", message: \"Sandbox container no longer exists\" };\n\t\t\t}\n\t\t\tensureSuccessful(result, args);\n\t\t}\n\t\tthis.forgetStoppedContainer(selected, options.workspaceRoot);\n\t\treturn { status: config.cleanup === \"remove\" ? \"removed\" : \"stopped\", container: selected };\n\t}\n\n\tasync stopManagedContainers(): Promise<void> {\n\t\tawait withSandboxStartLock(async () => {\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const [containerId, container] of [...this.managedContainers]) {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.stop({\n\t\t\t\t\t\tworkspaceRoot: container.workspaceRoot,\n\t\t\t\t\t\ttarget: containerId,\n\t\t\t\t\t\tcurrentContainerId: containerId,\n\t\t\t\t\t});\n\t\t\t\t\tthis.managedContainers.delete(containerId);\n\t\t\t\t\treservedSandboxDaemonPorts.delete(container.daemonPort);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailures.push(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (failures.length > 0) throw new AggregateError(failures, \"Failed to stop managed sandbox containers\");\n\t\t});\n\t}\n\n\tprivate containerFromPsRecord(row: DockerPsRecord): SandboxContainer {\n\t\tconst labels = parseLabels(row.Labels);\n\t\tconst daemonPort = parsePositiveInteger(\n\t\t\tlabels[`${SANDBOX_LABEL_PREFIX}.daemon-port`] ?? undefined,\n\t\t\t\"daemon port\",\n\t\t);\n\t\treturn {\n\t\t\tid: row.ID ?? \"\",\n\t\t\tname: row.Names ?? \"\",\n\t\t\timage: row.Image ?? \"\",\n\t\t\tstatus: row.Status ?? \"\",\n\t\t\tstate: row.State,\n\t\t\tcreatedAt: row.CreatedAt,\n\t\t\tworkspaceRoot: undefined,\n\t\t\tworkspaceMountPath: labels[SANDBOX_LABEL_WORKSPACE_MOUNT],\n\t\t\tdaemonPort,\n\t\t\tdaemonEndpoint: row.Ports ? redactSecrets(row.Ports) : undefined,\n\t\t\tlabels,\n\t\t};\n\t}\n}\n\nexport function parseDockerPortOutput(output: string): string {\n\tconst firstLine = output.trim().split(/\\r?\\n/)[0];\n\tconst match = firstLine?.match(/^(?<host>.+):(?<port>\\d+)$/);\n\tif (!match?.groups) throw new Error(`Unable to parse Docker daemon port output: ${output.trim()}`);\n\tconst host = match.groups.host === \"0.0.0.0\" ? \"127.0.0.1\" : match.groups.host;\n\treturn `ws://${host}:${match.groups.port}${DAEMON_WEBSOCKET_PATH}`;\n}\n\nexport function parseDockerInspectContainers(\n\toutput: string,\n\tdaemonPort = DEFAULT_SANDBOX_DAEMON_PORT,\n): SandboxContainer[] {\n\treturn parseJsonArray<DockerInspectRecord>(output).map((record) => {\n\t\tconst labels = record.Config?.Labels ?? {};\n\t\tconst mountPath = labels[SANDBOX_LABEL_WORKSPACE_MOUNT] ?? DEFAULT_SANDBOX_WORKSPACE_MOUNT;\n\t\tconst mount = record.Mounts?.find((candidate) => candidate.Destination === mountPath);\n\t\tconst name = record.Name?.replace(/^\\//, \"\") ?? \"\";\n\t\treturn {\n\t\t\tid: record.Id ?? \"\",\n\t\t\tname,\n\t\t\timage: record.Config?.Image ?? \"\",\n\t\t\tstatus: record.State?.Status ?? \"\",\n\t\t\tstate: record.State?.Running ? \"running\" : record.State?.Status,\n\t\t\tcreatedAt: record.State?.StartedAt ?? record.Created,\n\t\t\tworkspaceRoot: mount?.Source,\n\t\t\tworkspaceMountPath: mount?.Destination ?? mountPath,\n\t\t\tdaemonPort,\n\t\t\tdaemonEndpoint: getEndpointFromPorts(record.NetworkSettings?.Ports, daemonPort),\n\t\t\tlabels,\n\t\t};\n\t});\n}\nfunction containerIdsMatch(left: string, right: string): boolean {\n\treturn left === right || left.startsWith(right) || right.startsWith(left);\n}\n\nfunction selectStopTarget(\n\tcontainers: SandboxContainer[],\n\ttarget: string | undefined,\n\tcurrentContainerId: string | undefined,\n): SandboxContainer | undefined {\n\tif (target) {\n\t\treturn containers.find((container) => containerIdsMatch(container.id, target) || container.name === target);\n\t}\n\tif (currentContainerId) {\n\t\tconst current = containers.find((container) => containerIdsMatch(container.id, currentContainerId));\n\t\tif (current) return current;\n\t}\n\treturn containers.length === 1 ? containers[0] : undefined;\n}\n"]}
@@ -1,274 +0,0 @@
1
- FROM ubuntu:26.04
2
-
3
- SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4
-
5
- ARG MISE_VERSION=v2026.7.13
6
- ARG NODE_VERSION=26.5.0
7
-
8
- RUN apt-get update \
9
- && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
10
- bash \
11
- build-essential \
12
- ca-certificates \
13
- curl \
14
- fd-find \
15
- file \
16
- git \
17
- jq \
18
- less \
19
- make \
20
- nodejs \
21
- npm \
22
- openssh-client \
23
- pkg-config \
24
- python3 \
25
- python3-pip \
26
- python3-venv \
27
- ripgrep \
28
- sudo \
29
- unzip \
30
- xz-utils \
31
- zip \
32
- && ln -s /usr/bin/fdfind /usr/local/bin/fd \
33
- && mkdir -p /workspace /home/grip /etc/grip \
34
- && chown 1000:1000 /workspace /home/grip \
35
- && rm -rf /var/lib/apt/lists/*
36
-
37
- RUN curl -fsSL https://mise.run | MISE_VERSION="${MISE_VERSION}" sh \
38
- && install -m 0755 /root/.local/bin/mise /usr/local/bin/mise \
39
- && rm -rf /root/.local
40
-
41
- ENV MISE_DATA_DIR=/home/grip/.local/share/mise
42
- ENV MISE_CONFIG_DIR=/home/grip/.config/mise
43
- ENV MISE_CACHE_DIR=/home/grip/.cache/mise
44
- ENV NPM_CONFIG_PREFIX=/home/grip/.npm-global
45
- ENV PATH=/home/grip/.local/share/mise/shims:/home/grip/.npm-global/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
46
-
47
- RUN mkdir -p \
48
- /home/grip/.cache \
49
- /home/grip/.config \
50
- /home/grip/.grip \
51
- /home/grip/.local/share \
52
- /home/grip/.npm-global \
53
- && mise install "node@${NODE_VERSION}" \
54
- && mise use --global "node@${NODE_VERSION}" \
55
- && node --version \
56
- && npm --version \
57
- && npm install -g \
58
- agent-browser@0.33.0 \
59
- @astrojs/language-server@latest \
60
- @biomejs/biome@latest \
61
- @tailwindcss/language-server@latest \
62
- @vue/language-server@latest \
63
- bash-language-server@latest \
64
- dockerfile-language-server-nodejs@latest \
65
- pyright@latest \
66
- svelte-language-server@latest \
67
- typescript@latest \
68
- typescript-language-server@latest \
69
- vscode-langservers-extracted@latest \
70
- yaml-language-server@latest \
71
- && HOME=/home/grip agent-browser install --with-deps \
72
- && npm cache clean --force \
73
- && rm -rf /var/lib/apt/lists/* \
74
- && chown -R 1000:1000 /home/grip
75
-
76
- RUN cat >/etc/grip/lsp.json <<'JSON'
77
- {
78
- "enabled": true,
79
- "servers": [
80
- {
81
- "id": "typescript",
82
- "selectors": [
83
- { "languageId": "javascript", "pattern": "**/*.js" },
84
- { "languageId": "javascriptreact", "pattern": "**/*.jsx" },
85
- { "languageId": "typescript", "pattern": "**/*.ts" },
86
- { "languageId": "typescriptreact", "pattern": "**/*.tsx" }
87
- ],
88
- "transport": { "type": "spawn", "command": "typescript-language-server", "args": ["--stdio"] },
89
- "lifecycle": { "type": "managed" },
90
- "workspace": { "type": "markers", "markers": ["tsconfig.json", "jsconfig.json", "package.json"], "fallback": "session" },
91
- "timeouts": { "connectMs": 5000, "initializeMs": 15000, "requestMs": 15000, "shutdownMs": 3000 }
92
- },
93
- {
94
- "id": "pyright",
95
- "selectors": [{ "languageId": "python", "pattern": "**/*.py" }],
96
- "transport": { "type": "spawn", "command": "pyright-langserver", "args": ["--stdio"] },
97
- "lifecycle": { "type": "managed" },
98
- "workspace": { "type": "markers", "markers": ["pyproject.toml", "setup.py", "setup.cfg", "requirements.txt"], "fallback": "session" },
99
- "timeouts": { "connectMs": 5000, "initializeMs": 15000, "requestMs": 15000, "shutdownMs": 3000 }
100
- },
101
- {
102
- "id": "json",
103
- "selectors": [
104
- { "languageId": "json", "pattern": "**/*.json" },
105
- { "languageId": "jsonc", "pattern": "**/*.jsonc" }
106
- ],
107
- "transport": { "type": "spawn", "command": "vscode-json-language-server", "args": ["--stdio"] },
108
- "lifecycle": { "type": "managed" },
109
- "workspace": { "type": "session" }
110
- },
111
- {
112
- "id": "html",
113
- "selectors": [{ "languageId": "html", "pattern": "**/*.html" }],
114
- "transport": { "type": "spawn", "command": "vscode-html-language-server", "args": ["--stdio"] },
115
- "lifecycle": { "type": "managed" },
116
- "workspace": { "type": "session" }
117
- },
118
- {
119
- "id": "css",
120
- "selectors": [
121
- { "languageId": "css", "pattern": "**/*.css" },
122
- { "languageId": "scss", "pattern": "**/*.scss" },
123
- { "languageId": "less", "pattern": "**/*.less" }
124
- ],
125
- "transport": { "type": "spawn", "command": "vscode-css-language-server", "args": ["--stdio"] },
126
- "lifecycle": { "type": "managed" },
127
- "workspace": { "type": "session" }
128
- },
129
- {
130
- "id": "yaml",
131
- "selectors": [
132
- { "languageId": "yaml", "pattern": "**/*.yaml" },
133
- { "languageId": "yaml", "pattern": "**/*.yml" }
134
- ],
135
- "transport": { "type": "spawn", "command": "yaml-language-server", "args": ["--stdio"] },
136
- "lifecycle": { "type": "managed" },
137
- "workspace": { "type": "session" }
138
- },
139
- {
140
- "id": "bash",
141
- "selectors": [
142
- { "languageId": "shellscript", "pattern": "**/*.sh" },
143
- { "languageId": "shellscript", "pattern": "**/*.bash" },
144
- { "languageId": "shellscript", "pattern": "**/.env" }
145
- ],
146
- "transport": { "type": "spawn", "command": "bash-language-server", "args": ["start"] },
147
- "lifecycle": { "type": "managed" },
148
- "workspace": { "type": "session" }
149
- },
150
- {
151
- "id": "dockerfile",
152
- "selectors": [
153
- { "languageId": "dockerfile", "pattern": "**/Dockerfile" },
154
- { "languageId": "dockerfile", "pattern": "**/*.Dockerfile" }
155
- ],
156
- "transport": { "type": "spawn", "command": "docker-langserver", "args": ["--stdio"] },
157
- "lifecycle": { "type": "managed" },
158
- "workspace": { "type": "session" }
159
- },
160
- {
161
- "id": "tailwindcss",
162
- "selectors": [
163
- { "languageId": "html", "pattern": "**/*.html" },
164
- { "languageId": "javascriptreact", "pattern": "**/*.jsx" },
165
- { "languageId": "typescriptreact", "pattern": "**/*.tsx" },
166
- { "languageId": "vue", "pattern": "**/*.vue" },
167
- { "languageId": "svelte", "pattern": "**/*.svelte" }
168
- ],
169
- "transport": { "type": "spawn", "command": "tailwindcss-language-server", "args": ["--stdio"] },
170
- "lifecycle": { "type": "managed" },
171
- "workspace": { "type": "markers", "markers": ["tailwind.config.js", "tailwind.config.cjs", "tailwind.config.mjs", "tailwind.config.ts", "package.json"], "fallback": "session" },
172
- "priority": 50
173
- },
174
- {
175
- "id": "vue",
176
- "selectors": [{ "languageId": "vue", "pattern": "**/*.vue" }],
177
- "transport": { "type": "spawn", "command": "vue-language-server", "args": ["--stdio"] },
178
- "lifecycle": { "type": "managed" },
179
- "workspace": { "type": "markers", "markers": ["package.json", "vue.config.js", "vite.config.ts", "vite.config.js"], "fallback": "session" }
180
- },
181
- {
182
- "id": "svelte",
183
- "selectors": [{ "languageId": "svelte", "pattern": "**/*.svelte" }],
184
- "transport": { "type": "spawn", "command": "svelteserver", "args": ["--stdio"] },
185
- "lifecycle": { "type": "managed" },
186
- "workspace": { "type": "markers", "markers": ["package.json", "svelte.config.js", "svelte.config.mjs"], "fallback": "session" }
187
- },
188
- {
189
- "id": "astro",
190
- "selectors": [{ "languageId": "astro", "pattern": "**/*.astro" }],
191
- "transport": { "type": "spawn", "command": "astro-ls", "args": ["--stdio"] },
192
- "lifecycle": { "type": "managed" },
193
- "workspace": { "type": "markers", "markers": ["package.json", "astro.config.mjs", "astro.config.ts"], "fallback": "session" }
194
- },
195
- {
196
- "id": "biome",
197
- "selectors": [
198
- { "languageId": "javascript", "pattern": "**/*.js" },
199
- { "languageId": "javascriptreact", "pattern": "**/*.jsx" },
200
- { "languageId": "typescript", "pattern": "**/*.ts" },
201
- { "languageId": "typescriptreact", "pattern": "**/*.tsx" },
202
- { "languageId": "json", "pattern": "**/*.json" },
203
- { "languageId": "jsonc", "pattern": "**/*.jsonc" }
204
- ],
205
- "transport": { "type": "spawn", "command": "biome", "args": ["lsp-proxy"] },
206
- "lifecycle": { "type": "managed" },
207
- "workspace": { "type": "markers", "markers": ["biome.json", "biome.jsonc", "package.json"], "fallback": "none" },
208
- "priority": 40
209
- }
210
- ]
211
- }
212
- JSON
213
-
214
- RUN cat >/SANDBOX.md <<'EOF'
215
- # Grip Sandbox
216
-
217
- This container is the Grip workspace sandbox. The host workspace is mounted read/write at `/workspace`; Grip itself remains the orchestrator outside the container. Grip loads this file into the model system prompt when the sandbox daemon is connected.
218
-
219
- Included tooling:
220
-
221
- - `grip --daemon` for remote workspace tools
222
- - `git`, `curl`, `ripgrep`, `fd`, `jq`, `file`, `less`, `make`, `build-essential`
223
- - Node.js with `npm`
224
- - Python 3 with `pip` and `venv`
225
- - `mise` for per-project tool installation (`mise install`, `mise use`, `mise x`)
226
- - `agent-browser` with Chrome for Testing for headless browser automation (`agent-browser open`, `agent-browser snapshot`, `agent-browser close`)
227
- - common npm-based LSP servers for TypeScript/JavaScript, Python, JSON, HTML, CSS, YAML, Bash, Dockerfile, Tailwind CSS, Vue, Svelte, Astro, and Biome
228
-
229
- LSP is enabled through `/etc/grip/lsp.json` via `GRIP_DAEMON_LSP_CONFIG`. Servers are spawned inside the container, so they see `/workspace` paths and can only inspect the mounted workspace plus the container filesystem.
230
-
231
- Useful commands:
232
-
233
- ```bash
234
- mise --version
235
- mise install # install tools from .mise.toml / mise.toml / .tool-versions
236
- npm --version
237
- agent-browser --version
238
- agent-browser doctor --json
239
- grip --version
240
- ```
241
-
242
- Security model:
243
-
244
- - `/workspace` is the host project mount and is intentionally writable.
245
- - `/tmp` is writable temporary storage. Use it for ad-hoc scripts, generated artifacts, and disposable intermediate files.
246
- - Host paths outside mounted volumes are not available to agent workspace tools.
247
- - Do not mount Docker socket, SSH keys, home directories, or extra secrets unless you explicitly want the sandbox to access them.
248
- EOF
249
-
250
- RUN cp /SANDBOX.md /etc/grip/SANDBOX.md
251
-
252
- ARG GRIP_RELEASE_NODE_DIR=node
253
- COPY ${GRIP_RELEASE_NODE_DIR}/ /opt/grip/
254
-
255
- RUN test -x /opt/grip/grip \
256
- && ln -s /opt/grip/grip /usr/local/bin/grip \
257
- && grip --help >/dev/null
258
-
259
- ENV GRIP_DAEMON_HOST=0.0.0.0
260
- ENV GRIP_DAEMON_PORT=8787
261
- ENV GRIP_DAEMON_CWD=/workspace
262
- ENV GRIP_DAEMON_TEMP_ROOT=/tmp
263
- ENV TMPDIR=/tmp
264
- ENV GRIP_DAEMON_ALLOW_INSECURE_TRANSPORT=1
265
- ENV GRIP_DAEMON_ALLOW_PROCESS_EXEC=1
266
- ENV GRIP_DAEMON_LSP_CONFIG=/etc/grip/lsp.json
267
- ENV GRIP_DAEMON_SANDBOX_INSTRUCTIONS=/etc/grip/SANDBOX.md
268
- ENV HOME=/home/grip
269
-
270
- WORKDIR /workspace
271
- USER 1000:1000
272
- EXPOSE 8787
273
-
274
- CMD ["grip", "--daemon"]
@@ -1,88 +0,0 @@
1
- # Grip sandbox Docker image
2
-
3
- This image is the base runtime for `/sandbox start`. It contains the packaged `grip` CLI and starts the integrated workspace daemon with `grip --daemon`.
4
-
5
- ## Build from a local release
6
-
7
- Create local release artifacts from the repository root:
8
-
9
- ```bash
10
- npm run release:local -- --out /tmp/grip-local-release --force
11
- ```
12
-
13
- Build the image with the local release directory as the Docker context:
14
-
15
- ```bash
16
- docker build \
17
- -f packages/coding-agent/examples/sandbox-docker/Dockerfile \
18
- -t grip-sandbox:local \
19
- /tmp/grip-local-release
20
- ```
21
-
22
- The Dockerfile consumes `/tmp/grip-local-release/node`, which is the isolated npm install produced from the locally packed tarballs. Do not use `--skip-install`; a tarball-only release does not contain the `node/` install directory the Dockerfile copies.
23
-
24
- If you use a different directory name inside the build context, pass it explicitly:
25
-
26
- ```bash
27
- docker build \
28
- --build-arg GRIP_RELEASE_NODE_DIR=my-node-install \
29
- -f packages/coding-agent/examples/sandbox-docker/Dockerfile \
30
- -t grip-sandbox:local \
31
- /path/to/context
32
- ```
33
-
34
- ## Runtime defaults
35
-
36
- The image sets:
37
-
38
- - workspace directory: `/workspace`
39
- - additional confined temporary root: `/tmp` via `GRIP_DAEMON_TEMP_ROOT`
40
- - daemon command: `grip --daemon`
41
- - daemon host inside the image: `0.0.0.0` (the configured `daemonHostBind` controls Docker's published host address)
42
- - daemon port inside the container: `8787`
43
- - process execution: enabled for Grip shell/tool execution inside the container
44
- - user: unprivileged `grip` user with uid `1000`
45
- - sandbox-only user instructions: `/home/grip/.grip/AGENTS.md` (loaded when present; run `/reload` after changing it)
46
-
47
- `GRIP_DAEMON_TOKEN` is intentionally not baked into the image. `/sandbox start` generates a token and passes it through the container environment. For manual runs, provide a long random token yourself:
48
-
49
- ```bash
50
- docker run --rm \
51
- --name grip-sandbox-local \
52
- --network bridge \
53
- --publish 127.0.0.1:8787:8787 \
54
- -e GRIP_DAEMON_HOST=0.0.0.0 \
55
- -e GRIP_DAEMON_TOKEN=dev-token-dev-token-dev-token-dev-token \
56
- -v "$PWD:/workspace" \
57
- grip-sandbox:local
58
- ```
59
-
60
- Then connect a local Grip process as the orchestrator:
61
-
62
- ```bash
63
- GRIP_REMOTE_TOKEN=dev-token-dev-token-dev-token-dev-token ./grip-test.sh --remote ws://127.0.0.1:8787/grip/workspace
64
- ```
65
-
66
- ## Use with `/sandbox start`
67
-
68
- Override the sandbox image for one start:
69
-
70
- ```text
71
- /sandbox start --image grip-sandbox:local
72
- ```
73
-
74
- Or configure the default image with normal sandbox precedence:
75
-
76
- ```bash
77
- GRIP_SANDBOX_IMAGE=grip-sandbox:local ./grip-test.sh
78
- ```
79
-
80
- The sandbox service mounts the current workspace at `/workspace`, uses Docker bridge networking, publishes only the authenticated daemon port to the configured host bind address (loopback by default), and supplies `GRIP_DAEMON_TOKEN` through the Docker environment. Sandbox processes cannot directly use host loopback services. Tokens must not be put in image layers, command-line arguments, labels, or URLs. See [Workspace Sandbox](../../docs/sandbox.md) for `/sandbox` commands, configuration precedence, stop behavior, troubleshooting, and security boundaries.
81
-
82
- ## Notes
83
-
84
- - The image uses the integrated `grip --daemon` command from `@greppleai/grip`.
85
- - The mounted workspace is read/write. Files created by the container are owned by uid `1000` unless Docker is run with a different user policy.
86
- - `/tmp` is writable container-local scratch storage and is not mounted from the host by default.
87
- - Bridge networking and loopback-only daemon publication avoid exposing host loopback services to the container.
88
- - Docker is not a complete security boundary. Treat this image and any override image as trusted code for the mounted workspace.