@copilotkit/react-core 1.84.2-canary.1793807121 → 1.84.2-canary.1793809041
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/{copilotkit-CP8oYU3L.cjs → copilotkit-BhV8iuX5.cjs} +30 -9
- package/dist/{copilotkit-CP8oYU3L.cjs.map → copilotkit-BhV8iuX5.cjs.map} +1 -1
- package/dist/copilotkit-CFqSAotl.d.mts.map +1 -1
- package/dist/copilotkit-OVo9Xjmp.d.cts.map +1 -1
- package/dist/{copilotkit-CdZ3W0B2.mjs → copilotkit-dNtiaQqU.mjs} +30 -9
- package/dist/{copilotkit-CdZ3W0B2.mjs.map → copilotkit-dNtiaQqU.mjs.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/v2/generative-ui.d.cts +4 -4
- package/dist/v2/generative-ui.d.mts +4 -4
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +29 -8
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +8 -8
|
@@ -1325,7 +1325,7 @@ function useRenderToolCall() {
|
|
|
1325
1325
|
|
|
1326
1326
|
//#endregion
|
|
1327
1327
|
//#region package.json
|
|
1328
|
-
var version = "1.84.2-canary.
|
|
1328
|
+
var version = "1.84.2-canary.1793809041";
|
|
1329
1329
|
|
|
1330
1330
|
//#endregion
|
|
1331
1331
|
//#region src/v2/components/CopilotKitInspector.tsx
|
|
@@ -10411,6 +10411,7 @@ function messageGroup(group) {
|
|
|
10411
10411
|
};
|
|
10412
10412
|
}
|
|
10413
10413
|
const GROUP_ROW_KEY_PREFIX = "copilotkit-group:";
|
|
10414
|
+
const MESSAGE_ROW_KEY_PREFIX = "copilotkit-message:";
|
|
10414
10415
|
const VIRTUALIZE_THRESHOLD = 50;
|
|
10415
10416
|
function CopilotChatMessageView({ messages = [], assistantMessage, userMessage, reasoningMessage, cursor, intelligenceIndicator, workSummary, isRunning = false, transformMessages, groupMessages, messageFeedback = true, toolCallDisplay = "grouped", children, className, ...props }) {
|
|
10416
10417
|
const isPinnedToBottom = (0, react.useContext)(ScrollPinnedContext);
|
|
@@ -10584,6 +10585,14 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10584
10585
|
(0, _copilotkit_shared.commitRowKeyStore)(rowKeyStore, renderedMessages);
|
|
10585
10586
|
}, [rowKeyStore, renderedMessages]);
|
|
10586
10587
|
const stableGroupKey = (key) => rowRenderKeys.get(key) ?? key;
|
|
10588
|
+
const rowKey = (row) => row.type === "group" ? `${GROUP_ROW_KEY_PREFIX}${stableGroupKey(row.key)}` : `${MESSAGE_ROW_KEY_PREFIX}${rowRenderKeys.get(row.message.id) ?? row.message.id}`;
|
|
10589
|
+
const previousRowKeysRef = (0, react.useRef)([]);
|
|
10590
|
+
const rowKeys = (0, react.useMemo)(() => {
|
|
10591
|
+
const next = rows.map(rowKey);
|
|
10592
|
+
const previous = previousRowKeysRef.current;
|
|
10593
|
+
return next.length === previous.length && next.every((key, index) => key === previous[index]) ? previous : next;
|
|
10594
|
+
}, [rows, rowRenderKeys]);
|
|
10595
|
+
previousRowKeysRef.current = rowKeys;
|
|
10587
10596
|
const groupStateRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
10588
10597
|
const groupSettersRef = (0, react.useRef)(/* @__PURE__ */ new Map());
|
|
10589
10598
|
const groupStateThreadRef = (0, react.useRef)(config?.threadId);
|
|
@@ -10669,6 +10678,8 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10669
10678
|
total: 0,
|
|
10670
10679
|
sizes: /* @__PURE__ */ new Map()
|
|
10671
10680
|
});
|
|
10681
|
+
const rowKeysRef = react.default.useRef(rowKeys);
|
|
10682
|
+
rowKeysRef.current = rowKeys;
|
|
10672
10683
|
const resizeAnchorRef = react.default.useRef(null);
|
|
10673
10684
|
const restoringVisibilityRef = react.default.useRef(false);
|
|
10674
10685
|
const firstMessageId = deduplicatedMessages[0]?.id;
|
|
@@ -10681,10 +10692,21 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10681
10692
|
sizes: /* @__PURE__ */ new Map()
|
|
10682
10693
|
};
|
|
10683
10694
|
}
|
|
10695
|
+
const measuredKeysRef = react.default.useRef(rowKeys);
|
|
10696
|
+
if (measuredKeysRef.current !== rowKeys) {
|
|
10697
|
+
measuredKeysRef.current = rowKeys;
|
|
10698
|
+
const live = new Set(rowKeys);
|
|
10699
|
+
const measured = measuredRef.current;
|
|
10700
|
+
for (const [key, height] of measured.sizes) if (!live.has(key)) {
|
|
10701
|
+
measured.sizes.delete(key);
|
|
10702
|
+
measured.total -= height;
|
|
10703
|
+
}
|
|
10704
|
+
}
|
|
10684
10705
|
const estimateRowSize = react.default.useCallback(() => {
|
|
10685
10706
|
const { total, sizes } = measuredRef.current;
|
|
10686
10707
|
return sizes.size > 0 ? Math.max(1, Math.round(total / sizes.size)) : 100;
|
|
10687
10708
|
}, []);
|
|
10709
|
+
const getRowKey = react.default.useCallback((index) => rowKeys[index] ?? index, [rowKeys]);
|
|
10688
10710
|
const isPinnedToBottomRef = react.default.useRef(isPinnedToBottom);
|
|
10689
10711
|
const measuredWidthRef = react.default.useRef(null);
|
|
10690
10712
|
const captureResizeAnchor = react.default.useCallback((instance) => {
|
|
@@ -10709,12 +10731,13 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10709
10731
|
captureResizeAnchor(instance);
|
|
10710
10732
|
const height = el?.getBoundingClientRect().height ?? 0;
|
|
10711
10733
|
const index = Number(el?.dataset?.index);
|
|
10712
|
-
|
|
10734
|
+
const key = Number.isInteger(index) ? rowKeysRef.current[index] : void 0;
|
|
10735
|
+
if (height > 0 && key !== void 0) {
|
|
10713
10736
|
const { total, sizes } = measuredRef.current;
|
|
10714
|
-
measuredRef.current.total = total - (sizes.get(
|
|
10715
|
-
sizes.set(
|
|
10737
|
+
measuredRef.current.total = total - (sizes.get(key) ?? 0) + height;
|
|
10738
|
+
sizes.set(key, height);
|
|
10716
10739
|
}
|
|
10717
|
-
return height > 0 ? height : measuredRef.current.sizes.get(
|
|
10740
|
+
return height > 0 ? height : (key === void 0 ? void 0 : measuredRef.current.sizes.get(key)) ?? 100;
|
|
10718
10741
|
}, [captureResizeAnchor]);
|
|
10719
10742
|
const shouldAdjustScrollOnResize = react.default.useCallback((item, _delta, instance) => {
|
|
10720
10743
|
if (isPinnedToBottomRef.current || resizeAnchorRef.current || restoringVisibilityRef.current) return false;
|
|
@@ -10780,6 +10803,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10780
10803
|
getScrollElement: () => shouldVirtualize ? scrollElement : null,
|
|
10781
10804
|
observeElementRect: observeScrollRect,
|
|
10782
10805
|
estimateSize: estimateRowSize,
|
|
10806
|
+
getItemKey: getRowKey,
|
|
10783
10807
|
overscan: 5,
|
|
10784
10808
|
measureElement: measureRowElement,
|
|
10785
10809
|
initialRect: {
|
|
@@ -10867,7 +10891,6 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10867
10891
|
}, `intelligence-${intelligenceTurnId}`));
|
|
10868
10892
|
return elements.filter(Boolean);
|
|
10869
10893
|
};
|
|
10870
|
-
const rowKey = (row) => row.type === "group" ? `${GROUP_ROW_KEY_PREFIX}${stableGroupKey(row.key)}` : rowRenderKeys.get(row.message.id) ?? row.message.id;
|
|
10871
10894
|
const renderRow = (row) => {
|
|
10872
10895
|
if (row.type === "message") return renderMessageBlock(row.message);
|
|
10873
10896
|
const Wrapper = row.wrapper;
|
|
@@ -10880,8 +10903,6 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
10880
10903
|
children: row.messages.flatMap(renderMessageBlock)
|
|
10881
10904
|
}, rowKey(row))];
|
|
10882
10905
|
};
|
|
10883
|
-
const rowKeysRef = (0, react.useRef)([]);
|
|
10884
|
-
rowKeysRef.current = rows.map(rowKey);
|
|
10885
10906
|
const virtualModeRef = (0, react.useRef)(shouldVirtualize);
|
|
10886
10907
|
virtualModeRef.current = shouldVirtualize;
|
|
10887
10908
|
(0, react.useEffect)(() => {
|
|
@@ -16533,4 +16554,4 @@ Object.defineProperty(exports, 'useToast', {
|
|
|
16533
16554
|
return useToast;
|
|
16534
16555
|
}
|
|
16535
16556
|
});
|
|
16536
|
-
//# sourceMappingURL=copilotkit-
|
|
16557
|
+
//# sourceMappingURL=copilotkit-BhV8iuX5.cjs.map
|