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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/README.md +299 -2
  2. package/bin/dsh-tool-mode-credentials.mjs +20 -0
  3. package/bin/dsh-tool-mode-mcp-stdio.mjs +80 -0
  4. package/bin/dsh-tool-mode.mjs +211 -0
  5. package/builtins.lock.json +26 -0
  6. package/catalog/desert-ant-models.json +693 -0
  7. package/catalog/playbooks.json +531 -0
  8. package/client/client.model-tools.js +1910 -0
  9. package/client/index.js +4039 -0
  10. package/cordis.patch.yml +39 -0
  11. package/lib/adapters/index.d.ts +61 -0
  12. package/lib/adapters/index.d.ts.map +1 -0
  13. package/lib/adapters/index.js +82 -0
  14. package/lib/adapters/types.d.ts +106 -0
  15. package/lib/adapters/types.d.ts.map +1 -0
  16. package/lib/adapters/types.js +85 -0
  17. package/lib/approval.d.ts +189 -0
  18. package/lib/approval.d.ts.map +1 -0
  19. package/lib/approval.js +510 -0
  20. package/lib/asset-acquisition.d.ts +149 -0
  21. package/lib/asset-acquisition.d.ts.map +1 -0
  22. package/lib/asset-acquisition.js +175 -0
  23. package/lib/authority.d.ts +185 -0
  24. package/lib/authority.d.ts.map +1 -0
  25. package/lib/authority.js +223 -0
  26. package/lib/bindings.d.ts +144 -0
  27. package/lib/bindings.d.ts.map +1 -0
  28. package/lib/bindings.js +314 -0
  29. package/lib/builtins.d.ts +27 -0
  30. package/lib/builtins.d.ts.map +1 -0
  31. package/lib/builtins.js +37 -0
  32. package/lib/capability.d.ts +58 -0
  33. package/lib/capability.d.ts.map +1 -0
  34. package/lib/capability.js +192 -0
  35. package/lib/capture-path.d.ts +97 -0
  36. package/lib/capture-path.d.ts.map +1 -0
  37. package/lib/capture-path.js +152 -0
  38. package/lib/catalog.d.ts +37 -0
  39. package/lib/catalog.d.ts.map +1 -0
  40. package/lib/catalog.js +274 -0
  41. package/lib/contract-payload.d.ts +39 -0
  42. package/lib/contract-payload.d.ts.map +1 -0
  43. package/lib/contract-payload.js +56 -0
  44. package/lib/custom-tools/compile.d.ts +25 -0
  45. package/lib/custom-tools/compile.d.ts.map +1 -0
  46. package/lib/custom-tools/compile.js +61 -0
  47. package/lib/custom-tools/composite-executor.d.ts +42 -0
  48. package/lib/custom-tools/composite-executor.d.ts.map +1 -0
  49. package/lib/custom-tools/composite-executor.js +113 -0
  50. package/lib/custom-tools/dispatch.d.ts +28 -0
  51. package/lib/custom-tools/dispatch.d.ts.map +1 -0
  52. package/lib/custom-tools/dispatch.js +34 -0
  53. package/lib/custom-tools/http-executor.d.ts +48 -0
  54. package/lib/custom-tools/http-executor.d.ts.map +1 -0
  55. package/lib/custom-tools/http-executor.js +241 -0
  56. package/lib/custom-tools/index.d.ts +12 -0
  57. package/lib/custom-tools/index.d.ts.map +1 -0
  58. package/lib/custom-tools/index.js +12 -0
  59. package/lib/custom-tools/mcp-surface.d.ts +14 -0
  60. package/lib/custom-tools/mcp-surface.d.ts.map +1 -0
  61. package/lib/custom-tools/mcp-surface.js +41 -0
  62. package/lib/custom-tools/prompt-executor.d.ts +39 -0
  63. package/lib/custom-tools/prompt-executor.d.ts.map +1 -0
  64. package/lib/custom-tools/prompt-executor.js +59 -0
  65. package/lib/custom-tools/registry.d.ts +69 -0
  66. package/lib/custom-tools/registry.d.ts.map +1 -0
  67. package/lib/custom-tools/registry.js +130 -0
  68. package/lib/custom-tools/schema.d.ts +26 -0
  69. package/lib/custom-tools/schema.d.ts.map +1 -0
  70. package/lib/custom-tools/schema.js +375 -0
  71. package/lib/custom-tools/service.d.ts +90 -0
  72. package/lib/custom-tools/service.d.ts.map +1 -0
  73. package/lib/custom-tools/service.js +203 -0
  74. package/lib/custom-tools/store.d.ts +61 -0
  75. package/lib/custom-tools/store.d.ts.map +1 -0
  76. package/lib/custom-tools/store.js +240 -0
  77. package/lib/custom-tools/types.d.ts +131 -0
  78. package/lib/custom-tools/types.d.ts.map +1 -0
  79. package/lib/custom-tools/types.js +11 -0
  80. package/lib/decision-combine.d.ts +113 -0
  81. package/lib/decision-combine.d.ts.map +1 -0
  82. package/lib/decision-combine.js +156 -0
  83. package/lib/decision-evaluate.d.ts +185 -0
  84. package/lib/decision-evaluate.d.ts.map +1 -0
  85. package/lib/decision-evaluate.js +227 -0
  86. package/lib/deployment-coordinator.d.ts +213 -0
  87. package/lib/deployment-coordinator.d.ts.map +1 -0
  88. package/lib/deployment-coordinator.js +274 -0
  89. package/lib/diagnostics.d.ts +169 -0
  90. package/lib/diagnostics.d.ts.map +1 -0
  91. package/lib/diagnostics.js +136 -0
  92. package/lib/discovery-contracts.d.ts +14 -0
  93. package/lib/discovery-contracts.d.ts.map +1 -0
  94. package/lib/discovery-contracts.js +90 -0
  95. package/lib/discovery-describe.d.ts +35 -0
  96. package/lib/discovery-describe.d.ts.map +1 -0
  97. package/lib/discovery-describe.js +99 -0
  98. package/lib/embedding-index.d.ts +55 -0
  99. package/lib/embedding-index.d.ts.map +1 -0
  100. package/lib/embedding-index.js +126 -0
  101. package/lib/extension-dependencies.d.ts +355 -0
  102. package/lib/extension-dependencies.d.ts.map +1 -0
  103. package/lib/extension-dependencies.js +987 -0
  104. package/lib/extension-dispatch.d.ts +150 -0
  105. package/lib/extension-dispatch.d.ts.map +1 -0
  106. package/lib/extension-dispatch.js +178 -0
  107. package/lib/extension-page-state.d.ts +69 -0
  108. package/lib/extension-page-state.d.ts.map +1 -0
  109. package/lib/extension-page-state.js +82 -0
  110. package/lib/extension-registrar.d.ts +116 -0
  111. package/lib/extension-registrar.d.ts.map +1 -0
  112. package/lib/extension-registrar.js +144 -0
  113. package/lib/extensions-api.d.ts +346 -0
  114. package/lib/extensions-api.d.ts.map +1 -0
  115. package/lib/extensions-api.js +17 -0
  116. package/lib/extensions-remote.d.ts +57 -0
  117. package/lib/extensions-remote.d.ts.map +1 -0
  118. package/lib/extensions-remote.js +69 -0
  119. package/lib/extensions-service.d.ts +568 -0
  120. package/lib/extensions-service.d.ts.map +1 -0
  121. package/lib/extensions-service.js +2507 -0
  122. package/lib/harness-budgets.d.ts +158 -0
  123. package/lib/harness-budgets.d.ts.map +1 -0
  124. package/lib/harness-budgets.js +152 -0
  125. package/lib/harness-llm.d.ts +138 -0
  126. package/lib/harness-llm.d.ts.map +1 -0
  127. package/lib/harness-llm.js +218 -0
  128. package/lib/harness-serving.d.ts +115 -0
  129. package/lib/harness-serving.d.ts.map +1 -0
  130. package/lib/harness-serving.js +176 -0
  131. package/lib/headless.d.ts +97 -0
  132. package/lib/headless.d.ts.map +1 -0
  133. package/lib/headless.js +407 -0
  134. package/lib/http-acquisition.d.ts +27 -0
  135. package/lib/http-acquisition.d.ts.map +1 -0
  136. package/lib/http-acquisition.js +140 -0
  137. package/lib/index.d.ts +546 -0
  138. package/lib/index.d.ts.map +1 -0
  139. package/lib/index.js +5197 -0
  140. package/lib/invocation-accounting.d.ts +169 -0
  141. package/lib/invocation-accounting.d.ts.map +1 -0
  142. package/lib/invocation-accounting.js +148 -0
  143. package/lib/jev.d.ts +218 -0
  144. package/lib/jev.d.ts.map +1 -0
  145. package/lib/jev.js +366 -0
  146. package/lib/legacy-migration.d.ts +95 -0
  147. package/lib/legacy-migration.d.ts.map +1 -0
  148. package/lib/legacy-migration.js +429 -0
  149. package/lib/license-basis.d.ts +29 -0
  150. package/lib/license-basis.d.ts.map +1 -0
  151. package/lib/license-basis.js +58 -0
  152. package/lib/managed-workers.d.ts +158 -0
  153. package/lib/managed-workers.d.ts.map +1 -0
  154. package/lib/managed-workers.js +269 -0
  155. package/lib/mcp/auth-selection.d.ts +35 -0
  156. package/lib/mcp/auth-selection.d.ts.map +1 -0
  157. package/lib/mcp/auth-selection.js +64 -0
  158. package/lib/mcp/client-grant.d.ts +89 -0
  159. package/lib/mcp/client-grant.d.ts.map +1 -0
  160. package/lib/mcp/client-grant.js +63 -0
  161. package/lib/mcp/credential-cli.d.ts +38 -0
  162. package/lib/mcp/credential-cli.d.ts.map +1 -0
  163. package/lib/mcp/credential-cli.js +148 -0
  164. package/lib/mcp/credential-store.d.ts +143 -0
  165. package/lib/mcp/credential-store.d.ts.map +1 -0
  166. package/lib/mcp/credential-store.js +461 -0
  167. package/lib/mcp/export-policy.d.ts +25 -0
  168. package/lib/mcp/export-policy.d.ts.map +1 -0
  169. package/lib/mcp/export-policy.js +31 -0
  170. package/lib/mcp/host-binding.d.ts +144 -0
  171. package/lib/mcp/host-binding.d.ts.map +1 -0
  172. package/lib/mcp/host-binding.js +280 -0
  173. package/lib/mcp/http.d.ts +180 -0
  174. package/lib/mcp/http.d.ts.map +1 -0
  175. package/lib/mcp/http.js +602 -0
  176. package/lib/mcp/oauth.d.ts +149 -0
  177. package/lib/mcp/oauth.d.ts.map +1 -0
  178. package/lib/mcp/oauth.js +396 -0
  179. package/lib/mcp/protocol.d.ts +329 -0
  180. package/lib/mcp/protocol.d.ts.map +1 -0
  181. package/lib/mcp/protocol.js +459 -0
  182. package/lib/mcp/rate-limit.d.ts +68 -0
  183. package/lib/mcp/rate-limit.d.ts.map +1 -0
  184. package/lib/mcp/rate-limit.js +114 -0
  185. package/lib/mcp/sdk-v2.d.ts +17 -0
  186. package/lib/mcp/sdk-v2.d.ts.map +1 -0
  187. package/lib/mcp/sdk-v2.js +204 -0
  188. package/lib/mcp/server.d.ts +149 -0
  189. package/lib/mcp/server.d.ts.map +1 -0
  190. package/lib/mcp/server.js +302 -0
  191. package/lib/mcp/stdio.d.ts +80 -0
  192. package/lib/mcp/stdio.d.ts.map +1 -0
  193. package/lib/mcp/stdio.js +184 -0
  194. package/lib/mcp/subscriptions.d.ts +177 -0
  195. package/lib/mcp/subscriptions.d.ts.map +1 -0
  196. package/lib/mcp/subscriptions.js +288 -0
  197. package/lib/mcp-status.d.ts +96 -0
  198. package/lib/mcp-status.d.ts.map +1 -0
  199. package/lib/mcp-status.js +70 -0
  200. package/lib/mcp-usage.d.ts +110 -0
  201. package/lib/mcp-usage.d.ts.map +1 -0
  202. package/lib/mcp-usage.js +189 -0
  203. package/lib/model-qualification.d.ts +192 -0
  204. package/lib/model-qualification.d.ts.map +1 -0
  205. package/lib/model-qualification.js +178 -0
  206. package/lib/planning.d.ts +256 -0
  207. package/lib/planning.d.ts.map +1 -0
  208. package/lib/planning.js +471 -0
  209. package/lib/playbook.d.ts +42 -0
  210. package/lib/playbook.d.ts.map +1 -0
  211. package/lib/playbook.js +65 -0
  212. package/lib/prepared-assets.d.ts +269 -0
  213. package/lib/prepared-assets.d.ts.map +1 -0
  214. package/lib/prepared-assets.js +471 -0
  215. package/lib/provider-bridge.d.ts +107 -0
  216. package/lib/provider-bridge.d.ts.map +1 -0
  217. package/lib/provider-bridge.js +423 -0
  218. package/lib/ptc-authority.d.ts +154 -0
  219. package/lib/ptc-authority.d.ts.map +1 -0
  220. package/lib/ptc-authority.js +242 -0
  221. package/lib/ptc-confinement.d.ts +60 -0
  222. package/lib/ptc-confinement.d.ts.map +1 -0
  223. package/lib/ptc-confinement.js +212 -0
  224. package/lib/ptc-runtime.d.ts +166 -0
  225. package/lib/ptc-runtime.d.ts.map +1 -0
  226. package/lib/ptc-runtime.js +231 -0
  227. package/lib/publication.d.ts +161 -0
  228. package/lib/publication.d.ts.map +1 -0
  229. package/lib/publication.js +181 -0
  230. package/lib/receipt-store.d.ts +57 -0
  231. package/lib/receipt-store.d.ts.map +1 -0
  232. package/lib/receipt-store.js +143 -0
  233. package/lib/receipt.d.ts +231 -0
  234. package/lib/receipt.d.ts.map +1 -0
  235. package/lib/receipt.js +165 -0
  236. package/lib/registrar.d.ts +75 -0
  237. package/lib/registrar.d.ts.map +1 -0
  238. package/lib/registrar.js +152 -0
  239. package/lib/resource-governance.d.ts +204 -0
  240. package/lib/resource-governance.d.ts.map +1 -0
  241. package/lib/resource-governance.js +213 -0
  242. package/lib/server-lifecycle.d.ts +175 -0
  243. package/lib/server-lifecycle.d.ts.map +1 -0
  244. package/lib/server-lifecycle.js +269 -0
  245. package/lib/skills.d.ts +31 -0
  246. package/lib/skills.d.ts.map +1 -0
  247. package/lib/skills.js +170 -0
  248. package/lib/speech-bridge.d.ts +74 -0
  249. package/lib/speech-bridge.d.ts.map +1 -0
  250. package/lib/speech-bridge.js +115 -0
  251. package/lib/state.d.ts +100 -0
  252. package/lib/state.d.ts.map +1 -0
  253. package/lib/state.js +160 -0
  254. package/lib/title-proposal.d.ts +194 -0
  255. package/lib/title-proposal.d.ts.map +1 -0
  256. package/lib/title-proposal.js +244 -0
  257. package/lib/tool-inventory.d.ts +90 -0
  258. package/lib/tool-inventory.d.ts.map +1 -0
  259. package/lib/tool-inventory.js +102 -0
  260. package/lib/tool-mode-run.d.ts +310 -0
  261. package/lib/tool-mode-run.d.ts.map +1 -0
  262. package/lib/tool-mode-run.js +411 -0
  263. package/lib/tool-sources.d.ts +80 -0
  264. package/lib/tool-sources.d.ts.map +1 -0
  265. package/lib/tool-sources.js +123 -0
  266. package/lib/tool-usage-projection.d.ts +390 -0
  267. package/lib/tool-usage-projection.d.ts.map +1 -0
  268. package/lib/tool-usage-projection.js +1038 -0
  269. package/lib/tool-usage-report.d.ts +153 -0
  270. package/lib/tool-usage-report.d.ts.map +1 -0
  271. package/lib/tool-usage-report.js +274 -0
  272. package/lib/transport.d.ts +158 -0
  273. package/lib/transport.d.ts.map +1 -0
  274. package/lib/transport.js +332 -0
  275. package/lib/types.d.ts +134 -0
  276. package/lib/types.d.ts.map +1 -0
  277. package/lib/types.js +8 -0
  278. package/lib/update-surface.d.ts +79 -0
  279. package/lib/update-surface.d.ts.map +1 -0
  280. package/lib/update-surface.js +224 -0
  281. package/lib/version.d.ts +3 -0
  282. package/lib/version.d.ts.map +1 -0
  283. package/lib/version.js +27 -0
  284. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts +13 -0
  285. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.d.ts.map +1 -0
  286. package/node_modules/@try-works/tool-mode-contracts/lib/contract-metadata.js +85 -0
  287. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts +16 -0
  288. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.d.ts.map +1 -0
  289. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/lang-detect.js +87 -0
  290. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts +38 -0
  291. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.d.ts.map +1 -0
  292. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/standard.js +445 -0
  293. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts +20 -0
  294. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.d.ts.map +1 -0
  295. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/stt-transcribe.js +112 -0
  296. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts +14 -0
  297. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.d.ts.map +1 -0
  298. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-embed.js +63 -0
  299. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts +14 -0
  300. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.d.ts.map +1 -0
  301. package/node_modules/@try-works/tool-mode-contracts/lib/contracts/text-rerank.js +76 -0
  302. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts +82 -0
  303. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.d.ts.map +1 -0
  304. package/node_modules/@try-works/tool-mode-contracts/lib/dsh.js +274 -0
  305. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts +26 -0
  306. package/node_modules/@try-works/tool-mode-contracts/lib/index.d.ts.map +1 -0
  307. package/node_modules/@try-works/tool-mode-contracts/lib/index.js +53 -0
  308. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts +133 -0
  309. package/node_modules/@try-works/tool-mode-contracts/lib/meta.d.ts.map +1 -0
  310. package/node_modules/@try-works/tool-mode-contracts/lib/meta.js +64 -0
  311. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts +121 -0
  312. package/node_modules/@try-works/tool-mode-contracts/lib/registry.d.ts.map +1 -0
  313. package/node_modules/@try-works/tool-mode-contracts/lib/registry.js +246 -0
  314. package/node_modules/@try-works/tool-mode-contracts/package.json +35 -0
  315. package/node_modules/@try-works/tool-mode-extension-sdk/bin/dsh-tool-mode.mjs +20 -0
  316. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts +80 -0
  317. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.d.ts.map +1 -0
  318. package/node_modules/@try-works/tool-mode-extension-sdk/lib/cli.js +533 -0
  319. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts +86 -0
  320. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.d.ts.map +1 -0
  321. package/node_modules/@try-works/tool-mode-extension-sdk/lib/declarative-recipes.js +145 -0
  322. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts +70 -0
  323. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.d.ts.map +1 -0
  324. package/node_modules/@try-works/tool-mode-extension-sdk/lib/discovery.js +201 -0
  325. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts +57 -0
  326. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.d.ts.map +1 -0
  327. package/node_modules/@try-works/tool-mode-extension-sdk/lib/errors.js +83 -0
  328. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts +33 -0
  329. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.d.ts.map +1 -0
  330. package/node_modules/@try-works/tool-mode-extension-sdk/lib/index.js +33 -0
  331. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts +86 -0
  332. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.d.ts.map +1 -0
  333. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/archive.js +191 -0
  334. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts +137 -0
  335. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.d.ts.map +1 -0
  336. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/dependencies.js +349 -0
  337. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts +274 -0
  338. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.d.ts.map +1 -0
  339. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/lifecycle.js +932 -0
  340. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts +210 -0
  341. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.d.ts.map +1 -0
  342. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/migration.js +368 -0
  343. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts +63 -0
  344. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.d.ts.map +1 -0
  345. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/runtime-link.js +149 -0
  346. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts +35 -0
  347. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.d.ts.map +1 -0
  348. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/source-directory.js +179 -0
  349. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts +179 -0
  350. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.d.ts.map +1 -0
  351. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/staged.js +299 -0
  352. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts +395 -0
  353. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.d.ts.map +1 -0
  354. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/store.js +839 -0
  355. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts +44 -0
  356. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.d.ts.map +1 -0
  357. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/tar-gzip-source.js +255 -0
  358. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts +185 -0
  359. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.d.ts.map +1 -0
  360. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/update-flow.js +504 -0
  361. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts +17 -0
  362. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.d.ts.map +1 -0
  363. package/node_modules/@try-works/tool-mode-extension-sdk/lib/install/zip-source.js +80 -0
  364. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts +221 -0
  365. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.d.ts.map +1 -0
  366. package/node_modules/@try-works/tool-mode-extension-sdk/lib/licensing.js +188 -0
  367. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts +52 -0
  368. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.d.ts.map +1 -0
  369. package/node_modules/@try-works/tool-mode-extension-sdk/lib/load.js +102 -0
  370. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts +171 -0
  371. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.d.ts.map +1 -0
  372. package/node_modules/@try-works/tool-mode-extension-sdk/lib/manifest.js +271 -0
  373. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts +242 -0
  374. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.d.ts.map +1 -0
  375. package/node_modules/@try-works/tool-mode-extension-sdk/lib/runtime.js +58 -0
  376. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts +128 -0
  377. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.d.ts.map +1 -0
  378. package/node_modules/@try-works/tool-mode-extension-sdk/lib/state.js +113 -0
  379. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts +41 -0
  380. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.d.ts.map +1 -0
  381. package/node_modules/@try-works/tool-mode-extension-sdk/lib/test-host.js +52 -0
  382. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts +2 -0
  383. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.d.ts.map +1 -0
  384. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker/worker-child.js +351 -0
  385. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts +157 -0
  386. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.d.ts.map +1 -0
  387. package/node_modules/@try-works/tool-mode-extension-sdk/lib/worker.js +688 -0
  388. package/node_modules/@try-works/tool-mode-extension-sdk/package.json +54 -0
  389. package/node_modules/@try-works/tool-mode-extension-sdk/schema/extension-manifest-1.1.0.schema.json +253 -0
  390. package/node_modules/@try-works/tool-mode-recipes/bin/tool-mode-recipe.mjs +15 -0
  391. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts +460 -0
  392. package/node_modules/@try-works/tool-mode-recipes/lib/broker.d.ts.map +1 -0
  393. package/node_modules/@try-works/tool-mode-recipes/lib/broker.js +647 -0
  394. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts +61 -0
  395. package/node_modules/@try-works/tool-mode-recipes/lib/cli.d.ts.map +1 -0
  396. package/node_modules/@try-works/tool-mode-recipes/lib/cli.js +1106 -0
  397. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts +237 -0
  398. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.d.ts.map +1 -0
  399. package/node_modules/@try-works/tool-mode-recipes/lib/dsh-adapter.js +205 -0
  400. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts +85 -0
  401. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.d.ts.map +1 -0
  402. package/node_modules/@try-works/tool-mode-recipes/lib/fixture-provider.js +176 -0
  403. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts +119 -0
  404. package/node_modules/@try-works/tool-mode-recipes/lib/images.d.ts.map +1 -0
  405. package/node_modules/@try-works/tool-mode-recipes/lib/images.js +201 -0
  406. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts +25 -0
  407. package/node_modules/@try-works/tool-mode-recipes/lib/index.d.ts.map +1 -0
  408. package/node_modules/@try-works/tool-mode-recipes/lib/index.js +25 -0
  409. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts +345 -0
  410. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.d.ts.map +1 -0
  411. package/node_modules/@try-works/tool-mode-recipes/lib/recipe-format.js +1465 -0
  412. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts +51 -0
  413. package/node_modules/@try-works/tool-mode-recipes/lib/templates.d.ts.map +1 -0
  414. package/node_modules/@try-works/tool-mode-recipes/lib/templates.js +310 -0
  415. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts +231 -0
  416. package/node_modules/@try-works/tool-mode-recipes/lib/titles.d.ts.map +1 -0
  417. package/node_modules/@try-works/tool-mode-recipes/lib/titles.js +435 -0
  418. package/node_modules/@try-works/tool-mode-recipes/package.json +56 -0
  419. package/node_modules/@try-works/tool-mode-recipes/recipes/describe-image.json +38 -0
  420. package/node_modules/@try-works/tool-mode-recipes/recipes/text-title.json +45 -0
  421. package/node_modules/@try-works/tool-mode-recipes/schema/harness-model-recipe.schema.json +273 -0
  422. package/package.json +127 -4
  423. package/remote/spec.mjs +993 -0
  424. package/remote/typert.host.mjs +14 -0
  425. package/remote/typert.remote-client.mjs +16 -0
