@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
@@ -90,6 +90,8 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
90
90
  assistantMessageToolbarCopyCodeLabel: "Copy",
91
91
  assistantMessageToolbarCopyCodeCopiedLabel: "Copied",
92
92
  assistantMessageToolbarCopyMessageLabel: "Copy",
93
+ assistantMessageToolbarInspectorLabel: "View in Inspector",
94
+ assistantMessageToolbarInspectorLocalOnlyLabel: "Local Only",
93
95
  assistantMessageToolbarThumbsUpLabel: "Good response",
94
96
  assistantMessageToolbarThumbsDownLabel: "Bad response",
95
97
  assistantMessageToolbarReadAloudLabel: "Read aloud",
@@ -1634,8 +1636,9 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1634
1636
 
1635
1637
  //#endregion
1636
1638
  //#region src/v2/components/CopilotKitInspector.tsx
1637
- const CopilotKitInspector = ({ core, ...rest }) => {
1639
+ const CopilotKitInspector = ({ core, openRequest, ...rest }) => {
1638
1640
  const [InspectorComponent, setInspectorComponent] = react.useState(null);
1641
+ const inspectorRef = react.useRef(null);
1639
1642
  react.useEffect(() => {
1640
1643
  let mounted = true;
1641
1644
  import("@copilotkit/web-inspector").then((mod) => {
@@ -1651,14 +1654,29 @@ _radix_ui_react_dropdown_menu = __toESM(_radix_ui_react_dropdown_menu);
1651
1654
  mounted = false;
1652
1655
  };
1653
1656
  }, []);
1657
+ react.useEffect(() => {
1658
+ if (openRequest) inspectorRef.current?.openInspector("message_toolbar", openRequest);
1659
+ }, [InspectorComponent, openRequest]);
1654
1660
  if (!InspectorComponent) return null;
1655
1661
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InspectorComponent, {
1662
+ ref: inspectorRef,
1656
1663
  ...rest,
1657
1664
  core: core ?? null
1658
1665
  });
1659
1666
  };
1660
1667
  CopilotKitInspector.displayName = "CopilotKitInspector";
1661
1668
 
1669
+ //#endregion
1670
+ //#region src/v2/components/CopilotKitInspectorContext.tsx
1671
+ const CopilotKitInspectorContext = react.createContext({
1672
+ isLocalInspectorEnabled: false,
1673
+ openInspector: () => void 0
1674
+ });
1675
+ const CopilotKitInspectorContextProvider = CopilotKitInspectorContext.Provider;
1676
+ function useCopilotKitInspector() {
1677
+ return react.useContext(CopilotKitInspectorContext);
1678
+ }
1679
+
1662
1680
  //#endregion
1663
1681
  //#region src/v2/components/license-warning-banner.tsx
1664
1682
  const LICENSE_BANNER_OFFSET_PX = 52;
@@ -3507,6 +3525,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3507
3525
  }
