@psnext/slingcli 2.5.20260724-1 → 2.5.20260725-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/sling.js +1 -1
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +66 -28
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +133 -15
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.js +7 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.js +28 -14
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.js +3 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.js +8 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/index.js +1 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.browser.js +9 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/index.js +5 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getDateHeader.js +1 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.js +12 -6
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/index.js +2 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/httpAuthSchemes/utils/isClockSkewed.js +1 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +10 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +10 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/detectBufferParsing.js +18 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.js +13 -15
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/ByteJsonShapeSerializer.js +27 -17
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js +22 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/needsReviver.js +41 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +33 -13
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/writeKey.js +3 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeDeserializer.js +4 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +2 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.d.ts +6 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.d.ts +7 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.d.ts +13 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/index.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +22 -6
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/index.browser.d.ts +11 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/index.d.ts +7 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/getDateHeader.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +22 -6
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/utils/index.d.ts +2 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/detectBufferParsing.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +0 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/needsReviver.d.ts +11 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +7 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/writeKey.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/api-extractor-type-index.d.ts +7 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +21 -61
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +27 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/AccountIdEndpointModeConstants.d.ts +16 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/NodeAccountIdEndpointModeConfigOptions.d.ts +14 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/account-id-endpoint/index.d.ts +5 -16
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/emitWarningIfUnsupportedVersion.d.ts +11 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.browser.d.ts +47 -107
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.d.ts +39 -112
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.native.d.ts +48 -107
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/longPollMiddleware.d.ts +14 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts +35 -25
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-logger/loggerMiddleware.d.ts +4 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/configuration.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.browser.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.d.ts +10 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/recursionDetectionMiddleware.native.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/check-features.d.ts +20 -16
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/configurations.d.ts +44 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/constants.d.ts +7 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/encode-features.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-user-agent/user-agent-middleware.d.ts +18 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/awsRegionConfig.d.ts +11 -8
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/extensions.d.ts +16 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.browser.d.ts +4 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.d.ts +14 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/region-config-resolver/stsRegionDefaultResolver.native.d.ts +4 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setCredentialFeature.d.ts +7 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setFeature.d.ts +12 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/setTokenFeature.d.ts +7 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/aws.d.ts +2 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/isVirtualHostableS3Bucket.d.ts +5 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/parseArn.d.ts +7 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partition.d.ts +38 -28
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partitions.d.ts +638 -647
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/isIpAddress.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/resolveDefaultAwsRegionalEndpointsConfig.d.ts +56 -29
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/resolveEndpoint.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointError.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/EndpointRuleObject.d.ts +1 -6
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/ErrorRuleObject.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/RuleSetObject.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/TreeRuleObject.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/types/shared.d.ts +1 -12
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/configurations.d.ts +7 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/createUserAgentStringParsingProvider.d.ts +14 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +2 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts +27 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts +18 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/crt-availability.d.ts +8 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/defaultUserAgent.d.ts +28 -17
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/getRuntimeUserAgentPair.d.ts +6 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/is-crt-available.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-node/nodeAppIdConfigOptions.d.ts +13 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +10 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +44 -37
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/NODE_AUTH_SCHEME_PREFERENCE_OPTIONS.d.ts +5 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.browser.d.ts +6 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-defaults.d.ts +7 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/clock-skew-node-config.d.ts +13 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/index.d.ts +7 -23
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +38 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +133 -56
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/index.browser.d.ts +11 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/index.d.ts +9 -24
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getArrayForCommaSeparatedString.d.ts +8 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getBearerTokenEnvKey.d.ts +6 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getDateHeader.d.ts +8 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getSkewCorrectedDate.d.ts +8 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/getUpdatedSystemClockOffset.d.ts +26 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/index.d.ts +4 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/httpAuthSchemes/utils/isClockSkewed.d.ts +9 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ConfigurableSerdeContext.d.ts +8 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/ProtocolLib.d.ts +74 -40
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/UnionSerde.d.ts +24 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/cbor/AwsSmithyRpcV2CborProtocol.d.ts +25 -36
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/coercing-serializers.d.ts +18 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/common.d.ts +2 -5
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/index.d.ts +22 -27
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_0Protocol.d.ts +22 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJson1_1Protocol.d.ts +22 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsJsonRpcProtocol.d.ts +29 -49
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/AwsRestJsonProtocol.d.ts +36 -49
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonCodec.d.ts +19 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeDeserializer.d.ts +13 -13
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/JsonShapeSerializer.d.ts +28 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/awsExpectUnion.d.ts +7 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/detectBufferParsing.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/BufferJsonShapeDeserializer.d.ts +29 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/experimental/ByteJsonShapeSerializer.d.ts +57 -30
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReplacer.d.ts +21 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/jsonReviver.d.ts +15 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/needsReviver.d.ts +11 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +22 -9
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsEc2QueryProtocol.d.ts +27 -18
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/AwsQueryProtocol.d.ts +49 -57
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QuerySerializerSettings.d.ts +13 -7
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/query/QueryShapeSerializer.d.ts +16 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/writeKey.d.ts +4 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +31 -47
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlCodec.d.ts +14 -17
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlShapeDeserializer.d.ts +20 -15
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/XmlShapeSerializer.d.ts +21 -21
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/parseXmlBody.d.ts +13 -4
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/simpleFormatXml.d.ts +6 -1
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +3 -3
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/util-arn-parser/arn.d.ts +32 -14
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/util-format-url/format-url.d.ts +2 -4
- package/node_modules/@aws-sdk/core/package.json +10 -6
- package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
- package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +2 -2
- package/node_modules/@aws-sdk/middleware-websocket/package.json +5 -5
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.browser.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.native.d.ts +2 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/package.json +6 -6
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +14 -4
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.js +14 -4
- package/node_modules/@aws-sdk/xml-builder/package.json +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +17 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +8 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +118 -11
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/bash.js +132 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit-diff.js +386 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/edit.js +95 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/file-mutation-queue.js +46 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/image.js +106 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/index.js +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/path-utils.js +26 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/read.js +110 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/tool-context.js +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +31 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +90 -35
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +10 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +26 -10
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +21 -8
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +17 -10
- package/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js +100 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +7 -11
- package/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js +17 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +7 -11
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +13 -9
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +68 -27
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +131 -34
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +173 -66
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +29 -7
- package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +8 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/load.js +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +222 -0
- package/node_modules/@earendil-works/pi-ai/dist/bun-oauth.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +9 -3
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +15 -0
- package/node_modules/@earendil-works/pi-ai/dist/model-catalog.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +5 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/ant-ling.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +30 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cerebras.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-workers-ai.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/ant-ling.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/deepseek.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google-vertex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/google.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/groq.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/minimax.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/mistral.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/moonshotai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/deepseek.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/fireworks.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/github-copilot.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/groq.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/huggingface.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax-cn.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/minimax.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai-cn.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/moonshotai.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/nvidia.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode-go.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/opencode.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter-images.js +10 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +10 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-cn.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/together.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/vercel-ai-gateway.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xai.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-ams.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-cn.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi-token-plan-sgp.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/xiaomi.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai-coding-cn.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/zai.models.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-retry.js +94 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +3 -0
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/startup-ui.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +7 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +11 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +4 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-config.js +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +7 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +3 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/remote-catalog-provider.js +5 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +4 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +34 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/tool-definition-wrapper.js +3 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/extensions/llama/provider.js +1 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +16 -46
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/external-editor.js +37 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +29 -47
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/clipboard.js +19 -8
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/version-check.js +3 -1
- package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +16 -15
- package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
- package/node_modules/@earendil-works/pi-server/package.json +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +15 -12
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +6 -3
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +1 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +1 -0
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/retry/service-error-classification/constants.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +2 -2
- package/node_modules/@smithy/core/dist-types/submodules/retry/service-error-classification/constants.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/retry/service-error-classification/constants.d.ts +1 -0
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/credential-provider-imds/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/node_modules/gaxios/build/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/node_modules/gaxios/build/esm/tsconfig.tsbuildinfo +1 -1
- package/node_modules/gaxios/package.json +1 -1
- package/node_modules/google-auth-library/build/src/auth/googleauth.js +24 -19
- package/node_modules/google-auth-library/package.json +1 -1
- package/node_modules/undici/lib/cache/memory-cache-store.js +54 -9
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +7 -1
- package/node_modules/undici/lib/core/request.js +12 -1
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -2
- package/node_modules/undici/lib/handler/cache-handler.js +246 -64
- package/node_modules/undici/lib/handler/cache-revalidation-handler.js +3 -3
- package/node_modules/undici/lib/handler/retry-handler.js +24 -0
- package/node_modules/undici/lib/interceptor/cache.js +159 -52
- package/node_modules/undici/lib/util/cache.js +324 -62
- package/node_modules/undici/lib/util/date.js +23 -6
- package/node_modules/undici/lib/web/cookies/util.js +79 -9
- package/node_modules/undici/package.json +1 -1
- package/package.json +7 -7
- package/sling-default-packages.json +2 -1
- package/slingshot/index.js +337 -339
|
@@ -4,6 +4,8 @@ import { formatProviderError, normalizeProviderError } from "../utils/error-body
|
|
|
4
4
|
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
5
5
|
import { headersToRecord } from "../utils/headers.js";
|
|
6
6
|
import { getProviderEnvValue } from "../utils/provider-env.js";
|
|
7
|
+
import { retryProviderRequest } from "../utils/provider-retry.js";
|
|
8
|
+
import { createGrammarToolInputProperties } from "./constrained-sampling.js";
|
|
7
9
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
|
8
10
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
|
9
11
|
import { buildBaseOptions } from "./simple-options.js";
|
|
@@ -68,7 +70,8 @@ export const stream = (model, context, options) => {
|
|
|
68
70
|
throw new Error(`No API key for provider: ${model.provider}`);
|
|
69
71
|
}
|
|
70
72
|
const client = createClient(model, apiKey, options);
|
|
71
|
-
|
|
73
|
+
const grammarToolInputProperties = createGrammarToolInputProperties(context.tools, model.compat?.supportsOpenAIGrammarTools ?? false);
|
|
74
|
+
let params = buildParams(model, context, options, deploymentName, grammarToolInputProperties);
|
|
72
75
|
const nextParams = await options?.onPayload?.(params, model);
|
|
73
76
|
if (nextParams !== undefined) {
|
|
74
77
|
params = nextParams;
|
|
@@ -76,12 +79,16 @@ export const stream = (model, context, options) => {
|
|
|
76
79
|
const requestOptions = {
|
|
77
80
|
...(options?.signal ? { signal: options.signal } : {}),
|
|
78
81
|
...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
|
|
79
|
-
maxRetries:
|
|
82
|
+
maxRetries: 0,
|
|
80
83
|
};
|
|
81
|
-
const { data: openaiStream, response } = await client.responses.create(params, requestOptions).withResponse()
|
|
84
|
+
const { data: openaiStream, response } = await retryProviderRequest(() => client.responses.create(params, requestOptions).withResponse(), {
|
|
85
|
+
maxRetries: options?.maxRetries,
|
|
86
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
87
|
+
signal: options?.signal,
|
|
88
|
+
});
|
|
82
89
|
await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
|
|
83
90
|
stream.push({ type: "start", partial: output });
|
|
84
|
-
await processResponsesStream(openaiStream, output, stream, model);
|
|
91
|
+
await processResponsesStream(openaiStream, output, stream, model, { grammarToolInputProperties });
|
|
85
92
|
if (options?.signal?.aborted) {
|
|
86
93
|
throw new Error("Request was aborted");
|
|
87
94
|
}
|
|
@@ -94,8 +101,9 @@ export const stream = (model, context, options) => {
|
|
|
94
101
|
catch (error) {
|
|
95
102
|
for (const block of output.content) {
|
|
96
103
|
delete block.index;
|
|
97
|
-
//
|
|
104
|
+
// Streaming scratch buffers are only used during parsing; never persist them.
|
|
98
105
|
delete block.partialJson;
|
|
106
|
+
delete block.customInput;
|
|
99
107
|
}
|
|
100
108
|
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
101
109
|
output.errorMessage = formatAzureOpenAIError(error);
|
|
@@ -181,8 +189,10 @@ function createClient(model, apiKey, options) {
|
|
|
181
189
|
baseURL: baseUrl,
|
|
182
190
|
});
|
|
183
191
|
}
|
|
184
|
-
function buildParams(model, context, options, deploymentName) {
|
|
185
|
-
const messages = convertResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS
|
|
192
|
+
function buildParams(model, context, options, deploymentName, grammarToolInputProperties = createGrammarToolInputProperties(context.tools, model.compat?.supportsOpenAIGrammarTools ?? false)) {
|
|
193
|
+
const messages = convertResponsesMessages(model, context, AZURE_TOOL_CALL_PROVIDERS, {
|
|
194
|
+
grammarToolInputProperties,
|
|
195
|
+
});
|
|
186
196
|
const params = {
|
|
187
197
|
model: deploymentName,
|
|
188
198
|
input: messages,
|
|
@@ -197,7 +207,10 @@ function buildParams(model, context, options, deploymentName) {
|
|
|
197
207
|
params.temperature = options?.temperature;
|
|
198
208
|
}
|
|
199
209
|
if (context.tools && context.tools.length > 0) {
|
|
200
|
-
params.tools = convertResponsesTools(context.tools
|
|
210
|
+
params.tools = convertResponsesTools(context.tools, {
|
|
211
|
+
supportsStrictMode: model.compat?.supportsStrictMode ?? true,
|
|
212
|
+
supportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,
|
|
213
|
+
});
|
|
201
214
|
}
|
|
202
215
|
if (model.reasoning) {
|
|
203
216
|
if (options?.reasoningEffort || options?.reasoningSummary) {
|
|
@@ -10,6 +10,7 @@ import { parseStreamingJson } from "../utils/json-parse.js";
|
|
|
10
10
|
import { resolveHttpProxyUrlForTarget } from "../utils/node-http-proxy.js";
|
|
11
11
|
import { getProviderEnvValue } from "../utils/provider-env.js";
|
|
12
12
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
13
|
+
import { resolveJsonSchemaStrictSampling } from "./constrained-sampling.js";
|
|
13
14
|
import { adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToContext, clampReasoning, } from "./simple-options.js";
|
|
14
15
|
import { transformMessages } from "./transform-messages.js";
|
|
15
16
|
const EMPTY_TEXT_PLACEHOLDER = "<empty>";
|
|
@@ -124,7 +125,7 @@ export const stream = (model, context, options = {}) => {
|
|
|
124
125
|
...(inferenceMaxTokens !== undefined && { maxTokens: inferenceMaxTokens }),
|
|
125
126
|
...(options.temperature !== undefined && { temperature: options.temperature }),
|
|
126
127
|
},
|
|
127
|
-
toolConfig: convertToolConfig(context.tools, options.toolChoice),
|
|
128
|
+
toolConfig: convertToolConfig(context.tools, options.toolChoice, model.compat?.supportsStrictMode ?? false),
|
|
128
129
|
additionalModelRequestFields: buildAdditionalModelRequestFields(model, options),
|
|
129
130
|
...(options.requestMetadata !== undefined && { requestMetadata: options.requestMetadata }),
|
|
130
131
|
};
|
|
@@ -728,16 +729,22 @@ function convertMessages(context, model, cacheRetention, env) {
|
|
|
728
729
|
}
|
|
729
730
|
return result;
|
|
730
731
|
}
|
|
731
|
-
function convertToolConfig(tools, toolChoice) {
|
|
732
|
-
if (!tools?.length
|
|
732
|
+
function convertToolConfig(tools, toolChoice, supportsStrictMode) {
|
|
733
|
+
if (!tools?.length)
|
|
733
734
|
return undefined;
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
735
|
+
if (toolChoice === "none")
|
|
736
|
+
return undefined;
|
|
737
|
+
const bedrockTools = tools.map((tool) => {
|
|
738
|
+
const strict = resolveJsonSchemaStrictSampling(tool, supportsStrictMode);
|
|
739
|
+
return {
|
|
740
|
+
toolSpec: {
|
|
741
|
+
name: tool.name,
|
|
742
|
+
description: tool.description,
|
|
743
|
+
inputSchema: { json: tool.parameters },
|
|
744
|
+
...(strict === true ? { strict: true } : {}),
|
|
745
|
+
},
|
|
746
|
+
};
|
|
747
|
+
});
|
|
741
748
|
let bedrockToolChoice;
|
|
742
749
|
switch (toolChoice) {
|
|
743
750
|
case "auto":
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
export function getGrammarToolInput(toolName, arguments_, inputProperty) {
|
|
2
|
+
const input = arguments_[inputProperty];
|
|
3
|
+
if (typeof input !== "string") {
|
|
4
|
+
throw new Error(`Grammar tool call "${toolName}" requires argument "${inputProperty}" to be a string.`);
|
|
5
|
+
}
|
|
6
|
+
return input;
|
|
7
|
+
}
|
|
8
|
+
export function appendGrammarToolInputJsonDelta(buffer, inputProperty, nextInput, close) {
|
|
9
|
+
if (buffer.closed) {
|
|
10
|
+
if (close && nextInput === buffer.input)
|
|
11
|
+
return undefined;
|
|
12
|
+
throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
|
|
13
|
+
}
|
|
14
|
+
if (!nextInput.startsWith(buffer.input)) {
|
|
15
|
+
throw new Error(`grammar tool input for property "${inputProperty}" changed non-monotonically`);
|
|
16
|
+
}
|
|
17
|
+
const inputDelta = nextInput.slice(buffer.input.length);
|
|
18
|
+
if (!close && inputDelta.length === 0)
|
|
19
|
+
return undefined;
|
|
20
|
+
let delta = "";
|
|
21
|
+
if (!buffer.started) {
|
|
22
|
+
delta += `{${JSON.stringify(inputProperty)}:"`;
|
|
23
|
+
buffer.started = true;
|
|
24
|
+
}
|
|
25
|
+
delta += JSON.stringify(inputDelta).slice(1, -1);
|
|
26
|
+
buffer.input = nextInput;
|
|
27
|
+
if (close) {
|
|
28
|
+
delta += '"}';
|
|
29
|
+
buffer.closed = true;
|
|
30
|
+
}
|
|
31
|
+
return delta;
|
|
32
|
+
}
|
|
33
|
+
function inferGrammarInputProperty(tool) {
|
|
34
|
+
const schema = tool.parameters;
|
|
35
|
+
if (schema.type !== "object") {
|
|
36
|
+
throw new Error("grammar constrained sampling requires an object parameter schema");
|
|
37
|
+
}
|
|
38
|
+
if (!Array.isArray(schema.required) || schema.required.length !== 1 || typeof schema.required[0] !== "string") {
|
|
39
|
+
throw new Error("grammar constrained sampling requires exactly one required string property");
|
|
40
|
+
}
|
|
41
|
+
const inputProperty = schema.required[0];
|
|
42
|
+
if (!schema.properties?.[inputProperty]) {
|
|
43
|
+
throw new Error(`grammar constrained sampling requires a properties entry for ${inputProperty}`);
|
|
44
|
+
}
|
|
45
|
+
if (schema.properties[inputProperty]?.type !== "string") {
|
|
46
|
+
throw new Error(`grammar constrained sampling property ${inputProperty} must have type string`);
|
|
47
|
+
}
|
|
48
|
+
return inputProperty;
|
|
49
|
+
}
|
|
50
|
+
export function resolveJsonSchemaStrictSampling(tool, supportsStrictMode) {
|
|
51
|
+
const config = tool.constrainedSampling;
|
|
52
|
+
if (!config || config.type !== "json_schema") {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
if (supportsStrictMode) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (config.strict === "require") {
|
|
59
|
+
throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
export function resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools) {
|
|
64
|
+
const config = tool.constrainedSampling;
|
|
65
|
+
if (!config || config.type !== "grammar") {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
if (!supportsOpenAIGrammarTools) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const larkDefinition = config.variants.openai_lark;
|
|
72
|
+
const regexDefinition = config.variants.openai_regex;
|
|
73
|
+
const hasLarkDefinition = typeof larkDefinition === "string" && larkDefinition.trim().length > 0;
|
|
74
|
+
const hasRegexDefinition = typeof regexDefinition === "string" && regexDefinition.trim().length > 0;
|
|
75
|
+
if (!hasLarkDefinition && !hasRegexDefinition) {
|
|
76
|
+
throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return {
|
|
80
|
+
format: hasLarkDefinition ? "lark" : "regex",
|
|
81
|
+
definition: hasLarkDefinition ? larkDefinition : regexDefinition,
|
|
82
|
+
inputProperty: inferGrammarInputProperty(tool),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
+
throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: ${message}.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
export function createGrammarToolInputProperties(tools, supportsOpenAIGrammarTools) {
|
|
91
|
+
const properties = new Map();
|
|
92
|
+
for (const tool of tools ?? []) {
|
|
93
|
+
const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
|
|
94
|
+
if (grammar) {
|
|
95
|
+
properties.set(tool.name, grammar.inputProperty);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return properties;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=constrained-sampling.js.map
|
|
@@ -4,7 +4,7 @@ import { formatProviderError, normalizeProviderError } from "../utils/error-body
|
|
|
4
4
|
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
5
5
|
import { providerHeadersToRecord } from "../utils/headers.js";
|
|
6
6
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
7
|
-
import { convertMessages, convertTools, isThinkingPart, mapStopReason,
|
|
7
|
+
import { convertMessages, convertTools, isThinkingPart, mapStopReason, resolveGoogleFunctionCallingMode, retainThoughtSignature, supportsGoogleStrictToolSampling, } from "./google-shared.js";
|
|
8
8
|
import { buildBaseOptions } from "./simple-options.js";
|
|
9
9
|
// Counter for generating unique tool call IDs
|
|
10
10
|
let toolCallCounter = 0;
|
|
@@ -271,21 +271,17 @@ function buildParams(model, context, options = {}) {
|
|
|
271
271
|
if (options.maxTokens !== undefined) {
|
|
272
272
|
generationConfig.maxOutputTokens = options.maxTokens;
|
|
273
273
|
}
|
|
274
|
+
const functionCallingMode = context.tools?.length
|
|
275
|
+
? resolveGoogleFunctionCallingMode(context.tools, options.toolChoice, supportsGoogleStrictToolSampling(model.id))
|
|
276
|
+
: undefined;
|
|
274
277
|
const config = {
|
|
275
278
|
...(Object.keys(generationConfig).length > 0 && generationConfig),
|
|
276
279
|
...(context.systemPrompt && { systemInstruction: sanitizeSurrogates(context.systemPrompt) }),
|
|
277
280
|
...(context.tools && context.tools.length > 0 && { tools: convertTools(context.tools) }),
|
|
281
|
+
...(functionCallingMode !== undefined && {
|
|
282
|
+
toolConfig: { functionCallingConfig: { mode: functionCallingMode } },
|
|
283
|
+
}),
|
|
278
284
|
};
|
|
279
|
-
if (context.tools && context.tools.length > 0 && options.toolChoice) {
|
|
280
|
-
config.toolConfig = {
|
|
281
|
-
functionCallingConfig: {
|
|
282
|
-
mode: mapToolChoice(options.toolChoice),
|
|
283
|
-
},
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
config.toolConfig = undefined;
|
|
288
|
-
}
|
|
289
285
|
if (options.thinking?.enabled && model.reasoning) {
|
|
290
286
|
const thinkingConfig = { includeThoughts: true };
|
|
291
287
|
if (options.thinking.level !== undefined) {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { FinishReason, FunctionCallingConfigMode } from "@google/genai";
|
|
5
5
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
6
|
+
import { resolveJsonSchemaStrictSampling } from "./constrained-sampling.js";
|
|
6
7
|
import { transformMessages } from "./transform-messages.js";
|
|
7
8
|
/**
|
|
8
9
|
* Determines whether a streamed Gemini `Part` should be treated as "thinking".
|
|
@@ -267,9 +268,12 @@ export function convertTools(tools, useParameters = false) {
|
|
|
267
268
|
},
|
|
268
269
|
];
|
|
269
270
|
}
|
|
270
|
-
/**
|
|
271
|
-
|
|
272
|
-
|
|
271
|
+
/** Gemini 3+ enforces required function parameters in validated tool-calling modes. */
|
|
272
|
+
export function supportsGoogleStrictToolSampling(modelId) {
|
|
273
|
+
const majorVersion = getGeminiMajorVersion(modelId);
|
|
274
|
+
return majorVersion !== undefined && majorVersion >= 3;
|
|
275
|
+
}
|
|
276
|
+
/** Map tool choice string to Gemini FunctionCallingConfigMode. */
|
|
273
277
|
export function mapToolChoice(choice) {
|
|
274
278
|
switch (choice) {
|
|
275
279
|
case "auto":
|
|
@@ -282,6 +286,16 @@ export function mapToolChoice(choice) {
|
|
|
282
286
|
return FunctionCallingConfigMode.AUTO;
|
|
283
287
|
}
|
|
284
288
|
}
|
|
289
|
+
export function resolveGoogleFunctionCallingMode(tools, toolChoice, supportsStrictMode) {
|
|
290
|
+
const useStrictMode = tools.some((tool) => resolveJsonSchemaStrictSampling(tool, supportsStrictMode) === true);
|
|
291
|
+
if (toolChoice === "none" || toolChoice === "any") {
|
|
292
|
+
return mapToolChoice(toolChoice);
|
|
293
|
+
}
|
|
294
|
+
if (useStrictMode) {
|
|
295
|
+
return FunctionCallingConfigMode.VALIDATED;
|
|
296
|
+
}
|
|
297
|
+
return toolChoice ? mapToolChoice(toolChoice) : undefined;
|
|
298
|
+
}
|
|
285
299
|
/**
|
|
286
300
|
* Map Gemini FinishReason to our StopReason.
|
|
287
301
|
*/
|
|
@@ -5,7 +5,7 @@ import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
|
5
5
|
import { providerHeadersToRecord } from "../utils/headers.js";
|
|
6
6
|
import { getProviderEnvValue } from "../utils/provider-env.js";
|
|
7
7
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
8
|
-
import { convertMessages, convertTools, isThinkingPart, mapStopReason,
|
|
8
|
+
import { convertMessages, convertTools, isThinkingPart, mapStopReason, resolveGoogleFunctionCallingMode, retainThoughtSignature, supportsGoogleStrictToolSampling, } from "./google-shared.js";
|
|
9
9
|
import { buildBaseOptions } from "./simple-options.js";
|
|
10
10
|
const API_VERSION = "v1";
|
|
11
11
|
const GCP_VERTEX_CREDENTIALS_MARKER = "gcp-vertex-credentials";
|
|
@@ -345,21 +345,17 @@ function buildParams(model, context, options = {}) {
|
|
|
345
345
|
if (options.maxTokens !== undefined) {
|
|
346
346
|
generationConfig.maxOutputTokens = options.maxTokens;
|
|
347
347
|
}
|
|
348
|
+
const functionCallingMode = context.tools?.length
|
|
349
|
+
? resolveGoogleFunctionCallingMode(context.tools, options.toolChoice, supportsGoogleStrictToolSampling(model.id))
|
|
350
|
+
: undefined;
|
|
348
351
|
const config = {
|
|
349
352
|
...(Object.keys(generationConfig).length > 0 && generationConfig),
|
|
350
353
|
...(context.systemPrompt && { systemInstruction: sanitizeSurrogates(context.systemPrompt) }),
|
|
351
354
|
...(context.tools && context.tools.length > 0 && { tools: convertTools(context.tools) }),
|
|
355
|
+
...(functionCallingMode !== undefined && {
|
|
356
|
+
toolConfig: { functionCallingConfig: { mode: functionCallingMode } },
|
|
357
|
+
}),
|
|
352
358
|
};
|
|
353
|
-
if (context.tools && context.tools.length > 0 && options.toolChoice) {
|
|
354
|
-
config.toolConfig = {
|
|
355
|
-
functionCallingConfig: {
|
|
356
|
-
mode: mapToolChoice(options.toolChoice),
|
|
357
|
-
},
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
config.toolConfig = undefined;
|
|
362
|
-
}
|
|
363
359
|
if (options.thinking?.enabled && model.reasoning) {
|
|
364
360
|
const thinkingConfig = { includeThoughts: true };
|
|
365
361
|
if (options.thinking.level !== undefined) {
|
|
@@ -4,6 +4,7 @@ import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
|
4
4
|
import { shortHash } from "../utils/hash.js";
|
|
5
5
|
import { parseStreamingJson } from "../utils/json-parse.js";
|
|
6
6
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
7
|
+
import { resolveJsonSchemaStrictSampling } from "./constrained-sampling.js";
|
|
7
8
|
import { buildBaseOptions } from "./simple-options.js";
|
|
8
9
|
import { transformMessages } from "./transform-messages.js";
|
|
9
10
|
const MISTRAL_TOOL_CALL_ID_LENGTH = 9;
|
|
@@ -389,15 +390,18 @@ async function consumeChatStream(model, output, stream, mistralStream) {
|
|
|
389
390
|
}
|
|
390
391
|
}
|
|
391
392
|
function toFunctionTools(tools) {
|
|
392
|
-
return tools.map((tool) =>
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
393
|
+
return tools.map((tool) => {
|
|
394
|
+
const strict = resolveJsonSchemaStrictSampling(tool, true);
|
|
395
|
+
return {
|
|
396
|
+
type: "function",
|
|
397
|
+
function: {
|
|
398
|
+
name: tool.name,
|
|
399
|
+
description: tool.description,
|
|
400
|
+
parameters: stripSymbolKeys(tool.parameters),
|
|
401
|
+
strict: strict ?? false,
|
|
402
|
+
},
|
|
403
|
+
};
|
|
404
|
+
});
|
|
401
405
|
}
|
|
402
406
|
function stripSymbolKeys(value) {
|
|
403
407
|
if (Array.isArray(value)) {
|
|
@@ -16,6 +16,7 @@ import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
|
16
16
|
import { headersToRecord } from "../utils/headers.js";
|
|
17
17
|
import { resolveHttpProxyUrlForTarget } from "../utils/node-http-proxy.js";
|
|
18
18
|
import { uuidv7 } from "../utils/uuid.js";
|
|
19
|
+
import { createGrammarToolInputProperties } from "./constrained-sampling.js";
|
|
19
20
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
|
20
21
|
import { convertResponsesMessages, convertResponsesTools, processResponsesStream } from "./openai-responses-shared.js";
|
|
21
22
|
import { buildBaseOptions } from "./simple-options.js";
|
|
@@ -34,6 +35,7 @@ const REQUEST_COMPRESSION_ZSTD_LEVEL = 3;
|
|
|
34
35
|
const CODEX_TOOL_CALL_PROVIDERS = new Set(["openai", "openai-codex", "opencode"]);
|
|
35
36
|
const WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;
|
|
36
37
|
const WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE = "websocket_connection_limit_reached";
|
|
38
|
+
const PREVIOUS_RESPONSE_NOT_FOUND_CODE = "previous_response_not_found";
|
|
37
39
|
const CODEX_RESPONSE_STATUSES = new Set([
|
|
38
40
|
"completed",
|
|
39
41
|
"incomplete",
|
|
@@ -79,9 +81,14 @@ function getRetryAfterDelayMs(headers) {
|
|
|
79
81
|
}
|
|
80
82
|
return undefined;
|
|
81
83
|
}
|
|
82
|
-
|
|
84
|
+
class RetryDelayExceededError extends Error {
|
|
85
|
+
}
|
|
86
|
+
function validateRetryDelayMs(delayMs, options) {
|
|
83
87
|
const maxRetryDelayMs = options?.maxRetryDelayMs ?? DEFAULT_MAX_RETRY_DELAY_MS;
|
|
84
|
-
|
|
88
|
+
if (maxRetryDelayMs > 0 && delayMs > maxRetryDelayMs) {
|
|
89
|
+
throw new RetryDelayExceededError(`Server requested ${Math.ceil(delayMs / 1000)}s retry delay (max: ${Math.ceil(maxRetryDelayMs / 1000)}s)`);
|
|
90
|
+
}
|
|
91
|
+
return delayMs;
|
|
85
92
|
}
|
|
86
93
|
function sleep(ms, signal) {
|
|
87
94
|
return new Promise((resolve, reject) => {
|
|
@@ -157,12 +164,14 @@ export const stream = (model, context, options) => {
|
|
|
157
164
|
throw new Error(`No API key for provider: ${model.provider}`);
|
|
158
165
|
}
|
|
159
166
|
const accountId = extractAccountId(apiKey);
|
|
160
|
-
|
|
167
|
+
const grammarToolInputProperties = createGrammarToolInputProperties(context.tools, model.compat?.supportsOpenAIGrammarTools ?? false);
|
|
168
|
+
const cacheSessionId = options?.cacheRetention === "none" ? undefined : options?.sessionId;
|
|
169
|
+
const codexSessionId = clampOpenAIPromptCacheKey(cacheSessionId);
|
|
170
|
+
let body = buildRequestBody(model, context, options, codexSessionId, grammarToolInputProperties);
|
|
161
171
|
const nextBody = await options?.onPayload?.(body, model);
|
|
162
172
|
if (nextBody !== undefined) {
|
|
163
173
|
body = nextBody;
|
|
164
174
|
}
|
|
165
|
-
const codexSessionId = clampOpenAIPromptCacheKey(options?.sessionId);
|
|
166
175
|
const websocketRequestId = codexSessionId || uuidv7();
|
|
167
176
|
const sseHeaders = buildSSEHeaders(model.headers, options?.headers, accountId, apiKey, codexSessionId);
|
|
168
177
|
const websocketHeaders = buildWebSocketHeaders(model.headers, options?.headers, accountId, apiKey, websocketRequestId);
|
|
@@ -170,19 +179,25 @@ export const stream = (model, context, options) => {
|
|
|
170
179
|
const httpTimeoutMs = normalizeTimeoutMs(options?.timeoutMs);
|
|
171
180
|
const websocketConnectTimeoutMs = normalizeTimeoutMs(options?.websocketConnectTimeoutMs);
|
|
172
181
|
const transport = options?.transport || "auto";
|
|
173
|
-
|
|
182
|
+
let startEmitted = false;
|
|
183
|
+
const websocketDisabledForSession = transport !== "sse" && isWebSocketSseFallbackActive(cacheSessionId);
|
|
174
184
|
if (websocketDisabledForSession) {
|
|
175
|
-
recordWebSocketSseFallback(
|
|
185
|
+
recordWebSocketSseFallback(cacheSessionId);
|
|
176
186
|
}
|
|
177
187
|
if (transport !== "sse" && !websocketDisabledForSession) {
|
|
178
188
|
let websocketStarted = false;
|
|
179
189
|
let retriedWebSocketConnectionLimit = false;
|
|
190
|
+
let retriedMissingWebSocketContinuation = false;
|
|
180
191
|
while (true) {
|
|
181
192
|
websocketStarted = false;
|
|
182
193
|
try {
|
|
183
194
|
await processWebSocketStream(resolveCodexWebSocketUrl(model.baseUrl), body, websocketHeaders, output, stream, model, () => {
|
|
184
195
|
websocketStarted = true;
|
|
185
|
-
|
|
196
|
+
if (!startEmitted) {
|
|
197
|
+
startEmitted = true;
|
|
198
|
+
stream.push({ type: "start", partial: output });
|
|
199
|
+
}
|
|
200
|
+
}, httpTimeoutMs, websocketConnectTimeoutMs, cacheSessionId, grammarToolInputProperties, options);
|
|
186
201
|
if (options?.signal?.aborted) {
|
|
187
202
|
throw new Error("Request was aborted");
|
|
188
203
|
}
|
|
@@ -197,6 +212,11 @@ export const stream = (model, context, options) => {
|
|
|
197
212
|
catch (error) {
|
|
198
213
|
const aborted = options?.signal?.aborted;
|
|
199
214
|
const connectionLimitBeforeStart = !websocketStarted && isWebSocketConnectionLimitReachedError(error);
|
|
215
|
+
const previousResponseNotFound = isPreviousResponseNotFoundError(error);
|
|
216
|
+
if (!aborted && previousResponseNotFound && !retriedMissingWebSocketContinuation) {
|
|
217
|
+
retriedMissingWebSocketContinuation = true;
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
200
220
|
if (!aborted && connectionLimitBeforeStart && !retriedWebSocketConnectionLimit) {
|
|
201
221
|
retriedWebSocketConnectionLimit = true;
|
|
202
222
|
continue;
|
|
@@ -211,11 +231,11 @@ export const stream = (model, context, options) => {
|
|
|
211
231
|
phase: websocketStarted ? "after_message_stream_start" : "before_message_stream_start",
|
|
212
232
|
requestBytes: new TextEncoder().encode(bodyJson).byteLength,
|
|
213
233
|
}));
|
|
214
|
-
recordWebSocketFailure(
|
|
234
|
+
recordWebSocketFailure(cacheSessionId, error);
|
|
215
235
|
if (websocketStarted) {
|
|
216
236
|
throw error;
|
|
217
237
|
}
|
|
218
|
-
recordWebSocketSseFallback(
|
|
238
|
+
recordWebSocketSseFallback(cacheSessionId);
|
|
219
239
|
break;
|
|
220
240
|
}
|
|
221
241
|
}
|
|
@@ -265,9 +285,7 @@ export const stream = (model, context, options) => {
|
|
|
265
285
|
const retryAfterDelayMs = getRetryAfterDelayMs(response.headers);
|
|
266
286
|
const delayMs = retryAfterDelayMs === undefined
|
|
267
287
|
? BASE_DELAY_MS * 2 ** attempt
|
|
268
|
-
:
|
|
269
|
-
? capRetryDelayMs(retryAfterDelayMs, options)
|
|
270
|
-
: retryAfterDelayMs;
|
|
288
|
+
: validateRetryDelayMs(retryAfterDelayMs, options);
|
|
271
289
|
await sleep(delayMs, options?.signal);
|
|
272
290
|
continue;
|
|
273
291
|
}
|
|
@@ -287,7 +305,9 @@ export const stream = (model, context, options) => {
|
|
|
287
305
|
}
|
|
288
306
|
lastError = error instanceof Error ? error : new Error(String(error));
|
|
289
307
|
// Network errors are retryable
|
|
290
|
-
if (attempt < maxRetries &&
|
|
308
|
+
if (attempt < maxRetries &&
|
|
309
|
+
!(lastError instanceof RetryDelayExceededError) &&
|
|
310
|
+
!lastError.message.includes("usage limit")) {
|
|
291
311
|
const delayMs = BASE_DELAY_MS * 2 ** attempt;
|
|
292
312
|
await sleep(delayMs, options?.signal);
|
|
293
313
|
continue;
|
|
@@ -301,8 +321,11 @@ export const stream = (model, context, options) => {
|
|
|
301
321
|
if (!response.body) {
|
|
302
322
|
throw new Error("No response body");
|
|
303
323
|
}
|
|
304
|
-
|
|
305
|
-
|
|
324
|
+
if (!startEmitted) {
|
|
325
|
+
startEmitted = true;
|
|
326
|
+
stream.push({ type: "start", partial: output });
|
|
327
|
+
}
|
|
328
|
+
await processStream(response, output, stream, model, grammarToolInputProperties, options);
|
|
306
329
|
if (options?.signal?.aborted) {
|
|
307
330
|
throw new Error("Request was aborted");
|
|
308
331
|
}
|
|
@@ -311,8 +334,9 @@ export const stream = (model, context, options) => {
|
|
|
311
334
|
}
|
|
312
335
|
catch (error) {
|
|
313
336
|
for (const block of output.content) {
|
|
314
|
-
//
|
|
337
|
+
// Streaming scratch buffers are only used during parsing; never persist them.
|
|
315
338
|
delete block.partialJson;
|
|
339
|
+
delete block.customInput;
|
|
316
340
|
}
|
|
317
341
|
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
318
342
|
output.errorMessage = formatProviderError(normalizeProviderError(error));
|
|
@@ -338,11 +362,19 @@ export const streamSimple = (model, context, options) => {
|
|
|
338
362
|
// ============================================================================
|
|
339
363
|
// Request Building
|
|
340
364
|
// ============================================================================
|
|
341
|
-
function buildRequestBody(model, context, options) {
|
|
365
|
+
function buildRequestBody(model, context, options, cacheSessionId, grammarToolInputProperties = createGrammarToolInputProperties(context.tools, model.compat?.supportsOpenAIGrammarTools ?? false)) {
|
|
366
|
+
const supportsStrictMode = model.compat?.supportsStrictMode ?? true;
|
|
367
|
+
const supportsOpenAIGrammarTools = model.compat?.supportsOpenAIGrammarTools ?? false;
|
|
342
368
|
const toolPlacement = splitDeferredTools(context, model.compat?.supportsToolSearch ?? false);
|
|
343
369
|
const messages = convertResponsesMessages(model, context, CODEX_TOOL_CALL_PROVIDERS, {
|
|
344
370
|
includeSystemPrompt: false,
|
|
371
|
+
grammarToolInputProperties,
|
|
345
372
|
deferredTools: toolPlacement.deferred,
|
|
373
|
+
toolOptions: {
|
|
374
|
+
strict: null,
|
|
375
|
+
supportsStrictMode,
|
|
376
|
+
supportsOpenAIGrammarTools,
|
|
377
|
+
},
|
|
346
378
|
});
|
|
347
379
|
const body = {
|
|
348
380
|
model: model.id,
|
|
@@ -352,7 +384,7 @@ function buildRequestBody(model, context, options) {
|
|
|
352
384
|
input: messages,
|
|
353
385
|
text: { verbosity: options?.textVerbosity || "low" },
|
|
354
386
|
include: ["reasoning.encrypted_content"],
|
|
355
|
-
prompt_cache_key:
|
|
387
|
+
prompt_cache_key: cacheSessionId,
|
|
356
388
|
tool_choice: options?.toolChoice ?? "auto",
|
|
357
389
|
parallel_tool_calls: true,
|
|
358
390
|
};
|
|
@@ -363,7 +395,11 @@ function buildRequestBody(model, context, options) {
|
|
|
363
395
|
body.service_tier = options.serviceTier;
|
|
364
396
|
}
|
|
365
397
|
if (toolPlacement.immediate.length > 0) {
|
|
366
|
-
body.tools = convertResponsesTools(toolPlacement.immediate, {
|
|
398
|
+
body.tools = convertResponsesTools(toolPlacement.immediate, {
|
|
399
|
+
strict: null,
|
|
400
|
+
supportsStrictMode,
|
|
401
|
+
supportsOpenAIGrammarTools,
|
|
402
|
+
});
|
|
367
403
|
}
|
|
368
404
|
if (options?.reasoningEffort !== undefined) {
|
|
369
405
|
const effort = options.reasoningEffort === "none"
|
|
@@ -424,9 +460,10 @@ function resolveCodexWebSocketUrl(baseUrl) {
|
|
|
424
460
|
// ============================================================================
|
|
425
461
|
// Response Processing
|
|
426
462
|
// ============================================================================
|
|
427
|
-
async function processStream(response, output, stream, model, options) {
|
|
463
|
+
async function processStream(response, output, stream, model, grammarToolInputProperties, options) {
|
|
428
464
|
await processResponsesStream(mapCodexEvents(parseSSE(response, options?.signal)), output, stream, model, {
|
|
429
465
|
serviceTier: options?.serviceTier,
|
|
466
|
+
grammarToolInputProperties,
|
|
430
467
|
resolveServiceTier: resolveCodexServiceTier,
|
|
431
468
|
applyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),
|
|
432
469
|
});
|
|
@@ -457,6 +494,9 @@ function isCodexNonTransportError(error) {
|
|
|
457
494
|
function isWebSocketConnectionLimitReachedError(error) {
|
|
458
495
|
return error instanceof CodexApiError && error.code === WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE;
|
|
459
496
|
}
|
|
497
|
+
function isPreviousResponseNotFoundError(error) {
|
|
498
|
+
return error instanceof CodexApiError && error.code === PREVIOUS_RESPONSE_NOT_FOUND_CODE;
|
|
499
|
+
}
|
|
460
500
|
function extractCodexEventError(event) {
|
|
461
501
|
const nested = event.error && typeof event.error === "object" ? event.error : undefined;
|
|
462
502
|
return {
|
|
@@ -1062,26 +1102,25 @@ function buildCachedWebSocketRequestBody(entry, body) {
|
|
|
1062
1102
|
input: delta,
|
|
1063
1103
|
};
|
|
1064
1104
|
}
|
|
1065
|
-
async function* startWebSocketOutputOnFirstEvent(events,
|
|
1105
|
+
async function* startWebSocketOutputOnFirstEvent(events, onStart) {
|
|
1066
1106
|
let started = false;
|
|
1067
1107
|
for await (const event of events) {
|
|
1068
1108
|
if (!started) {
|
|
1069
1109
|
started = true;
|
|
1070
1110
|
onStart();
|
|
1071
|
-
stream.push({ type: "start", partial: output });
|
|
1072
1111
|
}
|
|
1073
1112
|
yield event;
|
|
1074
1113
|
}
|
|
1075
1114
|
}
|
|
1076
|
-
async function processWebSocketStream(url, body, headers, output, stream, model, onStart, idleTimeoutMs, websocketConnectTimeoutMs, options) {
|
|
1077
|
-
const { socket, entry, reused, release } = await acquireWebSocket(url, headers,
|
|
1115
|
+
async function processWebSocketStream(url, body, headers, output, stream, model, onStart, idleTimeoutMs, websocketConnectTimeoutMs, cacheSessionId, grammarToolInputProperties, options) {
|
|
1116
|
+
const { socket, entry, reused, release } = await acquireWebSocket(url, headers, cacheSessionId, options?.signal, websocketConnectTimeoutMs, options?.env);
|
|
1078
1117
|
let keepConnection = true;
|
|
1079
1118
|
const useCachedContext = options?.transport === "websocket-cached" || options?.transport === "auto";
|
|
1080
1119
|
// ChatGPT Codex Responses rejects `store: true` ("Store must be set to false").
|
|
1081
1120
|
// WebSocket continuation still works via connection-scoped previous_response_id state.
|
|
1082
1121
|
const fullBody = body;
|
|
1083
1122
|
const requestBody = useCachedContext && entry ? buildCachedWebSocketRequestBody(entry, fullBody) : fullBody;
|
|
1084
|
-
const stats =
|
|
1123
|
+
const stats = cacheSessionId ? getOrCreateWebSocketDebugStats(cacheSessionId) : undefined;
|
|
1085
1124
|
if (stats) {
|
|
1086
1125
|
stats.requests++;
|
|
1087
1126
|
if (reused)
|
|
@@ -1106,8 +1145,9 @@ async function processWebSocketStream(url, body, headers, output, stream, model,
|
|
|
1106
1145
|
}
|
|
1107
1146
|
try {
|
|
1108
1147
|
socket.send(JSON.stringify({ type: "response.create", ...requestBody }));
|
|
1109
|
-
await processResponsesStream(startWebSocketOutputOnFirstEvent(mapCodexEvents(parseWebSocket(socket, options?.signal, idleTimeoutMs)),
|
|
1148
|
+
await processResponsesStream(startWebSocketOutputOnFirstEvent(mapCodexEvents(parseWebSocket(socket, options?.signal, idleTimeoutMs)), onStart), output, stream, model, {
|
|
1110
1149
|
serviceTier: options?.serviceTier,
|
|
1150
|
+
grammarToolInputProperties,
|
|
1111
1151
|
resolveServiceTier: resolveCodexServiceTier,
|
|
1112
1152
|
applyServiceTierPricing: (usage, serviceTier) => applyServiceTierPricing(usage, serviceTier, model),
|
|
1113
1153
|
});
|
|
@@ -1117,7 +1157,8 @@ async function processWebSocketStream(url, body, headers, output, stream, model,
|
|
|
1117
1157
|
else if (useCachedContext && entry && output.responseId) {
|
|
1118
1158
|
const responseItems = convertResponsesMessages(model, { messages: [output] }, CODEX_TOOL_CALL_PROVIDERS, {
|
|
1119
1159
|
includeSystemPrompt: false,
|
|
1120
|
-
|
|
1160
|
+
grammarToolInputProperties,
|
|
1161
|
+
}).filter((item) => item.type !== "function_call_output" && item.type !== "custom_tool_call_output");
|
|
1121
1162
|
entry.continuation = {
|
|
1122
1163
|
lastRequestBody: fullBody,
|
|
1123
1164
|
lastResponseId: output.responseId,
|