dsh-plugin-dev-kb 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/CHANGELOG.md +19 -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 +67 -0
  414. package/kb/extra/defensive-patterns.md +0 -33
  415. package/kb/extra/defensive-patterns.zh.md +0 -35
@@ -61,11 +61,23 @@ interface WebBootBatch {
61
61
  }
62
62
  ```
63
63
 
64
+ ```ts type-equiv
65
+ /** Host release identity; two releases are the same when both fields are equal. */
66
+ interface WebBootRelease {
67
+ /** Release version label. */
68
+ version: string
69
+ /** Source commit fixed in when the Host was built; absent when the build recorded none. */
70
+ commit?: string
71
+ }
72
+ ```
73
+
64
74
  ```ts type-equiv
65
75
  /** The composed client entry graph the host injects as `window.__DSH_BOOT__`. */
66
76
  interface WebBootGraph {
67
77
  /** Consistency anchor over the current entry and batch descriptors. */
68
78
  rev: string
79
+ /** Host release identity; absent from a Host that publishes none. */
80
+ release?: WebBootRelease
69
81
  /**
70
82
  * Composed entries in module-graph order — a dynamic package row precedes
71
83
  * rows whose `external` requests that package. Cordis activation order is
@@ -79,6 +91,8 @@ interface WebBootGraph {
79
91
 
80
92
  首次发布与 HMR 都从入口的 mtime、ctime 和大小派生每个 row 的 `rev`,不对可执行字节求哈希。相同产物会跨 Host 重启保持 revision。初始 descriptor 把 row 划入 bootstrap 与 application 两个调度阶段,每个阶段都可以包含多条 descriptor。URL 只含有序 package 资源列表和从这些 row revision 派生的 revision,阶段名不会进入路由。图组合保持 row 顺序,并在 map 形式 URL 超过 3 KiB 前贪心切分,不拼接脚本,也不读取 map。图 revision 对 entry 与 batch descriptor 求哈希。`immediately` 标记第一阶段的 registration barrier;同一 combo 中的 row 共享脚本传输,不同 combo 则独立加载。
81
93
 
94
+ `release` 把本包版本与 client 构建固化进 Host 构建产物的源码 commit 配成一对,不计入图 revision。只有 Host 提供页面启动时的 release,页面才应用图和 rebuilt 帧;其他 release 要等页面刷新([Host release 变化](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/modules/README.zh.md#host-release-changes))。
95
+
82
96
  ## 扫描
83
97
 
84
98
  包加入这张表的方式,是在自己的 package.json 中声明 `dsh.client`(`platform: 'web'`、可选的 `inject` 边、可选的 `immediately`),并在 `exports["./client"]` 导出构建好的 bundle。每个 live row 都从自己的 Loader specifier 与所属 tree `baseUrl` 解析;若 `loader.internal.resolveSync` 可用,则使用 Host face import 所用的同一个实现。最近归属的 package manifest 提供浏览器模块 id,因此相对 source 与 built overlay 仍保留包身份。若不同的 active Loader source 解析到同一包名,组合会失败;一个来源卸载后,仍存活的来源无需重启 fiber 即可提供该 row。
@@ -75,6 +75,8 @@ Group 存储在安装前校验完整提交结果:根 Group 引用与记录一
75
75
 
76
76
  实时 Assistant delta 作为 Client-only `assistant/live-chunk` event 到达。重连 baseline 会把活跃的进程内紧凑 stream 展开为相同的瞬态 event,持久 `assistant/message` 与 `assistant/attempt` event 则嵌入完整紧凑 stream 供历史回放。瞬态 event 可以初始化 Context。每条工具 delta 和后续 `tool/call` 都可以按同一个 callId 匹配为 start,即使名称尚未到达;只有最早的 Match 调用 `start()`,后续 Match 调用 `update()`。准备态 Tool 节点只有在名称可用后才显示。历史分页不把已结束消息展开为实时 delta。消费 Assistant 输出的 Definition 通过同一组匹配和更新接口处理 live chunk 与持久 settlement,其他 Definition 直接返回 `null`,无需展开 stream。
77
77
 
78
+ <a id="definition-and-typed-chat-payload"></a>
79
+
78
80
  ## Definition 与类型化 Chat payload
79
81
 
80
82
  为了完整展示关联关系,下面把生产方声明和 Client 贡献写在同一个代码块里。实际的包族中,branded id 与 `SessionEventMap` 声明留在事件生产方,Definition、Chat data 合并与 renderer 留在 Client 插件。
@@ -251,10 +253,24 @@ export function apply(ctx: ClientContext): void {
251
253
 
252
254
  `ConversationNodeDefinitionInput` 接受上述函数,或事件类型到匹配函数的只读表。函数形式的注册接收所有事件;表形式只接收列出的类型。Registry 在注册关系变化时复制表条目并预计算有序候选 Set,不在逐事件分发时构造候选集合。替换表时先注销,再重新注册。两种形式解析后的 `ConversationNodeDefinition` 都保留可调用的 `match(event)`。
253
255
 
256
+ match 结果带 `exclusive: true` 时,即在该 Definition 的 target 上认领这个事件。Assembler 先求出该事件的全部 match,再逐个接收,因此结果与注册顺序无关:被认领 target 上的其他 Definition 不为该事件建立 Context,该 target 的未匹配事件 fallback 也不运行;其他 target 的 Definition 与没有 target 的 Definition 照常接收。同一 target 被认领两次,或没有 target 的 Definition 发起认领,都会在分发时抛错;fallback 自身返回的认领不起作用。业务 Definition 用认领来呈现某一类消息,而同一 target 上的通用 Definition 原本也会呈现它,例如迟到的问题回答。
257
+
254
258
  `buildLocationData(context, scope)` 可以把 Definition 拥有的数据发布到引擎拥有的 Turn 或 Step 上。通过 declaration merging 为每个 key 指定精确 value 类型。同一 Location 内的另一个 Node 可以使用受限 slot hook(例如 `useTurnData(key)`)读取该值,无须取得 Session,也无须扫描 `snapshot.chat.nodes`。
255
259
 
256
260
  `target` 与 `buildViewNode(context)` 必须同时声明一项由 target 拥有的渲染贡献。把 `context.key` 保留为 React 侧身份,根据持久排序证据选择 `anchorSeq`,并且只返回 renderer 可以直接使用的数据。某个 target Node 一旦发布,就要继续返回同一个 key;需要暂时离开可见流时使用 `visibility: 'hidden'`,不要改为返回 `null` 撤回它。
257
261
 
262
+ Chat Node 还通过 `groupTree` 选择所在行的位置。位置由外到内排列,站在某个位置的 Node 同时具有所有内层位置的效果。Chat 的过程分组、整轮折叠和轮次输入判断只读取这个位置;完整契约见 [group-tree.ts](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/ui-chat/src/client/contract/group-tree.ts)。
263
+
264
+ | Node 是 | 声明 |
265
+ |---|---|
266
+ | Step 1 认领的人的输入,所在轮次开启一个交互段 | `exchange` |
267
+ | 所在轮次的其他输入,如之后的人的输入或触发通知;位于过程之前时是开场输入,之后出现时整个轮次保持展开 | `input` |
268
+ | 留在整轮折叠之外的轮次通知,如错误或已完成轮次页脚 | `turn` |
269
+ | 整轮折叠仍会隐藏的独立行,如模型重试 | `process` |
270
+ | 并入相邻步骤组的普通过程内容 | 不声明 `groupTree` |
271
+
272
+ 各内置 Node 声明的位置见 [Chat 业务规则](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/client/ui-chat/src/client/conversation-nodes/README.zh.md#process-grouping)。如果同一 target 的通用 Definition 也会匹配你的 Node 所呈现的事件,按上文用 `exclusive: true` 认领该事件。
273
+
258
274
  ## Predecessor read
259
275
 
260
276
  有些 Definition 需要另一个业务 kind 在当前位置之前的最新 State。`start` 会收到 `ConversationContextReader`;应在这里调用 `reader.previous<State>(kind)`,不要接收 Context 集合或扫描事件。Reader 返回当前 start `seq` 之前最近一个已启动 Context 的只读数据。
@@ -367,6 +367,8 @@ type SessionStartSource = 'startup' | 'resume' | 'clear' | 'compact'
367
367
 
368
368
  其完整字段、`defineTool`/`ValueSchemaSpec`/`ParameterSchemaSpec` 类型化 schema DSL、`ToolExecution`/`ToolExecutionResult` waterfall 类型,以及工具展示 UI 类型都在 **[tools.md](./tools.md)** 中。
369
369
 
370
+ <a id="repo-wide-type-patterns"></a>
371
+
370
372
  ## 全仓通用类型模式
371
373
 
372
374
  两个模式在每个子系统中反复出现,只在此处记录一次。
@@ -571,7 +573,9 @@ serviceFor<K extends string & keyof Context>(agent: { ctx: Context }, name: K):
571
573
  */
572
574
  async recompose(ctx: Context, id: string): Promise<AgentPreset>
573
575
 
574
- /** Select a preset before a session starts its first turn.
576
+ /** Select a preset before a session starts its first turn. A Session whose
577
+ * log records the preset and whose Agent runs its current revision keeps its
578
+ * composition; nothing is logged or announced.
575
579
  * @param agent Target Agent.
576
580
  * @param agentPreset Requested identity.
577
581
  * @returns Committed preset identity.
@@ -19,6 +19,7 @@ outline: [2,3]
19
19
  type CredentialRef = Branded<'CredentialRef'>
20
20
  ```
21
21
 
22
+ <a id="resolution"></a>
22
23
  ## 解析
23
24
 
24
25
  `resolve(ref)` 返回值及提供该值的来源层(由提供方定义);未配置期间返回 `undefined`。消费方在每个操作中重新解析,绝不跨操作缓存——这种按操作进行的读取正是热更新机制。
@@ -35,7 +36,7 @@ interface ResolvedCredential {
35
36
 
36
37
  ## 描述
37
38
 
38
- `describe(ref)` 在绝不暴露值的前提下回应配置界面:引用当前是否可解析、来自哪一层、`set` 当前能否成功。本地提供方把由当前进程环境供值的引用报告为 `writable: false`——那样的写入会表面成功而解析持续返回遮蔽值,因此 seam 直接拒绝,界面也得以提前把该引用渲染为只读。
39
+ `describe(ref)` 在绝不暴露值的前提下回应配置界面:引用当前是否可解析、来自哪一层、`set` 当前能否成功。本地提供方将其管理的文件排在启动环境之前,因此保存值总会成为生效且可写的那一层;移除后会重新使用启动环境或 `.env` 后备值。
39
40
 
40
41
  ```ts type-equiv
41
42
  /**
@@ -59,7 +60,7 @@ interface CredentialInfo {
59
60
 
60
61
  ## 内嵌 Platform 凭证
61
62
 
62
- PlatformSession 是 getPlatformSession 返回的仅限 Host 快照:origin 指定所配置的 Platform 签发来源,token 包含其已存账号凭证。userId 复制最近一次成功 getProfile 得到的稳定账号 ID;尚无一次成功读取或资料不含 ID 时为 null。快照复用该 ID,不自行发起资料请求,因此 ID 未知时只会让 userId 为 null,而不会延迟调用方;资料读取首次取得稳定 ID 或该 ID 变化时会通知 watch 订阅者,供标识使用方重新读取快照。使用方以 origin 和 userId 作为持久化浏览器存储的键,为 null 时退回临时存储。账号已退登或读取凭证期间凭证变化时不返回快照;签发来源不匹配时失败。原生使用方负责在凭证变化时使文档失效。账号控制器 RPC、AccountView 和 AccountDetails 均不包含此快照。
63
+ PlatformSession 是 getPlatformSession 返回的仅限 Host 快照:origin 指定所配置的 Platform 签发来源,token 包含其已存账号凭证。userId 复制最近一次成功 getProfile 得到的稳定账号 ID;尚无一次成功读取或资料不含 ID 时为 null。快照复用该 ID,不自行发起资料请求,因此 ID 未知时只会让 userId 为 null,而不会延迟调用方;资料读取首次取得稳定 ID 或该 ID 变化时仅通知使用 `watch(signal, true)` 的 Host 订阅者,供标识使用方重新读取快照。使用方以 origin 和 userId 作为持久化浏览器存储的键,为 null 时退回临时存储。账号已退登或读取凭证期间凭证变化时不返回快照;签发来源不匹配时失败。原生使用方负责在凭证变化时使文档失效。账号控制器 RPC、AccountView 和 AccountDetails 均不包含此快照。
63
64
 
64
65
  AccountDetails.balance 将充值钱包投影为 value、赠送钱包投影为 bonusWallets,分别保留币种和十进制余额字符串。查询失败不包含钱包数组。
65
66
 
@@ -140,7 +141,7 @@ Source: [`packages/credentials/authorization/src/index.ts`](https://github.com/d
140
141
 
141
142
  Abstract credential service over two key spaces that answer two questions.
142
143
 
143
- A CredentialRef answers "what is behind this environment-variable name", layered over the process environment, the provider-managed store, and `.env` files. One seam-wide rule binds that half: an empty stored value is absent everywhere — `resolve` skips it, `describe` reports it unconfigured — so a blank never masquerades as a configured secret.
144
+ A CredentialRef answers "what is behind this environment-variable name": the provider-managed store first, then ambient fallbacks such as the process environment and `.env` files. One seam-wide rule binds that half: an empty stored value is absent everywhere — `resolve` skips it, `describe` reports it unconfigured — so a blank never masquerades as a configured secret.
144
145
 
145
146
  A CredentialKey answers "what credential does this plugin hold for this id". Nothing can layer here — an authorization grant has no environment to be read from — so presence of the record is the whole fact, and modifyRecord is the only write path because a correct write depends on the current value (a token refresh is read-decide-replace under one lock).
146
147
 
@@ -164,10 +165,9 @@ abstract resolve(ref: CredentialRef): Promise<ResolvedCredential | undefined>
164
165
  abstract describe(ref: CredentialRef): Promise<CredentialInfo>
165
166
 
166
167
  /**
167
- * Durably store one value in the provider-managed writable source. Rejects
168
- * while a read-only source shadows the reference — the write would appear
169
- * to succeed while resolution keeps returning the shadowing value — and
170
- * rejects an empty value (use {@link unset}).
168
+ * Durably store one value in the provider-managed writable source. The stored
169
+ * value takes precedence over ambient fallbacks, and empty values are
170
+ * rejected (use {@link unset}).
171
171
  * @param ref - the reference to store.
172
172
  * @param value - the non-empty secret value.
173
173
  */
@@ -175,8 +175,8 @@ abstract set(ref: CredentialRef, value: string): Promise<void>
175
175
 
176
176
  /**
177
177
  * Remove one reference from the provider-managed writable source; removing
178
- * an absent reference is a no-op. Rejects while a read-only source shadows
179
- * the reference, like {@link set}.
178
+ * an absent reference is a no-op. Ambient fallback layers may become
179
+ * effective again after removal.
180
180
  * @param ref - the reference to remove.
181
181
  */
182
182
  abstract unset(ref: CredentialRef): Promise<void>
@@ -280,8 +280,8 @@ abstract getState(): Promise<AccountView>
280
280
 
281
281
  /**
282
282
  * Query Platform profile independently of wallet balances.
283
- * A ready result whose stable profile ID first becomes available or changes notifies watch
284
- * consumers, so identity consumers re-read getPlatformSession; repeated IDs stay silent.
283
+ * A ready result whose stable profile ID first becomes available or changes notifies identity-enabled watch
284
+ * consumers, so they re-read getPlatformSession; repeated IDs stay silent.
285
285
  * @param client - identity of the requesting UI for this call.
286
286
  * @returns profile outcome, or null if signed out or the grant changed during the query.
287
287
  */
@@ -336,9 +336,10 @@ abstract signOut(client: AccountClientMetadata): Promise<AccountView>
336
336
  /**
337
337
  * Subscribe to snapshots including a complete initial state.
338
338
  * @param signal - subscription lifetime; ending it never cancels login.
339
+ * @param includeIdentityChanges - also notify when cached Platform identity changes; defaults to false.
339
340
  * @returns complete snapshots as account state changes.
340
341
  */
341
- abstract watch(signal: AbortSignal): AsyncIterable<AccountView>
342
+ abstract watch(signal: AbortSignal, includeIdentityChanges?: boolean): AsyncIterable<AccountView>
342
343
 
343
344
  /**
344
345
  * Resolve a credential only for the inference origin allowed by the provider.
@@ -22,6 +22,8 @@ outline: [2,3]
22
22
  | [deliverables.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/deliverables.zh.md) | 一轮交给用户的东西:`present` 声明的 `PresentedFile` 交付,以及由 git 快照得出、由 Host 提供的 `WorkspaceChangesSummary` 改动摘要 |
23
23
  | [commands.md](./commands.md) | 人类命令注册表服务:定义、适配器发现、直接调用、结果与解析视图 |
24
24
  | [session.md](./session.md) | 完整的 `SessionEventMap` 变体目录、`TurnEndReason`、`deriveMessages()`、执行封闭与独立事件 |
25
+ | [working-directory.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/working-directory.zh.md) | Session 执行目录、持久化变更、恢复与用户上下文 |
26
+ | [worktrees.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/worktrees.zh.md) | 现有权限下的实验性 Git 分支与检出目录创建 |
25
27
  | [persistence.md](./persistence.md) | 持久性 seam:`SessionPersistence`、JSONL 提供方、`session/flush`、崩溃恢复、`SessionHeader` |
26
28
  | [settings.md](./settings.md) | 用户设置 seam:`SettingsNamespace` 注册、分层解析(默认值 → 组合 `base` → 用户文档)、owner scope、热提交 |
27
29
  | [credentials.md](./credentials.md) | 凭据 seam:配置中的 `CredentialRef` 引用(绝不含值)、按操作解析、对 UI 安全的 `CredentialInfo`、提供方来源层 |
@@ -51,7 +53,8 @@ outline: [2,3]
51
53
  | [compaction.md](./compaction.md) | 压缩(compaction)seam:`compaction/*` 会话事件、`CompactionResult`、`CompactionEngine` 接口 |
52
54
  | [subagent.md](./subagent.md) | subagent seam:命名提供方注册表、`SubagentStartRequest`/`Result`/`Run`、启动时与运行时能力拆分 |
53
55
  | [voice-input.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/voice-input.zh.md) | 实验性具名语音识别、临时音频和受版本保护的草稿插入 |
54
- | [agent-team.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/agent-team.zh.md) | Agent Teams:隐式 Lead 身份、具名 continuable teammate、持久 peer mailbox 与共享任务 DAG |
56
+ | [translation.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/translation.zh.md) | 实验性免登录文本翻译与显式 Provider 请求 |
57
+ | [agent-team.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/agent-team.zh.md) | Agent Teams:隐式 Lead 身份、具名 continuable teammate、直接 peer inbox 投递 与共享任务 DAG |
55
58
  | [claude-code-mods.md](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/claude-code-mods.zh.md) | 经实验性桥接运行的 Claude Code 模组:与 Claude Code 不同的每个事件、`$` 成员、链规则、绘制特性与示例模组 |
56
59
  | [web.md](./web.md) | Web 访问 seam:`WebSearchRequest`/`Result`、`WebFetchRequest`/`Result`、`WebFetchBody`、提供方可用性、`WebError` |
57
60
  | [spill.md](./spill.md) | spill 存储 seam:`SaveTextSpill`、`SpillOwner`/`SpillSource`、`SpillRef`、品牌类型 `SpillLocator` |
@@ -10,7 +10,7 @@ outline: [2,3]
10
10
 
11
11
  ## ID 与状态
12
12
 
13
- `JobId` 是按 `<kind>-N` 生成的[品牌化 id](./core.md#branded-ids)。访问控制依赖拥有者授权,而非 id 的保密性。`JobKind` 派生自可合并扩展的 map;注册表将各个 kind 视为不透明的 id 命名空间。
13
+ `JobId` 是按 `<kind>-<short-uuid>` 生成的[品牌化 id](./core.md#branded-ids),kind 后是 UUID 的 16 位小写十六进制字符。访问控制依赖拥有者授权,而非 id 的保密性。`JobKind` 派生自可合并扩展的 map;注册表将各个 kind 视为不透明的 id 命名空间。
14
14
 
15
15
  ```ts type-equiv
16
16
  /**
@@ -19,16 +19,69 @@ outline: [2,3]
19
19
  */
20
20
  interface JobKindMap {
21
21
  bash: 'bash'
22
- subagent: 'subagent'
23
22
  }
24
23
  ```
25
24
 
26
25
  `JobStatus` 为 `'running' | 'stopping' | 'completed' | 'killed' | 'failed'`;生产方特有的事实在运行期间归入 `JobView.progress`,结算后归入 `JobView.detail`。
27
26
 
27
+ <a id="session-lifecycle-records"></a>
28
+
29
+ ## Session 生命周期记录
30
+
31
+ 有所有者的 job 在原始所有者 Session 中发布 `job/registered` 与 `job/settled`。全局唯一的 `jobId` 同时配对这两条记录并控制运行中的 job。SDK 通过 `session.event` 转发这些仅日志记录,不依赖输出读取。时间戳描述注册表提交时刻,不是 CPU 时间或精确的 OS 进程边界;缺少结算时保持不完整。`producerReported` 表示生产方通过兑现 `done` 报告了终态;强制销毁或 promise 拒绝时为 false,不独立确认资源已释放。
32
+
33
+ `job/settled` 可能出现在 `turn/end` 之后。SDK run 结果只覆盖自身观测窗口;需要较晚结算的消费方应保留 Session 订阅或读取持久化历史。轮次完成不表示所有有主 job 都已停止。
34
+
35
+ 应用销毁可能在有主 job 的最后一条结算写入存储前停止 Session 事件路由或关闭写句柄。正常的一次性运行结束、信号关停和进程硬退出都可能出现这种情况。即使运行期注册表报告了终止,缺少 `job/settled` 的区间仍不完整;消费方不得虚构结束时间戳。
36
+
37
+ ```ts type-equiv
38
+ /** Durable identity and registration time of one owned job execution. */
39
+ interface JobRegisteredData {
40
+ /** Unique execution id accepted by job controls and retained in Session history. */
41
+ readonly jobId: JobId
42
+ /** Original owner; copied history does not transfer execution ownership. */
43
+ readonly owner: SessionId
44
+ /** Producer kind. */
45
+ readonly kind: string
46
+ /** Producer-supplied label. */
47
+ readonly label: string
48
+ /** Unix epoch milliseconds when registration committed. */
49
+ readonly startedAt: number
50
+ /** Creating tool invocation, when the producer was called through a tool. */
51
+ readonly toolCall?: JobToolCall
52
+ }
53
+ ```
54
+
55
+ ```ts type-equiv
56
+ /** Registry settlement, including whether the producer reported a terminal outcome. */
57
+ interface JobSettledData extends JobRegisteredData {
58
+ /** Unix epoch milliseconds when the registry committed the terminal record. */
59
+ readonly finishedAt: number
60
+ /** Recorded terminal outcome. */
61
+ readonly status: JobOutcome['status']
62
+ /** Source of the termination request, or producer completion. */
63
+ readonly cause: JobSettleCause
64
+ /** True when done fulfilled; false for rejection or forced failure. Does not certify resource release. */
65
+ readonly producerReported: boolean
66
+ /** Terminal reason, including a recorded kill reason when applicable. */
67
+ readonly detail?: string
68
+ }
69
+ ```
70
+
28
71
  ## 生产方约定
29
72
 
30
73
  `JobSpec` 声明身份、拥有者会话、可选的拉取式 `output` 源与启动器。运行时会在完成预检后携带该 job 的 `JobHandle` 调用 `run()`,随后提交注册,不再执行可能失败的步骤。生产方拥有执行资源;运行时拥有身份、访问、生命周期状态与输出环。
31
74
 
75
+ ```ts type-equiv
76
+ /** Tool dispatch that created a job; nested calls retain their root invocation. */
77
+ interface JobToolCall {
78
+ /** Exact invocation, including a PTC sub-call when applicable. */
79
+ readonly callId: SessionEventMap['tool/call']['callId']
80
+ /** Root model-requested invocation owning this execution. */
81
+ readonly rootCallId: SessionEventMap['tool/call']['callId']
82
+ }
83
+ ```
84
+
32
85
  ```ts type-equiv
33
86
  /**
34
87
  * Producer declaration passed to {@link JobRegistry.start}. The runtime
@@ -37,7 +90,7 @@ interface JobKindMap {
37
90
  * the output ring.
38
91
  */
39
92
  interface JobSpec {
40
- /** Producer kind — also the id prefix (`bash`, `subagent`, …). */
93
+ /** Producer kind — also the id prefix (`bash`, …). */
41
94
  kind: JobKind
42
95
  /** One-line model-facing label (the command; the delegation description). */
43
96
  label: string
@@ -48,6 +101,8 @@ interface JobSpec {
48
101
  * caller until service disposal.
49
102
  */
50
103
  owner?: SessionId
104
+ /** Creating tool invocation, retained in the durable lifecycle records. */
105
+ toolCall?: JobToolCall
51
106
  /**
52
107
  * Optional UTF-8 byte cap for each complete model-facing completion notice or
53
108
  * output read, including controller status metadata. Independent of ring
@@ -81,7 +136,7 @@ interface JobSpec {
81
136
  * throwing, so a producer's trailing flush cannot break its own teardown path.
82
137
  */
83
138
  interface JobHandle {
84
- /** The registry-issued id (`<kind>-N`). */
139
+ /** The registry-issued id (`<kind>-<short-uuid>`). */
85
140
  readonly id: JobId
86
141
  /**
87
142
  * Append one chunk to the output ring. Offsets advance by the chunk's UTF-8
@@ -99,7 +154,7 @@ interface JobHandle {
99
154
  }
100
155
  ```
101
156
 
102
- `JobHooks.done` 会在生产方释放其资源后 resolve,而不是仅在工作完成时 resolve。结果是一个值而非流的 job——subagent 的报告、workflow 渲染出的结果——把它作为 `JobOutcome.result` 返回;模型在结算后的第一次读取携带它一次。
157
+ `JobHooks.done` 会在生产方释放其资源后 resolve,而不是仅在工作完成时 resolve。结果是一个值而非流的 job——workflow 渲染出的结果——把它作为 `JobOutcome.result` 返回;模型在结算后的第一次读取携带它一次。
103
158
 
104
159
  ```ts type-equiv
105
160
  /** Hooks through which the runtime controls and observes producer work. */
@@ -224,7 +279,7 @@ interface JobOutputRead {
224
279
  * stream all consume this one shape.
225
280
  */
226
281
  interface JobView {
227
- /** The registry-issued id (`<kind>-N`). */
282
+ /** The registry-issued id (`<kind>-<short-uuid>`). */
228
283
  readonly id: JobId
229
284
  /**
230
285
  * The producer kind the job was registered with: a Host-registered
@@ -410,7 +465,7 @@ Implementations must honor these semantics:
410
465
  * rejection leaves no job id or execution resource. A throwing starter
411
466
  * leaves nothing registered; after it returns, registration cannot fail.
412
467
  * @param spec - job identity, owner, output sources, and synchronous starter.
413
- * @returns the registry-issued `<kind>-N` id.
468
+ * @returns the registry-issued `<kind>-<short-uuid>` id.
414
469
  */
415
470
  abstract start(spec: JobSpec): JobId
416
471
 
@@ -508,11 +508,33 @@ interface LlmConfigurableProvider {
508
508
  * from outside.
509
509
  */
510
510
  declared?: boolean
511
+ /**
512
+ * Route endpoint the adapter uses when the profile sets no `baseURL`; the
513
+ * adapter may still send an individual model to that model's own endpoint.
514
+ * Absent when the route has no fixed endpoint.
515
+ */
516
+ defaultBaseURL?: string
517
+ /** Environment variables used to construct a provider endpoint; absent when none are reported. */
518
+ baseURLEnv?: readonly string[]
519
+ /** Authentication the adapter performs when the profile names no credential reference; absent when it reports none. */
520
+ nativeAuth?: LlmNativeAuth
511
521
  /** Configuration diagnostic for repair; unaffected models may remain serviceable. */
512
522
  error?: string
513
523
  }
514
524
  ```
515
525
 
526
+ 设置编辑器在提供方配置未设置端点或凭据引用时显示 `defaultBaseURL`、`baseURLEnv` 中的端点配置变量,以及 `nativeAuth`。两个变量列表都只包含名称,不包含值。
527
+
528
+ ```ts type-equiv
529
+ /** Authentication a provider route performs without a credential reference in its profile. */
530
+ interface LlmNativeAuth {
531
+ /** Environment variables the route's authentication reads, in lookup order; empty when it reads none. */
532
+ env: readonly string[]
533
+ /** Whether a stored OAuth sign-in can authenticate the route. */
534
+ oauth: boolean
535
+ }
536
+ ```
537
+
516
538
  ```ts type-equiv
517
539
  /** One adapter-discovered model; catalog membership is advisory, not request validation. */
518
540
  interface LlmModelInfo {
@@ -539,7 +561,7 @@ interface LlmModelContext {
539
561
  }
540
562
  ```
541
563
 
542
- 推理强度是另一项针对确切路由的能力。核心为标识符添加品牌类型,但不枚举其值;有序集合、展示名称和可选的部署默认值均由各适配器持有。
564
+ 推理强度是另一项确切路由能力。核心为标识符添加品牌类型,但不枚举其值;每个适配器负责按强度递增排列的选项、显示名称与可选部署默认值。该顺序比较可选控制,不预测 token 用量、成本或延迟。
543
565
 
544
566
  ```ts type-equiv
545
567
  /** Adapter-owned identifier for one model's selectable reasoning effort. */
@@ -561,7 +583,7 @@ interface LlmReasoningEffortInfo {
561
583
  ```ts type-equiv
562
584
  /** Selectable reasoning efforts for one exact provider/model route. */
563
585
  interface LlmModelReasoningInfo {
564
- /** Supported efforts in adapter-preferred display order. */
586
+ /** Supported efforts from least to greatest selectable reasoning effort, not predicted token use or latency. */
565
587
  efforts: readonly LlmReasoningEffortInfo[]
566
588
  /**
567
589
  * Adapter-configured default materialized into requests when callers omit
@@ -644,8 +666,8 @@ interface GenerateOptions {
644
666
  sessionId?: Branded<'SessionId'>
645
667
  /**
646
668
  * Provider-neutral classification for an auxiliary model call. Adapters may
647
- * map the purpose to model-hidden transport metadata or purpose-specific
648
- * generation policy. Ordinary conversation requests leave it unset.
669
+ * map the purpose to model-hidden transport metadata. Ordinary conversation
670
+ * requests leave it unset.
649
671
  */
650
672
  purpose?: 'compaction' | 'session-title'
651
673
  }
@@ -754,6 +776,16 @@ interface LlmDiscoveredModel {
754
776
 
755
777
  FIXME(call-config-shape):重新审视其余哪些字段出于缓存目的确实属于 epoch 层级(`model` 和模型持有的推理强度已明确属于;采样标量目前出于谨慎保留在此)。
756
778
 
779
+ ```ts type-equiv
780
+ /** Concrete generation settings; omitted controls use the selected route's defaults. */
781
+ interface LlmCallControls {
782
+ reasoningEffort?: ReasoningEffortId
783
+ temperature?: number
784
+ maxTokens?: number
785
+ stop?: string[]
786
+ }
787
+ ```
788
+
757
789
  ```ts type-equiv
758
790
  /**
759
791
  * Provider, model, reasoning effort, and sampling scalars of one conversation's
@@ -761,16 +793,28 @@ FIXME(call-config-shape):重新审视其余哪些字段出于缓存目的确
761
793
  * the loop builds requests from the logged header rather than accepting these
762
794
  * per call.
763
795
  */
764
- interface LlmCallConfig {
796
+ interface LlmCallConfig extends LlmCallControls {
765
797
  provider: string
766
798
  model: string
767
- reasoningEffort?: ReasoningEffortId
768
- temperature?: number
769
- maxTokens?: number
770
- stop?: string[]
771
799
  }
772
800
  ```
773
801
 
802
+ ```ts type-equiv
803
+ /**
804
+ * Synchronous, pure configuration of one call before defaults and validation.
805
+ * Compose functions in the desired order; later writes replace earlier ones.
806
+ * The returned controls cannot change the captured route. Errors reject
807
+ * preparation before dispatch; only the resolved configuration is recordable.
808
+ * @param controls - detached, deeply frozen proposed controls, without defaults.
809
+ * @param model - detached, deeply frozen metadata from the captured adapter generation.
810
+ * @returns concrete controls; omitted fields receive the route's defaults.
811
+ */
812
+ type ConfigureCall = (
813
+ controls: Readonly<LlmCallControls>,
814
+ model: Readonly<LlmResolvedModelInfo>,
815
+ ) => LlmCallControls
816
+ ```
817
+
774
818
  ```ts type-equiv
775
819
  /**
776
820
  * Effective config fields supplied by exact-model adapter resolution rather
@@ -784,7 +828,7 @@ interface LlmCallConfigAdapterDefaults {
784
828
 
785
829
  ## DeepSeek 官方请求扩展
786
830
 
787
- `ctx.deepseekLlmApiExtensions` 是用于向 `deepseek-official` 请求添加顶层字段的提供方特定注册表。贡献插件通过 `register(field, provider)` 认领一个字段;适配器在序列化基础正文后调用 `prepare(request)`,并在 HTTP 前合并返回字段。已准备的 `accept()` 事务会在 2xx 后运行,因此贡献方可以提交交付状态,而不会把传输失败或提供方拒绝当作接受。准备、冲突与接受失败会使用 `REQUEST_EXTENSION`,并使模型请求失败。合并后的正文无法序列化时,请求不带扩展字段发出,跳过接受,并由提供方插件记录被省略的字段名。
831
+ `ctx.deepseekLlmApiExtensions` 是用于向 `deepseek-official` 请求添加顶层字段的提供方特定注册表。贡献插件通过 `register(field, provider)` 认领一个字段;适配器在序列化基础正文后调用 `prepare(request)`,并在 HTTP 前合并返回字段。已准备的 `accept()` 事务会在 2xx 后运行,因此贡献方可以提交交付状态,而不会把传输失败或提供方拒绝当作接受。贡献方准备时抛错会被记录并在该次请求中省略,接受失败只记录告警而不使请求失败;与基础字段冲突时使用 `REQUEST_EXTENSION` 并使模型请求失败。合并后的正文无法序列化时,请求不带扩展字段发出,跳过接受,并由提供方插件记录被省略的字段名。
788
832
 
789
833
  [协议参考](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/deepseek-llm-api-wire-extensions.zh.md)定义确切的请求标头、扩展事务、字段版本和接收方义务。随附组合会将 [`dsh_session_log`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/session/session-log-deepseek/README.zh.md) 注册为无损增量权威日志后缀,并将 [`dsh_plugin_packages`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/llm/plugin-package-inventory-deepseek/README.zh.md) 注册为完整存活 Loader 包集合。这些字段仍位于模型消息之外,也不会进入 pi-ai 适配器路径。
790
834
 
@@ -850,6 +894,15 @@ declare abstract class LlmAdapter {
850
894
  * @returns route-owned image pricing, or `undefined` when the route declares none.
851
895
  */
852
896
  imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;
897
+ /**
898
+ * Resolve the image dimensions and byte target this adapter sends to the model.
899
+ * The default preserves normalized images; adapters that resize must override it.
900
+ * @param _provider - registered provider route.
901
+ * @param _model - exact model id.
902
+ * @param image - normalized image whose request projection is being resolved.
903
+ * @returns the same target used by request serialization, before provider-internal processing.
904
+ */
905
+ imageRequestTarget(_provider: string, _model: string, image: ImageAttachmentRef): ImageRequestTarget;
853
906
  /**
854
907
  * List models this adapter can currently advertise for one owned provider.
855
908
  * Core routing accepts unlisted model ids; catalog-driven entry points such
@@ -919,8 +972,9 @@ register<K extends keyof DeepSeekLlmApiExtensionMap>( field: K, provider: DeepSe
919
972
 
920
973
  /**
921
974
  * Prepare every currently registered field from one immutable base request.
922
- * Preparation failures reject before HTTP dispatch. Field values are cloned and frozen;
923
- * providers retain no mutable alias to the outgoing request.
975
+ * A provider whose preparation throws, or whose value cannot be cloned, is omitted
976
+ * from this request; the first such failure per field is logged. Only cancellation rejects. Field values are cloned
977
+ * and frozen; providers retain no mutable alias to the outgoing request.
924
978
  * @param request - exact serialized request facts before extension fields.
925
979
  * @returns detached fields and their idempotent joint acceptance transaction.
926
980
  */
@@ -1020,6 +1074,15 @@ providerRetryPolicy(provider: string): ResolvedRetryPolicy
1020
1074
  */
1021
1075
  imageRequestPricing(provider: string, model: string): LlmImageRequestPricing | undefined
1022
1076
 
1077
+ /**
1078
+ * Resolve the image projection for an exact registered model route.
1079
+ * @param provider - registered provider route.
1080
+ * @param model - exact model id.
1081
+ * @param image - normalized image reference.
1082
+ * @returns dimensions and byte target used by the adapter's request serializer.
1083
+ */
1084
+ imageRequestTarget(provider: string, model: string, image: ImageAttachmentRef): ImageRequestTarget
1085
+
1023
1086
  /**
1024
1087
  * Resolve the exact text one durable file occurrence contributes to every
1025
1088
  * provider request in the current execution environment.
@@ -1064,11 +1127,15 @@ async resolveCallConfig(config: LlmCallConfig, signal?: AbortSignal): Promise<Ll
1064
1127
  * Resolve one call under its current adapter registration. The returned
1065
1128
  * one-shot handle keeps that registration across header logging and dispatch,
1066
1129
  * so HMR cannot combine one adapter's capability result with another adapter.
1067
- * @param config - provider/model route and optional request controls.
1130
+ * An optional synchronous callback selects concrete controls using captured
1131
+ * model metadata. Defaults and validation apply to its result. Callback
1132
+ * failures and cancellation reject preparation before dispatch.
1133
+ * @param config - provider/model route and optional concrete request controls.
1068
1134
  * @param signal - optional cancellation for adapter-owned capability lookup.
1135
+ * @param configure - pure control selection, called once before defaults and validation.
1069
1136
  * @returns a prepared config and its registration-bound stream entry point.
1070
1137
  */
1071
- async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<PreparedLlmCall>
1138
+ async prepareCall( config: LlmCallConfig, signal?: AbortSignal, configure?: ConfigureCall, ): Promise<PreparedLlmCall>
1072
1139
 
1073
1140
  /**
1074
1141
  * Stream one model call as raw chunks (token-level deltas). Replay state is
@@ -1084,7 +1151,7 @@ async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<Prepared
1084
1151
  stream(options: GenerateOptions): AsyncIterable<StreamChunk>
1085
1152
  ```
1086
1153
 
1087
- Types: [FileAttachmentRef](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/attachment.zh.md)
1154
+ Types: [FileAttachmentRef](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/attachment.zh.md) · [ImageAttachmentRef](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/attachment.zh.md) · [ImageRequestTarget](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/subsystems/attachment.zh.md)
1088
1155
 
1089
1156
  Source: [`packages/llm/llm/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/llm/llm/src/index.ts)
1090
1157
 
@@ -315,6 +315,8 @@ type SessionPersistenceRevision = Branded<'SessionPersistenceRevision'>
315
315
  interface SessionPersistenceSnapshot {
316
316
  /** Detached metadata for one stored session. */
317
317
  readonly header: SessionHeader
318
+ /** Header-only format classification; absent without versioned artifact metadata. */
319
+ readonly formatStatus?: 'current' | 'migration-required'
318
320
  /** Opaque change token; see {@link SessionPersistence.stat}. */
319
321
  readonly revision: SessionPersistenceRevision
320
322
  /** Logical event count, when the backend can provide it cheaply from metadata; otherwise absent. */
@@ -34,7 +34,7 @@ interface PlanModeConfig {
34
34
 
35
35
  ## 退出工具与 `/plan` 命令
36
36
 
37
- [`exit_plan_mode`](../tool-catalog.md#deepseek-aidsh-plan-mode) 在计划模式未激活时仍保持注册,因此进入或离开计划模式只改变提示词段落,绝不改变请求的工具目录;在计划模式之外执行会失败。在计划模式中,它要求一份以 `#` 标题开头的完整 markdown 计划,并通过[用户交互 seam](./user-questions.md) 呈交评审。批准返回 `{ approved: true }`,并记录一个静默(不叙述)的待生效退出,由下一个被接受的轮内 pre-step 追加。因此,计划指引在 assistant 当前这批工具调用的剩余部分继续生效,而工具结果本身会报告这次转换。「继续规划」则是一次携带用户反馈的失败调用,模型据此修订并再次呈交;评审期间交互通道缺失或服务重载同样使调用失败,而不是静默离开计划模式。
37
+ [`exit_plan_mode`](../tool-catalog.md#deepseek-aidsh-plan-mode) 在计划模式未激活时仍保持注册,因此进入或离开计划模式只改变提示词段落,绝不改变请求的工具目录;在计划模式之外执行会失败。在计划模式中,它要求一份以 `#` 标题开头的完整 markdown 计划,并通过[用户交互 seam](./user-questions.md) 呈交评审。批准返回 `{ approved: true }`,并记录一个静默(不叙述)的待生效退出,由下一个被接受的轮内 pre-step 追加。因此,计划指引在 assistant 当前这批工具调用的剩余部分继续生效,而工具结果本身会报告这次转换。「继续规划」则是一次携带用户反馈的失败调用,模型据此修订并再次呈交。放弃评审返回 `{ approved: false }` 并结束当前轮次,计划模式保持激活,直到用户发出下一条消息。评审期间交互通道缺失或服务重载同样使调用失败,而不是静默离开计划模式。
38
38
 
39
39
  当 [`ctx.commands`](./commands.md) 被组合时,插件注册 `/plan [off|message]`:单独的 `/plan` 选择计划模式;任何其他非空消息先选择计划模式,再通过 `agent.steer()` 提交该文本,使其在计划指引下成为下一步骤的普通已记录用户消息;确切参数 `off` 选择未激活,这还会在待生效条目被追加并对请求可见之前将其取消。
40
40
 
@@ -22,11 +22,18 @@ PTC 执行[能力 seam](https://github.com/deepseek-ai/deepseek-harness/blob/mas
22
22
  interface PtcRunRequest {
23
23
  /**
24
24
  * The program source, in the runtime's {@link ../index.ts | language}. It
25
- * runs as the body of an async function: top-level `await` and `return`
26
- * are available, and the completion value becomes
25
+ * follows the provider's programFormat: an async function body supports
26
+ * top-level `await` and `return`; a REPL supports top-level declarations,
27
+ * `await`, and a final expression. The completion value becomes
27
28
  * {@link PtcRunResult.value}.
28
29
  */
29
30
  program: string
31
+ /**
32
+ * Object-identity owner for optional in-memory state. Omission requests a fresh
33
+ * environment. Consumers must await runtime.release(owner) when the owner ends.
34
+ * Stateless providers ignore this field; retained state is never durable.
35
+ */
36
+ stateOwner?: object
30
37
  /** Host functions exposed to the program, one global object per namespace. */
31
38
  bindings: PtcBindingNamespace[]
32
39
  /** Working directory in the mounted filesystem and subprocess execution world. */
@@ -81,7 +88,7 @@ interface PtcRunResult {
81
88
  /** Applied file policy and observed denial, when the provider enforces file policy. */
82
89
  sandbox?: PtcRunSandbox
83
90
  /**
84
- * The program's completion value (its top-level `return`), when it ran to
91
+ * The program's completion value (a return or final REPL expression), when it ran to
85
92
  * completion and the value crossed the runtime's lossless-JSON boundary.
86
93
  * Invalid or over-limit completions fail the run instead of substituting a
87
94
  * rendered string; a failed or value-less run leaves this absent.
@@ -98,6 +105,8 @@ interface PtcRunResult {
98
105
  }
99
106
  ```
100
107
 
108
+ `programFormat` 区分异步函数体与 REPL 语句。`stateOwner` 是标识可选保留内存的进程内对象身份;不同对象相互隔离。消费者在所有者结束时等待 `release(owner)`;清理失败时该调用拒绝。省略所有者时仅执行一次,无状态提供方忽略所有权。[持久 Node 提供方](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/ptc-runtime/ptc-runtime-node/README.zh.md#persistent-repl)定义重置和恢复行为;保留对象不会进入持久 Session 格式。
109
+
101
110
  ## 绑定:宿主函数作为程序全局变量
102
111
 
103
112
  每个 `PtcBindingNamespace` 成为一个异步可调用函数的全局对象;PTC 传入 `tools`。参数与返回值必须是无损 JSON。提供方强制各自的传输上限;seam 不设统一的绑定字节上限。可选错误类描述符创建程序可见的类型化拒绝,无需在运行时内点名消费方。绑定名是自有属性,因此 `__proto__` 不能遍历原型:
@@ -172,12 +181,12 @@ type PtcBindingFunction = (args: unknown) => Promise<PtcJsonValue>
172
181
 
173
182
  日志是纯字符串。每个来源通道保留自身的发出顺序;由于通道元数据不属于 seam,相互独立的通道如何交错由后端决定。运行时捕获程序的 console 与流输出,Consumer 只渲染文本。实现会对序列化后的外层日志数组,以及完成值或失败消息的组合载荷设置上限;固定的结果封装语法与 Consumer 展示空白不计入这份可变载荷计量。超限会显式失败,而不会在值中插入替代内容。
174
183
 
175
- 失败类型是**正交的结果,独立报告**(见 [defensive-patterns](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/defensive-patterns.zh.md)):预算耗尽不是异常,中止不是超时,基底崩溃(如 OOM)也不是二者中的任何一个:
184
+ 失败类型是**正交的结果,独立报告**(见 [defensive-patterns](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/defensive-patterns/general.zh.md)):预算耗尽不是异常,中止不是超时,基底崩溃(如 OOM)也不是二者中的任何一个:
176
185
 
177
186
  ```ts type-equiv
178
187
  /**
179
188
  * Why a run failed. The kinds are orthogonal outcomes reported independently
180
- * (per docs/defensive-patterns.md): a budget expiry is not an exception, an
189
+ * (per docs/defensive-patterns/general.md): a budget expiry is not an exception, an
181
190
  * abort is not a timeout, and a substrate death is neither.
182
191
  *
183
192
  * - `'exception'` — the program threw or failed to parse/transform.
@@ -213,9 +222,18 @@ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnp
213
222
 
214
223
  ### `ctx.ptcRuntime` — `PtcRuntime` (abstract seam)
215
224
 
216
- Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate runs from one another, and terminate and await in-flight runs during disposal.
225
+ Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
217
226
 
218
227
  ```ts cordis-catalog
228
+ /**
229
+ * Release an owner's retained environment and await its execution resources.
230
+ * Stateless providers have no retained resources to release.
231
+ * @param owner - The exact object supplied as the request's state owner.
232
+ * @returns Completion after all owned execution resources have been released.
233
+ * @throws When managed resource cleanup fails.
234
+ */
235
+ release(owner: object): Promise<void>
236
+
219
237
  /**
220
238
  * Resolve supported options and provider defaults before execution.
221
239
  * @param request - Program, bindings, cancellation and optional execution choices.
@@ -10,6 +10,8 @@ outline: [2,3]
10
10
 
11
11
  源码:[`packages/core/scope/src/index.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/core/scope/src/index.ts) 与 [`packages/core/scope/src/store.ts`](https://github.com/deepseek-ai/deepseek-harness/blob/master/packages/core/scope/src/store.ts)。
12
12
 
13
+ <a id="identity-and-dispatch-carrier"></a>
14
+
13
15
  ## 身份标识与分发载体
14
16
 
15
17
  `ScopeKey` 是一个不透明的对象身份标识。已交付的 agent loop(智能体循环)使用活跃的 `Agent` 对象作为自身的 key,但该原语从不检视该对象。