@try-works/dsh-tool-mode 0.0.0-stage → 0.5.45

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 (432) hide show
  1. package/LICENSE +205 -0
  2. package/README.md +303 -2
  3. package/bin/dsh-tool-mode-credentials.mjs +20 -0
  4. package/bin/dsh-tool-mode-mcp-stdio.mjs +80 -0
  5. package/bin/dsh-tool-mode.mjs +211 -0
  6. package/builtins.lock.json +26 -0
  7. package/catalog/desert-ant-models.json +693 -0
  8. package/catalog/playbooks.json +531 -0
  9. package/client/client.model-tools.js +1910 -0
  10. package/client/index.js +4158 -0
  11. package/cordis.patch.yml +39 -0
  12. package/lib/adapters/index.d.ts +61 -0
  13. package/lib/adapters/index.d.ts.map +1 -0
  14. package/lib/adapters/index.js +82 -0
  15. package/lib/adapters/types.d.ts +106 -0
  16. package/lib/adapters/types.d.ts.map +1 -0
  17. package/lib/adapters/types.js +85 -0
  18. package/lib/approval.d.ts +189 -0
  19. package/lib/approval.d.ts.map +1 -0
  20. package/lib/approval.js +510 -0
  21. package/lib/asset-acquisition.d.ts +149 -0
  22. package/lib/asset-acquisition.d.ts.map +1 -0
  23. package/lib/asset-acquisition.js +175 -0
  24. package/lib/authority.d.ts +185 -0
  25. package/lib/authority.d.ts.map +1 -0
  26. package/lib/authority.js +223 -0
  27. package/lib/bindings.d.ts +144 -0
  28. package/lib/bindings.d.ts.map +1 -0
  29. package/lib/bindings.js +314 -0
  30. package/lib/builtins.d.ts +27 -0
  31. package/lib/builtins.d.ts.map +1 -0
  32. package/lib/builtins.js +37 -0
  33. package/lib/capability.d.ts +58 -0
  34. package/lib/capability.d.ts.map +1 -0
  35. package/lib/capability.js +192 -0
  36. package/lib/capture-path.d.ts +97 -0
  37. package/lib/capture-path.d.ts.map +1 -0
  38. package/lib/capture-path.js +152 -0
  39. package/lib/catalog.d.ts +37 -0
  40. package/lib/catalog.d.ts.map +1 -0
  41. package/lib/catalog.js +274 -0
  42. package/lib/contract-payload.d.ts +39 -0
  43. package/lib/contract-payload.d.ts.map +1 -0
  44. package/lib/contract-payload.js +56 -0
  45. package/lib/custom-tools/compile.d.ts +25 -0
  46. package/lib/custom-tools/compile.d.ts.map +1 -0
  47. package/lib/custom-tools/compile.js +61 -0
  48. package/lib/custom-tools/composite-executor.d.ts +42 -0
  49. package/lib/custom-tools/composite-executor.d.ts.map +1 -0
  50. package/lib/custom-tools/composite-executor.js +113 -0
  51. package/lib/custom-tools/dispatch.d.ts +28 -0
  52. package/lib/custom-tools/dispatch.d.ts.map +1 -0
  53. package/lib/custom-tools/dispatch.js +34 -0
  54. package/lib/custom-tools/http-executor.d.ts +48 -0
  55. package/lib/custom-tools/http-executor.d.ts.map +1 -0
  56. package/lib/custom-tools/http-executor.js +241 -0
  57. package/lib/custom-tools/index.d.ts +12 -0
  58. package/lib/custom-tools/index.d.ts.map +1 -0
  59. package/lib/custom-tools/index.js +12 -0
  60. package/lib/custom-tools/mcp-surface.d.ts +14 -0
  61. package/lib/custom-tools/mcp-surface.d.ts.map +1 -0
  62. package/lib/custom-tools/mcp-surface.js +41 -0
  63. package/lib/custom-tools/prompt-executor.d.ts +39 -0
  64. package/lib/custom-tools/prompt-executor.d.ts.map +1 -0
  65. package/lib/custom-tools/prompt-executor.js +59 -0
  66. package/lib/custom-tools/registry.d.ts +69 -0
  67. package/lib/custom-tools/registry.d.ts.map +1 -0
  68. package/lib/custom-tools/registry.js +130 -0
  69. package/lib/custom-tools/schema.d.ts +26 -0
  70. package/lib/custom-tools/schema.d.ts.map +1 -0
  71. package/lib/custom-tools/schema.js +375 -0
  72. package/lib/custom-tools/service.d.ts +90 -0
  73. package/lib/custom-tools/service.d.ts.map +1 -0
  74. package/lib/custom-tools/service.js +203 -0
  75. package/lib/custom-tools/store.d.ts +61 -0
  76. package/lib/custom-tools/store.d.ts.map +1 -0
  77. package/lib/custom-tools/store.js +240 -0
  78. package/lib/custom-tools/types.d.ts +131 -0
  79. package/lib/custom-tools/types.d.ts.map +1 -0
  80. package/lib/custom-tools/types.js +11 -0
  81. package/lib/decision-combine.d.ts +113 -0
  82. package/lib/decision-combine.d.ts.map +1 -0
  83. package/lib/decision-combine.js +156 -0
  84. package/lib/decision-evaluate.d.ts +185 -0
  85. package/lib/decision-evaluate.d.ts.map +1 -0
  86. package/lib/decision-evaluate.js +227 -0
  87. package/lib/deployment-coordinator.d.ts +213 -0
  88. package/lib/deployment-coordinator.d.ts.map +1 -0
  89. package/lib/deployment-coordinator.js +274 -0
  90. package/lib/diagnostics.d.ts +169 -0
  91. package/lib/diagnostics.d.ts.map +1 -0
  92. package/lib/diagnostics.js +136 -0
  93. package/lib/discovery-contracts.d.ts +14 -0
  94. package/lib/discovery-contracts.d.ts.map +1 -0
  95. package/lib/discovery-contracts.js +90 -0
  96. package/lib/discovery-describe.d.ts +35 -0
  97. package/lib/discovery-describe.d.ts.map +1 -0
  98. package/lib/discovery-describe.js +99 -0
  99. package/lib/embedding-index.d.ts +55 -0
  100. package/lib/embedding-index.d.ts.map +1 -0
  101. package/lib/embedding-index.js +126 -0
  102. package/lib/extension-dependencies.d.ts +355 -0
  103. package/lib/extension-dependencies.d.ts.map +1 -0
  104. package/lib/extension-dependencies.js +987 -0
  105. package/lib/extension-dispatch.d.ts +150 -0
  106. package/lib/extension-dispatch.d.ts.map +1 -0
  107. package/lib/extension-dispatch.js +178 -0
  108. package/lib/extension-page-state.d.ts +69 -0
  109. package/lib/extension-page-state.d.ts.map +1 -0
  110. package/lib/extension-page-state.js +82 -0
  111. package/lib/extension-registrar.d.ts +116 -0
  112. package/lib/extension-registrar.d.ts.map +1 -0
  113. package/lib/extension-registrar.js +144 -0
  114. package/lib/extensions-api.d.ts +346 -0
  115. package/lib/extensions-api.d.ts.map +1 -0
  116. package/lib/extensions-api.js +17 -0
  117. package/lib/extensions-remote.d.ts +57 -0
  118. package/lib/extensions-remote.d.ts.map +1 -0
  119. package/lib/extensions-remote.js +69 -0
  120. package/lib/extensions-service.d.ts +568 -0
  121. package/lib/extensions-service.d.ts.map +1 -0
  122. package/lib/extensions-service.js +2552 -0
  123. package/lib/harness-budgets.d.ts +158 -0
  124. package/lib/harness-budgets.d.ts.map +1 -0
  125. package/lib/harness-budgets.js +152 -0
  126. package/lib/harness-llm.d.ts +138 -0
  127. package/lib/harness-llm.d.ts.map +1 -0
  128. package/lib/harness-llm.js +218 -0
  129. package/lib/harness-serving.d.ts +115 -0
  130. package/lib/harness-serving.d.ts.map +1 -0
  131. package/lib/harness-serving.js +176 -0
  132. package/lib/headless.d.ts +97 -0
  133. package/lib/headless.d.ts.map +1 -0
  134. package/lib/headless.js +407 -0
  135. package/lib/http-acquisition.d.ts +27 -0
  136. package/lib/http-acquisition.d.ts.map +1 -0
  137. package/lib/http-acquisition.js +140 -0
  138. package/lib/index.d.ts +546 -0
  139. package/lib/index.d.ts.map +1 -0
  140. package/lib/index.js +5273 -0
  141. package/lib/invocation-accounting.d.ts +169 -0
  142. package/lib/invocation-accounting.d.ts.map +1 -0
  143. package/lib/invocation-accounting.js +148 -0
  144. package/lib/jev.d.ts +218 -0
  145. package/lib/jev.d.ts.map +1 -0
  146. package/lib/jev.js +366 -0
  147. package/lib/legacy-migration.d.ts +95 -0
  148. package/lib/legacy-migration.d.ts.map +1 -0
  149. package/lib/legacy-migration.js +429 -0
  150. package/lib/license-basis.d.ts +29 -0
  151. package/lib/license-basis.d.ts.map +1 -0
  152. package/lib/license-basis.js +58 -0
  153. package/lib/managed-workers.d.ts +158 -0
  154. package/lib/managed-workers.d.ts.map +1 -0
  155. package/lib/managed-workers.js +269 -0
  156. package/lib/mcp/auth-selection.d.ts +35 -0
  157. package/lib/mcp/auth-selection.d.ts.map +1 -0
  158. package/lib/mcp/auth-selection.js +64 -0
  159. package/lib/mcp/client-grant.d.ts +89 -0
  160. package/lib/mcp/client-grant.d.ts.map +1 -0
  161. package/lib/mcp/client-grant.js +63 -0
  162. package/lib/mcp/credential-cli.d.ts +38 -0
  163. package/lib/mcp/credential-cli.d.ts.map +1 -0
  164. package/lib/mcp/credential-cli.js +148 -0
  165. package/lib/mcp/credential-store.d.ts +143 -0
  166. package/lib/mcp/credential-store.d.ts.map +1 -0
  167. package/lib/mcp/credential-store.js +461 -0
  168. package/lib/mcp/export-policy.d.ts +25 -0
  169. package/lib/mcp/export-policy.d.ts.map +1 -0
  170. package/lib/mcp/export-policy.js +31 -0
  171. package/lib/mcp/host-binding.d.ts +144 -0
  172. package/lib/mcp/host-binding.d.ts.map +1 -0
  173. package/lib/mcp/host-binding.js +280 -0
  174. package/lib/mcp/http.d.ts +180 -0
  175. package/lib/mcp/http.d.ts.map +1 -0
  176. package/lib/mcp/http.js +602 -0
  177. package/lib/mcp/oauth.d.ts +149 -0
  178. package/lib/mcp/oauth.d.ts.map +1 -0
  179. package/lib/mcp/oauth.js +396 -0
  180. package/lib/mcp/protocol.d.ts +329 -0
  181. package/lib/mcp/protocol.d.ts.map +1 -0
  182. package/lib/mcp/protocol.js +459 -0
  183. package/lib/mcp/rate-limit.d.ts +68 -0
  184. package/lib/mcp/rate-limit.d.ts.map +1 -0
  185. package/lib/mcp/rate-limit.js +114 -0
  186. package/lib/mcp/sdk-v2.d.ts +17 -0
  187. package/lib/mcp/sdk-v2.d.ts.map +1 -0
  188. package/lib/mcp/sdk-v2.js +204 -0
  189. package/lib/mcp/server.d.ts +149 -0
  190. package/lib/mcp/server.d.ts.map +1 -0
  191. package/lib/mcp/server.js +302 -0
  192. package/lib/mcp/stdio.d.ts +80 -0
  193. package/lib/mcp/stdio.d.ts.map +1 -0
  194. package/lib/mcp/stdio.js +184 -0
  195. package/lib/mcp/subscriptions.d.ts +177 -0
  196. package/lib/mcp/subscriptions.d.ts.map +1 -0
  197. package/lib/mcp/subscriptions.js +288 -0
  198. package/lib/mcp-status.d.ts +96 -0
  199. package/lib/mcp-status.d.ts.map +1 -0
  200. package/lib/mcp-status.js +70 -0
  201. package/lib/mcp-usage.d.ts +110 -0
  202. package/lib/mcp-usage.d.ts.map +1 -0
  203. package/lib/mcp-usage.js +189 -0
  204. package/lib/model-qualification.d.ts +192 -0
  205. package/lib/model-qualification.d.ts.map +1 -0
  206. package/lib/model-qualification.js +178 -0
  207. package/lib/model-runtime-lane.d.ts +69 -0
  208. package/lib/model-runtime-lane.d.ts.map +1 -0
  209. package/lib/model-runtime-lane.js +122 -0
  210. package/lib/model-runtime-recipe.d.ts +132 -0
  211. package/lib/model-runtime-recipe.d.ts.map +1 -0
  212. package/lib/model-runtime-recipe.js +291 -0
  213. package/lib/planning.d.ts +256 -0
  214. package/lib/planning.d.ts.map +1 -0
  215. package/lib/planning.js +471 -0
  216. package/lib/playbook.d.ts +42 -0
  217. package/lib/playbook.d.ts.map +1 -0
  218. package/lib/playbook.js +65 -0
  219. package/lib/prepared-assets.d.ts +269 -0
  220. package/lib/prepared-assets.d.ts.map +1 -0
  221. package/lib/prepared-assets.js +471 -0
  222. package/lib/provider-bridge.d.ts +107 -0
  223. package/lib/provider-bridge.d.ts.map +1 -0
  224. package/lib/provider-bridge.js +423 -0
  225. package/lib/ptc-authority.d.ts +154 -0
  226. package/lib/ptc-authority.d.ts.map +1 -0
  227. package/lib/ptc-authority.js +242 -0
  228. package/lib/ptc-confinement.d.ts +60 -0
  229. package/lib/ptc-confinement.d.ts.map +1 -0
  230. package/lib/ptc-confinement.js +212 -0
  231. package/lib/ptc-runtime.d.ts +166 -0
  232. package/lib/ptc-runtime.d.ts.map +1 -0
  233. package/lib/ptc-runtime.js +231 -0
  234. package/lib/publication.d.ts +161 -0
  235. package/lib/publication.d.ts.map +1 -0
  236. package/lib/publication.js +181 -0
  237. package/lib/receipt-store.d.ts +57 -0
  238. package/lib/receipt-store.d.ts.map +1 -0
  239. package/lib/receipt-store.js +143 -0
  240. package/lib/receipt.d.ts +231 -0
  241. package/lib/receipt.d.ts.map +1 -0
  242. package/lib/receipt.js +165 -0
  243. package/lib/registrar.d.ts +75 -0
  244. package/lib/registrar.d.ts.map +1 -0
  245. package/lib/registrar.js +152 -0
  246. package/lib/resource-governance.d.ts +204 -0
  247. package/lib/resource-governance.d.ts.map +1 -0
  248. package/lib/resource-governance.js +213 -0
  249. package/lib/server-lifecycle.d.ts +175 -0
  250. package/lib/server-lifecycle.d.ts.map +1 -0
  251. package/lib/server-lifecycle.js +269 -0
  252. package/lib/skills.d.ts +31 -0
  253. package/lib/skills.d.ts.map +1 -0
  254. package/lib/skills.js +170 -0
  255. package/lib/speech-bridge.d.ts +74 -0
  256. package/lib/speech-bridge.d.ts.map +1 -0
  257. package/lib/speech-bridge.js +115 -0
  258. package/lib/state.d.ts +100 -0
  259. package/lib/state.d.ts.map +1 -0
  260. package/lib/state.js +160 -0
  261. package/lib/title-proposal.d.ts +194 -0
  262. package/lib/title-proposal.d.ts.map +1 -0
  263. package/lib/title-proposal.js +244 -0
  264. package/lib/tool-inventory.d.ts +90 -0
  265. package/lib/tool-inventory.d.ts.map +1 -0
  266. package/lib/tool-inventory.js +102 -0
  267. package/lib/tool-mode-run.d.ts +310 -0
  268. package/lib/tool-mode-run.d.ts.map +1 -0
  269. package/lib/tool-mode-run.js +411 -0
  270. package/lib/tool-sources.d.ts +80 -0
  271. package/lib/tool-sources.d.ts.map +1 -0
  272. package/lib/tool-sources.js +123 -0
  273. package/lib/tool-usage-projection.d.ts +390 -0
  274. package/lib/tool-usage-projection.d.ts.map +1 -0
  275. package/lib/tool-usage-projection.js +1038 -0
  276. package/lib/tool-usage-report.d.ts +153 -0
  277. package/lib/tool-usage-report.d.ts.map +1 -0
  278. package/lib/tool-usage-report.js +274 -0
  279. package/lib/transport.d.ts +158 -0
  280. package/lib/transport.d.ts.map +1 -0
  281. package/lib/transport.js +332 -0
  282. package/lib/types.d.ts +134 -0
  283. package/lib/types.d.ts.map +1 -0
  284. package/lib/types.js +8 -0
  285. package/lib/update-surface.d.ts +79 -0
  286. package/lib/update-surface.d.ts.map +1 -0
  287. package/lib/update-surface.js +224 -0
  288. package/lib/version.d.ts +3 -0
  289. package/lib/version.d.ts.map +1 -0
  290. package/lib/version.js +27 -0
  291. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts +13 -0
  292. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts.map +1 -0
  293. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.js +85 -0
  294. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts +16 -0
  295. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
  296. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +87 -0
  297. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
  298. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
  299. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
  300. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
  301. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
  302. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
  303. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
  304. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
  305. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
  306. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
  307. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
  308. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
  309. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
  310. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
  311. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
  312. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
  313. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
  314. package/node_modules/@try-works/tool-mode-contracts/lib/index.js +53 -0
  315. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +133 -0
  316. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
  317. package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +64 -0
  318. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +121 -0
  319. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
  320. package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
  321. package/node_modules/@try-works/tool-mode-contracts/package.json +35 -0
  322. package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
  323. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
  324. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
  325. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
  326. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +86 -0
  327. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
  328. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +145 -0
  329. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
  330. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
  331. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
  332. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
  333. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
  334. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
  335. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +33 -0
  336. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
  337. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +33 -0
  338. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
  339. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
  340. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
  341. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +137 -0
  342. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
  343. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +349 -0
  344. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +274 -0
  345. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
  346. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +932 -0
  347. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
  348. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
  349. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
  350. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
  351. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
  352. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
  353. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
  354. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
  355. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
  356. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
  357. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
  358. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +299 -0
  359. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +395 -0
  360. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
  361. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +839 -0
  362. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
  363. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
  364. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +255 -0
  365. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
  366. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
  367. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
  368. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
  369. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
  370. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
  371. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts +221 -0
  372. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts.map +1 -0
  373. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.js +188 -0
  374. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
  375. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
  376. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
  377. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
  378. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
  379. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
  380. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
  381. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
  382. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
  383. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +128 -0
  384. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
  385. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
  386. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts +41 -0
  387. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts.map +1 -0
  388. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.js +52 -0
  389. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
  390. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
  391. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
  392. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +157 -0
  393. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
  394. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +688 -0
  395. package/node_modules/@try-works/tool-mode-extension-sdk/package.json +54 -0
  396. package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
  397. package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
  398. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +460 -0
  399. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
  400. package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +647 -0
  401. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +61 -0
  402. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
  403. package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +1106 -0
  404. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
  405. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
  406. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +205 -0
  407. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
  408. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
  409. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
  410. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +119 -0
  411. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
  412. package/node_modules/@try-works/tool-mode-recipes/lib/images.js +201 -0
  413. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
  414. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
  415. package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
  416. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +345 -0
  417. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
  418. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1465 -0
  419. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
  420. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
  421. package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
  422. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +231 -0
  423. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
  424. package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +435 -0
  425. package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
  426. package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
  427. package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
  428. package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
  429. package/package.json +127 -4
  430. package/remote/spec.mjs +993 -0
  431. package/remote/typert.host.mjs +14 -0
  432. package/remote/typert.remote-client.mjs +16 -0
