@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
package/README.md CHANGED
@@ -1,3 +1,300 @@
1
- # Temporary Holding Version
1
+ # dsh-tool-mode
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install on-device models as DSH tools and skills, with per-platform capability
4
+ gating. Ships with the [Desert Ant Labs](https://desertant.com/models/) catalog.
5
+
6
+ A DSH agent gets a real tool for every model that can run in its process, a
7
+ skill that teaches it *when* to reach for that tool, and an honest explanation
8
+ for every model that cannot run — instead of a tool that fails at call time.
9
+
10
+ ## What it does
11
+
12
+ The plugin composes six layers:
13
+
14
+ 1. **Catalog** (`catalog/desert-ant-models.json`) — all 18 Desert Ant models,
15
+ their inputs, outputs, language counts and the npm package that runs them.
16
+ 2. **Capability resolver** (`src/capability.ts`) — decides, per model, whether it
17
+ can actually run *in this process*, and why not when it cannot.
18
+ 3. **Adapters** (`src/adapters/`) — lazily import a model package and invoke it.
19
+ 4. **Transports** (`src/transport.ts`) — reach a model this machine cannot run:
20
+ through the Desert Ant CLI, or through a bridge on a machine that can.
21
+ 5. **Registrar** (`src/registrar.ts`) — turns each reachable model into a
22
+ `defineTool` definition registered on `ctx.tools`.
23
+ 6. **Skills** (`src/skills.ts` + `catalog/playbooks.json`) — publishes one skill
24
+ per registered tool describing when to use it, when not to, and how.
25
+
26
+ Nothing is imported from a model package at plugin load, so a deployment that
27
+ installs none of them still starts cleanly and reports exactly what is missing.
28
+
29
+ ## Tools it registers
30
+
31
+ | Tool | Model | Runs on Windows x64 | Notes |
32
+ | --- | --- | --- | --- |
33
+ | `lang_detect` | Tongue | **yes** | Pure JavaScript, 2 MB model inside the package, no network |
34
+ | `transcribe_audio` | Voz | **yes** | Needs `onnxruntime-node`; ~349 MB weights download on first use |
35
+ | `model_tools` | — | yes | Lists every catalogued model, and installs/removes tools |
36
+
37
+ The other 16 catalog models are reported by `model_tools` with the exact reason
38
+ they cannot run, for example:
39
+
40
+ ```
41
+ - [unavailable] redact (`redact_pii`): On-device redaction that strips personal
42
+ data as you type, in 27 languages, with restore support.
43
+ why not: Redact has no prebuilt native build for win32-x64; @desert-ant-labs/redact/native
44
+ ships one for linux-x64, linux-arm64 and darwin-arm64 only.
45
+ ```
46
+
47
+ ## Reaching the other 16 models
48
+
49
+ A model only needs a route, not a rewrite. Two routes cover the rest.
50
+
51
+ ### The CLI (macOS and Linux)
52
+
53
+ Every shipping model is `desertant <verb> … --json`, so wherever the CLI is
54
+ installed the plugin will drive it. Nothing to configure — it is detected on
55
+ PATH:
56
+
57
+ ```sh
58
+ curl -fsSL https://raw.githubusercontent.com/Desert-Ant-Labs/desert-ant-cli/main/install.sh | sh
59
+ ```
60
+
61
+ That immediately makes Redact, Emo, Gist, Clear, Ear, Moderator, Shapes, Align,
62
+ Tongue and Voz callable on that machine.
63
+
64
+ ### The bridge (an Apple machine, for Apple-only models)
65
+
66
+ Title and Uhm run only on Apple silicon. Run the reference bridge there and point
67
+ the plugin at it:
68
+
69
+ ```sh
70
+ # on the Mac
71
+ node scripts/desert-ant-bridge.mjs --token "$(openssl rand -hex 16)"
72
+ ```
73
+
74
+ ```yaml
75
+ - id: model-tools
76
+ config:
77
+ remote:
78
+ endpoint: http://mac-studio.local:8787
79
+ token: <the token>
80
+ ```
81
+
82
+ `suggest_title` then registers here with `route: remote`, and the existing
83
+ catalog entry, parameter schema and skill apply unchanged. The bridge is a thin
84
+ wrapper over the CLI; it binds to loopback and requires a token. **The plugin
85
+ does not host anything** — the licence forbids re-hosting the models as a
86
+ service, so the bridge must be your own machine.
87
+
88
+ ## Installing tools at run time
89
+
90
+ `model_tools` actions: `list`, `installed`, `describe <id>`, `enable <id>`,
91
+ `disable <id>`, `reset [<id>]`.
92
+
93
+ **Enable and disable are remembered across restarts.** A plugin `config` states
94
+ the *deployment* default; `enable`/`disable` record the *user's* choice on top of
95
+ it:
96
+
97
+ - `disable` always wins, so a user can turn off something the config ships.
98
+ - `enable` adds to the config selection, so a user can turn something on without
99
+ editing YAML.
100
+ - `reset` forgets the choice and makes the configuration authoritative again.
101
+
102
+ Choices are stored as JSON at `<DSH_HOME>/model-as-tool/state.json`, written
103
+ through a temporary file and a rename so a crash cannot leave a truncated
104
+ document that reads as "everything is gone".
105
+
106
+ ```json
107
+ { "enabled": ["voz"], "disabled": ["tongue"] }
108
+ ```
109
+
110
+ The plugin writes its own state file rather than rewriting your
111
+ `cordis.patch.yml`: a rewrite there would fight the profile's reload and could
112
+ clobber comments you wrote. Point it elsewhere with `stateFile`, or set
113
+ `persist: false` for the earlier session-scoped behaviour.
114
+
115
+ Enabling a model that cannot run here fails with the resolver's reason and
116
+ nothing is written — persisting a failed enable would install it silently on the
117
+ next start.
118
+
119
+ ## Install
120
+
121
+ The package is a DSH bundle: `package.json` declares
122
+ `dsh.bundle.patch: ./cordis.patch.yml`, and that patch is the single `insert`
123
+ row a profile mounts. Install it with `plugin_manager`'s `install_bundle`
124
+ action, or copy the row from [`cordis.patch.yml`](cordis.patch.yml) into the
125
+ profile's own patch file.
126
+
127
+ The package builds itself on install: `prepare` runs `tsc` from `src/` into
128
+ `lib/`, which is the entry point `main` and `exports` advertise. A registry
129
+ tarball ships `lib/` prebuilt by `prepack`, so a consumer needs no toolchain.
130
+
131
+ Model packages are **optional dependencies**: install only the ones you want.
132
+
133
+ ```sh
134
+ npm i @desert-ant-labs/tongue # language detection, works everywhere
135
+ npm i @desert-ant-labs/voz onnxruntime-node # transcription on Windows/Linux/macOS
136
+ ```
137
+
138
+ The plugin never bundles or re-hosts model weights.
139
+
140
+ ## What gets downloaded, and when
141
+
142
+ Three separate things arrive at three separate times. Measured sizes are from a
143
+ Windows x64 install of this package.
144
+
145
+ **1. The plugin itself — ~58 kB, from npm, at install.** `lib/`, the two catalog
146
+ JSON files, `cordis.patch.yml` and this README. It contains **no model weights
147
+ and no inference runtime**.
148
+
149
+ **2. The model SDK packages — from npm, at install, only if you asked for them.**
150
+ They are `optionalDependencies`, so a failed or skipped download does not fail the
151
+ install; the capability resolver simply reports the model as unavailable.
152
+
153
+ | Package | Size on disk | Contains |
154
+ | --- | --- | --- |
155
+ | `@desert-ant-labs/tongue` | 2.1 MB | **The model itself** — `tongue_int8.bin` (2.0 MB) ships inside the tarball |
156
+ | `@desert-ant-labs/voz` | 44.2 MB | The WebAssembly runtime (`VozWeb.wasm`), not the weights |
157
+ | `onnxruntime-node` | 287.1 MB | The prebuilt inference engine for this platform |
158
+
159
+ **3. The weights — from Hugging Face, on first call, not at install.** Each SDK
160
+ pins one revision and verifies the download, then caches it. Voz fetches about
161
+ **367 MB** on its first transcription:
162
+
163
+ ```
164
+ ~/.cache/desert-ant-models/desert-ant-labs/voz 367 MB (first call)
165
+ ```
166
+
167
+ Tongue never downloads anything: its model is inside the npm package.
168
+
169
+ Point an SDK at a pre-populated folder to run offline (each adapter accepts a
170
+ `directory`), and set `HF_TOKEN` for a gated repo. Because the licence forbids
171
+ redistribution, the plugin never bundles or mirrors weights — it downloads them
172
+ the way the vendor intends, once, into the vendor's own cache.
173
+
174
+ ### Install cost is real, so it is opt-out
175
+
176
+ Installing with the optional dependencies present pulls roughly **333 MB** before
177
+ any model runs, and a first Voz call adds **367 MB** more. If that is unwanted,
178
+ install the plugin with them skipped and add only what you use:
179
+
180
+ ```sh
181
+ npm i @try-works/dsh-tool-mode --omit=optional
182
+ npm i @desert-ant-labs/tongue # 2 MB, and its model is included
183
+ ```
184
+
185
+ **Watch out for the other model packages.** They ship prebuilt native cores for
186
+ `linux-x64`, `linux-arm64` and `darwin-arm64` inside one tarball — roughly 50 MB
187
+ each — so `@desert-ant-labs/redact` is ~166 MB of which the great majority is
188
+ Linux and macOS binaries that can never load on Windows. Installing one on
189
+ Windows buys ~130 MB that cannot run.
190
+
191
+ ## Development
192
+
193
+ ```sh
194
+ npm install # devDependencies: tsc, tsx, and the two model packages
195
+ npm run link:dsh # point @deepseek-ai/* peers at a DSH checkout
196
+ npm run verify # typecheck -> build -> 35 tests -> built-artifact check
197
+ ```
198
+
199
+ `link:dsh` exists because `@deepseek-ai/*` are **peer** dependencies — DSH
200
+ supplies them at runtime, so locally they must be pointed at a checkout:
201
+
202
+ ```sh
203
+ node scripts/link-dsh.mjs --checkout /path/to/deepseek-harness
204
+ ```
205
+
206
+ Run it again after any `npm install`: npm prunes anything in `node_modules` it
207
+ does not own, which includes those links.
208
+
209
+ `npm run verify` ends with `verify:built`, which loads `lib/index.js` — resolved
210
+ through the package's own `main`, under plain Node with no TypeScript loader —
211
+ and runs a real inference. That is the artifact DSH loads, so it is the only
212
+ build whose behaviour proves the plugin is installable; passing tests against
213
+ `src/` under `tsx` does not.
214
+
215
+ | Command | Purpose |
216
+ | --- | --- |
217
+ | `npm run demo` | Mount the plugin on a real context and print what it registered |
218
+ | `npm run gating` | Print the resolved route for every catalogued model |
219
+ | `npm run gen-docs` | Regenerate the data-derived docs from the catalog |
220
+ | `npm run bridge` | Run the reference bridge for an Apple/Linux machine |
221
+
222
+ Tests always mount through `tests/helpers.ts`, which points the durable state at
223
+ a throwaway directory. That is not cosmetic: the plugin writes user choices into
224
+ `DSH_HOME` by default, so an unisolated test would edit the developer's real
225
+ configuration and a later test would read those edits as a user decision.
226
+
227
+ ## Configuration
228
+
229
+ ```yaml
230
+ - id: model-tools
231
+ name: '@try-works/dsh-tool-mode'
232
+ config:
233
+ models: [] # empty = every runnable model; or list ids, e.g. [tongue]
234
+ exclude: [] # ids to drop after `models`
235
+ exposeUnavailable: false # true registers tools that will fail at call time
236
+ registerSkills: true
237
+ registerControlTool: true
238
+ persist: true # remember enable/disable across restarts
239
+ # stateFile: /path/to/state.json # default <DSH_HOME>/model-as-tool/state.json
240
+ allowNpm: true # false forces the CLI/bridge routes
241
+ cli:
242
+ enabled: true # use the Desert Ant CLI when it is on PATH
243
+ command: desertant
244
+ remote:
245
+ endpoint: '' # a bridge on a machine that can run what this one cannot
246
+ token: ''
247
+ # catalogFile: /path/to/other-catalog.json
248
+ # playbookFile: /path/to/other-playbooks.json
249
+ ```
250
+
251
+ ## Platform support
252
+
253
+ This is the part that matters most, because Desert Ant's Node prebuilds cover
254
+ `linux-x64`, `linux-arm64` and `darwin-arm64` — **not `win32-x64`**.
255
+
256
+ | Tier | Models | How |
257
+ | --- | --- | --- |
258
+ | Runs in plain Node everywhere | Tongue | Pure JS, no WASM, no inference runtime |
259
+ | Runs where ONNX Runtime runs | Voz | `onnxruntime-node` ships win32-x64 binaries |
260
+ | Prebuilt for linux/darwin only | Redact, Emo, Gist, Clear, Ear, Moderator, Shapes, Align | `/native` subpath |
261
+ | Apple only (Core ML / MLX) | Title, Uhm | Swift SDK; no JS or Kotlin SDK |
262
+ | Closed beta, no SDK | Schemer, Toxic, Who, Eye, Face | Weights on Hugging Face, nothing ships them |
263
+
264
+ The browser/WASM entry of the LiteRT models explicitly refuses to run in plain
265
+ Node ("needs a browser/Worker environment"), so it is not a fallback.
266
+
267
+ ## Licensing
268
+
269
+ The Desert Ant Labs models are under the
270
+ [Source-Available License 1.0](https://license.desertant.com/1.0) — not an
271
+ open-source license. Inference is unlimited and free below 100,000 monthly active
272
+ devices **per platform, per model**; above that a commercial license is required.
273
+ Attribution ("Powered by Desert Ant Labs", linked) is required, and the models
274
+ may not be redistributed or re-hosted as a standalone product or service.
275
+
276
+ That is exactly why this plugin is an installer/wrapper: it loads the official
277
+ npm packages locally and never ships, mirrors or proxies the weights.
278
+
279
+ ## Tests
280
+
281
+ ```sh
282
+ npm run verify # from the repository root
283
+ ```
284
+
285
+ The suite boots the plugin on a real Cordis context with the shipping
286
+ `ToolRuntime`, `SystemPrompt` and `SkillRegistry`, then drives the registered
287
+ tools through `ctx.tools.execute` — including a real Tongue inference. The
288
+ transport suite injects its command runner and HTTP poster, so the CLI and bridge
289
+ failure paths are covered without a process or a socket.
290
+
291
+ The tracked requirements and acceptance evidence are summarized in
292
+ [verification/FINAL-REPORT.md](../../verification/FINAL-REPORT.md).
293
+
294
+ ## Design notes
295
+
296
+ - See [docs/model-as-tool-architecture.md](../../docs/model-as-tool-architecture.md)
297
+ for the full design.
298
+ - See [docs/adding-a-model.md](../../docs/adding-a-model.md) to add a model.
299
+ - See [docs/model-tool-playbook.md](../../docs/model-tool-playbook.md) for the
300
+ per-model use cases, tool shapes and skill content.
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The `dsh-tool-mode-credentials` executable (SEC-01).
4
+ *
5
+ * The HUMAN-ONLY credential surface: the model-visible `model_tools`
6
+ * management action refuses generation (a generated secret must never enter a
7
+ * model transcript), and this CLI is the operator's terminal instead. The
8
+ * stream discipline is the stdio bridge's own: STDOUT carries the credential
9
+ * (the secret exactly once) and nothing else; diagnostics and usage go to
10
+ * stderr. The secret is never logged and never recoverable.
11
+ */
12
+
13
+ import { runCredentialsCli } from '../lib/mcp/credential-cli.js'
14
+
15
+ const exit = runCredentialsCli(process.argv.slice(2), {
16
+ out: line => process.stdout.write(`${line}\n`),
17
+ err: line => process.stderr.write(`${line}\n`),
18
+ })
19
+
20
+ process.exit(exit)
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The `dsh-tool-mode-mcp-stdio` executable (MCP-03, P26-08).
4
+ *
5
+ * This file owns the one property that cannot be tested from the library: that
6
+ * STDOUT CARRIES PROTOCOL TRAFFIC AND NOTHING ELSE. Everything written here goes
7
+ * through two explicitly separate streams, and nothing in this process writes to
8
+ * stdout except a protocol frame — not a banner, not a version, not a warning.
9
+ *
10
+ * The endpoint and token come from the environment, which is how an MCP client
11
+ * launches a stdio server. A missing token is reported on STDERR and the process
12
+ * exits non-zero: an unattended launch must fail with guidance rather than hang
13
+ * waiting for a credential nobody will supply (P26-16).
14
+ */
15
+
16
+ import { createStdioBridge } from '../lib/mcp/stdio.js'
17
+
18
+ const url = process.env.DSH_TOOL_MODE_MCP_URL ?? 'http://127.0.0.1:3765/mcp'
19
+ const token = process.env.DSH_TOOL_MODE_MCP_TOKEN
20
+
21
+ /** Diagnostics. NEVER stdout. */
22
+ const diagnostic = line => process.stderr.write(`${line}\n`)
23
+
24
+ if (token === undefined || token.length === 0) {
25
+ // P26-16: unattended operation must fail with setup guidance, never hang.
26
+ diagnostic('dsh-tool-mode-mcp-stdio: no credential configured.')
27
+ diagnostic(' Set DSH_TOOL_MODE_MCP_TOKEN to the token the operator configured for this client,')
28
+ diagnostic(' and DSH_TOOL_MODE_MCP_URL if the endpoint is not http://127.0.0.1:3765/mcp.')
29
+ process.exit(2)
30
+ }
31
+
32
+ const bridge = createStdioBridge(
33
+ {
34
+ url,
35
+ token,
36
+ fetch: async (target, init) => {
37
+ const response = await fetch(target, {
38
+ method: init.method,
39
+ headers: init.headers,
40
+ body: init.body,
41
+ signal: init.signal,
42
+ })
43
+ const headers = {}
44
+ response.headers.forEach((value, key) => { headers[key] = value })
45
+ return { status: response.status, headers, body: await response.text() }
46
+ },
47
+ },
48
+ {
49
+ // The ONLY writer to stdout in this process.
50
+ protocol: line => process.stdout.write(`${line}\n`),
51
+ diagnostic,
52
+ },
53
+ )
54
+
55
+ // Newline-delimited input. Chunk boundaries are not frame boundaries, so a partial
56
+ // line is buffered until its newline arrives.
57
+ let buffer = ''
58
+ process.stdin.setEncoding('utf8')
59
+ process.stdin.on('data', chunk => {
60
+ buffer += chunk
61
+ let index = buffer.indexOf('\n')
62
+ while (index !== -1) {
63
+ const line = buffer.slice(0, index)
64
+ buffer = buffer.slice(index + 1)
65
+ void bridge.handleLine(line).then(output => {
66
+ if (output !== undefined) process.stdout.write(`${output}\n`)
67
+ }).catch(error => {
68
+ // A bridge fault is a diagnostic; the protocol channel stays clean.
69
+ diagnostic(`bridge error: ${error instanceof Error ? error.message : String(error)}`)
70
+ })
71
+ index = buffer.indexOf('\n')
72
+ }
73
+ })
74
+
75
+ process.stdin.on('end', () => {
76
+ // P26-08: EOF shuts down BRIDGE-OWNED requests without killing the shared host.
77
+ bridge.close()
78
+ diagnostic('stdin closed; bridge-owned requests aborted')
79
+ process.exit(0)
80
+ })
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The `dsh-tool-mode` launcher (RUN-03/RUN-04): serve / doctor / prepare /
4
+ * mcp-stdio.
5
+ *
6
+ * - `serve` boots the headless host composition. The host package ships no
7
+ * composition entry of its own (no src/host.ts — the recorded seam): serve
8
+ * attempts to resolve the DSH composition runtime and, when it is not
9
+ * resolvable from this artifact, exits non-zero with the exact missing seam
10
+ * rather than inventing service constructors.
11
+ * - `doctor` reports configuration, package/runtime compatibility, platform
12
+ * readiness and the launcher seam WITHOUT secrets.
13
+ * - `prepare --tool <name>` resolves the installed extension that serves the
14
+ * tool and runs the digest-verified prepared-assets acquisition (a REAL
15
+ * download is opt-in: the operator runs this command deliberately).
16
+ * - `mcp-stdio` reuses the existing stdio relay (same env contract as the
17
+ * standalone binary).
18
+ *
19
+ * Every subcommand: `--json` emits structured JSON on stdout; failures exit
20
+ * non-zero; an unattended launch never hangs (P26-16).
21
+ */
22
+
23
+ import { readFileSync } from 'node:fs'
24
+ import { createHash } from 'node:crypto'
25
+ import { existsSync, mkdirSync, readdirSync, statSync } from 'node:fs'
26
+ import { createInterface } from 'node:readline'
27
+ import { dirname, join, resolve } from 'node:path'
28
+ import { createPreparedAssetRegistry, parseAssetLock, plannedAssets, lockGroups, identityFor } from '../lib/prepared-assets.js'
29
+ import { planPreparation } from '../lib/deployment-coordinator.js'
30
+ import { createHttpSource } from '../lib/http-acquisition.js'
31
+ import { createStdioBridge } from '../lib/mcp/stdio.js'
32
+ import { discoverExtension } from '@try-works/tool-mode-extension-sdk'
33
+
34
+ const args = process.argv.slice(2)
35
+ const command = args[0] ?? '--help'
36
+ const flag = name => {
37
+ const index = args.indexOf(name)
38
+ return index === -1 || index + 1 >= args.length ? undefined : args[index + 1]
39
+ }
40
+ const jsonOut = args.includes('--json')
41
+ const report = (value) => {
42
+ process.stdout.write(`${JSON.stringify(value, null, 2)}\n`)
43
+ process.exit(0)
44
+ }
45
+ const fail = (message, code = 2) => {
46
+ if (jsonOut) process.stdout.write(`${JSON.stringify({ ok: false, error: message })}\n`)
47
+ else process.stderr.write(`dsh-tool-mode: ${message}\n`)
48
+ process.exit(code)
49
+ }
50
+
51
+ /** Read the config document, tolerating its absence for the read-only commands. */
52
+ function readConfig(path) {
53
+ const target = path ?? process.env.DSH_TOOL_MODE_CONFIG ?? './tool-mode.json'
54
+ try {
55
+ return JSON.parse(readFileSync(target, 'utf8'))
56
+ } catch {
57
+ return {}
58
+ }
59
+ }
60
+
61
+ if (command === 'mcp-stdio') {
62
+ const url = process.env.DSH_TOOL_MODE_MCP_URL ?? 'http://127.0.0.1:3765/mcp'
63
+ const token = process.env.DSH_TOOL_MODE_MCP_TOKEN
64
+ if (token === undefined || token.length === 0) {
65
+ process.stderr.write('dsh-tool-mode mcp-stdio: no credential configured (DSH_TOOL_MODE_MCP_TOKEN).\n')
66
+ process.exit(2)
67
+ }
68
+ const bridge = createStdioBridge(
69
+ {
70
+ url,
71
+ token,
72
+ fetch: async (target, init) => {
73
+ const response = await fetch(target, {
74
+ method: init.method,
75
+ headers: init.headers,
76
+ body: init.body,
77
+ signal: init.signal,
78
+ })
79
+ const headers = {}
80
+ response.headers.forEach((value, key) => { headers[key] = value })
81
+ return { status: response.status, headers, body: await response.text() }
82
+ },
83
+ },
84
+ {
85
+ protocol: line => process.stdout.write(`${line}\n`),
86
+ diagnostic: line => process.stderr.write(`${line}\n`),
87
+ },
88
+ )
89
+ const lines = createInterface({ input: process.stdin, crlfDelay: Infinity })
90
+ lines.on('line', line => {
91
+ void bridge.handleLine(line).then(
92
+ reply => { if (reply !== undefined) process.stdout.write(`${reply}\n`) },
93
+ error => process.stderr.write(`dsh-tool-mode mcp-stdio: ${error instanceof Error ? error.message : String(error)}\n`),
94
+ )
95
+ })
96
+ lines.on('close', () => bridge.close())
97
+ process.on('SIGINT', () => { bridge.close(); process.exit(0) })
98
+ process.on('SIGTERM', () => { bridge.close(); process.exit(0) })
99
+ } else if (command === 'doctor') {
100
+ const config = readConfig(flag('--config'))
101
+ const platform = `${process.platform} ${process.arch}`
102
+ const nodeVersion = process.version
103
+ const mcpPort = config.mcpV3?.port ?? config.mcp?.port ?? 3765
104
+ const extensionStore = config.extensionStore ?? config.extensions?.registry ?? 'unset'
105
+ const result = {
106
+ ok: true,
107
+ command: 'doctor',
108
+ platform: { os: process.platform, arch: process.arch, node: nodeVersion, accelerator: 'cpu' },
109
+ configuration: {
110
+ schemaVersion: config.schemaVersion ?? 'legacy (v1/v2 flat shape)',
111
+ mcp: { host: '127.0.0.1', port: mcpPort, path: config.mcpV3?.path ?? '/mcp' },
112
+ extensionStore,
113
+ fixedFalseFlags: {
114
+ automaticUpdates: false,
115
+ runInstallScripts: false,
116
+ automaticActivation: false,
117
+ allowExecutableTemplates: false,
118
+ inheritConversation: false,
119
+ allowModelToolCalls: false,
120
+ },
121
+ },
122
+ launcherSeam:
123
+ '`serve` boots the headless composition in lib/headless.js: config -> catalog -> contract bindings -> MCP host -> '
124
+ + 'HTTP with credential authentication, without the DSH CLI or a browser (RUN-03). Harness-backed program '
125
+ + 'execution (tool_mode_run) stays refused headless: it needs the DSH PtcHostContext (CODE-10).',
126
+ serverStatus: 'not running (doctor does not start the listener)',
127
+ }
128
+ report(result)
129
+ } else if (command === 'prepare') {
130
+ const tool = flag('--tool')
131
+ if (tool === undefined) fail('prepare requires --tool <toolName> (RUN-04)')
132
+ const config = readConfig(flag('--config'))
133
+ const storeDir = config.extensionStore
134
+ if (typeof storeDir !== 'string' || storeDir.length === 0) {
135
+ fail('prepare requires the extension store (config.extensionStore); the store is not configured')
136
+ }
137
+ // Resolve the installed extension whose manifest serves the requested tool.
138
+ const found = []
139
+ if (existsSync(storeDir)) {
140
+ for (const entry of readdirSync(storeDir)) {
141
+ const root = join(storeDir, entry)
142
+ if (!statSync(root).isDirectory()) continue
143
+ for (const id of readdirSync(root)) {
144
+ const scope = join(root, id)
145
+ if (!statSync(scope).isDirectory()) continue
146
+ for (const version of readdirSync(scope)) {
147
+ const installPath = join(scope, version)
148
+ if (!existsSync(join(installPath, 'tool-mode.extension.json'))) continue
149
+ try {
150
+ const discovery = discoverExtension(installPath)
151
+ const serves = discovery.manifest.tools.some(t => t.name === tool)
152
+ || discovery.manifest.implementations.some(impl => {
153
+ const owner = discovery.manifest.tools.find(t => t.contractId === impl.contractId)
154
+ return owner?.name === tool
155
+ })
156
+ if (serves) found.push({ discovery, installPath })
157
+ } catch {
158
+ // A broken package is skipped: prepare never guesses.
159
+ }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ if (found.length === 0) fail(`no installed extension serves the tool ${JSON.stringify(tool)} (prepare never guesses)`)
165
+ const { discovery, installPath } = found[0]
166
+ const model = discovery.manifest.models[0]
167
+ if (model === undefined) fail(`the extension serving ${tool} declares no model deployment`)
168
+ const lockPath = join(dirname(discovery.manifestPath), model.assetLock)
169
+ const lock = parseAssetLock(readFileSync(lockPath, 'utf8'))
170
+ const groups = lockGroups(lock, model.assetSet)
171
+ const plan = planPreparation(identityFor(discovery.manifest.id, model.id, lock), plannedAssets(lock, model.assetSet), lock.license)
172
+ const statePath = config.stateFile ?? join(process.env.LOCALAPPDATA ?? process.env.TEMP ?? '.', 'dsh-tool-mode', 'state.json')
173
+ const registry = createPreparedAssetRegistry({ cacheRoot: join(dirname(resolve(statePath)), 'asset-cache') })
174
+ const outcome = await registry.prepare(discovery.manifest.id, plan, groups, {
175
+ source: createHttpSource(),
176
+ allowExecutable: false,
177
+ signal: new AbortController().signal,
178
+ })
179
+ if (!outcome.ok) fail(`the preparation failed: ${outcome.reason}`, 1)
180
+ const transferred = outcome.groups.map(group => group.digests.map(digest => createHash('sha256').update(digest).digest('hex')))
181
+ report({
182
+ ok: true,
183
+ command: 'prepare',
184
+ tool,
185
+ extension: discovery.manifest.id,
186
+ model: model.id,
187
+ revision: lock.revision,
188
+ groups: outcome.groups.map(group => ({ groupId: group.groupId, path: group.path, digests: group.digests })),
189
+ note: `transferred digests (${transferred.length} groups) are the content hashes; sizes are per-asset in the lock`,
190
+ })
191
+ } else if (command === 'serve') {
192
+ // The REAL headless composition (RUN-03, task-74): config load, catalog
193
+ // resolution, contract bindings, the MCP HTTP listener, and a bounded
194
+ // SIGINT/SIGTERM shutdown — composed from the host's own services, no DSH
195
+ // CLI required.
196
+ const { runHeadlessServe } = await import('../lib/headless.js')
197
+ const exit = await runHeadlessServe(
198
+ { configPath: flag('--config'), json: jsonOut },
199
+ { out: line => process.stdout.write(`${line}\n`), err: line => process.stderr.write(`${line}\n`) },
200
+ )
201
+ process.exit(exit)
202
+ } else {
203
+ process.stderr.write(
204
+ 'dsh-tool-mode: usage\n'
205
+ + ' dsh-tool-mode serve [--config tool-mode.json] [--json]\n'
206
+ + ' dsh-tool-mode doctor [--config tool-mode.json] [--json]\n'
207
+ + ' dsh-tool-mode prepare --tool <toolName> [--config tool-mode.json] [--json]\n'
208
+ + ' dsh-tool-mode mcp-stdio\n',
209
+ )
210
+ process.exit(command === '--help' || command === '-h' ? 0 : 2)
211
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "version": 1,
3
+ "description": "Host-release trusted built-ins. This file is authoritative; a package manifest cannot grant itself built-in status or extra trust.",
4
+ "builtins": [
5
+ {
6
+ "extensionId": "@try-works/extension-embeddinggemma",
7
+ "package": "@try-works/extension-embeddinggemma",
8
+ "protected": true
9
+ },
10
+ {
11
+ "extensionId": "@try-works/extension-laya",
12
+ "package": "@try-works/extension-laya",
13
+ "protected": true
14
+ },
15
+ {
16
+ "extensionId": "@try-works/extension-needle",
17
+ "package": "@try-works/extension-needle",
18
+ "protected": true
19
+ },
20
+ {
21
+ "extensionId": "@try-works/extension-declarative-recipes",
22
+ "package": "@try-works/extension-declarative-recipes",
23
+ "protected": true
24
+ }
25
+ ]
26
+ }