@copilotkit/runtime 1.71.2 → 1.72.1-canary.sp-longthread-perf
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/dist/agent/index.cjs +35 -1
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +36 -2
- package/dist/agent/index.d.cts.map +1 -1
- package/dist/agent/index.d.mts +36 -2
- package/dist/agent/index.d.mts.map +1 -1
- package/dist/agent/index.mjs +36 -3
- package/dist/agent/index.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +23 -16
- package/dist/index.d.mts +23 -16
- package/dist/index.mjs +1 -1
- package/dist/langgraph.d.cts +3 -1
- package/dist/langgraph.d.mts +3 -1
- package/dist/lib/index.cjs +1 -1
- package/dist/lib/index.cjs.map +1 -1
- package/dist/lib/index.d.cts.map +1 -1
- package/dist/lib/index.d.mts.map +1 -1
- package/dist/lib/index.mjs +1 -1
- package/dist/lib/index.mjs.map +1 -1
- package/dist/lib/integrations/nextjs/app-router.cjs.map +1 -1
- package/dist/lib/integrations/nextjs/app-router.mjs.map +1 -1
- package/dist/lib/integrations/node-express/index.cjs.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs.map +1 -1
- package/dist/lib/integrations/node-http/index.cjs.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs.map +1 -1
- package/dist/lib/runtime/copilot-runtime.cjs +15 -24
- package/dist/lib/runtime/copilot-runtime.cjs.map +1 -1
- package/dist/lib/runtime/copilot-runtime.d.cts.map +1 -1
- package/dist/lib/runtime/copilot-runtime.d.mts.map +1 -1
- package/dist/lib/runtime/copilot-runtime.mjs +16 -25
- package/dist/lib/runtime/copilot-runtime.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/service-adapters/experimental/ollama/ollama-adapter.cjs +16 -0
- package/dist/service-adapters/experimental/ollama/ollama-adapter.cjs.map +1 -1
- package/dist/service-adapters/experimental/ollama/ollama-adapter.d.cts +14 -0
- package/dist/service-adapters/experimental/ollama/ollama-adapter.d.cts.map +1 -1
- package/dist/service-adapters/experimental/ollama/ollama-adapter.d.mts +14 -0
- package/dist/service-adapters/experimental/ollama/ollama-adapter.d.mts.map +1 -1
- package/dist/service-adapters/experimental/ollama/ollama-adapter.mjs +16 -0
- package/dist/service-adapters/experimental/ollama/ollama-adapter.mjs.map +1 -1
- package/dist/service-adapters/google/google-genai-adapter.cjs +17 -0
- package/dist/service-adapters/google/google-genai-adapter.cjs.map +1 -1
- package/dist/service-adapters/google/google-genai-adapter.d.cts +10 -0
- package/dist/service-adapters/google/google-genai-adapter.d.cts.map +1 -1
- package/dist/service-adapters/google/google-genai-adapter.d.mts +10 -0
- package/dist/service-adapters/google/google-genai-adapter.d.mts.map +1 -1
- package/dist/service-adapters/google/google-genai-adapter.mjs +16 -0
- package/dist/service-adapters/google/google-genai-adapter.mjs.map +1 -1
- package/dist/service-adapters/unify/unify-adapter.cjs +14 -2
- package/dist/service-adapters/unify/unify-adapter.cjs.map +1 -1
- package/dist/service-adapters/unify/unify-adapter.d.cts +9 -1
- package/dist/service-adapters/unify/unify-adapter.d.cts.map +1 -1
- package/dist/service-adapters/unify/unify-adapter.d.mts +9 -1
- package/dist/service-adapters/unify/unify-adapter.d.mts.map +1 -1
- package/dist/service-adapters/unify/unify-adapter.mjs +14 -2
- package/dist/service-adapters/unify/unify-adapter.mjs.map +1 -1
- package/dist/v2/index.cjs +1 -0
- package/dist/v2/index.d.cts +2 -2
- package/dist/v2/index.d.mts +2 -2
- package/dist/v2/index.mjs +2 -2
- package/dist/v2/runtime/core/channel-manager.d.mts +1 -0
- package/dist/v2/runtime/core/channel-manager.d.mts.map +1 -1
- package/dist/v2/runtime/core/debug-event-bus.cjs +22 -0
- package/dist/v2/runtime/core/debug-event-bus.cjs.map +1 -1
- package/dist/v2/runtime/core/debug-event-bus.d.cts +1 -1
- package/dist/v2/runtime/core/debug-event-bus.d.mts +1 -1
- package/dist/v2/runtime/core/debug-event-bus.mjs +22 -1
- package/dist/v2/runtime/core/debug-event-bus.mjs.map +1 -1
- package/dist/v2/runtime/core/runtime.cjs +5 -5
- package/dist/v2/runtime/core/runtime.cjs.map +1 -1
- package/dist/v2/runtime/core/runtime.d.cts +11 -0
- package/dist/v2/runtime/core/runtime.d.cts.map +1 -1
- package/dist/v2/runtime/core/runtime.d.mts +11 -0
- package/dist/v2/runtime/core/runtime.d.mts.map +1 -1
- package/dist/v2/runtime/core/runtime.mjs +6 -6
- package/dist/v2/runtime/core/runtime.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-connect.cjs +3 -2
- package/dist/v2/runtime/handlers/handle-connect.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-connect.mjs +3 -2
- package/dist/v2/runtime/handlers/handle-connect.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-debug-events.cjs +2 -1
- package/dist/v2/runtime/handlers/handle-debug-events.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-debug-events.mjs +3 -1
- package/dist/v2/runtime/handlers/handle-debug-events.mjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-run.cjs +5 -3
- package/dist/v2/runtime/handlers/handle-run.cjs.map +1 -1
- package/dist/v2/runtime/handlers/handle-run.mjs +5 -3
- package/dist/v2/runtime/handlers/handle-run.mjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.cjs +31 -0
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.cjs.map +1 -0
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.mjs +30 -0
- package/dist/v2/runtime/handlers/shared/cloud-telemetry.mjs.map +1 -0
- package/dist/v2/runtime/handlers/shared/sse-response.cjs +31 -3
- package/dist/v2/runtime/handlers/shared/sse-response.cjs.map +1 -1
- package/dist/v2/runtime/handlers/shared/sse-response.mjs +31 -3
- package/dist/v2/runtime/handlers/shared/sse-response.mjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/run.cjs +1 -0
- package/dist/v2/runtime/handlers/sse/run.cjs.map +1 -1
- package/dist/v2/runtime/handlers/sse/run.mjs +1 -0
- package/dist/v2/runtime/handlers/sse/run.mjs.map +1 -1
- package/dist/v2/runtime/telemetry/events.d.cts +12 -0
- package/dist/v2/runtime/telemetry/events.d.cts.map +1 -1
- package/dist/v2/runtime/telemetry/events.d.mts +12 -0
- package/dist/v2/runtime/telemetry/events.d.mts.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.cjs +3 -2
- package/dist/v2/runtime/telemetry/telemetry-client.cjs.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.d.cts.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.d.mts.map +1 -1
- package/dist/v2/runtime/telemetry/telemetry-client.mjs +7 -6
- package/dist/v2/runtime/telemetry/telemetry-client.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -314,7 +314,8 @@ LangChainAdapter, /**
|
|
|
314
314
|
*/
|
|
315
315
|
LangGraphAgent, /**
|
|
316
316
|
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
317
|
-
*
|
|
317
|
+
* Use `HttpAgent` from `@ag-ui/client`, passed to the v2 `CopilotRuntime`.
|
|
318
|
+
* Exception: a v1 client still resuming interrupts through `forwardedProps.command.resume` — `LangGraphHttpAgent` keeps a back-compat bridge for that channel.
|
|
318
319
|
* Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph
|
|
319
320
|
* Start with `@copilotkit/runtime/v2`.
|
|
320
321
|
* V2 docs: https://docs.copilotkit.ai/
|
|
@@ -553,11 +554,13 @@ copilotKitEndpoint, /**
|
|
|
553
554
|
*/
|
|
554
555
|
copilotRuntimeNestEndpoint, /**
|
|
555
556
|
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
560
|
-
*
|
|
557
|
+
* Use `createCopilotRuntimeHandler` from `@copilotkit/runtime/v2` instead.
|
|
558
|
+
* Import and usage example:
|
|
559
|
+
* ```ts
|
|
560
|
+
* import { createCopilotRuntimeHandler } from "@copilotkit/runtime/v2";
|
|
561
|
+
* const v2CreateCopilotRuntimeHandler = createCopilotRuntimeHandler;
|
|
562
|
+
* ```
|
|
563
|
+
* See https://docs.copilotkit.ai/runtime-server-adapter
|
|
561
564
|
* Migration guide: https://docs.copilotkit.ai/migrate/v2
|
|
562
565
|
*/
|
|
563
566
|
copilotRuntimeNextJSAppRouterEndpoint, /**
|
|
@@ -571,20 +574,24 @@ copilotRuntimeNextJSAppRouterEndpoint, /**
|
|
|
571
574
|
*/
|
|
572
575
|
copilotRuntimeNextJSPagesRouterEndpoint, /**
|
|
573
576
|
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
577
|
+
* Use `createCopilotExpressHandler` from `@copilotkit/runtime/v2/express` instead.
|
|
578
|
+
* Import and usage example:
|
|
579
|
+
* ```ts
|
|
580
|
+
* import { createCopilotExpressHandler } from "@copilotkit/runtime/v2/express";
|
|
581
|
+
* const v2CreateCopilotExpressHandler = createCopilotExpressHandler;
|
|
582
|
+
* ```
|
|
583
|
+
* See https://docs.copilotkit.ai/runtime-server-adapter
|
|
579
584
|
* Migration guide: https://docs.copilotkit.ai/migrate/v2
|
|
580
585
|
*/
|
|
581
586
|
copilotRuntimeNodeExpressEndpoint, /**
|
|
582
587
|
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
583
|
-
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
588
|
+
* Use `createCopilotRuntimeHandler` from `@copilotkit/runtime/v2` instead.
|
|
589
|
+
* Import and usage example:
|
|
590
|
+
* ```ts
|
|
591
|
+
* import { createCopilotRuntimeHandler } from "@copilotkit/runtime/v2";
|
|
592
|
+
* const v2CreateCopilotRuntimeHandler = createCopilotRuntimeHandler;
|
|
593
|
+
* ```
|
|
594
|
+
* See https://docs.copilotkit.ai/runtime-server-adapter
|
|
588
595
|
* Migration guide: https://docs.copilotkit.ai/migrate/v2
|
|
589
596
|
*/
|
|
590
597
|
copilotRuntimeNodeHttpEndpoint, /**
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,6 @@ import { UnifyAdapter } from "./service-adapters/unify/unify-adapter.mjs";
|
|
|
9
9
|
import { GroqAdapter } from "./service-adapters/groq/groq-adapter.mjs";
|
|
10
10
|
import { GuardrailsValidationFailureResponse, MessageStreamInterruptedResponse, UnknownErrorResponse } from "./utils/failed-response-status-reasons.mjs";
|
|
11
11
|
import { createLogger } from "./lib/logger.mjs";
|
|
12
|
-
import { TelemetryAgentRunner } from "./lib/runtime/telemetry-agent-runner.mjs";
|
|
13
12
|
import { convertMCPToolsToActions, extractParametersFromSchema, generateMcpToolInstructions } from "./lib/runtime/mcp-tools-utils.mjs";
|
|
14
13
|
import { CopilotRuntime, copilotKitEndpoint, langGraphPlatformEndpoint, resolveEndpointType } from "./lib/runtime/copilot-runtime.mjs";
|
|
15
14
|
import { buildSchema, getCommonConfig } from "./lib/integrations/shared.mjs";
|
|
@@ -18,6 +17,7 @@ import { copilotRuntimeNodeHttpEndpoint } from "./lib/integrations/node-http/ind
|
|
|
18
17
|
import { config, copilotRuntimeNextJSPagesRouterEndpoint } from "./lib/integrations/nextjs/pages-router.mjs";
|
|
19
18
|
import { copilotRuntimeNodeExpressEndpoint } from "./lib/integrations/node-express/index.mjs";
|
|
20
19
|
import { copilotRuntimeNestEndpoint } from "./lib/integrations/nest/index.mjs";
|
|
20
|
+
import { TelemetryAgentRunner } from "./lib/runtime/telemetry-agent-runner.mjs";
|
|
21
21
|
import { LangGraphAgent, LangGraphHttpAgent } from "./lib/index.mjs";
|
|
22
22
|
import { RemoteChain } from "./service-adapters/langchain/langserve.mjs";
|
|
23
23
|
import { AnthropicAdapter, FilterThinkingTextBuffer } from "./service-adapters/anthropic/anthropic-adapter.mjs";
|
package/dist/langgraph.d.cts
CHANGED
|
@@ -22,7 +22,9 @@ CustomEventNames, /**
|
|
|
22
22
|
*/
|
|
23
23
|
LangGraphAgent, /**
|
|
24
24
|
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
25
|
-
*
|
|
25
|
+
* Use `HttpAgent` from `@ag-ui/client`, passed to the v2 `CopilotRuntime`.
|
|
26
|
+
* Exception: a v1 client still resuming interrupts through `forwardedProps.command.resume` — `LangGraphHttpAgent` keeps a back-compat bridge for that channel.
|
|
27
|
+
* Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph
|
|
26
28
|
* Start with `@copilotkit/runtime/v2`.
|
|
27
29
|
* V2 docs: https://docs.copilotkit.ai/
|
|
28
30
|
* V2 reference docs: https://docs.copilotkit.ai/reference/v2
|
package/dist/langgraph.d.mts
CHANGED
|
@@ -22,7 +22,9 @@ CustomEventNames, /**
|
|
|
22
22
|
*/
|
|
23
23
|
LangGraphAgent, /**
|
|
24
24
|
* @deprecated Since 1.68.2. The v1 SDK is deprecated. Use v2 instead.
|
|
25
|
-
*
|
|
25
|
+
* Use `HttpAgent` from `@ag-ui/client`, passed to the v2 `CopilotRuntime`.
|
|
26
|
+
* Exception: a v1 client still resuming interrupts through `forwardedProps.command.resume` — `LangGraphHttpAgent` keeps a back-compat bridge for that channel.
|
|
27
|
+
* Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph
|
|
26
28
|
* Start with `@copilotkit/runtime/v2`.
|
|
27
29
|
* V2 docs: https://docs.copilotkit.ai/
|
|
28
30
|
* V2 reference docs: https://docs.copilotkit.ai/reference/v2
|
package/dist/lib/index.cjs
CHANGED
|
@@ -6,7 +6,6 @@ const require_openai_assistant_adapter = require('../service-adapters/openai/ope
|
|
|
6
6
|
const require_unify_adapter = require('../service-adapters/unify/unify-adapter.cjs');
|
|
7
7
|
const require_groq_adapter = require('../service-adapters/groq/groq-adapter.cjs');
|
|
8
8
|
const require_logger = require('./logger.cjs');
|
|
9
|
-
const require_telemetry_agent_runner = require('./runtime/telemetry-agent-runner.cjs');
|
|
10
9
|
const require_mcp_tools_utils = require('./runtime/mcp-tools-utils.cjs');
|
|
11
10
|
const require_copilot_runtime = require('./runtime/copilot-runtime.cjs');
|
|
12
11
|
const require_shared = require('./integrations/shared.cjs');
|
|
@@ -15,6 +14,7 @@ const require_index = require('./integrations/node-http/index.cjs');
|
|
|
15
14
|
const require_pages_router = require('./integrations/nextjs/pages-router.cjs');
|
|
16
15
|
const require_index$1 = require('./integrations/node-express/index.cjs');
|
|
17
16
|
const require_index$2 = require('./integrations/nest/index.cjs');
|
|
17
|
+
const require_telemetry_agent_runner = require('./runtime/telemetry-agent-runner.cjs');
|
|
18
18
|
|
|
19
19
|
//#region src/v1-deprecated/lib/index.ts
|
|
20
20
|
/**
|
package/dist/lib/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — CustomEventNames:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphAgent:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphHttpAgent:\n *
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — CustomEventNames:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphAgent:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphHttpAgent:\n * Use `HttpAgent` from `@ag-ui/client`, passed to the v2 `CopilotRuntime`.\n * Exception: a v1 client still resuming interrupts through `forwardedProps.command.resume` — `LangGraphHttpAgent` keeps a back-compat bridge for that channel.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — PredictStateTool:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — TextMessageEvents:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — ToolCallEvents:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nexport * from \"../service-adapters/openai/openai-adapter\";\nexport * from \"../service-adapters/langchain/langchain-adapter\";\nexport * from \"../service-adapters/google/google-genai-adapter\";\nexport * from \"../service-adapters/openai/openai-assistant-adapter\";\nexport * from \"../service-adapters/unify/unify-adapter\";\nexport * from \"../service-adapters/groq/groq-adapter\";\nexport * from \"./integrations\";\nexport * from \"./logger\";\nexport * from \"./runtime/copilot-runtime\";\nexport * from \"./runtime/mcp-tools-utils\";\nexport * from \"./runtime/telemetry-agent-runner\";\n\n// The below re-exports \"dummy\" classes and types, to get a deprecation warning redirecting the users to import these from the correct, new route\n\n/**\n * @deprecated LangGraphAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport class LangGraphAgent {\n constructor() {\n throw new Error(\n \"LangGraphAgent import from @copilotkit/runtime is deprecated. Please import it from @copilotkit/runtime/langgraph instead\",\n );\n }\n}\n\n/**\n * @deprecated LangGraphHttpAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport class LangGraphHttpAgent {\n constructor() {\n throw new Error(\n \"LangGraphHttpAgent import from @copilotkit/runtime is deprecated. Please import it from @copilotkit/runtime/langgraph instead\",\n );\n }\n}\n\n/**\n * @deprecated TextMessageEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type TextMessageEvents = any;\n/**\n * @deprecated ToolCallEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type ToolCallEvents = any;\n/**\n * @deprecated CustomEventNames import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type CustomEventNames = any;\n/**\n * @deprecated PredictStateTool import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type PredictStateTool = any;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwEA,IAAa,iBAAb,MAA4B;CAC1B,cAAc;AACZ,QAAM,IAAI,MACR,4HACD;;;;;;AAOL,IAAa,qBAAb,MAAgC;CAC9B,cAAc;AACZ,QAAM,IAAI,MACR,gIACD"}
|
package/dist/lib/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;cAwEa,cAAA;EAAc,WAAA,CAAA;AAAA;;;;cAWd,kBAAA;EAAkB,WAAA,CAAA;AAAA;;;AAA/B;KAWY,iBAAA;;;;KAIA,cAAA;;;;KAIA,gBAAA;AAJZ;;;AAAA,KAQY,gBAAA"}
|
package/dist/lib/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;cAwEa,cAAA;EAAc,WAAA,CAAA;AAAA;;;;cAWd,kBAAA;EAAkB,WAAA,CAAA;AAAA;;;AAA/B;KAWY,iBAAA;;;;KAIA,cAAA;;;;KAIA,gBAAA;AAJZ;;;AAAA,KAQY,gBAAA"}
|
package/dist/lib/index.mjs
CHANGED
|
@@ -6,7 +6,6 @@ import { OpenAIAssistantAdapter } from "../service-adapters/openai/openai-assist
|
|
|
6
6
|
import { UnifyAdapter } from "../service-adapters/unify/unify-adapter.mjs";
|
|
7
7
|
import { GroqAdapter } from "../service-adapters/groq/groq-adapter.mjs";
|
|
8
8
|
import { createLogger } from "./logger.mjs";
|
|
9
|
-
import { TelemetryAgentRunner } from "./runtime/telemetry-agent-runner.mjs";
|
|
10
9
|
import { convertMCPToolsToActions, extractParametersFromSchema, generateMcpToolInstructions } from "./runtime/mcp-tools-utils.mjs";
|
|
11
10
|
import { CopilotRuntime, copilotKitEndpoint, langGraphPlatformEndpoint, resolveEndpointType } from "./runtime/copilot-runtime.mjs";
|
|
12
11
|
import { buildSchema, getCommonConfig } from "./integrations/shared.mjs";
|
|
@@ -15,6 +14,7 @@ import { copilotRuntimeNodeHttpEndpoint } from "./integrations/node-http/index.m
|
|
|
15
14
|
import { config, copilotRuntimeNextJSPagesRouterEndpoint } from "./integrations/nextjs/pages-router.mjs";
|
|
16
15
|
import { copilotRuntimeNodeExpressEndpoint } from "./integrations/node-express/index.mjs";
|
|
17
16
|
import { copilotRuntimeNestEndpoint } from "./integrations/nest/index.mjs";
|
|
17
|
+
import { TelemetryAgentRunner } from "./runtime/telemetry-agent-runner.mjs";
|
|
18
18
|
|
|
19
19
|
//#region src/v1-deprecated/lib/index.ts
|
|
20
20
|
/**
|
package/dist/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — CustomEventNames:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphAgent:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphHttpAgent:\n *
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/v1-deprecated/lib/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — CustomEventNames:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphAgent:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — LangGraphHttpAgent:\n * Use `HttpAgent` from `@ag-ui/client`, passed to the v2 `CopilotRuntime`.\n * Exception: a v1 client still resuming interrupts through `forwardedProps.command.resume` — `LangGraphHttpAgent` keeps a back-compat bridge for that channel.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — PredictStateTool:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — TextMessageEvents:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * @copilotkit/runtime — ToolCallEvents:\n * No 1:1 v2 replacement is available.\n * Related v2 docs (LangGraph agents): https://docs.copilotkit.ai/agent-spec/langgraph\n * Start at: @copilotkit/runtime/v2\n * V2 docs: https://docs.copilotkit.ai/\n * V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nexport * from \"../service-adapters/openai/openai-adapter\";\nexport * from \"../service-adapters/langchain/langchain-adapter\";\nexport * from \"../service-adapters/google/google-genai-adapter\";\nexport * from \"../service-adapters/openai/openai-assistant-adapter\";\nexport * from \"../service-adapters/unify/unify-adapter\";\nexport * from \"../service-adapters/groq/groq-adapter\";\nexport * from \"./integrations\";\nexport * from \"./logger\";\nexport * from \"./runtime/copilot-runtime\";\nexport * from \"./runtime/mcp-tools-utils\";\nexport * from \"./runtime/telemetry-agent-runner\";\n\n// The below re-exports \"dummy\" classes and types, to get a deprecation warning redirecting the users to import these from the correct, new route\n\n/**\n * @deprecated LangGraphAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport class LangGraphAgent {\n constructor() {\n throw new Error(\n \"LangGraphAgent import from @copilotkit/runtime is deprecated. Please import it from @copilotkit/runtime/langgraph instead\",\n );\n }\n}\n\n/**\n * @deprecated LangGraphHttpAgent import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport class LangGraphHttpAgent {\n constructor() {\n throw new Error(\n \"LangGraphHttpAgent import from @copilotkit/runtime is deprecated. Please import it from @copilotkit/runtime/langgraph instead\",\n );\n }\n}\n\n/**\n * @deprecated TextMessageEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type TextMessageEvents = any;\n/**\n * @deprecated ToolCallEvents import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type ToolCallEvents = any;\n/**\n * @deprecated CustomEventNames import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type CustomEventNames = any;\n/**\n * @deprecated PredictStateTool import from `@copilotkit/runtime` is deprecated. Please import it from `@copilotkit/runtime/langgraph` instead\n */\nexport type PredictStateTool = any;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwEA,IAAa,iBAAb,MAA4B;CAC1B,cAAc;AACZ,QAAM,IAAI,MACR,4HACD;;;;;;AAOL,IAAa,qBAAb,MAAgC;CAC9B,cAAc;AACZ,QAAM,IAAI,MACR,gIACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-router.cjs","names":["getCommonConfig","getRuntimeInstanceTelemetryInfo","createCopilotEndpointSingleRoute"],"sources":["../../../../../src/v1-deprecated/lib/integrations/nextjs/app-router.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNextJSAppRouterEndpoint:\n *
|
|
1
|
+
{"version":3,"file":"app-router.cjs","names":["getCommonConfig","getRuntimeInstanceTelemetryInfo","createCopilotEndpointSingleRoute"],"sources":["../../../../../src/v1-deprecated/lib/integrations/nextjs/app-router.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNextJSAppRouterEndpoint:\n * V2 import and usage:\n * import { createCopilotRuntimeHandler } from \"@copilotkit/runtime/v2\";\n * const v2CreateCopilotRuntimeHandler = createCopilotRuntimeHandler;\n * V2 replacement source: packages/runtime/src/v2/runtime/core/fetch-handler.ts\n * V2 docs: https://docs.copilotkit.ai/runtime-server-adapter\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nimport { createCopilotEndpointSingleRoute } from \"../../../../v2/runtime\";\nimport type { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { getCommonConfig } from \"../shared\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\nimport { handle } from \"hono/vercel\";\n\nexport function copilotRuntimeNextJSAppRouterEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-app-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n options.runtime.telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS App Router endpoint\");\n\n const serviceAdapter = options.serviceAdapter;\n if (serviceAdapter) {\n options.runtime.handleServiceAdapter(serviceAdapter);\n }\n\n // Note: cors option requires @copilotkit/runtime with credentials support\n const copilotRoute = createCopilotEndpointSingleRoute({\n runtime: options.runtime.instance,\n basePath: options.baseUrl ?? options.endpoint,\n ...(options.cors && { cors: options.cors }),\n } as any);\n\n const handleRequest = handle(copilotRoute as any);\n return { handleRequest };\n}\n"],"mappings":";;;;;;;;AA2BA,SAAgB,sCACd,SACA;CACA,MAAM,eAAeA,+BAAgB,QAAQ;AAE7C,kCAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,qBACZ,EACF,CAAC;AAEF,KAAI,QAAQ,YAAY,YACtB,kCAAU,oBAAoB,EAC5B,aAAa,QAAQ,WAAW,aACjC,CAAC;AAGJ,SAAQ,QAAQ,UAAU,QACxB,gCACAC,yDAAgC,QAAQ,CACzC;AAGD,CADe,aAAa,QACrB,MAAM,sCAAsC;CAEnD,MAAM,iBAAiB,QAAQ;AAC/B,KAAI,eACF,SAAQ,QAAQ,qBAAqB,eAAe;AAWtD,QAAO,EAAE,uCAPYC,qDAAiC;EACpD,SAAS,QAAQ,QAAQ;EACzB,UAAU,QAAQ,WAAW,QAAQ;EACrC,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,MAAM;EAC3C,CAAQ,CAEwC,EACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-router.mjs","names":[],"sources":["../../../../../src/v1-deprecated/lib/integrations/nextjs/app-router.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNextJSAppRouterEndpoint:\n *
|
|
1
|
+
{"version":3,"file":"app-router.mjs","names":[],"sources":["../../../../../src/v1-deprecated/lib/integrations/nextjs/app-router.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNextJSAppRouterEndpoint:\n * V2 import and usage:\n * import { createCopilotRuntimeHandler } from \"@copilotkit/runtime/v2\";\n * const v2CreateCopilotRuntimeHandler = createCopilotRuntimeHandler;\n * V2 replacement source: packages/runtime/src/v2/runtime/core/fetch-handler.ts\n * V2 docs: https://docs.copilotkit.ai/runtime-server-adapter\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nimport { createCopilotEndpointSingleRoute } from \"../../../../v2/runtime\";\nimport type { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { getCommonConfig } from \"../shared\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\nimport { handle } from \"hono/vercel\";\n\nexport function copilotRuntimeNextJSAppRouterEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"nextjs-app-router\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n options.runtime.telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating NextJS App Router endpoint\");\n\n const serviceAdapter = options.serviceAdapter;\n if (serviceAdapter) {\n options.runtime.handleServiceAdapter(serviceAdapter);\n }\n\n // Note: cors option requires @copilotkit/runtime with credentials support\n const copilotRoute = createCopilotEndpointSingleRoute({\n runtime: options.runtime.instance,\n basePath: options.baseUrl ?? options.endpoint,\n ...(options.cors && { cors: options.cors }),\n } as any);\n\n const handleRequest = handle(copilotRoute as any);\n return { handleRequest };\n}\n"],"mappings":";;;;;;;AA2BA,SAAgB,sCACd,SACA;CACA,MAAM,eAAe,gBAAgB,QAAQ;AAE7C,iBAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,qBACZ,EACF,CAAC;AAEF,KAAI,QAAQ,YAAY,YACtB,iBAAU,oBAAoB,EAC5B,aAAa,QAAQ,WAAW,aACjC,CAAC;AAGJ,SAAQ,QAAQ,UAAU,QACxB,gCACA,gCAAgC,QAAQ,CACzC;AAGD,CADe,aAAa,QACrB,MAAM,sCAAsC;CAEnD,MAAM,iBAAiB,QAAQ;AAC/B,KAAI,eACF,SAAQ,QAAQ,qBAAqB,eAAe;AAWtD,QAAO,EAAE,eADa,OAND,iCAAiC;EACpD,SAAS,QAAQ,QAAQ;EACzB,UAAU,QAAQ,WAAW,QAAQ;EACrC,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,MAAM;EAC3C,CAAQ,CAEwC,EACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getRuntimeInstanceTelemetryInfo","copilotRuntimeNodeHttpEndpoint"],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-express/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeExpressEndpoint:\n *
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getRuntimeInstanceTelemetryInfo","copilotRuntimeNodeHttpEndpoint"],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-express/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeExpressEndpoint:\n * V2 import and usage:\n * import { createCopilotExpressHandler } from \"@copilotkit/runtime/v2/express\";\n * const v2CreateCopilotExpressHandler = createCopilotExpressHandler;\n * V2 replacement source: packages/runtime/src/v2/runtime/endpoints/express.ts\n * V2 docs: https://docs.copilotkit.ai/runtime-server-adapter\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nimport type { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { copilotRuntimeNodeHttpEndpoint } from \"../node-http\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\n\nexport function copilotRuntimeNodeExpressEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"node-express\",\n },\n });\n\n options.runtime.telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n return copilotRuntimeNodeHttpEndpoint(options);\n}\n"],"mappings":";;;;;AAyBA,SAAgB,kCACd,SACA;AACA,kCAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,gBACZ,EACF,CAAC;AAEF,SAAQ,QAAQ,UAAU,QACxB,gCACAA,yDAAgC,QAAQ,CACzC;AACD,QAAOC,6CAA+B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-express/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeExpressEndpoint:\n *
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-express/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeExpressEndpoint:\n * V2 import and usage:\n * import { createCopilotExpressHandler } from \"@copilotkit/runtime/v2/express\";\n * const v2CreateCopilotExpressHandler = createCopilotExpressHandler;\n * V2 replacement source: packages/runtime/src/v2/runtime/endpoints/express.ts\n * V2 docs: https://docs.copilotkit.ai/runtime-server-adapter\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\nimport type { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { copilotRuntimeNodeHttpEndpoint } from \"../node-http\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\n\nexport function copilotRuntimeNodeExpressEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"node-express\",\n },\n });\n\n options.runtime.telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n return copilotRuntimeNodeHttpEndpoint(options);\n}\n"],"mappings":";;;;;AAyBA,SAAgB,kCACd,SACA;AACA,iBAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,gBACZ,EACF,CAAC;AAEF,SAAQ,QAAQ,UAAU,QACxB,gCACA,gCAAgC,QAAQ,CACzC;AACD,QAAO,+BAA+B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["getCommonConfig","getRuntimeInstanceTelemetryInfo","createCopilotEndpointSingleRoute","getFullUrl","toHeaders","isStreamConsumed","nodeStreamToReadableStream","synthesizeBodyFromParsedBody","isDisturbedOrLockedError"],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-http/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeHttpEndpoint:\n *
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["getCommonConfig","getRuntimeInstanceTelemetryInfo","createCopilotEndpointSingleRoute","getFullUrl","toHeaders","isStreamConsumed","nodeStreamToReadableStream","synthesizeBodyFromParsedBody","isDisturbedOrLockedError"],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-http/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeHttpEndpoint:\n * V2 import and usage:\n * import { createCopilotRuntimeHandler } from \"@copilotkit/runtime/v2\";\n * const v2CreateCopilotRuntimeHandler = createCopilotRuntimeHandler;\n * V2 replacement source: packages/runtime/src/v2/runtime/core/fetch-handler.ts\n * V2 docs: https://docs.copilotkit.ai/runtime-server-adapter\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\nimport type { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { getCommonConfig } from \"../shared\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\nimport { createCopilotEndpointSingleRoute } from \"../../../../v2/runtime\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\nimport type { IncomingWithBody } from \"./request-handler\";\nimport {\n getFullUrl,\n isDisturbedOrLockedError,\n isStreamConsumed,\n nodeStreamToReadableStream,\n readableStreamToNodeStream,\n synthesizeBodyFromParsedBody,\n toHeaders,\n} from \"./request-handler\";\n\nexport function copilotRuntimeNodeHttpEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"node-http\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n options.runtime.telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating Node HTTP endpoint\");\n\n const serviceAdapter = options.serviceAdapter;\n if (serviceAdapter) {\n options.runtime.handleServiceAdapter(serviceAdapter);\n }\n\n // Note: cors option requires @copilotkit/runtime with credentials support\n const honoApp = createCopilotEndpointSingleRoute({\n runtime: options.runtime.instance,\n basePath: options.baseUrl ?? options.endpoint,\n ...(options.cors && { cors: options.cors }),\n } as any);\n\n const handle = async function handler(\n req: IncomingWithBody,\n res: ServerResponse,\n ) {\n const url = getFullUrl(req);\n const hasBody = req.method !== \"GET\" && req.method !== \"HEAD\";\n\n const baseHeaders = toHeaders(req.headers);\n const parsedBody = req.body;\n\n const streamConsumed = isStreamConsumed(req) || parsedBody !== undefined;\n const canStream = hasBody && !streamConsumed;\n\n let requestBody: BodyInit | null | undefined = undefined;\n let useDuplex = false;\n\n if (hasBody && canStream) {\n requestBody = nodeStreamToReadableStream(req);\n useDuplex = true;\n }\n\n if (hasBody && streamConsumed) {\n if (parsedBody !== undefined) {\n const synthesized = synthesizeBodyFromParsedBody(\n parsedBody,\n baseHeaders,\n );\n requestBody = synthesized.body ?? undefined;\n baseHeaders.delete(\"content-length\");\n\n if (synthesized.contentType) {\n baseHeaders.set(\"content-type\", synthesized.contentType);\n }\n\n logger.debug(\n \"Request stream already consumed; using parsed req.body to rebuild request.\",\n );\n } else {\n logger.warn(\n \"Request stream consumed with no available body; sending empty payload.\",\n );\n requestBody = undefined;\n }\n }\n\n const buildRequest = (\n body: BodyInit | null | undefined,\n headers: Headers,\n duplex: boolean,\n ) =>\n new Request(url, {\n method: req.method,\n headers,\n body,\n duplex: duplex ? \"half\" : undefined,\n } as RequestInit);\n\n let response: Response;\n try {\n response = await honoApp.fetch(\n buildRequest(requestBody, baseHeaders, useDuplex),\n );\n } catch (error) {\n if (isDisturbedOrLockedError(error) && hasBody) {\n logger.warn(\n \"Encountered disturbed/locked request body; rebuilding request using parsed body or empty payload.\",\n );\n\n const fallbackHeaders = new Headers(baseHeaders);\n let fallbackBody: BodyInit | null | undefined;\n\n if (parsedBody !== undefined) {\n const synthesized = synthesizeBodyFromParsedBody(\n parsedBody,\n fallbackHeaders,\n );\n fallbackBody = synthesized.body ?? undefined;\n fallbackHeaders.delete(\"content-length\");\n\n if (synthesized.contentType) {\n fallbackHeaders.set(\"content-type\", synthesized.contentType);\n }\n } else {\n fallbackBody = undefined;\n }\n\n response = await honoApp.fetch(\n buildRequest(fallbackBody, fallbackHeaders, false),\n );\n } else {\n throw error;\n }\n }\n\n res.statusCode = response.status;\n response.headers.forEach((value, key) => {\n res.setHeader(key, value);\n });\n\n if (response.body) {\n readableStreamToNodeStream(response.body).pipe(res);\n } else {\n res.end();\n }\n };\n\n // Duck-type check for Request-like objects (handles polyfilled Request from @hono/node-server)\n function isRequestLike(obj: unknown): obj is Request {\n return (\n obj instanceof Request ||\n (typeof obj === \"object\" &&\n obj !== null &&\n \"url\" in obj &&\n \"method\" in obj &&\n \"headers\" in obj &&\n typeof (obj as any).url === \"string\" &&\n typeof (obj as any).method === \"string\")\n );\n }\n\n return function (\n reqOrRequest: IncomingMessage | Request,\n res?: ServerResponse,\n ): Promise<void> | Promise<Response> | Response {\n if (isRequestLike(reqOrRequest) && !res) {\n return honoApp.fetch(reqOrRequest as Request);\n }\n if (!res) {\n throw new TypeError(\"ServerResponse is required for Node HTTP requests\");\n }\n return handle(reqOrRequest as IncomingMessage, res);\n };\n}\n"],"mappings":";;;;;;;AAoCA,SAAgB,+BACd,SACA;CACA,MAAM,eAAeA,+BAAgB,QAAQ;AAE7C,kCAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,aACZ,EACF,CAAC;AAEF,KAAI,QAAQ,YAAY,YACtB,kCAAU,oBAAoB,EAC5B,aAAa,QAAQ,WAAW,aACjC,CAAC;AAGJ,SAAQ,QAAQ,UAAU,QACxB,gCACAC,yDAAgC,QAAQ,CACzC;CAED,MAAM,SAAS,aAAa;AAC5B,QAAO,MAAM,8BAA8B;CAE3C,MAAM,iBAAiB,QAAQ;AAC/B,KAAI,eACF,SAAQ,QAAQ,qBAAqB,eAAe;CAItD,MAAM,UAAUC,qDAAiC;EAC/C,SAAS,QAAQ,QAAQ;EACzB,UAAU,QAAQ,WAAW,QAAQ;EACrC,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,MAAM;EAC3C,CAAQ;CAET,MAAM,SAAS,eAAe,QAC5B,KACA,KACA;EACA,MAAM,MAAMC,mCAAW,IAAI;EAC3B,MAAM,UAAU,IAAI,WAAW,SAAS,IAAI,WAAW;EAEvD,MAAM,cAAcC,kCAAU,IAAI,QAAQ;EAC1C,MAAM,aAAa,IAAI;EAEvB,MAAM,iBAAiBC,yCAAiB,IAAI,IAAI,eAAe;EAC/D,MAAM,YAAY,WAAW,CAAC;EAE9B,IAAI,cAA2C;EAC/C,IAAI,YAAY;AAEhB,MAAI,WAAW,WAAW;AACxB,iBAAcC,mDAA2B,IAAI;AAC7C,eAAY;;AAGd,MAAI,WAAW,eACb,KAAI,eAAe,QAAW;GAC5B,MAAM,cAAcC,qDAClB,YACA,YACD;AACD,iBAAc,YAAY,QAAQ;AAClC,eAAY,OAAO,iBAAiB;AAEpC,OAAI,YAAY,YACd,aAAY,IAAI,gBAAgB,YAAY,YAAY;AAG1D,UAAO,MACL,6EACD;SACI;AACL,UAAO,KACL,yEACD;AACD,iBAAc;;EAIlB,MAAM,gBACJ,MACA,SACA,WAEA,IAAI,QAAQ,KAAK;GACf,QAAQ,IAAI;GACZ;GACA;GACA,QAAQ,SAAS,SAAS;GAC3B,CAAgB;EAEnB,IAAI;AACJ,MAAI;AACF,cAAW,MAAM,QAAQ,MACvB,aAAa,aAAa,aAAa,UAAU,CAClD;WACM,OAAO;AACd,OAAIC,iDAAyB,MAAM,IAAI,SAAS;AAC9C,WAAO,KACL,oGACD;IAED,MAAM,kBAAkB,IAAI,QAAQ,YAAY;IAChD,IAAI;AAEJ,QAAI,eAAe,QAAW;KAC5B,MAAM,cAAcD,qDAClB,YACA,gBACD;AACD,oBAAe,YAAY,QAAQ;AACnC,qBAAgB,OAAO,iBAAiB;AAExC,SAAI,YAAY,YACd,iBAAgB,IAAI,gBAAgB,YAAY,YAAY;UAG9D,gBAAe;AAGjB,eAAW,MAAM,QAAQ,MACvB,aAAa,cAAc,iBAAiB,MAAM,CACnD;SAED,OAAM;;AAIV,MAAI,aAAa,SAAS;AAC1B,WAAS,QAAQ,SAAS,OAAO,QAAQ;AACvC,OAAI,UAAU,KAAK,MAAM;IACzB;AAEF,MAAI,SAAS,KACX,oDAA2B,SAAS,KAAK,CAAC,KAAK,IAAI;MAEnD,KAAI,KAAK;;CAKb,SAAS,cAAc,KAA8B;AACnD,SACE,eAAe,WACd,OAAO,QAAQ,YACd,QAAQ,QACR,SAAS,OACT,YAAY,OACZ,aAAa,OACb,OAAQ,IAAY,QAAQ,YAC5B,OAAQ,IAAY,WAAW;;AAIrC,QAAO,SACL,cACA,KAC8C;AAC9C,MAAI,cAAc,aAAa,IAAI,CAAC,IAClC,QAAO,QAAQ,MAAM,aAAwB;AAE/C,MAAI,CAAC,IACH,OAAM,IAAI,UAAU,oDAAoD;AAE1E,SAAO,OAAO,cAAiC,IAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-http/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeHttpEndpoint:\n *
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/v1-deprecated/lib/integrations/node-http/index.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — copilotRuntimeNodeHttpEndpoint:\n * V2 import and usage:\n * import { createCopilotRuntimeHandler } from \"@copilotkit/runtime/v2\";\n * const v2CreateCopilotRuntimeHandler = createCopilotRuntimeHandler;\n * V2 replacement source: packages/runtime/src/v2/runtime/core/fetch-handler.ts\n * V2 docs: https://docs.copilotkit.ai/runtime-server-adapter\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\nimport type { CreateCopilotRuntimeServerOptions } from \"../shared\";\nimport { getCommonConfig } from \"../shared\";\nimport telemetry, {\n getRuntimeInstanceTelemetryInfo,\n} from \"../../telemetry-client\";\nimport { createCopilotEndpointSingleRoute } from \"../../../../v2/runtime\";\nimport type { IncomingMessage, ServerResponse } from \"node:http\";\nimport type { IncomingWithBody } from \"./request-handler\";\nimport {\n getFullUrl,\n isDisturbedOrLockedError,\n isStreamConsumed,\n nodeStreamToReadableStream,\n readableStreamToNodeStream,\n synthesizeBodyFromParsedBody,\n toHeaders,\n} from \"./request-handler\";\n\nexport function copilotRuntimeNodeHttpEndpoint(\n options: CreateCopilotRuntimeServerOptions,\n) {\n const commonConfig = getCommonConfig(options);\n\n telemetry.setGlobalProperties({\n runtime: {\n framework: \"node-http\",\n },\n });\n\n if (options.properties?._copilotkit) {\n telemetry.setGlobalProperties({\n _copilotkit: options.properties._copilotkit,\n });\n }\n\n options.runtime.telemetry.capture(\n \"oss.runtime.instance_created\",\n getRuntimeInstanceTelemetryInfo(options),\n );\n\n const logger = commonConfig.logging;\n logger.debug(\"Creating Node HTTP endpoint\");\n\n const serviceAdapter = options.serviceAdapter;\n if (serviceAdapter) {\n options.runtime.handleServiceAdapter(serviceAdapter);\n }\n\n // Note: cors option requires @copilotkit/runtime with credentials support\n const honoApp = createCopilotEndpointSingleRoute({\n runtime: options.runtime.instance,\n basePath: options.baseUrl ?? options.endpoint,\n ...(options.cors && { cors: options.cors }),\n } as any);\n\n const handle = async function handler(\n req: IncomingWithBody,\n res: ServerResponse,\n ) {\n const url = getFullUrl(req);\n const hasBody = req.method !== \"GET\" && req.method !== \"HEAD\";\n\n const baseHeaders = toHeaders(req.headers);\n const parsedBody = req.body;\n\n const streamConsumed = isStreamConsumed(req) || parsedBody !== undefined;\n const canStream = hasBody && !streamConsumed;\n\n let requestBody: BodyInit | null | undefined = undefined;\n let useDuplex = false;\n\n if (hasBody && canStream) {\n requestBody = nodeStreamToReadableStream(req);\n useDuplex = true;\n }\n\n if (hasBody && streamConsumed) {\n if (parsedBody !== undefined) {\n const synthesized = synthesizeBodyFromParsedBody(\n parsedBody,\n baseHeaders,\n );\n requestBody = synthesized.body ?? undefined;\n baseHeaders.delete(\"content-length\");\n\n if (synthesized.contentType) {\n baseHeaders.set(\"content-type\", synthesized.contentType);\n }\n\n logger.debug(\n \"Request stream already consumed; using parsed req.body to rebuild request.\",\n );\n } else {\n logger.warn(\n \"Request stream consumed with no available body; sending empty payload.\",\n );\n requestBody = undefined;\n }\n }\n\n const buildRequest = (\n body: BodyInit | null | undefined,\n headers: Headers,\n duplex: boolean,\n ) =>\n new Request(url, {\n method: req.method,\n headers,\n body,\n duplex: duplex ? \"half\" : undefined,\n } as RequestInit);\n\n let response: Response;\n try {\n response = await honoApp.fetch(\n buildRequest(requestBody, baseHeaders, useDuplex),\n );\n } catch (error) {\n if (isDisturbedOrLockedError(error) && hasBody) {\n logger.warn(\n \"Encountered disturbed/locked request body; rebuilding request using parsed body or empty payload.\",\n );\n\n const fallbackHeaders = new Headers(baseHeaders);\n let fallbackBody: BodyInit | null | undefined;\n\n if (parsedBody !== undefined) {\n const synthesized = synthesizeBodyFromParsedBody(\n parsedBody,\n fallbackHeaders,\n );\n fallbackBody = synthesized.body ?? undefined;\n fallbackHeaders.delete(\"content-length\");\n\n if (synthesized.contentType) {\n fallbackHeaders.set(\"content-type\", synthesized.contentType);\n }\n } else {\n fallbackBody = undefined;\n }\n\n response = await honoApp.fetch(\n buildRequest(fallbackBody, fallbackHeaders, false),\n );\n } else {\n throw error;\n }\n }\n\n res.statusCode = response.status;\n response.headers.forEach((value, key) => {\n res.setHeader(key, value);\n });\n\n if (response.body) {\n readableStreamToNodeStream(response.body).pipe(res);\n } else {\n res.end();\n }\n };\n\n // Duck-type check for Request-like objects (handles polyfilled Request from @hono/node-server)\n function isRequestLike(obj: unknown): obj is Request {\n return (\n obj instanceof Request ||\n (typeof obj === \"object\" &&\n obj !== null &&\n \"url\" in obj &&\n \"method\" in obj &&\n \"headers\" in obj &&\n typeof (obj as any).url === \"string\" &&\n typeof (obj as any).method === \"string\")\n );\n }\n\n return function (\n reqOrRequest: IncomingMessage | Request,\n res?: ServerResponse,\n ): Promise<void> | Promise<Response> | Response {\n if (isRequestLike(reqOrRequest) && !res) {\n return honoApp.fetch(reqOrRequest as Request);\n }\n if (!res) {\n throw new TypeError(\"ServerResponse is required for Node HTTP requests\");\n }\n return handle(reqOrRequest as IncomingMessage, res);\n };\n}\n"],"mappings":";;;;;;;AAoCA,SAAgB,+BACd,SACA;CACA,MAAM,eAAe,gBAAgB,QAAQ;AAE7C,iBAAU,oBAAoB,EAC5B,SAAS,EACP,WAAW,aACZ,EACF,CAAC;AAEF,KAAI,QAAQ,YAAY,YACtB,iBAAU,oBAAoB,EAC5B,aAAa,QAAQ,WAAW,aACjC,CAAC;AAGJ,SAAQ,QAAQ,UAAU,QACxB,gCACA,gCAAgC,QAAQ,CACzC;CAED,MAAM,SAAS,aAAa;AAC5B,QAAO,MAAM,8BAA8B;CAE3C,MAAM,iBAAiB,QAAQ;AAC/B,KAAI,eACF,SAAQ,QAAQ,qBAAqB,eAAe;CAItD,MAAM,UAAU,iCAAiC;EAC/C,SAAS,QAAQ,QAAQ;EACzB,UAAU,QAAQ,WAAW,QAAQ;EACrC,GAAI,QAAQ,QAAQ,EAAE,MAAM,QAAQ,MAAM;EAC3C,CAAQ;CAET,MAAM,SAAS,eAAe,QAC5B,KACA,KACA;EACA,MAAM,MAAM,WAAW,IAAI;EAC3B,MAAM,UAAU,IAAI,WAAW,SAAS,IAAI,WAAW;EAEvD,MAAM,cAAc,UAAU,IAAI,QAAQ;EAC1C,MAAM,aAAa,IAAI;EAEvB,MAAM,iBAAiB,iBAAiB,IAAI,IAAI,eAAe;EAC/D,MAAM,YAAY,WAAW,CAAC;EAE9B,IAAI,cAA2C;EAC/C,IAAI,YAAY;AAEhB,MAAI,WAAW,WAAW;AACxB,iBAAc,2BAA2B,IAAI;AAC7C,eAAY;;AAGd,MAAI,WAAW,eACb,KAAI,eAAe,QAAW;GAC5B,MAAM,cAAc,6BAClB,YACA,YACD;AACD,iBAAc,YAAY,QAAQ;AAClC,eAAY,OAAO,iBAAiB;AAEpC,OAAI,YAAY,YACd,aAAY,IAAI,gBAAgB,YAAY,YAAY;AAG1D,UAAO,MACL,6EACD;SACI;AACL,UAAO,KACL,yEACD;AACD,iBAAc;;EAIlB,MAAM,gBACJ,MACA,SACA,WAEA,IAAI,QAAQ,KAAK;GACf,QAAQ,IAAI;GACZ;GACA;GACA,QAAQ,SAAS,SAAS;GAC3B,CAAgB;EAEnB,IAAI;AACJ,MAAI;AACF,cAAW,MAAM,QAAQ,MACvB,aAAa,aAAa,aAAa,UAAU,CAClD;WACM,OAAO;AACd,OAAI,yBAAyB,MAAM,IAAI,SAAS;AAC9C,WAAO,KACL,oGACD;IAED,MAAM,kBAAkB,IAAI,QAAQ,YAAY;IAChD,IAAI;AAEJ,QAAI,eAAe,QAAW;KAC5B,MAAM,cAAc,6BAClB,YACA,gBACD;AACD,oBAAe,YAAY,QAAQ;AACnC,qBAAgB,OAAO,iBAAiB;AAExC,SAAI,YAAY,YACd,iBAAgB,IAAI,gBAAgB,YAAY,YAAY;UAG9D,gBAAe;AAGjB,eAAW,MAAM,QAAQ,MACvB,aAAa,cAAc,iBAAiB,MAAM,CACnD;SAED,OAAM;;AAIV,MAAI,aAAa,SAAS;AAC1B,WAAS,QAAQ,SAAS,OAAO,QAAQ;AACvC,OAAI,UAAU,KAAK,MAAM;IACzB;AAEF,MAAI,SAAS,KACX,4BAA2B,SAAS,KAAK,CAAC,KAAK,IAAI;MAEnD,KAAI,KAAK;;CAKb,SAAS,cAAc,KAA8B;AACnD,SACE,eAAe,WACd,OAAO,QAAQ,YACd,QAAQ,QACR,SAAS,OACT,YAAY,OACZ,aAAa,OACb,OAAQ,IAAY,QAAQ,YAC5B,OAAQ,IAAY,WAAW;;AAIrC,QAAO,SACL,cACA,KAC8C;AAC9C,MAAI,cAAc,aAAa,IAAI,CAAC,IAClC,QAAO,QAAQ,MAAM,aAAwB;AAE/C,MAAI,CAAC,IACH,OAAM,IAAI,UAAU,oDAAoD;AAE1E,SAAO,OAAO,cAAiC,IAAI"}
|
|
@@ -6,7 +6,6 @@ const require_in_memory = require('../../v2/runtime/runner/in-memory.cjs');
|
|
|
6
6
|
const require_telemetry_identity = require('../../v2/runtime/telemetry/telemetry-identity.cjs');
|
|
7
7
|
const require_runtime_error_reporter = require('../../v2/runtime/core/runtime-error-reporter.cjs');
|
|
8
8
|
const require_runtime$1 = require('../../v2/runtime/core/runtime.cjs');
|
|
9
|
-
const require_telemetry_agent_runner = require('./telemetry-agent-runner.cjs');
|
|
10
9
|
const require_types = require('./types.cjs');
|
|
11
10
|
const require_mcp_tools_utils = require('./mcp-tools-utils.cjs');
|
|
12
11
|
const require_index = require('../../agent/index.cjs');
|
|
@@ -60,15 +59,12 @@ var CopilotRuntime = class {
|
|
|
60
59
|
const resolvedTelemetryId = (0, _copilotkit_shared.firstNonBlankTelemetryId)(params?.telemetryId, process.env.CPK_TELEMETRY_ID);
|
|
61
60
|
const resolvedTelemetryIdentity = resolvedTelemetryId !== void 0 ? { telemetryId: resolvedTelemetryId } : resolvedLicenseToken !== void 0 ? { licenseToken: resolvedLicenseToken } : {};
|
|
62
61
|
this.telemetry = require_telemetry_client.default.createScope(resolvedTelemetryIdentity);
|
|
63
|
-
const
|
|
64
|
-
const runner = (0, _copilotkit_shared.isTelemetryDisabled)() ? baseRunner : new require_telemetry_agent_runner.TelemetryAgentRunner({
|
|
65
|
-
runner: baseRunner,
|
|
66
|
-
telemetry: this.telemetry
|
|
67
|
-
});
|
|
62
|
+
const runner = params?.runner ?? new require_in_memory.InMemoryAgentRunner();
|
|
68
63
|
const sharedRuntimeArgs = {
|
|
69
64
|
agents: mergedAgents,
|
|
70
65
|
telemetryId: resolvedTelemetryId,
|
|
71
66
|
licenseToken: resolvedLicenseToken,
|
|
67
|
+
ɵtelemetry: this.telemetry,
|
|
72
68
|
telemetryProperties: params?.telemetryProperties,
|
|
73
69
|
debug: params?.debug,
|
|
74
70
|
beforeRequestMiddleware: this.createOnBeforeRequestHandler(params).bind(this),
|
|
@@ -124,10 +120,9 @@ var CopilotRuntime = class {
|
|
|
124
120
|
else throw new _copilotkit_shared.CopilotKitMisuseError({ message: `Service adapter "${serviceAdapter.name ?? "unknown"}" does not provide model information. When using adapters like LangChainAdapter without an explicit agents list, please provide a default agent in the runtime config. Example:\n new CopilotRuntime({\n agents: { default: new BuiltInAgent({ model: "openai/gpt-4o" }) }\n })` });
|
|
125
121
|
}
|
|
126
122
|
const actions = this.params?.actions;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
123
|
+
const mcpTools = await this.getToolsFromMCP();
|
|
124
|
+
const actionTools = actions ? this.getToolsFromActions(actions) : [];
|
|
125
|
+
agentsList = this.assignToolsToAgents(agentsList, [...actionTools, ...mcpTools]);
|
|
131
126
|
return agentsList;
|
|
132
127
|
});
|
|
133
128
|
}
|
|
@@ -141,7 +136,11 @@ var CopilotRuntime = class {
|
|
|
141
136
|
name: action.name,
|
|
142
137
|
description: action.description || "",
|
|
143
138
|
parameters: zodSchema,
|
|
144
|
-
execute: () =>
|
|
139
|
+
execute: async (args) => {
|
|
140
|
+
if (typeof action.handler !== "function") return `The tool "${action.name}" was advertised without a handler, so it has no implementation to run. Tell the user this tool is unavailable.`;
|
|
141
|
+
const result = await action.handler(args);
|
|
142
|
+
return result === void 0 ? `The tool "${action.name}" ran and returned no value.` : result;
|
|
143
|
+
}
|
|
145
144
|
};
|
|
146
145
|
});
|
|
147
146
|
}
|
|
@@ -153,9 +152,12 @@ var CopilotRuntime = class {
|
|
|
153
152
|
if ("factory" in existingConfig) continue;
|
|
154
153
|
const classicConfig = existingConfig;
|
|
155
154
|
const existingTools = classicConfig.tools ?? [];
|
|
155
|
+
const existingNames = new Set(existingTools.map((tool) => tool.name));
|
|
156
|
+
const newTools = tools.filter((tool) => !existingNames.has(tool.name));
|
|
157
|
+
if (newTools.length === 0) continue;
|
|
156
158
|
const updatedConfig = {
|
|
157
159
|
...classicConfig,
|
|
158
|
-
tools: [...existingTools, ...
|
|
160
|
+
tools: [...existingTools, ...newTools]
|
|
159
161
|
};
|
|
160
162
|
Reflect.set(agent, "config", updatedConfig);
|
|
161
163
|
enrichedAgents[agentId] = agent;
|
|
@@ -165,17 +167,7 @@ var CopilotRuntime = class {
|
|
|
165
167
|
createOnBeforeRequestHandler(params) {
|
|
166
168
|
return async (hookParams) => {
|
|
167
169
|
const { request } = hookParams;
|
|
168
|
-
const publicApiKey = request.headers.get("x-copilotcloud-public-api-key");
|
|
169
170
|
const body = await (0, _copilotkit_shared.readBody)(request);
|
|
170
|
-
const forwardedProps = body?.forwardedProps;
|
|
171
|
-
const cloudBaseUrl = process.env.COPILOT_CLOUD_BASE_URL || "https://api.cloud.copilotkit.ai";
|
|
172
|
-
this.telemetry.capture("oss.runtime.copilot_request_created", {
|
|
173
|
-
"cloud.guardrails.enabled": forwardedProps?.cloud?.guardrails !== void 0,
|
|
174
|
-
requestType: forwardedProps?.metadata?.requestType ?? "unknown",
|
|
175
|
-
"cloud.api_key_provided": !!publicApiKey,
|
|
176
|
-
...publicApiKey ? { "cloud.public_api_key": publicApiKey } : {},
|
|
177
|
-
"cloud.base_url": cloudBaseUrl
|
|
178
|
-
});
|
|
179
171
|
if (request.method === "GET" || !body) return;
|
|
180
172
|
const middlewareResult = await params?.beforeRequestMiddleware?.(hookParams);
|
|
181
173
|
if (params?.middleware?.onBeforeRequest) {
|
|
@@ -283,14 +275,13 @@ var CopilotRuntime = class {
|
|
|
283
275
|
name: toolName,
|
|
284
276
|
description: tool.description || `MCP tool: ${toolName} (from ${endpointUrl})`,
|
|
285
277
|
parameters: zodSchema,
|
|
286
|
-
execute: () =>
|
|
278
|
+
execute: async (args) => tool.execute(args)
|
|
287
279
|
};
|
|
288
280
|
});
|
|
289
281
|
this.mcpToolsCache.set(endpointUrl, toolDefs);
|
|
290
282
|
allTools.push(...toolDefs);
|
|
291
283
|
} catch (error) {
|
|
292
284
|
console.error(`MCP: Failed to fetch tools from endpoint ${endpointUrl}. Skipping. Error:`, error);
|
|
293
|
-
this.mcpToolsCache.set(endpointUrl, []);
|
|
294
285
|
}
|
|
295
286
|
}
|
|
296
287
|
const dedupedByName = /* @__PURE__ */ new Map();
|