@@ -0,0 +1,169 @@
1
+ /**
2
+ * Invocation accounting: timings, outcome class and sizes (OBS-01, OBS-05).
3
+ *
4
+ * The receipt already carries identity — contract, implementation, extension version,
5
+ * content digest, activation generation, caller scope. OBS-01 asks for four things it did
6
+ * not have:
7
+ *
8
+ * - **queue / load / inference / total time**, separated, because a slow call has three
9
+ * very different causes and a single duration cannot tell them apart;
10
+ * - **a cancellation/failure CLASS**, so an operations reader can group failures rather
11
+ * than reading prose;
12
+ * - **sizes**, measured rather than estimated;
13
+ * - and all of it **without credentials or bodies**, which is why the sizes are NUMBERS
14
+ * and there is deliberately nowhere to put a payload.
15
+ *
16
+ * The last point is the design constraint rather than a disclaimer: this module has no
17
+ * field that can hold request or response content, so a future change cannot start logging
18
+ * bodies by accident. A `Record<string, unknown>` "details" bag would have undone that in
19
+ * one commit.
20
+ *
21
+ * OBS-05 is the other half: what is recorded is MEASURED, with the runtime that measured
22
+ * it, so a vendor's published figure can never be mistaken for this machine's.
23
+ *
24
+ * @module @try-works/dsh-tool-mode/invocation-accounting
25
+ */
26
+ /**
27
+ * Why an invocation ended.
28
+ *
29
+ * Deliberately coarse and closed: a reader groups by these, and an open string would make
30
+ * every dashboard a list of one-off messages.
31
+ */
32
+ export type FailureClass =
33
+ /** The call completed. */
34
+ 'none'
35
+ /** The caller cancelled, or an imported signal aborted. */
36
+ | 'cancelled'
37
+ /** Policy or the contract refused before work began. */
38
+ | 'refused'
39
+ /** A deadline expired. */
40
+ | 'timeout'
41
+ /** An extension or provider failed. */
42
+ | 'failed'
43
+ /** Authorization denied. */
44
+ | 'policy-denied';
45
+ /** Where the time went, in milliseconds. */
46
+ export interface InvocationTimings {
47
+ /**
48
+ * Time waiting for admission — a queue, a pool, or a load already in flight.
49
+ *
50
+ * Separated from load time because "the model is already loading for someone else" and
51
+ * "the model is slow to load" are different problems with different fixes.
52
+ */
53
+ readonly queuedMs: number;
54
+ /** Time spent preparing or loading, when the invocation had to. */
55
+ readonly loadMs: number;
56
+ /** Time the implementation spent on the work itself. */
57
+ readonly inferenceMs: number;
58
+ /**
59
+ * Wall time from admission attempt to result.
60
+ *
61
+ * NOT asserted equal to the sum: phases can overlap, and forcing equality would make the
62
+ * record wrong whenever they do.
63
+ */
64
+ readonly totalMs: number;
65
+ }
66
+ /** Byte sizes, measured rather than estimated. */
67
+ export interface InvocationSizes {
68
+ /** Serialized request size in bytes. */
69
+ readonly inputBytes: number;
70
+ /** Serialized result size in bytes. */
71
+ readonly outputBytes: number;
72
+ /** Bytes read from assets during this invocation, when any were. */
73
+ readonly assetBytes: number;
74
+ }
75
+ /** The runtime that produced the measurements (OBS-05). */
76
+ export interface MeasurementContext {
77
+ /** Platform, e.g. `win32`. */
78
+ readonly platform: string;
79
+ /** Architecture, e.g. `x64`. */
80
+ readonly architecture: string;
81
+ /** Node version. */
82
+ readonly nodeVersion: string;
83
+ /** The engine or runtime version actually used. */
84
+ readonly engineVersion: string;
85
+ }
86
+ /** One invocation's accounting record. */
87
+ export interface InvocationAccounting {
88
+ /** Correlation id, matching the receipt. */
89
+ readonly receiptId: string;
90
+ readonly timings: InvocationTimings;
91
+ readonly sizes: InvocationSizes;
92
+ readonly failureClass: FailureClass;
93
+ /** A short class-level reason, never a payload. */
94
+ readonly reason: string | null;
95
+ /**
96
+ * How the timings were obtained.
97
+ *
98
+ * `measured` for this process's own clock; the alternative exists so an imported figure
99
+ * can never be presented as one taken here.
100
+ */
101
+ readonly timingSource: 'measured' | 'reported-by-implementation';
102
+ /** The runtime the measurement belongs to. */
103
+ readonly measuredOn: MeasurementContext;
104
+ /**
105
+ * The CALLER'S grant identity, present only for external MCP calls (SEC-04).
106
+ *
107
+ * Identity, never payload: the operator can tell WHICH client called, while the
108
+ * record still has no field that can hold request or response content.
109
+ */
110
+ readonly grantId?: string;
111
+ /** The authenticated client identity, present with {@link grantId}. */
112
+ readonly clientId?: string;
113
+ }
114
+ /**
115
+ * A phase timer.
116
+ *
117
+ * Records the phases as they HAPPEN rather than inferring them afterwards, because a
118
+ * duration measured by subtraction cannot distinguish a slow load from a slow queue.
119
+ */
120
+ export declare class PhaseTimer {
121
+ #private;
122
+ constructor(now?: () => number);
123
+ /** Begin a phase, closing any phase already open. */
124
+ begin(name: 'queued' | 'load' | 'inference'): void;
125
+ /** Close the open phase, if any. Idempotent. */
126
+ end(): void;
127
+ /** The timings recorded so far. */
128
+ finish(): InvocationTimings;
129
+ }
130
+ /** Classify an outcome from what was observed (OBS-01). */
131
+ export declare function classifyOutcome(input: {
132
+ readonly ok: boolean;
133
+ readonly aborted?: boolean;
134
+ readonly timedOut?: boolean;
135
+ readonly denied?: boolean;
136
+ readonly refused?: boolean;
137
+ }): FailureClass;
138
+ /**
139
+ * The runtime this process is measuring on (OBS-05).
140
+ *
141
+ * Read from the process rather than configured, so a record cannot claim a platform it was
142
+ * not produced on. That is the specific defect OBS-05 names: Apple Neural Engine figures
143
+ * presented as Windows performance.
144
+ * @param engineVersion - the engine actually used for this invocation.
145
+ * @returns the measurement context.
146
+ */
147
+ export declare function measurementContext(engineVersion: string): MeasurementContext;
148
+ /**
149
+ * Build an accounting record (OBS-01).
150
+ *
151
+ * Sizes are computed from the SERIALIZED forms because that is what crossed the boundary;
152
+ * an object's in-memory size is not what a caller paid for.
153
+ * @param request - what to record.
154
+ * @returns the accounting record.
155
+ */
156
+ export declare function accountInvocation(request: {
157
+ readonly receiptId: string;
158
+ readonly timings: InvocationTimings;
159
+ readonly failureClass: FailureClass;
160
+ readonly reason?: string;
161
+ readonly input: unknown;
162
+ readonly output?: unknown;
163
+ readonly assetBytes?: number;
164
+ readonly engineVersion: string;
165
+ /** The external caller's grant identity, when the call was external (SEC-04). */
166
+ readonly grantId?: string;
167
+ readonly clientId?: string;
168
+ }): InvocationAccounting;
169
+ //# sourceMappingURL=invocation-accounting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invocation-accounting.d.ts","sourceRoot":"","sources":["../src/invocation-accounting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY;AACtB,0BAA0B;AACxB,MAA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AM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,iFAAiF;IACjF,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,oBAAoB,CAmBvB"}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Invocation accounting: timings, outcome class and sizes (OBS-01, OBS-05).
3
+ *
4
+ * The receipt already carries identity — contract, implementation, extension version,
5
+ * content digest, activation generation, caller scope. OBS-01 asks for four things it did
6
+ * not have:
7
+ *
8
+ * - **queue / load / inference / total time**, separated, because a slow call has three
9
+ * very different causes and a single duration cannot tell them apart;
10
+ * - **a cancellation/failure CLASS**, so an operations reader can group failures rather
11
+ * than reading prose;
12
+ * - **sizes**, measured rather than estimated;
13
+ * - and all of it **without credentials or bodies**, which is why the sizes are NUMBERS
14
+ * and there is deliberately nowhere to put a payload.
15
+ *
16
+ * The last point is the design constraint rather than a disclaimer: this module has no
17
+ * field that can hold request or response content, so a future change cannot start logging
18
+ * bodies by accident. A `Record<string, unknown>` "details" bag would have undone that in
19
+ * one commit.
20
+ *
21
+ * OBS-05 is the other half: what is recorded is MEASURED, with the runtime that measured
22
+ * it, so a vendor's published figure can never be mistaken for this machine's.
23
+ *
24
+ * @module @try-works/dsh-tool-mode/invocation-accounting
25
+ */
26
+ /**
27
+ * A phase timer.
28
+ *
29
+ * Records the phases as they HAPPEN rather than inferring them afterwards, because a
30
+ * duration measured by subtraction cannot distinguish a slow load from a slow queue.
31
+ */
32
+ export class PhaseTimer {
33
+ #start;
34
+ #phases = new Map();
35
+ #current = null;
36
+ constructor(now = Date.now) {
37
+ this.#now = now;
38
+ this.#start = now();
39
+ }
40
+ #now;
41
+ /** Begin a phase, closing any phase already open. */
42
+ begin(name) {
43
+ this.end();
44
+ this.#current = { name, startedAt: this.#now() };
45
+ }
46
+ /** Close the open phase, if any. Idempotent. */
47
+ end() {
48
+ if (this.#current === null)
49
+ return;
50
+ const elapsed = this.#now() - this.#current.startedAt;
51
+ // Phases ACCUMULATE: a call may load, infer, and resume the same phase after a retry.
52
+ this.#phases.set(this.#current.name, (this.#phases.get(this.#current.name) ?? 0) + elapsed);
53
+ this.#current = null;
54
+ }
55
+ /** The timings recorded so far. */
56
+ finish() {
57
+ this.end();
58
+ return {
59
+ queuedMs: this.#phases.get('queued') ?? 0,
60
+ loadMs: this.#phases.get('load') ?? 0,
61
+ inferenceMs: this.#phases.get('inference') ?? 0,
62
+ totalMs: this.#now() - this.#start,
63
+ };
64
+ }
65
+ }
66
+ /** Classify an outcome from what was observed (OBS-01). */
67
+ export function classifyOutcome(input) {
68
+ /**
69
+ * ORDER MATTERS, and it is the caller's intent that wins.
70
+ *
71
+ * A deadline that fires will usually also surface as an abort, so checking `aborted`
72
+ * first would report every timeout as a cancellation and hide the deadline. Likewise a
73
+ * denial is a policy decision rather than a failure of the work.
74
+ */
75
+ if (input.ok)
76
+ return 'none';
77
+ if (input.denied === true)
78
+ return 'policy-denied';
79
+ if (input.refused === true)
80
+ return 'refused';
81
+ if (input.timedOut === true)
82
+ return 'timeout';
83
+ if (input.aborted === true)
84
+ return 'cancelled';
85
+ return 'failed';
86
+ }
87
+ /**
88
+ * The runtime this process is measuring on (OBS-05).
89
+ *
90
+ * Read from the process rather than configured, so a record cannot claim a platform it was
91
+ * not produced on. That is the specific defect OBS-05 names: Apple Neural Engine figures
92
+ * presented as Windows performance.
93
+ * @param engineVersion - the engine actually used for this invocation.
94
+ * @returns the measurement context.
95
+ */
96
+ export function measurementContext(engineVersion) {
97
+ return {
98
+ platform: process.platform,
99
+ architecture: process.arch,
100
+ nodeVersion: process.version,
101
+ engineVersion,
102
+ };
103
+ }
104
+ /**
105
+ * Build an accounting record (OBS-01).
106
+ *
107
+ * Sizes are computed from the SERIALIZED forms because that is what crossed the boundary;
108
+ * an object's in-memory size is not what a caller paid for.
109
+ * @param request - what to record.
110
+ * @returns the accounting record.
111
+ */
112
+ export function accountInvocation(request) {
113
+ return {
114
+ receiptId: request.receiptId,
115
+ timings: request.timings,
116
+ sizes: {
117
+ inputBytes: byteLengthOf(request.input),
118
+ // An absent output is ZERO bytes rather than unknown: nothing crossed the boundary,
119
+ // and reporting `null` would invite a reader to treat it as unmeasured.
120
+ outputBytes: request.output === undefined ? 0 : byteLengthOf(request.output),
121
+ assetBytes: request.assetBytes ?? 0,
122
+ },
123
+ failureClass: request.failureClass,
124
+ reason: request.reason ?? null,
125
+ timingSource: 'measured',
126
+ measuredOn: measurementContext(request.engineVersion),
127
+ ...request.grantId === undefined
128
+ ? {}
129
+ : { grantId: request.grantId, ...request.clientId === undefined ? {} : { clientId: request.clientId } },
130
+ };
131
+ }
132
+ /** Serialized byte length, with a defined answer for values that cannot serialize. */
133
+ function byteLengthOf(value) {
134
+ try {
135
+ const serialized = JSON.stringify(value);
136
+ // `undefined` and functions serialize to `undefined`, which is zero bytes on the wire.
137
+ return serialized === undefined ? 0 : Buffer.byteLength(serialized, 'utf8');
138
+ }
139
+ catch {
140
+ /**
141
+ * A cyclic or otherwise unserializable value did cross the boundary, but its size is
142
+ * unknown — and reporting `0` would understate it. Recorded as `-1`, which no real
143
+ * payload can produce, so a reader sees "unmeasured" rather than "empty".
144
+ */
145
+ return -1;
146
+ }
147
+ }
148
+ //# sourceMappingURL=invocation-accounting.js.map
package/lib/jev.d.ts ADDED
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Remote Jev (TypeSafe System One) adapter (TOOL-02, DEC-07).
3
+ *
4
+ * Jev is a remote typed-question service, not a local checkpoint and not a chat
5
+ * endpoint. This module speaks its native `systemOne` request/response shape and
6
+ * converts a choice answer onto the standard `decision.choose` result. The
7
+ * conversion is VERSIONED and tested; an invalid probability set or an unknown
8
+ * choice is an error, never an abstention.
9
+ *
10
+ * @module @try-works/dsh-tool-mode/jev
11
+ */
12
+ /** The version of the native-to-standard conversion this build implements. */
13
+ export declare const JEV_CONVERSION_VERSION = "1.0.0";
14
+ /** A configuration or transport failure; never carries the API key or response body. */
15
+ export declare class JevError extends Error {
16
+ /** Stable failure class. */
17
+ readonly code: string;
18
+ /** HTTP status, when the failure came from a response. */
19
+ readonly status?: number;
20
+ constructor(code: string, message: string, status?: number);
21
+ }
22
+ /** The standard `decision.choose` result. */
23
+ export interface JevChoiceResult {
24
+ /** Zero-based index into the caller's option list. */
25
+ readonly chosen: number;
26
+ /** Bucket over the uncalibrated probability mass. */
27
+ readonly confidence: 'confident' | 'likely' | 'tentative';
28
+ /** Human-readable reason naming the option and its uncalibrated probability. */
29
+ readonly reason: string;
30
+ }
31
+ /** The remote request one choice becomes. */
32
+ export interface JevChoiceRequest {
33
+ readonly model: string;
34
+ readonly state: {
35
+ readonly decision: string;
36
+ };
37
+ readonly questions: {
38
+ readonly choice: {
39
+ readonly type: 'choice';
40
+ readonly instructions: string;
41
+ readonly criteria: Readonly<Record<string, string>>;
42
+ };
43
+ };
44
+ }
45
+ /** Configuration for one Jev client. */
46
+ export interface JevConfig {
47
+ readonly enabled?: boolean;
48
+ readonly apiKey?: string;
49
+ readonly apiKeyEnv?: string;
50
+ readonly credentialRef?: string;
51
+ readonly baseURL?: string;
52
+ readonly model?: string;
53
+ }
54
+ /** Configuration for one Jev client. */
55
+ export interface JevClientConfig {
56
+ readonly apiKey: string;
57
+ /** API root ending before `/v1/systemone`. */
58
+ readonly baseURL?: string;
59
+ /** Pinned model id, e.g. `jev-1.14`. */
60
+ readonly model?: string;
61
+ readonly timeoutMs?: number;
62
+ /** Injected transport for tests; defaults to the global fetch. */
63
+ readonly fetch?: typeof fetch;
64
+ }
65
+ /** The default TypeSafe API root (the `/v1/systemone` path is appended). */
66
+ export declare const JEV_DEFAULT_BASE_URL = "https://api.typesafe.ai";
67
+ /** The default pinned model; callers may pin another documented model. */
68
+ export declare const JEV_DEFAULT_MODEL = "jev-1.14";
69
+ /** Convert a probability mass to the standard bucket. */
70
+ export declare function confidenceBucket(mass: number): 'confident' | 'likely' | 'tentative';
71
+ /**
72
+ * Build the native request for a choice.
73
+ * @param decision - the decision text.
74
+ * @param options - 2–16 distinct nonempty labels.
75
+ * @param model - the pinned model id.
76
+ * @returns the native request body.
77
+ */
78
+ export declare function buildJevChoiceRequest(decision: string, options: readonly string[], model?: string): JevChoiceRequest;
79
+ /**
80
+ * Convert a native response payload to the standard result.
81
+ * @param payload - the parsed JSON response.
82
+ * @param options - the caller's option labels, in order.
83
+ * @returns the standard result.
84
+ */
85
+ export declare function convertJevChoiceResponse(payload: unknown, options: readonly string[]): JevChoiceResult;
86
+ /**
87
+ * Ask Jev one choice question through its native API.
88
+ * @param decision - the decision text.
89
+ * @param options - the caller's labels.
90
+ * @param config - API key, base URL, model and optional transport.
91
+ * @param signal - cancellation.
92
+ * @returns the standard result.
93
+ */
94
+ export declare function chooseWithJev(decision: string, options: readonly string[], config: JevClientConfig, signal?: AbortSignal): Promise<JevChoiceResult>;
95
+ /** One atomic judgment question in the native multi-question shape. */
96
+ export type JevJudgmentQuestion = {
97
+ readonly id: string;
98
+ readonly type: 'boolean';
99
+ readonly proposition: string;
100
+ } | {
101
+ readonly id: string;
102
+ readonly type: 'choice';
103
+ readonly instructions: string;
104
+ readonly criteria: Readonly<Record<string, string>>;
105
+ };
106
+ /** Native answers returned for a batch of independent judgments. */
107
+ export interface JevJudgmentsResult {
108
+ readonly model: string;
109
+ readonly judgments: Readonly<Record<string, Record<string, unknown>>>;
110
+ }
111
+ /** Build the native multi-question request. */
112
+ export declare function buildJevJudgmentsRequest(state: unknown, questions: readonly JevJudgmentQuestion[], model?: string): {
113
+ readonly model: string;
114
+ readonly state: unknown;
115
+ readonly questions: Record<string, unknown>;
116
+ };
117
+ /** Convert the native batch response; missing or invalid answers are errors. */
118
+ export declare function convertJevJudgmentsResponse(payload: unknown, questions: readonly JevJudgmentQuestion[]): JevJudgmentsResult;
119
+ /**
120
+ * Ask independent atomic judgments in ONE native request.
121
+ * @param state - the same state for every question.
122
+ * @param questions - 1–16 independent questions.
123
+ * @param config - API key, base URL, model and optional transport.
124
+ * @param signal - cancellation.
125
+ * @returns native judgments keyed by question id.
126
+ */
127
+ export declare function judgeWithJev(state: unknown, questions: readonly JevJudgmentQuestion[], config: JevClientConfig, signal?: AbortSignal): Promise<JevJudgmentsResult>;
128
+ /** The MCP contract for the atomic judgment batch. */
129
+ export declare const JEV_JUDGMENTS_CONTRACT: {
130
+ readonly contract: "decision.judgments.jev";
131
+ readonly version: "1.0.0";
132
+ readonly toolName: "decision_judgments_jev";
133
+ readonly description: "Ask independent atomic boolean/choice questions through Jev in one native request.";
134
+ readonly inputSchema: {
135
+ readonly type: "object";
136
+ readonly additionalProperties: false;
137
+ readonly required: readonly ["state", "questions"];
138
+ readonly properties: {
139
+ readonly state: {
140
+ readonly type: "object";
141
+ readonly additionalProperties: true;
142
+ };
143
+ readonly questions: {
144
+ readonly type: "array";
145
+ readonly items: {
146
+ readonly type: "object";
147
+ readonly additionalProperties: true;
148
+ };
149
+ };
150
+ };
151
+ };
152
+ readonly outputSchema: {
153
+ readonly type: "object";
154
+ readonly additionalProperties: false;
155
+ readonly required: readonly ["model", "judgments"];
156
+ readonly properties: {
157
+ readonly model: {
158
+ readonly type: "string";
159
+ };
160
+ readonly judgments: {
161
+ readonly type: "object";
162
+ readonly additionalProperties: true;
163
+ };
164
+ };
165
+ };
166
+ readonly semantics: {
167
+ readonly deterministic: false;
168
+ readonly readsInputs: true;
169
+ };
170
+ readonly limits: {};
171
+ readonly unsupported: readonly ["no local Jev weights", "no chat schema"];
172
+ };
173
+ /** The MCP contract for the single-choice Jev tool. */
174
+ export declare const JEV_CHOOSE_CONTRACT: {
175
+ readonly contract: "decision.choose.jev";
176
+ readonly version: "1.0.0";
177
+ readonly toolName: "decision_choose_jev";
178
+ readonly description: "Choose 2–16 options through the remote Jev typed-question API on the standard decision result.";
179
+ readonly inputSchema: {
180
+ readonly type: "object";
181
+ readonly additionalProperties: false;
182
+ readonly required: readonly ["decision", "options"];
183
+ readonly properties: {
184
+ readonly decision: {
185
+ readonly type: "string";
186
+ };
187
+ readonly options: {
188
+ readonly type: "array";
189
+ readonly items: {
190
+ readonly type: "string";
191
+ };
192
+ };
193
+ };
194
+ };
195
+ readonly outputSchema: {
196
+ readonly type: "object";
197
+ readonly additionalProperties: false;
198
+ readonly required: readonly ["chosen", "confidence", "reason"];
199
+ readonly properties: {
200
+ readonly chosen: {
201
+ readonly type: "integer";
202
+ };
203
+ readonly confidence: {
204
+ readonly type: "string";
205
+ readonly enum: readonly ["confident", "likely", "tentative"];
206
+ };
207
+ readonly reason: {
208
+ readonly type: "string";
209
+ };
210
+ };
211
+ };
212
+ readonly semantics: {
213
+ readonly deterministic: false;
214
+ readonly readsInputs: true;
215
+ };
216
+ readonly limits: {};
217
+ };
218
+ //# sourceMappingURL=jev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jev.d.ts","sourceRoot":"","sources":["../src/jev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,UAAU,CAAA;AAE7C,wFAAwF;AACxF,qBAAa,QAAS,SAAQ,KAAK;IACjC,4BAA4B;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,0DAA0D;IAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;gBACZ,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAM3D;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAA;IACzD,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,6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