@sentropic/h2a-cli 0.75.0 → 0.79.0

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 (350) hide show
  1. package/dist/index.d.ts +1 -37
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -41
  4. package/dist/index.js.map +1 -1
  5. package/package.json +4 -15
  6. package/dist/bin.d.ts +0 -3
  7. package/dist/bin.d.ts.map +0 -1
  8. package/dist/bin.js +0 -83
  9. package/dist/bin.js.map +0 -1
  10. package/dist/cli-contract.d.ts +0 -62
  11. package/dist/cli-contract.d.ts.map +0 -1
  12. package/dist/cli-contract.js +0 -794
  13. package/dist/cli-contract.js.map +0 -1
  14. package/dist/cli.d.ts +0 -254
  15. package/dist/cli.d.ts.map +0 -1
  16. package/dist/cli.js +0 -4672
  17. package/dist/cli.js.map +0 -1
  18. package/dist/hosts/agy.d.ts +0 -14
  19. package/dist/hosts/agy.d.ts.map +0 -1
  20. package/dist/hosts/agy.js +0 -47
  21. package/dist/hosts/agy.js.map +0 -1
  22. package/dist/hosts/claude.d.ts +0 -12
  23. package/dist/hosts/claude.d.ts.map +0 -1
  24. package/dist/hosts/claude.js +0 -46
  25. package/dist/hosts/claude.js.map +0 -1
  26. package/dist/hosts/codex.d.ts +0 -65
  27. package/dist/hosts/codex.d.ts.map +0 -1
  28. package/dist/hosts/codex.js +0 -45
  29. package/dist/hosts/codex.js.map +0 -1
  30. package/dist/hosts/gemini.d.ts +0 -12
  31. package/dist/hosts/gemini.d.ts.map +0 -1
  32. package/dist/hosts/gemini.js +0 -46
  33. package/dist/hosts/gemini.js.map +0 -1
  34. package/dist/hosts/plugin.d.ts +0 -151
  35. package/dist/hosts/plugin.d.ts.map +0 -1
  36. package/dist/hosts/plugin.js +0 -188
  37. package/dist/hosts/plugin.js.map +0 -1
  38. package/dist/mcp.d.ts +0 -2
  39. package/dist/mcp.d.ts.map +0 -1
  40. package/dist/mcp.js +0 -32
  41. package/dist/mcp.js.map +0 -1
  42. package/dist/runtime/blockage/index.d.ts +0 -3
  43. package/dist/runtime/blockage/index.d.ts.map +0 -1
  44. package/dist/runtime/blockage/index.js +0 -3
  45. package/dist/runtime/blockage/index.js.map +0 -1
  46. package/dist/runtime/blockage/notifiers.d.ts +0 -52
  47. package/dist/runtime/blockage/notifiers.d.ts.map +0 -1
  48. package/dist/runtime/blockage/notifiers.js +0 -74
  49. package/dist/runtime/blockage/notifiers.js.map +0 -1
  50. package/dist/runtime/blockage/registry.d.ts +0 -30
  51. package/dist/runtime/blockage/registry.d.ts.map +0 -1
  52. package/dist/runtime/blockage/registry.js +0 -86
  53. package/dist/runtime/blockage/registry.js.map +0 -1
  54. package/dist/runtime/deploy/k8s-sidecar.d.ts +0 -92
  55. package/dist/runtime/deploy/k8s-sidecar.d.ts.map +0 -1
  56. package/dist/runtime/deploy/k8s-sidecar.js +0 -166
  57. package/dist/runtime/deploy/k8s-sidecar.js.map +0 -1
  58. package/dist/runtime/deploy/k8s-tenant.d.ts +0 -86
  59. package/dist/runtime/deploy/k8s-tenant.d.ts.map +0 -1
  60. package/dist/runtime/deploy/k8s-tenant.js +0 -255
  61. package/dist/runtime/deploy/k8s-tenant.js.map +0 -1
  62. package/dist/runtime/drive/inbox-wake.d.ts +0 -36
  63. package/dist/runtime/drive/inbox-wake.d.ts.map +0 -1
  64. package/dist/runtime/drive/inbox-wake.js +0 -50
  65. package/dist/runtime/drive/inbox-wake.js.map +0 -1
  66. package/dist/runtime/drive/index.d.ts +0 -173
  67. package/dist/runtime/drive/index.d.ts.map +0 -1
  68. package/dist/runtime/drive/index.js +0 -503
  69. package/dist/runtime/drive/index.js.map +0 -1
  70. package/dist/runtime/drumbeat/deciders.d.ts +0 -32
  71. package/dist/runtime/drumbeat/deciders.d.ts.map +0 -1
  72. package/dist/runtime/drumbeat/deciders.js +0 -65
  73. package/dist/runtime/drumbeat/deciders.js.map +0 -1
  74. package/dist/runtime/drumbeat/decisions.d.ts +0 -19
  75. package/dist/runtime/drumbeat/decisions.d.ts.map +0 -1
  76. package/dist/runtime/drumbeat/decisions.js +0 -34
  77. package/dist/runtime/drumbeat/decisions.js.map +0 -1
  78. package/dist/runtime/drumbeat/inbox-relance.d.ts +0 -29
  79. package/dist/runtime/drumbeat/inbox-relance.d.ts.map +0 -1
  80. package/dist/runtime/drumbeat/inbox-relance.js +0 -101
  81. package/dist/runtime/drumbeat/inbox-relance.js.map +0 -1
  82. package/dist/runtime/drumbeat/index.d.ts +0 -8
  83. package/dist/runtime/drumbeat/index.d.ts.map +0 -1
  84. package/dist/runtime/drumbeat/index.js +0 -8
  85. package/dist/runtime/drumbeat/index.js.map +0 -1
  86. package/dist/runtime/drumbeat/registry.d.ts +0 -60
  87. package/dist/runtime/drumbeat/registry.d.ts.map +0 -1
  88. package/dist/runtime/drumbeat/registry.js +0 -115
  89. package/dist/runtime/drumbeat/registry.js.map +0 -1
  90. package/dist/runtime/drumbeat/relaunchers.d.ts +0 -111
  91. package/dist/runtime/drumbeat/relaunchers.d.ts.map +0 -1
  92. package/dist/runtime/drumbeat/relaunchers.js +0 -260
  93. package/dist/runtime/drumbeat/relaunchers.js.map +0 -1
  94. package/dist/runtime/drumbeat/scan.d.ts +0 -36
  95. package/dist/runtime/drumbeat/scan.d.ts.map +0 -1
  96. package/dist/runtime/drumbeat/scan.js +0 -41
  97. package/dist/runtime/drumbeat/scan.js.map +0 -1
  98. package/dist/runtime/drumbeat/watch.d.ts +0 -74
  99. package/dist/runtime/drumbeat/watch.d.ts.map +0 -1
  100. package/dist/runtime/drumbeat/watch.js +0 -216
  101. package/dist/runtime/drumbeat/watch.js.map +0 -1
  102. package/dist/runtime/escalation/index.d.ts +0 -2
  103. package/dist/runtime/escalation/index.d.ts.map +0 -1
  104. package/dist/runtime/escalation/index.js +0 -2
  105. package/dist/runtime/escalation/index.js.map +0 -1
  106. package/dist/runtime/escalation/registry.d.ts +0 -44
  107. package/dist/runtime/escalation/registry.d.ts.map +0 -1
  108. package/dist/runtime/escalation/registry.js +0 -79
  109. package/dist/runtime/escalation/registry.js.map +0 -1
  110. package/dist/runtime/governance/claims.d.ts +0 -43
  111. package/dist/runtime/governance/claims.d.ts.map +0 -1
  112. package/dist/runtime/governance/claims.js +0 -93
  113. package/dist/runtime/governance/claims.js.map +0 -1
  114. package/dist/runtime/governance/conductor.d.ts +0 -79
  115. package/dist/runtime/governance/conductor.d.ts.map +0 -1
  116. package/dist/runtime/governance/conductor.js +0 -106
  117. package/dist/runtime/governance/conductor.js.map +0 -1
  118. package/dist/runtime/governance/index.d.ts +0 -5
  119. package/dist/runtime/governance/index.d.ts.map +0 -1
  120. package/dist/runtime/governance/index.js +0 -5
  121. package/dist/runtime/governance/index.js.map +0 -1
  122. package/dist/runtime/governance/launch-check.d.ts +0 -93
  123. package/dist/runtime/governance/launch-check.d.ts.map +0 -1
  124. package/dist/runtime/governance/launch-check.js +0 -113
  125. package/dist/runtime/governance/launch-check.js.map +0 -1
  126. package/dist/runtime/governance/spawns.d.ts +0 -50
  127. package/dist/runtime/governance/spawns.d.ts.map +0 -1
  128. package/dist/runtime/governance/spawns.js +0 -91
  129. package/dist/runtime/governance/spawns.js.map +0 -1
  130. package/dist/runtime/identity/bindings.d.ts +0 -84
  131. package/dist/runtime/identity/bindings.d.ts.map +0 -1
  132. package/dist/runtime/identity/bindings.js +0 -112
  133. package/dist/runtime/identity/bindings.js.map +0 -1
  134. package/dist/runtime/identity/index.d.ts +0 -11
  135. package/dist/runtime/identity/index.d.ts.map +0 -1
  136. package/dist/runtime/identity/index.js +0 -6
  137. package/dist/runtime/identity/index.js.map +0 -1
  138. package/dist/runtime/identity/live.d.ts +0 -26
  139. package/dist/runtime/identity/live.d.ts.map +0 -1
  140. package/dist/runtime/identity/live.js +0 -232
  141. package/dist/runtime/identity/live.js.map +0 -1
  142. package/dist/runtime/identity/migration.d.ts +0 -55
  143. package/dist/runtime/identity/migration.d.ts.map +0 -1
  144. package/dist/runtime/identity/migration.js +0 -100
  145. package/dist/runtime/identity/migration.js.map +0 -1
  146. package/dist/runtime/identity/readers.d.ts +0 -42
  147. package/dist/runtime/identity/readers.d.ts.map +0 -1
  148. package/dist/runtime/identity/readers.js +0 -248
  149. package/dist/runtime/identity/readers.js.map +0 -1
  150. package/dist/runtime/identity/resolver.d.ts +0 -50
  151. package/dist/runtime/identity/resolver.d.ts.map +0 -1
  152. package/dist/runtime/identity/resolver.js +0 -61
  153. package/dist/runtime/identity/resolver.js.map +0 -1
  154. package/dist/runtime/identity/workspace-id.d.ts +0 -43
  155. package/dist/runtime/identity/workspace-id.d.ts.map +0 -1
  156. package/dist/runtime/identity/workspace-id.js +0 -138
  157. package/dist/runtime/identity/workspace-id.js.map +0 -1
  158. package/dist/runtime/local-files/index.d.ts +0 -8
  159. package/dist/runtime/local-files/index.d.ts.map +0 -1
  160. package/dist/runtime/local-files/index.js +0 -8
  161. package/dist/runtime/local-files/index.js.map +0 -1
  162. package/dist/runtime/local-files/lease.d.ts +0 -62
  163. package/dist/runtime/local-files/lease.d.ts.map +0 -1
  164. package/dist/runtime/local-files/lease.js +0 -249
  165. package/dist/runtime/local-files/lease.js.map +0 -1
  166. package/dist/runtime/local-files/locks.d.ts +0 -43
  167. package/dist/runtime/local-files/locks.d.ts.map +0 -1
  168. package/dist/runtime/local-files/locks.js +0 -197
  169. package/dist/runtime/local-files/locks.js.map +0 -1
  170. package/dist/runtime/local-files/migrate.d.ts +0 -31
  171. package/dist/runtime/local-files/migrate.d.ts.map +0 -1
  172. package/dist/runtime/local-files/migrate.js +0 -104
  173. package/dist/runtime/local-files/migrate.js.map +0 -1
  174. package/dist/runtime/local-files/paths.d.ts +0 -146
  175. package/dist/runtime/local-files/paths.d.ts.map +0 -1
  176. package/dist/runtime/local-files/paths.js +0 -233
  177. package/dist/runtime/local-files/paths.js.map +0 -1
  178. package/dist/runtime/local-files/presence.d.ts +0 -80
  179. package/dist/runtime/local-files/presence.d.ts.map +0 -1
  180. package/dist/runtime/local-files/presence.js +0 -250
  181. package/dist/runtime/local-files/presence.js.map +0 -1
  182. package/dist/runtime/local-files/schema.d.ts +0 -47
  183. package/dist/runtime/local-files/schema.d.ts.map +0 -1
  184. package/dist/runtime/local-files/schema.js +0 -77
  185. package/dist/runtime/local-files/schema.js.map +0 -1
  186. package/dist/runtime/local-files/store.d.ts +0 -132
  187. package/dist/runtime/local-files/store.d.ts.map +0 -1
  188. package/dist/runtime/local-files/store.js +0 -997
  189. package/dist/runtime/local-files/store.js.map +0 -1
  190. package/dist/runtime/loop/index.d.ts +0 -73
  191. package/dist/runtime/loop/index.d.ts.map +0 -1
  192. package/dist/runtime/loop/index.js +0 -107
  193. package/dist/runtime/loop/index.js.map +0 -1
  194. package/dist/runtime/mcp/handlers.d.ts +0 -196
  195. package/dist/runtime/mcp/handlers.d.ts.map +0 -1
  196. package/dist/runtime/mcp/handlers.js +0 -1025
  197. package/dist/runtime/mcp/handlers.js.map +0 -1
  198. package/dist/runtime/mcp/index.d.ts +0 -7
  199. package/dist/runtime/mcp/index.d.ts.map +0 -1
  200. package/dist/runtime/mcp/index.js +0 -7
  201. package/dist/runtime/mcp/index.js.map +0 -1
  202. package/dist/runtime/mcp/notifications.d.ts +0 -47
  203. package/dist/runtime/mcp/notifications.d.ts.map +0 -1
  204. package/dist/runtime/mcp/notifications.js +0 -204
  205. package/dist/runtime/mcp/notifications.js.map +0 -1
  206. package/dist/runtime/mcp/server.d.ts +0 -45
  207. package/dist/runtime/mcp/server.d.ts.map +0 -1
  208. package/dist/runtime/mcp/server.js +0 -94
  209. package/dist/runtime/mcp/server.js.map +0 -1
  210. package/dist/runtime/mcp/sessions.d.ts +0 -68
  211. package/dist/runtime/mcp/sessions.d.ts.map +0 -1
  212. package/dist/runtime/mcp/sessions.js +0 -152
  213. package/dist/runtime/mcp/sessions.js.map +0 -1
  214. package/dist/runtime/mcp/stdio.d.ts +0 -72
  215. package/dist/runtime/mcp/stdio.d.ts.map +0 -1
  216. package/dist/runtime/mcp/stdio.js +0 -274
  217. package/dist/runtime/mcp/stdio.js.map +0 -1
  218. package/dist/runtime/mcp/tools.d.ts +0 -19
  219. package/dist/runtime/mcp/tools.d.ts.map +0 -1
  220. package/dist/runtime/mcp/tools.js +0 -525
  221. package/dist/runtime/mcp/tools.js.map +0 -1
  222. package/dist/runtime/mcp-http/app.d.ts +0 -33
  223. package/dist/runtime/mcp-http/app.d.ts.map +0 -1
  224. package/dist/runtime/mcp-http/app.js +0 -162
  225. package/dist/runtime/mcp-http/app.js.map +0 -1
  226. package/dist/runtime/mcp-http/hosted-mcp-server.d.ts +0 -14
  227. package/dist/runtime/mcp-http/hosted-mcp-server.d.ts.map +0 -1
  228. package/dist/runtime/mcp-http/hosted-mcp-server.js +0 -38
  229. package/dist/runtime/mcp-http/hosted-mcp-server.js.map +0 -1
  230. package/dist/runtime/mcp-http/index.d.ts +0 -18
  231. package/dist/runtime/mcp-http/index.d.ts.map +0 -1
  232. package/dist/runtime/mcp-http/index.js +0 -18
  233. package/dist/runtime/mcp-http/index.js.map +0 -1
  234. package/dist/runtime/mcp-http/main.d.ts +0 -2
  235. package/dist/runtime/mcp-http/main.d.ts.map +0 -1
  236. package/dist/runtime/mcp-http/main.js +0 -14
  237. package/dist/runtime/mcp-http/main.js.map +0 -1
  238. package/dist/runtime/mcp-http/oauth/broker-login.d.ts +0 -50
  239. package/dist/runtime/mcp-http/oauth/broker-login.d.ts.map +0 -1
  240. package/dist/runtime/mcp-http/oauth/broker-login.js +0 -41
  241. package/dist/runtime/mcp-http/oauth/broker-login.js.map +0 -1
  242. package/dist/runtime/mcp-http/oauth/broker-routes.d.ts +0 -45
  243. package/dist/runtime/mcp-http/oauth/broker-routes.d.ts.map +0 -1
  244. package/dist/runtime/mcp-http/oauth/broker-routes.js +0 -54
  245. package/dist/runtime/mcp-http/oauth/broker-routes.js.map +0 -1
  246. package/dist/runtime/mcp-http/oauth/config.d.ts +0 -49
  247. package/dist/runtime/mcp-http/oauth/config.d.ts.map +0 -1
  248. package/dist/runtime/mcp-http/oauth/config.js +0 -69
  249. package/dist/runtime/mcp-http/oauth/config.js.map +0 -1
  250. package/dist/runtime/mcp-http/oauth/crypto.d.ts +0 -14
  251. package/dist/runtime/mcp-http/oauth/crypto.d.ts.map +0 -1
  252. package/dist/runtime/mcp-http/oauth/crypto.js +0 -29
  253. package/dist/runtime/mcp-http/oauth/crypto.js.map +0 -1
  254. package/dist/runtime/mcp-http/oauth/file-store.d.ts +0 -48
  255. package/dist/runtime/mcp-http/oauth/file-store.d.ts.map +0 -1
  256. package/dist/runtime/mcp-http/oauth/file-store.js +0 -101
  257. package/dist/runtime/mcp-http/oauth/file-store.js.map +0 -1
  258. package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts +0 -5
  259. package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts.map +0 -1
  260. package/dist/runtime/mcp-http/oauth/hono-oauth-router.js +0 -92
  261. package/dist/runtime/mcp-http/oauth/hono-oauth-router.js.map +0 -1
  262. package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts +0 -56
  263. package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts.map +0 -1
  264. package/dist/runtime/mcp-http/oauth/oidc-rp.js +0 -63
  265. package/dist/runtime/mcp-http/oauth/oidc-rp.js.map +0 -1
  266. package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts +0 -11
  267. package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts.map +0 -1
  268. package/dist/runtime/mcp-http/oauth/redirect-uri.js +0 -29
  269. package/dist/runtime/mcp-http/oauth/redirect-uri.js.map +0 -1
  270. package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts +0 -70
  271. package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts.map +0 -1
  272. package/dist/runtime/mcp-http/oauth/single-tenant-provider.js +0 -247
  273. package/dist/runtime/mcp-http/oauth/single-tenant-provider.js.map +0 -1
  274. package/dist/runtime/mcp-http/oauth/tenancy.d.ts +0 -3
  275. package/dist/runtime/mcp-http/oauth/tenancy.d.ts.map +0 -1
  276. package/dist/runtime/mcp-http/oauth/tenancy.js +0 -18
  277. package/dist/runtime/mcp-http/oauth/tenancy.js.map +0 -1
  278. package/dist/runtime/mcp-http/readonly-allowlist.d.ts +0 -24
  279. package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +0 -1
  280. package/dist/runtime/mcp-http/readonly-allowlist.js +0 -43
  281. package/dist/runtime/mcp-http/readonly-allowlist.js.map +0 -1
  282. package/dist/runtime/mcp-http/serve.d.ts +0 -39
  283. package/dist/runtime/mcp-http/serve.d.ts.map +0 -1
  284. package/dist/runtime/mcp-http/serve.js +0 -100
  285. package/dist/runtime/mcp-http/serve.js.map +0 -1
  286. package/dist/runtime/mirror/accept.d.ts +0 -57
  287. package/dist/runtime/mirror/accept.d.ts.map +0 -1
  288. package/dist/runtime/mirror/accept.js +0 -70
  289. package/dist/runtime/mirror/accept.js.map +0 -1
  290. package/dist/runtime/mirror/build.d.ts +0 -44
  291. package/dist/runtime/mirror/build.d.ts.map +0 -1
  292. package/dist/runtime/mirror/build.js +0 -37
  293. package/dist/runtime/mirror/build.js.map +0 -1
  294. package/dist/runtime/mirror/index.d.ts +0 -9
  295. package/dist/runtime/mirror/index.d.ts.map +0 -1
  296. package/dist/runtime/mirror/index.js +0 -9
  297. package/dist/runtime/mirror/index.js.map +0 -1
  298. package/dist/runtime/mirror/serve.d.ts +0 -21
  299. package/dist/runtime/mirror/serve.d.ts.map +0 -1
  300. package/dist/runtime/mirror/serve.js +0 -141
  301. package/dist/runtime/mirror/serve.js.map +0 -1
  302. package/dist/runtime/nhi.d.ts +0 -15
  303. package/dist/runtime/nhi.d.ts.map +0 -1
  304. package/dist/runtime/nhi.js +0 -26
  305. package/dist/runtime/nhi.js.map +0 -1
  306. package/dist/runtime/remote/accept.d.ts +0 -50
  307. package/dist/runtime/remote/accept.d.ts.map +0 -1
  308. package/dist/runtime/remote/accept.js +0 -54
  309. package/dist/runtime/remote/accept.js.map +0 -1
  310. package/dist/runtime/remote/client.d.ts +0 -27
  311. package/dist/runtime/remote/client.d.ts.map +0 -1
  312. package/dist/runtime/remote/client.js +0 -34
  313. package/dist/runtime/remote/client.js.map +0 -1
  314. package/dist/runtime/remote/index.d.ts +0 -5
  315. package/dist/runtime/remote/index.d.ts.map +0 -1
  316. package/dist/runtime/remote/index.js +0 -5
  317. package/dist/runtime/remote/index.js.map +0 -1
  318. package/dist/runtime/remote/serve.d.ts +0 -27
  319. package/dist/runtime/remote/serve.d.ts.map +0 -1
  320. package/dist/runtime/remote/serve.js +0 -26
  321. package/dist/runtime/remote/serve.js.map +0 -1
  322. package/dist/runtime/remote/server.d.ts +0 -36
  323. package/dist/runtime/remote/server.d.ts.map +0 -1
  324. package/dist/runtime/remote/server.js +0 -100
  325. package/dist/runtime/remote/server.js.map +0 -1
  326. package/dist/runtime/sysml/client.d.ts +0 -44
  327. package/dist/runtime/sysml/client.d.ts.map +0 -1
  328. package/dist/runtime/sysml/client.js +0 -52
  329. package/dist/runtime/sysml/client.js.map +0 -1
  330. package/dist/runtime/sysml/disclosure.d.ts +0 -23
  331. package/dist/runtime/sysml/disclosure.d.ts.map +0 -1
  332. package/dist/runtime/sysml/disclosure.js +0 -53
  333. package/dist/runtime/sysml/disclosure.js.map +0 -1
  334. package/dist/runtime/sysml/index.d.ts +0 -4
  335. package/dist/runtime/sysml/index.d.ts.map +0 -1
  336. package/dist/runtime/sysml/index.js +0 -4
  337. package/dist/runtime/sysml/index.js.map +0 -1
  338. package/dist/runtime/sysml/verify.d.ts +0 -32
  339. package/dist/runtime/sysml/verify.d.ts.map +0 -1
  340. package/dist/runtime/sysml/verify.js +0 -67
  341. package/dist/runtime/sysml/verify.js.map +0 -1
  342. package/dist/runtime/upgrade/index.d.ts +0 -96
  343. package/dist/runtime/upgrade/index.d.ts.map +0 -1
  344. package/dist/runtime/upgrade/index.js +0 -185
  345. package/dist/runtime/upgrade/index.js.map +0 -1
  346. package/dist/runtime/version/agent-version.d.ts +0 -15
  347. package/dist/runtime/version/agent-version.d.ts.map +0 -1
  348. package/dist/runtime/version/agent-version.js +0 -53
  349. package/dist/runtime/version/agent-version.js.map +0 -1
  350. package/skills/h2a/SKILL.md +0 -345
