dsh-plugin-dev-kb 1.4.0 → 1.5.2

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 (415) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.en.md +6 -6
  3. package/README.md +10 -5
  4. package/kb/INDEX.md +8 -4
  5. package/kb/extra/AGENTS.md +4 -3
  6. package/kb/extra/agent-lifecycle.md +91 -0
  7. package/kb/extra/agent-lifecycle.zh.md +93 -0
  8. package/kb/extra/api-gateway.md +172 -0
  9. package/kb/extra/api-gateway.zh.md +178 -0
  10. package/kb/extra/architecture.md +165 -0
  11. package/kb/extra/architecture.zh.md +169 -0
  12. package/kb/extra/capability-seams.md +714 -0
  13. package/kb/extra/capability-seams.zh.md +716 -0
  14. package/kb/extra/cli-help.md +203 -0
  15. package/kb/extra/cli-help.zh.md +205 -0
  16. package/kb/extra/config-catalog.md +4801 -0
  17. package/kb/extra/config-catalog.zh.md +4803 -0
  18. package/kb/extra/cookbook/adding-a-package.md +170 -0
  19. package/kb/extra/cookbook/adding-a-package.zh.md +170 -0
  20. package/kb/extra/cookbook/adding-a-plugin-preview.md +52 -0
  21. package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +52 -0
  22. package/kb/extra/cookbook/adding-a-session-format-version.md +7 -5
  23. package/kb/extra/cookbook/adding-a-session-format-version.zh.md +7 -5
  24. package/kb/extra/cookbook/adding-a-settings-card.md +72 -0
  25. package/kb/extra/cookbook/adding-a-settings-card.zh.md +72 -0
  26. package/kb/extra/cookbook/adding-a-tool.md +101 -0
  27. package/kb/extra/cookbook/adding-a-tool.zh.md +103 -0
  28. package/kb/extra/cookbook/adding-an-llm-adapter.md +43 -0
  29. package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +43 -0
  30. package/kb/extra/cookbook/extension-cookbook.md +132 -0
  31. package/kb/extra/cookbook/extension-cookbook.zh.md +136 -0
  32. package/kb/extra/cookbook/reviewing-persistence-type-changes.md +11 -9
  33. package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +11 -9
  34. package/kb/extra/cordis-api/context.md +364 -0
  35. package/kb/extra/cordis-api/context.zh.md +366 -0
  36. package/kb/extra/cordis-api/events.md +207 -0
  37. package/kb/extra/cordis-api/events.zh.md +209 -0
  38. package/kb/extra/cordis-api/fiber.md +375 -0
  39. package/kb/extra/cordis-api/fiber.zh.md +377 -0
  40. package/kb/extra/cordis-api/inherited.md +38 -0
  41. package/kb/extra/cordis-api/registry.md +152 -0
  42. package/kb/extra/cordis-api/registry.zh.md +154 -0
  43. package/kb/extra/cordis-api/service.md +102 -0
  44. package/kb/extra/cordis-api/service.zh.md +104 -0
  45. package/kb/extra/cordis-tutorial/01-first-plugin.md +95 -0
  46. package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +95 -0
  47. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  48. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
  49. package/kb/extra/cordis-tutorial/03-services.md +98 -0
  50. package/kb/extra/cordis-tutorial/03-services.zh.md +98 -0
  51. package/kb/extra/cordis-tutorial/04-events.md +144 -0
  52. package/kb/extra/cordis-tutorial/04-events.zh.md +144 -0
  53. package/kb/extra/cordis-tutorial/05-config.md +111 -0
  54. package/kb/extra/cordis-tutorial/05-config.zh.md +111 -0
  55. package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +113 -0
  56. package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
  57. package/kb/extra/cordis-tutorial/07-into-the-harness.md +108 -0
  58. package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +108 -0
  59. package/kb/extra/cordis-tutorial/index.md +60 -0
  60. package/kb/extra/cordis-tutorial/index.zh.md +62 -0
  61. package/kb/extra/deepseek-llm-api-wire-extensions.md +5 -5
  62. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +5 -5
  63. package/kb/extra/defensive-patterns/README.md +25 -0
  64. package/kb/extra/defensive-patterns/README.zh.md +27 -0
  65. package/kb/extra/defensive-patterns/client-components.md +493 -0
  66. package/kb/extra/defensive-patterns/client-components.zh.md +495 -0
  67. package/kb/extra/defensive-patterns/conversation-and-session.md +316 -0
  68. package/kb/extra/defensive-patterns/conversation-and-session.zh.md +316 -0
  69. package/kb/extra/defensive-patterns/general.md +222 -0
  70. package/kb/extra/defensive-patterns/general.zh.md +252 -0
  71. package/kb/extra/defensive-patterns/package-surface.md +231 -0
  72. package/kb/extra/defensive-patterns/package-surface.zh.md +231 -0
  73. package/kb/extra/defensive-patterns/remote-and-api.md +115 -0
  74. package/kb/extra/defensive-patterns/remote-and-api.zh.md +115 -0
  75. package/kb/extra/development.md +31 -11
  76. package/kb/extra/development.zh.md +32 -11
  77. package/kb/extra/event-producer-consumer.md +40 -39
  78. package/kb/extra/event-producer-consumer.zh.md +40 -39
  79. package/kb/extra/experimental-persistence-catalog.md +17 -0
  80. package/kb/extra/experimental-persistence-catalog.zh.md +17 -0
  81. package/kb/extra/glossary.md +1 -0
  82. package/kb/extra/glossary.zh.md +1 -0
  83. package/kb/extra/i18n/style-samples.md +2 -2
  84. package/kb/extra/i18n/terminology.md +1 -0
  85. package/kb/extra/module-graph.md +274 -195
  86. package/kb/extra/module-graph.zh.md +274 -195
  87. package/kb/extra/persistence-catalog.md +9140 -0
  88. package/kb/extra/persistence-catalog.zh.md +9142 -0
  89. package/kb/extra/persistence-changes/2026-09-13-working-directory.md +48 -0
  90. package/kb/extra/persistence-changes/2026-09-13-working-directory.zh.md +48 -0
  91. package/kb/extra/persistence-changes/2026-09-16-session-format-v4.md +2 -2
  92. package/kb/extra/persistence-changes/2026-09-16-session-format-v4.zh.md +2 -2
  93. package/kb/extra/persistence-changes/2026-09-19-external-subagent-catalog.md +48 -0
  94. package/kb/extra/persistence-changes/2026-09-19-external-subagent-catalog.zh.md +48 -0
  95. package/kb/extra/persistence-changes/2026-09-30-job-session-lifecycle.md +52 -0
  96. package/kb/extra/persistence-changes/2026-09-30-job-session-lifecycle.zh.md +52 -0
  97. package/kb/extra/persistence-changes/2026-10-05-ptc-operation-metadata.md +48 -0
  98. package/kb/extra/persistence-changes/2026-10-05-ptc-operation-metadata.zh.md +48 -0
  99. package/kb/extra/persistence-changes/2026-10-05-working-directory-attribution.md +60 -0
  100. package/kb/extra/persistence-changes/2026-10-05-working-directory-attribution.zh.md +60 -0
  101. package/kb/extra/persistence-changes/2026-10-07-title-reasoning-effort.md +48 -0
  102. package/kb/extra/persistence-changes/2026-10-07-title-reasoning-effort.zh.md +48 -0
  103. package/kb/extra/persistence-changes/2026-10-13-deepseek-search-thinking.md +48 -0
  104. package/kb/extra/persistence-changes/2026-10-13-deepseek-search-thinking.zh.md +48 -0
  105. package/kb/extra/persistence-changes/2026-10-13-user-rpc-principal.md +60 -0
  106. package/kb/extra/persistence-changes/2026-10-13-user-rpc-principal.zh.md +60 -0
  107. package/kb/extra/persistence-changes/README.md +12 -10
  108. package/kb/extra/persistence-changes/README.zh.md +12 -10
  109. package/kb/extra/persistence-changes/historical-formats/README.md +1 -1
  110. package/kb/extra/persistence-changes/historical-formats/README.zh.md +1 -1
  111. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.2.md +50 -50
  112. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.2.zh.md +50 -50
  113. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.3.md +14 -14
  114. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.3.zh.md +14 -14
  115. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.7.md +3 -3
  116. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.7.zh.md +3 -3
  117. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.8.md +10 -10
  118. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.8.zh.md +10 -10
  119. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.1.md +3 -3
  120. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.1.zh.md +3 -3
  121. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.2.md +13 -13
  122. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.2.zh.md +13 -13
  123. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.1.md +63 -63
  124. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.1.zh.md +63 -63
  125. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.2.md +54 -54
  126. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.2.zh.md +54 -54
  127. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.4.md +7 -7
  128. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.4.zh.md +7 -7
  129. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.1.md +27 -27
  130. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.1.zh.md +27 -27
  131. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.2.md +4 -4
  132. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.2.zh.md +4 -4
  133. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.1.md +27 -27
  134. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.1.zh.md +27 -27
  135. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.2.md +7 -7
  136. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.2.zh.md +7 -7
  137. package/kb/extra/session-format-status.md +6 -6
  138. package/kb/extra/session-format-status.zh.md +6 -6
  139. package/kb/extra/subsystems/README.md +76 -0
  140. package/kb/extra/subsystems/README.zh.md +76 -0
  141. package/kb/extra/subsystems/agent-team.md +10 -10
  142. package/kb/extra/subsystems/agent-team.zh.md +10 -10
  143. package/kb/extra/subsystems/approval.md +170 -0
  144. package/kb/extra/subsystems/approval.zh.md +170 -0
  145. package/kb/extra/subsystems/boot.md +128 -4
  146. package/kb/extra/subsystems/boot.zh.md +128 -4
  147. package/kb/extra/subsystems/claude-code-mods.md +1 -1
  148. package/kb/extra/subsystems/claude-code-mods.zh.md +1 -1
  149. package/kb/extra/subsystems/client-modules.md +198 -0
  150. package/kb/extra/subsystems/client-modules.zh.md +198 -0
  151. package/kb/extra/subsystems/client-resources.md +92 -0
  152. package/kb/extra/subsystems/client-resources.zh.md +92 -0
  153. package/kb/extra/subsystems/commands.md +223 -0
  154. package/kb/extra/subsystems/commands.zh.md +223 -0
  155. package/kb/extra/subsystems/compaction.md +284 -0
  156. package/kb/extra/subsystems/compaction.zh.md +284 -0
  157. package/kb/extra/subsystems/computer-use.md +3 -0
  158. package/kb/extra/subsystems/computer-use.zh.md +3 -0
  159. package/kb/extra/subsystems/conversation.md +301 -0
  160. package/kb/extra/subsystems/conversation.zh.md +303 -0
  161. package/kb/extra/subsystems/core.md +1113 -0
  162. package/kb/extra/subsystems/core.zh.md +1125 -0
  163. package/kb/extra/subsystems/credentials.md +493 -0
  164. package/kb/extra/subsystems/credentials.zh.md +493 -0
  165. package/kb/extra/subsystems/filesystem.md +530 -0
  166. package/kb/extra/subsystems/filesystem.zh.md +530 -0
  167. package/kb/extra/subsystems/goal.md +313 -0
  168. package/kb/extra/subsystems/goal.zh.md +313 -0
  169. package/kb/extra/subsystems/jobs.md +554 -0
  170. package/kb/extra/subsystems/jobs.zh.md +554 -0
  171. package/kb/extra/subsystems/llm-streaming.md +1196 -0
  172. package/kb/extra/subsystems/llm-streaming.zh.md +1202 -0
  173. package/kb/extra/subsystems/lsp.md +202 -0
  174. package/kb/extra/subsystems/lsp.zh.md +202 -0
  175. package/kb/extra/subsystems/permission-presets.md +167 -0
  176. package/kb/extra/subsystems/permission-presets.zh.md +167 -0
  177. package/kb/extra/subsystems/persistence.md +418 -0
  178. package/kb/extra/subsystems/persistence.zh.md +418 -0
  179. package/kb/extra/subsystems/plan.md +87 -0
  180. package/kb/extra/subsystems/plan.zh.md +87 -0
  181. package/kb/extra/subsystems/product-telemetry.md +4 -2
  182. package/kb/extra/subsystems/product-telemetry.zh.md +4 -2
  183. package/kb/extra/subsystems/ptc-runtime.md +250 -0
  184. package/kb/extra/subsystems/ptc-runtime.zh.md +250 -0
  185. package/kb/extra/subsystems/sandbox.md +221 -0
  186. package/kb/extra/subsystems/sandbox.zh.md +221 -0
  187. package/kb/extra/subsystems/schedule.md +550 -0
  188. package/kb/extra/subsystems/schedule.zh.md +550 -0
  189. package/kb/extra/subsystems/scope.md +59 -0
  190. package/kb/extra/subsystems/scope.zh.md +61 -0
  191. package/kb/extra/subsystems/session-projection.md +356 -0
  192. package/kb/extra/subsystems/session-projection.zh.md +356 -0
  193. package/kb/extra/subsystems/session-query.md +511 -0
  194. package/kb/extra/subsystems/session-query.zh.md +511 -0
  195. package/kb/extra/subsystems/session-reference.md +224 -0
  196. package/kb/extra/subsystems/session-reference.zh.md +224 -0
  197. package/kb/extra/subsystems/session-telemetry.md +212 -0
  198. package/kb/extra/subsystems/session-telemetry.zh.md +212 -0
  199. package/kb/extra/subsystems/session-title.md +213 -0
  200. package/kb/extra/subsystems/session-title.zh.md +213 -0
  201. package/kb/extra/subsystems/session.md +1339 -0
  202. package/kb/extra/subsystems/session.zh.md +1343 -0
  203. package/kb/extra/subsystems/settings.md +155 -0
  204. package/kb/extra/subsystems/settings.zh.md +155 -0
  205. package/kb/extra/subsystems/shell.md +314 -0
  206. package/kb/extra/subsystems/shell.zh.md +314 -0
  207. package/kb/extra/subsystems/sidebar-right.md +160 -0
  208. package/kb/extra/subsystems/sidebar-right.zh.md +160 -0
  209. package/kb/extra/subsystems/skills.md +352 -0
  210. package/kb/extra/subsystems/skills.zh.md +352 -0
  211. package/kb/extra/subsystems/slots.md +200 -0
  212. package/kb/extra/subsystems/slots.zh.md +204 -0
  213. package/kb/extra/subsystems/spill.md +124 -0
  214. package/kb/extra/subsystems/spill.zh.md +124 -0
  215. package/kb/extra/subsystems/ssh.md +22 -11
  216. package/kb/extra/subsystems/ssh.zh.md +22 -11
  217. package/kb/extra/subsystems/storage.md +259 -0
  218. package/kb/extra/subsystems/storage.zh.md +259 -0
  219. package/kb/extra/subsystems/subagent.md +686 -0
  220. package/kb/extra/subsystems/subagent.zh.md +688 -0
  221. package/kb/extra/subsystems/subprocess.md +321 -0
  222. package/kb/extra/subsystems/subprocess.zh.md +321 -0
  223. package/kb/extra/subsystems/system-prompt.md +254 -0
  224. package/kb/extra/subsystems/system-prompt.zh.md +254 -0
  225. package/kb/extra/subsystems/terminal.md +184 -0
  226. package/kb/extra/subsystems/terminal.zh.md +184 -0
  227. package/kb/extra/subsystems/token-meter.md +106 -0
  228. package/kb/extra/subsystems/token-meter.zh.md +106 -0
  229. package/kb/extra/subsystems/tools.md +747 -0
  230. package/kb/extra/subsystems/tools.zh.md +747 -0
  231. package/kb/extra/subsystems/translation.md +103 -0
  232. package/kb/extra/subsystems/translation.zh.md +103 -0
  233. package/kb/extra/subsystems/typert.md +690 -0
  234. package/kb/extra/subsystems/typert.zh.md +690 -0
  235. package/kb/extra/subsystems/user-questions.md +307 -0
  236. package/kb/extra/subsystems/user-questions.zh.md +307 -0
  237. package/kb/extra/subsystems/web-client.md +100 -0
  238. package/kb/extra/subsystems/web-client.zh.md +100 -0
  239. package/kb/extra/subsystems/web-server.md +302 -0
  240. package/kb/extra/subsystems/web-server.zh.md +302 -0
  241. package/kb/extra/subsystems/web.md +206 -0
  242. package/kb/extra/subsystems/web.zh.md +206 -0
  243. package/kb/extra/subsystems/webhook.md +1 -1
  244. package/kb/extra/subsystems/webhook.zh.md +1 -1
  245. package/kb/extra/subsystems/workflow.md +278 -0
  246. package/kb/extra/subsystems/workflow.zh.md +278 -0
  247. package/kb/extra/subsystems/working-directory.md +64 -0
  248. package/kb/extra/subsystems/working-directory.zh.md +64 -0
  249. package/kb/extra/subsystems/workspace.md +647 -0
  250. package/kb/extra/subsystems/workspace.zh.md +647 -0
  251. package/kb/extra/subsystems/worktrees.md +76 -0
  252. package/kb/extra/subsystems/worktrees.zh.md +76 -0
  253. package/kb/extra/testing.md +1 -1
  254. package/kb/extra/testing.zh.md +1 -1
  255. package/kb/extra/tool-catalog.md +2824 -0
  256. package/kb/extra/tool-catalog.zh.md +2832 -0
  257. package/kb/extra/tool-execution-pipeline.md +65 -0
  258. package/kb/extra/tool-execution-pipeline.zh.md +67 -0
  259. package/kb/extra/ui-radius.md +6 -4
  260. package/kb/extra/ui-radius.zh.md +6 -4
  261. package/kb/extra/upgrade-guide/v0.2.0-rc.2/bundled-python-tests/guide.md +18 -0
  262. package/kb/extra/upgrade-guide/v0.2.0-rc.2/bundled-python-tests/guide.zh.md +18 -0
  263. package/kb/extra/upgrade-guide/v0.2.0-rc.2/primary-runtime-python-aliases/guide.md +18 -0
  264. package/kb/extra/upgrade-guide/v0.2.0-rc.2/primary-runtime-python-aliases/guide.zh.md +18 -0
  265. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/deepseek-model-discovery/guide.md +17 -0
  266. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/deepseek-model-discovery/guide.zh.md +17 -0
  267. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/desktop-test-auth-popup/guide.md +18 -0
  268. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/desktop-test-auth-popup/guide.zh.md +18 -0
  269. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/experimental-package-composition/guide.md +28 -0
  270. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/experimental-package-composition/guide.zh.md +28 -0
  271. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/instruction-home-override/guide.md +20 -0
  272. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/instruction-home-override/guide.zh.md +20 -0
  273. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/job-id-identity/guide.md +18 -0
  274. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/job-id-identity/guide.zh.md +18 -0
  275. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/jsonl-persistence-plugin/guide.md +18 -0
  276. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/jsonl-persistence-plugin/guide.zh.md +18 -0
  277. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/mock-messages-events/guide.md +17 -0
  278. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/mock-messages-events/guide.zh.md +17 -0
  279. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.md +31 -0
  280. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.zh.md +31 -0
  281. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/new-session-generations/guide.md +20 -0
  282. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/new-session-generations/guide.zh.md +20 -0
  283. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/plugin-option-placement/guide.md +20 -0
  284. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/plugin-option-placement/guide.zh.md +20 -0
  285. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-optional-resources/guide.md +18 -0
  286. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-optional-resources/guide.zh.md +18 -0
  287. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.md +21 -0
  288. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.zh.md +21 -0
  289. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-adapters/guide.md +18 -0
  290. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-adapters/guide.zh.md +18 -0
  291. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-provider-strategy/guide.md +20 -0
  292. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-provider-strategy/guide.zh.md +20 -0
  293. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/ssh-helper-launch/guide.md +19 -0
  294. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/ssh-helper-launch/guide.zh.md +19 -0
  295. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-activations/guide.md +59 -0
  296. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-activations/guide.zh.md +59 -0
  297. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.md +21 -0
  298. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.zh.md +21 -0
  299. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +21 -0
  300. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +21 -0
  301. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/terminal-command-labels/guide.md +18 -0
  302. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/terminal-command-labels/guide.zh.md +18 -0
  303. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/tool-presentation-mode/guide.md +21 -0
  304. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/tool-presentation-mode/guide.zh.md +21 -0
  305. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/web-listener-trust-config/guide.md +36 -0
  306. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/web-listener-trust-config/guide.zh.md +36 -0
  307. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/working-directory/guide.md +25 -0
  308. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/working-directory/guide.zh.md +25 -0
  309. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-identity-watch/guide.md +18 -0
  310. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-identity-watch/guide.zh.md +18 -0
  311. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-model-catalog/guide.md +27 -0
  312. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-model-catalog/guide.zh.md +27 -0
  313. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/desktop-font-size-shortcuts/guide.md +18 -0
  314. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/desktop-font-size-shortcuts/guide.zh.md +18 -0
  315. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/from-default-profile-replaces-target/guide.md +20 -0
  316. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/from-default-profile-replaces-target/guide.zh.md +20 -0
  317. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/operator-connect/guide.md +18 -0
  318. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/operator-connect/guide.zh.md +18 -0
  319. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-azure-provider/guide.md +19 -0
  320. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-azure-provider/guide.zh.md +19 -0
  321. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-model-discovery/guide.md +17 -0
  322. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-model-discovery/guide.zh.md +17 -0
  323. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-install-over-installed/guide.md +20 -0
  324. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-install-over-installed/guide.zh.md +20 -0
  325. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/sdk-minimal-image-compaction/guide.md +32 -0
  326. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/sdk-minimal-image-compaction/guide.zh.md +32 -0
  327. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/stored-credentials-precedence/guide.md +25 -0
  328. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/stored-credentials-precedence/guide.zh.md +25 -0
  329. package/kb/extra/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/guide.md +21 -0
  330. package/kb/extra/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/guide.zh.md +21 -0
  331. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/account-notification-fields/guide.md +18 -0
  332. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/account-notification-fields/guide.zh.md +18 -0
  333. package/kb/meta/search-index.json +1932 -366
  334. package/kb/meta/source.json +9 -8
  335. package/kb/site/develop/basic/publish.md +3 -1
  336. package/kb/site/en/develop/basic/publish.md +3 -1
  337. package/kb/site/en/guide/github-review.md +7 -10
  338. package/kb/site/en/guide/plugin-market.md +151 -0
  339. package/kb/site/en/guide/providers.md +27 -4
  340. package/kb/site/en/guide/public-deployments.md +10 -6
  341. package/kb/site/en/guide/python-sdk.md +8 -9
  342. package/kb/site/en/reference/api-gateway.md +10 -3
  343. package/kb/site/en/reference/capability-seams.md +71 -24
  344. package/kb/site/en/reference/config-catalog.md +452 -191
  345. package/kb/site/en/reference/experimental-persistence-catalog.md +20 -0
  346. package/kb/site/en/reference/index.md +11 -12
  347. package/kb/site/en/reference/persistence-catalog.md +552 -192
  348. package/kb/site/en/reference/subsystems/client-modules.md +14 -0
  349. package/kb/site/en/reference/subsystems/conversation.md +14 -0
  350. package/kb/site/en/reference/subsystems/core.md +3 -1
  351. package/kb/site/en/reference/subsystems/credentials.md +13 -12
  352. package/kb/site/en/reference/subsystems/index.md +4 -1
  353. package/kb/site/en/reference/subsystems/jobs.md +62 -7
  354. package/kb/site/en/reference/subsystems/llm-streaming.md +82 -15
  355. package/kb/site/en/reference/subsystems/persistence.md +2 -0
  356. package/kb/site/en/reference/subsystems/plan.md +1 -1
  357. package/kb/site/en/reference/subsystems/ptc-runtime.md +24 -6
  358. package/kb/site/en/reference/subsystems/session-query.md +2 -0
  359. package/kb/site/en/reference/subsystems/session-title.md +14 -5
  360. package/kb/site/en/reference/subsystems/session.md +59 -14
  361. package/kb/site/en/reference/subsystems/sidebar-right.md +2 -0
  362. package/kb/site/en/reference/subsystems/skills.md +2 -2
  363. package/kb/site/en/reference/subsystems/slots.md +80 -83
  364. package/kb/site/en/reference/subsystems/subagent.md +175 -247
  365. package/kb/site/en/reference/subsystems/system-prompt.md +32 -2
  366. package/kb/site/en/reference/subsystems/tools.md +3 -3
  367. package/kb/site/en/reference/subsystems/typert.md +222 -17
  368. package/kb/site/en/reference/subsystems/web-client.md +1 -1
  369. package/kb/site/en/reference/subsystems/web-server.md +87 -11
  370. package/kb/site/en/reference/subsystems/web.md +2 -2
  371. package/kb/site/en/reference/subsystems/workflow.md +1 -1
  372. package/kb/site/en/reference/subsystems/workspace.md +25 -37
  373. package/kb/site/en/reference/tool-catalog.md +156 -51
  374. package/kb/site/guide/github-review.md +7 -10
  375. package/kb/site/guide/plugin-market.md +151 -0
  376. package/kb/site/guide/providers.md +27 -4
  377. package/kb/site/guide/public-deployments.md +10 -6
  378. package/kb/site/guide/python-sdk.md +8 -9
  379. package/kb/site/reference/api-gateway.md +16 -3
  380. package/kb/site/reference/capability-seams.md +71 -24
  381. package/kb/site/reference/config-catalog.md +452 -191
  382. package/kb/site/reference/experimental-persistence-catalog.md +20 -0
  383. package/kb/site/reference/index.md +11 -12
  384. package/kb/site/reference/persistence-catalog.md +552 -192
  385. package/kb/site/reference/subsystems/client-modules.md +14 -0
  386. package/kb/site/reference/subsystems/conversation.md +16 -0
  387. package/kb/site/reference/subsystems/core.md +5 -1
  388. package/kb/site/reference/subsystems/credentials.md +13 -12
  389. package/kb/site/reference/subsystems/index.md +4 -1
  390. package/kb/site/reference/subsystems/jobs.md +62 -7
  391. package/kb/site/reference/subsystems/llm-streaming.md +82 -15
  392. package/kb/site/reference/subsystems/persistence.md +2 -0
  393. package/kb/site/reference/subsystems/plan.md +1 -1
  394. package/kb/site/reference/subsystems/ptc-runtime.md +24 -6
  395. package/kb/site/reference/subsystems/scope.md +2 -0
  396. package/kb/site/reference/subsystems/session-query.md +2 -0
  397. package/kb/site/reference/subsystems/session-title.md +14 -5
  398. package/kb/site/reference/subsystems/session.md +59 -14
  399. package/kb/site/reference/subsystems/sidebar-right.md +2 -0
  400. package/kb/site/reference/subsystems/skills.md +2 -2
  401. package/kb/site/reference/subsystems/slots.md +84 -83
  402. package/kb/site/reference/subsystems/subagent.md +177 -251
  403. package/kb/site/reference/subsystems/system-prompt.md +32 -2
  404. package/kb/site/reference/subsystems/tools.md +3 -3
  405. package/kb/site/reference/subsystems/typert.md +222 -17
  406. package/kb/site/reference/subsystems/web-client.md +1 -1
  407. package/kb/site/reference/subsystems/web-server.md +87 -11
  408. package/kb/site/reference/subsystems/web.md +2 -2
  409. package/kb/site/reference/subsystems/workflow.md +1 -1
  410. package/kb/site/reference/subsystems/workspace.md +25 -37
  411. package/kb/site/reference/tool-catalog.md +160 -55
  412. package/package.json +2 -2
  413. package/skills/dsh-dev-sandbox.md +70 -0
  414. package/kb/extra/defensive-patterns.md +0 -33
  415. package/kb/extra/defensive-patterns.zh.md +0 -35
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.2] - 2026-10-21
4
+
5
+ - `dsh-dev-sandbox` 技能去掉固定 `dev` profile 约定:**沙箱 profile 名由 agent 按任务自定**
6
+ (建议 `sb-<插件名>`),建前检查不与现有 profile(尤其主力)重名,端口同样自选空闲高位端口;
7
+ 新增沙箱「用完即删、不留残留」的收尾说明。
8
+
9
+ ## [1.5.1] - 2026-10-21
10
+
11
+ - **知识库同步上游 master `687f282e`(2026-10-17)**:
12
+ - 站点镜像 188 → **192 页**(中英各 96),全量刷新;`kb/extra/` 补充文档 182 → **439 篇**
13
+ (上游 `docs/` 大幅扩充,按 docs.ts 发布清单差集重建);索引 373 → **634 文件**。
14
+ - 修复 `kb/meta/source.json` 历史 bug:自始以 GBK 编码提交(含 BOM + 控制字符),
15
+ JSON.parse 恒失败、中文字段永久乱码;现重写为 UTF-8 无 BOM。
16
+
17
+ ## [1.5.0] - 2026-10-21
18
+
19
+ - **定位升级为「dsh 插件辅助」**(插件 id / 包名 `dsh-plugin-dev-kb` 不变,避免破坏挂载与市场收录)。
20
+ - 新增 `dsh-dev-sandbox` 技能:独立 dev profile 开发沙箱工作流——开发中的插件隔离装进
21
+ `~/.dsh/profiles/dev`(默认名,用户可指定),agent 自主后台启动(`dsh web --profile dev
22
+ --port 3081`,npx 拉与主力同版本的 dsh CLI)、自主重启(查端口 PID → Stop-Process → 起回)、
23
+ 读 `skipping profile bundle` 警告与崩溃栈、headless 冒烟验证;插件崩了只崩沙箱,
24
+ 绝不影响主力 dsh,全程不要求用户重启。含初始化(`plugin --profile dev add file:` /
25
+ `link:` 挂载 / 兼容闸门 / 双挂载禁令)与进主力 profile 的收尾流程。
26
+ - `lib/index.js` 无需改动:skills/ 目录自动扫描,新技能文件即插即用。
27
+
3
28
  ## [1.4.0] - 2026-10-10
