@copilotkit/react-core 1.69.1 → 1.69.2

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 (35) hide show
  1. package/dist/{copilotkit-Dr0speVK.cjs → copilotkit-Ba7qwYt3.cjs} +34 -288
  2. package/dist/copilotkit-Ba7qwYt3.cjs.map +1 -0
  3. package/dist/{copilotkit-Dr6g885f.mjs → copilotkit-BmW2sFH6.mjs} +35 -289
  4. package/dist/copilotkit-BmW2sFH6.mjs.map +1 -0
  5. package/dist/{copilotkit-Hl1t9Y1v.d.cts → copilotkit-CF1Pm2VG.d.cts} +2 -7
  6. package/dist/copilotkit-CF1Pm2VG.d.cts.map +1 -0
  7. package/dist/{copilotkit-DYKpg4pD.d.mts → copilotkit-TdM-5onZ.d.mts} +2 -7
  8. package/dist/copilotkit-TdM-5onZ.d.mts.map +1 -0
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/index.umd.js +5 -46
  14. package/dist/index.umd.js.map +1 -1
  15. package/dist/v2/headless.cjs +0 -1
  16. package/dist/v2/headless.cjs.map +1 -1
  17. package/dist/v2/headless.d.cts +0 -1
  18. package/dist/v2/headless.d.cts.map +1 -1
  19. package/dist/v2/headless.d.mts +0 -1
  20. package/dist/v2/headless.d.mts.map +1 -1
  21. package/dist/v2/headless.mjs +0 -1
  22. package/dist/v2/headless.mjs.map +1 -1
  23. package/dist/v2/index.cjs +1 -1
  24. package/dist/v2/index.css +1 -1
  25. package/dist/v2/index.d.cts +1 -1
  26. package/dist/v2/index.d.mts +1 -1
  27. package/dist/v2/index.mjs +1 -1
  28. package/dist/v2/index.umd.js +33 -287
  29. package/dist/v2/index.umd.js.map +1 -1
  30. package/package.json +7 -7
  31. package/skills/react-core/SKILL.md +1 -1
  32. package/dist/copilotkit-DYKpg4pD.d.mts.map +0 -1
  33. package/dist/copilotkit-Dr0speVK.cjs.map +0 -1
  34. package/dist/copilotkit-Dr6g885f.mjs.map +0 -1
  35. package/dist/copilotkit-Hl1t9Y1v.d.cts.map +0 -1
@@ -92,7 +92,6 @@ _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",
96
95
  assistantMessageToolbarThumbsUpLabel: "Good response",
97
96
  assistantMessageToolbarThumbsDownLabel: "Bad response",
98
97
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -1671,8 +1670,7 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1671
1670
  //#region src/v2/components/CopilotKitInspectorContext.tsx
1672
1671
  const CopilotKitInspectorContext = react.createContext({
1673
1672
  isLocalInspectorEnabled: false,
1674
- openInspector: () => void 0,
1675
- saveEventSnippet: async () => void 0
1673
+ openInspector: () => void 0
1676
1674
  });
1677
1675
  const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
