@copilotkit/react-core 1.10.0-next.7 → 1.10.0-next.9
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 +15 -0
- package/dist/{chunk-57MBVQPX.mjs → chunk-3RHHNUVV.mjs} +2 -2
- package/dist/{chunk-AC2GVFW6.mjs → chunk-6EKLRL7B.mjs} +2 -2
- package/dist/{chunk-EQQSE6KM.mjs → chunk-CLMDRYEN.mjs} +2 -2
- package/dist/{chunk-CZWJ4VJG.mjs → chunk-FTP6FDYS.mjs} +5 -5
- package/dist/{chunk-SMLWBM4N.mjs → chunk-GEKWHETN.mjs} +4 -4
- package/dist/{chunk-XGRBVNW2.mjs → chunk-GRCHDHC4.mjs} +11 -13
- package/dist/chunk-GRCHDHC4.mjs.map +1 -0
- package/dist/{chunk-OL3VRQKU.mjs → chunk-IN7GE4NO.mjs} +2 -2
- package/dist/{chunk-KTD5U4PK.mjs → chunk-K4HXT453.mjs} +3 -3
- package/dist/{chunk-X7ETNW3P.mjs → chunk-KH27ZS4Y.mjs} +7 -7
- package/dist/{chunk-4NR26FFD.mjs → chunk-MUDXTKXE.mjs} +43 -9
- package/dist/chunk-MUDXTKXE.mjs.map +1 -0
- package/dist/{chunk-5RPZ4T2V.mjs → chunk-MWHILKQH.mjs} +2 -2
- package/dist/{chunk-PH6RVMFU.mjs → chunk-OPRDTF4S.mjs} +4 -4
- package/dist/{chunk-TUPJR242.mjs → chunk-PHIMGB3K.mjs} +13 -15
- package/dist/chunk-PHIMGB3K.mjs.map +1 -0
- package/dist/{chunk-47GMU44Z.mjs → chunk-TEMLWRRT.mjs} +1 -4
- package/dist/{chunk-47GMU44Z.mjs.map → chunk-TEMLWRRT.mjs.map} +1 -1
- package/dist/{chunk-32JPCD6C.mjs → chunk-TTI4Z6GK.mjs} +16 -17
- package/dist/chunk-TTI4Z6GK.mjs.map +1 -0
- package/dist/{chunk-A3QJUCBZ.mjs → chunk-VH45SC6Z.mjs} +4 -4
- package/dist/{chunk-BJ7N5YF5.mjs → chunk-VSH4JSN3.mjs} +3 -3
- package/dist/{chunk-DCTJZ742.mjs → chunk-ZLQVRPDS.mjs} +5 -2
- package/dist/chunk-ZLQVRPDS.mjs.map +1 -0
- package/dist/{chunk-U6JSCZCE.mjs → chunk-ZTZJIDRJ.mjs} +4 -4
- package/dist/components/copilot-provider/copilot-messages.d.ts +17 -1
- package/dist/components/copilot-provider/copilot-messages.js +35 -7
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +9 -5
- package/dist/components/copilot-provider/copilotkit-props.d.ts +1 -2
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -2
- package/dist/components/copilot-provider/copilotkit.js +30 -9
- 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 -2
- package/dist/components/copilot-provider/index.js +30 -9
- 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.mjs +2 -2
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.js +30 -9
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +8 -8
- package/dist/context/copilot-context.d.ts +1 -2
- package/dist/context/copilot-context.js +0 -3
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/copilot-messages-context.d.ts +11 -15
- package/dist/context/copilot-messages-context.js +4 -1
- package/dist/context/copilot-messages-context.js.map +1 -1
- package/dist/context/copilot-messages-context.mjs +1 -1
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +4 -4
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +5 -5
- package/dist/{copilot-context-78fc727c.d.ts → copilot-context-256f9020.d.ts} +1 -21
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +133 -123
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +32 -32
- package/dist/hooks/use-chat.d.ts +1 -2
- package/dist/hooks/use-chat.js +0 -3
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +4 -4
- package/dist/hooks/use-coagent-state-render.js +0 -3
- 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 +3 -4
- package/dist/hooks/use-coagent.js +85 -75
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +14 -14
- package/dist/hooks/use-copilot-action.js +0 -3
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-additional-instructions.js +0 -3
- 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 +0 -3
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-copilot-chat-light.d.ts +3 -3
- package/dist/hooks/use-copilot-chat-light.js +5 -7
- package/dist/hooks/use-copilot-chat-light.js.map +1 -1
- package/dist/hooks/use-copilot-chat-light.mjs +14 -14
- package/dist/hooks/use-copilot-chat.d.ts +2 -2
- package/dist/hooks/use-copilot-chat.js +5 -7
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +14 -14
- package/dist/hooks/use-copilot-chat_internal.d.ts +3 -3
- package/dist/hooks/use-copilot-chat_internal.js +5 -7
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +13 -13
- package/dist/hooks/use-copilot-readable.js +0 -3
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt-render.js +0 -3
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +3 -3
- package/dist/hooks/use-langgraph-interrupt.d.ts +3 -4
- package/dist/hooks/use-langgraph-interrupt.js +5 -7
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +14 -14
- package/dist/hooks/use-make-copilot-document-readable.js +0 -3
- 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-08c43df1.d.ts +36 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +38 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -37
- package/dist/lib/copilot-task.d.ts +1 -2
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +10 -10
- package/dist/lib/index.d.ts +1 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +10 -10
- package/dist/types/interrupt-action.d.ts +2 -3
- package/dist/utils/extract.d.ts +2 -2
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +8 -8
- package/dist/utils/index.d.ts +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +8 -8
- package/dist/utils/suggestions.d.ts +2 -2
- package/dist/utils/suggestions.js.map +1 -1
- package/dist/utils/suggestions.mjs +8 -8
- package/package.json +3 -3
- package/src/components/copilot-provider/copilot-messages.tsx +57 -1
- package/src/components/copilot-provider/copilotkit.tsx +4 -5
- package/src/context/copilot-context.tsx +0 -5
- package/src/context/copilot-messages-context.tsx +7 -1
- package/src/hooks/__tests__/use-coagent-config.test.ts +7 -0
- package/src/hooks/use-coagent.ts +11 -8
- package/src/hooks/use-copilot-chat_internal.ts +2 -3
- package/dist/chunk-32JPCD6C.mjs.map +0 -1
- package/dist/chunk-4NR26FFD.mjs.map +0 -1
- package/dist/chunk-DCTJZ742.mjs.map +0 -1
- package/dist/chunk-TUPJR242.mjs.map +0 -1
- package/dist/chunk-XGRBVNW2.mjs.map +0 -1
- /package/dist/{chunk-57MBVQPX.mjs.map → chunk-3RHHNUVV.mjs.map} +0 -0
- /package/dist/{chunk-AC2GVFW6.mjs.map → chunk-6EKLRL7B.mjs.map} +0 -0
- /package/dist/{chunk-EQQSE6KM.mjs.map → chunk-CLMDRYEN.mjs.map} +0 -0
- /package/dist/{chunk-CZWJ4VJG.mjs.map → chunk-FTP6FDYS.mjs.map} +0 -0
- /package/dist/{chunk-SMLWBM4N.mjs.map → chunk-GEKWHETN.mjs.map} +0 -0
- /package/dist/{chunk-OL3VRQKU.mjs.map → chunk-IN7GE4NO.mjs.map} +0 -0
- /package/dist/{chunk-KTD5U4PK.mjs.map → chunk-K4HXT453.mjs.map} +0 -0
- /package/dist/{chunk-X7ETNW3P.mjs.map → chunk-KH27ZS4Y.mjs.map} +0 -0
- /package/dist/{chunk-5RPZ4T2V.mjs.map → chunk-MWHILKQH.mjs.map} +0 -0
- /package/dist/{chunk-PH6RVMFU.mjs.map → chunk-OPRDTF4S.mjs.map} +0 -0
- /package/dist/{chunk-A3QJUCBZ.mjs.map → chunk-VH45SC6Z.mjs.map} +0 -0
- /package/dist/{chunk-BJ7N5YF5.mjs.map → chunk-VSH4JSN3.mjs.map} +0 -0
- /package/dist/{chunk-U6JSCZCE.mjs.map → chunk-ZTZJIDRJ.mjs.map} +0 -0
|
@@ -163,11 +163,8 @@ var emptyCopilotContext = {
|
|
|
163
163
|
setLangGraphInterruptAction: () => null,
|
|
164
164
|
removeLangGraphInterruptAction: () => null,
|
|
165
165
|
onError: void 0,
|
|
166
|
-
suggestions: [],
|
|
167
166
|
bannerError: null,
|
|
168
167
|
setBannerError: () => {
|
|
169
|
-
},
|
|
170
|
-
setSuggestions: () => {
|
|
171
168
|
}
|
|
172
169
|
};
|
|
173
170
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
@@ -393,7 +390,10 @@ var import_react6 = require("react");
|
|
|
393
390
|
var import_react4 = __toESM(require("react"));
|
|
394
391
|
var emptyCopilotContext2 = {
|
|
395
392
|
messages: [],
|
|
396
|
-
setMessages: () => []
|
|
393
|
+
setMessages: () => [],
|
|
394
|
+
// suggestions state
|
|
395
|
+
suggestions: [],
|
|
396
|
+
setSuggestions: () => []
|
|
397
397
|
};
|
|
398
398
|
var CopilotMessagesContext = import_react4.default.createContext(emptyCopilotContext2);
|
|
399
399
|
|
|
@@ -716,11 +716,29 @@ function shouldShowDevConsole(showDevConsole) {
|
|
|
716
716
|
// src/components/copilot-provider/copilot-messages.tsx
|
|
717
717
|
var import_shared4 = require("@copilotkit/shared");
|
|
718
718
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
719
|
+
var MessagesTapContext = (0, import_react6.createContext)(null);
|
|
720
|
+
function useMessagesTap() {
|
|
721
|
+
const tap = (0, import_react6.useContext)(MessagesTapContext);
|
|
722
|
+
if (!tap)
|
|
723
|
+
throw new Error("useMessagesTap must be used inside <MessagesTapProvider>");
|
|
724
|
+
return tap;
|
|
725
|
+
}
|
|
726
|
+
function MessagesTapProvider({ children }) {
|
|
727
|
+
const messagesRef = (0, import_react6.useRef)([]);
|
|
728
|
+
const tapRef = (0, import_react6.useRef)({
|
|
729
|
+
getMessagesFromTap: () => messagesRef.current,
|
|
730
|
+
updateTapMessages: (messages) => {
|
|
731
|
+
messagesRef.current = messages;
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(MessagesTapContext.Provider, { value: tapRef.current, children });
|
|
735
|
+
}
|
|
719
736
|
function CopilotMessages({ children }) {
|
|
720
737
|
const [messages, setMessages] = (0, import_react6.useState)([]);
|
|
721
738
|
const lastLoadedThreadId = (0, import_react6.useRef)();
|
|
722
739
|
const lastLoadedAgentName = (0, import_react6.useRef)();
|
|
723
740
|
const lastLoadedMessages = (0, import_react6.useRef)();
|
|
741
|
+
const { updateTapMessages } = useMessagesTap();
|
|
724
742
|
const { threadId, agentSession, runtimeClient, showDevConsole, onError, copilotApiConfig } = useCopilotContext();
|
|
725
743
|
const { setBannerError } = useToast();
|
|
726
744
|
const traceUIError = (0, import_react6.useCallback)(
|
|
@@ -857,13 +875,19 @@ function CopilotMessages({ children }) {
|
|
|
857
875
|
});
|
|
858
876
|
void fetchMessages();
|
|
859
877
|
}, [threadId, agentSession == null ? void 0 : agentSession.agentName]);
|
|
878
|
+
(0, import_react6.useEffect)(() => {
|
|
879
|
+
updateTapMessages(messages);
|
|
880
|
+
}, [messages, updateTapMessages]);
|
|
860
881
|
const memoizedChildren = (0, import_react6.useMemo)(() => children, [children]);
|
|
882
|
+
const [suggestions, setSuggestions] = (0, import_react6.useState)([]);
|
|
861
883
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
862
884
|
CopilotMessagesContext.Provider,
|
|
863
885
|
{
|
|
864
886
|
value: {
|
|
865
887
|
messages,
|
|
866
|
-
setMessages
|
|
888
|
+
setMessages,
|
|
889
|
+
suggestions,
|
|
890
|
+
setSuggestions
|
|
867
891
|
},
|
|
868
892
|
children: memoizedChildren
|
|
869
893
|
}
|
|
@@ -1566,7 +1590,6 @@ ${nonDocumentStrings}`;
|
|
|
1566
1590
|
}, []);
|
|
1567
1591
|
const memoizedChildren = (0, import_react9.useMemo)(() => children, [children]);
|
|
1568
1592
|
const [bannerError, setBannerError] = (0, import_react9.useState)(null);
|
|
1569
|
-
const [suggestions, setSuggestions] = (0, import_react9.useState)([]);
|
|
1570
1593
|
const agentLock = (0, import_react9.useMemo)(() => {
|
|
1571
1594
|
var _a2;
|
|
1572
1595
|
return (_a2 = props.agent) != null ? _a2 : null;
|
|
@@ -1656,13 +1679,11 @@ ${nonDocumentStrings}`;
|
|
|
1656
1679
|
setLangGraphInterruptAction,
|
|
1657
1680
|
removeLangGraphInterruptAction,
|
|
1658
1681
|
onError: props.onError,
|
|
1659
|
-
suggestions,
|
|
1660
|
-
setSuggestions,
|
|
1661
1682
|
bannerError,
|
|
1662
1683
|
setBannerError
|
|
1663
1684
|
},
|
|
1664
1685
|
children: [
|
|
1665
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CopilotMessages, { children: memoizedChildren }),
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MessagesTapProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CopilotMessages, { children: memoizedChildren }) }),
|
|
1666
1687
|
bannerError && showDevConsole && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1667
1688
|
UsageBanner,
|
|
1668
1689
|
{
|