@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
|
@@ -79,9 +79,6 @@ var __async = (__this, __arguments, generator) => {
|
|
|
79
79
|
// src/hooks/use-coagent.ts
|
|
80
80
|
var use_coagent_exports = {};
|
|
81
81
|
__export(use_coagent_exports, {
|
|
82
|
-
runAgent: () => runAgent,
|
|
83
|
-
startAgent: () => startAgent,
|
|
84
|
-
stopAgent: () => stopAgent,
|
|
85
82
|
useCoAgent: () => useCoAgent
|
|
86
83
|
});
|
|
87
84
|
module.exports = __toCommonJS(use_coagent_exports);
|
|
@@ -136,17 +133,12 @@ var emptyCopilotContext = {
|
|
|
136
133
|
coagentStates: {},
|
|
137
134
|
setCoagentStates: () => {
|
|
138
135
|
},
|
|
136
|
+
coagentStatesRef: { current: {} },
|
|
137
|
+
setCoagentStatesWithRef: () => {
|
|
138
|
+
},
|
|
139
139
|
agentSession: null,
|
|
140
140
|
setAgentSession: () => {
|
|
141
|
-
}
|
|
142
|
-
agentLock: null,
|
|
143
|
-
threadId: null,
|
|
144
|
-
setThreadId: () => {
|
|
145
|
-
},
|
|
146
|
-
runId: null,
|
|
147
|
-
setRunId: () => {
|
|
148
|
-
},
|
|
149
|
-
chatAbortControllerRef: { current: null }
|
|
141
|
+
}
|
|
150
142
|
};
|
|
151
143
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
152
144
|
function useCopilotContext() {
|
|
@@ -229,26 +221,18 @@ function useChat(options) {
|
|
|
229
221
|
actions,
|
|
230
222
|
onFunctionCall,
|
|
231
223
|
onCoAgentStateRender,
|
|
232
|
-
|
|
233
|
-
|
|
224
|
+
setCoagentStatesWithRef,
|
|
225
|
+
coagentStatesRef,
|
|
234
226
|
agentSession,
|
|
235
|
-
setAgentSession
|
|
236
|
-
threadId,
|
|
237
|
-
setThreadId,
|
|
238
|
-
runId,
|
|
239
|
-
setRunId,
|
|
240
|
-
chatAbortControllerRef
|
|
227
|
+
setAgentSession
|
|
241
228
|
} = options;
|
|
229
|
+
const abortControllerRef = (0, import_react5.useRef)();
|
|
230
|
+
const threadIdRef = (0, import_react5.useRef)(null);
|
|
231
|
+
const runIdRef = (0, import_react5.useRef)(null);
|
|
242
232
|
const { addGraphQLErrorsToast } = useToast();
|
|
243
233
|
const runChatCompletionRef = (0, import_react5.useRef)();
|
|
244
|
-
const coagentStatesRef = (0, import_react5.useRef)(coagentStates);
|
|
245
|
-
coagentStatesRef.current = coagentStates;
|
|
246
234
|
const agentSessionRef = (0, import_react5.useRef)(agentSession);
|
|
247
235
|
agentSessionRef.current = agentSession;
|
|
248
|
-
const threadIdRef = (0, import_react5.useRef)(threadId);
|
|
249
|
-
threadIdRef.current = threadId;
|
|
250
|
-
const runIdRef = (0, import_react5.useRef)(runId);
|
|
251
|
-
runIdRef.current = runId;
|
|
252
236
|
const publicApiKey = copilotConfig.publicApiKey;
|
|
253
237
|
const headers = __spreadValues(__spreadValues({}, copilotConfig.headers || {}), publicApiKey ? { [import_shared.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
254
238
|
const runtimeClient = useCopilotRuntimeClient({
|
|
@@ -266,7 +250,8 @@ function useChat(options) {
|
|
|
266
250
|
role: import_runtime_client_gql2.Role.Assistant
|
|
267
251
|
})
|
|
268
252
|
];
|
|
269
|
-
|
|
253
|
+
const abortController = new AbortController();
|
|
254
|
+
abortControllerRef.current = abortController;
|
|
270
255
|
setMessages([...previousMessages, ...newMessages]);
|
|
271
256
|
const systemMessage = makeSystemMessageCallback();
|
|
272
257
|
const messagesWithContext = [systemMessage, ...initialMessages || [], ...previousMessages];
|
|
@@ -319,7 +304,7 @@ function useChat(options) {
|
|
|
319
304
|
}))
|
|
320
305
|
}),
|
|
321
306
|
properties: copilotConfig.properties,
|
|
322
|
-
signal: (_d =
|
|
307
|
+
signal: (_d = abortControllerRef.current) == null ? void 0 : _d.signal
|
|
323
308
|
})
|
|
324
309
|
);
|
|
325
310
|
const guardrailsEnabled = ((_g = (_f = (_e = copilotConfig.cloud) == null ? void 0 : _e.guardrails) == null ? void 0 : _f.input) == null ? void 0 : _g.restrictToTopic.enabled) || false;
|
|
@@ -338,9 +323,6 @@ function useChat(options) {
|
|
|
338
323
|
break;
|
|
339
324
|
}
|
|
340
325
|
if (done) {
|
|
341
|
-
if (chatAbortControllerRef.current.signal.aborted) {
|
|
342
|
-
return [];
|
|
343
|
-
}
|
|
344
326
|
break;
|
|
345
327
|
}
|
|
346
328
|
if (!(value == null ? void 0 : value.generateCopilotResponse)) {
|
|
@@ -348,8 +330,6 @@ function useChat(options) {
|
|
|
348
330
|
}
|
|
349
331
|
threadIdRef.current = value.generateCopilotResponse.threadId || null;
|
|
350
332
|
runIdRef.current = value.generateCopilotResponse.runId || null;
|
|
351
|
-
setThreadId(threadIdRef.current);
|
|
352
|
-
setRunId(runIdRef.current);
|
|
353
333
|
const messages2 = (0, import_runtime_client_gql2.convertGqlOutputToMessages)(
|
|
354
334
|
(0, import_runtime_client_gql2.filterAdjacentAgentStateMessages)(value.generateCopilotResponse.messages)
|
|
355
335
|
);
|
|
@@ -378,22 +358,12 @@ function useChat(options) {
|
|
|
378
358
|
if (action) {
|
|
379
359
|
followUp = action.followUp;
|
|
380
360
|
}
|
|
381
|
-
const result = yield
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
new Promise((_, reject) => {
|
|
388
|
-
var _a2;
|
|
389
|
-
return (_a2 = chatAbortControllerRef.current) == null ? void 0 : _a2.signal.addEventListener("abort", () => reject(new Error("Operation was aborted")));
|
|
390
|
-
})
|
|
391
|
-
]);
|
|
392
|
-
if (chatAbortControllerRef.current.signal.aborted) {
|
|
393
|
-
actionResults[message.id] = "";
|
|
394
|
-
} else {
|
|
395
|
-
actionResults[message.id] = result;
|
|
396
|
-
}
|
|
361
|
+
const result = yield onFunctionCall({
|
|
362
|
+
messages: previousMessages,
|
|
363
|
+
name: message.name,
|
|
364
|
+
args: message.arguments
|
|
365
|
+
});
|
|
366
|
+
actionResults[message.id] = result;
|
|
397
367
|
} catch (e) {
|
|
398
368
|
actionResults[message.id] = `Failed to execute action ${message.name}`;
|
|
399
369
|
console.error(`Failed to execute action ${message.name}: ${e}`);
|
|
@@ -421,7 +391,7 @@ function useChat(options) {
|
|
|
421
391
|
}
|
|
422
392
|
const lastAgentStateMessage = [...messages2].reverse().find((message) => message.isAgentStateMessage());
|
|
423
393
|
if (lastAgentStateMessage) {
|
|
424
|
-
|
|
394
|
+
setCoagentStatesWithRef((prevAgentStates) => __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
425
395
|
[lastAgentStateMessage.agentName]: {
|
|
426
396
|
name: lastAgentStateMessage.agentName,
|
|
427
397
|
state: lastAgentStateMessage.state,
|
|
@@ -488,12 +458,13 @@ function useChat(options) {
|
|
|
488
458
|
});
|
|
489
459
|
const stop = () => {
|
|
490
460
|
var _a;
|
|
491
|
-
(_a =
|
|
461
|
+
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
492
462
|
};
|
|
493
463
|
return {
|
|
494
464
|
append,
|
|
495
465
|
reload,
|
|
496
|
-
stop
|
|
466
|
+
stop,
|
|
467
|
+
runChatCompletion: () => runChatCompletionRef.current(messages)
|
|
497
468
|
};
|
|
498
469
|
}
|
|
499
470
|
|
|
@@ -519,17 +490,11 @@ function useCopilotChat(_a = {}) {
|
|
|
519
490
|
setIsLoading,
|
|
520
491
|
chatInstructions,
|
|
521
492
|
actions,
|
|
522
|
-
|
|
523
|
-
|
|
493
|
+
coagentStatesRef,
|
|
494
|
+
setCoagentStatesWithRef,
|
|
524
495
|
coAgentStateRenders,
|
|
525
496
|
agentSession,
|
|
526
|
-
setAgentSession
|
|
527
|
-
agentLock,
|
|
528
|
-
threadId,
|
|
529
|
-
setThreadId,
|
|
530
|
-
runId,
|
|
531
|
-
setRunId,
|
|
532
|
-
chatAbortControllerRef
|
|
497
|
+
setAgentSession
|
|
533
498
|
} = useCopilotContext();
|
|
534
499
|
const { messages, setMessages } = useCopilotMessagesContext();
|
|
535
500
|
const latestGetContextString = useUpdatedRef(getContextString);
|
|
@@ -565,7 +530,7 @@ function useCopilotChat(_a = {}) {
|
|
|
565
530
|
}),
|
|
566
531
|
[coAgentStateRenders]
|
|
567
532
|
);
|
|
568
|
-
const { append, reload, stop } = useChat(__spreadProps(__spreadValues({}, options), {
|
|
533
|
+
const { append, reload, stop, runChatCompletion } = useChat(__spreadProps(__spreadValues({}, options), {
|
|
569
534
|
actions: Object.values(actions),
|
|
570
535
|
copilotConfig: copilotApiConfig,
|
|
571
536
|
initialMessages: options.initialMessages || [],
|
|
@@ -576,15 +541,10 @@ function useCopilotChat(_a = {}) {
|
|
|
576
541
|
makeSystemMessageCallback,
|
|
577
542
|
isLoading,
|
|
578
543
|
setIsLoading,
|
|
579
|
-
|
|
580
|
-
|
|
544
|
+
coagentStatesRef,
|
|
545
|
+
setCoagentStatesWithRef,
|
|
581
546
|
agentSession,
|
|
582
|
-
setAgentSession
|
|
583
|
-
threadId,
|
|
584
|
-
setThreadId,
|
|
585
|
-
runId,
|
|
586
|
-
setRunId,
|
|
587
|
-
chatAbortControllerRef
|
|
547
|
+
setAgentSession
|
|
588
548
|
}));
|
|
589
549
|
const latestAppend = useUpdatedRef(append);
|
|
590
550
|
const latestAppendFunc = (0, import_react7.useCallback)(
|
|
@@ -615,32 +575,18 @@ function useCopilotChat(_a = {}) {
|
|
|
615
575
|
},
|
|
616
576
|
[latestSetMessages]
|
|
617
577
|
);
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
setRunId(null);
|
|
623
|
-
setCoagentStates({});
|
|
624
|
-
let initialAgentSession = null;
|
|
625
|
-
if (agentLock) {
|
|
626
|
-
initialAgentSession = {
|
|
627
|
-
agentName: agentLock
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
setAgentSession(initialAgentSession);
|
|
631
|
-
}, [latestStopFunc, setMessages, setThreadId, setCoagentStates, setAgentSession, agentLock]);
|
|
632
|
-
const latestReset = useUpdatedRef(reset);
|
|
633
|
-
const latestResetFunc = (0, import_react7.useCallback)(() => {
|
|
634
|
-
return latestReset.current();
|
|
635
|
-
}, [latestReset]);
|
|
578
|
+
const latestRunChatCompletion = useUpdatedRef(runChatCompletion);
|
|
579
|
+
const latestRunChatCompletionFunc = (0, import_react7.useCallback)(() => {
|
|
580
|
+
return latestRunChatCompletion.current();
|
|
581
|
+
}, [latestRunChatCompletion]);
|
|
636
582
|
return {
|
|
637
583
|
visibleMessages: messages,
|
|
638
584
|
appendMessage: latestAppendFunc,
|
|
639
585
|
setMessages: latestSetMessagesFunc,
|
|
640
586
|
reloadMessages: latestReloadFunc,
|
|
641
587
|
stopGeneration: latestStopFunc,
|
|
642
|
-
reset: latestResetFunc,
|
|
643
588
|
deleteMessage: latestDeleteFunc,
|
|
589
|
+
runChatCompletion: latestRunChatCompletionFunc,
|
|
644
590
|
isLoading
|
|
645
591
|
};
|
|
646
592
|
}
|
|
@@ -687,8 +633,8 @@ function useCoAgent(options) {
|
|
|
687
633
|
const generalContext = useCopilotContext();
|
|
688
634
|
const messagesContext = useCopilotMessagesContext();
|
|
689
635
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
690
|
-
const { coagentStates,
|
|
691
|
-
const { appendMessage } = useCopilotChat();
|
|
636
|
+
const { coagentStates, coagentStatesRef, setCoagentStatesWithRef } = context;
|
|
637
|
+
const { appendMessage, runChatCompletion } = useCopilotChat();
|
|
692
638
|
const getCoagentState = (coagentStates2, name2) => {
|
|
693
639
|
if (coagentStates2[name2]) {
|
|
694
640
|
return coagentStates2[name2];
|
|
@@ -705,15 +651,13 @@ function useCoAgent(options) {
|
|
|
705
651
|
}
|
|
706
652
|
};
|
|
707
653
|
const setState = (newState) => {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
});
|
|
716
|
-
});
|
|
654
|
+
let coagentState2 = getCoagentState(coagentStatesRef.current || {}, name);
|
|
655
|
+
const updatedState = typeof newState === "function" ? newState(coagentState2.state) : newState;
|
|
656
|
+
setCoagentStatesWithRef(__spreadProps(__spreadValues({}, coagentStatesRef.current), {
|
|
657
|
+
[name]: __spreadProps(__spreadValues({}, coagentState2), {
|
|
658
|
+
state: updatedState
|
|
659
|
+
})
|
|
660
|
+
}));
|
|
717
661
|
};
|
|
718
662
|
const coagentState = getCoagentState(coagentStates, name);
|
|
719
663
|
const state = isExternalStateManagement(options) ? options.state : coagentState.state;
|
|
@@ -723,11 +667,7 @@ function useCoAgent(options) {
|
|
|
723
667
|
} else if (coagentStates[name] === void 0) {
|
|
724
668
|
setState(options.initialState === void 0 ? {} : options.initialState);
|
|
725
669
|
}
|
|
726
|
-
}, [
|
|
727
|
-
isExternalStateManagement(options) ? JSON.stringify(options.state) : void 0,
|
|
728
|
-
// reset initialstate on reset
|
|
729
|
-
coagentStates[name] === void 0
|
|
730
|
-
]);
|
|
670
|
+
}, [isExternalStateManagement(options) ? JSON.stringify(options.state) : void 0]);
|
|
731
671
|
return {
|
|
732
672
|
name,
|
|
733
673
|
nodeName: coagentState.nodeName,
|
|
@@ -741,7 +681,7 @@ function useCoAgent(options) {
|
|
|
741
681
|
stopAgent(name, context);
|
|
742
682
|
},
|
|
743
683
|
run: (hint) => {
|
|
744
|
-
return runAgent(name, context, appendMessage, hint);
|
|
684
|
+
return runAgent(name, context, appendMessage, runChatCompletion, hint);
|
|
745
685
|
}
|
|
746
686
|
};
|
|
747
687
|
}
|
|
@@ -755,22 +695,11 @@ function stopAgent(name, context) {
|
|
|
755
695
|
const { agentSession, setAgentSession } = context;
|
|
756
696
|
if (agentSession && agentSession.agentName === name) {
|
|
757
697
|
setAgentSession(null);
|
|
758
|
-
context.setCoagentStates((prevAgentStates) => {
|
|
759
|
-
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
760
|
-
[name]: __spreadProps(__spreadValues({}, prevAgentStates[name]), {
|
|
761
|
-
running: false,
|
|
762
|
-
active: false,
|
|
763
|
-
threadId: void 0,
|
|
764
|
-
nodeName: void 0,
|
|
765
|
-
runId: void 0
|
|
766
|
-
})
|
|
767
|
-
});
|
|
768
|
-
});
|
|
769
698
|
} else {
|
|
770
699
|
console.warn(`No agent session found for ${name}`);
|
|
771
700
|
}
|
|
772
701
|
}
|
|
773
|
-
function runAgent(name, context, appendMessage, hint) {
|
|
702
|
+
function runAgent(name, context, appendMessage, runChatCompletion, hint) {
|
|
774
703
|
return __async(this, null, function* () {
|
|
775
704
|
var _a, _b;
|
|
776
705
|
const { agentSession, setAgentSession } = context;
|
|
@@ -786,20 +715,21 @@ function runAgent(name, context, appendMessage, hint) {
|
|
|
786
715
|
previousState = message.state;
|
|
787
716
|
}
|
|
788
717
|
}
|
|
789
|
-
let state = ((_b = (_a = context.
|
|
718
|
+
let state = ((_b = (_a = context.coagentStatesRef.current) == null ? void 0 : _a[name]) == null ? void 0 : _b.state) || {};
|
|
790
719
|
if (hint) {
|
|
791
720
|
const hintMessage = hint({ previousState, currentState: state });
|
|
792
721
|
if (hintMessage) {
|
|
793
722
|
yield appendMessage(hintMessage);
|
|
723
|
+
} else {
|
|
724
|
+
yield runChatCompletion();
|
|
794
725
|
}
|
|
726
|
+
} else {
|
|
727
|
+
yield runChatCompletion();
|
|
795
728
|
}
|
|
796
729
|
});
|
|
797
730
|
}
|
|
798
731
|
// Annotate the CommonJS export names for ESM import in node:
|
|
799
732
|
0 && (module.exports = {
|
|
800
|
-
runAgent,
|
|
801
|
-
startAgent,
|
|
802
|
-
stopAgent,
|
|
803
733
|
useCoAgent
|
|
804
734
|
});
|
|
805
735
|
//# sourceMappingURL=use-coagent.js.map
|