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,651 +1,743 @@
1
- ---
2
- editSource: "docs/subsystems/workspace.md"
3
- rawMarkdownPath: "en/reference/subsystems/workspace.md"
4
- outline: [2,3]
5
- ---
6
-
7
- # Workspaces
8
-
9
- A workspace is the persistent record of a directory the user works in: a stable id over a canonical path, a display title, and the ordered account of sessions that belong to it. The subsystem is one package ([dsh-workspace](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/workspace/workspace), `ctx.workspaceRegistry`) — an optional host-side capability, not part of the agent-loop spine, and invisible to models (no tools, no prompt text, no session events). It stores its records through the [storage domain form](./storage.md) and validates session membership against [`SessionHeader.cwd`](./persistence.md#sessionheader--metadata-beside-the-log), so `storageDomain` and `sessionPersistence` are mandatory startup dependencies: an unavailable persistence peer leaves the plugin pending rather than being mistaken for an empty history. Design record: [domain KV storage Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.md); bootstrap and GUI ordering: [Workspace UI product-flow Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md).
10
-
11
- Source: [`packages/workspace/workspace/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/types.ts)
12
-
13
- ## Identity
14
-
15
- ```ts type-equiv
16
- /**
17
- * Identifies one workspace record. A generated uuid, never the path: path
18
- * normalization rewrites paths, and a reference anchor must stay stable.
19
- */
20
- type WorkspaceId = Branded<'WorkspaceId'>
21
- ```
22
-
23
- `WorkspaceId` is a [branded id](./core.md#branded-ids). Path identity is separate: `realpathNormalize` (`fs.realpath`; trailing slashes, `..`, and symlinks resolved) is the one uniqueness canon — workspace paths are stored canonicalized, uniqueness is string equality of canonical paths (a symlink to an owned directory collides), and attach-time session cwd checks go through the same canon.
24
-
25
- ## The workspace entity
26
-
27
- Consumers see only the `Workspace` interface; the implementation stays package-private.
28
-
29
- ```ts type-equiv
30
- /**
31
- * One workspace: a stable id over an existing directory, a display title, and
32
- * an ordered candidate account of sessions. Membership validates header cwd
33
- * against the workspace path, but preserves an existing account when its
34
- * fully qualified cwd is missing. Consumers only see this interface; the
35
- * implementation stays private.
36
- */
37
- interface Workspace {
38
- /** Stable record id (generated uuid). */
39
- readonly id: WorkspaceId
40
-
41
- /**
42
- * Canonical directory path: the `fs.realpath` of the path given at create
43
- * time (trailing slashes, `..`, and symlinks all resolved). Never rewritten
44
- * afterwards, even when the directory disappears (see {@link status}).
45
- */
46
- readonly path: string
47
-
48
- /** Display title. Defaults to the final path segment, or a filesystem root's own spelling; duplicates are allowed. */
49
- readonly title: string
50
-
51
- /** ISO-8601 creation instant, stamped at create and never rewritten. */
52
- readonly createdAt: string
53
-
54
- /** ISO-8601 instant of the last durable mutation (create counts as one). */
55
- readonly updatedAt: string
56
-
57
- /**
58
- * Header-validated sessions in manually owned order: a new session is
59
- * prepended at attach, explicit reordering goes through
60
- * `insertSessionBefore`, and activity never reorders. The durable candidate
61
- * account is filtered synchronously: missing headers, invalid cwd values,
62
- * and canonical cwd mismatches are never returned. A fully qualified cwd
63
- * whose realpath or directory stat fails with ENOENT preserves an existing
64
- * candidate, including a dangling symlink; other filesystem failures do not.
65
- * A subsequent mutation prunes filtered candidates, not missing-directory
66
- * candidates. This does not admit new sessions or recreate directories.
67
- */
68
- readonly sessionIds: readonly SessionId[]
69
-
70
- /**
71
- * Replace the display title durably.
72
- * @param title - New title; any string, duplicates across workspaces allowed.
73
- * @returns resolution after durability.
74
- */
75
- setTitle(title: string): Promise<void>
76
-
77
- /**
78
- * Prepend a session to this workspace's candidate account. An already
79
- * accounted id resolves without writing, aside from the durable
80
- * filtered-candidate prune every accepted mutation performs. A new id's
81
- * live or persisted
82
- * header cwd must resolve to an existing directory equal to {@link path};
83
- * unknown ids, missing or invalid cwd values, and mismatches reject without
84
- * writing.
85
- * @param sessionId - The session to record.
86
- * @returns resolution after durability.
87
- */
88
- attachSession(sessionId: SessionId): Promise<void>
89
-
90
- /**
91
- * Move an accounted session within the manual order, DOM-insertBefore-like:
92
- * with an anchor the session lands before it, without one it appends to the
93
- * end. Only the moved id changes position. A session or anchor absent from
94
- * the account rejects without writing; a move to the current position
95
- * resolves without writing, aside from the durable filtered-candidate
96
- * prune every accepted mutation performs; decided on the domain write
97
- * chain.
98
- * @param sessionId - The accounted session to move.
99
- * @param beforeSessionId - Accounted anchor to insert before; omitted appends.
100
- * @returns resolution after durability.
101
- */
102
- insertSessionBefore(sessionId: SessionId, beforeSessionId?: SessionId): Promise<void>
103
-
104
- /**
105
- * Remove a session from this workspace's account. Idempotent: an id not on
106
- * the account resolves without writing, aside from the durable
107
- * filtered-candidate prune every accepted mutation performs; decided on
108
- * the domain write chain like attach. Never touches the session's own stored log.
109
- * @param sessionId - The session to remove.
110
- * @returns resolution after durability.
111
- */
112
- detachSession(sessionId: SessionId): Promise<void>
113
-
114
- /**
115
- * Live directory check, uncached: whether {@link path} currently exists and
116
- * is a directory. A missing directory never mutates the record — the
117
- * directory may only be temporarily moved.
118
- * @returns `'ok'` when the directory exists, `'missing-dir'` otherwise.
119
- */
120
- status(): Promise<'ok' | 'missing-dir'>
121
- }
122
- ```
123
-
124
- Ownership truth is the record's ordered `sessionIds`, never derived from session cwd. Membership validates the recorded header cwd against the workspace path; an existing candidate remains owned when its fully qualified cwd fails resolution or directory stat with `ENOENT`. This preserves missing-directory and dangling-symlink accounts without admitting new sessions. Failed writes reject (`insertSessionBefore` account errors as `WorkspaceMoveInvalidError`, storage failures as plain errors); every accepted mutation stamps `updatedAt` and durably prunes candidates that no longer pass the membership check.
125
-
126
- ## The registry: `ctx.workspaceRegistry`
127
-
128
- `WorkspaceRegistry` ([signatures](#ctxworkspaceregistry--workspaceregistry)) owns registration and resolution. `create(path, title?)` requires a fully qualified path, canonicalizes it, rejects a nonexistent path (the original `ENOENT`) or a non-directory, returns the existing entity unchanged when the canonical path is already owned, and otherwise creates a record with `title ?? defaultWorkspaceTitle(path)` prepended to the durable registry order (different canonical paths may share a display title, and a path with no final segment uses its root spelling). `get(id)` and the ordered `list()` are synchronous cache reads; `resolveByPath(path)` applies the same fully qualified realpath canon without creating. `delete(id)` removes only the registration, order entry, and session account — the directory, user files, live sessions, and persisted logs are never touched, so those sessions become Ungrouped ([reference](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/README.md)); unknown ids return `false`. Create and delete persist a pending-mutation marker before their two writes (record + order) can diverge; startup resolves exactly the marked mutation — by deleting the marked table row, which completes an interrupted delete and rolls back an interrupted create (the registration is re-creatable, so rollback is the safe direction) — and an unmarked order/table mismatch fails loud as corruption.
129
-
130
- Sessions get their cwd at create time from whoever creates them, not from this registry — the API gateway resolves a new session's cwd from the chosen workspace's `path` (falling back to an explicit or default cwd), creates the session so the cwd lands in its immutable [`SessionHeader`](./persistence.md#sessionheader--metadata-beside-the-log), then calls `attachSession`, which re-validates that stored header cwd against the workspace path. On the first successful start, the registry bootstraps history from persisted headers alone (`id`, `cwd`, `createdAt` — never event bodies), grouping sessions with a valid canonical cwd into per-directory workspaces, newest first; the initialized marker is written last so an interrupted bootstrap resumes safely. The bootstrap is one-time: cwd-less legacy sessions stay Ungrouped, and sessions created afterwards join a workspace only through `attachSession`.
131
-
132
- ## Default Workspace initialization
133
-
134
- The controller's `initializeDefault` takes no request: it owns the fixed `default-workspace` directory name, resolves the Documents location, and asks the registry to initialize once. The registry accepts a directory resolver, derives the initial title from the requested directory's final segment rather than the canonical one, and commits the registration with its durable identity. No language reaches the Host — browser consumers label a Workspace still carrying that automatic title through the controller's `workspaceDisplayTitle`, so only the on-screen name follows the reader's language. [First-use behavior and configuration](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/README.md#first-use-workspace) describe reuse and failure handling.
135
-
136
- ## Session pinning
137
-
138
- The controller's [transport types](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/types.ts) define `WorkspacePinSessionRequest` and `WorkspaceUnpinSessionRequest`, each carrying one `sessionId`. Both operations return `WorkspacePinValue`: the complete `pinnedSessionIds` array of Session ids, most recently pinned first. Pinning requires a known, unarchived Session; unpinning an id that is not pinned succeeds without changing the set. Archiving removes the Session's pin in the same durable write, and unarchiving does not restore it.
139
-
140
- ## Archive admission
141
-
142
- Archiving is a registry-global durable set, and the registry refuses to hide running work behind it. The rule is a capability seam over two Host events the package declares and dispatches ([events](#workspace-events)): `workspace/session-activity` (waterfall) asks the composed providers what still runs for a Session, and `workspace/session-stop` (parallel) asks them to stop it. Each provider registers on the root like any listener, so the package knows no agent, job, or schedule vocabulary; the families are keys of a merge-extensible map.
143
-
144
- ```ts type-equiv
145
- /**
146
- * Activity families a `workspace/session-activity` listener may report. This
147
- * package declares none: each provider merges its own key from a module both
148
- * its Host and Client faces import, so a consumer that renders the families
149
- * sees exactly the keys its program compiled and falls through to a generic
150
- * description for any other. The shipped providers merge `turn` (the Agent
151
- * registry), `job` (the job registry seam), `subagent` (the Subagent
152
- * runtime), and `schedule` (the Schedule plugin).
153
- */
154
- interface SessionActivityKindMap {}
155
- ```
156
-
157
- `SessionActivityKind` is `keyof SessionActivityKindMap`, so a program that compiled no provider sees no key at all. The shipped keys live in client-importable type modules: `turn` in the Agent registry's `types.ts`, `job` in the job registry seam's `view.ts`, `subagent` in the Subagent runtime's `control-types.ts`, `schedule` in the Schedule plugin's `types.ts`; a consumer that renders the families imports those modules for its cases and keeps a generic line for any other key. A provider answers the waterfall by prepending its `SessionActivity` entries to the result of `next()`; the registry's innermost callback returns an empty list, so a composition without providers archives freely.
158
-
159
- ```ts type-equiv
160
- /**
161
- * One reason a session counts as active for archive admission. Families with
162
- * per-item identity list their items so a caller can name what must stop.
163
- */
164
- interface SessionActivity {
165
- readonly kind: SessionActivityKind
166
- /** Active items of the family; absent for a family without per-item identity (`turn`). */
167
- readonly items?: readonly SessionActivityItem[]
168
- }
169
- ```
170
-
171
- `SessionActivityItem` carries the family-specific `id` (a session, job, or schedule id) and an optional display `label`. `archiveSession(sessionId)` asks the waterfall once, after the existence check, and rejects a non-empty answer with `WorkspaceActiveSessionError` (`sessionId`, `activity`) without writing; the controller maps it to the `workspace/session-active` error, whose details carry the same two fields. `archiveSession(sessionId, { stopActivity: true })` — the `ArchiveSessionOptions` field the transport request exposes as `stopActivity` — skips the check, writes the archive, then dispatches `workspace/session-stop`; a rejecting provider is logged and the archive stays, and the stopped work is never awaited to settlement. An already archived id neither asks nor stops. The shipped providers, what they stop, and the `agent/pre-step` gate that keeps an archived Session from running a model step are documented with the [registry package](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/README.md#api-behavior); the decision record is the [archive-stops-running-work Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-09-21-archive-stops-running-session-work.md).
172
-
173
- ## Consumers
174
-
175
- [`dsh-workspace-controller`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/api/workspace-controller) serves workspace CRUD to GUI clients over `ctx.workspaceRegistry`, and [`dsh-session-controller`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/api/session-controller) performs the create-session-then-attach flow above. [dsh-agent-instructions](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/context/agent-instructions) is **not** a consumer despite the name: it discovers AGENTS.md-style instruction files under an agent's own cwd and never touches `ctx.workspaceRegistry` — the shared word refers to the user's working directory, not to this registry's entities.
176
-
177
- <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
178
-
179
- <a id="cordis-surface"></a>
180
-
181
- ## Cordis API
182
-
183
- 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).
184
-
185
- <a id="ctxdirectorypicker--directorypicker-abstract-seam"></a>
186
-
187
- ### `ctx.directoryPicker` — `DirectoryPicker` (abstract seam)
188
-
189
- Abstract directory-picking service. Subclass, implement `capability()`, and load the subclass as a plugin — it registers as `ctx.directoryPicker` (one implementation per context; loading a second throws, cordis' standard duplicate-service behavior). The capability object must be stable for the service lifetime: consumers may capture it across calls.
190
-
191
- ```ts cordis-catalog
192
- /**
193
- * The backend's interaction capability.
194
- * @returns the discriminated capability consumers switch on.
195
- */
196
- abstract capability(): DirectoryPickerCapability
197
- ```
198
-
199
- Source: [`packages/host/directory-picker/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/directory-picker/src/index.ts)
200
-
201
- <a id="ctxdirectorypickercontroller--directorypickercontroller"></a>
202
-
203
- ### `ctx.directoryPickerController` — `DirectoryPickerController`
204
-
205
- Host service backing the generated `ctx.remote.directoryPicker` namespace. The seam it exports is abstract and therefore never a Loader entry of its own, so this controller carries the wire verbs: one composed backend serves either the native chooser or the browse primitives, and a verb the composition cannot serve is refused rather than approximated.
206
-
207
- ```ts cordis-catalog
208
- /**
209
- * Open the host's OS chooser for a Remote caller.
210
- * @param signal - caller lifetime; abort terminates the chooser.
211
- * @returns the chosen absolute path, or null when the operator cancels.
212
- */
213
- @Remote('pick') async pick(signal: AbortSignal): Promise<string | null>
214
-
215
- /**
216
- * List one directory level for a Remote caller's in-app browser.
217
- * @param path - absolute directory to list; absent lists the home directory.
218
- * @param signal - caller lifetime; abort stops the backend's scan instead of
219
- * letting it outlive a disconnected caller.
220
- * @returns the level's listing with its ancestry.
221
- */
222
- @Remote('list') async list(path: string | undefined, signal: AbortSignal): Promise<DirectoryListing>
223
-
224
- /**
225
- * Create one child directory for a Remote caller's in-app browser.
226
- * @param path - absolute existing parent directory.
227
- * @param name - single non-blank path segment.
228
- * @returns the created directory's absolute path.
229
- */
230
- @Remote('createDirectory') async createDirectory(path: string, name: string): Promise<string>
231
- ```
232
-
233
- Source: [`packages/api/workspace-controller/src/directory-picker.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/directory-picker.ts)
234
-
235
- <a id="ctxterminalcontroller--terminalcontroller"></a>
236
-
237
- ### `ctx.terminalController` — `TerminalController`
238
-
239
- Typed Remote control of transient Session-owned terminal processes.
240
-
241
- ```ts cordis-catalog
242
- /**
243
- * Read the Session's current directory and terminal limits without filesystem validation or shell lookup.
244
- * @param agent - Session owner supplied by the Gateway.
245
- * @param signal - request cancellation.
246
- * @returns the logged current directory and terminal limits; retained terminals keep their own process directories.
247
- */
248
- @Remote environment(agent: Agent, signal: AbortSignal): TerminalEnvironment
249
-
250
- /**
251
- * Discover installed shells in the Session's execution environment.
252
- * @param agent - Session owner supplied by the Gateway.
253
- * @param signal - request cancellation.
254
- * @returns verified profiles, with the configured or system default first.
255
- */
256
- @Remote shells(agent: Agent, signal: AbortSignal): Promise<TerminalShell[]>
257
-
258
- /**
259
- * List retained terminals without resolving or activating an Agent.
260
- * @param sessionId - displayed Session identity, including offline history.
261
- * @returns terminals retained for this Host lifetime.
262
- */
263
- @Remote list(sessionId: SessionId): WebTerminalInfo[]
264
-
265
- /**
266
- * Allocate a user shell once for a caller-generated identity, without Agent sandbox or approval restrictions.
267
- * @param agent - Session owner supplied by the Gateway.
268
- * @param request - initial dimensions and idempotency identity.
269
- * @param signal - allocation cancellation; committed terminals survive disconnection.
270
- * @returns the existing or newly committed terminal.
271
- */
272
- @Remote async create(agent: Agent, request: TerminalCreateRequest, signal: AbortSignal): Promise<WebTerminalInfo>
273
-
274
- /**
275
- * Retain an existing terminal for a window without activating its Agent or taking input control.
276
- * @param sessionId - owning Session identity, including an inactive saved layout.
277
- * @param id - retained Host terminal identity.
278
- * @param signal - physical Remote stream cancellation.
279
- * @returns a hold acknowledgement followed by an open lifetime stream.
280
- */
281
- @Remote({ mode: 'stream' }) retain(sessionId: SessionId, id: WebTerminalId, signal: AbortSignal): AsyncIterable<TerminalRetentionFrame>
282
-
283
- /**
284
- * Attach terminal input and output to one physical Remote stream.
285
- * @param agent - Session owner supplied by the Gateway.
286
- * @param id - terminal identity.
287
- * @param signal - attachment cancellation; the process remains alive and input is never replayed.
288
- * @returns screen recovery, output, writable state and provider-acceptance acknowledgements.
289
- */
290
- @Remote({ mode: 'stream' }) attach(agent: Agent, id: WebTerminalId, signal: AbortSignal): RemoteStream<TerminalFrame, TerminalInput>
291
-
292
- /**
293
- * Rename a terminal without changing its shell.
294
- * @param agent - Session owner supplied by the Gateway.
295
- * @param id - terminal identity.
296
- * @param title - nonempty display title, at most 120 characters.
297
- */
298
- @Remote rename(agent: Agent, id: WebTerminalId, title: string): void
299
-
300
- /**
301
- * Close an identity to future creation and kill its process range; repeated closes succeed.
302
- * @param agent - Session owner supplied by the Gateway.
303
- * @param id - terminal identity.
304
- * @returns after provider cleanup succeeds. A failure retains the terminal for retry.
305
- */
306
- @Remote async close(agent: Agent, id: WebTerminalId): Promise<void>
307
- ```
308
-
309
- Types: [Agent](./core.md) · [RemoteStream](./typert.md) · [SessionId](./core.md)
310
-
311
- Source: [`packages/api/terminal-controller/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/terminal-controller/src/index.ts)
312
-
313
- <a id="ctxworkspacecontroller--workspacecontroller"></a>
314
-
315
- ### `ctx.workspaceController` — `WorkspaceController`
316
-
317
- Host service backing the generated `ctx.remote.workspace` namespace.
318
-
319
- ```ts cordis-catalog
320
- /**
321
- * Create or idempotently resolve one Workspace over an existing directory.
322
- * @param request - directory path to register.
323
- * @returns the Workspace and whether this call created it.
324
- */
325
- @Remote('create') create(request: WorkspaceCreateRequest): Promise<WorkspaceCreateValue>
326
-
327
- /**
328
- * Initialize or reuse the default Workspace during first-use startup. The
329
- * directory name is fixed, so the Host never renames or relocates an
330
- * existing default; its initial title is that same name, which browser
331
- * consumers label in the reader's language.
332
- * @param signal - caller lifetime; cancels native directory lookup.
333
- * @returns the durable Workspace, or undefined when first-use initialization is ineligible; creates no Session or message.
334
- */
335
- @Remote('initializeDefault') async initializeDefault(signal: AbortSignal): Promise<WorkspaceValue | undefined>
336
-
337
- /**
338
- * Rename one Workspace to a unique non-blank title.
339
- * @param request - Workspace identity and proposed title.
340
- * @returns the updated Workspace projection.
341
- */
342
- @Remote('rename') rename(request: WorkspaceRenameRequest): Promise<WorkspaceValue>
343
-
344
- /**
345
- * Remove one Workspace registration while retaining files and Sessions.
346
- * @param request - Workspace identity to remove.
347
- * @returns deletion confirmation.
348
- */
349
- @Remote('delete') delete(request: WorkspaceDeleteRequest): Promise<WorkspaceDeleteValue>
350
-
351
- /**
352
- * Move one Workspace within the registry display order.
353
- * @param request - moved Workspace and optional anchor.
354
- * @returns the complete resulting Workspace order.
355
- */
356
- @Remote('insertBefore') insertBefore(request: WorkspaceInsertBeforeRequest): Promise<WorkspaceOrderValue>
357
-
358
- /**
359
- * Move one accounted Session within a Workspace.
360
- * @param request - Workspace, Session, and optional anchor identities.
361
- * @returns the updated Workspace projection.
362
- */
363
- @Remote('insertSessionBefore') insertSessionBefore(request: WorkspaceInsertSessionBeforeRequest): Promise<WorkspaceValue>
364
-
365
- /**
366
- * Hide one known Session from Workspace grouping surfaces.
367
- * @param request - Session identity to archive.
368
- * @returns the complete resulting archive set.
369
- */
370
- @Remote('archiveSession') archiveSession(request: WorkspaceArchiveSessionRequest): Promise<WorkspaceArchiveValue>
371
-
372
- /**
373
- * Restore one archived Session to Workspace grouping surfaces.
374
- * @param request - Session identity to unarchive.
375
- * @returns the complete resulting archive set.
376
- */
377
- @Remote('unarchiveSession') unarchiveSession(request: WorkspaceUnarchiveSessionRequest): Promise<WorkspaceArchiveValue>
378
-
379
- /**
380
- * Surface one known unarchived Session ahead of unpinned Sessions.
381
- * @param request - Session identity to pin.
382
- * @returns the complete resulting pin set, most recently pinned first.
383
- */
384
- @Remote('pinSession') pinSession(request: WorkspacePinSessionRequest): Promise<WorkspacePinValue>
385
-
386
- /**
387
- * Remove one Session's pin without changing its saved Session order.
388
- * @param request - Session identity to unpin.
389
- * @returns the complete resulting pin set, most recently pinned first.
390
- */
391
- @Remote('unpinSession') unpinSession(request: WorkspaceUnpinSessionRequest): Promise<WorkspacePinValue>
392
-
393
- /**
394
- * Stream a complete Workspace baseline followed by ordered increments. A
395
- * non-owner receives only the Workspaces and Sessions `allows()` admits.
396
- * When a delivered Workspace is no longer admitted at its next change or
397
- * the next order change, the stream sends a `replace` frame with the
398
- * complete filtered state instead of a `remove`, because a Client never
399
- * resurrects a removed Workspace; a `remove` frame reports a deletion and
400
- * reaches only a Client that received that Workspace.
401
- * @param signal - generation cancellation.
402
- * @returns baseline followed by ordered Workspace increments.
403
- */
404
- @Remote({ mode: 'stream' }) async *follow(signal: AbortSignal): AsyncIterable<WorkspaceFollowFrame>
405
- ```
406
-
407
- Source: [`packages/api/workspace-controller/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/index.ts)
408
-
409
- <a id="ctxworkspacefiles--workspacefiles"></a>
410
-
411
- ### `ctx.workspaceFiles` — `WorkspaceFiles`
412
-
413
- Host Remote file reads and workspace directory observations over the composed filesystem.
414
-
415
- ```ts cordis-catalog
416
- /**
417
- * Read one page of lines from a UTF-8 file readable by the filesystem backend.
418
- * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
419
- * @param path - absolute path or path relative to the workspace root; files outside it are allowed.
420
- * @param range - the line window; omitted fields take the page defaults.
421
- * @param signal - caller cancellation.
422
- * @returns the page, the file's version at the stat before it, and whether it reaches the last line.
423
- */
424
- @Remote async read( workspaceFileScope: WorkspaceFileScope, path: string, range: WorkspaceFileRange, signal: AbortSignal, ): Promise<WorkspaceFileText>
425
-
426
- /**
427
- * Read a complete regular file or one byte range without text decoding.
428
- * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
429
- * @param path - target path, absolute or workspace-relative; relative to the base file's directory when provided.
430
- * @param options - optional base file and range; without a range the complete-file cap applies.
431
- * @param signal - caller cancellation.
432
- * @returns native bytes with the file's version and size at the preceding stat, byte offset, and EOF marker.
433
- */
434
- @Remote async readBytes( workspaceFileScope: WorkspaceFileScope, path: string, options: WorkspaceByteReadOptions, signal: AbortSignal, ): Promise<WorkspaceFileBytes>
435
-
436
- /**
437
- * Report one regular file's identity, version, and size without its content.
438
- * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
439
- * @param path - absolute path or path relative to the workspace root; files outside it are allowed.
440
- * @param signal - caller cancellation.
441
- * @returns the file's absolute path, current version, and byte size.
442
- */
443
- @Remote async stat(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceFileStat>
444
-
445
- /**
446
- * List the direct children of one directory inside the Session's workspace.
447
- * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
448
- * @param path - workspace path, absolute or relative to the workspace root.
449
- * @param signal - caller cancellation.
450
- * @returns the directory's children in the backend's stable name order, bounded by the entry cap.
451
- */
452
- @Remote async list(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceDirectoryListing>
453
-
454
- /**
455
- * Watch one file or a directory's direct entries in the Session's filesystem.
456
- * Files use the backend's read authority; directories remain workspace-scoped.
457
- * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
458
- * @param path - target path; the Host determines its type and confines directories to the workspace.
459
- * @param signal - generation cancellation.
460
- * @returns `ready` once the target watch is active, then current metadata for queued and live invalidations.
461
- * @throws RemoteError when watching is unavailable or a directory is outside the workspace.
462
- */
463
- @Remote({ mode: 'stream' }) changes(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): AsyncIterable<WorkspaceFileWatchFrame>
464
- ```
465
-
466
- Source: [`packages/api/workspace-files/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-files/src/index.ts)
467
-
468
- <a id="ctxworkspaceregistry--workspaceregistry"></a>
469
-
470
- ### `ctx.workspaceRegistry` — `WorkspaceRegistry`
471
-
472
- Durable workspace registry. Startup waits for `sessionPersistence`, builds one canonical-cwd header index, and completes the one-time history bootstrap before the service becomes active. The persistence dependency is mandatory so an unavailable peer can never be mistaken for an empty history and commit the initialized marker.
473
-
474
- ```ts cordis-catalog
475
- /**
476
- * Create or reuse a workspace for an existing directory. The fully qualified
477
- * path is canonicalized through `fs.realpath`; a relative, nonexistent, or
478
- * non-directory path rejects. Repeated calls for the same canonical path
479
- * return the existing entity without changing its title.
480
- * A newly created workspace is prepended to the durable registry order.
481
- * Different canonical paths may share a display title.
482
- * @param path - Existing directory to own, in a fully qualified path spelling.
483
- * @param title - Display title used only when a new record is created.
484
- * @returns the existing or newly durable workspace.
485
- */
486
- async create(path: string, title?: string): Promise<Workspace>
487
-
488
- /**
489
- * Initialize the default Workspace only while both the registry and Session
490
- * history are empty. Repeated requests reuse its durable identity; deleting
491
- * that registration permanently disables automatic creation.
492
- * @param resolveDirectory - resolve the absolute directory; called only for
493
- * eligible creation, inside the registry mutation queue. Missing directories
494
- * are created recursively before registration, and the initial title is the
495
- * requested directory's own final segment — not the canonical one, so a
496
- * symlink at that path does not retitle the Workspace after its target.
497
- * After resolution, caller cancellation does not roll back creation or registration.
498
- * @returns the initialized Workspace, or undefined when automatic creation is ineligible.
499
- */
500
- initializeDefault(resolveDirectory: () => Promise<string>): Promise<Workspace | undefined>
501
-
502
- /**
503
- * Look up a workspace by id.
504
- * @param id - Workspace id.
505
- * @returns the workspace, or `undefined` when unknown.
506
- */
507
- get(id: WorkspaceId): Workspace | undefined
508
-
509
- /**
510
- * Synchronous workspace projection in durable registry order. Every
511
- * entity's `sessionIds` getter is already filtered by the startup/live
512
- * canonical-cwd header index; this method performs no persistence reads.
513
- * @returns a fresh ordered array of workspace entities.
514
- */
515
- list(): Workspace[]
516
-
517
- /**
518
- * Delete one workspace registration while retaining its directory and every
519
- * session log. The durable order is updated before the table deletion; a
520
- * failed table write restores the prior order and keeps the entity
521
- * published. Unknown ids are an idempotent no-op for domain callers.
522
- * @param id - Workspace registration to remove.
523
- * @returns `true` when a record was deleted, `false` when it was unknown.
524
- */
525
- delete(id: WorkspaceId): Promise<boolean>
526
-
527
- /**
528
- * Move one workspace within the durable display order, DOM-insertBefore-like.
529
- * With an anchor it lands before that workspace; without one it appends.
530
- * @param id - Workspace to move.
531
- * @param beforeId - Workspace anchor; omitted appends.
532
- * @returns the complete committed workspace order.
533
- */
534
- insertBefore(id: WorkspaceId, beforeId?: WorkspaceId): Promise<readonly WorkspaceId[]>
535
-
536
- /**
537
- * Archive one session durably. The session must exist (live or in session
538
- * persistence); its workspace accounting — or lack of one — is irrelevant.
539
- * Without `stopActivity` the session must also be inactive: the
540
- * `workspace/session-activity` waterfall is asked once, and any reported
541
- * activity rejects with {@link WorkspaceActiveSessionError} before anything
542
- * is written. With `stopActivity` the archive is written without an
543
- * activity check, and the `workspace/session-stop` providers are then asked
544
- * to stop the session's work: the durable archive set is what a provider's
545
- * `agent/pre-step` gate reads, so every wake the stops induce is already
546
- * blocked. Archiving drops the session's pin in the same durable write
547
- * (pinning and archival are mutually exclusive). An already archived id
548
- * resolves without writing, asking, or stopping.
549
- * @param sessionId - The session to archive.
550
- * @param options - Whether running work is stopped instead of refusing.
551
- * @returns resolution after durability and, with `stopActivity`, after every stop request was issued.
552
- */
553
- archiveSession(sessionId: SessionId, options: ArchiveSessionOptions = {}): Promise<void>
554
-
555
- /**
556
- * Unarchive one session durably by dropping it from the registry-global
557
- * archive set; the accounting slot was never touched, so the session
558
- * returns to its recorded position. Unarchiving runs no session-existence
559
- * check because removing an id cannot introduce an unknown one, so an
560
- * entry whose session is gone still resolves. An id that is not archived
561
- * resolves without writing.
562
- * @param sessionId - The session to unarchive.
563
- * @returns resolution after durability.
564
- */
565
- unarchiveSession(sessionId: SessionId): Promise<void>
566
-
567
- /**
568
- * Pin one session durably, prepending it to the registry-global pin set.
569
- * The session must exist (live or in session persistence) and must not be
570
- * archived. An already pinned id resolves without writing or reordering.
571
- * @param sessionId - The session to pin.
572
- * @returns resolution after durability.
573
- */
574
- pinSession(sessionId: SessionId): Promise<void>
575
-
576
- /**
577
- * Unpin one session durably by dropping it from the registry-global pin
578
- * set. Unpinning runs no session-existence check because removing an id
579
- * cannot introduce an unknown one, so an entry whose session is gone still
580
- * resolves. An id that is not pinned resolves without writing.
581
- * @param sessionId - The session to unpin.
582
- * @returns resolution after durability.
583
- */
584
- unpinSession(sessionId: SessionId): Promise<void>
585
-
586
- /**
587
- * Resolve by canonical directory path without creating or mutating a
588
- * workspace. A missing path rejects during `realpath`; an existing unowned
589
- * directory returns `undefined`.
590
- * @param path - Existing directory path in a fully qualified spelling.
591
- * @returns the workspace owning the canonical path, when one exists.
592
- */
593
- async resolveByPath(path: string): Promise<Workspace | undefined>
594
- ```
595
-
596
- Types: [SessionId](./core.md)
597
-
598
- Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
599
-
600
- <a id="workspace-events"></a>
601
-
602
- ### `workspace/*` events
603
-
604
- <a id="workspacesession-activity--waterfall"></a>
605
-
606
- #### `workspace/session-activity` — waterfall
607
-
608
- Ask the composed providers what still runs for a session before it is archived. A listener prepends its own SessionActivity entries to the result of `next()`; the registry's innermost callback returns an empty list, so a composition without providers archives freely. Any non-empty result refuses the archive without a write.
609
-
610
- ```ts cordis-catalog
611
- /**
612
- * Ask the composed providers what still runs for a session before it is
613
- * archived. A listener prepends its own {@link SessionActivity} entries to
614
- * the result of `next()`; the registry's innermost callback returns an
615
- * empty list, so a composition without providers archives freely. Any
616
- * non-empty result refuses the archive without a write.
617
- * @param request - the session about to be archived.
618
- * @param next - delegate to the remaining providers.
619
- * @mode waterfall
620
- */
621
- 'workspace/session-activity'( request: SessionActivityRequest, next: () => Promise<readonly SessionActivity[]>, ): Promise<readonly SessionActivity[]>
622
- ```
623
-
624
- Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
625
-
626
- <a id="workspacesession-stop--parallel"></a>
627
-
628
- #### `workspace/session-stop` — parallel
629
-
630
- Stop a session's running work because the caller archived it with `stopActivity`; the archive set is durable when this dispatches. Each provider stops its own families — cancelling a turn, its subagent descendants, owned jobs, or active schedules — through the same cancel paths the user's own stop actions use, so the session log ends every open turn regularly and a later unarchive can continue the conversation. Listeners issue their stop requests without waiting for running work to settle; a listener may await its own durability barrier. A rejection is logged by the registry and does not undo the archive.
631
-
632
- ```ts cordis-catalog
633
- /**
634
- * Stop a session's running work because the caller archived it with
635
- * `stopActivity`; the archive set is durable when this dispatches. Each
636
- * provider stops its own families — cancelling a turn, its subagent
637
- * descendants, owned jobs, or active schedules — through the same cancel
638
- * paths the user's own stop actions use, so the session log ends every
639
- * open turn regularly and a later unarchive can continue the
640
- * conversation. Listeners issue their stop requests without waiting for
641
- * running work to settle; a listener may await its own durability
642
- * barrier. A rejection is logged by the registry and does not undo the
643
- * archive.
644
- * @param request - the session being archived.
645
- * @mode parallel
646
- */
647
- 'workspace/session-stop'(request: SessionActivityRequest): Promise<void> | void
648
- ```
649
-
650
- Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
651
- <!-- END GENERATED cordis-surface -->
1
+ ---
2
+ editSource: "docs/subsystems/workspace.md"
3
+ rawMarkdownPath: "en/reference/subsystems/workspace.md"
4
+ outline: [2,3]
5
+ ---
6
+
7
+ # Workspaces
8
+
9
+ A workspace is the persistent record of a directory the user works in: a stable id over a canonical path, a display title, and the ordered account of sessions that belong to it. The subsystem is one package ([dsh-workspace](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/workspace/workspace), `ctx.workspaceRegistry`) — an optional host-side capability, not part of the agent-loop spine, and invisible to models (no tools, no prompt text, no session events). It stores its records through the [storage domain form](./storage.md) and validates session membership against [`SessionHeader.cwd`](./persistence.md#sessionheader--metadata-beside-the-log), so `storageDomain` and `sessionPersistence` are mandatory startup dependencies: an unavailable persistence peer leaves the plugin pending rather than being mistaken for an empty history. Design record: [domain KV storage Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/proposed/architecture/2026-07-24-domain-kv-storage-and-workspace.md); bootstrap and GUI ordering: [Workspace UI product-flow Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/archived/feature/2026-07-25-workspace-ui-product-flow.md).
10
+
11
+ Source: [`packages/workspace/workspace/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/types.ts)
12
+
13
+ ## Identity
14
+
15
+ ```ts type-equiv
16
+ /**
17
+ * Identifies one workspace record. A generated uuid, never the path: path
18
+ * normalization rewrites paths, and a reference anchor must stay stable.
19
+ */
20
+ type WorkspaceId = Branded<'WorkspaceId'>
21
+ ```
22
+
23
+ `WorkspaceId` is a [branded id](./core.md#branded-ids). Path identity is separate: `realpathNormalize` (`fs.realpath`; trailing slashes, `..`, and symlinks resolved) is the one uniqueness canon — workspace paths are stored canonicalized, uniqueness is string equality of canonical paths (a symlink to an owned directory collides), and attach-time session cwd checks go through the same canon.
24
+
25
+ ## The workspace entity
26
+
27
+ Consumers see only the `Workspace` interface; the implementation stays package-private.
28
+
29
+ ```ts type-equiv
30
+ /**
31
+ * One workspace: a stable id over an existing directory, a display title, and
32
+ * an ordered candidate account of sessions. Membership validates header cwd
33
+ * against the workspace path, but preserves an existing account when its
34
+ * fully qualified cwd is missing. Consumers only see this interface; the
35
+ * implementation stays private.
36
+ */
37
+ interface Workspace {
38
+ /** Stable record id (generated uuid). */
39
+ readonly id: WorkspaceId
40
+
41
+ /**
42
+ * Canonical directory path: the `fs.realpath` of the path given at create
43
+ * time (trailing slashes, `..`, and symlinks all resolved). Never rewritten
44
+ * afterwards, even when the directory disappears (see {@link status}).
45
+ */
46
+ readonly path: string
47
+
48
+ /** Display title. Defaults to the final path segment, or a filesystem root's own spelling; duplicates are allowed. */
49
+ readonly title: string
50
+
51
+ /** ISO-8601 creation instant, stamped at create and never rewritten. */
52
+ readonly createdAt: string
53
+
54
+ /** ISO-8601 instant of the last durable mutation (create counts as one). */
55
+ readonly updatedAt: string
56
+
57
+ /**
58
+ * Header-validated sessions in manually owned order: a new session is
59
+ * prepended at attach, explicit reordering goes through
60
+ * `insertSessionBefore`, and activity never reorders. The durable candidate
61
+ * account is filtered synchronously: missing headers, invalid cwd values,
62
+ * and canonical cwd mismatches are never returned. A fully qualified cwd
63
+ * whose realpath or directory stat fails with ENOENT preserves an existing
64
+ * candidate, including a dangling symlink; other filesystem failures do not.
65
+ * A subsequent mutation prunes filtered candidates, not missing-directory
66
+ * candidates. This does not admit new sessions or recreate directories.
67
+ */
68
+ readonly sessionIds: readonly SessionId[]
69
+
70
+ /**
71
+ * Replace the display title durably.
72
+ * @param title - New title; any string, duplicates across workspaces allowed.
73
+ * @returns resolution after durability.
74
+ */
75
+ setTitle(title: string): Promise<void>
76
+
77
+ /**
78
+ * Prepend a session to this workspace's candidate account. An already
79
+ * accounted id resolves without writing, aside from the durable
80
+ * filtered-candidate prune every accepted mutation performs. A new id's
81
+ * live or persisted
82
+ * header cwd must resolve to an existing directory equal to {@link path};
83
+ * unknown ids, missing or invalid cwd values, and mismatches reject without
84
+ * writing.
85
+ * @param sessionId - The session to record.
86
+ * @returns resolution after durability.
87
+ */
88
+ attachSession(sessionId: SessionId): Promise<void>
89
+
90
+ /**
91
+ * Move an accounted session within the manual order, DOM-insertBefore-like:
92
+ * with an anchor the session lands before it, without one it appends to the
93
+ * end. Only the moved id changes position. A session or anchor absent from
94
+ * the account rejects without writing; a move to the current position
95
+ * resolves without writing, aside from the durable filtered-candidate
96
+ * prune every accepted mutation performs; decided on the domain write
97
+ * chain.
98
+ * @param sessionId - The accounted session to move.
99
+ * @param beforeSessionId - Accounted anchor to insert before; omitted appends.
100
+ * @returns resolution after durability.
101
+ */
102
+ insertSessionBefore(sessionId: SessionId, beforeSessionId?: SessionId): Promise<void>
103
+
104
+ /**
105
+ * Remove a session from this workspace's account. Idempotent: an id not on
106
+ * the account resolves without writing, aside from the durable
107
+ * filtered-candidate prune every accepted mutation performs; decided on
108
+ * the domain write chain like attach. Never touches the session's own stored log.
109
+ * @param sessionId - The session to remove.
110
+ * @returns resolution after durability.
111
+ */
112
+ detachSession(sessionId: SessionId): Promise<void>
113
+
114
+ /**
115
+ * Live directory check, uncached: whether {@link path} currently exists and
116
+ * is a directory. A missing directory never mutates the record — the
117
+ * directory may only be temporarily moved.
118
+ * @returns `'ok'` when the directory exists, `'missing-dir'` otherwise.
119
+ */
120
+ status(): Promise<'ok' | 'missing-dir'>
121
+ }
122
+ ```
123
+
124
+ Ownership truth is the record's ordered `sessionIds`, never derived from session cwd. Membership validates the recorded header cwd against the workspace path; an existing candidate remains owned when its fully qualified cwd fails resolution or directory stat with `ENOENT`. This preserves missing-directory and dangling-symlink accounts without admitting new sessions. Failed writes reject (`insertSessionBefore` account errors as `WorkspaceMoveInvalidError`, storage failures as plain errors); every accepted mutation stamps `updatedAt` and durably prunes candidates that no longer pass the membership check.
125
+
126
+ ## The registry: `ctx.workspaceRegistry`
127
+
128
+ `WorkspaceRegistry` ([signatures](#ctxworkspaceregistry--workspaceregistry)) owns registration and resolution. `create(path, title?)` requires a fully qualified path, canonicalizes it, rejects a nonexistent path (the original `ENOENT`) or a non-directory, returns the existing entity unchanged when the canonical path is already owned, and otherwise creates a record with `title ?? defaultWorkspaceTitle(path)` prepended to the durable registry order (different canonical paths may share a display title, and a path with no final segment uses its root spelling). `get(id)` and the ordered `list()` are synchronous cache reads; `resolveByPath(path)` applies the same fully qualified realpath canon without creating. `delete(id)` removes only the registration, order entry, and session account — the directory, user files, live sessions, and persisted logs are never touched, so those sessions become Ungrouped ([reference](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/README.md)); unknown ids return `false`. Create and delete persist a pending-mutation marker before their two writes (record + order) can diverge; startup resolves exactly the marked mutation — by deleting the marked table row, which completes an interrupted delete and rolls back an interrupted create (the registration is re-creatable, so rollback is the safe direction) — and an unmarked order/table mismatch fails loud as corruption.
129
+
130
+ Sessions get their cwd at create time from whoever creates them, not from this registry — the API gateway resolves a new session's cwd from the chosen workspace's `path` (falling back to an explicit or default cwd), creates the session so the cwd lands in its immutable [`SessionHeader`](./persistence.md#sessionheader--metadata-beside-the-log), then calls `attachSession`, which re-validates that stored header cwd against the workspace path. On the first successful start, the registry bootstraps history from persisted headers alone (`id`, `cwd`, `createdAt` — never event bodies), grouping sessions with a valid canonical cwd into per-directory workspaces, newest first; the initialized marker is written last so an interrupted bootstrap resumes safely. The bootstrap is one-time: cwd-less legacy sessions stay Ungrouped, and sessions created afterwards join a workspace only through `attachSession`.
131
+
132
+ ## Default Workspace initialization
133
+
134
+ The controller's `initializeDefault` takes no request: it owns the fixed `default-workspace` directory name, resolves the Documents location, and asks the registry to initialize once. The registry accepts a directory resolver, derives the initial title from the requested directory's final segment rather than the canonical one, and commits the registration with its durable identity. No language reaches the Host — browser consumers label a Workspace still carrying that automatic title through the controller's `workspaceDisplayTitle`, so only the on-screen name follows the reader's language. [First-use behavior and configuration](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/README.md#first-use-workspace) describe reuse and failure handling.
135
+
136
+ ## Session pinning
137
+
138
+ The controller's [transport types](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/types.ts) define `WorkspacePinSessionRequest` and `WorkspaceUnpinSessionRequest`, each carrying one `sessionId`. Both operations return `WorkspacePinValue`: the complete `pinnedSessionIds` array of Session ids, most recently pinned first. Pinning requires a known, unarchived Session; unpinning an id that is not pinned succeeds without changing the set. Archiving removes the Session's pin in the same durable write, and unarchiving does not restore it.
139
+
140
+ ## Archive admission
141
+
142
+ Archiving is a registry-global durable set, and the registry refuses to hide running work behind it. The rule is a capability seam over two Host events the package declares and dispatches ([events](#workspace-events)): `workspace/session-activity` (waterfall) asks the composed providers what still runs for a Session, and `workspace/session-stop` (parallel) asks them to stop it. Each provider registers on the root like any listener, so the package knows no agent, job, or schedule vocabulary; the families are keys of a merge-extensible map.
143
+
144
+ ```ts type-equiv
145
+ /**
146
+ * Activity families a `workspace/session-activity` listener may report. This
147
+ * package declares none: each provider merges its own key from a module both
148
+ * its Host and Client faces import, so a consumer that renders the families
149
+ * sees exactly the keys its program compiled and falls through to a generic
150
+ * description for any other. The shipped providers merge `turn` (the Agent
151
+ * registry), `job` (the job registry seam), `subagent` (the Subagent
152
+ * runtime), and `schedule` (the Schedule plugin).
153
+ */
154
+ interface SessionActivityKindMap {}
155
+ ```
156
+
157
+ `SessionActivityKind` is `keyof SessionActivityKindMap`, so a program that compiled no provider sees no key at all. The shipped keys live in client-importable type modules: `turn` in the Agent registry's `types.ts`, `job` in the job registry seam's `view.ts`, `subagent` in the Subagent runtime's `control-types.ts`, `schedule` in the Schedule plugin's `types.ts`; a consumer that renders the families imports those modules for its cases and keeps a generic line for any other key. A provider answers the waterfall by prepending its `SessionActivity` entries to the result of `next()`; the registry's innermost callback returns an empty list, so a composition without providers archives freely.
158
+
159
+ ```ts type-equiv
160
+ /**
161
+ * One reason a session counts as active for archive admission. Families with
162
+ * per-item identity list their items so a caller can name what must stop.
163
+ */
164
+ interface SessionActivity {
165
+ readonly kind: SessionActivityKind
166
+ /** Active items of the family; absent for a family without per-item identity (`turn`). */
167
+ readonly items?: readonly SessionActivityItem[]
168
+ }
169
+ ```
170
+
171
+ `SessionActivityItem` carries the family-specific `id` (a session, job, or schedule id) and an optional display `label`. `archiveSession(sessionId)` asks the waterfall once, after the existence check, and rejects a non-empty answer with `WorkspaceActiveSessionError` (`sessionId`, `activity`) without writing; the controller maps it to the `workspace/session-active` error, whose details carry the same two fields. `archiveSession(sessionId, { stopActivity: true })` — the `ArchiveSessionOptions` field the transport request exposes as `stopActivity` — skips the check, writes the archive, then dispatches `workspace/session-stop`; a rejecting provider is logged and the archive stays, and the stopped work is never awaited to settlement. An already archived id neither asks nor stops. The shipped providers, what they stop, and the `agent/pre-step` gate that keeps an archived Session from running a model step are documented with the [registry package](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/README.md#api-behavior); the decision record is the [archive-stops-running-work Agent Note](https://github.com/deepseek-ai/deepseek-harness/blob/master/.agents/notes/implemented/feature/2026-09-21-archive-stops-running-session-work.md).
172
+
173
+ ## Consumers
174
+
175
+ [`dsh-workspace-controller`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/api/workspace-controller) serves workspace CRUD to GUI clients over `ctx.workspaceRegistry`, and [`dsh-session-controller`](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/api/session-controller) performs the create-session-then-attach flow above. [dsh-agent-instructions](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/context/agent-instructions) is **not** a consumer despite the name: it discovers AGENTS.md-style instruction files under an agent's own cwd and never touches `ctx.workspaceRegistry` — the shared word refers to the user's working directory, not to this registry's entities.
176
+
177
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
178
+
179
+ <a id="cordis-surface"></a>
180
+
181
+ ## Cordis API
182
+
183
+ 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).
184
+
185
+ <a id="ctxdirectorypicker--directorypicker-abstract-seam"></a>
186
+
187
+ ### `ctx.directoryPicker` — `DirectoryPicker` (abstract seam)
188
+
189
+ Abstract directory-picking service. Subclass, implement `capability()`, and load the subclass as a plugin — it registers as `ctx.directoryPicker` (one implementation per context; loading a second throws, cordis' standard duplicate-service behavior). The capability object must be stable for the service lifetime: consumers may capture it across calls.
190
+
191
+ ```ts cordis-catalog
192
+ /**
193
+ * The backend's interaction capability.
194
+ * @returns the discriminated capability consumers switch on.
195
+ */
196
+ abstract capability(): DirectoryPickerCapability
197
+ ```
198
+
199
+ Source: [`packages/host/directory-picker/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/host/directory-picker/src/index.ts)
200
+
201
+ <a id="ctxdirectorypickercontroller--directorypickercontroller"></a>
202
+
203
+ ### `ctx.directoryPickerController` — `DirectoryPickerController`
204
+
205
+ Host service backing the generated `ctx.remote.directoryPicker` namespace. The seam it exports is abstract and therefore never a Loader entry of its own, so this controller carries the wire verbs: one composed backend serves either the native chooser or the browse primitives, and a verb the composition cannot serve is refused rather than approximated.
206
+
207
+ ```ts cordis-catalog
208
+ /**
209
+ * Open the host's OS chooser for a Remote caller.
210
+ * @param signal - caller lifetime; abort terminates the chooser.
211
+ * @returns the chosen absolute path, or null when the operator cancels.
212
+ */
213
+ @Remote('pick') async pick(signal: AbortSignal): Promise<string | null>
214
+
215
+ /**
216
+ * List one directory level for a Remote caller's in-app browser.
217
+ * @param path - absolute directory to list; absent lists the home directory.
218
+ * @param signal - caller lifetime; abort stops the backend's scan instead of
219
+ * letting it outlive a disconnected caller.
220
+ * @returns the level's listing with its ancestry.
221
+ */
222
+ @Remote('list') async list(path: string | undefined, signal: AbortSignal): Promise<DirectoryListing>
223
+
224
+ /**
225
+ * Create one child directory for a Remote caller's in-app browser.
226
+ * @param path - absolute existing parent directory.
227
+ * @param name - single non-blank path segment.
228
+ * @returns the created directory's absolute path.
229
+ */
230
+ @Remote('createDirectory') async createDirectory(path: string, name: string): Promise<string>
231
+ ```
232
+
233
+ Source: [`packages/api/workspace-controller/src/directory-picker.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/directory-picker.ts)
234
+
235
+ <a id="ctxterminalcontroller--terminalcontroller"></a>
236
+
237
+ ### `ctx.terminalController` — `TerminalController`
238
+
239
+ Typed Remote control of transient Session-owned terminal processes.
240
+
241
+ ```ts cordis-catalog
242
+ /**
243
+ * Read the Session's current directory and terminal limits without filesystem validation or shell lookup.
244
+ * @param agent - Session owner supplied by the Gateway.
245
+ * @param signal - request cancellation.
246
+ * @returns the logged current directory and terminal limits; retained terminals keep their own process directories.
247
+ */
248
+ @Remote environment(agent: Agent, signal: AbortSignal): TerminalEnvironment
249
+
250
+ /**
251
+ * Discover installed shells in the Session's execution environment.
252
+ * @param agent - Session owner supplied by the Gateway.
253
+ * @param signal - request cancellation.
254
+ * @returns verified profiles, with the configured or system default first.
255
+ */
256
+ @Remote shells(agent: Agent, signal: AbortSignal): Promise<TerminalShell[]>
257
+
258
+ /**
259
+ * List retained terminals without resolving or activating an Agent.
260
+ * @param sessionId - displayed Session identity, including offline history.
261
+ * @returns terminals retained for this Host lifetime.
262
+ */
263
+ @Remote list(sessionId: SessionId): WebTerminalInfo[]
264
+
265
+ /**
266
+ * Allocate a user shell once for a caller-generated identity, without Agent sandbox or approval restrictions.
267
+ * @param agent - Session owner supplied by the Gateway.
268
+ * @param request - initial dimensions and idempotency identity.
269
+ * @param signal - allocation cancellation; committed terminals survive disconnection.
270
+ * @returns the existing or newly committed terminal.
271
+ */
272
+ @Remote async create(agent: Agent, request: TerminalCreateRequest, signal: AbortSignal): Promise<WebTerminalInfo>
273
+
274
+ /**
275
+ * Open a terminal for the Session's Agent under a caller-resolved sandbox policy; it appears in every
276
+ * window that watches the Session and passes to the person on the person's first typed input.
277
+ * @param agent - Session owner whose Agent requests the terminal.
278
+ * @param request - title, directory, dimensions, sandbox policy and shell preference.
279
+ * @param signal - allocation cancellation; a committed terminal outlives it.
280
+ * @returns the Agent's handle for the committed terminal.
281
+ * @throws RemoteError `terminal/limit-reached` when the Session or Agent terminal limit is reached.
282
+ * @throws Error when the title is blank or longer than 120 characters.
283
+ */
284
+ async openForAgent(agent: Agent, request: AgentTerminalRequest, signal: AbortSignal): Promise<AgentTerminal>
285
+
286
+ /**
287
+ * Render a page of any terminal in the Agent's Session, including terminals the person opened.
288
+ * @param agent - Session owner.
289
+ * @param id - terminal identity.
290
+ * @param request - page position and byte bound.
291
+ * @returns rendered screen text, including output received before the call.
292
+ * @throws RemoteError `terminal/unavailable` when the terminal is missing or closes before the screen is read.
293
+ */
294
+ readScreen(agent: Agent, id: WebTerminalId, request: TerminalScreenRequest): Promise<TerminalScreenPage>
295
+
296
+ /**
297
+ * Observe whether a Session terminal's shell is running a command.
298
+ * @param agent - Session owner.
299
+ * @param id - terminal identity.
300
+ * @returns idle, busy, or unknown for unsupported shells and sandboxed launches.
301
+ */
302
+ inspectActivity(agent: Agent, id: WebTerminalId): Promise<'idle' | 'busy' | 'unknown'>
303
+
304
+ /**
305
+ * Stream the Session's retained terminals as whole sets, without resolving or activating an Agent.
306
+ * @param sessionId - watched Session identity.
307
+ * @param signal - stream cancellation.
308
+ * @returns the current set, then a new set after creation, removal or any published state change.
309
+ */
310
+ @Remote({ mode: 'stream' }) async *watch(sessionId: SessionId, signal: AbortSignal): AsyncIterable<WebTerminalInfo[]>
311
+
312
+ /**
313
+ * Retain an existing terminal for a window without activating its Agent or taking input control.
314
+ * @param sessionId - owning Session identity, including an inactive saved layout.
315
+ * @param id - retained Host terminal identity.
316
+ * @param signal - physical Remote stream cancellation.
317
+ * @returns a hold acknowledgement followed by an open lifetime stream.
318
+ */
319
+ @Remote({ mode: 'stream' }) retain(sessionId: SessionId, id: WebTerminalId, signal: AbortSignal): AsyncIterable<TerminalRetentionFrame>
320
+
321
+ /**
322
+ * Attach terminal input and output to one physical Remote stream.
323
+ * @param agent - Session owner supplied by the Gateway.
324
+ * @param id - terminal identity.
325
+ * @param signal - attachment cancellation; the process remains alive and input is never replayed.
326
+ * @returns screen recovery, output, writable state and provider-acceptance acknowledgements.
327
+ */
328
+ @Remote({ mode: 'stream' }) attach(agent: Agent, id: WebTerminalId, signal: AbortSignal): RemoteStream<TerminalFrame, TerminalInput>
329
+
330
+ /**
331
+ * Rename a terminal without changing its shell.
332
+ * @param agent - Session owner supplied by the Gateway.
333
+ * @param id - terminal identity.
334
+ * @param title - nonempty display title, at most 120 characters.
335
+ */
336
+ @Remote rename(agent: Agent, id: WebTerminalId, title: string): void
337
+
338
+ /**
339
+ * Close an identity to future creation and kill its process range; repeated closes succeed.
340
+ * @param agent - Session owner supplied by the Gateway.
341
+ * @param id - terminal identity.
342
+ * @returns after provider cleanup succeeds. A failure retains the terminal for retry.
343
+ */
344
+ @Remote async close(agent: Agent, id: WebTerminalId): Promise<void>
345
+ ```
346
+
347
+ Types: [Agent](./core.md) · [RemoteStream](./typert.md) · [SessionId](./core.md)
348
+
349
+ Source: [`packages/api/terminal-controller/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/terminal-controller/src/index.ts)
350
+
351
+ <a id="ctxworkspacecontroller--workspacecontroller"></a>
352
+
353
+ ### `ctx.workspaceController` — `WorkspaceController`
354
+
355
+ Host service backing the generated `ctx.remote.workspace` namespace.
356
+
357
+ ```ts cordis-catalog
358
+ /**
359
+ * Create or idempotently resolve one Workspace over an existing directory.
360
+ * @param request - directory path to register.
361
+ * @returns the Workspace and whether this call created it.
362
+ */
363
+ @Remote('create') create(request: WorkspaceCreateRequest): Promise<WorkspaceCreateValue>
364
+
365
+ /**
366
+ * Initialize or reuse the default Workspace during first-use startup. The
367
+ * directory name is fixed, so the Host never renames or relocates an
368
+ * existing default; its initial title is that same name, which browser
369
+ * consumers label in the reader's language.
370
+ * @param signal - caller lifetime; cancels native directory lookup.
371
+ * @returns the durable Workspace, or undefined when first-use initialization is ineligible; creates no Session or message.
372
+ */
373
+ @Remote('initializeDefault') async initializeDefault(signal: AbortSignal): Promise<WorkspaceValue | undefined>
374
+
375
+ /**
376
+ * Rename one Workspace to a unique non-blank title.
377
+ * @param request - Workspace identity and proposed title.
378
+ * @returns the updated Workspace projection.
379
+ */
380
+ @Remote('rename') rename(request: WorkspaceRenameRequest): Promise<WorkspaceValue>
381
+
382
+ /**
383
+ * Remove one Workspace registration while retaining files and Sessions.
384
+ * @param request - Workspace identity to remove.
385
+ * @returns deletion confirmation.
386
+ */
387
+ @Remote('delete') delete(request: WorkspaceDeleteRequest): Promise<WorkspaceDeleteValue>
388
+
389
+ /**
390
+ * Move one Workspace within the registry display order.
391
+ * @param request - moved Workspace and optional anchor.
392
+ * @returns the complete resulting Workspace order.
393
+ */
394
+ @Remote('insertBefore') insertBefore(request: WorkspaceInsertBeforeRequest): Promise<WorkspaceOrderValue>
395
+
396
+ /**
397
+ * Move one accounted Session within a Workspace.
398
+ * @param request - Workspace, Session, and optional anchor identities.
399
+ * @returns the updated Workspace projection.
400
+ */
401
+ @Remote('insertSessionBefore') insertSessionBefore(request: WorkspaceInsertSessionBeforeRequest): Promise<WorkspaceValue>
402
+
403
+ /**
404
+ * Hide one known Session from Workspace grouping surfaces.
405
+ * @param request - Session identity to archive.
406
+ * @returns the complete resulting archive set.
407
+ */
408
+ @Remote('archiveSession') archiveSession(request: WorkspaceArchiveSessionRequest): Promise<WorkspaceArchiveValue>
409
+
410
+ /**
411
+ * Restore one archived Session to Workspace grouping surfaces.
412
+ * @param request - Session identity to unarchive.
413
+ * @returns the complete resulting archive set.
414
+ */
415
+ @Remote('unarchiveSession') unarchiveSession(request: WorkspaceUnarchiveSessionRequest): Promise<WorkspaceArchiveValue>
416
+
417
+ /**
418
+ * Surface one known unarchived Session ahead of unpinned Sessions.
419
+ * @param request - Session identity to pin.
420
+ * @returns the complete resulting pin set, most recently pinned first.
421
+ */
422
+ @Remote('pinSession') pinSession(request: WorkspacePinSessionRequest): Promise<WorkspacePinValue>
423
+
424
+ /**
425
+ * Remove one Session's pin without changing its saved Session order.
426
+ * @param request - Session identity to unpin.
427
+ * @returns the complete resulting pin set, most recently pinned first.
428
+ */
429
+ @Remote('unpinSession') unpinSession(request: WorkspaceUnpinSessionRequest): Promise<WorkspacePinValue>
430
+
431
+ /**
432
+ * Stream a complete Workspace baseline followed by ordered increments. A
433
+ * non-owner receives only the Workspaces and Sessions `allows()` admits.
434
+ * When a delivered Workspace is no longer admitted at its next change or
435
+ * the next order change, the stream sends a `replace` frame with the
436
+ * complete filtered state instead of a `remove`, because a Client never
437
+ * resurrects a removed Workspace; a `remove` frame reports a deletion and
438
+ * reaches only a Client that received that Workspace.
439
+ * @param signal - generation cancellation.
440
+ * @returns baseline followed by ordered Workspace increments.
441
+ */
442
+ @Remote({ mode: 'stream' }) async *follow(signal: AbortSignal): AsyncIterable<WorkspaceFollowFrame>
443
+ ```
444
+
445
+ Source: [`packages/api/workspace-controller/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-controller/src/index.ts)
446
+
447
+ <a id="ctxworkspacefiles--workspacefiles"></a>
448
+
449
+ ### `ctx.workspaceFiles` — `WorkspaceFiles`
450
+
451
+ Host Remote file reads and workspace directory observations over the composed filesystem.
452
+
453
+ ```ts cordis-catalog
454
+ /**
455
+ * Read one page of lines from a UTF-8 file readable by the filesystem backend.
456
+ * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
457
+ * @param path - absolute path or path relative to the workspace root; files outside it are allowed.
458
+ * @param range - the line window; omitted fields take the page defaults.
459
+ * @param signal - caller cancellation.
460
+ * @returns the page, the file's version at the stat before it, and whether it reaches the last line.
461
+ */
462
+ @Remote async read( workspaceFileScope: WorkspaceFileScope, path: string, range: WorkspaceFileRange, signal: AbortSignal, ): Promise<WorkspaceFileText>
463
+
464
+ /**
465
+ * Read a complete regular file or one byte range without text decoding.
466
+ * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
467
+ * @param path - target path, absolute or workspace-relative; relative to the base file's directory when provided.
468
+ * @param options - optional base file and range; without a range the complete-file cap applies.
469
+ * @param signal - caller cancellation.
470
+ * @returns native bytes with the file's version and size at the preceding stat, byte offset, and EOF marker.
471
+ */
472
+ @Remote async readBytes( workspaceFileScope: WorkspaceFileScope, path: string, options: WorkspaceByteReadOptions, signal: AbortSignal, ): Promise<WorkspaceFileBytes>
473
+
474
+ /**
475
+ * Report one regular file's identity, version, and size without its content.
476
+ * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
477
+ * @param path - absolute path or path relative to the workspace root; files outside it are allowed.
478
+ * @param signal - caller cancellation.
479
+ * @returns the file's absolute path, current version, and byte size.
480
+ */
481
+ @Remote async stat(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceFileStat>
482
+
483
+ /**
484
+ * List the direct children of one directory inside the Session's workspace.
485
+ * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
486
+ * @param path - workspace path, absolute or relative to the workspace root.
487
+ * @param signal - caller cancellation.
488
+ * @returns the directory's children in the backend's stable name order, bounded by the entry cap.
489
+ */
490
+ @Remote async list(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): Promise<WorkspaceDirectoryListing>
491
+
492
+ /**
493
+ * Search files and their inferred ancestor directories with packaged ripgrep.
494
+ * Native ignore rules apply unless disabled; VCS metadata, symlinks and empty
495
+ * directories are absent. Within the bounded set of listed files, matches
496
+ * sort by depth, then workspace-relative path.
497
+ * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
498
+ * @param request - the query, literal exclusions, and hidden/ignore switches.
499
+ * @param signal - caller cancellation, forwarded to the subprocess; rejection preserves its reason.
500
+ * @returns matches capped by search.maxResults; incomplete marks excess rg files or exit 2.
501
+ * @throws RemoteError `gateway/bad-request`: the query is blank.
502
+ * @throws RemoteError `workspace-file/not-found`: the workspace root does not exist.
503
+ * @throws RemoteError `workspace-file/not-directory`: the workspace root is not a directory.
504
+ * @throws RemoteError `workspace-file/search-failed`: subprocess is missing, rg cannot launch or execute, or the search times out.
505
+ */
506
+ @Remote async search( workspaceFileScope: WorkspaceFileScope, request: WorkspaceFileSearchRequest, signal: AbortSignal, ): Promise<WorkspaceFileSearchResult>
507
+
508
+ /**
509
+ * Watch one file or a directory's direct entries in the Session's filesystem.
510
+ * Files use the backend's read authority; directories remain workspace-scoped.
511
+ * @param workspaceFileScope - header-derived workspace root for the Session identity on the wire.
512
+ * @param path - target path; the Host determines its type and confines directories to the workspace.
513
+ * @param signal - generation cancellation.
514
+ * @returns `ready` once the target watch is active, then current metadata for queued and live invalidations.
515
+ * @throws RemoteError when watching is unavailable or a directory is outside the workspace.
516
+ */
517
+ @Remote({ mode: 'stream' }) changes(workspaceFileScope: WorkspaceFileScope, path: string, signal: AbortSignal): AsyncIterable<WorkspaceFileWatchFrame>
518
+ ```
519
+
520
+ Source: [`packages/api/workspace-files/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/api/workspace-files/src/index.ts)
521
+
522
+ <a id="ctxworkspaceregistry--workspaceregistry"></a>
523
+
524
+ ### `ctx.workspaceRegistry` — `WorkspaceRegistry`
525
+
526
+ Durable workspace registry. Startup waits for `sessionPersistence`, builds one canonical-cwd header index, and completes the one-time history bootstrap before the service becomes active. The persistence dependency is mandatory so an unavailable peer can never be mistaken for an empty history and commit the initialized marker.
527
+
528
+ ```ts cordis-catalog
529
+ /**
530
+ * Create or reuse a workspace for an existing directory. The fully qualified
531
+ * path is canonicalized through `fs.realpath`; a relative, nonexistent, or
532
+ * non-directory path rejects. Repeated calls for the same canonical path
533
+ * return the existing entity without changing its title.
534
+ * A newly created workspace is prepended to the durable registry order.
535
+ * Different canonical paths may share a display title.
536
+ * @param path - Existing directory to own, in a fully qualified path spelling.
537
+ * @param title - Display title used only when a new record is created.
538
+ * @returns the existing or newly durable workspace.
539
+ */
540
+ async create(path: string, title?: string): Promise<Workspace>
541
+
542
+ /**
543
+ * Initialize the default Workspace only while both the registry and Session
544
+ * history are empty. Repeated requests reuse its durable identity; deleting
545
+ * that registration permanently disables automatic creation.
546
+ * @param resolveDirectory - resolve the absolute directory; called only for
547
+ * eligible creation, inside the registry mutation queue. Missing directories
548
+ * are created recursively before registration, and the initial title is the
549
+ * requested directory's own final segment — not the canonical one, so a
550
+ * symlink at that path does not retitle the Workspace after its target.
551
+ * After resolution, caller cancellation does not roll back creation or registration.
552
+ * @returns the initialized Workspace, or undefined when automatic creation is ineligible.
553
+ */
554
+ initializeDefault(resolveDirectory: () => Promise<string>): Promise<Workspace | undefined>
555
+
556
+ /**
557
+ * Look up a workspace by id.
558
+ * @param id - Workspace id.
559
+ * @returns the workspace, or `undefined` when unknown.
560
+ */
561
+ get(id: WorkspaceId): Workspace | undefined
562
+
563
+ /**
564
+ * Synchronous workspace projection in durable registry order. Every
565
+ * entity's `sessionIds` getter is already filtered by the startup/live
566
+ * canonical-cwd header index; this method performs no persistence reads.
567
+ * @returns a fresh ordered array of workspace entities.
568
+ */
569
+ list(): Workspace[]
570
+
571
+ /**
572
+ * Delete one workspace registration while retaining its directory and every
573
+ * session log. The durable order is updated before the table deletion; a
574
+ * failed table write restores the prior order and keeps the entity
575
+ * published. Unknown ids are an idempotent no-op for domain callers.
576
+ * @param id - Workspace registration to remove.
577
+ * @returns `true` when a record was deleted, `false` when it was unknown.
578
+ */
579
+ delete(id: WorkspaceId): Promise<boolean>
580
+
581
+ /**
582
+ * Move one workspace within the durable display order, DOM-insertBefore-like.
583
+ * With an anchor it lands before that workspace; without one it appends.
584
+ * @param id - Workspace to move.
585
+ * @param beforeId - Workspace anchor; omitted appends.
586
+ * @returns the complete committed workspace order.
587
+ */
588
+ insertBefore(id: WorkspaceId, beforeId?: WorkspaceId): Promise<readonly WorkspaceId[]>
589
+
590
+ /**
591
+ * Archive one session durably. The session must exist (live or in session
592
+ * persistence); its workspace accounting — or lack of one — is irrelevant.
593
+ * Without `stopActivity` the session must also be inactive: the
594
+ * `workspace/session-activity` waterfall is asked once, and any reported
595
+ * activity rejects with {@link WorkspaceActiveSessionError} before anything
596
+ * is written. With `stopActivity` the archive is written without an
597
+ * activity check, and the `workspace/session-stop` providers are then asked
598
+ * to stop the session's work: the durable archive set is what a provider's
599
+ * `agent/pre-step` gate reads, so every wake the stops induce is already
600
+ * blocked. Archiving drops the session's pin in the same durable write
601
+ * (pinning and archival are mutually exclusive). An already archived id
602
+ * resolves without writing, asking, or stopping.
603
+ * @param sessionId - The session to archive.
604
+ * @param options - Whether running work is stopped instead of refusing.
605
+ * @returns resolution after durability, any stop requests, and follow-up admission.
606
+ */
607
+ archiveSession(sessionId: SessionId, options: ArchiveSessionOptions = {}): Promise<void>
608
+
609
+ /**
610
+ * Unarchive one session durably by dropping it from the registry-global
611
+ * archive set; the accounting slot was never touched, so the session
612
+ * returns to its recorded position. Unarchiving runs no session-existence
613
+ * check because removing an id cannot introduce an unknown one, so an
614
+ * entry whose session is gone still resolves. An id that is not archived
615
+ * resolves without writing.
616
+ * @param sessionId - The session to unarchive.
617
+ * @returns resolution after durability.
618
+ */
619
+ unarchiveSession(sessionId: SessionId): Promise<void>
620
+
621
+ /**
622
+ * Pin one session durably, prepending it to the registry-global pin set.
623
+ * The session must exist (live or in session persistence) and must not be
624
+ * archived. An already pinned id resolves without writing or reordering.
625
+ * @param sessionId - The session to pin.
626
+ * @returns resolution after durability.
627
+ */
628
+ pinSession(sessionId: SessionId): Promise<void>
629
+
630
+ /**
631
+ * Unpin one session durably by dropping it from the registry-global pin
632
+ * set. Unpinning runs no session-existence check because removing an id
633
+ * cannot introduce an unknown one, so an entry whose session is gone still
634
+ * resolves. An id that is not pinned resolves without writing.
635
+ * @param sessionId - The session to unpin.
636
+ * @returns resolution after durability.
637
+ */
638
+ unpinSession(sessionId: SessionId): Promise<void>
639
+
640
+ /**
641
+ * Resolve by canonical directory path without creating or mutating a
642
+ * workspace. A missing path rejects during `realpath`; an existing unowned
643
+ * directory returns `undefined`.
644
+ * @param path - Existing directory path in a fully qualified spelling.
645
+ * @returns the workspace owning the canonical path, when one exists.
646
+ */
647
+ async resolveByPath(path: string): Promise<Workspace | undefined>
648
+ ```
649
+
650
+ Types: [SessionId](./core.md)
651
+
652
+ Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
653
+
654
+ <a id="workspace-events"></a>
655
+
656
+ ### `workspace/*` events
657
+
658
+ <a id="workspacesession-activity--waterfall"></a>
659
+
660
+ #### `workspace/session-activity` — waterfall
661
+
662
+ Ask the composed providers what still runs for a session before it is archived. A listener prepends its own SessionActivity entries to the result of `next()`; the registry's innermost callback returns an empty list, so a composition without providers archives freely. Any non-empty result refuses the archive without a write.
663
+
664
+ ```ts cordis-catalog
665
+ /**
666
+ * Ask the composed providers what still runs for a session before it is
667
+ * archived. A listener prepends its own {@link SessionActivity} entries to
668
+ * the result of `next()`; the registry's innermost callback returns an
669
+ * empty list, so a composition without providers archives freely. Any
670
+ * non-empty result refuses the archive without a write.
671
+ * @param request - the session about to be archived.
672
+ * @param next - delegate to the remaining providers.
673
+ * @mode waterfall
674
+ */
675
+ 'workspace/session-activity'( request: SessionActivityRequest, next: () => Promise<readonly SessionActivity[]>, ): Promise<readonly SessionActivity[]>
676
+ ```
677
+
678
+ Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
679
+
680
+ <a id="workspacesession-archived--parallel"></a>
681
+
682
+ #### `workspace/session-archived` — parallel
683
+
684
+ Admit optional follow-up work after durable archival and any stop requests. Dispatched inside the registry's write queue: a listener registers its work and returns, and runs the work and any unbounded I/O afterwards. Listener failures are logged without undoing archival. Listeners own and drain their background work.
685
+
686
+ ```ts cordis-catalog
687
+ /**
688
+ * Admit optional follow-up work after durable archival and any stop requests.
689
+ * Dispatched inside the registry's write queue: a listener registers its work
690
+ * and returns, and runs the work and any unbounded I/O afterwards. Listener
691
+ * failures are logged without undoing archival. Listeners own and drain their background work.
692
+ * @param request - newly archived Session; repeated archive requests do not dispatch.
693
+ * @mode parallel
694
+ */
695
+ 'workspace/session-archived'(request: SessionActivityRequest): Promise<void> | void
696
+ ```
697
+
698
+ Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
699
+
700
+ <a id="workspacesession-stop--parallel"></a>
701
+
702
+ #### `workspace/session-stop` — parallel
703
+
704
+ Stop a session's running work because the caller archived it with `stopActivity`; the archive set is durable when this dispatches. Each provider stops its own families — cancelling a turn, its subagent descendants, owned jobs, or active schedules — through the same cancel paths the user's own stop actions use, so the session log ends every open turn regularly and a later unarchive can continue the conversation. Listeners issue their stop requests without waiting for running work to settle; a listener may await its own durability barrier. A rejection is logged by the registry and does not undo the archive.
705
+
706
+ ```ts cordis-catalog
707
+ /**
708
+ * Stop a session's running work because the caller archived it with
709
+ * `stopActivity`; the archive set is durable when this dispatches. Each
710
+ * provider stops its own families — cancelling a turn, its subagent
711
+ * descendants, owned jobs, or active schedules — through the same cancel
712
+ * paths the user's own stop actions use, so the session log ends every
713
+ * open turn regularly and a later unarchive can continue the
714
+ * conversation. Listeners issue their stop requests without waiting for
715
+ * running work to settle; a listener may await its own durability
716
+ * barrier. A rejection is logged by the registry and does not undo the
717
+ * archive.
718
+ * @param request - the session being archived.
719
+ * @mode parallel
720
+ */
721
+ 'workspace/session-stop'(request: SessionActivityRequest): Promise<void> | void
722
+ ```
723
+
724
+ Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
725
+
726
+ <a id="workspacesession-unarchiving--parallel"></a>
727
+
728
+ #### `workspace/session-unarchiving` — parallel
729
+
730
+ Cancel or settle archive follow-up work before making a Session available again. A rejection retains the archived state.
731
+
732
+ ```ts cordis-catalog
733
+ /**
734
+ * Cancel or settle archive follow-up work before making a Session available again.
735
+ * A rejection retains the archived state.
736
+ * @param request - Session about to leave the archive set.
737
+ * @mode parallel
738
+ */
739
+ 'workspace/session-unarchiving'(request: SessionActivityRequest): Promise<void> | void
740
+ ```
741
+
742
+ Source: [`packages/workspace/workspace/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/workspace/workspace/src/index.ts)
743
+ <!-- END GENERATED cordis-surface -->