@copilotkit/react-core 1.68.3 → 1.69.1

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.
Files changed (41) hide show
  1. package/dist/{copilotkit-BUIK5yln.d.mts → copilotkit-DYKpg4pD.d.mts} +34 -25
  2. package/dist/copilotkit-DYKpg4pD.d.mts.map +1 -0
  3. package/dist/{copilotkit-Bocmlr37.cjs → copilotkit-Dr0speVK.cjs} +454 -48
  4. package/dist/copilotkit-Dr0speVK.cjs.map +1 -0
  5. package/dist/{copilotkit-C4RqjAba.mjs → copilotkit-Dr6g885f.mjs} +456 -50
  6. package/dist/copilotkit-Dr6g885f.mjs.map +1 -0
  7. package/dist/{copilotkit-DSvKW3SS.d.cts → copilotkit-Hl1t9Y1v.d.cts} +34 -25
  8. package/dist/copilotkit-Hl1t9Y1v.d.cts.map +1 -0
  9. package/dist/index.cjs +119 -75
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +904 -28
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +904 -28
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs +119 -75
  16. package/dist/index.mjs.map +1 -1
  17. package/dist/index.umd.js +185 -101
  18. package/dist/index.umd.js.map +1 -1
  19. package/dist/v2/headless.cjs +3 -2
  20. package/dist/v2/headless.cjs.map +1 -1
  21. package/dist/v2/headless.d.cts +5 -4
  22. package/dist/v2/headless.d.cts.map +1 -1
  23. package/dist/v2/headless.d.mts +5 -4
  24. package/dist/v2/headless.d.mts.map +1 -1
  25. package/dist/v2/headless.mjs +3 -2
  26. package/dist/v2/headless.mjs.map +1 -1
  27. package/dist/v2/index.cjs +1 -1
  28. package/dist/v2/index.css +1 -1
  29. package/dist/v2/index.d.cts +2 -2
  30. package/dist/v2/index.d.mts +2 -2
  31. package/dist/v2/index.mjs +1 -1
  32. package/dist/v2/index.umd.js +451 -45
  33. package/dist/v2/index.umd.js.map +1 -1
  34. package/package.json +8 -8
  35. package/skills/react-core/SKILL.md +1 -1
  36. package/skills/react-core/references/provider-setup.md +23 -2
  37. package/skills/react-core/references/threads.md +3 -4
  38. package/dist/copilotkit-BUIK5yln.d.mts.map +0 -1
  39. package/dist/copilotkit-Bocmlr37.cjs.map +0 -1
  40. package/dist/copilotkit-C4RqjAba.mjs.map +0 -1
  41. package/dist/copilotkit-DSvKW3SS.d.cts.map +0 -1
