@copilotkitnext/react 0.0.13-alpha.0 → 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.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // src/components/chat/CopilotChatInput.tsx
2
4
  import { useState as useState2, useRef as useRef2, useEffect as useEffect2, forwardRef as forwardRef2, useImperativeHandle as useImperativeHandle2 } from "react";
3
5
  import { twMerge as twMerge3 } from "tailwind-merge";
@@ -899,26 +901,100 @@ import "katex/dist/katex.min.css";
899
901
  import { completePartialMarkdown } from "@copilotkitnext/core";
900
902
 
901
903
  // src/hooks/use-render-tool-call.tsx
902
- import { useCallback, useEffect as useEffect4, useState as useState4 } from "react";
904
+ import { useCallback, useEffect as useEffect5, useState as useState4, useSyncExternalStore } from "react";
903
905
  import { ToolCallStatus } from "@copilotkitnext/core";
904
906
 
905
907
  // src/providers/CopilotKitProvider.tsx
906
- import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2, useEffect as useEffect3, useState as useState3, useReducer, useRef as useRef3 } from "react";
908
+ import {
909
+ createContext as createContext2,
910
+ useContext as useContext2,
911
+ useMemo as useMemo2,
912
+ useEffect as useEffect4,
913
+ useReducer,
914
+ useRef as useRef4,
915
+ useState as useState3
916
+ } from "react";
907
917
  import { z } from "zod";
918
+
919
+ // src/lib/react-core.ts
908
920
  import { CopilotKitCore } from "@copilotkitnext/core";
921
+ var CopilotKitCoreReact = class extends CopilotKitCore {
922
+ _renderToolCalls = [];
923
+ _renderCustomMessages = [];
924
+ constructor(config) {
925
+ super(config);
926
+ this._renderToolCalls = config.renderToolCalls ?? [];
927
+ this._renderCustomMessages = config.renderCustomMessages ?? [];
928
+ }
929
+ get renderCustomMessages() {
930
+ return this._renderCustomMessages;
931
+ }
932
+ get renderToolCalls() {
933
+ return this._renderToolCalls;
934
+ }
935
+ setRenderToolCalls(renderToolCalls) {
936
+ this._renderToolCalls = renderToolCalls;
937
+ void this.notifySubscribers(
938
+ (subscriber) => {
939
+ const reactSubscriber = subscriber;
940
+ if (reactSubscriber.onRenderToolCallsChanged) {
941
+ reactSubscriber.onRenderToolCallsChanged({
942
+ copilotkit: this,
943
+ renderToolCalls: this.renderToolCalls
944
+ });
945
+ }
946
+ },
947
+ "Subscriber onRenderToolCallsChanged error:"
948
+ );
949
+ }
950
+ // Override to accept React-specific subscriber type
951
+ subscribe(subscriber) {
952
+ return super.subscribe(subscriber);
953
+ }
954
+ unsubscribe(subscriber) {
955
+ super.unsubscribe(subscriber);
956
+ }
957
+ };
958
+
959
+ // src/components/WebInspector.tsx
960
+ import * as React4 from "react";
961
+ import { createComponent } from "@lit-labs/react";
962
+ import {
963
+ WEB_INSPECTOR_TAG,
964
+ WebInspectorElement,
965
+ defineWebInspector
966
+ } from "@copilotkitnext/web-inspector";
909
967
  import { jsx as jsx7 } from "react/jsx-runtime";
