@puku-ai/sdk 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +26 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/vendor/_vendor/partial-json-parser/parser.d.ts +2 -0
- package/dist/vendor/_vendor/partial-json-parser/parser.js +223 -0
- package/dist/vendor/_vendor/partial-json-parser/parser.js.map +1 -0
- package/dist/vendor/api-promise.d.ts +2 -0
- package/dist/vendor/api-promise.js +3 -0
- package/dist/vendor/api-promise.js.map +1 -0
- package/dist/vendor/client.d.ts +399 -0
- package/dist/vendor/client.js +976 -0
- package/dist/vendor/client.js.map +1 -0
- package/dist/vendor/core/api-promise.d.ts +49 -0
- package/dist/vendor/core/api-promise.js +77 -0
- package/dist/vendor/core/api-promise.js.map +1 -0
- package/dist/vendor/core/api.d.ts +10 -0
- package/dist/vendor/core/api.js +2 -0
- package/dist/vendor/core/api.js.map +1 -0
- package/dist/vendor/core/credentials.d.ts +130 -0
- package/dist/vendor/core/credentials.js +274 -0
- package/dist/vendor/core/credentials.js.map +1 -0
- package/dist/vendor/core/error.d.ts +82 -0
- package/dist/vendor/core/error.js +140 -0
- package/dist/vendor/core/error.js.map +1 -0
- package/dist/vendor/core/middleware.d.ts +153 -0
- package/dist/vendor/core/middleware.js +168 -0
- package/dist/vendor/core/middleware.js.map +1 -0
- package/dist/vendor/core/pagination.d.ts +121 -0
- package/dist/vendor/core/pagination.js +207 -0
- package/dist/vendor/core/pagination.js.map +1 -0
- package/dist/vendor/core/resource.d.ts +5 -0
- package/dist/vendor/core/resource.js +8 -0
- package/dist/vendor/core/resource.js.map +1 -0
- package/dist/vendor/core/streaming.d.ts +41 -0
- package/dist/vendor/core/streaming.js +342 -0
- package/dist/vendor/core/streaming.js.map +1 -0
- package/dist/vendor/core/uploads.d.ts +2 -0
- package/dist/vendor/core/uploads.js +2 -0
- package/dist/vendor/core/uploads.js.map +1 -0
- package/dist/vendor/error.d.ts +2 -0
- package/dist/vendor/error.js +3 -0
- package/dist/vendor/error.js.map +1 -0
- package/dist/vendor/helpers/beta/environments.d.ts +22 -0
- package/dist/vendor/helpers/beta/environments.js +23 -0
- package/dist/vendor/helpers/beta/environments.js.map +1 -0
- package/dist/vendor/helpers/beta/json-schema.d.ts +36 -0
- package/dist/vendor/helpers/beta/json-schema.js +53 -0
- package/dist/vendor/helpers/beta/json-schema.js.map +1 -0
- package/dist/vendor/helpers/beta/mcp.d.ts +302 -0
- package/dist/vendor/helpers/beta/mcp.js +406 -0
- package/dist/vendor/helpers/beta/mcp.js.map +1 -0
- package/dist/vendor/helpers/beta/memory.d.ts +10 -0
- package/dist/vendor/helpers/beta/memory.js +15 -0
- package/dist/vendor/helpers/beta/memory.js.map +1 -0
- package/dist/vendor/helpers/beta/standard-schema.d.ts +44 -0
- package/dist/vendor/helpers/beta/standard-schema.js +54 -0
- package/dist/vendor/helpers/beta/standard-schema.js.map +1 -0
- package/dist/vendor/helpers/beta/zod.d.ts +32 -0
- package/dist/vendor/helpers/beta/zod.js +52 -0
- package/dist/vendor/helpers/beta/zod.js.map +1 -0
- package/dist/vendor/helpers/index.d.ts +2 -0
- package/dist/vendor/helpers/index.js +3 -0
- package/dist/vendor/helpers/index.js.map +1 -0
- package/dist/vendor/helpers/json-schema.d.ts +17 -0
- package/dist/vendor/helpers/json-schema.js +34 -0
- package/dist/vendor/helpers/json-schema.js.map +1 -0
- package/dist/vendor/helpers/zod.d.ts +12 -0
- package/dist/vendor/helpers/zod.js +42 -0
- package/dist/vendor/helpers/zod.js.map +1 -0
- package/dist/vendor/index.d.ts +16 -0
- package/dist/vendor/index.js +23 -0
- package/dist/vendor/index.js.map +1 -0
- package/dist/vendor/internal/builtin-types.d.ts +72 -0
- package/dist/vendor/internal/builtin-types.js +3 -0
- package/dist/vendor/internal/builtin-types.js.map +1 -0
- package/dist/vendor/internal/constants.d.ts +4 -0
- package/dist/vendor/internal/constants.js +10 -0
- package/dist/vendor/internal/constants.js.map +1 -0
- package/dist/vendor/internal/decoders/jsonl.d.ts +9 -0
- package/dist/vendor/internal/decoders/jsonl.js +37 -0
- package/dist/vendor/internal/decoders/jsonl.js.map +1 -0
- package/dist/vendor/internal/decoders/line.d.ts +16 -0
- package/dist/vendor/internal/decoders/line.js +105 -0
- package/dist/vendor/internal/decoders/line.js.map +1 -0
- package/dist/vendor/internal/detect-platform.d.ts +14 -0
- package/dist/vendor/internal/detect-platform.js +155 -0
- package/dist/vendor/internal/detect-platform.js.map +1 -0
- package/dist/vendor/internal/errors.d.ts +2 -0
- package/dist/vendor/internal/errors.js +38 -0
- package/dist/vendor/internal/errors.js.map +1 -0
- package/dist/vendor/internal/file-store.d.ts +135 -0
- package/dist/vendor/internal/file-store.js +529 -0
- package/dist/vendor/internal/file-store.js.map +1 -0
- package/dist/vendor/internal/headers.d.ts +28 -0
- package/dist/vendor/internal/headers.js +114 -0
- package/dist/vendor/internal/headers.js.map +1 -0
- package/dist/vendor/internal/message-stream-utils.d.ts +9 -0
- package/dist/vendor/internal/message-stream-utils.js +30 -0
- package/dist/vendor/internal/message-stream-utils.js.map +1 -0
- package/dist/vendor/internal/node.browser.d.ts +8 -0
- package/dist/vendor/internal/node.browser.js +19 -0
- package/dist/vendor/internal/node.browser.js.map +1 -0
- package/dist/vendor/internal/node.d.ts +13 -0
- package/dist/vendor/internal/node.js +14 -0
- package/dist/vendor/internal/node.js.map +1 -0
- package/dist/vendor/internal/parse.d.ts +17 -0
- package/dist/vendor/internal/parse.js +62 -0
- package/dist/vendor/internal/parse.js.map +1 -0
- package/dist/vendor/internal/qs/formats.d.ts +6 -0
- package/dist/vendor/internal/qs/formats.js +9 -0
- package/dist/vendor/internal/qs/formats.js.map +1 -0
- package/dist/vendor/internal/qs/index.d.ts +9 -0
- package/dist/vendor/internal/qs/index.js +10 -0
- package/dist/vendor/internal/qs/index.js.map +1 -0
- package/dist/vendor/internal/qs/stringify.d.ts +2 -0
- package/dist/vendor/internal/qs/stringify.js +274 -0
- package/dist/vendor/internal/qs/stringify.js.map +1 -0
- package/dist/vendor/internal/qs/types.d.ts +56 -0
- package/dist/vendor/internal/qs/types.js +2 -0
- package/dist/vendor/internal/qs/types.js.map +1 -0
- package/dist/vendor/internal/qs/utils.d.ts +14 -0
- package/dist/vendor/internal/qs/utils.js +217 -0
- package/dist/vendor/internal/qs/utils.js.map +1 -0
- package/dist/vendor/internal/request-options.d.ts +126 -0
- package/dist/vendor/internal/request-options.js +27 -0
- package/dist/vendor/internal/request-options.js.map +1 -0
- package/dist/vendor/internal/request-signal.d.ts +3 -0
- package/dist/vendor/internal/request-signal.js +45 -0
- package/dist/vendor/internal/request-signal.js.map +1 -0
- package/dist/vendor/internal/shim-types.d.ts +16 -0
- package/dist/vendor/internal/shim-types.js +3 -0
- package/dist/vendor/internal/shim-types.js.map +1 -0
- package/dist/vendor/internal/shims.d.ts +25 -0
- package/dist/vendor/internal/shims.js +85 -0
- package/dist/vendor/internal/shims.js.map +1 -0
- package/dist/vendor/internal/stainless-helper-header.d.ts +59 -0
- package/dist/vendor/internal/stainless-helper-header.js +83 -0
- package/dist/vendor/internal/stainless-helper-header.js.map +1 -0
- package/dist/vendor/internal/stream-utils.d.ts +7 -0
- package/dist/vendor/internal/stream-utils.js +35 -0
- package/dist/vendor/internal/stream-utils.js.map +1 -0
- package/dist/vendor/internal/to-file.d.ts +44 -0
- package/dist/vendor/internal/to-file.js +93 -0
- package/dist/vendor/internal/to-file.js.map +1 -0
- package/dist/vendor/internal/types.d.ts +62 -0
- package/dist/vendor/internal/types.js +3 -0
- package/dist/vendor/internal/types.js.map +1 -0
- package/dist/vendor/internal/uploads.d.ts +41 -0
- package/dist/vendor/internal/uploads.js +139 -0
- package/dist/vendor/internal/uploads.js.map +1 -0
- package/dist/vendor/internal/utils/abort.d.ts +11 -0
- package/dist/vendor/internal/utils/abort.js +22 -0
- package/dist/vendor/internal/utils/abort.js.map +1 -0
- package/dist/vendor/internal/utils/async-queue.d.ts +30 -0
- package/dist/vendor/internal/utils/async-queue.js +66 -0
- package/dist/vendor/internal/utils/async-queue.js.map +1 -0
- package/dist/vendor/internal/utils/backoff.d.ts +22 -0
- package/dist/vendor/internal/utils/backoff.js +36 -0
- package/dist/vendor/internal/utils/backoff.js.map +1 -0
- package/dist/vendor/internal/utils/base64.d.ts +2 -0
- package/dist/vendor/internal/utils/base64.js +33 -0
- package/dist/vendor/internal/utils/base64.js.map +1 -0
- package/dist/vendor/internal/utils/bytes.d.ts +3 -0
- package/dist/vendor/internal/utils/bytes.js +26 -0
- package/dist/vendor/internal/utils/bytes.js.map +1 -0
- package/dist/vendor/internal/utils/env.d.ts +8 -0
- package/dist/vendor/internal/utils/env.js +18 -0
- package/dist/vendor/internal/utils/env.js.map +1 -0
- package/dist/vendor/internal/utils/log.d.ts +46 -0
- package/dist/vendor/internal/utils/log.js +105 -0
- package/dist/vendor/internal/utils/log.js.map +1 -0
- package/dist/vendor/internal/utils/path.d.ts +14 -0
- package/dist/vendor/internal/utils/path.js +74 -0
- package/dist/vendor/internal/utils/path.js.map +1 -0
- package/dist/vendor/internal/utils/promise.d.ts +10 -0
- package/dist/vendor/internal/utils/promise.js +15 -0
- package/dist/vendor/internal/utils/promise.js.map +1 -0
- package/dist/vendor/internal/utils/query.d.ts +1 -0
- package/dist/vendor/internal/utils/query.js +6 -0
- package/dist/vendor/internal/utils/query.js.map +1 -0
- package/dist/vendor/internal/utils/sleep.d.ts +9 -0
- package/dist/vendor/internal/utils/sleep.js +24 -0
- package/dist/vendor/internal/utils/sleep.js.map +1 -0
- package/dist/vendor/internal/utils/time.d.ts +2 -0
- package/dist/vendor/internal/utils/time.js +5 -0
- package/dist/vendor/internal/utils/time.js.map +1 -0
- package/dist/vendor/internal/utils/uuid.d.ts +4 -0
- package/dist/vendor/internal/utils/uuid.js +15 -0
- package/dist/vendor/internal/utils/uuid.js.map +1 -0
- package/dist/vendor/internal/utils/values.d.ts +24 -0
- package/dist/vendor/internal/utils/values.js +106 -0
- package/dist/vendor/internal/utils/values.js.map +1 -0
- package/dist/vendor/internal/utils.d.ts +7 -0
- package/dist/vendor/internal/utils.js +9 -0
- package/dist/vendor/internal/utils.js.map +1 -0
- package/dist/vendor/lib/BetaMessageStream.d.ts +123 -0
- package/dist/vendor/lib/BetaMessageStream.js +662 -0
- package/dist/vendor/lib/BetaMessageStream.js.map +1 -0
- package/dist/vendor/lib/MessageStream.d.ts +122 -0
- package/dist/vendor/lib/MessageStream.js +609 -0
- package/dist/vendor/lib/MessageStream.js.map +1 -0
- package/dist/vendor/lib/beta-parser.d.ts +36 -0
- package/dist/vendor/lib/beta-parser.js +75 -0
- package/dist/vendor/lib/beta-parser.js.map +1 -0
- package/dist/vendor/lib/credentials/credential-chain.d.ts +38 -0
- package/dist/vendor/lib/credentials/credential-chain.js +208 -0
- package/dist/vendor/lib/credentials/credential-chain.js.map +1 -0
- package/dist/vendor/lib/credentials/identity-token.d.ts +10 -0
- package/dist/vendor/lib/credentials/identity-token.js +35 -0
- package/dist/vendor/lib/credentials/identity-token.js.map +1 -0
- package/dist/vendor/lib/credentials/oidc-federation.d.ts +39 -0
- package/dist/vendor/lib/credentials/oidc-federation.js +79 -0
- package/dist/vendor/lib/credentials/oidc-federation.js.map +1 -0
- package/dist/vendor/lib/credentials/token-cache.d.ts +53 -0
- package/dist/vendor/lib/credentials/token-cache.js +110 -0
- package/dist/vendor/lib/credentials/token-cache.js.map +1 -0
- package/dist/vendor/lib/credentials/types.d.ts +95 -0
- package/dist/vendor/lib/credentials/types.js +226 -0
- package/dist/vendor/lib/credentials/types.js.map +1 -0
- package/dist/vendor/lib/credentials/user-oauth.d.ts +20 -0
- package/dist/vendor/lib/credentials/user-oauth.js +94 -0
- package/dist/vendor/lib/credentials/user-oauth.js.map +1 -0
- package/dist/vendor/lib/credentials.d.ts +3 -0
- package/dist/vendor/lib/credentials.js +3 -0
- package/dist/vendor/lib/credentials.js.map +1 -0
- package/dist/vendor/lib/environments/index.d.ts +3 -0
- package/dist/vendor/lib/environments/index.js +4 -0
- package/dist/vendor/lib/environments/index.js.map +1 -0
- package/dist/vendor/lib/environments/poller.d.ts +94 -0
- package/dist/vendor/lib/environments/poller.js +218 -0
- package/dist/vendor/lib/environments/poller.js.map +1 -0
- package/dist/vendor/lib/environments/worker.d.ts +226 -0
- package/dist/vendor/lib/environments/worker.js +572 -0
- package/dist/vendor/lib/environments/worker.js.map +1 -0
- package/dist/vendor/lib/helper-client.d.ts +30 -0
- package/dist/vendor/lib/helper-client.js +55 -0
- package/dist/vendor/lib/helper-client.js.map +1 -0
- package/dist/vendor/lib/middleware.d.ts +97 -0
- package/dist/vendor/lib/middleware.js +775 -0
- package/dist/vendor/lib/middleware.js.map +1 -0
- package/dist/vendor/lib/parser.d.ts +31 -0
- package/dist/vendor/lib/parser.js +62 -0
- package/dist/vendor/lib/parser.js.map +1 -0
- package/dist/vendor/lib/sessions/accumulate.d.ts +22 -0
- package/dist/vendor/lib/sessions/accumulate.js +42 -0
- package/dist/vendor/lib/sessions/accumulate.js.map +1 -0
- package/dist/vendor/lib/standard-schema.d.ts +130 -0
- package/dist/vendor/lib/standard-schema.js +41 -0
- package/dist/vendor/lib/standard-schema.js.map +1 -0
- package/dist/vendor/lib/tools/BetaRunnableTool.d.ts +48 -0
- package/dist/vendor/lib/tools/BetaRunnableTool.js +26 -0
- package/dist/vendor/lib/tools/BetaRunnableTool.js.map +1 -0
- package/dist/vendor/lib/tools/BetaToolRunner.d.ts +160 -0
- package/dist/vendor/lib/tools/BetaToolRunner.js +497 -0
- package/dist/vendor/lib/tools/BetaToolRunner.js.map +1 -0
- package/dist/vendor/lib/tools/CompactionControl.d.ts +29 -0
- package/dist/vendor/lib/tools/CompactionControl.js +25 -0
- package/dist/vendor/lib/tools/CompactionControl.js.map +1 -0
- package/dist/vendor/lib/tools/SessionToolRunner.d.ts +178 -0
- package/dist/vendor/lib/tools/SessionToolRunner.js +737 -0
- package/dist/vendor/lib/tools/SessionToolRunner.js.map +1 -0
- package/dist/vendor/lib/tools/ToolError.d.ts +32 -0
- package/dist/vendor/lib/tools/ToolError.js +43 -0
- package/dist/vendor/lib/tools/ToolError.js.map +1 -0
- package/dist/vendor/lib/transform-json-schema.d.ts +2 -0
- package/dist/vendor/lib/transform-json-schema.js +111 -0
- package/dist/vendor/lib/transform-json-schema.js.map +1 -0
- package/dist/vendor/pagination.d.ts +2 -0
- package/dist/vendor/pagination.js +3 -0
- package/dist/vendor/pagination.js.map +1 -0
- package/dist/vendor/resource.d.ts +2 -0
- package/dist/vendor/resource.js +3 -0
- package/dist/vendor/resource.js.map +1 -0
- package/dist/vendor/resources/beta/agents/agents.d.ts +1128 -0
- package/dist/vendor/resources/beta/agents/agents.js +123 -0
- package/dist/vendor/resources/beta/agents/agents.js.map +1 -0
- package/dist/vendor/resources/beta/agents/index.d.ts +2 -0
- package/dist/vendor/resources/beta/agents/index.js +4 -0
- package/dist/vendor/resources/beta/agents/index.js.map +1 -0
- package/dist/vendor/resources/beta/agents/versions.d.ts +32 -0
- package/dist/vendor/resources/beta/agents/versions.js +32 -0
- package/dist/vendor/resources/beta/agents/versions.js.map +1 -0
- package/dist/vendor/resources/beta/agents.d.ts +1 -0
- package/dist/vendor/resources/beta/agents.js +3 -0
- package/dist/vendor/resources/beta/agents.js.map +1 -0
- package/dist/vendor/resources/beta/beta.d.ts +131 -0
- package/dist/vendor/resources/beta/beta.js +69 -0
- package/dist/vendor/resources/beta/beta.js.map +1 -0
- package/dist/vendor/resources/beta/deployment-runs.d.ts +305 -0
- package/dist/vendor/resources/beta/deployment-runs.js +51 -0
- package/dist/vendor/resources/beta/deployment-runs.js.map +1 -0
- package/dist/vendor/resources/beta/deployments.d.ts +698 -0
- package/dist/vendor/resources/beta/deployments.js +192 -0
- package/dist/vendor/resources/beta/deployments.js.map +1 -0
- package/dist/vendor/resources/beta/dreams.d.ts +335 -0
- package/dist/vendor/resources/beta/dreams.js +112 -0
- package/dist/vendor/resources/beta/dreams.js.map +1 -0
- package/dist/vendor/resources/beta/environments/environments.d.ts +432 -0
- package/dist/vendor/resources/beta/environments/environments.js +142 -0
- package/dist/vendor/resources/beta/environments/environments.js.map +1 -0
- package/dist/vendor/resources/beta/environments/index.d.ts +2 -0
- package/dist/vendor/resources/beta/environments/index.js +4 -0
- package/dist/vendor/resources/beta/environments/index.js.map +1 -0
- package/dist/vendor/resources/beta/environments/work.d.ts +500 -0
- package/dist/vendor/resources/beta/environments/work.js +251 -0
- package/dist/vendor/resources/beta/environments/work.js.map +1 -0
- package/dist/vendor/resources/beta/environments.d.ts +1 -0
- package/dist/vendor/resources/beta/environments.js +3 -0
- package/dist/vendor/resources/beta/environments.js.map +1 -0
- package/dist/vendor/resources/beta/files.d.ts +190 -0
- package/dist/vendor/resources/beta/files.js +120 -0
- package/dist/vendor/resources/beta/files.js.map +1 -0
- package/dist/vendor/resources/beta/index.d.ts +17 -0
- package/dist/vendor/resources/beta/index.js +19 -0
- package/dist/vendor/resources/beta/index.js.map +1 -0
- package/dist/vendor/resources/beta/memory-stores/index.d.ts +3 -0
- package/dist/vendor/resources/beta/memory-stores/index.js +5 -0
- package/dist/vendor/resources/beta/memory-stores/index.js.map +1 -0
- package/dist/vendor/resources/beta/memory-stores/memories.d.ts +346 -0
- package/dist/vendor/resources/beta/memory-stores/memories.js +126 -0
- package/dist/vendor/resources/beta/memory-stores/memories.js.map +1 -0
- package/dist/vendor/resources/beta/memory-stores/memory-stores.d.ts +230 -0
- package/dist/vendor/resources/beta/memory-stores/memory-stores.js +137 -0
- package/dist/vendor/resources/beta/memory-stores/memory-stores.js.map +1 -0
- package/dist/vendor/resources/beta/memory-stores/memory-versions.d.ts +252 -0
- package/dist/vendor/resources/beta/memory-stores/memory-versions.js +77 -0
- package/dist/vendor/resources/beta/memory-stores/memory-versions.js.map +1 -0
- package/dist/vendor/resources/beta/memory-stores.d.ts +1 -0
- package/dist/vendor/resources/beta/memory-stores.js +3 -0
- package/dist/vendor/resources/beta/memory-stores.js.map +1 -0
- package/dist/vendor/resources/beta/messages/batches.d.ts +685 -0
- package/dist/vendor/resources/beta/messages/batches.js +203 -0
- package/dist/vendor/resources/beta/messages/batches.js.map +1 -0
- package/dist/vendor/resources/beta/messages/index.d.ts +3 -0
- package/dist/vendor/resources/beta/messages/index.js +5 -0
- package/dist/vendor/resources/beta/messages/index.js.map +1 -0
- package/dist/vendor/resources/beta/messages/messages.d.ts +5376 -0
- package/dist/vendor/resources/beta/messages/messages.js +158 -0
- package/dist/vendor/resources/beta/messages/messages.js.map +1 -0
- package/dist/vendor/resources/beta/messages.d.ts +1 -0
- package/dist/vendor/resources/beta/messages.js +3 -0
- package/dist/vendor/resources/beta/messages.js.map +1 -0
- package/dist/vendor/resources/beta/models.d.ts +217 -0
- package/dist/vendor/resources/beta/models.js +56 -0
- package/dist/vendor/resources/beta/models.js.map +1 -0
- package/dist/vendor/resources/beta/organization/api-keys.d.ts +176 -0
- package/dist/vendor/resources/beta/organization/api-keys.js +52 -0
- package/dist/vendor/resources/beta/organization/api-keys.js.map +1 -0
- package/dist/vendor/resources/beta/organization/compliance-settings.d.ts +73 -0
- package/dist/vendor/resources/beta/organization/compliance-settings.js +48 -0
- package/dist/vendor/resources/beta/organization/compliance-settings.js.map +1 -0
- package/dist/vendor/resources/beta/organization/external-keys.d.ts +271 -0
- package/dist/vendor/resources/beta/organization/external-keys.js +115 -0
- package/dist/vendor/resources/beta/organization/external-keys.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/federation.d.ts +13 -0
- package/dist/vendor/resources/beta/organization/federation/federation.js +13 -0
- package/dist/vendor/resources/beta/organization/federation/federation.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/index.d.ts +3 -0
- package/dist/vendor/resources/beta/organization/federation/index.js +5 -0
- package/dist/vendor/resources/beta/organization/federation/index.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/issuers.d.ts +352 -0
- package/dist/vendor/resources/beta/organization/federation/issuers.js +165 -0
- package/dist/vendor/resources/beta/organization/federation/issuers.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/rules/index.d.ts +2 -0
- package/dist/vendor/resources/beta/organization/federation/rules/index.js +4 -0
- package/dist/vendor/resources/beta/organization/federation/rules/index.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/rules/rules.d.ts +467 -0
- package/dist/vendor/resources/beta/organization/federation/rules/rules.js +190 -0
- package/dist/vendor/resources/beta/organization/federation/rules/rules.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/rules/workspaces.d.ts +123 -0
- package/dist/vendor/resources/beta/organization/federation/rules/workspaces.js +110 -0
- package/dist/vendor/resources/beta/organization/federation/rules/workspaces.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation/rules.d.ts +1 -0
- package/dist/vendor/resources/beta/organization/federation/rules.js +3 -0
- package/dist/vendor/resources/beta/organization/federation/rules.js.map +1 -0
- package/dist/vendor/resources/beta/organization/federation.d.ts +1 -0
- package/dist/vendor/resources/beta/organization/federation.js +3 -0
- package/dist/vendor/resources/beta/organization/federation.js.map +1 -0
- package/dist/vendor/resources/beta/organization/index.d.ts +10 -0
- package/dist/vendor/resources/beta/organization/index.js +12 -0
- package/dist/vendor/resources/beta/organization/index.js.map +1 -0
- package/dist/vendor/resources/beta/organization/invites.d.ts +161 -0
- package/dist/vendor/resources/beta/organization/invites.js +72 -0
- package/dist/vendor/resources/beta/organization/invites.js.map +1 -0
- package/dist/vendor/resources/beta/organization/organization.d.ts +72 -0
- package/dist/vendor/resources/beta/organization/organization.js +54 -0
- package/dist/vendor/resources/beta/organization/organization.js.map +1 -0
- package/dist/vendor/resources/beta/organization/rate-limits.d.ts +76 -0
- package/dist/vendor/resources/beta/organization/rate-limits.js +27 -0
- package/dist/vendor/resources/beta/organization/rate-limits.js.map +1 -0
- package/dist/vendor/resources/beta/organization/service-accounts/index.d.ts +2 -0
- package/dist/vendor/resources/beta/organization/service-accounts/index.js +4 -0
- package/dist/vendor/resources/beta/organization/service-accounts/index.js.map +1 -0
- package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.d.ts +257 -0
- package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.js +166 -0
- package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.js.map +1 -0
- package/dist/vendor/resources/beta/organization/service-accounts/workspaces.d.ts +140 -0
- package/dist/vendor/resources/beta/organization/service-accounts/workspaces.js +121 -0
- package/dist/vendor/resources/beta/organization/service-accounts/workspaces.js.map +1 -0
- package/dist/vendor/resources/beta/organization/service-accounts.d.ts +1 -0
- package/dist/vendor/resources/beta/organization/service-accounts.js +3 -0
- package/dist/vendor/resources/beta/organization/service-accounts.js.map +1 -0
- package/dist/vendor/resources/beta/organization/users.d.ts +123 -0
- package/dist/vendor/resources/beta/organization/users.js +63 -0
- package/dist/vendor/resources/beta/organization/users.js.map +1 -0
- package/dist/vendor/resources/beta/organization/workspaces/index.d.ts +4 -0
- package/dist/vendor/resources/beta/organization/workspaces/index.js +6 -0
- package/dist/vendor/resources/beta/organization/workspaces/index.js.map +1 -0
- package/dist/vendor/resources/beta/organization/workspaces/members.d.ts +134 -0
- package/dist/vendor/resources/beta/organization/workspaces/members.js +98 -0
- package/dist/vendor/resources/beta/organization/workspaces/members.js.map +1 -0
- package/dist/vendor/resources/beta/organization/workspaces/rate-limits.d.ts +82 -0
- package/dist/vendor/resources/beta/organization/workspaces/rate-limits.js +30 -0
- package/dist/vendor/resources/beta/organization/workspaces/rate-limits.js.map +1 -0
- package/dist/vendor/resources/beta/organization/workspaces/service-accounts.d.ts +209 -0
- package/dist/vendor/resources/beta/organization/workspaces/service-accounts.js +185 -0
- package/dist/vendor/resources/beta/organization/workspaces/service-accounts.js.map +1 -0
- package/dist/vendor/resources/beta/organization/workspaces/workspaces.d.ts +302 -0
- package/dist/vendor/resources/beta/organization/workspaces/workspaces.js +104 -0
- package/dist/vendor/resources/beta/organization/workspaces/workspaces.js.map +1 -0
- package/dist/vendor/resources/beta/organization/workspaces.d.ts +1 -0
- package/dist/vendor/resources/beta/organization/workspaces.js +3 -0
- package/dist/vendor/resources/beta/organization/workspaces.js.map +1 -0
- package/dist/vendor/resources/beta/organization.d.ts +1 -0
- package/dist/vendor/resources/beta/organization.js +3 -0
- package/dist/vendor/resources/beta/organization.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/events.d.ts +1513 -0
- package/dist/vendor/resources/beta/sessions/events.js +115 -0
- package/dist/vendor/resources/beta/sessions/events.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/index.d.ts +4 -0
- package/dist/vendor/resources/beta/sessions/index.js +6 -0
- package/dist/vendor/resources/beta/sessions/index.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/resources.d.ts +227 -0
- package/dist/vendor/resources/beta/sessions/resources.js +128 -0
- package/dist/vendor/resources/beta/sessions/resources.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/sessions.d.ts +866 -0
- package/dist/vendor/resources/beta/sessions/sessions.js +150 -0
- package/dist/vendor/resources/beta/sessions/sessions.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/threads/events.d.ts +77 -0
- package/dist/vendor/resources/beta/sessions/threads/events.js +57 -0
- package/dist/vendor/resources/beta/sessions/threads/events.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/threads/index.d.ts +2 -0
- package/dist/vendor/resources/beta/sessions/threads/index.js +4 -0
- package/dist/vendor/resources/beta/sessions/threads/index.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/threads/threads.d.ts +195 -0
- package/dist/vendor/resources/beta/sessions/threads/threads.js +80 -0
- package/dist/vendor/resources/beta/sessions/threads/threads.js.map +1 -0
- package/dist/vendor/resources/beta/sessions/threads.d.ts +1 -0
- package/dist/vendor/resources/beta/sessions/threads.js +3 -0
- package/dist/vendor/resources/beta/sessions/threads.js.map +1 -0
- package/dist/vendor/resources/beta/sessions.d.ts +1 -0
- package/dist/vendor/resources/beta/sessions.js +3 -0
- package/dist/vendor/resources/beta/sessions.js.map +1 -0
- package/dist/vendor/resources/beta/skills/index.d.ts +2 -0
- package/dist/vendor/resources/beta/skills/index.js +4 -0
- package/dist/vendor/resources/beta/skills/index.js.map +1 -0
- package/dist/vendor/resources/beta/skills/skills.d.ts +178 -0
- package/dist/vendor/resources/beta/skills/skills.js +96 -0
- package/dist/vendor/resources/beta/skills/skills.js.map +1 -0
- package/dist/vendor/resources/beta/skills/versions.d.ts +181 -0
- package/dist/vendor/resources/beta/skills/versions.js +125 -0
- package/dist/vendor/resources/beta/skills/versions.js.map +1 -0
- package/dist/vendor/resources/beta/skills.d.ts +1 -0
- package/dist/vendor/resources/beta/skills.js +3 -0
- package/dist/vendor/resources/beta/skills.js.map +1 -0
- package/dist/vendor/resources/beta/tunnels/certificates.d.ts +162 -0
- package/dist/vendor/resources/beta/tunnels/certificates.js +125 -0
- package/dist/vendor/resources/beta/tunnels/certificates.js.map +1 -0
- package/dist/vendor/resources/beta/tunnels/index.d.ts +2 -0
- package/dist/vendor/resources/beta/tunnels/index.js +4 -0
- package/dist/vendor/resources/beta/tunnels/index.js.map +1 -0
- package/dist/vendor/resources/beta/tunnels/tunnels.d.ts +211 -0
- package/dist/vendor/resources/beta/tunnels/tunnels.js +173 -0
- package/dist/vendor/resources/beta/tunnels/tunnels.js.map +1 -0
- package/dist/vendor/resources/beta/tunnels.d.ts +1 -0
- package/dist/vendor/resources/beta/tunnels.js +3 -0
- package/dist/vendor/resources/beta/tunnels.js.map +1 -0
- package/dist/vendor/resources/beta/user-profiles.d.ts +244 -0
- package/dist/vendor/resources/beta/user-profiles.js +114 -0
- package/dist/vendor/resources/beta/user-profiles.js.map +1 -0
- package/dist/vendor/resources/beta/vaults/credentials.d.ts +715 -0
- package/dist/vendor/resources/beta/vaults/credentials.js +173 -0
- package/dist/vendor/resources/beta/vaults/credentials.js.map +1 -0
- package/dist/vendor/resources/beta/vaults/index.d.ts +2 -0
- package/dist/vendor/resources/beta/vaults/index.js +4 -0
- package/dist/vendor/resources/beta/vaults/index.js.map +1 -0
- package/dist/vendor/resources/beta/vaults/vaults.d.ts +191 -0
- package/dist/vendor/resources/beta/vaults/vaults.js +141 -0
- package/dist/vendor/resources/beta/vaults/vaults.js.map +1 -0
- package/dist/vendor/resources/beta/vaults.d.ts +1 -0
- package/dist/vendor/resources/beta/vaults.js +3 -0
- package/dist/vendor/resources/beta/vaults.js.map +1 -0
- package/dist/vendor/resources/beta/webhooks.d.ts +464 -0
- package/dist/vendor/resources/beta/webhooks.js +29 -0
- package/dist/vendor/resources/beta/webhooks.js.map +1 -0
- package/dist/vendor/resources/beta.d.ts +1 -0
- package/dist/vendor/resources/beta.js +3 -0
- package/dist/vendor/resources/beta.js.map +1 -0
- package/dist/vendor/resources/completions.d.ts +172 -0
- package/dist/vendor/resources/completions.js +19 -0
- package/dist/vendor/resources/completions.js.map +1 -0
- package/dist/vendor/resources/files.d.ts +104 -0
- package/dist/vendor/resources/files.js +48 -0
- package/dist/vendor/resources/files.js.map +1 -0
- package/dist/vendor/resources/index.d.ts +7 -0
- package/dist/vendor/resources/index.js +9 -0
- package/dist/vendor/resources/index.js.map +1 -0
- package/dist/vendor/resources/messages/batches.d.ts +312 -0
- package/dist/vendor/resources/messages/batches.js +157 -0
- package/dist/vendor/resources/messages/batches.js.map +1 -0
- package/dist/vendor/resources/messages/index.d.ts +2 -0
- package/dist/vendor/resources/messages/index.js +4 -0
- package/dist/vendor/resources/messages/index.js.map +1 -0
- package/dist/vendor/resources/messages/messages.d.ts +3886 -0
- package/dist/vendor/resources/messages/messages.js +130 -0
- package/dist/vendor/resources/messages/messages.js.map +1 -0
- package/dist/vendor/resources/messages.d.ts +1 -0
- package/dist/vendor/resources/messages.js +3 -0
- package/dist/vendor/resources/messages.js.map +1 -0
- package/dist/vendor/resources/models.d.ts +196 -0
- package/dist/vendor/resources/models.js +41 -0
- package/dist/vendor/resources/models.js.map +1 -0
- package/dist/vendor/resources/shared.d.ts +43 -0
- package/dist/vendor/resources/shared.js +3 -0
- package/dist/vendor/resources/shared.js.map +1 -0
- package/dist/vendor/resources/skills/index.d.ts +2 -0
- package/dist/vendor/resources/skills/index.js +4 -0
- package/dist/vendor/resources/skills/index.js.map +1 -0
- package/dist/vendor/resources/skills/skills.d.ts +128 -0
- package/dist/vendor/resources/skills/skills.js +36 -0
- package/dist/vendor/resources/skills/skills.js.map +1 -0
- package/dist/vendor/resources/skills/versions.d.ts +103 -0
- package/dist/vendor/resources/skills/versions.js +37 -0
- package/dist/vendor/resources/skills/versions.js.map +1 -0
- package/dist/vendor/resources/skills.d.ts +1 -0
- package/dist/vendor/resources/skills.js +3 -0
- package/dist/vendor/resources/skills.js.map +1 -0
- package/dist/vendor/resources/top-level.d.ts +1 -0
- package/dist/vendor/resources/top-level.js +3 -0
- package/dist/vendor/resources/top-level.js.map +1 -0
- package/dist/vendor/resources.d.ts +1 -0
- package/dist/vendor/resources.js +2 -0
- package/dist/vendor/resources.js.map +1 -0
- package/dist/vendor/streaming.d.ts +2 -0
- package/dist/vendor/streaming.js +3 -0
- package/dist/vendor/streaming.js.map +1 -0
- package/dist/vendor/tools/agent-toolset/fs-util.d.ts +74 -0
- package/dist/vendor/tools/agent-toolset/fs-util.js +184 -0
- package/dist/vendor/tools/agent-toolset/fs-util.js.map +1 -0
- package/dist/vendor/tools/agent-toolset/memories.d.ts +172 -0
- package/dist/vendor/tools/agent-toolset/memories.js +910 -0
- package/dist/vendor/tools/agent-toolset/memories.js.map +1 -0
- package/dist/vendor/tools/agent-toolset/node.browser.d.ts +80 -0
- package/dist/vendor/tools/agent-toolset/node.browser.js +129 -0
- package/dist/vendor/tools/agent-toolset/node.browser.js.map +1 -0
- package/dist/vendor/tools/agent-toolset/node.d.ts +191 -0
- package/dist/vendor/tools/agent-toolset/node.js +886 -0
- package/dist/vendor/tools/agent-toolset/node.js.map +1 -0
- package/dist/vendor/tools/agent-toolset/skills.d.ts +73 -0
- package/dist/vendor/tools/agent-toolset/skills.js +320 -0
- package/dist/vendor/tools/agent-toolset/skills.js.map +1 -0
- package/dist/vendor/tools/agent-toolset/sync-interval.d.ts +18 -0
- package/dist/vendor/tools/agent-toolset/sync-interval.js +25 -0
- package/dist/vendor/tools/agent-toolset/sync-interval.js.map +1 -0
- package/dist/vendor/tools/memory/node.browser.d.ts +26 -0
- package/dist/vendor/tools/memory/node.browser.js +44 -0
- package/dist/vendor/tools/memory/node.browser.js.map +1 -0
- package/dist/vendor/tools/memory/node.d.ts +17 -0
- package/dist/vendor/tools/memory/node.js +327 -0
- package/dist/vendor/tools/memory/node.js.map +1 -0
- package/dist/vendor/uploads.d.ts +2 -0
- package/dist/vendor/uploads.js +3 -0
- package/dist/vendor/uploads.js.map +1 -0
- package/dist/vendor/version.d.ts +1 -0
- package/dist/vendor/version.js +2 -0
- package/dist/vendor/version.js.map +1 -0
- package/package.json +7 -14
- package/sdk.cjs +2 -2
- package/sdk.cjs.map +2 -2
- package/sdk.d.ts +1 -1
- package/sdk.mjs +2 -2
- package/sdk.mjs.map +3 -3
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { ReadableStreamFrom } from './shims.js';
|
|
2
|
+
export const checkFileSupport = () => {
|
|
3
|
+
if (typeof File === 'undefined') {
|
|
4
|
+
const { process } = globalThis;
|
|
5
|
+
const isOldNode = typeof process?.versions?.node === 'string' && parseInt(process.versions.node.split('.')) < 20;
|
|
6
|
+
throw new Error('`File` is not defined as a global, which is required for file uploads.' +
|
|
7
|
+
(isOldNode ?
|
|
8
|
+
" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`."
|
|
9
|
+
: ''));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Construct a `File` instance. This is used to ensure a helpful error is thrown
|
|
14
|
+
* for environments that don't define a global `File` yet.
|
|
15
|
+
*/
|
|
16
|
+
export function makeFile(fileBits, fileName, options) {
|
|
17
|
+
checkFileSupport();
|
|
18
|
+
return new File(fileBits, fileName ?? 'unknown_file', options);
|
|
19
|
+
}
|
|
20
|
+
export function getName(value, stripPath) {
|
|
21
|
+
const val = (typeof value === 'object' &&
|
|
22
|
+
value !== null &&
|
|
23
|
+
(('name' in value && value.name && String(value.name)) ||
|
|
24
|
+
('url' in value && value.url && String(value.url)) ||
|
|
25
|
+
('filename' in value && value.filename && String(value.filename)) ||
|
|
26
|
+
('path' in value && value.path && String(value.path)))) ||
|
|
27
|
+
'';
|
|
28
|
+
return stripPath ? val.split(/[\\/]/).pop() || undefined : val;
|
|
29
|
+
}
|
|
30
|
+
export const isAsyncIterable = (value) => value != null && typeof value === 'object' && typeof value[Symbol.asyncIterator] === 'function';
|
|
31
|
+
/**
|
|
32
|
+
* Returns a multipart/form-data request if any part of the given request body contains a File / Blob value.
|
|
33
|
+
* Otherwise returns the request as is.
|
|
34
|
+
*/
|
|
35
|
+
export const maybeMultipartFormRequestOptions = async (opts, fetch) => {
|
|
36
|
+
if (!hasUploadableValue(opts.body))
|
|
37
|
+
return opts;
|
|
38
|
+
return { ...opts, body: await createForm(opts.body, fetch) };
|
|
39
|
+
};
|
|
40
|
+
export const multipartFormRequestOptions = async (opts, fetch, stripFilenames = true) => {
|
|
41
|
+
return { ...opts, body: await createForm(opts.body, fetch, stripFilenames) };
|
|
42
|
+
};
|
|
43
|
+
const supportsFormDataMap = /* @__PURE__ */ new WeakMap();
|
|
44
|
+
/**
|
|
45
|
+
* node-fetch doesn't support the global FormData object in recent node versions. Instead of sending
|
|
46
|
+
* properly-encoded form data, it just stringifies the object, resulting in a request body of "[object FormData]".
|
|
47
|
+
* This function detects if the fetch function provided supports the global FormData object to avoid
|
|
48
|
+
* confusing error messages later on.
|
|
49
|
+
*/
|
|
50
|
+
function supportsFormData(fetchObject) {
|
|
51
|
+
const fetch = typeof fetchObject === 'function' ? fetchObject : fetchObject.fetch;
|
|
52
|
+
const cached = supportsFormDataMap.get(fetch);
|
|
53
|
+
if (cached)
|
|
54
|
+
return cached;
|
|
55
|
+
const promise = (async () => {
|
|
56
|
+
try {
|
|
57
|
+
const FetchResponse = ('Response' in fetch ?
|
|
58
|
+
fetch.Response
|
|
59
|
+
: (await fetch('data:,')).constructor);
|
|
60
|
+
const data = new FormData();
|
|
61
|
+
if (data.toString() === (await new FetchResponse(data).text())) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// avoid false negatives
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
supportsFormDataMap.set(fetch, promise);
|
|
72
|
+
return promise;
|
|
73
|
+
}
|
|
74
|
+
export const createForm = async (body, fetch, stripFilenames = true) => {
|
|
75
|
+
if (!(await supportsFormData(fetch))) {
|
|
76
|
+
throw new TypeError('The provided fetch function does not support file uploads with the current global FormData class.');
|
|
77
|
+
}
|
|
78
|
+
const form = new FormData();
|
|
79
|
+
await Promise.all(Object.entries(body || {}).map(([key, value]) => addFormValue(form, key, value, stripFilenames)));
|
|
80
|
+
return form;
|
|
81
|
+
};
|
|
82
|
+
// Blob, not File: bare Blobs and Bun.file() results don't inherit from File.
|
|
83
|
+
const isUploadable = (value) => typeof value === 'object' &&
|
|
84
|
+
value !== null &&
|
|
85
|
+
(value instanceof Response || isAsyncIterable(value) || value instanceof Blob);
|
|
86
|
+
const hasUploadableValue = (value) => {
|
|
87
|
+
if (isUploadable(value))
|
|
88
|
+
return true;
|
|
89
|
+
if (Array.isArray(value))
|
|
90
|
+
return value.some(hasUploadableValue);
|
|
91
|
+
if (value && typeof value === 'object') {
|
|
92
|
+
for (const k in value) {
|
|
93
|
+
if (hasUploadableValue(value[k]))
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
const addFormValue = async (form, key, value, stripFilenames) => {
|
|
100
|
+
if (value === undefined)
|
|
101
|
+
return;
|
|
102
|
+
if (value == null) {
|
|
103
|
+
throw new TypeError(`Received null for "${key}"; to pass null in FormData, you must use the string 'null'`);
|
|
104
|
+
}
|
|
105
|
+
// TODO: make nested formats configurable
|
|
106
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
107
|
+
form.append(key, String(value));
|
|
108
|
+
}
|
|
109
|
+
else if (value instanceof Response) {
|
|
110
|
+
let options = {};
|
|
111
|
+
const contentType = value.headers.get('Content-Type');
|
|
112
|
+
if (contentType) {
|
|
113
|
+
options = { type: contentType };
|
|
114
|
+
}
|
|
115
|
+
form.append(key, makeFile([await value.blob()], getName(value, stripFilenames), options));
|
|
116
|
+
}
|
|
117
|
+
else if (isAsyncIterable(value)) {
|
|
118
|
+
form.append(key, makeFile([await new Response(ReadableStreamFrom(value)).blob()], getName(value, stripFilenames)));
|
|
119
|
+
}
|
|
120
|
+
else if (value instanceof Blob) {
|
|
121
|
+
form.append(key, makeFile([value], getName(value, stripFilenames) || undefined, { type: value.type }));
|
|
122
|
+
}
|
|
123
|
+
else if (Array.isArray(value)) {
|
|
124
|
+
await Promise.all(value.map((entry) => addFormValue(form, key + '[]', entry, stripFilenames)));
|
|
125
|
+
}
|
|
126
|
+
else if (typeof value.then === 'function') {
|
|
127
|
+
throw new TypeError(`Received a Promise for "${key}"; await it first, e.g. \`await toFile(...)\``);
|
|
128
|
+
}
|
|
129
|
+
else if (value instanceof ArrayBuffer || ArrayBuffer.isView(value)) {
|
|
130
|
+
throw new TypeError(`Received ${value.constructor.name} for "${key}"; to upload raw bytes, wrap them with \`await toFile(bytes, 'filename')\``);
|
|
131
|
+
}
|
|
132
|
+
else if (typeof value === 'object') {
|
|
133
|
+
await Promise.all(Object.entries(value).map(([name, prop]) => addFormValue(form, `${key}[${name}]`, prop, stripFilenames)));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${value} instead`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=uploads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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C,CAAC,CAAC;IACjG,CAAC;SAAM,IAAI,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,SAAS,CAAC,2BAA2B,GAAG,+CAA+C,CAAC,CAAC;IACrG,CAAC;SAAM,IAAI,KAAK,YAAY,WAAW,IAAI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,SAAS,CACjB,YAAY,KAAK,CAAC,WAAW,CAAC,IAAI,SAAS,GAAG,4EAA4E,CAC3H,CAAC;IACJ,CAAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACrC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CACzC,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,CAC5D,CACF,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,SAAS,CACjB,wGAAwG,KAAK,UAAU,CACxH,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain an external {@link AbortSignal} into a local {@link AbortController}:
|
|
3
|
+
* the controller aborts whenever `external` aborts (synchronously if it is
|
|
4
|
+
* already aborted).
|
|
5
|
+
*
|
|
6
|
+
* Returns a cleanup function that detaches the listener. Callers MUST invoke it
|
|
7
|
+
* on their normal teardown path — `{ once: true }` only removes the listener if
|
|
8
|
+
* abort actually fires, so a long-lived `external` signal would otherwise leak one
|
|
9
|
+
* listener per controller.
|
|
10
|
+
*/
|
|
11
|
+
export declare function linkAbort(external: AbortSignal | null | undefined, controller: AbortController): () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chain an external {@link AbortSignal} into a local {@link AbortController}:
|
|
3
|
+
* the controller aborts whenever `external` aborts (synchronously if it is
|
|
4
|
+
* already aborted).
|
|
5
|
+
*
|
|
6
|
+
* Returns a cleanup function that detaches the listener. Callers MUST invoke it
|
|
7
|
+
* on their normal teardown path — `{ once: true }` only removes the listener if
|
|
8
|
+
* abort actually fires, so a long-lived `external` signal would otherwise leak one
|
|
9
|
+
* listener per controller.
|
|
10
|
+
*/
|
|
11
|
+
export function linkAbort(external, controller) {
|
|
12
|
+
if (!external)
|
|
13
|
+
return () => { };
|
|
14
|
+
if (external.aborted) {
|
|
15
|
+
controller.abort();
|
|
16
|
+
return () => { };
|
|
17
|
+
}
|
|
18
|
+
const onAbort = () => controller.abort();
|
|
19
|
+
external.addEventListener('abort', onAbort);
|
|
20
|
+
return () => external.removeEventListener('abort', onAbort);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=abort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort.js","sourceRoot":"","sources":["../../../../src/vendor/internal/utils/abort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,QAAwC,EAAE,UAA2B;IAC7F,IAAI,CAAC,QAAQ;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAC/B,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrB,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IACzC,QAAQ,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type AsyncQueueResult<T> = {
|
|
2
|
+
done: false;
|
|
3
|
+
value: T;
|
|
4
|
+
} | {
|
|
5
|
+
done: true;
|
|
6
|
+
value: undefined;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Single-consumer async queue that bridges background producers to an
|
|
10
|
+
* `AsyncIterator`-style reader. Producers `push()` items; the consumer awaits
|
|
11
|
+
* `next()`. `close()` is idempotent and wakes any pending `next()` with
|
|
12
|
+
* `done: true`. `tryShift()` synchronously drains remaining items after
|
|
13
|
+
* iteration has been signalled to stop.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AsyncQueue<T> {
|
|
16
|
+
#private;
|
|
17
|
+
/** Enqueue an item, or hand it directly to a waiting reader. Returns `false` once closed. */
|
|
18
|
+
push(item: T): boolean;
|
|
19
|
+
/** Mark the queue done. Idempotent; wakes every pending reader with `done: true`. */
|
|
20
|
+
close(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve with the next item, or `done: true` once the queue is closed and
|
|
23
|
+
* drained. When `signal` is supplied, aborting it resolves a pending read
|
|
24
|
+
* with `done: true` (cancellation is pushed down here rather than handled by
|
|
25
|
+
* an outer `Promise.race`).
|
|
26
|
+
*/
|
|
27
|
+
next(signal?: AbortSignal): Promise<AsyncQueueResult<T>>;
|
|
28
|
+
/** Synchronously remove and return the next buffered item, or `undefined` if empty. */
|
|
29
|
+
tryShift(): T | undefined;
|
|
30
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single-consumer async queue that bridges background producers to an
|
|
3
|
+
* `AsyncIterator`-style reader. Producers `push()` items; the consumer awaits
|
|
4
|
+
* `next()`. `close()` is idempotent and wakes any pending `next()` with
|
|
5
|
+
* `done: true`. `tryShift()` synchronously drains remaining items after
|
|
6
|
+
* iteration has been signalled to stop.
|
|
7
|
+
*/
|
|
8
|
+
export class AsyncQueue {
|
|
9
|
+
#items = [];
|
|
10
|
+
#waiters = [];
|
|
11
|
+
#closed = false;
|
|
12
|
+
/** Enqueue an item, or hand it directly to a waiting reader. Returns `false` once closed. */
|
|
13
|
+
push(item) {
|
|
14
|
+
if (this.#closed)
|
|
15
|
+
return false;
|
|
16
|
+
const w = this.#waiters.shift();
|
|
17
|
+
if (w)
|
|
18
|
+
w({ done: false, value: item });
|
|
19
|
+
else
|
|
20
|
+
this.#items.push(item);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
/** Mark the queue done. Idempotent; wakes every pending reader with `done: true`. */
|
|
24
|
+
close() {
|
|
25
|
+
if (this.#closed)
|
|
26
|
+
return;
|
|
27
|
+
this.#closed = true;
|
|
28
|
+
while (this.#waiters.length > 0) {
|
|
29
|
+
const w = this.#waiters.shift();
|
|
30
|
+
w({ done: true, value: undefined });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Resolve with the next item, or `done: true` once the queue is closed and
|
|
35
|
+
* drained. When `signal` is supplied, aborting it resolves a pending read
|
|
36
|
+
* with `done: true` (cancellation is pushed down here rather than handled by
|
|
37
|
+
* an outer `Promise.race`).
|
|
38
|
+
*/
|
|
39
|
+
next(signal) {
|
|
40
|
+
if (this.#items.length > 0) {
|
|
41
|
+
return Promise.resolve({ done: false, value: this.#items.shift() });
|
|
42
|
+
}
|
|
43
|
+
if (this.#closed || signal?.aborted) {
|
|
44
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
45
|
+
}
|
|
46
|
+
return new Promise((resolve) => {
|
|
47
|
+
const waiter = (r) => {
|
|
48
|
+
signal?.removeEventListener('abort', onAbort);
|
|
49
|
+
resolve(r);
|
|
50
|
+
};
|
|
51
|
+
const onAbort = () => {
|
|
52
|
+
const idx = this.#waiters.indexOf(waiter);
|
|
53
|
+
if (idx >= 0)
|
|
54
|
+
this.#waiters.splice(idx, 1);
|
|
55
|
+
resolve({ done: true, value: undefined });
|
|
56
|
+
};
|
|
57
|
+
this.#waiters.push(waiter);
|
|
58
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/** Synchronously remove and return the next buffered item, or `undefined` if empty. */
|
|
62
|
+
tryShift() {
|
|
63
|
+
return this.#items.shift();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=async-queue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-queue.js","sourceRoot":"","sources":["../../../../src/vendor/internal/utils/async-queue.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IACrB,MAAM,GAAQ,EAAE,CAAC;IACjB,QAAQ,GAA4C,EAAE,CAAC;IACvD,OAAO,GAAG,KAAK,CAAC;IAEhB,6FAA6F;IAC7F,IAAI,CAAC,IAAO;QACV,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAC/B,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC;YAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;;YAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qFAAqF;IACrF,KAAK;QACH,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAChC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAG,CAAC;YACjC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,MAAoB;QACvB,IAAI,IAAI,CAAC,MA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 @@
|
|
|
1
|
+
/** True when `e` is an {@link APIError} whose HTTP status equals `code`. */
|
|
2
|
+
export declare function isStatus(e: unknown, code: number): boolean;
|
|
3
|
+
/** True when `e` is an {@link APIError} with a 4xx status. */
|
|
4
|
+
export declare function is4xx(e: unknown): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* True for a 4xx that the core client's retry policy would *not* retry, i.e. a
|
|
7
|
+
* permanent client error. 408 (request timeout), 409 (lock timeout) and 429
|
|
8
|
+
* (rate limit) are retryable for the base client (`PukuAI.shouldRetry`), so
|
|
9
|
+
* they are not treated as fatal here — keeping helper retry behaviour aligned
|
|
10
|
+
* with the rest of the SDK.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isFatal4xx(e: unknown): boolean;
|
|
13
|
+
/** Exponential backoff: `baseMs * 2 ** attempt`, clamped to `capMs`. */
|
|
14
|
+
export declare function backoff(attempt: number, baseMs: number, capMs: number): number;
|
|
15
|
+
/** Uniform random delay in the half-open interval `[lowMs, highMs)`. */
|
|
16
|
+
export declare function jitter(lowMs: number, highMs: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Trim up to 25% off `ms` at random so a fleet of clients backing off after a
|
|
19
|
+
* shared outage does not retry in lockstep — mirrors the jitter the core client
|
|
20
|
+
* applies to its own retry timeout.
|
|
21
|
+
*/
|
|
22
|
+
export declare function applyJitter(ms: number): number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { APIError } from '../../core/error.js';
|
|
2
|
+
/** True when `e` is an {@link APIError} whose HTTP status equals `code`. */
|
|
3
|
+
export function isStatus(e, code) {
|
|
4
|
+
return e instanceof APIError && e.status === code;
|
|
5
|
+
}
|
|
6
|
+
/** True when `e` is an {@link APIError} with a 4xx status. */
|
|
7
|
+
export function is4xx(e) {
|
|
8
|
+
return e instanceof APIError && typeof e.status === 'number' && e.status >= 400 && e.status < 500;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* True for a 4xx that the core client's retry policy would *not* retry, i.e. a
|
|
12
|
+
* permanent client error. 408 (request timeout), 409 (lock timeout) and 429
|
|
13
|
+
* (rate limit) are retryable for the base client (`PukuAI.shouldRetry`), so
|
|
14
|
+
* they are not treated as fatal here — keeping helper retry behaviour aligned
|
|
15
|
+
* with the rest of the SDK.
|
|
16
|
+
*/
|
|
17
|
+
export function isFatal4xx(e) {
|
|
18
|
+
return is4xx(e) && !isStatus(e, 408) && !isStatus(e, 409) && !isStatus(e, 429);
|
|
19
|
+
}
|
|
20
|
+
/** Exponential backoff: `baseMs * 2 ** attempt`, clamped to `capMs`. */
|
|
21
|
+
export function backoff(attempt, baseMs, capMs) {
|
|
22
|
+
return Math.min(baseMs * 2 ** attempt, capMs);
|
|
23
|
+
}
|
|
24
|
+
/** Uniform random delay in the half-open interval `[lowMs, highMs)`. */
|
|
25
|
+
export function jitter(lowMs, highMs) {
|
|
26
|
+
return lowMs + Math.random() * (highMs - lowMs);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Trim up to 25% off `ms` at random so a fleet of clients backing off after a
|
|
30
|
+
* shared outage does not retry in lockstep — mirrors the jitter the core client
|
|
31
|
+
* applies to its own retry timeout.
|
|
32
|
+
*/
|
|
33
|
+
export function applyJitter(ms) {
|
|
34
|
+
return ms * (1 - Math.random() * 0.25);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=backoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../../src/vendor/internal/utils/backoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,4EAA4E;AAC5E,MAAM,UAAU,QAAQ,CAAC,CAAU,EAAE,IAAY;IAC/C,OAAO,CAAC,YAAY,QAAQ,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC;AACpD,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,KAAK,CAAC,CAAU;IAC9B,OAAO,CAAC,YAAY,QAAQ,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC;AACpG,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACjF,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,MAAc,EAAE,KAAa;IACpE,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,MAAM,CAAC,KAAa,EAAE,MAAc;IAClD,OAAO,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,EAAE,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { PukuError } from '../../core/error.js';
|
|
3
|
+
import { encodeUTF8 } from './bytes.js';
|
|
4
|
+
export const toBase64 = (data) => {
|
|
5
|
+
if (!data)
|
|
6
|
+
return '';
|
|
7
|
+
if (typeof globalThis.Buffer !== 'undefined') {
|
|
8
|
+
return globalThis.Buffer.from(data).toString('base64');
|
|
9
|
+
}
|
|
10
|
+
if (typeof data === 'string') {
|
|
11
|
+
data = encodeUTF8(data);
|
|
12
|
+
}
|
|
13
|
+
if (typeof btoa !== 'undefined') {
|
|
14
|
+
return btoa(String.fromCharCode.apply(null, data));
|
|
15
|
+
}
|
|
16
|
+
throw new PukuError('Cannot generate base64 string; Expected `Buffer` or `btoa` to be defined');
|
|
17
|
+
};
|
|
18
|
+
export const fromBase64 = (str) => {
|
|
19
|
+
if (typeof globalThis.Buffer !== 'undefined') {
|
|
20
|
+
const buf = globalThis.Buffer.from(str, 'base64');
|
|
21
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
22
|
+
}
|
|
23
|
+
if (typeof atob !== 'undefined') {
|
|
24
|
+
const bstr = atob(str);
|
|
25
|
+
const buf = new Uint8Array(bstr.length);
|
|
26
|
+
for (let i = 0; i < bstr.length; i++) {
|
|
27
|
+
buf[i] = bstr.charCodeAt(i);
|
|
28
|
+
}
|
|
29
|
+
return buf;
|
|
30
|
+
}
|
|
31
|
+
throw new PukuError('Cannot decode base64 string; Expected `Buffer` or `atob` to be defined');
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=base64.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../../src/vendor/internal/utils/base64.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAA4C,EAAU,EAAE;IAC/E,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,IAAI,OAAQ,UAAkB,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;QACtD,OAAQ,UAAkB,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED,IA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ffers) {
|
|
4
|
+
length += buffer.length;
|
|
5
|
+
}
|
|
6
|
+
const output = new Uint8Array(length);
|
|
7
|
+
let index = 0;
|
|
8
|
+
for (const buffer of buffers) {
|
|
9
|
+
output.set(buffer, index);
|
|
10
|
+
index += buffer.length;
|
|
11
|
+
}
|
|
12
|
+
return output;
|
|
13
|
+
}
|
|
14
|
+
let encodeUTF8_;
|
|
15
|
+
export function encodeUTF8(str) {
|
|
16
|
+
let encoder;
|
|
17
|
+
return (encodeUTF8_ ??
|
|
18
|
+
((encoder = new globalThis.TextEncoder()), (encodeUTF8_ = encoder.encode.bind(encoder))))(str);
|
|
19
|
+
}
|
|
20
|
+
let decodeUTF8_;
|
|
21
|
+
export function decodeUTF8(bytes) {
|
|
22
|
+
let decoder;
|
|
23
|
+
return (decodeUTF8_ ??
|
|
24
|
+
((decoder = new globalThis.TextDecoder()), (decodeUTF8_ = decoder.decode.bind(decoder))))(bytes);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=bytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../../src/vendor/internal/utils/bytes.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,OAAqB;IAC/C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC;IAC1B,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC1B,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,IAAI,WAAwC,CAAC;AAC7C,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,IAAI,OAAO,CAAC;IACZ,OAAO,CACL,WAAW;QACX,CAAC,CAAC,OAAO,GAAG,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAClG,CAAC,GAAG,CAAC,CAAC;AACT,CAAC;AAED,IAAI,WAA0C,CAAC;AAC/C,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,IAAI,OAAO,CAAC;IACZ,OAAO,CACL,WAAW;QACX,CAAC,CAAC,OAAO,GAAG,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAClG,CAAC,KAAK,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
/**
|
|
3
|
+
* Read an environment variable.
|
|
4
|
+
*
|
|
5
|
+
* Trims beginning and trailing whitespace.
|
|
6
|
+
*
|
|
7
|
+
* Will return undefined if the environment variable doesn't exist or cannot be accessed.
|
|
8
|
+
*/
|
|
9
|
+
export const readEnv = (env) => {
|
|
10
|
+
if (typeof globalThis.process !== 'undefined') {
|
|
11
|
+
return globalThis.process.env?.[env]?.trim() || undefined;
|
|
12
|
+
}
|
|
13
|
+
if (typeof globalThis.Deno !== 'undefined') {
|
|
14
|
+
return globalThis.Deno.env?.get?.(env)?.trim() || undefined;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../../../src/vendor/internal/utils/env.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAsB,EAAE;IACzD,IAAI,OAAQ,UAAkB,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACvD,OAAQ,UAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACrE,CAAC;IACD,IAAI,OAAQ,UAAkB,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;QACpD,OAAQ,UAAkB,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,SAAS,CAAC;IACvE,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type BasePuku } from '../../client';
|
|
2
|
+
import { RequestOptions } from '../request-options';
|
|
3
|
+
type LogFn = (message: string, ...rest: unknown[]) => void;
|
|
4
|
+
export type Logger = {
|
|
5
|
+
error: LogFn;
|
|
6
|
+
warn: LogFn;
|
|
7
|
+
info: LogFn;
|
|
8
|
+
debug: LogFn;
|
|
9
|
+
};
|
|
10
|
+
export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug';
|
|
11
|
+
export declare const defaultLogLevel: LogLevel;
|
|
12
|
+
export declare const parseLogLevel: (maybeLevel: string | undefined, sourceName: string, logger: Logger) => LogLevel | undefined;
|
|
13
|
+
export declare function loggerFor(client: BasePuku): Logger;
|
|
14
|
+
/**
|
|
15
|
+
* A logger matching the client defaults — `console`, filtered to
|
|
16
|
+
* `PUKU_LOG` or {@link defaultLogLevel} — for contexts with no client to
|
|
17
|
+
* read the configured `logger`/`logLevel` from.
|
|
18
|
+
*
|
|
19
|
+
* Cached per `PUKU_LOG` value so an invalid value warns once, like a
|
|
20
|
+
* client construction does, rather than on every request.
|
|
21
|
+
*/
|
|
22
|
+
export declare function defaultLogger(): Logger;
|
|
23
|
+
export declare const formatRequestDetails: (details: {
|
|
24
|
+
options?: RequestOptions | undefined;
|
|
25
|
+
headers?: Headers | Record<string, string> | undefined;
|
|
26
|
+
retryOfRequestLogID?: string | undefined;
|
|
27
|
+
retryOf?: string | undefined;
|
|
28
|
+
url?: string | undefined;
|
|
29
|
+
status?: number | undefined;
|
|
30
|
+
method?: string | undefined;
|
|
31
|
+
durationMs?: number | undefined;
|
|
32
|
+
message?: unknown;
|
|
33
|
+
body?: unknown;
|
|
34
|
+
}) => {
|
|
35
|
+
options?: RequestOptions | undefined;
|
|
36
|
+
headers?: Headers | Record<string, string> | undefined;
|
|
37
|
+
retryOfRequestLogID?: string | undefined;
|
|
38
|
+
retryOf?: string | undefined;
|
|
39
|
+
url?: string | undefined;
|
|
40
|
+
status?: number | undefined;
|
|
41
|
+
method?: string | undefined;
|
|
42
|
+
durationMs?: number | undefined;
|
|
43
|
+
message?: unknown;
|
|
44
|
+
body?: unknown;
|
|
45
|
+
};
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { hasOwn } from './values.js';
|
|
3
|
+
import { readEnv } from './env.js';
|
|
4
|
+
export const defaultLogLevel = 'warn';
|
|
5
|
+
const levelNumbers = {
|
|
6
|
+
off: 0,
|
|
7
|
+
error: 200,
|
|
8
|
+
warn: 300,
|
|
9
|
+
info: 400,
|
|
10
|
+
debug: 500,
|
|
11
|
+
};
|
|
12
|
+
export const parseLogLevel = (maybeLevel, sourceName, logger) => {
|
|
13
|
+
if (!maybeLevel) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
if (hasOwn(levelNumbers, maybeLevel)) {
|
|
17
|
+
return maybeLevel;
|
|
18
|
+
}
|
|
19
|
+
logger.warn(`${sourceName} was set to ${JSON.stringify(maybeLevel)}, expected one of ${JSON.stringify(Object.keys(levelNumbers))}`);
|
|
20
|
+
return undefined;
|
|
21
|
+
};
|
|
22
|
+
function noop() { }
|
|
23
|
+
function makeLogFn(fnLevel, logger, logLevel) {
|
|
24
|
+
if (!logger || levelNumbers[fnLevel] > levelNumbers[logLevel]) {
|
|
25
|
+
return noop;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// Don't wrap logger functions, we want the stacktrace intact!
|
|
29
|
+
return logger[fnLevel].bind(logger);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const noopLogger = {
|
|
33
|
+
error: noop,
|
|
34
|
+
warn: noop,
|
|
35
|
+
info: noop,
|
|
36
|
+
debug: noop,
|
|
37
|
+
};
|
|
38
|
+
let cachedLoggers = /* @__PURE__ */ new WeakMap();
|
|
39
|
+
function filterLogger(logger, logLevel) {
|
|
40
|
+
const cachedLogger = cachedLoggers.get(logger);
|
|
41
|
+
if (cachedLogger && cachedLogger[0] === logLevel) {
|
|
42
|
+
return cachedLogger[1];
|
|
43
|
+
}
|
|
44
|
+
const levelLogger = {
|
|
45
|
+
error: makeLogFn('error', logger, logLevel),
|
|
46
|
+
warn: makeLogFn('warn', logger, logLevel),
|
|
47
|
+
info: makeLogFn('info', logger, logLevel),
|
|
48
|
+
debug: makeLogFn('debug', logger, logLevel),
|
|
49
|
+
};
|
|
50
|
+
cachedLoggers.set(logger, [logLevel, levelLogger]);
|
|
51
|
+
return levelLogger;
|
|
52
|
+
}
|
|
53
|
+
export function loggerFor(client) {
|
|
54
|
+
const logger = client.logger;
|
|
55
|
+
const logLevel = client.logLevel ?? 'off';
|
|
56
|
+
if (!logger) {
|
|
57
|
+
return noopLogger;
|
|
58
|
+
}
|
|
59
|
+
return filterLogger(logger, logLevel);
|
|
60
|
+
}
|
|
61
|
+
let lastEnvLevel;
|
|
62
|
+
let cachedDefaultLogger;
|
|
63
|
+
/**
|
|
64
|
+
* A logger matching the client defaults — `console`, filtered to
|
|
65
|
+
* `PUKU_LOG` or {@link defaultLogLevel} — for contexts with no client to
|
|
66
|
+
* read the configured `logger`/`logLevel` from.
|
|
67
|
+
*
|
|
68
|
+
* Cached per `PUKU_LOG` value so an invalid value warns once, like a
|
|
69
|
+
* client construction does, rather than on every request.
|
|
70
|
+
*/
|
|
71
|
+
export function defaultLogger() {
|
|
72
|
+
const envLevel = readEnv('PUKU_LOG');
|
|
73
|
+
if (!cachedDefaultLogger || envLevel !== lastEnvLevel) {
|
|
74
|
+
lastEnvLevel = envLevel;
|
|
75
|
+
cachedDefaultLogger = filterLogger(console, parseLogLevel(envLevel, "process.env['PUKU_LOG']", filterLogger(console, defaultLogLevel)) ??
|
|
76
|
+
defaultLogLevel);
|
|
77
|
+
}
|
|
78
|
+
return cachedDefaultLogger;
|
|
79
|
+
}
|
|
80
|
+
export const formatRequestDetails = (details) => {
|
|
81
|
+
if (details.options) {
|
|
82
|
+
details.options = { ...details.options };
|
|
83
|
+
delete details.options['headers']; // redundant + leaks internals
|
|
84
|
+
}
|
|
85
|
+
if (details.headers) {
|
|
86
|
+
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
87
|
+
name,
|
|
88
|
+
(name.toLowerCase() === 'authorization' ||
|
|
89
|
+
name.toLowerCase() === 'api-key' ||
|
|
90
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
91
|
+
name.toLowerCase() === 'cookie' ||
|
|
92
|
+
name.toLowerCase() === 'set-cookie') ?
|
|
93
|
+
'***'
|
|
94
|
+
: value,
|
|
95
|
+
]));
|
|
96
|
+
}
|
|
97
|
+
if ('retryOfRequestLogID' in details) {
|
|
98
|
+
if (details.retryOfRequestLogID) {
|
|
99
|
+
details.retryOf = details.retryOfRequestLogID;
|
|
100
|
+
}
|
|
101
|
+
delete details.retryOfRequestLogID;
|
|
102
|
+
}
|
|
103
|
+
return details;
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log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