better-dsh 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/cordis.patch.yml +1 -1
  2. package/docs/50_test-reports/2026-09-06-write/345/267/245/345/205/267sandbox/345/215/207/347/272/247/351/200/217/344/274/240bug/345/244/215/345/217/221/345/217/212/346/214/202/350/265/267-/344/272/213/344/273/266/346/212/245/345/221/212.md +176 -0
  3. package/docs/50_test-reports/2026-09-08-hashline-edit-E_RANGE_UNVERIFIED/350/267/250/350/275/256/344/274/232/350/257/235/351/224/256/345/244/261/346/225/210-/350/257/212/346/226/255/346/212/245/345/221/212.md +226 -0
  4. package/docs/50_test-reports/2026-09-11-control-prompt-into-eval-description/345/256/236/346/265/213/346/212/245/345/221/212.md +222 -0
  5. package/docs/50_test-reports/2026-09-12-fs-scheme-resolution-/345/256/236/346/265/213/346/212/245/345/221/212.md +81 -0
  6. package/docs/50_test-reports/2026-09-12-url-schemes-grammar-matrix/344/270/216catalog-centralize-/345/256/236/346/265/213/346/212/245/345/221/212.md +234 -0
  7. package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-design/351/252/214/350/257/201/346/212/245/345/221/212.md +160 -0
  8. package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-/345/256/236/346/265/213/345/211/247/346/234/254.md +44 -0
  9. package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-/345/256/236/346/265/213/346/212/245/345/221/212.md +89 -0
  10. package/docs/50_test-reports/2026-09-12-url-schemes-/345/205/255scheme/345/206/222/347/203/237/344/270/216/350/276/271/347/225/214/345/256/236/346/265/213/346/212/245/345/221/212.md +198 -0
  11. package/docs/50_test-reports/2026-09-13-hashline-off/344/270/213scheme/345/217/257/350/276/276/346/200/247/345/267/245/345/205/267/351/235/242/344/270/215/345/257/271/347/247/260-/345/256/236/346/265/213/346/212/245/345/221/212.md +246 -0
  12. package/docs/50_test-reports/2026-09-13-preact-ui-shell/345/256/236/346/265/213/346/212/245/345/221/212.md +50 -0
  13. package/docs/50_test-reports/2026-09-14-4999-skill/346/270/205/345/215/225/344/270/216lsp-gate/345/256/236/346/265/213/346/212/245/345/221/212.md +63 -0
  14. package/docs/50_test-reports/upstream-dsh-0.1.3-alpha.2-local-test-report.md +44 -0
  15. package/docs/50_test-reports/upstream-dsh-0.1.3-alpha.2-report.md +110 -0
  16. package/docs/50_test-reports/upstream-dsh-0.1.5-rc.2-local-test-report.md +79 -0
  17. package/docs/50_test-reports/v0.2.3b-hashline-content-locator/345/256/236/346/265/213/346/212/245/345/221/212.md +73 -0
  18. package/docs/50_test-reports/v0.2.3c-mobile-wave/345/256/236/346/265/213/346/212/245/345/221/212.md +47 -0
  19. package/docs/50_test-reports/v0.2.4-ios-focus-zoom-suppression/345/256/236/346/265/213/346/212/245/345/221/212.md +158 -0
  20. package/docs/specs/agent/spec.md +54 -0
  21. package/docs/specs/ast/spec.md +34 -0
  22. package/docs/specs/compaction-recall/spec.md +46 -0
  23. package/docs/specs/ctx/spec.md +107 -0
  24. package/docs/specs/dsh/spec.md +47 -0
  25. package/docs/specs/dvc/spec.md +87 -0
  26. package/docs/specs/escalation-guidance/spec.md +44 -0
  27. package/docs/specs/fs-scheme-resolution/spec.md +37 -0
  28. package/docs/specs/hash-edit/spec.md +41 -0
  29. package/docs/specs/http-read/spec.md +73 -0
  30. package/docs/specs/kernel-provisioning/spec.md +53 -0
  31. package/docs/specs/lsp/spec.md +121 -0
  32. package/docs/specs/mobile-layout/spec.md +108 -0
  33. package/docs/specs/model-failover/spec.md +20 -0
  34. package/docs/specs/preact-ui-shell/spec.md +22 -0
  35. package/docs/specs/repl-dispatch-resilience/spec.md +21 -0
  36. package/docs/specs/skill/spec.md +58 -0
  37. package/docs/specs/tool-surface/spec.md +222 -0
  38. package/docs/specs/url-schema/spec.md +148 -0
  39. package/docs/specs/web-trust-fence/spec.md +43 -0
  40. package/docs/upstream-dsh-0.1.5-rc.2-report.md +156 -0
  41. package/dsh-docs/AGENTS.md +75 -0
  42. package/dsh-docs/agent-lifecycle.md +84 -0
  43. package/dsh-docs/agent-lifecycle.zh.md +86 -0
  44. package/dsh-docs/api-gateway.md +164 -0
  45. package/dsh-docs/api-gateway.zh.md +164 -0
  46. package/dsh-docs/architecture.md +150 -0
  47. package/dsh-docs/architecture.zh.md +154 -0
  48. package/dsh-docs/capability-seams.md +543 -0
  49. package/dsh-docs/capability-seams.zh.md +545 -0
  50. package/dsh-docs/config-catalog.md +3473 -0
  51. package/dsh-docs/config-catalog.zh.md +3474 -0
  52. package/dsh-docs/cookbook/adding-a-package.md +117 -0
  53. package/dsh-docs/cookbook/adding-a-package.zh.md +119 -0
  54. package/dsh-docs/cookbook/adding-a-remote-api.md +197 -0
  55. package/dsh-docs/cookbook/adding-a-remote-api.zh.md +197 -0
  56. package/dsh-docs/cookbook/adding-a-session-format-version.md +109 -0
  57. package/dsh-docs/cookbook/adding-a-session-format-version.zh.md +109 -0
  58. package/dsh-docs/cookbook/adding-a-settings-card.md +102 -0
  59. package/dsh-docs/cookbook/adding-a-settings-card.zh.md +102 -0
  60. package/dsh-docs/cookbook/adding-a-tool.md +101 -0
  61. package/dsh-docs/cookbook/adding-a-tool.zh.md +103 -0
  62. package/dsh-docs/cookbook/adding-a-vendored-package.md +59 -0
  63. package/dsh-docs/cookbook/adding-a-vendored-package.zh.md +59 -0
  64. package/dsh-docs/cookbook/adding-an-llm-adapter.md +43 -0
  65. package/dsh-docs/cookbook/adding-an-llm-adapter.zh.md +43 -0
  66. package/dsh-docs/cookbook/extension-cookbook.md +132 -0
  67. package/dsh-docs/cookbook/extension-cookbook.zh.md +136 -0
  68. package/dsh-docs/cookbook/maintaining-dsh-code-review.md +64 -0
  69. package/dsh-docs/cookbook/maintaining-dsh-code-review.zh.md +64 -0
  70. package/dsh-docs/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
  71. package/dsh-docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
  72. package/dsh-docs/cordis-api/context.md +364 -0
  73. package/dsh-docs/cordis-api/context.zh.md +366 -0
  74. package/dsh-docs/cordis-api/events.md +207 -0
  75. package/dsh-docs/cordis-api/events.zh.md +209 -0
  76. package/dsh-docs/cordis-api/fiber.md +375 -0
  77. package/dsh-docs/cordis-api/fiber.zh.md +377 -0
  78. package/dsh-docs/cordis-api/inherited.md +39 -0
  79. package/dsh-docs/cordis-api/registry.md +152 -0
  80. package/dsh-docs/cordis-api/registry.zh.md +154 -0
  81. package/dsh-docs/cordis-api/service.md +102 -0
  82. package/dsh-docs/cordis-api/service.zh.md +104 -0
  83. package/dsh-docs/cordis-primer.md +45 -0
  84. package/dsh-docs/cordis-primer.zh.md +51 -0
  85. package/dsh-docs/cordis-tutorial/01-first-plugin.md +95 -0
  86. package/dsh-docs/cordis-tutorial/01-first-plugin.zh.md +95 -0
  87. package/dsh-docs/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  88. package/dsh-docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
  89. package/dsh-docs/cordis-tutorial/03-services.md +98 -0
  90. package/dsh-docs/cordis-tutorial/03-services.zh.md +98 -0
  91. package/dsh-docs/cordis-tutorial/04-events.md +144 -0
  92. package/dsh-docs/cordis-tutorial/04-events.zh.md +144 -0
  93. package/dsh-docs/cordis-tutorial/05-config.md +84 -0
  94. package/dsh-docs/cordis-tutorial/05-config.zh.md +84 -0
  95. package/dsh-docs/cordis-tutorial/06-composition-and-hmr.md +113 -0
  96. package/dsh-docs/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
  97. package/dsh-docs/cordis-tutorial/07-into-the-harness.md +108 -0
  98. package/dsh-docs/cordis-tutorial/07-into-the-harness.zh.md +108 -0
  99. package/dsh-docs/cordis-tutorial/index.md +60 -0
  100. package/dsh-docs/cordis-tutorial/index.zh.md +62 -0
  101. package/dsh-docs/deepseek-llm-api-wire-extensions.md +163 -0
  102. package/dsh-docs/deepseek-llm-api-wire-extensions.zh.md +163 -0
  103. package/dsh-docs/defensive-patterns.md +33 -0
  104. package/dsh-docs/defensive-patterns.zh.md +35 -0
  105. package/dsh-docs/development.md +167 -0
  106. package/dsh-docs/development.zh.md +173 -0
  107. package/dsh-docs/event-producer-consumer.md +86 -0
  108. package/dsh-docs/event-producer-consumer.zh.md +88 -0
  109. package/dsh-docs/glossary.md +45 -0
  110. package/dsh-docs/glossary.zh.md +45 -0
  111. package/dsh-docs/graph-atlas.md +22 -0
  112. package/dsh-docs/graph-atlas.zh.md +24 -0
  113. package/dsh-docs/i18n/README.md +60 -0
  114. package/dsh-docs/i18n/README.zh.md +62 -0
  115. package/dsh-docs/i18n/style-samples.md +87 -0
  116. package/dsh-docs/i18n/terminology.md +214 -0
  117. package/dsh-docs/i18n/translation-prompt.md +263 -0
  118. package/dsh-docs/i18n/translation-rules.md +69 -0
  119. package/dsh-docs/i18n/translation-rules.zh.md +69 -0
  120. package/dsh-docs/module-graph.md +1411 -0
  121. package/dsh-docs/module-graph.zh.md +1413 -0
  122. package/dsh-docs/persistence-catalog.md +1075 -0
  123. package/dsh-docs/persistence-catalog.zh.md +1077 -0
  124. package/dsh-docs/postmortem/0001-acp-default-export-drops-inject.md +113 -0
  125. package/dsh-docs/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
  126. package/dsh-docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
  127. package/dsh-docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
  128. package/dsh-docs/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
  129. package/dsh-docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
  130. package/dsh-docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
  131. package/dsh-docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
  132. package/dsh-docs/postmortem/README.md +18 -0
  133. package/dsh-docs/postmortem/README.zh.md +18 -0
  134. package/dsh-docs/rescope.md +53 -0
  135. package/dsh-docs/rescope.zh.md +53 -0
  136. package/dsh-docs/session-format-status.md +47 -0
  137. package/dsh-docs/session-format-status.zh.md +47 -0
  138. package/dsh-docs/subsystems/README.md +61 -0
  139. package/dsh-docs/subsystems/README.zh.md +61 -0
  140. package/dsh-docs/subsystems/agent-team.md +207 -0
  141. package/dsh-docs/subsystems/agent-team.zh.md +207 -0
  142. package/dsh-docs/subsystems/approval.md +170 -0
  143. package/dsh-docs/subsystems/approval.zh.md +170 -0
  144. package/dsh-docs/subsystems/attachment.md +351 -0
  145. package/dsh-docs/subsystems/attachment.zh.md +351 -0
  146. package/dsh-docs/subsystems/client-modules.md +168 -0
  147. package/dsh-docs/subsystems/client-modules.zh.md +168 -0
  148. package/dsh-docs/subsystems/client-resources.md +91 -0
  149. package/dsh-docs/subsystems/client-resources.zh.md +91 -0
  150. package/dsh-docs/subsystems/code-runtime.md +195 -0
  151. package/dsh-docs/subsystems/code-runtime.zh.md +195 -0
  152. package/dsh-docs/subsystems/commands.md +219 -0
  153. package/dsh-docs/subsystems/commands.zh.md +219 -0
  154. package/dsh-docs/subsystems/compaction.md +238 -0
  155. package/dsh-docs/subsystems/compaction.zh.md +238 -0
  156. package/dsh-docs/subsystems/conversation.md +258 -0
  157. package/dsh-docs/subsystems/conversation.zh.md +258 -0
  158. package/dsh-docs/subsystems/core.md +1209 -0
  159. package/dsh-docs/subsystems/core.zh.md +1219 -0
  160. package/dsh-docs/subsystems/credentials.md +329 -0
  161. package/dsh-docs/subsystems/credentials.zh.md +329 -0
  162. package/dsh-docs/subsystems/extensions.md +382 -0
  163. package/dsh-docs/subsystems/extensions.zh.md +382 -0
  164. package/dsh-docs/subsystems/feedback.md +266 -0
  165. package/dsh-docs/subsystems/feedback.zh.md +266 -0
  166. package/dsh-docs/subsystems/filesystem.md +505 -0
  167. package/dsh-docs/subsystems/filesystem.zh.md +505 -0
  168. package/dsh-docs/subsystems/goal.md +277 -0
  169. package/dsh-docs/subsystems/goal.zh.md +277 -0
  170. package/dsh-docs/subsystems/invariants.md +88 -0
  171. package/dsh-docs/subsystems/invariants.zh.md +88 -0
  172. package/dsh-docs/subsystems/jobs.md +290 -0
  173. package/dsh-docs/subsystems/jobs.zh.md +290 -0
  174. package/dsh-docs/subsystems/llm-streaming.md +1080 -0
  175. package/dsh-docs/subsystems/llm-streaming.zh.md +1086 -0
  176. package/dsh-docs/subsystems/lsp.md +202 -0
  177. package/dsh-docs/subsystems/lsp.zh.md +202 -0
  178. package/dsh-docs/subsystems/permission-presets.md +131 -0
  179. package/dsh-docs/subsystems/permission-presets.zh.md +131 -0
  180. package/dsh-docs/subsystems/persistence.md +395 -0
  181. package/dsh-docs/subsystems/persistence.zh.md +395 -0
  182. package/dsh-docs/subsystems/plan.md +87 -0
  183. package/dsh-docs/subsystems/plan.zh.md +87 -0
  184. package/dsh-docs/subsystems/sandbox.md +220 -0
  185. package/dsh-docs/subsystems/sandbox.zh.md +220 -0
  186. package/dsh-docs/subsystems/schedule.md +192 -0
  187. package/dsh-docs/subsystems/schedule.zh.md +192 -0
  188. package/dsh-docs/subsystems/scope.md +59 -0
  189. package/dsh-docs/subsystems/scope.zh.md +59 -0
  190. package/dsh-docs/subsystems/session-projection.md +354 -0
  191. package/dsh-docs/subsystems/session-projection.zh.md +354 -0
  192. package/dsh-docs/subsystems/session-query.md +509 -0
  193. package/dsh-docs/subsystems/session-query.zh.md +509 -0
  194. package/dsh-docs/subsystems/session-reference.md +219 -0
  195. package/dsh-docs/subsystems/session-reference.zh.md +219 -0
  196. package/dsh-docs/subsystems/session-telemetry.md +194 -0
  197. package/dsh-docs/subsystems/session-telemetry.zh.md +194 -0
  198. package/dsh-docs/subsystems/session-title.md +204 -0
  199. package/dsh-docs/subsystems/session-title.zh.md +204 -0
  200. package/dsh-docs/subsystems/session.md +1155 -0
  201. package/dsh-docs/subsystems/session.zh.md +1159 -0
  202. package/dsh-docs/subsystems/settings.md +405 -0
  203. package/dsh-docs/subsystems/settings.zh.md +405 -0
  204. package/dsh-docs/subsystems/shell.md +303 -0
  205. package/dsh-docs/subsystems/shell.zh.md +303 -0
  206. package/dsh-docs/subsystems/sidebar-right.md +148 -0
  207. package/dsh-docs/subsystems/sidebar-right.zh.md +148 -0
  208. package/dsh-docs/subsystems/skills.md +354 -0
  209. package/dsh-docs/subsystems/skills.zh.md +354 -0
  210. package/dsh-docs/subsystems/slots.md +175 -0
  211. package/dsh-docs/subsystems/slots.zh.md +175 -0
  212. package/dsh-docs/subsystems/spill.md +117 -0
  213. package/dsh-docs/subsystems/spill.zh.md +117 -0
  214. package/dsh-docs/subsystems/storage.md +260 -0
  215. package/dsh-docs/subsystems/storage.zh.md +260 -0
  216. package/dsh-docs/subsystems/subagent.md +766 -0
  217. package/dsh-docs/subsystems/subagent.zh.md +770 -0
  218. package/dsh-docs/subsystems/subprocess.md +324 -0
  219. package/dsh-docs/subsystems/subprocess.zh.md +324 -0
  220. package/dsh-docs/subsystems/system-prompt.md +220 -0
  221. package/dsh-docs/subsystems/system-prompt.zh.md +220 -0
  222. package/dsh-docs/subsystems/terminal.md +184 -0
  223. package/dsh-docs/subsystems/terminal.zh.md +184 -0
  224. package/dsh-docs/subsystems/todo.md +32 -0
  225. package/dsh-docs/subsystems/todo.zh.md +32 -0
  226. package/dsh-docs/subsystems/token-meter.md +105 -0
  227. package/dsh-docs/subsystems/token-meter.zh.md +105 -0
  228. package/dsh-docs/subsystems/tools.md +720 -0
  229. package/dsh-docs/subsystems/tools.zh.md +720 -0
  230. package/dsh-docs/subsystems/typert.md +343 -0
  231. package/dsh-docs/subsystems/typert.zh.md +343 -0
  232. package/dsh-docs/subsystems/user-questions.md +178 -0
  233. package/dsh-docs/subsystems/user-questions.zh.md +178 -0
  234. package/dsh-docs/subsystems/web-client.md +95 -0
  235. package/dsh-docs/subsystems/web-client.zh.md +95 -0
  236. package/dsh-docs/subsystems/web-server.md +154 -0
  237. package/dsh-docs/subsystems/web-server.zh.md +154 -0
  238. package/dsh-docs/subsystems/web.md +206 -0
  239. package/dsh-docs/subsystems/web.zh.md +206 -0
  240. package/dsh-docs/subsystems/webhook.md +70 -0
  241. package/dsh-docs/subsystems/webhook.zh.md +70 -0
  242. package/dsh-docs/subsystems/workflow.md +278 -0
  243. package/dsh-docs/subsystems/workflow.zh.md +278 -0
  244. package/dsh-docs/subsystems/workspace.md +321 -0
  245. package/dsh-docs/subsystems/workspace.zh.md +321 -0
  246. package/dsh-docs/testing.md +54 -0
  247. package/dsh-docs/testing.zh.md +54 -0
  248. package/dsh-docs/tool-catalog.md +2225 -0
  249. package/dsh-docs/tool-catalog.zh.md +2233 -0
  250. package/dsh-docs/tool-execution-pipeline.md +62 -0
  251. package/dsh-docs/tool-execution-pipeline.zh.md +64 -0
  252. package/dsh-docs/user/develop/basic/config.md +106 -0
  253. package/dsh-docs/user/develop/basic/config.zh.md +106 -0
  254. package/dsh-docs/user/develop/basic/index.md +144 -0
  255. package/dsh-docs/user/develop/basic/index.zh.md +144 -0
  256. package/dsh-docs/user/develop/basic/publish.md +183 -0
  257. package/dsh-docs/user/develop/basic/publish.zh.md +183 -0
  258. package/dsh-docs/user/develop/basic/tool.md +52 -0
  259. package/dsh-docs/user/develop/basic/tool.zh.md +52 -0
  260. package/dsh-docs/user/develop/framework/events.md +143 -0
  261. package/dsh-docs/user/develop/framework/events.zh.md +143 -0
  262. package/dsh-docs/user/develop/framework/index.md +137 -0
  263. package/dsh-docs/user/develop/framework/index.zh.md +137 -0
  264. package/dsh-docs/user/develop/framework/service.md +148 -0
  265. package/dsh-docs/user/develop/framework/service.zh.md +150 -0
  266. package/dsh-docs/user/develop/practice/dynamic-cordis.md +15 -0
  267. package/dsh-docs/user/develop/practice/dynamic-cordis.zh.md +15 -0
  268. package/dsh-docs/user/develop/practice/index.md +155 -0
  269. package/dsh-docs/user/develop/practice/index.zh.md +155 -0
  270. package/dsh-docs/user/develop/practice/llm-adapter.md +189 -0
  271. package/dsh-docs/user/develop/practice/llm-adapter.zh.md +189 -0
  272. package/dsh-docs/user/guide/github-review.md +102 -0
  273. package/dsh-docs/user/guide/github-review.zh.md +102 -0
  274. package/dsh-docs/user/guide/index.md +30 -0
  275. package/dsh-docs/user/guide/index.zh.md +30 -0
  276. package/dsh-docs/user/guide/mcp-memory.md +101 -0
  277. package/dsh-docs/user/guide/mcp-memory.zh.md +101 -0
  278. package/dsh-docs/user/guide/network-proxy.md +85 -0
  279. package/dsh-docs/user/guide/network-proxy.zh.md +85 -0
  280. package/dsh-docs/user/guide/providers.md +190 -0
  281. package/dsh-docs/user/guide/providers.zh.md +190 -0
  282. package/dsh-docs/user/guide/python-sdk.md +150 -0
  283. package/dsh-docs/user/guide/python-sdk.zh.md +150 -0
  284. package/dsh-docs/user/guide/schedule.md +21 -0
  285. package/dsh-docs/user/guide/schedule.zh.md +21 -0
  286. package/dsh-docs/user/index.md +11 -0
  287. package/dsh-docs/user/index.zh.md +11 -0
  288. package/dsh-docs/web-styling.md +29 -0
  289. package/dsh-docs/web-styling.zh.md +29 -0
  290. package/eval-description.md +33 -0
  291. package/lib/client/index.js +327 -88
  292. package/lib/fs-aware/sandbox-plugin.d.ts +71 -0
  293. package/lib/fs-aware/sandbox-plugin.js +249 -0
  294. package/lib/index.d.ts +22 -22
  295. package/lib/index.js +3095 -3204
  296. package/lib/lsp-server-registry-DkaYmTwt.js +972 -0
  297. package/lib/lsp-server-registry-_hk-Wcia.js +3 -0
  298. package/lib/py-sdk-Chvy92MB.js +178 -0
  299. package/lib/py-sdk.d.ts +19 -2
  300. package/lib/py-sdk.js +2 -2
  301. package/lib/wrap-JFjcWwZf.js +747 -0
  302. package/package.json +9 -3
  303. package/url-schemes-instruction.md +22 -0
  304. package/control-prompt.md +0 -37
  305. package/docs/50_test-reports/v0.1.8d_artifacts/README.md +0 -138
  306. package/docs/50_test-reports/v0.1.8d_artifacts/code-mode-repl-only.observation.md +0 -74
  307. package/docs/50_test-reports/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.jsonl +0 -3890
  308. package/docs/50_test-reports/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.w-sample-0435.jsonl +0 -544
  309. package/docs/50_test-reports/v0.1.8d_artifacts/functions.json +0 -592
  310. package/docs/50_test-reports/v0.1.8d_artifacts/skills-catalog.snapshot.md +0 -30
  311. package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.output-schemas.json +0 -1236
  312. package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.python.txt +0 -592
  313. package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.typescript.txt +0 -516
  314. package/docs/50_test-reports/v0.1.8d_artifacts/wire-vs-transcription.diff.md +0 -54
  315. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/Cargo.lock +0 -7
  316. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/Cargo.toml +0 -6
  317. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/src/bin/messy.rs +0 -8
  318. package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/src/main.rs +0 -4
  319. package/docs/50_test-reports/v0.2.0b_artifacts/hashline-probe.md +0 -5
  320. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/Cargo.lock +0 -7
  321. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/Cargo.toml +0 -7
  322. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/build.rs +0 -4
  323. package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/src/main.rs +0 -13
  324. package/docs/60_exploration-and-research/cordis-research.md +0 -350
  325. package/docs/60_exploration-and-research/dsh-web-profile-package-map.md +0 -186
  326. package/docs/60_exploration-and-research/dsh-web-ui-slot-system-research.md +0 -310
  327. package/docs/60_exploration-and-research/dsh-webui-strip-boundary-research.md +0 -300
  328. package/docs/60_exploration-and-research/ios-chat-app-bridge-research.md +0 -324
  329. package/docs/60_exploration-and-research/web-frontend-composability-research.md +0 -191
  330. package/docs/REPL-/345/267/245/345/205/267/350/260/203/347/224/250-/346/210/252/346/226/255/350/257/212/346/226/255.md +0 -110
  331. package/docs/adr/0001-bridge-tool-layer-not-service-layer.md +0 -14
  332. package/docs/adr/0002-masking-is-presentation-only.md +0 -15
  333. package/docs/plans/A2A-messaging-channel-test-archive.md +0 -256
  334. package/docs/plans/code-mode-vs-rlm-ipython-comparison.md +0 -137
  335. package/docs/plans/dashr-blueprint-review.md +0 -201
  336. package/docs/plans/dashr-blueprint.md +0 -561
  337. package/docs/plans/dashr-compaction-window-and-archive.md +0 -307
  338. package/docs/plans/dashr-profile-layer-feasibility.md +0 -367
  339. package/docs/plans/dashr-sandbox-escalation-semantics-gap.md +0 -171
  340. package/docs/plans/dashr-security-sandbox-analysis.md +0 -187
  341. package/docs/plans/dashr-surface-invariant-and-omp-imports.md +0 -97
  342. package/docs/plans/ipython-kernel-interactive-interface-test-report.md +0 -152
  343. package/docs/plans/kernel-refactoring/Dash-IPython-Control-Prompt-draft.md +0 -146
  344. package/docs/plans/kernel-refactoring/Dash-IPython-Control-Prompt-draft_v3.md +0 -50
  345. package/docs/plans/kernel-refactoring/Dash-IPython-Control-Prompt-draft_v4.md +0 -79
  346. package/docs/plans/kernel-refactoring/Dash-vs-PrimeAgent-systemprompt-toolcatalog-comparison.md +0 -138
  347. package/docs/plans/kernel-refactoring/RLM-system-prompt-injection-gap-report.md +0 -161
  348. package/docs/plans/kernel-refactoring/V0.1.5-development-plan.md +0 -109
  349. package/docs/plans/kernel-refactoring/actinoable-surface-to-llm-in-agent-runtime_dsh.md +0 -50
  350. package/docs/plans/kernel-refactoring/actinoable-surface-to-llm-in-agent-runtime_prime.md +0 -113
  351. package/docs/plans/recallable-compaction.md +0 -147
  352. package/docs/plans/spike-tag-repro.mjs +0 -102
  353. package/docs/plans/upstream-analysis.md +0 -128
  354. package/docs/v0.1.8-improved-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -142
  355. package/docs/v0.1.8-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -193
  356. package/docs/v0.1.8b-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -96
  357. package/docs/v0.1.8c-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -127
  358. package/docs/v0.1.8d-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -150
  359. package/docs/v0.1.8d_artifacts/README.md +0 -138
  360. package/docs/v0.1.8d_artifacts/code-mode-repl-only.observation.md +0 -74
  361. package/docs/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.jsonl +0 -3890
  362. package/docs/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.w-sample-0435.jsonl +0 -544
  363. package/docs/v0.1.8d_artifacts/functions.json +0 -592
  364. package/docs/v0.1.8d_artifacts/skills-catalog.snapshot.md +0 -30
  365. package/docs/v0.1.8d_artifacts/tools-sdk.output-schemas.json +0 -1236
  366. package/docs/v0.1.8d_artifacts/tools-sdk.python.txt +0 -592
  367. package/docs/v0.1.8d_artifacts/tools-sdk.typescript.txt +0 -516
  368. package/docs/v0.1.8d_artifacts/wire-vs-transcription.diff.md +0 -54
  369. package/docs/v0.1.8e-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -224
  370. package/docs/v0.1.9a-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -168
  371. package/docs/v0.2.0b-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -123
  372. package/docs/v0.2.0b_artifacts/f2probe/Cargo.lock +0 -7
  373. package/docs/v0.2.0b_artifacts/f2probe/Cargo.toml +0 -6
  374. package/docs/v0.2.0b_artifacts/f2probe/src/bin/messy.rs +0 -8
  375. package/docs/v0.2.0b_artifacts/f2probe/src/main.rs +0 -4
  376. package/docs/v0.2.0b_artifacts/hashline-probe.md +0 -5
  377. package/docs/v0.2.0b_artifacts/slowprobe/Cargo.lock +0 -7
  378. package/docs/v0.2.0b_artifacts/slowprobe/Cargo.toml +0 -7
  379. package/docs/v0.2.0b_artifacts/slowprobe/build.rs +0 -4
  380. package/docs/v0.2.0b_artifacts/slowprobe/src/main.rs +0 -13
  381. package/docs/v0.2.1-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -110
  382. package/docs/v0.2.1b-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -86
  383. package/docs/v0.2.1c-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -66
  384. package/lib/py-sdk-BCaOGYz7.d.ts +0 -125
  385. package/lib/py-sdk-CbgYiX8O.js +0 -691
@@ -0,0 +1,148 @@
1
+ # url-schema Specification
2
+
3
+ ## Purpose
4
+
5
+ Give DASHR one uniform URL resource-addressing layer: read/write/grep/glob accept `scheme://` URLs, route by scheme to a handler, apply one selector syntax uniformly, and keep non-URL behavior byte-identical to the native tools via delegation.
6
+
7
+ ## Requirements
8
+
9
+ ### Requirement: FS-shaped tools accept and route scheme URLs
10
+ The scheme registry SHALL be owned by the `dsh-url-schemes` cordis service (renamed from `dsh-url-schema`), which SHALL contain the `UrlResolver` and scheme handlers only (no tool registrations inside the service). The URL-aware read/write/grep/glob tools SHALL be tool-layer consumers. read SHALL accept `scheme://` URLs and resolve them end-to-end through the scheme registry; grep/glob SHALL translate or materialize the resource for the native search; write SHALL dispatch to a structured per-scheme write channel (all rejected this wave).
11
+
12
+ #### Scenario: Reading a registered scheme
13
+ - **WHEN** the model calls read with a registered scheme URL (e.g. `skill://foo`)
14
+ - **THEN** the system returns the handler-resolved content with the selector applied, not a filesystem read
15
+
16
+ #### Scenario: Reading an unregistered scheme
17
+ - **WHEN** the model calls read with a URL whose scheme has no registered handler (including `history://` — no special case exists)
18
+ - **THEN** the system returns the structured `URL_UNREGISTERED_SCHEME` error listing the registered schemes
19
+
20
+ #### Scenario: URL without a scheme prefix
21
+ - **WHEN** a resolver-layer caller passes a string without `scheme://`
22
+ - **THEN** the system returns the structured `URL_NO_SCHEME` error
23
+
24
+ ### Requirement: `dsh://docs` serves the vendored upstream official docs
25
+ `dsh://docs` SHALL serve the shipped upstream official harness documentation corpus (`dsh-docs/`, vendored from the `deepseek-ai/deepseek-harness` repo `docs/`), not the DASHR repository's working notes. Resolution order: explicit `docsDir` → packaged `dsh-docs/` → packaged `docs/` → repo-root `docs/` (walk-up probes `dsh-docs` before `docs` at every level).
26
+
27
+ #### Scenario: Docs index lists the official corpus
28
+ - **WHEN** the model reads `dsh://docs`
29
+ - **THEN** the index enumerates the upstream official docs tree (`agent-lifecycle.md`, `api-gateway.md`, `architecture.md`, …)
30
+
31
+ ### Requirement: Bare `skill://` lists the available skills
32
+ A bare `skill://` URL (no skill name) SHALL render the cwd-scoped skill catalog from the registry's `list` face — one line per winning summary (`skill://<name> — <description>`, plus `(use when: …)` when `whenToUse` is present) — using the same discovery rule as a name lookup. An empty catalog SHALL answer explicitly, never with an error.
33
+
34
+ #### Scenario: Bare skill list
35
+ - **WHEN** the model reads `skill://` with no skill name
36
+ - **THEN** the tool result contains the count header and per-skill lines, cwd-scoped exactly like `skill://<name>` resolution
37
+
38
+ #### Scenario: Empty catalog
39
+ - **WHEN** no skill is available in the workspace scope
40
+ - **THEN** the result reads "No skills available in this workspace scope." — not a `URL_SKILL_NOT_FOUND` error
41
+
42
+ ### Requirement: Delegation shells preserve native non-URL behavior
43
+ The system SHALL implement read/write/grep/glob as delegation shells over the definition registered under the same semantic name at capture time, captured once per agent via `ctx.tools.get(name, agent)` strictly before the wrappers register on the agent's own scope layer (`read` included — its captured delegate MAY be another feature's wrapper). Non-URL inputs SHALL be forwarded verbatim to `captured.execute(args, exec)`, preserving the native write-intent policy gate, sandbox resolution, ripgrep search semantics, and any outer-layer behavior already present. The shells SHALL honor per-feature config gates `Config = { urlSchemes?: boolean = true, hashline?: boolean = true }` from the patch-line `config:` block: with `urlSchemes: false`, scheme paths SHALL fall through to the captured definition (native failure semantics are honest); with `hashline: false`, file reads SHALL delegate without hashline anchoring.
44
+
45
+ #### Scenario: Ordinary write keeps the policy gate
46
+ - **WHEN** the model writes to an ordinary file path
47
+ - **THEN** the call runs through the captured native write definition — the write-intent policy gate, sandbox resolution, and observation events behave exactly as before the URL schema existed
48
+
49
+ #### Scenario: Ordinary grep/glob keep ripgrep semantics
50
+ - **WHEN** the model greps or globs over ordinary paths
51
+ - **THEN** the call delegates to the captured native definition with args untouched, returning native-shaped results
52
+
53
+ #### Scenario: Missing native delegate fails loudly
54
+ - **WHEN** a host did not deploy the native write/grep/glob and the corresponding wrapper is invoked on a non-URL input
55
+ - **THEN** the system returns the structured `NATIVE_WRITE_UNAVAILABLE` / `NATIVE_GREP_UNAVAILABLE` / `NATIVE_GLOB_UNAVAILABLE` error instead of reimplementing the tool
56
+
57
+ #### Scenario: Capture happens before registration
58
+ - **WHEN** an agent session starts and the URL-aware tools are installed
59
+ - **THEN** the definitions under `read`/`write`/`grep`/`glob` are captured strictly before any wrapper registers on that agent's scope layer, so the captured reference is the pre-existing tool rather than the wrapper (no self-recursion)
60
+
61
+ #### Scenario: URL capability disabled by gate
62
+ - **WHEN** the patch line sets `urlSchemes: false` and the model reads `ctx://session`
63
+ - **THEN** the wrapper delegates to the captured read definition and the native failure surfaces
64
+
65
+ ### Requirement: URL search reuses the native engine
66
+ The system SHALL run grep/glob over URL-addressed resources through the native search engine: path-backed schemes (a handler-implemented `resolvePath` mapping the URL to a real disk location — `skill://` today) have the URL translated to the disk path before delegating; content-backed schemes (agent, ctx, `dsh://config`, http, …) have the resolved text materialized into a fresh RAM-backed tempfs directory (`/dev/shm` when available and writable; falling back to the OS temp dir when unavailable or when a single materialization exceeds 8 MiB) which is removed afterwards whatever the outcome.
67
+
68
+ #### Scenario: Searching a path-backed resource
69
+ - **WHEN** the model greps a `skill://name` URL
70
+ - **THEN** the URL is translated to the skill's real disk path and only the search root is rewritten before the native grep runs
71
+
72
+ #### Scenario: Searching a content-backed resource
73
+ - **WHEN** the model greps a content-backed URL (e.g. `ctx://model`)
74
+ - **THEN** the resolved text is written into a fresh temp dir under `/dev/shm` (or the OS temp dir on fallback) as `content.txt`, the native grep searches it, and the temp dir is removed whether the search succeeds or fails
75
+
76
+ #### Scenario: Listing a URL resource
77
+ - **WHEN** the model calls glob with a URL in `pattern`
78
+ - **THEN** a path-backed scheme globs the resource's real disk directory natively, and a content-backed scheme returns the resolved text's non-empty lines as the listing without a native call
79
+
80
+ #### Scenario: Glob metacharacters in a URL pattern
81
+ - **WHEN** the glob pattern is a URL carrying glob metacharacters (e.g. `skill://grp/*`, `skill://grp/**/*.md`)
82
+ - **THEN** the pattern splits at the first metacharacter (`*?[`): the URL part resolves via `resolvePath` and the tail is the rooted glob pattern applied WITHIN the resource's real disk directory — the raw metachar-containing string is never handed to the native engine as a literal path
83
+
84
+ #### Scenario: Grep match paths report URL addressing
85
+ - **WHEN** a grep over a path-backed URL returns matches
86
+ - **THEN** match paths are rewritten back to the URL form (`skill://grp/SKILL.md`), both for absolute paths under the disk root and for native-relative paths — the model never sees internal disk locations
87
+
88
+ #### Scenario: Fallback to the OS temp dir
89
+ - **WHEN** `/dev/shm` is unavailable or the content exceeds 8 MiB
90
+ - **THEN** materialization falls back to the OS temp dir and the search still completes
91
+
92
+ ### Requirement: URL writes are rejected per scheme
93
+ The system SHALL reject every `scheme://` write with a scheme-specific structured error: `dvc://` → `DVC_NO_DEVICE` (no device mounted), `ctx://` → `URL_READ_ONLY` (curated read-only snapshot), any other registered scheme → `URL_WRITE_UNSUPPORTED`, unregistered scheme → `URL_UNREGISTERED_SCHEME`.
94
+
95
+ #### Scenario: Writing to a read-only scheme
96
+ - **WHEN** the model writes to `ctx://model`
97
+ - **THEN** the system returns the structured `URL_READ_ONLY` error explaining the scheme is a read-only snapshot
98
+
99
+ #### Scenario: Writing to the device placeholder
100
+ - **WHEN** the model writes to `dvc://<device>`
101
+ - **THEN** the system returns the structured `DVC_NO_DEVICE` error (no devices mounted to route the write to)
102
+
103
+ ### Requirement: Unified selector syntax
104
+ The system SHALL parse selectors once (`:N-M` comma-lists, `:raw`, `:path/…`, `?q=`) and apply them uniformly to every handler's full text after resolution. Handlers return full text with no default line truncation; only explicit selectors page. Malformed selectors return the structured `URL_BAD_SELECTOR` error.
105
+
106
+ #### Scenario: Scheme URL with a line range
107
+ - **WHEN** the model reads `skill://foo:50-100`
108
+ - **THEN** the system resolves the full skill body and returns lines 50–100, exactly as it would slice a plain file
109
+
110
+ #### Scenario: JSON path and query selectors
111
+ - **WHEN** the resolved text is JSON and the URL carries `:path/a.b` or `?q=a.b`
112
+ - **THEN** the system navigates the JSON by dot-path; for non-JSON text `?q=` keeps the lines containing the query string
113
+
114
+ ### Requirement: Read delegation shapes args to the delegate and coerces output
115
+ The URL-aware read wrapper SHALL accept both `path` and `file_path` (aliased); when delegating a non-scheme path it SHALL shape args to the delegate's DECLARED parameters (`file_path` for the host-native read, `path` for hashline; opaque schemas forwarded verbatim — no keys added an unknown validator might reject) and SHALL coerce a non-string delegate result to the wrapper's string output (JSON serialization), since the wrapper declares the string face for every branch.
116
+
117
+ #### Scenario: Host-native delegate receives file_path
118
+ - **WHEN** a file path is delegated to a delegate whose schema declares `file_path`
119
+ - **THEN** the delegate receives `file_path` (the `path` key removed) and its structured result is serialized into the wrapper's string output
120
+
121
+ #### Scenario: Hashline delegate receives path
122
+ - **WHEN** a file path is delegated to the hashline read (schema declares `path`)
123
+ - **THEN** the delegate receives `path` only and the anchored text returns verbatim
124
+
125
+ ### Requirement: read's file branch stays vendored hashline
126
+ The system SHALL keep the ordinary-file branch of read on the vendored hashline pipeline (HASH│content anchors plus the snapshot store the vendored edit tools depend on), reading through the sandboxed filesystem and the fs observation policy gate — read delegates to no native definition.
127
+
128
+ #### Scenario: Plain file read returns hashline anchors
129
+ - **WHEN** the model reads an ordinary file path
130
+ - **THEN** the system returns hashline-anchored lines via the vendored pipeline and records the observation with the fs policy gate, so follow-up edit calls see the version just read
131
+
132
+ ### Requirement: Read chassis with ordered transforms
133
+ The `read` tool registration SHALL be owned by a single chassis inside `dsh-url-schemes`: an ordered transform chain (URL transform, hashline anchor transform, …) with a terminal delegate to the captured read definition. Additional read-side features SHALL register transforms into the chassis rather than registering competing `read` definitions (same-layer same-name registration is a registry error); a read-interested feature SHALL fall back to its own minimal wrapper only when the chassis is absent.
134
+
135
+ #### Scenario: Transforms compose deterministically
136
+ - **WHEN** both the URL transform and the hashline anchor transform are registered and the model reads a filesystem path
137
+ - **THEN** the path flows URL transform (no match) → anchor transform (anchors applied) → captured native read
138
+
139
+ ### Requirement: General syntax guidance section
140
+ The service SHALL render a gated `url-schema:general` system-prompt section whose text is loaded once at module load from the package-root `url-schemes-instruction.md` (the owner-maintained instruction file; shipped via the package.json `files` array — an unlisted file is omitted from the published package and the module-load `readFileSync` fails plugin boot, the 0.2.3-d ENOENT lesson) (shipped via the package.json `files` array — an unlisted file is omitted from the published package and the module-load `readFileSync` fails plugin boot, the 0.2.3-d ENOENT lesson). The section is the SINGLE surfacing point of the URL scheme set to the model: the read/grep/glob/write tool descriptions SHALL carry NO `scheme://` mentions, so the model cannot believe only some tools accept URLs. The section text is the OWNER-MAINTAINED file rendered verbatim (2026-09-12 ruling: the file is hand-edited, not generated) and SHALL cover at minimum: the general URL grammar (`scheme://<path>[:selector]`); all six schemes (`skill://`, `agent://`, `dsh://`, `ctx://`, `dvc://`, `http(s)://`) with first-level resource coverage per scheme; the selector set including the composite `:raw:N-M` clause; and bulk-read guidance. The section renders only while the URL capability is enabled.
141
+
142
+ #### Scenario: Gated disclosure
143
+ - **WHEN** the URL capability is enabled and an agent session starts
144
+ - **THEN** the system prompt contains the section text loaded from `url-schemes-instruction.md` with the grammar, selector, and scheme coverage
145
+
146
+ #### Scenario: Tool descriptions stay scheme-silent
147
+ - **WHEN** the model inspects any read/grep/glob/write tool description on the wire
148
+ - **THEN** no description carries a `scheme://` mention — the `url-schema:general` section is the only place the scheme set is surfaced
@@ -0,0 +1,43 @@
1
+ # web-trust-fence Specification
2
+
3
+ ## Purpose
4
+ better-dsh 的 /api 信任栅栏随发契约(替代 prod 手改 patch):bundle patch 整行重述 `connection` 行,`trustedHosts` = `DSH_TRUSTED_HOSTS` env 条目 + 上游 webRuntime 权威拼接(env 缺省时行为与原装行等价、零侵入);host 半 boot script 的 isLoopback 腿——页面 origin 命中 `trustedPageAuthorities` 时置 `window.__DSH_TRANSPORT__ = { ownsHost: true }`(空列表不注入)。
5
+
6
+ ## Requirements
7
+
8
+ ### Requirement: Plugin-shipped fence authorities
9
+
10
+ The plugin's bundle patch layer SHALL override the `connection` loader row by id, restating the row's full shape, with `config.trustedHosts` computed as the concatenation of `DSH_TRUSTED_HOSTS` environment entries (whitespace-separated) and the upstream `webRuntime`-derived authorities; with the environment variable unset or empty the resulting composition SHALL be byte-equivalent in behavior to the unpatched upstream row (inert by default).
11
+
12
+ #### Scenario: Env-derived authority passes the fence
13
+
14
+ - **WHEN** the daemon runs with `DSH_TRUSTED_HOSTS=host.example` and a browser reaches `/api` with `Host: host.example` and same-origin markers
15
+ - **THEN** the request passes the Host/Origin trust fence (no 403 from the fence) and the Settings > Models provider directory loads from that authority
16
+
17
+ #### Scenario: Inert without the environment variable
18
+
19
+ - **WHEN** the daemon runs without `DSH_TRUSTED_HOSTS`
20
+ - **THEN** the fence accepts exactly the authorities the unpatched upstream composition would (loopback, LAN literals on all-interface binds, `--trusted-host` extras)
21
+
22
+ #### Scenario: Malformed entry fails loud at load
23
+
24
+ - **WHEN** `DSH_TRUSTED_HOSTS` contains an entry that is not a bare canonical `host[:port]` authority
25
+ - **THEN** plugin load fails loudly via the upstream `assertTrustedAuthority` validation instead of silently widening or narrowing the fence
26
+
27
+ ### Requirement: Upgrade-safe replacement of the hand patch
28
+
29
+ The plugin SHALL NOT require source-level edits to vendored `@deepseek-ai/*` files for fence behavior; the alpha.3 hand patch (`isLoopbackHostname` widening in `dsh-client-connection` index.js and client bundle) SHALL be retirable on alpha.5+ by this capability alone, and the row-override shape SHALL be tracked as an upstream-alignment checklist item (diff `packages/bundle/web-app/cordis.patch.yml`'s `connection` row each alignment round).
30
+
31
+ #### Scenario: Upstream row drift is detected at alignment time
32
+
33
+ - **WHEN** an upstream release changes the `connection` row's keys (name, inject, or config shape)
34
+ - **THEN** the alignment-round checklist surfaces the drift before the stale restated row ships
35
+
36
+ ### Requirement: User layer keeps precedence
37
+
38
+ A user's own profile or home `cordis.patch.yml` override of the `connection` row SHALL take precedence over the plugin's bundle layer, preserving the upstream layering contract.
39
+
40
+ #### Scenario: User override wins
41
+
42
+ - **WHEN** the user's profile patch restates the `connection` row
43
+ - **THEN** the user's row applies, not the plugin's
@@ -0,0 +1,156 @@
1
+ # upstream dsh npm 版本对账:prod 0.1.3-alpha.2 → 0.1.5-rc.2
2
+
3
+ > 生成时间:2026-09-10(本地时区)
4
+ > 数据源:npm registry(`@deepseek-ai/dsh`)元数据 + `upstream/deepseek-harness` git tag 对账
5
+ > 目标:回答「npm 上比 prod 更高的版本是什么、diff 有多大、对 prod 意味着什么」
6
+
7
+ ---
8
+
9
+ ## 〇、一句话结论
10
+
11
+ prod 当前跑 **`@deepseek-ai/dsh@0.1.3-alpha.2`**。npm 上比它高的版本是整条 **0.1.5 线**(`alpha.1 / alpha.2 / rc.1 / rc.2`,**0.1.4 从未发布,直接跳号**)。最高版本是 **`0.1.5-rc.2`**(挂在 `next` dist-tag,而 `latest` 还停在 `0.1.5-rc.1`)。
12
+
13
+ 这条 0.1.5 线是**大版本级聚合**:846 commits、3170 文件、约 10.4 万行新增。核心是 **Session 格式 v3 重写**(会话持久化契约变更,对 prod 是**破坏性升级,不可 drop-in**),外加 Electron 桌面打包、Sidebar/dockkit 重构、文件交付「present」工具、图渲染预览、模型默认值切换(DeepSeek V41 Flash)等一批功能。**升级 prod 前必须按 AGENTS.md §一/§二 走对齐轮,不能只换版本号。**
14
+
15
+ ---
16
+
17
+ ## 一、版本全景
18
+
19
+ npm registry 当前 dist-tags:
20
+
21
+ | dist-tag | 指向版本 |
22
+ |---|---|
23
+ | `latest` | 0.1.5-rc.1 |
24
+ | `next` | **0.1.5-rc.2**(最高) |
25
+ | `alpha` | 0.1.5-alpha.2 |
26
+
27
+ 比 prod(0.1.3-alpha.2)更高的版本,按发布顺序:
28
+
29
+ | 版本 | npm 发布时间 (UTC) | dist-tag |
30
+ |---|---|---|
31
+ | 0.1.5-alpha.1 | 2026-09-08 15:57 | — |
32
+ | 0.1.5-alpha.2 | 2026-09-09 14:41 | `alpha` |
33
+ | 0.1.5-rc.1 | 2026-09-10 03:12 | `latest` |
34
+ | **0.1.5-rc.2** | **2026-09-10 14:57** | `next` |
35
+
36
+ > 注意点:`latest` 并不指向最高版本(rc.1 vs rc.2);「最高版本」= `next` 上的 **0.1.5-rc.2**。0.1.4 未在 npm 出现过。
37
+
38
+ 对应 git tag(本地 `upstream/deepseek-harness`,已 fetch):
39
+
40
+ ```
41
+ dsh-v0.1.3-alpha.2 2026-09-07 19:45 +0800 ← prod 当前
42
+ dsh-v0.1.5-alpha.1 2026-09-08 23:25 +0800
43
+ dsh-v0.1.5-alpha.2 2026-09-09 22:13 +0800
44
+ dsh-v0.1.5-rc.1 2026-09-10 09:36 +0800
45
+ dsh-v0.1.5-rc.2 2026-09-10 21:50 +0800
46
+ ```
47
+
48
+ ---
49
+
50
+ ## 二、diff 规模
51
+
52
+ `dsh-v0.1.3-alpha.2 .. dsh-v0.1.5-rc.2`:
53
+
54
+ | 指标 | 值 |
55
+ |---|---|
56
+ | commits | **846** |
57
+ | 文件 | 3170 changed |
58
+ | 行 | +103,990 / −17,687 |
59
+ | 源码侧(排除 snapshots/tests) | 2474 文件,+68,818 / −13,973 |
60
+
61
+ 分段 commit 分布:
62
+
63
+ | 区间 | commits |
64
+ |---|---|
65
+ | 0.1.3-alpha.2 → 0.1.5-alpha.1 | 563(大头,聚合了 Session V3 与一堆 feature) |
66
+ | 0.1.5-alpha.1 → 0.1.5-alpha.2 | 262 |
67
+ | 0.1.5-alpha.2 → 0.1.5-rc.1 | 17 |
68
+ | 0.1.5-rc.1 → 0.1.5-rc.2 | 4(收尾/backport) |
69
+
70
+ ---
71
+
72
+ ## 三、依赖面变化(对 prod 直接可见)
73
+
74
+ prod 0.1.3-alpha.2 有 **71 个 dependencies**,0.1.5-rc.2 有 **72 个**。差异:
75
+
76
+ 1. **新增运行期包 `@deepseek-ai/dsh-tool-present`**(`packages/fs/tool-present`)——新「present」工具:把 agent 产出的文件以不可变交付卡片(download card)呈现,是文件交付特性的宿主半。
77
+ 2. `apps/cli` devDeps 新增 `@deepseek-ai/dsh-agent-loop`、`@deepseek-ai/dsh-agent-loop-testkit`(内部,不影响 prod 运行面)。
78
+ 3. 新增 client 包 `ui-deliverables`(`PresentRow` / `PresentedFileCard` / `present-open`),属 web shell 交付卡片 UI。
79
+ 4. 其余全部 `@deepseek-ai/*` 依赖整体从 `^0.1.3-alpha.2` 抬到 `^0.1.5-rc.2`(同版本号齐步,无个别漂移)。
80
+ 5. 底层 `cordis` / `schemastery` / `commander` / `js-yaml` 等版本**未变**(`cordis ^4.0.2`、`schemastery ^3.18.2` 等,与 0.1.3-alpha.2 相同)。
81
+
82
+ ---
83
+
84
+ ## 四、主要变更主题(按 prod 相关度排序)
85
+
86
+ ### 1. Session 格式 v3 重写(⚠ 破坏性,最高风险)
87
+ `session-log-v3` 工作线,是本次最大的变更块。要点:
88
+
89
+ - 会话身份 **V2 → V3 迁移**(`feat(session): add identity V2-to-V3 migration and writer skeleton`)。
90
+ - system prompt 表示为 **surface node zero**(`refactor(session): represent the system prompt as surface node zero`)。
91
+ - **canonical envelopes**、PTC durable vocabulary、in-history system prompt 表示、JSONL 跨进程写所有权(lease)。
92
+ - 大量 `session.v3.jsonl` 快照与 V2/V3 迁移覆盖面单测。
93
+
94
+ > **对 prod 的含义**:会话持久化契约改变。上一轮(0.1.3-alpha.2 对齐)已实测:上游 tag diff 会打到 `session-persistence-omp.ts` / `replay.ts` / store 的 handle+lease 契约(见 2026-09-08 对齐报告)。**0.1.5 的 V3 比 0.1.3 的 V2 更进一步,破坏面更大**,`better-dsh` / `omp-web` 这类桥接会话数据的插件必须重新对齐,不能 drop-in。
95
+
96
+ ### 2. Electron 桌面打包(对 3080 web 无直接作用)
97
+ Windows/macOS/Linux 构建、mac 签名+公证、Windows 签名、auto-update、IPC 性能优化。纯桌面宿主线,与本机 `dsh web`(3080)部署无关,但意味着上游发布面从此多一个桌面产物。
98
+
99
+ ### 3. Sidebar / dockkit 重构
100
+ - `dockkit` 可逆停靠引擎、pointer 交互。
101
+ - 全局 sidebar panel、tab 导航、live tab 标题 + 文件类型图标、末 tab 关闭规则、响应式右栏、全屏 shell。
102
+ - session-log 控制移入 header「更多」菜单。
103
+
104
+ ### 4. 文件交付「present」工具 + 文档预览
105
+ - 新 `dsh-tool-present` 包:不可变文件交付下载卡片、artifact 卡原生文件动作、workspace 文件操作。
106
+ - 可扩展文档预览、文本预览分页 tab、文件类型图标集、`ui-deliverables` client 卡。
107
+ - `feat(fs)`:bounded byte-range reads(fs-local / fs-e2b)、dual-face 文件 API。
108
+
109
+ ### 5. 图表 / Markdown 预览
110
+ Chat 代码块内预览 Mermaid / Graphviz / SVG / HTML fence,适配应用主题。
111
+
112
+ ### 6. LLM 模型默认值切换(⚠ 影响 prod 行为)
113
+ - Chat Completions 默认切到 **DeepSeek V41 Flash**(`feat(llm): default Chat Completions to DeepSeek V41 Flash`)。
114
+ - 保留 V4 模型、恢复 V4 Flash Vision Exp catalog 条目。
115
+ > prod 若升级,默认模型会跟着变;需确认是否期望。
116
+
117
+ ### 7. Feedback 对话框
118
+ `/feedback` 与 Dislike 统一为一个带分类的对话框 + toast。
119
+
120
+ ### 8. Subagent catalog
121
+ 记录并观察 parent-owned child catalog(子代理目录)。
122
+
123
+ ### 9. native system / node-addon-system
124
+ 包族改名 `node-addon-system`,预编译 Node-API flock、Landlock capability 子路径。**新增原生依赖面,升级安装需留意 prod 机上的原生构建/预编译匹配**(本机已有一处 zeromq allowBuilds 特例,见 AGENTS.md §二)。
125
+
126
+ ### 10. minimal profile 行为调整
127
+ - `str_replace_editor` 从 minimal profiles 移除。
128
+ - persistent bash 输出与 one-shot shell 契约对齐。
129
+ > 只影响 minimal profile,不影响 prod `web` profile 的默认工具集。
130
+
131
+ ### 11. 其它
132
+ - CLI:从 shipped 模板创建 profile。
133
+ - skills:Playwright 视频录制 GIF。
134
+ - 内部 CI/审查自动化(weighted PR approval、review owner 排名等)——与 prod 运行无关。
135
+
136
+ ---
137
+
138
+ ## 五、对 prod 升级的风险评估(简要)
139
+
140
+ | 风险项 | 级别 | 说明 |
141
+ |---|---|---|
142
+ | Session V3 格式迁移 | 🔴 高 | 会话持久化契约变更;`better-dsh`/`omp-web` 会话桥接面需重新对齐,先例(0.1.3 V2)已证实非 drop-in |
143
+ | 模型默认切 V41 Flash | 🟠 中 | 默认行为变化,需 user 确认是否接受 |
144
+ | 新原生依赖(node-addon-system) | 🟡 中低 | 安装面原生构建/预编译匹配;本机 pnpm strictDepBuilds/allowBuilds 需复核 |
145
+ | 新工具 `dsh-tool-present` | 🟡 中低 | 新工具进入 agent 运行时,需确认与现有工具/插件无 id 冲突 |
146
+ | Sidebar/dockkit UI 重构 | 🟢 低(功能面) | 纯增量 UI,但 better-dsh 的 mobile 手势/侧栏 patch 需复测是否仍对齐 |
147
+ | Electron 桌面 | ⚪ 无关 | 不影响 web 部署 |
148
+
149
+ ---
150
+
151
+ ## 六、建议
152
+
153
+ 1. 本次**只做对账、不做升级**:0.1.5 是聚合大版本,且含 Session V3 破坏性契约变更,不能当「换版本号」处理。
154
+ 2. 若后续要升级,按 AGENTS.md §一/§二走 **Dev/Test 1(4999 源码级)对齐轮**:切 `dsh-v0.1.5-rc.2` → 重放三处本地 patch(storeDir / unrun devDep / resolveRepositoryRoot)→ install/build → 插件契约对齐(重点 `session-persistence-omp.ts`/`replay.ts`/store 的 V3 handle+lease)→ tsc/单测 → 4999 第一人称实测 → 报告落 `docs/50_test-reports/` → user 确认 → 才动 prod 3080。
155
+ 3. 升级目标版本**首选 `0.1.5-rc.2`(`next`)而非 `latest`(rc.1)**,因为 rc.2 才是最高版本;但 rc 阶段仍建议等上游正式 stable 后再定。
156
+ 4. 升级前单独确认模型默认值(V41 Flash)是否要在 prod 生效。
@@ -0,0 +1,75 @@
1
+ # AGENTS.md — The documentation standard
2
+
3
+ This file defines document structure, Markdown tiers, writing rules, and `verify-doc-budgets` ceilings. Use [dsh-doc](../.agents/skills/dsh-doc/SKILL.md) for placement and validation, and [dsh-prose-standard](../.agents/skills/dsh-prose-standard/SKILL.md) for required coverage and editorial judgment; the [doc-tiers Agent Note](../.agents/notes/implemented/process/2026-07-04-doc-tiers-and-budgets.md) owns rationale.
4
+
5
+ ## Document structure
6
+
7
+ These rules apply to human-facing documentation; [Agent Notes](../.agents/notes/README.md) remain outside their scope. A [postmortem](postmortem/README.md) is an incident-scoped reference; chronology records evidence, not a teaching sequence. A document's subject and tree position fix its scope: describe its own subject at appropriate detail and direct children only by purpose, responsibility, and high-level behavior; link to the owning descendant for lower-level detail. Document type does not widen that scope. A reference may be exhaustive only about its own subject. Testing mechanisms, fixtures, and harnesses belong at the lowest owning level; higher documents link there.
8
+
9
+ Classify every in-scope document as a tutorial or reference. Tutorials follow an ordered path to an outcome and introduce only what each step needs. References define a lookup scope and current behavior without a teaching sequence. Separate substantial tutorial and reference content; label a section when either part is small.
10
+
11
+ Before writing a tutorial, privately classify the reader's starting knowledge and each concept as beginner, intermediate, or advanced. Establish prerequisites before dependent concepts, increase difficulty gradually, and move unnecessary advanced material to a later tutorial or reference.
12
+
13
+ Author in this order: locate the document in the tree; set its permitted detail; choose tutorial or reference; for a tutorial, order concepts by prerequisite and difficulty; relocate descendant-owned detail; replace lower-level explanations with links to their owners.
14
+
15
+ ## The tier taxonomy: one home per fact
16
+
17
+ Each fact has one home: the tier whose job it is; elsewhere, link there.
18
+
19
+ | Tier | Job | Does NOT belong there |
20
+ |---|---|---|
21
+ | Root `AGENTS.md` | Standing orders: rules an agent needs in context in every session, one to three lines each, linking its home | Stories, worked examples, situational procedures, anything restated from a linked home |
22
+ | Subtree `AGENTS.md` (`packages/`, `docs/`, `.agents/notes/`) | Orders specific to that subtree | Repo-wide rules the root file already carries |
23
+ | [architecture.md](architecture.md) | Ordered map: composition, core packages, loop, seams, extension points; read before changing `packages/` | Type definitions (→ subsystems), per-package detail (→ package READMEs), decision rationale (→ Agent Notes), implementation-status annotations |
24
+ | [subsystems/](subsystems/README.md) | One reference page per subsystem: type definitions, semantics, and the generated Cordis API | Behavior narration (→ architecture.md) |
25
+ | [Agent Notes](../.agents/notes/README.md) | Active decision records: the why, what-was-given-up, and required verification; `implemented/` notes describe shipped reality in present tense | Migration plans, acceptance-task checklists, fixture walkthroughs, and spec-speak ("should…") once the decision has shipped; archived notes are frozen history, never current authority |
26
+ | [postmortem/](postmortem/README.md) | Incident stories — the only tier where war-story narrative belongs | — |
27
+ | [cookbook/](cookbook/adding-a-package.md) | Step-by-step how-tos with numbered verify steps | Design rationale (→ the Agent Note each guide links) |
28
+ | [user/](user/index.md) | Product-facing guides published by the documentation website | Generated reference tables, contributor procedures, decision history |
29
+ | Package README | The per-package contract: config, semantics, limitations, extension points, and [Model Experience](cookbook/adding-a-package.md#4-write-the-package-readme) | JSDoc restatement, generated-catalog restatement (event/tool tables), other packages' concerns |
30
+ | [development.md](development.md) | Contributor setup, daily workflow, and a summary of CI; a bilingual pair under the [i18n contract](i18n/README.md) | Runtime/version rationale (→ Agent Notes), check-by-check lists that drift from `package.json` scripts |
31
+ | Generated reference: the per-page `cordis-surface` regions in [subsystems/](subsystems/README.md), the [Cordis core API + inherited tier](cordis-api/context.md), [tool-catalog](tool-catalog.md), [config-catalog](config-catalog.md), [persistence-catalog](persistence-catalog.md), [module-graph.md](module-graph.md) | Exhaustive English sources regenerated from source and freshness-gated; reviewed Chinese counterparts follow the [pairing workflow](i18n/README.md#scope-and-exclusions) | Hand edits to generated English sources or regions; Chinese counterparts update through pairing only |
32
+ | Skills (`.agents/skills/`) | Reusable workflows and specialized decision standards | Product and runtime contracts (→ docs or source) |
33
+
34
+ Placement: bugs → postmortems; rationale → Agent Notes; procedures → cookbooks; type definitions → subsystems; package contracts → READMEs; standing orders → root `AGENTS.md` with a rationale link.
35
+
36
+ ## Writing rules
37
+
38
+ - **Document current state, not change history.** Avoid "previously/now/no longer", PRs, commits, and stack positions in durable prose; name the live mechanism. Put change stories in commits, PRs, Agent Notes, or postmortems; the latter two may cite merged PRs and issues as evidence.
39
+ - **Every non-trivial change includes at least one Agent Note in the same PR.** Update the owning note or add one; only mechanical/local edits are exempt ([scope](../.agents/notes/README.md#when-to-write-one)).
40
+ - **One physical line per paragraph** (`verify-md-wrap`): use editor soft-wrap. Code blocks, tables, and list structure keep their formatting; code comments stay under the linter's column limit.
41
+ - **Fenced `ts` blocks must compile** (`doc-typecheck`); a pasted type declaration and its original JSDoc use ` ```ts type-equiv `, while a body-stripped public class declaration uses ` ```ts public-api `; register either in the manifest so neither can drift ([mechanics](development.md#documenting-types-verbatim-ts-type-equiv)).
42
+ - **The owning [subsystems page](subsystems/README.md) updates in the same change** that reshapes a documented type. `verify-type-equiv` catches drifted pastes, not never-documented new types; a type is documented on its declaring package group's page ([page scoping](../.agents/notes/implemented/process/2026-08-03-package-anchored-subsystem-pages.md)).
43
+ - **Pairs update together**: [Terminology-guided](i18n/terminology.md), single-pass active-agent work repositions first-use annotations, preserves untouched prose, and re-records; `dsh-translate-docs` remains user-invoked ([contract](i18n/README.md)).
44
+ - **Comments and JSDoc state complete contracts, not reasoning transcripts.** Preserve behavior, failure, timing, ownership, modality, exceptions, consequences, and non-obvious orientation; delete narration, test walkthroughs, review analysis, and code restatement. Keep the local contract and link its rationale. Use [dsh-prose-standard](../.agents/skills/dsh-prose-standard/SKILL.md) for details.
45
+ - Write directly: name actors and facts ([decision](../.agents/notes/implemented/process/2026-08-09-concrete-prose-names-actors-and-recorded-facts.md)). Reserve `seam` for the defined capability. Name the exact check, type, API, operation, or behavior instead of metaphorical "gate", "vocabulary", or "surface".
46
+
47
+ ## Wordcount Budgets
48
+
49
+ [scripts/doc-budgets.manifest.json](../scripts/doc-budgets.manifest.json) sets standing-doc ceilings; `pnpm run verify-doc-budgets` rejects excess or missing files.
50
+
51
+ When the gate goes red:
52
+
53
+ 1. **Relocate** content that belongs in another tier; leave a one-line link if needed.
54
+ 2. **Condense** content that belongs here but can be shorter.
55
+ 3. **Raise** the ceiling only when the words need the space; justify the manifest diff in the PR. A too-low ceiling is a budget bug.
56
+
57
+ Ceilings are guardrails, not reduction targets. At or below target, retain at least 5% headroom; above target, freeze the ceiling until relocation or condensation brings the document under target. Lower a ceiling only when the document still has room. Targets: root `AGENTS.md` ≤ 1,950; `architecture.md` ≤ 2,400; subtree `AGENTS.md` ≤ 600, except `packages/AGENTS.md` ≤ 750 and this file ≤ 1,320; `packages/README.md` ≤ 994; plus `cordis-primer.md` 600, `defensive-patterns.md` 550, `testing.md` 1,300, `examples/AGENTS.md` 310. Review governs unbudgeted tiers.
58
+
59
+ ## The slop checklist
60
+
61
+ Hunt these in any doc; [dsh-doc](../.agents/skills/dsh-doc/SKILL.md) runs this list as an audit:
62
+
63
+ - The same rule stated in more than one home. Grep a distinctive phrase; keep one home and link the rest.
64
+ - Narrated history or war stories: "previously", "now", "no longer", "used to", "renamed", "was moved", PRs, or commits. State the current fact; link an Agent Note or postmortem when needed.
65
+ - Implementation-status annotations in prose or diagrams ("implemented!", "future: …"). Status rots; the repo layout and package manifests carry it.
66
+ - Hand-restated catalogs, JSDoc, or inventories of tests, packages, and status when source or a generator is authoritative.
67
+ - Reasoning transcripts: step-by-step implementation narration, proof of obvious branches, test walkthroughs, or rejected local alternatives. Keep the resulting contract or durable rationale; delete the path used to derive it.
68
+ - Rationale repeated beside sibling methods instead of once at the owning capability or helper.
69
+ - Paragraph walls: one paragraph carrying several rules and parenthetical asides. Split it or demote the detail to its home.
70
+ - Emphasis inflation: bold, CAPS, or "critically" everywhere means nothing stands out. Reserve emphasis for the clause that changes behavior.
71
+ - Spec-speak in `implemented/` Agent Notes: "should", migration plans, acceptance checklists. An implemented Agent Note describes what is, per the [implemented-note instructions](../.agents/notes/implemented/AGENTS.md).
72
+
73
+ ## Cross-reference with machine-checkable links, never free prose
74
+
75
+ Link repository references with relative Markdown paths, never bare filenames or Agent Note numbers. `verify-md-links` rejects missing targets and dead `#fragment` anchors ([rationale](../.agents/notes/implemented/process/2026-06-18-markdown-cross-link-lint.md)).
@@ -0,0 +1,84 @@
1
+ <!-- Generated by scripts/gen-doc-graphs.ts - do not edit by hand.
2
+ Run `pnpm run gen-doc-graphs` to regenerate. -->
3
+
4
+ # Agent Turn And Step Lifecycle
5
+
6
+ This sequence is the visual companion to [architecture.md](architecture.md#turn-flow). It keeps durable replay facts on `session/event` and live control/status on `agent/*`.
7
+
8
+ ```mermaid
9
+ sequenceDiagram
10
+ participant User
11
+ participant Agent
12
+ participant Driver
13
+ participant Hooks as hook listeners
14
+ participant Prompt as ctx.systemPrompt
15
+ participant LLM as ctx.llm
16
+ participant Tools as ctx.tools
17
+ participant Session
18
+ participant SDK as UI or SDK listener
19
+ User->>Agent: followup(content)
20
+ Agent-->>SDK: <code>agent/inbox/spliced</code>
21
+ Agent-->>SDK: <code>agent/inbox/inserted</code> { message }
22
+ Agent->>Driver: queued work wakes driver
23
+ Driver-->>SDK: <code>agent/status</code> running
24
+ Driver->>Session: <code>turn/start</code>
25
+ Note over Agent,Driver: claim pending next-step input plus one queued prompt
26
+ Driver-->>SDK: <code>agent/inbox/spliced</code> pure deletion
27
+ Driver-->>SDK: <code>agent/inbox/claimed</code> { message, turn } per message
28
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
29
+ Hooks-->>Driver: authoritative reject or enter(messages)
30
+ alt proposed step rejected or pre-step failed
31
+ Driver-->>Driver: claimed batch stays removed, the open turn spends no step
32
+ else enter proposed step
33
+ Driver->>Session: <code>step/start</code>
34
+ Driver->>Session: <code>user/message</code> per entered message
35
+ Driver->>Prompt: <code>system-prompt/assemble</code> waterfall
36
+ Driver->>LLM: <code>agent/request</code> waterfall, then <code>llm/stream</code> waterfall
37
+ LLM-->>Driver: StreamChunk*
38
+ Driver-->>SDK: <code>agent/assistant-stream</code> chunk*
39
+ alt final adapter or terminal in-band request failure
40
+ Driver->>Session: <code>assistant/attempt</code>
41
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
42
+ Driver->>Session: <code>step/end</code>
43
+ Driver->>Hooks: <code>agent/request-error</code> waterfall
44
+ Hooks-->>Driver: return retry action or preserve the original error
45
+ else model request succeeded
46
+ Driver->>Session: <code>assistant/message</code>
47
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
48
+ Driver->>Tools: classify pending call by executionMode
49
+ loop barriers and bounded rolling pool, reclassify before start
50
+ opt call starts
51
+ Driver->>Session: <code>tool/call</code>
52
+ Driver->>Tools: ordered pre, concurrent execute
53
+ Tools-->>Session: tool-owned events when applicable
54
+ end
55
+ opt next model-order result ready
56
+ Driver->>Tools: ordered post
57
+ Driver->>Session: <code>tool/result</code>
58
+ end
59
+ end
60
+ Driver->>Session: <code>step/end</code>
61
+ opt natural stop and next-step inbox empty
62
+ Driver->>Hooks: <code>agent/turn-stopping</code> serial terminal checkpoint
63
+ end
64
+ opt next-step input is pending
65
+ Driver-->>Driver: claim pending next-step input
66
+ Driver-->>SDK: <code>agent/inbox/claimed</code> { message, turn } per message
67
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
68
+ Hooks-->>Driver: authoritative reject or enter(messages)
69
+ end
70
+ end
71
+ end
72
+ Driver->>Session: <code>turn/end</code>
73
+ Driver-->>SDK: <code>agent/status</code> idle
74
+ ```
75
+
76
+ The `assistant/message` event records every successful provider call, including content-less and `max-tokens` finishes, and embeds the exact compact timed stream. Empty content stays out of derived history. A failed, retried, cancelled, or stream-error attempt that reaches settlement without a surface message records its stream as `assistant/attempt`. Live `agent/assistant-stream` chunk frames are transient; replay reads either durable settlement, and a hard process loss before settlement leaves no durable attempt stream.
77
+
78
+ `dsh-compaction-basic` uses `agent/pre-step` for pressure before request derivation and `agent/request-error` only for canonical context overflow. Once either trigger qualifies, optional tool-result pruning runs before summary selection. Recovery works between the closed failed step and failed turn close, and opens a fresh retry turn only when pruning or summarization advances the surface replacement generation; otherwise the original request error remains authoritative.
79
+
80
+ The returned `agent/pre-step` decision is authoritative; listeners wrapping `next()` preserve downstream messages and `startsRequestSeries` unless replacement is intentional. Steering and injected context pass through the same waterfall after a later claim operation takes their next-step batch.
81
+
82
+ SDK users that need replayable transcript data should consume `session/event`; `agent/*` is the live coordination API for queue/status, prompt interception, request construction, steering, continuation, and errors.
83
+
84
+ Maintenance mode: curated Mermaid sequence; exact event signatures live in the generated Cordis catalog.
@@ -0,0 +1,86 @@
1
+ <!-- 英文源文件由 scripts/gen-doc-graphs.ts 生成;本中文文件是通过双语配对维护的经评审对侧。
2
+ 更新时先运行 `pnpm run gen-doc-graphs` 更新英文,再更新本文件并运行 `pnpm run verify-translation-pairing --write docs/agent-lifecycle.md` 重新记录配对。 -->
3
+
4
+ # Agent 轮次与步骤生命周期
5
+
6
+ [English](agent-lifecycle.md) | 中文
7
+
8
+ 此时序图是 [architecture.md](architecture.zh.md#turn-flow) 的配套图示。持久的回放事实保存在 `session/event` 中,实时控制与状态则保存在 `agent/*` 中。
9
+
10
+ ```mermaid
11
+ sequenceDiagram
12
+ participant User
13
+ participant Agent
14
+ participant Driver
15
+ participant Hooks as hook listeners
16
+ participant Prompt as ctx.systemPrompt
17
+ participant LLM as ctx.llm
18
+ participant Tools as ctx.tools
19
+ participant Session
20
+ participant SDK as UI or SDK listener
21
+ User->>Agent: followup(content)
22
+ Agent-->>SDK: <code>agent/inbox/spliced</code>
23
+ Agent-->>SDK: <code>agent/inbox/inserted</code> { message }
24
+ Agent->>Driver: queued work wakes driver
25
+ Driver-->>SDK: <code>agent/status</code> running
26
+ Driver->>Session: <code>turn/start</code>
27
+ Note over Agent,Driver: claim pending next-step input plus one queued prompt
28
+ Driver-->>SDK: <code>agent/inbox/spliced</code> pure deletion
29
+ Driver-->>SDK: <code>agent/inbox/claimed</code> { message, turn } per message
30
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
31
+ Hooks-->>Driver: authoritative reject or enter(messages)
32
+ alt proposed step rejected or pre-step failed
33
+ Driver-->>Driver: claimed batch stays removed, the open turn spends no step
34
+ else enter proposed step
35
+ Driver->>Session: <code>step/start</code>
36
+ Driver->>Session: <code>user/message</code> per entered message
37
+ Driver->>Prompt: <code>system-prompt/assemble</code> waterfall
38
+ Driver->>LLM: <code>agent/request</code> waterfall, then <code>llm/stream</code> waterfall
39
+ LLM-->>Driver: StreamChunk*
40
+ Driver-->>SDK: <code>agent/assistant-stream</code> chunk*
41
+ alt final adapter or terminal in-band request failure
42
+ Driver->>Session: <code>assistant/attempt</code>
43
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
44
+ Driver->>Session: <code>step/end</code>
45
+ Driver->>Hooks: <code>agent/request-error</code> waterfall
46
+ Hooks-->>Driver: return retry action or preserve the original error
47
+ else model request succeeded
48
+ Driver->>Session: <code>assistant/message</code>
49
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
50
+ Driver->>Tools: classify pending call by executionMode
51
+ loop barriers and bounded rolling pool, reclassify before start
52
+ opt call starts
53
+ Driver->>Session: <code>tool/call</code>
54
+ Driver->>Tools: ordered pre, concurrent execute
55
+ Tools-->>Session: tool-owned events when applicable
56
+ end
57
+ opt next model-order result ready
58
+ Driver->>Tools: ordered post
59
+ Driver->>Session: <code>tool/result</code>
60
+ end
61
+ end
62
+ Driver->>Session: <code>step/end</code>
63
+ opt natural stop and next-step inbox empty
64
+ Driver->>Hooks: <code>agent/turn-stopping</code> serial terminal checkpoint
65
+ end
66
+ opt next-step input is pending
67
+ Driver-->>Driver: claim pending next-step input
68
+ Driver-->>SDK: <code>agent/inbox/claimed</code> { message, turn } per message
69
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
70
+ Hooks-->>Driver: authoritative reject or enter(messages)
71
+ end
72
+ end
73
+ end
74
+ Driver->>Session: <code>turn/end</code>
75
+ Driver-->>SDK: <code>agent/status</code> idle
76
+ ```
77
+
78
+ `assistant/message` 事件会记录每次成功的提供方调用,包括返回空内容或以 `max-tokens` 结束的调用,并嵌入精确的紧凑带时间 stream。空内容不会进入派生历史。失败、重试、取消或 stream error attempt 到达 settlement 时,如果没有 surface message,就会把 stream 记录为 `assistant/attempt`。实时 `agent/assistant-stream` chunk frame 是瞬态数据;回放读取任一种持久 settlement,如果进程在 settlement 前硬中断,则不会留下持久 attempt stream。
79
+
80
+ `dsh-compaction-basic` 在派生请求之前通过 `agent/pre-step` 处理压力,而 `agent/request-error` 仅用于规范的上下文溢出。任一触发条件满足后,系统都会先执行可选的工具结果剪枝,再选择摘要。恢复发生在失败步骤结束之后、失败轮次结束之前;只有当剪枝或摘要生成推进了 surface replacement generation 时,系统才会开启一个全新的重试轮次,否则仍以原始请求错误为准。
81
+
82
+ 以返回的 `agent/pre-step` 决策为准;通过包装 `next()` 的监听器会保留下游消息与 `startsRequestSeries`,除非有意替换。steering(中途引导)和注入的上下文在后续的认领操作取得其下一步骤批次后,会经过同一 waterfall(瀑布式事件)。
83
+
84
+ 需要可回放 transcript(文本记录)数据的 SDK 用户应当消费 `session/event`;`agent/*` 是用于队列与状态、提示词拦截、请求构造、steering、继续执行和错误处理的实时协调接口。
85
+
86
+ 维护模式:英文源文件包含人工维护的 Mermaid 时序图,并由生成器写出;本中文文件作为经评审对侧通过双语配对维护。确切的事件签名位于生成的 Cordis 目录中。