@copilotkit/react-core 1.9.2-next.1 → 1.9.2-next.10
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 +71 -0
- package/dist/{chunk-CCESTGAM.mjs → chunk-3OQM3NEK.mjs} +2 -2
- package/dist/{chunk-2FW7HH6W.mjs → chunk-3YHYWAHK.mjs} +3 -3
- package/dist/{chunk-RUY6MLHA.mjs → chunk-55QZ2SVJ.mjs} +36 -6
- package/dist/chunk-55QZ2SVJ.mjs.map +1 -0
- package/dist/chunk-57K2ZJ5F.mjs +348 -0
- package/dist/chunk-57K2ZJ5F.mjs.map +1 -0
- package/dist/{chunk-XY5BN4HZ.mjs → chunk-ADIITPD2.mjs} +9 -6
- package/dist/{chunk-XY5BN4HZ.mjs.map → chunk-ADIITPD2.mjs.map} +1 -1
- package/dist/{chunk-Q5D5XQFA.mjs → chunk-CMQV4XNY.mjs} +2 -2
- package/dist/{chunk-LDACFA2B.mjs → chunk-EF5BNM34.mjs} +3 -3
- package/dist/{chunk-UHQMV2CE.mjs → chunk-ERXWDCY6.mjs} +2 -2
- package/dist/{chunk-UIT6QMUJ.mjs → chunk-EXU7GWLC.mjs} +5 -5
- package/dist/{chunk-YDENFEKA.mjs → chunk-FXK6RQIN.mjs} +2 -2
- package/dist/{chunk-HJP2RX5R.mjs → chunk-G7LYGERN.mjs} +81 -14
- package/dist/chunk-G7LYGERN.mjs.map +1 -0
- package/dist/{chunk-NNSXCFQO.mjs → chunk-JDEWNLNP.mjs} +41 -7
- package/dist/chunk-JDEWNLNP.mjs.map +1 -0
- package/dist/{chunk-C6F6EQNA.mjs → chunk-JPMIAGI6.mjs} +2 -2
- package/dist/{chunk-T42PN5VN.mjs → chunk-NQVCZQ5T.mjs} +4 -4
- package/dist/{chunk-YZDRMIOM.mjs → chunk-OF4SZTLL.mjs} +4 -4
- package/dist/{chunk-QQZLIEXK.mjs → chunk-SJJNFYGQ.mjs} +3 -3
- package/dist/{chunk-LZDDYZEY.mjs → chunk-UBNRUXEK.mjs} +2 -2
- package/dist/{chunk-SGLWMQ2J.mjs → chunk-WOGURSAL.mjs} +12 -9
- package/dist/chunk-WOGURSAL.mjs.map +1 -0
- package/dist/{chunk-6KGEF242.mjs → chunk-XFOTNHYA.mjs} +3 -2
- package/dist/chunk-XFOTNHYA.mjs.map +1 -0
- package/dist/chunk-YAF2LATQ.mjs +310 -0
- package/dist/chunk-YAF2LATQ.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +39 -4
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +3 -3
- package/dist/components/copilot-provider/copilotkit-props.d.ts +21 -2
- package/dist/components/copilot-provider/copilotkit-props.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +330 -240
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +8 -8
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +330 -240
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +8 -8
- package/dist/components/error-boundary/error-boundary.js +135 -146
- package/dist/components/error-boundary/error-boundary.js.map +1 -1
- package/dist/components/error-boundary/error-boundary.mjs +4 -4
- package/dist/components/error-boundary/error-utils.js.map +1 -1
- package/dist/components/error-boundary/error-utils.mjs +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +330 -240
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -8
- package/dist/components/toast/toast-provider.js +118 -85
- package/dist/components/toast/toast-provider.js.map +1 -1
- package/dist/components/toast/toast-provider.mjs +1 -1
- package/dist/components/usage-banner.js +135 -146
- package/dist/components/usage-banner.js.map +1 -1
- package/dist/components/usage-banner.mjs +1 -1
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +2 -1
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.js +2 -1
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-f9b2b4c3.d.ts → copilot-context-3da805ab.d.ts} +5 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +108 -12
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +19 -19
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +105 -12
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +5 -5
- package/dist/hooks/use-coagent-state-render.js +2 -1
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +3 -3
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +108 -12
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +11 -11
- package/dist/hooks/use-copilot-action.js +2 -1
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +4 -4
- package/dist/hooks/use-copilot-additional-instructions.js +2 -1
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +2 -1
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +5 -5
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +105 -12
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +10 -10
- package/dist/hooks/use-copilot-readable.js +2 -1
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-copilot-runtime-client.d.ts +2 -0
- package/dist/hooks/use-copilot-runtime-client.js +52 -2
- package/dist/hooks/use-copilot-runtime-client.js.map +1 -1
- package/dist/hooks/use-copilot-runtime-client.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt-render.js +2 -1
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +105 -12
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +11 -11
- package/dist/hooks/use-make-copilot-document-readable.js +2 -1
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +404 -249
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -20
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +9 -9
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +9 -9
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/utils/extract.d.ts +1 -1
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +8 -8
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +8 -8
- package/jest.config.js +7 -3
- package/package.json +4 -3
- package/src/components/copilot-provider/__tests__/copilotkit-trace.test.tsx +75 -0
- package/src/components/copilot-provider/copilot-messages.tsx +46 -5
- package/src/components/copilot-provider/copilotkit-props.tsx +21 -0
- package/src/components/copilot-provider/copilotkit.tsx +5 -1
- package/src/components/toast/toast-provider.tsx +49 -24
- package/src/components/usage-banner.tsx +144 -147
- package/src/context/copilot-context.tsx +7 -1
- package/src/hooks/use-chat.ts +106 -6
- package/src/hooks/use-coagent.ts +5 -0
- package/src/hooks/use-copilot-runtime-client.ts +41 -39
- package/tsconfig.json +1 -8
- package/tsup.config.ts +6 -6
- package/dist/chunk-6KGEF242.mjs.map +0 -1
- package/dist/chunk-HD2GE3DK.mjs +0 -359
- package/dist/chunk-HD2GE3DK.mjs.map +0 -1
- package/dist/chunk-HJP2RX5R.mjs.map +0 -1
- package/dist/chunk-NNSXCFQO.mjs.map +0 -1
- package/dist/chunk-RUY6MLHA.mjs.map +0 -1
- package/dist/chunk-SGLWMQ2J.mjs.map +0 -1
- package/dist/chunk-VRXANACV.mjs +0 -277
- package/dist/chunk-VRXANACV.mjs.map +0 -1
- package/dist/utils/utils.test.d.ts +0 -2
- package/dist/utils/utils.test.js +0 -9
- package/dist/utils/utils.test.js.map +0 -1
- package/dist/utils/utils.test.mjs +0 -7
- package/dist/utils/utils.test.mjs.map +0 -1
- /package/dist/{chunk-CCESTGAM.mjs.map → chunk-3OQM3NEK.mjs.map} +0 -0
- /package/dist/{chunk-2FW7HH6W.mjs.map → chunk-3YHYWAHK.mjs.map} +0 -0
- /package/dist/{chunk-Q5D5XQFA.mjs.map → chunk-CMQV4XNY.mjs.map} +0 -0
- /package/dist/{chunk-LDACFA2B.mjs.map → chunk-EF5BNM34.mjs.map} +0 -0
- /package/dist/{chunk-UHQMV2CE.mjs.map → chunk-ERXWDCY6.mjs.map} +0 -0
- /package/dist/{chunk-UIT6QMUJ.mjs.map → chunk-EXU7GWLC.mjs.map} +0 -0
- /package/dist/{chunk-YDENFEKA.mjs.map → chunk-FXK6RQIN.mjs.map} +0 -0
- /package/dist/{chunk-C6F6EQNA.mjs.map → chunk-JPMIAGI6.mjs.map} +0 -0
- /package/dist/{chunk-T42PN5VN.mjs.map → chunk-NQVCZQ5T.mjs.map} +0 -0
- /package/dist/{chunk-YZDRMIOM.mjs.map → chunk-OF4SZTLL.mjs.map} +0 -0
- /package/dist/{chunk-QQZLIEXK.mjs.map → chunk-SJJNFYGQ.mjs.map} +0 -0
- /package/dist/{chunk-LZDDYZEY.mjs.map → chunk-UBNRUXEK.mjs.map} +0 -0
|
@@ -157,7 +157,8 @@ var emptyCopilotContext = {
|
|
|
157
157
|
},
|
|
158
158
|
langGraphInterruptAction: null,
|
|
159
159
|
setLangGraphInterruptAction: () => null,
|
|
160
|
-
removeLangGraphInterruptAction: () => null
|
|
160
|
+
removeLangGraphInterruptAction: () => null,
|
|
161
|
+
onTrace: void 0
|
|
161
162
|
};
|
|
162
163
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
163
164
|
function useCopilotContext() {
|
|
@@ -233,8 +234,35 @@ function shouldShowDevConsole(showDevConsole) {
|
|
|
233
234
|
// src/hooks/use-copilot-runtime-client.ts
|
|
234
235
|
var useCopilotRuntimeClient = (options) => {
|
|
235
236
|
const { setBannerError } = useToast();
|
|
236
|
-
const _a = options, { showDevConsole } = _a, runtimeOptions = __objRest(_a, ["showDevConsole"]);
|
|
237
|
+
const _a = options, { showDevConsole, onTrace } = _a, runtimeOptions = __objRest(_a, ["showDevConsole", "onTrace"]);
|
|
237
238
|
const lastStructuredErrorRef = (0, import_react3.useRef)(null);
|
|
239
|
+
const traceUIError = (error, originalError) => __async(void 0, null, function* () {
|
|
240
|
+
if (!onTrace || !runtimeOptions.publicApiKey)
|
|
241
|
+
return;
|
|
242
|
+
try {
|
|
243
|
+
const traceEvent = {
|
|
244
|
+
type: "error",
|
|
245
|
+
timestamp: Date.now(),
|
|
246
|
+
context: {
|
|
247
|
+
source: "ui",
|
|
248
|
+
request: {
|
|
249
|
+
operation: "runtimeClient",
|
|
250
|
+
url: runtimeOptions.url,
|
|
251
|
+
startTime: Date.now()
|
|
252
|
+
},
|
|
253
|
+
technical: {
|
|
254
|
+
environment: "browser",
|
|
255
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
|
|
256
|
+
stackTrace: originalError instanceof Error ? originalError.stack : void 0
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
error
|
|
260
|
+
};
|
|
261
|
+
yield onTrace(traceEvent);
|
|
262
|
+
} catch (traceError) {
|
|
263
|
+
console.error("Error in onTrace handler:", traceError);
|
|
264
|
+
}
|
|
265
|
+
});
|
|
238
266
|
const runtimeClient = (0, import_react3.useMemo)(() => {
|
|
239
267
|
return new import_runtime_client_gql2.CopilotRuntimeClient(__spreadProps(__spreadValues({}, runtimeOptions), {
|
|
240
268
|
handleGQLErrors: (error) => {
|
|
@@ -262,12 +290,14 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
262
290
|
const ckError = createStructuredError(gqlError);
|
|
263
291
|
if (ckError) {
|
|
264
292
|
setBannerError(ckError);
|
|
293
|
+
traceUIError(ckError, gqlError);
|
|
265
294
|
} else {
|
|
266
295
|
const fallbackError = new import_shared3.CopilotKitError({
|
|
267
296
|
message: gqlError.message,
|
|
268
297
|
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
269
298
|
});
|
|
270
299
|
setBannerError(fallbackError);
|
|
300
|
+
traceUIError(fallbackError, gqlError);
|
|
271
301
|
}
|
|
272
302
|
};
|
|
273
303
|
graphQLErrors.forEach(routeError);
|
|
@@ -281,6 +311,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
281
311
|
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
282
312
|
});
|
|
283
313
|
setBannerError(fallbackError);
|
|
314
|
+
traceUIError(fallbackError, error);
|
|
284
315
|
}
|
|
285
316
|
}
|
|
286
317
|
},
|
|
@@ -293,7 +324,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
293
324
|
setBannerError(warningError);
|
|
294
325
|
}
|
|
295
326
|
}));
|
|
296
|
-
}, [runtimeOptions, setBannerError, showDevConsole]);
|
|
327
|
+
}, [runtimeOptions, setBannerError, showDevConsole, onTrace]);
|
|
297
328
|
return runtimeClient;
|
|
298
329
|
};
|
|
299
330
|
function createStructuredError(gqlError) {
|
|
@@ -465,6 +496,35 @@ function useChat(options) {
|
|
|
465
496
|
} = options;
|
|
466
497
|
const runChatCompletionRef = (0, import_react5.useRef)();
|
|
467
498
|
const addErrorToast = useErrorToast();
|
|
499
|
+
const { setBannerError } = useToast();
|
|
500
|
+
const { onTrace } = useCopilotContext();
|
|
501
|
+
const traceUIError = (error, originalError) => __async(this, null, function* () {
|
|
502
|
+
if (!onTrace || !(copilotConfig == null ? void 0 : copilotConfig.publicApiKey))
|
|
503
|
+
return;
|
|
504
|
+
try {
|
|
505
|
+
const traceEvent = {
|
|
506
|
+
type: "error",
|
|
507
|
+
timestamp: Date.now(),
|
|
508
|
+
context: {
|
|
509
|
+
source: "ui",
|
|
510
|
+
request: {
|
|
511
|
+
operation: "useChatCompletion",
|
|
512
|
+
url: copilotConfig.chatApiEndpoint,
|
|
513
|
+
startTime: Date.now()
|
|
514
|
+
},
|
|
515
|
+
technical: {
|
|
516
|
+
environment: "browser",
|
|
517
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0,
|
|
518
|
+
stackTrace: originalError instanceof Error ? originalError.stack : void 0
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
error
|
|
522
|
+
};
|
|
523
|
+
yield onTrace(traceEvent);
|
|
524
|
+
} catch (traceError) {
|
|
525
|
+
console.error("Error in use-chat onTrace handler:", traceError);
|
|
526
|
+
}
|
|
527
|
+
});
|
|
468
528
|
const agentSessionRef = (0, import_react5.useRef)(agentSession);
|
|
469
529
|
agentSessionRef.current = agentSession;
|
|
470
530
|
const runIdRef = (0, import_react5.useRef)(runId);
|
|
@@ -484,7 +544,7 @@ function useChat(options) {
|
|
|
484
544
|
const pendingAppendsRef = (0, import_react5.useRef)([]);
|
|
485
545
|
const runChatCompletion = useAsyncCallback(
|
|
486
546
|
(previousMessages) => __async(this, null, function* () {
|
|
487
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
547
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
488
548
|
setIsLoading(true);
|
|
489
549
|
const interruptEvent = langGraphInterruptAction == null ? void 0 : langGraphInterruptAction.event;
|
|
490
550
|
if ((interruptEvent == null ? void 0 : interruptEvent.name) === import_runtime_client_gql3.MetaEventName.LangGraphInterruptEvent && (interruptEvent == null ? void 0 : interruptEvent.value) && !(interruptEvent == null ? void 0 : interruptEvent.response) && agentSessionRef.current) {
|
|
@@ -616,20 +676,53 @@ function useChat(options) {
|
|
|
616
676
|
messages2 = (0, import_runtime_client_gql3.convertGqlOutputToMessages)(
|
|
617
677
|
(0, import_runtime_client_gql3.filterAdjacentAgentStateMessages)(rawMessagesResponse)
|
|
618
678
|
);
|
|
619
|
-
if (messages2.length === 0) {
|
|
620
|
-
continue;
|
|
621
|
-
}
|
|
622
679
|
newMessages = [];
|
|
623
680
|
if (((_k = value.generateCopilotResponse.status) == null ? void 0 : _k.__typename) === "FailedResponseStatus" && value.generateCopilotResponse.status.reason === "GUARDRAILS_VALIDATION_FAILED") {
|
|
681
|
+
const guardrailsReason = ((_l = value.generateCopilotResponse.status.details) == null ? void 0 : _l.guardrailsReason) || "";
|
|
624
682
|
newMessages = [
|
|
625
683
|
new import_runtime_client_gql3.TextMessage({
|
|
626
684
|
role: import_runtime_client_gql3.MessageRole.Assistant,
|
|
627
|
-
content:
|
|
685
|
+
content: guardrailsReason
|
|
628
686
|
})
|
|
629
687
|
];
|
|
688
|
+
const guardrailsError = new import_shared4.CopilotKitError({
|
|
689
|
+
message: `Guardrails validation failed: ${guardrailsReason}`,
|
|
690
|
+
code: import_shared4.CopilotKitErrorCode.MISUSE
|
|
691
|
+
});
|
|
692
|
+
yield traceUIError(guardrailsError, {
|
|
693
|
+
statusReason: value.generateCopilotResponse.status.reason,
|
|
694
|
+
statusDetails: value.generateCopilotResponse.status.details
|
|
695
|
+
});
|
|
630
696
|
setMessages([...previousMessages, ...newMessages]);
|
|
631
697
|
break;
|
|
632
|
-
}
|
|
698
|
+
}
|
|
699
|
+
if (((_m = value.generateCopilotResponse.status) == null ? void 0 : _m.__typename) === "FailedResponseStatus" && value.generateCopilotResponse.status.reason === "UNKNOWN_ERROR") {
|
|
700
|
+
const errorMessage = ((_n = value.generateCopilotResponse.status.details) == null ? void 0 : _n.description) || "An unknown error occurred";
|
|
701
|
+
const statusDetails = value.generateCopilotResponse.status.details;
|
|
702
|
+
const originalError = (statusDetails == null ? void 0 : statusDetails.originalError) || (statusDetails == null ? void 0 : statusDetails.error);
|
|
703
|
+
const originalCode = (originalError == null ? void 0 : originalError.code) || ((_o = originalError == null ? void 0 : originalError.extensions) == null ? void 0 : _o.code);
|
|
704
|
+
const originalSeverity = (originalError == null ? void 0 : originalError.severity) || ((_p = originalError == null ? void 0 : originalError.extensions) == null ? void 0 : _p.severity);
|
|
705
|
+
const originalVisibility = (originalError == null ? void 0 : originalError.visibility) || ((_q = originalError == null ? void 0 : originalError.extensions) == null ? void 0 : _q.visibility);
|
|
706
|
+
let errorCode = import_shared4.CopilotKitErrorCode.NETWORK_ERROR;
|
|
707
|
+
if (originalCode && Object.values(import_shared4.CopilotKitErrorCode).includes(originalCode)) {
|
|
708
|
+
errorCode = originalCode;
|
|
709
|
+
}
|
|
710
|
+
const structuredError = new import_shared4.CopilotKitError({
|
|
711
|
+
message: errorMessage,
|
|
712
|
+
code: errorCode,
|
|
713
|
+
severity: originalSeverity,
|
|
714
|
+
visibility: originalVisibility
|
|
715
|
+
});
|
|
716
|
+
setBannerError(structuredError);
|
|
717
|
+
yield traceUIError(structuredError, {
|
|
718
|
+
statusReason: value.generateCopilotResponse.status.reason,
|
|
719
|
+
statusDetails: value.generateCopilotResponse.status.details,
|
|
720
|
+
originalErrorCode: originalCode,
|
|
721
|
+
preservedStructure: !!originalCode
|
|
722
|
+
});
|
|
723
|
+
setIsLoading(false);
|
|
724
|
+
break;
|
|
725
|
+
} else if (messages2.length > 0) {
|
|
633
726
|
newMessages = [...messages2];
|
|
634
727
|
for (const message of messages2) {
|
|
635
728
|
if (message.isAgentStateMessage() && !message.active && !executedCoAgentStateRenders.includes(message.id) && onCoAgentStateRender) {
|
|
@@ -760,11 +853,11 @@ function useChat(options) {
|
|
|
760
853
|
followUp !== false && // and we executed an action
|
|
761
854
|
(didExecuteAction || // the last message is a server side result
|
|
762
855
|
!isAgentRun && finalMessages.length && finalMessages[finalMessages.length - 1].isResultMessage()) && // the user did not stop generation
|
|
763
|
-
!((
|
|
856
|
+
!((_r = chatAbortControllerRef.current) == null ? void 0 : _r.signal.aborted)
|
|
764
857
|
) {
|
|
765
858
|
yield new Promise((resolve) => setTimeout(resolve, 10));
|
|
766
859
|
return yield runChatCompletionRef.current(finalMessages);
|
|
767
|
-
} else if ((
|
|
860
|
+
} else if ((_s = chatAbortControllerRef.current) == null ? void 0 : _s.signal.aborted) {
|
|
768
861
|
const repairedMessages = finalMessages.filter((message, actionExecutionIndex) => {
|
|
769
862
|
if (message.isActionExecutionMessage()) {
|
|
770
863
|
return finalMessages.find(
|
|
@@ -775,7 +868,7 @@ function useChat(options) {
|
|
|
775
868
|
});
|
|
776
869
|
const repairedMessageIds = repairedMessages.map((message) => message.id);
|
|
777
870
|
setMessages(repairedMessages);
|
|
778
|
-
if ((
|
|
871
|
+
if ((_t = agentSessionRef.current) == null ? void 0 : _t.nodeName) {
|
|
779
872
|
setAgentSession({
|
|
780
873
|
threadId: agentSessionRef.current.threadId,
|
|
781
874
|
agentName: agentSessionRef.current.agentName,
|