@copilotkit/react-core 1.6.0-next.10 → 1.6.0-next.11
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 +8 -0
- package/dist/{chunk-XERJQUHA.mjs → chunk-4CEQJ2X6.mjs} +2 -2
- package/dist/{chunk-XERJQUHA.mjs.map → chunk-4CEQJ2X6.mjs.map} +1 -1
- package/dist/{chunk-ADTDNMYG.mjs → chunk-4EC4JK7H.mjs} +2 -2
- package/dist/{chunk-ALW2T2LL.mjs → chunk-FUO5LKSJ.mjs} +114 -60
- package/dist/chunk-FUO5LKSJ.mjs.map +1 -0
- package/dist/{chunk-MPFP6ANM.mjs → chunk-HBCP2KNA.mjs} +2 -2
- package/dist/{chunk-QJPWWVJQ.mjs → chunk-T4CAQC6B.mjs} +2 -2
- package/dist/{chunk-JFCNSGNU.mjs → chunk-Y2T56VSE.mjs} +2 -2
- package/dist/hooks/index.js +128 -77
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -5
- package/dist/hooks/use-chat.js +113 -62
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +2 -2
- package/dist/hooks/use-coagent.js +119 -68
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +4 -4
- package/dist/hooks/use-copilot-chat.js +117 -66
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +3 -3
- package/dist/hooks/use-langgraph-interrupt.js +119 -68
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +4 -4
- package/dist/index.js +134 -83
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/lib/copilot-task.js +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +2 -2
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +2 -2
- package/dist/types/frontend-action.d.ts +2 -1
- package/dist/types/frontend-action.js +1 -1
- package/dist/types/frontend-action.js.map +1 -1
- package/dist/types/frontend-action.mjs +1 -1
- package/package.json +3 -3
- package/src/hooks/use-chat.ts +133 -58
- package/src/types/frontend-action.ts +5 -2
- package/dist/chunk-ALW2T2LL.mjs.map +0 -1
- /package/dist/{chunk-ADTDNMYG.mjs.map → chunk-4EC4JK7H.mjs.map} +0 -0
- /package/dist/{chunk-MPFP6ANM.mjs.map → chunk-HBCP2KNA.mjs.map} +0 -0
- /package/dist/{chunk-QJPWWVJQ.mjs.map → chunk-T4CAQC6B.mjs.map} +0 -0
- /package/dist/{chunk-JFCNSGNU.mjs.map → chunk-Y2T56VSE.mjs.map} +0 -0
package/dist/hooks/index.js
CHANGED
|
@@ -183,7 +183,7 @@ function returnAndThrowInDebug(_value) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
// src/hooks/use-copilot-chat.ts
|
|
186
|
-
var
|
|
186
|
+
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
187
187
|
|
|
188
188
|
// src/hooks/use-chat.ts
|
|
189
189
|
var import_react5 = require("react");
|
|
@@ -195,7 +195,7 @@ var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
|
195
195
|
var import_shared = require("@copilotkit/shared");
|
|
196
196
|
function processActionsForRuntimeRequest(actions) {
|
|
197
197
|
const filteredActions = actions.filter(
|
|
198
|
-
(action) => action.available !== import_runtime_client_gql.ActionInputAvailability.Disabled && action.disabled !== true && action.name !== "*"
|
|
198
|
+
(action) => action.available !== import_runtime_client_gql.ActionInputAvailability.Disabled && action.disabled !== true && action.name !== "*" && action.available != "frontend" && !action.pairedAction
|
|
199
199
|
).map((action) => {
|
|
200
200
|
let available = import_runtime_client_gql.ActionInputAvailability.Enabled;
|
|
201
201
|
if (action.disabled) {
|
|
@@ -372,8 +372,6 @@ var useCopilotRuntimeClient = (options) => {
|
|
|
372
372
|
};
|
|
373
373
|
|
|
374
374
|
// src/hooks/use-chat.ts
|
|
375
|
-
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
376
|
-
var import_shared3 = require("@copilotkit/shared");
|
|
377
375
|
function useChat(options) {
|
|
378
376
|
const {
|
|
379
377
|
messages,
|
|
@@ -422,7 +420,7 @@ function useChat(options) {
|
|
|
422
420
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
423
421
|
setIsLoading(true);
|
|
424
422
|
const interruptEvent = langGraphInterruptAction == null ? void 0 : langGraphInterruptAction.event;
|
|
425
|
-
if ((interruptEvent == null ? void 0 : interruptEvent.name) ===
|
|
423
|
+
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) {
|
|
426
424
|
addErrorToast([
|
|
427
425
|
new Error(
|
|
428
426
|
"A message was sent while interrupt is active. This will cause failure on the agent side"
|
|
@@ -516,16 +514,16 @@ function useChat(options) {
|
|
|
516
514
|
setExtensions(extensionsRef.current);
|
|
517
515
|
let rawMessagesResponse = value.generateCopilotResponse.messages;
|
|
518
516
|
((_i = (_h = value.generateCopilotResponse) == null ? void 0 : _h.metaEvents) != null ? _i : []).forEach((ev) => {
|
|
519
|
-
if (ev.name ===
|
|
517
|
+
if (ev.name === import_runtime_client_gql3.MetaEventName.LangGraphInterruptEvent) {
|
|
520
518
|
let eventValue = (0, import_runtime_client_gql3.langGraphInterruptEvent)(ev).value;
|
|
521
|
-
eventValue = (0,
|
|
519
|
+
eventValue = (0, import_shared2.parseJson)(eventValue, eventValue);
|
|
522
520
|
setLangGraphInterruptAction({
|
|
523
521
|
event: __spreadProps(__spreadValues({}, (0, import_runtime_client_gql3.langGraphInterruptEvent)(ev)), {
|
|
524
522
|
value: eventValue
|
|
525
523
|
})
|
|
526
524
|
});
|
|
527
525
|
}
|
|
528
|
-
if (ev.name ===
|
|
526
|
+
if (ev.name === import_runtime_client_gql3.MetaEventName.CopilotKitLangGraphInterruptEvent) {
|
|
529
527
|
const data = ev.data;
|
|
530
528
|
rawMessagesResponse = [...rawMessagesResponse, ...data.messages];
|
|
531
529
|
interruptMessages = (0, import_runtime_client_gql3.convertGqlOutputToMessages)(
|
|
@@ -606,7 +604,7 @@ function useChat(options) {
|
|
|
606
604
|
setMessages([...previousMessages, ...newMessages]);
|
|
607
605
|
}
|
|
608
606
|
}
|
|
609
|
-
|
|
607
|
+
let finalMessages = constructFinalMessages(
|
|
610
608
|
[...syncedMessages, ...interruptMessages],
|
|
611
609
|
previousMessages,
|
|
612
610
|
newMessages
|
|
@@ -616,7 +614,7 @@ function useChat(options) {
|
|
|
616
614
|
const lastMessages = [];
|
|
617
615
|
for (let i = finalMessages.length - 1; i >= 0; i--) {
|
|
618
616
|
const message = finalMessages[i];
|
|
619
|
-
if (message.isActionExecutionMessage() && message.status.code !== import_runtime_client_gql3.MessageStatusCode.Pending) {
|
|
617
|
+
if ((message.isActionExecutionMessage() || message.isResultMessage()) && message.status.code !== import_runtime_client_gql3.MessageStatusCode.Pending) {
|
|
620
618
|
lastMessages.unshift(message);
|
|
621
619
|
} else {
|
|
622
620
|
break;
|
|
@@ -624,59 +622,51 @@ function useChat(options) {
|
|
|
624
622
|
}
|
|
625
623
|
for (const message of lastMessages) {
|
|
626
624
|
setMessages(finalMessages);
|
|
627
|
-
const action = actions.find(
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
"abort",
|
|
644
|
-
() => resolve("Operation was aborted by the user")
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
),
|
|
648
|
-
// if the user stopped generation, we also abort consecutive actions
|
|
649
|
-
new Promise((resolve) => {
|
|
650
|
-
var _a2;
|
|
651
|
-
if ((_a2 = chatAbortControllerRef.current) == null ? void 0 : _a2.signal.aborted) {
|
|
652
|
-
resolve("Operation was aborted by the user");
|
|
653
|
-
}
|
|
654
|
-
})
|
|
655
|
-
]);
|
|
656
|
-
} catch (e) {
|
|
657
|
-
error = e;
|
|
658
|
-
addErrorToast([error]);
|
|
659
|
-
result = `Failed to execute action ${message.name}. ${error.message}`;
|
|
660
|
-
console.error(`Failed to execute action ${message.name}: ${error}`);
|
|
661
|
-
}
|
|
625
|
+
const action = actions.find(
|
|
626
|
+
(action2) => action2.name === message.name
|
|
627
|
+
);
|
|
628
|
+
const currentResultMessagePairedFeAction = message.isResultMessage() ? getPairedFeAction(actions, message) : null;
|
|
629
|
+
const executeActionFromMessage = (action2, message2) => __async(this, null, function* () {
|
|
630
|
+
followUp = action2 == null ? void 0 : action2.followUp;
|
|
631
|
+
const resultMessage = yield executeAction({
|
|
632
|
+
onFunctionCall,
|
|
633
|
+
previousMessages,
|
|
634
|
+
message: message2,
|
|
635
|
+
chatAbortControllerRef,
|
|
636
|
+
onError: (error) => {
|
|
637
|
+
addErrorToast([error]);
|
|
638
|
+
console.error(`Failed to execute action ${message2.name}: ${error}`);
|
|
639
|
+
}
|
|
640
|
+
});
|
|
662
641
|
didExecuteAction = true;
|
|
663
|
-
const messageIndex = finalMessages.findIndex((msg) => msg.id ===
|
|
664
|
-
finalMessages.splice(
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
642
|
+
const messageIndex = finalMessages.findIndex((msg) => msg.id === message2.id);
|
|
643
|
+
finalMessages.splice(messageIndex + 1, 0, resultMessage);
|
|
644
|
+
return resultMessage;
|
|
645
|
+
});
|
|
646
|
+
if (action && message.isActionExecutionMessage()) {
|
|
647
|
+
const resultMessage = yield executeActionFromMessage(action, message);
|
|
648
|
+
const pairedFeAction = getPairedFeAction(actions, resultMessage);
|
|
649
|
+
if (pairedFeAction) {
|
|
650
|
+
const newExecutionMessage = new import_runtime_client_gql3.ActionExecutionMessage({
|
|
651
|
+
name: pairedFeAction.name,
|
|
652
|
+
arguments: (0, import_shared2.parseJson)(resultMessage.result, resultMessage.result),
|
|
653
|
+
status: message.status,
|
|
654
|
+
createdAt: message.createdAt,
|
|
655
|
+
parentMessageId: message.parentMessageId
|
|
656
|
+
});
|
|
657
|
+
yield executeActionFromMessage(pairedFeAction, newExecutionMessage);
|
|
658
|
+
}
|
|
659
|
+
} else if (message.isResultMessage() && currentResultMessagePairedFeAction) {
|
|
660
|
+
const newExecutionMessage = new import_runtime_client_gql3.ActionExecutionMessage({
|
|
661
|
+
name: currentResultMessagePairedFeAction.name,
|
|
662
|
+
arguments: (0, import_shared2.parseJson)(message.result, message.result),
|
|
663
|
+
status: message.status,
|
|
664
|
+
createdAt: message.createdAt
|
|
665
|
+
});
|
|
666
|
+
finalMessages.push(newExecutionMessage);
|
|
667
|
+
yield executeActionFromMessage(
|
|
668
|
+
currentResultMessagePairedFeAction,
|
|
669
|
+
newExecutionMessage
|
|
680
670
|
);
|
|
681
671
|
}
|
|
682
672
|
}
|
|
@@ -747,7 +737,7 @@ function useChat(options) {
|
|
|
747
737
|
if (!event)
|
|
748
738
|
return acc;
|
|
749
739
|
switch (event.name) {
|
|
750
|
-
case
|
|
740
|
+
case import_runtime_client_gql3.MetaEventName.LangGraphInterruptEvent:
|
|
751
741
|
if (event.response) {
|
|
752
742
|
setLangGraphInterruptAction(null);
|
|
753
743
|
const value = event.value;
|
|
@@ -823,11 +813,72 @@ function constructFinalMessages(syncedMessages, previousMessages, newMessages) {
|
|
|
823
813
|
}
|
|
824
814
|
return finalMessages;
|
|
825
815
|
}
|
|
816
|
+
function executeAction(_0) {
|
|
817
|
+
return __async(this, arguments, function* ({
|
|
818
|
+
onFunctionCall,
|
|
819
|
+
previousMessages,
|
|
820
|
+
message,
|
|
821
|
+
chatAbortControllerRef,
|
|
822
|
+
onError
|
|
823
|
+
}) {
|
|
824
|
+
let result;
|
|
825
|
+
let error = null;
|
|
826
|
+
try {
|
|
827
|
+
result = yield Promise.race([
|
|
828
|
+
onFunctionCall({
|
|
829
|
+
messages: previousMessages,
|
|
830
|
+
name: message.name,
|
|
831
|
+
args: message.arguments
|
|
832
|
+
}),
|
|
833
|
+
new Promise(
|
|
834
|
+
(resolve) => {
|
|
835
|
+
var _a;
|
|
836
|
+
return (_a = chatAbortControllerRef.current) == null ? void 0 : _a.signal.addEventListener(
|
|
837
|
+
"abort",
|
|
838
|
+
() => resolve("Operation was aborted by the user")
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
),
|
|
842
|
+
// if the user stopped generation, we also abort consecutive actions
|
|
843
|
+
new Promise((resolve) => {
|
|
844
|
+
var _a;
|
|
845
|
+
if ((_a = chatAbortControllerRef.current) == null ? void 0 : _a.signal.aborted) {
|
|
846
|
+
resolve("Operation was aborted by the user");
|
|
847
|
+
}
|
|
848
|
+
})
|
|
849
|
+
]);
|
|
850
|
+
} catch (e) {
|
|
851
|
+
onError(e);
|
|
852
|
+
}
|
|
853
|
+
return new import_runtime_client_gql3.ResultMessage({
|
|
854
|
+
id: "result-" + message.id,
|
|
855
|
+
result: import_runtime_client_gql3.ResultMessage.encodeResult(
|
|
856
|
+
error ? {
|
|
857
|
+
content: result,
|
|
858
|
+
error: JSON.parse(JSON.stringify(error, Object.getOwnPropertyNames(error)))
|
|
859
|
+
} : result
|
|
860
|
+
),
|
|
861
|
+
actionExecutionId: message.id,
|
|
862
|
+
actionName: message.name
|
|
863
|
+
});
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
function getPairedFeAction(actions, message) {
|
|
867
|
+
let actionName = null;
|
|
868
|
+
if (message.isActionExecutionMessage()) {
|
|
869
|
+
actionName = message.name;
|
|
870
|
+
} else if (message.isResultMessage()) {
|
|
871
|
+
actionName = message.actionName;
|
|
872
|
+
}
|
|
873
|
+
return actions.find(
|
|
874
|
+
(action) => action.name === actionName && action.available === "frontend" || action.pairedAction === actionName
|
|
875
|
+
);
|
|
876
|
+
}
|
|
826
877
|
|
|
827
878
|
// src/components/copilot-provider/copilotkit.tsx
|
|
828
879
|
var import_react7 = require("react");
|
|
829
880
|
var import_react_dom = require("react-dom");
|
|
830
|
-
var
|
|
881
|
+
var import_shared3 = require("@copilotkit/shared");
|
|
831
882
|
|
|
832
883
|
// src/context/copilot-messages-context.tsx
|
|
833
884
|
var import_react6 = __toESM(require("react"));
|
|
@@ -893,9 +944,9 @@ function useCopilotChat(_a = {}) {
|
|
|
893
944
|
const makeSystemMessageCallback = (0, import_react8.useCallback)(() => {
|
|
894
945
|
const systemMessageMaker = makeSystemMessage || defaultSystemMessage;
|
|
895
946
|
const contextString = latestGetContextString.current([], defaultCopilotContextCategories);
|
|
896
|
-
return new
|
|
947
|
+
return new import_runtime_client_gql4.TextMessage({
|
|
897
948
|
content: systemMessageMaker(contextString, chatInstructions),
|
|
898
|
-
role:
|
|
949
|
+
role: import_runtime_client_gql4.Role.System
|
|
899
950
|
});
|
|
900
951
|
}, [getContextString, makeSystemMessage, chatInstructions]);
|
|
901
952
|
const onCoAgentStateRender = useAsyncCallback(
|
|
@@ -1047,11 +1098,11 @@ ${additionalInstructions}` : "");
|
|
|
1047
1098
|
}
|
|
1048
1099
|
|
|
1049
1100
|
// src/hooks/use-copilot-action.ts
|
|
1050
|
-
var
|
|
1101
|
+
var import_shared4 = require("@copilotkit/shared");
|
|
1051
1102
|
var import_react9 = require("react");
|
|
1052
1103
|
function useCopilotAction(action, dependencies) {
|
|
1053
1104
|
const { setAction, removeAction, actions, chatComponentsCache } = useCopilotContext();
|
|
1054
|
-
const idRef = (0, import_react9.useRef)((0,
|
|
1105
|
+
const idRef = (0, import_react9.useRef)((0, import_shared4.randomId)());
|
|
1055
1106
|
const renderAndWaitRef = (0, import_react9.useRef)(null);
|
|
1056
1107
|
const { addToast } = useToast();
|
|
1057
1108
|
action = __spreadValues({}, action);
|
|
@@ -1153,7 +1204,7 @@ function isFrontendAction(action) {
|
|
|
1153
1204
|
|
|
1154
1205
|
// src/hooks/use-coagent-state-render.ts
|
|
1155
1206
|
var import_react10 = require("react");
|
|
1156
|
-
var
|
|
1207
|
+
var import_shared5 = require("@copilotkit/shared");
|
|
1157
1208
|
function useCoAgentStateRender(action, dependencies) {
|
|
1158
1209
|
const {
|
|
1159
1210
|
setCoAgentStateRender,
|
|
@@ -1162,7 +1213,7 @@ function useCoAgentStateRender(action, dependencies) {
|
|
|
1162
1213
|
chatComponentsCache,
|
|
1163
1214
|
availableAgents
|
|
1164
1215
|
} = (0, import_react10.useContext)(CopilotContext);
|
|
1165
|
-
const idRef = (0, import_react10.useRef)((0,
|
|
1216
|
+
const idRef = (0, import_react10.useRef)((0, import_shared5.randomId)());
|
|
1166
1217
|
const { addToast } = useToast();
|
|
1167
1218
|
(0, import_react10.useEffect)(() => {
|
|
1168
1219
|
if ((availableAgents == null ? void 0 : availableAgents.length) && !availableAgents.some((a) => a.name === action.name)) {
|
|
@@ -1261,7 +1312,7 @@ function useCopilotReadable({ description, value, parentId, categories, convert
|
|
|
1261
1312
|
|
|
1262
1313
|
// src/hooks/use-coagent.ts
|
|
1263
1314
|
var import_react13 = require("react");
|
|
1264
|
-
var
|
|
1315
|
+
var import_shared6 = require("@copilotkit/shared");
|
|
1265
1316
|
function useCoAgent(options) {
|
|
1266
1317
|
const generalContext = useCopilotContext();
|
|
1267
1318
|
const { availableAgents } = generalContext;
|
|
@@ -1312,7 +1363,7 @@ function useCoAgent(options) {
|
|
|
1312
1363
|
if (((_d = (_c = result.data) == null ? void 0 : _c.loadAgentState) == null ? void 0 : _d.threadExists) && newState && newState != "{}") {
|
|
1313
1364
|
lastLoadedState.current = newState;
|
|
1314
1365
|
lastLoadedThreadId.current = threadId;
|
|
1315
|
-
const fetchedState = (0,
|
|
1366
|
+
const fetchedState = (0, import_shared6.parseJson)(newState, {});
|
|
1316
1367
|
isExternalStateManagement(options) ? options.setState(fetchedState) : setState(fetchedState);
|
|
1317
1368
|
}
|
|
1318
1369
|
});
|
|
@@ -1438,7 +1489,7 @@ var import_react15 = __toESM(require("react"));
|
|
|
1438
1489
|
function useCopilotAuthenticatedAction_c(action, dependencies) {
|
|
1439
1490
|
const { authConfig_c, authStates_c, setAuthStates_c } = useCopilotContext();
|
|
1440
1491
|
const pendingActionRef = (0, import_react14.useRef)(null);
|
|
1441
|
-
const
|
|
1492
|
+
const executeAction2 = (0, import_react14.useCallback)(
|
|
1442
1493
|
(props) => {
|
|
1443
1494
|
if (typeof action.render === "function") {
|
|
1444
1495
|
return action.render(props);
|
|
@@ -1458,13 +1509,13 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
|
|
|
1458
1509
|
onSignInComplete: (authState) => {
|
|
1459
1510
|
setAuthStates_c == null ? void 0 : setAuthStates_c((prev) => __spreadProps(__spreadValues({}, prev), { [action.name]: authState }));
|
|
1460
1511
|
if (pendingActionRef.current) {
|
|
1461
|
-
|
|
1512
|
+
executeAction2(pendingActionRef.current);
|
|
1462
1513
|
pendingActionRef.current = null;
|
|
1463
1514
|
}
|
|
1464
1515
|
}
|
|
1465
1516
|
}) : import_react15.default.createElement(import_react14.Fragment);
|
|
1466
1517
|
}
|
|
1467
|
-
return
|
|
1518
|
+
return executeAction2(props);
|
|
1468
1519
|
},
|
|
1469
1520
|
[action, authStates_c, setAuthStates_c]
|
|
1470
1521
|
);
|
|
@@ -1478,13 +1529,13 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
|
|
|
1478
1529
|
|
|
1479
1530
|
// src/hooks/use-langgraph-interrupt.ts
|
|
1480
1531
|
var import_react16 = require("react");
|
|
1481
|
-
var
|
|
1532
|
+
var import_shared7 = require("@copilotkit/shared");
|
|
1482
1533
|
function useLangGraphInterrupt(action, dependencies) {
|
|
1483
1534
|
var _a;
|
|
1484
1535
|
const { setLangGraphInterruptAction, removeLangGraphInterruptAction, langGraphInterruptAction } = (0, import_react16.useContext)(CopilotContext);
|
|
1485
1536
|
const { runChatCompletion } = useCopilotChat();
|
|
1486
1537
|
const { addToast } = useToast();
|
|
1487
|
-
const actionId = (0,
|
|
1538
|
+
const actionId = (0, import_shared7.dataToUUID)(JSON.stringify(action), "lgAction");
|
|
1488
1539
|
const hasAction = (0, import_react16.useMemo)(
|
|
1489
1540
|
() => Boolean(langGraphInterruptAction == null ? void 0 : langGraphInterruptAction.id),
|
|
1490
1541
|
[langGraphInterruptAction]
|