@copilotkit/react-core 1.70.3 → 1.71.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 (60) hide show
  1. package/dist/{copilotkit-BU3OvveB.cjs → copilotkit-BkVEkUS0.cjs} +369 -154
  2. package/dist/copilotkit-BkVEkUS0.cjs.map +1 -0
  3. package/dist/{copilotkit-Bs98akp9.d.mts → copilotkit-ChjzWqn6.d.mts} +33 -8
  4. package/dist/copilotkit-ChjzWqn6.d.mts.map +1 -0
  5. package/dist/{copilotkit-Ap_yisA5.mjs → copilotkit-D5BTo0YG.mjs} +368 -153
  6. package/dist/copilotkit-D5BTo0YG.mjs.map +1 -0
  7. package/dist/{copilotkit-X2eGbOwf.d.cts → copilotkit-DCIXZawe.d.cts} +33 -8
  8. package/dist/copilotkit-DCIXZawe.d.cts.map +1 -0
  9. package/dist/index.cjs +3 -3
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.mjs +4 -4
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/index.umd.js +180 -139
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/v2/context.cjs +4 -0
  18. package/dist/v2/context.cjs.map +1 -1
  19. package/dist/v2/context.d.cts +3 -1
  20. package/dist/v2/context.d.cts.map +1 -1
  21. package/dist/v2/context.d.mts +3 -1
  22. package/dist/v2/context.d.mts.map +1 -1
  23. package/dist/v2/context.mjs +3 -1
  24. package/dist/v2/context.mjs.map +1 -1
  25. package/dist/v2/headless.cjs +20 -5
  26. package/dist/v2/headless.cjs.map +1 -1
  27. package/dist/v2/headless.d.cts +9 -4
  28. package/dist/v2/headless.d.cts.map +1 -1
  29. package/dist/v2/headless.d.mts +9 -4
  30. package/dist/v2/headless.d.mts.map +1 -1
  31. package/dist/v2/headless.mjs +21 -6
  32. package/dist/v2/headless.mjs.map +1 -1
  33. package/dist/v2/index.cjs +1 -1
  34. package/dist/v2/index.css +1 -1
  35. package/dist/v2/index.d.cts +1 -1
  36. package/dist/v2/index.d.mts +1 -1
  37. package/dist/v2/index.mjs +1 -1
  38. package/dist/v2/index.umd.js +495 -278
  39. package/dist/v2/index.umd.js.map +1 -1
  40. package/package.json +8 -9
  41. package/dist/copilotkit-Ap_yisA5.mjs.map +0 -1
  42. package/dist/copilotkit-BU3OvveB.cjs.map +0 -1
  43. package/dist/copilotkit-Bs98akp9.d.mts.map +0 -1
  44. package/dist/copilotkit-X2eGbOwf.d.cts.map +0 -1
  45. package/skills/react-core/SKILL.md +0 -110
  46. package/skills/react-core/references/agent-access.md +0 -355
  47. package/skills/react-core/references/attachments.md +0 -311
  48. package/skills/react-core/references/capabilities.md +0 -138
  49. package/skills/react-core/references/chat-components.md +0 -229
  50. package/skills/react-core/references/client-side-tools.md +0 -358
  51. package/skills/react-core/references/custom-message-renderers.md +0 -223
  52. package/skills/react-core/references/debug-mode.md +0 -140
  53. package/skills/react-core/references/human-in-the-loop.md +0 -312
  54. package/skills/react-core/references/provider-setup.md +0 -358
  55. package/skills/react-core/references/rendering-activity-messages.md +0 -201
  56. package/skills/react-core/references/rendering-tool-calls.md +0 -319
  57. package/skills/react-core/references/suggestions.md +0 -211
  58. package/skills/react-core/references/switching-agents-recipes.md +0 -161
  59. package/skills/react-core/references/switching-agents.md +0 -240
  60. package/skills/react-core/references/threads.md +0 -289
@@ -32,6 +32,7 @@ let _ag_ui_client = require("@ag-ui/client");
32
32
  let tailwind_merge = require("tailwind-merge");
33
33
  let lucide_react = require("lucide-react");
34
34
  let _copilotkit_shared = require("@copilotkit/shared");
35
+ let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
35
36
  let react_jsx_runtime = require("react/jsx-runtime");
36
37
  let _radix_ui_react_slot = require("@radix-ui/react-slot");
37
38
  let class_variance_authority = require("class-variance-authority");
@@ -41,7 +42,6 @@ _radix_ui_react_tooltip = __toESM(_radix_ui_react_tooltip);
41
42
  let _radix_ui_react_dropdown_menu = require("@radix-ui/react-dropdown-menu");
42
43
  _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
43
44
  let streamdown = require("streamdown");
44
- let _copilotkit_react_core_v2_context = require("@copilotkit/react-core/v2/context");
45
45
  let zod = require("zod");
46
46
  let _copilotkit_a2ui_renderer = require("@copilotkit/a2ui-renderer");
47
47
  let zod_to_json_schema = require("zod-to-json-schema");
