@copilotkit/react-core 1.9.2-next.10 → 1.9.2-next.3
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 +0 -56
- package/dist/{chunk-3YHYWAHK.mjs → chunk-2FW7HH6W.mjs} +3 -3
- package/dist/{chunk-OF4SZTLL.mjs → chunk-2XSUXRGG.mjs} +4 -4
- package/dist/{chunk-WOGURSAL.mjs → chunk-3XXVDQ7Z.mjs} +8 -10
- package/dist/chunk-3XXVDQ7Z.mjs.map +1 -0
- package/dist/{chunk-XFOTNHYA.mjs → chunk-6KGEF242.mjs} +2 -3
- package/dist/chunk-6KGEF242.mjs.map +1 -0
- package/dist/{chunk-EXU7GWLC.mjs → chunk-C3SYYVMR.mjs} +5 -5
- package/dist/{chunk-JPMIAGI6.mjs → chunk-C6F6EQNA.mjs} +2 -2
- package/dist/{chunk-3OQM3NEK.mjs → chunk-CCESTGAM.mjs} +2 -2
- package/dist/chunk-HD2GE3DK.mjs +359 -0
- package/dist/chunk-HD2GE3DK.mjs.map +1 -0
- package/dist/{chunk-G7LYGERN.mjs → chunk-HJP2RX5R.mjs} +14 -81
- package/dist/chunk-HJP2RX5R.mjs.map +1 -0
- package/dist/{chunk-ADIITPD2.mjs → chunk-IVXB3GYK.mjs} +6 -9
- package/dist/{chunk-ADIITPD2.mjs.map → chunk-IVXB3GYK.mjs.map} +1 -1
- package/dist/{chunk-EF5BNM34.mjs → chunk-LDACFA2B.mjs} +3 -3
- package/dist/{chunk-UBNRUXEK.mjs → chunk-LZDDYZEY.mjs} +2 -2
- package/dist/{chunk-FXK6RQIN.mjs → chunk-PUNALT2S.mjs} +2 -2
- package/dist/{chunk-CMQV4XNY.mjs → chunk-Q5D5XQFA.mjs} +2 -2
- package/dist/{chunk-SJJNFYGQ.mjs → chunk-QQZLIEXK.mjs} +3 -3
- package/dist/{chunk-JDEWNLNP.mjs → chunk-QRGDQSGZ.mjs} +5 -38
- package/dist/chunk-QRGDQSGZ.mjs.map +1 -0
- package/dist/{chunk-55QZ2SVJ.mjs → chunk-RUY6MLHA.mjs} +6 -36
- package/dist/chunk-RUY6MLHA.mjs.map +1 -0
- package/dist/{chunk-NQVCZQ5T.mjs → chunk-T42PN5VN.mjs} +4 -4
- package/dist/{chunk-ERXWDCY6.mjs → chunk-UHQMV2CE.mjs} +2 -2
- package/dist/chunk-VRXANACV.mjs +277 -0
- package/dist/chunk-VRXANACV.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +3 -37
- 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 +2 -21
- 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 +238 -326
- 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 +238 -326
- 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 +146 -135
- 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 +238 -326
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -8
- package/dist/components/toast/toast-provider.js +85 -118
- 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 +146 -135
- 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 +1 -2
- 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 +1 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-3da805ab.d.ts → copilot-context-f9b2b4c3.d.ts} +1 -5
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +12 -108
- 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 +12 -105
- 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 +1 -2
- 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 +12 -108
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +11 -11
- package/dist/hooks/use-copilot-action.js +1 -2
- 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 +1 -2
- 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 +1 -2
- 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 +12 -105
- 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 +1 -2
- 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 +0 -2
- package/dist/hooks/use-copilot-runtime-client.js +2 -52
- 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 +1 -2
- 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 +12 -105
- 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 +1 -2
- 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 +247 -400
- 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/dist/utils/utils.test.d.ts +2 -0
- package/dist/utils/utils.test.js +9 -0
- package/dist/utils/utils.test.js.map +1 -0
- package/dist/utils/utils.test.mjs +7 -0
- package/dist/utils/utils.test.mjs.map +1 -0
- package/jest.config.js +3 -7
- package/package.json +3 -4
- package/src/components/copilot-provider/copilot-messages.tsx +3 -42
- package/src/components/copilot-provider/copilotkit-props.tsx +0 -21
- package/src/components/copilot-provider/copilotkit.tsx +0 -2
- package/src/components/toast/toast-provider.tsx +24 -49
- package/src/components/usage-banner.tsx +147 -144
- package/src/context/copilot-context.tsx +1 -7
- package/src/hooks/use-chat.ts +6 -106
- package/src/hooks/use-coagent.ts +0 -5
- package/src/hooks/use-copilot-runtime-client.ts +39 -41
- package/tsconfig.json +8 -1
- package/tsup.config.ts +6 -6
- package/dist/chunk-55QZ2SVJ.mjs.map +0 -1
- package/dist/chunk-57K2ZJ5F.mjs +0 -348
- package/dist/chunk-57K2ZJ5F.mjs.map +0 -1
- package/dist/chunk-G7LYGERN.mjs.map +0 -1
- package/dist/chunk-JDEWNLNP.mjs.map +0 -1
- package/dist/chunk-WOGURSAL.mjs.map +0 -1
- package/dist/chunk-XFOTNHYA.mjs.map +0 -1
- package/dist/chunk-YAF2LATQ.mjs +0 -310
- package/dist/chunk-YAF2LATQ.mjs.map +0 -1
- package/src/components/copilot-provider/__tests__/copilotkit-trace.test.tsx +0 -75
- /package/dist/{chunk-3YHYWAHK.mjs.map → chunk-2FW7HH6W.mjs.map} +0 -0
- /package/dist/{chunk-OF4SZTLL.mjs.map → chunk-2XSUXRGG.mjs.map} +0 -0
- /package/dist/{chunk-EXU7GWLC.mjs.map → chunk-C3SYYVMR.mjs.map} +0 -0
- /package/dist/{chunk-JPMIAGI6.mjs.map → chunk-C6F6EQNA.mjs.map} +0 -0
- /package/dist/{chunk-3OQM3NEK.mjs.map → chunk-CCESTGAM.mjs.map} +0 -0
- /package/dist/{chunk-EF5BNM34.mjs.map → chunk-LDACFA2B.mjs.map} +0 -0
- /package/dist/{chunk-UBNRUXEK.mjs.map → chunk-LZDDYZEY.mjs.map} +0 -0
- /package/dist/{chunk-FXK6RQIN.mjs.map → chunk-PUNALT2S.mjs.map} +0 -0
- /package/dist/{chunk-CMQV4XNY.mjs.map → chunk-Q5D5XQFA.mjs.map} +0 -0
- /package/dist/{chunk-SJJNFYGQ.mjs.map → chunk-QQZLIEXK.mjs.map} +0 -0
- /package/dist/{chunk-NQVCZQ5T.mjs.map → chunk-T42PN5VN.mjs.map} +0 -0
- /package/dist/{chunk-ERXWDCY6.mjs.map → chunk-UHQMV2CE.mjs.map} +0 -0
|
@@ -157,8 +157,7 @@ var emptyCopilotContext = {
|
|
|
157
157
|
},
|
|
158
158
|
langGraphInterruptAction: null,
|
|
159
159
|
setLangGraphInterruptAction: () => null,
|
|
160
|
-
removeLangGraphInterruptAction: () => null
|
|
161
|
-
onTrace: void 0
|
|
160
|
+
removeLangGraphInterruptAction: () => null
|
|
162
161
|
};
|
|
163
162
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
164
163
|
function useCopilotContext() {
|
|
@@ -234,35 +233,8 @@ function shouldShowDevConsole(showDevConsole) {
|
|
|
234
233
|
// src/hooks/use-copilot-runtime-client.ts
|
|
235
234
|
var useCopilotRuntimeClient = (options) => {
|
|
236
235
|
const { setBannerError } = useToast();
|
|
237
|
-
const _a = options, { showDevConsole
|
|
236
|
+
const _a = options, { showDevConsole } = _a, runtimeOptions = __objRest(_a, ["showDevConsole"]);
|
|
238
237
|
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
|
-
});
|
|
266
238
|
const runtimeClient = (0, import_react3.useMemo)(() => {
|
|
267
239
|
return new import_runtime_client_gql2.CopilotRuntimeClient(__spreadProps(__spreadValues({}, runtimeOptions), {
|
|
268
240
|
handleGQLErrors: (error) => {
|
|
@@ -290,14 +262,12 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
290
262
|
const ckError = createStructuredError(gqlError);
|
|
291
263
|
if (ckError) {
|
|
292
264
|
setBannerError(ckError);
|
|
293
|
-
traceUIError(ckError, gqlError);
|
|
294
265
|
} else {
|
|
295
266
|
const fallbackError = new import_shared3.CopilotKitError({
|
|
296
267
|
message: gqlError.message,
|
|
297
268
|
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
298
269
|
});
|
|
299
270
|
setBannerError(fallbackError);
|
|
300
|
-
traceUIError(fallbackError, gqlError);
|
|
301
271
|
}
|
|
302
272
|
};
|
|
303
273
|
graphQLErrors.forEach(routeError);
|
|
@@ -311,7 +281,6 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
311
281
|
code: import_shared3.CopilotKitErrorCode.UNKNOWN
|
|
312
282
|
});
|
|
313
283
|
setBannerError(fallbackError);
|
|
314
|
-
traceUIError(fallbackError, error);
|
|
315
284
|
}
|
|
316
285
|
}
|
|
317
286
|
},
|
|
@@ -324,7 +293,7 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
324
293
|
setBannerError(warningError);
|
|
325
294
|
}
|
|
326
295
|
}));
|
|
327
|
-
}, [runtimeOptions, setBannerError, showDevConsole
|
|
296
|
+
}, [runtimeOptions, setBannerError, showDevConsole]);
|
|
328
297
|
return runtimeClient;
|
|
329
298
|
};
|
|
330
299
|
function createStructuredError(gqlError) {
|
|
@@ -496,35 +465,6 @@ function useChat(options) {
|
|
|
496
465
|
} = options;
|
|
497
466
|
const runChatCompletionRef = (0, import_react5.useRef)();
|
|
498
467
|
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
|
-
});
|
|
528
468
|
const agentSessionRef = (0, import_react5.useRef)(agentSession);
|
|
529
469
|
agentSessionRef.current = agentSession;
|
|
530
470
|
const runIdRef = (0, import_react5.useRef)(runId);
|
|
@@ -544,7 +484,7 @@ function useChat(options) {
|
|
|
544
484
|
const pendingAppendsRef = (0, import_react5.useRef)([]);
|
|
545
485
|
const runChatCompletion = useAsyncCallback(
|
|
546
486
|
(previousMessages) => __async(this, null, function* () {
|
|
547
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o
|
|
487
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
548
488
|
setIsLoading(true);
|
|
549
489
|
const interruptEvent = langGraphInterruptAction == null ? void 0 : langGraphInterruptAction.event;
|
|
550
490
|
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) {
|
|
@@ -676,53 +616,20 @@ function useChat(options) {
|
|
|
676
616
|
messages2 = (0, import_runtime_client_gql3.convertGqlOutputToMessages)(
|
|
677
617
|
(0, import_runtime_client_gql3.filterAdjacentAgentStateMessages)(rawMessagesResponse)
|
|
678
618
|
);
|
|
619
|
+
if (messages2.length === 0) {
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
679
622
|
newMessages = [];
|
|
680
623
|
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) || "";
|
|
682
624
|
newMessages = [
|
|
683
625
|
new import_runtime_client_gql3.TextMessage({
|
|
684
626
|
role: import_runtime_client_gql3.MessageRole.Assistant,
|
|
685
|
-
content: guardrailsReason
|
|
627
|
+
content: ((_l = value.generateCopilotResponse.status.details) == null ? void 0 : _l.guardrailsReason) || ""
|
|
686
628
|
})
|
|
687
629
|
];
|
|
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
|
-
});
|
|
696
630
|
setMessages([...previousMessages, ...newMessages]);
|
|
697
631
|
break;
|
|
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) {
|
|
632
|
+
} else {
|
|
726
633
|
newMessages = [...messages2];
|
|
727
634
|
for (const message of messages2) {
|
|
728
635
|
if (message.isAgentStateMessage() && !message.active && !executedCoAgentStateRenders.includes(message.id) && onCoAgentStateRender) {
|
|
@@ -853,11 +760,11 @@ function useChat(options) {
|
|
|
853
760
|
followUp !== false && // and we executed an action
|
|
854
761
|
(didExecuteAction || // the last message is a server side result
|
|
855
762
|
!isAgentRun && finalMessages.length && finalMessages[finalMessages.length - 1].isResultMessage()) && // the user did not stop generation
|
|
856
|
-
!((
|
|
763
|
+
!((_m = chatAbortControllerRef.current) == null ? void 0 : _m.signal.aborted)
|
|
857
764
|
) {
|
|
858
765
|
yield new Promise((resolve) => setTimeout(resolve, 10));
|
|
859
766
|
return yield runChatCompletionRef.current(finalMessages);
|
|
860
|
-
} else if ((
|
|
767
|
+
} else if ((_n = chatAbortControllerRef.current) == null ? void 0 : _n.signal.aborted) {
|
|
861
768
|
const repairedMessages = finalMessages.filter((message, actionExecutionIndex) => {
|
|
862
769
|
if (message.isActionExecutionMessage()) {
|
|
863
770
|
return finalMessages.find(
|
|
@@ -868,7 +775,7 @@ function useChat(options) {
|
|
|
868
775
|
});
|
|
869
776
|
const repairedMessageIds = repairedMessages.map((message) => message.id);
|
|
870
777
|
setMessages(repairedMessages);
|
|
871
|
-
if ((
|
|
778
|
+
if ((_o = agentSessionRef.current) == null ? void 0 : _o.nodeName) {
|
|
872
779
|
setAgentSession({
|
|
873
780
|
threadId: agentSessionRef.current.threadId,
|
|
874
781
|
agentName: agentSessionRef.current.agentName,
|