dsh-plugin-guide 0.3.1 → 0.3.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 (370) hide show
  1. package/README.es.md +1 -1
  2. package/README.hi.md +1 -1
  3. package/README.md +1 -1
  4. package/README.pt.md +1 -1
  5. package/README.zh.md +1 -1
  6. package/SKILL.md +1 -1
  7. package/dist/dsh-plugin-dev.js +5 -5
  8. package/guide/links.md +1 -1
  9. package/guide/plugin-dev-guide.md +1 -1
  10. package/guide/quick-reference.es.md +2 -2
  11. package/guide/quick-reference.hi.md +1 -1
  12. package/guide/quick-reference.md +2 -2
  13. package/guide/quick-reference.pt.md +2 -2
  14. package/guide/quick-reference.zh-CN.md +2 -2
  15. package/package.json +3 -3
  16. package/references/cordis-paper-and-community.md +1 -1
  17. package/references/official-docs/AGENTS.md +27 -22
  18. package/references/official-docs/README.i18n.yaml +2 -2
  19. package/references/official-docs/README.md +1 -1
  20. package/references/official-docs/README.zh.md +19 -9
  21. package/references/official-docs/SNAPSHOT.md +5 -5
  22. package/references/official-docs/THIRD_PARTY_NOTICES.md +36 -13
  23. package/references/official-docs/docs/AGENTS.md +4 -4
  24. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +2 -2
  25. package/references/official-docs/docs/agent-lifecycle.md +1 -1
  26. package/references/official-docs/docs/agent-lifecycle.zh.md +2 -2
  27. package/references/official-docs/docs/api-gateway.i18n.yaml +2 -2
  28. package/references/official-docs/docs/api-gateway.md +8 -8
  29. package/references/official-docs/docs/api-gateway.zh.md +8 -8
  30. package/references/official-docs/docs/architecture.i18n.yaml +2 -2
  31. package/references/official-docs/docs/architecture.md +23 -7
  32. package/references/official-docs/docs/architecture.zh.md +36 -20
  33. package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
  34. package/references/official-docs/docs/capability-seams.md +132 -67
  35. package/references/official-docs/docs/capability-seams.zh.md +132 -67
  36. package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
  37. package/references/official-docs/docs/config-catalog.md +659 -373
  38. package/references/official-docs/docs/config-catalog.zh.md +677 -391
  39. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +2 -2
  40. package/references/official-docs/docs/cookbook/adding-a-package.md +2 -3
  41. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +8 -7
  42. package/references/official-docs/docs/cookbook/{adding-a-conversation-node.i18n.yaml → adding-a-remote-api.i18n.yaml} +3 -3
  43. package/references/official-docs/docs/cookbook/adding-a-remote-api.md +197 -0
  44. package/references/official-docs/docs/cookbook/adding-a-remote-api.zh.md +197 -0
  45. package/references/official-docs/docs/cookbook/adding-a-settings-card.i18n.yaml +6 -0
  46. package/references/official-docs/docs/cookbook/adding-a-settings-card.md +102 -0
  47. package/references/official-docs/docs/cookbook/adding-a-settings-card.zh.md +102 -0
  48. package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +2 -2
  49. package/references/official-docs/docs/cookbook/adding-a-tool.md +11 -4
  50. package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +16 -9
  51. package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +2 -2
  52. package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +2 -2
  53. package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +4 -4
  54. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.i18n.yaml +2 -2
  55. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.md +1 -1
  56. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +3 -3
  57. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +2 -2
  58. package/references/official-docs/docs/cookbook/extension-cookbook.md +9 -8
  59. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +17 -14
  60. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.i18n.yaml +1 -1
  61. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.zh.md +1 -1
  62. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +1 -1
  63. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
  64. package/references/official-docs/docs/cordis-api/context.i18n.yaml +1 -1
  65. package/references/official-docs/docs/cordis-api/context.zh.md +1 -1
  66. package/references/official-docs/docs/cordis-api/events.i18n.yaml +1 -1
  67. package/references/official-docs/docs/cordis-api/events.zh.md +1 -1
  68. package/references/official-docs/docs/cordis-api/inherited.md +1 -1
  69. package/references/official-docs/docs/cordis-primer.i18n.yaml +2 -2
  70. package/references/official-docs/docs/cordis-primer.md +2 -1
  71. package/references/official-docs/docs/cordis-primer.zh.md +3 -2
  72. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.i18n.yaml +1 -1
  73. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.zh.md +4 -4
  74. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.i18n.yaml +1 -1
  75. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +4 -4
  76. package/references/official-docs/docs/cordis-tutorial/03-services.i18n.yaml +1 -1
  77. package/references/official-docs/docs/cordis-tutorial/03-services.zh.md +4 -4
  78. package/references/official-docs/docs/cordis-tutorial/04-events.i18n.yaml +1 -1
  79. package/references/official-docs/docs/cordis-tutorial/04-events.zh.md +4 -4
  80. package/references/official-docs/docs/cordis-tutorial/05-config.i18n.yaml +1 -1
  81. package/references/official-docs/docs/cordis-tutorial/05-config.zh.md +2 -2
  82. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +1 -1
  83. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +3 -3
  84. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.i18n.yaml +2 -2
  85. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.md +5 -4
  86. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.zh.md +11 -10
  87. package/references/official-docs/docs/cordis-tutorial/index.i18n.yaml +1 -1
  88. package/references/official-docs/docs/cordis-tutorial/index.zh.md +10 -10
  89. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.i18n.yaml +6 -0
  90. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.md +159 -0
  91. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.zh.md +159 -0
  92. package/references/official-docs/docs/defensive-patterns.i18n.yaml +1 -1
  93. package/references/official-docs/docs/defensive-patterns.zh.md +3 -1
  94. package/references/official-docs/docs/development.i18n.yaml +2 -2
  95. package/references/official-docs/docs/development.md +9 -13
  96. package/references/official-docs/docs/development.zh.md +23 -21
  97. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
  98. package/references/official-docs/docs/event-producer-consumer.md +55 -46
  99. package/references/official-docs/docs/event-producer-consumer.zh.md +55 -46
  100. package/references/official-docs/docs/glossary.i18n.yaml +2 -2
  101. package/references/official-docs/docs/glossary.md +1 -1
  102. package/references/official-docs/docs/glossary.zh.md +1 -1
  103. package/references/official-docs/docs/graph-atlas.i18n.yaml +2 -2
  104. package/references/official-docs/docs/graph-atlas.md +0 -2
  105. package/references/official-docs/docs/graph-atlas.zh.md +7 -9
  106. package/references/official-docs/docs/i18n/README.i18n.yaml +2 -2
  107. package/references/official-docs/docs/i18n/README.md +7 -7
  108. package/references/official-docs/docs/i18n/README.zh.md +11 -9
  109. package/references/official-docs/docs/i18n/style-samples.md +3 -3
  110. package/references/official-docs/docs/i18n/translation-prompt.md +3 -3
  111. package/references/official-docs/docs/i18n/translation-rules.i18n.yaml +2 -2
  112. package/references/official-docs/docs/i18n/translation-rules.md +2 -2
  113. package/references/official-docs/docs/i18n/translation-rules.zh.md +3 -3
  114. package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
  115. package/references/official-docs/docs/module-graph.md +666 -747
  116. package/references/official-docs/docs/module-graph.zh.md +668 -749
  117. package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
  118. package/references/official-docs/docs/persistence-catalog.md +172 -40
  119. package/references/official-docs/docs/persistence-catalog.zh.md +180 -48
  120. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.i18n.yaml +2 -2
  121. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.md +2 -2
  122. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.zh.md +3 -3
  123. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.i18n.yaml +2 -2
  124. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +2 -2
  125. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +2 -2
  126. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.i18n.yaml +2 -2
  127. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.md +2 -2
  128. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +2 -2
  129. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.i18n.yaml +2 -2
  130. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +1 -1
  131. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +2 -2
  132. package/references/official-docs/docs/postmortem/README.i18n.yaml +1 -1
  133. package/references/official-docs/docs/postmortem/README.zh.md +5 -5
  134. package/references/official-docs/docs/rescope.i18n.yaml +2 -2
  135. package/references/official-docs/docs/rescope.md +2 -2
  136. package/references/official-docs/docs/rescope.zh.md +3 -3
  137. package/references/official-docs/docs/subsystems/README.i18n.yaml +2 -2
  138. package/references/official-docs/docs/subsystems/README.md +8 -2
  139. package/references/official-docs/docs/subsystems/README.zh.md +53 -47
  140. package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +6 -0
  141. package/references/official-docs/docs/subsystems/agent-team.md +206 -0
  142. package/references/official-docs/docs/subsystems/agent-team.zh.md +206 -0
  143. package/references/official-docs/docs/subsystems/approval.i18n.yaml +2 -2
  144. package/references/official-docs/docs/subsystems/approval.md +12 -12
  145. package/references/official-docs/docs/subsystems/approval.zh.md +13 -13
  146. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +2 -2
  147. package/references/official-docs/docs/subsystems/attachment.md +90 -7
  148. package/references/official-docs/docs/subsystems/attachment.zh.md +90 -7
  149. package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +2 -2
  150. package/references/official-docs/docs/subsystems/client-modules.md +69 -19
  151. package/references/official-docs/docs/subsystems/client-modules.zh.md +69 -19
  152. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +2 -2
  153. package/references/official-docs/docs/subsystems/code-runtime.md +5 -5
  154. package/references/official-docs/docs/subsystems/code-runtime.zh.md +6 -6
  155. package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
  156. package/references/official-docs/docs/subsystems/commands.md +29 -6
  157. package/references/official-docs/docs/subsystems/commands.zh.md +30 -7
  158. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
  159. package/references/official-docs/docs/subsystems/compaction.md +5 -5
  160. package/references/official-docs/docs/subsystems/compaction.zh.md +11 -11
  161. package/references/official-docs/docs/subsystems/conversation.i18n.yaml +6 -0
  162. package/references/official-docs/docs/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +49 -24
  163. package/references/official-docs/docs/{cookbook/adding-a-conversation-node.zh.md → subsystems/conversation.zh.md} +49 -24
  164. package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
  165. package/references/official-docs/docs/subsystems/core.md +110 -33
  166. package/references/official-docs/docs/subsystems/core.zh.md +141 -62
  167. package/references/official-docs/docs/subsystems/credentials.i18n.yaml +2 -2
  168. package/references/official-docs/docs/subsystems/credentials.md +207 -11
  169. package/references/official-docs/docs/subsystems/credentials.zh.md +207 -11
  170. package/references/official-docs/docs/subsystems/extensions.i18n.yaml +2 -2
  171. package/references/official-docs/docs/subsystems/extensions.md +27 -9
  172. package/references/official-docs/docs/subsystems/extensions.zh.md +30 -12
  173. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
  174. package/references/official-docs/docs/subsystems/feedback.md +4 -4
  175. package/references/official-docs/docs/subsystems/feedback.zh.md +4 -4
  176. package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +2 -2
  177. package/references/official-docs/docs/subsystems/filesystem.md +17 -7
  178. package/references/official-docs/docs/subsystems/filesystem.zh.md +19 -9
  179. package/references/official-docs/docs/subsystems/goal.i18n.yaml +2 -2
  180. package/references/official-docs/docs/subsystems/goal.md +4 -4
  181. package/references/official-docs/docs/subsystems/goal.zh.md +8 -8
  182. package/references/official-docs/docs/subsystems/invariants.i18n.yaml +2 -2
  183. package/references/official-docs/docs/subsystems/invariants.md +2 -2
  184. package/references/official-docs/docs/subsystems/invariants.zh.md +5 -5
  185. package/references/official-docs/docs/subsystems/jobs.i18n.yaml +2 -2
  186. package/references/official-docs/docs/subsystems/jobs.md +3 -3
  187. package/references/official-docs/docs/subsystems/jobs.zh.md +6 -6
  188. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +2 -2
  189. package/references/official-docs/docs/subsystems/llm-streaming.md +193 -22
  190. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +199 -28
  191. package/references/official-docs/docs/subsystems/lsp.i18n.yaml +2 -2
  192. package/references/official-docs/docs/subsystems/lsp.md +2 -2
  193. package/references/official-docs/docs/subsystems/lsp.zh.md +3 -3
  194. package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +2 -2
  195. package/references/official-docs/docs/subsystems/permission-presets.md +8 -8
  196. package/references/official-docs/docs/subsystems/permission-presets.zh.md +8 -8
  197. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
  198. package/references/official-docs/docs/subsystems/persistence.md +35 -17
  199. package/references/official-docs/docs/subsystems/persistence.zh.md +38 -20
  200. package/references/official-docs/docs/subsystems/plan.i18n.yaml +2 -2
  201. package/references/official-docs/docs/subsystems/plan.md +4 -4
  202. package/references/official-docs/docs/subsystems/plan.zh.md +10 -10
  203. package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +2 -2
  204. package/references/official-docs/docs/subsystems/sandbox.md +5 -3
  205. package/references/official-docs/docs/subsystems/sandbox.zh.md +8 -6
  206. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
  207. package/references/official-docs/docs/subsystems/schedule.md +9 -3
  208. package/references/official-docs/docs/subsystems/schedule.zh.md +11 -5
  209. package/references/official-docs/docs/subsystems/scope.i18n.yaml +1 -1
  210. package/references/official-docs/docs/subsystems/scope.zh.md +1 -1
  211. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
  212. package/references/official-docs/docs/subsystems/session-projection.md +136 -67
  213. package/references/official-docs/docs/subsystems/session-projection.zh.md +136 -67
  214. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +2 -2
  215. package/references/official-docs/docs/subsystems/session-query.md +11 -3
  216. package/references/official-docs/docs/subsystems/session-query.zh.md +12 -4
  217. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +2 -2
  218. package/references/official-docs/docs/subsystems/session-reference.md +94 -7
  219. package/references/official-docs/docs/subsystems/session-reference.zh.md +95 -8
  220. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +2 -2
  221. package/references/official-docs/docs/subsystems/session-telemetry.md +5 -6
  222. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +9 -10
  223. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
  224. package/references/official-docs/docs/subsystems/session-title.md +3 -3
  225. package/references/official-docs/docs/subsystems/session-title.zh.md +5 -5
  226. package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
  227. package/references/official-docs/docs/subsystems/session.md +284 -39
  228. package/references/official-docs/docs/subsystems/session.zh.md +301 -54
  229. package/references/official-docs/docs/subsystems/settings.i18n.yaml +2 -2
  230. package/references/official-docs/docs/subsystems/settings.md +105 -10
  231. package/references/official-docs/docs/subsystems/settings.zh.md +105 -10
  232. package/references/official-docs/docs/subsystems/shell.i18n.yaml +2 -2
  233. package/references/official-docs/docs/subsystems/shell.md +3 -3
  234. package/references/official-docs/docs/subsystems/shell.zh.md +11 -11
  235. package/references/official-docs/docs/subsystems/skills.i18n.yaml +2 -2
  236. package/references/official-docs/docs/subsystems/skills.md +26 -3
  237. package/references/official-docs/docs/subsystems/skills.zh.md +29 -6
  238. package/references/official-docs/docs/subsystems/slots.i18n.yaml +6 -0
  239. package/references/official-docs/docs/subsystems/slots.md +174 -0
  240. package/references/official-docs/docs/subsystems/slots.zh.md +174 -0
  241. package/references/official-docs/docs/subsystems/spill.i18n.yaml +2 -2
  242. package/references/official-docs/docs/subsystems/spill.md +4 -4
  243. package/references/official-docs/docs/subsystems/spill.zh.md +6 -6
  244. package/references/official-docs/docs/subsystems/storage.i18n.yaml +2 -2
  245. package/references/official-docs/docs/subsystems/storage.md +13 -5
  246. package/references/official-docs/docs/subsystems/storage.zh.md +16 -8
  247. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
  248. package/references/official-docs/docs/subsystems/subagent.md +120 -32
  249. package/references/official-docs/docs/subsystems/subagent.zh.md +131 -41
  250. package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +2 -2
  251. package/references/official-docs/docs/subsystems/subprocess.md +3 -3
  252. package/references/official-docs/docs/subsystems/subprocess.zh.md +5 -5
  253. package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +2 -2
  254. package/references/official-docs/docs/subsystems/system-prompt.md +21 -8
  255. package/references/official-docs/docs/subsystems/system-prompt.zh.md +23 -10
  256. package/references/official-docs/docs/subsystems/terminal.i18n.yaml +2 -2
  257. package/references/official-docs/docs/subsystems/terminal.md +2 -2
  258. package/references/official-docs/docs/subsystems/terminal.zh.md +4 -4
  259. package/references/official-docs/docs/subsystems/todo.i18n.yaml +6 -0
  260. package/references/official-docs/docs/subsystems/todo.md +32 -0
  261. package/references/official-docs/docs/subsystems/todo.zh.md +32 -0
  262. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
  263. package/references/official-docs/docs/subsystems/token-meter.md +27 -12
  264. package/references/official-docs/docs/subsystems/token-meter.zh.md +28 -13
  265. package/references/official-docs/docs/subsystems/tools.i18n.yaml +2 -2
  266. package/references/official-docs/docs/subsystems/tools.md +46 -46
  267. package/references/official-docs/docs/subsystems/tools.zh.md +54 -54
  268. package/references/official-docs/docs/subsystems/typert.i18n.yaml +2 -2
  269. package/references/official-docs/docs/subsystems/typert.md +65 -58
  270. package/references/official-docs/docs/subsystems/typert.zh.md +67 -60
  271. package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +2 -2
  272. package/references/official-docs/docs/subsystems/user-questions.md +35 -35
  273. package/references/official-docs/docs/subsystems/user-questions.zh.md +35 -35
  274. package/references/official-docs/docs/subsystems/web-client.i18n.yaml +6 -0
  275. package/references/official-docs/docs/subsystems/web-client.md +95 -0
  276. package/references/official-docs/docs/subsystems/web-client.zh.md +95 -0
  277. package/references/official-docs/docs/subsystems/web-server.i18n.yaml +2 -2
  278. package/references/official-docs/docs/subsystems/web-server.md +55 -9
  279. package/references/official-docs/docs/subsystems/web-server.zh.md +56 -10
  280. package/references/official-docs/docs/subsystems/web.i18n.yaml +2 -2
  281. package/references/official-docs/docs/subsystems/web.md +14 -7
  282. package/references/official-docs/docs/subsystems/web.zh.md +16 -9
  283. package/references/official-docs/docs/subsystems/webhook.i18n.yaml +6 -0
  284. package/references/official-docs/docs/subsystems/webhook.md +70 -0
  285. package/references/official-docs/docs/subsystems/webhook.zh.md +70 -0
  286. package/references/official-docs/docs/subsystems/workflow.i18n.yaml +2 -2
  287. package/references/official-docs/docs/subsystems/workflow.md +8 -8
  288. package/references/official-docs/docs/subsystems/workflow.zh.md +13 -13
  289. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +2 -2
  290. package/references/official-docs/docs/subsystems/workspace.md +98 -5
  291. package/references/official-docs/docs/subsystems/workspace.zh.md +102 -9
  292. package/references/official-docs/docs/testing.i18n.yaml +2 -2
  293. package/references/official-docs/docs/testing.md +15 -10
  294. package/references/official-docs/docs/testing.zh.md +15 -10
  295. package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
  296. package/references/official-docs/docs/tool-catalog.md +433 -27
  297. package/references/official-docs/docs/tool-catalog.zh.md +438 -29
  298. package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +2 -2
  299. package/references/official-docs/docs/tool-execution-pipeline.md +1 -1
  300. package/references/official-docs/docs/tool-execution-pipeline.zh.md +1 -1
  301. package/references/official-docs/docs/user/develop/basic/config.i18n.yaml +2 -2
  302. package/references/official-docs/docs/user/develop/basic/config.md +1 -1
  303. package/references/official-docs/docs/user/develop/basic/config.zh.md +4 -4
  304. package/references/official-docs/docs/user/develop/basic/index.i18n.yaml +1 -1
  305. package/references/official-docs/docs/user/develop/basic/index.zh.md +5 -5
  306. package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +2 -2
  307. package/references/official-docs/docs/user/develop/basic/publish.md +3 -3
  308. package/references/official-docs/docs/user/develop/basic/publish.zh.md +7 -7
  309. package/references/official-docs/docs/user/develop/basic/tool.i18n.yaml +2 -2
  310. package/references/official-docs/docs/user/develop/basic/tool.md +3 -3
  311. package/references/official-docs/docs/user/develop/basic/tool.zh.md +4 -4
  312. package/references/official-docs/docs/user/develop/framework/events.i18n.yaml +2 -2
  313. package/references/official-docs/docs/user/develop/framework/events.md +2 -2
  314. package/references/official-docs/docs/user/develop/framework/events.zh.md +3 -3
  315. package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +1 -1
  316. package/references/official-docs/docs/user/develop/framework/index.zh.md +3 -3
  317. package/references/official-docs/docs/user/develop/framework/service.i18n.yaml +2 -2
  318. package/references/official-docs/docs/user/develop/framework/service.md +1 -1
  319. package/references/official-docs/docs/user/develop/framework/service.zh.md +3 -3
  320. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.i18n.yaml +6 -0
  321. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.md +15 -0
  322. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.zh.md +15 -0
  323. package/references/official-docs/docs/user/develop/practice/index.i18n.yaml +2 -2
  324. package/references/official-docs/docs/user/develop/practice/index.md +1 -1
  325. package/references/official-docs/docs/user/develop/practice/index.zh.md +3 -3
  326. package/references/official-docs/docs/user/develop/practice/llm-adapter.i18n.yaml +2 -2
  327. package/references/official-docs/docs/user/develop/practice/llm-adapter.md +4 -3
  328. package/references/official-docs/docs/user/develop/practice/llm-adapter.zh.md +4 -3
  329. package/references/official-docs/docs/user/guide/github-review.i18n.yaml +6 -0
  330. package/references/official-docs/docs/user/guide/github-review.md +102 -0
  331. package/references/official-docs/docs/user/guide/github-review.zh.md +102 -0
  332. package/references/official-docs/docs/user/guide/index.i18n.yaml +2 -2
  333. package/references/official-docs/docs/user/guide/index.md +2 -2
  334. package/references/official-docs/docs/user/guide/index.zh.md +8 -8
  335. package/references/official-docs/docs/user/guide/mcp-memory.i18n.yaml +6 -0
  336. package/references/official-docs/docs/user/guide/mcp-memory.md +101 -0
  337. package/references/official-docs/docs/user/guide/mcp-memory.zh.md +101 -0
  338. package/references/official-docs/docs/user/guide/providers.i18n.yaml +2 -2
  339. package/references/official-docs/docs/user/guide/providers.md +40 -1
  340. package/references/official-docs/docs/user/guide/providers.zh.md +41 -2
  341. package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +2 -2
  342. package/references/official-docs/docs/user/guide/python-sdk.md +80 -34
  343. package/references/official-docs/docs/user/guide/python-sdk.zh.md +87 -41
  344. package/references/official-docs/docs/user/guide/schedule.i18n.yaml +6 -0
  345. package/references/official-docs/docs/user/guide/schedule.md +21 -0
  346. package/references/official-docs/docs/user/guide/schedule.zh.md +21 -0
  347. package/references/official-docs/docs/web-styling.i18n.yaml +1 -1
  348. package/references/official-docs/docs/web-styling.zh.md +2 -2
  349. package/references/official-docs/packages/AGENTS.md +3 -2
  350. package/references/official-docs/packages/README.md +104 -59
  351. package/references/official-docs/vendor/README.md +1 -0
  352. package/references/official-docs/website-docs.ts +52 -11
  353. package/references/sources.md +2 -2
  354. package/references/website-pages.md +3 -3
  355. package/scripts/download-sources.ps1 +1 -1
  356. package/scripts/sync-official-docs.ps1 +19 -11
  357. package/scripts/verify-kit.ps1 +0 -4
  358. package/templates/js/README.es.md +1 -1
  359. package/templates/js/README.hi.md +1 -1
  360. package/templates/js/README.md +1 -1
  361. package/templates/js/README.pt.md +1 -1
  362. package/templates/js/README.zh.md +1 -1
  363. package/templates/js/package.json +4 -4
  364. package/templates/ts/README.es.md +1 -1
  365. package/templates/ts/README.hi.md +1 -1
  366. package/templates/ts/README.md +1 -1
  367. package/templates/ts/README.pt.md +1 -1
  368. package/templates/ts/README.zh.md +1 -1
  369. package/templates/ts/package.json +4 -4
  370. package/references/official-docs/examples/AGENTS.md +0 -20
