@copilotkit/react-core 1.69.0 → 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-pkDPhwkR.d.mts → copilotkit-DYKpg4pD.d.mts} +28 -22
  2. package/dist/copilotkit-DYKpg4pD.d.mts.map +1 -0
  3. package/dist/{copilotkit-DOMr3DRO.cjs → copilotkit-Dr0speVK.cjs} +429 -46
  4. package/dist/copilotkit-Dr0speVK.cjs.map +1 -0
  5. package/dist/{copilotkit-ykQW_VJZ.mjs → copilotkit-Dr6g885f.mjs} +431 -48
  6. package/dist/copilotkit-Dr6g885f.mjs.map +1 -0
  7. package/dist/{copilotkit-DYM5ChMS.d.cts → copilotkit-Hl1t9Y1v.d.cts} +28 -22
  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 -100
  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 +1 -1
  30. package/dist/v2/index.d.mts +1 -1
  31. package/dist/v2/index.mjs +1 -1
  32. package/dist/v2/index.umd.js +426 -43
  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 +1 -1
  37. package/skills/react-core/references/threads.md +2 -2
  38. package/dist/copilotkit-DOMr3DRO.cjs.map +0 -1
  39. package/dist/copilotkit-DYM5ChMS.d.cts.map +0 -1
  40. package/dist/copilotkit-pkDPhwkR.d.mts.map +0 -1
  41. package/dist/copilotkit-ykQW_VJZ.mjs.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;
@@ -8352,14 +8612,109 @@ async function transcribeAudio(core, audioBlob, filename = "recording.webm") {
8352
8612
  return await response.json();
8353
8613
  }
8354
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
+
8355
8704
  //#endregion
8356
8705
  //#region src/v2/components/chat/CopilotChat.tsx
8357
8706
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
8358
8707
  const existingConfig = useCopilotChatConfiguration();
8359
8708
  const resolvedAgentId = agentId ?? existingConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
8360
8709
  const providedThreadId = threadId ?? existingConfig?.threadId;
8361
- const resolvedThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8362
- 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;
8363
8718
  const { agent, isReady } = useAgent({
8364
8719
  agentId: resolvedAgentId,
8365
8720
  throttleMs
@@ -8388,6 +8743,24 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8388
8743
  subscription.unsubscribe();
8389
8744
  };
8390
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
+ ]);
8391
8764
  const [transcribeMode, setTranscribeMode] = (0, react.useState)("input");
8392
8765
  const [inputValue, setInputValue] = (0, react.useState)("");
8393
8766
  const [transcriptionError, setTranscriptionError] = (0, react.useState)(null);
@@ -8414,7 +8787,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8414
8787
  const runtimeStatus = copilotkit.runtimeConnectionStatus === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connected ? "Connected" : copilotkit.runtimeConnectionStatus;
8415
8788
  const hasNativeIntelligenceRunActivity = hasExplicitThreadId && runtimeStatus === "Connected" && !!copilotkit.intelligence?.wsUrl && copilotkit.threadEndpoints?.realtimeMetadata === true;
8416
8789
  const [standaloneRunActivityStore] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: globalThis.fetch }));
8417
- const previousThreadIdRef = (0, react.useRef)(null);
8790
+ const previousThreadRef = (0, react.useRef)(null);
8418
8791
  const hasExplicitThreadIdRef = (0, react.useRef)(hasExplicitThreadId);
8419
8792
  hasExplicitThreadIdRef.current = hasExplicitThreadId;
8420
8793
  const rememberRecentlyLocalRunId = (0, react.useCallback)((runId) => {
@@ -8454,8 +8827,15 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8454
8827
  };
8455
8828
  }, []);
