@copilotkit/react-core 1.68.1 → 1.68.3-canary.1786716392

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 (37) hide show
  1. package/dist/{copilotkit-BICg0AyJ.d.cts → copilotkit-B1K0Tgnz.d.cts} +47 -3
  2. package/dist/copilotkit-B1K0Tgnz.d.cts.map +1 -0
  3. package/dist/{copilotkit-BrfN8YeF.d.mts → copilotkit-CZjzQPdq.d.mts} +47 -3
  4. package/dist/copilotkit-CZjzQPdq.d.mts.map +1 -0
  5. package/dist/{copilotkit-Ck0RL8hh.mjs → copilotkit-DT2FmOwK.mjs} +263 -19
  6. package/dist/copilotkit-DT2FmOwK.mjs.map +1 -0
  7. package/dist/{copilotkit-8KSSmCH_.cjs → copilotkit-EFunREg5.cjs} +268 -18
  8. package/dist/copilotkit-EFunREg5.cjs.map +1 -0
  9. package/dist/index.cjs +14 -7
  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 +14 -7
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/index.umd.js +62 -16
  16. package/dist/index.umd.js.map +1 -1
  17. package/dist/v2/headless.cjs +2 -0
  18. package/dist/v2/headless.cjs.map +1 -1
  19. package/dist/v2/headless.d.cts +2 -0
  20. package/dist/v2/headless.d.cts.map +1 -1
  21. package/dist/v2/headless.d.mts +2 -0
  22. package/dist/v2/headless.d.mts.map +1 -1
  23. package/dist/v2/headless.mjs +2 -0
  24. package/dist/v2/headless.mjs.map +1 -1
  25. package/dist/v2/index.cjs +2 -1
  26. package/dist/v2/index.css +1 -1
  27. package/dist/v2/index.d.cts +2 -2
  28. package/dist/v2/index.d.mts +2 -2
  29. package/dist/v2/index.mjs +2 -2
  30. package/dist/v2/index.umd.js +262 -17
  31. package/dist/v2/index.umd.js.map +1 -1
  32. package/package.json +8 -8
  33. package/skills/react-core/SKILL.md +1 -1
  34. package/dist/copilotkit-8KSSmCH_.cjs.map +0 -1
  35. package/dist/copilotkit-BICg0AyJ.d.cts.map +0 -1
  36. package/dist/copilotkit-BrfN8YeF.d.mts.map +0 -1
  37. package/dist/copilotkit-Ck0RL8hh.mjs.map +0 -1