@@ -106,7 +106,12 @@ const CopilotChatDefaultLabels = {
106
106
  assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
107
107
  assistantMessageToolbarCopyMessageLabel: "Copy",
108
108
  assistantMessageToolbarInspectorLabel: "View in Inspector",
109
- assistantMessageToolbarInspectorLocalOnlyLabel: "Development Only",
109
+ assistantMessageToolbarInspectorDescription: "Open this message in the Inspector",
110
+ assistantMessageToolbarInspectorLocalOnlyLabel: "Local only",
111
+ assistantMessageToolbarInspectorLocalOnlyDescription: "Only visible on localhost or loopback hosts in development. Never shown in production.",
112
+ assistantMessageToolbarInspectorTitle: "CopilotKit Inspector",
113
+ assistantMessageToolbarInspectorHideLabel: "Hide this icon",
114
+ assistantMessageToolbarInspectorHideDescription: "Until you reload this page",
110
115
  assistantMessageToolbarThumbsUpLabel: "Good response",
111
116
  assistantMessageToolbarThumbsDownLabel: "Bad response",
112
117
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -147,7 +152,8 @@ const CopilotChatConfigurationProvider = ({ children, labels, agentId, threadId,
147
152
  ...parentConfig?.labels,
148
153
  ...stableLabels
149
154
  }), [stableLabels, parentConfig?.labels]);
150
- const resolvedAgentId = agentId ?? parentConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
155
+ const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
156
+ const resolvedAgentId = agentId ?? parentConfig?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
151
157
  const threadIdPropIsAuthoritative = threadId !== void 0 && hasExplicitThreadId !== false;
152
158
  const isThreadIdControlled = threadIdPropIsAuthoritative;
153
159
  const [activeThreadOverride, setActiveThreadOverride] = (0, react.useState)(null);
@@ -357,9 +363,9 @@ ControlledModalOpenScope.displayName = "ControlledModalOpenScope";
357
363
 
358
364
  //#endregion
359
365
  //#region src/v2/lib/utils.ts
360
- const twMerge$9 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
366
+ const twMerge$10 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
361
367
  function cn(...inputs) {
362
- return twMerge$9((0, clsx.clsx)(inputs));
368
+ return twMerge$10((0, clsx.clsx)(inputs));
363
369
  }
364
370
 
365
371
  //#endregion
@@ -504,6 +510,14 @@ function DropdownMenuItem({ className, inset, variant = "default", ...props }) {
504
510
  ...props
505
511
  });
506
512
  }
513
+ function DropdownMenuLabel({ className, inset, ...props }) {
514
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Label, {
515
+ "data-slot": "dropdown-menu-label",
516
+ "data-inset": inset,
517
+ className: cn("cpk:px-2 cpk:py-1.5 cpk:text-sm cpk:font-medium cpk:data-[inset]:pl-8", className),
518
+ ...props
519
+ });
520
+ }
507
521
  function DropdownMenuSeparator({ className, ...props }) {
508
522
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Separator, {
509
523
  "data-slot": "dropdown-menu-separator",
@@ -1620,21 +1634,28 @@ function useRenderToolCall() {
1620
1634
 
1621
1635
  //#endregion
1622
1636
  //#region src/v2/components/CopilotKitInspector.tsx
1623
- const CopilotKitInspector = ({ core, openRequest }) => {
1637
+ const CopilotKitInspector = ({ core, openRequest, onVisibilityChange }) => {
1624
1638
  const mountRef = react.useRef(null);
1625
1639
  const inspectorRef = react.useRef(null);
1626
1640
  const latestCoreRef = react.useRef(core ?? null);
1627
1641
  const latestOpenRequestRef = react.useRef(openRequest);
1642
+ const visibilityCallbackRef = react.useRef(onVisibilityChange);
1643
+ visibilityCallbackRef.current = onVisibilityChange;
1628
1644
  latestCoreRef.current = core ?? null;
1629
1645
  latestOpenRequestRef.current = openRequest;
1630
1646
  react.useEffect(() => {
1631
1647
  let mounted = true;
1632
1648
  let inspector = null;
1649
+ const handleVisibilityChange = (event) => {
1650
+ const visible = event.detail?.visible;
1651
+ visibilityCallbackRef.current?.(visible === true);
1652
+ };
1633
1653
  import("@copilotkit/web-inspector").then((mod) => {
1634
1654
  if (!mounted || !mountRef.current) return;
1635
1655
  mod.defineWebInspector?.();
1636
1656
  inspector = mountRef.current.ownerDocument.createElement(mod.WEB_INSPECTOR_TAG);
1637
1657
  mod.configureWebInspectorElement(inspector, latestCoreRef.current);
1658
+ inspector.addEventListener("cpk-inspector-visibility-change", handleVisibilityChange);
1638
1659
  mountRef.current.appendChild(inspector);
1639
1660
  inspectorRef.current = inspector;
1640
1661
  const request = latestOpenRequestRef.current;
@@ -1644,7 +1665,9 @@ const CopilotKitInspector = ({ core, openRequest }) => {
1644
1665
  });
1645
1666
  return () => {
1646
1667
  mounted = false;
1668
+ inspector?.removeEventListener("cpk-inspector-visibility-change", handleVisibilityChange);
1647
1669
  inspector?.remove();
1670
+ visibilityCallbackRef.current?.(false);
1648
1671
  if (inspectorRef.current === inspector) inspectorRef.current = null;
1649
1672
  };
1650
1673
  }, []);
@@ -3673,14 +3696,19 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3673
3696
  }, [value, warningMessage]);
3674
3697
  return value;
3675
3698
  }
3676
- const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, enableInspector, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug }) => {
3699
+ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY_HEADERS, credentials, publicApiKey, publicLicenseKey, licenseToken, properties = EMPTY_PROPERTIES, agents__unsafe_dev_only: agents = EMPTY_AGENTS, selfManagedAgents = EMPTY_AGENTS, renderToolCalls, renderActivityMessages, renderCustomMessages, frontendTools, humanInTheLoop, openGenerativeUI, enableInspector, agentId, useSingleEndpoint, onError, a2ui, defaultThrottleMs, debug }) => {
3677
3700
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
3701
+ const [inspectorVisible, setInspectorVisible] = (0, react.useState)(false);
3678
3702
  (0, react.useEffect)(() => {
3679
3703
  setShouldRenderInspector((0, _copilotkit_shared.shouldEnableInspector)({
3680
3704
  enableInspector,
3681
3705
  isBrowser: true,
3682
3706
  isDevelopment: process.env.NODE_ENV === "development"
3683
- }));
3707
+ }) && [
3708
+ "localhost",
3709
+ "127.0.0.1",
3710
+ "[::1]"
3711
+ ].includes(window.location.hostname));
3684
3712
  }, [enableInspector]);
