@copilotkitnext/react 0.0.13-alpha.1 → 0.0.13

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.js CHANGED
@@ -46,12 +46,14 @@ __export(index_exports, {
46
46
  CopilotChatToolCallsView: () => CopilotChatToolCallsView_default,
47
47
  CopilotChatUserMessage: () => CopilotChatUserMessage_default,
48
48
  CopilotChatView: () => CopilotChatView_default,
49
+ CopilotKitCoreReact: () => CopilotKitCoreReact,
49
50
  CopilotKitProvider: () => CopilotKitProvider,
50
51
  CopilotModalHeader: () => CopilotModalHeader,
51
52
  CopilotSidebar: () => CopilotSidebar,
52
53
  CopilotSidebarView: () => CopilotSidebarView,
54
+ WebInspector: () => WebInspector,
53
55
  WildcardToolCallRender: () => WildcardToolCallRender,
54
- defineToolCallRender: () => defineToolCallRender,
56
+ defineToolCallRenderer: () => defineToolCallRenderer,
55
57
  useAgent: () => useAgent,
56
58
  useAgentContext: () => useAgentContext,
57
59
  useConfigureSuggestions: () => useConfigureSuggestions,
@@ -59,6 +61,7 @@ __export(index_exports, {
59
61
  useCopilotKit: () => useCopilotKit,
60
62
  useFrontendTool: () => useFrontendTool,
61
63
  useHumanInTheLoop: () => useHumanInTheLoop,
64
+ useRenderCustomMessages: () => useRenderCustomMessages,
62
65
  useRenderToolCall: () => useRenderToolCall,
63
66
  useSuggestions: () => useSuggestions
64
67
  });
@@ -951,33 +954,95 @@ var import_remark_gfm = __toESM(require("remark-gfm"));
951
954
  var import_remark_math = __toESM(require("remark-math"));
952
955
  var import_rehype_pretty_code = __toESM(require("rehype-pretty-code"));
953
956
  var import_rehype_katex = __toESM(require("rehype-katex"));
954
- var import_react15 = require("react");
957
+ var import_react16 = require("react");
955
958
  var import_lucide_react3 = require("lucide-react");
956
959
  var import_tailwind_merge4 = require("tailwind-merge");
957
960
  var import_katex_min = require("katex/dist/katex.min.css");
958
961
  var import_core3 = require("@copilotkitnext/core");
959
962
 
960
963
  // src/hooks/use-render-tool-call.tsx
961
- var import_react6 = require("react");
964
+ var import_react7 = require("react");
962
965
  var import_core2 = require("@copilotkitnext/core");
963
966
 
964
967
  // src/providers/CopilotKitProvider.tsx
965
- var import_react5 = require("react");
968
+ var import_react6 = require("react");
966
969
  var import_zod = require("zod");
970
+
971
+ // src/lib/react-core.ts
967
972
  var import_core = require("@copilotkitnext/core");
973
+ var CopilotKitCoreReact = class extends import_core.CopilotKitCore {
974
+ _renderToolCalls = [];
975
+ _renderCustomMessages = [];
976
+ constructor(config) {
977
+ super(config);
978
+ this._renderToolCalls = config.renderToolCalls ?? [];
979
+ this._renderCustomMessages = config.renderCustomMessages ?? [];
980
+ }
981
+ get renderCustomMessages() {
982
+ return this._renderCustomMessages;
983
+ }
984
+ get renderToolCalls() {
985
+ return this._renderToolCalls;
986
+ }
987
+ setRenderToolCalls(renderToolCalls) {
988
+ this._renderToolCalls = renderToolCalls;
989
+ void this.notifySubscribers(
990
+ (subscriber) => {
991
+ const reactSubscriber = subscriber;
992
+ if (reactSubscriber.onRenderToolCallsChanged) {
993
+ reactSubscriber.onRenderToolCallsChanged({
994
+ copilotkit: this,
995
+ renderToolCalls: this.renderToolCalls
996
+ });
997
+ }
998
+ },
999
+ "Subscriber onRenderToolCallsChanged error:"
1000
+ );
1001
+ }
1002
+ // Override to accept React-specific subscriber type
1003
+ subscribe(subscriber) {
1004
+ return super.subscribe(subscriber);
1005
+ }
1006
+ unsubscribe(subscriber) {
1007
+ super.unsubscribe(subscriber);
1008
+ }
1009
+ };
1010
+
1011
+ // src/components/WebInspector.tsx
1012
+ var React4 = __toESM(require("react"));
1013
+ var import_react5 = require("@lit-labs/react");
1014
+ var import_web_inspector = require("@copilotkitnext/web-inspector");
968
1015
  var import_jsx_runtime7 = require("react/jsx-runtime");
969
- var CopilotKitContext = (0, import_react5.createContext)({
970
- copilotkit: null,
971
- renderToolCalls: [],
972
- currentRenderToolCalls: [],
973
- setCurrentRenderToolCalls: () => {
1016
+ (0, import_web_inspector.defineWebInspector)();
1017
+ var WebInspectorBase = (0, import_react5.createComponent)({
1018
+ tagName: import_web_inspector.WEB_INSPECTOR_TAG,
1019
+ elementClass: import_web_inspector.WebInspectorElement,
1020
+ react: React4
1021
+ });
1022
+ var WebInspector = React4.forwardRef(
1023
+ ({ core, ...rest }, ref) => {
1024
+ const innerRef = React4.useRef(null);
1025
+ React4.useImperativeHandle(ref, () => innerRef.current, []);
1026
+ React4.useEffect(() => {
1027
+ if (innerRef.current) {
1028
+ innerRef.current.core = core ?? null;
1029
+ }
1030
+ }, [core]);
1031
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(WebInspectorBase, { ...rest, ref: innerRef });
974
1032
  }
1033
+ );
1034
+ WebInspector.displayName = "WebInspector";
1035
+
1036
+ // src/providers/CopilotKitProvider.tsx
1037
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1038
+ var CopilotKitContext = (0, import_react6.createContext)({
1039
+ copilotkit: null
975
1040
  });
976
1041
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
977
- const empty = (0, import_react5.useMemo)(() => [], []);
1042
+ const empty = (0, import_react6.useMemo)(() => [], []);
978
1043
  const value = prop ?? empty;
979
- const initial = (0, import_react5.useRef)(value);
980
- (0, import_react5.useEffect)(() => {
1044
+ const initial = (0, import_react6.useRef)(value);
1045
+ (0, import_react6.useEffect)(() => {
981
1046
  if (warningMessage && value !== initial.current && (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)) {
982
1047
  console.error(warningMessage);
983
1048
  }
@@ -991,9 +1056,29 @@ var CopilotKitProvider = ({
991
1056
  properties = {},
992
1057
  agents__unsafe_dev_only: agents = {},
993
1058
  renderToolCalls,
1059
+ renderCustomMessages,
994
1060
  frontendTools,
995
- humanInTheLoop
1061
+ humanInTheLoop,
1062
+ showDevConsole = false
996
1063
  }) => {
1064
+ const [shouldRenderInspector, setShouldRenderInspector] = (0, import_react6.useState)(false);
1065
+ (0, import_react6.useEffect)(() => {
1066
+ if (typeof window === "undefined") {
1067
+ return;
1068
+ }
1069
+ if (showDevConsole === true) {
1070
+ setShouldRenderInspector(true);
1071
+ } else if (showDevConsole === "auto") {
1072
+ const localhostHosts = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]);
1073
+ if (localhostHosts.has(window.location.hostname)) {
1074
+ setShouldRenderInspector(true);
1075
+ } else {
1076
+ setShouldRenderInspector(false);
1077
+ }
1078
+ } else {
1079
+ setShouldRenderInspector(false);
1080
+ }
1081
+ }, [showDevConsole]);
997
1082
  const renderToolCallsList = useStableArrayProp(
998
1083
  renderToolCalls,
999
1084
  "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.",
@@ -1007,6 +1092,10 @@ var CopilotKitProvider = ({
1007
1092
  return false;
1008
1093
  }
1009
1094
  );
1095
+ const renderCustomMessagesList = useStableArrayProp(
1096
+ renderCustomMessages,
1097
+ "renderCustomMessages must be a stable array."
1098
+ );
1010
1099
  const frontendToolsList = useStableArrayProp(
1011
1100
  frontendTools,
1012
1101
  "frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead."
@@ -1015,9 +1104,7 @@ var CopilotKitProvider = ({
1015
1104
  humanInTheLoop,
1016
1105
  "humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead."
1017
1106
  );
1018
- const initialRenderToolCalls = (0, import_react5.useMemo)(() => renderToolCallsList, []);
1019
- const [currentRenderToolCalls, setCurrentRenderToolCalls] = (0, import_react5.useState)([]);
1020
- const processedHumanInTheLoopTools = (0, import_react5.useMemo)(() => {
1107
+ const processedHumanInTheLoopTools = (0, import_react6.useMemo)(() => {
1021
1108
  const processedTools = [];
1022
1109
  const processedRenderToolCalls = [];
1023
1110
  humanInTheLoopList.forEach((tool) => {
@@ -1046,13 +1133,13 @@ var CopilotKitProvider = ({
1046
1133
  });
1047
1134
  return { tools: processedTools, renderToolCalls: processedRenderToolCalls };
1048
1135
  }, [humanInTheLoopList]);
1049
- const allTools = (0, import_react5.useMemo)(() => {
1136
+ const allTools = (0, import_react6.useMemo)(() => {
1050
1137
  const tools = [];
1051
1138
  tools.push(...frontendToolsList);
1052
1139
  tools.push(...processedHumanInTheLoopTools.tools);
1053
1140
  return tools;
1054
1141
  }, [frontendToolsList, processedHumanInTheLoopTools]);
1055
- const allRenderToolCalls = (0, import_react5.useMemo)(() => {
1142
+ const allRenderToolCalls = (0, import_react6.useMemo)(() => {
1056
1143
  const combined = [...renderToolCallsList];
1057
1144
  frontendToolsList.forEach((tool) => {
1058
1145
  if (tool.render) {
@@ -1069,69 +1156,55 @@ var CopilotKitProvider = ({
1069
1156
  combined.push(...processedHumanInTheLoopTools.renderToolCalls);
1070
1157
  return combined;
1071
1158
  }, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);
1072
- const copilotkit = (0, import_react5.useMemo)(() => {
1073
- const config = {
1159
+ const copilotkit = (0, import_react6.useMemo)(() => {
1160
+ const copilotkit2 = new CopilotKitCoreReact({
1074
1161
  runtimeUrl,
1075
1162
  headers,
1076
1163
  properties,
1077
1164
  agents__unsafe_dev_only: agents,
1078
- tools: allTools
1079
- };
1080
- const copilotkit2 = new import_core.CopilotKitCore(config);
1165
+ tools: allTools,
1166
+ renderToolCalls: allRenderToolCalls,
1167
+ renderCustomMessages: renderCustomMessagesList
1168
+ });
1081
1169
  return copilotkit2;
1082
- }, [allTools]);
1083
- (0, import_react5.useEffect)(() => {
1084
- setCurrentRenderToolCalls((prev) => {
1085
- const keyOf = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
1086
- const computedMap = /* @__PURE__ */ new Map();
1087
- for (const rc of allRenderToolCalls) {
1088
- computedMap.set(keyOf(rc), rc);
1089
- }
1090
- const merged = [...computedMap.values()];
1091
- for (const rc of prev) {
1092
- const k = keyOf(rc);
1093
- if (!computedMap.has(k)) merged.push(rc);
1094
- }
1095
- const sameLength = merged.length === prev.length;
1096
- if (sameLength) {
1097
- let same = true;
1098
- for (let i = 0; i < merged.length; i++) {
1099
- if (merged[i] !== prev[i]) {
1100
- same = false;
1101
- break;
1102
- }
1103
- }
1104
- if (same) return prev;
1170
+ }, [allTools, allRenderToolCalls, renderCustomMessagesList]);
1171
+ const [, forceUpdate] = (0, import_react6.useReducer)((x) => x + 1, 0);
1172
+ (0, import_react6.useEffect)(() => {
1173
+ const unsubscribe = copilotkit.subscribe({
1174
+ onRenderToolCallsChanged: () => {
1175
+ forceUpdate();
1105
1176
  }
1106
- return merged;
1107
1177
  });
1108
- }, [allRenderToolCalls]);
1109
- (0, import_react5.useEffect)(() => {
1178
+ return () => {
1179
+ unsubscribe();
1180
+ };
1181
+ }, [copilotkit]);
1182
+ (0, import_react6.useEffect)(() => {
1110
1183
  copilotkit.setRuntimeUrl(runtimeUrl);
1111
1184
  copilotkit.setHeaders(headers);
1112
1185
  copilotkit.setProperties(properties);
1113
1186
  copilotkit.setAgents__unsafe_dev_only(agents);
1114
1187
  }, [runtimeUrl, headers, properties, agents]);
1115
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1188
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1116
1189
  CopilotKitContext.Provider,
1117
1190
  {
1118
1191
  value: {
1119
- copilotkit,
1120
- renderToolCalls: allRenderToolCalls,
1121
- currentRenderToolCalls,
1122
- setCurrentRenderToolCalls
1192
+ copilotkit
1123
1193
  },
1124
- children
1194
+ children: [
1195
+ children,
1196
+ shouldRenderInspector ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WebInspector, { core: copilotkit }) : null
1197
+ ]
1125
1198
  }
1126
1199
  );
1127
1200
  };
1128
1201
  var useCopilotKit = () => {
1129
- const context = (0, import_react5.useContext)(CopilotKitContext);
1130
- const [, forceUpdate] = (0, import_react5.useReducer)((x) => x + 1, 0);
1202
+ const context = (0, import_react6.useContext)(CopilotKitContext);
1203
+ const [, forceUpdate] = (0, import_react6.useReducer)((x) => x + 1, 0);
1131
1204
  if (!context) {
1132
1205
  throw new Error("useCopilotKit must be used within CopilotKitProvider");
1133
1206
  }
1134
- (0, import_react5.useEffect)(() => {
1207
+ (0, import_react6.useEffect)(() => {
1135
1208
  const unsubscribe = context.copilotkit.subscribe({
1136
1209
  onRuntimeConnectionStatusChanged: () => {
1137
1210
  forceUpdate();
@@ -1147,13 +1220,22 @@ var useCopilotKit = () => {
1147
1220
  // src/hooks/use-render-tool-call.tsx
1148
1221
  var import_shared2 = require("@copilotkitnext/shared");
1149
1222
  var import_shared3 = require("@copilotkitnext/shared");
1150
- var import_jsx_runtime8 = require("react/jsx-runtime");
1223
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1151
1224
  function useRenderToolCall() {
1152
- const { currentRenderToolCalls, copilotkit } = useCopilotKit();
1225
+ const { copilotkit } = useCopilotKit();
1153
1226
  const config = useCopilotChatConfiguration();
1154
1227
  const agentId = config?.agentId ?? import_shared2.DEFAULT_AGENT_ID;
1155
- const [executingToolCallIds, setExecutingToolCallIds] = (0, import_react6.useState)(() => /* @__PURE__ */ new Set());
1156
- (0, import_react6.useEffect)(() => {
1228
+ const [executingToolCallIds, setExecutingToolCallIds] = (0, import_react7.useState)(() => /* @__PURE__ */ new Set());
1229
+ const renderToolCalls = (0, import_react7.useSyncExternalStore)(
1230
+ (callback) => {
1231
+ return copilotkit.subscribe({
1232
+ onRenderToolCallsChanged: callback
1233
+ });
1234
+ },
1235
+ () => copilotkit.renderToolCalls,
1236
+ () => copilotkit.renderToolCalls
1237
+ );
1238
+ (0, import_react7.useEffect)(() => {
1157
1239
  const unsubscribe = copilotkit.subscribe({
1158
1240
  onToolExecutionStart: ({ toolCallId }) => {
1159
1241
  setExecutingToolCallIds((prev) => {
@@ -1174,15 +1256,15 @@ function useRenderToolCall() {
1174
1256
  });
1175
1257
  return () => unsubscribe();
1176
1258
  }, [copilotkit]);
1177
- const renderToolCall = (0, import_react6.useCallback)(
1259
+ const renderToolCall = (0, import_react7.useCallback)(
1178
1260
  ({
1179
1261
  toolCall,
1180
1262
  toolMessage
1181
1263
  }) => {
1182
- const exactMatches = currentRenderToolCalls.filter(
1264
+ const exactMatches = renderToolCalls.filter(
1183
1265
  (rc) => rc.name === toolCall.function.name
1184
1266
  );
1185
- const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || currentRenderToolCalls.find((rc) => rc.name === "*");
1267
+ const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
1186
1268
  if (!renderConfig) {
1187
1269
  return null;
1188
1270
  }
@@ -1190,7 +1272,7 @@ function useRenderToolCall() {
1190
1272
  const args = (0, import_shared3.partialJSONParse)(toolCall.function.arguments);
1191
1273
  const toolName = toolCall.function.name;
1192
1274
  if (toolMessage) {
1193
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1275
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1194
1276
  RenderComponent,
1195
1277
  {
1196
1278
  name: toolName,
@@ -1201,7 +1283,7 @@ function useRenderToolCall() {
1201
1283
  toolCall.id
1202
1284
  );
1203
1285
  } else if (executingToolCallIds.has(toolCall.id)) {
1204
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1286
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1205
1287
  RenderComponent,
1206
1288
  {
1207
1289
  name: toolName,
@@ -1212,7 +1294,7 @@ function useRenderToolCall() {
1212
1294
  toolCall.id
1213
1295
  );
1214
1296
  } else {
1215
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1297
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1216
1298
  RenderComponent,
1217
1299
  {
1218
1300
  name: toolName,
@@ -1224,16 +1306,74 @@ function useRenderToolCall() {
1224
1306
  );
1225
1307
  }
1226
1308
  },
1227
- [currentRenderToolCalls, executingToolCallIds, agentId]
1309
+ [renderToolCalls, executingToolCallIds, agentId]
1228
1310
  );
1229
1311
  return renderToolCall;
1230
1312
  }
1231
1313
 
1314
+ // src/hooks/use-render-custom-messages.tsx
1315
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1316
+ function useRenderCustomMessages() {
1317
+ const { copilotkit } = useCopilotKit();
1318
+ const config = useCopilotChatConfiguration();
1319
+ if (!config) {
1320
+ return null;
1321
+ }
1322
+ const { agentId, threadId } = config;
1323
+ const customMessageRenderers = copilotkit.renderCustomMessages.filter((renderer) => renderer.agentId === void 0 || renderer.agentId === agentId).sort((a, b) => {
1324
+ const aHasAgent = a.agentId !== void 0;
1325
+ const bHasAgent = b.agentId !== void 0;
1326
+ if (aHasAgent === bHasAgent) return 0;
1327
+ return aHasAgent ? -1 : 1;
1328
+ });
1329
+ return function(params) {
1330
+ if (!customMessageRenderers.length) {
1331
+ return null;
1332
+ }
1333
+ const { message, position } = params;
1334
+ const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
1335
+ const agent = copilotkit.getAgent(agentId);
1336
+ if (!agent) {
1337
+ throw new Error("Agent not found");
1338
+ }
1339
+ const messagesIdsInRun = agent.messages.filter((msg) => copilotkit.getRunIdForMessage(agentId, threadId, msg.id) === runId).map((msg) => msg.id);
1340
+ const messageIndex = agent.messages.findIndex((msg) => msg.id === message.id) ?? 0;
1341
+ const messageIndexInRun = Math.min(messagesIdsInRun.indexOf(message.id), 0);
1342
+ const numberOfMessagesInRun = messagesIdsInRun.length;
1343
+ const stateSnapshot = copilotkit.getStateByRun(agentId, threadId, runId);
1344
+ let result = null;
1345
+ for (const renderer of customMessageRenderers) {
1346
+ if (!renderer.render) {
1347
+ continue;
1348
+ }
1349
+ const Component = renderer.render;
1350
+ result = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1351
+ Component,
1352
+ {
1353
+ message,
1354
+ position,
1355
+ runId,
1356
+ messageIndex,
1357
+ messageIndexInRun,
1358
+ numberOfMessagesInRun,
1359
+ agentId,
1360
+ stateSnapshot
1361
+ },
1362
+ `${runId}-${message.id}-${position}`
1363
+ );
1364
+ if (result) {
1365
+ break;
1366
+ }
1367
+ }
1368
+ return result;
1369
+ };
1370
+ }
1371
+
1232
1372
  // src/hooks/use-frontend-tool.tsx
1233
- var import_react7 = require("react");
1373
+ var import_react8 = require("react");
1234
1374
  function useFrontendTool(tool) {
1235
- const { copilotkit, setCurrentRenderToolCalls } = useCopilotKit();
1236
- (0, import_react7.useEffect)(() => {
1375
+ const { copilotkit } = useCopilotKit();
1376
+ (0, import_react8.useEffect)(() => {
1237
1377
  const name = tool.name;
1238
1378
  if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {
1239
1379
  console.warn(
@@ -1243,52 +1383,52 @@ function useFrontendTool(tool) {
1243
1383
  }
1244
1384
  copilotkit.addTool(tool);
1245
1385
  if (tool.render) {
1246
- setCurrentRenderToolCalls((prev) => {
1247
- const replaced = prev.filter(
1248
- (rc) => !(rc.name === name && rc.agentId === tool.agentId)
1249
- );
1250
- return [
1251
- ...replaced,
1252
- {
1253
- name,
1254
- args: tool.parameters,
1255
- agentId: tool.agentId,
1256
- render: tool.render
1257
- }
1258
- ];
1259
- });
1386
+ const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
1387
+ const currentRenderToolCalls = copilotkit.renderToolCalls;
1388
+ const mergedMap = /* @__PURE__ */ new Map();
1389
+ for (const rc of currentRenderToolCalls) {
1390
+ mergedMap.set(keyOf(rc), rc);
1391
+ }
1392
+ const newEntry = {
1393
+ name,
1394
+ args: tool.parameters,
1395
+ agentId: tool.agentId,
1396
+ render: tool.render
1397
+ };
1398
+ mergedMap.set(keyOf(newEntry), newEntry);
1399
+ copilotkit.setRenderToolCalls(Array.from(mergedMap.values()));
1260
1400
  }
1261
1401
  return () => {
1262
1402
  copilotkit.removeTool(name, tool.agentId);
1263
1403
  };
1264
- }, [tool.name, copilotkit, setCurrentRenderToolCalls]);
1404
+ }, [tool.name, copilotkit]);
1265
1405
  }
1266
1406
 
1267
1407
  // src/hooks/use-human-in-the-loop.tsx
1268
- var import_react8 = require("react");
1269
- var import_react9 = __toESM(require("react"));
1408
+ var import_react9 = require("react");
1409
+ var import_react10 = __toESM(require("react"));
1270
1410
  function useHumanInTheLoop(tool) {
1271
- const [status, setStatus] = (0, import_react8.useState)(
1411
+ const { copilotkit } = useCopilotKit();
1412
+ const [status, setStatus] = (0, import_react9.useState)(
1272
1413
  "inProgress"
1273
1414
  );
1274
- const statusRef = (0, import_react8.useRef)(status);
1275
- const resolvePromiseRef = (0, import_react8.useRef)(null);
1276
- const { setCurrentRenderToolCalls } = useCopilotKit();
1415
+ const statusRef = (0, import_react9.useRef)(status);
1416
+ const resolvePromiseRef = (0, import_react9.useRef)(null);
1277
1417
  statusRef.current = status;
1278
- const respond = (0, import_react8.useCallback)(async (result) => {
1418
+ const respond = (0, import_react9.useCallback)(async (result) => {
1279
1419
  if (resolvePromiseRef.current) {
1280
1420
  resolvePromiseRef.current(result);
1281
1421
  setStatus("complete");
1282
1422
  resolvePromiseRef.current = null;
1283
1423
  }
1284
1424
  }, []);
1285
- const handler = (0, import_react8.useCallback)(async () => {
1425
+ const handler = (0, import_react9.useCallback)(async () => {
1286
1426
  return new Promise((resolve) => {
1287
1427
  setStatus("executing");
1288
1428
  resolvePromiseRef.current = resolve;
1289
1429
  });
1290
1430
  }, []);
1291
- const RenderComponent = (0, import_react8.useCallback)(
1431
+ const RenderComponent = (0, import_react9.useCallback)(
1292
1432
  (props) => {
1293
1433
  const ToolComponent = tool.render;
1294
1434
  const currentStatus = statusRef.current;
@@ -1299,7 +1439,7 @@ function useHumanInTheLoop(tool) {
1299
1439
  description: tool.description || "",
1300
1440
  respond: void 0
1301
1441
  };
1302
- return import_react9.default.createElement(ToolComponent, enhancedProps);
1442
+ return import_react10.default.createElement(ToolComponent, enhancedProps);
1303
1443
  } else if (currentStatus === "executing" && props.status === "executing") {
1304
1444
  const enhancedProps = {
1305
1445
  ...props,
@@ -1307,7 +1447,7 @@ function useHumanInTheLoop(tool) {
1307
1447
  description: tool.description || "",
1308
1448
  respond
1309
1449
  };
1310
- return import_react9.default.createElement(ToolComponent, enhancedProps);
1450
+ return import_react10.default.createElement(ToolComponent, enhancedProps);
1311
1451
  } else if (currentStatus === "complete" && props.status === "complete") {
1312
1452
  const enhancedProps = {
1313
1453
  ...props,
@@ -1315,9 +1455,9 @@ function useHumanInTheLoop(tool) {
1315
1455
  description: tool.description || "",
1316
1456
  respond: void 0
1317
1457
  };
1318
- return import_react9.default.createElement(ToolComponent, enhancedProps);
1458
+ return import_react10.default.createElement(ToolComponent, enhancedProps);
1319
1459
  }
1320
- return import_react9.default.createElement(ToolComponent, props);
1460
+ return import_react10.default.createElement(ToolComponent, props);
1321
1461
  },
1322
1462
  [tool.render, tool.name, tool.description, respond]
1323
1463
  );
@@ -1327,19 +1467,20 @@ function useHumanInTheLoop(tool) {
1327
1467
  render: RenderComponent
1328
1468
  };
1329
1469
  useFrontendTool(frontendTool);
1330
- (0, import_react8.useEffect)(() => {
1470
+ (0, import_react9.useEffect)(() => {
1331
1471
  return () => {
1332
- setCurrentRenderToolCalls(
1333
- (prev) => prev.filter(
1334
- (rc) => rc.name !== tool.name || rc.agentId !== tool.agentId
1335
- )
1472
+ const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
1473
+ const currentRenderToolCalls = copilotkit.renderToolCalls;
1474
+ const filtered = currentRenderToolCalls.filter(
1475
+ (rc) => keyOf(rc) !== keyOf({ name: tool.name, agentId: tool.agentId })
1336
1476
  );
1477
+ copilotkit.setRenderToolCalls(filtered);
1337
1478
  };
1338
- }, [setCurrentRenderToolCalls, tool.name, tool.agentId]);
1479
+ }, [copilotkit, tool.name, tool.agentId]);
1339
1480
  }
1340
1481
 
1341
1482
  // src/hooks/use-agent.tsx
1342
- var import_react10 = require("react");
1483
+ var import_react11 = require("react");
1343
1484
  var import_shared4 = require("@copilotkitnext/shared");
1344
1485
  var ALL_UPDATES = [
1345
1486
  "OnMessagesChanged" /* OnMessagesChanged */,
@@ -1349,12 +1490,12 @@ var ALL_UPDATES = [
1349
1490
  function useAgent({ agentId, updates } = {}) {
1350
1491
  agentId ??= import_shared4.DEFAULT_AGENT_ID;
1351
1492
  const { copilotkit } = useCopilotKit();
1352
- const [, forceUpdate] = (0, import_react10.useReducer)((x) => x + 1, 0);
1353
- const updateFlags = (0, import_react10.useMemo)(
1493
+ const [, forceUpdate] = (0, import_react11.useReducer)((x) => x + 1, 0);
1494
+ const updateFlags = (0, import_react11.useMemo)(
1354
1495
  () => updates ?? ALL_UPDATES,
1355
1496
  [JSON.stringify(updates)]
1356
1497
  );
1357
- const agent = (0, import_react10.useMemo)(() => {
1498
+ const agent = (0, import_react11.useMemo)(() => {
1358
1499
  return copilotkit.getAgent(agentId);
1359
1500
  }, [
1360
1501
  agentId,
@@ -1362,7 +1503,7 @@ function useAgent({ agentId, updates } = {}) {
1362
1503
  copilotkit.runtimeConnectionStatus,
1363
1504
  copilotkit
1364
1505
  ]);
1365
- (0, import_react10.useEffect)(() => {
1506
+ (0, import_react11.useEffect)(() => {
1366
1507
  if (!agent) {
1367
1508
  return;
1368
1509
  }
@@ -1400,11 +1541,11 @@ function useAgent({ agentId, updates } = {}) {
1400
1541
  }
1401
1542
 
1402
1543
  // src/hooks/use-agent-context.tsx
1403
- var import_react11 = require("react");
1544
+ var import_react12 = require("react");
1404
1545
  function useAgentContext(context) {
1405
1546
  const { description, value } = context;
1406
1547
  const { copilotkit } = useCopilotKit();
1407
- (0, import_react11.useEffect)(() => {
1548
+ (0, import_react12.useEffect)(() => {
1408
1549
  if (!copilotkit) return;
1409
1550
  const id = copilotkit.addContext(context);
1410
1551
  return () => {
@@ -1414,26 +1555,26 @@ function useAgentContext(context) {
1414
1555
  }
1415
1556
 
1416
1557
  // src/hooks/use-suggestions.tsx
1417
- var import_react12 = require("react");
1558
+ var import_react13 = require("react");
1418
1559
  var import_shared5 = require("@copilotkitnext/shared");
1419
1560
  function useSuggestions({ agentId } = {}) {
1420
1561
  const { copilotkit } = useCopilotKit();
1421
1562
  const config = useCopilotChatConfiguration();
1422
- const resolvedAgentId = (0, import_react12.useMemo)(() => agentId ?? config?.agentId ?? import_shared5.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
1423
- const [suggestions, setSuggestions] = (0, import_react12.useState)(() => {
1563
+ const resolvedAgentId = (0, import_react13.useMemo)(() => agentId ?? config?.agentId ?? import_shared5.DEFAULT_AGENT_ID, [agentId, config?.agentId]);
1564
+ const [suggestions, setSuggestions] = (0, import_react13.useState)(() => {
1424
1565
  const result = copilotkit.getSuggestions(resolvedAgentId);
1425
1566
  return result.suggestions;
1426
1567
  });
1427
- const [isLoading, setIsLoading] = (0, import_react12.useState)(() => {
1568
+ const [isLoading, setIsLoading] = (0, import_react13.useState)(() => {
1428
1569
  const result = copilotkit.getSuggestions(resolvedAgentId);
1429
1570
  return result.isLoading;
1430
1571
  });
1431
- (0, import_react12.useEffect)(() => {
1572
+ (0, import_react13.useEffect)(() => {
1432
1573
  const result = copilotkit.getSuggestions(resolvedAgentId);
1433
1574
  setSuggestions(result.suggestions);
1434
1575
  setIsLoading(result.isLoading);
1435
1576
  }, [copilotkit, resolvedAgentId]);
1436
- (0, import_react12.useEffect)(() => {
1577
+ (0, import_react13.useEffect)(() => {
1437
1578
  const unsubscribe = copilotkit.subscribe({
1438
1579
  onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: suggestions2 }) => {
1439
1580
  if (changedAgentId !== resolvedAgentId) {
@@ -1463,10 +1604,10 @@ function useSuggestions({ agentId } = {}) {
1463
1604
  unsubscribe();
1464
1605
  };
1465
1606
  }, [copilotkit, resolvedAgentId]);
1466
- const reloadSuggestions = (0, import_react12.useCallback)(() => {
1607
+ const reloadSuggestions = (0, import_react13.useCallback)(() => {
1467
1608
  copilotkit.reloadSuggestions(resolvedAgentId);
1468
1609
  }, [copilotkit, resolvedAgentId]);
1469
- const clearSuggestions = (0, import_react12.useCallback)(() => {
1610
+ const clearSuggestions = (0, import_react13.useCallback)(() => {
1470
1611
  copilotkit.clearSuggestions(resolvedAgentId);
1471
1612
  }, [copilotkit, resolvedAgentId]);
1472
1613
  return {
@@ -1478,20 +1619,20 @@ function useSuggestions({ agentId } = {}) {
1478
1619
  }
1479
1620
 
1480
1621
  // src/hooks/use-configure-suggestions.tsx
1481
- var import_react13 = require("react");
1622
+ var import_react14 = require("react");
1482
1623
  var import_shared6 = require("@copilotkitnext/shared");
1483
1624
  var EMPTY_DEPS = [];
1484
1625
  function useConfigureSuggestions(config, options) {
1485
1626
  const { copilotkit } = useCopilotKit();
1486
1627
  const chatConfig = useCopilotChatConfiguration();
1487
1628
  const extraDeps = options?.deps ?? EMPTY_DEPS;
1488
- const resolvedConsumerAgentId = (0, import_react13.useMemo)(() => chatConfig?.agentId ?? import_shared6.DEFAULT_AGENT_ID, [chatConfig?.agentId]);
1489
- const rawConsumerAgentId = (0, import_react13.useMemo)(() => config ? config.consumerAgentId : void 0, [config]);
1490
- const normalizationCacheRef = (0, import_react13.useRef)({
1629
+ const resolvedConsumerAgentId = (0, import_react14.useMemo)(() => chatConfig?.agentId ?? import_shared6.DEFAULT_AGENT_ID, [chatConfig?.agentId]);
1630
+ const rawConsumerAgentId = (0, import_react14.useMemo)(() => config ? config.consumerAgentId : void 0, [config]);
1631
+ const normalizationCacheRef = (0, import_react14.useRef)({
1491
1632
  serialized: null,
1492
1633
  config: null
1493
1634
  });
1494
- const { normalizedConfig, serializedConfig } = (0, import_react13.useMemo)(() => {
1635
+ const { normalizedConfig, serializedConfig } = (0, import_react14.useMemo)(() => {
1495
1636
  if (!config) {
1496
1637
  normalizationCacheRef.current = { serialized: null, config: null };
1497
1638
  return { normalizedConfig: null, serializedConfig: null };
@@ -1521,10 +1662,10 @@ function useConfigureSuggestions(config, options) {
1521
1662
  normalizationCacheRef.current = { serialized, config: built };
1522
1663
  return { normalizedConfig: built, serializedConfig: serialized };
1523
1664
  }, [config, resolvedConsumerAgentId, ...extraDeps]);
1524
- const latestConfigRef = (0, import_react13.useRef)(null);
1665
+ const latestConfigRef = (0, import_react14.useRef)(null);
1525
1666
  latestConfigRef.current = normalizedConfig;
1526
- const previousSerializedConfigRef = (0, import_react13.useRef)(null);
1527
- const targetAgentId = (0, import_react13.useMemo)(() => {
1667
+ const previousSerializedConfigRef = (0, import_react14.useRef)(null);
1668
+ const targetAgentId = (0, import_react14.useMemo)(() => {
1528
1669
  if (!normalizedConfig) {
1529
1670
  return resolvedConsumerAgentId;
1530
1671
  }
@@ -1535,7 +1676,7 @@ function useConfigureSuggestions(config, options) {
1535
1676
  return consumer;
1536
1677
  }, [normalizedConfig, resolvedConsumerAgentId]);
1537
1678
  const isGlobalConfig = rawConsumerAgentId === void 0 || rawConsumerAgentId === "*";
1538
- const requestReload = (0, import_react13.useCallback)(() => {
1679
+ const requestReload = (0, import_react14.useCallback)(() => {
1539
1680
  if (!normalizedConfig) {
1540
1681
  return;
1541
1682
  }
@@ -1557,7 +1698,7 @@ function useConfigureSuggestions(config, options) {
1557
1698
  }
1558
1699
  copilotkit.reloadSuggestions(targetAgentId);
1559
1700
  }, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);
1560
- (0, import_react13.useEffect)(() => {
1701
+ (0, import_react14.useEffect)(() => {
1561
1702
  if (!serializedConfig || !latestConfigRef.current) {
1562
1703
  return;
1563
1704
  }
@@ -1567,7 +1708,7 @@ function useConfigureSuggestions(config, options) {
1567
1708
  copilotkit.removeSuggestionsConfig(id);
1568
1709
  };
1569
1710
  }, [copilotkit, serializedConfig, requestReload]);
1570
- (0, import_react13.useEffect)(() => {
1711
+ (0, import_react14.useEffect)(() => {
1571
1712
  if (!normalizedConfig) {
1572
1713
  previousSerializedConfigRef.current = null;
1573
1714
  return;
@@ -1580,7 +1721,7 @@ function useConfigureSuggestions(config, options) {
1580
1721
  }
1581
1722
  requestReload();
1582
1723
  }, [normalizedConfig, requestReload, serializedConfig]);
1583
- (0, import_react13.useEffect)(() => {
1724
+ (0, import_react14.useEffect)(() => {
1584
1725
  if (!normalizedConfig || extraDeps.length === 0) {
1585
1726
  return;
1586
1727
  }
@@ -1598,8 +1739,8 @@ function normalizeStaticSuggestions(suggestions) {
1598
1739
  }
1599
1740
 
1600
1741
  // src/components/chat/CopilotChatToolCallsView.tsx
1601
- var import_react14 = __toESM(require("react"));
1602
- var import_jsx_runtime9 = require("react/jsx-runtime");
1742
+ var import_react15 = __toESM(require("react"));
1743
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1603
1744
  function CopilotChatToolCallsView({
1604
1745
  message,
1605
1746
  messages = []
@@ -1608,11 +1749,11 @@ function CopilotChatToolCallsView({
1608
1749
  if (!message.toolCalls || message.toolCalls.length === 0) {
1609
1750
  return null;
1610
1751
  }
1611
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: message.toolCalls.map((toolCall) => {
1752
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: message.toolCalls.map((toolCall) => {
1612
1753
  const toolMessage = messages.find(
1613
1754
  (m) => m.role === "tool" && m.toolCallId === toolCall.id
1614
1755
  );
1615
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react14.default.Fragment, { children: renderToolCall({
1756
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react15.default.Fragment, { children: renderToolCall({
1616
1757
  toolCall,
1617
1758
  toolMessage
1618
1759
  }) }, toolCall.id);
@@ -1621,7 +1762,7 @@ function CopilotChatToolCallsView({
1621
1762
  var CopilotChatToolCallsView_default = CopilotChatToolCallsView;
1622
1763
 
1623
1764
  // src/components/chat/CopilotChatAssistantMessage.tsx
1624
- var import_jsx_runtime10 = require("react/jsx-runtime");
1765
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1625
1766
  function CopilotChatAssistantMessage({
1626
1767
  message,
1627
1768
  messages,
@@ -1698,7 +1839,7 @@ function CopilotChatAssistantMessage({
1698
1839
  toolbar,
1699
1840
  CopilotChatAssistantMessage.Toolbar,
1700
1841
  {
1701
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center gap-1", children: [
1842
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center gap-1", children: [
1702
1843
  boundCopyButton,
1703
1844
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
1704
1845
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
@@ -1719,7 +1860,7 @@ function CopilotChatAssistantMessage({
1719
1860
  const hasContent = !!(message.content && message.content.trim().length > 0);
1720
1861
  const shouldShowToolbar = toolbarVisible && hasContent;
1721
1862
  if (children) {
1722
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_jsx_runtime10.Fragment, { children: children({
1863
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: children({
1723
1864
  markdownRenderer: boundMarkdownRenderer,
1724
1865
  toolbar: boundToolbar,
1725
1866
  toolCallsView: boundToolCallsView,
@@ -1739,7 +1880,7 @@ function CopilotChatAssistantMessage({
1739
1880
  toolbarVisible: shouldShowToolbar
1740
1881
  }) });
1741
1882
  }
1742
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1883
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1743
1884
  "div",
1744
1885
  {
1745
1886
  className: (0, import_tailwind_merge4.twMerge)(
@@ -1761,7 +1902,7 @@ function CopilotChatAssistantMessage({
1761
1902
  children,
1762
1903
  ...props
1763
1904
  }) => {
1764
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1905
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1765
1906
  "code",
1766
1907
  {
1767
1908
  className: "px-[4.8px] py-[2.5px] bg-[rgb(236,236,236)] dark:bg-gray-800 rounded text-sm font-mono font-medium! text-foreground!",
@@ -1773,7 +1914,7 @@ function CopilotChatAssistantMessage({
1773
1914
  const CodeBlock = ({ children, className, onClick, ...props }) => {
1774
1915
  const config = useCopilotChatConfiguration();
1775
1916
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1776
- const [copied, setCopied] = (0, import_react15.useState)(false);
1917
+ const [copied, setCopied] = (0, import_react16.useState)(false);
1777
1918
  const getCodeContent = (node) => {
1778
1919
  if (typeof node === "string") return node;
1779
1920
  if (Array.isArray(node)) return node.map(getCodeContent).join("");
@@ -1794,10 +1935,10 @@ function CopilotChatAssistantMessage({
1794
1935
  console.error("Failed to copy code:", err);
1795
1936
  }
1796
1937
  };
1797
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "relative", children: [
1798
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex items-center justify-between px-4 pr-3 py-3 text-xs", children: [
1799
- language && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "font-regular text-muted-foreground dark:text-white", children: language }),
1800
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1938
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
1939
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between px-4 pr-3 py-3 text-xs", children: [
1940
+ language && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "font-regular text-muted-foreground dark:text-white", children: language }),
1941
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
1801
1942
  "button",
1802
1943
  {
1803
1944
  className: cn(
@@ -1806,13 +1947,13 @@ function CopilotChatAssistantMessage({
1806
1947
  onClick: copyToClipboard,
1807
1948
  title: copied ? labels.assistantMessageToolbarCopyCodeCopiedLabel : `${labels.assistantMessageToolbarCopyCodeLabel} code`,
1808
1949
  children: [
1809
- copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Check, { className: "h-[10px]! w-[10px]!" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Copy, { className: "h-[10px]! w-[10px]!" }),
1810
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-[11px]", children: copied ? labels.assistantMessageToolbarCopyCodeCopiedLabel : labels.assistantMessageToolbarCopyCodeLabel })
1950
+ copied ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Check, { className: "h-[10px]! w-[10px]!" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Copy, { className: "h-[10px]! w-[10px]!" }),
1951
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "text-[11px]", children: copied ? labels.assistantMessageToolbarCopyCodeCopiedLabel : labels.assistantMessageToolbarCopyCodeLabel })
1811
1952
  ]
1812
1953
  }
1813
1954
  )
1814
1955
  ] }),
1815
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1956
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1816
1957
  "pre",
1817
1958
  {
1818
1959
  className: cn(
@@ -1825,7 +1966,7 @@ function CopilotChatAssistantMessage({
1825
1966
  )
1826
1967
  ] });
1827
1968
  };
1828
- CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1969
+ CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1829
1970
  import_react_markdown.MarkdownHooks,
1830
1971
  {
1831
1972
  remarkPlugins: [import_remark_gfm.default, import_remark_math.default],
@@ -1848,9 +1989,9 @@ function CopilotChatAssistantMessage({
1848
1989
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1849
1990
  code: ({ className: className2, children, ...props }) => {
1850
1991
  if (typeof children === "string") {
1851
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InlineCode, { ...props, children });
1992
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(InlineCode, { ...props, children });
1852
1993
  }
1853
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { className: className2, ...props, children });
1994
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { className: className2, ...props, children });
1854
1995
  }
1855
1996
  },
1856
1997
  children: (0, import_core3.completePartialMarkdown)(content || "")
@@ -1859,7 +2000,7 @@ function CopilotChatAssistantMessage({
1859
2000
  CopilotChatAssistantMessage2.Toolbar = ({
1860
2001
  className,
1861
2002
  ...props
1862
- }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2003
+ }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1863
2004
  "div",
1864
2005
  {
1865
2006
  className: (0, import_tailwind_merge4.twMerge)(
@@ -1870,8 +2011,8 @@ function CopilotChatAssistantMessage({
1870
2011
  }
1871
2012
  );
1872
2013
  CopilotChatAssistantMessage2.ToolbarButton = ({ title, children, ...props }) => {
1873
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Tooltip, { children: [
1874
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2014
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Tooltip, { children: [
2015
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1875
2016
  Button,
1876
2017
  {
1877
2018
  type: "button",
@@ -1881,13 +2022,13 @@ function CopilotChatAssistantMessage({
1881
2022
  children
1882
2023
  }
1883
2024
  ) }),
1884
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: title }) })
2025
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: title }) })
1885
2026
  ] });
1886
2027
  };
1887
2028
  CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
1888
2029
  const config = useCopilotChatConfiguration();
1889
2030
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1890
- const [copied, setCopied] = (0, import_react15.useState)(false);
2031
+ const [copied, setCopied] = (0, import_react16.useState)(false);
1891
2032
  const handleClick = (event) => {
1892
2033
  setCopied(true);
1893
2034
  setTimeout(() => setCopied(false), 2e3);
@@ -1895,62 +2036,62 @@ function CopilotChatAssistantMessage({
1895
2036
  onClick(event);
1896
2037
  }
1897
2038
  };
1898
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2039
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1899
2040
  CopilotChatAssistantMessage2.ToolbarButton,
1900
2041
  {
1901
2042
  title: title || labels.assistantMessageToolbarCopyMessageLabel,
1902
2043
  onClick: handleClick,
1903
2044
  className,
1904
2045
  ...props,
1905
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Copy, { className: "size-[18px]" })
2046
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Copy, { className: "size-[18px]" })
1906
2047
  }
1907
2048
  );
1908
2049
  };
1909
2050
  CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
1910
2051
  const config = useCopilotChatConfiguration();
1911
2052
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1912
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2053
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1913
2054
  CopilotChatAssistantMessage2.ToolbarButton,
1914
2055
  {
1915
2056
  title: title || labels.assistantMessageToolbarThumbsUpLabel,
1916
2057
  ...props,
1917
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ThumbsUp, { className: "size-[18px]" })
2058
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.ThumbsUp, { className: "size-[18px]" })
1918
2059
  }
1919
2060
  );
1920
2061
  };
1921
2062
  CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
1922
2063
  const config = useCopilotChatConfiguration();
1923
2064
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1924
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2065
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1925
2066
  CopilotChatAssistantMessage2.ToolbarButton,
1926
2067
  {
1927
2068
  title: title || labels.assistantMessageToolbarThumbsDownLabel,
1928
2069
  ...props,
1929
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.ThumbsDown, { className: "size-[18px]" })
2070
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.ThumbsDown, { className: "size-[18px]" })
1930
2071
  }
1931
2072
  );
1932
2073
  };
1933
2074
  CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
1934
2075
  const config = useCopilotChatConfiguration();
1935
2076
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1936
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2077
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1937
2078
  CopilotChatAssistantMessage2.ToolbarButton,
1938
2079
  {
1939
2080
  title: title || labels.assistantMessageToolbarReadAloudLabel,
1940
2081
  ...props,
1941
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.Volume2, { className: "size-[20px]" })
2082
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.Volume2, { className: "size-[20px]" })
1942
2083
  }
1943
2084
  );
1944
2085
  };
1945
2086
  CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
1946
2087
  const config = useCopilotChatConfiguration();
1947
2088
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1948
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2089
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1949
2090
  CopilotChatAssistantMessage2.ToolbarButton,
1950
2091
  {
1951
2092
  title: title || labels.assistantMessageToolbarRegenerateLabel,
1952
2093
  ...props,
1953
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.RefreshCw, { className: "size-[18px]" })
2094
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.RefreshCw, { className: "size-[18px]" })
1954
2095
  }
1955
2096
  );
1956
2097
  };
@@ -1965,10 +2106,10 @@ CopilotChatAssistantMessage.RegenerateButton.displayName = "CopilotChatAssistant
1965
2106
  var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
1966
2107
 
1967
2108
  // src/components/chat/CopilotChatUserMessage.tsx
1968
- var import_react16 = require("react");
2109
+ var import_react17 = require("react");
1969
2110
  var import_lucide_react4 = require("lucide-react");
1970
2111
  var import_tailwind_merge5 = require("tailwind-merge");
1971
- var import_jsx_runtime11 = require("react/jsx-runtime");
2112
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1972
2113
  function CopilotChatUserMessage({
1973
2114
  message,
1974
2115
  onEditMessage,
@@ -2026,7 +2167,7 @@ function CopilotChatUserMessage({
2026
2167
  );
2027
2168
  const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
2028
2169
  const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {
2029
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex items-center gap-1 justify-end", children: [
2170
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex items-center gap-1 justify-end", children: [
2030
2171
  additionalToolbarItems,
2031
2172
  BoundCopyButton,
2032
2173
  onEditMessage && BoundEditButton,
@@ -2034,7 +2175,7 @@ function CopilotChatUserMessage({
2034
2175
  ] })
2035
2176
  });
2036
2177
  if (children) {
2037
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: children({
2178
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: children({
2038
2179
  messageRenderer: BoundMessageRenderer,
2039
2180
  toolbar: BoundToolbar,
2040
2181
  copyButton: BoundCopyButton,
@@ -2046,7 +2187,7 @@ function CopilotChatUserMessage({
2046
2187
  additionalToolbarItems
2047
2188
  }) });
2048
2189
  }
2049
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2190
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2050
2191
  "div",
2051
2192
  {
2052
2193
  className: (0, import_tailwind_merge5.twMerge)("flex flex-col items-end group pt-10", className),
@@ -2060,7 +2201,7 @@ function CopilotChatUserMessage({
2060
2201
  );
2061
2202
  }
2062
2203
  ((CopilotChatUserMessage2) => {
2063
- CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2204
+ CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2064
2205
  "div",
2065
2206
  {
2066
2207
  className: (0, import_tailwind_merge5.twMerge)("flex flex-col items-end group", className),
@@ -2068,7 +2209,7 @@ function CopilotChatUserMessage({
2068
2209
  children
2069
2210
  }
2070
2211
  );
2071
- CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2212
+ CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2072
2213
  "div",
2073
2214
  {
2074
2215
  className: (0, import_tailwind_merge5.twMerge)(
@@ -2081,7 +2222,7 @@ function CopilotChatUserMessage({
2081
2222
  CopilotChatUserMessage2.Toolbar = ({
2082
2223
  className,
2083
2224
  ...props
2084
- }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2225
+ }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2085
2226
  "div",
2086
2227
  {
2087
2228
  className: (0, import_tailwind_merge5.twMerge)(
@@ -2092,8 +2233,8 @@ function CopilotChatUserMessage({
2092
2233
  }
2093
2234
  );
2094
2235
  CopilotChatUserMessage2.ToolbarButton = ({ title, children, className, ...props }) => {
2095
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Tooltip, { children: [
2096
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2236
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Tooltip, { children: [
2237
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2097
2238
  Button,
2098
2239
  {
2099
2240
  type: "button",
@@ -2104,13 +2245,13 @@ function CopilotChatUserMessage({
2104
2245
  children
2105
2246
  }
2106
2247
  ) }),
2107
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: title }) })
2248
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipContent, { side: "bottom", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: title }) })
2108
2249
  ] });
2109
2250
  };
2110
2251
  CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
2111
2252
  const config = useCopilotChatConfiguration();
2112
2253
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2113
- const [copied, setCopied] = (0, import_react16.useState)(false);
2254
+ const [copied, setCopied] = (0, import_react17.useState)(false);
2114
2255
  const handleClick = (event) => {
2115
2256
  setCopied(true);
2116
2257
  setTimeout(() => setCopied(false), 2e3);
@@ -2118,27 +2259,27 @@ function CopilotChatUserMessage({
2118
2259
  onClick(event);
2119
2260
  }
2120
2261
  };
2121
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2262
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2122
2263
  CopilotChatUserMessage2.ToolbarButton,
2123
2264
  {
2124
2265
  title: title || labels.userMessageToolbarCopyMessageLabel,
2125
2266
  onClick: handleClick,
2126
2267
  className,
2127
2268
  ...props,
2128
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Copy, { className: "size-[18px]" })
2269
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Check, { className: "size-[18px]" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Copy, { className: "size-[18px]" })
2129
2270
  }
2130
2271
  );
2131
2272
  };
2132
2273
  CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
2133
2274
  const config = useCopilotChatConfiguration();
2134
2275
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2135
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2276
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2136
2277
  CopilotChatUserMessage2.ToolbarButton,
2137
2278
  {
2138
2279
  title: title || labels.userMessageToolbarEditMessageLabel,
2139
2280
  className,
2140
2281
  ...props,
2141
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Edit, { className: "size-[18px]" })
2282
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.Edit, { className: "size-[18px]" })
2142
2283
  }
2143
2284
  );
2144
2285
  };
@@ -2155,8 +2296,8 @@ function CopilotChatUserMessage({
2155
2296
  }
2156
2297
  const canGoPrev = currentBranch > 0;
2157
2298
  const canGoNext = currentBranch < numberOfBranches - 1;
2158
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: (0, import_tailwind_merge5.twMerge)("flex items-center gap-1", className), ...props, children: [
2159
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2299
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: (0, import_tailwind_merge5.twMerge)("flex items-center gap-1", className), ...props, children: [
2300
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2160
2301
  Button,
2161
2302
  {
2162
2303
  type: "button",
@@ -2168,15 +2309,15 @@ function CopilotChatUserMessage({
2168
2309
  }),
2169
2310
  disabled: !canGoPrev,
2170
2311
  className: "h-6 w-6 p-0",
2171
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.ChevronLeft, { className: "size-[20px]" })
2312
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.ChevronLeft, { className: "size-[20px]" })
2172
2313
  }
2173
2314
  ),
2174
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2315
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2175
2316
  currentBranch + 1,
2176
2317
  "/",
2177
2318
  numberOfBranches
2178
2319
  ] }),
2179
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2320
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2180
2321
  Button,
2181
2322
  {
2182
2323
  type: "button",
@@ -2188,7 +2329,7 @@ function CopilotChatUserMessage({
2188
2329
  }),
2189
2330
  disabled: !canGoNext,
2190
2331
  className: "h-6 w-6 p-0",
2191
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.ChevronRight, { className: "size-[20px]" })
2332
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.ChevronRight, { className: "size-[20px]" })
2192
2333
  }
2193
2334
  )
2194
2335
  ] });
@@ -2204,14 +2345,14 @@ CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.Br
2204
2345
  var CopilotChatUserMessage_default = CopilotChatUserMessage;
2205
2346
 
2206
2347
  // src/components/chat/CopilotChatSuggestionPill.tsx
2207
- var import_react17 = __toESM(require("react"));
2348
+ var import_react18 = __toESM(require("react"));
2208
2349
  var import_lucide_react5 = require("lucide-react");
2209
- var import_jsx_runtime12 = require("react/jsx-runtime");
2350
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2210
2351
  var baseClasses = "group inline-flex h-8 items-center gap-1.5 rounded-full border border-border/60 bg-background px-3 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";
2211
2352
  var labelClasses = "whitespace-nowrap font-medium leading-none";
2212
- var CopilotChatSuggestionPill = import_react17.default.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2353
+ var CopilotChatSuggestionPill = import_react18.default.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2213
2354
  const showIcon = !isLoading && icon;
2214
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2355
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2215
2356
  "button",
2216
2357
  {
2217
2358
  ref,
@@ -2222,8 +2363,8 @@ var CopilotChatSuggestionPill = import_react17.default.forwardRef(function Copil
2222
2363
  disabled: isLoading || props.disabled,
2223
2364
  ...props,
2224
2365
  children: [
2225
- isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: icon }),
2226
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: labelClasses, children })
2366
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: icon }),
2367
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: labelClasses, children })
2227
2368
  ]
2228
2369
  }
2229
2370
  );
@@ -2232,10 +2373,10 @@ CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
2232
2373
  var CopilotChatSuggestionPill_default = CopilotChatSuggestionPill;
2233
2374
 
2234
2375
  // src/components/chat/CopilotChatSuggestionView.tsx
2235
- var import_react18 = __toESM(require("react"));
2236
- var import_jsx_runtime13 = require("react/jsx-runtime");
2237
- var DefaultContainer = import_react18.default.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2238
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2376
+ var import_react19 = __toESM(require("react"));
2377
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2378
+ var DefaultContainer = import_react19.default.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2379
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2239
2380
  "div",
2240
2381
  {
2241
2382
  ref,
@@ -2247,7 +2388,7 @@ var DefaultContainer = import_react18.default.forwardRef(function DefaultContain
2247
2388
  }
2248
2389
  );
2249
2390
  });
2250
- var CopilotChatSuggestionView = import_react18.default.forwardRef(function CopilotChatSuggestionView2({
2391
+ var CopilotChatSuggestionView = import_react19.default.forwardRef(function CopilotChatSuggestionView2({
2251
2392
  suggestions,
2252
2393
  onSelectSuggestion,
2253
2394
  loadingIndexes,
@@ -2257,7 +2398,7 @@ var CopilotChatSuggestionView = import_react18.default.forwardRef(function Copil
2257
2398
  children,
2258
2399
  ...restProps
2259
2400
  }, ref) {
2260
- const loadingSet = import_react18.default.useMemo(() => {
2401
+ const loadingSet = import_react19.default.useMemo(() => {
2261
2402
  if (!loadingIndexes || loadingIndexes.length === 0) {
2262
2403
  return /* @__PURE__ */ new Set();
2263
2404
  }
@@ -2276,11 +2417,11 @@ var CopilotChatSuggestionView = import_react18.default.forwardRef(function Copil
2276
2417
  type: "button",
2277
2418
  onClick: () => onSelectSuggestion?.(suggestion, index)
2278
2419
  });
2279
- return import_react18.default.cloneElement(pill, {
2420
+ return import_react19.default.cloneElement(pill, {
2280
2421
  key: `${suggestion.title}-${index}`
2281
2422
  });
2282
2423
  });
2283
- const boundContainer = import_react18.default.cloneElement(
2424
+ const boundContainer = import_react19.default.cloneElement(
2284
2425
  ContainerElement,
2285
2426
  void 0,
2286
2427
  suggestionElements
@@ -2291,7 +2432,7 @@ var CopilotChatSuggestionView = import_react18.default.forwardRef(function Copil
2291
2432
  isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
2292
2433
  type: "button"
2293
2434
  });
2294
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: children({
2435
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: children({
2295
2436
  container: boundContainer,
2296
2437
  suggestion: sampleSuggestion,
2297
2438
  suggestions,
@@ -2302,7 +2443,7 @@ var CopilotChatSuggestionView = import_react18.default.forwardRef(function Copil
2302
2443
  }) });
2303
2444
  }
2304
2445
  if (children) {
2305
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
2446
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2306
2447
  boundContainer,
2307
2448
  children
2308
2449
  ] });
@@ -2314,7 +2455,7 @@ var CopilotChatSuggestionView_default = CopilotChatSuggestionView;
2314
2455
 
2315
2456
  // src/components/chat/CopilotChatMessageView.tsx
2316
2457
  var import_tailwind_merge6 = require("tailwind-merge");
2317
- var import_jsx_runtime14 = require("react/jsx-runtime");
2458
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2318
2459
  function CopilotChatMessageView({
2319
2460
  messages = [],
2320
2461
  assistantMessage,
@@ -2325,41 +2466,57 @@ function CopilotChatMessageView({
2325
2466
  className,
2326
2467
  ...props
2327
2468
  }) {
2328
- const messageElements = messages.map((message) => {
2469
+ const renderCustomMessage = useRenderCustomMessages();
2470
+ const messageElements = messages.flatMap((message) => {
2471
+ const elements = [];
2472
+ if (renderCustomMessage) {
2473
+ elements.push(
2474
+ renderCustomMessage({
2475
+ message,
2476
+ position: "before"
2477
+ })
2478
+ );
2479
+ }
2329
2480
  if (message.role === "assistant") {
2330
- return renderSlot(assistantMessage, CopilotChatAssistantMessage_default, {
2331
- key: message.id,
2332
- message,
2333
- messages,
2334
- isRunning
2335
- });
2481
+ elements.push(
2482
+ renderSlot(assistantMessage, CopilotChatAssistantMessage_default, {
2483
+ key: message.id,
2484
+ message,
2485
+ messages,
2486
+ isRunning
2487
+ })
2488
+ );
2336
2489
  } else if (message.role === "user") {
2337
- return renderSlot(userMessage, CopilotChatUserMessage_default, {
2338
- key: message.id,
2339
- message
2340
- });
2490
+ elements.push(
2491
+ renderSlot(userMessage, CopilotChatUserMessage_default, {
2492
+ key: message.id,
2493
+ message
2494
+ })
2495
+ );
2341
2496
  }
2342
- return;
2497
+ if (renderCustomMessage) {
2498
+ elements.push(
2499
+ renderCustomMessage({
2500
+ message,
2501
+ position: "after"
2502
+ })
2503
+ );
2504
+ }
2505
+ return elements;
2343
2506
  }).filter(Boolean);
2344
2507
  if (children) {
2345
2508
  return children({ messageElements, messages, isRunning });
2346
2509
  }
2347
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_tailwind_merge6.twMerge)("flex flex-col", className), ...props, children: [
2510
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: (0, import_tailwind_merge6.twMerge)("flex flex-col", className), ...props, children: [
2348
2511
  messageElements,
2349
2512
  isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
2350
2513
  ] });
2351
2514
  }
2352
- CopilotChatMessageView.Cursor = function Cursor({
2353
- className,
2354
- ...props
2355
- }) {
2356
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2515
+ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
2516
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2357
2517
  "div",
2358
2518
  {
2359
- className: (0, import_tailwind_merge6.twMerge)(
2360
- "w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1",
2361
- className
2362
- ),
2519
+ className: (0, import_tailwind_merge6.twMerge)("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
2363
2520
  ...props
2364
2521
  }
2365
2522
  );
@@ -2367,11 +2524,11 @@ CopilotChatMessageView.Cursor = function Cursor({
2367
2524
  var CopilotChatMessageView_default = CopilotChatMessageView;
2368
2525
 
2369
2526
  // src/components/chat/CopilotChatView.tsx
2370
- var import_react19 = __toESM(require("react"));
2527
+ var import_react20 = __toESM(require("react"));
2371
2528
  var import_tailwind_merge7 = require("tailwind-merge");
2372
2529
  var import_use_stick_to_bottom = require("use-stick-to-bottom");
2373
2530
  var import_lucide_react6 = require("lucide-react");
2374
- var import_jsx_runtime15 = require("react/jsx-runtime");
2531
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2375
2532
  function CopilotChatView({
2376
2533
  messageView,
2377
2534
  input,
@@ -2392,11 +2549,11 @@ function CopilotChatView({
2392
2549
  className,
2393
2550
  ...props
2394
2551
  }) {
2395
- const inputContainerRef = (0, import_react19.useRef)(null);
2396
- const [inputContainerHeight, setInputContainerHeight] = (0, import_react19.useState)(0);
2397
- const [isResizing, setIsResizing] = (0, import_react19.useState)(false);
2398
- const resizeTimeoutRef = (0, import_react19.useRef)(null);
2399
- (0, import_react19.useEffect)(() => {
2552
+ const inputContainerRef = (0, import_react20.useRef)(null);
2553
+ const [inputContainerHeight, setInputContainerHeight] = (0, import_react20.useState)(0);
2554
+ const [isResizing, setIsResizing] = (0, import_react20.useState)(false);
2555
+ const resizeTimeoutRef = (0, import_react20.useRef)(null);
2556
+ (0, import_react20.useEffect)(() => {
2400
2557
  const element = inputContainerRef.current;
2401
2558
  if (!element) return;
2402
2559
  const resizeObserver = new ResizeObserver((entries) => {
@@ -2448,17 +2605,17 @@ function CopilotChatView({
2448
2605
  scrollToBottomButton,
2449
2606
  inputContainerHeight,
2450
2607
  isResizing,
2451
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "max-w-3xl mx-auto", children: [
2608
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "max-w-3xl mx-auto", children: [
2452
2609
  BoundMessageView,
2453
- hasSuggestions ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
2610
+ hasSuggestions ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "px-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
2454
2611
  ] }) })
2455
2612
  });
2456
2613
  const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});
2457
2614
  const BoundDisclaimer = renderSlot(disclaimer, CopilotChatView.Disclaimer, {});
2458
2615
  const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {
2459
2616
  ref: inputContainerRef,
2460
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2461
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 pointer-events-auto", children: BoundInput }),
2617
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2618
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "max-w-3xl mx-auto py-0 px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8 pointer-events-auto", children: BoundInput }),
2462
2619
  BoundDisclaimer
2463
2620
  ] })
2464
2621
  });
@@ -2471,10 +2628,10 @@ function CopilotChatView({
2471
2628
  feather: BoundFeather,
2472
2629
  inputContainer: BoundInputContainer,
2473
2630
  disclaimer: BoundDisclaimer,
2474
- suggestionView: BoundSuggestionView ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, {})
2631
+ suggestionView: BoundSuggestionView ?? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_jsx_runtime17.Fragment, {})
2475
2632
  });
2476
2633
  }
2477
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: (0, import_tailwind_merge7.twMerge)("relative h-full", className), ...props, children: [
2634
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_tailwind_merge7.twMerge)("relative h-full", className), ...props, children: [
2478
2635
  BoundScrollView,
2479
2636
  BoundFeather,
2480
2637
  BoundInputContainer
@@ -2483,9 +2640,9 @@ function CopilotChatView({
2483
2640
  ((CopilotChatView2) => {
2484
2641
  const ScrollContent = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {
2485
2642
  const { isAtBottom, scrollToBottom } = (0, import_use_stick_to_bottom.useStickToBottomContext)();
2486
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2487
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_use_stick_to_bottom.StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) }),
2488
- !isAtBottom && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2643
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
2644
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_use_stick_to_bottom.StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) }),
2645
+ !isAtBottom && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2489
2646
  "div",
2490
2647
  {
2491
2648
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -2508,13 +2665,13 @@ function CopilotChatView({
2508
2665
  className,
2509
2666
  ...props
2510
2667
  }) => {
2511
- const [hasMounted, setHasMounted] = (0, import_react19.useState)(false);
2668
+ const [hasMounted, setHasMounted] = (0, import_react20.useState)(false);
2512
2669
  const { scrollRef, contentRef, scrollToBottom } = (0, import_use_stick_to_bottom.useStickToBottom)();
2513
- const [showScrollButton, setShowScrollButton] = (0, import_react19.useState)(false);
2514
- (0, import_react19.useEffect)(() => {
2670
+ const [showScrollButton, setShowScrollButton] = (0, import_react20.useState)(false);
2671
+ (0, import_react20.useEffect)(() => {
2515
2672
  setHasMounted(true);
2516
2673
  }, []);
2517
- (0, import_react19.useEffect)(() => {
2674
+ (0, import_react20.useEffect)(() => {
2518
2675
  if (autoScroll) return;
2519
2676
  const scrollElement = scrollRef.current;
2520
2677
  if (!scrollElement) return;
@@ -2532,10 +2689,10 @@ function CopilotChatView({
2532
2689
  };
2533
2690
  }, [scrollRef, autoScroll]);
2534
2691
  if (!hasMounted) {
2535
- return /* @__PURE__ */ (0, import_jsx_runtime15.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_runtime15.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) });
2692
+ return /* @__PURE__ */ (0, import_jsx_runtime17.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_runtime17.jsx)("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) });
2536
2693
  }
2537
2694
  if (!autoScroll) {
2538
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2695
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2539
2696
  "div",
2540
2697
  {
2541
2698
  ref: scrollRef,
@@ -2545,8 +2702,8 @@ function CopilotChatView({
2545
2702
  ),
2546
2703
  ...props,
2547
2704
  children: [
2548
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }),
2549
- showScrollButton && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2705
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }),
2706
+ showScrollButton && !isResizing && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2550
2707
  "div",
2551
2708
  {
2552
2709
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -2562,14 +2719,14 @@ function CopilotChatView({
2562
2719
  }
2563
2720
  );
2564
2721
  }
2565
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2722
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2566
2723
  import_use_stick_to_bottom.StickToBottom,
2567
2724
  {
2568
2725
  className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
2569
2726
  resize: "smooth",
2570
2727
  initial: "smooth",
2571
2728
  ...props,
2572
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2729
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2573
2730
  ScrollContent,
2574
2731
  {
2575
2732
  scrollToBottomButton,
@@ -2584,7 +2741,7 @@ function CopilotChatView({
2584
2741
  CopilotChatView2.ScrollToBottomButton = ({
2585
2742
  className,
2586
2743
  ...props
2587
- }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2744
+ }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2588
2745
  Button,
2589
2746
  {
2590
2747
  variant: "outline",
@@ -2598,10 +2755,10 @@ function CopilotChatView({
2598
2755
  className
2599
2756
  ),
2600
2757
  ...props,
2601
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react6.ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
2758
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react6.ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
2602
2759
  }
2603
2760
  );
2604
- CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2761
+ CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2605
2762
  "div",
2606
2763
  {
2607
2764
  className: cn(
@@ -2614,12 +2771,12 @@ function CopilotChatView({
2614
2771
  ...props
2615
2772
  }
2616
2773
  );
2617
- CopilotChatView2.InputContainer = import_react19.default.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref, className: cn("absolute bottom-0 left-0 right-0 z-20 pointer-events-none", className), ...props, children }));
2774
+ CopilotChatView2.InputContainer = import_react20.default.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref, className: cn("absolute bottom-0 left-0 right-0 z-20 pointer-events-none", className), ...props, children }));
2618
2775
  CopilotChatView2.InputContainer.displayName = "CopilotChatView.InputContainer";
2619
2776
  CopilotChatView2.Disclaimer = ({ className, ...props }) => {
2620
2777
  const config = useCopilotChatConfiguration();
2621
2778
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2622
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
2779
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2623
2780
  "div",
2624
2781
  {
2625
2782
  className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
@@ -2633,14 +2790,14 @@ var CopilotChatView_default = CopilotChatView;
2633
2790
 
2634
2791
  // src/components/chat/CopilotChat.tsx
2635
2792
  var import_shared7 = require("@copilotkitnext/shared");
2636
- var import_react20 = require("react");
2793
+ var import_react21 = require("react");
2637
2794
  var import_ts_deepmerge = require("ts-deepmerge");
2638
2795
  var import_client = require("@ag-ui/client");
2639
- var import_jsx_runtime16 = require("react/jsx-runtime");
2796
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2640
2797
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }) {
2641
2798
  const existingConfig = useCopilotChatConfiguration();
2642
2799
  const resolvedAgentId = agentId ?? existingConfig?.agentId ?? import_shared7.DEFAULT_AGENT_ID;
2643
- const resolvedThreadId = (0, import_react20.useMemo)(
2800
+ const resolvedThreadId = (0, import_react21.useMemo)(
2644
2801
  () => threadId ?? existingConfig?.threadId ?? (0, import_shared7.randomUUID)(),
2645
2802
  [threadId, existingConfig?.threadId]
2646
2803
  );
@@ -2653,7 +2810,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2653
2810
  suggestionView: providedSuggestionView,
2654
2811
  ...restProps
2655
2812
  } = props;
2656
- (0, import_react20.useEffect)(() => {
2813
+ (0, import_react21.useEffect)(() => {
2657
2814
  const connect = async (agent2) => {
2658
2815
  try {
2659
2816
  await copilotkit.connectAgent({ agent: agent2 });
@@ -2671,7 +2828,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2671
2828
  return () => {
2672
2829
  };
2673
2830
  }, [resolvedThreadId, agent, copilotkit, resolvedAgentId]);
2674
- const onSubmitInput = (0, import_react20.useCallback)(
2831
+ const onSubmitInput = (0, import_react21.useCallback)(
2675
2832
  async (value) => {
2676
2833
  agent?.addMessage({
2677
2834
  id: (0, import_shared7.randomUUID)(),
@@ -2688,7 +2845,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2688
2845
  },
2689
2846
  [agent, copilotkit]
2690
2847
  );
2691
- const handleSelectSuggestion = (0, import_react20.useCallback)(
2848
+ const handleSelectSuggestion = (0, import_react21.useCallback)(
2692
2849
  async (suggestion) => {
2693
2850
  if (!agent) {
2694
2851
  return;
@@ -2726,7 +2883,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2726
2883
  }
2727
2884
  });
2728
2885
  const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);
2729
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2886
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2730
2887
  CopilotChatConfigurationProvider,
2731
2888
  {
2732
2889
  agentId: resolvedAgentId,
@@ -2742,17 +2899,17 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2742
2899
  })(CopilotChat || (CopilotChat = {}));
2743
2900
 
2744
2901
  // src/components/chat/CopilotChatToggleButton.tsx
2745
- var import_react21 = __toESM(require("react"));
2902
+ var import_react22 = __toESM(require("react"));
2746
2903
  var import_lucide_react7 = require("lucide-react");
2747
- var import_jsx_runtime17 = require("react/jsx-runtime");
2904
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2748
2905
  var DefaultOpenIcon = ({
2749
2906
  className,
2750
2907
  ...props
2751
- }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
2908
+ }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
2752
2909
  var DefaultCloseIcon = ({
2753
2910
  className,
2754
2911
  ...props
2755
- }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.X, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
2912
+ }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.X, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
2756
2913
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
2757
2914
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
2758
2915
  var ICON_TRANSITION_STYLE = Object.freeze({
@@ -2769,11 +2926,11 @@ var BUTTON_BASE_CLASSES = cn(
2769
2926
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2770
2927
  "disabled:pointer-events-none disabled:opacity-60"
2771
2928
  );
2772
- var CopilotChatToggleButton = import_react21.default.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
2929
+ var CopilotChatToggleButton = import_react22.default.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
2773
2930
  const { onClick, type, disabled, ...restProps } = buttonProps;
2774
2931
  const configuration = useCopilotChatConfiguration();
2775
2932
  const labels = configuration?.labels ?? CopilotChatDefaultLabels;
2776
- const [fallbackOpen, setFallbackOpen] = (0, import_react21.useState)(false);
2933
+ const [fallbackOpen, setFallbackOpen] = (0, import_react22.useState)(false);
2777
2934
  const isOpen = configuration?.isModalOpen ?? fallbackOpen;
2778
2935
  const setModalOpen = configuration?.setModalOpen ?? setFallbackOpen;
2779
2936
  const handleClick = (event) => {
@@ -2807,7 +2964,7 @@ var CopilotChatToggleButton = import_react21.default.forwardRef(function Copilot
2807
2964
  focusable: false
2808
2965
  }
2809
2966
  );
2810
- const openIconElement = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2967
+ const openIconElement = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2811
2968
  "span",
2812
2969
  {
2813
2970
  "aria-hidden": "true",
@@ -2821,7 +2978,7 @@ var CopilotChatToggleButton = import_react21.default.forwardRef(function Copilot
2821
2978
  children: renderedOpenIcon
2822
2979
  }
2823
2980
  );
2824
- const closeIconElement = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2981
+ const closeIconElement = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2825
2982
  "span",
2826
2983
  {
2827
2984
  "aria-hidden": "true",
@@ -2835,7 +2992,7 @@ var CopilotChatToggleButton = import_react21.default.forwardRef(function Copilot
2835
2992
  children: renderedCloseIcon
2836
2993
  }
2837
2994
  );
2838
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
2995
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2839
2996
  "button",
2840
2997
  {
2841
2998
  ref,
@@ -2859,12 +3016,12 @@ CopilotChatToggleButton.displayName = "CopilotChatToggleButton";
2859
3016
  var CopilotChatToggleButton_default = CopilotChatToggleButton;
2860
3017
 
2861
3018
  // src/components/chat/CopilotSidebarView.tsx
2862
- var import_react23 = require("react");
3019
+ var import_react24 = require("react");
2863
3020
 
2864
3021
  // src/components/chat/CopilotModalHeader.tsx
2865
- var import_react22 = require("react");
3022
+ var import_react23 = require("react");
2866
3023
  var import_lucide_react8 = require("lucide-react");
2867
- var import_jsx_runtime18 = require("react/jsx-runtime");
3024
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2868
3025
  function CopilotModalHeader({
2869
3026
  title,
2870
3027
  titleContent,
@@ -2876,7 +3033,7 @@ function CopilotModalHeader({
2876
3033
  const configuration = useCopilotChatConfiguration();
2877
3034
  const fallbackTitle = configuration?.labels.modalHeaderTitle ?? CopilotChatDefaultLabels.modalHeaderTitle;
2878
3035
  const resolvedTitle = title ?? fallbackTitle;
2879
- const handleClose = (0, import_react22.useCallback)(() => {
3036
+ const handleClose = (0, import_react23.useCallback)(() => {
2880
3037
  configuration?.setModalOpen(false);
2881
3038
  }, [configuration]);
2882
3039
  const BoundTitle = renderSlot(titleContent, CopilotModalHeader.Title, {
@@ -2893,7 +3050,7 @@ function CopilotModalHeader({
2893
3050
  ...rest
2894
3051
  });
2895
3052
  }
2896
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3053
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2897
3054
  "header",
2898
3055
  {
2899
3056
  "data-slot": "copilot-modal-header",
@@ -2903,17 +3060,17 @@ function CopilotModalHeader({
2903
3060
  className
2904
3061
  ),
2905
3062
  ...rest,
2906
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
2907
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1", "aria-hidden": "true" }),
2908
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
2909
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
3063
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
3064
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1", "aria-hidden": "true" }),
3065
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
3066
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
2910
3067
  ] })
2911
3068
  }
2912
3069
  );
2913
3070
  }
2914
3071
  CopilotModalHeader.displayName = "CopilotModalHeader";
2915
3072
  ((CopilotModalHeader2) => {
2916
- CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3073
+ CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2917
3074
  "div",
2918
3075
  {
2919
3076
  className: cn(
@@ -2927,7 +3084,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
2927
3084
  CopilotModalHeader2.CloseButton = ({
2928
3085
  className,
2929
3086
  ...props
2930
- }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3087
+ }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2931
3088
  "button",
2932
3089
  {
2933
3090
  type: "button",
@@ -2938,7 +3095,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
2938
3095
  ),
2939
3096
  "aria-label": "Close",
2940
3097
  ...props,
2941
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.X, { className: "h-4 w-4", "aria-hidden": "true" })
3098
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { className: "h-4 w-4", "aria-hidden": "true" })
2942
3099
  }
2943
3100
  );
2944
3101
  })(CopilotModalHeader || (CopilotModalHeader = {}));
@@ -2946,14 +3103,14 @@ CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
2946
3103
  CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
2947
3104
 
2948
3105
  // src/components/chat/CopilotSidebarView.tsx
2949
- var import_jsx_runtime19 = require("react/jsx-runtime");
3106
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2950
3107
  var DEFAULT_SIDEBAR_WIDTH = 480;
2951
3108
  var SIDEBAR_TRANSITION_MS = 260;
2952
3109
  function CopilotSidebarView({ header, width, ...props }) {
2953
3110
  const configuration = useCopilotChatConfiguration();
2954
3111
  const isSidebarOpen = configuration?.isModalOpen ?? false;
2955
- const sidebarRef = (0, import_react23.useRef)(null);
2956
- const [sidebarWidth, setSidebarWidth] = (0, import_react23.useState)(width ?? DEFAULT_SIDEBAR_WIDTH);
3112
+ const sidebarRef = (0, import_react24.useRef)(null);
3113
+ const [sidebarWidth, setSidebarWidth] = (0, import_react24.useState)(width ?? DEFAULT_SIDEBAR_WIDTH);
2957
3114
  const widthToCss = (w) => {
2958
3115
  return typeof w === "number" ? `${w}px` : w;
2959
3116
  };
@@ -2963,7 +3120,7 @@ function CopilotSidebarView({ header, width, ...props }) {
2963
3120
  }
2964
3121
  return w;
2965
3122
  };
2966
- (0, import_react23.useEffect)(() => {
3123
+ (0, import_react24.useEffect)(() => {
2967
3124
  if (width !== void 0) {
2968
3125
  return;
2969
3126
  }
@@ -2990,8 +3147,8 @@ function CopilotSidebarView({ header, width, ...props }) {
2990
3147
  return () => window.removeEventListener("resize", updateWidth);
2991
3148
  }, [width]);
2992
3149
  const headerElement = renderSlot(header, CopilotModalHeader, {});
2993
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
2994
- isSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3150
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
3151
+ isSidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2995
3152
  "style",
2996
3153
  {
2997
3154
  dangerouslySetInnerHTML: {
@@ -3002,8 +3159,8 @@ function CopilotSidebarView({ header, width, ...props }) {
3002
3159
  }
3003
3160
  }
3004
3161
  ),
3005
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopilotChatToggleButton_default, {}),
3006
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3162
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotChatToggleButton_default, {}),
3163
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3007
3164
  "aside",
3008
3165
  {
3009
3166
  ref: sidebarRef,
@@ -3018,9 +3175,9 @@ function CopilotSidebarView({ header, width, ...props }) {
3018
3175
  "aria-hidden": !isSidebarOpen,
3019
3176
  "aria-label": "Copilot chat sidebar",
3020
3177
  role: "complementary",
3021
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3178
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3022
3179
  headerElement,
3023
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CopilotChatView_default, { ...props }) })
3180
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CopilotChatView_default, { ...props }) })
3024
3181
  ] })
3025
3182
  }
3026
3183
  )
@@ -3029,13 +3186,13 @@ function CopilotSidebarView({ header, width, ...props }) {
3029
3186
  CopilotSidebarView.displayName = "CopilotSidebarView";
3030
3187
 
3031
3188
  // src/components/chat/CopilotSidebar.tsx
3032
- var import_react24 = require("react");
3033
- var import_jsx_runtime20 = require("react/jsx-runtime");
3189
+ var import_react25 = require("react");
3190
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3034
3191
  function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3035
- const SidebarViewOverride = (0, import_react24.useMemo)(() => {
3192
+ const SidebarViewOverride = (0, import_react25.useMemo)(() => {
3036
3193
  const Component = (viewProps) => {
3037
3194
  const { header: viewHeader, width: viewWidth, ...restProps } = viewProps;
3038
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3195
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3039
3196
  CopilotSidebarView,
3040
3197
  {
3041
3198
  ...restProps,
@@ -3046,7 +3203,7 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3046
3203
  };
3047
3204
  return Object.assign(Component, CopilotChatView_default);
3048
3205
  }, [header, width]);
3049
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3206
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3050
3207
  CopilotChat,
3051
3208
  {
3052
3209
  ...chatProps,
@@ -3057,9 +3214,9 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
3057
3214
  }
3058
3215
  CopilotSidebar.displayName = "CopilotSidebar";
3059
3216
 
3060
- // src/types/defineToolCallRender.ts
3217
+ // src/types/defineToolCallRenderer.ts
3061
3218
  var import_zod2 = require("zod");
3062
- function defineToolCallRender(def) {
3219
+ function defineToolCallRenderer(def) {
3063
3220
  const argsSchema = def.name === "*" && !def.args ? import_zod2.z.any() : def.args;
3064
3221
  return {
3065
3222
  name: def.name,
@@ -3070,25 +3227,25 @@ function defineToolCallRender(def) {
3070
3227
  }
3071
3228
 
3072
3229
  // src/components/WildcardToolCallRender.tsx
3073
- var import_react25 = require("react");
3074
- var import_jsx_runtime21 = require("react/jsx-runtime");
3075
- var WildcardToolCallRender = defineToolCallRender({
3230
+ var import_react26 = require("react");
3231
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3232
+ var WildcardToolCallRender = defineToolCallRenderer({
3076
3233
  name: "*",
3077
3234
  render: ({ args, result, name, status }) => {
3078
- const [isExpanded, setIsExpanded] = (0, import_react25.useState)(false);
3235
+ const [isExpanded, setIsExpanded] = (0, import_react26.useState)(false);
3079
3236
  const statusString = String(status);
3080
3237
  const isActive = statusString === "inProgress" || statusString === "executing";
3081
3238
  const isComplete = statusString === "complete";
3082
3239
  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";
3083
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime21.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: [
3084
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3240
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime23.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: [
3241
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3085
3242
  "div",
3086
3243
  {
3087
3244
  className: "flex items-center justify-between gap-3 cursor-pointer",
3088
3245
  onClick: () => setIsExpanded(!isExpanded),
3089
3246
  children: [
3090
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
3091
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3247
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 min-w-0", children: [
3248
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3092
3249
  "svg",
3093
3250
  {
3094
3251
  className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
@@ -3096,7 +3253,7 @@ var WildcardToolCallRender = defineToolCallRender({
3096
3253
  viewBox: "0 0 24 24",
3097
3254
  strokeWidth: 2,
3098
3255
  stroke: "currentColor",
3099
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3256
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3100
3257
  "path",
3101
3258
  {
3102
3259
  strokeLinecap: "round",
@@ -3106,10 +3263,10 @@ var WildcardToolCallRender = defineToolCallRender({
3106
3263
  )
3107
3264
  }
3108
3265
  ),
3109
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3110
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3266
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3267
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3111
3268
  ] }),
3112
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3269
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3113
3270
  "span",
3114
3271
  {
3115
3272
  className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
@@ -3119,14 +3276,14 @@ var WildcardToolCallRender = defineToolCallRender({
3119
3276
  ]
3120
3277
  }
3121
3278
  ),
3122
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-3 grid gap-4", children: [
3123
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3124
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3125
- /* @__PURE__ */ (0, import_jsx_runtime21.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) })
3279
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mt-3 grid gap-4", children: [
3280
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
3281
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3282
+ /* @__PURE__ */ (0, import_jsx_runtime23.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) })
3126
3283
  ] }),
3127
- result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3128
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3129
- /* @__PURE__ */ (0, import_jsx_runtime21.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) })
3284
+ result !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { children: [
3285
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3286
+ /* @__PURE__ */ (0, import_jsx_runtime23.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) })
3130
3287
  ] })
3131
3288
  ] })
3132
3289
  ] }) });
@@ -3149,12 +3306,14 @@ var WildcardToolCallRender = defineToolCallRender({
3149
3306
  CopilotChatToolCallsView,
3150
3307
  CopilotChatUserMessage,
3151
3308
  CopilotChatView,
3309
+ CopilotKitCoreReact,
3152
3310
  CopilotKitProvider,
3153
3311
  CopilotModalHeader,
3154
3312
  CopilotSidebar,
3155
3313
  CopilotSidebarView,
3314
+ WebInspector,
3156
3315
  WildcardToolCallRender,
3157
- defineToolCallRender,
3316
+ defineToolCallRenderer,
3158
3317
  useAgent,
3159
3318
  useAgentContext,
3160
3319
  useConfigureSuggestions,
@@ -3162,6 +3321,7 @@ var WildcardToolCallRender = defineToolCallRender({
3162
3321
  useCopilotKit,
3163
3322
  useFrontendTool,
3164
3323
  useHumanInTheLoop,
3324
+ useRenderCustomMessages,
3165
3325
  useRenderToolCall,
3166
3326
  useSuggestions
3167
3327
  });