@@ -76,6 +76,8 @@ const CopilotChatDefaultLabels = {
76
76
  assistantMessageToolbarCopyCodeLabel: "Copy",
77
77
  assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
78
78
  assistantMessageToolbarCopyMessageLabel: "Copy",
79
+ assistantMessageToolbarInspectorLabel: "View in Inspector",
80
+ assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
79
81
  assistantMessageToolbarThumbsUpLabel: "Good response",
80
82
  assistantMessageToolbarThumbsDownLabel: "Bad response",
81
83
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -1494,8 +1496,9 @@ function useRenderToolCall() {
1494
1496
 
1495
1497
  //#endregion
1496
1498
  //#region src/v2/components/CopilotKitInspector.tsx
1497
- const CopilotKitInspector = ({ core, ...rest }) => {
1499
+ const CopilotKitInspector = ({ core, openRequest, ...rest }) => {
1498
1500
  const [InspectorComponent, setInspectorComponent] = React$1.useState(null);
1501
+ const inspectorRef = React$1.useRef(null);
1499
1502
  React$1.useEffect(() => {
1500
1503
  let mounted = true;
1501
1504
  import("@copilotkit/web-inspector").then((mod) => {
@@ -1511,14 +1514,29 @@ const CopilotKitInspector = ({ core, ...rest }) => {
1511
1514
  mounted = false;
1512
1515
  };
1513
1516
  }, []);
1517
+ React$1.useEffect(() => {
1518
+ if (openRequest) inspectorRef.current?.openInspector("message_toolbar", openRequest);
1519
+ }, [InspectorComponent, openRequest]);
1514
1520
  if (!InspectorComponent) return null;
1515
1521
  return /* @__PURE__ */ jsx(InspectorComponent, {
1522
+ ref: inspectorRef,
1516
1523
  ...rest,
1517
1524
  core: core ?? null
1518
1525
  });
1519
1526
  };
1520
1527
  CopilotKitInspector.displayName = "CopilotKitInspector";
1521
1528
 
1529
+ //#endregion
1530
+ //#region src/v2/components/CopilotKitInspectorContext.tsx
1531
+ const CopilotKitInspectorContext = React$1.createContext({
1532
+ isLocalInspectorEnabled: false,
1533
+ openInspector: () => void 0
1534
+ });
1535
+ const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
1536
+ function useCopilotKitInspector() {
1537
+ return React$1.useContext(CopilotKitInspectorContext);
1538
+ }
1539
+
1522
1540
  //#endregion
1523
1541
  //#region src/v2/components/license-warning-banner.tsx
1524
1542
  const LICENSE_BANNER_OFFSET_PX = 52;
@@ -3463,6 +3481,8 @@ function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
3463
3481
  }
3464
3482
  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, showDevConsole = false, useSingleEndpoint, onError, a2ui, defaultThrottleMs, inspectorDefaultAnchor, debug }) => {
3465
3483
  const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
3484
+ const [isLocalInspectorEnabled, setIsLocalInspectorEnabled] = useState(false);
3485
+ const [inspectorOpenRequest, setInspectorOpenRequest] = useState(null);
3466
3486
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = useState(false);
3467
3487
  const [runtimeOpenGenUIEnabled, setRuntimeOpenGenUIEnabled] = useState(false);
3468
3488
  const [catalogToggleVersion, setCatalogToggleVersion] = useState(0);
@@ -3472,11 +3492,30 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3472
3492
  const [runtimeLicenseStatus, setRuntimeLicenseStatus] = useState(void 0);
3473
3493
  useEffect(() => {
3474
3494
  if (typeof window === "undefined") return;
3475
- if (showDevConsole === true) setShouldRenderInspector(true);
3476
- else if (showDevConsole === "auto") if (new Set(["localhost", "127.0.0.1"]).has(window.location.hostname)) setShouldRenderInspector(true);
3477
- else setShouldRenderInspector(false);
3478
- else setShouldRenderInspector(false);
3495
+ const isLocalhost = new Set(["localhost", "127.0.0.1"]).has(window.location?.hostname ?? "");
3496
+ const canShowLocalInspectorAction = process.env.NODE_ENV === "development" && isLocalhost;
3497
+ if (showDevConsole === true) {
3498
+ setShouldRenderInspector(true);
3499
+ setIsLocalInspectorEnabled(canShowLocalInspectorAction);
3500
+ } else if (showDevConsole === "auto") if (isLocalhost) {
3501
+ setShouldRenderInspector(true);
3502
+ setIsLocalInspectorEnabled(canShowLocalInspectorAction);
3503
+ } else {
3504
+ setShouldRenderInspector(false);
3505
+ setIsLocalInspectorEnabled(false);
3506
+ }
3507
+ else {
3508
+ setShouldRenderInspector(false);
3509
+ setIsLocalInspectorEnabled(false);
3510
+ }
3479
3511
  }, [showDevConsole]);
3512
+ const requestInspectorOpen = useCallback((request) => {
3513
+ setInspectorOpenRequest({ ...request });
3514
+ }, []);
3515
+ const inspectorContextValue = useMemo(() => ({
3516
+ isLocalInspectorEnabled,
3517
+ openInspector: requestInspectorOpen
3518
+ }), [isLocalInspectorEnabled, requestInspectorOpen]);
3480
3519
  const renderToolCallsList = useStableArrayProp(renderToolCalls, "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.", (initial, next) => {
3481
3520
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3482
3521
  const setFrom = (arr) => new Set(arr.map(key));
@@ -3813,11 +3852,14 @@ const CopilotKitProvider = ({ children, runtimeUrl, headers: headersProp = EMPTY
3813
3852
  catalog: filteredCatalog,
3814
3853
  includeSchema: a2ui?.includeSchema
3815
3854
  }),
3816
- children,
3817
- shouldRenderInspector ? /* @__PURE__ */ jsx(CopilotKitInspector, {
3818
- core: copilotkit,
3819
- defaultAnchor: inspectorDefaultAnchor
3820
- }) : null,
3855
+ /* @__PURE__ */ jsxs(CopilotKitInspectorContextProvider, {
3856
+ value: inspectorContextValue,
3857
+ children: [children, shouldRenderInspector ? /* @__PURE__ */ jsx(CopilotKitInspector, {
3858
+ core: copilotkit,
3859
+ defaultAnchor: inspectorDefaultAnchor,
3860
+ openRequest: inspectorOpenRequest
3861
+ }) : null]
3862
+ }),
3821
3863
  runtimeLicenseStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "no_license" }),
3822
3864
  runtimeLicenseStatus === "expired" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "expired" }),
3823
3865
  runtimeLicenseStatus === "invalid" && /* @__PURE__ */ jsx(LicenseWarningBanner, { type: "invalid" }),
@@ -4571,6 +4613,75 @@ function useAgent({ agentId, threadId, runtimeAgentId, updates, throttleMs } = {
4571
4613
  };
4572
4614
  }
4573
4615
 
4616
+ //#endregion
4617
+ //#region src/v2/hooks/use-subagent.tsx
4618
+ const warnedAmbiguousNames = /* @__PURE__ */ new Set();
4619
+ function resolveSubagent(subagents, subagentRunId, subagentName) {
4620
+ if (subagentRunId) {
4621
+ const match = subagents[subagentRunId];
4622
+ return match ? { ...match } : void 0;
4623
+ }
4624
+ if (subagentName) {
4625
+ const matches = Object.values(subagents).filter((s) => s.name === subagentName);
4626
+ if (matches.length === 0) return;
4627
+ const chosen = matches[matches.length - 1];
4628
+ return matches.length > 1 ? {
4629
+ ...chosen,
4630
+ isAmbiguous: true,
4631
+ matchCount: matches.length
4632
+ } : { ...chosen };
4633
+ }
4634
+ }
4635
+ /**
4636
+ * Read a subagent's live lifecycle state (name, description, running status)
4637
+ * from the CopilotKit core subagent registry, by id or by declared name.
4638
+ *
4639
+ * @example
4640
+ * const sub = useSubagent({ subagentRunId: message.subagentRunId });
4641
+ * // sub?.name, sub?.description, sub?.status
4642
+ */
4643
+ function useSubagent(params) {
4644
+ const { subagentRunId, subagentName, agentId } = params;
4645
+ const { copilotkit } = useCopilotKit();
4646
+ const config = useCopilotChatConfiguration();
4647
+ const resolvedAgentId = useMemo(() => agentId ?? config?.agentId ?? DEFAULT_AGENT_ID, [agentId, config?.agentId]);
4648
+ const [subagent, setSubagent] = useState(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
4649
+ useEffect(() => {
4650
+ setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
4651
+ }, [
4652
+ copilotkit,
4653
+ resolvedAgentId,
4654
+ subagentRunId,
4655
+ subagentName
4656
+ ]);
4657
+ useEffect(() => {
4658
+ const subscription = copilotkit.subscribe({ onSubagentsChanged: ({ agentId: changedAgentId, subagents }) => {
4659
+ if (changedAgentId !== resolvedAgentId) return;
4660
+ setSubagent(resolveSubagent(subagents, subagentRunId, subagentName));
4661
+ } });
4662
+ return () => {
4663
+ subscription.unsubscribe();
4664
+ };
4665
+ }, [
4666
+ copilotkit,
4667
+ resolvedAgentId,
4668
+ subagentRunId,
4669
+ subagentName
4670
+ ]);
4671
+ useEffect(() => {
4672
+ if (process.env.NODE_ENV === "production" || !subagentName || !subagent?.isAmbiguous) return;
4673
+ const key = `${subagentName}:${subagent.matchCount}`;
4674
+ if (warnedAmbiguousNames.has(key)) return;
4675
+ warnedAmbiguousNames.add(key);
4676
+ console.warn(`[CopilotKit] useSubagent({ subagentName: ${JSON.stringify(subagentName)} }) matched ${subagent.matchCount} subagents. Returning the most recently started one; pass a subagentRunId for a stable reference.`);
4677
+ }, [
4678
+ subagentName,
4679
+ subagent?.isAmbiguous,
4680
+ subagent?.matchCount
4681
+ ]);
4682
+ return subagent;
4683
+ }
4684
+
4574
4685
  //#endregion
4575
4686
  //#region src/v2/hooks/use-capabilities.tsx
4576
4687
  /**
@@ -5866,14 +5977,21 @@ function CopilotChatToolCallsView({ message, messages = [] }) {
5866
5977
 
5867
5978
  //#endregion
5868
5979
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
5869
- function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
5980
+ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
5870
5981
  useKatexStyles();
5982
+ const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
5983
+ const chatConfiguration = useCopilotChatConfiguration();
5871
5984
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
5872
5985
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
5873
5986
  if (message.content) return await copyToClipboard(message.content);
5874
5987
  return false;
5875
5988
  } });
5876
5989
  const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
5990
+ const boundInspectorButton = renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, { onClick: () => openInspector({
5991
+ messageId: message.id,
5992
+ threadId: chatConfiguration?.threadId,
5993
+ agentId: chatConfiguration?.agentId
5994
+ }) });
5877
5995
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
5878
5996
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
5879
5997
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
@@ -5881,6 +5999,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5881
5999
  className: "cpk:flex cpk:items-center cpk:gap-1",
5882
6000
  children: [
5883
6001
  boundCopyButton,
6002
+ isLocalInspectorEnabled && boundInspectorButton,
5884
6003
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
5885
6004
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
5886
6005
  (onReadAloud || readAloudButton) && boundReadAloudButton,
@@ -5903,6 +6022,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5903
6022
  toolbar: boundToolbar,
5904
6023
  toolCallsView: boundToolCallsView,
5905
6024
  copyButton: boundCopyButton,
6025
+ inspectorButton: boundInspectorButton,
5906
6026
  thumbsUpButton: boundThumbsUpButton,
5907
6027
  thumbsDownButton: boundThumbsDownButton,
5908
6028
  readAloudButton: boundReadAloudButton,
@@ -5934,6 +6054,110 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5934
6054
  ]
5935
6055
  });
5936
6056
  }
6057
+ function CopilotKitColoredIcon() {
6058
+ const gradientId = useId().replace(/:/g, "");
6059
+ return /* @__PURE__ */ jsxs("svg", {
6060
+ "aria-hidden": "true",
6061
+ className: "cpk:size-5",
6062
+ "data-testid": "copilot-inspector-icon",
6063
+ viewBox: "0 0 24 24",
6064
+ children: [
6065
+ /* @__PURE__ */ jsx("path", {
6066
+ 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",
6067
+ fill: `url(#${gradientId}-purple)`
6068
+ }),
6069
+ /* @__PURE__ */ jsx("path", {
6070
+ 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",
6071
+ fill: `url(#${gradientId}-blue)`
6072
+ }),
6073
+ /* @__PURE__ */ jsx("path", {
6074
+ 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",
6075
+ fill: `url(#${gradientId}-light-blue)`
6076
+ }),
6077
+ /* @__PURE__ */ jsx("path", {
6078
+ className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
6079
+ 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"
6080
+ }),
6081
+ /* @__PURE__ */ jsx("path", {
6082
+ className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
6083
+ 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"
6084
+ }),
6085
+ /* @__PURE__ */ jsx("path", {
6086
+ className: "cpk:fill-[#ABABAB] cpk:dark:fill-[#D4D4D4]",
6087
+ 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"
6088
+ }),
6089
+ /* @__PURE__ */ jsx("path", {
6090
+ 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",
6091
+ fill: `url(#${gradientId}-tail)`
6092
+ }),
6093
+ /* @__PURE__ */ jsxs("defs", { children: [
6094
+ /* @__PURE__ */ jsxs("linearGradient", {
6095
+ gradientUnits: "userSpaceOnUse",
6096
+ id: `${gradientId}-purple`,
6097
+ x1: "17.852",
6098
+ x2: "14.202",
6099
+ y1: "1.467",
6100
+ y2: "11.504",
6101
+ children: [/* @__PURE__ */ jsx("stop", { className: "cpk:[stop-color:#6430AB] cpk:dark:[stop-color:#B792F0]" }), /* @__PURE__ */ jsx("stop", {
6102
+ className: "cpk:[stop-color:#AA89D8] cpk:dark:[stop-color:#D3BDF7]",
6103
+ offset: "1"
6104
+ })]
6105
+ }),
6106
+ /* @__PURE__ */ jsxs("linearGradient", {
6107
+ gradientUnits: "userSpaceOnUse",
6108
+ id: `${gradientId}-blue`,
6109
+ x1: "15.024",
6110
+ x2: "10.324",
6111
+ y1: "7.125",
6112
+ y2: "16.204",
6113
+ children: [/* @__PURE__ */ jsx("stop", { className: "cpk:[stop-color:#005DBB] cpk:dark:[stop-color:#4D9FEF]" }), /* @__PURE__ */ jsx("stop", {
6114
+ className: "cpk:[stop-color:#3D92E8] cpk:dark:[stop-color:#84C0FA]",
6115
+ offset: "1"
6116
+ })]
6117
+ }),
6118
+ /* @__PURE__ */ jsxs("linearGradient", {
6119
+ gradientUnits: "userSpaceOnUse",
6120
+ id: `${gradientId}-light-blue`,
6121
+ x1: "17.122",
6122
+ x2: "15.707",
6123
+ y1: "1.467",
6124
+ y2: "5.892",
6125
+ children: [/* @__PURE__ */ jsx("stop", { className: "cpk:[stop-color:#1B70C4] cpk:dark:[stop-color:#61ACF2]" }), /* @__PURE__ */ jsx("stop", {
6126
+ className: "cpk:[stop-color:#54A4F2] cpk:dark:[stop-color:#9ACDFF]",
6127
+ offset: "1"
6128
+ })]
6129
+ }),
6130
+ /* @__PURE__ */ jsxs("linearGradient", {
6131
+ gradientUnits: "userSpaceOnUse",
6132
+ id: `${gradientId}-tail`,
6133
+ x1: "6.577",
6134
+ x2: "21.506",
6135
+ y1: "21.758",
6136
+ y2: "21.758",
6137
+ children: [
6138
+ /* @__PURE__ */ jsx("stop", { className: "cpk:[stop-color:#4497EA] cpk:dark:[stop-color:#79BCF5]" }),
6139
+ /* @__PURE__ */ jsx("stop", {
6140
+ className: "cpk:[stop-color:#1463B2] cpk:dark:[stop-color:#4594D8]",
6141
+ offset: ".255"
6142
+ }),
6143
+ /* @__PURE__ */ jsx("stop", {
6144
+ className: "cpk:[stop-color:#0A437D] cpk:dark:[stop-color:#347CB7]",
6145
+ offset: ".499"
6146
+ }),
6147
+ /* @__PURE__ */ jsx("stop", {
6148
+ className: "cpk:[stop-color:#2476C8] cpk:dark:[stop-color:#58A4E5]",
6149
+ offset: ".667"
6150
+ }),
6151
+ /* @__PURE__ */ jsx("stop", {
6152
+ className: "cpk:[stop-color:#0C549A] cpk:dark:[stop-color:#3C87C7]",
6153
+ offset: ".973"
6154
+ })
6155
+ ]
6156
+ })
6157
+ ] })
6158
+ ]
6159
+ });
6160
+ }
5937
6161
  (function(_CopilotChatAssistantMessage) {
5938
6162
  _CopilotChatAssistantMessage.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ jsx(Streamdown, {
5939
6163
  className,
@@ -5945,7 +6169,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5945
6169
  className: twMerge("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]", className),
5946
6170
  ...props
5947
6171
  });
5948
- const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, children, ...props }) => {
6172
+ const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, children, ...props }) => {
5949
6173
  return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
5950
6174
  asChild: true,
5951
6175
  children: /* @__PURE__ */ jsx(Button, {
@@ -5957,7 +6181,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5957
6181
  })
5958
6182
  }), /* @__PURE__ */ jsx(TooltipContent, {
5959
6183
  side: "bottom",
5960
- children: /* @__PURE__ */ jsx("p", { children: title })
6184
+ children: tooltip ?? /* @__PURE__ */ jsx("p", { children: title })
5961
6185
  })] });