3685
3713
  const [inspectorOpenRequest, setInspectorOpenRequest] = (0, react.useState)(null);
3686
3714
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
@@ -3696,9 +3724,15 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3696
3724
  setInspectorOpenRequest({ ...request });
3697
3725
  }, []);
3698
3726
  const inspectorContextValue = (0, react.useMemo)(() => ({
3699
- isInspectorEnabled: shouldRenderInspector,
3727
+ providerEnableInspector: enableInspector,
3728
+ isInspectorEnabled: shouldRenderInspector && inspectorVisible,
3700
3729
  openInspector: requestInspectorOpen
3701
- }), [shouldRenderInspector, requestInspectorOpen]);
3730
+ }), [
3731
+ enableInspector,
3732
+ shouldRenderInspector,
3733
+ inspectorVisible,
3734
+ requestInspectorOpen
3735
+ ]);
3702
3736
  const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
3703
3737
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3704
3738
  const setFrom = (arr) => new Set(arr.map(key));
@@ -4095,9 +4129,13 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
4095
4129
  }),
4096
4130
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CopilotKitInspectorContextProvider, {
4097
4131
  value: inspectorContextValue,
4098
- children: [children, shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
4132
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_copilotkit_react_core_v2_context.CopilotKitAgentIdContext.Provider, {
4133
+ value: agentId,
4134
+ children
4135
+ }), shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
4099
4136
  core: copilotkit,
4100
- openRequest: inspectorOpenRequest
4137
+ openRequest: inspectorOpenRequest,
4138
+ onVisibilityChange: setInspectorVisible
4101
4139
  }) : null]
4102
4140
  }),
4103
4141
  runtimeLicenseWarningStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "no_license" }),
@@ -4679,7 +4717,8 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
4679
4717
  if (runtimeAgentId != null && threadId == null) throw new Error(`useAgent: \`runtimeAgentId\` requires \`threadId\`. A proxied agent exists to scope a thread to a private instance; without a threadId it behaves like the shared agent while adding a registration and a local agentId to keep unique. Either pass the thread, e.g. useAgent({ agentId: "${agentId ?? "chat-1"}", runtimeAgentId: "${runtimeAgentId}", threadId }), or bind to the agent directly with useAgent({ agentId: "${runtimeAgentId}" }).`);
4680
4718
  if (runtimeAgentId != null && agentId == null) throw new Error(`useAgent: \`runtimeAgentId\` requires an explicit \`agentId\`. The proxied agent is registered under \`agentId\`, and the usual fallbacks (chat configuration, then "${_copilotkit_shared.DEFAULT_AGENT_ID}") name agents that already exist — registering over one throws or shadows it. Pick a local id for this hook, e.g. useAgent({ agentId: "chat-1", runtimeAgentId: "${runtimeAgentId}", threadId }).`);
4681
4719
  const chatConfig = useCopilotChatConfiguration();
4682
- const resolvedAgentId = agentId ?? chatConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
4720
+ const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
4721
+ const resolvedAgentId = agentId ?? chatConfig?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
4683
4722
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
4684
4723
  const providerThrottleMs = copilotkit.defaultThrottleMs;
4685
4724
  const [, forceUpdate] = (0, react.useReducer)((x) => x + 1, 0);
