dsh-plugin-dev-kb 1.4.0 → 1.5.1

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 (415) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.en.md +6 -6
  3. package/README.md +10 -5
  4. package/kb/INDEX.md +8 -4
  5. package/kb/extra/AGENTS.md +4 -3
  6. package/kb/extra/agent-lifecycle.md +91 -0
  7. package/kb/extra/agent-lifecycle.zh.md +93 -0
  8. package/kb/extra/api-gateway.md +172 -0
  9. package/kb/extra/api-gateway.zh.md +178 -0
  10. package/kb/extra/architecture.md +165 -0
  11. package/kb/extra/architecture.zh.md +169 -0
  12. package/kb/extra/capability-seams.md +714 -0
  13. package/kb/extra/capability-seams.zh.md +716 -0
  14. package/kb/extra/cli-help.md +203 -0
  15. package/kb/extra/cli-help.zh.md +205 -0
  16. package/kb/extra/config-catalog.md +4801 -0
  17. package/kb/extra/config-catalog.zh.md +4803 -0
  18. package/kb/extra/cookbook/adding-a-package.md +170 -0
  19. package/kb/extra/cookbook/adding-a-package.zh.md +170 -0
  20. package/kb/extra/cookbook/adding-a-plugin-preview.md +52 -0
  21. package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +52 -0
  22. package/kb/extra/cookbook/adding-a-session-format-version.md +7 -5
  23. package/kb/extra/cookbook/adding-a-session-format-version.zh.md +7 -5
  24. package/kb/extra/cookbook/adding-a-settings-card.md +72 -0
  25. package/kb/extra/cookbook/adding-a-settings-card.zh.md +72 -0
  26. package/kb/extra/cookbook/adding-a-tool.md +101 -0
  27. package/kb/extra/cookbook/adding-a-tool.zh.md +103 -0
  28. package/kb/extra/cookbook/adding-an-llm-adapter.md +43 -0
  29. package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +43 -0
  30. package/kb/extra/cookbook/extension-cookbook.md +132 -0
  31. package/kb/extra/cookbook/extension-cookbook.zh.md +136 -0
  32. package/kb/extra/cookbook/reviewing-persistence-type-changes.md +11 -9
  33. package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +11 -9
  34. package/kb/extra/cordis-api/context.md +364 -0
  35. package/kb/extra/cordis-api/context.zh.md +366 -0
  36. package/kb/extra/cordis-api/events.md +207 -0
  37. package/kb/extra/cordis-api/events.zh.md +209 -0
  38. package/kb/extra/cordis-api/fiber.md +375 -0
  39. package/kb/extra/cordis-api/fiber.zh.md +377 -0
  40. package/kb/extra/cordis-api/inherited.md +38 -0
  41. package/kb/extra/cordis-api/registry.md +152 -0
  42. package/kb/extra/cordis-api/registry.zh.md +154 -0
  43. package/kb/extra/cordis-api/service.md +102 -0
  44. package/kb/extra/cordis-api/service.zh.md +104 -0
  45. package/kb/extra/cordis-tutorial/01-first-plugin.md +95 -0
  46. package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +95 -0
  47. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
  48. package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
  49. package/kb/extra/cordis-tutorial/03-services.md +98 -0
  50. package/kb/extra/cordis-tutorial/03-services.zh.md +98 -0
  51. package/kb/extra/cordis-tutorial/04-events.md +144 -0
  52. package/kb/extra/cordis-tutorial/04-events.zh.md +144 -0
  53. package/kb/extra/cordis-tutorial/05-config.md +111 -0
  54. package/kb/extra/cordis-tutorial/05-config.zh.md +111 -0
  55. package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +113 -0
  56. package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
  57. package/kb/extra/cordis-tutorial/07-into-the-harness.md +108 -0
  58. package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +108 -0
  59. package/kb/extra/cordis-tutorial/index.md +60 -0
  60. package/kb/extra/cordis-tutorial/index.zh.md +62 -0
  61. package/kb/extra/deepseek-llm-api-wire-extensions.md +5 -5
  62. package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +5 -5
  63. package/kb/extra/defensive-patterns/README.md +25 -0
  64. package/kb/extra/defensive-patterns/README.zh.md +27 -0
  65. package/kb/extra/defensive-patterns/client-components.md +493 -0
  66. package/kb/extra/defensive-patterns/client-components.zh.md +495 -0
  67. package/kb/extra/defensive-patterns/conversation-and-session.md +316 -0
  68. package/kb/extra/defensive-patterns/conversation-and-session.zh.md +316 -0
  69. package/kb/extra/defensive-patterns/general.md +222 -0
  70. package/kb/extra/defensive-patterns/general.zh.md +252 -0
  71. package/kb/extra/defensive-patterns/package-surface.md +231 -0
  72. package/kb/extra/defensive-patterns/package-surface.zh.md +231 -0
  73. package/kb/extra/defensive-patterns/remote-and-api.md +115 -0
  74. package/kb/extra/defensive-patterns/remote-and-api.zh.md +115 -0
  75. package/kb/extra/development.md +31 -11
  76. package/kb/extra/development.zh.md +32 -11
  77. package/kb/extra/event-producer-consumer.md +40 -39
  78. package/kb/extra/event-producer-consumer.zh.md +40 -39
  79. package/kb/extra/experimental-persistence-catalog.md +17 -0
  80. package/kb/extra/experimental-persistence-catalog.zh.md +17 -0
  81. package/kb/extra/glossary.md +1 -0
  82. package/kb/extra/glossary.zh.md +1 -0
  83. package/kb/extra/i18n/style-samples.md +2 -2
  84. package/kb/extra/i18n/terminology.md +1 -0
  85. package/kb/extra/module-graph.md +274 -195
  86. package/kb/extra/module-graph.zh.md +274 -195
  87. package/kb/extra/persistence-catalog.md +9140 -0
  88. package/kb/extra/persistence-catalog.zh.md +9142 -0
  89. package/kb/extra/persistence-changes/2026-09-13-working-directory.md +48 -0
  90. package/kb/extra/persistence-changes/2026-09-13-working-directory.zh.md +48 -0
  91. package/kb/extra/persistence-changes/2026-09-16-session-format-v4.md +2 -2
  92. package/kb/extra/persistence-changes/2026-09-16-session-format-v4.zh.md +2 -2
  93. package/kb/extra/persistence-changes/2026-09-19-external-subagent-catalog.md +48 -0
  94. package/kb/extra/persistence-changes/2026-09-19-external-subagent-catalog.zh.md +48 -0
  95. package/kb/extra/persistence-changes/2026-09-30-job-session-lifecycle.md +52 -0
  96. package/kb/extra/persistence-changes/2026-09-30-job-session-lifecycle.zh.md +52 -0
  97. package/kb/extra/persistence-changes/2026-10-05-ptc-operation-metadata.md +48 -0
  98. package/kb/extra/persistence-changes/2026-10-05-ptc-operation-metadata.zh.md +48 -0
  99. package/kb/extra/persistence-changes/2026-10-05-working-directory-attribution.md +60 -0
  100. package/kb/extra/persistence-changes/2026-10-05-working-directory-attribution.zh.md +60 -0
  101. package/kb/extra/persistence-changes/2026-10-07-title-reasoning-effort.md +48 -0
  102. package/kb/extra/persistence-changes/2026-10-07-title-reasoning-effort.zh.md +48 -0
  103. package/kb/extra/persistence-changes/2026-10-13-deepseek-search-thinking.md +48 -0
  104. package/kb/extra/persistence-changes/2026-10-13-deepseek-search-thinking.zh.md +48 -0
  105. package/kb/extra/persistence-changes/2026-10-13-user-rpc-principal.md +60 -0
  106. package/kb/extra/persistence-changes/2026-10-13-user-rpc-principal.zh.md +60 -0
  107. package/kb/extra/persistence-changes/README.md +12 -10
  108. package/kb/extra/persistence-changes/README.zh.md +12 -10
  109. package/kb/extra/persistence-changes/historical-formats/README.md +1 -1
  110. package/kb/extra/persistence-changes/historical-formats/README.zh.md +1 -1
  111. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.2.md +50 -50
  112. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.2.zh.md +50 -50
  113. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.3.md +14 -14
  114. package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.3.zh.md +14 -14
  115. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.7.md +3 -3
  116. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.7.zh.md +3 -3
  117. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.8.md +10 -10
  118. package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.8.zh.md +10 -10
  119. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.1.md +3 -3
  120. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.1.zh.md +3 -3
  121. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.2.md +13 -13
  122. package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.2.zh.md +13 -13
  123. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.1.md +63 -63
  124. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.1.zh.md +63 -63
  125. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.2.md +54 -54
  126. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.2.zh.md +54 -54
  127. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.4.md +7 -7
  128. package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.4.zh.md +7 -7
  129. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.1.md +27 -27
  130. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.1.zh.md +27 -27
  131. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.2.md +4 -4
  132. package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.2.zh.md +4 -4
  133. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.1.md +27 -27
  134. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.1.zh.md +27 -27
  135. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.2.md +7 -7
  136. package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.2.zh.md +7 -7
  137. package/kb/extra/session-format-status.md +6 -6
  138. package/kb/extra/session-format-status.zh.md +6 -6
  139. package/kb/extra/subsystems/README.md +76 -0
  140. package/kb/extra/subsystems/README.zh.md +76 -0
  141. package/kb/extra/subsystems/agent-team.md +10 -10
  142. package/kb/extra/subsystems/agent-team.zh.md +10 -10
  143. package/kb/extra/subsystems/approval.md +170 -0
  144. package/kb/extra/subsystems/approval.zh.md +170 -0
  145. package/kb/extra/subsystems/boot.md +128 -4
  146. package/kb/extra/subsystems/boot.zh.md +128 -4
  147. package/kb/extra/subsystems/claude-code-mods.md +1 -1
  148. package/kb/extra/subsystems/claude-code-mods.zh.md +1 -1
  149. package/kb/extra/subsystems/client-modules.md +198 -0
  150. package/kb/extra/subsystems/client-modules.zh.md +198 -0
  151. package/kb/extra/subsystems/client-resources.md +92 -0
  152. package/kb/extra/subsystems/client-resources.zh.md +92 -0
  153. package/kb/extra/subsystems/commands.md +223 -0
  154. package/kb/extra/subsystems/commands.zh.md +223 -0
  155. package/kb/extra/subsystems/compaction.md +284 -0
  156. package/kb/extra/subsystems/compaction.zh.md +284 -0
  157. package/kb/extra/subsystems/computer-use.md +3 -0
  158. package/kb/extra/subsystems/computer-use.zh.md +3 -0
  159. package/kb/extra/subsystems/conversation.md +301 -0
  160. package/kb/extra/subsystems/conversation.zh.md +303 -0
  161. package/kb/extra/subsystems/core.md +1113 -0
  162. package/kb/extra/subsystems/core.zh.md +1125 -0
  163. package/kb/extra/subsystems/credentials.md +493 -0
  164. package/kb/extra/subsystems/credentials.zh.md +493 -0
  165. package/kb/extra/subsystems/filesystem.md +530 -0
  166. package/kb/extra/subsystems/filesystem.zh.md +530 -0
  167. package/kb/extra/subsystems/goal.md +313 -0
  168. package/kb/extra/subsystems/goal.zh.md +313 -0
  169. package/kb/extra/subsystems/jobs.md +554 -0
  170. package/kb/extra/subsystems/jobs.zh.md +554 -0
  171. package/kb/extra/subsystems/llm-streaming.md +1196 -0
  172. package/kb/extra/subsystems/llm-streaming.zh.md +1202 -0
  173. package/kb/extra/subsystems/lsp.md +202 -0
  174. package/kb/extra/subsystems/lsp.zh.md +202 -0
  175. package/kb/extra/subsystems/permission-presets.md +167 -0
  176. package/kb/extra/subsystems/permission-presets.zh.md +167 -0
  177. package/kb/extra/subsystems/persistence.md +418 -0
  178. package/kb/extra/subsystems/persistence.zh.md +418 -0
  179. package/kb/extra/subsystems/plan.md +87 -0
  180. package/kb/extra/subsystems/plan.zh.md +87 -0
  181. package/kb/extra/subsystems/product-telemetry.md +4 -2
  182. package/kb/extra/subsystems/product-telemetry.zh.md +4 -2
  183. package/kb/extra/subsystems/ptc-runtime.md +250 -0
  184. package/kb/extra/subsystems/ptc-runtime.zh.md +250 -0
  185. package/kb/extra/subsystems/sandbox.md +221 -0
  186. package/kb/extra/subsystems/sandbox.zh.md +221 -0
  187. package/kb/extra/subsystems/schedule.md +550 -0
  188. package/kb/extra/subsystems/schedule.zh.md +550 -0
  189. package/kb/extra/subsystems/scope.md +59 -0
  190. package/kb/extra/subsystems/scope.zh.md +61 -0
  191. package/kb/extra/subsystems/session-projection.md +356 -0
  192. package/kb/extra/subsystems/session-projection.zh.md +356 -0
  193. package/kb/extra/subsystems/session-query.md +511 -0
  194. package/kb/extra/subsystems/session-query.zh.md +511 -0
  195. package/kb/extra/subsystems/session-reference.md +224 -0
  196. package/kb/extra/subsystems/session-reference.zh.md +224 -0
  197. package/kb/extra/subsystems/session-telemetry.md +212 -0
  198. package/kb/extra/subsystems/session-telemetry.zh.md +212 -0
  199. package/kb/extra/subsystems/session-title.md +213 -0
  200. package/kb/extra/subsystems/session-title.zh.md +213 -0
  201. package/kb/extra/subsystems/session.md +1339 -0
  202. package/kb/extra/subsystems/session.zh.md +1343 -0
  203. package/kb/extra/subsystems/settings.md +155 -0
  204. package/kb/extra/subsystems/settings.zh.md +155 -0
  205. package/kb/extra/subsystems/shell.md +314 -0
  206. package/kb/extra/subsystems/shell.zh.md +314 -0
  207. package/kb/extra/subsystems/sidebar-right.md +160 -0
  208. package/kb/extra/subsystems/sidebar-right.zh.md +160 -0
  209. package/kb/extra/subsystems/skills.md +352 -0
  210. package/kb/extra/subsystems/skills.zh.md +352 -0
  211. package/kb/extra/subsystems/slots.md +200 -0
  212. package/kb/extra/subsystems/slots.zh.md +204 -0
  213. package/kb/extra/subsystems/spill.md +124 -0
  214. package/kb/extra/subsystems/spill.zh.md +124 -0
  215. package/kb/extra/subsystems/ssh.md +22 -11
  216. package/kb/extra/subsystems/ssh.zh.md +22 -11
  217. package/kb/extra/subsystems/storage.md +259 -0
  218. package/kb/extra/subsystems/storage.zh.md +259 -0
  219. package/kb/extra/subsystems/subagent.md +686 -0
  220. package/kb/extra/subsystems/subagent.zh.md +688 -0
  221. package/kb/extra/subsystems/subprocess.md +321 -0
  222. package/kb/extra/subsystems/subprocess.zh.md +321 -0
  223. package/kb/extra/subsystems/system-prompt.md +254 -0
  224. package/kb/extra/subsystems/system-prompt.zh.md +254 -0
  225. package/kb/extra/subsystems/terminal.md +184 -0
  226. package/kb/extra/subsystems/terminal.zh.md +184 -0
  227. package/kb/extra/subsystems/token-meter.md +106 -0
  228. package/kb/extra/subsystems/token-meter.zh.md +106 -0
  229. package/kb/extra/subsystems/tools.md +747 -0
  230. package/kb/extra/subsystems/tools.zh.md +747 -0
  231. package/kb/extra/subsystems/translation.md +103 -0
  232. package/kb/extra/subsystems/translation.zh.md +103 -0
  233. package/kb/extra/subsystems/typert.md +690 -0
  234. package/kb/extra/subsystems/typert.zh.md +690 -0
  235. package/kb/extra/subsystems/user-questions.md +307 -0
  236. package/kb/extra/subsystems/user-questions.zh.md +307 -0
  237. package/kb/extra/subsystems/web-client.md +100 -0
  238. package/kb/extra/subsystems/web-client.zh.md +100 -0
  239. package/kb/extra/subsystems/web-server.md +302 -0
  240. package/kb/extra/subsystems/web-server.zh.md +302 -0
  241. package/kb/extra/subsystems/web.md +206 -0
  242. package/kb/extra/subsystems/web.zh.md +206 -0
  243. package/kb/extra/subsystems/webhook.md +1 -1
  244. package/kb/extra/subsystems/webhook.zh.md +1 -1
  245. package/kb/extra/subsystems/workflow.md +278 -0
  246. package/kb/extra/subsystems/workflow.zh.md +278 -0
  247. package/kb/extra/subsystems/working-directory.md +64 -0
  248. package/kb/extra/subsystems/working-directory.zh.md +64 -0
  249. package/kb/extra/subsystems/workspace.md +647 -0
  250. package/kb/extra/subsystems/workspace.zh.md +647 -0
  251. package/kb/extra/subsystems/worktrees.md +76 -0
  252. package/kb/extra/subsystems/worktrees.zh.md +76 -0
  253. package/kb/extra/testing.md +1 -1
  254. package/kb/extra/testing.zh.md +1 -1
  255. package/kb/extra/tool-catalog.md +2824 -0
  256. package/kb/extra/tool-catalog.zh.md +2832 -0
  257. package/kb/extra/tool-execution-pipeline.md +65 -0
  258. package/kb/extra/tool-execution-pipeline.zh.md +67 -0
  259. package/kb/extra/ui-radius.md +6 -4
  260. package/kb/extra/ui-radius.zh.md +6 -4
  261. package/kb/extra/upgrade-guide/v0.2.0-rc.2/bundled-python-tests/guide.md +18 -0
  262. package/kb/extra/upgrade-guide/v0.2.0-rc.2/bundled-python-tests/guide.zh.md +18 -0
  263. package/kb/extra/upgrade-guide/v0.2.0-rc.2/primary-runtime-python-aliases/guide.md +18 -0
  264. package/kb/extra/upgrade-guide/v0.2.0-rc.2/primary-runtime-python-aliases/guide.zh.md +18 -0
  265. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/deepseek-model-discovery/guide.md +17 -0
  266. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/deepseek-model-discovery/guide.zh.md +17 -0
  267. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/desktop-test-auth-popup/guide.md +18 -0
  268. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/desktop-test-auth-popup/guide.zh.md +18 -0
  269. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/experimental-package-composition/guide.md +28 -0
  270. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/experimental-package-composition/guide.zh.md +28 -0
  271. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/instruction-home-override/guide.md +20 -0
  272. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/instruction-home-override/guide.zh.md +20 -0
  273. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/job-id-identity/guide.md +18 -0
  274. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/job-id-identity/guide.zh.md +18 -0
  275. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/jsonl-persistence-plugin/guide.md +18 -0
  276. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/jsonl-persistence-plugin/guide.zh.md +18 -0
  277. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/mock-messages-events/guide.md +17 -0
  278. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/mock-messages-events/guide.zh.md +17 -0
  279. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.md +31 -0
  280. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.zh.md +31 -0
  281. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/new-session-generations/guide.md +20 -0
  282. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/new-session-generations/guide.zh.md +20 -0
  283. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/plugin-option-placement/guide.md +20 -0
  284. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/plugin-option-placement/guide.zh.md +20 -0
  285. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-optional-resources/guide.md +18 -0
  286. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-optional-resources/guide.zh.md +18 -0
  287. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.md +21 -0
  288. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.zh.md +21 -0
  289. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-adapters/guide.md +18 -0
  290. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-adapters/guide.zh.md +18 -0
  291. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-provider-strategy/guide.md +20 -0
  292. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-provider-strategy/guide.zh.md +20 -0
  293. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/ssh-helper-launch/guide.md +19 -0
  294. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/ssh-helper-launch/guide.zh.md +19 -0
  295. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-activations/guide.md +59 -0
  296. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-activations/guide.zh.md +59 -0
  297. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.md +21 -0
  298. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.zh.md +21 -0
  299. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +21 -0
  300. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +21 -0
  301. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/terminal-command-labels/guide.md +18 -0
  302. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/terminal-command-labels/guide.zh.md +18 -0
  303. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/tool-presentation-mode/guide.md +21 -0
  304. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/tool-presentation-mode/guide.zh.md +21 -0
  305. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/web-listener-trust-config/guide.md +36 -0
  306. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/web-listener-trust-config/guide.zh.md +36 -0
  307. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/working-directory/guide.md +25 -0
  308. package/kb/extra/upgrade-guide/v0.2.1-alpha.1/working-directory/guide.zh.md +25 -0
  309. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-identity-watch/guide.md +18 -0
  310. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-identity-watch/guide.zh.md +18 -0
  311. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-model-catalog/guide.md +27 -0
  312. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-model-catalog/guide.zh.md +27 -0
  313. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/desktop-font-size-shortcuts/guide.md +18 -0
  314. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/desktop-font-size-shortcuts/guide.zh.md +18 -0
  315. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/from-default-profile-replaces-target/guide.md +20 -0
  316. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/from-default-profile-replaces-target/guide.zh.md +20 -0
  317. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/operator-connect/guide.md +18 -0
  318. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/operator-connect/guide.zh.md +18 -0
  319. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-azure-provider/guide.md +19 -0
  320. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-azure-provider/guide.zh.md +19 -0
  321. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-model-discovery/guide.md +17 -0
  322. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-model-discovery/guide.zh.md +17 -0
  323. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-install-over-installed/guide.md +20 -0
  324. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-install-over-installed/guide.zh.md +20 -0
  325. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/sdk-minimal-image-compaction/guide.md +32 -0
  326. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/sdk-minimal-image-compaction/guide.zh.md +32 -0
  327. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/stored-credentials-precedence/guide.md +25 -0
  328. package/kb/extra/upgrade-guide/v0.2.1-alpha.2/stored-credentials-precedence/guide.zh.md +25 -0
  329. package/kb/extra/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/guide.md +21 -0
  330. package/kb/extra/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/guide.zh.md +21 -0
  331. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/account-notification-fields/guide.md +18 -0
  332. package/kb/extra/upgrade-guide/v0.2.1-alpha.4/account-notification-fields/guide.zh.md +18 -0
  333. package/kb/meta/search-index.json +1932 -366
  334. package/kb/meta/source.json +9 -8
  335. package/kb/site/develop/basic/publish.md +3 -1
  336. package/kb/site/en/develop/basic/publish.md +3 -1
  337. package/kb/site/en/guide/github-review.md +7 -10
  338. package/kb/site/en/guide/plugin-market.md +151 -0
  339. package/kb/site/en/guide/providers.md +27 -4
  340. package/kb/site/en/guide/public-deployments.md +10 -6
  341. package/kb/site/en/guide/python-sdk.md +8 -9
  342. package/kb/site/en/reference/api-gateway.md +10 -3
  343. package/kb/site/en/reference/capability-seams.md +71 -24
  344. package/kb/site/en/reference/config-catalog.md +452 -191
  345. package/kb/site/en/reference/experimental-persistence-catalog.md +20 -0
  346. package/kb/site/en/reference/index.md +11 -12
  347. package/kb/site/en/reference/persistence-catalog.md +552 -192
  348. package/kb/site/en/reference/subsystems/client-modules.md +14 -0
  349. package/kb/site/en/reference/subsystems/conversation.md +14 -0
  350. package/kb/site/en/reference/subsystems/core.md +3 -1
  351. package/kb/site/en/reference/subsystems/credentials.md +13 -12
  352. package/kb/site/en/reference/subsystems/index.md +4 -1
  353. package/kb/site/en/reference/subsystems/jobs.md +62 -7
  354. package/kb/site/en/reference/subsystems/llm-streaming.md +82 -15
  355. package/kb/site/en/reference/subsystems/persistence.md +2 -0
  356. package/kb/site/en/reference/subsystems/plan.md +1 -1
  357. package/kb/site/en/reference/subsystems/ptc-runtime.md +24 -6
  358. package/kb/site/en/reference/subsystems/session-query.md +2 -0
  359. package/kb/site/en/reference/subsystems/session-title.md +14 -5
  360. package/kb/site/en/reference/subsystems/session.md +59 -14
  361. package/kb/site/en/reference/subsystems/sidebar-right.md +2 -0
  362. package/kb/site/en/reference/subsystems/skills.md +2 -2
  363. package/kb/site/en/reference/subsystems/slots.md +80 -83
  364. package/kb/site/en/reference/subsystems/subagent.md +175 -247
  365. package/kb/site/en/reference/subsystems/system-prompt.md +32 -2
  366. package/kb/site/en/reference/subsystems/tools.md +3 -3
  367. package/kb/site/en/reference/subsystems/typert.md +222 -17
  368. package/kb/site/en/reference/subsystems/web-client.md +1 -1
  369. package/kb/site/en/reference/subsystems/web-server.md +87 -11
  370. package/kb/site/en/reference/subsystems/web.md +2 -2
  371. package/kb/site/en/reference/subsystems/workflow.md +1 -1
  372. package/kb/site/en/reference/subsystems/workspace.md +25 -37
  373. package/kb/site/en/reference/tool-catalog.md +156 -51
  374. package/kb/site/guide/github-review.md +7 -10
  375. package/kb/site/guide/plugin-market.md +151 -0
  376. package/kb/site/guide/providers.md +27 -4
  377. package/kb/site/guide/public-deployments.md +10 -6
  378. package/kb/site/guide/python-sdk.md +8 -9
  379. package/kb/site/reference/api-gateway.md +16 -3
  380. package/kb/site/reference/capability-seams.md +71 -24
  381. package/kb/site/reference/config-catalog.md +452 -191
  382. package/kb/site/reference/experimental-persistence-catalog.md +20 -0
  383. package/kb/site/reference/index.md +11 -12
  384. package/kb/site/reference/persistence-catalog.md +552 -192
  385. package/kb/site/reference/subsystems/client-modules.md +14 -0
  386. package/kb/site/reference/subsystems/conversation.md +16 -0
  387. package/kb/site/reference/subsystems/core.md +5 -1
  388. package/kb/site/reference/subsystems/credentials.md +13 -12
  389. package/kb/site/reference/subsystems/index.md +4 -1
  390. package/kb/site/reference/subsystems/jobs.md +62 -7
  391. package/kb/site/reference/subsystems/llm-streaming.md +82 -15
  392. package/kb/site/reference/subsystems/persistence.md +2 -0
  393. package/kb/site/reference/subsystems/plan.md +1 -1
  394. package/kb/site/reference/subsystems/ptc-runtime.md +24 -6
  395. package/kb/site/reference/subsystems/scope.md +2 -0
  396. package/kb/site/reference/subsystems/session-query.md +2 -0
  397. package/kb/site/reference/subsystems/session-title.md +14 -5
  398. package/kb/site/reference/subsystems/session.md +59 -14
  399. package/kb/site/reference/subsystems/sidebar-right.md +2 -0
  400. package/kb/site/reference/subsystems/skills.md +2 -2
  401. package/kb/site/reference/subsystems/slots.md +84 -83
  402. package/kb/site/reference/subsystems/subagent.md +177 -251
  403. package/kb/site/reference/subsystems/system-prompt.md +32 -2
  404. package/kb/site/reference/subsystems/tools.md +3 -3
  405. package/kb/site/reference/subsystems/typert.md +222 -17
  406. package/kb/site/reference/subsystems/web-client.md +1 -1
  407. package/kb/site/reference/subsystems/web-server.md +87 -11
  408. package/kb/site/reference/subsystems/web.md +2 -2
  409. package/kb/site/reference/subsystems/workflow.md +1 -1
  410. package/kb/site/reference/subsystems/workspace.md +25 -37
  411. package/kb/site/reference/tool-catalog.md +160 -55
  412. package/package.json +2 -2
  413. package/skills/dsh-dev-sandbox.md +67 -0
  414. package/kb/extra/defensive-patterns.md +0 -33
  415. package/kb/extra/defensive-patterns.zh.md +0 -35
