@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.d.mts +89 -1
- package/dist/index.d.ts +89 -1
- package/dist/index.js +595 -305
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +523 -236
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -55,6 +55,9 @@ __export(index_exports, {
|
|
|
55
55
|
CopilotPopupView: () => CopilotPopupView,
|
|
56
56
|
CopilotSidebar: () => CopilotSidebar,
|
|
57
57
|
CopilotSidebarView: () => CopilotSidebarView,
|
|
58
|
+
MCPAppsActivityContentSchema: () => MCPAppsActivityContentSchema,
|
|
59
|
+
MCPAppsActivityRenderer: () => MCPAppsActivityRenderer,
|
|
60
|
+
MCPAppsActivityType: () => MCPAppsActivityType,
|
|
58
61
|
WildcardToolCallRender: () => WildcardToolCallRender,
|
|
59
62
|
defineToolCallRenderer: () => defineToolCallRenderer,
|
|
60
63
|
useAgent: () => useAgent,
|
|
@@ -1424,19 +1427,19 @@ CopilotChatInput.AddMenuButton.displayName = "CopilotChatInput.AddMenuButton";
|
|
|
1424
1427
|
var CopilotChatInput_default = CopilotChatInput;
|
|
1425
1428
|
|
|
1426
1429
|
// src/components/chat/CopilotChatAssistantMessage.tsx
|
|
1427
|
-
var
|
|
1430
|
+
var import_react18 = require("react");
|
|
1428
1431
|
var import_lucide_react3 = require("lucide-react");
|
|
1429
1432
|
var import_tailwind_merge4 = require("tailwind-merge");
|
|
1430
1433
|
var import_katex_min = require("katex/dist/katex.min.css");
|
|
1431
1434
|
var import_streamdown = require("streamdown");
|
|
1432
1435
|
|
|
1433
1436
|
// src/hooks/use-render-tool-call.tsx
|
|
1434
|
-
var
|
|
1437
|
+
var import_react8 = __toESM(require("react"));
|
|
1435
1438
|
var import_core2 = require("@copilotkitnext/core");
|
|
1436
1439
|
|
|
1437
1440
|
// src/providers/CopilotKitProvider.tsx
|
|
1438
|
-
var
|
|
1439
|
-
var
|
|
1441
|
+
var import_react7 = require("react");
|
|
1442
|
+
var import_zod2 = require("zod");
|
|
1440
1443
|
|
|
1441
1444
|
// src/lib/react-core.ts
|
|
1442
1445
|
var import_core = require("@copilotkitnext/core");
|
|
@@ -1508,18 +1511,289 @@ var CopilotKitInspector = ({ core, ...rest }) => {
|
|
|
1508
1511
|
};
|
|
1509
1512
|
CopilotKitInspector.displayName = "CopilotKitInspector";
|
|
1510
1513
|
|
|
1511
|
-
// src/
|
|
1514
|
+
// src/components/MCPAppsActivityRenderer.tsx
|
|
1515
|
+
var import_react6 = require("react");
|
|
1516
|
+
var import_zod = require("zod");
|
|
1512
1517
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1518
|
+
var PROTOCOL_VERSION = "2025-06-18";
|
|
1519
|
+
var MCPAppsActivityType = "mcp-apps";
|
|
1520
|
+
var MCPAppsActivityContentSchema = import_zod.z.object({
|
|
1521
|
+
result: import_zod.z.object({
|
|
1522
|
+
content: import_zod.z.array(import_zod.z.any()).optional(),
|
|
1523
|
+
structuredContent: import_zod.z.any().optional(),
|
|
1524
|
+
isError: import_zod.z.boolean().optional()
|
|
1525
|
+
}),
|
|
1526
|
+
resource: import_zod.z.object({
|
|
1527
|
+
uri: import_zod.z.string(),
|
|
1528
|
+
mimeType: import_zod.z.string().optional(),
|
|
1529
|
+
text: import_zod.z.string().optional(),
|
|
1530
|
+
blob: import_zod.z.string().optional()
|
|
1531
|
+
}),
|
|
1532
|
+
// Server ID for proxying requests (MD5 hash of server config)
|
|
1533
|
+
serverId: import_zod.z.string().optional(),
|
|
1534
|
+
// Original tool input arguments
|
|
1535
|
+
toolInput: import_zod.z.record(import_zod.z.unknown()).optional()
|
|
1536
|
+
});
|
|
1537
|
+
function isRequest(msg) {
|
|
1538
|
+
return "id" in msg && "method" in msg;
|
|
1539
|
+
}
|
|
1540
|
+
function isNotification(msg) {
|
|
1541
|
+
return !("id" in msg) && "method" in msg;
|
|
1542
|
+
}
|
|
1543
|
+
function extractHtmlFromResource(resource) {
|
|
1544
|
+
if (resource.text) {
|
|
1545
|
+
return resource.text;
|
|
1546
|
+
}
|
|
1547
|
+
if (resource.blob) {
|
|
1548
|
+
return atob(resource.blob);
|
|
1549
|
+
}
|
|
1550
|
+
throw new Error("Resource has no text or blob content");
|
|
1551
|
+
}
|
|
1552
|
+
var MCPAppsActivityRenderer = ({ content, agent }) => {
|
|
1553
|
+
const containerRef = (0, import_react6.useRef)(null);
|
|
1554
|
+
const iframeRef = (0, import_react6.useRef)(null);
|
|
1555
|
+
const [iframeReady, setIframeReady] = (0, import_react6.useState)(false);
|
|
1556
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
1557
|
+
const [iframeSize, setIframeSize] = (0, import_react6.useState)({});
|
|
1558
|
+
const contentRef = (0, import_react6.useRef)(content);
|
|
1559
|
+
contentRef.current = content;
|
|
1560
|
+
const agentRef = (0, import_react6.useRef)(agent);
|
|
1561
|
+
agentRef.current = agent;
|
|
1562
|
+
const sendToIframe = (0, import_react6.useCallback)((msg) => {
|
|
1563
|
+
if (iframeRef.current?.contentWindow) {
|
|
1564
|
+
console.log("[MCPAppsRenderer] Sending to iframe:", msg);
|
|
1565
|
+
iframeRef.current.contentWindow.postMessage(msg, "*");
|
|
1566
|
+
}
|
|
1567
|
+
}, []);
|
|
1568
|
+
const sendResponse = (0, import_react6.useCallback)((id, result) => {
|
|
1569
|
+
sendToIframe({
|
|
1570
|
+
jsonrpc: "2.0",
|
|
1571
|
+
id,
|
|
1572
|
+
result
|
|
1573
|
+
});
|
|
1574
|
+
}, [sendToIframe]);
|
|
1575
|
+
const sendErrorResponse = (0, import_react6.useCallback)((id, code, message) => {
|
|
1576
|
+
sendToIframe({
|
|
1577
|
+
jsonrpc: "2.0",
|
|
1578
|
+
id,
|
|
1579
|
+
error: { code, message }
|
|
1580
|
+
});
|
|
1581
|
+
}, [sendToIframe]);
|
|
1582
|
+
const sendNotification = (0, import_react6.useCallback)((method, params) => {
|
|
1583
|
+
sendToIframe({
|
|
1584
|
+
jsonrpc: "2.0",
|
|
1585
|
+
method,
|
|
1586
|
+
params: params || {}
|
|
1587
|
+
});
|
|
1588
|
+
}, [sendToIframe]);
|
|
1589
|
+
(0, import_react6.useEffect)(() => {
|
|
1590
|
+
if (!containerRef.current) return;
|
|
1591
|
+
let mounted = true;
|
|
1592
|
+
let messageHandler = null;
|
|
1593
|
+
const setup = async () => {
|
|
1594
|
+
try {
|
|
1595
|
+
const iframe = document.createElement("iframe");
|
|
1596
|
+
iframe.style.width = "100%";
|
|
1597
|
+
iframe.style.height = "300px";
|
|
1598
|
+
iframe.style.border = "none";
|
|
1599
|
+
iframe.style.backgroundColor = "transparent";
|
|
1600
|
+
iframe.setAttribute("sandbox", "allow-scripts allow-same-origin allow-forms");
|
|
1601
|
+
const sandboxReady = new Promise((resolve) => {
|
|
1602
|
+
const initialListener = (event) => {
|
|
1603
|
+
if (event.source === iframe.contentWindow) {
|
|
1604
|
+
if (event.data?.method === "ui/notifications/sandbox-proxy-ready") {
|
|
1605
|
+
window.removeEventListener("message", initialListener);
|
|
1606
|
+
resolve();
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
window.addEventListener("message", initialListener);
|
|
1611
|
+
});
|
|
1612
|
+
iframe.src = "/sandbox.html";
|
|
1613
|
+
iframeRef.current = iframe;
|
|
1614
|
+
containerRef.current?.appendChild(iframe);
|
|
1615
|
+
await sandboxReady;
|
|
1616
|
+
if (!mounted) return;
|
|
1617
|
+
console.log("[MCPAppsRenderer] Sandbox proxy ready");
|
|
1618
|
+
messageHandler = async (event) => {
|
|
1619
|
+
if (event.source !== iframe.contentWindow) return;
|
|
1620
|
+
const msg = event.data;
|
|
1621
|
+
if (!msg || typeof msg !== "object" || msg.jsonrpc !== "2.0") return;
|
|
1622
|
+
console.log("[MCPAppsRenderer] Received from iframe:", msg);
|
|
1623
|
+
if (isRequest(msg)) {
|
|
1624
|
+
switch (msg.method) {
|
|
1625
|
+
case "ui/initialize": {
|
|
1626
|
+
sendResponse(msg.id, {
|
|
1627
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
1628
|
+
hostInfo: {
|
|
1629
|
+
name: "CopilotKit MCP Apps Host",
|
|
1630
|
+
version: "1.0.0"
|
|
1631
|
+
},
|
|
1632
|
+
hostCapabilities: {
|
|
1633
|
+
openLinks: {},
|
|
1634
|
+
logging: {}
|
|
1635
|
+
},
|
|
1636
|
+
hostContext: {
|
|
1637
|
+
theme: "light",
|
|
1638
|
+
platform: "web"
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
break;
|
|
1642
|
+
}
|
|
1643
|
+
case "ui/message": {
|
|
1644
|
+
console.log("[MCPAppsRenderer] ui/message request:", msg.params);
|
|
1645
|
+
sendResponse(msg.id, { isError: false });
|
|
1646
|
+
break;
|
|
1647
|
+
}
|
|
1648
|
+
case "ui/open-link": {
|
|
1649
|
+
const url = msg.params?.url;
|
|
1650
|
+
if (url) {
|
|
1651
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
1652
|
+
sendResponse(msg.id, { isError: false });
|
|
1653
|
+
} else {
|
|
1654
|
+
sendErrorResponse(msg.id, -32602, "Missing url parameter");
|
|
1655
|
+
}
|
|
1656
|
+
break;
|
|
1657
|
+
}
|
|
1658
|
+
case "tools/call": {
|
|
1659
|
+
const { serverId } = contentRef.current;
|
|
1660
|
+
const currentAgent = agentRef.current;
|
|
1661
|
+
if (!serverId) {
|
|
1662
|
+
sendErrorResponse(msg.id, -32603, "No server ID available for proxying");
|
|
1663
|
+
break;
|
|
1664
|
+
}
|
|
1665
|
+
if (!currentAgent) {
|
|
1666
|
+
sendErrorResponse(msg.id, -32603, "No agent available for proxying");
|
|
1667
|
+
break;
|
|
1668
|
+
}
|
|
1669
|
+
try {
|
|
1670
|
+
const runResult = await currentAgent.runAgent({
|
|
1671
|
+
forwardedProps: {
|
|
1672
|
+
__proxiedMCPRequest: {
|
|
1673
|
+
serverId,
|
|
1674
|
+
method: "tools/call",
|
|
1675
|
+
params: msg.params
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
});
|
|
1679
|
+
sendResponse(msg.id, runResult.result || {});
|
|
1680
|
+
} catch (err) {
|
|
1681
|
+
console.error("[MCPAppsRenderer] tools/call error:", err);
|
|
1682
|
+
sendErrorResponse(msg.id, -32603, String(err));
|
|
1683
|
+
}
|
|
1684
|
+
break;
|
|
1685
|
+
}
|
|
1686
|
+
default:
|
|
1687
|
+
sendErrorResponse(msg.id, -32601, `Method not found: ${msg.method}`);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
if (isNotification(msg)) {
|
|
1691
|
+
switch (msg.method) {
|
|
1692
|
+
case "ui/notifications/initialized": {
|
|
1693
|
+
console.log("[MCPAppsRenderer] Inner iframe initialized");
|
|
1694
|
+
if (mounted) {
|
|
1695
|
+
setIframeReady(true);
|
|
1696
|
+
}
|
|
1697
|
+
break;
|
|
1698
|
+
}
|
|
1699
|
+
case "ui/notifications/size-change": {
|
|
1700
|
+
const { width, height } = msg.params || {};
|
|
1701
|
+
console.log("[MCPAppsRenderer] Size change:", { width, height });
|
|
1702
|
+
if (mounted) {
|
|
1703
|
+
setIframeSize({
|
|
1704
|
+
width: typeof width === "number" ? width : void 0,
|
|
1705
|
+
height: typeof height === "number" ? height : void 0
|
|
1706
|
+
});
|
|
1707
|
+
}
|
|
1708
|
+
break;
|
|
1709
|
+
}
|
|
1710
|
+
case "notifications/message": {
|
|
1711
|
+
console.log("[MCPAppsRenderer] App log:", msg.params);
|
|
1712
|
+
break;
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
};
|
|
1717
|
+
window.addEventListener("message", messageHandler);
|
|
1718
|
+
const html = extractHtmlFromResource(content.resource);
|
|
1719
|
+
sendNotification("ui/notifications/sandbox-resource-ready", { html });
|
|
1720
|
+
} catch (err) {
|
|
1721
|
+
console.error("[MCPAppsRenderer] Setup error:", err);
|
|
1722
|
+
if (mounted) {
|
|
1723
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
};
|
|
1727
|
+
setup();
|
|
1728
|
+
return () => {
|
|
1729
|
+
mounted = false;
|
|
1730
|
+
if (messageHandler) {
|
|
1731
|
+
window.removeEventListener("message", messageHandler);
|
|
1732
|
+
}
|
|
1733
|
+
if (iframeRef.current && containerRef.current?.contains(iframeRef.current)) {
|
|
1734
|
+
containerRef.current.removeChild(iframeRef.current);
|
|
1735
|
+
}
|
|
1736
|
+
iframeRef.current = null;
|
|
1737
|
+
};
|
|
1738
|
+
}, [content.resource, sendNotification, sendResponse, sendErrorResponse]);
|
|
1739
|
+
(0, import_react6.useEffect)(() => {
|
|
1740
|
+
if (iframeRef.current) {
|
|
1741
|
+
if (iframeSize.width !== void 0) {
|
|
1742
|
+
iframeRef.current.style.width = `${iframeSize.width}px`;
|
|
1743
|
+
}
|
|
1744
|
+
if (iframeSize.height !== void 0) {
|
|
1745
|
+
iframeRef.current.style.height = `${iframeSize.height}px`;
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
}, [iframeSize]);
|
|
1749
|
+
(0, import_react6.useEffect)(() => {
|
|
1750
|
+
if (iframeReady && content.toolInput) {
|
|
1751
|
+
console.log("[MCPAppsRenderer] Sending tool input:", content.toolInput);
|
|
1752
|
+
sendNotification("ui/notifications/tool-input", {
|
|
1753
|
+
arguments: content.toolInput
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1756
|
+
}, [iframeReady, content.toolInput, sendNotification]);
|
|
1757
|
+
(0, import_react6.useEffect)(() => {
|
|
1758
|
+
if (iframeReady && content.result) {
|
|
1759
|
+
console.log("[MCPAppsRenderer] Sending tool result:", content.result);
|
|
1760
|
+
sendNotification("ui/notifications/tool-result", content.result);
|
|
1761
|
+
}
|
|
1762
|
+
}, [iframeReady, content.result, sendNotification]);
|
|
1763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1764
|
+
"div",
|
|
1765
|
+
{
|
|
1766
|
+
ref: containerRef,
|
|
1767
|
+
style: {
|
|
1768
|
+
width: "100%",
|
|
1769
|
+
minHeight: "100px",
|
|
1770
|
+
borderRadius: "8px",
|
|
1771
|
+
overflow: "hidden",
|
|
1772
|
+
backgroundColor: "#f9f9f9",
|
|
1773
|
+
border: "1px solid #e0e0e0"
|
|
1774
|
+
},
|
|
1775
|
+
children: error && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { style: { color: "red", padding: "1rem" }, children: [
|
|
1776
|
+
"Error: ",
|
|
1777
|
+
error.message
|
|
1778
|
+
] })
|
|
1779
|
+
}
|
|
1780
|
+
);
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1783
|
+
// src/providers/CopilotKitProvider.tsx
|
|
1784
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1513
1785
|
var HEADER_NAME = "X-CopilotCloud-Public-Api-Key";
|
|
1514
1786
|
var COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
|
|
1515
|
-
var
|
|
1516
|
-
|
|
1787
|
+
var EMPTY_SET = /* @__PURE__ */ new Set();
|
|
1788
|
+
var CopilotKitContext = (0, import_react7.createContext)({
|
|
1789
|
+
copilotkit: null,
|
|
1790
|
+
executingToolCallIds: EMPTY_SET
|
|
1517
1791
|
});
|
|
1518
1792
|
function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
|
|
1519
|
-
const empty = (0,
|
|
1793
|
+
const empty = (0, import_react7.useMemo)(() => [], []);
|
|
1520
1794
|
const value = prop ?? empty;
|
|
1521
|
-
const initial = (0,
|
|
1522
|
-
(0,
|
|
1795
|
+
const initial = (0, import_react7.useRef)(value);
|
|
1796
|
+
(0, import_react7.useEffect)(() => {
|
|
1523
1797
|
if (warningMessage && value !== initial.current && (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)) {
|
|
1524
1798
|
console.error(warningMessage);
|
|
1525
1799
|
}
|
|
@@ -1542,8 +1816,8 @@ var CopilotKitProvider = ({
|
|
|
1542
1816
|
showDevConsole = false,
|
|
1543
1817
|
useSingleEndpoint = false
|
|
1544
1818
|
}) => {
|
|
1545
|
-
const [shouldRenderInspector, setShouldRenderInspector] = (0,
|
|
1546
|
-
(0,
|
|
1819
|
+
const [shouldRenderInspector, setShouldRenderInspector] = (0, import_react7.useState)(false);
|
|
1820
|
+
(0, import_react7.useEffect)(() => {
|
|
1547
1821
|
if (typeof window === "undefined") {
|
|
1548
1822
|
return;
|
|
1549
1823
|
}
|
|
@@ -1581,9 +1855,19 @@ var CopilotKitProvider = ({
|
|
|
1581
1855
|
renderActivityMessages,
|
|
1582
1856
|
"renderActivityMessages must be a stable array."
|
|
1583
1857
|
);
|
|
1858
|
+
const builtInActivityRenderers = (0, import_react7.useMemo)(() => [
|
|
1859
|
+
{
|
|
1860
|
+
activityType: MCPAppsActivityType,
|
|
1861
|
+
content: MCPAppsActivityContentSchema,
|
|
1862
|
+
render: MCPAppsActivityRenderer
|
|
1863
|
+
}
|
|
1864
|
+
], []);
|
|
1865
|
+
const allActivityRenderers = (0, import_react7.useMemo)(() => {
|
|
1866
|
+
return [...renderActivityMessagesList, ...builtInActivityRenderers];
|
|
1867
|
+
}, [renderActivityMessagesList, builtInActivityRenderers]);
|
|
1584
1868
|
const resolvedPublicKey = publicApiKey ?? publicLicenseKey;
|
|
1585
1869
|
const hasLocalAgents = agents && Object.keys(agents).length > 0;
|
|
1586
|
-
const mergedHeaders = (0,
|
|
1870
|
+
const mergedHeaders = (0, import_react7.useMemo)(() => {
|
|
1587
1871
|
if (!resolvedPublicKey) return headers;
|
|
1588
1872
|
if (headers[HEADER_NAME]) return headers;
|
|
1589
1873
|
return {
|
|
@@ -1608,7 +1892,7 @@ var CopilotKitProvider = ({
|
|
|
1608
1892
|
humanInTheLoop,
|
|
1609
1893
|
"humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead."
|
|
1610
1894
|
);
|
|
1611
|
-
const processedHumanInTheLoopTools = (0,
|
|
1895
|
+
const processedHumanInTheLoopTools = (0, import_react7.useMemo)(() => {
|
|
1612
1896
|
const processedTools = [];
|
|
1613
1897
|
const processedRenderToolCalls = [];
|
|
1614
1898
|
humanInTheLoopList.forEach((tool) => {
|
|
@@ -1637,17 +1921,17 @@ var CopilotKitProvider = ({
|
|
|
1637
1921
|
});
|
|
1638
1922
|
return { tools: processedTools, renderToolCalls: processedRenderToolCalls };
|
|
1639
1923
|
}, [humanInTheLoopList]);
|
|
1640
|
-
const allTools = (0,
|
|
1924
|
+
const allTools = (0, import_react7.useMemo)(() => {
|
|
1641
1925
|
const tools = [];
|
|
1642
1926
|
tools.push(...frontendToolsList);
|
|
1643
1927
|
tools.push(...processedHumanInTheLoopTools.tools);
|
|
1644
1928
|
return tools;
|
|
1645
1929
|
}, [frontendToolsList, processedHumanInTheLoopTools]);
|
|
1646
|
-
const allRenderToolCalls = (0,
|
|
1930
|
+
const allRenderToolCalls = (0, import_react7.useMemo)(() => {
|
|
1647
1931
|
const combined = [...renderToolCallsList];
|
|
1648
1932
|
frontendToolsList.forEach((tool) => {
|
|
1649
1933
|
if (tool.render) {
|
|
1650
|
-
const args = tool.parameters || (tool.name === "*" ?
|
|
1934
|
+
const args = tool.parameters || (tool.name === "*" ? import_zod2.z.any() : void 0);
|
|
1651
1935
|
if (args) {
|
|
1652
1936
|
combined.push({
|
|
1653
1937
|
name: tool.name,
|
|
@@ -1660,7 +1944,7 @@ var CopilotKitProvider = ({
|
|
|
1660
1944
|
combined.push(...processedHumanInTheLoopTools.renderToolCalls);
|
|
1661
1945
|
return combined;
|
|
1662
1946
|
}, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);
|
|
1663
|
-
const copilotkit = (0,
|
|
1947
|
+
const copilotkit = (0, import_react7.useMemo)(() => {
|
|
1664
1948
|
const copilotkit2 = new CopilotKitCoreReact({
|
|
1665
1949
|
runtimeUrl: chatApiEndpoint,
|
|
1666
1950
|
runtimeTransport: useSingleEndpoint ? "single" : "rest",
|
|
@@ -1669,13 +1953,13 @@ var CopilotKitProvider = ({
|
|
|
1669
1953
|
agents__unsafe_dev_only: agents,
|
|
1670
1954
|
tools: allTools,
|
|
1671
1955
|
renderToolCalls: allRenderToolCalls,
|
|
1672
|
-
renderActivityMessages:
|
|
1956
|
+
renderActivityMessages: allActivityRenderers,
|
|
1673
1957
|
renderCustomMessages: renderCustomMessagesList
|
|
1674
1958
|
});
|
|
1675
1959
|
return copilotkit2;
|
|
1676
|
-
}, [allTools, allRenderToolCalls,
|
|
1677
|
-
const [, forceUpdate] = (0,
|
|
1678
|
-
(0,
|
|
1960
|
+
}, [allTools, allRenderToolCalls, allActivityRenderers, renderCustomMessagesList, useSingleEndpoint]);
|
|
1961
|
+
const [, forceUpdate] = (0, import_react7.useReducer)((x) => x + 1, 0);
|
|
1962
|
+
(0, import_react7.useEffect)(() => {
|
|
1679
1963
|
const subscription = copilotkit.subscribe({
|
|
1680
1964
|
onRenderToolCallsChanged: () => {
|
|
1681
1965
|
forceUpdate();
|
|
@@ -1685,33 +1969,58 @@ var CopilotKitProvider = ({
|
|
|
1685
1969
|
subscription.unsubscribe();
|
|
1686
1970
|
};
|
|
1687
1971
|
}, [copilotkit]);
|
|
1688
|
-
(0,
|
|
1972
|
+
const [executingToolCallIds, setExecutingToolCallIds] = (0, import_react7.useState)(() => /* @__PURE__ */ new Set());
|
|
1973
|
+
(0, import_react7.useEffect)(() => {
|
|
1974
|
+
const subscription = copilotkit.subscribe({
|
|
1975
|
+
onToolExecutionStart: ({ toolCallId }) => {
|
|
1976
|
+
setExecutingToolCallIds((prev) => {
|
|
1977
|
+
if (prev.has(toolCallId)) return prev;
|
|
1978
|
+
const next = new Set(prev);
|
|
1979
|
+
next.add(toolCallId);
|
|
1980
|
+
return next;
|
|
1981
|
+
});
|
|
1982
|
+
},
|
|
1983
|
+
onToolExecutionEnd: ({ toolCallId }) => {
|
|
1984
|
+
setExecutingToolCallIds((prev) => {
|
|
1985
|
+
if (!prev.has(toolCallId)) return prev;
|
|
1986
|
+
const next = new Set(prev);
|
|
1987
|
+
next.delete(toolCallId);
|
|
1988
|
+
return next;
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
});
|
|
1992
|
+
return () => {
|
|
1993
|
+
subscription.unsubscribe();
|
|
1994
|
+
};
|
|
1995
|
+
}, [copilotkit]);
|
|
1996
|
+
(0, import_react7.useEffect)(() => {
|
|
1689
1997
|
copilotkit.setRuntimeUrl(chatApiEndpoint);
|
|
1690
1998
|
copilotkit.setRuntimeTransport(useSingleEndpoint ? "single" : "rest");
|
|
1691
1999
|
copilotkit.setHeaders(mergedHeaders);
|
|
1692
2000
|
copilotkit.setProperties(properties);
|
|
1693
2001
|
copilotkit.setAgents__unsafe_dev_only(agents);
|
|
1694
2002
|
}, [chatApiEndpoint, mergedHeaders, properties, agents, useSingleEndpoint]);
|
|
1695
|
-
return /* @__PURE__ */ (0,
|
|
2003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
1696
2004
|
CopilotKitContext.Provider,
|
|
1697
2005
|
{
|
|
1698
2006
|
value: {
|
|
1699
|
-
copilotkit
|
|
2007
|
+
copilotkit,
|
|
2008
|
+
executingToolCallIds
|
|
1700
2009
|
},
|
|
1701
2010
|
children: [
|
|
1702
2011
|
children,
|
|
1703
|
-
shouldRenderInspector ? /* @__PURE__ */ (0,
|
|
2012
|
+
shouldRenderInspector ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CopilotKitInspector, { core: copilotkit }) : null
|
|
1704
2013
|
]
|
|
1705
2014
|
}
|
|
1706
2015
|
);
|
|
1707
2016
|
};
|
|
1708
2017
|
var useCopilotKit = () => {
|
|
1709
|
-
const context = (0,
|
|
1710
|
-
const [, forceUpdate] = (0,
|
|
2018
|
+
const context = (0, import_react7.useContext)(CopilotKitContext);
|
|
2019
|
+
const [, forceUpdate] = (0, import_react7.useReducer)((x) => x + 1, 0);
|
|
1711
2020
|
if (!context) {
|
|
1712
2021
|
throw new Error("useCopilotKit must be used within CopilotKitProvider");
|
|
1713
2022
|
}
|
|
1714
|
-
(0,
|
|
2023
|
+
(0, import_react7.useEffect)(() => {
|
|
1715
2024
|
const subscription = context.copilotkit.subscribe({
|
|
1716
2025
|
onRuntimeConnectionStatusChanged: () => {
|
|
1717
2026
|
forceUpdate();
|
|
@@ -1727,21 +2036,21 @@ var useCopilotKit = () => {
|
|
|
1727
2036
|
// src/hooks/use-render-tool-call.tsx
|
|
1728
2037
|
var import_shared2 = require("@copilotkitnext/shared");
|
|
1729
2038
|
var import_shared3 = require("@copilotkitnext/shared");
|
|
1730
|
-
var
|
|
1731
|
-
var ToolCallRenderer =
|
|
2039
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2040
|
+
var ToolCallRenderer = import_react8.default.memo(
|
|
1732
2041
|
function ToolCallRenderer2({
|
|
1733
2042
|
toolCall,
|
|
1734
2043
|
toolMessage,
|
|
1735
2044
|
RenderComponent,
|
|
1736
2045
|
isExecuting
|
|
1737
2046
|
}) {
|
|
1738
|
-
const args = (0,
|
|
2047
|
+
const args = (0, import_react8.useMemo)(
|
|
1739
2048
|
() => (0, import_shared3.partialJSONParse)(toolCall.function.arguments),
|
|
1740
2049
|
[toolCall.function.arguments]
|
|
1741
2050
|
);
|
|
1742
2051
|
const toolName = toolCall.function.name;
|
|
1743
2052
|
if (toolMessage) {
|
|
1744
|
-
return /* @__PURE__ */ (0,
|
|
2053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1745
2054
|
RenderComponent,
|
|
1746
2055
|
{
|
|
1747
2056
|
name: toolName,
|
|
@@ -1751,7 +2060,7 @@ var ToolCallRenderer = import_react7.default.memo(
|
|
|
1751
2060
|
}
|
|
1752
2061
|
);
|
|
1753
2062
|
} else if (isExecuting) {
|
|
1754
|
-
return /* @__PURE__ */ (0,
|
|
2063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1755
2064
|
RenderComponent,
|
|
1756
2065
|
{
|
|
1757
2066
|
name: toolName,
|
|
@@ -1761,7 +2070,7 @@ var ToolCallRenderer = import_react7.default.memo(
|
|
|
1761
2070
|
}
|
|
1762
2071
|
);
|
|
1763
2072
|
} else {
|
|
1764
|
-
return /* @__PURE__ */ (0,
|
|
2073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1765
2074
|
RenderComponent,
|
|
1766
2075
|
{
|
|
1767
2076
|
name: toolName,
|
|
@@ -1786,11 +2095,10 @@ var ToolCallRenderer = import_react7.default.memo(
|
|
|
1786
2095
|
}
|
|
1787
2096
|
);
|
|
1788
2097
|
function useRenderToolCall() {
|
|
1789
|
-
const { copilotkit } = useCopilotKit();
|
|
2098
|
+
const { copilotkit, executingToolCallIds } = useCopilotKit();
|
|
1790
2099
|
const config = useCopilotChatConfiguration();
|
|
1791
2100
|
const agentId = config?.agentId ?? import_shared2.DEFAULT_AGENT_ID;
|
|
1792
|
-
const
|
|
1793
|
-
const renderToolCalls = (0, import_react7.useSyncExternalStore)(
|
|
2101
|
+
const renderToolCalls = (0, import_react8.useSyncExternalStore)(
|
|
1794
2102
|
(callback) => {
|
|
1795
2103
|
return copilotkit.subscribe({
|
|
1796
2104
|
onRenderToolCallsChanged: callback
|
|
@@ -1799,28 +2107,7 @@ function useRenderToolCall() {
|
|
|
1799
2107
|
() => copilotkit.renderToolCalls,
|
|
1800
2108
|
() => copilotkit.renderToolCalls
|
|
1801
2109
|
);
|
|
1802
|
-
(0,
|
|
1803
|
-
const subscription = copilotkit.subscribe({
|
|
1804
|
-
onToolExecutionStart: ({ toolCallId }) => {
|
|
1805
|
-
setExecutingToolCallIds((prev) => {
|
|
1806
|
-
if (prev.has(toolCallId)) return prev;
|
|
1807
|
-
const next = new Set(prev);
|
|
1808
|
-
next.add(toolCallId);
|
|
1809
|
-
return next;
|
|
1810
|
-
});
|
|
1811
|
-
},
|
|
1812
|
-
onToolExecutionEnd: ({ toolCallId }) => {
|
|
1813
|
-
setExecutingToolCallIds((prev) => {
|
|
1814
|
-
if (!prev.has(toolCallId)) return prev;
|
|
1815
|
-
const next = new Set(prev);
|
|
1816
|
-
next.delete(toolCallId);
|
|
1817
|
-
return next;
|
|
1818
|
-
});
|
|
1819
|
-
}
|
|
1820
|
-
});
|
|
1821
|
-
return () => subscription.unsubscribe();
|
|
1822
|
-
}, [copilotkit]);
|
|
1823
|
-
const renderToolCall = (0, import_react7.useCallback)(
|
|
2110
|
+
const renderToolCall = (0, import_react8.useCallback)(
|
|
1824
2111
|
({
|
|
1825
2112
|
toolCall,
|
|
1826
2113
|
toolMessage
|
|
@@ -1834,7 +2121,7 @@ function useRenderToolCall() {
|
|
|
1834
2121
|
}
|
|
1835
2122
|
const RenderComponent = renderConfig.render;
|
|
1836
2123
|
const isExecuting = executingToolCallIds.has(toolCall.id);
|
|
1837
|
-
return /* @__PURE__ */ (0,
|
|
2124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1838
2125
|
ToolCallRenderer,
|
|
1839
2126
|
{
|
|
1840
2127
|
toolCall,
|
|
@@ -1851,7 +2138,7 @@ function useRenderToolCall() {
|
|
|
1851
2138
|
}
|
|
1852
2139
|
|
|
1853
2140
|
// src/hooks/use-render-custom-messages.tsx
|
|
1854
|
-
var
|
|
2141
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1855
2142
|
function useRenderCustomMessages() {
|
|
1856
2143
|
const { copilotkit } = useCopilotKit();
|
|
1857
2144
|
const config = useCopilotChatConfiguration();
|
|
@@ -1886,7 +2173,7 @@ function useRenderCustomMessages() {
|
|
|
1886
2173
|
continue;
|
|
1887
2174
|
}
|
|
1888
2175
|
const Component = renderer.render;
|
|
1889
|
-
result = /* @__PURE__ */ (0,
|
|
2176
|
+
result = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1890
2177
|
Component,
|
|
1891
2178
|
{
|
|
1892
2179
|
message,
|
|
@@ -1910,14 +2197,14 @@ function useRenderCustomMessages() {
|
|
|
1910
2197
|
|
|
1911
2198
|
// src/hooks/use-render-activity-message.tsx
|
|
1912
2199
|
var import_shared4 = require("@copilotkitnext/shared");
|
|
1913
|
-
var
|
|
1914
|
-
var
|
|
2200
|
+
var import_react9 = require("react");
|
|
2201
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1915
2202
|
function useRenderActivityMessage() {
|
|
1916
2203
|
const { copilotkit } = useCopilotKit();
|
|
1917
2204
|
const config = useCopilotChatConfiguration();
|
|
1918
2205
|
const agentId = config?.agentId ?? import_shared4.DEFAULT_AGENT_ID;
|
|
1919
2206
|
const renderers = copilotkit.renderActivityMessages;
|
|
1920
|
-
return (0,
|
|
2207
|
+
return (0, import_react9.useCallback)(
|
|
1921
2208
|
(message) => {
|
|
1922
2209
|
if (!renderers.length) {
|
|
1923
2210
|
return null;
|
|
@@ -1939,7 +2226,7 @@ function useRenderActivityMessage() {
|
|
|
1939
2226
|
}
|
|
1940
2227
|
const Component = renderer.render;
|
|
1941
2228
|
const agent = copilotkit.getAgent(agentId);
|
|
1942
|
-
return /* @__PURE__ */ (0,
|
|
2229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1943
2230
|
Component,
|
|
1944
2231
|
{
|
|
1945
2232
|
activityType: message.activityType,
|
|
@@ -1955,12 +2242,12 @@ function useRenderActivityMessage() {
|
|
|
1955
2242
|
}
|
|
1956
2243
|
|
|
1957
2244
|
// src/hooks/use-frontend-tool.tsx
|
|
1958
|
-
var
|
|
2245
|
+
var import_react10 = require("react");
|
|
1959
2246
|
var EMPTY_DEPS = [];
|
|
1960
2247
|
function useFrontendTool(tool, deps) {
|
|
1961
2248
|
const { copilotkit } = useCopilotKit();
|
|
1962
2249
|
const extraDeps = deps ?? EMPTY_DEPS;
|
|
1963
|
-
(0,
|
|
2250
|
+
(0, import_react10.useEffect)(() => {
|
|
1964
2251
|
const name = tool.name;
|
|
1965
2252
|
if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {
|
|
1966
2253
|
console.warn(
|
|
@@ -1992,23 +2279,23 @@ function useFrontendTool(tool, deps) {
|
|
|
1992
2279
|
}
|
|
1993
2280
|
|
|
1994
2281
|
// src/hooks/use-human-in-the-loop.tsx
|
|
1995
|
-
var
|
|
1996
|
-
var
|
|
2282
|
+
var import_react11 = require("react");
|
|
2283
|
+
var import_react12 = __toESM(require("react"));
|
|
1997
2284
|
function useHumanInTheLoop(tool, deps) {
|
|
1998
2285
|
const { copilotkit } = useCopilotKit();
|
|
1999
|
-
const resolvePromiseRef = (0,
|
|
2000
|
-
const respond = (0,
|
|
2286
|
+
const resolvePromiseRef = (0, import_react11.useRef)(null);
|
|
2287
|
+
const respond = (0, import_react11.useCallback)(async (result) => {
|
|
2001
2288
|
if (resolvePromiseRef.current) {
|
|
2002
2289
|
resolvePromiseRef.current(result);
|
|
2003
2290
|
resolvePromiseRef.current = null;
|
|
2004
2291
|
}
|
|
2005
2292
|
}, []);
|
|
2006
|
-
const handler = (0,
|
|
2293
|
+
const handler = (0, import_react11.useCallback)(async () => {
|
|
2007
2294
|
return new Promise((resolve) => {
|
|
2008
2295
|
resolvePromiseRef.current = resolve;
|
|
2009
2296
|
});
|
|
2010
2297
|
}, []);
|
|
2011
|
-
const RenderComponent = (0,
|
|
2298
|
+
const RenderComponent = (0, import_react11.useCallback)(
|
|
2012
2299
|
(props) => {
|
|
2013
2300
|
const ToolComponent = tool.render;
|
|
2014
2301
|
if (props.status === "inProgress") {
|
|
@@ -2018,7 +2305,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
2018
2305
|
description: tool.description || "",
|
|
2019
2306
|
respond: void 0
|
|
2020
2307
|
};
|
|
2021
|
-
return
|
|
2308
|
+
return import_react12.default.createElement(ToolComponent, enhancedProps);
|
|
2022
2309
|
} else if (props.status === "executing") {
|
|
2023
2310
|
const enhancedProps = {
|
|
2024
2311
|
...props,
|
|
@@ -2026,7 +2313,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
2026
2313
|
description: tool.description || "",
|
|
2027
2314
|
respond
|
|
2028
2315
|
};
|
|
2029
|
-
return
|
|
2316
|
+
return import_react12.default.createElement(ToolComponent, enhancedProps);
|
|
2030
2317
|
} else if (props.status === "complete") {
|
|
2031
2318
|
const enhancedProps = {
|
|
2032
2319
|
...props,
|
|
@@ -2034,9 +2321,9 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
2034
2321
|
description: tool.description || "",
|
|
2035
2322
|
respond: void 0
|
|
2036
2323
|
};
|
|
2037
|
-
return
|
|
2324
|
+
return import_react12.default.createElement(ToolComponent, enhancedProps);
|
|
2038
2325
|
}
|
|
2039
|
-
return
|
|
2326
|
+
return import_react12.default.createElement(ToolComponent, props);
|
|
2040
2327
|
},
|
|
2041
2328
|
[tool.render, tool.name, tool.description, respond]
|
|
2042
2329
|
);
|
|
@@ -2046,7 +2333,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
2046
2333
|
render: RenderComponent
|
|
2047
2334
|
};
|
|
2048
2335
|
useFrontendTool(frontendTool, deps);
|
|
2049
|
-
(0,
|
|
2336
|
+
(0, import_react11.useEffect)(() => {
|
|
2050
2337
|
return () => {
|
|
2051
2338
|
const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
|
|
2052
2339
|
const currentRenderToolCalls = copilotkit.renderToolCalls;
|
|
@@ -2059,7 +2346,7 @@ function useHumanInTheLoop(tool, deps) {
|
|
|
2059
2346
|
}
|
|
2060
2347
|
|
|
2061
2348
|
// src/hooks/use-agent.tsx
|
|
2062
|
-
var
|
|
2349
|
+
var import_react13 = require("react");
|
|
2063
2350
|
var import_shared5 = require("@copilotkitnext/shared");
|
|
2064
2351
|
var import_core3 = require("@copilotkitnext/core");
|
|
2065
2352
|
var ALL_UPDATES = [
|
|
@@ -2070,12 +2357,12 @@ var ALL_UPDATES = [
|
|
|
2070
2357
|
function useAgent({ agentId, updates } = {}) {
|
|
2071
2358
|
agentId ??= import_shared5.DEFAULT_AGENT_ID;
|
|
2072
2359
|
const { copilotkit } = useCopilotKit();
|
|
2073
|
-
const [, forceUpdate] = (0,
|
|
2074
|
-
const updateFlags = (0,
|
|
2360
|
+
const [, forceUpdate] = (0, import_react13.useReducer)((x) => x + 1, 0);
|
|
2361
|
+
const updateFlags = (0, import_react13.useMemo)(
|
|
2075
2362
|
() => updates ?? ALL_UPDATES,
|
|
2076
2363
|
[JSON.stringify(updates)]
|
|
2077
2364
|
);
|
|
2078
|
-
const agent = (0,
|
|
2365
|
+
const agent = (0, import_react13.useMemo)(() => {
|
|
2079
2366
|
const existing = copilotkit.getAgent(agentId);
|
|
2080
2367
|
if (existing) {
|
|
2081
2368
|
return existing;
|
|
@@ -2105,7 +2392,7 @@ function useAgent({ agentId, updates } = {}) {
|
|
|
2105
2392
|
JSON.stringify(copilotkit.headers),
|
|
2106
2393
|
copilotkit
|
|
2107
2394
|
]);
|
|
2108
|
-
(0,
|
|
2395
|
+
(0, import_react13.useEffect)(() => {
|
|
2109
2396
|
if (updateFlags.length === 0) {
|
|
2110
2397
|
return;
|
|
2111
2398
|
}
|
|
@@ -2140,17 +2427,17 @@ function useAgent({ agentId, updates } = {}) {
|
|
|
2140
2427
|
}
|
|
2141
2428
|
|
|
2142
2429
|
// src/hooks/use-agent-context.tsx
|
|
2143
|
-
var
|
|
2430
|
+
var import_react14 = require("react");
|
|
2144
2431
|
function useAgentContext(context) {
|
|
2145
2432
|
const { description, value } = context;
|
|
2146
2433
|
const { copilotkit } = useCopilotKit();
|
|
2147
|
-
const stringValue = (0,
|
|
2434
|
+
const stringValue = (0, import_react14.useMemo)(() => {
|
|
2148
2435
|
if (typeof value === "string") {
|
|
2149
2436
|
return value;
|
|
2150
2437
|
}
|
|
2151
2438
|
return JSON.stringify(value);
|
|
2152
2439
|
}, [value]);
|
|
2153
|
-
(0,
|
|
2440
|
+
(0, import_react14.useEffect)(() => {
|
|
2154
2441
|
if (!copilotkit) return;
|
|
2155
2442
|
const id = copilotkit.addContext({ description, value: stringValue });
|
|
2156
2443
|
return () => {
|
|
@@ -2160,26 +2447,26 @@ function useAgentContext(context) {
|
|
|
2160
2447
|
}
|
|
2161
2448
|
|
|
2162
2449
|
// src/hooks/use-suggestions.tsx
|
|
2163
|
-
var
|
|
2450
|
+
var import_react15 = require("react");
|
|
2164
2451
|
var import_shared6 = require("@copilotkitnext/shared");
|
|
2165
2452
|
function useSuggestions({ agentId } = {}) {
|
|
2166
2453
|
const { copilotkit } = useCopilotKit();
|
|
2167
2454
|
const config = useCopilotChatConfiguration();
|
|
2168
|
-
const resolvedAgentId = (0,
|
|
2169
|
-
const [suggestions, setSuggestions] = (0,
|
|
2455
|
+
const resolvedAgentId = (0, import_react15.useMemo)(() => agentId ?? config?.agentId ?? import_shared6.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
|
|
2456
|
+
const [suggestions, setSuggestions] = (0, import_react15.useState)(() => {
|
|
2170
2457
|
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
2171
2458
|
return result.suggestions;
|
|
2172
2459
|
});
|
|
2173
|
-
const [isLoading, setIsLoading] = (0,
|
|
2460
|
+
const [isLoading, setIsLoading] = (0, import_react15.useState)(() => {
|
|
2174
2461
|
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
2175
2462
|
return result.isLoading;
|
|
2176
2463
|
});
|
|
2177
|
-
(0,
|
|
2464
|
+
(0, import_react15.useEffect)(() => {
|
|
2178
2465
|
const result = copilotkit.getSuggestions(resolvedAgentId);
|
|
2179
2466
|
setSuggestions(result.suggestions);
|
|
2180
2467
|
setIsLoading(result.isLoading);
|
|
2181
2468
|
}, [copilotkit, resolvedAgentId]);
|
|
2182
|
-
(0,
|
|
2469
|
+
(0, import_react15.useEffect)(() => {
|
|
2183
2470
|
const subscription = copilotkit.subscribe({
|
|
2184
2471
|
onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: suggestions2 }) => {
|
|
2185
2472
|
if (changedAgentId !== resolvedAgentId) {
|
|
@@ -2209,10 +2496,10 @@ function useSuggestions({ agentId } = {}) {
|
|
|
2209
2496
|
subscription.unsubscribe();
|
|
2210
2497
|
};
|
|
2211
2498
|
}, [copilotkit, resolvedAgentId]);
|
|
2212
|
-
const reloadSuggestions = (0,
|
|
2499
|
+
const reloadSuggestions = (0, import_react15.useCallback)(() => {
|
|
2213
2500
|
copilotkit.reloadSuggestions(resolvedAgentId);
|
|
2214
2501
|
}, [copilotkit, resolvedAgentId]);
|
|
2215
|
-
const clearSuggestions = (0,
|
|
2502
|
+
const clearSuggestions = (0, import_react15.useCallback)(() => {
|
|
2216
2503
|
copilotkit.clearSuggestions(resolvedAgentId);
|
|
2217
2504
|
}, [copilotkit, resolvedAgentId]);
|
|
2218
2505
|
return {
|
|
@@ -2224,19 +2511,19 @@ function useSuggestions({ agentId } = {}) {
|
|
|
2224
2511
|
}
|
|
2225
2512
|
|
|
2226
2513
|
// src/hooks/use-configure-suggestions.tsx
|
|
2227
|
-
var
|
|
2514
|
+
var import_react16 = require("react");
|
|
2228
2515
|
var import_shared7 = require("@copilotkitnext/shared");
|
|
2229
2516
|
function useConfigureSuggestions(config, deps) {
|
|
2230
2517
|
const { copilotkit } = useCopilotKit();
|
|
2231
2518
|
const chatConfig = useCopilotChatConfiguration();
|
|
2232
2519
|
const extraDeps = deps ?? [];
|
|
2233
|
-
const resolvedConsumerAgentId = (0,
|
|
2234
|
-
const rawConsumerAgentId = (0,
|
|
2235
|
-
const normalizationCacheRef = (0,
|
|
2520
|
+
const resolvedConsumerAgentId = (0, import_react16.useMemo)(() => chatConfig?.agentId ?? import_shared7.DEFAULT_AGENT_ID, [chatConfig?.agentId]);
|
|
2521
|
+
const rawConsumerAgentId = (0, import_react16.useMemo)(() => config ? config.consumerAgentId : void 0, [config]);
|
|
2522
|
+
const normalizationCacheRef = (0, import_react16.useRef)({
|
|
2236
2523
|
serialized: null,
|
|
2237
2524
|
config: null
|
|
2238
2525
|
});
|
|
2239
|
-
const { normalizedConfig, serializedConfig } = (0,
|
|
2526
|
+
const { normalizedConfig, serializedConfig } = (0, import_react16.useMemo)(() => {
|
|
2240
2527
|
if (!config) {
|
|
2241
2528
|
normalizationCacheRef.current = { serialized: null, config: null };
|
|
2242
2529
|
return { normalizedConfig: null, serializedConfig: null };
|
|
@@ -2266,10 +2553,10 @@ function useConfigureSuggestions(config, deps) {
|
|
|
2266
2553
|
normalizationCacheRef.current = { serialized, config: built };
|
|
2267
2554
|
return { normalizedConfig: built, serializedConfig: serialized };
|
|
2268
2555
|
}, [config, resolvedConsumerAgentId, ...extraDeps]);
|
|
2269
|
-
const latestConfigRef = (0,
|
|
2556
|
+
const latestConfigRef = (0, import_react16.useRef)(null);
|
|
2270
2557
|
latestConfigRef.current = normalizedConfig;
|
|
2271
|
-
const previousSerializedConfigRef = (0,
|
|
2272
|
-
const targetAgentId = (0,
|
|
2558
|
+
const previousSerializedConfigRef = (0, import_react16.useRef)(null);
|
|
2559
|
+
const targetAgentId = (0, import_react16.useMemo)(() => {
|
|
2273
2560
|
if (!normalizedConfig) {
|
|
2274
2561
|
return resolvedConsumerAgentId;
|
|
2275
2562
|
}
|
|
@@ -2280,7 +2567,7 @@ function useConfigureSuggestions(config, deps) {
|
|
|
2280
2567
|
return consumer;
|
|
2281
2568
|
}, [normalizedConfig, resolvedConsumerAgentId]);
|
|
2282
2569
|
const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
|
|
2283
|
-
const requestReload = (0,
|
|
2570
|
+
const requestReload = (0, import_react16.useCallback)(() => {
|
|
2284
2571
|
if (!normalizedConfig) {
|
|
2285
2572
|
return;
|
|
2286
2573
|
}
|
|
@@ -2302,7 +2589,7 @@ function useConfigureSuggestions(config, deps) {
|
|
|
2302
2589
|
}
|
|
2303
2590
|
copilotkit.reloadSuggestions(targetAgentId);
|
|
2304
2591
|
}, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);
|
|
2305
|
-
(0,
|
|
2592
|
+
(0, import_react16.useEffect)(() => {
|
|
2306
2593
|
if (!serializedConfig || !latestConfigRef.current) {
|
|
2307
2594
|
return;
|
|
2308
2595
|
}
|
|
@@ -2312,7 +2599,7 @@ function useConfigureSuggestions(config, deps) {
|
|
|
2312
2599
|
copilotkit.removeSuggestionsConfig(id);
|
|
2313
2600
|
};
|
|
2314
2601
|
}, [copilotkit, serializedConfig, requestReload]);
|
|
2315
|
-
(0,
|
|
2602
|
+
(0, import_react16.useEffect)(() => {
|
|
2316
2603
|
if (!normalizedConfig) {
|
|
2317
2604
|
previousSerializedConfigRef.current = null;
|
|
2318
2605
|
return;
|
|
@@ -2325,7 +2612,7 @@ function useConfigureSuggestions(config, deps) {
|
|
|
2325
2612
|
}
|
|
2326
2613
|
requestReload();
|
|
2327
2614
|
}, [normalizedConfig, requestReload, serializedConfig]);
|
|
2328
|
-
(0,
|
|
2615
|
+
(0, import_react16.useEffect)(() => {
|
|
2329
2616
|
if (!normalizedConfig || extraDeps.length === 0) {
|
|
2330
2617
|
return;
|
|
2331
2618
|
}
|
|
@@ -2343,8 +2630,8 @@ function normalizeStaticSuggestions(suggestions) {
|
|
|
2343
2630
|
}
|
|
2344
2631
|
|
|
2345
2632
|
// src/components/chat/CopilotChatToolCallsView.tsx
|
|
2346
|
-
var
|
|
2347
|
-
var
|
|
2633
|
+
var import_react17 = __toESM(require("react"));
|
|
2634
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2348
2635
|
function CopilotChatToolCallsView({
|
|
2349
2636
|
message,
|
|
2350
2637
|
messages = []
|
|
@@ -2353,11 +2640,11 @@ function CopilotChatToolCallsView({
|
|
|
2353
2640
|
if (!message.toolCalls || message.toolCalls.length === 0) {
|
|
2354
2641
|
return null;
|
|
2355
2642
|
}
|
|
2356
|
-
return /* @__PURE__ */ (0,
|
|
2643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: message.toolCalls.map((toolCall) => {
|
|
2357
2644
|
const toolMessage = messages.find(
|
|
2358
2645
|
(m) => m.role === "tool" && m.toolCallId === toolCall.id
|
|
2359
2646
|
);
|
|
2360
|
-
return /* @__PURE__ */ (0,
|
|
2647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react17.default.Fragment, { children: renderToolCall({
|
|
2361
2648
|
toolCall,
|
|
2362
2649
|
toolMessage
|
|
2363
2650
|
}) }, toolCall.id);
|
|
@@ -2366,7 +2653,7 @@ function CopilotChatToolCallsView({
|
|
|
2366
2653
|
var CopilotChatToolCallsView_default = CopilotChatToolCallsView;
|
|
2367
2654
|
|
|
2368
2655
|
// src/components/chat/CopilotChatAssistantMessage.tsx
|
|
2369
|
-
var
|
|
2656
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2370
2657
|
function CopilotChatAssistantMessage({
|
|
2371
2658
|
message,
|
|
2372
2659
|
messages,
|
|
@@ -2443,7 +2730,7 @@ function CopilotChatAssistantMessage({
|
|
|
2443
2730
|
toolbar,
|
|
2444
2731
|
CopilotChatAssistantMessage.Toolbar,
|
|
2445
2732
|
{
|
|
2446
|
-
children: /* @__PURE__ */ (0,
|
|
2733
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2447
2734
|
boundCopyButton,
|
|
2448
2735
|
(onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
|
|
2449
2736
|
(onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
|
|
@@ -2465,7 +2752,7 @@ function CopilotChatAssistantMessage({
|
|
|
2465
2752
|
const isLatestAssistantMessage = message.role === "assistant" && messages?.[messages.length - 1]?.id === message.id;
|
|
2466
2753
|
const shouldShowToolbar = toolbarVisible && hasContent && !(isRunning && isLatestAssistantMessage);
|
|
2467
2754
|
if (children) {
|
|
2468
|
-
return /* @__PURE__ */ (0,
|
|
2755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: children({
|
|
2469
2756
|
markdownRenderer: boundMarkdownRenderer,
|
|
2470
2757
|
toolbar: boundToolbar,
|
|
2471
2758
|
toolCallsView: boundToolCallsView,
|
|
@@ -2485,7 +2772,7 @@ function CopilotChatAssistantMessage({
|
|
|
2485
2772
|
toolbarVisible: shouldShowToolbar
|
|
2486
2773
|
}) });
|
|
2487
2774
|
}
|
|
2488
|
-
return /* @__PURE__ */ (0,
|
|
2775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
2489
2776
|
"div",
|
|
2490
2777
|
{
|
|
2491
2778
|
className: (0, import_tailwind_merge4.twMerge)(
|
|
@@ -2503,11 +2790,11 @@ function CopilotChatAssistantMessage({
|
|
|
2503
2790
|
);
|
|
2504
2791
|
}
|
|
2505
2792
|
((CopilotChatAssistantMessage2) => {
|
|
2506
|
-
CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0,
|
|
2793
|
+
CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_streamdown.Streamdown, { className, ...props, children: content ?? "" });
|
|
2507
2794
|
CopilotChatAssistantMessage2.Toolbar = ({
|
|
2508
2795
|
className,
|
|
2509
2796
|
...props
|
|
2510
|
-
}) => /* @__PURE__ */ (0,
|
|
2797
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2511
2798
|
"div",
|
|
2512
2799
|
{
|
|
2513
2800
|
className: (0, import_tailwind_merge4.twMerge)(
|
|
@@ -2518,8 +2805,8 @@ function CopilotChatAssistantMessage({
|
|
|
2518
2805
|
}
|
|
2519
2806
|
);
|
|
2520
2807
|
CopilotChatAssistantMessage2.ToolbarButton = ({ title, children, ...props }) => {
|
|
2521
|
-
return /* @__PURE__ */ (0,
|
|
2522
|
-
/* @__PURE__ */ (0,
|
|
2808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Tooltip, { children: [
|
|
2809
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2523
2810
|
Button,
|
|
2524
2811
|
{
|
|
2525
2812
|
type: "button",
|
|
@@ -2529,13 +2816,13 @@ function CopilotChatAssistantMessage({
|
|
|
2529
2816
|
children
|
|
2530
2817
|
}
|
|
2531
2818
|
) }),
|
|
2532
|
-
/* @__PURE__ */ (0,
|
|
2819
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: title }) })
|
|
2533
2820
|
] });
|
|
2534
2821
|
};
|
|
2535
2822
|
CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
2536
2823
|
const config = useCopilotChatConfiguration();
|
|
2537
2824
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2538
|
-
const [copied, setCopied] = (0,
|
|
2825
|
+
const [copied, setCopied] = (0, import_react18.useState)(false);
|
|
2539
2826
|
const handleClick = (event) => {
|
|
2540
2827
|
setCopied(true);
|
|
2541
2828
|
setTimeout(() => setCopied(false), 2e3);
|
|
@@ -2543,62 +2830,62 @@ function CopilotChatAssistantMessage({
|
|
|
2543
2830
|
onClick(event);
|
|
2544
2831
|
}
|
|
2545
2832
|
};
|
|
2546
|
-
return /* @__PURE__ */ (0,
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2547
2834
|
CopilotChatAssistantMessage2.ToolbarButton,
|
|
2548
2835
|
{
|
|
2549
2836
|
title: title || labels.assistantMessageToolbarCopyMessageLabel,
|
|
2550
2837
|
onClick: handleClick,
|
|
2551
2838
|
className,
|
|
2552
2839
|
...props,
|
|
2553
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
2840
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Copy, { className: "size-[18px]" })
|
|
2554
2841
|
}
|
|
2555
2842
|
);
|
|
2556
2843
|
};
|
|
2557
2844
|
CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
|
|
2558
2845
|
const config = useCopilotChatConfiguration();
|
|
2559
2846
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2560
|
-
return /* @__PURE__ */ (0,
|
|
2847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2561
2848
|
CopilotChatAssistantMessage2.ToolbarButton,
|
|
2562
2849
|
{
|
|
2563
2850
|
title: title || labels.assistantMessageToolbarThumbsUpLabel,
|
|
2564
2851
|
...props,
|
|
2565
|
-
children: /* @__PURE__ */ (0,
|
|
2852
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.ThumbsUp, { className: "size-[18px]" })
|
|
2566
2853
|
}
|
|
2567
2854
|
);
|
|
2568
2855
|
};
|
|
2569
2856
|
CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
|
|
2570
2857
|
const config = useCopilotChatConfiguration();
|
|
2571
2858
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2572
|
-
return /* @__PURE__ */ (0,
|
|
2859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2573
2860
|
CopilotChatAssistantMessage2.ToolbarButton,
|
|
2574
2861
|
{
|
|
2575
2862
|
title: title || labels.assistantMessageToolbarThumbsDownLabel,
|
|
2576
2863
|
...props,
|
|
2577
|
-
children: /* @__PURE__ */ (0,
|
|
2864
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.ThumbsDown, { className: "size-[18px]" })
|
|
2578
2865
|
}
|
|
2579
2866
|
);
|
|
2580
2867
|
};
|
|
2581
2868
|
CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
|
|
2582
2869
|
const config = useCopilotChatConfiguration();
|
|
2583
2870
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2584
|
-
return /* @__PURE__ */ (0,
|
|
2871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2585
2872
|
CopilotChatAssistantMessage2.ToolbarButton,
|
|
2586
2873
|
{
|
|
2587
2874
|
title: title || labels.assistantMessageToolbarReadAloudLabel,
|
|
2588
2875
|
...props,
|
|
2589
|
-
children: /* @__PURE__ */ (0,
|
|
2876
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Volume2, { className: "size-[20px]" })
|
|
2590
2877
|
}
|
|
2591
2878
|
);
|
|
2592
2879
|
};
|
|
2593
2880
|
CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
|
|
2594
2881
|
const config = useCopilotChatConfiguration();
|
|
2595
2882
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2596
|
-
return /* @__PURE__ */ (0,
|
|
2883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2597
2884
|
CopilotChatAssistantMessage2.ToolbarButton,
|
|
2598
2885
|
{
|
|
2599
2886
|
title: title || labels.assistantMessageToolbarRegenerateLabel,
|
|
2600
2887
|
...props,
|
|
2601
|
-
children: /* @__PURE__ */ (0,
|
|
2888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.RefreshCw, { className: "size-[18px]" })
|
|
2602
2889
|
}
|
|
2603
2890
|
);
|
|
2604
2891
|
};
|
|
@@ -2613,10 +2900,10 @@ CopilotChatAssistantMessage.RegenerateButton.displayName = "CopilotChatAssistant
|
|
|
2613
2900
|
var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
|
|
2614
2901
|
|
|
2615
2902
|
// src/components/chat/CopilotChatUserMessage.tsx
|
|
2616
|
-
var
|
|
2903
|
+
var import_react19 = require("react");
|
|
2617
2904
|
var import_lucide_react4 = require("lucide-react");
|
|
2618
2905
|
var import_tailwind_merge5 = require("tailwind-merge");
|
|
2619
|
-
var
|
|
2906
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2620
2907
|
function flattenUserMessageContent(content) {
|
|
2621
2908
|
if (!content) {
|
|
2622
2909
|
return "";
|
|
@@ -2647,7 +2934,7 @@ function CopilotChatUserMessage({
|
|
|
2647
2934
|
className,
|
|
2648
2935
|
...props
|
|
2649
2936
|
}) {
|
|
2650
|
-
const flattenedContent = (0,
|
|
2937
|
+
const flattenedContent = (0, import_react19.useMemo)(
|
|
2651
2938
|
() => flattenUserMessageContent(message.content),
|
|
2652
2939
|
[message.content]
|
|
2653
2940
|
);
|
|
@@ -2692,7 +2979,7 @@ function CopilotChatUserMessage({
|
|
|
2692
2979
|
);
|
|
2693
2980
|
const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
|
|
2694
2981
|
const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {
|
|
2695
|
-
children: /* @__PURE__ */ (0,
|
|
2982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex items-center gap-1 justify-end", children: [
|
|
2696
2983
|
additionalToolbarItems,
|
|
2697
2984
|
BoundCopyButton,
|
|
2698
2985
|
onEditMessage && BoundEditButton,
|
|
@@ -2700,7 +2987,7 @@ function CopilotChatUserMessage({
|
|
|
2700
2987
|
] })
|
|
2701
2988
|
});
|
|
2702
2989
|
if (children) {
|
|
2703
|
-
return /* @__PURE__ */ (0,
|
|
2990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: children({
|
|
2704
2991
|
messageRenderer: BoundMessageRenderer,
|
|
2705
2992
|
toolbar: BoundToolbar,
|
|
2706
2993
|
copyButton: BoundCopyButton,
|
|
@@ -2712,7 +2999,7 @@ function CopilotChatUserMessage({
|
|
|
2712
2999
|
additionalToolbarItems
|
|
2713
3000
|
}) });
|
|
2714
3001
|
}
|
|
2715
|
-
return /* @__PURE__ */ (0,
|
|
3002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2716
3003
|
"div",
|
|
2717
3004
|
{
|
|
2718
3005
|
className: (0, import_tailwind_merge5.twMerge)("flex flex-col items-end group pt-10", className),
|
|
@@ -2726,7 +3013,7 @@ function CopilotChatUserMessage({
|
|
|
2726
3013
|
);
|
|
2727
3014
|
}
|
|
2728
3015
|
((CopilotChatUserMessage2) => {
|
|
2729
|
-
CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0,
|
|
3016
|
+
CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2730
3017
|
"div",
|
|
2731
3018
|
{
|
|
2732
3019
|
className: (0, import_tailwind_merge5.twMerge)("flex flex-col items-end group", className),
|
|
@@ -2734,7 +3021,7 @@ function CopilotChatUserMessage({
|
|
|
2734
3021
|
children
|
|
2735
3022
|
}
|
|
2736
3023
|
);
|
|
2737
|
-
CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0,
|
|
3024
|
+
CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2738
3025
|
"div",
|
|
2739
3026
|
{
|
|
2740
3027
|
className: (0, import_tailwind_merge5.twMerge)(
|
|
@@ -2747,7 +3034,7 @@ function CopilotChatUserMessage({
|
|
|
2747
3034
|
CopilotChatUserMessage2.Toolbar = ({
|
|
2748
3035
|
className,
|
|
2749
3036
|
...props
|
|
2750
|
-
}) => /* @__PURE__ */ (0,
|
|
3037
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2751
3038
|
"div",
|
|
2752
3039
|
{
|
|
2753
3040
|
className: (0, import_tailwind_merge5.twMerge)(
|
|
@@ -2758,8 +3045,8 @@ function CopilotChatUserMessage({
|
|
|
2758
3045
|
}
|
|
2759
3046
|
);
|
|
2760
3047
|
CopilotChatUserMessage2.ToolbarButton = ({ title, children, className, ...props }) => {
|
|
2761
|
-
return /* @__PURE__ */ (0,
|
|
2762
|
-
/* @__PURE__ */ (0,
|
|
3048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(Tooltip, { children: [
|
|
3049
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2763
3050
|
Button,
|
|
2764
3051
|
{
|
|
2765
3052
|
type: "button",
|
|
@@ -2770,13 +3057,13 @@ function CopilotChatUserMessage({
|
|
|
2770
3057
|
children
|
|
2771
3058
|
}
|
|
2772
3059
|
) }),
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
3060
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: title }) })
|
|
2774
3061
|
] });
|
|
2775
3062
|
};
|
|
2776
3063
|
CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
|
|
2777
3064
|
const config = useCopilotChatConfiguration();
|
|
2778
3065
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2779
|
-
const [copied, setCopied] = (0,
|
|
3066
|
+
const [copied, setCopied] = (0, import_react19.useState)(false);
|
|
2780
3067
|
const handleClick = (event) => {
|
|
2781
3068
|
setCopied(true);
|
|
2782
3069
|
setTimeout(() => setCopied(false), 2e3);
|
|
@@ -2784,27 +3071,27 @@ function CopilotChatUserMessage({
|
|
|
2784
3071
|
onClick(event);
|
|
2785
3072
|
}
|
|
2786
3073
|
};
|
|
2787
|
-
return /* @__PURE__ */ (0,
|
|
3074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2788
3075
|
CopilotChatUserMessage2.ToolbarButton,
|
|
2789
3076
|
{
|
|
2790
3077
|
title: title || labels.userMessageToolbarCopyMessageLabel,
|
|
2791
3078
|
onClick: handleClick,
|
|
2792
3079
|
className,
|
|
2793
3080
|
...props,
|
|
2794
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
3081
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Copy, { className: "size-[18px]" })
|
|
2795
3082
|
}
|
|
2796
3083
|
);
|
|
2797
3084
|
};
|
|
2798
3085
|
CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
|
|
2799
3086
|
const config = useCopilotChatConfiguration();
|
|
2800
3087
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
2801
|
-
return /* @__PURE__ */ (0,
|
|
3088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2802
3089
|
CopilotChatUserMessage2.ToolbarButton,
|
|
2803
3090
|
{
|
|
2804
3091
|
title: title || labels.userMessageToolbarEditMessageLabel,
|
|
2805
3092
|
className,
|
|
2806
3093
|
...props,
|
|
2807
|
-
children: /* @__PURE__ */ (0,
|
|
3094
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Edit, { className: "size-[18px]" })
|
|
2808
3095
|
}
|
|
2809
3096
|
);
|
|
2810
3097
|
};
|
|
@@ -2821,8 +3108,8 @@ function CopilotChatUserMessage({
|
|
|
2821
3108
|
}
|
|
2822
3109
|
const canGoPrev = currentBranch > 0;
|
|
2823
3110
|
const canGoNext = currentBranch < numberOfBranches - 1;
|
|
2824
|
-
return /* @__PURE__ */ (0,
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
3111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_tailwind_merge5.twMerge)("flex items-center gap-1", className), ...props, children: [
|
|
3112
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2826
3113
|
Button,
|
|
2827
3114
|
{
|
|
2828
3115
|
type: "button",
|
|
@@ -2834,15 +3121,15 @@ function CopilotChatUserMessage({
|
|
|
2834
3121
|
}),
|
|
2835
3122
|
disabled: !canGoPrev,
|
|
2836
3123
|
className: "h-6 w-6 p-0",
|
|
2837
|
-
children: /* @__PURE__ */ (0,
|
|
3124
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.ChevronLeft, { className: "size-[20px]" })
|
|
2838
3125
|
}
|
|
2839
3126
|
),
|
|
2840
|
-
/* @__PURE__ */ (0,
|
|
3127
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
|
|
2841
3128
|
currentBranch + 1,
|
|
2842
3129
|
"/",
|
|
2843
3130
|
numberOfBranches
|
|
2844
3131
|
] }),
|
|
2845
|
-
/* @__PURE__ */ (0,
|
|
3132
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2846
3133
|
Button,
|
|
2847
3134
|
{
|
|
2848
3135
|
type: "button",
|
|
@@ -2854,7 +3141,7 @@ function CopilotChatUserMessage({
|
|
|
2854
3141
|
}),
|
|
2855
3142
|
disabled: !canGoNext,
|
|
2856
3143
|
className: "h-6 w-6 p-0",
|
|
2857
|
-
children: /* @__PURE__ */ (0,
|
|
3144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.ChevronRight, { className: "size-[20px]" })
|
|
2858
3145
|
}
|
|
2859
3146
|
)
|
|
2860
3147
|
] });
|
|
@@ -2870,14 +3157,14 @@ CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.Br
|
|
|
2870
3157
|
var CopilotChatUserMessage_default = CopilotChatUserMessage;
|
|
2871
3158
|
|
|
2872
3159
|
// src/components/chat/CopilotChatSuggestionPill.tsx
|
|
2873
|
-
var
|
|
3160
|
+
var import_react20 = __toESM(require("react"));
|
|
2874
3161
|
var import_lucide_react5 = require("lucide-react");
|
|
2875
|
-
var
|
|
3162
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2876
3163
|
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";
|
|
2877
3164
|
var labelClasses = "whitespace-nowrap font-medium leading-none";
|
|
2878
|
-
var CopilotChatSuggestionPill =
|
|
3165
|
+
var CopilotChatSuggestionPill = import_react20.default.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
|
|
2879
3166
|
const showIcon = !isLoading && icon;
|
|
2880
|
-
return /* @__PURE__ */ (0,
|
|
3167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2881
3168
|
"button",
|
|
2882
3169
|
{
|
|
2883
3170
|
ref,
|
|
@@ -2888,8 +3175,8 @@ var CopilotChatSuggestionPill = import_react19.default.forwardRef(function Copil
|
|
|
2888
3175
|
disabled: isLoading || props.disabled,
|
|
2889
3176
|
...props,
|
|
2890
3177
|
children: [
|
|
2891
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
3178
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_lucide_react5.Loader2, { className: "h-3.5 sm:h-4 w-3.5 sm:w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "flex h-3.5 sm:h-4 w-3.5 sm:w-4 items-center justify-center text-muted-foreground", children: icon }),
|
|
3179
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: labelClasses, children })
|
|
2893
3180
|
]
|
|
2894
3181
|
}
|
|
2895
3182
|
);
|
|
@@ -2898,10 +3185,10 @@ CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
|
|
|
2898
3185
|
var CopilotChatSuggestionPill_default = CopilotChatSuggestionPill;
|
|
2899
3186
|
|
|
2900
3187
|
// src/components/chat/CopilotChatSuggestionView.tsx
|
|
2901
|
-
var
|
|
2902
|
-
var
|
|
2903
|
-
var DefaultContainer =
|
|
2904
|
-
return /* @__PURE__ */ (0,
|
|
3188
|
+
var import_react21 = __toESM(require("react"));
|
|
3189
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3190
|
+
var DefaultContainer = import_react21.default.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
|
|
3191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2905
3192
|
"div",
|
|
2906
3193
|
{
|
|
2907
3194
|
ref,
|
|
@@ -2913,7 +3200,7 @@ var DefaultContainer = import_react20.default.forwardRef(function DefaultContain
|
|
|
2913
3200
|
}
|
|
2914
3201
|
);
|
|
2915
3202
|
});
|
|
2916
|
-
var CopilotChatSuggestionView =
|
|
3203
|
+
var CopilotChatSuggestionView = import_react21.default.forwardRef(function CopilotChatSuggestionView2({
|
|
2917
3204
|
suggestions,
|
|
2918
3205
|
onSelectSuggestion,
|
|
2919
3206
|
loadingIndexes,
|
|
@@ -2923,7 +3210,7 @@ var CopilotChatSuggestionView = import_react20.default.forwardRef(function Copil
|
|
|
2923
3210
|
children,
|
|
2924
3211
|
...restProps
|
|
2925
3212
|
}, ref) {
|
|
2926
|
-
const loadingSet =
|
|
3213
|
+
const loadingSet = import_react21.default.useMemo(() => {
|
|
2927
3214
|
if (!loadingIndexes || loadingIndexes.length === 0) {
|
|
2928
3215
|
return /* @__PURE__ */ new Set();
|
|
2929
3216
|
}
|
|
@@ -2942,11 +3229,11 @@ var CopilotChatSuggestionView = import_react20.default.forwardRef(function Copil
|
|
|
2942
3229
|
type: "button",
|
|
2943
3230
|
onClick: () => onSelectSuggestion?.(suggestion, index)
|
|
2944
3231
|
});
|
|
2945
|
-
return
|
|
3232
|
+
return import_react21.default.cloneElement(pill, {
|
|
2946
3233
|
key: `${suggestion.title}-${index}`
|
|
2947
3234
|
});
|
|
2948
3235
|
});
|
|
2949
|
-
const boundContainer =
|
|
3236
|
+
const boundContainer = import_react21.default.cloneElement(
|
|
2950
3237
|
ContainerElement,
|
|
2951
3238
|
void 0,
|
|
2952
3239
|
suggestionElements
|
|
@@ -2957,7 +3244,7 @@ var CopilotChatSuggestionView = import_react20.default.forwardRef(function Copil
|
|
|
2957
3244
|
isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
|
|
2958
3245
|
type: "button"
|
|
2959
3246
|
});
|
|
2960
|
-
return /* @__PURE__ */ (0,
|
|
3247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, { children: children({
|
|
2961
3248
|
container: boundContainer,
|
|
2962
3249
|
suggestion: sampleSuggestion,
|
|
2963
3250
|
suggestions,
|
|
@@ -2968,7 +3255,7 @@ var CopilotChatSuggestionView = import_react20.default.forwardRef(function Copil
|
|
|
2968
3255
|
}) });
|
|
2969
3256
|
}
|
|
2970
3257
|
if (children) {
|
|
2971
|
-
return /* @__PURE__ */ (0,
|
|
3258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2972
3259
|
boundContainer,
|
|
2973
3260
|
children
|
|
2974
3261
|
] });
|
|
@@ -2979,17 +3266,17 @@ CopilotChatSuggestionView.displayName = "CopilotChatSuggestionView";
|
|
|
2979
3266
|
var CopilotChatSuggestionView_default = CopilotChatSuggestionView;
|
|
2980
3267
|
|
|
2981
3268
|
// src/components/chat/CopilotChatMessageView.tsx
|
|
2982
|
-
var
|
|
3269
|
+
var import_react22 = __toESM(require("react"));
|
|
2983
3270
|
var import_tailwind_merge6 = require("tailwind-merge");
|
|
2984
|
-
var
|
|
2985
|
-
var MemoizedAssistantMessage =
|
|
3271
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3272
|
+
var MemoizedAssistantMessage = import_react22.default.memo(
|
|
2986
3273
|
function MemoizedAssistantMessage2({
|
|
2987
3274
|
message,
|
|
2988
3275
|
messages,
|
|
2989
3276
|
isRunning,
|
|
2990
3277
|
AssistantMessageComponent
|
|
2991
3278
|
}) {
|
|
2992
|
-
return /* @__PURE__ */ (0,
|
|
3279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2993
3280
|
AssistantMessageComponent,
|
|
2994
3281
|
{
|
|
2995
3282
|
message,
|
|
@@ -3032,12 +3319,12 @@ var MemoizedAssistantMessage = import_react21.default.memo(
|
|
|
3032
3319
|
return true;
|
|
3033
3320
|
}
|
|
3034
3321
|
);
|
|
3035
|
-
var MemoizedUserMessage =
|
|
3322
|
+
var MemoizedUserMessage = import_react22.default.memo(
|
|
3036
3323
|
function MemoizedUserMessage2({
|
|
3037
3324
|
message,
|
|
3038
3325
|
UserMessageComponent
|
|
3039
3326
|
}) {
|
|
3040
|
-
return /* @__PURE__ */ (0,
|
|
3327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UserMessageComponent, { message });
|
|
3041
3328
|
},
|
|
3042
3329
|
(prevProps, nextProps) => {
|
|
3043
3330
|
if (prevProps.message.id !== nextProps.message.id) return false;
|
|
@@ -3046,7 +3333,7 @@ var MemoizedUserMessage = import_react21.default.memo(
|
|
|
3046
3333
|
return true;
|
|
3047
3334
|
}
|
|
3048
3335
|
);
|
|
3049
|
-
var MemoizedActivityMessage =
|
|
3336
|
+
var MemoizedActivityMessage = import_react22.default.memo(
|
|
3050
3337
|
function MemoizedActivityMessage2({
|
|
3051
3338
|
message,
|
|
3052
3339
|
renderActivityMessage
|
|
@@ -3060,7 +3347,7 @@ var MemoizedActivityMessage = import_react21.default.memo(
|
|
|
3060
3347
|
return true;
|
|
3061
3348
|
}
|
|
3062
3349
|
);
|
|
3063
|
-
var MemoizedCustomMessage =
|
|
3350
|
+
var MemoizedCustomMessage = import_react22.default.memo(
|
|
3064
3351
|
function MemoizedCustomMessage2({
|
|
3065
3352
|
message,
|
|
3066
3353
|
position,
|
|
@@ -3092,7 +3379,7 @@ function CopilotChatMessageView({
|
|
|
3092
3379
|
const elements = [];
|
|
3093
3380
|
if (renderCustomMessage) {
|
|
3094
3381
|
elements.push(
|
|
3095
|
-
/* @__PURE__ */ (0,
|
|
3382
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3096
3383
|
MemoizedCustomMessage,
|
|
3097
3384
|
{
|
|
3098
3385
|
message,
|
|
@@ -3106,7 +3393,7 @@ function CopilotChatMessageView({
|
|
|
3106
3393
|
if (message.role === "assistant") {
|
|
3107
3394
|
const AssistantComponent = typeof assistantMessage === "function" ? assistantMessage : CopilotChatAssistantMessage_default;
|
|
3108
3395
|
elements.push(
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3396
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3110
3397
|
MemoizedAssistantMessage,
|
|
3111
3398
|
{
|
|
3112
3399
|
message,
|
|
@@ -3120,7 +3407,7 @@ function CopilotChatMessageView({
|
|
|
3120
3407
|
} else if (message.role === "user") {
|
|
3121
3408
|
const UserComponent = typeof userMessage === "function" ? userMessage : CopilotChatUserMessage_default;
|
|
3122
3409
|
elements.push(
|
|
3123
|
-
/* @__PURE__ */ (0,
|
|
3410
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3124
3411
|
MemoizedUserMessage,
|
|
3125
3412
|
{
|
|
3126
3413
|
message,
|
|
@@ -3131,7 +3418,7 @@ function CopilotChatMessageView({
|
|
|
3131
3418
|
);
|
|
3132
3419
|
} else if (message.role === "activity") {
|
|
3133
3420
|
elements.push(
|
|
3134
|
-
/* @__PURE__ */ (0,
|
|
3421
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3135
3422
|
MemoizedActivityMessage,
|
|
3136
3423
|
{
|
|
3137
3424
|
message,
|
|
@@ -3143,7 +3430,7 @@ function CopilotChatMessageView({
|
|
|
3143
3430
|
}
|
|
3144
3431
|
if (renderCustomMessage) {
|
|
3145
3432
|
elements.push(
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3433
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3147
3434
|
MemoizedCustomMessage,
|
|
3148
3435
|
{
|
|
3149
3436
|
message,
|
|
@@ -3159,13 +3446,13 @@ function CopilotChatMessageView({
|
|
|
3159
3446
|
if (children) {
|
|
3160
3447
|
return children({ messageElements, messages, isRunning });
|
|
3161
3448
|
}
|
|
3162
|
-
return /* @__PURE__ */ (0,
|
|
3449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: (0, import_tailwind_merge6.twMerge)("flex flex-col", className), ...props, children: [
|
|
3163
3450
|
messageElements,
|
|
3164
3451
|
isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
|
|
3165
3452
|
] });
|
|
3166
3453
|
}
|
|
3167
3454
|
CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
|
|
3168
|
-
return /* @__PURE__ */ (0,
|
|
3455
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3169
3456
|
"div",
|
|
3170
3457
|
{
|
|
3171
3458
|
className: (0, import_tailwind_merge6.twMerge)("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
|
|
@@ -3176,21 +3463,21 @@ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
|
|
|
3176
3463
|
var CopilotChatMessageView_default = CopilotChatMessageView;
|
|
3177
3464
|
|
|
3178
3465
|
// src/components/chat/CopilotChatView.tsx
|
|
3179
|
-
var
|
|
3466
|
+
var import_react24 = __toESM(require("react"));
|
|
3180
3467
|
var import_tailwind_merge7 = require("tailwind-merge");
|
|
3181
3468
|
var import_use_stick_to_bottom = require("use-stick-to-bottom");
|
|
3182
3469
|
var import_lucide_react6 = require("lucide-react");
|
|
3183
3470
|
|
|
3184
3471
|
// src/hooks/use-keyboard-height.tsx
|
|
3185
|
-
var
|
|
3472
|
+
var import_react23 = require("react");
|
|
3186
3473
|
function useKeyboardHeight() {
|
|
3187
|
-
const [keyboardState, setKeyboardState] = (0,
|
|
3474
|
+
const [keyboardState, setKeyboardState] = (0, import_react23.useState)({
|
|
3188
3475
|
isKeyboardOpen: false,
|
|
3189
3476
|
keyboardHeight: 0,
|
|
3190
3477
|
availableHeight: typeof window !== "undefined" ? window.innerHeight : 0,
|
|
3191
3478
|
viewportHeight: typeof window !== "undefined" ? window.innerHeight : 0
|
|
3192
3479
|
});
|
|
3193
|
-
(0,
|
|
3480
|
+
(0, import_react23.useEffect)(() => {
|
|
3194
3481
|
if (typeof window === "undefined") {
|
|
3195
3482
|
return;
|
|
3196
3483
|
}
|
|
@@ -3222,7 +3509,7 @@ function useKeyboardHeight() {
|
|
|
3222
3509
|
}
|
|
3223
3510
|
|
|
3224
3511
|
// src/components/chat/CopilotChatView.tsx
|
|
3225
|
-
var
|
|
3512
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3226
3513
|
function CopilotChatView({
|
|
3227
3514
|
messageView,
|
|
3228
3515
|
input,
|
|
@@ -3243,12 +3530,12 @@ function CopilotChatView({
|
|
|
3243
3530
|
className,
|
|
3244
3531
|
...props
|
|
3245
3532
|
}) {
|
|
3246
|
-
const inputContainerRef = (0,
|
|
3247
|
-
const [inputContainerHeight, setInputContainerHeight] = (0,
|
|
3248
|
-
const [isResizing, setIsResizing] = (0,
|
|
3249
|
-
const resizeTimeoutRef = (0,
|
|
3533
|
+
const inputContainerRef = (0, import_react24.useRef)(null);
|
|
3534
|
+
const [inputContainerHeight, setInputContainerHeight] = (0, import_react24.useState)(0);
|
|
3535
|
+
const [isResizing, setIsResizing] = (0, import_react24.useState)(false);
|
|
3536
|
+
const resizeTimeoutRef = (0, import_react24.useRef)(null);
|
|
3250
3537
|
const { isKeyboardOpen, keyboardHeight, availableHeight } = useKeyboardHeight();
|
|
3251
|
-
(0,
|
|
3538
|
+
(0, import_react24.useEffect)(() => {
|
|
3252
3539
|
const element = inputContainerRef.current;
|
|
3253
3540
|
if (!element) return;
|
|
3254
3541
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
@@ -3296,9 +3583,9 @@ function CopilotChatView({
|
|
|
3296
3583
|
scrollToBottomButton,
|
|
3297
3584
|
inputContainerHeight,
|
|
3298
3585
|
isResizing,
|
|
3299
|
-
children: /* @__PURE__ */ (0,
|
|
3586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "max-w-3xl mx-auto", children: [
|
|
3300
3587
|
BoundMessageView,
|
|
3301
|
-
hasSuggestions ? /* @__PURE__ */ (0,
|
|
3588
|
+
hasSuggestions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pl-0 pr-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
|
|
3302
3589
|
] }) })
|
|
3303
3590
|
});
|
|
3304
3591
|
const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});
|
|
@@ -3306,8 +3593,8 @@ function CopilotChatView({
|
|
|
3306
3593
|
const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {
|
|
3307
3594
|
ref: inputContainerRef,
|
|
3308
3595
|
keyboardHeight: isKeyboardOpen ? keyboardHeight : 0,
|
|
3309
|
-
children: /* @__PURE__ */ (0,
|
|
3310
|
-
/* @__PURE__ */ (0,
|
|
3596
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3597
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("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 }),
|
|
3311
3598
|
BoundDisclaimer
|
|
3312
3599
|
] })
|
|
3313
3600
|
});
|
|
@@ -3320,10 +3607,10 @@ function CopilotChatView({
|
|
|
3320
3607
|
feather: BoundFeather,
|
|
3321
3608
|
inputContainer: BoundInputContainer,
|
|
3322
3609
|
disclaimer: BoundDisclaimer,
|
|
3323
|
-
suggestionView: BoundSuggestionView ?? /* @__PURE__ */ (0,
|
|
3610
|
+
suggestionView: BoundSuggestionView ?? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {})
|
|
3324
3611
|
});
|
|
3325
3612
|
}
|
|
3326
|
-
return /* @__PURE__ */ (0,
|
|
3613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_tailwind_merge7.twMerge)("relative h-full", className), ...props, children: [
|
|
3327
3614
|
BoundScrollView,
|
|
3328
3615
|
BoundFeather,
|
|
3329
3616
|
BoundInputContainer
|
|
@@ -3332,9 +3619,9 @@ function CopilotChatView({
|
|
|
3332
3619
|
((CopilotChatView2) => {
|
|
3333
3620
|
const ScrollContent = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {
|
|
3334
3621
|
const { isAtBottom, scrollToBottom } = (0, import_use_stick_to_bottom.useStickToBottomContext)();
|
|
3335
|
-
return /* @__PURE__ */ (0,
|
|
3336
|
-
/* @__PURE__ */ (0,
|
|
3337
|
-
!isAtBottom && !isResizing && /* @__PURE__ */ (0,
|
|
3622
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3623
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_use_stick_to_bottom.StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) }),
|
|
3624
|
+
!isAtBottom && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3338
3625
|
"div",
|
|
3339
3626
|
{
|
|
3340
3627
|
className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
|
|
@@ -3357,13 +3644,13 @@ function CopilotChatView({
|
|
|
3357
3644
|
className,
|
|
3358
3645
|
...props
|
|
3359
3646
|
}) => {
|
|
3360
|
-
const [hasMounted, setHasMounted] = (0,
|
|
3647
|
+
const [hasMounted, setHasMounted] = (0, import_react24.useState)(false);
|
|
3361
3648
|
const { scrollRef, contentRef, scrollToBottom } = (0, import_use_stick_to_bottom.useStickToBottom)();
|
|
3362
|
-
const [showScrollButton, setShowScrollButton] = (0,
|
|
3363
|
-
(0,
|
|
3649
|
+
const [showScrollButton, setShowScrollButton] = (0, import_react24.useState)(false);
|
|
3650
|
+
(0, import_react24.useEffect)(() => {
|
|
3364
3651
|
setHasMounted(true);
|
|
3365
3652
|
}, []);
|
|
3366
|
-
(0,
|
|
3653
|
+
(0, import_react24.useEffect)(() => {
|
|
3367
3654
|
if (autoScroll) return;
|
|
3368
3655
|
const scrollElement = scrollRef.current;
|
|
3369
3656
|
if (!scrollElement) return;
|
|
@@ -3381,10 +3668,10 @@ function CopilotChatView({
|
|
|
3381
3668
|
};
|
|
3382
3669
|
}, [scrollRef, autoScroll]);
|
|
3383
3670
|
if (!hasMounted) {
|
|
3384
|
-
return /* @__PURE__ */ (0,
|
|
3671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }) });
|
|
3385
3672
|
}
|
|
3386
3673
|
if (!autoScroll) {
|
|
3387
|
-
return /* @__PURE__ */ (0,
|
|
3674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3388
3675
|
"div",
|
|
3389
3676
|
{
|
|
3390
3677
|
ref: scrollRef,
|
|
@@ -3394,8 +3681,8 @@ function CopilotChatView({
|
|
|
3394
3681
|
),
|
|
3395
3682
|
...props,
|
|
3396
3683
|
children: [
|
|
3397
|
-
/* @__PURE__ */ (0,
|
|
3398
|
-
showScrollButton && !isResizing && /* @__PURE__ */ (0,
|
|
3684
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 [div[data-popup-chat]_&]:px-6", children }),
|
|
3685
|
+
showScrollButton && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3399
3686
|
"div",
|
|
3400
3687
|
{
|
|
3401
3688
|
className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
|
|
@@ -3411,14 +3698,14 @@ function CopilotChatView({
|
|
|
3411
3698
|
}
|
|
3412
3699
|
);
|
|
3413
3700
|
}
|
|
3414
|
-
return /* @__PURE__ */ (0,
|
|
3701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3415
3702
|
import_use_stick_to_bottom.StickToBottom,
|
|
3416
3703
|
{
|
|
3417
3704
|
className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
|
|
3418
3705
|
resize: "smooth",
|
|
3419
3706
|
initial: "smooth",
|
|
3420
3707
|
...props,
|
|
3421
|
-
children: /* @__PURE__ */ (0,
|
|
3708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3422
3709
|
ScrollContent,
|
|
3423
3710
|
{
|
|
3424
3711
|
scrollToBottomButton,
|
|
@@ -3433,7 +3720,7 @@ function CopilotChatView({
|
|
|
3433
3720
|
CopilotChatView2.ScrollToBottomButton = ({
|
|
3434
3721
|
className,
|
|
3435
3722
|
...props
|
|
3436
|
-
}) => /* @__PURE__ */ (0,
|
|
3723
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3437
3724
|
Button,
|
|
3438
3725
|
{
|
|
3439
3726
|
variant: "outline",
|
|
@@ -3447,10 +3734,10 @@ function CopilotChatView({
|
|
|
3447
3734
|
className
|
|
3448
3735
|
),
|
|
3449
3736
|
...props,
|
|
3450
|
-
children: /* @__PURE__ */ (0,
|
|
3737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react6.ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
|
|
3451
3738
|
}
|
|
3452
3739
|
);
|
|
3453
|
-
CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ (0,
|
|
3740
|
+
CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3454
3741
|
"div",
|
|
3455
3742
|
{
|
|
3456
3743
|
className: cn(
|
|
@@ -3463,7 +3750,7 @@ function CopilotChatView({
|
|
|
3463
3750
|
...props
|
|
3464
3751
|
}
|
|
3465
3752
|
);
|
|
3466
|
-
CopilotChatView2.InputContainer =
|
|
3753
|
+
CopilotChatView2.InputContainer = import_react24.default.forwardRef(({ children, className, keyboardHeight = 0, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3467
3754
|
"div",
|
|
3468
3755
|
{
|
|
3469
3756
|
ref,
|
|
@@ -3481,7 +3768,7 @@ function CopilotChatView({
|
|
|
3481
3768
|
CopilotChatView2.Disclaimer = ({ className, ...props }) => {
|
|
3482
3769
|
const config = useCopilotChatConfiguration();
|
|
3483
3770
|
const labels = config?.labels ?? CopilotChatDefaultLabels;
|
|
3484
|
-
return /* @__PURE__ */ (0,
|
|
3771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3485
3772
|
"div",
|
|
3486
3773
|
{
|
|
3487
3774
|
className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
|
|
@@ -3495,14 +3782,14 @@ var CopilotChatView_default = CopilotChatView;
|
|
|
3495
3782
|
|
|
3496
3783
|
// src/components/chat/CopilotChat.tsx
|
|
3497
3784
|
var import_shared8 = require("@copilotkitnext/shared");
|
|
3498
|
-
var
|
|
3785
|
+
var import_react25 = require("react");
|
|
3499
3786
|
var import_ts_deepmerge = require("ts-deepmerge");
|
|
3500
3787
|
var import_client = require("@ag-ui/client");
|
|
3501
|
-
var
|
|
3788
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3502
3789
|
function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }) {
|
|
3503
3790
|
const existingConfig = useCopilotChatConfiguration();
|
|
3504
3791
|
const resolvedAgentId = agentId ?? existingConfig?.agentId ?? import_shared8.DEFAULT_AGENT_ID;
|
|
3505
|
-
const resolvedThreadId = (0,
|
|
3792
|
+
const resolvedThreadId = (0, import_react25.useMemo)(
|
|
3506
3793
|
() => threadId ?? existingConfig?.threadId ?? (0, import_shared8.randomUUID)(),
|
|
3507
3794
|
[threadId, existingConfig?.threadId]
|
|
3508
3795
|
);
|
|
@@ -3515,7 +3802,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
3515
3802
|
suggestionView: providedSuggestionView,
|
|
3516
3803
|
...restProps
|
|
3517
3804
|
} = props;
|
|
3518
|
-
(0,
|
|
3805
|
+
(0, import_react25.useEffect)(() => {
|
|
3519
3806
|
const connect = async (agent2) => {
|
|
3520
3807
|
try {
|
|
3521
3808
|
await copilotkit.connectAgent({ agent: agent2 });
|
|
@@ -3531,7 +3818,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
3531
3818
|
return () => {
|
|
3532
3819
|
};
|
|
3533
3820
|
}, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);
|
|
3534
|
-
const onSubmitInput = (0,
|
|
3821
|
+
const onSubmitInput = (0, import_react25.useCallback)(
|
|
3535
3822
|
async (value) => {
|
|
3536
3823
|
agent.addMessage({
|
|
3537
3824
|
id: (0, import_shared8.randomUUID)(),
|
|
@@ -3546,7 +3833,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
3546
3833
|
},
|
|
3547
3834
|
[agent, copilotkit]
|
|
3548
3835
|
);
|
|
3549
|
-
const handleSelectSuggestion = (0,
|
|
3836
|
+
const handleSelectSuggestion = (0, import_react25.useCallback)(
|
|
3550
3837
|
async (suggestion) => {
|
|
3551
3838
|
agent.addMessage({
|
|
3552
3839
|
id: (0, import_shared8.randomUUID)(),
|
|
@@ -3561,7 +3848,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
3561
3848
|
},
|
|
3562
3849
|
[agent, copilotkit]
|
|
3563
3850
|
);
|
|
3564
|
-
const stopCurrentRun = (0,
|
|
3851
|
+
const stopCurrentRun = (0, import_react25.useCallback)(() => {
|
|
3565
3852
|
try {
|
|
3566
3853
|
copilotkit.stopAgent({ agent });
|
|
3567
3854
|
} catch (error) {
|
|
@@ -3601,7 +3888,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
3601
3888
|
inputProps: finalInputProps
|
|
3602
3889
|
});
|
|
3603
3890
|
const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);
|
|
3604
|
-
return /* @__PURE__ */ (0,
|
|
3891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3605
3892
|
CopilotChatConfigurationProvider,
|
|
3606
3893
|
{
|
|
3607
3894
|
agentId: resolvedAgentId,
|
|
@@ -3617,17 +3904,17 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
|
|
|
3617
3904
|
})(CopilotChat || (CopilotChat = {}));
|
|
3618
3905
|
|
|
3619
3906
|
// src/components/chat/CopilotChatToggleButton.tsx
|
|
3620
|
-
var
|
|
3907
|
+
var import_react26 = __toESM(require("react"));
|
|
3621
3908
|
var import_lucide_react7 = require("lucide-react");
|
|
3622
|
-
var
|
|
3909
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3623
3910
|
var DefaultOpenIcon = ({
|
|
3624
3911
|
className,
|
|
3625
3912
|
...props
|
|
3626
|
-
}) => /* @__PURE__ */ (0,
|
|
3913
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react7.MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
|
|
3627
3914
|
var DefaultCloseIcon = ({
|
|
3628
3915
|
className,
|
|
3629
3916
|
...props
|
|
3630
|
-
}) => /* @__PURE__ */ (0,
|
|
3917
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react7.X, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
|
|
3631
3918
|
DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
|
|
3632
3919
|
DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
|
|
3633
3920
|
var ICON_TRANSITION_STYLE = Object.freeze({
|
|
@@ -3644,11 +3931,11 @@ var BUTTON_BASE_CLASSES = cn(
|
|
|
3644
3931
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
3645
3932
|
"disabled:pointer-events-none disabled:opacity-60"
|
|
3646
3933
|
);
|
|
3647
|
-
var CopilotChatToggleButton =
|
|
3934
|
+
var CopilotChatToggleButton = import_react26.default.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
|
|
3648
3935
|
const { onClick, type, disabled, ...restProps } = buttonProps;
|
|
3649
3936
|
const configuration = useCopilotChatConfiguration();
|
|
3650
3937
|
const labels = configuration?.labels ?? CopilotChatDefaultLabels;
|
|
3651
|
-
const [fallbackOpen, setFallbackOpen] = (0,
|
|
3938
|
+
const [fallbackOpen, setFallbackOpen] = (0, import_react26.useState)(false);
|
|
3652
3939
|
const isOpen = configuration?.isModalOpen ?? fallbackOpen;
|
|
3653
3940
|
const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;
|
|
3654
3941
|
const handleClick = (event) => {
|
|
@@ -3682,7 +3969,7 @@ var CopilotChatToggleButton = import_react25.default.forwardRef(function Copilot
|
|
|
3682
3969
|
focusable: false
|
|
3683
3970
|
}
|
|
3684
3971
|
);
|
|
3685
|
-
const openIconElement = /* @__PURE__ */ (0,
|
|
3972
|
+
const openIconElement = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3686
3973
|
"span",
|
|
3687
3974
|
{
|
|
3688
3975
|
"aria-hidden": "true",
|
|
@@ -3696,7 +3983,7 @@ var CopilotChatToggleButton = import_react25.default.forwardRef(function Copilot
|
|
|
3696
3983
|
children: renderedOpenIcon
|
|
3697
3984
|
}
|
|
3698
3985
|
);
|
|
3699
|
-
const closeIconElement = /* @__PURE__ */ (0,
|
|
3986
|
+
const closeIconElement = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3700
3987
|
"span",
|
|
3701
3988
|
{
|
|
3702
3989
|
"aria-hidden": "true",
|
|
@@ -3710,7 +3997,7 @@ var CopilotChatToggleButton = import_react25.default.forwardRef(function Copilot
|
|
|
3710
3997
|
children: renderedCloseIcon
|
|
3711
3998
|
}
|
|
3712
3999
|
);
|
|
3713
|
-
return /* @__PURE__ */ (0,
|
|
4000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3714
4001
|
"button",
|
|
3715
4002
|
{
|
|
3716
4003
|
ref,
|
|
@@ -3734,12 +4021,12 @@ CopilotChatToggleButton.displayName = "CopilotChatToggleButton";
|
|
|
3734
4021
|
var CopilotChatToggleButton_default = CopilotChatToggleButton;
|
|
3735
4022
|
|
|
3736
4023
|
// src/components/chat/CopilotSidebarView.tsx
|
|
3737
|
-
var
|
|
4024
|
+
var import_react28 = require("react");
|
|
3738
4025
|
|
|
3739
4026
|
// src/components/chat/CopilotModalHeader.tsx
|
|
3740
|
-
var
|
|
4027
|
+
var import_react27 = require("react");
|
|
3741
4028
|
var import_lucide_react8 = require("lucide-react");
|
|
3742
|
-
var
|
|
4029
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3743
4030
|
function CopilotModalHeader({
|
|
3744
4031
|
title,
|
|
3745
4032
|
titleContent,
|
|
@@ -3751,7 +4038,7 @@ function CopilotModalHeader({
|
|
|
3751
4038
|
const configuration = useCopilotChatConfiguration();
|
|
3752
4039
|
const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;
|
|
3753
4040
|
const resolvedTitle = title ?? fallbackTitle;
|
|
3754
|
-
const handleClose = (0,
|
|
4041
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
3755
4042
|
configuration?.setModalOpen(false);
|
|
3756
4043
|
}, [configuration]);
|
|
3757
4044
|
const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {
|
|
@@ -3768,7 +4055,7 @@ function CopilotModalHeader({
|
|
|
3768
4055
|
...rest
|
|
3769
4056
|
});
|
|
3770
4057
|
}
|
|
3771
|
-
return /* @__PURE__ */ (0,
|
|
4058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3772
4059
|
"header",
|
|
3773
4060
|
{
|
|
3774
4061
|
"data-slot": "copilot-modal-header",
|
|
@@ -3778,17 +4065,17 @@ function CopilotModalHeader({
|
|
|
3778
4065
|
className
|
|
3779
4066
|
),
|
|
3780
4067
|
...rest,
|
|
3781
|
-
children: /* @__PURE__ */ (0,
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
3783
|
-
/* @__PURE__ */ (0,
|
|
3784
|
-
/* @__PURE__ */ (0,
|
|
4068
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
|
|
4069
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1", "aria-hidden": "true" }),
|
|
4070
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
|
|
4071
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
|
|
3785
4072
|
] })
|
|
3786
4073
|
}
|
|
3787
4074
|
);
|
|
3788
4075
|
}
|
|
3789
4076
|
CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
3790
4077
|
((CopilotModalHeader2) => {
|
|
3791
|
-
CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0,
|
|
4078
|
+
CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3792
4079
|
"div",
|
|
3793
4080
|
{
|
|
3794
4081
|
className: cn(
|
|
@@ -3802,7 +4089,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
|
3802
4089
|
CopilotModalHeader2.CloseButton = ({
|
|
3803
4090
|
className,
|
|
3804
4091
|
...props
|
|
3805
|
-
}) => /* @__PURE__ */ (0,
|
|
4092
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3806
4093
|
"button",
|
|
3807
4094
|
{
|
|
3808
4095
|
type: "button",
|
|
@@ -3813,7 +4100,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
|
|
|
3813
4100
|
),
|
|
3814
4101
|
"aria-label": "Close",
|
|
3815
4102
|
...props,
|
|
3816
|
-
children: /* @__PURE__ */ (0,
|
|
4103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react8.X, { className: "h-4 w-4", "aria-hidden": "true" })
|
|
3817
4104
|
}
|
|
3818
4105
|
);
|
|
3819
4106
|
})(CopilotModalHeader || (CopilotModalHeader = {}));
|
|
@@ -3821,14 +4108,14 @@ CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
|
|
|
3821
4108
|
CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
|
|
3822
4109
|
|
|
3823
4110
|
// src/components/chat/CopilotSidebarView.tsx
|
|
3824
|
-
var
|
|
4111
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3825
4112
|
var DEFAULT_SIDEBAR_WIDTH = 480;
|
|
3826
4113
|
var SIDEBAR_TRANSITION_MS = 260;
|
|
3827
4114
|
function CopilotSidebarView({ header, width, ...props }) {
|
|
3828
4115
|
const configuration = useCopilotChatConfiguration();
|
|
3829
4116
|
const isSidebarOpen = configuration?.isModalOpen ?? false;
|
|
3830
|
-
const sidebarRef = (0,
|
|
3831
|
-
const [sidebarWidth, setSidebarWidth] = (0,
|
|
4117
|
+
const sidebarRef = (0, import_react28.useRef)(null);
|
|
4118
|
+
const [sidebarWidth, setSidebarWidth] = (0, import_react28.useState)(width ?? DEFAULT_SIDEBAR_WIDTH);
|
|
3832
4119
|
const widthToCss = (w) => {
|
|
3833
4120
|
return typeof w === "number" ? `${w}px` : w;
|
|
3834
4121
|
};
|
|
@@ -3838,7 +4125,7 @@ function CopilotSidebarView({ header, width, ...props }) {
|
|
|
3838
4125
|
}
|
|
3839
4126
|
return w;
|
|
3840
4127
|
};
|
|
3841
|
-
(0,
|
|
4128
|
+
(0, import_react28.useEffect)(() => {
|
|
3842
4129
|
if (width !== void 0) {
|
|
3843
4130
|
return;
|
|
3844
4131
|
}
|
|
@@ -3865,8 +4152,8 @@ function CopilotSidebarView({ header, width, ...props }) {
|
|
|
3865
4152
|
return () => window.removeEventListener("resize", updateWidth);
|
|
3866
4153
|
}, [width]);
|
|
3867
4154
|
const headerElement = renderSlot(header, CopilotModalHeader, {});
|
|
3868
|
-
return /* @__PURE__ */ (0,
|
|
3869
|
-
isSidebarOpen && /* @__PURE__ */ (0,
|
|
4155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
4156
|
+
isSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3870
4157
|
"style",
|
|
3871
4158
|
{
|
|
3872
4159
|
dangerouslySetInnerHTML: {
|
|
@@ -3880,8 +4167,8 @@ function CopilotSidebarView({ header, width, ...props }) {
|
|
|
3880
4167
|
}
|
|
3881
4168
|
}
|
|
3882
4169
|
),
|
|
3883
|
-
/* @__PURE__ */ (0,
|
|
3884
|
-
/* @__PURE__ */ (0,
|
|
4170
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotChatToggleButton_default, {}),
|
|
4171
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3885
4172
|
"aside",
|
|
3886
4173
|
{
|
|
3887
4174
|
ref: sidebarRef,
|
|
@@ -3906,9 +4193,9 @@ function CopilotSidebarView({ header, width, ...props }) {
|
|
|
3906
4193
|
"aria-hidden": !isSidebarOpen,
|
|
3907
4194
|
"aria-label": "Copilot chat sidebar",
|
|
3908
4195
|
role: "complementary",
|
|
3909
|
-
children: /* @__PURE__ */ (0,
|
|
4196
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
|
|
3910
4197
|
headerElement,
|
|
3911
|
-
/* @__PURE__ */ (0,
|
|
4198
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CopilotChatView_default, { ...props }) })
|
|
3912
4199
|
] })
|
|
3913
4200
|
}
|
|
3914
4201
|
)
|
|
@@ -3917,8 +4204,8 @@ function CopilotSidebarView({ header, width, ...props }) {
|
|
|
3917
4204
|
CopilotSidebarView.displayName = "CopilotSidebarView";
|
|
3918
4205
|
|
|
3919
4206
|
// src/components/chat/CopilotPopupView.tsx
|
|
3920
|
-
var
|
|
3921
|
-
var
|
|
4207
|
+
var import_react29 = require("react");
|
|
4208
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3922
4209
|
var DEFAULT_POPUP_WIDTH = 420;
|
|
3923
4210
|
var DEFAULT_POPUP_HEIGHT = 560;
|
|
3924
4211
|
var dimensionToCss = (value, fallback) => {
|
|
@@ -3942,10 +4229,10 @@ function CopilotPopupView({
|
|
|
3942
4229
|
const isPopupOpen = configuration?.isModalOpen ?? false;
|
|
3943
4230
|
const setModalOpen = configuration?.setModalOpen;
|
|
3944
4231
|
const labels = configuration?.labels ?? CopilotChatDefaultLabels;
|
|
3945
|
-
const containerRef = (0,
|
|
3946
|
-
const [isRendered, setIsRendered] = (0,
|
|
3947
|
-
const [isAnimatingOut, setIsAnimatingOut] = (0,
|
|
3948
|
-
(0,
|
|
4232
|
+
const containerRef = (0, import_react29.useRef)(null);
|
|
4233
|
+
const [isRendered, setIsRendered] = (0, import_react29.useState)(isPopupOpen);
|
|
4234
|
+
const [isAnimatingOut, setIsAnimatingOut] = (0, import_react29.useState)(false);
|
|
4235
|
+
(0, import_react29.useEffect)(() => {
|
|
3949
4236
|
if (isPopupOpen) {
|
|
3950
4237
|
setIsRendered(true);
|
|
3951
4238
|
setIsAnimatingOut(false);
|
|
@@ -3961,7 +4248,7 @@ function CopilotPopupView({
|
|
|
3961
4248
|
}, 200);
|
|
3962
4249
|
return () => clearTimeout(timeout);
|
|
3963
4250
|
}, [isPopupOpen, isRendered]);
|
|
3964
|
-
(0,
|
|
4251
|
+
(0, import_react29.useEffect)(() => {
|
|
3965
4252
|
if (!isPopupOpen) {
|
|
3966
4253
|
return;
|
|
3967
4254
|
}
|
|
@@ -3977,7 +4264,7 @@ function CopilotPopupView({
|
|
|
3977
4264
|
window.addEventListener("keydown", handleKeyDown);
|
|
3978
4265
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
3979
4266
|
}, [isPopupOpen, setModalOpen]);
|
|
3980
|
-
(0,
|
|
4267
|
+
(0, import_react29.useEffect)(() => {
|
|
3981
4268
|
if (!isPopupOpen) {
|
|
3982
4269
|
return;
|
|
3983
4270
|
}
|
|
@@ -3986,7 +4273,7 @@ function CopilotPopupView({
|
|
|
3986
4273
|
}, 200);
|
|
3987
4274
|
return () => clearTimeout(focusTimer);
|
|
3988
4275
|
}, [isPopupOpen]);
|
|
3989
|
-
(0,
|
|
4276
|
+
(0, import_react29.useEffect)(() => {
|
|
3990
4277
|
if (!isPopupOpen || !clickOutsideToClose) {
|
|
3991
4278
|
return;
|
|
3992
4279
|
}
|
|
@@ -4011,10 +4298,10 @@ function CopilotPopupView({
|
|
|
4011
4298
|
document.addEventListener("pointerdown", handlePointerDown);
|
|
4012
4299
|
return () => document.removeEventListener("pointerdown", handlePointerDown);
|
|
4013
4300
|
}, [isPopupOpen, clickOutsideToClose, setModalOpen]);
|
|
4014
|
-
const headerElement = (0,
|
|
4301
|
+
const headerElement = (0, import_react29.useMemo)(() => renderSlot(header, CopilotModalHeader, {}), [header]);
|
|
4015
4302
|
const resolvedWidth = dimensionToCss(width, DEFAULT_POPUP_WIDTH);
|
|
4016
4303
|
const resolvedHeight = dimensionToCss(height, DEFAULT_POPUP_HEIGHT);
|
|
4017
|
-
const popupStyle = (0,
|
|
4304
|
+
const popupStyle = (0, import_react29.useMemo)(
|
|
4018
4305
|
() => ({
|
|
4019
4306
|
"--copilot-popup-width": resolvedWidth,
|
|
4020
4307
|
"--copilot-popup-height": resolvedHeight,
|
|
@@ -4028,14 +4315,14 @@ function CopilotPopupView({
|
|
|
4028
4315
|
[resolvedHeight, resolvedWidth]
|
|
4029
4316
|
);
|
|
4030
4317
|
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]";
|
|
4031
|
-
const popupContent = isRendered ? /* @__PURE__ */ (0,
|
|
4318
|
+
const popupContent = isRendered ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4032
4319
|
"div",
|
|
4033
4320
|
{
|
|
4034
4321
|
className: cn(
|
|
4035
4322
|
"fixed inset-0 z-[1200] flex max-w-full flex-col items-stretch",
|
|
4036
4323
|
"md:inset-auto md:bottom-24 md:right-6 md:items-end md:gap-4"
|
|
4037
4324
|
),
|
|
4038
|
-
children: /* @__PURE__ */ (0,
|
|
4325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4039
4326
|
"div",
|
|
4040
4327
|
{
|
|
4041
4328
|
ref: containerRef,
|
|
@@ -4056,7 +4343,7 @@ function CopilotPopupView({
|
|
|
4056
4343
|
style: popupStyle,
|
|
4057
4344
|
children: [
|
|
4058
4345
|
headerElement,
|
|
4059
|
-
/* @__PURE__ */ (0,
|
|
4346
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1 overflow-hidden", "data-popup-chat": true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4060
4347
|
CopilotChatView_default,
|
|
4061
4348
|
{
|
|
4062
4349
|
...restProps,
|
|
@@ -4068,21 +4355,21 @@ function CopilotPopupView({
|
|
|
4068
4355
|
)
|
|
4069
4356
|
}
|
|
4070
4357
|
) : null;
|
|
4071
|
-
return /* @__PURE__ */ (0,
|
|
4072
|
-
/* @__PURE__ */ (0,
|
|
4358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CopilotChatToggleButton_default, {}),
|
|
4073
4360
|
popupContent
|
|
4074
4361
|
] });
|
|
4075
4362
|
}
|
|
4076
4363
|
CopilotPopupView.displayName = "CopilotPopupView";
|
|
4077
4364
|
|
|
4078
4365
|
// src/components/chat/CopilotSidebar.tsx
|
|
4079
|
-
var
|
|
4080
|
-
var
|
|
4366
|
+
var import_react30 = require("react");
|
|
4367
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4081
4368
|
function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
|
|
4082
|
-
const SidebarViewOverride = (0,
|
|
4369
|
+
const SidebarViewOverride = (0, import_react30.useMemo)(() => {
|
|
4083
4370
|
const Component = (viewProps) => {
|
|
4084
4371
|
const { header: viewHeader, width: viewWidth, ...restProps } = viewProps;
|
|
4085
|
-
return /* @__PURE__ */ (0,
|
|
4372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4086
4373
|
CopilotSidebarView,
|
|
4087
4374
|
{
|
|
4088
4375
|
...restProps,
|
|
@@ -4093,7 +4380,7 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
|
|
|
4093
4380
|
};
|
|
4094
4381
|
return Object.assign(Component, CopilotChatView_default);
|
|
4095
4382
|
}, [header, width]);
|
|
4096
|
-
return /* @__PURE__ */ (0,
|
|
4383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4097
4384
|
CopilotChat,
|
|
4098
4385
|
{
|
|
4099
4386
|
...chatProps,
|
|
@@ -4105,8 +4392,8 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
|
|
|
4105
4392
|
CopilotSidebar.displayName = "CopilotSidebar";
|
|
4106
4393
|
|
|
4107
4394
|
// src/components/chat/CopilotPopup.tsx
|
|
4108
|
-
var
|
|
4109
|
-
var
|
|
4395
|
+
var import_react31 = require("react");
|
|
4396
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4110
4397
|
function CopilotPopup({
|
|
4111
4398
|
header,
|
|
4112
4399
|
defaultOpen,
|
|
@@ -4115,7 +4402,7 @@ function CopilotPopup({
|
|
|
4115
4402
|
clickOutsideToClose,
|
|
4116
4403
|
...chatProps
|
|
4117
4404
|
}) {
|
|
4118
|
-
const PopupViewOverride = (0,
|
|
4405
|
+
const PopupViewOverride = (0, import_react31.useMemo)(() => {
|
|
4119
4406
|
const Component = (viewProps) => {
|
|
4120
4407
|
const {
|
|
4121
4408
|
header: viewHeader,
|
|
@@ -4124,7 +4411,7 @@ function CopilotPopup({
|
|
|
4124
4411
|
clickOutsideToClose: viewClickOutsideToClose,
|
|
4125
4412
|
...restProps
|
|
4126
4413
|
} = viewProps;
|
|
4127
|
-
return /* @__PURE__ */ (0,
|
|
4414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4128
4415
|
CopilotPopupView,
|
|
4129
4416
|
{
|
|
4130
4417
|
...restProps,
|
|
@@ -4137,7 +4424,7 @@ function CopilotPopup({
|
|
|
4137
4424
|
};
|
|
4138
4425
|
return Object.assign(Component, CopilotChatView_default);
|
|
4139
4426
|
}, [clickOutsideToClose, header, height, width]);
|
|
4140
|
-
return /* @__PURE__ */ (0,
|
|
4427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4141
4428
|
CopilotChat,
|
|
4142
4429
|
{
|
|
4143
4430
|
...chatProps,
|
|
@@ -4149,9 +4436,9 @@ function CopilotPopup({
|
|
|
4149
4436
|
CopilotPopup.displayName = "CopilotPopup";
|
|
4150
4437
|
|
|
4151
4438
|
// src/types/defineToolCallRenderer.ts
|
|
4152
|
-
var
|
|
4439
|
+
var import_zod3 = require("zod");
|
|
4153
4440
|
function defineToolCallRenderer(def) {
|
|
4154
|
-
const argsSchema = def.name === "*" && !def.args ?
|
|
4441
|
+
const argsSchema = def.name === "*" && !def.args ? import_zod3.z.any() : def.args;
|
|
4155
4442
|
return {
|
|
4156
4443
|
name: def.name,
|
|
4157
4444
|
args: argsSchema,
|
|
@@ -4161,25 +4448,25 @@ function defineToolCallRenderer(def) {
|
|
|
4161
4448
|
}
|
|
4162
4449
|
|
|
4163
4450
|
// src/components/WildcardToolCallRender.tsx
|
|
4164
|
-
var
|
|
4165
|
-
var
|
|
4451
|
+
var import_react32 = require("react");
|
|
4452
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
4166
4453
|
var WildcardToolCallRender = defineToolCallRenderer({
|
|
4167
4454
|
name: "*",
|
|
4168
4455
|
render: ({ args, result, name, status }) => {
|
|
4169
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
4456
|
+
const [isExpanded, setIsExpanded] = (0, import_react32.useState)(false);
|
|
4170
4457
|
const statusString = String(status);
|
|
4171
4458
|
const isActive = statusString === "inProgress" || statusString === "executing";
|
|
4172
4459
|
const isComplete = statusString === "complete";
|
|
4173
4460
|
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";
|
|
4174
|
-
return /* @__PURE__ */ (0,
|
|
4175
|
-
/* @__PURE__ */ (0,
|
|
4461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("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: [
|
|
4462
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
4176
4463
|
"div",
|
|
4177
4464
|
{
|
|
4178
4465
|
className: "flex items-center justify-between gap-3 cursor-pointer",
|
|
4179
4466
|
onClick: () => setIsExpanded(!isExpanded),
|
|
4180
4467
|
children: [
|
|
4181
|
-
/* @__PURE__ */ (0,
|
|
4182
|
-
/* @__PURE__ */ (0,
|
|
4468
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
4469
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4183
4470
|
"svg",
|
|
4184
4471
|
{
|
|
4185
4472
|
className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
|
|
@@ -4187,7 +4474,7 @@ var WildcardToolCallRender = defineToolCallRenderer({
|
|
|
4187
4474
|
viewBox: "0 0 24 24",
|
|
4188
4475
|
strokeWidth: 2,
|
|
4189
4476
|
stroke: "currentColor",
|
|
4190
|
-
children: /* @__PURE__ */ (0,
|
|
4477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4191
4478
|
"path",
|
|
4192
4479
|
{
|
|
4193
4480
|
strokeLinecap: "round",
|
|
@@ -4197,10 +4484,10 @@ var WildcardToolCallRender = defineToolCallRenderer({
|
|
|
4197
4484
|
)
|
|
4198
4485
|
}
|
|
4199
4486
|
),
|
|
4200
|
-
/* @__PURE__ */ (0,
|
|
4201
|
-
/* @__PURE__ */ (0,
|
|
4487
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
|
|
4488
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
|
|
4202
4489
|
] }),
|
|
4203
|
-
/* @__PURE__ */ (0,
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4204
4491
|
"span",
|
|
4205
4492
|
{
|
|
4206
4493
|
className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
|
|
@@ -4210,14 +4497,14 @@ var WildcardToolCallRender = defineToolCallRenderer({
|
|
|
4210
4497
|
]
|
|
4211
4498
|
}
|
|
4212
4499
|
),
|
|
4213
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
4214
|
-
/* @__PURE__ */ (0,
|
|
4215
|
-
/* @__PURE__ */ (0,
|
|
4216
|
-
/* @__PURE__ */ (0,
|
|
4500
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mt-3 grid gap-4", children: [
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
|
|
4217
4504
|
] }),
|
|
4218
|
-
result !== void 0 && /* @__PURE__ */ (0,
|
|
4219
|
-
/* @__PURE__ */ (0,
|
|
4220
|
-
/* @__PURE__ */ (0,
|
|
4505
|
+
result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
|
|
4221
4508
|
] })
|
|
4222
4509
|
] })
|
|
4223
4510
|
] }) });
|
|
@@ -4248,6 +4535,9 @@ var WildcardToolCallRender = defineToolCallRenderer({
|
|
|
4248
4535
|
CopilotPopupView,
|
|
4249
4536
|
CopilotSidebar,
|
|
4250
4537
|
CopilotSidebarView,
|
|
4538
|
+
MCPAppsActivityContentSchema,
|
|
4539
|
+
MCPAppsActivityRenderer,
|
|
4540
|
+
MCPAppsActivityType,
|
|
4251
4541
|
WildcardToolCallRender,
|
|
4252
4542
|
defineToolCallRenderer,
|
|
4253
4543
|
useAgent,
|