dsh-plugin-guide 0.2.0 → 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 (373) hide show
  1. package/README.es.md +36 -18
  2. package/README.hi.md +36 -18
  3. package/README.md +38 -18
  4. package/README.pt.md +36 -18
  5. package/README.zh.md +38 -18
  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 +2 -2
  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 +3 -3
  15. package/package.json +13 -4
  16. package/references/cordis-paper-and-community.md +1 -1
  17. package/references/harness-repo.md +1 -1
  18. package/references/official-docs/AGENTS.md +27 -22
  19. package/references/official-docs/README.i18n.yaml +2 -2
  20. package/references/official-docs/README.md +1 -1
  21. package/references/official-docs/README.zh.md +19 -9
  22. package/references/official-docs/SNAPSHOT.md +5 -5
  23. package/references/official-docs/THIRD_PARTY_NOTICES.md +36 -13
  24. package/references/official-docs/docs/AGENTS.md +4 -4
  25. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +2 -2
  26. package/references/official-docs/docs/agent-lifecycle.md +1 -1
  27. package/references/official-docs/docs/agent-lifecycle.zh.md +2 -2
  28. package/references/official-docs/docs/api-gateway.i18n.yaml +2 -2
  29. package/references/official-docs/docs/api-gateway.md +8 -8
  30. package/references/official-docs/docs/api-gateway.zh.md +8 -8
  31. package/references/official-docs/docs/architecture.i18n.yaml +2 -2
  32. package/references/official-docs/docs/architecture.md +23 -7
  33. package/references/official-docs/docs/architecture.zh.md +36 -20
  34. package/references/official-docs/docs/capability-seams.i18n.yaml +2 -2
  35. package/references/official-docs/docs/capability-seams.md +132 -67
  36. package/references/official-docs/docs/capability-seams.zh.md +132 -67
  37. package/references/official-docs/docs/config-catalog.i18n.yaml +2 -2
  38. package/references/official-docs/docs/config-catalog.md +659 -373
  39. package/references/official-docs/docs/config-catalog.zh.md +677 -391
  40. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +2 -2
  41. package/references/official-docs/docs/cookbook/adding-a-package.md +2 -3
  42. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +8 -7
  43. package/references/official-docs/docs/cookbook/{adding-a-conversation-node.i18n.yaml → adding-a-remote-api.i18n.yaml} +3 -3
  44. package/references/official-docs/docs/cookbook/adding-a-remote-api.md +197 -0
  45. package/references/official-docs/docs/cookbook/adding-a-remote-api.zh.md +197 -0
  46. package/references/official-docs/docs/cookbook/adding-a-settings-card.i18n.yaml +6 -0
  47. package/references/official-docs/docs/cookbook/adding-a-settings-card.md +102 -0
  48. package/references/official-docs/docs/cookbook/adding-a-settings-card.zh.md +102 -0
  49. package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +2 -2
  50. package/references/official-docs/docs/cookbook/adding-a-tool.md +11 -4
  51. package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +16 -9
  52. package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +2 -2
  53. package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +2 -2
  54. package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +4 -4
  55. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.i18n.yaml +2 -2
  56. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.md +1 -1
  57. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +3 -3
  58. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +2 -2
  59. package/references/official-docs/docs/cookbook/extension-cookbook.md +9 -8
  60. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +17 -14
  61. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.i18n.yaml +1 -1
  62. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.zh.md +1 -1
  63. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +1 -1
  64. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +1 -1
  65. package/references/official-docs/docs/cordis-api/context.i18n.yaml +1 -1
  66. package/references/official-docs/docs/cordis-api/context.zh.md +1 -1
  67. package/references/official-docs/docs/cordis-api/events.i18n.yaml +1 -1
  68. package/references/official-docs/docs/cordis-api/events.zh.md +1 -1
  69. package/references/official-docs/docs/cordis-api/inherited.md +1 -1
  70. package/references/official-docs/docs/cordis-primer.i18n.yaml +2 -2
  71. package/references/official-docs/docs/cordis-primer.md +2 -1
  72. package/references/official-docs/docs/cordis-primer.zh.md +3 -2
  73. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.i18n.yaml +1 -1
  74. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.zh.md +4 -4
  75. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.i18n.yaml +1 -1
  76. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +4 -4
  77. package/references/official-docs/docs/cordis-tutorial/03-services.i18n.yaml +1 -1
  78. package/references/official-docs/docs/cordis-tutorial/03-services.zh.md +4 -4
  79. package/references/official-docs/docs/cordis-tutorial/04-events.i18n.yaml +1 -1
  80. package/references/official-docs/docs/cordis-tutorial/04-events.zh.md +4 -4
  81. package/references/official-docs/docs/cordis-tutorial/05-config.i18n.yaml +1 -1
  82. package/references/official-docs/docs/cordis-tutorial/05-config.zh.md +2 -2
  83. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +1 -1
  84. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +3 -3
  85. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.i18n.yaml +2 -2
  86. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.md +5 -4
  87. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.zh.md +11 -10
  88. package/references/official-docs/docs/cordis-tutorial/index.i18n.yaml +1 -1
  89. package/references/official-docs/docs/cordis-tutorial/index.zh.md +10 -10
  90. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.i18n.yaml +6 -0
  91. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.md +159 -0
  92. package/references/official-docs/docs/deepseek-llm-api-wire-extensions.zh.md +159 -0
  93. package/references/official-docs/docs/defensive-patterns.i18n.yaml +1 -1
  94. package/references/official-docs/docs/defensive-patterns.zh.md +3 -1
  95. package/references/official-docs/docs/development.i18n.yaml +2 -2
  96. package/references/official-docs/docs/development.md +9 -13
  97. package/references/official-docs/docs/development.zh.md +23 -21
  98. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +2 -2
  99. package/references/official-docs/docs/event-producer-consumer.md +55 -46
  100. package/references/official-docs/docs/event-producer-consumer.zh.md +55 -46
  101. package/references/official-docs/docs/glossary.i18n.yaml +2 -2
  102. package/references/official-docs/docs/glossary.md +1 -1
  103. package/references/official-docs/docs/glossary.zh.md +1 -1
  104. package/references/official-docs/docs/graph-atlas.i18n.yaml +2 -2
  105. package/references/official-docs/docs/graph-atlas.md +0 -2
  106. package/references/official-docs/docs/graph-atlas.zh.md +7 -9
  107. package/references/official-docs/docs/i18n/README.i18n.yaml +2 -2
  108. package/references/official-docs/docs/i18n/README.md +7 -7
  109. package/references/official-docs/docs/i18n/README.zh.md +11 -9
  110. package/references/official-docs/docs/i18n/style-samples.md +3 -3
  111. package/references/official-docs/docs/i18n/translation-prompt.md +3 -3
  112. package/references/official-docs/docs/i18n/translation-rules.i18n.yaml +2 -2
  113. package/references/official-docs/docs/i18n/translation-rules.md +2 -2
  114. package/references/official-docs/docs/i18n/translation-rules.zh.md +3 -3
  115. package/references/official-docs/docs/module-graph.i18n.yaml +2 -2
  116. package/references/official-docs/docs/module-graph.md +666 -747
  117. package/references/official-docs/docs/module-graph.zh.md +668 -749
  118. package/references/official-docs/docs/persistence-catalog.i18n.yaml +2 -2
  119. package/references/official-docs/docs/persistence-catalog.md +160 -39
  120. package/references/official-docs/docs/persistence-catalog.zh.md +169 -48
  121. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.i18n.yaml +2 -2
  122. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.md +2 -2
  123. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.zh.md +3 -3
  124. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.i18n.yaml +2 -2
  125. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +2 -2
  126. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +2 -2
  127. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.i18n.yaml +2 -2
  128. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.md +2 -2
  129. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +2 -2
  130. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.i18n.yaml +2 -2
  131. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +1 -1
  132. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +2 -2
  133. package/references/official-docs/docs/postmortem/README.i18n.yaml +1 -1
  134. package/references/official-docs/docs/postmortem/README.zh.md +5 -5
  135. package/references/official-docs/docs/rescope.i18n.yaml +2 -2
  136. package/references/official-docs/docs/rescope.md +2 -2
  137. package/references/official-docs/docs/rescope.zh.md +3 -3
  138. package/references/official-docs/docs/subsystems/README.i18n.yaml +2 -2
  139. package/references/official-docs/docs/subsystems/README.md +8 -2
  140. package/references/official-docs/docs/subsystems/README.zh.md +53 -47
  141. package/references/official-docs/docs/subsystems/agent-team.i18n.yaml +6 -0
  142. package/references/official-docs/docs/subsystems/agent-team.md +206 -0
  143. package/references/official-docs/docs/subsystems/agent-team.zh.md +206 -0
  144. package/references/official-docs/docs/subsystems/approval.i18n.yaml +2 -2
  145. package/references/official-docs/docs/subsystems/approval.md +12 -12
  146. package/references/official-docs/docs/subsystems/approval.zh.md +13 -13
  147. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +2 -2
  148. package/references/official-docs/docs/subsystems/attachment.md +90 -7
  149. package/references/official-docs/docs/subsystems/attachment.zh.md +90 -7
  150. package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +2 -2
  151. package/references/official-docs/docs/subsystems/client-modules.md +69 -19
  152. package/references/official-docs/docs/subsystems/client-modules.zh.md +69 -19
  153. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +2 -2
  154. package/references/official-docs/docs/subsystems/code-runtime.md +5 -5
  155. package/references/official-docs/docs/subsystems/code-runtime.zh.md +6 -6
  156. package/references/official-docs/docs/subsystems/commands.i18n.yaml +2 -2
  157. package/references/official-docs/docs/subsystems/commands.md +29 -6
  158. package/references/official-docs/docs/subsystems/commands.zh.md +30 -7
  159. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +2 -2
  160. package/references/official-docs/docs/subsystems/compaction.md +5 -5
  161. package/references/official-docs/docs/subsystems/compaction.zh.md +11 -11
  162. package/references/official-docs/docs/subsystems/conversation.i18n.yaml +6 -0
  163. package/references/official-docs/docs/{cookbook/adding-a-conversation-node.md → subsystems/conversation.md} +49 -24
  164. package/references/official-docs/docs/{cookbook/adding-a-conversation-node.zh.md → subsystems/conversation.zh.md} +49 -24
  165. package/references/official-docs/docs/subsystems/core.i18n.yaml +2 -2
  166. package/references/official-docs/docs/subsystems/core.md +110 -33
  167. package/references/official-docs/docs/subsystems/core.zh.md +141 -62
  168. package/references/official-docs/docs/subsystems/credentials.i18n.yaml +2 -2
  169. package/references/official-docs/docs/subsystems/credentials.md +207 -11
  170. package/references/official-docs/docs/subsystems/credentials.zh.md +207 -11
  171. package/references/official-docs/docs/subsystems/extensions.i18n.yaml +2 -2
  172. package/references/official-docs/docs/subsystems/extensions.md +27 -9
  173. package/references/official-docs/docs/subsystems/extensions.zh.md +30 -12
  174. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +2 -2
  175. package/references/official-docs/docs/subsystems/feedback.md +4 -4
  176. package/references/official-docs/docs/subsystems/feedback.zh.md +4 -4
  177. package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +2 -2
  178. package/references/official-docs/docs/subsystems/filesystem.md +17 -7
  179. package/references/official-docs/docs/subsystems/filesystem.zh.md +19 -9
  180. package/references/official-docs/docs/subsystems/goal.i18n.yaml +2 -2
  181. package/references/official-docs/docs/subsystems/goal.md +4 -4
  182. package/references/official-docs/docs/subsystems/goal.zh.md +8 -8
  183. package/references/official-docs/docs/subsystems/invariants.i18n.yaml +2 -2
  184. package/references/official-docs/docs/subsystems/invariants.md +2 -2
  185. package/references/official-docs/docs/subsystems/invariants.zh.md +5 -5
  186. package/references/official-docs/docs/subsystems/jobs.i18n.yaml +2 -2
  187. package/references/official-docs/docs/subsystems/jobs.md +3 -3
  188. package/references/official-docs/docs/subsystems/jobs.zh.md +6 -6
  189. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +2 -2
  190. package/references/official-docs/docs/subsystems/llm-streaming.md +193 -22
  191. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +199 -28
  192. package/references/official-docs/docs/subsystems/lsp.i18n.yaml +2 -2
  193. package/references/official-docs/docs/subsystems/lsp.md +2 -2
  194. package/references/official-docs/docs/subsystems/lsp.zh.md +3 -3
  195. package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +2 -2
  196. package/references/official-docs/docs/subsystems/permission-presets.md +8 -8
  197. package/references/official-docs/docs/subsystems/permission-presets.zh.md +8 -8
  198. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +2 -2
  199. package/references/official-docs/docs/subsystems/persistence.md +35 -17
  200. package/references/official-docs/docs/subsystems/persistence.zh.md +38 -20
  201. package/references/official-docs/docs/subsystems/plan.i18n.yaml +2 -2
  202. package/references/official-docs/docs/subsystems/plan.md +4 -4
  203. package/references/official-docs/docs/subsystems/plan.zh.md +10 -10
  204. package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +2 -2
  205. package/references/official-docs/docs/subsystems/sandbox.md +5 -3
  206. package/references/official-docs/docs/subsystems/sandbox.zh.md +8 -6
  207. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +2 -2
  208. package/references/official-docs/docs/subsystems/schedule.md +9 -3
  209. package/references/official-docs/docs/subsystems/schedule.zh.md +11 -5
  210. package/references/official-docs/docs/subsystems/scope.i18n.yaml +1 -1
  211. package/references/official-docs/docs/subsystems/scope.zh.md +1 -1
  212. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +2 -2
  213. package/references/official-docs/docs/subsystems/session-projection.md +136 -67
  214. package/references/official-docs/docs/subsystems/session-projection.zh.md +136 -67
  215. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +2 -2
  216. package/references/official-docs/docs/subsystems/session-query.md +11 -3
  217. package/references/official-docs/docs/subsystems/session-query.zh.md +12 -4
  218. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +2 -2
  219. package/references/official-docs/docs/subsystems/session-reference.md +94 -7
  220. package/references/official-docs/docs/subsystems/session-reference.zh.md +95 -8
  221. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +2 -2
  222. package/references/official-docs/docs/subsystems/session-telemetry.md +5 -6
  223. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +9 -10
  224. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +2 -2
  225. package/references/official-docs/docs/subsystems/session-title.md +3 -3
  226. package/references/official-docs/docs/subsystems/session-title.zh.md +5 -5
  227. package/references/official-docs/docs/subsystems/session.i18n.yaml +2 -2
  228. package/references/official-docs/docs/subsystems/session.md +273 -39
  229. package/references/official-docs/docs/subsystems/session.zh.md +290 -54
  230. package/references/official-docs/docs/subsystems/settings.i18n.yaml +2 -2
  231. package/references/official-docs/docs/subsystems/settings.md +105 -10
  232. package/references/official-docs/docs/subsystems/settings.zh.md +105 -10
  233. package/references/official-docs/docs/subsystems/shell.i18n.yaml +2 -2
  234. package/references/official-docs/docs/subsystems/shell.md +3 -3
  235. package/references/official-docs/docs/subsystems/shell.zh.md +11 -11
  236. package/references/official-docs/docs/subsystems/skills.i18n.yaml +2 -2
  237. package/references/official-docs/docs/subsystems/skills.md +26 -3
  238. package/references/official-docs/docs/subsystems/skills.zh.md +29 -6
  239. package/references/official-docs/docs/subsystems/slots.i18n.yaml +6 -0
  240. package/references/official-docs/docs/subsystems/slots.md +174 -0
  241. package/references/official-docs/docs/subsystems/slots.zh.md +174 -0
  242. package/references/official-docs/docs/subsystems/spill.i18n.yaml +2 -2
  243. package/references/official-docs/docs/subsystems/spill.md +4 -4
  244. package/references/official-docs/docs/subsystems/spill.zh.md +6 -6
  245. package/references/official-docs/docs/subsystems/storage.i18n.yaml +2 -2
  246. package/references/official-docs/docs/subsystems/storage.md +13 -5
  247. package/references/official-docs/docs/subsystems/storage.zh.md +16 -8
  248. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +2 -2
  249. package/references/official-docs/docs/subsystems/subagent.md +120 -32
  250. package/references/official-docs/docs/subsystems/subagent.zh.md +131 -41
  251. package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +2 -2
  252. package/references/official-docs/docs/subsystems/subprocess.md +3 -3
  253. package/references/official-docs/docs/subsystems/subprocess.zh.md +5 -5
  254. package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +2 -2
  255. package/references/official-docs/docs/subsystems/system-prompt.md +21 -8
  256. package/references/official-docs/docs/subsystems/system-prompt.zh.md +23 -10
  257. package/references/official-docs/docs/subsystems/terminal.i18n.yaml +2 -2
  258. package/references/official-docs/docs/subsystems/terminal.md +2 -2
  259. package/references/official-docs/docs/subsystems/terminal.zh.md +4 -4
  260. package/references/official-docs/docs/subsystems/todo.i18n.yaml +6 -0
  261. package/references/official-docs/docs/subsystems/todo.md +32 -0
  262. package/references/official-docs/docs/subsystems/todo.zh.md +32 -0
  263. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +2 -2
  264. package/references/official-docs/docs/subsystems/token-meter.md +27 -12
  265. package/references/official-docs/docs/subsystems/token-meter.zh.md +28 -13
  266. package/references/official-docs/docs/subsystems/tools.i18n.yaml +2 -2
  267. package/references/official-docs/docs/subsystems/tools.md +46 -46
  268. package/references/official-docs/docs/subsystems/tools.zh.md +54 -54
  269. package/references/official-docs/docs/subsystems/typert.i18n.yaml +2 -2
  270. package/references/official-docs/docs/subsystems/typert.md +65 -58
  271. package/references/official-docs/docs/subsystems/typert.zh.md +67 -60
  272. package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +2 -2
  273. package/references/official-docs/docs/subsystems/user-questions.md +35 -35
  274. package/references/official-docs/docs/subsystems/user-questions.zh.md +35 -35
  275. package/references/official-docs/docs/subsystems/web-client.i18n.yaml +6 -0
  276. package/references/official-docs/docs/subsystems/web-client.md +95 -0
  277. package/references/official-docs/docs/subsystems/web-client.zh.md +95 -0
  278. package/references/official-docs/docs/subsystems/web-server.i18n.yaml +2 -2
  279. package/references/official-docs/docs/subsystems/web-server.md +55 -9
  280. package/references/official-docs/docs/subsystems/web-server.zh.md +56 -10
  281. package/references/official-docs/docs/subsystems/web.i18n.yaml +2 -2
  282. package/references/official-docs/docs/subsystems/web.md +14 -7
  283. package/references/official-docs/docs/subsystems/web.zh.md +16 -9
  284. package/references/official-docs/docs/subsystems/webhook.i18n.yaml +6 -0
  285. package/references/official-docs/docs/subsystems/webhook.md +70 -0
  286. package/references/official-docs/docs/subsystems/webhook.zh.md +70 -0
  287. package/references/official-docs/docs/subsystems/workflow.i18n.yaml +2 -2
  288. package/references/official-docs/docs/subsystems/workflow.md +8 -8
  289. package/references/official-docs/docs/subsystems/workflow.zh.md +13 -13
  290. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +2 -2
  291. package/references/official-docs/docs/subsystems/workspace.md +98 -5
  292. package/references/official-docs/docs/subsystems/workspace.zh.md +102 -9
  293. package/references/official-docs/docs/testing.i18n.yaml +2 -2
  294. package/references/official-docs/docs/testing.md +15 -10
  295. package/references/official-docs/docs/testing.zh.md +15 -10
  296. package/references/official-docs/docs/tool-catalog.i18n.yaml +2 -2
  297. package/references/official-docs/docs/tool-catalog.md +433 -27
  298. package/references/official-docs/docs/tool-catalog.zh.md +438 -29
  299. package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +2 -2
  300. package/references/official-docs/docs/tool-execution-pipeline.md +1 -1
  301. package/references/official-docs/docs/tool-execution-pipeline.zh.md +1 -1
  302. package/references/official-docs/docs/user/develop/basic/config.i18n.yaml +2 -2
  303. package/references/official-docs/docs/user/develop/basic/config.md +1 -1
  304. package/references/official-docs/docs/user/develop/basic/config.zh.md +4 -4
  305. package/references/official-docs/docs/user/develop/basic/index.i18n.yaml +1 -1
  306. package/references/official-docs/docs/user/develop/basic/index.zh.md +5 -5
  307. package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +2 -2
  308. package/references/official-docs/docs/user/develop/basic/publish.md +3 -3
  309. package/references/official-docs/docs/user/develop/basic/publish.zh.md +7 -7
  310. package/references/official-docs/docs/user/develop/basic/tool.i18n.yaml +2 -2
  311. package/references/official-docs/docs/user/develop/basic/tool.md +3 -3
  312. package/references/official-docs/docs/user/develop/basic/tool.zh.md +4 -4
  313. package/references/official-docs/docs/user/develop/framework/events.i18n.yaml +2 -2
  314. package/references/official-docs/docs/user/develop/framework/events.md +2 -2
  315. package/references/official-docs/docs/user/develop/framework/events.zh.md +3 -3
  316. package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +1 -1
  317. package/references/official-docs/docs/user/develop/framework/index.zh.md +3 -3
  318. package/references/official-docs/docs/user/develop/framework/service.i18n.yaml +2 -2
  319. package/references/official-docs/docs/user/develop/framework/service.md +1 -1
  320. package/references/official-docs/docs/user/develop/framework/service.zh.md +3 -3
  321. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.i18n.yaml +6 -0
  322. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.md +15 -0
  323. package/references/official-docs/docs/user/develop/practice/dynamic-cordis.zh.md +15 -0
  324. package/references/official-docs/docs/user/develop/practice/index.i18n.yaml +2 -2
  325. package/references/official-docs/docs/user/develop/practice/index.md +1 -1
  326. package/references/official-docs/docs/user/develop/practice/index.zh.md +3 -3
  327. package/references/official-docs/docs/user/develop/practice/llm-adapter.i18n.yaml +2 -2
  328. package/references/official-docs/docs/user/develop/practice/llm-adapter.md +4 -3
  329. package/references/official-docs/docs/user/develop/practice/llm-adapter.zh.md +4 -3
  330. package/references/official-docs/docs/user/guide/github-review.i18n.yaml +6 -0
  331. package/references/official-docs/docs/user/guide/github-review.md +102 -0
  332. package/references/official-docs/docs/user/guide/github-review.zh.md +102 -0
  333. package/references/official-docs/docs/user/guide/index.i18n.yaml +2 -2
  334. package/references/official-docs/docs/user/guide/index.md +2 -2
  335. package/references/official-docs/docs/user/guide/index.zh.md +8 -8
  336. package/references/official-docs/docs/user/guide/mcp-memory.i18n.yaml +6 -0
  337. package/references/official-docs/docs/user/guide/mcp-memory.md +101 -0
  338. package/references/official-docs/docs/user/guide/mcp-memory.zh.md +101 -0
  339. package/references/official-docs/docs/user/guide/providers.i18n.yaml +2 -2
  340. package/references/official-docs/docs/user/guide/providers.md +40 -1
  341. package/references/official-docs/docs/user/guide/providers.zh.md +41 -2
  342. package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +2 -2
  343. package/references/official-docs/docs/user/guide/python-sdk.md +80 -34
  344. package/references/official-docs/docs/user/guide/python-sdk.zh.md +87 -41
  345. package/references/official-docs/docs/user/guide/schedule.i18n.yaml +6 -0
  346. package/references/official-docs/docs/user/guide/schedule.md +21 -0
  347. package/references/official-docs/docs/user/guide/schedule.zh.md +21 -0
  348. package/references/official-docs/docs/web-styling.i18n.yaml +1 -1
  349. package/references/official-docs/docs/web-styling.zh.md +2 -2
  350. package/references/official-docs/packages/AGENTS.md +3 -2
  351. package/references/official-docs/packages/README.md +104 -59
  352. package/references/official-docs/vendor/README.md +1 -0
  353. package/references/official-docs/website-docs.ts +52 -11
  354. package/references/sources.md +2 -2
  355. package/references/website-pages.md +3 -3
  356. package/scripts/check-docs-drift.ps1 +55 -0
  357. package/scripts/check-readme-sync.mjs +91 -0
  358. package/scripts/download-sources.ps1 +1 -1
  359. package/scripts/sync-official-docs.ps1 +19 -11
  360. package/scripts/verify-kit.ps1 +0 -4
  361. package/templates/js/README.es.md +1 -1
  362. package/templates/js/README.hi.md +1 -1
  363. package/templates/js/README.md +1 -1
  364. package/templates/js/README.pt.md +1 -1
  365. package/templates/js/README.zh.md +1 -1
  366. package/templates/js/package.json +4 -4
  367. package/templates/ts/README.es.md +1 -1
  368. package/templates/ts/README.hi.md +1 -1
  369. package/templates/ts/README.md +1 -1
  370. package/templates/ts/README.pt.md +1 -1
  371. package/templates/ts/README.zh.md +1 -1
  372. package/templates/ts/package.json +4 -4
  373. package/references/official-docs/examples/AGENTS.md +0 -20
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](llm-streaming.md) | 中文
4
4
 
