@copilotkit/runtime 2.0.0-rc.5 → 2.0.0-rc.51
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 +27 -27
- package/dist/index.d.cts +15 -15
- package/dist/index.d.mts +15 -15
- package/dist/index.mjs +9 -8
- package/dist/internal/learned-skills.d.cts +1 -1
- package/dist/internal/learned-skills.d.mts +1 -1
- package/dist/node.cjs +3 -2
- 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 +24 -13
- package/dist/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/runtime/core/fetch-handler.d.cts +35 -14
- package/dist/runtime/core/fetch-handler.d.cts.map +1 -1
- package/dist/runtime/core/fetch-handler.d.mts +35 -14
- package/dist/runtime/core/fetch-handler.d.mts.map +1 -1
- package/dist/runtime/core/fetch-handler.mjs +16 -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 +29 -46
- package/dist/runtime/core/runtime.cjs.map +1 -1
- package/dist/runtime/core/runtime.d.cts +157 -91
- package/dist/runtime/core/runtime.d.cts.map +1 -1
- package/dist/runtime/core/runtime.d.mts +157 -91
- package/dist/runtime/core/runtime.d.mts.map +1 -1
- package/dist/runtime/core/runtime.mjs +27 -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 +11 -7
- package/dist/runtime/endpoints/node-fetch-handler.cjs.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.d.cts +9 -5
- package/dist/runtime/endpoints/node-fetch-handler.d.cts.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.d.mts +9 -5
- package/dist/runtime/endpoints/node-fetch-handler.d.mts.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.mjs +10 -5
- package/dist/runtime/endpoints/node-fetch-handler.mjs.map +1 -1
- package/dist/runtime/endpoints/node.cjs +14 -4
- package/dist/runtime/endpoints/node.cjs.map +1 -1
- package/dist/runtime/endpoints/node.d.cts +39 -16
- package/dist/runtime/endpoints/node.d.cts.map +1 -1
- package/dist/runtime/endpoints/node.d.mts +39 -16
- package/dist/runtime/endpoints/node.d.mts.map +1 -1
- package/dist/runtime/endpoints/node.mjs +16 -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.cjs +29 -0
- package/dist/runtime/index.cjs.map +1 -0
- package/dist/runtime/index.d.cts +61 -15
- package/dist/runtime/index.d.cts.map +1 -1
- package/dist/runtime/index.d.mts +61 -15
- package/dist/runtime/index.d.mts.map +1 -1
- package/dist/runtime/index.mjs +27 -0
- package/dist/runtime/index.mjs.map +1 -0
- 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/package.json +54 -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.mts
CHANGED
|
@@ -1,29 +1,75 @@
|
|
|
1
|
+
import { experimental_d_exports } from "./intelligence-platform/experimental.mjs";
|
|
1
2
|
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, LocalThreadEndpointRecord, LocalThreadEndpointRunner, LocalThreadEndpointScope, THREAD_ACCESS_DENIED_ERROR_CODE, ThreadAccessDeniedError, ThreadAlreadyRunningError, ThreadOwnershipRunner, enforcesThreadOwnership, isThreadAccessDeniedError, supportsLocalThreadEndpoints, ɵSERVER_THREAD_OWNER, ɵresolveThreadOwner } from "./runner/agent-runner.mjs";
|
|
2
3
|
import { ThreadAccessMode, ThreadsConfig } from "./handlers/shared/thread-access.mjs";
|
|
4
|
+
import { CopilotKitRuntimeLogger } from "./core/logger.mjs";
|
|
3
5
|
import { TranscribeFileOptions, TranscriptionService } from "./transcription-service/transcription-service.mjs";
|
|
4
|
-
import { experimental_d_exports } from "./intelligence-platform/experimental.mjs";
|
|
5
|
-
import { CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeUser, GetLearningContainerId, GetTrajectoryLearningContainerIds, LearningContainerSelectorInput, TrajectoryLearningContainerSelectorInput } from "./core/learning.mjs";
|
|
6
6
|
import { GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult } from "./intelligence-platform/learned-skills.mjs";
|
|
7
|
-
import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, PlatformRequestError, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./intelligence-platform/client.mjs";
|
|
8
7
|
import "./intelligence-platform/index.mjs";
|
|
9
|
-
import { AgentFactoryContext, AgentsConfig, AgentsFactory,
|
|
8
|
+
import { A2UIVersion, AgentFactoryContext, AgentsConfig, AgentsFactory, CopilotKitIntelligenceRuntime, CopilotKitIntelligenceRuntimeLike, CopilotKitIntelligenceRuntimeOptions, CopilotKitRuntime, CopilotKitRuntimeConstructor, CopilotKitRuntimeLike, CopilotKitRuntimeMemoryConfig, CopilotKitRuntimeOptions, CopilotKitSseRuntime, CopilotKitSseRuntimeLike, CopilotKitSseRuntimeOptions, GenerativeUIOptions, IdentifyUserCallback, McpAppsConfig, McpAppsServerConfig, MemoryAccess, MemoryConsumer, MemoryGrant, OpenGenerativeUIConfig, OpenGenerativeUIOptions, RuntimeWithDeclaredChannels, VERSION, isIntelligenceRuntime, resolveAgents } from "./core/runtime.mjs";
|
|
9
|
+
import { CopilotKitRuntimeLearningConfig, CopilotKitRuntimeLearningContext, CopilotKitRuntimeUser, GetLearningContainerId, GetTrajectoryLearningContainerIds, LearningContainerSelectorInput, TrajectoryLearningContainerSelectorInput } from "./core/learning.mjs";
|
|
10
|
+
import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, PlatformRequestError, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./intelligence-platform/client.mjs";
|
|
11
|
+
import { ChannelStatus, ChannelsControl } from "./core/channel-manager.mjs";
|
|
12
|
+
import { CopilotKitRuntimeHooks, ErrorHookContext, HandlerHookContext, HookContext, ResponseHookContext, RouteInfo } from "./core/hooks.mjs";
|
|
13
|
+
import { CopilotKitCorsConfig } from "./core/fetch-cors.mjs";
|
|
14
|
+
import { CopilotKitRuntimeFetchHandler, CopilotKitRuntimeFetchHandlerWithChannels, CopilotKitRuntimeHandlerOptions, createCopilotKitRuntimeHandler, createCopilotRuntimeHandler } from "./core/fetch-handler.mjs";
|
|
10
15
|
import { GenerativeUIMiddleware } from "./generative-ui/generative-ui-middleware.mjs";
|
|
16
|
+
import { A2UIV09BridgeMiddleware } from "./generative-ui/a2ui-v09-middleware.mjs";
|
|
11
17
|
import { GenerativeUISurfaceWriter, createSurfaceWriter } from "./generative-ui/surface-writer.mjs";
|
|
12
18
|
import "./generative-ui/index.mjs";
|
|
19
|
+
import { ArgsParser, GenerateSandboxedUIParams, OnParamEvent, OpenGenerativeUIMiddleware } from "./event-transforms/open-generative-ui-middleware.mjs";
|
|
20
|
+
import { RecordedEventTransformOptions, transformRecordedEvents } from "./event-transforms/recorded-events.mjs";
|
|
21
|
+
import { A2UIMiddleware, A2UIMiddlewareConfig } from "./event-transforms/index.mjs";
|
|
13
22
|
import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵestimateBytes, ɵnormalizeLimits } from "./runner/in-memory.mjs";
|
|
14
|
-
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary } from "./runner/intelligence.mjs";
|
|
23
|
+
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary, STOP_RECORD_DEADLINE_MS } from "./runner/intelligence.mjs";
|
|
15
24
|
import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./runner/index.mjs";
|
|
16
|
-
import { ChannelStatus, ChannelsControl } from "./core/channel-manager.mjs";
|
|
17
|
-
import { CopilotRuntimeHooks, ErrorHookContext, HandlerHookContext, HookContext, ResponseHookContext, RouteInfo } from "./core/hooks.mjs";
|
|
18
|
-
import { CopilotCorsConfig } from "./core/fetch-cors.mjs";
|
|
19
|
-
import { CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, createCopilotRuntimeHandler } from "./core/fetch-handler.mjs";
|
|
20
|
-
import { MCPClient, MCPTransport } from "@ai-sdk/mcp";
|
|
21
25
|
|
|
22
26
|
//#region src/runtime/index.d.ts
|
|
23
|
-
/** @deprecated Use
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
/** @deprecated Use CopilotKitRuntime. This old name is an alias with the same behavior. */
|
|
28
|
+
declare const CopilotRuntime: CopilotKitRuntimeConstructor;
|
|
29
|
+
/** @deprecated Use CopilotKitRuntime. This old name is an alias with the same behavior. */
|
|
30
|
+
type CopilotRuntime = CopilotKitRuntime;
|
|
31
|
+
/** @deprecated Use CopilotKitSseRuntime. This old name is an alias with the same behavior. */
|
|
32
|
+
declare const CopilotSseRuntime: typeof CopilotKitSseRuntime;
|
|
33
|
+
/** @deprecated Use CopilotKitSseRuntime. This old name is an alias with the same behavior. */
|
|
34
|
+
type CopilotSseRuntime = CopilotKitSseRuntime;
|
|
35
|
+
/** @deprecated Use CopilotKitIntelligenceRuntime. This old name is an alias with the same behavior. */
|
|
36
|
+
declare const CopilotIntelligenceRuntime: typeof CopilotKitIntelligenceRuntime;
|
|
37
|
+
/** @deprecated Use CopilotKitIntelligenceRuntime. This old name is an alias with the same behavior. */
|
|
38
|
+
type CopilotIntelligenceRuntime = CopilotKitIntelligenceRuntime;
|
|
39
|
+
/** @deprecated Use CopilotKitRuntimeConstructor. This old name is an alias with the same behavior. */
|
|
40
|
+
type CopilotRuntimeConstructor = CopilotKitRuntimeConstructor;
|
|
41
|
+
/** @deprecated Use CopilotKitRuntimeOptions. This old name is an alias with the same behavior. */
|
|
42
|
+
type CopilotRuntimeOptions = CopilotKitRuntimeOptions;
|
|
43
|
+
/** @deprecated Use CopilotKitRuntimeLike. This old name is an alias with the same behavior. */
|
|
44
|
+
type CopilotRuntimeLike = CopilotKitRuntimeLike;
|
|
45
|
+
/** @deprecated Use CopilotKitSseRuntimeOptions. This old name is an alias with the same behavior. */
|
|
46
|
+
type CopilotSseRuntimeOptions = CopilotKitSseRuntimeOptions;
|
|
47
|
+
/** @deprecated Use CopilotKitSseRuntimeLike. This old name is an alias with the same behavior. */
|
|
48
|
+
type CopilotSseRuntimeLike = CopilotKitSseRuntimeLike;
|
|
49
|
+
/** @deprecated Use CopilotKitIntelligenceRuntimeOptions. This old name is an alias with the same behavior. */
|
|
50
|
+
type CopilotIntelligenceRuntimeOptions = CopilotKitIntelligenceRuntimeOptions;
|
|
51
|
+
/** @deprecated Use CopilotKitIntelligenceRuntimeLike. This old name is an alias with the same behavior. */
|
|
52
|
+
type CopilotIntelligenceRuntimeLike = CopilotKitIntelligenceRuntimeLike;
|
|
53
|
+
/** @deprecated Use CopilotKitRuntimeMemoryConfig. This old name is an alias with the same behavior. */
|
|
54
|
+
type CopilotRuntimeMemoryConfig = CopilotKitRuntimeMemoryConfig;
|
|
55
|
+
/** @deprecated Use CopilotKitRuntimeUser. This old name is an alias with the same behavior. */
|
|
56
|
+
type CopilotRuntimeUser = CopilotKitRuntimeUser;
|
|
57
|
+
/** @deprecated Use CopilotKitRuntimeLearningConfig. This old name is an alias with the same behavior. */
|
|
58
|
+
type CopilotRuntimeLearningConfig = CopilotKitRuntimeLearningConfig;
|
|
59
|
+
/** @deprecated Use CopilotKitRuntimeLearningContext. This old name is an alias with the same behavior. */
|
|
60
|
+
type CopilotRuntimeLearningContext = CopilotKitRuntimeLearningContext;
|
|
61
|
+
/** @deprecated Use CopilotKitRuntimeLogger. This old name is an alias with the same behavior. */
|
|
62
|
+
type CopilotRuntimeLogger = CopilotKitRuntimeLogger;
|
|
63
|
+
/** @deprecated Use CopilotKitRuntimeHandlerOptions. This old name is an alias with the same behavior. */
|
|
64
|
+
type CopilotRuntimeHandlerOptions = CopilotKitRuntimeHandlerOptions;
|
|
65
|
+
/** @deprecated Use CopilotKitRuntimeFetchHandler. This old name is an alias with the same behavior. */
|
|
66
|
+
type CopilotRuntimeFetchHandler = CopilotKitRuntimeFetchHandler;
|
|
67
|
+
/** @deprecated Use CopilotKitRuntimeFetchHandlerWithChannels. This old name is an alias with the same behavior. */
|
|
68
|
+
type CopilotRuntimeFetchHandlerWithChannels = CopilotKitRuntimeFetchHandlerWithChannels;
|
|
69
|
+
/** @deprecated Use CopilotKitRuntimeHooks. This old name is an alias with the same behavior. */
|
|
70
|
+
type CopilotRuntimeHooks = CopilotKitRuntimeHooks;
|
|
71
|
+
/** @deprecated Use CopilotKitCorsConfig. This old name is an alias with the same behavior. */
|
|
72
|
+
type CopilotCorsConfig = CopilotKitCorsConfig;
|
|
27
73
|
//#endregion
|
|
28
|
-
export {
|
|
74
|
+
export { CopilotCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, CopilotRuntimeHooks, CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeLike, CopilotRuntimeLogger, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions };
|
|
29
75
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/runtime/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/runtime/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;cAwGa,cAAA,EAAc,4BAAA;;KAEf,cAAA,GAAiB,iBAAA;;cAGhB,iBAAA,SAAiB,oBAAA;;KAElB,iBAAA,GAAoB,oBAAA;AAPhC;AAAA,cAUa,0BAAA,SAA0B,6BAAA;;KAE3B,0BAAA,GAA6B,6BAAA;;KAG7B,yBAAA,GAA4B,4BAAA;;KAE5B,qBAAA,GAAwB,wBAAA;;KAExB,kBAAA,GAAqB,qBAAA;AAdjC;AAAA,KAgBY,wBAAA,GAA2B,2BAAA;;KAE3B,qBAAA,GAAwB,wBAAA;;KAExB,iCAAA,GACV,oCAAA;;KAEU,8BAAA,GAAiC,iCAAA;;KAEjC,0BAAA,GAA6B,6BAAA;AApBzC;AAAA,KAsBY,kBAAA,GAAqB,qBAAA;;KAErB,4BAAA,GAA+B,+BAAA;;KAE/B,6BAAA,GAAgC,gCAAA;;KAEhC,oBAAA,GAAuB,uBAAA;;KAEvB,4BAAA,GAA+B,+BAAA;AAzB3C;AAAA,KA2BY,0BAAA,GAA6B,6BAAA;;KAE7B,sCAAA,GACV,yCAAA;;KAEU,mBAAA,GAAsB,sBAAA;;KAEtB,iBAAA,GAAoB,oBAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AgentRunner, THREAD_ACCESS_DENIED_ERROR_CODE, ThreadAccessDeniedError, ThreadAlreadyRunningError, enforcesThreadOwnership, isThreadAccessDeniedError, supportsLocalThreadEndpoints, ɵSERVER_THREAD_OWNER, ɵresolveThreadOwner } from "./runner/agent-runner.mjs";
|
|
2
|
+
import { LearnedSkillsError } from "./intelligence-platform/learned-skills.mjs";
|
|
3
|
+
import { CopilotKitIntelligence, PlatformRequestError } from "./intelligence-platform/client.mjs";
|
|
4
|
+
import { InMemoryAgentRunner, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵestimateBytes, ɵnormalizeLimits } from "./runner/in-memory.mjs";
|
|
5
|
+
import { IntelligenceAgentRunner, STOP_RECORD_DEADLINE_MS } from "./runner/intelligence.mjs";
|
|
6
|
+
import { CopilotKitIntelligenceRuntime, CopilotKitRuntime, CopilotKitSseRuntime, VERSION, isIntelligenceRuntime, resolveAgents } from "./core/runtime.mjs";
|
|
7
|
+
import { GenerativeUIMiddleware } from "./generative-ui/generative-ui-middleware.mjs";
|
|
8
|
+
import { A2UIV09BridgeMiddleware } from "./generative-ui/a2ui-v09-middleware.mjs";
|
|
9
|
+
import { createSurfaceWriter } from "./generative-ui/surface-writer.mjs";
|
|
10
|
+
import { ArgsParser, OpenGenerativeUIMiddleware } from "./event-transforms/open-generative-ui-middleware.mjs";
|
|
11
|
+
import { transformRecordedEvents } from "./event-transforms/recorded-events.mjs";
|
|
12
|
+
import { A2UIMiddleware } from "./event-transforms/index.mjs";
|
|
13
|
+
import { createRunEventFinalizer, finalizeRunEvents } from "./runner/index.mjs";
|
|
14
|
+
import { TranscriptionService } from "./transcription-service/transcription-service.mjs";
|
|
15
|
+
import { createCopilotKitRuntimeHandler, createCopilotRuntimeHandler } from "./core/fetch-handler.mjs";
|
|
16
|
+
|
|
17
|
+
//#region src/runtime/index.ts
|
|
18
|
+
/** @deprecated Use CopilotKitRuntime. This old name is an alias with the same behavior. */
|
|
19
|
+
const CopilotRuntime = CopilotKitRuntime;
|
|
20
|
+
/** @deprecated Use CopilotKitSseRuntime. This old name is an alias with the same behavior. */
|
|
21
|
+
const CopilotSseRuntime = CopilotKitSseRuntime;
|
|
22
|
+
/** @deprecated Use CopilotKitIntelligenceRuntime. This old name is an alias with the same behavior. */
|
|
23
|
+
const CopilotIntelligenceRuntime = CopilotKitIntelligenceRuntime;
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { CopilotIntelligenceRuntime, CopilotRuntime, CopilotSseRuntime };
|
|
27
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/runtime/index.ts"],"sourcesContent":["import {\n CopilotKitIntelligenceRuntime,\n CopilotKitRuntime,\n CopilotKitSseRuntime,\n} from \"./core/runtime\";\nimport type {\n CopilotKitIntelligenceRuntimeLike,\n CopilotKitIntelligenceRuntimeOptions,\n CopilotKitRuntimeConstructor,\n CopilotKitRuntimeLearningConfig,\n CopilotKitRuntimeLearningContext,\n CopilotKitRuntimeLike,\n CopilotKitRuntimeLogger,\n CopilotKitRuntimeMemoryConfig,\n CopilotKitRuntimeOptions,\n CopilotKitRuntimeUser,\n CopilotKitSseRuntimeLike,\n CopilotKitSseRuntimeOptions,\n} from \"./core/runtime\";\nimport type {\n CopilotKitRuntimeFetchHandler,\n CopilotKitRuntimeFetchHandlerWithChannels,\n CopilotKitRuntimeHandlerOptions,\n} from \"./core/fetch-handler\";\nimport type { CopilotKitRuntimeHooks } from \"./core/hooks\";\nimport type { CopilotKitCorsConfig } from \"./core/fetch-cors\";\n\nexport * from \"./core/runtime\";\n\n// Export the generative UI middlewares and surface writer\nexport {\n A2UIV09BridgeMiddleware,\n GenerativeUIMiddleware,\n createSurfaceWriter,\n} from \"./generative-ui\";\nexport type { GenerativeUISurfaceWriter } from \"./generative-ui\";\n\n// Export the A2UI / Open Generative UI middleware and the recorded-event\n// transforms (moved from `@copilotkit/shared/event-transforms` in 2.0)\nexport * from \"./event-transforms\";\n\n// Export agent runners and base types\nexport * from \"./runner\";\n\n// Export transcription services\nexport * from \"./transcription-service/transcription-service\";\n\n// Export CopilotKit Intelligence client and types\nexport {\n CopilotKitIntelligence,\n PlatformRequestError,\n LearnedSkillsError,\n type LearnedSkillsErrorCode,\n type GetLearnedSkillsSnapshotRequest,\n type GetLearnedSkillsSnapshotsRequest,\n type LearnedSkillsBatchResult,\n type LearnedSkillsSnapshotResult,\n type CopilotKitIntelligenceConfig,\n type CreateThreadRequest,\n type ThreadSummary,\n type ListThreadsResponse,\n type SubscribeToThreadsRequest,\n type SubscribeToThreadsResponse,\n type UpdateThreadRequest,\n} from \"./intelligence-platform\";\n\n// Export framework-agnostic fetch handler\nexport {\n createCopilotKitRuntimeHandler,\n createCopilotRuntimeHandler,\n} from \"./core/fetch-handler\";\nexport type {\n CopilotKitRuntimeHandlerOptions,\n CopilotKitRuntimeFetchHandler,\n CopilotKitRuntimeFetchHandlerWithChannels,\n} from \"./core/fetch-handler\";\n\n// Export hook types\nexport type {\n CopilotKitRuntimeHooks,\n HookContext,\n HandlerHookContext,\n ResponseHookContext,\n ErrorHookContext,\n RouteInfo,\n} from \"./core/hooks\";\n\n// Export CORS config type\nexport type { CopilotKitCorsConfig } from \"./core/fetch-cors\";\n\n// Export Channels control-surface types so consumers can name the type of\n// `handler.channels` (see `core/channel-manager.ts`).\nexport type { ChannelsControl, ChannelStatus } from \"./core/channel-manager\";\n\nexport type { experimental } from \"./intelligence-platform\";\n\n/* ------------------------------------------------------------------------------------------------\n * Deprecated names\n *\n * The 2.0 release candidates named these exports without \"Kit\". Each old name\n * is an alias of its CopilotKit name, with the same value and the same type.\n * --------------------------------------------------------------------------------------------- */\n\n/** @deprecated Use CopilotKitRuntime. This old name is an alias with the same behavior. */\nexport const CopilotRuntime = CopilotKitRuntime;\n/** @deprecated Use CopilotKitRuntime. This old name is an alias with the same behavior. */\nexport type CopilotRuntime = CopilotKitRuntime;\n\n/** @deprecated Use CopilotKitSseRuntime. This old name is an alias with the same behavior. */\nexport const CopilotSseRuntime = CopilotKitSseRuntime;\n/** @deprecated Use CopilotKitSseRuntime. This old name is an alias with the same behavior. */\nexport type CopilotSseRuntime = CopilotKitSseRuntime;\n\n/** @deprecated Use CopilotKitIntelligenceRuntime. This old name is an alias with the same behavior. */\nexport const CopilotIntelligenceRuntime = CopilotKitIntelligenceRuntime;\n/** @deprecated Use CopilotKitIntelligenceRuntime. This old name is an alias with the same behavior. */\nexport type CopilotIntelligenceRuntime = CopilotKitIntelligenceRuntime;\n\n/** @deprecated Use CopilotKitRuntimeConstructor. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeConstructor = CopilotKitRuntimeConstructor;\n/** @deprecated Use CopilotKitRuntimeOptions. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeOptions = CopilotKitRuntimeOptions;\n/** @deprecated Use CopilotKitRuntimeLike. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeLike = CopilotKitRuntimeLike;\n/** @deprecated Use CopilotKitSseRuntimeOptions. This old name is an alias with the same behavior. */\nexport type CopilotSseRuntimeOptions = CopilotKitSseRuntimeOptions;\n/** @deprecated Use CopilotKitSseRuntimeLike. This old name is an alias with the same behavior. */\nexport type CopilotSseRuntimeLike = CopilotKitSseRuntimeLike;\n/** @deprecated Use CopilotKitIntelligenceRuntimeOptions. This old name is an alias with the same behavior. */\nexport type CopilotIntelligenceRuntimeOptions =\n CopilotKitIntelligenceRuntimeOptions;\n/** @deprecated Use CopilotKitIntelligenceRuntimeLike. This old name is an alias with the same behavior. */\nexport type CopilotIntelligenceRuntimeLike = CopilotKitIntelligenceRuntimeLike;\n/** @deprecated Use CopilotKitRuntimeMemoryConfig. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeMemoryConfig = CopilotKitRuntimeMemoryConfig;\n/** @deprecated Use CopilotKitRuntimeUser. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeUser = CopilotKitRuntimeUser;\n/** @deprecated Use CopilotKitRuntimeLearningConfig. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeLearningConfig = CopilotKitRuntimeLearningConfig;\n/** @deprecated Use CopilotKitRuntimeLearningContext. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeLearningContext = CopilotKitRuntimeLearningContext;\n/** @deprecated Use CopilotKitRuntimeLogger. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeLogger = CopilotKitRuntimeLogger;\n/** @deprecated Use CopilotKitRuntimeHandlerOptions. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeHandlerOptions = CopilotKitRuntimeHandlerOptions;\n/** @deprecated Use CopilotKitRuntimeFetchHandler. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeFetchHandler = CopilotKitRuntimeFetchHandler;\n/** @deprecated Use CopilotKitRuntimeFetchHandlerWithChannels. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeFetchHandlerWithChannels =\n CopilotKitRuntimeFetchHandlerWithChannels;\n/** @deprecated Use CopilotKitRuntimeHooks. This old name is an alias with the same behavior. */\nexport type CopilotRuntimeHooks = CopilotKitRuntimeHooks;\n/** @deprecated Use CopilotKitCorsConfig. This old name is an alias with the same behavior. */\nexport type CopilotCorsConfig = CopilotKitCorsConfig;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwGA,MAAa,iBAAiB;;AAK9B,MAAa,oBAAoB;;AAKjC,MAAa,6BAA6B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const require_logger = require('../core/logger.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/intelligence-platform/analytics-context.ts
|
|
4
|
+
/**
|
|
5
|
+
* The `forwardedProps` key an app uses to hand the runtime its analytics
|
|
6
|
+
* context for one run.
|
|
7
|
+
*/
|
|
8
|
+
const ANALYTICS_CONTEXT_FORWARDED_PROP = "__copilotkitAnalyticsContext";
|
|
9
|
+
/** The largest analytics context the runtime forwards, in UTF-8 bytes of JSON. */
|
|
10
|
+
const MAX_ANALYTICS_CONTEXT_BYTES = 4096;
|
|
11
|
+
/**
|
|
12
|
+
* Splits an app's analytics context off a run's input.
|
|
13
|
+
*
|
|
14
|
+
* The returned input no longer carries the context, so it never reaches the
|
|
15
|
+
* agent or the run's stored events. The caller forwards it on the thread lock
|
|
16
|
+
* request alone. The context is returned as the app sent it; check it with
|
|
17
|
+
* {@link normalizeAnalyticsContext} before sending it anywhere.
|
|
18
|
+
*/
|
|
19
|
+
function takeAnalyticsContext(input) {
|
|
20
|
+
const forwardedProps = input.forwardedProps;
|
|
21
|
+
if (typeof forwardedProps !== "object" || forwardedProps === null || !Object.prototype.hasOwnProperty.call(forwardedProps, ANALYTICS_CONTEXT_FORWARDED_PROP)) return {
|
|
22
|
+
input,
|
|
23
|
+
analyticsContext: void 0
|
|
24
|
+
};
|
|
25
|
+
const { [ANALYTICS_CONTEXT_FORWARDED_PROP]: analyticsContext, ...agentForwardedProps } = forwardedProps;
|
|
26
|
+
return {
|
|
27
|
+
input: {
|
|
28
|
+
...input,
|
|
29
|
+
forwardedProps: agentForwardedProps
|
|
30
|
+
},
|
|
31
|
+
analyticsContext
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns a JSON copy of an app's analytics context when it has the shape the
|
|
36
|
+
* lock request carries, and `undefined` otherwise.
|
|
37
|
+
*
|
|
38
|
+
* The runtime does not know what the context means. It checks only that the
|
|
39
|
+
* value is a plain object that serializes to JSON without losing anything (no
|
|
40
|
+
* functions, symbols, BigInts, cycles or non-finite numbers) in at most
|
|
41
|
+
* {@link MAX_ANALYTICS_CONTEXT_BYTES}. Intelligence validates the fields.
|
|
42
|
+
*
|
|
43
|
+
* A missing context (`undefined` or `null`) is dropped silently. A malformed
|
|
44
|
+
* one is dropped with a warning that names the problem but never the content.
|
|
45
|
+
* Neither ever fails the run.
|
|
46
|
+
*/
|
|
47
|
+
function normalizeAnalyticsContext(value, logger = require_logger.getRuntimeLogger()) {
|
|
48
|
+
if (value === void 0 || value === null) return void 0;
|
|
49
|
+
const result = serializeAnalyticsContext(value);
|
|
50
|
+
if ("problem" in result) {
|
|
51
|
+
logger.warn({ problem: result.problem }, "Dropped the run's analytics context; the run continues without it");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return JSON.parse(result.json);
|
|
55
|
+
}
|
|
56
|
+
function serializeAnalyticsContext(value) {
|
|
57
|
+
if (!isPlainObject(value)) return { problem: "not a plain object" };
|
|
58
|
+
let lossy;
|
|
59
|
+
let json;
|
|
60
|
+
try {
|
|
61
|
+
json = JSON.stringify(value, (_key, entry) => {
|
|
62
|
+
if (typeof entry === "function") lossy ??= "contains a function";
|
|
63
|
+
else if (typeof entry === "symbol") lossy ??= "contains a symbol";
|
|
64
|
+
else if (typeof entry === "number" && !Number.isFinite(entry)) lossy ??= "contains a non-finite number";
|
|
65
|
+
return entry;
|
|
66
|
+
});
|
|
67
|
+
} catch {
|
|
68
|
+
return { problem: "not serializable as JSON" };
|
|
69
|
+
}
|
|
70
|
+
if (lossy) return { problem: lossy };
|
|
71
|
+
const bytes = new TextEncoder().encode(json).byteLength;
|
|
72
|
+
if (bytes > MAX_ANALYTICS_CONTEXT_BYTES) return { problem: `larger than ${MAX_ANALYTICS_CONTEXT_BYTES} bytes (${bytes})` };
|
|
73
|
+
return { json };
|
|
74
|
+
}
|
|
75
|
+
function isPlainObject(value) {
|
|
76
|
+
if (typeof value !== "object" || value === null) return false;
|
|
77
|
+
const prototype = Object.getPrototypeOf(value);
|
|
78
|
+
return prototype === Object.prototype || prototype === null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.normalizeAnalyticsContext = normalizeAnalyticsContext;
|
|
83
|
+
exports.takeAnalyticsContext = takeAnalyticsContext;
|
|
84
|
+
//# sourceMappingURL=analytics-context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-context.cjs","names":["getRuntimeLogger"],"sources":["../../../src/runtime/intelligence-platform/analytics-context.ts"],"sourcesContent":["import type { RunAgentInput } from \"@ag-ui/client\";\nimport { getRuntimeLogger } from \"../core/logger\";\nimport type { CopilotKitRuntimeLogger } from \"../core/logger\";\n\n/**\n * The `forwardedProps` key an app uses to hand the runtime its analytics\n * context for one run.\n */\nexport const ANALYTICS_CONTEXT_FORWARDED_PROP = \"__copilotkitAnalyticsContext\";\n\n/** The largest analytics context the runtime forwards, in UTF-8 bytes of JSON. */\nexport const MAX_ANALYTICS_CONTEXT_BYTES = 4096;\n\n/**\n * Splits an app's analytics context off a run's input.\n *\n * The returned input no longer carries the context, so it never reaches the\n * agent or the run's stored events. The caller forwards it on the thread lock\n * request alone. The context is returned as the app sent it; check it with\n * {@link normalizeAnalyticsContext} before sending it anywhere.\n */\nexport function takeAnalyticsContext(input: RunAgentInput): {\n input: RunAgentInput;\n analyticsContext: unknown;\n} {\n const forwardedProps: unknown = input.forwardedProps;\n if (\n typeof forwardedProps !== \"object\" ||\n forwardedProps === null ||\n !Object.prototype.hasOwnProperty.call(\n forwardedProps,\n ANALYTICS_CONTEXT_FORWARDED_PROP,\n )\n ) {\n return { input, analyticsContext: undefined };\n }\n const {\n [ANALYTICS_CONTEXT_FORWARDED_PROP]: analyticsContext,\n ...agentForwardedProps\n } = forwardedProps as Record<string, unknown>;\n return {\n input: { ...input, forwardedProps: agentForwardedProps },\n analyticsContext,\n };\n}\n\n/**\n * Returns a JSON copy of an app's analytics context when it has the shape the\n * lock request carries, and `undefined` otherwise.\n *\n * The runtime does not know what the context means. It checks only that the\n * value is a plain object that serializes to JSON without losing anything (no\n * functions, symbols, BigInts, cycles or non-finite numbers) in at most\n * {@link MAX_ANALYTICS_CONTEXT_BYTES}. Intelligence validates the fields.\n *\n * A missing context (`undefined` or `null`) is dropped silently. A malformed\n * one is dropped with a warning that names the problem but never the content.\n * Neither ever fails the run.\n */\nexport function normalizeAnalyticsContext(\n value: unknown,\n logger: CopilotKitRuntimeLogger = getRuntimeLogger(),\n): Record<string, unknown> | undefined {\n if (value === undefined || value === null) return undefined;\n const result = serializeAnalyticsContext(value);\n if (\"problem\" in result) {\n logger.warn(\n { problem: result.problem },\n \"Dropped the run's analytics context; the run continues without it\",\n );\n return undefined;\n }\n return JSON.parse(result.json) as Record<string, unknown>;\n}\n\nfunction serializeAnalyticsContext(\n value: unknown,\n): { json: string } | { problem: string } {\n if (!isPlainObject(value)) {\n return { problem: \"not a plain object\" };\n }\n let lossy: string | undefined;\n let json: string;\n try {\n json = JSON.stringify(value, (_key, entry: unknown) => {\n if (typeof entry === \"function\") lossy ??= \"contains a function\";\n else if (typeof entry === \"symbol\") lossy ??= \"contains a symbol\";\n else if (typeof entry === \"number\" && !Number.isFinite(entry))\n lossy ??= \"contains a non-finite number\";\n return entry;\n });\n } catch {\n // JSON.stringify throws on cycles and BigInts.\n return { problem: \"not serializable as JSON\" };\n }\n if (lossy) return { problem: lossy };\n const bytes = new TextEncoder().encode(json).byteLength;\n if (bytes > MAX_ANALYTICS_CONTEXT_BYTES) {\n return {\n problem: `larger than ${MAX_ANALYTICS_CONTEXT_BYTES} bytes (${bytes})`,\n };\n }\n return { json };\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n"],"mappings":";;;;;;;AAQA,MAAa,mCAAmC;;AAGhD,MAAa,8BAA8B;;;;;;;;;AAU3C,SAAgB,qBAAqB,OAGnC;CACA,MAAM,iBAA0B,MAAM;AACtC,KACE,OAAO,mBAAmB,YAC1B,mBAAmB,QACnB,CAAC,OAAO,UAAU,eAAe,KAC/B,gBACA,iCACD,CAED,QAAO;EAAE;EAAO,kBAAkB;EAAW;CAE/C,MAAM,GACH,mCAAmC,kBACpC,GAAG,wBACD;AACJ,QAAO;EACL,OAAO;GAAE,GAAG;GAAO,gBAAgB;GAAqB;EACxD;EACD;;;;;;;;;;;;;;;AAgBH,SAAgB,0BACd,OACA,SAAkCA,iCAAkB,EACf;AACrC,KAAI,UAAU,UAAa,UAAU,KAAM,QAAO;CAClD,MAAM,SAAS,0BAA0B,MAAM;AAC/C,KAAI,aAAa,QAAQ;AACvB,SAAO,KACL,EAAE,SAAS,OAAO,SAAS,EAC3B,oEACD;AACD;;AAEF,QAAO,KAAK,MAAM,OAAO,KAAK;;AAGhC,SAAS,0BACP,OACwC;AACxC,KAAI,CAAC,cAAc,MAAM,CACvB,QAAO,EAAE,SAAS,sBAAsB;CAE1C,IAAI;CACJ,IAAI;AACJ,KAAI;AACF,SAAO,KAAK,UAAU,QAAQ,MAAM,UAAmB;AACrD,OAAI,OAAO,UAAU,WAAY,WAAU;YAClC,OAAO,UAAU,SAAU,WAAU;YACrC,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,MAAM,CAC3D,WAAU;AACZ,UAAO;IACP;SACI;AAEN,SAAO,EAAE,SAAS,4BAA4B;;AAEhD,KAAI,MAAO,QAAO,EAAE,SAAS,OAAO;CACpC,MAAM,QAAQ,IAAI,aAAa,CAAC,OAAO,KAAK,CAAC;AAC7C,KAAI,QAAQ,4BACV,QAAO,EACL,SAAS,eAAe,4BAA4B,UAAU,MAAM,IACrE;AAEH,QAAO,EAAE,MAAM;;AAGjB,SAAS,cAAc,OAAkD;AACvE,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,YAAqB,OAAO,eAAe,MAAM;AACvD,QAAO,cAAc,OAAO,aAAa,cAAc"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getRuntimeLogger } from "../core/logger.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/intelligence-platform/analytics-context.ts
|
|
4
|
+
/**
|
|
5
|
+
* The `forwardedProps` key an app uses to hand the runtime its analytics
|
|
6
|
+
* context for one run.
|
|
7
|
+
*/
|
|
8
|
+
const ANALYTICS_CONTEXT_FORWARDED_PROP = "__copilotkitAnalyticsContext";
|
|
9
|
+
/** The largest analytics context the runtime forwards, in UTF-8 bytes of JSON. */
|
|
10
|
+
const MAX_ANALYTICS_CONTEXT_BYTES = 4096;
|
|
11
|
+
/**
|
|
12
|
+
* Splits an app's analytics context off a run's input.
|
|
13
|
+
*
|
|
14
|
+
* The returned input no longer carries the context, so it never reaches the
|
|
15
|
+
* agent or the run's stored events. The caller forwards it on the thread lock
|
|
16
|
+
* request alone. The context is returned as the app sent it; check it with
|
|
17
|
+
* {@link normalizeAnalyticsContext} before sending it anywhere.
|
|
18
|
+
*/
|
|
19
|
+
function takeAnalyticsContext(input) {
|
|
20
|
+
const forwardedProps = input.forwardedProps;
|
|
21
|
+
if (typeof forwardedProps !== "object" || forwardedProps === null || !Object.prototype.hasOwnProperty.call(forwardedProps, ANALYTICS_CONTEXT_FORWARDED_PROP)) return {
|
|
22
|
+
input,
|
|
23
|
+
analyticsContext: void 0
|
|
24
|
+
};
|
|
25
|
+
const { [ANALYTICS_CONTEXT_FORWARDED_PROP]: analyticsContext, ...agentForwardedProps } = forwardedProps;
|
|
26
|
+
return {
|
|
27
|
+
input: {
|
|
28
|
+
...input,
|
|
29
|
+
forwardedProps: agentForwardedProps
|
|
30
|
+
},
|
|
31
|
+
analyticsContext
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns a JSON copy of an app's analytics context when it has the shape the
|
|
36
|
+
* lock request carries, and `undefined` otherwise.
|
|
37
|
+
*
|
|
38
|
+
* The runtime does not know what the context means. It checks only that the
|
|
39
|
+
* value is a plain object that serializes to JSON without losing anything (no
|
|
40
|
+
* functions, symbols, BigInts, cycles or non-finite numbers) in at most
|
|
41
|
+
* {@link MAX_ANALYTICS_CONTEXT_BYTES}. Intelligence validates the fields.
|
|
42
|
+
*
|
|
43
|
+
* A missing context (`undefined` or `null`) is dropped silently. A malformed
|
|
44
|
+
* one is dropped with a warning that names the problem but never the content.
|
|
45
|
+
* Neither ever fails the run.
|
|
46
|
+
*/
|
|
47
|
+
function normalizeAnalyticsContext(value, logger = getRuntimeLogger()) {
|
|
48
|
+
if (value === void 0 || value === null) return void 0;
|
|
49
|
+
const result = serializeAnalyticsContext(value);
|
|
50
|
+
if ("problem" in result) {
|
|
51
|
+
logger.warn({ problem: result.problem }, "Dropped the run's analytics context; the run continues without it");
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
return JSON.parse(result.json);
|
|
55
|
+
}
|
|
56
|
+
function serializeAnalyticsContext(value) {
|
|
57
|
+
if (!isPlainObject(value)) return { problem: "not a plain object" };
|
|
58
|
+
let lossy;
|
|
59
|
+
let json;
|
|
60
|
+
try {
|
|
61
|
+
json = JSON.stringify(value, (_key, entry) => {
|
|
62
|
+
if (typeof entry === "function") lossy ??= "contains a function";
|
|
63
|
+
else if (typeof entry === "symbol") lossy ??= "contains a symbol";
|
|
64
|
+
else if (typeof entry === "number" && !Number.isFinite(entry)) lossy ??= "contains a non-finite number";
|
|
65
|
+
return entry;
|
|
66
|
+
});
|
|
67
|
+
} catch {
|
|
68
|
+
return { problem: "not serializable as JSON" };
|
|
69
|
+
}
|
|
70
|
+
if (lossy) return { problem: lossy };
|
|
71
|
+
const bytes = new TextEncoder().encode(json).byteLength;
|
|
72
|
+
if (bytes > MAX_ANALYTICS_CONTEXT_BYTES) return { problem: `larger than ${MAX_ANALYTICS_CONTEXT_BYTES} bytes (${bytes})` };
|
|
73
|
+
return { json };
|
|
74
|
+
}
|
|
75
|
+
function isPlainObject(value) {
|
|
76
|
+
if (typeof value !== "object" || value === null) return false;
|
|
77
|
+
const prototype = Object.getPrototypeOf(value);
|
|
78
|
+
return prototype === Object.prototype || prototype === null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { normalizeAnalyticsContext, takeAnalyticsContext };
|
|
83
|
+
//# sourceMappingURL=analytics-context.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics-context.mjs","names":[],"sources":["../../../src/runtime/intelligence-platform/analytics-context.ts"],"sourcesContent":["import type { RunAgentInput } from \"@ag-ui/client\";\nimport { getRuntimeLogger } from \"../core/logger\";\nimport type { CopilotKitRuntimeLogger } from \"../core/logger\";\n\n/**\n * The `forwardedProps` key an app uses to hand the runtime its analytics\n * context for one run.\n */\nexport const ANALYTICS_CONTEXT_FORWARDED_PROP = \"__copilotkitAnalyticsContext\";\n\n/** The largest analytics context the runtime forwards, in UTF-8 bytes of JSON. */\nexport const MAX_ANALYTICS_CONTEXT_BYTES = 4096;\n\n/**\n * Splits an app's analytics context off a run's input.\n *\n * The returned input no longer carries the context, so it never reaches the\n * agent or the run's stored events. The caller forwards it on the thread lock\n * request alone. The context is returned as the app sent it; check it with\n * {@link normalizeAnalyticsContext} before sending it anywhere.\n */\nexport function takeAnalyticsContext(input: RunAgentInput): {\n input: RunAgentInput;\n analyticsContext: unknown;\n} {\n const forwardedProps: unknown = input.forwardedProps;\n if (\n typeof forwardedProps !== \"object\" ||\n forwardedProps === null ||\n !Object.prototype.hasOwnProperty.call(\n forwardedProps,\n ANALYTICS_CONTEXT_FORWARDED_PROP,\n )\n ) {\n return { input, analyticsContext: undefined };\n }\n const {\n [ANALYTICS_CONTEXT_FORWARDED_PROP]: analyticsContext,\n ...agentForwardedProps\n } = forwardedProps as Record<string, unknown>;\n return {\n input: { ...input, forwardedProps: agentForwardedProps },\n analyticsContext,\n };\n}\n\n/**\n * Returns a JSON copy of an app's analytics context when it has the shape the\n * lock request carries, and `undefined` otherwise.\n *\n * The runtime does not know what the context means. It checks only that the\n * value is a plain object that serializes to JSON without losing anything (no\n * functions, symbols, BigInts, cycles or non-finite numbers) in at most\n * {@link MAX_ANALYTICS_CONTEXT_BYTES}. Intelligence validates the fields.\n *\n * A missing context (`undefined` or `null`) is dropped silently. A malformed\n * one is dropped with a warning that names the problem but never the content.\n * Neither ever fails the run.\n */\nexport function normalizeAnalyticsContext(\n value: unknown,\n logger: CopilotKitRuntimeLogger = getRuntimeLogger(),\n): Record<string, unknown> | undefined {\n if (value === undefined || value === null) return undefined;\n const result = serializeAnalyticsContext(value);\n if (\"problem\" in result) {\n logger.warn(\n { problem: result.problem },\n \"Dropped the run's analytics context; the run continues without it\",\n );\n return undefined;\n }\n return JSON.parse(result.json) as Record<string, unknown>;\n}\n\nfunction serializeAnalyticsContext(\n value: unknown,\n): { json: string } | { problem: string } {\n if (!isPlainObject(value)) {\n return { problem: \"not a plain object\" };\n }\n let lossy: string | undefined;\n let json: string;\n try {\n json = JSON.stringify(value, (_key, entry: unknown) => {\n if (typeof entry === \"function\") lossy ??= \"contains a function\";\n else if (typeof entry === \"symbol\") lossy ??= \"contains a symbol\";\n else if (typeof entry === \"number\" && !Number.isFinite(entry))\n lossy ??= \"contains a non-finite number\";\n return entry;\n });\n } catch {\n // JSON.stringify throws on cycles and BigInts.\n return { problem: \"not serializable as JSON\" };\n }\n if (lossy) return { problem: lossy };\n const bytes = new TextEncoder().encode(json).byteLength;\n if (bytes > MAX_ANALYTICS_CONTEXT_BYTES) {\n return {\n problem: `larger than ${MAX_ANALYTICS_CONTEXT_BYTES} bytes (${bytes})`,\n };\n }\n return { json };\n}\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null) return false;\n const prototype: unknown = Object.getPrototypeOf(value);\n return prototype === Object.prototype || prototype === null;\n}\n"],"mappings":";;;;;;;AAQA,MAAa,mCAAmC;;AAGhD,MAAa,8BAA8B;;;;;;;;;AAU3C,SAAgB,qBAAqB,OAGnC;CACA,MAAM,iBAA0B,MAAM;AACtC,KACE,OAAO,mBAAmB,YAC1B,mBAAmB,QACnB,CAAC,OAAO,UAAU,eAAe,KAC/B,gBACA,iCACD,CAED,QAAO;EAAE;EAAO,kBAAkB;EAAW;CAE/C,MAAM,GACH,mCAAmC,kBACpC,GAAG,wBACD;AACJ,QAAO;EACL,OAAO;GAAE,GAAG;GAAO,gBAAgB;GAAqB;EACxD;EACD;;;;;;;;;;;;;;;AAgBH,SAAgB,0BACd,OACA,SAAkC,kBAAkB,EACf;AACrC,KAAI,UAAU,UAAa,UAAU,KAAM,QAAO;CAClD,MAAM,SAAS,0BAA0B,MAAM;AAC/C,KAAI,aAAa,QAAQ;AACvB,SAAO,KACL,EAAE,SAAS,OAAO,SAAS,EAC3B,oEACD;AACD;;AAEF,QAAO,KAAK,MAAM,OAAO,KAAK;;AAGhC,SAAS,0BACP,OACwC;AACxC,KAAI,CAAC,cAAc,MAAM,CACvB,QAAO,EAAE,SAAS,sBAAsB;CAE1C,IAAI;CACJ,IAAI;AACJ,KAAI;AACF,SAAO,KAAK,UAAU,QAAQ,MAAM,UAAmB;AACrD,OAAI,OAAO,UAAU,WAAY,WAAU;YAClC,OAAO,UAAU,SAAU,WAAU;YACrC,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,MAAM,CAC3D,WAAU;AACZ,UAAO;IACP;SACI;AAEN,SAAO,EAAE,SAAS,4BAA4B;;AAEhD,KAAI,MAAO,QAAO,EAAE,SAAS,OAAO;CACpC,MAAM,QAAQ,IAAI,aAAa,CAAC,OAAO,KAAK,CAAC;AAC7C,KAAI,QAAQ,4BACV,QAAO,EACL,SAAS,eAAe,4BAA4B,UAAU,MAAM,IACrE;AAEH,QAAO,EAAE,MAAM;;AAGjB,SAAS,cAAc,OAAkD;AACvE,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO;CACxD,MAAM,YAAqB,OAAO,eAAe,MAAM;AACvD,QAAO,cAAc,OAAO,aAAa,cAAc"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
1
|
const require_learning_management = require('./learning-management.cjs');
|
|
3
2
|
const require_learning = require('../core/learning.cjs');
|
|
3
|
+
const require_analytics_context = require('./analytics-context.cjs');
|
|
4
|
+
const require_stop_run = require('./stop-run.cjs');
|
|
4
5
|
const require_trajectories = require('./trajectories.cjs');
|
|
5
6
|
const require_learned_skills = require('./learned-skills.cjs');
|
|
6
7
|
let _copilotkit_shared = require("@copilotkit/shared");
|
|
@@ -193,16 +194,16 @@ function cloneRuntimeEntitlementError(error) {
|
|
|
193
194
|
* Client for the CopilotKit Intelligence REST API.
|
|
194
195
|
*
|
|
195
196
|
* Construct the client once and pass it to any consumers that need it
|
|
196
|
-
* (e.g. `
|
|
197
|
+
* (e.g. `CopilotKitRuntime`, `IntelligenceAgentRunner`):
|
|
197
198
|
*
|
|
198
199
|
* ```ts
|
|
199
|
-
* import { CopilotKitIntelligence,
|
|
200
|
+
* import { CopilotKitIntelligence, CopilotKitRuntime } from "@copilotkit/runtime";
|
|
200
201
|
*
|
|
201
202
|
* const intelligence = new CopilotKitIntelligence({
|
|
202
203
|
* apiKey: process.env.CPK_INTELLIGENCE_API_KEY!,
|
|
203
204
|
* });
|
|
204
205
|
*
|
|
205
|
-
* const runtime = new
|
|
206
|
+
* const runtime = new CopilotKitRuntime({
|
|
206
207
|
* agents,
|
|
207
208
|
* intelligence,
|
|
208
209
|
* });
|
|
@@ -1219,6 +1220,7 @@ var CopilotKitIntelligence = class {
|
|
|
1219
1220
|
return response;
|
|
1220
1221
|
}
|
|
1221
1222
|
async ɵacquireThreadLock(params) {
|
|
1223
|
+
const analyticsContext = require_analytics_context.normalizeAnalyticsContext(params.analyticsContext);
|
|
1222
1224
|
return this.#request("POST", `/api/threads/${encodeURIComponent(params.threadId)}/lock`, {
|
|
1223
1225
|
runId: params.runId,
|
|
1224
1226
|
userId: params.userId,
|
|
@@ -1226,6 +1228,7 @@ var CopilotKitIntelligence = class {
|
|
|
1226
1228
|
...params.supportsBackendThreadId === void 0 ? {} : { supportsBackendThreadId: params.supportsBackendThreadId },
|
|
1227
1229
|
...params.learningContainerId !== void 0 ? { learningContainerId: params.learningContainerId } : {},
|
|
1228
1230
|
...params.requestId !== void 0 ? { requestId: params.requestId } : {},
|
|
1231
|
+
...analyticsContext !== void 0 ? { analyticsContext } : {},
|
|
1229
1232
|
...params.lockKeyPrefix !== void 0 ? { lockKeyPrefix: params.lockKeyPrefix } : {},
|
|
1230
1233
|
...params.ttlSeconds !== void 0 ? { ttlSeconds: params.ttlSeconds } : {}
|
|
1231
1234
|
}, params.channelDeliveryId ? { "X-Cpki-Channel-Delivery-Id": params.channelDeliveryId } : void 0);
|
|
@@ -1250,6 +1253,29 @@ var CopilotKitIntelligence = class {
|
|
|
1250
1253
|
agentId: params.agentId
|
|
1251
1254
|
}) ?? null;
|
|
1252
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* @internal Records that the runtime stopped a run, by the route a
|
|
1258
|
+
* browser's Stop takes: mint a thread join token, join the thread's client
|
|
1259
|
+
* channel and send `stop_run`. Intelligence stores the stop for the run, so
|
|
1260
|
+
* it counts the run's terminal event as cancelled rather than finished.
|
|
1261
|
+
*
|
|
1262
|
+
* @throws {@link PlatformRequestError} when no join token is issued, or an
|
|
1263
|
+
* error when the channel or the stop is refused or `signal` aborts.
|
|
1264
|
+
*/
|
|
1265
|
+
async ɵrecordRunStop(params) {
|
|
1266
|
+
const connection = await this.#request("POST", `/api/threads/${encodeURIComponent(params.threadId)}/connect`, {
|
|
1267
|
+
userId: params.userId,
|
|
1268
|
+
agentId: params.agentId
|
|
1269
|
+
}, void 0, params.signal);
|
|
1270
|
+
if (!connection?.joinToken) throw new PlatformRequestError("Intelligence issued no join token to record the stop", 502);
|
|
1271
|
+
await require_stop_run.sendStopRun({
|
|
1272
|
+
url: this.#clientWsUrl,
|
|
1273
|
+
joinToken: connection.joinToken,
|
|
1274
|
+
threadId: params.threadId,
|
|
1275
|
+
runId: params.runId,
|
|
1276
|
+
...params.signal ? { signal: params.signal } : {}
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1253
1279
|
};
|
|
1254
1280
|
/**
|
|
1255
1281
|
* Normalize a configured URL to "provided" or "not provided". A blank string
|