3508
3526
  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 }) => {
3509
3527
  const [shouldRenderInspector, setShouldRenderInspector] = (0, react.useState)(false);
3528
+ const [isLocalInspectorEnabled, setIsLocalInspectorEnabled] = (0, react.useState)(false);
3529
+ const [inspectorOpenRequest, setInspectorOpenRequest] = (0, react.useState)(null);
3510
3530
  const [runtimeA2UIEnabled, setRuntimeA2UIEnabled] = (0, react.useState)(false);
3511
3531
  const [runtimeOpenGenUIEnabled, setRuntimeOpenGenUIEnabled] = (0, react.useState)(false);
3512
3532
  const [catalogToggleVersion, setCatalogToggleVersion] = (0, react.useState)(0);
@@ -3516,11 +3536,30 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3516
3536
  const [runtimeLicenseStatus, setRuntimeLicenseStatus] = (0, react.useState)(void 0);
3517
3537
  (0, react.useEffect)(() => {
3518
3538
  if (typeof window === "undefined") return;
3519
- if (showDevConsole === true) setShouldRenderInspector(true);
3520
- else if (showDevConsole === "auto") if (new Set(["localhost", "127.0.0.1"]).has(window.location.hostname)) setShouldRenderInspector(true);
3521
- else setShouldRenderInspector(false);
3522
- else setShouldRenderInspector(false);
3539
+ const isLocalhost = new Set(["localhost", "127.0.0.1"]).has(window.location?.hostname ?? "");
3540
+ const canShowLocalInspectorAction = process.env.NODE_ENV === "development" && isLocalhost;
3541
+ if (showDevConsole === true) {
3542
+ setShouldRenderInspector(true);
3543
+ setIsLocalInspectorEnabled(canShowLocalInspectorAction);
3544
+ } else if (showDevConsole === "auto") if (isLocalhost) {
3545
+ setShouldRenderInspector(true);
3546
+ setIsLocalInspectorEnabled(canShowLocalInspectorAction);
3547
+ } else {
3548
+ setShouldRenderInspector(false);
3549
+ setIsLocalInspectorEnabled(false);
3550
+ }
3551
+ else {
3552
+ setShouldRenderInspector(false);
3553
+ setIsLocalInspectorEnabled(false);
3554
+ }
3523
3555
  }, [showDevConsole]);
3556
+ const requestInspectorOpen = (0, react.useCallback)((request) => {
3557
+ setInspectorOpenRequest({ ...request });
3558
+ }, []);
3559
+ const inspectorContextValue = (0, react.useMemo)(() => ({
3560
+ isLocalInspectorEnabled,
3561
+ openInspector: requestInspectorOpen
3562
+ }), [isLocalInspectorEnabled, requestInspectorOpen]);
3524
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) => {
3525
3564
  const key = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
3526
3565
  const setFrom = (arr) => new Set(arr.map(key));
@@ -3857,11 +3896,14 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
3857
3896
  catalog: filteredCatalog,
3858
3897
  includeSchema: a2ui?.includeSchema
3859
3898
  }),
3860
- children,
3861
- shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
3862
- core: copilotkit,
3863
- defaultAnchor: inspectorDefaultAnchor
3864
- }) : null,
3899
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CopilotKitInspectorContextProvider, {
3900
+ value: inspectorContextValue,
3901
+ children: [children, shouldRenderInspector ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitInspector, {
3902
+ core: copilotkit,
3903
+ defaultAnchor: inspectorDefaultAnchor,
3904
+ openRequest: inspectorOpenRequest
3905
+ }) : null]
3906
+ }),
3865
3907
  runtimeLicenseStatus === "none" && !resolvedPublicKey && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "no_license" }),
3866
3908
  runtimeLicenseStatus === "expired" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "expired" }),
3867
3909
  runtimeLicenseStatus === "invalid" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LicenseWarningBanner, { type: "invalid" }),
@@ -4615,6 +4657,75 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
4615
4657
  };
4616
4658
  }
4617
4659
 