@@ -0,0 +1,747 @@
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`/`projectContent`/`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 for native and nested 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
+ * Install execution-prepared content before `tools/post-execute` policies.
43
+ * The callback is captured when the call starts and runs once for a
44
+ * normalized outcome entering post-execute. Policy replacements remain
45
+ * authoritative; pipeline failures that bypass post-execute skip projection.
46
+ * @param exec - immutable execution identity and arguments.
47
+ * @param result - normalized result before post-execute policy.
48
+ * @returns replacement content, or undefined to preserve the renderer output.
49
+ */
50
+ projectContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
51
+ /**
52
+ * Synchronous last-mile transform for model-facing content. The registry
53
+ * snapshots this callback when execution starts and invokes it exactly once
54
+ * for every normalized outcome, including pipeline failures that bypass
55
+ * `tools/post-execute`, immediately before lossless materialization.
56
+ * Returning `undefined` preserves the content; every other result field
57
+ * remains registry-owned. The callback must be total and must not throw.
58
+ * @param exec - immutable execution identity and arguments.
59
+ * @param result - complete normalized outcome before materialization.
60
+ * @returns replacement content, or `undefined` to preserve it.
61
+ */
62
+ finalizeContent?(exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): ContentBlock[] | undefined
63
+ /**
64
+ * Cooperative tool-call timeout budget in milliseconds. Omit for no deadline.
65
+ * Enforced by `@deepseek-ai/dsh-tool-call-timeout-policy` (a `tools/execute` wrapper); it
66
+ * is NEVER sent to the model — `schemas()` whitelists only name/description/
67
+ * parameters. Declaring it asserts this tool forwards `exec.signal` to a
68
+ * cooperative implementation that can reach quiescence when the signal aborts.
69
+ */
70
+ timeoutMs?: number
71
+ /**
72
+ * Pure synchronous classifier for overlap with sibling tool calls. Only
73
+ * `true` opts in; omission, exceptions, non-`true` returns, and invalid
74
+ * `defineTool` arguments are exclusive. This metadata is never model-visible.
75
+ *
76
+ * Opted-in executions must not mutate parent-owned state. Shared state must
77
+ * tolerate concurrent dispatch; recorder races are permitted only when they
78
+ * commute or fail closed. See the
79
+ * [parallel-tool-call Agent Note](../../../../.agents/notes/implemented/feature/2026-07-10-parallel-tool-call-execution.md)
80
+ * for the full contract.
81
+ * @param args - parsed arguments; `defineTool` validates before calling.
82
+ * @returns Whether this call may join a parallel group.
83
+ */
84
+ isConcurrencySafe?(args: unknown): boolean
85
+ /**
86
+ * Optional: how to present the PENDING state of one call in a UI, derived from
87
+ * the call's `args` (parsed arguments, `unknown` — the tool validates/narrows
88
+ * its own input). Returns a {@link ToolCallView} (a `card`-tagged render intent),
89
+ * or `undefined` (or omit the method) to fall back to a generic presentation
90
+ * (title = tool name, raw args as input). Pure and side-effect-free: a UI may
91
+ * call it during live streaming AND a session-log replay, so it must depend
92
+ * only on `args`.
93
+ */
94
+ presentCall?(args: unknown): ToolCallView | undefined
95
+ /**
96
+ * Optional: how to present the COMPLETED state, given the same `args` and the
97
+ * durable result projection (`content`, failure state, and optional `meta`). Returns a
98
+ * {@link ToolResultView}, or `undefined` (or omit the method) to keep the
99
+ * pending title and render the raw result content. Pure and side-effect-free
100
+ * for the same replay reason.
101
+ */
102
+ presentResult?(args: unknown, result: ToolResult): ToolResultView | undefined
103
+ }
104
+ ```
105
+
106
+ `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.
107
+
108
+ ## The unified JSON-value schema DSL
109
+
110
+ 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.
111
+
112
+ Source: [`packages/core/tools/src/schema.ts`](../../packages/core/tools/src/schema.ts)
113
+
114
+ ```ts type-equiv
115
+ /** One author-facing schema for any lossless JSON value root. */
116
+ type ValueSchemaSpec =
117
+ | StringValueSchemaSpec
118
+ | NumberValueSchemaSpec
119
+ | IntegerValueSchemaSpec
120
+ | BooleanValueSchemaSpec
121
+ | NullValueSchemaSpec
122
+ | ArrayValueSchemaSpec
123
+ | ObjectValueSchemaSpec
124
+ | JsonValueSchemaSpec
125
+ | OneOfValueSchemaSpec
126
+ ```
127
+
128
+ ```ts type-equiv
129
+ /** One implicit parameter-root property, optionally required. */
130
+ type ParameterPropertySpec = ValueSchemaSpec & { required?: true }
131
+ ```
132
+
133
+ ```ts type-equiv
134
+ /**
135
+ * Tool parameter schema. The map itself is an implicit open object root;
136
+ * requiredness remains a per-property `required: true` annotation.
137
+ */
138
+ type ParameterSchemaSpec = {
139
+ [key: string]: ParameterPropertySpec
140
+ [key: symbol]: never
141
+ }
142
+ ```
143
+
144
+ `{ 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:
145
+
146
+ ```ts type-equiv
147
+ /**
148
+ * Infer the TypeScript value accepted by an author-facing value schema. Exact
149
+ * inference is bounded to 16 container levels, then falls back to `JsonValue`.
150
+ */
151
+ type InferValue<S> = InferValueAt<S, []>
152
+ ```
153
+
154
+ ```ts type-equiv
155
+ /** Infer the TypeScript argument object for an implicit parameter schema. */
156
+ type InferArgs<S> = InferProperties<S, []>
157
+ ```
158
+
159
+ `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.
160
+
161
+ 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.
162
+
163
+ ## `ToolRestriction` — one scope's live filter over what it inherits
164
+
165
+ `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.
166
+
167
+ ```ts type-equiv
168
+ /**
169
+ * Per-scope filter over global tools. Restrictions intersect and do not affect
170
+ * scoped registrations or the reserved PTC mode transport.
171
+ */
172
+ interface ToolRestriction {
173
+ /** Global tool names that stay visible; everything else is removed. */
174
+ readonly allow?: readonly string[]
175
+ /** Global tool names removed from visibility. */
176
+ readonly deny?: readonly string[]
177
+ }
178
+ ```
179
+
180
+ ## Execution: extensible waterfalls plus monotonic policy
181
+
182
+ `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) → `projectContent` → `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`.
183
+
184
+ ```ts type-equiv
185
+ /** Opaque call identity that permits correlation without exposing mutable execution state. */
186
+ type ToolExecutionToken = symbol & { readonly [toolExecutionTokenBrand]: true }
187
+ ```
188
+
189
+ ```ts type-equiv
190
+ /**
191
+ * Caller-supplied description of one tool call. {@link ToolRuntime.execute}
192
+ * adds the registry-owned token to form a pipeline {@link ToolExecution};
193
+ * callers do not choose that token.
194
+ */
195
+ interface ToolExecutionInput {
196
+ readonly callId: ToolCallId
197
+ /**
198
+ * Root model-requested call owning this execution tree. Callers omit it for
199
+ * a root execution; nested dispatchers propagate the enclosing value.
200
+ */
201
+ readonly rootCallId?: ToolCallId
202
+ readonly name: string
203
+ /** Binding-time tool schema for a PTC inner call; frozen by its producer and never logged. */
204
+ readonly schema?: ToolSchema
205
+ /** Losslessly JSON-serializable parsed arguments (tools validate their own schema). */
206
+ readonly arguments: unknown
207
+ /** The agent on whose behalf the call runs (set by the agent loop). */
208
+ readonly agent?: Agent
209
+ /**
210
+ * Opaque token of the enclosing transport execution, when one exists. PTC
211
+ * mode sets this on SDK sub-dispatches so commit-style observers can wait for
212
+ * the outer `run_code` outcome without receiving its live mutable execution.
213
+ * The token also marks the call as a transport sub-dispatch rather than a
214
+ * model-direct call: under `mode: 'ptc'`, only calls WITH a parent may
215
+ * execute a native tool name — a model-direct call (no parent) is denied as
216
+ * `UNKNOWN_TOOL` before the policy pipeline. See {@link ToolRuntime.execute}.
217
+ */
218
+ readonly parent?: ToolExecutionToken
219
+ /** Required caller-owned cancellation for this invocation. */
220
+ readonly signal: AbortSignal
221
+ }
222
+ ```
223
+
224
+ 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.
225
+
226
+ ```ts type-equiv
227
+ /**
228
+ * Runtime context handed to a tool implementation after the registry has
229
+ * accepted a {@link ToolExecution}. {@link deferContext} attaches context to
230
+ * this execution's own result — a composite tool ferries nested-dispatch
231
+ * context back to the outer result, and a leaf tool may mint a fresh
232
+ * plugin-sourced instruction; the loop appends it only after the
233
+ * `tool/result`.
234
+ */
235
+ interface ToolRunContext extends ToolExecution {
236
+ /**
237
+ * Defer one context — typically a nested-dispatch context ferried by a
238
+ * composite tool, or a fresh plugin-sourced instruction — until this tool's
239
+ * final result reaches the agent loop. Contexts retain their individual
240
+ * source and metadata and are emitted in call order.
241
+ */
242
+ deferContext(context: UserMessage): void
243
+ /**
244
+ * Mark a successful final result as terminal for the current agent turn.
245
+ * The marker rides this execution's own result (`concludesTurn` exists only
246
+ * on {@link ToolExecutionSuccess}); a composite that dispatches nested
247
+ * calls forwards it from the nested result, exactly like
248
+ * `additionalContexts`, so only an authoritative nested success can
249
+ * conclude the enclosing run.
250
+ */
251
+ concludeTurn(): void
252
+ }
253
+ ```
254
+
255
+ 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:
256
+
257
+ ```ts type-equiv
258
+ /**
259
+ * Scheduling mode for one pending call. `parallel` may overlap with siblings;
260
+ * `exclusive` runs alone and forms an ordering barrier.
261
+ */
262
+ type ToolExecutionMode =
263
+ | { kind: 'parallel' }
264
+ | { kind: 'exclusive' }
265
+ ```
266
+
267
+ PTC bindings freeze their ToolSchema at construction and pass it through the scheduler into `ToolExecution.schema`; it is transient execution metadata. Before policy, each actually started sub-dispatch records only pairing ids, name, and normalized arguments. Neither start nor settle events serialize description, parameters, or schema. The bridge later exposes the settled call to the `tools/ptc-dispatch-log` waterfall, which may change the durable content copy while preserving the program value, model-visible outer result, and structured failure identity:
268
+
269
+ ```ts type-equiv
270
+ /**
271
+ * One settled `run_code` sub-dispatch about to be logged, as seen by the
272
+ * `tools/ptc-dispatch-log` waterfall: the parent execution (session owner,
273
+ * outer call identity), the sub-call identity, and the outcome whose durable
274
+ * copy a listener may reshape. `content` is the RENDERED result projection
275
+ * (what a native `tool/result` would carry) — the program itself received
276
+ * the structured `value` (or just the error message on failure); only the
277
+ * `tool/ptc-dispatch` event's copy changes.
278
+ */
279
+ interface PtcDispatchLog {
280
+ /** The outer `run_code` execution. */
281
+ readonly exec: ToolExecution
282
+ /** The calling agent (the scope routing key and the spill owner), when the outer call has one. */
283
+ readonly agent?: Agent
284
+ /** Opaque sub-call id; new calls use `<parent>:ptc:<n>`. */
285
+ readonly subCallId: ToolCallId
286
+ /** The dispatched sub-tool name. */
287
+ readonly name: string
288
+ /** Whether the sub-call settled as an error. */
289
+ readonly isError: boolean
290
+ /** The sub-call's complete model-facing content (the settle event's default payload). */
291
+ readonly content: ContentBlock[]
292
+ }
293
+ ```
294
+
295
+ ```ts type-equiv
296
+ /**
297
+ * One pending tool call inside the registry pipeline. Parsed arguments cross
298
+ * one lossless-JSON materialization boundary before policy and are deep-frozen;
299
+ * call identity, the caller signal, and the registry-assigned {@link token} are
300
+ * readonly. The registry freezes the complete object before `tools/result`
301
+ * observers run.
302
+ */
303
+ interface ToolExecution extends ToolExecutionInput {
304
+ /** Root model-requested call, resolved for every root and nested execution. */
305
+ readonly rootCallId: ToolCallId
306
+ /** Registry-assigned identity shared with nested calls only as their opaque `parent` token. */
307
+ readonly token: ToolExecutionToken
308
+ }
309
+ ```
310
+
311
+ ```ts type-equiv
312
+ /**
313
+ * Around-dispatch view of a {@link ToolExecution}. A `tools/execute` wrapper
314
+ * may replace the signal for its delegated lifetime, but it cannot remove it.
315
+ * The registry fuses every replacement with the captured caller signal.
316
+ */
317
+ interface ToolDispatchExecution extends Omit<ToolExecution, 'signal'> {
318
+ /** Cancellation signal visible to the next wrapper or tool body. */
319
+ signal: AbortSignal
320
+ }
321
+ ```
322
+
323
+ `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.
324
+
325
+ 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.
326
+
327
+ ```ts type-equiv
328
+ /**
329
+ * A monotonic execution guard evaluated after every `tools/pre-execute`
330
+ * listener and before the tool body. Returning a reason denies the call;
331
+ * returning `undefined` leaves it unchanged. Because guards have no allow
332
+ * result, listener ordering cannot turn a denial back into permission.
333
+ * @param execution - the identity-protected call after extensible pre-execute policy completed.
334
+ * @returns a final denial reason, or `undefined` to leave the call allowed.
335
+ */
336
+ type ToolGuard = (execution: Readonly<ToolExecution>) => string | undefined
337
+ ```
338
+
339
+ ```ts type-equiv
340
+ /** Canonical failure detail; internal routing information remains optional. */
341
+ interface ToolFailure {
342
+ /** Human-readable failure message without the Native `Error: ` envelope. */
343
+ message: string
344
+ /** Internal error class/code used by policy and durable diagnostics. */
345
+ info?: ToolErrorInfo
346
+ }
347
+ ```
348
+
349
+ ```ts type-equiv
350
+ /** Successful canonical tool execution, including its Native/model projection. */
351
+ interface ToolExecutionSuccess {
352
+ readonly isError: false
353
+ /** Execution-local canonical value; deliberately omitted from durable events. */
354
+ readonly value: JsonValue
355
+ readonly content: ContentBlock[]
356
+ readonly error?: never
357
+ readonly meta?: JsonValue
358
+ readonly additionalContexts?: UserMessage[]
359
+ /** The agent loop stops after committing this successful result batch. */
360
+ readonly concludesTurn?: true
361
+ }
362
+ ```
363
+
364
+ ```ts type-equiv
365
+ /** Failed canonical tool execution; failures never carry a successful value. */
366
+ interface ToolExecutionFailure {
367
+ readonly isError: true
368
+ readonly error: ToolFailure
369
+ readonly value?: never
370
+ readonly content: ContentBlock[]
371
+ readonly meta?: JsonValue
372
+ readonly additionalContexts?: UserMessage[]
373
+ readonly concludesTurn?: never
374
+ }
375
+ ```
376
+
377
+ ```ts type-equiv
378
+ /** The discriminated, execution-local outcome of one tool call. */
379
+ type ToolExecutionResult = ToolExecutionSuccess | ToolExecutionFailure
380
+ ```
381
+
382
+ ```ts type-equiv
383
+ /** Structured error metadata for a failed tool call (alongside the model-facing text). */
384
+ interface ToolErrorInfo {
385
+ name: string
386
+ code: string
387
+ /** Optional raw user-facing detail; durable projections preserve it but model-facing content does not include it. */
388
+ reason?: string
389
+ }
390
+ ```
391
+
392
+ 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/ptc-dispatch` stores the sub-call's rendered `content`, `isError`, optional structured `error`, and presentation `meta`. Replay reproduces presentation but cannot reconstruct canonical intermediate values. Optional `ToolErrorInfo.reason` retains raw user-facing detail without adding it to model-facing content.
393
+
394
+ On success the registry snapshots and validates the body value, freezes it, and invokes the pure renderer plus the optional presentation metadata projector for native and nested calls. 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.
395
+
396
+ 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.
397
+
398
+ 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`:
399
+
400
+ ```ts type-equiv
401
+ /**
402
+ * Pre-dispatch decision. `allow` runs the call; `deny` materializes its
403
+ * model-facing reason and optional structured error identity; `cancel` selects
404
+ * the canonical cancellation result without presenting a policy denial; `ask`
405
+ * runs only after an approval service returns `allowed-once` and otherwise
406
+ * denies; its `reason` is the audited approval reason and its optional
407
+ * `displayReason` is the localized prompt text. Input rewriting is excluded because arguments are already logged and
408
+ * presented.
409
+ */
410
+ type PreToolDecision =
411
+ | { kind: 'allow' }
412
+ | { kind: 'deny'; reason: string; info?: ToolErrorInfo }
413
+ | { kind: 'cancel' }
414
+ | { kind: 'ask'; reason?: string; displayReason?: { readonly en: string; readonly [locale: string]: string } }
415
+ ```
416
+
417
+ ```ts type-equiv
418
+ /**
419
+ * Post-dispatch decision: accept, replace one projection, attach context for the
420
+ * next request, or block by turning corrective feedback into an error result.
421
+ */
422
+ type PostToolDecision =
423
+ | { kind: 'accept'; content?: ContentBlock[]; value?: never; additionalContexts?: UserMessage[] }
424
+ | { kind: 'accept'; value: JsonValue; content?: never; additionalContexts?: UserMessage[] }
425
+ | { kind: 'block'; feedback: ContentBlock[]; additionalContexts?: UserMessage[] }
426
+ ```
427
+
428
+ 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. A deny may attach structured identity and user-facing detail without changing its model-facing reason. Guards may still impose a final denial. Arguments cannot be rewritten because history, audit, UI, and execution must agree.
429
+
430
+ 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.
431
+
432
+ ## The enforced raw JSON Schema subset
433
+
434
+ 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.
435
+
436
+ ```ts type-equiv
437
+ /** Scalar JSON values supported by `enum` and `const`. */
438
+ type JsonSchemaScalar = string | number | boolean | null
439
+ ```
440
+
441
+ ```ts type-equiv
442
+ /** Single-type keywords accepted by the enforced subset. */
443
+ type JsonSchemaType = 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null'
444
+ ```
445
+
446
+ ```ts type-equiv
447
+ /**
448
+ * One raw JSON Schema node in the enforced subset. The optional fields express
449
+ * the external wire schema; {@link assertSupportedJsonSchema} rejects invalid
450
+ * combinations before a caller treats the node as trusted.
451
+ */
452
+ interface JsonSchemaNode {
453
+ /** Omit with no constraints for any JSON value, or use `oneOf`. */
454
+ type?: JsonSchemaType
455
+ /** Exactly one branch must validate; at least two branches are required. */
456
+ oneOf?: JsonSchemaNode[]
457
+ /** Nested property schemas (`type: 'object'` only). */
458
+ properties?: Record<string, JsonSchemaNode>
459
+ /** Required property names; each must appear in `properties`. */
460
+ required?: string[]
461
+ /** `false` rejects undeclared keys; absent/`true` follows JSON Schema's open default. */
462
+ additionalProperties?: boolean
463
+ /** Item schema (`type: 'array'` only); absent accepts any JSON item. */
464
+ items?: JsonSchemaNode
465
+ /** Allowed values for a scalar node. */
466
+ enum?: JsonSchemaScalar[]
467
+ /** The single allowed value for a scalar node. */
468
+ const?: JsonSchemaScalar
469
+ /** Annotation, ignored for validation. */
470
+ description?: string
471
+ /** Annotation, ignored for validation. */
472
+ title?: string
473
+ /** Annotation, ignored for validation but required to be lossless JSON. */
474
+ default?: JsonValue
475
+ /** Annotation, ignored for validation but required to be lossless JSON. */
476
+ examples?: JsonValue
477
+ }
478
+ ```
479
+
480
+ ```ts type-equiv
481
+ /** A consumer-constrained object-rooted schema. */
482
+ type ObjectJsonSchema = JsonSchemaNode & { type: 'object' }
483
+ ```
484
+
485
+ ## Tool-presentation UI vocabulary
486
+
487
+ 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:
488
+
489
+ - `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).
490
+ - `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`).
491
+
492
+ `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.
493
+
494
+ 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).
495
+
496
+ <!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
497
+
498
+ <a id="cordis-surface"></a>
499
+
500
+ ## Cordis API
501
+
502
+ Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
503
+
504
+ <a id="ctxtools--toolruntime"></a>
505
+
506
+ ### `ctx.tools` — `ToolRuntime`
507
+
508
+ Tool registry and execution pipeline. Scoped registrations shadow globals; one visibility resolver feeds presentation, lookup, and dispatch.
509
+
510
+ ```ts cordis-catalog
511
+ /**
512
+ * Present the calling scope's tools in `mode` instead of the deployment
513
+ * default. Nearest scope on the chain wins, so a preset's standing
514
+ * declaration covers every agent joined under it.
515
+ *
516
+ * Scoped only, and one declaration per scope: this is how an agent preset
517
+ * composes PTC mode agents beside native ones in the same process, and a
518
+ * process-global override would be the `mode` config field instead.
519
+ * @param mode - the presentation the covered agents' models see.
520
+ * @returns the exact disposer that restores the deployment default.
521
+ */
522
+ presentAs(mode: ToolPresentationMode): () => void
523
+
524
+ /**
525
+ * Register globally or in the calling agent scope. Scoped tools shadow
526
+ * globals; duplicates within one layer and the reserved `run_code` name fail.
527
+ * @param definition - tool schema, execution, and optional finalization/presentation callbacks.
528
+ * @returns the exact disposer that unregisters the tool.
529
+ */
530
+ register(definition: ToolDefinition): () => void
531
+
532
+ /**
533
+ * Restrict global tools for the calling agent scope. Empty filters, unknown
534
+ * names, scope-local names, and reserved transport names fail. Restrictions
535
+ * intersect; scoped registrations remain visible.
536
+ * @param filter - global-tool mask: `allow` (keep only) and/or `deny` (remove).
537
+ * @returns the exact disposer that lifts this restriction.
538
+ */
539
+ restrict(filter: ToolRestriction): () => void
540
+
541
+ /**
542
+ * Register a monotonic guard after the extensible `tools/pre-execute`
543
+ * waterfall. A plain-context guard applies globally; one registered through
544
+ * `agent.ctx` applies only to that agent. Any matching guard may deny by
545
+ * returning a reason, while no guard can force-allow a call another guard
546
+ * denied. The exact effect disposer is returned for ordered ownership and
547
+ * HMR cleanup.
548
+ * @param guard - synchronous check; a returned string denies the execution.
549
+ * @returns the exact disposer that unregisters the guard.
550
+ */
551
+ guard(guard: ToolGuard): () => void
552
+
553
+ /**
554
+ * Look up a tool as one scope sees it (scoped
555
+ * shadows global; a restricted-away global reads as absent). Presenters pass
556
+ * the calling agent so the rendered card matches the definition that
557
+ * actually executed.
558
+ * @param name - the tool name as registered.
559
+ * @param scope - the viewing scope (the agent); omitted = the global view.
560
+ * @returns the definition the scope resolves, or undefined when none is visible.
561
+ */
562
+ get(name: string, scope?: ScopeKey): ToolDefinition | undefined
563
+
564
+ /**
565
+ * Project visible definitions onto the allowlisted model-facing schema fields,
566
+ * excluding execution and presentation callbacks.
567
+ * @param scope - the viewing scope (the agent); omitted = the global view.
568
+ * @returns one deep-cloned schema per visible tool.
569
+ */
570
+ schemas(scope?: ScopeKey): ToolSchema[]
571
+
572
+ /**
573
+ * Classify a pending call through the caller's visible tool definition. Only
574
+ * an exact `true` is parallel; unknown, hidden, undeclared, invalid, or
575
+ * throwing classifiers are exclusive.
576
+ * @param exec - call name, parsed arguments, and optional agent scope.
577
+ * @returns the fail-closed scheduling mode.
578
+ */
579
+ executionMode(exec: ToolExecutionInput): ToolExecutionMode
580
+
581
+ /**
582
+ * Execute through pre-policy, guards, around-dispatch, post-policy,
583
+ * definition-owned content finalization, and final notification. Tool and
584
+ * listener failures resolve as materialized error results; an invisible tool
585
+ * reports `UNKNOWN_TOOL`. The returned outcome is the same lossless, frozen
586
+ * snapshot final observers receive. Cancellation
587
+ * arriving after entry and before final result materialization skips a
588
+ * not-yet-started body with `ABORTED_BEFORE_DISPATCH` or replaces a
589
+ * successful started outcome with `ABORTED`; already-started work is still
590
+ * drained and may retain a tool-owned structured error.
591
+ * @param exec - the typed same-process call input. The registry assigns its
592
+ * correlation token before policy begins.
593
+ * @returns the materialized final result.
594
+ */
595
+ async execute(exec: ToolExecutionInput): Promise<ToolExecutionResult>
596
+ ```
597
+
598
+ Types: [ScopeKey](scope.md)
599
+
600
+ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts)
601
+
602
+ <a id="tools-events"></a>
603
+
604
+ ### `tools/*` events
605
+
606
+ <a id="toolschange--emit"></a>
607
+
608
+ #### `tools/change` — emit
609
+
610
+ 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.
611
+
612
+ ```ts cordis-catalog
613
+ /**
614
+ * A tool was registered or unregistered, or a scoped restriction changed
615
+ * (the available tool set changed — possibly for one scope only). An
616
+ * UNFILTERED registry-subject notification, deliberately not scope-filtered
617
+ * dispatch: a global change concerns every agent's next assembly, so a
618
+ * scoped listener subscribing here sees every change, not just its own
619
+ * scope's.
620
+ * @mode emit
621
+ */
622
+ 'tools/change'(): void
623
+ ```
624
+
625
+ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts)
626
+
627
+ <a id="toolsexecute--waterfall"></a>
628
+
629
+ #### `tools/execute` — waterfall
630
+
631
+ 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.
632
+
633
+ ```ts cordis-catalog
634
+ /**
635
+ * Around-dispatch waterfall for timeout, retry, or metrics. `next()` returns
636
+ * a normalized result; wrappers may change only `exec.signal`, while call
637
+ * identity remains immutable. The registry re-fuses the original caller
638
+ * signal before the body, so replacement cannot detach caller cancellation;
639
+ * wrappers must still restore their signal and reach quiescence.
640
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
641
+ * @param exec - the allowed call about to dispatch (name, parsed arguments, caller agent, signal).
642
+ * @mode waterfall
643
+ */
644
+ 'tools/execute'(this: Scoped<ToolRuntime>, exec: ToolDispatchExecution, next: () => Promise<ToolExecutionResult>): Promise<ToolExecutionResult>
645
+ ```
646
+
647
+ Types: [Scoped](scope.md)
648
+
649
+ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts)
650
+
651
+ <a id="toolspost-execute--waterfall"></a>
652
+
653
+ #### `tools/post-execute` — waterfall
654
+
655
+ 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.
656
+
657
+ ```ts cordis-catalog
658
+ /**
659
+ * Accept, replace, enrich, or block a normalized dispatch result. `next()`
660
+ * accepts it unchanged; thrown tools still reach this waterfall as errors. Async
661
+ * listeners must observe `exec.signal`; after they settle, caller
662
+ * cancellation replaces only a successful accepted outcome with the code
663
+ * selected by whether the tool body was invoked.
664
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's calls.
665
+ * @param exec - the call that just ran (name, parsed arguments, caller agent).
666
+ * @param result - the dispatch outcome a listener may accept, replace, or block.
667
+ * @mode waterfall
668
+ */
669
+ 'tools/post-execute'(this: Scoped<ToolRuntime>, exec: ToolExecution, result: Readonly<ToolExecutionResult>, next: () => Promise<PostToolDecision>): Promise<PostToolDecision>
670
+ ```
671
+
672
+ Types: [Scoped](scope.md)
673
+
674
+ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts)
675
+
676
+ <a id="toolspre-execute--waterfall"></a>
677
+
678
+ #### `tools/pre-execute` — waterfall
679
+
680
+ Allow, deny, cancel, or ask before dispatch. `next()` delegates to allow; `cancel` selects the canonical pre-dispatch cancellation result, and 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.
681
+
682
+ ```ts cordis-catalog
683
+ /**
684
+ * Allow, deny, cancel, or ask before dispatch. `next()` delegates to allow;
685
+ * `cancel` selects the canonical pre-dispatch cancellation result, and 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`](../../packages/core/tools/src/index.ts)
699
+
700
+ <a id="toolsptc-dispatch-log--waterfall"></a>
701
+
702
+ #### `tools/ptc-dispatch-log` — waterfall
703
+
704
+ Allow a listener to replace content in the DURABLE LOG COPY of one `run_code` sub-dispatch outcome before the bridge appends its `tool/ptc-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.
705
+
706
+ ```ts cordis-catalog
707
+ /**
708
+ * Allow a listener to replace content in the DURABLE LOG COPY of one
709
+ * `run_code` sub-dispatch outcome before the bridge appends its
710
+ * `tool/ptc-dispatch` event. `next()` keeps the
711
+ * content unchanged; a listener may return replacement blocks (e.g. the
712
+ * spill policy's preview + locator for an oversized text result). Only the
713
+ * logged copy is affected — the program already received the complete
714
+ * value, and the model sees neither. A throwing listener is contained:
715
+ * the bridge falls back to logging the original settled content.
716
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): agent-scoped listeners receive only that agent's dispatches.
717
+ * @param dispatch - the parent execution, sub-call identity, and the settled content to log.
718
+ * @mode waterfall
719
+ */
720
+ 'tools/ptc-dispatch-log'(this: Scoped<ToolRuntime>, dispatch: PtcDispatchLog, next: () => Promise<ContentBlock[]>): Promise<ContentBlock[]>
721
+ ```
722
+
723
+ Types: [ContentBlock](llm-streaming.md) · [Scoped](scope.md)
724
+
725
+ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts)
726
+
727
+ <a id="toolsresult--emit"></a>
728
+
729
+ #### `tools/result` — emit
730
+
731
+ Observe the frozen, lossless-JSON final outcome. Listener failures are contained. Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): keyed by `exec.agent`.
732
+
733
+ ```ts cordis-catalog
734
+ /**
735
+ * Observe the frozen, lossless-JSON final outcome. Listener failures are contained.
736
+ * Scope-filtered dispatch (`@deepseek-ai/dsh-scope`): keyed by `exec.agent`.
737
+ * @param exec - the execution object that traversed the pipeline.
738
+ * @param result - a deep-frozen snapshot of the final returned result.
739
+ * @mode emit
740
+ */
741
+ 'tools/result'(this: Scoped<ToolRuntime>, exec: Readonly<ToolExecution>, result: Readonly<ToolExecutionResult>): undefined
742
+ ```
743
+
744
+ Types: [Scoped](scope.md)
745
+
746
+ Source: [`packages/core/tools/src/index.ts`](../../packages/core/tools/src/index.ts)
747
+ <!-- END GENERATED cordis-surface -->