package/lib/catalog.js ADDED
@@ -0,0 +1,274 @@
1
+ /**
2
+ * Loads and validates the Desert Ant Labs model catalog.
3
+ *
4
+ * The catalog is plain JSON shipped beside the plugin so that a deployment can
5
+ * inspect or override it without rebuilding: `catalogFile` points at another
6
+ * document with the same shape.
7
+ *
8
+ * @module @try-works/dsh-tool-mode/catalog
9
+ */
10
+ import { readFileSync } from 'node:fs';
11
+ import { fileURLToPath } from 'node:url';
12
+ /** Absolute path of the catalog document shipped with this package. */
13
+ export const DEFAULT_CATALOG_FILE = fileURLToPath(new URL('../catalog/desert-ant-models.json', import.meta.url));
14
+ const INPUTS = ['text', 'audio', 'image', 'video', 'stroke', 'transcript'];
15
+ const WINDOWS_SUPPORT = [
16
+ 'native-node',
17
+ 'onnxruntime-node',
18
+ 'apple-only',
19
+ 'browser-only',
20
+ 'no-sdk',
21
+ ];
22
+ /** Raised when the catalog document is missing, unparseable, or malformed. */
23
+ export class CatalogError extends Error {
24
+ name = 'CatalogError';
25
+ }
26
+ function fail(source, message) {
27
+ throw new CatalogError(`${source}: ${message}`);
28
+ }
29
+ function requireString(entry, key, source) {
30
+ const value = entry[key];
31
+ if (typeof value !== 'string' || value.length === 0) {
32
+ fail(source, `entry "${String(entry.id ?? '?')}" field "${key}" must be a non-empty string`);
33
+ }
34
+ return value;
35
+ }
36
+ const PARAM_TYPES = ['string', 'number', 'integer', 'boolean', 'string[]'];
37
+ /**
38
+ * Normalize one parameter declaration.
39
+ *
40
+ * The string shorthand exists because most parameters are prose descriptions of
41
+ * a string argument; accepting it here keeps the catalog readable while the
42
+ * registrar still receives one resolved shape.
43
+ * @param raw - the declaration as written in the document.
44
+ * @param scope - entry description for error messages.
45
+ * @param key - parameter name.
46
+ * @returns the normalized parameter.
47
+ */
48
+ function parseParam(raw, scope, key) {
49
+ if (typeof raw === 'string' && raw.length > 0)
50
+ return { description: raw, type: 'string' };
51
+ if (typeof raw === 'object' && raw !== null && !Array.isArray(raw)) {
52
+ const spec = raw;
53
+ const description = spec.description;
54
+ if (typeof description !== 'string' || description.length === 0) {
55
+ throw new CatalogError(`${scope} tool.params.${key}.description must be a non-empty string`);
56
+ }
57
+ const type = spec.type;
58
+ if (type !== undefined && !PARAM_TYPES.includes(type)) {
59
+ throw new CatalogError(`${scope} tool.params.${key}.type must be one of ${PARAM_TYPES.join(', ')}`);
60
+ }
61
+ return { description, type: type ?? 'string' };
62
+ }
63
+ throw new CatalogError(`${scope} tool.params.${key} must be a description string or a parameter object`);
64
+ }
65
+ /**
66
+ * Validate the optional `contract` binding.
67
+ *
68
+ * A model without a contract is legitimate — it keeps a per-model tool — but a
69
+ * malformed contract identity would bind a tool to a name no caller can address,
70
+ * so it fails at load rather than at registration.
71
+ * @param value - the raw field.
72
+ * @param scope - entry description for error messages.
73
+ * @param source - document description for error messages.
74
+ * @returns the contract id, or null when unbound.
75
+ */
76
+ /**
77
+ * Parse a model's extension provider binding (BASE-09).
78
+ *
79
+ * The binding names the package that implements the model. It is validated here
80
+ * rather than trusted, because it decides which package's code the host will
81
+ * import: a malformed binding must fail the catalog load rather than surface later
82
+ * as an import of something unintended.
83
+ * @param raw - the raw `provider` field.
84
+ * @param source - the catalog source, for error messages.
85
+ * @returns the binding field, or an empty object when absent.
86
+ */
87
+ function parseProvider(raw, source) {
88
+ if (raw === undefined || raw === null)
89
+ return {};
90
+ const value = raw;
91
+ const extension = value.extension;
92
+ const modelId = value.modelId;
93
+ if (typeof extension !== 'string' || extension.length === 0) {
94
+ throw new Error(`${source}: provider.extension must be a non-empty package name`);
95
+ }
96
+ if (typeof modelId !== 'string' || modelId.length === 0) {
97
+ throw new Error(`${source}: provider.modelId must be a non-empty string`);
98
+ }
99
+ // A relative path is admitted so a first-party package can be exercised from a
100
+ // checkout; anything else must look like a package specifier.
101
+ const packageLike = /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(extension);
102
+ const relativeLike = extension.startsWith('./') || extension.startsWith('../');
103
+ if (!packageLike && !relativeLike) {
104
+ throw new Error(`${source}: provider.extension ${JSON.stringify(extension)} is neither a package specifier nor a relative path`);
105
+ }
106
+ return { provider: { extension, modelId } };
107
+ }
108
+ function parseContract(value, scope, source) {
109
+ if (value === null || value === undefined)
110
+ return null;
111
+ if (typeof value !== 'string') {
112
+ throw new CatalogError(`${source}: ${scope} field "contract" must be a contract id or null`);
113
+ }
114
+ if (!/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/.test(value)) {
115
+ throw new CatalogError(`${source}: ${scope} field "contract" ${JSON.stringify(value)} must be a dotted lower-case `
116
+ + 'contract identity (for example "stt.transcribe")');
117
+ }
118
+ return value;
119
+ }
120
+ /**
121
+ * Parse and validate one catalog entry. Validation is strict on purpose: every
122
+ * downstream decision (which tool to register, whether it can run, what the
123
+ * model sees) reads these fields, so a malformed entry must fail at load rather
124
+ * than become a silently missing tool.
125
+ * @param raw - one decoded JSON object.
126
+ * @param source - description of where the document came from, for messages.
127
+ * @param index - position in the array, for entries with no usable id.
128
+ * @returns the validated entry.
129
+ */
130
+ export function parseCatalogEntry(raw, source, index) {
131
+ if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
132
+ fail(source, `entry ${String(index)} must be an object`);
133
+ }
134
+ const entry = raw;
135
+ const id = requireString(entry, 'id', source);
136
+ const scope = `entry "${id}"`;
137
+ const input = requireString(entry, 'input', source);
138
+ if (!INPUTS.includes(input)) {
139
+ fail(source, `${scope} has unsupported input ${JSON.stringify(input)} (expected one of ${INPUTS.join(', ')})`);
140
+ }
141
+ const windowsSupport = requireString(entry, 'windowsSupport', source);
142
+ if (!WINDOWS_SUPPORT.includes(windowsSupport)) {
143
+ fail(source, `${scope} has unsupported windowsSupport ${JSON.stringify(windowsSupport)} (expected one of ${WINDOWS_SUPPORT.join(', ')})`);
144
+ }
145
+ const tool = entry.tool;
146
+ if (typeof tool !== 'object' || tool === null)
147
+ fail(source, `${scope} is missing its "tool" object`);
148
+ const skill = entry.skill;
149
+ if (typeof skill !== 'object' || skill === null)
150
+ fail(source, `${scope} is missing its "skill" object`);
151
+ const toolSpec = tool;
152
+ const skillSpec = skill;
153
+ const params = toolSpec.params;
154
+ if (typeof params !== 'object' || params === null || Array.isArray(params)) {
155
+ fail(source, `${scope} tool.params must be an object`);
156
+ }
157
+ const bool = (key) => {
158
+ const value = entry[key];
159
+ if (typeof value !== 'boolean')
160
+ fail(source, `${scope} field "${key}" must be a boolean`);
161
+ return value;
162
+ };
163
+ const nullableNumber = (key) => {
164
+ const value = entry[key];
165
+ if (value !== null && (typeof value !== 'number' || !Number.isFinite(value))) {
166
+ fail(source, `${scope} field "${key}" must be a finite number or null`);
167
+ }
168
+ return value;
169
+ };
170
+ const nullableString = (key) => {
171
+ const value = entry[key];
172
+ if (value !== null && typeof value !== 'string') {
173
+ fail(source, `${scope} field "${key}" must be a string or null`);
174
+ }
175
+ return value;
176
+ };
177
+ const strings = (key) => {
178
+ const value = entry[key];
179
+ if (!Array.isArray(value) || value.some(item => typeof item !== 'string')) {
180
+ fail(source, `${scope} field "${key}" must be an array of strings`);
181
+ }
182
+ return value;
183
+ };
184
+ const toolName = requireString(toolSpec, 'name', source);
185
+ if (!/^[a-z][a-z0-9_]*$/.test(toolName)) {
186
+ fail(source, `${scope} tool.name ${JSON.stringify(toolName)} must be lower snake_case starting with a letter`);
187
+ }
188
+ const skillName = requireString(skillSpec, 'name', source);
189
+ if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(skillName)) {
190
+ fail(source, `${scope} skill.name ${JSON.stringify(skillName)} must be kebab-case`);
191
+ }
192
+ return {
193
+ id,
194
+ name: requireString(entry, 'name', source),
195
+ summary: requireString(entry, 'summary', source),
196
+ capability: requireString(entry, 'capability', source),
197
+ contract: parseContract(entry.contract, scope, source),
198
+ ...parseProvider(entry.provider, source),
199
+ input: input,
200
+ output: requireString(entry, 'output', source),
201
+ languages: nullableNumber('languages'),
202
+ modelSizeMB: nullableNumber('modelSizeMB'),
203
+ appleOnly: bool('appleOnly'),
204
+ closedBeta: bool('closedBeta'),
205
+ verifiedRunnableOnWindows: bool('verifiedRunnableOnWindows'),
206
+ windowsSupport: windowsSupport,
207
+ npmPackage: nullableString('npmPackage'),
208
+ npmSubpath: nullableString('npmSubpath'),
209
+ requiresRuntime: strings('requiresRuntime'),
210
+ cliVerb: nullableString('cliVerb'),
211
+ license: requireString(entry, 'license', source),
212
+ docsUrl: requireString(entry, 'docsUrl', source),
213
+ hfRepo: requireString(entry, 'hfRepo', source),
214
+ tool: {
215
+ name: toolName,
216
+ description: requireString(toolSpec, 'description', source),
217
+ params: Object.fromEntries(Object.entries(params).map(([key, value]) => [
218
+ key,
219
+ parseParam(value, scope, key),
220
+ ])),
221
+ returns: requireString(toolSpec, 'returns', source),
222
+ },
223
+ skill: {
224
+ name: skillName,
225
+ description: requireString(skillSpec, 'description', source),
226
+ ...typeof skillSpec.whenToUse === 'string' ? { whenToUse: skillSpec.whenToUse } : {},
227
+ },
228
+ };
229
+ }
230
+ /**
231
+ * Load the catalog from a JSON document.
232
+ * @param file - absolute path of the catalog document.
233
+ * @returns every validated entry, in document order.
234
+ * @throws CatalogError when the file cannot be read, is not valid JSON, is not an array, or holds a malformed entry.
235
+ */
236
+ export function loadCatalog(file = DEFAULT_CATALOG_FILE) {
237
+ let text;
238
+ try {
239
+ text = readFileSync(file, 'utf8');
240
+ }
241
+ catch (error) {
242
+ // Node errors are not stable enough to switch on; the message is the point.
243
+ throw new CatalogError(`cannot read model catalog ${file}: ${error instanceof Error ? error.message : String(error)}`);
244
+ }
245
+ let parsed;
246
+ try {
247
+ parsed = JSON.parse(text);
248
+ }
249
+ catch (error) {
250
+ throw new CatalogError(`${file} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
251
+ }
252
+ if (!Array.isArray(parsed))
253
+ throw new CatalogError(`${file} must contain a JSON array of model entries`);
254
+ const entries = parsed.map((raw, index) => parseCatalogEntry(raw, file, index));
255
+ const seen = new Set();
256
+ for (const entry of entries) {
257
+ if (seen.has(entry.id))
258
+ throw new CatalogError(`${file} declares model id "${entry.id}" more than once`);
259
+ seen.add(entry.id);
260
+ }
261
+ const toolNames = new Set();
262
+ for (const entry of entries) {
263
+ if (toolNames.has(entry.tool.name)) {
264
+ throw new CatalogError(`${file} maps tool name "${entry.tool.name}" to more than one model`);
265
+ }
266
+ toolNames.add(entry.tool.name);
267
+ }
268
+ return entries;
269
+ }
270
+ /** Index a catalog by model id. */
271
+ export function indexCatalog(entries) {
272
+ return new Map(entries.map(entry => [entry.id, entry]));
273
+ }
274
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Translation from a model's native result to a contract's payload.
3
+ *
4
+ * The spec puts this responsibility on adapters: they "translate between the
5
+ * capability's canonical representation and the model's native interface". It is
6
+ * a separate module from the invoke adapters because the two change for different
7
+ * reasons — an adapter changes when the vendor SDK does, a translator changes when
8
+ * the contract does — and conflating them is how a contract silently drifts to
9
+ * match whatever the SDK happened to return.
10
+ *
11
+ * The contract is the authority. When a translation cannot supply a field the
12
+ * contract requires, that is reported rather than faked; TOOL-01 is explicit that
13
+ * an incomplete clip must not be presented as fully transcribed.
14
+ *
15
+ * @module @try-works/dsh-tool-mode/contract-payload
16
+ */
17
+ import type { JsonValue } from './adapters/index.ts';
18
+ /** Raised when a native result cannot be expressed under its contract. */
19
+ export declare class PayloadTranslationError extends Error {
20
+ readonly name = "PayloadTranslationError";
21
+ }
22
+ /**
23
+ * Translate the contract's caller-facing arguments into the implementation's
24
+ * native vocabulary.
25
+ * @param contractId - the contract the implementation was selected for.
26
+ * @param contractArgs - the validated contract arguments.
27
+ * @returns the native argument shape.
28
+ */
29
+ export declare function toNativeArgs(contractId: string, contractArgs: Readonly<Record<string, unknown>>): Record<string, unknown>;
30
+ /**
31
+ * Translate a native implementation result into the payload its contract declares.
32
+ * @param contractId - the contract the implementation was selected for.
33
+ * @param native - the adapter's native result.
34
+ * @param args - the validated arguments, for contract-conditional translation.
35
+ * @returns the contract payload.
36
+ * @throws PayloadTranslationError when the native result cannot satisfy the contract.
37
+ */
38
+ export declare function toContractPayload(contractId: string, native: Record<string, JsonValue>, args?: Readonly<Record<string, unknown>>): Record<string, JsonValue>;
39
+ //# sourceMappingURL=contract-payload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-payload.d.ts","sourceRoot":"","sources":["../src/contract-payload.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,0EAA0E;AAC1E,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAkB,IAAI,6BAA4B;CACnD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC9C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWzB;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACjC,IAAI,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC3C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAO3B"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Translation from a model's native result to a contract's payload.
3
+ *
4
+ * The spec puts this responsibility on adapters: they "translate between the
5
+ * capability's canonical representation and the model's native interface". It is
6
+ * a separate module from the invoke adapters because the two change for different
7
+ * reasons — an adapter changes when the vendor SDK does, a translator changes when
8
+ * the contract does — and conflating them is how a contract silently drifts to
9
+ * match whatever the SDK happened to return.
10
+ *
11
+ * The contract is the authority. When a translation cannot supply a field the
12
+ * contract requires, that is reported rather than faked; TOOL-01 is explicit that
13
+ * an incomplete clip must not be presented as fully transcribed.
14
+ *
15
+ * @module @try-works/dsh-tool-mode/contract-payload
16
+ */
17
+ /** Raised when a native result cannot be expressed under its contract. */
18
+ export class PayloadTranslationError extends Error {
19
+ name = 'PayloadTranslationError';
20
+ }
21
+ /**
22
+ * Translate the contract's caller-facing arguments into the implementation's
23
+ * native vocabulary.
24
+ * @param contractId - the contract the implementation was selected for.
25
+ * @param contractArgs - the validated contract arguments.
26
+ * @returns the native argument shape.
27
+ */
28
+ export function toNativeArgs(contractId, contractArgs) {
29
+ void contractId;
30
+ /**
31
+ * TASK-115/120/121: the extension implementations now speak the CONTRACT
32
+ * vocabulary on BOTH sides (the tongue/voz mappings published in 0.1.3 and
33
+ * 0.1.5 read {audio:{path}} and emit the contract payloads), so the host's
34
+ * argument translation is a PASS-THROUGH — the old audio_path/include_words
35
+ * native vocabulary no longer exists on the wire. A future implementation
36
+ * with a genuinely different native vocabulary re-introduces its case here.
37
+ */
38
+ return { ...contractArgs };
39
+ }
40
+ /**
41
+ * Translate a native implementation result into the payload its contract declares.
42
+ * @param contractId - the contract the implementation was selected for.
43
+ * @param native - the adapter's native result.
44
+ * @param args - the validated arguments, for contract-conditional translation.
45
+ * @returns the contract payload.
46
+ * @throws PayloadTranslationError when the native result cannot satisfy the contract.
47
+ */
48
+ export function toContractPayload(contractId, native, args = {}) {
49
+ void contractId;
50
+ void args;
51
+ // TASK-115/120/121: the extension implementations emit the CONTRACT payloads
52
+ // directly, so the result translation is the identity; the output schema's
53
+ // validation is the authority that accepts or rejects the payload.
54
+ return native;
55
+ }
56
+ //# sourceMappingURL=contract-payload.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Compile a validated custom-tool record into a real DSH tool definition.
3
+ *
4
+ * The authoring record is data; this module is the only place that turns it into
5
+ * the executable definition the registry consumes. Executors are injected so the
6
+ * HTTP/prompt/composite slices can be tested independently.
7
+ *
8
+ * @module @try-works/dsh-tool-mode/custom-tools/compile
9
+ */
10
+ import type { CustomToolRecord } from './types.ts';
11
+ /** Execution context a custom-tool executor needs. */
12
+ export interface CustomToolExecContext {
13
+ readonly signal: AbortSignal;
14
+ }
15
+ /** The executor contract shared by all three kinds. */
16
+ export type CustomToolExecutor = (record: CustomToolRecord, args: Readonly<Record<string, unknown>>, context: CustomToolExecContext) => Promise<unknown>;
17
+ /**
18
+ * Compile one record. Validation is the caller's responsibility; the store and
19
+ * save path validate before calling this.
20
+ * @param record - validated authoring record.
21
+ * @param execute - kind-specific executor.
22
+ * @returns the definition accepted by `ctx.tools.register`.
23
+ */
24
+ export declare function compileCustomTool(record: CustomToolRecord, execute: CustomToolExecutor): import("@deepseek-ai/dsh-tools").ToolDefinition;
25
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/custom-tools/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,sDAAsD;AACtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAC7B;AAED,uDAAuD;AACvD,MAAM,MAAM,kBAAkB,GAAG,CAC/B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,OAAO,CAAC,CAAA;AAErB;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,mDAyCtF"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Compile a validated custom-tool record into a real DSH tool definition.
3
+ *
4
+ * The authoring record is data; this module is the only place that turns it into
5
+ * the executable definition the registry consumes. Executors are injected so the
6
+ * HTTP/prompt/composite slices can be tested independently.
7
+ *
8
+ * @module @try-works/dsh-tool-mode/custom-tools/compile
9
+ */
10
+ import { defineTool } from '@deepseek-ai/dsh-tools';
11
+ import { projectSchemaToDsh } from '@try-works/tool-mode-contracts';
12
+ /**
13
+ * Compile one record. Validation is the caller's responsibility; the store and
14
+ * save path validate before calling this.
15
+ * @param record - validated authoring record.
16
+ * @param execute - kind-specific executor.
17
+ * @returns the definition accepted by `ctx.tools.register`.
18
+ */
19
+ export function compileCustomTool(record, execute) {
20
+ const outputSchema = record.outputSchema === undefined
21
+ ? undefined
22
+ : {
23
+ type: 'object',
24
+ properties: projectSchemaToDsh(record.outputSchema).parameters,
25
+ additionalProperties: false,
26
+ };
27
+ const parameters = projectSchemaToDsh(record.parameters).parameters;
28
+ const declaredOutput = outputSchema === undefined
29
+ ? { type: 'object', additionalProperties: true }
30
+ : outputSchema;
31
+ return defineTool({
32
+ name: record.name,
33
+ description: record.description,
34
+ parameters: parameters,
35
+ output: {
36
+ schema: declaredOutput,
37
+ render: (_args, value) => [{
38
+ type: 'text',
39
+ text: typeof value === 'string' ? value : JSON.stringify(value),
40
+ }],
41
+ },
42
+ timeoutMs: record.policy.timeoutMs,
43
+ async execute(args, exec) {
44
+ const value = await execute(record, args, { signal: exec.signal });
45
+ // With no declared output schema the registry advertises an open object.
46
+ // Preserve a scalar/list result inside that envelope instead of dropping it.
47
+ if (outputSchema === undefined && (typeof value !== 'object' || value === null || Array.isArray(value))) {
48
+ return { result: value };
49
+ }
50
+ return value;
51
+ },
52
+ presentCall() {
53
+ return {
54
+ card: 'generic',
55
+ title: record.title,
56
+ kind: record.policy.readOnly ? 'read' : 'execute',
57
+ };
58
+ },
59
+ });
60
+ }
61
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Composite custom-tool executor.
3
+ *
4
+ * A bounded sequential pipeline over existing tools. It never loops, never calls
5
+ * itself, and requires an explicit approval seam for steps marked destructive.
6
+ *
7
+ * @module @try-works/dsh-tool-mode/custom-tools/composite-executor
8
+ */
9
+ import type { CustomToolExecContext } from './compile.ts';
10
+ import type { CustomToolRecord } from './types.ts';
11
+ /** A named composite-execution refusal. */
12
+ export declare class CustomToolCompositeError extends Error {
13
+ readonly name = "CustomToolCompositeError";
14
+ readonly code: 'custom-tool-composite-unavailable' | 'custom-tool-composite-step-invalid' | 'custom-tool-composite-approval-denied' | 'custom-tool-composite-failed';
15
+ constructor(code: CustomToolCompositeError['code'], message: string, options?: ErrorOptions);
16
+ }
17
+ /** One call into the real tool registry. */
18
+ export type CompositeToolCall = (name: string, args: Readonly<Record<string, unknown>>, signal: AbortSignal) => Promise<unknown>;
19
+ /** Optional approval for a destructive step. */
20
+ export type CompositeApproval = (step: {
21
+ readonly tool: string;
22
+ readonly index: number;
23
+ }) => Promise<boolean>;
24
+ /** Composite executor seams. */
25
+ export interface CompositeExecutorDeps {
26
+ readonly callTool?: CompositeToolCall;
27
+ readonly approve?: CompositeApproval;
28
+ /** The tool name owning this record; self-calls are refused. */
29
+ readonly selfName?: string;
30
+ }
31
+ declare function asRecord(value: unknown): Record<string, unknown>;
32
+ /**
33
+ * Execute one composite tool.
34
+ * @param record - validated composite record.
35
+ * @param args - arguments.
36
+ * @param context - cancellation.
37
+ * @param deps - registry and approval seams.
38
+ * @returns the selected final value.
39
+ */
40
+ export declare function executeCompositeCustomTool(record: CustomToolRecord, args: Readonly<Record<string, unknown>>, context: CustomToolExecContext, deps?: CompositeExecutorDeps): Promise<unknown>;
41
+ export { asRecord };
42
+ //# sourceMappingURL=composite-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composite-executor.d.ts","sourceRoot":"","sources":["../../src/custom-tools/composite-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,2CAA2C;AAC3C,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,SAAkB,IAAI,8BAA6B;IACnD,QAAQ,CAAC,IAAI,EACT,mCAAmC,GACnC,oCAAoC,GACpC,uCAAuC,GACvC,8BAA8B,CAAA;gBAEtB,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAI5F;AAED,4CAA4C;AAC5C,MAAM,MAAM,iBAAiB,GAAG,CAC9B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,MAAM,EAAE,WAAW,KAChB,OAAO,CAAC,OAAO,CAAC,CAAA;AAErB,gDAAgD;AAChD,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AAE7G,gCAAgC;AAChC,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAA;IACpC,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzD;AAoCD;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,OAAO,EAAE,qBAAqB,EAC9B,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,OAAO,CAAC,CA2ClB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Composite custom-tool executor.
3
+ *
4
+ * A bounded sequential pipeline over existing tools. It never loops, never calls
5
+ * itself, and requires an explicit approval seam for steps marked destructive.
6
+ *
7
+ * @module @try-works/dsh-tool-mode/custom-tools/composite-executor
8
+ */
9
+ /** A named composite-execution refusal. */
10
+ export class CustomToolCompositeError extends Error {
11
+ name = 'CustomToolCompositeError';
12
+ code;
13
+ constructor(code, message, options) {
14
+ super(message, options);
15
+ this.code = code;
16
+ }
17
+ }
18
+ function asRecord(value) {
19
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
20
+ ? value
21
+ : {};
22
+ }
23
+ function readPath(value, path) {
24
+ let current = value;
25
+ for (const segment of path) {
26
+ if (Array.isArray(current))
27
+ current = current[Number(segment)];
28
+ else if (typeof current === 'object' && current !== null)
29
+ current = current[segment];
30
+ else
31
+ return undefined;
32
+ }
33
+ return current;
34
+ }
35
+ /** Resolve `{{arg}}`, `{{steps.N.result}}` and `{{steps.N.result.path}}`. */
36
+ function interpolate(template, args, results) {
37
+ return template.replace(/\{\{([^}]+)\}\}/g, (_whole, expression) => {
38
+ const trimmed = expression.trim();
39
+ if (trimmed.startsWith('steps.')) {
40
+ const segments = trimmed.split('.');
41
+ const index = Number(segments[1]);
42
+ if (!Number.isInteger(index) || index < 0 || index >= results.length) {
43
+ throw new CustomToolCompositeError('custom-tool-composite-step-invalid', `${trimmed} does not name a previous step`);
44
+ }
45
+ const value = readPath(results[index], segments.slice(3));
46
+ if (value === undefined) {
47
+ throw new CustomToolCompositeError('custom-tool-composite-step-invalid', `${trimmed} resolved to no value`);
48
+ }
49
+ return typeof value === 'string' ? value : JSON.stringify(value);
50
+ }
51
+ const value = args[trimmed];
52
+ if (value === undefined) {
53
+ throw new CustomToolCompositeError('custom-tool-composite-step-invalid', `argument ${JSON.stringify(trimmed)} is missing`);
54
+ }
55
+ return String(value);
56
+ });
57
+ }
58
+ /**
59
+ * Execute one composite tool.
60
+ * @param record - validated composite record.
61
+ * @param args - arguments.
62
+ * @param context - cancellation.
63
+ * @param deps - registry and approval seams.
64
+ * @returns the selected final value.
65
+ */
66
+ export async function executeCompositeCustomTool(record, args, context, deps = {}) {
67
+ if (record.execution.kind !== 'composite') {
68
+ throw new CustomToolCompositeError('custom-tool-composite-step-invalid', `${record.id} is not a composite tool`);
69
+ }
70
+ if (deps.callTool === undefined) {
71
+ throw new CustomToolCompositeError('custom-tool-composite-unavailable', 'no tool dispatcher is mounted for composite tools');
72
+ }
73
+ const results = [];
74
+ const selfName = deps.selfName ?? record.name;
75
+ for (const [index, step] of record.execution.composite.steps.entries()) {
76
+ if (step.tool === selfName) {
77
+ throw new CustomToolCompositeError('custom-tool-composite-step-invalid', `${record.id} may not call itself`);
78
+ }
79
+ if (step.requiresApproval === true) {
80
+ if (deps.approve === undefined) {
81
+ throw new CustomToolCompositeError('custom-tool-composite-approval-denied', `step ${index} (${step.tool}) requires approval, but no approval surface is mounted`);
82
+ }
83
+ if (!await deps.approve({ tool: step.tool, index })) {
84
+ throw new CustomToolCompositeError('custom-tool-composite-approval-denied', `step ${index} (${step.tool}) was not approved`);
85
+ }
86
+ }
87
+ const stepArgs = {};
88
+ for (const [key, template] of Object.entries(step.args)) {
89
+ stepArgs[key] = interpolate(template, args, results);
90
+ }
91
+ try {
92
+ results.push(await deps.callTool(step.tool, stepArgs, context.signal));
93
+ }
94
+ catch (error) {
95
+ throw new CustomToolCompositeError('custom-tool-composite-failed', `step ${index} (${step.tool}) failed`, { cause: error });
96
+ }
97
+ }
98
+ const output = record.execution.composite.output;
99
+ if (output === undefined)
100
+ return results[results.length - 1];
101
+ if (output.startsWith('steps.')) {
102
+ const segments = output.split('.');
103
+ const index = Number(segments[1]);
104
+ if (!Number.isInteger(index) || index < 0 || index >= results.length) {
105
+ throw new CustomToolCompositeError('custom-tool-composite-step-invalid', `${output} does not name a previous step`);
106
+ }
107
+ const value = readPath(results[index], segments.slice(3));
108
+ return value;
109
+ }
110
+ return interpolate(output, args, results);
111
+ }
112
+ export { asRecord };
113
+ //# sourceMappingURL=composite-executor.js.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Kind dispatch for custom tools.
3
+ *
4
+ * @module @try-works/dsh-tool-mode/custom-tools/dispatch
5
+ */
6
+ import type { CustomToolExecContext, CustomToolExecutor } from './compile.ts';
7
+ import { type CompositeExecutorDeps } from './composite-executor.ts';
8
+ import { type HttpExecutorDeps } from './http-executor.ts';
9
+ import { type PromptExecutorDeps } from './prompt-executor.ts';
10
+ import type { CustomToolRecord } from './types.ts';
11
+ /** One deps object for all three kinds. */
12
+ export interface CustomToolDispatchDeps {
13
+ readonly http?: HttpExecutorDeps;
14
+ readonly prompt?: PromptExecutorDeps;
15
+ readonly composite?: CompositeExecutorDeps;
16
+ }
17
+ /**
18
+ * Execute a record according to its validated kind.
19
+ * @param record - validated record.
20
+ * @param args - model-supplied arguments.
21
+ * @param context - cancellation.
22
+ * @param deps - kind-specific seams.
23
+ * @returns the canonical result value.
24
+ */
25
+ export declare function executeCustomTool(record: CustomToolRecord, args: Readonly<Record<string, unknown>>, context: CustomToolExecContext, deps?: CustomToolDispatchDeps): Promise<unknown>;
26
+ /** Adapt dispatch deps into the registrar's executor signature. */
27
+ export declare function customToolExecutor(deps: CustomToolDispatchDeps): CustomToolExecutor;
28
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/custom-tools/dispatch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC7E,OAAO,EAA8B,KAAK,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAChG,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACjF,OAAO,EAA2B,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAA;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAA;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAC3C;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,OAAO,EAAE,qBAAqB,EAC9B,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,OAAO,CAAC,CAYlB;AAED,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,kBAAkB,CAEnF"}