dsh-plugin-guide 0.1.0

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 (374) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE.md +26 -0
  3. package/README.es.md +139 -0
  4. package/README.hi.md +138 -0
  5. package/README.md +165 -0
  6. package/README.pt.md +139 -0
  7. package/README.zh-CN.md +164 -0
  8. package/SKILL.md +69 -0
  9. package/cordis.patch.yml +4 -0
  10. package/guide/links.md +92 -0
  11. package/guide/plugin-dev-guide.md +429 -0
  12. package/guide/quick-reference.es.md +176 -0
  13. package/guide/quick-reference.hi.md +176 -0
  14. package/guide/quick-reference.md +176 -0
  15. package/guide/quick-reference.pt.md +176 -0
  16. package/guide/quick-reference.zh-CN.md +175 -0
  17. package/index.js +58 -0
  18. package/package.json +83 -0
  19. package/references/community-ecosystem.md +201 -0
  20. package/references/community-repo-deep-dive.md +695 -0
  21. package/references/cordis-paper-and-community.md +326 -0
  22. package/references/harness-repo.md +654 -0
  23. package/references/official-docs/AGENTS.md +149 -0
  24. package/references/official-docs/BENCHMARK.md +3 -0
  25. package/references/official-docs/CLAUDE.md +1 -0
  26. package/references/official-docs/CONTRIBUTING.i18n.yaml +6 -0
  27. package/references/official-docs/CONTRIBUTING.md +23 -0
  28. package/references/official-docs/CONTRIBUTING.zh.md +23 -0
  29. package/references/official-docs/LICENSE +21 -0
  30. package/references/official-docs/README.i18n.yaml +6 -0
  31. package/references/official-docs/README.md +35 -0
  32. package/references/official-docs/README.zh.md +74 -0
  33. package/references/official-docs/SNAPSHOT.md +16 -0
  34. package/references/official-docs/THIRD_PARTY_NOTICES.md +192 -0
  35. package/references/official-docs/docs/AGENTS.md +75 -0
  36. package/references/official-docs/docs/agent-lifecycle.i18n.yaml +6 -0
  37. package/references/official-docs/docs/agent-lifecycle.md +82 -0
  38. package/references/official-docs/docs/agent-lifecycle.zh.md +84 -0
  39. package/references/official-docs/docs/api-gateway.i18n.yaml +6 -0
  40. package/references/official-docs/docs/api-gateway.md +164 -0
  41. package/references/official-docs/docs/api-gateway.zh.md +164 -0
  42. package/references/official-docs/docs/architecture.i18n.yaml +6 -0
  43. package/references/official-docs/docs/architecture.md +129 -0
  44. package/references/official-docs/docs/architecture.zh.md +133 -0
  45. package/references/official-docs/docs/capability-seams.i18n.yaml +6 -0
  46. package/references/official-docs/docs/capability-seams.md +471 -0
  47. package/references/official-docs/docs/capability-seams.zh.md +473 -0
  48. package/references/official-docs/docs/config-catalog.i18n.yaml +6 -0
  49. package/references/official-docs/docs/config-catalog.md +3151 -0
  50. package/references/official-docs/docs/config-catalog.zh.md +3152 -0
  51. package/references/official-docs/docs/cookbook/adding-a-conversation-node.i18n.yaml +6 -0
  52. package/references/official-docs/docs/cookbook/adding-a-conversation-node.md +233 -0
  53. package/references/official-docs/docs/cookbook/adding-a-conversation-node.zh.md +233 -0
  54. package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +6 -0
  55. package/references/official-docs/docs/cookbook/adding-a-package.md +118 -0
  56. package/references/official-docs/docs/cookbook/adding-a-package.zh.md +118 -0
  57. package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +6 -0
  58. package/references/official-docs/docs/cookbook/adding-a-tool.md +94 -0
  59. package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +96 -0
  60. package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +6 -0
  61. package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +59 -0
  62. package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +59 -0
  63. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.i18n.yaml +6 -0
  64. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.md +43 -0
  65. package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +43 -0
  66. package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +6 -0
  67. package/references/official-docs/docs/cookbook/extension-cookbook.md +129 -0
  68. package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +131 -0
  69. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.i18n.yaml +6 -0
  70. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.md +64 -0
  71. package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.zh.md +64 -0
  72. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +6 -0
  73. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
  74. package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
  75. package/references/official-docs/docs/cordis-api/context.i18n.yaml +6 -0
  76. package/references/official-docs/docs/cordis-api/context.md +364 -0
  77. package/references/official-docs/docs/cordis-api/context.zh.md +366 -0
  78. package/references/official-docs/docs/cordis-api/events.i18n.yaml +6 -0
  79. package/references/official-docs/docs/cordis-api/events.md +207 -0
  80. package/references/official-docs/docs/cordis-api/events.zh.md +209 -0
  81. package/references/official-docs/docs/cordis-api/fiber.i18n.yaml +6 -0
  82. package/references/official-docs/docs/cordis-api/fiber.md +375 -0
  83. package/references/official-docs/docs/cordis-api/fiber.zh.md +377 -0
  84. package/references/official-docs/docs/cordis-api/inherited.md +39 -0
  85. package/references/official-docs/docs/cordis-api/registry.i18n.yaml +6 -0
  86. package/references/official-docs/docs/cordis-api/registry.md +152 -0
  87. package/references/official-docs/docs/cordis-api/registry.zh.md +154 -0
  88. package/references/official-docs/docs/cordis-api/service.i18n.yaml +6 -0
  89. package/references/official-docs/docs/cordis-api/service.md +102 -0
  90. package/references/official-docs/docs/cordis-api/service.zh.md +104 -0
  91. package/references/official-docs/docs/cordis-primer.i18n.yaml +6 -0
  92. package/references/official-docs/docs/cordis-primer.md +44 -0
  93. package/references/official-docs/docs/cordis-primer.zh.md +50 -0
  94. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.i18n.yaml +6 -0
  95. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.md +95 -0
  96. package/references/official-docs/docs/cordis-tutorial/01-first-plugin.zh.md +95 -0
  97. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.i18n.yaml +6 -0
  98. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  99. package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
  100. package/references/official-docs/docs/cordis-tutorial/03-services.i18n.yaml +6 -0
  101. package/references/official-docs/docs/cordis-tutorial/03-services.md +98 -0
  102. package/references/official-docs/docs/cordis-tutorial/03-services.zh.md +98 -0
  103. package/references/official-docs/docs/cordis-tutorial/04-events.i18n.yaml +6 -0
  104. package/references/official-docs/docs/cordis-tutorial/04-events.md +144 -0
  105. package/references/official-docs/docs/cordis-tutorial/04-events.zh.md +144 -0
  106. package/references/official-docs/docs/cordis-tutorial/05-config.i18n.yaml +6 -0
  107. package/references/official-docs/docs/cordis-tutorial/05-config.md +84 -0
  108. package/references/official-docs/docs/cordis-tutorial/05-config.zh.md +84 -0
  109. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +6 -0
  110. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.md +113 -0
  111. package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
  112. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.i18n.yaml +6 -0
  113. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.md +107 -0
  114. package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.zh.md +107 -0
  115. package/references/official-docs/docs/cordis-tutorial/index.i18n.yaml +6 -0
  116. package/references/official-docs/docs/cordis-tutorial/index.md +60 -0
  117. package/references/official-docs/docs/cordis-tutorial/index.zh.md +62 -0
  118. package/references/official-docs/docs/defensive-patterns.i18n.yaml +6 -0
  119. package/references/official-docs/docs/defensive-patterns.md +33 -0
  120. package/references/official-docs/docs/defensive-patterns.zh.md +33 -0
  121. package/references/official-docs/docs/development.i18n.yaml +6 -0
  122. package/references/official-docs/docs/development.md +171 -0
  123. package/references/official-docs/docs/development.zh.md +171 -0
  124. package/references/official-docs/docs/event-producer-consumer.i18n.yaml +6 -0
  125. package/references/official-docs/docs/event-producer-consumer.md +76 -0
  126. package/references/official-docs/docs/event-producer-consumer.zh.md +78 -0
  127. package/references/official-docs/docs/glossary.i18n.yaml +6 -0
  128. package/references/official-docs/docs/glossary.md +45 -0
  129. package/references/official-docs/docs/glossary.zh.md +45 -0
  130. package/references/official-docs/docs/graph-atlas.i18n.yaml +6 -0
  131. package/references/official-docs/docs/graph-atlas.md +24 -0
  132. package/references/official-docs/docs/graph-atlas.zh.md +26 -0
  133. package/references/official-docs/docs/i18n/README.i18n.yaml +6 -0
  134. package/references/official-docs/docs/i18n/README.md +60 -0
  135. package/references/official-docs/docs/i18n/README.zh.md +60 -0
  136. package/references/official-docs/docs/i18n/style-samples.md +87 -0
  137. package/references/official-docs/docs/i18n/terminology.md +214 -0
  138. package/references/official-docs/docs/i18n/translation-prompt.md +263 -0
  139. package/references/official-docs/docs/i18n/translation-rules.i18n.yaml +6 -0
  140. package/references/official-docs/docs/i18n/translation-rules.md +69 -0
  141. package/references/official-docs/docs/i18n/translation-rules.zh.md +69 -0
  142. package/references/official-docs/docs/module-graph.i18n.yaml +6 -0
  143. package/references/official-docs/docs/module-graph.md +1638 -0
  144. package/references/official-docs/docs/module-graph.zh.md +1640 -0
  145. package/references/official-docs/docs/persistence-catalog.i18n.yaml +6 -0
  146. package/references/official-docs/docs/persistence-catalog.md +944 -0
  147. package/references/official-docs/docs/persistence-catalog.zh.md +946 -0
  148. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.i18n.yaml +6 -0
  149. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.md +113 -0
  150. package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
  151. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.i18n.yaml +6 -0
  152. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
  153. package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
  154. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.i18n.yaml +6 -0
  155. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
  156. package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
  157. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.i18n.yaml +6 -0
  158. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
  159. package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
  160. package/references/official-docs/docs/postmortem/README.i18n.yaml +6 -0
  161. package/references/official-docs/docs/postmortem/README.md +18 -0
  162. package/references/official-docs/docs/postmortem/README.zh.md +18 -0
  163. package/references/official-docs/docs/rescope.i18n.yaml +6 -0
  164. package/references/official-docs/docs/rescope.md +53 -0
  165. package/references/official-docs/docs/rescope.zh.md +53 -0
  166. package/references/official-docs/docs/subsystems/README.i18n.yaml +6 -0
  167. package/references/official-docs/docs/subsystems/README.md +55 -0
  168. package/references/official-docs/docs/subsystems/README.zh.md +55 -0
  169. package/references/official-docs/docs/subsystems/approval.i18n.yaml +6 -0
  170. package/references/official-docs/docs/subsystems/approval.md +170 -0
  171. package/references/official-docs/docs/subsystems/approval.zh.md +170 -0
  172. package/references/official-docs/docs/subsystems/attachment.i18n.yaml +6 -0
  173. package/references/official-docs/docs/subsystems/attachment.md +115 -0
  174. package/references/official-docs/docs/subsystems/attachment.zh.md +115 -0
  175. package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +6 -0
  176. package/references/official-docs/docs/subsystems/client-modules.md +118 -0
  177. package/references/official-docs/docs/subsystems/client-modules.zh.md +118 -0
  178. package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +6 -0
  179. package/references/official-docs/docs/subsystems/code-runtime.md +191 -0
  180. package/references/official-docs/docs/subsystems/code-runtime.zh.md +191 -0
  181. package/references/official-docs/docs/subsystems/commands.i18n.yaml +6 -0
  182. package/references/official-docs/docs/subsystems/commands.md +187 -0
  183. package/references/official-docs/docs/subsystems/commands.zh.md +187 -0
  184. package/references/official-docs/docs/subsystems/compaction.i18n.yaml +6 -0
  185. package/references/official-docs/docs/subsystems/compaction.md +238 -0
  186. package/references/official-docs/docs/subsystems/compaction.zh.md +238 -0
  187. package/references/official-docs/docs/subsystems/core.i18n.yaml +6 -0
  188. package/references/official-docs/docs/subsystems/core.md +1070 -0
  189. package/references/official-docs/docs/subsystems/core.zh.md +1078 -0
  190. package/references/official-docs/docs/subsystems/credentials.i18n.yaml +6 -0
  191. package/references/official-docs/docs/subsystems/credentials.md +133 -0
  192. package/references/official-docs/docs/subsystems/credentials.zh.md +133 -0
  193. package/references/official-docs/docs/subsystems/extensions.i18n.yaml +6 -0
  194. package/references/official-docs/docs/subsystems/extensions.md +364 -0
  195. package/references/official-docs/docs/subsystems/extensions.zh.md +364 -0
  196. package/references/official-docs/docs/subsystems/feedback.i18n.yaml +6 -0
  197. package/references/official-docs/docs/subsystems/feedback.md +266 -0
  198. package/references/official-docs/docs/subsystems/feedback.zh.md +266 -0
  199. package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +6 -0
  200. package/references/official-docs/docs/subsystems/filesystem.md +495 -0
  201. package/references/official-docs/docs/subsystems/filesystem.zh.md +495 -0
  202. package/references/official-docs/docs/subsystems/goal.i18n.yaml +6 -0
  203. package/references/official-docs/docs/subsystems/goal.md +277 -0
  204. package/references/official-docs/docs/subsystems/goal.zh.md +277 -0
  205. package/references/official-docs/docs/subsystems/invariants.i18n.yaml +6 -0
  206. package/references/official-docs/docs/subsystems/invariants.md +88 -0
  207. package/references/official-docs/docs/subsystems/invariants.zh.md +88 -0
  208. package/references/official-docs/docs/subsystems/jobs.i18n.yaml +6 -0
  209. package/references/official-docs/docs/subsystems/jobs.md +290 -0
  210. package/references/official-docs/docs/subsystems/jobs.zh.md +290 -0
  211. package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +6 -0
  212. package/references/official-docs/docs/subsystems/llm-streaming.md +888 -0
  213. package/references/official-docs/docs/subsystems/llm-streaming.zh.md +894 -0
  214. package/references/official-docs/docs/subsystems/lsp.i18n.yaml +6 -0
  215. package/references/official-docs/docs/subsystems/lsp.md +202 -0
  216. package/references/official-docs/docs/subsystems/lsp.zh.md +202 -0
  217. package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +6 -0
  218. package/references/official-docs/docs/subsystems/permission-presets.md +131 -0
  219. package/references/official-docs/docs/subsystems/permission-presets.zh.md +131 -0
  220. package/references/official-docs/docs/subsystems/persistence.i18n.yaml +6 -0
  221. package/references/official-docs/docs/subsystems/persistence.md +385 -0
  222. package/references/official-docs/docs/subsystems/persistence.zh.md +385 -0
  223. package/references/official-docs/docs/subsystems/plan.i18n.yaml +6 -0
  224. package/references/official-docs/docs/subsystems/plan.md +87 -0
  225. package/references/official-docs/docs/subsystems/plan.zh.md +87 -0
  226. package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +6 -0
  227. package/references/official-docs/docs/subsystems/sandbox.md +218 -0
  228. package/references/official-docs/docs/subsystems/sandbox.zh.md +218 -0
  229. package/references/official-docs/docs/subsystems/schedule.i18n.yaml +6 -0
  230. package/references/official-docs/docs/subsystems/schedule.md +186 -0
  231. package/references/official-docs/docs/subsystems/schedule.zh.md +186 -0
  232. package/references/official-docs/docs/subsystems/scope.i18n.yaml +6 -0
  233. package/references/official-docs/docs/subsystems/scope.md +59 -0
  234. package/references/official-docs/docs/subsystems/scope.zh.md +59 -0
  235. package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +6 -0
  236. package/references/official-docs/docs/subsystems/session-projection.md +262 -0
  237. package/references/official-docs/docs/subsystems/session-projection.zh.md +262 -0
  238. package/references/official-docs/docs/subsystems/session-query.i18n.yaml +6 -0
  239. package/references/official-docs/docs/subsystems/session-query.md +495 -0
  240. package/references/official-docs/docs/subsystems/session-query.zh.md +495 -0
  241. package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +6 -0
  242. package/references/official-docs/docs/subsystems/session-reference.md +108 -0
  243. package/references/official-docs/docs/subsystems/session-reference.zh.md +108 -0
  244. package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +6 -0
  245. package/references/official-docs/docs/subsystems/session-telemetry.md +194 -0
  246. package/references/official-docs/docs/subsystems/session-telemetry.zh.md +194 -0
  247. package/references/official-docs/docs/subsystems/session-title.i18n.yaml +6 -0
  248. package/references/official-docs/docs/subsystems/session-title.md +204 -0
  249. package/references/official-docs/docs/subsystems/session-title.zh.md +204 -0
  250. package/references/official-docs/docs/subsystems/session.i18n.yaml +6 -0
  251. package/references/official-docs/docs/subsystems/session.md +849 -0
  252. package/references/official-docs/docs/subsystems/session.zh.md +851 -0
  253. package/references/official-docs/docs/subsystems/settings.i18n.yaml +6 -0
  254. package/references/official-docs/docs/subsystems/settings.md +310 -0
  255. package/references/official-docs/docs/subsystems/settings.zh.md +310 -0
  256. package/references/official-docs/docs/subsystems/shell.i18n.yaml +6 -0
  257. package/references/official-docs/docs/subsystems/shell.md +303 -0
  258. package/references/official-docs/docs/subsystems/shell.zh.md +303 -0
  259. package/references/official-docs/docs/subsystems/skills.i18n.yaml +6 -0
  260. package/references/official-docs/docs/subsystems/skills.md +331 -0
  261. package/references/official-docs/docs/subsystems/skills.zh.md +331 -0
  262. package/references/official-docs/docs/subsystems/spill.i18n.yaml +6 -0
  263. package/references/official-docs/docs/subsystems/spill.md +117 -0
  264. package/references/official-docs/docs/subsystems/spill.zh.md +117 -0
  265. package/references/official-docs/docs/subsystems/storage.i18n.yaml +6 -0
  266. package/references/official-docs/docs/subsystems/storage.md +229 -0
  267. package/references/official-docs/docs/subsystems/storage.zh.md +229 -0
  268. package/references/official-docs/docs/subsystems/subagent.i18n.yaml +6 -0
  269. package/references/official-docs/docs/subsystems/subagent.md +734 -0
  270. package/references/official-docs/docs/subsystems/subagent.zh.md +736 -0
  271. package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +6 -0
  272. package/references/official-docs/docs/subsystems/subprocess.md +324 -0
  273. package/references/official-docs/docs/subsystems/subprocess.zh.md +324 -0
  274. package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +6 -0
  275. package/references/official-docs/docs/subsystems/system-prompt.md +207 -0
  276. package/references/official-docs/docs/subsystems/system-prompt.zh.md +207 -0
  277. package/references/official-docs/docs/subsystems/terminal.i18n.yaml +6 -0
  278. package/references/official-docs/docs/subsystems/terminal.md +184 -0
  279. package/references/official-docs/docs/subsystems/terminal.zh.md +184 -0
  280. package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +6 -0
  281. package/references/official-docs/docs/subsystems/token-meter.md +90 -0
  282. package/references/official-docs/docs/subsystems/token-meter.zh.md +90 -0
  283. package/references/official-docs/docs/subsystems/tools.i18n.yaml +6 -0
  284. package/references/official-docs/docs/subsystems/tools.md +720 -0
  285. package/references/official-docs/docs/subsystems/tools.zh.md +720 -0
  286. package/references/official-docs/docs/subsystems/typert.i18n.yaml +6 -0
  287. package/references/official-docs/docs/subsystems/typert.md +336 -0
  288. package/references/official-docs/docs/subsystems/typert.zh.md +336 -0
  289. package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +6 -0
  290. package/references/official-docs/docs/subsystems/user-questions.md +178 -0
  291. package/references/official-docs/docs/subsystems/user-questions.zh.md +178 -0
  292. package/references/official-docs/docs/subsystems/web-server.i18n.yaml +6 -0
  293. package/references/official-docs/docs/subsystems/web-server.md +108 -0
  294. package/references/official-docs/docs/subsystems/web-server.zh.md +108 -0
  295. package/references/official-docs/docs/subsystems/web.i18n.yaml +6 -0
  296. package/references/official-docs/docs/subsystems/web.md +199 -0
  297. package/references/official-docs/docs/subsystems/web.zh.md +199 -0
  298. package/references/official-docs/docs/subsystems/workflow.i18n.yaml +6 -0
  299. package/references/official-docs/docs/subsystems/workflow.md +278 -0
  300. package/references/official-docs/docs/subsystems/workflow.zh.md +278 -0
  301. package/references/official-docs/docs/subsystems/workspace.i18n.yaml +6 -0
  302. package/references/official-docs/docs/subsystems/workspace.md +228 -0
  303. package/references/official-docs/docs/subsystems/workspace.zh.md +228 -0
  304. package/references/official-docs/docs/testing.i18n.yaml +6 -0
  305. package/references/official-docs/docs/testing.md +49 -0
  306. package/references/official-docs/docs/testing.zh.md +49 -0
  307. package/references/official-docs/docs/tool-catalog.i18n.yaml +6 -0
  308. package/references/official-docs/docs/tool-catalog.md +1873 -0
  309. package/references/official-docs/docs/tool-catalog.zh.md +1878 -0
  310. package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +6 -0
  311. package/references/official-docs/docs/tool-execution-pipeline.md +62 -0
  312. package/references/official-docs/docs/tool-execution-pipeline.zh.md +64 -0
  313. package/references/official-docs/docs/user/develop/basic/config.i18n.yaml +6 -0
  314. package/references/official-docs/docs/user/develop/basic/config.md +106 -0
  315. package/references/official-docs/docs/user/develop/basic/config.zh.md +106 -0
  316. package/references/official-docs/docs/user/develop/basic/index.i18n.yaml +6 -0
  317. package/references/official-docs/docs/user/develop/basic/index.md +144 -0
  318. package/references/official-docs/docs/user/develop/basic/index.zh.md +144 -0
  319. package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +6 -0
  320. package/references/official-docs/docs/user/develop/basic/publish.md +183 -0
  321. package/references/official-docs/docs/user/develop/basic/publish.zh.md +183 -0
  322. package/references/official-docs/docs/user/develop/basic/tool.i18n.yaml +6 -0
  323. package/references/official-docs/docs/user/develop/basic/tool.md +52 -0
  324. package/references/official-docs/docs/user/develop/basic/tool.zh.md +52 -0
  325. package/references/official-docs/docs/user/develop/framework/events.i18n.yaml +6 -0
  326. package/references/official-docs/docs/user/develop/framework/events.md +143 -0
  327. package/references/official-docs/docs/user/develop/framework/events.zh.md +143 -0
  328. package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +6 -0
  329. package/references/official-docs/docs/user/develop/framework/index.md +137 -0
  330. package/references/official-docs/docs/user/develop/framework/index.zh.md +137 -0
  331. package/references/official-docs/docs/user/develop/framework/service.i18n.yaml +6 -0
  332. package/references/official-docs/docs/user/develop/framework/service.md +148 -0
  333. package/references/official-docs/docs/user/develop/framework/service.zh.md +150 -0
  334. package/references/official-docs/docs/user/develop/practice/index.i18n.yaml +6 -0
  335. package/references/official-docs/docs/user/develop/practice/index.md +155 -0
  336. package/references/official-docs/docs/user/develop/practice/index.zh.md +155 -0
  337. package/references/official-docs/docs/user/develop/practice/llm-adapter.i18n.yaml +6 -0
  338. package/references/official-docs/docs/user/develop/practice/llm-adapter.md +188 -0
  339. package/references/official-docs/docs/user/develop/practice/llm-adapter.zh.md +188 -0
  340. package/references/official-docs/docs/user/guide/index.i18n.yaml +6 -0
  341. package/references/official-docs/docs/user/guide/index.md +30 -0
  342. package/references/official-docs/docs/user/guide/index.zh.md +30 -0
  343. package/references/official-docs/docs/user/guide/providers-custom-form.png +0 -0
  344. package/references/official-docs/docs/user/guide/providers-custom-form.zh.png +0 -0
  345. package/references/official-docs/docs/user/guide/providers-models-page.png +0 -0
  346. package/references/official-docs/docs/user/guide/providers-models-page.zh.png +0 -0
  347. package/references/official-docs/docs/user/guide/providers.i18n.yaml +6 -0
  348. package/references/official-docs/docs/user/guide/providers.md +98 -0
  349. package/references/official-docs/docs/user/guide/providers.zh.md +98 -0
  350. package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +6 -0
  351. package/references/official-docs/docs/user/guide/python-sdk.md +104 -0
  352. package/references/official-docs/docs/user/guide/python-sdk.zh.md +104 -0
  353. package/references/official-docs/docs/user/index.i18n.yaml +6 -0
  354. package/references/official-docs/docs/user/index.md +11 -0
  355. package/references/official-docs/docs/user/index.zh.md +11 -0
  356. package/references/official-docs/docs/web-styling.i18n.yaml +6 -0
  357. package/references/official-docs/docs/web-styling.md +25 -0
  358. package/references/official-docs/docs/web-styling.zh.md +25 -0
  359. package/references/official-docs/examples/AGENTS.md +20 -0
  360. package/references/official-docs/packages/AGENTS.md +27 -0
  361. package/references/official-docs/packages/README.md +69 -0
  362. package/references/official-docs/vendor/README.md +60 -0
  363. package/references/official-docs/website-docs.ts +524 -0
  364. package/references/sources.md +137 -0
  365. package/references/upstream-cordis.md +594 -0
  366. package/references/website-pages.md +668 -0
  367. package/scripts/archive-discussions.ps1 +154 -0
  368. package/scripts/download-community-articles.ps1 +188 -0
  369. package/scripts/download-community-repos.ps1 +232 -0
  370. package/scripts/download-sources.ps1 +195 -0
  371. package/scripts/gen-topic-snapshot.ps1 +91 -0
  372. package/scripts/install-skill.ps1 +63 -0
  373. package/scripts/sync-official-docs.ps1 +130 -0
  374. package/scripts/verify-kit.ps1 +191 -0