@@ -2,11 +2,11 @@
2
2
 
3
3
  [English](jobs.md) | 中文
4
4
 
5
- 长时间运行的生产方、`ctx.jobs` 与任务控制命令共用的类型。[运行时 Agent Note](../../.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.md) 负责设计;本页记录 [`packages/jobs/jobs/src/types.ts`](../../packages/jobs/jobs/src/types.ts) 中的确切字段和变体。
5
+ 长时间运行的生产方、`ctx.jobs` 与任务控制命令共用的类型。[运行时 Agent Note](../../.agents/notes/implemented/architecture/2026-06-20-generic-long-running-tool-runtime.zh.md) 负责设计;本页记录 [`packages/jobs/jobs/src/types.ts`](../../packages/jobs/jobs/src/types.ts) 中的确切字段和变体。
6
6
 
7
7
  ## ID 与状态
8
8
 
9
- `JobId` 是按 `<kind>-N` 生成的[品牌化 id](core.md#branded-ids)。访问控制依赖拥有者授权,而非 id 的保密性。`JobKind` 派生自可合并扩展的 map;注册表将各个 kind 视为不透明的 id 命名空间。
9
+ `JobId` 是按 `<kind>-N` 生成的[品牌化 id](core.zh.md#branded-ids)。访问控制依赖拥有者授权,而非 id 的保密性。`JobKind` 派生自可合并扩展的 map;注册表将各个 kind 视为不透明的 id 命名空间。
10
10
 
11
11
  ```ts type-equiv
12
12
  /**
@@ -154,7 +154,7 @@ interface JobRead {
154
154
 
155
155
  ## 服务行为
156
156
 
157
- 抽象的 [`JobRegistry`](../../packages/jobs/jobs/src/index.ts) Service Definition 规定原子 `start`、限定调用方作用域的 `get` 和 `list`、`read`、`kill`、有界 `wait`、故障隔离的 `onJobDone` 与 `onJobsChanged` 监听器,以及 `attachController` 何时可用;[`LocalJobRegistry`](../../packages/jobs/jobs-local/src/index.ts) 是其进程局部 Service Provider。授权会比较拥有者会话;拥有者清理与准入会使用确切的已注册 `Agent` 实例。本地 Service Provider 的 `maxConcurrentJobsPerOwner` 配置必须是正的安全整数,默认值为 `10`;它按确切 owner 统计 `running` 与 `stopping` 记录,所有无 owner 任务共享一个服务级桶,并在生产方终止结算后释放容量。Service Definition 约定见 [`dsh-jobs`](../../packages/jobs/jobs/README.md),注册表生命周期与准入策略见 [`dsh-jobs-local`](../../packages/jobs/jobs-local/README.md),面向模型的 Consumer 见 [`dsh-tool-jobs`](../../packages/jobs/tool-jobs/README.md)。
157
+ 抽象的 [`JobRegistry`](../../packages/jobs/jobs/src/index.ts) Service Definition 规定原子 `start`、限定调用方作用域的 `get` 和 `list`、`read`、`kill`、有界 `wait`、故障隔离的 `onJobDone` 与 `onJobsChanged` 监听器,以及 `attachController`;[`LocalJobRegistry`](../../packages/jobs/jobs-local/src/index.ts) 是其进程局部 Service Provider。授权会比较拥有者会话;拥有者清理与准入会使用确切的已注册 `Agent` 实例。本地 Service Provider 的 `maxConcurrentJobsPerOwner` 配置必须是正的安全整数,默认值为 `10`;它按确切 owner 统计 `running` 与 `stopping` 记录,所有无 owner 任务共享一个服务级桶,并在生产方终止结算后释放容量。Service Definition 约定见 [`dsh-jobs`](../../packages/jobs/jobs/README.zh.md),注册表生命周期与准入策略见 [`dsh-jobs-local`](../../packages/jobs/jobs-local/README.zh.md),面向模型的 Consumer 见 [`dsh-tool-jobs`](../../packages/jobs/tool-jobs/README.zh.md)。
158
158
 
159
159
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
160
160
 
@@ -162,7 +162,7 @@ interface JobRead {
162
162
 
163
163
  ## Cordis API
164
164
 
165
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
165
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
166
166
 
167
167
  <a id="ctxjobs--jobregistry-abstract-seam"></a>
168
168
 
@@ -284,7 +284,7 @@ abstract onJobsChanged(listener: JobsChangedListener): () => void
284
284
  abstract attachController(name: string): () => void
285
285
  ```
286
286
 
287
- Types: [Agent](core.md)
287
+ Types: [Agent](core.zh.md)
288
288
 
289
- Source: [`packages/jobs/jobs/src/index.ts:62`](../../packages/jobs/jobs/src/index.ts)
289
+ Source: [`packages/jobs/jobs/src/index.ts`](../../packages/jobs/jobs/src/index.ts)
290
290
  <!-- END GENERATED cordis-surface -->
@@ -2,5 +2,5 @@
2
2
  # side as of the last confirmed-consistent state. Both languages carry equal authority;
3
3
  # after editing either side, bring the other along and re-record with:
4
4
  # pnpm run verify-translation-pairing --write docs/subsystems/llm-streaming.md
5
- llm-streaming.md: 0d3a0d53c875c9d943146ba44b775d81fc9cae01
6
- llm-streaming.zh.md: fbaa47d14d57e7377be4db6ecaa04f11997572a6
5
+ llm-streaming.md: 6867ae292d77474bcedc1466ae0ce6b1fc1c92d3
6
+ llm-streaming.zh.md: b75e24f2e9010b4fb08c035f14bc4e91dc3971ef
@@ -28,7 +28,19 @@ interface ContentBlockMap {
28
28
  }
29
29
  ```
30
30
 
31
- The block interfaces (full fields in source): `TextBlock` (`text`), `ReasoningBlock` (thinking, distinct from visible text), `ImageBlock` (a durable [image attachment](attachment.md)), `ToolCallBlock` (`id: CallId`, `name`, raw-JSON `arguments`), and `ToolResultBlock` (`toolCallId`, nested `content: ContentBlock[]`, `isError?`). `ContentBlock = ContentBlockMap[ContentBlockType]`. A new modality belongs in the merge-extensible map only when its adapter, UI, compaction, and durable replay paths honor it.
31
+ The block interfaces (full fields in source): `TextBlock` (`text`), `ReasoningBlock` (thinking, distinct from visible text), `ImageBlock` (a durable [image attachment](attachment.md)), `ToolCallBlock` (`id: ToolCallId`, `name`, raw-JSON `arguments`), and `ToolResultBlock` (`toolCallId`, nested `content: ContentBlock[]`, `isError?`). `ContentBlock = ContentBlockMap[ContentBlockType]`. A new modality belongs in the merge-extensible map only when its adapter, UI, compaction, and durable replay paths honor it.
32
+
33
+ Image access belongs to request serialization rather than the durable attachment or deterministic request-image version. `resolveImageAttachmentAccess()` combines the attachment provider's optional host object path with a mapping supplied by the consumer for the current tool execution filesystem. The result is available only for that request and does not participate in `variantId`.
34
+
35
+ Source: [`packages/llm/llm/src/content.ts`](../../packages/llm/llm/src/content.ts)
36
+
37
+ ```ts type-equiv
38
+ /** Execution-world path that model tools can use to read one normalized attachment. */
39
+ interface ImageAttachmentAccess {
40
+ /** Absolute path to immutable normalized bytes; callers must treat it as read-only. */
41
+ readonlyPath: string
42
+ }
43
+ ```
32
44
 
33
45
  Source: [`packages/llm/llm/src/message.ts`](../../packages/llm/llm/src/message.ts)
34
46
 
@@ -157,6 +169,29 @@ type ContextFormed =
157
169
 
158
170
  A streaming response interleaves several typed blocks (text, reasoning, multiple tool calls). `index` ties each delta to its block; `block-end` carries the fully-assembled `ContentBlock` so consumers don't have to re-assemble deltas themselves. It is a **closed** discriminated union — a `switch` over `type` ends with `assertNever`, so adding a variant breaks compilation at every consumer that must handle it.
159
171
 
172
+ ```ts type-equiv
173
+ /**
174
+ * Adapter-private lossless-JSON state for replaying a successful response,
175
+ * carried by a terminal `finish` chunk and stored on the assembled assistant
176
+ * message's model source. Both halves stay opaque to the harness; only the
177
+ * split is shared vocabulary, so assembly can keep stored metadata aligned
178
+ * with stored content without reading either half.
179
+ */
180
+ interface ReplayEnvelope {
181
+ /** Response-level adapter-private metadata (ids, native stop reason). */
182
+ response: unknown
183
+ /**
184
+ * Per-block adapter-private metadata, one entry per emitted block in
185
+ * first-seen stream order. When assembly drops a block it drops the entry at
186
+ * the same position; entries whose length does not match the emitted block
187
+ * count discard the whole envelope. An adapter whose metadata is independent
188
+ * of block structure omits this field and the envelope passes through
189
+ * assembly unchanged.
190
+ */
191
+ blocks?: readonly unknown[]
192
+ }
193
+ ```
194
+
160
195
  ```ts type-equiv
161
196
  /**
162
197
  * Raw streaming protocol emitted by adapters.
@@ -170,14 +205,14 @@ type StreamChunk =
170
205
  | { type: 'block-start'; index: number; blockType: ContentBlockType }
171
206
  | { type: 'text-delta'; index: number; text: string }
172
207
  | { type: 'reasoning-delta'; index: number; text: string }
173
- | { type: 'tool-call-delta'; index: number; id: CallId; name?: string; argumentsDelta: string }
208
+ | { type: 'tool-call-delta'; index: number; id: ToolCallId; name?: string; argumentsDelta: string }
174
209
  | { type: 'block-end'; index: number; block: ContentBlock }
175
210
  | { type: 'usage'; usage: TokenUsage }
176
211
  | {
177
212
  type: 'finish'
178
213
  reason: FinishReason
179
- /** Adapter-private lossless-JSON state for replaying a successful response. */
180
- replayState?: unknown
214
+ /** Replay metadata for a successful response; see {@link ReplayEnvelope}. */
215
+ replayState?: ReplayEnvelope
181
216
  }
182
217
  ```
183
218
 
@@ -201,6 +236,44 @@ interface LlmFailure {
201
236
  }
202
237
  ```
203
238
 
239
+ ## Request-image pricing
240
+
241
+ An adapter whose provider charges visual tokens for request images declares per-route pricing by overriding `LlmAdapter.imageRequestPricing`, and `ctx.llm.imageRequestPricing(provider, model)` resolves it synchronously for consumers. The token meter resolves the routed model's pricing on every measurement so compaction pressure, retention, and range selection price image history as the routed request actually sends it; the DeepSeek adapter reproduces its own request projection (per-model pixel budget, oldest-first offload) and prices retained images with the published v4 vision accounting, while provider usage remains the authoritative anchor for completed requests.
242
+
243
+ ```ts type-equiv
244
+ /**
245
+ * Request price of one ordered image occurrence under one exact model route's
246
+ * request projection. Every occurrence resolves to the pair the wire actually
247
+ * carries: provider visual tokens for a retained image, plus the model-visible
248
+ * text sent with or instead of it (request-preview handle, offload placeholder,
249
+ * or text-only substitution). The caller prices `text` with its own text
250
+ * estimator so provider pricing never fixes a text tokenization.
251
+ */
252
+ interface LlmImageRequestPrice {
253
+ /** Provider visual tokens for the retained request image; 0 when only text represents this occurrence. */
254
+ visualTokens: number
255
+ /** Model-visible text sent for this occurrence, to be priced by the caller's text estimator. */
256
+ text: string
257
+ }
258
+ ```
259
+
260
+ ```ts type-equiv
261
+ /**
262
+ * Provider-side request-image pricing for one exact model route. Implemented
263
+ * by adapters whose provider charges visual tokens; consumers (the token
264
+ * meter) resolve it synchronously per measurement, so implementations must not
265
+ * perform I/O.
266
+ */
267
+ interface LlmImageRequestPricing {
268
+ /**
269
+ * Price every image occurrence of one request projection.
270
+ * @param images - durable image references in request order, one entry per occurrence.
271
+ * @returns one price per occurrence, aligned by index with `images`.
272
+ */
273
+ priceImages(images: readonly ImageAttachmentRef[]): readonly LlmImageRequestPrice[]
274
+ }
275
+ ```
276
+
204
277
  ## The adapter contract
205
278
 
206
279
  Every adapter MUST obey these, and every consumer may rely on them:
@@ -213,11 +286,11 @@ Every adapter MUST obey these, and every consumer may rely on them:
213
286
  - **Context overflow has one canonical code.** Both DeepSeek adapters classify explicit provider detail through `isContextWindowExceededError()` and surface `CONTEXT_WINDOW_EXCEEDED`, whether the failure arrives as a thrown HTTP `LlmError` or an in-band finish error. Consumers route on the code, never provider text.
214
287
  - **An empty completion is a retryable error, not a silent success.** Both adapters map a terminal `stop` finish that carried no content blocks to `finish {kind:'error'}` with the canonical `EMPTY_RESPONSE` code, and `dsh-llm-retry` retries it by default; see [empty model responses are retryable](../../.agents/notes/implemented/bug-fix/2026-07-24-empty-model-response-is-retryable.md).
215
288
  - **Every provider HTTP request carries the app-attribution header.** Adapters send `attributionHeaders()` (below) - the `User-Agent` baseline - and prove it with a wire-level test.
216
- - **Replay state is adapter-owned.** A successful `finish` may carry lossless-JSON state needed to reconstruct a native provider response. The loop stores it with the assembled assistant message. On a later request, `LlmRuntime` passes the state only when the historical provider and target provider are currently registered to the exact same adapter instance. That adapter validates the state and owns any cross-model or cross-provider conversion; other adapters receive the provider-neutral content plus provider/model fields without the private state.
289
+ - **Replay state is adapter-owned; its split is shared.** A successful `finish` may carry a `ReplayEnvelope`: opaque response-level metadata plus optional per-block entries aligned with the emitted block sequence. The alignment is the harness's vocabulary — when assembly drops a block it drops the entry at the same position, so stored metadata always describes stored content. The loop stores the pruned envelope with the assembled assistant message. On a later request, `LlmRuntime` passes the state only when the historical provider and target provider are currently registered to the exact same adapter instance. That adapter validates the state and owns any cross-model or cross-provider conversion; other adapters receive the provider-neutral content plus provider/model fields without the private state. Durable content stays authoritative: a stored state the reading adapter cannot use degrades that one message to provider-neutral conversion with a diagnostic instead of failing the request.
217
290
 
218
291
  ## `ResolvedRetryPolicy`
219
292
 
220
- Provider configuration resolves before route registration into an immutable discriminated union. Normal mode carries `mode: 'normal'`, finite `maxRetries`, `retryableCodes`, and required `initialDelayMs`, `maxDelayMs`, and `jitterRatio`; always mode carries `mode: 'always'` and the same required backoff fields without a finite maximum. `LlmRuntime.providerRetryPolicy(provider)` returns the currently registered value and supplies normal defaults when the adapter omits one; `llmRetryPolicyOf(stream)` returns the value captured from the serving registration after the call selects that registration, so later route disposal or replacement cannot change an in-flight failure's recovery policy. The [generated config catalog](../config-catalog.md) lists the optional input fields.
293
+ Retry configuration resolves before route registration into an immutable discriminated union. Normal mode carries `mode: 'normal'`, finite `maxRetries`, `retryableCodes`, and required `initialDelayMs`, `maxDelayMs`, and `jitterRatio`; always mode carries `mode: 'always'` and the same required backoff fields without a finite maximum. Omitting a provider policy uses the normal default of five retries. Layered settings may retain normal-only `maxRetries` or `retryableCodes` after switching to always mode; the resolver ignores those inactive fields and captures the pure always policy. `LlmRuntime.providerRetryPolicy(provider)` returns the registered value, and `llmRetryPolicyOf(stream)` returns the value captured from the serving registration after the call selects it, so later route disposal or replacement cannot change an in-flight failure's recovery policy. The [generated config catalog](../config-catalog.md) lists the optional input fields.
221
294
 
222
295
  ## `AppIdentity` — app attribution
223
296
 
@@ -243,7 +316,7 @@ interface AppIdentity {
243
316
 
244
317
  ## `TokenUsage`
245
318
 
246
- Per-call token accounting. Counts are **disjoint**: `inputTokens` is uncached input only; cached input is reported separately, and billed input is the sum of the three. Adapters whose providers fold cache hits into a single prompt total (DeepSeek's `prompt_tokens`) subtract them back out. `reasoningTokens`, when present, is informational detail already included in `outputTokens`; totals must not add it again.
319
+ Per-call token accounting. Counts are **disjoint**: `inputTokens` is uncached input only; cached input is reported separately, and billed input is the sum of the three. Adapters whose providers fold cache hits into a single prompt total (DeepSeek's `prompt_tokens`) subtract them back out. Optional `totalTokens` is an exact aggregate prompt-plus-output count preserved from the provider or reconstructed from authoritative aggregate counters; adapters omit it when unavailable or inconsistent. `reasoningTokens`, when present, is informational detail already included in `outputTokens`; totals must not add it again.
247
320
 
248
321
  ```ts type-equiv
249
322
  /**
@@ -257,6 +330,14 @@ Per-call token accounting. Counts are **disjoint**: `inputTokens` is uncached in
257
330
  interface TokenUsage {
258
331
  inputTokens: number
259
332
  outputTokens: number
333
+ /**
334
+ * Exact full-call total including aggregate prompt and output tokens.
335
+ *
336
+ * Adapters preserve a provider total or derive it from authoritative
337
+ * aggregate prompt/output counters; they omit it when unavailable or
338
+ * inconsistent.
339
+ */
340
+ totalTokens?: number
260
341
  cacheReadTokens?: number
261
342
  cacheWriteTokens?: number
262
343
  reasoningTokens?: number
@@ -267,13 +348,16 @@ interface TokenUsage {
267
348
 
268
349
  `BlockAssembler` ([`packages/llm/llm/src/assembler.ts`](../../packages/llm/llm/src/assembler.ts)) is the single shared implementation that folds a `StreamChunk` stream back into `ContentBlock`s, usage, finish reason, and replay state. The loop logs the raw chunks while feeding the same chunks through an assembler, then stores the assembled assistant content with the provider and model that produced it. A consumer that needs the assembled result without re-implementing the fold uses this.
269
350
 
351
+ One keep/drop decision covers content and metadata together: a `max-tokens` finish drops every tool call because a truncated call is unsafe to execute, and the same decision prunes the replay envelope's per-block entry at each dropped position. `blocks()` and `replayState` therefore cannot disagree, whatever assembly removes.
352
+
270
353
  ```ts public-api
271
354
  /**
272
355
  * Incrementally assembles raw {@link StreamChunk}s into complete
273
356
  * {@link ContentBlock}s and a final assistant {@link Message}.
274
357
  *
275
358
  * The agent loop feeds it while logging raw chunks for replay fidelity, then
276
- * reads `blocks()` / `message()` / `usage` / `finish` once the stream ends.
359
+ * reads `blocks()` / `message()` / `usage` / `finish` once the stream ends,
360
+ * or `interruptedBlocks()` when cancellation cut the stream short.
277
361
  *
278
362
  * Tolerant of delta-only protocols (no block-start/end); deltas arriving for
279
363
  * an index already closed by `block-end` are ignored (malformed stream) so a
@@ -292,12 +376,24 @@ declare class BlockAssembler {
292
376
  * its accumulated deltas (an unknown block type never closed by `block-end` throws).
293
377
  */
294
378
  blocks(): ContentBlock[];
379
+ /**
380
+ * Assemble the prefix an interrupted stream can safely finalize: closed and
381
+ * open text/reasoning blocks with non-whitespace content, in stream order.
382
+ * Tool calls are omitted because interruption precedes dispatch; retaining
383
+ * one would require a fabricated result. Open unknown blocks are also omitted.
384
+ * @returns the kept blocks; empty when nothing streamed before the interruption.
385
+ */
386
+ interruptedBlocks(): ContentBlock[];
295
387
  /** Usage from the `usage` chunk; undefined until one arrives. */
296
388
  get usage(): TokenUsage | undefined;
297
389
  /** Finish reason from the `finish` chunk; `{kind: 'stop'}` when the stream ended without one. */
298
390
  get finish(): FinishReason;
299
- /** Adapter-private replay state from the terminal finish chunk, if any. */
300
- get replayState(): unknown;
391
+ /**
392
+ * Replay metadata from the terminal finish chunk, if any, with per-block
393
+ * entries pruned in step with {@link blocks}. Undefined when the envelope's
394
+ * entries do not align with the emitted blocks.
395
+ */
396
+ get replayState(): ReplayEnvelope | undefined;
301
397
  /**
302
398
  * The assembled assistant message.
303
399
  * @param source - producer attribution for the assembled message.
@@ -315,7 +411,7 @@ One model call is a fully-assembled `GenerateOptions`. The adapter answers with
315
411
 
316
412
  Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
317
413
 
318
- Provider and model discovery uses small provider-neutral descriptors. A model catalog is advisory: routing still keys on a registered provider, and an adapter may accept unlisted model ids.
414
+ Provider and model discovery uses small provider-neutral descriptors. A model catalog is advisory: routing still keys on a registered provider.
319
415
 
320
416
  Registering an adapter returns a handle: the disposer, plus the atomic route replacement a plugin whose route set is user-configurable needs.
321
417
 
@@ -563,8 +659,6 @@ interface LlmModelDiscoveryRequest {
563
659
  api?: string
564
660
  /** Credential for this interrogation alone; the harness never stores it. */
565
661
  apiKey?: string
566
- /** Caller cancellation; implementations must settle promptly after it aborts. */
567
- signal?: AbortSignal
568
662
  }
569
663
  ```
570
664
 
@@ -624,6 +718,12 @@ interface LlmCallConfigAdapterDefaults {
624
718
  }
625
719
  ```
626
720
 
721
+ ## Official DeepSeek request extensions
722
+
723
+ `ctx.deepseekLlmApiExtensions` is the provider-specific registry for additive top-level fields on `deepseek-official` requests. Contributor plugins use `register(field, provider)` to claim one field; the adapter calls `prepare(request)` after serializing its base body and merges the returned fields before HTTP. The prepared `accept()` transaction runs after 2xx, so a contributor can commit delivery state without treating a transport or provider rejection as acceptance. Preparation, collision, and acceptance failures use `REQUEST_EXTENSION` and fail the model request.
724
+
725
+ The [wire reference](../deepseek-llm-api-wire-extensions.md) defines the exact request headers, extension transaction, field versions, and receiver obligations. The shipped composition registers [`dsh_session_log`](../../packages/session/session-log-deepseek/README.md) as a lossless incremental canonical-log suffix and [`dsh_plugin_packages`](../../packages/llm/plugin-package-inventory-deepseek/README.md) as the complete active Loader-backed package set. These fields remain outside model messages and are absent from the pi-ai adapter path.
726
+
627
727
  ## Service and provider contracts
628
728
 
629
729
  `LlmAdapter` is the provider contract: subclass, implement `stream()`, and register one adapter instance with `ctx.llm.registerAdapter(providers, adapter)`. `GenerateOptions.provider` selects the registered adapter; `GenerateOptions.model` is passed to that adapter and need not be registered at lifecycle start. Duplicate provider routes fail atomically. Optional `providerRetryPolicy()` is captured per route with normal defaults, while `providerInfo()` and asynchronous `listModels()` feed `LlmRuntime.listProviders()` / `listModels()` with detached selector metadata. That catalog is advisory rather than a request whitelist: the adapter remains authoritative and may accept unlisted model ids. One asynchronous `resolveModel()` query returns exact model identity plus optional correctness-sensitive context capacity, an adapter-configured `defaultMaxTokens`, and ordered model-owned reasoning ids with an optional deployment default; absent fields mean unavailable metadata or provider-owned behavior, not invalid catalog membership. The resolver receives optional cancellation and must settle promptly after abort. `LlmRuntime.resolveModelInfo()` validates and detaches the aggregate. At the final adapter boundary, `resolveCallConfig()` materializes the output default only when `maxTokens` is absent and validates and materializes reasoning, so direct calls cannot bypass either configured behavior; direct dispatch captures one registration before awaiting that resolution. The agent loop instead uses `prepareCall()` to keep the same registration across model resolution, durable header logging, and dispatch, retain detached context metadata from that exact lookup, and report which config fields the adapter defaulted. Adapter lookup happens at the terminal continuation of the `llm/stream` waterfall, so a listener may short-circuit the call or route a mutable one-shot request before lookup. AgentLoop observes a request attempt once the outer waterfall returns a stream handle; that limited boundary does not prove a lazy terminal adapter was constructed or began provider I/O. The `block-start` / `block-end` `index` correlation and the assembler together mean an adapter only has to emit well-formed chunks — block reassembly is not each adapter's problem. [architecture.md](../architecture.md#turn-flow) shows where `ctx.llm.stream()` and the `llm/stream` waterfall sit in one turn.
@@ -637,6 +737,8 @@ interface PreparedLlmCall {
637
737
  readonly retryPolicy: ResolvedRetryPolicy
638
738
  /** Detached context metadata resolved with the registration-bound call. */
639
739
  readonly context?: LlmModelContext
740
+ /** Exact model modalities captured with the adapter dispatch generation. */
741
+ readonly inputModalities?: readonly ModelModality[]
640
742
  /** Config fields materialized by the captured adapter rather than proposed by the caller. */
641
743
  readonly adapterDefaults: LlmCallConfigAdapterDefaults
642
744
  /**
@@ -670,6 +772,16 @@ declare abstract class LlmAdapter {
670
772
  * @returns a resolved policy, or `undefined` to use the normal defaults.
671
773
  */
672
774
  providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined;
775
+ /**
776
+ * Resolve provider-side request-image pricing for one exact model route.
777
+ * The default declares none, so consumers fall back to their own neutral
778
+ * estimate. Implementations must answer synchronously without I/O; the
779
+ * token meter resolves this per measurement.
780
+ * @param _provider - a route passed to `registerAdapter()` for this instance.
781
+ * @param _model - exact model id passed to {@link GenerateOptions.model}.
782
+ * @returns route-owned image pricing, or `undefined` when the route declares none.
783
+ */
784
+ imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;
673
785
  /**
674
786
  * List models this adapter can currently advertise for one owned provider.
675
787
  * The result is advisory: an adapter may accept unlisted model ids, and
@@ -692,6 +804,16 @@ declare abstract class LlmAdapter {
692
804
  model: string,
693
805
  _signal?: AbortSignal,
694
806
  ): Promise<LlmResolvedModelInfo>;
807
+ /**
808
+ * Bind exact model metadata and the eventual request dispatch to one adapter generation.
809
+ * Dynamic adapters override this so settings changes between preparation and
810
+ * dispatch cannot combine one generation's capabilities with another's endpoint.
811
+ * @param provider - registered provider route.
812
+ * @param model - exact model id.
813
+ * @param signal - cancellation for model resolution.
814
+ * @returns model metadata and a one-generation stream entry point.
815
+ */
816
+ async prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
695
817
  /**
696
818
  * Stream one model call as raw chunks. The only required method.
697
819
  * @param options - the fully-assembled request; implementations must honor `options.signal`.
@@ -709,7 +831,34 @@ declare abstract class LlmAdapter {
709
831
 
710
832
  ## Cordis API
711
833
 
712
- Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — this section is byte-identical in both language sides of the page. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
834
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
835
+
836
+ <a id="ctxdeepseekllmapiextensions--deepseekllmapiextensionregistry"></a>
837
+
838
+ ### `ctx.deepseekLlmApiExtensions` — `DeepSeekLlmApiExtensionRegistry`
839
+
840
+ Registry of independently owned top-level fields for official DeepSeek requests.
841
+
842
+ ```ts cordis-catalog
843
+ /**
844
+ * Register the sole provider of one top-level request field. Registration is effect-scoped.
845
+ * @param field - declaration-merged field owned by the provider.
846
+ * @param provider - request-time field preparation and optional acceptance behavior.
847
+ * @returns disposer that releases the field.
848
+ */
849
+ register<K extends keyof DeepSeekLlmApiExtensionMap>( field: K, provider: DeepSeekLlmApiExtensionProvider<DeepSeekLlmApiExtensionMap[K]>, ): () => Promise<void>
850
+
851
+ /**
852
+ * Prepare every currently registered field from one immutable base request.
853
+ * Preparation failures reject before HTTP dispatch. Field values are cloned and frozen;
854
+ * providers retain no mutable alias to the outgoing request.
855
+ * @param request - exact serialized request facts before extension fields.
856
+ * @returns detached fields and their idempotent joint acceptance transaction.
857
+ */
858
+ async prepare(request: DeepSeekLlmApiExtensionRequest): Promise<PreparedDeepSeekLlmApiExtensions>
859
+ ```
860
+
861
+ Source: [`packages/llm/deepseek-llm-api-extensions/src/index.ts`](../../packages/llm/deepseek-llm-api-extensions/src/index.ts)
713
862
 
714
863
  <a id="ctxllm--llmruntime"></a>
715
864
 
@@ -732,7 +881,7 @@ registerAdapter(providers: string[], adapter: LlmAdapter): AdapterRegistrationHa
732
881
  * Describe provider routes with a registered adapter.
733
882
  * @returns detached provider metadata in registration order.
734
883
  */
735
- listProviders(): LlmProviderInfo[]
884
+ @Remote listProviders(): LlmProviderInfo[]
736
885
 
737
886
  /**
738
887
  * Declare provider routes an adapter plugin can activate through
@@ -748,7 +897,7 @@ registerConfigurableProviders(entries: readonly LlmConfigurableProvider[]): Dire
748
897
  * List every declared configurable provider, registered or dormant.
749
898
  * @returns detached directory entries in declaration order.
750
899
  */
751
- listConfigurableProviders(): LlmConfigurableProvider[]
900
+ @Remote listConfigurableProviders(): LlmConfigurableProvider[]
752
901
 
753
902
  /**
754
903
  * Offer to interrogate provider endpoints on behalf of the settings
@@ -757,10 +906,10 @@ listConfigurableProviders(): LlmConfigurableProvider[]
757
906
  * directory, and because a provider being *added* has no route to name yet.
758
907
  * Disposed with the fiber.
759
908
  * @param settingsNs - the namespace whose profiles this discovery serves.
760
- * @param discover - interrogates one endpoint; must honor `request.signal`.
909
+ * @param discover - interrogates one endpoint and must honor the supplied signal.
761
910
  * @returns the disposer that withdraws the offer.
762
911
  */
763
- registerModelDiscovery( settingsNs: string, discover: (request: LlmModelDiscoveryRequest) => Promise<readonly LlmDiscoveredModel[]>, ): () => void
912
+ registerModelDiscovery( settingsNs: string, discover: ( request: LlmModelDiscoveryRequest, signal?: AbortSignal, ) => Promise<readonly LlmDiscoveredModel[]>, ): () => void
764
913
 
765
914
  /**
766
915
  * Interrogate one provider endpoint for the models it advertises. The
@@ -769,9 +918,20 @@ registerModelDiscovery( settingsNs: string, discover: (request: LlmModelDiscover
769
918
  * candidate metadata a surface may offer for adoption.
770
919
  * @param settingsNs - namespace whose registered discovery serves this draft.
771
920
  * @param request - the endpoint, protocol, and one-shot credential to use.
921
+ * @param signal - caller cancellation.
772
922
  * @returns the advertised models, deduplicated in endpoint order.
773
923
  */
774
- async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, ): Promise<LlmDiscoveredModel[]>
924
+ async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, signal?: AbortSignal, ): Promise<LlmDiscoveredModel[]>
925
+
926
+ /**
927
+ * Remote adapter for one draft provider interrogation.
928
+ * @param settingsNs - namespace whose registered discovery serves this draft.
929
+ * @param request - endpoint, protocol, and one-shot credential to use.
930
+ * @param signal - caller cancellation supplied by the Remote carrier.
931
+ * @returns advertised models in endpoint order.
932
+ * @throws RemoteError with `llm/model-discovery-rejected` when discovery refuses or fails.
933
+ */
934
+ @Remote('discoverModels') async remoteDiscoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, signal: AbortSignal, ): Promise<LlmDiscoveredModel[]>
775
935
 
776
936
  /**
777
937
  * Resolve the retry policy captured when one provider route was registered.
@@ -780,6 +940,17 @@ async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, ):
780
940
  */
781
941
  providerRetryPolicy(provider: string): ResolvedRetryPolicy
782
942
 
943
+ /**
944
+ * Resolve provider-side request-image pricing for one exact route, or
945
+ * `undefined` when the provider is unregistered or declares none. Unknown
946
+ * providers degrade to `undefined` rather than throwing because callers
947
+ * price durable history whose route may no longer be mounted.
948
+ * @param provider - provider route named by a request header.
949
+ * @param model - exact model id named by the same header.
950
+ * @returns the owning adapter's image pricing for the route, when declared.
951
+ */
952
+ imageRequestPricing(provider: string, model: string): LlmImageRequestPricing | undefined
953
+
783
954
  /**
784
955
  * Discover models advertised by one registered provider. Catalog membership
785
956
  * is advisory and never changes routing or request validation.
@@ -835,7 +1006,7 @@ async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<Prepared
835
1006
  stream(options: GenerateOptions): AsyncIterable<StreamChunk>
836
1007
  ```
837
1008
 
838
- Source: [`packages/llm/llm/src/index.ts:284`](../../packages/llm/llm/src/index.ts)
1009
+ Source: [`packages/llm/llm/src/index.ts`](../../packages/llm/llm/src/index.ts)
839
1010
 
840
1011
  <a id="llm-events"></a>
841
1012
 
@@ -860,7 +1031,7 @@ The provider topology changed: an adapter registered or unregistered routes, or
860
1031
  'llm/adapters-updated'(): void
861
1032
  ```
862
1033
 
863
- Source: [`packages/llm/llm/src/types.ts:23`](../../packages/llm/llm/src/types.ts)
1034
+ Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
864
1035
 
865
1036
  <a id="llmstream--waterfall"></a>
866
1037
 
@@ -884,5 +1055,5 @@ Waterfall around every streaming model call (retry, replay, routing). Bound to t
884
1055
  'llm/stream'(this: LlmRuntime, options: GenerateOptions, next: () => AsyncIterable<StreamChunk>): AsyncIterable<StreamChunk>
885
1056
  ```
886
1057
 
887
- Source: [`packages/llm/llm/src/index.ts:64`](../../packages/llm/llm/src/index.ts)
1058
+ Source: [`packages/llm/llm/src/index.ts`](../../packages/llm/llm/src/index.ts)
888
1059
  <!-- END GENERATED cordis-surface -->