@copilotkitnext/react 0.0.33 → 0.0.34-alpha.0

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.
package/dist/index.mjs CHANGED
@@ -1378,12 +1378,12 @@ import "katex/dist/katex.min.css";
1378
1378
  import { Streamdown } from "streamdown";
1379
1379
 
1380
1380
  // src/hooks/use-render-tool-call.tsx
1381
- import React6, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo4, useState as useState5, useSyncExternalStore } from "react";
1381
+ import React7, { useCallback as useCallback3, useMemo as useMemo4, useSyncExternalStore } from "react";
1382
1382
  import { ToolCallStatus } from "@copilotkitnext/core";
1383
1383
 
1384
1384
  // src/providers/CopilotKitProvider.tsx
1385
- import { createContext as createContext2, useContext as useContext2, useMemo as useMemo3, useEffect as useEffect4, useReducer, useRef as useRef3, useState as useState4 } from "react";
1386
- import { z } from "zod";
1385
+ import { createContext as createContext2, useContext as useContext2, useMemo as useMemo3, useEffect as useEffect5, useReducer, useRef as useRef4, useState as useState5 } from "react";
1386
+ import { z as z2 } from "zod";
1387
1387
 
1388
1388
  // src/lib/react-core.ts
1389
1389
  import { CopilotKitCore } from "@copilotkitnext/core";
@@ -1455,18 +1455,289 @@ var CopilotKitInspector = ({ core, ...rest }) => {
1455
1455
  };
1456
1456
  CopilotKitInspector.displayName = "CopilotKitInspector";
1457
1457
 
1458
- // src/providers/CopilotKitProvider.tsx
1458
+ // src/components/MCPAppsActivityRenderer.tsx
1459
+ import { useEffect as useEffect4, useRef as useRef3, useState as useState4, useCallback as useCallback2 } from "react";
1460
+ import { z } from "zod";
1459
1461
  import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
1462
+ var PROTOCOL_VERSION = "2025-06-18";
1463
+ var MCPAppsActivityType = "mcp-apps";
1464
+ var MCPAppsActivityContentSchema = z.object({
1465
+ result: z.object({
1466
+ content: z.array(z.any()).optional(),
1467
+ structuredContent: z.any().optional(),
1468
+ isError: z.boolean().optional()
1469
+ }),
1470
+ resource: z.object({
1471
+ uri: z.string(),
1472
+ mimeType: z.string().optional(),
1473
+ text: z.string().optional(),
1474
+ blob: z.string().optional()
1475
+ }),
1476
+ // Server ID for proxying requests (MD5 hash of server config)
1477
+ serverId: z.string().optional(),
1478
+ // Original tool input arguments
1479
+ toolInput: z.record(z.unknown()).optional()
1480
+ });
1481
+ function isRequest(msg) {
1482
+ return "id" in msg && "method" in msg;
1483
+ }
1484
+ function isNotification(msg) {
1485
+ return !("id" in msg) && "method" in msg;
1486
+ }
1487
+ function extractHtmlFromResource(resource) {
1488
+ if (resource.text) {
1489
+ return resource.text;
1490
+ }
1491
+ if (resource.blob) {
1492
+ return atob(resource.blob);
1493
+ }
1494
+ throw new Error("Resource has no text or blob content");
1495
+ }
1496
+ var MCPAppsActivityRenderer = ({ content, agent }) => {
1497
+ const containerRef = useRef3(null);
1498
+ const iframeRef = useRef3(null);
1499
+ const [iframeReady, setIframeReady] = useState4(false);
1500
+ const [error, setError] = useState4(null);
1501
+ const [iframeSize, setIframeSize] = useState4({});
1502
+ const contentRef = useRef3(content);
1503
+ contentRef.current = content;
1504
+ const agentRef = useRef3(agent);
1505
+ agentRef.current = agent;
1506
+ const sendToIframe = useCallback2((msg) => {
1507
+ if (iframeRef.current?.contentWindow) {
1508
+ console.log("[MCPAppsRenderer] Sending to iframe:", msg);
1509
+ iframeRef.current.contentWindow.postMessage(msg, "*");
1510
+ }
1511
+ }, []);
1512
+ const sendResponse = useCallback2((id, result) => {
1513
+ sendToIframe({
1514
+ jsonrpc: "2.0",
1515
+ id,
1516
+ result
1517
+ });
1518
+ }, [sendToIframe]);
1519
+ const sendErrorResponse = useCallback2((id, code, message) => {
1520
+ sendToIframe({
1521
+ jsonrpc: "2.0",
1522
+ id,
1523
+ error: { code, message }
1524
+ });
1525
+ }, [sendToIframe]);
1526
+ const sendNotification = useCallback2((method, params) => {
1527
+ sendToIframe({
1528
+ jsonrpc: "2.0",
1529
+ method,
1530
+ params: params || {}
1531
+ });
1532
+ }, [sendToIframe]);
1533
+ useEffect4(() => {
1534
+ if (!containerRef.current) return;
1535
+ let mounted = true;
1536
+ let messageHandler = null;
1537
+ const setup = async () => {
1538
+ try {
1539
+ const iframe = document.createElement("iframe");
1540
+ iframe.style.width = "100%";
1541
+ iframe.style.height = "300px";
1542
+ iframe.style.border = "none";
1543
+ iframe.style.backgroundColor = "transparent";
1544
+ iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
1545
+ const sandboxReady = new Promise((resolve) => {
1546
+ const initialListener = (event) => {
1547
+ if (event.source === iframe.contentWindow) {
1548
+ if (event.data?.method === "ui/notifications/sandbox-proxy-ready") {
1549
+ window.removeEventListener("message", initialListener);
1550
+ resolve();
1551
+ }
1552
+ }
1553
+ };
1554
+ window.addEventListener("message", initialListener);
1555
+ });
1556
+ iframe.src = "/sandbox.html";
1557
+ iframeRef.current = iframe;
1558
+ containerRef.current?.appendChild(iframe);
1559
+ await sandboxReady;
1560
+ if (!mounted) return;
1561
+ console.log("[MCPAppsRenderer] Sandbox proxy ready");
1562
+ messageHandler = async (event) => {
1563
+ if (event.source !== iframe.contentWindow) return;
1564
+ const msg = event.data;
1565
+ if (!msg || typeof msg !== "object" || msg.jsonrpc !== "2.0") return;
1566
+ console.log("[MCPAppsRenderer] Received from iframe:", msg);
1567
+ if (isRequest(msg)) {
1568
+ switch (msg.method) {
1569
+ case "ui/initialize": {
1570
+ sendResponse(msg.id, {
1571
+ protocolVersion: PROTOCOL_VERSION,
1572
+ hostInfo: {
1573
+ name: "CopilotKit MCP Apps Host",
1574
+ version: "1.0.0"
1575
+ },
1576
+ hostCapabilities: {
1577
+ openLinks: {},
1578
+ logging: {}
1579
+ },
1580
+ hostContext: {
1581
+ theme: "light",
1582
+ platform: "web"
1583
+ }
1584
+ });
1585
+ break;
1586
+ }
1587
+ case "ui/message": {
1588
+ console.log("[MCPAppsRenderer] ui/message request:", msg.params);
1589
+ sendResponse(msg.id, { isError: false });
1590
+ break;
1591
+ }
1592
+ case "ui/open-link": {
1593
+ const url = msg.params?.url;
1594
+ if (url) {
1595
+ window.open(url, "_blank", "noopener,noreferrer");
1596
+ sendResponse(msg.id, { isError: false });
1597
+ } else {
1598
+ sendErrorResponse(msg.id, -32602, "Missing url parameter");
1599
+ }
1600
+ break;
1601
+ }
1602
+ case "tools/call": {
1603
+ const { serverId } = contentRef.current;
1604
+ const currentAgent = agentRef.current;
1605
+ if (!serverId) {
1606
+ sendErrorResponse(msg.id, -32603, "No server ID available for proxying");
1607
+ break;
1608
+ }
1609
+ if (!currentAgent) {
1610
+ sendErrorResponse(msg.id, -32603, "No agent available for proxying");
1611
+ break;
1612
+ }
1613
+ try {
1614
+ const runResult = await currentAgent.runAgent({
1615
+ forwardedProps: {
1616
+ __proxiedMCPRequest: {
1617
+ serverId,
1618
+ method: "tools/call",
1619
+ params: msg.params
1620
+ }
1621
+ }
1622
+ });
1623
+ sendResponse(msg.id, runResult.result || {});
1624
+ } catch (err) {
1625
+ console.error("[MCPAppsRenderer] tools/call error:", err);
1626
+ sendErrorResponse(msg.id, -32603, String(err));
1627
+ }
1628
+ break;
1629
+ }
1630
+ default:
1631
+ sendErrorResponse(msg.id, -32601, `Method not found: ${msg.method}`);
1632
+ }
1633
+ }
1634
+ if (isNotification(msg)) {
1635
+ switch (msg.method) {
1636
+ case "ui/notifications/initialized": {
1637
+ console.log("[MCPAppsRenderer] Inner iframe initialized");
1638
+ if (mounted) {
1639
+ setIframeReady(true);
1640
+ }
1641
+ break;
1642
+ }
1643
+ case "ui/notifications/size-change": {
1644
+ const { width, height } = msg.params || {};
1645
+ console.log("[MCPAppsRenderer] Size change:", { width, height });
1646
+ if (mounted) {
1647
+ setIframeSize({
1648
+ width: typeof width === "number" ? width : void 0,
1649
+ height: typeof height === "number" ? height : void 0
1650
+ });
1651
+ }
1652
+ break;
1653
+ }
1654
+ case "notifications/message": {
1655
+ console.log("[MCPAppsRenderer] App log:", msg.params);
1656
+ break;
1657
+ }
1658
+ }
1659
+ }
1660
+ };
1661
+ window.addEventListener("message", messageHandler);
1662
+ const html = extractHtmlFromResource(content.resource);
1663
+ sendNotification("ui/notifications/sandbox-resource-ready", { html });
1664
+ } catch (err) {
1665
+ console.error("[MCPAppsRenderer] Setup error:", err);
1666
+ if (mounted) {
1667
+ setError(err instanceof Error ? err : new Error(String(err)));
1668
+ }
1669
+ }
1670
+ };
1671
+ setup();
1672
+ return () => {
1673
+ mounted = false;
1674
+ if (messageHandler) {
1675
+ window.removeEventListener("message", messageHandler);
1676
+ }
1677
+ if (iframeRef.current && containerRef.current?.contains(iframeRef.current)) {
1678
+ containerRef.current.removeChild(iframeRef.current);
1679
+ }
1680
+ iframeRef.current = null;
1681
+ };
1682
+ }, [content.resource, sendNotification, sendResponse, sendErrorResponse]);
1683
+ useEffect4(() => {
1684
+ if (iframeRef.current) {
1685
+ if (iframeSize.width !== void 0) {
1686
+ iframeRef.current.style.width = `${iframeSize.width}px`;
1687
+ }
1688
+ if (iframeSize.height !== void 0) {
1689
+ iframeRef.current.style.height = `${iframeSize.height}px`;
1690
+ }
1691
+ }
1692
+ }, [iframeSize]);
1693
+ useEffect4(() => {
1694
+ if (iframeReady && content.toolInput) {
1695
+ console.log("[MCPAppsRenderer] Sending tool input:", content.toolInput);
1696
+ sendNotification("ui/notifications/tool-input", {
1697
+ arguments: content.toolInput
1698
+ });
1699
+ }
1700
+ }, [iframeReady, content.toolInput, sendNotification]);
1701
+ useEffect4(() => {
1702
+ if (iframeReady && content.result) {
1703
+ console.log("[MCPAppsRenderer] Sending tool result:", content.result);
1704
+ sendNotification("ui/notifications/tool-result", content.result);
1705
+ }
1706
+ }, [iframeReady, content.result, sendNotification]);
1707
+ return /* @__PURE__ */ jsx8(
1708
+ "div",
1709
+ {
1710
+ ref: containerRef,
1711
+ style: {
1712
+ width: "100%",
1713
+ minHeight: "100px",
1714
+ borderRadius: "8px",
1715
+ overflow: "hidden",
1716
+ backgroundColor: "#f9f9f9",
1717
+ border: "1px solid #e0e0e0"
1718
+ },
1719
+ children: error && /* @__PURE__ */ jsxs4("div", { style: { color: "red", padding: "1rem" }, children: [
1720
+ "Error: ",
1721
+ error.message
1722
+ ] })
1723
+ }
1724
+ );
1725
+ };
1726
+
1727
+ // src/providers/CopilotKitProvider.tsx
1728
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
1460
1729
  var HEADER_NAME = "X-CopilotCloud-Public-Api-Key";
