@copilotkit/react-core 1.10.3 → 1.10.4-next.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 +8 -0
- package/dist/{chunk-ME7RQK67.mjs → chunk-2DXYQG42.mjs} +8 -8
- package/dist/{chunk-HD2TFFAT.mjs → chunk-B6ZYKFIA.mjs} +8 -8
- package/dist/{chunk-MUDXTKXE.mjs → chunk-BKODPOZI.mjs} +8 -8
- package/dist/{chunk-MUDXTKXE.mjs.map → chunk-BKODPOZI.mjs.map} +1 -1
- package/dist/{chunk-GEKWHETN.mjs → chunk-DLEXVOQE.mjs} +4 -4
- package/dist/{chunk-ACHZJNZF.mjs → chunk-FG3FWUVW.mjs} +2 -2
- package/dist/{chunk-K4HXT453.mjs → chunk-JJDXTTEN.mjs} +2 -2
- package/dist/{chunk-QE7Z6LQR.mjs → chunk-KOGKA4V5.mjs} +2 -2
- package/dist/{chunk-N4VN2B5S.mjs → chunk-L3I57GMV.mjs} +4 -4
- package/dist/{chunk-KDE2GWEU.mjs → chunk-PI7BDJ6G.mjs} +5 -5
- package/dist/{chunk-A2ORBLCP.mjs → chunk-QXSEHCPY.mjs} +4 -4
- package/dist/{chunk-WNMN2UNU.mjs → chunk-SAWWZBE3.mjs} +11 -11
- package/dist/{chunk-AEAS6ZRO.mjs → chunk-TQGWN4FE.mjs} +4 -4
- package/dist/{chunk-HD3F6XVZ.mjs → chunk-V5PU37CB.mjs} +6 -6
- package/dist/{chunk-ZJYEXP6T.mjs → chunk-W7W43PPC.mjs} +2 -2
- package/dist/{chunk-OPRDTF4S.mjs → chunk-X2DNXTME.mjs} +4 -4
- package/dist/components/copilot-provider/copilot-messages.js +2 -2
- 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.js +2 -2
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +10 -10
- package/dist/components/copilot-provider/index.js +2 -2
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +10 -10
- package/dist/components/dev-console/console-trigger.mjs +3 -3
- package/dist/components/dev-console/developer-console-modal.mjs +2 -2
- package/dist/components/error-boundary/error-boundary.mjs +2 -2
- package/dist/components/index.js +2 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -10
- package/dist/context/index.mjs +4 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +31 -31
- package/dist/hooks/use-chat.mjs +4 -4
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +15 -15
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-copilot-chat-headless_c.mjs +15 -15
- package/dist/hooks/use-copilot-chat.mjs +15 -15
- package/dist/hooks/use-copilot-chat_internal.mjs +14 -14
- package/dist/hooks/use-langgraph-interrupt-render.mjs +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +15 -15
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -35
- package/dist/lib/copilot-task.mjs +12 -12
- package/dist/lib/index.mjs +12 -12
- package/dist/utils/extract.mjs +10 -10
- package/dist/utils/index.mjs +10 -10
- package/dist/utils/suggestions.mjs +10 -10
- package/package.json +3 -3
- package/src/components/copilot-provider/copilot-messages.tsx +1 -1
- /package/dist/{chunk-ME7RQK67.mjs.map → chunk-2DXYQG42.mjs.map} +0 -0
- /package/dist/{chunk-HD2TFFAT.mjs.map → chunk-B6ZYKFIA.mjs.map} +0 -0
- /package/dist/{chunk-GEKWHETN.mjs.map → chunk-DLEXVOQE.mjs.map} +0 -0
- /package/dist/{chunk-ACHZJNZF.mjs.map → chunk-FG3FWUVW.mjs.map} +0 -0
- /package/dist/{chunk-K4HXT453.mjs.map → chunk-JJDXTTEN.mjs.map} +0 -0
- /package/dist/{chunk-QE7Z6LQR.mjs.map → chunk-KOGKA4V5.mjs.map} +0 -0
- /package/dist/{chunk-N4VN2B5S.mjs.map → chunk-L3I57GMV.mjs.map} +0 -0
- /package/dist/{chunk-KDE2GWEU.mjs.map → chunk-PI7BDJ6G.mjs.map} +0 -0
- /package/dist/{chunk-A2ORBLCP.mjs.map → chunk-QXSEHCPY.mjs.map} +0 -0
- /package/dist/{chunk-WNMN2UNU.mjs.map → chunk-SAWWZBE3.mjs.map} +0 -0
- /package/dist/{chunk-AEAS6ZRO.mjs.map → chunk-TQGWN4FE.mjs.map} +0 -0
- /package/dist/{chunk-HD3F6XVZ.mjs.map → chunk-V5PU37CB.mjs.map} +0 -0
- /package/dist/{chunk-ZJYEXP6T.mjs.map → chunk-W7W43PPC.mjs.map} +0 -0
- /package/dist/{chunk-OPRDTF4S.mjs.map → chunk-X2DNXTME.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B6ZYKFIA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useMessagesTap
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import {
|
|
8
|
-
useCopilotRuntimeClient
|
|
9
|
-
} from "./chunk-FAUNHSQU.mjs";
|
|
6
|
+
} from "./chunk-BKODPOZI.mjs";
|
|
10
7
|
import {
|
|
11
8
|
useAsyncCallback
|
|
12
9
|
} from "./chunk-N4WEHORG.mjs";
|
|
13
10
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
11
|
+
useCopilotRuntimeClient
|
|
12
|
+
} from "./chunk-FAUNHSQU.mjs";
|
|
16
13
|
import {
|
|
17
14
|
useCopilotContext
|
|
18
15
|
} from "./chunk-TEMLWRRT.mjs";
|
|
16
|
+
import {
|
|
17
|
+
useToast
|
|
18
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
19
19
|
import {
|
|
20
20
|
__async,
|
|
21
21
|
__spreadProps,
|
|
@@ -235,4 +235,4 @@ export {
|
|
|
235
235
|
stopAgent,
|
|
236
236
|
runAgent
|
|
237
237
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
238
|
+
//# sourceMappingURL=chunk-2DXYQG42.mjs.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useLangGraphInterruptRender
|
|
3
3
|
} from "./chunk-IN7GE4NO.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useChat
|
|
6
|
-
} from "./chunk-HD3F6XVZ.mjs";
|
|
7
4
|
import {
|
|
8
5
|
defaultCopilotContextCategories,
|
|
9
6
|
reloadSuggestions
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SAWWZBE3.mjs";
|
|
8
|
+
import {
|
|
9
|
+
useCopilotMessagesContext
|
|
10
|
+
} from "./chunk-ZLQVRPDS.mjs";
|
|
11
|
+
import {
|
|
12
|
+
useChat
|
|
13
|
+
} from "./chunk-V5PU37CB.mjs";
|
|
11
14
|
import {
|
|
12
15
|
useAsyncCallback
|
|
13
16
|
} from "./chunk-N4WEHORG.mjs";
|
|
14
17
|
import {
|
|
15
18
|
useCopilotContext
|
|
16
19
|
} from "./chunk-TEMLWRRT.mjs";
|
|
17
|
-
import {
|
|
18
|
-
useCopilotMessagesContext
|
|
19
|
-
} from "./chunk-ZLQVRPDS.mjs";
|
|
20
20
|
import {
|
|
21
21
|
__async,
|
|
22
22
|
__spreadProps,
|
|
@@ -329,4 +329,4 @@ export {
|
|
|
329
329
|
useCopilotChat,
|
|
330
330
|
defaultSystemMessage
|
|
331
331
|
};
|
|
332
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-B6ZYKFIA.mjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CopilotMessagesContext
|
|
3
|
+
} from "./chunk-ZLQVRPDS.mjs";
|
|
1
4
|
import {
|
|
2
5
|
shouldShowDevConsole
|
|
3
6
|
} from "./chunk-ICIK2BSB.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useToast
|
|
6
|
-
} from "./chunk-EFL5OBKN.mjs";
|
|
7
7
|
import {
|
|
8
8
|
useCopilotContext
|
|
9
9
|
} from "./chunk-TEMLWRRT.mjs";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
11
|
+
useToast
|
|
12
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
13
13
|
import {
|
|
14
14
|
__async
|
|
15
15
|
} from "./chunk-SKC7AJIV.mjs";
|
|
@@ -169,7 +169,7 @@ function CopilotMessages({ children }) {
|
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
const fetchMessages = () => __async(this, null, function* () {
|
|
172
|
-
var _a, _b, _c
|
|
172
|
+
var _a, _b, _c;
|
|
173
173
|
if (!(agentSession == null ? void 0 : agentSession.agentName))
|
|
174
174
|
return;
|
|
175
175
|
const result = yield runtimeClient.loadAgentState({
|
|
@@ -185,7 +185,7 @@ function CopilotMessages({ children }) {
|
|
|
185
185
|
const newMessages = (_b = (_a = result.data) == null ? void 0 : _a.loadAgentState) == null ? void 0 : _b.messages;
|
|
186
186
|
if (newMessages === lastLoadedMessages.current)
|
|
187
187
|
return;
|
|
188
|
-
if ((
|
|
188
|
+
if ((_c = result.data) == null ? void 0 : _c.loadAgentState) {
|
|
189
189
|
lastLoadedMessages.current = newMessages;
|
|
190
190
|
lastLoadedThreadId.current = threadId;
|
|
191
191
|
lastLoadedAgentName.current = agentSession == null ? void 0 : agentSession.agentName;
|
|
@@ -219,4 +219,4 @@ export {
|
|
|
219
219
|
MessagesTapProvider,
|
|
220
220
|
CopilotMessages
|
|
221
221
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-BKODPOZI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/copilot-provider/copilot-messages.tsx"],"sourcesContent":["/**\n * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context\n */\n\nimport {\n ReactNode,\n useEffect,\n useState,\n useRef,\n useCallback,\n useMemo,\n createContext,\n useContext,\n} from \"react\";\nimport { CopilotMessagesContext } from \"../../context/copilot-messages-context\";\nimport {\n loadMessagesFromJsonRepresentation,\n Message,\n GraphQLError,\n} from \"@copilotkit/runtime-client-gql\";\nimport { useCopilotContext } from \"../../context/copilot-context\";\nimport { useToast } from \"../toast/toast-provider\";\nimport { shouldShowDevConsole } from \"../../utils/dev-console\";\nimport {\n ErrorVisibility,\n CopilotKitApiDiscoveryError,\n CopilotKitRemoteEndpointDiscoveryError,\n CopilotKitAgentDiscoveryError,\n CopilotKitError,\n CopilotKitErrorCode,\n} from \"@copilotkit/shared\";\nimport { SuggestionItem } from \"../../utils/suggestions\";\n\n// Helper to determine if error should show as banner based on visibility and legacy patterns\nfunction shouldShowAsBanner(gqlError: GraphQLError): boolean {\n const extensions = gqlError.extensions;\n if (!extensions) return false;\n\n // Priority 1: Check error code for discovery errors (these should always be banners)\n const code = extensions.code as CopilotKitErrorCode;\n if (\n code === CopilotKitErrorCode.AGENT_NOT_FOUND ||\n code === CopilotKitErrorCode.API_NOT_FOUND ||\n code === CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND ||\n code === CopilotKitErrorCode.CONFIGURATION_ERROR ||\n code === CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR ||\n code === CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR\n ) {\n return true;\n }\n\n // Priority 2: Check banner visibility\n if (extensions.visibility === ErrorVisibility.BANNER) {\n return true;\n }\n\n // Priority 3: Check for critical errors that should be banners regardless of formal classification\n const errorMessage = gqlError.message.toLowerCase();\n if (\n errorMessage.includes(\"api key\") ||\n errorMessage.includes(\"401\") ||\n errorMessage.includes(\"unauthorized\") ||\n errorMessage.includes(\"authentication\") ||\n errorMessage.includes(\"incorrect api key\")\n ) {\n return true;\n }\n\n // Priority 4: Legacy stack trace detection for discovery errors\n const originalError = extensions.originalError as any;\n if (originalError?.stack) {\n return (\n originalError.stack.includes(\"CopilotApiDiscoveryError\") ||\n originalError.stack.includes(\"CopilotKitRemoteEndpointDiscoveryError\") ||\n originalError.stack.includes(\"CopilotKitAgentDiscoveryError\")\n );\n }\n\n return false;\n}\n\n/**\n * MessagesTap is used to mitigate performance issues when we only need\n * a snapshot of the messages, not a continuously updating stream of messages.\n */\n\nexport type MessagesTap = {\n getMessagesFromTap: () => Message[];\n updateTapMessages: (messages: Message[]) => void;\n};\n\nconst MessagesTapContext = createContext<MessagesTap | null>(null);\n\nexport function useMessagesTap() {\n const tap = useContext(MessagesTapContext);\n if (!tap) throw new Error(\"useMessagesTap must be used inside <MessagesTapProvider>\");\n return tap;\n}\n\nexport function MessagesTapProvider({ children }: { children: React.ReactNode }) {\n const messagesRef = useRef<Message[]>([]);\n\n const tapRef = useRef<MessagesTap>({\n getMessagesFromTap: () => messagesRef.current,\n updateTapMessages: (messages: Message[]) => {\n messagesRef.current = messages;\n },\n });\n\n return (\n <MessagesTapContext.Provider value={tapRef.current}>{children}</MessagesTapContext.Provider>\n );\n}\n\n/**\n * CopilotKit messages context.\n */\n\nexport function CopilotMessages({ children }: { children: ReactNode }) {\n const [messages, setMessages] = useState<Message[]>([]);\n const lastLoadedThreadId = useRef<string>();\n const lastLoadedAgentName = useRef<string>();\n const lastLoadedMessages = useRef<string>();\n\n const { updateTapMessages } = useMessagesTap();\n\n const { threadId, agentSession, runtimeClient, showDevConsole, onError, copilotApiConfig } =\n useCopilotContext();\n const { setBannerError } = useToast();\n\n // Helper function to trace UI errors (similar to useCopilotRuntimeClient)\n const traceUIError = useCallback(\n async (error: CopilotKitError, originalError?: any) => {\n // Just check if onError and publicApiKey are defined\n if (!onError || !copilotApiConfig.publicApiKey) return;\n\n try {\n const traceEvent = {\n type: \"error\" as const,\n timestamp: Date.now(),\n context: {\n source: \"ui\" as const,\n request: {\n operation: \"loadAgentState\",\n url: copilotApiConfig.chatApiEndpoint,\n startTime: Date.now(),\n },\n technical: {\n environment: \"browser\",\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : undefined,\n stackTrace: originalError instanceof Error ? originalError.stack : undefined,\n },\n },\n error,\n };\n await onError(traceEvent);\n } catch (traceError) {\n console.error(\"Error in CopilotMessages onError handler:\", traceError);\n }\n },\n [onError, copilotApiConfig.publicApiKey, copilotApiConfig.chatApiEndpoint],\n );\n\n const createStructuredError = (gqlError: GraphQLError): CopilotKitError | null => {\n const extensions = gqlError.extensions;\n const originalError = extensions?.originalError as any;\n\n // Priority: Check stack trace for discovery errors first\n if (originalError?.stack) {\n if (originalError.stack.includes(\"CopilotApiDiscoveryError\")) {\n return new CopilotKitApiDiscoveryError({ message: originalError.message });\n }\n if (originalError.stack.includes(\"CopilotKitRemoteEndpointDiscoveryError\")) {\n return new CopilotKitRemoteEndpointDiscoveryError({ message: originalError.message });\n }\n if (originalError.stack.includes(\"CopilotKitAgentDiscoveryError\")) {\n return new CopilotKitAgentDiscoveryError({\n agentName: \"\",\n availableAgents: [],\n });\n }\n }\n\n // Fallback: Use the formal error code if available\n const message = originalError?.message || gqlError.message;\n const code = extensions?.code as CopilotKitErrorCode;\n\n if (code) {\n return new CopilotKitError({ message, code });\n }\n\n return null;\n };\n\n const handleGraphQLErrors = useCallback(\n (error: any) => {\n if (error.graphQLErrors?.length) {\n const graphQLErrors = error.graphQLErrors as GraphQLError[];\n\n // Route all errors to banners for consistent UI\n const routeError = (gqlError: GraphQLError) => {\n const extensions = gqlError.extensions;\n const visibility = extensions?.visibility as ErrorVisibility;\n const isDev = shouldShowDevConsole(showDevConsole);\n\n if (!isDev) {\n console.error(\"CopilotKit Error (hidden in production):\", gqlError.message);\n return;\n }\n\n // Silent errors - just log\n if (visibility === ErrorVisibility.SILENT) {\n console.error(\"CopilotKit Silent Error:\", gqlError.message);\n return;\n }\n\n // All other errors (including DEV_ONLY) show as banners for consistency\n const ckError = createStructuredError(gqlError);\n if (ckError) {\n setBannerError(ckError);\n // Trace the structured error\n traceUIError(ckError, gqlError);\n } else {\n // Fallback: create a generic error for unstructured GraphQL errors\n const fallbackError = new CopilotKitError({\n message: gqlError.message,\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(fallbackError);\n // Trace the fallback error\n traceUIError(fallbackError, gqlError);\n }\n };\n\n // Process all errors as banners\n graphQLErrors.forEach(routeError);\n } else {\n const isDev = shouldShowDevConsole(showDevConsole);\n if (!isDev) {\n console.error(\"CopilotKit Error (hidden in production):\", error);\n } else {\n // Route non-GraphQL errors to banner as well\n const fallbackError = new CopilotKitError({\n message: error?.message || String(error),\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(fallbackError);\n // Trace the non-GraphQL error\n traceUIError(fallbackError, error);\n }\n }\n },\n [setBannerError, showDevConsole, traceUIError],\n );\n\n useEffect(() => {\n if (!threadId || threadId === lastLoadedThreadId.current) return;\n if (\n threadId === lastLoadedThreadId.current &&\n agentSession?.agentName === lastLoadedAgentName.current\n ) {\n return;\n }\n\n const fetchMessages = async () => {\n if (!agentSession?.agentName) return;\n\n const result = await runtimeClient.loadAgentState({\n threadId,\n agentName: agentSession?.agentName,\n });\n\n // Check for GraphQL errors and manually trigger error handling\n if (result.error) {\n // Update refs to prevent infinite retries of the same failed request\n lastLoadedThreadId.current = threadId;\n lastLoadedAgentName.current = agentSession?.agentName;\n handleGraphQLErrors(result.error);\n return; // Don't try to process the data if there's an error\n }\n\n const newMessages = result.data?.loadAgentState?.messages;\n if (newMessages === lastLoadedMessages.current) return;\n\n if (result.data?.loadAgentState?.threadExists) {\n lastLoadedMessages.current = newMessages;\n lastLoadedThreadId.current = threadId;\n lastLoadedAgentName.current = agentSession?.agentName;\n\n const messages = loadMessagesFromJsonRepresentation(JSON.parse(newMessages || \"[]\"));\n setMessages(messages);\n }\n };\n void fetchMessages();\n }, [threadId, agentSession?.agentName]);\n\n useEffect(() => {\n updateTapMessages(messages);\n }, [messages, updateTapMessages]);\n\n const memoizedChildren = useMemo(() => children, [children]);\n const [suggestions, setSuggestions] = useState<SuggestionItem[]>([]);\n\n return (\n <CopilotMessagesContext.Provider\n value={{\n messages,\n setMessages,\n suggestions,\n setSuggestions,\n }}\n >\n {memoizedChildren}\n </CopilotMessagesContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OAGK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgFH;AAnBJ,IAAM,qBAAqB,cAAkC,IAAI;AAE1D,SAAS,iBAAiB;AAC/B,QAAM,MAAM,WAAW,kBAAkB;AACzC,MAAI,CAAC;AAAK,UAAM,IAAI,MAAM,0DAA0D;AACpF,SAAO;AACT;AAEO,SAAS,oBAAoB,EAAE,SAAS,GAAkC;AAC/E,QAAM,cAAc,OAAkB,CAAC,CAAC;AAExC,QAAM,SAAS,OAAoB;AAAA,IACjC,oBAAoB,MAAM,YAAY;AAAA,IACtC,mBAAmB,CAAC,aAAwB;AAC1C,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,CAAC;AAED,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,OAAO,SAAU,UAAS;AAElE;AAMO,SAAS,gBAAgB,EAAE,SAAS,GAA4B;AACrE,QAAM,CAAC,UAAU,WAAW,IAAI,SAAoB,CAAC,CAAC;AACtD,QAAM,qBAAqB,OAAe;AAC1C,QAAM,sBAAsB,OAAe;AAC3C,QAAM,qBAAqB,OAAe;AAE1C,QAAM,EAAE,kBAAkB,IAAI,eAAe;AAE7C,QAAM,EAAE,U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ages"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/copilot-provider/copilot-messages.tsx"],"sourcesContent":["/**\n * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context\n */\n\nimport {\n ReactNode,\n useEffect,\n useState,\n useRef,\n useCallback,\n useMemo,\n createContext,\n useContext,\n} from \"react\";\nimport { CopilotMessagesContext } from \"../../context/copilot-messages-context\";\nimport {\n loadMessagesFromJsonRepresentation,\n Message,\n GraphQLError,\n} from \"@copilotkit/runtime-client-gql\";\nimport { useCopilotContext } from \"../../context/copilot-context\";\nimport { useToast } from \"../toast/toast-provider\";\nimport { shouldShowDevConsole } from \"../../utils/dev-console\";\nimport {\n ErrorVisibility,\n CopilotKitApiDiscoveryError,\n CopilotKitRemoteEndpointDiscoveryError,\n CopilotKitAgentDiscoveryError,\n CopilotKitError,\n CopilotKitErrorCode,\n} from \"@copilotkit/shared\";\nimport { SuggestionItem } from \"../../utils/suggestions\";\n\n// Helper to determine if error should show as banner based on visibility and legacy patterns\nfunction shouldShowAsBanner(gqlError: GraphQLError): boolean {\n const extensions = gqlError.extensions;\n if (!extensions) return false;\n\n // Priority 1: Check error code for discovery errors (these should always be banners)\n const code = extensions.code as CopilotKitErrorCode;\n if (\n code === CopilotKitErrorCode.AGENT_NOT_FOUND ||\n code === CopilotKitErrorCode.API_NOT_FOUND ||\n code === CopilotKitErrorCode.REMOTE_ENDPOINT_NOT_FOUND ||\n code === CopilotKitErrorCode.CONFIGURATION_ERROR ||\n code === CopilotKitErrorCode.MISSING_PUBLIC_API_KEY_ERROR ||\n code === CopilotKitErrorCode.UPGRADE_REQUIRED_ERROR\n ) {\n return true;\n }\n\n // Priority 2: Check banner visibility\n if (extensions.visibility === ErrorVisibility.BANNER) {\n return true;\n }\n\n // Priority 3: Check for critical errors that should be banners regardless of formal classification\n const errorMessage = gqlError.message.toLowerCase();\n if (\n errorMessage.includes(\"api key\") ||\n errorMessage.includes(\"401\") ||\n errorMessage.includes(\"unauthorized\") ||\n errorMessage.includes(\"authentication\") ||\n errorMessage.includes(\"incorrect api key\")\n ) {\n return true;\n }\n\n // Priority 4: Legacy stack trace detection for discovery errors\n const originalError = extensions.originalError as any;\n if (originalError?.stack) {\n return (\n originalError.stack.includes(\"CopilotApiDiscoveryError\") ||\n originalError.stack.includes(\"CopilotKitRemoteEndpointDiscoveryError\") ||\n originalError.stack.includes(\"CopilotKitAgentDiscoveryError\")\n );\n }\n\n return false;\n}\n\n/**\n * MessagesTap is used to mitigate performance issues when we only need\n * a snapshot of the messages, not a continuously updating stream of messages.\n */\n\nexport type MessagesTap = {\n getMessagesFromTap: () => Message[];\n updateTapMessages: (messages: Message[]) => void;\n};\n\nconst MessagesTapContext = createContext<MessagesTap | null>(null);\n\nexport function useMessagesTap() {\n const tap = useContext(MessagesTapContext);\n if (!tap) throw new Error(\"useMessagesTap must be used inside <MessagesTapProvider>\");\n return tap;\n}\n\nexport function MessagesTapProvider({ children }: { children: React.ReactNode }) {\n const messagesRef = useRef<Message[]>([]);\n\n const tapRef = useRef<MessagesTap>({\n getMessagesFromTap: () => messagesRef.current,\n updateTapMessages: (messages: Message[]) => {\n messagesRef.current = messages;\n },\n });\n\n return (\n <MessagesTapContext.Provider value={tapRef.current}>{children}</MessagesTapContext.Provider>\n );\n}\n\n/**\n * CopilotKit messages context.\n */\n\nexport function CopilotMessages({ children }: { children: ReactNode }) {\n const [messages, setMessages] = useState<Message[]>([]);\n const lastLoadedThreadId = useRef<string>();\n const lastLoadedAgentName = useRef<string>();\n const lastLoadedMessages = useRef<string>();\n\n const { updateTapMessages } = useMessagesTap();\n\n const { threadId, agentSession, runtimeClient, showDevConsole, onError, copilotApiConfig } =\n useCopilotContext();\n const { setBannerError } = useToast();\n\n // Helper function to trace UI errors (similar to useCopilotRuntimeClient)\n const traceUIError = useCallback(\n async (error: CopilotKitError, originalError?: any) => {\n // Just check if onError and publicApiKey are defined\n if (!onError || !copilotApiConfig.publicApiKey) return;\n\n try {\n const traceEvent = {\n type: \"error\" as const,\n timestamp: Date.now(),\n context: {\n source: \"ui\" as const,\n request: {\n operation: \"loadAgentState\",\n url: copilotApiConfig.chatApiEndpoint,\n startTime: Date.now(),\n },\n technical: {\n environment: \"browser\",\n userAgent: typeof navigator !== \"undefined\" ? navigator.userAgent : undefined,\n stackTrace: originalError instanceof Error ? originalError.stack : undefined,\n },\n },\n error,\n };\n await onError(traceEvent);\n } catch (traceError) {\n console.error(\"Error in CopilotMessages onError handler:\", traceError);\n }\n },\n [onError, copilotApiConfig.publicApiKey, copilotApiConfig.chatApiEndpoint],\n );\n\n const createStructuredError = (gqlError: GraphQLError): CopilotKitError | null => {\n const extensions = gqlError.extensions;\n const originalError = extensions?.originalError as any;\n\n // Priority: Check stack trace for discovery errors first\n if (originalError?.stack) {\n if (originalError.stack.includes(\"CopilotApiDiscoveryError\")) {\n return new CopilotKitApiDiscoveryError({ message: originalError.message });\n }\n if (originalError.stack.includes(\"CopilotKitRemoteEndpointDiscoveryError\")) {\n return new CopilotKitRemoteEndpointDiscoveryError({ message: originalError.message });\n }\n if (originalError.stack.includes(\"CopilotKitAgentDiscoveryError\")) {\n return new CopilotKitAgentDiscoveryError({\n agentName: \"\",\n availableAgents: [],\n });\n }\n }\n\n // Fallback: Use the formal error code if available\n const message = originalError?.message || gqlError.message;\n const code = extensions?.code as CopilotKitErrorCode;\n\n if (code) {\n return new CopilotKitError({ message, code });\n }\n\n return null;\n };\n\n const handleGraphQLErrors = useCallback(\n (error: any) => {\n if (error.graphQLErrors?.length) {\n const graphQLErrors = error.graphQLErrors as GraphQLError[];\n\n // Route all errors to banners for consistent UI\n const routeError = (gqlError: GraphQLError) => {\n const extensions = gqlError.extensions;\n const visibility = extensions?.visibility as ErrorVisibility;\n const isDev = shouldShowDevConsole(showDevConsole);\n\n if (!isDev) {\n console.error(\"CopilotKit Error (hidden in production):\", gqlError.message);\n return;\n }\n\n // Silent errors - just log\n if (visibility === ErrorVisibility.SILENT) {\n console.error(\"CopilotKit Silent Error:\", gqlError.message);\n return;\n }\n\n // All other errors (including DEV_ONLY) show as banners for consistency\n const ckError = createStructuredError(gqlError);\n if (ckError) {\n setBannerError(ckError);\n // Trace the structured error\n traceUIError(ckError, gqlError);\n } else {\n // Fallback: create a generic error for unstructured GraphQL errors\n const fallbackError = new CopilotKitError({\n message: gqlError.message,\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(fallbackError);\n // Trace the fallback error\n traceUIError(fallbackError, gqlError);\n }\n };\n\n // Process all errors as banners\n graphQLErrors.forEach(routeError);\n } else {\n const isDev = shouldShowDevConsole(showDevConsole);\n if (!isDev) {\n console.error(\"CopilotKit Error (hidden in production):\", error);\n } else {\n // Route non-GraphQL errors to banner as well\n const fallbackError = new CopilotKitError({\n message: error?.message || String(error),\n code: CopilotKitErrorCode.UNKNOWN,\n });\n setBannerError(fallbackError);\n // Trace the non-GraphQL error\n traceUIError(fallbackError, error);\n }\n }\n },\n [setBannerError, showDevConsole, traceUIError],\n );\n\n useEffect(() => {\n if (!threadId || threadId === lastLoadedThreadId.current) return;\n if (\n threadId === lastLoadedThreadId.current &&\n agentSession?.agentName === lastLoadedAgentName.current\n ) {\n return;\n }\n\n const fetchMessages = async () => {\n if (!agentSession?.agentName) return;\n\n const result = await runtimeClient.loadAgentState({\n threadId,\n agentName: agentSession?.agentName,\n });\n\n // Check for GraphQL errors and manually trigger error handling\n if (result.error) {\n // Update refs to prevent infinite retries of the same failed request\n lastLoadedThreadId.current = threadId;\n lastLoadedAgentName.current = agentSession?.agentName;\n handleGraphQLErrors(result.error);\n return; // Don't try to process the data if there's an error\n }\n\n const newMessages = result.data?.loadAgentState?.messages;\n if (newMessages === lastLoadedMessages.current) return;\n\n if (result.data?.loadAgentState) {\n lastLoadedMessages.current = newMessages;\n lastLoadedThreadId.current = threadId;\n lastLoadedAgentName.current = agentSession?.agentName;\n\n const messages = loadMessagesFromJsonRepresentation(JSON.parse(newMessages || \"[]\"));\n setMessages(messages);\n }\n };\n void fetchMessages();\n }, [threadId, agentSession?.agentName]);\n\n useEffect(() => {\n updateTapMessages(messages);\n }, [messages, updateTapMessages]);\n\n const memoizedChildren = useMemo(() => children, [children]);\n const [suggestions, setSuggestions] = useState<SuggestionItem[]>([]);\n\n return (\n <CopilotMessagesContext.Provider\n value={{\n messages,\n setMessages,\n suggestions,\n setSuggestions,\n }}\n >\n {memoizedChildren}\n </CopilotMessagesContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OAGK;AAIP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAgFH;AAnBJ,IAAM,qBAAqB,cAAkC,IAAI;AAE1D,SAAS,iBAAiB;AAC/B,QAAM,MAAM,WAAW,kBAAkB;AACzC,MAAI,CAAC;AAAK,UAAM,IAAI,MAAM,0DAA0D;AACpF,SAAO;AACT;AAEO,SAAS,oBAAoB,EAAE,SAAS,GAAkC;AAC/E,QAAM,cAAc,OAAkB,CAAC,CAAC;AAExC,QAAM,SAAS,OAAoB;AAAA,IACjC,oBAAoB,MAAM,YAAY;AAAA,IACtC,mBAAmB,CAAC,aAAwB;AAC1C,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,CAAC;AAED,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,OAAO,SAAU,UAAS;AAElE;AAMO,SAAS,gBAAgB,EAAE,SAAS,GAA4B;AACrE,QAAM,CAAC,UAAU,WAAW,IAAI,SAAoB,CAAC,CAAC;AACtD,QAAM,qBAAqB,OAAe;AAC1C,QAAM,sBAAsB,OAAe;AAC3C,QAAM,qBAAqB,OAAe;AAE1C,QAAM,EAAE,kBAAkB,IAAI,eAAe;AAE7C,QAAM,EAAE,UAAU,cAAc,eAAe,gBAAgB,SAAS,iBAAiB,IACvF,kBA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
|
|
3
|
-
} from "./chunk-EFL5OBKN.mjs";
|
|
4
1
|
import {
|
|
5
2
|
CopilotContext
|
|
6
3
|
} from "./chunk-TEMLWRRT.mjs";
|
|
4
|
+
import {
|
|
5
|
+
useToast
|
|
6
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
7
7
|
|
|
8
8
|
// src/hooks/use-coagent-state-render.ts
|
|
9
9
|
import { useRef, useContext, useEffect } from "react";
|
|
@@ -85,4 +85,4 @@ function useCoAgentStateRender(action, dependencies) {
|
|
|
85
85
|
export {
|
|
86
86
|
useCoAgentStateRender
|
|
87
87
|
};
|
|
88
|
-
//# sourceMappingURL=chunk-
|
|
88
|
+
//# sourceMappingURL=chunk-DLEXVOQE.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B6ZYKFIA.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useCopilotContext
|
|
6
6
|
} from "./chunk-TEMLWRRT.mjs";
|
|
@@ -82,4 +82,4 @@ function useCopilotChatHeadless_c(options = {}) {
|
|
|
82
82
|
export {
|
|
83
83
|
useCopilotChatHeadless_c
|
|
84
84
|
};
|
|
85
|
-
//# sourceMappingURL=chunk-
|
|
85
|
+
//# sourceMappingURL=chunk-FG3FWUVW.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotAction
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X2DNXTME.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useCopilotContext
|
|
6
6
|
} from "./chunk-TEMLWRRT.mjs";
|
|
@@ -56,4 +56,4 @@ function useCopilotAuthenticatedAction_c(action, dependencies) {
|
|
|
56
56
|
export {
|
|
57
57
|
useCopilotAuthenticatedAction_c
|
|
58
58
|
};
|
|
59
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-JJDXTTEN.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeveloperConsoleModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QXSEHCPY.mjs";
|
|
4
4
|
import {
|
|
5
5
|
CopilotKitIcon
|
|
6
6
|
} from "./chunk-PIF5KJYI.mjs";
|
|
@@ -167,4 +167,4 @@ function ConsoleTrigger({ position = "bottom-right" }) {
|
|
|
167
167
|
export {
|
|
168
168
|
ConsoleTrigger
|
|
169
169
|
};
|
|
170
|
-
//# sourceMappingURL=chunk-
|
|
170
|
+
//# sourceMappingURL=chunk-KOGKA4V5.mjs.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StatusChecker
|
|
3
3
|
} from "./chunk-PMAFHQ7P.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useErrorToast
|
|
6
|
-
} from "./chunk-N4WEHORG.mjs";
|
|
7
4
|
import {
|
|
8
5
|
UsageBanner,
|
|
9
6
|
getErrorActions
|
|
10
7
|
} from "./chunk-6ZLPNY7X.mjs";
|
|
8
|
+
import {
|
|
9
|
+
useErrorToast
|
|
10
|
+
} from "./chunk-N4WEHORG.mjs";
|
|
11
11
|
|
|
12
12
|
// src/components/error-boundary/error-boundary.tsx
|
|
13
13
|
import React, { useEffect } from "react";
|
|
@@ -80,4 +80,4 @@ export {
|
|
|
80
80
|
CopilotErrorBoundary,
|
|
81
81
|
ErrorToast
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-L3I57GMV.mjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
useToast
|
|
6
|
-
} from "./chunk-EFL5OBKN.mjs";
|
|
3
|
+
} from "./chunk-B6ZYKFIA.mjs";
|
|
7
4
|
import {
|
|
8
5
|
CopilotContext
|
|
9
6
|
} from "./chunk-TEMLWRRT.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useToast
|
|
9
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__spreadProps,
|
|
12
12
|
__spreadValues
|
|
@@ -62,4 +62,4 @@ function useLangGraphInterrupt(action, dependencies) {
|
|
|
62
62
|
export {
|
|
63
63
|
useLangGraphInterrupt
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-PI7BDJ6G.mjs.map
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
CopilotKitIcon,
|
|
4
4
|
ExclamationMarkTriangleIcon
|
|
5
5
|
} from "./chunk-PIF5KJYI.mjs";
|
|
6
|
-
import {
|
|
7
|
-
useCopilotContext
|
|
8
|
-
} from "./chunk-TEMLWRRT.mjs";
|
|
9
6
|
import {
|
|
10
7
|
useCopilotMessagesContext
|
|
11
8
|
} from "./chunk-ZLQVRPDS.mjs";
|
|
9
|
+
import {
|
|
10
|
+
useCopilotContext
|
|
11
|
+
} from "./chunk-TEMLWRRT.mjs";
|
|
12
12
|
|
|
13
13
|
// src/components/dev-console/developer-console-modal.tsx
|
|
14
14
|
import { COPILOTKIT_VERSION } from "@copilotkit/shared";
|
|
@@ -756,4 +756,4 @@ function ContextTab({ context }) {
|
|
|
756
756
|
export {
|
|
757
757
|
DeveloperConsoleModal
|
|
758
758
|
};
|
|
759
|
-
//# sourceMappingURL=chunk-
|
|
759
|
+
//# sourceMappingURL=chunk-QXSEHCPY.mjs.map
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotErrorBoundary
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L3I57GMV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
CopilotMessages,
|
|
6
6
|
MessagesTapProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BKODPOZI.mjs";
|
|
8
8
|
import {
|
|
9
9
|
ConsoleTrigger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KOGKA4V5.mjs";
|
|
11
11
|
import {
|
|
12
12
|
use_flat_category_store_default
|
|
13
13
|
} from "./chunk-5FHSUKQL.mjs";
|
|
14
14
|
import {
|
|
15
15
|
use_tree_default
|
|
16
16
|
} from "./chunk-RKTVJRK7.mjs";
|
|
17
|
+
import {
|
|
18
|
+
UsageBanner,
|
|
19
|
+
getErrorActions
|
|
20
|
+
} from "./chunk-6ZLPNY7X.mjs";
|
|
17
21
|
import {
|
|
18
22
|
useCopilotRuntimeClient
|
|
19
23
|
} from "./chunk-FAUNHSQU.mjs";
|
|
20
24
|
import {
|
|
21
25
|
shouldShowDevConsole
|
|
22
26
|
} from "./chunk-ICIK2BSB.mjs";
|
|
23
|
-
import {
|
|
24
|
-
ToastProvider
|
|
25
|
-
} from "./chunk-EFL5OBKN.mjs";
|
|
26
|
-
import {
|
|
27
|
-
UsageBanner,
|
|
28
|
-
getErrorActions
|
|
29
|
-
} from "./chunk-6ZLPNY7X.mjs";
|
|
30
27
|
import {
|
|
31
28
|
CopilotContext
|
|
32
29
|
} from "./chunk-TEMLWRRT.mjs";
|
|
30
|
+
import {
|
|
31
|
+
ToastProvider
|
|
32
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
33
33
|
import {
|
|
34
34
|
__async,
|
|
35
35
|
__objRest,
|
|
@@ -753,4 +753,4 @@ export {
|
|
|
753
753
|
CopilotKitInternal,
|
|
754
754
|
defaultCopilotContextCategories
|
|
755
755
|
};
|
|
756
|
-
//# sourceMappingURL=chunk-
|
|
756
|
+
//# sourceMappingURL=chunk-SAWWZBE3.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultCopilotContextCategories
|
|
3
|
+
} from "./chunk-SAWWZBE3.mjs";
|
|
1
4
|
import {
|
|
2
5
|
processActionsForRuntimeRequest
|
|
3
6
|
} from "./chunk-4CEQJ2X6.mjs";
|
|
4
|
-
import {
|
|
5
|
-
defaultCopilotContextCategories
|
|
6
|
-
} from "./chunk-WNMN2UNU.mjs";
|
|
7
7
|
import {
|
|
8
8
|
__async,
|
|
9
9
|
__spreadValues
|
|
@@ -117,4 +117,4 @@ ${instructions}
|
|
|
117
117
|
export {
|
|
118
118
|
CopilotTask
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-TQGWN4FE.mjs.map
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
processActionsForRuntimeRequest
|
|
3
3
|
} from "./chunk-4CEQJ2X6.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useCopilotRuntimeClient
|
|
6
|
-
} from "./chunk-FAUNHSQU.mjs";
|
|
7
4
|
import {
|
|
8
5
|
useAsyncCallback,
|
|
9
6
|
useErrorToast
|
|
10
7
|
} from "./chunk-N4WEHORG.mjs";
|
|
11
8
|
import {
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
9
|
+
useCopilotRuntimeClient
|
|
10
|
+
} from "./chunk-FAUNHSQU.mjs";
|
|
14
11
|
import {
|
|
15
12
|
useCopilotContext
|
|
16
13
|
} from "./chunk-TEMLWRRT.mjs";
|
|
14
|
+
import {
|
|
15
|
+
useToast
|
|
16
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
17
17
|
import {
|
|
18
18
|
__async,
|
|
19
19
|
__spreadProps,
|
|
@@ -707,4 +707,4 @@ function getPairedFeAction(actions, message) {
|
|
|
707
707
|
export {
|
|
708
708
|
useChat
|
|
709
709
|
};
|
|
710
|
-
//# sourceMappingURL=chunk-
|
|
710
|
+
//# sourceMappingURL=chunk-V5PU37CB.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useCopilotChat
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B6ZYKFIA.mjs";
|
|
4
4
|
|
|
5
5
|
// src/hooks/use-copilot-chat.ts
|
|
6
6
|
function useCopilotChat2(options = {}) {
|
|
@@ -31,4 +31,4 @@ function useCopilotChat2(options = {}) {
|
|
|
31
31
|
export {
|
|
32
32
|
useCopilotChat2 as useCopilotChat
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-W7W43PPC.mjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useAsyncCallback
|
|
3
3
|
} from "./chunk-N4WEHORG.mjs";
|
|
4
|
-
import {
|
|
5
|
-
useToast
|
|
6
|
-
} from "./chunk-EFL5OBKN.mjs";
|
|
7
4
|
import {
|
|
8
5
|
useCopilotContext
|
|
9
6
|
} from "./chunk-TEMLWRRT.mjs";
|
|
7
|
+
import {
|
|
8
|
+
useToast
|
|
9
|
+
} from "./chunk-EFL5OBKN.mjs";
|
|
10
10
|
import {
|
|
11
11
|
__async,
|
|
12
12
|
__spreadValues
|
|
@@ -139,4 +139,4 @@ function isFrontendAction(action) {
|
|
|
139
139
|
export {
|
|
140
140
|
useCopilotAction
|
|
141
141
|
};
|
|
142
|
-
//# sourceMappingURL=chunk-
|
|
142
|
+
//# sourceMappingURL=chunk-X2DNXTME.mjs.map
|
|
@@ -324,7 +324,7 @@ function CopilotMessages({ children }) {
|
|
|
324
324
|
return;
|
|
325
325
|
}
|
|
326
326
|
const fetchMessages = () => __async(this, null, function* () {
|
|
327
|
-
var _a, _b, _c
|
|
327
|
+
var _a, _b, _c;
|
|
328
328
|
if (!(agentSession == null ? void 0 : agentSession.agentName))
|
|
329
329
|
return;
|
|
330
330
|
const result = yield runtimeClient.loadAgentState({
|
|
@@ -340,7 +340,7 @@ function CopilotMessages({ children }) {
|
|
|
340
340
|
const newMessages = (_b = (_a = result.data) == null ? void 0 : _a.loadAgentState) == null ? void 0 : _b.messages;
|
|
341
341
|
if (newMessages === lastLoadedMessages.current)
|
|
342
342
|
return;
|
|
343
|
-
if ((
|
|
343
|
+
if ((_c = result.data) == null ? void 0 : _c.loadAgentState) {
|
|
344
344
|
lastLoadedMessages.current = newMessages;
|
|
345
345
|
lastLoadedThreadId.current = threadId;
|
|
346
346
|
lastLoadedAgentName.current = agentSession == null ? void 0 : agentSession.agentName;
|