5962
6186
  };
5963
6187
  _CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
@@ -5990,6 +6214,25 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
5990
6214
  children: copied ? /* @__PURE__ */ jsx(Check, { className: "cpk:size-[18px]" }) : /* @__PURE__ */ jsx(Copy, { className: "cpk:size-[18px]" })
5991
6215
  });
5992
6216
  };
6217
+ _CopilotChatAssistantMessage.InspectorButton = ({ title, ...props }) => {
6218
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6219
+ const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
6220
+ const localOnlyLabel = labels.assistantMessageToolbarInspectorLocalOnlyLabel;
6221
+ const accessibleLabel = `${primaryLabel} (${localOnlyLabel})`;
6222
+ return /* @__PURE__ */ jsx(ToolbarButton, {
6223
+ "data-testid": "copilot-inspector-button",
6224
+ title: accessibleLabel,
6225
+ tooltip: /* @__PURE__ */ jsxs("div", {
6226
+ className: "cpk:flex cpk:flex-col cpk:gap-0.5",
6227
+ children: [/* @__PURE__ */ jsx("span", { children: primaryLabel }), /* @__PURE__ */ jsx("span", {
6228
+ className: "cpk:text-[10px] cpk:opacity-65",
6229
+ children: localOnlyLabel
6230
+ })]
6231
+ }),
6232
+ ...props,
6233
+ children: /* @__PURE__ */ jsx(CopilotKitColoredIcon, {})
6234
+ });
6235
+ };
5993
6236
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
5994
6237
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
5995
6238
  return /* @__PURE__ */ jsx(ToolbarButton, {
@@ -6030,6 +6273,7 @@ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp,
6030
6273
  CopilotChatAssistantMessage.MarkdownRenderer.displayName = "CopilotChatAssistantMessage.MarkdownRenderer";
6031
6274
  CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
6032
6275
  CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
6276
+ CopilotChatAssistantMessage.InspectorButton.displayName = "CopilotChatAssistantMessage.InspectorButton";
6033
6277
  CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
6034
6278
  CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
6035
6279
  CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
@@ -8131,7 +8375,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8131
8375
  const providedThreadId = threadId ?? existingConfig?.threadId;
8132
8376
  const resolvedThreadId = useMemo(() => providedThreadId ?? randomUUID$1(), [providedThreadId]);
8133
8377
  const hasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
8134
- const { agent } = useAgent({
8378
+ const { agent, isReady } = useAgent({
8135
8379
  agentId: resolvedAgentId,
8136
8380
  throttleMs
8137
8381
  });
@@ -8577,8 +8821,8 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8577
8821
  }, []);
8578
8822
  const mergedProps = {
8579
8823
  isRunning: agent.isRunning,
8580
- suggestions: autoSuggestions,
8581
- onSelectSuggestion: handleSelectSuggestion,
8824
+ suggestions: isReady ? autoSuggestions : [],
8825
+ onSelectSuggestion: isReady ? handleSelectSuggestion : void 0,
8582
8826
  suggestionView: stableSuggestionView,
8583
8827
  ...restProps
8584
8828
  };
@@ -8611,7 +8855,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
8611
8855
  const RenderedChatView = renderSlot(chatView, CopilotChatView, {
8612
8856
  ...mergedProps,
8613
8857
  messages,
8614
- onSubmitMessage: onSubmitInput,
8858
+ onSubmitMessage: isReady ? onSubmitInput : void 0,
8615
8859
  onStop: effectiveStopHandler,
8616
8860
  inputMode: effectiveMode,
8617
8861
  inputValue,
@@ -11755,5 +11999,5 @@ function validateProps(props) {
11755
11999
  }
11756
12000
 
11757
12001
  //#endregion
11758
- export { useCapabilities as $, CopilotChatMessageView as A, CopilotChatAudioRecorder as At, CopilotChatAssistantMessage_default as B, CopilotModalHeader as C, MCPAppsActivityRenderer as Ct, CopilotChat as D, useRenderToolCall as Dt, DefaultOpenIcon as E, CopilotKitInspector as Et, CopilotChatSuggestionView as F, useLearnFromUserActionInCurrentThread as G, useLearningContainersInCurrentThread as H, CopilotChatSuggestionPill as I, useThreads$1 as J, useLearnFromUserAction as K, CopilotChatReasoningMessage_default as L, IntelligenceIndicator as M, useCopilotChatConfiguration as Mt, getIntelligenceTurnAnchors as N, CopilotChatView_default as O, CopilotChatInput_default as Ot, IntelligenceIndicatorView as P, useAgentContext as Q, CopilotChatUserMessage_default as R, CopilotSidebarView as S, MCPAppsActivityContentSchema as St, DefaultCloseIcon as T, ɵrunMcpFollowUp as Tt, useLearningContainers as U, CopilotChatToolCallsView as V, useAttachments as W, useConfigureSuggestions as X, useInterrupt as Y, useSuggestions as Z, WildcardToolCallRender as _, OpenGenerativeUIActivityType as _t, ThreadsProvider as a, useComponent as at, CopilotSidebar as b, SandboxFunctionsContext as bt, CoAgentStateRendersProvider as c, useRenderCustomMessages as ct, shouldShowDevConsole as d, useLicenseContext$1 as dt, UseAgentUpdate as et, useToast as f, CopilotKitCoreReact as ft, useCopilotContext as g, OpenGenerativeUIActivityRenderer as gt, CopilotContext as h, GenerateSandboxedUiArgsSchema as ht, ThreadsContext as i, useRenderTool as it, INTELLIGENCE_TURN_HEAD as j, CopilotChatConfigurationProvider as jt, CopilotChatAttachmentQueue as k, AudioRecorderError as kt, useCoAgentStateRenders as l, CopilotKitProvider as lt, useCopilotMessagesContext as m, createA2UIMessageRenderer as mt, defaultCopilotContextCategories as n, useHumanInTheLoop as nt, useThreads as o, useFrontendTool as ot, CopilotMessagesContext as p, defineToolCallRenderer as pt, useMemories as q, CoAgentStateRenderBridge as r, useDefaultRenderTool as rt, CoAgentStateRendersContext as s, useRenderActivityMessage as st, CopilotKit as t, useAgent as tt, useAsyncCallback as u, useCopilotKit$1 as ut, CopilotThreadsDrawer as v, OpenGenerativeUIContentSchema as vt, CopilotChatToggleButton as w, MCPAppsActivityType as wt, CopilotPopupView as x, useSandboxFunctions as xt, CopilotPopup as y, OpenGenerativeUIToolRenderer as yt, CopilotChatAttachmentRenderer as z };
11759
- //# sourceMappingURL=copilotkit-Ck0RL8hh.mjs.map
12002
+ export { useCapabilities as $, CopilotChatMessageView as A, AudioRecorderError as At, CopilotChatAssistantMessage_default as B, CopilotModalHeader as C, MCPAppsActivityContentSchema as Ct, CopilotChat as D, CopilotKitInspector as Dt, DefaultOpenIcon as E, ɵrunMcpFollowUp as Et, CopilotChatSuggestionView as F, useLearnFromUserActionInCurrentThread as G, useLearningContainersInCurrentThread as H, CopilotChatSuggestionPill as I, useThreads$1 as J, useLearnFromUserAction as K, CopilotChatReasoningMessage_default as L, IntelligenceIndicator as M, CopilotChatConfigurationProvider as Mt, getIntelligenceTurnAnchors as N, useCopilotChatConfiguration as Nt, CopilotChatView_default as O, useRenderToolCall as Ot, IntelligenceIndicatorView as P, useAgentContext as Q, CopilotChatUserMessage_default as R, CopilotSidebarView as S, useSandboxFunctions as St, DefaultCloseIcon as T, MCPAppsActivityType as Tt, useLearningContainers as U, CopilotChatToolCallsView as V, useAttachments as W, useConfigureSuggestions as X, useInterrupt as Y, useSuggestions as Z, WildcardToolCallRender as _, OpenGenerativeUIActivityRenderer as _t, ThreadsProvider as a, useRenderTool as at, CopilotSidebar as b, OpenGenerativeUIToolRenderer as bt, CoAgentStateRendersProvider as c, useRenderActivityMessage as ct, shouldShowDevConsole as d, useCopilotKit$1 as dt, useSubagent as et, useToast as f, useLicenseContext$1 as ft, useCopilotContext as g, GenerateSandboxedUiArgsSchema as gt, CopilotContext as h, createA2UIMessageRenderer as ht, ThreadsContext as i, useDefaultRenderTool as it, INTELLIGENCE_TURN_HEAD as j, CopilotChatAudioRecorder as jt, CopilotChatAttachmentQueue as k, CopilotChatInput_default as kt, useCoAgentStateRenders as l, useRenderCustomMessages as lt, useCopilotMessagesContext as m, defineToolCallRenderer as mt, defaultCopilotContextCategories as n, useAgent as nt, useThreads as o, useComponent as ot, CopilotMessagesContext as p, CopilotKitCoreReact as pt, useMemories as q, CoAgentStateRenderBridge as r, useHumanInTheLoop as rt, CoAgentStateRendersContext as s, useFrontendTool as st, CopilotKit as t, UseAgentUpdate as tt, useAsyncCallback as u, CopilotKitProvider as ut, CopilotThreadsDrawer as v, OpenGenerativeUIActivityType as vt, CopilotChatToggleButton as w, MCPAppsActivityRenderer as wt, CopilotPopupView as x, SandboxFunctionsContext as xt, CopilotPopup as y, OpenGenerativeUIContentSchema as yt, CopilotChatAttachmentRenderer as z };
12003
+ //# sourceMappingURL=copilotkit-DT2FmOwK.mjs.map