@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
|
@@ -6,7 +6,9 @@ import { shortHash } from "../utils/hash.js";
|
|
|
6
6
|
import { headersToRecord } from "../utils/headers.js";
|
|
7
7
|
import { parseStreamingJson } from "../utils/json-parse.js";
|
|
8
8
|
import { getProviderEnvValue } from "../utils/provider-env.js";
|
|
9
|
+
import { retryProviderRequest } from "../utils/provider-retry.js";
|
|
9
10
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
11
|
+
import { appendGrammarToolInputJsonDelta, createGrammarToolInputProperties, getGrammarToolInput, resolveGrammarConstrainedSampling, resolveJsonSchemaStrictSampling, } from "./constrained-sampling.js";
|
|
10
12
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
|
|
11
13
|
import { clampOpenAIPromptCacheKey } from "./openai-prompt-cache.js";
|
|
12
14
|
import { buildBaseOptions } from "./simple-options.js";
|
|
@@ -120,10 +122,11 @@ export const stream = (model, context, options) => {
|
|
|
120
122
|
try {
|
|
121
123
|
const apiKey = getClientApiKey(model.provider, options?.apiKey, options?.headers);
|
|
122
124
|
const compat = getCompat(model);
|
|
125
|
+
const grammarToolInputProperties = createGrammarToolInputProperties(context.tools, compat.supportsOpenAIGrammarTools);
|
|
123
126
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
|
|
124
127
|
const cacheSessionId = cacheRetention === "none" ? undefined : options?.sessionId;
|
|
125
128
|
const client = createClient(model, context, apiKey, options?.headers, cacheSessionId, compat);
|
|
126
|
-
let params = buildParams(model, context, options, compat, cacheRetention);
|
|
129
|
+
let params = buildParams(model, context, options, compat, cacheRetention, grammarToolInputProperties);
|
|
127
130
|
const nextParams = await options?.onPayload?.(params, model);
|
|
128
131
|
if (nextParams !== undefined) {
|
|
129
132
|
params = nextParams;
|
|
@@ -131,11 +134,13 @@ export const stream = (model, context, options) => {
|
|
|
131
134
|
const requestOptions = {
|
|
132
135
|
...(options?.signal ? { signal: options.signal } : {}),
|
|
133
136
|
...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
|
|
134
|
-
maxRetries:
|
|
137
|
+
maxRetries: 0,
|
|
135
138
|
};
|
|
136
|
-
const { data: openaiStream, response } = await client.chat.completions
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
const { data: openaiStream, response } = await retryProviderRequest(() => client.chat.completions.create(params, requestOptions).withResponse(), {
|
|
140
|
+
maxRetries: options?.maxRetries,
|
|
141
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
142
|
+
signal: options?.signal,
|
|
143
|
+
});
|
|
139
144
|
await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
|
|
140
145
|
stream.push({ type: "start", partial: output });
|
|
141
146
|
let textBlock = null;
|
|
@@ -146,6 +151,21 @@ export const stream = (model, context, options) => {
|
|
|
146
151
|
const pendingReasoningDetailsByToolCallId = new Map();
|
|
147
152
|
const blocks = output.content;
|
|
148
153
|
const getContentIndex = (block) => blocks.indexOf(block);
|
|
154
|
+
const getCustomToolCallInput = (block) => {
|
|
155
|
+
const property = block.customInput?.property;
|
|
156
|
+
if (property === undefined)
|
|
157
|
+
return "";
|
|
158
|
+
const value = block.arguments[property];
|
|
159
|
+
return typeof value === "string" ? value : "";
|
|
160
|
+
};
|
|
161
|
+
const appendCustomToolCallInput = (block, nextInput, close) => {
|
|
162
|
+
const customInput = block.customInput;
|
|
163
|
+
if (!customInput)
|
|
164
|
+
return undefined;
|
|
165
|
+
const delta = appendGrammarToolInputJsonDelta(customInput.jsonBuffer, customInput.property, nextInput, close);
|
|
166
|
+
block.arguments = { [customInput.property]: nextInput };
|
|
167
|
+
return delta;
|
|
168
|
+
};
|
|
149
169
|
const finishBlock = (block) => {
|
|
150
170
|
const contentIndex = getContentIndex(block);
|
|
151
171
|
if (contentIndex === -1) {
|
|
@@ -168,10 +188,24 @@ export const stream = (model, context, options) => {
|
|
|
168
188
|
});
|
|
169
189
|
}
|
|
170
190
|
else if (block.type === "toolCall") {
|
|
171
|
-
|
|
191
|
+
if (block.customInput) {
|
|
192
|
+
const delta = appendCustomToolCallInput(block, getCustomToolCallInput(block), true);
|
|
193
|
+
if (delta !== undefined) {
|
|
194
|
+
stream.push({
|
|
195
|
+
type: "toolcall_delta",
|
|
196
|
+
contentIndex,
|
|
197
|
+
delta,
|
|
198
|
+
partial: output,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
block.arguments = parseStreamingJson(block.partialArgs);
|
|
204
|
+
}
|
|
172
205
|
// Finalize in-place and strip the scratch buffers so replay only
|
|
173
206
|
// carries parsed arguments.
|
|
174
207
|
delete block.partialArgs;
|
|
208
|
+
delete block.customInput;
|
|
175
209
|
delete block.streamIndex;
|
|
176
210
|
stream.push({
|
|
177
211
|
type: "toolcall_end",
|
|
@@ -213,17 +247,27 @@ export const stream = (model, context, options) => {
|
|
|
213
247
|
};
|
|
214
248
|
const ensureToolCallBlock = (toolCall) => {
|
|
215
249
|
const streamIndex = typeof toolCall.index === "number" ? toolCall.index : undefined;
|
|
250
|
+
const name = toolCall.function?.name ?? toolCall.custom?.name ?? "";
|
|
216
251
|
let block = streamIndex !== undefined ? toolCallBlocksByIndex.get(streamIndex) : undefined;
|
|
217
252
|
if (!block && toolCall.id) {
|
|
218
253
|
block = toolCallBlocksById.get(toolCall.id);
|
|
219
254
|
}
|
|
220
255
|
if (!block) {
|
|
256
|
+
// Note: the "input" fallback here should/must not be taken. in case the LLM makes up
|
|
257
|
+
// a tool we don't knwo about, we at least have a place to stash our stuff.
|
|
258
|
+
const customInputProperty = toolCall.custom
|
|
259
|
+
? (grammarToolInputProperties.get(name) ?? "input")
|
|
260
|
+
: undefined;
|
|
261
|
+
const hasCustomInput = customInputProperty !== undefined;
|
|
221
262
|
block = {
|
|
222
263
|
type: "toolCall",
|
|
223
264
|
id: toolCall.id || "",
|
|
224
|
-
name
|
|
225
|
-
arguments: {},
|
|
226
|
-
partialArgs: "",
|
|
265
|
+
name,
|
|
266
|
+
arguments: hasCustomInput ? { [customInputProperty]: "" } : {},
|
|
267
|
+
partialArgs: hasCustomInput ? undefined : "",
|
|
268
|
+
customInput: hasCustomInput
|
|
269
|
+
? { property: customInputProperty, jsonBuffer: { input: "", started: false, closed: false } }
|
|
270
|
+
: undefined,
|
|
227
271
|
streamIndex,
|
|
228
272
|
};
|
|
229
273
|
if (streamIndex !== undefined) {
|
|
@@ -246,6 +290,18 @@ export const stream = (model, context, options) => {
|
|
|
246
290
|
if (toolCall.id) {
|
|
247
291
|
toolCallBlocksById.set(toolCall.id, block);
|
|
248
292
|
}
|
|
293
|
+
if (!block.name && name) {
|
|
294
|
+
block.name = name;
|
|
295
|
+
}
|
|
296
|
+
if (toolCall.custom && !block.customInput) {
|
|
297
|
+
const customInputProperty = grammarToolInputProperties.get(block.name) ?? "input";
|
|
298
|
+
block.arguments = { [customInputProperty]: "" };
|
|
299
|
+
block.customInput = {
|
|
300
|
+
property: customInputProperty,
|
|
301
|
+
jsonBuffer: { input: "", started: false, closed: false },
|
|
302
|
+
};
|
|
303
|
+
delete block.partialArgs;
|
|
304
|
+
}
|
|
249
305
|
applyPendingReasoningDetail(block);
|
|
250
306
|
return block;
|
|
251
307
|
};
|
|
@@ -327,8 +383,9 @@ export const stream = (model, context, options) => {
|
|
|
327
383
|
block.id = toolCall.id;
|
|
328
384
|
toolCallBlocksById.set(toolCall.id, block);
|
|
329
385
|
}
|
|
330
|
-
|
|
331
|
-
|
|
386
|
+
const name = toolCall.function?.name ?? toolCall.custom?.name;
|
|
387
|
+
if (!block.name && name) {
|
|
388
|
+
block.name = name;
|
|
332
389
|
}
|
|
333
390
|
let delta = "";
|
|
334
391
|
if (toolCall.function?.arguments) {
|
|
@@ -336,6 +393,10 @@ export const stream = (model, context, options) => {
|
|
|
336
393
|
block.partialArgs = (block.partialArgs ?? "") + toolCall.function.arguments;
|
|
337
394
|
block.arguments = parseStreamingJson(block.partialArgs);
|
|
338
395
|
}
|
|
396
|
+
else if (toolCall.custom?.input) {
|
|
397
|
+
const nextInput = getCustomToolCallInput(block) + toolCall.custom.input;
|
|
398
|
+
delta = appendCustomToolCallInput(block, nextInput, false) ?? "";
|
|
399
|
+
}
|
|
339
400
|
stream.push({
|
|
340
401
|
type: "toolcall_delta",
|
|
341
402
|
contentIndex: getContentIndex(block),
|
|
@@ -384,6 +445,7 @@ export const stream = (model, context, options) => {
|
|
|
384
445
|
delete block.index;
|
|
385
446
|
// Streaming scratch buffers are only used during parsing; never persist them.
|
|
386
447
|
delete block.partialArgs;
|
|
448
|
+
delete block.customInput;
|
|
387
449
|
delete block.streamIndex;
|
|
388
450
|
}
|
|
389
451
|
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
@@ -447,8 +509,8 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId, compat
|
|
|
447
509
|
defaultHeaders: headers,
|
|
448
510
|
});
|
|
449
511
|
}
|
|
450
|
-
function buildParams(model, context, options, compat = getCompat(model), cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env)) {
|
|
451
|
-
const messages = convertMessages(model, context, compat);
|
|
512
|
+
function buildParams(model, context, options, compat = getCompat(model), cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env), grammarToolInputProperties = createGrammarToolInputProperties(context.tools, compat.supportsOpenAIGrammarTools)) {
|
|
513
|
+
const messages = convertMessages(model, context, compat, { grammarToolInputProperties });
|
|
452
514
|
const cacheControl = getCompatCacheControl(compat, cacheRetention);
|
|
453
515
|
const params = {
|
|
454
516
|
model: model.id,
|
|
@@ -642,7 +704,7 @@ function addCacheControlToSystemPrompt(messages, cacheControl) {
|
|
|
642
704
|
function addCacheControlToLastConversationMessage(messages, cacheControl) {
|
|
643
705
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
644
706
|
const message = messages[i];
|
|
645
|
-
if (message.role === "user" || message.role === "assistant") {
|
|
707
|
+
if (message.role === "user" || message.role === "assistant" || message.role === "tool") {
|
|
646
708
|
if (addCacheControlToMessage(message, cacheControl)) {
|
|
647
709
|
return;
|
|
648
710
|
}
|
|
@@ -660,7 +722,7 @@ function addCacheControlToInstructionMessage(message, cacheControl) {
|
|
|
660
722
|
return addCacheControlToTextContent(message, cacheControl);
|
|
661
723
|
}
|
|
662
724
|
function addCacheControlToMessage(message, cacheControl) {
|
|
663
|
-
if (message.role === "user" || message.role === "assistant") {
|
|
725
|
+
if (message.role === "user" || message.role === "assistant" || message.role === "tool") {
|
|
664
726
|
return addCacheControlToTextContent(message, cacheControl);
|
|
665
727
|
}
|
|
666
728
|
return false;
|
|
@@ -693,7 +755,7 @@ function addCacheControlToTextContent(message, cacheControl) {
|
|
|
693
755
|
}
|
|
694
756
|
return false;
|
|
695
757
|
}
|
|
696
|
-
export function convertMessages(model, context, compat) {
|
|
758
|
+
export function convertMessages(model, context, compat, options) {
|
|
697
759
|
const params = [];
|
|
698
760
|
const normalizeToolCallId = (id) => {
|
|
699
761
|
// Handle pipe-separated IDs from OpenAI Responses API
|
|
@@ -823,14 +885,27 @@ export function convertMessages(model, context, compat) {
|
|
|
823
885
|
}
|
|
824
886
|
const toolCalls = msg.content.filter(isToolCallBlock);
|
|
825
887
|
if (toolCalls.length > 0) {
|
|
826
|
-
assistantMsg.tool_calls = toolCalls.map((tc) =>
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
888
|
+
assistantMsg.tool_calls = toolCalls.map((tc) => {
|
|
889
|
+
const customInputProperty = options?.grammarToolInputProperties?.get(tc.name);
|
|
890
|
+
if (customInputProperty !== undefined) {
|
|
891
|
+
return {
|
|
892
|
+
id: tc.id,
|
|
893
|
+
type: "custom",
|
|
894
|
+
custom: {
|
|
895
|
+
name: tc.name,
|
|
896
|
+
input: sanitizeSurrogates(getGrammarToolInput(tc.name, tc.arguments, customInputProperty)),
|
|
897
|
+
},
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
return {
|
|
901
|
+
id: tc.id,
|
|
902
|
+
type: "function",
|
|
903
|
+
function: {
|
|
904
|
+
name: tc.name,
|
|
905
|
+
arguments: JSON.stringify(tc.arguments),
|
|
906
|
+
},
|
|
907
|
+
};
|
|
908
|
+
});
|
|
834
909
|
const reasoningDetails = toolCalls
|
|
835
910
|
.filter((tc) => tc.thoughtSignature)
|
|
836
911
|
.map((tc) => {
|
|
@@ -948,16 +1023,36 @@ export function convertMessages(model, context, compat) {
|
|
|
948
1023
|
return params;
|
|
949
1024
|
}
|
|
950
1025
|
function convertTools(tools, compat) {
|
|
951
|
-
return tools.map((tool) =>
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1026
|
+
return tools.map((tool) => {
|
|
1027
|
+
const grammar = resolveGrammarConstrainedSampling(tool, compat.supportsOpenAIGrammarTools);
|
|
1028
|
+
if (grammar) {
|
|
1029
|
+
return {
|
|
1030
|
+
type: "custom",
|
|
1031
|
+
custom: {
|
|
1032
|
+
name: tool.name,
|
|
1033
|
+
description: tool.description,
|
|
1034
|
+
format: {
|
|
1035
|
+
type: "grammar",
|
|
1036
|
+
grammar: {
|
|
1037
|
+
syntax: grammar.format,
|
|
1038
|
+
definition: grammar.definition,
|
|
1039
|
+
},
|
|
1040
|
+
},
|
|
1041
|
+
},
|
|
1042
|
+
};
|
|
1043
|
+
}
|
|
1044
|
+
const strict = resolveJsonSchemaStrictSampling(tool, compat.supportsStrictMode !== false);
|
|
1045
|
+
return {
|
|
1046
|
+
type: "function",
|
|
1047
|
+
function: {
|
|
1048
|
+
name: tool.name,
|
|
1049
|
+
description: tool.description,
|
|
1050
|
+
parameters: tool.parameters, // TypeBox already generates JSON Schema
|
|
1051
|
+
// Only include strict if provider supports it. Some reject unknown fields.
|
|
1052
|
+
...(compat.supportsStrictMode !== false && { strict: strict ?? false }),
|
|
1053
|
+
},
|
|
1054
|
+
};
|
|
1055
|
+
});
|
|
961
1056
|
}
|
|
962
1057
|
function parseChunkUsage(rawUsage, model) {
|
|
963
1058
|
const promptTokens = rawUsage.prompt_tokens || 0;
|
|
@@ -1074,6 +1169,7 @@ function detectCompat(model) {
|
|
|
1074
1169
|
chatTemplateKwargs: {},
|
|
1075
1170
|
zaiToolStream: false,
|
|
1076
1171
|
supportsStrictMode: !isMoonshot && !isTogether && !isCloudflareAiGateway && !isNvidia,
|
|
1172
|
+
supportsOpenAIGrammarTools: false,
|
|
1077
1173
|
cacheControlFormat,
|
|
1078
1174
|
sendSessionAffinityHeaders: false,
|
|
1079
1175
|
deferredToolsMode: undefined,
|
|
@@ -1110,6 +1206,7 @@ function getCompat(model) {
|
|
|
1110
1206
|
chatTemplateKwargs: model.compat.chatTemplateKwargs ?? detected.chatTemplateKwargs,
|
|
1111
1207
|
zaiToolStream: model.compat.zaiToolStream ?? detected.zaiToolStream,
|
|
1112
1208
|
supportsStrictMode: model.compat.supportsStrictMode ?? detected.supportsStrictMode,
|
|
1209
|
+
supportsOpenAIGrammarTools: model.compat.supportsOpenAIGrammarTools ?? detected.supportsOpenAIGrammarTools,
|
|
1113
1210
|
cacheControlFormat: model.compat.cacheControlFormat ?? detected.cacheControlFormat,
|
|
1114
1211
|
sendSessionAffinityHeaders: model.compat.sendSessionAffinityHeaders ?? detected.sendSessionAffinityHeaders,
|
|
1115
1212
|
deferredToolsMode: model.compat.deferredToolsMode ?? detected.deferredToolsMode,
|
|
@@ -2,6 +2,7 @@ import { calculateCost } from "../models.js";
|
|
|
2
2
|
import { shortHash } from "../utils/hash.js";
|
|
3
3
|
import { parseStreamingJson } from "../utils/json-parse.js";
|
|
4
4
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
5
|
+
import { appendGrammarToolInputJsonDelta, getGrammarToolInput, resolveGrammarConstrainedSampling, resolveJsonSchemaStrictSampling, } from "./constrained-sampling.js";
|
|
5
6
|
import { transformMessages } from "./transform-messages.js";
|
|
6
7
|
// =============================================================================
|
|
7
8
|
// Utilities
|
|
@@ -31,6 +32,29 @@ function parseTextSignature(signature) {
|
|
|
31
32
|
}
|
|
32
33
|
return { id: signature };
|
|
33
34
|
}
|
|
35
|
+
function convertToolResultOutput(model, content) {
|
|
36
|
+
const textResult = content
|
|
37
|
+
.filter((c) => c.type === "text")
|
|
38
|
+
.map((c) => c.text)
|
|
39
|
+
.join("\n");
|
|
40
|
+
const images = content.filter((c) => c.type === "image");
|
|
41
|
+
const hasText = textResult.length > 0;
|
|
42
|
+
if (images.length === 0 || !model.input.includes("image")) {
|
|
43
|
+
return sanitizeSurrogates(hasText ? textResult : images.length > 0 ? "(see attached image)" : "(no tool output)");
|
|
44
|
+
}
|
|
45
|
+
const output = [];
|
|
46
|
+
if (hasText) {
|
|
47
|
+
output.push({ type: "input_text", text: sanitizeSurrogates(textResult) });
|
|
48
|
+
}
|
|
49
|
+
for (const image of images) {
|
|
50
|
+
output.push({
|
|
51
|
+
type: "input_image",
|
|
52
|
+
detail: "auto",
|
|
53
|
+
image_url: `data:${image.mimeType};base64,${image.data}`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return output;
|
|
57
|
+
}
|
|
34
58
|
// =============================================================================
|
|
35
59
|
// Message conversion
|
|
36
60
|
// =============================================================================
|
|
@@ -141,20 +165,35 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider
|
|
|
141
165
|
else if (block.type === "toolCall") {
|
|
142
166
|
const toolCall = block;
|
|
143
167
|
const [callId, itemIdRaw] = toolCall.id.split("|");
|
|
168
|
+
const customInputProperty = options?.grammarToolInputProperties?.get(toolCall.name);
|
|
144
169
|
let itemId = itemIdRaw;
|
|
145
170
|
// For different-model messages, set id to undefined to avoid pairing validation.
|
|
146
171
|
// OpenAI tracks which fc_xxx IDs were paired with rs_xxx reasoning items.
|
|
147
172
|
// By omitting the id, we avoid triggering that validation (like cross-provider does).
|
|
148
|
-
|
|
173
|
+
// When replaying custom-tool calls as a function_call, also drop non-fc_* ids such as
|
|
174
|
+
// ctc_* custom-tool ids because function_call item ids must be fc_*.
|
|
175
|
+
if ((isDifferentModel && itemId?.startsWith("fc_")) ||
|
|
176
|
+
(customInputProperty === undefined && !itemId?.startsWith("fc_"))) {
|
|
149
177
|
itemId = undefined;
|
|
150
178
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
179
|
+
if (customInputProperty !== undefined) {
|
|
180
|
+
output.push({
|
|
181
|
+
type: "custom_tool_call",
|
|
182
|
+
id: itemId,
|
|
183
|
+
call_id: callId,
|
|
184
|
+
name: toolCall.name,
|
|
185
|
+
input: sanitizeSurrogates(getGrammarToolInput(toolCall.name, toolCall.arguments, customInputProperty)),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
output.push({
|
|
190
|
+
type: "function_call",
|
|
191
|
+
id: itemId,
|
|
192
|
+
call_id: callId,
|
|
193
|
+
name: toolCall.name,
|
|
194
|
+
arguments: JSON.stringify(toolCall.arguments),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
158
197
|
}
|
|
159
198
|
}
|
|
160
199
|
if (output.length === 0)
|
|
@@ -162,41 +201,22 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider
|
|
|
162
201
|
messages.push(...output);
|
|
163
202
|
}
|
|
164
203
|
else if (msg.role === "toolResult") {
|
|
165
|
-
const textResult = msg.content
|
|
166
|
-
.filter((c) => c.type === "text")
|
|
167
|
-
.map((c) => c.text)
|
|
168
|
-
.join("\n");
|
|
169
|
-
const hasImages = msg.content.some((c) => c.type === "image");
|
|
170
|
-
const hasText = textResult.length > 0;
|
|
171
204
|
const [callId] = msg.toolCallId.split("|");
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
for (const block of msg.content) {
|
|
182
|
-
if (block.type === "image") {
|
|
183
|
-
contentParts.push({
|
|
184
|
-
type: "input_image",
|
|
185
|
-
detail: "auto",
|
|
186
|
-
image_url: `data:${block.mimeType};base64,${block.data}`,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
output = contentParts;
|
|
205
|
+
const output = convertToolResultOutput(model, msg.content);
|
|
206
|
+
if (options?.grammarToolInputProperties?.has(msg.toolName)) {
|
|
207
|
+
messages.push({
|
|
208
|
+
type: "custom_tool_call_output",
|
|
209
|
+
call_id: callId,
|
|
210
|
+
output,
|
|
211
|
+
});
|
|
191
212
|
}
|
|
192
213
|
else {
|
|
193
|
-
|
|
214
|
+
messages.push({
|
|
215
|
+
type: "function_call_output",
|
|
216
|
+
call_id: callId,
|
|
217
|
+
output,
|
|
218
|
+
});
|
|
194
219
|
}
|
|
195
|
-
messages.push({
|
|
196
|
-
type: "function_call_output",
|
|
197
|
-
call_id: callId,
|
|
198
|
-
output,
|
|
199
|
-
});
|
|
200
220
|
const deferredTools = [];
|
|
201
221
|
for (const name of msg.addedToolNames ?? []) {
|
|
202
222
|
const tool = options?.deferredTools?.get(name);
|
|
@@ -220,7 +240,10 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider
|
|
|
220
240
|
call_id: searchCallId,
|
|
221
241
|
execution: "client",
|
|
222
242
|
status: "completed",
|
|
223
|
-
tools: convertResponsesTools(deferredTools, {
|
|
243
|
+
tools: convertResponsesTools(deferredTools, {
|
|
244
|
+
...options?.toolOptions,
|
|
245
|
+
deferLoading: true,
|
|
246
|
+
}),
|
|
224
247
|
});
|
|
225
248
|
}
|
|
226
249
|
}
|
|
@@ -232,15 +255,52 @@ export function convertResponsesMessages(model, context, allowedToolCallProvider
|
|
|
232
255
|
// Tool conversion
|
|
233
256
|
// =============================================================================
|
|
234
257
|
export function convertResponsesTools(tools, options) {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
258
|
+
const defaultStrict = options?.strict === undefined ? false : options.strict;
|
|
259
|
+
const supportsStrictMode = options?.supportsStrictMode ?? true;
|
|
260
|
+
const supportsOpenAIGrammarTools = options?.supportsOpenAIGrammarTools ?? false;
|
|
261
|
+
return tools.map((tool) => {
|
|
262
|
+
const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
|
|
263
|
+
if (grammar) {
|
|
264
|
+
return {
|
|
265
|
+
type: "custom",
|
|
266
|
+
name: tool.name,
|
|
267
|
+
description: tool.description,
|
|
268
|
+
format: {
|
|
269
|
+
type: "grammar",
|
|
270
|
+
syntax: grammar.format,
|
|
271
|
+
definition: grammar.definition,
|
|
272
|
+
},
|
|
273
|
+
...(options?.deferLoading ? { defer_loading: true } : {}),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
const constrainedStrict = resolveJsonSchemaStrictSampling(tool, supportsStrictMode);
|
|
277
|
+
const functionTool = {
|
|
278
|
+
type: "function",
|
|
279
|
+
name: tool.name,
|
|
280
|
+
description: tool.description,
|
|
281
|
+
parameters: tool.parameters, // TypeBox already generates JSON Schema
|
|
282
|
+
...(options?.deferLoading ? { defer_loading: true } : {}),
|
|
283
|
+
};
|
|
284
|
+
if (supportsStrictMode) {
|
|
285
|
+
functionTool.strict = constrainedStrict ?? defaultStrict;
|
|
286
|
+
}
|
|
287
|
+
return functionTool;
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function getCustomToolCallInput(block) {
|
|
291
|
+
const property = block.customInput?.property;
|
|
292
|
+
if (property === undefined)
|
|
293
|
+
return "";
|
|
294
|
+
const value = block.arguments[property];
|
|
295
|
+
return typeof value === "string" ? value : "";
|
|
296
|
+
}
|
|
297
|
+
function appendCustomToolCallInput(block, nextInput, close) {
|
|
298
|
+
const customInput = block.customInput;
|
|
299
|
+
if (!customInput)
|
|
300
|
+
return undefined;
|
|
301
|
+
const delta = appendGrammarToolInputJsonDelta(customInput.jsonBuffer, customInput.property, nextInput, close);
|
|
302
|
+
block.arguments = { [customInput.property]: nextInput };
|
|
303
|
+
return delta;
|
|
244
304
|
}
|
|
245
305
|
export async function processResponsesStream(openaiStream, output, stream, model, options) {
|
|
246
306
|
let sawTerminalResponseEvent = false;
|
|
@@ -250,6 +310,16 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
|
|
250
310
|
const slot = outputSlots.get(outputIndex);
|
|
251
311
|
return slot?.type === type ? slot : undefined;
|
|
252
312
|
};
|
|
313
|
+
const pushToolCallDelta = (slot, delta) => {
|
|
314
|
+
if (delta === undefined)
|
|
315
|
+
return;
|
|
316
|
+
stream.push({
|
|
317
|
+
type: "toolcall_delta",
|
|
318
|
+
contentIndex: slot.contentIndex,
|
|
319
|
+
delta,
|
|
320
|
+
partial: output,
|
|
321
|
+
});
|
|
322
|
+
};
|
|
253
323
|
const createSlot = (outputIndex, item) => {
|
|
254
324
|
if (item.type === "reasoning") {
|
|
255
325
|
const block = { type: "thinking", thinking: "" };
|
|
@@ -289,6 +359,29 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
|
|
289
359
|
stream.push({ type: "toolcall_start", contentIndex: slot.contentIndex, partial: output });
|
|
290
360
|
return slot;
|
|
291
361
|
}
|
|
362
|
+
if (item.type === "custom_tool_call") {
|
|
363
|
+
const inputProperty = options?.grammarToolInputProperties?.get(item.name) ?? "input";
|
|
364
|
+
const input = item.input || "";
|
|
365
|
+
const block = {
|
|
366
|
+
type: "toolCall",
|
|
367
|
+
id: `${item.call_id}|${item.id}`,
|
|
368
|
+
name: item.name,
|
|
369
|
+
arguments: { [inputProperty]: input },
|
|
370
|
+
customInput: {
|
|
371
|
+
property: inputProperty,
|
|
372
|
+
jsonBuffer: { input: "", started: false, closed: false },
|
|
373
|
+
},
|
|
374
|
+
};
|
|
375
|
+
output.content.push(block);
|
|
376
|
+
const slot = {
|
|
377
|
+
type: "toolCall",
|
|
378
|
+
block,
|
|
379
|
+
contentIndex: output.content.length - 1,
|
|
380
|
+
};
|
|
381
|
+
outputSlots.set(outputIndex, slot);
|
|
382
|
+
stream.push({ type: "toolcall_start", contentIndex: slot.contentIndex, partial: output });
|
|
383
|
+
return slot;
|
|
384
|
+
}
|
|
292
385
|
return undefined;
|
|
293
386
|
};
|
|
294
387
|
const getOrCreateSlot = (outputIndex, item) => {
|
|
@@ -417,36 +510,37 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
|
|
417
510
|
}
|
|
418
511
|
else if (event.type === "response.function_call_arguments.delta") {
|
|
419
512
|
const slot = getSlot(event.output_index, "toolCall");
|
|
420
|
-
if (!slot)
|
|
513
|
+
if (!slot || slot.block.partialJson === undefined)
|
|
421
514
|
continue;
|
|
422
515
|
slot.block.partialJson += event.delta;
|
|
423
516
|
slot.block.arguments = parseStreamingJson(slot.block.partialJson);
|
|
424
|
-
|
|
425
|
-
type: "toolcall_delta",
|
|
426
|
-
contentIndex: slot.contentIndex,
|
|
427
|
-
delta: event.delta,
|
|
428
|
-
partial: output,
|
|
429
|
-
});
|
|
517
|
+
pushToolCallDelta(slot, event.delta);
|
|
430
518
|
}
|
|
431
519
|
else if (event.type === "response.function_call_arguments.done") {
|
|
432
520
|
const slot = getSlot(event.output_index, "toolCall");
|
|
433
|
-
if (!slot)
|
|
521
|
+
if (!slot || slot.block.partialJson === undefined)
|
|
434
522
|
continue;
|
|
435
523
|
const previousPartialJson = slot.block.partialJson;
|
|
436
524
|
slot.block.partialJson = event.arguments;
|
|
437
525
|
slot.block.arguments = parseStreamingJson(slot.block.partialJson);
|
|
438
526
|
if (event.arguments.startsWith(previousPartialJson)) {
|
|
439
527
|
const delta = event.arguments.slice(previousPartialJson.length);
|
|
440
|
-
if (delta.length > 0)
|
|
441
|
-
|
|
442
|
-
type: "toolcall_delta",
|
|
443
|
-
contentIndex: slot.contentIndex,
|
|
444
|
-
delta,
|
|
445
|
-
partial: output,
|
|
446
|
-
});
|
|
447
|
-
}
|
|
528
|
+
if (delta.length > 0)
|
|
529
|
+
pushToolCallDelta(slot, delta);
|
|
448
530
|
}
|
|
449
531
|
}
|
|
532
|
+
else if (event.type === "response.custom_tool_call_input.delta") {
|
|
533
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
534
|
+
if (!slot || !slot.block.customInput)
|
|
535
|
+
continue;
|
|
536
|
+
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, getCustomToolCallInput(slot.block) + event.delta, false));
|
|
537
|
+
}
|
|
538
|
+
else if (event.type === "response.custom_tool_call_input.done") {
|
|
539
|
+
const slot = getSlot(event.output_index, "toolCall");
|
|
540
|
+
if (!slot || !slot.block.customInput)
|
|
541
|
+
continue;
|
|
542
|
+
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, event.input, true));
|
|
543
|
+
}
|
|
450
544
|
else if (event.type === "response.output_item.done") {
|
|
451
545
|
const item = event.item;
|
|
452
546
|
const slot = getOrCreateSlot(event.output_index, item);
|
|
@@ -475,7 +569,9 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
|
|
475
569
|
});
|
|
476
570
|
outputSlots.delete(event.output_index);
|
|
477
571
|
}
|
|
478
|
-
else if (item.type === "function_call" &&
|
|
572
|
+
else if (item.type === "function_call" &&
|
|
573
|
+
slot?.type === "toolCall" &&
|
|
574
|
+
slot.block.partialJson !== undefined) {
|
|
479
575
|
slot.block.arguments = parseStreamingJson(item.arguments || slot.block.partialJson || "{}");
|
|
480
576
|
// Finalize in-place and strip the scratch buffer so replay only
|
|
481
577
|
// carries parsed arguments.
|
|
@@ -488,6 +584,17 @@ export async function processResponsesStream(openaiStream, output, stream, model
|
|
|
488
584
|
});
|
|
489
585
|
outputSlots.delete(event.output_index);
|
|
490
586
|
}
|
|
587
|
+
else if (item.type === "custom_tool_call" && slot?.type === "toolCall" && slot.block.customInput) {
|
|
588
|
+
pushToolCallDelta(slot, appendCustomToolCallInput(slot.block, item.input ?? getCustomToolCallInput(slot.block), true));
|
|
589
|
+
delete slot.block.customInput;
|
|
590
|
+
stream.push({
|
|
591
|
+
type: "toolcall_end",
|
|
592
|
+
contentIndex: slot.contentIndex,
|
|
593
|
+
toolCall: slot.block,
|
|
594
|
+
partial: output,
|
|
595
|
+
});
|
|
596
|
+
outputSlots.delete(event.output_index);
|
|
597
|
+
}
|
|
491
598
|
}
|
|
492
599
|
else if (event.type === "response.completed" || event.type === "response.incomplete") {
|
|
493
600
|
finalizeResponse(event.response);
|