dsh-plugin-dev-kb 1.6.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 (622) hide show
  1. package/CHANGELOG.md +186 -141
  2. package/README.en.md +172 -155
  3. package/README.md +183 -163
  4. package/kb/INDEX.md +236 -234
  5. package/kb/README.md +88 -83
  6. package/kb/extra/AGENTS.md +77 -77
  7. package/kb/extra/cli-help.md +15 -7
  8. package/kb/extra/cli-help.zh.md +15 -7
  9. package/kb/extra/cookbook/adding-a-plugin-preview.md +18 -25
  10. package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +18 -25
  11. package/kb/extra/cookbook/reviewing-persistence-type-changes.md +1 -1
  12. package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +1 -1
  13. package/kb/extra/cookbook/reviewing-ui-design.md +166 -0
  14. package/kb/extra/cookbook/reviewing-ui-design.zh.md +166 -0
  15. package/kb/extra/deepseek-llm-api-wire-extensions.md +162 -162
  16. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +162 -162
  17. package/kb/extra/defensive-patterns/conversation-and-session.md +2 -2
  18. package/kb/extra/defensive-patterns/conversation-and-session.zh.md +2 -2
  19. package/kb/extra/defensive-patterns/general.md +2 -0
  20. package/kb/extra/defensive-patterns/general.zh.md +2 -0
  21. package/kb/extra/defensive-patterns/package-surface.md +233 -231
  22. package/kb/extra/defensive-patterns/package-surface.zh.md +233 -231
  23. package/kb/extra/defensive-patterns/remote-and-api.md +117 -115
  24. package/kb/extra/defensive-patterns/remote-and-api.zh.md +117 -115
  25. package/kb/extra/development.md +221 -214
  26. package/kb/extra/development.zh.md +228 -221
  27. package/kb/extra/event-producer-consumer.md +133 -110
  28. package/kb/extra/event-producer-consumer.zh.md +135 -112
  29. package/kb/extra/i18n/README.md +2 -0
  30. package/kb/extra/i18n/README.zh.md +2 -0
  31. package/kb/extra/module-graph.md +1961 -1776
  32. package/kb/extra/module-graph.zh.md +1963 -1778
  33. package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.md +60 -0
  34. package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.zh.md +60 -0
  35. package/kb/extra/persistence-changes/2026-10-19-session-team-mode.md +48 -0
  36. package/kb/extra/persistence-changes/2026-10-19-session-team-mode.zh.md +48 -0
  37. package/kb/extra/persistence-changes/2026-10-22-action-card-status.md +60 -0
  38. package/kb/extra/persistence-changes/2026-10-22-action-card-status.zh.md +60 -0
  39. package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.md +60 -0
  40. package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.zh.md +60 -0
  41. package/kb/extra/persistence-changes/2026-10-27-retry-control-input.md +60 -0
  42. package/kb/extra/persistence-changes/2026-10-27-retry-control-input.zh.md +60 -0
  43. package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.md +60 -0
  44. package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.zh.md +60 -0
  45. package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.md +48 -0
  46. package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.zh.md +48 -0
  47. package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.md +48 -0
  48. package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.zh.md +48 -0
  49. package/kb/extra/persistence-changes/2026-11-05-timeline-priority-notice.md +60 -0
  50. package/kb/extra/persistence-changes/2026-11-05-timeline-priority-notice.zh.md +60 -0
  51. package/kb/extra/persistence-changes/README.md +92 -90
  52. package/kb/extra/persistence-changes/README.zh.md +92 -90
  53. package/kb/extra/persistence-changes/historical-formats/README.md +75 -75
  54. package/kb/extra/persistence-changes/historical-formats/README.zh.md +75 -75
  55. package/kb/extra/persistence-changes/releases/README.md +103 -103
  56. package/kb/extra/persistence-changes/releases/README.zh.md +103 -103
  57. package/kb/extra/rescope.md +55 -53
  58. package/kb/extra/rescope.zh.md +55 -53
  59. package/kb/extra/subsystems/agent-team.md +38 -75
  60. package/kb/extra/subsystems/agent-team.zh.md +38 -75
  61. package/kb/extra/subsystems/attachment.md +36 -13
  62. package/kb/extra/subsystems/attachment.zh.md +36 -13
  63. package/kb/extra/subsystems/boot.md +631 -447
  64. package/kb/extra/subsystems/boot.zh.md +631 -447
  65. package/kb/extra/subsystems/computer-use.md +179 -59
  66. package/kb/extra/subsystems/computer-use.zh.md +179 -59
  67. package/kb/extra/subsystems/deliverables.md +2 -0
  68. package/kb/extra/subsystems/deliverables.zh.md +2 -0
  69. package/kb/extra/subsystems/extensions.md +387 -384
  70. package/kb/extra/subsystems/extensions.zh.md +387 -384
  71. package/kb/extra/subsystems/feedback.md +418 -400
  72. package/kb/extra/subsystems/feedback.zh.md +418 -400
  73. package/kb/extra/subsystems/forge.md +2169 -0
  74. package/kb/extra/subsystems/forge.zh.md +2171 -0
  75. package/kb/extra/subsystems/liveshare.md +167 -0
  76. package/kb/extra/subsystems/liveshare.zh.md +167 -0
  77. package/kb/extra/subsystems/mcp.md +237 -139
  78. package/kb/extra/subsystems/mcp.zh.md +237 -139
  79. package/kb/extra/subsystems/office-kit.md +122 -0
  80. package/kb/extra/subsystems/office-kit.zh.md +122 -0
  81. package/kb/extra/subsystems/working-directory.md +95 -64
  82. package/kb/extra/subsystems/working-directory.zh.md +95 -64
  83. package/kb/extra/subsystems/worktrees.md +187 -76
  84. package/kb/extra/subsystems/worktrees.zh.md +187 -76
  85. package/kb/extra/testing.md +1 -1
  86. package/kb/extra/testing.zh.md +1 -1
  87. package/kb/extra/ui-design-review-cases.md +445 -0
  88. package/kb/extra/ui-design-review-cases.zh.md +445 -0
  89. package/kb/extra/ui-radius.md +3 -1
  90. package/kb/extra/ui-radius.zh.md +3 -1
  91. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.md +21 -21
  92. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.zh.md +21 -21
  93. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +1 -1
  94. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +1 -1
  95. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.md +24 -0
  96. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.zh.md +24 -0
  97. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.md +25 -0
  98. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.zh.md +25 -0
  99. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.md +30 -0
  100. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.zh.md +30 -0
  101. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.md +28 -0
  102. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.zh.md +28 -0
  103. package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.md +24 -0
  104. package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.zh.md +24 -0
  105. package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.md +23 -0
  106. package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.zh.md +23 -0
  107. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.md +20 -0
  108. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.zh.md +20 -0
  109. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.md +31 -0
  110. package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.zh.md +31 -0
  111. package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.md +34 -0
  112. package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.zh.md +34 -0
  113. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.md +20 -0
  114. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.zh.md +20 -0
  115. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.md +18 -0
  116. package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.zh.md +18 -0
  117. package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.md +18 -0
  118. package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.zh.md +18 -0
  119. package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.md +25 -0
  120. package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.zh.md +25 -0
  121. package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.md +23 -0
  122. package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.zh.md +23 -0
  123. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.md +22 -0
  124. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.zh.md +22 -0
  125. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.md +18 -0
  126. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.zh.md +18 -0
  127. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.md +17 -0
  128. package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.zh.md +17 -0
  129. package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.md +19 -0
  130. package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.zh.md +19 -0
  131. package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.md +27 -0
  132. package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.zh.md +27 -0
  133. package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.md +18 -0
  134. package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.zh.md +18 -0
  135. package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.md +22 -0
  136. package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.zh.md +22 -0
  137. package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.md +17 -0
  138. package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.zh.md +17 -0
  139. package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.md +18 -0
  140. package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.zh.md +18 -0
  141. package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.md +18 -0
  142. package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.zh.md +18 -0
  143. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.md +18 -0
  144. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.zh.md +18 -0
  145. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.md +53 -0
  146. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.zh.md +53 -0
  147. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.md +30 -0
  148. package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.zh.md +30 -0
  149. package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.md +20 -0
  150. package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.zh.md +20 -0
  151. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.md +18 -0
  152. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.zh.md +18 -0
  153. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.md +18 -0
  154. package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.zh.md +18 -0
  155. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.md +24 -0
  156. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.zh.md +24 -0
  157. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.md +25 -0
  158. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.zh.md +25 -0
  159. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.md +22 -0
  160. package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.zh.md +22 -0
  161. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.md +18 -0
  162. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.zh.md +18 -0
  163. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.md +19 -0
  164. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.zh.md +19 -0
  165. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.md +26 -0
  166. package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.zh.md +26 -0
  167. package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.md +35 -0
  168. package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.zh.md +35 -0
  169. package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.md +21 -0
  170. package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.zh.md +21 -0
  171. package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.md +17 -0
  172. package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.zh.md +17 -0
  173. package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.md +23 -0
  174. package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.zh.md +23 -0
  175. package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.md +21 -0
  176. package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.zh.md +21 -0
  177. package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.md +20 -0
  178. package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.zh.md +20 -0
  179. package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.md +20 -0
  180. package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.zh.md +20 -0
  181. package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.md +19 -0
  182. package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.zh.md +19 -0
  183. package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.md +23 -0
  184. package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.zh.md +23 -0
  185. package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.md +20 -0
  186. package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.zh.md +20 -0
  187. package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.md +21 -0
  188. package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.zh.md +21 -0
  189. package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.md +21 -0
  190. package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.zh.md +21 -0
  191. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.md +18 -0
  192. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.zh.md +18 -0
  193. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.md +20 -0
  194. package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.zh.md +20 -0
  195. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.md +19 -0
  196. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.zh.md +19 -0
  197. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.md +18 -0
  198. package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.zh.md +18 -0
  199. package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.md +22 -0
  200. package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.zh.md +22 -0
  201. package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.md +20 -0
  202. package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.zh.md +20 -0
  203. package/kb/extra/upgrade-guide/v0.2.1-rc.4/sandbox-unsupported-policy-error/guide.md +18 -0
  204. package/kb/extra/upgrade-guide/v0.2.1-rc.4/sandbox-unsupported-policy-error/guide.zh.md +18 -0
  205. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.md +19 -0
  206. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.zh.md +19 -0
  207. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.md +24 -0
  208. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.zh.md +24 -0
  209. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.md +21 -0
  210. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.zh.md +21 -0
  211. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.md +19 -0
  212. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.zh.md +19 -0
  213. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md +18 -0
  214. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md +18 -0
  215. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.md +21 -0
  216. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.zh.md +21 -0
  217. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.md +29 -0
  218. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.zh.md +29 -0
  219. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.md +29 -0
  220. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.zh.md +29 -0
  221. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-error-builtin-codes/guide.md +18 -0
  222. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-error-builtin-codes/guide.zh.md +18 -0
  223. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.md +29 -0
  224. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.zh.md +29 -0
  225. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.md +18 -0
  226. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.zh.md +18 -0
  227. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.md +32 -0
  228. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.zh.md +32 -0
  229. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.md +30 -0
  230. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.zh.md +30 -0
  231. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.md +19 -0
  232. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.zh.md +19 -0
  233. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.md +21 -0
  234. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.zh.md +21 -0
  235. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.md +37 -0
  236. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.zh.md +37 -0
  237. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.md +22 -0
  238. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.zh.md +22 -0
  239. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.md +24 -0
  240. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.zh.md +24 -0
  241. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.md +20 -0
  242. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.zh.md +20 -0
  243. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.md +20 -0
  244. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.zh.md +20 -0
  245. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.md +17 -0
  246. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.zh.md +17 -0
  247. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.md +19 -0
  248. package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.zh.md +19 -0
  249. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.md +18 -0
  250. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.zh.md +18 -0
  251. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-kit-package/guide.md +34 -0
  252. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-kit-package/guide.zh.md +34 -0
  253. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.md +49 -0
  254. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-operation-tools/guide.zh.md +49 -0
  255. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-skill-resources/guide.md +36 -0
  256. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/office-skill-resources/guide.zh.md +36 -0
  257. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.md +29 -0
  258. package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.zh.md +29 -0
  259. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-notification-fields/guide.md +26 -0
  260. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-notification-fields/guide.zh.md +26 -0
  261. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-remote-provider/guide.md +22 -0
  262. package/kb/extra/upgrade-guide/v0.2.2-rc.1/account-remote-provider/guide.zh.md +22 -0
  263. package/kb/extra/upgrade-guide/v0.2.2-rc.1/archive-worktrees/guide.md +21 -0
  264. package/kb/extra/upgrade-guide/v0.2.2-rc.1/archive-worktrees/guide.zh.md +21 -0
  265. package/kb/extra/upgrade-guide/v0.2.2-rc.1/attachment-error-codes/guide.md +23 -0
  266. package/kb/extra/upgrade-guide/v0.2.2-rc.1/attachment-error-codes/guide.zh.md +23 -0
  267. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-ax-read-limits/guide.md +20 -0
  268. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-ax-read-limits/guide.zh.md +20 -0
  269. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-hover-ax-only/guide.md +18 -0
  270. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-hover-ax-only/guide.zh.md +18 -0
  271. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-native-platform/guide.md +23 -0
  272. package/kb/extra/upgrade-guide/v0.2.2-rc.1/cua-native-platform/guide.zh.md +23 -0
  273. package/kb/extra/upgrade-guide/v0.2.2-rc.1/dsh-doc-skill/guide.md +35 -0
  274. package/kb/extra/upgrade-guide/v0.2.2-rc.1/dsh-doc-skill/guide.zh.md +35 -0
  275. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-change-request-overview/guide.md +26 -0
  276. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-change-request-overview/guide.zh.md +26 -0
  277. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-pinned-diff/guide.md +26 -0
  278. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-pinned-diff/guide.zh.md +26 -0
  279. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-review-reads/guide.md +19 -0
  280. package/kb/extra/upgrade-guide/v0.2.2-rc.1/forge-review-reads/guide.zh.md +19 -0
  281. package/kb/extra/upgrade-guide/v0.2.2-rc.1/package-export-cleanup/guide.md +26 -0
  282. package/kb/extra/upgrade-guide/v0.2.2-rc.1/package-export-cleanup/guide.zh.md +26 -0
  283. package/kb/extra/upgrade-guide/v0.2.2-rc.1/plugin-update-method/guide.md +22 -0
  284. package/kb/extra/upgrade-guide/v0.2.2-rc.1/plugin-update-method/guide.zh.md +22 -0
  285. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-bootstrap-protocol/guide.md +25 -0
  286. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-bootstrap-protocol/guide.zh.md +25 -0
  287. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-inspect-output/guide.md +48 -0
  288. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-inspect-output/guide.zh.md +48 -0
  289. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-scoped-repl-default/guide.md +45 -0
  290. package/kb/extra/upgrade-guide/v0.2.2-rc.1/ptc-scoped-repl-default/guide.zh.md +45 -0
  291. package/kb/extra/upgrade-guide/v0.2.2-rc.1/runtime-context-reminders/guide.md +19 -0
  292. package/kb/extra/upgrade-guide/v0.2.2-rc.1/runtime-context-reminders/guide.zh.md +19 -0
  293. package/kb/extra/upgrade-guide/v0.2.2-rc.1/session-append-overloads/guide.md +17 -0
  294. package/kb/extra/upgrade-guide/v0.2.2-rc.1/session-append-overloads/guide.zh.md +17 -0
  295. package/kb/extra/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.md +27 -0
  296. package/kb/extra/upgrade-guide/v0.2.2-rc.1/subagent-interrupt-default/guide.zh.md +27 -0
  297. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-backend-cleanup-error/guide.md +20 -0
  298. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-backend-cleanup-error/guide.zh.md +20 -0
  299. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-bundle-sidebar-backend/guide.md +19 -0
  300. package/kb/extra/upgrade-guide/v0.2.2-rc.1/terminal-bundle-sidebar-backend/guide.zh.md +19 -0
  301. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.md +18 -0
  302. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-fetch-transport-error-codes/guide.zh.md +18 -0
  303. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-search-billing/guide.md +41 -0
  304. package/kb/extra/upgrade-guide/v0.2.2-rc.1/web-search-billing/guide.zh.md +41 -0
  305. package/kb/extra/upgrade-guide/v0.2.2-rc.1/window-drag-regions/guide.md +21 -0
  306. package/kb/extra/upgrade-guide/v0.2.2-rc.1/window-drag-regions/guide.zh.md +21 -0
  307. package/kb/extra/upgrade-guide/v0.2.2-rc.2/client-module-metadata/guide.md +29 -0
  308. package/kb/extra/upgrade-guide/v0.2.2-rc.2/client-module-metadata/guide.zh.md +29 -0
  309. package/kb/extra/upgrade-guide/v0.2.2-rc.2/connection-page-peer/guide.md +25 -0
  310. package/kb/extra/upgrade-guide/v0.2.2-rc.2/connection-page-peer/guide.zh.md +25 -0
  311. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.md +31 -0
  312. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cordis-root-and-intercept-metadata/guide.zh.md +31 -0
  313. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-agents-without-preset/guide.md +24 -0
  314. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-agents-without-preset/guide.zh.md +24 -0
  315. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-macos-provider/guide.md +24 -0
  316. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-macos-provider/guide.zh.md +24 -0
  317. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-partial-observations/guide.md +19 -0
  318. package/kb/extra/upgrade-guide/v0.2.2-rc.2/cua-partial-observations/guide.zh.md +19 -0
  319. package/kb/extra/upgrade-guide/v0.2.2-rc.2/deepseek-files-timeout/guide.md +15 -0
  320. package/kb/extra/upgrade-guide/v0.2.2-rc.2/deepseek-files-timeout/guide.zh.md +15 -0
  321. package/kb/extra/upgrade-guide/v0.2.2-rc.2/experimental-tool-error-codes/guide.md +28 -0
  322. package/kb/extra/upgrade-guide/v0.2.2-rc.2/experimental-tool-error-codes/guide.zh.md +28 -0
  323. package/kb/extra/upgrade-guide/v0.2.2-rc.2/package-export-cleanup/guide.md +36 -0
  324. package/kb/extra/upgrade-guide/v0.2.2-rc.2/package-export-cleanup/guide.zh.md +36 -0
  325. package/kb/extra/upgrade-guide/v0.2.2-rc.2/python-ptc-removal/guide.md +22 -0
  326. package/kb/extra/upgrade-guide/v0.2.2-rc.2/python-ptc-removal/guide.zh.md +22 -0
  327. package/kb/extra/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.md +31 -0
  328. package/kb/extra/upgrade-guide/v0.2.2-rc.2/session-status-package/guide.zh.md +31 -0
  329. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.md +18 -0
  330. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shared-search-filter/guide.zh.md +18 -0
  331. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shell-fs-tool-error-codes/guide.md +30 -0
  332. package/kb/extra/upgrade-guide/v0.2.2-rc.2/shell-fs-tool-error-codes/guide.zh.md +30 -0
  333. package/kb/extra/web-styling.md +57 -39
  334. package/kb/extra/web-styling.zh.md +57 -39
  335. package/kb/meta/search-index.json +4508 -3806
  336. package/kb/meta/source.json +18 -14
  337. package/kb/site/develop/cordis-tutorial/04-events.md +1 -1
  338. package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  339. package/kb/site/develop/framework/events.md +1 -1
  340. package/kb/site/develop/practice/dynamic-cordis.md +1 -1
  341. package/kb/site/develop/practice/llm-adapter.md +192 -192
  342. package/kb/site/en/develop/cordis-tutorial/04-events.md +1 -1
  343. package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +5 -4
  344. package/kb/site/en/develop/framework/events.md +1 -1
  345. package/kb/site/en/develop/practice/dynamic-cordis.md +1 -1
  346. package/kb/site/en/develop/practice/llm-adapter.md +192 -192
  347. package/kb/site/en/guide/desktop-uninstall-cleanup.md +63 -0
  348. package/kb/site/en/guide/network-proxy.md +1 -1
  349. package/kb/site/en/guide/plugin-market.md +153 -151
  350. package/kb/site/en/guide/providers.md +234 -230
  351. package/kb/site/en/guide/python-sdk.md +17 -2
  352. package/kb/site/en/guide/quickstart.md +35 -34
  353. package/kb/site/en/guide/schedule.md +45 -26
  354. package/kb/site/en/reference/agent-lifecycle.md +3 -1
  355. package/kb/site/en/reference/api-gateway.md +4 -4
  356. package/kb/site/en/reference/capability-seams.md +789 -719
  357. package/kb/site/en/reference/config-catalog.md +5432 -4806
  358. package/kb/site/en/reference/cookbook/adding-a-package.md +175 -173
  359. package/kb/site/en/reference/cookbook/adding-a-tool.md +105 -104
  360. package/kb/site/en/reference/cookbook/extension-cookbook.md +178 -135
  361. package/kb/site/en/reference/cordis-api/context.md +373 -369
  362. package/kb/site/en/reference/cordis-api/events.md +9 -9
  363. package/kb/site/en/reference/cordis-api/fiber.md +457 -380
  364. package/kb/site/en/reference/cordis-api/inherited.md +44 -43
  365. package/kb/site/en/reference/cordis-api/service.md +118 -107
  366. package/kb/site/en/reference/experimental-persistence-catalog.md +36 -20
  367. package/kb/site/en/reference/index.md +174 -168
  368. package/kb/site/en/reference/persistence-catalog.md +9453 -9146
  369. package/kb/site/en/reference/subsystems/client-modules.md +19 -11
  370. package/kb/site/en/reference/subsystems/compaction.md +288 -288
  371. package/kb/site/en/reference/subsystems/conversation.md +2 -0
  372. package/kb/site/en/reference/subsystems/core.md +1172 -1117
  373. package/kb/site/en/reference/subsystems/credentials.md +526 -497
  374. package/kb/site/en/reference/subsystems/filesystem.md +708 -534
  375. package/kb/site/en/reference/subsystems/index.md +82 -80
  376. package/kb/site/en/reference/subsystems/llm-streaming.md +1290 -1200
  377. package/kb/site/en/reference/subsystems/lsp.md +230 -206
  378. package/kb/site/en/reference/subsystems/persistence.md +451 -422
  379. package/kb/site/en/reference/subsystems/plan.md +91 -91
  380. package/kb/site/en/reference/subsystems/ptc-runtime.md +295 -254
  381. package/kb/site/en/reference/subsystems/sandbox.md +250 -225
  382. package/kb/site/en/reference/subsystems/schedule.md +194 -430
  383. package/kb/site/en/reference/subsystems/session-projection.md +186 -44
  384. package/kb/site/en/reference/subsystems/session-query.md +525 -515
  385. package/kb/site/en/reference/subsystems/session-reference.md +231 -228
  386. package/kb/site/en/reference/subsystems/session.md +1478 -1343
  387. package/kb/site/en/reference/subsystems/sidebar-right.md +165 -164
  388. package/kb/site/en/reference/subsystems/skills.md +356 -356
  389. package/kb/site/en/reference/subsystems/slots.md +235 -204
  390. package/kb/site/en/reference/subsystems/storage.md +26 -9
  391. package/kb/site/en/reference/subsystems/subagent.md +119 -102
  392. package/kb/site/en/reference/subsystems/system-prompt.md +13 -11
  393. package/kb/site/en/reference/subsystems/terminal.md +188 -188
  394. package/kb/site/en/reference/subsystems/token-meter.md +45 -0
  395. package/kb/site/en/reference/subsystems/tools.md +902 -751
  396. package/kb/site/en/reference/subsystems/typert.md +21 -11
  397. package/kb/site/en/reference/subsystems/user-questions.md +330 -311
  398. package/kb/site/en/reference/subsystems/web-client.md +161 -104
  399. package/kb/site/en/reference/subsystems/web-server.md +434 -306
  400. package/kb/site/en/reference/subsystems/web.md +268 -210
  401. package/kb/site/en/reference/subsystems/workflow.md +287 -282
  402. package/kb/site/en/reference/subsystems/workspace.md +743 -651
  403. package/kb/site/en/reference/tool-catalog.md +2867 -2829
  404. package/kb/site/en/reference/tool-execution-pipeline.md +5 -4
  405. package/kb/site/guide/desktop-uninstall-cleanup.md +63 -0
  406. package/kb/site/guide/network-proxy.md +1 -1
  407. package/kb/site/guide/plugin-market.md +153 -151
  408. package/kb/site/guide/providers.md +234 -230
  409. package/kb/site/guide/python-sdk.md +17 -2
  410. package/kb/site/guide/quickstart.md +35 -34
  411. package/kb/site/guide/schedule.md +45 -26
  412. package/kb/site/reference/agent-lifecycle.md +3 -1
  413. package/kb/site/reference/api-gateway.md +4 -4
  414. package/kb/site/reference/capability-seams.md +789 -719
  415. package/kb/site/reference/config-catalog.md +5432 -4806
  416. package/kb/site/reference/cookbook/adding-a-package.md +175 -173
  417. package/kb/site/reference/cookbook/adding-a-tool.md +107 -106
  418. package/kb/site/reference/cookbook/extension-cookbook.md +182 -139
  419. package/kb/site/reference/cordis-api/context.md +373 -369
  420. package/kb/site/reference/cordis-api/events.md +9 -9
  421. package/kb/site/reference/cordis-api/fiber.md +459 -380
  422. package/kb/site/reference/cordis-api/inherited.md +44 -43
  423. package/kb/site/reference/cordis-api/service.md +118 -107
  424. package/kb/site/reference/experimental-persistence-catalog.md +36 -20
  425. package/kb/site/reference/index.md +178 -172
  426. package/kb/site/reference/persistence-catalog.md +9453 -9146
  427. package/kb/site/reference/subsystems/client-modules.md +19 -11
  428. package/kb/site/reference/subsystems/compaction.md +288 -288
  429. package/kb/site/reference/subsystems/conversation.md +4 -0
  430. package/kb/site/reference/subsystems/core.md +1184 -1129
  431. package/kb/site/reference/subsystems/credentials.md +526 -497
  432. package/kb/site/reference/subsystems/filesystem.md +708 -534
  433. package/kb/site/reference/subsystems/index.md +82 -80
  434. package/kb/site/reference/subsystems/llm-streaming.md +1296 -1206
  435. package/kb/site/reference/subsystems/lsp.md +230 -206
  436. package/kb/site/reference/subsystems/persistence.md +451 -422
  437. package/kb/site/reference/subsystems/plan.md +91 -91
  438. package/kb/site/reference/subsystems/ptc-runtime.md +295 -254
  439. package/kb/site/reference/subsystems/sandbox.md +250 -225
  440. package/kb/site/reference/subsystems/schedule.md +197 -433
  441. package/kb/site/reference/subsystems/session-projection.md +186 -44
  442. package/kb/site/reference/subsystems/session-query.md +525 -515
  443. package/kb/site/reference/subsystems/session-reference.md +231 -228
  444. package/kb/site/reference/subsystems/session.md +1482 -1347
  445. package/kb/site/reference/subsystems/sidebar-right.md +165 -164
  446. package/kb/site/reference/subsystems/skills.md +356 -356
  447. package/kb/site/reference/subsystems/slots.md +239 -208
  448. package/kb/site/reference/subsystems/storage.md +26 -9
  449. package/kb/site/reference/subsystems/subagent.md +119 -102
  450. package/kb/site/reference/subsystems/system-prompt.md +13 -11
  451. package/kb/site/reference/subsystems/terminal.md +188 -188
  452. package/kb/site/reference/subsystems/token-meter.md +45 -0
  453. package/kb/site/reference/subsystems/tools.md +902 -751
  454. package/kb/site/reference/subsystems/typert.md +21 -11
  455. package/kb/site/reference/subsystems/user-questions.md +330 -311
  456. package/kb/site/reference/subsystems/web-client.md +161 -104
  457. package/kb/site/reference/subsystems/web-server.md +434 -306
  458. package/kb/site/reference/subsystems/web.md +268 -210
  459. package/kb/site/reference/subsystems/workflow.md +287 -282
  460. package/kb/site/reference/subsystems/workspace.md +743 -651
  461. package/kb/site/reference/tool-catalog.md +2872 -2835
  462. package/kb/site/reference/tool-execution-pipeline.md +4 -3
  463. package/lib/index.js +359 -244
  464. package/lib/kb-version.js +118 -0
  465. package/package.json +68 -66
  466. package/scripts/refresh-kb.mjs +153 -0
  467. package/scripts/selfcheck.mjs +18 -0
  468. package/scripts/smoke.mjs +77 -0
  469. package/skills/dsh-plugin-dev-kb.md +71 -69
  470. package/skills/dsh-plugin-starter.md +65 -0
  471. package/skills/dsh-upgrade-assistant.md +62 -0
  472. package/kb/extra/agent-lifecycle.md +0 -91
  473. package/kb/extra/agent-lifecycle.zh.md +0 -93
  474. package/kb/extra/api-gateway.md +0 -172
  475. package/kb/extra/api-gateway.zh.md +0 -178
  476. package/kb/extra/architecture.md +0 -165
  477. package/kb/extra/architecture.zh.md +0 -169
  478. package/kb/extra/capability-seams.md +0 -714
  479. package/kb/extra/capability-seams.zh.md +0 -716
  480. package/kb/extra/config-catalog.md +0 -4801
  481. package/kb/extra/config-catalog.zh.md +0 -4803
  482. package/kb/extra/cookbook/adding-a-package.md +0 -170
  483. package/kb/extra/cookbook/adding-a-package.zh.md +0 -170
  484. package/kb/extra/cookbook/adding-a-settings-card.md +0 -72
  485. package/kb/extra/cookbook/adding-a-settings-card.zh.md +0 -72
  486. package/kb/extra/cookbook/adding-a-tool.md +0 -101
  487. package/kb/extra/cookbook/adding-a-tool.zh.md +0 -103
  488. package/kb/extra/cookbook/adding-an-llm-adapter.md +0 -43
  489. package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +0 -43
  490. package/kb/extra/cookbook/extension-cookbook.md +0 -132
  491. package/kb/extra/cookbook/extension-cookbook.zh.md +0 -136
  492. package/kb/extra/cordis-api/context.md +0 -364
  493. package/kb/extra/cordis-api/context.zh.md +0 -366
  494. package/kb/extra/cordis-api/events.md +0 -207
  495. package/kb/extra/cordis-api/events.zh.md +0 -209
  496. package/kb/extra/cordis-api/fiber.md +0 -375
  497. package/kb/extra/cordis-api/fiber.zh.md +0 -377
  498. package/kb/extra/cordis-api/inherited.md +0 -38
  499. package/kb/extra/cordis-api/registry.md +0 -152
  500. package/kb/extra/cordis-api/registry.zh.md +0 -154
  501. package/kb/extra/cordis-api/service.md +0 -102
  502. package/kb/extra/cordis-api/service.zh.md +0 -104
  503. package/kb/extra/cordis-tutorial/01-first-plugin.md +0 -95
  504. package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +0 -95
  505. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +0 -98
  506. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +0 -98
  507. package/kb/extra/cordis-tutorial/03-services.md +0 -98
  508. package/kb/extra/cordis-tutorial/03-services.zh.md +0 -98
  509. package/kb/extra/cordis-tutorial/04-events.md +0 -144
  510. package/kb/extra/cordis-tutorial/04-events.zh.md +0 -144
  511. package/kb/extra/cordis-tutorial/05-config.md +0 -111
  512. package/kb/extra/cordis-tutorial/05-config.zh.md +0 -111
  513. package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +0 -113
  514. package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +0 -113
  515. package/kb/extra/cordis-tutorial/07-into-the-harness.md +0 -108
  516. package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +0 -108
  517. package/kb/extra/cordis-tutorial/index.md +0 -60
  518. package/kb/extra/cordis-tutorial/index.zh.md +0 -62
  519. package/kb/extra/experimental-persistence-catalog.md +0 -17
  520. package/kb/extra/experimental-persistence-catalog.zh.md +0 -17
  521. package/kb/extra/persistence-catalog.md +0 -9140
  522. package/kb/extra/persistence-catalog.zh.md +0 -9142
  523. package/kb/extra/subsystems/README.md +0 -76
  524. package/kb/extra/subsystems/README.zh.md +0 -76
  525. package/kb/extra/subsystems/approval.md +0 -170
  526. package/kb/extra/subsystems/approval.zh.md +0 -170
  527. package/kb/extra/subsystems/client-modules.md +0 -198
  528. package/kb/extra/subsystems/client-modules.zh.md +0 -198
  529. package/kb/extra/subsystems/client-resources.md +0 -92
  530. package/kb/extra/subsystems/client-resources.zh.md +0 -92
  531. package/kb/extra/subsystems/commands.md +0 -223
  532. package/kb/extra/subsystems/commands.zh.md +0 -223
  533. package/kb/extra/subsystems/compaction.md +0 -284
  534. package/kb/extra/subsystems/compaction.zh.md +0 -284
  535. package/kb/extra/subsystems/conversation.md +0 -301
  536. package/kb/extra/subsystems/conversation.zh.md +0 -303
  537. package/kb/extra/subsystems/core.md +0 -1113
  538. package/kb/extra/subsystems/core.zh.md +0 -1125
  539. package/kb/extra/subsystems/credentials.md +0 -493
  540. package/kb/extra/subsystems/credentials.zh.md +0 -493
  541. package/kb/extra/subsystems/filesystem.md +0 -530
  542. package/kb/extra/subsystems/filesystem.zh.md +0 -530
  543. package/kb/extra/subsystems/goal.md +0 -313
  544. package/kb/extra/subsystems/goal.zh.md +0 -313
  545. package/kb/extra/subsystems/jobs.md +0 -554
  546. package/kb/extra/subsystems/jobs.zh.md +0 -554
  547. package/kb/extra/subsystems/llm-streaming.md +0 -1196
  548. package/kb/extra/subsystems/llm-streaming.zh.md +0 -1202
  549. package/kb/extra/subsystems/lsp.md +0 -202
  550. package/kb/extra/subsystems/lsp.zh.md +0 -202
  551. package/kb/extra/subsystems/office-to-pdf.md +0 -87
  552. package/kb/extra/subsystems/office-to-pdf.zh.md +0 -87
  553. package/kb/extra/subsystems/permission-presets.md +0 -167
  554. package/kb/extra/subsystems/permission-presets.zh.md +0 -167
  555. package/kb/extra/subsystems/persistence.md +0 -418
  556. package/kb/extra/subsystems/persistence.zh.md +0 -418
  557. package/kb/extra/subsystems/plan.md +0 -87
  558. package/kb/extra/subsystems/plan.zh.md +0 -87
  559. package/kb/extra/subsystems/ptc-runtime.md +0 -250
  560. package/kb/extra/subsystems/ptc-runtime.zh.md +0 -250
  561. package/kb/extra/subsystems/sandbox.md +0 -221
  562. package/kb/extra/subsystems/sandbox.zh.md +0 -221
  563. package/kb/extra/subsystems/schedule.md +0 -550
  564. package/kb/extra/subsystems/schedule.zh.md +0 -550
  565. package/kb/extra/subsystems/scope.md +0 -59
  566. package/kb/extra/subsystems/scope.zh.md +0 -61
  567. package/kb/extra/subsystems/session-projection.md +0 -356
  568. package/kb/extra/subsystems/session-projection.zh.md +0 -356
  569. package/kb/extra/subsystems/session-query.md +0 -511
  570. package/kb/extra/subsystems/session-query.zh.md +0 -511
  571. package/kb/extra/subsystems/session-reference.md +0 -224
  572. package/kb/extra/subsystems/session-reference.zh.md +0 -224
  573. package/kb/extra/subsystems/session-telemetry.md +0 -212
  574. package/kb/extra/subsystems/session-telemetry.zh.md +0 -212
  575. package/kb/extra/subsystems/session-title.md +0 -213
  576. package/kb/extra/subsystems/session-title.zh.md +0 -213
  577. package/kb/extra/subsystems/session.md +0 -1339
  578. package/kb/extra/subsystems/session.zh.md +0 -1343
  579. package/kb/extra/subsystems/settings.md +0 -155
  580. package/kb/extra/subsystems/settings.zh.md +0 -155
  581. package/kb/extra/subsystems/shell.md +0 -314
  582. package/kb/extra/subsystems/shell.zh.md +0 -314
  583. package/kb/extra/subsystems/sidebar-right.md +0 -160
  584. package/kb/extra/subsystems/sidebar-right.zh.md +0 -160
  585. package/kb/extra/subsystems/skills.md +0 -352
  586. package/kb/extra/subsystems/skills.zh.md +0 -352
  587. package/kb/extra/subsystems/slots.md +0 -200
  588. package/kb/extra/subsystems/slots.zh.md +0 -204
  589. package/kb/extra/subsystems/spill.md +0 -124
  590. package/kb/extra/subsystems/spill.zh.md +0 -124
  591. package/kb/extra/subsystems/storage.md +0 -259
  592. package/kb/extra/subsystems/storage.zh.md +0 -259
  593. package/kb/extra/subsystems/subagent.md +0 -686
  594. package/kb/extra/subsystems/subagent.zh.md +0 -688
  595. package/kb/extra/subsystems/subprocess.md +0 -321
  596. package/kb/extra/subsystems/subprocess.zh.md +0 -321
  597. package/kb/extra/subsystems/system-prompt.md +0 -254
  598. package/kb/extra/subsystems/system-prompt.zh.md +0 -254
  599. package/kb/extra/subsystems/terminal.md +0 -184
  600. package/kb/extra/subsystems/terminal.zh.md +0 -184
  601. package/kb/extra/subsystems/token-meter.md +0 -106
  602. package/kb/extra/subsystems/token-meter.zh.md +0 -106
  603. package/kb/extra/subsystems/tools.md +0 -747
  604. package/kb/extra/subsystems/tools.zh.md +0 -747
  605. package/kb/extra/subsystems/typert.md +0 -690
  606. package/kb/extra/subsystems/typert.zh.md +0 -690
  607. package/kb/extra/subsystems/user-questions.md +0 -307
  608. package/kb/extra/subsystems/user-questions.zh.md +0 -307
  609. package/kb/extra/subsystems/web-client.md +0 -100
  610. package/kb/extra/subsystems/web-client.zh.md +0 -100
  611. package/kb/extra/subsystems/web-server.md +0 -302
  612. package/kb/extra/subsystems/web-server.zh.md +0 -302
  613. package/kb/extra/subsystems/web.md +0 -206
  614. package/kb/extra/subsystems/web.zh.md +0 -206
  615. package/kb/extra/subsystems/workflow.md +0 -278
  616. package/kb/extra/subsystems/workflow.zh.md +0 -278
  617. package/kb/extra/subsystems/workspace.md +0 -647
  618. package/kb/extra/subsystems/workspace.zh.md +0 -647
  619. package/kb/extra/tool-catalog.md +0 -2824
  620. package/kb/extra/tool-catalog.zh.md +0 -2832
  621. package/kb/extra/tool-execution-pipeline.md +0 -65
  622. package/kb/extra/tool-execution-pipeline.zh.md +0 -67
