@copilotkit/runtime 1.9.2-next.16 → 1.9.2-next.18
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/CHANGELOG.md +18 -0
- package/dist/{chunk-7F4BIRQF.mjs → chunk-FW5UOGQ2.mjs} +38 -33
- package/dist/chunk-FW5UOGQ2.mjs.map +1 -0
- package/dist/{chunk-4ODT32DV.mjs → chunk-JIE2UKYM.mjs} +2 -2
- package/dist/{chunk-BCDAWNNK.mjs → chunk-QSSQAW7A.mjs} +2 -2
- package/dist/{chunk-R22NGLLV.mjs → chunk-RXWWTMSG.mjs} +2 -2
- package/dist/{chunk-RBG2A675.mjs → chunk-Y6GPK3Y7.mjs} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +37 -32
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +5 -5
- package/dist/lib/integrations/index.d.ts +2 -2
- package/dist/lib/integrations/index.js +2 -2
- package/dist/lib/integrations/index.js.map +1 -1
- package/dist/lib/integrations/index.mjs +4 -4
- package/dist/lib/integrations/nest/index.d.ts +1 -1
- package/dist/lib/integrations/nest/index.js +2 -2
- package/dist/lib/integrations/nest/index.js.map +1 -1
- package/dist/lib/integrations/nest/index.mjs +2 -2
- package/dist/lib/integrations/node-express/index.d.ts +1 -1
- package/dist/lib/integrations/node-express/index.js +2 -2
- package/dist/lib/integrations/node-express/index.js.map +1 -1
- package/dist/lib/integrations/node-express/index.mjs +2 -2
- package/dist/lib/integrations/node-http/index.d.ts +1 -1
- package/dist/lib/integrations/node-http/index.js +2 -2
- package/dist/lib/integrations/node-http/index.js.map +1 -1
- package/dist/lib/integrations/node-http/index.mjs +1 -1
- package/dist/{shared-4164c674.d.ts → shared-41d4988d.d.ts} +13 -13
- package/package.json +2 -2
- package/src/graphql/resolvers/copilot.resolver.ts +1 -2
- package/src/lib/runtime/__tests__/{copilot-runtime-trace.test.ts → copilot-runtime-error.test.ts} +27 -27
- package/src/lib/runtime/agui-action.ts +3 -0
- package/src/lib/runtime/copilot-runtime.ts +42 -42
- package/src/lib/runtime/remote-actions.ts +3 -0
- package/dist/chunk-7F4BIRQF.mjs.map +0 -1
- /package/dist/{chunk-4ODT32DV.mjs.map → chunk-JIE2UKYM.mjs.map} +0 -0
- /package/dist/{chunk-BCDAWNNK.mjs.map → chunk-QSSQAW7A.mjs.map} +0 -0
- /package/dist/{chunk-R22NGLLV.mjs.map → chunk-RXWWTMSG.mjs.map} +0 -0
- /package/dist/{chunk-RBG2A675.mjs.map → chunk-Y6GPK3Y7.mjs.map} +0 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FW5UOGQ2.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNodeExpressEndpoint, "copilotRuntimeNodeExpressEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNodeExpressEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-JIE2UKYM.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
copilotRuntimeNodeHttpEndpoint,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FW5UOGQ2.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -22,4 +22,4 @@ __name(copilotRuntimeNestEndpoint, "copilotRuntimeNestEndpoint");
|
|
|
22
22
|
export {
|
|
23
23
|
copilotRuntimeNestEndpoint
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-QSSQAW7A.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LangGraphEventTypes
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FW5UOGQ2.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -155,4 +155,4 @@ export {
|
|
|
155
155
|
CustomEventNames,
|
|
156
156
|
LangGraphAgent
|
|
157
157
|
};
|
|
158
|
-
//# sourceMappingURL=chunk-
|
|
158
|
+
//# sourceMappingURL=chunk-RXWWTMSG.mjs.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
getCommonConfig,
|
|
3
3
|
getRuntimeInstanceTelemetryInfo,
|
|
4
4
|
telemetry_client_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FW5UOGQ2.mjs";
|
|
6
6
|
import {
|
|
7
7
|
__name
|
|
8
8
|
} from "./chunk-FHD4JECV.mjs";
|
|
@@ -77,4 +77,4 @@ export {
|
|
|
77
77
|
config,
|
|
78
78
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
80
|
+
//# sourceMappingURL=chunk-Y6GPK3Y7.mjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { G as GoogleGenerativeAIAdapter, f as GroqAdapter, e as GroqAdapterParams, L as LangChainAdapter, a as OpenAIAdapter, O as OpenAIAdapterParams, c as OpenAIAssistantAdapter, b as OpenAIAssistantAdapterParams, d as UnifyAdapter, U as UnifyAdapterParams } from './groq-adapter-172a2ca4.js';
|
|
2
|
-
export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-
|
|
2
|
+
export { e as CommonConfig, C as CopilotRequestContextProperties, k as CopilotRuntime, j as CopilotRuntimeConstructorParams, f as CopilotRuntimeLogger, i as CopilotRuntimeRequest, b as CreateCopilotRuntimeServerOptions, G as GraphQLContext, L as LogLevel, o as MCPClient, p as MCPEndpointConfig, M as MCPTool, a as addCustomHeaderPlugin, d as buildSchema, s as convertMCPToolsToActions, m as copilotKitEndpoint, c as createContext, h as createLogger, q as extractParametersFromSchema, l as flattenToolCallsNoDuplicates, t as generateMcpToolInstructions, g as getCommonConfig, n as langGraphPlatformEndpoint, r as resolveEndpointType } from './shared-41d4988d.js';
|
|
3
3
|
export { CopilotRuntimeServerInstance, config, copilotRuntimeNextJSAppRouterEndpoint, copilotRuntimeNextJSPagesRouterEndpoint } from './lib/integrations/index.js';
|
|
4
4
|
export { copilotRuntimeNodeHttpEndpoint } from './lib/integrations/node-http/index.js';
|
|
5
5
|
export { copilotRuntimeNodeExpressEndpoint } from './lib/integrations/node-express/index.js';
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var require_package = __commonJS({
|
|
|
44
44
|
publishConfig: {
|
|
45
45
|
access: "public"
|
|
46
46
|
},
|
|
47
|
-
version: "1.9.2-next.
|
|
47
|
+
version: "1.9.2-next.18",
|
|
48
48
|
sideEffects: false,
|
|
49
49
|
main: "./dist/index.js",
|
|
50
50
|
module: "./dist/index.mjs",
|
|
@@ -4705,8 +4705,8 @@ var CopilotRuntime = class {
|
|
|
4705
4705
|
delegateAgentProcessingToServiceAdapter;
|
|
4706
4706
|
observability;
|
|
4707
4707
|
availableAgents;
|
|
4708
|
-
|
|
4709
|
-
|
|
4708
|
+
onError;
|
|
4709
|
+
hasWarnedAboutError = false;
|
|
4710
4710
|
// +++ MCP Properties +++
|
|
4711
4711
|
mcpServersConfig;
|
|
4712
4712
|
mcpActionCache = /* @__PURE__ */ new Map();
|
|
@@ -4732,7 +4732,7 @@ var CopilotRuntime = class {
|
|
|
4732
4732
|
this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
|
|
4733
4733
|
this.observability = params == null ? void 0 : params.observability_c;
|
|
4734
4734
|
this.agents = (params == null ? void 0 : params.agents) ?? {};
|
|
4735
|
-
this.
|
|
4735
|
+
this.onError = params == null ? void 0 : params.onError;
|
|
4736
4736
|
this.mcpServersConfig = params == null ? void 0 : params.mcpServers;
|
|
4737
4737
|
this.createMCPClientImpl = params == null ? void 0 : params.createMCPClient;
|
|
4738
4738
|
if (this.mcpServersConfig && this.mcpServersConfig.length > 0 && !this.createMCPClientImpl) {
|
|
@@ -4811,7 +4811,7 @@ var CopilotRuntime = class {
|
|
|
4811
4811
|
const eventSource = new RuntimeEventSource();
|
|
4812
4812
|
const requestStartTime = Date.now();
|
|
4813
4813
|
const streamedChunks = [];
|
|
4814
|
-
await this.
|
|
4814
|
+
await this.error("request", {
|
|
4815
4815
|
threadId,
|
|
4816
4816
|
runId,
|
|
4817
4817
|
source: "runtime",
|
|
@@ -5007,7 +5007,7 @@ please use an LLM adapter instead.`
|
|
|
5007
5007
|
} else {
|
|
5008
5008
|
structuredError = (0, import_shared18.ensureStructuredError)(error, (err) => this.convertStreamingErrorToStructured(err));
|
|
5009
5009
|
}
|
|
5010
|
-
await this.
|
|
5010
|
+
await this.error("error", {
|
|
5011
5011
|
threadId,
|
|
5012
5012
|
runId,
|
|
5013
5013
|
source: "runtime",
|
|
@@ -5255,7 +5255,7 @@ please use an LLM adapter instead.`
|
|
|
5255
5255
|
const requestStartTime = Date.now();
|
|
5256
5256
|
const streamedChunks = [];
|
|
5257
5257
|
const threadId = threadIdFromRequest ?? agentSession.threadId;
|
|
5258
|
-
await this.
|
|
5258
|
+
await this.error("agent_state", {
|
|
5259
5259
|
threadId,
|
|
5260
5260
|
source: "agent",
|
|
5261
5261
|
request: {
|
|
@@ -5391,7 +5391,7 @@ please use an LLM adapter instead.`
|
|
|
5391
5391
|
}
|
|
5392
5392
|
}
|
|
5393
5393
|
const structuredError = (0, import_shared18.ensureStructuredError)(err, (error) => this.convertStreamingErrorToStructured(error));
|
|
5394
|
-
await this.
|
|
5394
|
+
await this.error("error", {
|
|
5395
5395
|
threadId,
|
|
5396
5396
|
source: "agent",
|
|
5397
5397
|
request: {
|
|
@@ -5480,7 +5480,7 @@ please use an LLM adapter instead.`
|
|
|
5480
5480
|
}
|
|
5481
5481
|
}
|
|
5482
5482
|
const structuredError = (0, import_shared18.ensureStructuredError)(error, (err) => this.convertStreamingErrorToStructured(err));
|
|
5483
|
-
await this.
|
|
5483
|
+
await this.error("error", {
|
|
5484
5484
|
threadId,
|
|
5485
5485
|
source: "agent",
|
|
5486
5486
|
request: {
|
|
@@ -5506,7 +5506,7 @@ please use an LLM adapter instead.`
|
|
|
5506
5506
|
}
|
|
5507
5507
|
}
|
|
5508
5508
|
async getServerSideActions(request) {
|
|
5509
|
-
var _a, _b;
|
|
5509
|
+
var _a, _b, _c;
|
|
5510
5510
|
const { graphqlContext, messages: rawMessages, agentStates, url } = request;
|
|
5511
5511
|
const inputMessages = convertGqlInputToMessages(rawMessages);
|
|
5512
5512
|
const langserveFunctions = [];
|
|
@@ -5529,7 +5529,8 @@ please use an LLM adapter instead.`
|
|
|
5529
5529
|
agentStates,
|
|
5530
5530
|
frontendUrl: url,
|
|
5531
5531
|
agents: this.agents,
|
|
5532
|
-
metaEvents: request.metaEvents
|
|
5532
|
+
metaEvents: request.metaEvents,
|
|
5533
|
+
nodeName: (_a = request.agentSession) == null ? void 0 : _a.nodeName
|
|
5533
5534
|
});
|
|
5534
5535
|
const configuredActions = typeof this.actions === "function" ? this.actions({
|
|
5535
5536
|
properties: graphqlContext.properties,
|
|
@@ -5538,7 +5539,7 @@ please use an LLM adapter instead.`
|
|
|
5538
5539
|
const requestSpecificMCPActions = [];
|
|
5539
5540
|
if (this.createMCPClientImpl) {
|
|
5540
5541
|
const baseEndpoints = this.mcpServersConfig || [];
|
|
5541
|
-
const requestEndpoints = ((
|
|
5542
|
+
const requestEndpoints = ((_b = graphqlContext.properties) == null ? void 0 : _b.mcpServers) || ((_c = graphqlContext.properties) == null ? void 0 : _c.mcpEndpoints) || [];
|
|
5542
5543
|
const effectiveEndpointsMap = /* @__PURE__ */ new Map();
|
|
5543
5544
|
[
|
|
5544
5545
|
...baseEndpoints
|
|
@@ -5611,18 +5612,18 @@ please use an LLM adapter instead.`
|
|
|
5611
5612
|
code: import_shared18.CopilotKitErrorCode.UNKNOWN
|
|
5612
5613
|
});
|
|
5613
5614
|
}
|
|
5614
|
-
async
|
|
5615
|
-
if (!this.
|
|
5615
|
+
async error(type, context, error, publicApiKey) {
|
|
5616
|
+
if (!this.onError)
|
|
5616
5617
|
return;
|
|
5617
5618
|
if (!publicApiKey) {
|
|
5618
|
-
if (!this.
|
|
5619
|
-
console.warn("CopilotKit:
|
|
5620
|
-
this.
|
|
5619
|
+
if (!this.hasWarnedAboutError) {
|
|
5620
|
+
console.warn("CopilotKit: onError handler provided but requires publicApiKey to be defined for error handling to work.");
|
|
5621
|
+
this.hasWarnedAboutError = true;
|
|
5621
5622
|
}
|
|
5622
5623
|
return;
|
|
5623
5624
|
}
|
|
5624
5625
|
try {
|
|
5625
|
-
const
|
|
5626
|
+
const errorEvent = {
|
|
5626
5627
|
type,
|
|
5627
5628
|
timestamp: Date.now(),
|
|
5628
5629
|
context,
|
|
@@ -5630,20 +5631,20 @@ please use an LLM adapter instead.`
|
|
|
5630
5631
|
error
|
|
5631
5632
|
}
|
|
5632
5633
|
};
|
|
5633
|
-
await this.
|
|
5634
|
-
} catch (
|
|
5635
|
-
console.error("Error in
|
|
5634
|
+
await this.onError(errorEvent);
|
|
5635
|
+
} catch (errorHandlerError) {
|
|
5636
|
+
console.error("Error in onError handler:", errorHandlerError);
|
|
5636
5637
|
}
|
|
5637
5638
|
}
|
|
5638
5639
|
/**
|
|
5639
|
-
* Public method to
|
|
5640
|
-
* This allows the GraphQL resolver to send validation errors through the
|
|
5640
|
+
* Public method to handle GraphQL validation errors
|
|
5641
|
+
* This allows the GraphQL resolver to send validation errors through the error system
|
|
5641
5642
|
*/
|
|
5642
|
-
async
|
|
5643
|
-
if (!this.
|
|
5643
|
+
async errorGraphQLError(error, context) {
|
|
5644
|
+
if (!this.onError)
|
|
5644
5645
|
return;
|
|
5645
5646
|
try {
|
|
5646
|
-
await this.
|
|
5647
|
+
await this.onError({
|
|
5647
5648
|
type: "error",
|
|
5648
5649
|
timestamp: Date.now(),
|
|
5649
5650
|
context: {
|
|
@@ -5663,8 +5664,8 @@ please use an LLM adapter instead.`
|
|
|
5663
5664
|
},
|
|
5664
5665
|
error
|
|
5665
5666
|
});
|
|
5666
|
-
} catch (
|
|
5667
|
-
console.error("Error in
|
|
5667
|
+
} catch (errorHandlerError) {
|
|
5668
|
+
console.error("Error in onError handler:", errorHandlerError);
|
|
5668
5669
|
}
|
|
5669
5670
|
}
|
|
5670
5671
|
};
|
|
@@ -6272,7 +6273,7 @@ var import_shared26 = require("@copilotkit/shared");
|
|
|
6272
6273
|
|
|
6273
6274
|
// src/lib/runtime/agui-action.ts
|
|
6274
6275
|
var import_shared24 = require("@copilotkit/shared");
|
|
6275
|
-
function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, agent, metaEvents, threadMetadata }) {
|
|
6276
|
+
function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, agent, metaEvents, threadMetadata, nodeName }) {
|
|
6276
6277
|
const action = {
|
|
6277
6278
|
name: agent.agentId,
|
|
6278
6279
|
description: agent.description,
|
|
@@ -6315,6 +6316,9 @@ function constructAGUIRemoteAction({ logger: logger2, messages, agentStates, age
|
|
|
6315
6316
|
} : {},
|
|
6316
6317
|
...threadMetadata ? {
|
|
6317
6318
|
threadMetadata
|
|
6319
|
+
} : {},
|
|
6320
|
+
...nodeName ? {
|
|
6321
|
+
nodeName
|
|
6318
6322
|
} : {}
|
|
6319
6323
|
};
|
|
6320
6324
|
return agent.legacy_to_be_removed_runAgentBridged({
|
|
@@ -6430,7 +6434,7 @@ async function fetchRemoteInfo({ url, onBeforeRequest, graphqlContext, logger: l
|
|
|
6430
6434
|
}
|
|
6431
6435
|
}
|
|
6432
6436
|
__name(fetchRemoteInfo, "fetchRemoteInfo");
|
|
6433
|
-
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl, agents, metaEvents }) {
|
|
6437
|
+
async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, messages, agentStates, frontendUrl, agents, metaEvents, nodeName }) {
|
|
6434
6438
|
var _a;
|
|
6435
6439
|
const logger2 = graphqlContext.logger.child({
|
|
6436
6440
|
component: "remote-actions.fetchRemoteActions"
|
|
@@ -6496,7 +6500,8 @@ async function setupRemoteActions({ remoteEndpointDefinitions, graphqlContext, m
|
|
|
6496
6500
|
agentStates,
|
|
6497
6501
|
agent,
|
|
6498
6502
|
metaEvents,
|
|
6499
|
-
threadMetadata
|
|
6503
|
+
threadMetadata,
|
|
6504
|
+
nodeName
|
|
6500
6505
|
}));
|
|
6501
6506
|
}
|
|
6502
6507
|
return result.flat();
|
|
@@ -7017,7 +7022,7 @@ var CopilotResolver = class {
|
|
|
7017
7022
|
logger2.debug("Cloud configuration provided, checking for public API key in headers");
|
|
7018
7023
|
if (!copilotCloudPublicApiKey) {
|
|
7019
7024
|
logger2.error("Public API key not found in headers");
|
|
7020
|
-
await copilotRuntime.
|
|
7025
|
+
await copilotRuntime.errorGraphQLError({
|
|
7021
7026
|
message: "X-CopilotCloud-Public-API-Key header is required",
|
|
7022
7027
|
code: "MISSING_PUBLIC_API_KEY",
|
|
7023
7028
|
type: "GraphQLError"
|