@harrylabsj/kiwi-merchant-cloud 0.12.5 → 0.12.6
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/app/buyer-core/service.d.ts +22 -1
- package/app/buyer-core/service.js +325 -33
- package/app/buyer-core/service.js.map +1 -1
- package/app/buyer-core/store.d.ts +23 -0
- package/app/buyer-core/store.js +71 -8
- package/app/buyer-core/store.js.map +1 -1
- package/app/cloud/bootstrap.d.ts +13 -0
- package/app/cloud/bootstrap.js +27 -4
- package/app/cloud/bootstrap.js.map +1 -1
- package/app/cloud/config.d.ts +26 -0
- package/app/cloud/config.js +75 -3
- package/app/cloud/config.js.map +1 -1
- package/app/cloud/main.d.ts +69 -0
- package/app/cloud/main.js +285 -0
- package/app/cloud/main.js.map +1 -1
- package/app/cloud/owned-clock.d.ts +27 -0
- package/app/cloud/owned-clock.js +98 -0
- package/app/cloud/owned-clock.js.map +1 -0
- package/app/cloud/owned-runtime.d.ts +188 -0
- package/app/cloud/owned-runtime.js +1041 -0
- package/app/cloud/owned-runtime.js.map +1 -0
- package/app/cloud-sample/products.json +3 -3
- package/app/demo/demo-runner.js +6 -0
- package/app/demo/demo-runner.js.map +1 -1
- package/app/handoff/destination.d.ts +2 -0
- package/app/handoff/destination.js +4 -0
- package/app/handoff/destination.js.map +1 -1
- package/build-manifest.json +1227 -1182
- package/node_modules/hono/README.md +1 -1
- 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 +320 -342
- 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 -87
- 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 +328 -371
- 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 +105 -119
- 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 -70
- 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 +471 -589
- 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 +133 -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 -179
- 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 -36
- 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 -343
- 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 -228
- 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 -205
- 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 -49
- 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 -595
- 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 +132 -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 -154
- 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 -16
- 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 -316
- 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 -105
- 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 -123
- 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 -17
- 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 -18
- 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 -3
- 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 -58
- 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 -8
- package/node_modules/hono/dist/types/adapter/service-worker/index.d.ts +6 -9
- package/node_modules/hono/dist/types/adapter/service-worker/types.d.ts +12 -8
- 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 -160
- 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 -336
- 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 -13
- package/node_modules/hono/dist/types/helper/css/common.d.ts +11 -10
- package/node_modules/hono/dist/types/helper/css/index.d.ts +25 -28
- package/node_modules/hono/dist/types/helper/dev/index.d.ts +10 -13
- package/node_modules/hono/dist/types/helper/factory/index.d.ts +26 -74
- package/node_modules/hono/dist/types/helper/html/index.d.ts +4 -7
- package/node_modules/hono/dist/types/helper/proxy/index.d.ts +20 -23
- package/node_modules/hono/dist/types/helper/route/index.d.ts +6 -4
- 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 -7
- 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 -4
- 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 -10
- package/node_modules/hono/dist/types/helper/websocket/index.d.ts +30 -33
- package/node_modules/hono/dist/types/hono-base.d.ts +208 -211
- package/node_modules/hono/dist/types/hono.d.ts +11 -10
- package/node_modules/hono/dist/types/http-exception.d.ts +20 -23
- package/node_modules/hono/dist/types/index.d.ts +6 -37
- package/node_modules/hono/dist/types/jsx/base.d.ts +36 -35
- 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 -7
- package/node_modules/hono/dist/types/jsx/dom/client.d.ts +8 -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 +26 -30
- package/node_modules/hono/dist/types/jsx/dom/hooks/index.d.ts +11 -13
- package/node_modules/hono/dist/types/jsx/dom/index.d.ts +78 -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 -51
- package/node_modules/hono/dist/types/jsx/dom/server.d.ts +86 -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 -17
- package/node_modules/hono/dist/types/jsx/index.d.ts +70 -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 +11 -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 -20
- package/node_modules/hono/dist/types/middleware/bearer-auth/index.d.ts +46 -49
- package/node_modules/hono/dist/types/middleware/body-limit/index.d.ts +6 -9
- package/node_modules/hono/dist/types/middleware/cache/index.d.ts +13 -15
- package/node_modules/hono/dist/types/middleware/combine/index.d.ts +7 -8
- package/node_modules/hono/dist/types/middleware/compress/index.d.ts +8 -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 -13
- package/node_modules/hono/dist/types/middleware/csrf/index.d.ts +6 -9
- 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 -9
- package/node_modules/hono/dist/types/middleware/ip-restriction/index.d.ts +11 -13
- package/node_modules/hono/dist/types/middleware/jsx-renderer/index.d.ts +11 -12
- 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 +6 -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 +5 -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 -6
- package/node_modules/hono/dist/types/middleware/method-not-allowed/index.d.ts +7 -10
- package/node_modules/hono/dist/types/middleware/method-override/index.d.ts +14 -17
- package/node_modules/hono/dist/types/middleware/powered-by/index.d.ts +8 -11
- package/node_modules/hono/dist/types/middleware/pretty-json/index.d.ts +18 -21
- package/node_modules/hono/dist/types/middleware/request-id/index.d.ts +5 -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 +5 -6
- package/node_modules/hono/dist/types/middleware/secure-headers/permissions-policy.d.ts +2 -1
- package/node_modules/hono/dist/types/middleware/secure-headers/secure-headers.d.ts +55 -58
- 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 +5 -5
- package/node_modules/hono/dist/types/middleware/timing/timing.d.ts +17 -21
- package/node_modules/hono/dist/types/middleware/trailing-slash/index.d.ts +35 -38
- 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 -287
- 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 -11
- 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 -506
- 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 -51
- package/node_modules/hono/dist/types/utils/buffer.d.ts +7 -6
- 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 -19
- package/node_modules/hono/dist/types/utils/crypto.d.ts +5 -8
- package/node_modules/hono/dist/types/utils/encode.d.ts +2 -0
- package/node_modules/hono/dist/types/utils/filepath.d.ts +5 -4
- 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 -10
- 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 +59 -57
- package/node_modules/hono/dist/types/utils/stream.d.ts +27 -25
- package/node_modules/hono/dist/types/utils/types.d.ts +15 -28
- package/node_modules/hono/dist/types/utils/url.d.ts +2 -1
- package/node_modules/hono/dist/types/validator/index.d.ts +3 -7
- package/node_modules/hono/dist/types/validator/utils.d.ts +6 -9
- package/node_modules/hono/dist/types/validator/validator.d.ts +11 -10
- package/node_modules/hono/dist/types.js +4 -6
- package/node_modules/hono/dist/utils/accept.js +185 -215
- 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 -197
- 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 +1 -1
- package/prepare.mjs +109 -4
- package/runtime-package.json +1 -1
- package/shipping-sbom.cdx.json +14 -14
- package/shipping-source.json +12 -12
|
@@ -220,7 +220,10 @@ export declare class KiwiBuyerService {
|
|
|
220
220
|
private readonly principal;
|
|
221
221
|
private readonly buyerAgentId;
|
|
222
222
|
private readonly sessionId;
|
|
223
|
-
private readonly
|
|
223
|
+
private readonly policySnapshot;
|
|
224
|
+
private readonly policyDigest;
|
|
225
|
+
/** 兼容既有内部读取点:一律指向已冻结快照,不再暴露可变原对象。 */
|
|
226
|
+
private get policy();
|
|
224
227
|
private readonly merchantIndex?;
|
|
225
228
|
private readonly quoteFetcher?;
|
|
226
229
|
private readonly negotiator?;
|
|
@@ -316,6 +319,24 @@ export declare class KiwiBuyerService {
|
|
|
316
319
|
};
|
|
317
320
|
authorization: AuthorizationRecord;
|
|
318
321
|
}>;
|
|
322
|
+
/** 目的地归一:类型词表校验 + URL 归一(http/https、无凭据、无 fragment)。 */
|
|
323
|
+
private normalizeHandoffDestination;
|
|
324
|
+
/** 意图对象(不含 intent_digest);字段集固定,缺失一律 null。 */
|
|
325
|
+
private buildHandoffIntent;
|
|
326
|
+
/**
|
|
327
|
+
* 意图感知的 ASK:在泛型 evaluateAuthorization 之前由 handoff 调用,
|
|
328
|
+
* 同事务写 intent 与 approval,杜绝"先产生无目的地审批再补绑定"。
|
|
329
|
+
*/
|
|
330
|
+
private requestHandoffApproval;
|
|
331
|
+
/**
|
|
332
|
+
* 由存储的 intent 重建 canonical body(字段集与 `buildHandoffIntent` 完全一致,
|
|
333
|
+
* 排除 `intent_digest` 自身)。任何字段被改都会改变重算摘要。
|
|
334
|
+
*/
|
|
335
|
+
private handoffIntentBody;
|
|
336
|
+
/** policy 自身期限必须独立有效(不能只靠 DB 其它期限间接代表)。 */
|
|
337
|
+
private assertPolicyActive;
|
|
338
|
+
/** 消费前的意图核验:重算摘要 + 逐字段 + 重算 agreement 摘要 + 现值 terms + policy 期限/摘要 + 全部期限。 */
|
|
339
|
+
private assertHandoffIntentMatches;
|
|
319
340
|
/** 创建 pending 审批记录(ASK 动作触发)。返回持久 approval_id。 */
|
|
320
341
|
requestApproval(input: {
|
|
321
342
|
task_id: string;
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
* 执行 seam(Phase 2 接线真实 merchant 网络):MerchantIndex / QuoteFetcher /
|
|
29
29
|
* Negotiator 为可注入接口。v0.1 默认使用 Static 实现或由宿主注入。
|
|
30
30
|
*/
|
|
31
|
-
import { contentDigest } from "../negotiation/jcs.js";
|
|
31
|
+
import { contentDigest, sha256Hex } from "../negotiation/jcs.js";
|
|
32
|
+
import { isDestinationType, isSessionDestinationType, isUrlDestinationType } from "../handoff/destination.js";
|
|
32
33
|
import { uuidv7 } from "@earendil-works/pi-ai";
|
|
33
34
|
import { assertNorthboundContractValid, validateCommerceIntent, validateEffectiveAuthorization, } from "../contracts/northbound-schema.js";
|
|
34
35
|
import { CatalogSourceError } from "../discovery/catalog-source/errors.js";
|
|
@@ -40,6 +41,17 @@ function agentIsFresh(record) {
|
|
|
40
41
|
const state = record.freshness_state;
|
|
41
42
|
return state === undefined || (state !== "stale" && state !== "unreachable");
|
|
42
43
|
}
|
|
44
|
+
const HANDOFF_INTENT_VERSION = "1";
|
|
45
|
+
/** 深冻结(plain JSON):保证授权与摘要使用同一不可变快照。 */
|
|
46
|
+
function deepFreezePlain(value) {
|
|
47
|
+
if (value !== null && typeof value === "object") {
|
|
48
|
+
for (const key of Object.keys(value)) {
|
|
49
|
+
deepFreezePlain(value[key]);
|
|
50
|
+
}
|
|
51
|
+
Object.freeze(value);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
43
55
|
function utcNow() {
|
|
44
56
|
return new Date().toISOString();
|
|
45
57
|
}
|
|
@@ -63,7 +75,12 @@ export class KiwiBuyerService {
|
|
|
63
75
|
principal;
|
|
64
76
|
buyerAgentId;
|
|
65
77
|
sessionId;
|
|
66
|
-
|
|
78
|
+
policySnapshot;
|
|
79
|
+
policyDigest;
|
|
80
|
+
/** 兼容既有内部读取点:一律指向已冻结快照,不再暴露可变原对象。 */
|
|
81
|
+
get policy() {
|
|
82
|
+
return this.policySnapshot;
|
|
83
|
+
}
|
|
67
84
|
merchantIndex;
|
|
68
85
|
quoteFetcher;
|
|
69
86
|
negotiator;
|
|
@@ -76,7 +93,10 @@ export class KiwiBuyerService {
|
|
|
76
93
|
this.sessionId = options.sessionId;
|
|
77
94
|
const clock = options.now ?? utcNow;
|
|
78
95
|
this.now = () => new Date(Date.parse(clock())).toISOString();
|
|
79
|
-
|
|
96
|
+
// A 卡:授权与摘要必须使用同一份 deep-clone/deep-freeze 的 plain-JSON 快照,
|
|
97
|
+
// 避免"原对象被就地改写、摘要仍是旧值"的漂移。
|
|
98
|
+
this.policySnapshot = deepFreezePlain(JSON.parse(JSON.stringify((options.delegationPolicy ?? {}))));
|
|
99
|
+
this.policyDigest = contentDigest(this.policySnapshot);
|
|
80
100
|
this.merchantIndex = options.merchantIndex;
|
|
81
101
|
this.quoteFetcher = options.quoteFetcher;
|
|
82
102
|
this.negotiator = options.negotiator;
|
|
@@ -281,27 +301,93 @@ export class KiwiBuyerService {
|
|
|
281
301
|
if (this.quoteFetcher !== undefined) {
|
|
282
302
|
const merchants = input.merchant_ids ?? [];
|
|
283
303
|
const index = this.merchantIndex;
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
304
|
+
let dispatchStarted = false;
|
|
305
|
+
let dispatchOutcomeUnknown = false;
|
|
306
|
+
let catalogLookupCompleted = false;
|
|
307
|
+
try {
|
|
308
|
+
// 用意图的商品查询解析商家(拿到各自 matching_skus,供 RFQ 用商家自有 SKU)。
|
|
309
|
+
const resolved = index !== undefined ? await index.search(this.firstQuery(input.intent)) : [];
|
|
310
|
+
const merchantRecords = await Promise.all(merchants.map(async (m) => {
|
|
311
|
+
const found = resolved.find((r) => r.merchant_id === m);
|
|
312
|
+
if (found !== undefined)
|
|
313
|
+
return found;
|
|
314
|
+
// intent query 文本未命中 catalog LIKE 时按 merchant_id 直接解析
|
|
315
|
+
// (保 agent_card_url,A2A 才能磋商;host 的 merchant_ids 来自一次
|
|
316
|
+
// 成功的 kiwi_search,不该因意图措辞丢失完整记录)。
|
|
317
|
+
if (index !== undefined) {
|
|
318
|
+
const byId = await index.resolveById(m);
|
|
319
|
+
if (byId !== undefined)
|
|
320
|
+
return byId;
|
|
321
|
+
}
|
|
322
|
+
return { merchant_id: m, name: m, verified: false, capabilities: [] };
|
|
323
|
+
}));
|
|
324
|
+
catalogLookupCompleted = true;
|
|
325
|
+
const protocolContext = this.protocolContext(persisted, merchants);
|
|
326
|
+
// 一旦调用 quoteFetcher,就不能把抛错解释成“没发送”:adapter 可能已
|
|
327
|
+
// 写入/发送部分 RFQ。没有 receipt 时保守落为 non-retryable unknown。
|
|
328
|
+
dispatchStarted = true;
|
|
329
|
+
quotedResults = await this.quoteFetcher.requestQuotes(input.intent, merchantRecords, protocolContext);
|
|
330
|
+
dispatchOutcomeUnknown = quotedResults.some((result) => result.status === "failed" &&
|
|
331
|
+
result.failure?.classification === "protocol_error" &&
|
|
332
|
+
result.failure.retryable === false);
|
|
333
|
+
const returnedMerchants = new Set(quotedResults.map((result) => result.merchant_id));
|
|
334
|
+
const missingResults = merchants.filter((merchantId) => !returnedMerchants.has(merchantId));
|
|
335
|
+
if (missingResults.length > 0)
|
|
336
|
+
dispatchOutcomeUnknown = true;
|
|
337
|
+
quotedResults = [
|
|
338
|
+
...quotedResults,
|
|
339
|
+
...missingResults.map((merchantId) => ({
|
|
340
|
+
merchant_id: merchantId,
|
|
341
|
+
status: "failed",
|
|
342
|
+
failure: {
|
|
343
|
+
classification: "protocol_error",
|
|
344
|
+
retryable: false,
|
|
345
|
+
detail: "RFQ dispatch returned no per-merchant result; remote outcome is unknown",
|
|
346
|
+
},
|
|
347
|
+
})),
|
|
348
|
+
];
|
|
349
|
+
}
|
|
350
|
+
catch {
|
|
351
|
+
// Catalog lookup resolves before quoteFetcher: this branch is known not sent.
|
|
352
|
+
// Once quoteFetcher was entered, an exception can follow a remote side effect,
|
|
353
|
+
// so record UNKNOWN and block automatic resend by the same task key.
|
|
354
|
+
const failure = dispatchStarted
|
|
355
|
+
? {
|
|
356
|
+
classification: "protocol_error",
|
|
357
|
+
retryable: false,
|
|
358
|
+
detail: "RFQ dispatch outcome is unknown; a remote side effect may have occurred. Reconcile before retrying",
|
|
359
|
+
}
|
|
360
|
+
: catalogLookupCompleted
|
|
361
|
+
? {
|
|
362
|
+
classification: "other",
|
|
363
|
+
retryable: true,
|
|
364
|
+
detail: "Local RFQ preparation failed before dispatch; no RFQ was sent",
|
|
365
|
+
}
|
|
366
|
+
: {
|
|
367
|
+
classification: "unreachable",
|
|
368
|
+
retryable: true,
|
|
369
|
+
detail: "Catalog lookup failed before RFQ dispatch; no RFQ was sent",
|
|
370
|
+
};
|
|
371
|
+
dispatchOutcomeUnknown = dispatchStarted;
|
|
372
|
+
quotedResults = merchants.map((merchantId) => ({
|
|
373
|
+
merchant_id: merchantId,
|
|
374
|
+
status: "failed",
|
|
375
|
+
failure,
|
|
376
|
+
}));
|
|
377
|
+
}
|
|
378
|
+
if (merchants.length === 0) {
|
|
379
|
+
status = "failed";
|
|
380
|
+
}
|
|
381
|
+
else if (quotedResults.length > 0) {
|
|
382
|
+
const successes = quotedResults.filter((r) => r.status === "succeeded").length;
|
|
383
|
+
status =
|
|
384
|
+
successes === quotedResults.length
|
|
385
|
+
? "succeeded"
|
|
386
|
+
: successes === 0
|
|
387
|
+
? dispatchOutcomeUnknown
|
|
388
|
+
? "in_progress"
|
|
389
|
+
: "failed"
|
|
390
|
+
: "partial_success";
|
|
305
391
|
}
|
|
306
392
|
}
|
|
307
393
|
return this.store.transaction(() => {
|
|
@@ -309,7 +395,10 @@ export class KiwiBuyerService {
|
|
|
309
395
|
this.store.addCandidate(taskId, { candidate_id: `cand-${uuidv7()}`, merchant_id: r.merchant_id, status: r.status, provenance: r.provenance, terms: r.terms, failure: r.failure, retryable: r.status === "failed" ? (r.failure?.retryable ?? false) : false });
|
|
310
396
|
const updated = this.store.updateTask(taskId, {
|
|
311
397
|
status,
|
|
312
|
-
|
|
398
|
+
// A terminal failure is not silently resumed under this idempotency key.
|
|
399
|
+
// A known pre-send failure may be submitted as a new task; an unknown A2A
|
|
400
|
+
// outcome remains non-retryable on its candidate and needs reconciliation.
|
|
401
|
+
resumable: status !== "failed",
|
|
313
402
|
payload: JSON.stringify({
|
|
314
403
|
...this.decodeTask(task),
|
|
315
404
|
status,
|
|
@@ -596,12 +685,20 @@ export class KiwiBuyerService {
|
|
|
596
685
|
if (stored === undefined) {
|
|
597
686
|
throw new McpError("agreement_not_found", `agreement ${input.agreement_id} not found`);
|
|
598
687
|
}
|
|
688
|
+
// A 卡:目的地先归一;非法即拒绝,且不落任何意图/审批行。
|
|
689
|
+
const destination = this.normalizeHandoffDestination(input);
|
|
690
|
+
// A 卡:ask 且无 approval_id 时,必须在泛型 evaluateAuthorization 之前
|
|
691
|
+
// 走意图感知的 ASK——否则 evaluateAuthorization 会先写一条无目的地审批。
|
|
692
|
+
if (input.approval_id === undefined && policyActionMode(this.policySnapshot, "handoff") === "ask") {
|
|
693
|
+
const approval_id = this.requestHandoffApproval({ agreement: stored, destination });
|
|
694
|
+
throw new McpError("approval_required", "action=handoff 需要持久审批", { approval_id });
|
|
695
|
+
}
|
|
599
696
|
// review P1-2(A316 校准):handoff 消费绑定 = 结构化 canonical digest
|
|
600
697
|
//(agreement/destination/url),无分隔符歧义。
|
|
601
698
|
const consumedBinding = this.consumeBinding({
|
|
602
699
|
agreement_id: input.agreement_id,
|
|
603
|
-
destination_type:
|
|
604
|
-
url:
|
|
700
|
+
destination_type: destination.destination_type,
|
|
701
|
+
url: destination.url,
|
|
605
702
|
});
|
|
606
703
|
const authorization = await this.evaluateAuthorization("handoff", {
|
|
607
704
|
taskId: stored.task_id,
|
|
@@ -614,8 +711,8 @@ export class KiwiBuyerService {
|
|
|
614
711
|
if (input.approval_id === undefined) {
|
|
615
712
|
const handoffRef = {
|
|
616
713
|
handoff_id: `handoff-${uuidv7()}`,
|
|
617
|
-
destination_type:
|
|
618
|
-
...(
|
|
714
|
+
destination_type: destination.destination_type,
|
|
715
|
+
...(destination.url !== null ? { url: destination.url } : {}),
|
|
619
716
|
};
|
|
620
717
|
return { handoff_ref: handoffRef, authorization };
|
|
621
718
|
}
|
|
@@ -627,14 +724,30 @@ export class KiwiBuyerService {
|
|
|
627
724
|
if (approval === undefined) {
|
|
628
725
|
throw new McpError("invalid_params", `approval ${input.approval_id} 不存在`);
|
|
629
726
|
}
|
|
727
|
+
// A 卡:同事务重读 task/agreement,核验意图(含 agreement 摘要、terms 现值、
|
|
728
|
+
// policy 摘要与全部有效期限);旧审批(无 intent)在此拒绝。
|
|
729
|
+
const freshTask = this.store.getTask(approval.task_id);
|
|
730
|
+
if (freshTask === undefined) {
|
|
731
|
+
throw new McpError("task_not_found", `task ${approval.task_id} not found`);
|
|
732
|
+
}
|
|
733
|
+
const freshAgreement = this.store.getAgreement(input.agreement_id);
|
|
734
|
+
if (freshAgreement === undefined) {
|
|
735
|
+
throw new McpError("agreement_not_found", `agreement ${input.agreement_id} not found`);
|
|
736
|
+
}
|
|
737
|
+
this.assertHandoffIntentMatches({
|
|
738
|
+
approval,
|
|
739
|
+
task: freshTask,
|
|
740
|
+
agreement: freshAgreement,
|
|
741
|
+
destination,
|
|
742
|
+
});
|
|
630
743
|
if (approval.status === "used") {
|
|
631
744
|
const consumed = this.approvalConsumed(approval);
|
|
632
745
|
if (consumed !== undefined && consumed.binding === consumedBinding) {
|
|
633
746
|
return {
|
|
634
747
|
handoff_ref: {
|
|
635
748
|
handoff_id: consumed.ref,
|
|
636
|
-
destination_type:
|
|
637
|
-
...(
|
|
749
|
+
destination_type: destination.destination_type,
|
|
750
|
+
...(destination.url !== null ? { url: destination.url } : {}),
|
|
638
751
|
},
|
|
639
752
|
authorization,
|
|
640
753
|
};
|
|
@@ -643,8 +756,8 @@ export class KiwiBuyerService {
|
|
|
643
756
|
}
|
|
644
757
|
const handoffRef = {
|
|
645
758
|
handoff_id: `handoff-${uuidv7()}`,
|
|
646
|
-
destination_type:
|
|
647
|
-
...(
|
|
759
|
+
destination_type: destination.destination_type,
|
|
760
|
+
...(destination.url !== null ? { url: destination.url } : {}),
|
|
648
761
|
};
|
|
649
762
|
this.store.setApproval(approval.task_id, {
|
|
650
763
|
...approval,
|
|
@@ -658,6 +771,185 @@ export class KiwiBuyerService {
|
|
|
658
771
|
});
|
|
659
772
|
}
|
|
660
773
|
// ---- 持久审批(宿主适配面;kiwi_approve / kiwi_reject 为 MCP 工具)----------
|
|
774
|
+
// ---- A 卡:handoff 意图(版本化、摘要不含自身、与 approval 同事务)----------
|
|
775
|
+
/** 目的地归一:类型词表校验 + URL 归一(http/https、无凭据、无 fragment)。 */
|
|
776
|
+
normalizeHandoffDestination(input) {
|
|
777
|
+
if (!isDestinationType(input.destination_type)) {
|
|
778
|
+
throw new McpError("invalid_params", `未知 destination_type:${String(input.destination_type)}`);
|
|
779
|
+
}
|
|
780
|
+
const type = input.destination_type;
|
|
781
|
+
let url = null;
|
|
782
|
+
if (input.url !== undefined) {
|
|
783
|
+
let parsed;
|
|
784
|
+
try {
|
|
785
|
+
parsed = new URL(input.url);
|
|
786
|
+
}
|
|
787
|
+
catch {
|
|
788
|
+
throw new McpError("invalid_params", `destination url 不是合法绝对 URL:${input.url}`);
|
|
789
|
+
}
|
|
790
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
791
|
+
throw new McpError("invalid_params", `destination url 必须是 http(s):${input.url}`);
|
|
792
|
+
}
|
|
793
|
+
if (parsed.username !== "" || parsed.password !== "") {
|
|
794
|
+
throw new McpError("invalid_params", "destination url 不得内嵌凭据");
|
|
795
|
+
}
|
|
796
|
+
if (parsed.hash !== "") {
|
|
797
|
+
throw new McpError("invalid_params", "destination url 不得携带 fragment");
|
|
798
|
+
}
|
|
799
|
+
url = parsed.href;
|
|
800
|
+
}
|
|
801
|
+
if (isUrlDestinationType(type) && url === null) {
|
|
802
|
+
throw new McpError("invalid_params", `destination_type=${type} 必须提供 url`);
|
|
803
|
+
}
|
|
804
|
+
if (isSessionDestinationType(type) && url !== null) {
|
|
805
|
+
throw new McpError("invalid_params", `destination_type=${type} 不得携带 url(会话类为 opaque ref)`);
|
|
806
|
+
}
|
|
807
|
+
return { destination_type: type, url };
|
|
808
|
+
}
|
|
809
|
+
/** 意图对象(不含 intent_digest);字段集固定,缺失一律 null。 */
|
|
810
|
+
buildHandoffIntent(args) {
|
|
811
|
+
const body = {
|
|
812
|
+
intent_version: HANDOFF_INTENT_VERSION,
|
|
813
|
+
action: "handoff",
|
|
814
|
+
task_id: args.task.task_id,
|
|
815
|
+
agreement_id: args.agreement.agreement_id,
|
|
816
|
+
destination_type: args.destination.destination_type,
|
|
817
|
+
url: args.destination.url,
|
|
818
|
+
agreement_sha256: `sha256:${sha256Hex(args.agreement.payload)}`,
|
|
819
|
+
terms_digest: args.agreement.terms_digest ?? null,
|
|
820
|
+
policy_id: this.policySnapshot.policy_id,
|
|
821
|
+
policy_digest: this.policyDigest,
|
|
822
|
+
issued_at: args.issuedAt,
|
|
823
|
+
expires_at: args.expiresAt,
|
|
824
|
+
};
|
|
825
|
+
return { intent_id: `intent-${uuidv7()}`, intent_digest: contentDigest(body), ...body };
|
|
826
|
+
}
|
|
827
|
+
/**
|
|
828
|
+
* 意图感知的 ASK:在泛型 evaluateAuthorization 之前由 handoff 调用,
|
|
829
|
+
* 同事务写 intent 与 approval,杜绝"先产生无目的地审批再补绑定"。
|
|
830
|
+
*/
|
|
831
|
+
requestHandoffApproval(args) {
|
|
832
|
+
const nowIso = this.now();
|
|
833
|
+
const nowMs = Date.parse(nowIso);
|
|
834
|
+
const task = this.store.getTask(args.agreement.task_id);
|
|
835
|
+
if (task === undefined)
|
|
836
|
+
throw new McpError("task_not_found", `task ${args.agreement.task_id} not found`);
|
|
837
|
+
// policy 自身期限在 ASK 侧同样独立校验(同一 now 样本)。
|
|
838
|
+
this.assertPolicyActive(nowMs);
|
|
839
|
+
const taskExpiry = task.expires_at === undefined ? Number.NaN : Date.parse(task.expires_at);
|
|
840
|
+
if (!Number.isFinite(taskExpiry) || taskExpiry <= nowMs) {
|
|
841
|
+
throw new McpError("invalid_params", `task ${task.task_id} 已过期或缺少有效期限`);
|
|
842
|
+
}
|
|
843
|
+
if (args.agreement.expires_at != null) {
|
|
844
|
+
const agreementExpiry = Date.parse(args.agreement.expires_at);
|
|
845
|
+
if (!Number.isFinite(agreementExpiry) || agreementExpiry <= nowMs) {
|
|
846
|
+
throw new McpError("invalid_params", `agreement ${args.agreement.agreement_id} 已过期或期限非法`);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const intent = this.buildHandoffIntent({
|
|
850
|
+
task,
|
|
851
|
+
agreement: args.agreement,
|
|
852
|
+
destination: args.destination,
|
|
853
|
+
issuedAt: nowIso,
|
|
854
|
+
expiresAt: task.expires_at,
|
|
855
|
+
});
|
|
856
|
+
return this.store.transaction(() => {
|
|
857
|
+
this.store.setHandoffIntent(intent);
|
|
858
|
+
const created = this.requestApproval({
|
|
859
|
+
task_id: task.task_id,
|
|
860
|
+
action: "handoff",
|
|
861
|
+
candidate_digest: undefined,
|
|
862
|
+
});
|
|
863
|
+
if (!this.store.bindApprovalIntent(created.approval_id, intent.intent_digest)) {
|
|
864
|
+
throw new McpError("approval_denied", `approval ${created.approval_id} 无法绑定意图`);
|
|
865
|
+
}
|
|
866
|
+
return created.approval_id;
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* 由存储的 intent 重建 canonical body(字段集与 `buildHandoffIntent` 完全一致,
|
|
871
|
+
* 排除 `intent_digest` 自身)。任何字段被改都会改变重算摘要。
|
|
872
|
+
*/
|
|
873
|
+
handoffIntentBody(intent) {
|
|
874
|
+
return {
|
|
875
|
+
intent_version: intent.intent_version,
|
|
876
|
+
action: "handoff",
|
|
877
|
+
task_id: intent.task_id,
|
|
878
|
+
agreement_id: intent.agreement_id,
|
|
879
|
+
destination_type: intent.destination_type,
|
|
880
|
+
url: intent.url ?? null,
|
|
881
|
+
agreement_sha256: intent.agreement_sha256,
|
|
882
|
+
terms_digest: intent.terms_digest ?? null,
|
|
883
|
+
policy_id: intent.policy_id,
|
|
884
|
+
policy_digest: intent.policy_digest,
|
|
885
|
+
issued_at: intent.issued_at,
|
|
886
|
+
expires_at: intent.expires_at,
|
|
887
|
+
};
|
|
888
|
+
}
|
|
889
|
+
/** policy 自身期限必须独立有效(不能只靠 DB 其它期限间接代表)。 */
|
|
890
|
+
assertPolicyActive(nowMs) {
|
|
891
|
+
const raw = this.policySnapshot.expires_at;
|
|
892
|
+
const ms = typeof raw === "string" ? Date.parse(raw) : Number.NaN;
|
|
893
|
+
if (!Number.isFinite(ms) || ms <= nowMs) {
|
|
894
|
+
throw new McpError("approval_denied", "委托策略已过期或缺少有效期限");
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
/** 消费前的意图核验:重算摘要 + 逐字段 + 重算 agreement 摘要 + 现值 terms + policy 期限/摘要 + 全部期限。 */
|
|
898
|
+
assertHandoffIntentMatches(args) {
|
|
899
|
+
if (args.approval.action !== "handoff") {
|
|
900
|
+
throw new McpError("approval_denied", `approval ${args.approval.approval_id} 动作不是 handoff`);
|
|
901
|
+
}
|
|
902
|
+
if (args.approval.intent_digest === undefined) {
|
|
903
|
+
throw new McpError("approval_denied", `approval ${args.approval.approval_id} 缺少 handoff 意图(旧审批),请重新 ASK`);
|
|
904
|
+
}
|
|
905
|
+
const intent = this.store.getHandoffIntent(args.approval.intent_digest);
|
|
906
|
+
if (intent === undefined) {
|
|
907
|
+
throw new McpError("approval_denied", `approval ${args.approval.approval_id} 的意图不存在`);
|
|
908
|
+
}
|
|
909
|
+
const nowMs = Date.parse(this.now());
|
|
910
|
+
// (1) policy 自身期限独立校验(同一 now 样本)。
|
|
911
|
+
this.assertPolicyActive(nowMs);
|
|
912
|
+
// (2) 重建 canonical body 并重算摘要:必须同时等于存储摘要与 approval 绑定,
|
|
913
|
+
// 防止"只改持久字段、摘要与绑定不动"的漂移。
|
|
914
|
+
const rebuiltDigest = contentDigest(this.handoffIntentBody(intent));
|
|
915
|
+
if (rebuiltDigest !== intent.intent_digest || rebuiltDigest !== args.approval.intent_digest) {
|
|
916
|
+
throw new McpError("approval_denied", "handoff 意图摘要与存储不一致(内容被改动)");
|
|
917
|
+
}
|
|
918
|
+
const expiries = [intent.expires_at, args.approval.expires_at, args.task.expires_at];
|
|
919
|
+
if (args.agreement.expires_at != null)
|
|
920
|
+
expiries.push(args.agreement.expires_at);
|
|
921
|
+
for (const value of expiries) {
|
|
922
|
+
if (value === undefined)
|
|
923
|
+
continue;
|
|
924
|
+
const ms = Date.parse(value);
|
|
925
|
+
if (!Number.isFinite(ms) || ms <= nowMs) {
|
|
926
|
+
throw new McpError("approval_denied", `handoff 期限已过或非法:${String(value)}`);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
const mismatch = [];
|
|
930
|
+
if (intent.intent_version !== HANDOFF_INTENT_VERSION)
|
|
931
|
+
mismatch.push("intent_version");
|
|
932
|
+
if (intent.task_id !== args.task.task_id)
|
|
933
|
+
mismatch.push("task_id");
|
|
934
|
+
if (intent.agreement_id !== args.agreement.agreement_id)
|
|
935
|
+
mismatch.push("agreement_id");
|
|
936
|
+
if (intent.destination_type !== args.destination.destination_type)
|
|
937
|
+
mismatch.push("destination_type");
|
|
938
|
+
if (intent.url !== args.destination.url)
|
|
939
|
+
mismatch.push("url");
|
|
940
|
+
if (intent.agreement_sha256 !== `sha256:${sha256Hex(args.agreement.payload)}`)
|
|
941
|
+
mismatch.push("agreement_sha256");
|
|
942
|
+
if (intent.terms_digest !== (args.agreement.terms_digest ?? null))
|
|
943
|
+
mismatch.push("terms_digest");
|
|
944
|
+
if (intent.policy_digest !== this.policyDigest)
|
|
945
|
+
mismatch.push("policy_digest");
|
|
946
|
+
if (intent.policy_id !== this.policySnapshot.policy_id)
|
|
947
|
+
mismatch.push("policy_id");
|
|
948
|
+
if (mismatch.length > 0) {
|
|
949
|
+
throw new McpError("approval_denied", `handoff 意图与当前请求不一致:${mismatch.join(",")}`);
|
|
950
|
+
}
|
|
951
|
+
return intent;
|
|
952
|
+
}
|
|
661
953
|
/** 创建 pending 审批记录(ASK 动作触发)。返回持久 approval_id。 */
|
|
662
954
|
requestApproval(input) {
|
|
663
955
|
const task = this.store.getTask(input.task_id);
|