4
29
 
5
30
  - 知识库同步至上游 master `5badb150`(2026-10-10,对应 dsh `0.2.0-rc.2` / `0.2.1-alpha` 时期):
package/README.en.md CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  [中文](./README.md) | **English**
14
14
 
15
- > **188-page official mirror · 182 supplementary docs · 373-file search index · 0 runtime dependencies**
15
+ > **192-page official mirror · 439 supplementary docs · 634-file search index · 0 runtime dependencies**
16
16
 
17
17
  **The official docs at your side whenever you write dsh plugins**: the entire content of the DeepSeek Harness official documentation site
18
18
  <https://deepseek-harness.github.io/deepseek-harness/> is organized into a form natively usable by dsh —
@@ -21,16 +21,16 @@ once this plugin is installed, the agent automatically loads the knowledge base
21
21
  ## What is this
22
22
 
23
23
  - **Complete site mirror**: the official docs (VitePress) are generated as a projection of the raw Markdown in
24
- `docs/` of the `deepseek-ai/deepseek-harness` repository (links rewritten to site routes, verbatim identical to the live site). 188 pages in both Chinese and English.
25
- - **Supplementary docs**: 182 development references from the repo's `docs/` that were not published to the site (glossary, defensive patterns, module graph, testing strategy, incident postmortems, i18n specs, upgrade guides, persistence changes, etc.).
24
+ `docs/` of the `deepseek-ai/deepseek-harness` repository (links rewritten to site routes, verbatim identical to the live site). 192 pages in both Chinese and English.
25
+ - **Supplementary docs**: 439 development references from the repo's `docs/` that were not published to the site (glossary, defensive patterns, module graph, testing strategy, incident postmortems, i18n specs, upgrade guides, persistence changes, etc.).
26
26
  - **Agent-friendly**: the `skills/dsh-plugin-dev-kb.md` skill lets dsh auto-load it during plugin development tasks, providing the knowledge base location,
