@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
@@ -92,6 +92,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
92
92
  assistantMessageToolbarCopyMessageLabel: "Copy",
93
93
  assistantMessageToolbarInspectorLabel: "View in Inspector",
94
94
  assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
95
+ assistantMessageToolbarSaveSnippetLabel: "Save as snippet",
95
96
  assistantMessageToolbarThumbsUpLabel: "Good response",
96
97
  assistantMessageToolbarThumbsDownLabel: "Bad response",
97
98
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -1670,7 +1671,8 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1670
1671
  //#region src/v2/components/CopilotKitInspectorContext.tsx
1671
1672
  const CopilotKitInspectorContext = react.createContext({
1672
1673
  isLocalInspectorEnabled: false,
1673
- openInspector: () => void 0
1674
+ openInspector: () => void 0,
1675
+ saveEventSnippet: async () => void 0
1674
1676
  });
1675
1677
  const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
1676
1678
  function useCopilotKitInspector() {
@@ -2484,6 +2486,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2484
2486
  const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGenerativeUIActivityRendererInner({ content }) {
2485
2487
  const initialHeight = content.initialHeight ?? 200;
2486
2488
  const [autoHeight, setAutoHeight] = (0, react.useState)(null);
2489
+ const [sandboxReady, setSandboxReady] = (0, react.useState)(false);
2487
2490
  const sandboxFunctions = useSandboxFunctions();
2488
2491
  const localApi = (0, react.useMemo)(() => {
2489
2492
  const api = {};
@@ -2585,6 +2588,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2585
2588
  sandbox.promise.then(() => {
2586
2589
  if (cancelled) return;
2587
2590
  sandboxReadyRef.current = true;
2591
+ setSandboxReady(true);
2588
2592
  sandbox.run(`
2589
2593
  var s = document.createElement('style');
2590
2594
  s.textContent = 'html, body { overflow: hidden !important; }';
@@ -2609,6 +2613,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2609
2613
  sandboxRef.current = null;
2610
2614
  }
2611
2615
  sandboxReadyRef.current = false;
2616
+ setSandboxReady(false);
2612
2617
  setAutoHeight(null);
2613
2618
  };
2614
2619
  }, [
@@ -2639,7 +2644,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2639
2644
  const generationDone = content.generating === false;
2640
2645
  (0, react.useEffect)(() => {
2641
2646
  const sandbox = sandboxRef.current;
2642
- if (!generationDone || !sandbox) return;
2647
+ if (!generationDone || !sandboxReady || !sandbox) return;
2643
2648
  let handled = false;
2644
2649
  const onMessage = (e) => {
2645
2650
  if (handled) return;
@@ -2668,7 +2673,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2668
2673
  return () => {
2669
2674
  window.removeEventListener("message", onMessage);
2670
2675
  };
2671
- }, [generationDone]);
2676
+ }, [generationDone, sandboxReady]);
2672
2677
  const height = autoHeight ?? initialHeight;
2673
2678
  const isGenerating = content.generating !== false;
2674
2679
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3556,10 +3561,46 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3556
3561
  const requestInspectorOpen = (0, react.useCallback)((request) => {
3557
3562
  setInspectorOpenRequest({ ...request });
3558
3563
  }, []);
3564
+ const saveEventSnippet = (0, react.useCallback)(async (request) => {
3565
+ try {
3566
+ const mod = await import("@copilotkit/web-inspector");
3567
+ const threadId = request.threadId ?? "inspector-snippet";
3568
+ const runId = `inspector-snippet-${Date.now()}`;
3569
+ const compiled = mod.compileChatSnippet({
3570
+ ...request,
3571
+ threadId,
3572
+ runId
3573
+ });
3574
+ const now = (/* @__PURE__ */ new Date()).toISOString();
3575
+ const snippet = {
3576
+ id: crypto.randomUUID(),
3577
+ name: compiled.name,
3578
+ recipe: compiled.recipe,
3579
+ events: compiled.events,
3580
+ createdAt: now,
3581
+ updatedAt: now
3582
+ };
3583
+ mod.upsertEventSnippet(snippet);
3584
+ requestInspectorOpen({
3585
+ messageId: request.messageId,
3586
+ threadId: request.threadId,
3587
+ agentId: request.agentId,
3588
+ menu: "event-snippets",
3589
+ snippetId: snippet.id
3590
+ });
3591
+ } catch (error) {
3592
+ console.error("[CopilotKit] Could not save the event snippet.", error);
3593
+ }
3594
+ }, [requestInspectorOpen]);
3559
3595
  const inspectorContextValue = (0, react.useMemo)(() => ({
3560
3596
  isLocalInspectorEnabled,
3561
- openInspector: requestInspectorOpen
3562
- }), [isLocalInspectorEnabled, requestInspectorOpen]);
3597
+ openInspector: requestInspectorOpen,
3598
+ saveEventSnippet
3599
+ }), [
3600
+ isLocalInspectorEnabled,
3601
+ requestInspectorOpen,
3602
+ saveEventSnippet
3603
+ ]);
3563
3604
  const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
3564
3605
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3565
3606
  const setFrom = (arr) => new Set(arr.map(key));
@@ -3614,7 +3655,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3614
3655
  const hasLocalAgents = mergedAgents && Object.keys(mergedAgents).length > 0;
3615
3656
  const hasSelfManagedAgents = Object.keys(selfManagedAgents).length > 0;
3616
3657
  (0, react.useEffect)(() => {
3617
- 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.");
3658
+ 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.");
3618
3659
  }, [hasSelfManagedAgents, resolvedPublicKey]);
3619
3660
  const headers = typeof headersProp === "function" ? headersProp() : headersProp;
3620
3661
  const mergedHeaders = (0, react.useMemo)(() => {
@@ -5211,10 +5252,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5211
5252
  }, [store, selector]), () => selector(store.getState()), () => selector(store.getServerState()));
5212
5253
  }
5213
5254
  /**
5214
- * React hook for listing and managing Intelligence platform threads.
5255
+ * React hook for listing and managing CopilotKit Intelligence threads.
5215
5256
  *
5216
5257
  * On mount the hook fetches the thread list for the runtime-authenticated user
5217
- * and the given `agentId`. When the Intelligence platform exposes a WebSocket
5258
+ * and the given `agentId`. When CopilotKit Intelligence exposes a WebSocket
5218
5259
  * URL, it also opens a realtime subscription so the `threads` array stays
5219
5260
  * current without polling — thread creates, renames, archives, and deletes
5220
5261
  * from any client are reflected immediately.
@@ -5510,7 +5551,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5510
5551
  //#endregion
5511
5552
  //#region src/v2/hooks/use-learn-from-user-action.tsx
5512
5553
  /**
5513
- * Record a user UI interaction in the Intelligence platform's user-actions
5554
+ * Record a user UI interaction in CopilotKit Intelligence's user-actions
5514
5555
  * stream. The platform's auto-curated knowledge base agent reads these
5515
5556
  * (alongside finished agent runs) and writes free-form Obsidian-flavored
5516
5557
  * markdown to `/project`, where any agent in the same project can later
@@ -5936,25 +5977,191 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5936
5977
  });
5937
5978
  }
5938
5979
 
5980
+ //#endregion
5981
+ //#region src/v2/components/chat/save-snippet-beside.ts
5982
+ const SAVE_SNIPPET_ICON_SLOT_PX = 36;
5983
+ const SAVE_SNIPPET_BESIDE_WRAP_CLASS = "cpk:relative cpk:w-full cpk:overflow-visible";
5984
+ const SAVE_SNIPPET_BESIDE_BODY_CLASS = "cpk:w-full";
5985
+ const SAVE_SNIPPET_BESIDE_SAVE_CLASS = "cpk:absolute cpk:top-0 cpk:z-10";
5986
+ function saveSnippetBesideStyle(side) {
5987
+ if (side === "left") return {
5988
+ left: "auto",
5989
+ right: "100%",
5990
+ marginLeft: 0,
5991
+ marginRight: 4
5992
+ };
5993
+ return {
5994
+ left: "100%",
5995
+ right: "auto",
5996
+ marginLeft: 4,
5997
+ marginRight: 0
5998
+ };
5999
+ }
6000
+ function pickSaveSnippetSide(roomRight, roomLeft, slotPx = SAVE_SNIPPET_ICON_SLOT_PX) {
6001
+ if (roomRight >= slotPx) return "right";
6002
+ if (roomLeft >= slotPx) return "left";
6003
+ return "right";
6004
+ }
6005
+ function findOverflowAncestor(el) {
6006
+ let node = el.parentElement;
6007
+ while (node) {
6008
+ const style = getComputedStyle(node);
6009
+ const overflowX = style.overflowX;
6010
+ const overflow = style.overflow;
6011
+ if (overflowX === "hidden" || overflowX === "auto" || overflowX === "scroll" || overflow === "hidden" || overflow === "auto" || overflow === "scroll") return node;
6012
+ node = node.parentElement;
6013
+ }
6014
+ return document.documentElement;
6015
+ }
6016
+ function measurableBox(el) {
6017
+ let node = el;
6018
+ while (node && getComputedStyle(node).display === "contents") node = node.firstElementChild;
6019
+ return node ?? el;
6020
+ }
6021
+ function measureSaveSnippetSide(wrap, body) {
6022
+ const clipRect = findOverflowAncestor(wrap).getBoundingClientRect();
6023
+ const bodyRect = measurableBox(body.firstElementChild ?? body).getBoundingClientRect();
6024
+ return pickSaveSnippetSide(clipRect.right - bodyRect.right, bodyRect.left - clipRect.left);
6025
+ }
6026
+
6027
+ //#endregion
6028
+ //#region src/v2/components/chat/SaveSnippetIconButton.tsx
6029
+ function SaveSnippetIconButton({ title, className, ...props }) {
6030
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6031
+ const primaryLabel = title || labels.assistantMessageToolbarSaveSnippetLabel;
6032
+ const localOnlyLabel = labels.assistantMessageToolbarInspectorLocalOnlyLabel;
6033
+ const accessibleLabel = `${primaryLabel} (${localOnlyLabel})`;
6034
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
6035
+ asChild: true,
6036
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
6037
+ type: "button",
6038
+ variant: "assistantMessageToolbarButton",
6039
+ "aria-label": accessibleLabel,
6040
+ title: accessibleLabel,
6041
+ className,
6042
+ ...props,
6043
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Bookmark, { className: "cpk:size-[18px]" })
6044
+ })
6045
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
6046
+ side: "bottom",
6047
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6048
+ className: "cpk:flex cpk:flex-col cpk:gap-0.5",
6049
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: primaryLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6050
+ className: "cpk:text-[10px] cpk:opacity-65",
6051
+ children: localOnlyLabel
6052
+ })]
6053
+ })
6054
+ })] });
6055
+ }
6056
+ function SaveSnippetBesideChrome({ children, showSave, saveButton }) {
6057
+ const wrapRef = (0, react.useRef)(null);
6058
+ const bodyRef = (0, react.useRef)(null);
6059
+ const [side, setSide] = (0, react.useState)("right");
6060
+ (0, react.useLayoutEffect)(() => {
6061
+ if (!showSave) return;
6062
+ const wrap = wrapRef.current;
6063
+ const body = bodyRef.current;
6064
+ if (!wrap || !body) return;
6065
+ const measure = () => {
6066
+ setSide(measureSaveSnippetSide(wrap, body));
6067
+ };
6068
+ measure();
6069
+ if (typeof ResizeObserver === "undefined") return;
6070
+ const observer = new ResizeObserver(measure);
6071
+ observer.observe(wrap);
6072
+ observer.observe(body);
6073
+ const clip = findOverflowAncestor(wrap);
6074
+ if (clip !== wrap) observer.observe(clip);
6075
+ window.addEventListener("resize", measure);
6076
+ return () => {
6077
+ observer.disconnect();
6078
+ window.removeEventListener("resize", measure);
6079
+ };
6080
+ }, [showSave]);
6081
+ if (!showSave) return children;
6082
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6083
+ ref: wrapRef,
6084
+ className: SAVE_SNIPPET_BESIDE_WRAP_CLASS,
6085
+ "data-save-snippet-side": side,
6086
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6087
+ ref: bodyRef,
6088
+ className: SAVE_SNIPPET_BESIDE_BODY_CLASS,
6089
+ children
6090
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6091
+ className: SAVE_SNIPPET_BESIDE_SAVE_CLASS,
6092
+ style: saveSnippetBesideStyle(side),
6093
+ children: saveButton
6094
+ })]
6095
+ });
6096
+ }
6097
+
5939
6098
  //#endregion
5940
6099
  //#region src/v2/components/chat/CopilotChatToolCallsView.tsx
5941
6100
  function CopilotChatToolCallsView({ message, messages = [] }) {
5942
6101
  const renderToolCall = useRenderToolCall();
6102
+ const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
6103
+ const chatConfiguration = useCopilotChatConfiguration();
6104
+ const labels = chatConfiguration?.labels ?? CopilotChatDefaultLabels;
5943
6105
  if (!message.toolCalls || message.toolCalls.length === 0) return null;
5944
6106
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: message.toolCalls.map((toolCall) => {
5945
- const toolMessage = messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id);
5946
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: renderToolCall({
6107
+ const rendered = renderToolCall({
5947
6108
  toolCall,
5948
- toolMessage
5949
- }) }, toolCall.id);
6109
+ toolMessage: messages.find((m) => m.role === "tool" && m.toolCallId === toolCall.id)
6110
+ });
6111
+ if (!isLocalInspectorEnabled || !hasCompleteArgs(toolCall.function.arguments)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: rendered }, toolCall.id);
6112
+ const primaryLabel = labels.assistantMessageToolbarSaveSnippetLabel;
6113
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolCallSnippetChrome, {
6114
+ label: primaryLabel,
6115
+ onSave: () => void saveEventSnippet({
6116
+ kind: "tool-call",
6117
+ messageId: message.id,
6118
+ toolCallId: toolCall.id,
6119
+ toolName: toolCall.function.name,
6120
+ argsJson: toolCall.function.arguments || "{}",
6121
+ threadId: chatConfiguration?.threadId,
6122
+ agentId: chatConfiguration?.agentId
6123
+ }),
6124
+ children: rendered
6125
+ }, toolCall.id);
5950
6126
  }) });
5951
6127
  }
6128
+ function hasCompleteArgs(args) {
6129
+ const trimmed = (args ?? "").trim();
6130
+ if (!trimmed) return true;
6131
+ try {
6132
+ JSON.parse(trimmed);
6133
+ return true;
6134
+ } catch {
6135
+ return false;
6136
+ }
6137
+ }
6138
+ function ToolCallSnippetChrome({ children, label, onSave }) {
6139
+ const bodyRef = (0, react.useRef)(null);
6140
+ const [showSave, setShowSave] = (0, react.useState)(false);
6141
+ (0, react.useLayoutEffect)(() => {
6142
+ const el = bodyRef.current;
6143
+ setShowSave(!!el && el.childElementCount > 0);
6144
+ });
6145
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetBesideChrome, {
6146
+ showSave,
6147
+ saveButton: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
6148
+ "data-testid": "copilot-tool-save-snippet-button",
6149
+ title: label,
6150
+ onClick: onSave
6151
+ }),
6152
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6153
+ ref: bodyRef,
6154
+ className: "cpk:contents",
6155
+ children
6156
+ })
6157
+ });
6158
+ }
5952
6159
 
5953
6160
  //#endregion
5954
6161
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
5955
- function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
6162
+ 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 }) {
5956
6163
  useKatexStyles();
5957
- const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
6164
+ const { isLocalInspectorEnabled, openInspector, saveEventSnippet } = useCopilotKitInspector();
5958
6165
  const chatConfiguration = useCopilotChatConfiguration();
5959
6166
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
5960
6167
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
@@ -5967,6 +6174,17 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5967
6174
  threadId: chatConfiguration?.threadId,
5968
6175
  agentId: chatConfiguration?.agentId
5969
6176
  }) });
6177
+ const hasContent = !!(message.content && message.content.trim().length > 0);
6178
+ const boundSaveSnippetButton = renderSlot(saveSnippetButton, CopilotChatAssistantMessage.SaveSnippetButton, { onClick: () => {
6179
+ if (!hasContent) return;
6180
+ saveEventSnippet({
6181
+ kind: "text",
6182
+ messageId: message.id,
6183
+ content: message.content ?? "",
6184
+ threadId: chatConfiguration?.threadId,
6185
+ agentId: chatConfiguration?.agentId
6186
+ });
6187
+ } });
5970
6188
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
5971
6189
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
5972
6190
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
@@ -5975,6 +6193,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5975
6193
  children: [
5976
6194
  boundCopyButton,
5977
6195
  isLocalInspectorEnabled && boundInspectorButton,
6196
+ isLocalInspectorEnabled && hasContent && boundSaveSnippetButton,
5978
6197
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
5979
6198
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
5980
6199
  (onReadAloud || readAloudButton) && boundReadAloudButton,
@@ -5986,9 +6205,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5986
6205
  message,
5987
6206
  messages
5988
6207
  });
5989
- const hasContent = !!(message.content && message.content.trim().length > 0);
5990
6208
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
5991
- const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
6209
+ const shouldShowToolbar = toolbarVisible && (hasContent || isLocalInspectorEnabled) && !(isRunning && isLatestAssistantMessage);
5992
6210
  if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
5993
6211
  "data-copilotkit": true,
5994
6212
  style: { display: "contents" },
@@ -5998,6 +6216,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5998
6216
  toolCallsView: boundToolCallsView,
5999
6217
  copyButton: boundCopyButton,
6000
6218
  inspectorButton: boundInspectorButton,
6219
+ saveSnippetButton: boundSaveSnippetButton,
6001
6220
  thumbsUpButton: boundThumbsUpButton,
6002
6221
  thumbsDownButton: boundThumbsDownButton,
6003
6222
  readAloudButton: boundReadAloudButton,
@@ -6208,6 +6427,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6208
6427
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {})
6209
6428
  });
6210
6429
  };
6430
+ _CopilotChatAssistantMessage.SaveSnippetButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
6431
+ "data-testid": "copilot-save-snippet-button",
6432
+ ...props
6433
+ });
6211
6434
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
6212
6435
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6213
6436
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
@@ -6249,6 +6472,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6249
6472
  CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
6250
6473
  CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
6251
6474
  CopilotChatAssistantMessage.InspectorButton.displayName = "CopilotChatAssistantMessage.InspectorButton";
6475
+ CopilotChatAssistantMessage.SaveSnippetButton.displayName = "CopilotChatAssistantMessage.SaveSnippetButton";
6252
6476
  CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
6253
6477
  CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
6254
6478
  CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
@@ -6619,6 +6843,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6619
6843
  const isLatest = messages?.[messages.length - 1]?.id === message.id;
6620
6844
  const isStreaming = !!(isRunning && isLatest);
6621
6845
  const hasContent = !!(message.content && message.content.length > 0);
6846
+ const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
6847
+ const chatConfiguration = useCopilotChatConfiguration();
6622
6848
  const startTimeRef = (0, react.useRef)(null);
6623
6849
  const [elapsed, setElapsed] = (0, react.useState)(0);
6624
6850
  (0, react.useEffect)(() => {
@@ -6678,7 +6904,16 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6678
6904
  className: (0, tailwind_merge.twMerge)("cpk:my-1", className),
6679
6905
  "data-message-id": message.id,
6680
6906
  ...props,
6681
- children: [boundHeader, boundToggle]
6907
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6908
+ className: "cpk:flex cpk:items-center cpk:gap-1",
6909
+ children: [boundHeader, isLocalInspectorEnabled && hasContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotChatAssistantMessage_default.SaveSnippetButton, { onClick: () => void saveEventSnippet({
6910
+ kind: "reasoning",
6911
+ messageId: message.id,
6912
+ content: message.content ?? "",
6913
+ threadId: chatConfiguration?.threadId,
6914
+ agentId: chatConfiguration?.agentId
6915
+ }) })]
6916
+ }), boundToggle]
6682
6917
  });
6683
6918
  }
6684
6919
  (function(_CopilotChatReasoningMessage) {
@@ -7197,8 +7432,33 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
7197
7432
  /**
7198
7433
  * Memoized wrapper for activity messages to prevent re-renders when other messages change.
7199
7434
  */
7435
+ function ActivitySnippetChrome({ message, children }) {
7436
+ const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
7437
+ const chatConfiguration = useCopilotChatConfiguration();
7438
+ if (!(isLocalInspectorEnabled && (message.activityType === "a2ui-surface" || message.activityType === "open-generative-ui"))) return children;
7439
+ const primaryLabel = (chatConfiguration?.labels ?? CopilotChatDefaultLabels).assistantMessageToolbarSaveSnippetLabel;
7440
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetBesideChrome, {
7441
+ showSave: true,
7442
+ saveButton: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
7443
+ "data-testid": "copilot-activity-save-snippet-button",
7444
+ title: primaryLabel,
7445
+ onClick: () => void saveEventSnippet({
7446
+ kind: "activity",
7447
+ messageId: message.id,
7448
+ activityType: message.activityType,
7449
+ content: message.content,
7450
+ threadId: chatConfiguration?.threadId,
7451
+ agentId: chatConfiguration?.agentId
7452
+ })
7453
+ }),
7454
+ children
7455
+ });
7456
+ }
7200
7457
  const MemoizedActivityMessage = react.default.memo(function MemoizedActivityMessage({ message, renderActivityMessage }) {
7201
- return renderActivityMessage(message);
7458
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivitySnippetChrome, {
7459
+ message,
7460
+ children: renderActivityMessage(message)
7461
+ });
7202
7462
  }, (prevProps, nextProps) => {
7203
7463
  if (prevProps.message.id !== nextProps.message.id) return false;
7204
7464
  if (prevProps.message.activityType !== nextProps.message.activityType) return false;
@@ -8366,14 +8626,109 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8366
8626
  return await response.json();
8367
8627
  }
8368
8628
 
8629
+ //#endregion
8630
+ //#region src/v2/providers/use-inspector-thread-override.ts
8631
+ function useInspectorThreadOverride(args) {
8632
+ const [override, setOverride] = (0, react.useState)(null);
8633
+ const latestRef = (0, react.useRef)({
8634
+ ...args,
8635
+ override
8636
+ });
8637
+ latestRef.current = {
8638
+ ...args,
8639
+ override
8640
+ };
8641
+ const restoreOverride = (0, react.useCallback)((current, nextThreadId) => {
8642
+ setOverride(null);
8643
+ (0, _copilotkit_core.emitInspectorActiveThread)({
8644
+ requestId: current.requestId,
8645
+ threadId: nextThreadId,
8646
+ agentId: current.agentId,
8647
+ source: "app"
8648
+ });
8649
+ }, []);
8650
+ const failInspectorOverride = (0, react.useCallback)((requestId) => {
8651
+ const current = latestRef.current.override;
8652
+ if (!current || current.requestId !== requestId) return;
8653
+ (0, _copilotkit_core.emitInspectorViewThreadResult)({
8654
+ requestId,
8655
+ threadId: current.threadId,
8656
+ agentId: current.agentId,
8657
+ ok: false,
8658
+ reason: "connect-failed"
8659
+ });
8660
+ restoreOverride(current, current.previousThreadId);
8661
+ }, [restoreOverride]);
8662
+ (0, react.useEffect)(() => {
8663
+ if (!(0, _copilotkit_core.isInspectorThreadBridgeEnabled)()) return;
8664
+ const offView = (0, _copilotkit_core.onInspectorViewThread)((payload) => {
8665
+ const current = latestRef.current;
8666
+ if (payload.agentId !== current.agentId) return false;
8667
+ setOverride(current.override ? {
8668
+ ...current.override,
8669
+ ...payload
8670
+ } : {
8671
+ ...payload,
8672
+ previousThreadId: current.baseThreadId
8673
+ });
8674
+ (0, _copilotkit_core.emitInspectorViewThreadResult)({
8675
+ ...payload,
8676
+ ok: true
8677
+ });
8678
+ (0, _copilotkit_core.emitInspectorActiveThread)({
8679
+ ...payload,
8680
+ source: "override"
8681
+ });
8682
+ return true;
8683
+ });
8684
+ const offStop = (0, _copilotkit_core.onInspectorStopViewing)((payload) => {
8685
+ const current = latestRef.current.override;
8686
+ if (!current) return;
8687
+ if (payload.requestId !== current.requestId) return;
8688
+ if (payload.agentId !== current.agentId) return;
8689
+ restoreOverride(current, current.previousThreadId);
8690
+ });
8691
+ return () => {
8692
+ offView();
8693
+ offStop();
8694
+ };
8695
+ }, [restoreOverride]);
8696
+ (0, react.useEffect)(() => {
8697
+ if (!override) return;
8698
+ if (args.agentId !== override.agentId) {
8699
+ restoreOverride(override, override.previousThreadId);
8700
+ return;
8701
+ }
8702
+ if (args.baseThreadId === override.previousThreadId) return;
8703
+ if (args.baseThreadId === override.threadId) return;
8704
+ restoreOverride(override, args.baseThreadId);
8705
+ }, [
8706
+ args.agentId,
8707
+ args.baseThreadId,
8708
+ override,
8709
+ restoreOverride
8710
+ ]);
8711
+ return {
8712
+ inspectorThreadId: override?.threadId ?? null,
8713
+ inspectorRequestId: override?.requestId ?? null,
8714
+ failInspectorOverride
8715
+ };
8716
+ }
8717
+
8369
8718
  //#endregion
8370
8719
  //#region src/v2/components/chat/CopilotChat.tsx
8371
8720
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
8372
8721
  const existingConfig = useCopilotChatConfiguration();
8373
8722
  const resolvedAgentId = agentId ?? existingConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
8374
8723
  const providedThreadId = threadId ?? existingConfig?.threadId;
8375
- const resolvedThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8376
- const hasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
8724
+ const baseThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8725
+ const baseHasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
8726
+ const { inspectorThreadId, inspectorRequestId, failInspectorOverride } = useInspectorThreadOverride({
8727
+ agentId: resolvedAgentId,
8728
+ baseThreadId
8729
+ });
8730
+ const resolvedThreadId = inspectorThreadId ?? baseThreadId;
8731
+ const hasExplicitThreadId = inspectorThreadId !== null || baseHasExplicitThreadId;
8377
8732
  const { agent, isReady } = useAgent({
8378
8733
  agentId: resolvedAgentId,
8379
8734
  throttleMs
@@ -8402,6 +8757,24 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8402
8757
  subscription.unsubscribe();
8403
8758
  };
8404
8759
  }, [copilotkit, resolvedAgentId]);
8760
+ (0, react.useEffect)(() => {
8761
+ if (!inspectorRequestId) return;
8762
+ const requestId = inspectorRequestId;
8763
+ const expectedThreadId = resolvedThreadId;
8764
+ const subscription = copilotkit.subscribe({ onError: (event) => {
8765
+ if (event.code !== _copilotkit_core.CopilotKitCoreErrorCode.AGENT_CONNECT_FAILED) return;
8766
+ if (event.context?.agentId !== resolvedAgentId) return;
8767
+ if (event.context?.threadId !== expectedThreadId) return;
8768
+ failInspectorOverride(requestId);
8769
+ } });
8770
+ return () => subscription.unsubscribe();
8771
+ }, [
8772
+ copilotkit,
8773
+ failInspectorOverride,
8774
+ inspectorRequestId,
8775
+ resolvedAgentId,
8776
+ resolvedThreadId
8777
+ ]);
8405
8778
  const [transcribeMode, setTranscribeMode] = (0, react.useState)("input");
8406
8779
  const [inputValue, setInputValue] = (0, react.useState)("");
8407
8780
  const [transcriptionError, setTranscriptionError] = (0, react.useState)(null);
@@ -8428,7 +8801,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8428
8801
  const runtimeStatus = copilotkit.runtimeConnectionStatus === _copilotkit_core.CopilotKitCoreRuntimeConnectionStatus.Connected ? "Connected" : copilotkit.runtimeConnectionStatus;
8429
8802
  const hasNativeIntelligenceRunActivity = hasExplicitThreadId && runtimeStatus === "Connected" && !!copilotkit.intelligence?.wsUrl && copilotkit.threadEndpoints?.realtimeMetadata === true;
8430
8803
  const [standaloneRunActivityStore] = (0, react.useState)(() => (0, _copilotkit_core.ɵcreateThreadStore)({ fetch: globalThis.fetch }));
8431
- const previousThreadIdRef = (0, react.useRef)(null);
8804
+ const previousThreadRef = (0, react.useRef)(null);
8432
8805
  const hasExplicitThreadIdRef = (0, react.useRef)(hasExplicitThreadId);
8433
8806
  hasExplicitThreadIdRef.current = hasExplicitThreadId;
8434
8807
  const rememberRecentlyLocalRunId = (0, react.useCallback)((runId) => {
@@ -8468,8 +8841,15 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8468
8841
  };
8469
8842
  }, []);
8470
8843
  (0, react.useEffect)(() => {
8471
- const threadChanged = previousThreadIdRef.current !== resolvedThreadId;
8472
- previousThreadIdRef.current = resolvedThreadId;
8844
+ const previousThread = previousThreadRef.current;
8845
+ const threadChanged = previousThread?.threadId !== resolvedThreadId;
8846
+ const inspectorTransition = threadChanged && previousThread !== null && previousThread.inspectorRequestId !== inspectorRequestId && (previousThread.inspectorRequestId !== null || inspectorRequestId !== null);
8847
+ previousThreadRef.current = {
8848
+ threadId: resolvedThreadId,
8849
+ inspectorRequestId
8850
+ };
8851
+ if (inspectorTransition) if (typeof copilotkit.stopAgent === "function") copilotkit.stopAgent({ agent });
8852
+ else agent.abortRun?.();
8473
8853
  agent.threadId = resolvedThreadId;
8474
8854
  if (!hasExplicitThreadId) {
8475
8855
  if (threadChanged && agent.messages.length > 0) agent.setMessages([]);
@@ -8485,6 +8865,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8485
8865
  } catch (error) {
8486
8866
  if (detached) return;
8487
8867
  console.error("CopilotChat: connectAgent failed", error);
8868
+ if (inspectorRequestId) failInspectorOverride(inspectorRequestId);
8488
8869
  } finally {
8489
8870
  if (!detached) (typeof requestAnimationFrame === "function" ? requestAnimationFrame : (cb) => setTimeout(cb, 16))(() => {
8490
8871
  if (!detached) setLastConnectedThreadId(resolvedThreadId);
@@ -8510,7 +8891,9 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8510
8891
  resolvedThreadId,
8511
8892
  agent,
8512
8893
  resolvedAgentId,
8513
- hasExplicitThreadId
8894
+ hasExplicitThreadId,
8895
+ inspectorRequestId,
8896
+ failInspectorOverride
8514
8897
  ]);
8515
8898
  (0, react.useEffect)(() => {
8516
8899
  if (!hasNativeIntelligenceRunActivity) return;
@@ -9867,7 +10250,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
9867
10250
  });
9868
10251
 
9869
10252
  //#endregion
9870
- //#region src/context/copilot-context.tsx
10253
+ //#region src/v1-deprecated/context/copilot-context.tsx
9871
10254
  const emptyCopilotContext$1 = {
9872
10255
  actions: {},
9873
10256
  setAction: () => {},
@@ -9947,7 +10330,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
9947
10330
  }
9948
10331
 
9949
10332
  //#endregion
9950
- //#region src/hooks/use-tree.ts
10333
+ //#region src/v1-deprecated/hooks/use-tree.ts
9951
10334
  const removeNode = (nodes, id) => {
9952
10335
  return nodes.reduce((result, node) => {
9953
10336
  if (node.id !== id) {
@@ -10060,7 +10443,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10060
10443
  }
10061
10444
 
10062
10445
  //#endregion
10063
- //#region src/hooks/use-flat-category-store.ts
10446
+ //#region src/v1-deprecated/hooks/use-flat-category-store.ts
10064
10447
  const useFlatCategoryStore = () => {
10065
10448
  const [elements, dispatch] = (0, react.useReducer)(flatCategoryStoreReducer, /* @__PURE__ */ new Map());
10066
10449
  return {
@@ -10118,7 +10501,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10118
10501
  }
10119
10502
 
10120
10503
  //#endregion
10121
- //#region src/context/copilot-messages-context.tsx
10504
+ //#region src/v1-deprecated/context/copilot-messages-context.tsx
10122
10505
  const emptyCopilotContext = {
10123
10506
  messages: [],
10124
10507
  setMessages: () => [],
@@ -10128,7 +10511,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10128
10511
  const CopilotMessagesContext = react.default.createContext(emptyCopilotContext);
10129
10512
 
10130
10513
  //#endregion
10131
- //#region src/components/toast/toast-provider.tsx
10514
+ //#region src/v1-deprecated/components/toast/toast-provider.tsx
10132
10515
  const ToastContext = (0, react.createContext)(void 0);
10133
10516
  function getErrorSeverity(error) {
10134
10517
  if (error.severity) switch (error.severity) {
@@ -10435,7 +10818,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10435
10818
  }
10436
10819
 
10437
10820
  //#endregion
10438
- //#region src/utils/dev-console.ts
10821
+ //#region src/v1-deprecated/utils/dev-console.ts
10439
10822
  function isLocalhost() {
10440
10823
  if (typeof window === "undefined") return false;
10441
10824
  return window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0";
@@ -10446,7 +10829,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10446
10829
  }
10447
10830
 
10448
10831
  //#endregion
10449
- //#region src/components/copilot-provider/copilot-messages.tsx
10832
+ //#region src/v1-deprecated/components/copilot-provider/copilot-messages.tsx
10450
10833
  /**
10451
10834
  * An internal context to separate the messages state (which is constantly changing) from the rest of CopilotKit context
10452
10835
  */
@@ -10596,7 +10979,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10596
10979
  }
10597
10980
 
10598
10981
  //#endregion
10599
- //#region src/components/usage-banner.tsx
10982
+ //#region src/v1-deprecated/components/usage-banner.tsx
10600
10983
  function UsageBanner({ severity = _copilotkit_shared.Severity.CRITICAL, message = "", onClose, actions }) {
10601
10984
  if (!message || !severity) return null;
10602
10985
  const theme = {
@@ -10793,7 +11176,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10793
11176
  };
10794
11177
 
10795
11178
  //#endregion
10796
- //#region src/lib/status-checker.ts
11179
+ //#region src/v1-deprecated/lib/status-checker.ts
10797
11180
  const STATUS_CHECK_INTERVAL = 1e3 * 60 * 5;
10798
11181
  var StatusChecker = class {
10799
11182
  constructor() {
@@ -10815,7 +11198,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10815
11198
  this.lastResponse = response;
10816
11199
  onUpdate?.(response);
10817
11200
  return response;
10818
- } catch (error) {
11201
+ } catch {
10819
11202
  return null;
10820
11203
  }
10821
11204
  };
@@ -10841,7 +11224,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10841
11224
  };
10842
11225
 
10843
11226
  //#endregion
10844
- //#region src/components/error-boundary/error-boundary.tsx
11227
+ //#region src/v1-deprecated/components/error-boundary/error-boundary.tsx
10845
11228
  const statusChecker = new StatusChecker();
10846
11229
  var CopilotErrorBoundary = class extends react.default.Component {
10847
11230
  constructor(props) {
@@ -10882,7 +11265,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10882
11265
  };
10883
11266
 
10884
11267
  //#endregion
10885
- //#region src/context/coagent-state-renders-context.tsx
11268
+ //#region src/v1-deprecated/context/coagent-state-renders-context.tsx
10886
11269
  const CoAgentStateRendersContext = (0, react.createContext)(void 0);
10887
11270
  function CoAgentStateRendersProvider({ children }) {
10888
11271
  const [coAgentStateRenders, setCoAgentStateRenders] = (0, react.useState)({});
@@ -10917,7 +11300,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10917
11300
  }
10918
11301
 
10919
11302
  //#endregion
10920
- //#region src/context/threads-context.tsx
11303
+ //#region src/v1-deprecated/context/threads-context.tsx
10921
11304
  const ThreadsContext = (0, react.createContext)(void 0);
10922
11305
  function ThreadsProvider({ children, threadId: explicitThreadId }) {
10923
11306
  const [internalThreadId, setInternalThreadId] = (0, react.useState)(() => (0, _copilotkit_shared.randomUUID)());
@@ -10944,7 +11327,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
10944
11327
  }
10945
11328
 
10946
11329
  //#endregion
10947
- //#region src/hooks/use-coagent-state-render-bridge.helpers.ts
11330
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.helpers.ts
10948
11331
  let RenderStatus = /* @__PURE__ */ function(RenderStatus) {
10949
11332
  RenderStatus["InProgress"] = "inProgress";
10950
11333
  RenderStatus["Complete"] = "complete";
@@ -11109,7 +11492,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11109
11492
  }
11110
11493
 
11111
11494
  //#endregion
11112
- //#region src/hooks/use-coagent-state-render-registry.ts
11495
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-registry.ts
11113
11496
  const LAST_SNAPSHOTS_BY_RENDER_AND_RUN = "__lastSnapshotsByStateRenderIdAndRun";
11114
11497
  const LAST_SNAPSHOTS_BY_MESSAGE = "__lastSnapshotsByMessageId";
11115
11498
  function getClaimsStore(claimsRef) {
@@ -11231,7 +11614,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11231
11614
  }
11232
11615
 
11233
11616
  //#endregion
11234
- //#region src/hooks/use-coagent-state-render-bridge.tsx
11617
+ //#region src/v1-deprecated/hooks/use-coagent-state-render-bridge.tsx
11235
11618
  function useCoagentStateRenderBridge(agentId, props) {
11236
11619
  const { stateSnapshot, message } = props;
11237
11620
  const { coAgentStateRenders, claimsRef } = useCoAgentStateRenders();
@@ -11315,7 +11698,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11315
11698
  }
11316
11699
 
11317
11700
  //#endregion
11318
- //#region src/components/CopilotListeners.tsx
11701
+ //#region src/v1-deprecated/components/CopilotListeners.tsx
11319
11702
  const usePredictStateSubscription = (agent) => {
11320
11703
  const predictStateToolsRef = (0, react.useRef)([]);
11321
11704
  const getSubscriber = (0, react.useCallback)((agent) => ({
@@ -11385,7 +11768,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
11385
11768
  }
11386
11769
 
11387
11770
  //#endregion
11388
- //#region src/components/copilot-provider/copilotkit.tsx
11771
+ //#region src/v1-deprecated/components/copilot-provider/copilotkit.tsx
11389
11772
  function CopilotKit({ children, ...props }) {
11390
11773
  const enabled = shouldShowDevConsole(props.showDevConsole);
11391
11774
  const showInspector = shouldShowDevConsole(props.enableInspector);