@anthropic-ai/sdk 0.95.2 → 0.97.0
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/CHANGELOG.md +37 -0
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +1 -0
- package/api-promise.d.ts.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/bin/migration-config.json +222 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts.map +1 -1
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/credentials.mjs.map +1 -1
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/pagination.d.mts.map +1 -1
- package/core/pagination.d.ts.map +1 -1
- package/core/pagination.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.js +2 -0
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs +2 -0
- package/core/streaming.mjs.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/helpers/beta/environments.d.mts +22 -0
- package/helpers/beta/environments.d.mts.map +1 -0
- package/helpers/beta/environments.d.ts +22 -0
- package/helpers/beta/environments.d.ts.map +1 -0
- package/helpers/beta/environments.js +30 -0
- package/helpers/beta/environments.js.map +1 -0
- package/helpers/beta/environments.mjs +22 -0
- package/helpers/beta/environments.mjs.map +1 -0
- package/helpers/beta/json-schema.d.mts +6 -0
- package/helpers/beta/json-schema.d.mts.map +1 -1
- package/helpers/beta/json-schema.d.ts +6 -0
- package/helpers/beta/json-schema.d.ts.map +1 -1
- package/helpers/beta/json-schema.js +1 -0
- package/helpers/beta/json-schema.js.map +1 -1
- package/helpers/beta/json-schema.mjs +1 -0
- package/helpers/beta/json-schema.mjs.map +1 -1
- package/helpers/beta/mcp.d.mts.map +1 -1
- package/helpers/beta/mcp.d.ts.map +1 -1
- package/helpers/beta/mcp.mjs.map +1 -1
- package/helpers/beta/memory.d.mts.map +1 -1
- package/helpers/beta/memory.d.ts.map +1 -1
- package/helpers/beta/zod.d.mts +11 -5
- package/helpers/beta/zod.d.mts.map +1 -1
- package/helpers/beta/zod.d.ts +11 -5
- package/helpers/beta/zod.d.ts.map +1 -1
- package/helpers/beta/zod.js +1 -0
- package/helpers/beta/zod.js.map +1 -1
- package/helpers/beta/zod.mjs +1 -0
- package/helpers/beta/zod.mjs.map +1 -1
- package/helpers/index.d.mts.map +1 -1
- package/helpers/index.d.ts.map +1 -1
- package/helpers/index.mjs.map +1 -1
- package/helpers/json-schema.d.mts.map +1 -1
- package/helpers/json-schema.d.ts.map +1 -1
- package/helpers/json-schema.mjs.map +1 -1
- package/helpers/zod.d.mts +2 -2
- package/helpers/zod.d.mts.map +1 -1
- package/helpers/zod.d.ts +2 -2
- package/helpers/zod.d.ts.map +1 -1
- package/helpers/zod.js.map +1 -1
- package/helpers/zod.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/decoders/jsonl.d.mts.map +1 -1
- package/internal/decoders/jsonl.d.ts.map +1 -1
- package/internal/decoders/jsonl.mjs.map +1 -1
- package/internal/decoders/line.mjs.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts.map +1 -1
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/index.d.mts +2 -2
- package/internal/qs/index.d.mts.map +1 -1
- package/internal/qs/index.d.ts +2 -2
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.mts.map +1 -1
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/utils.d.mts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +6 -0
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +4 -4
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +4 -4
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/abort.d.mts +13 -0
- package/internal/utils/abort.d.mts.map +1 -0
- package/internal/utils/abort.d.ts +13 -0
- package/internal/utils/abort.d.ts.map +1 -0
- package/internal/utils/abort.js +26 -0
- package/internal/utils/abort.js.map +1 -0
- package/internal/utils/abort.mjs +23 -0
- package/internal/utils/abort.mjs.map +1 -0
- package/internal/utils/async-queue.d.mts +31 -0
- package/internal/utils/async-queue.d.mts.map +1 -0
- package/internal/utils/async-queue.d.ts +31 -0
- package/internal/utils/async-queue.d.ts.map +1 -0
- package/internal/utils/async-queue.js +75 -0
- package/internal/utils/async-queue.js.map +1 -0
- package/internal/utils/async-queue.mjs +71 -0
- package/internal/utils/async-queue.mjs.map +1 -0
- package/internal/utils/backoff.d.mts +23 -0
- package/internal/utils/backoff.d.mts.map +1 -0
- package/internal/utils/backoff.d.ts +23 -0
- package/internal/utils/backoff.d.ts.map +1 -0
- package/internal/utils/backoff.js +44 -0
- package/internal/utils/backoff.js.map +1 -0
- package/internal/utils/backoff.mjs +36 -0
- package/internal/utils/backoff.mjs.map +1 -0
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/promise.d.mts +11 -0
- package/internal/utils/promise.d.mts.map +1 -0
- package/internal/utils/promise.d.ts +11 -0
- package/internal/utils/promise.d.ts.map +1 -0
- package/internal/utils/promise.js +18 -0
- package/internal/utils/promise.js.map +1 -0
- package/internal/utils/promise.mjs +15 -0
- package/internal/utils/promise.mjs.map +1 -0
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/sleep.d.mts +9 -1
- package/internal/utils/sleep.d.mts.map +1 -1
- package/internal/utils/sleep.d.ts +9 -1
- package/internal/utils/sleep.d.ts.map +1 -1
- package/internal/utils/sleep.js +23 -2
- package/internal/utils/sleep.js.map +1 -1
- package/internal/utils/sleep.mjs +23 -2
- package/internal/utils/sleep.mjs.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.mjs.map +1 -1
- package/lib/BetaMessageStream.d.mts.map +1 -1
- package/lib/BetaMessageStream.d.ts.map +1 -1
- package/lib/BetaMessageStream.mjs.map +1 -1
- package/lib/MessageStream.d.mts.map +1 -1
- package/lib/MessageStream.d.ts.map +1 -1
- package/lib/MessageStream.mjs.map +1 -1
- package/lib/beta-parser.d.mts.map +1 -1
- package/lib/beta-parser.d.ts.map +1 -1
- package/lib/beta-parser.mjs.map +1 -1
- package/lib/credentials/credential-chain.d.mts.map +1 -1
- package/lib/credentials/credential-chain.d.ts.map +1 -1
- package/lib/credentials/credential-chain.mjs.map +1 -1
- package/lib/credentials/identity-token.d.mts.map +1 -1
- package/lib/credentials/identity-token.d.ts.map +1 -1
- package/lib/credentials/identity-token.mjs.map +1 -1
- package/lib/credentials/oidc-federation.d.mts.map +1 -1
- package/lib/credentials/oidc-federation.d.ts.map +1 -1
- package/lib/credentials/oidc-federation.mjs.map +1 -1
- package/lib/credentials/token-cache.d.mts.map +1 -1
- package/lib/credentials/token-cache.d.ts.map +1 -1
- package/lib/credentials/token-cache.mjs.map +1 -1
- package/lib/credentials/types.d.mts.map +1 -1
- package/lib/credentials/types.d.ts.map +1 -1
- package/lib/credentials/types.mjs.map +1 -1
- package/lib/credentials/user-oauth.d.mts.map +1 -1
- package/lib/credentials/user-oauth.d.ts.map +1 -1
- package/lib/credentials/user-oauth.mjs.map +1 -1
- package/lib/credentials.d.mts.map +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.mjs.map +1 -1
- package/lib/environments/index.d.mts +4 -0
- package/lib/environments/index.d.mts.map +1 -0
- package/lib/environments/index.d.ts +4 -0
- package/lib/environments/index.d.ts.map +1 -0
- package/lib/environments/index.js +18 -0
- package/lib/environments/index.js.map +1 -0
- package/lib/environments/index.mjs +4 -0
- package/lib/environments/index.mjs.map +1 -0
- package/lib/environments/poller.d.mts +89 -0
- package/lib/environments/poller.d.mts.map +1 -0
- package/lib/environments/poller.d.ts +89 -0
- package/lib/environments/poller.d.ts.map +1 -0
- package/lib/environments/poller.js +181 -0
- package/lib/environments/poller.js.map +1 -0
- package/lib/environments/poller.mjs +172 -0
- package/lib/environments/poller.mjs.map +1 -0
- package/lib/environments/worker.d.mts +143 -0
- package/lib/environments/worker.d.mts.map +1 -0
- package/lib/environments/worker.d.ts +143 -0
- package/lib/environments/worker.d.ts.map +1 -0
- package/lib/environments/worker.js +265 -0
- package/lib/environments/worker.js.map +1 -0
- package/lib/environments/worker.mjs +261 -0
- package/lib/environments/worker.mjs.map +1 -0
- package/lib/helper-client.d.mts +49 -0
- package/lib/helper-client.d.mts.map +1 -0
- package/lib/helper-client.d.ts +49 -0
- package/lib/helper-client.d.ts.map +1 -0
- package/lib/helper-client.js +57 -0
- package/lib/helper-client.js.map +1 -0
- package/lib/helper-client.mjs +54 -0
- package/lib/helper-client.mjs.map +1 -0
- package/lib/parser.d.mts.map +1 -1
- package/lib/parser.d.ts.map +1 -1
- package/lib/parser.mjs.map +1 -1
- package/lib/stainless-helper-header.d.mts.map +1 -1
- package/lib/stainless-helper-header.d.ts.map +1 -1
- package/lib/tools/BetaRunnableTool.d.mts +54 -2
- package/lib/tools/BetaRunnableTool.d.mts.map +1 -1
- package/lib/tools/BetaRunnableTool.d.ts +54 -2
- package/lib/tools/BetaRunnableTool.d.ts.map +1 -1
- package/lib/tools/BetaRunnableTool.js +37 -0
- package/lib/tools/BetaRunnableTool.js.map +1 -1
- package/lib/tools/BetaRunnableTool.mjs +34 -1
- package/lib/tools/BetaRunnableTool.mjs.map +1 -1
- package/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/lib/tools/BetaToolRunner.js +4 -14
- package/lib/tools/BetaToolRunner.js.map +1 -1
- package/lib/tools/BetaToolRunner.mjs +2 -12
- package/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/lib/tools/CompactionControl.d.mts.map +1 -1
- package/lib/tools/CompactionControl.d.ts.map +1 -1
- package/lib/tools/SessionToolRunner.d.mts +140 -0
- package/lib/tools/SessionToolRunner.d.mts.map +1 -0
- package/lib/tools/SessionToolRunner.d.ts +140 -0
- package/lib/tools/SessionToolRunner.d.ts.map +1 -0
- package/lib/tools/SessionToolRunner.js +459 -0
- package/lib/tools/SessionToolRunner.js.map +1 -0
- package/lib/tools/SessionToolRunner.mjs +455 -0
- package/lib/tools/SessionToolRunner.mjs.map +1 -0
- package/lib/tools/ToolError.d.mts.map +1 -1
- package/lib/tools/ToolError.d.ts.map +1 -1
- package/lib/tools/ToolRunner.d.mts.map +1 -1
- package/lib/tools/ToolRunner.d.ts.map +1 -1
- package/lib/tools/ToolRunner.mjs.map +1 -1
- package/lib/transform-json-schema.mjs.map +1 -1
- package/package.json +1 -1
- package/pagination.d.mts +1 -0
- package/pagination.d.mts.map +1 -1
- package/pagination.d.ts +1 -0
- package/pagination.d.ts.map +1 -1
- package/pagination.mjs +1 -0
- package/pagination.mjs.map +1 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +1 -0
- package/resource.d.ts.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/beta/agents/agents.d.mts +125 -1
- package/resources/beta/agents/agents.d.mts.map +1 -1
- package/resources/beta/agents/agents.d.ts +125 -1
- package/resources/beta/agents/agents.d.ts.map +1 -1
- package/resources/beta/agents/agents.js.map +1 -1
- package/resources/beta/agents/agents.mjs.map +1 -1
- package/resources/beta/agents/index.d.mts +1 -1
- package/resources/beta/agents/index.d.mts.map +1 -1
- package/resources/beta/agents/index.d.ts +1 -1
- package/resources/beta/agents/index.d.ts.map +1 -1
- package/resources/beta/agents/index.js.map +1 -1
- package/resources/beta/agents/index.mjs.map +1 -1
- package/resources/beta/agents/versions.d.mts.map +1 -1
- package/resources/beta/agents/versions.d.ts.map +1 -1
- package/resources/beta/agents/versions.mjs.map +1 -1
- package/resources/beta/agents.d.mts.map +1 -1
- package/resources/beta/agents.d.ts.map +1 -1
- package/resources/beta/agents.mjs.map +1 -1
- package/resources/beta/beta.d.mts +10 -10
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +10 -10
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +2 -2
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +2 -2
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/environments/environments.d.mts +425 -0
- package/resources/beta/environments/environments.d.mts.map +1 -0
- package/resources/beta/environments/environments.d.ts +425 -0
- package/resources/beta/environments/environments.d.ts.map +1 -0
- package/resources/beta/environments/environments.js +150 -0
- package/resources/beta/environments/environments.js.map +1 -0
- package/resources/beta/environments/environments.mjs +145 -0
- package/resources/beta/environments/environments.mjs.map +1 -0
- package/resources/beta/environments/index.d.mts +3 -0
- package/resources/beta/environments/index.d.mts.map +1 -0
- package/resources/beta/environments/index.d.ts +3 -0
- package/resources/beta/environments/index.d.ts.map +1 -0
- package/resources/beta/environments/index.js +9 -0
- package/resources/beta/environments/index.js.map +1 -0
- package/resources/beta/environments/index.mjs +4 -0
- package/resources/beta/environments/index.mjs.map +1 -0
- package/resources/beta/environments/work.d.mts +496 -0
- package/resources/beta/environments/work.d.mts.map +1 -0
- package/resources/beta/environments/work.d.ts +496 -0
- package/resources/beta/environments/work.d.ts.map +1 -0
- package/resources/beta/environments/work.js +274 -0
- package/resources/beta/environments/work.js.map +1 -0
- package/resources/beta/environments/work.mjs +268 -0
- package/resources/beta/environments/work.mjs.map +1 -0
- package/resources/beta/environments.d.mts +1 -388
- package/resources/beta/environments.d.mts.map +1 -1
- package/resources/beta/environments.d.ts +1 -388
- package/resources/beta/environments.d.ts.map +1 -1
- package/resources/beta/environments.js +2 -138
- package/resources/beta/environments.js.map +1 -1
- package/resources/beta/environments.mjs +1 -136
- package/resources/beta/environments.mjs.map +1 -1
- package/resources/beta/files.d.mts.map +1 -1
- package/resources/beta/files.d.ts.map +1 -1
- package/resources/beta/files.mjs.map +1 -1
- package/resources/beta/index.d.mts +4 -4
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +4 -4
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +12 -12
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/memory-stores/index.d.mts.map +1 -1
- package/resources/beta/memory-stores/index.d.ts.map +1 -1
- package/resources/beta/memory-stores/index.mjs.map +1 -1
- package/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/resources/beta/memory-stores/memories.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
- package/resources/beta/memory-stores.d.mts.map +1 -1
- package/resources/beta/memory-stores.d.ts.map +1 -1
- package/resources/beta/memory-stores.mjs.map +1 -1
- package/resources/beta/messages/batches.d.mts +5 -0
- package/resources/beta/messages/batches.d.mts.map +1 -1
- package/resources/beta/messages/batches.d.ts +5 -0
- package/resources/beta/messages/batches.d.ts.map +1 -1
- package/resources/beta/messages/batches.mjs.map +1 -1
- package/resources/beta/messages/index.d.mts +1 -1
- package/resources/beta/messages/index.d.mts.map +1 -1
- package/resources/beta/messages/index.d.ts +1 -1
- package/resources/beta/messages/index.d.ts.map +1 -1
- package/resources/beta/messages/index.js.map +1 -1
- package/resources/beta/messages/index.mjs.map +1 -1
- package/resources/beta/messages/messages.d.mts +80 -5
- package/resources/beta/messages/messages.d.mts.map +1 -1
- package/resources/beta/messages/messages.d.ts +80 -5
- package/resources/beta/messages/messages.d.ts.map +1 -1
- package/resources/beta/messages/messages.js.map +1 -1
- package/resources/beta/messages/messages.mjs.map +1 -1
- package/resources/beta/messages.d.mts.map +1 -1
- package/resources/beta/messages.d.ts.map +1 -1
- package/resources/beta/messages.mjs.map +1 -1
- package/resources/beta/models.d.mts.map +1 -1
- package/resources/beta/models.d.ts.map +1 -1
- package/resources/beta/models.mjs.map +1 -1
- package/resources/beta/sessions/events.d.mts +97 -9
- package/resources/beta/sessions/events.d.mts.map +1 -1
- package/resources/beta/sessions/events.d.ts +97 -9
- package/resources/beta/sessions/events.d.ts.map +1 -1
- package/resources/beta/sessions/events.js +27 -1
- package/resources/beta/sessions/events.js.map +1 -1
- package/resources/beta/sessions/events.mjs +25 -0
- package/resources/beta/sessions/events.mjs.map +1 -1
- package/resources/beta/sessions/index.d.mts +3 -3
- package/resources/beta/sessions/index.d.mts.map +1 -1
- package/resources/beta/sessions/index.d.ts +3 -3
- package/resources/beta/sessions/index.d.ts.map +1 -1
- package/resources/beta/sessions/index.js.map +1 -1
- package/resources/beta/sessions/index.mjs.map +1 -1
- package/resources/beta/sessions/resources.d.mts.map +1 -1
- package/resources/beta/sessions/resources.d.ts.map +1 -1
- package/resources/beta/sessions/resources.mjs.map +1 -1
- package/resources/beta/sessions/sessions.d.mts +101 -9
- package/resources/beta/sessions/sessions.d.mts.map +1 -1
- package/resources/beta/sessions/sessions.d.ts +101 -9
- package/resources/beta/sessions/sessions.d.ts.map +1 -1
- package/resources/beta/sessions/sessions.js.map +1 -1
- package/resources/beta/sessions/sessions.mjs.map +1 -1
- package/resources/beta/sessions/threads/events.d.mts.map +1 -1
- package/resources/beta/sessions/threads/events.d.ts.map +1 -1
- package/resources/beta/sessions/threads/events.mjs.map +1 -1
- package/resources/beta/sessions/threads/index.d.mts +1 -1
- package/resources/beta/sessions/threads/index.d.mts.map +1 -1
- package/resources/beta/sessions/threads/index.d.ts +1 -1
- package/resources/beta/sessions/threads/index.d.ts.map +1 -1
- package/resources/beta/sessions/threads/index.js.map +1 -1
- package/resources/beta/sessions/threads/index.mjs.map +1 -1
- package/resources/beta/sessions/threads/threads.d.mts +3 -23
- package/resources/beta/sessions/threads/threads.d.mts.map +1 -1
- package/resources/beta/sessions/threads/threads.d.ts +3 -23
- package/resources/beta/sessions/threads/threads.d.ts.map +1 -1
- package/resources/beta/sessions/threads/threads.js.map +1 -1
- package/resources/beta/sessions/threads/threads.mjs.map +1 -1
- package/resources/beta/sessions/threads.d.mts.map +1 -1
- package/resources/beta/sessions/threads.d.ts.map +1 -1
- package/resources/beta/sessions/threads.mjs.map +1 -1
- package/resources/beta/sessions.d.mts.map +1 -1
- package/resources/beta/sessions.d.ts.map +1 -1
- package/resources/beta/sessions.mjs.map +1 -1
- package/resources/beta/skills/index.d.mts +1 -1
- package/resources/beta/skills/index.d.mts.map +1 -1
- package/resources/beta/skills/index.d.ts +1 -1
- package/resources/beta/skills/index.d.ts.map +1 -1
- package/resources/beta/skills/index.js.map +1 -1
- package/resources/beta/skills/index.mjs.map +1 -1
- package/resources/beta/skills/skills.d.mts +2 -2
- package/resources/beta/skills/skills.d.mts.map +1 -1
- package/resources/beta/skills/skills.d.ts +2 -2
- package/resources/beta/skills/skills.d.ts.map +1 -1
- package/resources/beta/skills/skills.js.map +1 -1
- package/resources/beta/skills/skills.mjs.map +1 -1
- package/resources/beta/skills/versions.d.mts +28 -1
- package/resources/beta/skills/versions.d.mts.map +1 -1
- package/resources/beta/skills/versions.d.ts +28 -1
- package/resources/beta/skills/versions.d.ts.map +1 -1
- package/resources/beta/skills/versions.js +28 -0
- package/resources/beta/skills/versions.js.map +1 -1
- package/resources/beta/skills/versions.mjs +28 -0
- package/resources/beta/skills/versions.mjs.map +1 -1
- package/resources/beta/skills.d.mts.map +1 -1
- package/resources/beta/skills.d.ts.map +1 -1
- package/resources/beta/skills.mjs.map +1 -1
- package/resources/beta/user-profiles.d.mts.map +1 -1
- package/resources/beta/user-profiles.d.ts.map +1 -1
- package/resources/beta/user-profiles.mjs.map +1 -1
- package/resources/beta/vaults/credentials.d.mts.map +1 -1
- package/resources/beta/vaults/credentials.d.ts.map +1 -1
- package/resources/beta/vaults/credentials.mjs.map +1 -1
- package/resources/beta/vaults/index.d.mts.map +1 -1
- package/resources/beta/vaults/index.d.ts.map +1 -1
- package/resources/beta/vaults/index.mjs.map +1 -1
- package/resources/beta/vaults/vaults.d.mts.map +1 -1
- package/resources/beta/vaults/vaults.d.ts.map +1 -1
- package/resources/beta/vaults/vaults.mjs.map +1 -1
- package/resources/beta/vaults.d.mts.map +1 -1
- package/resources/beta/vaults.d.ts.map +1 -1
- package/resources/beta/vaults.mjs.map +1 -1
- package/resources/beta/webhooks.d.mts.map +1 -1
- package/resources/beta/webhooks.d.ts.map +1 -1
- package/resources/beta/webhooks.mjs.map +1 -1
- package/resources/beta.d.mts.map +1 -1
- package/resources/beta.d.ts.map +1 -1
- package/resources/beta.mjs.map +1 -1
- package/resources/completions.d.mts.map +1 -1
- package/resources/completions.d.ts.map +1 -1
- package/resources/completions.mjs.map +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/batches.d.mts.map +1 -1
- package/resources/messages/batches.d.ts.map +1 -1
- package/resources/messages/batches.mjs.map +1 -1
- package/resources/messages/index.d.mts.map +1 -1
- package/resources/messages/index.d.ts.map +1 -1
- package/resources/messages/index.mjs.map +1 -1
- package/resources/messages/messages.d.mts.map +1 -1
- package/resources/messages/messages.d.ts.map +1 -1
- package/resources/messages/messages.mjs.map +1 -1
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.mjs.map +1 -1
- package/resources/models.d.mts.map +1 -1
- package/resources/models.d.ts.map +1 -1
- package/resources/models.mjs.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/core/streaming.ts +2 -0
- package/src/helpers/beta/environments.ts +33 -0
- package/src/helpers/beta/json-schema.ts +7 -0
- package/src/helpers/beta/zod.ts +13 -7
- package/src/helpers/zod.ts +2 -3
- package/src/internal/utils/abort.ts +21 -0
- package/src/internal/utils/async-queue.ts +66 -0
- package/src/internal/utils/backoff.ts +41 -0
- package/src/internal/utils/promise.ts +18 -0
- package/src/internal/utils/sleep.ts +25 -2
- package/src/lib/environments/index.ts +23 -0
- package/src/lib/environments/poller.ts +253 -0
- package/src/lib/environments/worker.ts +395 -0
- package/src/lib/helper-client.ts +89 -0
- package/src/lib/tools/BetaRunnableTool.ts +82 -1
- package/src/lib/tools/BetaToolRunner.ts +2 -17
- package/src/lib/tools/SessionToolRunner.ts +591 -0
- package/src/resources/beta/agents/agents.ts +158 -0
- package/src/resources/beta/agents/index.ts +7 -0
- package/src/resources/beta/beta.ts +62 -21
- package/src/resources/beta/environments/environments.ts +625 -0
- package/src/resources/beta/environments/index.ts +42 -0
- package/src/resources/beta/environments/work.ts +697 -0
- package/src/resources/beta/environments.ts +1 -540
- package/src/resources/beta/index.ts +21 -1
- package/src/resources/beta/messages/batches.ts +6 -0
- package/src/resources/beta/messages/index.ts +8 -0
- package/src/resources/beta/messages/messages.ts +109 -5
- package/src/resources/beta/sessions/events.ts +153 -7
- package/src/resources/beta/sessions/index.ts +7 -1
- package/src/resources/beta/sessions/sessions.ts +130 -6
- package/src/resources/beta/sessions/threads/index.ts +0 -1
- package/src/resources/beta/sessions/threads/threads.ts +4 -37
- package/src/resources/beta/skills/index.ts +1 -0
- package/src/resources/beta/skills/skills.ts +2 -0
- package/src/resources/beta/skills/versions.ts +44 -0
- package/src/tools/agent-toolset/fs-util.ts +154 -0
- package/src/tools/agent-toolset/node.ts +787 -0
- package/src/tools/agent-toolset/skills.ts +256 -0
- package/src/version.ts +1 -1
- package/streaming.d.mts +1 -0
- package/streaming.d.mts.map +1 -1
- package/streaming.d.ts +1 -0
- package/streaming.d.ts.map +1 -1
- package/streaming.mjs +1 -0
- package/streaming.mjs.map +1 -1
- package/tools/agent-toolset/fs-util.d.mts +49 -0
- package/tools/agent-toolset/fs-util.d.mts.map +1 -0
- package/tools/agent-toolset/fs-util.d.ts +49 -0
- package/tools/agent-toolset/fs-util.d.ts.map +1 -0
- package/tools/agent-toolset/fs-util.js +159 -0
- package/tools/agent-toolset/fs-util.js.map +1 -0
- package/tools/agent-toolset/fs-util.mjs +151 -0
- package/tools/agent-toolset/fs-util.mjs.map +1 -0
- package/tools/agent-toolset/node.d.mts +139 -0
- package/tools/agent-toolset/node.d.mts.map +1 -0
- package/tools/agent-toolset/node.d.ts +139 -0
- package/tools/agent-toolset/node.d.ts.map +1 -0
- package/tools/agent-toolset/node.js +746 -0
- package/tools/agent-toolset/node.js.map +1 -0
- package/tools/agent-toolset/node.mjs +731 -0
- package/tools/agent-toolset/node.mjs.map +1 -0
- package/tools/agent-toolset/skills.d.mts +50 -0
- package/tools/agent-toolset/skills.d.mts.map +1 -0
- package/tools/agent-toolset/skills.d.ts +50 -0
- package/tools/agent-toolset/skills.d.ts.map +1 -0
- package/tools/agent-toolset/skills.js +249 -0
- package/tools/agent-toolset/skills.js.map +1 -0
- package/tools/agent-toolset/skills.mjs +243 -0
- package/tools/agent-toolset/skills.mjs.map +1 -0
- package/tools/memory/node.d.mts.map +1 -1
- package/tools/memory/node.d.ts.map +1 -1
- package/tools/memory/node.mjs.map +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +1 -0
- package/uploads.d.ts.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-only skill plumbing for the agent toolset: downloading a session
|
|
3
|
+
* agent's skills into the workdir and extracting the archives. Kept in its own
|
|
4
|
+
* file because it is a distinct concern from the tool implementations in
|
|
5
|
+
* `node.ts` — distinct enough, and large enough, to review on its own.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as fs from 'node:fs/promises';
|
|
9
|
+
import * as fssync from 'node:fs';
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
import { execFile } from 'node:child_process';
|
|
12
|
+
import { promisify } from 'node:util';
|
|
13
|
+
import { Readable } from 'node:stream';
|
|
14
|
+
import { pipeline } from 'node:stream/promises';
|
|
15
|
+
import type { Anthropic } from '../../client';
|
|
16
|
+
import { AnthropicError } from '../../core/error';
|
|
17
|
+
import { loggerFor } from '../../internal/utils/log';
|
|
18
|
+
import { DIR_CREATE_MODE } from './fs-util';
|
|
19
|
+
import type { AgentToolContext } from './node';
|
|
20
|
+
|
|
21
|
+
const execFileAsync = promisify(execFile);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Download the session agent's skills into `{ctx.workdir}/skills/<name>/`.
|
|
25
|
+
*
|
|
26
|
+
* No-op (returns a no-op cleanup) unless both `ctx.client` and `ctx.sessionId`
|
|
27
|
+
* are set. Looks up the session's resolved agent and, for each skill, fetches
|
|
28
|
+
* its files via `client.beta.skills.versions.download` and extracts the archive
|
|
29
|
+
* (a zip or tar.* archive) into a directory named after the skill. A failure on
|
|
30
|
+
* one skill is logged and does not block the others. Call this before starting
|
|
31
|
+
* the session tool runner (e.g. right after the bash session / workdir is
|
|
32
|
+
* ready).
|
|
33
|
+
*
|
|
34
|
+
* Returns a cleanup function that removes the skill directories this call
|
|
35
|
+
* created — call it once the work item is done so downloaded skills do not
|
|
36
|
+
* accumulate in the workdir across sessions.
|
|
37
|
+
*/
|
|
38
|
+
export async function setupSkills(ctx: AgentToolContext): Promise<() => Promise<void>> {
|
|
39
|
+
const { client, sessionId } = ctx;
|
|
40
|
+
if (!client || !sessionId) return async () => {};
|
|
41
|
+
const log = loggerFor(client);
|
|
42
|
+
const session = await client.beta.sessions.retrieve(sessionId);
|
|
43
|
+
const skillsRoot = path.resolve(ctx.workdir, 'skills');
|
|
44
|
+
const created: string[] = [];
|
|
45
|
+
for (const skill of session.agent.skills) {
|
|
46
|
+
try {
|
|
47
|
+
const versionId = await resolveSkillVersion(client, skill.skill_id, skill.version);
|
|
48
|
+
const version = await client.beta.skills.versions.retrieve(versionId, { skill_id: skill.skill_id });
|
|
49
|
+
// The directory is the skill's name, reduced to a single safe path
|
|
50
|
+
// component so a hostile name can't escape `skillsRoot`.
|
|
51
|
+
let dirname = path.basename(version.name.trim());
|
|
52
|
+
if (dirname === '' || dirname === '.' || dirname === '..') dirname = skill.skill_id;
|
|
53
|
+
const dest = path.resolve(skillsRoot, dirname);
|
|
54
|
+
if (dest !== skillsRoot && !dest.startsWith(skillsRoot + path.sep)) {
|
|
55
|
+
log.warn('skill name escapes the skills dir; skipping', {
|
|
56
|
+
component: 'agent-tool-context',
|
|
57
|
+
name: version.name,
|
|
58
|
+
});
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const resp = await client.beta.skills.versions.download(versionId, { skill_id: skill.skill_id });
|
|
62
|
+
await fs.rm(dest, { recursive: true, force: true });
|
|
63
|
+
await fs.mkdir(dest, { recursive: true, mode: DIR_CREATE_MODE });
|
|
64
|
+
created.push(dest);
|
|
65
|
+
await extractSkillArchive(resp, dest);
|
|
66
|
+
log.info('downloaded skill', {
|
|
67
|
+
component: 'agent-tool-context',
|
|
68
|
+
skill_id: skill.skill_id,
|
|
69
|
+
version: versionId,
|
|
70
|
+
dest,
|
|
71
|
+
});
|
|
72
|
+
} catch (e) {
|
|
73
|
+
log.warn('failed to download skill', {
|
|
74
|
+
component: 'agent-tool-context',
|
|
75
|
+
skill_id: skill.skill_id,
|
|
76
|
+
error: String(e),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return async () => {
|
|
81
|
+
for (const dest of created) {
|
|
82
|
+
await fs.rm(dest, { recursive: true, force: true }).catch((e) => {
|
|
83
|
+
log.warn('failed to clean up skill', { component: 'agent-tool-context', dest, error: String(e) });
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Resolve `version` to the concrete numeric timestamp the
|
|
91
|
+
* `/v1/skills/{id}/versions/{version}` endpoints require — `session.agent.skills[].version`
|
|
92
|
+
* can be an alias such as `"latest"`, which those endpoints reject. Numeric
|
|
93
|
+
* versions pass through unchanged.
|
|
94
|
+
*/
|
|
95
|
+
export async function resolveSkillVersion(
|
|
96
|
+
client: Anthropic,
|
|
97
|
+
skillId: string,
|
|
98
|
+
version: string,
|
|
99
|
+
): Promise<string> {
|
|
100
|
+
if (/^\d+$/.test(version)) return version;
|
|
101
|
+
let newest: string | undefined;
|
|
102
|
+
for await (const v of client.beta.skills.versions.list(skillId)) {
|
|
103
|
+
if (/^\d+$/.test(v.version) && (newest === undefined || BigInt(v.version) > BigInt(newest))) {
|
|
104
|
+
newest = v.version;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (newest === undefined) {
|
|
108
|
+
throw new AnthropicError(
|
|
109
|
+
`skill ${JSON.stringify(skillId)} has no concrete version to resolve ${JSON.stringify(
|
|
110
|
+
version,
|
|
111
|
+
)} against`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return newest;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Reject archive members that are absolute or contain a `..` component. */
|
|
118
|
+
function assertSafeMemberNames(names: string): void {
|
|
119
|
+
for (const raw of names.split('\n')) {
|
|
120
|
+
const entry = raw.trim();
|
|
121
|
+
if (!entry) continue;
|
|
122
|
+
if (path.isAbsolute(entry) || entry.split(/[\\/]/).includes('..')) {
|
|
123
|
+
throw new AnthropicError(`refusing to extract unsafe archive member: ${entry}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Reject archives that contain anything other than regular files and
|
|
130
|
+
* directories. The type char is the first byte of each `ls`-style line emitted
|
|
131
|
+
* by `tar -tvf` / `unzip -Z`: `-` file, `d` dir, `l` symlink, `h` hardlink,
|
|
132
|
+
* `b`/`c` device, `p` fifo, `s` socket. A symlink/hardlink member is how an
|
|
133
|
+
* archive escapes its extraction dir even when no name contains `..`.
|
|
134
|
+
*/
|
|
135
|
+
function assertNoSpecialMembers(verboseListing: string): void {
|
|
136
|
+
for (const line of verboseListing.split('\n')) {
|
|
137
|
+
const type = line.trimStart()[0];
|
|
138
|
+
if (type === 'l' || type === 'h' || type === 'b' || type === 'c' || type === 'p' || type === 's') {
|
|
139
|
+
throw new AnthropicError('refusing to extract archive with symlink/hardlink/device member');
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Run an archive CLI (`unzip` for zip archives, `tar` for everything else),
|
|
146
|
+
* returning its stdout. Both binaries must be on `PATH`; a missing one would
|
|
147
|
+
* otherwise surface as an opaque `ENOENT` spawn failure, so it is turned into a
|
|
148
|
+
* clear, specific error naming the missing command.
|
|
149
|
+
*/
|
|
150
|
+
async function runArchiveTool(cmd: 'unzip' | 'tar', args: string[]): Promise<string> {
|
|
151
|
+
try {
|
|
152
|
+
const { stdout } = await execFileAsync(cmd, args);
|
|
153
|
+
return stdout;
|
|
154
|
+
} catch (e) {
|
|
155
|
+
if (e != null && typeof e === 'object' && (e as { code?: unknown }).code === 'ENOENT') {
|
|
156
|
+
throw new AnthropicError(
|
|
157
|
+
`skill extraction requires the \`${cmd}\` command, but it was not found on PATH`,
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
throw e;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* The single top-level directory shared by every entry in a newline-separated
|
|
166
|
+
* archive listing, or `''` if entries don't all live under one common
|
|
167
|
+
* directory. Skill bundles are packaged wrapped in one directory named after
|
|
168
|
+
* the skill (e.g. `pdf/SKILL.md`, `pdf/scripts/...`); the extractor strips it
|
|
169
|
+
* so contents land directly in the skill's dir instead of a redundant nested
|
|
170
|
+
* `<skill>/<skill>/` level. A flat or multi-root archive yields `''`.
|
|
171
|
+
*/
|
|
172
|
+
function archiveTopDir(listing: string): string {
|
|
173
|
+
let top: string | undefined;
|
|
174
|
+
let nested = false;
|
|
175
|
+
for (const raw of listing.split('\n')) {
|
|
176
|
+
// Drop `.` / empty segments so a `./pdf/...`-style listing (e.g. from
|
|
177
|
+
// `tar -C dir .`) is treated the same as `pdf/...`.
|
|
178
|
+
const parts = raw
|
|
179
|
+
.trim()
|
|
180
|
+
.split('/')
|
|
181
|
+
.filter((p) => p !== '' && p !== '.');
|
|
182
|
+
if (parts.length === 0) continue;
|
|
183
|
+
const first = parts[0]!;
|
|
184
|
+
if (top === undefined) top = first;
|
|
185
|
+
else if (first !== top) return '';
|
|
186
|
+
if (parts.length > 1) nested = true;
|
|
187
|
+
}
|
|
188
|
+
return top !== undefined && nested ? top : '';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Extract a skill download (a zip or tar.* archive) into `dest`. Streams the
|
|
193
|
+
* response body straight to a temp file beside `dest` (so the whole archive is
|
|
194
|
+
* never buffered in memory — skills can contain large binaries), then shells out
|
|
195
|
+
* to `unzip`/`tar` — consistent with the rest of the toolset, which already
|
|
196
|
+
* invokes `bash` and `rg`. Both `unzip` and `tar` must be available on `PATH`; a
|
|
197
|
+
* missing binary surfaces as a clear error (see {@link runArchiveTool}). Refuses
|
|
198
|
+
* any member that would escape `dest` (zip-slip / tar-slip), including
|
|
199
|
+
* symlink/hardlink members: skill archives come from the API, but skills can be
|
|
200
|
+
* third-party.
|
|
201
|
+
*
|
|
202
|
+
* The skill bundle's single wrapper directory is stripped: the archive is
|
|
203
|
+
* extracted into a staging dir and the wrapper's contents are promoted into
|
|
204
|
+
* `dest`, so files land at `dest/SKILL.md` rather than a doubled
|
|
205
|
+
* `dest/<skill>/SKILL.md` (`unzip` has no `--strip-components`, so this is
|
|
206
|
+
* done uniformly by staging + promote rather than per-tool flags).
|
|
207
|
+
*/
|
|
208
|
+
export async function extractSkillArchive(resp: Response, dest: string): Promise<void> {
|
|
209
|
+
const tmp = path.join(dest, `.skill-archive-${process.pid}-${Date.now()}`);
|
|
210
|
+
if (!resp.body) {
|
|
211
|
+
throw new AnthropicError('skill download response had no body');
|
|
212
|
+
}
|
|
213
|
+
await pipeline(
|
|
214
|
+
Readable.fromWeb(resp.body as Parameters<typeof Readable.fromWeb>[0]),
|
|
215
|
+
fssync.createWriteStream(tmp),
|
|
216
|
+
);
|
|
217
|
+
const stage = path.join(path.dirname(dest), `.skill-stage-${process.pid}-${Date.now()}`);
|
|
218
|
+
try {
|
|
219
|
+
// Sniff the first bytes: zip archives start with "PK\x03\x04"; treat
|
|
220
|
+
// anything else as a tar.* archive (`tar -xf` autodetects gzip/bzip2/xz).
|
|
221
|
+
const head = await readHead(tmp, 4);
|
|
222
|
+
const isZip =
|
|
223
|
+
head.length >= 4 && head[0] === 0x50 && head[1] === 0x4b && head[2] === 0x03 && head[3] === 0x04;
|
|
224
|
+
const archiveCmd = isZip ? 'unzip' : 'tar';
|
|
225
|
+
// List first, validate, then extract — `tar`/`unzip` will happily write a
|
|
226
|
+
// `../` member (or follow a symlink member) outside `-C`/`-d` otherwise.
|
|
227
|
+
const listing = await runArchiveTool(archiveCmd, isZip ? ['-Z1', tmp] : ['-tf', tmp]);
|
|
228
|
+
assertSafeMemberNames(listing);
|
|
229
|
+
assertNoSpecialMembers(await runArchiveTool(archiveCmd, isZip ? ['-Z', tmp] : ['-tvf', tmp]));
|
|
230
|
+
const top = archiveTopDir(listing);
|
|
231
|
+
await fs.mkdir(stage, { recursive: true, mode: DIR_CREATE_MODE });
|
|
232
|
+
await runArchiveTool(archiveCmd, isZip ? ['-oq', tmp, '-d', stage] : ['-xf', tmp, '-C', stage]);
|
|
233
|
+
// Promote the wrapper's contents (or the staged tree itself, if the
|
|
234
|
+
// archive wasn't wrapped) into the already-created empty `dest`. `stage`
|
|
235
|
+
// is a sibling of `dest`, so each rename stays on one filesystem.
|
|
236
|
+
const srcRoot = top ? path.join(stage, top) : stage;
|
|
237
|
+
for (const entry of await fs.readdir(srcRoot)) {
|
|
238
|
+
await fs.rename(path.join(srcRoot, entry), path.join(dest, entry));
|
|
239
|
+
}
|
|
240
|
+
} finally {
|
|
241
|
+
await fs.rm(tmp, { force: true });
|
|
242
|
+
await fs.rm(stage, { recursive: true, force: true });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Read the first `n` bytes of `file`. */
|
|
247
|
+
async function readHead(file: string, n: number): Promise<Buffer> {
|
|
248
|
+
const handle = await fs.open(file, 'r');
|
|
249
|
+
try {
|
|
250
|
+
const buf = Buffer.alloc(n);
|
|
251
|
+
const { bytesRead } = await handle.read(buf, 0, n, 0);
|
|
252
|
+
return buf.subarray(0, bytesRead);
|
|
253
|
+
} finally {
|
|
254
|
+
await handle.close();
|
|
255
|
+
}
|
|
256
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.97.0'; // x-release-please-version
|
package/streaming.d.mts
CHANGED
package/streaming.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,qCAAiC"}
|
package/streaming.d.ts
CHANGED
package/streaming.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,oCAAiC"}
|
package/streaming.mjs
CHANGED
package/streaming.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streaming.mjs","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"streaming.mjs","sourceRoot":"","sources":["src/streaming.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,qCAAiC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, Node-only filesystem helpers for the agent toolset's file tools:
|
|
3
|
+
* path confinement (symlink-aware), an atomic write, and language-independent
|
|
4
|
+
* error messages. Kept out of `node.ts` so the tool implementations stay focused
|
|
5
|
+
* and these helpers can be reused by every file tool.
|
|
6
|
+
*/
|
|
7
|
+
/** Mode for directories the file tools create — not world-writable under a 0 umask. */
|
|
8
|
+
export declare const DIR_CREATE_MODE = 493;
|
|
9
|
+
/** Mode for files the file tools create. */
|
|
10
|
+
export declare const FILE_CREATE_MODE = 420;
|
|
11
|
+
/**
|
|
12
|
+
* Fully resolve `abs`: `realpath` the longest existing ancestor and re-append
|
|
13
|
+
* the rest, but never re-append a component that is itself a symlink — read the
|
|
14
|
+
* link and continue from its target instead. This handles paths being created
|
|
15
|
+
* (write/edit) without letting a symlink leaf (e.g. a dangling one pointing
|
|
16
|
+
* outside a confinement root) slip through unresolved.
|
|
17
|
+
*/
|
|
18
|
+
export declare function canonicalize(abs: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve `p` and confine it to `root`.
|
|
21
|
+
*
|
|
22
|
+
* Unless `allowOutside` is set, absolute inputs are rejected and the
|
|
23
|
+
* **canonical** path is returned — every symlink in `p` (including the leaf,
|
|
24
|
+
* even a dangling one) is resolved before the confinement check, and the
|
|
25
|
+
* resolved path is what the caller then operates on, so a symlink inside `root`
|
|
26
|
+
* that points outside it can neither pass the check nor be followed afterwards.
|
|
27
|
+
*
|
|
28
|
+
* Residual TOCTOU: a component could still be swapped for a symlink between this
|
|
29
|
+
* call and the eventual `fs` operation. Closing that fully needs per-component
|
|
30
|
+
* `O_NOFOLLOW`/`openat`, which Node does not expose ergonomically; this is why a
|
|
31
|
+
* sandbox is still recommended for the toolset as a whole.
|
|
32
|
+
*/
|
|
33
|
+
export declare function confineToRoot(root: string, p: string, opts?: {
|
|
34
|
+
allowOutside?: boolean;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Atomically write `content` to `targetPath`: write a sibling temp file, fsync
|
|
38
|
+
* it, then rename over the target. The rename is atomic on most filesystems, so
|
|
39
|
+
* a crash mid-write never leaves the target half-written.
|
|
40
|
+
*/
|
|
41
|
+
export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Map a thrown filesystem error to a consistent, language-independent message,
|
|
44
|
+
* so the model sees the same wording regardless of the runtime (Node's raw
|
|
45
|
+
* `ENOENT: no such file...` text would otherwise leak through). Falls back to
|
|
46
|
+
* the raw error message for codes we don't special-case.
|
|
47
|
+
*/
|
|
48
|
+
export declare function fsErrorMessage(err: unknown, file: string): string;
|
|
49
|
+
//# sourceMappingURL=fs-util.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-util.d.mts","sourceRoot":"","sources":["../../src/tools/agent-toolset/fs-util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,uFAAuF;AACvF,eAAO,MAAM,eAAe,MAAQ,CAAC;AACrC,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB,MAAQ,CAAC;AAWtC;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, Node-only filesystem helpers for the agent toolset's file tools:
|
|
3
|
+
* path confinement (symlink-aware), an atomic write, and language-independent
|
|
4
|
+
* error messages. Kept out of `node.ts` so the tool implementations stay focused
|
|
5
|
+
* and these helpers can be reused by every file tool.
|
|
6
|
+
*/
|
|
7
|
+
/** Mode for directories the file tools create — not world-writable under a 0 umask. */
|
|
8
|
+
export declare const DIR_CREATE_MODE = 493;
|
|
9
|
+
/** Mode for files the file tools create. */
|
|
10
|
+
export declare const FILE_CREATE_MODE = 420;
|
|
11
|
+
/**
|
|
12
|
+
* Fully resolve `abs`: `realpath` the longest existing ancestor and re-append
|
|
13
|
+
* the rest, but never re-append a component that is itself a symlink — read the
|
|
14
|
+
* link and continue from its target instead. This handles paths being created
|
|
15
|
+
* (write/edit) without letting a symlink leaf (e.g. a dangling one pointing
|
|
16
|
+
* outside a confinement root) slip through unresolved.
|
|
17
|
+
*/
|
|
18
|
+
export declare function canonicalize(abs: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve `p` and confine it to `root`.
|
|
21
|
+
*
|
|
22
|
+
* Unless `allowOutside` is set, absolute inputs are rejected and the
|
|
23
|
+
* **canonical** path is returned — every symlink in `p` (including the leaf,
|
|
24
|
+
* even a dangling one) is resolved before the confinement check, and the
|
|
25
|
+
* resolved path is what the caller then operates on, so a symlink inside `root`
|
|
26
|
+
* that points outside it can neither pass the check nor be followed afterwards.
|
|
27
|
+
*
|
|
28
|
+
* Residual TOCTOU: a component could still be swapped for a symlink between this
|
|
29
|
+
* call and the eventual `fs` operation. Closing that fully needs per-component
|
|
30
|
+
* `O_NOFOLLOW`/`openat`, which Node does not expose ergonomically; this is why a
|
|
31
|
+
* sandbox is still recommended for the toolset as a whole.
|
|
32
|
+
*/
|
|
33
|
+
export declare function confineToRoot(root: string, p: string, opts?: {
|
|
34
|
+
allowOutside?: boolean;
|
|
35
|
+
}): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Atomically write `content` to `targetPath`: write a sibling temp file, fsync
|
|
38
|
+
* it, then rename over the target. The rename is atomic on most filesystems, so
|
|
39
|
+
* a crash mid-write never leaves the target half-written.
|
|
40
|
+
*/
|
|
41
|
+
export declare function atomicWriteFile(targetPath: string, content: string): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Map a thrown filesystem error to a consistent, language-independent message,
|
|
44
|
+
* so the model sees the same wording regardless of the runtime (Node's raw
|
|
45
|
+
* `ENOENT: no such file...` text would otherwise leak through). Falls back to
|
|
46
|
+
* the raw error message for codes we don't special-case.
|
|
47
|
+
*/
|
|
48
|
+
export declare function fsErrorMessage(err: unknown, file: string): string;
|
|
49
|
+
//# sourceMappingURL=fs-util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-util.d.ts","sourceRoot":"","sources":["../../src/tools/agent-toolset/fs-util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,uFAAuF;AACvF,eAAO,MAAM,eAAe,MAAQ,CAAC;AACrC,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB,MAAQ,CAAC;AAWtC;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA4B/D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,MAAM,EACT,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBxF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAwBjE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared, Node-only filesystem helpers for the agent toolset's file tools:
|
|
4
|
+
* path confinement (symlink-aware), an atomic write, and language-independent
|
|
5
|
+
* error messages. Kept out of `node.ts` so the tool implementations stay focused
|
|
6
|
+
* and these helpers can be reused by every file tool.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.FILE_CREATE_MODE = exports.DIR_CREATE_MODE = void 0;
|
|
10
|
+
exports.canonicalize = canonicalize;
|
|
11
|
+
exports.confineToRoot = confineToRoot;
|
|
12
|
+
exports.atomicWriteFile = atomicWriteFile;
|
|
13
|
+
exports.fsErrorMessage = fsErrorMessage;
|
|
14
|
+
const tslib_1 = require("../../internal/tslib.js");
|
|
15
|
+
const fs = tslib_1.__importStar(require("node:fs/promises"));
|
|
16
|
+
const path = tslib_1.__importStar(require("node:path"));
|
|
17
|
+
const node_crypto_1 = require("node:crypto");
|
|
18
|
+
const ToolError_1 = require("../../lib/tools/ToolError.js");
|
|
19
|
+
/** Mode for directories the file tools create — not world-writable under a 0 umask. */
|
|
20
|
+
exports.DIR_CREATE_MODE = 0o755;
|
|
21
|
+
/** Mode for files the file tools create. */
|
|
22
|
+
exports.FILE_CREATE_MODE = 0o644;
|
|
23
|
+
/** `realpath` `p`, or return `p` unchanged when it cannot be resolved. */
|
|
24
|
+
async function realpathOrSelf(p) {
|
|
25
|
+
try {
|
|
26
|
+
return await fs.realpath(p);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return p;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Fully resolve `abs`: `realpath` the longest existing ancestor and re-append
|
|
34
|
+
* the rest, but never re-append a component that is itself a symlink — read the
|
|
35
|
+
* link and continue from its target instead. This handles paths being created
|
|
36
|
+
* (write/edit) without letting a symlink leaf (e.g. a dangling one pointing
|
|
37
|
+
* outside a confinement root) slip through unresolved.
|
|
38
|
+
*/
|
|
39
|
+
async function canonicalize(abs) {
|
|
40
|
+
const tail = [];
|
|
41
|
+
let prefix = abs;
|
|
42
|
+
for (;;) {
|
|
43
|
+
let real;
|
|
44
|
+
try {
|
|
45
|
+
real = await fs.realpath(prefix);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
let isLink = false;
|
|
49
|
+
try {
|
|
50
|
+
isLink = (await fs.lstat(prefix)).isSymbolicLink();
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
/* prefix truly doesn't exist (ENOENT) — fall through and walk up */
|
|
54
|
+
}
|
|
55
|
+
if (isLink) {
|
|
56
|
+
// Resolve the symlink ourselves and retry; `tail` (the part below it)
|
|
57
|
+
// still applies to the link's target.
|
|
58
|
+
prefix = path.resolve(path.dirname(prefix), await fs.readlink(prefix));
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const parent = path.dirname(prefix);
|
|
62
|
+
if (parent === prefix)
|
|
63
|
+
return abs; // walked past the FS root without a hit
|
|
64
|
+
tail.push(path.basename(prefix));
|
|
65
|
+
prefix = parent;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
return tail.length ? path.join(real, ...tail.reverse()) : real;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolve `p` and confine it to `root`.
|
|
73
|
+
*
|
|
74
|
+
* Unless `allowOutside` is set, absolute inputs are rejected and the
|
|
75
|
+
* **canonical** path is returned — every symlink in `p` (including the leaf,
|
|
76
|
+
* even a dangling one) is resolved before the confinement check, and the
|
|
77
|
+
* resolved path is what the caller then operates on, so a symlink inside `root`
|
|
78
|
+
* that points outside it can neither pass the check nor be followed afterwards.
|
|
79
|
+
*
|
|
80
|
+
* Residual TOCTOU: a component could still be swapped for a symlink between this
|
|
81
|
+
* call and the eventual `fs` operation. Closing that fully needs per-component
|
|
82
|
+
* `O_NOFOLLOW`/`openat`, which Node does not expose ergonomically; this is why a
|
|
83
|
+
* sandbox is still recommended for the toolset as a whole.
|
|
84
|
+
*/
|
|
85
|
+
async function confineToRoot(root, p, opts) {
|
|
86
|
+
const allowOutside = opts?.allowOutside ?? false;
|
|
87
|
+
if (path.isAbsolute(p)) {
|
|
88
|
+
if (!allowOutside) {
|
|
89
|
+
throw new ToolError_1.ToolError(`absolute path ${JSON.stringify(p)} not permitted`);
|
|
90
|
+
}
|
|
91
|
+
return path.resolve(p);
|
|
92
|
+
}
|
|
93
|
+
const realRoot = await realpathOrSelf(path.resolve(root));
|
|
94
|
+
const abs = path.resolve(realRoot, p);
|
|
95
|
+
if (allowOutside)
|
|
96
|
+
return abs;
|
|
97
|
+
const real = await canonicalize(abs);
|
|
98
|
+
const rootSep = realRoot.endsWith(path.sep) ? realRoot : realRoot + path.sep;
|
|
99
|
+
if (real !== realRoot && !real.startsWith(rootSep)) {
|
|
100
|
+
throw new ToolError_1.ToolError(`path ${JSON.stringify(p)} escapes workdir`);
|
|
101
|
+
}
|
|
102
|
+
return real;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Atomically write `content` to `targetPath`: write a sibling temp file, fsync
|
|
106
|
+
* it, then rename over the target. The rename is atomic on most filesystems, so
|
|
107
|
+
* a crash mid-write never leaves the target half-written.
|
|
108
|
+
*/
|
|
109
|
+
async function atomicWriteFile(targetPath, content) {
|
|
110
|
+
const dir = path.dirname(targetPath);
|
|
111
|
+
const tempPath = path.join(dir, `.tmp-${process.pid}-${(0, node_crypto_1.randomUUID)()}`);
|
|
112
|
+
let handle;
|
|
113
|
+
try {
|
|
114
|
+
handle = await fs.open(tempPath, 'wx', exports.FILE_CREATE_MODE);
|
|
115
|
+
await handle.writeFile(content, 'utf-8');
|
|
116
|
+
await handle.sync();
|
|
117
|
+
await handle.close();
|
|
118
|
+
handle = undefined;
|
|
119
|
+
await fs.rename(tempPath, targetPath);
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
if (handle)
|
|
123
|
+
await handle.close().catch(() => { });
|
|
124
|
+
await fs.unlink(tempPath).catch(() => { });
|
|
125
|
+
throw err;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Map a thrown filesystem error to a consistent, language-independent message,
|
|
130
|
+
* so the model sees the same wording regardless of the runtime (Node's raw
|
|
131
|
+
* `ENOENT: no such file...` text would otherwise leak through). Falls back to
|
|
132
|
+
* the raw error message for codes we don't special-case.
|
|
133
|
+
*/
|
|
134
|
+
function fsErrorMessage(err, file) {
|
|
135
|
+
const code = err?.code;
|
|
136
|
+
switch (code) {
|
|
137
|
+
case 'ENOENT':
|
|
138
|
+
return `${file}: no such file or directory`;
|
|
139
|
+
case 'EACCES':
|
|
140
|
+
case 'EPERM':
|
|
141
|
+
return `${file}: permission denied`;
|
|
142
|
+
case 'ENOTDIR':
|
|
143
|
+
return `${file}: not a directory`;
|
|
144
|
+
case 'EISDIR':
|
|
145
|
+
return `${file}: is a directory`;
|
|
146
|
+
case 'ELOOP':
|
|
147
|
+
return `${file}: too many levels of symbolic links`;
|
|
148
|
+
case 'ENAMETOOLONG':
|
|
149
|
+
return `${file}: file name too long`;
|
|
150
|
+
case 'ENOSPC':
|
|
151
|
+
return `${file}: no space left on device`;
|
|
152
|
+
case 'EMFILE':
|
|
153
|
+
case 'ENFILE':
|
|
154
|
+
return `${file}: too many open files`;
|
|
155
|
+
default:
|
|
156
|
+
return `${file}: ${err instanceof Error ? err.message : String(err)}`;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=fs-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs-util.js","sourceRoot":"","sources":["../../src/tools/agent-toolset/fs-util.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA4BH,oCA4BC;AAgBD,sCAqBC;AAOD,0CAgBC;AAQD,wCAwBC;;AAlJD,6DAAuC;AACvC,wDAAkC;AAClC,6CAAyC;AACzC,4DAAsD;AAEtD,uFAAuF;AAC1E,QAAA,eAAe,GAAG,KAAK,CAAC;AACrC,4CAA4C;AAC/B,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEtC,0EAA0E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