@copilotkit/runtime 1.9.2-next.17 → 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 +11 -0
- package/dist/{chunk-H3ML2MWF.mjs → chunk-FW5UOGQ2.mjs} +27 -27
- package/dist/chunk-FW5UOGQ2.mjs.map +1 -0
- package/dist/{chunk-6QK2NO6W.mjs → chunk-JIE2UKYM.mjs} +2 -2
- package/dist/{chunk-WXNKOOVD.mjs → chunk-QSSQAW7A.mjs} +2 -2
- package/dist/{chunk-CORCJNXR.mjs → chunk-RXWWTMSG.mjs} +2 -2
- package/dist/{chunk-7EDOHCIU.mjs → chunk-Y6GPK3Y7.mjs} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -26
- 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 +26 -26
- 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/copilot-runtime.ts +41 -42
- package/dist/chunk-H3ML2MWF.mjs.map +0 -1
- /package/dist/{chunk-6QK2NO6W.mjs.map → chunk-JIE2UKYM.mjs.map} +0 -0
- /package/dist/{chunk-WXNKOOVD.mjs.map → chunk-QSSQAW7A.mjs.map} +0 -0
- /package/dist/{chunk-CORCJNXR.mjs.map → chunk-RXWWTMSG.mjs.map} +0 -0
- /package/dist/{chunk-7EDOHCIU.mjs.map → chunk-Y6GPK3Y7.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CustomEventNames,
|
|
3
3
|
LangGraphAgent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RXWWTMSG.mjs";
|
|
5
5
|
import {
|
|
6
6
|
config,
|
|
7
7
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
8
8
|
copilotRuntimeNextJSPagesRouterEndpoint
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y6GPK3Y7.mjs";
|
|
10
10
|
import {
|
|
11
11
|
copilotRuntimeNestEndpoint
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QSSQAW7A.mjs";
|
|
13
13
|
import {
|
|
14
14
|
copilotRuntimeNodeExpressEndpoint
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JIE2UKYM.mjs";
|
|
16
16
|
import {
|
|
17
17
|
CopilotRuntime,
|
|
18
18
|
addCustomHeaderPlugin,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
getCommonConfig,
|
|
29
29
|
langGraphPlatformEndpoint,
|
|
30
30
|
resolveEndpointType
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FW5UOGQ2.mjs";
|
|
32
32
|
import "./chunk-SHBDMA63.mjs";
|
|
33
33
|
import {
|
|
34
34
|
AnthropicAdapter,
|
package/dist/lib/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 './integrations/index.js';
|
|
4
4
|
export { copilotRuntimeNodeHttpEndpoint } from './integrations/node-http/index.js';
|
|
5
5
|
export { copilotRuntimeNodeExpressEndpoint } from './integrations/node-express/index.js';
|
package/dist/lib/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",
|
|
@@ -4251,8 +4251,8 @@ var CopilotRuntime = class {
|
|
|
4251
4251
|
delegateAgentProcessingToServiceAdapter;
|
|
4252
4252
|
observability;
|
|
4253
4253
|
availableAgents;
|
|
4254
|
-
|
|
4255
|
-
|
|
4254
|
+
onError;
|
|
4255
|
+
hasWarnedAboutError = false;
|
|
4256
4256
|
// +++ MCP Properties +++
|
|
4257
4257
|
mcpServersConfig;
|
|
4258
4258
|
mcpActionCache = /* @__PURE__ */ new Map();
|
|
@@ -4278,7 +4278,7 @@ var CopilotRuntime = class {
|
|
|
4278
4278
|
this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
|
|
4279
4279
|
this.observability = params == null ? void 0 : params.observability_c;
|
|
4280
4280
|
this.agents = (params == null ? void 0 : params.agents) ?? {};
|
|
4281
|
-
this.
|
|
4281
|
+
this.onError = params == null ? void 0 : params.onError;
|
|
4282
4282
|
this.mcpServersConfig = params == null ? void 0 : params.mcpServers;
|
|
4283
4283
|
this.createMCPClientImpl = params == null ? void 0 : params.createMCPClient;
|
|
4284
4284
|
if (this.mcpServersConfig && this.mcpServersConfig.length > 0 && !this.createMCPClientImpl) {
|
|
@@ -4357,7 +4357,7 @@ var CopilotRuntime = class {
|
|
|
4357
4357
|
const eventSource = new RuntimeEventSource();
|
|
4358
4358
|
const requestStartTime = Date.now();
|
|
4359
4359
|
const streamedChunks = [];
|
|
4360
|
-
await this.
|
|
4360
|
+
await this.error("request", {
|
|
4361
4361
|
threadId,
|
|
4362
4362
|
runId,
|
|
4363
4363
|
source: "runtime",
|
|
@@ -4553,7 +4553,7 @@ please use an LLM adapter instead.`
|
|
|
4553
4553
|
} else {
|
|
4554
4554
|
structuredError = (0, import_shared15.ensureStructuredError)(error, (err) => this.convertStreamingErrorToStructured(err));
|
|
4555
4555
|
}
|
|
4556
|
-
await this.
|
|
4556
|
+
await this.error("error", {
|
|
4557
4557
|
threadId,
|
|
4558
4558
|
runId,
|
|
4559
4559
|
source: "runtime",
|
|
@@ -4801,7 +4801,7 @@ please use an LLM adapter instead.`
|
|
|
4801
4801
|
const requestStartTime = Date.now();
|
|
4802
4802
|
const streamedChunks = [];
|
|
4803
4803
|
const threadId = threadIdFromRequest ?? agentSession.threadId;
|
|
4804
|
-
await this.
|
|
4804
|
+
await this.error("agent_state", {
|
|
4805
4805
|
threadId,
|
|
4806
4806
|
source: "agent",
|
|
4807
4807
|
request: {
|
|
@@ -4937,7 +4937,7 @@ please use an LLM adapter instead.`
|
|
|
4937
4937
|
}
|
|
4938
4938
|
}
|
|
4939
4939
|
const structuredError = (0, import_shared15.ensureStructuredError)(err, (error) => this.convertStreamingErrorToStructured(error));
|
|
4940
|
-
await this.
|
|
4940
|
+
await this.error("error", {
|
|
4941
4941
|
threadId,
|
|
4942
4942
|
source: "agent",
|
|
4943
4943
|
request: {
|
|
@@ -5026,7 +5026,7 @@ please use an LLM adapter instead.`
|
|
|
5026
5026
|
}
|
|
5027
5027
|
}
|
|
5028
5028
|
const structuredError = (0, import_shared15.ensureStructuredError)(error, (err) => this.convertStreamingErrorToStructured(err));
|
|
5029
|
-
await this.
|
|
5029
|
+
await this.error("error", {
|
|
5030
5030
|
threadId,
|
|
5031
5031
|
source: "agent",
|
|
5032
5032
|
request: {
|
|
@@ -5158,18 +5158,18 @@ please use an LLM adapter instead.`
|
|
|
5158
5158
|
code: import_shared15.CopilotKitErrorCode.UNKNOWN
|
|
5159
5159
|
});
|
|
5160
5160
|
}
|
|
5161
|
-
async
|
|
5162
|
-
if (!this.
|
|
5161
|
+
async error(type, context, error, publicApiKey) {
|
|
5162
|
+
if (!this.onError)
|
|
5163
5163
|
return;
|
|
5164
5164
|
if (!publicApiKey) {
|
|
5165
|
-
if (!this.
|
|
5166
|
-
console.warn("CopilotKit:
|
|
5167
|
-
this.
|
|
5165
|
+
if (!this.hasWarnedAboutError) {
|
|
5166
|
+
console.warn("CopilotKit: onError handler provided but requires publicApiKey to be defined for error handling to work.");
|
|
5167
|
+
this.hasWarnedAboutError = true;
|
|
5168
5168
|
}
|
|
5169
5169
|
return;
|
|
5170
5170
|
}
|
|
5171
5171
|
try {
|
|
5172
|
-
const
|
|
5172
|
+
const errorEvent = {
|
|
5173
5173
|
type,
|
|
5174
5174
|
timestamp: Date.now(),
|
|
5175
5175
|
context,
|
|
@@ -5177,20 +5177,20 @@ please use an LLM adapter instead.`
|
|
|
5177
5177
|
error
|
|
5178
5178
|
}
|
|
5179
5179
|
};
|
|
5180
|
-
await this.
|
|
5181
|
-
} catch (
|
|
5182
|
-
console.error("Error in
|
|
5180
|
+
await this.onError(errorEvent);
|
|
5181
|
+
} catch (errorHandlerError) {
|
|
5182
|
+
console.error("Error in onError handler:", errorHandlerError);
|
|
5183
5183
|
}
|
|
5184
5184
|
}
|
|
5185
5185
|
/**
|
|
5186
|
-
* Public method to
|
|
5187
|
-
* This allows the GraphQL resolver to send validation errors through the
|
|
5186
|
+
* Public method to handle GraphQL validation errors
|
|
5187
|
+
* This allows the GraphQL resolver to send validation errors through the error system
|
|
5188
5188
|
*/
|
|
5189
|
-
async
|
|
5190
|
-
if (!this.
|
|
5189
|
+
async errorGraphQLError(error, context) {
|
|
5190
|
+
if (!this.onError)
|
|
5191
5191
|
return;
|
|
5192
5192
|
try {
|
|
5193
|
-
await this.
|
|
5193
|
+
await this.onError({
|
|
5194
5194
|
type: "error",
|
|
5195
5195
|
timestamp: Date.now(),
|
|
5196
5196
|
context: {
|
|
@@ -5210,8 +5210,8 @@ please use an LLM adapter instead.`
|
|
|
5210
5210
|
},
|
|
5211
5211
|
error
|
|
5212
5212
|
});
|
|
5213
|
-
} catch (
|
|
5214
|
-
console.error("Error in
|
|
5213
|
+
} catch (errorHandlerError) {
|
|
5214
|
+
console.error("Error in onError handler:", errorHandlerError);
|
|
5215
5215
|
}
|
|
5216
5216
|
}
|
|
5217
5217
|
};
|
|
@@ -6568,7 +6568,7 @@ var CopilotResolver = class {
|
|
|
6568
6568
|
logger2.debug("Cloud configuration provided, checking for public API key in headers");
|
|
6569
6569
|
if (!copilotCloudPublicApiKey) {
|
|
6570
6570
|
logger2.error("Public API key not found in headers");
|
|
6571
|
-
await copilotRuntime.
|
|
6571
|
+
await copilotRuntime.errorGraphQLError({
|
|
6572
6572
|
message: "X-CopilotCloud-Public-API-Key header is required",
|
|
6573
6573
|
code: "MISSING_PUBLIC_API_KEY",
|
|
6574
6574
|
type: "GraphQLError"
|