1678
1676
  function useCopilotKitInspector() {
@@ -2486,7 +2484,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2486
2484
  const OpenGenerativeUIActivityRendererInner = react.default.memo(function OpenGenerativeUIActivityRendererInner({ content }) {
2487
2485
  const initialHeight = content.initialHeight ?? 200;
2488
2486
  const [autoHeight, setAutoHeight] = (0, react.useState)(null);
2489
- const [sandboxReady, setSandboxReady] = (0, react.useState)(false);
2490
2487
  const sandboxFunctions = useSandboxFunctions();
2491
2488
  const localApi = (0, react.useMemo)(() => {
2492
2489
  const api = {};
@@ -2588,7 +2585,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2588
2585
  sandbox.promise.then(() => {
2589
2586
  if (cancelled) return;
2590
2587
  sandboxReadyRef.current = true;
2591
- setSandboxReady(true);
2592
2588
  sandbox.run(`
2593
2589
  var s = document.createElement('style');
2594
2590
  s.textContent = 'html, body { overflow: hidden !important; }';
@@ -2613,7 +2609,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2613
2609
  sandboxRef.current = null;
2614
2610
  }
2615
2611
  sandboxReadyRef.current = false;
2616
- setSandboxReady(false);
2617
2612
  setAutoHeight(null);
2618
2613
  };
2619
2614
  }, [
@@ -2644,7 +2639,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2644
2639
  const generationDone = content.generating === false;
2645
2640
  (0, react.useEffect)(() => {
2646
2641
  const sandbox = sandboxRef.current;
2647
- if (!generationDone || !sandboxReady || !sandbox) return;
2642
+ if (!generationDone || !sandbox) return;
2648
2643
  let handled = false;
2649
2644
  const onMessage = (e) => {
2650
2645
  if (handled) return;
@@ -2673,7 +2668,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
2673
2668
  return () => {
2674
2669
  window.removeEventListener("message", onMessage);
2675
2670
  };
2676
- }, [generationDone, sandboxReady]);
2671
+ }, [generationDone]);
2677
2672
  const height = autoHeight ?? initialHeight;
2678
2673
  const isGenerating = content.generating !== false;
2679
2674
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3561,46 +3556,10 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3561
3556
  const requestInspectorOpen = (0, react.useCallback)((request) => {
3562
3557
  setInspectorOpenRequest({ ...request });
3563
3558
  }, []);
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]);
3595
3559
  const inspectorContextValue = (0, react.useMemo)(() => ({
3596
3560
  isLocalInspectorEnabled,
3597
- openInspector: requestInspectorOpen,
3598
- saveEventSnippet
3599
- }), [
3600
- isLocalInspectorEnabled,
3601
- requestInspectorOpen,
3602
- saveEventSnippet
3603
- ]);
3561
+ openInspector: requestInspectorOpen
3562
+ }), [isLocalInspectorEnabled, requestInspectorOpen]);
3604
3563
  const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
3605
3564
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3606
3565
  const setFrom = (arr) => new Set(arr.map(key));
@@ -5977,191 +5936,25 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5977
5936
  });
5978
5937
  }
5979
5938
 
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
-
6098
5939
  //#endregion
6099
5940
  //#region src/v2/components/chat/CopilotChatToolCallsView.tsx
6100
5941
  function CopilotChatToolCallsView({ message, messages = [] }) {
6101
5942
  const renderToolCall = useRenderToolCall();
6102
- const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
6103
- const chatConfiguration = useCopilotChatConfiguration();
6104
- const labels = chatConfiguration?.labels ?? CopilotChatDefaultLabels;
6105
5943
  if (!message.toolCalls || message.toolCalls.length === 0) return null;
6106
5944
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: message.toolCalls.map((toolCall) => {
6107
- const rendered = renderToolCall({
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({
6108
5947
  toolCall,
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);
5948
+ toolMessage
5949
+ }) }, toolCall.id);
6126
5950
  }) });
6127
5951
  }
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
- }
6159
5952
 
6160
5953
  //#endregion
6161
5954
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
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 }) {
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 }) {
6163
5956
  useKatexStyles();
6164
- const { isLocalInspectorEnabled, openInspector, saveEventSnippet } = useCopilotKitInspector();
5957
+ const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
6165
5958
  const chatConfiguration = useCopilotChatConfiguration();
6166
5959
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
6167
5960
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
@@ -6174,17 +5967,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6174
5967
  threadId: chatConfiguration?.threadId,
6175
5968
  agentId: chatConfiguration?.agentId
6176
5969
  }) });
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
- } });
6188
5970
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
6189
5971
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
6190
5972
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
@@ -6193,7 +5975,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6193
5975
  children: [
6194
5976
  boundCopyButton,
6195
5977
  isLocalInspectorEnabled && boundInspectorButton,
6196
- isLocalInspectorEnabled && hasContent && boundSaveSnippetButton,
6197
5978
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
6198
5979
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
6199
5980
  (onReadAloud || readAloudButton) && boundReadAloudButton,
@@ -6205,6 +5986,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6205
5986
  message,
6206
5987
  messages
6207
5988
  });
5989
+ const hasContent = !!(message.content && message.content.trim().length > 0);
6208
5990
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
6209
5991
  const shouldShowToolbar = toolbarVisible && (hasContent || isLocalInspectorEnabled) && !(isRunning && isLatestAssistantMessage);
6210
5992
  if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -6216,7 +5998,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6216
5998
  toolCallsView: boundToolCallsView,
6217
5999
  copyButton: boundCopyButton,
6218
6000
  inspectorButton: boundInspectorButton,
6219
- saveSnippetButton: boundSaveSnippetButton,
6220
6001
  thumbsUpButton: boundThumbsUpButton,
6221
6002
  thumbsDownButton: boundThumbsDownButton,
6222
6003
  readAloudButton: boundReadAloudButton,
@@ -6363,7 +6144,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6363
6144
  className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]", className),
6364
6145
  ...props
6365
6146
  });
6366
- const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, children, ...props }) => {
6147
+ const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, tooltipClassName, children, ...props }) => {
6367
6148
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
6368
6149
  asChild: true,
6369
6150
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
@@ -6375,6 +6156,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6375
6156
  })
6376
6157
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
6377
6158
  side: "bottom",
6159
+ className: tooltipClassName,
6378
6160
  children: tooltip ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: title })
6379
6161
  })] });
6380
6162
  };
@@ -6408,29 +6190,30 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6408
6190
  children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "cpk:size-[18px]" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Copy, { className: "cpk:size-[18px]" })
6409
6191
  });
6410
6192
  };
6411
- _CopilotChatAssistantMessage.InspectorButton = ({ title, ...props }) => {
6193
+ _CopilotChatAssistantMessage.InspectorButton = ({ title, className, ...props }) => {
6412
6194
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6413
6195
  const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
6414
- const localOnlyLabel = labels.assistantMessageToolbarInspectorLocalOnlyLabel;
6415
- const accessibleLabel = `${primaryLabel} (${localOnlyLabel})`;
6416
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
6196
+ const accessibleLabel = `${primaryLabel} (local only)`;
6197
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarButton, {
6417
6198
  "data-testid": "copilot-inspector-button",
6418
6199
  title: accessibleLabel,
6419
- tooltip: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6420
- className: "cpk:flex cpk:flex-col cpk:gap-0.5",
6421
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: primaryLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6422
- className: "cpk:text-[10px] cpk:opacity-65",
6423
- children: localOnlyLabel
6424
- })]
6425
- }),
6200
+ className: (0, tailwind_merge.twMerge)("cpk:w-auto cpk:gap-1.5 cpk:px-2", className),
6201
+ tooltipClassName: "cpk:max-w-64 cpk:text-left cpk:leading-4",
6202
+ tooltip: "View this message in the Inspector to get more information. This button and the inspector only display during local development (localhost, dev env).",
6426
6203
  ...props,
6427
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {})
6204
+ children: [
6205
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {}),
6206
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6207
+ className: "cpk:font-medium",
6208
+ children: primaryLabel
6209
+ }),
6210
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6211
+ className: "cpk:text-xs cpk:text-muted-foreground",
6212
+ children: "(local only)"
6213
+ })
6214
+ ]
6428
6215
  });
6429
6216
  };
6430
- _CopilotChatAssistantMessage.SaveSnippetButton = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SaveSnippetIconButton, {
6431
- "data-testid": "copilot-save-snippet-button",
6432
- ...props
6433
- });
6434
6217
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
6435
6218
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6436
6219
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
@@ -6472,7 +6255,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6472
6255
  CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
6473
6256
  CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
6474
6257
  CopilotChatAssistantMessage.InspectorButton.displayName = "CopilotChatAssistantMessage.InspectorButton";
6475
- CopilotChatAssistantMessage.SaveSnippetButton.displayName = "CopilotChatAssistantMessage.SaveSnippetButton";
6476
6258
  CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
6477
6259
  CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
6478
6260
  CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
@@ -6843,8 +6625,6 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6843
6625
  const isLatest = messages?.[messages.length - 1]?.id === message.id;
6844
6626
  const isStreaming = !!(isRunning && isLatest);
6845
6627
  const hasContent = !!(message.content && message.content.length > 0);
6846
- const { isLocalInspectorEnabled, saveEventSnippet } = useCopilotKitInspector();
6847
- const chatConfiguration = useCopilotChatConfiguration();
6848
6628
  const startTimeRef = (0, react.useRef)(null);
6849
6629
  const [elapsed, setElapsed] = (0, react.useState)(0);
6850
6630
  (0, react.useEffect)(() => {
@@ -6904,16 +6684,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6904
6684
  className: (0, tailwind_merge.twMerge)("cpk:my-1", className),
6905
6685
  "data-message-id": message.id,
6906
6686
  ...props,
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]
6687
+ children: [boundHeader, boundToggle]
6917
6688
  });
6918
6689
  }
6919
6690
  (function(_CopilotChatReasoningMessage) {
@@ -7432,33 +7203,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
7432
7203
  /**
7433
7204
  * Memoized wrapper for activity messages to prevent re-renders when other messages change.
7434
7205
  */
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
- }
7457
7206
  const MemoizedActivityMessage = react.default.memo(function MemoizedActivityMessage({ message, renderActivityMessage }) {
7458
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivitySnippetChrome, {
7459
- message,
7460
- children: renderActivityMessage(message)
7461
- });
7207
+ return renderActivityMessage(message);
7462
7208
  }, (prevProps, nextProps) => {
7463
7209
  if (prevProps.message.id !== nextProps.message.id) return false;
7464
7210
  if (prevProps.message.activityType !== nextProps.message.activityType) return false;