27
27
  topic navigation, and search strategy; `kb/meta/topics.md` maps task scenarios to the files to read; `kb/meta/search-index.json` provides full search coverage.
28
28
 
29
29
  ## Features
30
30
 
31
31
  - **Complete mirror of the official docs**: the entire content of the deepseek-ai/deepseek-harness official documentation site, organized into a form natively usable by dsh,
32
- 188 pages in both Chinese and English, links rewritten to site routes, verbatim identical to the live site;
33
- - **Repo supplementary docs**: 182 development references not published to the site (glossary, defensive patterns, module graph, testing strategy, incident postmortems, i18n specs, upgrade guides, persistence changes, etc.);
32
+ 192 pages in both Chinese and English, links rewritten to site routes, verbatim identical to the live site;
33
+ - **Repo supplementary docs**: 439 development references not published to the site (glossary, defensive patterns, module graph, testing strategy, incident postmortems, i18n specs, upgrade guides, persistence changes, etc.);
34
34
  - **Agent-friendly**: the `dsh-plugin-dev-kb` skill lets dsh auto-load the knowledge base during plugin development tasks;
35
35
  `kb/meta/topics.md` maps task scenarios to the files to read, and `kb/meta/search-index.json` provides full search coverage;
36
36
  - **Human-usable**: browse the `kb/` directory directly, or open `kb/INDEX.md` to look things up by URL mapping;
