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

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 (425) hide show
  1. package/README.md +299 -2
  2. package/bin/dsh-tool-mode-credentials.mjs +20 -0
  3. package/bin/dsh-tool-mode-mcp-stdio.mjs +80 -0
  4. package/bin/dsh-tool-mode.mjs +211 -0
  5. package/builtins.lock.json +26 -0
  6. package/catalog/desert-ant-models.json +693 -0
  7. package/catalog/playbooks.json +531 -0
  8. package/client/client.model-tools.js +1910 -0
  9. package/client/index.js +4039 -0
  10. package/cordis.patch.yml +39 -0
  11. package/lib/adapters/index.d.ts +61 -0
  12. package/lib/adapters/index.d.ts.map +1 -0
  13. package/lib/adapters/index.js +82 -0
  14. package/lib/adapters/types.d.ts +106 -0
  15. package/lib/adapters/types.d.ts.map +1 -0
  16. package/lib/adapters/types.js +85 -0
  17. package/lib/approval.d.ts +189 -0
  18. package/lib/approval.d.ts.map +1 -0
  19. package/lib/approval.js +510 -0
  20. package/lib/asset-acquisition.d.ts +149 -0
  21. package/lib/asset-acquisition.d.ts.map +1 -0
  22. package/lib/asset-acquisition.js +175 -0
  23. package/lib/authority.d.ts +185 -0
  24. package/lib/authority.d.ts.map +1 -0
  25. package/lib/authority.js +223 -0
  26. package/lib/bindings.d.ts +144 -0
  27. package/lib/bindings.d.ts.map +1 -0
  28. package/lib/bindings.js +314 -0
  29. package/lib/builtins.d.ts +27 -0
  30. package/lib/builtins.d.ts.map +1 -0
  31. package/lib/builtins.js +37 -0
  32. package/lib/capability.d.ts +58 -0
  33. package/lib/capability.d.ts.map +1 -0
  34. package/lib/capability.js +192 -0
  35. package/lib/capture-path.d.ts +97 -0
  36. package/lib/capture-path.d.ts.map +1 -0
  37. package/lib/capture-path.js +152 -0
  38. package/lib/catalog.d.ts +37 -0
  39. package/lib/catalog.d.ts.map +1 -0
  40. package/lib/catalog.js +274 -0
  41. package/lib/contract-payload.d.ts +39 -0
  42. package/lib/contract-payload.d.ts.map +1 -0
  43. package/lib/contract-payload.js +56 -0
  44. package/lib/custom-tools/compile.d.ts +25 -0
  45. package/lib/custom-tools/compile.d.ts.map +1 -0
  46. package/lib/custom-tools/compile.js +61 -0
  47. package/lib/custom-tools/composite-executor.d.ts +42 -0
  48. package/lib/custom-tools/composite-executor.d.ts.map +1 -0
  49. package/lib/custom-tools/composite-executor.js +113 -0
  50. package/lib/custom-tools/dispatch.d.ts +28 -0
  51. package/lib/custom-tools/dispatch.d.ts.map +1 -0
  52. package/lib/custom-tools/dispatch.js +34 -0
  53. package/lib/custom-tools/http-executor.d.ts +48 -0
  54. package/lib/custom-tools/http-executor.d.ts.map +1 -0
  55. package/lib/custom-tools/http-executor.js +241 -0
  56. package/lib/custom-tools/index.d.ts +12 -0
  57. package/lib/custom-tools/index.d.ts.map +1 -0
  58. package/lib/custom-tools/index.js +12 -0
  59. package/lib/custom-tools/mcp-surface.d.ts +14 -0
  60. package/lib/custom-tools/mcp-surface.d.ts.map +1 -0
  61. package/lib/custom-tools/mcp-surface.js +41 -0
  62. package/lib/custom-tools/prompt-executor.d.ts +39 -0
  63. package/lib/custom-tools/prompt-executor.d.ts.map +1 -0
  64. package/lib/custom-tools/prompt-executor.js +59 -0
  65. package/lib/custom-tools/registry.d.ts +69 -0
  66. package/lib/custom-tools/registry.d.ts.map +1 -0
  67. package/lib/custom-tools/registry.js +130 -0
  68. package/lib/custom-tools/schema.d.ts +26 -0
  69. package/lib/custom-tools/schema.d.ts.map +1 -0
  70. package/lib/custom-tools/schema.js +375 -0
  71. package/lib/custom-tools/service.d.ts +90 -0
  72. package/lib/custom-tools/service.d.ts.map +1 -0
  73. package/lib/custom-tools/service.js +203 -0
  74. package/lib/custom-tools/store.d.ts +61 -0
  75. package/lib/custom-tools/store.d.ts.map +1 -0
  76. package/lib/custom-tools/store.js +240 -0
  77. package/lib/custom-tools/types.d.ts +131 -0
  78. package/lib/custom-tools/types.d.ts.map +1 -0
  79. package/lib/custom-tools/types.js +11 -0
  80. package/lib/decision-combine.d.ts +113 -0
  81. package/lib/decision-combine.d.ts.map +1 -0
  82. package/lib/decision-combine.js +156 -0
  83. package/lib/decision-evaluate.d.ts +185 -0
  84. package/lib/decision-evaluate.d.ts.map +1 -0
  85. package/lib/decision-evaluate.js +227 -0
  86. package/lib/deployment-coordinator.d.ts +213 -0
  87. package/lib/deployment-coordinator.d.ts.map +1 -0
  88. package/lib/deployment-coordinator.js +274 -0
  89. package/lib/diagnostics.d.ts +169 -0
  90. package/lib/diagnostics.d.ts.map +1 -0
  91. package/lib/diagnostics.js +136 -0
  92. package/lib/discovery-contracts.d.ts +14 -0
  93. package/lib/discovery-contracts.d.ts.map +1 -0
  94. package/lib/discovery-contracts.js +90 -0
  95. package/lib/discovery-describe.d.ts +35 -0
  96. package/lib/discovery-describe.d.ts.map +1 -0
  97. package/lib/discovery-describe.js +99 -0
  98. package/lib/embedding-index.d.ts +55 -0
  99. package/lib/embedding-index.d.ts.map +1 -0
  100. package/lib/embedding-index.js +126 -0
  101. package/lib/extension-dependencies.d.ts +355 -0
  102. package/lib/extension-dependencies.d.ts.map +1 -0
  103. package/lib/extension-dependencies.js +987 -0
  104. package/lib/extension-dispatch.d.ts +150 -0
  105. package/lib/extension-dispatch.d.ts.map +1 -0
  106. package/lib/extension-dispatch.js +178 -0
  107. package/lib/extension-page-state.d.ts +69 -0
  108. package/lib/extension-page-state.d.ts.map +1 -0
  109. package/lib/extension-page-state.js +82 -0
  110. package/lib/extension-registrar.d.ts +116 -0
  111. package/lib/extension-registrar.d.ts.map +1 -0
  112. package/lib/extension-registrar.js +144 -0
  113. package/lib/extensions-api.d.ts +346 -0
  114. package/lib/extensions-api.d.ts.map +1 -0
  115. package/lib/extensions-api.js +17 -0
  116. package/lib/extensions-remote.d.ts +57 -0
  117. package/lib/extensions-remote.d.ts.map +1 -0
  118. package/lib/extensions-remote.js +69 -0
  119. package/lib/extensions-service.d.ts +568 -0
  120. package/lib/extensions-service.d.ts.map +1 -0
  121. package/lib/extensions-service.js +2507 -0
  122. package/lib/harness-budgets.d.ts +158 -0
  123. package/lib/harness-budgets.d.ts.map +1 -0
  124. package/lib/harness-budgets.js +152 -0
  125. package/lib/harness-llm.d.ts +138 -0
  126. package/lib/harness-llm.d.ts.map +1 -0
  127. package/lib/harness-llm.js +218 -0
  128. package/lib/harness-serving.d.ts +115 -0
  129. package/lib/harness-serving.d.ts.map +1 -0
  130. package/lib/harness-serving.js +176 -0
  131. package/lib/headless.d.ts +97 -0
  132. package/lib/headless.d.ts.map +1 -0
  133. package/lib/headless.js +407 -0
  134. package/lib/http-acquisition.d.ts +27 -0
  135. package/lib/http-acquisition.d.ts.map +1 -0
  136. package/lib/http-acquisition.js +140 -0
  137. package/lib/index.d.ts +546 -0
  138. package/lib/index.d.ts.map +1 -0
  139. package/lib/index.js +5197 -0
  140. package/lib/invocation-accounting.d.ts +169 -0
  141. package/lib/invocation-accounting.d.ts.map +1 -0
  142. package/lib/invocation-accounting.js +148 -0
  143. package/lib/jev.d.ts +218 -0
  144. package/lib/jev.d.ts.map +1 -0
  145. package/lib/jev.js +366 -0
  146. package/lib/legacy-migration.d.ts +95 -0
  147. package/lib/legacy-migration.d.ts.map +1 -0
  148. package/lib/legacy-migration.js +429 -0
  149. package/lib/license-basis.d.ts +29 -0
  150. package/lib/license-basis.d.ts.map +1 -0
  151. package/lib/license-basis.js +58 -0
  152. package/lib/managed-workers.d.ts +158 -0
  153. package/lib/managed-workers.d.ts.map +1 -0
  154. package/lib/managed-workers.js +269 -0
  155. package/lib/mcp/auth-selection.d.ts +35 -0
  156. package/lib/mcp/auth-selection.d.ts.map +1 -0
  157. package/lib/mcp/auth-selection.js +64 -0
  158. package/lib/mcp/client-grant.d.ts +89 -0
  159. package/lib/mcp/client-grant.d.ts.map +1 -0
  160. package/lib/mcp/client-grant.js +63 -0
  161. package/lib/mcp/credential-cli.d.ts +38 -0
  162. package/lib/mcp/credential-cli.d.ts.map +1 -0
  163. package/lib/mcp/credential-cli.js +148 -0
  164. package/lib/mcp/credential-store.d.ts +143 -0
  165. package/lib/mcp/credential-store.d.ts.map +1 -0
  166. package/lib/mcp/credential-store.js +461 -0
  167. package/lib/mcp/export-policy.d.ts +25 -0
  168. package/lib/mcp/export-policy.d.ts.map +1 -0
  169. package/lib/mcp/export-policy.js +31 -0
  170. package/lib/mcp/host-binding.d.ts +144 -0
  171. package/lib/mcp/host-binding.d.ts.map +1 -0
  172. package/lib/mcp/host-binding.js +280 -0
  173. package/lib/mcp/http.d.ts +180 -0
  174. package/lib/mcp/http.d.ts.map +1 -0
  175. package/lib/mcp/http.js +602 -0
  176. package/lib/mcp/oauth.d.ts +149 -0
  177. package/lib/mcp/oauth.d.ts.map +1 -0
  178. package/lib/mcp/oauth.js +396 -0
  179. package/lib/mcp/protocol.d.ts +329 -0
  180. package/lib/mcp/protocol.d.ts.map +1 -0
  181. package/lib/mcp/protocol.js +459 -0
  182. package/lib/mcp/rate-limit.d.ts +68 -0
  183. package/lib/mcp/rate-limit.d.ts.map +1 -0
  184. package/lib/mcp/rate-limit.js +114 -0
  185. package/lib/mcp/sdk-v2.d.ts +17 -0
  186. package/lib/mcp/sdk-v2.d.ts.map +1 -0
  187. package/lib/mcp/sdk-v2.js +204 -0
  188. package/lib/mcp/server.d.ts +149 -0
  189. package/lib/mcp/server.d.ts.map +1 -0
  190. package/lib/mcp/server.js +302 -0
  191. package/lib/mcp/stdio.d.ts +80 -0
  192. package/lib/mcp/stdio.d.ts.map +1 -0
  193. package/lib/mcp/stdio.js +184 -0
  194. package/lib/mcp/subscriptions.d.ts +177 -0
  195. package/lib/mcp/subscriptions.d.ts.map +1 -0
  196. package/lib/mcp/subscriptions.js +288 -0
  197. package/lib/mcp-status.d.ts +96 -0
  198. package/lib/mcp-status.d.ts.map +1 -0
  199. package/lib/mcp-status.js +70 -0
  200. package/lib/mcp-usage.d.ts +110 -0
  201. package/lib/mcp-usage.d.ts.map +1 -0
  202. package/lib/mcp-usage.js +189 -0
  203. package/lib/model-qualification.d.ts +192 -0
  204. package/lib/model-qualification.d.ts.map +1 -0
  205. package/lib/model-qualification.js +178 -0
  206. package/lib/planning.d.ts +256 -0
  207. package/lib/planning.d.ts.map +1 -0
  208. package/lib/planning.js +471 -0
  209. package/lib/playbook.d.ts +42 -0
  210. package/lib/playbook.d.ts.map +1 -0
  211. package/lib/playbook.js +65 -0
  212. package/lib/prepared-assets.d.ts +269 -0
  213. package/lib/prepared-assets.d.ts.map +1 -0
  214. package/lib/prepared-assets.js +471 -0
  215. package/lib/provider-bridge.d.ts +107 -0
  216. package/lib/provider-bridge.d.ts.map +1 -0
  217. package/lib/provider-bridge.js +423 -0
  218. package/lib/ptc-authority.d.ts +154 -0
  219. package/lib/ptc-authority.d.ts.map +1 -0
  220. package/lib/ptc-authority.js +242 -0
  221. package/lib/ptc-confinement.d.ts +60 -0
  222. package/lib/ptc-confinement.d.ts.map +1 -0
  223. package/lib/ptc-confinement.js +212 -0
  224. package/lib/ptc-runtime.d.ts +166 -0
  225. package/lib/ptc-runtime.d.ts.map +1 -0
  226. package/lib/ptc-runtime.js +231 -0
  227. package/lib/publication.d.ts +161 -0
  228. package/lib/publication.d.ts.map +1 -0
  229. package/lib/publication.js +181 -0
  230. package/lib/receipt-store.d.ts +57 -0
  231. package/lib/receipt-store.d.ts.map +1 -0
  232. package/lib/receipt-store.js +143 -0
  233. package/lib/receipt.d.ts +231 -0
  234. package/lib/receipt.d.ts.map +1 -0
  235. package/lib/receipt.js +165 -0
  236. package/lib/registrar.d.ts +75 -0
  237. package/lib/registrar.d.ts.map +1 -0
  238. package/lib/registrar.js +152 -0
  239. package/lib/resource-governance.d.ts +204 -0
  240. package/lib/resource-governance.d.ts.map +1 -0
  241. package/lib/resource-governance.js +213 -0
  242. package/lib/server-lifecycle.d.ts +175 -0
  243. package/lib/server-lifecycle.d.ts.map +1 -0
  244. package/lib/server-lifecycle.js +269 -0
  245. package/lib/skills.d.ts +31 -0
  246. package/lib/skills.d.ts.map +1 -0
  247. package/lib/skills.js +170 -0
  248. package/lib/speech-bridge.d.ts +74 -0
  249. package/lib/speech-bridge.d.ts.map +1 -0
  250. package/lib/speech-bridge.js +115 -0
  251. package/lib/state.d.ts +100 -0
  252. package/lib/state.d.ts.map +1 -0
  253. package/lib/state.js +160 -0
  254. package/lib/title-proposal.d.ts +194 -0
  255. package/lib/title-proposal.d.ts.map +1 -0
  256. package/lib/title-proposal.js +244 -0
  257. package/lib/tool-inventory.d.ts +90 -0
  258. package/lib/tool-inventory.d.ts.map +1 -0
  259. package/lib/tool-inventory.js +102 -0
  260. package/lib/tool-mode-run.d.ts +310 -0
  261. package/lib/tool-mode-run.d.ts.map +1 -0
  262. package/lib/tool-mode-run.js +411 -0
  263. package/lib/tool-sources.d.ts +80 -0
  264. package/lib/tool-sources.d.ts.map +1 -0
  265. package/lib/tool-sources.js +123 -0
  266. package/lib/tool-usage-projection.d.ts +390 -0
  267. package/lib/tool-usage-projection.d.ts.map +1 -0
  268. package/lib/tool-usage-projection.js +1038 -0
  269. package/lib/tool-usage-report.d.ts +153 -0
  270. package/lib/tool-usage-report.d.ts.map +1 -0
  271. package/lib/tool-usage-report.js +274 -0
  272. package/lib/transport.d.ts +158 -0
  273. package/lib/transport.d.ts.map +1 -0
  274. package/lib/transport.js +332 -0
  275. package/lib/types.d.ts +134 -0
  276. package/lib/types.d.ts.map +1 -0
  277. package/lib/types.js +8 -0
  278. package/lib/update-surface.d.ts +79 -0
  279. package/lib/update-surface.d.ts.map +1 -0
  280. package/lib/update-surface.js +224 -0
  281. package/lib/version.d.ts +3 -0
  282. package/lib/version.d.ts.map +1 -0
  283. package/lib/version.js +27 -0
  284. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts +13 -0
  285. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts.map +1 -0
  286. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.js +85 -0
  287. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts +16 -0
  288. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
  289. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +87 -0
  290. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
  291. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
  292. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
  293. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
  294. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
  295. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
  296. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
  297. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
  298. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
  299. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
  300. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
  301. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
  302. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
  303. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
  304. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
  305. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
  306. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
  307. package/node_modules/@try-works/tool-mode-contracts/lib/index.js +53 -0
  308. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +133 -0
  309. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
  310. package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +64 -0
  311. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +121 -0
  312. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
  313. package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
  314. package/node_modules/@try-works/tool-mode-contracts/package.json +35 -0
  315. package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
  316. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
  317. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
  318. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
  319. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +86 -0
  320. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
  321. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +145 -0
  322. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
  323. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
  324. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
  325. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
  326. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
  327. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
  328. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +33 -0
  329. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
  330. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +33 -0
  331. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
  332. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
  333. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
  334. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +137 -0
  335. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
  336. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +349 -0
  337. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +274 -0
  338. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
  339. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +932 -0
  340. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
  341. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
  342. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
  343. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
  344. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
  345. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
  346. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
  347. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
  348. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
  349. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
  350. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
  351. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +299 -0
  352. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +395 -0
  353. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
  354. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +839 -0
  355. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
  356. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
  357. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +255 -0
  358. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
  359. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
  360. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
  361. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
  362. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
  363. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
  364. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts +221 -0
  365. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts.map +1 -0
  366. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.js +188 -0
  367. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
  368. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
  369. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
  370. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
  371. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
  372. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
  373. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
  374. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
  375. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
  376. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +128 -0
  377. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
  378. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
  379. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts +41 -0
  380. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts.map +1 -0
  381. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.js +52 -0
  382. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
  383. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
  384. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
  385. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +157 -0
  386. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
  387. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +688 -0
  388. package/node_modules/@try-works/tool-mode-extension-sdk/package.json +54 -0
  389. package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
  390. package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
  391. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +460 -0
  392. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
  393. package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +647 -0
  394. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +61 -0
  395. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
  396. package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +1106 -0
  397. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
  398. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
  399. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +205 -0
  400. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
  401. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
  402. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
  403. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +119 -0
  404. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
  405. package/node_modules/@try-works/tool-mode-recipes/lib/images.js +201 -0
  406. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
  407. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
  408. package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
  409. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +345 -0
  410. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
  411. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1465 -0
  412. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
  413. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
  414. package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
  415. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +231 -0
  416. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
  417. package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +435 -0
  418. package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
  419. package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
  420. package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
  421. package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
  422. package/package.json +127 -4
  423. package/remote/spec.mjs +993 -0
  424. package/remote/typert.host.mjs +14 -0
  425. package/remote/typert.remote-client.mjs +16 -0
