Created
September 13, 2026 07:05
-
-
Save zxkane/5b94758c17b0b545540d7d0f63c850f5 to your computer and use it in GitHub Desktop.
Node.js 24 Bedrock Responses router for Codex and ChatGPT: regional model routing, reasoning.summary cleanup, and streaming tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "bedrock-router-blog-example", | |
| "version": "1.0.0", | |
| "lockfileVersion": 3, | |
| "requires": true, | |
| "packages": { | |
| "": { | |
| "name": "bedrock-router-blog-example", | |
| "version": "1.0.0", | |
| "dependencies": { | |
| "@aws-sdk/credential-providers": "3.985.0", | |
| "@aws/bedrock-token-generator": "1.1.0" | |
| }, | |
| "engines": { | |
| "node": ">=24" | |
| } | |
| }, | |
| "node_modules/@aws-crypto/sha256-browser": { | |
| "version": "5.2.0", | |
| "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", | |
| "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-crypto/sha256-js": "^5.2.0", | |
| "@aws-crypto/supports-web-crypto": "^5.2.0", | |
| "@aws-crypto/util": "^5.2.0", | |
| "@aws-sdk/types": "^3.222.0", | |
| "@aws-sdk/util-locate-window": "^3.0.0", | |
| "@smithy/util-utf8": "^2.0.0", | |
| "tslib": "^2.6.2" | |
| } | |
| }, | |
| "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { | |
| "version": "2.3.0", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", | |
| "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/util-buffer-from": "^2.2.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=14.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-crypto/sha256-js": { | |
| "version": "5.2.0", | |
| "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", | |
| "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-crypto/util": "^5.2.0", | |
| "@aws-sdk/types": "^3.222.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=16.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-crypto/supports-web-crypto": { | |
| "version": "5.2.0", | |
| "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", | |
| "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "tslib": "^2.6.2" | |
| } | |
| }, | |
| "node_modules/@aws-crypto/util": { | |
| "version": "5.2.0", | |
| "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", | |
| "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/types": "^3.222.0", | |
| "@smithy/util-utf8": "^2.0.0", | |
| "tslib": "^2.6.2" | |
| } | |
| }, | |
| "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { | |
| "version": "2.3.0", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", | |
| "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/util-buffer-from": "^2.2.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=14.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/client-cognito-identity": { | |
| "version": "3.985.0", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/client-cognito-identity/-/client-cognito-identity-3.985.0.tgz", | |
| "integrity": "sha512-PpHgiNGLsnQ2QHh0wx/uhGV3kxlASp2LOl5Z+LQCnu59i8rjAH1decT03QNWcho3Jz4zg9Kcto6VoAxu6OFb2A==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-crypto/sha256-browser": "5.2.0", | |
| "@aws-crypto/sha256-js": "5.2.0", | |
| "@aws-sdk/core": "^3.973.7", | |
| "@aws-sdk/credential-provider-node": "^3.972.6", | |
| "@aws-sdk/middleware-host-header": "^3.972.3", | |
| "@aws-sdk/middleware-logger": "^3.972.3", | |
| "@aws-sdk/middleware-recursion-detection": "^3.972.3", | |
| "@aws-sdk/middleware-user-agent": "^3.972.7", | |
| "@aws-sdk/region-config-resolver": "^3.972.3", | |
| "@aws-sdk/types": "^3.973.1", | |
| "@aws-sdk/util-endpoints": "3.985.0", | |
| "@aws-sdk/util-user-agent-browser": "^3.972.3", | |
| "@aws-sdk/util-user-agent-node": "^3.972.5", | |
| "@smithy/config-resolver": "^4.4.6", | |
| "@smithy/core": "^3.22.1", | |
| "@smithy/fetch-http-handler": "^5.3.9", | |
| "@smithy/hash-node": "^4.2.8", | |
| "@smithy/invalid-dependency": "^4.2.8", | |
| "@smithy/middleware-content-length": "^4.2.8", | |
| "@smithy/middleware-endpoint": "^4.4.13", | |
| "@smithy/middleware-retry": "^4.4.30", | |
| "@smithy/middleware-serde": "^4.2.9", | |
| "@smithy/middleware-stack": "^4.2.8", | |
| "@smithy/node-config-provider": "^4.3.8", | |
| "@smithy/node-http-handler": "^4.4.9", | |
| "@smithy/protocol-http": "^5.3.8", | |
| "@smithy/smithy-client": "^4.11.2", | |
| "@smithy/types": "^4.12.0", | |
| "@smithy/url-parser": "^4.2.8", | |
| "@smithy/util-base64": "^4.3.0", | |
| "@smithy/util-body-length-browser": "^4.2.0", | |
| "@smithy/util-body-length-node": "^4.2.1", | |
| "@smithy/util-defaults-mode-browser": "^4.3.29", | |
| "@smithy/util-defaults-mode-node": "^4.2.32", | |
| "@smithy/util-endpoints": "^3.2.8", | |
| "@smithy/util-middleware": "^4.2.8", | |
| "@smithy/util-retry": "^4.2.8", | |
| "@smithy/util-utf8": "^4.2.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/core": { | |
| "version": "3.978.0", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.978.0.tgz", | |
| "integrity": "sha512-2yX9LUmxPklVjSGTb8dfnWRJSiFQ3TeH2nn7G1mdKHTfnabzF0+gfrS8rYfLWmZrQ8A3mEcxMJjRc51dL5KWaA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/types": "^3.974.5", | |
| "@aws-sdk/xml-builder": "^3.972.40", | |
| "@aws/lambda-invoke-store": "^0.3.0", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/signature-v4": "^5.6.12", | |
| "@smithy/types": "^4.17.2", | |
| "bowser": "^2.11.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-cognito-identity": { | |
| "version": "3.972.70", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-cognito-identity/-/credential-provider-cognito-identity-3.972.70.tgz", | |
| "integrity": "sha512-KlU89w6Hmb4oZB5zFz/MNIhPOBQGVE7KrDr3BTPCwC4W+q566YH8tGNsAML781LKATtqmNCGFry8XvsJ2XPusg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/nested-clients": "^3.997.45", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-cognito-identity/node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.997.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.45.tgz", | |
| "integrity": "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/signature-v4-multi-region": "^3.996.46", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-env": { | |
| "version": "3.972.71", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.972.71.tgz", | |
| "integrity": "sha512-JN+JHruYZw3GUZB8YGAlDk4wTDPOEAEEdEzj5nS0xodWR4smzHsN7PnK2j6IeOsDIj2aqua5DSbhXl9Gtf90FQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-http": { | |
| "version": "3.972.73", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.972.73.tgz", | |
| "integrity": "sha512-uyYYnJOnlis8uQzaYGPd7N1JoioCoNpXgnkXYixsWJXHXgXyYi8WXJSDfofxJeWfQIGWLe2Nwyq60Uc7MZdVOg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-ini": { | |
| "version": "3.973.16", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.973.16.tgz", | |
| "integrity": "sha512-i++ly+0Uxa+u3ebSSyr0S/3CFhFJDxCXT3+Zj+mW2bXenEx5bKGCdTIKFu39SgXBNhWDjex/8cXUx9MUTMCrTw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/credential-provider-env": "^3.972.71", | |
| "@aws-sdk/credential-provider-http": "^3.972.73", | |
| "@aws-sdk/credential-provider-login": "^3.972.78", | |
| "@aws-sdk/credential-provider-process": "^3.972.71", | |
| "@aws-sdk/credential-provider-sso": "^3.973.15", | |
| "@aws-sdk/credential-provider-web-identity": "^3.972.77", | |
| "@aws-sdk/nested-clients": "^3.997.45", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/credential-provider-imds": "^4.4.16", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-ini/node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.997.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.45.tgz", | |
| "integrity": "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/signature-v4-multi-region": "^3.996.46", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-login": { | |
| "version": "3.972.78", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-login/-/credential-provider-login-3.972.78.tgz", | |
| "integrity": "sha512-eUtswnXu0+Ii9ieRK+0L7aPFV3Z/dnW2VntJzjBP9xs8s+8p5nBNuymIXtXwZ+5r5+XJP3e32nMkuZ/r0HozEA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/nested-clients": "^3.997.45", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-login/node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.997.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.45.tgz", | |
| "integrity": "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/signature-v4-multi-region": "^3.996.46", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-node": { | |
| "version": "3.972.83", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.972.83.tgz", | |
| "integrity": "sha512-jdso7ejzfRnatxMUZK4S/U6KbaDPCvfIV4XL+IQAPFDBt5rj5Fq595euqlK8Le4lNCMFR9oUpt+1l0aMgaayOQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/credential-provider-env": "^3.972.71", | |
| "@aws-sdk/credential-provider-http": "^3.972.73", | |
| "@aws-sdk/credential-provider-ini": "^3.973.16", | |
| "@aws-sdk/credential-provider-process": "^3.972.71", | |
| "@aws-sdk/credential-provider-sso": "^3.973.15", | |
| "@aws-sdk/credential-provider-web-identity": "^3.972.77", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/credential-provider-imds": "^4.4.16", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-process": { | |
| "version": "3.972.71", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.972.71.tgz", | |
| "integrity": "sha512-lYmXJa4gvq4xN1lrT5NiP5vIYYKcGWAdj8y+8o6dlcateB5eF3Dn8DtmjjHKfMBrTPAMr2pebIiX/UOj8c1/UA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-sso": { | |
| "version": "3.973.15", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.973.15.tgz", | |
| "integrity": "sha512-6Jhcf4v0pSFdjk1EW2kvzuEBKD+UZ2uNcHUIglKKLndD20YhvkL2kdmDOV5/j4mYuWWwe/a1FQ1aomU86/Cg5Q==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/nested-clients": "^3.997.45", | |
| "@aws-sdk/token-providers": "3.1129.0", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.997.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.45.tgz", | |
| "integrity": "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/signature-v4-multi-region": "^3.996.46", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-web-identity": { | |
| "version": "3.972.77", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.972.77.tgz", | |
| "integrity": "sha512-uylIQSUWpfLuH2LovxEEfwzJGM/SabLOfLMg6YXu/E8jJEKUdpdILCVCQCdFvHyu/7dLJOHPMfrSwduxO56NkQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/nested-clients": "^3.997.45", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-provider-web-identity/node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.997.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.45.tgz", | |
| "integrity": "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/signature-v4-multi-region": "^3.996.46", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/credential-providers": { | |
| "version": "3.985.0", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/credential-providers/-/credential-providers-3.985.0.tgz", | |
| "integrity": "sha512-mYjWyt0HiU3dYZif7yAJ+DYerSD/0bh7Umw9tUTFhhXrPePGTbJPyJx+vLmEh2dG2hCr7Qpn6DZdY8sB5yOxhQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/client-cognito-identity": "3.985.0", | |
| "@aws-sdk/core": "^3.973.7", | |
| "@aws-sdk/credential-provider-cognito-identity": "^3.972.3", | |
| "@aws-sdk/credential-provider-env": "^3.972.5", | |
| "@aws-sdk/credential-provider-http": "^3.972.7", | |
| "@aws-sdk/credential-provider-ini": "^3.972.5", | |
| "@aws-sdk/credential-provider-login": "^3.972.5", | |
| "@aws-sdk/credential-provider-node": "^3.972.6", | |
| "@aws-sdk/credential-provider-process": "^3.972.5", | |
| "@aws-sdk/credential-provider-sso": "^3.972.5", | |
| "@aws-sdk/credential-provider-web-identity": "^3.972.5", | |
| "@aws-sdk/nested-clients": "3.985.0", | |
| "@aws-sdk/types": "^3.973.1", | |
| "@smithy/config-resolver": "^4.4.6", | |
| "@smithy/core": "^3.22.1", | |
| "@smithy/credential-provider-imds": "^4.2.8", | |
| "@smithy/node-config-provider": "^4.3.8", | |
| "@smithy/property-provider": "^4.2.8", | |
| "@smithy/types": "^4.12.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/middleware-host-header": { | |
| "version": "3.972.46", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.972.46.tgz", | |
| "integrity": "sha512-+e7anPzwwSVRSGlVdcnB9zFAqg1Jv7tIAeka6THyydF0pAwh2yJ2stYNjoWBYi7v5eJpATLhrnRNC1DlKLfBaw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/middleware-logger": { | |
| "version": "3.972.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.972.45.tgz", | |
| "integrity": "sha512-+rjCxwS/qITrmgzio67fLzKyzJCGED5UIDm7RLnrZ4/LpFau0iE7j+BRcl1ORfH/89ztu113vY3t5gONcKlGHw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/middleware-recursion-detection": { | |
| "version": "3.972.47", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.972.47.tgz", | |
| "integrity": "sha512-YrVlExpLUfQklGuI5Neeuj9MwzNEbfCzRfoNIGO3kXLxve/ZiAMOxDmEPlhOWlq2I0RJDHqF4QyRNLPJSU+EjA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/middleware-user-agent": { | |
| "version": "3.972.75", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.972.75.tgz", | |
| "integrity": "sha512-LGmSbKuxzhA7W+4f/th0eV0dMv3ZBPpn5ip1HiFSC3sM+9pX0Nmcr9vKhVyhk3YpYdpegI7UCKbXNOK/dWX6aw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.985.0", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.985.0.tgz", | |
| "integrity": "sha512-TsWwKzb/2WHafAY0CE7uXgLj0FmnkBTgfioG9HO+7z/zCPcl1+YU+i7dW4o0y+aFxFgxTMG+ExBQpqT/k2ao8g==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-crypto/sha256-browser": "5.2.0", | |
| "@aws-crypto/sha256-js": "5.2.0", | |
| "@aws-sdk/core": "^3.973.7", | |
| "@aws-sdk/middleware-host-header": "^3.972.3", | |
| "@aws-sdk/middleware-logger": "^3.972.3", | |
| "@aws-sdk/middleware-recursion-detection": "^3.972.3", | |
| "@aws-sdk/middleware-user-agent": "^3.972.7", | |
| "@aws-sdk/region-config-resolver": "^3.972.3", | |
| "@aws-sdk/types": "^3.973.1", | |
| "@aws-sdk/util-endpoints": "3.985.0", | |
| "@aws-sdk/util-user-agent-browser": "^3.972.3", | |
| "@aws-sdk/util-user-agent-node": "^3.972.5", | |
| "@smithy/config-resolver": "^4.4.6", | |
| "@smithy/core": "^3.22.1", | |
| "@smithy/fetch-http-handler": "^5.3.9", | |
| "@smithy/hash-node": "^4.2.8", | |
| "@smithy/invalid-dependency": "^4.2.8", | |
| "@smithy/middleware-content-length": "^4.2.8", | |
| "@smithy/middleware-endpoint": "^4.4.13", | |
| "@smithy/middleware-retry": "^4.4.30", | |
| "@smithy/middleware-serde": "^4.2.9", | |
| "@smithy/middleware-stack": "^4.2.8", | |
| "@smithy/node-config-provider": "^4.3.8", | |
| "@smithy/node-http-handler": "^4.4.9", | |
| "@smithy/protocol-http": "^5.3.8", | |
| "@smithy/smithy-client": "^4.11.2", | |
| "@smithy/types": "^4.12.0", | |
| "@smithy/url-parser": "^4.2.8", | |
| "@smithy/util-base64": "^4.3.0", | |
| "@smithy/util-body-length-browser": "^4.2.0", | |
| "@smithy/util-body-length-node": "^4.2.1", | |
| "@smithy/util-defaults-mode-browser": "^4.3.29", | |
| "@smithy/util-defaults-mode-node": "^4.2.32", | |
| "@smithy/util-endpoints": "^3.2.8", | |
| "@smithy/util-middleware": "^4.2.8", | |
| "@smithy/util-retry": "^4.2.8", | |
| "@smithy/util-utf8": "^4.2.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/region-config-resolver": { | |
| "version": "3.972.49", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.972.49.tgz", | |
| "integrity": "sha512-E8bqidh0M9OX2SUIwpOEZzU3HjL5lOFuVYlk7ikmwOOCig/KRj80sYZI/2qMlYGlo7STCy2x6U/jgp2ZBa5Gbw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/signature-v4-multi-region": { | |
| "version": "3.996.46", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.996.46.tgz", | |
| "integrity": "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/signature-v4": "^5.6.12", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/token-providers": { | |
| "version": "3.1129.0", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.1129.0.tgz", | |
| "integrity": "sha512-Sbl3rpzQdsG4ZK2zh0JWUYyZPKKorJlVOddA2T0DVbKJFrsW8J6wgnslxxUH04+WaBMr4A1HzJZvZX0xUvkniA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/nested-clients": "^3.997.45", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/token-providers/node_modules/@aws-sdk/nested-clients": { | |
| "version": "3.997.45", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/nested-clients/-/nested-clients-3.997.45.tgz", | |
| "integrity": "sha512-mooq9Q+jLa18VoM7HouczmslZU60iiB0aKc/Ztnq/luIL1ud0z4DnYprLR/ZO1gp331S9tJctM1HZr7u6YKBXQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "@aws-sdk/signature-v4-multi-region": "^3.996.46", | |
| "@aws-sdk/types": "^3.974.5", | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/fetch-http-handler": "^5.7.2", | |
| "@smithy/node-http-handler": "^4.11.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/types": { | |
| "version": "3.974.5", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.974.5.tgz", | |
| "integrity": "sha512-LkwLL2BLbC6wNNm4JaH9mbEqBMdOZCct6VAYqhdN4U1xrWM+fUJQEfbHwQgDypapOWTRtlk25akb5afM0P8CIQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/util-endpoints": { | |
| "version": "3.985.0", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.985.0.tgz", | |
| "integrity": "sha512-vth7UfGSUR3ljvaq8V4Rc62FsM7GUTH/myxPWkaEgOrprz1/Pc72EgTXxj+cPPPDAfHFIpjhkB7T7Td0RJx+BA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/types": "^3.973.1", | |
| "@smithy/types": "^4.12.0", | |
| "@smithy/url-parser": "^4.2.8", | |
| "@smithy/util-endpoints": "^3.2.8", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/util-format-url": { | |
| "version": "3.972.47", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/util-format-url/-/util-format-url-3.972.47.tgz", | |
| "integrity": "sha512-MdxDDRjsrLAEpY8+astSjT3cmpMfxutLuCbvTizRsLUotFamPZMaARqmnxCcsuwz0MVGj8k6/gRZz9d5SYq0Zw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/util-locate-window": { | |
| "version": "3.965.10", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.965.10.tgz", | |
| "integrity": "sha512-ycwH6Zd2GhuSqdXX9ihbCjeGTB6xOJs+O3+Jb8/zDG9978XU80qs75dfkPJRMNKe5MvBZPuNeFpd4JZKPoUF4g==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/util-user-agent-browser": { | |
| "version": "3.972.46", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.972.46.tgz", | |
| "integrity": "sha512-4DN8JqKyJ/pB80d90xlOBOo1R4s71fLxlYdNhSXHMaWSL2XBqimD95G+6J+i+OR8QrG9e2e3QgdV1yqvbTcTcw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/util-user-agent-node": { | |
| "version": "3.973.61", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.973.61.tgz", | |
| "integrity": "sha512-1vC+HqswIWJ3DdCwlxujXC4u/V81pED5EFrDTvwtbCFRMTT+skQEveUyWZlFx9y2J3s6s9sdPXjxTtVNrkoV+w==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/core": "^3.978.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws-sdk/xml-builder": { | |
| "version": "3.972.40", | |
| "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.972.40.tgz", | |
| "integrity": "sha512-wlFmCIGUlwF4zx/kncw+bmxTQh1HeSJq4mYV/V5cZUSJadDP3kXvGW8Rn21cimj/7y9ju+47oYWXi97vF7czaA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=20.0.0" | |
| } | |
| }, | |
| "node_modules/@aws/bedrock-token-generator": { | |
| "version": "1.1.0", | |
| "resolved": "https://registry.npmjs.org/@aws/bedrock-token-generator/-/bedrock-token-generator-1.1.0.tgz", | |
| "integrity": "sha512-i+DkWnfdA4j4sffy9dI4k3OGoOWqN8CTGdtO4IZ3c0kpKYFr6KyqzqLQmoRNrF3ACFcWj6u+J6cbBQ97j9wx5w==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@aws-sdk/credential-providers": "^3.525.0", | |
| "@aws-sdk/util-format-url": ">=3.525.0", | |
| "@smithy/config-resolver": "^4.1.4", | |
| "@smithy/hash-node": ">=2.1.3", | |
| "@smithy/invalid-dependency": "^4.0.4", | |
| "@smithy/node-config-provider": "^4.1.3", | |
| "@smithy/protocol-http": ">=3.2.1", | |
| "@smithy/signature-v4": ">=2.1.3", | |
| "@smithy/types": ">=2.11.0" | |
| }, | |
| "engines": { | |
| "node": ">=16.0.0" | |
| } | |
| }, | |
| "node_modules/@aws/lambda-invoke-store": { | |
| "version": "0.3.0", | |
| "resolved": "https://registry.npmjs.org/@aws/lambda-invoke-store/-/lambda-invoke-store-0.3.0.tgz", | |
| "integrity": "sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ==", | |
| "license": "Apache-2.0", | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/config-resolver": { | |
| "version": "4.7.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-4.7.2.tgz", | |
| "integrity": "sha512-Y1XfSefHIOub9762qm3ShafdlEE/Va8h3kLUeMq765fNeWeNLcOP2YUPr86H1SlyGwZTOqQ67RlBZPZ3k9Djgg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/core": { | |
| "version": "3.34.1", | |
| "resolved": "https://registry.npmjs.org/@smithy/core/-/core-3.34.1.tgz", | |
| "integrity": "sha512-dLcOUxz8YCv1RZUMKq6GbyUf95pLbrqh34bPvpCZ1+CByFF31BEAFewZjsGCnVsZTKdThNENfGyAgk2TJqVwSw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/types": "^4.18.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/credential-provider-imds": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-4.5.2.tgz", | |
| "integrity": "sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/fetch-http-handler": { | |
| "version": "5.8.0", | |
| "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-5.8.0.tgz", | |
| "integrity": "sha512-ycSJu3tFAQ4v04CBB0agqFMVsSQ1iG3yw+SpgxRqKfaURpQD4CZ8Wn0zPMmSnOuTpTh65Vz+EA0rMrw089wvkA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.18.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/hash-node": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-4.5.2.tgz", | |
| "integrity": "sha512-OcD8fGClTkP0BWHVEAgUp1RZyCw8cKfqTPQ+DgrSF5jvR8zKkw2Aud79L4G/1Fu3QKLcsHExxRIPQCcKx7+xkg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/invalid-dependency": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-4.5.2.tgz", | |
| "integrity": "sha512-VONOgtCxIXtwXrLVZPUdxOELYpkFzNizkpbQE5CrJ/OEh12Osx+LVXsLEAF+JcvVqPODmUoOUaovlOjCQHTOow==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/is-array-buffer": { | |
| "version": "2.2.0", | |
| "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", | |
| "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=14.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/middleware-content-length": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-4.5.2.tgz", | |
| "integrity": "sha512-43Ixsc2OE5rhruhc9a1vETUCmK3Yh1AIbg2+wwQUgloOIti2FgPHmPLLBkjIqx8vdmpABtsVlhazNr5TMZKJmA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/middleware-endpoint": { | |
| "version": "4.7.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-4.7.2.tgz", | |
| "integrity": "sha512-7HgK3/pQQHcD5w9lOPtK53/eDMKDp324Nd4KZ8XvxlcKHiWytuM9VwVOB2iy3rutsz/N1WNEWBkaRBayrGnuog==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/middleware-retry": { | |
| "version": "4.8.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-4.8.2.tgz", | |
| "integrity": "sha512-wj0BTZ6SC7YI8hSLMbZCO1BP7k8JOuSUHjRYrZJApqNEiHL6jxaLs5Sr92EeXu5CuVzZOUCFUuewXusWxps0bQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/middleware-serde": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-4.5.2.tgz", | |
| "integrity": "sha512-5Qeqkw4IdmUQUGR/FRImBruFcnXiwGC8+EOVH377bonkQF66temzxM4HbCnOOQb8U/SClP1IdlFbC7CTmKux4Q==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/middleware-stack": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-4.5.2.tgz", | |
| "integrity": "sha512-db1TDSBA03WtomPMLWPy69L85vEaQbbnDHlmCYQ7hIqOdD22K+k8GlsVYdafYKaFkJaJW2OvcgcXOELGfhtptA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/node-config-provider": { | |
| "version": "4.6.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-4.6.2.tgz", | |
| "integrity": "sha512-zMrXu/O5tPa7GLtra8L4wFG6DACcXT9QV4Ay+WEAjUhXm1dVq7c/q9Qv9gkJZNLY8hmQKg08778kDcxpKNMqOA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/node-http-handler": { | |
| "version": "4.12.1", | |
| "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-4.12.1.tgz", | |
| "integrity": "sha512-ThMkboGeONWXAelq9FvGsuJC4rOi+qyC4/zhUF58xYpxUg5sQKx2VXZYJmtNjr4dSuBJ1HeJXETQILCz3wOHvw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.18.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/property-provider": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-4.5.2.tgz", | |
| "integrity": "sha512-SPJCSCCGpHf5g5b8244ig3WVKIdv2DS+X6cfmy4bpKEYo4VlLYM+bGHpHbfbmp76vegMKQBvs7DEpwQ5YuhKLA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/protocol-http": { | |
| "version": "5.6.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-5.6.2.tgz", | |
| "integrity": "sha512-Asd04MaxODN6FNY8EPTeCAM4kPNi3jDUAjZU0Y4F9rHvpLUrrUo7KLcxFgSthywFr6dZfIyDLIJda6jxmVTk5w==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/signature-v4": { | |
| "version": "5.7.3", | |
| "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-5.7.3.tgz", | |
| "integrity": "sha512-7ImGm+FkHRLcBaRttIAMZ6bzJZWb2cJGoYjq46F2UjycujWzrL9GEN9h4w7eQyXJYnltrUhxbbieBAIRrdqpow==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.3", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/smithy-client": { | |
| "version": "4.15.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-4.15.2.tgz", | |
| "integrity": "sha512-qweA7dHwcWmq8IN2mIGo7nAfeji1nwWBra+P3nz4R8W8yoQYE6Iy2bN33I0W3d50MN/V5EiDY/nElr4EHITsrg==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "@smithy/types": "^4.17.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/types": { | |
| "version": "4.18.0", | |
| "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.18.0.tgz", | |
| "integrity": "sha512-CgB6HHWer/vrKps24ulRIbpcpb7K4xAU7SkZ7YHzBPlwHsvsrCJFEXK421s+cJzX+ZrqtA/TuU5w1HzI7k9N8A==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/url-parser": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-4.5.2.tgz", | |
| "integrity": "sha512-xqZcyU/YjOt9ofe8WM1y9aCaAmxel2iRiHpkT0x2BN++mRXw0M4VdxPAOtuux279JndY6wWMiOt5BJ2xmAuMYA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-base64": { | |
| "version": "4.6.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-4.6.2.tgz", | |
| "integrity": "sha512-wTQX1hPfElIqY6AzM/s6c4UgpMxCL4MwJ5u6340ksLPq78lur6Y+keheIDk5gMX4G3KFh4MERcDt6xhRq+ie1Q==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-body-length-browser": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-4.5.2.tgz", | |
| "integrity": "sha512-QyeUSin/R2nz0hXZ5ObTvhmCQomsr6+ZyHygab5AH5+fTY5xVDQeX1DFKp9uPEwOs6RW26jEn9yqq+4yqIZDrA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-body-length-node": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-4.5.2.tgz", | |
| "integrity": "sha512-SErsW8pBKTCkFEA1RoChwW6/8JYzdcWqWDOsRP0xOtxMYsHOUMcldkcQjtujpKSy2FtlywqygCOxSKarc4TAZw==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-buffer-from": { | |
| "version": "2.2.0", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", | |
| "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/is-array-buffer": "^2.2.0", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=14.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-defaults-mode-browser": { | |
| "version": "4.6.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-4.6.2.tgz", | |
| "integrity": "sha512-wENSdyLXVzupl1nyPK7JP/wt6Lkph/psRgocKli5NLh7O936L66FrZQ/I9HBHwZ5N0Z4MJUoj8qNdw+/6cTRgA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-defaults-mode-node": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-4.5.2.tgz", | |
| "integrity": "sha512-3915rhdCibo7Do927AFV6pXxsIiaKOZGGexJ3LnT2l5CgJZi3DPqZ2ZMhYTIPjiRA3asHhPe0gaFBtxuqXC8aA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-endpoints": { | |
| "version": "3.7.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-3.7.2.tgz", | |
| "integrity": "sha512-16wQS3r4gXctr9/uYB0OUAUOm1LZLUKAsBeG364l64OalFwsRRvgO+AjL3OYxmxt060z1ExchX2ayrNVfM0r9Q==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-middleware": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-4.5.2.tgz", | |
| "integrity": "sha512-wmfA04AZqTwu10EWGKUu4dm/3BZfSedqlqAiQPWVr8OkwFh0MovRDBwc48Pzd2YEEjqpI0JwXVk65TBarff3wQ==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-retry": { | |
| "version": "4.6.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-4.6.2.tgz", | |
| "integrity": "sha512-q6MXFNu+W4ZCNdNKutzDLP/Hzumd1FU9CQX++P/7ylanYIYiGhgZwSzwZWAw+G1RNcfY+RBYv61XcGlSYhj+BA==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/@smithy/util-utf8": { | |
| "version": "4.5.2", | |
| "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-4.5.2.tgz", | |
| "integrity": "sha512-7wNWV7SugHpcMA7uzEawJNpE0GrasXM7a9E+1+Wm6NxVuDClESac/AKt+G7jMZNUz5vBLWqKlqVV7Sv7AtUr6Q==", | |
| "license": "Apache-2.0", | |
| "dependencies": { | |
| "@smithy/core": "^3.33.2", | |
| "tslib": "^2.6.2" | |
| }, | |
| "engines": { | |
| "node": ">=18.0.0" | |
| } | |
| }, | |
| "node_modules/bowser": { | |
| "version": "2.14.1", | |
| "resolved": "https://registry.npmjs.org/bowser/-/bowser-2.14.1.tgz", | |
| "integrity": "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg==", | |
| "license": "MIT" | |
| }, | |
| "node_modules/tslib": { | |
| "version": "2.8.1", | |
| "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", | |
| "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", | |
| "license": "0BSD" | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "bedrock-router-blog-example", | |
| "version": "1.0.0", | |
| "private": true, | |
| "type": "module", | |
| "engines": { "node": ">=24" }, | |
| "scripts": { "start": "node router.mjs", "test": "node --test" }, | |
| "dependencies": { | |
| "@aws/bedrock-token-generator": "1.1.0", | |
| "@aws-sdk/credential-providers": "3.985.0" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import http from 'node:http'; | |
| import { Readable } from 'node:stream'; | |
| import { pipeline } from 'node:stream/promises'; | |
| import { promisify } from 'node:util'; | |
| import { gunzip, inflate, brotliDecompress, zstdDecompress } from 'node:zlib'; | |
| import { pathToFileURL } from 'node:url'; | |
| import { getTokenProvider } from '@aws/bedrock-token-generator'; | |
| import { fromIni, fromNodeProviderChain } from '@aws-sdk/credential-providers'; | |
| export const routes = Object.freeze({ | |
| 'openai.gpt-6-astra': 'us-west-2', | |
| 'openai.gpt-5.6-sol': 'us-east-2', | |
| 'openai.gpt-5.6-terra': 'us-east-2', | |
| 'openai.gpt-5.6-luna': 'us-east-2', | |
| }); | |
| const paths = new Set(['/v1/responses', '/v1/responses/compact']); | |
| const limit = 32 * 1024 * 1024; | |
| export function normalize(body) { | |
| const parsed = JSON.parse(body); | |
| if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) throw new Error('Invalid payload'); | |
| if (typeof parsed.model !== 'string' || !Object.hasOwn(routes, parsed.model)) throw new Error('Unknown model'); | |
| const reasoning = parsed.reasoning; | |
| if (reasoning && typeof reasoning === 'object' && !Array.isArray(reasoning) | |
| && Object.hasOwn(reasoning, 'summary')) { | |
| // Preserve numeric literals in tool schemas, including integers above 2^53. | |
| const lossless = JSON.parse(body, (_key, value, context) => | |
| typeof value === 'number' ? JSON.rawJSON(context.source) : value); | |
| delete lossless.reasoning.summary; | |
| if (!Object.keys(lossless.reasoning).length) delete lossless.reasoning; | |
| return { region: routes[parsed.model], body: JSON.stringify(lossless), summaryRemoved: true }; | |
| } | |
| return { region: routes[parsed.model], body, summaryRemoved: false }; | |
| } | |
| export function tokenSource() { | |
| // Explicit profiles must not silently fall back to another identity. | |
| const credentials = process.env.AWS_PROFILE | |
| ? fromIni({ profile: process.env.AWS_PROFILE }) : fromNodeProviderChain(); | |
| const providers = new Map(); | |
| return region => { | |
| if (!providers.has(region)) providers.set(region, getTokenProvider({ | |
| region, credentials, expiresInSeconds: 3600, | |
| })); | |
| return providers.get(region)(); | |
| }; | |
| } | |
| async function readBody(request) { | |
| const chunks = []; | |
| let size = 0; | |
| for await (const chunk of request) { | |
| size += chunk.length; | |
| if (size > limit) throw new Error('Request too large'); | |
| chunks.push(chunk); | |
| } | |
| const body = Buffer.concat(chunks); | |
| const encoding = request.headers['content-encoding']; | |
| if (!encoding || encoding === 'identity') return body.toString('utf8'); | |
| const decode = { gzip: gunzip, deflate: inflate, br: brotliDecompress, zstd: zstdDecompress }[encoding]; | |
| if (!decode) throw new Error('Unsupported encoding'); | |
| return (await promisify(decode)(body, { maxOutputLength: limit })).toString('utf8'); | |
| } | |
| function reply(response, status, message) { | |
| response.writeHead(status, { 'content-type': 'application/json', 'cache-control': 'no-store' }); | |
| response.end(JSON.stringify({ error: { type: 'router_error', message } })); | |
| } | |
| export function createRouter({ getToken = tokenSource(), fetchImpl = fetch } = {}) { | |
| const server = http.createServer(async (request, response) => { | |
| // This unauthenticated demonstration is for a trusted, single-user host only. | |
| if (!/^127\.0\.0\.1(?::\d+)?$/.test(request.headers.host || '') || request.headers.origin | |
| || (request.headers['sec-fetch-site'] && request.headers['sec-fetch-site'] !== 'none')) { | |
| reply(response, 403, 'Local non-browser clients only'); return; | |
| } | |
| if (request.method === 'GET' && request.url === '/v1/models') { | |
| response.writeHead(200, { 'content-type': 'application/json' }); | |
| response.end(JSON.stringify({ object: 'list', data: Object.keys(routes).map(id => ({ id, object: 'model', owned_by: 'openai' })) })); | |
| return; | |
| } | |
| if (request.method !== 'POST' || !paths.has(request.url)) { | |
| reply(response, 404, 'Unsupported endpoint'); return; | |
| } | |
| let normalized; | |
| try { normalized = normalize(await readBody(request)); } | |
| catch { reply(response, 400, 'Invalid, oversized, unsupported body or unknown model'); return; } | |
| const controller = new AbortController(); | |
| response.on('close', () => { if (!response.writableFinished) controller.abort(); }); | |
| const timeout = setTimeout(() => controller.abort(), 30 * 60 * 1000).unref(); | |
| try { | |
| let token; | |
| try { token = await getToken(normalized.region); } | |
| catch { reply(response, 503, 'AWS credentials unavailable; check the selected identity'); return; } | |
| if (controller.signal.aborted) return; | |
| const upstream = await fetchImpl( | |
| `https://bedrock-mantle.${normalized.region}.api.aws/openai${request.url}`, { | |
| method: 'POST', redirect: 'error', signal: controller.signal, | |
| // Do not forward client authorization, cookies, or old length/encoding. | |
| headers: { 'content-type': 'application/json', 'accept-encoding': 'identity', | |
| authorization: `Bearer ${token}` }, | |
| body: normalized.body, | |
| }); | |
| if (process.env.BEDROCK_ROUTER_DEBUG === '1') console.error(JSON.stringify({ | |
| path: request.url, model: JSON.parse(normalized.body).model, | |
| region: normalized.region, summary_removed: normalized.summaryRemoved, | |
| upstream_status: upstream.status, | |
| })); | |
| response.writeHead(upstream.status, { | |
| 'content-type': upstream.headers.get('content-type') || 'application/json', | |
| 'cache-control': 'no-store', | |
| }); | |
| response.flushHeaders(); | |
| if (upstream.body) await pipeline(Readable.fromWeb(upstream.body), response); | |
| else response.end(); | |
| } catch { | |
| if (!response.headersSent) reply(response, 502, 'Upstream connection failed'); | |
| else response.destroy(); | |
| } finally { clearTimeout(timeout); } | |
| }); | |
| server.requestTimeout = 120000; | |
| server.headersTimeout = 15000; | |
| return server; | |
| } | |
| if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { | |
| const port = Number(process.env.BEDROCK_ROUTER_PORT || 14673); | |
| const server = createRouter(); | |
| server.on('error', error => { console.error(error.code || 'Router failed'); process.exitCode = 1; }); | |
| server.listen(port, '127.0.0.1', () => console.log(`Router: http://127.0.0.1:${port}/v1`)); | |
| for (const signal of ['SIGINT', 'SIGTERM']) process.on(signal, () => server.close()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import test from 'node:test'; | |
| import http from 'node:http'; | |
| import assert from 'node:assert/strict'; | |
| import { once } from 'node:events'; | |
| import { gzipSync } from 'node:zlib'; | |
| import { createRouter, normalize, routes } from './router.mjs'; | |
| test('summary removal preserves effort, history, and original numeric literals', () => { | |
| const body = '{"model":"openai.gpt-5.6-sol","reasoning":{"effort":"high","summary":"auto"},"input":[{"type":"reasoning","summary":[{"text":"history"}],"encrypted_content":"test"}],"tools":[{"enum":[9007199254740993,1e400,-0]}]}'; | |
| assert.equal(normalize(body).body, body.replace(',"summary":"auto"', '')); | |
| for (const summary of ['auto', 'none', 'concise', 'detailed', null]) { | |
| assert.deepEqual(JSON.parse(normalize(JSON.stringify({ model: 'openai.gpt-5.6-sol', reasoning: { summary } })).body), { model: 'openai.gpt-5.6-sol' }); | |
| } | |
| const unchanged = '{ "model": "openai.gpt-5.6-sol", "input": "test" }'; | |
| assert.equal(normalize(unchanged).body, unchanged); | |
| assert.throws(() => normalize('{"model":"unknown"}')); | |
| }); | |
| async function fixture(t, fetchImpl) { | |
| const calls = [], regions = []; | |
| const server = createRouter({ getToken: async region => { regions.push(region); return 'fake-test-token'; }, | |
| fetchImpl: async (...args) => { calls.push(args); return fetchImpl(...args); } }); | |
| server.listen(0, '127.0.0.1'); await once(server, 'listening'); | |
| t.after(() => { server.closeAllConnections(); server.close(); }); | |
| const base = `http://127.0.0.1:${server.address().port}`; | |
| return { base, calls, regions, post: (path, body, headers = {}) => fetch(base + path, { | |
| method: 'POST', headers: { 'content-type': 'application/json', ...headers }, | |
| body: typeof body === 'string' || Buffer.isBuffer(body) ? body : JSON.stringify(body), | |
| }) }; | |
| } | |
| test('all model/path combinations route, decompress, sanitize headers, and preserve upstream errors', async t => { | |
| const f = await fixture(t, async () => new Response('{"error":"denied"}', { status: 403 })); | |
| for (const [model, region] of Object.entries(routes)) { | |
| for (const path of ['/v1/responses', '/v1/responses/compact']) { | |
| const response = await f.post(path, gzipSync(JSON.stringify({ model, input: 'test', reasoning: { summary: 'auto', effort: 'low' } })), | |
| { 'content-encoding': 'gzip', authorization: 'Bearer client-only', cookie: 'test-only=value' }); | |
| assert.equal(response.status, 403); await response.text(); | |
| const [url, options] = f.calls.at(-1); | |
| assert.equal(url, `https://bedrock-mantle.${region}.api.aws/openai${path}`); | |
| assert.equal(f.regions.at(-1), region); | |
| assert.deepEqual(JSON.parse(options.body).reasoning, { effort: 'low' }); | |
| assert.equal(options.headers.authorization, 'Bearer fake-test-token'); | |
| assert.equal(options.headers.cookie, undefined); | |
| assert.equal(options.headers['content-encoding'], undefined); | |
| assert.equal(options.headers['content-length'], undefined); | |
| } | |
| } | |
| assert.equal(f.calls.length, 8); // No retries for permission failures. | |
| assert.equal((await f.post('/v1/responses', { model: 'unknown' })).status, 400); | |
| assert.equal((await f.post('/v1/responses', 'not JSON')).status, 400); | |
| assert.equal((await f.post('/v1/responses', '{}', { origin: 'https://example.com' })).status, 403); | |
| const badHostStatus = await new Promise((resolve, reject) => { | |
| const req = http.request(f.base + '/v1/responses', { method: 'POST', headers: { host: 'example.com' } }, res => { res.resume(); resolve(res.statusCode); }); | |
| req.on('error', reject); req.end('{}'); | |
| }); | |
| assert.equal(badHostStatus, 403); | |
| assert.equal((await f.post('/v1/unknown', '{}')).status, 404); | |
| assert.equal((await (await fetch(f.base + '/v1/models')).json()).data.length, 4); | |
| assert.equal(f.calls.length, 8); | |
| }); | |
| test('SSE first chunk arrives before upstream completion; client cancellation aborts upstream', async t => { | |
| let signal; | |
| const f = await fixture(t, async (_url, options) => { | |
| signal = options.signal; | |
| return new Response(new ReadableStream({ start(controller) { | |
| controller.enqueue(new TextEncoder().encode('data: {"type":"response.created"}\n\n')); | |
| } }), { headers: { 'content-type': 'text/event-stream' } }); | |
| }); | |
| const response = await f.post('/v1/responses', { model: 'openai.gpt-5.6-sol', stream: true }); | |
| const reader = response.body.getReader(); | |
| const first = await reader.read(); | |
| assert.match(new TextDecoder().decode(first.value), /response.created/); | |
| const aborted = once(signal, 'abort'); | |
| await reader.cancel(); | |
| await aborted; | |
| assert.equal(f.calls.length, 1); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment