@copilotkit/react-core 2.0.0-rc.15 → 2.0.0-rc.17
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.cjs +39 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +23 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +39 -9
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +39 -9
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -1924,7 +1924,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
1924
1924
|
|
|
1925
1925
|
//#endregion
|
|
1926
1926
|
//#region package.json
|
|
1927
|
-
var version$1 = "2.0.0-rc.
|
|
1927
|
+
var version$1 = "2.0.0-rc.17";
|
|
1928
1928
|
|
|
1929
1929
|
//#endregion
|
|
1930
1930
|
//#region src/components/CopilotKitInspector.tsx
|
|
@@ -3544,7 +3544,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3544
3544
|
* includeCatalog: true,
|
|
3545
3545
|
* contextSent: false,
|
|
3546
3546
|
* });
|
|
3547
|
-
* envelope["
|
|
3547
|
+
* envelope["1.0"].supportedCatalogIds; // [runtime.ui.id]
|
|
3548
3548
|
* ```
|
|
3549
3549
|
*/
|
|
3550
3550
|
function buildGenerativeUIEnvelope(runtime, threadId, options) {
|
|
@@ -3553,7 +3553,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
3553
3553
|
const instructions = options.instructions ?? (transport === "markdown" ? (0, _copilotkit_shared.buildGenerativeUIMarkdownGuidelines)((0, _copilotkit_shared.generativeUIGuideFeatures)(manifest)) : void 0);
|
|
3554
3554
|
const omitComponents = transport === "markdown" && !includeCatalog;
|
|
3555
3555
|
return {
|
|
3556
|
-
"
|
|
3556
|
+
"1.0": {
|
|
3557
3557
|
supportedCatalogIds: manifest.catalogIds ?? [manifest.catalogId],
|
|
3558
3558
|
inlineCatalogs: [{
|
|
3559
3559
|
catalogId: manifest.catalogId,
|
|
@@ -14227,6 +14227,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14227
14227
|
const lastNonceRef = (0, react.useRef)(-1);
|
|
14228
14228
|
(0, react.useEffect)(() => {
|
|
14229
14229
|
if (sendNonce === lastNonceRef.current) return;
|
|
14230
|
+
const previousNonce = lastNonceRef.current;
|
|
14230
14231
|
lastNonceRef.current = sendNonce;
|
|
14231
14232
|
if (!id) return;
|
|
14232
14233
|
const scrollEl = scrollRef.current;
|
|
@@ -14242,7 +14243,9 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14242
14243
|
const bubbleHeight = Math.max(0, userMessageHeight - paddingTop);
|
|
14243
14244
|
const spacerHeight = Math.max(0, viewportHeight - bubbleHeight - topOffset);
|
|
14244
14245
|
spacerEl.style.height = `${spacerHeight}px`;
|
|
14246
|
+
let pinned = false;
|
|
14245
14247
|
const raf = requestAnimationFrame(() => {
|
|
14248
|
+
pinned = true;
|
|
14246
14249
|
const targetTop = computeOffsetTop(targetEl, scrollEl) + paddingTop - topOffset;
|
|
14247
14250
|
scrollEl.scrollTo({
|
|
14248
14251
|
top: Math.max(0, targetTop),
|
|
@@ -14259,6 +14262,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14259
14262
|
return () => {
|
|
14260
14263
|
cancelAnimationFrame(raf);
|
|
14261
14264
|
ro.disconnect();
|
|
14265
|
+
if (!pinned) lastNonceRef.current = previousNonce;
|
|
14262
14266
|
};
|
|
14263
14267
|
}, [
|
|
14264
14268
|
id,
|
|
@@ -14294,7 +14298,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14294
14298
|
})
|
|
14295
14299
|
});
|
|
14296
14300
|
}
|
|
14297
|
-
function CopilotChatView({ messageView, input, scrollView, suggestionView, welcomeScreen, messages = [], autoScroll = true, isRunning = false, suggestions, suggestionLoadingIndexes, onSelectSuggestion, onSubmitMessage, onStop, inputMode, inputValue, onInputChange, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, attachments, onRemoveAttachment, onAddFile, dragOver, onDragOver, onDragLeave, onDrop, isConnecting = false, hasExplicitThreadId = false, intelligenceIndicator, children, className, ...props }) {
|
|
14301
|
+
function CopilotChatView({ messageView, input, scrollView, suggestionView, welcomeScreen, messages = [], autoScroll = true, isRunning = false, suggestions, suggestionLoadingIndexes, onSelectSuggestion, onSubmitMessage, onStop, inputMode, inputValue, onInputChange, onStartTranscribe, onCancelTranscribe, onFinishTranscribe, onFinishTranscribeWithAudio, attachments, onRemoveAttachment, onAddFile, dragOver, onDragOver, onDragLeave, onDrop, isConnecting = false, connectingIndicator, hasExplicitThreadId = false, intelligenceIndicator, children, className, ...props }) {
|
|
14298
14302
|
const configuredThreadId = useCopilotChatConfiguration()?.threadId;
|
|
14299
14303
|
const [fallbackThreadId, setFallbackThreadId] = (0, react.useState)(messages[0]?.id);
|
|
14300
14304
|
const previousMessageIds = (0, react.useRef)(/* @__PURE__ */ new Set());
|
|
@@ -14369,6 +14373,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14369
14373
|
onSelectSuggestion,
|
|
14370
14374
|
className: "cpk-chat-view-suggestion-view"
|
|
14371
14375
|
}) : null;
|
|
14376
|
+
const BoundConnectingIndicator = isConnecting && messages.length === 0 && connectingIndicator !== false ? renderSlot(connectingIndicator === true ? void 0 : connectingIndicator, CopilotChatView.ConnectingIndicator, {}) : null;
|
|
14372
14377
|
const BoundScrollView = renderSlot(scrollView, CopilotChatView.ScrollView, {
|
|
14373
14378
|
autoScroll,
|
|
14374
14379
|
scrollThreadId,
|
|
@@ -14379,10 +14384,14 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14379
14384
|
style: { paddingBottom: `${inputContainerHeight + (hasSuggestions ? 4 : 32)}px` },
|
|
14380
14385
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14381
14386
|
className: "cpk-chat-view-feed",
|
|
14382
|
-
children: [
|
|
14383
|
-
|
|
14384
|
-
|
|
14385
|
-
|
|
14387
|
+
children: [
|
|
14388
|
+
BoundConnectingIndicator,
|
|
14389
|
+
BoundMessageView,
|
|
14390
|
+
hasSuggestions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14391
|
+
className: "cpk-chat-view-suggestions",
|
|
14392
|
+
children: BoundSuggestionView
|
|
14393
|
+
}) : null
|
|
14394
|
+
]
|
|
14386
14395
|
})
|
|
14387
14396
|
})
|
|
14388
14397
|
});
|
|
@@ -14419,6 +14428,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14419
14428
|
"data-copilotkit": true,
|
|
14420
14429
|
"data-testid": "copilot-chat",
|
|
14421
14430
|
"data-copilot-running": isRunning ? "true" : "false",
|
|
14431
|
+
"data-copilot-connecting": isConnecting ? "true" : "false",
|
|
14422
14432
|
onDragOver,
|
|
14423
14433
|
onDragLeave,
|
|
14424
14434
|
onDrop,
|
|
@@ -14429,6 +14439,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14429
14439
|
}
|
|
14430
14440
|
if (children) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14431
14441
|
"data-copilotkit": true,
|
|
14442
|
+
"data-copilot-connecting": isConnecting ? "true" : "false",
|
|
14432
14443
|
style: { display: "contents" },
|
|
14433
14444
|
children: children({
|
|
14434
14445
|
messageView: BoundMessageView,
|
|
@@ -14441,6 +14452,7 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14441
14452
|
"data-copilotkit": true,
|
|
14442
14453
|
"data-testid": "copilot-chat",
|
|
14443
14454
|
"data-copilot-running": isRunning ? "true" : "false",
|
|
14455
|
+
"data-copilot-connecting": isConnecting ? "true" : "false",
|
|
14444
14456
|
onDragOver,
|
|
14445
14457
|
onDragLeave,
|
|
14446
14458
|
onDrop,
|
|
@@ -14656,13 +14668,15 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14656
14668
|
if (mode === "pin-to-bottom") return;
|
|
14657
14669
|
const scrollElement = nonAutoScrollEl;
|
|
14658
14670
|
if (!scrollElement) return;
|
|
14671
|
+
const contentElement = contentRef.current;
|
|
14659
14672
|
const checkScroll = () => {
|
|
14660
|
-
setShowScrollButton(
|
|
14673
|
+
setShowScrollButton((contentElement ? contentElement.getBoundingClientRect().bottom - scrollElement.getBoundingClientRect().bottom : scrollElement.scrollHeight - scrollElement.scrollTop - scrollElement.clientHeight) >= 10);
|
|
14661
14674
|
};
|
|
14662
14675
|
checkScroll();
|
|
14663
14676
|
scrollElement.addEventListener("scroll", checkScroll);
|
|
14664
14677
|
const resizeObserver = new ResizeObserver(checkScroll);
|
|
14665
14678
|
resizeObserver.observe(scrollElement);
|
|
14679
|
+
if (contentElement) resizeObserver.observe(contentElement);
|
|
14666
14680
|
return () => {
|
|
14667
14681
|
scrollElement.removeEventListener("scroll", checkScroll);
|
|
14668
14682
|
resizeObserver.disconnect();
|
|
@@ -14748,6 +14762,22 @@ _radix_ui_react_popover = __toESM(_radix_ui_react_popover);
|
|
|
14748
14762
|
className,
|
|
14749
14763
|
...props
|
|
14750
14764
|
});
|
|
14765
|
+
_CopilotChatView.ConnectingIndicator = ({ className, ...props }) => {
|
|
14766
|
+
const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
14767
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14768
|
+
"data-testid": "copilot-connecting-indicator",
|
|
14769
|
+
role: "status",
|
|
14770
|
+
className: cn("cpk-chat-view-connecting-indicator", className),
|
|
14771
|
+
...props,
|
|
14772
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopilotIcon, {
|
|
14773
|
+
name: "Loader2",
|
|
14774
|
+
className: "cpk-chat-view-connecting-spinner"
|
|
14775
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
14776
|
+
className: "cpk-chat-view-connecting-label",
|
|
14777
|
+
children: labels.chatConnectingLabel
|
|
14778
|
+
})]
|
|
14779
|
+
});
|
|
14780
|
+
};
|
|
14751
14781
|
_CopilotChatView.WelcomeMessage = ({ className, ...props }) => {
|
|
14752
14782
|
const labels = useCopilotChatConfiguration()?.labels ?? _copilotkit_core.CopilotChatDefaultLabels;
|
|
14753
14783
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|