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,720 @@
1
+ # 工具
2
+
3
+ [English](tools.md) | 中文
4
+
5
+ [dsh-tools](../../packages/core/tools) 的工具流水线。[core.md](core.md) 介绍了核心包共用、用于编写流水线的类型 `ToolDefinition`;面向模型的 [`ToolSchema`](llm-streaming.md#the-model-request-and-result) 协议类型与模型请求一起声明。本页记录 `ToolDefinition` 的每个字段、用于构建它的类型化 schema DSL、带守卫的执行类型和 UI 展示类型。
6
+
7
+ 源码:[`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts) · [`packages/core/tools/src/schema.ts`](../../packages/core/tools/src/schema.ts) · [`packages/core/tools/src/presentation.ts`](../../packages/core/tools/src/presentation.ts)
8
+
9
+ ## `ToolDefinition` — 一个已注册的工具
10
+
11
+ 由一个 `ToolSchema`(面向模型的字段)、必需的规范输出声明、`execute` 函数、仅供宿主使用的调度器元数据、可选的最终内容回调和可选 UI 展示函数组成。注册表持有这些定义,循环通过它们分派调用。注册表的 `schemas()` 通过显式允许列表构建面向模型的 `ToolSchema[]`;`output`/`execute`/`finalizeContent`/`timeoutMs`/`isConcurrencySafe`/`presentCall`/`presentResult` 绝不能泄漏到模型请求中。
12
+
13
+ ```ts type-equiv
14
+ /** Tool-owned canonical output contract used after the body returns a JSON value. */
15
+ interface ToolOutputDefinition {
16
+ /** Raw supported JSON Schema enforced against every successful canonical value. */
17
+ readonly schema: JsonSchemaNode
18
+ /** Pure projection from validated arguments and value to Native/model content. */
19
+ render(args: unknown, value: JsonValue): ContentBlock[]
20
+ /** Pure replayable presentation projection, computed only for top-level calls. */
21
+ presentationMeta?(args: unknown, value: JsonValue): JsonValue
22
+ }
23
+ ```
24
+
25
+ ```ts type-equiv
26
+ /** A registered tool: its schema plus the execution function. */
27
+ interface ToolDefinition extends ToolSchema {
28
+ /** Mandatory canonical output declaration. */
29
+ readonly output: ToolOutputDefinition
30
+ /**
31
+ * Run one accepted call and return only its canonical lossless-JSON value.
32
+ * Async work must observe or forward `exec.signal` and settle only after its
33
+ * owned work reaches quiescence. The registry preserves caller cancellation
34
+ * through around-dispatch signal replacement and does not abandon this
35
+ * promise, but it cannot hard-kill same-process code.
36
+ * @param args - losslessly snapshotted, frozen model arguments.
37
+ * @param exec - execution identity, cancellation signal, and context deferral.
38
+ * @returns the canonical value declared by `output.schema`.
39
+ */
40
+ execute(args: unknown, exec: ToolRunContext): Promise<unknown>
41
+ /**
42
+ * Synchronous last-mile transform for model-facing content. The registry
43
+ * snapshots this callback when execution starts and invokes it exactly once
44
+ * for every normalized outcome, including pipeline failures that bypass
45
+ * `tools/post-execute`, immediately before lossless materialization.
46
+ * Returning `undefined` preserves the content; every other result field
47
+ * remains registry-owned. The callback must be total and must not throw.
48
+ * @param exec - immutable execution identity and arguments.
49
+ * @param result - complete normalized outcome before materialization.
50
+ * @returns replacement content, or `undefined` to preserve it.
51
+ */
52
+ finalizeContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
53
+ /**
54
+ * Cooperative tool-call timeout budget in milliseconds. Omit for no deadline.
55
+ * Enforced by `@deepseek-ai/dsh-tool-call-timeout-policy` (a `tools/execute` wrapper); it
56
+ * is NEVER sent to the model — `schemas()` whitelists only name/description/
57
+ * parameters. Declaring it asserts this tool forwards `exec.signal` to a
58
+ * cooperative implementation that can reach quiescence when the signal aborts.
59
+ */
60
+ timeoutMs?: number
61
+ /**
62
+ * Pure synchronous classifier for overlap with sibling tool calls. Only
63
+ * `true` opts in; omission, exceptions, non-`true` returns, and invalid
64
+ * `defineTool` arguments are exclusive. This metadata is never model-visible.
65
+ *
66
+ * Opted-in executions must not mutate parent-owned state. Shared state must
67
+ * tolerate concurrent dispatch; recorder races are permitted only when they
68
+ * commute or fail closed. See the
69
+ * [parallel-tool-call Agent Note](../../../../.agents/notes/implemented/feature/2026-07-10-parallel-tool-call-execution.md)
70
+ * for the full contract.
71
+ * @param args - parsed arguments; `defineTool` validates before calling.
72
+ * @returns Whether this call may join a parallel group.
73
+ */
74
+ isConcurrencySafe?(args: unknown): boolean
75
+ /**
76
+ * Optional: how to present the PENDING state of one call in a UI, derived from
77
+ * the call's `args` (parsed arguments, `unknown` — the tool validates/narrows
78
+ * its own input). Returns a {@link ToolCallView} (a `card`-tagged render intent),
79
+ * or `undefined` (or omit the method) to fall back to a generic presentation
80
+ * (title = tool name, raw args as input). Pure and side-effect-free: a UI may
81
+ * call it during live streaming AND a session-log replay, so it must depend
82
+ * only on `args`.
83
+ */
84
+ presentCall?(args: unknown): ToolCallView | undefined
85
+ /**
86
+ * Optional: how to present the COMPLETED state, given the same `args` and the
87
+ * durable result projection (`content`, failure state, and optional `meta`). Returns a
88
+ * {@link ToolResultView}, or `undefined` (or omit the method) to keep the
89
+ * pending title and render the raw result content. Pure and side-effect-free
90
+ * for the same replay reason.
91
+ */
92
+ presentResult?(args: unknown, result: ToolResult): ToolResultView | undefined
93
+ }
94
+ ```
95
+
96
+ `execute` 接收 `args: unknown`——原始的 `ToolDefinition` 自行校验输入。第一方工具不需要手写校验;它们使用 `defineTool`,由后者代为校验并收窄参数类型、根据 `output.schema` 推导函数体返回类型,并为两个输出投影器提供类型约束。`finalizeContent` 特意接收不可变的执行对象而非类型化参数,因为无效输入和外层流水线失败也会到达该回调;它可以施加工具自有的内容限制,同时保留 `isError`、规范值、结构化错误身份、延迟上下文与展示元数据。
97
+
98
+ ## 统一的 JSON 值 schema DSL
99
+
100
+ 插件作者使用同一套词汇描述类型化参数和类型化输出值。`ValueSchemaSpec` 支持 `string`、`number`、`integer`、`boolean`、`null`、`array`、`object`、仅作者侧可用的 `json`,以及要求恰好命中一个分支的 `oneOf`;标量 `enum` 和 `const` 值必须与节点类型匹配。显式对象节点始终声明 `additionalProperties: true | false`。参数定义仍是隐式的开放对象属性映射,每个必填属性都附带 `required: true`。
101
+
102
+ 源码:[`packages/core/tools/src/schema.ts`](../../packages/core/tools/src/schema.ts)
103
+
104
+ ```ts type-equiv
105
+ /** One author-facing schema for any lossless JSON value root. */
106
+ type ValueSchemaSpec =
107
+ | StringValueSchemaSpec
108
+ | NumberValueSchemaSpec
109
+ | IntegerValueSchemaSpec
110
+ | BooleanValueSchemaSpec
111
+ | NullValueSchemaSpec
112
+ | ArrayValueSchemaSpec
113
+ | ObjectValueSchemaSpec
114
+ | JsonValueSchemaSpec
115
+ | OneOfValueSchemaSpec
116
+ ```
117
+
118
+ ```ts type-equiv
119
+ /** One implicit parameter-root property, optionally required. */
120
+ type ParameterPropertySpec = ValueSchemaSpec & { required?: true }
121
+ ```
122
+
123
+ ```ts type-equiv
124
+ /**
125
+ * Tool parameter schema. The map itself is an implicit open object root;
126
+ * requiredness remains a per-property `required: true` annotation.
127
+ */
128
+ type ParameterSchemaSpec = {
129
+ [key: string]: ParameterPropertySpec
130
+ [key: symbol]: never
131
+ }
132
+ ```
133
+
134
+ `{ type: 'json' }` 推导为 `JsonValue`,并编译成仅含注解、不施加约束的原始 schema。输出根可以是对象、数组、标量或 null。`InferValue<S>` 在 16 层容器内保留字面量约束与对象开放性,之后回退为 `JsonValue`,避免耗尽 TypeScript 的类型实例化栈。`InferArgs<P>` 依据逐属性的必填标记生成必填和可选的字符串键:
135
+
136
+ ```ts type-equiv
137
+ /**
138
+ * Infer the TypeScript value accepted by an author-facing value schema. Exact
139
+ * inference is bounded to 16 container levels, then falls back to `JsonValue`.
140
+ */
141
+ type InferValue<S> = InferValueAt<S, []>
142
+ ```
143
+
144
+ ```ts type-equiv
145
+ /** Infer the TypeScript argument object for an implicit parameter schema. */
146
+ type InferArgs<S> = InferProperties<S, []>
147
+ ```
148
+
149
+ `defineTool({ name, description, parameters, output, execute, … })` 将参数推导与 `parameterSchemaSpecToJsonSchema()` 和 `validateArgs()` 绑定,并将 `execute`/`render`/`presentationMeta` 与 `InferValue<OutputSchema>` 绑定。schema 记录只包含自有且可枚举的字符串键,schema 数组是稠密的内建数组,因此推导、编译与校验观察到的是同一份声明。精确推导保持到 16 层容器,之后放宽为 `JsonValue`;运行时校验仍会继续遍历完整 schema。`valueSchemaSpecToJsonSchema()` 通过同一套已强制执行的原始子集编译输出声明。参数不匹配时抛出 `ToolArgsError`(`INVALID_ARGS`);函数体或后置策略产生的值无效时抛出 `ToolOutputError`(`INVALID_TOOL_OUTPUT`)。两者都经由常规工具错误路径处理。原始 JSON Schema 默认保持开放;不支持的关键字会被拒绝,而不会在未强制执行的情况下获准进入。
150
+
151
+ 注册是一项受信任的同进程约定。注册表以 readonly 输入借用已类型化定义,要求它声明 `output`,校验其原始 schema,并检查 `timeoutMs` 必须为正有限值等语义要求;`schemas()` 在构建请求时生成面向模型的投影,使执行和展示共享同一份已解析定义,而不会将回调泄漏到协议上。
152
+
153
+ ## `ToolRestriction` — 单个作用域对其继承内容的实时过滤器
154
+
155
+ `ToolRestriction` 作用于该作用域继承来的工具:部署全局层,加上其链上的每个祖先作用域。注册表将 readonly 名称编译为私有集合,对多个限制取交集,再叠加该作用域**自身**的注册——后者不受约束,因此被委派的子 agent 会保留其回报所依赖的工具。仅 deny 的过滤器允许后续未列出的继承工具通过,而 allow 列表则排除它们。
156
+
157
+ ```ts type-equiv
158
+ /**
159
+ * Per-scope filter over global tools. Restrictions intersect and do not affect
160
+ * scoped registrations or the reserved Code Mode transport.
161
+ */
162
+ interface ToolRestriction {
163
+ /** Global tool names that stay visible; everything else is removed. */
164
+ readonly allow?: readonly string[]
165
+ /** Global tool names removed from visibility. */
166
+ readonly deny?: readonly string[]
167
+ }
168
+ ```
169
+
170
+ ## 执行:可扩展的 waterfall(瀑布式事件)加单调策略
171
+
172
+ `ctx.tools.execute()` 接受由调用方拥有且包含必需 readonly `signal` 的 `ToolExecutionInput`,将其解析后的 JSON 参数一次性物化为流水线拥有的 `ToolExecution`,然后让调用依次经过 `tools/pre-execute`(可重排的 allow/deny/ask waterfall)→ 已注册的单调 guard → `tools/execute`(环绕分派包装层)→ `tools/post-execute`(检查/替换结果)→ 可选且由定义拥有的 `finalizeContent` → `tools/result`(不可变的权威结果)。只有 `tools/execute` 视图可以替换必需的 signal。最终产出为 `ToolExecutionResult`。
173
+
174
+ ```ts type-equiv
175
+ /** Opaque call identity that permits correlation without exposing mutable execution state. */
176
+ type ToolExecutionToken = symbol & { readonly [toolExecutionTokenBrand]: true }
177
+ ```
178
+
179
+ ```ts type-equiv
180
+ /**
181
+ * Caller-supplied description of one tool call. {@link ToolRuntime.execute}
182
+ * adds the registry-owned token to form a pipeline {@link ToolExecution};
183
+ * callers do not choose that token.
184
+ */
185
+ interface ToolExecutionInput {
186
+ readonly callId: CallId
187
+ /**
188
+ * Root model-requested call owning this execution tree. Callers omit it for
189
+ * a root execution; nested dispatchers propagate the enclosing value.
190
+ */
191
+ readonly rootCallId?: CallId
192
+ readonly name: string
193
+ /** Losslessly JSON-serializable parsed arguments (tools validate their own schema). */
194
+ readonly arguments: unknown
195
+ /** The agent on whose behalf the call runs (set by the agent loop). */
196
+ readonly agent?: Agent
197
+ /**
198
+ * Opaque token of the enclosing transport execution, when one exists. Code
199
+ * Mode sets this on SDK sub-dispatches so commit-style observers can wait for
200
+ * the outer `run_code` outcome without receiving its live mutable execution.
201
+ * The token also marks the call as a transport sub-dispatch rather than a
202
+ * model-direct call: under `mode: 'code'`, only calls WITH a parent may
203
+ * execute a native tool name — a model-direct call (no parent) is denied as
204
+ * `UNKNOWN_TOOL` before the policy pipeline. See {@link ToolRuntime.execute}.
205
+ */
206
+ readonly parent?: ToolExecutionToken
207
+ /** Required caller-owned cancellation for this invocation. */
208
+ readonly signal: AbortSignal
209
+ }
210
+ ```
211
+
212
+ 工具函数体接收运行时扩展。`deferContext()` 把上下文附着到本次执行自己的结果上——既是组合工具转运嵌套分派上下文的通道,也可供叶子工具铸造插件来源指令——而不会在外层调用尚未结束时注入这些上下文。
213
+
214
+ ```ts type-equiv
215
+ /**
216
+ * Runtime context handed to a tool implementation after the registry has
217
+ * accepted a {@link ToolExecution}. {@link deferContext} attaches context to
218
+ * this execution's own result — a composite tool ferries nested-dispatch
219
+ * context back to the outer result, and a leaf tool may mint a fresh
220
+ * plugin-sourced instruction; the loop appends it only after the
221
+ * `tool/result`.
222
+ */
223
+ interface ToolRunContext extends ToolExecution {
224
+ /**
225
+ * Defer one context — typically a nested-dispatch context ferried by a
226
+ * composite tool, or a fresh plugin-sourced instruction — until this tool's
227
+ * final result reaches the agent loop. Contexts retain their individual
228
+ * source and metadata and are emitted in call order.
229
+ */
230
+ deferContext(context: UserMessage): void
231
+ /**
232
+ * Mark a successful final result as terminal for the current agent turn.
233
+ * The marker rides this execution's own result (`concludesTurn` exists only
234
+ * on {@link ToolExecutionSuccess}); a composite that dispatches nested
235
+ * calls forwards it from the nested result, exactly like
236
+ * `additionalContexts`, so only an authoritative nested success can
237
+ * conclude the enclosing run.
238
+ */
239
+ concludeTurn(): void
240
+ }
241
+ ```
242
+
243
+ agent loop(智能体循环)向注册表查询每个待处理调用的执行模式,并据此形成独占屏障和滚动池并行执行:
244
+
245
+ ```ts type-equiv
246
+ /**
247
+ * Scheduling mode for one pending call. `parallel` may overlap with siblings;
248
+ * `exclusive` runs alone and forms an ordering barrier.
249
+ */
250
+ type ToolExecutionMode =
251
+ | { kind: 'parallel' }
252
+ | { kind: 'exclusive' }
253
+ ```
254
+
255
+ Code Mode 的桥接层还会把每个已结算的子分派暴露给 `tools/code-dispatch-log` waterfall,该 waterfall 可以更改持久事件所存的内容副本(程序取得的值和模型可见结果均不受影响):
256
+
257
+ ```ts type-equiv
258
+ /**
259
+ * One settled `run_code` sub-dispatch about to be logged, as seen by the
260
+ * `tools/code-dispatch-log` waterfall: the parent execution (session owner,
261
+ * outer call identity), the sub-call identity, and the outcome whose durable
262
+ * copy a listener may reshape. `content` is the RENDERED result projection
263
+ * (what a native `tool/result` would carry) — the program itself received
264
+ * the structured `value` (or just the error message on failure); only the
265
+ * `tool/code-dispatch` event's copy changes.
266
+ */
267
+ interface CodeDispatchLog {
268
+ /** The outer `run_code` execution. */
269
+ readonly exec: ToolExecution
270
+ /** The calling agent (the scope routing key and the spill owner), when the outer call has one. */
271
+ readonly agent?: Agent
272
+ /** Deterministic sub-call id (`<parent>:code:<n>`). */
273
+ readonly subCallId: CallId
274
+ /** The dispatched sub-tool name. */
275
+ readonly name: string
276
+ /** Whether the sub-call settled as an error. */
277
+ readonly isError: boolean
278
+ /** The sub-call's complete model-facing content (the settle event's default payload). */
279
+ readonly content: ContentBlock[]
280
+ }
281
+ ```
282
+
283
+ ```ts type-equiv
284
+ /**
285
+ * One pending tool call inside the registry pipeline. Parsed arguments cross
286
+ * one lossless-JSON materialization boundary before policy and are deep-frozen;
287
+ * call identity, the caller signal, and the registry-assigned {@link token} are
288
+ * readonly. The registry freezes the complete object before `tools/result`
289
+ * observers run.
290
+ */
291
+ interface ToolExecution extends ToolExecutionInput {
292
+ /** Root model-requested call, resolved for every root and nested execution. */
293
+ readonly rootCallId: CallId
294
+ /** Registry-assigned identity shared with nested calls only as their opaque `parent` token. */
295
+ readonly token: ToolExecutionToken
296
+ }
297
+ ```
298
+
299
+ ```ts type-equiv
300
+ /**
301
+ * Around-dispatch view of a {@link ToolExecution}. A `tools/execute` wrapper
302
+ * may replace the signal for its delegated lifetime, but it cannot remove it.
303
+ * The registry fuses every replacement with the captured caller signal.
304
+ */
305
+ interface ToolDispatchExecution extends Omit<ToolExecution, 'signal'> {
306
+ /** Cancellation signal visible to the next wrapper or tool body. */
307
+ signal: AbortSignal
308
+ }
309
+ ```
310
+
311
+ `ToolExecutionToken` 是不透明的运行时 `Symbol`,仅用于身份比较。策略执行前,`execute()` 会物化并冻结参数、拒绝非 JSON 输入并分配 token。身份字段、调用方必需的 signal 和可选的 parent token 均保持 readonly。`ToolDispatchExecution` 包装层可以替换 signal 但不能移除;注册表会在调用工具函数体前重新融合调用方的 signal。最终观察者接收冻结的执行身份。
312
+
313
+ `ToolGuard` 是感知作用域的最终预分派策略。其返回类型有意不包含 allow 结果:`undefined` 保留 waterfall 的决策,而返回的 reason 只能缩减权限,因此后续监听器无法撤销它。
314
+
315
+ ```ts type-equiv
316
+ /**
317
+ * A monotonic execution guard evaluated after every `tools/pre-execute`
318
+ * listener and before the tool body. Returning a reason denies the call;
319
+ * returning `undefined` leaves it unchanged. Because guards have no allow
320
+ * result, listener ordering cannot turn a denial back into permission.
321
+ * @param execution - the identity-protected call after extensible pre-execute policy completed.
322
+ * @returns a final denial reason, or `undefined` to leave the call allowed.
323
+ */
324
+ type ToolGuard = (execution: Readonly<ToolExecution>) => string | undefined
325
+ ```
326
+
327
+ ```ts type-equiv
328
+ /** Canonical failure detail; internal routing information remains optional. */
329
+ interface ToolFailure {
330
+ /** Human-readable failure message without the Native `Error: ` envelope. */
331
+ message: string
332
+ /** Internal error class/code used by policy and durable diagnostics. */
333
+ info?: ToolErrorInfo
334
+ }
335
+ ```
336
+
337
+ ```ts type-equiv
338
+ /** Successful canonical tool execution, including its Native/model projection. */
339
+ interface ToolExecutionSuccess {
340
+ readonly isError: false
341
+ /** Execution-local canonical value; deliberately omitted from durable events. */
342
+ readonly value: JsonValue
343
+ readonly content: ContentBlock[]
344
+ readonly error?: never
345
+ readonly meta?: JsonValue
346
+ readonly additionalContexts?: UserMessage[]
347
+ /** The agent loop stops after committing this successful result batch. */
348
+ readonly concludesTurn?: true
349
+ }
350
+ ```
351
+
352
+ ```ts type-equiv
353
+ /** Failed canonical tool execution; failures never carry a successful value. */
354
+ interface ToolExecutionFailure {
355
+ readonly isError: true
356
+ readonly error: ToolFailure
357
+ readonly value?: never
358
+ readonly content: ContentBlock[]
359
+ readonly meta?: JsonValue
360
+ readonly additionalContexts?: UserMessage[]
361
+ readonly concludesTurn?: never
362
+ }
363
+ ```
364
+
365
+ ```ts type-equiv
366
+ /** The discriminated, execution-local outcome of one tool call. */
367
+ type ToolExecutionResult = ToolExecutionSuccess | ToolExecutionFailure
368
+ ```
369
+
370
+ 结果仅承载产出。调用身份保留在不可变的 `ToolExecution` 上,后者伴随结果经过每个钩子,并出现在持久化的 `tool/call` / `tool/result` 会话事件上,因此包装层无法创建第二个相互矛盾的身份。规范的 `value` 仅存在于执行期间:循环只持久化 `content`、`error` 和 `meta`,`tool/code-dispatch` 则原样存储子调用渲染后的 `content` 与 `isError`。回放可以重现展示,却无法重建规范的中间值。
371
+
372
+ 成功时,注册表会快照并校验函数体返回值,将其冻结,然后调用纯渲染器;对于直接的外层调用,还会调用可选的元数据投影器。注册表会在 `tools/result` 之前另行物化持久展示字段;无效值、渲染器/投影器失败或非 JSON 展示都会转为 JSON 安全的 `isError`。因此,最终实时观察者能看到精确的执行期值,以及可安全用于后续持久追加的字段。
373
+
374
+ 在得到最终内容之前,注册表会物化候选结果;若内容、结构化错误、附加上下文或展示元数据无法物化,则会转为仍可到达 `finalizeContent` 的 JSON 安全 `isError` 结果。注册表恰好调用该回调一次,随后在 `tools/result` 之前立即物化并冻结已接受的结果,因此实时观察到的产出可安全用于后续持久化的 `tool/result` 追加。
375
+
376
+ 每个拦截 waterfall 返回一个类型化的 **Decision**(与 `agent/*` waterfall 共享的惯用模式)。`tools/pre-execute` 监听器接收 `(exec, next)` 并返回 `PreToolDecision`;`tools/execute` 包装层返回 `ToolExecutionResult`;`tools/post-execute` 监听器接收 `(exec, result, next)` 并返回 `PostToolDecision`:
377
+
378
+ ```ts type-equiv
379
+ /**
380
+ * Pre-dispatch decision. `allow` runs the call; `deny` materializes an error;
381
+ * `ask` runs only after an approval service returns `allowed-once` and otherwise
382
+ * denies. Input rewriting is excluded because arguments are already logged and
383
+ * presented.
384
+ */
385
+ type PreToolDecision =
386
+ | { kind: 'allow' }
387
+ | { kind: 'deny'; reason: string }
388
+ | { kind: 'ask'; reason?: string }
389
+ ```
390
+
391
+ ```ts type-equiv
392
+ /**
393
+ * Post-dispatch decision: accept, replace one projection, attach context for the
394
+ * next request, or block by turning corrective feedback into an error result.
395
+ */
396
+ type PostToolDecision =
397
+ | { kind: 'accept'; content?: ContentBlock[]; value?: never; additionalContexts?: UserMessage[] }
398
+ | { kind: 'accept'; value: JsonValue; content?: never; additionalContexts?: UserMessage[] }
399
+ | { kind: 'block'; feedback: ContentBlock[]; additionalContexts?: UserMessage[] }
400
+ ```
401
+
402
+ 调用 `next()` 获取默认决策,或直接返回一个决策以短路。前置策略可以 deny 或 ask;只有 `allowed-once` 才继续执行,而未授权、缺少审批通道或服务、或无 agent 的请求都会变为拒绝。Guard 仍可施加最终拒绝。参数不可被改写,因为历史记录、审计、UI 和执行必须保持一致。
403
+
404
+ 后置策略可以替换内容或值,但不能同时替换两者。替换内容会保留规范值和现有元数据;替换值会重新校验并重新计算内容/元数据;阻止会移除值,并转为包含纠正反馈的 `isError`。内容替换是展示策略,而非保密策略;需要隐藏程序化值的监听器必须阻止或替换该值。`tools/result` 在归一化后接收冻结的执行和结果;观察者无法对其进行变换,观察者的失败也会被隔离。未知工具和抛出异常的工具都会变为结构化错误(`ToolNotFoundError` 映射为 `UNKNOWN_TOOL`),调用失败但不终止当前轮次。
405
+
406
+ ## 已强制执行的原始 JSON Schema 子集
407
+
408
+ subagent、工作流、MCP 和动态注册提供的原始 schema 使用作者侧 DSL 在协议层的对应表示。`assertSupportedJsonSchema()` 接受任意 JSON 根,`validateJsonSchemaValue()` 强制执行该 schema,`JsonSchemaError` 则报告每条不受支持或格式错误的 schema 路径。仅含注解的空节点表示不受约束的无损 JSON。`oneOf` 至少要求两个分支,且一个值必须恰好匹配其中一个。仍要求对象根的消费方调用 `assertObjectJsonSchema()` 并携带 `ObjectJsonSchema`;这样,subagent/工作流中由调用方定义的结构化输出可以继续以对象为根,而不会限制共享词汇。
409
+
410
+ ```ts type-equiv
411
+ /** Scalar JSON values supported by `enum` and `const`. */
412
+ type JsonSchemaScalar = string | number | boolean | null
413
+ ```
414
+
415
+ ```ts type-equiv
416
+ /** Single-type keywords accepted by the enforced subset. */
417
+ type JsonSchemaType = 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null'
418
+ ```
419
+
420
+ ```ts type-equiv
421
+ /**
422
+ * One raw JSON Schema node in the enforced subset. The optional fields express
423
+ * the external wire schema; {@link assertSupportedJsonSchema} rejects invalid
424
+ * combinations before a caller treats the node as trusted.
425
+ */
426
+ interface JsonSchemaNode {
427
+ /** Omit with no constraints for any JSON value, or use `oneOf`. */
428
+ type?: JsonSchemaType
429
+ /** Exactly one branch must validate; at least two branches are required. */
430
+ oneOf?: JsonSchemaNode[]
431
+ /** Nested property schemas (`type: 'object'` only). */
432
+ properties?: Record<string, JsonSchemaNode>
433
+ /** Required property names; each must appear in `properties`. */
434
+ required?: string[]
435
+ /** `false` rejects undeclared keys; absent/`true` follows JSON Schema's open default. */
436
+ additionalProperties?: boolean
437
+ /** Item schema (`type: 'array'` only); absent accepts any JSON item. */
438
+ items?: JsonSchemaNode
439
+ /** Allowed values for a scalar node. */
440
+ enum?: JsonSchemaScalar[]
441
+ /** The single allowed value for a scalar node. */
442
+ const?: JsonSchemaScalar
443
+ /** Annotation, ignored for validation. */
444
+ description?: string
445
+ /** Annotation, ignored for validation. */
446
+ title?: string
447
+ /** Annotation, ignored for validation but required to be lossless JSON. */
448
+ default?: JsonValue
449
+ /** Annotation, ignored for validation but required to be lossless JSON. */
450
+ examples?: JsonValue
451
+ }
452
+ ```
453
+
454
+ ```ts type-equiv
455
+ /** A consumer-constrained object-rooted schema. */
456
+ type ObjectJsonSchema = JsonSchemaNode & { type: 'object' }
457
+ ```
458
+
459
+ ## 工具展示 UI 词汇
460
+
461
+ 工具希望其调用在 UI 中如何呈现(编辑器工具调用卡片、CLI(命令行界面)日志行),提供方无关,使工具在不依赖任何客户端协议的情况下描述自身。`presentCall`/`presentResult` 返回一个 **`card` 标签的渲染意图**——一个可辨识联合类型,UI 桥接层据此分发:
462
+
463
+ - `ToolCallView`(待执行):`{ card: 'generic', title, kind?, rawInput?, content?, locations? }`(默认卡片;`locations` 是 `{ path, line? }[]`,表示调用读取/修改的文件,供编辑器跟随)、`{ card: 'terminal', title, description?, cwd? }`(shell 命令→终端卡片)、或 `{ card: 'diff', title, diffs, locations? }`(文件创建/修改→行内 diff 卡片;`diffs` 是 `{ path, oldText, newText }[]`,新文件时 `oldText: null`)。
464
+ - `ToolResultView`(已完成):`{ card: 'generic', title?, content? }`、`{ card: 'terminal', title?, output?, exitCode?, signal? }`(捕获的运行输出 + 退出状态;有能力的 UI 显示退出状态标签,其他 UI 可以派生围栏 ` ```console ` 回退)、`{ card: 'diff', title?, diffs }`(已完成的文件变更→要展示的变更,通常是从变更前后内容计算出带上下文行的已应用 hunk,或在没有前像时的整文件 diff)、`{ card: 'search', shape, title?, truncated, total, … }`(已完成的发现型搜索→`shape: 'matches'`(grep)为按文件分组的匹配,`shape: 'paths'`(glob)为扁平路径列表;`truncated`/`total` 报告内联结果是否被截断,使 UI 永不把部分结果当作完整结果呈现;该视图不携带结果文本——无 search 卡片的 UI 回退到原始结果内容)、`{ card: 'read', title?, path, offset, lines, totalLines, lang?, content? }`(已完成的文件读取→带行号、可选语法高亮的代码视图;`offset` 是窗口请求的 1-based 起始行,即使 `lines` 为空也保留;`lang` 是从扩展名推得的语言提示,`content` 是无读取能力的 UI 回退时使用的去信封文本)、或 `{ card: 'web', kind: 'search' | 'fetch', title?, … }`(已完成的 web 检索;`kind: 'search'` 携带结构化的 `sources`/`answer?`/`truncated`,`kind: 'fetch'` 携带 `url`/`statusCode`/`truncated`,不具备 `web` 能力的 UI 回退到原始结果内容——正文不会重复进视图)。已完成视图会替换待执行视图,因此变更工具即使与调用时的片段重复也要返回 diff 结果;搜索和 web 检索都没有 `card` 的调用时对应视图(其 pending 状态保持为 generic 卡片,因为结构化结果只在 `execute` 之后才存在)。
465
+
466
+ `ToolCallKind`(`'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'fetch' | 'other'`)用于为通用卡片选择图标。`FileLocation`(`{ path, line? }`)、`FileDiff`(`{ path, oldText, newText }`)与 `ReadFileLine`(`{ number, text }`,读取窗口中一行带 1-based 行号的内容)是共享的文件卡片词汇。该设计由[渲染意图联合类型 Agent Note](../../.agents/notes/implemented/architecture/2026-07-02-tool-render-intent-union.md)固定;host/client 运行时将这套中性词汇投影为各自的视图。
467
+
468
+ 完整的展示字段文档见 [`packages/core/tools/src/presentation.ts`](../../packages/core/tools/src/presentation.ts)。`bash` schema 与执行器见 [shell.md](shell.md);通用后台控制见 [jobs.md](jobs.md)。
469
+
470
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
471
+
472
+ <a id="cordis-surface"></a>
473
+
474
+ ## Cordis API
475
+
476
+ 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).
477
+
478
+ <a id="ctxtools--toolruntime"></a>
479
+
480
+ ### `ctx.tools` — `ToolRuntime`
481
+
482
+ Tool registry and execution pipeline. Scoped registrations shadow globals; one visibility resolver feeds presentation, lookup, and dispatch.
483
+
484
+ ```ts cordis-catalog
485
+ /**
486
+ * Present the calling scope's tools in `mode` instead of the deployment
487
+ * default. Nearest scope on the chain wins, so a preset's standing
488
+ * declaration covers every agent joined under it.
489
+ *
490
+ * Scoped only, and one declaration per scope: this is how an agent preset
491
+ * composes Code Mode agents beside native ones in the same process, and a
492
+ * process-global override would be the `mode` config field instead.
493
+ * @param mode - the presentation the covered agents' models see.
494
+ * @returns the exact disposer that restores the deployment default.
495
+ */
496
+ presentAs(mode: ToolPresentationMode): () => void
497
+
498
+ /**
499
+ * Register globally or in the calling agent scope. Scoped tools shadow
500
+ * globals; duplicates within one layer and the reserved `run_code` name fail.
501
+ * @param definition - tool schema, execution, and optional finalization/presentation callbacks.
502
+ * @returns the exact disposer that unregisters the tool.
503
+ */
504
+ register(definition: ToolDefinition): () => void
505
+
506
+ /**
507
+ * Restrict global tools for the calling agent scope. Empty filters, unknown
508
+ * names, scope-local names, and reserved transport names fail. Restrictions
509
+ * intersect; scoped registrations remain visible.
510
+ * @param filter - global-tool mask: `allow` (keep only) and/or `deny` (remove).
511
+ * @returns the exact disposer that lifts this restriction.
512
+ */
513
+ restrict(filter: ToolRestriction): () => void
514
+
515
+ /**
516
+ * Register a monotonic guard after the extensible `tools/pre-execute`
517
+ * waterfall. A plain-context guard applies globally; one registered through
518
+ * `agent.ctx` applies only to that agent. Any matching guard may deny by
519
+ * returning a reason, while no guard can force-allow a call another guard
520
+ * denied. The exact effect disposer is returned for ordered ownership and
521
+ * HMR cleanup.
522
+ * @param guard - synchronous check; a returned string denies the execution.
523
+ * @returns the exact disposer that unregisters the guard.
524
+ */
525
+ guard(guard: ToolGuard): () => void
526
+
527
+ /**
528
+ * Look up a tool as one scope sees it (scoped
529
+ * shadows global; a restricted-away global reads as absent). Presenters pass
530
+ * the calling agent so the rendered card matches the definition that
531
+ * actually executed.
532
+ * @param name - the tool name as registered.
533
+ * @param scope - the viewing scope (the agent); omitted = the global view.
534
+ * @returns the definition the scope resolves, or undefined when none is visible.
535
+ */
536
+ get(name: string, scope?: ScopeKey): ToolDefinition | undefined
537
+
538
+ /**
539
+ * Project visible definitions onto the allowlisted model-facing schema fields,
540
+ * excluding execution and presentation callbacks.
541
+ * @param scope - the viewing scope (the agent); omitted = the global view.
542
+ * @returns one deep-cloned schema per visible tool.
543
+ */
544
+ schemas(scope?: ScopeKey): ToolSchema[]
545
+
546
+ /**
547
+ * Classify a pending call through the caller's visible tool definition. Only
548
+ * an exact `true` is parallel; unknown, hidden, undeclared, invalid, or
549
+ * throwing classifiers are exclusive.
550
+ * @param exec - call name, parsed arguments, and optional agent scope.
551
+ * @returns the fail-closed scheduling mode.
552
+ */
553
+ executionMode(exec: ToolExecutionInput): ToolExecutionMode
554
+
555
+ /**
556
+ * Execute through pre-policy, guards, around-dispatch, post-policy,
557
+ * definition-owned content finalization, and final notification. Tool and
558
+ * listener failures resolve as materialized error results; an invisible tool
559
+ * reports `UNKNOWN_TOOL`. The returned outcome is the same lossless, frozen
560
+ * snapshot final observers receive. Cancellation
561
+ * arriving after entry and before final result materialization skips a
562
+ * not-yet-started body with `ABORTED_BEFORE_DISPATCH` or replaces a
563
+ * successful started outcome with `ABORTED`; already-started work is still
564
+ * drained and may retain a tool-owned structured error.
565
+ * @param exec - the typed same-process call input. The registry assigns its
566
+ * correlation token before policy begins.
567
+ * @returns the materialized final result.
568
+ */
569
+ async execute(exec: ToolExecutionInput): Promise<ToolExecutionResult>
570
+ ```
571
+
572
+ Types: [ScopeKey](scope.md)
573
+
574
+ Source: [`packages/core/tools/src/index.ts:787`](../../packages/core/tools/src/index.ts)
575
+
576
+ <a id="tools-events"></a>
577
+
578
+ ### `tools/*` events
579
+
580
+ <a id="toolschange--emit"></a>
581
+
582
+ #### `tools/change` — emit
583
+
584
+ A tool was registered or unregistered, or a scoped restriction changed (the available tool set changed — possibly for one scope only). An UNFILTERED registry-subject notification, deliberately not scope-filtered dispatch: a global change concerns every agent's next assembly, so a scoped listener subscribing here sees every change, not just its own scope's.
585
+
586
+ ```ts cordis-catalog
587
+ /**
588
+ * A tool was registered or unregistered, or a scoped restriction changed
589
+ * (the available tool set changed — possibly for one scope only). An
590
+ * UNFILTERED registry-subject notification, deliberately not scope-filtered
591
+ * dispatch: a global change concerns every agent's next assembly, so a
592
+ * scoped listener subscribing here sees every change, not just its own
593
+ * scope's.
594
+ * @mode emit
595
+ */
596
+ 'tools/change'(): void
597
+ ```
598
+
599
+ Source: [`packages/core/tools/src/index.ts:207`](../../packages/core/tools/src/index.ts)
600
+
601
+ <a id="toolscode-dispatch-log--waterfall"></a>
602
+
603
+ #### `tools/code-dispatch-log` — waterfall
604
+
605
+ Allow a listener to replace content in the DURABLE LOG COPY of one `run_code` sub-dispatch outcome before the bridge appends its `tool/code-dispatch` event. `next()` keeps the content unchanged; a listener may return replacement blocks (e.g. the spill policy's preview + locator for an oversized text result). Only the logged copy is affected — the program already received the complete value, and the model sees neither. A throwing listener is contained: the bridge falls back to logging the original settled content. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's dispatches.
606
+
607
+ ```ts cordis-catalog
608
+ /**
609
+ * Allow a listener to replace content in the DURABLE LOG COPY of one
610
+ * `run_code` sub-dispatch outcome before the bridge appends its
611
+ * `tool/code-dispatch` event. `next()` keeps the
612
+ * content unchanged; a listener may return replacement blocks (e.g. the
613
+ * spill policy's preview + locator for an oversized text result). Only the
614
+ * logged copy is affected — the program already received the complete
615
+ * value, and the model sees neither. A throwing listener is contained:
616
+ * the bridge falls back to logging the original settled content.
617
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's dispatches.
618
+ * @param dispatch - the parent execution, sub-call identity, and the settled content to log.
619
+ * @mode waterfall
620
+ */
621
+ 'tools/code-dispatch-log'(this: Scoped<ToolRuntime>, dispatch: CodeDispatchLog, next: () => Promise<ContentBlock[]>): Promise<ContentBlock[]>
622
+ ```
623
+
624
+ Types: [ContentBlock](llm-streaming.md) · [Scoped](scope.md)
625
+
626
+ Source: [`packages/core/tools/src/index.ts:189`](../../packages/core/tools/src/index.ts)
627
+
628
+ <a id="toolsexecute--waterfall"></a>
629
+
630
+ #### `tools/execute` — waterfall
631
+
632
+ Around-dispatch waterfall for timeout, retry, or metrics. `next()` returns a normalized result; wrappers may change only `exec.signal`, while call identity remains immutable. The registry re-fuses the original caller signal before the body, so replacement cannot detach caller cancellation; wrappers must still restore their signal and reach quiescence. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
633
+
634
+ ```ts cordis-catalog
635
+ /**
636
+ * Around-dispatch waterfall for timeout, retry, or metrics. `next()` returns
637
+ * a normalized result; wrappers may change only `exec.signal`, while call
638
+ * identity remains immutable. The registry re-fuses the original caller
639
+ * signal before the body, so replacement cannot detach caller cancellation;
640
+ * wrappers must still restore their signal and reach quiescence.
641
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
642
+ * @param exec - the allowed call about to dispatch (name, parsed arguments, caller agent, signal).
643
+ * @mode waterfall
644
+ */
645
+ 'tools/execute'(this: Scoped<ToolRuntime>, exec: ToolDispatchExecution, next: () => Promise<ToolExecutionResult>): Promise<ToolExecutionResult>
646
+ ```
647
+
648
+ Types: [Scoped](scope.md)
649
+
650
+ Source: [`packages/core/tools/src/index.ts:163`](../../packages/core/tools/src/index.ts)
651
+
652
+ <a id="toolspost-execute--waterfall"></a>
653
+
654
+ #### `tools/post-execute` — waterfall
655
+
656
+ Accept, replace, enrich, or block a normalized dispatch result. `next()` accepts it unchanged; thrown tools still reach this waterfall as errors. Async listeners must observe `exec.signal`; after they settle, caller cancellation replaces only a successful accepted outcome with the code selected by whether the tool body was invoked. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
657
+
658
+ ```ts cordis-catalog
659
+ /**
660
+ * Accept, replace, enrich, or block a normalized dispatch result. `next()`
661
+ * accepts it unchanged; thrown tools still reach this waterfall as errors. Async
662
+ * listeners must observe `exec.signal`; after they settle, caller
663
+ * cancellation replaces only a successful accepted outcome with the code
664
+ * selected by whether the tool body was invoked.
665
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
666
+ * @param exec - the call that just ran (name, parsed arguments, caller agent).
667
+ * @param result - the dispatch outcome a listener may accept, replace, or block.
668
+ * @mode waterfall
669
+ */
670
+ 'tools/post-execute'(this: Scoped<ToolRuntime>, exec: ToolExecution, result: Readonly<ToolExecutionResult>, next: () => Promise<PostToolDecision>): Promise<PostToolDecision>
671
+ ```
672
+
673
+ Types: [Scoped](scope.md)
674
+
675
+ Source: [`packages/core/tools/src/index.ts:175`](../../packages/core/tools/src/index.ts)
676
+
677
+ <a id="toolspre-execute--waterfall"></a>
678
+
679
+ #### `tools/pre-execute` — waterfall
680
+
681
+ Allow, deny, or ask before dispatch. `next()` delegates to allow; missing approval support turns `ask` into denial. Async gates must observe `exec.signal`; the registry rechecks cancellation after they settle but never abandons their promise. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
682
+
683
+ ```ts cordis-catalog
684
+ /**
685
+ * Allow, deny, or ask before dispatch. `next()` delegates to allow; missing
686
+ * approval support turns `ask` into denial. Async gates must observe
687
+ * `exec.signal`; the registry rechecks cancellation after they settle but
688
+ * never abandons their promise.
689
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
690
+ * @param exec - the pending call (name, parsed arguments, caller agent).
691
+ * @mode waterfall
692
+ */
693
+ 'tools/pre-execute'(this: Scoped<ToolRuntime>, exec: ToolExecution, next: () => Promise<PreToolDecision>): Promise<PreToolDecision>
694
+ ```
695
+
696
+ Types: [Scoped](scope.md)
697
+
698
+ Source: [`packages/core/tools/src/index.ts:152`](../../packages/core/tools/src/index.ts)
699
+
700
+ <a id="toolsresult--emit"></a>
701
+
702
+ #### `tools/result` — emit
703
+
704
+ Observe the frozen, lossless-JSON final outcome. Listener failures are contained. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): keyed by `exec.agent`.
705
+
706
+ ```ts cordis-catalog
707
+ /**
708
+ * Observe the frozen, lossless-JSON final outcome. Listener failures are contained.
709
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): keyed by `exec.agent`.
710
+ * @param exec - the execution object that traversed the pipeline.
711
+ * @param result - a deep-frozen snapshot of the final returned result.
712
+ * @mode emit
713
+ */
714
+ 'tools/result'(this: Scoped<ToolRuntime>, exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): undefined
715
+ ```
716
+
717
+ Types: [Scoped](scope.md)
718
+
719
+ Source: [`packages/core/tools/src/index.ts:197`](../../packages/core/tools/src/index.ts)
720
+ <!-- END GENERATED cordis-surface -->