@suveren/gateway 0.8.7 → 0.9.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.
- package/bin/suveren-gateway.js +165 -9
- package/dist/control-plane/index.mjs +330 -87
- package/dist/mcp-server/http.mjs +662 -186
- package/dist/ui/assets/{index-tzStUGuj.js → index-CIiOCgjJ.js} +21 -21
- package/dist/ui/index.html +1 -1
- package/lib/config.d.mts +37 -0
- package/lib/config.mjs +150 -0
- package/node_modules/@hap/core/dist/index.d.mts +33 -2
- package/node_modules/@hap/core/dist/index.d.ts +33 -2
- package/node_modules/@hap/core/dist/index.js +26 -2
- package/node_modules/@hap/core/dist/index.mjs +25 -2
- package/node_modules/@hap/core/package.json +1 -1
- package/node_modules/@hap/core/src/gatekeeper.ts +36 -2
- package/node_modules/@hap/core/src/types.ts +21 -1
- package/node_modules/@hono/node-server/README.md +21 -10
- package/node_modules/@hono/node-server/dist/early-hints.cjs +1 -1
- package/node_modules/@hono/node-server/dist/early-hints.mjs +1 -1
- package/node_modules/@hono/node-server/dist/index.cjs +41 -19
- package/node_modules/@hono/node-server/dist/index.mjs +42 -20
- package/node_modules/@hono/node-server/dist/serve-static.cjs +1 -0
- package/node_modules/@hono/node-server/dist/serve-static.d.cts +2 -1
- package/node_modules/@hono/node-server/dist/serve-static.d.mts +2 -1
- package/node_modules/@hono/node-server/dist/serve-static.mjs +1 -0
- package/node_modules/@hono/node-server/package.json +3 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts +43 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js +26 -5
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth-extensions.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts +11 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js +96 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js +11 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/client/simpleClientCredentials.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js +6 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/auth/providers/proxyProvider.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts +3 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js +12 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts +43 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js +26 -5
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth-extensions.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts +11 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js +96 -14
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js +11 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/client/simpleClientCredentials.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts +2 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/server/demoInMemoryOAuthProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js +6 -3
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts +3 -0
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js +12 -2
- package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map +1 -1
- package/node_modules/@modelcontextprotocol/sdk/package.json +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/hono/dist/_virtual/_rolldown/runtime.js +13 -0
- package/node_modules/hono/dist/adapter/aws-lambda/conninfo.js +42 -23
- package/node_modules/hono/dist/adapter/aws-lambda/handler.js +318 -344
- package/node_modules/hono/dist/adapter/aws-lambda/index.js +2 -8
- package/node_modules/hono/dist/adapter/aws-lambda/types.js +1 -0
- package/node_modules/hono/dist/adapter/bun/conninfo.js +20 -25
- package/node_modules/hono/dist/adapter/bun/index.js +3 -13
- package/node_modules/hono/dist/adapter/bun/serve-static.js +27 -27
- package/node_modules/hono/dist/adapter/bun/server.js +11 -5
- package/node_modules/hono/dist/adapter/bun/ssg.js +25 -15
- package/node_modules/hono/dist/adapter/bun/websocket.js +61 -68
- package/node_modules/hono/dist/adapter/cloudflare-pages/conninfo.js +24 -9
- package/node_modules/hono/dist/adapter/cloudflare-pages/handler.js +59 -62
- package/node_modules/hono/dist/adapter/cloudflare-pages/index.js +2 -8
- package/node_modules/hono/dist/adapter/cloudflare-workers/conninfo.js +7 -9
- package/node_modules/hono/dist/adapter/cloudflare-workers/index.js +3 -8
- package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static-module.js +5 -6
- package/node_modules/hono/dist/adapter/cloudflare-workers/serve-static.js +26 -20
- package/node_modules/hono/dist/adapter/cloudflare-workers/utils.js +21 -34
- package/node_modules/hono/dist/adapter/cloudflare-workers/websocket.js +31 -39
- package/node_modules/hono/dist/adapter/deno/conninfo.js +16 -13
- package/node_modules/hono/dist/adapter/deno/deno.d.js +1 -0
- package/node_modules/hono/dist/adapter/deno/index.js +3 -10
- package/node_modules/hono/dist/adapter/deno/serve-static.js +33 -38
- package/node_modules/hono/dist/adapter/deno/ssg.js +27 -16
- package/node_modules/hono/dist/adapter/deno/websocket.js +30 -30
- package/node_modules/hono/dist/adapter/lambda-edge/conninfo.js +7 -9
- package/node_modules/hono/dist/adapter/lambda-edge/handler.js +102 -101
- package/node_modules/hono/dist/adapter/lambda-edge/index.js +2 -6
- package/node_modules/hono/dist/adapter/netlify/conninfo.js +24 -9
- package/node_modules/hono/dist/adapter/netlify/handler.js +10 -8
- package/node_modules/hono/dist/adapter/netlify/index.js +3 -2
- package/node_modules/hono/dist/adapter/netlify/mod.js +2 -6
- package/node_modules/hono/dist/adapter/service-worker/handler.js +15 -19
- package/node_modules/hono/dist/adapter/service-worker/index.js +23 -7
- package/node_modules/hono/dist/adapter/service-worker/types.js +1 -0
- package/node_modules/hono/dist/adapter/vercel/conninfo.js +7 -10
- package/node_modules/hono/dist/adapter/vercel/handler.js +8 -6
- package/node_modules/hono/dist/adapter/vercel/index.js +2 -6
- package/node_modules/hono/dist/cjs/_virtual/_rolldown/runtime.js +33 -0
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/conninfo.js +42 -44
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +326 -373
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/index.js +7 -34
- package/node_modules/hono/dist/cjs/adapter/aws-lambda/types.js +0 -15
- package/node_modules/hono/dist/cjs/adapter/bun/conninfo.js +21 -47
- package/node_modules/hono/dist/cjs/adapter/bun/index.js +14 -45
- package/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +29 -50
- package/node_modules/hono/dist/cjs/adapter/bun/server.js +11 -26
- package/node_modules/hono/dist/cjs/adapter/bun/ssg.js +24 -35
- package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +63 -91
- package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/conninfo.js +25 -31
- package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/handler.js +61 -85
- package/node_modules/hono/dist/cjs/adapter/cloudflare-pages/index.js +7 -34
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/conninfo.js +8 -31
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/index.js +7 -33
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static-module.js +7 -29
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/serve-static.js +27 -42
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/utils.js +21 -55
- package/node_modules/hono/dist/cjs/adapter/cloudflare-workers/websocket.js +33 -62
- package/node_modules/hono/dist/cjs/adapter/deno/conninfo.js +16 -34
- package/node_modules/hono/dist/cjs/adapter/deno/index.js +10 -38
- package/node_modules/hono/dist/cjs/adapter/deno/serve-static.js +33 -59
- package/node_modules/hono/dist/cjs/adapter/deno/ssg.js +27 -37
- package/node_modules/hono/dist/cjs/adapter/deno/websocket.js +32 -53
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/conninfo.js +8 -31
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +102 -130
- package/node_modules/hono/dist/cjs/adapter/lambda-edge/index.js +5 -30
- package/node_modules/hono/dist/cjs/adapter/netlify/conninfo.js +25 -31
- package/node_modules/hono/dist/cjs/adapter/netlify/handler.js +10 -29
- package/node_modules/hono/dist/cjs/adapter/netlify/index.js +5 -21
- package/node_modules/hono/dist/cjs/adapter/netlify/mod.js +5 -30
- package/node_modules/hono/dist/cjs/adapter/service-worker/handler.js +16 -41
- package/node_modules/hono/dist/cjs/adapter/service-worker/index.js +25 -30
- package/node_modules/hono/dist/cjs/adapter/service-worker/types.js +0 -15
- package/node_modules/hono/dist/cjs/adapter/vercel/conninfo.js +8 -32
- package/node_modules/hono/dist/cjs/adapter/vercel/handler.js +8 -27
- package/node_modules/hono/dist/cjs/adapter/vercel/index.js +5 -30
- package/node_modules/hono/dist/cjs/client/client.js +139 -212
- package/node_modules/hono/dist/cjs/client/fetch-result-please.js +62 -80
- package/node_modules/hono/dist/cjs/client/index.js +7 -32
- package/node_modules/hono/dist/cjs/client/types.js +0 -15
- package/node_modules/hono/dist/cjs/client/utils.js +54 -92
- package/node_modules/hono/dist/cjs/compose.js +49 -66
- package/node_modules/hono/dist/cjs/context.js +379 -450
- package/node_modules/hono/dist/cjs/helper/accepts/accepts.js +47 -72
- package/node_modules/hono/dist/cjs/helper/accepts/index.js +3 -27
- package/node_modules/hono/dist/cjs/helper/adapter/index.js +33 -73
- package/node_modules/hono/dist/cjs/helper/conninfo/index.js +0 -15
- package/node_modules/hono/dist/cjs/helper/conninfo/types.js +0 -15
- package/node_modules/hono/dist/cjs/helper/cookie/index.js +75 -116
- package/node_modules/hono/dist/cjs/helper/css/common.js +165 -244
- package/node_modules/hono/dist/cjs/helper/css/index.js +136 -151
- package/node_modules/hono/dist/cjs/helper/dev/index.js +45 -71
- package/node_modules/hono/dist/cjs/helper/factory/index.js +30 -51
- package/node_modules/hono/dist/cjs/helper/html/index.js +32 -62
- package/node_modules/hono/dist/cjs/helper/proxy/index.js +113 -106
- package/node_modules/hono/dist/cjs/helper/route/index.js +123 -66
- package/node_modules/hono/dist/cjs/helper/ssg/index.js +19 -43
- package/node_modules/hono/dist/cjs/helper/ssg/middleware.js +56 -64
- package/node_modules/hono/dist/cjs/helper/ssg/plugins.js +55 -57
- package/node_modules/hono/dist/cjs/helper/ssg/ssg.js +196 -296
- package/node_modules/hono/dist/cjs/helper/ssg/utils.js +47 -90
- package/node_modules/hono/dist/cjs/helper/streaming/index.js +8 -35
- package/node_modules/hono/dist/cjs/helper/streaming/sse.js +53 -85
- package/node_modules/hono/dist/cjs/helper/streaming/stream.js +23 -53
- package/node_modules/hono/dist/cjs/helper/streaming/text.js +10 -32
- package/node_modules/hono/dist/cjs/helper/streaming/utils.js +13 -32
- package/node_modules/hono/dist/cjs/helper/testing/index.js +16 -31
- package/node_modules/hono/dist/cjs/helper/websocket/index.js +51 -76
- package/node_modules/hono/dist/cjs/hono-base.js +345 -403
- package/node_modules/hono/dist/cjs/hono.js +28 -42
- package/node_modules/hono/dist/cjs/http-exception.js +55 -56
- package/node_modules/hono/dist/cjs/index.js +22 -30
- package/node_modules/hono/dist/cjs/jsx/base.js +237 -366
- package/node_modules/hono/dist/cjs/jsx/children.js +16 -41
- package/node_modules/hono/dist/cjs/jsx/components.js +119 -192
- package/node_modules/hono/dist/cjs/jsx/constants.js +15 -42
- package/node_modules/hono/dist/cjs/jsx/context.js +144 -162
- package/node_modules/hono/dist/cjs/jsx/dom/client.js +49 -69
- package/node_modules/hono/dist/cjs/jsx/dom/components.js +23 -52
- package/node_modules/hono/dist/cjs/jsx/dom/context.js +39 -67
- package/node_modules/hono/dist/cjs/jsx/dom/css.js +143 -158
- package/node_modules/hono/dist/cjs/jsx/dom/hooks/index.js +55 -64
- package/node_modules/hono/dist/cjs/jsx/dom/index.js +114 -173
- package/node_modules/hono/dist/cjs/jsx/dom/intrinsic-element/components.js +282 -375
- package/node_modules/hono/dist/cjs/jsx/dom/jsx-dev-runtime.js +14 -49
- package/node_modules/hono/dist/cjs/jsx/dom/jsx-runtime.js +5 -32
- package/node_modules/hono/dist/cjs/jsx/dom/render.js +469 -623
- package/node_modules/hono/dist/cjs/jsx/dom/server.js +37 -64
- package/node_modules/hono/dist/cjs/jsx/dom/utils.js +7 -30
- package/node_modules/hono/dist/cjs/jsx/hooks/index.js +225 -318
- package/node_modules/hono/dist/cjs/jsx/index.js +86 -135
- package/node_modules/hono/dist/cjs/jsx/intrinsic-element/common.js +20 -43
- package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +117 -168
- package/node_modules/hono/dist/cjs/jsx/intrinsic-elements.js +0 -15
- package/node_modules/hono/dist/cjs/jsx/jsx-dev-runtime.js +14 -39
- package/node_modules/hono/dist/cjs/jsx/jsx-runtime.js +34 -68
- package/node_modules/hono/dist/cjs/jsx/streaming.js +123 -166
- package/node_modules/hono/dist/cjs/jsx/types.js +0 -15
- package/node_modules/hono/dist/cjs/jsx/utils.js +91 -175
- package/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +98 -86
- package/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +92 -109
- package/node_modules/hono/dist/cjs/middleware/body-limit/index.js +66 -72
- package/node_modules/hono/dist/cjs/middleware/cache/index.js +153 -199
- package/node_modules/hono/dist/cjs/middleware/combine/index.js +135 -95
- package/node_modules/hono/dist/cjs/middleware/compress/index.js +73 -88
- package/node_modules/hono/dist/cjs/middleware/context-storage/index.js +49 -41
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +107 -107
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +101 -72
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +58 -97
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +71 -91
- package/node_modules/hono/dist/cjs/middleware/ip-restriction/index.js +161 -169
- package/node_modules/hono/dist/cjs/middleware/jsx-renderer/index.js +99 -77
- package/node_modules/hono/dist/cjs/middleware/jwk/index.js +3 -27
- package/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +118 -135
- package/node_modules/hono/dist/cjs/middleware/jwt/index.js +9 -38
- package/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +120 -141
- package/node_modules/hono/dist/cjs/middleware/language/index.js +7 -35
- package/node_modules/hono/dist/cjs/middleware/language/language.js +184 -182
- package/node_modules/hono/dist/cjs/middleware/logger/index.js +41 -62
- package/node_modules/hono/dist/cjs/middleware/method-not-allowed/index.js +82 -88
- package/node_modules/hono/dist/cjs/middleware/method-override/index.js +101 -102
- package/node_modules/hono/dist/cjs/middleware/powered-by/index.js +23 -30
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +38 -42
- package/node_modules/hono/dist/cjs/middleware/request-id/index.js +3 -27
- package/node_modules/hono/dist/cjs/middleware/request-id/request-id.js +34 -42
- package/node_modules/hono/dist/cjs/middleware/secure-headers/index.js +4 -29
- package/node_modules/hono/dist/cjs/middleware/secure-headers/permissions-policy.js +0 -15
- package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +142 -174
- package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +56 -93
- package/node_modules/hono/dist/cjs/middleware/serve-static/path.js +15 -38
- package/node_modules/hono/dist/cjs/middleware/timeout/index.js +40 -45
- package/node_modules/hono/dist/cjs/middleware/timing/index.js +7 -35
- package/node_modules/hono/dist/cjs/middleware/timing/timing.js +177 -118
- package/node_modules/hono/dist/cjs/middleware/trailing-slash/index.js +85 -58
- package/node_modules/hono/dist/cjs/preset/quick.js +18 -37
- package/node_modules/hono/dist/cjs/preset/tiny.js +15 -33
- package/node_modules/hono/dist/cjs/request/constants.js +5 -27
- package/node_modules/hono/dist/cjs/request.js +334 -346
- package/node_modules/hono/dist/cjs/router/linear-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +95 -143
- package/node_modules/hono/dist/cjs/router/pattern-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +41 -63
- package/node_modules/hono/dist/cjs/router/reg-exp-router/index.js +7 -34
- package/node_modules/hono/dist/cjs/router/reg-exp-router/matcher.js +18 -45
- package/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +91 -135
- package/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +92 -161
- package/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +98 -147
- package/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +73 -89
- package/node_modules/hono/dist/cjs/router/smart-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/smart-router/router.js +49 -79
- package/node_modules/hono/dist/cjs/router/trie-router/index.js +3 -27
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +134 -186
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +15 -39
- package/node_modules/hono/dist/cjs/router/utils.js +5 -27
- package/node_modules/hono/dist/cjs/router.js +37 -37
- package/node_modules/hono/dist/cjs/types.js +5 -28
- package/node_modules/hono/dist/cjs/utils/accept.js +177 -225
- package/node_modules/hono/dist/cjs/utils/basic-auth.js +16 -40
- package/node_modules/hono/dist/cjs/utils/body.js +84 -110
- package/node_modules/hono/dist/cjs/utils/buffer.js +43 -91
- package/node_modules/hono/dist/cjs/utils/color.js +35 -44
- package/node_modules/hono/dist/cjs/utils/compress.js +11 -26
- package/node_modules/hono/dist/cjs/utils/concurrent.js +29 -59
- package/node_modules/hono/dist/cjs/utils/constants.js +7 -26
- package/node_modules/hono/dist/cjs/utils/cookie.js +107 -177
- package/node_modules/hono/dist/cjs/utils/crypto.js +30 -61
- package/node_modules/hono/dist/cjs/utils/encode.js +31 -48
- package/node_modules/hono/dist/cjs/utils/filepath.js +23 -54
- package/node_modules/hono/dist/cjs/utils/handler.js +11 -33
- package/node_modules/hono/dist/cjs/utils/headers.js +0 -15
- package/node_modules/hono/dist/cjs/utils/html.js +96 -137
- package/node_modules/hono/dist/cjs/utils/http-status.js +0 -15
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +213 -286
- package/node_modules/hono/dist/cjs/utils/jwt/index.js +14 -27
- package/node_modules/hono/dist/cjs/utils/jwt/jwa.js +25 -42
- package/node_modules/hono/dist/cjs/utils/jwt/jws.js +119 -199
- package/node_modules/hono/dist/cjs/utils/jwt/jwt.js +122 -206
- package/node_modules/hono/dist/cjs/utils/jwt/types.js +122 -159
- package/node_modules/hono/dist/cjs/utils/jwt/utf8.js +9 -28
- package/node_modules/hono/dist/cjs/utils/mime.js +75 -101
- package/node_modules/hono/dist/cjs/utils/stream.js +88 -111
- package/node_modules/hono/dist/cjs/utils/types.js +0 -15
- package/node_modules/hono/dist/cjs/utils/url.js +185 -234
- package/node_modules/hono/dist/cjs/validator/index.js +3 -27
- package/node_modules/hono/dist/cjs/validator/utils.js +0 -15
- package/node_modules/hono/dist/cjs/validator/validator.js +60 -103
- package/node_modules/hono/dist/client/client.js +138 -197
- package/node_modules/hono/dist/client/fetch-result-please.js +59 -56
- package/node_modules/hono/dist/client/index.js +3 -7
- package/node_modules/hono/dist/client/types.js +1 -0
- package/node_modules/hono/dist/client/utils.js +51 -68
- package/node_modules/hono/dist/compose.js +49 -45
- package/node_modules/hono/dist/context.js +376 -426
- package/node_modules/hono/dist/helper/accepts/accepts.js +47 -51
- package/node_modules/hono/dist/helper/accepts/index.js +1 -4
- package/node_modules/hono/dist/helper/adapter/index.js +33 -52
- package/node_modules/hono/dist/helper/conninfo/index.js +1 -0
- package/node_modules/hono/dist/helper/conninfo/types.js +1 -0
- package/node_modules/hono/dist/helper/cookie/index.js +74 -94
- package/node_modules/hono/dist/helper/css/common.js +167 -225
- package/node_modules/hono/dist/helper/css/index.js +132 -137
- package/node_modules/hono/dist/helper/dev/index.js +44 -49
- package/node_modules/hono/dist/helper/factory/index.js +27 -27
- package/node_modules/hono/dist/helper/html/index.js +30 -39
- package/node_modules/hono/dist/helper/proxy/index.js +116 -88
- package/node_modules/hono/dist/helper/route/index.js +121 -43
- package/node_modules/hono/dist/helper/ssg/index.js +3 -18
- package/node_modules/hono/dist/helper/ssg/middleware.js +53 -40
- package/node_modules/hono/dist/helper/ssg/plugins.js +55 -36
- package/node_modules/hono/dist/helper/ssg/ssg.js +198 -283
- package/node_modules/hono/dist/helper/ssg/utils.js +53 -75
- package/node_modules/hono/dist/helper/streaming/index.js +2 -8
- package/node_modules/hono/dist/helper/streaming/sse.js +50 -61
- package/node_modules/hono/dist/helper/streaming/stream.js +22 -31
- package/node_modules/hono/dist/helper/streaming/text.js +9 -10
- package/node_modules/hono/dist/helper/streaming/utils.js +9 -12
- package/node_modules/hono/dist/helper/testing/index.js +16 -10
- package/node_modules/hono/dist/helper/websocket/index.js +49 -53
- package/node_modules/hono/dist/hono-base.js +342 -379
- package/node_modules/hono/dist/hono.js +27 -20
- package/node_modules/hono/dist/http-exception.js +53 -33
- package/node_modules/hono/dist/index.js +19 -6
- package/node_modules/hono/dist/jsx/base.js +231 -340
- package/node_modules/hono/dist/jsx/children.js +16 -20
- package/node_modules/hono/dist/jsx/components.js +118 -170
- package/node_modules/hono/dist/jsx/constants.js +9 -15
- package/node_modules/hono/dist/jsx/context.js +153 -150
- package/node_modules/hono/dist/jsx/dom/client.js +45 -48
- package/node_modules/hono/dist/jsx/dom/components.js +21 -29
- package/node_modules/hono/dist/jsx/dom/context.js +37 -44
- package/node_modules/hono/dist/jsx/dom/css.js +142 -147
- package/node_modules/hono/dist/jsx/dom/hooks/index.js +52 -40
- package/node_modules/hono/dist/jsx/dom/index.js +71 -134
- package/node_modules/hono/dist/jsx/dom/intrinsic-element/components.js +275 -359
- package/node_modules/hono/dist/jsx/dom/jsx-dev-runtime.js +14 -18
- package/node_modules/hono/dist/jsx/dom/jsx-runtime.js +2 -8
- package/node_modules/hono/dist/jsx/dom/render.js +492 -631
- package/node_modules/hono/dist/jsx/dom/server.js +32 -32
- package/node_modules/hono/dist/jsx/dom/utils.js +6 -8
- package/node_modules/hono/dist/jsx/hooks/index.js +236 -308
- package/node_modules/hono/dist/jsx/index.js +45 -98
- package/node_modules/hono/dist/jsx/intrinsic-element/common.js +20 -22
- package/node_modules/hono/dist/jsx/intrinsic-element/components.js +113 -154
- package/node_modules/hono/dist/jsx/intrinsic-elements.js +1 -0
- package/node_modules/hono/dist/jsx/jsx-dev-runtime.js +12 -16
- package/node_modules/hono/dist/jsx/jsx-runtime.js +29 -42
- package/node_modules/hono/dist/jsx/streaming.js +120 -142
- package/node_modules/hono/dist/jsx/types.js +1 -0
- package/node_modules/hono/dist/jsx/utils.js +105 -168
- package/node_modules/hono/dist/middleware/basic-auth/index.js +96 -63
- package/node_modules/hono/dist/middleware/bearer-auth/index.js +93 -89
- package/node_modules/hono/dist/middleware/body-limit/index.js +66 -51
- package/node_modules/hono/dist/middleware/cache/index.js +165 -190
- package/node_modules/hono/dist/middleware/combine/index.js +134 -73
- package/node_modules/hono/dist/middleware/compress/index.js +75 -69
- package/node_modules/hono/dist/middleware/context-storage/index.js +49 -19
- package/node_modules/hono/dist/middleware/cors/index.js +107 -86
- package/node_modules/hono/dist/middleware/csrf/index.js +103 -53
- package/node_modules/hono/dist/middleware/etag/digest.js +59 -77
- package/node_modules/hono/dist/middleware/etag/index.js +71 -70
- package/node_modules/hono/dist/middleware/ip-restriction/index.js +163 -158
- package/node_modules/hono/dist/middleware/jsx-renderer/index.js +97 -54
- package/node_modules/hono/dist/middleware/jwk/index.js +1 -4
- package/node_modules/hono/dist/middleware/jwk/jwk.js +116 -112
- package/node_modules/hono/dist/middleware/jwt/index.js +2 -10
- package/node_modules/hono/dist/middleware/jwt/jwt.js +114 -114
- package/node_modules/hono/dist/middleware/language/index.js +2 -15
- package/node_modules/hono/dist/middleware/language/language.js +180 -157
- package/node_modules/hono/dist/middleware/logger/index.js +43 -37
- package/node_modules/hono/dist/middleware/method-not-allowed/index.js +81 -66
- package/node_modules/hono/dist/middleware/method-override/index.js +101 -81
- package/node_modules/hono/dist/middleware/powered-by/index.js +23 -9
- package/node_modules/hono/dist/middleware/pretty-json/index.js +39 -22
- package/node_modules/hono/dist/middleware/request-id/index.js +1 -4
- package/node_modules/hono/dist/middleware/request-id/request-id.js +33 -20
- package/node_modules/hono/dist/middleware/secure-headers/index.js +1 -5
- package/node_modules/hono/dist/middleware/secure-headers/permissions-policy.js +1 -0
- package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +144 -155
- package/node_modules/hono/dist/middleware/serve-static/index.js +56 -72
- package/node_modules/hono/dist/middleware/serve-static/path.js +15 -17
- package/node_modules/hono/dist/middleware/timeout/index.js +40 -23
- package/node_modules/hono/dist/middleware/timing/index.js +2 -9
- package/node_modules/hono/dist/middleware/timing/timing.js +177 -97
- package/node_modules/hono/dist/middleware/trailing-slash/index.js +85 -37
- package/node_modules/hono/dist/preset/quick.js +17 -15
- package/node_modules/hono/dist/preset/tiny.js +14 -11
- package/node_modules/hono/dist/request/constants.js +4 -5
- package/node_modules/hono/dist/request.js +328 -319
- package/node_modules/hono/dist/router/linear-router/index.js +1 -4
- package/node_modules/hono/dist/router/linear-router/router.js +93 -120
- package/node_modules/hono/dist/router/pattern-router/index.js +1 -4
- package/node_modules/hono/dist/router/pattern-router/router.js +39 -40
- package/node_modules/hono/dist/router/reg-exp-router/index.js +1 -7
- package/node_modules/hono/dist/router/reg-exp-router/matcher.js +17 -23
- package/node_modules/hono/dist/router/reg-exp-router/node.js +87 -110
- package/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +89 -137
- package/node_modules/hono/dist/router/reg-exp-router/router.js +92 -129
- package/node_modules/hono/dist/router/reg-exp-router/trie.js +69 -64
- package/node_modules/hono/dist/router/smart-router/index.js +1 -4
- package/node_modules/hono/dist/router/smart-router/router.js +46 -55
- package/node_modules/hono/dist/router/trie-router/index.js +1 -4
- package/node_modules/hono/dist/router/trie-router/node.js +131 -162
- package/node_modules/hono/dist/router/trie-router/router.js +11 -14
- package/node_modules/hono/dist/router/utils.js +4 -5
- package/node_modules/hono/dist/router.js +35 -14
- package/node_modules/hono/dist/types/adapter/aws-lambda/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/aws-lambda/handler.d.ts +150 -104
- package/node_modules/hono/dist/types/adapter/aws-lambda/index.d.ts +4 -8
- package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +152 -122
- package/node_modules/hono/dist/types/adapter/bun/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/bun/index.d.ts +6 -10
- package/node_modules/hono/dist/types/adapter/bun/serve-static.d.ts +7 -2
- package/node_modules/hono/dist/types/adapter/bun/server.d.ts +4 -5
- package/node_modules/hono/dist/types/adapter/bun/ssg.d.ts +5 -1
- package/node_modules/hono/dist/types/adapter/bun/websocket.d.ts +31 -16
- package/node_modules/hono/dist/types/adapter/cloudflare-pages/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/cloudflare-pages/handler.d.ts +29 -17
- package/node_modules/hono/dist/types/adapter/cloudflare-pages/index.d.ts +3 -7
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/conninfo.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/index.d.ts +4 -7
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static-module.d.ts +5 -2
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/serve-static.d.ts +10 -5
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/utils.d.ts +10 -2
- package/node_modules/hono/dist/types/adapter/cloudflare-workers/websocket.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/deno/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/deno/deno.d.ts +1 -0
- package/node_modules/hono/dist/types/adapter/deno/index.d.ts +5 -8
- package/node_modules/hono/dist/types/adapter/deno/serve-static.d.ts +7 -2
- package/node_modules/hono/dist/types/adapter/deno/ssg.d.ts +5 -1
- package/node_modules/hono/dist/types/adapter/deno/websocket.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/lambda-edge/conninfo.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +83 -57
- package/node_modules/hono/dist/types/adapter/lambda-edge/index.d.ts +3 -7
- package/node_modules/hono/dist/types/adapter/netlify/conninfo.d.ts +4 -1
- package/node_modules/hono/dist/types/adapter/netlify/handler.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/netlify/index.d.ts +3 -5
- package/node_modules/hono/dist/types/adapter/netlify/mod.d.ts +3 -2
- package/node_modules/hono/dist/types/adapter/service-worker/handler.d.ts +9 -7
- package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +7 -9
- package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -7
- package/node_modules/hono/dist/types/adapter/vercel/conninfo.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/vercel/handler.d.ts +6 -1
- package/node_modules/hono/dist/types/adapter/vercel/index.d.ts +3 -6
- package/node_modules/hono/dist/types/client/client.d.ts +5 -3
- package/node_modules/hono/dist/types/client/fetch-result-please.d.ts +21 -19
- package/node_modules/hono/dist/types/client/index.d.ts +5 -7
- package/node_modules/hono/dist/types/client/types.d.ts +134 -159
- package/node_modules/hono/dist/types/client/utils.d.ts +6 -4
- package/node_modules/hono/dist/types/compose.d.ts +4 -2
- package/node_modules/hono/dist/types/context.d.ts +335 -335
- package/node_modules/hono/dist/types/helper/accepts/accepts.d.ts +11 -9
- package/node_modules/hono/dist/types/helper/accepts/index.d.ts +2 -5
- package/node_modules/hono/dist/types/helper/adapter/index.d.ts +4 -6
- package/node_modules/hono/dist/types/helper/conninfo/index.d.ts +2 -5
- package/node_modules/hono/dist/types/helper/conninfo/types.d.ts +25 -23
- package/node_modules/hono/dist/types/helper/cookie/index.d.ts +10 -12
- package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -9
- package/node_modules/hono/dist/types/helper/css/index.d.ts +26 -28
- package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -12
- package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -73
- package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
- package/node_modules/hono/dist/types/helper/proxy/index.d.ts +19 -21
- package/node_modules/hono/dist/types/helper/route/index.d.ts +4 -2
- package/node_modules/hono/dist/types/helper/ssg/index.d.ts +4 -7
- package/node_modules/hono/dist/types/helper/ssg/middleware.d.ts +8 -6
- package/node_modules/hono/dist/types/helper/ssg/plugins.d.ts +3 -1
- package/node_modules/hono/dist/types/helper/ssg/ssg.d.ts +38 -36
- package/node_modules/hono/dist/types/helper/ssg/utils.d.ts +5 -3
- package/node_modules/hono/dist/types/helper/streaming/index.d.ts +4 -8
- package/node_modules/hono/dist/types/helper/streaming/sse.d.ts +10 -8
- package/node_modules/hono/dist/types/helper/streaming/stream.d.ts +4 -2
- package/node_modules/hono/dist/types/helper/streaming/text.d.ts +4 -2
- package/node_modules/hono/dist/types/helper/streaming/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/helper/testing/index.d.ts +7 -9
- package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
- package/node_modules/hono/dist/types/hono-base.d.ts +208 -210
- package/node_modules/hono/dist/types/hono.d.ts +11 -10
- package/node_modules/hono/dist/types/http-exception.d.ts +20 -22
- package/node_modules/hono/dist/types/index.d.ts +6 -37
- package/node_modules/hono/dist/types/jsx/base.d.ts +36 -34
- package/node_modules/hono/dist/types/jsx/children.d.ts +8 -6
- package/node_modules/hono/dist/types/jsx/components.d.ts +8 -5
- package/node_modules/hono/dist/types/jsx/constants.d.ts +2 -0
- package/node_modules/hono/dist/types/jsx/context.d.ts +9 -6
- package/node_modules/hono/dist/types/jsx/dom/client.d.ts +9 -10
- package/node_modules/hono/dist/types/jsx/dom/components.d.ts +9 -6
- package/node_modules/hono/dist/types/jsx/dom/context.d.ts +3 -1
- package/node_modules/hono/dist/types/jsx/dom/css.d.ts +27 -30
- package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -12
- package/node_modules/hono/dist/types/jsx/dom/index.d.ts +79 -83
- package/node_modules/hono/dist/types/jsx/dom/intrinsic-element/components.d.ts +9 -5
- package/node_modules/hono/dist/types/jsx/dom/jsx-dev-runtime.d.ts +4 -6
- package/node_modules/hono/dist/types/jsx/dom/jsx-runtime.d.ts +3 -7
- package/node_modules/hono/dist/types/jsx/dom/render.d.ts +32 -50
- package/node_modules/hono/dist/types/jsx/dom/server.d.ts +87 -85
- package/node_modules/hono/dist/types/jsx/dom/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/jsx/hooks/index.d.ts +16 -16
- package/node_modules/hono/dist/types/jsx/index.d.ts +71 -73
- package/node_modules/hono/dist/types/jsx/intrinsic-element/common.d.ts +3 -1
- package/node_modules/hono/dist/types/jsx/intrinsic-element/components.d.ts +7 -4
- package/node_modules/hono/dist/types/jsx/intrinsic-elements.d.ts +708 -708
- package/node_modules/hono/dist/types/jsx/jsx-dev-runtime.d.ts +4 -7
- package/node_modules/hono/dist/types/jsx/jsx-runtime.d.ts +7 -10
- package/node_modules/hono/dist/types/jsx/streaming.d.ts +9 -10
- package/node_modules/hono/dist/types/jsx/types.d.ts +12 -13
- package/node_modules/hono/dist/types/jsx/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/basic-auth/index.d.ts +17 -19
- package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +46 -48
- package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/cache/index.d.ts +13 -15
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +4 -6
- package/node_modules/hono/dist/types/middleware/compress/index.d.ts +9 -10
- package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +4 -6
- package/node_modules/hono/dist/types/middleware/cors/index.d.ts +10 -12
- package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/etag/digest.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/etag/index.d.ts +6 -8
- package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -12
- package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +11 -11
- package/node_modules/hono/dist/types/middleware/jwk/index.d.ts +2 -1
- package/node_modules/hono/dist/types/middleware/jwk/jwk.d.ts +20 -23
- package/node_modules/hono/dist/types/middleware/jwt/index.d.ts +7 -6
- package/node_modules/hono/dist/types/middleware/jwt/jwt.d.ts +28 -30
- package/node_modules/hono/dist/types/middleware/language/index.d.ts +6 -5
- package/node_modules/hono/dist/types/middleware/language/language.d.ts +42 -44
- package/node_modules/hono/dist/types/middleware/logger/index.d.ts +3 -5
- package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +7 -9
- package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -16
- package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -10
- package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -20
- package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +6 -5
- package/node_modules/hono/dist/types/middleware/request-id/request-id.d.ts +9 -11
- package/node_modules/hono/dist/types/middleware/secure-headers/index.d.ts +6 -6
- package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -57
- package/node_modules/hono/dist/types/middleware/serve-static/index.d.ts +24 -24
- package/node_modules/hono/dist/types/middleware/serve-static/path.d.ts +2 -0
- package/node_modules/hono/dist/types/middleware/timeout/index.d.ts +5 -7
- package/node_modules/hono/dist/types/middleware/timing/index.d.ts +6 -5
- package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -20
- package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -37
- package/node_modules/hono/dist/types/preset/quick.d.ts +6 -9
- package/node_modules/hono/dist/types/preset/tiny.d.ts +6 -9
- package/node_modules/hono/dist/types/request/constants.d.ts +2 -0
- package/node_modules/hono/dist/types/request.d.ts +288 -286
- package/node_modules/hono/dist/types/router/linear-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/linear-router/router.d.ts +7 -5
- package/node_modules/hono/dist/types/router/pattern-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/pattern-router/router.d.ts +7 -5
- package/node_modules/hono/dist/types/router/reg-exp-router/index.d.ts +3 -6
- package/node_modules/hono/dist/types/router/reg-exp-router/matcher.d.ts +3 -1
- package/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +6 -4
- package/node_modules/hono/dist/types/router/reg-exp-router/prepared-router.d.ts +11 -10
- package/node_modules/hono/dist/types/router/reg-exp-router/router.d.ts +10 -9
- package/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +7 -5
- package/node_modules/hono/dist/types/router/smart-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/smart-router/router.d.ts +11 -9
- package/node_modules/hono/dist/types/router/trie-router/index.d.ts +2 -5
- package/node_modules/hono/dist/types/router/trie-router/node.d.ts +6 -4
- package/node_modules/hono/dist/types/router/trie-router/router.d.ts +7 -5
- package/node_modules/hono/dist/types/router/utils.d.ts +2 -0
- package/node_modules/hono/dist/types/router.d.ts +23 -22
- package/node_modules/hono/dist/types/types.d.ts +146 -505
- package/node_modules/hono/dist/types/utils/accept.d.ts +5 -3
- package/node_modules/hono/dist/types/utils/basic-auth.d.ts +4 -2
- package/node_modules/hono/dist/types/utils/body.d.ts +46 -50
- package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -5
- package/node_modules/hono/dist/types/utils/color.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/compress.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/concurrent.d.ts +6 -4
- package/node_modules/hono/dist/types/utils/constants.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/cookie.d.ts +20 -18
- package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -7
- package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -3
- package/node_modules/hono/dist/types/utils/handler.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/headers.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/html.d.ts +11 -9
- package/node_modules/hono/dist/types/utils/http-status.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/ipaddr.d.ts +4 -6
- package/node_modules/hono/dist/types/utils/jwt/index.d.ts +18 -12
- package/node_modules/hono/dist/types/utils/jwt/jwa.d.ts +15 -13
- package/node_modules/hono/dist/types/utils/jwt/jws.d.ts +4 -7
- package/node_modules/hono/dist/types/utils/jwt/jwt.d.ts +26 -29
- package/node_modules/hono/dist/types/utils/jwt/types.d.ts +48 -45
- package/node_modules/hono/dist/types/utils/jwt/utf8.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/mime.d.ts +60 -57
- package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
- package/node_modules/hono/dist/types/utils/types.d.ts +14 -26
- package/node_modules/hono/dist/types/utils/url.d.ts +2 -0
- package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
- package/node_modules/hono/dist/types/validator/utils.d.ts +6 -8
- package/node_modules/hono/dist/types/validator/validator.d.ts +11 -9
- package/node_modules/hono/dist/types.js +4 -6
- package/node_modules/hono/dist/utils/accept.js +185 -212
- package/node_modules/hono/dist/utils/basic-auth.js +18 -21
- package/node_modules/hono/dist/utils/body.js +87 -92
- package/node_modules/hono/dist/utils/buffer.js +44 -71
- package/node_modules/hono/dist/utils/color.js +33 -21
- package/node_modules/hono/dist/utils/compress.js +11 -5
- package/node_modules/hono/dist/utils/concurrent.js +29 -38
- package/node_modules/hono/dist/utils/constants.js +7 -5
- package/node_modules/hono/dist/utils/cookie.js +114 -163
- package/node_modules/hono/dist/utils/crypto.js +30 -40
- package/node_modules/hono/dist/utils/encode.js +30 -26
- package/node_modules/hono/dist/utils/filepath.js +23 -33
- package/node_modules/hono/dist/utils/handler.js +10 -11
- package/node_modules/hono/dist/utils/headers.js +1 -0
- package/node_modules/hono/dist/utils/html.js +97 -117
- package/node_modules/hono/dist/utils/http-status.js +1 -0
- package/node_modules/hono/dist/utils/ipaddr.js +227 -279
- package/node_modules/hono/dist/utils/jwt/index.js +12 -4
- package/node_modules/hono/dist/utils/jwt/jwa.js +24 -20
- package/node_modules/hono/dist/utils/jwt/jws.js +115 -174
- package/node_modules/hono/dist/utils/jwt/jwt.js +120 -198
- package/node_modules/hono/dist/utils/jwt/types.js +79 -95
- package/node_modules/hono/dist/utils/jwt/utf8.js +9 -7
- package/node_modules/hono/dist/utils/mime.js +74 -79
- package/node_modules/hono/dist/utils/stream.js +86 -88
- package/node_modules/hono/dist/utils/types.js +1 -0
- package/node_modules/hono/dist/utils/url.js +187 -215
- package/node_modules/hono/dist/validator/index.js +1 -4
- package/node_modules/hono/dist/validator/utils.js +1 -0
- package/node_modules/hono/dist/validator/validator.js +61 -83
- package/node_modules/hono/package.json +27 -27
- package/package.json +2 -2
- package/profiles/README.md +20 -0
- package/profiles/index.json +2 -1
- package/profiles/sales/0.1.profile.json +252 -0
- package/server.js +99 -0
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
|
|
6
6
|
// src/index.ts
|
|
7
7
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
8
|
-
import { existsSync as
|
|
9
|
-
import { dirname as
|
|
8
|
+
import { existsSync as existsSync9, readFileSync as readFileSync10, renameSync as renameSync2 } from "fs";
|
|
9
|
+
import { dirname as dirname8, join as join11 } from "path";
|
|
10
10
|
import { homedir as homedir7 } from "os";
|
|
11
11
|
import express from "express";
|
|
12
12
|
import { createProxyMiddleware } from "http-proxy-middleware";
|
|
@@ -110,6 +110,24 @@ var Vault = class {
|
|
|
110
110
|
this.clearKey();
|
|
111
111
|
this.lockedReason = "expired";
|
|
112
112
|
}
|
|
113
|
+
/** Lock because the live Authority Server key no longer matches the one
|
|
114
|
+
* pinned at pairing — see as-pairing.ts / gatekeeper.ts. Mirrors
|
|
115
|
+
* lockExpired() exactly; the only difference callers care about is WHY. */
|
|
116
|
+
lockAsKeyMismatch() {
|
|
117
|
+
this.clearKey();
|
|
118
|
+
this.lockedReason = "as-key-mismatch";
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Boot-time only: record that the gateway starts locked because the
|
|
122
|
+
* resolved Authority Server URL differs from the one it was last paired
|
|
123
|
+
* with. Deliberately does NOT call clearKey() — the vault always boots
|
|
124
|
+
* locked already (nothing has been unlocked yet in this process), so there
|
|
125
|
+
* is no session to end; this only attaches the reason so /health and the
|
|
126
|
+
* locked-agent notice can explain it instead of defaulting to "restart".
|
|
127
|
+
*/
|
|
128
|
+
markBootLockedAsUrlChanged() {
|
|
129
|
+
this.lockedReason = "as-url-changed";
|
|
130
|
+
}
|
|
113
131
|
/** What locked the vault, if known. `null` covers both "still unlocked"
|
|
114
132
|
* and the default boot-locked case — callers that care about the
|
|
115
133
|
* difference should check `isUnlocked()` first. */
|
|
@@ -300,10 +318,11 @@ async function configure(sessionCookie, vaultKeyHex) {
|
|
|
300
318
|
clearTimeout(timeout);
|
|
301
319
|
}
|
|
302
320
|
}
|
|
303
|
-
async function unconfigureSession() {
|
|
321
|
+
async function unconfigureSession(reason) {
|
|
304
322
|
const res = await fetch(`${MCP_BASE}/internal/clear-session`, {
|
|
305
323
|
method: "POST",
|
|
306
|
-
headers: internalHeaders()
|
|
324
|
+
headers: internalHeaders(),
|
|
325
|
+
body: JSON.stringify({ reason })
|
|
307
326
|
});
|
|
308
327
|
if (!res.ok) {
|
|
309
328
|
throw new Error(`MCP clear-session failed: ${res.status}`);
|
|
@@ -465,6 +484,13 @@ async function getEnrichedAuthorizations() {
|
|
|
465
484
|
if (!res.ok) throw new Error("Failed to fetch authorizations");
|
|
466
485
|
return res.json();
|
|
467
486
|
}
|
|
487
|
+
async function getSkippedCommitments() {
|
|
488
|
+
const res = await fetch(`${MCP_BASE}/internal/skipped-commitments`, {
|
|
489
|
+
headers: internalHeaders()
|
|
490
|
+
});
|
|
491
|
+
if (!res.ok) throw new Error("Failed to fetch skipped commitments");
|
|
492
|
+
return res.json();
|
|
493
|
+
}
|
|
468
494
|
async function getLocalEvidence() {
|
|
469
495
|
const res = await fetch(`${MCP_BASE}/internal/evidence`, {
|
|
470
496
|
headers: internalHeaders()
|
|
@@ -634,10 +660,86 @@ function clientVersionHeaders() {
|
|
|
634
660
|
};
|
|
635
661
|
}
|
|
636
662
|
|
|
663
|
+
// src/lib/as-pairing.ts
|
|
664
|
+
import { createHash as createHash2 } from "crypto";
|
|
665
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync3, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
|
|
666
|
+
import { dirname as dirname2, join as join3 } from "path";
|
|
667
|
+
function pairingPath(dataDir) {
|
|
668
|
+
return join3(dataDir, "as-pairing.json");
|
|
669
|
+
}
|
|
670
|
+
function readPairing(dataDir) {
|
|
671
|
+
const path = pairingPath(dataDir);
|
|
672
|
+
if (!existsSync2(path)) return null;
|
|
673
|
+
try {
|
|
674
|
+
const data = JSON.parse(readFileSync3(path, "utf-8"));
|
|
675
|
+
if (typeof data.asUrl !== "string" || typeof data.publicKeyHex !== "string") return null;
|
|
676
|
+
return { asUrl: data.asUrl, publicKeyHex: data.publicKeyHex, pairedAt: data.pairedAt ?? "" };
|
|
677
|
+
} catch {
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
function writePairing(dataDir, asUrl, publicKeyHex) {
|
|
682
|
+
const pairing = { asUrl, publicKeyHex, pairedAt: (/* @__PURE__ */ new Date()).toISOString() };
|
|
683
|
+
const path = pairingPath(dataDir);
|
|
684
|
+
mkdirSync2(dirname2(path), { recursive: true, mode: 448 });
|
|
685
|
+
writeFileSync2(path, JSON.stringify(pairing, null, 2), { encoding: "utf-8", mode: 384 });
|
|
686
|
+
return pairing;
|
|
687
|
+
}
|
|
688
|
+
function clearPairing(dataDir) {
|
|
689
|
+
const path = pairingPath(dataDir);
|
|
690
|
+
try {
|
|
691
|
+
if (existsSync2(path)) unlinkSync(path);
|
|
692
|
+
} catch {
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function fingerprintOf(publicKeyHex) {
|
|
696
|
+
const raw = Buffer.from(publicKeyHex, "hex");
|
|
697
|
+
const digest = createHash2("sha256").update(raw).digest("hex").toUpperCase();
|
|
698
|
+
return digest.match(/.{1,4}/g)?.join(":") ?? digest;
|
|
699
|
+
}
|
|
700
|
+
|
|
637
701
|
// src/routes/auth.ts
|
|
638
|
-
var
|
|
639
|
-
function
|
|
702
|
+
var DEFAULT_SP_URL = process.env.SUVEREN_AS_URL ?? "https://www.suveren.ai";
|
|
703
|
+
async function checkAsKeyBeforeLogin(asUrl, dataDir) {
|
|
704
|
+
let publicKeyHex;
|
|
705
|
+
try {
|
|
706
|
+
const res = await fetch(`${asUrl}/api/as/pubkey`, { signal: AbortSignal.timeout(5e3) });
|
|
707
|
+
if (!res.ok) {
|
|
708
|
+
return {
|
|
709
|
+
ok: false,
|
|
710
|
+
error: "as_unreachable",
|
|
711
|
+
message: `Could not reach the Authority Server at ${asUrl} to verify its signing key (HTTP ${res.status}). Refusing to sign in.`
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
const body = await res.json().catch(() => null);
|
|
715
|
+
if (!body || typeof body.publicKey !== "string" || !body.publicKey) {
|
|
716
|
+
return {
|
|
717
|
+
ok: false,
|
|
718
|
+
error: "as_unreachable",
|
|
719
|
+
message: `The Authority Server at ${asUrl} returned a malformed signing key. Refusing to sign in.`
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
publicKeyHex = body.publicKey;
|
|
723
|
+
} catch (err) {
|
|
724
|
+
return {
|
|
725
|
+
ok: false,
|
|
726
|
+
error: "as_unreachable",
|
|
727
|
+
message: `Could not reach the Authority Server at ${asUrl} to verify its signing key \u2014 ${err instanceof Error ? err.message : String(err)}. Refusing to sign in.`
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
const existing = readPairing(dataDir);
|
|
731
|
+
if (existing && existing.asUrl === asUrl && existing.publicKeyHex !== publicKeyHex) {
|
|
732
|
+
return {
|
|
733
|
+
ok: false,
|
|
734
|
+
error: "as_key_mismatch",
|
|
735
|
+
message: `The Authority Server at ${asUrl} presented a signing key that does not match the one pinned when this gateway last signed in (pinned fingerprint ${fingerprintOf(existing.publicKeyHex)}, now seeing ${fingerprintOf(publicKeyHex)}). Refusing to sign in. If the AS's key changed intentionally, an operator must clear the old pairing before signing in again.`
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
return { ok: true, publicKeyHex };
|
|
739
|
+
}
|
|
740
|
+
function createAuthRouter(vault2, logoutAuth, loginRateLimit2, onSessionEstablished, pairing) {
|
|
640
741
|
const router = Router();
|
|
742
|
+
const SP_URL2 = pairing?.asUrl ?? DEFAULT_SP_URL;
|
|
641
743
|
router.post("/login", loginRateLimit2, async (req, res) => {
|
|
642
744
|
const apiKey = req.headers["x-api-key"] || req.body?.apiKey;
|
|
643
745
|
const confirmWipe = req.body?.confirmWipe === true;
|
|
@@ -646,7 +748,18 @@ function createAuthRouter(vault2, logoutAuth, loginRateLimit2, onSessionEstablis
|
|
|
646
748
|
return;
|
|
647
749
|
}
|
|
648
750
|
try {
|
|
649
|
-
|
|
751
|
+
let keyCheck = null;
|
|
752
|
+
if (pairing) {
|
|
753
|
+
keyCheck = await checkAsKeyBeforeLogin(pairing.asUrl, pairing.dataDir);
|
|
754
|
+
if (!keyCheck.ok) {
|
|
755
|
+
res.status(keyCheck.error === "as_key_mismatch" ? 409 : 502).json({
|
|
756
|
+
error: keyCheck.error,
|
|
757
|
+
message: keyCheck.message
|
|
758
|
+
});
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
const spRes = await fetch(`${SP_URL2}/api/auth/session`, {
|
|
650
763
|
method: "POST",
|
|
651
764
|
headers: {
|
|
652
765
|
"Content-Type": "application/json",
|
|
@@ -662,6 +775,13 @@ function createAuthRouter(vault2, logoutAuth, loginRateLimit2, onSessionEstablis
|
|
|
662
775
|
res.status(spRes.status).json(err);
|
|
663
776
|
return;
|
|
664
777
|
}
|
|
778
|
+
if (pairing && keyCheck?.publicKeyHex) {
|
|
779
|
+
const existing = readPairing(pairing.dataDir);
|
|
780
|
+
if (!existing || existing.asUrl !== pairing.asUrl) {
|
|
781
|
+
writePairing(pairing.dataDir, pairing.asUrl, keyCheck.publicKeyHex);
|
|
782
|
+
console.error(`[Control Plane] Paired with Authority Server ${pairing.asUrl} (fingerprint ${fingerprintOf(keyCheck.publicKeyHex)})`);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
665
785
|
const data = await spRes.json();
|
|
666
786
|
const setCookieHeaders = spRes.headers.getSetCookie?.() ?? [];
|
|
667
787
|
const sessionCookie = setCookieHeaders.join("; ");
|
|
@@ -708,7 +828,7 @@ function createAuthRouter(vault2, logoutAuth, loginRateLimit2, onSessionEstablis
|
|
|
708
828
|
const kp = await loadOrGenerateKeyPair(vault2);
|
|
709
829
|
const localPubkeyB64 = Buffer.from(kp.publicKey).toString("base64");
|
|
710
830
|
const spCookie = vault2.getSpCookie();
|
|
711
|
-
const meKeyRes = await fetch(`${
|
|
831
|
+
const meKeyRes = await fetch(`${SP_URL2}/api/users/me/pubkey`, {
|
|
712
832
|
headers: spCookie ? { Cookie: spCookie } : {},
|
|
713
833
|
signal: AbortSignal.timeout(5e3)
|
|
714
834
|
});
|
|
@@ -720,7 +840,7 @@ function createAuthRouter(vault2, logoutAuth, loginRateLimit2, onSessionEstablis
|
|
|
720
840
|
needsUpdate = meKeyData.pubkey !== localPubkeyB64;
|
|
721
841
|
}
|
|
722
842
|
if (needsUpdate) {
|
|
723
|
-
const putRes = await fetch(`${
|
|
843
|
+
const putRes = await fetch(`${SP_URL2}/api/users/me/pubkey`, {
|
|
724
844
|
method: "PUT",
|
|
725
845
|
headers: {
|
|
726
846
|
"Content-Type": "application/json",
|
|
@@ -777,7 +897,7 @@ function createAuthRouter(vault2, logoutAuth, loginRateLimit2, onSessionEstablis
|
|
|
777
897
|
vault2.clearKey();
|
|
778
898
|
await Promise.allSettled([
|
|
779
899
|
unconfigureSession(),
|
|
780
|
-
cookie ? fetch(`${
|
|
900
|
+
cookie ? fetch(`${SP_URL2}/api/auth/logout`, {
|
|
781
901
|
method: "POST",
|
|
782
902
|
headers: { cookie, ...clientVersionHeaders() },
|
|
783
903
|
redirect: "manual"
|
|
@@ -1392,18 +1512,18 @@ async function testAIConnectivity(config) {
|
|
|
1392
1512
|
}
|
|
1393
1513
|
|
|
1394
1514
|
// src/lib/agent-brief-store.ts
|
|
1395
|
-
import { existsSync as
|
|
1515
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4 } from "fs";
|
|
1396
1516
|
import { homedir as homedir2 } from "os";
|
|
1397
|
-
import { join as
|
|
1517
|
+
import { join as join4 } from "path";
|
|
1398
1518
|
var AGENT_CONTEXT_MAX_BYTES = 16 * 1024;
|
|
1399
1519
|
function agentBriefPath() {
|
|
1400
|
-
const dataDir = process.env.SUVEREN_DATA_DIR ??
|
|
1401
|
-
return
|
|
1520
|
+
const dataDir = process.env.SUVEREN_DATA_DIR ?? join4(homedir2(), ".suveren");
|
|
1521
|
+
return join4(dataDir, "context.md");
|
|
1402
1522
|
}
|
|
1403
1523
|
function readAgentBrief() {
|
|
1404
1524
|
const filePath = agentBriefPath();
|
|
1405
|
-
if (!
|
|
1406
|
-
return
|
|
1525
|
+
if (!existsSync3(filePath)) return "";
|
|
1526
|
+
return readFileSync4(filePath, "utf-8");
|
|
1407
1527
|
}
|
|
1408
1528
|
|
|
1409
1529
|
// src/routes/ai.ts
|
|
@@ -1767,28 +1887,28 @@ function createMCPRouter() {
|
|
|
1767
1887
|
// src/routes/autostart.ts
|
|
1768
1888
|
import { Router as Router6 } from "express";
|
|
1769
1889
|
import { execFile } from "child_process";
|
|
1770
|
-
import { existsSync as
|
|
1890
|
+
import { existsSync as existsSync4 } from "fs";
|
|
1771
1891
|
import { dirname as pathDirname, resolve } from "path";
|
|
1772
1892
|
import { fileURLToPath } from "url";
|
|
1773
1893
|
import { promisify } from "util";
|
|
1774
1894
|
var run = promisify(execFile);
|
|
1775
1895
|
var SUPPORTED = /* @__PURE__ */ new Set(["darwin", "win32", "linux"]);
|
|
1776
1896
|
var MODULE_DIR = pathDirname(fileURLToPath(import.meta.url));
|
|
1777
|
-
function findCli(
|
|
1897
|
+
function findCli(dirname9 = MODULE_DIR) {
|
|
1778
1898
|
const candidates = [
|
|
1779
1899
|
// Bundled (the shipped layout): dist/control-plane → dist → root → bin
|
|
1780
|
-
resolve(
|
|
1900
|
+
resolve(dirname9, "..", "..", "bin", "suveren-gateway.js"),
|
|
1781
1901
|
// Bundled, were the routes/ directory ever preserved.
|
|
1782
|
-
resolve(
|
|
1902
|
+
resolve(dirname9, "..", "..", "..", "bin", "suveren-gateway.js"),
|
|
1783
1903
|
// Dev, running from source: the repo's own bundle directory.
|
|
1784
|
-
resolve(
|
|
1785
|
-
resolve(
|
|
1904
|
+
resolve(dirname9, "..", "..", "..", "..", "bundle", "bin", "suveren-gateway.js"),
|
|
1905
|
+
resolve(dirname9, "..", "..", "..", "..", "..", "bundle", "bin", "suveren-gateway.js")
|
|
1786
1906
|
// Deliberately NO process.cwd() fallback: it makes the result depend on
|
|
1787
1907
|
// where the process happened to be launched from, so the same install
|
|
1788
1908
|
// resolves differently between a shell and a login service — and it would
|
|
1789
1909
|
// mask a genuinely missing CLI whenever the cwd happened to be the repo.
|
|
1790
1910
|
];
|
|
1791
|
-
return candidates.find(
|
|
1911
|
+
return candidates.find(existsSync4) ?? null;
|
|
1792
1912
|
}
|
|
1793
1913
|
async function cli(args) {
|
|
1794
1914
|
const bin = findCli();
|
|
@@ -1869,17 +1989,17 @@ function createAutostartRouter() {
|
|
|
1869
1989
|
import { spawn, spawnSync } from "child_process";
|
|
1870
1990
|
|
|
1871
1991
|
// src/lib/notifier-icon.ts
|
|
1872
|
-
import { writeFileSync as
|
|
1992
|
+
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync3, existsSync as existsSync5 } from "fs";
|
|
1873
1993
|
import { homedir as homedir3 } from "os";
|
|
1874
|
-
import { join as
|
|
1994
|
+
import { join as join5, dirname as dirname3 } from "path";
|
|
1875
1995
|
var ICON_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAACXBIWXMAACxLAAAsSwGlPZapAAAaEElEQVR42u2deXxNV9fH7/O2z/vHk+HmJoIoQQxpBtVPi+LTIWZqeDQ6V0tRFUWIeagSRAheyasxVNUsWtRQSquoMTRi9mgJooZWhBqaSIX97nWa9CVN4ubes8/Z55zf+ny+H1rknrv3Wr+zh7XXttmMaY94e3vXdDgcL3JifHx8ZnE2cvbw/z7MyeBc5eRxGABukFfgS+RTh8nHCnxtFvke+SD3xRrkkzaYGPP19fXmDd6eM403eDoCG0gqFPu5j07ltCOfReS6YbwRn+ANGsd/TeW/5sPBgMG4U+C7Ezh1ENFOGB9K+fLG6skbbiccCJgJ7tPH+K9D/f39KyLS/z7Eb84baD2pJpwFWGBksN5utzezetz/o2BevwdOASxKOn/5vUKxYKnA51/8tYLVejgBAA7HQUsIgZ+fXzB/43+LDgegWLZzwk0X+AEBAf/iX2wMtu8AePgaASeRvyy9zLKd147zMzoWgDLtGpzjv7Y1cuw/WvDWv4sOBcAl7tFogMfSfxsq8vlDB3IF240OBEAVfuDbhkGGCH7+oB35A19DpwGgKlf5S7WD7PP9DzDkB0DolCBG1mH/UHQQAJosEMZLdTS34GgkOgcA7fiMFtplCP7P0RkA6DISWK5nHQLK5Z+DjgBAVxGYrdecfwI6AAApGKv1an9vNDoAUo0EorXc58dWHwBycZeO1wvP8ONko7EBkDNZiL+gq4mK/38ivRcA6acCe4WcHeA//H/QwMAM+Po6WKNQH9arlZ0ldPZ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Xwj7bpYfzDk9ABAOga/LNsOtoj/AGWoyMA0CX4U/664FNnEZiJDgFAU+bR1rxNFuMPNBSdAoBxE33U2CLsjS1CAIRu9fWyyWwF5cSy0VkAqMoVzfb51cgYpAsI0WkAqDLk38er+lS3Gcwe5Q8/BlMCANw61ZcoLLdfo9HAi3Q2GZ0JQJk4q/qRXr2soKgIjQZuo2MBKBUqwZfo7+/vaTObeXl51eLzmU3oZACKZRsnzGZ24wsakfyLpqPDAVDY72rpbkMb/+LPcr6DAwCLru7vom1zl8t2m2hE0IQ3yDoHriYH5od8fB35vA32oHl7e/vyxumJHAJgwrf9MUqXL1++fAVEunPTgzBOLG+43RgZACO+6QtqaI6lC3YQ0W6Yn5+fF+UTFFQmTsN2IpAQ8skfuI8mkK+achtPInuEz6GCKFGC/9qfjiNzvi5Q3IOcjILzCHlwTOAmeQW+RD51kKan5Gv898n81+gCH6Q03f8yYiD9H4Lpi7OZQSaFAAAAAElFTkSuQmCC";
|
|
1876
1996
|
function ensureNotifierIcon(dataDir) {
|
|
1877
1997
|
try {
|
|
1878
|
-
const dir = dataDir ?? process.env.SUVEREN_DATA_DIR ??
|
|
1879
|
-
const path =
|
|
1880
|
-
if (!
|
|
1881
|
-
|
|
1882
|
-
|
|
1998
|
+
const dir = dataDir ?? process.env.SUVEREN_DATA_DIR ?? join5(homedir3(), ".suveren");
|
|
1999
|
+
const path = join5(dir, "notifier-icon.png");
|
|
2000
|
+
if (!existsSync5(path)) {
|
|
2001
|
+
mkdirSync3(dirname3(path), { recursive: true });
|
|
2002
|
+
writeFileSync3(path, Buffer.from(ICON_BASE64, "base64"));
|
|
1883
2003
|
}
|
|
1884
2004
|
return path;
|
|
1885
2005
|
} catch {
|
|
@@ -2081,24 +2201,24 @@ import { Router as Router9 } from "express";
|
|
|
2081
2201
|
|
|
2082
2202
|
// src/routes/approved-intents.ts
|
|
2083
2203
|
import { Router as Router8 } from "express";
|
|
2084
|
-
import { readFileSync as
|
|
2204
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync4, existsSync as existsSync6, mkdirSync as mkdirSync4 } from "fs";
|
|
2085
2205
|
import { homedir as homedir4 } from "os";
|
|
2086
|
-
import { join as
|
|
2087
|
-
var SUVEREN_DATA_DIR = process.env.SUVEREN_DATA_DIR ??
|
|
2088
|
-
var FILE_PATH =
|
|
2206
|
+
import { join as join6 } from "path";
|
|
2207
|
+
var SUVEREN_DATA_DIR = process.env.SUVEREN_DATA_DIR ?? join6(homedir4(), ".suveren");
|
|
2208
|
+
var FILE_PATH = join6(SUVEREN_DATA_DIR, "approved-intents.enc.json");
|
|
2089
2209
|
function readFile() {
|
|
2090
|
-
if (!
|
|
2210
|
+
if (!existsSync6(FILE_PATH)) {
|
|
2091
2211
|
return { version: 1, entries: {} };
|
|
2092
2212
|
}
|
|
2093
2213
|
try {
|
|
2094
|
-
return JSON.parse(
|
|
2214
|
+
return JSON.parse(readFileSync5(FILE_PATH, "utf-8"));
|
|
2095
2215
|
} catch {
|
|
2096
2216
|
return { version: 1, entries: {} };
|
|
2097
2217
|
}
|
|
2098
2218
|
}
|
|
2099
2219
|
function writeFile(data) {
|
|
2100
|
-
|
|
2101
|
-
|
|
2220
|
+
mkdirSync4(SUVEREN_DATA_DIR, { recursive: true });
|
|
2221
|
+
writeFileSync4(FILE_PATH, JSON.stringify(data, null, 2), "utf-8");
|
|
2102
2222
|
}
|
|
2103
2223
|
function readApprovedIntents(vault2) {
|
|
2104
2224
|
const file = readFile();
|
|
@@ -2363,7 +2483,7 @@ function createDecryptIntentRouter(vault2) {
|
|
|
2363
2483
|
|
|
2364
2484
|
// src/lib/update-checker.ts
|
|
2365
2485
|
import { execSync } from "child_process";
|
|
2366
|
-
import { dirname as
|
|
2486
|
+
import { dirname as dirname4 } from "path";
|
|
2367
2487
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2368
2488
|
var GHCR_IMAGE = "suverenai/suveren-gateway";
|
|
2369
2489
|
var NPM_PACKAGE = "@suveren/gateway";
|
|
@@ -2429,7 +2549,7 @@ function compareSemver(a, b) {
|
|
|
2429
2549
|
return 0;
|
|
2430
2550
|
}
|
|
2431
2551
|
function checkDev() {
|
|
2432
|
-
const cwd =
|
|
2552
|
+
const cwd = dirname4(fileURLToPath2(import.meta.url));
|
|
2433
2553
|
try {
|
|
2434
2554
|
execSync("git fetch origin --quiet", { cwd, stdio: "ignore", timeout: 15e3 });
|
|
2435
2555
|
const out = execSync("git rev-list HEAD..origin/main --count", {
|
|
@@ -2502,19 +2622,19 @@ data: ${data}
|
|
|
2502
2622
|
import { Router as Router12 } from "express";
|
|
2503
2623
|
|
|
2504
2624
|
// src/lib/gateway-settings.ts
|
|
2505
|
-
import { readFileSync as
|
|
2625
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "fs";
|
|
2506
2626
|
import { homedir as homedir5 } from "os";
|
|
2507
|
-
import { join as
|
|
2627
|
+
import { join as join7, dirname as dirname5 } from "path";
|
|
2508
2628
|
var DEFAULT_SETTINGS = {
|
|
2509
2629
|
desktopNotifications: true
|
|
2510
2630
|
};
|
|
2511
2631
|
function settingsPath(dataDir) {
|
|
2512
|
-
const dir = dataDir ?? process.env.SUVEREN_DATA_DIR ??
|
|
2513
|
-
return
|
|
2632
|
+
const dir = dataDir ?? process.env.SUVEREN_DATA_DIR ?? join7(homedir5(), ".suveren");
|
|
2633
|
+
return join7(dir, "settings.json");
|
|
2514
2634
|
}
|
|
2515
2635
|
function readSettings(dataDir) {
|
|
2516
2636
|
try {
|
|
2517
|
-
const raw = JSON.parse(
|
|
2637
|
+
const raw = JSON.parse(readFileSync6(settingsPath(dataDir), "utf8"));
|
|
2518
2638
|
return {
|
|
2519
2639
|
desktopNotifications: typeof raw.desktopNotifications === "boolean" ? raw.desktopNotifications : DEFAULT_SETTINGS.desktopNotifications
|
|
2520
2640
|
};
|
|
@@ -2528,8 +2648,8 @@ function writeSettings(patch, dataDir) {
|
|
|
2528
2648
|
...typeof patch.desktopNotifications === "boolean" ? { desktopNotifications: patch.desktopNotifications } : {}
|
|
2529
2649
|
};
|
|
2530
2650
|
const path = settingsPath(dataDir);
|
|
2531
|
-
|
|
2532
|
-
|
|
2651
|
+
mkdirSync5(dirname5(path), { recursive: true });
|
|
2652
|
+
writeFileSync5(path, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
2533
2653
|
return next;
|
|
2534
2654
|
}
|
|
2535
2655
|
|
|
@@ -2561,20 +2681,20 @@ function createGatewaySettingsRouter() {
|
|
|
2561
2681
|
import { Router as Router13 } from "express";
|
|
2562
2682
|
|
|
2563
2683
|
// src/lib/archived-mandates-store.ts
|
|
2564
|
-
import { readFileSync as
|
|
2684
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6, renameSync } from "fs";
|
|
2565
2685
|
import { homedir as homedir6 } from "os";
|
|
2566
|
-
import { join as
|
|
2686
|
+
import { join as join8, dirname as dirname6 } from "path";
|
|
2567
2687
|
var ID_PATTERN = /^[A-Za-z0-9_.:-]{1,200}$/;
|
|
2568
2688
|
function isValidMandateId(id) {
|
|
2569
2689
|
return typeof id === "string" && ID_PATTERN.test(id);
|
|
2570
2690
|
}
|
|
2571
2691
|
function storePath(dataDir) {
|
|
2572
|
-
const dir = dataDir ?? process.env.SUVEREN_DATA_DIR ??
|
|
2573
|
-
return
|
|
2692
|
+
const dir = dataDir ?? process.env.SUVEREN_DATA_DIR ?? join8(homedir6(), ".suveren");
|
|
2693
|
+
return join8(dir, "archived-mandates.json");
|
|
2574
2694
|
}
|
|
2575
2695
|
function readArchived(dataDir) {
|
|
2576
2696
|
try {
|
|
2577
|
-
const raw = JSON.parse(
|
|
2697
|
+
const raw = JSON.parse(readFileSync7(storePath(dataDir), "utf8"));
|
|
2578
2698
|
if (!Array.isArray(raw.archived)) return [];
|
|
2579
2699
|
return [...new Set(raw.archived.filter(isValidMandateId))];
|
|
2580
2700
|
} catch {
|
|
@@ -2584,9 +2704,9 @@ function readArchived(dataDir) {
|
|
|
2584
2704
|
function writeArchived(ids, dataDir) {
|
|
2585
2705
|
const next = [...new Set(ids.filter(isValidMandateId))].sort();
|
|
2586
2706
|
const path = storePath(dataDir);
|
|
2587
|
-
|
|
2707
|
+
mkdirSync6(dirname6(path), { recursive: true });
|
|
2588
2708
|
const tmp = `${path}.tmp`;
|
|
2589
|
-
|
|
2709
|
+
writeFileSync6(tmp, JSON.stringify({ archived: next }, null, 2) + "\n", "utf8");
|
|
2590
2710
|
renameSync(tmp, path);
|
|
2591
2711
|
return next;
|
|
2592
2712
|
}
|
|
@@ -2627,6 +2747,7 @@ import { Router as Router14 } from "express";
|
|
|
2627
2747
|
import { timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
2628
2748
|
var ALLOWED = ["proposal-added", "action-approval-needed"];
|
|
2629
2749
|
var SESSION_EXPIRED = "session-expired";
|
|
2750
|
+
var AS_KEY_MISMATCH = "as-key-mismatch";
|
|
2630
2751
|
function secretMatches(provided, expected) {
|
|
2631
2752
|
if (!expected) return false;
|
|
2632
2753
|
if (!provided) return false;
|
|
@@ -2635,7 +2756,7 @@ function secretMatches(provided, expected) {
|
|
|
2635
2756
|
if (a.length !== b.length) return false;
|
|
2636
2757
|
return timingSafeEqual2(a, b);
|
|
2637
2758
|
}
|
|
2638
|
-
function createInternalEventsRouter(getSecret, onSessionExpired) {
|
|
2759
|
+
function createInternalEventsRouter(getSecret, onSessionExpired, onAsKeyMismatch) {
|
|
2639
2760
|
const router = Router14();
|
|
2640
2761
|
router.post("/event", (req, res) => {
|
|
2641
2762
|
if (!secretMatches(req.headers["x-internal-secret"], getSecret())) {
|
|
@@ -2648,6 +2769,11 @@ function createInternalEventsRouter(getSecret, onSessionExpired) {
|
|
|
2648
2769
|
res.json({ ok: true });
|
|
2649
2770
|
return;
|
|
2650
2771
|
}
|
|
2772
|
+
if (type === AS_KEY_MISMATCH) {
|
|
2773
|
+
onAsKeyMismatch?.();
|
|
2774
|
+
res.json({ ok: true });
|
|
2775
|
+
return;
|
|
2776
|
+
}
|
|
2651
2777
|
if (typeof type !== "string" || !ALLOWED.includes(type)) {
|
|
2652
2778
|
res.status(400).json({ error: "Unsupported event type" });
|
|
2653
2779
|
return;
|
|
@@ -2746,6 +2872,7 @@ function startNotificationDispatcher(opts = {}) {
|
|
|
2746
2872
|
|
|
2747
2873
|
// src/lib/session-lock.ts
|
|
2748
2874
|
var SESSION_LOCKED_MESSAGE = "Your sign-in ended after 30 days or was revoked. Sign in again.";
|
|
2875
|
+
var AS_KEY_MISMATCH_MESSAGE = "The Authority Server presented a signing key that does not match the one pinned at pairing. Sign in again to review.";
|
|
2749
2876
|
function createSessionLock(deps) {
|
|
2750
2877
|
const { vault: vault2, port: port2 } = deps;
|
|
2751
2878
|
const notifyFn = deps.notifyFn ?? notify;
|
|
@@ -2763,6 +2890,23 @@ function createSessionLock(deps) {
|
|
|
2763
2890
|
notifyFn(title, message, process.platform, url);
|
|
2764
2891
|
};
|
|
2765
2892
|
}
|
|
2893
|
+
function createAsKeyMismatchLock(deps) {
|
|
2894
|
+
const { vault: vault2, port: port2 } = deps;
|
|
2895
|
+
const notifyFn = deps.notifyFn ?? notify;
|
|
2896
|
+
const unconfigureSessionFn = deps.unconfigureSessionFn ?? unconfigureSession;
|
|
2897
|
+
const emit = deps.emit ?? eventBus.emit.bind(eventBus);
|
|
2898
|
+
return function lockOnAsKeyMismatch() {
|
|
2899
|
+
if (!vault2.isUnlocked()) return;
|
|
2900
|
+
vault2.lockAsKeyMismatch();
|
|
2901
|
+
console.error("[Control Plane] Authority Server key mismatch \u2014 gateway LOCKED");
|
|
2902
|
+
void unconfigureSessionFn("as-key-mismatch").catch((err) => {
|
|
2903
|
+
console.error("[Control Plane] Failed to push cleared session to MCP:", err);
|
|
2904
|
+
});
|
|
2905
|
+
emit("session-locked", { reason: "as-key-mismatch", message: AS_KEY_MISMATCH_MESSAGE });
|
|
2906
|
+
const { title, url } = sessionExpiredNotification(port2);
|
|
2907
|
+
notifyFn(title, AS_KEY_MISMATCH_MESSAGE, process.platform, url);
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2766
2910
|
|
|
2767
2911
|
// src/lib/session-expiry-scheduler.ts
|
|
2768
2912
|
var MAX_TIMEOUT_MS = 2147483647;
|
|
@@ -2832,17 +2976,17 @@ function buildSessionHealth(vault2) {
|
|
|
2832
2976
|
}
|
|
2833
2977
|
|
|
2834
2978
|
// src/lib/denials-reader.ts
|
|
2835
|
-
import { existsSync as
|
|
2836
|
-
import { join as
|
|
2979
|
+
import { existsSync as existsSync7, readFileSync as readFileSync8 } from "fs";
|
|
2980
|
+
import { join as join9 } from "path";
|
|
2837
2981
|
function loadDenials(dataDir, decrypt) {
|
|
2838
|
-
const encPath =
|
|
2839
|
-
const plainPath =
|
|
2840
|
-
if (
|
|
2841
|
-
const { blob } = JSON.parse(
|
|
2982
|
+
const encPath = join9(dataDir, "denials.enc.json");
|
|
2983
|
+
const plainPath = join9(dataDir, "denials.json");
|
|
2984
|
+
if (existsSync7(encPath)) {
|
|
2985
|
+
const { blob } = JSON.parse(readFileSync8(encPath, "utf-8"));
|
|
2842
2986
|
return JSON.parse(decrypt(blob)).records ?? [];
|
|
2843
2987
|
}
|
|
2844
|
-
if (
|
|
2845
|
-
return JSON.parse(
|
|
2988
|
+
if (existsSync7(plainPath)) {
|
|
2989
|
+
return JSON.parse(readFileSync8(plainPath, "utf-8")).records ?? [];
|
|
2846
2990
|
}
|
|
2847
2991
|
return [];
|
|
2848
2992
|
}
|
|
@@ -2856,12 +3000,80 @@ function selectDenials(records, opts = {}) {
|
|
|
2856
3000
|
return { count, records: out };
|
|
2857
3001
|
}
|
|
2858
3002
|
|
|
3003
|
+
// src/lib/as-config.ts
|
|
3004
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync9, writeFileSync as writeFileSync7 } from "fs";
|
|
3005
|
+
import { dirname as dirname7, join as join10 } from "path";
|
|
3006
|
+
var DEFAULT_AS_URL = "https://www.suveren.ai";
|
|
3007
|
+
function configPath(dataDir) {
|
|
3008
|
+
return join10(dataDir, "config.json");
|
|
3009
|
+
}
|
|
3010
|
+
function readAsConfigStrict(dataDir) {
|
|
3011
|
+
const path = configPath(dataDir);
|
|
3012
|
+
if (!existsSync8(path)) return {};
|
|
3013
|
+
let data;
|
|
3014
|
+
try {
|
|
3015
|
+
data = JSON.parse(readFileSync9(path, "utf-8"));
|
|
3016
|
+
} catch (err) {
|
|
3017
|
+
throw new Error(
|
|
3018
|
+
`Could not parse ${path}: ${err instanceof Error ? err.message : String(err)}`
|
|
3019
|
+
);
|
|
3020
|
+
}
|
|
3021
|
+
const out = {};
|
|
3022
|
+
if (typeof data.asUrl === "string") out.asUrl = data.asUrl;
|
|
3023
|
+
if (typeof data.caFile === "string") out.caFile = data.caFile;
|
|
3024
|
+
return out;
|
|
3025
|
+
}
|
|
3026
|
+
function validateAsUrl(candidate) {
|
|
3027
|
+
const trimmed = candidate.trim();
|
|
3028
|
+
if (!trimmed) return { ok: false, error: "The Authority Server URL is empty." };
|
|
3029
|
+
let parsed;
|
|
3030
|
+
try {
|
|
3031
|
+
parsed = new URL(trimmed);
|
|
3032
|
+
} catch {
|
|
3033
|
+
return { ok: false, error: `"${trimmed}" is not a valid URL.` };
|
|
3034
|
+
}
|
|
3035
|
+
const isLocalHttp = parsed.protocol === "http:" && (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1");
|
|
3036
|
+
if (parsed.protocol !== "https:" && !isLocalHttp) {
|
|
3037
|
+
return {
|
|
3038
|
+
ok: false,
|
|
3039
|
+
error: `"${trimmed}" must use https:// (http:// is only allowed for http://localhost or http://127.0.0.1).`
|
|
3040
|
+
};
|
|
3041
|
+
}
|
|
3042
|
+
let normalized = `${parsed.origin}${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
3043
|
+
if (normalized.endsWith("/") && normalized !== `${parsed.origin}/`) {
|
|
3044
|
+
normalized = normalized.slice(0, -1);
|
|
3045
|
+
} else if (normalized === `${parsed.origin}/`) {
|
|
3046
|
+
normalized = parsed.origin;
|
|
3047
|
+
}
|
|
3048
|
+
return { ok: true, url: normalized };
|
|
3049
|
+
}
|
|
3050
|
+
function resolveAsUrl(dataDir, flag) {
|
|
3051
|
+
if (flag) {
|
|
3052
|
+
const v = validateAsUrl(flag);
|
|
3053
|
+
if (!v.ok) throw new Error(`Invalid --as-url: ${v.error}`);
|
|
3054
|
+
return v.url;
|
|
3055
|
+
}
|
|
3056
|
+
const envUrl = process.env.SUVEREN_AS_URL;
|
|
3057
|
+
if (envUrl) {
|
|
3058
|
+
const v = validateAsUrl(envUrl);
|
|
3059
|
+
if (!v.ok) throw new Error(`Invalid SUVEREN_AS_URL: ${v.error}`);
|
|
3060
|
+
return v.url;
|
|
3061
|
+
}
|
|
3062
|
+
const saved = readAsConfigStrict(dataDir).asUrl;
|
|
3063
|
+
if (saved) {
|
|
3064
|
+
const v = validateAsUrl(saved);
|
|
3065
|
+
if (!v.ok) throw new Error(`Invalid saved as-url "${saved}" in ${dataDir}/config.json: ${v.error}`);
|
|
3066
|
+
return v.url;
|
|
3067
|
+
}
|
|
3068
|
+
return DEFAULT_AS_URL;
|
|
3069
|
+
}
|
|
3070
|
+
|
|
2859
3071
|
// src/index.ts
|
|
2860
3072
|
(function migrateDataDir() {
|
|
2861
3073
|
if (process.env.SUVEREN_DATA_DIR) return;
|
|
2862
|
-
const oldDir =
|
|
2863
|
-
const newDir =
|
|
2864
|
-
if (!
|
|
3074
|
+
const oldDir = join11(homedir7(), ".hap");
|
|
3075
|
+
const newDir = join11(homedir7(), ".suveren");
|
|
3076
|
+
if (!existsSync9(newDir) && existsSync9(oldDir)) {
|
|
2865
3077
|
try {
|
|
2866
3078
|
renameSync2(oldDir, newDir);
|
|
2867
3079
|
console.error(`[Control Plane] Migrated data directory: ${oldDir} \u2192 ${newDir}`);
|
|
@@ -2871,11 +3083,22 @@ function selectDenials(records, opts = {}) {
|
|
|
2871
3083
|
}
|
|
2872
3084
|
}
|
|
2873
3085
|
})();
|
|
2874
|
-
var
|
|
3086
|
+
var DATA_DIR = process.env.SUVEREN_DATA_DIR ?? join11(homedir7(), ".suveren");
|
|
3087
|
+
var SP_URL = resolveAsUrl(DATA_DIR);
|
|
2875
3088
|
var port = parseInt(process.env.SUVEREN_CP_PORT ?? "3402", 10);
|
|
2876
3089
|
var HAP_MODE = process.env.HAP_MODE ?? "personal";
|
|
2877
|
-
var UI_DIST = process.env.HAP_UI_DIST ??
|
|
2878
|
-
var vault = new Vault();
|
|
3090
|
+
var UI_DIST = process.env.HAP_UI_DIST ?? join11(import.meta.dirname ?? __dirname, "../../ui/dist");
|
|
3091
|
+
var vault = new Vault(DATA_DIR);
|
|
3092
|
+
(function repairIfAsUrlChanged() {
|
|
3093
|
+
const pairing = readPairing(DATA_DIR);
|
|
3094
|
+
if (pairing && pairing.asUrl !== SP_URL) {
|
|
3095
|
+
console.error(
|
|
3096
|
+
`[Control Plane] Authority Server changed (${pairing.asUrl} \u2192 ${SP_URL}) \u2014 clearing the old pairing. Sign in again to re-pair.`
|
|
3097
|
+
);
|
|
3098
|
+
clearPairing(DATA_DIR);
|
|
3099
|
+
vault.markBootLockedAsUrlChanged();
|
|
3100
|
+
}
|
|
3101
|
+
})();
|
|
2879
3102
|
var internalSecret2 = process.env.SUVEREN_INTERNAL_SECRET ?? randomBytes2(32).toString("hex");
|
|
2880
3103
|
setInternalSecret(internalSecret2);
|
|
2881
3104
|
var app = express();
|
|
@@ -2899,6 +3122,7 @@ function loginRateLimit(req, res, next) {
|
|
|
2899
3122
|
next();
|
|
2900
3123
|
}
|
|
2901
3124
|
var lockExpiredSession = createSessionLock({ vault, port });
|
|
3125
|
+
var lockAsKeyMismatch = createAsKeyMismatchLock({ vault, port });
|
|
2902
3126
|
var sessionExpiryScheduler = new SessionExpiryScheduler(
|
|
2903
3127
|
() => vault.getSessionExpiresAt(),
|
|
2904
3128
|
lockExpiredSession
|
|
@@ -2907,7 +3131,8 @@ app.use("/auth", jsonParser, createAuthRouter(
|
|
|
2907
3131
|
vault,
|
|
2908
3132
|
requireAuth(vault),
|
|
2909
3133
|
loginRateLimit,
|
|
2910
|
-
() => sessionExpiryScheduler.reschedule()
|
|
3134
|
+
() => sessionExpiryScheduler.reschedule(),
|
|
3135
|
+
{ asUrl: SP_URL, dataDir: DATA_DIR }
|
|
2911
3136
|
));
|
|
2912
3137
|
function resolveOrigin(req) {
|
|
2913
3138
|
const fwdHost = req.get("x-forwarded-host");
|
|
@@ -3114,7 +3339,7 @@ app.get("/auth/oauth/:integrationId/health", authGuard, async (req, res) => {
|
|
|
3114
3339
|
}
|
|
3115
3340
|
});
|
|
3116
3341
|
app.get("/events", requireAllowedHost, requireAuthQueryOrHeader(vault), createEventsHandler());
|
|
3117
|
-
app.use("/internal", jsonParser, createInternalEventsRouter(() => internalSecret2, lockExpiredSession));
|
|
3342
|
+
app.use("/internal", jsonParser, createInternalEventsRouter(() => internalSecret2, lockExpiredSession, lockAsKeyMismatch));
|
|
3118
3343
|
app.use("/vault", jsonParser, authGuard, createVaultRouter(vault));
|
|
3119
3344
|
app.use("/ai", jsonParser, authGuard, createAIRouter(vault));
|
|
3120
3345
|
app.use("/ai-prompts", jsonParser, authGuard, createAIPromptsRouter());
|
|
@@ -3123,7 +3348,7 @@ app.use("/autostart", jsonParser, authGuard, createAutostartRouter());
|
|
|
3123
3348
|
app.use("/api/gateway-settings", jsonParser, authGuard, createGatewaySettingsRouter());
|
|
3124
3349
|
app.use("/api/archived-mandates", jsonParser, authGuard, createArchivedMandatesRouter());
|
|
3125
3350
|
app.use("/api/encrypt-intent", jsonParser, authGuard, createEncryptIntentRouter());
|
|
3126
|
-
app.use("/api/evidence-export", authGuard, createEvidenceExportRouter(
|
|
3351
|
+
app.use("/api/evidence-export", authGuard, createEvidenceExportRouter(SP_URL, vault));
|
|
3127
3352
|
app.use("/api/evidence", authGuard, createEvidenceRouter());
|
|
3128
3353
|
app.use("/api/decrypt-intent", jsonParser, authGuard, createDecryptIntentRouter(vault));
|
|
3129
3354
|
app.use("/api/approved-intents", jsonParser, authGuard, createApprovedIntentsRouter(vault));
|
|
@@ -3253,9 +3478,27 @@ app.get("/active-authorizations", authGuard, async (_req, res) => {
|
|
|
3253
3478
|
res.status(500).json({ error: "Failed to fetch authorizations from MCP server" });
|
|
3254
3479
|
}
|
|
3255
3480
|
});
|
|
3481
|
+
app.get("/skipped-commitments", authGuard, async (_req, res) => {
|
|
3482
|
+
try {
|
|
3483
|
+
const data = await getSkippedCommitments();
|
|
3484
|
+
res.json(data);
|
|
3485
|
+
} catch (err) {
|
|
3486
|
+
console.error("[Control Plane] Skipped-commitments retrieval error:", err);
|
|
3487
|
+
res.status(500).json({ error: "Failed to fetch skipped commitments from MCP server" });
|
|
3488
|
+
}
|
|
3489
|
+
});
|
|
3490
|
+
app.get("/as-pairing", authGuard, (_req, res) => {
|
|
3491
|
+
const pairing = readPairing(DATA_DIR);
|
|
3492
|
+
res.json({
|
|
3493
|
+
asUrl: SP_URL,
|
|
3494
|
+
paired: pairing !== null && pairing.asUrl === SP_URL,
|
|
3495
|
+
fingerprint: pairing && pairing.asUrl === SP_URL ? fingerprintOf(pairing.publicKeyHex) : null,
|
|
3496
|
+
pairedAt: pairing && pairing.asUrl === SP_URL ? pairing.pairedAt : null
|
|
3497
|
+
});
|
|
3498
|
+
});
|
|
3256
3499
|
app.get("/denials", authGuard, (req, res) => {
|
|
3257
3500
|
try {
|
|
3258
|
-
const dataDir = process.env.SUVEREN_DATA_DIR ??
|
|
3501
|
+
const dataDir = process.env.SUVEREN_DATA_DIR ?? join11(homedir7(), ".suveren");
|
|
3259
3502
|
const all = loadDenials(dataDir, (blob) => vault.decrypt(blob));
|
|
3260
3503
|
const since = Number(req.query.since);
|
|
3261
3504
|
const limit = Number(req.query.limit);
|
|
@@ -3306,11 +3549,11 @@ app.put("/agent-brief/context", jsonParser, authGuard, async (req, res) => {
|
|
|
3306
3549
|
res.status(413).json({ error: `Context exceeds ${AGENT_CONTEXT_MAX_BYTES}-byte cap` });
|
|
3307
3550
|
return;
|
|
3308
3551
|
}
|
|
3309
|
-
const { mkdirSync:
|
|
3552
|
+
const { mkdirSync: mkdirSync8, writeFileSync: writeFileSync8, renameSync: renameSync3 } = await import("fs");
|
|
3310
3553
|
const filePath = agentBriefPath();
|
|
3311
|
-
|
|
3554
|
+
mkdirSync8(dirname8(filePath), { recursive: true });
|
|
3312
3555
|
const tmpPath = `${filePath}.tmp`;
|
|
3313
|
-
|
|
3556
|
+
writeFileSync8(tmpPath, content, "utf-8");
|
|
3314
3557
|
renameSync3(tmpPath, filePath);
|
|
3315
3558
|
res.json({ ok: true });
|
|
3316
3559
|
} catch (err) {
|
|
@@ -3321,7 +3564,7 @@ app.put("/agent-brief/context", jsonParser, authGuard, async (req, res) => {
|
|
|
3321
3564
|
app.use("/api", authGuard);
|
|
3322
3565
|
app.use(
|
|
3323
3566
|
createProxyMiddleware({
|
|
3324
|
-
target:
|
|
3567
|
+
target: SP_URL,
|
|
3325
3568
|
changeOrigin: true,
|
|
3326
3569
|
pathFilter: "/api",
|
|
3327
3570
|
on: {
|
|
@@ -3363,13 +3606,13 @@ app.use(
|
|
|
3363
3606
|
})
|
|
3364
3607
|
);
|
|
3365
3608
|
function detectInstallMethod() {
|
|
3366
|
-
if (
|
|
3609
|
+
if (existsSync9("/.dockerenv")) return "docker";
|
|
3367
3610
|
const dir = import.meta.dirname ?? __dirname;
|
|
3368
3611
|
if (dir.includes("/node_modules/@suveren/gateway/")) return "npm";
|
|
3369
3612
|
let cursor = dir;
|
|
3370
3613
|
for (let i = 0; i < 8; i++) {
|
|
3371
|
-
if (
|
|
3372
|
-
const parent =
|
|
3614
|
+
if (existsSync9(join11(cursor, ".git"))) return "dev";
|
|
3615
|
+
const parent = dirname8(cursor);
|
|
3373
3616
|
if (parent === cursor) break;
|
|
3374
3617
|
cursor = parent;
|
|
3375
3618
|
}
|
|
@@ -3381,10 +3624,10 @@ function detectRunningVersion() {
|
|
|
3381
3624
|
return process.env.HAP_BUILD_SHA ?? "dev";
|
|
3382
3625
|
}
|
|
3383
3626
|
const dir = import.meta.dirname ?? __dirname;
|
|
3384
|
-
const bundlePkg =
|
|
3385
|
-
if (
|
|
3627
|
+
const bundlePkg = join11(dir, "..", "..", "package.json");
|
|
3628
|
+
if (existsSync9(bundlePkg)) {
|
|
3386
3629
|
try {
|
|
3387
|
-
const pkg = JSON.parse(
|
|
3630
|
+
const pkg = JSON.parse(readFileSync10(bundlePkg, "utf8"));
|
|
3388
3631
|
if (pkg.name === "@suveren/gateway" && typeof pkg.version === "string") {
|
|
3389
3632
|
return pkg.version;
|
|
3390
3633
|
}
|
|
@@ -3406,14 +3649,14 @@ app.get("/health", async (req, res) => {
|
|
|
3406
3649
|
latestVersion: update.latestVersion,
|
|
3407
3650
|
updateAvailable: update.updateAvailable,
|
|
3408
3651
|
installMethod: INSTALL_METHOD,
|
|
3409
|
-
spUrl:
|
|
3652
|
+
spUrl: SP_URL,
|
|
3410
3653
|
session: buildSessionHealth(vault),
|
|
3411
3654
|
security: {
|
|
3412
3655
|
note: "Gateway secures tool execution. Agent host isolation is the user's responsibility."
|
|
3413
3656
|
}
|
|
3414
3657
|
});
|
|
3415
3658
|
});
|
|
3416
|
-
if (
|
|
3659
|
+
if (existsSync9(UI_DIST)) {
|
|
3417
3660
|
app.use(express.static(UI_DIST, {
|
|
3418
3661
|
setHeaders: (res, filePath) => {
|
|
3419
3662
|
if (filePath.endsWith("index.html")) {
|
|
@@ -3423,7 +3666,7 @@ if (existsSync7(UI_DIST)) {
|
|
|
3423
3666
|
}));
|
|
3424
3667
|
app.get("*", (_req, res) => {
|
|
3425
3668
|
res.setHeader("Cache-Control", "no-store, must-revalidate");
|
|
3426
|
-
res.sendFile(
|
|
3669
|
+
res.sendFile(join11(UI_DIST, "index.html"));
|
|
3427
3670
|
});
|
|
3428
3671
|
} else {
|
|
3429
3672
|
app.get("/", (_req, res) => {
|
|
@@ -3441,7 +3684,7 @@ app.listen(port, "0.0.0.0", () => {
|
|
|
3441
3684
|
}
|
|
3442
3685
|
startNotificationDispatcher({ url: `http://localhost:${port}` });
|
|
3443
3686
|
sessionExpiryScheduler.start();
|
|
3444
|
-
console.error(`[Control Plane] SP proxy: ${
|
|
3687
|
+
console.error(`[Control Plane] SP proxy: ${SP_URL}`);
|
|
3445
3688
|
console.error(`[Control Plane] UI dist: ${UI_DIST}`);
|
|
3446
3689
|
console.error(`[Control Plane] Internal secret: configured`);
|
|
3447
3690
|
console.error(`[Control Plane] MCP server: ${MCP_BASE}`);
|