dsh-plugin-dev-kb 1.8.0 → 1.8.1

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 (229) hide show
  1. package/CHANGELOG.md +186 -178
  2. package/README.en.md +172 -172
  3. package/README.md +183 -183
  4. package/kb/INDEX.md +236 -234
  5. package/kb/README.md +88 -88
  6. package/kb/extra/AGENTS.md +77 -77
  7. package/kb/extra/deepseek-llm-api-wire-extensions.md +162 -162
  8. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +162 -162
  9. package/kb/extra/defensive-patterns/package-surface.md +233 -232
  10. package/kb/extra/defensive-patterns/package-surface.zh.md +233 -232
  11. package/kb/extra/defensive-patterns/remote-and-api.md +117 -117
  12. package/kb/extra/defensive-patterns/remote-and-api.zh.md +117 -117
  13. package/kb/extra/development.md +221 -221
  14. package/kb/extra/development.zh.md +228 -228
  15. package/kb/extra/event-producer-consumer.md +133 -123
  16. package/kb/extra/event-producer-consumer.zh.md +135 -125
  17. package/kb/extra/module-graph.md +1961 -1888
  18. package/kb/extra/module-graph.zh.md +1963 -1890
  19. package/kb/extra/persistence-changes/2026-11-05-timeline-priority-notice.md +60 -0
  20. package/kb/extra/persistence-changes/2026-11-05-timeline-priority-notice.zh.md +60 -0
  21. package/kb/extra/persistence-changes/README.md +92 -92
  22. package/kb/extra/persistence-changes/README.zh.md +92 -92
  23. package/kb/extra/persistence-changes/historical-formats/README.md +75 -75
  24. package/kb/extra/persistence-changes/historical-formats/README.zh.md +75 -75
  25. package/kb/extra/persistence-changes/releases/README.md +103 -103
  26. package/kb/extra/persistence-changes/releases/README.zh.md +103 -103
  27. package/kb/extra/rescope.md +55 -55
  28. package/kb/extra/rescope.zh.md +55 -55
  29. package/kb/extra/subsystems/boot.md +631 -621
  30. package/kb/extra/subsystems/boot.zh.md +631 -621
  31. package/kb/extra/subsystems/computer-use.md +179 -137
  32. package/kb/extra/subsystems/computer-use.zh.md +179 -137
  33. package/kb/extra/subsystems/extensions.md +387 -384
  34. package/kb/extra/subsystems/extensions.zh.md +387 -384
  35. package/kb/extra/subsystems/feedback.md +418 -400
  36. package/kb/extra/subsystems/feedback.zh.md +418 -400
  37. package/kb/extra/subsystems/forge.md +2169 -1226
  38. package/kb/extra/subsystems/forge.zh.md +2171 -1226
  39. package/kb/extra/subsystems/liveshare.md +167 -158
  40. package/kb/extra/subsystems/liveshare.zh.md +167 -158
  41. package/kb/extra/subsystems/mcp.md +237 -234
  42. package/kb/extra/subsystems/mcp.zh.md +237 -234
  43. package/kb/extra/subsystems/office-kit.md +122 -0
  44. package/kb/extra/subsystems/office-kit.zh.md +122 -0
  45. package/kb/extra/subsystems/working-directory.md +95 -64
  46. package/kb/extra/subsystems/working-directory.zh.md +95 -64
  47. package/kb/extra/subsystems/worktrees.md +187 -127
  48. package/kb/extra/subsystems/worktrees.zh.md +187 -127
  49. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.md +21 -21
  50. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.zh.md +21 -21
  51. package/kb/extra/upgrade-guide/v0.2.1-rc.4/sandbox-unsupported-policy-error/guide.md +18 -0
  52. package/kb/extra/upgrade-guide/v0.2.1-rc.4/sandbox-unsupported-policy-error/guide.zh.md +18 -0
  53. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-error-builtin-codes/guide.md +18 -0
  54. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-error-builtin-codes/guide.zh.md +18 -0
  55. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-kit-package/guide.md +34 -0
  56. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-kit-package/guide.zh.md +34 -0
  57. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md +49 -0
  58. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md +49 -0
  59. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-skill-resources/guide.md +36 -0
  60. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-skill-resources/guide.zh.md +36 -0
  61. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-notification-fields/guide.md +26 -0
  62. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-notification-fields/guide.zh.md +26 -0
  63. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-remote-provider/guide.md +22 -0
  64. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-remote-provider/guide.zh.md +22 -0
  65. package/kb/extra/upgrade-guide/v0.2.2-rc.1/archive-worktrees/guide.md +21 -0
  66. package/kb/extra/upgrade-guide/v0.2.2-rc.1/archive-worktrees/guide.zh.md +21 -0
  67. package/kb/extra/upgrade-guide/v0.2.2-rc.1/attachment-error-codes/guide.md +23 -0
  68. package/kb/extra/upgrade-guide/v0.2.2-rc.1/attachment-error-codes/guide.zh.md +23 -0
  69. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-ax-read-limits/guide.md +20 -0
  70. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-ax-read-limits/guide.zh.md +20 -0
  71. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-hover-ax-only/guide.md +18 -0
  72. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-hover-ax-only/guide.zh.md +18 -0
  73. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-native-platform/guide.md +23 -0
  74. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-native-platform/guide.zh.md +23 -0
  75. package/kb/extra/upgrade-guide/v0.2.2-rc.1/dsh-doc-skill/guide.md +35 -0
  76. package/kb/extra/upgrade-guide/v0.2.2-rc.1/dsh-doc-skill/guide.zh.md +35 -0
  77. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-change-request-overview/guide.md +26 -0
  78. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-change-request-overview/guide.zh.md +26 -0
  79. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-pinned-diff/guide.md +26 -0
  80. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-pinned-diff/guide.zh.md +26 -0
  81. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-review-reads/guide.md +19 -0
  82. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-review-reads/guide.zh.md +19 -0
  83. package/kb/extra/upgrade-guide/v0.2.2-rc.1/package-export-cleanup/guide.md +26 -0
  84. package/kb/extra/upgrade-guide/v0.2.2-rc.1/package-export-cleanup/guide.zh.md +26 -0
  85. package/kb/extra/upgrade-guide/v0.2.2-rc.1/plugin-update-method/guide.md +22 -0
  86. package/kb/extra/upgrade-guide/v0.2.2-rc.1/plugin-update-method/guide.zh.md +22 -0
  87. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-bootstrap-protocol/guide.md +25 -0
  88. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-bootstrap-protocol/guide.zh.md +25 -0
  89. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-inspect-output/guide.md +48 -0
  90. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-inspect-output/guide.zh.md +48 -0
  91. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-scoped-repl-default/guide.md +45 -0
  92. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-scoped-repl-default/guide.zh.md +45 -0
  93. package/kb/extra/upgrade-guide/v0.2.2-rc.1/runtime-context-reminders/guide.md +19 -0
  94. package/kb/extra/upgrade-guide/v0.2.2-rc.1/runtime-context-reminders/guide.zh.md +19 -0
  95. package/kb/extra/upgrade-guide/v0.2.2-rc.1/session-append-overloads/guide.md +17 -0
  96. package/kb/extra/upgrade-guide/v0.2.2-rc.1/session-append-overloads/guide.zh.md +17 -0
  97. package/kb/extra/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.md +27 -0
  98. package/kb/extra/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.zh.md +27 -0
  99. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-backend-cleanup-error/guide.md +20 -0
  100. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-backend-cleanup-error/guide.zh.md +20 -0
  101. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-bundle-sidebar-backend/guide.md +19 -0
  102. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-bundle-sidebar-backend/guide.zh.md +19 -0
  103. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.md +18 -0
  104. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.zh.md +18 -0
  105. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-search-billing/guide.md +41 -0
  106. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-search-billing/guide.zh.md +41 -0
  107. package/kb/extra/upgrade-guide/v0.2.2-rc.1/window-drag-regions/guide.md +21 -0
  108. package/kb/extra/upgrade-guide/v0.2.2-rc.1/window-drag-regions/guide.zh.md +21 -0
  109. package/kb/extra/upgrade-guide/v0.2.2-rc.2/client-module-metadata/guide.md +29 -0
  110. package/kb/extra/upgrade-guide/v0.2.2-rc.2/client-module-metadata/guide.zh.md +29 -0
  111. package/kb/extra/upgrade-guide/v0.2.2-rc.2/connection-page-peer/guide.md +25 -0
  112. package/kb/extra/upgrade-guide/v0.2.2-rc.2/connection-page-peer/guide.zh.md +25 -0
  113. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.md +31 -0
  114. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.zh.md +31 -0
  115. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-agents-without-preset/guide.md +24 -0
  116. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-agents-without-preset/guide.zh.md +24 -0
  117. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-macos-provider/guide.md +24 -0
  118. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-macos-provider/guide.zh.md +24 -0
  119. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-partial-observations/guide.md +19 -0
  120. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-partial-observations/guide.zh.md +19 -0
  121. package/kb/extra/upgrade-guide/v0.2.2-rc.2/deepseek-files-timeout/guide.md +15 -0
  122. package/kb/extra/upgrade-guide/v0.2.2-rc.2/deepseek-files-timeout/guide.zh.md +15 -0
  123. package/kb/extra/upgrade-guide/v0.2.2-rc.2/experimental-tool-error-codes/guide.md +28 -0
  124. package/kb/extra/upgrade-guide/v0.2.2-rc.2/experimental-tool-error-codes/guide.zh.md +28 -0
  125. package/kb/extra/upgrade-guide/v0.2.2-rc.2/package-export-cleanup/guide.md +36 -0
  126. package/kb/extra/upgrade-guide/v0.2.2-rc.2/package-export-cleanup/guide.zh.md +36 -0
  127. package/kb/extra/upgrade-guide/v0.2.2-rc.2/python-ptc-removal/guide.md +22 -0
  128. package/kb/extra/upgrade-guide/v0.2.2-rc.2/python-ptc-removal/guide.zh.md +22 -0
  129. package/kb/extra/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.md +31 -0
  130. package/kb/extra/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.zh.md +31 -0
  131. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.md +18 -0
  132. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.zh.md +18 -0
  133. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shell-fs-tool-error-codes/guide.md +30 -0
  134. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shell-fs-tool-error-codes/guide.zh.md +30 -0
  135. package/kb/extra/web-styling.md +57 -57
  136. package/kb/extra/web-styling.zh.md +57 -57
  137. package/kb/meta/search-index.json +4508 -3980
  138. package/kb/meta/source.json +18 -18
  139. package/kb/site/develop/practice/llm-adapter.md +192 -192
  140. package/kb/site/en/develop/practice/llm-adapter.md +192 -192
  141. package/kb/site/en/guide/desktop-uninstall-cleanup.md +63 -0
  142. package/kb/site/en/guide/plugin-market.md +153 -151
  143. package/kb/site/en/guide/providers.md +234 -234
  144. package/kb/site/en/guide/quickstart.md +35 -34
  145. package/kb/site/en/reference/capability-seams.md +789 -767
  146. package/kb/site/en/reference/config-catalog.md +5432 -5128
  147. package/kb/site/en/reference/cookbook/adding-a-package.md +175 -175
  148. package/kb/site/en/reference/cookbook/adding-a-tool.md +105 -104
  149. package/kb/site/en/reference/cookbook/extension-cookbook.md +178 -135
  150. package/kb/site/en/reference/cordis-api/context.md +373 -369
  151. package/kb/site/en/reference/cordis-api/fiber.md +457 -433
  152. package/kb/site/en/reference/cordis-api/inherited.md +44 -44
  153. package/kb/site/en/reference/cordis-api/service.md +118 -107
  154. package/kb/site/en/reference/experimental-persistence-catalog.md +36 -23
  155. package/kb/site/en/reference/index.md +174 -174
  156. package/kb/site/en/reference/persistence-catalog.md +9453 -9432
  157. package/kb/site/en/reference/subsystems/compaction.md +288 -288
  158. package/kb/site/en/reference/subsystems/core.md +1172 -1171
  159. package/kb/site/en/reference/subsystems/credentials.md +526 -497
  160. package/kb/site/en/reference/subsystems/filesystem.md +708 -708
  161. package/kb/site/en/reference/subsystems/index.md +82 -82
  162. package/kb/site/en/reference/subsystems/llm-streaming.md +1290 -1288
  163. package/kb/site/en/reference/subsystems/lsp.md +230 -206
  164. package/kb/site/en/reference/subsystems/persistence.md +451 -432
  165. package/kb/site/en/reference/subsystems/plan.md +91 -91
  166. package/kb/site/en/reference/subsystems/ptc-runtime.md +295 -261
  167. package/kb/site/en/reference/subsystems/sandbox.md +250 -232
  168. package/kb/site/en/reference/subsystems/session-query.md +525 -515
  169. package/kb/site/en/reference/subsystems/session-reference.md +231 -229
  170. package/kb/site/en/reference/subsystems/session.md +1478 -1431
  171. package/kb/site/en/reference/subsystems/sidebar-right.md +165 -165
  172. package/kb/site/en/reference/subsystems/skills.md +356 -356
  173. package/kb/site/en/reference/subsystems/slots.md +235 -231
  174. package/kb/site/en/reference/subsystems/terminal.md +188 -188
  175. package/kb/site/en/reference/subsystems/tools.md +902 -891
  176. package/kb/site/en/reference/subsystems/user-questions.md +330 -327
  177. package/kb/site/en/reference/subsystems/web-client.md +161 -104
  178. package/kb/site/en/reference/subsystems/web-server.md +434 -351
  179. package/kb/site/en/reference/subsystems/web.md +268 -268
  180. package/kb/site/en/reference/subsystems/workflow.md +287 -282
  181. package/kb/site/en/reference/subsystems/workspace.md +743 -651
  182. package/kb/site/en/reference/tool-catalog.md +2867 -2704
  183. package/kb/site/guide/desktop-uninstall-cleanup.md +63 -0
  184. package/kb/site/guide/plugin-market.md +153 -151
  185. package/kb/site/guide/providers.md +234 -234
  186. package/kb/site/guide/quickstart.md +35 -34
  187. package/kb/site/reference/capability-seams.md +789 -767
  188. package/kb/site/reference/config-catalog.md +5432 -5128
  189. package/kb/site/reference/cookbook/adding-a-package.md +175 -175
  190. package/kb/site/reference/cookbook/adding-a-tool.md +107 -106
  191. package/kb/site/reference/cookbook/extension-cookbook.md +182 -139
  192. package/kb/site/reference/cordis-api/context.md +373 -369
  193. package/kb/site/reference/cordis-api/fiber.md +459 -435
  194. package/kb/site/reference/cordis-api/inherited.md +44 -44
  195. package/kb/site/reference/cordis-api/service.md +118 -107
  196. package/kb/site/reference/experimental-persistence-catalog.md +36 -23
  197. package/kb/site/reference/index.md +178 -178
  198. package/kb/site/reference/persistence-catalog.md +9453 -9432
  199. package/kb/site/reference/subsystems/compaction.md +288 -288
  200. package/kb/site/reference/subsystems/core.md +1184 -1183
  201. package/kb/site/reference/subsystems/credentials.md +526 -497
  202. package/kb/site/reference/subsystems/filesystem.md +708 -708
  203. package/kb/site/reference/subsystems/index.md +82 -82
  204. package/kb/site/reference/subsystems/llm-streaming.md +1296 -1294
  205. package/kb/site/reference/subsystems/lsp.md +230 -206
  206. package/kb/site/reference/subsystems/persistence.md +451 -432
  207. package/kb/site/reference/subsystems/plan.md +91 -91
  208. package/kb/site/reference/subsystems/ptc-runtime.md +295 -261
  209. package/kb/site/reference/subsystems/sandbox.md +250 -232
  210. package/kb/site/reference/subsystems/session-query.md +525 -515
  211. package/kb/site/reference/subsystems/session-reference.md +231 -229
  212. package/kb/site/reference/subsystems/session.md +1482 -1435
  213. package/kb/site/reference/subsystems/sidebar-right.md +165 -165
  214. package/kb/site/reference/subsystems/skills.md +356 -356
  215. package/kb/site/reference/subsystems/slots.md +239 -235
  216. package/kb/site/reference/subsystems/terminal.md +188 -188
  217. package/kb/site/reference/subsystems/tools.md +902 -891
  218. package/kb/site/reference/subsystems/user-questions.md +330 -327
  219. package/kb/site/reference/subsystems/web-client.md +161 -104
  220. package/kb/site/reference/subsystems/web-server.md +434 -351
  221. package/kb/site/reference/subsystems/web.md +268 -268
  222. package/kb/site/reference/subsystems/workflow.md +287 -282
  223. package/kb/site/reference/subsystems/workspace.md +743 -651
  224. package/kb/site/reference/tool-catalog.md +2872 -2709
  225. package/lib/index.js +359 -359
  226. package/package.json +68 -68
  227. package/skills/dsh-plugin-dev-kb.md +71 -70
  228. package/kb/extra/subsystems/office-to-pdf.md +0 -87
  229. package/kb/extra/subsystems/office-to-pdf.zh.md +0 -87
