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
+ # Tools
2
+
3
+ English | [中文](tools.zh.md)
4
+
5
+ The tool pipeline of [dsh-tools](../../packages/core/tools). [core.md](core.md) introduces `ToolDefinition` as the pipeline-authoring type shared by the core packages; the model-facing [`ToolSchema`](llm-streaming.md#the-model-request-and-result) wire type is declared with the model request. This page documents every `ToolDefinition` field, the typed schema DSL that builds it, the guarded execution types, and the UI-presentation types.
6
+
7
+ Source: [`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` — a registered tool
10
+
11
+ A `ToolSchema` (the model-facing fields) plus a mandatory canonical output declaration, the `execute` function, host-only scheduler metadata, an optional final-content callback, and optional UI presenters. The registry holds these; the loop dispatches calls through them. The registry's `schemas()` builds the model-facing `ToolSchema[]` by an explicit allowlist — `output`/`execute`/`finalizeContent`/`timeoutMs`/`isConcurrencySafe`/`presentCall`/`presentResult` must never leak into a model request.
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` receives `args: unknown` — a raw `ToolDefinition` validates its own input. First-party tools don't write that by hand; they use `defineTool`, which validates and narrows the arguments, infers the body return from `output.schema`, and types both output projectors. `finalizeContent` deliberately receives the immutable execution instead of typed arguments because invalid-input and outer pipeline failures reach it too; it may enforce a tool-owned content bound while preserving `isError`, canonical value, structured error identity, deferred contexts, and presentation metadata.
97
+
98
+ ## The unified JSON-value schema DSL
99
+
100
+ Plugin authors use one vocabulary for typed parameters and typed output values. `ValueSchemaSpec` supports `string`, `number`, `integer`, `boolean`, `null`, `array`, `object`, author-only `json`, and exact-one `oneOf`; scalar `enum` and `const` values must match their node type. An explicit object node always declares `additionalProperties: true | false`. Parameter definitions remain an implicit open object property map, with `required: true` attached to each required property.
101
+
102
+ Source: [`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' }` infers `JsonValue` and compiles to an annotation-only unconstrained raw schema. Output roots can be objects, arrays, scalars, or null. `InferValue<S>` honors literal constraints and object openness through 16 container levels, then falls back to `JsonValue` instead of exhausting TypeScript's type-instantiation stack. `InferArgs<P>` turns per-property requiredness into required and optional string keys:
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, … })` ties parameter inference to `parameterSchemaSpecToJsonSchema()` and `validateArgs()`, and ties `execute`/`render`/`presentationMeta` to `InferValue<OutputSchema>`. Schema records contain only own enumerable string keys, and schema arrays are dense intrinsic arrays, so inference, compilation, and validation observe the same declaration. Inference stays exact through 16 container levels and then widens to `JsonValue`; runtime validation keeps walking the complete schema. `valueSchemaSpecToJsonSchema()` compiles output declarations through the same enforced raw subset. A parameter mismatch throws `ToolArgsError` (`INVALID_ARGS`); an invalid body or post-policy value throws `ToolOutputError` (`INVALID_TOOL_OUTPUT`). Both use the normal tool-error path. Raw JSON Schema remains open by default; unsupported keywords reject instead of being accepted without enforcement.
150
+
151
+ Registration is a trusted same-process contract. The registry borrows the typed definition as readonly input, requires `output`, validates its raw schema, and checks semantic requirements such as a positive finite `timeoutMs`; `schemas()` constructs the model-facing projection when building a request, so execution and presentation share one resolved definition without leaking callbacks onto the wire.
152
+
153
+ ## `ToolRestriction` — one scope's live filter over what it inherits
154
+
155
+ `ToolRestriction` applies to the tools a scope inherits: the deployment-global layer plus every ancestor scope on its chain. The registry compiles readonly names into private sets, intersects multiple restrictions, then overlays the scope's OWN registrations, which stay exempt so a delegated child keeps the tools it answers through. A deny-only filter admits later unlisted inherited tools, while an allow-list excludes them.
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
+ ## Execution: extensible waterfalls plus monotonic policy
171
+
172
+ `ctx.tools.execute()` accepts a caller-owned `ToolExecutionInput` with a required readonly `signal`, materializes its parsed JSON arguments once into a pipeline-owned `ToolExecution`, and runs that call through `tools/pre-execute` (the reorderable allow/deny/ask waterfall) → registered monotonic guards → `tools/execute` (around-dispatch wrappers) → `tools/post-execute` (inspect/replace the result) → optional definition-owned `finalizeContent` → `tools/result` (the immutable authoritative outcome). Only the `tools/execute` view may replace the required signal. The outcome is a `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
+ A tool body receives the runtime extension. `deferContext()` attaches context to the execution's own result — the composite-tool nested-dispatch channel, also usable by a leaf tool minting a plugin-sourced instruction — without injecting inside the still-open outer call.
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
+ The agent loop asks the registry for each pending call's execution mode and uses it to form exclusive barriers and rolling-pool parallel runs:
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's bridge additionally exposes each settled sub-dispatch to the `tools/code-dispatch-log` waterfall, which may change the durable event's copy of the content (the program's value and model-visible result remain untouched):
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` is an opaque runtime `Symbol` used only for identity comparison. Before policy, `execute()` materializes and freezes arguments, rejects non-JSON input, and assigns the token. Identity fields, the required caller signal, and the optional parent token remain readonly. A `ToolDispatchExecution` wrapper may replace but not remove the signal; the registry re-fuses the caller signal before invoking the body. Final observers receive the frozen execution identity.
312
+
313
+ A `ToolGuard` is scope-aware final pre-dispatch policy. Its return type deliberately has no allow result: `undefined` preserves the waterfall decision, while a returned reason can only reduce permission, so a later listener cannot undo it.
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
+ The result carries only the outcome. Call identity remains on the immutable `ToolExecution` that accompanies it through every hook and on the durable `tool/call` / `tool/result` session events, so wrappers cannot create a second, disagreeing identity. The canonical `value` is execution-local: the loop persists only `content`, `error`, and `meta`, while `tool/code-dispatch` stores the sub-call's rendered `content` and `isError` verbatim. Replay reproduces presentation but cannot reconstruct canonical intermediate values.
371
+
372
+ On success the registry snapshots and validates the body value, freezes it, and invokes the pure renderer plus the optional top-level-call metadata projector. It separately materializes the durable presentation fields immediately before `tools/result`; an invalid value, renderer/projector failure, or non-JSON presentation becomes a JSON-safe `isError`. The final live observer therefore sees the exact execution-local value beside fields safe for the later durable append.
373
+
374
+ Before final content, the registry materializes the candidate result; a failure in content, structured error, additional context, or presentation metadata becomes a JSON-safe `isError` result that still reaches `finalizeContent`. The registry invokes that callback exactly once, then materializes and freezes the accepted result immediately before `tools/result`, so the observed live outcome is safe for the later durable `tool/result` append.
375
+
376
+ Each interception waterfall returns a typed **Decision** (the idiom shared with the `agent/*` waterfalls). `tools/pre-execute` listeners receive `(exec, next)` and return a `PreToolDecision`; `tools/execute` wrappers return a `ToolExecutionResult`; `tools/post-execute` listeners receive `(exec, result, next)` and return a `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
+ Call `next()` for the default or return a decision to short-circuit. Pre-policy may deny or ask; only `allowed-once` proceeds, while a non-grant, missing approval channel or service, or agent-less request becomes a denial. Guards may still impose a final denial. Arguments cannot be rewritten because history, audit, UI, and execution must agree.
403
+
404
+ Post-policy may replace either content or value, never both. Content replacement preserves the canonical value and existing metadata; value replacement is revalidated and recomputes content/metadata; a block removes the value and becomes an `isError` containing corrective feedback. Content replacement is presentation policy, not confidentiality policy: a listener that must hide the programmatic value blocks or replaces it. `tools/result` receives the frozen execution and result after normalization; observers cannot transform them, and observer failures are contained. Unknown and throwing tools both become structured errors (`ToolNotFoundError` maps to `UNKNOWN_TOOL`), so the call fails without ending the turn.
405
+
406
+ ## The enforced raw JSON Schema subset
407
+
408
+ Raw schemas from subagents, workflows, MCP, and dynamic registrations use the wire-level counterpart of the author DSL. `assertSupportedJsonSchema()` accepts any JSON root, `validateJsonSchemaValue()` enforces it, and `JsonSchemaError` reports every unsupported or malformed schema path. The empty annotation-only node means unconstrained lossless JSON. `oneOf` requires at least two branches and a value must match exactly one. Consumers that still require an object root call `assertObjectJsonSchema()` and carry `ObjectJsonSchema`; this is how subagent/workflow caller-defined structured output remains object-rooted without restricting the shared vocabulary.
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
+ ## Tool-presentation UI vocabulary
460
+
461
+ How a tool wants its call shown in a UI (an editor tool-call card, a CLI log line), provider-neutral so a tool describes itself without depending on any client protocol. `presentCall`/`presentResult` return a **`card`-tagged render intent** — a discriminated union a UI bridge switches on:
462
+
463
+ - `ToolCallView` (pending): `{ card: 'generic', title, kind?, rawInput?, content?, locations? }` (the default card; `locations` is `{ path, line? }[]` files the call reads/modifies, for editor follow-along), `{ card: 'terminal', title, description?, cwd? }` (a shell command → a terminal card), or `{ card: 'diff', title, diffs, locations? }` (a file create/modify → an inline diff card; `diffs` is `{ path, oldText, newText }[]`, `oldText: null` for a new file).
464
+ - `ToolResultView` (completed): `{ card: 'generic', title?, content? }`, `{ card: 'terminal', title?, output?, exitCode?, signal? }` (the captured run output + exit; a capable UI shows an exit-status pill, while another may derive a fenced ` ```console ` fallback), `{ card: 'diff', title?, diffs }` (a completed file mutation → the change to show, typically the applied hunks with context lines computed from the before/after content, or a whole-file diff when there is no before-image), `{ card: 'search', shape, title?, truncated, total, … }` (a completed discovery search → grouped-by-file matches for `shape: 'matches'` (grep) or a flat path list for `shape: 'paths'` (glob); `truncated`/`total` report whether the inline result was capped so a UI never presents a partial result as complete; the view carries no result text — a UI without a search card falls back to the raw result content), `{ card: 'read', title?, path, offset, lines, totalLines, lang?, content? }` (a completed file read → a line-numbered, optionally syntax-highlighted code view; `offset` is the 1-based first line the window requested, kept even when `lines` is empty; `lang` is a language hint from the extension, and `content` is the envelope-stripped text a UI without read support falls back to), or `{ card: 'web', kind: 'search' | 'fetch', title?, … }` (a completed web retrieval; `kind: 'search'` carries the structured `sources`/`answer?`/`truncated`, `kind: 'fetch'` carries `url`/`statusCode`/`truncated`, and a UI without the `web` capability falls back to the raw result content — the body is not duplicated into the view). Completed views replace pending views, so mutation tools return a diff result even when it duplicates the call-time snippet; a search and a web retrieval have no `card` call-time analogue (their pending state stays a generic card, since the structured result exists only after `execute`).
465
+
466
+ `ToolCallKind` (`'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'fetch' | 'other'`) picks an icon on a generic card. `FileLocation` (`{ path, line? }`), `FileDiff` (`{ path, oldText, newText }`), and `ReadFileLine` (`{ number, text }`, one 1-based numbered line of a read window) are the shared file-card vocabulary. The design is pinned in [the render-intent-union Agent Note](../../.agents/notes/implemented/architecture/2026-07-02-tool-render-intent-union.md); host/client runtimes project this neutral vocabulary into their own views.
467
+
468
+ The full presentation field docs live in [`packages/core/tools/src/presentation.ts`](../../packages/core/tools/src/presentation.ts). The `bash` schema and executor are on [shell.md](shell.md); generic background controls are on [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 -->