@copilotkit/runtime 2.0.0-rc.6 → 2.0.0-rc.61
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/README.md +29 -4
- package/dist/agent/{url-download.cjs → ai-sdk/url-download.cjs} +19 -76
- package/dist/agent/ai-sdk/url-download.cjs.map +1 -0
- package/dist/agent/{url-download.d.cts → ai-sdk/url-download.d.cts} +11 -8
- package/dist/agent/ai-sdk/url-download.d.cts.map +1 -0
- package/dist/agent/{url-download.d.mts → ai-sdk/url-download.d.mts} +11 -8
- package/dist/agent/ai-sdk/url-download.d.mts.map +1 -0
- package/dist/agent/{url-download.mjs → ai-sdk/url-download.mjs} +20 -74
- package/dist/agent/ai-sdk/url-download.mjs.map +1 -0
- package/dist/agent/ai-sdk.cjs +425 -0
- package/dist/agent/ai-sdk.cjs.map +1 -0
- package/dist/agent/ai-sdk.d.cts +119 -0
- package/dist/agent/ai-sdk.d.cts.map +1 -0
- package/dist/agent/ai-sdk.d.mts +119 -0
- package/dist/agent/ai-sdk.d.mts.map +1 -0
- package/dist/agent/ai-sdk.mjs +419 -0
- package/dist/agent/ai-sdk.mjs.map +1 -0
- package/dist/agent/classic-tools.cjs +185 -0
- package/dist/agent/classic-tools.cjs.map +1 -0
- package/dist/agent/classic-tools.mjs +183 -0
- package/dist/agent/classic-tools.mjs.map +1 -0
- package/dist/agent/converters/aisdk.cjs +17 -4
- package/dist/agent/converters/aisdk.cjs.map +1 -1
- package/dist/agent/converters/aisdk.d.cts.map +1 -1
- package/dist/agent/converters/aisdk.d.mts.map +1 -1
- package/dist/agent/converters/aisdk.mjs +18 -2
- package/dist/agent/converters/aisdk.mjs.map +1 -1
- package/dist/agent/converters/tanstack.cjs +202 -30
- package/dist/agent/converters/tanstack.cjs.map +1 -1
- package/dist/agent/converters/tanstack.d.cts +90 -6
- package/dist/agent/converters/tanstack.d.cts.map +1 -1
- package/dist/agent/converters/tanstack.d.mts +90 -6
- package/dist/agent/converters/tanstack.d.mts.map +1 -1
- package/dist/agent/converters/tanstack.mjs +202 -29
- package/dist/agent/converters/tanstack.mjs.map +1 -1
- package/dist/agent/learned-skills.cjs +15 -17
- package/dist/agent/learned-skills.cjs.map +1 -1
- package/dist/agent/learned-skills.d.cts +9 -3
- package/dist/agent/learned-skills.d.cts.map +1 -1
- package/dist/agent/learned-skills.d.mts +9 -3
- package/dist/agent/learned-skills.d.mts.map +1 -1
- package/dist/agent/learned-skills.mjs +15 -16
- package/dist/agent/learned-skills.mjs.map +1 -1
- package/dist/agent/model.cjs +42 -0
- package/dist/agent/model.cjs.map +1 -0
- package/dist/agent/model.d.cts +19 -0
- package/dist/agent/model.d.cts.map +1 -0
- package/dist/agent/model.d.mts +19 -0
- package/dist/agent/model.d.mts.map +1 -0
- package/dist/agent/model.mjs +41 -0
- package/dist/agent/model.mjs.map +1 -0
- package/dist/agent/state-delta.cjs +0 -1
- package/dist/agent/state-delta.cjs.map +1 -1
- package/dist/agent.cjs +558 -0
- package/dist/agent.cjs.map +1 -0
- package/dist/agent.d.cts +455 -0
- package/dist/agent.d.cts.map +1 -0
- package/dist/agent.d.mts +455 -0
- package/dist/agent.d.mts.map +1 -0
- package/dist/agent.mjs +551 -0
- package/dist/agent.mjs.map +1 -0
- package/dist/index.cjs +23 -28
- package/dist/index.d.cts +14 -14
- package/dist/index.d.mts +14 -14
- package/dist/index.mjs +8 -8
- package/dist/internal/learned-skills.d.cts +1 -1
- package/dist/internal/learned-skills.d.mts +1 -1
- package/dist/node.cjs +2 -3
- package/dist/node.d.cts +3 -3
- package/dist/node.d.mts +3 -3
- package/dist/node.mjs +3 -3
- package/dist/runtime/core/channel-manager.cjs +10 -2
- package/dist/runtime/core/channel-manager.cjs.map +1 -1
- package/dist/runtime/core/channel-manager.d.cts +1 -1
- package/dist/runtime/core/channel-manager.d.mts +1 -1
- package/dist/runtime/core/channel-manager.mjs +10 -1
- package/dist/runtime/core/channel-manager.mjs.map +1 -1
- package/dist/runtime/core/debug-event-bus.cjs +4 -3
- package/dist/runtime/core/debug-event-bus.cjs.map +1 -1
- package/dist/runtime/core/debug-event-bus.d.cts +5 -1
- package/dist/runtime/core/debug-event-bus.d.cts.map +1 -1
- package/dist/runtime/core/debug-event-bus.d.mts +4 -0
- package/dist/runtime/core/debug-event-bus.d.mts.map +1 -1
- package/dist/runtime/core/debug-event-bus.mjs +5 -3
- package/dist/runtime/core/debug-event-bus.mjs.map +1 -1
- package/dist/runtime/core/fetch-cors.cjs.map +1 -1
- package/dist/runtime/core/fetch-cors.d.cts +2 -2
- package/dist/runtime/core/fetch-cors.d.cts.map +1 -1
- package/dist/runtime/core/fetch-cors.d.mts +2 -2
- package/dist/runtime/core/fetch-cors.d.mts.map +1 -1
- package/dist/runtime/core/fetch-cors.mjs.map +1 -1
- package/dist/runtime/core/fetch-handler.cjs +17 -14
- package/dist/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/runtime/core/fetch-handler.d.cts +22 -14
- package/dist/runtime/core/fetch-handler.d.cts.map +1 -1
- package/dist/runtime/core/fetch-handler.d.mts +22 -14
- package/dist/runtime/core/fetch-handler.d.mts.map +1 -1
- package/dist/runtime/core/fetch-handler.mjs +9 -5
- package/dist/runtime/core/fetch-handler.mjs.map +1 -1
- package/dist/runtime/core/hooks.cjs.map +1 -1
- package/dist/runtime/core/hooks.d.cts +5 -5
- package/dist/runtime/core/hooks.d.cts.map +1 -1
- package/dist/runtime/core/hooks.d.mts +5 -5
- package/dist/runtime/core/hooks.d.mts.map +1 -1
- package/dist/runtime/core/hooks.mjs.map +1 -1
- package/dist/runtime/core/learning.cjs.map +1 -1
- package/dist/runtime/core/learning.d.cts +9 -9
- package/dist/runtime/core/learning.d.cts.map +1 -1
- package/dist/runtime/core/learning.d.mts +8 -8
- package/dist/runtime/core/learning.d.mts.map +1 -1
- package/dist/runtime/core/learning.mjs.map +1 -1
- package/dist/runtime/core/logger.cjs +105 -14
- package/dist/runtime/core/logger.cjs.map +1 -1
- package/dist/runtime/core/logger.d.cts +26 -9
- package/dist/runtime/core/logger.d.cts.map +1 -1
- package/dist/runtime/core/logger.d.mts +26 -9
- package/dist/runtime/core/logger.d.mts.map +1 -1
- package/dist/runtime/core/logger.mjs +105 -12
- package/dist/runtime/core/logger.mjs.map +1 -1
- package/dist/runtime/core/middleware-sse-parser.cjs +3 -4
- package/dist/runtime/core/middleware-sse-parser.cjs.map +1 -1
- package/dist/runtime/core/middleware-sse-parser.d.cts.map +1 -1
- package/dist/runtime/core/middleware-sse-parser.d.mts.map +1 -1
- package/dist/runtime/core/middleware-sse-parser.mjs +2 -2
- package/dist/runtime/core/middleware-sse-parser.mjs.map +1 -1
- package/dist/runtime/core/middleware.cjs +5 -5
- package/dist/runtime/core/middleware.cjs.map +1 -1
- package/dist/runtime/core/middleware.d.cts +3 -3
- package/dist/runtime/core/middleware.d.cts.map +1 -1
- package/dist/runtime/core/middleware.d.mts +3 -3
- package/dist/runtime/core/middleware.d.mts.map +1 -1
- package/dist/runtime/core/middleware.mjs +4 -3
- package/dist/runtime/core/middleware.mjs.map +1 -1
- package/dist/runtime/core/package-info.cjs +1 -1
- package/dist/runtime/core/package-info.mjs +1 -1
- package/dist/runtime/core/runtime-error-reporter.cjs.map +1 -1
- package/dist/runtime/core/runtime-error-reporter.mjs.map +1 -1
- package/dist/runtime/core/runtime.cjs +44 -46
- package/dist/runtime/core/runtime.cjs.map +1 -1
- package/dist/runtime/core/runtime.d.cts +178 -91
- package/dist/runtime/core/runtime.d.cts.map +1 -1
- package/dist/runtime/core/runtime.d.mts +178 -91
- package/dist/runtime/core/runtime.d.mts.map +1 -1
- package/dist/runtime/core/runtime.mjs +42 -42
- package/dist/runtime/core/runtime.mjs.map +1 -1
- package/dist/runtime/endpoints/auto-start-channels.cjs +3 -4
- package/dist/runtime/endpoints/auto-start-channels.cjs.map +1 -1
- package/dist/runtime/endpoints/auto-start-channels.mjs +2 -2
- package/dist/runtime/endpoints/auto-start-channels.mjs.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.cjs +4 -8
- package/dist/runtime/endpoints/node-fetch-handler.cjs.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.d.cts +4 -5
- package/dist/runtime/endpoints/node-fetch-handler.d.cts.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.d.mts +4 -5
- package/dist/runtime/endpoints/node-fetch-handler.d.mts.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.mjs +3 -5
- package/dist/runtime/endpoints/node-fetch-handler.mjs.map +1 -1
- package/dist/runtime/endpoints/node.cjs +7 -5
- package/dist/runtime/endpoints/node.cjs.map +1 -1
- package/dist/runtime/endpoints/node.d.cts +16 -16
- package/dist/runtime/endpoints/node.d.cts.map +1 -1
- package/dist/runtime/endpoints/node.d.mts +16 -16
- package/dist/runtime/endpoints/node.d.mts.map +1 -1
- package/dist/runtime/endpoints/node.mjs +9 -7
- package/dist/runtime/endpoints/node.mjs.map +1 -1
- package/dist/runtime/event-transforms/index.d.cts +4 -0
- package/dist/runtime/event-transforms/index.d.mts +4 -0
- package/dist/runtime/event-transforms/index.mjs +5 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.cjs +277 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.cjs.map +1 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.d.cts +61 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.d.cts.map +1 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.d.mts +61 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.d.mts.map +1 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.mjs +276 -0
- package/dist/runtime/event-transforms/open-generative-ui-middleware.mjs.map +1 -0
- package/dist/runtime/event-transforms/recorded-events.cjs +68 -0
- package/dist/runtime/event-transforms/recorded-events.cjs.map +1 -0
- package/dist/runtime/event-transforms/recorded-events.d.cts +27 -0
- package/dist/runtime/event-transforms/recorded-events.d.cts.map +1 -0
- package/dist/runtime/event-transforms/recorded-events.d.mts +27 -0
- package/dist/runtime/event-transforms/recorded-events.d.mts.map +1 -0
- package/dist/runtime/event-transforms/recorded-events.mjs +68 -0
- package/dist/runtime/event-transforms/recorded-events.mjs.map +1 -0
- package/dist/runtime/event-transforms/streaming-json-scanner.cjs +289 -0
- package/dist/runtime/event-transforms/streaming-json-scanner.cjs.map +1 -0
- package/dist/runtime/event-transforms/streaming-json-scanner.mjs +288 -0
- package/dist/runtime/event-transforms/streaming-json-scanner.mjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-actions.cjs +106 -0
- package/dist/runtime/generative-ui/a2ui-v09-actions.cjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-actions.mjs +106 -0
- package/dist/runtime/generative-ui/a2ui-v09-actions.mjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-catalog.cjs +422 -0
- package/dist/runtime/generative-ui/a2ui-v09-catalog.cjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-catalog.mjs +422 -0
- package/dist/runtime/generative-ui/a2ui-v09-catalog.mjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.cjs +84 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.cjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.d.cts +41 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.d.cts.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.d.mts +41 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.d.mts.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.mjs +83 -0
- package/dist/runtime/generative-ui/a2ui-v09-middleware.mjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-operations.cjs +694 -0
- package/dist/runtime/generative-ui/a2ui-v09-operations.cjs.map +1 -0
- package/dist/runtime/generative-ui/a2ui-v09-operations.mjs +694 -0
- package/dist/runtime/generative-ui/a2ui-v09-operations.mjs.map +1 -0
- package/dist/runtime/generative-ui/generative-ui-middleware.cjs +0 -1
- package/dist/runtime/generative-ui/generative-ui-middleware.cjs.map +1 -1
- package/dist/runtime/generative-ui/index.d.cts +1 -0
- package/dist/runtime/generative-ui/index.d.mts +1 -0
- package/dist/runtime/generative-ui/surface-writer.cjs +4 -5
- package/dist/runtime/generative-ui/surface-writer.cjs.map +1 -1
- package/dist/runtime/generative-ui/surface-writer.d.cts +1 -1
- package/dist/runtime/generative-ui/surface-writer.d.cts.map +1 -1
- package/dist/runtime/generative-ui/surface-writer.d.mts.map +1 -1
- package/dist/runtime/generative-ui/surface-writer.mjs +5 -5
- package/dist/runtime/generative-ui/surface-writer.mjs.map +1 -1
- package/dist/runtime/handlers/get-runtime-info.cjs +24 -6
- package/dist/runtime/handlers/get-runtime-info.cjs.map +1 -1
- package/dist/runtime/handlers/get-runtime-info.mjs +25 -7
- package/dist/runtime/handlers/get-runtime-info.mjs.map +1 -1
- package/dist/runtime/handlers/handle-connect.cjs +3 -8
- package/dist/runtime/handlers/handle-connect.cjs.map +1 -1
- package/dist/runtime/handlers/handle-connect.mjs +3 -8
- package/dist/runtime/handlers/handle-connect.mjs.map +1 -1
- package/dist/runtime/handlers/handle-debug-events.cjs.map +1 -1
- package/dist/runtime/handlers/handle-debug-events.mjs.map +1 -1
- package/dist/runtime/handlers/handle-inspector-learning.cjs +2 -3
- package/dist/runtime/handlers/handle-inspector-learning.cjs.map +1 -1
- package/dist/runtime/handlers/handle-inspector-learning.mjs.map +1 -1
- package/dist/runtime/handlers/handle-inspector-metadata.cjs +2 -3
- package/dist/runtime/handlers/handle-inspector-metadata.cjs.map +1 -1
- package/dist/runtime/handlers/handle-inspector-metadata.mjs.map +1 -1
- package/dist/runtime/handlers/handle-run.cjs +11 -16
- package/dist/runtime/handlers/handle-run.cjs.map +1 -1
- package/dist/runtime/handlers/handle-run.mjs +8 -12
- package/dist/runtime/handlers/handle-run.mjs.map +1 -1
- package/dist/runtime/handlers/handle-stop.cjs +5 -5
- package/dist/runtime/handlers/handle-stop.cjs.map +1 -1
- package/dist/runtime/handlers/handle-stop.mjs +2 -1
- package/dist/runtime/handlers/handle-stop.mjs.map +1 -1
- package/dist/runtime/handlers/handle-suggest.cjs +6 -3
- package/dist/runtime/handlers/handle-suggest.cjs.map +1 -1
- package/dist/runtime/handlers/handle-suggest.mjs +6 -2
- package/dist/runtime/handlers/handle-suggest.mjs.map +1 -1
- package/dist/runtime/handlers/handle-trajectory-connect.cjs.map +1 -1
- package/dist/runtime/handlers/handle-trajectory-connect.mjs.map +1 -1
- package/dist/runtime/handlers/handle-transcribe.cjs +0 -1
- package/dist/runtime/handlers/handle-transcribe.cjs.map +1 -1
- package/dist/runtime/handlers/handle-transcribe.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/annotate.cjs +8 -8
- package/dist/runtime/handlers/intelligence/annotate.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/annotate.mjs +5 -4
- package/dist/runtime/handlers/intelligence/annotate.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/connect.cjs +6 -2
- package/dist/runtime/handlers/intelligence/connect.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/connect.mjs +6 -2
- package/dist/runtime/handlers/intelligence/connect.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/memories.cjs +28 -23
- package/dist/runtime/handlers/intelligence/memories.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/memories.mjs +12 -6
- package/dist/runtime/handlers/intelligence/memories.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/run.cjs +38 -30
- package/dist/runtime/handlers/intelligence/run.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/run.mjs +37 -28
- package/dist/runtime/handlers/intelligence/run.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/thread-names.cjs +6 -5
- package/dist/runtime/handlers/intelligence/thread-names.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/thread-names.mjs +3 -1
- package/dist/runtime/handlers/intelligence/thread-names.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/threads.cjs +40 -31
- package/dist/runtime/handlers/intelligence/threads.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/threads.mjs +18 -8
- package/dist/runtime/handlers/intelligence/threads.mjs.map +1 -1
- package/dist/runtime/handlers/shared/agent-utils.cjs +50 -46
- package/dist/runtime/handlers/shared/agent-utils.cjs.map +1 -1
- package/dist/runtime/handlers/shared/agent-utils.mjs +47 -42
- package/dist/runtime/handlers/shared/agent-utils.mjs.map +1 -1
- package/dist/runtime/handlers/shared/cloud-telemetry.cjs +0 -1
- package/dist/runtime/handlers/shared/cloud-telemetry.cjs.map +1 -1
- package/dist/runtime/handlers/shared/memory-policy.cjs.map +1 -1
- package/dist/runtime/handlers/shared/memory-policy.mjs.map +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs +4 -3
- package/dist/runtime/handlers/shared/resolve-intelligence-user.cjs.map +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs +4 -3
- package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -1
- package/dist/runtime/handlers/shared/sse-response.cjs +77 -78
- package/dist/runtime/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/runtime/handlers/shared/sse-response.mjs +77 -77
- package/dist/runtime/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/runtime/handlers/shared/thread-access.cjs +4 -3
- package/dist/runtime/handlers/shared/thread-access.cjs.map +1 -1
- package/dist/runtime/handlers/shared/thread-access.d.cts.map +1 -1
- package/dist/runtime/handlers/shared/thread-access.d.mts.map +1 -1
- package/dist/runtime/handlers/shared/thread-access.mjs +4 -3
- package/dist/runtime/handlers/shared/thread-access.mjs.map +1 -1
- package/dist/runtime/handlers/sse/connect.cjs +2 -0
- package/dist/runtime/handlers/sse/connect.cjs.map +1 -1
- package/dist/runtime/handlers/sse/connect.mjs +2 -0
- package/dist/runtime/handlers/sse/connect.mjs.map +1 -1
- package/dist/runtime/handlers/sse/run.cjs +5 -2
- package/dist/runtime/handlers/sse/run.cjs.map +1 -1
- package/dist/runtime/handlers/sse/run.mjs +5 -2
- package/dist/runtime/handlers/sse/run.mjs.map +1 -1
- package/dist/runtime/index.d.cts +13 -18
- package/dist/runtime/index.d.mts +13 -18
- package/dist/runtime/intelligence-platform/analytics-context.cjs +84 -0
- package/dist/runtime/intelligence-platform/analytics-context.cjs.map +1 -0
- package/dist/runtime/intelligence-platform/analytics-context.mjs +83 -0
- package/dist/runtime/intelligence-platform/analytics-context.mjs.map +1 -0
- package/dist/runtime/intelligence-platform/client.cjs +30 -4
- package/dist/runtime/intelligence-platform/client.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/client.d.cts +25 -2
- package/dist/runtime/intelligence-platform/client.d.cts.map +1 -1
- package/dist/runtime/intelligence-platform/client.d.mts +25 -2
- package/dist/runtime/intelligence-platform/client.d.mts.map +1 -1
- package/dist/runtime/intelligence-platform/client.mjs +30 -3
- package/dist/runtime/intelligence-platform/client.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/learning-management.cjs +7 -8
- package/dist/runtime/intelligence-platform/learning-management.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/learning-management.mjs +7 -7
- package/dist/runtime/intelligence-platform/learning-management.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/archive.cjs +104 -110
- package/dist/runtime/intelligence-platform/skill-registry/archive.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/archive.d.cts +8 -2
- package/dist/runtime/intelligence-platform/skill-registry/archive.d.cts.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/archive.d.mts +8 -2
- package/dist/runtime/intelligence-platform/skill-registry/archive.d.mts.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/archive.mjs +104 -109
- package/dist/runtime/intelligence-platform/skill-registry/archive.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/config.cjs +0 -1
- package/dist/runtime/intelligence-platform/skill-registry/config.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/index.d.cts +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/index.d.mts +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.cjs +22 -19
- package/dist/runtime/intelligence-platform/skill-registry/registry.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.d.cts.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.d.mts.map +1 -1
- package/dist/runtime/intelligence-platform/skill-registry/registry.mjs +22 -19
- package/dist/runtime/intelligence-platform/skill-registry/registry.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/stop-run.cjs +50 -0
- package/dist/runtime/intelligence-platform/stop-run.cjs.map +1 -0
- package/dist/runtime/intelligence-platform/stop-run.mjs +50 -0
- package/dist/runtime/intelligence-platform/stop-run.mjs.map +1 -0
- package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs +3 -3
- package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/thread-lock-heartbeat.mjs +2 -1
- package/dist/runtime/intelligence-platform/thread-lock-heartbeat.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/trajectories.cjs +2 -3
- package/dist/runtime/intelligence-platform/trajectories.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/trajectories.mjs +2 -2
- package/dist/runtime/intelligence-platform/trajectories.mjs.map +1 -1
- package/dist/runtime/node.d.cts +2 -2
- package/dist/runtime/node.d.mts +2 -2
- package/dist/runtime/runner/agent-runner.cjs +0 -1
- package/dist/runtime/runner/agent-runner.cjs.map +1 -1
- package/dist/runtime/runner/agent-runner.d.cts +9 -0
- package/dist/runtime/runner/agent-runner.d.cts.map +1 -1
- package/dist/runtime/runner/agent-runner.d.mts +9 -0
- package/dist/runtime/runner/agent-runner.d.mts.map +1 -1
- package/dist/runtime/runner/agent-runner.mjs.map +1 -1
- package/dist/runtime/runner/in-memory.cjs +0 -1
- package/dist/runtime/runner/in-memory.cjs.map +1 -1
- package/dist/runtime/runner/index.d.cts +1 -1
- package/dist/runtime/runner/index.d.mts +1 -1
- package/dist/runtime/runner/index.mjs +1 -1
- package/dist/runtime/runner/intelligence.cjs +55 -9
- package/dist/runtime/runner/intelligence.cjs.map +1 -1
- package/dist/runtime/runner/intelligence.d.cts +12 -1
- package/dist/runtime/runner/intelligence.d.cts.map +1 -1
- package/dist/runtime/runner/intelligence.d.mts +12 -1
- package/dist/runtime/runner/intelligence.d.mts.map +1 -1
- package/dist/runtime/runner/intelligence.mjs +56 -10
- package/dist/runtime/runner/intelligence.mjs.map +1 -1
- package/dist/runtime/telemetry/disclosure.cjs +2 -3
- package/dist/runtime/telemetry/disclosure.cjs.map +1 -1
- package/dist/runtime/telemetry/disclosure.mjs +3 -3
- package/dist/runtime/telemetry/disclosure.mjs.map +1 -1
- package/dist/runtime/telemetry/events.d.cts +1 -1
- package/dist/runtime/telemetry/events.d.mts +1 -1
- package/dist/runtime/telemetry/instance-created.cjs +33 -12
- package/dist/runtime/telemetry/instance-created.cjs.map +1 -1
- package/dist/runtime/telemetry/instance-created.mjs +33 -12
- package/dist/runtime/telemetry/instance-created.mjs.map +1 -1
- package/dist/runtime/telemetry/telemetry-client.cjs +0 -5
- package/dist/runtime/telemetry/telemetry-client.cjs.map +1 -1
- package/dist/runtime/telemetry/telemetry-client.mjs +0 -4
- package/dist/runtime/telemetry/telemetry-client.mjs.map +1 -1
- package/dist/runtime/telemetry/telemetry-identity.cjs +0 -1
- package/dist/runtime/telemetry/telemetry-identity.cjs.map +1 -1
- package/dist/v2/index.d.cts +242 -0
- package/dist/v2/index.d.mts +242 -0
- package/dist/v2/node.d.cts +18 -0
- package/dist/v2/node.d.mts +18 -0
- package/package.json +84 -29
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/agent/converters/index.d.mts +0 -2
- package/dist/agent/index.cjs +0 -1328
- package/dist/agent/index.cjs.map +0 -1
- package/dist/agent/index.d.cts +0 -467
- package/dist/agent/index.d.cts.map +0 -1
- package/dist/agent/index.d.mts +0 -468
- package/dist/agent/index.d.mts.map +0 -1
- package/dist/agent/index.mjs +0 -1318
- package/dist/agent/index.mjs.map +0 -1
- package/dist/agent/mcp-tool-names.cjs +0 -82
- package/dist/agent/mcp-tool-names.cjs.map +0 -1
- package/dist/agent/mcp-tool-names.mjs +0 -80
- package/dist/agent/mcp-tool-names.mjs.map +0 -1
- package/dist/agent/url-download.cjs.map +0 -1
- package/dist/agent/url-download.d.cts.map +0 -1
- package/dist/agent/url-download.d.mts.map +0 -1
- package/dist/agent/url-download.mjs.map +0 -1
- package/dist/runtime/index.d.cts.map +0 -1
- package/dist/runtime/index.d.mts.map +0 -1
package/dist/agent.d.mts
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { BuiltInAgentLearnedSkills, BuiltInAgentLearnedSkillsOptions } from "./agent/learned-skills.mjs";
|
|
2
|
+
import { isAISDKLanguageModel } from "./agent/model.mjs";
|
|
3
|
+
import { convertAISDKStream } from "./agent/converters/aisdk.mjs";
|
|
4
|
+
import { TanStackChatMessage, TanStackInputOptions, TanStackInputResult, convertInputToTanStackAI, convertTanStackStream } from "./agent/converters/tanstack.mjs";
|
|
5
|
+
import { InferSchemaOutput, ModelHostClass, StandardSchemaV1 } from "@copilotkit/shared";
|
|
6
|
+
import { Observable } from "rxjs";
|
|
7
|
+
import { AbstractAgent, BaseEvent, Interrupt, ResumeEntry, RunAgentInput } from "@ag-ui/client";
|
|
8
|
+
import { AnyTextAdapter, ChatMCPOptions, SystemPrompt } from "@tanstack/ai";
|
|
9
|
+
import { AgentCapabilities } from "@ag-ui/core";
|
|
10
|
+
import { TextActivityOptions } from "@tanstack/ai/adapters";
|
|
11
|
+
|
|
12
|
+
//#region src/agent/index.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* Properties that a run's `forwardedProps` can override, when the agent lists
|
|
15
|
+
* them in `overridableProperties`:
|
|
16
|
+
*
|
|
17
|
+
* - `model`: a model name, such as `"fast"`. The agent's `resolveModel`
|
|
18
|
+
* turns it into an adapter.
|
|
19
|
+
* - `toolChoice`: `"auto"`, `"none"`, `"required"`, or
|
|
20
|
+
* `{ type: "tool", name }`.
|
|
21
|
+
* - `prompt`: the agent's prompt, as a string.
|
|
22
|
+
* - `modelOptions`: replaces the configured `modelOptions` object.
|
|
23
|
+
*/
|
|
24
|
+
type OverridableProperty = "model" | "toolChoice" | "prompt" | "modelOptions";
|
|
25
|
+
/**
|
|
26
|
+
* Thrown by `AgentFactoryContext.interrupt()` on a fresh (non-resume) run to
|
|
27
|
+
* pause the factory. Caught in `runFactory` and translated into a RUN_FINISHED
|
|
28
|
+
* event carrying `outcome:{type:"interrupt",interrupts}`. Not a real error.
|
|
29
|
+
*/
|
|
30
|
+
declare class InterruptSignal extends Error {
|
|
31
|
+
readonly interrupts: Interrupt[];
|
|
32
|
+
constructor(interrupts: Interrupt[]);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The CopilotKit settings of a `defineTool()` tool. They live in the tool's
|
|
36
|
+
* `metadata.copilotkit`, which TanStack AI passes through without reading.
|
|
37
|
+
*/
|
|
38
|
+
type CopilotKitToolSettings = {
|
|
39
|
+
/**
|
|
40
|
+
* When true, calling this tool pauses the run and emits a standard AG-UI
|
|
41
|
+
* interrupt (RUN_FINISHED outcome:interrupt) keyed by the tool call's id.
|
|
42
|
+
* The human response (resume payload) is injected as this tool call's result
|
|
43
|
+
* on the resume run. Interrupt tools must NOT define `execute`: a tool call
|
|
44
|
+
* with no executor ends the run, even with a multi-step limit.
|
|
45
|
+
*/
|
|
46
|
+
interrupt?: boolean; /** Optional categorical reason surfaced on the Interrupt (default: "tool_call"). */
|
|
47
|
+
interruptReason?: string; /** Optional human-readable prompt surfaced on the Interrupt. */
|
|
48
|
+
interruptMessage?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* A tool made with `defineTool()`. It is a TanStack AI server tool as a plain
|
|
52
|
+
* object, so it works in the BuiltInAgent `tools`, in your own `chat()` call,
|
|
53
|
+
* and in a `type: "tanstack"` factory.
|
|
54
|
+
*
|
|
55
|
+
* - `inputSchema` is the JSON Schema of the tool's parameters.
|
|
56
|
+
* - `execute` validates its arguments with the parameters schema first, then
|
|
57
|
+
* calls your `execute` with the parsed output.
|
|
58
|
+
* - `metadata.copilotkit` holds the interrupt settings.
|
|
59
|
+
*/
|
|
60
|
+
type ToolDefinition<TParameters extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
61
|
+
__toolSide: "server";
|
|
62
|
+
name: string;
|
|
63
|
+
description: string;
|
|
64
|
+
inputSchema: Record<string, unknown>;
|
|
65
|
+
/**
|
|
66
|
+
* Server-side executor. Not set for interrupt tools, which pause the run
|
|
67
|
+
* instead of executing.
|
|
68
|
+
*/
|
|
69
|
+
execute?: (args: StandardSchemaV1.InferInput<TParameters>) => Promise<unknown>;
|
|
70
|
+
metadata: {
|
|
71
|
+
copilotkit: CopilotKitToolSettings;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Defines a server tool for BuiltInAgent, or for any TanStack AI `chat()`
|
|
76
|
+
* call.
|
|
77
|
+
*
|
|
78
|
+
* The parameters become the tool's JSON Schema, which the model sees. Before
|
|
79
|
+
* `execute` runs, the arguments go through the schema's own Standard Schema
|
|
80
|
+
* validation, so `execute` gets the parsed output (for example with Zod
|
|
81
|
+
* defaults applied). Arguments that fail the schema, and errors that `execute`
|
|
82
|
+
* throws, become the tool's error result.
|
|
83
|
+
*
|
|
84
|
+
* A tool without `execute` (an interrupt tool) has no executor, so `chat()`
|
|
85
|
+
* stops the run when the model calls it.
|
|
86
|
+
*
|
|
87
|
+
* @param config.name - The name of the tool.
|
|
88
|
+
* @param config.description - What the tool does, for the model.
|
|
89
|
+
* @param config.parameters - Schema for the tool's input parameters (any
|
|
90
|
+
* Standard Schema V1 library that can describe itself as JSON Schema: Zod,
|
|
91
|
+
* Valibot, ArkType, etc.).
|
|
92
|
+
* @param config.execute - Runs the tool server-side with the parsed arguments.
|
|
93
|
+
* @param config.interrupt - Pause the run for human input instead of
|
|
94
|
+
* executing. See {@link CopilotKitToolSettings}.
|
|
95
|
+
* @throws Error when the parameters schema cannot describe itself as JSON
|
|
96
|
+
* Schema.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* const weather = defineTool({
|
|
100
|
+
* name: "get_weather",
|
|
101
|
+
* description: "Get the weather for a city.",
|
|
102
|
+
* parameters: z.object({ city: z.string() }),
|
|
103
|
+
* execute: async ({ city }) => ({ city, temperature: 21 }),
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
declare function defineTool<TParameters extends StandardSchemaV1>(config: {
|
|
108
|
+
name: string;
|
|
109
|
+
description: string;
|
|
110
|
+
parameters: TParameters;
|
|
111
|
+
execute?: (args: InferSchemaOutput<TParameters>) => Promise<unknown>;
|
|
112
|
+
} & CopilotKitToolSettings): ToolDefinition<TParameters>;
|
|
113
|
+
/**
|
|
114
|
+
* Context passed to the user-supplied factory function in factory mode.
|
|
115
|
+
*/
|
|
116
|
+
interface AgentFactoryContext {
|
|
117
|
+
/**
|
|
118
|
+
* Verified skill catalog and TanStack AI server tools for this run; empty
|
|
119
|
+
* when disabled or no skills exist. Pass the tools to TanStack `chat()` as
|
|
120
|
+
* they are. For `streamText()`, convert them with `toAISDKTools` from
|
|
121
|
+
* `@copilotkit/runtime/agent/ai-sdk`.
|
|
122
|
+
*/
|
|
123
|
+
learnedSkills: BuiltInAgentLearnedSkills;
|
|
124
|
+
input: RunAgentInput;
|
|
125
|
+
/**
|
|
126
|
+
* Prefer `abortSignal` for most use cases (AI SDK, fetch, custom backends).
|
|
127
|
+
* Provided for backends like TanStack AI that require the full AbortController.
|
|
128
|
+
* Do NOT call `.abort()` on this controller — use `abortRun()` on the agent instead.
|
|
129
|
+
*/
|
|
130
|
+
abortController: AbortController;
|
|
131
|
+
abortSignal: AbortSignal;
|
|
132
|
+
/**
|
|
133
|
+
* Pause the run for human input (AG-UI standard interrupt). On a fresh run
|
|
134
|
+
* this throws an InterruptSignal (caught by the runtime) and the run finishes
|
|
135
|
+
* with `outcome:{type:"interrupt",interrupts}`. On the resume run (when
|
|
136
|
+
* `input.resume` covers these interrupts) it returns the matching ResumeEntry
|
|
137
|
+
* responses so the factory can continue. Each `interrupts[i].id` is matched to
|
|
138
|
+
* `input.resume[].interruptId`.
|
|
139
|
+
*/
|
|
140
|
+
interrupt: (interrupts: Interrupt[]) => Promise<ResumeEntry[]>;
|
|
141
|
+
}
|
|
142
|
+
/** Public name that avoids the runtime's request-scoped AgentFactoryContext. */
|
|
143
|
+
type BuiltInAgentFactoryContext = AgentFactoryContext;
|
|
144
|
+
/**
|
|
145
|
+
* Factory config for AI SDK backend.
|
|
146
|
+
* The factory must return an object with a `fullStream` async iterable
|
|
147
|
+
* (compatible with the result of `streamText()` — only `fullStream` is consumed).
|
|
148
|
+
*
|
|
149
|
+
* `@copilotkit/runtime/agent/ai-sdk` has the helpers for the `streamText()`
|
|
150
|
+
* call you own:
|
|
151
|
+
*
|
|
152
|
+
* - `convertMessagesToVercelAISDKMessages` and `convertToolsToVercelAITools`
|
|
153
|
+
* turn `ctx.input` into AI SDK messages and tools.
|
|
154
|
+
* - `toAISDKTools` turns `ctx.learnedSkills.tools` into an AI SDK `ToolSet`.
|
|
155
|
+
* - `createSafeUrlDownload({ signal: ctx.abortSignal })`, passed as
|
|
156
|
+
* `experimental_download`, keeps the server from fetching internal
|
|
157
|
+
* addresses named in request attachments, and stops the downloads when the
|
|
158
|
+
* run is aborted.
|
|
159
|
+
*/
|
|
160
|
+
interface BuiltInAgentAISDKFactoryConfig {
|
|
161
|
+
/** Opt in to automatic snapshot acquisition before each run, including resumes. */
|
|
162
|
+
learnedSkills?: BuiltInAgentLearnedSkillsOptions;
|
|
163
|
+
type: "aisdk";
|
|
164
|
+
factory: (ctx: AgentFactoryContext) => {
|
|
165
|
+
fullStream: AsyncIterable<unknown>;
|
|
166
|
+
} | Promise<{
|
|
167
|
+
fullStream: AsyncIterable<unknown>;
|
|
168
|
+
}>;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Factory config for TanStack AI backend.
|
|
172
|
+
* The factory must return an async iterable of TanStack AI stream chunks.
|
|
173
|
+
*/
|
|
174
|
+
interface BuiltInAgentTanStackFactoryConfig {
|
|
175
|
+
/** Opt in to automatic snapshot acquisition before each run, including resumes. */
|
|
176
|
+
learnedSkills?: BuiltInAgentLearnedSkillsOptions;
|
|
177
|
+
type: "tanstack";
|
|
178
|
+
factory: (ctx: AgentFactoryContext) => AsyncIterable<unknown> | Promise<AsyncIterable<unknown>>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Factory config for a custom backend that directly yields AG-UI events.
|
|
182
|
+
*/
|
|
183
|
+
interface BuiltInAgentCustomFactoryConfig {
|
|
184
|
+
/** Opt in to automatic snapshot acquisition before each run, including resumes. */
|
|
185
|
+
learnedSkills?: BuiltInAgentLearnedSkillsOptions;
|
|
186
|
+
type: "custom";
|
|
187
|
+
factory: (ctx: AgentFactoryContext) => AsyncIterable<BaseEvent> | Promise<AsyncIterable<BaseEvent>>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Union of all factory-mode configurations.
|
|
191
|
+
*/
|
|
192
|
+
type BuiltInAgentFactoryConfig = BuiltInAgentAISDKFactoryConfig | BuiltInAgentTanStackFactoryConfig | BuiltInAgentCustomFactoryConfig;
|
|
193
|
+
/**
|
|
194
|
+
* The TanStack AI `chat()` options for a text adapter, as `chat()` types them
|
|
195
|
+
* for a streamed run without an output schema.
|
|
196
|
+
*/
|
|
197
|
+
type ChatOptionsFor<TAdapter extends AnyTextAdapter, TContext> = TextActivityOptions<TAdapter, undefined, true, TContext>;
|
|
198
|
+
/**
|
|
199
|
+
* The TanStack AI `chat()` options that BuiltInAgent's classic config takes
|
|
200
|
+
* next to `model`. Their types come from the adapter in `model`, the same way
|
|
201
|
+
* `chat({ adapter, ... })` types them:
|
|
202
|
+
*
|
|
203
|
+
* - `modelOptions`: the provider options of the adapter.
|
|
204
|
+
* - `reasoning`: only the levels the model has.
|
|
205
|
+
* - `tools`: server tools (`defineTool()`, `toolDefinition().server()`) and
|
|
206
|
+
* the provider tools that the model supports, such as `webSearchTool` from
|
|
207
|
+
* `@tanstack/ai-openai/tools`.
|
|
208
|
+
* - `systemPrompts`: strings, or `{ content, metadata }` with the metadata
|
|
209
|
+
* the adapter accepts.
|
|
210
|
+
* - `middleware` and `context`: the hooks get the type of `context` as
|
|
211
|
+
* `ctx.context`.
|
|
212
|
+
*
|
|
213
|
+
* The agent passes these to `chat()` on each run. See the TanStack AI docs of
|
|
214
|
+
* `chat()` for each option.
|
|
215
|
+
*/
|
|
216
|
+
type BuiltInAgentChatOptions<TAdapter extends AnyTextAdapter = AnyTextAdapter, TContext = unknown> = Pick<ChatOptionsFor<TAdapter, TContext>, "promptCache" | "retry" | "wrapFetch" | "middleware" | "context" | "toolExecution" | "lazyToolsConfig" | "metadata" | "debug" | "agentLoopStrategy" | "repairToolInput" | "modelOptions" | "toolChoice" | "tools"> & {
|
|
217
|
+
/**
|
|
218
|
+
* How hard the model thinks: a level, or `{ level, summary?,
|
|
219
|
+
* budgetTokens? }`. Only the levels the model has are accepted. A model
|
|
220
|
+
* that does not reason takes no `reasoning`.
|
|
221
|
+
*/
|
|
222
|
+
reasoning?: NeverAsUndefined<ChatOptionsFor<TAdapter, TContext>["reasoning"]>;
|
|
223
|
+
/**
|
|
224
|
+
* More system prompts, after `prompt`: strings, or `{ content, metadata }`
|
|
225
|
+
* with the metadata the adapter accepts (for example Anthropic
|
|
226
|
+
* `cache_control`). An adapter without system prompt metadata takes
|
|
227
|
+
* strings and `{ content }` only.
|
|
228
|
+
*/
|
|
229
|
+
systemPrompts?: Array<SystemPrompt<NeverAsUndefined<TAdapter["~types"]["systemPromptMetadata"]>>>;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* `undefined` in place of `never`. TanStack AI types an option `never` when
|
|
233
|
+
* the model does not support it (`reasoning` on a model that does not
|
|
234
|
+
* reason, system prompt `metadata` on an adapter without any). As `undefined`,
|
|
235
|
+
* the option still takes no value, and a config written for any adapter can
|
|
236
|
+
* be spread into a config for such a model.
|
|
237
|
+
*/
|
|
238
|
+
type NeverAsUndefined<T> = [T] extends [never] ? undefined : T;
|
|
239
|
+
/**
|
|
240
|
+
* A model that `resolveModel` picked for one run, with the options for it:
|
|
241
|
+
*
|
|
242
|
+
* - `adapter`: the TanStack AI text adapter.
|
|
243
|
+
* - `modelOptions`: replaces the configured `modelOptions` for this run.
|
|
244
|
+
* - `reasoning`: replaces the configured `reasoning` for this run.
|
|
245
|
+
*
|
|
246
|
+
* TanStack AI's `createChatOptions({ adapter, modelOptions, reasoning })`
|
|
247
|
+
* returns this shape, typed by that adapter.
|
|
248
|
+
*/
|
|
249
|
+
type ResolvedModelOptions = Pick<ChatOptionsFor<AnyTextAdapter, unknown>, "adapter" | "modelOptions" | "reasoning">;
|
|
250
|
+
/**
|
|
251
|
+
* Classic config: BuiltInAgent runs the model with TanStack AI `chat()` and
|
|
252
|
+
* handles tools, MCP, state tools, and the system prompt.
|
|
253
|
+
*
|
|
254
|
+
* The runtime installs `@tanstack/ai`. Install the adapter package for your
|
|
255
|
+
* provider, for example `@tanstack/ai-openai`.
|
|
256
|
+
*
|
|
257
|
+
* Next to the CopilotKit settings below, it takes the `chat()` options in
|
|
258
|
+
* {@link BuiltInAgentChatOptions}, typed by the adapter in `model`:
|
|
259
|
+
*
|
|
260
|
+
* ```ts
|
|
261
|
+
* new BuiltInAgent({
|
|
262
|
+
* model: openaiText("gpt-5.2"),
|
|
263
|
+
* reasoning: { level: "high", summary: true },
|
|
264
|
+
* modelOptions: { text: { verbosity: "low" } },
|
|
265
|
+
* tools: [refund, webSearchTool({ type: "web_search" })],
|
|
266
|
+
* retry: { maxRetries: 3 },
|
|
267
|
+
* });
|
|
268
|
+
* ```
|
|
269
|
+
*
|
|
270
|
+
* The agent sets the run's `messages`, `threadId`, `abortController`, and
|
|
271
|
+
* `stream` itself, so the config has no such keys.
|
|
272
|
+
*
|
|
273
|
+
* @typeParam TAdapter - The adapter type, inferred from `model`.
|
|
274
|
+
* @typeParam TContext - The type of `context`, inferred from it. The
|
|
275
|
+
* `middleware` hooks get it as `ctx.context`.
|
|
276
|
+
*/
|
|
277
|
+
interface BuiltInAgentClassicConfig<TAdapter extends AnyTextAdapter = AnyTextAdapter, TContext = unknown> extends BuiltInAgentChatOptions<TAdapter, TContext> {
|
|
278
|
+
/** Opt in to automatic snapshot acquisition before each run, including resumes. */
|
|
279
|
+
learnedSkills?: BuiltInAgentLearnedSkillsOptions;
|
|
280
|
+
/**
|
|
281
|
+
* The model, as a TanStack AI text adapter, for example
|
|
282
|
+
* `openaiText("gpt-5")` from `@tanstack/ai-openai`. The adapter holds its
|
|
283
|
+
* own API key and base URL.
|
|
284
|
+
*/
|
|
285
|
+
model: TAdapter;
|
|
286
|
+
/**
|
|
287
|
+
* Turns a forwarded model name into a model, when `"model"` is in
|
|
288
|
+
* `overridableProperties`. It returns one of these:
|
|
289
|
+
*
|
|
290
|
+
* - An adapter. The run uses the configured `modelOptions` and
|
|
291
|
+
* `reasoning` with it.
|
|
292
|
+
* - `{ adapter, modelOptions?, reasoning? }`. Its `modelOptions` and
|
|
293
|
+
* `reasoning` replace the configured ones for this run. Build it with
|
|
294
|
+
* TanStack AI's `createChatOptions()` to type the options by that
|
|
295
|
+
* adapter.
|
|
296
|
+
* - `undefined`, for a name you do not accept. The run then uses `model`.
|
|
297
|
+
*
|
|
298
|
+
* The configured `tools`, provider tools included, do not change.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```ts
|
|
302
|
+
* new BuiltInAgent({
|
|
303
|
+
* model: openaiText("gpt-5"),
|
|
304
|
+
* overridableProperties: ["model"],
|
|
305
|
+
* resolveModel: (name) =>
|
|
306
|
+
* name === "deep"
|
|
307
|
+
* ? createChatOptions({
|
|
308
|
+
* adapter: openaiText("gpt-5.2"),
|
|
309
|
+
* reasoning: "high",
|
|
310
|
+
* modelOptions: { text: { verbosity: "low" } },
|
|
311
|
+
* })
|
|
312
|
+
* : undefined,
|
|
313
|
+
* });
|
|
314
|
+
* ```
|
|
315
|
+
*/
|
|
316
|
+
resolveModel?: (name: string) => AnyTextAdapter | ResolvedModelOptions | undefined;
|
|
317
|
+
/**
|
|
318
|
+
* Maximum number of model calls in one run. Tools that the last call asks
|
|
319
|
+
* for still run. Default: 1, or 10 when learned skills are available.
|
|
320
|
+
* `agentLoopStrategy`, when set, is used instead.
|
|
321
|
+
*/
|
|
322
|
+
maxSteps?: number;
|
|
323
|
+
/**
|
|
324
|
+
* The agent's system prompt. The frontend can replace it when `"prompt"`
|
|
325
|
+
* is in `overridableProperties`. It goes after the learned-skills catalog
|
|
326
|
+
* and before `systemPrompts`.
|
|
327
|
+
*/
|
|
328
|
+
prompt?: string;
|
|
329
|
+
/**
|
|
330
|
+
* List of properties that can be overridden by forwardedProps.
|
|
331
|
+
*/
|
|
332
|
+
overridableProperties?: OverridableProperty[];
|
|
333
|
+
/**
|
|
334
|
+
* MCP servers whose tools the agent offers to the model, as TanStack AI's
|
|
335
|
+
* `chat()` `mcp` option. On each run, `chat()` reads the tools of each
|
|
336
|
+
* client in `clients`.
|
|
337
|
+
*
|
|
338
|
+
* - `connection`: the agent sets `"keep-alive"` unless you set it. The
|
|
339
|
+
* clients in the config are used by every run, so the agent does not
|
|
340
|
+
* close them. Close them yourself when your server shuts down. With
|
|
341
|
+
* `"close"`, `chat()` closes them when the first run ends.
|
|
342
|
+
* - `lazyTools`: read the tool schemas only when the model needs them.
|
|
343
|
+
* - `onDiscoveryError`: called when one client fails to list its tools.
|
|
344
|
+
* Return to skip that client, or throw to fail the run. Without it, the
|
|
345
|
+
* error fails the run.
|
|
346
|
+
*
|
|
347
|
+
* Tool names must be unique. If two MCP servers have a tool with the same
|
|
348
|
+
* name, or an MCP tool has the name of an app or frontend tool, the run
|
|
349
|
+
* fails. Give a client a `prefix` to keep its tool names apart.
|
|
350
|
+
*
|
|
351
|
+
* ```typescript
|
|
352
|
+
* import { createMCPClient } from "@tanstack/ai-mcp";
|
|
353
|
+
*
|
|
354
|
+
* const client = await createMCPClient({
|
|
355
|
+
* transport: { type: "http", url: "https://mcp.example.com/mcp" },
|
|
356
|
+
* });
|
|
357
|
+
* const agent = new BuiltInAgent({
|
|
358
|
+
* model: openaiText("gpt-5"),
|
|
359
|
+
* mcp: { clients: [client] },
|
|
360
|
+
* });
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
mcp?: ChatMCPOptions;
|
|
364
|
+
/**
|
|
365
|
+
* Forward system-role messages from input to the LLM, as system prompts.
|
|
366
|
+
* Default: false
|
|
367
|
+
*/
|
|
368
|
+
forwardSystemMessages?: boolean;
|
|
369
|
+
/**
|
|
370
|
+
* Forward developer-role messages from input to the LLM, as system prompts.
|
|
371
|
+
* Default: false
|
|
372
|
+
*/
|
|
373
|
+
forwardDeveloperMessages?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Explicit agent capabilities. **Shallow-merged** at the category level on
|
|
376
|
+
* top of auto-inferred defaults — providing a category (e.g. `tools`)
|
|
377
|
+
* replaces that entire category, not individual fields within it.
|
|
378
|
+
*
|
|
379
|
+
* For example, `{ tools: { supported: true } }` will drop the inferred
|
|
380
|
+
* `clientProvided` value. Include all fields for any category you override.
|
|
381
|
+
*/
|
|
382
|
+
capabilities?: Partial<AgentCapabilities>;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Configuration for BuiltInAgent.
|
|
386
|
+
*
|
|
387
|
+
* Two modes:
|
|
388
|
+
* - **Classic** (model + params): BuiltInAgent handles everything — the TanStack AI `chat()` call, tools, MCP, state tools.
|
|
389
|
+
* - **Factory** (type + factory): You own the LLM call. BuiltInAgent handles lifecycle only.
|
|
390
|
+
*/
|
|
391
|
+
type BuiltInAgentConfiguration<TAdapter extends AnyTextAdapter = AnyTextAdapter, TContext = unknown> = BuiltInAgentClassicConfig<TAdapter, TContext> | BuiltInAgentFactoryConfig;
|
|
392
|
+
/**
|
|
393
|
+
* An AG-UI agent that runs a model with TanStack AI `chat()` (classic config),
|
|
394
|
+
* or runs your own LLM call (factory config).
|
|
395
|
+
*
|
|
396
|
+
* @typeParam TAdapter - The adapter type of a classic config, inferred from
|
|
397
|
+
* `model`. It types the `chat()` options of the config.
|
|
398
|
+
* @typeParam TContext - The type of the classic config's `context`, inferred
|
|
399
|
+
* from it.
|
|
400
|
+
*
|
|
401
|
+
* ```ts
|
|
402
|
+
* const agent = new BuiltInAgent({
|
|
403
|
+
* model: openaiText("gpt-5.2"),
|
|
404
|
+
* prompt: "You are a helpful assistant.",
|
|
405
|
+
* reasoning: "low",
|
|
406
|
+
* });
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
declare class BuiltInAgent<TAdapter extends AnyTextAdapter = AnyTextAdapter, TContext = unknown> extends AbstractAgent {
|
|
410
|
+
private config;
|
|
411
|
+
private abortController?;
|
|
412
|
+
private skillRegistry?;
|
|
413
|
+
/** Whether this agent already warned about an unresolved model override. */
|
|
414
|
+
private warnedUnresolvedModel;
|
|
415
|
+
/**
|
|
416
|
+
* Which vendor this agent's model reaches, read by the SSE layer onto
|
|
417
|
+
* `agent_execution_stream_*` telemetry. Always `"unknown"`: a TanStack AI
|
|
418
|
+
* adapter keeps its base URL private, and a factory config owns its own
|
|
419
|
+
* LLM call.
|
|
420
|
+
*/
|
|
421
|
+
readonly modelHostClass: ModelHostClass;
|
|
422
|
+
/**
|
|
423
|
+
* @throws Error when a classic config's `model` is a model string or an AI
|
|
424
|
+
* SDK model object. Pass a TanStack AI text adapter, or run AI SDK models
|
|
425
|
+
* with a `type: "aisdk"` factory.
|
|
426
|
+
*/
|
|
427
|
+
constructor(config: BuiltInAgentConfiguration<TAdapter, TContext>);
|
|
428
|
+
/**
|
|
429
|
+
* Check if a property can be overridden by forwardedProps
|
|
430
|
+
*/
|
|
431
|
+
canOverride(property: OverridableProperty): boolean;
|
|
432
|
+
/**
|
|
433
|
+
* The `forwardedProps` values this run may use, one per property in
|
|
434
|
+
* `overridableProperties`. A value of the wrong shape is ignored.
|
|
435
|
+
*/
|
|
436
|
+
private forwardedOverrides;
|
|
437
|
+
/**
|
|
438
|
+
* The model for this run: the forwarded model name through `resolveModel`,
|
|
439
|
+
* else the configured `model`. Returns the adapter with the `modelOptions`
|
|
440
|
+
* and `reasoning` to use with it. An override that does not resolve logs
|
|
441
|
+
* one warning per agent.
|
|
442
|
+
*
|
|
443
|
+
* @throws Error when `resolveModel` returns a model string or an AI SDK
|
|
444
|
+
* model object.
|
|
445
|
+
*/
|
|
446
|
+
private modelFor;
|
|
447
|
+
getCapabilities(): Promise<AgentCapabilities>;
|
|
448
|
+
run(input: RunAgentInput): Observable<BaseEvent>;
|
|
449
|
+
private runFactory;
|
|
450
|
+
clone(): BuiltInAgent<TAdapter, TContext>;
|
|
451
|
+
abortRun(): void;
|
|
452
|
+
}
|
|
453
|
+
//#endregion
|
|
454
|
+
export { AgentFactoryContext, BuiltInAgent, BuiltInAgentAISDKFactoryConfig, BuiltInAgentChatOptions, BuiltInAgentClassicConfig, BuiltInAgentConfiguration, BuiltInAgentCustomFactoryConfig, BuiltInAgentFactoryConfig, BuiltInAgentFactoryContext, type BuiltInAgentLearnedSkills, type BuiltInAgentLearnedSkillsOptions, BuiltInAgentTanStackFactoryConfig, CopilotKitToolSettings, InterruptSignal, OverridableProperty, ResolvedModelOptions, type TanStackChatMessage, type TanStackInputOptions, type TanStackInputResult, ToolDefinition, convertAISDKStream, convertInputToTanStackAI, convertTanStackStream, defineTool, isAISDKLanguageModel };
|
|
455
|
+
//# sourceMappingURL=agent.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.mts","names":[],"sources":["../src/agent/index.ts"],"mappings":"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"}
|