@code-yeongyu/senpi 2026.8.25 → 2026.8.26-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/CHANGELOG.md +37 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +39 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +67 -0
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.js +1 -0
- package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts +5 -9
- package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/per-turn-cap.js +5 -11
- package/dist/core/extensions/builtin/compaction/per-turn-cap.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts +2 -3
- package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/todo-bridge.js +53 -14
- package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -1
- package/dist/core/extensions/builtin/config-reload/index.js +14 -22
- package/dist/core/extensions/builtin/config-reload/index.js.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/monitor-continuation.js +29 -6
- package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
- package/dist/core/hidden-stdout-log.d.ts +10 -0
- package/dist/core/hidden-stdout-log.d.ts.map +1 -1
- package/dist/core/hidden-stdout-log.js +36 -5
- package/dist/core/hidden-stdout-log.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +46 -8
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +28 -5
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +558 -0
- package/node_modules/@anthropic-ai/sdk/README.md +16 -1
- package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js +14 -2
- package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs +14 -2
- package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/api-promise.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/api-promise.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/api-promise.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/api-promise.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/api-promise.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/api-promise.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/bin/migration-config.json +481 -0
- package/node_modules/@anthropic-ai/sdk/client.d.mts +165 -11
- package/node_modules/@anthropic-ai/sdk/client.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/client.d.ts +165 -11
- package/node_modules/@anthropic-ai/sdk/client.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/client.js +415 -38
- package/node_modules/@anthropic-ai/sdk/client.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/client.mjs +414 -37
- package/node_modules/@anthropic-ai/sdk/client.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/api-promise.js +7 -2
- package/node_modules/@anthropic-ai/sdk/core/api-promise.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/api-promise.mjs +8 -3
- package/node_modules/@anthropic-ai/sdk/core/api-promise.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/api.d.mts +11 -0
- package/node_modules/@anthropic-ai/sdk/core/api.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/api.d.ts +11 -0
- package/node_modules/@anthropic-ai/sdk/core/api.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/api.js +3 -0
- package/node_modules/@anthropic-ai/sdk/core/api.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/api.mjs +2 -0
- package/node_modules/@anthropic-ai/sdk/core/api.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts +131 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts +131 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.js +317 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +277 -0
- package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/error.d.mts +12 -0
- package/node_modules/@anthropic-ai/sdk/core/error.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/error.d.ts +12 -0
- package/node_modules/@anthropic-ai/sdk/core/error.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/error.js +18 -1
- package/node_modules/@anthropic-ai/sdk/core/error.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/error.mjs +16 -0
- package/node_modules/@anthropic-ai/sdk/core/error.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts +154 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts +154 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.js +174 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +168 -0
- package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/core/pagination.d.mts +20 -0
- package/node_modules/@anthropic-ai/sdk/core/pagination.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/pagination.d.ts +20 -0
- package/node_modules/@anthropic-ai/sdk/core/pagination.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/pagination.js +26 -1
- package/node_modules/@anthropic-ai/sdk/core/pagination.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/pagination.mjs +24 -0
- package/node_modules/@anthropic-ai/sdk/core/pagination.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/resource.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/resource.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/streaming.d.mts +9 -0
- package/node_modules/@anthropic-ai/sdk/core/streaming.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/streaming.d.ts +9 -0
- package/node_modules/@anthropic-ai/sdk/core/streaming.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/streaming.js +34 -1
- package/node_modules/@anthropic-ai/sdk/core/streaming.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/streaming.mjs +34 -1
- package/node_modules/@anthropic-ai/sdk/core/streaming.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/uploads.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/uploads.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/uploads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/error.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/error.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/error.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/error.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/error.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/error.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.mts +23 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.ts +23 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.js +31 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.mjs +23 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.mts +6 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.ts +6 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.js +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.js +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/memory.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/memory.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.mts +11 -5
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.ts +11 -5
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.js +2 -2
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.mjs +2 -2
- package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/json-schema.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/json-schema.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/json-schema.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/zod.d.mts +2 -2
- package/node_modules/@anthropic-ai/sdk/helpers/zod.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/zod.d.ts +2 -2
- package/node_modules/@anthropic-ai/sdk/helpers/zod.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/zod.js +1 -2
- package/node_modules/@anthropic-ai/sdk/helpers/zod.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/zod.mjs +1 -2
- package/node_modules/@anthropic-ai/sdk/helpers/zod.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/index.d.mts +4 -2
- package/node_modules/@anthropic-ai/sdk/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/index.d.ts +4 -2
- package/node_modules/@anthropic-ai/sdk/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/index.js +5 -1
- package/node_modules/@anthropic-ai/sdk/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/index.mjs +3 -2
- package/node_modules/@anthropic-ai/sdk/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/constants.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/constants.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/constants.js +0 -5
- package/node_modules/@anthropic-ai/sdk/internal/constants.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/constants.mjs +0 -5
- package/node_modules/@anthropic-ai/sdk/internal/constants.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts +136 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts +136 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.js +531 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +523 -0
- package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/headers.d.mts +7 -0
- package/node_modules/@anthropic-ai/sdk/internal/headers.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/headers.d.ts +7 -0
- package/node_modules/@anthropic-ai/sdk/internal/headers.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/headers.js +45 -4
- package/node_modules/@anthropic-ai/sdk/internal/headers.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/headers.mjs +43 -3
- package/node_modules/@anthropic-ai/sdk/internal/headers.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.mts +10 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.ts +10 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.js +34 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs +30 -0
- package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/parse.d.mts +2 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.d.ts +2 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.js +16 -10
- package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +15 -9
- package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.mts +7 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.ts +7 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.js +13 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs +9 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.mts +10 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.ts +10 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.js +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.mjs +10 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.js +277 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs +274 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.mts +57 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.ts +57 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.js +3 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.mjs +2 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/types.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.mts +15 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.ts +15 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.js +230 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs +217 -0
- package/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts +52 -2
- package/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts +52 -2
- package/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/request-options.js +12 -1
- package/node_modules/@anthropic-ai/sdk/internal/request-options.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/request-options.mjs +10 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-options.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.mts +4 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.ts +4 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.js +50 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.mjs +45 -0
- package/node_modules/@anthropic-ai/sdk/internal/request-signal.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/shims.d.mts +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/shims.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/shims.d.ts +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/shims.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.mts +60 -0
- package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.ts +60 -0
- package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/{lib → internal}/stainless-helper-header.js +27 -6
- package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/{lib → internal}/stainless-helper-header.mjs +25 -5
- package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/to-file.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/to-file.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/to-file.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/types.d.mts +12 -6
- package/node_modules/@anthropic-ai/sdk/internal/types.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/types.d.ts +12 -6
- package/node_modules/@anthropic-ai/sdk/internal/types.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.mts +13 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.ts +13 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.js +26 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs +23 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.mts +31 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.ts +31 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.js +75 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs +71 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.mts +23 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.ts +23 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.js +44 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs +36 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts +11 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts +11 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.js +37 -11
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs +35 -10
- package/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.mts +11 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.ts +11 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.js +18 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs +15 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.mts +0 -3
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.ts +0 -3
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.js +3 -16
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs +2 -16
- package/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts +9 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts +9 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js +23 -2
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs +23 -2
- package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.js +8 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs +5 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +66 -31
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +66 -31
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +37 -26
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +34 -23
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/beta-parser.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/beta-parser.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/beta-parser.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.mts +39 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.ts +39 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +245 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +208 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.mts +11 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.ts +11 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +72 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +35 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.mts +40 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.ts +40 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.js +82 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs +79 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.mts +54 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.ts +54 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.js +112 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs +108 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts +96 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts +96 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +266 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +224 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.mts +21 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.ts +21 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +130 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +94 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.d.mts +4 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.d.ts +4 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.js +8 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/lib/credentials.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.mts +4 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.ts +4 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.js +18 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.mts +95 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.ts +95 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.js +226 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs +217 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.mts +227 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.ts +227 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.js +569 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs +564 -0
- package/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.mts +31 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.ts +31 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.js +58 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs +55 -0
- package/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts +98 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts +98 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.js +754 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +749 -0
- package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/parser.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/parser.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/parser.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +22 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +22 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +88 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +85 -0
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.mts +38 -5
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.ts +38 -5
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.js +28 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs +25 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +107 -29
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +105 -27
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.mts +179 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.ts +179 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.js +728 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs +724 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/transform-json-schema.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/package.json +32 -15
- package/node_modules/@anthropic-ai/sdk/pagination.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/pagination.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/pagination.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/pagination.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/pagination.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/pagination.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resource.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/resource.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resource.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/resource.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resource.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/resource.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +608 -68
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +608 -68
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +51 -13
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +51 -13
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +22 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +22 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +306 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +306 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.js +55 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs +51 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +698 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +698 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.js +196 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs +192 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +309 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +309 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.js +116 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.mjs +112 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +426 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +426 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js +150 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs +145 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.mts +501 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.ts +501 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.js +257 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs +251 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.mts +1 -388
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.ts +1 -388
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.js +2 -138
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.mjs +1 -136
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +22 -22
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +22 -22
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +5 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +5 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +11 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +11 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +23 -13
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +6 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +136 -24
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +136 -24
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.js +10 -10
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs +10 -10
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.mts +60 -16
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.ts +60 -16
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.js +12 -12
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs +12 -12
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +105 -7
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +105 -7
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.js +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts +81 -30
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts +81 -30
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js +12 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs +12 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +2453 -380
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +2453 -380
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js +16 -22
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs +16 -22
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +643 -19
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +643 -19
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.js +29 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs +27 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.mts +3 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.js +3 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +455 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +455 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.js +5 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs +6 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.mts +78 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.ts +78 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.js +61 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs +57 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +195 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +195 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js +88 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs +83 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +13 -11
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +13 -11
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +5 -3
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +5 -3
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +31 -3
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +31 -3
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +32 -3
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +32 -3
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.mts +163 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.ts +163 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.js +129 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.mjs +125 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.mts +212 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.ts +212 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.js +181 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.mjs +176 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +62 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +62 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.js +5 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs +5 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.mts +256 -4
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.ts +256 -4
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.js +22 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs +22 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.mts +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.ts +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +466 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +466 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +20 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +16 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/completions.d.mts +18 -11
- package/node_modules/@anthropic-ai/sdk/resources/completions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/completions.d.ts +18 -11
- package/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/completions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/files.d.mts +105 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.d.ts +105 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.js +52 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.mjs +48 -0
- package/node_modules/@anthropic-ai/sdk/resources/files.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/index.d.mts +4 -2
- package/node_modules/@anthropic-ai/sdk/resources/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/index.d.ts +4 -2
- package/node_modules/@anthropic-ai/sdk/resources/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/index.js +5 -1
- package/node_modules/@anthropic-ai/sdk/resources/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/index.mjs +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts +20 -11
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts +20 -11
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.js +17 -9
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs +17 -9
- package/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1782 -162
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1782 -162
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js +23 -28
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs +23 -28
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/models.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/models.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/models.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.mts +129 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.ts +129 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.js +44 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.mjs +39 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/skills.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.mts +104 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.ts +104 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.js +41 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.mjs +37 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills/versions.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/skills.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/src/_vendor/partial-json-parser/parser.ts +18 -2
- package/node_modules/@anthropic-ai/sdk/src/client.ts +749 -42
- package/node_modules/@anthropic-ai/sdk/src/core/api-promise.ts +14 -4
- package/node_modules/@anthropic-ai/sdk/src/core/api.ts +11 -0
- package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +379 -0
- package/node_modules/@anthropic-ai/sdk/src/core/error.ts +17 -0
- package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +339 -0
- package/node_modules/@anthropic-ai/sdk/src/core/pagination.ts +60 -0
- package/node_modules/@anthropic-ai/sdk/src/core/streaming.ts +38 -1
- package/node_modules/@anthropic-ai/sdk/src/helpers/beta/environments.ts +34 -0
- package/node_modules/@anthropic-ai/sdk/src/helpers/beta/json-schema.ts +7 -0
- package/node_modules/@anthropic-ai/sdk/src/helpers/beta/mcp.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/helpers/beta/zod.ts +14 -10
- package/node_modules/@anthropic-ai/sdk/src/helpers/zod.ts +3 -6
- package/node_modules/@anthropic-ai/sdk/src/index.ts +16 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/constants.ts +0 -5
- package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +550 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/headers.ts +47 -4
- package/node_modules/@anthropic-ai/sdk/src/internal/message-stream-utils.ts +30 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +16 -11
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/LICENSE.md +13 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/README.md +3 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/formats.ts +10 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/index.ts +13 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/stringify.ts +385 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/types.ts +71 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/qs/utils.ts +265 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/request-options.ts +55 -2
- package/node_modules/@anthropic-ai/sdk/src/internal/request-signal.ts +68 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/stainless-helper-header.ts +122 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/abort.ts +21 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/async-queue.ts +66 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/backoff.ts +41 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/log.ts +41 -10
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/promise.ts +18 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/query.ts +2 -18
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/sleep.ts +25 -2
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/time.ts +4 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +72 -33
- package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +36 -24
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +292 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +37 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/oidc-federation.ts +140 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/token-cache.ts +130 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +295 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +144 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/environments/index.ts +23 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/environments/poller.ts +299 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/environments/worker.ts +779 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/helper-client.ts +86 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +994 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +130 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaRunnableTool.ts +71 -7
- package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +135 -35
- package/node_modules/@anthropic-ai/sdk/src/lib/tools/SessionToolRunner.ts +885 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +806 -69
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/index.ts +34 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +690 -28
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +441 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +996 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +453 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +626 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/index.ts +42 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/work.ts +705 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments.ts +1 -540
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +28 -28
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +312 -5
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/index.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +141 -31
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-stores.ts +66 -20
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +112 -9
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/batches.ts +90 -33
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +90 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +2755 -211
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/models.ts +7 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +888 -18
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/index.ts +60 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +669 -14
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/events.ts +123 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/index.ts +15 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +330 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +15 -14
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +49 -3
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/certificates.ts +252 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/index.ts +23 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/tunnels.ts +347 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +76 -5
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/credentials.ts +347 -3
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/index.ts +17 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/vaults.ts +34 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +762 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/completions.ts +18 -11
- package/node_modules/@anthropic-ai/sdk/src/resources/files.ts +163 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/index.ts +89 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/messages/batches.ts +30 -12
- package/node_modules/@anthropic-ai/sdk/src/resources/messages/index.ts +70 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2202 -226
- package/node_modules/@anthropic-ai/sdk/src/resources/skills/index.ts +21 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/skills/skills.ts +194 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/skills/versions.ts +160 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/skills.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +190 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +1017 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +172 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +914 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +372 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/sync-interval.ts +30 -0
- package/node_modules/@anthropic-ai/sdk/src/tools/memory/node.browser.ts +64 -0
- package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/streaming.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/streaming.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/streaming.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/streaming.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/streaming.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/streaming.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts +75 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts +75 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +196 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +185 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts +173 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts +173 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +902 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +895 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +82 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +82 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +151 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +131 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +190 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +190 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +819 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +797 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +82 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +82 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +352 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +344 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.mts +19 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.ts +19 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.js +29 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.mjs +25 -0
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.mts +27 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.ts +27 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.js +49 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.mjs +44 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/memory/node.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/uploads.d.mts +1 -0
- package/node_modules/@anthropic-ai/sdk/uploads.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/uploads.d.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/uploads.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/uploads.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/uploads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/version.js +1 -1
- package/node_modules/@anthropic-ai/sdk/version.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/version.mjs.map +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +24 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +4 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +3 -3
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +90 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/node_modules/@stablelib/base64/LICENSE +21 -0
- package/node_modules/@stablelib/base64/base64.bench.ts +25 -0
- package/node_modules/@stablelib/base64/base64.test.ts +85 -0
- package/node_modules/@stablelib/base64/base64.ts +283 -0
- package/node_modules/@stablelib/base64/lib/base64.bench.d.ts +1 -0
- package/node_modules/@stablelib/base64/lib/base64.bench.js +23 -0
- package/node_modules/@stablelib/base64/lib/base64.bench.js.map +1 -0
- package/node_modules/@stablelib/base64/lib/base64.d.ts +34 -0
- package/node_modules/@stablelib/base64/lib/base64.js +282 -0
- package/node_modules/@stablelib/base64/lib/base64.js.map +1 -0
- package/node_modules/@stablelib/base64/lib/base64.test.d.ts +1 -0
- package/node_modules/@stablelib/base64/lib/base64.test.js +82 -0
- package/node_modules/@stablelib/base64/lib/base64.test.js.map +1 -0
- package/node_modules/@stablelib/base64/package.json +25 -0
- package/node_modules/@stablelib/base64/tsconfig.json +27 -0
- package/node_modules/fast-sha256/LICENSE +24 -0
- package/node_modules/fast-sha256/README.md +127 -0
- package/node_modules/fast-sha256/package.json +42 -0
- package/node_modules/fast-sha256/sha256.d.ts +39 -0
- package/node_modules/fast-sha256/sha256.js +427 -0
- package/node_modules/fast-sha256/sha256.min.js +1 -0
- package/node_modules/standardwebhooks/README.md +41 -0
- package/node_modules/standardwebhooks/dist/index.d.ts +24 -0
- package/node_modules/standardwebhooks/dist/index.js +106 -0
- package/node_modules/standardwebhooks/dist/index.js.map +1 -0
- package/node_modules/standardwebhooks/dist/timing_safe_equal.d.ts +1 -0
- package/node_modules/standardwebhooks/dist/timing_safe_equal.js +30 -0
- package/node_modules/standardwebhooks/dist/timing_safe_equal.js.map +1 -0
- package/node_modules/standardwebhooks/package.json +45 -0
- package/package.json +17 -8
- package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.mts +0 -34
- package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.mts.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.ts +0 -34
- package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.ts.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.js.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.mjs.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.mts +0 -132
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.mts.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.ts +0 -132
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.ts.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.js +0 -294
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.js.map +0 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.mjs +0 -290
- package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.mjs.map +0 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/stainless-helper-header.ts +0 -80
- package/node_modules/@anthropic-ai/sdk/src/lib/tools/ToolRunner.ts +0 -381
|
@@ -0,0 +1,885 @@
|
|
|
1
|
+
import { AnthropicError } from '../../core/error';
|
|
2
|
+
import type { Anthropic } from '../../client';
|
|
3
|
+
import type {
|
|
4
|
+
BetaManagedAgentsAgentCustomToolUseEvent,
|
|
5
|
+
BetaManagedAgentsAgentToolUseEvent,
|
|
6
|
+
BetaManagedAgentsSessionEvent,
|
|
7
|
+
BetaManagedAgentsStreamSessionEvents,
|
|
8
|
+
BetaManagedAgentsUserCustomToolResultEventParams,
|
|
9
|
+
BetaManagedAgentsUserToolResultEventParams,
|
|
10
|
+
} from '../../resources/beta/sessions/events';
|
|
11
|
+
import type { BetaToolResultContentBlockParam } from '../../resources/beta';
|
|
12
|
+
import { loggerFor, type Logger } from '../../internal/utils/log';
|
|
13
|
+
import { sleep } from '../../internal/utils/sleep';
|
|
14
|
+
import { applyJitter, backoff, isFatal4xx } from '../../internal/utils/backoff';
|
|
15
|
+
import { linkAbort } from '../../internal/utils/abort';
|
|
16
|
+
import { AsyncQueue } from '../../internal/utils/async-queue';
|
|
17
|
+
import { buildHeaders } from '../../internal/headers';
|
|
18
|
+
import { helperHeader } from '../../internal/stainless-helper-header';
|
|
19
|
+
import type { RequestOptions } from '../../internal/request-options';
|
|
20
|
+
import { runRunnableTool, toolName, type BetaRunnableTool } from './BetaRunnableTool';
|
|
21
|
+
import type { BetaToolRunnerRequestOptions } from './BetaToolRunner';
|
|
22
|
+
|
|
23
|
+
/** Beta header for the managed-agents API. */
|
|
24
|
+
export const MANAGED_AGENTS_BETA = 'managed-agents-2026-04-01';
|
|
25
|
+
|
|
26
|
+
const STREAM_BACKOFF_START_MS = 500;
|
|
27
|
+
const STREAM_BACKOFF_CAP_MS = 10_000;
|
|
28
|
+
const TOOL_TIMEOUT_MS = 120_000;
|
|
29
|
+
const DRAIN_TIMEOUT_MS = 30_000;
|
|
30
|
+
const SEND_BACKOFF_START_MS = 1_000;
|
|
31
|
+
const SEND_BACKOFF_CAP_MS = 30_000;
|
|
32
|
+
/**
|
|
33
|
+
* How long a transiently failing tool-result send keeps retrying when the
|
|
34
|
+
* runner is used on its own: the server's default work-item lease TTL.
|
|
35
|
+
* `EnvironmentWorker` overrides it with the live TTL from each lease heartbeat
|
|
36
|
+
* (`_setSendRetryWindow`), so a send is only abandoned once the lease can no
|
|
37
|
+
* longer be ours.
|
|
38
|
+
*/
|
|
39
|
+
const SEND_RETRY_WINDOW_MS = 5 * 60_000;
|
|
40
|
+
|
|
41
|
+
/** Block type accepted in a `user.tool_result` event's content — codegen'd, stays in sync with the API. */
|
|
42
|
+
type SessionContentBlock = NonNullable<BetaManagedAgentsUserToolResultEventParams['content']>[number];
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A tool-call event the runner dispatches against the local registry: either a
|
|
46
|
+
* builtin `agent.tool_use` (answered with `user.tool_result`) or a custom
|
|
47
|
+
* `agent.custom_tool_use` (answered with `user.custom_tool_result`). Server-side
|
|
48
|
+
* `agent.mcp_tool_use` calls are intentionally excluded — the runner does not
|
|
49
|
+
* handle them.
|
|
50
|
+
*/
|
|
51
|
+
type DispatchedToolUseEvent = BetaManagedAgentsAgentToolUseEvent | BetaManagedAgentsAgentCustomToolUseEvent;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The result-event params paired with a {@link DispatchedToolUseEvent}: a
|
|
55
|
+
* `user.tool_result` answers an `agent.tool_use`, a `user.custom_tool_result`
|
|
56
|
+
* answers an `agent.custom_tool_use`. The two pairs must be matched exactly.
|
|
57
|
+
*/
|
|
58
|
+
type DispatchedToolResultParams =
|
|
59
|
+
| BetaManagedAgentsUserToolResultEventParams
|
|
60
|
+
| BetaManagedAgentsUserCustomToolResultEventParams;
|
|
61
|
+
|
|
62
|
+
export interface SessionToolRunnerOptions {
|
|
63
|
+
client: Anthropic;
|
|
64
|
+
/**
|
|
65
|
+
* Tools to expose to the session, in the same {@link BetaRunnableTool} shape
|
|
66
|
+
* `client.beta.messages.toolRunner` accepts. Use
|
|
67
|
+
* `betaAgentToolset20260401({ workdir })` from
|
|
68
|
+
* `@anthropic-ai/sdk/tools/agent-toolset/node` for the standard
|
|
69
|
+
* `agent_toolset_20260401` set; filter or extend the array to customise.
|
|
70
|
+
*/
|
|
71
|
+
tools: Array<BetaRunnableTool>;
|
|
72
|
+
/**
|
|
73
|
+
* Once the session goes idle with `stop_reason.type === "end_turn"`, the
|
|
74
|
+
* runner keeps running for this many milliseconds before stopping; any new
|
|
75
|
+
* event resets the countdown and it re-arms on the next `end_turn` idle. The
|
|
76
|
+
* countdown is deferred while a confirmation-gated call is held or still
|
|
77
|
+
* dispatching, and starts fresh once the last one resolves.
|
|
78
|
+
* Defaults to {@link DEFAULT_MAX_IDLE_MS} (60s). `0` (or negative) disables
|
|
79
|
+
* it — the runner then only stops on session termination or the consumer
|
|
80
|
+
* breaking out / aborting.
|
|
81
|
+
*/
|
|
82
|
+
maxIdleMs?: number;
|
|
83
|
+
/** External abort signal. Aborting it ends the iteration. */
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
/**
|
|
86
|
+
* Extra per-request options merged into every call this runner issues
|
|
87
|
+
* (event stream / list / send). Mirrors what `client.beta.messages.toolRunner`
|
|
88
|
+
* accepts: custom `headers` (e.g. a proxy's auth/routing headers) reach the
|
|
89
|
+
* poll/heartbeat/stop/stream/list/send calls. The runner always owns the abort
|
|
90
|
+
* signal, so a `signal` here is ignored — pass {@link SessionToolRunnerOptions.signal}
|
|
91
|
+
* to abort externally.
|
|
92
|
+
*/
|
|
93
|
+
requestOptions?: BetaToolRunnerRequestOptions;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Default {@link SessionToolRunnerOptions.maxIdleMs}: 60 seconds. */
|
|
97
|
+
export const DEFAULT_MAX_IDLE_MS = 60_000;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Outcome of a single tool execution dispatched by {@link SessionToolRunner}.
|
|
101
|
+
*
|
|
102
|
+
* Yielded after the tool ran (or failed) and after the result was posted back
|
|
103
|
+
* to the session as a `user.tool_result` event. Consumers can read either the
|
|
104
|
+
* embedded {@link DispatchedToolCall.event} / {@link DispatchedToolCall.result}
|
|
105
|
+
* blocks or the flat top-level convenience fields.
|
|
106
|
+
*/
|
|
107
|
+
export interface DispatchedToolCall {
|
|
108
|
+
/**
|
|
109
|
+
* The `agent.tool_use` or `agent.custom_tool_use` event that triggered this
|
|
110
|
+
* dispatch. Read `event.input` for the raw tool input and `event.name` for the
|
|
111
|
+
* tool name; `event.type` distinguishes a builtin tool call from a custom one.
|
|
112
|
+
*/
|
|
113
|
+
readonly event: DispatchedToolUseEvent;
|
|
114
|
+
/**
|
|
115
|
+
* The result event posted (or attempted) back to the session for this call: a
|
|
116
|
+
* `user.tool_result` for an `agent.tool_use`, a `user.custom_tool_result` for
|
|
117
|
+
* an `agent.custom_tool_use`. Read `result.content` for the tool's output
|
|
118
|
+
* blocks and `result.is_error` for the error flag.
|
|
119
|
+
*
|
|
120
|
+
* `undefined` when no result event was ever built — i.e. the tool name is
|
|
121
|
+
* not one this runner owns and, under the split-client behavior, it
|
|
122
|
+
* deliberately posted nothing and left the id pending for its owner.
|
|
123
|
+
*/
|
|
124
|
+
readonly result?: DispatchedToolResultParams;
|
|
125
|
+
/**
|
|
126
|
+
* Flat convenience for `event.id` — the id of the tool-use event this result
|
|
127
|
+
* answers (echoed back as `tool_use_id` / `custom_tool_use_id` on the result).
|
|
128
|
+
*/
|
|
129
|
+
readonly toolUseId: string;
|
|
130
|
+
/** Flat convenience for `event.name` — the dispatched tool's name. */
|
|
131
|
+
readonly name: string;
|
|
132
|
+
/**
|
|
133
|
+
* Flat convenience for `result.is_error` — `true` when the tool threw,
|
|
134
|
+
* `false` on success and for a skipped unowned call.
|
|
135
|
+
*/
|
|
136
|
+
readonly isError: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Whether a result event for this call reached the session. `false` when the
|
|
139
|
+
* post itself failed (typically a permanent 4xx or send-retry exhaustion)
|
|
140
|
+
* and also `false` — with no `result` event ever built — for a tool name
|
|
141
|
+
* this runner does not own when it deliberately posts nothing and leaves the
|
|
142
|
+
* id pending for its owner (the split-client behavior), or when the call
|
|
143
|
+
* was denied and never executed (see `confirmation`).
|
|
144
|
+
*/
|
|
145
|
+
readonly posted: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* The confirmation verdict that gated this call, if any.
|
|
148
|
+
*
|
|
149
|
+
* `'allow'` — the call required user confirmation (the server evaluated
|
|
150
|
+
* its permission to `ask`, e.g. under an `always_ask` policy) and the
|
|
151
|
+
* matching `user.tool_confirmation` approved it before the tool ran.
|
|
152
|
+
* `'deny'` — the user denied it, or the server itself evaluated the
|
|
153
|
+
* permission to `deny`; the tool was never executed and nothing was posted
|
|
154
|
+
* (`result=undefined`, `posted=false`, `isError=false`).
|
|
155
|
+
* `undefined` — the call needed no confirmation.
|
|
156
|
+
*/
|
|
157
|
+
readonly confirmation: 'allow' | 'deny' | undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Returns true if `ev` is a `session.status_idle` with `stop_reason` `end_turn`. */
|
|
161
|
+
function isEndTurnIdle(ev: { type?: string; stop_reason?: { type?: string } }): boolean {
|
|
162
|
+
return ev.type === 'session.status_idle' && ev.stop_reason?.type === 'end_turn';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The `maxIdleMs` stop-countdown, including its deferral. {@link noteEvent}
|
|
167
|
+
* arms on `session.status_idle` with `stop_reason: end_turn` and disarms on
|
|
168
|
+
* anything else. Gated tool work registered via {@link block} — a call held for
|
|
169
|
+
* user confirmation, or a user-approved call still dispatching — keeps
|
|
170
|
+
* {@link arm} pending until {@link unblock} retires the last blocker, at which
|
|
171
|
+
* point the countdown starts. Event-driven — there is no polling watchdog.
|
|
172
|
+
*/
|
|
173
|
+
class IdleClock {
|
|
174
|
+
readonly #maxIdleMs: number;
|
|
175
|
+
readonly #onExpire: () => void;
|
|
176
|
+
readonly #blockers = new Set<string>();
|
|
177
|
+
// Set when arm() found blockers outstanding; the unblock that retires the
|
|
178
|
+
// last blocker applies it. Cleared by any disarm.
|
|
179
|
+
#armPending = false;
|
|
180
|
+
#timer: ReturnType<typeof setTimeout> | undefined;
|
|
181
|
+
|
|
182
|
+
constructor(maxIdleMs: number, onExpire: () => void) {
|
|
183
|
+
this.#maxIdleMs = maxIdleMs;
|
|
184
|
+
this.#onExpire = onExpire;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Arm on `status_idle{end_turn}`; disarm otherwise. `user.tool_confirmation`
|
|
189
|
+
* is neutral: it signals neither agent activity nor an idle, and its effect
|
|
190
|
+
* on the clock flows through {@link block} / {@link unblock} instead —
|
|
191
|
+
* disarming here would discard the pending arm the verdict is about to
|
|
192
|
+
* settle.
|
|
193
|
+
*/
|
|
194
|
+
noteEvent(ev: { type: string; stop_reason?: { type?: string } }): void {
|
|
195
|
+
if (ev.type === 'user.tool_confirmation') return;
|
|
196
|
+
if (isEndTurnIdle(ev)) this.arm();
|
|
197
|
+
else this.disarm();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Register gated work that must resolve before an idle countdown starts. */
|
|
201
|
+
block(toolUseId: string): void {
|
|
202
|
+
this.#blockers.add(toolUseId);
|
|
203
|
+
if (this.#timer !== undefined) {
|
|
204
|
+
// Defensive: every caller disarms first (any event that routes a tool
|
|
205
|
+
// call is itself a disarming event), but a countdown running when gated
|
|
206
|
+
// work appears is stale evidence — the session is not idly waiting to
|
|
207
|
+
// stop. Convert it into a pending arm rather than let it fire over the
|
|
208
|
+
// gated call.
|
|
209
|
+
this.#armPending = true;
|
|
210
|
+
clearTimeout(this.#timer);
|
|
211
|
+
this.#timer = undefined;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Retire gated work (a no-op for ids never blocked); applies a pending arm —
|
|
217
|
+
* with a fresh full `maxIdleMs` window — once the last blocker retires.
|
|
218
|
+
*/
|
|
219
|
+
unblock(toolUseId: string): void {
|
|
220
|
+
this.#blockers.delete(toolUseId);
|
|
221
|
+
if (this.#blockers.size === 0 && this.#armPending) this.arm();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* (Re)start the idle countdown — or, while blockers are outstanding, hold
|
|
226
|
+
* the arm pending instead. Stopping then would drop a held call when its
|
|
227
|
+
* verdict later arrives, or cut the runner off before a released call's
|
|
228
|
+
* result can drive the next turn.
|
|
229
|
+
*/
|
|
230
|
+
arm(): void {
|
|
231
|
+
if (this.#maxIdleMs <= 0) return;
|
|
232
|
+
if (this.#blockers.size > 0) {
|
|
233
|
+
this.#armPending = true;
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
this.#armPending = false;
|
|
237
|
+
if (this.#timer !== undefined) clearTimeout(this.#timer);
|
|
238
|
+
this.#timer = setTimeout(this.#onExpire, this.#maxIdleMs);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Cancel the idle countdown and any pending arm. Blockers persist — they
|
|
243
|
+
* track real outstanding work, retired only by {@link unblock}.
|
|
244
|
+
*/
|
|
245
|
+
disarm(): void {
|
|
246
|
+
this.#armPending = false;
|
|
247
|
+
if (this.#timer !== undefined) {
|
|
248
|
+
clearTimeout(this.#timer);
|
|
249
|
+
this.#timer = undefined;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The sessions-side counterpart to `client.beta.messages.toolRunner`: an
|
|
256
|
+
* async-iterable that attaches to a managed-agents session, executes every
|
|
257
|
+
* incoming `agent.tool_use` and `agent.custom_tool_use` event against a local
|
|
258
|
+
* tool registry, posts the matching result back (`user.tool_result` for the
|
|
259
|
+
* former, `user.custom_tool_result` for the latter), and yields one
|
|
260
|
+
* {@link DispatchedToolCall} per completed call. Server-side `agent.mcp_tool_use`
|
|
261
|
+
* calls are not dispatched. Internally drives event-stream reconnect and result
|
|
262
|
+
* posting.
|
|
263
|
+
*
|
|
264
|
+
* A call the server gated with `evaluated_permission: "ask"` (the `always_ask`
|
|
265
|
+
* policy — or any value this SDK doesn't recognize, which fails closed) is held
|
|
266
|
+
* until its `user.tool_confirmation` arrives: only an explicit `allow` runs it;
|
|
267
|
+
* `deny` — or any verdict this SDK doesn't recognize, failing closed — is never
|
|
268
|
+
* executed and posts nothing (the denial resolves the call server-side), but is
|
|
269
|
+
* still yielded (`confirmation="deny"`, `posted=false`, `result=undefined`) so
|
|
270
|
+
* the consumer can observe it. A held call — and a user-approved one still
|
|
271
|
+
* dispatching — defers the `maxIdleMs` countdown, so an `end_turn` idle
|
|
272
|
+
* observed in the meantime cannot stop the runner: it waits until the verdict
|
|
273
|
+
* arrives, the session terminates, or the abort signal fires — pass
|
|
274
|
+
* `AbortSignal.timeout(...)` for a wall-clock bound.
|
|
275
|
+
*
|
|
276
|
+
* Iteration ends when the session terminates (`session.status_terminated` /
|
|
277
|
+
* `session.deleted`), when the consumer `break`s out of the loop or aborts the
|
|
278
|
+
* supplied signal, or — once the session has gone idle with
|
|
279
|
+
* `stop_reason.type === "end_turn"` — when `maxIdleMs` elapses with no new
|
|
280
|
+
* event (any new event resets that countdown; it re-arms on the next `end_turn`
|
|
281
|
+
* idle; `maxIdleMs <= 0` disables it). The `finally` branch drains any in-flight
|
|
282
|
+
* tool calls and runs each tool's `close()` cleanup hook. It does *not* touch
|
|
283
|
+
* the work-item lease — wrap it in an `EnvironmentWorker` if you need
|
|
284
|
+
* heartbeating / force-stop.
|
|
285
|
+
*
|
|
286
|
+
* @example
|
|
287
|
+
* ```ts
|
|
288
|
+
* import { betaAgentToolset20260401 } from '@anthropic-ai/sdk/tools/agent-toolset/node';
|
|
289
|
+
*
|
|
290
|
+
* for await (const call of client.beta.sessions.events.toolRunner(work.data.id, {
|
|
291
|
+
* tools: [...betaAgentToolset20260401({ workdir }), myTool],
|
|
292
|
+
* })) {
|
|
293
|
+
* console.log(`${call.name} -> ${call.isError ? 'error' : 'ok'}`);
|
|
294
|
+
* }
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
export class SessionToolRunner implements AsyncIterable<DispatchedToolCall> {
|
|
298
|
+
readonly client: Anthropic;
|
|
299
|
+
readonly sessionId: string;
|
|
300
|
+
readonly tools: ReadonlyArray<BetaRunnableTool>;
|
|
301
|
+
readonly maxIdleMs: number;
|
|
302
|
+
|
|
303
|
+
#consumed = false;
|
|
304
|
+
readonly #controller: AbortController;
|
|
305
|
+
readonly #detachExternal: () => void;
|
|
306
|
+
readonly #requestOpts: BetaToolRunnerRequestOptions | undefined;
|
|
307
|
+
readonly #toolByName: Map<string, BetaRunnableTool>;
|
|
308
|
+
readonly #logger: Logger;
|
|
309
|
+
readonly #seen = new Set<string>();
|
|
310
|
+
readonly #answered = new Set<string>();
|
|
311
|
+
// Confirmation gating (`always_ask` tools): `#confirmationVerdicts` records
|
|
312
|
+
// every `user.tool_confirmation` verdict by `tool_use_id`;
|
|
313
|
+
// `#awaitingConfirmation` holds the tool-call events whose
|
|
314
|
+
// `evaluated_permission` is `ask` and whose verdict has not arrived —
|
|
315
|
+
// released (or resolved as denied) by `#noteConfirmation` / the next
|
|
316
|
+
// reconcile pass. Like `#seen` and `#answered`, `#confirmationVerdicts` is
|
|
317
|
+
// per-session O(tool calls): recorded verdicts persist for the life of the run.
|
|
318
|
+
readonly #confirmationVerdicts = new Map<string, 'allow' | 'deny'>();
|
|
319
|
+
readonly #awaitingConfirmation = new Map<string, DispatchedToolUseEvent>();
|
|
320
|
+
readonly #results = new AsyncQueue<DispatchedToolCall>();
|
|
321
|
+
#inFlightCount = 0;
|
|
322
|
+
#sendRetryWindowMs = SEND_RETRY_WINDOW_MS;
|
|
323
|
+
#onIdle: (() => void) | null = null;
|
|
324
|
+
readonly #idleClock: IdleClock;
|
|
325
|
+
|
|
326
|
+
constructor(sessionId: string, opts: SessionToolRunnerOptions) {
|
|
327
|
+
this.client = opts.client;
|
|
328
|
+
this.sessionId = sessionId;
|
|
329
|
+
this.tools = opts.tools;
|
|
330
|
+
this.maxIdleMs = opts.maxIdleMs ?? DEFAULT_MAX_IDLE_MS;
|
|
331
|
+
this.#logger = loggerFor(opts.client);
|
|
332
|
+
this.#toolByName = new Map(opts.tools.map((t) => [toolName(t), t]));
|
|
333
|
+
this.#controller = new AbortController();
|
|
334
|
+
this.#detachExternal = linkAbort(opts.signal, this.#controller);
|
|
335
|
+
this.#requestOpts = opts.requestOptions;
|
|
336
|
+
this.#idleClock = new IdleClock(this.maxIdleMs, () => {
|
|
337
|
+
this.#logger.info('session idle after end_turn; stopping', {
|
|
338
|
+
component: 'session-tool-runner',
|
|
339
|
+
session_id: this.sessionId,
|
|
340
|
+
max_idle_ms: this.maxIdleMs,
|
|
341
|
+
});
|
|
342
|
+
this.#controller.abort();
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/** Read-only view of this runner's abort signal. */
|
|
347
|
+
get signal(): AbortSignal {
|
|
348
|
+
return this.#controller.signal;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Abort the runner. Background tasks will wind down and `for await` will exit cleanly. */
|
|
352
|
+
abort(): void {
|
|
353
|
+
this.#controller.abort();
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* @internal
|
|
358
|
+
* `EnvironmentWorker` keeps this equal to the lease TTL each heartbeat
|
|
359
|
+
* reports; applies to a send already retrying.
|
|
360
|
+
*/
|
|
361
|
+
_setSendRetryWindow(ms: number): void {
|
|
362
|
+
this.#sendRetryWindowMs = ms;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
async *[Symbol.asyncIterator](): AsyncIterator<DispatchedToolCall> {
|
|
366
|
+
if (this.#consumed) {
|
|
367
|
+
throw new AnthropicError('Cannot iterate over a consumed SessionToolRunner');
|
|
368
|
+
}
|
|
369
|
+
this.#consumed = true;
|
|
370
|
+
this.#logger.info('session tool runner starting', {
|
|
371
|
+
component: 'session-tool-runner',
|
|
372
|
+
session_id: this.sessionId,
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// The one background promise: drives the event stream and dispatches tools.
|
|
376
|
+
// Its `.catch` aborts the controller so the main loop unwinds.
|
|
377
|
+
const streamPromise = this.#streamLoop().catch((e) => {
|
|
378
|
+
if (!this.#controller.signal.aborted) {
|
|
379
|
+
this.#logger.error('stream loop failed', { error: String(e) });
|
|
380
|
+
}
|
|
381
|
+
this.#controller.abort();
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
try {
|
|
385
|
+
// Phase 1: yield results as they arrive. `next(signal)` resolves
|
|
386
|
+
// `done: true` when the controller aborts — cancellation is handled in
|
|
387
|
+
// the queue read, no outer `Promise.race` needed.
|
|
388
|
+
while (true) {
|
|
389
|
+
const next = await this.#results.next(this.#controller.signal);
|
|
390
|
+
if (next.done) break;
|
|
391
|
+
yield next.value;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Phase 2: let the stream loop settle (and push any final results), then
|
|
395
|
+
// drain whatever is still queued before closing.
|
|
396
|
+
await streamPromise;
|
|
397
|
+
let pending: DispatchedToolCall | undefined;
|
|
398
|
+
while ((pending = this.#results.tryShift()) !== undefined) {
|
|
399
|
+
yield pending;
|
|
400
|
+
}
|
|
401
|
+
} finally {
|
|
402
|
+
this.#controller.abort();
|
|
403
|
+
this.#idleClock.disarm();
|
|
404
|
+
// Re-await defensively in case the consumer broke out of phase 1 before
|
|
405
|
+
// phase 2 ran — a no-op if it already settled.
|
|
406
|
+
await streamPromise;
|
|
407
|
+
try {
|
|
408
|
+
await this.#drain();
|
|
409
|
+
} catch (e) {
|
|
410
|
+
this.#logger.warn('drain failed', { error: String(e) });
|
|
411
|
+
}
|
|
412
|
+
this.#results.close();
|
|
413
|
+
for (const t of this.tools) {
|
|
414
|
+
try {
|
|
415
|
+
// `close` is typed `() => Promisable<void>`, so a single `await`
|
|
416
|
+
// covers both the sync and async return.
|
|
417
|
+
await t.close?.();
|
|
418
|
+
} catch (e) {
|
|
419
|
+
this.#logger.warn('tool.close failed', { tool: toolName(t), error: String(e) });
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
// Detach from the external signal so the consumer can drop their signal
|
|
423
|
+
// reference without leaking this iterator instance.
|
|
424
|
+
this.#detachExternal();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// ===== request options =====
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Request options for every helper-issued call: the caller's `requestOptions`
|
|
432
|
+
* (custom proxy headers etc.) with the helper telemetry header stamped on and
|
|
433
|
+
* the runner's own abort signal forced last so it always owns cancellation.
|
|
434
|
+
*/
|
|
435
|
+
#requestOptions(): RequestOptions {
|
|
436
|
+
return {
|
|
437
|
+
...this.#requestOpts,
|
|
438
|
+
headers: buildHeaders([helperHeader('session-tool-runner'), this.#requestOpts?.headers]),
|
|
439
|
+
signal: this.#controller.signal,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// ===== event stream =====
|
|
444
|
+
|
|
445
|
+
async #streamLoop(): Promise<void> {
|
|
446
|
+
const ctrl = this.#controller;
|
|
447
|
+
let backoff = STREAM_BACKOFF_START_MS;
|
|
448
|
+
while (!ctrl.signal.aborted) {
|
|
449
|
+
try {
|
|
450
|
+
// Establish the event stream *before* reconciling history, so an event
|
|
451
|
+
// emitted in the gap between listing and attaching is buffered on the
|
|
452
|
+
// stream rather than lost. `seen`/`answered` dedup any event that shows
|
|
453
|
+
// up both in the reconcile pass and on the live stream.
|
|
454
|
+
const stream = await this.client.beta.sessions.events.stream(
|
|
455
|
+
this.sessionId,
|
|
456
|
+
{},
|
|
457
|
+
this.#requestOptions(),
|
|
458
|
+
);
|
|
459
|
+
await this.#reconcile();
|
|
460
|
+
for await (const ev of stream) {
|
|
461
|
+
backoff = STREAM_BACKOFF_START_MS;
|
|
462
|
+
if (await this.#handleStreamEvent(ev)) return;
|
|
463
|
+
}
|
|
464
|
+
} catch (e) {
|
|
465
|
+
// An abort throws to unwind the caller (the iterator's `streamPromise`
|
|
466
|
+
// `.catch`) rather than returning early and letting it carry on.
|
|
467
|
+
ctrl.signal.throwIfAborted();
|
|
468
|
+
if (isFatal4xx(e)) {
|
|
469
|
+
this.#logger.error('permanent stream failure, shutting down', { error: String(e) });
|
|
470
|
+
ctrl.abort();
|
|
471
|
+
throw e;
|
|
472
|
+
}
|
|
473
|
+
this.#logger.warn('stream disconnected, reconnecting', {
|
|
474
|
+
error: String(e),
|
|
475
|
+
backoff_ms: backoff,
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
ctrl.signal.throwIfAborted();
|
|
479
|
+
await sleep(backoff, ctrl.signal);
|
|
480
|
+
backoff = Math.min(backoff * 2, STREAM_BACKOFF_CAP_MS);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Read full history before dispatching so a `tool_use` whose result appears
|
|
486
|
+
* later in the same history is not re-executed. Runs after the live stream is
|
|
487
|
+
* already attached (see {@link SessionToolRunner.#streamLoop}).
|
|
488
|
+
*/
|
|
489
|
+
async #reconcile(): Promise<void> {
|
|
490
|
+
const ctrl = this.#controller;
|
|
491
|
+
const pending: DispatchedToolUseEvent[] = [];
|
|
492
|
+
let lastWasEndTurn = false;
|
|
493
|
+
try {
|
|
494
|
+
for await (const ev of this.client.beta.sessions.events.list(
|
|
495
|
+
this.sessionId,
|
|
496
|
+
{ limit: 1000 },
|
|
497
|
+
this.#requestOptions(),
|
|
498
|
+
)) {
|
|
499
|
+
this.#ingestHistory(ev, pending);
|
|
500
|
+
lastWasEndTurn = isEndTurnIdle(ev);
|
|
501
|
+
}
|
|
502
|
+
} catch (e) {
|
|
503
|
+
// An abort throws to unwind the caller; a real list failure is
|
|
504
|
+
// non-fatal — undo the speculative `seen` entries and let `#streamLoop`
|
|
505
|
+
// carry on with the live stream.
|
|
506
|
+
ctrl.signal.throwIfAborted();
|
|
507
|
+
this.#logger.warn('reconcile list failed', { error: String(e) });
|
|
508
|
+
// If list itself failed, undo the speculative `seen` entries so the next
|
|
509
|
+
// reconcile pass (or the live stream) can pick them up. Leave the idle
|
|
510
|
+
// timer untouched — the history we read may be incomplete.
|
|
511
|
+
for (const ev of pending) this.#seen.delete(ev.id);
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
const unanswered = pending.filter((ev) => !this.#answered.has(ev.id));
|
|
515
|
+
// Disarm before routing: `#execute` runs inline here, so a timer left armed
|
|
516
|
+
// from before the reconnect could fire over an in-flight tool.
|
|
517
|
+
this.#idleClock.disarm();
|
|
518
|
+
for (const ev of unanswered) await this.#routeToolEvent(ev);
|
|
519
|
+
// A held call's verdict is normally applied by the routing pass above; if
|
|
520
|
+
// its tool_use fell outside the listed window the pass never saw it, so
|
|
521
|
+
// apply the verdict to the held copy here.
|
|
522
|
+
for (const held of [...this.#awaitingConfirmation.values()]) {
|
|
523
|
+
const verdict = this.#confirmationVerdicts.get(held.id);
|
|
524
|
+
if (verdict !== undefined) await this.#applyVerdict(held, verdict);
|
|
525
|
+
}
|
|
526
|
+
// Routing resolves denied calls in place (marking them answered) and holds
|
|
527
|
+
// ask-gated calls for their `user.tool_confirmation`. If the most recent
|
|
528
|
+
// event in history is an `end_turn` idle and no tool work is outstanding,
|
|
529
|
+
// the session is done — arm the idle clock so the runner stops even if that
|
|
530
|
+
// `end_turn` arrived during a disconnect. A held call is not outstanding
|
|
531
|
+
// here: it blocks the clock, so this arm stays pending until the verdict
|
|
532
|
+
// (and, for an allow, the dispatch it releases) resolves it.
|
|
533
|
+
const outstanding = unanswered.filter(
|
|
534
|
+
(ev) => !this.#answered.has(ev.id) && !this.#awaitingConfirmation.has(ev.id),
|
|
535
|
+
);
|
|
536
|
+
if (lastWasEndTurn && outstanding.length === 0) this.#idleClock.arm();
|
|
537
|
+
else this.#idleClock.disarm();
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
#ingestHistory(ev: BetaManagedAgentsSessionEvent, pending: DispatchedToolUseEvent[]): void {
|
|
541
|
+
if (ev.type === 'agent.tool_use' || ev.type === 'agent.custom_tool_use') {
|
|
542
|
+
// Mark the event seen so a replay on the live stream is not dispatched
|
|
543
|
+
// twice, but decide whether it still needs executing from `answered`, not
|
|
544
|
+
// `seen`: a call whose result post failed is seen-but-unanswered, and must
|
|
545
|
+
// be retried on the next reconcile pass rather than silently dropped.
|
|
546
|
+
this.#seen.add(ev.id);
|
|
547
|
+
if (!this.#answered.has(ev.id)) pending.push(ev);
|
|
548
|
+
} else if (ev.type === 'user.tool_result') {
|
|
549
|
+
this.#answered.add(ev.tool_use_id);
|
|
550
|
+
} else if (ev.type === 'user.custom_tool_result') {
|
|
551
|
+
this.#answered.add(ev.custom_tool_use_id);
|
|
552
|
+
} else if (ev.type === 'user.tool_confirmation') {
|
|
553
|
+
// Record the verdict only, before the pending pass, so a call whose
|
|
554
|
+
// confirmation appears later in the same history routes with its verdict
|
|
555
|
+
// already known. Releasing a held call here as well would dispatch it a
|
|
556
|
+
// second time when the routing pass reaches its tool_use event.
|
|
557
|
+
if (!this.#answered.has(ev.tool_use_id)) this.#confirmationVerdicts.set(ev.tool_use_id, ev.result);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/** Returns true when the runner should exit. */
|
|
562
|
+
async #handleStreamEvent(ev: BetaManagedAgentsStreamSessionEvents): Promise<boolean> {
|
|
563
|
+
this.#idleClock.noteEvent(ev);
|
|
564
|
+
switch (ev.type) {
|
|
565
|
+
case 'agent.tool_use':
|
|
566
|
+
case 'agent.custom_tool_use':
|
|
567
|
+
if (!this.#seen.has(ev.id)) {
|
|
568
|
+
this.#seen.add(ev.id);
|
|
569
|
+
await this.#routeToolEvent(ev);
|
|
570
|
+
}
|
|
571
|
+
return false;
|
|
572
|
+
case 'user.tool_confirmation':
|
|
573
|
+
await this.#noteConfirmation(ev);
|
|
574
|
+
return false;
|
|
575
|
+
case 'user.tool_result':
|
|
576
|
+
this.#answered.add(ev.tool_use_id);
|
|
577
|
+
return false;
|
|
578
|
+
case 'user.custom_tool_result':
|
|
579
|
+
this.#answered.add(ev.custom_tool_use_id);
|
|
580
|
+
return false;
|
|
581
|
+
case 'session.status_terminated':
|
|
582
|
+
case 'session.deleted':
|
|
583
|
+
this.#logger.info('session terminated', {
|
|
584
|
+
component: 'session-tool-runner',
|
|
585
|
+
session_id: this.sessionId,
|
|
586
|
+
});
|
|
587
|
+
this.#controller.abort();
|
|
588
|
+
return true;
|
|
589
|
+
default:
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// ===== confirmation gating (always_ask tools) =====
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Dispatch `ev`, honoring its evaluated permission. A call the server gated
|
|
598
|
+
* (`evaluated_permission == "ask"`) is held until its `user.tool_confirmation`
|
|
599
|
+
* arrives. Fails closed: only an explicit `allow` verdict releases a gated
|
|
600
|
+
* call; a server-side `deny` overrides any recorded verdict; an unrecognized
|
|
601
|
+
* permission is held like `ask` and an unrecognized verdict is denied.
|
|
602
|
+
*/
|
|
603
|
+
async #routeToolEvent(ev: DispatchedToolUseEvent): Promise<void> {
|
|
604
|
+
// `getattr`-style read: today only `agent.tool_use` carries
|
|
605
|
+
// `evaluated_permission`, but if it ever lands on `agent.custom_tool_use`
|
|
606
|
+
// the gate must keep failing closed rather than dispatch by event type.
|
|
607
|
+
const permission = (ev as { evaluated_permission?: 'allow' | 'ask' | 'deny' }).evaluated_permission;
|
|
608
|
+
// A server-side `deny` overrides any (stray) recorded verdict.
|
|
609
|
+
const verdict = permission === 'deny' ? 'deny' : this.#confirmationVerdicts.get(ev.id);
|
|
610
|
+
if (verdict === undefined) {
|
|
611
|
+
if (permission === undefined || permission === 'allow') {
|
|
612
|
+
await this.#execute(ev, undefined);
|
|
613
|
+
} else if (!this.#awaitingConfirmation.has(ev.id)) {
|
|
614
|
+
// "ask" — or a permission this SDK does not recognize, which must not
|
|
615
|
+
// dispatch unconfirmed — waits for the user's verdict. (Already-held: a
|
|
616
|
+
// reconcile after reconnect re-routes the call; keep the existing hold.)
|
|
617
|
+
this.#logger.info('tool call awaiting confirmation; holding', {
|
|
618
|
+
component: 'session-tool-runner',
|
|
619
|
+
session_id: this.sessionId,
|
|
620
|
+
tool: ev.name,
|
|
621
|
+
tool_use_id: ev.id,
|
|
622
|
+
});
|
|
623
|
+
this.#awaitingConfirmation.set(ev.id, ev);
|
|
624
|
+
this.#idleClock.block(ev.id);
|
|
625
|
+
}
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
await this.#applyVerdict(ev, verdict);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/** Record an allow/deny verdict and release the held call it gates, if any. */
|
|
632
|
+
async #noteConfirmation(ev: { tool_use_id: string; result: 'allow' | 'deny' }): Promise<void> {
|
|
633
|
+
this.#confirmationVerdicts.set(ev.tool_use_id, ev.result);
|
|
634
|
+
const held = this.#awaitingConfirmation.get(ev.tool_use_id);
|
|
635
|
+
// Nothing held: the verdict gates a call this runner has not seen yet (or
|
|
636
|
+
// one it never gates, e.g. an `agent.mcp_tool_use`). Keeping it in
|
|
637
|
+
// `#confirmationVerdicts` lets a later route of that call resolve instantly.
|
|
638
|
+
if (held === undefined) return;
|
|
639
|
+
await this.#applyVerdict(held, ev.result);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Dispatch or resolve a gated call according to its verdict.
|
|
644
|
+
*
|
|
645
|
+
* The idle-clock blocker accounting lives here: a denial retires the held
|
|
646
|
+
* call's blocker, while an allow keeps one on the call — taking it now if the
|
|
647
|
+
* verdict was already known when the call was routed, so it was never held —
|
|
648
|
+
* until `#execute` has finished with it. The countdown must not run over
|
|
649
|
+
* gated work that is still in flight.
|
|
650
|
+
*/
|
|
651
|
+
async #applyVerdict(ev: DispatchedToolUseEvent, verdict: 'allow' | 'deny'): Promise<void> {
|
|
652
|
+
const wasHeld = this.#awaitingConfirmation.delete(ev.id);
|
|
653
|
+
if (verdict === 'allow') {
|
|
654
|
+
this.#logger.info('tool call confirmed', {
|
|
655
|
+
component: 'session-tool-runner',
|
|
656
|
+
session_id: this.sessionId,
|
|
657
|
+
tool: ev.name,
|
|
658
|
+
tool_use_id: ev.id,
|
|
659
|
+
});
|
|
660
|
+
if (!wasHeld) this.#idleClock.block(ev.id);
|
|
661
|
+
try {
|
|
662
|
+
await this.#execute(ev, 'allow');
|
|
663
|
+
} finally {
|
|
664
|
+
// The approved call is fully disposed of (executed, or moot because it
|
|
665
|
+
// was answered elsewhere) — the sole place an allow's blocker retires.
|
|
666
|
+
this.#idleClock.unblock(ev.id);
|
|
667
|
+
}
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
// "deny" — or any value other than an explicit "allow" (fail closed). The
|
|
671
|
+
// denial resolves the call server-side, so mark it answered and yield it
|
|
672
|
+
// (nothing ran, nothing posted).
|
|
673
|
+
if (wasHeld) this.#idleClock.unblock(ev.id);
|
|
674
|
+
this.#answered.add(ev.id);
|
|
675
|
+
this.#logger.info('tool call denied; not executing', {
|
|
676
|
+
component: 'session-tool-runner',
|
|
677
|
+
session_id: this.sessionId,
|
|
678
|
+
tool: ev.name,
|
|
679
|
+
tool_use_id: ev.id,
|
|
680
|
+
});
|
|
681
|
+
this.#surfaceCall({
|
|
682
|
+
event: ev,
|
|
683
|
+
toolUseId: ev.id,
|
|
684
|
+
name: ev.name,
|
|
685
|
+
isError: false,
|
|
686
|
+
posted: false,
|
|
687
|
+
confirmation: 'deny',
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Yield `call` to the consumer. A closed queue — the consumer broke out of
|
|
693
|
+
* the iterator — makes `push` a no-op returning false; the underlying work
|
|
694
|
+
* already happened, so only the observability event is lost.
|
|
695
|
+
*/
|
|
696
|
+
#surfaceCall(call: DispatchedToolCall): void {
|
|
697
|
+
this.#results.push(call);
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
// ===== tool execution =====
|
|
701
|
+
|
|
702
|
+
async #execute(ev: DispatchedToolUseEvent, confirmation: 'allow' | undefined): Promise<void> {
|
|
703
|
+
if (this.#answered.has(ev.id)) return;
|
|
704
|
+
this.#logger.info('executing tool', {
|
|
705
|
+
component: 'session-tool-runner',
|
|
706
|
+
session_id: this.sessionId,
|
|
707
|
+
tool: ev.name,
|
|
708
|
+
tool_use_id: ev.id,
|
|
709
|
+
});
|
|
710
|
+
this.#inFlightCount++;
|
|
711
|
+
try {
|
|
712
|
+
const tool = this.#toolByName.get(ev.name);
|
|
713
|
+
if (!tool) {
|
|
714
|
+
// Skip (split-client partial fulfilment): a name this runner
|
|
715
|
+
// is not registered for belongs to the other client servicing this
|
|
716
|
+
// session (typically the customer's app backend handling custom tools).
|
|
717
|
+
// Post NO result, do not mark it answered, and leave the tool_use_id
|
|
718
|
+
// pending for its owner — claiming it would corrupt the conversation.
|
|
719
|
+
// Still yield the call so the consumer can observe the unowned
|
|
720
|
+
// dispatch; nothing was sent, so `posted`/`isError` stay false and no
|
|
721
|
+
// `result` event is populated. The id stays unanswered, so reconcile
|
|
722
|
+
// keeps it out of the idle/end-turn accounting and re-surfaces it after
|
|
723
|
+
// a reconnect until its owner answers it.
|
|
724
|
+
this.#logger.info('tool not owned by this runner; leaving the tool_use_id pending for its owner', {
|
|
725
|
+
component: 'session-tool-runner',
|
|
726
|
+
session_id: this.sessionId,
|
|
727
|
+
tool: ev.name,
|
|
728
|
+
tool_use_id: ev.id,
|
|
729
|
+
});
|
|
730
|
+
this.#surfaceCall({
|
|
731
|
+
event: ev,
|
|
732
|
+
toolUseId: ev.id,
|
|
733
|
+
name: ev.name,
|
|
734
|
+
isError: false,
|
|
735
|
+
posted: false,
|
|
736
|
+
confirmation,
|
|
737
|
+
});
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
let content: string | Array<BetaToolResultContentBlockParam>;
|
|
741
|
+
let isError: boolean;
|
|
742
|
+
// Per-tool controller: aborts on the runner's own signal *or* the
|
|
743
|
+
// per-tool timeout, so an in-flight tool stops promptly when the runner
|
|
744
|
+
// is aborted instead of running until the timeout.
|
|
745
|
+
const toolCtrl = new AbortController();
|
|
746
|
+
const detachTool = linkAbort(this.#controller.signal, toolCtrl);
|
|
747
|
+
const timer = setTimeout(() => toolCtrl.abort(), TOOL_TIMEOUT_MS);
|
|
748
|
+
try {
|
|
749
|
+
// Pass the source `agent.tool_use` / `agent.custom_tool_use` event
|
|
750
|
+
// straight through as the run context's `toolUse` — it is a union
|
|
751
|
+
// member of `BetaToolUse`, no Messages-block adapter needed.
|
|
752
|
+
const outcome = await runRunnableTool(tool, ev.input, {
|
|
753
|
+
toolUse: ev,
|
|
754
|
+
toolUseBlock: ev,
|
|
755
|
+
signal: toolCtrl.signal,
|
|
756
|
+
});
|
|
757
|
+
content = outcome.content;
|
|
758
|
+
isError = outcome.isError;
|
|
759
|
+
} finally {
|
|
760
|
+
clearTimeout(timer);
|
|
761
|
+
detachTool();
|
|
762
|
+
}
|
|
763
|
+
// Answer with the result event that matches the call kind: a
|
|
764
|
+
// `user.tool_result` for an `agent.tool_use`, a `user.custom_tool_result`
|
|
765
|
+
// for an `agent.custom_tool_use`. Posting the wrong one leaves the call
|
|
766
|
+
// unanswered and the session stuck.
|
|
767
|
+
const result = buildResultEvent(ev, isError, toSessionContent(content));
|
|
768
|
+
const posted = await this.#sendResult(result, ev.id);
|
|
769
|
+
this.#surfaceCall({
|
|
770
|
+
event: ev,
|
|
771
|
+
result,
|
|
772
|
+
toolUseId: ev.id,
|
|
773
|
+
name: ev.name,
|
|
774
|
+
isError,
|
|
775
|
+
posted,
|
|
776
|
+
confirmation,
|
|
777
|
+
});
|
|
778
|
+
} finally {
|
|
779
|
+
this.#inFlightCount--;
|
|
780
|
+
if (this.#inFlightCount === 0) this.#onIdle?.();
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
async #sendResult(result: DispatchedToolResultParams, toolUseId: string): Promise<boolean> {
|
|
785
|
+
const ctrl = this.#controller;
|
|
786
|
+
const start = Date.now();
|
|
787
|
+
let lastErr: unknown;
|
|
788
|
+
let attempt = 0;
|
|
789
|
+
while (true) {
|
|
790
|
+
attempt++;
|
|
791
|
+
// An abort throws to unwind the caller rather than returning a
|
|
792
|
+
// `posted: false` result the iterator would carry on past.
|
|
793
|
+
ctrl.signal.throwIfAborted();
|
|
794
|
+
try {
|
|
795
|
+
await this.client.beta.sessions.events.send(
|
|
796
|
+
this.sessionId,
|
|
797
|
+
{ events: [result] },
|
|
798
|
+
this.#requestOptions(),
|
|
799
|
+
);
|
|
800
|
+
this.#answered.add(toolUseId);
|
|
801
|
+
return true;
|
|
802
|
+
} catch (e) {
|
|
803
|
+
lastErr = e;
|
|
804
|
+
// Only short-circuit on a permanent 4xx; 408/409/429 deserve the
|
|
805
|
+
// remaining retries (aligned with the core client's retry policy).
|
|
806
|
+
if (isFatal4xx(e)) break;
|
|
807
|
+
const remainingMs = this.#sendRetryWindowMs - (Date.now() - start);
|
|
808
|
+
if (remainingMs <= 0) break;
|
|
809
|
+
const waitMs = Math.min(
|
|
810
|
+
applyJitter(backoff(attempt - 1, SEND_BACKOFF_START_MS, SEND_BACKOFF_CAP_MS)),
|
|
811
|
+
remainingMs,
|
|
812
|
+
);
|
|
813
|
+
this.#logger.warn('tool result send failed; retrying', {
|
|
814
|
+
tool_use_id: toolUseId,
|
|
815
|
+
attempt,
|
|
816
|
+
backoff_ms: waitMs,
|
|
817
|
+
error: String(e),
|
|
818
|
+
});
|
|
819
|
+
await sleep(waitMs, ctrl.signal);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
this.#logger.error('failed to send tool result', {
|
|
823
|
+
tool_use_id: toolUseId,
|
|
824
|
+
attempts: attempt,
|
|
825
|
+
error: String(lastErr),
|
|
826
|
+
});
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
/** Wait (bounded) for in-flight tool executions to finish during teardown. */
|
|
831
|
+
async #drain(): Promise<void> {
|
|
832
|
+
if (this.#inFlightCount === 0) return;
|
|
833
|
+
await Promise.race([new Promise<void>((r) => (this.#onIdle = r)), sleep(DRAIN_TIMEOUT_MS)]);
|
|
834
|
+
this.#onIdle = null;
|
|
835
|
+
if (this.#inFlightCount > 0) {
|
|
836
|
+
this.#logger.warn('drain timeout exceeded');
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Build the result event that answers `ev`: a `user.tool_result` for a builtin
|
|
843
|
+
* `agent.tool_use`, a `user.custom_tool_result` for a custom
|
|
844
|
+
* `agent.custom_tool_use`. The two `(use, result)` pairs are distinct API event
|
|
845
|
+
* types and must be matched exactly — a `user.tool_result` does not answer a
|
|
846
|
+
* custom tool call.
|
|
847
|
+
*/
|
|
848
|
+
function buildResultEvent(
|
|
849
|
+
ev: DispatchedToolUseEvent,
|
|
850
|
+
isError: boolean,
|
|
851
|
+
content: SessionContentBlock[],
|
|
852
|
+
): DispatchedToolResultParams {
|
|
853
|
+
if (ev.type === 'agent.custom_tool_use') {
|
|
854
|
+
return { type: 'user.custom_tool_result', custom_tool_use_id: ev.id, is_error: isError, content };
|
|
855
|
+
}
|
|
856
|
+
return { type: 'user.tool_result', tool_use_id: ev.id, is_error: isError, content };
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// The Messages-API tool-result block union is wider than the Sessions-API
|
|
860
|
+
// tool_result content union; pass through text/image/document and stringify
|
|
861
|
+
// anything else so a BetaRunnableTool authored for toolRunner still works here.
|
|
862
|
+
function toSessionContent(content: string | Array<BetaToolResultContentBlockParam>): SessionContentBlock[] {
|
|
863
|
+
if (typeof content === 'string') return [{ type: 'text', text: content || '(no output)' }];
|
|
864
|
+
const out = content.map((b): SessionContentBlock => {
|
|
865
|
+
if (b.type === 'text') return { type: 'text', text: b.text || '(no output)' };
|
|
866
|
+
if (b.type === 'image' || b.type === 'document') return b as SessionContentBlock;
|
|
867
|
+
if (b.type === 'search_result') {
|
|
868
|
+
// The Messages `search_result` block param maps field-for-field onto the
|
|
869
|
+
// Sessions `BetaManagedAgentsSearchResultBlock`; map it explicitly rather
|
|
870
|
+
// than letting it fall through to the JSON.stringify branch (which would
|
|
871
|
+
// bury a structured result inside a text block). `citations` is required
|
|
872
|
+
// on the Sessions side and optional on the Messages side — default the
|
|
873
|
+
// flag to `false` when the producer left it unset.
|
|
874
|
+
return {
|
|
875
|
+
type: 'search_result',
|
|
876
|
+
source: b.source,
|
|
877
|
+
title: b.title,
|
|
878
|
+
content: b.content.map((c) => ({ type: 'text', text: c.text })),
|
|
879
|
+
citations: { enabled: b.citations?.enabled ?? false },
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
return { type: 'text', text: JSON.stringify(b) };
|
|
883
|
+
});
|
|
884
|
+
return out.length > 0 ? out : [{ type: 'text', text: '(no output)' }];
|
|
885
|
+
}
|