@@ -1,232 +1,250 @@
1
- ---
2
- editSource: "docs/subsystems/sandbox.md"
3
- rawMarkdownPath: "en/reference/subsystems/sandbox.md"
4
- outline: [2,3]
5
- ---
6
-
7
- # Process Sandbox
8
-
9
- The process-sandbox seam of [dsh-sandbox](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/sandbox/sandbox) wraps a same-world subprocess argv in a file-effect policy without coupling consumers to a platform runner. [dsh-sandbox-local](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/sandbox/sandbox-local) supplies Linux bwrap/Landlock, macOS Seatbelt, and the Windows ACL restricted-token backend; [dsh-bash-sandbox](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/shell/bash-sandbox) and [dsh-pwsh-sandbox](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/shell/pwsh-sandbox) consume it. [dsh-sandbox-ssh](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/ssh/sandbox-ssh/README.md) applies the same policy through a remote backend paired with the SSH filesystem and subprocess providers.
10
-
11
- Source: [`packages/sandbox/sandbox/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox/src/index.ts)
12
-
13
- ## Modes and enforcement
14
-
15
- `SandboxMode` governs filesystem effects only. `read-only` asks the backend to deny writes — the POSIX runners additionally grant the `/dev/null` sink their shells require, while the Windows ACL runner grants no explicit writable root and reports partial enforcement for its ambient ACL gaps; `workspace-write` permits writes under the workspace root, explicit extra directories, and the backend's promised temp area; `danger-full-access` bypasses confinement. Network and process visibility are outside this vocabulary.
16
-
17
- ```ts type-equiv
18
- /**
19
- * File-effect policy for confined processes. `read-only` permits only required
20
- * sinks such as `/dev/null`; `workspace-write` also permits the workspace,
21
- * explicit extra roots, and backend-defined temp areas; `danger-full-access` bypasses confinement. Network
22
- * and process visibility are outside this vocabulary.
23
- */
24
- type SandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access'
25
- ```
26
-
27
- Only the first two modes can be sent to a provider. A `danger-full-access` consumer spawns its original argv and does not call `ctx.sandbox`.
28
-
29
- ```ts type-equiv
30
- /** A confining (non-`danger-full-access`) mode — the modes a {@link SandboxPolicy} can carry. */
31
- type ConfinedSandboxMode = Exclude<SandboxMode, 'danger-full-access'>
32
- ```
33
-
34
- Enforcement is a reported fact. `full` means the backend governs every file effect promised by the mode; `partial` means an active backend or older kernel ABI governs only a subset, so consumers that require the absolute promise must reject or surface that distinction. Older Landlock ABIs and the Windows ACL runner's hard-link, unconfined-read, and AppContainer-ACL boundaries are current partial cases.
35
-
36
- ```ts type-equiv
37
- /**
38
- * Enforcement completeness for this host. `partial` means an active backend or
39
- * older kernel ABI cannot govern every promised file effect; callers requiring
40
- * an absolute boundary must not treat it as `full`.
41
- */
42
- type SandboxEnforcement = 'full' | 'partial'
43
- ```
44
-
45
- ## Per-call policy
46
-
47
- The complete execution policy is resolved and carried per capability call. It includes `danger-full-access` so a consumer can resolve policy once before deciding whether to bypass confinement. Normal tool calls derive `workspaceRoot` from the calling session's immutable cwd; deployment configuration supplies the agentless fallback and explicit additional write grants. The resolver preserves absolute execution-world spelling. Enforcing providers canonicalize the root where the files exist, so a cwd containing `symlink/..` identifies the directory where the paired subprocess provider actually runs.
48
-
49
- ```ts type-equiv
50
- /**
51
- * The complete file-effect policy resolved for one capability call. The root
52
- * is carried even under modes that do not consume it so callers can resolve
53
- * policy once before choosing the enforcement path.
54
- */
55
- interface SandboxExecutionPolicy {
56
- /** The file-effect mode this execution runs under. */
57
- mode: SandboxMode
58
- /** Absolute root directory `workspace-write` may write under. */
59
- workspaceRoot: string
60
- /**
61
- * Extra physical absolute directories `workspace-write` may also write under.
62
- * Absence means none. The enforcing host rejects missing, non-directory, and
63
- * symlinked entries on each call. Remote paths are checked on the remote host.
64
- * These grant nothing under `read-only` or `danger-full-access`.
65
- */
66
- additionalWritableRoots?: readonly string[]
67
- /**
68
- * Opaque identity of the calling session (the branded `dsh-session`
69
- * SessionId). Backends key per-session state off it (e.g. windows-acl gives
70
- * each live session/workspace pair a random private temp directory and SID,
71
- * while the workspace SID and standing grant remain per-workspace); absent
72
- * for agentless calls, which fall back to per-call backend state.
73
- */
74
- sessionId?: SessionId
75
- }
76
- ```
77
-
78
- `ctx.sandboxPolicy.resolve()` accepts the active session and, for an approved retry, an explicit mode. The service owns precedence and root fallback so bash and fs do not repeat it.
79
-
80
- ```ts type-equiv
81
- /** Inputs that select the sandbox policy for one capability call. */
82
- interface SandboxPolicyRequest {
83
- /** Calling session; its immutable cwd becomes the workspace boundary. */
84
- session?: Session
85
- /** Explicit approved mode override, which outranks session policy. */
86
- mode?: SandboxMode
87
- }
88
- ```
89
-
90
- Only a confined execution reaches `ctx.sandbox`; its provider policy narrows the mode while retaining the same root. This permits concurrent sessions, consumers, and one-shot escalated retries to ask the same provider for different boundaries without mutating provider state.
91
-
92
- ```ts type-equiv
93
- /**
94
- * What one confined execution is allowed to touch — carried PER CALL, not
95
- * fixed on the provider: two consumers may confine under different policies
96
- * at the same instant (bash under `read-only` while a confined child agent
97
- * needs its state directory writable), and an approved escalated retry is a
98
- * new call with a wider policy. Defaulting/resolution is an explicit step at
99
- * the consumer boundary; the provider treats the policy as fully specified.
100
- */
101
- interface SandboxPolicy extends SandboxExecutionPolicy {
102
- /** The file-effect mode this execution runs under. */
103
- mode: ConfinedSandboxMode
104
- }
105
- ```
106
-
107
- <a id="wrapped-argv-and-classification-dialects"></a>
108
-
109
- ## Wrapped argv and classification dialects
110
-
111
- `RunnerFailureRule` combines evidence that a runner failed before executing the command. A consumer requires a nonzero exit, the optional allowed-exit-code gate, and a case-insensitive fatal signature within one remaining stderr line. Case-insensitive exact full-line informational exclusions are removed first, so a benign runner notice cannot prove failure by itself. The matched line remains available as error detail; classification does not rewrite stderr.
112
-
113
- ```ts type-equiv
114
- /**
115
- * Evidence that identifies a sandbox runner failing before it executes the
116
- * wrapped command. A consumer first applies {@link allowedExitCodes} when
117
- * present, removes {@link informationalLines} by case-insensitive exact line
118
- * equality, then matches {@link fatalSignatures} case-insensitively within
119
- * each remaining stderr line. Exit status alone never proves runner failure.
120
- */
121
- interface RunnerFailureRule {
122
- /** Nonzero process exit codes on which this rule may match; omitted permits any nonzero exit. */
123
- allowedExitCodes?: readonly number[]
124
- /** Non-empty substrings identifying a fatal runner diagnostic on one stderr line. */
125
- fatalSignatures: readonly string[]
126
- /** Benign stderr lines excluded by exact full-line equality before fatal matching. */
127
- informationalLines?: readonly string[]
128
- }
129
- ```
130
-
131
- `ConfinedArgv` is what the consumer spawns. Besides the replacement argv, it carries the backend's enforcement fact and two orthogonal stderr classifiers. `denialSignatures` identify the confined command being blocked while the sandbox works correctly. `runnerFailureRules` identify the sandbox runner refusing or failing before it executes the command; consumers check these first and surface a sandbox infrastructure failure, never an ordinary task failure.
132
-
133
- ```ts type-equiv
134
- /**
135
- * A {@link SandboxProvider.confine} result: the argv to spawn in place of
136
- * the caller's own, plus the enforcement completeness the selected backend
137
- * achieves for it.
138
- */
139
- interface ConfinedArgv {
140
- /** The wrapped argv (runner, profile, separator, then the caller's argv). */
141
- argv: string[]
142
- /** How completely the selected backend enforces the policy's file effects. */
143
- enforcement: SandboxEnforcement
144
- /**
145
- * The selected backend's denial DIALECT: the case-insensitive stderr
146
- * substrings a file effect denied by THIS backend produces (EROFS text
147
- * under bwrap's read-only binds, EACCES under Landlock, EPERM under
148
- * Seatbelt). A consumer that infers denials from a failed run's stderr
149
- * matches against exactly these rather than a cross-backend union — the
150
- * union claims denials a given backend never produces.
151
- */
152
- denialSignatures: readonly string[]
153
- /**
154
- * Structured runner-failure evidence rules. Consumers require a matching
155
- * fatal stderr line (after informational exclusions) and any rule-specific
156
- * exit-code gate before checking denial signatures: runner failure means the
157
- * command never ran, while denial means confinement worked and blocked it.
158
- */
159
- runnerFailureRules: readonly RunnerFailureRule[]
160
- }
161
- ```
162
-
163
- The [local provider](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox-local/README.md) owns operator configuration and maps its runner dialect into these rules. The [sandboxed bash consumer](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/shell/bash-sandbox/README.md) owns spawn and result attribution.
164
-
165
- ## Provider and fail-closed errors
166
-
167
- `await ctx.sandbox.confine(argv, policy, signal)` resolves policy paths and returns a `ConfinedArgv` from the execution world, or rejects with `SandboxUnavailableError` and code `SANDBOX_UNAVAILABLE` when no usable backend exists. The optional signal cancels resolution before launch. Consumers may also classify a failure while spawning or observing the returned argv; that attribution belongs to the consumer contract. Silent unconfined passthrough is never legal for a confined policy.
168
-
169
- Provider selection, probing, caching, and backend-specific enforcement reports belong to the [local provider](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox-local/README.md).
170
-
171
- <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
172
-
173
- <a id="cordis-surface"></a>
174
-
175
- ## Cordis API
176
-
177
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
178
-
179
- <a id="ctxsandbox--sandboxprovider-abstract-seam"></a>
180
-
181
- ### `ctx.sandbox` — `SandboxProvider` (abstract seam)
182
-
183
- Abstract process-sandbox service. confine must return enforcing argv or fail closed at wrap or runner-execution time; silent unconfined passthrough is forbidden. Functional probes arbitrate multi-runner chains and may be skipped for a sole candidate, whose own refusal remains the fail-closed end.
184
-
185
- ```ts cordis-catalog
186
- /**
187
- * Wrap `argv` so it executes confined under `policy` on this host; the
188
- * caller spawns the returned argv in place of its own.
189
- * @param argv - the exact argv the caller is about to spawn (program plus
190
- * arguments), NOT a shell string — a shell-shaped consumer passes
191
- * `['bash', '-c', command]`.
192
- * @param policy - the file-effect policy this execution runs under,
193
- * carried per call (see {@link SandboxPolicy}).
194
- * @param signal - cancellation while the provider resolves the policy and runner.
195
- * @returns the argv to spawn instead, plus the enforcement completeness
196
- * the selected backend achieves for it.
197
- */
198
- abstract confine(argv: readonly string[], policy: SandboxPolicy, signal?: AbortSignal): Promise<ConfinedArgv>
199
- ```
200
-
201
- Source: [`packages/sandbox/sandbox/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox/src/index.ts)
202
-
203
- <a id="ctxsandboxpolicy--sandboxpolicyservice"></a>
204
-
205
- ### `ctx.sandboxPolicy` — `SandboxPolicyService`
206
-
207
- The sandbox-policy service (`ctx.sandboxPolicy`). Owns the deployment default mode, fallback workspace root, and current request-time policy section. Tool layers call resolve for each execution so a session's mode log and immutable cwd travel together to every enforcing capability.
208
-
209
- ```ts cordis-catalog
210
- /**
211
- * Resolve the complete policy for one capability call. An approved explicit
212
- * mode outranks the session's last `sandbox/mode` event, which outranks the
213
- * deployment default. A session cwd is its workspace-write boundary; the
214
- * configured root is the fallback for agentless calls and sessions without a
215
- * cwd.
216
- * @param request - optional session and approved mode override.
217
- * @returns the fully resolved per-call mode and absolute workspace root.
218
- */
219
- resolve(request: SandboxPolicyRequest = {}): SandboxExecutionPolicy
220
-
221
- /**
222
- * Read the session override without applying the deployment default.
223
- * @param session - session whose log supplies the override.
224
- * @returns the last logged mode, or `undefined` without one.
225
- */
226
- overrideOf(session: Session): SandboxMode | undefined
227
- ```
228
-
229
- Types: [Session](./session.md)
230
-
231
- Source: [`packages/sandbox/sandbox-policy/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox-policy/src/index.ts)
232
- <!-- END GENERATED cordis-surface -->
1
+ ---
2
+ editSource: "docs/subsystems/sandbox.md"
3
+ rawMarkdownPath: "en/reference/subsystems/sandbox.md"
4
+ outline: [2,3]
5
+ ---
6
+
7
+ # Process Sandbox
8
+
9
+ The process-sandbox seam of [dsh-sandbox](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/sandbox/sandbox) wraps a same-world subprocess argv in a file-effect policy without coupling consumers to a platform runner. [dsh-sandbox-local](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/sandbox/sandbox-local) supplies Linux bwrap/Landlock, macOS Seatbelt, and the Windows ACL restricted-token backend; [dsh-bash-sandbox](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/shell/bash-sandbox) and [dsh-pwsh-sandbox](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/shell/pwsh-sandbox) consume it. [dsh-sandbox-ssh](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/ssh/sandbox-ssh/README.md) applies the same policy through a remote backend paired with the SSH filesystem and subprocess providers.
10
+
11
+ Source: [`packages/sandbox/sandbox/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox/src/index.ts)
12
+
13
+ ## Modes and enforcement
14
+
15
+ `SandboxMode` governs filesystem effects only. `read-only` asks the backend to deny writes — the POSIX runners additionally grant the `/dev/null` sink their shells require, while the Windows ACL runner grants no explicit writable root and reports partial enforcement for its ambient ACL gaps; `workspace-write` permits writes under the workspace root, extra directories where supported, and the backend's promised temp area; `danger-full-access` bypasses confinement. Windows subprocesses ignore extra directory grants; the harness file tools enforce them independently. Network and process visibility are outside this vocabulary.
16
+
17
+ ```ts type-equiv
18
+ /**
19
+ * File-effect policy for confined processes. `read-only` permits only required
20
+ * sinks such as `/dev/null`; `workspace-write` also permits the workspace,
21
+ * explicit extra roots where supported, and backend-defined temp areas; `danger-full-access` bypasses confinement. Network
22
+ * and process visibility are outside this vocabulary.
23
+ */
24
+ type SandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access'
25
+ ```
26
+
27
+ Only the first two modes can be sent to a provider. A `danger-full-access` consumer spawns its original argv and does not call `ctx.sandbox`.
28
+
29
+ ```ts type-equiv
30
+ /** A confining (non-`danger-full-access`) mode — the modes a {@link SandboxPolicy} can carry. */
31
+ type ConfinedSandboxMode = Exclude<SandboxMode, 'danger-full-access'>
32
+ ```
33
+
34
+ Enforcement is a reported fact. `full` means the backend governs every file effect promised by the mode; `partial` means an active backend or older kernel ABI governs only a subset, so consumers that require the absolute promise must reject or surface that distinction. Older Landlock ABIs and the Windows ACL runner's hard-link, unconfined-read, and AppContainer-ACL boundaries are current partial cases.
35
+
36
+ ```ts type-equiv
37
+ /**
38
+ * Enforcement completeness for this host. `partial` means an active backend or
39
+ * older kernel ABI cannot govern every promised file effect; callers requiring
40
+ * an absolute boundary must not treat it as `full`.
41
+ */
42
+ type SandboxEnforcement = 'full' | 'partial'
43
+ ```
44
+
45
+ ## Per-call policy
46
+
47
+ The complete execution policy is resolved and carried per capability call. It includes `danger-full-access` so a consumer can resolve policy once before deciding whether to bypass confinement. Normal tool calls derive `workspaceRoot` from the calling session's immutable cwd; deployment configuration supplies the agentless fallback and shared additional write grants. Live Session registrations add effect-scoped directories to subsequent resolutions. The resolver preserves absolute execution-world spelling. Enforcing providers canonicalize the root where the files exist, so a cwd containing `symlink/..` identifies the directory where the paired subprocess provider actually runs.
48
+
49
+ ```ts type-equiv
50
+ /**
51
+ * The complete file-effect policy resolved for one capability call. The root
52
+ * is carried even under modes that do not consume it so callers can resolve
53
+ * policy once before choosing the enforcement path.
54
+ */
55
+ interface SandboxExecutionPolicy {
56
+ /** The file-effect mode this execution runs under. */
57
+ mode: SandboxMode
58
+ /** Absolute root directory `workspace-write` may write under. */
59
+ workspaceRoot: string
60
+ /**
61
+ * Extra physical absolute directories `workspace-write` may also write under.
62
+ * Absence means none. The enforcing host rejects missing, non-directory, and
63
+ * symlinked entries on each call. Remote paths are checked on the remote host.
64
+ * Windows process confinement ignores these; harness filesystem operations honor them.
65
+ * These grant nothing under `read-only` or `danger-full-access`.
66
+ */
67
+ additionalWritableRoots?: readonly string[]
68
+ /**
69
+ * Opaque identity of the calling session (the branded `dsh-session`
70
+ * SessionId). Backends key per-session state off it (e.g. windows-acl gives
71
+ * each live session/workspace pair a random private temp directory and SID,
72
+ * while the workspace SID and standing grant remain per-workspace); absent
73
+ * for agentless calls, which fall back to per-call backend state.
74
+ */
75
+ sessionId?: SessionId
76
+ }
77
+ ```
78
+
79
+ `ctx.sandboxPolicy.resolve()` accepts the active session and, for an approved retry, an explicit mode. The service owns precedence and root fallback so bash and fs do not repeat it.
80
+
81
+ ```ts type-equiv
82
+ /** Inputs that select the sandbox policy for one capability call. */
83
+ interface SandboxPolicyRequest {
84
+ /** Calling session; its immutable cwd becomes the workspace boundary. */
85
+ session?: Session
86
+ /** Explicit approved mode override, which outranks session policy. */
87
+ mode?: SandboxMode
88
+ }
89
+ ```
90
+
91
+ Only a confined execution reaches `ctx.sandbox`; its provider policy narrows the mode while retaining the same root. This permits concurrent sessions, consumers, and one-shot escalated retries to ask the same provider for different boundaries without mutating provider state.
92
+
93
+ ```ts type-equiv
94
+ /**
95
+ * What one confined execution is allowed to touch — carried PER CALL, not
96
+ * fixed on the provider: two consumers may confine under different policies
97
+ * at the same instant (bash under `read-only` while a confined child agent
98
+ * needs its state directory writable), and an approved escalated retry is a
99
+ * new call with a wider policy. Defaulting/resolution is an explicit step at
100
+ * the consumer boundary; the provider treats the policy as fully specified.
101
+ */
102
+ interface SandboxPolicy extends SandboxExecutionPolicy {
103
+ /** The file-effect mode this execution runs under. */
104
+ mode: ConfinedSandboxMode
105
+ }
106
+ ```
107
+
108
+ <a id="wrapped-argv-and-classification-dialects"></a>
109
+
110
+ ## Wrapped argv and classification dialects
111
+
112
+ `RunnerFailureRule` combines evidence that a runner failed before executing the command. A consumer requires a nonzero exit, the optional allowed-exit-code gate, and a case-insensitive fatal signature within one remaining stderr line. Case-insensitive exact full-line informational exclusions are removed first, so a benign runner notice cannot prove failure by itself. The matched line remains available as error detail; classification does not rewrite stderr.
113
+
114
+ ```ts type-equiv
115
+ /**
116
+ * Evidence that identifies a sandbox runner failing before it executes the
117
+ * wrapped command. A consumer first applies {@link allowedExitCodes} when
118
+ * present, removes {@link informationalLines} by case-insensitive exact line
119
+ * equality, then matches {@link fatalSignatures} case-insensitively within
120
+ * each remaining stderr line. Exit status alone never proves runner failure.
121
+ */
122
+ interface RunnerFailureRule {
123
+ /** Nonzero process exit codes on which this rule may match; omitted permits any nonzero exit. */
124
+ allowedExitCodes?: readonly number[]
125
+ /** Non-empty substrings identifying a fatal runner diagnostic on one stderr line. */
126
+ fatalSignatures: readonly string[]
127
+ /** Benign stderr lines excluded by exact full-line equality before fatal matching. */
128
+ informationalLines?: readonly string[]
129
+ }
130
+ ```
131
+
132
+ `ConfinedArgv` is what the consumer spawns. Besides the replacement argv, it carries the backend's enforcement fact and two orthogonal stderr classifiers. `denialSignatures` identify the confined command being blocked while the sandbox works correctly. `runnerFailureRules` identify the sandbox runner refusing or failing before it executes the command; consumers check these first and surface a sandbox infrastructure failure, never an ordinary task failure.
133
+
134
+ ```ts type-equiv
135
+ /**
136
+ * A {@link SandboxProvider.confine} result: the argv to spawn in place of
137
+ * the caller's own, plus the enforcement completeness the selected backend
138
+ * achieves for it.
139
+ */
140
+ interface ConfinedArgv {
141
+ /** The wrapped argv (runner, profile, separator, then the caller's argv). */
142
+ argv: string[]
143
+ /** How completely the selected backend enforces the policy's file effects. */
144
+ enforcement: SandboxEnforcement
145
+ /**
146
+ * The selected backend's denial DIALECT: the case-insensitive stderr
147
+ * substrings a file effect denied by THIS backend produces (EROFS text
148
+ * under bwrap's read-only binds, EACCES under Landlock, EPERM under
149
+ * Seatbelt). A consumer that infers denials from a failed run's stderr
150
+ * matches against exactly these rather than a cross-backend union — the
151
+ * union claims denials a given backend never produces.
152
+ */
153
+ denialSignatures: readonly string[]
154
+ /**
155
+ * Structured runner-failure evidence rules. Consumers require a matching
156
+ * fatal stderr line (after informational exclusions) and any rule-specific
157
+ * exit-code gate before checking denial signatures: runner failure means the
158
+ * command never ran, while denial means confinement worked and blocked it.
159
+ */
160
+ runnerFailureRules: readonly RunnerFailureRule[]
161
+ }
162
+ ```
163
+
164
+ The [local provider](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox-local/README.md) owns operator configuration and maps its runner dialect into these rules. The [sandboxed bash consumer](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/shell/bash-sandbox/README.md) owns spawn and result attribution.
165
+
166
+ ## Provider and fail-closed errors
167
+
168
+ `await ctx.sandbox.confine(argv, policy, signal)` resolves policy paths and returns a `ConfinedArgv` from the execution world, or rejects with `SandboxUnavailableError` and code `SANDBOX_UNAVAILABLE` when no usable backend exists, or with `SandboxPreparationError` (`SANDBOX_PREPARATION_FAILED`, `SANDBOX_INVALID_TEMP_ROOT`) when the provider cannot prepare host state for the mode. The optional signal cancels resolution before launch. Consumers may also classify a failure while spawning or observing the returned argv; that attribution belongs to the consumer contract. Silent unconfined passthrough is never legal for a confined policy.
169
+
170
+ Provider selection, probing, caching, and backend-specific enforcement reports belong to the [local provider](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox-local/README.md).
171
+
172
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
173
+
174
+ <a id="cordis-surface"></a>
175
+
176
+ ## Cordis API
177
+
178
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
179
+
180
+ <a id="ctxsandbox--sandboxprovider-abstract-seam"></a>
181
+
182
+ ### `ctx.sandbox` — `SandboxProvider` (abstract seam)
183
+
184
+ Abstract process-sandbox service. confine must return enforcing argv or fail closed at wrap or runner-execution time; silent unconfined passthrough is forbidden. Functional probes arbitrate multi-runner chains and may be skipped for a sole candidate, whose own refusal remains the fail-closed end.
185
+
186
+ ```ts cordis-catalog
187
+ /**
188
+ * Wrap `argv` so it executes confined under `policy` on this host; the
189
+ * caller spawns the returned argv in place of its own.
190
+ * @param argv - the exact argv the caller is about to spawn (program plus
191
+ * arguments), NOT a shell string — a shell-shaped consumer passes
192
+ * `['bash', '-c', command]`.
193
+ * @param policy - the file-effect policy this execution runs under,
194
+ * carried per call (see {@link SandboxPolicy}).
195
+ * @param signal - cancellation while the provider resolves the policy and runner.
196
+ * @returns the argv to spawn instead, plus the enforcement completeness
197
+ * the selected backend achieves for it.
198
+ */
199
+ abstract confine(argv: readonly string[], policy: SandboxPolicy, signal?: AbortSignal): Promise<ConfinedArgv>
200
+ ```
201
+
202
+ Source: [`packages/sandbox/sandbox/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox/src/index.ts)
203
+
204
+ <a id="ctxsandboxpolicy--sandboxpolicyservice"></a>
205
+
206
+ ### `ctx.sandboxPolicy` — `SandboxPolicyService`
207
+
208
+ The sandbox-policy service (`ctx.sandboxPolicy`). Owns the deployment default mode, fallback workspace root, session-scoped directory grants, and request-time policy section. Tool layers call resolve for each execution so a session's mode log and immutable cwd travel together to every enforcing capability.
209
+
210
+ ```ts cordis-catalog
211
+ /**
212
+ * Resolve the complete policy for one capability call. An approved explicit
213
+ * mode outranks the session's last `sandbox/mode` event, which outranks the
214
+ * deployment default. A session cwd is its workspace-write boundary; the
215
+ * configured root is the fallback for agentless calls and sessions without a
216
+ * cwd. Configured extra roots and this Session's active registrations are
217
+ * snapshotted together; existing operations and processes keep their policy.
218
+ * @param request - optional session and approved mode override.
219
+ * @returns the fully resolved per-call mode and absolute workspace root.
220
+ * @throws `SandboxInvalidRootError` (`SANDBOX_INVALID_ROOT`) when the session's recorded cwd is
221
+ * relative or contains a NUL byte.
222
+ */
223
+ resolve(request: SandboxPolicyRequest = {}): SandboxExecutionPolicy
224
+
225
+ /**
226
+ * Permit writes under one directory in this Session's future workspace-write
227
+ * operations. The calling context owns the effect; disposal removes only this
228
+ * registration. Other grants to the directory remain effective. Existing
229
+ * operations and persistent processes retain their resolved permissions.
230
+ * Grants are runtime-only and must be registered again after resume or fork.
231
+ * On Windows, only harness file tools honor extra grants; process permissions stay unchanged.
232
+ * @param session - exact live Session receiving the grant; other Sessions and agentless calls are unaffected.
233
+ * @param directory - absolute execution-world path; execution rejects missing, non-directory, or symlinked paths.
234
+ * @returns the exact Cordis effect disposer for this registration.
235
+ * @throws when the directory is relative or contains a NUL byte.
236
+ */
237
+ registerWritableRoot(session: Session, directory: string): () => void
238
+
239
+ /**
240
+ * Read the session override without applying the deployment default.
241
+ * @param session - session whose log supplies the override.
242
+ * @returns the last logged mode, or `undefined` without one.
243
+ */
244
+ overrideOf(session: Session): SandboxMode | undefined
245
+ ```
246
+
247
+ Types: [Session](./session.md)
248
+
249
+ Source: [`packages/sandbox/sandbox-policy/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/sandbox/sandbox-policy/src/index.ts)
250
+ <!-- END GENERATED cordis-surface -->