@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,39 @@
1
+ # The dsh-tool-mode bundle patch: one insert row over the empty profile root.
2
+ #
3
+ # A user's profile `cordis.patch.yml` (or the file this row is installed into)
4
+ # addresses this row by id, so a deployment can change the config without
5
+ # forking the package. Later patch layers win per row.
6
+ #
7
+ # `models: []` means "no explicit allowlist": every model whose runtime resolves
8
+ # in this process is registered. Naming ids narrows the surface; naming a model
9
+ # that cannot run here is harmless, because the allowlist is intersected with
10
+ # what the capability resolver proves runnable.
11
+
12
+ - insert:
13
+ - id: model-tools
14
+ name: '@try-works/dsh-tool-mode'
15
+ config:
16
+ # Every model that can actually run in this process.
17
+ models: []
18
+ exclude: []
19
+ # Do not register a tool for a model whose runtime is missing: a tool
20
+ # that cannot work costs a model turn to discover.
21
+ exposeUnavailable: false
22
+ # Publish one skill per registered tool, teaching when to use it.
23
+ registerSkills: true
24
+ # Register the `model_tools` inspection and install tool.
25
+ registerControlTool: true
26
+ # Allow in-process npm packages. Set false to force every call through
27
+ # the CLI or the bridge below.
28
+ allowNpm: true
29
+ # The Desert Ant CLI, auto-detected on PATH (macOS and Linux). It can run
30
+ # every shipping model, so it is the route that needs no extra service.
31
+ cli:
32
+ enabled: true
33
+ command: desertant
34
+ # A bridge on a machine that can run what this one cannot — most
35
+ # importantly the Apple-only models. Leave the endpoint empty to disable.
36
+ # See scripts/desert-ant-bridge.mjs; the plugin never hosts this itself.
37
+ remote:
38
+ endpoint: ''
39
+ token: ''
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Adapter registry: the one place that maps a catalog model to the code that
3
+ * can invoke it.
4
+ *
5
+ * Two kinds of adapter exist. A **model adapter** is written by hand for a model
6
+ * with a real in-process SDK (Tongue, Voz). A **transport adapter** is generic:
7
+ * it drives any model through the Desert Ant CLI or a user-hosted bridge, using
8
+ * only the catalog's verb and parameter declarations.
9
+ *
10
+ * @module @try-works/dsh-tool-mode/adapters/index
11
+ */
12
+ import type { ModelCatalogEntry } from '../types.ts';
13
+ import type { AdapterFactory, ModelAdapter } from './types.ts';
14
+ import type { ProviderBridge } from '../provider-bridge.ts';
15
+ import { type TransportOptions } from '../transport.ts';
16
+ /**
17
+ * Hand-written adapters living inside the host.
18
+ *
19
+ * EMPTY, and it must stay that way (BASE-09). Every model-specific implementation
20
+ * is now an independently versioned extension package reached through the public
21
+ * extension API: Tongue is `@try-works/extension-desert-ant-tongue` and Voz is
22
+ * `@try-works/extension-desert-ant-voz`. The host holds no adapter for any model,
23
+ * so a first-party package has no privilege a published one lacks.
24
+ *
25
+ * The parameter is kept rather than deleted because a test may still inject
26
+ * factories, and an empty list DOCUMENTED as needing to stay empty is a stronger
27
+ * statement than a removed hook.
28
+ */
29
+ export declare const ADAPTER_FACTORIES: readonly AdapterFactory[];
30
+ /**
31
+ * Options that decide which transports a model may use.
32
+ *
33
+ * `routes` is normally the capability resolver's verdict, which is what keeps
34
+ * the adapter and the reported reason from disagreeing: a model is only offered
35
+ * through a transport the resolver already proved usable.
36
+ */
37
+ export interface TransportSelection extends TransportOptions {
38
+ /** The resolved route for this model. */
39
+ readonly route: string;
40
+ }
41
+ /**
42
+ * Create the adapter for one entry.
43
+ *
44
+ * A hand-written adapter always wins for the model it serves: an in-process
45
+ * call is faster and needs no external service. Everything else falls to the
46
+ * transport the capability resolver selected.
47
+ *
48
+ * The lookup is ASYNC because an extension-backed model is reached by importing
49
+ * and activating its package, which cannot happen in a synchronous call. The
50
+ * order is deliberate: a declared extension binding wins, then a hand-written
51
+ * factory, then a transport.
52
+ * @param entry - the catalog entry.
53
+ * @param options - the resolved route plus transport settings.
54
+ * @param factories - hand-written adapter factories, defaulting to the shipped set.
55
+ * @param bridge - the extension provider bridge, when extensions are available.
56
+ * @returns the adapter, or undefined when no extension, factory or transport serves this model.
57
+ */
58
+ export declare function createAdapter(entry: ModelCatalogEntry, options?: TransportSelection, factories?: readonly AdapterFactory[], bridge?: ProviderBridge): ModelAdapter | undefined;
59
+ export type { AdapterFactory, AdapterInvocation, JsonValue, ModelAdapter } from './types.ts';
60
+ export type { CommandTransport, TransportOptions } from '../transport.ts';
61
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAA;AAExB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAAO,CAAA;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,yCAAyC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAmBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,kBAA4C,EACrD,SAAS,GAAE,SAAS,cAAc,EAAsB,EACxD,MAAM,CAAC,EAAE,cAAc,GACtB,YAAY,GAAG,SAAS,CAoB1B;AAED,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5F,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Adapter registry: the one place that maps a catalog model to the code that
3
+ * can invoke it.
4
+ *
5
+ * Two kinds of adapter exist. A **model adapter** is written by hand for a model
6
+ * with a real in-process SDK (Tongue, Voz). A **transport adapter** is generic:
7
+ * it drives any model through the Desert Ant CLI or a user-hosted bridge, using
8
+ * only the catalog's verb and parameter declarations.
9
+ *
10
+ * @module @try-works/dsh-tool-mode/adapters/index
11
+ */
12
+ import { createCliTransport, createRemoteTransport, } from "../transport.js";
13
+ /**
14
+ * Hand-written adapters living inside the host.
15
+ *
16
+ * EMPTY, and it must stay that way (BASE-09). Every model-specific implementation
17
+ * is now an independently versioned extension package reached through the public
18
+ * extension API: Tongue is `@try-works/extension-desert-ant-tongue` and Voz is
19
+ * `@try-works/extension-desert-ant-voz`. The host holds no adapter for any model,
20
+ * so a first-party package has no privilege a published one lacks.
21
+ *
22
+ * The parameter is kept rather than deleted because a test may still inject
23
+ * factories, and an empty list DOCUMENTED as needing to stay empty is a stronger
24
+ * statement than a removed hook.
25
+ */
26
+ export const ADAPTER_FACTORIES = [];
27
+ /**
28
+ * Wrap a command transport as a model adapter.
29
+ *
30
+ * The transport already returns the canonical object, so this is a pure
31
+ * adaptation of shape rather than a second place that knows how to parse a
32
+ * result.
33
+ * @param entry - the catalog entry.
34
+ * @param transport - the CLI or remote transport.
35
+ * @returns the adapter.
36
+ */
37
+ function transportAdapter(entry, transport) {
38
+ return {
39
+ modelId: entry.id,
40
+ invoke: ({ args, signal }) => transport.invoke({ entry, args, signal }),
41
+ };
42
+ }
43
+ /**
44
+ * Create the adapter for one entry.
45
+ *
46
+ * A hand-written adapter always wins for the model it serves: an in-process
47
+ * call is faster and needs no external service. Everything else falls to the
48
+ * transport the capability resolver selected.
49
+ *
50
+ * The lookup is ASYNC because an extension-backed model is reached by importing
51
+ * and activating its package, which cannot happen in a synchronous call. The
52
+ * order is deliberate: a declared extension binding wins, then a hand-written
53
+ * factory, then a transport.
54
+ * @param entry - the catalog entry.
55
+ * @param options - the resolved route plus transport settings.
56
+ * @param factories - hand-written adapter factories, defaulting to the shipped set.
57
+ * @param bridge - the extension provider bridge, when extensions are available.
58
+ * @returns the adapter, or undefined when no extension, factory or transport serves this model.
59
+ */
60
+ export function createAdapter(entry, options = { route: 'npm-native' }, factories = ADAPTER_FACTORIES, bridge) {
61
+ // A declared extension binding is the model's own statement of who implements
62
+ // it, but only the explicit extension route may use it. This keeps CLI/remote
63
+ // fallback routes from accidentally trying to load a provider package.
64
+ if (options.route === 'extension')
65
+ return bridge?.adapterFor(entry);
66
+ for (const factory of factories) {
67
+ const adapter = factory(entry);
68
+ if (adapter !== undefined)
69
+ return adapter;
70
+ }
71
+ // No extension and no factory: the model is reachable only through a transport.
72
+ if (options.route === 'cli')
73
+ return transportAdapter(entry, createCliTransport(entry, options));
74
+ if (options.route === 'remote') {
75
+ return transportAdapter(entry, createRemoteTransport(entry, options));
76
+ }
77
+ // No extension, no factory and no transport serves this model. Returning
78
+ // undefined is correct: a model with no implementation simply has no tool,
79
+ // rather than falling back to something that cannot run it.
80
+ return undefined;
81
+ }
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,106 @@
1
+ /**
2
+ * The adapter seam: how one catalog model is actually invoked.
3
+ *
4
+ * An adapter is responsible for exactly two things — loading its model lazily
5
+ * and turning validated tool arguments into the canonical JSON value the tool
6
+ * declares. Everything else (which models exist, whether they may run, what the
7
+ * model sees) belongs to the catalog, the capability resolver, and the
8
+ * registrar.
9
+ *
10
+ * @module @try-works/dsh-tool-mode/adapters/types
11
+ */
12
+ import type { ModelCatalogEntry } from '../types.ts';
13
+ import type { InvocationAuthority } from '../authority.ts';
14
+ /** A lossless JSON value, the only thing a tool body may return. */
15
+ export type JsonValue = null | boolean | number | string | JsonValue[] | {
16
+ [key: string]: JsonValue;
17
+ };
18
+ /** One adapter invocation. */
19
+ export interface AdapterInvocation {
20
+ /** Validated tool arguments, already constrained by the registered parameter schema. */
21
+ readonly args: Readonly<Record<string, unknown>>;
22
+ /** Caller cancellation, forwarded by the tool body. */
23
+ readonly signal: AbortSignal;
24
+ /**
25
+ * Trusted authority for this call (BASE-05).
26
+ *
27
+ * An implementation MUST resolve a caller-supplied path through
28
+ * `authority.resolvePath` rather than opening the argument directly: the
29
+ * authority is constructed by the host and cannot be supplied or widened by a
30
+ * request. It is optional only so a test can drive an adapter without a grant;
31
+ * a host always provides one.
32
+ */
33
+ readonly authority?: InvocationAuthority;
34
+ }
35
+ /** One model's invocation strategy. */
36
+ export interface ModelAdapter {
37
+ /** The catalog id this adapter serves. */
38
+ readonly modelId: string;
39
+ /**
40
+ * Run the model once and return the canonical value.
41
+ *
42
+ * Every model tool declares an object output schema, so an adapter returns an
43
+ * object rather than an arbitrary JSON root.
44
+ * @param invocation - validated arguments and caller cancellation.
45
+ * @returns the lossless JSON object declared by the tool's output schema.
46
+ */
47
+ invoke(invocation: AdapterInvocation): Promise<Record<string, JsonValue>>;
48
+ /**
49
+ * Release any process-level model resources.
50
+ *
51
+ * Called on plugin dispose. Adapters that cache a loaded model must implement
52
+ * it; adapters that hold nothing may omit it.
53
+ */
54
+ dispose?(): Promise<void>;
55
+ }
56
+ /** Build an adapter for one runnable model, or `undefined` when none exists yet. */
57
+ export type AdapterFactory = (entry: ModelCatalogEntry) => ModelAdapter | undefined;
58
+ /**
59
+ * Reject an aborted call before doing model work.
60
+ * @param signal - caller cancellation.
61
+ * @throws the abort reason when the signal is already aborted.
62
+ */
63
+ export declare function throwIfAborted(signal: AbortSignal): void;
64
+ /**
65
+ * Read a required string argument.
66
+ * @param args - validated arguments.
67
+ * @param key - argument name.
68
+ * @returns the string value.
69
+ * @throws when the value is absent or not a string.
70
+ */
71
+ export declare function requireString(args: Readonly<Record<string, unknown>>, key: string): string;
72
+ /**
73
+ * Read an optional integer argument, clamped to a range.
74
+ * @param args - validated arguments.
75
+ * @param key - argument name.
76
+ * @param options - inclusive bounds and the value to use when absent.
77
+ * @returns the resolved integer.
78
+ * @throws when the value is present but not an integer in range.
79
+ */
80
+ export declare function optionalInteger(args: Readonly<Record<string, unknown>>, key: string, options: {
81
+ readonly min: number;
82
+ readonly max: number;
83
+ readonly fallback: number;
84
+ }): number;
85
+ /**
86
+ * Read an optional number in a range.
87
+ * @param args - validated arguments.
88
+ * @param key - argument name.
89
+ * @param options - inclusive bounds.
90
+ * @returns the resolved number, or undefined when absent.
91
+ * @throws when the value is present but not a finite number in range.
92
+ */
93
+ export declare function optionalNumber(args: Readonly<Record<string, unknown>>, key: string, options: {
94
+ readonly min: number;
95
+ readonly max: number;
96
+ }): number | undefined;
97
+ /**
98
+ * Read a required boolean argument.
99
+ * @param args - validated arguments.
100
+ * @param key - argument name.
101
+ * @param fallback - value used when the argument is absent.
102
+ * @returns the resolved boolean.
103
+ * @throws when the value is present but not a boolean.
104
+ */
105
+ export declare function optionalBoolean(args: Readonly<Record<string, unknown>>, key: string, fallback: boolean): boolean;
106
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/adapters/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,oEAAoE;AACpE,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAErG,8BAA8B;AAC9B,MAAM,WAAW,iBAAiB;IAChC,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAChD,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B;;;;;;;;OAQG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAA;CACzC;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,Q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,MAAM,EAAE,OAAO,CAAC,CAAC,EACvC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,OAAO,GAChB,OAAO,CAKT"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The adapter seam: how one catalog model is actually invoked.
3
+ *
4
+ * An adapter is responsible for exactly two things — loading its model lazily
5
+ * and turning validated tool arguments into the canonical JSON value the tool
6
+ * declares. Everything else (which models exist, whether they may run, what the
7
+ * model sees) belongs to the catalog, the capability resolver, and the
8
+ * registrar.
9
+ *
10
+ * @module @try-works/dsh-tool-mode/adapters/types
11
+ */
12
+ /**
13
+ * Reject an aborted call before doing model work.
14
+ * @param signal - caller cancellation.
15
+ * @throws the abort reason when the signal is already aborted.
16
+ */
17
+ export function throwIfAborted(signal) {
18
+ if (signal.aborted)
19
+ throw signal.reason instanceof Error ? signal.reason : new Error('aborted');
20
+ }
21
+ /**
22
+ * Read a required string argument.
23
+ * @param args - validated arguments.
24
+ * @param key - argument name.
25
+ * @returns the string value.
26
+ * @throws when the value is absent or not a string.
27
+ */
28
+ export function requireString(args, key) {
29
+ const value = args[key];
30
+ if (typeof value !== 'string' || value.length === 0) {
31
+ throw new Error(`argument "${key}" must be a non-empty string`);
32
+ }
33
+ return value;
34
+ }
35
+ /**
36
+ * Read an optional integer argument, clamped to a range.
37
+ * @param args - validated arguments.
38
+ * @param key - argument name.
39
+ * @param options - inclusive bounds and the value to use when absent.
40
+ * @returns the resolved integer.
41
+ * @throws when the value is present but not an integer in range.
42
+ */
43
+ export function optionalInteger(args, key, options) {
44
+ const value = args[key];
45
+ if (value === undefined)
46
+ return options.fallback;
47
+ if (typeof value !== 'number' || !Number.isInteger(value) || value < options.min || value > options.max) {
48
+ throw new Error(`argument "${key}" must be an integer between ${options.min} and ${options.max}`);
49
+ }
50
+ return value;
51
+ }
52
+ /**
53
+ * Read an optional number in a range.
54
+ * @param args - validated arguments.
55
+ * @param key - argument name.
56
+ * @param options - inclusive bounds.
57
+ * @returns the resolved number, or undefined when absent.
58
+ * @throws when the value is present but not a finite number in range.
59
+ */
60
+ export function optionalNumber(args, key, options) {
61
+ const value = args[key];
62
+ if (value === undefined)
63
+ return undefined;
64
+ if (typeof value !== 'number' || !Number.isFinite(value) || value < options.min || value > options.max) {
65
+ throw new Error(`argument "${key}" must be a number between ${options.min} and ${options.max}`);
66
+ }
67
+ return value;
68
+ }
69
+ /**
70
+ * Read a required boolean argument.
71
+ * @param args - validated arguments.
72
+ * @param key - argument name.
73
+ * @param fallback - value used when the argument is absent.
74
+ * @returns the resolved boolean.
75
+ * @throws when the value is present but not a boolean.
76
+ */
77
+ export function optionalBoolean(args, key, fallback) {
78
+ const value = args[key];
79
+ if (value === undefined)
80
+ return fallback;
81
+ if (typeof value !== 'boolean')
82
+ throw new Error(`argument "${key}" must be a boolean`);
83
+ return value;
84
+ }
85
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,189 @@
1
+ /**
2
+ * SEC-09 — the approval state machine for management-sensitive changes.
3
+ *
4
+ * A management-sensitive mutation (enabling a model, installing/replacing an
5
+ * extension, revoking a credential, changing a model URL or provider, …) must pass an
6
+ * EXPLICIT operator decision before it happens. This module is the standalone state
7
+ * machine for that flow; it deliberately owns no host wiring and no I/O:
8
+ *
9
+ * pending ──approve──▶ approved ──commit()──▶ committed (terminal)
10
+ * │ │
11
+ * ├──deny──▶ denied └── TTL ──▶ expired (terminal)
12
+ * └── TTL ──▶ expired
13
+ *
14
+ * Properties this module guarantees:
15
+ * - **No commit without an approval.** `commit()` on a pending request throws
16
+ * `approval/pending` SYNCHRONOUSLY; there is no promise to await, so a deployment
17
+ * with no approval UI fails promptly instead of hanging.
18
+ * - **One-shot commit.** The first successful commit moves the record to
19
+ * `committed`; every later commit throws `approval/already-committed`.
20
+ * - **Idempotent decisions.** Repeating the SAME decision returns the unchanged
21
+ * record (including its original decision timestamp); the opposite decision after a
22
+ * decision is `approval/already-decided`.
23
+ * - **Scope-bound.** The request stores the exact decision scope; a commit must name
24
+ * exactly that scope. An approval for one extension or one tool cannot authorize
25
+ * another.
26
+ * - **TTL on an injected clock.** Expiry is evaluated lazily on every read/mutation
27
+ * against `now()`; tests never depend on wall time.
28
+ * - **Plain-JSON durable-safe state.** Records contain only strings, numbers, nulls,
29
+ * booleans and one nested scope object. Unknown caller fields are dropped, so a
30
+ * token or API key passed by mistake is never stored or re-serialized.
31
+ * - **Deterministic ids.** By default the id is a hash of the request content and the
32
+ * injected request time, so the same request at the same instant has the same id.
33
+ *
34
+ * @module @try-works/dsh-tool-mode/approval
35
+ */
36
+ /** Every management-sensitive request kind this module admits. */
37
+ export declare const APPROVAL_KINDS: readonly ["model-enable", "model-disable", "model-reset", "extension-install", "extension-activate", "extension-deactivate", "extension-uninstall", "extension-prepare", "extension-commit", "extension-rollback", "credential-revoke", "model-url-change", "model-provider-change"];
38
+ /** The management-sensitive request kind. */
39
+ export type ApprovalKind = (typeof APPROVAL_KINDS)[number];
40
+ /** The terminal/non-terminal states a record can be in. */
41
+ export declare const APPROVAL_STATES: readonly ["pending", "approved", "denied", "committed", "expired"];
42
+ /** One state of an approval record. */
43
+ export type ApprovalState = (typeof APPROVAL_STATES)[number];
44
+ /** What an approval is scoped to. */
45
+ export declare const APPROVAL_SCOPE_KINDS: readonly ["model", "extension", "tool", "credential", "provider"];
46
+ /** The kind of subject an approval covers. */
47
+ export type ApprovalScopeKind = (typeof APPROVAL_SCOPE_KINDS)[number];
48
+ /** The exact subject an approval covers. */
49
+ export interface ApprovalScope {
50
+ /** The subject kind (model, extension, tool, credential or provider). */
51
+ readonly kind: ApprovalScopeKind;
52
+ /** The subject identity, for example `@try-works/extension-laya` or `lang_detect`. */
53
+ readonly id: string;
54
+ }
55
+ /** The caller-supplied part of a request. */
56
+ export interface ApprovalRequestInput {
57
+ /** What management operation the approval would allow. */
58
+ readonly kind: ApprovalKind;
59
+ /** The exact subject the approval is bound to. */
60
+ readonly scope: ApprovalScope;
61
+ /** Operator identity recorded with the request (never a secret). */
62
+ readonly operator: string;
63
+ /** Why the operator wants the change; recorded verbatim (never a secret). */
64
+ readonly reason: string;
65
+ /** Optional lifetime; defaults to the store's `defaultTtlMs`. */
66
+ readonly ttlMs?: number;
67
+ }
68
+ /** One explicit operator decision. */
69
+ export interface ApprovalDecision {
70
+ /** `true` approves, `false` denies. */
71
+ readonly approve: boolean;
72
+ /** Who decided. */
73
+ readonly decidedBy: string;
74
+ /** Optional decision note. */
75
+ readonly reason?: string;
76
+ }
77
+ /** The plain-JSON record every method returns and the snapshot stores. */
78
+ export interface ApprovalRecord {
79
+ readonly id: string;
80
+ readonly kind: ApprovalKind;
81
+ readonly scope: ApprovalScope;
82
+ readonly operator: string;
83
+ readonly reason: string;
84
+ readonly requestedAt: number;
85
+ readonly expiresAt: number;
86
+ readonly state: ApprovalState;
87
+ readonly decidedAt: number | null;
88
+ readonly decidedBy: string | null;
89
+ readonly decisionReason: string | null;
90
+ readonly committedAt: number | null;
91
+ }
92
+ /** The durable snapshot produced by {@link ApprovalStore.toJSON}. */
93
+ export interface ApprovalSnapshot {
94
+ readonly version: 1;
95
+ readonly defaultTtlMs: number;
96
+ readonly records: readonly ApprovalRecord[];
97
+ }
98
+ /** The call-time dependencies, all injectable for tests. */
99
+ export interface ApprovalStoreOptions {
100
+ /** The clock; defaults to `Date.now`. */
101
+ readonly now?: () => number;
102
+ /** Lifetime used when a request carries no `ttlMs`; defaults to five minutes. */
103
+ readonly defaultTtlMs?: number;
104
+ /** Deterministic id derivation; defaults to a sha256 of the request and time. */
105
+ readonly idFactory?: (input: {
106
+ readonly kind: ApprovalKind;
107
+ readonly scope: ApprovalScope;
108
+ readonly operator: string;
109
+ readonly reason: string;
110
+ }, requestedAt: number) => string;
111
+ }
112
+ /** The named refusals this module can raise. */
113
+ export type ApprovalErrorCode = 'approval/invalid-request' | 'approval/invalid-serialization' | 'approval/unknown-id' | 'approval/pending' | 'approval/denied' | 'approval/expired' | 'approval/already-decided' | 'approval/already-committed' | 'approval/scope-mismatch';
114
+ /** A refusal with a stable machine-readable code. */
115
+ export declare class ApprovalError extends Error {
116
+ /** The stable refusal code. */
117
+ readonly code: ApprovalErrorCode;
118
+ /**
119
+ * @param code - the stable refusal code.
120
+ * @param message - the concrete explanation (the code is prefixed).
121
+ */
122
+ constructor(code: ApprovalErrorCode, message: string);
123
+ }
124
+ /**
125
+ * The in-memory approval store. One instance per host process, restored from its
126
+ * snapshot at boot (see the wiring contract in the task report).
127
+ */
128
+ export declare class ApprovalStore {
129
+ #private;
130
+ /**
131
+ * @param options - clock, default TTL and id derivation (all injectable).
132
+ */
133
+ constructor(options?: ApprovalStoreOptions);
134
+ /** The default lifetime new requests receive. */
135
+ get defaultTtlMs(): number;
136
+ /**
137
+ * Record a pending request.
138
+ *
139
+ * A repeated request (same content at the same injected instant) returns the
140
+ * EXISTING record rather than resetting its TTL or decision.
141
+ * @param input - the request facts (kind, scope, operator, reason, optional TTL).
142
+ * @returns the pending record (a plain-JSON copy).
143
+ */
144
+ request(input: ApprovalRequestInput): ApprovalRecord;
145
+ /**
146
+ * Read one record, applying lazy TTL expiry.
147
+ * @param id - the approval id.
148
+ * @returns the record (a plain-JSON copy).
149
+ */
150
+ describe(id: string): ApprovalRecord;
151
+ /** Every record, oldest first (expiry applied). */
152
+ list(): readonly ApprovalRecord[];
153
+ /**
154
+ * Apply an explicit operator decision.
155
+ *
156
+ * Repeating the SAME decision is idempotent and returns the unchanged record; the
157
+ * opposite decision after a decision is `approval/already-decided`.
158
+ * @param id - the approval id.
159
+ * @param decision - approve/deny, the decider and an optional note.
160
+ * @returns the decided record.
161
+ */
162
+ decide(id: string, decision: ApprovalDecision): ApprovalRecord;
163
+ /**
164
+ * Consume an approved request for exactly its recorded scope.
165
+ *
166
+ * One-shot: the first successful call commits; every later call (and any call on a
167
+ * pending, denied or expired record) throws a named error WITHOUT waiting.
168
+ * @param id - the approval id.
169
+ * @param scope - the exact subject the caller is about to mutate.
170
+ * @returns the committed record.
171
+ */
172
+ commit(id: string, scope: ApprovalScope): ApprovalRecord;
173
+ /**
174
+ * The durable snapshot. Only the declared fields are serialized, so a caller that
175
+ * passed a token by mistake cannot leak it through this channel.
176
+ * @returns a plain-JSON snapshot.
177
+ */
178
+ toJSON(): ApprovalSnapshot;
179
+ /**
180
+ * Restore a store from {@link toJSON} output.
181
+ * @param value - the parsed snapshot.
182
+ * @param options - clock, optional TTL override and optional id factory.
183
+ * @returns the restored store.
184
+ */
185
+ static fromJSON(value: unknown, options?: ApprovalStoreOptions): ApprovalStore;
186
+ }
187
+ /** Whether a restored/default id has the module's deterministic shape. */
188
+ export declare function isDeterministicApprovalId(id: unknown): boolean;
189
+ //# sourceMappingURL=approval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../src/approval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,kEAAkE;AAClE,eAAO,MAAM,cAAc,sRAcjB,CAAA;AAEV,6CAA6C;AAC7C,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D,2DAA2D;AAC3D,eAAO,MAAM,eAAe,oEAAqE,CAAA;AAEjG,uCAAuC;AACvC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA;AAE5D,qCAAqC;AACrC,eAAO,MAAM,oBAAoB,mEAAoE,CAAA;AAErG,8CAA8C;AAC9C,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAA;AAErE,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC5B,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CACpB;AAED,6CAA6C;AAC7C,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,QAAQ,CAA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