@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,280 @@
1
+ /**
2
+ * Binding the MCP surface to the real DSH tool registry (MCP-08, MCP-09, MCP-12).
3
+ *
4
+ * Two requirements shape this module, and both are about where data comes from
5
+ * rather than what it looks like:
6
+ *
7
+ * - **MCP-09**: DSH's model-facing `schemas()` projection INTENTIONALLY omits the
8
+ * output schema, so an export built from it would publish a tool with no declared
9
+ * result shape. The canonical schemas therefore come from the CONTRACTS, which is
10
+ * the only place that has them; `schemas()` is never consulted for a schema.
11
+ * - **MCP-08**: invocation goes through the host's `execute` path with a
12
+ * server-issued call identity and the caller's abort signal. Resolving a tool and
13
+ * calling it directly would bypass the grant, the receipt and the result policy —
14
+ * the three things the host path exists to apply — so this module is given an
15
+ * executor rather than a registry to reach into.
16
+ *
17
+ * §16.4 defines the payload derivation precisely: an implementation returns the
18
+ * domain payload with the reserved root `meta` OMITTED, and the payload schema is
19
+ * the final tool schema with only that property and its required entry removed.
20
+ * Everything else is preserved, because a schema that quietly dropped more would
21
+ * under-declare the result.
22
+ *
23
+ * @module @try-works/dsh-tool-mode/mcp/host-binding
24
+ */
25
+ import { Ajv } from 'ajv';
26
+ import Ajv2020 from 'ajv/dist/2020.js';
27
+ import { redactText } from "./../receipt.js";
28
+ import { normalizeCachePolicy } from "./protocol.js";
29
+ import { accountInvocation, classifyOutcome, PhaseTimer, } from "../invocation-accounting.js";
30
+ /** The reserved root field the host authors, never the implementation. */
31
+ const RESERVED_META = 'meta';
32
+ /**
33
+ * Two JSON-Schema dialects are in play: the host's contracts are draft-07 while
34
+ * extension-declared output schemas may declare 2020-12 (laya does). Compiling a
35
+ * 2020-12 schema with the draft-07 compiler throws "no schema with key or ref", which
36
+ * turned three LISTED tools into permanent call failures. The dialect is read from the
37
+ * schema's own `$schema`, never guessed.
38
+ */
39
+ const draft7 = new Ajv({ allErrors: true, strict: false, allowUnionTypes: true });
40
+ const draft2020 = new Ajv2020({ allErrors: true, strict: false, allowUnionTypes: true });
41
+ const payloadValidators = new Map();
42
+ /** The compiler that speaks the schema's declared dialect. */
43
+ function compilerFor(schema) {
44
+ const declared = schema?.$schema;
45
+ return typeof declared === 'string' && declared.includes('2020-12') ? draft2020 : draft7;
46
+ }
47
+ /**
48
+ * Derive the payload schema from a contract's final output schema (§16.4).
49
+ *
50
+ * Only the reserved `meta` property and its `required` entry are removed. The rest
51
+ * of the schema — including constraints on the remaining properties — is preserved
52
+ * verbatim, because removing anything else would advertise a looser result than the
53
+ * contract actually enforces.
54
+ * @param outputSchema - the contract's output schema, including `meta`.
55
+ * @returns the payload schema.
56
+ */
57
+ export function derivePayloadSchema(outputSchema) {
58
+ const clone = structuredClone(outputSchema);
59
+ if (typeof clone.properties === 'object' && clone.properties !== null) {
60
+ delete clone.properties[RESERVED_META];
61
+ }
62
+ if (Array.isArray(clone.required)) {
63
+ clone.required = clone.required.filter(entry => entry !== RESERVED_META);
64
+ }
65
+ return clone;
66
+ }
67
+ /** Render Ajv errors as bounded, path-qualified text. */
68
+ function renderValidationErrors(errors) {
69
+ return (errors ?? [])
70
+ .map(error => `${error.instancePath || '(root)'} ${error.message ?? 'is invalid'}`)
71
+ .slice(0, 8)
72
+ .join('; ');
73
+ }
74
+ /** Validator for the externally advertised payload schema. */
75
+ function payloadValidator(contract) {
76
+ const payloadSchema = derivePayloadSchema(contract.outputSchema);
77
+ /**
78
+ * Cache by the SCHEMA, not by `contract.contract`: an extension-published tool's
79
+ * contract is synthesized by the host and has no contract id, so every extension
80
+ * shared the key `undefined` and the FIRST compiled validator validated later calls.
81
+ * That is the cross-tool leak where multimodal_embed was rejected against
82
+ * decision_choose's schema.
83
+ */
84
+ const key = JSON.stringify(payloadSchema);
85
+ const existing = payloadValidators.get(key);
86
+ if (existing !== undefined)
87
+ return existing;
88
+ const validate = compilerFor(payloadSchema).compile(payloadSchema);
89
+ payloadValidators.set(key, validate);
90
+ return validate;
91
+ }
92
+ /**
93
+ * Convert a host result into the MCP payload shape and validate it.
94
+ *
95
+ * Host-native results may include the reserved `meta` envelope because the DSH tool contract
96
+ * validates that full value. MCP §16.4 publishes the payload schema with `meta` removed, so the
97
+ * external value must be the same payload with only that reserved field omitted. A malformed host
98
+ * result is returned as a tool error rather than a success-shaped `structuredContent`.
99
+ */
100
+ function payloadForMcp(contract, value) {
101
+ const payload = typeof value === 'object' && value !== null && !Array.isArray(value)
102
+ ? Object.fromEntries(Object.entries(value).filter(([key]) => key !== RESERVED_META))
103
+ : value;
104
+ const validate = payloadValidator(contract);
105
+ if (!validate(payload)) {
106
+ return { ok: false, reason: `tool result violates the advertised MCP output schema: ${renderValidationErrors(validate.errors)}` };
107
+ }
108
+ return { ok: true, value: payload };
109
+ }
110
+ /**
111
+ * Build the MCP host surface over a DSH tool surface.
112
+ *
113
+ * @param options - the host surface and this server's identity.
114
+ * @returns the MCP host the dispatch layer consumes.
115
+ */
116
+ export function createMcpHost(options) {
117
+ // P26-14: validate the configured policy before any request can read it. This keeps
118
+ // the private/0 default when unset and refuses a non-private scope / bad TTL.
119
+ const cachePolicy = normalizeCachePolicy(options.cachePolicy);
120
+ let counter = 0;
121
+ return {
122
+ serverInfo: options.serverInfo,
123
+ cachePolicy,
124
+ ...options.catalogFacts === undefined ? {} : { catalogFacts: options.catalogFacts },
125
+ listTools() {
126
+ const out = [];
127
+ for (const published of options.surface.published) {
128
+ // MCP-12: a tool that cannot be exported faithfully is withheld entirely,
129
+ // with its reason recorded. Exporting a partial tool would tell a client the
130
+ // tool exists and then fail in a way the client cannot interpret.
131
+ if (published.notExportableReason !== undefined) {
132
+ options.onWithheld?.(published);
133
+ continue;
134
+ }
135
+ out.push({
136
+ name: published.toolName,
137
+ description: published.contract.description,
138
+ // Both schemas come from the CONTRACT. `schemas()` omits output, so using
139
+ // it here would publish a tool with no declared result shape (MCP-09).
140
+ inputSchema: published.contract.inputSchema,
141
+ outputSchema: derivePayloadSchema(published.contract.outputSchema),
142
+ // Nothing in this binding imports from another MCP server, so no tool is
143
+ // a re-export (MCP-13).
144
+ importedFromMcp: false,
145
+ });
146
+ }
147
+ return out;
148
+ },
149
+ /**
150
+ * Why a known tool is absent from the catalog, when the host recorded it.
151
+ *
152
+ * `callTool` already explains a withheld name when it is reached directly; the
153
+ * dispatcher needs the same fact BEFORE it can decide the name is unknown, or
154
+ * the protocol layer turns the explanation into a generic invalid-params error.
155
+ * Confidential tools are deliberately omitted: their existence must not leak.
156
+ */
157
+ withheldReason(name) {
158
+ if (options.confidentialTools?.includes(name) === true)
159
+ return undefined;
160
+ return options.surface.withheld?.get(name);
161
+ },
162
+ async callTool(name, args, signal, caller) {
163
+ if (options.confidentialTools?.includes(name) === true) {
164
+ return {
165
+ structured: null,
166
+ text: `"${name}" is blocked by the operator confidentiality policy (MCP-11)`,
167
+ isError: true,
168
+ };
169
+ }
170
+ const definition = options.surface.published.find(tool => tool.toolName === name);
171
+ // A tool that is not EXPORTABLE must not be callable either. Looking only for
172
+ // its presence in `published` would let a client invoke by name exactly the
173
+ // tool the export deliberately withheld — defeating MCP-12 through the back
174
+ // door, since a client that guessed the name would get a partial result the
175
+ // export refused to promise.
176
+ if (definition === undefined || definition.notExportableReason !== undefined) {
177
+ // A name the host KNOWS but withheld explains itself; only a name it has
178
+ // never heard of may say "unknown tool" (slice 3).
179
+ const recorded = definition?.notExportableReason ?? options.surface.withheld?.get(name);
180
+ return {
181
+ structured: null,
182
+ text: recorded === undefined
183
+ ? `unknown tool ${JSON.stringify(name)}`
184
+ : `tool ${JSON.stringify(name)} is withheld: ${recorded}`,
185
+ isError: true,
186
+ };
187
+ }
188
+ /**
189
+ * ACCOUNTING, wrapped around the dispatch (OBS-02).
190
+ *
191
+ * The timer measures the external call's own phases and the outcome is classified
192
+ * from what was OBSERVED, not assumed — a cancelled external call must not be
193
+ * recorded as a failure, so the abort state is read from the caller's own signal.
194
+ * The CALLER'S grant identity rides the record (SEC-04): identity only, never the
195
+ * payload, so the operator can tell which client called.
196
+ */
197
+ const callId = `mcp_${Date.now().toString(36)}_${(++counter).toString(36)}`;
198
+ const timer = new PhaseTimer();
199
+ timer.begin('inference');
200
+ let outcome;
201
+ try {
202
+ outcome = await options.surface.execute({
203
+ name,
204
+ arguments: args,
205
+ signal,
206
+ // Server-issued, monotonically increasing. A caller-supplied identity would
207
+ // let a caller forge a receipt (BASE-05).
208
+ callId,
209
+ ...caller === undefined ? {} : { caller },
210
+ });
211
+ }
212
+ catch (error) {
213
+ options.onAccounted?.(accountInvocation({
214
+ receiptId: callId,
215
+ timings: timer.finish(),
216
+ failureClass: classifyOutcome({ ok: false, aborted: signal.aborted }),
217
+ reason: error instanceof Error ? redactText(error.message) : String(error),
218
+ input: args,
219
+ engineVersion: options.engineVersion ?? 'unknown',
220
+ ...caller === undefined ? {} : { grantId: caller.grantId, clientId: caller.clientId },
221
+ }), name);
222
+ throw error;
223
+ }
224
+ // CORRELATION (the round-65 review's finding): the contract payload's
225
+ // reserved meta carries the NATIVE receipt id the host dispatch issued, so
226
+ // the external accounting joins the native ring by that id when the result
227
+ // carries one — the two rings are no longer unjoinable. A value without
228
+ // meta (a tool that predates the meta contract) falls back to the
229
+ // server-issued id.
230
+ const nativeReceiptId = (() => {
231
+ const meta = outcome.value?.meta;
232
+ return typeof meta?.receiptId === 'string' ? meta.receiptId : callId;
233
+ })();
234
+ options.onAccounted?.(accountInvocation({
235
+ receiptId: nativeReceiptId,
236
+ timings: timer.finish(),
237
+ failureClass: classifyOutcome({
238
+ ok: outcome.isError !== true,
239
+ aborted: signal.aborted,
240
+ refused: outcome.isError === true,
241
+ }),
242
+ ...outcome.isError === true && outcome.message !== undefined ? { reason: redactText(outcome.message) } : {},
243
+ input: args,
244
+ // An error carries no result, so nothing crossed the boundary as output.
245
+ output: outcome.isError === true ? undefined : outcome.value,
246
+ engineVersion: options.engineVersion ?? 'unknown',
247
+ ...caller === undefined ? {} : { grantId: caller.grantId, clientId: caller.clientId },
248
+ }), name);
249
+ if (outcome.isError) {
250
+ return {
251
+ structured: null,
252
+ // Bounded by the dispatch layer when it becomes a tool-error result.
253
+ text: outcome.message ?? 'the tool failed without reporting a reason',
254
+ isError: true,
255
+ };
256
+ }
257
+ const payload = payloadForMcp(definition.contract, outcome.value ?? null);
258
+ if (!payload.ok) {
259
+ return { structured: null, text: payload.reason, isError: true };
260
+ }
261
+ return {
262
+ structured: payload.value,
263
+ text: renderBounded(payload.value),
264
+ };
265
+ },
266
+ };
267
+ }
268
+ /**
269
+ * Render a bounded, model-readable representation of a canonical value.
270
+ *
271
+ * Bounded because a result is copied into a model's context, and an unbounded
272
+ * rendering of a large value would consume it silently.
273
+ * @param value - the canonical value.
274
+ * @returns the text rendering.
275
+ */
276
+ function renderBounded(value) {
277
+ const text = typeof value === 'string' ? value : JSON.stringify(value ?? null);
278
+ return text.length > 100_000 ? `${text.slice(0, 100_000)}…(truncated)` : text;
279
+ }
280
+ //# sourceMappingURL=host-binding.js.map
@@ -0,0 +1,180 @@
1
+ /**
2
+ * The loopback HTTP transport (MCP-02, MCP-03, SEC-02, P26-05..P26-08, P26-15).
3
+ *
4
+ * `P26-15` is decisive about the shape of this: *"Plain unauthenticated loopback is
5
+ * not this product's default."* So the endpoint requires a credential, and because
6
+ * the OAuth 2.1 resource-server profile is NOT implemented, the credential is
7
+ * offered explicitly as **custom static-token authentication** and makes no OAuth
8
+ * conformance claim. The requirement permits that mode while forbidding the claim;
9
+ * implementing half of OAuth and calling it OAuth would be the failure it names.
10
+ *
11
+ * The handler is a pure function of a request description rather than a socket
12
+ * listener. Every security property here — the loopback check, Host and Origin
13
+ * validation, size limits, authentication — is then testable without binding a
14
+ * port, which matters because these are exactly the paths a socket-based test
15
+ * would leave to manual checking.
16
+ *
17
+ * @module @try-works/dsh-tool-mode/mcp/http
18
+ */
19
+ import type { McpHost } from './server.ts';
20
+ import { type LocalOAuthServer } from './oauth.ts';
21
+ import { type RateLimitPolicy } from './rate-limit.ts';
22
+ import { type ClientGrantConfig } from './client-grant.ts';
23
+ /** How the endpoint authenticates. */
24
+ export interface StaticTokenAuth {
25
+ /**
26
+ * The scheme this endpoint implements.
27
+ *
28
+ * Named `static-token` rather than `oauth` so nothing downstream can mistake it
29
+ * for the OAuth profile, and so a log or a status report that prints this value
30
+ * cannot imply a conformance that was never tested.
31
+ */
32
+ readonly scheme: 'static-token';
33
+ /** The accepted token, compared in constant time. */
34
+ readonly token: string;
35
+ /** The caller identity recorded for the grant, for receipts and audit. */
36
+ readonly clientId: string;
37
+ /**
38
+ * The durable credential store holding GENERATED static-token credentials (SEC-01).
39
+ *
40
+ * When present, a presented bearer token is also checked against the stored
41
+ * credentials (constant-time over the whole registry), and the matched client's
42
+ * OWN identity drives grants, receipts and rate limiting — never the configured
43
+ * primary `clientId`. Absent keeps the single-token behavior.
44
+ */
45
+ readonly registry?: import('./credential-store.ts').ClientCredentialStore;
46
+ }
47
+ /** The OAuth 2.1 resource-server scheme (P26-15). */
48
+ export interface OAuthResourceServerAuth {
49
+ /**
50
+ * The scheme this endpoint implements: the local embedded authorization server
51
+ * issues HS256 credentials and this endpoint verifies them per RFC 6750, with
52
+ * audience and scope validation and per-client revocation.
53
+ */
54
+ readonly scheme: 'oauth-resource-server';
55
+ /** The embedded server: verifier, issuer and revocation registry. */
56
+ readonly server: LocalOAuthServer;
57
+ /** The scope a caller must hold to reach the MCP endpoint. */
58
+ readonly requiredScope?: readonly string[];
59
+ }
60
+ /** The union of supported authentication schemes. */
61
+ export type HttpAuth = StaticTokenAuth | OAuthResourceServerAuth;
62
+ /** Transport configuration. */
63
+ export interface HttpTransportConfig {
64
+ /** Path the endpoint serves. */
65
+ readonly path: string;
66
+ /** Bind address; only a loopback address is admitted. */
67
+ readonly host: string;
68
+ /** Port. */
69
+ readonly port: number;
70
+ /** Maximum request body size in bytes (SEC-02). */
71
+ readonly maxBodyBytes: number;
72
+ /**
73
+ * Origins permitted to call from a browser.
74
+ *
75
+ * Empty by default, which refuses every browser origin. SEC-02 requires
76
+ * unapproved origins to be REJECTED, so an empty list is a working configuration
77
+ * rather than a missing one, and CORS is not used as authentication anywhere.
78
+ */
79
+ readonly allowedOrigins: readonly string[];
80
+ readonly auth: HttpAuth;
81
+ /**
82
+ * Per-client request rate limiting (AT-12).
83
+ *
84
+ * Absent means the DEFAULT policy applies — 60 requests per client per minute — so
85
+ * the transport is bounded by default rather than only when someone remembers to ask.
86
+ * A policy overrides the default; `false` disables limiting explicitly. The count is
87
+ * keyed on the AUTHENTICATED client identity (the static-token `clientId` or the OAuth
88
+ * subject), never on the socket address, and an unauthenticated request never moves a
89
+ * counter — counting auth failures would leak credential existence through 429 timing.
90
+ */
91
+ readonly rateLimit?: RateLimitPolicy | false;
92
+ /**
93
+ * Per-client external grants (SEC-04).
94
+ *
95
+ * After authentication, each client's grant is DERIVED here — from this
96
+ * configuration, the authenticated identity and the live published surface — and
97
+ * travels with the call as caller identity. Absent means the default: every client
98
+ * is granted exactly the live surface, recorded under its own `external:<clientId>`
99
+ * grant identity. A request body can never supply or extend a grant (BASE-05).
100
+ */
101
+ readonly grants?: ClientGrantConfig;
102
+ }
103
+ /** A conservative default: loopback, the illustrative port, a small body cap,
104
+ * and the default per-client rate limit (AT-12). */
105
+ export declare const DEFAULT_HTTP_CONFIG: Omit<HttpTransportConfig, 'auth'>;
106
+ /** One HTTP request, described rather than received. */
107
+ export interface HttpRequestDescription {
108
+ readonly method: string;
109
+ /** The request path, without query. */
110
+ readonly path: string;
111
+ /** Lower-cased header names to values. */
112
+ readonly headers: Readonly<Record<string, string | undefined>>;
113
+ /** The raw body. */
114
+ readonly body: string;
115
+ /** The peer address, as the socket reports it. */
116
+ readonly remoteAddress: string;
117
+ }
118
+ /** One HTTP response. */
119
+ export interface HttpResponseDescription {
120
+ readonly status: number;
121
+ readonly headers: Readonly<Record<string, string>>;
122
+ readonly body: string;
123
+ }
124
+ /** Whether an address is loopback. */
125
+ export declare function isLoopback(address: string): boolean;
126
+ /**
127
+ * Shared, guarded Fetch/stream core. The Node adapter's toNodeHandler is NOT
128
+ * used directly: its early 413 has a different wire envelope, it does not watch
129
+ * IncomingMessage.aborted, and its close/drain listeners are not removed.
130
+ * Use its official bounded Request conversion only AFTER our unchanged gate.
131
+ */
132
+ export declare function createHttpStreamHandler(config: HttpTransportConfig, host: McpHost): (request: HttpRequestDescription, signal?: AbortSignal) => Promise<Response>;
133
+ /** Finite, materializing test facade; production sockets use the stream core. */
134
+ export declare function createHttpHandler(config: HttpTransportConfig, host: McpHost): (request: HttpRequestDescription) => Promise<HttpResponseDescription>;
135
+ /**
136
+ * Whether this transport may claim OAuth conformance.
137
+ *
138
+ * The static-token scheme may not; the oauth-resource-server scheme may, because
139
+ * it verifies HS256 credentials, audience, expiry and scope against the embedded
140
+ * server and answers RFC 6750 challenges — a conformant subset, not an invention.
141
+ * The claim is per-DEPLOYMENT, which is what a status report needs: a host using
142
+ * static tokens must still report false.
143
+ * @param auth - the live auth configuration.
144
+ * @returns whether the live scheme may claim the OAuth 2.1 resource-server profile.
145
+ */
146
+ export declare function claimsOAuthConformance(auth: HttpAuth): boolean;
147
+ /**
148
+ * The authentication profile this transport reports.
149
+ *
150
+ * A machine-readable statement of what is actually implemented, so a client or an
151
+ * operator can tell custom authentication from the OAuth profile without reading
152
+ * the source.
153
+ * @param auth - the live auth configuration.
154
+ * @returns the auth profile description.
155
+ */
156
+ export declare function authProfile(auth: HttpAuth): Record<string, unknown>;
157
+ /** A bound endpoint. */
158
+ export interface BoundEndpoint {
159
+ /** The address actually bound, which for port 0 is the one the OS chose. */
160
+ readonly host: string;
161
+ readonly port: number;
162
+ /** The full URL clients should use. */
163
+ readonly url: string;
164
+ /** Stop serving and release the port. */
165
+ close(): Promise<void>;
166
+ }
167
+ /**
168
+ * Bind the endpoint on loopback.
169
+ *
170
+ * The bind address is validated rather than trusted: a configuration naming a
171
+ * routable address is REFUSED at startup rather than silently exposing the endpoint,
172
+ * because a server that logs a warning and binds anyway is a server that is exposed.
173
+ * @param config - the transport configuration.
174
+ * @param host - the MCP surface.
175
+ * @param options - an optional pre-built server module, so a test can drive a fake.
176
+ * @returns the bound endpoint.
177
+ * @throws Error when the bind address is not loopback.
178
+ */
179
+ export declare function startHttpServer(config: HttpTransportConfig, host: McpHost): Promise<BoundEndpoint>;
180
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/mcp/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAiBH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAG1C,OAAO,EAAoC,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACpF,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAsB,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE9E,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,uBAAuB,EAAE,qBAAqB,CAAA;CAC1E;AAED,qDAAqD;AACrD,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAA;IACxC,qEAAqE;IACrE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAA;IACjC,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC3C;AAED,qDAAqD;AACrD,MAAM,MAAM,QAAQ,GAAG,eAAe,GAAG,uBAAuB,CAAA;AAEhE,+BAA+B;AAC/B,MAAM,WAAW,mBAAmB;IAClC,gCAAgC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,YAAY;IACZ,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,mDAAmD;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1C,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;IACvB;;;;;;;;;OASG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,GAAG,KAAK,CAAA;IAC5C;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAA;CACpC;AAED;oDACoD;AACpD,eAAO,MAAM,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAOjE,CAAA;AAED,wDAAwD;AACxD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAA;IAC9D,oBAAoB;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,yBAAyB;AACzB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,sCAAsC;AACtC,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAMnD;AAwUD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,OAAO,GACZ,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAsB9E;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,OAAO,GACZ,CAAC,OAAO,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAUvE;AASD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBnE;AAED,wBAAwB;AACxB,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,uCAAuC;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AAiDD;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,aAAa,CAAC,CAwGxB"}