@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,189 @@
1
+ /**
2
+ * The bounded external-MCP call ledger (plan §3.4).
3
+ *
4
+ * External MCP `tools/call`s are not session events, so the only honest way to answer
5
+ * "MCP was used, by whom, how often" is to persist them. One JSONL row per call, trimmed
6
+ * at a bound, written beside the host state.
7
+ *
8
+ * The record TYPE is the privacy boundary: it has identity, timings, failure class,
9
+ * sizes and the receipt id, and deliberately nowhere to put arguments, results,
10
+ * credentials or the bearer token. A future change cannot start logging payloads by
11
+ * accident without changing this type.
12
+ *
13
+ * @module @try-works/dsh-tool-mode/mcp-usage
14
+ */
15
+ import { appendFileSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
16
+ import { dirname } from 'node:path';
17
+ /** How many rows the ledger retains. */
18
+ export const MCP_USAGE_MAX_ROWS = 5_000;
19
+ /** The default page size for a call-log request. */
20
+ export const MCP_USAGE_DEFAULT_PAGE_SIZE = 50;
21
+ /** What the accounting hook supplies, plus the tool name it now carries. */
22
+ export function recordFromAccounting(toolName, accounting, time = Date.now()) {
23
+ return {
24
+ time,
25
+ tool: toolName,
26
+ clientId: accounting.clientId ?? 'unknown',
27
+ grantId: accounting.grantId ?? null,
28
+ totalMs: accounting.timings.totalMs,
29
+ queuedMs: accounting.timings.queuedMs,
30
+ loadMs: accounting.timings.loadMs,
31
+ inferenceMs: accounting.timings.inferenceMs,
32
+ failureClass: accounting.failureClass,
33
+ reason: accounting.reason,
34
+ inputBytes: accounting.sizes.inputBytes,
35
+ outputBytes: accounting.sizes.outputBytes,
36
+ receiptId: accounting.receiptId,
37
+ };
38
+ }
39
+ /** A finite number, else null. */
40
+ function numberOrNull(value) {
41
+ return typeof value === 'number' && Number.isFinite(value) ? value : null;
42
+ }
43
+ /** Read one raw ledger line as a record, or null when it is not one. */
44
+ function readRecord(raw) {
45
+ let parsed;
46
+ try {
47
+ parsed = JSON.parse(raw);
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed))
53
+ return null;
54
+ // SAFETY: the guard above proved a non-null, non-array object; every field the record
55
+ // needs is type-checked below before it is copied into the typed result.
56
+ const record = parsed;
57
+ const time = numberOrNull(record['time']);
58
+ const totalMs = numberOrNull(record['totalMs']);
59
+ if (time === null || totalMs === null)
60
+ return null;
61
+ if (typeof record['tool'] !== 'string' || typeof record['clientId'] !== 'string')
62
+ return null;
63
+ if (typeof record['receiptId'] !== 'string' || typeof record['failureClass'] !== 'string')
64
+ return null;
65
+ return {
66
+ time,
67
+ tool: record['tool'],
68
+ clientId: record['clientId'],
69
+ grantId: typeof record['grantId'] === 'string' ? record['grantId'] : null,
70
+ totalMs,
71
+ queuedMs: numberOrNull(record['queuedMs']) ?? 0,
72
+ loadMs: numberOrNull(record['loadMs']) ?? 0,
73
+ inferenceMs: numberOrNull(record['inferenceMs']) ?? 0,
74
+ failureClass: record['failureClass'],
75
+ reason: typeof record['reason'] === 'string' ? record['reason'] : null,
76
+ inputBytes: numberOrNull(record['inputBytes']) ?? 0,
77
+ outputBytes: numberOrNull(record['outputBytes']) ?? 0,
78
+ receiptId: record['receiptId'],
79
+ };
80
+ }
81
+ /**
82
+ * A bounded JSONL ledger over one file.
83
+ *
84
+ * Operations are synchronous and defensive: an unreadable or corrupt line contributes
85
+ * nothing, and a rotated file keeps the newest rows rather than failing the append.
86
+ */
87
+ export class McpUsageLedger {
88
+ #file;
89
+ #maxRows;
90
+ /**
91
+ * @param file - the JSONL path.
92
+ * @param options - `maxRows` defaults to {@link MCP_USAGE_MAX_ROWS}.
93
+ */
94
+ constructor(file, options = {}) {
95
+ this.#file = file;
96
+ this.#maxRows = Math.max(2, options.maxRows ?? MCP_USAGE_MAX_ROWS);
97
+ }
98
+ /** The ledger path (the MCP status surface names it, never its contents). */
99
+ get file() {
100
+ return this.#file;
101
+ }
102
+ /** All readable rows, oldest first. */
103
+ #rows() {
104
+ let text;
105
+ try {
106
+ text = readFileSync(this.#file, 'utf8');
107
+ }
108
+ catch {
109
+ return [];
110
+ }
111
+ const rows = [];
112
+ for (const line of text.split('\n')) {
113
+ if (line.trim().length === 0)
114
+ continue;
115
+ const record = readRecord(line);
116
+ if (record !== null)
117
+ rows.push(record);
118
+ }
119
+ return rows;
120
+ }
121
+ /** Atomically replace the file with exactly these rows. */
122
+ #write(rows) {
123
+ mkdirSync(dirname(this.#file), { recursive: true });
124
+ const temporary = `${this.#file}.${process.pid}.${Date.now().toString(36)}.tmp`;
125
+ writeFileSync(temporary, rows.map(row => `${JSON.stringify(row)}\n`).join(''), 'utf8');
126
+ renameSync(temporary, this.#file);
127
+ }
128
+ /**
129
+ * Append one call, trimming at the bound.
130
+ * @param call - the record to persist.
131
+ */
132
+ record(call) {
133
+ mkdirSync(dirname(this.#file), { recursive: true });
134
+ const existing = this.#rows();
135
+ if (existing.length >= this.#maxRows) {
136
+ // Rotation: keep the newest (bound - 1) rows, then append the new one.
137
+ this.#write([...existing.slice(existing.length - (this.#maxRows - 1)), call]);
138
+ return;
139
+ }
140
+ appendFileSync(this.#file, `${JSON.stringify(call)}\n`, 'utf8');
141
+ }
142
+ /**
143
+ * Read one page, newest first.
144
+ * @param query - optional client filter and 1-based page.
145
+ * @returns the page plus the matching total and the ledger's client identities.
146
+ */
147
+ read(query = {}) {
148
+ const all = this.#rows();
149
+ const clients = [...new Set(all.map(row => row.clientId))].sort((left, right) => left.localeCompare(right));
150
+ const matching = query.clientId === undefined ? all : all.filter(row => row.clientId === query.clientId);
151
+ const page = Math.max(1, Math.trunc(query.page ?? 1));
152
+ const pageSize = Math.min(200, Math.max(1, Math.trunc(query.pageSize ?? MCP_USAGE_DEFAULT_PAGE_SIZE)));
153
+ const newestFirst = [...matching].reverse();
154
+ const start = (page - 1) * pageSize;
155
+ return {
156
+ calls: newestFirst.slice(start, start + pageSize),
157
+ total: matching.length,
158
+ page,
159
+ pageSize,
160
+ clients,
161
+ };
162
+ }
163
+ /** Aggregate the ledger by client and tool. */
164
+ summarize() {
165
+ const rows = this.#rows();
166
+ const clients = new Map();
167
+ const tools = new Map();
168
+ for (const row of rows) {
169
+ const client = clients.get(row.clientId) ?? { calls: 0, errors: 0, lastSeen: 0, grantId: null };
170
+ clients.set(row.clientId, {
171
+ calls: client.calls + 1,
172
+ errors: client.errors + (row.failureClass === 'none' ? 0 : 1),
173
+ lastSeen: Math.max(client.lastSeen, row.time),
174
+ grantId: row.grantId ?? client.grantId,
175
+ });
176
+ tools.set(row.tool, (tools.get(row.tool) ?? 0) + 1);
177
+ }
178
+ return {
179
+ total: rows.length,
180
+ clients: [...clients.entries()]
181
+ .map(([clientId, client]) => ({ clientId, ...client }))
182
+ .sort((left, right) => left.clientId.localeCompare(right.clientId)),
183
+ tools: [...tools.entries()]
184
+ .map(([tool, calls]) => ({ tool, calls }))
185
+ .sort((left, right) => right.calls - left.calls || left.tool.localeCompare(right.tool)),
186
+ };
187
+ }
188
+ }
189
+ //# sourceMappingURL=mcp-usage.js.map
@@ -0,0 +1,192 @@
1
+ /**
2
+ * Model qualification and capability resolution (MODEL-01, MODEL-04, MODEL-05, MODEL-06).
3
+ *
4
+ * Four rules, each guarding a way of claiming more than is known:
5
+ *
6
+ * - **A platform table is not proof of correct inference** (MODEL-05). A record is
7
+ * qualified only when the exact revision, artifact hash, tokenizer, processor, engine
8
+ * version, ABI and execution provider are all recorded. A missing field is a GAP, and
9
+ * a gap is not a qualification.
10
+ * - **A model's modality list is not an adapter's** (MODEL-05). A model can support
11
+ * video while the selected adapter does not, so what is ADVERTISED is the INTERSECTION
12
+ * of the two, described as such.
13
+ * - **A model name is not a capability test** (MODEL-06). Capability comes from the
14
+ * resolved model, never from recognising a brand.
15
+ * - **Unknown is not unsupported** (MODEL-06). The requirement says to record them
16
+ * separately, because collapsing them lets an unevaluated capability be reported as a
17
+ * known absence — or, worse, the reverse.
18
+ *
19
+ * @module @try-works/dsh-tool-mode/model-qualification
20
+ */
21
+ /**
22
+ * What is known about one capability.
23
+ *
24
+ * Three states rather than two, because MODEL-06 requires unknown and unsupported to be
25
+ * recorded separately.
26
+ */
27
+ export type CapabilityState =
28
+ /** Evaluated, and it works. */
29
+ 'supported'
30
+ /** Evaluated, and it does not. */
31
+ | 'unsupported'
32
+ /** NOT evaluated. Reporting this as either of the others is the defect. */
33
+ | 'unknown';
34
+ /** A capability of a model or an adapter. */
35
+ export type Modality = 'text' | 'code' | 'image' | 'audio' | 'video' | 'embedding';
36
+ /**
37
+ * The exact path a model is executed through (MODEL-05).
38
+ *
39
+ * Every field is required for qualification, because each one has been the difference
40
+ * between "the package imports" and "inference is correct".
41
+ */
42
+ export interface QualificationRecord {
43
+ /** The model revision, not a branch or floating tag. */
44
+ readonly modelRevision: string;
45
+ /** The SHA of the exported artifact that is actually loaded. */
46
+ readonly artifactSha: string;
47
+ /** The tokenizer identity. */
48
+ readonly tokenizer: string;
49
+ /** The processor or preprocessing recipe identity. */
50
+ readonly processor: string;
51
+ /** The engine or package version. */
52
+ readonly engineVersion: string;
53
+ /** The Node ABI. */
54
+ readonly nodeAbi: string;
55
+ /** The CPU architecture, e.g. `x64`. */
56
+ readonly architecture: string;
57
+ /** The execution provider, e.g. `cpu` or `wasm`. */
58
+ readonly executionProvider: string;
59
+ }
60
+ /** The fields a qualification record must carry. */
61
+ export declare const QUALIFICATION_FIELDS: readonly (keyof QualificationRecord)[];
62
+ /**
63
+ * Report which qualification fields are missing (MODEL-05).
64
+ *
65
+ * A platform table, a successful package import or a runnable base model is not proof of
66
+ * correct inference, so a record with gaps is not a qualification however well it runs.
67
+ * @param record - the partial record.
68
+ * @returns the missing fields.
69
+ */
70
+ export declare function qualificationGaps(record: Partial<QualificationRecord>): readonly (keyof QualificationRecord)[];
71
+ /**
72
+ * Whether a record qualifies a path (MODEL-05).
73
+ * @param record - the partial record.
74
+ * @returns whether every required field is present.
75
+ */
76
+ export declare function isQualified(record: Partial<QualificationRecord>): record is QualificationRecord;
77
+ /** What a model supports, and what an adapter supports. */
78
+ export interface ModalityClaim {
79
+ readonly modelSupports: readonly Modality[];
80
+ readonly adapterSupports: readonly Modality[];
81
+ }
82
+ /**
83
+ * The capabilities that may be ADVERTISED (MODEL-05).
84
+ *
85
+ * The intersection, because a model can support a modality while the selected adapter
86
+ * does not. Advertising the model's list would promise something the adapter cannot do.
87
+ * @param claim - what each side supports.
88
+ * @returns the advertisable modalities.
89
+ */
90
+ export declare function advertisableModalities(claim: ModalityClaim): readonly Modality[];
91
+ /**
92
+ * Describe a model's capability as the INTERSECTION (MODEL-05).
93
+ *
94
+ * The description names what is not advertisable and why, so a reader is not left to
95
+ * infer that the model lacks the modality when in fact the adapter does.
96
+ * @param claim - what each side supports.
97
+ * @returns a description that is true of the pairing.
98
+ */
99
+ export declare function describeCapability(claim: ModalityClaim): string;
100
+ /**
101
+ * Resolve one capability (MODEL-06).
102
+ *
103
+ * A capability is resolved from what was EVALUATED. A model name is never consulted,
104
+ * because a brand is not a capability test, and an unevaluated capability returns
105
+ * `unknown` rather than being inferred from a sibling.
106
+ * @param evidence - the observed result, or undefined when not evaluated.
107
+ * @returns the state.
108
+ */
109
+ export declare function resolveCapability(evidence: boolean | undefined): CapabilityState;
110
+ /**
111
+ * Whether a model name may be used to infer a capability (MODEL-06).
112
+ *
113
+ * It may not. Returns false so the prohibition is asserted rather than merely intended:
114
+ * a rule that lives only in a comment is one a future branch will not read.
115
+ * @returns always false.
116
+ */
117
+ export declare function modelNameImpliesCapability(): boolean;
118
+ /** How a candidate implementation executes (MODEL-04). */
119
+ export type ExecutionMode =
120
+ /** Pure JavaScript or WASM usable in plain Node. */
121
+ 'js-wasm-node'
122
+ /** Prebuilt ONNX Runtime for Node. */
123
+ | 'onnxruntime-node'
124
+ /** A managed native Windows executable with pinned assets. */
125
+ | 'managed-native-windows'
126
+ /** Requires Python on the end user's machine. */
127
+ | 'python-required'
128
+ /** Requires WSL. */
129
+ | 'wsl-required'
130
+ /** Requires Docker. */
131
+ | 'docker-required'
132
+ /** Requires a GPU. */
133
+ | 'gpu-required'
134
+ /** Only works in a browser. */
135
+ | 'browser-only'
136
+ /** Requires a consumer-side compile step. */
137
+ | 'consumer-compile';
138
+ /** Why a mode was refused. */
139
+ export interface ModeVerdict {
140
+ readonly acceptable: boolean;
141
+ readonly reason?: string;
142
+ }
143
+ /**
144
+ * Whether an execution mode is acceptable for the end user (MODEL-04).
145
+ *
146
+ * Python, WSL, Docker, a GPU and a consumer compile step are all refused: maintainers may
147
+ * use Python to export artifacts, but it MUST NOT be required on an end user's Windows
148
+ * machine. A browser-only API does not establish Node support.
149
+ * @param mode - the mode.
150
+ * @returns the verdict, with a reason when refused.
151
+ */
152
+ export declare function executionModeVerdict(mode: ExecutionMode): ModeVerdict;
153
+ /** An embedding space identity (MODEL-01, BASE-12). */
154
+ export interface EmbeddingSpace {
155
+ /** The model that produces it. */
156
+ readonly modelId: string;
157
+ /** The dimensionality of the vectors it produces. */
158
+ readonly dimensions: number;
159
+ }
160
+ /**
161
+ * Whether one embedding space may silently stand in for another (BASE-12).
162
+ *
163
+ * Only when the dimensions MATCH. EmbeddingGemma 2 is 768-dimensional and MiniLM is
164
+ * 384-dimensional, so substituting one for the other silently would compare vectors of
165
+ * different widths and produce meaningless similarity.
166
+ * @param from - the space in use.
167
+ * @param to - the proposed replacement.
168
+ * @returns whether the substitution is safe without an explicit migration.
169
+ */
170
+ export declare function maySubstituteSilently(from: EmbeddingSpace, to: EmbeddingSpace): boolean;
171
+ /**
172
+ * Describe an embedding substitution (BASE-12).
173
+ * @param from - the space in use.
174
+ * @param to - the proposed replacement.
175
+ * @returns a description naming the incompatibility when there is one.
176
+ */
177
+ export declare function describeSubstitution(from: EmbeddingSpace, to: EmbeddingSpace): string;
178
+ /**
179
+ * The reduced dimensionalities EmbeddingGemma 2 supports (MODEL-01).
180
+ *
181
+ * The model card describes 768 reducible to 512, 256 and 128. Recorded rather than
182
+ * assumed, because a reduction that is not applied consistently produces vectors that
183
+ * cannot be compared with each other.
184
+ */
185
+ export declare const EMBEDDINGGEMMA2_DIMENSIONS: readonly number[];
186
+ /**
187
+ * Whether a stated dimensionality is one EmbeddingGemma 2 can produce (MODEL-01).
188
+ * @param dimensions - the stated width.
189
+ * @returns whether it is a documented width.
190
+ */
191
+ export declare function isEmbeddingGemma2Width(dimensions: number): boolean;
192
+ //# sourceMappingURL=model-qualification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-qualification.d.ts","sourceRoot":"","sources":["../src/model-qualification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,eAAe;AACzB,+BAA+B;AAC7B,WAAW;AACb,kCAAkC;GAChC,aAAa;AACf,2EAA2E;GACzE,SAAS,CAAA;AAEb,6CAA6C;AAC7C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAA;AAElF;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,8BAA8B;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,oBAAoB;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,wCAAwC;IACxC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;CACnC;AAED,oDAAoD;AACpD,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,MAAM,mBAAmB,CAAC,EAGtE,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC,MAAM,mBAAmB,CAAC,EAAE,CAK9G;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,MAAM,IAAI,mBAAmB,CAE/F;AAED,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,aAAa,EAAE,SAAS,QAAQ,EAAE,CAAA;IAC3C,QAAQ,CAAC,eAAe,EAAE,SAAS,QAAQ,EAAE,CAAA;CAC9C;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,QAAQ,EAAE,CAGhF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAW/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,eAAe,CAGhF;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED,0DAA0D;AAC1D,MAAM,MAAM,aAAa;AACvB,oDAAoD;AAClD,cAAc;AAChB,sCAAsC;GACpC,kBAAkB;AACpB,8DAA8D;GAC5D,wBAAwB;AAC1B,iDAAiD;GAC/C,iBAAiB;AACnB,oBAAoB;GAClB,cAAc;AAChB,uBAAuB;GACrB,iBAAiB;AACnB,sBAAsB;GACpB,cAAc;AAChB,+BAA+B;GAC7B,cAAc;AAChB,6CAA6C;GAC3C,kBAAkB,CAAA;AAEtB,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,aAAa,GAAG,WAAW,CAsBrE;AAED,uDAAuD;AACvD,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,GAAG,OAAO,CAEvF;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,cAAc,GAAG,MAAM,CAMrF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,MAAM,EAAyB,CAAA;AAEjF;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAElE"}
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Model qualification and capability resolution (MODEL-01, MODEL-04, MODEL-05, MODEL-06).
3
+ *
4
+ * Four rules, each guarding a way of claiming more than is known:
5
+ *
6
+ * - **A platform table is not proof of correct inference** (MODEL-05). A record is
7
+ * qualified only when the exact revision, artifact hash, tokenizer, processor, engine
8
+ * version, ABI and execution provider are all recorded. A missing field is a GAP, and
9
+ * a gap is not a qualification.
10
+ * - **A model's modality list is not an adapter's** (MODEL-05). A model can support
11
+ * video while the selected adapter does not, so what is ADVERTISED is the INTERSECTION
12
+ * of the two, described as such.
13
+ * - **A model name is not a capability test** (MODEL-06). Capability comes from the
14
+ * resolved model, never from recognising a brand.
15
+ * - **Unknown is not unsupported** (MODEL-06). The requirement says to record them
16
+ * separately, because collapsing them lets an unevaluated capability be reported as a
17
+ * known absence — or, worse, the reverse.
18
+ *
19
+ * @module @try-works/dsh-tool-mode/model-qualification
20
+ */
21
+ /** The fields a qualification record must carry. */
22
+ export const QUALIFICATION_FIELDS = [
23
+ 'modelRevision', 'artifactSha', 'tokenizer', 'processor',
24
+ 'engineVersion', 'nodeAbi', 'architecture', 'executionProvider',
25
+ ];
26
+ /**
27
+ * Report which qualification fields are missing (MODEL-05).
28
+ *
29
+ * A platform table, a successful package import or a runnable base model is not proof of
30
+ * correct inference, so a record with gaps is not a qualification however well it runs.
31
+ * @param record - the partial record.
32
+ * @returns the missing fields.
33
+ */
34
+ export function qualificationGaps(record) {
35
+ return QUALIFICATION_FIELDS.filter(field => {
36
+ const value = record[field];
37
+ return typeof value !== 'string' || value.length === 0;
38
+ });
39
+ }
40
+ /**
41
+ * Whether a record qualifies a path (MODEL-05).
42
+ * @param record - the partial record.
43
+ * @returns whether every required field is present.
44
+ */
45
+ export function isQualified(record) {
46
+ return qualificationGaps(record).length === 0;
47
+ }
48
+ /**
49
+ * The capabilities that may be ADVERTISED (MODEL-05).
50
+ *
51
+ * The intersection, because a model can support a modality while the selected adapter
52
+ * does not. Advertising the model's list would promise something the adapter cannot do.
53
+ * @param claim - what each side supports.
54
+ * @returns the advertisable modalities.
55
+ */
56
+ export function advertisableModalities(claim) {
57
+ const adapter = new Set(claim.adapterSupports);
58
+ return claim.modelSupports.filter(modality => adapter.has(modality));
59
+ }
60
+ /**
61
+ * Describe a model's capability as the INTERSECTION (MODEL-05).
62
+ *
63
+ * The description names what is not advertisable and why, so a reader is not left to
64
+ * infer that the model lacks the modality when in fact the adapter does.
65
+ * @param claim - what each side supports.
66
+ * @returns a description that is true of the pairing.
67
+ */
68
+ export function describeCapability(claim) {
69
+ const advertisable = advertisableModalities(claim);
70
+ const adapter = new Set(claim.adapterSupports);
71
+ // Named rather than omitted: the model supports these, this adapter does not.
72
+ const modelOnly = claim.modelSupports.filter(modality => !adapter.has(modality));
73
+ const base = advertisable.length === 0
74
+ ? 'no modality is advertisable through this adapter'
75
+ : `advertisable: ${advertisable.join(', ')}`;
76
+ return modelOnly.length === 0
77
+ ? base
78
+ : `${base} (the model also supports ${modelOnly.join(', ')}, which this adapter does not)`;
79
+ }
80
+ /**
81
+ * Resolve one capability (MODEL-06).
82
+ *
83
+ * A capability is resolved from what was EVALUATED. A model name is never consulted,
84
+ * because a brand is not a capability test, and an unevaluated capability returns
85
+ * `unknown` rather than being inferred from a sibling.
86
+ * @param evidence - the observed result, or undefined when not evaluated.
87
+ * @returns the state.
88
+ */
89
+ export function resolveCapability(evidence) {
90
+ if (evidence === undefined)
91
+ return 'unknown';
92
+ return evidence ? 'supported' : 'unsupported';
93
+ }
94
+ /**
95
+ * Whether a model name may be used to infer a capability (MODEL-06).
96
+ *
97
+ * It may not. Returns false so the prohibition is asserted rather than merely intended:
98
+ * a rule that lives only in a comment is one a future branch will not read.
99
+ * @returns always false.
100
+ */
101
+ export function modelNameImpliesCapability() {
102
+ return false;
103
+ }
104
+ /**
105
+ * Whether an execution mode is acceptable for the end user (MODEL-04).
106
+ *
107
+ * Python, WSL, Docker, a GPU and a consumer compile step are all refused: maintainers may
108
+ * use Python to export artifacts, but it MUST NOT be required on an end user's Windows
109
+ * machine. A browser-only API does not establish Node support.
110
+ * @param mode - the mode.
111
+ * @returns the verdict, with a reason when refused.
112
+ */
113
+ export function executionModeVerdict(mode) {
114
+ switch (mode) {
115
+ case 'js-wasm-node':
116
+ case 'onnxruntime-node':
117
+ case 'managed-native-windows':
118
+ return { acceptable: true };
119
+ case 'python-required':
120
+ return {
121
+ acceptable: false,
122
+ reason: 'Python may be used by maintainers to export and verify artifacts, but must not be required on an end user machine',
123
+ };
124
+ case 'wsl-required':
125
+ return { acceptable: false, reason: 'WSL must not be required on an end user machine' };
126
+ case 'docker-required':
127
+ return { acceptable: false, reason: 'Docker must not be required on an end user machine' };
128
+ case 'gpu-required':
129
+ return { acceptable: false, reason: 'no GPU requirement is permitted' };
130
+ case 'browser-only':
131
+ return { acceptable: false, reason: 'browser-only APIs do not establish Node support' };
132
+ case 'consumer-compile':
133
+ return { acceptable: false, reason: 'no consumer-side compile is permitted' };
134
+ }
135
+ }
136
+ /**
137
+ * Whether one embedding space may silently stand in for another (BASE-12).
138
+ *
139
+ * Only when the dimensions MATCH. EmbeddingGemma 2 is 768-dimensional and MiniLM is
140
+ * 384-dimensional, so substituting one for the other silently would compare vectors of
141
+ * different widths and produce meaningless similarity.
142
+ * @param from - the space in use.
143
+ * @param to - the proposed replacement.
144
+ * @returns whether the substitution is safe without an explicit migration.
145
+ */
146
+ export function maySubstituteSilently(from, to) {
147
+ return from.dimensions === to.dimensions;
148
+ }
149
+ /**
150
+ * Describe an embedding substitution (BASE-12).
151
+ * @param from - the space in use.
152
+ * @param to - the proposed replacement.
153
+ * @returns a description naming the incompatibility when there is one.
154
+ */
155
+ export function describeSubstitution(from, to) {
156
+ if (maySubstituteSilently(from, to)) {
157
+ return `${to.modelId} produces ${to.dimensions}-dimensional vectors, matching ${from.modelId}`;
158
+ }
159
+ return `${to.modelId} produces ${to.dimensions}-dimensional vectors and ${from.modelId} produces `
160
+ + `${from.dimensions}; existing vectors are not comparable and require an explicit re-index`;
161
+ }
162
+ /**
163
+ * The reduced dimensionalities EmbeddingGemma 2 supports (MODEL-01).
164
+ *
165
+ * The model card describes 768 reducible to 512, 256 and 128. Recorded rather than
166
+ * assumed, because a reduction that is not applied consistently produces vectors that
167
+ * cannot be compared with each other.
168
+ */
169
+ export const EMBEDDINGGEMMA2_DIMENSIONS = [768, 512, 256, 128];
170
+ /**
171
+ * Whether a stated dimensionality is one EmbeddingGemma 2 can produce (MODEL-01).
172
+ * @param dimensions - the stated width.
173
+ * @returns whether it is a documented width.
174
+ */
175
+ export function isEmbeddingGemma2Width(dimensions) {
176
+ return EMBEDDINGGEMMA2_DIMENSIONS.includes(dimensions);
177
+ }
178
+ //# sourceMappingURL=model-qualification.js.map
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The host lane that turns a parsed `model-runtime` recipe into a callable tool
3
+ * (docs/runtime/PHASE2.md § Host lane).
4
+ *
5
+ * WHAT THIS MODULE OWNS, and what it deliberately does not:
6
+ *
7
+ * - It owns the CONTRACT between the recipe and DSH: the tool's name and description, the
8
+ * projection of the recipe's JSON-Schema input into what DSH can advertise, the FULL
9
+ * schema enforced at call time (the projection is intentionally looser), and the output
10
+ * check that stops a malformed payload from being published as a result.
11
+ * - It does NOT own the engine. The provider is a `ModelProviderV1` created by the factory
12
+ * the recipe names, which was resolved from the extension's own package (AT-25).
13
+ *
14
+ * TIMING IS PART OF THE DESIGN. Creating a tool resolves the provider module but does not
15
+ * import or run it; the import and the provider's `load` happen on the FIRST CALL. That keeps
16
+ * activation lightweight (EXT-19) while still refusing — at registration — a package whose
17
+ * engine is not installed, because resolution is synchronous.
18
+ *
19
+ * @module @try-works/dsh-tool-mode/model-runtime-lane
20
+ */
21
+ import type { InvocationContextV1, PreparedAssetMapV1 } from '@try-works/tool-mode-extension-sdk';
22
+ import { type ModelRuntimeRecipe, type ModelRuntimeRefusal } from './model-runtime-recipe.ts';
23
+ /** What the host hands the lane when it registers one implementation's tool. */
24
+ export interface ModelRuntimeToolDeps {
25
+ /** The extension that owns the tool, for diagnostics. */
26
+ readonly extensionId: string;
27
+ /** The implementation id the recipe belongs to (the manifest's, not the tool name). */
28
+ readonly implementationId: string;
29
+ /** The installed package directory. */
30
+ readonly installPath: string;
31
+ /** The parsed recipe. */
32
+ readonly recipe: ModelRuntimeRecipe;
33
+ /** The host-verified prepared assets for this extension; empty until prepared. */
34
+ readonly assets: () => Readonly<PreparedAssetMapV1>;
35
+ /** Build the call-scoped context the SDK contract requires. */
36
+ readonly invocationContext: (exec: {
37
+ readonly signal?: AbortSignal;
38
+ } | undefined) => InvocationContextV1;
39
+ /** Record a teardown failure without throwing out of a disposer. */
40
+ readonly onError?: (message: string) => void;
41
+ }
42
+ /** A registered tool's host-side half: what DSH advertises and what it runs. */
43
+ export interface ModelRuntimeToolHandle {
44
+ readonly name: string;
45
+ readonly description: string;
46
+ /** The DSH-advertisable parameters projected from the recipe's input schema. */
47
+ readonly parameters: Readonly<Record<string, unknown>>;
48
+ /** The recipe's own input schema, for the MCP advertisement (enforced in full above). */
49
+ readonly inputSchema: Readonly<Record<string, unknown>>;
50
+ /** The recipe's own output schema, for the MCP advertisement. */
51
+ readonly outputSchema: Readonly<Record<string, unknown>>;
52
+ readonly execute: (args: unknown, exec?: {
53
+ readonly signal?: AbortSignal;
54
+ }) => Promise<unknown>;
55
+ readonly dispose: () => Promise<void>;
56
+ }
57
+ /** The lane's outcome: a tool, or a named refusal the host turns into a refusal at registration. */
58
+ export type ModelRuntimeToolResult = {
59
+ readonly ok: true;
60
+ readonly tool: ModelRuntimeToolHandle;
61
+ } | ModelRuntimeRefusal;
62
+ /**
63
+ * Build the tool for one model-runtime implementation.
64
+ *
65
+ * @param deps - the installed package, the parsed recipe and the host's context/asset hooks.
66
+ * @returns the tool handle or a named refusal.
67
+ */
68
+ export declare function createModelRuntimeTool(deps: ModelRuntimeToolDeps): ModelRuntimeToolResult;
69
+ //# sourceMappingURL=model-runtime-lane.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-runtime-lane.d.ts","sourceRoot":"","sources":["../src/model-runtime-lane.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,KAAK,EAAE,mBAAmB,EAA+B,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAE9H,OAAO,EAIL,KAAK,kBAAkB,EAEvB,KAAK,mBAAmB,EACzB,MAAM,2BAA2B,CAAA;AAElC,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,yDAAyD;IACzD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,uFAAuF;IACvF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IACjC,uCAAuC;IACvC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAA;IACnC,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,MAAM,QAAQ,CAAC,kBAAkB,CAAC,CAAA;IACnD,+DAA+D;IAC/D,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,SAAS,KAAK,mBAAmB,CAAA;IACxG,oEAAoE;IACpE,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7C;AAED,gFAAgF;AAChF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACtD,yFAAyF;IACzF,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACvD,iEAAiE;IACjE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACxD,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC/F,QAAQ,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACtC;AAED,oGAAoG;AACpG,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAA;CAAE,GAC5D,mBAAmB,CAAA;AASvB;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,oBAAoB,GAAG,sBAAsB,CAkFzF"}