4660
+ //#endregion
4661
+ //#region src/v2/hooks/use-subagent.tsx
4662
+ const warnedAmbiguousNames = /* @__PURE__ */ new Set();
4663
+ function resolveSubagent(subagents, subagentRunId, subagentName) {
4664
+ if (subagentRunId) {
4665
+ const match = subagents[subagentRunId];
4666
+ return match ? { ...match } : void 0;
4667
+ }
4668
+ if (subagentName) {
4669
+ const matches = Object.values(subagents).filter((s) => s.name === subagentName);
4670
+ if (matches.length === 0) return;
4671
+ const chosen = matches[matches.length - 1];
4672
+ return matches.length > 1 ? {
4673
+ ...chosen,
4674
+ isAmbiguous: true,
4675
+ matchCount: matches.length
4676
+ } : { ...chosen };
4677
+ }
4678
+ }
4679
+ /**
4680
+ * Read a subagent's live lifecycle state (name, description, running status)
4681
+ * from the CopilotKit core subagent registry, by id or by declared name.
4682
+ *
4683
+ * @example
4684
+ * const sub = useSubagent({ subagentRunId: message.subagentRunId });
4685
+ * // sub?.name, sub?.description, sub?.status
4686
+ */
4687
+ function useSubagent(params) {
4688
+ const { subagentRunId, subagentName, agentId } = params;
4689
+ const { copilotkit } = useCopilotKit();
4690
+ const config = useCopilotChatConfiguration();
4691
+ const resolvedAgentId = (0, react.useMemo)(() => agentId ?? config?.agentId ?? _copilotkit_shared.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
4692
+ const [subagent, setSubagent] = (0, react.useState)(() => resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
4693
+ (0, react.useEffect)(() => {
4694
+ setSubagent(resolveSubagent(copilotkit.getSubagents(resolvedAgentId), subagentRunId, subagentName));
4695
+ }, [
4696
+ copilotkit,
4697
+ resolvedAgentId,
4698
+ subagentRunId,
4699
+ subagentName
4700
+ ]);
4701
+ (0, react.useEffect)(() => {
4702
+ const subscription = copilotkit.subscribe({ onSubagentsChanged: ({ agentId: changedAgentId, subagents }) => {
4703
+ if (changedAgentId !== resolvedAgentId) return;
4704
+ setSubagent(resolveSubagent(subagents, subagentRunId, subagentName));
4705
+ } });
4706
+ return () => {
4707
+ subscription.unsubscribe();
4708
+ };
4709
+ }, [
4710
+ copilotkit,
4711
+ resolvedAgentId,
4712
+ subagentRunId,
4713
+ subagentName
4714
+ ]);
4715
+ (0, react.useEffect)(() => {
4716
+ if (process.env.NODE_ENV === "production" || !subagentName || !subagent?.isAmbiguous) return;
4717
+ const key = `${subagentName}:${subagent.matchCount}`;
4718
+ if (warnedAmbiguousNames.has(key)) return;
4719
+ warnedAmbiguousNames.add(key);
4720
+ 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.`);
4721
+ }, [
4722
+ subagentName,
4723
+ subagent?.isAmbiguous,
4724
+ subagent?.matchCount
4725
+ ]);
4726
+ return subagent;
4727
+ }
4728
+
4618
4729
  //#endregion
4619
4730
  //#region src/v2/hooks/use-capabilities.tsx
4620
4731
  /**
@@ -5910,14 +6021,21 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5910
6021
 
5911
6022
  //#endregion
5912
6023
  //#region src/v2/components/chat/CopilotChatAssistantMessage.tsx
5913
- function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
6024
+ function CopilotChatAssistantMessage({ message, messages, isRunning, onThumbsUp, onThumbsDown, onReadAloud, onRegenerate, additionalToolbarItems, toolbarVisible = true, markdownRenderer, toolbar, copyButton, inspectorButton, thumbsUpButton, thumbsDownButton, readAloudButton, regenerateButton, toolCallsView, children, className, ...props }) {
5914
6025
  useKatexStyles();
6026
+ const { isLocalInspectorEnabled, openInspector } = useCopilotKitInspector();
6027
+ const chatConfiguration = useCopilotChatConfiguration();
5915
6028
  const boundMarkdownRenderer = renderSlot(markdownRenderer, CopilotChatAssistantMessage.MarkdownRenderer, { content: message.content || "" });
5916
6029
  const boundCopyButton = renderSlot(copyButton, CopilotChatAssistantMessage.CopyButton, { onClick: async () => {
5917
6030
  if (message.content) return await (0, _copilotkit_shared.copyToClipboard)(message.content);
5918
6031
  return false;
5919
6032
  } });
5920
6033
  const boundThumbsUpButton = renderSlot(thumbsUpButton, CopilotChatAssistantMessage.ThumbsUpButton, { onClick: onThumbsUp ? () => onThumbsUp(message) : void 0 });
6034
+ const boundInspectorButton = renderSlot(inspectorButton, CopilotChatAssistantMessage.InspectorButton, { onClick: () => openInspector({
6035
+ messageId: message.id,
6036
+ threadId: chatConfiguration?.threadId,
6037
+ agentId: chatConfiguration?.agentId
6038
+ }) });
5921
6039
  const boundThumbsDownButton = renderSlot(thumbsDownButton, CopilotChatAssistantMessage.ThumbsDownButton, { onClick: onThumbsDown ? () => onThumbsDown(message) : void 0 });
5922
6040
  const boundReadAloudButton = renderSlot(readAloudButton, CopilotChatAssistantMessage.ReadAloudButton, { onClick: onReadAloud ? () => onReadAloud(message) : void 0 });
5923
6041
  const boundRegenerateButton = renderSlot(regenerateButton, CopilotChatAssistantMessage.RegenerateButton, { onClick: onRegenerate ? () => onRegenerate(message) : void 0 });
@@ -5925,6 +6043,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5925
6043
  className: "cpk:flex cpk:items-center cpk:gap-1",
5926
6044
  children: [
5927
6045
  boundCopyButton,
6046
+ isLocalInspectorEnabled && boundInspectorButton,
5928
6047
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
5929
6048
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
5930
6049
  (onReadAloud || readAloudButton) && boundReadAloudButton,
@@ -5947,6 +6066,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5947
6066
  toolbar: boundToolbar,
5948
6067
  toolCallsView: boundToolCallsView,
5949
6068
  copyButton: boundCopyButton,
6069
+ inspectorButton: boundInspectorButton,
5950
6070
  thumbsUpButton: boundThumbsUpButton,
5951
6071
  thumbsDownButton: boundThumbsDownButton,
5952
6072
  readAloudButton: boundReadAloudButton,
@@ -5978,6 +6098,110 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5978
6098
  ]
5979
6099
  });
5980
6100
  }
6101
+ function CopilotKitColoredIcon() {
6102
+ const gradientId = (0, react.useId)().replace(/:/g, "");
6103
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
6104
+ "aria-hidden": "true",
6105
+ className: "cpk:size-5",
6106
+ "data-testid": "copilot-inspector-icon",
6107
+ viewBox: "0 0 24 24",
6108
+ children: [
6109
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6110
+ 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",
6111
+ fill: `url(#${gradientId}-purple)`
6112
+ }),
6113
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6114
+ 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",
6115
+ fill: `url(#${gradientId}-blue)`
6116
+ }),
6117
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6118
+ 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",
6119
+ fill: `url(#${gradientId}-light-blue)`
6120
+ }),
6121
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6122
+ className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
6123
+ 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"
6124
+ }),
6125
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6126
+ className: "cpk:fill-[#513C9F] cpk:dark:fill-[#B99AE8]",
6127
+ 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"
6128
+ }),
6129
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6130
+ className: "cpk:fill-[#ABABAB] cpk:dark:fill-[#D4D4D4]",
6131
+ 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"
6132
+ }),
6133
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
6134
+ 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",
6135
+ fill: `url(#${gradientId}-tail)`
6136
+ }),
6137
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("defs", { children: [
6138
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6139
+ gradientUnits: "userSpaceOnUse",
6140
+ id: `${gradientId}-purple`,
6141
+ x1: "17.852",
6142
+ x2: "14.202",
6143
+ y1: "1.467",
6144
+ y2: "11.504",
6145
+ 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", {
6146
+ className: "cpk:[stop-color:#AA89D8] cpk:dark:[stop-color:#D3BDF7]",
6147
+ offset: "1"
6148
+ })]
6149
+ }),
6150
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6151
+ gradientUnits: "userSpaceOnUse",
6152
+ id: `${gradientId}-blue`,
6153
+ x1: "15.024",
6154
+ x2: "10.324",
6155
+ y1: "7.125",
6156
+ y2: "16.204",
6157
+ 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", {
6158
+ className: "cpk:[stop-color:#3D92E8] cpk:dark:[stop-color:#84C0FA]",
6159
+ offset: "1"
6160
+ })]
6161
+ }),
6162
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6163
+ gradientUnits: "userSpaceOnUse",
6164
+ id: `${gradientId}-light-blue`,
6165
+ x1: "17.122",
6166
+ x2: "15.707",
6167
+ y1: "1.467",
6168
+ y2: "5.892",
6169
+ 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", {
6170
+ className: "cpk:[stop-color:#54A4F2] cpk:dark:[stop-color:#9ACDFF]",
6171
+ offset: "1"
6172
+ })]
6173
+ }),
6174
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("linearGradient", {
6175
+ gradientUnits: "userSpaceOnUse",
6176
+ id: `${gradientId}-tail`,
6177
+ x1: "6.577",
6178
+ x2: "21.506",
6179
+ y1: "21.758",
6180
+ y2: "21.758",
6181
+ children: [
6182
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", { className: "cpk:[stop-color:#4497EA] cpk:dark:[stop-color:#79BCF5]" }),
6183
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6184
+ className: "cpk:[stop-color:#1463B2] cpk:dark:[stop-color:#4594D8]",
6185
+ offset: ".255"
6186
+ }),
6187
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6188
+ className: "cpk:[stop-color:#0A437D] cpk:dark:[stop-color:#347CB7]",
6189
+ offset: ".499"
6190
+ }),
6191
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6192
+ className: "cpk:[stop-color:#2476C8] cpk:dark:[stop-color:#58A4E5]",
6193
+ offset: ".667"
6194
+ }),
6195
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("stop", {
6196
+ className: "cpk:[stop-color:#0C549A] cpk:dark:[stop-color:#3C87C7]",
6197
+ offset: ".973"
6198
+ })
6199
+ ]
6200
+ })
6201
+ ] })
6202
+ ]
6203
+ });
6204
+ }
5981
6205
  (function(_CopilotChatAssistantMessage) {
5982
6206
  _CopilotChatAssistantMessage.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(streamdown.Streamdown, {
5983
6207
  className,
@@ -5989,7 +6213,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
5989
6213
  className: (0, tailwind_merge.twMerge)("cpk:w-full cpk:bg-transparent cpk:flex cpk:items-center cpk:-ml-[5px] cpk:-mt-[0px]", className),
5990
6214
  ...props
5991
6215
  });
5992
- const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, children, ...props }) => {
6216
+ const ToolbarButton = _CopilotChatAssistantMessage.ToolbarButton = ({ title, tooltip, children, ...props }) => {
5993
6217
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipTrigger, {
5994
6218
  asChild: true,
5995
6219
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
@@ -6001,7 +6225,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6001
6225
  })
6002
6226
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TooltipContent, {
6003
6227
  side: "bottom",
6004
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: title })
6228
+ children: tooltip ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: title })
6005
6229
  })] });