1461
1730
  var COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
1731
+ var EMPTY_SET = /* @__PURE__ */ new Set();
1462
1732
  var CopilotKitContext = createContext2({
1463
- copilotkit: null
1733
+ copilotkit: null,
1734
+ executingToolCallIds: EMPTY_SET
1464
1735
  });
1465
1736
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
1466
1737
  const empty = useMemo3(() => [], []);
1467
1738
  const value = prop ?? empty;
1468
- const initial = useRef3(value);
1469
- useEffect4(() => {
1739
+ const initial = useRef4(value);
1740
+ useEffect5(() => {
1470
1741
  if (warningMessage && value !== initial.current && (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)) {
1471
1742
  console.error(warningMessage);
1472
1743
  }
@@ -1489,8 +1760,8 @@ var CopilotKitProvider = ({
1489
1760
  showDevConsole = false,
1490
1761
  useSingleEndpoint = false
1491
1762
  }) => {
1492
- const [shouldRenderInspector, setShouldRenderInspector] = useState4(false);
1493
- useEffect4(() => {
1763
+ const [shouldRenderInspector, setShouldRenderInspector] = useState5(false);
1764
+ useEffect5(() => {
1494
1765
  if (typeof window === "undefined") {
1495
1766
  return;
1496
1767
  }
@@ -1528,6 +1799,16 @@ var CopilotKitProvider = ({
1528
1799
  renderActivityMessages,
1529
1800
  "renderActivityMessages must be a stable array."
1530
1801
  );
1802
+ const builtInActivityRenderers = useMemo3(() => [
1803
+ {
1804
+ activityType: MCPAppsActivityType,
1805
+ content: MCPAppsActivityContentSchema,
1806
+ render: MCPAppsActivityRenderer
1807
+ }
1808
+ ], []);
1809
+ const allActivityRenderers = useMemo3(() => {
1810
+ return [...renderActivityMessagesList, ...builtInActivityRenderers];
1811
+ }, [renderActivityMessagesList, builtInActivityRenderers]);
1531
1812
  const resolvedPublicKey = publicApiKey ?? publicLicenseKey;
1532
1813
  const hasLocalAgents = agents && Object.keys(agents).length > 0;
1533
1814
  const mergedHeaders = useMemo3(() => {
@@ -1594,7 +1875,7 @@ var CopilotKitProvider = ({
1594
1875
  const combined = [...renderToolCallsList];
1595
1876
  frontendToolsList.forEach((tool) => {
1596
1877
  if (tool.render) {
1597
- const args = tool.parameters || (tool.name === "*" ? z.any() : void 0);
1878
+ const args = tool.parameters || (tool.name === "*" ? z2.any() : void 0);
1598
1879
  if (args) {
1599
1880
  combined.push({
1600
1881
  name: tool.name,
@@ -1616,13 +1897,13 @@ var CopilotKitProvider = ({
1616
1897
  agents__unsafe_dev_only: agents,
1617
1898
  tools: allTools,
1618
1899
  renderToolCalls: allRenderToolCalls,
1619
- renderActivityMessages: renderActivityMessagesList,
1900
+ renderActivityMessages: allActivityRenderers,
1620
1901
  renderCustomMessages: renderCustomMessagesList
1621
1902
  });
1622
1903
  return copilotkit2;
1623
- }, [allTools, allRenderToolCalls, renderActivityMessagesList, renderCustomMessagesList, useSingleEndpoint]);
1904
+ }, [allTools, allRenderToolCalls, allActivityRenderers, renderCustomMessagesList, useSingleEndpoint]);
1624
1905
  const [, forceUpdate] = useReducer((x) => x + 1, 0);
1625
- useEffect4(() => {
1906
+ useEffect5(() => {
1626
1907
  const subscription = copilotkit.subscribe({
1627
1908
  onRenderToolCallsChanged: () => {
1628
1909
  forceUpdate();
@@ -1632,22 +1913,47 @@ var CopilotKitProvider = ({
1632
1913
  subscription.unsubscribe();
1633
1914
  };
1634
1915
  }, [copilotkit]);
1635
- useEffect4(() => {
1916
+ const [executingToolCallIds, setExecutingToolCallIds] = useState5(() => /* @__PURE__ */ new Set());
1917
+ useEffect5(() => {
1918
+ const subscription = copilotkit.subscribe({
1919
+ onToolExecutionStart: ({ toolCallId }) => {
1920
+ setExecutingToolCallIds((prev) => {
1921
+ if (prev.has(toolCallId)) return prev;
1922
+ const next = new Set(prev);
1923
+ next.add(toolCallId);
1924
+ return next;
1925
+ });
1926
+ },
1927
+ onToolExecutionEnd: ({ toolCallId }) => {
1928
+ setExecutingToolCallIds((prev) => {
1929
+ if (!prev.has(toolCallId)) return prev;
1930
+ const next = new Set(prev);
1931
+ next.delete(toolCallId);
1932
+ return next;
1933
+ });
1934
+ }
1935
+ });
1936
+ return () => {
1937
+ subscription.unsubscribe();
1938
+ };
1939
+ }, [copilotkit]);
1940
+ useEffect5(() => {
1636
1941
  copilotkit.setRuntimeUrl(chatApiEndpoint);
1637
1942
  copilotkit.setRuntimeTransport(useSingleEndpoint ? "single" : "rest");
1638
1943
  copilotkit.setHeaders(mergedHeaders);
1639
1944
  copilotkit.setProperties(properties);
1640
1945
  copilotkit.setAgents__unsafe_dev_only(agents);
1641
1946
  }, [chatApiEndpoint, mergedHeaders, properties, agents, useSingleEndpoint]);
1642
- return /* @__PURE__ */ jsxs4(
1947
+ return /* @__PURE__ */ jsxs5(
1643
1948
  CopilotKitContext.Provider,
1644
1949
  {
1645
1950
  value: {
1646
- copilotkit
1951
+ copilotkit,
1952
+ executingToolCallIds
1647
1953
  },
1648
1954
  children: [
1649
1955
  children,
1650
- shouldRenderInspector ? /* @__PURE__ */ jsx8(CopilotKitInspector, { core: copilotkit }) : null
1956
+ shouldRenderInspector ? /* @__PURE__ */ jsx9(CopilotKitInspector, { core: copilotkit }) : null
1651
1957
  ]
1652
1958
  }
1653
1959
  );
@@ -1658,7 +1964,7 @@ var useCopilotKit = () => {
1658
1964
  if (!context) {
1659
1965
  throw new Error("useCopilotKit must be used within CopilotKitProvider");
1660
1966
  }
1661
- useEffect4(() => {
1967
+ useEffect5(() => {
1662
1968
  const subscription = context.copilotkit.subscribe({
1663
1969
  onRuntimeConnectionStatusChanged: () => {
1664
1970
  forceUpdate();
@@ -1674,8 +1980,8 @@ var useCopilotKit = () => {
1674
1980
  // src/hooks/use-render-tool-call.tsx
1675
1981
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2 } from "@copilotkitnext/shared";
1676
1982
  import { partialJSONParse } from "@copilotkitnext/shared";
1677
- import { jsx as jsx9 } from "react/jsx-runtime";
1678
- var ToolCallRenderer = React6.memo(
1983
+ import { jsx as jsx10 } from "react/jsx-runtime";
1984
+ var ToolCallRenderer = React7.memo(
1679
1985
  function ToolCallRenderer2({
1680
1986
  toolCall,
1681
1987
  toolMessage,
@@ -1688,7 +1994,7 @@ var ToolCallRenderer = React6.memo(
1688
1994
  );
1689
1995
  const toolName = toolCall.function.name;
1690
1996
  if (toolMessage) {
1691
- return /* @__PURE__ */ jsx9(
1997
+ return /* @__PURE__ */ jsx10(
1692
1998
  RenderComponent,
1693
1999
  {
1694
2000
  name: toolName,
@@ -1698,7 +2004,7 @@ var ToolCallRenderer = React6.memo(
1698
2004
  }
1699
2005
  );
1700
2006
  } else if (isExecuting) {
1701
- return /* @__PURE__ */ jsx9(
2007
+ return /* @__PURE__ */ jsx10(
1702
2008
  RenderComponent,
1703
2009
  {
1704
2010
  name: toolName,
@@ -1708,7 +2014,7 @@ var ToolCallRenderer = React6.memo(
1708
2014
  }
1709
2015
  );
1710
2016
  } else {
1711
- return /* @__PURE__ */ jsx9(
2017
+ return /* @__PURE__ */ jsx10(
1712
2018
  RenderComponent,
1713
2019
  {
1714
2020
  name: toolName,
@@ -1733,10 +2039,9 @@ var ToolCallRenderer = React6.memo(
1733
2039
  }
1734
2040
  );
1735
2041
  function useRenderToolCall() {
1736
- const { copilotkit } = useCopilotKit();
2042
+ const { copilotkit, executingToolCallIds } = useCopilotKit();
1737
2043
  const config = useCopilotChatConfiguration();
1738
2044
  const agentId = config?.agentId ?? DEFAULT_AGENT_ID2;
1739
- const [executingToolCallIds, setExecutingToolCallIds] = useState5(() => /* @__PURE__ */ new Set());
1740
2045
  const renderToolCalls = useSyncExternalStore(
1741
2046
  (callback) => {
1742
2047
  return copilotkit.subscribe({
@@ -1746,28 +2051,7 @@ function useRenderToolCall() {
1746
2051
  () => copilotkit.renderToolCalls,
1747
2052
  () => copilotkit.renderToolCalls
1748
2053
  );
1749
- useEffect5(() => {
1750
- const subscription = copilotkit.subscribe({
1751
- onToolExecutionStart: ({ toolCallId }) => {
1752
- setExecutingToolCallIds((prev) => {
1753
- if (prev.has(toolCallId)) return prev;
1754
- const next = new Set(prev);
1755
- next.add(toolCallId);
1756
- return next;
1757
- });
1758
- },
1759
- onToolExecutionEnd: ({ toolCallId }) => {
1760
- setExecutingToolCallIds((prev) => {
1761
- if (!prev.has(toolCallId)) return prev;
1762
- const next = new Set(prev);
1763
- next.delete(toolCallId);
1764
- return next;
1765
- });
1766
- }
1767
- });
1768
- return () => subscription.unsubscribe();
1769
- }, [copilotkit]);
1770
- const renderToolCall = useCallback2(
2054
+ const renderToolCall = useCallback3(
1771
2055
  ({
1772
2056
  toolCall,
1773
2057
  toolMessage
@@ -1781,7 +2065,7 @@ function useRenderToolCall() {
1781
2065
  }
1782
2066
  const RenderComponent = renderConfig.render;
1783
2067
  const isExecuting = executingToolCallIds.has(toolCall.id);
1784
- return /* @__PURE__ */ jsx9(
2068
+ return /* @__PURE__ */ jsx10(
1785
2069
  ToolCallRenderer,
1786
2070
  {
1787
2071
  toolCall,
@@ -1798,7 +2082,7 @@ function useRenderToolCall() {
1798
2082
  }
1799
2083
 
1800
2084
  // src/hooks/use-render-custom-messages.tsx
1801
- import { jsx as jsx10 } from "react/jsx-runtime";
2085
+ import { jsx as jsx11 } from "react/jsx-runtime";
1802
2086
  function useRenderCustomMessages() {
1803
2087
  const { copilotkit } = useCopilotKit();
1804
2088
  const config = useCopilotChatConfiguration();
@@ -1833,7 +2117,7 @@ function useRenderCustomMessages() {
1833
2117
  continue;
1834
2118
  }
1835
2119
  const Component = renderer.render;
1836
- result = /* @__PURE__ */ jsx10(
2120
+ result = /* @__PURE__ */ jsx11(
1837
2121
  Component,
1838
2122
  {
1839
2123
  message,
@@ -1857,14 +2141,14 @@ function useRenderCustomMessages() {
1857
2141
 
1858
2142
  // src/hooks/use-render-activity-message.tsx
1859
2143
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID3 } from "@copilotkitnext/shared";
1860
- import { useCallback as useCallback3 } from "react";
1861
- import { jsx as jsx11 } from "react/jsx-runtime";
2144
+ import { useCallback as useCallback4 } from "react";
2145
+ import { jsx as jsx12 } from "react/jsx-runtime";
1862
2146
  function useRenderActivityMessage() {
1863
2147
  const { copilotkit } = useCopilotKit();
1864
2148
  const config = useCopilotChatConfiguration();
1865
2149
  const agentId = config?.agentId ?? DEFAULT_AGENT_ID3;
1866
2150
  const renderers = copilotkit.renderActivityMessages;
1867
- return useCallback3(
2151
+ return useCallback4(
1868
2152
  (message) => {
1869
2153
  if (!renderers.length) {
1870
2154
  return null;
@@ -1886,7 +2170,7 @@ function useRenderActivityMessage() {
1886
2170
  }
1887
2171
  const Component = renderer.render;
1888
2172
  const agent = copilotkit.getAgent(agentId);
1889
- return /* @__PURE__ */ jsx11(
2173
+ return /* @__PURE__ */ jsx12(
1890
2174
  Component,
1891
2175
  {
1892
2176
  activityType: message.activityType,
@@ -1939,23 +2223,23 @@ function useFrontendTool(tool, deps) {
1939
2223
  }
1940
2224
 
1941
2225
  // src/hooks/use-human-in-the-loop.tsx
1942
- import { useCallback as useCallback4, useRef as useRef4, useEffect as useEffect7 } from "react";
1943
- import React7 from "react";
2226
+ import { useCallback as useCallback5, useRef as useRef5, useEffect as useEffect7 } from "react";
2227
+ import React8 from "react";
1944
2228
  function useHumanInTheLoop(tool, deps) {
1945
2229
  const { copilotkit } = useCopilotKit();
1946
- const resolvePromiseRef = useRef4(null);
1947
- const respond = useCallback4(async (result) => {
2230
+ const resolvePromiseRef = useRef5(null);
2231
+ const respond = useCallback5(async (result) => {
1948
2232
  if (resolvePromiseRef.current) {
1949
2233
  resolvePromiseRef.current(result);
1950
2234
  resolvePromiseRef.current = null;
1951
2235
  }
1952
2236
  }, []);
1953
- const handler = useCallback4(async () => {
2237
+ const handler = useCallback5(async () => {
1954
2238
  return new Promise((resolve) => {
1955
2239
  resolvePromiseRef.current = resolve;
1956
2240
  });
1957
2241
  }, []);
1958
- const RenderComponent = useCallback4(
2242
+ const RenderComponent = useCallback5(
1959
2243
  (props) => {
1960
2244
  const ToolComponent = tool.render;
1961
2245
  if (props.status === "inProgress") {
@@ -1965,7 +2249,7 @@ function useHumanInTheLoop(tool, deps) {
1965
2249
  description: tool.description || "",
1966
2250
  respond: void 0
1967
2251
  };
1968
- return React7.createElement(ToolComponent, enhancedProps);
2252
+ return React8.createElement(ToolComponent, enhancedProps);
1969
2253
  } else if (props.status === "executing") {
1970
2254
  const enhancedProps = {
1971
2255
  ...props,
@@ -1973,7 +2257,7 @@ function useHumanInTheLoop(tool, deps) {
1973
2257
  description: tool.description || "",
1974
2258
  respond
1975
2259
  };
1976
- return React7.createElement(ToolComponent, enhancedProps);
2260
+ return React8.createElement(ToolComponent, enhancedProps);
1977
2261
  } else if (props.status === "complete") {
1978
2262
  const enhancedProps = {
1979
2263
  ...props,
@@ -1981,9 +2265,9 @@ function useHumanInTheLoop(tool, deps) {
1981
2265
  description: tool.description || "",
1982
2266
  respond: void 0
1983
2267
  };
1984
- return React7.createElement(ToolComponent, enhancedProps);
2268
+ return React8.createElement(ToolComponent, enhancedProps);
1985
2269
  }
1986
- return React7.createElement(ToolComponent, props);
2270
+ return React8.createElement(ToolComponent, props);
1987
2271
  },
1988
2272
  [tool.render, tool.name, tool.description, respond]
1989
2273
  );
@@ -2107,7 +2391,7 @@ function useAgentContext(context) {
2107
2391
  }
2108
2392
 
2109
2393
  // src/hooks/use-suggestions.tsx
2110
- import { useCallback as useCallback5, useEffect as useEffect10, useMemo as useMemo7, useState as useState6 } from "react";
2394
+ import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo7, useState as useState6 } from "react";
2111
2395
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID5 } from "@copilotkitnext/shared";
2112
2396
  function useSuggestions({ agentId } = {}) {
2113
2397
  const { copilotkit } = useCopilotKit();
@@ -2156,10 +2440,10 @@ function useSuggestions({ agentId } = {}) {
2156
2440
  subscription.unsubscribe();
2157
2441
  };
2158
2442
  }, [copilotkit, resolvedAgentId]);
2159
- const reloadSuggestions = useCallback5(() => {
2443
+ const reloadSuggestions = useCallback6(() => {
2160
2444
  copilotkit.reloadSuggestions(resolvedAgentId);
2161
2445
  }, [copilotkit, resolvedAgentId]);
2162
- const clearSuggestions = useCallback5(() => {
2446
+ const clearSuggestions = useCallback6(() => {
2163
2447
  copilotkit.clearSuggestions(resolvedAgentId);
2164
2448
  }, [copilotkit, resolvedAgentId]);
2165
2449
  return {
@@ -2171,7 +2455,7 @@ function useSuggestions({ agentId } = {}) {
2171
2455
  }
2172
2456
 
2173
2457
  // src/hooks/use-configure-suggestions.tsx
2174
- import { useCallback as useCallback6, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef5 } from "react";
2458
+ import { useCallback as useCallback7, useEffect as useEffect11, useMemo as useMemo8, useRef as useRef6 } from "react";
2175
2459
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID6 } from "@copilotkitnext/shared";
2176
2460
  function useConfigureSuggestions(config, deps) {
2177
2461
  const { copilotkit } = useCopilotKit();
@@ -2179,7 +2463,7 @@ function useConfigureSuggestions(config, deps) {
2179
2463
  const extraDeps = deps ?? [];
2180
2464
  const resolvedConsumerAgentId = useMemo8(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID6, [chatConfig?.agentId]);
2181
2465
  const rawConsumerAgentId = useMemo8(() => config ? config.consumerAgentId : void 0, [config]);
2182
- const normalizationCacheRef = useRef5({
2466
+ const normalizationCacheRef = useRef6({
2183
2467
  serialized: null,
2184
2468
  config: null
2185
2469
  });
@@ -2213,9 +2497,9 @@ function useConfigureSuggestions(config, deps) {
2213
2497
  normalizationCacheRef.current = { serialized, config: built };
2214
2498
  return { normalizedConfig: built, serializedConfig: serialized };
2215
2499
  }, [config, resolvedConsumerAgentId, ...extraDeps]);
2216
- const latestConfigRef = useRef5(null);
2500
+ const latestConfigRef = useRef6(null);
2217
2501
  latestConfigRef.current = normalizedConfig;
2218
- const previousSerializedConfigRef = useRef5(null);
2502
+ const previousSerializedConfigRef = useRef6(null);
2219
2503
  const targetAgentId = useMemo8(() => {
2220
2504
  if (!normalizedConfig) {
2221
2505
  return resolvedConsumerAgentId;
@@ -2227,7 +2511,7 @@ function useConfigureSuggestions(config, deps) {
2227
2511
  return consumer;
2228
2512
  }, [normalizedConfig, resolvedConsumerAgentId]);
2229
2513
  const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
2230
- const requestReload = useCallback6(() => {
2514
+ const requestReload = useCallback7(() => {
2231
2515
  if (!normalizedConfig) {
2232
2516
  return;
2233
2517
  }
@@ -2290,8 +2574,8 @@ function normalizeStaticSuggestions(suggestions) {
2290
2574
  }
2291
2575
 
2292
2576
  // src/components/chat/CopilotChatToolCallsView.tsx
2293
- import React8 from "react";
2294
- import { Fragment as Fragment2, jsx as jsx12 } from "react/jsx-runtime";
2577
+ import React9 from "react";
2578
+ import { Fragment as Fragment2, jsx as jsx13 } from "react/jsx-runtime";
2295
2579
  function CopilotChatToolCallsView({
2296
2580
  message,
2297
2581
  messages = []
@@ -2300,11 +2584,11 @@ function CopilotChatToolCallsView({
2300
2584
  if (!message.toolCalls || message.toolCalls.length === 0) {
2301
2585
  return null;
2302
2586
  }
2303
- return /* @__PURE__ */ jsx12(Fragment2, { children: message.toolCalls.map((toolCall) => {
2587
+ return /* @__PURE__ */ jsx13(Fragment2, { children: message.toolCalls.map((toolCall) => {
2304
2588
  const toolMessage = messages.find(
2305
2589
  (m) => m.role === "tool" && m.toolCallId === toolCall.id
2306
2590
  );
2307
- return /* @__PURE__ */ jsx12(React8.Fragment, { children: renderToolCall({
2591
+ return /* @__PURE__ */ jsx13(React9.Fragment, { children: renderToolCall({
2308
2592
  toolCall,
2309
2593
  toolMessage
2310
2594
  }) }, toolCall.id);
@@ -2313,7 +2597,7 @@ function CopilotChatToolCallsView({
2313
2597
  var CopilotChatToolCallsView_default = CopilotChatToolCallsView;
2314
2598
 
2315
2599
  // src/components/chat/CopilotChatAssistantMessage.tsx
2316
- import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
2600
+ import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
2317
2601
  function CopilotChatAssistantMessage({
2318
2602
  message,
2319
2603
  messages,
@@ -2390,7 +2674,7 @@ function CopilotChatAssistantMessage({
2390
2674
  toolbar,
2391
2675
  CopilotChatAssistantMessage.Toolbar,
2392
2676
  {
2393
- children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
2677
+ children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1", children: [
2394
2678
  boundCopyButton,
2395
2679
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
2396
2680
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
@@ -2412,7 +2696,7 @@ function CopilotChatAssistantMessage({
2412
2696
  const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
2413
2697
  const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
2414
2698
  if (children) {
2415
- return /* @__PURE__ */ jsx13(Fragment3, { children: children({
2699
+ return /* @__PURE__ */ jsx14(Fragment3, { children: children({
2416
2700
  markdownRenderer: boundMarkdownRenderer,
2417
2701
  toolbar: boundToolbar,
2418
2702
  toolCallsView: boundToolCallsView,
@@ -2432,7 +2716,7 @@ function CopilotChatAssistantMessage({
2432
2716
  toolbarVisible: shouldShowToolbar
2433
2717
  }) });
2434
2718
  }
2435
- return /* @__PURE__ */ jsxs5(
2719
+ return /* @__PURE__ */ jsxs6(
2436
2720
  "div",
2437
2721
  {
2438
2722
  className: twMerge4(
@@ -2450,11 +2734,11 @@ function CopilotChatAssistantMessage({
2450
2734
  );
2451
2735
  }
2452
2736
  ((CopilotChatAssistantMessage2) => {
2453
- CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ jsx13(Streamdown, { className, ...props, children: content ?? "" });
2737
+ CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ jsx14(Streamdown, { className, ...props, children: content ?? "" });
2454
2738
  CopilotChatAssistantMessage2.Toolbar = ({
2455
2739
  className,
2456
2740
  ...props
2457
- }) => /* @__PURE__ */ jsx13(
2741
+ }) => /* @__PURE__ */ jsx14(
2458
2742
  "div",
2459
2743
  {
2460
2744
  className: twMerge4(
@@ -2465,8 +2749,8 @@ function CopilotChatAssistantMessage({
2465
2749
  }
2466
2750
  );
2467
2751
  CopilotChatAssistantMessage2.ToolbarButton = ({ title, children, ...props }) => {
2468
- return /* @__PURE__ */ jsxs5(Tooltip, { children: [
2469
- /* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx13(
2752
+ return /* @__PURE__ */ jsxs6(Tooltip, { children: [
2753
+ /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
2470
2754
  Button,
2471
2755
  {
2472
2756
  type: "button",
@@ -2476,7 +2760,7 @@ function CopilotChatAssistantMessage({
2476
2760
  children
2477
2761
  }
2478
2762
  ) }),
2479
- /* @__PURE__ */ jsx13(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx13("p", { children: title }) })
2763
+ /* @__PURE__ */ jsx14(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx14("p", { children: title }) })
2480
2764
  ] });
2481
2765
  };
2482
2766
  CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
@@ -2490,62 +2774,62 @@ function CopilotChatAssistantMessage({
2490
2774
  onClick(event);
2491
2775
  }
2492
2776
  };
2493
- return /* @__PURE__ */ jsx13(
2777
+ return /* @__PURE__ */ jsx14(
2494
2778
  CopilotChatAssistantMessage2.ToolbarButton,
2495
2779
  {
2496
2780
  title: title || labels.assistantMessageToolbarCopyMessageLabel,
2497
2781
  onClick: handleClick,
2498
2782
  className,
2499
2783
  ...props,
2500
- children: copied ? /* @__PURE__ */ jsx13(Check2, { className: "size-[18px]" }) : /* @__PURE__ */ jsx13(Copy, { className: "size-[18px]" })
2784
+ children: copied ? /* @__PURE__ */ jsx14(Check2, { className: "size-[18px]" }) : /* @__PURE__ */ jsx14(Copy, { className: "size-[18px]" })
2501
2785
  }
2502
2786
  );
2503
2787
  };
2504
2788
  CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
2505
2789
  const config = useCopilotChatConfiguration();
2506
2790
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2507
- return /* @__PURE__ */ jsx13(
2791
+ return /* @__PURE__ */ jsx14(
2508
2792
  CopilotChatAssistantMessage2.ToolbarButton,
2509
2793
  {
2510
2794
  title: title || labels.assistantMessageToolbarThumbsUpLabel,
2511
2795
  ...props,
2512
- children: /* @__PURE__ */ jsx13(ThumbsUp, { className: "size-[18px]" })
2796
+ children: /* @__PURE__ */ jsx14(ThumbsUp, { className: "size-[18px]" })
2513
2797
  }
2514
2798
  );
2515
2799
  };
2516
2800
  CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
2517
2801
  const config = useCopilotChatConfiguration();
2518
2802
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2519
- return /* @__PURE__ */ jsx13(
2803
+ return /* @__PURE__ */ jsx14(
2520
2804
  CopilotChatAssistantMessage2.ToolbarButton,
2521
2805
  {
2522
2806
  title: title || labels.assistantMessageToolbarThumbsDownLabel,
2523
2807
  ...props,
2524
- children: /* @__PURE__ */ jsx13(ThumbsDown, { className: "size-[18px]" })
2808
+ children: /* @__PURE__ */ jsx14(ThumbsDown, { className: "size-[18px]" })
2525
2809
  }
2526
2810
  );
2527
2811
  };
2528
2812
  CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
2529
2813
  const config = useCopilotChatConfiguration();
2530
2814
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2531
- return /* @__PURE__ */ jsx13(
2815
+ return /* @__PURE__ */ jsx14(
2532
2816
  CopilotChatAssistantMessage2.ToolbarButton,
2533
2817
  {
2534
2818
  title: title || labels.assistantMessageToolbarReadAloudLabel,
2535
2819
  ...props,
2536
- children: /* @__PURE__ */ jsx13(Volume2, { className: "size-[20px]" })
2820
+ children: /* @__PURE__ */ jsx14(Volume2, { className: "size-[20px]" })
2537
2821
  }
2538
2822
  );
2539
2823
  };
2540
2824
  CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
2541
2825
  const config = useCopilotChatConfiguration();
2542
2826
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2543
- return /* @__PURE__ */ jsx13(
2827
+ return /* @__PURE__ */ jsx14(
2544
2828
  CopilotChatAssistantMessage2.ToolbarButton,
2545
2829
  {
2546
2830
  title: title || labels.assistantMessageToolbarRegenerateLabel,
2547
2831
  ...props,
2548
- children: /* @__PURE__ */ jsx13(RefreshCw, { className: "size-[18px]" })
2832
+ children: /* @__PURE__ */ jsx14(RefreshCw, { className: "size-[18px]" })
2549
2833
  }
2550
2834
  );
2551
2835
  };
@@ -2563,7 +2847,7 @@ var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
2563
2847
  import { useMemo as useMemo9, useState as useState8 } from "react";
2564
2848
  import { Copy as Copy2, Check as Check3, Edit, ChevronLeft, ChevronRight } from "lucide-react";
2565
2849
  import { twMerge as twMerge5 } from "tailwind-merge";
2566
- import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
2850
+ import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
2567
2851
  function flattenUserMessageContent(content) {
2568
2852
  if (!content) {
2569
2853
  return "";
@@ -2639,7 +2923,7 @@ function CopilotChatUserMessage({
2639
2923
  );
2640
2924
  const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
2641
2925
  const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {
2642
- children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1 justify-end", children: [
2926
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-1 justify-end", children: [
2643
2927
  additionalToolbarItems,
2644
2928
  BoundCopyButton,
2645
2929
  onEditMessage && BoundEditButton,
@@ -2647,7 +2931,7 @@ function CopilotChatUserMessage({
2647
2931
  ] })
2648
2932
  });
2649
2933
  if (children) {
2650
- return /* @__PURE__ */ jsx14(Fragment4, { children: children({
2934
+ return /* @__PURE__ */ jsx15(Fragment4, { children: children({
2651
2935
  messageRenderer: BoundMessageRenderer,
2652
2936
  toolbar: BoundToolbar,
2653
2937
  copyButton: BoundCopyButton,
@@ -2659,7 +2943,7 @@ function CopilotChatUserMessage({
2659
2943
  additionalToolbarItems
2660
2944
  }) });
2661
2945
  }
2662
- return /* @__PURE__ */ jsxs6(
2946
+ return /* @__PURE__ */ jsxs7(
2663
2947
  "div",
2664
2948
  {
2665
2949
  className: twMerge5("flex flex-col items-end group pt-10", className),
@@ -2673,7 +2957,7 @@ function CopilotChatUserMessage({
2673
2957
  );
2674
2958
  }
2675
2959
  ((CopilotChatUserMessage2) => {
2676
- CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ jsx14(
2960
+ CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ jsx15(
2677
2961
  "div",
2678
2962
  {
2679
2963
  className: twMerge5("flex flex-col items-end group", className),
@@ -2681,7 +2965,7 @@ function CopilotChatUserMessage({
2681
2965
  children
2682
2966
  }
2683
2967
  );
2684
- CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ jsx14(
2968
+ CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ jsx15(
2685
2969
  "div",
2686
2970
  {
2687
2971
  className: twMerge5(
@@ -2694,7 +2978,7 @@ function CopilotChatUserMessage({
2694
2978
  CopilotChatUserMessage2.Toolbar = ({
2695
2979
  className,
2696
2980
  ...props
2697
- }) => /* @__PURE__ */ jsx14(
2981
+ }) => /* @__PURE__ */ jsx15(
2698
2982
  "div",
2699
2983
  {
2700
2984
  className: twMerge5(
@@ -2705,8 +2989,8 @@ function CopilotChatUserMessage({
2705
2989
  }
2706
2990
  );
2707
2991
  CopilotChatUserMessage2.ToolbarButton = ({ title, children, className, ...props }) => {
2708
- return /* @__PURE__ */ jsxs6(Tooltip, { children: [
2709
- /* @__PURE__ */ jsx14(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(
2992
+ return /* @__PURE__ */ jsxs7(Tooltip, { children: [
2993
+ /* @__PURE__ */ jsx15(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx15(
2710
2994
  Button,
2711
2995
  {
2712
2996
  type: "button",
@@ -2717,7 +3001,7 @@ function CopilotChatUserMessage({
2717
3001
  children
2718
3002
  }
2719
3003
  ) }),
2720
- /* @__PURE__ */ jsx14(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx14("p", { children: title }) })
3004
+ /* @__PURE__ */ jsx15(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx15("p", { children: title }) })
2721
3005
  ] });
2722
3006
  };
2723
3007
  CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
@@ -2731,27 +3015,27 @@ function CopilotChatUserMessage({
2731
3015
  onClick(event);
2732
3016
  }
2733
3017
  };
2734
- return /* @__PURE__ */ jsx14(
3018
+ return /* @__PURE__ */ jsx15(
2735
3019
  CopilotChatUserMessage2.ToolbarButton,
2736
3020
  {
2737
3021
  title: title || labels.userMessageToolbarCopyMessageLabel,
2738
3022
  onClick: handleClick,
2739
3023
  className,
2740
3024
  ...props,
2741
- children: copied ? /* @__PURE__ */ jsx14(Check3, { className: "size-[18px]" }) : /* @__PURE__ */ jsx14(Copy2, { className: "size-[18px]" })
3025
+ children: copied ? /* @__PURE__ */ jsx15(Check3, { className: "size-[18px]" }) : /* @__PURE__ */ jsx15(Copy2, { className: "size-[18px]" })
2742
3026
  }
2743
3027
  );
2744
3028
  };
2745
3029
  CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
2746
3030
  const config = useCopilotChatConfiguration();
2747
3031
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2748
- return /* @__PURE__ */ jsx14(
3032
+ return /* @__PURE__ */ jsx15(
2749
3033
  CopilotChatUserMessage2.ToolbarButton,
2750
3034
  {
2751
3035
  title: title || labels.userMessageToolbarEditMessageLabel,
2752
3036
  className,
2753
3037
  ...props,
2754
- children: /* @__PURE__ */ jsx14(Edit, { className: "size-[18px]" })
3038
+ children: /* @__PURE__ */ jsx15(Edit, { className: "size-[18px]" })
2755
3039
  }
2756
3040
  );
2757
3041
  };
@@ -2768,8 +3052,8 @@ function CopilotChatUserMessage({
2768
3052
  }
2769
3053
  const canGoPrev = currentBranch > 0;
2770
3054
  const canGoNext = currentBranch < numberOfBranches - 1;
2771
- return /* @__PURE__ */ jsxs6("div", { className: twMerge5("flex items-center gap-1", className), ...props, children: [
2772
- /* @__PURE__ */ jsx14(
3055
+ return /* @__PURE__ */ jsxs7("div", { className: twMerge5("flex items-center gap-1", className), ...props, children: [
3056
+ /* @__PURE__ */ jsx15(
2773
3057
  Button,
2774
3058
  {
2775
3059
  type: "button",
@@ -2781,15 +3065,15 @@ function CopilotChatUserMessage({
2781
3065
  }),
2782
3066
  disabled: !canGoPrev,
2783
3067
  className: "h-6 w-6 p-0",
2784
- children: /* @__PURE__ */ jsx14(ChevronLeft, { className: "size-[20px]" })
3068
+ children: /* @__PURE__ */ jsx15(ChevronLeft, { className: "size-[20px]" })
2785
3069
  }
2786
3070
  ),
2787
- /* @__PURE__ */ jsxs6("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
3071
+ /* @__PURE__ */ jsxs7("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2788
3072
  currentBranch + 1,
2789
3073
  "/",
2790
3074
  numberOfBranches
2791
3075
  ] }),
2792
- /* @__PURE__ */ jsx14(
3076
+ /* @__PURE__ */ jsx15(
2793
3077
  Button,
2794
3078
  {
2795
3079
  type: "button",
@@ -2801,7 +3085,7 @@ function CopilotChatUserMessage({
2801
3085
  }),
2802
3086
  disabled: !canGoNext,
2803
3087
  className: "h-6 w-6 p-0",
2804
- children: /* @__PURE__ */ jsx14(ChevronRight, { className: "size-[20px]" })
3088
+ children: /* @__PURE__ */ jsx15(ChevronRight, { className: "size-[20px]" })
2805
3089
  }
2806
3090
  )
2807
3091
  ] });
@@ -2817,14 +3101,14 @@ CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.Br
2817
3101
  var CopilotChatUserMessage_default = CopilotChatUserMessage;
2818
3102
 
2819
3103
  // src/components/chat/CopilotChatSuggestionPill.tsx
2820
- import React9 from "react";
3104
+ import React10 from "react";
2821
3105
  import { Loader2 } from "lucide-react";
2822
- import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
3106
+ import { jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
2823
3107
  var baseClasses = "group inline-flex h-7 sm:h-8 items-center gap-1 sm:gap-1.5 rounded-full border border-border/60 bg-background px-2.5 sm:px-3 text-[11px] sm:text-xs leading-none text-foreground transition-colors cursor-pointer hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:text-muted-foreground disabled:hover:bg-background disabled:hover:text-muted-foreground pointer-events-auto";
2824
3108
  var labelClasses = "whitespace-nowrap font-medium leading-none";
2825
- var CopilotChatSuggestionPill = React9.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
3109
+ var CopilotChatSuggestionPill = React10.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2826
3110
  const showIcon = !isLoading && icon;
2827
- return /* @__PURE__ */ jsxs7(
3111
+ return /* @__PURE__ */ jsxs8(
2828
3112
  "button",
2829
3113
  {
2830
3114
  ref,
@@ -2835,8 +3119,8 @@ var CopilotChatSuggestionPill = React9.forwardRef(function CopilotChatSuggestion
2835
3119
  disabled: isLoading || props.disabled,
2836
3120
  ...props,
2837
3121
  children: [
2838
- isLoading ? /* @__PURE__ */ jsx15("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx15(Loader2, { className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ jsx15("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: icon }),
2839
- /* @__PURE__ */ jsx15("span", { className: labelClasses, children })
3122
+ isLoading ? /* @__PURE__ */ jsx16("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx16(Loader2, { className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ jsx16("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: icon }),
3123
+ /* @__PURE__ */ jsx16("span", { className: labelClasses, children })
2840
3124
  ]
2841
3125
  }
2842
3126
  );
@@ -2845,10 +3129,10 @@ CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
2845
3129
  var CopilotChatSuggestionPill_default = CopilotChatSuggestionPill;
2846
3130
 
2847
3131
  // src/components/chat/CopilotChatSuggestionView.tsx
2848
- import React10 from "react";
2849
- import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
2850
- var DefaultContainer = React10.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2851
- return /* @__PURE__ */ jsx16(
3132
+ import React11 from "react";
3133
+ import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
3134
+ var DefaultContainer = React11.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
3135
+ return /* @__PURE__ */ jsx17(
2852
3136
  "div",
2853
3137
  {
2854
3138
  ref,
@@ -2860,7 +3144,7 @@ var DefaultContainer = React10.forwardRef(function DefaultContainer2({ className
2860
3144
  }
2861
3145
  );
2862
3146
  });
2863
- var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestionView2({
3147
+ var CopilotChatSuggestionView = React11.forwardRef(function CopilotChatSuggestionView2({
2864
3148
  suggestions,
2865
3149
  onSelectSuggestion,
2866
3150
  loadingIndexes,
@@ -2870,7 +3154,7 @@ var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestio
2870
3154
  children,
2871
3155
  ...restProps
2872
3156
  }, ref) {
2873
- const loadingSet = React10.useMemo(() => {
3157
+ const loadingSet = React11.useMemo(() => {
2874
3158
  if (!loadingIndexes || loadingIndexes.length === 0) {
2875
3159
  return /* @__PURE__ */ new Set();
2876
3160
  }
@@ -2889,11 +3173,11 @@ var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestio
2889
3173
  type: "button",
2890
3174
  onClick: () => onSelectSuggestion?.(suggestion, index)
2891
3175
  });
2892
- return React10.cloneElement(pill, {
3176
+ return React11.cloneElement(pill, {
2893
3177
  key: `${suggestion.title}-${index}`
2894
3178
  });
2895
3179
  });
2896
- const boundContainer = React10.cloneElement(
3180
+ const boundContainer = React11.cloneElement(
2897
3181
  ContainerElement,
2898
3182
  void 0,
2899
3183
  suggestionElements
@@ -2904,7 +3188,7 @@ var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestio
2904
3188
  isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
2905
3189
  type: "button"
2906
3190
  });
2907
- return /* @__PURE__ */ jsx16(Fragment5, { children: children({
3191
+ return /* @__PURE__ */ jsx17(Fragment5, { children: children({
2908
3192
  container: boundContainer,
2909
3193
  suggestion: sampleSuggestion,
2910
3194
  suggestions,
@@ -2915,7 +3199,7 @@ var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestio
2915
3199
  }) });
2916
3200
  }
2917
3201
  if (children) {
2918
- return /* @__PURE__ */ jsxs8(Fragment5, { children: [
3202
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
2919
3203
  boundContainer,
2920
3204
  children
2921
3205
  ] });
@@ -2926,17 +3210,17 @@ CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
2926
3210
  var CopilotChatSuggestionView_default = CopilotChatSuggestionView;
2927
3211
 
2928
3212
  // src/components/chat/CopilotChatMessageView.tsx
2929
- import React11 from "react";
3213
+ import React12 from "react";
2930
3214
  import { twMerge as twMerge6 } from "tailwind-merge";
2931
- import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
2932
- var MemoizedAssistantMessage = React11.memo(
3215
+ import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
3216
+ var MemoizedAssistantMessage = React12.memo(
2933
3217
  function MemoizedAssistantMessage2({
2934
3218
  message,
2935
3219
  messages,
2936
3220
  isRunning,
2937
3221
  AssistantMessageComponent
2938
3222
  }) {
2939
- return /* @__PURE__ */ jsx17(
3223
+ return /* @__PURE__ */ jsx18(
2940
3224
  AssistantMessageComponent,
2941
3225
  {
2942
3226
  message,
@@ -2979,12 +3263,12 @@ var MemoizedAssistantMessage = React11.memo(
2979
3263
  return true;
2980
3264
  }
2981
3265
  );
2982
- var MemoizedUserMessage = React11.memo(
3266
+ var MemoizedUserMessage = React12.memo(
2983
3267
  function MemoizedUserMessage2({
2984
3268
  message,
2985
3269
  UserMessageComponent
2986
3270
  }) {
2987
- return /* @__PURE__ */ jsx17(UserMessageComponent, { message });
3271
+ return /* @__PURE__ */ jsx18(UserMessageComponent, { message });
2988
3272
  },
2989
3273
  (prevProps, nextProps) => {
2990
3274
  if (prevProps.message.id !== nextProps.message.id) return false;
@@ -2993,7 +3277,7 @@ var MemoizedUserMessage = React11.memo(
2993
3277
  return true;
2994
3278
  }
2995
3279
  );
2996
- var MemoizedActivityMessage = React11.memo(
3280
+ var MemoizedActivityMessage = React12.memo(
2997
3281
  function MemoizedActivityMessage2({
2998
3282
  message,
2999
3283
  renderActivityMessage
@@ -3007,7 +3291,7 @@ var MemoizedActivityMessage = React11.memo(
3007
3291
  return true;
3008
3292
  }
3009
3293
  );
3010
- var MemoizedCustomMessage = React11.memo(
3294
+ var MemoizedCustomMessage = React12.memo(
3011
3295
  function MemoizedCustomMessage2({
3012
3296
  message,
3013
3297
  position,
@@ -3039,7 +3323,7 @@ function CopilotChatMessageView({
3039
3323
  const elements = [];
3040
3324
  if (renderCustomMessage) {
3041
3325
  elements.push(
3042
- /* @__PURE__ */ jsx17(
3326
+ /* @__PURE__ */ jsx18(
3043
3327
  MemoizedCustomMessage,
3044
3328
  {
3045
3329
  message,
@@ -3053,7 +3337,7 @@ function CopilotChatMessageView({
3053
3337
  if (message.role === "assistant") {
3054
3338
  const AssistantComponent = typeof assistantMessage === "function" ? assistantMessage : CopilotChatAssistantMessage_default;
3055
3339
  elements.push(
3056
- /* @__PURE__ */ jsx17(
3340
+ /* @__PURE__ */ jsx18(
3057
3341
  MemoizedAssistantMessage,
3058
3342
  {
3059
3343
  message,
@@ -3067,7 +3351,7 @@ function CopilotChatMessageView({
3067
3351
  } else if (message.role === "user") {
3068
3352
  const UserComponent = typeof userMessage === "function" ? userMessage : CopilotChatUserMessage_default;
3069
3353
  elements.push(
3070
- /* @__PURE__ */ jsx17(
3354
+ /* @__PURE__ */ jsx18(
3071
3355
  MemoizedUserMessage,
3072
3356
  {
3073
3357
  message,
@@ -3078,7 +3362,7 @@ function CopilotChatMessageView({
3078
3362
  );
3079
3363
  } else if (message.role === "activity") {
3080
3364
  elements.push(
3081
- /* @__PURE__ */ jsx17(
3365
+ /* @__PURE__ */ jsx18(
3082
3366
  MemoizedActivityMessage,
3083
3367
  {
3084
3368
  message,
@@ -3090,7 +3374,7 @@ function CopilotChatMessageView({
3090
3374
  }
3091
3375
  if (renderCustomMessage) {
3092
3376
  elements.push(
3093
- /* @__PURE__ */ jsx17(
3377
+ /* @__PURE__ */ jsx18(
3094
3378
  MemoizedCustomMessage,
3095
3379
  {
3096
3380
  message,
@@ -3106,13 +3390,13 @@ function CopilotChatMessageView({
3106
3390
  if (children) {
3107
3391
  return children({ messageElements, messages, isRunning });
3108
3392
  }
3109
- return /* @__PURE__ */ jsxs9("div", { className: twMerge6("flex flex-col", className), ...props, children: [
3393
+ return /* @__PURE__ */ jsxs10("div", { className: twMerge6("flex flex-col", className), ...props, children: [
3110
3394
  messageElements,
3111
3395
  isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
3112
3396
  ] });
3113
3397
  }
3114
3398
  CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
3115
- return /* @__PURE__ */ jsx17(
3399
+ return /* @__PURE__ */ jsx18(
3116
3400
  "div",
3117
3401
  {
3118
3402
  className: twMerge6("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
@@ -3123,7 +3407,7 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
3123
3407
  var CopilotChatMessageView_default = CopilotChatMessageView;
3124
3408
 
3125
3409
  // src/components/chat/CopilotChatView.tsx
3126
- import React12, { useRef as useRef6, useState as useState10, useEffect as useEffect13 } from "react";
3410
+ import React13, { useRef as useRef7, useState as useState10, useEffect as useEffect13 } from "react";
3127
3411
  import { twMerge as twMerge7 } from "tailwind-merge";
3128
3412
  import { StickToBottom, useStickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
3129
3413
  import { ChevronDown } from "lucide-react";
@@ -3169,7 +3453,7 @@ function useKeyboardHeight() {
3169
3453
  }
3170
3454
 
3171
3455
  // src/components/chat/CopilotChatView.tsx
3172
- import { Fragment as Fragment6, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
3456
+ import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
3173
3457
  function CopilotChatView({
3174
3458
  messageView,
3175
3459
  input,
@@ -3190,10 +3474,10 @@ function CopilotChatView({
3190
3474
  className,
3191
3475
  ...props
3192
3476
  }) {
3193
- const inputContainerRef = useRef6(null);
3477
+ const inputContainerRef = useRef7(null);
3194
3478
  const [inputContainerHeight, setInputContainerHeight] = useState10(0);
3195
3479
  const [isResizing, setIsResizing] = useState10(false);
3196
- const resizeTimeoutRef = useRef6(null);
3480
+ const resizeTimeoutRef = useRef7(null);
3197
3481
  const { isKeyboardOpen, keyboardHeight, availableHeight } = useKeyboardHeight();
3198
3482
  useEffect13(() => {
3199
3483
  const element = inputContainerRef.current;
@@ -3243,9 +3527,9 @@ function CopilotChatView({
3243
3527
  scrollToBottomButton,
3244
3528
  inputContainerHeight,
3245
3529
  isResizing,
3246
- children: /* @__PURE__ */ jsx18("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ jsxs10("div", { className: "max-w-3xl mx-auto", children: [
3530
+ children: /* @__PURE__ */ jsx19("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ jsxs11("div", { className: "max-w-3xl mx-auto", children: [
3247
3531
  BoundMessageView,
3248
- hasSuggestions ? /* @__PURE__ */ jsx18("div", { className: "pl-0 pr-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
3532
+ hasSuggestions ? /* @__PURE__ */ jsx19("div", { className: "pl-0 pr-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
3249
3533
  ] }) })
3250
3534
  });
3251
3535
  const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});
@@ -3253,8 +3537,8 @@ function CopilotChatView({
3253
3537
  const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {
3254
3538
  ref: inputContainerRef,
3255
3539
  keyboardHeight: isKeyboardOpen ? keyboardHeight : 0,
3256
- children: /* @__PURE__ */ jsxs10(Fragment6, { children: [
3257
- /* @__PURE__ */ jsx18("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6 pointer-events-auto", children: BoundInput }),
3540
+ children: /* @__PURE__ */ jsxs11(Fragment6, { children: [
3541
+ /* @__PURE__ */ jsx19("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6 pointer-events-auto", children: BoundInput }),
3258
3542
  BoundDisclaimer
3259
3543
  ] })
3260
3544
  });
@@ -3267,10 +3551,10 @@ function CopilotChatView({
3267
3551
  feather: BoundFeather,
3268
3552
  inputContainer: BoundInputContainer,
3269
3553
  disclaimer: BoundDisclaimer,
3270
- suggestionView: BoundSuggestionView ?? /* @__PURE__ */ jsx18(Fragment6, {})
3554
+ suggestionView: BoundSuggestionView ?? /* @__PURE__ */ jsx19(Fragment6, {})
3271
3555
  });
3272
3556
  }
3273
- return /* @__PURE__ */ jsxs10("div", { className: twMerge7("relative h-full", className), ...props, children: [
3557
+ return /* @__PURE__ */ jsxs11("div", { className: twMerge7("relative h-full", className), ...props, children: [
3274
3558
  BoundScrollView,
3275
3559
  BoundFeather,
3276
3560
  BoundInputContainer
@@ -3279,9 +3563,9 @@ function CopilotChatView({
3279
3563
  ((CopilotChatView2) => {
3280
3564
  const ScrollContent = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {
3281
3565
  const { isAtBottom, scrollToBottom } = useStickToBottomContext();
3282
- return /* @__PURE__ */ jsxs10(Fragment6, { children: [
3283
- /* @__PURE__ */ jsx18(StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx18("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) }),
3284
- !isAtBottom && !isResizing && /* @__PURE__ */ jsx18(
3566
+ return /* @__PURE__ */ jsxs11(Fragment6, { children: [
3567
+ /* @__PURE__ */ jsx19(StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx19("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) }),
3568
+ !isAtBottom && !isResizing && /* @__PURE__ */ jsx19(
3285
3569
  "div",
3286
3570
  {
3287
3571
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -3328,10 +3612,10 @@ function CopilotChatView({
3328
3612
  };
3329
3613
  }, [scrollRef, autoScroll]);
3330
3614
  if (!hasMounted) {
3331
- return /* @__PURE__ */ jsx18("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx18("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) });
3615
+ return /* @__PURE__ */ jsx19("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx19("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) });
3332
3616
  }
3333
3617
  if (!autoScroll) {
3334
- return /* @__PURE__ */ jsxs10(
3618
+ return /* @__PURE__ */ jsxs11(
3335
3619
  "div",
3336
3620
  {
3337
3621
  ref: scrollRef,
@@ -3341,8 +3625,8 @@ function CopilotChatView({
3341
3625
  ),
3342
3626
  ...props,
3343
3627
  children: [
3344
- /* @__PURE__ */ jsx18("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }),
3345
- showScrollButton && !isResizing && /* @__PURE__ */ jsx18(
3628
+ /* @__PURE__ */ jsx19("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }),
3629
+ showScrollButton && !isResizing && /* @__PURE__ */ jsx19(
3346
3630
  "div",
3347
3631
  {
3348
3632
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -3358,14 +3642,14 @@ function CopilotChatView({
3358
3642
  }
3359
3643
  );
3360
3644
  }
3361
- return /* @__PURE__ */ jsx18(
3645
+ return /* @__PURE__ */ jsx19(
3362
3646
  StickToBottom,
3363
3647
  {
3364
3648
  className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
3365
3649
  resize: "smooth",
3366
3650
  initial: "smooth",
3367
3651
  ...props,
3368
- children: /* @__PURE__ */ jsx18(
3652
+ children: /* @__PURE__ */ jsx19(
3369
3653
  ScrollContent,
3370
3654
  {
3371
3655
  scrollToBottomButton,
@@ -3380,7 +3664,7 @@ function CopilotChatView({
3380
3664
  CopilotChatView2.ScrollToBottomButton = ({
3381
3665
  className,
3382
3666
  ...props
3383
- }) => /* @__PURE__ */ jsx18(
3667
+ }) => /* @__PURE__ */ jsx19(
3384
3668
  Button,
3385
3669
  {
3386
3670
  variant: "outline",
@@ -3394,10 +3678,10 @@ function CopilotChatView({
3394
3678
  className
3395
3679
  ),
3396
3680
  ...props,
3397
- children: /* @__PURE__ */ jsx18(ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
3681
+ children: /* @__PURE__ */ jsx19(ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
3398
3682
  }
3399
3683
  );
3400
- CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ jsx18(
3684
+ CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ jsx19(
3401
3685
  "div",
3402
3686
  {
3403
3687
  className: cn(
@@ -3410,7 +3694,7 @@ function CopilotChatView({
3410
3694
  ...props
3411
3695
  }
3412
3696
  );
3413
- CopilotChatView2.InputContainer = React12.forwardRef(({ children, className, keyboardHeight = 0, ...props }, ref) => /* @__PURE__ */ jsx18(
3697
+ CopilotChatView2.InputContainer = React13.forwardRef(({ children, className, keyboardHeight = 0, ...props }, ref) => /* @__PURE__ */ jsx19(
3414
3698
  "div",
3415
3699
  {
3416
3700
  ref,
@@ -3428,7 +3712,7 @@ function CopilotChatView({
3428
3712
  CopilotChatView2.Disclaimer = ({ className, ...props }) => {
3429
3713
  const config = useCopilotChatConfiguration();
3430
3714
  const labels = config?.labels ?? CopilotChatDefaultLabels;
3431
- return /* @__PURE__ */ jsx18(
3715
+ return /* @__PURE__ */ jsx19(
3432
3716
  "div",
3433
3717
  {
3434
3718
  className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
@@ -3442,10 +3726,10 @@ var CopilotChatView_default = CopilotChatView;
3442
3726
 
3443
3727
  // src/components/chat/CopilotChat.tsx
3444
3728
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID7, randomUUID as randomUUID2 } from "@copilotkitnext/shared";
3445
- import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo10 } from "react";
3729
+ import { useCallback as useCallback8, useEffect as useEffect14, useMemo as useMemo10 } from "react";
3446
3730
  import { merge } from "ts-deepmerge";
3447
3731
  import { AGUIConnectNotImplementedError } from "@ag-ui/client";
3448
- import { jsx as jsx19 } from "react/jsx-runtime";
3732
+ import { jsx as jsx20 } from "react/jsx-runtime";
3449
3733
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }) {
3450
3734
  const existingConfig = useCopilotChatConfiguration();
3451
3735
  const resolvedAgentId = agentId ?? existingConfig?.agentId ?? DEFAULT_AGENT_ID7;
@@ -3478,7 +3762,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3478
3762
  return () => {
3479
3763
  };
3480
3764
  }, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);
3481
- const onSubmitInput = useCallback7(
3765
+ const onSubmitInput = useCallback8(
3482
3766
  async (value) => {
3483
3767
  agent.addMessage({
3484
3768
  id: randomUUID2(),
@@ -3493,7 +3777,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3493
3777
  },
3494
3778
  [agent, copilotkit]
3495
3779
  );
3496
- const handleSelectSuggestion = useCallback7(
3780
+ const handleSelectSuggestion = useCallback8(
3497
3781
  async (suggestion) => {
3498
3782
  agent.addMessage({
3499
3783
  id: randomUUID2(),
@@ -3508,7 +3792,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3508
3792
  },
3509
3793
  [agent, copilotkit]
3510
3794
  );
3511
- const stopCurrentRun = useCallback7(() => {
3795
+ const stopCurrentRun = useCallback8(() => {
3512
3796
  try {
3513
3797
  copilotkit.stopAgent({ agent });
3514
3798
  } catch (error) {
@@ -3548,7 +3832,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3548
3832
  inputProps: finalInputProps
3549
3833
  });
3550
3834
  const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);
3551
- return /* @__PURE__ */ jsx19(
3835
+ return /* @__PURE__ */ jsx20(
3552
3836
  CopilotChatConfigurationProvider,
3553
3837
  {
3554
3838
  agentId: resolvedAgentId,
@@ -3564,17 +3848,17 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
3564
3848
  })(CopilotChat || (CopilotChat = {}));
3565
3849
 
3566
3850
  // src/components/chat/CopilotChatToggleButton.tsx
3567
- import React13, { useState as useState11 } from "react";
3851
+ import React14, { useState as useState11 } from "react";
3568
3852
  import { MessageCircle, X as X2 } from "lucide-react";
3569
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
3853
+ import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
3570
3854
  var DefaultOpenIcon = ({
3571
3855
  className,
3572
3856
  ...props
3573
- }) => /* @__PURE__ */ jsx20(MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
3857
+ }) => /* @__PURE__ */ jsx21(MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
3574
3858
  var DefaultCloseIcon = ({
3575
3859
  className,
3576
3860
  ...props
3577
- }) => /* @__PURE__ */ jsx20(X2, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
3861
+ }) => /* @__PURE__ */ jsx21(X2, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
3578
3862
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
3579
3863
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
3580
3864
  var ICON_TRANSITION_STYLE = Object.freeze({
@@ -3591,7 +3875,7 @@ var BUTTON_BASE_CLASSES = cn(
3591
3875
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
3592
3876
  "disabled:pointer-events-none disabled:opacity-60"
3593
3877
  );
3594
- var CopilotChatToggleButton = React13.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
3878
+ var CopilotChatToggleButton = React14.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
3595
3879
  const { onClick, type, disabled, ...restProps } = buttonProps;
3596
3880
  const configuration = useCopilotChatConfiguration();
3597
3881
  const labels = configuration?.labels ?? CopilotChatDefaultLabels;
@@ -3629,7 +3913,7 @@ var CopilotChatToggleButton = React13.forwardRef(function CopilotChatToggleButto
3629
3913
  focusable: false
3630
3914
  }
3631
3915
  );
3632
- const openIconElement = /* @__PURE__ */ jsx20(
3916
+ const openIconElement = /* @__PURE__ */ jsx21(
3633
3917
  "span",
3634
3918
  {
3635
3919
  "aria-hidden": "true",
@@ -3643,7 +3927,7 @@ var CopilotChatToggleButton = React13.forwardRef(function CopilotChatToggleButto
3643
3927
  children: renderedOpenIcon
3644
3928
  }
3645
3929
  );
3646
- const closeIconElement = /* @__PURE__ */ jsx20(
3930
+ const closeIconElement = /* @__PURE__ */ jsx21(
3647
3931
  "span",
3648
3932
  {
3649
3933
  "aria-hidden": "true",
@@ -3657,7 +3941,7 @@ var CopilotChatToggleButton = React13.forwardRef(function CopilotChatToggleButto
3657
3941
  children: renderedCloseIcon
3658
3942
  }
3659
3943
  );
3660
- return /* @__PURE__ */ jsxs11(
3944
+ return /* @__PURE__ */ jsxs12(
3661
3945
  "button",
3662
3946
  {
3663
3947
  ref,
@@ -3681,12 +3965,12 @@ CopilotChatToggleButton.displayName = "CopilotChatToggleButton";
3681
3965
  var CopilotChatToggleButton_default = CopilotChatToggleButton;
3682
3966
 
3683
3967
  // src/components/chat/CopilotSidebarView.tsx
3684
- import { useEffect as useEffect15, useRef as useRef7, useState as useState12 } from "react";
3968
+ import { useEffect as useEffect15, useRef as useRef8, useState as useState12 } from "react";
3685
3969
 
3686
3970
  // src/components/chat/CopilotModalHeader.tsx
3687
- import { useCallback as useCallback8 } from "react";
3971
+ import { useCallback as useCallback9 } from "react";
3688
3972
  import { X as X3 } from "lucide-react";
3689
- import { jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
3973
+ import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
3690
3974
  function CopilotModalHeader({
3691
3975
  title,
3692
3976
  titleContent,
@@ -3698,7 +3982,7 @@ function CopilotModalHeader({
3698
3982
  const configuration = useCopilotChatConfiguration();
3699
3983
  const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;
3700
3984
  const resolvedTitle = title ?? fallbackTitle;
3701
- const handleClose = useCallback8(() => {
3985
+ const handleClose = useCallback9(() => {
3702
3986
  configuration?.setModalOpen(false);
3703
3987
  }, [configuration]);
3704
3988
  const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {
@@ -3715,7 +3999,7 @@ function CopilotModalHeader({
3715
3999
  ...rest
3716
4000
  });
3717
4001
  }
3718
- return /* @__PURE__ */ jsx21(
4002
+ return /* @__PURE__ */ jsx22(
3719
4003
  "header",
3720
4004
  {
3721
4005
  "data-slot": "copilot-modal-header",
@@ -3725,17 +4009,17 @@ function CopilotModalHeader({
3725
4009
  className
3726
4010
  ),
3727
4011
  ...rest,
3728
- children: /* @__PURE__ */ jsxs12("div", { className: "flex w-full items-center gap-2", children: [
3729
- /* @__PURE__ */ jsx21("div", { className: "flex-1", "aria-hidden": "true" }),
3730
- /* @__PURE__ */ jsx21("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
3731
- /* @__PURE__ */ jsx21("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
4012
+ children: /* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center gap-2", children: [
4013
+ /* @__PURE__ */ jsx22("div", { className: "flex-1", "aria-hidden": "true" }),
4014
+ /* @__PURE__ */ jsx22("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
4015
+ /* @__PURE__ */ jsx22("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
3732
4016
  ] })
3733
4017
  }
3734
4018
  );
3735
4019
  }
3736
4020
  CopilotModalHeader.displayName = "CopilotModalHeader";
3737
4021
  ((CopilotModalHeader2) => {
3738
- CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ jsx21(
4022
+ CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ jsx22(
3739
4023
  "div",
3740
4024
  {
3741
4025
  className: cn(
@@ -3749,7 +4033,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
3749
4033
  CopilotModalHeader2.CloseButton = ({
3750
4034
  className,
3751
4035
  ...props
3752
- }) => /* @__PURE__ */ jsx21(
4036
+ }) => /* @__PURE__ */ jsx22(
3753
4037
  "button",
3754
4038
  {
3755
4039
  type: "button",
@@ -3760,7 +4044,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
3760
4044
  ),
3761
4045
  "aria-label": "Close",
3762
4046
  ...props,
3763
- children: /* @__PURE__ */ jsx21(X3, { className: "h-4 w-4", "aria-hidden": "true" })
4047
+ children: /* @__PURE__ */ jsx22(X3, { className: "h-4 w-4", "aria-hidden": "true" })
3764
4048
  }
3765
4049
  );
3766
4050
  })(CopilotModalHeader || (CopilotModalHeader = {}));
@@ -3768,13 +4052,13 @@ CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
3768
4052
  CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
3769
4053
 
3770
4054
  // src/components/chat/CopilotSidebarView.tsx
3771
- import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
4055
+ import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
3772
4056
  var DEFAULT_SIDEBAR_WIDTH = 480;
3773
4057
  var SIDEBAR_TRANSITION_MS = 260;
3774
4058
  function CopilotSidebarView({ header, width, ...props }) {
3775
4059
  const configuration = useCopilotChatConfiguration();
3776
4060
  const isSidebarOpen = configuration?.isModalOpen ?? false;
3777
- const sidebarRef = useRef7(null);
4061
+ const sidebarRef = useRef8(null);
3778
4062
  const [sidebarWidth, setSidebarWidth] = useState12(width ?? DEFAULT_SIDEBAR_WIDTH);
3779
4063
  const widthToCss = (w) => {
3780
4064
  return typeof w === "number" ? `${w}px` : w;
@@ -3812,8 +4096,8 @@ function CopilotSidebarView({ header, width, ...props }) {
3812
4096
  return () => window.removeEventListener("resize", updateWidth);
3813
4097
  }, [width]);
3814
4098
  const headerElement = renderSlot(header, CopilotModalHeader, {});
3815
- return /* @__PURE__ */ jsxs13(Fragment7, { children: [
3816
- isSidebarOpen && /* @__PURE__ */ jsx22(
4099
+ return /* @__PURE__ */ jsxs14(Fragment7, { children: [
4100
+ isSidebarOpen && /* @__PURE__ */ jsx23(
3817
4101
  "style",
3818
4102
  {
3819
4103
  dangerouslySetInnerHTML: {
@@ -3827,8 +4111,8 @@ function CopilotSidebarView({ header, width, ...props }) {
3827
4111
  }
3828
4112
  }
3829
4113
  ),
3830
- /* @__PURE__ */ jsx22(CopilotChatToggleButton_default, {}),
3831
- /* @__PURE__ */ jsx22(
4114
+ /* @__PURE__ */ jsx23(CopilotChatToggleButton_default, {}),
4115
+ /* @__PURE__ */ jsx23(
3832
4116
  "aside",
3833
4117
  {
3834
4118
  ref: sidebarRef,
@@ -3853,9 +4137,9 @@ function CopilotSidebarView({ header, width, ...props }) {
3853
4137
  "aria-hidden": !isSidebarOpen,
3854
4138
  "aria-label": "Copilot chat sidebar",
3855
4139
  role: "complementary",
3856
- children: /* @__PURE__ */ jsxs13("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
4140
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3857
4141
  headerElement,
3858
- /* @__PURE__ */ jsx22("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ jsx22(CopilotChatView_default, { ...props }) })
4142
+ /* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ jsx23(CopilotChatView_default, { ...props }) })
3859
4143
  ] })
3860
4144
  }
3861
4145
  )
@@ -3864,8 +4148,8 @@ function CopilotSidebarView({ header, width, ...props }) {
3864
4148
  CopilotSidebarView.displayName = "CopilotSidebarView";
3865
4149
 
3866
4150
  // src/components/chat/CopilotPopupView.tsx
3867
- import { useEffect as useEffect16, useMemo as useMemo11, useRef as useRef8, useState as useState13 } from "react";
3868
- import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
4151
+ import { useEffect as useEffect16, useMemo as useMemo11, useRef as useRef9, useState as useState13 } from "react";
4152
+ import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
3869
4153
  var DEFAULT_POPUP_WIDTH = 420;
3870
4154
  var DEFAULT_POPUP_HEIGHT = 560;
3871
4155
  var dimensionToCss = (value, fallback) => {
@@ -3889,7 +4173,7 @@ function CopilotPopupView({
3889
4173
  const isPopupOpen = configuration?.isModalOpen ?? false;
3890
4174
  const setModalOpen = configuration?.setModalOpen;
3891
4175
  const labels = configuration?.labels ?? CopilotChatDefaultLabels;
3892
- const containerRef = useRef8(null);
4176
+ const containerRef = useRef9(null);
3893
4177
  const [isRendered, setIsRendered] = useState13(isPopupOpen);
3894
4178
  const [isAnimatingOut, setIsAnimatingOut] = useState13(false);
3895
4179
  useEffect16(() => {
@@ -3975,14 +4259,14 @@ function CopilotPopupView({
3975
4259
  [resolvedHeight, resolvedWidth]
3976
4260
  );
3977
4261
  const popupAnimationClass = isPopupOpen && !isAnimatingOut ? "pointer-events-auto translate-y-0 opacity-100 md:scale-100" : "pointer-events-none translate-y-4 opacity-0 md:translate-y-5 md:scale-[0.95]";
3978
- const popupContent = isRendered ? /* @__PURE__ */ jsx23(
4262
+ const popupContent = isRendered ? /* @__PURE__ */ jsx24(
3979
4263
  "div",
3980
4264
  {
3981
4265
  className: cn(
3982
4266
  "fixed inset-0 z-[1200] flex max-w-full flex-col items-stretch",
3983
4267
  "md:inset-auto md:bottom-24 md:right-6 md:items-end md:gap-4"
3984
4268
  ),
3985
- children: /* @__PURE__ */ jsxs14(
4269
+ children: /* @__PURE__ */ jsxs15(
3986
4270
  "div",
3987
4271
  {
3988
4272
  ref: containerRef,
@@ -4003,7 +4287,7 @@ function CopilotPopupView({
4003
4287
  style: popupStyle,
4004
4288
  children: [
4005
4289
  headerElement,
4006
- /* @__PURE__ */ jsx23("div", { className: "flex-1 overflow-hidden", "data-popup-chat": true, children: /* @__PURE__ */ jsx23(
4290
+ /* @__PURE__ */ jsx24("div", { className: "flex-1 overflow-hidden", "data-popup-chat": true, children: /* @__PURE__ */ jsx24(
4007
4291
  CopilotChatView_default,
4008
4292
  {
4009
4293
  ...restProps,
@@ -4015,8 +4299,8 @@ function CopilotPopupView({
4015
4299
  )
4016
4300
  }
4017
4301
  ) : null;
4018
- return /* @__PURE__ */ jsxs14(Fragment8, { children: [
4019
- /* @__PURE__ */ jsx23(CopilotChatToggleButton_default, {}),
4302
+ return /* @__PURE__ */ jsxs15(Fragment8, { children: [
4303
+ /* @__PURE__ */ jsx24(CopilotChatToggleButton_default, {}),
4020
4304
  popupContent
4021
4305
  ] });
4022
4306
  }
@@ -4024,12 +4308,12 @@ CopilotPopupView.displayName = "CopilotPopupView";
4024
4308
 
4025
4309
  // src/components/chat/CopilotSidebar.tsx
4026
4310
  import { useMemo as useMemo12 } from "react";
4027
- import { jsx as jsx24 } from "react/jsx-runtime";
4311
+ import { jsx as jsx25 } from "react/jsx-runtime";
4028
4312
  function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
4029
4313
  const SidebarViewOverride = useMemo12(() => {
4030
4314
  const Component = (viewProps) => {
4031
4315
  const { header: viewHeader, width: viewWidth, ...restProps } = viewProps;
4032
- return /* @__PURE__ */ jsx24(
4316
+ return /* @__PURE__ */ jsx25(
4033
4317
  CopilotSidebarView,
4034
4318
  {
4035
4319
  ...restProps,
@@ -4040,7 +4324,7 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
4040
4324
  };
4041
4325
  return Object.assign(Component, CopilotChatView_default);
4042
4326
  }, [header, width]);
4043
- return /* @__PURE__ */ jsx24(
4327
+ return /* @__PURE__ */ jsx25(
4044
4328
  CopilotChat,
4045
4329
  {
4046
4330
  ...chatProps,
@@ -4053,7 +4337,7 @@ CopilotSidebar.displayName = "CopilotSidebar";
4053
4337
 
4054
4338
  // src/components/chat/CopilotPopup.tsx
4055
4339
  import { useMemo as useMemo13 } from "react";
4056
- import { jsx as jsx25 } from "react/jsx-runtime";
4340
+ import { jsx as jsx26 } from "react/jsx-runtime";
4057
4341
  function CopilotPopup({
4058
4342
  header,
4059
4343
  defaultOpen,
@@ -4071,7 +4355,7 @@ function CopilotPopup({
4071
4355
  clickOutsideToClose: viewClickOutsideToClose,
4072
4356
  ...restProps
4073
4357
  } = viewProps;
4074
- return /* @__PURE__ */ jsx25(
4358
+ return /* @__PURE__ */ jsx26(
4075
4359
  CopilotPopupView,
4076
4360
  {
4077
4361
  ...restProps,
@@ -4084,7 +4368,7 @@ function CopilotPopup({
4084
4368
  };
4085
4369
  return Object.assign(Component, CopilotChatView_default);
4086
4370
  }, [clickOutsideToClose, header, height, width]);
4087
- return /* @__PURE__ */ jsx25(
4371
+ return /* @__PURE__ */ jsx26(
4088
4372
  CopilotChat,
4089
4373
  {
4090
4374
  ...chatProps,
@@ -4096,9 +4380,9 @@ function CopilotPopup({
4096
4380
  CopilotPopup.displayName = "CopilotPopup";
4097
4381
 
4098
4382
  // src/types/defineToolCallRenderer.ts
4099
- import { z as z2 } from "zod";
4383
+ import { z as z3 } from "zod";
4100
4384
  function defineToolCallRenderer(def) {
4101
- const argsSchema = def.name === "*" && !def.args ? z2.any() : def.args;
4385
+ const argsSchema = def.name === "*" && !def.args ? z3.any() : def.args;
4102
4386
  return {
4103
4387
  name: def.name,
4104
4388
  args: argsSchema,
@@ -4109,7 +4393,7 @@ function defineToolCallRenderer(def) {
4109
4393
 
4110
4394
  // src/components/WildcardToolCallRender.tsx
4111
4395
  import { useState as useState14 } from "react";
4112
- import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
4396
+ import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
4113
4397
  var WildcardToolCallRender = defineToolCallRenderer({
4114
4398
  name: "*",
4115
4399
  render: ({ args, result, name, status }) => {
@@ -4118,15 +4402,15 @@ var WildcardToolCallRender = defineToolCallRenderer({
4118
4402
  const isActive = statusString === "inProgress" || statusString === "executing";
4119
4403
  const isComplete = statusString === "complete";
4120
4404
  const statusStyles = isActive ? "bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-400" : isComplete ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-400" : "bg-zinc-100 text-zinc-800 dark:bg-zinc-700/40 dark:text-zinc-300";
4121
- return /* @__PURE__ */ jsx26("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs15("div", { className: "rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4", children: [
4122
- /* @__PURE__ */ jsxs15(
4405
+ return /* @__PURE__ */ jsx27("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs16("div", { className: "rounded-xl border border-zinc-200/60 dark:border-zinc-800/60 bg-white/70 dark:bg-zinc-900/50 shadow-sm backdrop-blur p-4", children: [
4406
+ /* @__PURE__ */ jsxs16(
4123
4407
  "div",
4124
4408
  {
4125
4409
  className: "flex items-center justify-between gap-3 cursor-pointer",
4126
4410
  onClick: () => setIsExpanded(!isExpanded),
4127
4411
  children: [
4128
- /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 min-w-0", children: [
4129
- /* @__PURE__ */ jsx26(
4412
+ /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 min-w-0", children: [
4413
+ /* @__PURE__ */ jsx27(
4130
4414
  "svg",
4131
4415
  {
4132
4416
  className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
@@ -4134,7 +4418,7 @@ var WildcardToolCallRender = defineToolCallRenderer({
4134
4418
  viewBox: "0 0 24 24",
4135
4419
  strokeWidth: 2,
4136
4420
  stroke: "currentColor",
4137
- children: /* @__PURE__ */ jsx26(
4421
+ children: /* @__PURE__ */ jsx27(
4138
4422
  "path",
4139
4423
  {
4140
4424
  strokeLinecap: "round",
@@ -4144,10 +4428,10 @@ var WildcardToolCallRender = defineToolCallRenderer({
4144
4428
  )
4145
4429
  }
4146
4430
  ),
4147
- /* @__PURE__ */ jsx26("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
4148
- /* @__PURE__ */ jsx26("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
4431
+ /* @__PURE__ */ jsx27("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
4432
+ /* @__PURE__ */ jsx27("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
4149
4433
  ] }),
4150
- /* @__PURE__ */ jsx26(
4434
+ /* @__PURE__ */ jsx27(
4151
4435
  "span",
4152
4436
  {
4153
4437
  className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
@@ -4157,14 +4441,14 @@ var WildcardToolCallRender = defineToolCallRenderer({
4157
4441
  ]
4158
4442
  }
4159
4443
  ),
4160
- isExpanded && /* @__PURE__ */ jsxs15("div", { className: "mt-3 grid gap-4", children: [
4161
- /* @__PURE__ */ jsxs15("div", { children: [
4162
- /* @__PURE__ */ jsx26("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
4163
- /* @__PURE__ */ jsx26("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: JSON.stringify(args ?? {}, null, 2) })
4444
+ isExpanded && /* @__PURE__ */ jsxs16("div", { className: "mt-3 grid gap-4", children: [
4445
+ /* @__PURE__ */ jsxs16("div", { children: [
4446
+ /* @__PURE__ */ jsx27("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
4447
+ /* @__PURE__ */ jsx27("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: JSON.stringify(args ?? {}, null, 2) })
4164
4448
  ] }),
4165
- result !== void 0 && /* @__PURE__ */ jsxs15("div", { children: [
4166
- /* @__PURE__ */ jsx26("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
4167
- /* @__PURE__ */ jsx26("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: typeof result === "string" ? result : JSON.stringify(result, null, 2) })
4449
+ result !== void 0 && /* @__PURE__ */ jsxs16("div", { children: [
4450
+ /* @__PURE__ */ jsx27("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
4451
+ /* @__PURE__ */ jsx27("pre", { className: "mt-2 max-h-64 overflow-auto rounded-md bg-zinc-50 dark:bg-zinc-800/60 p-3 text-xs leading-relaxed text-zinc-800 dark:text-zinc-200 whitespace-pre-wrap break-words", children: typeof result === "string" ? result : JSON.stringify(result, null, 2) })
4168
4452
  ] })
4169
4453
  ] })
4170
4454
  ] }) });
@@ -4194,6 +4478,9 @@ export {
4194
4478
  CopilotPopupView,
4195
4479
  CopilotSidebar,
4196
4480
  CopilotSidebarView,
4481
+ MCPAppsActivityContentSchema,
4482
+ MCPAppsActivityRenderer,
4483
+ MCPAppsActivityType,
4197
4484
  WildcardToolCallRender,
4198
4485
  defineToolCallRenderer,
4199
4486
  useAgent,