@sentropic/h2a-cli 0.74.0 → 0.78.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 (346) hide show
  1. package/dist/index.d.ts +1 -36
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -40
  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 -729
  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 -4530
  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 -242
  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/mcp/handlers.d.ts +0 -196
  191. package/dist/runtime/mcp/handlers.d.ts.map +0 -1
  192. package/dist/runtime/mcp/handlers.js +0 -1025
  193. package/dist/runtime/mcp/handlers.js.map +0 -1
  194. package/dist/runtime/mcp/index.d.ts +0 -7
  195. package/dist/runtime/mcp/index.d.ts.map +0 -1
  196. package/dist/runtime/mcp/index.js +0 -7
  197. package/dist/runtime/mcp/index.js.map +0 -1
  198. package/dist/runtime/mcp/notifications.d.ts +0 -47
  199. package/dist/runtime/mcp/notifications.d.ts.map +0 -1
  200. package/dist/runtime/mcp/notifications.js +0 -204
  201. package/dist/runtime/mcp/notifications.js.map +0 -1
  202. package/dist/runtime/mcp/server.d.ts +0 -45
  203. package/dist/runtime/mcp/server.d.ts.map +0 -1
  204. package/dist/runtime/mcp/server.js +0 -94
  205. package/dist/runtime/mcp/server.js.map +0 -1
  206. package/dist/runtime/mcp/sessions.d.ts +0 -68
  207. package/dist/runtime/mcp/sessions.d.ts.map +0 -1
  208. package/dist/runtime/mcp/sessions.js +0 -152
  209. package/dist/runtime/mcp/sessions.js.map +0 -1
  210. package/dist/runtime/mcp/stdio.d.ts +0 -72
  211. package/dist/runtime/mcp/stdio.d.ts.map +0 -1
  212. package/dist/runtime/mcp/stdio.js +0 -274
  213. package/dist/runtime/mcp/stdio.js.map +0 -1
  214. package/dist/runtime/mcp/tools.d.ts +0 -19
  215. package/dist/runtime/mcp/tools.d.ts.map +0 -1
  216. package/dist/runtime/mcp/tools.js +0 -525
  217. package/dist/runtime/mcp/tools.js.map +0 -1
  218. package/dist/runtime/mcp-http/app.d.ts +0 -33
  219. package/dist/runtime/mcp-http/app.d.ts.map +0 -1
  220. package/dist/runtime/mcp-http/app.js +0 -162
  221. package/dist/runtime/mcp-http/app.js.map +0 -1
  222. package/dist/runtime/mcp-http/hosted-mcp-server.d.ts +0 -14
  223. package/dist/runtime/mcp-http/hosted-mcp-server.d.ts.map +0 -1
  224. package/dist/runtime/mcp-http/hosted-mcp-server.js +0 -38
  225. package/dist/runtime/mcp-http/hosted-mcp-server.js.map +0 -1
  226. package/dist/runtime/mcp-http/index.d.ts +0 -18
  227. package/dist/runtime/mcp-http/index.d.ts.map +0 -1
  228. package/dist/runtime/mcp-http/index.js +0 -18
  229. package/dist/runtime/mcp-http/index.js.map +0 -1
  230. package/dist/runtime/mcp-http/main.d.ts +0 -2
  231. package/dist/runtime/mcp-http/main.d.ts.map +0 -1
  232. package/dist/runtime/mcp-http/main.js +0 -14
  233. package/dist/runtime/mcp-http/main.js.map +0 -1
  234. package/dist/runtime/mcp-http/oauth/broker-login.d.ts +0 -50
  235. package/dist/runtime/mcp-http/oauth/broker-login.d.ts.map +0 -1
  236. package/dist/runtime/mcp-http/oauth/broker-login.js +0 -41
  237. package/dist/runtime/mcp-http/oauth/broker-login.js.map +0 -1
  238. package/dist/runtime/mcp-http/oauth/broker-routes.d.ts +0 -45
  239. package/dist/runtime/mcp-http/oauth/broker-routes.d.ts.map +0 -1
  240. package/dist/runtime/mcp-http/oauth/broker-routes.js +0 -54
  241. package/dist/runtime/mcp-http/oauth/broker-routes.js.map +0 -1
  242. package/dist/runtime/mcp-http/oauth/config.d.ts +0 -49
  243. package/dist/runtime/mcp-http/oauth/config.d.ts.map +0 -1
  244. package/dist/runtime/mcp-http/oauth/config.js +0 -69
  245. package/dist/runtime/mcp-http/oauth/config.js.map +0 -1
  246. package/dist/runtime/mcp-http/oauth/crypto.d.ts +0 -14
  247. package/dist/runtime/mcp-http/oauth/crypto.d.ts.map +0 -1
  248. package/dist/runtime/mcp-http/oauth/crypto.js +0 -29
  249. package/dist/runtime/mcp-http/oauth/crypto.js.map +0 -1
  250. package/dist/runtime/mcp-http/oauth/file-store.d.ts +0 -48
  251. package/dist/runtime/mcp-http/oauth/file-store.d.ts.map +0 -1
  252. package/dist/runtime/mcp-http/oauth/file-store.js +0 -101
  253. package/dist/runtime/mcp-http/oauth/file-store.js.map +0 -1
  254. package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts +0 -5
  255. package/dist/runtime/mcp-http/oauth/hono-oauth-router.d.ts.map +0 -1
  256. package/dist/runtime/mcp-http/oauth/hono-oauth-router.js +0 -92
  257. package/dist/runtime/mcp-http/oauth/hono-oauth-router.js.map +0 -1
  258. package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts +0 -56
  259. package/dist/runtime/mcp-http/oauth/oidc-rp.d.ts.map +0 -1
  260. package/dist/runtime/mcp-http/oauth/oidc-rp.js +0 -63
  261. package/dist/runtime/mcp-http/oauth/oidc-rp.js.map +0 -1
  262. package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts +0 -11
  263. package/dist/runtime/mcp-http/oauth/redirect-uri.d.ts.map +0 -1
  264. package/dist/runtime/mcp-http/oauth/redirect-uri.js +0 -29
  265. package/dist/runtime/mcp-http/oauth/redirect-uri.js.map +0 -1
  266. package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts +0 -70
  267. package/dist/runtime/mcp-http/oauth/single-tenant-provider.d.ts.map +0 -1
  268. package/dist/runtime/mcp-http/oauth/single-tenant-provider.js +0 -247
  269. package/dist/runtime/mcp-http/oauth/single-tenant-provider.js.map +0 -1
  270. package/dist/runtime/mcp-http/oauth/tenancy.d.ts +0 -3
  271. package/dist/runtime/mcp-http/oauth/tenancy.d.ts.map +0 -1
  272. package/dist/runtime/mcp-http/oauth/tenancy.js +0 -18
  273. package/dist/runtime/mcp-http/oauth/tenancy.js.map +0 -1
  274. package/dist/runtime/mcp-http/readonly-allowlist.d.ts +0 -24
  275. package/dist/runtime/mcp-http/readonly-allowlist.d.ts.map +0 -1
  276. package/dist/runtime/mcp-http/readonly-allowlist.js +0 -43
  277. package/dist/runtime/mcp-http/readonly-allowlist.js.map +0 -1
  278. package/dist/runtime/mcp-http/serve.d.ts +0 -39
  279. package/dist/runtime/mcp-http/serve.d.ts.map +0 -1
  280. package/dist/runtime/mcp-http/serve.js +0 -100
  281. package/dist/runtime/mcp-http/serve.js.map +0 -1
  282. package/dist/runtime/mirror/accept.d.ts +0 -57
  283. package/dist/runtime/mirror/accept.d.ts.map +0 -1
  284. package/dist/runtime/mirror/accept.js +0 -70
  285. package/dist/runtime/mirror/accept.js.map +0 -1
  286. package/dist/runtime/mirror/build.d.ts +0 -44
  287. package/dist/runtime/mirror/build.d.ts.map +0 -1
  288. package/dist/runtime/mirror/build.js +0 -37
  289. package/dist/runtime/mirror/build.js.map +0 -1
  290. package/dist/runtime/mirror/index.d.ts +0 -9
  291. package/dist/runtime/mirror/index.d.ts.map +0 -1
  292. package/dist/runtime/mirror/index.js +0 -9
  293. package/dist/runtime/mirror/index.js.map +0 -1
  294. package/dist/runtime/mirror/serve.d.ts +0 -21
  295. package/dist/runtime/mirror/serve.d.ts.map +0 -1
  296. package/dist/runtime/mirror/serve.js +0 -141
  297. package/dist/runtime/mirror/serve.js.map +0 -1
  298. package/dist/runtime/nhi.d.ts +0 -15
  299. package/dist/runtime/nhi.d.ts.map +0 -1
  300. package/dist/runtime/nhi.js +0 -26
  301. package/dist/runtime/nhi.js.map +0 -1
  302. package/dist/runtime/remote/accept.d.ts +0 -50
  303. package/dist/runtime/remote/accept.d.ts.map +0 -1
  304. package/dist/runtime/remote/accept.js +0 -54
  305. package/dist/runtime/remote/accept.js.map +0 -1
  306. package/dist/runtime/remote/client.d.ts +0 -27
  307. package/dist/runtime/remote/client.d.ts.map +0 -1
  308. package/dist/runtime/remote/client.js +0 -34
  309. package/dist/runtime/remote/client.js.map +0 -1
  310. package/dist/runtime/remote/index.d.ts +0 -5
  311. package/dist/runtime/remote/index.d.ts.map +0 -1
  312. package/dist/runtime/remote/index.js +0 -5
  313. package/dist/runtime/remote/index.js.map +0 -1
  314. package/dist/runtime/remote/serve.d.ts +0 -27
  315. package/dist/runtime/remote/serve.d.ts.map +0 -1
  316. package/dist/runtime/remote/serve.js +0 -26
  317. package/dist/runtime/remote/serve.js.map +0 -1
  318. package/dist/runtime/remote/server.d.ts +0 -36
  319. package/dist/runtime/remote/server.d.ts.map +0 -1
  320. package/dist/runtime/remote/server.js +0 -100
  321. package/dist/runtime/remote/server.js.map +0 -1
  322. package/dist/runtime/sysml/client.d.ts +0 -44
  323. package/dist/runtime/sysml/client.d.ts.map +0 -1
  324. package/dist/runtime/sysml/client.js +0 -52
  325. package/dist/runtime/sysml/client.js.map +0 -1
  326. package/dist/runtime/sysml/disclosure.d.ts +0 -23
  327. package/dist/runtime/sysml/disclosure.d.ts.map +0 -1
  328. package/dist/runtime/sysml/disclosure.js +0 -53
  329. package/dist/runtime/sysml/disclosure.js.map +0 -1
  330. package/dist/runtime/sysml/index.d.ts +0 -4
  331. package/dist/runtime/sysml/index.d.ts.map +0 -1
  332. package/dist/runtime/sysml/index.js +0 -4
  333. package/dist/runtime/sysml/index.js.map +0 -1
  334. package/dist/runtime/sysml/verify.d.ts +0 -32
  335. package/dist/runtime/sysml/verify.d.ts.map +0 -1
  336. package/dist/runtime/sysml/verify.js +0 -67
  337. package/dist/runtime/sysml/verify.js.map +0 -1
  338. package/dist/runtime/upgrade/index.d.ts +0 -96
  339. package/dist/runtime/upgrade/index.d.ts.map +0 -1
  340. package/dist/runtime/upgrade/index.js +0 -185
  341. package/dist/runtime/upgrade/index.js.map +0 -1
  342. package/dist/runtime/version/agent-version.d.ts +0 -15
  343. package/dist/runtime/version/agent-version.d.ts.map +0 -1
  344. package/dist/runtime/version/agent-version.js +0 -53
  345. package/dist/runtime/version/agent-version.js.map +0 -1
  346. package/skills/h2a/SKILL.md +0 -345