@@ -108,6 +108,7 @@ const CopilotChatDefaultLabels = {
108
108
  assistantMessageToolbarCopyMessageLabel: "Copy",
109
109
  assistantMessageToolbarInspectorLabel: "View in Inspector",
110
110
  assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
111
+ assistantMessageToolbarSaveSnippetLabel: "Save as snippet",
111
112
  assistantMessageToolbarThumbsUpLabel: "Good response",
112
113
  assistantMessageToolbarThumbsDownLabel: "Bad response",
113
114
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -1560,7 +1561,8 @@ CopilotKitInspector.displayName = "CopilotKitInspector";
1560
1561
  //#region src/v2/components/CopilotKitInspectorContext.tsx
1561
1562
  const CopilotKitInspectorContext = react.createContext({
1562
1563
  isLocalInspectorEnabled: false,
1563
- openInspector: () => void 0
1564
+ openInspector: () => void 0,
1565
+ saveEventSnippet: async () => void 0
1564
1566
  });
1565
1567
  const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
1566
1568
  function useCopilotKitInspector() {
@@ -2374,6 +2376,7 @@ function injectCssIntoHtml(html, css) {
2374
2376
  const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGenerativeUIActivityRendererInner({ content }) {
2375
2377
  const initialHeight = content.initialHeight ?? 200;
2376
2378
  const [autoHeight, setAutoHeight] = (0, react.useState)(null);
2379
+ const [sandboxReady, setSandboxReady] = (0, react.useState)(false);
2377
2380
  const sandboxFunctions = useSandboxFunctions();
2378
2381
  const localApi = (0, react.useMemo)(() => {
2379
2382
  const api = {};
@@ -2475,6 +2478,7 @@ const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGe
2475
2478
  sandbox.promise.then(() => {
2476
2479
  if (cancelled) return;
2477
2480
  sandboxReadyRef.current = true;
2481
+ setSandboxReady(true);
2478
2482
  sandbox.run(`
2479
2483
  var s = document.createElement('style');
2480
2484
  s.textContent = 'html, body { overflow: hidden !important; }';
@@ -2499,6 +2503,7 @@ const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGe
2499
2503
  sandboxRef.current = null;
2500
2504
  }
2501
2505
  sandboxReadyRef.current = false;
2506
+ setSandboxReady(false);
2502
2507
  setAutoHeight(null);
2503
2508
  };
2504
2509
  }, [
@@ -2529,7 +2534,7 @@ const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGe
2529
2534
  const generationDone = content.generating === false;
2530
2535
  (0, react.useEffect)(() => {
2531
2536
  const sandbox = sandboxRef.current;
2532
- if (!generationDone || !sandbox) return;
2537
+ if (!generationDone || !sandboxReady || !sandbox) return;
2533
2538
  let handled = false;
2534
2539
  const onMessage = (e) => {
2535
2540
  if (handled) return;
@@ -2558,7 +2563,7 @@ const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGe
2558
2563
  return () => {
2559
2564
  window.removeEventListener("message", onMessage);
2560
2565
  };
2561
- }, [generationDone]);
2566
+ }, [generationDone, sandboxReady]);
2562
2567
  const height = autoHeight ?? initialHeight;
2563
2568
  const isGenerating = content.generating !== false;
2564
2569
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3542,10 +3547,46 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3542
3547
  const requestInspectorOpen = (0, react.useCallback)((request) => {
3543
3548
  setInspectorOpenRequest({ ...request });
3544
3549
  }, []);
3550
+ const saveEventSnippet = (0, react.useCallback)(async (request) => {
3551
+ try {
3552
+ const mod = await import("@copilotkit/web-inspector");
3553
+ const threadId = request.threadId ?? "inspector-snippet";
3554
+ const runId = `inspector-snippet-${Date.now()}`;
3555
+ const compiled = mod.compileChatSnippet({
3556
+ ...request,
3557
+ threadId,
3558
+ runId
3559
+ });
3560
+ const now = (/* @__PURE__ */ new Date()).toISOString();
3561
+ const snippet = {
3562
+ id: crypto.randomUUID(),
3563
+ name: compiled.name,
3564
+ recipe: compiled.recipe,
3565
+ events: compiled.events,
3566
+ createdAt: now,
3567
+ updatedAt: now
3568
+ };
3569
+ mod.upsertEventSnippet(snippet);
3570
+ requestInspectorOpen({
3571
+ messageId: request.messageId,
3572
+ threadId: request.threadId,
3573
+ agentId: request.agentId,
3574
+ menu: "event-snippets",
3575
+ snippetId: snippet.id
3576
+ });
3577
+ } catch (error) {
3578
+ console.error("[CopilotKit] Could not save the event snippet.", error);
3579
+ }
3580
+ }, [requestInspectorOpen]);
3545
3581
  const inspectorContextValue = (0, react.useMemo)(() => ({
3546
3582
  isLocalInspectorEnabled,
3547
- openInspector: requestInspectorOpen
3548
- }), [isLocalInspectorEnabled, requestInspectorOpen]);
3583
+ openInspector: requestInspectorOpen,
3584
+ saveEventSnippet
3585
+ }), [
3586
+ isLocalInspectorEnabled,
3587
+ requestInspectorOpen,
3588
+ saveEventSnippet
3589
+ ]);
3549
3590
  const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
3550
3591
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3551
3592
  const setFrom = (arr) => new Set(arr.map(key));
@@ -3600,7 +3641,7 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3600
3641
  const hasLocalAgents = mergedAgents && Object.keys(mergedAgents).length > 0;
3601
3642
  const hasSelfManagedAgents = Object.keys(selfManagedAgents).length > 0;
3602
3643
  (0, react.useEffect)(() => {
3603
- if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence offering. Provide a `publicLicenseKey` for production use — contact the CopilotKit team about licensing.");
3644
+ if (hasSelfManagedAgents && !resolvedPublicKey) console.warn("[CopilotKit] `selfManagedAgents` is part of CopilotKit's Enterprise Intelligence tier. Provide a `publicLicenseKey` for production use — contact the CopilotKit team about licensing.");
3604
3645
  }, [hasSelfManagedAgents, resolvedPublicKey]);
3605
3646
  const headers = typeof headersProp === "function" ? headersProp() : headersProp;
3606
3647
  const mergedHeaders = (0, react.useMemo)(() => {
@@ -5197,10 +5238,10 @@ function useThreadStoreSelector(store, selector) {
5197
5238
  }, [store, selector]), () => selector(store.getState()), () => selector(store.getServerState()));
5198
5239
  }
5199
5240
  /**
5200
- * React hook for listing and managing Intelligence platform threads.
5241
+ * React hook for listing and managing CopilotKit Intelligence threads.
5201
5242
  *
5202
5243
  * On mount the hook fetches the thread list for the runtime-authenticated user
5203
- * and the given `agentId`. When the Intelligence platform exposes a WebSocket
5244
+ * and the given `agentId`. When CopilotKit Intelligence exposes a WebSocket
5204
5245
  * URL, it also opens a realtime subscription so the `threads` array stays
5205
5246
  * current without polling — thread creates, renames, archives, and deletes
5206
5247
  * from any client are reflected immediately.
@@ -5496,7 +5537,7 @@ async function recordAnnotation(args) {
5496
5537
  //#endregion
5497
5538
  //#region src/v2/hooks/use-learn-from-user-action.tsx
5498
5539
  /**
5499
- * Record a user UI interaction in the Intelligence platform's user-actions
5540
+ * Record a user UI interaction in CopilotKit Intelligence's user-actions
5500
5541
  * stream. The platform's auto-curated knowledge base agent reads these
5501
5542
  * (alongside finished agent runs) and writes free-form Obsidian-flavored
5502
5543
  * markdown to `/project`, where any agent in the same project can later
@@ -5922,25 +5963,191 @@ function useLearningContainersInCurrentThread({ learningContainers }) {
5922
5963
  });
5923
5964
  }
5924
5965
 
5966
+ //#endregion
5967
+ //#region src/v2/components/chat/save-snippet-beside.ts
5968
+ const SAVE_SNIPPET_ICON_SLOT_PX = 36;
5969
+ const SAVE_SNIPPET_BESIDE_WRAP_CLASS = "cpk:relative cpk:w-full cpk:overflow-visible";
5970
+ const SAVE_SNIPPET_BESIDE_BODY_CLASS = "cpk:w-full";
5971
+ const SAVE_SNIPPET_BESIDE_SAVE_CLASS = "cpk:absolute cpk:top-0 cpk:z-10";
5972
+ function saveSnippetBesideStyle(side) {
5973
+ if (side === "left") return {
5974
+ left: "auto",
5975
+ right: "100%",
5976
+ marginLeft: 0,
5977
+ marginRight: 4
5978
+ };
5979
+ return {
5980
+ left: "100%",
5981
+ right: "auto",
5982
+ marginLeft: 4,
5983
+ marginRight: 0
5984
+ };
5985
+ }
5986
+ function pickSaveSnippetSide(roomRight, roomLeft, slotPx = SAVE_SNIPPET_ICON_SLOT_PX) {
5987
+ if (roomRight >= slotPx) return "right";
5988
+ if (roomLeft >= slotPx) return "left";
5989
+ return "right";
5990
+ }
5991
+ function findOverflowAncestor(el) {
5992
+ let node = el.parentElement;
5993
+ while (node) {
5994
+ const style = getComputedStyle(node);
5995
+ const overflowX = style.overflowX;
5996
+ const overflow = style.overflow;
5997
+ if (overflowX === "hidden" || overflowX === "auto" || overflowX === "scroll" || overflow === "hidden" || overflow === "auto" || overflow === "scroll") return node;
5998
+ node = node.parentElement;
5999
+ }
6000
+ return document.documentElement;
6001
+ }
6002
+ function measurableBox(el) {
6003
+ let node = el;
6004
+ while (node && getComputedStyle(node).display === "contents") node = node.firstElementChild;
6005
+ return node ?? el;
6006
+ }
6007
+ function measureSaveSnippetSide(wrap, body) {
6008
+ const clipRect = findOverflowAncestor(wrap).getBoundingClientRect();
6009
+ const bodyRect = measurableBox(body.firstElementChild ?? body).getBoundingClientRect();
6010
+ return pickSaveSnippetSide(clipRect.right - bodyRect.right, bodyRect.left - clipRect.left);
6011
+ }
6012
+
6013
+ //#endregion
6014
+ //#region src/v2/components/chat/SaveSnippetIconButton.tsx
6015
+ function SaveSnippetIconButton({ title, className, ...props }) {
6016
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6017
+ const primaryLabel = title || labels.assistantMessageToolbarSaveSnippetLabel;
6018
+ const localOnlyLabel = labels.assistantMessageToolbarInspectorLocalOnlyLabel;
6019
+ const accessibleLabel = `${primaryLabel} (${localOnlyLabel})`;
6020
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
6021
+ asChild: true,
6022
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
6023
+ type: "button",
6024
+ variant: "assistantMessageToolbarButton",
6025
+ "aria-label": accessibleLabel,
6026
+ title: accessibleLabel,
6027
+ className,
6028
+ ...props,
6029
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Bookmark, { className: "cpk:size-[18px]" })
6030
+ })
6031
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
6032
+ side: "bottom",
6033
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6034
+ className: "cpk:flex cpk:flex-col cpk:gap-0.5",
6035
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: primaryLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6036
+ className: "cpk:text-[10px] cpk:opacity-65",
6037
+ children: localOnlyLabel
6038
+ })]
6039
+ })
6040
+ })] });
6041
+ }
6042
+ function SaveSnippetBesideChrome({ children, showSave, saveButton }) {
6043
+ const wrapRef = (0, react.useRef)(null);
6044
+ const bodyRef = (0, react.useRef)(null);
6045
+ const [side, setSide] = (0, react.useState)("right");
6046
+ (0, react.useLayoutEffect)(() => {
6047
+ if (!showSave) return;
6048
+ const wrap = wrapRef.current;
6049
+ const body = bodyRef.current;
6050
+ if (!wrap || !body) return;
6051
+ const measure = () => {
6052
+ setSide(measureSaveSnippetSide(wrap, body));
6053
+ };
6054
+ measure();
6055
+ if (typeof ResizeObserver === "undefined") return;
6056
+ const observer = new ResizeObserver(measure);
6057
+ observer.observe(wrap);
6058
+ observer.observe(body);
6059
+ const clip = findOverflowAncestor(wrap);
6060
+ if (clip !== wrap) observer.observe(clip);
6061
+ window.addEventListener("resize", measure);
6062
+ return () => {
6063
+ observer.disconnect();
6064
+ window.removeEventListener("resize", measure);
6065
+ };
6066
+ }, [showSave]);
6067
+ if (!showSave) return children;
6068
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6069
+ ref: wrapRef,
6070
+ className: SAVE_SNIPPET_BESIDE_WRAP_CLASS,
6071
+ "data-save-snippet-side": side,
6072
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6073
+ ref: bodyRef,
6074
+ className: SAVE_SNIPPET_BESIDE_BODY_CLASS,
6075
+ children
6076
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6077
+ className: SAVE_SNIPPET_BESIDE_SAVE_CLASS,
6078
+ style: saveSnippetBesideStyle(side),
6079
+ children: saveButton
6080
+ })]
6081
+ });
6082
+ }
6083
+
5925
6084
  //#endregion
5926
6085
  //#region src/v2/components/chat/CopilotChatToolCallsView.tsx
5927
6086
  function CopilotChatToolCallsView({ message, messages = [] }) {
5928
6087
  const renderToolCall = useRenderToolCall();
6088
+ const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
6089
+ const chatConfiguration = useCopilotChatConfiguration();
6090
+ const labels = chatConfiguration?.labels ?? CopilotChatDefaultLabels;
5929
6091
  if (!message.toolCalls || message.toolCalls.length === 0) return null;
5930
6092
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: message.toolCalls.map((toolCall) => {
5931
- const toolMessage = messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id);
5932
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: renderToolCall({
6093
+ const rendered = renderToolCall({
5933
6094
  toolCall,
5934
- toolMessage
5935
- }) }, toolCall.id);
6095
+ toolMessage: messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id)
6096
+ });
6097
+ if (!isLocalInspectorEnabled || !hasCompleteArgs(toolCall.function.arguments)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: rendered }, toolCall.id);
6098
+ const primaryLabel = labels.assistantMessageToolbarSaveSnippetLabel;
6099
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallSnippetChrome, {
6100
+ label: primaryLabel,
6101
+ onSave: () => void saveEventSnippet({
6102
+ kind: "tool-call",
6103
+ messageId: message.id,
6104
+ toolCallId: toolCall.id,
6105
+ toolName: toolCall.function.name,
6106
+ argsJson: toolCall.function.arguments || "{}",
6107
+ threadId: chatConfiguration?.threadId,
6108
+ agentId: chatConfiguration?.agentId
6109
+ }),
6110
+ children: rendered
6111
+ }, toolCall.id);
5936
6112
  }) });
5937
6113
  }
6114
+ function hasCompleteArgs(args) {
6115
+ const trimmed = (args ?? "").trim();
6116
+ if (!trimmed) return true;
6117
+ try {
6118
+ JSON.parse(trimmed);
6119
+ return true;
6120
+ } catch {
6121
+ return false;
6122
+ }
6123
+ }
6124
+ function ToolCallSnippetChrome({ children, label, onSave }) {
6125
+ const bodyRef = (0, react.useRef)(null);
6126
+ const [showSave, setShowSave] = (0, react.useState)(false);
6127
+ (0, react.useLayoutEffect)(() => {
6128
+ const el = bodyRef.current;
6129
+ setShowSave(!!el && el.childElementCount > 0);
6130
+ });
6131
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetBesideChrome, {
6132
+ showSave,
6133
+ saveButton: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
6134
+ "data-testid": "copilot-tool-save-snippet-button",
6135
+ title: label,
6136
+ onClick: onSave
6137
+ }),
6138
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6139
+ ref: bodyRef,
6140
+ className: "cpk:contents",
6141
+ children
6142
+ })
6143
+ });
6144
+ }
5938
6145
 
5939
6146
  //#endregion
5940
6147
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
5941
- function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
6148
+ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, saveSnippetButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
5942
6149
  useKatexStyles();
5943
- const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
6150
+ const { isLocalInspectorEnabled, openInspector, saveEventSnippet } = useCopilotKitInspector();
5944
6151
  const chatConfiguration = useCopilotChatConfiguration();
5945
6152
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
5946
6153
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
@@ -5953,6 +6160,17 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5953
6160
  threadId: chatConfiguration?.threadId,
5954
6161
  agentId: chatConfiguration?.agentId
5955
6162
  }) });
6163
+ const hasContent = !!(message.content && message.content.trim().length > 0);
6164
+ const boundSaveSnippetButton = renderSlot(saveSnippetButton, CopilotChatAssistantMessage.SaveSnippetButton, { onClick: () => {
6165
+ if (!hasContent) return;
6166
+ saveEventSnippet({
6167
+ kind: "text",
6168
+ messageId: message.id,
6169
+ content: message.content ?? "",
6170
+ threadId: chatConfiguration?.threadId,
6171
+ agentId: chatConfiguration?.agentId
6172
+ });
6173
+ } });
5956
6174
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
5957
6175
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
5958
6176
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
@@ -5961,6 +6179,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5961
6179
  children: [
5962
6180
  boundCopyButton,
5963
6181
  isLocalInspectorEnabled && boundInspectorButton,
6182
+ isLocalInspectorEnabled && hasContent && boundSaveSnippetButton,
5964
6183
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
5965
6184
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
5966
6185
  (onReadAloud || readAloudButton) && boundReadAloudButton,
@@ -5972,9 +6191,8 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5972
6191
  message,
5973
6192
  messages
5974
6193
  });
5975
- const hasContent = !!(message.content && message.content.trim().length > 0);
5976
6194
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
5977
- const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
6195
+ const shouldShowToolbar = toolbarVisible && (hasContent || isLocalInspectorEnabled) && !(isRunning && isLatestAssistantMessage);
5978
6196
  if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5979
6197
  "data-copilotkit": true,
5980
6198
  style: { display: "contents" },
@@ -5984,6 +6202,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5984
6202
  toolCallsView: boundToolCallsView,
5985
6203
  copyButton: boundCopyButton,
5986
6204
  inspectorButton: boundInspectorButton,
6205
+ saveSnippetButton: boundSaveSnippetButton,
5987
6206
  thumbsUpButton: boundThumbsUpButton,
5988
6207
  thumbsDownButton: boundThumbsDownButton,
5989
6208
  readAloudButton: boundReadAloudButton,
@@ -6194,6 +6413,10 @@ function CopilotKitColoredIcon() {
6194
6413
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {})
6195
6414
  });
6196
6415
  };
6416
+ _CopilotChatAssistantMessage.SaveSnippetButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
6417
+ "data-testid": "copilot-save-snippet-button",
6418
+ ...props
6419
+ });
6197
6420
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
6198
6421
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6199
6422
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
@@ -6235,6 +6458,7 @@ CopilotChatAssistantMessage.MarkdownRenderer.displayName = "CopilotChatAssistant
6235
6458
  CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
6236
6459
  CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
6237
6460
  CopilotChatAssistantMessage.InspectorButton.displayName = "CopilotChatAssistantMessage.InspectorButton";
6461
+ CopilotChatAssistantMessage.SaveSnippetButton.displayName = "CopilotChatAssistantMessage.SaveSnippetButton";
6238
6462
  CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
6239
6463
  CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
6240
6464
  CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
@@ -6605,6 +6829,8 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, header, con
6605
6829
  const isLatest = messages?.[messages.length - 1]?.id === message.id;
6606
6830
  const isStreaming = !!(isRunning && isLatest);
6607
6831
  const hasContent = !!(message.content && message.content.length > 0);
6832
+ const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
6833
+ const chatConfiguration = useCopilotChatConfiguration();
6608
6834
  const startTimeRef = (0, react.useRef)(null);
6609
6835
  const [elapsed, setElapsed] = (0, react.useState)(0);
6610
6836
  (0, react.useEffect)(() => {
@@ -6664,7 +6890,16 @@ function CopilotChatReasoningMessage({ message, messages, isRunning, header, con
6664
6890
  className: (0, tailwind_merge.twMerge)("cpk:my-1", className),
6665
6891
  "data-message-id": message.id,
6666
6892
  ...props,
6667
- children: [boundHeader, boundToggle]
6893
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6894
+ className: "cpk:flex cpk:items-center cpk:gap-1",
6895
+ children: [boundHeader, isLocalInspectorEnabled && hasContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatAssistantMessage_default.SaveSnippetButton, { onClick: () => void saveEventSnippet({
6896
+ kind: "reasoning",
6897
+ messageId: message.id,
6898
+ content: message.content ?? "",
6899
+ threadId: chatConfiguration?.threadId,
6900
+ agentId: chatConfiguration?.agentId
6901
+ }) })]
6902
+ }), boundToggle]
6668
6903
  });
6669
6904
  }
6670
6905
  (function(_CopilotChatReasoningMessage) {
@@ -7183,8 +7418,33 @@ const MemoizedUserMessage = react.default.memo(function MemoizedUserMessage({ me
7183
7418
  /**
7184
7419
  * Memoized wrapper for activity messages to prevent re-renders when other messages change.
7185
7420
  */
7421
+ function ActivitySnippetChrome({ message, children }) {
7422
+ const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
7423
+ const chatConfiguration = useCopilotChatConfiguration();
7424
+ if (!(isLocalInspectorEnabled && (message.activityType === "a2ui-surface" || message.activityType === "open-generative-ui"))) return children;
7425
+ const primaryLabel = (chatConfiguration?.labels ?? CopilotChatDefaultLabels).assistantMessageToolbarSaveSnippetLabel;
7426
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetBesideChrome, {
7427
+ showSave: true,
7428
+ saveButton: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
7429
+ "data-testid": "copilot-activity-save-snippet-button",
7430
+ title: primaryLabel,
7431
+ onClick: () => void saveEventSnippet({
7432
+ kind: "activity",
7433
+ messageId: message.id,
7434
+ activityType: message.activityType,
7435
+ content: message.content,
7436
+ threadId: chatConfiguration?.threadId,
7437
+ agentId: chatConfiguration?.agentId
7438
+ })
7439
+ }),
7440
+ children
7441
+ });
7442
+ }
7186
7443
  const MemoizedActivityMessage = react.default.memo(function MemoizedActivityMessage({ message, renderActivityMessage }) {
7187
- return renderActivityMessage(message);
7444
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivitySnippetChrome, {
7445
+ message,
7446
+ children: renderActivityMessage(message)
7447
+ });
7188
7448
  }, (prevProps, nextProps) => {
7189
7449
  if (prevProps.message.id !== nextProps.message.id) return false;
7190
7450
  if (prevProps.message.activityType !== nextProps.message.activityType) return false;
@@ -7325,6 +7585,30 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7325
7585
  const deduplicatedMessages = (0, react.useMemo)(() => deduplicateMessages(messages), [messages]);
7326
7586
  if (process.env.NODE_ENV === "development" && deduplicatedMessages.length < messages.length) console.warn(`CopilotChatMessageView: Merged ${messages.length - deduplicatedMessages.length} message(s) with duplicate IDs.`);
7327
7587
  const { Component: AssistantComponent, slotProps: assistantSlotProps } = (0, react.useMemo)(() => resolveSlotComponent(assistantMessage, CopilotChatAssistantMessage_default), [assistantMessage]);
7588
+ const agentId = config?.agentId;
7589
+ const threadId = config?.threadId;
7590
+ const assistantSlotPropsWithFeedback = (0, react.useMemo)(() => {
7591
+ const onThumbsUp = assistantSlotProps?.onThumbsUp;
7592
+ const onThumbsDown = assistantSlotProps?.onThumbsDown;
7593
+ if (!onThumbsUp && !onThumbsDown) return assistantSlotProps;
7594
+ const withRawEvent = (message) => {
7595
+ const rawEvent = agentId === void 0 || threadId === void 0 ? void 0 : copilotkit.getRawEventForMessage(agentId, threadId, message.id);
7596
+ return rawEvent === void 0 ? message : {
7597
+ ...message,
7598
+ rawEvent
7599
+ };
7600
+ };
7601
+ return {
7602
+ ...assistantSlotProps,
7603
+ ...onThumbsUp && { onThumbsUp: (message) => onThumbsUp(withRawEvent(message)) },
7604
+ ...onThumbsDown && { onThumbsDown: (message) => onThumbsDown(withRawEvent(message)) }
7605
+ };
7606
+ }, [
7607
+ assistantSlotProps,
7608
+ agentId,
7609
+ threadId,
7610
+ copilotkit
7611
+ ]);
7328
7612
  const { Component: UserComponent, slotProps: userSlotProps } = (0, react.useMemo)(() => resolveSlotComponent(userMessage, CopilotChatUserMessage_default), [userMessage]);
7329
7613
  const { Component: ReasoningComponent, slotProps: reasoningSlotProps } = (0, react.useMemo)(() => resolveSlotComponent(reasoningMessage, CopilotChatReasoningMessage_default), [reasoningMessage]);
7330
7614
  const scrollElementFromCtx = (0, react.useContext)(ScrollElementContext);
@@ -7364,7 +7648,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
7364
7648
  messages,
7365
7649
  isRunning,
7366
7650
  AssistantMessageComponent: AssistantComponent,
7367
- slotProps: assistantSlotProps
7651
+ slotProps: assistantSlotPropsWithFeedback
7368
7652
  }, message.id));
7369
7653
  else if (message.role === "user") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedUserMessage, {
7370
7654
  message,
@@ -8328,14 +8612,109 @@ async function transcribeAudio(core, audioBlob, filename = "recording.webm") {
8328
8612
  return await response.json();
8329
8613
  }
8330
8614
 
8615
+ //#endregion
8616
+ //#region src/v2/providers/use-inspector-thread-override.ts
8617
+ function useInspectorThreadOverride(args) {
8618
+ const [override, setOverride] = (0, react.useState)(null);
8619
+ const latestRef = (0, react.useRef)({
8620
+ ...args,
8621
+ override
8622
+ });
8623
+ latestRef.current = {
8624
+ ...args,
8625
+ override
8626
+ };
8627
+ const restoreOverride = (0, react.useCallback)((current, nextThreadId) => {
8628
+ setOverride(null);
8629
+ (0, _copilotkit_core.emitInspectorActiveThread)({
8630
+ requestId: current.requestId,
8631
+ threadId: nextThreadId,
8632
+ agentId: current.agentId,
8633
+ source: "app"
8634
+ });
8635
+ }, []);
8636
+ const failInspectorOverride = (0, react.useCallback)((requestId) => {
8637
+ const current = latestRef.current.override;
8638
+ if (!current || current.requestId !== requestId) return;
8639
+ (0, _copilotkit_core.emitInspectorViewThreadResult)({
8640
+ requestId,
8641
+ threadId: current.threadId,
8642
+ agentId: current.agentId,
8643
+ ok: false,
8644
+ reason: "connect-failed"
8645
+ });
8646
+ restoreOverride(current, current.previousThreadId);
8647
+ }, [restoreOverride]);
8648
+ (0, react.useEffect)(() => {
8649
+ if (!(0, _copilotkit_core.isInspectorThreadBridgeEnabled)()) return;
8650
+ const offView = (0, _copilotkit_core.onInspectorViewThread)((payload) => {
8651
+ const current = latestRef.current;
8652
+ if (payload.agentId !== current.agentId) return false;
8653
+ setOverride(current.override ? {
8654
+ ...current.override,
8655
+ ...payload
8656
+ } : {
8657
+ ...payload,
8658
+ previousThreadId: current.baseThreadId
8659
+ });
8660
+ (0, _copilotkit_core.emitInspectorViewThreadResult)({
8661
+ ...payload,
8662
+ ok: true
8663
+ });
8664
+ (0, _copilotkit_core.emitInspectorActiveThread)({
8665
+ ...payload,
8666
+ source: "override"
8667
+ });
8668
+ return true;
8669
+ });
8670
+ const offStop = (0, _copilotkit_core.onInspectorStopViewing)((payload) => {
8671
+ const current = latestRef.current.override;
8672
+ if (!current) return;
8673
+ if (payload.requestId !== current.requestId) return;
8674
+ if (payload.agentId !== current.agentId) return;
8675
+ restoreOverride(current, current.previousThreadId);
8676
+ });
8677
+ return () => {
8678
+ offView();
8679
+ offStop();
8680
+ };
8681
+ }, [restoreOverride]);
8682
+ (0, react.useEffect)(() => {
8683
+ if (!override) return;
8684
+ if (args.agentId !== override.agentId) {
8685
+ restoreOverride(override, override.previousThreadId);
8686
+ return;
8687
+ }
8688
+ if (args.baseThreadId === override.previousThreadId) return;
8689
+ if (args.baseThreadId === override.threadId) return;
8690
+ restoreOverride(override, args.baseThreadId);
8691
+ }, [
8692
+ args.agentId,
8693
+ args.baseThreadId,
8694
+ override,
8695
+ restoreOverride
8696
+ ]);
8697
+ return {
8698
+ inspectorThreadId: override?.threadId ?? null,
8699
+ inspectorRequestId: override?.requestId ?? null,
8700
+ failInspectorOverride
8701
+ };
8702
+ }
8703
+
8331
8704
  //#endregion
8332
8705
  //#region src/v2/components/chat/CopilotChat.tsx
8333
8706
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
8334
8707
  const existingConfig = useCopilotChatConfiguration();
8335
8708
  const resolvedAgentId = agentId ?? existingConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
8336
8709
  const providedThreadId = threadId ?? existingConfig?.threadId;
8337
- const resolvedThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8338
- const hasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
8710
+ const baseThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8711
+ const baseHasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
8712
+ const { inspectorThreadId, inspectorRequestId, failInspectorOverride } = useInspectorThreadOverride({
8713
+ agentId: resolvedAgentId,
8714
+ baseThreadId
8715
+ });
8716
+ const resolvedThreadId = inspectorThreadId ?? baseThreadId;
8717
+ const hasExplicitThreadId = inspectorThreadId !== null || baseHasExplicitThreadId;
8339
8718
  const { agent, isReady } = useAgent({
8340
8719
  agentId: resolvedAgentId,
8341
8720
  throttleMs
@@ -8364,6 +8743,24 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8364
8743
  subscription.unsubscribe();
8365
8744
  };
8366
8745
  }, [copilotkit, resolvedAgentId]);
8746
+ (0, react.useEffect)(() => {
8747
+ if (!inspectorRequestId) return;
8748
+ const requestId = inspectorRequestId;
8749
+ const expectedThreadId = resolvedThreadId;
8750
+ const subscription = copilotkit.subscribe({ onError: (event) => {
8751
+ if (event.code !== _copilotkit_core.CopilotKitCoreErrorCode.AGENT_CONNECT_FAILED) return;
8752
+ if (event.context?.agentId !== resolvedAgentId) return;
8753
+ if (event.context?.threadId !== expectedThreadId) return;
8754
+ failInspectorOverride(requestId);
8755
+ } });
8756
+ return () => subscription.unsubscribe();
8757
+ }, [
8758
+ copilotkit,
8759
+ failInspectorOverride,
8760
+ inspectorRequestId,
8761
+ resolvedAgentId,
8762
+ resolvedThreadId
8763
+ ]);
8367
8764
  const [transcribeMode, setTranscribeMode] = (0, react.useState)("input");
8368
8765
  const [inputValue, setInputValue] = (0, react.useState)("");
8369
8766
  const [transcriptionError, setTranscriptionError] = (0, react.useState)(null);
@@ -8390,7 +8787,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8390
8787
  const runtimeStatus = copilotkit.runtimeConnectionStatus === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connected ? "Connected" : copilotkit.runtimeConnectionStatus;
8391
8788
  const hasNativeIntelligenceRunActivity = hasExplicitThreadId && runtimeStatus === "Connected" && !!copilotkit.intelligence?.wsUrl && copilotkit.threadEndpoints?.realtimeMetadata === true;
8392
8789
  const [standaloneRunActivityStore] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: globalThis.fetch }));
8393
- const previousThreadIdRef = (0, react.useRef)(null);
8790
+ const previousThreadRef = (0, react.useRef)(null);
8394
8791
  const hasExplicitThreadIdRef = (0, react.useRef)(hasExplicitThreadId);
8395
8792
  hasExplicitThreadIdRef.current = hasExplicitThreadId;
8396
8793
  const rememberRecentlyLocalRunId = (0, react.useCallback)((runId) => {
@@ -8430,8 +8827,15 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8430
8827
  };
8431
8828
  }, []);
8432
8829
  (0, react.useEffect)(() => {
8433
- const threadChanged = previousThreadIdRef.current !== resolvedThreadId;
8434
- previousThreadIdRef.current = resolvedThreadId;
8830
+ const previousThread = previousThreadRef.current;
8831
+ const threadChanged = previousThread?.threadId !== resolvedThreadId;
8832
+ const inspectorTransition = threadChanged && previousThread !== null && previousThread.inspectorRequestId !== inspectorRequestId && (previousThread.inspectorRequestId !== null || inspectorRequestId !== null);
8833
+ previousThreadRef.current = {
8834
+ threadId: resolvedThreadId,
8835
+ inspectorRequestId
8836
+ };
8837
+ if (inspectorTransition) if (typeof copilotkit.stopAgent === "function") copilotkit.stopAgent({ agent });
8838
+ else agent.abortRun?.();
8435
8839
  agent.threadId = resolvedThreadId;
8436
8840
  if (!hasExplicitThreadId) {
8437
8841
  if (threadChanged && agent.messages.length > 0) agent.setMessages([]);
@@ -8447,6 +8851,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8447
8851
  } catch (error) {
8448
8852
  if (detached) return;
8449
8853
  console.error("CopilotChat: connectAgent failed", error);
8854
+ if (inspectorRequestId) failInspectorOverride(inspectorRequestId);
8450
8855
  } finally {
8451
8856
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
8452
8857
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
@@ -8472,7 +8877,9 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8472
8877
  resolvedThreadId,
8473
8878
  agent,
8474
8879
  resolvedAgentId,
8475
- hasExplicitThreadId
8880
+ hasExplicitThreadId,
8881
+ inspectorRequestId,
8882
+ failInspectorOverride
8476
8883
  ]);
8477
8884
  (0, react.useEffect)(() => {
8478
8885
  if (!hasNativeIntelligenceRunActivity) return;
@@ -9829,7 +10236,7 @@ const WildcardToolCallRender = defineToolCallRenderer({
9829
10236
  });
9830
10237
 
9831
10238
  //#endregion
9832
- //#region src/context/copilot-context.tsx
10239
+ //#region src/v1-deprecated/context/copilot-context.tsx
9833
10240
  const emptyCopilotContext$1 = {
9834
10241
  actions: {},
9835
10242
  setAction: () => {},
@@ -9909,7 +10316,7 @@ function returnAndThrowInDebug(_value) {
9909
10316
  }
9910
10317
 
9911
10318
  //#endregion
9912
- //#region src/hooks/use-tree.ts
10319
+ //#region src/v1-deprecated/hooks/use-tree.ts
9913
10320
  const removeNode = (nodes, id) => {
9914
10321
  return nodes.reduce((result, node) => {
9915
10322
  if (node.id !== id) {
@@ -10022,7 +10429,7 @@ function setsHaveIntersection$1(setA, setB) {
10022
10429
  }
10023
10430
 
10024
10431
  //#endregion
10025
- //#region src/hooks/use-flat-category-store.ts
10432
+ //#region src/v1-deprecated/hooks/use-flat-category-store.ts
10026
10433
  const useFlatCategoryStore = () => {
10027
10434
  const [elements, dispatch] = (0, react.useReducer)(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
10028
10435
  return {
@@ -10080,7 +10487,7 @@ function setsHaveIntersection(setA, setB) {
10080
10487
  }
10081
10488
 
10082
10489
  //#endregion
10083
- //#region src/context/copilot-messages-context.tsx
10490
+ //#region src/v1-deprecated/context/copilot-messages-context.tsx
10084
10491
  const emptyCopilotContext = {
10085
10492
  messages: [],
10086
10493
  setMessages: () => [],
@@ -10095,7 +10502,7 @@ function useCopilotMessagesContext() {
10095
10502
  }
10096
10503
 
10097
10504
  //#endregion
10098
- //#region src/components/toast/toast-provider.tsx
10505
+ //#region src/v1-deprecated/components/toast/toast-provider.tsx
10099
10506
  const ToastContext = (0, react.createContext)(void 0);
10100
10507
  function getErrorSeverity(error) {
10101
10508
  if (error.severity) switch (error.severity) {
@@ -10402,7 +10809,7 @@ function ToastProvider({ enabled, children }) {
10402
10809
  }
10403
10810
 
10404
10811
  //#endregion
10405
- //#region src/utils/dev-console.ts
10812
+ //#region src/v1-deprecated/utils/dev-console.ts
10406
10813
  function isLocalhost() {
10407
10814
  if (typeof window === "undefined") return false;
10408
10815
  return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
@@ -10413,7 +10820,7 @@ function shouldShowDevConsole(showDevConsole) {
10413
10820
  }
10414
10821
 
10415
10822
  //#endregion
10416
- //#region src/components/copilot-provider/copilot-messages.tsx
10823
+ //#region src/v1-deprecated/components/copilot-provider/copilot-messages.tsx
10417
10824
  /**
10418
10825
  * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
10419
10826
  */
@@ -10563,7 +10970,7 @@ function CopilotMessages({ children }) {
10563
10970
  }
10564
10971
 
10565
10972
  //#endregion
10566
- //#region src/components/usage-banner.tsx
10973
+ //#region src/v1-deprecated/components/usage-banner.tsx
10567
10974
  function UsageBanner({ severity = _copilotkit_shared.Severity.CRITICAL, message = "", onClose, actions }) {
10568
10975
  if (!message || !severity) return null;
10569
10976
  const theme = {
@@ -10760,7 +11167,7 @@ const getErrorActions = (error) => {
10760
11167
  };
10761
11168
 
10762
11169
  //#endregion
10763
- //#region src/lib/status-checker.ts
11170
+ //#region src/v1-deprecated/lib/status-checker.ts
10764
11171
  const STATUS_CHECK_INTERVAL = 1e3 * 60 * 5;
10765
11172
  var StatusChecker = class {
10766
11173
  constructor() {
@@ -10782,7 +11189,7 @@ var StatusChecker = class {
10782
11189
  this.lastResponse = response;
10783
11190
  onUpdate?.(response);
10784
11191
  return response;
10785
- } catch (error) {
11192
+ } catch {
10786
11193
  return null;
10787
11194
  }
10788
11195
  };
@@ -10808,7 +11215,7 @@ var StatusChecker = class {
10808
11215
  };
10809
11216
 
10810
11217
  //#endregion
10811
- //#region src/components/toast/exclamation-mark-icon.tsx
11218
+ //#region src/v1-deprecated/components/toast/exclamation-mark-icon.tsx
10812
11219
  const ExclamationMarkIcon = ({ className, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
10813
11220
  xmlns: "http://www.w3.org/2000/svg",
10814
11221
  width: "24",
@@ -10843,7 +11250,7 @@ const ExclamationMarkIcon = ({ className, style }) => /* @__PURE__ */ (0, react_
10843
11250
  });
10844
11251
 
10845
11252
  //#endregion
10846
- //#region src/components/error-boundary/error-utils.tsx
11253
+ //#region src/v1-deprecated/components/error-boundary/error-utils.tsx
10847
11254
  function ErrorToast({ errors }) {
10848
11255
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10849
11256
  style: {
@@ -10917,7 +11324,7 @@ function useAsyncCallback(callback, deps) {
10917
11324
  }
10918
11325
 
10919
11326
  //#endregion
10920
- //#region src/components/error-boundary/error-boundary.tsx
11327
+ //#region src/v1-deprecated/components/error-boundary/error-boundary.tsx
10921
11328
  const statusChecker = new StatusChecker();
10922
11329
  var CopilotErrorBoundary = class extends react.default.Component {
10923
11330
  constructor(props) {
@@ -10958,7 +11365,7 @@ var CopilotErrorBoundary = class extends react.default.Component {
10958
11365
  };
10959
11366
 
10960
11367
  //#endregion
10961
- //#region src/context/coagent-state-renders-context.tsx
11368
+ //#region src/v1-deprecated/context/coagent-state-renders-context.tsx
10962
11369
  const CoAgentStateRendersContext = (0, react.createContext)(void 0);
10963
11370
  function CoAgentStateRendersProvider({ children }) {
10964
11371
  const [coAgentStateRenders, setCoAgentStateRenders] = (0, react.useState)({});
@@ -10993,7 +11400,7 @@ function useCoAgentStateRenders() {
10993
11400
  }
10994
11401
 
10995
11402
  //#endregion
10996
- //#region src/context/threads-context.tsx
11403
+ //#region src/v1-deprecated/context/threads-context.tsx
10997
11404
  const ThreadsContext = (0, react.createContext)(void 0);
10998
11405
  function ThreadsProvider({ children, threadId: explicitThreadId }) {
10999
11406
  const [internalThreadId, setInternalThreadId] = (0, react.useState)(() => (0, _copilotkit_shared.randomUUID)());
@@ -11020,7 +11427,7 @@ function useThreads() {
11020
11427
  }
11021
11428
 
11022
11429
  //#endregion
11023
- //#region src/hooks/use-coagent-state-render-bridge.helpers.ts
11430
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.helpers.ts
11024
11431
  let RenderStatus = /* @__PURE__ */ function(RenderStatus) {
11025
11432
  RenderStatus["InProgress"] = "inProgress";
11026
11433
  RenderStatus["Complete"] = "complete";
@@ -11185,7 +11592,7 @@ function selectSnapshot({ messageId, messageName, allowLiveState, skipLatestCach
11185
11592
  }
11186
11593
 
11187
11594
  //#endregion
11188
- //#region src/hooks/use-coagent-state-render-registry.ts
11595
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-registry.ts
11189
11596
  const LAST_SNAPSHOTS_BY_RENDER_AND_RUN = "__lastSnapshotsByStateRenderIdAndRun";
11190
11597
  const LAST_SNAPSHOTS_BY_MESSAGE = "__lastSnapshotsByMessageId";
11191
11598
  function getClaimsStore(claimsRef) {
@@ -11307,7 +11714,7 @@ function useStateRenderRegistry({ agentId, stateRenderId, message, messageIndex,
11307
11714
  }
11308
11715
 
11309
11716
  //#endregion
11310
- //#region src/hooks/use-coagent-state-render-bridge.tsx
11717
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.tsx
11311
11718
  function useCoagentStateRenderBridge(agentId, props) {
11312
11719
  const { stateSnapshot, message } = props;
11313
11720
  const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
@@ -11391,7 +11798,7 @@ function CoAgentStateRenderBridge(props) {
11391
11798
  }
11392
11799
 
11393
11800
  //#endregion
11394
- //#region src/components/CopilotListeners.tsx
11801
+ //#region src/v1-deprecated/components/CopilotListeners.tsx
11395
11802
  const usePredictStateSubscription = (agent) => {
11396
11803
  const predictStateToolsRef = (0, react.useRef)([]);
11397
11804
  const getSubscriber = (0, react.useCallback)((agent) => ({
@@ -11461,7 +11868,7 @@ function CopilotListeners() {
11461
11868
  }
11462
11869
 
11463
11870
  //#endregion
11464
- //#region src/components/copilot-provider/copilotkit.tsx
11871
+ //#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
11465
11872
  function CopilotKit({ children, ...props }) {
11466
11873
  const enabled = shouldShowDevConsole(props.showDevConsole);
11467
11874
  const showInspector = shouldShowDevConsole(props.enableInspector);
@@ -11479,7 +11886,6 @@ function CopilotKit({ children, ...props }) {
11479
11886
  ...v2Props,
11480
11887
  showDevConsole: showInspector,
11481
11888
  renderCustomMessages: renderArr,
11482
- useSingleEndpoint: props.useSingleEndpoint ?? true,
11483
11889
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInternal, {
11484
11890
  ...props,
11485
11891
  children
@@ -12470,4 +12876,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
12470
12876
  return ɵrunMcpFollowUp;
12471
12877
  }
12472
12878
  });
12473
- //# sourceMappingURL=copilotkit-Bocmlr37.cjs.map
12879
+ //# sourceMappingURL=copilotkit-Dr0speVK.cjs.map