@@ -0,0 +1,888 @@
1
+ # LLM Streaming
2
+
3
+ English | [中文](llm-streaming.zh.md)
4
+
5
+ The conversation and streaming types from [`packages/llm`](../../packages/llm/README.md): the `Message`/`ContentBlock` variants every request and durable history share, the fully assembled model request, the raw `StreamChunk` protocol, the adapter contract every adapter must implement, and the shared assembler. The [core packages](core.md) hold and log these values on every turn; this page declares them.
6
+
7
+ Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
8
+
9
+ <a id="content-blocks-and-messages"></a>
10
+
11
+ ## Content blocks and messages
12
+
13
+ A conversation is `Message`s; a message is an array of typed **content blocks**. The block union derives from `ContentBlockMap`.
14
+
15
+ Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
16
+
17
+ ```ts type-equiv
18
+ /**
19
+ * Merge-extensible content blocks keyed by `type`. New core blocks must land
20
+ * with adapter, UI, and compaction support.
21
+ */
22
+ interface ContentBlockMap {
23
+ 'text': TextBlock
24
+ 'reasoning': ReasoningBlock
25
+ 'image': ImageBlock
26
+ 'tool-call': ToolCallBlock
27
+ 'tool-result': ToolResultBlock
28
+ }
29
+ ```
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.
32
+
33
+ Source: [`packages/llm/llm/src/message.ts`](../../packages/llm/llm/src/message.ts)
34
+
35
+ A `Message` is one identified, immutable role/source/content value. Model-produced assistant messages name the provider and model that produced them and carry optional adapter-private replay data in their source:
36
+
37
+ ```ts type-equiv
38
+ /** Provider/model identity and adapter-private replay data for an assistant message. */
39
+ interface AssistantProvenance {
40
+ /** Provider route that produced the message. */
41
+ provider: string
42
+ /** Provider model id that produced the message. */
43
+ model: string
44
+ /**
45
+ * Lossless-JSON adapter state needed to replay the provider response.
46
+ * `LlmRuntime` exposes it to a target adapter only when that adapter instance
47
+ * currently owns both this historical provider and the target provider.
48
+ */
49
+ replayState?: unknown
50
+ }
51
+ ```
52
+
53
+ ```ts type-equiv
54
+ /** One immutable message representation shared by delivery, durable history, and model requests. */
55
+ interface Message {
56
+ /** Stable identity preserved across every representation boundary. */
57
+ readonly id: MessageId
58
+ /** Provider-neutral conversation role. */
59
+ readonly role: 'system' | 'user' | 'assistant'
60
+ /** Exact model-facing blocks. */
61
+ readonly content: ContentBlock[]
62
+ /** Required source fields supplied by the producer. */
63
+ readonly source: MessageSource
64
+ }
65
+ ```
66
+
67
+ Where a message came from is itself a merge-extensible sum type:
68
+
69
+ ```ts type-equiv
70
+ /**
71
+ * Where a message (or injected content) came from.
72
+ * Merge-extensible sum type — plugins add their own `kind`s.
73
+ */
74
+ interface MessageSourceMap {
75
+ user: { kind: 'user' }
76
+ plugin: { kind: 'plugin'; plugin: string } & ContextFormed
77
+ model: ModelMessageSource
78
+ tool: ToolMessageSource
79
+ }
80
+ ```
81
+
82
+ Producer identity and presentation form are independent. `kind` answers *who produced this*; the optional `form` answers *what kind of information this is*, and consumers decide how to present it. Several producers may share one form, and one producer may emit more than one form over a session. The values are semantic and grow one at a time; an absent or unrecognized value uses the documented default and is presented as opaque content:
83
+
84
+ ```ts type-equiv
85
+ /**
86
+ * The kind of information in producer-supplied context, declared by the
87
+ * producer beside its provenance.
88
+ *
89
+ * `MessageSource.kind` answers *who produced this*; `form` answers *what kind
90
+ * of thing it is*, and the two axes are deliberately independent — several
91
+ * producers share one form, and one producer may emit more than one form over
92
+ * a session.
93
+ *
94
+ * The vocabulary is SEMANTIC, never visual: a value states that the content is
95
+ * a file's instructions or a catalog of available items, and a consumer decides
96
+ * what that looks like. Colors, icons, ordering, and collapse defaults are the
97
+ * consumer's business and must not enter this union. It grows one value at a
98
+ * time as producers gain the structured fields their form needs; an absent or
99
+ * unknown value is the documented default, presented as opaque content.
100
+ */
101
+ type ContextForm =
102
+ /** Instructions read out of workspace files the model is expected to follow. */
103
+ | 'instructions'
104
+ /** A catalog of items available in this session, republished as it changes. */
105
+ | 'catalog'
106
+ /** Current state, where a later snapshot from the same producer supersedes an earlier one. */
107
+ | 'snapshot'
108
+ /** A one-off account of something that just happened; it supersedes nothing. */
109
+ | 'notice'
110
+ /** A message another agent addressed to this one. */
111
+ | 'relay'
112
+ /** Material lifted out of another session's log, possibly reduced on the way in. */
113
+ | 'recall'
114
+ ```
115
+
116
+ ```ts type-equiv
117
+ /** One named contribution to a `snapshot`-form context, in assembly order. */
118
+ interface ContextSnapshotSection {
119
+ /** The contributing subsystem's name. */
120
+ readonly name: string
121
+ /** That contribution's model-facing text, exactly as assembled. */
122
+ readonly text: string
123
+ }
124
+ ```
125
+
126
+ ```ts type-equiv
127
+ /**
128
+ * Producer-declared {@link ContextForm} and the fields that form requires,
129
+ * mixed into the source types that carry one.
130
+ *
131
+ * Discriminated by `form` so a producer cannot select a form without the
132
+ * fields needed to present it: a `notice` must record its one-line
133
+ * account, a `snapshot` its sections. Omitting `form` stays valid — an
134
+ * undeclared context is the documented default.
135
+ */
136
+ type ContextFormed =
137
+ | { readonly form?: never }
138
+ | { readonly form: 'instructions' }
139
+ | { readonly form: 'catalog' }
140
+ | {
141
+ readonly form: 'snapshot'
142
+ /** The named contributions this snapshot assembled, in order. */
143
+ readonly sections: readonly ContextSnapshotSection[]
144
+ }
145
+ | {
146
+ readonly form: 'notice'
147
+ /** One-line account of what happened, shown without expanding the row. */
148
+ readonly summary: string
149
+ }
150
+ | { readonly form: 'relay' }
151
+ | { readonly form: 'recall' }
152
+ ```
153
+
154
+ <a id="streamchunk--the-raw-protocol"></a>
155
+
156
+ ## `StreamChunk` — the raw protocol
157
+
158
+ 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
+
160
+ ```ts type-equiv
161
+ /**
162
+ * Raw streaming protocol emitted by adapters.
163
+ * Block indexes correlate interleaved deltas, and `block-end` carries the
164
+ * assembled block. Adapters emit usage before the terminal finish and nothing
165
+ * afterward; tool arguments remain raw JSON strings. An adapter implementation
166
+ * may throw, but `LlmRuntime.stream()` normalizes that failure to a terminal
167
+ * `error` or `aborted` finish before exposing it to consumers.
168
+ */
169
+ type StreamChunk =
170
+ | { type: 'block-start'; index: number; blockType: ContentBlockType }
171
+ | { type: 'text-delta'; index: number; text: string }
172
+ | { type: 'reasoning-delta'; index: number; text: string }
173
+ | { type: 'tool-call-delta'; index: number; id: CallId; name?: string; argumentsDelta: string }
174
+ | { type: 'block-end'; index: number; block: ContentBlock }
175
+ | { type: 'usage'; usage: TokenUsage }
176
+ | {
177
+ type: 'finish'
178
+ reason: FinishReason
179
+ /** Adapter-private lossless-JSON state for replaying a successful response. */
180
+ replayState?: unknown
181
+ }
182
+ ```
183
+
184
+ ## `LlmFailure`
185
+
186
+ Every thrown or in-band final-adapter failure normalizes to one serializable provider-neutral payload. `providerRetryAfterMs` is a validated positive delay requested by the provider, not a retry decision; `ProviderRequestId` is an opaque branded string for diagnostics.
187
+
188
+ ```ts type-equiv
189
+ /** Serializable provider or transport failure facts; policy decides whether they are retryable. */
190
+ interface LlmFailure {
191
+ /** Human-readable provider or transport failure. */
192
+ readonly message: string
193
+ /** Stable provider-neutral machine-routing code. */
194
+ readonly code: string
195
+ /** HTTP status returned by the provider, when available. */
196
+ readonly status?: number
197
+ /** Provider-requested delay in milliseconds, when valid and available. */
198
+ readonly providerRetryAfterMs?: number
199
+ /** Opaque provider-issued request identifier for diagnostics. */
200
+ readonly requestId?: ProviderRequestId
201
+ }
202
+ ```
203
+
204
+ ## The adapter contract
205
+
206
+ Every adapter MUST obey these, and every consumer may rely on them:
207
+
208
+ - **`usage` before `finish`, nothing after `finish`.** Defer both to the provider's end-of-stream marker so a trailing usage-only chunk can't violate the ordering.
209
+ - **Tool-call `arguments` stay raw JSON strings end-to-end.** Partial fragments stream via `argumentsDelta`; a provider that hands back parsed objects re-stringifies at `block-end`.
210
+ - **Two sanctioned error paths, one `LlmFailure` type.** A failure may either THROW from `stream()` (transport/protocol errors) **or** end the stream with `finish {kind:'error'|'aborted', failure}` (provider in-band errors, for adapters that can't throw mid-stream). `LlmError.failure` carries the same `LlmFailure`. After the call selects its adapter, the stream preserves the exact thrown `Error` object and associates immutable facts plus the serving registration's immutable retry policy with that call; the agent loop closes the failed step and offers the error, facts, immutable prior-retried facts, serving policy, and turn signal to `agent/request-error`. A handling listener returns `{ kind: 'retry' }` after its awaited repair; absent recovery the structured failure becomes the turn error, and no normal assistant message or tool side effect is committed for that attempt.
211
+ - **One adapter call is one provider attempt.** Adapters disable library retries. Agent-level recovery opens another durable numbered turn; direct `ctx.llm.stream()` callers remain single-attempt.
212
+ - **Provider stalls are bounded at the transport.** Both shipping remote adapters expose positive finite `streamIdleTimeoutMs` with a five-minute default. The watchdog arms only while iterator `next()` is outstanding, uses one stable signal for the whole request, maps its own expiry to `TIMEOUT`, and keeps an earlier caller abort as `ABORTED`.
213
+ - **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
+ - **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
+ - **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.
217
+
218
+ ## `ResolvedRetryPolicy`
219
+
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.
221
+
222
+ ## `AppIdentity` — app attribution
223
+
224
+ The static public application identity every adapter sends to providers ([`packages/llm/llm/src/attribution.ts`](../../packages/llm/llm/src/attribution.ts)). `attributionHeaders(identity?)` maps it to the standard `User-Agent` header only; OpenRouter-specific app attribution headers are intentionally not supported by this contract. The default `APP_IDENTITY` sources its version from the package manifest; every field is a public product fact - no secrets, paths, session ids, or per-user identifiers, and nothing per-request may influence the values. Rationale: [Mandatory `User-Agent` attribution](../../.agents/notes/implemented/architecture/2026-06-21-mandatory-app-attribution-headers.md).
225
+
226
+ ```ts type-equiv
227
+ /**
228
+ * Static public application identity sent to LLM providers.
229
+ *
230
+ * Every field is a public product fact, safe on every request: no secrets,
231
+ * local paths, session ids, prompt text, or per-user identifiers belong here,
232
+ * and nothing per-request may influence the values.
233
+ */
234
+ interface AppIdentity {
235
+ /** `User-Agent` product token (lowercase, hyphenated). */
236
+ product: string
237
+ /** Product version; sourced from package metadata, never hand-copied. */
238
+ version: string
239
+ /** Repository home URL of the app, used as the `User-Agent` comment. */
240
+ url: string
241
+ }
242
+ ```
243
+
244
+ ## `TokenUsage`
245
+
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.
247
+
248
+ ```ts type-equiv
249
+ /**
250
+ * Token accounting for one model call (cache fields are optional).
251
+ *
252
+ * Counts are DISJOINT: `inputTokens` is uncached input only; cached input is
253
+ * reported separately as `cacheReadTokens`/`cacheWriteTokens` (billed input =
254
+ * sum of the three). Adapters whose providers fold cache hits into a total
255
+ * prompt count (DeepSeek's `prompt_tokens`) subtract them out.
256
+ */
257
+ interface TokenUsage {
258
+ inputTokens: number
259
+ outputTokens: number
260
+ cacheReadTokens?: number
261
+ cacheWriteTokens?: number
262
+ reasoningTokens?: number
263
+ }
264
+ ```
265
+
266
+ ## `BlockAssembler`
267
+
268
+ `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
+
270
+ ```ts public-api
271
+ /**
272
+ * Incrementally assembles raw {@link StreamChunk}s into complete
273
+ * {@link ContentBlock}s and a final assistant {@link Message}.
274
+ *
275
+ * The agent loop feeds it while logging raw chunks for replay fidelity, then
276
+ * reads `blocks()` / `message()` / `usage` / `finish` once the stream ends.
277
+ *
278
+ * Tolerant of delta-only protocols (no block-start/end); deltas arriving for
279
+ * an index already closed by `block-end` are ignored (malformed stream) so a
280
+ * misbehaving adapter cannot grow memory or corrupt a completed block.
281
+ */
282
+ declare class BlockAssembler {
283
+ /**
284
+ * Feed one chunk into the assembly state.
285
+ * @param chunk - the next raw chunk, in stream order.
286
+ */
287
+ push(chunk: StreamChunk): void;
288
+ /**
289
+ * Assemble all blocks seen so far, in stream order.
290
+ * @returns one block per seen index, except that max-token truncation drops
291
+ * tool calls that cannot be executed safely; an open block assembles from
292
+ * its accumulated deltas (an unknown block type never closed by `block-end` throws).
293
+ */
294
+ blocks(): ContentBlock[];
295
+ /** Usage from the `usage` chunk; undefined until one arrives. */
296
+ get usage(): TokenUsage | undefined;
297
+ /** Finish reason from the `finish` chunk; `{kind: 'stop'}` when the stream ended without one. */
298
+ get finish(): FinishReason;
299
+ /** Adapter-private replay state from the terminal finish chunk, if any. */
300
+ get replayState(): unknown;
301
+ /**
302
+ * The assembled assistant message.
303
+ * @param source - producer attribution for the assembled message.
304
+ * @returns a frozen assistant-role message over `blocks()` (same open-block assembly rules).
305
+ */
306
+ message(source: MessageSource = { kind: 'plugin', plugin: 'dsh-llm/assembler' }): Message;
307
+ }
308
+ ```
309
+
310
+ <a id="the-model-request-and-result"></a>
311
+
312
+ ## The model request
313
+
314
+ One model call is a fully-assembled `GenerateOptions`. The adapter answers with a raw [`StreamChunk`](#streamchunk--the-raw-protocol) stream; the consumer assembles it with [`BlockAssembler`](#blockassembler).
315
+
316
+ Source: [`packages/llm/llm/src/types.ts`](../../packages/llm/llm/src/types.ts)
317
+
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.
319
+
320
+ Registering an adapter returns a handle: the disposer, plus the atomic route replacement a plugin whose route set is user-configurable needs.
321
+
322
+ ```ts type-equiv
323
+ /**
324
+ * What {@link LlmRuntime.registerAdapter} returns: the disposer, plus an
325
+ * atomic route replacement for the same adapter instance.
326
+ */
327
+ interface AdapterRegistrationHandle {
328
+ /** Release every route this registration currently holds. */
329
+ (): void
330
+ /**
331
+ * Replace this registration's routes with `providers`, keeping the same
332
+ * adapter instance. The candidate set is validated in full first — a
333
+ * conflict with another adapter, an invalid name, or bad provider metadata
334
+ * throws and leaves the current routes untouched — and the swap itself is
335
+ * one synchronous section, so no request can observe a gap. An empty array
336
+ * is legal here (a settings section that emptied holds zero routes while
337
+ * staying registered), unlike an empty initial registration.
338
+ *
339
+ * Throws `LlmError` with code `REGISTRATION_DISPOSED` once the registration
340
+ * has been released: its routes are gone and its disposer has already run,
341
+ * so anything registered afterwards would have no owner left to release it.
342
+ * @param providers - the complete next route set for this registration.
343
+ */
344
+ replace(providers: string[]): void
345
+ }
346
+ ```
347
+
348
+ ```ts type-equiv
349
+ /** Display metadata for one registered provider route. */
350
+ interface LlmProviderInfo {
351
+ /** Provider route key used by {@link GenerateOptions.provider}. */
352
+ id: string
353
+ /** Human-readable provider name for selectors and diagnostics. */
354
+ name: string
355
+ }
356
+ ```
357
+
358
+ Adapter plugins additionally declare which routes *could* run through `registerConfigurableProviders()`, addressing each one's user-settings section, so configuration surfaces can offer dormant providers before any route registers.
359
+
360
+ ```ts type-equiv
361
+ /**
362
+ * One provider route an adapter plugin can activate through configuration,
363
+ * whether or not the route is currently registered. Configuration surfaces
364
+ * merge this directory with `listProviders()` to offer every configurable
365
+ * provider alongside its live/dormant state.
366
+ */
367
+ interface LlmConfigurableProvider {
368
+ /** Provider route key this entry activates when configured. */
369
+ provider: string
370
+ /** Human-readable provider name for configuration surfaces. */
371
+ displayName: string
372
+ /** User-settings namespace whose section configures this provider. */
373
+ settingsNs: string
374
+ /**
375
+ * Path from that namespace's section root to this provider's profile
376
+ * object; empty when the whole section is the profile.
377
+ */
378
+ settingsPath: readonly string[]
379
+ /**
380
+ * Whether the owning adapter knows this route only because configuration
381
+ * declared it — a gateway or self-hosted server it ships nothing about.
382
+ * Absent means the adapter draws no such distinction; false means it does
383
+ * and this route is one of its own. Only the adapter can answer: a stored
384
+ * profile is how a user-added route AND a corrected shipped one both look
385
+ * from outside.
386
+ */
387
+ declared?: boolean
388
+ }
389
+ ```
390
+
391
+ ```ts type-equiv
392
+ /** One adapter-discovered model; catalog membership is advisory, not request validation. */
393
+ interface LlmModelInfo {
394
+ /** Provider route that owns this model entry. */
395
+ provider: string
396
+ /** Model id passed to {@link GenerateOptions.model}. */
397
+ id: string
398
+ /** Human-readable model name for selectors. */
399
+ name: string
400
+ /** Optional user-facing distinction from otherwise similar models. */
401
+ description?: string
402
+ /** Accepted request modalities; absent means unknown, while an explicit omission is negative capability. */
403
+ inputModalities?: readonly ModelModality[]
404
+ }
405
+ ```
406
+
407
+ Correctness-sensitive metadata is resolved separately from the advisory catalog and is owned by the adapter serving the exact route. Context capacity, adapter call defaults, and reasoning choices share one exact-model result so consumers do not repeat authoritative model resolution.
408
+
409
+ ```ts type-equiv
410
+ /** Provider-owned context capacity for one exact provider/model route. */
411
+ interface LlmModelContext {
412
+ /** Maximum combined request and response context in tokens. */
413
+ contextWindow: number
414
+ }
415
+ ```
416
+
417
+ Reasoning effort is another exact-route capability. The core brands identifiers but does not enumerate their values; each adapter owns the ordered set, display names, and optional deployment default.
418
+
419
+ ```ts type-equiv
420
+ /** Adapter-owned identifier for one model's selectable reasoning effort. */
421
+ type ReasoningEffortId = Branded<'ReasoningEffortId'>
422
+ ```
423
+
424
+ ```ts type-equiv
425
+ /** Display metadata for one adapter-owned reasoning effort. */
426
+ interface LlmReasoningEffortInfo {
427
+ /** Opaque stable value accepted by {@link GenerateOptions.reasoningEffort}. */
428
+ id: ReasoningEffortId
429
+ /** Human-readable effort name for selectors and diagnostics. */
430
+ name: string
431
+ /** Optional user-facing distinction from otherwise similar efforts. */
432
+ description?: string
433
+ }
434
+ ```
435
+
436
+ ```ts type-equiv
437
+ /** Selectable reasoning efforts for one exact provider/model route. */
438
+ interface LlmModelReasoningInfo {
439
+ /** Supported efforts in adapter-preferred display order. */
440
+ efforts: readonly LlmReasoningEffortInfo[]
441
+ /**
442
+ * Adapter-configured default materialized into requests when callers omit
443
+ * an effort. Absence preserves the provider's own default.
444
+ */
445
+ defaultEffort?: ReasoningEffortId
446
+ }
447
+ ```
448
+
449
+ ```ts type-equiv
450
+ /** Exact-route model metadata resolved by its owning adapter. */
451
+ interface LlmResolvedModelInfo extends LlmModelInfo {
452
+ /** Provider-owned context capacity when known. */
453
+ context?: LlmModelContext
454
+ /** Adapter-configured per-request output cap materialized when callers omit one. */
455
+ defaultMaxTokens?: number
456
+ /** Adapter-owned selectable reasoning levels when exposed. */
457
+ reasoning?: LlmModelReasoningInfo
458
+ }
459
+ ```
460
+
461
+ ```ts type-equiv
462
+ /** A single model request, fully assembled. */
463
+ interface GenerateOptions {
464
+ /** Registered provider route selecting the adapter instance. */
465
+ provider: string
466
+ model: string
467
+ /** Adapter-owned reasoning effort selected for this exact model. */
468
+ reasoningEffort?: ReasoningEffortId
469
+ /**
470
+ * Ordered conversation messages, exactly as the provider sees them (after
471
+ * the `system` slot). A loop-built request assembles them as
472
+ * the derived history (dsh-agent-loop); a hand-built one-shot passes any list.
473
+ */
474
+ messages: Message[]
475
+ /** System prompt text (adapters map to the provider's system slot). */
476
+ system?: string
477
+ /** Tool schemas (adapters map to the provider's `tools` field). */
478
+ tools?: ToolSchema[]
479
+ temperature?: number
480
+ maxTokens?: number
481
+ /**
482
+ * Stop sequences: generation halts as soon as the model produces any one of
483
+ * these strings (adapters map to the provider's stop field, e.g. OpenAI
484
+ * `stop`). The stop string itself is not included in the output.
485
+ */
486
+ stop?: string[]
487
+ signal?: AbortSignal
488
+ /**
489
+ * Session identity stamped by the loop for request routing. Replay uses it
490
+ * to separate cursors; adapters may map it to model-hidden transport metadata.
491
+ */
492
+ sessionId?: Branded<'SessionId'>
493
+ /**
494
+ * Provider-neutral classification for an auxiliary model call. Adapters may
495
+ * map the purpose to model-hidden transport metadata or purpose-specific
496
+ * generation policy. Ordinary conversation requests leave it unset.
497
+ */
498
+ purpose?: 'compaction' | 'session-title'
499
+ }
500
+ ```
501
+
502
+ Why a model response stopped is a merge-extensible reason. Terminal provider failures carry the streaming contract's [`LlmFailure`](#llmfailure):
503
+
504
+ ```ts type-equiv
505
+ /**
506
+ * Why a model response stopped.
507
+ * Merge-extensible so adapters can surface provider-specific reasons.
508
+ */
509
+ interface FinishReasonMap {
510
+ 'stop': { kind: 'stop' }
511
+ 'tool-calls': { kind: 'tool-calls' }
512
+ 'max-tokens': { kind: 'max-tokens' }
513
+ 'aborted': { kind: 'aborted'; failure: LlmFailure }
514
+ 'error': { kind: 'error'; failure: LlmFailure }
515
+ }
516
+ ```
517
+
518
+ `FinishReason = FinishReasonMap[keyof FinishReasonMap]`. `TokenUsage` (per-call accounting with disjoint cache fields) is detailed [below](#tokenusage).
519
+
520
+ `GenerateOptions.tools` carries `ToolSchema` — the JSON-schema description of a tool, as sent to the model. It is declared in dsh-llm (not dsh-tools) precisely because it is part of the request the loop assembles every step:
521
+
522
+ ```ts type-equiv
523
+ /**
524
+ * JSON-schema description of a tool, as sent to the model.
525
+ *
526
+ * Declared here (not in dsh-tools) because it is part of {@link GenerateOptions};
527
+ * dsh-tools' ToolDefinition and dsh-system-prompt's PromptAssembly both import
528
+ * it from this package.
529
+ */
530
+ interface ToolSchema {
531
+ name: string
532
+ description: string
533
+ /** JSON Schema object for the arguments. */
534
+ parameters: Record<string, unknown>
535
+ }
536
+ ```
537
+
538
+ The model-facing `ToolSchema` is the wire type; the registered `ToolDefinition` that produces it (schema + `execute`) is on [tools.md](tools.md).
539
+
540
+ A provider a surface is still drafting has no route and no catalog, so interrogation is described separately: the request carries the draft the user is editing, and the reply is candidates a surface may adopt rather than a catalog it must serve.
541
+
542
+ ```ts type-equiv
543
+ /**
544
+ * One interrogation of a provider endpoint that configuration has not stored
545
+ * yet. Configuration surfaces send the draft a user is still editing, so the
546
+ * request carries the endpoint and credential directly instead of naming a
547
+ * route: a provider being added has no route to name.
548
+ */
549
+ interface LlmModelDiscoveryRequest {
550
+ /**
551
+ * Route the draft is editing, when it edits an existing one. A route whose
552
+ * adapter already knows its models answers from that knowledge instead of
553
+ * asking the endpoint — the adapter's own registry is the better answer, and
554
+ * it costs no network call.
555
+ */
556
+ provider?: string
557
+ /**
558
+ * Endpoint to interrogate. Optional because a route the adapter already
559
+ * describes needs none; a route it does not must supply one.
560
+ */
561
+ baseURL?: string
562
+ /** Wire protocol the endpoint speaks, when the draft names one. */
563
+ api?: string
564
+ /** Credential for this interrogation alone; the harness never stores it. */
565
+ apiKey?: string
566
+ /** Caller cancellation; implementations must settle promptly after it aborts. */
567
+ signal?: AbortSignal
568
+ }
569
+ ```
570
+
571
+ ```ts type-equiv
572
+ /**
573
+ * One model an endpoint reports about itself. Every field but the id is
574
+ * optional because most provider listings disclose an id and nothing else;
575
+ * a surface adopting one of these still owes the capacities its adapter needs.
576
+ */
577
+ interface LlmDiscoveredModel {
578
+ /** Model id the endpoint accepts. */
579
+ id: string
580
+ /** Human-readable name when the endpoint supplies one. */
581
+ name?: string
582
+ /** Maximum combined request and response context, when disclosed. */
583
+ contextWindow?: number
584
+ /** Maximum output tokens, when disclosed. */
585
+ maxTokens?: number
586
+ }
587
+ ```
588
+
589
+ ### The request envelope: `LlmCallConfig` and the logged header
590
+
591
+ The loop builds each request from logged state. `EpochHeader` records call config, marks the fields supplied by adapter defaults, and records the rendered prompt and authoritative returned tool order (configured by `toolOrder`, or lexicographic when unset) through full `request/header` snapshots. Together with derived history, this makes the request reconstructable from the session log. See [session.md](session.md#the-request-header-event-requestheader) and the [reconstructability Agent Note](../../.agents/notes/implemented/architecture/2026-07-05-reconstructable-requests.md).
592
+
593
+ `agent/request` receives a frozen call-config seed and may return a replacement to switch provider, model, reasoning effort, or sampling. Before the waterfall, the loop removes values marked as adapter defaults so exact-model preparation materializes the selected route's current values; unmarked explicit settings remain in the proposal. After the waterfall, preparation rejects unsupported explicit effort ids without clamping and logs the effective config plus the fields supplied by adapter defaults under the turn signal. The prepared call keeps one adapter registration through dispatch. Requests reaching `llm/stream` are deep-frozen, so mutation throws, and carry a process-local loop identity so observers do not confuse separately logged frozen auxiliary calls with conversation requests.
594
+
595
+ On the wire, a loop-built request reads the `system` slot (the rendered prompt assembly) followed by the derived history. The logged request snapshot ends with the newest `user/message` on a turn's first step and the previous step's tool results on later steps. The dev invariant recomputes exactly this equation against every loop-built request.
596
+
597
+ FIXME(call-config-shape): revisit which remaining fields are genuinely epoch-level for cache purposes (`model` and the model-owned reasoning effort are explicit; the sampling scalars sit here out of caution).
598
+
599
+ ```ts type-equiv
600
+ /**
601
+ * Provider, model, reasoning effort, and sampling scalars of one conversation's
602
+ * requests. Every field maps 1:1 onto the same-named `GenerateOptions` field;
603
+ * the loop builds requests from the logged header rather than accepting these
604
+ * per call.
605
+ */
606
+ interface LlmCallConfig {
607
+ provider: string
608
+ model: string
609
+ reasoningEffort?: ReasoningEffortId
610
+ temperature?: number
611
+ maxTokens?: number
612
+ stop?: string[]
613
+ }
614
+ ```
615
+
616
+ ```ts type-equiv
617
+ /**
618
+ * Effective config fields supplied by exact-model adapter resolution rather
619
+ * than by the caller's request proposal.
620
+ */
621
+ interface LlmCallConfigAdapterDefaults {
622
+ reasoningEffort?: true
623
+ maxTokens?: true
624
+ }
625
+ ```
626
+
627
+ ## Service and provider contracts
628
+
629
+ `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.
630
+
631
+ ```ts type-equiv
632
+ /** One model call whose config and adapter registration were resolved together. */
633
+ interface PreparedLlmCall {
634
+ /** Detached, deep-frozen config with any adapter-owned default materialized. */
635
+ readonly config: LlmCallConfig
636
+ /** Immutable retry policy captured with the adapter registration. */
637
+ readonly retryPolicy: ResolvedRetryPolicy
638
+ /** Detached context metadata resolved with the registration-bound call. */
639
+ readonly context?: LlmModelContext
640
+ /** Config fields materialized by the captured adapter rather than proposed by the caller. */
641
+ readonly adapterDefaults: LlmCallConfigAdapterDefaults
642
+ /**
643
+ * Dispatch this call once through the registration captured during
644
+ * preparation. The request's call-config fields must match {@link config};
645
+ * reuse or mismatch fails with `INVALID_PREPARED_CALL`.
646
+ * @param options - fully assembled request carrying the prepared config.
647
+ * @returns the chunk stream, including the `llm/stream` waterfall.
648
+ */
649
+ stream(options: GenerateOptions): AsyncIterable<StreamChunk>
650
+ }
651
+ ```
652
+
653
+ ```ts public-api
654
+ /**
655
+ * Provider-wire adapter for the harness message and stream vocabulary. Register implementations
656
+ * with `ctx.llm.registerAdapter(providers, adapter)`. Every provider HTTP request must include
657
+ * `attributionHeaders()`; prove the headers are added in the wire request or library header hook. The direct-fetch
658
+ * DeepSeek and library-backed pi-ai adapters meet this contract through different internals.
659
+ */
660
+ declare abstract class LlmAdapter {
661
+ /**
662
+ * Describe one provider route owned by this adapter.
663
+ * @param provider - a route passed to `registerAdapter()` for this instance.
664
+ * @returns detached display metadata whose id must equal `provider`.
665
+ */
666
+ providerInfo(provider: string): LlmProviderInfo;
667
+ /**
668
+ * Return the provider-owned retry policy captured with this route.
669
+ * @param _provider - a route passed to `registerAdapter()` for this instance.
670
+ * @returns a resolved policy, or `undefined` to use the normal defaults.
671
+ */
672
+ providerRetryPolicy(_provider: string): ResolvedRetryPolicy | undefined;
673
+ /**
674
+ * List models this adapter can currently advertise for one owned provider.
675
+ * The result is advisory: an adapter may accept unlisted model ids, and
676
+ * consumers must not turn absence into request rejection.
677
+ * @param _provider - one provider route owned by this adapter.
678
+ * @returns discoverable models in adapter-preferred order.
679
+ */
680
+ listModels(_provider: string): Promise<readonly LlmModelInfo[]>;
681
+ /**
682
+ * Resolve all metadata available for one exact model. This query is
683
+ * independent of the advisory catalog and does not validate request routing.
684
+ * @param provider - one provider route owned by this adapter.
685
+ * @param model - exact model id passed to {@link GenerateOptions.model}.
686
+ * @param _signal - cancellation for this exact-model lookup; asynchronous
687
+ * implementations must settle promptly after it aborts.
688
+ * @returns provider/model identity plus any context, call-default, and reasoning metadata.
689
+ */
690
+ resolveModel(
691
+ provider: string,
692
+ model: string,
693
+ _signal?: AbortSignal,
694
+ ): Promise<LlmResolvedModelInfo>;
695
+ /**
696
+ * Stream one model call as raw chunks. The only required method.
697
+ * @param options - the fully-assembled request; implementations must honor `options.signal`.
698
+ * @returns the chunk stream, obeying the adapter contract documented on `StreamChunk`.
699
+ */
700
+ abstract stream(options: GenerateOptions): AsyncIterable<StreamChunk>;
701
+ }
702
+ ```
703
+
704
+ `ContentBlockType` (the key set the `index`-correlated blocks carry) derives from [`ContentBlockMap`](#content-blocks-and-messages) above.
705
+
706
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
707
+
708
+ <a id="cordis-surface"></a>
709
+
710
+ ## Cordis API
711
+
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).
713
+
714
+ <a id="ctxllm--llmruntime"></a>
715
+
716
+ ### `ctx.llm` — `LlmRuntime`
717
+
718
+ The abstract `llm` service: an adapter registry plus a streaming model-call API, interceptable via the `llm/stream` waterfall.
719
+
720
+ ```ts cordis-catalog
721
+ /**
722
+ * Register an adapter for the given provider routes. Throws `LlmError` with code
723
+ * `DUPLICATE_ADAPTER` if any provider already has an adapter (all-or-nothing).
724
+ * Disposed with the fiber.
725
+ * @param providers - every provider route this adapter should serve.
726
+ * @param adapter - the adapter that streams calls for those providers.
727
+ * @returns the disposer, carrying {@link AdapterRegistrationHandle.replace}.
728
+ */
729
+ registerAdapter(providers: string[], adapter: LlmAdapter): AdapterRegistrationHandle
730
+
731
+ /**
732
+ * Describe provider routes with a registered adapter.
733
+ * @returns detached provider metadata in registration order.
734
+ */
735
+ listProviders(): LlmProviderInfo[]
736
+
737
+ /**
738
+ * Declare provider routes an adapter plugin can activate through
739
+ * configuration. Registration is all-or-nothing: an empty list, invalid
740
+ * entry, or a provider already declared by any registration throws
741
+ * `LlmError` without registering the rest. Disposed with the fiber.
742
+ * @param entries - every configurable provider this plugin owns.
743
+ * @returns a handle that withdraws all of them, and can atomically replace them.
744
+ */
745
+ registerConfigurableProviders(entries: readonly LlmConfigurableProvider[]): DirectoryRegistrationHandle
746
+
747
+ /**
748
+ * List every declared configurable provider, registered or dormant.
749
+ * @returns detached directory entries in declaration order.
750
+ */
751
+ listConfigurableProviders(): LlmConfigurableProvider[]
752
+
753
+ /**
754
+ * Offer to interrogate provider endpoints on behalf of the settings
755
+ * namespace this plugin owns. The namespace is the key because that is what
756
+ * a configuration surface already holds from the configurable-provider
757
+ * directory, and because a provider being *added* has no route to name yet.
758
+ * Disposed with the fiber.
759
+ * @param settingsNs - the namespace whose profiles this discovery serves.
760
+ * @param discover - interrogates one endpoint; must honor `request.signal`.
761
+ * @returns the disposer that withdraws the offer.
762
+ */
763
+ registerModelDiscovery( settingsNs: string, discover: (request: LlmModelDiscoveryRequest) => Promise<readonly LlmDiscoveredModel[]>, ): () => void
764
+
765
+ /**
766
+ * Interrogate one provider endpoint for the models it advertises. The
767
+ * request describes a draft, not a stored route, so nothing here reads or
768
+ * writes settings or credentials — the caller owns both, and the reply is
769
+ * candidate metadata a surface may offer for adoption.
770
+ * @param settingsNs - namespace whose registered discovery serves this draft.
771
+ * @param request - the endpoint, protocol, and one-shot credential to use.
772
+ * @returns the advertised models, deduplicated in endpoint order.
773
+ */
774
+ async discoverModels( settingsNs: string, request: LlmModelDiscoveryRequest, ): Promise<LlmDiscoveredModel[]>
775
+
776
+ /**
777
+ * Resolve the retry policy captured when one provider route was registered.
778
+ * @param provider - registered provider route to inspect.
779
+ * @returns the provider-owned policy, with normal defaults already resolved.
780
+ */
781
+ providerRetryPolicy(provider: string): ResolvedRetryPolicy
782
+
783
+ /**
784
+ * Discover models advertised by one registered provider. Catalog membership
785
+ * is advisory and never changes routing or request validation.
786
+ * @param provider - registered provider route to inspect.
787
+ * @returns detached model metadata in adapter-preferred order.
788
+ */
789
+ async listModels(provider: string): Promise<LlmModelInfo[]>
790
+
791
+ /**
792
+ * Resolve and validate all metadata from the adapter that owns one exact
793
+ * route. The result is detached from adapter-owned objects; catalog
794
+ * membership remains advisory and does not control request routing.
795
+ * @param provider - registered provider route to inspect.
796
+ * @param model - exact model id passed to the adapter.
797
+ * @param signal - optional cancellation for adapter-owned asynchronous lookup.
798
+ * @returns exact model identity plus available context and reasoning metadata.
799
+ */
800
+ async resolveModelInfo( provider: string, model: string, signal?: AbortSignal, ): Promise<LlmResolvedModelInfo>
801
+
802
+ /**
803
+ * Validate a conversation call config against its exact model capability and
804
+ * materialize adapter-configured defaults. Unsupported explicit efforts
805
+ * reject before provider I/O; no clamping or aliasing is performed. This
806
+ * standalone query does not bind a later dispatch; use {@link prepareCall}
807
+ * when logging and streaming must share one adapter registration.
808
+ * @param config - provider/model route and optional request controls.
809
+ * @param signal - optional cancellation for adapter-owned capability lookup.
810
+ * @returns a detached config only when a default must be materialized.
811
+ */
812
+ async resolveCallConfig(config: LlmCallConfig, signal?: AbortSignal): Promise<LlmCallConfig>
813
+
814
+ /**
815
+ * Resolve one call under its current adapter registration. The returned
816
+ * one-shot handle keeps that registration across header logging and dispatch,
817
+ * so HMR cannot combine one adapter's capability result with another adapter.
818
+ * @param config - provider/model route and optional request controls.
819
+ * @param signal - optional cancellation for adapter-owned capability lookup.
820
+ * @returns a prepared config and its registration-bound stream entry point.
821
+ */
822
+ async prepareCall(config: LlmCallConfig, signal?: AbortSignal): Promise<PreparedLlmCall>
823
+
824
+ /**
825
+ * Stream one model call as raw chunks (token-level deltas). Replay state is
826
+ * retained only when the same adapter instance owns its historical provider
827
+ * and the target provider. Final adapter selection remains fixed through
828
+ * asynchronous exact-model resolution and dispatch. Adapter selection,
829
+ * dispatch, and iteration failures become terminal `error` or `aborted`
830
+ * finish chunks; middleware, nested-call, cleanup, and consumer failures
831
+ * remain thrown.
832
+ * @param options - the full request; `options.provider` selects the adapter.
833
+ * @returns the chunk stream, possibly wrapped by `llm/stream` listeners.
834
+ */
835
+ stream(options: GenerateOptions): AsyncIterable<StreamChunk>
836
+ ```
837
+
838
+ Source: [`packages/llm/llm/src/index.ts:284`](../../packages/llm/llm/src/index.ts)
839
+
840
+ <a id="llm-events"></a>
841
+
842
+ ### `llm/*` events
843
+
844
+ <a id="llmadapters-updated--emit"></a>
845
+
846
+ #### `llm/adapters-updated` — emit
847
+
848
+ The provider topology changed: an adapter registered or unregistered routes, or the configurable-provider directory gained or lost entries. This payload-free registry notification fires at each commit point (including registration disposal); consumers re-read `listProviders()`, `listModels()`, or `listConfigurableProviders()` for the new state. Observer failures are contained and cannot veto the registry mutation.
849
+
850
+ ```ts cordis-catalog
851
+ /**
852
+ * The provider topology changed: an adapter registered or unregistered
853
+ * routes, or the configurable-provider directory gained or lost entries.
854
+ * This payload-free registry notification fires at each commit point
855
+ * (including registration disposal); consumers re-read `listProviders()`,
856
+ * `listModels()`, or `listConfigurableProviders()` for the new state.
857
+ * Observer failures are contained and cannot veto the registry mutation.
858
+ * @mode emit
859
+ */
860
+ 'llm/adapters-updated'(): void
861
+ ```
862
+
863
+ Source: [`packages/llm/llm/src/types.ts:23`](../../packages/llm/llm/src/types.ts)
864
+
865
+ <a id="llmstream--waterfall"></a>
866
+
867
+ #### `llm/stream` — waterfall
868
+
869
+ Waterfall around every streaming model call (retry, replay, routing). Bound to the LlmRuntime; call `next()` to reach the resolved adapter's stream, or yield your own chunks to short-circuit.
870
+
871
+ ```ts cordis-catalog
872
+ /**
873
+ * Waterfall around every streaming model call (retry, replay, routing).
874
+ * Bound to the {@link LlmRuntime}; call `next()` to reach the resolved
875
+ * adapter's stream, or yield your own chunks to short-circuit.
876
+ * @param options - the full request. A LOOP-built request carries the
877
+ * process-local {@link markAgentLoopRequest} identity and arrives deep-frozen
878
+ * (mutation throws): its content is a pure function of the session log (the
879
+ * reconstructability Agent Note), so listeners read it, never rewrite it.
880
+ * Hand-built calls do not carry that marker; their messages already obey
881
+ * the immutable creation contract.
882
+ * @mode waterfall
883
+ */
884
+ 'llm/stream'(this: LlmRuntime, options: GenerateOptions, next: () => AsyncIterable<StreamChunk>): AsyncIterable<StreamChunk>
885
+ ```
886
+
887
+ Source: [`packages/llm/llm/src/index.ts:64`](../../packages/llm/llm/src/index.ts)
888
+ <!-- END GENERATED cordis-surface -->