@@ -4907,7 +4946,12 @@ function useAgentContext(context) {
4907
4946
  function useSuggestions({ agentId } = {}) {
4908
4947
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
4909
4948
  const config = useCopilotChatConfiguration();
4910
- const resolvedAgentId = (0, react.useMemo)(() => agentId ?? config?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
4949
+ const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
4950
+ const resolvedAgentId = (0, react.useMemo)(() => agentId ?? config?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID, [
4951
+ agentId,
4952
+ config?.agentId,
4953
+ providerAgentId
4954
+ ]);
4911
4955
  const [suggestions, setSuggestions] = (0, react.useState)(() => {
4912
4956
  return copilotkit.getSuggestions(resolvedAgentId).suggestions;
4913
4957
  });
@@ -5161,7 +5205,10 @@ function toLegacyEvent(pending) {
5161
5205
  */
5162
5206
  function useInterrupt(config) {
5163
5207
  const { copilotkit } = (0, _copilotkit_react_core_v2_context.useCopilotKit)();
5164
- const { agent } = useAgent({ agentId: config.agentId });
5208
+ const { agent } = useAgent({
5209
+ agentId: config.agentId,
5210
+ updates: []
5211
+ });
5165
5212
  const [pending, setPending] = (0, react.useState)(null);
5166
5213
  const pendingRef = (0, react.useRef)(pending);
5167
5214
  pendingRef.current = pending;
@@ -6211,6 +6258,289 @@ function CopilotChatToolCallsView({ message, messages = [] }) {
6211
6258
  }) });
6212
6259
  }
6213
6260
 
6261
+ //#endregion
6262
+ //#region src/v2/components/chat/CopilotChatInspectorButton.tsx
6263
+ let shortcutsHidden = false;
6264
+ const listeners = /* @__PURE__ */ new Set();
6265
+ const subscribe = (listener) => {
6266
+ listeners.add(listener);
6267
+ return () => {
6268
+ listeners.delete(listener);
6269
+ };
6270
+ };
6271
+ const getSnapshot = () => shortcutsHidden;
6272
+ const getServerSnapshot = () => false;
6273
+ function useInspectorShortcutsHidden() {
6274
+ return (0, react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
6275
+ }
6276
+ function hideShortcuts() {
6277
+ shortcutsHidden = true;
6278
+ listeners.forEach((listener) => listener());
6279
+ }
6280
+ function InspectorKiteIcon({ className, ...props }) {
6281
+ const id = (0, react.useId)();
6282
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
6283
+ ...props,
6284
+ "aria-hidden": "true",
6285
+ className: (0, tailwind_merge.twMerge)("cpk:size-4", className),
6286
+ viewBox: "4.57 3.36 17.8 17.8",
6287
+ fill: "none",
6288
+ children: [
6289
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6290
+ d: "M6.36084 10.9855C8.34277 8.393 9.98843 5.82939 10.6204 3.75914C10.6382 3.70281 10.7043 3.67888 10.7534 3.7114C12.9536 5.16894 16.9635 6.12833 20.5086 6.15085C20.5703 6.15124 20.6124 6.2114 20.5895 6.26829C19.4109 9.25938 17.9705 14.6189 17.9148 20.7392C17.9148 20.8301 17.7873 20.8627 17.7419 20.7837C15.7236 17.2522 9.26021 12.2898 6.39414 11.1186C6.34112 11.0968 6.32556 11.0313 6.36084 10.9855Z",
6291
+ fill: `url(#${id}-paint0_linear)`
6292
+ }),
6293
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6294
+ d: "M13.0475 9.39974C9.95016 10.3806 7.11935 10.9259 6.44331 11.0498C6.40027 11.0577 6.39115 11.1172 6.43152 11.134C9.3203 12.3347 15.7516 17.2826 17.7511 20.7998C17.7551 20.8075 17.7647 20.8103 17.7728 20.8068C17.7809 20.803 17.7853 20.793 17.7819 20.7844L13.0475 9.39974Z",
6295
+ fill: `url(#${id}-paint1_linear)`
6296
+ }),
6297
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6298
+ d: "M10.762 3.705C13.4137 5.15161 16.4787 5.80132 20.545 6.14367C20.5703 6.14585 20.5787 6.18008 20.5557 6.19197C20.0359 6.45923 17.0574 7.97512 14.8455 8.78701C14.2524 9.00453 13.6564 9.20632 13.0692 9.39249C13.0562 9.39656 13.0419 9.39015 13.0369 9.37774L10.7005 3.75979C10.6849 3.72196 10.7257 3.68538 10.762 3.705Z",
6299
+ fill: `url(#${id}-paint2_linear)`
6300
+ }),
6301
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6302
+ d: "M10.7145 3.79041L17.8305 20.7659",
6303
+ stroke: "#513C9F",
6304
+ strokeWidth: "0.17284",
6305
+ strokeLinecap: "round"
6306
+ }),
6307
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6308
+ d: "M6.44531 11.0476C6.44531 11.0476 10.375 10.3422 14.0686 9.06804C17.7623 7.7939 20.5122 6.23373 20.5122 6.23373",
6309
+ stroke: "#513C9F",
6310
+ strokeWidth: "0.17284",
6311
+ strokeLinecap: "round"
6312
+ }),
6313
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6314
+ d: "M11.6914 5.93518L9.05534 14.7068M9.05534 14.7068H15.3203M9.05534 14.7068L0.15625 26.3646",
6315
+ stroke: "#ABABAB",
6316
+ strokeWidth: "0.302474",
6317
+ strokeLinecap: "round"
6318
+ }),
6319
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6320
+ d: "M6.02539 23.9646L4.85806 24.1287C5.46272 25.7287 6.70381 26.4276 8.18528 26.4276C11.8147 26.4276 10.707 22.3227 12.8103 22.3227C14.3358 22.3227 13.7155 25.6498 16.9992 25.6498C19.0029 25.6498 19.2028 23.631 18.8607 22.7625C18.8589 22.7572 18.8568 22.7524 18.8538 22.7476L18.3166 21.9253C18.2817 21.8706 18.1968 21.8912 18.1907 21.9562L18.0908 22.9529C18.0838 23.0222 18.0857 23.0913 18.0936 23.1605C18.1764 23.8491 18.2291 25.5202 16.9992 25.5202C15.7015 25.5202 15.3895 22.2362 12.8103 22.2362C9.78393 22.2362 10.1726 26.298 8.31487 26.298C7.08938 26.298 6.15447 24.9153 6.02539 23.9646Z",
6321
+ fill: `url(#${id}-paint3_linear)`
6322
+ }),
6323
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
6324
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6325
+ id: `${id}-paint0_linear`,
6326
+ x1: "15.5372",
6327
+ y1: "5.0278",
6328
+ x2: "12.0802",
6329
+ y2: "14.534",
6330
+ gradientUnits: "userSpaceOnUse",
6331
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#6430AB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6332
+ offset: "1",
6333
+ stopColor: "#AA89D8"
6334
+ })]
6335
+ }),
6336
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6337
+ id: `${id}-paint1_linear`,
6338
+ x1: "12.8583",
6339
+ y1: "10.3858",
6340
+ x2: "8.40764",
6341
+ y2: "18.9846",
6342
+ gradientUnits: "userSpaceOnUse",
6343
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#005DBB" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6344
+ offset: "1",
6345
+ stopColor: "#3D92E8"
6346
+ })]
6347
+ }),
6348
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6349
+ id: `${id}-paint2_linear`,
6350
+ x1: "14.8452",
6351
+ y1: "5.02774",
6352
+ x2: "13.5047",
6353
+ y2: "9.21911",
6354
+ gradientUnits: "userSpaceOnUse",
6355
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#1B70C4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6356
+ offset: "1",
6357
+ stopColor: "#54A4F2"
6358
+ })]
6359
+ }),
6360
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6361
+ id: `${id}-paint3_linear`,
6362
+ x1: "4.85806",
6363
+ y1: "24.2455",
6364
+ x2: "18.9963",
6365
+ y2: "24.2455",
6366
+ gradientUnits: "userSpaceOnUse",
6367
+ children: [
6368
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { stopColor: "#4497EA" }),
6369
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6370
+ offset: "0.254755",
6371
+ stopColor: "#1463B2"
6372
+ }),
6373
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6374
+ offset: "0.498725",
6375
+ stopColor: "#0A437D"
6376
+ }),
6377
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6378
+ offset: "0.666667",
6379
+ stopColor: "#2476C8"
6380
+ }),
6381
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6382
+ offset: "0.972542",
6383
+ stopColor: "#0C549A"
6384
+ })
6385
+ ]
6386
+ })
6387
+ ] })
6388
+ ]
6389
+ });
6390
+ }
6391
+ function CopilotChatInspectorButton({ title, className, onClick, onPointerDown, onPointerEnter, onPointerLeave, onKeyDown, disabled, ...props }) {
6392
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6393
+ const { isInspectorEnabled } = useCopilotKitInspector();
6394
+ const hidden = useInspectorShortcutsHidden();
6395
+ const [open, setOpen] = (0, react.useState)(false);
6396
+ const [dark, setDark] = (0, react.useState)(false);
6397
+ const trigger = (0, react.useRef)(null);
6398
+ const closeTimer = (0, react.useRef)(null);
6399
+ const openedByHover = (0, react.useRef)(false);
6400
+ const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
6401
+ const cancelClose = () => {
6402
+ if (closeTimer.current !== null) clearTimeout(closeTimer.current);
6403
+ closeTimer.current = null;
6404
+ };
6405
+ (0, react.useEffect)(() => cancelClose, []);
6406
+ const changeOpen = (next) => {
6407
+ cancelClose();
6408
+ if (next) setDark(!!trigger.current?.closest(".dark"));
6409
+ setOpen(next);
6410
+ };
6411
+ const scheduleClose = () => {
6412
+ cancelClose();
6413
+ closeTimer.current = setTimeout(() => {
6414
+ if (openedByHover.current) setOpen(false);
6415
+ }, 180);
6416
+ };
6417
+ if (!isInspectorEnabled || hidden) return null;
6418
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenu, {
6419
+ open,
6420
+ onOpenChange: changeOpen,
6421
+ modal: false,
6422
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuTrigger, {
6423
+ asChild: true,
6424
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
6425
+ ...props,
6426
+ ref: trigger,
6427
+ type: "button",
6428
+ disabled,
6429
+ variant: "assistantMessageToolbarButton",
6430
+ size: "icon",
6431
+ "data-testid": "copilot-inspector-button",
6432
+ "aria-label": `${labels.assistantMessageToolbarInspectorTitle} (${labels.assistantMessageToolbarInspectorLocalOnlyLabel.toLowerCase()})`,
6433
+ className: (0, tailwind_merge.twMerge)("cpk:size-8 cpk:p-1.5", className),
6434
+ onPointerEnter: (event) => {
6435
+ onPointerEnter?.(event);
6436
+ if (!disabled && event.pointerType !== "touch") {
6437
+ openedByHover.current = true;
6438
+ changeOpen(true);
6439
+ }
6440
+ },
6441
+ onPointerLeave: (event) => {
6442
+ onPointerLeave?.(event);
6443
+ scheduleClose();
6444
+ },
6445
+ onPointerDown: (event) => {
6446
+ onPointerDown?.(event);
6447
+ event.preventDefault();
6448
+ },
6449
+ onClick: (event) => {
6450
+ changeOpen(false);
6451
+ onClick?.(event);
6452
+ },
6453
+ onKeyDown: (event) => {
6454
+ openedByHover.current = false;
6455
+ onKeyDown?.(event);
6456
+ if (!event.defaultPrevented && (event.key === "Enter" || event.key === " ")) {
6457
+ event.preventDefault();
6458
+ event.currentTarget.click();
6459
+ }
6460
+ },
6461
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Wrench, {
6462
+ "aria-hidden": "true",
6463
+ className: "cpk:size-4",
6464
+ "data-testid": "copilot-inspector-icon"
6465
+ })
6466
+ })
6467
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuContent, {
6468
+ align: "start",
6469
+ side: "top",
6470
+ sideOffset: 6,
6471
+ className: (0, tailwind_merge.twMerge)("cpk:w-64 cpk:p-1 cpk:text-sm", dark && "dark"),
6472
+ onPointerEnter: cancelClose,
6473
+ onPointerLeave: scheduleClose,
6474
+ onKeyDown: () => {
6475
+ openedByHover.current = false;
6476
+ },
6477
+ onOpenAutoFocus: (event) => {
6478
+ if (openedByHover.current) event.preventDefault();
6479
+ },
6480
+ onCloseAutoFocus: (event) => {
6481
+ if (openedByHover.current) event.preventDefault();
6482
+ },
6483
+ onFocusOutside: () => changeOpen(false),
6484
+ children: [
6485
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuLabel, {
6486
+ className: "cpk:flex cpk:items-center cpk:justify-between cpk:gap-3 cpk:px-2 cpk:py-2",
6487
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6488
+ className: "cpk:text-xs cpk:font-medium",
6489
+ children: labels.assistantMessageToolbarInspectorTitle
6490
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, {
6491
+ delayDuration: 1e3,
6492
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
6493
+ asChild: true,
6494
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6495
+ tabIndex: 0,
6496
+ className: "cpk:cursor-help cpk:rounded cpk:bg-muted cpk:px-1.5 cpk:py-0.5 cpk:text-[10px] cpk:font-normal cpk:text-muted-foreground",
6497
+ children: labels.assistantMessageToolbarInspectorLocalOnlyLabel
6498
+ })
6499
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
6500
+ side: "top",
6501
+ sideOffset: 6,
6502
+ className: (0, tailwind_merge.twMerge)("cpk:max-w-48 cpk:text-wrap", dark && "dark"),
6503
+ onPointerEnter: cancelClose,
6504
+ onPointerLeave: scheduleClose,
6505
+ children: labels.assistantMessageToolbarInspectorLocalOnlyDescription
6506
+ })]
6507
+ })]
6508
+ }),
6509
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuSeparator, {}),
6510
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DropdownMenuItem, {
6511
+ asChild: true,
6512
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
6513
+ type: "button",
6514
+ onClick,
6515
+ className: "cpk:w-full cpk:cursor-pointer cpk:items-start cpk:text-left",
6516
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorKiteIcon, { className: "cpk:mt-0.5" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6517
+ className: "cpk:block",
6518
+ children: primaryLabel
6519
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6520
+ className: "cpk:block cpk:text-xs cpk:text-muted-foreground",
6521
+ children: labels.assistantMessageToolbarInspectorDescription
6522
+ })] })]
6523
+ })
6524
+ }),
6525
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(DropdownMenuItem, {
6526
+ onSelect: hideShortcuts,
6527
+ className: "cpk:cursor-pointer cpk:items-start",
6528
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.EyeOff, {
6529
+ "aria-hidden": "true",
6530
+ className: "cpk:mt-0.5"
6531
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6532
+ className: "cpk:block",
6533
+ children: labels.assistantMessageToolbarInspectorHideLabel
6534
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6535
+ className: "cpk:block cpk:text-xs cpk:text-muted-foreground",
6536
+ children: labels.assistantMessageToolbarInspectorHideDescription
6537
+ })] })]
6538
+ })
6539
+ ]
6540
+ })]
6541
+ });
6542
+ }
6543
+
6214
6544
  //#endregion