@@ -0,0 +1,274 @@
1
+ /**
2
+ * Deployment coordination: preparation, single-flight loading and reference counting
3
+ * (RES-02, RES-03, RES-05).
4
+ *
5
+ * This is the module that makes readiness states PRODUCED rather than assigned. Before
6
+ * it, `prepared-cold` and `ready` were values a test could write; here they are values
7
+ * this coordinator derives from what actually happened.
8
+ *
9
+ * Three rules shape the design:
10
+ *
11
+ * - **One operation per EXACT deployment** (RES-05). The key that identifies a
12
+ * deployment includes the model revision, engine version, quantization and
13
+ * preprocessing recipe, not just a model name — two builds of "the same model" that
14
+ * differ in quantization are different deployments and loading one must not satisfy
15
+ * a request for the other.
16
+ * - **Concurrent callers JOIN** (RES-05). A second caller during a load awaits the
17
+ * same promise rather than starting a second load, which is the difference between
18
+ * sharing 349 MB and allocating it twice.
19
+ * - **A failed or interrupted preparation cannot become ready** (RES-03). Failure is
20
+ * recorded as failure, and a later caller retries rather than inheriting a
21
+ * half-prepared deployment that reports success.
22
+ *
23
+ * @module @try-works/dsh-tool-mode/deployment-coordinator
24
+ */
25
+ /**
26
+ * The stable key for an exact deployment (RES-05).
27
+ *
28
+ * A delimiter that cannot appear in a component, so two different field combinations
29
+ * cannot collide into one key.
30
+ * @param identity - the deployment identity.
31
+ * @returns the key.
32
+ */
33
+ export function deploymentKey(identity) {
34
+ return [
35
+ identity.extensionId,
36
+ identity.modelId,
37
+ identity.modelRevision,
38
+ identity.engineVersion,
39
+ identity.quantization,
40
+ identity.tokenizer,
41
+ identity.preprocessingRecipe,
42
+ // A unit separator is used rather than a printable character because a model id can
43
+ // legitimately contain most printable ones.
44
+ ].join('\u001f');
45
+ }
46
+ /**
47
+ * Build the pre-approval disclosure (RES-02).
48
+ *
49
+ * An operator approving a preparation is approving a specific download of a specific
50
+ * size under specific terms, so all three are computed here rather than discovered
51
+ * during the install.
52
+ * @param identity - the exact deployment.
53
+ * @param assets - the assets the lock resolves to.
54
+ * @param license - the pinned license.
55
+ * @returns the plan.
56
+ */
57
+ export function planPreparation(identity, assets, license) {
58
+ const totalBytes = assets.reduce((sum, asset) => sum + asset.bytes, 0);
59
+ return {
60
+ identity,
61
+ assets,
62
+ totalBytes,
63
+ // Storage is stated separately from download because an operator approving
64
+ // bandwidth is not thereby approving disk.
65
+ storageBytes: totalBytes,
66
+ requiresExecutableApproval: assets.some(asset => asset.executable),
67
+ license,
68
+ };
69
+ }
70
+ /** Raised when a deployment cannot be prepared. */
71
+ export class DeploymentError extends Error {
72
+ name = 'DeploymentError';
73
+ key;
74
+ constructor(key, message) {
75
+ super(message);
76
+ this.key = key;
77
+ }
78
+ }
79
+ /**
80
+ * Coordinates preparation, loading and reference counting per exact deployment.
81
+ *
82
+ * Not thread-safe in the language sense — Node is single-threaded — but
83
+ * single-flight with respect to `await`: two callers that reach `acquire` before the
84
+ * load settles both await ONE promise.
85
+ */
86
+ export class DeploymentCoordinator {
87
+ #records = new Map();
88
+ /** The in-flight load per key, so concurrent callers join rather than duplicate. */
89
+ #loading = new Map();
90
+ /** Per-caller release handlers, so releasing is idempotent. */
91
+ #leases = new WeakSet();
92
+ /** Every tracked deployment, for diagnostics. */
93
+ get deployments() {
94
+ return [...this.#records.values()];
95
+ }
96
+ /** One deployment's record. */
97
+ record(key) {
98
+ return this.#records.get(key);
99
+ }
100
+ /**
101
+ * The state to report for a deployment that has not been touched yet.
102
+ * @param identity - the exact deployment.
103
+ * @returns the readiness.
104
+ */
105
+ readinessOf(identity) {
106
+ return this.#records.get(deploymentKey(identity))?.readiness ?? 'needs-preparation';
107
+ }
108
+ /**
109
+ * Prepare and load a deployment, joining an in-flight load if there is one.
110
+ *
111
+ * RES-05: "One preparation/load operation per exact provider deployment; concurrent
112
+ * callers join or queue."
113
+ * @param identity - the exact deployment.
114
+ * @param load - performs the load. Called AT MOST ONCE per concurrent group.
115
+ * @param options - cancellation for THIS caller.
116
+ * @returns the lease.
117
+ * @throws DeploymentError when the load fails.
118
+ */
119
+ async acquire(identity, load, options = {}) {
120
+ const key = deploymentKey(identity);
121
+ let record = this.#records.get(key);
122
+ if (record === undefined) {
123
+ record = {
124
+ key,
125
+ identity,
126
+ readiness: 'needs-preparation',
127
+ activeUsers: 0,
128
+ loadingSince: null,
129
+ failureReason: null,
130
+ };
131
+ this.#records.set(key, record);
132
+ }
133
+ // A previous failure must not be inherited as a success: RES-03 says a failed or
134
+ // interrupted preparation cannot become ready, so the next caller RETRIES.
135
+ if (record.readiness === 'failed') {
136
+ record.readiness = 'needs-preparation';
137
+ record.failureReason = null;
138
+ }
139
+ let joined = false;
140
+ if (record.readiness === 'ready') {
141
+ // Already loaded: nothing to join.
142
+ }
143
+ else {
144
+ let pending = this.#loading.get(key);
145
+ if (pending === undefined) {
146
+ pending = this.#startLoad(record, load);
147
+ this.#loading.set(key, pending);
148
+ }
149
+ else {
150
+ joined = true;
151
+ }
152
+ try {
153
+ await pending;
154
+ }
155
+ catch (error) {
156
+ // The caller is told WHY, and the record keeps the failure so a later caller
157
+ // retries rather than seeing a stale success.
158
+ throw new DeploymentError(key, `${identity.extensionId}/${identity.modelId} could not be prepared: `
159
+ + `${error instanceof Error ? error.message : String(error)}`);
160
+ }
161
+ }
162
+ if (options.signal?.aborted === true) {
163
+ // Cancellation is PER INVOCATION (RES-05): this caller gives up, and the
164
+ // deployment it just waited for is left loaded and available to whoever else
165
+ // wants it. Killing it here would destroy another caller's legitimate work.
166
+ throw new DeploymentError(key, 'the caller cancelled before the deployment could be used');
167
+ }
168
+ record.activeUsers += 1;
169
+ const lease = {
170
+ key,
171
+ readiness: record.readiness,
172
+ joined,
173
+ release: () => this.#release(key, lease),
174
+ };
175
+ return lease;
176
+ }
177
+ /** Start the single load for a key. */
178
+ #startLoad(record, load) {
179
+ record.readiness = 'loading';
180
+ record.loadingSince = Date.now();
181
+ const pending = (async () => {
182
+ try {
183
+ await load();
184
+ // A load that threw is not ready; a load that returned is.
185
+ record.readiness = 'ready';
186
+ record.failureReason = null;
187
+ }
188
+ catch (error) {
189
+ // RES-03: a failed or interrupted preparation CANNOT become ready.
190
+ record.readiness = 'failed';
191
+ record.failureReason = error instanceof Error ? error.message : String(error);
192
+ throw error;
193
+ }
194
+ finally {
195
+ record.loadingSince = null;
196
+ this.#loading.delete(record.key);
197
+ }
198
+ })();
199
+ return pending;
200
+ }
201
+ /** Decrement a caller's reference. */
202
+ #release(key, lease) {
203
+ if (this.#leases.has(lease))
204
+ return;
205
+ this.#leases.add(lease);
206
+ const record = this.#records.get(key);
207
+ if (record === undefined)
208
+ return;
209
+ record.activeUsers = Math.max(0, record.activeUsers - 1);
210
+ }
211
+ /**
212
+ * Unload a deployment, but only when it is IDLE (RES-05).
213
+ *
214
+ * "Unload only idle resources or an explicitly revoked deployment after coordinated
215
+ * cleanup." Unloading a busy deployment would discard another caller's work.
216
+ * @param key - the deployment key.
217
+ * @param force - set only for an explicitly revoked deployment.
218
+ * @returns whether it was unloaded, and why not when it was not.
219
+ */
220
+ unload(key, force = false) {
221
+ const record = this.#records.get(key);
222
+ if (record === undefined)
223
+ return { unloaded: false, reason: 'no such deployment' };
224
+ if (this.#loading.has(key)) {
225
+ return { unloaded: false, reason: 'a load is in progress' };
226
+ }
227
+ if (record.activeUsers > 0 && !force) {
228
+ // The count is the whole point: another caller is using this right now.
229
+ return { unloaded: false, reason: `${record.activeUsers} caller(s) are still using it` };
230
+ }
231
+ record.readiness = 'prepared-cold';
232
+ return { unloaded: true };
233
+ }
234
+ /**
235
+ * Revoke a deployment, discarding in-flight work after coordinated cleanup (RES-05).
236
+ * @param key - the deployment key.
237
+ * @returns whether it was revoked.
238
+ */
239
+ revoke(key) {
240
+ const record = this.#records.get(key);
241
+ if (record === undefined)
242
+ return false;
243
+ // Revocation is the one case that may discard a busy deployment, and it is
244
+ // explicit: the operator asked for it rather than a policy inferring it.
245
+ record.activeUsers = 0;
246
+ record.readiness = 'prepared-cold';
247
+ return true;
248
+ }
249
+ }
250
+ /**
251
+ * Decide which assets may be deleted (RES-03).
252
+ *
253
+ * RES-03: "Package uninstall and asset purge are separate operations; delete only
254
+ * unreferenced host-owned assets." So removing an owner does not delete anything, and
255
+ * an asset with another owner is never deleted.
256
+ * @param ownership - the current records.
257
+ * @param removedOwner - the owner being uninstalled.
258
+ * @returns the digests that are now unreferenced, and those still held.
259
+ */
260
+ export function purgeCandidates(ownership, removedOwner) {
261
+ const deletable = [];
262
+ const retained = [];
263
+ for (const asset of ownership) {
264
+ const remaining = asset.owners.filter(owner => owner !== removedOwner);
265
+ // An asset with a remaining owner is RETAINED, because deleting it would break a
266
+ // deployment nobody uninstalled.
267
+ if (remaining.length === 0)
268
+ deletable.push(asset.digest);
269
+ else
270
+ retained.push(asset.digest);
271
+ }
272
+ return { deletable, retained };
273
+ }
274
+ //# sourceMappingURL=deployment-coordinator.js.map
@@ -0,0 +1,169 @@
1
+ /**
2
+ * The settings/diagnostic surface (OBS-04).
3
+ *
4
+ * OBS-04 names, item by item, what an operator must be able to SEE. A surface that answers
5
+ * "is it on?" but not "which client may call what, and exactly why is this not supported here?"
6
+ * leaves an operator guessing, so each item below is reported with the fact that makes it
7
+ * actionable rather than a bare boolean.
8
+ *
9
+ * DESIGN CONSTRAINTS, because a diagnostic surface is unusually easy to get wrong:
10
+ *
11
+ * - **It reports STATE, never credentials.** It names authorized clients and grants; it
12
+ * never echoes a token. A diagnostic surface is the single most likely place for a secret
13
+ * to leak, because its whole purpose is to be displayed.
14
+ * - **Unsupported is always paired with WHY.** OBS-04 asks for "exact unsupported-platform
15
+ * reasons", and a bare `supported: false` sends an operator to the source to find out.
16
+ * - **Unknown is its own state.** A fact that cannot be determined is reported as unknown
17
+ * rather than defaulted to false, because "not supported" and "not checked" call for
18
+ * different actions.
19
+ *
20
+ * @module @try-works/dsh-tool-mode/diagnostics
21
+ */
22
+ /** One capability this deployment either has, lacks, or has not determined. */
23
+ export interface CapabilityReport {
24
+ /** The capability, in the vocabulary OBS-04 uses. */
25
+ readonly capability: string;
26
+ /** Whether it is available HERE. */
27
+ readonly state: 'available' | 'unavailable' | 'unknown';
28
+ /**
29
+ * Why, whenever the state is not `available`.
30
+ *
31
+ * Never omitted for `unavailable`: an operator cannot act on a fact they cannot explain,
32
+ * and OBS-04 asks for the EXACT reason.
33
+ */
34
+ readonly reason?: string;
35
+ }
36
+ /** Inputs the surface reports on. */
37
+ export interface DiagnosticInputs {
38
+ /** Whether the MCP surface is mounted. */
39
+ readonly mcpMounted: boolean;
40
+ /** Where it listens, when it does. */
41
+ readonly mcpEndpoint?: string;
42
+ /** Whether the endpoint requires a credential. */
43
+ readonly mcpRequiresCredential?: boolean;
44
+ /** Client identities currently authorized, if the deployment tracks them. */
45
+ readonly authorizedClients?: readonly string[];
46
+ /** Tool names exported to clients. */
47
+ readonly exportedTools: readonly string[];
48
+ /** Tools registered on the host but deliberately NOT exported. */
49
+ readonly withheldTools?: readonly string[];
50
+ /** Why each withheld tool is not exported, keyed by tool name. */
51
+ readonly withheldReasons?: Readonly<Record<string, string>>;
52
+ /** Per-model preparation state. */
53
+ readonly preparation?: readonly {
54
+ readonly modelId: string;
55
+ readonly prepared: boolean;
56
+ readonly reason?: string;
57
+ }[];
58
+ /** The implementation each contract currently resolves to. */
59
+ readonly selectedImplementations?: readonly {
60
+ readonly contractId: string;
61
+ readonly implementationId: string;
62
+ }[];
63
+ /** Installed extensions and whether they are active. */
64
+ readonly extensions?: readonly {
65
+ readonly extensionId: string;
66
+ readonly version: string;
67
+ readonly activation: string;
68
+ }[];
69
+ /** Whether the deployment can remove an extension, and whether it protects built-ins. */
70
+ readonly uninstall?: {
71
+ readonly available: boolean;
72
+ readonly builtInsProtected: boolean;
73
+ readonly reason?: string;
74
+ };
75
+ /** Location and network requirements. */
76
+ readonly requirements?: {
77
+ readonly localOnly: boolean;
78
+ readonly networkOrigins: readonly string[];
79
+ };
80
+ /** Code Mode permission and backend readiness. */
81
+ readonly codeMode?: {
82
+ readonly permitted: boolean;
83
+ readonly backendReady: boolean;
84
+ readonly reason?: string;
85
+ };
86
+ /** Platform facts, so an unsupported reason can name the platform it refers to. */
87
+ readonly platform: {
88
+ readonly os: string;
89
+ readonly arch: string;
90
+ readonly nodeVersion: string;
91
+ };
92
+ }
93
+ /** The reported surface. */
94
+ export interface DiagnosticReport {
95
+ readonly platform: DiagnosticInputs['platform'];
96
+ readonly mcp: {
97
+ readonly mounted: boolean;
98
+ readonly endpoint: string | null;
99
+ readonly requiresCredential: boolean | null;
100
+ readonly authorizedClients: readonly string[];
101
+ readonly exportedTools: readonly string[];
102
+ readonly withheldTools: readonly string[];
103
+ readonly withheldReasons: Readonly<Record<string, string>>;
104
+ };
105
+ readonly preparation: readonly {
106
+ readonly modelId: string;
107
+ readonly prepared: boolean;
108
+ readonly reason: string | null;
109
+ }[];
110
+ readonly implementations: readonly {
111
+ readonly contractId: string;
112
+ readonly implementationId: string;
113
+ }[];
114
+ readonly extensions: readonly {
115
+ readonly extensionId: string;
116
+ readonly version: string;
117
+ readonly activation: string;
118
+ }[];
119
+ readonly capabilities: readonly CapabilityReport[];
120
+ readonly uninstall: DiagnosticInputs['uninstall'] | null;
121
+ readonly requirements: DiagnosticInputs['requirements'] | null;
122
+ readonly codeMode: DiagnosticInputs['codeMode'] | null;
123
+ }
124
+ /**
125
+ * Build the diagnostic report.
126
+ *
127
+ * @param inputs - the observed state.
128
+ * @returns everything OBS-04 names, with a reason wherever something is not available.
129
+ */
130
+ export declare function buildDiagnostics(inputs: DiagnosticInputs): DiagnosticReport;
131
+ /**
132
+ * The exact reason something is unsupported on THIS platform.
133
+ *
134
+ * Exists as a function because OBS-04 asks for the reason to be EXACT, and an exact reason has
135
+ * to name the platform it is about — "unsupported" against an unnamed platform sends an
136
+ * operator to compare their machine against a document.
137
+ *
138
+ * @param subject - what is unsupported.
139
+ * @param supportedOn - the platforms it does work on.
140
+ * @param platform - the platform being reported.
141
+ * @returns a reason naming both sides of the mismatch.
142
+ */
143
+ export declare function unsupportedReason(subject: string, supportedOn: readonly {
144
+ readonly os: string;
145
+ readonly arch: string;
146
+ }[], platform: {
147
+ readonly os: string;
148
+ readonly arch: string;
149
+ }): string;
150
+ /**
151
+ * Whether the deployment may retain request and response BODIES (OBS-03).
152
+ *
153
+ * OBS-03's operative sentence is a refusal, not a preference: where an operator's no-retention
154
+ * policy cannot be honoured together with DSH's requirement that model-visible inputs be
155
+ * reconstructable, harness-backed execution must be REFUSED rather than bodies silently
156
+ * logged or DSH bypassed. This returns the decision so the caller cannot soften it into a
157
+ * warning.
158
+ *
159
+ * @param policy - the deployment's retention policy.
160
+ * @returns whether harness-backed execution is permitted.
161
+ */
162
+ export declare function harnessExecutionDecision(policy: {
163
+ readonly retainsBodies: boolean;
164
+ readonly requiresReconstructableInputs: boolean;
165
+ }): {
166
+ readonly permitted: boolean;
167
+ readonly reason?: string;
168
+ };
169
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * The settings/diagnostic surface (OBS-04).
3
+ *
4
+ * OBS-04 names, item by item, what an operator must be able to SEE. A surface that answers
5
+ * "is it on?" but not "which client may call what, and exactly why is this not supported here?"
6
+ * leaves an operator guessing, so each item below is reported with the fact that makes it
7
+ * actionable rather than a bare boolean.
8
+ *
9
+ * DESIGN CONSTRAINTS, because a diagnostic surface is unusually easy to get wrong:
10
+ *
11
+ * - **It reports STATE, never credentials.** It names authorized clients and grants; it
12
+ * never echoes a token. A diagnostic surface is the single most likely place for a secret
13
+ * to leak, because its whole purpose is to be displayed.
14
+ * - **Unsupported is always paired with WHY.** OBS-04 asks for "exact unsupported-platform
15
+ * reasons", and a bare `supported: false` sends an operator to the source to find out.
16
+ * - **Unknown is its own state.** A fact that cannot be determined is reported as unknown
17
+ * rather than defaulted to false, because "not supported" and "not checked" call for
18
+ * different actions.
19
+ *
20
+ * @module @try-works/dsh-tool-mode/diagnostics
21
+ */
22
+ /**
23
+ * Build the diagnostic report.
24
+ *
25
+ * @param inputs - the observed state.
26
+ * @returns everything OBS-04 names, with a reason wherever something is not available.
27
+ */
28
+ export function buildDiagnostics(inputs) {
29
+ const capabilities = [
30
+ inputs.mcpMounted
31
+ ? { capability: 'mcp', state: 'available' }
32
+ : {
33
+ capability: 'mcp',
34
+ state: 'unavailable',
35
+ reason: 'no MCP surface is mounted in this deployment, so no client can call these tools',
36
+ },
37
+ /*
38
+ * The endpoint is reported separately from `mcp` because a mounted surface with no
39
+ * endpoint is a real state: the host composes tools for its own agent and serves nothing.
40
+ */
41
+ inputs.mcpEndpoint === undefined
42
+ ? { capability: 'mcp-endpoint', state: 'unavailable', reason: 'the mounted MCP surface exposes no network endpoint' }
43
+ : { capability: 'mcp-endpoint', state: 'available' },
44
+ inputs.mcpRequiresCredential === true
45
+ ? { capability: 'mcp-authorization', state: 'available' }
46
+ : inputs.mcpRequiresCredential === false
47
+ ? {
48
+ capability: 'mcp-authorization',
49
+ state: 'unavailable',
50
+ reason: 'the endpoint accepts unauthenticated requests, so any local caller may invoke these tools',
51
+ }
52
+ // `unknown` rather than `false`: a fact that was not determined is not a fact that is
53
+ // absent, and the two call for different actions.
54
+ : { capability: 'mcp-authorization', state: 'unknown', reason: 'the deployment did not report whether a credential is required' },
55
+ ];
56
+ if (inputs.codeMode !== undefined) {
57
+ capabilities.push(inputs.codeMode.permitted && inputs.codeMode.backendReady
58
+ ? { capability: 'code-mode', state: 'available' }
59
+ : {
60
+ capability: 'code-mode',
61
+ state: 'unavailable',
62
+ reason: inputs.codeMode.reason
63
+ ?? (inputs.codeMode.permitted
64
+ ? 'generated-code execution is permitted but no backend is ready to run it'
65
+ : 'generated-code execution is not permitted in this deployment'),
66
+ });
67
+ }
68
+ return {
69
+ platform: inputs.platform,
70
+ mcp: {
71
+ mounted: inputs.mcpMounted,
72
+ endpoint: inputs.mcpEndpoint ?? null,
73
+ requiresCredential: inputs.mcpRequiresCredential ?? null,
74
+ authorizedClients: [...(inputs.authorizedClients ?? [])],
75
+ exportedTools: [...inputs.exportedTools],
76
+ withheldTools: [...(inputs.withheldTools ?? [])],
77
+ withheldReasons: { ...(inputs.withheldReasons ?? {}) },
78
+ },
79
+ preparation: (inputs.preparation ?? []).map(entry => ({
80
+ modelId: entry.modelId,
81
+ prepared: entry.prepared,
82
+ // A prepared model has nothing to explain; an unprepared one must say what is missing.
83
+ reason: entry.prepared ? null : entry.reason ?? 'no reason was reported, which is itself a defect in the caller',
84
+ })),
85
+ implementations: [...(inputs.selectedImplementations ?? [])],
86
+ extensions: [...(inputs.extensions ?? [])],
87
+ capabilities,
88
+ uninstall: inputs.uninstall ?? null,
89
+ requirements: inputs.requirements ?? null,
90
+ codeMode: inputs.codeMode ?? null,
91
+ };
92
+ }
93
+ /**
94
+ * The exact reason something is unsupported on THIS platform.
95
+ *
96
+ * Exists as a function because OBS-04 asks for the reason to be EXACT, and an exact reason has
97
+ * to name the platform it is about — "unsupported" against an unnamed platform sends an
98
+ * operator to compare their machine against a document.
99
+ *
100
+ * @param subject - what is unsupported.
101
+ * @param supportedOn - the platforms it does work on.
102
+ * @param platform - the platform being reported.
103
+ * @returns a reason naming both sides of the mismatch.
104
+ */
105
+ export function unsupportedReason(subject, supportedOn, platform) {
106
+ const supported = supportedOn.map(entry => `${entry.os}/${entry.arch}`);
107
+ if (supported.length === 0) {
108
+ // A different sentence, because "no platform supports this" is not a mismatch.
109
+ return `${subject} declares no supported platform, so it cannot run anywhere`;
110
+ }
111
+ return `${subject} supports ${supported.join(', ')} but this host is ${platform.os}/${platform.arch}`;
112
+ }
113
+ /**
114
+ * Whether the deployment may retain request and response BODIES (OBS-03).
115
+ *
116
+ * OBS-03's operative sentence is a refusal, not a preference: where an operator's no-retention
117
+ * policy cannot be honoured together with DSH's requirement that model-visible inputs be
118
+ * reconstructable, harness-backed execution must be REFUSED rather than bodies silently
119
+ * logged or DSH bypassed. This returns the decision so the caller cannot soften it into a
120
+ * warning.
121
+ *
122
+ * @param policy - the deployment's retention policy.
123
+ * @returns whether harness-backed execution is permitted.
124
+ */
125
+ export function harnessExecutionDecision(policy) {
126
+ if (!policy.retainsBodies && policy.requiresReconstructableInputs) {
127
+ return {
128
+ permitted: false,
129
+ reason: 'the deployment does not retain bodies while DSH requires model-visible inputs to be '
130
+ + 'reconstructable, so harness-backed execution is refused here rather than logging '
131
+ + 'bodies against the policy or bypassing DSH',
132
+ };
133
+ }
134
+ return { permitted: true };
135
+ }
136
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * DECL-07 read-only discovery contracts.
3
+ *
4
+ * These tools were registered natively but withheld from MCP, so an authorized
5
+ * external caller could not read the catalogue or per-tool schemas. Their contracts
6
+ * are published independently of any model package; the execution path is the ordinary
7
+ * DSH tool runtime, not a private MCP-only handler.
8
+ */
9
+ import type { ToolContract } from '@try-works/tool-mode-contracts';
10
+ /** `tool_mode_list` — permitted tools, readiness and catalog revision. */
11
+ export declare const TOOL_MODE_LIST_CONTRACT: ToolContract;
12
+ /** `tool_mode_describe` — schemas, model facts, limits and catalog revision. */
13
+ export declare const TOOL_MODE_DESCRIBE_CONTRACT: ToolContract;
14
+ //# sourceMappingURL=discovery-contracts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery-contracts.d.ts","sourceRoot":"","sources":["../src/discovery-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AA+ClE,0EAA0E;AAC1E,eAAO,MAAM,uBAAuB,EAAE,YAiBrC,CAAA;AAED,gFAAgF;AAChF,eAAO,MAAM,2BAA2B,EAAE,YAmBzC,CAAA"}