@@ -1,69 +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
- export const H2A_HOSTED_OAUTH_SCOPE = "h2a:read";
9
- export function parseOAuthCsv(value) {
10
- return value
11
- .split(",")
12
- .map((item) => item.trim())
13
- .filter((item) => item.length > 0);
14
- }
15
- export function parseHostedEnrollmentEnabled(value) {
16
- if (value === undefined)
17
- return false;
18
- return ["1", "true", "yes", "on"].includes(value.trim().toLowerCase());
19
- }
20
- export function oauthConfigFromEnv(env) {
21
- const publicBaseUrl = new URL(env.PUBLIC_BASE_URL);
22
- const issuerUrl = new URL(env.OAUTH_ISSUER_URL);
23
- const enrollmentEnabled = parseHostedEnrollmentEnabled(env.H2A_HOSTED_ENROLLMENT_ENABLED);
24
- if (enrollmentEnabled && !env.OAUTH_CONSENT_SECRET) {
25
- throw new Error("OAUTH_CONSENT_SECRET is required when H2A_HOSTED_ENROLLMENT_ENABLED=true");
26
- }
27
- const brokerMode = env.H2A_BROKER_MODE === "true";
28
- const upstream = brokerMode ? upstreamFromEnv(env) : undefined;
29
- return {
30
- issuerUrl,
31
- publicBaseUrl,
32
- resourceServerUrl: new URL("/mcp", publicBaseUrl),
33
- resourceMetadataUrl: new URL("/.well-known/oauth-protected-resource/mcp", publicBaseUrl).href,
34
- consentSecret: env.OAUTH_CONSENT_SECRET ?? "local-dev-consent",
35
- enrollmentEnabled,
36
- allowedRedirectUris: parseOAuthCsv(env.OAUTH_ALLOWED_REDIRECT_URIS),
37
- accessTokenTtlSeconds: env.OAUTH_ACCESS_TOKEN_TTL_SECONDS,
38
- refreshTokenTtlSeconds: env.OAUTH_REFRESH_TOKEN_TTL_SECONDS,
39
- authCodeTtlSeconds: env.OAUTH_AUTH_CODE_TTL_SECONDS,
40
- nodeEnv: env.NODE_ENV ?? "development",
41
- brokerMode,
42
- ...(upstream ? { upstream } : {})
43
- };
44
- }
45
- /** Parse the seeded 39-auth RP config from env; throws if a field is missing. */
46
- function upstreamFromEnv(env) {
47
- const required = {
48
- issuer: env.H2A_UPSTREAM_ISSUER,
49
- authorizeUrl: env.H2A_UPSTREAM_AUTHORIZE_URL,
50
- tokenUrl: env.H2A_UPSTREAM_TOKEN_URL,
51
- clientId: env.H2A_UPSTREAM_CLIENT_ID,
52
- clientSecret: env.H2A_UPSTREAM_CLIENT_SECRET,
53
- redirectUri: env.H2A_UPSTREAM_REDIRECT_URI
54
- };
55
- for (const [key, value] of Object.entries(required)) {
56
- if (!value)
57
- throw new Error(`H2A_BROKER_MODE=true requires H2A_UPSTREAM_* (missing ${key})`);
58
- }
59
- return {
60
- issuer: required.issuer,
61
- authorizeUrl: required.authorizeUrl,
62
- tokenUrl: required.tokenUrl,
63
- clientId: required.clientId,
64
- clientSecret: required.clientSecret,
65
- redirectUri: required.redirectUri,
66
- scopes: env.H2A_UPSTREAM_SCOPES ? parseOAuthCsv(env.H2A_UPSTREAM_SCOPES) : ["openid", "profile", "email"]
67
- };
68
- }
69
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC;AA2CjD,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAK;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SAC1B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,KAAyB;IACpE,IAAI,K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ACV,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClC,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,SAAS,eAAe,CAAC,GAAsB;IAC7C,MAAM,QAAQ,GAAG;QACf,MAAM,EAAE,GAAG,CAAC,mBAAmB;QAC/B,YAAY,EAAE,GAAG,CAAC,0BAA0B;QAC5C,QAAQ,EAAE,GAAG,CAAC,sBAAsB;QACpC,QAAQ,EAAE,GAAG,CAAC,sBAAsB;QACpC,YAAY,EAAE,GAAG,CAAC,0BAA0B;QAC5C,WAAW,EAAE,GAAG,CAAC,yBAAyB;KAC3C,CAAC;IACF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,IAAI,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,yDAAyD,GAAG,GAAG,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAgB;QACjC,YAAY,EAAE,QAAQ,CAAC,YAAsB;QAC7C,QAAQ,EAAE,QAAQ,CAAC,QAAkB;QACrC,QAAQ,EAAE,QAAQ,CAAC,QAAkB;QACrC,YAAY,EAAE,QAAQ,CAAC,YAAsB;QAC7C,WAAW,EAAE,QAAQ,CAAC,WAAqB;QAC3C,MAAM,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;KAC1G,CAAC;AACJ,CAAC"}
@@ -1,14 +0,0 @@
1
- export declare function randomToken(byteLength?: number): string;
2
- export declare function sha256Hex(value: string): string;
3
- export declare function tokenHashPrefix(tokenHash: string): string;
4
- export declare function timingSafeEqualString(a: string, b: string): boolean;
5
- /**
6
- * EVO-12 P2 (mode 3): a fresh PKCE pair for the gateway's upstream 39-auth leg.
7
- * The verifier is held server-side (broker pending state); the S256 challenge
8
- * goes on the wire to /authorize.
9
- */
10
- export declare function pkceS256(): {
11
- verifier: string;
12
- challenge: string;
13
- };
14
- //# sourceMappingURL=crypto.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/crypto.ts"],"names":[],"mappings":"AAKA,wBAAgB,WAAW,CAAC,UAAU,SAAK,GAAG,MAAM,CAEnD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAInE;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,IAAI;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAIlE"}
@@ -1,29 +0,0 @@
1
- /**
2
- * EVO-12 hosted OAuth — token crypto helpers (ported from mcp-wave, generic).
3
- */
4
- import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
5
- export function randomToken(byteLength = 32) {
6
- return randomBytes(byteLength).toString("base64url");
7
- }
8
- export function sha256Hex(value) {
9
- return createHash("sha256").update(value).digest("hex");
10
- }
11
- export function tokenHashPrefix(tokenHash) {
12
- return tokenHash.slice(0, 12);
13
- }
14
- export function timingSafeEqualString(a, b) {
15
- const left = Buffer.from(sha256Hex(a), "hex");
16
- const right = Buffer.from(sha256Hex(b), "hex");
17
- return timingSafeEqual(left, right);
18
- }
19
- /**
20
- * EVO-12 P2 (mode 3): a fresh PKCE pair for the gateway's upstream 39-auth leg.
21
- * The verifier is held server-side (broker pending state); the S256 challenge
22
- * goes on the wire to /authorize.
23
- */
24
- export function pkceS256() {
25
- const verifier = randomBytes(32).toString("base64url");
26
- const challenge = createHash("sha256").update(verifier).digest("base64url");
27
- return { verifier, challenge };
28
- }
29
- //# sourceMappingURL=crypto.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/crypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEvE,MAAM,UAAU,WAAW,CAAC,UAAU,GAAG,EAAE;IACzC,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,CAAS,EAAE,CAAS;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC/C,OAAO,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAC5E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
@@ -1,48 +0,0 @@
1
- import type { OAuthRegisteredClientsStore } from "@modelcontextprotocol/sdk/server/auth/clients.js";
2
- import type { OAuthClientInformationFull } from "@modelcontextprotocol/sdk/shared/auth.js";
3
- export interface StoredAuthorizationCode {
4
- codeHash: string;
5
- clientId: string;
6
- redirectUri: string;
7
- codeChallenge: string;
8
- scopes: string[];
9
- resource: string;
10
- createdAt: number;
11
- expiresAt: number;
12
- consumedAt?: number;
13
- /**
14
- * EVO-12 P2 (mode 3, multi-tenant): the upstream 39-auth subject this code was
15
- * minted for. Threaded code→token so /mcp can serve the per-user root. Absent
16
- * for single-tenant (consent-secret) codes.
17
- */
18
- sub?: string;
19
- }
20
- export interface StoredToken {
21
- tokenHash: string;
22
- tokenType: "access" | "refresh";
23
- clientId: string;
24
- scopes: string[];
25
- resource: string;
26
- issuedAt: number;
27
- expiresAt: number;
28
- revokedAt?: number;
29
- parentRefreshTokenHash?: string;
30
- /** EVO-12 P2: the 39-auth subject (see StoredAuthorizationCode.sub). */
31
- sub?: string;
32
- }
33
- export declare class FileOAuthStore implements OAuthRegisteredClientsStore {
34
- readonly path: string;
35
- private snapshot;
36
- constructor(path: string);
37
- load(): Promise<void>;
38
- getClient(clientId: string): Promise<OAuthClientInformationFull | undefined>;
39
- registerClient(client: OAuthClientInformationFull): Promise<OAuthClientInformationFull>;
40
- putAuthorizationCode(code: string, record: Omit<StoredAuthorizationCode, "codeHash" | "consumedAt">): Promise<void>;
41
- getAuthorizationCode(code: string, nowSeconds: number): Promise<StoredAuthorizationCode | undefined>;
42
- consumeAuthorizationCode(code: string, nowSeconds: number): Promise<StoredAuthorizationCode | undefined>;
43
- putToken(token: string, record: Omit<StoredToken, "tokenHash" | "revokedAt">): Promise<StoredToken>;
44
- findToken(token: string): Promise<StoredToken | undefined>;
45
- revokeToken(token: string, nowSeconds: number): Promise<void>;
46
- private persist;
47
- }
48
- //# sourceMappingURL=file-store.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-store.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/file-store.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI3F,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,wEAAwE;IACxE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AASD,qBAAa,cAAe,YAAW,2BAA2B;IAGpD,QAAQ,CAAC,IAAI,EAAE,MAAM;IAFjC,OAAO,CAAC,QAAQ,CAA6E;gBAExE,IAAI,EAAE,MAAM;IAE3B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAkBrB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;IAI5E,cAAc,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAMvF,oBAAoB,CACxB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,GAAG,YAAY,CAAC,GAC/D,OAAO,CAAC,IAAI,CAAC;IAMV,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;IAMpG,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC;IASxG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC;IAQnG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAI1D,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAQrD,OAAO;CAmBtB"}
@@ -1,101 +0,0 @@
1
- /**
2
- * EVO-12 hosted OAuth — file-backed store for DCR clients, auth codes, tokens
3
- * (ported from mcp-wave; generic, atomic-persist). Holds only OAuth artifacts
4
- * (hashed codes/tokens) — never an h2a ed25519 private key.
5
- */
6
- import { mkdir, open, readFile, rename, writeFile } from "node:fs/promises";
7
- import { dirname } from "node:path";
8
- import { sha256Hex } from "./crypto.js";
9
- export class FileOAuthStore {
10
- path;
11
- snapshot = { version: 1, clients: {}, authorizationCodes: {}, tokens: {} };
12
- constructor(path) {
13
- this.path = path;
14
- }
15
- async load() {
16
- try {
17
- const parsed = JSON.parse(await readFile(this.path, "utf8"));
18
- this.snapshot = {
19
- version: 1,
20
- clients: parsed.clients ?? {},
21
- authorizationCodes: parsed.authorizationCodes ?? {},
22
- tokens: parsed.tokens ?? {}
23
- };
24
- }
25
- catch (error) {
26
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
27
- await this.persist();
28
- return;
29
- }
30
- throw error;
31
- }
32
- }
33
- async getClient(clientId) {
34
- return this.snapshot.clients[clientId];
35
- }
36
- async registerClient(client) {
37
- this.snapshot.clients[client.client_id] = client;
38
- await this.persist();
39
- return client;
40
- }
41
- async putAuthorizationCode(code, record) {
42
- const codeHash = sha256Hex(code);
43
- this.snapshot.authorizationCodes[codeHash] = { ...record, codeHash };
44
- await this.persist();
45
- }
46
- async getAuthorizationCode(code, nowSeconds) {
47
- const record = this.snapshot.authorizationCodes[sha256Hex(code)];
48
- if (!record || record.consumedAt || record.expiresAt <= nowSeconds)
49
- return undefined;
50
- return record;
51
- }
52
- async consumeAuthorizationCode(code, nowSeconds) {
53
- const codeHash = sha256Hex(code);
54
- const record = this.snapshot.authorizationCodes[codeHash];
55
- if (!record || record.consumedAt || record.expiresAt <= nowSeconds)
56
- return undefined;
57
- record.consumedAt = nowSeconds;
58
- await this.persist();
59
- return record;
60
- }
61
- async putToken(token, record) {
62
- const tokenHash = sha256Hex(token);
63
- const stored = { ...record, tokenHash };
64
- this.snapshot.tokens[tokenHash] = stored;
65
- await this.persist();
66
- return stored;
67
- }
68
- async findToken(token) {
69
- return this.snapshot.tokens[sha256Hex(token)];
70
- }
71
- async revokeToken(token, nowSeconds) {
72
- const record = this.snapshot.tokens[sha256Hex(token)];
73
- if (record && record.revokedAt === undefined) {
74
- record.revokedAt = nowSeconds;
75
- await this.persist();
76
- }
77
- }
78
- async persist() {
79
- await mkdir(dirname(this.path), { recursive: true });
80
- const body = `${JSON.stringify(this.snapshot, null, 2)}\n`;
81
- const tempPath = `${this.path}.${process.pid}.${Date.now()}.tmp`;
82
- await writeFile(tempPath, body, { mode: 0o600 });
83
- const handle = await open(tempPath, "r");
84
- try {
85
- await handle.sync();
86
- }
87
- catch (error) {
88
- // Windows rejects fsync on some handles with EPERM, and exotic FUSE/CI
89
- // filesystems return ENOSYS. The durability hint is best-effort; the
90
- // rename below still provides atomic replace on every platform.
91
- const code = error.code;
92
- if (code !== "EPERM" && code !== "ENOSYS")
93
- throw error;
94
- }
95
- finally {
96
- await handle.close();
97
- }
98
- await rename(tempPath, this.path);
99
- }
100
- }
101
- //# sourceMappingURL=file-store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"file-store.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/file-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAyCxC,MAAM,OAAO,cAAc;IAGJ;IAFb,QAAQ,GAAa,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IAE7F,YAAqB,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;IAAG,CAAC;IAErC,KAAK,CAAC,IAAI;QACR,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAa,CAAC;YACzE,IAAI,CAAC,QAAQ,GAAG;gBACd,OAAO,EAAE,CAAC;gBACV,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,EAAE;gBAC7B,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,EAAE;gBACnD,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;aAC5B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,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AI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;QAC3D,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;QACjE,MAAM,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACjD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACzC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uEAAuE;YACvE,qEAAqE;YACrE,gEAAgE;YAChE,MAAM,IAAI,GAAI,KAA+B,CAAC,IAAI,CAAC;YACnD,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,QAAQ;gBAAE,MAAM,KAAK,CAAC;QACzD,CAAC;gBAAS,CAAC;YACT,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;QACD,MAAM,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF"}
@@ -1,5 +0,0 @@
1
- import { Hono } from "hono";
2
- import { type H2AHostedOAuthConfig } from "./config.js";
3
- import type { SingleTenantOAuthProvider } from "./single-tenant-provider.js";
4
- export declare function buildOAuthRoutes(provider: SingleTenantOAuthProvider, oauth: H2AHostedOAuthConfig): Hono;
5
- //# sourceMappingURL=hono-oauth-router.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hono-oauth-router.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/hono-oauth-router.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC/F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAY7E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,yBAAyB,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,CA2FvG"}
@@ -1,92 +0,0 @@
1
- /**
2
- * EVO-12 hosted OAuth — authorization-server + protected-resource routes
3
- * (ported from mcp-wave). Standard endpoints (DCR, token+PKCE, revoke,
4
- * well-known metadata) come from `@hono/mcp/auth`; only `/authorize` is custom
5
- * (operator consent secret gate, single-tenant). resourceName = "h2a".
6
- */
7
- import { authenticateClient, clientRegistrationHandler, createOAuthMetadata, revokeHandler, tokenHandler, wellKnownRouter } from "@hono/mcp/auth";
8
- import { OAuthError, ServerError } from "@modelcontextprotocol/sdk/server/auth/errors.js";
9
- import { Hono } from "hono";
10
- import { H2A_HOSTED_OAUTH_SCOPE as OAUTH_SCOPE } from "./config.js";
11
- function enrollmentDisabled(c) {
12
- return c.json({
13
- error: "enrollment_disabled",
14
- error_description: "Remote h2a enrollment is disabled by default; enable it explicitly after multi-tenant policy is configured."
15
- }, 403);
16
- }
17
- export function buildOAuthRoutes(provider, oauth) {
18
- const sdkProvider = provider;
19
- const clientsStore = provider.clientsStore;
20
- const router = new Hono();
21
- // RFC 8414: issuer identifier must equal the metadata-URL value (no trailing
22
- // slash) — a URL object would normalize to a trailing slash that claude.ai rejects.
23
- const issuer = oauth.issuerUrl.href.replace(/\/+$/, "");
24
- const oauthMetadata = createOAuthMetadata({
25
- provider: sdkProvider,
26
- issuerUrl: issuer,
27
- baseUrl: oauth.publicBaseUrl,
28
- scopesSupported: [OAUTH_SCOPE]
29
- });
30
- router.route("/", wellKnownRouter({
31
- oauthMetadata,
32
- resourceServerUrl: oauth.resourceServerUrl,
33
- scopesSupported: [OAUTH_SCOPE],
34
- resourceName: "h2a"
35
- }));
36
- // Also serve PRM at the unsuffixed path (the bearerAuth 401 advertises it there).
37
- router.get("/.well-known/oauth-protected-resource", (c) => c.json({
38
- resource: oauth.resourceServerUrl.href,
39
- authorization_servers: [issuer],
40
- bearer_methods_supported: ["header"],
41
- scopes_supported: [OAUTH_SCOPE],
42
- resource_name: "h2a"
43
- }));
44
- router.post("/register", (c, next) => oauth.enrollmentEnabled ? next() : enrollmentDisabled(c));
45
- router.post("/register", clientRegistrationHandler({ clientsStore }));
46
- router.post("/token", authenticateClient({ clientsStore }), tokenHandler(sdkProvider));
47
- router.post("/revoke", authenticateClient({ clientsStore }), revokeHandler(sdkProvider));
48
- router.on(["GET", "POST"], "/authorize", async (c) => {
49
- c.header("Cache-Control", "no-store");
50
- if (!oauth.enrollmentEnabled)
51
- return enrollmentDisabled(c);
52
- const raw = c.req.method === "POST"
53
- ? (await c.req.parseBody())
54
- : c.req.query();
55
- const clientId = raw["client_id"];
56
- if (!clientId) {
57
- return c.json({ error: "invalid_request", error_description: "missing client_id" }, 400);
58
- }
59
- const client = await provider.clientsStore.getClient(clientId);
60
- if (!client) {
61
- return c.json({ error: "invalid_client", error_description: "unknown client_id" }, 400);
62
- }
63
- const redirectUri = raw["redirect_uri"] ?? client.redirect_uris[0] ?? "";
64
- const scopeRaw = raw["scope"];
65
- const stateRaw = raw["state"];
66
- const resourceRaw = raw["resource"];
67
- const params = {
68
- redirectUri,
69
- codeChallenge: raw["code_challenge"] ?? "",
70
- ...(scopeRaw !== undefined && { scopes: scopeRaw.split(" ") }),
71
- ...(stateRaw !== undefined && { state: stateRaw }),
72
- ...(resourceRaw !== undefined && { resource: new URL(resourceRaw) })
73
- };
74
- try {
75
- const consentSecret = raw["consent_secret"];
76
- const outcome = await provider.authorizeRequest(client, params, {
77
- method: c.req.method,
78
- ...(consentSecret !== undefined && { consentSecret })
79
- });
80
- if (outcome.kind === "consent") {
81
- return c.html(outcome.html, outcome.status);
82
- }
83
- return c.redirect(outcome.location, 302);
84
- }
85
- catch (e) {
86
- const err = e instanceof OAuthError ? e : new ServerError("Internal Server Error");
87
- return c.json(err.toResponseObject(), err instanceof ServerError ? 500 : 400);
88
- }
89
- });
90
- return router;
91
- }
92
- //# sourceMappingURL=hono-oauth-router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hono-oauth-router.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/hono-oauth-router.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAK1F,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,sBAAsB,IAAI,WAAW,EAA6B,MAAM,aAAa,CAAC;AAG/F,SAAS,kBAAkB,CAAC,CAAwD;IAClF,OAAO,CAAC,CAAC,IAAI,CACX;QACE,KAAK,EAAE,qBAAqB;QAC5B,iBAAiB,EAAE,6GAA6G;KACjI,EACD,GAAG,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,QAAmC,EAAE,KAA2B;IAC/F,MAAM,WAAW,GAAG,QAA0C,CAAC;IAC/D,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAsD,CAAC;IACrF,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;IAE1B,6EAA6E;IAC7E,oFAAoF;IACpF,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,mBAAmB,CAAC;QACxC,QAAQ,EAAE,WAAW;QACrB,SAAS,EAAE,MAAM;QACjB,OAAO,EAAE,KAAK,CAAC,aAAa;QAC5B,eAAe,EAAE,CAAC,WAAW,CAAC;KAC/B,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CACV,GAAG,EACH,eAAe,CAAC;QAC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K,EAAE,QAAQ,EAAE,CAAC;YAClD,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;SACrE,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAAC;YAC5C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE;gBAC9D,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM;gBACpB,GAAG,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,CAAC;aACtD,CAAC,CAAC;YACH,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC/B,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC3C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,GAAG,GAAG,CAAC,YAAY,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,uBAAuB,CAAC,CAAC;YACnF,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,EAAE,GAAG,YAAY,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAChF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,56 +0,0 @@
1
- /**
2
- * EVO-12 P2 (mode 3, gateway broker) — upstream OIDC Relying Party for 39-auth.
3
- *
4
- * The hosted shim keeps the DCR + token surface claude.ai needs (self-AS), but
5
- * delegates the USER login to 39-auth (the sentropic OIDC IdP, live at
6
- * `…/api/v1/auth/oauth/authorize`): redirect to its `/authorize`, then exchange
7
- * the code at `/token` and read the authenticated `sub`. The `sub` is what the
8
- * gateway maps to a per-user h2a root (multi-tenant).
9
- *
10
- * Pure + fetch-injected → unit-testable against a mock IdP. The real client
11
- * (client_id/secret) is seeded operator-side in 39-auth (no DCR there); that
12
- * seed is the live-integration point, not a code dependency.
13
- */
14
- export interface H2AUpstreamOidcConfig {
15
- /** 39-auth issuer (informational / id_token `iss` check later). */
16
- readonly issuer: string;
17
- /** 39-auth authorization endpoint (e.g. …/api/v1/auth/oauth/authorize). */
18
- readonly authorizeUrl: string;
19
- /** 39-auth token endpoint (e.g. …/api/v1/auth/oauth/token). */
20
- readonly tokenUrl: string;
21
- /** This gateway's seeded client id at 39-auth. */
22
- readonly clientId: string;
23
- /** This gateway's client secret (k8s Secret). */
24
- readonly clientSecret: string;
25
- /** The gateway's callback URL registered at 39-auth. */
26
- readonly redirectUri: string;
27
- /** Scopes to request (openid required for `sub`). */
28
- readonly scopes: readonly string[];
29
- }
30
- /** Minimal fetch shape (injected for tests; global fetch satisfies it). */
31
- export type UpstreamFetch = (url: string, init: {
32
- method: string;
33
- headers: Record<string, string>;
34
- body: string;
35
- }) => Promise<{
36
- ok: boolean;
37
- status: number;
38
- json: () => Promise<unknown>;
39
- }>;
40
- export interface UpstreamLogin {
41
- /** The authenticated user — the gateway's per-tenant key. */
42
- readonly sub: string;
43
- readonly idToken: string;
44
- readonly accessToken?: string;
45
- }
46
- /** Build the 39-auth `/authorize` URL to redirect the user to (authorization_code + PKCE). */
47
- export declare function buildUpstreamAuthorizeUrl(config: H2AUpstreamOidcConfig, params: {
48
- state: string;
49
- codeChallenge: string;
50
- }): string;
51
- /** Exchange an authorization_code (+ PKCE verifier) at 39-auth for the user's `sub`. */
52
- export declare function exchangeUpstreamCode(config: H2AUpstreamOidcConfig, params: {
53
- code: string;
54
- codeVerifier: string;
55
- }, fetchImpl: UpstreamFetch): Promise<UpstreamLogin>;
56
- //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AAqB,EAC7B,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAC/C,MAAM,CAUR;AAqBD,wFAAwF;AACxF,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAC9C,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,aAAa,CAAC,CA0BxB"}
@@ -1,63 +0,0 @@
1
- /** Build the 39-auth `/authorize` URL to redirect the user to (authorization_code + PKCE). */
2
- export function buildUpstreamAuthorizeUrl(config, params) {
3
- const url = new URL(config.authorizeUrl);
4
- url.searchParams.set("response_type", "code");
5
- url.searchParams.set("client_id", config.clientId);
6
- url.searchParams.set("redirect_uri", config.redirectUri);
7
- url.searchParams.set("scope", config.scopes.join(" "));
8
- url.searchParams.set("state", params.state);
9
- url.searchParams.set("code_challenge", params.codeChallenge);
10
- url.searchParams.set("code_challenge_method", "S256");
11
- return url.href;
12
- }
13
- /** Read `sub` from an id_token payload. The token came from our authenticated
14
- * server-to-server exchange with 39-auth (TLS + client_secret), so the payload
15
- * is trusted here; verifying the EdDSA signature against 39-auth JWKS is the
16
- * hardening step (needs JWKS publicly reachable). */
17
- function subFromIdToken(idToken) {
18
- const parts = idToken.split(".");
19
- if (parts.length < 2)
20
- throw new Error("malformed id_token");
21
- let payload;
22
- try {
23
- payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
24
- }
25
- catch {
26
- throw new Error("unparseable id_token payload");
27
- }
28
- if (typeof payload.sub !== "string" || payload.sub.length === 0) {
29
- throw new Error("id_token has no sub");
30
- }
31
- return payload.sub;
32
- }
33
- /** Exchange an authorization_code (+ PKCE verifier) at 39-auth for the user's `sub`. */
34
- export async function exchangeUpstreamCode(config, params, fetchImpl) {
35
- const body = new URLSearchParams({
36
- grant_type: "authorization_code",
37
- code: params.code,
38
- redirect_uri: config.redirectUri,
39
- client_id: config.clientId,
40
- code_verifier: params.codeVerifier
41
- }).toString();
42
- const basic = Buffer.from(`${config.clientId}:${config.clientSecret}`).toString("base64");
43
- const res = await fetchImpl(config.tokenUrl, {
44
- method: "POST",
45
- headers: {
46
- "content-type": "application/x-www-form-urlencoded",
47
- accept: "application/json",
48
- authorization: `Basic ${basic}`
49
- },
50
- body
51
- });
52
- if (!res.ok)
53
- throw new Error(`upstream token exchange failed: HTTP ${res.status}`);
54
- const tok = (await res.json());
55
- if (typeof tok.id_token !== "string")
56
- throw new Error("upstream token response missing id_token");
57
- return {
58
- sub: subFromIdToken(tok.id_token),
59
- idToken: tok.id_token,
60
- ...(typeof tok.access_token === "string" ? { accessToken: tok.access_token } : {})
61
- };
62
- }
63
- //# sourceMappingURL=oidc-rp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"oidc-rp.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/oidc-rp.ts"],"names":[],"mappings":"AA2CA,8FAA8F;AAC9F,MAAM,UAAU,yBAAyB,CACvC,MAA6B,EAC7B,MAAgD;IAEhD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IACzC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC9C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IACnD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IACzD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5C,GAAG,CAAC,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QAAQ,EAAE,CAAC;IACd,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC1F,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE;QAC3C,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,mCAAmC;YACnD,MAAM,EAAE,kBAAkB;YAC1B,aAAa,EAAE,SAAS,KAAK,EAAE;SAChC;QACD,IAAI;KACL,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAmD,CAAC;IACjF,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAClG,OAAO;QACL,GAAG,EAAE,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC;QACjC,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,GAAG,CAAC,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnF,CAAC;AACJ,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * EVO-12 hosted OAuth — redirect-uri allow checks (ported from mcp-wave;
3
- * decoupled from the Wave env type — takes a plain nodeEnv string).
4
- *
5
- * claude.ai's connector uses fixed redirect URIs
6
- * (https://claude.ai|claude.com/api/mcp/auth_callback) — those must be in
7
- * `allowedRedirectUris`. Loopback is allowed only outside production (local dev).
8
- */
9
- export declare function redirectUriAllowed(redirectUri: string, allowedRedirectUris: readonly string[], nodeEnv: string): boolean;
10
- export declare function allRedirectUrisAllowed(redirectUris: readonly string[], allowedRedirectUris: readonly string[], nodeEnv: string): boolean;
11
- //# sourceMappingURL=redirect-uri.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redirect-uri.d.ts","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/redirect-uri.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,SAAS,MAAM,EAAE,EACtC,OAAO,EAAE,MAAM,GACd,OAAO,CAiBT;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,mBAAmB,EAAE,SAAS,MAAM,EAAE,EACtC,OAAO,EAAE,MAAM,GACd,OAAO,CAET"}
@@ -1,29 +0,0 @@
1
- /**
2
- * EVO-12 hosted OAuth — redirect-uri allow checks (ported from mcp-wave;
3
- * decoupled from the Wave env type — takes a plain nodeEnv string).
4
- *
5
- * claude.ai's connector uses fixed redirect URIs
6
- * (https://claude.ai|claude.com/api/mcp/auth_callback) — those must be in
7
- * `allowedRedirectUris`. Loopback is allowed only outside production (local dev).
8
- */
9
- const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1"]);
10
- export function redirectUriAllowed(redirectUri, allowedRedirectUris, nodeEnv) {
11
- let parsed;
12
- try {
13
- parsed = new URL(redirectUri);
14
- }
15
- catch {
16
- return false;
17
- }
18
- if (allowedRedirectUris.includes(parsed.href)) {
19
- return true;
20
- }
21
- if (nodeEnv !== "production" && LOOPBACK_HOSTS.has(parsed.hostname)) {
22
- return parsed.protocol === "http:" || parsed.protocol === "https:";
23
- }
24
- return false;
25
- }
26
- export function allRedirectUrisAllowed(redirectUris, allowedRedirectUris, nodeEnv) {
27
- return redirectUris.every((uri) => redirectUriAllowed(uri, allowedRedirectUris, nodeEnv));
28
- }
29
- //# sourceMappingURL=redirect-uri.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redirect-uri.js","sourceRoot":"","sources":["../../../../src/runtime/mcp-http/oauth/redirect-uri.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;AAElE,MAAM,UAAU,kBAAkB,CAChC,WAAmB,EACnB,mBAAsC,EACtC,OAAe;IAEf,IAAI,MAAW,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,mBAAmB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,KAAK,YAAY,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpE,OAAO,MAAM,CAAC,QAAQ,KAAK,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACrE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,YAA+B,EAC/B,mBAAsC,EACtC,OAAe;IAEf,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5F,CAAC"}