6215
6545
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
6216
6546
  /**
@@ -6231,30 +6561,32 @@ function BoundInspectorButton({ inspectorButton, messageId, openInspector, ...pr
6231
6561
  function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
6232
6562
  useKatexStyles();
6233
6563
  const { isInspectorEnabled, openInspector } = useCopilotKitInspector();
6564
+ const shortcutsHidden = useInspectorShortcutsHidden();
6565
+ const showInspectorShortcut = isInspectorEnabled && !shortcutsHidden;
6234
6566
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
6235
6567
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
6236
6568
  if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
6237
6569
  return false;
6238
6570
  } });
6239
6571
  const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
6240
- const boundInspectorButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundInspectorButton, {
6572
+ const boundInspectorButton = showInspectorShortcut ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoundInspectorButton, {
6241
6573
  inspectorButton,
6242
6574
  messageId: message.id,
6243
6575
  openInspector
6244
- });
6576
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
6245
6577
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
6246
6578
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
6247
6579
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
6248
6580
  const boundToolbar = renderSlot(toolbar, CopilotChatAssistantMessage.Toolbar, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6249
- className: "cpk:flex cpk:items-center cpk:gap-1",
6581
+ className: "cpk:flex cpk:w-full cpk:items-center cpk:gap-1",
6250
6582
  children: [
6251
6583
  boundCopyButton,
6252
- isInspectorEnabled && boundInspectorButton,
6253
6584
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
6254
6585
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
6255
6586
  (onReadAloud || readAloudButton) && boundReadAloudButton,
6256
6587
  (onRegenerate || regenerateButton) && boundRegenerateButton,
6257
- additionalToolbarItems
6588
+ additionalToolbarItems,
6589
+ showInspectorShortcut && boundInspectorButton
6258
6590
  ]
6259
6591
  }) });
6260
6592
  const boundToolCallsView = renderSlot(toolCallsView, CopilotChatToolCallsView, {
@@ -6263,7 +6595,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
6263
6595
  });
6264
6596
  const hasContent = !!(message.content && message.content.trim().length > 0);
6265
6597
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
6266
- const shouldShowToolbar = toolbarVisible && (hasContent || isInspectorEnabled) && !(isRunning && isLatestAssistantMessage);
6598
+ const shouldShowToolbar = toolbarVisible && (hasContent || showInspectorShortcut) && !(isRunning && isLatestAssistantMessage);
6267
6599
  if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
6268
6600
  "data-copilotkit": true,
6269
6601
  style: { display: "contents" },
@@ -6304,110 +6636,6 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
6304
6636
  ]
6305
6637
  });
6306
6638
  }
6307
- function CopilotKitColoredIcon() {
6308
- const gradientId = (0, react.useId)().replace(/:/g, "");
6309
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
6310
- "aria-hidden": "true",
6311
- className: "cpk:size-5",
6312
- "data-testid": "copilot-inspector-icon",
6313
- viewBox: "0 0 24 24",
6314
- children: [
6315
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6316
- d: "M8.162 7.758c2.093-2.738 3.831-5.445 4.498-7.63a.093.093 0 01.14-.051c2.324 1.539 6.558 2.552 10.301 2.576a.09.09 0 01.085.124c-1.243 3.158-2.765 8.817-2.823 15.28-.001.095-.135.13-.183.046-2.131-3.729-8.955-8.968-11.982-10.205a.09.09 0 01-.036-.14z",
6317
- fill: `url(#${gradientId}-purple)`
6318
- }),
6319
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6320
- d: "M15.223 6.083A61.492 61.492 0 018.25 7.827c-.045.008-.055.071-.012.089 3.05 1.267 9.84 6.492 11.952 10.206a.017.017 0 00.022.007.018.018 0 00.01-.024l-4.999-12.02z",
6321
- fill: `url(#${gradientId}-blue)`
6322
- }),
6323
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6324
- d: "M12.81.07c2.8 1.528 6.037 2.214 10.33 2.575.028.002.036.039.012.051-.55.282-3.695 1.883-6.03 2.74-.626.23-1.256.443-1.876.64a.028.028 0 01-.033-.016L12.746.128c-.017-.04.027-.078.065-.058z",
6325
- fill: `url(#${gradientId}-light-blue)`
6326
- }),
6327
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6328
- className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
6329
- d: "M12.725.075c.046-.019.1.003.119.05l7.514 17.923a.091.091 0 01-.148.1l-.02-.03L12.675.195a.091.091 0 01.049-.12z"
6330
- }),
6331
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6332
- className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
6333
- d: "M23.06 2.66c.044-.025.1-.01.125.034.025.044.009.1-.035.124v.001l-.008.004-.025.015-.1.054a41.384 41.384 0 01-1.811.92A47.05 47.05 0 0116.33 5.82c-1.954.674-3.97 1.197-5.497 1.552a66.27 66.27 0 01-2.38.507l-.138.026-.036.007h-.01l-.002.002a.091.091 0 11-.033-.18l.016.09-.015-.09h.002l.01-.002.035-.007.137-.025a66.16 66.16 0 002.373-.506c1.524-.354 3.533-.876 5.479-1.547a46.857 46.857 0 006.276-2.709c.166-.087.295-.156.381-.204l.099-.054.024-.014.008-.004z"
6334
- }),
6335
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6336
- className: "cpk:fill-[#ABABAB] cpk:dark:fill-[#D4D4D4]",
6337
- d: "M13.838 2.272a.16.16 0 01.107.2l-2.72 9.055h6.4l.061.013a.16.16 0 010 .295l-.061.013h-6.541L.679 24.099l-.05.04a.16.16 0 01-.194-.245l10.43-12.285 2.773-9.23a.16.16 0 01.2-.107z"
6338
- }),
6339
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6340
- d: "M7.809 21.461l-1.232.173c.638 1.69 1.949 2.427 3.514 2.427 3.831 0 2.661-4.334 4.883-4.334 1.61 0 .956 3.513 4.423 3.513 2.116 0 2.326-2.131 1.966-3.048l-.008-.016-.567-.868c-.037-.058-.127-.036-.133.032l-.106 1.053a1.01 1.01 0 00.003.219c.088.727.144 2.491-1.155 2.491-1.37 0-1.7-3.467-4.423-3.467-3.196 0-2.785 4.289-4.747 4.289-1.294 0-2.28-1.46-2.418-2.464z",
6341
- fill: `url(#${gradientId}-tail)`
6342
- }),
6343
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
6344
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6345
- gradientUnits: "userSpaceOnUse",
6346
- id: `${gradientId}-purple`,
6347
- x1: "17.852",
6348
- x2: "14.202",
6349
- y1: "1.467",
6350
- y2: "11.504",
6351
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#6430AB] cpk:dark:[stop-color:#B792F0]" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6352
- className: "cpk:[stop-color:#AA89D8] cpk:dark:[stop-color:#D3BDF7]",
6353
- offset: "1"
6354
- })]
6355
- }),
6356
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6357
- gradientUnits: "userSpaceOnUse",
6358
- id: `${gradientId}-blue`,
6359
- x1: "15.024",
6360
- x2: "10.324",
6361
- y1: "7.125",
6362
- y2: "16.204",
6363
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#005DBB] cpk:dark:[stop-color:#4D9FEF]" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6364
- className: "cpk:[stop-color:#3D92E8] cpk:dark:[stop-color:#84C0FA]",
6365
- offset: "1"
6366
- })]
6367
- }),
6368
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6369
- gradientUnits: "userSpaceOnUse",
6370
- id: `${gradientId}-light-blue`,
6371
- x1: "17.122",
6372
- x2: "15.707",
6373
- y1: "1.467",
6374
- y2: "5.892",
6375
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#1B70C4] cpk:dark:[stop-color:#61ACF2]" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6376
- className: "cpk:[stop-color:#54A4F2] cpk:dark:[stop-color:#9ACDFF]",
6377
- offset: "1"
6378
- })]
6379
- }),
6380
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6381
- gradientUnits: "userSpaceOnUse",
6382
- id: `${gradientId}-tail`,
6383
- x1: "6.577",
6384
- x2: "21.506",
6385
- y1: "21.758",
6386
- y2: "21.758",
6387
- children: [
6388
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#4497EA] cpk:dark:[stop-color:#79BCF5]" }),
6389
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6390
- className: "cpk:[stop-color:#1463B2] cpk:dark:[stop-color:#4594D8]",
6391
- offset: ".255"
6392
- }),
6393
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6394
- className: "cpk:[stop-color:#0A437D] cpk:dark:[stop-color:#347CB7]",
6395
- offset: ".499"
6396
- }),
6397
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6398
- className: "cpk:[stop-color:#2476C8] cpk:dark:[stop-color:#58A4E5]",
6399
- offset: ".667"
6400
- }),
6401
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6402
- className: "cpk:[stop-color:#0C549A] cpk:dark:[stop-color:#3C87C7]",
6403
- offset: ".973"
6404
- })
6405
- ]
6406
- })
6407
- ] })
6408
- ]
6409
- });
6410
- }
6411
6639
  (function(_CopilotChatAssistantMessage) {
6412
6640
  _CopilotChatAssistantMessage.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
6413
6641
  className,
@@ -6465,30 +6693,7 @@ function CopilotKitColoredIcon() {
6465
6693
  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]" })
6466
6694
  });
6467
6695
  };
6468
- _CopilotChatAssistantMessage.InspectorButton = ({ title, className, ...props }) => {
6469
- const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6470
- const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
6471
- const accessibleLabel = `${primaryLabel} (local only)`;
6472
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ToolbarButton, {
6473
- "data-testid": "copilot-inspector-button",
6474
- title: accessibleLabel,
6475
- className: (0, tailwind_merge.twMerge)("cpk:w-auto cpk:gap-1.5 cpk:px-2", className),
6476
- tooltipClassName: "cpk:max-w-64 cpk:text-left cpk:leading-4",
6477
- tooltip: "View this message in the Inspector to get more information. This button and the inspector only display during local development (localhost, dev env).",
6478
- ...props,
6479
- children: [
6480
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {}),
6481
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6482
- className: "cpk:font-medium",
6483
- children: primaryLabel
6484
- }),
6485
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6486
- className: "cpk:text-xs cpk:text-muted-foreground",
6487
- children: "(local only)"
6488
- })
6489
- ]
6490
- });
6491
- };
6696
+ _CopilotChatAssistantMessage.InspectorButton = CopilotChatInspectorButton;
6492
6697
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
6493
6698
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6494
6699
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
@@ -8738,9 +8943,15 @@ function useInspectorThreadOverride(args) {
8738
8943
 
8739
8944
  //#endregion
8740
8945
  //#region src/v2/components/chat/CopilotChat.tsx
8741
- function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
8946
+ function CopilotChat({ agentId, threadId, labels, inspectorTools, chatView, isModalDefaultOpen, attachments: attachmentsConfig, onError, throttleMs, ...props }) {
8742
8947
  const existingConfig = useCopilotChatConfiguration();
8743
- const resolvedAgentId = agentId ?? existingConfig?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
8948
+ const inspector = useCopilotKitInspector();
8949
+ const inspectorContextValue = (0, react.useMemo)(() => ({
8950
+ ...inspector,
8951
+ isInspectorEnabled: inspector.isInspectorEnabled && (inspector.providerEnableInspector ?? inspectorTools ?? true)
8952
+ }), [inspector, inspectorTools]);
8953
+ const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
8954
+ const resolvedAgentId = agentId ?? existingConfig?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
8744
8955
  const providedThreadId = threadId ?? existingConfig?.threadId;
8745
8956
  const baseThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8746
8957
  const baseHasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
@@ -9313,7 +9524,10 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
9313
9524
  }),
9314
9525
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LastUserMessageContext.Provider, {
9315
9526
  value: lastUserMessageState,
9316
- children: RenderedChatView
9527
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspectorContextProvider, {
9528
+ value: inspectorContextValue,
9529
+ children: RenderedChatView
9530
+ })
9317
9531
  })
9318
9532
  ]
9319
9533
  })
@@ -10021,7 +10235,8 @@ function CopilotThreadsDrawer({ agentId, onThreadSelect, onNewThread, onLicensed
10021
10235
  const featureLicensed = checkFeature("threads");
10022
10236
  const licensed = licensePresent && featureLicensed;
10023
10237
  const licensePending = status === null;
10024
- const resolvedAgentId = agentId ?? configuration?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
10238
+ const providerAgentId = (0, _copilotkit_react_core_v2_context.useDefaultAgentId)();
10239
+ const resolvedAgentId = agentId ?? configuration?.agentId ?? providerAgentId ?? _copilotkit_shared.DEFAULT_AGENT_ID;
10025
10240
  const activeThreadId = configuration?.threadId ?? null;
10026
10241
  const { threads, isLoading, listError, fetchMoreError, hasMoreThreads, isFetchingMoreThreads, archiveThread, unarchiveThread, deleteThread, fetchMoreThreads, refetchThreads, startNewThread } = useThreads$1({
10027
10242
  agentId: resolvedAgentId,
@@ -12995,4 +13210,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
12995
13210
  return ɵrunMcpFollowUp;
12996
13211
  }
12997
13212
  });
12998
- //# sourceMappingURL=copilotkit-BU3OvveB.cjs.map
13213
+ //# sourceMappingURL=copilotkit-BkVEkUS0.cjs.map