910
- var CopilotKitContext = createContext2({
911
- copilotkit: null,
912
- renderToolCalls: [],
913
- currentRenderToolCalls: [],
914
- setCurrentRenderToolCalls: () => {
968
+ defineWebInspector();
969
+ var WebInspectorBase = createComponent({
970
+ tagName: WEB_INSPECTOR_TAG,
971
+ elementClass: WebInspectorElement,
972
+ react: React4
973
+ });
974
+ var WebInspector = React4.forwardRef(
975
+ ({ core, ...rest }, ref) => {
976
+ const innerRef = React4.useRef(null);
977
+ React4.useImperativeHandle(ref, () => innerRef.current, []);
978
+ React4.useEffect(() => {
979
+ if (innerRef.current) {
980
+ innerRef.current.core = core ?? null;
981
+ }
982
+ }, [core]);
983
+ return /* @__PURE__ */ jsx7(WebInspectorBase, { ...rest, ref: innerRef });
915
984
  }
985
+ );
986
+ WebInspector.displayName = "WebInspector";
987
+
988
+ // src/providers/CopilotKitProvider.tsx
989
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
990
+ var CopilotKitContext = createContext2({
991
+ copilotkit: null
916
992
  });
917
993
  function useStableArrayProp(prop, warningMessage, isMeaningfulChange) {
918
994
  const empty = useMemo2(() => [], []);
919
995
  const value = prop ?? empty;
920
- const initial = useRef3(value);
921
- useEffect3(() => {
996
+ const initial = useRef4(value);
997
+ useEffect4(() => {
922
998
  if (warningMessage && value !== initial.current && (isMeaningfulChange ? isMeaningfulChange(initial.current, value) : true)) {
923
999
  console.error(warningMessage);
924
1000
  }
@@ -932,9 +1008,29 @@ var CopilotKitProvider = ({
932
1008
  properties = {},
933
1009
  agents__unsafe_dev_only: agents = {},
934
1010
  renderToolCalls,
1011
+ renderCustomMessages,
935
1012
  frontendTools,
936
- humanInTheLoop
1013
+ humanInTheLoop,
1014
+ showDevConsole = false
937
1015
  }) => {
1016
+ const [shouldRenderInspector, setShouldRenderInspector] = useState3(false);
1017
+ useEffect4(() => {
1018
+ if (typeof window === "undefined") {
1019
+ return;
1020
+ }
1021
+ if (showDevConsole === true) {
1022
+ setShouldRenderInspector(true);
1023
+ } else if (showDevConsole === "auto") {
1024
+ const localhostHosts = /* @__PURE__ */ new Set(["localhost", "127.0.0.1"]);
1025
+ if (localhostHosts.has(window.location.hostname)) {
1026
+ setShouldRenderInspector(true);
1027
+ } else {
1028
+ setShouldRenderInspector(false);
1029
+ }
1030
+ } else {
1031
+ setShouldRenderInspector(false);
1032
+ }
1033
+ }, [showDevConsole]);
938
1034
  const renderToolCallsList = useStableArrayProp(
939
1035
  renderToolCalls,
940
1036
  "renderToolCalls must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead.",
@@ -948,6 +1044,10 @@ var CopilotKitProvider = ({
948
1044
  return false;
949
1045
  }
950
1046
  );
1047
+ const renderCustomMessagesList = useStableArrayProp(
1048
+ renderCustomMessages,
1049
+ "renderCustomMessages must be a stable array."
1050
+ );
951
1051
  const frontendToolsList = useStableArrayProp(
952
1052
  frontendTools,
953
1053
  "frontendTools must be a stable array. If you want to dynamically add or remove tools, use `useFrontendTool` instead."
@@ -956,8 +1056,6 @@ var CopilotKitProvider = ({
956
1056
  humanInTheLoop,
957
1057
  "humanInTheLoop must be a stable array. If you want to dynamically add or remove human-in-the-loop tools, use `useHumanInTheLoop` instead."
958
1058
  );
959
- const initialRenderToolCalls = useMemo2(() => renderToolCallsList, []);
960
- const [currentRenderToolCalls, setCurrentRenderToolCalls] = useState3([]);
961
1059
  const processedHumanInTheLoopTools = useMemo2(() => {
962
1060
  const processedTools = [];
963
1061
  const processedRenderToolCalls = [];
@@ -1011,58 +1109,44 @@ var CopilotKitProvider = ({
1011
1109
  return combined;
1012
1110
  }, [renderToolCallsList, frontendToolsList, processedHumanInTheLoopTools]);
1013
1111
  const copilotkit = useMemo2(() => {
1014
- const config = {
1112
+ const copilotkit2 = new CopilotKitCoreReact({
1015
1113
  runtimeUrl,
1016
1114
  headers,
1017
1115
  properties,
1018
1116
  agents__unsafe_dev_only: agents,
1019
- tools: allTools
1020
- };
1021
- const copilotkit2 = new CopilotKitCore(config);
1117
+ tools: allTools,
1118
+ renderToolCalls: allRenderToolCalls,
1119
+ renderCustomMessages: renderCustomMessagesList
1120
+ });
1022
1121
  return copilotkit2;
1023
- }, [allTools]);
1024
- useEffect3(() => {
1025
- setCurrentRenderToolCalls((prev) => {
1026
- const keyOf = (rc) => `${rc?.agentId ?? ""}:${rc?.name ?? ""}`;
1027
- const computedMap = /* @__PURE__ */ new Map();
1028
- for (const rc of allRenderToolCalls) {
1029
- computedMap.set(keyOf(rc), rc);
1030
- }
1031
- const merged = [...computedMap.values()];
1032
- for (const rc of prev) {
1033
- const k = keyOf(rc);
1034
- if (!computedMap.has(k)) merged.push(rc);
1035
- }
1036
- const sameLength = merged.length === prev.length;
1037
- if (sameLength) {
1038
- let same = true;
1039
- for (let i = 0; i < merged.length; i++) {
1040
- if (merged[i] !== prev[i]) {
1041
- same = false;
1042
- break;
1043
- }
1044
- }
1045
- if (same) return prev;
1122
+ }, [allTools, allRenderToolCalls, renderCustomMessagesList]);
1123
+ const [, forceUpdate] = useReducer((x) => x + 1, 0);
1124
+ useEffect4(() => {
1125
+ const unsubscribe = copilotkit.subscribe({
1126
+ onRenderToolCallsChanged: () => {
1127
+ forceUpdate();
1046
1128
  }
1047
- return merged;
1048
1129
  });
1049
- }, [allRenderToolCalls]);
1050
- useEffect3(() => {
1130
+ return () => {
1131
+ unsubscribe();
1132
+ };
1133
+ }, [copilotkit]);
1134
+ useEffect4(() => {
1051
1135
  copilotkit.setRuntimeUrl(runtimeUrl);
1052
1136
  copilotkit.setHeaders(headers);
1053
1137
  copilotkit.setProperties(properties);
1054
1138
  copilotkit.setAgents__unsafe_dev_only(agents);
1055
1139
  }, [runtimeUrl, headers, properties, agents]);
1056
- return /* @__PURE__ */ jsx7(
1140
+ return /* @__PURE__ */ jsxs4(
1057
1141
  CopilotKitContext.Provider,
1058
1142
  {
1059
1143
  value: {
1060
- copilotkit,
1061
- renderToolCalls: allRenderToolCalls,
1062
- currentRenderToolCalls,
1063
- setCurrentRenderToolCalls
1144
+ copilotkit
1064
1145
  },
1065
- children
1146
+ children: [
1147
+ children,
1148
+ shouldRenderInspector ? /* @__PURE__ */ jsx8(WebInspector, { core: copilotkit }) : null
1149
+ ]
1066
1150
  }
1067
1151
  );
1068
1152
  };
@@ -1072,7 +1156,7 @@ var useCopilotKit = () => {
1072
1156
  if (!context) {
1073
1157
  throw new Error("useCopilotKit must be used within CopilotKitProvider");
1074
1158
  }
1075
- useEffect3(() => {
1159
+ useEffect4(() => {
1076
1160
  const unsubscribe = context.copilotkit.subscribe({
1077
1161
  onRuntimeConnectionStatusChanged: () => {
1078
1162
  forceUpdate();
@@ -1088,13 +1172,22 @@ var useCopilotKit = () => {
1088
1172
  // src/hooks/use-render-tool-call.tsx
1089
1173
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID2 } from "@copilotkitnext/shared";
1090
1174
  import { partialJSONParse } from "@copilotkitnext/shared";
1091
- import { jsx as jsx8 } from "react/jsx-runtime";
1175
+ import { jsx as jsx9 } from "react/jsx-runtime";
1092
1176
  function useRenderToolCall() {
1093
- const { currentRenderToolCalls, copilotkit } = useCopilotKit();
1177
+ const { copilotkit } = useCopilotKit();
1094
1178
  const config = useCopilotChatConfiguration();
1095
1179
  const agentId = config?.agentId ?? DEFAULT_AGENT_ID2;
1096
1180
  const [executingToolCallIds, setExecutingToolCallIds] = useState4(() => /* @__PURE__ */ new Set());
1097
- useEffect4(() => {
1181
+ const renderToolCalls = useSyncExternalStore(
1182
+ (callback) => {
1183
+ return copilotkit.subscribe({
1184
+ onRenderToolCallsChanged: callback
1185
+ });
1186
+ },
1187
+ () => copilotkit.renderToolCalls,
1188
+ () => copilotkit.renderToolCalls
1189
+ );
1190
+ useEffect5(() => {
1098
1191
  const unsubscribe = copilotkit.subscribe({
1099
1192
  onToolExecutionStart: ({ toolCallId }) => {
1100
1193
  setExecutingToolCallIds((prev) => {
@@ -1120,10 +1213,10 @@ function useRenderToolCall() {
1120
1213
  toolCall,
1121
1214
  toolMessage
1122
1215
  }) => {
1123
- const exactMatches = currentRenderToolCalls.filter(
1216
+ const exactMatches = renderToolCalls.filter(
1124
1217
  (rc) => rc.name === toolCall.function.name
1125
1218
  );
1126
- const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || currentRenderToolCalls.find((rc) => rc.name === "*");
1219
+ const renderConfig = exactMatches.find((rc) => rc.agentId === agentId) || exactMatches.find((rc) => !rc.agentId) || exactMatches[0] || renderToolCalls.find((rc) => rc.name === "*");
1127
1220
  if (!renderConfig) {
1128
1221
  return null;
1129
1222
  }
@@ -1131,7 +1224,7 @@ function useRenderToolCall() {
1131
1224
  const args = partialJSONParse(toolCall.function.arguments);
1132
1225
  const toolName = toolCall.function.name;
1133
1226
  if (toolMessage) {
1134
- return /* @__PURE__ */ jsx8(
1227
+ return /* @__PURE__ */ jsx9(
1135
1228
  RenderComponent,
1136
1229
  {
1137
1230
  name: toolName,
@@ -1142,7 +1235,7 @@ function useRenderToolCall() {
1142
1235
  toolCall.id
1143
1236
  );
1144
1237
  } else if (executingToolCallIds.has(toolCall.id)) {
1145
- return /* @__PURE__ */ jsx8(
1238
+ return /* @__PURE__ */ jsx9(
1146
1239
  RenderComponent,
1147
1240
  {
1148
1241
  name: toolName,
@@ -1153,7 +1246,7 @@ function useRenderToolCall() {
1153
1246
  toolCall.id
1154
1247
  );
1155
1248
  } else {
1156
- return /* @__PURE__ */ jsx8(
1249
+ return /* @__PURE__ */ jsx9(
1157
1250
  RenderComponent,
1158
1251
  {
1159
1252
  name: toolName,
@@ -1165,16 +1258,74 @@ function useRenderToolCall() {
1165
1258
  );
1166
1259
  }
1167
1260
  },
1168
- [currentRenderToolCalls, executingToolCallIds, agentId]
1261
+ [renderToolCalls, executingToolCallIds, agentId]
1169
1262
  );
1170
1263
  return renderToolCall;
1171
1264
  }
1172
1265
 
1266
+ // src/hooks/use-render-custom-messages.tsx
1267
+ import { jsx as jsx10 } from "react/jsx-runtime";
1268
+ function useRenderCustomMessages() {
1269
+ const { copilotkit } = useCopilotKit();
1270
+ const config = useCopilotChatConfiguration();
1271
+ if (!config) {
1272
+ return null;
1273
+ }
1274
+ const { agentId, threadId } = config;
1275
+ const customMessageRenderers = copilotkit.renderCustomMessages.filter((renderer) => renderer.agentId === void 0 || renderer.agentId === agentId).sort((a, b) => {
1276
+ const aHasAgent = a.agentId !== void 0;
1277
+ const bHasAgent = b.agentId !== void 0;
1278
+ if (aHasAgent === bHasAgent) return 0;
1279
+ return aHasAgent ? -1 : 1;
1280
+ });
1281
+ return function(params) {
1282
+ if (!customMessageRenderers.length) {
1283
+ return null;
1284
+ }
1285
+ const { message, position } = params;
1286
+ const runId = copilotkit.getRunIdForMessage(agentId, threadId, message.id);
1287
+ const agent = copilotkit.getAgent(agentId);
1288
+ if (!agent) {
1289
+ throw new Error("Agent not found");
1290
+ }
1291
+ const messagesIdsInRun = agent.messages.filter((msg) => copilotkit.getRunIdForMessage(agentId, threadId, msg.id) === runId).map((msg) => msg.id);
1292
+ const messageIndex = agent.messages.findIndex((msg) => msg.id === message.id) ?? 0;
1293
+ const messageIndexInRun = Math.min(messagesIdsInRun.indexOf(message.id), 0);
1294
+ const numberOfMessagesInRun = messagesIdsInRun.length;
1295
+ const stateSnapshot = copilotkit.getStateByRun(agentId, threadId, runId);
1296
+ let result = null;
1297
+ for (const renderer of customMessageRenderers) {
1298
+ if (!renderer.render) {
1299
+ continue;
1300
+ }
1301
+ const Component = renderer.render;
1302
+ result = /* @__PURE__ */ jsx10(
1303
+ Component,
1304
+ {
1305
+ message,
1306
+ position,
1307
+ runId,
1308
+ messageIndex,
1309
+ messageIndexInRun,
1310
+ numberOfMessagesInRun,
1311
+ agentId,
1312
+ stateSnapshot
1313
+ },
1314
+ `${runId}-${message.id}-${position}`
1315
+ );
1316
+ if (result) {
1317
+ break;
1318
+ }
1319
+ }
1320
+ return result;
1321
+ };
1322
+ }
1323
+
1173
1324
  // src/hooks/use-frontend-tool.tsx
1174
- import { useEffect as useEffect5 } from "react";
1325
+ import { useEffect as useEffect6 } from "react";
1175
1326
  function useFrontendTool(tool) {
1176
- const { copilotkit, setCurrentRenderToolCalls } = useCopilotKit();
1177
- useEffect5(() => {
1327
+ const { copilotkit } = useCopilotKit();
1328
+ useEffect6(() => {
1178
1329
  const name = tool.name;
1179
1330
  if (copilotkit.getTool({ toolName: name, agentId: tool.agentId })) {
1180
1331
  console.warn(
@@ -1184,37 +1335,37 @@ function useFrontendTool(tool) {
1184
1335
  }
1185
1336
  copilotkit.addTool(tool);
1186
1337
  if (tool.render) {
1187
- setCurrentRenderToolCalls((prev) => {
1188
- const replaced = prev.filter(
1189
- (rc) => !(rc.name === name && rc.agentId === tool.agentId)
1190
- );
1191
- return [
1192
- ...replaced,
1193
- {
1194
- name,
1195
- args: tool.parameters,
1196
- agentId: tool.agentId,
1197
- render: tool.render
1198
- }
1199
- ];
1200
- });
1338
+ const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
1339
+ const currentRenderToolCalls = copilotkit.renderToolCalls;
1340
+ const mergedMap = /* @__PURE__ */ new Map();
1341
+ for (const rc of currentRenderToolCalls) {
1342
+ mergedMap.set(keyOf(rc), rc);
1343
+ }
1344
+ const newEntry = {
1345
+ name,
1346
+ args: tool.parameters,
1347
+ agentId: tool.agentId,
1348
+ render: tool.render
1349
+ };
1350
+ mergedMap.set(keyOf(newEntry), newEntry);
1351
+ copilotkit.setRenderToolCalls(Array.from(mergedMap.values()));
1201
1352
  }
1202
1353
  return () => {
1203
1354
  copilotkit.removeTool(name, tool.agentId);
1204
1355
  };
1205
- }, [tool.name, copilotkit, setCurrentRenderToolCalls]);
1356
+ }, [tool.name, copilotkit]);
1206
1357
  }
1207
1358
 
1208
1359
  // src/hooks/use-human-in-the-loop.tsx
1209
- import { useState as useState5, useCallback as useCallback2, useRef as useRef4, useEffect as useEffect6 } from "react";
1210
- import React6 from "react";
1360
+ import { useState as useState5, useCallback as useCallback2, useRef as useRef5, useEffect as useEffect7 } from "react";
1361
+ import React7 from "react";
1211
1362
  function useHumanInTheLoop(tool) {
1363
+ const { copilotkit } = useCopilotKit();
1212
1364
  const [status, setStatus] = useState5(
1213
1365
  "inProgress"
1214
1366
  );
1215
- const statusRef = useRef4(status);
1216
- const resolvePromiseRef = useRef4(null);
1217
- const { setCurrentRenderToolCalls } = useCopilotKit();
1367
+ const statusRef = useRef5(status);
1368
+ const resolvePromiseRef = useRef5(null);
1218
1369
  statusRef.current = status;
1219
1370
  const respond = useCallback2(async (result) => {
1220
1371
  if (resolvePromiseRef.current) {
@@ -1240,7 +1391,7 @@ function useHumanInTheLoop(tool) {
1240
1391
  description: tool.description || "",
1241
1392
  respond: void 0
1242
1393
  };
1243
- return React6.createElement(ToolComponent, enhancedProps);
1394
+ return React7.createElement(ToolComponent, enhancedProps);
1244
1395
  } else if (currentStatus === "executing" && props.status === "executing") {
1245
1396
  const enhancedProps = {
1246
1397
  ...props,
@@ -1248,7 +1399,7 @@ function useHumanInTheLoop(tool) {
1248
1399
  description: tool.description || "",
1249
1400
  respond
1250
1401
  };
1251
- return React6.createElement(ToolComponent, enhancedProps);
1402
+ return React7.createElement(ToolComponent, enhancedProps);
1252
1403
  } else if (currentStatus === "complete" && props.status === "complete") {
1253
1404
  const enhancedProps = {
1254
1405
  ...props,
@@ -1256,9 +1407,9 @@ function useHumanInTheLoop(tool) {
1256
1407
  description: tool.description || "",
1257
1408
  respond: void 0
1258
1409
  };
1259
- return React6.createElement(ToolComponent, enhancedProps);
1410
+ return React7.createElement(ToolComponent, enhancedProps);
1260
1411
  }
1261
- return React6.createElement(ToolComponent, props);
1412
+ return React7.createElement(ToolComponent, props);
1262
1413
  },
1263
1414
  [tool.render, tool.name, tool.description, respond]
1264
1415
  );
@@ -1268,19 +1419,20 @@ function useHumanInTheLoop(tool) {
1268
1419
  render: RenderComponent
1269
1420
  };
1270
1421
  useFrontendTool(frontendTool);
1271
- useEffect6(() => {
1422
+ useEffect7(() => {
1272
1423
  return () => {
1273
- setCurrentRenderToolCalls(
1274
- (prev) => prev.filter(
1275
- (rc) => rc.name !== tool.name || rc.agentId !== tool.agentId
1276
- )
1424
+ const keyOf = (rc) => `${rc.agentId ?? ""}:${rc.name}`;
1425
+ const currentRenderToolCalls = copilotkit.renderToolCalls;
1426
+ const filtered = currentRenderToolCalls.filter(
1427
+ (rc) => keyOf(rc) !== keyOf({ name: tool.name, agentId: tool.agentId })
1277
1428
  );
1429
+ copilotkit.setRenderToolCalls(filtered);
1278
1430
  };
1279
- }, [setCurrentRenderToolCalls, tool.name, tool.agentId]);
1431
+ }, [copilotkit, tool.name, tool.agentId]);
1280
1432
  }
1281
1433
 
1282
1434
  // src/hooks/use-agent.tsx
1283
- import { useMemo as useMemo3, useEffect as useEffect7, useReducer as useReducer2 } from "react";
1435
+ import { useMemo as useMemo3, useEffect as useEffect8, useReducer as useReducer2 } from "react";
1284
1436
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID3 } from "@copilotkitnext/shared";
1285
1437
  var ALL_UPDATES = [
1286
1438
  "OnMessagesChanged" /* OnMessagesChanged */,
@@ -1303,7 +1455,7 @@ function useAgent({ agentId, updates } = {}) {
1303
1455
  copilotkit.runtimeConnectionStatus,
1304
1456
  copilotkit
1305
1457
  ]);
1306
- useEffect7(() => {
1458
+ useEffect8(() => {
1307
1459
  if (!agent) {
1308
1460
  return;
1309
1461
  }
@@ -1341,11 +1493,11 @@ function useAgent({ agentId, updates } = {}) {
1341
1493
  }
1342
1494
 
1343
1495
  // src/hooks/use-agent-context.tsx
1344
- import { useEffect as useEffect8 } from "react";
1496
+ import { useEffect as useEffect9 } from "react";
1345
1497
  function useAgentContext(context) {
1346
1498
  const { description, value } = context;
1347
1499
  const { copilotkit } = useCopilotKit();
1348
- useEffect8(() => {
1500
+ useEffect9(() => {
1349
1501
  if (!copilotkit) return;
1350
1502
  const id = copilotkit.addContext(context);
1351
1503
  return () => {
@@ -1355,7 +1507,7 @@ function useAgentContext(context) {
1355
1507
  }
1356
1508
 
1357
1509
  // src/hooks/use-suggestions.tsx
1358
- import { useCallback as useCallback3, useEffect as useEffect9, useMemo as useMemo4, useState as useState6 } from "react";
1510
+ import { useCallback as useCallback3, useEffect as useEffect10, useMemo as useMemo4, useState as useState6 } from "react";
1359
1511
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID4 } from "@copilotkitnext/shared";
1360
1512
  function useSuggestions({ agentId } = {}) {
1361
1513
  const { copilotkit } = useCopilotKit();
@@ -1369,12 +1521,12 @@ function useSuggestions({ agentId } = {}) {
1369
1521
  const result = copilotkit.getSuggestions(resolvedAgentId);
1370
1522
  return result.isLoading;
1371
1523
  });
1372
- useEffect9(() => {
1524
+ useEffect10(() => {
1373
1525
  const result = copilotkit.getSuggestions(resolvedAgentId);
1374
1526
  setSuggestions(result.suggestions);
1375
1527
  setIsLoading(result.isLoading);
1376
1528
  }, [copilotkit, resolvedAgentId]);
1377
- useEffect9(() => {
1529
+ useEffect10(() => {
1378
1530
  const unsubscribe = copilotkit.subscribe({
1379
1531
  onSuggestionsChanged: ({ agentId: changedAgentId, suggestions: suggestions2 }) => {
1380
1532
  if (changedAgentId !== resolvedAgentId) {
@@ -1419,7 +1571,7 @@ function useSuggestions({ agentId } = {}) {
1419
1571
  }
1420
1572
 
1421
1573
  // src/hooks/use-configure-suggestions.tsx
1422
- import { useCallback as useCallback4, useEffect as useEffect10, useMemo as useMemo5, useRef as useRef5 } from "react";
1574
+ import { useCallback as useCallback4, useEffect as useEffect11, useMemo as useMemo5, useRef as useRef6 } from "react";
1423
1575
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID5 } from "@copilotkitnext/shared";
1424
1576
  var EMPTY_DEPS = [];
1425
1577
  function useConfigureSuggestions(config, options) {
@@ -1428,7 +1580,7 @@ function useConfigureSuggestions(config, options) {
1428
1580
  const extraDeps = options?.deps ?? EMPTY_DEPS;
1429
1581
  const resolvedConsumerAgentId = useMemo5(() => chatConfig?.agentId ?? DEFAULT_AGENT_ID5, [chatConfig?.agentId]);
1430
1582
  const rawConsumerAgentId = useMemo5(() => config ? config.consumerAgentId : void 0, [config]);
1431
- const normalizationCacheRef = useRef5({
1583
+ const normalizationCacheRef = useRef6({
1432
1584
  serialized: null,
1433
1585
  config: null
1434
1586
  });
@@ -1462,9 +1614,9 @@ function useConfigureSuggestions(config, options) {
1462
1614
  normalizationCacheRef.current = { serialized, config: built };
1463
1615
  return { normalizedConfig: built, serializedConfig: serialized };
1464
1616
  }, [config, resolvedConsumerAgentId, ...extraDeps]);
1465
- const latestConfigRef = useRef5(null);
1617
+ const latestConfigRef = useRef6(null);
1466
1618
  latestConfigRef.current = normalizedConfig;
1467
- const previousSerializedConfigRef = useRef5(null);
1619
+ const previousSerializedConfigRef = useRef6(null);
1468
1620
  const targetAgentId = useMemo5(() => {
1469
1621
  if (!normalizedConfig) {
1470
1622
  return resolvedConsumerAgentId;
@@ -1498,7 +1650,7 @@ function useConfigureSuggestions(config, options) {
1498
1650
  }
1499
1651
  copilotkit.reloadSuggestions(targetAgentId);
1500
1652
  }, [copilotkit, isGlobalConfig, normalizedConfig, targetAgentId]);
1501
- useEffect10(() => {
1653
+ useEffect11(() => {
1502
1654
  if (!serializedConfig || !latestConfigRef.current) {
1503
1655
  return;
1504
1656
  }
@@ -1508,7 +1660,7 @@ function useConfigureSuggestions(config, options) {
1508
1660
  copilotkit.removeSuggestionsConfig(id);
1509
1661
  };
1510
1662
  }, [copilotkit, serializedConfig, requestReload]);
1511
- useEffect10(() => {
1663
+ useEffect11(() => {
1512
1664
  if (!normalizedConfig) {
1513
1665
  previousSerializedConfigRef.current = null;
1514
1666
  return;
@@ -1521,7 +1673,7 @@ function useConfigureSuggestions(config, options) {
1521
1673
  }
1522
1674
  requestReload();
1523
1675
  }, [normalizedConfig, requestReload, serializedConfig]);
1524
- useEffect10(() => {
1676
+ useEffect11(() => {
1525
1677
  if (!normalizedConfig || extraDeps.length === 0) {
1526
1678
  return;
1527
1679
  }
@@ -1539,8 +1691,8 @@ function normalizeStaticSuggestions(suggestions) {
1539
1691
  }
1540
1692
 
1541
1693
  // src/components/chat/CopilotChatToolCallsView.tsx
1542
- import React7 from "react";
1543
- import { Fragment as Fragment2, jsx as jsx9 } from "react/jsx-runtime";
1694
+ import React8 from "react";
1695
+ import { Fragment as Fragment2, jsx as jsx11 } from "react/jsx-runtime";
1544
1696
  function CopilotChatToolCallsView({
1545
1697
  message,
1546
1698
  messages = []
@@ -1549,11 +1701,11 @@ function CopilotChatToolCallsView({
1549
1701
  if (!message.toolCalls || message.toolCalls.length === 0) {
1550
1702
  return null;
1551
1703
  }
1552
- return /* @__PURE__ */ jsx9(Fragment2, { children: message.toolCalls.map((toolCall) => {
1704
+ return /* @__PURE__ */ jsx11(Fragment2, { children: message.toolCalls.map((toolCall) => {
1553
1705
  const toolMessage = messages.find(
1554
1706
  (m) => m.role === "tool" && m.toolCallId === toolCall.id
1555
1707
  );
1556
- return /* @__PURE__ */ jsx9(React7.Fragment, { children: renderToolCall({
1708
+ return /* @__PURE__ */ jsx11(React8.Fragment, { children: renderToolCall({
1557
1709
  toolCall,
1558
1710
  toolMessage
1559
1711
  }) }, toolCall.id);
@@ -1562,7 +1714,7 @@ function CopilotChatToolCallsView({
1562
1714
  var CopilotChatToolCallsView_default = CopilotChatToolCallsView;
1563
1715
 
1564
1716
  // src/components/chat/CopilotChatAssistantMessage.tsx
1565
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
1717
+ import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
1566
1718
  function CopilotChatAssistantMessage({
1567
1719
  message,
1568
1720
  messages,
@@ -1639,7 +1791,7 @@ function CopilotChatAssistantMessage({
1639
1791
  toolbar,
1640
1792
  CopilotChatAssistantMessage.Toolbar,
1641
1793
  {
1642
- children: /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-1", children: [
1794
+ children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1", children: [
1643
1795
  boundCopyButton,
1644
1796
  (onThumbsUp || thumbsUpButton) && boundThumbsUpButton,
1645
1797
  (onThumbsDown || thumbsDownButton) && boundThumbsDownButton,
@@ -1660,7 +1812,7 @@ function CopilotChatAssistantMessage({
1660
1812
  const hasContent = !!(message.content && message.content.trim().length > 0);
1661
1813
  const shouldShowToolbar = toolbarVisible && hasContent;
1662
1814
  if (children) {
1663
- return /* @__PURE__ */ jsx10(Fragment3, { children: children({
1815
+ return /* @__PURE__ */ jsx12(Fragment3, { children: children({
1664
1816
  markdownRenderer: boundMarkdownRenderer,
1665
1817
  toolbar: boundToolbar,
1666
1818
  toolCallsView: boundToolCallsView,
@@ -1680,7 +1832,7 @@ function CopilotChatAssistantMessage({
1680
1832
  toolbarVisible: shouldShowToolbar
1681
1833
  }) });
1682
1834
  }
1683
- return /* @__PURE__ */ jsxs4(
1835
+ return /* @__PURE__ */ jsxs5(
1684
1836
  "div",
1685
1837
  {
1686
1838
  className: twMerge4(
@@ -1702,7 +1854,7 @@ function CopilotChatAssistantMessage({
1702
1854
  children,
1703
1855
  ...props
1704
1856
  }) => {
1705
- return /* @__PURE__ */ jsx10(
1857
+ return /* @__PURE__ */ jsx12(
1706
1858
  "code",
1707
1859
  {
1708
1860
  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!",
@@ -1735,10 +1887,10 @@ function CopilotChatAssistantMessage({
1735
1887
  console.error("Failed to copy code:", err);
1736
1888
  }
1737
1889
  };
1738
- return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
1739
- /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between px-4 pr-3 py-3 text-xs", children: [
1740
- language && /* @__PURE__ */ jsx10("span", { className: "font-regular text-muted-foreground dark:text-white", children: language }),
1741
- /* @__PURE__ */ jsxs4(
1890
+ return /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
1891
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between px-4 pr-3 py-3 text-xs", children: [
1892
+ language && /* @__PURE__ */ jsx12("span", { className: "font-regular text-muted-foreground dark:text-white", children: language }),
1893
+ /* @__PURE__ */ jsxs5(
1742
1894
  "button",
1743
1895
  {
1744
1896
  className: cn(
@@ -1747,13 +1899,13 @@ function CopilotChatAssistantMessage({
1747
1899
  onClick: copyToClipboard,
1748
1900
  title: copied ? labels.assistantMessageToolbarCopyCodeCopiedLabel : `${labels.assistantMessageToolbarCopyCodeLabel} code`,
1749
1901
  children: [
1750
- copied ? /* @__PURE__ */ jsx10(Check2, { className: "h-[10px]! w-[10px]!" }) : /* @__PURE__ */ jsx10(Copy, { className: "h-[10px]! w-[10px]!" }),
1751
- /* @__PURE__ */ jsx10("span", { className: "text-[11px]", children: copied ? labels.assistantMessageToolbarCopyCodeCopiedLabel : labels.assistantMessageToolbarCopyCodeLabel })
1902
+ copied ? /* @__PURE__ */ jsx12(Check2, { className: "h-[10px]! w-[10px]!" }) : /* @__PURE__ */ jsx12(Copy, { className: "h-[10px]! w-[10px]!" }),
1903
+ /* @__PURE__ */ jsx12("span", { className: "text-[11px]", children: copied ? labels.assistantMessageToolbarCopyCodeCopiedLabel : labels.assistantMessageToolbarCopyCodeLabel })
1752
1904
  ]
1753
1905
  }
1754
1906
  )
1755
1907
  ] }),
1756
- /* @__PURE__ */ jsx10(
1908
+ /* @__PURE__ */ jsx12(
1757
1909
  "pre",
1758
1910
  {
1759
1911
  className: cn(
@@ -1766,7 +1918,7 @@ function CopilotChatAssistantMessage({
1766
1918
  )
1767
1919
  ] });
1768
1920
  };
1769
- CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className }) => /* @__PURE__ */ jsx10("div", { className, children: /* @__PURE__ */ jsx10(
1921
+ CopilotChatAssistantMessage2.MarkdownRenderer = ({ content, className }) => /* @__PURE__ */ jsx12("div", { className, children: /* @__PURE__ */ jsx12(
1770
1922
  MarkdownHooks,
1771
1923
  {
1772
1924
  remarkPlugins: [remarkGfm, remarkMath],
@@ -1789,9 +1941,9 @@ function CopilotChatAssistantMessage({
1789
1941
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1790
1942
  code: ({ className: className2, children, ...props }) => {
1791
1943
  if (typeof children === "string") {
1792
- return /* @__PURE__ */ jsx10(InlineCode, { ...props, children });
1944
+ return /* @__PURE__ */ jsx12(InlineCode, { ...props, children });
1793
1945
  }
1794
- return /* @__PURE__ */ jsx10("code", { className: className2, ...props, children });
1946
+ return /* @__PURE__ */ jsx12("code", { className: className2, ...props, children });
1795
1947
  }
1796
1948
  },
1797
1949
  children: completePartialMarkdown(content || "")
@@ -1800,7 +1952,7 @@ function CopilotChatAssistantMessage({
1800
1952
  CopilotChatAssistantMessage2.Toolbar = ({
1801
1953
  className,
1802
1954
  ...props
1803
- }) => /* @__PURE__ */ jsx10(
1955
+ }) => /* @__PURE__ */ jsx12(
1804
1956
  "div",
1805
1957
  {
1806
1958
  className: twMerge4(
@@ -1811,8 +1963,8 @@ function CopilotChatAssistantMessage({
1811
1963
  }
1812
1964
  );
1813
1965
  CopilotChatAssistantMessage2.ToolbarButton = ({ title, children, ...props }) => {
1814
- return /* @__PURE__ */ jsxs4(Tooltip, { children: [
1815
- /* @__PURE__ */ jsx10(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx10(
1966
+ return /* @__PURE__ */ jsxs5(Tooltip, { children: [
1967
+ /* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx12(
1816
1968
  Button,
1817
1969
  {
1818
1970
  type: "button",
@@ -1822,7 +1974,7 @@ function CopilotChatAssistantMessage({
1822
1974
  children
1823
1975
  }
1824
1976
  ) }),
1825
- /* @__PURE__ */ jsx10(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx10("p", { children: title }) })
1977
+ /* @__PURE__ */ jsx12(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx12("p", { children: title }) })
1826
1978
  ] });
1827
1979
  };
1828
1980
  CopilotChatAssistantMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
@@ -1836,62 +1988,62 @@ function CopilotChatAssistantMessage({
1836
1988
  onClick(event);
1837
1989
  }
1838
1990
  };
1839
- return /* @__PURE__ */ jsx10(
1991
+ return /* @__PURE__ */ jsx12(
1840
1992
  CopilotChatAssistantMessage2.ToolbarButton,
1841
1993
  {
1842
1994
  title: title || labels.assistantMessageToolbarCopyMessageLabel,
1843
1995
  onClick: handleClick,
1844
1996
  className,
1845
1997
  ...props,
1846
- children: copied ? /* @__PURE__ */ jsx10(Check2, { className: "size-[18px]" }) : /* @__PURE__ */ jsx10(Copy, { className: "size-[18px]" })
1998
+ children: copied ? /* @__PURE__ */ jsx12(Check2, { className: "size-[18px]" }) : /* @__PURE__ */ jsx12(Copy, { className: "size-[18px]" })
1847
1999
  }
1848
2000
  );
1849
2001
  };
1850
2002
  CopilotChatAssistantMessage2.ThumbsUpButton = ({ title, ...props }) => {
1851
2003
  const config = useCopilotChatConfiguration();
1852
2004
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1853
- return /* @__PURE__ */ jsx10(
2005
+ return /* @__PURE__ */ jsx12(
1854
2006
  CopilotChatAssistantMessage2.ToolbarButton,
1855
2007
  {
1856
2008
  title: title || labels.assistantMessageToolbarThumbsUpLabel,
1857
2009
  ...props,
1858
- children: /* @__PURE__ */ jsx10(ThumbsUp, { className: "size-[18px]" })
2010
+ children: /* @__PURE__ */ jsx12(ThumbsUp, { className: "size-[18px]" })
1859
2011
  }
1860
2012
  );
1861
2013
  };
1862
2014
  CopilotChatAssistantMessage2.ThumbsDownButton = ({ title, ...props }) => {
1863
2015
  const config = useCopilotChatConfiguration();
1864
2016
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1865
- return /* @__PURE__ */ jsx10(
2017
+ return /* @__PURE__ */ jsx12(
1866
2018
  CopilotChatAssistantMessage2.ToolbarButton,
1867
2019
  {
1868
2020
  title: title || labels.assistantMessageToolbarThumbsDownLabel,
1869
2021
  ...props,
1870
- children: /* @__PURE__ */ jsx10(ThumbsDown, { className: "size-[18px]" })
2022
+ children: /* @__PURE__ */ jsx12(ThumbsDown, { className: "size-[18px]" })
1871
2023
  }
1872
2024
  );
1873
2025
  };
1874
2026
  CopilotChatAssistantMessage2.ReadAloudButton = ({ title, ...props }) => {
1875
2027
  const config = useCopilotChatConfiguration();
1876
2028
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1877
- return /* @__PURE__ */ jsx10(
2029
+ return /* @__PURE__ */ jsx12(
1878
2030
  CopilotChatAssistantMessage2.ToolbarButton,
1879
2031
  {
1880
2032
  title: title || labels.assistantMessageToolbarReadAloudLabel,
1881
2033
  ...props,
1882
- children: /* @__PURE__ */ jsx10(Volume2, { className: "size-[20px]" })
2034
+ children: /* @__PURE__ */ jsx12(Volume2, { className: "size-[20px]" })
1883
2035
  }
1884
2036
  );
1885
2037
  };
1886
2038
  CopilotChatAssistantMessage2.RegenerateButton = ({ title, ...props }) => {
1887
2039
  const config = useCopilotChatConfiguration();
1888
2040
  const labels = config?.labels ?? CopilotChatDefaultLabels;
1889
- return /* @__PURE__ */ jsx10(
2041
+ return /* @__PURE__ */ jsx12(
1890
2042
  CopilotChatAssistantMessage2.ToolbarButton,
1891
2043
  {
1892
2044
  title: title || labels.assistantMessageToolbarRegenerateLabel,
1893
2045
  ...props,
1894
- children: /* @__PURE__ */ jsx10(RefreshCw, { className: "size-[18px]" })
2046
+ children: /* @__PURE__ */ jsx12(RefreshCw, { className: "size-[18px]" })
1895
2047
  }
1896
2048
  );
1897
2049
  };
@@ -1909,7 +2061,7 @@ var CopilotChatAssistantMessage_default = CopilotChatAssistantMessage;
1909
2061
  import { useState as useState8 } from "react";
1910
2062
  import { Copy as Copy2, Check as Check3, Edit, ChevronLeft, ChevronRight } from "lucide-react";
1911
2063
  import { twMerge as twMerge5 } from "tailwind-merge";
1912
- import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
2064
+ import { Fragment as Fragment4, jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
1913
2065
  function CopilotChatUserMessage({
1914
2066
  message,
1915
2067
  onEditMessage,
@@ -1967,7 +2119,7 @@ function CopilotChatUserMessage({
1967
2119
  );
1968
2120
  const showBranchNavigation = numberOfBranches && numberOfBranches > 1 && onSwitchToBranch;
1969
2121
  const BoundToolbar = renderSlot(toolbar, CopilotChatUserMessage.Toolbar, {
1970
- children: /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1 justify-end", children: [
2122
+ children: /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-1 justify-end", children: [
1971
2123
  additionalToolbarItems,
1972
2124
  BoundCopyButton,
1973
2125
  onEditMessage && BoundEditButton,
@@ -1975,7 +2127,7 @@ function CopilotChatUserMessage({
1975
2127
  ] })
1976
2128
  });
1977
2129
  if (children) {
1978
- return /* @__PURE__ */ jsx11(Fragment4, { children: children({
2130
+ return /* @__PURE__ */ jsx13(Fragment4, { children: children({
1979
2131
  messageRenderer: BoundMessageRenderer,
1980
2132
  toolbar: BoundToolbar,
1981
2133
  copyButton: BoundCopyButton,
@@ -1987,7 +2139,7 @@ function CopilotChatUserMessage({
1987
2139
  additionalToolbarItems
1988
2140
  }) });
1989
2141
  }
1990
- return /* @__PURE__ */ jsxs5(
2142
+ return /* @__PURE__ */ jsxs6(
1991
2143
  "div",
1992
2144
  {
1993
2145
  className: twMerge5("flex flex-col items-end group pt-10", className),
@@ -2001,7 +2153,7 @@ function CopilotChatUserMessage({
2001
2153
  );
2002
2154
  }
2003
2155
  ((CopilotChatUserMessage2) => {
2004
- CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ jsx11(
2156
+ CopilotChatUserMessage2.Container = ({ children, className, ...props }) => /* @__PURE__ */ jsx13(
2005
2157
  "div",
2006
2158
  {
2007
2159
  className: twMerge5("flex flex-col items-end group", className),
@@ -2009,7 +2161,7 @@ function CopilotChatUserMessage({
2009
2161
  children
2010
2162
  }
2011
2163
  );
2012
- CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ jsx11(
2164
+ CopilotChatUserMessage2.MessageRenderer = ({ content, className }) => /* @__PURE__ */ jsx13(
2013
2165
  "div",
2014
2166
  {
2015
2167
  className: twMerge5(
@@ -2022,7 +2174,7 @@ function CopilotChatUserMessage({
2022
2174
  CopilotChatUserMessage2.Toolbar = ({
2023
2175
  className,
2024
2176
  ...props
2025
- }) => /* @__PURE__ */ jsx11(
2177
+ }) => /* @__PURE__ */ jsx13(
2026
2178
  "div",
2027
2179
  {
2028
2180
  className: twMerge5(
@@ -2033,8 +2185,8 @@ function CopilotChatUserMessage({
2033
2185
  }
2034
2186
  );
2035
2187
  CopilotChatUserMessage2.ToolbarButton = ({ title, children, className, ...props }) => {
2036
- return /* @__PURE__ */ jsxs5(Tooltip, { children: [
2037
- /* @__PURE__ */ jsx11(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx11(
2188
+ return /* @__PURE__ */ jsxs6(Tooltip, { children: [
2189
+ /* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx13(
2038
2190
  Button,
2039
2191
  {
2040
2192
  type: "button",
@@ -2045,7 +2197,7 @@ function CopilotChatUserMessage({
2045
2197
  children
2046
2198
  }
2047
2199
  ) }),
2048
- /* @__PURE__ */ jsx11(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx11("p", { children: title }) })
2200
+ /* @__PURE__ */ jsx13(TooltipContent, { side: "bottom", children: /* @__PURE__ */ jsx13("p", { children: title }) })
2049
2201
  ] });
2050
2202
  };
2051
2203
  CopilotChatUserMessage2.CopyButton = ({ className, title, onClick, ...props }) => {
@@ -2059,27 +2211,27 @@ function CopilotChatUserMessage({
2059
2211
  onClick(event);
2060
2212
  }
2061
2213
  };
2062
- return /* @__PURE__ */ jsx11(
2214
+ return /* @__PURE__ */ jsx13(
2063
2215
  CopilotChatUserMessage2.ToolbarButton,
2064
2216
  {
2065
2217
  title: title || labels.userMessageToolbarCopyMessageLabel,
2066
2218
  onClick: handleClick,
2067
2219
  className,
2068
2220
  ...props,
2069
- children: copied ? /* @__PURE__ */ jsx11(Check3, { className: "size-[18px]" }) : /* @__PURE__ */ jsx11(Copy2, { className: "size-[18px]" })
2221
+ children: copied ? /* @__PURE__ */ jsx13(Check3, { className: "size-[18px]" }) : /* @__PURE__ */ jsx13(Copy2, { className: "size-[18px]" })
2070
2222
  }
2071
2223
  );
2072
2224
  };
2073
2225
  CopilotChatUserMessage2.EditButton = ({ className, title, ...props }) => {
2074
2226
  const config = useCopilotChatConfiguration();
2075
2227
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2076
- return /* @__PURE__ */ jsx11(
2228
+ return /* @__PURE__ */ jsx13(
2077
2229
  CopilotChatUserMessage2.ToolbarButton,
2078
2230
  {
2079
2231
  title: title || labels.userMessageToolbarEditMessageLabel,
2080
2232
  className,
2081
2233
  ...props,
2082
- children: /* @__PURE__ */ jsx11(Edit, { className: "size-[18px]" })
2234
+ children: /* @__PURE__ */ jsx13(Edit, { className: "size-[18px]" })
2083
2235
  }
2084
2236
  );
2085
2237
  };
@@ -2096,8 +2248,8 @@ function CopilotChatUserMessage({
2096
2248
  }
2097
2249
  const canGoPrev = currentBranch > 0;
2098
2250
  const canGoNext = currentBranch < numberOfBranches - 1;
2099
- return /* @__PURE__ */ jsxs5("div", { className: twMerge5("flex items-center gap-1", className), ...props, children: [
2100
- /* @__PURE__ */ jsx11(
2251
+ return /* @__PURE__ */ jsxs6("div", { className: twMerge5("flex items-center gap-1", className), ...props, children: [
2252
+ /* @__PURE__ */ jsx13(
2101
2253
  Button,
2102
2254
  {
2103
2255
  type: "button",
@@ -2109,15 +2261,15 @@ function CopilotChatUserMessage({
2109
2261
  }),
2110
2262
  disabled: !canGoPrev,
2111
2263
  className: "h-6 w-6 p-0",
2112
- children: /* @__PURE__ */ jsx11(ChevronLeft, { className: "size-[20px]" })
2264
+ children: /* @__PURE__ */ jsx13(ChevronLeft, { className: "size-[20px]" })
2113
2265
  }
2114
2266
  ),
2115
- /* @__PURE__ */ jsxs5("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2267
+ /* @__PURE__ */ jsxs6("span", { className: "text-sm text-muted-foreground px-0 font-medium", children: [
2116
2268
  currentBranch + 1,
2117
2269
  "/",
2118
2270
  numberOfBranches
2119
2271
  ] }),
2120
- /* @__PURE__ */ jsx11(
2272
+ /* @__PURE__ */ jsx13(
2121
2273
  Button,
2122
2274
  {
2123
2275
  type: "button",
@@ -2129,7 +2281,7 @@ function CopilotChatUserMessage({
2129
2281
  }),
2130
2282
  disabled: !canGoNext,
2131
2283
  className: "h-6 w-6 p-0",
2132
- children: /* @__PURE__ */ jsx11(ChevronRight, { className: "size-[20px]" })
2284
+ children: /* @__PURE__ */ jsx13(ChevronRight, { className: "size-[20px]" })
2133
2285
  }
2134
2286
  )
2135
2287
  ] });
@@ -2145,14 +2297,14 @@ CopilotChatUserMessage.BranchNavigation.displayName = "CopilotChatUserMessage.Br
2145
2297
  var CopilotChatUserMessage_default = CopilotChatUserMessage;
2146
2298
 
2147
2299
  // src/components/chat/CopilotChatSuggestionPill.tsx
2148
- import React8 from "react";
2300
+ import React9 from "react";
2149
2301
  import { Loader2 } from "lucide-react";
2150
- import { jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
2302
+ import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
2151
2303
  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";
2152
2304
  var labelClasses = "whitespace-nowrap font-medium leading-none";
2153
- var CopilotChatSuggestionPill = React8.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2305
+ var CopilotChatSuggestionPill = React9.forwardRef(function CopilotChatSuggestionPill2({ className, children, icon, isLoading, type, ...props }, ref) {
2154
2306
  const showIcon = !isLoading && icon;
2155
- return /* @__PURE__ */ jsxs6(
2307
+ return /* @__PURE__ */ jsxs7(
2156
2308
  "button",
2157
2309
  {
2158
2310
  ref,
@@ -2163,8 +2315,8 @@ var CopilotChatSuggestionPill = React8.forwardRef(function CopilotChatSuggestion
2163
2315
  disabled: isLoading || props.disabled,
2164
2316
  ...props,
2165
2317
  children: [
2166
- isLoading ? /* @__PURE__ */ jsx12("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx12(Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ jsx12("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: icon }),
2167
- /* @__PURE__ */ jsx12("span", { className: labelClasses, children })
2318
+ isLoading ? /* @__PURE__ */ jsx14("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: /* @__PURE__ */ jsx14(Loader2, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" }) }) : showIcon && /* @__PURE__ */ jsx14("span", { className: "flex h-4 w-4 items-center justify-center text-muted-foreground", children: icon }),
2319
+ /* @__PURE__ */ jsx14("span", { className: labelClasses, children })
2168
2320
  ]
2169
2321
  }
2170
2322
  );
@@ -2173,10 +2325,10 @@ CopilotChatSuggestionPill.displayName = "CopilotChatSuggestionPill";
2173
2325
  var CopilotChatSuggestionPill_default = CopilotChatSuggestionPill;
2174
2326
 
2175
2327
  // src/components/chat/CopilotChatSuggestionView.tsx
2176
- import React9 from "react";
2177
- import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
2178
- var DefaultContainer = React9.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2179
- return /* @__PURE__ */ jsx13(
2328
+ import React10 from "react";
2329
+ import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
2330
+ var DefaultContainer = React10.forwardRef(function DefaultContainer2({ className, ...props }, ref) {
2331
+ return /* @__PURE__ */ jsx15(
2180
2332
  "div",
2181
2333
  {
2182
2334
  ref,
@@ -2188,7 +2340,7 @@ var DefaultContainer = React9.forwardRef(function DefaultContainer2({ className,
2188
2340
  }
2189
2341
  );
2190
2342
  });
2191
- var CopilotChatSuggestionView = React9.forwardRef(function CopilotChatSuggestionView2({
2343
+ var CopilotChatSuggestionView = React10.forwardRef(function CopilotChatSuggestionView2({
2192
2344
  suggestions,
2193
2345
  onSelectSuggestion,
2194
2346
  loadingIndexes,
@@ -2198,7 +2350,7 @@ var CopilotChatSuggestionView = React9.forwardRef(function CopilotChatSuggestion
2198
2350
  children,
2199
2351
  ...restProps
2200
2352
  }, ref) {
2201
- const loadingSet = React9.useMemo(() => {
2353
+ const loadingSet = React10.useMemo(() => {
2202
2354
  if (!loadingIndexes || loadingIndexes.length === 0) {
2203
2355
  return /* @__PURE__ */ new Set();
2204
2356
  }
@@ -2217,11 +2369,11 @@ var CopilotChatSuggestionView = React9.forwardRef(function CopilotChatSuggestion
2217
2369
  type: "button",
2218
2370
  onClick: () => onSelectSuggestion?.(suggestion, index)
2219
2371
  });
2220
- return React9.cloneElement(pill, {
2372
+ return React10.cloneElement(pill, {
2221
2373
  key: `${suggestion.title}-${index}`
2222
2374
  });
2223
2375
  });
2224
- const boundContainer = React9.cloneElement(
2376
+ const boundContainer = React10.cloneElement(
2225
2377
  ContainerElement,
2226
2378
  void 0,
2227
2379
  suggestionElements
@@ -2232,7 +2384,7 @@ var CopilotChatSuggestionView = React9.forwardRef(function CopilotChatSuggestion
2232
2384
  isLoading: suggestions.length > 0 ? loadingSet.has(0) || suggestions[0]?.isLoading === true : false,
2233
2385
  type: "button"
2234
2386
  });
2235
- return /* @__PURE__ */ jsx13(Fragment5, { children: children({
2387
+ return /* @__PURE__ */ jsx15(Fragment5, { children: children({
2236
2388
  container: boundContainer,
2237
2389
  suggestion: sampleSuggestion,
2238
2390
  suggestions,
@@ -2243,7 +2395,7 @@ var CopilotChatSuggestionView = React9.forwardRef(function CopilotChatSuggestion
2243
2395
  }) });
2244
2396
  }
2245
2397
  if (children) {
2246
- return /* @__PURE__ */ jsxs7(Fragment5, { children: [
2398
+ return /* @__PURE__ */ jsxs8(Fragment5, { children: [
2247
2399
  boundContainer,
2248
2400
  children
2249
2401
  ] });
@@ -2255,7 +2407,7 @@ var CopilotChatSuggestionView_default = CopilotChatSuggestionView;
2255
2407
 
2256
2408
  // src/components/chat/CopilotChatMessageView.tsx
2257
2409
  import { twMerge as twMerge6 } from "tailwind-merge";
2258
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
2410
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
2259
2411
  function CopilotChatMessageView({
2260
2412
  messages = [],
2261
2413
  assistantMessage,
@@ -2266,41 +2418,57 @@ function CopilotChatMessageView({
2266
2418
  className,
2267
2419
  ...props
2268
2420
  }) {
2269
- const messageElements = messages.map((message) => {
2421
+ const renderCustomMessage = useRenderCustomMessages();
2422
+ const messageElements = messages.flatMap((message) => {
2423
+ const elements = [];
2424
+ if (renderCustomMessage) {
2425
+ elements.push(
2426
+ renderCustomMessage({
2427
+ message,
2428
+ position: "before"
2429
+ })
2430
+ );
2431
+ }
2270
2432
  if (message.role === "assistant") {
2271
- return renderSlot(assistantMessage, CopilotChatAssistantMessage_default, {
2272
- key: message.id,
2273
- message,
2274
- messages,
2275
- isRunning
2276
- });
2433
+ elements.push(
2434
+ renderSlot(assistantMessage, CopilotChatAssistantMessage_default, {
2435
+ key: message.id,
2436
+ message,
2437
+ messages,
2438
+ isRunning
2439
+ })
2440
+ );
2277
2441
  } else if (message.role === "user") {
2278
- return renderSlot(userMessage, CopilotChatUserMessage_default, {
2279
- key: message.id,
2280
- message
2281
- });
2442
+ elements.push(
2443
+ renderSlot(userMessage, CopilotChatUserMessage_default, {
2444
+ key: message.id,
2445
+ message
2446
+ })
2447
+ );
2282
2448
  }
2283
- return;
2449
+ if (renderCustomMessage) {
2450
+ elements.push(
2451
+ renderCustomMessage({
2452
+ message,
2453
+ position: "after"
2454
+ })
2455
+ );
2456
+ }
2457
+ return elements;
2284
2458
  }).filter(Boolean);
2285
2459
  if (children) {
2286
2460
  return children({ messageElements, messages, isRunning });
2287
2461
  }
2288
- return /* @__PURE__ */ jsxs8("div", { className: twMerge6("flex flex-col", className), ...props, children: [
2462
+ return /* @__PURE__ */ jsxs9("div", { className: twMerge6("flex flex-col", className), ...props, children: [
2289
2463
  messageElements,
2290
2464
  isRunning && renderSlot(cursor, CopilotChatMessageView.Cursor, {})
2291
2465
  ] });
2292
2466
  }
2293
- CopilotChatMessageView.Cursor = function Cursor({
2294
- className,
2295
- ...props
2296
- }) {
2297
- return /* @__PURE__ */ jsx14(
2467
+ CopilotChatMessageView.Cursor = function Cursor({ className, ...props }) {
2468
+ return /* @__PURE__ */ jsx16(
2298
2469
  "div",
2299
2470
  {
2300
- className: twMerge6(
2301
- "w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1",
2302
- className
2303
- ),
2471
+ className: twMerge6("w-[11px] h-[11px] rounded-full bg-foreground animate-pulse-cursor ml-1", className),
2304
2472
  ...props
2305
2473
  }
2306
2474
  );
@@ -2308,11 +2476,11 @@ CopilotChatMessageView.Cursor = function Cursor({
2308
2476
  var CopilotChatMessageView_default = CopilotChatMessageView;
2309
2477
 
2310
2478
  // src/components/chat/CopilotChatView.tsx
2311
- import React10, { useRef as useRef6, useState as useState9, useEffect as useEffect11 } from "react";
2479
+ import React11, { useRef as useRef7, useState as useState9, useEffect as useEffect12 } from "react";
2312
2480
  import { twMerge as twMerge7 } from "tailwind-merge";
2313
2481
  import { StickToBottom, useStickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
2314
2482
  import { ChevronDown } from "lucide-react";
2315
- import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
2483
+ import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
2316
2484
  function CopilotChatView({
2317
2485
  messageView,
2318
2486
  input,
@@ -2333,11 +2501,11 @@ function CopilotChatView({
2333
2501
  className,
2334
2502
  ...props
2335
2503
  }) {
2336
- const inputContainerRef = useRef6(null);
2504
+ const inputContainerRef = useRef7(null);
2337
2505
  const [inputContainerHeight, setInputContainerHeight] = useState9(0);
2338
2506
  const [isResizing, setIsResizing] = useState9(false);
2339
- const resizeTimeoutRef = useRef6(null);
2340
- useEffect11(() => {
2507
+ const resizeTimeoutRef = useRef7(null);
2508
+ useEffect12(() => {
2341
2509
  const element = inputContainerRef.current;
2342
2510
  if (!element) return;
2343
2511
  const resizeObserver = new ResizeObserver((entries) => {
@@ -2389,17 +2557,17 @@ function CopilotChatView({
2389
2557
  scrollToBottomButton,
2390
2558
  inputContainerHeight,
2391
2559
  isResizing,
2392
- children: /* @__PURE__ */ jsx15("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ jsxs9("div", { className: "max-w-3xl mx-auto", children: [
2560
+ children: /* @__PURE__ */ jsx17("div", { style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` }, children: /* @__PURE__ */ jsxs10("div", { className: "max-w-3xl mx-auto", children: [
2393
2561
  BoundMessageView,
2394
- hasSuggestions ? /* @__PURE__ */ jsx15("div", { className: "px-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
2562
+ hasSuggestions ? /* @__PURE__ */ jsx17("div", { className: "px-4 sm:px-0 mt-4", children: BoundSuggestionView }) : null
2395
2563
  ] }) })
2396
2564
  });
2397
2565
  const BoundScrollToBottomButton = renderSlot(scrollToBottomButton, CopilotChatView.ScrollToBottomButton, {});
2398
2566
  const BoundDisclaimer = renderSlot(disclaimer, CopilotChatView.Disclaimer, {});
2399
2567
  const BoundInputContainer = renderSlot(inputContainer, CopilotChatView.InputContainer, {
2400
2568
  ref: inputContainerRef,
2401
- children: /* @__PURE__ */ jsxs9(Fragment6, { children: [
2402
- /* @__PURE__ */ jsx15("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 }),
2569
+ children: /* @__PURE__ */ jsxs10(Fragment6, { children: [
2570
+ /* @__PURE__ */ jsx17("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 }),
2403
2571
  BoundDisclaimer
2404
2572
  ] })
2405
2573
  });
@@ -2412,10 +2580,10 @@ function CopilotChatView({
2412
2580
  feather: BoundFeather,
2413
2581
  inputContainer: BoundInputContainer,
2414
2582
  disclaimer: BoundDisclaimer,
2415
- suggestionView: BoundSuggestionView ?? /* @__PURE__ */ jsx15(Fragment6, {})
2583
+ suggestionView: BoundSuggestionView ?? /* @__PURE__ */ jsx17(Fragment6, {})
2416
2584
  });
2417
2585
  }
2418
- return /* @__PURE__ */ jsxs9("div", { className: twMerge7("relative h-full", className), ...props, children: [
2586
+ return /* @__PURE__ */ jsxs10("div", { className: twMerge7("relative h-full", className), ...props, children: [
2419
2587
  BoundScrollView,
2420
2588
  BoundFeather,
2421
2589
  BoundInputContainer
@@ -2424,9 +2592,9 @@ function CopilotChatView({
2424
2592
  ((CopilotChatView2) => {
2425
2593
  const ScrollContent = ({ children, scrollToBottomButton, inputContainerHeight, isResizing }) => {
2426
2594
  const { isAtBottom, scrollToBottom } = useStickToBottomContext();
2427
- return /* @__PURE__ */ jsxs9(Fragment6, { children: [
2428
- /* @__PURE__ */ jsx15(StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx15("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) }),
2429
- !isAtBottom && !isResizing && /* @__PURE__ */ jsx15(
2595
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
2596
+ /* @__PURE__ */ jsx17(StickToBottom.Content, { className: "overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx17("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) }),
2597
+ !isAtBottom && !isResizing && /* @__PURE__ */ jsx17(
2430
2598
  "div",
2431
2599
  {
2432
2600
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -2452,10 +2620,10 @@ function CopilotChatView({
2452
2620
  const [hasMounted, setHasMounted] = useState9(false);
2453
2621
  const { scrollRef, contentRef, scrollToBottom } = useStickToBottom();
2454
2622
  const [showScrollButton, setShowScrollButton] = useState9(false);
2455
- useEffect11(() => {
2623
+ useEffect12(() => {
2456
2624
  setHasMounted(true);
2457
2625
  }, []);
2458
- useEffect11(() => {
2626
+ useEffect12(() => {
2459
2627
  if (autoScroll) return;
2460
2628
  const scrollElement = scrollRef.current;
2461
2629
  if (!scrollElement) return;
@@ -2473,10 +2641,10 @@ function CopilotChatView({
2473
2641
  };
2474
2642
  }, [scrollRef, autoScroll]);
2475
2643
  if (!hasMounted) {
2476
- return /* @__PURE__ */ jsx15("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx15("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) });
2644
+ return /* @__PURE__ */ jsx17("div", { className: "h-full max-h-full flex flex-col min-h-0 overflow-y-scroll overflow-x-hidden", children: /* @__PURE__ */ jsx17("div", { className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }) });
2477
2645
  }
2478
2646
  if (!autoScroll) {
2479
- return /* @__PURE__ */ jsxs9(
2647
+ return /* @__PURE__ */ jsxs10(
2480
2648
  "div",
2481
2649
  {
2482
2650
  ref: scrollRef,
@@ -2486,8 +2654,8 @@ function CopilotChatView({
2486
2654
  ),
2487
2655
  ...props,
2488
2656
  children: [
2489
- /* @__PURE__ */ jsx15("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }),
2490
- showScrollButton && !isResizing && /* @__PURE__ */ jsx15(
2657
+ /* @__PURE__ */ jsx17("div", { ref: contentRef, className: "px-4 sm:px-0 [div[data-sidebar-chat]_&]:px-8", children }),
2658
+ showScrollButton && !isResizing && /* @__PURE__ */ jsx17(
2491
2659
  "div",
2492
2660
  {
2493
2661
  className: "absolute inset-x-0 flex justify-center z-10 pointer-events-none",
@@ -2503,14 +2671,14 @@ function CopilotChatView({
2503
2671
  }
2504
2672
  );
2505
2673
  }
2506
- return /* @__PURE__ */ jsx15(
2674
+ return /* @__PURE__ */ jsx17(
2507
2675
  StickToBottom,
2508
2676
  {
2509
2677
  className: cn("h-full max-h-full flex flex-col min-h-0 relative", className),
2510
2678
  resize: "smooth",
2511
2679
  initial: "smooth",
2512
2680
  ...props,
2513
- children: /* @__PURE__ */ jsx15(
2681
+ children: /* @__PURE__ */ jsx17(
2514
2682
  ScrollContent,
2515
2683
  {
2516
2684
  scrollToBottomButton,
@@ -2525,7 +2693,7 @@ function CopilotChatView({
2525
2693
  CopilotChatView2.ScrollToBottomButton = ({
2526
2694
  className,
2527
2695
  ...props
2528
- }) => /* @__PURE__ */ jsx15(
2696
+ }) => /* @__PURE__ */ jsx17(
2529
2697
  Button,
2530
2698
  {
2531
2699
  variant: "outline",
@@ -2539,10 +2707,10 @@ function CopilotChatView({
2539
2707
  className
2540
2708
  ),
2541
2709
  ...props,
2542
- children: /* @__PURE__ */ jsx15(ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
2710
+ children: /* @__PURE__ */ jsx17(ChevronDown, { className: "w-4 h-4 text-gray-600 dark:text-white" })
2543
2711
  }
2544
2712
  );
2545
- CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ jsx15(
2713
+ CopilotChatView2.Feather = ({ className, style, ...props }) => /* @__PURE__ */ jsx17(
2546
2714
  "div",
2547
2715
  {
2548
2716
  className: cn(
@@ -2555,12 +2723,12 @@ function CopilotChatView({
2555
2723
  ...props
2556
2724
  }
2557
2725
  );
2558
- CopilotChatView2.InputContainer = React10.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ jsx15("div", { ref, className: cn("absolute bottom-0 left-0 right-0 z-20 pointer-events-none", className), ...props, children }));
2726
+ CopilotChatView2.InputContainer = React11.forwardRef(({ children, className, ...props }, ref) => /* @__PURE__ */ jsx17("div", { ref, className: cn("absolute bottom-0 left-0 right-0 z-20 pointer-events-none", className), ...props, children }));
2559
2727
  CopilotChatView2.InputContainer.displayName = "CopilotChatView.InputContainer";
2560
2728
  CopilotChatView2.Disclaimer = ({ className, ...props }) => {
2561
2729
  const config = useCopilotChatConfiguration();
2562
2730
  const labels = config?.labels ?? CopilotChatDefaultLabels;
2563
- return /* @__PURE__ */ jsx15(
2731
+ return /* @__PURE__ */ jsx17(
2564
2732
  "div",
2565
2733
  {
2566
2734
  className: cn("text-center text-xs text-muted-foreground py-3 px-4 max-w-3xl mx-auto", className),
@@ -2574,10 +2742,10 @@ var CopilotChatView_default = CopilotChatView;
2574
2742
 
2575
2743
  // src/components/chat/CopilotChat.tsx
2576
2744
  import { DEFAULT_AGENT_ID as DEFAULT_AGENT_ID6, randomUUID as randomUUID2 } from "@copilotkitnext/shared";
2577
- import { useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo6 } from "react";
2745
+ import { useCallback as useCallback5, useEffect as useEffect13, useMemo as useMemo6 } from "react";
2578
2746
  import { merge } from "ts-deepmerge";
2579
2747
  import { AGUIConnectNotImplementedError } from "@ag-ui/client";
2580
- import { jsx as jsx16 } from "react/jsx-runtime";
2748
+ import { jsx as jsx18 } from "react/jsx-runtime";
2581
2749
  function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen, ...props }) {
2582
2750
  const existingConfig = useCopilotChatConfiguration();
2583
2751
  const resolvedAgentId = agentId ?? existingConfig?.agentId ?? DEFAULT_AGENT_ID6;
@@ -2594,7 +2762,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2594
2762
  suggestionView: providedSuggestionView,
2595
2763
  ...restProps
2596
2764
  } = props;
2597
- useEffect12(() => {
2765
+ useEffect13(() => {
2598
2766
  const connect = async (agent2) => {
2599
2767
  try {
2600
2768
  await copilotkit.connectAgent({ agent: agent2 });
@@ -2667,7 +2835,7 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2667
2835
  }
2668
2836
  });
2669
2837
  const RenderedChatView = renderSlot(chatView, CopilotChatView, finalProps);
2670
- return /* @__PURE__ */ jsx16(
2838
+ return /* @__PURE__ */ jsx18(
2671
2839
  CopilotChatConfigurationProvider,
2672
2840
  {
2673
2841
  agentId: resolvedAgentId,
@@ -2683,17 +2851,17 @@ function CopilotChat({ agentId, threadId, labels, chatView, isModalDefaultOpen,
2683
2851
  })(CopilotChat || (CopilotChat = {}));
2684
2852
 
2685
2853
  // src/components/chat/CopilotChatToggleButton.tsx
2686
- import React11, { useState as useState10 } from "react";
2854
+ import React12, { useState as useState10 } from "react";
2687
2855
  import { MessageCircle, X as X2 } from "lucide-react";
2688
- import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
2856
+ import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
2689
2857
  var DefaultOpenIcon = ({
2690
2858
  className,
2691
2859
  ...props
2692
- }) => /* @__PURE__ */ jsx17(MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
2860
+ }) => /* @__PURE__ */ jsx19(MessageCircle, { className: cn("h-6 w-6", className), strokeWidth: 1.75, fill: "currentColor", ...props });
2693
2861
  var DefaultCloseIcon = ({
2694
2862
  className,
2695
2863
  ...props
2696
- }) => /* @__PURE__ */ jsx17(X2, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
2864
+ }) => /* @__PURE__ */ jsx19(X2, { className: cn("h-6 w-6", className), strokeWidth: 1.75, ...props });
2697
2865
  DefaultOpenIcon.displayName = "CopilotChatToggleButton.OpenIcon";
2698
2866
  DefaultCloseIcon.displayName = "CopilotChatToggleButton.CloseIcon";
2699
2867
  var ICON_TRANSITION_STYLE = Object.freeze({
@@ -2710,7 +2878,7 @@ var BUTTON_BASE_CLASSES = cn(
2710
2878
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background",
2711
2879
  "disabled:pointer-events-none disabled:opacity-60"
2712
2880
  );
2713
- var CopilotChatToggleButton = React11.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
2881
+ var CopilotChatToggleButton = React12.forwardRef(function CopilotChatToggleButton2({ openIcon, closeIcon, className, ...buttonProps }, ref) {
2714
2882
  const { onClick, type, disabled, ...restProps } = buttonProps;
2715
2883
  const configuration = useCopilotChatConfiguration();
2716
2884
  const labels = configuration?.labels ?? CopilotChatDefaultLabels;
@@ -2748,7 +2916,7 @@ var CopilotChatToggleButton = React11.forwardRef(function CopilotChatToggleButto
2748
2916
  focusable: false
2749
2917
  }
2750
2918
  );
2751
- const openIconElement = /* @__PURE__ */ jsx17(
2919
+ const openIconElement = /* @__PURE__ */ jsx19(
2752
2920
  "span",
2753
2921
  {
2754
2922
  "aria-hidden": "true",
@@ -2762,7 +2930,7 @@ var CopilotChatToggleButton = React11.forwardRef(function CopilotChatToggleButto
2762
2930
  children: renderedOpenIcon
2763
2931
  }
2764
2932
  );
2765
- const closeIconElement = /* @__PURE__ */ jsx17(
2933
+ const closeIconElement = /* @__PURE__ */ jsx19(
2766
2934
  "span",
2767
2935
  {
2768
2936
  "aria-hidden": "true",
@@ -2776,7 +2944,7 @@ var CopilotChatToggleButton = React11.forwardRef(function CopilotChatToggleButto
2776
2944
  children: renderedCloseIcon
2777
2945
  }
2778
2946
  );
2779
- return /* @__PURE__ */ jsxs10(
2947
+ return /* @__PURE__ */ jsxs11(
2780
2948
  "button",
2781
2949
  {
2782
2950
  ref,
@@ -2800,12 +2968,12 @@ CopilotChatToggleButton.displayName = "CopilotChatToggleButton";
2800
2968
  var CopilotChatToggleButton_default = CopilotChatToggleButton;
2801
2969
 
2802
2970
  // src/components/chat/CopilotSidebarView.tsx
2803
- import { useEffect as useEffect13, useRef as useRef7, useState as useState11 } from "react";
2971
+ import { useEffect as useEffect14, useRef as useRef8, useState as useState11 } from "react";
2804
2972
 
2805
2973
  // src/components/chat/CopilotModalHeader.tsx
2806
2974
  import { useCallback as useCallback6 } from "react";
2807
2975
  import { X as X3 } from "lucide-react";
2808
- import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
2976
+ import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
2809
2977
  function CopilotModalHeader({
2810
2978
  title,
2811
2979
  titleContent,
@@ -2834,7 +3002,7 @@ function CopilotModalHeader({
2834
3002
  ...rest
2835
3003
  });
2836
3004
  }
2837
- return /* @__PURE__ */ jsx18(
3005
+ return /* @__PURE__ */ jsx20(
2838
3006
  "header",
2839
3007
  {
2840
3008
  "data-slot": "copilot-modal-header",
@@ -2844,17 +3012,17 @@ function CopilotModalHeader({
2844
3012
  className
2845
3013
  ),
2846
3014
  ...rest,
2847
- children: /* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center gap-2", children: [
2848
- /* @__PURE__ */ jsx18("div", { className: "flex-1", "aria-hidden": "true" }),
2849
- /* @__PURE__ */ jsx18("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
2850
- /* @__PURE__ */ jsx18("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
3015
+ children: /* @__PURE__ */ jsxs12("div", { className: "flex w-full items-center gap-2", children: [
3016
+ /* @__PURE__ */ jsx20("div", { className: "flex-1", "aria-hidden": "true" }),
3017
+ /* @__PURE__ */ jsx20("div", { className: "flex flex-1 justify-center text-center", children: BoundTitle }),
3018
+ /* @__PURE__ */ jsx20("div", { className: "flex flex-1 justify-end", children: BoundCloseButton })
2851
3019
  ] })
2852
3020
  }
2853
3021
  );
2854
3022
  }
2855
3023
  CopilotModalHeader.displayName = "CopilotModalHeader";
2856
3024
  ((CopilotModalHeader2) => {
2857
- CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ jsx18(
3025
+ CopilotModalHeader2.Title = ({ children, className, ...props }) => /* @__PURE__ */ jsx20(
2858
3026
  "div",
2859
3027
  {
2860
3028
  className: cn(
@@ -2868,7 +3036,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
2868
3036
  CopilotModalHeader2.CloseButton = ({
2869
3037
  className,
2870
3038
  ...props
2871
- }) => /* @__PURE__ */ jsx18(
3039
+ }) => /* @__PURE__ */ jsx20(
2872
3040
  "button",
2873
3041
  {
2874
3042
  type: "button",
@@ -2879,7 +3047,7 @@ CopilotModalHeader.displayName = "CopilotModalHeader";
2879
3047
  ),
2880
3048
  "aria-label": "Close",
2881
3049
  ...props,
2882
- children: /* @__PURE__ */ jsx18(X3, { className: "h-4 w-4", "aria-hidden": "true" })
3050
+ children: /* @__PURE__ */ jsx20(X3, { className: "h-4 w-4", "aria-hidden": "true" })
2883
3051
  }
2884
3052
  );
2885
3053
  })(CopilotModalHeader || (CopilotModalHeader = {}));
@@ -2887,13 +3055,13 @@ CopilotModalHeader.Title.displayName = "CopilotModalHeader.Title";
2887
3055
  CopilotModalHeader.CloseButton.displayName = "CopilotModalHeader.CloseButton";
2888
3056
 
2889
3057
  // src/components/chat/CopilotSidebarView.tsx
2890
- import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
3058
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
2891
3059
  var DEFAULT_SIDEBAR_WIDTH = 480;
2892
3060
  var SIDEBAR_TRANSITION_MS = 260;
2893
3061
  function CopilotSidebarView({ header, width, ...props }) {
2894
3062
  const configuration = useCopilotChatConfiguration();
2895
3063
  const isSidebarOpen = configuration?.isModalOpen ?? false;
2896
- const sidebarRef = useRef7(null);
3064
+ const sidebarRef = useRef8(null);
2897
3065
  const [sidebarWidth, setSidebarWidth] = useState11(width ?? DEFAULT_SIDEBAR_WIDTH);
2898
3066
  const widthToCss = (w) => {
2899
3067
  return typeof w === "number" ? `${w}px` : w;
@@ -2904,7 +3072,7 @@ function CopilotSidebarView({ header, width, ...props }) {
2904
3072
  }
2905
3073
  return w;
2906
3074
  };
2907
- useEffect13(() => {
3075
+ useEffect14(() => {
2908
3076
  if (width !== void 0) {
2909
3077
  return;
2910
3078
  }
@@ -2931,8 +3099,8 @@ function CopilotSidebarView({ header, width, ...props }) {
2931
3099
  return () => window.removeEventListener("resize", updateWidth);
2932
3100
  }, [width]);
2933
3101
  const headerElement = renderSlot(header, CopilotModalHeader, {});
2934
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
2935
- isSidebarOpen && /* @__PURE__ */ jsx19(
3102
+ return /* @__PURE__ */ jsxs13(Fragment7, { children: [
3103
+ isSidebarOpen && /* @__PURE__ */ jsx21(
2936
3104
  "style",
2937
3105
  {
2938
3106
  dangerouslySetInnerHTML: {
@@ -2943,8 +3111,8 @@ function CopilotSidebarView({ header, width, ...props }) {
2943
3111
  }
2944
3112
  }
2945
3113
  ),
2946
- /* @__PURE__ */ jsx19(CopilotChatToggleButton_default, {}),
2947
- /* @__PURE__ */ jsx19(
3114
+ /* @__PURE__ */ jsx21(CopilotChatToggleButton_default, {}),
3115
+ /* @__PURE__ */ jsx21(
2948
3116
  "aside",
2949
3117
  {
2950
3118
  ref: sidebarRef,
@@ -2959,9 +3127,9 @@ function CopilotSidebarView({ header, width, ...props }) {
2959
3127
  "aria-hidden": !isSidebarOpen,
2960
3128
  "aria-label": "Copilot chat sidebar",
2961
3129
  role: "complementary",
2962
- children: /* @__PURE__ */ jsxs12("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
3130
+ children: /* @__PURE__ */ jsxs13("div", { className: "flex h-full w-full flex-col overflow-hidden", children: [
2963
3131
  headerElement,
2964
- /* @__PURE__ */ jsx19("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ jsx19(CopilotChatView_default, { ...props }) })
3132
+ /* @__PURE__ */ jsx21("div", { className: "flex-1 overflow-hidden", "data-sidebar-chat": true, children: /* @__PURE__ */ jsx21(CopilotChatView_default, { ...props }) })
2965
3133
  ] })
2966
3134
  }
2967
3135
  )
@@ -2971,12 +3139,12 @@ CopilotSidebarView.displayName = "CopilotSidebarView";
2971
3139
 
2972
3140
  // src/components/chat/CopilotSidebar.tsx
2973
3141
  import { useMemo as useMemo7 } from "react";
2974
- import { jsx as jsx20 } from "react/jsx-runtime";
3142
+ import { jsx as jsx22 } from "react/jsx-runtime";
2975
3143
  function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
2976
3144
  const SidebarViewOverride = useMemo7(() => {
2977
3145
  const Component = (viewProps) => {
2978
3146
  const { header: viewHeader, width: viewWidth, ...restProps } = viewProps;
2979
- return /* @__PURE__ */ jsx20(
3147
+ return /* @__PURE__ */ jsx22(
2980
3148
  CopilotSidebarView,
2981
3149
  {
2982
3150
  ...restProps,
@@ -2987,7 +3155,7 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
2987
3155
  };
2988
3156
  return Object.assign(Component, CopilotChatView_default);
2989
3157
  }, [header, width]);
2990
- return /* @__PURE__ */ jsx20(
3158
+ return /* @__PURE__ */ jsx22(
2991
3159
  CopilotChat,
2992
3160
  {
2993
3161
  ...chatProps,
@@ -2998,9 +3166,9 @@ function CopilotSidebar({ header, defaultOpen, width, ...chatProps }) {
2998
3166
  }
2999
3167
  CopilotSidebar.displayName = "CopilotSidebar";
3000
3168
 
3001
- // src/types/defineToolCallRender.ts
3169
+ // src/types/defineToolCallRenderer.ts
3002
3170
  import { z as z2 } from "zod";
3003
- function defineToolCallRender(def) {
3171
+ function defineToolCallRenderer(def) {
3004
3172
  const argsSchema = def.name === "*" && !def.args ? z2.any() : def.args;
3005
3173
  return {
3006
3174
  name: def.name,
@@ -3012,8 +3180,8 @@ function defineToolCallRender(def) {
3012
3180
 
3013
3181
  // src/components/WildcardToolCallRender.tsx
3014
3182
  import { useState as useState12 } from "react";
3015
- import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
3016
- var WildcardToolCallRender = defineToolCallRender({
3183
+ import { jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
3184
+ var WildcardToolCallRender = defineToolCallRenderer({
3017
3185
  name: "*",
3018
3186
  render: ({ args, result, name, status }) => {
3019
3187
  const [isExpanded, setIsExpanded] = useState12(false);
@@ -3021,15 +3189,15 @@ var WildcardToolCallRender = defineToolCallRender({
3021
3189
  const isActive = statusString === "inProgress" || statusString === "executing";
3022
3190
  const isComplete = statusString === "complete";
3023
3191
  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";
3024
- return /* @__PURE__ */ jsx21("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs13("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: [
3025
- /* @__PURE__ */ jsxs13(
3192
+ return /* @__PURE__ */ jsx23("div", { className: "mt-2 pb-2", children: /* @__PURE__ */ jsxs14("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: [
3193
+ /* @__PURE__ */ jsxs14(
3026
3194
  "div",
3027
3195
  {
3028
3196
  className: "flex items-center justify-between gap-3 cursor-pointer",
3029
3197
  onClick: () => setIsExpanded(!isExpanded),
3030
3198
  children: [
3031
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 min-w-0", children: [
3032
- /* @__PURE__ */ jsx21(
3199
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 min-w-0", children: [
3200
+ /* @__PURE__ */ jsx23(
3033
3201
  "svg",
3034
3202
  {
3035
3203
  className: `h-4 w-4 text-zinc-500 dark:text-zinc-400 transition-transform ${isExpanded ? "rotate-90" : ""}`,
@@ -3037,7 +3205,7 @@ var WildcardToolCallRender = defineToolCallRender({
3037
3205
  viewBox: "0 0 24 24",
3038
3206
  strokeWidth: 2,
3039
3207
  stroke: "currentColor",
3040
- children: /* @__PURE__ */ jsx21(
3208
+ children: /* @__PURE__ */ jsx23(
3041
3209
  "path",
3042
3210
  {
3043
3211
  strokeLinecap: "round",
@@ -3047,10 +3215,10 @@ var WildcardToolCallRender = defineToolCallRender({
3047
3215
  )
3048
3216
  }
3049
3217
  ),
3050
- /* @__PURE__ */ jsx21("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3051
- /* @__PURE__ */ jsx21("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3218
+ /* @__PURE__ */ jsx23("span", { className: "inline-block h-2 w-2 rounded-full bg-blue-500" }),
3219
+ /* @__PURE__ */ jsx23("span", { className: "truncate text-sm font-medium text-zinc-900 dark:text-zinc-100", children: name })
3052
3220
  ] }),
3053
- /* @__PURE__ */ jsx21(
3221
+ /* @__PURE__ */ jsx23(
3054
3222
  "span",
3055
3223
  {
3056
3224
  className: `inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ${statusStyles}`,
@@ -3060,14 +3228,14 @@ var WildcardToolCallRender = defineToolCallRender({
3060
3228
  ]
3061
3229
  }
3062
3230
  ),
3063
- isExpanded && /* @__PURE__ */ jsxs13("div", { className: "mt-3 grid gap-4", children: [
3064
- /* @__PURE__ */ jsxs13("div", { children: [
3065
- /* @__PURE__ */ jsx21("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3066
- /* @__PURE__ */ jsx21("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) })
3231
+ isExpanded && /* @__PURE__ */ jsxs14("div", { className: "mt-3 grid gap-4", children: [
3232
+ /* @__PURE__ */ jsxs14("div", { children: [
3233
+ /* @__PURE__ */ jsx23("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Arguments" }),
3234
+ /* @__PURE__ */ jsx23("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) })
3067
3235
  ] }),
3068
- result !== void 0 && /* @__PURE__ */ jsxs13("div", { children: [
3069
- /* @__PURE__ */ jsx21("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3070
- /* @__PURE__ */ jsx21("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) })
3236
+ result !== void 0 && /* @__PURE__ */ jsxs14("div", { children: [
3237
+ /* @__PURE__ */ jsx23("div", { className: "text-xs uppercase tracking-wide text-zinc-500 dark:text-zinc-400", children: "Result" }),
3238
+ /* @__PURE__ */ jsx23("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) })
3071
3239
  ] })
3072
3240
  ] })
3073
3241
  ] }) });
@@ -3089,12 +3257,14 @@ export {
3089
3257
  CopilotChatToolCallsView_default as CopilotChatToolCallsView,
3090
3258
  CopilotChatUserMessage_default as CopilotChatUserMessage,
3091
3259
  CopilotChatView_default as CopilotChatView,
3260
+ CopilotKitCoreReact,
3092
3261
  CopilotKitProvider,
3093
3262
  CopilotModalHeader,
3094
3263
  CopilotSidebar,
3095
3264
  CopilotSidebarView,
3265
+ WebInspector,
3096
3266
  WildcardToolCallRender,
3097
- defineToolCallRender,
3267
+ defineToolCallRenderer,
3098
3268
  useAgent,
3099
3269
  useAgentContext,
3100
3270
  useConfigureSuggestions,
@@ -3102,6 +3272,7 @@ export {
3102
3272
  useCopilotKit,
3103
3273
  useFrontendTool,
3104
3274
  useHumanInTheLoop,
3275
+ useRenderCustomMessages,
3105
3276
  useRenderToolCall,
3106
3277
  useSuggestions
3107
3278
  };