@psnext/slingcli 2.5.20260723-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 +3 -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/cbor/index.js +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/cbor/cbor-decode.js +1 -1
- 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/brace-expansion/README.md +12 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +2 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/brace-expansion/dist/commonjs/index.js +138 -86
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.d.ts +2 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.js +137 -85
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
- package/node_modules/brace-expansion/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
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
2
|
+
export function detectSupportedImageMimeType(buffer) {
|
|
3
|
+
if (startsWith(buffer, [0xff, 0xd8, 0xff]))
|
|
4
|
+
return buffer[3] === 0xf7 ? undefined : "image/jpeg";
|
|
5
|
+
if (startsWith(buffer, PNG_SIGNATURE))
|
|
6
|
+
return isPng(buffer) && !isAnimatedPng(buffer) ? "image/png" : undefined;
|
|
7
|
+
if (startsWithAscii(buffer, 0, "GIF"))
|
|
8
|
+
return "image/gif";
|
|
9
|
+
if (startsWithAscii(buffer, 0, "RIFF") && startsWithAscii(buffer, 8, "WEBP"))
|
|
10
|
+
return "image/webp";
|
|
11
|
+
if (startsWithAscii(buffer, 0, "BM") && isBmp(buffer))
|
|
12
|
+
return "image/bmp";
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
export function encodeBase64(bytes) {
|
|
16
|
+
const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
17
|
+
let output = "";
|
|
18
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
19
|
+
const first = bytes[index] ?? 0;
|
|
20
|
+
const second = bytes[index + 1];
|
|
21
|
+
const third = bytes[index + 2];
|
|
22
|
+
output += alphabet[first >> 2];
|
|
23
|
+
output += alphabet[((first & 0x03) << 4) | ((second ?? 0) >> 4)];
|
|
24
|
+
output += second === undefined ? "=" : alphabet[((second & 0x0f) << 2) | ((third ?? 0) >> 6)];
|
|
25
|
+
output += third === undefined ? "=" : alphabet[third & 0x3f];
|
|
26
|
+
}
|
|
27
|
+
return output;
|
|
28
|
+
}
|
|
29
|
+
function isPng(buffer) {
|
|
30
|
+
return (buffer.length >= 16 && readUint32BE(buffer, PNG_SIGNATURE.length) === 13 && startsWithAscii(buffer, 12, "IHDR"));
|
|
31
|
+
}
|
|
32
|
+
function isAnimatedPng(buffer) {
|
|
33
|
+
let offset = PNG_SIGNATURE.length;
|
|
34
|
+
while (offset + 8 <= buffer.length) {
|
|
35
|
+
const chunkLength = readUint32BE(buffer, offset);
|
|
36
|
+
const chunkTypeOffset = offset + 4;
|
|
37
|
+
if (startsWithAscii(buffer, chunkTypeOffset, "acTL"))
|
|
38
|
+
return true;
|
|
39
|
+
if (startsWithAscii(buffer, chunkTypeOffset, "IDAT"))
|
|
40
|
+
return false;
|
|
41
|
+
const nextOffset = offset + 8 + chunkLength + 4;
|
|
42
|
+
if (nextOffset <= offset || nextOffset > buffer.length)
|
|
43
|
+
return false;
|
|
44
|
+
offset = nextOffset;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
function isBmp(buffer) {
|
|
49
|
+
if (buffer.length < 26)
|
|
50
|
+
return false;
|
|
51
|
+
const declaredFileSize = readUint32LE(buffer, 2);
|
|
52
|
+
const pixelDataOffset = readUint32LE(buffer, 10);
|
|
53
|
+
const dibHeaderSize = readUint32LE(buffer, 14);
|
|
54
|
+
if (declaredFileSize !== 0 && declaredFileSize < 26)
|
|
55
|
+
return false;
|
|
56
|
+
if (pixelDataOffset < 14 + dibHeaderSize)
|
|
57
|
+
return false;
|
|
58
|
+
if (declaredFileSize !== 0 && pixelDataOffset >= declaredFileSize)
|
|
59
|
+
return false;
|
|
60
|
+
let colorPlanes;
|
|
61
|
+
let bitsPerPixel;
|
|
62
|
+
if (dibHeaderSize === 12) {
|
|
63
|
+
colorPlanes = readUint16LE(buffer, 22);
|
|
64
|
+
bitsPerPixel = readUint16LE(buffer, 24);
|
|
65
|
+
}
|
|
66
|
+
else if (dibHeaderSize >= 40 && dibHeaderSize <= 124) {
|
|
67
|
+
if (buffer.length < 30)
|
|
68
|
+
return false;
|
|
69
|
+
colorPlanes = readUint16LE(buffer, 26);
|
|
70
|
+
bitsPerPixel = readUint16LE(buffer, 28);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
return colorPlanes === 1 && [1, 4, 8, 16, 24, 32].includes(bitsPerPixel);
|
|
76
|
+
}
|
|
77
|
+
function readUint16LE(buffer, offset) {
|
|
78
|
+
return (buffer[offset] ?? 0) + ((buffer[offset + 1] ?? 0) << 8);
|
|
79
|
+
}
|
|
80
|
+
function readUint32BE(buffer, offset) {
|
|
81
|
+
return ((buffer[offset] ?? 0) * 0x1000000 +
|
|
82
|
+
((buffer[offset + 1] ?? 0) << 16) +
|
|
83
|
+
((buffer[offset + 2] ?? 0) << 8) +
|
|
84
|
+
(buffer[offset + 3] ?? 0));
|
|
85
|
+
}
|
|
86
|
+
function readUint32LE(buffer, offset) {
|
|
87
|
+
return ((buffer[offset] ?? 0) +
|
|
88
|
+
((buffer[offset + 1] ?? 0) << 8) +
|
|
89
|
+
((buffer[offset + 2] ?? 0) << 16) +
|
|
90
|
+
(buffer[offset + 3] ?? 0) * 0x1000000);
|
|
91
|
+
}
|
|
92
|
+
function startsWith(buffer, bytes) {
|
|
93
|
+
if (buffer.length < bytes.length)
|
|
94
|
+
return false;
|
|
95
|
+
return bytes.every((byte, index) => buffer[index] === byte);
|
|
96
|
+
}
|
|
97
|
+
function startsWithAscii(buffer, offset, text) {
|
|
98
|
+
if (buffer.length < offset + text.length)
|
|
99
|
+
return false;
|
|
100
|
+
for (let index = 0; index < text.length; index++) {
|
|
101
|
+
if (buffer[offset + index] !== text.charCodeAt(index))
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getOrThrow } from "../types.js";
|
|
2
|
+
const UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
|
|
3
|
+
const NARROW_NO_BREAK_SPACE = "\u202F";
|
|
4
|
+
function normalizeToolPath(path) {
|
|
5
|
+
const normalized = path.replace(UNICODE_SPACES, " ");
|
|
6
|
+
return normalized.startsWith("@") ? normalized.slice(1) : normalized;
|
|
7
|
+
}
|
|
8
|
+
export async function resolveToolPath(env, path, signal) {
|
|
9
|
+
return getOrThrow(await env.absolutePath(normalizeToolPath(path), signal));
|
|
10
|
+
}
|
|
11
|
+
export async function resolveReadToolPath(env, path, signal) {
|
|
12
|
+
const resolved = await resolveToolPath(env, path, signal);
|
|
13
|
+
const variants = [
|
|
14
|
+
resolved,
|
|
15
|
+
resolved.replace(/ (AM|PM)\./gi, `${NARROW_NO_BREAK_SPACE}$1.`),
|
|
16
|
+
resolved.normalize("NFD"),
|
|
17
|
+
resolved.replace(/'/g, "\u2019"),
|
|
18
|
+
resolved.normalize("NFD").replace(/'/g, "\u2019"),
|
|
19
|
+
];
|
|
20
|
+
for (const variant of new Set(variants)) {
|
|
21
|
+
if (getOrThrow(await env.exists(variant, signal)))
|
|
22
|
+
return variant;
|
|
23
|
+
}
|
|
24
|
+
return resolved;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=path-utils.js.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import { getOrThrow } from "../types.js";
|
|
3
|
+
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, } from "../utils/truncate.js";
|
|
4
|
+
import { detectSupportedImageMimeType, encodeBase64 } from "./image.js";
|
|
5
|
+
import { resolveReadToolPath } from "./path-utils.js";
|
|
6
|
+
const readSchema = Type.Object({
|
|
7
|
+
path: Type.String({ description: "Path to the file to read (relative or absolute)" }),
|
|
8
|
+
offset: Type.Optional(Type.Number({ description: "Line number to start reading from (1-indexed)" })),
|
|
9
|
+
limit: Type.Optional(Type.Number({ description: "Maximum number of lines to read" })),
|
|
10
|
+
});
|
|
11
|
+
export function createReadTool(options) {
|
|
12
|
+
return {
|
|
13
|
+
name: "read",
|
|
14
|
+
label: "read",
|
|
15
|
+
description: `Read the contents of a file. Supports text files and images (jpg, png, gif, webp, bmp). Images are sent as attachments. For text files, output is truncated to ${DEFAULT_MAX_LINES} lines or ${DEFAULT_MAX_BYTES / 1024}KB (whichever is hit first). Use offset/limit for large files. When you need the full file, continue with offset until complete.`,
|
|
16
|
+
parameters: readSchema,
|
|
17
|
+
async execute(_toolCallId, { path, offset, limit }, signal, _onUpdate, { env }) {
|
|
18
|
+
const absolutePath = await resolveReadToolPath(env, path, signal);
|
|
19
|
+
const bytes = getOrThrow(await env.readBinaryFile(absolutePath, signal));
|
|
20
|
+
const mimeType = detectSupportedImageMimeType(bytes);
|
|
21
|
+
if (mimeType) {
|
|
22
|
+
if (options?.imageProcessor) {
|
|
23
|
+
const processed = await options.imageProcessor(bytes, mimeType, {
|
|
24
|
+
autoResizeImages: options.autoResizeImages ?? true,
|
|
25
|
+
});
|
|
26
|
+
if (!processed.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: `Read image file [${mimeType}]\n${processed.message}` }],
|
|
29
|
+
details: undefined,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const hints = processed.hints.length > 0 ? `\n${processed.hints.join("\n")}` : "";
|
|
33
|
+
return {
|
|
34
|
+
content: [
|
|
35
|
+
{ type: "text", text: `Read image file [${processed.mimeType}]${hints}` },
|
|
36
|
+
{ type: "image", data: processed.data, mimeType: processed.mimeType },
|
|
37
|
+
],
|
|
38
|
+
details: undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (mimeType === "image/bmp") {
|
|
42
|
+
return {
|
|
43
|
+
content: [
|
|
44
|
+
{
|
|
45
|
+
type: "text",
|
|
46
|
+
text: "Read image file [image/bmp]\n[Image omitted: configure an imageProcessor to convert BMP images.]",
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
details: undefined,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{ type: "text", text: `Read image file [${mimeType}]` },
|
|
55
|
+
{ type: "image", data: encodeBase64(bytes), mimeType },
|
|
56
|
+
],
|
|
57
|
+
details: undefined,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const textContent = new TextDecoder().decode(bytes);
|
|
61
|
+
const allLines = textContent.split("\n");
|
|
62
|
+
const totalFileLines = allLines.length;
|
|
63
|
+
const startLine = offset ? Math.max(0, offset - 1) : 0;
|
|
64
|
+
const startLineDisplay = startLine + 1;
|
|
65
|
+
if (startLine >= allLines.length) {
|
|
66
|
+
throw new Error(`Offset ${offset} is beyond end of file (${allLines.length} lines total)`);
|
|
67
|
+
}
|
|
68
|
+
let selectedContent;
|
|
69
|
+
let userLimitedLines;
|
|
70
|
+
if (limit !== undefined) {
|
|
71
|
+
const endLine = Math.min(startLine + limit, allLines.length);
|
|
72
|
+
selectedContent = allLines.slice(startLine, endLine).join("\n");
|
|
73
|
+
userLimitedLines = endLine - startLine;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
selectedContent = allLines.slice(startLine).join("\n");
|
|
77
|
+
}
|
|
78
|
+
const truncation = truncateHead(selectedContent);
|
|
79
|
+
let outputText;
|
|
80
|
+
let details;
|
|
81
|
+
if (truncation.firstLineExceedsLimit) {
|
|
82
|
+
const firstLineSize = formatSize(new TextEncoder().encode(allLines[startLine]).byteLength);
|
|
83
|
+
outputText = `[Line ${startLineDisplay} is ${firstLineSize}, exceeds ${formatSize(DEFAULT_MAX_BYTES)} limit. Use bash: sed -n '${startLineDisplay}p' ${path} | head -c ${DEFAULT_MAX_BYTES}]`;
|
|
84
|
+
details = { truncation };
|
|
85
|
+
}
|
|
86
|
+
else if (truncation.truncated) {
|
|
87
|
+
const endLineDisplay = startLineDisplay + truncation.outputLines - 1;
|
|
88
|
+
const nextOffset = endLineDisplay + 1;
|
|
89
|
+
outputText = truncation.content;
|
|
90
|
+
if (truncation.truncatedBy === "lines") {
|
|
91
|
+
outputText += `\n\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines}. Use offset=${nextOffset} to continue.]`;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
outputText += `\n\n[Showing lines ${startLineDisplay}-${endLineDisplay} of ${totalFileLines} (${formatSize(DEFAULT_MAX_BYTES)} limit). Use offset=${nextOffset} to continue.]`;
|
|
95
|
+
}
|
|
96
|
+
details = { truncation };
|
|
97
|
+
}
|
|
98
|
+
else if (userLimitedLines !== undefined && startLine + userLimitedLines < allLines.length) {
|
|
99
|
+
const remaining = allLines.length - (startLine + userLimitedLines);
|
|
100
|
+
const nextOffset = startLine + userLimitedLines + 1;
|
|
101
|
+
outputText = `${truncation.content}\n\n[${remaining} more lines in file. Use offset=${nextOffset} to continue.]`;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
outputText = truncation.content;
|
|
105
|
+
}
|
|
106
|
+
return { content: [{ type: "text", text: outputText }], details };
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=read.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
import { getOrThrow } from "../types.js";
|
|
3
|
+
import { withFileMutationQueue } from "./file-mutation-queue.js";
|
|
4
|
+
import { resolveToolPath } from "./path-utils.js";
|
|
5
|
+
const writeSchema = Type.Object({
|
|
6
|
+
path: Type.String({ description: "Path to the file to write (relative or absolute)" }),
|
|
7
|
+
content: Type.String({ description: "Content to write to the file" }),
|
|
8
|
+
});
|
|
9
|
+
export function createWriteTool() {
|
|
10
|
+
return {
|
|
11
|
+
name: "write",
|
|
12
|
+
label: "write",
|
|
13
|
+
description: "Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",
|
|
14
|
+
parameters: writeSchema,
|
|
15
|
+
async execute(_toolCallId, { path, content }, signal, _onUpdate, { env }) {
|
|
16
|
+
const absolutePath = await resolveToolPath(env, path, signal);
|
|
17
|
+
return withFileMutationQueue(env, absolutePath, async () => {
|
|
18
|
+
if (signal?.aborted)
|
|
19
|
+
throw new Error("Operation aborted");
|
|
20
|
+
getOrThrow(await env.writeFile(absolutePath, content, signal));
|
|
21
|
+
if (signal?.aborted)
|
|
22
|
+
throw new Error("Operation aborted");
|
|
23
|
+
return {
|
|
24
|
+
content: [{ type: "text", text: `Successfully wrote ${content.length} bytes to ${path}` }],
|
|
25
|
+
details: undefined,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ExecutionError, err, ok, toError } from "../types.js";
|
|
2
|
-
import { DEFAULT_MAX_BYTES, truncateTail } from "./truncate.js";
|
|
2
|
+
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, truncateTail } from "./truncate.js";
|
|
3
3
|
function toExecutionError(error) {
|
|
4
4
|
if (error instanceof ExecutionError)
|
|
5
5
|
return error;
|
|
@@ -22,61 +22,104 @@ export function sanitizeBinaryOutput(str) {
|
|
|
22
22
|
})
|
|
23
23
|
.join("");
|
|
24
24
|
}
|
|
25
|
+
function trimToLastUtf8Bytes(text, maxBytes, encoder) {
|
|
26
|
+
const bytes = encoder.encode(text);
|
|
27
|
+
if (bytes.byteLength <= maxBytes)
|
|
28
|
+
return text;
|
|
29
|
+
let start = bytes.byteLength - maxBytes;
|
|
30
|
+
while (start < bytes.byteLength && ((bytes[start] ?? 0) & 0xc0) === 0x80)
|
|
31
|
+
start++;
|
|
32
|
+
return new TextDecoder().decode(bytes.subarray(start));
|
|
33
|
+
}
|
|
25
34
|
export async function executeShellWithCapture(env, command, options) {
|
|
26
|
-
|
|
27
|
-
let outputBytes = 0;
|
|
35
|
+
let tailOutput = "";
|
|
28
36
|
const maxOutputBytes = DEFAULT_MAX_BYTES * 2;
|
|
29
37
|
const encoder = new TextEncoder();
|
|
30
38
|
let totalBytes = 0;
|
|
39
|
+
let completedLines = 0;
|
|
40
|
+
let hasOpenLine = false;
|
|
41
|
+
let currentLineBytes = 0;
|
|
31
42
|
let fullOutputPath;
|
|
43
|
+
let fullOutputRequested = false;
|
|
44
|
+
let acceptingOutput = true;
|
|
32
45
|
let writeChain = Promise.resolve(ok(undefined));
|
|
33
46
|
let captureError;
|
|
34
47
|
const appendFullOutput = (text) => {
|
|
35
|
-
if (!
|
|
48
|
+
if (!fullOutputRequested || captureError)
|
|
36
49
|
return;
|
|
37
|
-
const path = fullOutputPath;
|
|
38
50
|
writeChain = writeChain.then(async (previous) => {
|
|
39
51
|
if (!previous.ok)
|
|
40
52
|
return previous;
|
|
41
|
-
|
|
53
|
+
if (!fullOutputPath)
|
|
54
|
+
return err(new ExecutionError("unknown", "Full output path was not created"));
|
|
55
|
+
const appendResult = await env.appendFile(fullOutputPath, text);
|
|
42
56
|
return appendResult.ok ? ok(undefined) : err(toExecutionError(appendResult.error));
|
|
43
57
|
});
|
|
44
58
|
};
|
|
45
59
|
const ensureFullOutputFile = (initialContent) => {
|
|
46
|
-
if (
|
|
60
|
+
if (fullOutputRequested || captureError)
|
|
47
61
|
return;
|
|
62
|
+
fullOutputRequested = true;
|
|
48
63
|
writeChain = writeChain.then(async (previous) => {
|
|
49
64
|
if (!previous.ok)
|
|
50
65
|
return previous;
|
|
51
|
-
const tempFile = await env.createTempFile({
|
|
52
|
-
prefix: "bash-",
|
|
53
|
-
suffix: ".log",
|
|
54
|
-
abortSignal: options?.abortSignal,
|
|
55
|
-
});
|
|
66
|
+
const tempFile = await env.createTempFile({ prefix: "bash-", suffix: ".log" });
|
|
56
67
|
if (!tempFile.ok)
|
|
57
68
|
return err(toExecutionError(tempFile.error));
|
|
58
69
|
fullOutputPath = tempFile.value;
|
|
59
|
-
const appendResult = await env.appendFile(tempFile.value, initialContent
|
|
70
|
+
const appendResult = await env.appendFile(tempFile.value, initialContent);
|
|
60
71
|
return appendResult.ok ? ok(undefined) : err(toExecutionError(appendResult.error));
|
|
61
72
|
});
|
|
62
73
|
};
|
|
74
|
+
const createProgress = () => {
|
|
75
|
+
const tailTruncation = truncateTail(tailOutput);
|
|
76
|
+
const totalLines = completedLines + (hasOpenLine ? 1 : 0);
|
|
77
|
+
const truncated = totalLines > DEFAULT_MAX_LINES || totalBytes > DEFAULT_MAX_BYTES;
|
|
78
|
+
const truncation = {
|
|
79
|
+
...tailTruncation,
|
|
80
|
+
truncated,
|
|
81
|
+
truncatedBy: truncated
|
|
82
|
+
? (tailTruncation.truncatedBy ?? (totalBytes > DEFAULT_MAX_BYTES ? "bytes" : "lines"))
|
|
83
|
+
: null,
|
|
84
|
+
totalLines,
|
|
85
|
+
totalBytes,
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
output: truncated ? truncation.content : tailOutput,
|
|
89
|
+
truncation,
|
|
90
|
+
fullOutputPath,
|
|
91
|
+
lastLineBytes: currentLineBytes,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
63
94
|
const onChunk = (chunk) => {
|
|
95
|
+
if (!acceptingOutput)
|
|
96
|
+
return;
|
|
64
97
|
try {
|
|
65
|
-
totalBytes += encoder.encode(chunk).byteLength;
|
|
66
98
|
const text = sanitizeBinaryOutput(chunk).replace(/\r/g, "");
|
|
67
|
-
|
|
68
|
-
|
|
99
|
+
const textBytes = encoder.encode(text).byteLength;
|
|
100
|
+
totalBytes += textBytes;
|
|
101
|
+
const newlineCount = text.split("\n").length - 1;
|
|
102
|
+
completedLines += newlineCount;
|
|
103
|
+
const lastNewline = text.lastIndexOf("\n");
|
|
104
|
+
if (lastNewline >= 0) {
|
|
105
|
+
const trailingText = text.slice(lastNewline + 1);
|
|
106
|
+
currentLineBytes = encoder.encode(trailingText).byteLength;
|
|
107
|
+
hasOpenLine = trailingText.length > 0;
|
|
69
108
|
}
|
|
70
|
-
else {
|
|
71
|
-
|
|
109
|
+
else if (text.length > 0) {
|
|
110
|
+
currentLineBytes += textBytes;
|
|
111
|
+
hasOpenLine = true;
|
|
112
|
+
}
|
|
113
|
+
tailOutput += text;
|
|
114
|
+
const totalLines = completedLines + (hasOpenLine ? 1 : 0);
|
|
115
|
+
if ((totalBytes > DEFAULT_MAX_BYTES || totalLines > DEFAULT_MAX_LINES) && !fullOutputRequested) {
|
|
116
|
+
ensureFullOutputFile(tailOutput);
|
|
72
117
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
while (outputBytes > maxOutputBytes && outputChunks.length > 1) {
|
|
76
|
-
const removed = outputChunks.shift();
|
|
77
|
-
outputBytes -= removed.length;
|
|
118
|
+
else if (fullOutputRequested) {
|
|
119
|
+
appendFullOutput(text);
|
|
78
120
|
}
|
|
79
|
-
|
|
121
|
+
tailOutput = trimToLastUtf8Bytes(tailOutput, maxOutputBytes, encoder);
|
|
122
|
+
options?.onChunk?.(text, createProgress);
|
|
80
123
|
}
|
|
81
124
|
catch (error) {
|
|
82
125
|
captureError = toExecutionError(error);
|
|
@@ -84,42 +127,54 @@ export async function executeShellWithCapture(env, command, options) {
|
|
|
84
127
|
};
|
|
85
128
|
try {
|
|
86
129
|
const result = await env.exec(command, {
|
|
87
|
-
|
|
130
|
+
cwd: options?.cwd,
|
|
131
|
+
env: options?.env,
|
|
132
|
+
inheritEnv: options?.inheritEnv,
|
|
133
|
+
timeout: options?.timeout,
|
|
134
|
+
abortSignal: options?.abortSignal,
|
|
88
135
|
onStdout: onChunk,
|
|
89
136
|
onStderr: onChunk,
|
|
90
137
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (
|
|
138
|
+
acceptingOutput = false;
|
|
139
|
+
let progress = createProgress();
|
|
140
|
+
if (progress.truncation.truncated && !fullOutputRequested)
|
|
94
141
|
ensureFullOutputFile(tailOutput);
|
|
95
|
-
}
|
|
96
142
|
const writeResult = await writeChain;
|
|
97
143
|
if (!writeResult.ok)
|
|
98
144
|
return err(writeResult.error);
|
|
99
145
|
if (captureError)
|
|
100
146
|
return err(captureError);
|
|
147
|
+
progress = createProgress();
|
|
101
148
|
if (!result.ok) {
|
|
102
149
|
if (result.error.code === "aborted" || options?.abortSignal?.aborted) {
|
|
103
150
|
return ok({
|
|
104
|
-
|
|
151
|
+
...progress,
|
|
105
152
|
exitCode: undefined,
|
|
106
153
|
cancelled: true,
|
|
107
|
-
truncated:
|
|
108
|
-
|
|
154
|
+
truncated: progress.truncation.truncated,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
if (options?.returnExecutionErrors) {
|
|
158
|
+
return ok({
|
|
159
|
+
...progress,
|
|
160
|
+
exitCode: undefined,
|
|
161
|
+
cancelled: false,
|
|
162
|
+
truncated: progress.truncation.truncated,
|
|
163
|
+
executionError: result.error,
|
|
109
164
|
});
|
|
110
165
|
}
|
|
111
166
|
return err(result.error);
|
|
112
167
|
}
|
|
113
168
|
const cancelled = options?.abortSignal?.aborted ?? false;
|
|
114
169
|
return ok({
|
|
115
|
-
|
|
170
|
+
...progress,
|
|
116
171
|
exitCode: cancelled ? undefined : result.value.exitCode,
|
|
117
172
|
cancelled,
|
|
118
|
-
truncated:
|
|
119
|
-
fullOutputPath,
|
|
173
|
+
truncated: progress.truncation.truncated,
|
|
120
174
|
});
|
|
121
175
|
}
|
|
122
176
|
catch (error) {
|
|
177
|
+
acceptingOutput = false;
|
|
123
178
|
return err(toExecutionError(error));
|
|
124
179
|
}
|
|
125
180
|
}
|
|
@@ -43,6 +43,14 @@ function utf8ByteLength(content) {
|
|
|
43
43
|
}
|
|
44
44
|
return bytes;
|
|
45
45
|
}
|
|
46
|
+
function splitLinesForCounting(content) {
|
|
47
|
+
if (content.length === 0)
|
|
48
|
+
return [];
|
|
49
|
+
const lines = content.split("\n");
|
|
50
|
+
if (content.endsWith("\n"))
|
|
51
|
+
lines.pop();
|
|
52
|
+
return lines;
|
|
53
|
+
}
|
|
46
54
|
function replaceUnpairedSurrogates(content) {
|
|
47
55
|
let output = "";
|
|
48
56
|
for (let i = 0; i < content.length; i++) {
|
|
@@ -92,7 +100,7 @@ export function truncateHead(content, options = {}) {
|
|
|
92
100
|
const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
|
|
93
101
|
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
94
102
|
const totalBytes = utf8ByteLength(content);
|
|
95
|
-
const lines = content
|
|
103
|
+
const lines = splitLinesForCounting(content);
|
|
96
104
|
const totalLines = lines.length;
|
|
97
105
|
// Check if no truncation needed
|
|
98
106
|
if (totalLines <= maxLines && totalBytes <= maxBytes) {
|
|
@@ -171,9 +179,7 @@ export function truncateTail(content, options = {}) {
|
|
|
171
179
|
const maxLines = options.maxLines ?? DEFAULT_MAX_LINES;
|
|
172
180
|
const maxBytes = options.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
173
181
|
const totalBytes = utf8ByteLength(content);
|
|
174
|
-
const lines = content
|
|
175
|
-
if (lines.length > 1 && lines[lines.length - 1] === "")
|
|
176
|
-
lines.pop();
|
|
182
|
+
const lines = splitLinesForCounting(content);
|
|
177
183
|
const totalLines = lines.length;
|
|
178
184
|
// Check if no truncation needed
|
|
179
185
|
if (totalLines <= maxLines && totalBytes <= maxBytes) {
|
|
@@ -16,6 +16,7 @@ export * from "./harness/session/repo-utils.js";
|
|
|
16
16
|
export * from "./harness/session/session.js";
|
|
17
17
|
export * from "./harness/skills.js";
|
|
18
18
|
export * from "./harness/system-prompt.js";
|
|
19
|
+
export * from "./harness/tools/index.js";
|
|
19
20
|
// Harness
|
|
20
21
|
export * from "./harness/types.js";
|
|
21
22
|
export * from "./harness/utils/shell-output.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-agent-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.82.0",
|
|
4
4
|
"description": "General-purpose agent with transport abstraction, state management, and attachment support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"prepublishOnly": "npm run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@earendil-works/pi-ai": "^0.
|
|
32
|
+
"@earendil-works/pi-ai": "^0.82.0",
|
|
33
|
+
"diff": "8.0.4",
|
|
33
34
|
"ignore": "7.0.5",
|
|
34
35
|
"typebox": "1.1.38",
|
|
35
36
|
"yaml": "2.9.0"
|
|
@@ -5,7 +5,9 @@ import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
|
|
5
5
|
import { headersToRecord } from "../utils/headers.js";
|
|
6
6
|
import { parseJsonWithRepair, parseStreamingJson } from "../utils/json-parse.js";
|
|
7
7
|
import { getProviderEnvValue } from "../utils/provider-env.js";
|
|
8
|
+
import { retryProviderRequest } from "../utils/provider-retry.js";
|
|
8
9
|
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
|
10
|
+
import { resolveJsonSchemaStrictSampling } from "./constrained-sampling.js";
|
|
9
11
|
import { buildCopilotDynamicHeaders, hasCopilotVisionInput } from "./github-copilot-headers.js";
|
|
10
12
|
import { adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToContext } from "./simple-options.js";
|
|
11
13
|
import { transformMessages } from "./transform-messages.js";
|
|
@@ -115,6 +117,7 @@ function getAnthropicCompat(model) {
|
|
|
115
117
|
supportsCacheControlOnTools: model.compat?.supportsCacheControlOnTools ?? true,
|
|
116
118
|
supportsTemperature: model.compat?.supportsTemperature ?? true,
|
|
117
119
|
allowEmptySignature: model.compat?.allowEmptySignature ?? false,
|
|
120
|
+
supportsStrictTools: model.compat?.supportsStrictTools ?? false,
|
|
118
121
|
supportsToolReferences: model.compat?.supportsToolReferences ?? defaultSupportsToolReferences(model),
|
|
119
122
|
};
|
|
120
123
|
}
|
|
@@ -365,9 +368,13 @@ export const stream = (model, context, options) => {
|
|
|
365
368
|
const requestOptions = {
|
|
366
369
|
...(options?.signal ? { signal: options.signal } : {}),
|
|
367
370
|
...(options?.timeoutMs !== undefined ? { timeout: options.timeoutMs } : {}),
|
|
368
|
-
maxRetries:
|
|
371
|
+
maxRetries: 0,
|
|
369
372
|
};
|
|
370
|
-
const response = await client.messages.create({ ...params, stream: true }, requestOptions).asResponse()
|
|
373
|
+
const response = await retryProviderRequest(() => client.messages.create({ ...params, stream: true }, requestOptions).asResponse(), {
|
|
374
|
+
maxRetries: options?.maxRetries,
|
|
375
|
+
maxRetryDelayMs: options?.maxRetryDelayMs,
|
|
376
|
+
signal: options?.signal,
|
|
377
|
+
});
|
|
371
378
|
await options?.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
|
|
372
379
|
stream.push({ type: "start", partial: output });
|
|
373
380
|
const blocks = output.content;
|
|
@@ -739,8 +746,8 @@ function buildParams(model, context, isOAuthToken, options) {
|
|
|
739
746
|
}
|
|
740
747
|
if (immediateTools.length > 0 || deferredTools.length > 0) {
|
|
741
748
|
params.tools = [
|
|
742
|
-
...convertTools(immediateTools, isOAuthToken, compat.supportsEagerToolInputStreaming, compat.supportsCacheControlOnTools ? cacheControl : undefined),
|
|
743
|
-
...convertTools(deferredTools, isOAuthToken, compat.supportsEagerToolInputStreaming, undefined, true),
|
|
749
|
+
...convertTools(immediateTools, isOAuthToken, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, compat.supportsCacheControlOnTools ? cacheControl : undefined),
|
|
750
|
+
...convertTools(deferredTools, isOAuthToken, compat.supportsEagerToolInputStreaming, compat.supportsStrictTools, undefined, true),
|
|
744
751
|
];
|
|
745
752
|
}
|
|
746
753
|
// Configure thinking mode: adaptive, budget-based, or explicitly disabled.
|
|
@@ -978,20 +985,29 @@ function convertMessages(transformedMessages, isOAuthToken, cacheControl, allowE
|
|
|
978
985
|
function shouldUseFineGrainedToolStreamingBeta(model, context) {
|
|
979
986
|
return !!context.tools?.length && !getAnthropicCompat(model).supportsEagerToolInputStreaming;
|
|
980
987
|
}
|
|
981
|
-
function convertTools(tools, isOAuthToken, supportsEagerToolInputStreaming, cacheControl, deferLoading = false) {
|
|
988
|
+
function convertTools(tools, isOAuthToken, supportsEagerToolInputStreaming, supportsStrictTools, cacheControl, deferLoading = false) {
|
|
982
989
|
if (!tools)
|
|
983
990
|
return [];
|
|
984
991
|
return tools.map((tool, index) => {
|
|
992
|
+
const strict = resolveJsonSchemaStrictSampling(tool, supportsStrictTools);
|
|
985
993
|
const schema = tool.parameters;
|
|
994
|
+
const legacyInputSchema = {
|
|
995
|
+
type: "object",
|
|
996
|
+
properties: schema.properties ?? {},
|
|
997
|
+
required: schema.required ?? [],
|
|
998
|
+
};
|
|
999
|
+
const inputSchema = strict === true
|
|
1000
|
+
? {
|
|
1001
|
+
...tool.parameters,
|
|
1002
|
+
...legacyInputSchema,
|
|
1003
|
+
}
|
|
1004
|
+
: legacyInputSchema;
|
|
986
1005
|
return {
|
|
987
1006
|
name: isOAuthToken ? toClaudeCodeName(tool.name) : tool.name,
|
|
988
1007
|
description: tool.description,
|
|
989
1008
|
...(supportsEagerToolInputStreaming ? { eager_input_streaming: true } : {}),
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
properties: schema.properties ?? {},
|
|
993
|
-
required: schema.required ?? [],
|
|
994
|
-
},
|
|
1009
|
+
...(strict === true ? { strict: true } : {}),
|
|
1010
|
+
input_schema: inputSchema,
|
|
995
1011
|
...(deferLoading ? { defer_loading: true } : {}),
|
|
996
1012
|
...(cacheControl && index === tools.length - 1 ? { cache_control: cacheControl } : {}),
|
|
997
1013
|
};
|