@@ -1,162 +0,0 @@
1
- /**
2
- * EVO-12 hosted MCP HTTP app (Hono) — the self-AS OAuth surface + the
3
- * bearer-gated Streamable-HTTP MCP endpoint, exposing only the read-only tools.
4
- * `createHostedApp` is the testable core; the env-driven entrypoint is below.
5
- */
6
- import { randomUUID } from "node:crypto";
7
- import { StreamableHTTPTransport } from "@hono/mcp";
8
- import { bearerAuth } from "@hono/mcp/auth";
9
- import { Hono } from "hono";
10
- import { buildHostedMcpServer } from "./hosted-mcp-server.js";
11
- import { buildBrokerRoutes } from "./oauth/broker-routes.js";
12
- import { H2A_HOSTED_OAUTH_SCOPE } from "./oauth/config.js";
13
- import { buildOAuthRoutes } from "./oauth/hono-oauth-router.js";
14
- import { rootForSub } from "./oauth/tenancy.js";
15
- export function createHostedApp(deps) {
16
- const app = new Hono();
17
- const wwwAuthenticateHeader = `Bearer error="Unauthorized", error_description="Unauthorized", resource_metadata="${deps.oauthConfig.resourceMetadataUrl}"`;
18
- app.get("/healthz", (c) => c.json({ ok: true }));
19
- app.get("/readyz", (c) => c.json({ ok: true }));
20
- // EVO-12 P2 (mode 3): in broker mode, the broker's /authorize + /oidc/callback
21
- // are registered FIRST (Hono first-match wins) so /authorize delegates to
22
- // 39-auth; /token, /register, well-known still fall through to buildOAuthRoutes.
23
- if (deps.oauthConfig.brokerMode && deps.brokerLogin) {
24
- app.route("/", buildBrokerRoutes({
25
- brokerLogin: deps.brokerLogin,
26
- // Gate the claude.ai request BEFORE delegating to 39-auth: the broker has
27
- // no consent secret, so an unregistered redirect_uri / missing PKCE must
28
- // be rejected here, else an attacker collects the victim's code.
29
- validateClaudeaiAuthorize: async (claudeai) => {
30
- if (!claudeai.client_id)
31
- return { ok: false, error: "invalid_request", description: "missing client_id" };
32
- const client = await deps.oauthProvider.clientsStore.getClient(claudeai.client_id);
33
- if (!client)
34
- return { ok: false, error: "invalid_client", description: "unknown client_id" };
35
- const registered = client.redirect_uris ?? [];
36
- if (!claudeai.redirect_uri || !registered.includes(claudeai.redirect_uri)) {
37
- return { ok: false, error: "invalid_request", description: "redirect_uri is not registered for this client" };
38
- }
39
- if (claudeai.response_type !== undefined && claudeai.response_type !== "code") {
40
- return { ok: false, error: "unsupported_response_type", description: "only response_type=code is supported" };
41
- }
42
- if (!claudeai.code_challenge || claudeai.code_challenge_method !== "S256") {
43
- return { ok: false, error: "invalid_request", description: "PKCE code_challenge (S256) is required" };
44
- }
45
- return { ok: true };
46
- },
47
- issueClaudeaiCode: async (claudeai, ctx) => {
48
- const client = await deps.oauthProvider.clientsStore.getClient(claudeai.client_id);
49
- if (!client)
50
- throw new Error("unknown client_id");
51
- // Defense-in-depth: re-check the redirect_uri belongs to the client
52
- // before minting the code (never trust the carried-through value alone).
53
- if (!claudeai.redirect_uri || !(client.redirect_uris ?? []).includes(claudeai.redirect_uri)) {
54
- throw new Error("redirect_uri is not registered for this client");
55
- }
56
- // Bind the 39-auth subject to the issued code: it rides code→token so
57
- // verifyAccessToken restores it and /mcp serves rootForSub(base, sub).
58
- const code = await deps.oauthProvider.issueAuthorizationCode(client, {
59
- redirectUri: claudeai.redirect_uri,
60
- codeChallenge: claudeai.code_challenge ?? "",
61
- scopes: [H2A_HOSTED_OAUTH_SCOPE],
62
- ...(claudeai.state ? { state: claudeai.state } : {}),
63
- ...(ctx.sub ? { sub: ctx.sub } : {})
64
- });
65
- const redirect = new URL(claudeai.redirect_uri);
66
- redirect.searchParams.set("code", code);
67
- if (claudeai.state)
68
- redirect.searchParams.set("state", claudeai.state);
69
- return redirect.href;
70
- }
71
- }));
72
- }
73
- // OAuth AS + protected-resource metadata (unauthenticated) at the root.
74
- app.route("/", buildOAuthRoutes(deps.oauthProvider, deps.oauthConfig));
75
- // Bearer gate for /mcp: valid access token AND the read-only scope.
76
- const requireAuth = bearerAuth({
77
- verifyToken: async (token) => {
78
- try {
79
- const info = await deps.oauthProvider.verifyAccessToken(token);
80
- return info.scopes.includes(H2A_HOSTED_OAUTH_SCOPE);
81
- }
82
- catch {
83
- return false;
84
- }
85
- },
86
- noAuthenticationHeader: { wwwAuthenticateHeader: () => wwwAuthenticateHeader },
87
- invalidAuthenticationHeader: { wwwAuthenticateHeader: () => wwwAuthenticateHeader }
88
- });
89
- const sessions = new Map();
90
- // EVO-12 P2 (mode 3): per-tenant h2a dispatch, cached by root. The underlying
91
- // server is reused across sessions/requests of the same tenant; the hosted
92
- // read-only wrapper is still built per session.
93
- const multiTenant = Boolean(deps.oauthConfig.brokerMode && deps.tenancy);
94
- const tenantServers = new Map();
95
- const tenantServerFor = (root) => {
96
- let server = tenantServers.get(root);
97
- if (!server) {
98
- server = deps.tenancy.createServer(root);
99
- tenantServers.set(root, server);
100
- }
101
- return server;
102
- };
103
- /**
104
- * Resolve the tenant root for a request from its (already bearer-validated)
105
- * access token. Returns undefined in single-tenant mode. Throws if a broker
106
- * token carries no `sub` (it is not bound to any tenant → forbidden).
107
- */
108
- const resolveTenantRoot = async (c) => {
109
- if (!multiTenant)
110
- return undefined;
111
- const header = c.req.header("authorization") ?? "";
112
- const token = header.startsWith("Bearer ") ? header.slice("Bearer ".length) : "";
113
- const info = await deps.oauthProvider.verifyAccessToken(token);
114
- const sub = typeof info.extra?.sub === "string" ? info.extra.sub : undefined;
115
- if (!sub)
116
- throw new Error("access token is not bound to a tenant");
117
- return rootForSub(deps.tenancy.baseRoot, sub);
118
- };
119
- const forbidden = (c) => c.json({ error: "access_denied", error_description: "token is not bound to this tenant" }, 403);
120
- const mcpHandler = async (c) => {
121
- let tenantRoot;
122
- try {
123
- tenantRoot = await resolveTenantRoot(c);
124
- }
125
- catch {
126
- return forbidden(c);
127
- }
128
- const requestedSessionId = c.req.header("mcp-session-id");
129
- let session = requestedSessionId ? sessions.get(requestedSessionId) : undefined;
130
- // A session is pinned to the tenant that opened it: a token for another
131
- // tenant must not be able to reuse it.
132
- if (session && session.tenantRoot !== tenantRoot)
133
- return forbidden(c);
134
- if (!session) {
135
- let created;
136
- const transport = new StreamableHTTPTransport({
137
- enableJsonResponse: true,
138
- sessionIdGenerator: () => randomUUID(),
139
- onsessioninitialized: (sessionId) => {
140
- if (created)
141
- sessions.set(sessionId, created);
142
- },
143
- onsessionclosed: (sessionId) => {
144
- sessions.delete(sessionId);
145
- }
146
- });
147
- created = { transport, ...(tenantRoot !== undefined && { tenantRoot }) };
148
- // One SDK server per session, exposing ONLY the read-only allowlist —
149
- // backed by the tenant's root in multi-tenant mode, else the single server.
150
- const base = tenantRoot !== undefined ? tenantServerFor(tenantRoot) : deps.h2aMcpServer;
151
- const server = buildHostedMcpServer(base);
152
- await server.connect(transport);
153
- session = created;
154
- }
155
- const res = await session.transport.handleRequest(c);
156
- return res ?? c.body(null, 202);
157
- };
158
- // claude.ai connects at the resource-server URL (/mcp); only /mcp is bearer-gated.
159
- app.all("/mcp", requireAuth, mcpHandler);
160
- return app;
161
- }
162
- //# sourceMappingURL=app.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/runtime/mcp-http/app.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAgB,IAAI,EAAE,MAAM,MAAM,CAAC;AAG1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAA6B,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,MAAM,oB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C,kBAAkB,EAAE,IAAI;gBACxB,kBAAkB,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;gBACtC,oBAAoB,EAAE,CAAC,SAAS,EAAE,EAAE;oBAClC,IAAI,OAAO;wBAAE,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBAChD,CAAC;gBACD,eAAe,EAAE,CAAC,SAAS,EAAE,EAAE;oBAC7B,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;gBAC7B,CAAC;aACF,CAAC,CAAC;YACH,OAAO,GAAG,EAAE,SAAS,EAAE,GAAG,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;YACzE,sEAAsE;YACtE,4EAA4E;YAC5E,MAAM,IAAI,GAAG,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;YACxF,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAChC,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACrD,OAAO,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,mFAAmF;IACnF,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;IAEzC,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * EVO-12 hosted MCP server — wraps the EXISTING in-process h2a tool dispatch
3
- * (`McpServer.callTool`) behind an SDK `Server`, exposing ONLY the read-only
4
- * allowlist. `dispatchHostedTool` refuses any non-allowlisted tool name
5
- * (defense-in-depth: a signing/private-key tool is never reachable here, even
6
- * if the wire asked for it).
7
- */
8
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
- import { type CallToolResult } from "@modelcontextprotocol/sdk/types.js";
10
- import type { McpServer } from "../mcp/server.js";
11
- export declare function dispatchHostedTool(h2a: McpServer, name: string, args: Record<string, unknown> | undefined): CallToolResult;
12
- /** SDK Server exposing only the read-only allowlist, dispatching to the h2a callTool. */
13
- export declare function buildHostedMcpServer(h2a: McpServer): Server;
14
- //# sourceMappingURL=hosted-mcp-server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hosted-mcp-server.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp-http/hosted-mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,oCAAoC,CAAC;AAI5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,SAAS,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,cAAc,CAYhB;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,SAAS,GAAG,MAAM,CAoB3D"}
@@ -1,38 +0,0 @@
1
- /**
2
- * EVO-12 hosted MCP server — wraps the EXISTING in-process h2a tool dispatch
3
- * (`McpServer.callTool`) behind an SDK `Server`, exposing ONLY the read-only
4
- * allowlist. `dispatchHostedTool` refuses any non-allowlisted tool name
5
- * (defense-in-depth: a signing/private-key tool is never reachable here, even
6
- * if the wire asked for it).
7
- */
8
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
- import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
10
- import { currentCliVersion } from "../upgrade/index.js";
11
- import { H2A_CLI_MCP_TOOL_DESCRIPTORS } from "../mcp/tools.js";
12
- import { hostedReadOnlyDescriptors, isHostedReadOnlyTool } from "./readonly-allowlist.js";
13
- export function dispatchHostedTool(h2a, name, args) {
14
- if (!isHostedReadOnlyTool(name)) {
15
- return {
16
- content: [{ type: "text", text: `tool '${name}' is not exposed on the hosted read-only surface` }],
17
- isError: true
18
- };
19
- }
20
- const result = h2a.callTool(name, args);
21
- if (result && typeof result === "object" && "error" in result && typeof result.error === "string") {
22
- return { content: [{ type: "text", text: result.error }], isError: true };
23
- }
24
- return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
25
- }
26
- /** SDK Server exposing only the read-only allowlist, dispatching to the h2a callTool. */
27
- export function buildHostedMcpServer(h2a) {
28
- const server = new Server({ name: "h2a", version: currentCliVersion() }, { capabilities: { tools: { listChanged: true } } });
29
- const announced = hostedReadOnlyDescriptors(H2A_CLI_MCP_TOOL_DESCRIPTORS).map((d) => ({
30
- name: d.name,
31
- description: d.description,
32
- inputSchema: d.inputSchema
33
- }));
34
- server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: announced }));
35
- server.setRequestHandler(CallToolRequestSchema, async (req) => dispatchHostedTool(h2a, req.params.name, req.params.arguments ?? {}));
36
- return server;
37
- }
38
- //# sourceMappingURL=hosted-mcp-server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hosted-mcp-server.js","sourceRoot":"","sources":["../../../src/runtime/mcp-http/hosted-mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EAErB,sBAAsB,EACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE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I;QACZ,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,WAAW,EAAE,CAAC,CAAC,WAAsC;KACtD,CAAC,CAAC,CAAC;IAEJ,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACrF,MAAM,CAAC,iBAAiB,CACtB,qBAAqB,EACrB,KAAK,EAAE,GAAG,EAA2B,EAAE,CACrC,kBAAkB,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC,CACvE,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * EVO-12 hosted MCP over HTTP + self-AS OAuth (mcp-wave pattern), exposing the
3
- * h2a read-only tool surface for claude.ai enrollment. Core is dep-free; this
4
- * lives in @sentropic/h2a-cli.
5
- */
6
- export { H2A_HOSTED_READONLY_TOOLS, hostedReadOnlyDescriptors, isHostedReadOnlyTool, toolTakesPrivateKey } from "./readonly-allowlist.js";
7
- export { buildHostedMcpServer, dispatchHostedTool } from "./hosted-mcp-server.js";
8
- export { createHostedApp, type HostedAppDeps } from "./app.js";
9
- export { startHostedServer, buildHostedConfigFromEnv, type HostedEnv, type HostedConfig, type StartedHostedServer } from "./serve.js";
10
- export { FileOAuthStore } from "./oauth/file-store.js";
11
- export { SingleTenantOAuthProvider } from "./oauth/single-tenant-provider.js";
12
- export { buildOAuthRoutes } from "./oauth/hono-oauth-router.js";
13
- export { buildUpstreamAuthorizeUrl, exchangeUpstreamCode, type H2AUpstreamOidcConfig, type UpstreamFetch, type UpstreamLogin } from "./oauth/oidc-rp.js";
14
- export { rootForSub } from "./oauth/tenancy.js";
15
- export { createBrokerLogin, type BrokerLogin, type BrokerLoginDeps, type BrokerStart, type BrokerComplete } from "./oauth/broker-login.js";
16
- export { buildBrokerRoutes, type BrokerRoutesDeps } from "./oauth/broker-routes.js";
17
- export { oauthConfigFromEnv, H2A_HOSTED_OAUTH_SCOPE, type H2AHostedOAuthConfig, type H2AHostedOAuthEnv } from "./oauth/config.js";
18
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp-http/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * EVO-12 hosted MCP over HTTP + self-AS OAuth (mcp-wave pattern), exposing the
3
- * h2a read-only tool surface for claude.ai enrollment. Core is dep-free; this
4
- * lives in @sentropic/h2a-cli.
5
- */
6
- export { H2A_HOSTED_READONLY_TOOLS, hostedReadOnlyDescriptors, isHostedReadOnlyTool, toolTakesPrivateKey } from "./readonly-allowlist.js";
7
- export { buildHostedMcpServer, dispatchHostedTool } from "./hosted-mcp-server.js";
8
- export { createHostedApp } from "./app.js";
9
- export { startHostedServer, buildHostedConfigFromEnv } from "./serve.js";
10
- export { FileOAuthStore } from "./oauth/file-store.js";
11
- export { SingleTenantOAuthProvider } from "./oauth/single-tenant-provider.js";
12
- export { buildOAuthRoutes } from "./oauth/hono-oauth-router.js";
13
- export { buildUpstreamAuthorizeUrl, exchangeUpstreamCode } from "./oauth/oidc-rp.js";
14
- export { rootForSub } from "./oauth/tenancy.js";
15
- export { createBrokerLogin } from "./oauth/broker-login.js";
16
- export { buildBrokerRoutes } from "./oauth/broker-routes.js";
17
- export { oauthConfigFromEnv, H2A_HOSTED_OAUTH_SCOPE } from "./oauth/config.js";
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/mcp-http/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAsB,MAAM,UAAU,CAAC;AAC/D,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EAIzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EAIrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,iBAAiB,EAKlB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAyB,MAAM,0BAA0B,CAAC;AACpF,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EAGvB,MAAM,mBAAmB,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=main.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/runtime/mcp-http/main.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- /**
2
- * EVO-12 hosted MCP — runnable entrypoint (Docker CMD / `node dist/runtime/mcp-http/main.js`).
3
- * Reads the deploy env and serves the OAuth-gated read-only MCP over HTTP.
4
- */
5
- import { startHostedServer } from "./serve.js";
6
- startHostedServer()
7
- .then((s) => {
8
- process.stderr.write(`h2a hosted MCP (EVO-12) listening on :${s.port}\n`);
9
- })
10
- .catch((e) => {
11
- process.stderr.write(`h2a hosted MCP failed to start: ${e instanceof Error ? e.message : String(e)}\n`);
12
- process.exit(1);
13
- });
14
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/runtime/mcp-http/main.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,iBAAiB,EAAE;KAChB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;IACV,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC5E,CAAC,CAAC;KACD,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;IACpB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACxG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,50 +0,0 @@
1
- /**
2
- * EVO-12 P2 (mode 3) — broker-login state machine. The stateful heart of the
3
- * gateway: on claude.ai's /authorize, `start()` stores the claude.ai request +
4
- * a fresh upstream PKCE/state and returns the 39-auth /authorize URL to redirect
5
- * to; on the /oidc/callback, `complete()` looks the pending entry up by state,
6
- * exchanges the code at 39-auth for the user's `sub`, and resolves that user's
7
- * per-tenant root. The hono routes are thin wrappers over this.
8
- *
9
- * Deps injected (exchange / pkce / randomState / clock) → unit-testable against
10
- * a mock IdP, no network. Pending entries are single-use + time-boxed.
11
- */
12
- import { type H2AUpstreamOidcConfig, type UpstreamLogin } from "./oidc-rp.js";
13
- export interface BrokerLoginDeps {
14
- readonly config: H2AUpstreamOidcConfig;
15
- /** Bound `exchangeUpstreamCode(config, {code, codeVerifier}, fetch)`. */
16
- readonly exchange: (code: string, codeVerifier: string) => Promise<UpstreamLogin>;
17
- /** Base h2a root; the per-user root is `rootForSub(baseRoot, sub)`. */
18
- readonly baseRoot: string;
19
- /** Fresh opaque state per login (e.g. `randomToken()`). */
20
- readonly randomState: () => string;
21
- /** Fresh PKCE pair for the upstream leg. */
22
- readonly pkce: () => {
23
- verifier: string;
24
- challenge: string;
25
- };
26
- readonly now?: () => number;
27
- /** Pending-login TTL (ms). Default 10 min. */
28
- readonly maxAgeMs?: number;
29
- }
30
- export interface BrokerStart {
31
- /** 39-auth /authorize URL to redirect the user to. */
32
- readonly redirectUrl: string;
33
- /** The upstream state (also the pending-entry key). */
34
- readonly state: string;
35
- }
36
- export interface BrokerComplete {
37
- /** The original claude.ai /authorize request, opaque to the broker — to resume issuing the claude.ai code. */
38
- readonly claudeai: unknown;
39
- /** The authenticated 39-auth user. */
40
- readonly sub: string;
41
- /** That user's per-tenant h2a root. */
42
- readonly root: string;
43
- }
44
- export interface BrokerLogin {
45
- start(claudeaiParams: unknown): BrokerStart;
46
- complete(state: string, code: string): Promise<BrokerComplete>;
47
- pendingCount(): number;
48
- }
49
- export declare function createBrokerLogin(deps: BrokerLoginDeps): BrokerLogin;
50
- //# sourceMappingURL=broker-login.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker-login.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/broker-login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAA6B,KAAK,qBAAqB,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGzG,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAClF,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,CAAC;IACnC,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7D,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,8CAA8C;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,8GAA8G;IAC9G,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,sCAAsC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,cAAc,EAAE,OAAO,GAAG,WAAW,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/D,YAAY,IAAI,MAAM,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,CAwBpE"}
@@ -1,41 +0,0 @@
1
- /**
2
- * EVO-12 P2 (mode 3) — broker-login state machine. The stateful heart of the
3
- * gateway: on claude.ai's /authorize, `start()` stores the claude.ai request +
4
- * a fresh upstream PKCE/state and returns the 39-auth /authorize URL to redirect
5
- * to; on the /oidc/callback, `complete()` looks the pending entry up by state,
6
- * exchanges the code at 39-auth for the user's `sub`, and resolves that user's
7
- * per-tenant root. The hono routes are thin wrappers over this.
8
- *
9
- * Deps injected (exchange / pkce / randomState / clock) → unit-testable against
10
- * a mock IdP, no network. Pending entries are single-use + time-boxed.
11
- */
12
- import { buildUpstreamAuthorizeUrl } from "./oidc-rp.js";
13
- import { rootForSub } from "./tenancy.js";
14
- export function createBrokerLogin(deps) {
15
- const now = deps.now ?? Date.now;
16
- const maxAgeMs = deps.maxAgeMs ?? 600_000;
17
- const pending = new Map();
18
- return {
19
- start(claudeaiParams) {
20
- const { verifier, challenge } = deps.pkce();
21
- const state = deps.randomState();
22
- pending.set(state, { verifier, claudeai: claudeaiParams, at: now() });
23
- return {
24
- redirectUrl: buildUpstreamAuthorizeUrl(deps.config, { state, codeChallenge: challenge }),
25
- state
26
- };
27
- },
28
- async complete(state, code) {
29
- const entry = pending.get(state);
30
- if (!entry)
31
- throw new Error("broker: unknown state");
32
- pending.delete(state); // single-use
33
- if (now() - entry.at > maxAgeMs)
34
- throw new Error("broker: state expired");
35
- const login = await deps.exchange(code, entry.verifier);
36
- return { claudeai: entry.claudeai, sub: login.sub, root: rootForSub(deps.baseRoot, login.sub) };
37
- },
38
- pendingCount: () => pending.size
39
- };
40
- }
41
- //# sourceMappingURL=broker-login.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker-login.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/broker-login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,yBAAyB,EAAkD,MAAM,cAAc,CAAC;AACzG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAuC1C,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAA+D,CAAC;IACvF,OAAO;QACL,KAAK,CAAC,cAAc;YAClB,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;YACtE,OAAO;gBACL,WAAW,EAAE,yBAAyB,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;gBACxF,KAAK;aACN,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI;YACxB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACjC,IAAI,CAAC,KAAK;gBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa;YACpC,IAAI,GAAG,EAAE,GAAG,KAAK,CAAC,EAAE,GAAG,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;YAC1E,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;YACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAClG,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI;KACjC,CAAC;AACJ,CAAC"}
@@ -1,45 +0,0 @@
1
- /**
2
- * EVO-12 P2 (mode 3) — hono routes for the broker login. Thin wrapper over
3
- * `createBrokerLogin`: `/authorize` starts a login (302 → 39-auth) instead of
4
- * the single-tenant consent form; `/oidc/callback` completes it (exchange →
5
- * sub → per-user root) and hands off to the provider to issue the claude.ai
6
- * authorization code, then 302s back to claude.ai.
7
- *
8
- * `issueClaudeaiCode` is injected (the SingleTenantOAuthProvider's code issuance,
9
- * bound to the resolved user/root) → routes are testable via `app.request` with
10
- * a mock IdP, no provider/network.
11
- */
12
- import { Hono } from "hono";
13
- import type { BrokerLogin } from "./broker-login.js";
14
- export interface BrokerRoutesDeps {
15
- readonly brokerLogin: BrokerLogin;
16
- /**
17
- * Issue the claude.ai authorization code for the original request, bound to
18
- * the authenticated user/root, and return the claude.ai redirect URL
19
- * (`<redirect_uri>?code=…&state=…`).
20
- */
21
- readonly issueClaudeaiCode: (claudeai: Record<string, string>, ctx: {
22
- sub: string;
23
- root: string;
24
- }) => string | Promise<string>;
25
- /**
26
- * Validate the claude.ai /authorize request BEFORE delegating to 39-auth. The
27
- * single-tenant flow is gated by the consent secret; the broker has none, so
28
- * an unvalidated `redirect_uri` would let an attacker craft
29
- * `/authorize?client_id=<real>&redirect_uri=https://evil&code_challenge=<theirs>`,
30
- * have the victim log in at 39-auth, and collect a code at their URL bound to
31
- * the victim's sub. This MUST reject an unregistered redirect_uri / bad PKCE
32
- * before the login starts. Returns ok, or an error rendered as 400.
33
- */
34
- readonly validateClaudeaiAuthorize?: (claudeai: Record<string, string>) => Promise<{
35
- ok: true;
36
- } | {
37
- ok: false;
38
- error: string;
39
- description: string;
40
- }>;
41
- /** Callback path registered at 39-auth. Default `/oidc/callback`. */
42
- readonly callbackPath?: string;
43
- }
44
- export declare function buildBrokerRoutes(deps: BrokerRoutesDeps): Hono;
45
- //# sourceMappingURL=broker-routes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker-routes.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/broker-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,EAAE,CAC1B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,GAAG,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAC/B,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,yBAAyB,CAAC,EAAE,CACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAC7B,OAAO,CAAC;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,GAAG;QAAE,EAAE,EAAE,KAAK,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/E,qEAAqE;IACrE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CA0C9D"}
@@ -1,54 +0,0 @@
1
- /**
2
- * EVO-12 P2 (mode 3) — hono routes for the broker login. Thin wrapper over
3
- * `createBrokerLogin`: `/authorize` starts a login (302 → 39-auth) instead of
4
- * the single-tenant consent form; `/oidc/callback` completes it (exchange →
5
- * sub → per-user root) and hands off to the provider to issue the claude.ai
6
- * authorization code, then 302s back to claude.ai.
7
- *
8
- * `issueClaudeaiCode` is injected (the SingleTenantOAuthProvider's code issuance,
9
- * bound to the resolved user/root) → routes are testable via `app.request` with
10
- * a mock IdP, no provider/network.
11
- */
12
- import { Hono } from "hono";
13
- export function buildBrokerRoutes(deps) {
14
- const router = new Hono();
15
- const callbackPath = deps.callbackPath ?? "/oidc/callback";
16
- // claude.ai lands here (DCR+PKCE already done against our self-AS); we redirect
17
- // the human to 39-auth to actually log in.
18
- router.get("/authorize", async (c) => {
19
- c.header("Cache-Control", "no-store");
20
- const claudeai = c.req.query();
21
- if (deps.validateClaudeaiAuthorize) {
22
- const v = await deps.validateClaudeaiAuthorize(claudeai);
23
- if (!v.ok) {
24
- // reject BEFORE sending the human to 39-auth — never issue a code to an
25
- // unregistered redirect_uri.
26
- return c.json({ error: v.error, error_description: v.description }, 400);
27
- }
28
- }
29
- const { redirectUrl } = deps.brokerLogin.start(claudeai);
30
- return c.redirect(redirectUrl, 302);
31
- });
32
- // 39-auth redirects back here with code+state; we exchange, resolve the user's
33
- // root, issue the claude.ai code, and bounce back to claude.ai.
34
- router.get(callbackPath, async (c) => {
35
- const code = c.req.query("code");
36
- const state = c.req.query("state");
37
- if (!code || !state) {
38
- return c.json({ error: "invalid_request", error_description: "missing code/state" }, 400);
39
- }
40
- try {
41
- const done = await deps.brokerLogin.complete(state, code);
42
- const redirectUrl = await deps.issueClaudeaiCode(done.claudeai, {
43
- sub: done.sub,
44
- root: done.root
45
- });
46
- return c.redirect(redirectUrl, 302);
47
- }
48
- catch (err) {
49
- return c.json({ error: "access_denied", error_description: err.message }, 400);
50
- }
51
- });
52
- return router;
53
- }
54
- //# sourceMappingURL=broker-routes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"broker-routes.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/broker-routes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA+B5B,MAAM,UAAU,iBAAiB,CAAC,IAAsB;IACtD,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;IAC1B,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,gBAAgB,CAAC;IAE3D,gFAAgF;IAChF,2CAA2C;IAC3C,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACnC,CAAC,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,EAA4B,CAAC;QACzD,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACnC,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,CAAC;YACzD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;gBACV,wEAAwE;gBACxE,6BAA6B;gBAC7B,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAA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AO,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * EVO-12 hosted OAuth — runtime config (ported from mcp-wave; decoupled from
3
- * the Wave env type — takes a plain input object so it is unit-testable).
4
- *
5
- * Scope is read-only (`h2a:read`) — the hosted surface exposes only read tools
6
- * (DEC-116 key custody; see ../readonly-allowlist).
7
- */
8
- import type { H2AUpstreamOidcConfig } from "./oidc-rp.js";
9
- export declare const H2A_HOSTED_OAUTH_SCOPE = "h2a:read";
10
- export interface H2AHostedOAuthEnv {
11
- PUBLIC_BASE_URL: string;
12
- OAUTH_ISSUER_URL: string;
13
- OAUTH_CONSENT_SECRET?: string;
14
- OAUTH_ALLOWED_REDIRECT_URIS: string;
15
- OAUTH_ACCESS_TOKEN_TTL_SECONDS: number;
16
- OAUTH_REFRESH_TOKEN_TTL_SECONDS: number;
17
- OAUTH_AUTH_CODE_TTL_SECONDS: number;
18
- H2A_HOSTED_ENROLLMENT_ENABLED?: string;
19
- NODE_ENV?: string;
20
- H2A_BROKER_MODE?: string;
21
- H2A_UPSTREAM_ISSUER?: string;
22
- H2A_UPSTREAM_AUTHORIZE_URL?: string;
23
- H2A_UPSTREAM_TOKEN_URL?: string;
24
- H2A_UPSTREAM_CLIENT_ID?: string;
25
- H2A_UPSTREAM_CLIENT_SECRET?: string;
26
- H2A_UPSTREAM_REDIRECT_URI?: string;
27
- H2A_UPSTREAM_SCOPES?: string;
28
- }
29
- export interface H2AHostedOAuthConfig {
30
- issuerUrl: URL;
31
- publicBaseUrl: URL;
32
- resourceServerUrl: URL;
33
- resourceMetadataUrl: string;
34
- consentSecret: string;
35
- enrollmentEnabled: boolean;
36
- allowedRedirectUris: readonly string[];
37
- accessTokenTtlSeconds: number;
38
- refreshTokenTtlSeconds: number;
39
- authCodeTtlSeconds: number;
40
- nodeEnv: string;
41
- /** EVO-12 P2: broker mode (delegate login to 39-auth). */
42
- brokerMode: boolean;
43
- /** The seeded 39-auth RP config — present iff broker mode. */
44
- upstream?: H2AUpstreamOidcConfig;
45
- }
46
- export declare function parseOAuthCsv(value: string): string[];
47
- export declare function parseHostedEnrollmentEnabled(value: string | undefined): boolean;
48
- export declare function oauthConfigFromEnv(env: H2AHostedOAuthEnv): H2AHostedOAuthConfig;
49
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,eAAO,MAAM,sBAAsB,aAAa,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2BAA2B,EAAE,MAAM,CAAC;IACpC,8BAA8B,EAAE,MAAM,CAAC;IACvC,+BAA+B,EAAE,MAAM,CAAC;IACxC,2BAA2B,EAAE,MAAM,CAAC;IACpC,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAIlB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,GAAG,CAAC;IACf,aAAa,EAAE,GAAG,CAAC;IACnB,iBAAiB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