@copilotkit/runtime 2.0.0-rc.49 → 2.0.0-rc.50
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 +1 -1
- package/dist/index.cjs +8 -3
- package/dist/index.d.cts +9 -9
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +4 -3
- package/dist/node.cjs +2 -0
- 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.map +1 -1
- package/dist/runtime/core/channel-manager.mjs.map +1 -1
- package/dist/runtime/core/debug-event-bus.cjs.map +1 -1
- package/dist/runtime/core/debug-event-bus.d.cts +2 -2
- package/dist/runtime/core/debug-event-bus.d.cts.map +1 -1
- package/dist/runtime/core/debug-event-bus.d.mts +2 -2
- package/dist/runtime/core/debug-event-bus.d.mts.map +1 -1
- 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 +9 -1
- package/dist/runtime/core/fetch-handler.cjs.map +1 -1
- package/dist/runtime/core/fetch-handler.d.cts +27 -14
- package/dist/runtime/core/fetch-handler.d.cts.map +1 -1
- package/dist/runtime/core/fetch-handler.d.mts +27 -14
- package/dist/runtime/core/fetch-handler.d.mts.map +1 -1
- package/dist/runtime/core/fetch-handler.mjs +9 -2
- 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 +8 -8
- 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.map +1 -1
- package/dist/runtime/core/logger.d.cts +3 -3
- package/dist/runtime/core/logger.d.cts.map +1 -1
- package/dist/runtime/core/logger.d.mts +3 -3
- package/dist/runtime/core/logger.d.mts.map +1 -1
- package/dist/runtime/core/logger.mjs.map +1 -1
- package/dist/runtime/core/middleware-sse-parser.cjs.map +1 -1
- package/dist/runtime/core/middleware-sse-parser.mjs.map +1 -1
- 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.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 +17 -17
- package/dist/runtime/core/runtime.cjs.map +1 -1
- package/dist/runtime/core/runtime.d.cts +65 -65
- package/dist/runtime/core/runtime.d.cts.map +1 -1
- package/dist/runtime/core/runtime.d.mts +65 -65
- package/dist/runtime/core/runtime.d.mts.map +1 -1
- package/dist/runtime/core/runtime.mjs +15 -15
- package/dist/runtime/core/runtime.mjs.map +1 -1
- package/dist/runtime/endpoints/auto-start-channels.cjs.map +1 -1
- package/dist/runtime/endpoints/auto-start-channels.mjs.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.cjs +9 -1
- package/dist/runtime/endpoints/node-fetch-handler.cjs.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.d.cts +9 -4
- package/dist/runtime/endpoints/node-fetch-handler.d.cts.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.d.mts +9 -4
- package/dist/runtime/endpoints/node-fetch-handler.d.mts.map +1 -1
- package/dist/runtime/endpoints/node-fetch-handler.mjs +9 -2
- package/dist/runtime/endpoints/node-fetch-handler.mjs.map +1 -1
- package/dist/runtime/endpoints/node.cjs +11 -3
- 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 +13 -6
- package/dist/runtime/endpoints/node.mjs.map +1 -1
- package/dist/runtime/generative-ui/a2ui-v09-middleware.cjs.map +1 -1
- package/dist/runtime/generative-ui/a2ui-v09-middleware.mjs.map +1 -1
- package/dist/runtime/handlers/get-runtime-info.cjs.map +1 -1
- package/dist/runtime/handlers/get-runtime-info.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.map +1 -1
- package/dist/runtime/handlers/handle-inspector-learning.mjs.map +1 -1
- 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-stop.cjs.map +1 -1
- package/dist/runtime/handlers/handle-stop.mjs.map +1 -1
- package/dist/runtime/handlers/handle-suggest.cjs.map +1 -1
- 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.map +1 -1
- package/dist/runtime/handlers/handle-transcribe.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/annotate.cjs +1 -1
- package/dist/runtime/handlers/intelligence/annotate.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/annotate.mjs +1 -1
- package/dist/runtime/handlers/intelligence/annotate.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/connect.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/connect.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/memories.cjs +1 -1
- package/dist/runtime/handlers/intelligence/memories.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/memories.mjs +1 -1
- package/dist/runtime/handlers/intelligence/memories.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/run.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/run.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/thread-names.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/thread-names.mjs.map +1 -1
- package/dist/runtime/handlers/intelligence/threads.cjs +5 -5
- package/dist/runtime/handlers/intelligence/threads.cjs.map +1 -1
- package/dist/runtime/handlers/intelligence/threads.mjs +5 -5
- package/dist/runtime/handlers/intelligence/threads.mjs.map +1 -1
- package/dist/runtime/handlers/shared/agent-utils.cjs.map +1 -1
- package/dist/runtime/handlers/shared/agent-utils.mjs.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.map +1 -1
- package/dist/runtime/handlers/shared/resolve-intelligence-user.mjs.map +1 -1
- package/dist/runtime/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/runtime/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/runtime/handlers/shared/thread-access.cjs +1 -1
- package/dist/runtime/handlers/shared/thread-access.cjs.map +1 -1
- package/dist/runtime/handlers/shared/thread-access.mjs +1 -1
- package/dist/runtime/handlers/shared/thread-access.mjs.map +1 -1
- package/dist/runtime/handlers/sse/connect.cjs.map +1 -1
- package/dist/runtime/handlers/sse/connect.mjs.map +1 -1
- package/dist/runtime/handlers/sse/run.cjs.map +1 -1
- 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 +58 -7
- package/dist/runtime/index.d.cts.map +1 -0
- package/dist/runtime/index.d.mts +58 -7
- package/dist/runtime/index.d.mts.map +1 -0
- package/dist/runtime/index.mjs +27 -0
- package/dist/runtime/index.mjs.map +1 -0
- package/dist/runtime/intelligence-platform/analytics-context.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/analytics-context.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/client.cjs +3 -3
- package/dist/runtime/intelligence-platform/client.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/client.d.cts +1 -1
- package/dist/runtime/intelligence-platform/client.d.mts +1 -1
- package/dist/runtime/intelligence-platform/client.mjs +3 -3
- package/dist/runtime/intelligence-platform/client.mjs.map +1 -1
- package/dist/runtime/intelligence-platform/thread-lock-heartbeat.cjs.map +1 -1
- package/dist/runtime/intelligence-platform/thread-lock-heartbeat.mjs.map +1 -1
- package/dist/runtime/node.d.cts +2 -2
- package/dist/runtime/node.d.mts +2 -2
- package/dist/runtime/runner/intelligence.cjs.map +1 -1
- package/dist/runtime/runner/intelligence.d.cts +2 -2
- package/dist/runtime/runner/intelligence.d.cts.map +1 -1
- package/dist/runtime/runner/intelligence.d.mts +2 -2
- package/dist/runtime/runner/intelligence.d.mts.map +1 -1
- package/dist/runtime/runner/intelligence.mjs.map +1 -1
- package/dist/runtime/telemetry/disclosure.cjs.map +1 -1
- package/dist/runtime/telemetry/disclosure.mjs.map +1 -1
- package/dist/runtime/telemetry/instance-created.cjs.map +1 -1
- package/dist/runtime/telemetry/instance-created.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.cjs","names":["createSseEventResponse","getRuntimeLogger","mergeForwardableHeaders","resolveForwardHeadersPolicy"],"sources":["../../../../src/runtime/handlers/sse/connect.ts"],"sourcesContent":["import type { AbstractAgent } from \"@ag-ui/client\";\nimport type {
|
|
1
|
+
{"version":3,"file":"connect.cjs","names":["createSseEventResponse","getRuntimeLogger","mergeForwardableHeaders","resolveForwardHeadersPolicy"],"sources":["../../../../src/runtime/handlers/sse/connect.ts"],"sourcesContent":["import type { AbstractAgent } from \"@ag-ui/client\";\nimport type { CopilotKitRuntimeLike } from \"../../core/runtime\";\nimport { getRuntimeLogger } from \"../../core/logger\";\nimport { createSseEventResponse } from \"../shared/sse-response\";\nimport {\n mergeForwardableHeaders,\n resolveForwardHeadersPolicy,\n} from \"../header-utils\";\n\n/**\n * `headers` lives on the HTTP-backed agent configs (e.g. `HttpAgent`), not on\n * the base `AbstractAgent`. Mirror the runtime's own optional-headers shape so\n * we can read server-configured headers off the per-request clone without a\n * cast. See `agent-utils.ts`.\n */\ntype AgentWithHeaders = AbstractAgent & {\n headers?: Record<string, string>;\n};\n\ninterface HandleSseConnectParams {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n agentId: string;\n threadId: string;\n /**\n * The per-request agent clone, carrying any server-configured `agent.headers`\n * (e.g. service-to-service auth). Used only to compute the merged header set\n * threaded into `runner.connect` below — see the note there for why that\n * merge is forward-looking plumbing rather than active outbound auth today.\n */\n agent?: AgentWithHeaders;\n /** Caller identity; the runner hides threads owned by anyone else. */\n ownerId?: string;\n}\n\nexport function handleSseConnect({\n runtime,\n request,\n agentId,\n threadId,\n agent,\n ownerId,\n}: HandleSseConnectParams): Response {\n return createSseEventResponse({\n request,\n debugEventBus: runtime.debugEventBus,\n // Forward the real agentId so debug envelopes reflect the agent the\n // route resolved to — not the literal string \"connect\".\n agentId,\n telemetry: runtime.telemetry,\n logger: getRuntimeLogger(runtime),\n keepAliveIntervalSeconds: runtime.sseKeepAliveIntervalSeconds,\n observableFactory: () =>\n runtime.runner.connect({\n threadId,\n agentId,\n ...(ownerId === undefined ? {} : { ownerId }),\n // Forward-looking plumbing: we compute the merged header set (server\n // `agent.headers` win on collision, case-insensitively; non-colliding\n // inbound headers still forward — see `mergeForwardableHeaders`, #5712)\n // and thread it into `runner.connect`. NO shipped runner consumes the\n // `headers` field of `AgentRunnerConnectRequest` today — every runner\n // (in-memory, intelligence, telemetry, sqlite) ignores it.\n // The real outbound header forwarding is the /run path, where\n // `cloneAgentForRequest` mutates `agent.headers` directly\n // (agent-utils.ts). This wiring exists so a future outbound-connecting\n // runner can pick the merged headers up without a route change; the\n // collision precedence noted here is purely about that merge, not about\n // middleware/mutation parity with /run.\n headers: mergeForwardableHeaders(\n agent?.headers,\n request,\n // Optional on `CopilotKitRuntimeLike` (non-breaking minor release);\n // coalesce a policy-less external implementor to the default resolved\n // policy (default-on denylist) instead of dereffing undefined.\n runtime.forwardHeadersPolicy ??\n resolveForwardHeadersPolicy(undefined),\n ),\n }),\n });\n}\n"],"mappings":";;;;;AAmCA,SAAgB,iBAAiB,EAC/B,SACA,SACA,SACA,UACA,OACA,WACmC;AACnC,QAAOA,4CAAuB;EAC5B;EACA,eAAe,QAAQ;EAGvB;EACA,WAAW,QAAQ;EACnB,QAAQC,gCAAiB,QAAQ;EACjC,0BAA0B,QAAQ;EAClC,yBACE,QAAQ,OAAO,QAAQ;GACrB;GACA;GACA,GAAI,YAAY,SAAY,EAAE,GAAG,EAAE,SAAS;GAa5C,SAASC,6CACP,OAAO,SACP,SAIA,QAAQ,wBACNC,iDAA4B,OAAU,CACzC;GACF,CAAC;EACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.mjs","names":[],"sources":["../../../../src/runtime/handlers/sse/connect.ts"],"sourcesContent":["import type { AbstractAgent } from \"@ag-ui/client\";\nimport type {
|
|
1
|
+
{"version":3,"file":"connect.mjs","names":[],"sources":["../../../../src/runtime/handlers/sse/connect.ts"],"sourcesContent":["import type { AbstractAgent } from \"@ag-ui/client\";\nimport type { CopilotKitRuntimeLike } from \"../../core/runtime\";\nimport { getRuntimeLogger } from \"../../core/logger\";\nimport { createSseEventResponse } from \"../shared/sse-response\";\nimport {\n mergeForwardableHeaders,\n resolveForwardHeadersPolicy,\n} from \"../header-utils\";\n\n/**\n * `headers` lives on the HTTP-backed agent configs (e.g. `HttpAgent`), not on\n * the base `AbstractAgent`. Mirror the runtime's own optional-headers shape so\n * we can read server-configured headers off the per-request clone without a\n * cast. See `agent-utils.ts`.\n */\ntype AgentWithHeaders = AbstractAgent & {\n headers?: Record<string, string>;\n};\n\ninterface HandleSseConnectParams {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n agentId: string;\n threadId: string;\n /**\n * The per-request agent clone, carrying any server-configured `agent.headers`\n * (e.g. service-to-service auth). Used only to compute the merged header set\n * threaded into `runner.connect` below — see the note there for why that\n * merge is forward-looking plumbing rather than active outbound auth today.\n */\n agent?: AgentWithHeaders;\n /** Caller identity; the runner hides threads owned by anyone else. */\n ownerId?: string;\n}\n\nexport function handleSseConnect({\n runtime,\n request,\n agentId,\n threadId,\n agent,\n ownerId,\n}: HandleSseConnectParams): Response {\n return createSseEventResponse({\n request,\n debugEventBus: runtime.debugEventBus,\n // Forward the real agentId so debug envelopes reflect the agent the\n // route resolved to — not the literal string \"connect\".\n agentId,\n telemetry: runtime.telemetry,\n logger: getRuntimeLogger(runtime),\n keepAliveIntervalSeconds: runtime.sseKeepAliveIntervalSeconds,\n observableFactory: () =>\n runtime.runner.connect({\n threadId,\n agentId,\n ...(ownerId === undefined ? {} : { ownerId }),\n // Forward-looking plumbing: we compute the merged header set (server\n // `agent.headers` win on collision, case-insensitively; non-colliding\n // inbound headers still forward — see `mergeForwardableHeaders`, #5712)\n // and thread it into `runner.connect`. NO shipped runner consumes the\n // `headers` field of `AgentRunnerConnectRequest` today — every runner\n // (in-memory, intelligence, telemetry, sqlite) ignores it.\n // The real outbound header forwarding is the /run path, where\n // `cloneAgentForRequest` mutates `agent.headers` directly\n // (agent-utils.ts). This wiring exists so a future outbound-connecting\n // runner can pick the merged headers up without a route change; the\n // collision precedence noted here is purely about that merge, not about\n // middleware/mutation parity with /run.\n headers: mergeForwardableHeaders(\n agent?.headers,\n request,\n // Optional on `CopilotKitRuntimeLike` (non-breaking minor release);\n // coalesce a policy-less external implementor to the default resolved\n // policy (default-on denylist) instead of dereffing undefined.\n runtime.forwardHeadersPolicy ??\n resolveForwardHeadersPolicy(undefined),\n ),\n }),\n });\n}\n"],"mappings":";;;;;AAmCA,SAAgB,iBAAiB,EAC/B,SACA,SACA,SACA,UACA,OACA,WACmC;AACnC,QAAO,uBAAuB;EAC5B;EACA,eAAe,QAAQ;EAGvB;EACA,WAAW,QAAQ;EACnB,QAAQ,iBAAiB,QAAQ;EACjC,0BAA0B,QAAQ;EAClC,yBACE,QAAQ,OAAO,QAAQ;GACrB;GACA;GACA,GAAI,YAAY,SAAY,EAAE,GAAG,EAAE,SAAS;GAa5C,SAAS,wBACP,OAAO,SACP,SAIA,QAAQ,wBACN,4BAA4B,OAAU,CACzC;GACF,CAAC;EACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.cjs","names":["getRuntimeLogger","isThreadAccessDeniedError","threadAccessDeniedResponse","createSseEventResponse","getRuntimeErrorReporter"],"sources":["../../../../src/runtime/handlers/sse/run.ts"],"sourcesContent":["import type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport type { Observable } from \"rxjs\";\nimport { isThreadAccessDeniedError } from \"../../runner/agent-runner\";\nimport { threadAccessDeniedResponse } from \"../shared/thread-access\";\nimport type { ResolvedDebugConfig, ModelHostClass } from \"@copilotkit/shared\";\nimport { getRuntimeLogger } from \"../../core/logger\";\nimport type {
|
|
1
|
+
{"version":3,"file":"run.cjs","names":["getRuntimeLogger","isThreadAccessDeniedError","threadAccessDeniedResponse","createSseEventResponse","getRuntimeErrorReporter"],"sources":["../../../../src/runtime/handlers/sse/run.ts"],"sourcesContent":["import type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport type { Observable } from \"rxjs\";\nimport { isThreadAccessDeniedError } from \"../../runner/agent-runner\";\nimport { threadAccessDeniedResponse } from \"../shared/thread-access\";\nimport type { ResolvedDebugConfig, ModelHostClass } from \"@copilotkit/shared\";\nimport { getRuntimeLogger } from \"../../core/logger\";\nimport type { CopilotKitRuntimeLogger } from \"../../core/logger\";\nimport type { CopilotKitRuntimeLike } from \"../../core/runtime\";\nimport { getRuntimeErrorReporter } from \"../../core/runtime-error-reporter\";\nimport { createSseEventResponse } from \"../shared/sse-response\";\n\ninterface HandleSseRunParams {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n agent: AbstractAgent;\n input: RunAgentInput;\n agentId: string;\n debug?: ResolvedDebugConfig;\n /** Pre-created debug logger, so a request does not create its own. */\n debugLogger?: CopilotKitRuntimeLogger;\n startTime?: number;\n /** Identity the run acts as; the runner records it as the thread owner. */\n ownerId?: string;\n}\n\nexport function handleSseRun({\n runtime,\n request,\n agent,\n input,\n agentId,\n debug,\n debugLogger,\n startTime,\n ownerId,\n}: HandleSseRunParams): Response {\n const logger = getRuntimeLogger(runtime);\n // Start the run before the stream opens. When another identity claimed the\n // thread after the handler's owner check, the runner refuses at once, and\n // that refusal becomes the same HTTP error as the check's, not a streamed\n // agent failure. Any other start error still reaches the client as a\n // RUN_ERROR on the stream, as before.\n let started: Observable<BaseEvent> | undefined;\n let startError: unknown;\n try {\n started = runtime.runner.run({\n threadId: input.threadId,\n agent,\n input,\n ...(ownerId === undefined ? {} : { ownerId }),\n });\n } catch (error) {\n if (isThreadAccessDeniedError(error)) {\n logger.warn(\n \"[CopilotKit] Run refused: the thread belongs to another identity.\",\n );\n return threadAccessDeniedResponse();\n }\n startError = error;\n }\n\n return createSseEventResponse({\n request,\n debugEventBus: runtime.debugEventBus,\n agentId,\n debug,\n debugLogger,\n logger,\n runtimeErrorReporter: getRuntimeErrorReporter(runtime),\n startTime,\n telemetry: runtime.telemetry,\n keepAliveIntervalSeconds: runtime.sseKeepAliveIntervalSeconds,\n // Read structurally rather than via `instanceof BuiltInAgent`, which would\n // pull the agent module into this handler. Any agent can opt in by\n // exposing the same property.\n executionSeed: {\n llmHostClass:\n (agent as { modelHostClass?: ModelHostClass }).modelHostClass ??\n \"unknown\",\n },\n observableFactory: () => {\n if (started === undefined) throw startError;\n return started;\n },\n });\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,aAAa,EAC3B,SACA,SACA,OACA,OACA,SACA,OACA,aACA,WACA,WAC+B;CAC/B,MAAM,SAASA,gCAAiB,QAAQ;CAMxC,IAAI;CACJ,IAAI;AACJ,KAAI;AACF,YAAU,QAAQ,OAAO,IAAI;GAC3B,UAAU,MAAM;GAChB;GACA;GACA,GAAI,YAAY,SAAY,EAAE,GAAG,EAAE,SAAS;GAC7C,CAAC;UACK,OAAO;AACd,MAAIC,+CAA0B,MAAM,EAAE;AACpC,UAAO,KACL,oEACD;AACD,UAAOC,kDAA4B;;AAErC,eAAa;;AAGf,QAAOC,4CAAuB;EAC5B;EACA,eAAe,QAAQ;EACvB;EACA;EACA;EACA;EACA,sBAAsBC,uDAAwB,QAAQ;EACtD;EACA,WAAW,QAAQ;EACnB,0BAA0B,QAAQ;EAIlC,eAAe,EACb,cACG,MAA8C,kBAC/C,WACH;EACD,yBAAyB;AACvB,OAAI,YAAY,OAAW,OAAM;AACjC,UAAO;;EAEV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.mjs","names":[],"sources":["../../../../src/runtime/handlers/sse/run.ts"],"sourcesContent":["import type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport type { Observable } from \"rxjs\";\nimport { isThreadAccessDeniedError } from \"../../runner/agent-runner\";\nimport { threadAccessDeniedResponse } from \"../shared/thread-access\";\nimport type { ResolvedDebugConfig, ModelHostClass } from \"@copilotkit/shared\";\nimport { getRuntimeLogger } from \"../../core/logger\";\nimport type {
|
|
1
|
+
{"version":3,"file":"run.mjs","names":[],"sources":["../../../../src/runtime/handlers/sse/run.ts"],"sourcesContent":["import type { AbstractAgent, BaseEvent, RunAgentInput } from \"@ag-ui/client\";\nimport type { Observable } from \"rxjs\";\nimport { isThreadAccessDeniedError } from \"../../runner/agent-runner\";\nimport { threadAccessDeniedResponse } from \"../shared/thread-access\";\nimport type { ResolvedDebugConfig, ModelHostClass } from \"@copilotkit/shared\";\nimport { getRuntimeLogger } from \"../../core/logger\";\nimport type { CopilotKitRuntimeLogger } from \"../../core/logger\";\nimport type { CopilotKitRuntimeLike } from \"../../core/runtime\";\nimport { getRuntimeErrorReporter } from \"../../core/runtime-error-reporter\";\nimport { createSseEventResponse } from \"../shared/sse-response\";\n\ninterface HandleSseRunParams {\n runtime: CopilotKitRuntimeLike;\n request: Request;\n agent: AbstractAgent;\n input: RunAgentInput;\n agentId: string;\n debug?: ResolvedDebugConfig;\n /** Pre-created debug logger, so a request does not create its own. */\n debugLogger?: CopilotKitRuntimeLogger;\n startTime?: number;\n /** Identity the run acts as; the runner records it as the thread owner. */\n ownerId?: string;\n}\n\nexport function handleSseRun({\n runtime,\n request,\n agent,\n input,\n agentId,\n debug,\n debugLogger,\n startTime,\n ownerId,\n}: HandleSseRunParams): Response {\n const logger = getRuntimeLogger(runtime);\n // Start the run before the stream opens. When another identity claimed the\n // thread after the handler's owner check, the runner refuses at once, and\n // that refusal becomes the same HTTP error as the check's, not a streamed\n // agent failure. Any other start error still reaches the client as a\n // RUN_ERROR on the stream, as before.\n let started: Observable<BaseEvent> | undefined;\n let startError: unknown;\n try {\n started = runtime.runner.run({\n threadId: input.threadId,\n agent,\n input,\n ...(ownerId === undefined ? {} : { ownerId }),\n });\n } catch (error) {\n if (isThreadAccessDeniedError(error)) {\n logger.warn(\n \"[CopilotKit] Run refused: the thread belongs to another identity.\",\n );\n return threadAccessDeniedResponse();\n }\n startError = error;\n }\n\n return createSseEventResponse({\n request,\n debugEventBus: runtime.debugEventBus,\n agentId,\n debug,\n debugLogger,\n logger,\n runtimeErrorReporter: getRuntimeErrorReporter(runtime),\n startTime,\n telemetry: runtime.telemetry,\n keepAliveIntervalSeconds: runtime.sseKeepAliveIntervalSeconds,\n // Read structurally rather than via `instanceof BuiltInAgent`, which would\n // pull the agent module into this handler. Any agent can opt in by\n // exposing the same property.\n executionSeed: {\n llmHostClass:\n (agent as { modelHostClass?: ModelHostClass }).modelHostClass ??\n \"unknown\",\n },\n observableFactory: () => {\n if (started === undefined) throw startError;\n return started;\n },\n });\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,aAAa,EAC3B,SACA,SACA,OACA,OACA,SACA,OACA,aACA,WACA,WAC+B;CAC/B,MAAM,SAAS,iBAAiB,QAAQ;CAMxC,IAAI;CACJ,IAAI;AACJ,KAAI;AACF,YAAU,QAAQ,OAAO,IAAI;GAC3B,UAAU,MAAM;GAChB;GACA;GACA,GAAI,YAAY,SAAY,EAAE,GAAG,EAAE,SAAS;GAC7C,CAAC;UACK,OAAO;AACd,MAAI,0BAA0B,MAAM,EAAE;AACpC,UAAO,KACL,oEACD;AACD,UAAO,4BAA4B;;AAErC,eAAa;;AAGf,QAAO,uBAAuB;EAC5B;EACA,eAAe,QAAQ;EACvB;EACA;EACA;EACA;EACA,sBAAsB,wBAAwB,QAAQ;EACtD;EACA,WAAW,QAAQ;EACnB,0BAA0B,QAAQ;EAIlC,eAAe,EACb,cACG,MAA8C,kBAC/C,WACH;EACD,yBAAyB;AACvB,OAAI,YAAY,OAAW,OAAM;AACjC,UAAO;;EAEV,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const require_agent_runner = require('./runner/agent-runner.cjs');
|
|
2
|
+
const require_learned_skills = require('./intelligence-platform/learned-skills.cjs');
|
|
3
|
+
const require_client = require('./intelligence-platform/client.cjs');
|
|
4
|
+
const require_in_memory = require('./runner/in-memory.cjs');
|
|
5
|
+
const require_intelligence = require('./runner/intelligence.cjs');
|
|
6
|
+
const require_runtime = require('./core/runtime.cjs');
|
|
7
|
+
const require_generative_ui_middleware = require('./generative-ui/generative-ui-middleware.cjs');
|
|
8
|
+
const require_a2ui_v09_middleware = require('./generative-ui/a2ui-v09-middleware.cjs');
|
|
9
|
+
const require_surface_writer = require('./generative-ui/surface-writer.cjs');
|
|
10
|
+
const require_open_generative_ui_middleware = require('./event-transforms/open-generative-ui-middleware.cjs');
|
|
11
|
+
const require_recorded_events = require('./event-transforms/recorded-events.cjs');
|
|
12
|
+
const require_transcription_service = require('./transcription-service/transcription-service.cjs');
|
|
13
|
+
const require_fetch_handler = require('./core/fetch-handler.cjs');
|
|
14
|
+
let _ag_ui_a2ui_middleware = require("@ag-ui/a2ui-middleware");
|
|
15
|
+
let _copilotkit_shared = require("@copilotkit/shared");
|
|
16
|
+
|
|
17
|
+
//#region src/runtime/index.ts
|
|
18
|
+
/** @deprecated Use CopilotKitRuntime. This old name is an alias with the same behavior. */
|
|
19
|
+
const CopilotRuntime = require_runtime.CopilotKitRuntime;
|
|
20
|
+
/** @deprecated Use CopilotKitSseRuntime. This old name is an alias with the same behavior. */
|
|
21
|
+
const CopilotSseRuntime = require_runtime.CopilotKitSseRuntime;
|
|
22
|
+
/** @deprecated Use CopilotKitIntelligenceRuntime. This old name is an alias with the same behavior. */
|
|
23
|
+
const CopilotIntelligenceRuntime = require_runtime.CopilotKitIntelligenceRuntime;
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.CopilotIntelligenceRuntime = CopilotIntelligenceRuntime;
|
|
27
|
+
exports.CopilotRuntime = CopilotRuntime;
|
|
28
|
+
exports.CopilotSseRuntime = CopilotSseRuntime;
|
|
29
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["CopilotKitRuntime","CopilotKitSseRuntime","CopilotKitIntelligenceRuntime"],"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,iBAAiBA;;AAK9B,MAAa,oBAAoBC;;AAKjC,MAAa,6BAA6BC"}
|
package/dist/runtime/index.d.cts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { experimental_d_exports } from "./intelligence-platform/experimental.cjs";
|
|
2
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.cjs";
|
|
3
3
|
import { ThreadAccessMode, ThreadsConfig } from "./handlers/shared/thread-access.cjs";
|
|
4
|
-
import {
|
|
4
|
+
import { CopilotKitRuntimeLogger } from "./core/logger.cjs";
|
|
5
5
|
import { TranscribeFileOptions, TranscriptionService } from "./transcription-service/transcription-service.cjs";
|
|
6
6
|
import { GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult } from "./intelligence-platform/learned-skills.cjs";
|
|
7
7
|
import "./intelligence-platform/index.cjs";
|
|
8
|
-
import { A2UIVersion, AgentFactoryContext, AgentsConfig, AgentsFactory,
|
|
9
|
-
import {
|
|
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.cjs";
|
|
9
|
+
import { CopilotKitRuntimeLearningConfig, CopilotKitRuntimeLearningContext, CopilotKitRuntimeUser, GetLearningContainerId, GetTrajectoryLearningContainerIds, LearningContainerSelectorInput, TrajectoryLearningContainerSelectorInput } from "./core/learning.cjs";
|
|
10
10
|
import { CopilotKitIntelligence, CopilotKitIntelligenceConfig, CreateThreadRequest, ListThreadsResponse, PlatformRequestError, SubscribeToThreadsRequest, SubscribeToThreadsResponse, ThreadSummary, UpdateThreadRequest } from "./intelligence-platform/client.cjs";
|
|
11
|
+
import { ChannelStatus, ChannelsControl } from "./core/channel-manager.cjs";
|
|
12
|
+
import { CopilotKitRuntimeHooks, ErrorHookContext, HandlerHookContext, HookContext, ResponseHookContext, RouteInfo } from "./core/hooks.cjs";
|
|
13
|
+
import { CopilotKitCorsConfig } from "./core/fetch-cors.cjs";
|
|
14
|
+
import { CopilotKitRuntimeFetchHandler, CopilotKitRuntimeFetchHandlerWithChannels, CopilotKitRuntimeHandlerOptions, createCopilotKitRuntimeHandler, createCopilotRuntimeHandler } from "./core/fetch-handler.cjs";
|
|
11
15
|
import { GenerativeUIMiddleware } from "./generative-ui/generative-ui-middleware.cjs";
|
|
12
16
|
import { A2UIV09BridgeMiddleware } from "./generative-ui/a2ui-v09-middleware.cjs";
|
|
13
17
|
import { GenerativeUISurfaceWriter, createSurfaceWriter } from "./generative-ui/surface-writer.cjs";
|
|
@@ -18,7 +22,54 @@ import { A2UIMiddleware, A2UIMiddlewareConfig } from "./event-transforms/index.c
|
|
|
18
22
|
import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵestimateBytes, ɵnormalizeLimits } from "./runner/in-memory.cjs";
|
|
19
23
|
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary, STOP_RECORD_DEADLINE_MS } from "./runner/intelligence.cjs";
|
|
20
24
|
import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./runner/index.cjs";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
//#region src/runtime/index.d.ts
|
|
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;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { CopilotCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, CopilotRuntimeHooks, CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeLike, CopilotRuntimeLogger, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions };
|
|
75
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","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"}
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { experimental_d_exports } from "./intelligence-platform/experimental.mjs";
|
|
2
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";
|
|
3
3
|
import { ThreadAccessMode, ThreadsConfig } from "./handlers/shared/thread-access.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { CopilotKitRuntimeLogger } from "./core/logger.mjs";
|
|
5
5
|
import { TranscribeFileOptions, TranscriptionService } from "./transcription-service/transcription-service.mjs";
|
|
6
6
|
import { GetLearnedSkillsSnapshotRequest, GetLearnedSkillsSnapshotsRequest, LearnedSkillsBatchResult, LearnedSkillsError, LearnedSkillsErrorCode, LearnedSkillsSnapshotResult } from "./intelligence-platform/learned-skills.mjs";
|
|
7
7
|
import "./intelligence-platform/index.mjs";
|
|
8
|
-
import { A2UIVersion, AgentFactoryContext, AgentsConfig, AgentsFactory,
|
|
9
|
-
import {
|
|
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
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";
|
|
11
15
|
import { GenerativeUIMiddleware } from "./generative-ui/generative-ui-middleware.mjs";
|
|
12
16
|
import { A2UIV09BridgeMiddleware } from "./generative-ui/a2ui-v09-middleware.mjs";
|
|
13
17
|
import { GenerativeUISurfaceWriter, createSurfaceWriter } from "./generative-ui/surface-writer.mjs";
|
|
@@ -18,7 +22,54 @@ import { A2UIMiddleware, A2UIMiddlewareConfig } from "./event-transforms/index.m
|
|
|
18
22
|
import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵOWNER_RETENTION_DEFAULTS, ɵOwnerRetention, ɵestimateBytes, ɵnormalizeLimits } from "./runner/in-memory.mjs";
|
|
19
23
|
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary, STOP_RECORD_DEADLINE_MS } from "./runner/intelligence.mjs";
|
|
20
24
|
import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "./runner/index.mjs";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
|
|
26
|
+
//#region src/runtime/index.d.ts
|
|
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;
|
|
73
|
+
//#endregion
|
|
74
|
+
export { CopilotCorsConfig, CopilotIntelligenceRuntime, CopilotIntelligenceRuntimeLike, CopilotIntelligenceRuntimeOptions, CopilotRuntime, CopilotRuntimeConstructor, CopilotRuntimeFetchHandler, CopilotRuntimeFetchHandlerWithChannels, CopilotRuntimeHandlerOptions, CopilotRuntimeHooks, CopilotRuntimeLearningConfig, CopilotRuntimeLearningContext, CopilotRuntimeLike, CopilotRuntimeLogger, CopilotRuntimeMemoryConfig, CopilotRuntimeOptions, CopilotRuntimeUser, CopilotSseRuntime, CopilotSseRuntimeLike, CopilotSseRuntimeOptions };
|
|
75
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -1 +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 {
|
|
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"}
|
|
@@ -1 +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 {
|
|
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"}
|
|
@@ -194,16 +194,16 @@ function cloneRuntimeEntitlementError(error) {
|
|
|
194
194
|
* Client for the CopilotKit Intelligence REST API.
|
|
195
195
|
*
|
|
196
196
|
* Construct the client once and pass it to any consumers that need it
|
|
197
|
-
* (e.g. `
|
|
197
|
+
* (e.g. `CopilotKitRuntime`, `IntelligenceAgentRunner`):
|
|
198
198
|
*
|
|
199
199
|
* ```ts
|
|
200
|
-
* import { CopilotKitIntelligence,
|
|
200
|
+
* import { CopilotKitIntelligence, CopilotKitRuntime } from "@copilotkit/runtime";
|
|
201
201
|
*
|
|
202
202
|
* const intelligence = new CopilotKitIntelligence({
|
|
203
203
|
* apiKey: process.env.CPK_INTELLIGENCE_API_KEY!,
|
|
204
204
|
* });
|
|
205
205
|
*
|
|
206
|
-
* const runtime = new
|
|
206
|
+
* const runtime = new CopilotKitRuntime({
|
|
207
207
|
* agents,
|
|
208
208
|
* intelligence,
|
|
209
209
|
* });
|