@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,194 @@
1
+ /**
2
+ * Title and description proposal (TOOL-06), with the language-evidence rule from
3
+ * TOOL-03.
4
+ *
5
+ * TOOL-06 is mostly a list of things a title generator must NOT do, and the sharpest of
6
+ * them is this: **a refusal or an incomplete generation must not become a valid empty
7
+ * title.** That failure is easy to ship and hard to notice, because the shape of the
8
+ * response is correct — `{ title: "" }` looks like a result — and a caller writing it
9
+ * into a document produces an empty heading rather than an error.
10
+ *
11
+ * The other rules here are enforced rather than described:
12
+ *
13
+ * - **No invented facts.** A number in a proposed title that does not appear in the
14
+ * source is a claim the source does not support. This is checkable, so it is checked.
15
+ * - **No changed source meaning.** Enforced through the same provenance check plus a
16
+ * refusal to accept a title with no overlap with the source.
17
+ * - **No calling another tool.** Structural: the response shape carries no tool-call
18
+ * field, so there is nothing to dispatch.
19
+ * - **Maximum lengths in the schema**, which the contract states and this enforces.
20
+ *
21
+ * @module @try-works/dsh-tool-mode/title-proposal
22
+ */
23
+ /** The lengths the contract states (TOOL-06). */
24
+ export interface TitleLimits {
25
+ /** Maximum characters in a title. */
26
+ readonly maxTitleChars: number;
27
+ /** Maximum characters in a description. */
28
+ readonly maxDescriptionChars: number;
29
+ /** Maximum repair attempts permitted. Zero when repairs are disabled. */
30
+ readonly maxRepairs: number;
31
+ }
32
+ /**
33
+ * The evaluated defaults for a section title (TOOL-06).
34
+ *
35
+ * Stated in the contract rather than chosen per call, because "define maximum
36
+ * title/description lengths in the schema and evaluated recipe" means a caller cannot
37
+ * widen them by asking.
38
+ */
39
+ export declare const SECTION_TITLE_LIMITS: TitleLimits;
40
+ /**
41
+ * The contract limits for one configuration's CODE-11 repair ceiling.
42
+ *
43
+ * The title/description lengths stay contract-stated; the repair ceiling is
44
+ * the operator's configured number (an integer 0..8, default 1). An invalid
45
+ * ceiling is a REFUSAL, never a silent clamp — the recorded lineage must show
46
+ * the budget the operator actually approved.
47
+ * @param repairCeiling - the configured ceiling; absent means the default 1.
48
+ * @returns the limits the repair decision and lineage honor.
49
+ */
50
+ export declare function titleLimitsFor(repairCeiling?: number): TitleLimits;
51
+ /** What a title is being proposed for. */
52
+ export type TitleKind = 'section' | 'page' | 'document';
53
+ /** The raw response a text model produced (TOOL-06). */
54
+ export interface RawTitleResponse {
55
+ /** The title text, when the model produced one. */
56
+ readonly title?: string;
57
+ /** The description text, when the model produced one. */
58
+ readonly description?: string;
59
+ /**
60
+ * Set when the model refused.
61
+ *
62
+ * Distinguishing a refusal from an empty generation is what stops the first becoming
63
+ * a valid empty title.
64
+ */
65
+ readonly refused?: boolean;
66
+ /** Why it refused, when it did. */
67
+ readonly refusalReason?: string;
68
+ /**
69
+ * Set when generation was cut short.
70
+ *
71
+ * A truncated generation is not a short one; reporting it as a title claims a
72
+ * complete answer from an incomplete one.
73
+ */
74
+ readonly incomplete?: boolean;
75
+ }
76
+ /** How a proposal ended. */
77
+ export type TitleOutcome =
78
+ /** A usable title. */
79
+ {
80
+ readonly kind: 'proposed';
81
+ readonly title: string;
82
+ readonly description: string;
83
+ /** How many repair attempts were consumed, for the accounting TOOL-06 asks for. */
84
+ readonly repairs: number;
85
+ }
86
+ /**
87
+ * The model refused.
88
+ *
89
+ * An ERROR for the caller, never an empty title.
90
+ */
91
+ | {
92
+ readonly kind: 'refused';
93
+ readonly reason: string;
94
+ }
95
+ /** The generation was cut short. An error, never a short title. */
96
+ | {
97
+ readonly kind: 'incomplete';
98
+ readonly reason: string;
99
+ }
100
+ /** The response could not be used as a title. */
101
+ | {
102
+ readonly kind: 'invalid';
103
+ readonly reason: string;
104
+ }
105
+ /** The response failed validation against a rule below. */
106
+ | {
107
+ readonly kind: 'rejected';
108
+ readonly reason: string;
109
+ };
110
+ /**
111
+ * Accept or refuse a title proposal (TOOL-06).
112
+ *
113
+ * @param response - the model's raw response.
114
+ * @param source - the text the title was proposed for, used for provenance.
115
+ * @param limits - the lengths the contract states.
116
+ * @returns the outcome, which is an error rather than an empty title whenever the
117
+ * response was not a usable one.
118
+ */
119
+ export declare function acceptTitle(response: RawTitleResponse, source: string, limits?: TitleLimits): TitleOutcome;
120
+ /**
121
+ * Whether a repair attempt may run (TOOL-06).
122
+ *
123
+ * The requirement says to COUNT repair attempts when they are enabled, so the count is
124
+ * returned rather than kept internally — an uncounted retry is how a budget silently
125
+ * becomes unbounded.
126
+ * @param limits - the contract's limits.
127
+ * @param repairsSoFar - repairs already consumed.
128
+ * @param previous - what the previous attempt produced.
129
+ * @returns whether to repair, and how many repairs would then be consumed.
130
+ */
131
+ export declare function mayRepairTitle(limits: TitleLimits, repairsSoFar: number, previous: TitleOutcome): {
132
+ readonly repair: boolean;
133
+ readonly repairs: number;
134
+ readonly reason?: string;
135
+ };
136
+ /**
137
+ * One repair-lineage entry (CODE-11): the traceable per-attempt record the
138
+ * budget lineage owes — which repair, the budget before and after the
139
+ * decision, and the outcome the decision produced. A COUNT alone cannot show
140
+ * WHERE a budget was spent; the lineage does.
141
+ */
142
+ export interface RepairLineageEntry {
143
+ /** One-based repair attempt index. */
144
+ readonly repairIndex: number;
145
+ /** The repair budget before the decision. */
146
+ readonly budgetBefore: number;
147
+ /** The repair budget after the decision (one lower when a repair ran). */
148
+ readonly budgetAfter: number;
149
+ /** What the previous attempt produced, so the lineage names WHY. */
150
+ readonly previousKind: string;
151
+ /** The decision outcome for this attempt. */
152
+ readonly outcome: 'repaired' | 'exhausted' | 'not-needed';
153
+ }
154
+ /**
155
+ * Record one repair decision into the lineage (CODE-11, pure and testable).
156
+ * @param lineage - the lineage so far (mutated in place, then returned).
157
+ * @param decision - the `mayRepairTitle` decision for this attempt.
158
+ * @param previousKind - the previous outcome kind.
159
+ * @param budgetBefore - the budget the decision was made against.
160
+ * @returns the updated lineage.
161
+ */
162
+ export declare function recordRepairLineage(lineage: RepairLineageEntry[], decision: {
163
+ readonly repair: boolean;
164
+ readonly repairs: number;
165
+ }, previousKind: string, budgetBefore: number): RepairLineageEntry[];
166
+ /**
167
+ * Whether a tool may call another tool to fulfil this contract (TOOL-06).
168
+ *
169
+ * It may not: "do not call another tool". Returns false so the prohibition is asserted,
170
+ * and the response shape carries no tool-call field for one to be dispatched from.
171
+ * @returns always false.
172
+ */
173
+ export declare function mayCallAnotherTool(): boolean;
174
+ /** What a language result actually examined (TOOL-03). */
175
+ export type LanguageEvidence = 'text' | 'audio';
176
+ /**
177
+ * Whether a language result may be cited as evidence for a medium (TOOL-03).
178
+ *
179
+ * A text detector's result is evidence about the TEXT it processed and nothing else.
180
+ * The requirement forbids using it as evidence of the language SPOKEN in audio it has
181
+ * not processed, and the refusal is per-medium rather than per-result because the result
182
+ * itself is sound — only its use as audio evidence is not.
183
+ * @param examined - what the result examined.
184
+ * @param claimed - the medium being claimed.
185
+ * @returns whether the claim is supported.
186
+ */
187
+ export declare function supportsLanguageClaim(examined: LanguageEvidence, claimed: LanguageEvidence): boolean;
188
+ /**
189
+ * Describe what a language result is evidence for (TOOL-03).
190
+ * @param examined - what the result examined.
191
+ * @returns a description that does not overstate the result.
192
+ */
193
+ export declare function describeLanguageEvidence(examined: LanguageEvidence): string;
194
+ //# sourceMappingURL=title-proposal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title-proposal.d.ts","sourceRoot":"","sources":["../src/title-proposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,iDAAiD;AACjD,MAAM,WAAW,WAAW;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,2CAA2C;IAC3C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAKlC,CAAA;AAED;;;;;;;;;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AQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAEpG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAI3E"}
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Title and description proposal (TOOL-06), with the language-evidence rule from
3
+ * TOOL-03.
4
+ *
5
+ * TOOL-06 is mostly a list of things a title generator must NOT do, and the sharpest of
6
+ * them is this: **a refusal or an incomplete generation must not become a valid empty
7
+ * title.** That failure is easy to ship and hard to notice, because the shape of the
8
+ * response is correct — `{ title: "" }` looks like a result — and a caller writing it
9
+ * into a document produces an empty heading rather than an error.
10
+ *
11
+ * The other rules here are enforced rather than described:
12
+ *
13
+ * - **No invented facts.** A number in a proposed title that does not appear in the
14
+ * source is a claim the source does not support. This is checkable, so it is checked.
15
+ * - **No changed source meaning.** Enforced through the same provenance check plus a
16
+ * refusal to accept a title with no overlap with the source.
17
+ * - **No calling another tool.** Structural: the response shape carries no tool-call
18
+ * field, so there is nothing to dispatch.
19
+ * - **Maximum lengths in the schema**, which the contract states and this enforces.
20
+ *
21
+ * @module @try-works/dsh-tool-mode/title-proposal
22
+ */
23
+ /**
24
+ * The evaluated defaults for a section title (TOOL-06).
25
+ *
26
+ * Stated in the contract rather than chosen per call, because "define maximum
27
+ * title/description lengths in the schema and evaluated recipe" means a caller cannot
28
+ * widen them by asking.
29
+ */
30
+ export const SECTION_TITLE_LIMITS = {
31
+ // A heading is scanned, not read; beyond this it wraps and stops being a heading.
32
+ maxTitleChars: 80,
33
+ maxDescriptionChars: 240,
34
+ maxRepairs: 1,
35
+ };
36
+ /**
37
+ * The contract limits for one configuration's CODE-11 repair ceiling.
38
+ *
39
+ * The title/description lengths stay contract-stated; the repair ceiling is
40
+ * the operator's configured number (an integer 0..8, default 1). An invalid
41
+ * ceiling is a REFUSAL, never a silent clamp — the recorded lineage must show
42
+ * the budget the operator actually approved.
43
+ * @param repairCeiling - the configured ceiling; absent means the default 1.
44
+ * @returns the limits the repair decision and lineage honor.
45
+ */
46
+ export function titleLimitsFor(repairCeiling) {
47
+ const ceiling = repairCeiling ?? SECTION_TITLE_LIMITS.maxRepairs;
48
+ if (!Number.isInteger(ceiling) || ceiling < 0 || ceiling > 8) {
49
+ throw new Error(`the repair ceiling must be an integer between 0 and 8 (CODE-11); received ${JSON.stringify(ceiling)}`);
50
+ }
51
+ return {
52
+ maxTitleChars: SECTION_TITLE_LIMITS.maxTitleChars,
53
+ maxDescriptionChars: SECTION_TITLE_LIMITS.maxDescriptionChars,
54
+ maxRepairs: ceiling,
55
+ };
56
+ }
57
+ /** Every number appearing in a string, as written. */
58
+ function numbersIn(text) {
59
+ return text.match(/\d+(?:[.,]\d+)*/g) ?? [];
60
+ }
61
+ /** Content words, lowercased, for the overlap check. */
62
+ function contentWords(text) {
63
+ const stop = new Set([
64
+ 'a', 'an', 'the', 'and', 'or', 'of', 'to', 'in', 'on', 'for', 'with', 'your', 'you',
65
+ 'this', 'that', 'is', 'are', 'be', 'it', 'at', 'by', 'as', 'how', 'what', 'why',
66
+ ]);
67
+ return new Set(text.toLowerCase().match(/[a-z][a-z'-]{2,}/g)?.filter(word => !stop.has(word)) ?? []);
68
+ }
69
+ /**
70
+ * Accept or refuse a title proposal (TOOL-06).
71
+ *
72
+ * @param response - the model's raw response.
73
+ * @param source - the text the title was proposed for, used for provenance.
74
+ * @param limits - the lengths the contract states.
75
+ * @returns the outcome, which is an error rather than an empty title whenever the
76
+ * response was not a usable one.
77
+ */
78
+ export function acceptTitle(response, source, limits = SECTION_TITLE_LIMITS) {
79
+ // A REFUSAL IS AN ERROR. This is the rule the requirement states most sharply, and it
80
+ // is checked first so a refusal can never fall through to the empty-title path.
81
+ if (response.refused === true) {
82
+ return {
83
+ kind: 'refused',
84
+ reason: response.refusalReason ?? 'the model declined to propose a title',
85
+ };
86
+ }
87
+ if (response.incomplete === true) {
88
+ return { kind: 'incomplete', reason: 'the generation was cut short, so no title was completed' };
89
+ }
90
+ const title = response.title;
91
+ if (typeof title !== 'string') {
92
+ return { kind: 'invalid', reason: 'the response carried no title field' };
93
+ }
94
+ // AN EMPTY TITLE IS NOT A VALID EMPTY TITLE. A caller writing one into a document
95
+ // produces a blank heading rather than an error, which is why this is refused.
96
+ if (title.trim().length === 0) {
97
+ return {
98
+ kind: 'rejected',
99
+ reason: 'the title is empty; an empty title is an error, not a valid empty result',
100
+ };
101
+ }
102
+ if (title.length > limits.maxTitleChars) {
103
+ return {
104
+ kind: 'rejected',
105
+ reason: `the title is ${title.length} characters, over the ${limits.maxTitleChars} the contract states`,
106
+ };
107
+ }
108
+ const description = response.description ?? '';
109
+ if (description.length > limits.maxDescriptionChars) {
110
+ return {
111
+ kind: 'rejected',
112
+ reason: `the description is ${description.length} characters, over the ${limits.maxDescriptionChars} the contract states`,
113
+ };
114
+ }
115
+ /**
116
+ * NO INVENTED FACTS: a number in the title must appear in the source.
117
+ *
118
+ * "10 Ways to Improve Performance" over a source that never says ten is a claim the
119
+ * source does not support, and it is exactly the kind of plausible embellishment a
120
+ * summariser adds. This is checkable, so it is checked rather than requested.
121
+ */
122
+ const sourceNumbers = new Set(numbersIn(source));
123
+ for (const number of numbersIn(title)) {
124
+ if (!sourceNumbers.has(number)) {
125
+ return {
126
+ kind: 'rejected',
127
+ reason: `the title states "${number}", which does not appear in the source`,
128
+ };
129
+ }
130
+ }
131
+ for (const number of numbersIn(description)) {
132
+ if (!sourceNumbers.has(number)) {
133
+ return {
134
+ kind: 'rejected',
135
+ reason: `the description states "${number}", which does not appear in the source`,
136
+ };
137
+ }
138
+ }
139
+ /**
140
+ * NO CHANGED SOURCE MEANING, approximated as a real overlap requirement.
141
+ *
142
+ * A title sharing no content word with its source is not a title FOR that source; it
143
+ * is a different claim wearing the shape of one.
144
+ */
145
+ const sourceWords = contentWords(source);
146
+ const titleWords = contentWords(title);
147
+ if (sourceWords.size > 0 && titleWords.size > 0) {
148
+ const overlap = [...titleWords].some(word => sourceWords.has(word));
149
+ if (!overlap) {
150
+ return {
151
+ kind: 'rejected',
152
+ reason: 'the title shares no content word with the source, so it is not a title for it',
153
+ };
154
+ }
155
+ }
156
+ return { kind: 'proposed', title: title.trim(), description: description.trim(), repairs: 0 };
157
+ }
158
+ /**
159
+ * Whether a repair attempt may run (TOOL-06).
160
+ *
161
+ * The requirement says to COUNT repair attempts when they are enabled, so the count is
162
+ * returned rather than kept internally — an uncounted retry is how a budget silently
163
+ * becomes unbounded.
164
+ * @param limits - the contract's limits.
165
+ * @param repairsSoFar - repairs already consumed.
166
+ * @param previous - what the previous attempt produced.
167
+ * @returns whether to repair, and how many repairs would then be consumed.
168
+ */
169
+ export function mayRepairTitle(limits, repairsSoFar, previous) {
170
+ if (previous.kind === 'proposed') {
171
+ return { repair: false, repairs: repairsSoFar };
172
+ }
173
+ if (repairsSoFar >= limits.maxRepairs) {
174
+ // Reported as an exhausted budget rather than as a failure to produce a title, so
175
+ // the caller can tell the two apart.
176
+ return {
177
+ repair: false,
178
+ repairs: repairsSoFar,
179
+ reason: `the repair budget of ${limits.maxRepairs} is exhausted; the last outcome was ${previous.kind}`,
180
+ };
181
+ }
182
+ return { repair: true, repairs: repairsSoFar + 1 };
183
+ }
184
+ /**
185
+ * Record one repair decision into the lineage (CODE-11, pure and testable).
186
+ * @param lineage - the lineage so far (mutated in place, then returned).
187
+ * @param decision - the `mayRepairTitle` decision for this attempt.
188
+ * @param previousKind - the previous outcome kind.
189
+ * @param budgetBefore - the budget the decision was made against.
190
+ * @returns the updated lineage.
191
+ */
192
+ export function recordRepairLineage(lineage, decision, previousKind, budgetBefore) {
193
+ const outcome = decision.repair
194
+ ? 'repaired'
195
+ : decision.repairs >= budgetBefore && previousKind !== 'proposed'
196
+ ? 'exhausted'
197
+ : 'not-needed';
198
+ lineage.push({
199
+ repairIndex: lineage.length + 1,
200
+ budgetBefore,
201
+ // The budget AFTER the decision is the budget before minus the one
202
+ // attempt a repair consumed — the lineage's own contract ("one lower
203
+ // when a repair ran"), never the consumed count relabelled.
204
+ budgetAfter: budgetBefore - (decision.repair ? 1 : 0),
205
+ previousKind,
206
+ outcome,
207
+ });
208
+ return lineage;
209
+ }
210
+ /**
211
+ * Whether a tool may call another tool to fulfil this contract (TOOL-06).
212
+ *
213
+ * It may not: "do not call another tool". Returns false so the prohibition is asserted,
214
+ * and the response shape carries no tool-call field for one to be dispatched from.
215
+ * @returns always false.
216
+ */
217
+ export function mayCallAnotherTool() {
218
+ return false;
219
+ }
220
+ /**
221
+ * Whether a language result may be cited as evidence for a medium (TOOL-03).
222
+ *
223
+ * A text detector's result is evidence about the TEXT it processed and nothing else.
224
+ * The requirement forbids using it as evidence of the language SPOKEN in audio it has
225
+ * not processed, and the refusal is per-medium rather than per-result because the result
226
+ * itself is sound — only its use as audio evidence is not.
227
+ * @param examined - what the result examined.
228
+ * @param claimed - the medium being claimed.
229
+ * @returns whether the claim is supported.
230
+ */
231
+ export function supportsLanguageClaim(examined, claimed) {
232
+ return examined === claimed;
233
+ }
234
+ /**
235
+ * Describe what a language result is evidence for (TOOL-03).
236
+ * @param examined - what the result examined.
237
+ * @returns a description that does not overstate the result.
238
+ */
239
+ export function describeLanguageEvidence(examined) {
240
+ return examined === 'text'
241
+ ? 'the language of the supplied text; this is not evidence of the language spoken in audio'
242
+ : 'the language of the supplied audio';
243
+ }
244
+ //# sourceMappingURL=title-proposal.js.map
@@ -0,0 +1,90 @@
1
+ /**
2
+ * The live Tool Inventory snapshot (plan §3.3).
3
+ *
4
+ * Inventory is deliberately NOT a projection: it reads the registry's model-facing
5
+ * schemas and the extension store's `describe()` live, so a tool that was never called
6
+ * still appears, and an installed-but-inactive extension's tools appear with their
7
+ * derived state instead of vanishing. Usage columns join from the report by name; a
8
+ * tool with no row is `never called` (zeros), never hidden.
9
+ *
10
+ * No payload reaches a row: the registry contributes name/description/argument count,
11
+ * never a schema body, and nothing here carries arguments, results, tokens or paths.
12
+ *
13
+ * @module @try-works/dsh-tool-mode/tool-inventory
14
+ */
15
+ import { type ToolKind, type ToolOrigin } from './tool-sources.ts';
16
+ /** What an inventory row says about availability. */
17
+ export type InventoryState = 'active' | 'prepared-cold' | 'failed';
18
+ /** One requirement fact the state derivation reads (structural subset of `ExtensionRequirement`). */
19
+ export interface InventoryRequirement {
20
+ readonly kind: string;
21
+ readonly satisfied: boolean;
22
+ }
23
+ /** One extension, as the store's `describe()` reports it (structural subset). */
24
+ export interface InventoryExtension {
25
+ readonly id: string;
26
+ readonly installed: boolean;
27
+ readonly active: boolean;
28
+ readonly tools: readonly string[];
29
+ /** Installed version, when the input carries it. */
30
+ readonly version?: string | null;
31
+ readonly requirements?: readonly InventoryRequirement[];
32
+ }
33
+ /** One registered tool's model-facing schema projection (structural subset of `ToolSchema`). */
34
+ export interface RegistryToolDescription {
35
+ readonly name: string;
36
+ readonly description: string;
37
+ readonly parameters: Readonly<Record<string, unknown>>;
38
+ }
39
+ /** The usage columns the report joins by name. */
40
+ export interface InventoryUsageRow {
41
+ readonly name: string;
42
+ readonly calls: number;
43
+ readonly errors: number;
44
+ readonly lastUsed: number | null;
45
+ }
46
+ /** Everything the snapshot needs. */
47
+ export interface InventoryInput {
48
+ readonly registry: readonly RegistryToolDescription[];
49
+ readonly extensions: readonly InventoryExtension[];
50
+ readonly usage: readonly InventoryUsageRow[];
51
+ /** Tool names the MCP export surface actually publishes. */
52
+ readonly mcpExposed: readonly string[];
53
+ /** User-authored tools, attributed to their owning profile record. */
54
+ readonly customTools?: readonly {
55
+ readonly name: string;
56
+ readonly id: string;
57
+ readonly title: string;
58
+ }[];
59
+ }
60
+ /** One inventory row. */
61
+ export interface ToolInventoryRow {
62
+ readonly name: string;
63
+ readonly description: string;
64
+ readonly owner: string;
65
+ readonly kind: ToolKind;
66
+ readonly origin: ToolOrigin;
67
+ readonly state: InventoryState;
68
+ /** The owning extension id, when an extension declares the tool. */
69
+ readonly extension: string | null;
70
+ readonly version: string | null;
71
+ /** Alias of {@link ToolInventoryRow.version} for the client's flat contract. */
72
+ readonly extensionVersion: string | null;
73
+ /** The implementation contract version, when the host knows one (not derivable from `describe()`). */
74
+ readonly contractVersion: string | null;
75
+ /** The number of declared argument properties, never the schema body. */
76
+ readonly argumentCount: number;
77
+ /** When the tool was last registered; null when the host cannot observe it. */
78
+ readonly lastRegistered: number | null;
79
+ readonly mcpExposed: boolean;
80
+ readonly calls: number;
81
+ readonly success: number;
82
+ readonly lastUsed: number | null;
83
+ }
84
+ /**
85
+ * Build the inventory snapshot.
86
+ * @param input - the live registry, store rows, usage join and MCP surface.
87
+ * @returns every row, sorted by name for a deterministic page.
88
+ */
89
+ export declare function buildToolInventory(input: InventoryInput): readonly ToolInventoryRow[];
90
+ //# sourceMappingURL=tool-inventory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-inventory.d.ts","sourceRoot":"","sources":["../src/tool-inventory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAoB,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEpF,qDAAqD;AACrD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,eAAe,GAAG,QAAQ,CAAA;AAElE,qGAAqG;AACrG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,oDAAoD;IACpD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,oBAAoB,EAAE,CA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,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B,gFAAgF;IAChF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,sGAAsG;IACtG,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IACvC,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,+EAA+E;IAC/E,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAkCD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,gBAAgB,EAAE,CAyDrF"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * The live Tool Inventory snapshot (plan §3.3).
3
+ *
4
+ * Inventory is deliberately NOT a projection: it reads the registry's model-facing
5
+ * schemas and the extension store's `describe()` live, so a tool that was never called
6
+ * still appears, and an installed-but-inactive extension's tools appear with their
7
+ * derived state instead of vanishing. Usage columns join from the report by name; a
8
+ * tool with no row is `never called` (zeros), never hidden.
9
+ *
10
+ * No payload reaches a row: the registry contributes name/description/argument count,
11
+ * never a schema body, and nothing here carries arguments, results, tokens or paths.
12
+ *
13
+ * @module @try-works/dsh-tool-mode/tool-inventory
14
+ */
15
+ import { resolveToolOwner } from "./tool-sources.js";
16
+ /** The number of top-level declared argument properties. */
17
+ function argumentCount(parameters) {
18
+ const properties = parameters['properties'];
19
+ if (typeof properties !== 'object' || properties === null || Array.isArray(properties))
20
+ return 0;
21
+ return Object.keys(properties).length;
22
+ }
23
+ /** Whether an installed extension has its declared assets prepared. */
24
+ function assetsReady(extension) {
25
+ return (extension.requirements ?? []).some(requirement => requirement.kind === 'assets' && requirement.satisfied);
26
+ }
27
+ /** Derive the availability state of an installed, unregistered extension tool. */
28
+ function extensionState(extension) {
29
+ if (extension.active)
30
+ return 'active';
31
+ return assetsReady(extension) ? 'prepared-cold' : 'failed';
32
+ }
33
+ /** Usage columns for a name, with never-called expressed as zeros and null. */
34
+ function usageFor(usage, name) {
35
+ const row = usage.get(name);
36
+ if (row === undefined)
37
+ return { calls: 0, success: 0, lastUsed: null };
38
+ return { calls: row.calls, success: Math.max(0, row.calls - row.errors), lastUsed: row.lastUsed };
39
+ }
40
+ /**
41
+ * Build the inventory snapshot.
42
+ * @param input - the live registry, store rows, usage join and MCP surface.
43
+ * @returns every row, sorted by name for a deterministic page.
44
+ */
45
+ export function buildToolInventory(input) {
46
+ const rows = new Map();
47
+ const usage = new Map(input.usage.map(row => [row.name, row]));
48
+ const exposed = new Set(input.mcpExposed);
49
+ const custom = new Map((input.customTools ?? []).map(tool => [tool.name, tool]));
50
+ for (const tool of input.registry) {
51
+ const customTool = custom.get(tool.name);
52
+ const owner = customTool === undefined
53
+ ? resolveToolOwner(tool.name, input.extensions)
54
+ : { owner: customTool.id, kind: 'custom', origin: 'custom' };
55
+ const extension = owner.kind === 'extension' ? input.extensions.find(candidate => candidate.id === owner.owner) : undefined;
56
+ rows.set(tool.name, {
57
+ name: tool.name,
58
+ description: tool.description,
59
+ owner: owner.owner,
60
+ kind: owner.kind,
61
+ origin: owner.origin,
62
+ state: 'active',
63
+ extension: extension?.id ?? null,
64
+ version: extension?.version ?? null,
65
+ extensionVersion: extension?.version ?? null,
66
+ contractVersion: null,
67
+ lastRegistered: null,
68
+ argumentCount: argumentCount(tool.parameters),
69
+ // model_tools is host-local by design; the surface can never expose it.
70
+ mcpExposed: tool.name !== 'model_tools' && exposed.has(tool.name),
71
+ ...usageFor(usage, tool.name),
72
+ });
73
+ }
74
+ for (const extension of input.extensions) {
75
+ if (!extension.installed)
76
+ continue;
77
+ for (const name of extension.tools) {
78
+ if (rows.has(name))
79
+ continue;
80
+ rows.set(name, {
81
+ name,
82
+ // The store reports tool NAMES, not their descriptions; inventing prose would
83
+ // be worse than the empty string the schema has no registry row for.
84
+ description: '',
85
+ owner: extension.id,
86
+ kind: 'extension',
87
+ origin: 'extension',
88
+ state: extensionState(extension),
89
+ extension: extension.id,
90
+ version: extension.version ?? null,
91
+ extensionVersion: extension.version ?? null,
92
+ contractVersion: null,
93
+ lastRegistered: null,
94
+ argumentCount: 0,
95
+ mcpExposed: name !== 'model_tools' && exposed.has(name),
96
+ ...usageFor(usage, name),
97
+ });
98
+ }
99
+ }
100
+ return [...rows.values()].sort((left, right) => left.name.localeCompare(right.name));
101
+ }
102
+ //# sourceMappingURL=tool-inventory.js.map