@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @copilotkit/runtime
|
|
2
2
|
|
|
3
|
+
## 1.9.2-next.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fac89c2: - refactor: rename onTrace to onError throughout codebase
|
|
8
|
+
|
|
9
|
+
- Rename CopilotTraceEvent to CopilotErrorEvent and CopilotTraceHandler to CopilotErrorHandler
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [fac89c2]
|
|
12
|
+
- @copilotkit/shared@1.9.2-next.18
|
|
13
|
+
|
|
3
14
|
## 1.9.2-next.17
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -40,7 +40,7 @@ var require_package = __commonJS({
|
|
|
40
40
|
publishConfig: {
|
|
41
41
|
access: "public"
|
|
42
42
|
},
|
|
43
|
-
version: "1.9.2-next.
|
|
43
|
+
version: "1.9.2-next.18",
|
|
44
44
|
sideEffects: false,
|
|
45
45
|
main: "./dist/index.js",
|
|
46
46
|
module: "./dist/index.mjs",
|
|
@@ -2735,8 +2735,8 @@ var CopilotRuntime = class {
|
|
|
2735
2735
|
delegateAgentProcessingToServiceAdapter;
|
|
2736
2736
|
observability;
|
|
2737
2737
|
availableAgents;
|
|
2738
|
-
|
|
2739
|
-
|
|
2738
|
+
onError;
|
|
2739
|
+
hasWarnedAboutError = false;
|
|
2740
2740
|
// +++ MCP Properties +++
|
|
2741
2741
|
mcpServersConfig;
|
|
2742
2742
|
mcpActionCache = /* @__PURE__ */ new Map();
|
|
@@ -2762,7 +2762,7 @@ var CopilotRuntime = class {
|
|
|
2762
2762
|
this.delegateAgentProcessingToServiceAdapter = (params == null ? void 0 : params.delegateAgentProcessingToServiceAdapter) || false;
|
|
2763
2763
|
this.observability = params == null ? void 0 : params.observability_c;
|
|
2764
2764
|
this.agents = (params == null ? void 0 : params.agents) ?? {};
|
|
2765
|
-
this.
|
|
2765
|
+
this.onError = params == null ? void 0 : params.onError;
|
|
2766
2766
|
this.mcpServersConfig = params == null ? void 0 : params.mcpServers;
|
|
2767
2767
|
this.createMCPClientImpl = params == null ? void 0 : params.createMCPClient;
|
|
2768
2768
|
if (this.mcpServersConfig && this.mcpServersConfig.length > 0 && !this.createMCPClientImpl) {
|
|
@@ -2841,7 +2841,7 @@ var CopilotRuntime = class {
|
|
|
2841
2841
|
const eventSource = new RuntimeEventSource();
|
|
2842
2842
|
const requestStartTime = Date.now();
|
|
2843
2843
|
const streamedChunks = [];
|
|
2844
|
-
await this.
|
|
2844
|
+
await this.error("request", {
|
|
2845
2845
|
threadId,
|
|
2846
2846
|
runId,
|
|
2847
2847
|
source: "runtime",
|
|
@@ -3037,7 +3037,7 @@ please use an LLM adapter instead.`
|
|
|
3037
3037
|
} else {
|
|
3038
3038
|
structuredError = ensureStructuredError2(error, (err) => this.convertStreamingErrorToStructured(err));
|
|
3039
3039
|
}
|
|
3040
|
-
await this.
|
|
3040
|
+
await this.error("error", {
|
|
3041
3041
|
threadId,
|
|
3042
3042
|
runId,
|
|
3043
3043
|
source: "runtime",
|
|
@@ -3285,7 +3285,7 @@ please use an LLM adapter instead.`
|
|
|
3285
3285
|
const requestStartTime = Date.now();
|
|
3286
3286
|
const streamedChunks = [];
|
|
3287
3287
|
const threadId = threadIdFromRequest ?? agentSession.threadId;
|
|
3288
|
-
await this.
|
|
3288
|
+
await this.error("agent_state", {
|
|
3289
3289
|
threadId,
|
|
3290
3290
|
source: "agent",
|
|
3291
3291
|
request: {
|
|
@@ -3421,7 +3421,7 @@ please use an LLM adapter instead.`
|
|
|
3421
3421
|
}
|
|
3422
3422
|
}
|
|
3423
3423
|
const structuredError = ensureStructuredError2(err, (error) => this.convertStreamingErrorToStructured(error));
|
|
3424
|
-
await this.
|
|
3424
|
+
await this.error("error", {
|
|
3425
3425
|
threadId,
|
|
3426
3426
|
source: "agent",
|
|
3427
3427
|
request: {
|
|
@@ -3510,7 +3510,7 @@ please use an LLM adapter instead.`
|
|
|
3510
3510
|
}
|
|
3511
3511
|
}
|
|
3512
3512
|
const structuredError = ensureStructuredError2(error, (err) => this.convertStreamingErrorToStructured(err));
|
|
3513
|
-
await this.
|
|
3513
|
+
await this.error("error", {
|
|
3514
3514
|
threadId,
|
|
3515
3515
|
source: "agent",
|
|
3516
3516
|
request: {
|
|
@@ -3642,18 +3642,18 @@ please use an LLM adapter instead.`
|
|
|
3642
3642
|
code: CopilotKitErrorCode2.UNKNOWN
|
|
3643
3643
|
});
|
|
3644
3644
|
}
|
|
3645
|
-
async
|
|
3646
|
-
if (!this.
|
|
3645
|
+
async error(type, context, error, publicApiKey) {
|
|
3646
|
+
if (!this.onError)
|
|
3647
3647
|
return;
|
|
3648
3648
|
if (!publicApiKey) {
|
|
3649
|
-
if (!this.
|
|
3650
|
-
console.warn("CopilotKit:
|
|
3651
|
-
this.
|
|
3649
|
+
if (!this.hasWarnedAboutError) {
|
|
3650
|
+
console.warn("CopilotKit: onError handler provided but requires publicApiKey to be defined for error handling to work.");
|
|
3651
|
+
this.hasWarnedAboutError = true;
|
|
3652
3652
|
}
|
|
3653
3653
|
return;
|
|
3654
3654
|
}
|
|
3655
3655
|
try {
|
|
3656
|
-
const
|
|
3656
|
+
const errorEvent = {
|
|
3657
3657
|
type,
|
|
3658
3658
|
timestamp: Date.now(),
|
|
3659
3659
|
context,
|
|
@@ -3661,20 +3661,20 @@ please use an LLM adapter instead.`
|
|
|
3661
3661
|
error
|
|
3662
3662
|
}
|
|
3663
3663
|
};
|
|
3664
|
-
await this.
|
|
3665
|
-
} catch (
|
|
3666
|
-
console.error("Error in
|
|
3664
|
+
await this.onError(errorEvent);
|
|
3665
|
+
} catch (errorHandlerError) {
|
|
3666
|
+
console.error("Error in onError handler:", errorHandlerError);
|
|
3667
3667
|
}
|
|
3668
3668
|
}
|
|
3669
3669
|
/**
|
|
3670
|
-
* Public method to
|
|
3671
|
-
* This allows the GraphQL resolver to send validation errors through the
|
|
3670
|
+
* Public method to handle GraphQL validation errors
|
|
3671
|
+
* This allows the GraphQL resolver to send validation errors through the error system
|
|
3672
3672
|
*/
|
|
3673
|
-
async
|
|
3674
|
-
if (!this.
|
|
3673
|
+
async errorGraphQLError(error, context) {
|
|
3674
|
+
if (!this.onError)
|
|
3675
3675
|
return;
|
|
3676
3676
|
try {
|
|
3677
|
-
await this.
|
|
3677
|
+
await this.onError({
|
|
3678
3678
|
type: "error",
|
|
3679
3679
|
timestamp: Date.now(),
|
|
3680
3680
|
context: {
|
|
@@ -3694,8 +3694,8 @@ please use an LLM adapter instead.`
|
|
|
3694
3694
|
},
|
|
3695
3695
|
error
|
|
3696
3696
|
});
|
|
3697
|
-
} catch (
|
|
3698
|
-
console.error("Error in
|
|
3697
|
+
} catch (errorHandlerError) {
|
|
3698
|
+
console.error("Error in onError handler:", errorHandlerError);
|
|
3699
3699
|
}
|
|
3700
3700
|
}
|
|
3701
3701
|
};
|
|
@@ -5016,7 +5016,7 @@ var CopilotResolver = class {
|
|
|
5016
5016
|
logger2.debug("Cloud configuration provided, checking for public API key in headers");
|
|
5017
5017
|
if (!copilotCloudPublicApiKey) {
|
|
5018
5018
|
logger2.error("Public API key not found in headers");
|
|
5019
|
-
await copilotRuntime.
|
|
5019
|
+
await copilotRuntime.errorGraphQLError({
|
|
5020
5020
|
message: "X-CopilotCloud-Public-API-Key header is required",
|
|
5021
5021
|
code: "MISSING_PUBLIC_API_KEY",
|
|
5022
5022
|
type: "GraphQLError"
|
|
@@ -5824,4 +5824,4 @@ export {
|
|
|
5824
5824
|
getCommonConfig,
|
|
5825
5825
|
copilotRuntimeNodeHttpEndpoint
|
|
5826
5826
|
};
|
|
5827
|
-
//# sourceMappingURL=chunk-
|
|
5827
|
+
//# sourceMappingURL=chunk-FW5UOGQ2.mjs.map
|