@@ -96,7 +96,7 @@ dsh-plugin-dev-kb/
96
96
  │ ├── extra/ repo supplementary docs: glossary, defensive-patterns, module-graph, postmortem/, i18n/ …
97
97
  │ ├── meta/
98
98
  │ │ ├── topics.md ★ topic navigation: task scenario → files
99
- │ │ ├── search-index.json full index (373 files)
99
+ │ │ ├── search-index.json full index (634 files)
100
100
  │ │ ├── source.json source commit / time / stats
101
101
  │ │ └── site-pages.txt list of live site pages
102
102
  │ ├── INDEX.md site URL ↔ local file mapping
package/README.md CHANGED
@@ -12,19 +12,24 @@
12
12
 
13
13
  [**中文**](./README.md) | [English](./README.en.md)
14
14
 
15
- > **188 页官方镜像 · 182 篇补充文档 · 373 文件搜索索引 · 0 运行时依赖**
15
+ > **192 页官方镜像 · 439 篇补充文档 · 634 文件搜索索引 · 0 运行时依赖**
16
16
 
17
- **写 dsh 插件时的随身官方文档**:把 DeepSeek Harness 官方文档站点
17
+ **写 dsh 插件时的随身辅助**:① 把 DeepSeek Harness 官方文档站点
18
18
  <https://deepseek-harness.github.io/deepseek-harness/> 的全部内容整理为 dsh 原生可用的形态——
19
- 装了这个插件,agent 写插件时自动加载知识库,按任务场景定位文档,不用再翻网页。
19
+ 装了这个插件,agent 写插件时自动加载知识库,按任务场景定位文档,不用再翻网页;
20
+ ② 附带 `dsh-dev-sandbox` 技能:自建独立沙箱 profile 开发沙箱工作流(沙箱名由 agent 按任务自定),
21
+ 开发中的插件隔离运行,agent 自主启动 / 重启 / 冒烟验证,插件崩了不影响主力 dsh。
20
22
 
21
23
  ## 这是什么
22
24
 
23
25
  - **站点完整镜像**:官方文档(VitePress)由仓库 `deepseek-ai/deepseek-harness` 的 `docs/` 原始 Markdown
24
- 投影生成(链接已按站点路由重写,与线上逐字一致)。中英双语共 188 页。
25
- - **补充文档**:仓库 `docs/` 中未发布到站点的 182 篇开发参考(术语表、防御模式、模块图、测试策略、事故复盘、i18n 规范、升级指南、持久化变更等)。
26
+ 投影生成(链接已按站点路由重写,与线上逐字一致)。中英双语共 192 页。
27
+ - **补充文档**:仓库 `docs/` 中未发布到站点的 439 篇开发参考(术语表、防御模式、模块图、测试策略、事故复盘、i18n 规范、升级指南、持久化变更等)。
26
28
  - **agent 友好**:`skills/dsh-plugin-dev-kb.md` 技能让 dsh 在插件开发任务中自动加载,获知知识库位置、
27
29
  主题导航与检索策略;`kb/meta/topics.md` 按任务场景映射要读的文件;`kb/meta/search-index.json` 提供全量检索。
30
+ - **开发沙箱**:`skills/dsh-dev-sandbox.md` 技能提供自建独立沙箱 profile 工作流(沙箱名 agent 按任务
31
+ 自定,不与主力 profile 重名)——初始化(兼容闸门 / link: 挂载)、后台启动(自选空闲端口)、自主重启、headless 冒烟验证,
32
+ 全程 agent 闭环,不要求用户重启。
28
33
 
29
34
  ## 功能
30
35
 
package/kb/INDEX.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DeepSeek Harness 文档索引
2
2
 
3
- > 由 `scripts/rebuild-index.mjs` 自动生成。共 188 个站点页面(中英双语),另有 182 个补充文档在 `extra/`。
3
+ > 由 `scripts/rebuild-index.mjs` 自动生成。共 192 个站点页面(中英双语),另有 439 个补充文档在 `extra/`。
4
4
 
5
5
  ## 中文站点(根路径)
6
6
 
