@copilotkitnext/runtime 1.52.2-next.3 → 1.53.0-next.5
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/handlers/handle-run.cjs +3 -3
- package/dist/handlers/handle-run.cjs.map +1 -1
- package/dist/handlers/handle-run.mjs +3 -3
- package/dist/handlers/handle-run.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/runtime.cjs +3 -3
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +12 -5
- package/dist/runtime.d.cts.map +1 -1
- package/dist/runtime.d.mts +12 -5
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +3 -3
- package/dist/runtime.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -21,9 +21,9 @@ async function handleRunAgent({ runtime, request, agentId }) {
|
|
|
21
21
|
const { agents: targetAgents, ...a2uiOptions } = runtime.a2ui;
|
|
22
22
|
if ((!targetAgents || targetAgents.includes(agentId)) && "use" in agent && typeof agent.use === "function") agent.use(new _ag_ui_a2ui_middleware.A2UIMiddleware(a2uiOptions));
|
|
23
23
|
}
|
|
24
|
-
if (runtime.
|
|
25
|
-
const {
|
|
26
|
-
if (
|
|
24
|
+
if (runtime.mcpApps?.servers?.length) {
|
|
25
|
+
const mcpServers = runtime.mcpApps.servers.filter((s) => !s.agentId || s.agentId === agentId).map(({ agentId: _, ...server }) => server);
|
|
26
|
+
if (mcpServers.length > 0 && "use" in agent && typeof agent.use === "function") agent.use(new _ag_ui_mcp_apps_middleware.MCPAppsMiddleware({ mcpServers }));
|
|
27
27
|
}
|
|
28
28
|
if (agent && "headers" in agent) {
|
|
29
29
|
const forwardableHeaders = require_header_utils.extractForwardableHeaders(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-run.cjs","names":["A2UIMiddleware","MCPAppsMiddleware","extractForwardableHeaders","RunAgentInputSchema","EventEncoder"],"sources":["../../src/handlers/handle-run.ts"],"sourcesContent":["import {\n AbstractAgent,\n RunAgentInput,\n RunAgentInputSchema,\n} from \"@ag-ui/client\";\nimport { A2UIMiddleware } from \"@ag-ui/a2ui-middleware\";\nimport { MCPAppsMiddleware } from \"@ag-ui/mcp-apps-middleware\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { CopilotRuntime } from \"../runtime\";\nimport { extractForwardableHeaders } from \"./header-utils\";\n\ninterface RunAgentParameters {\n request: Request;\n runtime: CopilotRuntime;\n agentId: string;\n}\n\nexport async function handleRunAgent({\n runtime,\n request,\n agentId,\n}: RunAgentParameters) {\n try {\n const agents = await runtime.agents;\n\n // Check if the requested agent exists\n if (!agents[agentId]) {\n return new Response(\n JSON.stringify({\n error: \"Agent not found\",\n message: `Agent '${agentId}' does not exist`,\n }),\n {\n status: 404,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const registeredAgent = agents[agentId] as AbstractAgent;\n const agent = registeredAgent.clone() as AbstractAgent;\n\n // Apply runtime-level A2UI middleware if configured\n if (runtime.a2ui) {\n const { agents: targetAgents, ...a2uiOptions } = runtime.a2ui;\n const shouldApply = !targetAgents || targetAgents.includes(agentId);\n if (\n shouldApply &&\n \"use\" in agent &&\n typeof (agent as any).use === \"function\"\n ) {\n (agent as any).use(new A2UIMiddleware(a2uiOptions));\n }\n }\n\n if (runtime.
|
|
1
|
+
{"version":3,"file":"handle-run.cjs","names":["A2UIMiddleware","MCPAppsMiddleware","extractForwardableHeaders","RunAgentInputSchema","EventEncoder"],"sources":["../../src/handlers/handle-run.ts"],"sourcesContent":["import {\n AbstractAgent,\n RunAgentInput,\n RunAgentInputSchema,\n} from \"@ag-ui/client\";\nimport { A2UIMiddleware } from \"@ag-ui/a2ui-middleware\";\nimport { MCPAppsMiddleware } from \"@ag-ui/mcp-apps-middleware\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { CopilotRuntime } from \"../runtime\";\nimport { extractForwardableHeaders } from \"./header-utils\";\n\ninterface RunAgentParameters {\n request: Request;\n runtime: CopilotRuntime;\n agentId: string;\n}\n\nexport async function handleRunAgent({\n runtime,\n request,\n agentId,\n}: RunAgentParameters) {\n try {\n const agents = await runtime.agents;\n\n // Check if the requested agent exists\n if (!agents[agentId]) {\n return new Response(\n JSON.stringify({\n error: \"Agent not found\",\n message: `Agent '${agentId}' does not exist`,\n }),\n {\n status: 404,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const registeredAgent = agents[agentId] as AbstractAgent;\n const agent = registeredAgent.clone() as AbstractAgent;\n\n // Apply runtime-level A2UI middleware if configured\n if (runtime.a2ui) {\n const { agents: targetAgents, ...a2uiOptions } = runtime.a2ui;\n const shouldApply = !targetAgents || targetAgents.includes(agentId);\n if (\n shouldApply &&\n \"use\" in agent &&\n typeof (agent as any).use === \"function\"\n ) {\n (agent as any).use(new A2UIMiddleware(a2uiOptions));\n }\n }\n\n if (runtime.mcpApps?.servers?.length) {\n // Filter to servers that target this agent or have no agentId restriction\n const mcpServers = runtime.mcpApps.servers\n .filter((s) => !s.agentId || s.agentId === agentId)\n .map(({ agentId: _, ...server }) => server);\n\n if (\n mcpServers.length > 0 &&\n \"use\" in agent &&\n typeof (agent as any).use === \"function\"\n ) {\n (agent as any).use(new MCPAppsMiddleware({ mcpServers }));\n }\n }\n\n if (agent && \"headers\" in agent) {\n const forwardableHeaders = extractForwardableHeaders(request);\n agent.headers = {\n ...(agent.headers as Record<string, string>),\n ...forwardableHeaders,\n };\n }\n\n // Parse and validate input BEFORE creating the stream\n // so we can return a proper error response\n let input: RunAgentInput;\n try {\n const requestBody = await request.json();\n input = RunAgentInputSchema.parse(requestBody);\n } catch (error) {\n console.error(\"Invalid run request body:\", error);\n return new Response(\n JSON.stringify({\n error: \"Invalid request body\",\n details: error instanceof Error ? error.message : String(error),\n }),\n {\n status: 400,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n const encoder = new EventEncoder();\n let streamClosed = false;\n\n agent.setMessages(input.messages);\n agent.setState(input.state);\n agent.threadId = input.threadId;\n\n // Process the agent run in the background\n (async () => {\n runtime.runner\n .run({\n threadId: input.threadId,\n agent,\n input,\n })\n .subscribe({\n next: async (event) => {\n if (!request.signal.aborted && !streamClosed) {\n try {\n await writer.write(encoder.encode(event));\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n streamClosed = true;\n }\n }\n }\n },\n error: async (error) => {\n console.error(\"Error running agent:\", error);\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed\n }\n }\n },\n complete: async () => {\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed\n }\n }\n },\n });\n })().catch((error) => {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n if (!streamClosed) {\n try {\n writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed\n }\n }\n });\n\n // Return the SSE response\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n } catch (error) {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n\n return new Response(\n JSON.stringify({\n error: \"Failed to run agent\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}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C;UACK,OAAO;AACd,UAAQ,MAAM,wBAAwB,MAAM;AAC5C,UAAQ,MACN,gBACA,iBAAiB,QAAQ,MAAM,QAAQ,iBACxC;AACD,UAAQ,MAAM,kBAAkB;GAC9B,MAAM,iBAAiB,QAAQ,MAAM,OAAO;GAC5C,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;GAC/D,OAAO,iBAAiB,QAAQ,MAAM,QAAQ;GAC/C,CAAC;AAEF,SAAO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,iBAAiB,QAAQ,MAAM,UAAU;GACnD,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF"}
|
|
@@ -20,9 +20,9 @@ async function handleRunAgent({ runtime, request, agentId }) {
|
|
|
20
20
|
const { agents: targetAgents, ...a2uiOptions } = runtime.a2ui;
|
|
21
21
|
if ((!targetAgents || targetAgents.includes(agentId)) && "use" in agent && typeof agent.use === "function") agent.use(new A2UIMiddleware(a2uiOptions));
|
|
22
22
|
}
|
|
23
|
-
if (runtime.
|
|
24
|
-
const {
|
|
25
|
-
if (
|
|
23
|
+
if (runtime.mcpApps?.servers?.length) {
|
|
24
|
+
const mcpServers = runtime.mcpApps.servers.filter((s) => !s.agentId || s.agentId === agentId).map(({ agentId: _, ...server }) => server);
|
|
25
|
+
if (mcpServers.length > 0 && "use" in agent && typeof agent.use === "function") agent.use(new MCPAppsMiddleware({ mcpServers }));
|
|
26
26
|
}
|
|
27
27
|
if (agent && "headers" in agent) {
|
|
28
28
|
const forwardableHeaders = extractForwardableHeaders(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-run.mjs","names":[],"sources":["../../src/handlers/handle-run.ts"],"sourcesContent":["import {\n AbstractAgent,\n RunAgentInput,\n RunAgentInputSchema,\n} from \"@ag-ui/client\";\nimport { A2UIMiddleware } from \"@ag-ui/a2ui-middleware\";\nimport { MCPAppsMiddleware } from \"@ag-ui/mcp-apps-middleware\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { CopilotRuntime } from \"../runtime\";\nimport { extractForwardableHeaders } from \"./header-utils\";\n\ninterface RunAgentParameters {\n request: Request;\n runtime: CopilotRuntime;\n agentId: string;\n}\n\nexport async function handleRunAgent({\n runtime,\n request,\n agentId,\n}: RunAgentParameters) {\n try {\n const agents = await runtime.agents;\n\n // Check if the requested agent exists\n if (!agents[agentId]) {\n return new Response(\n JSON.stringify({\n error: \"Agent not found\",\n message: `Agent '${agentId}' does not exist`,\n }),\n {\n status: 404,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const registeredAgent = agents[agentId] as AbstractAgent;\n const agent = registeredAgent.clone() as AbstractAgent;\n\n // Apply runtime-level A2UI middleware if configured\n if (runtime.a2ui) {\n const { agents: targetAgents, ...a2uiOptions } = runtime.a2ui;\n const shouldApply = !targetAgents || targetAgents.includes(agentId);\n if (\n shouldApply &&\n \"use\" in agent &&\n typeof (agent as any).use === \"function\"\n ) {\n (agent as any).use(new A2UIMiddleware(a2uiOptions));\n }\n }\n\n if (runtime.
|
|
1
|
+
{"version":3,"file":"handle-run.mjs","names":[],"sources":["../../src/handlers/handle-run.ts"],"sourcesContent":["import {\n AbstractAgent,\n RunAgentInput,\n RunAgentInputSchema,\n} from \"@ag-ui/client\";\nimport { A2UIMiddleware } from \"@ag-ui/a2ui-middleware\";\nimport { MCPAppsMiddleware } from \"@ag-ui/mcp-apps-middleware\";\nimport { EventEncoder } from \"@ag-ui/encoder\";\nimport { CopilotRuntime } from \"../runtime\";\nimport { extractForwardableHeaders } from \"./header-utils\";\n\ninterface RunAgentParameters {\n request: Request;\n runtime: CopilotRuntime;\n agentId: string;\n}\n\nexport async function handleRunAgent({\n runtime,\n request,\n agentId,\n}: RunAgentParameters) {\n try {\n const agents = await runtime.agents;\n\n // Check if the requested agent exists\n if (!agents[agentId]) {\n return new Response(\n JSON.stringify({\n error: \"Agent not found\",\n message: `Agent '${agentId}' does not exist`,\n }),\n {\n status: 404,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const registeredAgent = agents[agentId] as AbstractAgent;\n const agent = registeredAgent.clone() as AbstractAgent;\n\n // Apply runtime-level A2UI middleware if configured\n if (runtime.a2ui) {\n const { agents: targetAgents, ...a2uiOptions } = runtime.a2ui;\n const shouldApply = !targetAgents || targetAgents.includes(agentId);\n if (\n shouldApply &&\n \"use\" in agent &&\n typeof (agent as any).use === \"function\"\n ) {\n (agent as any).use(new A2UIMiddleware(a2uiOptions));\n }\n }\n\n if (runtime.mcpApps?.servers?.length) {\n // Filter to servers that target this agent or have no agentId restriction\n const mcpServers = runtime.mcpApps.servers\n .filter((s) => !s.agentId || s.agentId === agentId)\n .map(({ agentId: _, ...server }) => server);\n\n if (\n mcpServers.length > 0 &&\n \"use\" in agent &&\n typeof (agent as any).use === \"function\"\n ) {\n (agent as any).use(new MCPAppsMiddleware({ mcpServers }));\n }\n }\n\n if (agent && \"headers\" in agent) {\n const forwardableHeaders = extractForwardableHeaders(request);\n agent.headers = {\n ...(agent.headers as Record<string, string>),\n ...forwardableHeaders,\n };\n }\n\n // Parse and validate input BEFORE creating the stream\n // so we can return a proper error response\n let input: RunAgentInput;\n try {\n const requestBody = await request.json();\n input = RunAgentInputSchema.parse(requestBody);\n } catch (error) {\n console.error(\"Invalid run request body:\", error);\n return new Response(\n JSON.stringify({\n error: \"Invalid request body\",\n details: error instanceof Error ? error.message : String(error),\n }),\n {\n status: 400,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n const stream = new TransformStream();\n const writer = stream.writable.getWriter();\n const encoder = new EventEncoder();\n let streamClosed = false;\n\n agent.setMessages(input.messages);\n agent.setState(input.state);\n agent.threadId = input.threadId;\n\n // Process the agent run in the background\n (async () => {\n runtime.runner\n .run({\n threadId: input.threadId,\n agent,\n input,\n })\n .subscribe({\n next: async (event) => {\n if (!request.signal.aborted && !streamClosed) {\n try {\n await writer.write(encoder.encode(event));\n } catch (error) {\n if (error instanceof Error && error.name === \"AbortError\") {\n streamClosed = true;\n }\n }\n }\n },\n error: async (error) => {\n console.error(\"Error running agent:\", error);\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed\n }\n }\n },\n complete: async () => {\n if (!streamClosed) {\n try {\n await writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed\n }\n }\n },\n });\n })().catch((error) => {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n if (!streamClosed) {\n try {\n writer.close();\n streamClosed = true;\n } catch {\n // Stream already closed\n }\n }\n });\n\n // Return the SSE response\n return new Response(stream.readable, {\n status: 200,\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n },\n });\n } catch (error) {\n console.error(\"Error running agent:\", error);\n console.error(\n \"Error stack:\",\n error instanceof Error ? error.stack : \"No stack trace\",\n );\n console.error(\"Error details:\", {\n name: error instanceof Error ? error.name : \"Unknown\",\n message: error instanceof Error ? error.message : String(error),\n cause: error instanceof Error ? error.cause : undefined,\n });\n\n return new Response(\n JSON.stringify({\n error: \"Failed to run agent\",\n message: error instanceof Error ? error.message : \"Unknown error\",\n }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n}\n"],"mappings":";;;;;;;AAiBA,eAAsB,eAAe,EACnC,SACA,SACA,WACqB;AACrB,KAAI;EACF,MAAM,SAAS,MAAM,QAAQ;AAG7B,MAAI,CAAC,OAAO,SACV,QAAO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,UAAU,QAAQ;GAC5B,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,C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CAAC;AAEF,SAAO,IAAI,SACT,KAAK,UAAU;GACb,OAAO;GACP,SAAS,iBAAiB,QAAQ,MAAM,UAAU;GACnD,CAAC,EACF;GACE,QAAQ;GACR,SAAS,EAAE,gBAAgB,oBAAoB;GAChD,CACF"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TranscribeFileOptions, TranscriptionService } from "./transcription-service/transcription-service.cjs";
|
|
2
2
|
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./runner/agent-runner.cjs";
|
|
3
|
-
import { CopilotRuntime, CopilotRuntimeOptions, VERSION } from "./runtime.cjs";
|
|
3
|
+
import { CopilotRuntime, CopilotRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION } from "./runtime.cjs";
|
|
4
4
|
import { CopilotEndpointCorsConfig, createCopilotEndpoint } from "./endpoints/hono.cjs";
|
|
5
5
|
import { createCopilotEndpointSingleRoute } from "./endpoints/hono-single.cjs";
|
|
6
6
|
import { InMemoryAgentRunner } from "./runner/in-memory.cjs";
|
|
7
7
|
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions } from "./runner/intelligence.cjs";
|
|
8
8
|
import { finalizeRunEvents } from "./runner/index.cjs";
|
|
9
|
-
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotRuntime, CopilotRuntimeOptions, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, TranscribeFileOptions, TranscriptionService, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents };
|
|
9
|
+
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotRuntime, CopilotRuntimeOptions, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, McpAppsConfig, McpAppsServerConfig, TranscribeFileOptions, TranscriptionService, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TranscribeFileOptions, TranscriptionService } from "./transcription-service/transcription-service.mjs";
|
|
2
2
|
import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./runner/agent-runner.mjs";
|
|
3
|
-
import { CopilotRuntime, CopilotRuntimeOptions, VERSION } from "./runtime.mjs";
|
|
3
|
+
import { CopilotRuntime, CopilotRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION } from "./runtime.mjs";
|
|
4
4
|
import { CopilotEndpointCorsConfig, createCopilotEndpoint } from "./endpoints/hono.mjs";
|
|
5
5
|
import { createCopilotEndpointSingleRoute } from "./endpoints/hono-single.mjs";
|
|
6
6
|
import "./endpoints/index.mjs";
|
|
7
7
|
import { InMemoryAgentRunner } from "./runner/in-memory.mjs";
|
|
8
8
|
import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions } from "./runner/intelligence.mjs";
|
|
9
9
|
import { finalizeRunEvents } from "./runner/index.mjs";
|
|
10
|
-
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotRuntime, CopilotRuntimeOptions, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, TranscribeFileOptions, TranscriptionService, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents };
|
|
10
|
+
export { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, CopilotEndpointCorsConfig, CopilotRuntime, CopilotRuntimeOptions, InMemoryAgentRunner, IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, McpAppsConfig, McpAppsServerConfig, TranscribeFileOptions, TranscriptionService, VERSION, createCopilotEndpoint, createCopilotEndpointSingleRoute, finalizeRunEvents };
|
package/dist/package.cjs
CHANGED
package/dist/package.mjs
CHANGED
package/dist/runtime.cjs
CHANGED
|
@@ -13,15 +13,15 @@ var CopilotRuntime = class {
|
|
|
13
13
|
afterRequestMiddleware;
|
|
14
14
|
runner;
|
|
15
15
|
a2ui;
|
|
16
|
-
|
|
17
|
-
constructor({ agents, transcriptionService, beforeRequestMiddleware, afterRequestMiddleware, runner, a2ui,
|
|
16
|
+
mcpApps;
|
|
17
|
+
constructor({ agents, transcriptionService, beforeRequestMiddleware, afterRequestMiddleware, runner, a2ui, mcpApps }) {
|
|
18
18
|
this.agents = agents;
|
|
19
19
|
this.transcriptionService = transcriptionService;
|
|
20
20
|
this.beforeRequestMiddleware = beforeRequestMiddleware;
|
|
21
21
|
this.afterRequestMiddleware = afterRequestMiddleware;
|
|
22
22
|
this.runner = runner ?? new require_in_memory.InMemoryAgentRunner();
|
|
23
23
|
this.a2ui = a2ui;
|
|
24
|
-
this.
|
|
24
|
+
this.mcpApps = mcpApps;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
package/dist/runtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.cjs","names":["InMemoryAgentRunner"],"sources":["../src/runtime.ts"],"sourcesContent":["import { MaybePromise, NonEmptyRecord } from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport {
|
|
1
|
+
{"version":3,"file":"runtime.cjs","names":["InMemoryAgentRunner"],"sources":["../src/runtime.ts"],"sourcesContent":["import { MaybePromise, NonEmptyRecord } from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport type { MCPClientConfig } from \"@ag-ui/mcp-apps-middleware\";\nimport { A2UIMiddlewareConfig } from \"@ag-ui/a2ui-middleware\";\nimport pkg from \"../package.json\";\nimport type {\n BeforeRequestMiddleware,\n AfterRequestMiddleware,\n} from \"./middleware\";\nimport { TranscriptionService } from \"./transcription-service/transcription-service\";\nimport { AgentRunner } from \"./runner/agent-runner\";\nimport { InMemoryAgentRunner } from \"./runner/in-memory\";\n\nexport const VERSION = pkg.version;\n\ninterface BaseCopilotRuntimeMiddlewareOptions {\n /** If set, middleware only applies to these named agents. Applies to all agents if omitted. */\n agents?: string[];\n}\n\nexport type McpAppsServerConfig = MCPClientConfig & {\n /** Agent to bind this server to. If omitted, the server is available to all agents. */\n agentId?: string;\n};\n\nexport interface McpAppsConfig {\n /** List of MCP server configurations. */\n servers: McpAppsServerConfig[];\n}\n\ninterface CopilotRuntimeMiddlewares {\n /** Auto-apply A2UIMiddleware to agents at run time. */\n a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;\n /** Auto-apply MCPAppsMiddleware to agents at run time. */\n mcpApps?: McpAppsConfig;\n}\n\n/**\n * Options used to construct a `CopilotRuntime` instance.\n */\nexport interface CopilotRuntimeOptions extends CopilotRuntimeMiddlewares {\n /** Map of available agents (loaded lazily is fine). */\n agents: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;\n /** The runner to use for running agents. */\n runner?: AgentRunner;\n /** Optional transcription service for audio processing. */\n transcriptionService?: TranscriptionService;\n /** Optional *before* middleware – callback function or webhook URL. */\n beforeRequestMiddleware?: BeforeRequestMiddleware;\n /** Optional *after* middleware – callback function or webhook URL. */\n afterRequestMiddleware?: AfterRequestMiddleware;\n}\n\n/**\n * Central runtime object passed to all request handlers.\n */\nexport class CopilotRuntime {\n public agents: CopilotRuntimeOptions[\"agents\"];\n public transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n public beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n public afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n public runner: AgentRunner;\n public a2ui: CopilotRuntimeOptions[\"a2ui\"];\n public mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n\n constructor({\n agents,\n transcriptionService,\n beforeRequestMiddleware,\n afterRequestMiddleware,\n runner,\n a2ui,\n mcpApps,\n }: CopilotRuntimeOptions) {\n this.agents = agents;\n this.transcriptionService = transcriptionService;\n this.beforeRequestMiddleware = beforeRequestMiddleware;\n this.afterRequestMiddleware = afterRequestMiddleware;\n this.runner = runner ?? new InMemoryAgentRunner();\n this.a2ui = a2ui;\n this.mcpApps = mcpApps;\n }\n}\n"],"mappings":";;;;AAaA,MAAa;;;;AA2Cb,IAAa,iBAAb,MAA4B;CAC1B,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAEP,YAAY,EACV,QACA,sBACA,yBACA,wBACA,QACA,MACA,WACwB;AACxB,OAAK,SAAS;AACd,OAAK,uBAAuB;AAC5B,OAAK,0BAA0B;AAC/B,OAAK,yBAAyB;AAC9B,OAAK,SAAS,UAAU,IAAIA,uCAAqB;AACjD,OAAK,OAAO;AACZ,OAAK,UAAU"}
|
package/dist/runtime.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { TranscriptionService } from "./transcription-service/transcription-serv
|
|
|
3
3
|
import { AgentRunner } from "./runner/agent-runner.cjs";
|
|
4
4
|
import { MaybePromise, NonEmptyRecord } from "@copilotkitnext/shared";
|
|
5
5
|
import { AbstractAgent } from "@ag-ui/client";
|
|
6
|
-
import {
|
|
6
|
+
import { MCPClientConfig } from "@ag-ui/mcp-apps-middleware";
|
|
7
7
|
import { A2UIMiddlewareConfig } from "@ag-ui/a2ui-middleware";
|
|
8
8
|
|
|
9
9
|
//#region src/runtime.d.ts
|
|
@@ -12,11 +12,18 @@ interface BaseCopilotRuntimeMiddlewareOptions {
|
|
|
12
12
|
/** If set, middleware only applies to these named agents. Applies to all agents if omitted. */
|
|
13
13
|
agents?: string[];
|
|
14
14
|
}
|
|
15
|
+
type McpAppsServerConfig = MCPClientConfig & {
|
|
16
|
+
/** Agent to bind this server to. If omitted, the server is available to all agents. */agentId?: string;
|
|
17
|
+
};
|
|
18
|
+
interface McpAppsConfig {
|
|
19
|
+
/** List of MCP server configurations. */
|
|
20
|
+
servers: McpAppsServerConfig[];
|
|
21
|
+
}
|
|
15
22
|
interface CopilotRuntimeMiddlewares {
|
|
16
23
|
/** Auto-apply A2UIMiddleware to agents at run time. */
|
|
17
24
|
a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;
|
|
18
25
|
/** Auto-apply MCPAppsMiddleware to agents at run time. */
|
|
19
|
-
|
|
26
|
+
mcpApps?: McpAppsConfig;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Options used to construct a `CopilotRuntime` instance.
|
|
@@ -43,7 +50,7 @@ declare class CopilotRuntime {
|
|
|
43
50
|
afterRequestMiddleware: CopilotRuntimeOptions["afterRequestMiddleware"];
|
|
44
51
|
runner: AgentRunner;
|
|
45
52
|
a2ui: CopilotRuntimeOptions["a2ui"];
|
|
46
|
-
|
|
53
|
+
mcpApps: CopilotRuntimeOptions["mcpApps"];
|
|
47
54
|
constructor({
|
|
48
55
|
agents,
|
|
49
56
|
transcriptionService,
|
|
@@ -51,9 +58,9 @@ declare class CopilotRuntime {
|
|
|
51
58
|
afterRequestMiddleware,
|
|
52
59
|
runner,
|
|
53
60
|
a2ui,
|
|
54
|
-
|
|
61
|
+
mcpApps
|
|
55
62
|
}: CopilotRuntimeOptions);
|
|
56
63
|
}
|
|
57
64
|
//#endregion
|
|
58
|
-
export { CopilotRuntime, CopilotRuntimeOptions, VERSION };
|
|
65
|
+
export { CopilotRuntime, CopilotRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION };
|
|
59
66
|
//# sourceMappingURL=runtime.d.cts.map
|
package/dist/runtime.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.cts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;cAaa,OAAA;AAAA,UAEH,mCAAA;EAFG;EAIX,MAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"runtime.d.cts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;cAaa,OAAA;AAAA,UAEH,mCAAA;EAFG;EAIX,MAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAPA,uFAShC,OAAA;AAAA;AAAA,UAGe,aAAA;EARf;EAUA,OAAA,EAAS,mBAAA;AAAA;AAAA,UAGD,yBAAA;;EAER,IAAA,GAAO,mCAAA,GAAsC,oBAAA;EAVtC;EAYP,OAAA,GAAU,aAAA;AAAA;;;;UAMK,qBAAA,SAA8B,yBAAA;EAVZ;EAYjC,MAAA,EAAQ,YAAA,CAAa,cAAA,CAAe,MAAA,SAAe,aAAA;EAV5C;EAYP,MAAA,GAAS,WAAA;EAVC;EAYV,oBAAA,GAAuB,oBAAA;EAZA;EAcvB,uBAAA,GAA0B,uBAAA;EAhBnB;EAkBP,sBAAA,GAAyB,sBAAA;AAAA;;;;cAMd,cAAA;EACJ,MAAA,EAAQ,qBAAA;EACR,oBAAA,EAAsB,qBAAA;EACtB,uBAAA,EAAyB,qBAAA;EACzB,sBAAA,EAAwB,qBAAA;EACxB,MAAA,EAAQ,WAAA;EACR,IAAA,EAAM,qBAAA;EACN,OAAA,EAAS,qBAAA;;IAGd,MAAA;IACA,oBAAA;IACA,uBAAA;IACA,sBAAA;IACA,MAAA;IACA,IAAA;IACA;EAAA,GACC,qBAAA;AAAA"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { AgentRunner } from "./runner/agent-runner.mjs";
|
|
|
4
4
|
import { AbstractAgent } from "@ag-ui/client";
|
|
5
5
|
import { MaybePromise, NonEmptyRecord } from "@copilotkitnext/shared";
|
|
6
6
|
import { A2UIMiddlewareConfig } from "@ag-ui/a2ui-middleware";
|
|
7
|
-
import {
|
|
7
|
+
import { MCPClientConfig } from "@ag-ui/mcp-apps-middleware";
|
|
8
8
|
|
|
9
9
|
//#region src/runtime.d.ts
|
|
10
10
|
declare const VERSION: string;
|
|
@@ -12,11 +12,18 @@ interface BaseCopilotRuntimeMiddlewareOptions {
|
|
|
12
12
|
/** If set, middleware only applies to these named agents. Applies to all agents if omitted. */
|
|
13
13
|
agents?: string[];
|
|
14
14
|
}
|
|
15
|
+
type McpAppsServerConfig = MCPClientConfig & {
|
|
16
|
+
/** Agent to bind this server to. If omitted, the server is available to all agents. */agentId?: string;
|
|
17
|
+
};
|
|
18
|
+
interface McpAppsConfig {
|
|
19
|
+
/** List of MCP server configurations. */
|
|
20
|
+
servers: McpAppsServerConfig[];
|
|
21
|
+
}
|
|
15
22
|
interface CopilotRuntimeMiddlewares {
|
|
16
23
|
/** Auto-apply A2UIMiddleware to agents at run time. */
|
|
17
24
|
a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;
|
|
18
25
|
/** Auto-apply MCPAppsMiddleware to agents at run time. */
|
|
19
|
-
|
|
26
|
+
mcpApps?: McpAppsConfig;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Options used to construct a `CopilotRuntime` instance.
|
|
@@ -43,7 +50,7 @@ declare class CopilotRuntime {
|
|
|
43
50
|
afterRequestMiddleware: CopilotRuntimeOptions["afterRequestMiddleware"];
|
|
44
51
|
runner: AgentRunner;
|
|
45
52
|
a2ui: CopilotRuntimeOptions["a2ui"];
|
|
46
|
-
|
|
53
|
+
mcpApps: CopilotRuntimeOptions["mcpApps"];
|
|
47
54
|
constructor({
|
|
48
55
|
agents,
|
|
49
56
|
transcriptionService,
|
|
@@ -51,9 +58,9 @@ declare class CopilotRuntime {
|
|
|
51
58
|
afterRequestMiddleware,
|
|
52
59
|
runner,
|
|
53
60
|
a2ui,
|
|
54
|
-
|
|
61
|
+
mcpApps
|
|
55
62
|
}: CopilotRuntimeOptions);
|
|
56
63
|
}
|
|
57
64
|
//#endregion
|
|
58
|
-
export { CopilotRuntime, CopilotRuntimeOptions, VERSION };
|
|
65
|
+
export { CopilotRuntime, CopilotRuntimeOptions, McpAppsConfig, McpAppsServerConfig, VERSION };
|
|
59
66
|
//# sourceMappingURL=runtime.d.mts.map
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;cAaa,OAAA;AAAA,UAEH,mCAAA;EAFG;EAIX,MAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/runtime.ts"],"mappings":";;;;;;;;;cAaa,OAAA;AAAA,UAEH,mCAAA;EAFG;EAIX,MAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,eAAA;EAPA,uFAShC,OAAA;AAAA;AAAA,UAGe,aAAA;EARf;EAUA,OAAA,EAAS,mBAAA;AAAA;AAAA,UAGD,yBAAA;;EAER,IAAA,GAAO,mCAAA,GAAsC,oBAAA;EAVtC;EAYP,OAAA,GAAU,aAAA;AAAA;;;;UAMK,qBAAA,SAA8B,yBAAA;EAVZ;EAYjC,MAAA,EAAQ,YAAA,CAAa,cAAA,CAAe,MAAA,SAAe,aAAA;EAV5C;EAYP,MAAA,GAAS,WAAA;EAVC;EAYV,oBAAA,GAAuB,oBAAA;EAZA;EAcvB,uBAAA,GAA0B,uBAAA;EAhBnB;EAkBP,sBAAA,GAAyB,sBAAA;AAAA;;;;cAMd,cAAA;EACJ,MAAA,EAAQ,qBAAA;EACR,oBAAA,EAAsB,qBAAA;EACtB,uBAAA,EAAyB,qBAAA;EACzB,sBAAA,EAAwB,qBAAA;EACxB,MAAA,EAAQ,WAAA;EACR,IAAA,EAAM,qBAAA;EACN,OAAA,EAAS,qBAAA;;IAGd,MAAA;IACA,oBAAA;IACA,uBAAA;IACA,sBAAA;IACA,MAAA;IACA,IAAA;IACA;EAAA,GACC,qBAAA;AAAA"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -13,15 +13,15 @@ var CopilotRuntime = class {
|
|
|
13
13
|
afterRequestMiddleware;
|
|
14
14
|
runner;
|
|
15
15
|
a2ui;
|
|
16
|
-
|
|
17
|
-
constructor({ agents, transcriptionService, beforeRequestMiddleware, afterRequestMiddleware, runner, a2ui,
|
|
16
|
+
mcpApps;
|
|
17
|
+
constructor({ agents, transcriptionService, beforeRequestMiddleware, afterRequestMiddleware, runner, a2ui, mcpApps }) {
|
|
18
18
|
this.agents = agents;
|
|
19
19
|
this.transcriptionService = transcriptionService;
|
|
20
20
|
this.beforeRequestMiddleware = beforeRequestMiddleware;
|
|
21
21
|
this.afterRequestMiddleware = afterRequestMiddleware;
|
|
22
22
|
this.runner = runner ?? new InMemoryAgentRunner();
|
|
23
23
|
this.a2ui = a2ui;
|
|
24
|
-
this.
|
|
24
|
+
this.mcpApps = mcpApps;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":["pkg.version"],"sources":["../src/runtime.ts"],"sourcesContent":["import { MaybePromise, NonEmptyRecord } from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport {
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":["pkg.version"],"sources":["../src/runtime.ts"],"sourcesContent":["import { MaybePromise, NonEmptyRecord } from \"@copilotkitnext/shared\";\nimport { AbstractAgent } from \"@ag-ui/client\";\nimport type { MCPClientConfig } from \"@ag-ui/mcp-apps-middleware\";\nimport { A2UIMiddlewareConfig } from \"@ag-ui/a2ui-middleware\";\nimport pkg from \"../package.json\";\nimport type {\n BeforeRequestMiddleware,\n AfterRequestMiddleware,\n} from \"./middleware\";\nimport { TranscriptionService } from \"./transcription-service/transcription-service\";\nimport { AgentRunner } from \"./runner/agent-runner\";\nimport { InMemoryAgentRunner } from \"./runner/in-memory\";\n\nexport const VERSION = pkg.version;\n\ninterface BaseCopilotRuntimeMiddlewareOptions {\n /** If set, middleware only applies to these named agents. Applies to all agents if omitted. */\n agents?: string[];\n}\n\nexport type McpAppsServerConfig = MCPClientConfig & {\n /** Agent to bind this server to. If omitted, the server is available to all agents. */\n agentId?: string;\n};\n\nexport interface McpAppsConfig {\n /** List of MCP server configurations. */\n servers: McpAppsServerConfig[];\n}\n\ninterface CopilotRuntimeMiddlewares {\n /** Auto-apply A2UIMiddleware to agents at run time. */\n a2ui?: BaseCopilotRuntimeMiddlewareOptions & A2UIMiddlewareConfig;\n /** Auto-apply MCPAppsMiddleware to agents at run time. */\n mcpApps?: McpAppsConfig;\n}\n\n/**\n * Options used to construct a `CopilotRuntime` instance.\n */\nexport interface CopilotRuntimeOptions extends CopilotRuntimeMiddlewares {\n /** Map of available agents (loaded lazily is fine). */\n agents: MaybePromise<NonEmptyRecord<Record<string, AbstractAgent>>>;\n /** The runner to use for running agents. */\n runner?: AgentRunner;\n /** Optional transcription service for audio processing. */\n transcriptionService?: TranscriptionService;\n /** Optional *before* middleware – callback function or webhook URL. */\n beforeRequestMiddleware?: BeforeRequestMiddleware;\n /** Optional *after* middleware – callback function or webhook URL. */\n afterRequestMiddleware?: AfterRequestMiddleware;\n}\n\n/**\n * Central runtime object passed to all request handlers.\n */\nexport class CopilotRuntime {\n public agents: CopilotRuntimeOptions[\"agents\"];\n public transcriptionService: CopilotRuntimeOptions[\"transcriptionService\"];\n public beforeRequestMiddleware: CopilotRuntimeOptions[\"beforeRequestMiddleware\"];\n public afterRequestMiddleware: CopilotRuntimeOptions[\"afterRequestMiddleware\"];\n public runner: AgentRunner;\n public a2ui: CopilotRuntimeOptions[\"a2ui\"];\n public mcpApps: CopilotRuntimeOptions[\"mcpApps\"];\n\n constructor({\n agents,\n transcriptionService,\n beforeRequestMiddleware,\n afterRequestMiddleware,\n runner,\n a2ui,\n mcpApps,\n }: CopilotRuntimeOptions) {\n this.agents = agents;\n this.transcriptionService = transcriptionService;\n this.beforeRequestMiddleware = beforeRequestMiddleware;\n this.afterRequestMiddleware = afterRequestMiddleware;\n this.runner = runner ?? new InMemoryAgentRunner();\n this.a2ui = a2ui;\n this.mcpApps = mcpApps;\n }\n}\n"],"mappings":";;;;AAaA,MAAa,UAAUA;;;;AA2CvB,IAAa,iBAAb,MAA4B;CAC1B,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CACP,AAAO;CAEP,YAAY,EACV,QACA,sBACA,yBACA,wBACA,QACA,MACA,WACwB;AACxB,OAAK,SAAS;AACd,OAAK,uBAAuB;AAC5B,OAAK,0BAA0B;AAC/B,OAAK,yBAAyB;AAC9B,OAAK,SAAS,UAAU,IAAI,qBAAqB;AACjD,OAAK,OAAO;AACZ,OAAK,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkitnext/runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.0-next.5",
|
|
4
4
|
"description": "Server-side runtime package for CopilotKit2",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"types": "./dist/index.d.cts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"tsdown": "^0.20.3",
|
|
30
30
|
"typescript": "5.8.2",
|
|
31
31
|
"vitest": "^3.0.5",
|
|
32
|
-
"@copilotkitnext/eslint-config": "1.
|
|
33
|
-
"@copilotkitnext/typescript-config": "1.
|
|
32
|
+
"@copilotkitnext/eslint-config": "1.53.0-next.5",
|
|
33
|
+
"@copilotkitnext/typescript-config": "1.53.0-next.5"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@ag-ui/a2ui-middleware": "0.0.2",
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"express": "^4.21.2",
|
|
45
45
|
"hono": "^4.11.4",
|
|
46
46
|
"rxjs": "7.8.1",
|
|
47
|
-
"@copilotkitnext/shared": "1.
|
|
47
|
+
"@copilotkitnext/shared": "1.53.0-next.5"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@ag-ui/client": "0.0.47",
|
|
51
51
|
"@ag-ui/core": "0.0.47",
|
|
52
52
|
"@ag-ui/encoder": "0.0.47",
|
|
53
|
-
"@copilotkitnext/shared": "1.
|
|
53
|
+
"@copilotkitnext/shared": "1.53.0-next.5"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {},
|
|
56
56
|
"engines": {
|