5
- [`packages/llm`](../../packages/llm/README.md) 提供对话与流式输出类型:每个请求和持久历史共用的 `Message`/`ContentBlock` 变体、完整组装的模型请求、原始 `StreamChunk` 协议、每个适配器必须实现的适配器约定(adapter contract),以及共享的 assembler。[核心包](core.md)在每个轮次持有并记录这些值;本页声明它们。
5
+ [`packages/llm`](../../packages/llm/README.zh.md) 提供对话与流式输出类型:每个请求和持久历史共用的 `Message`/`ContentBlock` 变体、完整组装的模型请求、原始 `StreamChunk` 协议、每个适配器必须实现的适配器约定(adapter contract),以及共享的 assembler。[核心包](core.zh.md)在每个轮次持有并记录这些值;本页声明它们。
6
6
 
7
7
  源码:[`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
8
8
 
@@ -28,7 +28,19 @@ interface ContentBlockMap {
28
28
  }
29
29
  ```
30
30
 
31
- 各块接口(完整字段见源码):`TextBlock`(`text`)、`ReasoningBlock`(thinking,区别于可见文本)、`ImageBlock`(一个持久的[图片附件](attachment.md))、`ToolCallBlock`(`id: CallId`、`name`、原始 JSON `arguments`),以及 `ToolResultBlock`(`toolCallId`、嵌套 `content: ContentBlock[]`、`isError?`)。`ContentBlock = ContentBlockMap[ContentBlockType]`。仅当适配器、UI、压缩(compaction)和持久回放路径均支持某种新模态时,才将其纳入可合并扩展的 map。
31
+ 各块接口(完整字段见源码):`TextBlock`(`text`)、`ReasoningBlock`(thinking,区别于可见文本)、`ImageBlock`(一个持久的[图片附件](attachment.zh.md))、`ToolCallBlock`(`id: ToolCallId`、`name`、原始 JSON `arguments`),以及 `ToolResultBlock`(`toolCallId`、嵌套 `content: ContentBlock[]`、`isError?`)。`ContentBlock = ContentBlockMap[ContentBlockType]`。仅当适配器、UI、压缩(compaction)和持久回放路径均支持某种新模态时,才将其纳入可合并扩展的 map。
32
+
33
+ 图片访问方式属于请求序列化,不属于持久附件或确定性请求图片版本。`resolveImageAttachmentAccess()` 把附件提供方可选的宿主对象路径,与消费方为当前工具执行文件系统提供的映射组合起来。结果只适用于本次请求,不参与 `variantId`。
34
+
35
+ 源码:[`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
  源码:[`packages/llm/llm/src/message.ts`](../../packages/llm/llm/src/message.ts)
34
46
 
@@ -157,6 +169,29 @@ type ContextFormed =
157
169
 
158
170
  一个流式响应交错包含多种类型的块(文本、推理(reasoning)、多个工具调用)。`index` 将每个 delta 关联到其所属块;`block-end` 携带完整组装好的 `ContentBlock`,消费方无需自行重新组装 delta。这是一个**封闭的**可辨识联合类型:对 `type` 的 `switch` 以 `assertNever` 结尾,因此新增变体会在每个必须处理它的消费方处触发编译错误。
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
 
@@ -203,6 +238,44 @@ interface LlmFailure {
203
238
  }
204
239
  ```
205
240
 
241
+ ## 请求图片定价
242
+
243
+ 提供方对请求图片收取视觉 token 的适配器通过覆写 `LlmAdapter.imageRequestPricing` 声明按路由的定价,消费方经 `ctx.llm.imageRequestPricing(provider, model)` 同步解析。token 计量服务在每次计量时解析路由模型的定价,使 compaction 的压力、保留与选段都按路由请求实际发送的形式为图片历史计价;DeepSeek 适配器复现自身的请求投影(按模型的像素预算、最旧优先 offload),并用官方公布的 v4 视觉计量为保留图片定价,已完成请求仍以 provider usage 为权威锚点。
244
+
245
+ ```ts type-equiv
246
+ /**
247
+ * Request price of one ordered image occurrence under one exact model route's
248
+ * request projection. Every occurrence resolves to the pair the wire actually
249
+ * carries: provider visual tokens for a retained image, plus the model-visible
250
+ * text sent with or instead of it (request-preview handle, offload placeholder,
251
+ * or text-only substitution). The caller prices `text` with its own text
252
+ * estimator so provider pricing never fixes a text tokenization.
253
+ */
254
+ interface LlmImageRequestPrice {
255
+ /** Provider visual tokens for the retained request image; 0 when only text represents this occurrence. */
256
+ visualTokens: number
257
+ /** Model-visible text sent for this occurrence, to be priced by the caller's text estimator. */
258
+ text: string
259
+ }
260
+ ```
261
+
262
+ ```ts type-equiv
263
+ /**
264
+ * Provider-side request-image pricing for one exact model route. Implemented
265
+ * by adapters whose provider charges visual tokens; consumers (the token
266
+ * meter) resolve it synchronously per measurement, so implementations must not
267
+ * perform I/O.
268
+ */
269
+ interface LlmImageRequestPricing {
270
+ /**
271
+ * Price every image occurrence of one request projection.
272
+ * @param images - durable image references in request order, one entry per occurrence.
273
+ * @returns one price per occurrence, aligned by index with `images`.
274
+ */
275
+ priceImages(images: readonly ImageAttachmentRef[]): readonly LlmImageRequestPrice[]
276
+ }
277
+ ```
278
+
206
279
  ## 适配器约定
207
280
 
208
281
  每个适配器必须遵守以下规则,每个消费方可以依赖它们:
@@ -213,17 +286,17 @@ interface LlmFailure {
213
286
  - **一次适配器调用就是一次提供方尝试。** 适配器禁用库重试。agent 层恢复会打开另一个持久、带编号的轮次;直接调用 `ctx.llm.stream()` 的调用方仍然只尝试一次。
214
287
  - **提供方停顿在传输层受到时限约束。** 两个已交付的远程适配器都暴露正数且有限的 `streamIdleTimeoutMs`,默认五分钟。watchdog 只在 iterator `next()` 尚未完成时启动,整个请求使用同一个稳定 signal,把自身到期映射为 `TIMEOUT`,并把更早发生的调用方中止保留为 `ABORTED`。
215
288
  - **上下文溢出只有一个规范 code。** 两个 DeepSeek 适配器都通过 `isContextWindowExceededError()` 对提供方的显式细节分类并暴露 `CONTEXT_WINDOW_EXCEEDED`,无论失败以抛出的 HTTP `LlmError` 还是带内 finish error 到达。消费方按 code 路由,绝不依赖提供方文本。
216
- - **空 completion 是可重试错误,而不是静默的成功结果。** 两个适配器都把没有携带任何内容块的终止性 `stop` 结束映射为携带规范 `EMPTY_RESPONSE` code 的 `finish {kind:'error'}`,`dsh-llm-retry` 默认会重试它;详见[空模型响应可重试](../../.agents/notes/implemented/bug-fix/2026-07-24-empty-model-response-is-retryable.md)。
289
+ - **空 completion 是可重试错误,而不是静默的成功结果。** 两个适配器都把没有携带任何内容块的终止性 `stop` 结束映射为携带规范 `EMPTY_RESPONSE` code 的 `finish {kind:'error'}`,`dsh-llm-retry` 默认会重试它;详见[空模型响应可重试](../../.agents/notes/implemented/bug-fix/2026-07-24-empty-model-response-is-retryable.zh.md)。
217
290
  - **每个提供方 HTTP 请求都携带应用归属头。** 适配器发送 `attributionHeaders()`(见下文)作为 `User-Agent` 基线,并通过协议级测试加以证明。
218
- - **回放状态归适配器所有。** 成功的 `finish` 可以携带重建提供方原生响应所需的无损 JSON 状态。循环会将其与组装后的 assistant 消息一起存储。后续请求中,仅当历史提供方与目标提供方当前注册到完全相同的适配器实例时,`LlmRuntime` 才会传递该状态。该适配器负责校验状态并拥有所有跨模型或跨提供方转换;其他适配器只会收到提供方无关的内容以及提供方/模型字段,不会收到私有状态。
291
+ - **回放状态归适配器所有;其切分是共享词汇。** 成功的 `finish` 可以携带一个 `ReplayEnvelope`:不透明的响应级元数据,加上与发射块序列对齐的可选逐块条目。对齐关系是 harness 的词汇——组装丢弃某个块时,同一位置的条目一并丢弃,因此存储的元数据始终描述存储的内容。循环把裁剪后的数据与组装后的 assistant 消息一起存储。后续请求中,仅当历史提供方与目标提供方当前注册到完全相同的适配器实例时,`LlmRuntime` 才会传递该状态。该适配器负责校验状态并拥有所有跨模型或跨提供方转换;其他适配器只会收到提供方无关的内容以及提供方/模型字段,不会收到私有状态。持久化内容保持权威:读取适配器无法使用的已存状态只会把这一条消息降级为提供方无关转换并带出诊断,而不是让请求失败。
219
292
 
220
293
  ## `ResolvedRetryPolicy`
221
294
 
222
- 提供方配置会在路由注册前解析为不可变的可辨识联合。normal mode 携带 `mode: 'normal'`、有限的 `maxRetries`、`retryableCodes`,以及必填的 `initialDelayMs`、`maxDelayMs` 与 `jitterRatio`;always mode 携带 `mode: 'always'` 和相同的必填退避字段,但没有有限上限。`LlmRuntime.providerRetryPolicy(provider)` 返回当前注册的值,并在适配器省略策略时提供 normal 默认值;调用选定该注册后,`llmRetryPolicyOf(stream)` 返回为该调用服务的注册所捕获的值,因此之后释放或替换路由都无法改变进行中失败的恢复策略。可选配置输入字段由[生成的配置目录](../config-catalog.md)列出。
295
+ 重试配置会在路由注册前解析为不可变的可辨识联合。normal mode 携带 `mode: 'normal'`、有限的 `maxRetries`、`retryableCodes`,以及必填的 `initialDelayMs`、`maxDelayMs` 与 `jitterRatio`;always mode 携带 `mode: 'always'` 和相同的必填退避字段,但没有有限上限。省略提供方策略时使用重试五次的 normal 默认值。分层 settings 在切换到 always 模式后可能保留仅属于 normal 的 `maxRetries` 或 `retryableCodes`;解析器会忽略这些未启用字段,并捕获纯 always 策略。`LlmRuntime.providerRetryPolicy(provider)` 返回注册值;调用选定实际提供服务的注册后,`llmRetryPolicyOf(stream)` 返回从中捕获的值,因此之后释放或替换路由都无法改变进行中失败的恢复策略。可选配置输入字段由[生成的配置目录](../config-catalog.zh.md)列出。
223
296
 
224
297
  ## `AppIdentity`:应用归属
225
298
 
226
- 每个适配器都会向提供方发送的静态公开应用标识([`packages/llm/llm/src/attribution.ts`](../../packages/llm/llm/src/attribution.ts))。`attributionHeaders(identity?)` 只把它映射到标准 `User-Agent` header;该约定有意不支持 OpenRouter 特有的应用归属 header。默认 `APP_IDENTITY` 从包 manifest(元数据清单)获取版本;每个字段都是公开产品事实——不含 secret、路径、会话 id 或逐用户标识,且任何逐请求信息都不得影响这些值。设计理由见[强制 `User-Agent` 归属](../../.agents/notes/implemented/architecture/2026-06-21-mandatory-app-attribution-headers.md)。
299
+ 每个适配器都会向提供方发送的静态公开应用标识([`packages/llm/llm/src/attribution.ts`](../../packages/llm/llm/src/attribution.ts))。`attributionHeaders(identity?)` 只把它映射到标准 `User-Agent` header;该约定有意不支持 OpenRouter 特有的应用归属 header。默认 `APP_IDENTITY` 从包 manifest(元数据清单)获取版本;每个字段都是公开产品事实——不含 secret、路径、会话 id 或逐用户标识,且任何逐请求信息都不得影响这些值。设计理由见[强制 `User-Agent` 归属](../../.agents/notes/implemented/architecture/2026-06-21-mandatory-app-attribution-headers.zh.md)。
227
300
 
228
301
  ```ts type-equiv
229
302
  /**
@@ -247,7 +320,7 @@ interface AppIdentity {
247
320
 
248
321
  ## `TokenUsage`
249
322
 
250
- 逐调用 token 记账。各计数**互不重叠**:`inputTokens` 只包含未缓存输入;缓存输入单独报告,计费输入是三者之和。若提供方把缓存命中折入单一提示词总数(如 DeepSeek 的 `prompt_tokens`),适配器会再将其扣除。`reasoningTokens` 存在时只是信息性细节,已经包含在 `outputTokens` 中;汇总时不得重复相加。
323
+ 逐调用 token 记账。各计数**互不重叠**:`inputTokens` 只包含未缓存输入;缓存输入单独报告,计费输入是三者之和。若提供方把缓存命中折入单一提示词总数(如 DeepSeek 的 `prompt_tokens`),适配器会再将其扣除。可选的 `totalTokens` 是精确的提示词与输出聚合计数,由适配器保留提供方原值或从权威聚合计数重建;不可用或不一致时省略。`reasoningTokens` 存在时只是信息性细节,已经包含在 `outputTokens` 中;汇总时不得重复相加。
251
324
 
252
325
  ```ts type-equiv
253
326
  /**
@@ -261,6 +334,14 @@ interface AppIdentity {
261
334
  interface TokenUsage {
262
335
  inputTokens: number
263
336
  outputTokens: number
337
+ /**
338
+ * Exact full-call total including aggregate prompt and output tokens.
339
+ *
340
+ * Adapters preserve a provider total or derive it from authoritative
341
+ * aggregate prompt/output counters; they omit it when unavailable or
342
+ * inconsistent.
343
+ */
344
+ totalTokens?: number
264
345
  cacheReadTokens?: number
265
346
  cacheWriteTokens?: number
266
347
  reasoningTokens?: number
@@ -273,13 +354,16 @@ interface TokenUsage {
273
354
 
274
355
  `BlockAssembler`([`packages/llm/llm/src/assembler.ts`](../../packages/llm/llm/src/assembler.ts))是唯一的共享实现,负责把 `StreamChunk` 流折叠回 `ContentBlock`、usage、结束原因与回放状态。循环在记录原始分片的同时,把同一批分片送入 assembler,再将组装后的 assistant 内容连同生成它的提供方和模型一起存储。需要组装结果、又不想重新实现 fold 的消费方使用它。
275
356
 
357
+ 内容与元数据共用同一次保留/丢弃决定:`max-tokens` 结束会丢弃每个工具调用,因为被截断的调用不能安全执行,而同一决定会在每个被丢弃的位置裁剪回放数据的逐块条目。无论组装移除什么,`blocks()` 与 `replayState` 都不可能不一致。
358
+
276
359
  ```ts public-api
277
360
  /**
278
361
  * Incrementally assembles raw {@link StreamChunk}s into complete
279
362
  * {@link ContentBlock}s and a final assistant {@link Message}.
280
363
  *
281
364
  * The agent loop feeds it while logging raw chunks for replay fidelity, then
282
- * reads `blocks()` / `message()` / `usage` / `finish` once the stream ends.
365
+ * reads `blocks()` / `message()` / `usage` / `finish` once the stream ends,
366
+ * or `interruptedBlocks()` when cancellation cut the stream short.
283
367
  *
284
368
  * Tolerant of delta-only protocols (no block-start/end); deltas arriving for
285
369
  * an index already closed by `block-end` are ignored (malformed stream) so a
@@ -298,12 +382,24 @@ declare class BlockAssembler {
298
382
  * its accumulated deltas (an unknown block type never closed by `block-end` throws).
299
383
  */
300
384
  blocks(): ContentBlock[];
385
+ /**
386
+ * Assemble the prefix an interrupted stream can safely finalize: closed and
387
+ * open text/reasoning blocks with non-whitespace content, in stream order.
388
+ * Tool calls are omitted because interruption precedes dispatch; retaining
389
+ * one would require a fabricated result. Open unknown blocks are also omitted.
390
+ * @returns the kept blocks; empty when nothing streamed before the interruption.
391
+ */
392
+ interruptedBlocks(): ContentBlock[];
301
393
  /** Usage from the `usage` chunk; undefined until one arrives. */
302
394
  get usage(): TokenUsage | undefined;
303
395
  /** Finish reason from the `finish` chunk; `{kind: 'stop'}` when the stream ended without one. */
304
396
  get finish(): FinishReason;
305
- /** Adapter-private replay state from the terminal finish chunk, if any. */
306
- get replayState(): unknown;
397
+ /**
398
+ * Replay metadata from the terminal finish chunk, if any, with per-block
399
+ * entries pruned in step with {@link blocks}. Undefined when the envelope's
400
+ * entries do not align with the emitted blocks.
401
+ */
402
+ get replayState(): ReplayEnvelope | undefined;
307
403
  /**
308
404
  * The assembled assistant message.
309
405
  * @param source - producer attribution for the assembled message.
@@ -321,7 +417,7 @@ declare class BlockAssembler {
321
417
 
322
418
  源码:[`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
323
419
 
324
- 提供方与模型发现使用小型、提供方无关的描述符。模型目录仅供参考:路由仍以已注册提供方为键,适配器也可以接受未列出的模型 id。
420
+ 提供方与模型发现使用小型、提供方无关的描述符。模型目录仅供参考:路由仍以已注册提供方为键。
325
421
 
326
422
  注册适配器会返回一个句柄:既是释放器,也带有原子的路由替换——路由集合由用户配置决定的插件正需要它。
327
423
 
@@ -541,7 +637,7 @@ interface ToolSchema {
541
637
  }
542
638
  ```
543
639
 
544
- 面向模型的 `ToolSchema` 是协议类型;产出它的已注册 `ToolDefinition`(schema + `execute`)在 [tools.md](tools.md) 中。
640
+ 面向模型的 `ToolSchema` 是协议类型;产出它的已注册 `ToolDefinition`(schema + `execute`)在 [tools.md](tools.zh.md) 中。
545
641
 
546
642
  界面正在起草的提供方既没有路由也没有 catalog,因此询问被单独描述:请求携带用户正在编辑的草稿,回复是界面可以采纳的候选,而不是它必须服务的 catalog。
547
643
 
@@ -569,8 +665,6 @@ interface LlmModelDiscoveryRequest {
569
665
  api?: string
570
666
  /** Credential for this interrogation alone; the harness never stores it. */
571
667
  apiKey?: string
572
- /** Caller cancellation; implementations must settle promptly after it aborts. */
573
- signal?: AbortSignal
574
668
  }
575
669
  ```
576
670
 
@@ -594,7 +688,7 @@ interface LlmDiscoveredModel {
594
688
 
595
689
  ### 请求信封:`LlmCallConfig` 与记录的 header
596
690
 
597
- 循环从已记录状态构建每个请求。`EpochHeader` 记录调用配置,标记由适配器默认值提供的字段,并通过完整的 `request/header` 快照记录渲染后的提示词以及权威返回工具顺序(由 `toolOrder` 配置;未配置时按字典序)。结合派生历史,请求便可由会话日志重建。见 [session.md](session.md#the-request-header-event-requestheader) 与[可重建性 Agent Note](../../.agents/notes/implemented/architecture/2026-07-05-reconstructable-requests.md)。
691
+ 循环从已记录状态构建每个请求。`EpochHeader` 记录调用配置,标记由适配器默认值提供的字段,并通过完整的 `request/header` 快照记录渲染后的提示词以及权威返回工具顺序(由 `toolOrder` 配置;未配置时按字典序)。结合派生历史,请求便可由会话日志重建。见 [session.md](session.zh.md#the-request-header-event-requestheader) 与[可重建性 Agent Note](../../.agents/notes/implemented/architecture/2026-07-05-reconstructable-requests.zh.md)。
598
692
 
599
693
  `agent/request` 接收冻结的调用配置种子,并可返回替代值以切换提供方、模型、推理强度或采样参数。waterfall(瀑布式事件)开始前,循环会移除标记为适配器默认值的值,使确切模型准备过程填入所选路由的当前值;未带标记的显式设置仍保留在提议中。waterfall 结束后,准备过程会在轮次信号控制下拒绝显式指定但不受支持的推理强度 ID(不自动调整),并记录生效配置以及由适配器默认值提供的字段。准备完成的调用直至分派完成始终持有同一项适配器注册。到达 `llm/stream` 的请求会被深度冻结,因此变更会抛异常;请求还携带进程本地循环标识,使观察者不会把单独记录的冻结辅助调用误认成对话请求。
600
694
 
@@ -630,9 +724,15 @@ interface LlmCallConfigAdapterDefaults {
630
724
  }
631
725
  ```
632
726
 
727
+ ## DeepSeek 官方请求扩展
728
+
729
+ `ctx.deepseekLlmApiExtensions` 是用于向 `deepseek-official` 请求添加顶层字段的提供方特定注册表。贡献插件通过 `register(field, provider)` 认领一个字段;适配器在序列化基础正文后调用 `prepare(request)`,并在 HTTP 前合并返回字段。已准备的 `accept()` 事务会在 2xx 后运行,因此贡献方可以提交交付状态,而不会把传输失败或提供方拒绝当作接受。准备、冲突与接受失败会使用 `REQUEST_EXTENSION`,并使模型请求失败。
730
+
731
+ [协议参考](../deepseek-llm-api-wire-extensions.zh.md)定义确切的请求标头、扩展事务、字段版本和接收方义务。随附组合会将 [`dsh_session_log`](../../packages/session/session-log-deepseek/README.zh.md) 注册为无损增量权威日志后缀,并将 [`dsh_plugin_packages`](../../packages/llm/plugin-package-inventory-deepseek/README.zh.md) 注册为完整存活 Loader 包集合。这些字段仍位于模型消息之外,也不会进入 pi-ai 适配器路径。
732
+
633
733
  ## 服务与提供方约定
634
734
 
635
- `LlmAdapter` 是提供方约定:创建子类、实现 `stream()`,再用 `ctx.llm.registerAdapter(providers, adapter)` 注册一个适配器实例。`GenerateOptions.provider` 选择已注册适配器;`GenerateOptions.model` 会传给该适配器,无需在生命周期启动时注册。重复提供方路由会原子失败。可选的 `providerRetryPolicy()` 会按路由捕获并填入 normal 默认值,`providerInfo()` 与异步 `listModels()` 方法则为 `LlmRuntime.listProviders()` / `listModels()` 提供分离的 selector 元数据。该目录仅供参考,不是请求白名单:适配器仍是权威,并可接受未列出的模型 id。单次异步 `resolveModel()` 查询返回确切模型身份,以及可选的对正确性敏感的上下文容量、适配器配置的 `defaultMaxTokens`、由模型持有的有序推理强度 ID 和可选的部署默认值;字段缺失表示元数据不可用或保留提供方持有的行为,而不表示目录成员关系无效。解析器会接收可选的取消信号,并且必须在信号中止后迅速完成结算。`LlmRuntime.resolveModelInfo()` 会校验聚合结果并返回分离值。在最终适配器边界,`resolveCallConfig()` 仅在 `maxTokens` 缺失时填入输出默认值,并校验和填入推理强度,因此直接调用也无法绕过任何一项已配置行为;直接分派会在等待解析前捕获一项适配器注册。agent loop 则使用 `prepareCall()`,使模型解析、请求头持久记录和分派全程使用同一项注册,保留来自同一次查询的分离上下文元数据,并报告适配器填入的配置字段。适配器查找发生在 `llm/stream` waterfall 的终端 continuation,因此 listener 可以在查找前短路调用,或路由一个可变的一次性请求。AgentLoop 在外层 waterfall 返回流句柄时观察到一次请求尝试;这个有限边界不能证明惰性终端适配器已构造完成或开始提供方 I/O。`block-start` / `block-end` 的 `index` 关联与 assembler 共同意味着适配器只需 emit 格式正确的分片——块重组不是每个适配器各自的问题。`ctx.llm.stream()` 与 `llm/stream` waterfall 在一个轮次中的位置见 [architecture.md](../architecture.md#turn-flow)。
735
+ `LlmAdapter` 是提供方约定:创建子类、实现 `stream()`,再用 `ctx.llm.registerAdapter(providers, adapter)` 注册一个适配器实例。`GenerateOptions.provider` 选择已注册适配器;`GenerateOptions.model` 会传给该适配器,无需在生命周期启动时注册。重复提供方路由会原子失败。可选的 `providerRetryPolicy()` 会按路由捕获并填入 normal 默认值,`providerInfo()` 与异步 `listModels()` 方法则为 `LlmRuntime.listProviders()` / `listModels()` 提供分离的 selector 元数据。该目录仅供参考,不是请求白名单:适配器仍是权威,并可接受未列出的模型 id。单次异步 `resolveModel()` 查询返回确切模型身份,以及可选的对正确性敏感的上下文容量、适配器配置的 `defaultMaxTokens`、由模型持有的有序推理强度 ID 和可选的部署默认值;字段缺失表示元数据不可用或保留提供方持有的行为,而不表示目录成员关系无效。解析器会接收可选的取消信号,并且必须在信号中止后迅速完成结算。`LlmRuntime.resolveModelInfo()` 会校验聚合结果并返回分离值。在最终适配器边界,`resolveCallConfig()` 仅在 `maxTokens` 缺失时填入输出默认值,并校验和填入推理强度,因此直接调用也无法绕过任何一项已配置行为;直接分派会在等待解析前捕获一项适配器注册。agent loop 则使用 `prepareCall()`,使模型解析、请求头持久记录和分派全程使用同一项注册,保留来自同一次查询的分离上下文元数据,并报告适配器填入的配置字段。适配器查找发生在 `llm/stream` waterfall 的终端 continuation,因此 listener 可以在查找前短路调用,或路由一个可变的一次性请求。AgentLoop 在外层 waterfall 返回流句柄时观察到一次请求尝试;这个有限边界不能证明惰性终端适配器已构造完成或开始提供方 I/O。`block-start` / `block-end` 的 `index` 关联与 assembler 共同意味着适配器只需 emit 格式正确的分片——块重组不是每个适配器各自的问题。`ctx.llm.stream()` 与 `llm/stream` waterfall 在一个轮次中的位置见 [architecture.md](../architecture.zh.md#turn-flow)。
636
736
 
637
737
  ```ts type-equiv
638
738
  /** One model call whose config and adapter registration were resolved together. */
@@ -643,6 +743,8 @@ interface PreparedLlmCall {
643
743
  readonly retryPolicy: ResolvedRetryPolicy
644
744
  /** Detached context metadata resolved with the registration-bound call. */
645
745
  readonly context?: LlmModelContext
746
+ /** Exact model modalities captured with the adapter dispatch generation. */
747
+ readonly inputModalities?: readonly ModelModality[]
646
748
  /** Config fields materialized by the captured adapter rather than proposed by the caller. */
647
749
  readonly adapterDefaults: LlmCallConfigAdapterDefaults
648
750
  /**
@@ -676,6 +778,16 @@ declare abstract class LlmAdapter {
676
778
  * @returns a resolved policy, or `undefined` to use the normal defaults.
677
779
  */
678
780
  providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined;
781
+ /**
782
+ * Resolve provider-side request-image pricing for one exact model route.
783
+ * The default declares none, so consumers fall back to their own neutral
784
+ * estimate. Implementations must answer synchronously without I/O; the
785
+ * token meter resolves this per measurement.
786
+ * @param _provider - a route passed to `registerAdapter()` for this instance.
787
+ * @param _model - exact model id passed to {@link GenerateOptions.model}.
788
+ * @returns route-owned image pricing, or `undefined` when the route declares none.
789
+ */
790
+ imageRequestPricing(_provider: string, _model: string): LlmImageRequestPricing | undefined;
679
791
  /**
680
792
  * List models this adapter can currently advertise for one owned provider.
681
793
  * The result is advisory: an adapter may accept unlisted model ids, and
@@ -698,6 +810,16 @@ declare abstract class LlmAdapter {
698
810
  model: string,
699
811
  _signal?: AbortSignal,
700
812
  ): Promise<LlmResolvedModelInfo>;
813
+ /**
814
+ * Bind exact model metadata and the eventual request dispatch to one adapter generation.
815
+ * Dynamic adapters override this so settings changes between preparation and
816
+ * dispatch cannot combine one generation's capabilities with another's endpoint.
817
+ * @param provider - registered provider route.
818
+ * @param model - exact model id.
819
+ * @param signal - cancellation for model resolution.
820
+ * @returns model metadata and a one-generation stream entry point.
821
+ */
822
+ async prepareCall(provider: string, model: string, signal?: AbortSignal): Promise<PreparedAdapterCall>;
701
823
  /**
702
824
  * Stream one model call as raw chunks. The only required method.
703
825
  * @param options - the fully-assembled request; implementations must honor `options.signal`.
@@ -715,7 +837,34 @@ declare abstract class LlmAdapter {
715
837
 
716
838
  ## Cordis API
717
839
 
718
- 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).
840
+ 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).
841
+
842
+ <a id="ctxdeepseekllmapiextensions--deepseekllmapiextensionregistry"></a>
843
+
844
+ ### `ctx.deepseekLlmApiExtensions` — `DeepSeekLlmApiExtensionRegistry`
845
+
846
+ Registry of independently owned top-level fields for official DeepSeek requests.
847
+
848
+ ```ts cordis-catalog
849
+ /**
850
+ * Register the sole provider of one top-level request field. Registration is effect-scoped.
851
+ * @param field - declaration-merged field owned by the provider.
852
+ * @param provider - request-time field preparation and optional acceptance behavior.
853
+ * @returns disposer that releases the field.
854
+ */
855
+ register<K extends keyof DeepSeekLlmApiExtensionMap>( field: K, provider: DeepSeekLlmApiExtensionProvider<DeepSeekLlmApiExtensionMap[K]>, ): () => Promise<void>
856
+
857
+ /**
858
+ * Prepare every currently registered field from one immutable base request.
859
+ * Preparation failures reject before HTTP dispatch. Field values are cloned and frozen;
860
+ * providers retain no mutable alias to the outgoing request.
861
+ * @param request - exact serialized request facts before extension fields.
862
+ * @returns detached fields and their idempotent joint acceptance transaction.
863
+ */
864
+ async prepare(request: DeepSeekLlmApiExtensionRequest): Promise<PreparedDeepSeekLlmApiExtensions>
865
+ ```
866
+
867
+ Source: [`packages/llm/deepseek-llm-api-extensions/src/index.ts`](../../packages/llm/deepseek-llm-api-extensions/src/index.ts)
719
868
 
720
869
  <a id="ctxllm--llmruntime"></a>
721
870
 
@@ -738,7 +887,7 @@ registerAdapter(providers: string[], adapter: LlmAdapter): AdapterRegistrationHa
738
887
  * Describe provider routes with a registered adapter.
739
888
  * @returns detached provider metadata in registration order.
740
889
  */
741
- listProviders(): LlmProviderInfo[]
890
+ @Remote listProviders(): LlmProviderInfo[]
742
891
 
743
892
  /**
744
893
  * Declare provider routes an adapter plugin can activate through
@@ -754,7 +903,7 @@ registerConfigurableProviders(entries: readonly LlmConfigurableProvider[]): Dire
754
903
  * List every declared configurable provider, registered or dormant.
755
904
  * @returns detached directory entries in declaration order.
756
905
  */
757
- listConfigurableProviders(): LlmConfigurableProvider[]
906
+ @Remote listConfigurableProviders(): LlmConfigurableProvider[]
758
907
 
759
908
  /**
760
909
  * Offer to interrogate provider endpoints on behalf of the settings
@@ -763,10 +912,10 @@ listConfigurableProviders(): LlmConfigurableProvider[]
763
912
  * directory, and because a provider being *added* has no route to name yet.
764
913
  * Disposed with the fiber.
765
914
  * @param settingsNs - the namespace whose profiles this discovery serves.
766
- * @param discover - interrogates one endpoint; must honor `request.signal`.
915
+ * @param discover - interrogates one endpoint and must honor the supplied signal.
767
916
  * @returns the disposer that withdraws the offer.
768
917
  */
769
- registerModelDiscovery( settingsNs: string, discover: (request: LlmModelDiscoveryRequest) => Promise<readonly LlmDiscoveredModel[]>, ): () => void
918
+ registerModelDiscovery( settingsNs: string, discover: ( request: LlmModelDiscoveryRequest, signal?: AbortSignal, ) => Promise<readonly LlmDiscoveredModel[]>, ): () => void
770
919
 
771
920
  /**
772
921
  * Interrogate one provider endpoint for the models it advertises. The
@@ -775,9 +924,20 @@ registerModelDiscovery( settingsNs: string, discover: (request: LlmModelDiscover
775
924
  * candidate metadata a surface may offer for adoption.
776
925
  * @param settingsNs - namespace whose registered discovery serves this draft.
777
926
  * @param request - the endpoint, protocol, and one-shot credential to use.
927
+ * @param signal - caller cancellation.
778
928
  * @returns the advertised models, deduplicated in endpoint order.
779
929
  */
780
- async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, ): Promise<LlmDiscoveredModel[]>
930
+ async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, signal?: AbortSignal, ): Promise<LlmDiscoveredModel[]>
931
+
932
+ /**
933
+ * Remote adapter for one draft provider interrogation.
934
+ * @param settingsNs - namespace whose registered discovery serves this draft.
935
+ * @param request - endpoint, protocol, and one-shot credential to use.
936
+ * @param signal - caller cancellation supplied by the Remote carrier.
937
+ * @returns advertised models in endpoint order.
938
+ * @throws RemoteError with `llm/model-discovery-rejected` when discovery refuses or fails.
939
+ */
940
+ @Remote('discoverModels') async remoteDiscoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, signal: AbortSignal, ): Promise<LlmDiscoveredModel[]>
781
941
 
782
942
  /**
783
943
  * Resolve the retry policy captured when one provider route was registered.
@@ -786,6 +946,17 @@ async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, ):
786
946
  */
787
947
  providerRetryPolicy(provider: string): ResolvedRetryPolicy
788
948
 
949
+ /**
950
+ * Resolve provider-side request-image pricing for one exact route, or
951
+ * `undefined` when the provider is unregistered or declares none. Unknown
952
+ * providers degrade to `undefined` rather than throwing because callers
953
+ * price durable history whose route may no longer be mounted.
954
+ * @param provider - provider route named by a request header.
955
+ * @param model - exact model id named by the same header.
956
+ * @returns the owning adapter's image pricing for the route, when declared.
957
+ */
958
+ imageRequestPricing(provider: string, model: string): LlmImageRequestPricing | undefined
959
+
789
960
  /**
790
961
  * Discover models advertised by one registered provider. Catalog membership
791
962
  * is advisory and never changes routing or request validation.
@@ -841,7 +1012,7 @@ async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<Prepared
841
1012
  stream(options: GenerateOptions): AsyncIterable<StreamChunk>
842
1013
  ```
843
1014
 
844
- Source: [`packages/llm/llm/src/index.ts:284`](../../packages/llm/llm/src/index.ts)
1015
+ Source: [`packages/llm/llm/src/index.ts`](../../packages/llm/llm/src/index.ts)
845
1016
 
846
1017
  <a id="llm-events"></a>
847
1018
 
@@ -866,7 +1037,7 @@ The provider topology changed: an adapter registered or unregistered routes, or
866
1037
  'llm/adapters-updated'(): void
867
1038
  ```
868
1039
 
869
- Source: [`packages/llm/llm/src/types.ts:23`](../../packages/llm/llm/src/types.ts)
1040
+ Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
870
1041
 
871
1042
  <a id="llmstream--waterfall"></a>
872
1043
 
@@ -890,5 +1061,5 @@ Waterfall around every streaming model call (retry, replay, routing). Bound to t
890
1061
  'llm/stream'(this: LlmRuntime, options: GenerateOptions, next: () => AsyncIterable<StreamChunk>): AsyncIterable<StreamChunk>
891
1062
  ```
892
1063
 
893
- Source: [`packages/llm/llm/src/index.ts:64`](../../packages/llm/llm/src/index.ts)
1064
+ Source: [`packages/llm/llm/src/index.ts`](../../packages/llm/llm/src/index.ts)
894
1065
  <!-- 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/lsp.md
5
- lsp.md: 18ed0e178c73702534a9964557a3dabf7bb9dd11
6
- lsp.zh.md: 8b154143057f05d74bf28b715a385a2ec65fbbff
5
+ lsp.md: 8f0b12cdbc4d81a9317b8f360fb7b76a03fbeb2b
6
+ lsp.zh.md: e88218f549b5f12ac1f6681085380347818a478d
@@ -170,7 +170,7 @@ interface LspService {
170
170
 
171
171
  ## Cordis API
172
172
 
173
- 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).
173
+ 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).
174
174
 
175
175
  <a id="ctxlsp--lspservice"></a>
176
176
 
@@ -198,5 +198,5 @@ registerProvider(provider: LspProvider): () => void
198
198
  query(request: LspQueryRequest, signal?: AbortSignal): Promise<LspQueryResult>
199
199
  ```
200
200
 
201
- Source: [`packages/lsp/lsp/src/types.ts:113`](../../packages/lsp/lsp/src/types.ts)
201
+ Source: [`packages/lsp/lsp/src/types.ts`](../../packages/lsp/lsp/src/types.ts)
202
202
  <!-- END GENERATED cordis-surface -->
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](lsp.md) | 中文
4
4
 
5
- LSP seam 是一个[能力 seam](../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.md):它在单一 `ctx.lsp` 服务上公开语义代码导航,并拆分到多个包:Service Definition([dsh-lsp](../../packages/lsp/lsp),`ctx.lsp` + 提供方注册表)、通用 Service Provider([dsh-lsp-stdio](../../packages/lsp/lsp-stdio),经过配置的 stdio 语言服务器宿主)和 Consumer([dsh-tool-lsp](../../packages/lsp/tool-lsp),即 `lsp` 工具 schema)。LSP 是**一项可选能力**,不属于 agent loop(智能体循环)主干,因此其词汇定义在此而非 [core.md](core.md) 中。更换提供方不会改变模型请求导航的方式。
5
+ LSP seam 是一个[能力 seam](../../.agents/notes/implemented/architecture/2026-07-15-lsp-capability-seam.zh.md):它在单一 `ctx.lsp` 服务上公开语义代码导航,并拆分到多个包:Service Definition([dsh-lsp](../../packages/lsp/lsp),`ctx.lsp` + 提供方注册表)、通用 Service Provider([dsh-lsp-stdio](../../packages/lsp/lsp-stdio),经过配置的 stdio 语言服务器宿主)和 Consumer([dsh-tool-lsp](../../packages/lsp/tool-lsp),即 `lsp` 工具 schema)。LSP 是**一项可选能力**,不属于 agent loop(智能体循环)主干,因此其词汇定义在此而非 [core.md](core.zh.md) 中。更换提供方不会改变模型请求导航的方式。
6
6
 
7
7
  源文件:[`packages/lsp/lsp/src/types.ts`](../../packages/lsp/lsp/src/types.ts)
8
8
 
@@ -170,7 +170,7 @@ interface LspService {
170
170
 
171
171
  ## Cordis API
172
172
 
173
- 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).
173
+ 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).
174
174
 
175
175
  <a id="ctxlsp--lspservice"></a>
176
176
 
@@ -198,5 +198,5 @@ registerProvider(provider: LspProvider): () => void
198
198
  query(request: LspQueryRequest, signal?: AbortSignal): Promise<LspQueryResult>
199
199
  ```
200
200
 
201
- Source: [`packages/lsp/lsp/src/types.ts:113`](../../packages/lsp/lsp/src/types.ts)
201
+ Source: [`packages/lsp/lsp/src/types.ts`](../../packages/lsp/lsp/src/types.ts)
202
202
  <!-- 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/permission-presets.md
5
- permission-presets.md: 16ce29a4c3b00fece089ebcdc959e57f419d35c9
6
- permission-presets.zh.md: d2e5eff6696d5dc6f925032d7eaafb7b19774f4e
5
+ permission-presets.md: f4c3fafb9eea79f58255f609affaf906c24c3bcd
6
+ permission-presets.zh.md: 7dd2927ad2d17c1715ad13085c791a73b5963c6a
@@ -45,7 +45,7 @@ The service requires a confining `ctx.shell` executor and `ctx.approval`, and mi
45
45
 
46
46
  ## Current preset and the derived `custom`
47
47
 
48
- `current(events)` derives the effective preset from the knobs, not from its own event alone: it folds the session's effective sandbox mode (falling back to the executor's configured mode) and effective approval policy (falling back to the approval service config, then `ask`), prefers a still-matching recorded selection, then the first matching table entry in declaration order, and otherwise returns `CUSTOM_PRESET` (`'custom'`). `custom` is derived-only: clients may display it as the current value, but it is never a switch target or an event payload.
48
+ `current(session)` derives the effective preset from the optionally registered `permissions` projection. The unit folds the session's sandbox mode, approval policy, and recorded selection; values absent within that state fall back to the executor's configured mode and the approval service config, then `ask`. A missing registry or projection key fails explicitly. The service prefers a still-matching selection, then the first matching table entry in declaration order, and otherwise returns `CUSTOM_PRESET` (`'custom'`). `custom` is derived-only: clients may display it as the current value, but it is never a switch target or an event payload.
49
49
 
50
50
  `names` lists the switchable presets in table declaration order; `optionOf(name)` builds the option a client renders for a table key (label falls back to the key) or for `custom`, and throws for any other name.
51
51
 
@@ -63,9 +63,9 @@ interface PresetOption {
63
63
 
64
64
  ## Switching and the `permission/preset` event
65
65
 
66
- `set(session, name)` resolves the preset (unknown names throw), appends a log-only `permission/preset` event unless `name` is already the effective preset, then writes each knob through its own setter — `setSandboxMode` from [dsh-sandbox-policy](../../packages/sandbox/sandbox-policy) and `setApprovalPolicy` from [dsh-user-approval](../../packages/interaction/user-approval) — only when that knob's effective value changes. The selection event precedes the knob events in the same turn, and re-selecting the effective preset appends nothing at all.
66
+ `set(session, name)` resolves the preset (unknown names throw), appends a log-only `permission/preset` event unless `name` is already the effective preset, then writes each knob through its own setter — `setSandboxMode` from [dsh-sandbox-policy](../../packages/sandbox/sandbox-policy) and `setApprovalPolicy` from [dsh-user-approval](../../packages/interaction/user-approval) — only when that knob's effective value changes. The selection event precedes the knob events in the same turn, and re-selecting the effective preset appends nothing.
67
67
 
68
- `permission/preset` is durable, log-only user intent: it stays out of the model transcript (the knob events own the model-visible consequences through their consumers), and it exists so `current()` can preserve WHICH preset the user chose when two presets share a bundle; `effectivePermissionPreset(events)` folds the last one, and replay needs no catch-up state. The complete event declaration is in the [persistence log event catalog](../persistence-catalog.md); the method signatures are in the generated [service catalog](#ctxpermissionpresets--permissionpresetservice).
68
+ `permission/preset` is durable, log-only user intent: it stays out of the model transcript (the knob events own the model-visible consequences through their consumers), and it exists so `current()` can preserve WHICH preset the user chose when two presets share a bundle. The `permissions` projection folds that selection with both knob events and retains the `session/end-seed` boundary used to distinguish a restored empty seed from a fresh session; replay needs no catch-up state or raw-log rescan. The complete event declaration is in the [persistence log event catalog](../persistence-catalog.md); the method signatures are in the generated [service catalog](#ctxpermissionpresets--permissionpresetservice).
69
69
 
70
70
  <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
71
71
 
@@ -73,7 +73,7 @@ interface PresetOption {
73
73
 
74
74
  ## Cordis API
75
75
 
76
- 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).
76
+ 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).
77
77
 
78
78
  <a id="ctxpermissionpresets--permissionpresetservice"></a>
79
79
 
@@ -86,10 +86,10 @@ Owns the deployment's permission presets and their write path. Requires a confin
86
86
  * Resolve the preset matching the effective knob values. A still-matching
87
87
  * last selection wins shared-bundle ties; otherwise the first table match
88
88
  * wins, or {@link CUSTOM_PRESET} when no entry matches.
89
- * @param events - the session's events in log order.
89
+ * @param session - the session whose knob state is read.
90
90
  * @returns the effective preset name, or `custom` when nothing matches.
91
91
  */
92
- current(events: readonly SessionEvent[]): string
92
+ current(session: Session): string
93
93
 
94
94
  /**
95
95
  * Build the whole select value for one folded knob state: every table
@@ -125,7 +125,7 @@ optionOf(name: string): PresetOption
125
125
  set(session: Session, name: string): void
126
126
  ```
127
127
 
128
- Types: [Session](session.md) · [SessionEvent](session.md)
128
+ Types: [Session](session.md)
129
129
 
130
- Source: [`packages/interaction/permission-presets/src/index.ts:159`](../../packages/interaction/permission-presets/src/index.ts)
130
+ Source: [`packages/interaction/permission-presets/src/index.ts`](../../packages/interaction/permission-presets/src/index.ts)
131
131
  <!-- END GENERATED cordis-surface -->