@copilotkit/react-core 1.4.2-tyler-reset-chat.2 → 1.4.3-pre.0
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 +10 -17
- package/dist/{chunk-USL3EHJB.mjs → chunk-AG7FH7OD.mjs} +2 -2
- package/dist/{chunk-6QKA3SNN.mjs → chunk-DHGXL5PC.mjs} +16 -12
- package/dist/{chunk-6QKA3SNN.mjs.map → chunk-DHGXL5PC.mjs.map} +1 -1
- package/dist/{chunk-24AHWFXB.mjs → chunk-EUIBVFV6.mjs} +20 -41
- package/dist/chunk-EUIBVFV6.mjs.map +1 -0
- package/dist/{chunk-3AYELZJS.mjs → chunk-JHEAUB3Z.mjs} +2 -2
- package/dist/{chunk-YTYNTCQL.mjs → chunk-O22KGHOQ.mjs} +21 -37
- package/dist/chunk-O22KGHOQ.mjs.map +1 -0
- package/dist/{chunk-JR55I3FL.mjs → chunk-OT67R4NB.mjs} +2 -2
- package/dist/{chunk-XUPO37VH.mjs → chunk-UOVONDR6.mjs} +2 -2
- package/dist/{chunk-UYKBEKKH.mjs → chunk-XBVKTDXP.mjs} +16 -41
- package/dist/chunk-XBVKTDXP.mjs.map +1 -0
- package/dist/{chunk-2JP64U3A.mjs → chunk-XQFVXX6R.mjs} +5 -10
- package/dist/{chunk-2JP64U3A.mjs.map → chunk-XQFVXX6R.mjs.map} +1 -1
- package/dist/{chunk-3R4J2TPH.mjs → chunk-Y7MI4PBB.mjs} +2 -2
- package/dist/components/copilot-provider/copilotkit.js +18 -19
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +2 -2
- package/dist/components/copilot-provider/index.js +18 -19
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +2 -2
- package/dist/components/index.js +18 -19
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/context/copilot-context.d.ts +2 -6
- package/dist/context/copilot-context.js +4 -9
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.js +4 -9
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/hooks/index.d.ts +1 -2
- package/dist/hooks/index.js +52 -122
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +16 -22
- package/dist/hooks/use-chat.d.ts +6 -22
- package/dist/hooks/use-chat.js +19 -40
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +1 -1
- package/dist/hooks/use-coagent-state-render.js +4 -9
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.d.ts +1 -14
- package/dist/hooks/use-coagent.js +52 -122
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +6 -12
- package/dist/hooks/use-copilot-action.js +4 -9
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-chat.d.ts +1 -1
- package/dist/hooks/use-copilot-chat.js +35 -86
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +5 -5
- package/dist/hooks/use-copilot-readable.js +4 -9
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-make-copilot-document-readable.js +4 -9
- 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 +66 -132
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -23
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +3 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +3 -3
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +2 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +5 -5
- package/src/components/copilot-provider/copilotkit.tsx +18 -10
- package/src/context/copilot-context.tsx +9 -22
- package/src/hooks/index.ts +1 -1
- package/src/hooks/use-chat.ts +28 -62
- package/src/hooks/use-coagent.ts +24 -38
- package/src/hooks/use-copilot-chat.ts +14 -41
- package/dist/chunk-24AHWFXB.mjs.map +0 -1
- package/dist/chunk-UYKBEKKH.mjs.map +0 -1
- package/dist/chunk-YTYNTCQL.mjs.map +0 -1
- /package/dist/{chunk-USL3EHJB.mjs.map → chunk-AG7FH7OD.mjs.map} +0 -0
- /package/dist/{chunk-3AYELZJS.mjs.map → chunk-JHEAUB3Z.mjs.map} +0 -0
- /package/dist/{chunk-JR55I3FL.mjs.map → chunk-OT67R4NB.mjs.map} +0 -0
- /package/dist/{chunk-XUPO37VH.mjs.map → chunk-UOVONDR6.mjs.map} +0 -0
- /package/dist/{chunk-3R4J2TPH.mjs.map → chunk-Y7MI4PBB.mjs.map} +0 -0
package/dist/hooks/index.js
CHANGED
|
@@ -79,9 +79,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
79
79
|
// src/hooks/index.ts
|
|
80
80
|
var hooks_exports = {};
|
|
81
81
|
__export(hooks_exports, {
|
|
82
|
-
runAgent: () => runAgent,
|
|
83
|
-
startAgent: () => startAgent,
|
|
84
|
-
stopAgent: () => stopAgent,
|
|
85
82
|
useCoAgent: () => useCoAgent,
|
|
86
83
|
useCoAgentStateRender: () => useCoAgentStateRender,
|
|
87
84
|
useCopilotAction: () => useCopilotAction,
|
|
@@ -144,17 +141,12 @@ var emptyCopilotContext = {
|
|
|
144
141
|
coagentStates: {},
|
|
145
142
|
setCoagentStates: () => {
|
|
146
143
|
},
|
|
144
|
+
coagentStatesRef: { current: {} },
|
|
145
|
+
setCoagentStatesWithRef: () => {
|
|
146
|
+
},
|
|
147
147
|
agentSession: null,
|
|
148
148
|
setAgentSession: () => {
|
|
149
|
-
}
|
|
150
|
-
agentLock: null,
|
|
151
|
-
threadId: null,
|
|
152
|
-
setThreadId: () => {
|
|
153
|
-
},
|
|
154
|
-
runId: null,
|
|
155
|
-
setRunId: () => {
|
|
156
|
-
},
|
|
157
|
-
chatAbortControllerRef: { current: null }
|
|
149
|
+
}
|
|
158
150
|
};
|
|
159
151
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
160
152
|
function useCopilotContext() {
|
|
@@ -219,26 +211,18 @@ function useChat(options) {
|
|
|
219
211
|
actions,
|
|
220
212
|
onFunctionCall,
|
|
221
213
|
onCoAgentStateRender,
|
|
222
|
-
|
|
223
|
-
|
|
214
|
+
setCoagentStatesWithRef,
|
|
215
|
+
coagentStatesRef,
|
|
224
216
|
agentSession,
|
|
225
|
-
setAgentSession
|
|
226
|
-
threadId,
|
|
227
|
-
setThreadId,
|
|
228
|
-
runId,
|
|
229
|
-
setRunId,
|
|
230
|
-
chatAbortControllerRef
|
|
217
|
+
setAgentSession
|
|
231
218
|
} = options;
|
|
219
|
+
const abortControllerRef = (0, import_react4.useRef)();
|
|
220
|
+
const threadIdRef = (0, import_react4.useRef)(null);
|
|
221
|
+
const runIdRef = (0, import_react4.useRef)(null);
|
|
232
222
|
const { addGraphQLErrorsToast } = useToast();
|
|
233
223
|
const runChatCompletionRef = (0, import_react4.useRef)();
|
|
234
|
-
const coagentStatesRef = (0, import_react4.useRef)(coagentStates);
|
|
235
|
-
coagentStatesRef.current = coagentStates;
|
|
236
224
|
const agentSessionRef = (0, import_react4.useRef)(agentSession);
|
|
237
225
|
agentSessionRef.current = agentSession;
|
|
238
|
-
const threadIdRef = (0, import_react4.useRef)(threadId);
|
|
239
|
-
threadIdRef.current = threadId;
|
|
240
|
-
const runIdRef = (0, import_react4.useRef)(runId);
|
|
241
|
-
runIdRef.current = runId;
|
|
242
226
|
const publicApiKey = copilotConfig.publicApiKey;
|
|
243
227
|
const headers = __spreadValues(__spreadValues({}, copilotConfig.headers || {}), publicApiKey ? { [import_shared.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
244
228
|
const runtimeClient = useCopilotRuntimeClient({
|
|
@@ -256,7 +240,8 @@ function useChat(options) {
|
|
|
256
240
|
role: import_runtime_client_gql2.Role.Assistant
|
|
257
241
|
})
|
|
258
242
|
];
|
|
259
|
-
|
|
243
|
+
const abortController = new AbortController();
|
|
244
|
+
abortControllerRef.current = abortController;
|
|
260
245
|
setMessages([...previousMessages, ...newMessages]);
|
|
261
246
|
const systemMessage = makeSystemMessageCallback();
|
|
262
247
|
const messagesWithContext = [systemMessage, ...initialMessages || [], ...previousMessages];
|
|
@@ -309,7 +294,7 @@ function useChat(options) {
|
|
|
309
294
|
}))
|
|
310
295
|
}),
|
|
311
296
|
properties: copilotConfig.properties,
|
|
312
|
-
signal: (_d =
|
|
297
|
+
signal: (_d = abortControllerRef.current) == null ? void 0 : _d.signal
|
|
313
298
|
})
|
|
314
299
|
);
|
|
315
300
|
const guardrailsEnabled = ((_g = (_f = (_e = copilotConfig.cloud) == null ? void 0 : _e.guardrails) == null ? void 0 : _f.input) == null ? void 0 : _g.restrictToTopic.enabled) || false;
|
|
@@ -328,9 +313,6 @@ function useChat(options) {
|
|
|
328
313
|
break;
|
|
329
314
|
}
|
|
330
315
|
if (done) {
|
|
331
|
-
if (chatAbortControllerRef.current.signal.aborted) {
|
|
332
|
-
return [];
|
|
333
|
-
}
|
|
334
316
|
break;
|
|
335
317
|
}
|
|
336
318
|
if (!(value == null ? void 0 : value.generateCopilotResponse)) {
|
|
@@ -338,8 +320,6 @@ function useChat(options) {
|
|
|
338
320
|
}
|
|
339
321
|
threadIdRef.current = value.generateCopilotResponse.threadId || null;
|
|
340
322
|
runIdRef.current = value.generateCopilotResponse.runId || null;
|
|
341
|
-
setThreadId(threadIdRef.current);
|
|
342
|
-
setRunId(runIdRef.current);
|
|
343
323
|
const messages2 = (0, import_runtime_client_gql2.convertGqlOutputToMessages)(
|
|
344
324
|
(0, import_runtime_client_gql2.filterAdjacentAgentStateMessages)(value.generateCopilotResponse.messages)
|
|
345
325
|
);
|
|
@@ -368,22 +348,12 @@ function useChat(options) {
|
|
|
368
348
|
if (action) {
|
|
369
349
|
followUp = action.followUp;
|
|
370
350
|
}
|
|
371
|
-
const result = yield
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
new Promise((_, reject) => {
|
|
378
|
-
var _a2;
|
|
379
|
-
return (_a2 = chatAbortControllerRef.current) == null ? void 0 : _a2.signal.addEventListener("abort", () => reject(new Error("Operation was aborted")));
|
|
380
|
-
})
|
|
381
|
-
]);
|
|
382
|
-
if (chatAbortControllerRef.current.signal.aborted) {
|
|
383
|
-
actionResults[message.id] = "";
|
|
384
|
-
} else {
|
|
385
|
-
actionResults[message.id] = result;
|
|
386
|
-
}
|
|
351
|
+
const result = yield onFunctionCall({
|
|
352
|
+
messages: previousMessages,
|
|
353
|
+
name: message.name,
|
|
354
|
+
args: message.arguments
|
|
355
|
+
});
|
|
356
|
+
actionResults[message.id] = result;
|
|
387
357
|
} catch (e) {
|
|
388
358
|
actionResults[message.id] = `Failed to execute action ${message.name}`;
|
|
389
359
|
console.error(`Failed to execute action ${message.name}: ${e}`);
|
|
@@ -411,7 +381,7 @@ function useChat(options) {
|
|
|
411
381
|
}
|
|
412
382
|
const lastAgentStateMessage = [...messages2].reverse().find((message) => message.isAgentStateMessage());
|
|
413
383
|
if (lastAgentStateMessage) {
|
|
414
|
-
|
|
384
|
+
setCoagentStatesWithRef((prevAgentStates) => __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
415
385
|
[lastAgentStateMessage.agentName]: {
|
|
416
386
|
name: lastAgentStateMessage.agentName,
|
|
417
387
|
state: lastAgentStateMessage.state,
|
|
@@ -478,12 +448,13 @@ function useChat(options) {
|
|
|
478
448
|
});
|
|
479
449
|
const stop = () => {
|
|
480
450
|
var _a;
|
|
481
|
-
(_a =
|
|
451
|
+
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
482
452
|
};
|
|
483
453
|
return {
|
|
484
454
|
append,
|
|
485
455
|
reload,
|
|
486
|
-
stop
|
|
456
|
+
stop,
|
|
457
|
+
runChatCompletion: () => runChatCompletionRef.current(messages)
|
|
487
458
|
};
|
|
488
459
|
}
|
|
489
460
|
|
|
@@ -528,17 +499,11 @@ function useCopilotChat(_a = {}) {
|
|
|
528
499
|
setIsLoading,
|
|
529
500
|
chatInstructions,
|
|
530
501
|
actions,
|
|
531
|
-
|
|
532
|
-
|
|
502
|
+
coagentStatesRef,
|
|
503
|
+
setCoagentStatesWithRef,
|
|
533
504
|
coAgentStateRenders,
|
|
534
505
|
agentSession,
|
|
535
|
-
setAgentSession
|
|
536
|
-
agentLock,
|
|
537
|
-
threadId,
|
|
538
|
-
setThreadId,
|
|
539
|
-
runId,
|
|
540
|
-
setRunId,
|
|
541
|
-
chatAbortControllerRef
|
|
506
|
+
setAgentSession
|
|
542
507
|
} = useCopilotContext();
|
|
543
508
|
const { messages, setMessages } = useCopilotMessagesContext();
|
|
544
509
|
const latestGetContextString = useUpdatedRef(getContextString);
|
|
@@ -574,7 +539,7 @@ function useCopilotChat(_a = {}) {
|
|
|
574
539
|
}),
|
|
575
540
|
[coAgentStateRenders]
|
|
576
541
|
);
|
|
577
|
-
const { append, reload, stop } = useChat(__spreadProps(__spreadValues({}, options), {
|
|
542
|
+
const { append, reload, stop, runChatCompletion } = useChat(__spreadProps(__spreadValues({}, options), {
|
|
578
543
|
actions: Object.values(actions),
|
|
579
544
|
copilotConfig: copilotApiConfig,
|
|
580
545
|
initialMessages: options.initialMessages || [],
|
|
@@ -585,15 +550,10 @@ function useCopilotChat(_a = {}) {
|
|
|
585
550
|
makeSystemMessageCallback,
|
|
586
551
|
isLoading,
|
|
587
552
|
setIsLoading,
|
|
588
|
-
|
|
589
|
-
|
|
553
|
+
coagentStatesRef,
|
|
554
|
+
setCoagentStatesWithRef,
|
|
590
555
|
agentSession,
|
|
591
|
-
setAgentSession
|
|
592
|
-
threadId,
|
|
593
|
-
setThreadId,
|
|
594
|
-
runId,
|
|
595
|
-
setRunId,
|
|
596
|
-
chatAbortControllerRef
|
|
556
|
+
setAgentSession
|
|
597
557
|
}));
|
|
598
558
|
const latestAppend = useUpdatedRef(append);
|
|
599
559
|
const latestAppendFunc = (0, import_react7.useCallback)(
|
|
@@ -624,32 +584,18 @@ function useCopilotChat(_a = {}) {
|
|
|
624
584
|
},
|
|
625
585
|
[latestSetMessages]
|
|
626
586
|
);
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
setRunId(null);
|
|
632
|
-
setCoagentStates({});
|
|
633
|
-
let initialAgentSession = null;
|
|
634
|
-
if (agentLock) {
|
|
635
|
-
initialAgentSession = {
|
|
636
|
-
agentName: agentLock
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
setAgentSession(initialAgentSession);
|
|
640
|
-
}, [latestStopFunc, setMessages, setThreadId, setCoagentStates, setAgentSession, agentLock]);
|
|
641
|
-
const latestReset = useUpdatedRef(reset);
|
|
642
|
-
const latestResetFunc = (0, import_react7.useCallback)(() => {
|
|
643
|
-
return latestReset.current();
|
|
644
|
-
}, [latestReset]);
|
|
587
|
+
const latestRunChatCompletion = useUpdatedRef(runChatCompletion);
|
|
588
|
+
const latestRunChatCompletionFunc = (0, import_react7.useCallback)(() => {
|
|
589
|
+
return latestRunChatCompletion.current();
|
|
590
|
+
}, [latestRunChatCompletion]);
|
|
645
591
|
return {
|
|
646
592
|
visibleMessages: messages,
|
|
647
593
|
appendMessage: latestAppendFunc,
|
|
648
594
|
setMessages: latestSetMessagesFunc,
|
|
649
595
|
reloadMessages: latestReloadFunc,
|
|
650
596
|
stopGeneration: latestStopFunc,
|
|
651
|
-
reset: latestResetFunc,
|
|
652
597
|
deleteMessage: latestDeleteFunc,
|
|
598
|
+
runChatCompletion: latestRunChatCompletionFunc,
|
|
653
599
|
isLoading
|
|
654
600
|
};
|
|
655
601
|
}
|
|
@@ -852,8 +798,8 @@ function useCoAgent(options) {
|
|
|
852
798
|
const generalContext = useCopilotContext();
|
|
853
799
|
const messagesContext = useCopilotMessagesContext();
|
|
854
800
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
855
|
-
const { coagentStates,
|
|
856
|
-
const { appendMessage } = useCopilotChat();
|
|
801
|
+
const { coagentStates, coagentStatesRef, setCoagentStatesWithRef } = context;
|
|
802
|
+
const { appendMessage, runChatCompletion } = useCopilotChat();
|
|
857
803
|
const getCoagentState = (coagentStates2, name2) => {
|
|
858
804
|
if (coagentStates2[name2]) {
|
|
859
805
|
return coagentStates2[name2];
|
|
@@ -870,15 +816,13 @@ function useCoAgent(options) {
|
|
|
870
816
|
}
|
|
871
817
|
};
|
|
872
818
|
const setState = (newState) => {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
});
|
|
881
|
-
});
|
|
819
|
+
let coagentState2 = getCoagentState(coagentStatesRef.current || {}, name);
|
|
820
|
+
const updatedState = typeof newState === "function" ? newState(coagentState2.state) : newState;
|
|
821
|
+
setCoagentStatesWithRef(__spreadProps(__spreadValues({}, coagentStatesRef.current), {
|
|
822
|
+
[name]: __spreadProps(__spreadValues({}, coagentState2), {
|
|
823
|
+
state: updatedState
|
|
824
|
+
})
|
|
825
|
+
}));
|
|
882
826
|
};
|
|
883
827
|
const coagentState = getCoagentState(coagentStates, name);
|
|
884
828
|
const state = isExternalStateManagement(options) ? options.state : coagentState.state;
|
|
@@ -888,11 +832,7 @@ function useCoAgent(options) {
|
|
|
888
832
|
} else if (coagentStates[name] === void 0) {
|
|
889
833
|
setState(options.initialState === void 0 ? {} : options.initialState);
|
|
890
834
|
}
|
|
891
|
-
}, [
|
|
892
|
-
isExternalStateManagement(options) ? JSON.stringify(options.state) : void 0,
|
|
893
|
-
// reset initialstate on reset
|
|
894
|
-
coagentStates[name] === void 0
|
|
895
|
-
]);
|
|
835
|
+
}, [isExternalStateManagement(options) ? JSON.stringify(options.state) : void 0]);
|
|
896
836
|
return {
|
|
897
837
|
name,
|
|
898
838
|
nodeName: coagentState.nodeName,
|
|
@@ -906,7 +846,7 @@ function useCoAgent(options) {
|
|
|
906
846
|
stopAgent(name, context);
|
|
907
847
|
},
|
|
908
848
|
run: (hint) => {
|
|
909
|
-
return runAgent(name, context, appendMessage, hint);
|
|
849
|
+
return runAgent(name, context, appendMessage, runChatCompletion, hint);
|
|
910
850
|
}
|
|
911
851
|
};
|
|
912
852
|
}
|
|
@@ -920,22 +860,11 @@ function stopAgent(name, context) {
|
|
|
920
860
|
const { agentSession, setAgentSession } = context;
|
|
921
861
|
if (agentSession && agentSession.agentName === name) {
|
|
922
862
|
setAgentSession(null);
|
|
923
|
-
context.setCoagentStates((prevAgentStates) => {
|
|
924
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
925
|
-
[name]: __spreadProps(__spreadValues({}, prevAgentStates[name]), {
|
|
926
|
-
running: false,
|
|
927
|
-
active: false,
|
|
928
|
-
threadId: void 0,
|
|
929
|
-
nodeName: void 0,
|
|
930
|
-
runId: void 0
|
|
931
|
-
})
|
|
932
|
-
});
|
|
933
|
-
});
|
|
934
863
|
} else {
|
|
935
864
|
console.warn(`No agent session found for ${name}`);
|
|
936
865
|
}
|
|
937
866
|
}
|
|
938
|
-
function runAgent(name, context, appendMessage, hint) {
|
|
867
|
+
function runAgent(name, context, appendMessage, runChatCompletion, hint) {
|
|
939
868
|
return __async(this, null, function* () {
|
|
940
869
|
var _a, _b;
|
|
941
870
|
const { agentSession, setAgentSession } = context;
|
|
@@ -951,20 +880,21 @@ function runAgent(name, context, appendMessage, hint) {
|
|
|
951
880
|
previousState = message.state;
|
|
952
881
|
}
|
|
953
882
|
}
|
|
954
|
-
let state = ((_b = (_a = context.
|
|
883
|
+
let state = ((_b = (_a = context.coagentStatesRef.current) == null ? void 0 : _a[name]) == null ? void 0 : _b.state) || {};
|
|
955
884
|
if (hint) {
|
|
956
885
|
const hintMessage = hint({ previousState, currentState: state });
|
|
957
886
|
if (hintMessage) {
|
|
958
887
|
yield appendMessage(hintMessage);
|
|
888
|
+
} else {
|
|
889
|
+
yield runChatCompletion();
|
|
959
890
|
}
|
|
891
|
+
} else {
|
|
892
|
+
yield runChatCompletion();
|
|
960
893
|
}
|
|
961
894
|
});
|
|
962
895
|
}
|
|
963
896
|
// Annotate the CommonJS export names for ESM import in node:
|
|
964
897
|
0 && (module.exports = {
|
|
965
|
-
runAgent,
|
|
966
|
-
startAgent,
|
|
967
|
-
stopAgent,
|
|
968
898
|
useCoAgent,
|
|
969
899
|
useCoAgentStateRender,
|
|
970
900
|
useCopilotAction,
|