6006
6230
  };
6007
6231
  _CopilotChatAssistantMessage.CopyButton = ({ className, title, onClick, ...props }) => {
@@ -6034,6 +6258,25 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6034
6258
  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]" })
6035
6259
  });
6036
6260
  };
6261
+ _CopilotChatAssistantMessage.InspectorButton = ({ title, ...props }) => {
6262
+ const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6263
+ const primaryLabel = title || labels.assistantMessageToolbarInspectorLabel;
6264
+ const localOnlyLabel = labels.assistantMessageToolbarInspectorLocalOnlyLabel;
6265
+ const accessibleLabel = `${primaryLabel} (${localOnlyLabel})`;
6266
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
6267
+ "data-testid": "copilot-inspector-button",
6268
+ title: accessibleLabel,
6269
+ tooltip: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
6270
+ className: "cpk:flex cpk:flex-col cpk:gap-0.5",
6271
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: primaryLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
6272
+ className: "cpk:text-[10px] cpk:opacity-65",
6273
+ children: localOnlyLabel
6274
+ })]
6275
+ }),
6276
+ ...props,
6277
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotKitColoredIcon, {})
6278
+ });
6279
+ };
6037
6280
  _CopilotChatAssistantMessage.ThumbsUpButton = ({ title, ...props }) => {
6038
6281
  const labels = useCopilotChatConfiguration()?.labels ?? CopilotChatDefaultLabels;
6039
6282
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToolbarButton, {
@@ -6074,6 +6317,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
6074
6317
  CopilotChatAssistantMessage.MarkdownRenderer.displayName = "CopilotChatAssistantMessage.MarkdownRenderer";
6075
6318
  CopilotChatAssistantMessage.Toolbar.displayName = "CopilotChatAssistantMessage.Toolbar";
6076
6319
  CopilotChatAssistantMessage.CopyButton.displayName = "CopilotChatAssistantMessage.CopyButton";
6320
+ CopilotChatAssistantMessage.InspectorButton.displayName = "CopilotChatAssistantMessage.InspectorButton";
6077
6321
  CopilotChatAssistantMessage.ThumbsUpButton.displayName = "CopilotChatAssistantMessage.ThumbsUpButton";
6078
6322
  CopilotChatAssistantMessage.ThumbsDownButton.displayName = "CopilotChatAssistantMessage.ThumbsDownButton";
6079
6323
  CopilotChatAssistantMessage.ReadAloudButton.displayName = "CopilotChatAssistantMessage.ReadAloudButton";
@@ -8175,7 +8419,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8175
8419
  const providedThreadId = threadId ?? existingConfig?.threadId;
8176
8420
  const resolvedThreadId = (0, react.useMemo)(() => providedThreadId ?? (0, _copilotkit_shared.randomUUID)(), [providedThreadId]);
8177
8421
  const hasExplicitThreadId = !!threadId || !!existingConfig?.hasExplicitThreadId;
8178
- const { agent } = useAgent({
8422
+ const { agent, isReady } = useAgent({
8179
8423
  agentId: resolvedAgentId,
8180
8424
  throttleMs
8181
8425
  });
@@ -8621,8 +8865,8 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8621
8865
  }, []);
8622
8866
  const mergedProps = {
8623
8867
  isRunning: agent.isRunning,
8624
- suggestions: autoSuggestions,
8625
- onSelectSuggestion: handleSelectSuggestion,
8868
+ suggestions: isReady ? autoSuggestions : [],
8869
+ onSelectSuggestion: isReady ? handleSelectSuggestion : void 0,
8626
8870
  suggestionView: stableSuggestionView,
8627
8871
  ...restProps
8628
8872
  };
@@ -8655,7 +8899,7 @@ window.parent.postMessage({jsonrpc:"2.0",method:"ui/notifications/sandbox-proxy-
8655
8899
  const RenderedChatView = renderSlot(chatView, CopilotChatView, {
8656
8900
  ...mergedProps,
8657
8901
  messages,
8658
- onSubmitMessage: onSubmitInput,
8902
+ onSubmitMessage: isReady ? onSubmitInput : void 0,
8659
8903
  onStop: effectiveStopHandler,
8660
8904
  inputMode: effectiveMode,
8661
8905
  inputValue,
@@ -11779,6 +12023,7 @@ exports.useRenderCustomMessages = useRenderCustomMessages;
11779
12023
  exports.useRenderTool = useRenderTool;
11780
12024
  exports.useRenderToolCall = useRenderToolCall;
11781
12025
  exports.useSandboxFunctions = useSandboxFunctions;
12026
+ exports.useSubagent = useSubagent;
11782
12027
  exports.useSuggestions = useSuggestions;
11783
12028
  exports.useThreads = useThreads;
11784
12029
  exports.ɵrunMcpFollowUp = ɵrunMcpFollowUp;