@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
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Contract-driven registration: one tool per contract, not one per model.
3
+ *
4
+ * This is the host half of BASE-02. The contract decides the tool's name, schema
5
+ * and description; the implementation behind it is host configuration. A second
6
+ * model implementing `stt.transcribe` therefore joins the existing
7
+ * `stt_transcribe` tool rather than appearing as a competing duplicate — which is
8
+ * the behaviour the previous per-model registrar could not express.
9
+ *
10
+ * The host also owns provenance (DECL-03): `meta` is stamped here, from host
11
+ * state, so an implementation cannot claim another package's identity.
12
+ *
13
+ * @module @try-works/dsh-tool-mode/bindings
14
+ */
15
+ import { type ExecutionLocation, type ToolContract, type ToolMeta } from '@try-works/tool-mode-contracts';
16
+ import type { ModelCatalogEntry, ModelRoute } from './types.ts';
17
+ import { type InvocationReceipt } from './receipt.ts';
18
+ import { type InvocationAuthority, type ToolGrant } from './authority.ts';
19
+ import type { ModelAdapter } from './adapters/index.ts';
20
+ /** Host identity stamped into every result. */
21
+ export interface HostIdentity {
22
+ /** The host package name. */
23
+ readonly extension: string;
24
+ /** The host package version. */
25
+ readonly extensionVersion: string;
26
+ /** Activation generation, incremented when the tool surface changes. */
27
+ readonly activationGeneration: number;
28
+ /** Receipt id factory; injectable so tests are deterministic. */
29
+ readonly nextReceiptId: () => string;
30
+ /**
31
+ * The grant this tool surface runs under (SEC-03).
32
+ *
33
+ * Built by the host from operator configuration. A caller's request cannot
34
+ * reach it, which is what makes the authority trustworthy (BASE-05).
35
+ */
36
+ readonly grant: ToolGrant;
37
+ /** How the host classified this caller. */
38
+ readonly callerKind: InvocationAuthority['callerKind'];
39
+ /**
40
+ * Where an invocation receipt is delivered (EXT-35).
41
+ *
42
+ * Optional so a host without a receipt store still works; when present it sees one
43
+ * receipt per SUCCESSFUL call, which is what makes the provenance recoverable
44
+ * after the fact rather than only during the call.
45
+ */
46
+ readonly recordReceipt?: (receipt: InvocationReceipt) => void;
47
+ }
48
+ /** One contract with the implementation chosen to serve it. */
49
+ export interface ContractBinding {
50
+ /** The contract that defines the tool. */
51
+ readonly contract: ToolContract;
52
+ /** The catalog entry selected to execute it. */
53
+ readonly implementation: ModelCatalogEntry;
54
+ /** The adapter that invokes that model. */
55
+ readonly adapter: ModelAdapter;
56
+ /** The route the capability resolver proved, used for `executionLocation`. */
57
+ readonly route: ModelRoute;
58
+ /** Other runnable implementations of the same contract, for reporting. */
59
+ readonly alternatives: readonly string[];
60
+ }
61
+ /**
62
+ * Translate a resolver route into the caller-facing execution location (SPEC §6).
63
+ *
64
+ * "Local" is deliberately not one value: a bridge is another machine, and a
65
+ * caller reasoning about data boundaries needs to know which.
66
+ * @param route - the resolved route.
67
+ * @returns the declared execution location.
68
+ */
69
+ export declare function executionLocationOf(route: ModelRoute): ExecutionLocation;
70
+ /**
71
+ * Build the `meta` envelope for one execution.
72
+ *
73
+ * Every field comes from host state or the contract, never from the model's
74
+ * output, which is what makes the provenance trustworthy (DECL-03).
75
+ * @param binding - the contract and implementation that are executing.
76
+ * @param host - the host identity to stamp.
77
+ * @param warnings - non-fatal conditions observed during this call.
78
+ * @returns the envelope.
79
+ */
80
+ export declare function buildMeta(binding: Pick<ContractBinding, 'contract' | 'implementation' | 'route'>, host: HostIdentity, warnings?: readonly string[]): ToolMeta;
81
+ /**
82
+ * Build the EXT-35 receipt for one call.
83
+ *
84
+ * Separate from {@link buildMeta} because it answers a different question: the
85
+ * envelope says what the caller received, while the receipt says what RAN and from
86
+ * which bytes. The extra provenance — the extension package, its content digest,
87
+ * the model and recipe identity — is what makes a receipt usable after the fact,
88
+ * when the version alone no longer identifies the code.
89
+ * @param binding - the contract and the implementation chosen for it.
90
+ * @param host - host identity and the receipt factory.
91
+ * @param meta - the envelope already stamped, for the receipt identity.
92
+ * @returns the invocation receipt.
93
+ */
94
+ export declare function buildReceipt(binding: Pick<ContractBinding, 'contract' | 'implementation' | 'route'>, host: HostIdentity, meta: Pick<ToolMeta, 'receiptId'>, warnings?: readonly string[]): InvocationReceipt;
95
+ /**
96
+ * Register one contract as a single DSH tool.
97
+ *
98
+ * The tool body validates arguments against the contract, applies the cross-field
99
+ * rules the DSH DSL cannot express, invokes the selected implementation, then
100
+ * validates the RESULT before returning it. A violation surfaces as a tool
101
+ * failure rather than as malformed data reaching a caller (AT-11).
102
+ * @param ctx - the context whose tool registry receives the definition.
103
+ * @param binding - the contract and the implementation chosen for it.
104
+ * @param host - host identity to stamp into results.
105
+ * @returns the registered tool name and the registry disposer.
106
+ */
107
+ export declare function registerContractTool(ctx: {
108
+ tools: {
109
+ register(definition: unknown): () => void;
110
+ };
111
+ }, binding: ContractBinding, host: HostIdentity): {
112
+ toolName: string;
113
+ dispose: () => void;
114
+ };
115
+ /**
116
+ * Register a STANDARD contract tool served by an ACTIVE extension's
117
+ * IMPLEMENTATION (TASK-121), mirroring {@link registerContractTool} with the
118
+ * execution bound to a host-supplied dispatch instead of a catalogue adapter.
119
+ *
120
+ * The tool name, description and schemas come from the CONTRACT definition —
121
+ * never invented per extension — and the dispatch hands the CONTRACT-shaped
122
+ * input to the extension's implementation (the extension reads the standard
123
+ * shapes directly). Input/output validation, the grant authorization, the
124
+ * meta stamping and the receipt are the SAME discipline the catalogue path
125
+ * applies, so the two routes cannot diverge.
126
+ * @param ctx - the context whose tool registry receives the definition.
127
+ * @param contract - the standard contract definition.
128
+ * @param host - host identity to stamp into results.
129
+ * @param dispatch - executes through the extension implementation.
130
+ * @returns the registered tool name and the registry disposer.
131
+ */
132
+ export declare function registerContractImplementationTool(ctx: {
133
+ tools: {
134
+ register(definition: unknown): () => void;
135
+ };
136
+ }, contract: ToolContract, host: HostIdentity, dispatch: (args: Record<string, unknown>, signal: AbortSignal) => Promise<Record<string, unknown>>, implementation: {
137
+ readonly id: string;
138
+ readonly extensionId: string;
139
+ readonly modelId: string;
140
+ }): {
141
+ toolName: string;
142
+ dispose: () => void;
143
+ };
144
+ //# sourceMappingURL=bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../src/bindings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAOL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE/D,OAAO,EAA0B,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAC7E,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,6BAA6B;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,gCAAgC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,wEAAwE;IACxE,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAA;IACrC,iEAAiE;IACjE,QAAQ,CAAC,aAAa,EAAE,MAAM,MAAM,CAAA;IACpC;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAA;IACtD;;;;;;OAMG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,CAAA;CAC9D;AAED,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAA;IAC/B,gDAAgD;IAChD,QAAQ,CAAC,cAAc,EAAE,iBAAiB,CAAA;IAC1C,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAA;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAA;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,CAcxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAAC,EACvE,IAAI,EAAE,YAAY,EAClB,QAAQ,GAAE,SAAS,MAAM,EAAO,GAC/B,QAAQ,CAYV;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,gBAAgB,GAAG,OAAO,CAAC,EACvE,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,EACjC,QAAQ,GAAE,SAAS,MAAM,EAAO,GAC/B,iBAAiB,CAoBnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE;IAAE,KAAK,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,IAAI,CAAA;KAAE,CAAA;CAAE,EAC7D,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,YAAY,GACjB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAoG3C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kCAAkC,CAChD,GAAG,EAAE;IAAE,KAAK,EAAE;QAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,MAAM,IAAI,CAAA;KAAE,CAAA;CAAE,EAC7D,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAClG,cAAc,EAAE;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC9F;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA0D3C"}
@@ -0,0 +1,314 @@
1
+ /**
2
+ * Contract-driven registration: one tool per contract, not one per model.
3
+ *
4
+ * This is the host half of BASE-02. The contract decides the tool's name, schema
5
+ * and description; the implementation behind it is host configuration. A second
6
+ * model implementing `stt.transcribe` therefore joins the existing
7
+ * `stt_transcribe` tool rather than appearing as a competing duplicate — which is
8
+ * the behaviour the previous per-model registrar could not express.
9
+ *
10
+ * The host also owns provenance (DECL-03): `meta` is stamped here, from host
11
+ * state, so an implementation cannot claim another package's identity.
12
+ *
13
+ * @module @try-works/dsh-tool-mode/bindings
14
+ */
15
+ import { defineTool } from '@deepseek-ai/dsh-tools';
16
+ import { assertValidContract, assertValidInput, assertValidOutput, crossFieldRules, projectSchemaToDsh, toDshParameters, } from '@try-works/tool-mode-contracts';
17
+ import { toContractPayload, toNativeArgs } from "./contract-payload.js";
18
+ import { buildInvocationReceipt } from "./receipt.js";
19
+ import { authorizeTool, createInvocationAuthority, } from "./authority.js";
20
+ /**
21
+ * Translate a resolver route into the caller-facing execution location (SPEC §6).
22
+ *
23
+ * "Local" is deliberately not one value: a bridge is another machine, and a
24
+ * caller reasoning about data boundaries needs to know which.
25
+ * @param route - the resolved route.
26
+ * @returns the declared execution location.
27
+ */
28
+ export function executionLocationOf(route) {
29
+ switch (route) {
30
+ case 'extension':
31
+ case 'npm-native':
32
+ case 'npm-onnxruntime':
33
+ return 'host';
34
+ case 'cli':
35
+ return 'host';
36
+ case 'remote':
37
+ return 'team-server';
38
+ /* v8 ignore next -- closed union; a new route must fail compilation here. */
39
+ default:
40
+ return 'host';
41
+ }
42
+ }
43
+ /**
44
+ * Build the `meta` envelope for one execution.
45
+ *
46
+ * Every field comes from host state or the contract, never from the model's
47
+ * output, which is what makes the provenance trustworthy (DECL-03).
48
+ * @param binding - the contract and implementation that are executing.
49
+ * @param host - the host identity to stamp.
50
+ * @param warnings - non-fatal conditions observed during this call.
51
+ * @returns the envelope.
52
+ */
53
+ export function buildMeta(binding, host, warnings = []) {
54
+ return {
55
+ contract: binding.contract.contract,
56
+ contractVersion: binding.contract.version,
57
+ implementationId: binding.implementation.id,
58
+ extension: host.extension,
59
+ extensionVersion: host.extensionVersion,
60
+ activationGeneration: host.activationGeneration,
61
+ executionLocation: executionLocationOf(binding.route),
62
+ receiptId: host.nextReceiptId(),
63
+ warnings: [...warnings],
64
+ };
65
+ }
66
+ /**
67
+ * Build the EXT-35 receipt for one call.
68
+ *
69
+ * Separate from {@link buildMeta} because it answers a different question: the
70
+ * envelope says what the caller received, while the receipt says what RAN and from
71
+ * which bytes. The extra provenance — the extension package, its content digest,
72
+ * the model and recipe identity — is what makes a receipt usable after the fact,
73
+ * when the version alone no longer identifies the code.
74
+ * @param binding - the contract and the implementation chosen for it.
75
+ * @param host - host identity and the receipt factory.
76
+ * @param meta - the envelope already stamped, for the receipt identity.
77
+ * @returns the invocation receipt.
78
+ */
79
+ export function buildReceipt(binding, host, meta, warnings = []) {
80
+ return buildInvocationReceipt({
81
+ receiptId: meta.receiptId,
82
+ contract: binding.contract.contract,
83
+ contractVersion: binding.contract.version,
84
+ implementationId: binding.implementation.id,
85
+ extension: binding.implementation.provider?.extension
86
+ ?? host.extension,
87
+ extensionVersion: host.extensionVersion,
88
+ // The catalog carries no digest, so it is reported as unknown rather than
89
+ // invented. A receipt that guesses at provenance is worse than one that admits
90
+ // it does not have it.
91
+ extensionContentDigest: null,
92
+ dependencyLockDigest: null,
93
+ modelIdentity: binding.implementation.provider?.modelId ?? binding.implementation.id,
94
+ recipeVersion: null,
95
+ activationGeneration: host.activationGeneration,
96
+ executionLocation: executionLocationOf(binding.route),
97
+ warnings,
98
+ });
99
+ }
100
+ /**
101
+ * Register one contract as a single DSH tool.
102
+ *
103
+ * The tool body validates arguments against the contract, applies the cross-field
104
+ * rules the DSH DSL cannot express, invokes the selected implementation, then
105
+ * validates the RESULT before returning it. A violation surfaces as a tool
106
+ * failure rather than as malformed data reaching a caller (AT-11).
107
+ * @param ctx - the context whose tool registry receives the definition.
108
+ * @param binding - the contract and the implementation chosen for it.
109
+ * @param host - host identity to stamp into results.
110
+ * @returns the registered tool name and the registry disposer.
111
+ */
112
+ export function registerContractTool(ctx, binding, host) {
113
+ const { contract, adapter, implementation } = binding;
114
+ // Registration and argument validation must agree, so the contract is checked
115
+ // here rather than trusted: a definition that cannot compile would otherwise
116
+ // fail only when a caller happened to hit the broken branch.
117
+ assertValidContract(contract);
118
+ const rules = crossFieldRules(contract);
119
+ const definition = defineTool({
120
+ name: contract.toolName,
121
+ description: contract.description,
122
+ // `toDshParameters` returns the projected JSON-Schema subset; the registry's
123
+ // DSL type is structurally narrower, and `ProjectionError` has already
124
+ // refused any keyword the DSL cannot express.
125
+ parameters: toDshParameters(contract),
126
+ output: {
127
+ /**
128
+ * The PROJECTED output schema, closing the DECL-02 advertisement gap.
129
+ *
130
+ * The registry validates every success against this advertised schema, so it may
131
+ * never be STRICTER than the contract. `projectSchemaToDsh` only loosens: it drops
132
+ * keywords the DSH value-schema DSL cannot carry (`items` at depth, non-scalar
133
+ * `enum`, `minimum`/`pattern`/`minLength`), records each in `runtimeEnforced`, and
134
+ * keeps every property name, type and closedness. `assertValidOutput` still
135
+ * enforces the FULL contract at runtime, so the projection is advertisement-only.
136
+ *
137
+ * The open `{type:"object", additionalProperties:true}` this replaces declared
138
+ * nothing about any field; the projection names every property, its type and its
139
+ * requiredness — a genuine declaration. Registration was previously impossible
140
+ * because the projection mangled scalar enums into objects (`{0:'host',...}`) via
141
+ * an array/record confusion in stripItems; that defect is fixed and probed.
142
+ */
143
+ schema: {
144
+ type: 'object',
145
+ properties: projectSchemaToDsh(contract.outputSchema).parameters,
146
+ additionalProperties: false,
147
+ },
148
+ render: (_args, value) => {
149
+ const record = value;
150
+ return [{ type: 'text', text: renderForModel(contract, record) }];
151
+ },
152
+ },
153
+ async execute(args, exec) {
154
+ const record = args;
155
+ assertValidInput(contract, record);
156
+ for (const rule of rules) {
157
+ const violation = rule(record);
158
+ if (violation !== undefined) {
159
+ throw new Error(`${contract.toolName}: ${violation}`);
160
+ }
161
+ }
162
+ // SEC-03: the grant is consulted before any work happens, so an ungranted
163
+ // tool is refused before inference rather than after it.
164
+ authorizeTool(host.grant, contract.toolName);
165
+ const authority = createInvocationAuthority(host.grant, host.callerKind);
166
+ // The contract's caller-facing arguments are translated into the adapter's
167
+ // native vocabulary before invocation; the reverse translation runs on the
168
+ // result. Both are explicit, so a name change on either side is a compile-
169
+ // or test-time failure rather than a runtime mystery.
170
+ const nativeArgs = toNativeArgs(contract.contract, record);
171
+ const native = await adapter.invoke({ args: nativeArgs, signal: exec.signal, authority });
172
+ // The implementation's native result is translated into the contract's
173
+ // payload before validation: the contract is the authority, so a mismatch is
174
+ // resolved here rather than by loosening the schema.
175
+ const payload = toContractPayload(contract.contract, native, record);
176
+ // `ToolMeta` is a plain interface without an index signature, so it is not
177
+ // structurally a `JsonValue`; the value is losslessly JSON either way, and
178
+ // `assertValidOutput` is the real check.
179
+ const meta = buildMeta(binding, host);
180
+ const value = { ...payload, meta };
181
+ assertValidOutput(contract, value);
182
+ // EXT-35: the receipt is emitted once the call SUCCEEDED. A receipt for a
183
+ // call that failed validation would claim provenance for a result nobody
184
+ // received, so the sink sees only calls that actually completed.
185
+ host.recordReceipt?.(buildReceipt(binding, host, meta));
186
+ /**
187
+ * The cast exists because the projected schema's inferred type is a closed
188
+ * record, while the registry validates the VALUE against the projected schema
189
+ * (which only LOOSENS the contract) and `assertValidOutput` enforces the full
190
+ * contract. The value is losslessly JSON and has passed both; the type-level
191
+ * fiction is contained to this return.
192
+ */
193
+ return value;
194
+ },
195
+ presentCall(callArgs) {
196
+ const primary = Object.values(callArgs)[0];
197
+ return {
198
+ card: 'generic',
199
+ title: contract.toolName,
200
+ kind: 'read',
201
+ ...typeof primary === 'string' ? { rawInput: primary } : {},
202
+ };
203
+ },
204
+ });
205
+ void implementation;
206
+ return { toolName: contract.toolName, dispose: ctx.tools.register(definition) };
207
+ }
208
+ /**
209
+ * Register a STANDARD contract tool served by an ACTIVE extension's
210
+ * IMPLEMENTATION (TASK-121), mirroring {@link registerContractTool} with the
211
+ * execution bound to a host-supplied dispatch instead of a catalogue adapter.
212
+ *
213
+ * The tool name, description and schemas come from the CONTRACT definition —
214
+ * never invented per extension — and the dispatch hands the CONTRACT-shaped
215
+ * input to the extension's implementation (the extension reads the standard
216
+ * shapes directly). Input/output validation, the grant authorization, the
217
+ * meta stamping and the receipt are the SAME discipline the catalogue path
218
+ * applies, so the two routes cannot diverge.
219
+ * @param ctx - the context whose tool registry receives the definition.
220
+ * @param contract - the standard contract definition.
221
+ * @param host - host identity to stamp into results.
222
+ * @param dispatch - executes through the extension implementation.
223
+ * @returns the registered tool name and the registry disposer.
224
+ */
225
+ export function registerContractImplementationTool(ctx, contract, host, dispatch, implementation) {
226
+ assertValidContract(contract);
227
+ const rules = crossFieldRules(contract);
228
+ // The minimal binding-lite the provenance builders read: the meta names the
229
+ // extension's implementation, and the receipt records the extension package.
230
+ const bindingLite = {
231
+ contract,
232
+ implementation: {
233
+ id: implementation.id,
234
+ provider: { extension: implementation.extensionId, modelId: implementation.modelId },
235
+ },
236
+ route: 'extension',
237
+ };
238
+ const definition = defineTool({
239
+ name: contract.toolName,
240
+ description: contract.description,
241
+ parameters: toDshParameters(contract),
242
+ output: {
243
+ schema: {
244
+ type: 'object',
245
+ properties: projectSchemaToDsh(contract.outputSchema).parameters,
246
+ additionalProperties: false,
247
+ },
248
+ render: (_args, value) => {
249
+ const record = value;
250
+ return [{ type: 'text', text: renderForModel(contract, record) }];
251
+ },
252
+ },
253
+ async execute(args, exec) {
254
+ const record = args;
255
+ assertValidInput(contract, record);
256
+ for (const rule of rules) {
257
+ const violation = rule(record);
258
+ if (violation !== undefined) {
259
+ throw new Error(`${contract.toolName}: ${violation}`);
260
+ }
261
+ }
262
+ authorizeTool(host.grant, contract.toolName);
263
+ const value = await dispatch(record, exec.signal);
264
+ const meta = buildMeta(bindingLite, host);
265
+ const stamped = { ...value, meta };
266
+ assertValidOutput(contract, stamped);
267
+ host.recordReceipt?.(buildReceipt(bindingLite, host, meta));
268
+ return stamped;
269
+ },
270
+ presentCall(callArgs) {
271
+ const primary = Object.values(callArgs)[0];
272
+ return {
273
+ card: 'generic',
274
+ title: contract.toolName,
275
+ kind: 'read',
276
+ ...typeof primary === 'string' ? { rawInput: primary } : {},
277
+ };
278
+ },
279
+ });
280
+ return { toolName: contract.toolName, dispose: ctx.tools.register(definition) };
281
+ }
282
+ /**
283
+ * Render a contract result for the model.
284
+ *
285
+ * The canonical value is the source of truth; this only chooses the presentation.
286
+ * It never invents a field the contract did not declare.
287
+ * @param contract - the contract that produced the value.
288
+ * @param value - the validated canonical value.
289
+ * @returns a short text projection.
290
+ */
291
+ function renderForModel(contract, value) {
292
+ if (contract.contract === 'text.language_detect') {
293
+ const language = value.language;
294
+ const candidates = Array.isArray(value.candidates) ? value.candidates : [];
295
+ const detail = candidates
296
+ .filter((candidate) => typeof candidate === 'object' && candidate !== null
297
+ && typeof candidate.language === 'string')
298
+ .map(candidate => `${candidate.language} ${(candidate.probability * 100).toFixed(1)}%`)
299
+ .join(', ');
300
+ const tooClose = value.tooCloseToCall === true ? ' (too close to call)' : '';
301
+ return `Detected language: ${String(language)}${tooClose}`
302
+ + (detail.length > 0 ? `\nCandidates: ${detail}` : '');
303
+ }
304
+ if (contract.contract === 'stt.transcribe') {
305
+ const text = typeof value.text === 'string' ? value.text : '';
306
+ const coverage = value.coverage;
307
+ const partial = coverage?.complete === false
308
+ ? `\n[warnings] partial transcript: ${String(coverage.transcribedSeconds ?? 0)}s covered\n`
309
+ : '';
310
+ return text.length > 0 ? `${text}${partial}` : `(no speech recognized)${partial}`;
311
+ }
312
+ return JSON.stringify(value, null, 2);
313
+ }
314
+ //# sourceMappingURL=bindings.js.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Host-release trusted built-ins (EXT-03).
3
+ *
4
+ * The lock is read from the HOST package, never from an extension manifest, so a
5
+ * package cannot grant itself built-in status or extra trust by declaring it.
6
+ * A missing/malformed lock fails closed with an empty protected set.
7
+ */
8
+ /** One trusted built-in entry. */
9
+ export interface BuiltinEntry {
10
+ readonly extensionId: string;
11
+ readonly package?: string;
12
+ readonly protected: boolean;
13
+ }
14
+ /** The host-release built-ins lock. */
15
+ export interface BuiltinsLock {
16
+ readonly version: number;
17
+ readonly builtins: readonly BuiltinEntry[];
18
+ }
19
+ /** Read and validate the lock next to this module. */
20
+ export declare function loadBuiltinsLock(url?: URL): BuiltinsLock;
21
+ /** The lock shipped with this host release. */
22
+ export declare const BUILTINS_LOCK: BuiltinsLock;
23
+ /** Extension ids the host release protects from uninstall. */
24
+ export declare const PROTECTED_BUILTIN_IDS: readonly string[];
25
+ /** Whether an extension is a protected built-in of THIS host release. */
26
+ export declare function isProtectedBuiltin(extensionId: string): boolean;
27
+ //# sourceMappingURL=builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,kCAAkC;AAClC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAA;CAC3C;AAED,sDAAsD;AACtD,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,GAAuD,GAAG,YAAY,CAkB3G;AAED,+CAA+C;AAC/C,eAAO,MAAM,aAAa,EAAE,YAAiC,CAAA;AAE7D,8DAA8D;AAC9D,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAElD,CAAA;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE/D"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Host-release trusted built-ins (EXT-03).
3
+ *
4
+ * The lock is read from the HOST package, never from an extension manifest, so a
5
+ * package cannot grant itself built-in status or extra trust by declaring it.
6
+ * A missing/malformed lock fails closed with an empty protected set.
7
+ */
8
+ import { readFileSync } from 'node:fs';
9
+ /** Read and validate the lock next to this module. */
10
+ export function loadBuiltinsLock(url = new URL('../builtins.lock.json', import.meta.url)) {
11
+ const parsed = JSON.parse(readFileSync(url, 'utf8'));
12
+ if (parsed.version !== 1 || !Array.isArray(parsed.builtins)) {
13
+ throw new Error('builtins.lock.json must carry version 1 and a builtins array');
14
+ }
15
+ const builtins = parsed.builtins.map((entry, index) => {
16
+ if (entry === null || typeof entry !== 'object') {
17
+ throw new Error(`builtins.lock.json builtins[${index}] is not an object`);
18
+ }
19
+ if (typeof entry.extensionId !== 'string' || entry.extensionId.length === 0) {
20
+ throw new Error(`builtins.lock.json builtins[${index}].extensionId must be a non-empty string`);
21
+ }
22
+ if (typeof entry.protected !== 'boolean') {
23
+ throw new Error(`builtins.lock.json builtins[${index}].protected must be a boolean`);
24
+ }
25
+ return { ...entry };
26
+ });
27
+ return { version: 1, builtins };
28
+ }
29
+ /** The lock shipped with this host release. */
30
+ export const BUILTINS_LOCK = loadBuiltinsLock();
31
+ /** Extension ids the host release protects from uninstall. */
32
+ export const PROTECTED_BUILTIN_IDS = Object.freeze(BUILTINS_LOCK.builtins.filter(entry => entry.protected).map(entry => entry.extensionId));
33
+ /** Whether an extension is a protected built-in of THIS host release. */
34
+ export function isProtectedBuiltin(extensionId) {
35
+ return PROTECTED_BUILTIN_IDS.includes(extensionId);
36
+ }
37
+ //# sourceMappingURL=builtins.js.map
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Capability resolution: decide whether a catalog model can actually run in
3
+ * this DSH process, and by which route.
4
+ *
5
+ * The rule this module enforces is that a model becomes a tool only when an
6
+ * adapter can really invoke it. Every other model stays catalogued and
7
+ * reportable, so `model_tools` can explain what is missing instead of the agent
8
+ * discovering a broken tool at call time.
9
+ *
10
+ * @module @try-works/dsh-tool-mode/capability
11
+ */
12
+ import type { CapabilityVerdict, ModelCatalogEntry } from './types.ts';
13
+ /**
14
+ * Whether a package specifier resolves from this plugin's installation.
15
+ *
16
+ * Resolution deliberately does not load the module: importing a model package
17
+ * pulls in a WASM or native runtime, and capability probing must stay cheap
18
+ * enough to run at plugin load.
19
+ * @param specifier - package name, optionally with a subpath.
20
+ * @returns whether Node can resolve the specifier.
21
+ */
22
+ export declare function canResolve(specifier: string): boolean;
23
+ /** Join a package and its documented subpath into one specifier. */
24
+ export declare function packageSpecifier(pkg: string, subpath: string | null): string;
25
+ /**
26
+ * Resolve how (and whether) one model can run here.
27
+ *
28
+ * Transport preference is deliberate: an in-process package is fastest and
29
+ * needs no external service, so it wins; the CLI is local but out-of-process;
30
+ * the bridge is last because it depends on another machine. A user who would
31
+ * rather route everything through a bridge can disable the other two.
32
+ * @param entry - the catalog entry to resolve.
33
+ * @param options - overrides for testing; `resolve`, `platform` and the transport switches replace the process facts.
34
+ * @returns the verdict, including the reason for every negative one.
35
+ */
36
+ export declare function resolveCapability(entry: ModelCatalogEntry, options?: {
37
+ readonly resolve?: (specifier: string) => boolean;
38
+ readonly platform?: NodeJS.Platform;
39
+ /** Whether the Desert Ant CLI is on PATH. */
40
+ readonly cliAvailable?: boolean;
41
+ /** Whether a bridge endpoint is configured. */
42
+ readonly remoteEndpoint?: string | undefined;
43
+ /** Turn off in-process npm resolution, to force another transport. */
44
+ readonly allowNpm?: boolean;
45
+ }): CapabilityVerdict;
46
+ /** One model plus its resolved capability verdict. */
47
+ export interface ResolvedModel {
48
+ readonly entry: ModelCatalogEntry;
49
+ readonly verdict: CapabilityVerdict;
50
+ }
51
+ /**
52
+ * Resolve every catalog entry.
53
+ * @param entries - validated catalog entries.
54
+ * @param options - resolution overrides, forwarded to {@link resolveCapability}.
55
+ * @returns one record per entry, in catalog order.
56
+ */
57
+ export declare function resolveCatalog(entries: readonly ModelCatalogEntry[], options?: Parameters<typeof resolveCapability>[1]): ResolvedModel[];
58
+ //# sourceMappingURL=capability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAWtE;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAOrD;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAE5E;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE;IACP,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAA;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;IACnC,6CAA6C;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5C,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACvB,GACL,iBAAiB,CA+GnB;AAED,sDAAsD;AACtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAA;CACpC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,OAAO,GAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAM,GACpD,aAAa,EAAE,CAEjB"}