@openclaw/amazon-bedrock-provider 2026.10.2 → 2026.10.5-beta.2
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/dist/bedrock-options.js +0 -1
- package/dist/discovery.js +57 -128
- package/dist/embedding-provider.js +3 -13
- package/dist/memory-embedding-adapter.js +0 -5
- package/dist/provider-policy-api.js +0 -1
- package/dist/register.sync.runtime.js +3 -27
- package/dist/stream.runtime.js +27 -28
- package/dist/thinking-policy.js +0 -5
- package/node_modules/@aws-sdk/client-bedrock/dist-cjs/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock/dist-es/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock/dist-types/Bedrock.d.ts +223 -217
- package/node_modules/@aws-sdk/client-bedrock/dist-types/ts3.4/Bedrock.d.ts +220 -216
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/core/package.json +6 -6
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +14 -11
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/schemas/schemas_0.js +13 -10
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentity.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/Signin.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSO.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDC.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STS.d.ts +33 -8
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +22 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleWithWebIdentityCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/index.d.ts +22 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/models_0.d.ts +40 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/CognitoIdentity.d.ts +14 -5
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/Signin.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/SSO.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/SSOOIDC.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/STS.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/models_0.d.ts +6 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/nested-clients/package.json +8 -8
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/signature-v4-multi-region/package.json +4 -4
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/CHANGELOG.md +19 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +22 -37
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +48 -4
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +49 -8
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +15 -7
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +22 -22
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +0 -15
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/client/index.js +1 -1
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +8 -1
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +40 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +49 -8
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +15 -7
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/submodules/client/index.d.ts +1 -1
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +17 -7
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/index.d.ts +1 -1
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +21 -7
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/signature-v4/CHANGELOG.md +6 -0
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/signature-v4/dist-cjs/index.js +4 -1
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js +4 -1
- package/node_modules/@aws-sdk/client-bedrock/node_modules/@smithy/signature-v4/package.json +3 -3
- package/node_modules/@aws-sdk/client-bedrock/package.json +9 -9
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/BedrockRuntime.d.ts +29 -23
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/BedrockRuntime.d.ts +26 -22
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/core/package.json +6 -6
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/eventstream-handler-node/package.json +4 -4
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/middleware-eventstream/package.json +4 -4
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/middleware-websocket/package.json +7 -7
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +14 -11
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/schemas/schemas_0.js +13 -10
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentity.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/Signin.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSO.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDC.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STS.d.ts +33 -8
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +22 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleWithWebIdentityCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/index.d.ts +22 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/models_0.d.ts +40 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/CognitoIdentity.d.ts +14 -5
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/Signin.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/SSO.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/SSOOIDC.d.ts +9 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/STS.d.ts +11 -5
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/models_0.d.ts +6 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/nested-clients/package.json +8 -8
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/signature-v4-multi-region/package.json +4 -4
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/CHANGELOG.md +19 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +22 -37
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +48 -4
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +49 -8
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +15 -7
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +22 -22
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +0 -15
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/client/index.js +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +8 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +40 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +49 -8
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +15 -7
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/submodules/client/index.d.ts +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +17 -7
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/index.d.ts +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +21 -7
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/signature-v4/CHANGELOG.md +6 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/signature-v4/dist-cjs/index.js +4 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js +4 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/node_modules/@smithy/signature-v4/package.json +3 -3
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +12 -12
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/core/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-env/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-http/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-login/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-process/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-sso/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/credential-provider-web-identity/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +14 -11
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/schemas/schemas_0.js +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/schemas/schemas_0.js +13 -10
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentity.d.ts +11 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/Signin.d.ts +11 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSO.d.ts +9 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDC.d.ts +9 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STS.d.ts +33 -8
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +22 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/commands/AssumeRoleWithWebIdentityCommand.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/index.d.ts +22 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/models/models_0.d.ts +40 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/CognitoIdentity.d.ts +14 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/Signin.d.ts +11 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/SSO.d.ts +9 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/SSOOIDC.d.ts +9 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/STS.d.ts +11 -5
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/models/models_0.d.ts +6 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/nested-clients/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/signature-v4-multi-region/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/token-providers/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/types/dist-types/feature-ids.d.ts +1 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/types/dist-types/ts3.4/feature-ids.d.ts +1 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/types/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/xml-builder/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/CHANGELOG.md +19 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +22 -37
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +48 -4
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +49 -8
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +15 -7
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +22 -22
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +0 -15
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/client/index.js +1 -1
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +8 -1
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +40 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +49 -8
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +15 -7
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/submodules/client/index.d.ts +1 -1
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +17 -7
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/index.d.ts +1 -1
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +21 -7
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/signature-v4/CHANGELOG.md +6 -0
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/signature-v4/dist-cjs/index.js +4 -1
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/signature-v4/dist-es/getCanonicalHeaders.js +4 -1
- package/node_modules/@aws-sdk/credential-provider-node/node_modules/@smithy/signature-v4/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/CHANGELOG.md +19 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +22 -37
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +48 -4
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +49 -8
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +15 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +22 -22
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +0 -15
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/client/index.js +1 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/command.js +8 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/exceptions.js +40 -3
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +49 -8
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +15 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/submodules/client/index.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/submodules/protocols/HttpProtocol.d.ts +17 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/parseCborBody.d.ts +3 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/index.d.ts +1 -1
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/client.d.ts +11 -3
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/ts3.4/submodules/client/smithy-client/exceptions.d.ts +1 -0
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/HttpProtocol.d.ts +21 -7
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/TypeRegistry.d.ts +2 -2
- package/node_modules/@smithy/node-http-handler/node_modules/@smithy/core/package.json +2 -2
- package/node_modules/@smithy/types/CHANGELOG.md +6 -0
- package/node_modules/@smithy/types/dist-types/metrics.d.ts +8 -7
- package/node_modules/@smithy/types/dist-types/middleware.d.ts +5 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/metrics.d.ts +8 -7
- package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +5 -0
- package/node_modules/@smithy/types/package.json +1 -1
- package/package.json +8 -8
package/dist/bedrock-options.js
CHANGED
|
@@ -19,7 +19,6 @@ function getModelMatchCandidates(modelId, modelName) {
|
|
|
19
19
|
return [lower, lower.replace(/[\s_.:]+/g, "-")];
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
/** Return whether a Bedrock model is known to support Anthropic prompt caching. */
|
|
23
22
|
function supportsBedrockClaudePromptCaching(modelId, modelName) {
|
|
24
23
|
const candidates = getModelMatchCandidates(modelId, modelName);
|
|
25
24
|
if (!candidates.some((s) => s.includes("claude"))) {
|
package/dist/discovery.js
CHANGED
|
@@ -103,72 +103,6 @@ const DEFAULT_COST = {
|
|
|
103
103
|
cacheWrite: 0
|
|
104
104
|
};
|
|
105
105
|
const discoveryCache = /* @__PURE__ */ new Map();
|
|
106
|
-
function includesTextModalities(modalities) {
|
|
107
|
-
return (modalities ?? []).some((entry) => normalizeOptionalLowercaseString(entry) === "text");
|
|
108
|
-
}
|
|
109
|
-
function mapInputModalities(summary) {
|
|
110
|
-
const inputs = (summary.inputModalities ?? []).map(normalizeOptionalLowercaseString).filter((modality) => modality === "text" || modality === "image");
|
|
111
|
-
return inputs.length > 0 ? [...new Set(inputs)] : ["text"];
|
|
112
|
-
}
|
|
113
|
-
function inferReasoningSupport(summary) {
|
|
114
|
-
if (supportsClaudeAdaptiveThinking({ id: summary.modelId })) return true;
|
|
115
|
-
const haystack = normalizeLowercaseStringOrEmpty(`${summary.modelId ?? ""} ${summary.modelName ?? ""}`);
|
|
116
|
-
return haystack.includes("reasoning") || haystack.includes("thinking");
|
|
117
|
-
}
|
|
118
|
-
function resolveDefaultContextWindow(config) {
|
|
119
|
-
const value = Math.floor(config?.defaultContextWindow ?? DEFAULT_CONTEXT_WINDOW);
|
|
120
|
-
return value > 0 ? value : DEFAULT_CONTEXT_WINDOW;
|
|
121
|
-
}
|
|
122
|
-
function resolveDefaultMaxTokens(config) {
|
|
123
|
-
const value = Math.floor(config?.defaultMaxTokens ?? DEFAULT_MAX_TOKENS);
|
|
124
|
-
return value > 0 ? value : DEFAULT_MAX_TOKENS;
|
|
125
|
-
}
|
|
126
|
-
function matchesProviderFilter(summary, filter) {
|
|
127
|
-
if (filter.length === 0) return true;
|
|
128
|
-
const providerName = summary.providerName ?? (typeof summary.modelId === "string" ? summary.modelId.split(".")[0] : void 0);
|
|
129
|
-
const normalized = normalizeOptionalLowercaseString(providerName);
|
|
130
|
-
if (!normalized) return false;
|
|
131
|
-
return filter.includes(normalized);
|
|
132
|
-
}
|
|
133
|
-
function shouldIncludeSummary(summary, filter) {
|
|
134
|
-
return Boolean(summary.modelId?.trim() && matchesProviderFilter(summary, filter) && summary.responseStreamingSupported === true && !isKnownClaudeMythosPreviewModelId(summary.modelId) && includesTextModalities(summary.outputModalities) && typeof summary.modelLifecycle?.status === "string" && summary.modelLifecycle.status.toUpperCase() === "ACTIVE");
|
|
135
|
-
}
|
|
136
|
-
function toModelDefinition(summary, defaults) {
|
|
137
|
-
const id = summary.modelId?.trim() ?? "";
|
|
138
|
-
const thinkingLevelMap = resolveBedrockNativeThinkingLevelMap(id);
|
|
139
|
-
return {
|
|
140
|
-
id,
|
|
141
|
-
name: summary.modelName?.trim() || id,
|
|
142
|
-
reasoning: inferReasoningSupport(summary),
|
|
143
|
-
input: mapInputModalities(summary),
|
|
144
|
-
cost: DEFAULT_COST,
|
|
145
|
-
contextWindow: resolveKnownContextWindow(id) ?? defaults.contextWindow,
|
|
146
|
-
maxTokens: isClaude5BedrockModel({ id }) ? 128e3 : defaults.maxTokens,
|
|
147
|
-
...thinkingLevelMap ? { thinkingLevelMap } : {}
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Resolve the base foundation model ID from an inference profile.
|
|
152
|
-
*
|
|
153
|
-
* System-defined profiles use a region prefix:
|
|
154
|
-
* "us.anthropic.claude-sonnet-4-6" → "anthropic.claude-sonnet-4-6"
|
|
155
|
-
*
|
|
156
|
-
* Application profiles carry the model ARN in their models[] array:
|
|
157
|
-
* models[0].modelArn = "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-6"
|
|
158
|
-
* → "anthropic.claude-sonnet-4-6"
|
|
159
|
-
*/
|
|
160
|
-
function resolveBaseModelId(profile) {
|
|
161
|
-
const firstArn = profile.models?.[0]?.modelArn;
|
|
162
|
-
if (firstArn) {
|
|
163
|
-
const arnMatch = /foundation-model\/(.+)$/.exec(firstArn);
|
|
164
|
-
if (arnMatch) return arnMatch[1];
|
|
165
|
-
}
|
|
166
|
-
if (profile.type === "SYSTEM_DEFINED") {
|
|
167
|
-
const id = profile.inferenceProfileId ?? "";
|
|
168
|
-
const prefixMatch = /^(?:us|eu|ap|apac|au|jp|global)\.(.+)$/i.exec(id);
|
|
169
|
-
if (prefixMatch) return prefixMatch[1];
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
106
|
/**
|
|
173
107
|
* Fetch raw inference profile summaries from the Bedrock control plane.
|
|
174
108
|
* All pages must succeed before discovery can cache a complete catalog.
|
|
@@ -187,56 +121,14 @@ async function fetchInferenceProfileSummaries(client, createListInferenceProfile
|
|
|
187
121
|
} while (nextToken);
|
|
188
122
|
return profiles;
|
|
189
123
|
}
|
|
190
|
-
/**
|
|
191
|
-
* Convert raw inference profile summaries into model definitions.
|
|
192
|
-
*
|
|
193
|
-
* Each profile inherits capabilities (modalities, reasoning, context window,
|
|
194
|
-
* cost) from its underlying foundation model. This ensures that
|
|
195
|
-
* "us.anthropic.claude-sonnet-4-6" has the same capabilities as
|
|
196
|
-
* "anthropic.claude-sonnet-4-6" — including image input, reasoning support,
|
|
197
|
-
* and token limits.
|
|
198
|
-
*
|
|
199
|
-
* When the foundation model isn't found in the map (e.g. the model is only
|
|
200
|
-
* available via inference profiles in this region), safe defaults are used.
|
|
201
|
-
*/
|
|
202
|
-
function resolveInferenceProfiles(profiles, defaults, providerFilter, foundationModels) {
|
|
203
|
-
const discovered = [];
|
|
204
|
-
for (const profile of profiles) {
|
|
205
|
-
if (!profile.inferenceProfileId?.trim()) continue;
|
|
206
|
-
if (profile.status !== "ACTIVE") continue;
|
|
207
|
-
if (providerFilter.length > 0) {
|
|
208
|
-
if (!(profile.models ?? []).some((m) => {
|
|
209
|
-
const provider = m.modelArn?.split("/")?.[1]?.split(".")?.[0];
|
|
210
|
-
return provider ? providerFilter.includes(normalizeOptionalLowercaseString(provider) ?? "") : false;
|
|
211
|
-
})) continue;
|
|
212
|
-
}
|
|
213
|
-
const baseModelId = resolveBaseModelId(profile);
|
|
214
|
-
if (isKnownClaudeMythosPreviewModelId(baseModelId ?? profile.inferenceProfileId)) continue;
|
|
215
|
-
const baseModel = baseModelId ? foundationModels.get(normalizeLowercaseStringOrEmpty(baseModelId)) : void 0;
|
|
216
|
-
const knownThinkingLevelMap = resolveBedrockNativeThinkingLevelMap(baseModelId ?? profile.inferenceProfileId);
|
|
217
|
-
const contractModelId = baseModelId ?? profile.inferenceProfileId;
|
|
218
|
-
const claude5 = isClaude5BedrockModel({ id: contractModelId });
|
|
219
|
-
const canonicalClaudeId = resolveClaudeModelIdentity({ id: baseModelId });
|
|
220
|
-
discovered.push({
|
|
221
|
-
id: profile.inferenceProfileId,
|
|
222
|
-
name: profile.inferenceProfileName?.trim() || profile.inferenceProfileId,
|
|
223
|
-
reasoning: baseModel?.reasoning ?? supportsClaudeAdaptiveThinking({ id: baseModelId ?? profile.inferenceProfileId }),
|
|
224
|
-
input: baseModel?.input ?? (claude5 ? ["text", "image"] : ["text"]),
|
|
225
|
-
cost: baseModel?.cost ?? DEFAULT_COST,
|
|
226
|
-
contextWindow: baseModel?.contextWindow ?? resolveKnownContextWindow(contractModelId) ?? defaults.contextWindow,
|
|
227
|
-
maxTokens: baseModel?.maxTokens ?? (claude5 ? 128e3 : defaults.maxTokens),
|
|
228
|
-
...baseModel?.thinkingLevelMap || knownThinkingLevelMap ? { thinkingLevelMap: baseModel?.thinkingLevelMap ?? knownThinkingLevelMap } : {},
|
|
229
|
-
...canonicalClaudeId.startsWith("claude-") ? { params: { canonicalModelId: canonicalClaudeId } } : {}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
return discovered;
|
|
233
|
-
}
|
|
234
124
|
/** Public discovery is advisory by default; catalog owners opt into strict acquisition. */
|
|
235
125
|
async function discoverBedrockModels(params) {
|
|
236
126
|
const refreshIntervalSeconds = Math.max(0, Math.floor(params.config?.refreshInterval ?? DEFAULT_REFRESH_INTERVAL_SECONDS));
|
|
237
127
|
const providerFilter = normalizeSortedUniqueTrimmedStringList(params.config?.providerFilter?.map(normalizeOptionalLowercaseString));
|
|
238
|
-
const
|
|
239
|
-
const
|
|
128
|
+
const contextWindow = Math.floor(params.config?.defaultContextWindow ?? DEFAULT_CONTEXT_WINDOW);
|
|
129
|
+
const maxTokens = Math.floor(params.config?.defaultMaxTokens ?? DEFAULT_MAX_TOKENS);
|
|
130
|
+
const defaultContextWindow = contextWindow > 0 ? contextWindow : DEFAULT_CONTEXT_WINDOW;
|
|
131
|
+
const defaultMaxTokens = maxTokens > 0 ? maxTokens : DEFAULT_MAX_TOKENS;
|
|
240
132
|
const cacheKey = JSON.stringify({
|
|
241
133
|
region: params.region,
|
|
242
134
|
discoveryMode: params.discoveryMode,
|
|
@@ -245,14 +137,14 @@ async function discoverBedrockModels(params) {
|
|
|
245
137
|
defaultContextWindow,
|
|
246
138
|
defaultMaxTokens
|
|
247
139
|
});
|
|
248
|
-
const now =
|
|
140
|
+
const now = Date.now();
|
|
249
141
|
if (refreshIntervalSeconds > 0) {
|
|
250
142
|
const cached = discoveryCache.get(cacheKey);
|
|
251
143
|
if (cached && isFutureDateTimestampMs(cached.expiresAt, { nowMs: now })) return cached.result;
|
|
252
144
|
discoveryCache.delete(cacheKey);
|
|
253
145
|
}
|
|
254
146
|
const sdk = await loadBedrockControlPlaneSdk();
|
|
255
|
-
const client =
|
|
147
|
+
const client = sdk.createClient(params.region);
|
|
256
148
|
const discoveryPromise = (async () => {
|
|
257
149
|
try {
|
|
258
150
|
const foundationCommand = sdk.createListFoundationModelsCommand();
|
|
@@ -268,24 +160,62 @@ async function discoverBedrockModels(params) {
|
|
|
268
160
|
const seenIds = /* @__PURE__ */ new Set();
|
|
269
161
|
const foundationModels = /* @__PURE__ */ new Map();
|
|
270
162
|
for (const summary of foundationResponse.modelSummaries ?? []) {
|
|
271
|
-
if (!
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
163
|
+
if (!summary.modelId?.trim()) continue;
|
|
164
|
+
if (providerFilter.length > 0) {
|
|
165
|
+
const providerName = summary.providerName ?? (typeof summary.modelId === "string" ? summary.modelId.split(".")[0] : void 0);
|
|
166
|
+
const provider = normalizeOptionalLowercaseString(providerName);
|
|
167
|
+
if (!provider || !providerFilter.includes(provider)) continue;
|
|
168
|
+
}
|
|
169
|
+
if (summary.responseStreamingSupported !== true || isKnownClaudeMythosPreviewModelId(summary.modelId) || !(summary.outputModalities ?? []).some((entry) => normalizeOptionalLowercaseString(entry) === "text") || typeof summary.modelLifecycle?.status !== "string" || summary.modelLifecycle.status.toUpperCase() !== "ACTIVE") continue;
|
|
170
|
+
const input = (summary.inputModalities ?? []).map(normalizeOptionalLowercaseString).filter((modality) => modality === "text" || modality === "image");
|
|
171
|
+
const reasoningHint = normalizeLowercaseStringOrEmpty(`${summary.modelId ?? ""} ${summary.modelName ?? ""}`);
|
|
172
|
+
const id = summary.modelId?.trim() ?? "";
|
|
173
|
+
const thinkingLevelMap = resolveBedrockNativeThinkingLevelMap(id);
|
|
174
|
+
const def = {
|
|
175
|
+
id,
|
|
176
|
+
name: summary.modelName?.trim() || id,
|
|
177
|
+
reasoning: supportsClaudeAdaptiveThinking({ id: summary.modelId }) || reasoningHint.includes("reasoning") || reasoningHint.includes("thinking"),
|
|
178
|
+
input: input.length > 0 ? [...new Set(input)] : ["text"],
|
|
179
|
+
cost: DEFAULT_COST,
|
|
180
|
+
contextWindow: resolveKnownContextWindow(id) ?? defaultContextWindow,
|
|
181
|
+
maxTokens: isClaude5BedrockModel({ id }) ? 128e3 : defaultMaxTokens,
|
|
182
|
+
...thinkingLevelMap ? { thinkingLevelMap } : {}
|
|
183
|
+
};
|
|
276
184
|
discovered.push(def);
|
|
277
185
|
const normalizedId = normalizeLowercaseStringOrEmpty(def.id);
|
|
278
186
|
seenIds.add(normalizedId);
|
|
279
187
|
foundationModels.set(normalizedId, def);
|
|
280
188
|
}
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
189
|
+
for (const profile of profileSummaries) {
|
|
190
|
+
if (!profile.inferenceProfileId?.trim()) continue;
|
|
191
|
+
if (profile.status !== "ACTIVE") continue;
|
|
192
|
+
if (providerFilter.length > 0) {
|
|
193
|
+
if (!(profile.models ?? []).some((m) => {
|
|
194
|
+
const provider = m.modelArn?.split("/")?.[1]?.split(".")?.[0];
|
|
195
|
+
return provider ? providerFilter.includes(normalizeOptionalLowercaseString(provider) ?? "") : false;
|
|
196
|
+
})) continue;
|
|
197
|
+
}
|
|
198
|
+
const baseModelId = /foundation-model\/(.+)$/.exec(profile.models?.[0]?.modelArn ?? "")?.[1] ?? (profile.type === "SYSTEM_DEFINED" ? /^(?:us|eu|ap|apac|au|jp|global)\.(.+)$/i.exec(profile.inferenceProfileId ?? "")?.[1] : void 0);
|
|
199
|
+
if (isKnownClaudeMythosPreviewModelId(baseModelId ?? profile.inferenceProfileId)) continue;
|
|
200
|
+
const baseModel = baseModelId ? foundationModels.get(normalizeLowercaseStringOrEmpty(baseModelId)) : void 0;
|
|
201
|
+
const knownThinkingLevelMap = resolveBedrockNativeThinkingLevelMap(baseModelId ?? profile.inferenceProfileId);
|
|
202
|
+
const contractModelId = baseModelId ?? profile.inferenceProfileId;
|
|
203
|
+
const claude5 = isClaude5BedrockModel({ id: contractModelId });
|
|
204
|
+
const canonicalClaudeId = resolveClaudeModelIdentity({ id: baseModelId });
|
|
205
|
+
const definition = {
|
|
206
|
+
id: profile.inferenceProfileId,
|
|
207
|
+
name: profile.inferenceProfileName?.trim() || profile.inferenceProfileId,
|
|
208
|
+
reasoning: baseModel?.reasoning ?? supportsClaudeAdaptiveThinking({ id: baseModelId ?? profile.inferenceProfileId }),
|
|
209
|
+
input: baseModel?.input ?? (claude5 ? ["text", "image"] : ["text"]),
|
|
210
|
+
cost: baseModel?.cost ?? DEFAULT_COST,
|
|
211
|
+
contextWindow: baseModel?.contextWindow ?? resolveKnownContextWindow(contractModelId) ?? defaultContextWindow,
|
|
212
|
+
maxTokens: baseModel?.maxTokens ?? (claude5 ? 128e3 : defaultMaxTokens),
|
|
213
|
+
...baseModel?.thinkingLevelMap || knownThinkingLevelMap ? { thinkingLevelMap: baseModel?.thinkingLevelMap ?? knownThinkingLevelMap } : {},
|
|
214
|
+
...canonicalClaudeId.startsWith("claude-") ? { params: { canonicalModelId: canonicalClaudeId } } : {}
|
|
215
|
+
};
|
|
216
|
+
const normalizedId = normalizeLowercaseStringOrEmpty(definition.id);
|
|
287
217
|
if (!seenIds.has(normalizedId)) {
|
|
288
|
-
discovered.push(
|
|
218
|
+
discovered.push(definition);
|
|
289
219
|
seenIds.add(normalizedId);
|
|
290
220
|
}
|
|
291
221
|
}
|
|
@@ -328,8 +258,7 @@ async function resolveImplicitBedrockProvider(params) {
|
|
|
328
258
|
const models = await discoverBedrockModels({
|
|
329
259
|
region,
|
|
330
260
|
discoveryMode: params.discoveryMode,
|
|
331
|
-
config: discoveryConfig
|
|
332
|
-
clientFactory: params.clientFactory
|
|
261
|
+
config: discoveryConfig
|
|
333
262
|
});
|
|
334
263
|
if (models.length === 0 && params.discoveryMode !== "strict") return null;
|
|
335
264
|
return {
|
|
@@ -2,7 +2,6 @@ import { bedrockCredentialDefaultProvider } from "./aws-credential-refresh.js";
|
|
|
2
2
|
import { asOptionalRecord, normalizeLowercaseStringOrEmpty, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { debugEmbeddingsLog, normalizeEmbeddingModelWithPrefixes, sanitizeAndNormalizeEmbedding } from "openclaw/plugin-sdk/memory-core-host-engine-embeddings";
|
|
4
4
|
//#region extensions/amazon-bedrock/embedding-provider.ts
|
|
5
|
-
/** Default Bedrock embedding model used when no explicit model is configured. */
|
|
6
5
|
const DEFAULT_BEDROCK_EMBEDDING_MODEL = "amazon.titan-embed-text-v2:0";
|
|
7
6
|
const MODELS = {
|
|
8
7
|
"amazon.titan-embed-text-v2:0": {
|
|
@@ -75,7 +74,6 @@ const MODELS = {
|
|
|
75
74
|
family: "twelvelabs"
|
|
76
75
|
}
|
|
77
76
|
};
|
|
78
|
-
/** Strip AWS inference profile prefix (us., eu., ap., apac., au., jp., global.) from model ID. */
|
|
79
77
|
function stripInferenceProfilePrefix(modelId) {
|
|
80
78
|
return modelId.replace(/^(?:us|eu|ap|apac|au|jp|global)\./, "");
|
|
81
79
|
}
|
|
@@ -89,7 +87,6 @@ function resolveSpec(modelId) {
|
|
|
89
87
|
if (spec) return spec;
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
|
-
/** Infer family from model ID prefix when not in catalog. */
|
|
93
90
|
function inferFamily(modelId) {
|
|
94
91
|
const id = normalizeLowercaseStringOrEmpty(stripInferenceProfilePrefix(modelId));
|
|
95
92
|
if (id.startsWith("amazon.titan-embed-text-v2")) return "titan-v2";
|
|
@@ -100,16 +97,7 @@ function inferFamily(modelId) {
|
|
|
100
97
|
if (id.startsWith("twelvelabs.")) return "twelvelabs";
|
|
101
98
|
return "titan-v1";
|
|
102
99
|
}
|
|
103
|
-
let sdkPromise = null;
|
|
104
100
|
let credentialProviderPromise = null;
|
|
105
|
-
async function loadSdk() {
|
|
106
|
-
try {
|
|
107
|
-
return await (sdkPromise ??= import("@aws-sdk/client-bedrock-runtime"));
|
|
108
|
-
} catch {
|
|
109
|
-
sdkPromise = null;
|
|
110
|
-
throw new Error("No API key found for provider bedrock: @aws-sdk/client-bedrock-runtime is not installed. Install it with: npm install @aws-sdk/client-bedrock-runtime");
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
101
|
function loadDefaultCredentialProvider() {
|
|
114
102
|
return credentialProviderPromise ??= import("@aws-sdk/credential-provider-node").then(({ defaultProvider }) => defaultProvider).catch(() => null);
|
|
115
103
|
}
|
|
@@ -202,7 +190,9 @@ function parseCohereBatch(family, raw) {
|
|
|
202
190
|
return asNumberArrayBatch(embeddings);
|
|
203
191
|
}
|
|
204
192
|
async function createBedrockEmbeddingProvider(options) {
|
|
205
|
-
const { BedrockRuntimeClient, InvokeModelCommand } = await
|
|
193
|
+
const { BedrockRuntimeClient, InvokeModelCommand } = await import("@aws-sdk/client-bedrock-runtime").catch(() => {
|
|
194
|
+
throw new Error("No API key found for provider bedrock: @aws-sdk/client-bedrock-runtime is not installed. Install it with: npm install @aws-sdk/client-bedrock-runtime");
|
|
195
|
+
});
|
|
206
196
|
const client = resolveBedrockEmbeddingClient(options, BedrockRuntimeClient);
|
|
207
197
|
const spec = resolveSpec(client.model);
|
|
208
198
|
const family = spec?.family ?? inferFamily(client.model);
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_BEDROCK_EMBEDDING_MODEL, createBedrockEmbeddingProvider, hasAwsCredentials } from "./embedding-provider.js";
|
|
2
2
|
import { isMissingEmbeddingApiKeyError } from "openclaw/plugin-sdk/embedding-provider-adapter";
|
|
3
3
|
//#region extensions/amazon-bedrock/memory-embedding-adapter.ts
|
|
4
|
-
/**
|
|
5
|
-
* Memory embedding adapter for Amazon Bedrock. It exposes Bedrock embeddings to
|
|
6
|
-
* the memory-core engine and verifies AWS credentials before auto-selection.
|
|
7
|
-
*/
|
|
8
|
-
/** Memory-core adapter descriptor for Bedrock embeddings. */
|
|
9
4
|
const bedrockMemoryEmbeddingProviderAdapter = {
|
|
10
5
|
id: "bedrock",
|
|
11
6
|
defaultModel: DEFAULT_BEDROCK_EMBEDDING_MODEL,
|
|
@@ -5,7 +5,6 @@ import { normalizeProviderId } from "openclaw/plugin-sdk/model-ref-parse";
|
|
|
5
5
|
* Provider-policy API for Amazon Bedrock. Core asks this plugin for thinking
|
|
6
6
|
* profiles without importing provider registration or streaming code.
|
|
7
7
|
*/
|
|
8
|
-
/** Resolve the Bedrock thinking profile for a provider/model pair. */
|
|
9
8
|
function resolveThinkingProfile(params) {
|
|
10
9
|
if (normalizeProviderId(params.provider) !== "amazon-bedrock") return null;
|
|
11
10
|
return resolveBedrockClaudeThinkingProfile(params.modelId, params.params);
|
|
@@ -93,14 +93,6 @@ const BEDROCK_APP_INFERENCE_PROFILE_RE = /^arn:aws(-cn|-us-gov)?:bedrock:.*:appl
|
|
|
93
93
|
function isBedrockAppInferenceProfile(modelId) {
|
|
94
94
|
return BEDROCK_APP_INFERENCE_PROFILE_RE.test(modelId);
|
|
95
95
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Extract the region from a Bedrock ARN.
|
|
98
|
-
* e.g. "arn:aws:bedrock:us-east-1:123:application-inference-profile/abc" → "us-east-1"
|
|
99
|
-
*/
|
|
100
|
-
function extractRegionFromArn(arn) {
|
|
101
|
-
const parts = arn.split(":");
|
|
102
|
-
return parts.length >= 4 && parts[3] ? parts[3] : void 0;
|
|
103
|
-
}
|
|
104
96
|
const appProfileTraitsCache = /* @__PURE__ */ new Map();
|
|
105
97
|
async function resolveAppProfileTraits(modelId, fallbackRegion, signal) {
|
|
106
98
|
const cached = appProfileTraitsCache.get(modelId);
|
|
@@ -108,7 +100,7 @@ async function resolveAppProfileTraits(modelId, fallbackRegion, signal) {
|
|
|
108
100
|
let client;
|
|
109
101
|
try {
|
|
110
102
|
signal?.throwIfAborted();
|
|
111
|
-
const region =
|
|
103
|
+
const region = modelId.split(":")[3] || fallbackRegion;
|
|
112
104
|
const sdk = await loadBedrockControlPlaneSdk();
|
|
113
105
|
signal?.throwIfAborted();
|
|
114
106
|
const controlPlaneClient = sdk.createClient(region);
|
|
@@ -168,7 +160,6 @@ function patchMaxThinkingEffort(payload) {
|
|
|
168
160
|
fields.output_config = outputConfig;
|
|
169
161
|
payload.additionalModelRequestFields = fields;
|
|
170
162
|
}
|
|
171
|
-
/** Register Amazon Bedrock provider, discovery catalog, stream wrappers, and embeddings. */
|
|
172
163
|
function registerAmazonBedrockPlugin(api) {
|
|
173
164
|
const providerId = "amazon-bedrock";
|
|
174
165
|
const bedrockRegionRe = /bedrock-runtime\.([a-z0-9-]+)\.amazonaws\./;
|
|
@@ -184,15 +175,6 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
184
175
|
return resolvePluginConfigObject(config, providerId) ?? (config ? void 0 : startupPluginConfig);
|
|
185
176
|
}
|
|
186
177
|
api.registerEmbeddingProvider(bedrockMemoryEmbeddingProviderAdapter);
|
|
187
|
-
const baseWrapStreamFn = ({ modelId, model, streamFn }) => {
|
|
188
|
-
const modelRef = {
|
|
189
|
-
id: modelId,
|
|
190
|
-
params: model?.params
|
|
191
|
-
};
|
|
192
|
-
if (resolveBedrockPromptCachePolicy(modelRef) === "nova" || isAnthropicBedrockModel(modelId) || resolveClaudeModelIdentity(modelRef).startsWith("claude-")) return streamFn;
|
|
193
|
-
if (isBedrockAppInferenceProfile(modelId)) return streamFn;
|
|
194
|
-
return createBedrockNoCacheWrapper(streamFn);
|
|
195
|
-
};
|
|
196
178
|
function omitUnsupportedClaudeTemperature(modelRef, options) {
|
|
197
179
|
const canonicalModelId = resolveClaudeModelIdentity(modelRef);
|
|
198
180
|
if (!(isOpus47OrNewerBedrockModelRef(modelRef.id) || isOpus47OrNewerBedrockModelRef(canonicalModelId) || resolveClaudeFable5ModelIdentity(modelRef) !== void 0) || !("temperature" in options)) return options;
|
|
@@ -205,12 +187,10 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
205
187
|
if (!inferenceConfig || typeof inferenceConfig !== "object") return;
|
|
206
188
|
delete inferenceConfig.temperature;
|
|
207
189
|
}
|
|
208
|
-
/** Extract the AWS region from a bedrock-runtime baseUrl. */
|
|
209
190
|
function extractRegionFromBaseUrl(baseUrl) {
|
|
210
191
|
if (!baseUrl) return;
|
|
211
192
|
return bedrockRegionRe.exec(baseUrl)?.[1];
|
|
212
193
|
}
|
|
213
|
-
/** Resolve the AWS region for Bedrock API calls from provider-specific baseUrl. */
|
|
214
194
|
function resolveBedrockRegion(config, selectedProvider) {
|
|
215
195
|
const providers = config?.models?.providers ?? {};
|
|
216
196
|
const exact = providers[selectedProvider]?.baseUrl;
|
|
@@ -261,11 +241,8 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
261
241
|
const canonicalModelId = resolveClaudeModelIdentity(modelRef);
|
|
262
242
|
const opus47OrNewer = isOpus47OrNewerBedrockModelRef(modelId) || isOpus47OrNewerBedrockModelRef(canonicalModelId);
|
|
263
243
|
const supportsNativeMax = supportsBedrockNativeMaxEffort(modelId, model?.params);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
model,
|
|
267
|
-
streamFn
|
|
268
|
-
});
|
|
244
|
+
const heuristicMatch = isAnthropicBedrockModel(modelId);
|
|
245
|
+
let wrapped = resolveBedrockPromptCachePolicy(modelRef) === "nova" || heuristicMatch || canonicalModelId.startsWith("claude-") || isBedrockAppInferenceProfile(modelId) ? streamFn : createBedrockNoCacheWrapper(streamFn);
|
|
269
246
|
if (wrapped && currentGuardrail?.guardrailIdentifier && currentGuardrail.guardrailVersion) wrapped = createGuardrailStreamWrapper(wrapped, currentGuardrail);
|
|
270
247
|
const serviceTier = resolveBedrockServiceTier(extraParams, (message) => api.logger.warn(message));
|
|
271
248
|
if (serviceTier && wrapped) {
|
|
@@ -279,7 +256,6 @@ function registerAmazonBedrockPlugin(api) {
|
|
|
279
256
|
const shouldOmitTemperature = opus47OrNewer || fable5 || isLatestAdaptiveBedrockModelRef(modelId, model?.params);
|
|
280
257
|
const shouldPatchMaxThinking = supportsNativeMax && thinkingLevel === "max";
|
|
281
258
|
const shouldPatchPayload = shouldOmitTemperature || shouldPatchMaxThinking;
|
|
282
|
-
const heuristicMatch = isAnthropicBedrockModel(modelId);
|
|
283
259
|
if (!region && !mayNeedCacheInjection && !shouldOmitTemperature && !shouldPatchMaxThinking) return wrapped;
|
|
284
260
|
const underlying = wrapped ?? streamFn;
|
|
285
261
|
if (!underlying) return wrapped;
|
package/dist/stream.runtime.js
CHANGED
|
@@ -4,7 +4,7 @@ import { isClaude5BedrockModel, resolveBedrockClaudeThinkingProfile, supportsBed
|
|
|
4
4
|
import { AssistantMessageEventStream, adjustMaxTokensForThinking, buildBaseOptions, calculateCost, clampReasoning, createHttpProxyAgentsForTarget, createToolArgumentPreviewSchedule, hasRuntimeContextMarker, parseStreamingJson, sanitizeSurrogates, transformMessages } from "openclaw/plugin-sdk/llm";
|
|
5
5
|
import { bindsClaudeThinkingPrefix, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaudeAdaptiveThinking, supportsClaudeNativeXhighEffort } from "openclaw/plugin-sdk/provider-model-shared";
|
|
6
6
|
import { applyAnthropicRefusal, createDeferredEventBuffer, notifyLlmRequestActivity } from "openclaw/plugin-sdk/provider-stream-shared";
|
|
7
|
-
import { buildAssistantMessage, coerceTransportToolCallArguments, createEmptyTransportUsage, describeToolResultMediaPlaceholder, failTransportStream, finalizeTerminalToolCallArguments, notifyProviderHttpMetadata, splitSystemPromptCacheBoundary, stripSystemPromptCacheBoundary } from "openclaw/plugin-sdk/provider-transport-runtime";
|
|
7
|
+
import { buildAssistantMessage, coerceTransportToolCallArguments, createEmptyTransportUsage, describeToolResultMediaPlaceholder, failTransportStream, finalizeTerminalToolCallArguments, notifyProviderHttpMetadata, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, stripSystemPromptCacheBoundary } from "openclaw/plugin-sdk/provider-transport-runtime";
|
|
8
8
|
import { asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { BedrockRuntimeClient, BedrockRuntimeServiceException, CacheTTL, ConversationRole, ConverseStreamCommand, ImageFormat, StopReason, ToolResultStatus } from "@aws-sdk/client-bedrock-runtime";
|
|
10
10
|
import { NodeHttpHandler } from "@smithy/node-http-handler";
|
|
@@ -42,12 +42,17 @@ const streamBedrock = (model, context, options = {}) => {
|
|
|
42
42
|
stopReason: "stop"
|
|
43
43
|
});
|
|
44
44
|
const blocks = output.content;
|
|
45
|
-
const pendingToolCallEnds = [];
|
|
46
|
-
const toolArgumentPreviewSchedules = /* @__PURE__ */ new WeakMap();
|
|
47
|
-
const redactedReasoningChunks = /* @__PURE__ */ new Map();
|
|
48
45
|
const fable5 = resolveClaudeFable5ModelIdentity(model) !== void 0;
|
|
49
46
|
const refusalBuffer = isClaude5BedrockModel(model) ? createDeferredEventBuffer(stream) : void 0;
|
|
50
47
|
const eventSink = refusalBuffer ?? stream;
|
|
48
|
+
const blockState = {
|
|
49
|
+
blocks,
|
|
50
|
+
output,
|
|
51
|
+
stream: eventSink,
|
|
52
|
+
toolArgumentPreviewSchedules: /* @__PURE__ */ new WeakMap(),
|
|
53
|
+
redactedReasoningChunks: /* @__PURE__ */ new Map(),
|
|
54
|
+
pendingToolCallEnds: []
|
|
55
|
+
};
|
|
51
56
|
const config = {
|
|
52
57
|
profile: options.profile,
|
|
53
58
|
...resolveBedrockRuntimeAuth(options.bearerToken)
|
|
@@ -118,9 +123,9 @@ const streamBedrock = (model, context, options = {}) => {
|
|
|
118
123
|
type: "start",
|
|
119
124
|
partial: output
|
|
120
125
|
});
|
|
121
|
-
} else if (item.contentBlockStart) handleContentBlockStart(item.contentBlockStart,
|
|
122
|
-
else if (item.contentBlockDelta) handleContentBlockDelta(item.contentBlockDelta,
|
|
123
|
-
else if (item.contentBlockStop) handleContentBlockStop(item.contentBlockStop,
|
|
126
|
+
} else if (item.contentBlockStart) handleContentBlockStart(item.contentBlockStart, blockState);
|
|
127
|
+
else if (item.contentBlockDelta) handleContentBlockDelta(item.contentBlockDelta, blockState);
|
|
128
|
+
else if (item.contentBlockStop) handleContentBlockStop(item.contentBlockStop, blockState);
|
|
124
129
|
else if (item.messageStop) {
|
|
125
130
|
sawMessageStop = true;
|
|
126
131
|
if (item.messageStop.stopReason === "refusal") applyAnthropicRefusal(output, readBedrockStopDetails(item.messageStop.additionalModelResponseFields), model.provider);
|
|
@@ -139,8 +144,8 @@ const streamBedrock = (model, context, options = {}) => {
|
|
|
139
144
|
if (!sawMessageStop) throw new Error("Bedrock stream ended before messageStop");
|
|
140
145
|
if (options.signal?.aborted) throw new Error("Request was aborted");
|
|
141
146
|
if (output.stopReason === "error" || output.stopReason === "aborted") throw new Error(output.errorMessage ?? "An unknown error occurred");
|
|
142
|
-
for (const block of blocks) if (block.index !== void 0 && block.type !== "toolCall") handleContentBlockStop({ contentBlockIndex: block.index },
|
|
143
|
-
flushPendingBedrockToolCalls(
|
|
147
|
+
for (const block of blocks) if (block.index !== void 0 && block.type !== "toolCall") handleContentBlockStop({ contentBlockIndex: block.index }, blockState);
|
|
148
|
+
flushPendingBedrockToolCalls(blockState);
|
|
144
149
|
refusalBuffer?.flush();
|
|
145
150
|
stream.push({
|
|
146
151
|
type: "done",
|
|
@@ -225,7 +230,7 @@ function resolveSimpleBedrockOptions(model, options) {
|
|
|
225
230
|
}
|
|
226
231
|
return base;
|
|
227
232
|
}
|
|
228
|
-
function handleContentBlockStart(event, blocks, output, stream, toolArgumentPreviewSchedules) {
|
|
233
|
+
function handleContentBlockStart(event, { blocks, output, stream, toolArgumentPreviewSchedules }) {
|
|
229
234
|
const index = event.contentBlockIndex;
|
|
230
235
|
const start = event.start;
|
|
231
236
|
if (start?.toolUse) {
|
|
@@ -247,7 +252,7 @@ function handleContentBlockStart(event, blocks, output, stream, toolArgumentPrev
|
|
|
247
252
|
});
|
|
248
253
|
}
|
|
249
254
|
}
|
|
250
|
-
function handleContentBlockDelta(event, blocks, output, stream, redactedReasoningChunks, toolArgumentPreviewSchedules) {
|
|
255
|
+
function handleContentBlockDelta(event, { blocks, output, stream, redactedReasoningChunks, toolArgumentPreviewSchedules }) {
|
|
251
256
|
const contentBlockIndex = event.contentBlockIndex;
|
|
252
257
|
const delta = event.delta;
|
|
253
258
|
let index = blocks.findIndex((b) => b.index === contentBlockIndex);
|
|
@@ -341,7 +346,7 @@ function handleMetadata(event, model, output) {
|
|
|
341
346
|
calculateCost(model, output.usage);
|
|
342
347
|
}
|
|
343
348
|
}
|
|
344
|
-
function handleContentBlockStop(event, blocks, output, stream, redactedReasoningChunks, pendingToolCallEnds) {
|
|
349
|
+
function handleContentBlockStop(event, { blocks, output, stream, redactedReasoningChunks, pendingToolCallEnds }) {
|
|
345
350
|
const index = blocks.findIndex((b) => b.index === event.contentBlockIndex);
|
|
346
351
|
const block = blocks[index];
|
|
347
352
|
if (!block) return;
|
|
@@ -381,7 +386,7 @@ function handleContentBlockStop(event, blocks, output, stream, redactedReasoning
|
|
|
381
386
|
});
|
|
382
387
|
}
|
|
383
388
|
}
|
|
384
|
-
function flushPendingBedrockToolCalls(pending, blocks, output, stream) {
|
|
389
|
+
function flushPendingBedrockToolCalls({ pendingToolCallEnds: pending, blocks, output, stream }) {
|
|
385
390
|
if (blocks.some((block) => block.type === "toolCall" && block.index !== void 0)) throw new Error("Provider completed stream with an incomplete tool call");
|
|
386
391
|
finalizeTerminalToolCallArguments(pending.map(({ block }) => block), (block) => block.partialJson && block.partialJson.length > 0 ? block.partialJson : block.arguments);
|
|
387
392
|
for (const toolCall of pending) {
|
|
@@ -480,15 +485,19 @@ function buildSystemPrompt(systemPrompt, cacheRetention, cachePoint) {
|
|
|
480
485
|
function normalizeToolCallId(id) {
|
|
481
486
|
return id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64);
|
|
482
487
|
}
|
|
483
|
-
function
|
|
488
|
+
function convertTextImageContent(blocks, skipEmptyImages) {
|
|
484
489
|
const content = [];
|
|
485
|
-
for (const block of
|
|
490
|
+
for (const block of blocks) {
|
|
486
491
|
if (block.type === "text") {
|
|
487
492
|
content.push({ text: sanitizeSurrogates(block.text) });
|
|
488
493
|
continue;
|
|
489
494
|
}
|
|
490
|
-
if (block.type === "image" && describeToolResultMediaPlaceholder([block])) content.push({ image: createImageBlock(block.mimeType, block.data) });
|
|
495
|
+
if (block.type === "image" && (!skipEmptyImages || describeToolResultMediaPlaceholder([block]))) content.push({ image: createImageBlock(block.mimeType, block.data) });
|
|
491
496
|
}
|
|
497
|
+
return content;
|
|
498
|
+
}
|
|
499
|
+
function createBedrockToolResult(message) {
|
|
500
|
+
const content = convertTextImageContent(message.content, true);
|
|
492
501
|
return { toolResult: {
|
|
493
502
|
toolUseId: message.toolCallId,
|
|
494
503
|
content: content.length > 0 ? content : [{ text: describeToolResultMediaPlaceholder(message.content) ?? "(no output)" }],
|
|
@@ -503,17 +512,7 @@ function convertMessages(context, model, cachePoint) {
|
|
|
503
512
|
const m = expectDefined(transformedMessages[i], "message conversion index is in bounds");
|
|
504
513
|
switch (m.role) {
|
|
505
514
|
case "user": {
|
|
506
|
-
const content = [];
|
|
507
|
-
if (typeof m.content === "string") content.push({ text: sanitizeSurrogates(m.content) });
|
|
508
|
-
else for (const c of m.content) switch (c.type) {
|
|
509
|
-
case "text":
|
|
510
|
-
content.push({ text: sanitizeSurrogates(c.text) });
|
|
511
|
-
break;
|
|
512
|
-
case "image":
|
|
513
|
-
content.push({ image: createImageBlock(c.mimeType, c.data) });
|
|
514
|
-
break;
|
|
515
|
-
default: continue;
|
|
516
|
-
}
|
|
515
|
+
const content = typeof m.content === "string" ? [{ text: sanitizeSurrogates(m.content) }] : convertTextImageContent(m.content, false);
|
|
517
516
|
if (content.length === 0) continue;
|
|
518
517
|
if (hasRuntimeContextMarker(m) && !bindsClaudeThinkingPrefix(model) && firstVolatileMessageIndex === void 0) firstVolatileMessageIndex = result.length;
|
|
519
518
|
result.push({
|
|
@@ -612,7 +611,7 @@ function convertMessages(context, model, cachePoint) {
|
|
|
612
611
|
}
|
|
613
612
|
function convertToolConfig(tools, toolChoice) {
|
|
614
613
|
if (!tools?.length || toolChoice === "none") return;
|
|
615
|
-
const bedrockTools = tools.map((tool) => ({ toolSpec: {
|
|
614
|
+
const bedrockTools = sortPromptCacheToolsByName(tools).map((tool) => ({ toolSpec: {
|
|
616
615
|
name: tool.name,
|
|
617
616
|
description: tool.description,
|
|
618
617
|
inputSchema: { json: { ...tool.parameters } }
|
package/dist/thinking-policy.js
CHANGED
|
@@ -19,14 +19,12 @@ function isOpus47Or48BedrockModelRef(modelRef) {
|
|
|
19
19
|
function isOpus46BedrockModelRef(modelRef) {
|
|
20
20
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?(?:anthropic\.)?claude-opus-4[.-]6(?:$|[-.:/])/i.test(modelRef);
|
|
21
21
|
}
|
|
22
|
-
/** Return whether a Bedrock model ref names Claude Opus 4.7 or newer. */
|
|
23
22
|
function isOpus47OrNewerBedrockModelRef(modelRef) {
|
|
24
23
|
return isOpus5BedrockModelRef(modelRef) || isOpus47Or48BedrockModelRef(modelRef);
|
|
25
24
|
}
|
|
26
25
|
function isMythosPreviewBedrockModelRef(modelRef) {
|
|
27
26
|
return /(?:^|[/.:])(?:(?:us|eu|ap|apac|au|jp|global)\.)?(?:anthropic\.)?claude-mythos-preview(?:$|[-.:/])/i.test(modelRef);
|
|
28
27
|
}
|
|
29
|
-
/** Return whether a Bedrock Claude ref needs latest adaptive-thinking request shaping. */
|
|
30
28
|
function isLatestAdaptiveBedrockModelRef(modelId, params) {
|
|
31
29
|
const modelRef = {
|
|
32
30
|
id: modelId,
|
|
@@ -35,7 +33,6 @@ function isLatestAdaptiveBedrockModelRef(modelId, params) {
|
|
|
35
33
|
const canonicalModelId = resolveClaudeModelIdentity(modelRef);
|
|
36
34
|
return isClaude5BedrockModel(modelRef) || [modelId, canonicalModelId].some((candidate) => isOpus47OrNewerBedrockModelRef(candidate) || isMythosPreviewBedrockModelRef(candidate));
|
|
37
35
|
}
|
|
38
|
-
/** Return whether a Bedrock Claude ref supports max effort. */
|
|
39
36
|
function supportsBedrockNativeMaxEffort(modelId, params) {
|
|
40
37
|
if (isClaude5BedrockModel({
|
|
41
38
|
id: modelId,
|
|
@@ -46,7 +43,6 @@ function supportsBedrockNativeMaxEffort(modelId, params) {
|
|
|
46
43
|
params
|
|
47
44
|
})].some((modelRef) => isOpus46BedrockModelRef(modelRef) || isOpus47OrNewerBedrockModelRef(modelRef));
|
|
48
45
|
}
|
|
49
|
-
/** Resolve route-specific native effort mappings for Bedrock Claude models. */
|
|
50
46
|
function resolveBedrockNativeThinkingLevelMap(modelId, params) {
|
|
51
47
|
const modelRef = {
|
|
52
48
|
id: modelId,
|
|
@@ -74,7 +70,6 @@ function resolveBedrockNativeThinkingLevelMap(modelId, params) {
|
|
|
74
70
|
max: "max"
|
|
75
71
|
};
|
|
76
72
|
}
|
|
77
|
-
/** Resolve supported Claude thinking levels for a Bedrock model id. */
|
|
78
73
|
function resolveBedrockClaudeThinkingProfile(modelId, params) {
|
|
79
74
|
const trimmed = modelId.trim();
|
|
80
75
|
const modelRefs = [trimmed, resolveClaudeModelIdentity({
|
|
@@ -86,7 +86,7 @@ const commonParams = {
|
|
|
86
86
|
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
var version = "3.
|
|
89
|
+
var version = "3.1145.0";
|
|
90
90
|
var packageInfo = {
|
|
91
91
|
version: version};
|
|
92
92
|
|
|
@@ -1622,10 +1622,10 @@ const _wP = "wordPolicy";
|
|
|
1622
1622
|
const _wPC = "wordPolicyConfig";
|
|
1623
1623
|
const _xact = "x-amz-client-token";
|
|
1624
1624
|
const n0 = "com.amazonaws.bedrock";
|
|
1625
|
-
const _s_registry = TypeRegistry
|
|
1625
|
+
const _s_registry = new TypeRegistry(_s);
|
|
1626
1626
|
var BedrockServiceException$ = [-3, _s, "BedrockServiceException", 0, [], []];
|
|
1627
1627
|
_s_registry.registerError(BedrockServiceException$, BedrockServiceException);
|
|
1628
|
-
const n0_registry = TypeRegistry
|
|
1628
|
+
const n0_registry = new TypeRegistry(n0);
|
|
1629
1629
|
var AccessDeniedException$ = [-3, n0, _ADE,
|
|
1630
1630
|
{ [_e]: _c, [_hE]: 403 },
|
|
1631
1631
|
[_m],
|
|
@@ -1345,10 +1345,10 @@ const n0 = "com.amazonaws.bedrock";
|
|
|
1345
1345
|
import { TypeRegistry } from "@smithy/core/schema";
|
|
1346
1346
|
import { BedrockServiceException } from "../models/BedrockServiceException";
|
|
1347
1347
|
import { AccessDeniedException, ConflictException, InternalServerException, ResourceInUseException, ResourceNotFoundException, ServiceQuotaExceededException, ServiceUnavailableException, ThrottlingException, TooManyTagsException, ValidationException, } from "../models/errors";
|
|
1348
|
-
const _s_registry = TypeRegistry
|
|
1348
|
+
const _s_registry = new TypeRegistry(_s);
|
|
1349
1349
|
export var BedrockServiceException$ = [-3, _s, "BedrockServiceException", 0, [], []];
|
|
1350
1350
|
_s_registry.registerError(BedrockServiceException$, BedrockServiceException);
|
|
1351
|
-
const n0_registry = TypeRegistry
|
|
1351
|
+
const n0_registry = new TypeRegistry(n0);
|
|
1352
1352
|
export var AccessDeniedException$ = [-3, n0, _ADE,
|
|
1353
1353
|
{ [_e]: _c, [_hE]: 403 },
|
|
1354
1354
|
[_m],
|