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,220 @@
1
+ # System Prompt Assembly
2
+
3
+ English | [中文](system-prompt.zh.md)
4
+
5
+ The [system-prompt package](../../packages/core/system-prompt) owns the data exchanged between prompt contributors and one assembly call. The package [README](../../packages/core/system-prompt/README.md) documents registration, ordering, scoping, and rendering behavior; this page records the exact cross-package types that plugins implement or pass.
6
+
7
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts).
8
+
9
+ ## Assembly context
10
+
11
+ `AssembleContext` identifies the scope layer one assembly resolves and may carry the explicit control signal for that request. It is merge-extensible: `dsh-agent` adds the optional live `agent` field, and `assembleContextFor(agent, signal)` sets the explicit fields together. A bare assembly has neither scope nor signal.
12
+
13
+ ```ts type-equiv
14
+ /** Merge-extensible context for one prompt assembly. */
15
+ interface AssembleContext {
16
+ /**
17
+ * Scope whose providers and waterfall listeners participate. When absent,
18
+ * only global providers and subject-less listeners participate.
19
+ */
20
+ scope?: ScopeKey
21
+ /** Explicit control signal for the turn that requested this assembly, when any. */
22
+ signal?: AbortSignal
23
+ }
24
+ ```
25
+
26
+ ## Tool-provider result
27
+
28
+ `ToolProviderResult.schemas` is the model-visible set for the current assembly. `knownNames` is the provider's pre-restriction name universe used to distinguish a configured-name typo from a known tool that is deliberately hidden in this scope.
29
+
30
+ ```ts type-equiv
31
+ /** Tool schemas visible in one assembly and their pre-restriction name set. */
32
+ interface ToolProviderResult {
33
+ /** The schemas this provider contributes to THIS assembly. */
34
+ readonly schemas: readonly ToolSchema[]
35
+ /** The pre-restriction name universe for config validation (defaults to `schemas`' names). */
36
+ readonly knownNames?: readonly string[]
37
+ }
38
+ ```
39
+
40
+ ## Prompt sections
41
+
42
+ `PromptSection` is a readonly same-process registration contract. Its text may be static or resolved from the current assembly context. Sections sort by ascending order and then code-unit name; repository contributors resolve the service-owned named allocation through `getSectionOrder()`. Runtime-context contributors resolve their independent allocation through `getContextOrder()`. One effective `complete` section becomes the sole prompt section after cooperative assembly.
43
+
44
+ ```ts type-equiv
45
+ /** One contributed section of the system prompt (registry input). */
46
+ interface PromptSection {
47
+ /** Unique name — a duplicate registration throws (see {@link SystemPrompt.section}). */
48
+ readonly name: string
49
+ /**
50
+ * Sections are concatenated in ascending order. Equal orders use code-unit
51
+ * name order.
52
+ */
53
+ readonly order: number
54
+ /**
55
+ * Static text or a provider evaluated at each assembly with that assembly's
56
+ * {@link AssembleContext}. The text may reference `{{variable}}`s — they are
57
+ * interpolated later, by {@link renderPrompt}.
58
+ */
59
+ readonly text: string | ((context: AssembleContext) => string)
60
+ /**
61
+ * Treat this contribution as the complete system prompt. Assembly still
62
+ * runs the cooperative waterfall so tools, contexts, and variables can be
63
+ * resolved, then restores this exact section as the sole prompt section.
64
+ * More than one effective complete section makes assembly fail.
65
+ */
66
+ readonly complete?: boolean
67
+ }
68
+ ```
69
+
70
+ ## Dynamic prompt context
71
+
72
+ `PromptContext` is the cache-safe counterpart to `PromptSection`. The assembly resolves and orders these contributions, while agent-loop logs their complete current snapshot after retained model history only when it changed or compaction removed it.
73
+
74
+ ```ts type-equiv
75
+ /** Dynamic model context materialized as a durable user-role snapshot. */
76
+ interface PromptContext {
77
+ /** Unique name — a duplicate registration throws (see {@link SystemPrompt.context}). */
78
+ readonly name: string
79
+ /** Contexts are joined in ascending order. */
80
+ readonly order: number
81
+ /** Static text or a provider evaluated for each assembly. Empty text contributes nothing. */
82
+ readonly text: string | ((context: AssembleContext) => string)
83
+ }
84
+ ```
85
+
86
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
87
+
88
+ <a id="cordis-surface"></a>
89
+
90
+ ## Cordis API
91
+
92
+ 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).
93
+
94
+ <a id="ctxsystemprompt--systemprompt"></a>
95
+
96
+ ### `ctx.systemPrompt` — `SystemPrompt`
97
+
98
+ Registry service for the prompt inputs assembled before each model step.
99
+
100
+ ```ts cordis-catalog
101
+ /**
102
+ * Register an ordered prompt section in the calling context's scope. A scoped
103
+ * section shadows a global section with the same name; duplicates within one
104
+ * layer and non-finite orders throw. Registration and disposal emit
105
+ * `system-prompt/change`.
106
+ * @param section - the section to register.
107
+ * @returns the exact Cordis effect disposer.
108
+ */
109
+ section(section: PromptSection): () => void
110
+
111
+ /**
112
+ * Resolve the centrally owned placement of a repository prompt section.
113
+ * @param name - stable section placement name.
114
+ * @returns the section's numeric sort order.
115
+ */
116
+ getSectionOrder(name: PromptSectionOrderName): number
117
+
118
+ /**
119
+ * Resolve the centrally owned placement of a repository runtime context.
120
+ * @param name - stable context placement name.
121
+ * @returns the context's numeric sort order.
122
+ */
123
+ getContextOrder(name: PromptContextOrderName): number
124
+
125
+ /**
126
+ * Register ordered dynamic context in the calling context's scope. Scoped
127
+ * entries shadow global entries with the same name.
128
+ * @param context - the context contribution to register.
129
+ * @returns the exact Cordis effect disposer.
130
+ */
131
+ context(context: PromptContext): () => void
132
+
133
+ /**
134
+ * Suppress every dynamic runtime-context contribution in the calling
135
+ * context's scope without changing the services that own or enforce those
136
+ * facts. Multiple suppressors remain independently disposable.
137
+ * @returns the exact Cordis effect disposer.
138
+ */
139
+ suppressRuntimeContext(): () => void
140
+
141
+ /**
142
+ * Register a tool-schema provider in the calling context's scope. Global and
143
+ * matching scoped providers both contribute; returning the reserved
144
+ * {@link TOOL_ORDER_REST} name makes assembly fail.
145
+ * @param provider - evaluated for each assembly with its context.
146
+ * @returns the exact Cordis effect disposer.
147
+ */
148
+ tools(provider: (context: AssembleContext) => ToolProviderResult): () => void
149
+
150
+ /**
151
+ * Register a prompt variable in the calling context's scope. Scoped values
152
+ * shadow globals; invalid or duplicate names throw. A provider may return
153
+ * `undefined`, but rendering a section that references that value then fails.
154
+ * @param name - the `[a-z][a-z0-9_]*` reference name.
155
+ * @param provider - evaluated for each assembly.
156
+ * @returns the exact Cordis effect disposer.
157
+ */
158
+ variable(name: string, provider: (context: AssembleContext) => string | undefined): () => void
159
+
160
+ /**
161
+ * Assemble global and scoped providers, detach tool parameters, apply
162
+ * canonical ordering, then run the assembly waterfall. Scoped sections and
163
+ * variables shadow globals. The returned waterfall value is authoritative
164
+ * except that an effective complete section is restored afterwards as the
165
+ * sole prompt section.
166
+ * @param context - the optional scope and plugin-defined assembly fields.
167
+ * @returns the post-waterfall assembly with any complete prompt enforced.
168
+ */
169
+ async assemble(context: AssembleContext = {}): Promise<PromptAssembly>
170
+ ```
171
+
172
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)
173
+
174
+ <a id="system-prompt-events"></a>
175
+
176
+ ### `system-prompt/*` events
177
+
178
+ <a id="system-promptassemble--waterfall"></a>
179
+
180
+ #### `system-prompt/assemble` — waterfall
181
+
182
+ Expert waterfall over the assembled sections, contexts, tools, and variables. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): scoped listeners receive only that scope's assemblies. The returned value is authoritative. A supplied signal controls only this explicit assembly request and must not be retained to control later turns. A registered complete section is restored after this waterfall, so listeners cannot add to or replace that scope's system prompt.
183
+
184
+ ```ts cordis-catalog
185
+ /**
186
+ * Expert waterfall over the assembled sections, contexts, tools, and variables.
187
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): scoped listeners
188
+ * receive only that scope's assemblies. The returned value is authoritative.
189
+ * A supplied signal controls only this explicit assembly request and must not
190
+ * be retained to control later turns. A registered complete section is
191
+ * restored after this waterfall, so listeners cannot add to or replace
192
+ * that scope's system prompt.
193
+ * @param assembly - the mutable assembly built from registered providers.
194
+ * @param context - the caller's per-assembly context.
195
+ * @mode waterfall
196
+ */
197
+ 'system-prompt/assemble'(this: Scoped<SystemPrompt>, assembly: PromptAssembly, context: AssembleContext, next: () => Promise<PromptAssembly>): Promise<PromptAssembly>
198
+ ```
199
+
200
+ Types: [Scoped](scope.md)
201
+
202
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)
203
+
204
+ <a id="system-promptchange--emit"></a>
205
+
206
+ #### `system-prompt/change` — emit
207
+
208
+ Emitted when any prompt provider changes. This registry notification is unfiltered because a global change affects every scope.
209
+
210
+ ```ts cordis-catalog
211
+ /**
212
+ * Emitted when any prompt provider changes. This registry notification is
213
+ * unfiltered because a global change affects every scope.
214
+ * @mode emit
215
+ */
216
+ 'system-prompt/change'(): void
217
+ ```
218
+
219
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)
220
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,220 @@
1
+ # 系统提示词组装
2
+
3
+ [English](system-prompt.md) | 中文
4
+
5
+ [system-prompt 包](../../packages/core/system-prompt)负责管理提示词贡献者与一次组装调用之间交换的数据。该包的 [README](../../packages/core/system-prompt/README.zh.md) 记录注册、排序、作用域与渲染行为;本页记录各插件实现或传递的确切跨包类型。
6
+
7
+ 源码:[`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)。
8
+
9
+ ## 组装上下文
10
+
11
+ `AssembleContext` 标识一次组装所解析的作用域层,并可携带该请求的显式控制信号。它可合并扩展:`dsh-agent` 添加可选字段 `agent`,用于携带当前的 agent(智能体)实例;`assembleContextFor(agent, signal)` 则一起设置这些显式字段。裸组装既没有作用域,也没有信号。
12
+
13
+ ```ts type-equiv
14
+ /** Merge-extensible context for one prompt assembly. */
15
+ interface AssembleContext {
16
+ /**
17
+ * Scope whose providers and waterfall listeners participate. When absent,
18
+ * only global providers and subject-less listeners participate.
19
+ */
20
+ scope?: ScopeKey
21
+ /** Explicit control signal for the turn that requested this assembly, when any. */
22
+ signal?: AbortSignal
23
+ }
24
+ ```
25
+
26
+ ## 工具提供方结果
27
+
28
+ `ToolProviderResult.schemas` 是当前组装中对模型可见的工具 schema 集合。`knownNames` 是提供方在限制前的名称全集,用于区分「配置名拼写错误」与「已知工具在此作用域中被有意隐藏」。
29
+
30
+ ```ts type-equiv
31
+ /** Tool schemas visible in one assembly and their pre-restriction name set. */
32
+ interface ToolProviderResult {
33
+ /** The schemas this provider contributes to THIS assembly. */
34
+ readonly schemas: readonly ToolSchema[]
35
+ /** The pre-restriction name universe for config validation (defaults to `schemas`' names). */
36
+ readonly knownNames?: readonly string[]
37
+ }
38
+ ```
39
+
40
+ ## 提示词段落
41
+
42
+ `PromptSection` 是一份只读的同进程注册约定。其文本可以是静态的,也可以从当前组装上下文动态解析。各段先按 order 升序排列,再按名称的代码单元顺序排列;仓库贡献方通过 `getSectionOrder()` 解析服务持有的具名分配。Runtime-context 贡献方通过 `getContextOrder()` 解析独立分配。协作式组装完成后,一个有效的 `complete` 段会成为唯一的提示词段落。
43
+
44
+ ```ts type-equiv
45
+ /** One contributed section of the system prompt (registry input). */
46
+ interface PromptSection {
47
+ /** Unique name — a duplicate registration throws (see {@link SystemPrompt.section}). */
48
+ readonly name: string
49
+ /**
50
+ * Sections are concatenated in ascending order. Equal orders use code-unit
51
+ * name order.
52
+ */
53
+ readonly order: number
54
+ /**
55
+ * Static text or a provider evaluated at each assembly with that assembly's
56
+ * {@link AssembleContext}. The text may reference `{{variable}}`s — they are
57
+ * interpolated later, by {@link renderPrompt}.
58
+ */
59
+ readonly text: string | ((context: AssembleContext) => string)
60
+ /**
61
+ * Treat this contribution as the complete system prompt. Assembly still
62
+ * runs the cooperative waterfall so tools, contexts, and variables can be
63
+ * resolved, then restores this exact section as the sole prompt section.
64
+ * More than one effective complete section makes assembly fail.
65
+ */
66
+ readonly complete?: boolean
67
+ }
68
+ ```
69
+
70
+ ## 动态提示词上下文
71
+
72
+ `PromptContext` 是与 `PromptSection` 对应的缓存安全结构。组装会解析这些贡献并排序;agent loop(智能体循环)仅在完整当前快照发生变化或被压缩(compaction)移除时,才会将其记录在保留的模型历史之后。
73
+
74
+ ```ts type-equiv
75
+ /** Dynamic model context materialized as a durable user-role snapshot. */
76
+ interface PromptContext {
77
+ /** Unique name — a duplicate registration throws (see {@link SystemPrompt.context}). */
78
+ readonly name: string
79
+ /** Contexts are joined in ascending order. */
80
+ readonly order: number
81
+ /** Static text or a provider evaluated for each assembly. Empty text contributes nothing. */
82
+ readonly text: string | ((context: AssembleContext) => string)
83
+ }
84
+ ```
85
+
86
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
87
+
88
+ <a id="cordis-surface"></a>
89
+
90
+ ## Cordis API
91
+
92
+ 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.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
93
+
94
+ <a id="ctxsystemprompt--systemprompt"></a>
95
+
96
+ ### `ctx.systemPrompt` — `SystemPrompt`
97
+
98
+ Registry service for the prompt inputs assembled before each model step.
99
+
100
+ ```ts cordis-catalog
101
+ /**
102
+ * Register an ordered prompt section in the calling context's scope. A scoped
103
+ * section shadows a global section with the same name; duplicates within one
104
+ * layer and non-finite orders throw. Registration and disposal emit
105
+ * `system-prompt/change`.
106
+ * @param section - the section to register.
107
+ * @returns the exact Cordis effect disposer.
108
+ */
109
+ section(section: PromptSection): () => void
110
+
111
+ /**
112
+ * Resolve the centrally owned placement of a repository prompt section.
113
+ * @param name - stable section placement name.
114
+ * @returns the section's numeric sort order.
115
+ */
116
+ getSectionOrder(name: PromptSectionOrderName): number
117
+
118
+ /**
119
+ * Resolve the centrally owned placement of a repository runtime context.
120
+ * @param name - stable context placement name.
121
+ * @returns the context's numeric sort order.
122
+ */
123
+ getContextOrder(name: PromptContextOrderName): number
124
+
125
+ /**
126
+ * Register ordered dynamic context in the calling context's scope. Scoped
127
+ * entries shadow global entries with the same name.
128
+ * @param context - the context contribution to register.
129
+ * @returns the exact Cordis effect disposer.
130
+ */
131
+ context(context: PromptContext): () => void
132
+
133
+ /**
134
+ * Suppress every dynamic runtime-context contribution in the calling
135
+ * context's scope without changing the services that own or enforce those
136
+ * facts. Multiple suppressors remain independently disposable.
137
+ * @returns the exact Cordis effect disposer.
138
+ */
139
+ suppressRuntimeContext(): () => void
140
+
141
+ /**
142
+ * Register a tool-schema provider in the calling context's scope. Global and
143
+ * matching scoped providers both contribute; returning the reserved
144
+ * {@link TOOL_ORDER_REST} name makes assembly fail.
145
+ * @param provider - evaluated for each assembly with its context.
146
+ * @returns the exact Cordis effect disposer.
147
+ */
148
+ tools(provider: (context: AssembleContext) => ToolProviderResult): () => void
149
+
150
+ /**
151
+ * Register a prompt variable in the calling context's scope. Scoped values
152
+ * shadow globals; invalid or duplicate names throw. A provider may return
153
+ * `undefined`, but rendering a section that references that value then fails.
154
+ * @param name - the `[a-z][a-z0-9_]*` reference name.
155
+ * @param provider - evaluated for each assembly.
156
+ * @returns the exact Cordis effect disposer.
157
+ */
158
+ variable(name: string, provider: (context: AssembleContext) => string | undefined): () => void
159
+
160
+ /**
161
+ * Assemble global and scoped providers, detach tool parameters, apply
162
+ * canonical ordering, then run the assembly waterfall. Scoped sections and
163
+ * variables shadow globals. The returned waterfall value is authoritative
164
+ * except that an effective complete section is restored afterwards as the
165
+ * sole prompt section.
166
+ * @param context - the optional scope and plugin-defined assembly fields.
167
+ * @returns the post-waterfall assembly with any complete prompt enforced.
168
+ */
169
+ async assemble(context: AssembleContext = {}): Promise<PromptAssembly>
170
+ ```
171
+
172
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)
173
+
174
+ <a id="system-prompt-events"></a>
175
+
176
+ ### `system-prompt/*` events
177
+
178
+ <a id="system-promptassemble--waterfall"></a>
179
+
180
+ #### `system-prompt/assemble` — waterfall
181
+
182
+ Expert waterfall over the assembled sections, contexts, tools, and variables. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): scoped listeners receive only that scope's assemblies. The returned value is authoritative. A supplied signal controls only this explicit assembly request and must not be retained to control later turns. A registered complete section is restored after this waterfall, so listeners cannot add to or replace that scope's system prompt.
183
+
184
+ ```ts cordis-catalog
185
+ /**
186
+ * Expert waterfall over the assembled sections, contexts, tools, and variables.
187
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): scoped listeners
188
+ * receive only that scope's assemblies. The returned value is authoritative.
189
+ * A supplied signal controls only this explicit assembly request and must not
190
+ * be retained to control later turns. A registered complete section is
191
+ * restored after this waterfall, so listeners cannot add to or replace
192
+ * that scope's system prompt.
193
+ * @param assembly - the mutable assembly built from registered providers.
194
+ * @param context - the caller's per-assembly context.
195
+ * @mode waterfall
196
+ */
197
+ 'system-prompt/assemble'(this: Scoped<SystemPrompt>, assembly: PromptAssembly, context: AssembleContext, next: () => Promise<PromptAssembly>): Promise<PromptAssembly>
198
+ ```
199
+
200
+ Types: [Scoped](scope.zh.md)
201
+
202
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)
203
+
204
+ <a id="system-promptchange--emit"></a>
205
+
206
+ #### `system-prompt/change` — emit
207
+
208
+ Emitted when any prompt provider changes. This registry notification is unfiltered because a global change affects every scope.
209
+
210
+ ```ts cordis-catalog
211
+ /**
212
+ * Emitted when any prompt provider changes. This registry notification is
213
+ * unfiltered because a global change affects every scope.
214
+ * @mode emit
215
+ */
216
+ 'system-prompt/change'(): void
217
+ ```
218
+
219
+ Source: [`packages/core/system-prompt/src/index.ts`](../../packages/core/system-prompt/src/index.ts)
220
+ <!-- END GENERATED cordis-surface -->
@@ -0,0 +1,184 @@
1
+ # Persistent PTY Sessions
2
+
3
+ English | [中文](terminal.zh.md)
4
+
5
+ Types shared by PTY backends, `ctx.terminals`, and the model-facing consumer. The [persistent PTY Agent Note](../../.agents/notes/implemented/feature/2026-07-16-persistent-pty-sessions.md) owns the rationale; this page records the cross-package vocabulary from [`packages/terminal/terminal/src/types.ts`](../../packages/terminal/terminal/src/types.ts).
6
+
7
+ ## Identity and readiness
8
+
9
+ `TerminalSessionId` is a service-minted branded id. Optional names are owner-local display metadata; authorization compares the exact owning `Agent`, not a name or guessed id.
10
+
11
+ `TerminalWaitReason` says why one send returned. It is independent from `TerminalSessionStatus`: silence or timeout may return while the top-level shell remains alive, while `session_exit` means that shell exited rather than an arbitrary foreground child.
12
+
13
+ ```ts type-equiv
14
+ /** Why one interactive send returned control to its caller. */
15
+ type TerminalWaitReason = 'stdin_read' | 'inferred_idle' | 'timeout' | 'session_exit'
16
+ ```
17
+
18
+ ```ts type-equiv
19
+ /** Top-level PTY process status, independent of a send's wait reason. */
20
+ type TerminalSessionStatus =
21
+ | { kind: 'running' }
22
+ | { kind: 'exited'; exitCode: number | null; signal: NodeJS.Signals | null }
23
+ ```
24
+
25
+ ## Backend and live session
26
+
27
+ A backend owns how one registered type starts and detects readiness. `TerminalSessionService` publishes the returned session only after setup succeeds, then owns id authorization and cleanup. A backend that cannot clean partial startup resources rejects with `TerminalBackendCleanupError`, allowing disposal to retain the cleanup failure without replacing the caller's cancellation reason. A backend session owns terminal state and captured-resource quiescence.
28
+
29
+ ```ts type-equiv
30
+ /** Replaceable provider for one PTY session type. */
31
+ interface TerminalBackend {
32
+ /** Stable type selected by {@link TerminalSpawnRequest.type}. */
33
+ readonly type: string
34
+ /** Create an unpublished session or reject after cleaning partial resources; cleanup failure uses {@link TerminalBackendCleanupError}. */
35
+ spawn(spec: TerminalBackendSpawnSpec): Promise<TerminalBackendSession>
36
+ }
37
+ ```
38
+
39
+ ```ts type-equiv
40
+ /** Backend-owned live session retained by {@link TerminalSessionService}. */
41
+ interface TerminalBackendSession {
42
+ /** Initial bounded terminal output returned from `terminal_open`. */
43
+ readonly motd: string
44
+ /** Top-level process id when one exists. */
45
+ readonly pid?: number
46
+ /** Start one exclusive send operation. */
47
+ startSend(request: TerminalSendRequest): TerminalSendOperation
48
+ /** Read one bounded page from retained scrollback. */
49
+ read(request: TerminalReadRequest): TerminalReadResult
50
+ /** Signal the verified foreground process group. */
51
+ signal(signal: TerminalSignal): Promise<TerminalSignalResult>
52
+ /** Observe top-level process status. */
53
+ status(): TerminalSessionStatus
54
+ /** Idempotently close the captured owned process tree and await quiescence. */
55
+ close(reason: string): Promise<void>
56
+ }
57
+ ```
58
+
59
+ ## Send and retained output
60
+
61
+ One live session accepts one active send. Its operation exposes a consuming output cursor for generic background jobs and one terminal result for a foreground caller. `TerminalReadResult` separately pages the bounded session scrollback.
62
+
63
+ ```ts type-equiv
64
+ /** Live backend-owned send; exactly one may be active per PTY session. */
65
+ interface TerminalSendOperation {
66
+ /** Resolves after readiness, timeout, cancellation, or top-level process exit. */
67
+ done: Promise<TerminalSendResult>
68
+ /** Consume output produced since the prior call. */
69
+ readOutput(): TerminalSendRead
70
+ /** Request `SIGINT`; returns false after the operation settled. */
71
+ cancel(): boolean
72
+ }
73
+ ```
74
+
75
+ ```ts type-equiv
76
+ /** Settled result for one foreground or background send. */
77
+ interface TerminalSendResult {
78
+ /** Bounded rendered terminal delta remaining at settlement. */
79
+ viewport: string
80
+ /** Why the wait returned; this does not imply arbitrary child-process exit. */
81
+ waitReason: TerminalWaitReason
82
+ /** Top-level session status observed at settlement. */
83
+ sessionStatus: TerminalSessionStatus
84
+ /** Whether output was dropped from the operation or retained scrollback. */
85
+ truncated: boolean
86
+ }
87
+ ```
88
+
89
+ ## Ownership and durability
90
+
91
+ `TerminalSessionService` attaches one awaited cleanup to the exact owner scope, rejects foreign operations, and keeps sessions alive across backend or tool-plugin reload. PTY state and raw bytes remain process-local. Model input and bounded returned output are durable through the existing `tool/call`, `tool/result`, and task-result paths rather than duplicate PTY session events.
92
+
93
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
94
+
95
+ <a id="cordis-surface"></a>
96
+
97
+ ## Cordis API
98
+
99
+ 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).
100
+
101
+ <a id="ctxterminals--terminalsessionservice"></a>
102
+
103
+ ### `ctx.terminals` — `TerminalSessionService`
104
+
105
+ In-process registry for replaceable PTY backends and exact-Agent sessions.
106
+
107
+ ```ts cordis-catalog
108
+ /**
109
+ * Register one backend type for this effect scope.
110
+ * @param backend - provider with a non-empty unique type.
111
+ * @returns disposer that removes exactly this contribution.
112
+ */
113
+ registerBackend(backend: TerminalBackend): () => void
114
+
115
+ /**
116
+ * List registered backend types in registration order.
117
+ * @returns fresh backend type names.
118
+ */
119
+ listBackends(): string[]
120
+
121
+ /**
122
+ * Create and publish one owner-scoped session after backend setup succeeds.
123
+ * @param owner - exact registered Agent that owns access and cleanup.
124
+ * @param request - backend type plus optional owner-local name and cwd.
125
+ * @param signal - cancellation of unpublished setup.
126
+ * @returns published identity, metadata, status, and MOTD.
127
+ */
128
+ async spawn(owner: Agent, request: TerminalSpawnRequest, signal?: AbortSignal): Promise<TerminalSpawnResult>
129
+
130
+ /**
131
+ * Test whether an exact owner has a published session or unpublished spawn.
132
+ * @param owner - exact live owner to inspect.
133
+ * @returns true across the entire spawn-to-close interval, with no publication gap.
134
+ */
135
+ hasOwnerActivity(owner: Agent): boolean
136
+
137
+ /**
138
+ * Start one exclusive interactive send.
139
+ * @param owner - exact session owner.
140
+ * @param id - target PTY identity.
141
+ * @param request - explicit text, submit behavior, and cancellation.
142
+ * @returns live operation handle for foreground await or task registration.
143
+ */
144
+ startSend(owner: Agent, id: TerminalSessionId, request: TerminalSendRequest): TerminalSendOperation
145
+
146
+ /**
147
+ * Read one bounded scrollback page from an owned session.
148
+ * @param owner - exact session owner.
149
+ * @param id - target PTY identity.
150
+ * @param request - optional newest-relative offset and line count.
151
+ * @returns bounded retained text and pagination metadata.
152
+ */
153
+ read(owner: Agent, id: TerminalSessionId, request: TerminalReadRequest = {}): TerminalReadResult
154
+
155
+ /**
156
+ * Deliver an allowed signal through an owned backend session.
157
+ * @param owner - exact session owner.
158
+ * @param id - target PTY identity.
159
+ * @param signal - allowed POSIX signal name.
160
+ * @returns delivered foreground process-group identity.
161
+ */
162
+ signal(owner: Agent, id: TerminalSessionId, signal: TerminalSignal): Promise<TerminalSignalResult>
163
+
164
+ /**
165
+ * Close one owned session and remove it only after quiescent backend cleanup.
166
+ * @param owner - exact session owner.
167
+ * @param id - target PTY identity.
168
+ * @param reason - diagnostic cleanup reason.
169
+ * @returns true for a newly closed session, false when the same close is already in flight.
170
+ */
171
+ async kill(owner: Agent, id: TerminalSessionId, reason: string = 'model request'): Promise<boolean>
172
+
173
+ /**
174
+ * List fresh snapshots for exactly one owner.
175
+ * @param owner - exact owner whose sessions are visible.
176
+ * @returns owner-visible snapshots in publication order.
177
+ */
178
+ list(owner: Agent): TerminalSessionSnapshot[]
179
+ ```
180
+
181
+ Types: [Agent](core.md)
182
+
183
+ Source: [`packages/terminal/terminal/src/index.ts`](../../packages/terminal/terminal/src/index.ts)
184
+ <!-- END GENERATED cordis-surface -->