@@ -1,534 +1,708 @@
1
- ---
2
- editSource: "docs/subsystems/filesystem.md"
3
- rawMarkdownPath: "en/reference/subsystems/filesystem.md"
4
- outline: [2,3]
5
- ---
6
-
7
- # Filesystem
8
-
9
- The optional filesystem capability has four parts: [dsh-fs](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/fs) owns `ctx.fs` and atomic text operations with optional guards, [dsh-fs-local](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/fs-local) implements local disk, [dsh-fs-observation-policy](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/fs-observation-policy) records observed presence or absence and adds freshness rules through events rather than a service, and [dsh-tool-fs](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/tool-fs) directly executes model-facing read/write/edit calls and renders windows. It is outside the agent-loop spine; alternate backends do not change policy or tool schemas.
10
-
11
- `dsh-fs-observation-policy` is optional. Without it, the `FileSystem` Service Definition, a provider, and the `dsh-tool-fs` Consumer form the complete, unconstrained filesystem seam: `write` unconditionally creates or overwrites, and `edit` unconditionally replaces literal text. The policy plugin changes these operations by deciding the `fs/*` waterfalls. Removing it does not break the tool because the tool calls `ctx.fs` and dispatches events; it does not call policy methods. A deployment that loads `dsh-tool-fs` is expected to also load `dsh-fs-observation-policy` so the default behavior is read-before-write/edit.
12
-
13
- Provider source: [`packages/fs/fs/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/types.ts) and [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts). Policy source: [`packages/fs/fs-observation-policy/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs-observation-policy/src/types.ts). Read-rendering source: [`packages/fs/tool-fs/src/read-render.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/tool-fs/src/read-render.ts).
14
-
15
- ## Target identity and metadata (provider contract)
16
-
17
- Every operation resolves a user-supplied path to an opaque backend target first. Consumers may display `displayPath`, but must not parse `targetKey` (a branded opaque id) or assume it is a local absolute path.
18
-
19
- Consumers that share the filesystem's execution world obtain cross-capability coordinates through the provider instead of interpreting that identity: `processPath(target)` returns the canonical absolute path a subprocess can open, `processPathFromHostPath(hostPath)` maps an absolute harness-host file only when that execution world shares it, `fileUrl(target)` returns its provider-platform `file:` URI, and `contains(parent, child)` tests canonical identity or descendant containment.
20
-
21
- ```ts type-equiv
22
- /**
23
- * A path resolved by a backend into a stable identity. `resolve()` produces
24
- * this; every other operation takes it.
25
- */
26
- interface FsTarget {
27
- /** Opaque key for stale guards and target lookup. */
28
- targetKey: FsTargetKey
29
- /**
30
- * Path for model/UI-facing output. May be a local absolute path,
31
- * workspace-relative path, or remote URI depending on the backend.
32
- */
33
- displayPath: string
34
- }
35
- ```
36
-
37
- The backend owns file-version tokens — the freshness token a write/edit guards against. The policy plugin stores them for stale checks; consumers do not interpret them. Both ids are branded opaque strings.
38
-
39
- ```ts type-equiv
40
- /**
41
- * Opaque key for stale guards and target lookup. The local backend uses a
42
- * realpath-like string; a remote backend might use a workspace URI or file id.
43
- * Consumers MUST NOT parse it or assume it is a local absolute path.
44
- */
45
- type FsTargetKey = Branded<'FsTargetKey'>
46
- ```
47
-
48
- ```ts type-equiv
49
- /**
50
- * Opaque file-version token — the freshness token a write/edit guards against.
51
- * The local backend derives it from high-resolution stat identity and freshness
52
- * fields; a remote backend might use a revision id. The policy layer records it
53
- * for stale checks; consumers may display related metadata but MUST NOT
54
- * interpret this token.
55
- */
56
- type FsVersion = Branded<'FsVersion'>
57
- ```
58
-
59
- `stat` returns metadata (never content), or `undefined` when the target is absent. `type` lets consumers reject directories and special files before reading, and `size` lets text consumers choose `readText` vs `streamText` without probing by failure. A text consumer applies its own retention ceiling while consuming `streamText`. Raw-byte consumers use `readBytes(target, signal, maxBytes)`; its required complete-content cap makes a known or discovered overflow fail with `FS_TOO_LARGE` instead of truncating or buffering without a bound.
60
-
61
- ```ts type-equiv
62
- /**
63
- * Metadata about a target — what {@link FileSystem.stat} returns. Lets the
64
- * policy layer reject directories/special files before reading and choose
65
- * `readText` vs `streamText` from `size` without probing by failure. `version`
66
- * is the freshness token. `undefined` from `stat` means the target is absent.
67
- */
68
- interface FsInfo {
69
- /** Opaque freshness token of the target right now. */
70
- version: FsVersion
71
- /** Whether the target is a regular file, a directory, or something else. */
72
- type: 'file' | 'directory' | 'other'
73
- /** Byte size of a regular file, when the backend can report it. */
74
- size?: number
75
- }
76
- ```
77
-
78
- `lstat` is the path-level no-follow metadata primitive. It takes a path instead of an `FsTarget` because `resolve` intentionally follows symlinks to produce stable identity; consumers that need trust-boundary checks can call `lstat` first and reject `symlink` before resolving.
79
-
80
- ```ts type-equiv
81
- /**
82
- * Metadata about a path without following the final path component when it is a
83
- * symbolic link. Unlike {@link FsInfo}, this path-level probe can report
84
- * `symlink` so consumers with trust-boundary rules can reject repository-owned
85
- * links before resolving a target.
86
- */
87
- interface FsPathInfo {
88
- /** Opaque freshness token of the path entry right now. */
89
- version: FsVersion
90
- /** Whether the path entry is a regular file, directory, symlink, or other. */
91
- type: 'file' | 'directory' | 'symlink' | 'other'
92
- /** Byte size of the path entry, when the backend can report it. */
93
- size?: number
94
- }
95
- ```
96
-
97
- `listDir` returns direct child entries in stable name order. Each entry carries the child basename, type, resolved target, and cheap metadata when the backend can report it. It must not read file contents, so `size` is only for regular files and `version` is metadata-derived. Broken or disappeared children may be returned as `other` without metadata; permission or backend I/O failures while listing or resolving child metadata fail the whole listing with `FS_PERMISSION_DENIED` or `FS_IO_ERROR`.
98
-
99
- ```ts type-equiv
100
- /**
101
- * One direct child returned by {@link FileSystem.listDir}. Listing returns
102
- * metadata and resolved targets only; it must not read file contents.
103
- */
104
- interface FsDirEntry {
105
- /** Basename of the child inside the listed directory. */
106
- name: string
107
- /** Whether the child is a regular file, a directory, or something else. */
108
- type: 'file' | 'directory' | 'other'
109
- /** Resolved child target for follow-up operations. */
110
- target: FsTarget
111
- /** Opaque freshness token when the backend can report metadata cheaply. */
112
- version?: FsVersion
113
- /** Byte size of a regular file, when the backend can report it. */
114
- size?: number
115
- }
116
- ```
117
-
118
- ## Write and edit guards (provider contract)
119
-
120
- Both `writeText` and `editText` take their version guard OPTIONALLY: omit it for an unconditional (bare-provider) mutation, supply it to guard. `writeText`'s guard is an `FsWriteIntent` — `createIfAbsent` creates a missing target and rejects an existing one with `FS_NOT_OBSERVED`, including a target that appears after the provider's initial probe because publication itself must be no-replace; `replaceIfVersion` replaces only when the target exists at the observed version, else `FS_STALE_VERSION`. Omitting `expected` unconditionally creates-or-overwrites. The union itself carries only the two guarded intents; "no guard" is expressed by omission, so write and edit both use the same optional `expected` field.
121
-
122
- ```ts type-equiv
123
- /**
124
- * Guarded write intent. `createIfAbsent` rejects an existing target with
125
- * `FS_NOT_OBSERVED`; `replaceIfVersion` rejects absence or mismatch with
126
- * `FS_STALE_VERSION`. Omitting the intent from `writeText` means unconditional
127
- * create-or-overwrite, not a third union arm.
128
- */
129
- type FsWriteIntent =
130
- | { kind: 'createIfAbsent' }
131
- | { kind: 'replaceIfVersion'; version: FsVersion }
132
- ```
133
-
134
- ```ts type-equiv
135
- /** Outcome of a full-file write. */
136
- interface FsWriteOutcome {
137
- /** Whether the write created a new file or replaced an existing one. */
138
- operation: 'create' | 'update'
139
- /** Opaque version of the file after the write. */
140
- version: FsVersion
141
- /**
142
- * The file's content BEFORE the write, or `null` when the file did not exist
143
- * (a create) or the backend declined a contextual basis (for example, a
144
- * binary/non-UTF-8 prior file or either overwrite side reaching its exclusive limit).
145
- * LF-normalized storage text (the diff basis), never a diff — a consumer
146
- * computes the result-time contextual diff from `before`/`after` when
147
- * `before` is present, else falls back to a whole-file diff.
148
- */
149
- before: string | null
150
- /** The file's content AFTER the write, LF-normalized to share `before`'s diff basis. */
151
- after: string
152
- }
153
- ```
154
-
155
- `editText` is a provider-level mutation, not a `read` plus `write` composed elsewhere. When guarded it verifies the expected version BEFORE literal matching (so a stale edit reports `FS_STALE_VERSION`, not a match failure against newer content); unguarded it edits the current content. Either way it applies the replacement and writes atomically — keeping matching, line-ending handling, the stale check, and atomic replacement inside one mutation critical section — and a missing target reports `FS_STALE_VERSION` on both paths.
156
-
157
- ```ts type-equiv
158
- /** A literal-replacement edit request. */
159
- interface FsEditRequest {
160
- /** Literal non-empty text to replace. Must match exactly (after line-ending normalization). */
161
- oldString: string
162
- /** Literal replacement text. An empty string deletes the matched text. */
163
- newString: string
164
- /** Replace every match instead of requiring exactly one. */
165
- replaceAll: boolean
166
- }
167
- ```
168
-
169
- ```ts type-equiv
170
- /** Outcome of a literal edit. */
171
- interface FsEditOutcome {
172
- /** Opaque version of the file after the edit. */
173
- version: FsVersion
174
- /**
175
- * The file's content BEFORE the edit. Raw storage text (LF-normalized by the
176
- * backend), never a diff — a consumer computes the result-time contextual diff
177
- * (the applied hunk with context) from `before`/`after`.
178
- */
179
- before: string
180
- /** The file's content AFTER the edit. */
181
- after: string
182
- }
183
- ```
184
-
185
- ## The fs policy events (provider contract vocabulary)
186
-
187
- `dsh-fs` owns three events the tool dispatches and the policy plugin listens for, so the emitter (`dsh-tool-fs`) and the listener (`dsh-fs-observation-policy`) share a vocabulary without the emitter depending on the policy plugin. They carry only `dsh-fs` vocabulary plus an opaque `object` actor — no model-facing concepts and no agent/session owner structure.
188
-
189
- `fs/write-intent` and `fs/edit-intent` are **single-slot decision waterfalls**: the tool dispatches each with a default thunk returning `undefined` (the bare provider), and a listener fully decides without calling `next()`. The slot is first-wins by registration order — the policy plugin owning it is a deployment convention, not an enforced invariant. `fs/observed` is a fire-and-forget recording event carrying an `FsObservation`: present at a version or confirmed absent. It is dispatched with a plain `ctx.emit`; its listener MUST be synchronous and side-effect-only, because the tool does NOT guard the emit — a throwing listener can replace a read error or surface as the tool's `isError` result after a mutation already succeeded. The generated [cordis surface](#cordis-surface) below shows the exact signatures.
190
-
191
- ```ts type-equiv
192
- /**
193
- * One authoritative observation of a target. A present observation carries the
194
- * version used by guarded replacement; an absent observation authorizes only a
195
- * guarded create, never an edit.
196
- */
197
- type FsObservation =
198
- | { readonly kind: 'present'; readonly version: FsVersion }
199
- | { readonly kind: 'absent' }
200
- ```
201
-
202
- ## Execution context (policy plugin)
203
-
204
- The policy plugin needs just enough execution context to derive the observed-state owner by narrowing the opaque `object` actor the `fs/*` events carry. `ToolExecution` has the required fields, so `dsh-tool-fs` passes its execution object through as the actor without making `dsh-fs-observation-policy` import the tool, agent, or session packages.
205
-
206
- ```ts type-equiv
207
- /**
208
- * Minimal structural view of a tool execution the policy plugin needs to derive
209
- * an observed-state owner. `@deepseek-ai/dsh-tools`' `ToolExecution` contains
210
- * these fields, so the tool passes its `exec` straight through as the opaque
211
- * `object` actor on the `fs/*` events; this plugin narrows that actor to
212
- * `FsObservationActor` without importing `dsh-tools`, `dsh-agent`, or `dsh-session`.
213
- *
214
- * The owner is `agent.session` when present. It is treated as an opaque object
215
- * identity (a `WeakMap` key); this package never reads any of its fields.
216
- */
217
- interface FsObservationActor {
218
- /** The agent on whose behalf the call runs, when there is one. */
219
- agent?: {
220
- /** The session that owns observed-file state, used as an opaque key. */
221
- session?: object
222
- }
223
- }
224
- ```
225
-
226
- ## Read outcome (consumer / read rendering)
227
-
228
- A text read is bounded by line window, byte cap, and backend limits. After the byte cap is reached, scanning continues without retaining more lines so `totalLines` remains exact. The result the model-facing `read` tool renders is purely presentational; there is no `full`/`partial` view — authorization is freshness-based (the tool emits a present `fs/observed` directly with the stat's version), so any windowed read can authorize a later write/edit when the file is unchanged. A metadata miss emits an absent observation before the tool returns `FS_NOT_FOUND`, allowing a later guarded write to recreate an externally deleted target without authorizing edit. `dsh-tool-fs`, the executor that owns the read, implements read windowing and constructs this result; the policy plugin does not.
229
-
230
- ```ts type-equiv
231
- /** Outcome of a bounded text read — what {@link formatReadOutput} renders. */
232
- interface FileReadOutcome {
233
- /** 1-based first line requested. */
234
- offset: number
235
- /** Returned lines, already numbered. */
236
- lines: FileTextLine[]
237
- /** Exact total line count in the file. */
238
- totalLines: number
239
- /** Whether selected output hit the byte cap. */
240
- truncatedByBytes?: true
241
- }
242
- ```
243
-
244
- ## Observed-file state (policy plugin)
245
-
246
- Observed state is a `WeakMap<owner, Map<targetKey, FsObservation>>` held inside the `dsh-fs-observation-policy` plugin. Missing map entry means unseen; `{ kind: 'absent' }` means a `read` or `str_replace_editor` `view`, `str_replace`, or `insert` metadata miss confirmed absence; `{ kind: 'present', version }` means a read, write, or edit observed that version. The write decision maps unseen and absent to `createIfAbsent`, while present maps to `replaceIfVersion`; the edit decision maps unseen to `FS_NOT_OBSERVED`, absent to `FS_NOT_FOUND`, and present to its version guard. The owner is derived from the event actor (normally `exec.agent.session`), treated as opaque and never read. Disposal drops everything (HMR safety), and the policy performs no filesystem I/O.
247
-
248
- ## Error taxonomy (provider contract)
249
-
250
- Filesystem failures use stable `FsErrorCode` strings carried by `FsError` (`HarnessError`). The tool registry preserves `{ name, code }` on error results, so retry, permission, and UI layers can branch without parsing text.
251
-
252
- ```ts type-equiv
253
- /**
254
- * Stable, machine-routable codes for filesystem failures. Carried on
255
- * {@link FsError}; the tool registry exposes `{ name, code }` on `isError`
256
- * results so retry/permission/UI layers can branch without parsing messages.
257
- */
258
- type FsErrorCode =
259
- | 'FS_NOT_FOUND'
260
- | 'FS_NOT_DIRECTORY'
261
- | 'FS_NOT_TEXT'
262
- | 'FS_NOT_REGULAR_FILE'
263
- | 'FS_TOO_LARGE'
264
- | 'FS_PERMISSION_DENIED'
265
- | 'FS_SANDBOX_DENIED'
266
- | 'FS_IO_ERROR'
267
- | 'FS_STALE_VERSION'
268
- | 'FS_NOT_OBSERVED'
269
- | 'FS_AMBIGUOUS_EDIT'
270
- | 'FS_EDIT_NOT_FOUND'
271
- | 'FS_ABORTED'
272
- ```
273
-
274
- `FS_NOT_DIRECTORY`, `FS_PERMISSION_DENIED`, and `FS_IO_ERROR` are used by directory listing to distinguish an existing non-directory target, a denied listing, and an unexpected backend I/O failure. `FS_SANDBOX_DENIED` is a POLICY refusal from a sandbox-enforcing backend (`dsh-fs-sandbox`) — the mode fence denied a write/edit — distinct from `FS_PERMISSION_DENIED` (the host kernel refusing). `FS_NOT_OBSERVED` means the policy plugin has no prior-observation record for this owner (or a `createIfAbsent` hit an existing file). `FS_NOT_FOUND` also represents an edit rejected from confirmed absence. `FS_STALE_VERSION` means the backend version no longer matches the observed one (or the provider itself receives an edit for a missing target). Freshness authorization has no partial/full distinction, so there is no `FS_PARTIAL_OBSERVATION`.
275
-
276
- ## No timeouts on file IO
277
-
278
- `read`/`write`/`edit` take **no** `timeoutMs`, and the provider contract arms no deadline — unlike bash and web (which consume [`@deepseek-ai/dsh-timeout`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/util/timeout/README.md)) and the subprocess-backed `glob`/`grep` (whose declared `timeoutMs` is enforced by `@deepseek-ai/dsh-tool-call-timeout-policy`): those are process-backed, where a deadline can really kill the work. A local syscall is best-effort-abortable at most — a timeout could not force an in-progress `fsync`/`rename` to stop, so a `timeoutMs` here would be a deadline the seam cannot enforce, and an implicit default in the exact place explicit-over-implicit forbids. Cancellation still propagates through the tool-execution signal for best-effort abort at syscall boundaries.
279
-
280
- ## The service and the plugin
281
-
282
- `FileSystem` (`ctx.fs`, abstract) owns the provider primitives: `resolve`, `processPath`, `processPathFromHostPath`, `fileUrl`, `contains`, `stat`, `lstat`, `readText`, `streamText`, `readBytes`, `listDir`, `writeText`, and `editText`. `dsh-fs-observation-policy` registers **no service** — it is a plugin that adds policy through the `fs/*` event gate: it decides the write/edit intent waterfalls from unseen/absent/present state and records `FsObservation` values. The executor is `dsh-tool-fs`: it reads/writes/edits through `ctx.fs`, dispatches the waterfalls, and emits the recording event. The generated [`ctx.fs` section](#ctxfs--filesystem-abstract-seam) below shows the exact signatures.
283
-
284
- <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
285
-
286
- <a id="cordis-surface"></a>
287
-
288
- ## Cordis API
289
-
290
- 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).
291
-
292
- <a id="ctxfs--filesystem-abstract-seam"></a>
293
-
294
- ### `ctx.fs` — `FileSystem` (abstract seam)
295
-
296
- Abstract filesystem provider. Targets must preserve identity across aliases; reads expose regular UTF-8 text or typed errors, listings are stable and content-free, and mutations are atomic. Optional guards add stale protection without changing the unguarded provider contract.
297
-
298
- ```ts cordis-catalog
299
- /**
300
- * Observe one file or a directory's direct entries in this provider's execution world.
301
- * @param target - resolved file or directory, including an absent path to observe for creation.
302
- * @param changed - invalidation callback; errors can be reported during or after initialization.
303
- * @param signal - cancels watcher initialization; the caller closes an initialized watcher.
304
- * @returns a promise resolving once observation is active, with an asynchronous close function.
305
- * @throws when the provider does not support watching or cannot initialize the watcher.
306
- */
307
- watch(target: FsTarget, changed: (error?: Error) => void, signal: AbortSignal): Promise<() => Promise<void>>
308
-
309
- /**
310
- * Resolve a model/plugin-supplied path into a stable {@link FsTarget}. May perform I/O (a
311
- * remote/sandboxed backend may need a round-trip to map a path to a stable identity), hence
312
- * async even though the local backend only normalizes + realpaths.
313
- *
314
- * @param path - the path to resolve; relative paths resolve against `opts.cwd`.
315
- * @param opts - optional cwd override and cancellation signal.
316
- * @returns the stable target; the same file yields the same `targetKey`.
317
- */
318
- abstract resolve(path: string, opts?: { cwd?: string; signal?: AbortSignal }): Promise<FsTarget>
319
-
320
- /**
321
- * Return the canonical absolute path a subprocess in this filesystem's
322
- * execution world can open. The path is deliberately separate from
323
- * {@link FsTarget.targetKey}: consumers may pass this value to another OS
324
- * capability, but must continue treating the target key as opaque.
325
- * @param target - the resolved target whose process path is required.
326
- * @returns an absolute path in the backend's execution world.
327
- */
328
- abstract processPath(target: FsTarget): string
329
-
330
- /**
331
- * Map an absolute path from the harness host into this filesystem's
332
- * execution world when both paths identify the same file. The base provider
333
- * exposes no mapping; host-backed or explicitly shared backends override it.
334
- * @param hostPath - absolute path in the harness host filesystem.
335
- * @returns the process path for the same file, or undefined when this
336
- * execution world cannot read that host file.
337
- */
338
- processPathFromHostPath(hostPath: string): string | undefined
339
-
340
- /**
341
- * Return the canonical `file:` URI for a target in this filesystem's
342
- * execution world. Backends own URI encoding because the host platform may
343
- * differ from the execution platform.
344
- * @param target - the resolved target to encode.
345
- * @returns the target's canonical file URI.
346
- */
347
- abstract fileUrl(target: FsTarget): string
348
-
349
- /**
350
- * Test canonical containment without exposing or parsing backend target
351
- * keys. Both targets must come from this provider.
352
- * @param parent - canonical directory target.
353
- * @param child - canonical candidate target.
354
- * @returns true when `child` is `parent` or a descendant of it.
355
- */
356
- abstract contains(parent: FsTarget, child: FsTarget): boolean
357
-
358
- /**
359
- * Return target metadata, or `undefined` when the target does not exist.
360
- * @param target - the resolved target to stat.
361
- * @param signal - aborts the metadata round-trip.
362
- * @returns metadata only, never content; undefined for an absent target.
363
- */
364
- abstract stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined>
365
-
366
- /**
367
- * Return path metadata without following the final path component when it is a
368
- * symbolic link. This is intentionally path-shaped, not target-shaped:
369
- * {@link resolve} follows symlinks to produce the stable identity used by
370
- * normal reads/writes, while `lstat` lets a consumer reject the path itself
371
- * before that follow happens.
372
- *
373
- * `opts.cwd` follows {@link resolve}'s cwd rules. `undefined` means the path is
374
- * absent.
375
- * @param path - the path to inspect; relative paths resolve against `opts.cwd`.
376
- * @param opts - `cwd` overrides the backend's default base for relative paths.
377
- * @param signal - aborts the metadata round-trip.
378
- * @returns metadata only, never content; undefined for an absent path.
379
- */
380
- abstract lstat(path: string, opts?: { cwd?: string }, signal?: AbortSignal): Promise<FsPathInfo | undefined>
381
-
382
- /**
383
- * Read the whole regular text file as a single decoded string.
384
- * @param target - the resolved target to read.
385
- * @param signal - aborts the read.
386
- * @returns the full decoded UTF-8 content.
387
- */
388
- abstract readText(target: FsTarget, signal?: AbortSignal): Promise<string>
389
-
390
- /**
391
- * Stream the whole regular text file as decoded text chunks (same text
392
- * semantics as {@link readText}, for large files). The backend owns
393
- * cross-chunk UTF-8 decoding and binary rejection so the policy layer never
394
- * touches raw bytes.
395
- * @param target - the resolved target to read.
396
- * @param signal - aborts the stream, including between chunks.
397
- * @returns the chunk iterable, decoded and validated like {@link readText}.
398
- */
399
- abstract streamText(target: FsTarget, signal?: AbortSignal): Promise<AsyncIterable<string>>
400
-
401
- /**
402
- * Read the whole regular file as raw bytes with no decoding or binary
403
- * rejection. The bound lives at this seam so a backend can never buffer an
404
- * unbounded file: a target known or discovered to exceed `maxBytes` fails
405
- * with `FS_TOO_LARGE` instead of returning a truncated result.
406
- * @param target - the resolved target to read.
407
- * @param signal - aborts the read.
408
- * @param maxBytes - inclusive byte cap on the complete content.
409
- * @returns the full raw content, at most `maxBytes` long.
410
- */
411
- abstract readBytes(target: FsTarget, signal: AbortSignal | undefined, maxBytes: number): Promise<Uint8Array>
412
-
413
- /**
414
- * Read one byte window of the regular file as raw bytes with no decoding or
415
- * binary rejection: the bytes at `[offset, offset + length)`, shorter when
416
- * the file ends inside the window and empty when `offset` lies at or past
417
- * its end. The window is the bound here, not the file: a backend transfers
418
- * at most `length` bytes of content beyond the prefix it skips to reach
419
- * `offset` and never buffers the whole file, so the caller's cap on `length`
420
- * is the guard against unbounded buffering.
421
- * @param target - the resolved target to read.
422
- * @param range - `offset`, the 0-based first byte, and `length`, the largest byte count; both non-negative integers.
423
- * @param signal - aborts the read.
424
- * @returns the window's bytes, at most `length` long.
425
- */
426
- abstract readByteRange(target: FsTarget, range: { offset: number; length: number }, signal?: AbortSignal): Promise<Uint8Array>
427
-
428
- /**
429
- * List direct children of a directory in stable name order. Returns resolved
430
- * child targets plus cheap metadata only; never reads file contents.
431
- * @param target - the resolved directory target.
432
- * @param signal - aborts the listing.
433
- * @returns one entry per direct child, in stable name order.
434
- */
435
- abstract listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]>
436
-
437
- /**
438
- * Atomically create or replace UTF-8 text. `expected` guards intent and
439
- * staleness; omission allows unconditional overwrite.
440
- * @param target - the resolved target to write.
441
- * @param content - the full new file content.
442
- * @param expected - the write intent guarding the write; omit for unconditional.
443
- * @param signal - aborts before atomic publication takes effect.
444
- * @param sandboxPolicy - the per-call mode and workspace root this write
445
- * runs under; a sandboxing backend fences the write by it, the bare backend
446
- * ignores it. Omit to leave the backend its own default.
447
- * @returns the outcome, including the version the write produced.
448
- */
449
- abstract writeText( target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsWriteOutcome>
450
-
451
- /**
452
- * Atomically edit literal text. When supplied, the version guard is checked
453
- * before matching so stale content reports `FS_STALE_VERSION`; omission edits
454
- * the current content without a freshness precondition.
455
- * @param target - the resolved target to edit.
456
- * @param edit - the literal search/replace request.
457
- * @param expected - the version guard; omit for an unconditional edit.
458
- * @param signal - aborts before atomic publication takes effect.
459
- * @param sandboxPolicy - the per-call mode and workspace root this edit runs
460
- * under; a sandboxing backend fences the edit by it, the bare backend
461
- * ignores it. Omit to leave the backend its own default.
462
- * @returns the outcome, including the version the edit produced.
463
- */
464
- abstract editText( target: FsTarget, edit: FsEditRequest, expected?: { version: FsVersion }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsEditOutcome>
465
- ```
466
-
467
- Types: [SandboxExecutionPolicy](./sandbox.md)
468
-
469
- Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
470
-
471
- <a id="fs-events"></a>
472
-
473
- ### `fs/*` events
474
-
475
- <a id="fsedit-intent--waterfall"></a>
476
-
477
- #### `fs/edit-intent` — waterfall
478
-
479
- Single-slot decision for the next FileSystem.editText. Calling `next()` yields an unconditional edit; the first returned guard wins.
480
-
481
- ```ts cordis-catalog
482
- /**
483
- * Single-slot decision for the next {@link FileSystem.editText}. Calling
484
- * `next()` yields an unconditional edit; the first returned guard wins.
485
- * @param target - the resolved target about to be edited.
486
- * @param actor - the opaque tool-execution context the decider keys off.
487
- * @mode waterfall
488
- */
489
- 'fs/edit-intent'(target: FsTarget, actor: object | undefined, next: () => { version: FsVersion } | undefined | Promise<{ version: FsVersion } | undefined>): Promise<{ version: FsVersion } | undefined>
490
- ```
491
-
492
- Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
493
-
494
- <a id="fsobserved--emit"></a>
495
-
496
- #### `fs/observed` — emit
497
-
498
- Record an authoritative positive or negative observation. Listeners must be synchronous recorders: throws fail the tool call and returned promises are not awaited.
499
-
500
- ```ts cordis-catalog
501
- /**
502
- * Record an authoritative positive or negative observation. Listeners must
503
- * be synchronous recorders: throws fail the tool call and returned promises
504
- * are not awaited.
505
- * @param target - the target whose presence or absence was observed.
506
- * @param observation - present with its version, or confirmed absent.
507
- * @param actor - the observing tool-execution context; undefined records nothing useful.
508
- * @mode emit
509
- */
510
- 'fs/observed'(target: FsTarget, observation: FsObservation, actor: object | undefined): void
511
- ```
512
-
513
- Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
514
-
515
- <a id="fswrite-intent--waterfall"></a>
516
-
517
- #### `fs/write-intent` — waterfall
518
-
519
- Single-slot decision for the next FileSystem.writeText. Calling `next()` yields the bare provider's unconditional write; the first listener that returns an intent owns the decision rather than composing with peers.
520
-
521
- ```ts cordis-catalog
522
- /**
523
- * Single-slot decision for the next {@link FileSystem.writeText}. Calling
524
- * `next()` yields the bare provider's unconditional write; the first listener
525
- * that returns an intent owns the decision rather than composing with peers.
526
- * @param target - the resolved target about to be written.
527
- * @param actor - the opaque tool-execution context the decider keys off.
528
- * @mode waterfall
529
- */
530
- 'fs/write-intent'(target: FsTarget, actor: object | undefined, next: () => FsWriteIntent | undefined | Promise<FsWriteIntent | undefined>): Promise<FsWriteIntent | undefined>
531
- ```
532
-
533
- Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
534
- <!-- END GENERATED cordis-surface -->
1
+ ---
2
+ editSource: "docs/subsystems/filesystem.md"
3
+ rawMarkdownPath: "en/reference/subsystems/filesystem.md"
4
+ outline: [2,3]
5
+ ---
6
+
7
+ # Filesystem
8
+
9
+ The optional filesystem capability composes these roles: [dsh-fs](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/fs) owns `ctx.fs` and guarded file mutations, [dsh-fs-local](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/fs-local) implements local disk, [dsh-fs-observation-policy](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/fs-observation-policy) records observed presence or absence and adds freshness rules through events rather than a service, and [dsh-tool-fs](https://github.com/deepseek-ai/deepseek-harness/tree/master/packages/fs/tool-fs) directly executes model-facing read/write/edit calls and renders windows. It is outside the agent-loop spine; alternate backends do not change policy or tool schemas. The pure [dsh-fs-patch](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs-patch/README.md) library supplies patch parsing and text application.
10
+
11
+ `dsh-fs-observation-policy` is optional. Without it, the `FileSystem` Service Definition, a provider, and the `dsh-tool-fs` Consumer form the complete, unconstrained filesystem seam: `write` unconditionally creates or overwrites, and `edit` unconditionally replaces literal text. The policy plugin changes these operations by deciding the `fs/*` waterfalls. Removing it does not break the tool because the tool calls `ctx.fs` and dispatches events; it does not call policy methods. The shipped compositions run without it: `dsh-base` lists the `fs-observation-policy` row `disabled: true`, and a deployment that wants read-before-write/edit sets that row to `disabled: false`.
12
+
13
+ Provider source: [`packages/fs/fs/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/types.ts) and [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts). Policy source: [`packages/fs/fs-observation-policy/src/types.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs-observation-policy/src/types.ts). Read-rendering source: [`packages/fs/tool-fs/src/read-render.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/tool-fs/src/read-render.ts).
14
+
15
+ ## Target identity and metadata (provider contract)
16
+
17
+ Every operation resolves a user-supplied path to an opaque backend target first. Consumers may display `displayPath`, but must not parse `targetKey` (a branded opaque id) or assume it is a local absolute path.
18
+
19
+ Consumers that share the filesystem's execution world obtain cross-capability coordinates through the provider instead of interpreting that identity: `processPath(target)` returns the canonical absolute path a subprocess can open, `processPathFromHostPath(hostPath)` maps an absolute harness-host file only when that execution world shares it, `fileUrl(target)` returns its provider-platform `file:` URI, and `contains(parent, child)` tests canonical identity or descendant containment.
20
+
21
+ ```ts type-equiv
22
+ /**
23
+ * A path resolved by a backend into a stable identity. `resolve()` produces
24
+ * this; every other operation takes it.
25
+ */
26
+ interface FsTarget {
27
+ /** Opaque key for stale guards and target lookup. */
28
+ targetKey: FsTargetKey
29
+ /**
30
+ * Path for model/UI-facing output. May be a local absolute path,
31
+ * workspace-relative path, or remote URI depending on the backend.
32
+ */
33
+ displayPath: string
34
+ }
35
+ ```
36
+
37
+ The backend owns file-version tokens — the freshness token a mutation guards against. The policy plugin stores them for stale checks; consumers do not interpret them. Both ids are branded opaque strings.
38
+
39
+ ```ts type-equiv
40
+ /**
41
+ * Opaque key for stale guards and target lookup. The local backend uses a
42
+ * realpath-like string; a remote backend might use a workspace URI or file id.
43
+ * Consumers MUST NOT parse it or assume it is a local absolute path.
44
+ */
45
+ type FsTargetKey = Branded<'FsTargetKey'>
46
+ ```
47
+
48
+ ```ts type-equiv
49
+ /**
50
+ * Opaque file-version token — the freshness token a write/edit guards against.
51
+ * The local backend derives it from high-resolution stat identity and freshness
52
+ * fields; a remote backend might use a revision id. The policy layer records it
53
+ * for stale checks; consumers may display related metadata but MUST NOT
54
+ * interpret this token.
55
+ */
56
+ type FsVersion = Branded<'FsVersion'>
57
+ ```
58
+
59
+ `stat` returns metadata (never content), or `undefined` when the target is absent. `type` lets consumers reject directories and special files before reading, and `size` lets text consumers choose `readText` vs `streamText` without probing by failure. A text consumer applies its own retention ceiling while consuming `streamText`. Raw-byte consumers use `readBytes(target, signal, maxBytes)`; its required complete-content cap makes a known or discovered overflow fail with `FS_TOO_LARGE` instead of truncating or buffering without a bound.
60
+
61
+ ```ts type-equiv
62
+ /**
63
+ * Metadata about a target — what {@link FileSystem.stat} returns. Lets the
64
+ * policy layer reject directories/special files before reading and choose
65
+ * `readText` vs `streamText` from `size` without probing by failure. `version`
66
+ * is the freshness token. `undefined` from `stat` means the target is absent.
67
+ */
68
+ interface FsInfo {
69
+ /** Opaque freshness token of the target right now. */
70
+ version: FsVersion
71
+ /** Whether the target is a regular file, a directory, or something else. */
72
+ type: 'file' | 'directory' | 'other'
73
+ /** Byte size of a regular file, when the backend can report it. */
74
+ size?: number
75
+ }
76
+ ```
77
+
78
+ `lstat` is the path-level no-follow metadata primitive. It takes a path instead of an `FsTarget` because `resolve` intentionally follows symlinks to produce stable identity; consumers that need trust-boundary checks can call `lstat` first and reject `symlink` before resolving.
79
+
80
+ ```ts type-equiv
81
+ /**
82
+ * Metadata about a path without following the final path component when it is a
83
+ * symbolic link. Unlike {@link FsInfo}, this path-level probe can report
84
+ * `symlink` so consumers with trust-boundary rules can reject repository-owned
85
+ * links before resolving a target.
86
+ */
87
+ interface FsPathInfo {
88
+ /** Opaque freshness token of the path entry right now. */
89
+ version: FsVersion
90
+ /** Whether the path entry is a regular file, directory, symlink, or other. */
91
+ type: 'file' | 'directory' | 'symlink' | 'other'
92
+ /** Byte size of the path entry, when the backend can report it. */
93
+ size?: number
94
+ }
95
+ ```
96
+
97
+ `listDir` returns direct child entries in stable name order. Each entry carries the child basename, type, resolved target, and cheap metadata when the backend can report it. It must not read file contents, so `size` is only for regular files and `version` is metadata-derived. Broken or disappeared children may be returned as `other` without metadata; permission or backend I/O failures while listing or resolving child metadata fail the whole listing with `FS_PERMISSION_DENIED` or `FS_IO_ERROR`.
98
+
99
+ ```ts type-equiv
100
+ /**
101
+ * One direct child returned by {@link FileSystem.listDir}. Listing returns
102
+ * metadata and resolved targets only; it must not read file contents.
103
+ */
104
+ interface FsDirEntry {
105
+ /** Basename of the child inside the listed directory. */
106
+ name: string
107
+ /** Whether the child is a regular file, a directory, or something else. */
108
+ type: 'file' | 'directory' | 'other'
109
+ /** Resolved child target for follow-up operations. */
110
+ target: FsTarget
111
+ /** Opaque freshness token when the backend can report metadata cheaply. */
112
+ version?: FsVersion
113
+ /** Byte size of a regular file, when the backend can report it. */
114
+ size?: number
115
+ }
116
+ ```
117
+
118
+ <a id="patch-syntax-records"></a>
119
+ ## Patch syntax records
120
+
121
+ [dsh-fs-patch](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs-patch/README.md) parses complete patch text into serializable operations whose paths are unresolved strings, and `applyHunks` applies hunks to caller-supplied LF-normalized text, returning complete new text or a structured match failure. The package README owns the pinned parsing and matching rules.
122
+
123
+ ```ts type-equiv
124
+ /** One contiguous update. */
125
+ interface PatchHunk {
126
+ /** One-based input line containing the marker or first implicit hunk line. */
127
+ lineNumber: number
128
+ /** Text following `@@ `, used as a search anchor by the text matcher. */
129
+ context?: string
130
+ /** Context and removed lines, without patch prefixes or line endings. */
131
+ oldLines: string[]
132
+ /** Context and added lines, without patch prefixes or line endings. */
133
+ newLines: string[]
134
+ /** Whether `*** End of File` follows this hunk. */
135
+ isEndOfFile: boolean
136
+ }
137
+
138
+ ```
139
+
140
+ ```ts type-equiv
141
+ /** Ordered file operation; a move is an update with a destination path. */
142
+ type PatchOperation =
143
+ | {
144
+ kind: 'add'
145
+ path: string
146
+ lineNumber: number
147
+ /** Added lines joined with LF, including a final LF for every added line. */
148
+ content: string
149
+ }
150
+ | {
151
+ kind: 'delete'
152
+ path: string
153
+ lineNumber: number
154
+ }
155
+ | {
156
+ kind: 'update'
157
+ path: string
158
+ lineNumber: number
159
+ moveTo?: string
160
+ hunks: PatchHunk[]
161
+ }
162
+ ```
163
+
164
+ ```ts type-equiv
165
+ /** The first hunk whose anchor or old lines could not be located in the original text. */
166
+ interface HunkApplyFailure {
167
+ /** One-based line of the failing hunk in the patch input. */
168
+ hunkLineNumber: number
169
+ /** The failed anchor or old-content search. */
170
+ stage: 'context' | 'oldLines'
171
+ /** Zero-based sequential search cursor; EOF searches override it with the tail candidate. */
172
+ searchStart: number
173
+ /** Original anchor or old lines, including any trailing empty line retried without its sentinel. */
174
+ pattern: string[]
175
+ }
176
+
177
+ ```
178
+
179
+ ```ts type-equiv
180
+ /** Complete new text or a match failure; failures contain no partially updated text. */
181
+ type ApplyHunksResult =
182
+ | { ok: true; after: string }
183
+ | { ok: false; failure: HunkApplyFailure }
184
+ ```
185
+
186
+ ## Write and edit guards (provider contract)
187
+
188
+ The same optional guard rules cover patches, deletion, and moves. Providers perform no observation recording; callers dispatch intents and record completed outcomes.
189
+
190
+ | Operation | Intent | Success observation |
191
+ |---|---|---|
192
+ | `patchText` | `fs/edit-intent` | Target present at the returned version. |
193
+ | `deleteFile` | `fs/delete-intent` | Source absent. |
194
+ | `moveFile` source | `fs/edit-intent` | Source absent only when `sourceDeleted` is true. |
195
+ | `moveFile` destination | `fs/write-intent` | Destination present at `destination.version`. |
196
+
197
+ Patch, delete, and move sources must be regular files; missing or stale sources report `FS_STALE_VERSION`. Patch matching runs on LF-normalized text inside the mutation lock, and a mismatch reports `FS_PATCH_MISMATCH` with the patch hunk line and stage. Moves reject identical target keys with `FS_SAME_TARGET`, use write guards for their destination, and preserve source line endings and mode. Deletion, move-source, and overwritten-destination bases are bounded nullable LF text. A move is two effects: the destination may be published while source removal fails. Cancellation is checked before local destination staging; after that, the provider completes both effects and reports their outcome.
198
+
199
+ Targets already follow symlinks, so a caller that rejects symlink sources inspects the path with `lstat` before `resolve`.
200
+
201
+ ```ts type-equiv
202
+ /** Outcome of a guarded delete; the bounded basis follows FsWriteOutcome.before. */
203
+ interface FsDeleteOutcome {
204
+ /** LF-normalized removed content, or null for an unavailable, binary, or over-limit basis. */
205
+ before: string | null
206
+ }
207
+ ```
208
+
209
+ ```ts type-equiv
210
+ /** Serializable failure after a move has published its destination but retained its source. */
211
+ interface FsMoveSourceFailure {
212
+ /** Filesystem failure code for source removal. */
213
+ code: FsErrorCode
214
+ /** Diagnostic identifying the source and the failed removal. */
215
+ message: string
216
+ }
217
+ ```
218
+
219
+ ```ts type-equiv
220
+ /** Published destination and removal status; sourceBefore is the bounded LF source basis captured under the move lock. */
221
+ type FsMoveOutcome =
222
+ | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: true }
223
+ | { sourceBefore: string | null; destination: FsWriteOutcome; sourceDeleted: false; sourceFailure: FsMoveSourceFailure }
224
+ ```
225
+
226
+ Both `writeText` and `editText` take their version guard OPTIONALLY: omit it for an unconditional (bare-provider) mutation, supply it to guard. `writeText`'s guard is an `FsWriteIntent` — `createIfAbsent` creates a missing target and rejects an existing one with `FS_NOT_OBSERVED`, including a target that appears after the provider's initial probe because publication itself must be no-replace; `replaceIfVersion` replaces only when the target exists at the observed version, else `FS_STALE_VERSION`. Omitting `expected` unconditionally creates-or-overwrites. The union itself carries only the two guarded intents; "no guard" is expressed by omission, so write and edit both use the same optional `expected` field.
227
+
228
+ ```ts type-equiv
229
+ /**
230
+ * Guarded write intent. `createIfAbsent` rejects an existing target with
231
+ * `FS_NOT_OBSERVED`; `replaceIfVersion` rejects absence or mismatch with
232
+ * `FS_STALE_VERSION`. Omitting the intent from `writeText` means unconditional
233
+ * create-or-overwrite, not a third union arm.
234
+ */
235
+ type FsWriteIntent =
236
+ | { kind: 'createIfAbsent' }
237
+ | { kind: 'replaceIfVersion'; version: FsVersion }
238
+ ```
239
+
240
+ ```ts type-equiv
241
+ /** Outcome of a full-file write. */
242
+ interface FsWriteOutcome {
243
+ /** Whether the write created a new file or replaced an existing one. */
244
+ operation: 'create' | 'update'
245
+ /** Opaque version of the file after the write. */
246
+ version: FsVersion
247
+ /**
248
+ * The file's content BEFORE the write, or `null` when the file did not exist
249
+ * (a create) or the backend declined a contextual basis (for example, a
250
+ * binary/non-UTF-8 prior file or either overwrite side reaching its exclusive limit).
251
+ * LF-normalized storage text (the diff basis), never a diff — a consumer
252
+ * computes the result-time contextual diff from `before`/`after` when
253
+ * `before` is present, else falls back to a whole-file diff.
254
+ */
255
+ before: string | null
256
+ /** The file's content AFTER the write, LF-normalized to share `before`'s diff basis. */
257
+ after: string
258
+ }
259
+ ```
260
+
261
+ `editText` is a provider-level mutation, not a `read` plus `write` composed elsewhere. When guarded it verifies the expected version BEFORE literal matching (so a stale edit reports `FS_STALE_VERSION`, not a match failure against newer content); unguarded it edits the current content. Either way it applies the replacement and writes atomically — keeping matching, line-ending handling, the stale check, and atomic replacement inside one mutation critical section — and a missing target reports `FS_STALE_VERSION` on both paths.
262
+
263
+ ```ts type-equiv
264
+ /** A literal-replacement edit request. */
265
+ interface FsEditRequest {
266
+ /** Literal non-empty text to replace. Must match exactly (after line-ending normalization). */
267
+ oldString: string
268
+ /** Literal replacement text. An empty string deletes the matched text. */
269
+ newString: string
270
+ /** Replace every match instead of requiring exactly one. */
271
+ replaceAll: boolean
272
+ }
273
+ ```
274
+
275
+ ```ts type-equiv
276
+ /** Outcome of a literal edit. */
277
+ interface FsEditOutcome {
278
+ /** Opaque version of the file after the edit. */
279
+ version: FsVersion
280
+ /**
281
+ * The file's content BEFORE the edit. Raw storage text (LF-normalized by the
282
+ * backend), never a diff — a consumer computes the result-time contextual diff
283
+ * (the applied hunk with context) from `before`/`after`.
284
+ */
285
+ before: string
286
+ /** The file's content AFTER the edit. */
287
+ after: string
288
+ }
289
+ ```
290
+
291
+ ## The fs policy events (provider contract vocabulary)
292
+
293
+ `dsh-fs` owns four events for mutation consumers and observation policy. Consumers dispatch intents before operations and record completed effects; they do not depend on the policy plugin. They carry only `dsh-fs` vocabulary plus an opaque `object` actor — no model-facing concepts and no agent/session owner structure.
294
+
295
+ `fs/write-intent`, `fs/edit-intent`, and `fs/delete-intent` are **single-slot decision waterfalls**: the tool dispatches each with a default thunk returning `undefined` (the bare provider), and a listener fully decides without calling `next()`. The slot is first-wins by registration order — the policy plugin owning it is a deployment convention, not an enforced invariant. `fs/observed` is a fire-and-forget recording event carrying an `FsObservation`: present at a version or confirmed absent. It is dispatched with a plain `ctx.emit`; its listener MUST be synchronous and side-effect-only, because the tool does NOT guard the emit — a throwing listener can replace a read error or surface as the tool's `isError` result after a mutation already succeeded. The generated [cordis surface](#cordis-surface) below shows the exact signatures.
296
+
297
+ ```ts type-equiv
298
+ /**
299
+ * One authoritative observation of a target. A present observation carries the
300
+ * version used by guarded replacement; an absent observation authorizes only a
301
+ * guarded create, never an edit.
302
+ */
303
+ type FsObservation =
304
+ | { readonly kind: 'present'; readonly version: FsVersion }
305
+ | { readonly kind: 'absent' }
306
+ ```
307
+
308
+ ## Execution context (policy plugin)
309
+
310
+ The policy plugin needs just enough execution context to derive the observed-state owner by narrowing the opaque `object` actor the `fs/*` events carry. `ToolExecution` has the required fields, so `dsh-tool-fs` passes its execution object through as the actor without making `dsh-fs-observation-policy` import the tool, agent, or session packages.
311
+
312
+ ```ts type-equiv
313
+ /**
314
+ * Minimal structural view of a tool execution the policy plugin needs to derive
315
+ * an observed-state owner. `@deepseek-ai/dsh-tools`' `ToolExecution` contains
316
+ * these fields, so the tool passes its `exec` straight through as the opaque
317
+ * `object` actor on the `fs/*` events; this plugin narrows that actor to
318
+ * `FsObservationActor` without importing `dsh-tools`, `dsh-agent`, or `dsh-session`.
319
+ *
320
+ * The owner is `agent.session` when present. It is treated as an opaque object
321
+ * identity (a `WeakMap` key); this package never reads any of its fields.
322
+ */
323
+ interface FsObservationActor {
324
+ /** The agent on whose behalf the call runs, when there is one. */
325
+ agent?: {
326
+ /** The session that owns observed-file state, used as an opaque key. */
327
+ session?: object
328
+ }
329
+ }
330
+ ```
331
+
332
+ ## Read outcome (consumer / read rendering)
333
+
334
+ A text read is bounded by line window, byte cap, and backend limits. After the byte cap is reached, scanning continues without retaining more lines so `totalLines` remains exact. The result the model-facing `read` tool renders is purely presentational; there is no `full`/`partial` view — authorization is freshness-based (the tool emits a present `fs/observed` directly with the stat's version), so any windowed read can authorize a later write/edit when the file is unchanged. A metadata miss emits an absent observation before the tool returns `FS_NOT_FOUND`, allowing a later guarded write to recreate an externally deleted target without authorizing edit. `dsh-tool-fs`, the executor that owns the read, implements read windowing and constructs this result; the policy plugin does not.
335
+
336
+ ```ts type-equiv
337
+ /** Outcome of a bounded text read — what {@link formatReadOutput} renders. */
338
+ interface FileReadOutcome {
339
+ /** 1-based first line requested. */
340
+ offset: number
341
+ /** Returned lines, already numbered. */
342
+ lines: FileTextLine[]
343
+ /** Exact total line count in the file. */
344
+ totalLines: number
345
+ /** Whether selected output hit the byte cap. */
346
+ truncatedByBytes?: true
347
+ }
348
+ ```
349
+
350
+ ## Observed-file state (policy plugin)
351
+
352
+ Observed state is a `WeakMap<owner, Map<targetKey, FsObservation>>` held inside the `dsh-fs-observation-policy` plugin. Missing map entry means unseen; `{ kind: 'absent' }` means a `read` or `str_replace_editor` `view`, `str_replace`, or `insert` metadata miss confirmed absence; `{ kind: 'present', version }` means a read, write, or edit observed that version. The write decision maps unseen and absent to `createIfAbsent`, while present maps to `replaceIfVersion`; the edit/delete decision maps unseen to `FS_NOT_OBSERVED`, absent to `FS_NOT_FOUND`, and present to its version guard. The owner is derived from the event actor (normally `exec.agent.session`), treated as opaque and never read. Disposal drops everything (HMR safety), and the policy performs no filesystem I/O.
353
+
354
+ ## Patch execution (consumer)
355
+
356
+ The internal [tool-fs patch executor](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/tool-fs/README.md#understand-the-implementation) dispatches intent decisions in preflight without emitting observations, simulates preceding operations, and reacquires guards for each commit. Sandbox containment stays with the provider at commit, as for `write` and `edit`. Provider results determine which effects are recorded; executor details and failure guarantees belong to the package README.
357
+
358
+ | Operation | Preflight intent on first target use | Commit intent | Successful observation |
359
+ |---|---|---|---|
360
+ | add | `fs/write-intent` | `fs/write-intent` | target present(version) |
361
+ | update | `fs/edit-intent` | `fs/edit-intent` | target present(version) |
362
+ | delete | `fs/delete-intent` | `fs/delete-intent` | target absent |
363
+ | move | source `fs/edit-intent`; destination `fs/write-intent` | same two intents, freshly dispatched | destination present(version); source absent only when removed |
364
+
365
+ The `apply_patch` tool returns strict commit values with per-operation diagnostics and full-text change inputs for rendering; persisted metadata holds diff hunks from the provider's bounded bases and a stopped flag. Syntax and preflight refusals set `isError: true`; commit reports retain `isError: false` even when stopped so known partial diffs reach Session presentation, except that a cancelled call receives the tool registry's abort result like every other tool. The [tool README](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/tool-fs/README.md#use-this-package) owns formatting and recovery.
366
+
367
+ ## Error taxonomy (provider contract)
368
+
369
+ Filesystem failures use stable `FsErrorCode` strings carried by `FsError` (`HarnessError`). The tool registry preserves `{ name, code }` on error results, so retry, permission, and UI layers can branch without parsing text.
370
+
371
+ `FS_PATCH_MISMATCH` means a hunk failed inside the provider commit; its message names the patch line and failed search stage. `FS_SAME_TARGET` means a move source and destination share the resolved identity. Delete intent follows edit intent: unseen is `FS_NOT_OBSERVED`, observed absence is `FS_NOT_FOUND`, and present state supplies a version. Provider-side missing patch/delete/move sources use `FS_STALE_VERSION` even without a guard.
372
+
373
+ ```ts
374
+ import { FS_ERROR_CODES } from '@deepseek-ai/dsh-fs'
375
+ ```
376
+
377
+ ```ts type-equiv
378
+ /** One machine-routable filesystem failure code from FS_ERROR_CODES. */
379
+ type FsErrorCode = typeof FS_ERROR_CODES[number]
380
+ ```
381
+
382
+ `FS_NOT_DIRECTORY`, `FS_PERMISSION_DENIED`, and `FS_IO_ERROR` are used by directory listing to distinguish an existing non-directory target, a denied listing, and an unexpected backend I/O failure. `FS_SANDBOX_DENIED` is a POLICY refusal from a sandbox-enforcing backend (`dsh-fs-sandbox`) — the mode fence denied a mutation — distinct from `FS_PERMISSION_DENIED` (the host kernel refusing). `FS_NOT_OBSERVED` means the policy plugin has no prior-observation record for this owner (or a `createIfAbsent` hit an existing file). `FS_NOT_FOUND` also represents an edit rejected from confirmed absence. `FS_STALE_VERSION` means the backend version no longer matches the observed one (or the provider itself receives an edit for a missing target). Freshness authorization has no partial/full distinction, so there is no `FS_PARTIAL_OBSERVATION`. `FS_ALREADY_EXISTS` means a create-only tool command found an existing target; the caller chooses another path or edits the existing file. `dsh-fs-local` and the `dsh-fs-sandbox` containment check classify errno failures from resolution, metadata, reads, and listing with the `dsh-fs` function `fsErrorFromErrno`: `ENOENT` and `ENOTDIR` report `FS_NOT_FOUND`, `EACCES` and `EPERM` report `FS_PERMISSION_DENIED`, `EISDIR` reports `FS_NOT_REGULAR_FILE`, and other errno values report `FS_IO_ERROR`, each with the Node error as `cause`.
383
+
384
+ ## No timeouts on file IO
385
+
386
+ `read`/`write`/`edit` take **no** `timeoutMs`, and the provider contract arms no deadline — unlike bash and web (which consume [`@deepseek-ai/dsh-timeout`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/util/timeout/README.md)) and the subprocess-backed `glob`/`grep` (whose declared `timeoutMs` is enforced by `@deepseek-ai/dsh-tool-call-timeout-policy`): those are process-backed, where a deadline can really kill the work. A local syscall is best-effort-abortable at most — a timeout could not force an in-progress `fsync`/`rename` to stop, so a `timeoutMs` here would be a deadline the seam cannot enforce, and an implicit default in the exact place explicit-over-implicit forbids. Cancellation still propagates through the tool-execution signal for best-effort abort at syscall boundaries.
387
+
388
+ ## The service and the plugin
389
+
390
+ `FileSystem` (`ctx.fs`, abstract) owns the provider primitives: `resolve`, `processPath`, `processPathFromHostPath`, `fileUrl`, `contains`, `stat`, `lstat`, `readText`, `streamText`, `readBytes`, `listDir`, `writeText`, `editText`, `patchText`, `deleteFile`, and `moveFile`. `dsh-fs-observation-policy` registers **no service** — it is a plugin that adds policy through the `fs/*` event gate: it decides the write/edit/delete intent waterfalls from unseen/absent/present state and records `FsObservation` values. The executor is `dsh-tool-fs`: it reads/writes/edits through `ctx.fs`, dispatches the waterfalls, and emits the recording event. The generated [`ctx.fs` section](#ctxfs--filesystem-abstract-seam) below shows the exact signatures.
391
+
392
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
393
+
394
+ <a id="cordis-surface"></a>
395
+
396
+ ## Cordis API
397
+
398
+ 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).
399
+
400
+ <a id="ctxfs--filesystem-abstract-seam"></a>
401
+
402
+ ### `ctx.fs` — `FileSystem` (abstract seam)
403
+
404
+ Abstract filesystem provider. Targets must preserve identity across aliases; reads expose regular UTF-8 text or typed errors, listings are stable and content-free, and single-file publication is atomic. Moves can retain their source after publishing the destination. Optional guards add stale protection without changing the unguarded provider contract.
405
+
406
+ ```ts cordis-catalog
407
+ /**
408
+ * Observe one file or a directory's direct entries in this provider's execution world.
409
+ * @param target - resolved file or directory, including an absent path to observe for creation.
410
+ * @param changed - invalidation callback; errors can be reported during or after initialization.
411
+ * @param signal - cancels watcher initialization; the caller closes an initialized watcher.
412
+ * @returns a promise resolving once observation is active, with an asynchronous close function.
413
+ * @throws when the provider does not support watching or cannot initialize the watcher.
414
+ */
415
+ watch(target: FsTarget, changed: (error?: Error) => void, signal: AbortSignal): Promise<() => Promise<void>>
416
+
417
+ /**
418
+ * Resolve a model/plugin-supplied path into a stable {@link FsTarget}. May perform I/O (a
419
+ * remote/sandboxed backend may need a round-trip to map a path to a stable identity), hence
420
+ * async even though the local backend only normalizes + realpaths.
421
+ *
422
+ * @param path - the path to resolve; relative paths resolve against `opts.cwd`.
423
+ * @param opts - optional cwd override and cancellation signal.
424
+ * @returns the stable target; the same file yields the same `targetKey`.
425
+ */
426
+ abstract resolve(path: string, opts?: { cwd?: string; signal?: AbortSignal }): Promise<FsTarget>
427
+
428
+ /**
429
+ * Return the canonical absolute path a subprocess in this filesystem's
430
+ * execution world can open. The path is deliberately separate from
431
+ * {@link FsTarget.targetKey}: consumers may pass this value to another OS
432
+ * capability, but must continue treating the target key as opaque.
433
+ * @param target - the resolved target whose process path is required.
434
+ * @returns an absolute path in the backend's execution world.
435
+ */
436
+ abstract processPath(target: FsTarget): string
437
+
438
+ /**
439
+ * Map an absolute path from the harness host into this filesystem's
440
+ * execution world when both paths identify the same file. The base provider
441
+ * exposes no mapping; host-backed or explicitly shared backends override it.
442
+ * @param hostPath - absolute path in the harness host filesystem.
443
+ * @returns the process path for the same file, or undefined when this
444
+ * execution world cannot read that host file.
445
+ */
446
+ processPathFromHostPath(hostPath: string): string | undefined
447
+
448
+ /**
449
+ * Return the canonical `file:` URI for a target in this filesystem's
450
+ * execution world. Backends own URI encoding because the host platform may
451
+ * differ from the execution platform.
452
+ * @param target - the resolved target to encode.
453
+ * @returns the target's canonical file URI.
454
+ */
455
+ abstract fileUrl(target: FsTarget): string
456
+
457
+ /**
458
+ * Test canonical containment without exposing or parsing backend target
459
+ * keys. Both targets must come from this provider.
460
+ * @param parent - canonical directory target.
461
+ * @param child - canonical candidate target.
462
+ * @returns true when `child` is `parent` or a descendant of it.
463
+ */
464
+ abstract contains(parent: FsTarget, child: FsTarget): boolean
465
+
466
+ /**
467
+ * Return target metadata, or `undefined` when the target does not exist.
468
+ * @param target - the resolved target to stat.
469
+ * @param signal - aborts the metadata round-trip.
470
+ * @returns metadata only, never content; undefined for an absent target.
471
+ */
472
+ abstract stat(target: FsTarget, signal?: AbortSignal): Promise<FsInfo | undefined>
473
+
474
+ /**
475
+ * Return path metadata without following the final path component when it is a
476
+ * symbolic link. This is intentionally path-shaped, not target-shaped:
477
+ * {@link resolve} follows symlinks to produce the stable identity used by
478
+ * normal reads/writes, while `lstat` lets a consumer reject the path itself
479
+ * before that follow happens.
480
+ *
481
+ * `opts.cwd` follows {@link resolve}'s cwd rules. `undefined` means the path is
482
+ * absent.
483
+ * @param path - the path to inspect; relative paths resolve against `opts.cwd`.
484
+ * @param opts - `cwd` overrides the backend's default base for relative paths.
485
+ * @param signal - aborts the metadata round-trip.
486
+ * @returns metadata only, never content; undefined for an absent path.
487
+ */
488
+ abstract lstat(path: string, opts?: { cwd?: string }, signal?: AbortSignal): Promise<FsPathInfo | undefined>
489
+
490
+ /**
491
+ * Read the whole regular text file as a single decoded string.
492
+ * @param target - the resolved target to read.
493
+ * @param signal - aborts the read.
494
+ * @returns the full decoded UTF-8 content.
495
+ */
496
+ abstract readText(target: FsTarget, signal?: AbortSignal): Promise<string>
497
+
498
+ /**
499
+ * Stream the whole regular text file as decoded text chunks (same text
500
+ * semantics as {@link readText}, for large files). The backend owns
501
+ * cross-chunk UTF-8 decoding and binary rejection so the policy layer never
502
+ * touches raw bytes.
503
+ * @param target - the resolved target to read.
504
+ * @param signal - aborts the stream, including between chunks.
505
+ * @returns the chunk iterable, decoded and validated like {@link readText}.
506
+ */
507
+ abstract streamText(target: FsTarget, signal?: AbortSignal): Promise<AsyncIterable<string>>
508
+
509
+ /**
510
+ * Read the whole regular file as raw bytes with no decoding or binary
511
+ * rejection. The bound lives at this seam so a backend can never buffer an
512
+ * unbounded file: a target known or discovered to exceed `maxBytes` fails
513
+ * with `FS_TOO_LARGE` instead of returning a truncated result.
514
+ * @param target - the resolved target to read.
515
+ * @param signal - aborts the read.
516
+ * @param maxBytes - inclusive byte cap on the complete content.
517
+ * @returns the full raw content, at most `maxBytes` long.
518
+ */
519
+ abstract readBytes(target: FsTarget, signal: AbortSignal | undefined, maxBytes: number): Promise<Uint8Array>
520
+
521
+ /**
522
+ * Read one byte window of the regular file as raw bytes with no decoding or
523
+ * binary rejection: the bytes at `[offset, offset + length)`, shorter when
524
+ * the file ends inside the window and empty when `offset` lies at or past
525
+ * its end. The window is the bound here, not the file: a backend transfers
526
+ * at most `length` bytes of content beyond the prefix it skips to reach
527
+ * `offset` and never buffers the whole file, so the caller's cap on `length`
528
+ * is the guard against unbounded buffering.
529
+ * @param target - the resolved target to read.
530
+ * @param range - `offset`, the 0-based first byte, and `length`, the largest byte count; both non-negative integers.
531
+ * @param signal - aborts the read.
532
+ * @returns the window's bytes, at most `length` long.
533
+ */
534
+ abstract readByteRange(target: FsTarget, range: { offset: number; length: number }, signal?: AbortSignal): Promise<Uint8Array>
535
+
536
+ /**
537
+ * List direct children of a directory in stable name order. Returns resolved
538
+ * child targets plus cheap metadata only; never reads file contents.
539
+ * @param target - the resolved directory target.
540
+ * @param signal - aborts the listing.
541
+ * @returns one entry per direct child, in stable name order.
542
+ */
543
+ abstract listDir(target: FsTarget, signal?: AbortSignal): Promise<FsDirEntry[]>
544
+
545
+ /**
546
+ * Atomically create or replace UTF-8 text. `expected` guards intent and
547
+ * staleness; omission allows unconditional overwrite.
548
+ * @param target - the resolved target to write.
549
+ * @param content - the full new file content.
550
+ * @param expected - the write intent guarding the write; omit for unconditional.
551
+ * @param signal - aborts before atomic publication takes effect.
552
+ * @param sandboxPolicy - the per-call mode and workspace root this write
553
+ * runs under; a sandboxing backend fences the write by it, the bare backend
554
+ * ignores it. Omit to leave the backend its own default.
555
+ * @returns the outcome, including the version the write produced.
556
+ */
557
+ abstract writeText( target: FsTarget, content: string, expected?: FsWriteIntent, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsWriteOutcome>
558
+
559
+ /**
560
+ * Atomically edit literal text. When supplied, the version guard is checked
561
+ * before matching so stale content reports `FS_STALE_VERSION`; omission edits
562
+ * the current content without a freshness precondition.
563
+ * @param target - the resolved target to edit.
564
+ * @param edit - the literal search/replace request.
565
+ * @param expected - the version guard; omit for an unconditional edit.
566
+ * @param signal - aborts before atomic publication takes effect.
567
+ * @param sandboxPolicy - the per-call mode and workspace root this edit runs
568
+ * under; a sandboxing backend fences the edit by it, the bare backend
569
+ * ignores it. Omit to leave the backend its own default.
570
+ * @returns the outcome, including the version the edit produced.
571
+ */
572
+ abstract editText( target: FsTarget, edit: FsEditRequest, expected?: { version: FsVersion }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsEditOutcome>
573
+
574
+ /**
575
+ * Atomically apply parsed hunks to the LF-normalized text and restore the
576
+ * stored line-ending style. A missing or stale target reports
577
+ * `FS_STALE_VERSION`; an unmatched hunk reports `FS_PATCH_MISMATCH`.
578
+ * @param target - the resolved regular file to patch.
579
+ * @param hunks - ordered hunks from `parsePatch`.
580
+ * @param expected - the version guard; omit for an unconditional patch.
581
+ * @param signal - aborts before atomic publication takes effect.
582
+ * @param sandboxPolicy - the per-call mode and workspace root this patch runs
583
+ * under; a sandboxing backend fences the patch by it, the bare backend
584
+ * ignores it. Omit to leave the backend its own default.
585
+ * @returns the outcome, including the version the patch produced.
586
+ */
587
+ abstract patchText( target: FsTarget, hunks: readonly PatchHunk[], expected?: { version: FsVersion }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsEditOutcome>
588
+
589
+ /**
590
+ * Remove a regular file. A missing or stale target reports `FS_STALE_VERSION`;
591
+ * a directory or other non-file reports `FS_NOT_REGULAR_FILE`. Resolution has
592
+ * already followed symlinks, so the target is the real file.
593
+ * @param target - the resolved file to remove.
594
+ * @param expected - the version guard; omit for an unconditional removal.
595
+ * @param signal - aborts before removal.
596
+ * @param sandboxPolicy - the per-call mode and workspace root this removal
597
+ * runs under; a sandboxing backend fences it, the bare backend ignores it.
598
+ * Omit to leave the backend its own default.
599
+ * @returns the bounded LF-normalized removed text, or null when no basis is available.
600
+ */
601
+ abstract deleteFile( target: FsTarget, expected?: { version: FsVersion }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsDeleteOutcome>
602
+
603
+ /**
604
+ * Publish the source text, optionally patched, at the destination, then remove
605
+ * the source. Both targets stay locked in canonical order. Identical targets
606
+ * report `FS_SAME_TARGET`; the source guard follows `patchText` and the
607
+ * destination guard follows `writeText`. The two effects are separate: a
608
+ * published destination with a retained source is a final outcome reported
609
+ * through `sourceDeleted: false`.
610
+ * @param source - the resolved regular source; its line-ending style and mode carry over.
611
+ * @param destination - the resolved destination within the same provider.
612
+ * @param options - optional hunks and the source/destination guards; an omitted guard is unconditional.
613
+ * @param signal - checked before destination staging; the commit then completes both effects.
614
+ * @param sandboxPolicy - the per-call mode and workspace root both paths run
615
+ * under; a sandboxing backend fences them, the bare backend ignores it.
616
+ * Omit to leave the backend its own default.
617
+ * @returns the bounded LF source basis, the destination outcome, and the source-removal status.
618
+ */
619
+ abstract moveFile( source: FsTarget, destination: FsTarget, options: { hunks?: readonly PatchHunk[] expectedSource?: { version: FsVersion } expectedDestination?: FsWriteIntent }, signal?: AbortSignal, sandboxPolicy?: SandboxExecutionPolicy, ): Promise<FsMoveOutcome>
620
+ ```
621
+
622
+ Types: [SandboxExecutionPolicy](./sandbox.md)
623
+
624
+ Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
625
+
626
+ <a id="fs-events"></a>
627
+
628
+ ### `fs/*` events
629
+
630
+ <a id="fsdelete-intent--waterfall"></a>
631
+
632
+ #### `fs/delete-intent` — waterfall
633
+
634
+ Single-slot decision for FileSystem.deleteFile; the first returned guard wins. Calling next() delegates to an unconditional deletion.
635
+
636
+ ```ts cordis-catalog
637
+ /**
638
+ * Single-slot decision for FileSystem.deleteFile; the first returned guard wins.
639
+ * Calling next() delegates to an unconditional deletion.
640
+ * @param target - the resolved source about to be removed.
641
+ * @param actor - the opaque tool-execution context used to select observed state.
642
+ * @mode waterfall
643
+ */
644
+ 'fs/delete-intent'(target: FsTarget, actor: object | undefined, next: () => { version: FsVersion } | undefined | Promise<{ version: FsVersion } | undefined>): Promise<{ version: FsVersion } | undefined>
645
+ ```
646
+
647
+ Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
648
+
649
+ <a id="fsedit-intent--waterfall"></a>
650
+
651
+ #### `fs/edit-intent` — waterfall
652
+
653
+ Single-slot decision for the next FileSystem.editText. Calling `next()` yields an unconditional edit; the first returned guard wins.
654
+
655
+ ```ts cordis-catalog
656
+ /**
657
+ * Single-slot decision for the next {@link FileSystem.editText}. Calling
658
+ * `next()` yields an unconditional edit; the first returned guard wins.
659
+ * @param target - the resolved target about to be edited.
660
+ * @param actor - the opaque tool-execution context the decider keys off.
661
+ * @mode waterfall
662
+ */
663
+ 'fs/edit-intent'(target: FsTarget, actor: object | undefined, next: () => { version: FsVersion } | undefined | Promise<{ version: FsVersion } | undefined>): Promise<{ version: FsVersion } | undefined>
664
+ ```
665
+
666
+ Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
667
+
668
+ <a id="fsobserved--emit"></a>
669
+
670
+ #### `fs/observed` — emit
671
+
672
+ Record an authoritative positive or negative observation. Listeners must be synchronous recorders: throws fail the tool call and returned promises are not awaited.
673
+
674
+ ```ts cordis-catalog
675
+ /**
676
+ * Record an authoritative positive or negative observation. Listeners must
677
+ * be synchronous recorders: throws fail the tool call and returned promises
678
+ * are not awaited.
679
+ * @param target - the target whose presence or absence was observed.
680
+ * @param observation - present with its version, or confirmed absent.
681
+ * @param actor - the observing tool-execution context; undefined records nothing useful.
682
+ * @mode emit
683
+ */
684
+ 'fs/observed'(target: FsTarget, observation: FsObservation, actor: object | undefined): void
685
+ ```
686
+
687
+ Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
688
+
689
+ <a id="fswrite-intent--waterfall"></a>
690
+
691
+ #### `fs/write-intent` — waterfall
692
+
693
+ Single-slot decision for the next FileSystem.writeText. Calling `next()` yields the bare provider's unconditional write; the first listener that returns an intent owns the decision rather than composing with peers.
694
+
695
+ ```ts cordis-catalog
696
+ /**
697
+ * Single-slot decision for the next {@link FileSystem.writeText}. Calling
698
+ * `next()` yields the bare provider's unconditional write; the first listener
699
+ * that returns an intent owns the decision rather than composing with peers.
700
+ * @param target - the resolved target about to be written.
701
+ * @param actor - the opaque tool-execution context the decider keys off.
702
+ * @mode waterfall
703
+ */
704
+ 'fs/write-intent'(target: FsTarget, actor: object | undefined, next: () => FsWriteIntent | undefined | Promise<FsWriteIntent | undefined>): Promise<FsWriteIntent | undefined>
705
+ ```
706
+
707
+ Source: [`packages/fs/fs/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/fs/fs/src/index.ts)
708
+ <!-- END GENERATED cordis-surface -->