8456
8829
  (0, react.useEffect)(() => {
8457
- const threadChanged = previousThreadIdRef.current !== resolvedThreadId;
8458
- 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?.();
8459
8839
  agent.threadId = resolvedThreadId;
8460
8840
  if (!hasExplicitThreadId) {
8461
8841
  if (threadChanged && agent.messages.length > 0) agent.setMessages([]);
@@ -8471,6 +8851,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8471
8851
  } catch (error) {
8472
8852
  if (detached) return;
8473
8853
  console.error("CopilotChat: connectAgent failed", error);
8854
+ if (inspectorRequestId) failInspectorOverride(inspectorRequestId);
8474
8855
  } finally {
8475
8856
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
8476
8857
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
@@ -8496,7 +8877,9 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8496
8877
  resolvedThreadId,
8497
8878
  agent,
8498
8879
  resolvedAgentId,
8499
- hasExplicitThreadId
8880
+ hasExplicitThreadId,
8881
+ inspectorRequestId,
8882
+ failInspectorOverride
8500
8883
  ]);
8501
8884
  (0, react.useEffect)(() => {
8502
8885
  if (!hasNativeIntelligenceRunActivity) return;
@@ -9853,7 +10236,7 @@ const WildcardToolCallRender = defineToolCallRenderer({
9853
10236
  });
9854
10237
 
9855
10238
  //#endregion
9856
- //#region src/context/copilot-context.tsx
10239
+ //#region src/v1-deprecated/context/copilot-context.tsx
9857
10240
  const emptyCopilotContext$1 = {
9858
10241
  actions: {},
9859
10242
  setAction: () => {},
@@ -9933,7 +10316,7 @@ function returnAndThrowInDebug(_value) {
9933
10316
  }
9934
10317
 
9935
10318
  //#endregion
9936
- //#region src/hooks/use-tree.ts
10319
+ //#region src/v1-deprecated/hooks/use-tree.ts
9937
10320
  const removeNode = (nodes, id) => {
9938
10321
  return nodes.reduce((result, node) => {
9939
10322
  if (node.id !== id) {
@@ -10046,7 +10429,7 @@ function setsHaveIntersection$1(setA, setB) {
10046
10429
  }
10047
10430
 
10048
10431
  //#endregion
10049
- //#region src/hooks/use-flat-category-store.ts
10432
+ //#region src/v1-deprecated/hooks/use-flat-category-store.ts
10050
10433
  const useFlatCategoryStore = () => {
10051
10434
  const [elements, dispatch] = (0, react.useReducer)(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
10052
10435
  return {
@@ -10104,7 +10487,7 @@ function setsHaveIntersection(setA, setB) {
10104
10487
  }
10105
10488
 
10106
10489
  //#endregion
10107
- //#region src/context/copilot-messages-context.tsx
10490
+ //#region src/v1-deprecated/context/copilot-messages-context.tsx
10108
10491
  const emptyCopilotContext = {
10109
10492
  messages: [],
10110
10493
  setMessages: () => [],
@@ -10119,7 +10502,7 @@ function useCopilotMessagesContext() {
10119
10502
  }
10120
10503
 
10121
10504
  //#endregion
10122
- //#region src/components/toast/toast-provider.tsx
10505
+ //#region src/v1-deprecated/components/toast/toast-provider.tsx
10123
10506
  const ToastContext = (0, react.createContext)(void 0);
10124
10507
  function getErrorSeverity(error) {
10125
10508
  if (error.severity) switch (error.severity) {
@@ -10426,7 +10809,7 @@ function ToastProvider({ enabled, children }) {
10426
10809
  }
10427
10810
 
10428
10811
  //#endregion
10429
- //#region src/utils/dev-console.ts
10812
+ //#region src/v1-deprecated/utils/dev-console.ts
10430
10813
  function isLocalhost() {
10431
10814
  if (typeof window === "undefined") return false;
10432
10815
  return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
@@ -10437,7 +10820,7 @@ function shouldShowDevConsole(showDevConsole) {
10437
10820
  }
10438
10821
 
10439
10822
  //#endregion
10440
- //#region src/components/copilot-provider/copilot-messages.tsx
10823
+ //#region src/v1-deprecated/components/copilot-provider/copilot-messages.tsx
10441
10824
  /**
10442
10825
  * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
10443
10826
  */
@@ -10587,7 +10970,7 @@ function CopilotMessages({ children }) {
10587
10970
  }
10588
10971
 
10589
10972
  //#endregion
10590
- //#region src/components/usage-banner.tsx
10973
+ //#region src/v1-deprecated/components/usage-banner.tsx
10591
10974
  function UsageBanner({ severity = _copilotkit_shared.Severity.CRITICAL, message = "", onClose, actions }) {
10592
10975
  if (!message || !severity) return null;
10593
10976
  const theme = {
@@ -10784,7 +11167,7 @@ const getErrorActions = (error) => {
10784
11167
  };
10785
11168
 
10786
11169
  //#endregion
10787
- //#region src/lib/status-checker.ts
11170
+ //#region src/v1-deprecated/lib/status-checker.ts
10788
11171
  const STATUS_CHECK_INTERVAL = 1e3 * 60 * 5;
10789
11172
  var StatusChecker = class {
10790
11173
  constructor() {
@@ -10806,7 +11189,7 @@ var StatusChecker = class {
10806
11189
  this.lastResponse = response;
10807
11190
  onUpdate?.(response);
10808
11191
  return response;
10809
- } catch (error) {
11192
+ } catch {
10810
11193
  return null;
10811
11194
  }
10812
11195
  };
@@ -10832,7 +11215,7 @@ var StatusChecker = class {
10832
11215
  };
10833
11216
 
10834
11217
  //#endregion
10835
- //#region src/components/toast/exclamation-mark-icon.tsx
11218
+ //#region src/v1-deprecated/components/toast/exclamation-mark-icon.tsx
10836
11219
  const ExclamationMarkIcon = ({ className, style }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
10837
11220
  xmlns: "http://www.w3.org/2000/svg",
10838
11221
  width: "24",
@@ -10867,7 +11250,7 @@ const ExclamationMarkIcon = ({ className, style }) => /* @__PURE__ */ (0, react_
10867
11250
  });
10868
11251
 
10869
11252
  //#endregion
10870
- //#region src/components/error-boundary/error-utils.tsx
11253
+ //#region src/v1-deprecated/components/error-boundary/error-utils.tsx
10871
11254
  function ErrorToast({ errors }) {
10872
11255
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
10873
11256
  style: {
@@ -10941,7 +11324,7 @@ function useAsyncCallback(callback, deps) {
10941
11324
  }
10942
11325
 
10943
11326
  //#endregion
10944
- //#region src/components/error-boundary/error-boundary.tsx
11327
+ //#region src/v1-deprecated/components/error-boundary/error-boundary.tsx
10945
11328
  const statusChecker = new StatusChecker();
10946
11329
  var CopilotErrorBoundary = class extends react.default.Component {
10947
11330
  constructor(props) {
@@ -10982,7 +11365,7 @@ var CopilotErrorBoundary = class extends react.default.Component {
10982
11365
  };
10983
11366
 
10984
11367
  //#endregion
10985
- //#region src/context/coagent-state-renders-context.tsx
11368
+ //#region src/v1-deprecated/context/coagent-state-renders-context.tsx
10986
11369
  const CoAgentStateRendersContext = (0, react.createContext)(void 0);
10987
11370
  function CoAgentStateRendersProvider({ children }) {
10988
11371
  const [coAgentStateRenders, setCoAgentStateRenders] = (0, react.useState)({});
@@ -11017,7 +11400,7 @@ function useCoAgentStateRenders() {
11017
11400
  }
11018
11401
 
11019
11402
  //#endregion
11020
- //#region src/context/threads-context.tsx
11403
+ //#region src/v1-deprecated/context/threads-context.tsx
11021
11404
  const ThreadsContext = (0, react.createContext)(void 0);
11022
11405
  function ThreadsProvider({ children, threadId: explicitThreadId }) {
11023
11406
  const [internalThreadId, setInternalThreadId] = (0, react.useState)(() => (0, _copilotkit_shared.randomUUID)());
@@ -11044,7 +11427,7 @@ function useThreads() {
11044
11427
  }
11045
11428
 
11046
11429
  //#endregion
11047
- //#region src/hooks/use-coagent-state-render-bridge.helpers.ts
11430
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.helpers.ts
11048
11431
  let RenderStatus = /* @__PURE__ */ function(RenderStatus) {
11049
11432
  RenderStatus["InProgress"] = "inProgress";
11050
11433
  RenderStatus["Complete"] = "complete";
@@ -11209,7 +11592,7 @@ function selectSnapshot({ messageId, messageName, allowLiveState, skipLatestCach
11209
11592
  }
11210
11593
 
11211
11594
  //#endregion
11212
- //#region src/hooks/use-coagent-state-render-registry.ts
11595
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-registry.ts
11213
11596
  const LAST_SNAPSHOTS_BY_RENDER_AND_RUN = "__lastSnapshotsByStateRenderIdAndRun";
11214
11597
  const LAST_SNAPSHOTS_BY_MESSAGE = "__lastSnapshotsByMessageId";
11215
11598
  function getClaimsStore(claimsRef) {
@@ -11331,7 +11714,7 @@ function useStateRenderRegistry({ agentId, stateRenderId, message, messageIndex,
11331
11714
  }
11332
11715
 
11333
11716
  //#endregion
11334
- //#region src/hooks/use-coagent-state-render-bridge.tsx
11717
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.tsx
11335
11718
  function useCoagentStateRenderBridge(agentId, props) {
11336
11719
  const { stateSnapshot, message } = props;
11337
11720
  const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
@@ -11415,7 +11798,7 @@ function CoAgentStateRenderBridge(props) {
11415
11798
  }
11416
11799
 
11417
11800
  //#endregion
11418
- //#region src/components/CopilotListeners.tsx
11801
+ //#region src/v1-deprecated/components/CopilotListeners.tsx
11419
11802
  const usePredictStateSubscription = (agent) => {
11420
11803
  const predictStateToolsRef = (0, react.useRef)([]);
11421
11804
  const getSubscriber = (0, react.useCallback)((agent) => ({
@@ -11485,7 +11868,7 @@ function CopilotListeners() {
11485
11868
  }
11486
11869
 
11487
11870
  //#endregion
11488
- //#region src/components/copilot-provider/copilotkit.tsx
11871
+ //#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
11489
11872
  function CopilotKit({ children, ...props }) {
11490
11873
  const enabled = shouldShowDevConsole(props.showDevConsole);
11491
11874
  const showInspector = shouldShowDevConsole(props.enableInspector);
@@ -12493,4 +12876,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
12493
12876
  return ɵrunMcpFollowUp;
12494
12877
  }
12495
12878
  });
12496
- //# sourceMappingURL=copilotkit-DOMr3DRO.cjs.map
12879
+ //# sourceMappingURL=copilotkit-Dr0speVK.cjs.map