@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
package/sdk.d.ts
CHANGED
|
@@ -10833,7 +10833,7 @@ type AutoParseableOutputConfig = Omit<OutputConfig, 'format'> & {
|
|
|
10833
10833
|
declare function betaGlobTool(ctx: AgentToolContext): BetaRunnableTool;
|
|
10834
10834
|
|
|
10835
10835
|
declare function betaGrepTool(ctx: AgentToolContext): BetaRunnableTool;
|
|
10836
|
-
declare const VERSION = "0.
|
|
10836
|
+
declare const VERSION = "4.0.2";
|
|
10837
10837
|
|
|
10838
10838
|
export { default, PukuAI, BasePuku, PukuAIType, BasePukuType, VERSION, Uploadable, toFile };
|
|
10839
10839
|
|
package/sdk.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var C9=Object.create;var{getPrototypeOf:U9,defineProperty:a1,getOwnPropertyNames:N9}=Object;var F9=Object.prototype.hasOwnProperty;function q9(J){return this[J]}var M9,T9,w9=(J,$,Z)=>{var X=J!=null&&typeof J==="object";if(X){var G=$?M9??=new WeakMap:T9??=new WeakMap,Q=G.get(J);if(Q)return Q}Z=J!=null?C9(U9(J)):{};let Y=$||!J||!J.__esModule?a1(Z,"default",{value:J,enumerable:!0}):Z;for(let z of N9(J))if(!F9.call(Y,z))a1(Y,z,{get:q9.bind(J,z),enumerable:!0});if(X)G.set(J,Y);return Y};var r8=(J,$)=>()=>($||J(($={exports:{}}).exports,$),$.exports);var O9=(J)=>J;function R9(J,$){this[J]=O9.bind(null,$)}var R4=(J,$)=>{for(var Z in $)a1(J,Z,{get:$[Z],enumerable:!0,configurable:!0,set:R9.bind($,Z)})};var M=(J,$)=>()=>(J&&($=J(J=0)),$);var U2=function(){let{crypto:J}=globalThis;if(J?.randomUUID)return U2=J.randomUUID.bind(J),J.randomUUID();let $=new Uint8Array(1),Z=J?()=>J.getRandomValues($)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(X)=>(+X^Z()&15>>+X/4).toString(16))};function U0(J){return typeof J==="object"&&J!==null&&(("name"in J)&&J.name==="AbortError"||("message"in J)&&String(J.message).includes("FetchRequestCanceledException"))}var a0=(J)=>{if(J instanceof Error)return J;if(typeof J==="object"&&J!==null){try{let $=Object.prototype.toString.call(J);if($==="[object Error]"||$==="[object DOMException]"){let Z=Error(J.message,J.cause?{cause:J.cause}:{});if(J.stack)Z.stack=J.stack;if(J.cause&&!Z.cause)Z.cause=J.cause;if(J.name)Z.name=J.name;return Z}}catch{}try{return Error(JSON.stringify(J))}catch{}}return Error(J)};var T,l,Z0,S0,g2,t8,h2,m2,u2,d2,c2,p2,l2,i2;var c=M(()=>{T=class T extends Error{name="PukuError";constructor(J){super(J);this.name="PukuError"}};l=class l extends T{status;headers;error;requestID;workspaceID;type;constructor(J,$,Z,X,G){super(`${l.makeMessage(J,$,Z)}`);this.status=J,this.headers=X,this.requestID=X?.get("request-id"),this.workspaceID=X?.get("puku-workspace-id"),this.error=$,this.type=G??null}static makeMessage(J,$,Z){let X=$?.message?typeof $.message==="string"?$.message:JSON.stringify($.message):$?JSON.stringify($):Z;if(J&&X)return`${J} ${X}`;if(J)return`${J} status code (no body)`;if(X)return X;return"(no status code or body)"}static generate(J,$,Z,X){if(!J||!X)return new S0({message:Z,cause:a0($)});let G=$,Q=G?.error?.type;if(J===400)return new h2(J,G,Z,X,Q);if(J===401)return new m2(J,G,Z,X,Q);if(J===403)return new u2(J,G,Z,X,Q);if(J===404)return new d2(J,G,Z,X,Q);if(J===409)return new c2(J,G,Z,X,Q);if(J===422)return new p2(J,G,Z,X,Q);if(J===429)return new l2(J,G,Z,X,Q);if(J>=500)return new i2(J,G,Z,X,Q);return new l(J,G,Z,X,Q)}};Z0=class Z0 extends l{constructor({message:J}={}){super(void 0,void 0,J||"Request was aborted.",void 0)}};S0=class S0 extends l{constructor({message:J,cause:$}){super(void 0,void 0,J||"Connection error.",void 0);if($)this.cause=$}};g2=class g2 extends S0{constructor({message:J}={}){super({message:J??"Request timed out."})}};t8=class t8 extends T{constructor(J,{cause:$}={}){super(J??"Retryable error.");if($!==void 0)this.cause=$}};h2=class h2 extends l{};m2=class m2 extends l{};u2=class u2 extends l{};d2=class d2 extends l{};c2=class c2 extends l{};p2=class p2 extends l{};l2=class l2 extends l{};i2=class i2 extends l{}});function n2(J){if(typeof J!=="object")return{};return J??{}}function r1(J){if(!J)return!0;for(let $ in J)return!1;return!0}function H4(J,$){return Object.prototype.hasOwnProperty.call(J,$)}function t1(J){return J!=null&&typeof J==="object"&&!Array.isArray(J)}function x0(J){}var H9,A4=(J)=>{return H9.test(J)},X0=(J)=>(X0=Array.isArray,X0(J)),o1,L4=(J,$)=>{if(typeof $!=="number"||!Number.isInteger($))throw new T(`${J} must be an integer`);if($<0)throw new T(`${J} must be a positive integer`);return $},o0=(J)=>{try{return JSON.parse(J)}catch($){return}},G0=(J,$)=>{let Z=J[$];return delete J[$],Z};var Q0=M(()=>{c();H9=/^[a-z][a-z0-9+.-]*:/i,o1=X0});var T0=(J,$)=>new Promise((Z)=>{if($?.aborted)return Z();let X=()=>{clearTimeout(G),Z()},G=setTimeout(()=>{$?.removeEventListener("abort",X),Z()},J);$?.addEventListener("abort",X,{once:!0})});var B0="0.123.0";function L9(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function j9(){if(typeof navigator>"u"||!navigator)return null;let J=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:$,pattern:Z}of J){let X=Z.exec(navigator.userAgent);if(X){let G=X[1]||0,Q=X[2]||0,Y=X[3]||0;return{browser:$,version:`${G}.${Q}.${Y}`}}}return null}var P4=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},D9=()=>{let J=L9();if(J==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":j4(Deno.build.os),"X-Stainless-Arch":D4(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process?.version??"unknown"};if(J==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":j4(globalThis.process.platform??"unknown"),"X-Stainless-Arch":D4(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let $=j9();if($)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${$.browser}`,"X-Stainless-Runtime-Version":$.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},D4=(J)=>{if(J==="x32")return"x32";if(J==="x86_64"||J==="x64")return"x64";if(J==="arm")return"arm";if(J==="aarch64"||J==="arm64")return"arm64";if(J)return`other:${J}`;return"unknown"},j4=(J)=>{if(J=J.toLowerCase(),J.includes("ios"))return"iOS";if(J==="android")return"Android";if(J==="darwin")return"MacOS";if(J==="win32")return"Windows";if(J==="freebsd")return"FreeBSD";if(J==="openbsd")return"OpenBSD";if(J==="linux")return"Linux";if(J)return`Other:${J}`;return"Unknown"},P9,a2=()=>{return P9??=D9()};var s8=()=>{};function S9(J,$){return()=>J.removeEventListener("abort",$)}function _4(J,$,Z){e8.set(J,S9($,Z))}function E4(J,$){if(e8.has($))S4?.register(J,$,$)}function H0(J){let $=e8.get(J);if($)e8.delete(J),S4?.unregister(J),$()}var e8,S4;var J1=M(()=>{e8=new WeakMap,S4=typeof globalThis.FinalizationRegistry==="function"?new globalThis.FinalizationRegistry((J)=>H0(J)):null});function I4(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new PukuAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function s1(...J){let $=globalThis.ReadableStream;if(typeof $>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new $(...J)}function $1(J){let $=Symbol.asyncIterator in J?J[Symbol.asyncIterator]():J[Symbol.iterator]();return s1({start(){},async pull(Z){let{done:X,value:G}=await $.next();if(X)Z.close();else Z.enqueue(G)},async cancel(){await $.return?.()}})}function o2(J){if(J[Symbol.asyncIterator])return J;let $=J.getReader();return{async next(){try{let Z=await $.read();if(Z?.done)$.releaseLock();return Z}catch(Z){throw $.releaseLock(),Z}},async return(){let Z=$.cancel();return $.releaseLock(),await Z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function y4(J){if(J===null||typeof J!=="object")return;if(J[Symbol.asyncIterator]){await J[Symbol.asyncIterator]().return?.();return}let $=J.getReader(),Z=$.cancel();$.releaseLock(),await Z}class e1{index}var x4=({headers:J,body:$})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify($)}};var J6="RFC3986",$6=(J)=>String(J),Z6,k4="RFC1738";var X6=M(()=>{Z6={RFC1738:(J)=>String(J).replace(/%20/g,"+"),RFC3986:$6}});function v4(J){if(!J||typeof J!=="object")return!1;return!!(J.constructor&&J.constructor.isBuffer&&J.constructor.isBuffer(J))}function Q6(J,$){if(X0(J)){let Z=[];for(let X=0;X<J.length;X+=1)Z.push($(J[X]));return Z}return $(J)}var Z1=(J,$)=>(Z1=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Z1(J,$)),L0,G6=1024,f4=(J,$,Z,X,G)=>{if(J.length===0)return J;let Q=J;if(typeof J==="symbol")Q=Symbol.prototype.toString.call(J);else if(typeof J!=="string")Q=String(J);if(Z==="iso-8859-1")return escape(Q).replace(/%u[0-9a-f]{4}/gi,function(z){return"%26%23"+parseInt(z.slice(2),16)+"%3B"});let Y="";for(let z=0;z<Q.length;z+=G6){let B=Q.length>=G6?Q.slice(z,z+G6):Q,K=[];for(let W=0;W<B.length;++W){let C=B.charCodeAt(W);if(C===45||C===46||C===95||C===126||C>=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||G===k4&&(C===40||C===41)){K[K.length]=B.charAt(W);continue}if(C<128){K[K.length]=L0[C];continue}if(C<2048){K[K.length]=L0[192|C>>6]+L0[128|C&63];continue}if(C<55296||C>=57344){K[K.length]=L0[224|C>>12]+L0[128|C>>6&63]+L0[128|C&63];continue}W+=1,C=65536+((C&1023)<<10|B.charCodeAt(W)&1023),K[K.length]=L0[240|C>>18]+L0[128|C>>12&63]+L0[128|C>>6&63]+L0[128|C&63]}Y+=K.join("")}return Y};var b4=M(()=>{X6();Q0();L0=(()=>{let J=[];for(let $=0;$<256;++$)J.push("%"+(($<16?"0":"")+$.toString(16)).toUpperCase());return J})()});function y9(J){return typeof J==="string"||typeof J==="number"||typeof J==="boolean"||typeof J==="symbol"||typeof J==="bigint"}function m4(J,$,Z,X,G,Q,Y,z,B,K,W,C,V,F,q,A,R,H){let O=J,D=H,S=0,y=!1;while((D=D.get(Y6))!==void 0&&!y){let b=D.get(J);if(S+=1,typeof b<"u")if(b===S)throw RangeError("Cyclic object value");else y=!0;if(typeof D.get(Y6)>"u")S=0}if(typeof K==="function")O=K($,O);else if(O instanceof Date)O=V?.(O);else if(Z==="comma"&&X0(O))O=Q6(O,function(b){if(b instanceof Date)return V?.(b);return b});if(O===null){if(Q)return B&&!A?B($,a.encoder,R,"key",F):$;O=""}if(y9(O)||v4(O)){if(B){let b=A?$:B($,a.encoder,R,"key",F);return[q?.(b)+"="+q?.(B(O,a.encoder,R,"value",F))]}return[q?.($)+"="+q?.(String(O))]}let f=[];if(typeof O>"u")return f;let v;if(Z==="comma"&&X0(O)){if(A&&B)O=Q6(O,B);v=[{value:O.length>0?O.join(",")||null:void 0}]}else if(X0(K))v=K;else{let b=Object.keys(O);v=W?b.sort(W):b}let g=z?String($).replace(/\./g,"%2E"):String($),d=X&&X0(O)&&O.length===1?g+"[]":g;if(G&&X0(O)&&O.length===0)return d+"[]";for(let b=0;b<v.length;++b){let t=v[b],A0=typeof t==="object"&&typeof t.value<"u"?t.value:O[t];if(Y&&A0===null)continue;let n0=C&&z?t.replace(/\./g,"%2E"):t,C2=X0(O)?typeof Z==="function"?Z(d,n0):d:d+(C?"."+n0:"["+n0+"]");H.set(J,S);let O4=new WeakMap;O4.set(Y6,H),h4(f,m4(A0,C2,Z,X,G,Q,Y,z,Z==="comma"&&A&&X0(O)?null:B,K,W,C,V,F,q,A,R,O4))}return f}function x9(J=a){if(typeof J.allowEmptyArrays<"u"&&typeof J.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof J.encodeDotInKeys<"u"&&typeof J.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(J.encoder!==null&&typeof J.encoder<"u"&&typeof J.encoder!=="function")throw TypeError("Encoder has to be a function.");let $=J.charset||a.charset;if(typeof J.charset<"u"&&J.charset!=="utf-8"&&J.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let Z=J6;if(typeof J.format<"u"){if(!Z1(Z6,J.format))throw TypeError("Unknown format option provided.");Z=J.format}let X=Z6[Z],G=a.filter;if(typeof J.filter==="function"||X0(J.filter))G=J.filter;let Q;if(J.arrayFormat&&J.arrayFormat in g4)Q=J.arrayFormat;else if("indices"in J)Q=J.indices?"indices":"repeat";else Q=a.arrayFormat;if("commaRoundTrip"in J&&typeof J.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let Y=typeof J.allowDots>"u"?!!J.encodeDotInKeys===!0?!0:a.allowDots:!!J.allowDots;return{addQueryPrefix:typeof J.addQueryPrefix==="boolean"?J.addQueryPrefix:a.addQueryPrefix,allowDots:Y,allowEmptyArrays:typeof J.allowEmptyArrays==="boolean"?!!J.allowEmptyArrays:a.allowEmptyArrays,arrayFormat:Q,charset:$,charsetSentinel:typeof J.charsetSentinel==="boolean"?J.charsetSentinel:a.charsetSentinel,commaRoundTrip:!!J.commaRoundTrip,delimiter:typeof J.delimiter>"u"?a.delimiter:J.delimiter,encode:typeof J.encode==="boolean"?J.encode:a.encode,encodeDotInKeys:typeof J.encodeDotInKeys==="boolean"?J.encodeDotInKeys:a.encodeDotInKeys,encoder:typeof J.encoder==="function"?J.encoder:a.encoder,encodeValuesOnly:typeof J.encodeValuesOnly==="boolean"?J.encodeValuesOnly:a.encodeValuesOnly,filter:G,format:Z,formatter:X,serializeDate:typeof J.serializeDate==="function"?J.serializeDate:a.serializeDate,skipNulls:typeof J.skipNulls==="boolean"?J.skipNulls:a.skipNulls,sort:typeof J.sort==="function"?J.sort:null,strictNullHandling:typeof J.strictNullHandling==="boolean"?J.strictNullHandling:a.strictNullHandling}}function u4(J,$={}){let Z=J,X=x9($),G,Q;if(typeof X.filter==="function")Q=X.filter,Z=Q("",Z);else if(X0(X.filter))Q=X.filter,G=Q;let Y=[];if(typeof Z!=="object"||Z===null)return"";let z=g4[X.arrayFormat],B=z==="comma"&&X.commaRoundTrip;if(!G)G=Object.keys(Z);if(X.sort)G.sort(X.sort);let K=new WeakMap;for(let V=0;V<G.length;++V){let F=G[V];if(X.skipNulls&&Z[F]===null)continue;h4(Y,m4(Z[F],F,z,B,X.allowEmptyArrays,X.strictNullHandling,X.skipNulls,X.encodeDotInKeys,X.encode?X.encoder:null,X.filter,X.sort,X.allowDots,X.serializeDate,X.format,X.formatter,X.encodeValuesOnly,X.charset,K))}let W=Y.join(X.delimiter),C=X.addQueryPrefix===!0?"?":"";if(X.charsetSentinel)if(X.charset==="iso-8859-1")C+="utf8=%26%2310003%3B&";else C+="utf8=%E2%9C%93&";return W.length>0?C+W:""}var g4,h4=function(J,$){Array.prototype.push.apply(J,X0($)?$:[$])},I9,a,Y6;var d4=M(()=>{b4();X6();Q0();g4={brackets(J){return String(J)+"[]"},comma:"comma",indices(J,$){return String(J)+"["+$+"]"},repeat(J){return String(J)}},a={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:f4,encodeValuesOnly:!1,format:J6,formatter:$6,indices:!1,serializeDate(J){return(I9??=Function.prototype.call.bind(Date.prototype.toISOString))(J)},skipNulls:!1,strictNullHandling:!1};Y6={}});function c4(J){return u4(J,{arrayFormat:"brackets"})}var z6=M(()=>{d4()});var D0={};R4(D0,{util:()=>K6,stream:()=>X1,path:()=>j,os:()=>f9,fs:()=>_0,crypto:()=>k0,child_process:()=>B6});import*as B6 from"node:child_process";import*as k0 from"node:crypto";import*as _0 from"node:fs";import*as f9 from"node:os";import*as j from"node:path";import*as X1 from"node:stream";import*as K6 from"node:util";var K0=()=>{};function Q1(J){if(!J)return;let $;try{$=new URL(J)}catch(X){throw new m(`Invalid token endpoint base URL "${J}": ${X}`)}if($.protocol==="https:")return;let Z=$.hostname.toLowerCase().replace(/^\[|\]$/g,"");if($.protocol==="http:"&&(Z==="localhost"||Z==="127.0.0.1"||Z==="::1"))return;throw new m(`Refusing to send credential over non-https token endpoint "${J}"`)}async function Y1(J,$){let Z=await b9(J),X;try{X=JSON.parse(Z)}catch{throw new m(`Token endpoint returned non-JSON response (status ${J.status})`,J.status,W0(Z),$)}if(!X.access_token)throw new m(`Token endpoint response missing access_token: ${JSON.stringify(W0(X))}`,J.status,W0(X),$);if(X.token_type&&X.token_type.toLowerCase()!=="bearer")throw new m(`Token endpoint response: unsupported token_type "${X.token_type}" (want Bearer)`,J.status,W0(X),$);return X}function W0(J){if(J==null)return J;if(typeof J==="string"){let $;try{$=JSON.parse(J)}catch{if(J.length<=W6)return J;return J.slice(0,W6)+`... <${J.length-W6} more chars>`}return JSON.stringify(W0($))}if(typeof J==="object"&&!Array.isArray(J)){let $={};for(let[Z,X]of Object.entries(J))if(v9.has(Z))$[Z]=X;return $}return null}async function z1(J,$=(Z)=>console.warn(`puku-ai/sdk: ${Z}`)){if(typeof process>"u"||process.platform==="win32")return;let{fs:Z}=await Promise.resolve().then(() => (K0(),D0)),X=J,G;try{X=await Z.promises.realpath(J),G=await Z.promises.stat(X)}catch{return}let Q=G.mode&511;if(Q&18)throw new m(`Credentials file at ${X} is group/world-writable (mode 0o${Q.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${X}\`.`);if(Q&36)throw new m(`Credentials file at ${X} is group/world-readable (mode 0o${Q.toString(8)}); run \`chmod 600 ${X}\` before retrying.`);if(typeof process.getuid==="function"&&G.uid!==process.getuid())$(`credentials file at ${X} is owned by uid ${G.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function B1(J,$){let{fs:Z,path:X}=await Promise.resolve().then(() => (K0(),D0)),G=X.dirname(J);await Z.promises.mkdir(G,{recursive:!0,mode:448});let Q=`${J}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let Y=await Z.promises.open(Q,"w",384);try{await Y.writeFile(JSON.stringify($,null,2)),await Y.sync()}finally{await Y.close()}await Z.promises.rename(Q,J)}catch(Y){throw await Z.promises.unlink(Q).catch(()=>{}),Y}try{let Y=await Z.promises.open(G,"r");try{await Y.sync()}finally{await Y.close()}}catch{}}async function b9(J){if(!J.body)return"";let $=J.body.getReader(),Z=[],X=0;for(;;){let{done:Q,value:Y}=await $.read();if(Q)break;if(X+Y.length>p4){let z=p4-X;if(z>0)Z.push(Y.subarray(0,z));await $.cancel();break}Z.push(Y),X+=Y.length}let G;if(Z.length===1)G=Z[0];else{G=new Uint8Array(Z.reduce((Y,z)=>Y+z.length,0));let Q=0;for(let Y of Z)G.set(Y,Q),Q+=Y.length}return new TextDecoder("utf-8").decode(G)}var l4="urn:ietf:params:oauth:grant-type:jwt-bearer",i4="refresh_token",G1="/v1/oauth/token",f0="oauth-2025-04-20",V6="oidc-federation-2026-04-01",n4=120,N2=30,a4=5,p4=1048576,W6=2000,v9,m;var r0=M(()=>{c();v9=new Set(["error","error_description","error_uri"]);m=class m extends T{statusCode;body;requestId;constructor(J,$=null,Z=null,X=null){super(J);this.statusCode=$,this.body=Z,this.requestId=X}}});function w0(){return Math.floor(Date.now()/1000)}class C6{provider;cached=null;pendingRefresh=null;nextForce=!1;lastAdvisoryError=0;onAdvisoryRefreshError;constructor(J,$){this.provider=J,this.onAdvisoryRefreshError=$}async getToken(){let J=this.nextForce;this.nextForce=!1;let $=this.cached;if(J||$==null)return(await this.refresh(J)).token;if($.expiresAt==null)return $.token;let Z=$.expiresAt-w0();if(Z>n4)return $.token;if(Z>N2)return this.backgroundRefresh(),$.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(J=!1){if(this.pendingRefresh&&!J)return this.pendingRefresh;return this.doRefresh(J)}backgroundRefresh(){if(this.pendingRefresh)return;if(w0()-this.lastAdvisoryError<a4)return;this.doRefresh().catch((J)=>{this.lastAdvisoryError=w0(),this.onAdvisoryRefreshError?.(J)})}doRefresh(J=!1){return this.pendingRefresh=this.provider(J?{forceRefresh:!0}:void 0).then(($)=>{return this.cached=$,this.pendingRefresh=null,$},($)=>{throw this.pendingRefresh=null,$}),this.pendingRefresh}}var o4=M(()=>{r0()});var x=(J)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[J]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(J)?.trim()||void 0;return};function s4(J){let $=0;for(let G of J)$+=G.length;let Z=new Uint8Array($),X=0;for(let G of J)Z.set(G,X),X+=G.length;return Z}function v0(J){let $;return(r4??($=new globalThis.TextEncoder,r4=$.encode.bind($)))(J)}function t0(J){let $;return(t4??($=new globalThis.TextDecoder,t4=$.decode.bind($)))(J)}var r4,t4;var r2=(J)=>{if(typeof globalThis.Buffer<"u"){let $=globalThis.Buffer.from(J,"base64");return new Uint8Array($.buffer,$.byteOffset,$.byteLength)}if(typeof atob<"u"){let $=atob(J),Z=new Uint8Array($.length);for(let X=0;X<$.length;X++)Z[X]=$.charCodeAt(X);return Z}throw new T("Cannot decode base64 string; Expected `Buffer` or `atob` to be defined")};var K1=M(()=>{c()});function t2(){}function W1(J,$,Z){if(!$||V1[J]>V1[Z])return t2;else return $[J].bind($)}function N6(J,$){let Z=e4.get(J);if(Z&&Z[0]===$)return Z[1];let X={error:W1("error",J,$),warn:W1("warn",J,$),info:W1("info",J,$),debug:W1("debug",J,$)};return e4.set(J,[$,X]),X}function k(J){let $=J.logger,Z=J.logLevel??"off";if(!$)return g9;return N6($,Z)}function $$(){let J=x("PUKU_LOG");if(!U6||J!==J$)J$=J,U6=N6(console,C1(J,"process.env['PUKU_LOG']",N6(console,s2))??s2);return U6}var s2="warn",V1,C1=(J,$,Z)=>{if(!J)return;if(H4(V1,J))return J;Z.warn(`${$} was set to ${JSON.stringify(J)}, expected one of ${JSON.stringify(Object.keys(V1))}`);return},g9,e4,J$,U6,j0=(J)=>{if(J.options)J.options={...J.options},delete J.options.headers;if(J.headers)J.headers=Object.fromEntries((J.headers instanceof Headers?[...J.headers]:Object.entries(J.headers)).map(([$,Z])=>[$,$.toLowerCase()==="authorization"||$.toLowerCase()==="api-key"||$.toLowerCase()==="x-api-key"||$.toLowerCase()==="cookie"||$.toLowerCase()==="set-cookie"?"***":Z]));if("retryOfRequestLogID"in J){if(J.retryOfRequestLogID)J.retryOf=J.retryOfRequestLogID;delete J.retryOfRequestLogID}return J};var O0=M(()=>{Q0();V1={off:0,error:200,warn:300,info:400,debug:500};g9={error:t2,warn:t2,info:t2,debug:t2},e4=new WeakMap});var F6=M(()=>{Q0();K1();O0();z6()});function Z$(J){if(!J)throw Error("profile name is empty");if(J==="."||J==="..")throw Error(`profile name "${J}" is not allowed`);if(J.includes("/")||J.includes("\\"))throw Error(`profile name "${J}" must not contain path separators`);if(!h9.test(J))throw Error(`profile name "${J}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var U1="1.0",h9,X$=async(J)=>{let $=await q6();if($===null)return null;let Z=J??await Q$();if(Z===null)return null;Z$(Z);let{fs:X,path:G}=await Promise.resolve().then(() => (K0(),D0)),Q=G.join($,"configs",`${Z}.json`),Y;try{Y=await X.promises.readFile(Q,"utf-8")}catch(K){if(K?.code!=="ENOENT")throw Error(`failed to read config file ${Q}: ${K}`);Y=null}if(Y===null){let K=x("PUKU_ORGANIZATION_ID"),W=x("PUKU_IDENTITY_TOKEN_FILE"),C=x("PUKU_FEDERATION_RULE_ID");if(C&&K)return{fromFile:!1,config:{organization_id:K,workspace_id:x("PUKU_WORKSPACE_ID"),base_url:x("PUKU_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:C,service_account_id:x("PUKU_SERVICE_ACCOUNT_ID"),identity_token:W?{source:"file",path:W}:void 0,scope:x("PUKU_SCOPE")}}};return null}let z;try{z=JSON.parse(Y)}catch(K){throw Error(`failed to parse config file ${Q}: ${K}`)}if(!z.authentication)throw Error(`config file ${Q} is missing "authentication"`);let B=z.authentication.type;if(B!=="oidc_federation"&&B!=="user_oauth")throw Error(`authentication.type "${B}" is not a known authentication type`);if(z.organization_id??=x("PUKU_ORGANIZATION_ID"),z.workspace_id??=x("PUKU_WORKSPACE_ID"),z.base_url??=x("PUKU_BASE_URL"),z.authentication.scope??=x("PUKU_SCOPE"),z.authentication.type==="oidc_federation"){if(!z.authentication.identity_token){let K=x("PUKU_IDENTITY_TOKEN_FILE");if(K)z.authentication.identity_token={source:"file",path:K}}if(!z.authentication.federation_rule_id)z.authentication.federation_rule_id=x("PUKU_FEDERATION_RULE_ID")??"";z.authentication.service_account_id??=x("PUKU_SERVICE_ACCOUNT_ID")}return{config:z,fromFile:!0}},G$=async(J,$)=>{if(J?.authentication.credentials_path)return J.authentication.credentials_path;let Z=await q6();if(!Z)return null;let X=$??await Q$();if(!X)return null;Z$(X);let{path:G}=await Promise.resolve().then(() => (K0(),D0));return G.join(Z,"credentials",`${X}.json`)},q6=async()=>{if(!m9())return null;let{path:J}=await Promise.resolve().then(() => (K0(),D0)),$=x("PUKU_CONFIG_DIR");if($)return $;if(a2()["X-Stainless-OS"]==="Windows"){let Q=x("APPDATA");if(Q)return J.join(Q,"PukuAI");let Y=x("USERPROFILE");if(Y)return J.join(Y,"AppData","Roaming","PukuAI");return null}let X=x("XDG_CONFIG_HOME");if(X)return J.join(X,"puku");let G=x("HOME");if(G)return J.join(G,".config","puku");return null},m9=()=>{let J=a2()["X-Stainless-Runtime"];return J==="node"||J==="deno"},Q$=async()=>{let J=await q6();if(!J)return null;let $=x("PUKU_PROFILE");if($)return $;let{fs:Z,path:X}=await Promise.resolve().then(() => (K0(),D0)),G=X.join(J,"active_config");try{return(await Z.promises.readFile(G,"utf-8")).trim()||"default"}catch(Q){if(Q?.code!=="ENOENT")throw Error(`failed to read ${G}: ${Q}`);return"default"}};var M6=M(()=>{s8();F6();h9=/^[A-Za-z0-9_.-]+$/});function T6(J){if(!J)throw new T("Identity token file path is empty");return async()=>{let{fs:$}=await Promise.resolve().then(() => (K0(),D0)),Z;try{Z=await $.promises.readFile(J,"utf-8")}catch(G){throw new T(`Failed to read identity token file at ${J}: ${G}`)}let X=Z.trim();if(!X)throw new T(`Identity token file at ${J} is empty`);return X}}function Y$(J){if(!J)throw new T("Identity token value is empty");return()=>J}var z$=M(()=>{c()});function B$(J){return async()=>{Q1(J.baseURL);let $=await J.identityTokenProvider();if($.length>16384)throw new m(`Identity token is ${Math.ceil($.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let Z={grant_type:l4,assertion:$,federation_rule_id:J.federationRuleId,organization_id:J.organizationId};if(J.serviceAccountId)Z.service_account_id=J.serviceAccountId;if(J.workspaceId)Z.workspace_id=J.workspaceId;let X=`${J.baseURL}${G1}`,G;try{G=await J.fetch(X,{method:"POST",headers:{"Content-Type":"application/json","puku-beta":`${f0},${V6}`,"User-Agent":J.userAgent||`puku-ai-sdk-typescript/${B0} oidcFederationProvider`},body:JSON.stringify(Z)})}catch(B){throw new m(`Failed to reach token endpoint ${X}: ${B}`)}let Q=G.headers.get("Request-Id");if(!G.ok){let B=await G.text().catch(()=>""),K=W0(B),W="";if(G.status===401)W=` Ensure your federation rule matches your identity token. ${J.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the PUKU_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Puku Console for more details.`;throw new m(`Token exchange failed with status ${G.status}${Q?` (request-id ${Q})`:""}: ${K}${W}`,G.status,K,Q)}let Y=await Y1(G,Q),z=Number(Y.expires_in);if(!Number.isFinite(z))throw new m(`Token endpoint response missing required fields: ${JSON.stringify(W0(Y))}`,G.status,W0(Y),Q);return{token:Y.access_token,expiresAt:w0()+z}}}var K$=M(()=>{r0()});function W$(J){return async($)=>{let{fs:Z}=await Promise.resolve().then(() => (K0(),D0));await z1(J.credentialsPath,J.onSafetyWarning);let X;try{X=await Z.promises.readFile(J.credentialsPath,"utf-8")}catch(R){throw new m(`Credentials file not found at ${J.credentialsPath}: ${R}`)}let G;try{G=JSON.parse(X)}catch(R){throw new m(`Credentials file at ${J.credentialsPath} is not valid JSON: ${R}`)}let Q=G.access_token;if(!Q)throw new m(`Credentials file at ${J.credentialsPath} must include 'access_token'`);let Y=G.expires_at;if(!$?.forceRefresh&&(Y==null||w0()<Y-N2))return{token:Q,expiresAt:Y??null};let z=G.refresh_token;if(!J.clientId||!z)throw new m(`Access token at ${J.credentialsPath} has expired and no refresh is available (client_id ${J.clientId?"set":"empty"}, refresh_token ${z?"set":"empty"})`);Q1(J.baseURL);let B={grant_type:i4,refresh_token:z,client_id:J.clientId},K=`${J.baseURL}${G1}`,W;try{W=await J.fetch(K,{method:"POST",headers:{"Content-Type":"application/json","puku-beta":f0,"User-Agent":J.userAgent||`puku-ai-sdk-typescript/${B0} userOAuthProvider`},body:JSON.stringify(B)})}catch(R){throw new m(`User OAuth refresh failed to reach token endpoint: ${R}`)}let C=W.headers.get("Request-Id");if(!W.ok){let R=await W.text().catch(()=>"");throw new m(`User OAuth refresh failed (HTTP ${W.status}): ${W0(R)}`,W.status,W0(R),C)}let V=await Y1(W,C),F=Number(V.expires_in);if(!Number.isFinite(F))throw new m(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(W0(V))}`,W.status,W0(V),C);let q=w0()+F,A=V.refresh_token||z;return await B1(J.credentialsPath,{...G,version:U1,type:"oauth_token",access_token:V.access_token,expires_at:q,refresh_token:A}),{token:V.access_token,expiresAt:q}}}var V$=M(()=>{M6();r0()});function w6(J,$){let Z=J.authentication.credentials_path??null,X=(J.base_url||$.baseURL).replace(/\/+$/,""),G=u9(J,Z,X,$),Q={};if(J.workspace_id&&J.authentication.type==="user_oauth")Q["puku-workspace-id"]=J.workspace_id;return{provider:G,extraHeaders:Q,baseURL:J.base_url||void 0}}async function C$(J,$){let Z=await X$($);if(!Z)return null;let{config:X,fromFile:G}=Z,Q=X.authentication.credentials_path||!G?X:{...X,authentication:{...X.authentication,credentials_path:await G$(X,$)??void 0}};return w6(Q,J)}function u9(J,$,Z,X){switch(J.authentication.type){case"oidc_federation":{let G=J.authentication,Q=d9(G);if(!Q)throw new m("oidc_federation config requires an identity token (set authentication.identity_token, PUKU_IDENTITY_TOKEN_FILE, or PUKU_IDENTITY_TOKEN)");if(!G.federation_rule_id)throw new m("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via PUKU_FEDERATION_RULE_ID (profile takes precedence).");if(!J.organization_id)throw new m("oidc_federation config requires organization_id (set PUKU_ORGANIZATION_ID or config.organization_id)");let Y=B$({identityTokenProvider:Q,federationRuleId:G.federation_rule_id,organizationId:J.organization_id,serviceAccountId:G.service_account_id,workspaceId:J.workspace_id,baseURL:Z,fetch:X.fetch,userAgent:X.userAgent});if($)return c9(Y,$,X.onCacheWriteError,X.onSafetyWarning);return Y}case"user_oauth":{if(!$)throw new m("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return W$({credentialsPath:$,clientId:J.authentication.client_id,baseURL:Z,fetch:X.fetch,userAgent:X.userAgent,onSafetyWarning:X.onSafetyWarning})}default:{let G=J.authentication.type;throw new m(`authentication.type "${G}" is not a known authentication type`)}}}function d9(J){if(J.identity_token){let X=J.identity_token.source;if(X!=="file")throw new m(`identity_token.source "${X}" is not supported by this SDK version (only "file")`);if(!J.identity_token.path)throw new m('identity_token.source "file" requires a non-empty path');return T6(J.identity_token.path)}let $=x("PUKU_IDENTITY_TOKEN_FILE");if($)return T6($);let Z=x("PUKU_IDENTITY_TOKEN");if(Z)return Y$(Z);return null}function c9(J,$,Z,X){return async(G)=>{let{fs:Q}=await Promise.resolve().then(() => (K0(),D0));await z1($,X);let Y;try{let B=await Q.promises.readFile($,"utf-8");Y=JSON.parse(B);let K=Y?.access_token;if(K&&!G?.forceRefresh){let W=Y?.expires_at;if(W==null||w0()<W-N2)return{token:K,expiresAt:W??null}}}catch(B){if(B?.code!=="ENOENT"&&!(B instanceof SyntaxError))Z?.(B)}let z=await J(G);try{await B1($,{...Y??{},version:U1,type:"oauth_token",access_token:z.token,expires_at:z.expiresAt})}catch(B){Z?.(B)}return z}}var U$=M(()=>{M6();r0();z$();K$();V$()});function p9(J,$){for(let G=$??0;G<J.length;G++){if(J[G]===10)return{preceding:G,index:G+1,carriage:!1};if(J[G]===13)return{preceding:G,index:G+1,carriage:!0}}return null}function N$(J){for(let X=0;X<J.length-1;X++){if(J[X]===10&&J[X+1]===10)return X+2;if(J[X]===13&&J[X+1]===13)return X+2;if(J[X]===13&&J[X+1]===10&&X+3<J.length&&J[X+2]===13&&J[X+3]===10)return X+4}return-1}var F2;var O6=M(()=>{F2=class F2{static NEWLINE_CHARS=new Set([`
|
|
1
|
+
var C9=Object.create;var{getPrototypeOf:U9,defineProperty:a1,getOwnPropertyNames:N9}=Object;var F9=Object.prototype.hasOwnProperty;function q9(J){return this[J]}var M9,T9,w9=(J,$,Z)=>{var X=J!=null&&typeof J==="object";if(X){var G=$?M9??=new WeakMap:T9??=new WeakMap,Q=G.get(J);if(Q)return Q}Z=J!=null?C9(U9(J)):{};let Y=$||!J||!J.__esModule?a1(Z,"default",{value:J,enumerable:!0}):Z;for(let z of N9(J))if(!F9.call(Y,z))a1(Y,z,{get:q9.bind(J,z),enumerable:!0});if(X)G.set(J,Y);return Y};var r8=(J,$)=>()=>($||J(($={exports:{}}).exports,$),$.exports);var O9=(J)=>J;function R9(J,$){this[J]=O9.bind(null,$)}var R4=(J,$)=>{for(var Z in $)a1(J,Z,{get:$[Z],enumerable:!0,configurable:!0,set:R9.bind($,Z)})};var M=(J,$)=>()=>(J&&($=J(J=0)),$);var U2=function(){let{crypto:J}=globalThis;if(J?.randomUUID)return U2=J.randomUUID.bind(J),J.randomUUID();let $=new Uint8Array(1),Z=J?()=>J.getRandomValues($)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(X)=>(+X^Z()&15>>+X/4).toString(16))};function U0(J){return typeof J==="object"&&J!==null&&(("name"in J)&&J.name==="AbortError"||("message"in J)&&String(J.message).includes("FetchRequestCanceledException"))}var a0=(J)=>{if(J instanceof Error)return J;if(typeof J==="object"&&J!==null){try{let $=Object.prototype.toString.call(J);if($==="[object Error]"||$==="[object DOMException]"){let Z=Error(J.message,J.cause?{cause:J.cause}:{});if(J.stack)Z.stack=J.stack;if(J.cause&&!Z.cause)Z.cause=J.cause;if(J.name)Z.name=J.name;return Z}}catch{}try{return Error(JSON.stringify(J))}catch{}}return Error(J)};var T,l,Z0,S0,g2,t8,h2,m2,u2,d2,c2,p2,l2,i2;var c=M(()=>{T=class T extends Error{name="PukuError";constructor(J){super(J);this.name="PukuError"}};l=class l extends T{status;headers;error;requestID;workspaceID;type;constructor(J,$,Z,X,G){super(`${l.makeMessage(J,$,Z)}`);this.status=J,this.headers=X,this.requestID=X?.get("request-id"),this.workspaceID=X?.get("puku-workspace-id"),this.error=$,this.type=G??null}static makeMessage(J,$,Z){let X=$?.message?typeof $.message==="string"?$.message:JSON.stringify($.message):$?JSON.stringify($):Z;if(J&&X)return`${J} ${X}`;if(J)return`${J} status code (no body)`;if(X)return X;return"(no status code or body)"}static generate(J,$,Z,X){if(!J||!X)return new S0({message:Z,cause:a0($)});let G=$,Q=G?.error?.type;if(J===400)return new h2(J,G,Z,X,Q);if(J===401)return new m2(J,G,Z,X,Q);if(J===403)return new u2(J,G,Z,X,Q);if(J===404)return new d2(J,G,Z,X,Q);if(J===409)return new c2(J,G,Z,X,Q);if(J===422)return new p2(J,G,Z,X,Q);if(J===429)return new l2(J,G,Z,X,Q);if(J>=500)return new i2(J,G,Z,X,Q);return new l(J,G,Z,X,Q)}};Z0=class Z0 extends l{constructor({message:J}={}){super(void 0,void 0,J||"Request was aborted.",void 0)}};S0=class S0 extends l{constructor({message:J,cause:$}){super(void 0,void 0,J||"Connection error.",void 0);if($)this.cause=$}};g2=class g2 extends S0{constructor({message:J}={}){super({message:J??"Request timed out."})}};t8=class t8 extends T{constructor(J,{cause:$}={}){super(J??"Retryable error.");if($!==void 0)this.cause=$}};h2=class h2 extends l{};m2=class m2 extends l{};u2=class u2 extends l{};d2=class d2 extends l{};c2=class c2 extends l{};p2=class p2 extends l{};l2=class l2 extends l{};i2=class i2 extends l{}});function n2(J){if(typeof J!=="object")return{};return J??{}}function r1(J){if(!J)return!0;for(let $ in J)return!1;return!0}function H4(J,$){return Object.prototype.hasOwnProperty.call(J,$)}function t1(J){return J!=null&&typeof J==="object"&&!Array.isArray(J)}function x0(J){}var H9,A4=(J)=>{return H9.test(J)},X0=(J)=>(X0=Array.isArray,X0(J)),o1,L4=(J,$)=>{if(typeof $!=="number"||!Number.isInteger($))throw new T(`${J} must be an integer`);if($<0)throw new T(`${J} must be a positive integer`);return $},o0=(J)=>{try{return JSON.parse(J)}catch($){return}},G0=(J,$)=>{let Z=J[$];return delete J[$],Z};var Q0=M(()=>{c();H9=/^[a-z][a-z0-9+.-]*:/i,o1=X0});var T0=(J,$)=>new Promise((Z)=>{if($?.aborted)return Z();let X=()=>{clearTimeout(G),Z()},G=setTimeout(()=>{$?.removeEventListener("abort",X),Z()},J);$?.addEventListener("abort",X,{once:!0})});var B0="4.0.2";function L9(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function j9(){if(typeof navigator>"u"||!navigator)return null;let J=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:$,pattern:Z}of J){let X=Z.exec(navigator.userAgent);if(X){let G=X[1]||0,Q=X[2]||0,Y=X[3]||0;return{browser:$,version:`${G}.${Q}.${Y}`}}}return null}var P4=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},D9=()=>{let J=L9();if(J==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":j4(Deno.build.os),"X-Stainless-Arch":D4(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process?.version??"unknown"};if(J==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":j4(globalThis.process.platform??"unknown"),"X-Stainless-Arch":D4(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let $=j9();if($)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${$.browser}`,"X-Stainless-Runtime-Version":$.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":B0,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},D4=(J)=>{if(J==="x32")return"x32";if(J==="x86_64"||J==="x64")return"x64";if(J==="arm")return"arm";if(J==="aarch64"||J==="arm64")return"arm64";if(J)return`other:${J}`;return"unknown"},j4=(J)=>{if(J=J.toLowerCase(),J.includes("ios"))return"iOS";if(J==="android")return"Android";if(J==="darwin")return"MacOS";if(J==="win32")return"Windows";if(J==="freebsd")return"FreeBSD";if(J==="openbsd")return"OpenBSD";if(J==="linux")return"Linux";if(J)return`Other:${J}`;return"Unknown"},P9,a2=()=>{return P9??=D9()};var s8=()=>{};function S9(J,$){return()=>J.removeEventListener("abort",$)}function _4(J,$,Z){e8.set(J,S9($,Z))}function E4(J,$){if(e8.has($))S4?.register(J,$,$)}function H0(J){let $=e8.get(J);if($)e8.delete(J),S4?.unregister(J),$()}var e8,S4;var J1=M(()=>{e8=new WeakMap,S4=typeof globalThis.FinalizationRegistry==="function"?new globalThis.FinalizationRegistry((J)=>H0(J)):null});function I4(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new PukuAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function s1(...J){let $=globalThis.ReadableStream;if(typeof $>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new $(...J)}function $1(J){let $=Symbol.asyncIterator in J?J[Symbol.asyncIterator]():J[Symbol.iterator]();return s1({start(){},async pull(Z){let{done:X,value:G}=await $.next();if(X)Z.close();else Z.enqueue(G)},async cancel(){await $.return?.()}})}function o2(J){if(J[Symbol.asyncIterator])return J;let $=J.getReader();return{async next(){try{let Z=await $.read();if(Z?.done)$.releaseLock();return Z}catch(Z){throw $.releaseLock(),Z}},async return(){let Z=$.cancel();return $.releaseLock(),await Z,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function y4(J){if(J===null||typeof J!=="object")return;if(J[Symbol.asyncIterator]){await J[Symbol.asyncIterator]().return?.();return}let $=J.getReader(),Z=$.cancel();$.releaseLock(),await Z}class e1{index}var x4=({headers:J,body:$})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify($)}};var J6="RFC3986",$6=(J)=>String(J),Z6,k4="RFC1738";var X6=M(()=>{Z6={RFC1738:(J)=>String(J).replace(/%20/g,"+"),RFC3986:$6}});function v4(J){if(!J||typeof J!=="object")return!1;return!!(J.constructor&&J.constructor.isBuffer&&J.constructor.isBuffer(J))}function Q6(J,$){if(X0(J)){let Z=[];for(let X=0;X<J.length;X+=1)Z.push($(J[X]));return Z}return $(J)}var Z1=(J,$)=>(Z1=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Z1(J,$)),L0,G6=1024,f4=(J,$,Z,X,G)=>{if(J.length===0)return J;let Q=J;if(typeof J==="symbol")Q=Symbol.prototype.toString.call(J);else if(typeof J!=="string")Q=String(J);if(Z==="iso-8859-1")return escape(Q).replace(/%u[0-9a-f]{4}/gi,function(z){return"%26%23"+parseInt(z.slice(2),16)+"%3B"});let Y="";for(let z=0;z<Q.length;z+=G6){let B=Q.length>=G6?Q.slice(z,z+G6):Q,K=[];for(let W=0;W<B.length;++W){let C=B.charCodeAt(W);if(C===45||C===46||C===95||C===126||C>=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||G===k4&&(C===40||C===41)){K[K.length]=B.charAt(W);continue}if(C<128){K[K.length]=L0[C];continue}if(C<2048){K[K.length]=L0[192|C>>6]+L0[128|C&63];continue}if(C<55296||C>=57344){K[K.length]=L0[224|C>>12]+L0[128|C>>6&63]+L0[128|C&63];continue}W+=1,C=65536+((C&1023)<<10|B.charCodeAt(W)&1023),K[K.length]=L0[240|C>>18]+L0[128|C>>12&63]+L0[128|C>>6&63]+L0[128|C&63]}Y+=K.join("")}return Y};var b4=M(()=>{X6();Q0();L0=(()=>{let J=[];for(let $=0;$<256;++$)J.push("%"+(($<16?"0":"")+$.toString(16)).toUpperCase());return J})()});function y9(J){return typeof J==="string"||typeof J==="number"||typeof J==="boolean"||typeof J==="symbol"||typeof J==="bigint"}function m4(J,$,Z,X,G,Q,Y,z,B,K,W,C,V,F,q,A,R,H){let O=J,D=H,S=0,y=!1;while((D=D.get(Y6))!==void 0&&!y){let b=D.get(J);if(S+=1,typeof b<"u")if(b===S)throw RangeError("Cyclic object value");else y=!0;if(typeof D.get(Y6)>"u")S=0}if(typeof K==="function")O=K($,O);else if(O instanceof Date)O=V?.(O);else if(Z==="comma"&&X0(O))O=Q6(O,function(b){if(b instanceof Date)return V?.(b);return b});if(O===null){if(Q)return B&&!A?B($,a.encoder,R,"key",F):$;O=""}if(y9(O)||v4(O)){if(B){let b=A?$:B($,a.encoder,R,"key",F);return[q?.(b)+"="+q?.(B(O,a.encoder,R,"value",F))]}return[q?.($)+"="+q?.(String(O))]}let f=[];if(typeof O>"u")return f;let v;if(Z==="comma"&&X0(O)){if(A&&B)O=Q6(O,B);v=[{value:O.length>0?O.join(",")||null:void 0}]}else if(X0(K))v=K;else{let b=Object.keys(O);v=W?b.sort(W):b}let g=z?String($).replace(/\./g,"%2E"):String($),d=X&&X0(O)&&O.length===1?g+"[]":g;if(G&&X0(O)&&O.length===0)return d+"[]";for(let b=0;b<v.length;++b){let t=v[b],A0=typeof t==="object"&&typeof t.value<"u"?t.value:O[t];if(Y&&A0===null)continue;let n0=C&&z?t.replace(/\./g,"%2E"):t,C2=X0(O)?typeof Z==="function"?Z(d,n0):d:d+(C?"."+n0:"["+n0+"]");H.set(J,S);let O4=new WeakMap;O4.set(Y6,H),h4(f,m4(A0,C2,Z,X,G,Q,Y,z,Z==="comma"&&A&&X0(O)?null:B,K,W,C,V,F,q,A,R,O4))}return f}function x9(J=a){if(typeof J.allowEmptyArrays<"u"&&typeof J.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof J.encodeDotInKeys<"u"&&typeof J.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(J.encoder!==null&&typeof J.encoder<"u"&&typeof J.encoder!=="function")throw TypeError("Encoder has to be a function.");let $=J.charset||a.charset;if(typeof J.charset<"u"&&J.charset!=="utf-8"&&J.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let Z=J6;if(typeof J.format<"u"){if(!Z1(Z6,J.format))throw TypeError("Unknown format option provided.");Z=J.format}let X=Z6[Z],G=a.filter;if(typeof J.filter==="function"||X0(J.filter))G=J.filter;let Q;if(J.arrayFormat&&J.arrayFormat in g4)Q=J.arrayFormat;else if("indices"in J)Q=J.indices?"indices":"repeat";else Q=a.arrayFormat;if("commaRoundTrip"in J&&typeof J.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let Y=typeof J.allowDots>"u"?!!J.encodeDotInKeys===!0?!0:a.allowDots:!!J.allowDots;return{addQueryPrefix:typeof J.addQueryPrefix==="boolean"?J.addQueryPrefix:a.addQueryPrefix,allowDots:Y,allowEmptyArrays:typeof J.allowEmptyArrays==="boolean"?!!J.allowEmptyArrays:a.allowEmptyArrays,arrayFormat:Q,charset:$,charsetSentinel:typeof J.charsetSentinel==="boolean"?J.charsetSentinel:a.charsetSentinel,commaRoundTrip:!!J.commaRoundTrip,delimiter:typeof J.delimiter>"u"?a.delimiter:J.delimiter,encode:typeof J.encode==="boolean"?J.encode:a.encode,encodeDotInKeys:typeof J.encodeDotInKeys==="boolean"?J.encodeDotInKeys:a.encodeDotInKeys,encoder:typeof J.encoder==="function"?J.encoder:a.encoder,encodeValuesOnly:typeof J.encodeValuesOnly==="boolean"?J.encodeValuesOnly:a.encodeValuesOnly,filter:G,format:Z,formatter:X,serializeDate:typeof J.serializeDate==="function"?J.serializeDate:a.serializeDate,skipNulls:typeof J.skipNulls==="boolean"?J.skipNulls:a.skipNulls,sort:typeof J.sort==="function"?J.sort:null,strictNullHandling:typeof J.strictNullHandling==="boolean"?J.strictNullHandling:a.strictNullHandling}}function u4(J,$={}){let Z=J,X=x9($),G,Q;if(typeof X.filter==="function")Q=X.filter,Z=Q("",Z);else if(X0(X.filter))Q=X.filter,G=Q;let Y=[];if(typeof Z!=="object"||Z===null)return"";let z=g4[X.arrayFormat],B=z==="comma"&&X.commaRoundTrip;if(!G)G=Object.keys(Z);if(X.sort)G.sort(X.sort);let K=new WeakMap;for(let V=0;V<G.length;++V){let F=G[V];if(X.skipNulls&&Z[F]===null)continue;h4(Y,m4(Z[F],F,z,B,X.allowEmptyArrays,X.strictNullHandling,X.skipNulls,X.encodeDotInKeys,X.encode?X.encoder:null,X.filter,X.sort,X.allowDots,X.serializeDate,X.format,X.formatter,X.encodeValuesOnly,X.charset,K))}let W=Y.join(X.delimiter),C=X.addQueryPrefix===!0?"?":"";if(X.charsetSentinel)if(X.charset==="iso-8859-1")C+="utf8=%26%2310003%3B&";else C+="utf8=%E2%9C%93&";return W.length>0?C+W:""}var g4,h4=function(J,$){Array.prototype.push.apply(J,X0($)?$:[$])},I9,a,Y6;var d4=M(()=>{b4();X6();Q0();g4={brackets(J){return String(J)+"[]"},comma:"comma",indices(J,$){return String(J)+"["+$+"]"},repeat(J){return String(J)}},a={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:f4,encodeValuesOnly:!1,format:J6,formatter:$6,indices:!1,serializeDate(J){return(I9??=Function.prototype.call.bind(Date.prototype.toISOString))(J)},skipNulls:!1,strictNullHandling:!1};Y6={}});function c4(J){return u4(J,{arrayFormat:"brackets"})}var z6=M(()=>{d4()});var D0={};R4(D0,{util:()=>K6,stream:()=>X1,path:()=>j,os:()=>f9,fs:()=>_0,crypto:()=>k0,child_process:()=>B6});import*as B6 from"node:child_process";import*as k0 from"node:crypto";import*as _0 from"node:fs";import*as f9 from"node:os";import*as j from"node:path";import*as X1 from"node:stream";import*as K6 from"node:util";var K0=()=>{};function Q1(J){if(!J)return;let $;try{$=new URL(J)}catch(X){throw new m(`Invalid token endpoint base URL "${J}": ${X}`)}if($.protocol==="https:")return;let Z=$.hostname.toLowerCase().replace(/^\[|\]$/g,"");if($.protocol==="http:"&&(Z==="localhost"||Z==="127.0.0.1"||Z==="::1"))return;throw new m(`Refusing to send credential over non-https token endpoint "${J}"`)}async function Y1(J,$){let Z=await b9(J),X;try{X=JSON.parse(Z)}catch{throw new m(`Token endpoint returned non-JSON response (status ${J.status})`,J.status,W0(Z),$)}if(!X.access_token)throw new m(`Token endpoint response missing access_token: ${JSON.stringify(W0(X))}`,J.status,W0(X),$);if(X.token_type&&X.token_type.toLowerCase()!=="bearer")throw new m(`Token endpoint response: unsupported token_type "${X.token_type}" (want Bearer)`,J.status,W0(X),$);return X}function W0(J){if(J==null)return J;if(typeof J==="string"){let $;try{$=JSON.parse(J)}catch{if(J.length<=W6)return J;return J.slice(0,W6)+`... <${J.length-W6} more chars>`}return JSON.stringify(W0($))}if(typeof J==="object"&&!Array.isArray(J)){let $={};for(let[Z,X]of Object.entries(J))if(v9.has(Z))$[Z]=X;return $}return null}async function z1(J,$=(Z)=>console.warn(`puku-ai/sdk: ${Z}`)){if(typeof process>"u"||process.platform==="win32")return;let{fs:Z}=await Promise.resolve().then(() => (K0(),D0)),X=J,G;try{X=await Z.promises.realpath(J),G=await Z.promises.stat(X)}catch{return}let Q=G.mode&511;if(Q&18)throw new m(`Credentials file at ${X} is group/world-writable (mode 0o${Q.toString(8)}); this allows other local users to plant tokens. Run \`chmod 600 ${X}\`.`);if(Q&36)throw new m(`Credentials file at ${X} is group/world-readable (mode 0o${Q.toString(8)}); run \`chmod 600 ${X}\` before retrying.`);if(typeof process.getuid==="function"&&G.uid!==process.getuid())$(`credentials file at ${X} is owned by uid ${G.uid} (current process uid ${process.getuid()}); verify this is intentional.`)}async function B1(J,$){let{fs:Z,path:X}=await Promise.resolve().then(() => (K0(),D0)),G=X.dirname(J);await Z.promises.mkdir(G,{recursive:!0,mode:448});let Q=`${J}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;try{let Y=await Z.promises.open(Q,"w",384);try{await Y.writeFile(JSON.stringify($,null,2)),await Y.sync()}finally{await Y.close()}await Z.promises.rename(Q,J)}catch(Y){throw await Z.promises.unlink(Q).catch(()=>{}),Y}try{let Y=await Z.promises.open(G,"r");try{await Y.sync()}finally{await Y.close()}}catch{}}async function b9(J){if(!J.body)return"";let $=J.body.getReader(),Z=[],X=0;for(;;){let{done:Q,value:Y}=await $.read();if(Q)break;if(X+Y.length>p4){let z=p4-X;if(z>0)Z.push(Y.subarray(0,z));await $.cancel();break}Z.push(Y),X+=Y.length}let G;if(Z.length===1)G=Z[0];else{G=new Uint8Array(Z.reduce((Y,z)=>Y+z.length,0));let Q=0;for(let Y of Z)G.set(Y,Q),Q+=Y.length}return new TextDecoder("utf-8").decode(G)}var l4="urn:ietf:params:oauth:grant-type:jwt-bearer",i4="refresh_token",G1="/v1/oauth/token",f0="oauth-2025-04-20",V6="oidc-federation-2026-04-01",n4=120,N2=30,a4=5,p4=1048576,W6=2000,v9,m;var r0=M(()=>{c();v9=new Set(["error","error_description","error_uri"]);m=class m extends T{statusCode;body;requestId;constructor(J,$=null,Z=null,X=null){super(J);this.statusCode=$,this.body=Z,this.requestId=X}}});function w0(){return Math.floor(Date.now()/1000)}class C6{provider;cached=null;pendingRefresh=null;nextForce=!1;lastAdvisoryError=0;onAdvisoryRefreshError;constructor(J,$){this.provider=J,this.onAdvisoryRefreshError=$}async getToken(){let J=this.nextForce;this.nextForce=!1;let $=this.cached;if(J||$==null)return(await this.refresh(J)).token;if($.expiresAt==null)return $.token;let Z=$.expiresAt-w0();if(Z>n4)return $.token;if(Z>N2)return this.backgroundRefresh(),$.token;return(await this.refresh()).token}invalidate(){this.cached=null,this.nextForce=!0}refresh(J=!1){if(this.pendingRefresh&&!J)return this.pendingRefresh;return this.doRefresh(J)}backgroundRefresh(){if(this.pendingRefresh)return;if(w0()-this.lastAdvisoryError<a4)return;this.doRefresh().catch((J)=>{this.lastAdvisoryError=w0(),this.onAdvisoryRefreshError?.(J)})}doRefresh(J=!1){return this.pendingRefresh=this.provider(J?{forceRefresh:!0}:void 0).then(($)=>{return this.cached=$,this.pendingRefresh=null,$},($)=>{throw this.pendingRefresh=null,$}),this.pendingRefresh}}var o4=M(()=>{r0()});var x=(J)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[J]?.trim()||void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(J)?.trim()||void 0;return};function s4(J){let $=0;for(let G of J)$+=G.length;let Z=new Uint8Array($),X=0;for(let G of J)Z.set(G,X),X+=G.length;return Z}function v0(J){let $;return(r4??($=new globalThis.TextEncoder,r4=$.encode.bind($)))(J)}function t0(J){let $;return(t4??($=new globalThis.TextDecoder,t4=$.decode.bind($)))(J)}var r4,t4;var r2=(J)=>{if(typeof globalThis.Buffer<"u"){let $=globalThis.Buffer.from(J,"base64");return new Uint8Array($.buffer,$.byteOffset,$.byteLength)}if(typeof atob<"u"){let $=atob(J),Z=new Uint8Array($.length);for(let X=0;X<$.length;X++)Z[X]=$.charCodeAt(X);return Z}throw new T("Cannot decode base64 string; Expected `Buffer` or `atob` to be defined")};var K1=M(()=>{c()});function t2(){}function W1(J,$,Z){if(!$||V1[J]>V1[Z])return t2;else return $[J].bind($)}function N6(J,$){let Z=e4.get(J);if(Z&&Z[0]===$)return Z[1];let X={error:W1("error",J,$),warn:W1("warn",J,$),info:W1("info",J,$),debug:W1("debug",J,$)};return e4.set(J,[$,X]),X}function k(J){let $=J.logger,Z=J.logLevel??"off";if(!$)return g9;return N6($,Z)}function $$(){let J=x("PUKU_LOG");if(!U6||J!==J$)J$=J,U6=N6(console,C1(J,"process.env['PUKU_LOG']",N6(console,s2))??s2);return U6}var s2="warn",V1,C1=(J,$,Z)=>{if(!J)return;if(H4(V1,J))return J;Z.warn(`${$} was set to ${JSON.stringify(J)}, expected one of ${JSON.stringify(Object.keys(V1))}`);return},g9,e4,J$,U6,j0=(J)=>{if(J.options)J.options={...J.options},delete J.options.headers;if(J.headers)J.headers=Object.fromEntries((J.headers instanceof Headers?[...J.headers]:Object.entries(J.headers)).map(([$,Z])=>[$,$.toLowerCase()==="authorization"||$.toLowerCase()==="api-key"||$.toLowerCase()==="x-api-key"||$.toLowerCase()==="cookie"||$.toLowerCase()==="set-cookie"?"***":Z]));if("retryOfRequestLogID"in J){if(J.retryOfRequestLogID)J.retryOf=J.retryOfRequestLogID;delete J.retryOfRequestLogID}return J};var O0=M(()=>{Q0();V1={off:0,error:200,warn:300,info:400,debug:500};g9={error:t2,warn:t2,info:t2,debug:t2},e4=new WeakMap});var F6=M(()=>{Q0();K1();O0();z6()});function Z$(J){if(!J)throw Error("profile name is empty");if(J==="."||J==="..")throw Error(`profile name "${J}" is not allowed`);if(J.includes("/")||J.includes("\\"))throw Error(`profile name "${J}" must not contain path separators`);if(!h9.test(J))throw Error(`profile name "${J}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`)}var U1="1.0",h9,X$=async(J)=>{let $=await q6();if($===null)return null;let Z=J??await Q$();if(Z===null)return null;Z$(Z);let{fs:X,path:G}=await Promise.resolve().then(() => (K0(),D0)),Q=G.join($,"configs",`${Z}.json`),Y;try{Y=await X.promises.readFile(Q,"utf-8")}catch(K){if(K?.code!=="ENOENT")throw Error(`failed to read config file ${Q}: ${K}`);Y=null}if(Y===null){let K=x("PUKU_ORGANIZATION_ID"),W=x("PUKU_IDENTITY_TOKEN_FILE"),C=x("PUKU_FEDERATION_RULE_ID");if(C&&K)return{fromFile:!1,config:{organization_id:K,workspace_id:x("PUKU_WORKSPACE_ID"),base_url:x("PUKU_BASE_URL"),authentication:{type:"oidc_federation",federation_rule_id:C,service_account_id:x("PUKU_SERVICE_ACCOUNT_ID"),identity_token:W?{source:"file",path:W}:void 0,scope:x("PUKU_SCOPE")}}};return null}let z;try{z=JSON.parse(Y)}catch(K){throw Error(`failed to parse config file ${Q}: ${K}`)}if(!z.authentication)throw Error(`config file ${Q} is missing "authentication"`);let B=z.authentication.type;if(B!=="oidc_federation"&&B!=="user_oauth")throw Error(`authentication.type "${B}" is not a known authentication type`);if(z.organization_id??=x("PUKU_ORGANIZATION_ID"),z.workspace_id??=x("PUKU_WORKSPACE_ID"),z.base_url??=x("PUKU_BASE_URL"),z.authentication.scope??=x("PUKU_SCOPE"),z.authentication.type==="oidc_federation"){if(!z.authentication.identity_token){let K=x("PUKU_IDENTITY_TOKEN_FILE");if(K)z.authentication.identity_token={source:"file",path:K}}if(!z.authentication.federation_rule_id)z.authentication.federation_rule_id=x("PUKU_FEDERATION_RULE_ID")??"";z.authentication.service_account_id??=x("PUKU_SERVICE_ACCOUNT_ID")}return{config:z,fromFile:!0}},G$=async(J,$)=>{if(J?.authentication.credentials_path)return J.authentication.credentials_path;let Z=await q6();if(!Z)return null;let X=$??await Q$();if(!X)return null;Z$(X);let{path:G}=await Promise.resolve().then(() => (K0(),D0));return G.join(Z,"credentials",`${X}.json`)},q6=async()=>{if(!m9())return null;let{path:J}=await Promise.resolve().then(() => (K0(),D0)),$=x("PUKU_CONFIG_DIR");if($)return $;if(a2()["X-Stainless-OS"]==="Windows"){let Q=x("APPDATA");if(Q)return J.join(Q,"PukuAI");let Y=x("USERPROFILE");if(Y)return J.join(Y,"AppData","Roaming","PukuAI");return null}let X=x("XDG_CONFIG_HOME");if(X)return J.join(X,"puku");let G=x("HOME");if(G)return J.join(G,".config","puku");return null},m9=()=>{let J=a2()["X-Stainless-Runtime"];return J==="node"||J==="deno"},Q$=async()=>{let J=await q6();if(!J)return null;let $=x("PUKU_PROFILE");if($)return $;let{fs:Z,path:X}=await Promise.resolve().then(() => (K0(),D0)),G=X.join(J,"active_config");try{return(await Z.promises.readFile(G,"utf-8")).trim()||"default"}catch(Q){if(Q?.code!=="ENOENT")throw Error(`failed to read ${G}: ${Q}`);return"default"}};var M6=M(()=>{s8();F6();h9=/^[A-Za-z0-9_.-]+$/});function T6(J){if(!J)throw new T("Identity token file path is empty");return async()=>{let{fs:$}=await Promise.resolve().then(() => (K0(),D0)),Z;try{Z=await $.promises.readFile(J,"utf-8")}catch(G){throw new T(`Failed to read identity token file at ${J}: ${G}`)}let X=Z.trim();if(!X)throw new T(`Identity token file at ${J} is empty`);return X}}function Y$(J){if(!J)throw new T("Identity token value is empty");return()=>J}var z$=M(()=>{c()});function B$(J){return async()=>{Q1(J.baseURL);let $=await J.identityTokenProvider();if($.length>16384)throw new m(`Identity token is ${Math.ceil($.length/1024)} KiB, exceeds the 16 KiB assertion limit`);let Z={grant_type:l4,assertion:$,federation_rule_id:J.federationRuleId,organization_id:J.organizationId};if(J.serviceAccountId)Z.service_account_id=J.serviceAccountId;if(J.workspaceId)Z.workspace_id=J.workspaceId;let X=`${J.baseURL}${G1}`,G;try{G=await J.fetch(X,{method:"POST",headers:{"Content-Type":"application/json","puku-beta":`${f0},${V6}`,"User-Agent":J.userAgent||`puku-ai-sdk-typescript/${B0} oidcFederationProvider`},body:JSON.stringify(Z)})}catch(B){throw new m(`Failed to reach token endpoint ${X}: ${B}`)}let Q=G.headers.get("Request-Id");if(!G.ok){let B=await G.text().catch(()=>""),K=W0(B),W="";if(G.status===401)W=` Ensure your federation rule matches your identity token. ${J.workspaceId?"":"If your federation rule is scoped to multiple workspaces, set the PUKU_WORKSPACE_ID environment variable, the 'workspace_id' config key, or the `workspaceId` option. "}View your authentication events in the Workload identity page of Puku Console for more details.`;throw new m(`Token exchange failed with status ${G.status}${Q?` (request-id ${Q})`:""}: ${K}${W}`,G.status,K,Q)}let Y=await Y1(G,Q),z=Number(Y.expires_in);if(!Number.isFinite(z))throw new m(`Token endpoint response missing required fields: ${JSON.stringify(W0(Y))}`,G.status,W0(Y),Q);return{token:Y.access_token,expiresAt:w0()+z}}}var K$=M(()=>{r0()});function W$(J){return async($)=>{let{fs:Z}=await Promise.resolve().then(() => (K0(),D0));await z1(J.credentialsPath,J.onSafetyWarning);let X;try{X=await Z.promises.readFile(J.credentialsPath,"utf-8")}catch(R){throw new m(`Credentials file not found at ${J.credentialsPath}: ${R}`)}let G;try{G=JSON.parse(X)}catch(R){throw new m(`Credentials file at ${J.credentialsPath} is not valid JSON: ${R}`)}let Q=G.access_token;if(!Q)throw new m(`Credentials file at ${J.credentialsPath} must include 'access_token'`);let Y=G.expires_at;if(!$?.forceRefresh&&(Y==null||w0()<Y-N2))return{token:Q,expiresAt:Y??null};let z=G.refresh_token;if(!J.clientId||!z)throw new m(`Access token at ${J.credentialsPath} has expired and no refresh is available (client_id ${J.clientId?"set":"empty"}, refresh_token ${z?"set":"empty"})`);Q1(J.baseURL);let B={grant_type:i4,refresh_token:z,client_id:J.clientId},K=`${J.baseURL}${G1}`,W;try{W=await J.fetch(K,{method:"POST",headers:{"Content-Type":"application/json","puku-beta":f0,"User-Agent":J.userAgent||`puku-ai-sdk-typescript/${B0} userOAuthProvider`},body:JSON.stringify(B)})}catch(R){throw new m(`User OAuth refresh failed to reach token endpoint: ${R}`)}let C=W.headers.get("Request-Id");if(!W.ok){let R=await W.text().catch(()=>"");throw new m(`User OAuth refresh failed (HTTP ${W.status}): ${W0(R)}`,W.status,W0(R),C)}let V=await Y1(W,C),F=Number(V.expires_in);if(!Number.isFinite(F))throw new m(`User OAuth refresh response missing or invalid expires_in: ${JSON.stringify(W0(V))}`,W.status,W0(V),C);let q=w0()+F,A=V.refresh_token||z;return await B1(J.credentialsPath,{...G,version:U1,type:"oauth_token",access_token:V.access_token,expires_at:q,refresh_token:A}),{token:V.access_token,expiresAt:q}}}var V$=M(()=>{M6();r0()});function w6(J,$){let Z=J.authentication.credentials_path??null,X=(J.base_url||$.baseURL).replace(/\/+$/,""),G=u9(J,Z,X,$),Q={};if(J.workspace_id&&J.authentication.type==="user_oauth")Q["puku-workspace-id"]=J.workspace_id;return{provider:G,extraHeaders:Q,baseURL:J.base_url||void 0}}async function C$(J,$){let Z=await X$($);if(!Z)return null;let{config:X,fromFile:G}=Z,Q=X.authentication.credentials_path||!G?X:{...X,authentication:{...X.authentication,credentials_path:await G$(X,$)??void 0}};return w6(Q,J)}function u9(J,$,Z,X){switch(J.authentication.type){case"oidc_federation":{let G=J.authentication,Q=d9(G);if(!Q)throw new m("oidc_federation config requires an identity token (set authentication.identity_token, PUKU_IDENTITY_TOKEN_FILE, or PUKU_IDENTITY_TOKEN)");if(!G.federation_rule_id)throw new m("oidc_federation config requires 'federation_rule_id'. Set it in authentication.federation_rule_id in your profile, or via PUKU_FEDERATION_RULE_ID (profile takes precedence).");if(!J.organization_id)throw new m("oidc_federation config requires organization_id (set PUKU_ORGANIZATION_ID or config.organization_id)");let Y=B$({identityTokenProvider:Q,federationRuleId:G.federation_rule_id,organizationId:J.organization_id,serviceAccountId:G.service_account_id,workspaceId:J.workspace_id,baseURL:Z,fetch:X.fetch,userAgent:X.userAgent});if($)return c9(Y,$,X.onCacheWriteError,X.onSafetyWarning);return Y}case"user_oauth":{if(!$)throw new m("user_oauth config requires authentication.credentials_path (or load via a profile so it defaults to <config_dir>/credentials/<profile>.json)");return W$({credentialsPath:$,clientId:J.authentication.client_id,baseURL:Z,fetch:X.fetch,userAgent:X.userAgent,onSafetyWarning:X.onSafetyWarning})}default:{let G=J.authentication.type;throw new m(`authentication.type "${G}" is not a known authentication type`)}}}function d9(J){if(J.identity_token){let X=J.identity_token.source;if(X!=="file")throw new m(`identity_token.source "${X}" is not supported by this SDK version (only "file")`);if(!J.identity_token.path)throw new m('identity_token.source "file" requires a non-empty path');return T6(J.identity_token.path)}let $=x("PUKU_IDENTITY_TOKEN_FILE");if($)return T6($);let Z=x("PUKU_IDENTITY_TOKEN");if(Z)return Y$(Z);return null}function c9(J,$,Z,X){return async(G)=>{let{fs:Q}=await Promise.resolve().then(() => (K0(),D0));await z1($,X);let Y;try{let B=await Q.promises.readFile($,"utf-8");Y=JSON.parse(B);let K=Y?.access_token;if(K&&!G?.forceRefresh){let W=Y?.expires_at;if(W==null||w0()<W-N2)return{token:K,expiresAt:W??null}}}catch(B){if(B?.code!=="ENOENT"&&!(B instanceof SyntaxError))Z?.(B)}let z=await J(G);try{await B1($,{...Y??{},version:U1,type:"oauth_token",access_token:z.token,expires_at:z.expiresAt})}catch(B){Z?.(B)}return z}}var U$=M(()=>{M6();r0();z$();K$();V$()});function p9(J,$){for(let G=$??0;G<J.length;G++){if(J[G]===10)return{preceding:G,index:G+1,carriage:!1};if(J[G]===13)return{preceding:G,index:G+1,carriage:!0}}return null}function N$(J){for(let X=0;X<J.length-1;X++){if(J[X]===10&&J[X+1]===10)return X+2;if(J[X]===13&&J[X+1]===13)return X+2;if(J[X]===13&&J[X+1]===10&&X+3<J.length&&J[X+2]===13&&J[X+3]===10)return X+4}return-1}var F2;var O6=M(()=>{F2=class F2{static NEWLINE_CHARS=new Set([`
|
|
2
2
|
`,"\r"]);static NEWLINE_REGEXP=/\r\n|[\n\r]/g;#J;#$;constructor(){this.#J=new Uint8Array,this.#$=null}decode(J){if(J==null)return[];let $=J instanceof ArrayBuffer?new Uint8Array(J):typeof J==="string"?v0(J):J;this.#J=s4([this.#J,$]);let Z=[],X;while((X=p9(this.#J,this.#$))!=null){if(X.carriage&&this.#$==null){this.#$=X.index;continue}if(this.#$!=null&&(X.index!==this.#$+1||X.carriage)){Z.push(t0(this.#J.subarray(0,this.#$-1))),this.#J=this.#J.subarray(this.#$),this.#$=null;continue}let G=this.#$!==null?X.preceding-1:X.preceding,Q=t0(this.#J.subarray(0,G));Z.push(Q),this.#J=this.#J.subarray(X.index),this.#$=null}return Z}flush(){if(!this.#J.length)return[];return this.decode(`
|
|
3
3
|
`)}}});async function*F$(J,$){if(!J.body){if($.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new T("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new T("Attempted to iterate over a response with no body")}let Z=new q$,X=new F2,G=o2(J.body);for await(let Q of l9(G))for(let Y of X.decode(Q)){let z=Z.decode(Y);if(z)yield z}for(let Q of X.flush()){let Y=Z.decode(Q);if(Y)yield Y}}async function*l9(J){let $=new Uint8Array;for await(let Z of J){if(Z==null)continue;let X=Z instanceof ArrayBuffer?new Uint8Array(Z):typeof Z==="string"?v0(Z):Z,G=new Uint8Array($.length+X.length);G.set($),G.set(X,$.length),$=G;let Q;while((Q=N$($))!==-1)yield $.slice(0,Q),$=$.slice(Q)}if($.length>0)yield $}class q${data;event;chunks;constructor(){this.event=null,this.data=[],this.chunks=[]}decode(J){if(J.endsWith("\r"))J=J.substring(0,J.length-1);if(!J){if(!this.event&&!this.data.length)return null;let G={event:this.event,data:this.data.join(`
|
|
4
4
|
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],G}if(this.chunks.push(J),J.startsWith(":"))return null;let[$,Z,X]=i9(J,":");if(X.startsWith(" "))X=X.substring(1);if($==="event")this.event=X;else if($==="data")this.data.push(X);return null}}function i9(J,$){let Z=J.indexOf($);if(Z!==-1)return[J.substring(0,Z),$,J.substring(Z+$.length)];return[J,"",""]}var s;var q2=M(()=>{c();O6();Q0();O0();c();J1();s=class s{iterator;controller;#J;constructor(J,$,Z){this.iterator=J;this.controller=$,this.#J=Z}static rawEvents(J,$=new AbortController){return F$(J,$)}static fromSSEResponse(J,$,Z){let X=!1,G=Z?k(Z):console;async function*Q(){if(X)throw new T("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");X=!0;let Y=!1;try{for await(let z of F$(J,$)){if(z.event==="completion")try{yield JSON.parse(z.data)}catch(B){throw G.error("Could not parse message into JSON:",z.data),G.error("From chunk:",z.raw),B}if(z.event==="message_start"||z.event==="message_delta"||z.event==="message_stop"||z.event==="content_block_start"||z.event==="content_block_delta"||z.event==="content_block_stop"||z.event==="message"||z.event==="user.message"||z.event==="user.interrupt"||z.event==="user.tool_confirmation"||z.event==="user.custom_tool_result"||z.event==="user.tool_result"||z.event==="agent.message"||z.event==="agent.thinking"||z.event==="agent.tool_use"||z.event==="agent.tool_result"||z.event==="agent.mcp_tool_use"||z.event==="agent.mcp_tool_result"||z.event==="agent.custom_tool_use"||z.event==="agent.thread_context_compacted"||z.event==="session.status_running"||z.event==="session.status_idle"||z.event==="session.status_rescheduled"||z.event==="session.status_terminated"||z.event==="session.error"||z.event==="session.deleted"||z.event==="session.updated"||z.event==="span.model_request_start"||z.event==="span.model_request_end"||z.event==="span.outcome_evaluation_start"||z.event==="span.outcome_evaluation_ongoing"||z.event==="span.outcome_evaluation_end"||z.event==="user.define_outcome"||z.event==="agent.thread_message_received"||z.event==="agent.thread_message_sent"||z.event==="agent.session_thread_message_received"||z.event==="agent.session_thread_message_sent"||z.event==="session.thread_created"||z.event==="session.thread_status_created"||z.event==="session.thread_status_running"||z.event==="session.thread_status_idle"||z.event==="session.thread_status_rescheduled"||z.event==="session.thread_status_terminated"||z.event==="event_start"||z.event==="event_delta"||z.event==="system.message")try{yield JSON.parse(z.data)}catch(B){throw G.error("Could not parse message into JSON:",z.data),G.error("From chunk:",z.raw),B}if(z.event==="ping")continue;if(z.event==="error"){let B=o0(z.data)??z.data,K=B?.error?.type;throw new l(void 0,B,void 0,J.headers,K)}}Y=!0}catch(z){if(U0(z))return;throw z}finally{if(!Y)$.abort();H0($)}}return new s(Q,$,Z)}static fromReadableStream(J,$,Z){let X=!1;async function*G(){let Y=new F2,z=o2(J);for await(let B of z)for(let K of Y.decode(B))yield K;for(let B of Y.flush())yield B}async function*Q(){if(X)throw new T("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");X=!0;let Y=!1;try{for await(let z of G()){if(Y)continue;if(z)yield JSON.parse(z)}Y=!0}catch(z){if(U0(z))return;throw z}finally{if(!Y)$.abort();H0($)}}return new s(Q,$,Z)}[Symbol.asyncIterator](){return this.iterator()}tee(){let J=[],$=[],Z=this.iterator(),X=(G)=>{return{next:()=>{if(G.length===0){let Q=Z.next();J.push(Q),$.push(Q)}return G.shift()}}};return[new s(()=>X(J),this.controller,this.#J),new s(()=>X($),this.controller,this.#J)]}toReadableStream(){let J=this,$;return s1({async start(){$=J[Symbol.asyncIterator]()},async pull(Z){try{let{value:X,done:G}=await $.next();if(G)return Z.close();let Q=v0(JSON.stringify(X)+`
|
|
@@ -65,4 +65,4 @@ new PukuAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
|
65
65
|
|
|
66
66
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let Y of J.seen.entries()){let z=Y[1];if($===Y[0]){Q(Y);continue}if(J.external){let K=J.external.registry.get(Y[0])?.id;if($!==Y[0]&&K){Q(Y);continue}}if(J.metadataRegistry.get(Y[0])?.id){Q(Y);continue}if(z.cycle){Q(Y);continue}if(z.count>1){if(J.reused==="ref"){Q(Y);continue}}}if(J.external)J.sharedDefsExtractedFor=J.external}function Q9(J){let $=J.anyOf;if(!Array.isArray($)||$.length===0||J.type!==void 0)return;let Z=[];for(let X of $){if(!X||typeof X!=="object")return;Q9(X);let G=Object.keys(X);if(G.length!==1||G[0]!=="type")return;let Q=X.type;for(let Y of Array.isArray(Q)?Q:[Q]){if(typeof Y!=="string")return;if(!Z.includes(Y))Z.push(Y)}}delete J.anyOf,J.type=Z.length===1?Z[0]:Z}var Y9=new Set(["type","properties","required","additionalProperties"]),Z9=["oneOf","anyOf"];function X9(J){let $=J.additionalProperties;if($===void 0||$===!1||typeof $!=="object"||$===null)return null;return Object.keys($).length?$:null}function F4(J){let $=[];for(let Q of J){if(typeof Q!=="object"||Q.type!=="object")return null;for(let Y in Q)if(!Y9.has(Y))return null;$.push(Q)}let Z={},X=new Set;for(let Q of $){for(let Y in Q.properties){if(Object.prototype.hasOwnProperty.call(Z,Y))continue;let z=[];for(let K of $){let W=K.properties?.[Y]??X9(K);if(W===null||W===void 0)continue;if(!z.some((C)=>JSON.stringify(C)===JSON.stringify(W)))z.push(W)}let B=z.length===1?z[0]:F4(z)??{allOf:z};i0(Z,Y,B)}for(let Y of Q.required??[])X.add(Y)}let G={type:"object",properties:Z};if(X.size)G.required=[...X];if($.every((Q)=>Q.additionalProperties===!1))G.additionalProperties=!1;else{let Q=[];for(let Y of $){let z=X9(Y);if(z&&!Q.some((B)=>JSON.stringify(B)===JSON.stringify(z)))Q.push(z)}if(Q.length===1)G.additionalProperties=Q[0];else if(Q.length>1)G.additionalProperties={allOf:Q}}return G}function rG(J){let $=J.allOf;if(!Array.isArray($)||$.length<2)return;for(let G of Y9)if(G in J)return;let Z=$.filter((G)=>Z9.some((Q)=>Array.isArray(G[Q]))),X=null;if(!Z.length)X=F4($);else{let G=Z[0],Q=Z9.find((B)=>Array.isArray(G[B]));if(Object.keys(G).length!==1)return;let Y=$.filter((B)=>B!==G),z=G[Q].map((B)=>F4([...Y,B]));if(z.some((B)=>!B))return;X={[Q]:z}}if(!X)return;delete J.allOf,a8(J,X)}function l1(J,$){let Z=J.seen.get($);if(!Z)throw Error("Unprocessed schema. This is a bug in Zod.");let X=(z)=>{let B=J.seen.get(z);if(B.ref===null)return;let K=B.def??B.schema,W={...K},C=B.ref;if(B.ref=null,C){X(C);let F=J.seen.get(C),q=F.schema;if(q.$ref&&(J.target==="draft-07"||J.target==="draft-04"||J.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(q);else a8(K,q);if(a8(K,W),z._zod.parent===C)for(let R in K){if(R==="$ref"||R==="allOf")continue;if(!(R in W))delete K[R]}if(q.$ref&&F.def)for(let R in K){if(R==="$ref"||R==="allOf")continue;if(R in F.def&&JSON.stringify(K[R])===JSON.stringify(F.def[R]))delete K[R]}}let V=z._zod.parent;if(V&&V!==C){X(V);let F=J.seen.get(V);if(F?.schema.$ref){if(K.$ref=F.schema.$ref,F.def)for(let q in K){if(q==="$ref"||q==="allOf")continue;if(q in F.def&&JSON.stringify(K[q])===JSON.stringify(F.def[q]))delete K[q]}}}J.override({zodSchema:z,jsonSchema:K,path:B.path??[]})};if(!J.external||J.sharedEmitDoneFor!==J.external){for(let z of[...J.seen.entries()].reverse())X(z[0]);if(J.target!=="openapi-3.0")for(let z of J.seen.entries())Q9(z[1].def??z[1].schema);for(let z of J.deferred)z();if(J.intersections.length){let z=new Map;for(let B of J.seen.values())for(let K of[B.schema,B.def]){let W=K?.allOf;if(!Array.isArray(W))continue;let C=z.get(W);if(C)C.push(K);else z.set(W,[K])}for(let B of J.intersections)for(let K of z.get(B)??[])rG(K)}}let G={};if(J.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(J.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(J.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(J.target==="openapi-3.0");if(J.external?.uri){let z=J.external.registry.get($)?.id;if(!z)throw Error("Schema is missing an `id` property");G.$id=J.external.uri(z)}a8(G,Z.defId?Z.schema:Z.def??Z.schema);let Q=J.metadataRegistry.get($)?.id;if(Q!==void 0&&G.id===Q)delete G.id;let Y=J.external?.defs??{};if(!J.external||J.sharedEmitDoneFor!==J.external)for(let z of J.seen.entries()){let B=z[1];if(B.def&&B.defId){if(B.def.id===B.defId)delete B.def.id;i0(Y,B.defId,B.def)}}if(J.external)J.sharedEmitDoneFor=J.external;if(J.external);else if(Object.keys(Y).length>0)if(J.target==="draft-2020-12")G.$defs=Y;else G.definitions=Y;try{let z=JSON.parse(JSON.stringify(G));return Object.defineProperty(z,"~standard",{value:{...$["~standard"],jsonSchema:{input:G9($,"input",J.processors),output:G9($,"output",J.processors)}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function z0(J,$){let Z=$??{seen:new Set};if(Z.seen.has(J))return!1;Z.seen.add(J);let X=J._zod.def;if(X.type==="transform")return!0;if(X.type==="array")return z0(X.element,Z);if(X.type==="set")return z0(X.valueType,Z);if(X.type==="lazy")return z0(X.getter(),Z);if(X.type==="promise"||X.type==="optional"||X.type==="nonoptional"||X.type==="nullable"||X.type==="readonly"||X.type==="default"||X.type==="prefault"||X.type==="catch")return z0(X.innerType,Z);if(X.type==="intersection")return z0(X.left,Z)||z0(X.right,Z);if(X.type==="record"||X.type==="map")return z0(X.keyType,Z)||z0(X.valueType,Z);if(X.type==="pipe"){if(J._zod.traits.has("$ZodCodec"))return!0;return z0(X.in,Z)||z0(X.out,Z)}if(X.type==="object"){for(let G in X.shape)if(z0(X.shape[G],Z))return!0;return!1}if(X.type==="union"){for(let G of X.options)if(z0(G,Z))return!0;return!1}if(X.type==="tuple"){for(let G of X.items)if(z0(G,Z))return!0;if(X.rest&&z0(X.rest,Z))return!0;return!1}return!1}var G9=(J,$,Z={})=>(X)=>{let{libraryOptions:G,target:Q}=X??{},Y=c1({...G??{},target:Q,io:$,processors:Z});return p(J,Y),p1(Y,J),l1(Y,J)};var tG={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sG=(J,$,Z,X)=>{let G=Z;G.type="string";let{minimum:Q,maximum:Y,format:z,patterns:B,contentEncoding:K,laxFormat:W}=J._zod.bag;if(typeof Q==="number")G.minLength=Q;if(typeof Y==="number")G.maxLength=Y;if(z){if(G.format=tG[z]??z,G.format==="")delete G.format;if(z==="time"||W)delete G.format}if(K)G.contentEncoding=K;if(B&&B.size>0){let C=[...B];if(C.length===1)G.pattern=C[0].source;else if(C.length>1)G.allOf=[...C.map((V)=>({...$.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},eG=(J,$,Z,X)=>{let G=Z,{minimum:Q,maximum:Y,format:z,multipleOf:B,exclusiveMaximum:K,exclusiveMinimum:W}=J._zod.bag;if(typeof z==="string"&&z.includes("int"))G.type="integer";else G.type="number";let C=typeof W==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),V=typeof K==="number"&&K<=(Y??Number.POSITIVE_INFINITY),F=$.target==="draft-04"||$.target==="openapi-3.0";if(C)if(F)G.minimum=W,G.exclusiveMinimum=!0;else G.exclusiveMinimum=W;else if(typeof Q==="number")G.minimum=Q;if(V)if(F)G.maximum=K,G.exclusiveMaximum=!0;else G.exclusiveMaximum=K;else if(typeof Y==="number")G.maximum=Y;if(typeof B==="number")if(Number.isFinite(B)&&B!==0)G.multipleOf=Math.abs(B);else $0(J,$,G,X,`A multipleOf divisor of ${B} cannot be represented in JSON Schema`)},J5=(J,$,Z,X)=>{Z.type="boolean"},$5=(J,$,Z,X)=>{$0(J,$,Z,X,"BigInt cannot be represented in JSON Schema")},Z5=(J,$,Z,X)=>{$0(J,$,Z,X,"Symbols cannot be represented in JSON Schema")},X5=(J,$,Z,X)=>{if($.target==="openapi-3.0")Z.type="string",Z.nullable=!0,Z.enum=[null];else Z.type="null"},G5=(J,$,Z,X)=>{$0(J,$,Z,X,"Undefined cannot be represented in JSON Schema")},Q5=(J,$,Z,X)=>{$0(J,$,Z,X,"Void cannot be represented in JSON Schema")},Y5=(J,$,Z,X)=>{Z.not={}},z5=(J,$,Z,X)=>{},B5=(J,$,Z,X)=>{},K5=(J,$,Z,X)=>{$0(J,$,Z,X,"Date cannot be represented in JSON Schema")},W5=(J,$,Z,X)=>{let G=J._zod.def,Q=oZ(G.entries);if(Q.length===0){Z.not={};return}if(Q.every((Y)=>typeof Y==="number"))Z.type="number";if(Q.every((Y)=>typeof Y==="string"))Z.type="string";Z.enum=Q},V5=(J,$,Z,X)=>{let G=J._zod.def;if(G.values.length===0){Z.not={};return}let Q=[];for(let Y of G.values)if(Y===void 0){if($0(J,$,Z,X,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof Y==="bigint"){if($0(J,$,Z,X,"BigInt literals cannot be represented in JSON Schema"))return;Q.push(Number(Y))}else Q.push(Y);if(Q.length===0);else if(Q.length===1){let Y=Q[0];if(Z.type=Y===null?"null":typeof Y,$.target==="draft-04"||$.target==="openapi-3.0")Z.enum=[Y];else Z.const=Y}else{if(Q.every((Y)=>typeof Y==="number"))Z.type="number";if(Q.every((Y)=>typeof Y==="string"))Z.type="string";if(Q.every((Y)=>typeof Y==="boolean"))Z.type="boolean";if(Q.every((Y)=>Y===null))Z.type="null";Z.enum=Q}},C5=(J,$,Z,X)=>{$0(J,$,Z,X,"NaN cannot be represented in JSON Schema")},U5=(J,$,Z,X)=>{let G=Z,Q=J._zod.pattern;if(!Q)throw Error("Pattern not found in template literal");G.type="string",G.pattern=Q.source},N5=(J,$,Z,X)=>{let G=Z,Q={type:"string",format:"binary",contentEncoding:"binary"},{minimum:Y,maximum:z,mime:B}=J._zod.bag;if(Y!==void 0)Q.minLength=Y;if(z!==void 0)Q.maxLength=z;if(B)if(B.length===1)Q.contentMediaType=B[0],Object.assign(G,Q);else Object.assign(G,Q),G.anyOf=B.map((K)=>({contentMediaType:K}));else Object.assign(G,Q)},F5=(J,$,Z,X)=>{Z.type="boolean"},q5=(J,$,Z,X)=>{$0(J,$,Z,X,"Custom types cannot be represented in JSON Schema")},M5=(J,$,Z,X)=>{$0(J,$,Z,X,"Function types cannot be represented in JSON Schema")},T5=(J,$,Z,X)=>{$0(J,$,Z,X,"Transforms cannot be represented in JSON Schema")},w5=(J,$,Z,X)=>{$0(J,$,Z,X,"Map cannot be represented in JSON Schema")},O5=(J,$,Z,X)=>{$0(J,$,Z,X,"Set cannot be represented in JSON Schema")},R5=(J,$,Z,X)=>{let G=Z,Q=J._zod.def,{minimum:Y,maximum:z}=J._zod.bag;if(typeof Y==="number")G.minItems=Y;if(typeof z==="number")G.maxItems=z;G.type="array",G.items=p(Q.element,$,{...X,path:[...X.path,"items"]})};function o8(J){let $=J._zod.def;if($.type==="pipe"&&$.in._zod.traits.has("$ZodTransform"))return o8($.out);if($.type==="catch")return o8($.innerType);return J._zod.optin}var A5=(J,$,Z,X)=>{let G=Z,Q=J._zod.def,Y=Q.shape;if(Object.getOwnPropertySymbols(Y).length&&$0(J,$,G,X,"Symbol keys cannot be represented in JSON Schema"))return;G.type="object",G.properties={};for(let W in Y)i0(G.properties,W,p(Y[W],$,{...X,path:[...X.path,"properties",W]}));let B=new Set(Object.keys(Y)),K=new Set([...B].filter((W)=>{let C=Q.shape[W];if($.io==="input")return o8(C)===void 0;else return C._zod.optout===void 0}));if(K.size>0)G.required=Array.from(K);if(Q.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!Q.catchall){if($.io==="output")G.additionalProperties=!1}else if(Q.catchall)G.additionalProperties=p(Q.catchall,$,{...X,path:[...X.path,"additionalProperties"]})},H5=(J,$,Z,X)=>{let G=J._zod.def,Q=G.inclusive===!1,Y=G.options.map((z,B)=>p(z,$,{...X,path:[...X.path,Q?"oneOf":"anyOf",B]}));if(Q)Z.oneOf=Y;else Z.anyOf=Y},L5=(J,$,Z,X)=>{let G=J._zod.def,Q=p(G.left,$,{...X,path:[...X.path,"allOf",0]}),Y=p(G.right,$,{...X,path:[...X.path,"allOf",1]}),z=(K)=>("allOf"in K)&&Object.keys(K).length===1,B=[...z(Q)?Q.allOf:[Q],...z(Y)?Y.allOf:[Y]];Z.allOf=B,$.intersections.push(B)},D5=(J,$,Z,X)=>{let G=Z,Q=J._zod.def;G.type="array";let Y=$.target==="draft-2020-12"?"prefixItems":"items",z=$.target==="draft-2020-12"?"items":$.target==="openapi-3.0"?"items":"additionalItems",B=Q.items.map((A,R)=>p(A,$,{...X,path:[...X.path,Y,R]})),K=Q.rest?p(Q.rest,$,{...X,path:[...X.path,z,...$.target==="openapi-3.0"?[Q.items.length]:[]]}):null,W=Q.items.length;while(W>0){let A=Q.items[W-1];if(!($.io==="input"?o8(A)!==void 0:A._zod.optout==="optional"))break;W--}let C=Q.items.length,V=!Q.rest;if($.target==="draft-2020-12"){if(G.prefixItems=B,V)G.items=!1;else if(K)G.items=K;if(W>0)G.minItems=W;if(V)G.maxItems=C}else if($.target==="openapi-3.0"){if(G.items={anyOf:B},K)G.items.anyOf.push(K);if(W>0)G.minItems=W;if(V)G.maxItems=C}else{if(G.items=B,V)G.additionalItems=!1;else if(K)G.additionalItems=K;if(W>0)G.minItems=W;if(V)G.maxItems=C}let{minimum:F,maximum:q}=J._zod.bag;if(typeof F==="number")G.minItems=F;if(typeof q==="number")G.maxItems=q};function q4(J,$,Z){if($.$ref){if(Z.has($))return $;Z.add($);let q=J.get($)?.def;if(!q)return $;let A=q4(J,q,Z);return A===q?$:A}for(let q of["anyOf","oneOf"]){let A=$[q];if(!Array.isArray(A))continue;let R=A.map((H)=>q4(J,H,Z));if(R.some((H,O)=>H!==A[O]))$={...$,[q]:R}}let X=Array.isArray($.type)?$.type:[$.type],G=!X.includes("string")&&X.some((q)=>q==="number"||q==="integer"),Q=$.enum??($.const!==void 0?[$.const]:void 0);if(!G&&!Q?.some((q)=>typeof q==="number"))return $;let{minimum:Y,maximum:z,exclusiveMinimum:B,exclusiveMaximum:K,multipleOf:W,format:C,id:V,...F}=$;if(F.enum)F.enum=F.enum.map((q)=>typeof q==="number"?String(q):q);else if(typeof F.const==="number")F.const=String(F.const);if(!G)return F;if(F.type="string",!Q)F.pattern=(X.includes("number")?tZ:rZ).source;return F}var M4=new WeakMap;function j5(J){let $=new Map;for(let X of J.seen.values())if(X.def&&!$.has(X.schema))$.set(X.schema,X);let Z=new Map;for(let X of M4.get(J)??[]){let G=J.seen.get(X),Q=(G?.def??G?.schema)?.propertyNames;if(!Q||Q===!0||Z.has(Q))continue;let Y=q4($,Q,new Set);if(Y!==Q)Z.set(Q,Y)}if(!Z.size)return;for(let X of J.seen.values())for(let G of[X.schema,X.def]){let Q=G&&Z.get(G.propertyNames);if(Q)G.propertyNames=Q}}var P5=(J,$,Z,X)=>{let G=Z,Q=J._zod.def;G.type="object";let Y=Q.keyType,B=Y._zod.bag?.patterns;if(Q.mode==="loose"&&B&&B.size>0){let C=p(Q.valueType,$,{...X,path:[...X.path,"patternProperties","*"]});G.patternProperties={};for(let V of B)i0(G.patternProperties,V.source,C)}else{if($.target==="draft-07"||$.target==="draft-2020-12"){G.propertyNames=p(Q.keyType,$,{...X,path:[...X.path,"propertyNames"]});let C=M4.get($);if(!C)C=[],M4.set($,C),$.deferred.push(()=>j5($));C.push(J)}G.additionalProperties=p(Q.valueType,$,{...X,path:[...X.path,"additionalProperties"]})}let K=Y._zod.values,W=$.io==="input"&&o8(Q.valueType)!==void 0;if(K&&!Q.partial&&!W){let C=[...K].filter((V)=>typeof V==="string"||typeof V==="number");if(C.length>0)G.required=C.map(String)}},S5=(J,$,Z,X)=>{let G=J._zod.def,Q=p(G.innerType,$,X),Y=$.seen.get(J);if($.target==="openapi-3.0")Y.ref=G.innerType,Z.nullable=!0;else Z.anyOf=[Q,{type:"null"}]},_5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);Q.ref=G.innerType},T4=Symbol();function B9(J,$,Z,X,G){let Q=!1,Y=JSON.stringify(J,(z,B)=>{if(typeof B!=="bigint")return B;return Q=!0,null});if(!Q)return JSON.parse(Y);return $0($,Z,X,G,"BigInt defaults cannot be represented in JSON Schema"),T4}var E5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);Q.ref=G.innerType;let Y=B9(G.defaultValue,J,$,Z,X);if(Y!==T4)Z.default=Y},I5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);if(Q.ref=G.innerType,$.io!=="input")return;let Y=B9(G.defaultValue,J,$,Z,X);if(Y!==T4)Z._prefault=Y},y5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);Q.ref=G.innerType;let Y;try{Y=G.catchValue(void 0)}catch{$0(J,$,Z,X,"Dynamic catch values are not supported in JSON Schema");return}Z.default=Y},x5=(J,$,Z,X)=>{let G=J._zod.def,Q=G.in._zod.traits.has("$ZodTransform"),Y=$.io==="input"?Q?G.out:G.in:G.out;p(Y,$,X);let z=$.seen.get(J);z.ref=Y},k5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);Q.ref=G.innerType,Z.readOnly=!0},f5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);Q.ref=G.innerType},v5=(J,$,Z,X)=>{let G=J._zod.def;p(G.innerType,$,X);let Q=$.seen.get(J);Q.ref=G.innerType},b5=(J,$,Z,X)=>{let G=J._zod.innerType;p(G,$,X);let Q=$.seen.get(J);Q.ref=G},z9={string:sG,number:eG,boolean:J5,bigint:$5,symbol:Z5,null:X5,undefined:G5,void:Q5,never:Y5,any:z5,unknown:B5,date:K5,enum:W5,literal:V5,nan:C5,template_literal:U5,file:N5,success:F5,custom:q5,function:M5,transform:T5,map:w5,set:O5,array:R5,object:A5,union:H5,intersection:L5,tuple:D5,record:P5,nullable:S5,nonoptional:_5,default:E5,prefault:I5,catch:y5,pipe:x5,readonly:k5,promise:f5,optional:v5,lazy:b5};function i1(J,$){if("_idmap"in J){let X=J,G=c1({...$,processors:z9}),Q={};for(let B of X._idmap.entries()){let[K,W]=B;p(W,G)}let Y={},z={registry:X,uri:$?.uri,defs:Q};G.external=z;for(let B of X._idmap.entries()){let[K,W]=B;p1(G,W),i0(Y,K,l1(G,W))}if(Object.keys(Q).length>0){let B=G.target==="draft-2020-12"?"$defs":"definitions";Y.__shared={[B]:Q}}return{schemas:Y}}let Z=c1({...$,processors:z9});return p(J,Z),p1(Z,J),l1(Z,J)}c();function g5(J){return{type:"json_schema",schema:{...x1(i1(J,{reused:"ref"}))},parse:(Z)=>{let X=J.safeParse(JSON.parse(Z));if(!X.success)throw new T(`Failed to parse structured output: ${X.error.message} cause: ${X.error.issues}`);return X.data}}}function h5(J){let $=i1(J.inputSchema,{reused:"ref"});if($.type!=="object")throw Error(`Zod schema for tool "${J.name}" must be an object, but got ${$.type}`);let Z=$;return{type:"custom",name:J.name,input_schema:Z,description:J.description,run:J.run,parse:(X)=>J.inputSchema.parse(X),...J.close?{close:J.close}:{}}}function m5(J){return{type:"memory_20250818",name:"memory",parse:($)=>$,run:($)=>{let Z=J[$.command];if(!Z)throw Error(`${$.command} not implemented`);return Z.bind(J)($)}}}I0();q0();K1();var u5=["image/jpeg","image/png","image/gif","image/webp"];function w4(J){return u5.includes(J)}function d5(J){return!J||J.startsWith("text/")||J==="application/pdf"||w4(J)}class R0 extends Error{constructor(J){super(J);this.name="UnsupportedMCPValueError"}}function K9(J,$,Z){let X={...J.inputSchema,type:"object",properties:J.inputSchema.properties??null,required:J.inputSchema.required??null};return{...{name:J.name,input_schema:X,...J.description!==void 0?{description:J.description}:{},...Z},run:async(Y)=>{let z=await $.callTool({name:J.name,arguments:Y});if(z.isError){let B=z.content.map((K)=>n1(K));throw new P(B)}if(z.content.length===0&&typeof z.structuredContent==="object"&&z.structuredContent!==null)return JSON.stringify(z.structuredContent);return z.content.map((B)=>n1(B))},parse:(Y)=>Y,[V0]:"mcpTool"}}function c5(J,$,Z){return J.map((X)=>K9(X,$,Z))}function W9(J,$){return{role:J.role,content:[n1(J.content,$)],[V0]:"mcpMessage"}}function p5(J,$){return J.map((Z)=>W9(Z,$))}function n1(J,$){switch(J.type){case"text":return{type:"text",text:J.text,...$,[V0]:"mcpContent"};case"image":{if(!w4(J.mimeType))throw new R0(`Unsupported image MIME type: ${J.mimeType}`);return{type:"image",source:{type:"base64",data:J.data,media_type:J.mimeType},...$,[V0]:"mcpContent"}}case"resource":return V9(J.resource,$,"mcpContent");case"resource_link":case"audio":throw new R0(`Unsupported MCP content type: ${J.type}`);default:throw new R0(`Unsupported MCP content type: ${J.type}`)}}function V9(J,$,Z="mcpResourceToContent"){let X=J.mimeType;if(X&&w4(X)){if(!("blob"in J))throw new R0(`Image resource must have blob data, not text. URI: ${J.uri}`);return{type:"image",source:{type:"base64",data:J.blob,media_type:X},...$,[V0]:Z}}if(X==="application/pdf"){if(!("blob"in J))throw new R0(`PDF resource must have blob data, not text. URI: ${J.uri}`);return{type:"document",source:{type:"base64",data:J.blob,media_type:"application/pdf"},...$,[V0]:Z}}if(!X||X.startsWith("text/"))return{type:"document",source:n5(J),...$,[V0]:Z};throw new R0(`Unsupported MIME type "${X}" for resource: ${J.uri}`)}function l5(J,$){if(J.contents.length===0)throw new R0("Resource contents array must contain at least one item");let Z=J.contents.find((X)=>d5(X.mimeType));if(!Z){let X=J.contents.map((G)=>G.mimeType).filter((G)=>G!==void 0);throw new R0(`No supported MIME type found in resource contents. Available: ${X.join(", ")}`)}return V9(Z,$)}function i5(J){if("blob"in J)return r2(J.blob);return new TextEncoder().encode(J.text)}function n5(J){return{type:"text",data:"text"in J?J.text:new TextDecoder().decode(r2(J.blob)),media_type:"text/plain"}}function a5(J){if(J.contents.length===0)throw new R0("Resource contents array must contain at least one item");let $=J.contents[0],Z=new URL($.uri).pathname.split("/").at(-1)||"file",X=$.mimeType,G=i5($),Q=new File([G],Z,X?{type:X}:void 0);return Q[V0]="mcpResourceToFile",Q}I0();KJ();export{w1 as toFile,t6 as setupSkills,Y2 as resolvePath,c5 as mcpTools,K9 as mcpTool,a5 as mcpResourceToFile,l5 as mcpResourceToContent,p5 as mcpMessages,W9 as mcpMessage,n1 as mcpContent,v1 as extractSkillArchive,P0 as default,h5 as betaZodTool,g5 as betaZodOutputFormat,QJ as betaWriteTool,m0 as betaTool,mG as betaRefusalFallbackMiddleware,GJ as betaReadTool,m5 as betaMemoryTool,d3 as betaJSONSchemaOutputFormat,BJ as betaGrepTool,zJ as betaGlobTool,YJ as betaEditTool,XJ as betaBashTool,TZ as betaAgentToolset20260401,B0 as VERSION,R0 as UnsupportedMCPValueError,p2 as UnprocessableEntityError,P as ToolError,s as Stream,t8 as RetryableError,l2 as RateLimitError,T as PukuError,P0 as PukuAI,u2 as PermissionDeniedError,T1 as PagePromise,f0 as OAUTH_API_BETA_HEADER,d2 as NotFoundError,D8 as MODEL_NONSTREAMING_TOKENS,i2 as InternalServerError,gZ as HUMAN_PROMPT,V6 as FEDERATION_BETA_HEADER,c2 as ConflictError,e1 as BetaFallbackState,g1 as BashTimeoutError,h1 as BashSession,d1 as BasePuku,h2 as BadRequestError,m2 as AuthenticationError,Z0 as APIUserAbortError,s0 as APIPromise,l as APIError,g2 as APIConnectionTimeoutError,S0 as APIConnectionError,hZ as AI_PROMPT};
|
|
67
67
|
|
|
68
|
-
//# debugId=
|
|
68
|
+
//# debugId=B92593A0D518752564756E2164756E21
|