@@ -17,6 +17,7 @@
17
17
  | 通过 GitHub Webhook 创建评审会话 | [https://deepseek-harness.github.io/deepseek-harness/guide/github-review](https://deepseek-harness.github.io/deepseek-harness/guide/github-review) | `site/guide/github-review.md` |
18
18
  | 连接第三方记忆 MCP 服务 | [https://deepseek-harness.github.io/deepseek-harness/guide/mcp-memory](https://deepseek-harness.github.io/deepseek-harness/guide/mcp-memory) | `site/guide/mcp-memory.md` |
19
19
  | 在网络代理后面运行 DSH | [https://deepseek-harness.github.io/deepseek-harness/guide/network-proxy](https://deepseek-harness.github.io/deepseek-harness/guide/network-proxy) | `site/guide/network-proxy.md` |
20
+ | 插件市场 | [https://deepseek-harness.github.io/deepseek-harness/guide/plugin-market](https://deepseek-harness.github.io/deepseek-harness/guide/plugin-market) | `site/guide/plugin-market.md` |
20
21
  | 配置模型 | [https://deepseek-harness.github.io/deepseek-harness/guide/providers](https://deepseek-harness.github.io/deepseek-harness/guide/providers) | `site/guide/providers.md` |
21
22
  | 在反向代理之后发布 Web UI | [https://deepseek-harness.github.io/deepseek-harness/guide/public-deployments](https://deepseek-harness.github.io/deepseek-harness/guide/public-deployments) | `site/guide/public-deployments.md` |
22
23
  | Python SDK 入门 | [https://deepseek-harness.github.io/deepseek-harness/guide/python-sdk](https://deepseek-harness.github.io/deepseek-harness/guide/python-sdk) | `site/guide/python-sdk.md` |
@@ -66,6 +67,7 @@
66
67
  | 注册表 | [https://deepseek-harness.github.io/deepseek-harness/reference/cordis-api/registry](https://deepseek-harness.github.io/deepseek-harness/reference/cordis-api/registry) | `site/reference/cordis-api/registry.md` |
67
68
  | Service | [https://deepseek-harness.github.io/deepseek-harness/reference/cordis-api/service](https://deepseek-harness.github.io/deepseek-harness/reference/cordis-api/service) | `site/reference/cordis-api/service.md` |
68
69
  | Cordis 入门 | [https://deepseek-harness.github.io/deepseek-harness/reference/cordis-primer](https://deepseek-harness.github.io/deepseek-harness/reference/cordis-primer) | `site/reference/cordis-primer.md` |
70
+ | 实验性插件记录目录 | [https://deepseek-harness.github.io/deepseek-harness/reference/experimental-persistence-catalog](https://deepseek-harness.github.io/deepseek-harness/reference/experimental-persistence-catalog) | `site/reference/experimental-persistence-catalog.md` |
69
71
  | DeepSeek Harness 架构 | [https://deepseek-harness.github.io/deepseek-harness/reference](https://deepseek-harness.github.io/deepseek-harness/reference) | `site/reference/index.md` |
70
72
  | 会话持久化事件目录 | [https://deepseek-harness.github.io/deepseek-harness/reference/persistence-catalog](https://deepseek-harness.github.io/deepseek-harness/reference/persistence-catalog) | `site/reference/persistence-catalog.md` |
71
73
  | 用户审批 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/approval](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/approval) | `site/reference/subsystems/approval.md` |
@@ -102,7 +104,7 @@
102
104
  | Web Client Slots | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/slots](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/slots) | `site/reference/subsystems/slots.md` |
103
105
  | spill 存储 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/spill](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/spill) | `site/reference/subsystems/spill.md` |
104
106
  | 存储 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/storage](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/storage) | `site/reference/subsystems/storage.md` |
105
- | Subagent | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/subagent](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/subagent) | `site/reference/subsystems/subagent.md` |
107
+ | 子代理 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/subagent](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/subagent) | `site/reference/subsystems/subagent.md` |
106
108
  | 子进程 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/subprocess](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/subprocess) | `site/reference/subsystems/subprocess.md` |
107
109
  | 系统提示词组装 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/system-prompt](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/system-prompt) | `site/reference/subsystems/system-prompt.md` |
108
110
  | 持久 PTY 会话 | [https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/terminal](https://deepseek-harness.github.io/deepseek-harness/reference/subsystems/terminal) | `site/reference/subsystems/terminal.md` |
@@ -151,6 +153,7 @@
151
153
  | Create review Sessions from GitHub webhooks | [https://deepseek-harness.github.io/deepseek-harness/en/guide/github-review](https://deepseek-harness.github.io/deepseek-harness/en/guide/github-review) | `site/en/guide/github-review.md` |
152
154
  | Connect a third-party memory MCP server | [https://deepseek-harness.github.io/deepseek-harness/en/guide/mcp-memory](https://deepseek-harness.github.io/deepseek-harness/en/guide/mcp-memory) | `site/en/guide/mcp-memory.md` |
153
155
  | Run DSH behind a network proxy | [https://deepseek-harness.github.io/deepseek-harness/en/guide/network-proxy](https://deepseek-harness.github.io/deepseek-harness/en/guide/network-proxy) | `site/en/guide/network-proxy.md` |
156
+ | Plugin markets | [https://deepseek-harness.github.io/deepseek-harness/en/guide/plugin-market](https://deepseek-harness.github.io/deepseek-harness/en/guide/plugin-market) | `site/en/guide/plugin-market.md` |
154
157
  | Configure models | [https://deepseek-harness.github.io/deepseek-harness/en/guide/providers](https://deepseek-harness.github.io/deepseek-harness/en/guide/providers) | `site/en/guide/providers.md` |
155
158
  | Publish the Web UI behind a reverse proxy | [https://deepseek-harness.github.io/deepseek-harness/en/guide/public-deployments](https://deepseek-harness.github.io/deepseek-harness/en/guide/public-deployments) | `site/en/guide/public-deployments.md` |
156
159
  | Get started with the Python SDK | [https://deepseek-harness.github.io/deepseek-harness/en/guide/python-sdk](https://deepseek-harness.github.io/deepseek-harness/en/guide/python-sdk) | `site/en/guide/python-sdk.md` |
@@ -172,6 +175,7 @@
172
175
  | Registry | [https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-api/registry](https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-api/registry) | `site/en/reference/cordis-api/registry.md` |
173
176
  | Service | [https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-api/service](https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-api/service) | `site/en/reference/cordis-api/service.md` |
174
177
  | Cordis Primer | [https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-primer](https://deepseek-harness.github.io/deepseek-harness/en/reference/cordis-primer) | `site/en/reference/cordis-primer.md` |
178
+ | Experimental Plugin Record Catalog | [https://deepseek-harness.github.io/deepseek-harness/en/reference/experimental-persistence-catalog](https://deepseek-harness.github.io/deepseek-harness/en/reference/experimental-persistence-catalog) | `site/en/reference/experimental-persistence-catalog.md` |
175
179
  | DeepSeek Harness Architecture | [https://deepseek-harness.github.io/deepseek-harness/en/reference](https://deepseek-harness.github.io/deepseek-harness/en/reference) | `site/en/reference/index.md` |
176
180
  | Session Persistence Event Catalog | [https://deepseek-harness.github.io/deepseek-harness/en/reference/persistence-catalog](https://deepseek-harness.github.io/deepseek-harness/en/reference/persistence-catalog) | `site/en/reference/persistence-catalog.md` |
177
181
  | User Approval | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/approval](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/approval) | `site/en/reference/subsystems/approval.md` |
@@ -208,7 +212,7 @@
208
212
  | Web Client Slots | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/slots](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/slots) | `site/en/reference/subsystems/slots.md` |
209
213
  | Spill Storage | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/spill](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/spill) | `site/en/reference/subsystems/spill.md` |
210
214
  | Storage | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/storage](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/storage) | `site/en/reference/subsystems/storage.md` |
211
- | Subagent | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/subagent](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/subagent) | `site/en/reference/subsystems/subagent.md` |
215
+ | Subagents | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/subagent](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/subagent) | `site/en/reference/subsystems/subagent.md` |
212
216
  | Subprocess | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/subprocess](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/subprocess) | `site/en/reference/subsystems/subprocess.md` |
213
217
  | System Prompt Assembly | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/system-prompt](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/system-prompt) | `site/en/reference/subsystems/system-prompt.md` |
214
218
  | Persistent PTY Sessions | [https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/terminal](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/terminal) | `site/en/reference/subsystems/terminal.md` |
@@ -226,5 +230,5 @@
226
230
 
227
231
  ---
228
232
 
229
- *站点页面:188(中文 94,英文 94)*
233
+ *站点页面:192(中文 96,英文 96)*
230
234
 
@@ -23,16 +23,17 @@ Each fact has one home: the tier whose job it is; elsewhere, link there.
23
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
24
  | [subsystems/](subsystems/README.md) | One reference page per subsystem: type definitions, semantics, and the generated Cordis API | Behavior narration (→ architecture.md) |
25
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
+ | [defensive-patterns/](defensive-patterns/README.md) | Rules this repository enforces in review, split by artifact: one general bug-class page plus per-domain pages | Type definitions and semantics (→ subsystems), decision rationale (→ Agent Notes) |
26
27
  | [postmortem/](postmortem/README.md) | Incident stories — the only tier where war-story narrative belongs | — |
27
28
  | [Persistence history](persistence-changes/README.md) and [format references](persistence-changes/historical-formats/README.md) | Type-change acknowledgements, release comparisons, and complete historical format schemas | Behavior-only changes; current runtime contracts |
28
29
  | [cookbook/](cookbook/adding-a-package.md) | Step-by-step how-tos with numbered verify steps | Design rationale (→ the Agent Note each guide links) |
29
30
  | [user/](user/index.md) | Product-facing guides published by the documentation website | Generated reference tables, contributor procedures, decision history |
30
31
  | 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 |
31
32
  | [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 |
32
- | 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 |
33
+ | 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), [cli-help](cli-help.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 |
33
34
  | Skills (`.agents/skills/`) | Reusable workflows and specialized decision standards | Product and runtime contracts (→ docs or source) |
34
35
 
35
- Placement: bugs → postmortems; rationale → Agent Notes; procedures → cookbooks; type definitions → subsystems; package contracts → READMEs; standing orders → root `AGENTS.md` with a rationale link.
36
+ Placement: bugs → postmortems; rationale → Agent Notes; procedures → cookbooks; type definitions → subsystems; package contracts → READMEs; standing orders → root `AGENTS.md` with a rationale link; review-enforced rules → `defensive-patterns/`.
36
37
 
37
38
  ## Writing rules
38
39
 
@@ -55,7 +56,7 @@ When the gate goes red:
55
56
  2. **Condense** content that belongs here but can be shorter.
56
57
  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.
57
58
 
58
- 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,960; `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.
59
+ 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` ≤ 2,080; `architecture.md` ≤ 2,400; subtree `AGENTS.md` ≤ 600, except `packages/AGENTS.md` ≤ 810 and this file ≤ 1,430; `packages/README.md` ≤ 994; plus `cordis-primer.md` 600, `testing.md` 1,300, `examples/AGENTS.md` 310. Review governs unbudgeted tiers.
59
60
 
60
61
  ## The slop checklist
61
62
 
@@ -0,0 +1,91 @@
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->>Prompt: <code>system-prompt/assemble</code> waterfall
29
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
30
+ Hooks-->>Driver: authoritative reject or enter(messages)
31
+ alt proposed step rejected, first batch empty, or pre-step failed
32
+ Driver-->>Driver: claimed batch stays removed, the open turn spends no step
33
+ else enter proposed step
34
+ Driver->>Session: <code>step/start</code>
35
+ Driver->>Hooks: <code>agent/request</code> waterfall
36
+ Driver->>LLM: prepareCall(config, signal)
37
+ Note over Driver,LLM: cancellation during either async phase commits neither system nor users
38
+ Note over Driver,Session: synchronous admission using the prepared call capability
39
+ Driver->>Session: <code>system/message</code> ordered per-node reconciliation
40
+ Driver->>Session: <code>user/message</code> per entered message
41
+ Driver->>Session: <code>request/header</code> and <code>request/context</code> as needed
42
+ Driver->>Driver: derive and freeze request from the log
43
+ Driver->>LLM: bound prepared call through <code>llm/stream</code> waterfall
44
+ LLM-->>Driver: StreamChunk*
45
+ Driver-->>SDK: <code>agent/assistant-stream</code> chunk*
46
+ alt final adapter or terminal in-band request failure
47
+ Driver->>Session: <code>assistant/attempt</code>
48
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
49
+ Driver->>Hooks: <code>agent/request-error</code> waterfall
50
+ Hooks-->>Driver: return retry action or preserve the original error
51
+ Note over Driver,LLM: retry in the open step: prepare and reconcile the same rendered assembly without repeating pre-step or users
52
+ else model request succeeded
53
+ Driver->>Session: <code>assistant/message</code>
54
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
55
+ Driver->>Tools: classify pending call by executionMode
56
+ loop barriers and bounded rolling pool, reclassify before start
57
+ opt call starts
58
+ Driver->>Session: <code>tool/call</code>
59
+ Driver->>Tools: ordered pre, concurrent execute
60
+ Tools-->>Session: tool-owned events when applicable
61
+ end
62
+ opt next model-order result ready
63
+ Driver->>Tools: ordered post
64
+ Driver->>Session: <code>tool/result</code>
65
+ end
66
+ end
67
+ Driver->>Session: <code>step/end</code>
68
+ opt natural stop and next-step inbox empty
69
+ Driver->>Hooks: <code>agent/turn-stopping</code> serial terminal checkpoint
70
+ end
71
+ opt next-step input is pending
72
+ Driver-->>Driver: claim pending next-step input
73
+ Driver-->>SDK: <code>agent/inbox/claimed</code> { message, turn } per message
74
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
75
+ Hooks-->>Driver: authoritative reject or enter(messages)
76
+ end
77
+ end
78
+ end
79
+ Driver->>Session: <code>turn/end</code>
80
+ Driver-->>SDK: <code>agent/status</code> idle
81
+ ```
82
+
83
+ 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.
84
+
85
+ `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 runs within the open step and retries only when pruning or summarization advances the surface replacement generation; otherwise the original request error remains authoritative. Each retry prepares its call and reconciles the retained rendered assembly before request derivation, without repeating assembly, pre-step, or user admission.
86
+
87
+ 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.
88
+
89
+ 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.
90
+
91
+ Maintenance mode: curated Mermaid sequence; exact event signatures live in the generated Cordis catalog.
@@ -0,0 +1,93 @@
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->>Prompt: <code>system-prompt/assemble</code> waterfall
31
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
32
+ Hooks-->>Driver: authoritative reject or enter(messages)
33
+ alt proposed step rejected, first batch empty, or pre-step failed
34
+ Driver-->>Driver: claimed batch stays removed, the open turn spends no step
35
+ else enter proposed step
36
+ Driver->>Session: <code>step/start</code>
37
+ Driver->>Hooks: <code>agent/request</code> waterfall
38
+ Driver->>LLM: prepareCall(config, signal)
39
+ Note over Driver,LLM: cancellation during either async phase commits neither system nor users
40
+ Note over Driver,Session: synchronous admission using the prepared call capability
41
+ Driver->>Session: <code>system/message</code> ordered per-node reconciliation
42
+ Driver->>Session: <code>user/message</code> per entered message
43
+ Driver->>Session: <code>request/header</code> and <code>request/context</code> as needed
44
+ Driver->>Driver: derive and freeze request from the log
45
+ Driver->>LLM: bound prepared call through <code>llm/stream</code> waterfall
46
+ LLM-->>Driver: StreamChunk*
47
+ Driver-->>SDK: <code>agent/assistant-stream</code> chunk*
48
+ alt final adapter or terminal in-band request failure
49
+ Driver->>Session: <code>assistant/attempt</code>
50
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
51
+ Driver->>Hooks: <code>agent/request-error</code> waterfall
52
+ Hooks-->>Driver: return retry action or preserve the original error
53
+ Note over Driver,LLM: retry in the open step: prepare and reconcile the same rendered assembly without repeating pre-step or users
54
+ else model request succeeded
55
+ Driver->>Session: <code>assistant/message</code>
56
+ Driver-->>SDK: <code>agent/assistant-stream</code> committed end
57
+ Driver->>Tools: classify pending call by executionMode
58
+ loop barriers and bounded rolling pool, reclassify before start
59
+ opt call starts
60
+ Driver->>Session: <code>tool/call</code>
61
+ Driver->>Tools: ordered pre, concurrent execute
62
+ Tools-->>Session: tool-owned events when applicable
63
+ end
64
+ opt next model-order result ready
65
+ Driver->>Tools: ordered post
66
+ Driver->>Session: <code>tool/result</code>
67
+ end
68
+ end
69
+ Driver->>Session: <code>step/end</code>
70
+ opt natural stop and next-step inbox empty
71
+ Driver->>Hooks: <code>agent/turn-stopping</code> serial terminal checkpoint
72
+ end
73
+ opt next-step input is pending
74
+ Driver-->>Driver: claim pending next-step input
75
+ Driver-->>SDK: <code>agent/inbox/claimed</code> { message, turn } per message
76
+ Driver->>Hooks: <code>agent/pre-step</code> waterfall
77
+ Hooks-->>Driver: authoritative reject or enter(messages)
78
+ end
79
+ end
80
+ end
81
+ Driver->>Session: <code>turn/end</code>
82
+ Driver-->>SDK: <code>agent/status</code> idle
83
+ ```
84
+
85
+ `assistant/message` 事件会记录每次成功的提供方调用,包括返回空内容或以 `max-tokens` 结束的调用,并嵌入精确的紧凑带时间 stream。空内容不会进入派生历史。失败、重试、取消或 stream error attempt 到达 settlement 时,如果没有 surface message,就会把 stream 记录为 `assistant/attempt`。实时 `agent/assistant-stream` chunk frame 是瞬态数据;回放读取任一种持久 settlement,如果进程在 settlement 前硬中断,则不会留下持久 attempt stream。
86
+
87
+ `dsh-compaction-basic` 在派生请求之前通过 `agent/pre-step` 处理压力,而 `agent/request-error` 仅用于规范的上下文溢出。任一触发条件满足后,系统都会先执行可选的工具结果剪枝,再选择摘要。恢复发生在仍打开的步骤内,只有剪枝或摘要生成推进 surface replacement generation 时才重试,否则仍以原始请求错误为准。每次重试都会准备调用,并在派生请求之前协调保留的已渲染组装结果,不重复组装、pre-step 或用户消息准入。
88
+
89
+ 以返回的 `agent/pre-step` 决策为准;通过包装 `next()` 的监听器会保留下游消息与 `startsRequestSeries`,除非有意替换。steering(中途引导)和注入的上下文在后续的认领操作取得其下一步骤批次后,会经过同一 waterfall(瀑布式事件)。
90
+
91
+ 需要可回放 transcript(文本记录)数据的 SDK 用户应当消费 `session/event`;`agent/*` 是用于队列与状态、提示词拦截、请求构造、steering、继续执行和错误处理的实时协调接口。
92
+
93
+ 维护模式:英文源文件包含人工维护的 Mermaid 时序图,并由生成器写出;本中文文件作为经评审对侧通过双语配对维护。确切的事件签名位于生成的 Cordis 目录中。
@@ -0,0 +1,172 @@
1
+ # API Gateway
2
+
3
+ English | [中文](api-gateway.zh.md)
4
+
5
+ This is the current-state reference for the Typert API Gateway. It describes how business services declare unary and stream Remote methods, how the build generates Host and Client contracts, and how calls reuse the Connection RPC and `/api` route. Session events, incremental data, and other streaming protocols are outside this document's scope; they may use the same Connection but do not use Remote method descriptors.
6
+
7
+ ## Programming model
8
+
9
+ Business services use `@Remote` or `@RemoteScope` to select the methods exposed to the Client. Unmarked methods do not enter the generated Client types or runtime contributions and cannot be called through `ctx.remote`.
10
+
11
+ `@Remote` denotes calling a Cordis service registered on the root Host Context. Complex Host objects cannot cross the wire directly; the business package must declare their association with a wire identity through `TypertLookupMap` and register a default resolution provider with `ctx.typert.lookups` at runtime. For example, an `Agent` parameter named `agent` in the Host signature produces an `agentId` wire field, and the Gateway resolves that id to a Host object before invoking the business method. Host composition can use `ctx.typert.lookups.configure()` to override the resolution policy for a lookup key without changing the parameter name, wire field, or canonical type symbol owned by the business package.
12
+
13
+ `@RemoteScope(key)` first resolves an identity to a scoped Context through `ctx.typert.contexts`, then obtains the service from that Context and invokes the method. It applies when the method itself depends on scoped composition and does not need to receive objects such as `Agent` explicitly.
14
+
15
+ `@Remote` accepts an export name or `{ name?, mode?, resources? }`, and `@RemoteScope(key, option?)` accepts an export name, as in `@RemoteScope('agent', 'current')` below, or `{ name?, resources? }` as its second argument. `resources` holds per-kind readers that return the identities of the resources one call touches for access control; each reader receives the method's wire arguments as its own parameters, with types inferred from the decorated method. Most methods declare no readers, because the Gateway also reads identities from lookup parameters and scoped Contexts that declare a `resource`, and from the default fields in `typert.resources`; the [Typert subsystem](subsystems/typert.md) owns that order.
16
+
17
+ Services normally extend `TypertRemoteService` so the constructor explicitly binds the Cordis service key and default Remote namespace. A service that already has another base class can instead declare `readonly typertRemote = bindTypertRemote(this, serviceKey)`; both forms leave an inspectable public binding and do not depend on the compiler injecting a symbol into the constructor.
18
+
19
+ ```ts
20
+ import type { Agent } from '@deepseek-ai/dsh-agent'
21
+ import { TypertRemoteService, Remote, RemoteScope } from '@deepseek-ai/dsh-typert-protocol'
22
+ import type { Context } from '@deepseek-ai/cordis'
23
+
24
+ export interface CreateGoalRequest {
25
+ objective: string
26
+ }
27
+
28
+ export interface CreateGoalResult {
29
+ accepted: boolean
30
+ }
31
+
32
+ export class GoalService extends TypertRemoteService {
33
+ constructor(ctx: Context) {
34
+ super(ctx, 'goals')
35
+ }
36
+
37
+ @Remote('create')
38
+ createForClient(
39
+ agent: Agent,
40
+ request: CreateGoalRequest,
41
+ signal: AbortSignal,
42
+ ): CreateGoalResult {
43
+ signal.throwIfAborted()
44
+ return this.create(agent, request)
45
+ }
46
+
47
+ @RemoteScope('agent', 'current')
48
+ currentForClient(): CreateGoalResult {
49
+ return { accepted: true }
50
+ }
51
+
52
+ private create(_agent: Agent, request: CreateGoalRequest): CreateGoalResult {
53
+ return { accepted: request.objective.length > 0 }
54
+ }
55
+ }
56
+ ```
57
+
58
+ Remote methods may return a value synchronously or return a Promise. For cooperative cancellation, the final parameter in the Host signature must be `signal: AbortSignal` using the global type; it is recorded in the descriptor instead of entering `args`, while the generated Client method accepts an optional final `AbortSignal`.
59
+
60
+ `@Remote({ mode: 'stream' })` marks a method that returns `Iterable`, `AsyncIterable`, or `RemoteStream<Out, In>`: the Gateway delivers each yielded item, a value the Host method produced, over its multiplexed `/api/remote.mux` WebSocket or an in-process carrier, and the generated Client method returns a `RemoteStreamHandle<Out, In>` that iterates the items and exposes `send`, `end`, and `dispose` for the Client-to-Host uplink of the same logical stream. The second type argument of `RemoteStream<Out, In>` declares the uplink item type; the Gateway validates each item the Client sends, because it arrives from the browser, with the generated `In` codec before the Host method reads it through `this.ctx.invocation.uplink<In>()`. The uplink enters neither `args` nor the parameter list; the [Gateway README](../packages/api/gateway/README.md) owns the frame, half-close, cancellation, and inbox-bound contracts.
61
+
62
+ The Client uses concrete functions on ordinary objects, not a JavaScript Proxy. Direct and scoped calls appear under `ctx.remote.<namespace>` and `agentCtx.remote.<namespace>`. Each namespace is a traced Cordis child Service registered as `remote.<namespace>`; the Client assembly mounts contributions through `ctx.remote.$mount()`, and the namespace unloads after its last method is withdrawn. Dependency declarations belong to the actual caller: only a business package that reads `ctx.remote.<namespace>` or `agentCtx.remote.<namespace>` declares both `remote` and `remote.<namespace>` in its own `inject`; assemblies that only mount contributions and higher-level runtimes that do not call that namespace do not declare the namespace dependency on the business package's behalf. When an `@Remote` method has exactly one lookup parameter and a same-named `TypertContextMap` uses the same wire identity, the generated scoped signature omits that identity parameter. `@RemoteScope` generates only the scoped invocation interface.
63
+
64
+ ```ts ignore-check
65
+ import type { SessionId } from '@deepseek-ai/dsh-session/types'
66
+ import type { AgentContext } from '@deepseek-ai/dsh-api-session-controller/client'
67
+ import type { Context } from '@deepseek-ai/cordis'
68
+ import type {} from '@deepseek-ai/dsh-api-remotes/client'
69
+
70
+ export const inject = ['remote', 'remote.goals']
71
+
72
+ declare const ctx: Context
73
+ declare const agentCtx: AgentContext
74
+ declare const agentId: SessionId
75
+
76
+ await ctx.remote.goals.create(agentId, { objective: 'ship it' })
77
+ await agentCtx.remote.goals.create({ objective: 'ship it' })
78
+ ```
79
+
80
+ Client applications assemble only `@deepseek-ai/dsh-api-remotes`. That package imports the `/remote` subpaths of selected business packages as runtime values, mounts their contributions through `ctx.remote.$mount()`, and re-exports the declaration merges from the same files. Adding a Host Remote package is an explicit choice by the Client composition owner; business components do not need to load the Typert Gateway or the business package's Remote JS separately.
81
+
82
+ The `api-remotes` assembly and the `ctx.remote` contract are React-independent; the Host methods visible to any Client assembly are limited to the Remote methods selected at generation time.
83
+
84
+ ## Component responsibilities
85
+
86
+ | Location | Package or entry | Responsibility |
87
+ |---|---|---|
88
+ | Shared | `@deepseek-ai/dsh-typert-protocol` | Declares decorators, Gateway bindings, merge-extensible protocol maps, invocation descriptors, and provider types; starts no TypeScript analysis and registers no Cordis services |
89
+ | Build | `@deepseek-ai/dsh-typert-generator` | Strictly analyzes Remote signatures, the type graph, lookups, Contexts, and source locations from the Host `ts.Program`, then generates Host and Host-for-Client artifacts |
90
+ | Host | `@deepseek-ai/dsh-typert-registry` and Loader | Places generated Host descriptors, schemas, and business-package registrations in `ctx.typert`, and holds lookup and Context providers |
91
+ | Host | `@deepseek-ai/dsh-api-session-controller` | Owns the application Agent/Session identity policy and configures the corresponding Typert lookups |
92
+ | Host | `@deepseek-ai/dsh-api-gateway` | Provides `ctx.typertGateway`, claims Remote endpoints, validates request values, resolves objects or Contexts, and invokes live Cordis services |
93
+ | Host | `@deepseek-ai/dsh-api-remote-access` | Decides which Remote methods a non-owner Peer may call through business-registered role-based policies, filters list results, and streams each Peer's access snapshot; the Gateway requires it |
94
+ | Client | `@deepseek-ai/dsh-api-gateway/client` | Provides `ctx.remote` and `remote.<namespace>` child Services, mounts generated descriptors as concrete methods, and initiates and cancels calls through the Connection |
95
+ | Client | `@deepseek-ai/dsh-api-remotes/client` | Explicitly selects and mounts the `/remote` contributions allowed by the application and brings the corresponding declaration merges into business code |
96
+ | Both | `@deepseek-ai/dsh-client-connection` | Provides the RPC carrier, request correlation, trust boundary, cancellation, response envelope, and the `/api` HTTP bridge |
97
+
98
+ The API Gateway package owns the Host dispatcher and Client Remote endpoint as peer entries, but the two builds never enter the same `ts.Program`. The Host entry does not import the Client Cordis `Context` merge, and the Client entry does not import the Host Gateway service.
99
+
100
+ ## Strict generation pipeline
101
+
102
+ The root build compiles and bundles the Host face, then the Client face, then builds the Web shell ([step order](development.md#typescript-project-layout)). The Host phase first compiles the Host package references, then runs `tsdown --env.DSH_BUILD_FACE host`; the normal Host Project Reference graph compiles the Typert generator, which runs during this tsdown pass with the Host aggregate as its only `ts.Program` seed. The Client phase then compiles the Client package references and runs `tsdown --env.DSH_BUILD_FACE client`, consuming the newly generated Remote Client declarations and runtime contributions without starting Typert again.
103
+
104
+ Both tsdown passes match `vendor/*`, `packages/*/*`, and `apps/cli`, the Host pass also `apps/desktop-host` ([build order](development.md#typescript-project-layout)), and both bundle only JavaScript emitted to `lib/types` by the corresponding tsc phase. The root config does not scan Client artifacts, classify package names, or pass a maintained filter to tsdown; package-local configs return entries for the current phase based on `DSH_BUILD_FACE`. An ordinary Client plugin produces both its Node loader entry and browser bundle during the Client phase.
105
+
106
+ `api/remotes`, `api/gateway`, `api/session-controller`, and `api/workspace-controller` (plus `client/connection`) split TypeScript faces. `api/remotes`' Client project depends on `/remote` declarations generated for business packages during Host tsdown; root aggregates and direct consumers must reference each split package's `tsconfig.host.json` or `tsconfig.client.json` respectively. `api-remotes`' `clientBundle(..., { hostPhase: true })` produces its Host entry during Host tsdown and leaves only the browser entry for Client tsdown. The Agent/Session lookup policy lives in `@deepseek-ai/dsh-api-session-controller`, not in `api-remotes`.
107
+
108
+ Each contributing business package writes generated files to its own `lib/` directory, not to its source directory:
109
+
110
+ | File | Consumer | Contents |
111
+ |---|---|---|
112
+ | `typert.host.js` | Host Loader | Runtime reflection for the Host face, strict invocation descriptors, and schema registration values |
113
+ | `typert.host.d.ts` | Host type system | Generated declarations for the Host face |
114
+ | `typert.remote-client.js` | `api-remotes` | A mountable `TypertRemoteContribution` containing strict descriptors and runtime codecs |
115
+ | `typert.remote-client.d.ts` | Client type system | Declaration merges for `TypertRemoteNamespaceMap` and `TypertRemoteScopeMap`, plus Client-safe type references |
116
+ | `typert.remote-client.d.ts.map` | Editor | Maps generated method properties back to Remote method declarations in the Host package |
117
+
118
+ Business packages expose the Host Loader entry through `./typert` and the Host-for-Client entry through `./remote`. The generator also validates these package exports and published-file lists; it generates artifacts only for explicit contribution packages that provide the corresponding entry.
119
+
120
+ Parameter names in Remote Client declarations come from wire fields, while parameter and return types reference Client-safe types exported by the original business package. The declaration map resolves the generated property behind `ctx.remote.goals.create` back to the Host source method marked with `@Remote`, so editors that support declaration maps can navigate from a Client call to the real implementation instead of stopping at the generated `.d.ts`.
121
+
122
+ Strict analysis requires a Remote to be a public, non-static instance method with a concrete implementation. The method cannot be generic; parameters must be required, named simple identifiers and cannot use destructuring, default values, rest parameters, or optional parameters. Typert generates strict schemas for ordinary JSON-representable types; complex objects such as workspace classes must have a unique `TypertLookupMap` declaration. Lookup and Context packages are responsible for both static declaration merges and runtime provider registration; if either side is missing, the build fails or the first call that needs the provider fails.
123
+
124
+ ## Runtime invocation
125
+
126
+ Remote calls use the Connection's `/api` route. The Client Remote calls `connection.rpc.call('/api', '<namespace>/<method>', { args }, signal)`; the HTTP carrier maps this to `POST /api/<namespace>/<method>`, with a payload containing only a named `args` object.
127
+
128
+ The Connection performs the unified trust check for `/api` before the HTTP bridge, then dispatches inside the shared FetchHandler. The Typert Gateway claims only two-segment endpoints that have a strict descriptor or active SRC marker; it projects binary Remote fields into JSON-compatible metadata and result-relative byte attachments, which Connection frames as multipart responses. Feature-owned exact Fetch routes handle responses outside the RPC envelope, and other requests return 404. Connection owns transport, RPC ids, response envelopes, and request cancellation, while Gateway owns the Remote data protocol and business dispatch. Replacing the Connection carrier does not require changes to Remote descriptors or the Client programming interface.
129
+
130
+ For every call, the Gateway resolves the descriptor and live service from the current registries instead of caching business objects. Every call names the Peer it speaks for, and a disposed Peer is refused with `gateway/peer-disposed`. The Gateway requires the fields in `args` to match the descriptor exactly; for a call whose Peer principal is not the owner it then resolves the resources the call touches and asks `ctx.remoteAccess.decide()`, so a refused call resolves no lookup and activates no Agent. It validates wire values with codecs, resolves objects or receivers through registered lookup or Context providers, and invokes the service method targeted by the binding. The Client Gateway validates decoded binary results with the generated result codec; ordinary JSON results retain their existing handling. A missing provider, unknown identity, binding mismatch, missing or extra argument, schema failure, or missing method fails before entering or after leaving business code.
131
+
132
+ The lookup provider's `register()` supplies both the stable declaration and the default resolver; `configure()` supplies a resolver owned by Host composition that may execute asynchronously and is scoped to an effect lifetime. Configuration may precede provider mounting; without a provider, invocation still fails with `gateway/lookup-unavailable`, and unloading the configuration restores the provider's default policy. The Session Controller owns the standard resolver semantics for `agent` and `session`: it reuses a live Agent, automatically resumes ordinary cold sessions, deduplicates concurrent resumes, and rejects identities owned by subagent routing; the `session` lookup returns that Agent's Session. A resume failure and an ownership fence raise a `RemoteError` carrying their own code, `session/not-found` or `session/agent-busy`, which the Gateway encodes onto the wire unchanged; only an unclassified throw folds into `gateway/internal`.
133
+
134
+ Unloading a Client contribution removes its descriptors and concrete methods together, aborts its in-flight calls, and makes stale method handles retained by external code reject further calls. A strict endpoint withdrawn on the Host also does not degrade to SRC inference, preventing a hot unload from silently weakening validation.
135
+
136
+ ## SRC development fallback
137
+
138
+ When the Host starts from source through `node --import tsx/esm`, it does not execute the Typert compiler plugin. Standard decorator initializers still record the method name and invocation mode in a versioned descriptor on the Service prototype, while `TypertRemoteService` or `bindTypertRemote()` supplies the explicit service binding; the Gateway can therefore construct a weaker temporary descriptor without starting a `ts.Program`. The descriptor's stable string property name lets `remoteMethods()` read markers written by another installed copy of the protocol package.
139
+
140
+ The SRC fallback parses simple parameter names from the live function. When a parameter name matches the `parameter` of a registered lookup, such as `agent` or `session`, it uses the lookup's `agentId` or `sessionId` wire field and resolves the object on the Host; other parameters are checked only for cycle-free, JSON-safe data with no special prototype. `@RemoteScope` directly uses the wire field of a registered Host Context provider. SRC does not read TypeScript types, generate Zod schemas, infer optional parameters, or support destructuring, default values, rest parameters, or duplicate parameter names.
141
+
142
+ SRC solves only dispatch for a Host process running from source. The Client does not discover decorators from the running Host, and the Client Remote refuses to mount SRC descriptors that lack strict codecs; its types, codecs, and Remote registration values always come from the most recently generated `lib/typert.remote-client.*` artifacts.
143
+
144
+ ## Development mode
145
+
146
+ Web development runs one command, which builds current Host, Client, and Web artifacts, starts the source Host, and keeps Client bundles rebuilt:
147
+
148
+ ```sh
149
+ pnpm run dev:web
150
+ ```
151
+
152
+ `dsh` starts the Host source through tsx, so the Host can use the SRC fallback; the `dev:web` watchers rebuild the client-face type emit, Client plugin and library bundles, and the Web shell on source edits. They do not analyze Host decorators or generate Remote Client DTS; only the complete build that `dev:web` runs first (or `pnpm run build`) does.
153
+
154
+ Changing only a Remote method's implementation body without changing its contract does not require regenerating the Typert files. After adding or removing a decorator or changing an export name, namespace, parameter, return value, lookup, Context, or cancellation signature, rerun the ordered lib build so the Host generates the strict contract before the Client compiles and bundles the new contribution:
155
+
156
+ ```sh
157
+ pnpm run build:lib
158
+ ```
159
+
160
+ The running Client watcher consumes these generated files when it rebundles. If `pnpm run build:lib:host` has already refreshed the Host contract, `pnpm run build:lib:client` can complete the Client side; a clean worktree cannot skip the Host phase. Recompiling only the frontend source cannot infer new types from Host decorators. `pnpm run typecheck` generates the Host contract with the bundle-free Typert pass before Client tsc, and the CI build lanes and release builds generate it in the Host bundle phase before Client tsc.
161
+
162
+ ## Boundaries
163
+
164
+ Remote handles unary method calls with one request and one result, and stream methods whose items flow Host → Client while the Client's items reach the running Host method through `this.ctx.invocation.uplink()`. Session event streams, pagination, incremental reduce, projection, and entity substreams still require a separate data protocol and registration model; even when they reuse the Connection, they must not masquerade as Remote methods or enter invocation descriptors.
165
+
166
+ The API layers are organized as `remotes → gateway → connection → webserver`. The BFF and Typert RPC layers live under `packages/api`; Connection and WebServer live at `packages/client/connection` and `packages/host/webserver`. Unary results containing `Uint8Array`, including nested fields and array entries, use [binary Remote transfer](../.agents/notes/implemented/architecture/2026-09-17-workspace-file-binary-transfer.md). A feature that needs a response outside the RPC envelope registers an exact Connection Fetch route.
167
+
168
+ Lookup policy is configured per key, so all `agent` or `session` parameters share the cold-resume behavior. Accepting live objects only would require an explicit per-parameter or per-endpoint policy, which does not exist; the business method must not guess whether the object came from restoration.
169
+
170
+ ### Business ownership
171
+
172
+ `packages/api` owns transport, call shape, and session lifecycle; a business rule belongs to an independent business package and reaches this layer through a registration surface or projected data. The requirements a change here must satisfy — the four `@Remote` disciplines, the additive-names rule, and the boundary this layer keeps — are owned by [Remote and API rules](defensive-patterns/remote-and-api.md), which is where a review checks them.