@yourgpt/copilot-sdk 2.1.5-alpha.7 → 2.1.6
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/{chunk-UZHGMDOK.js → chunk-2JNH3T6H.js} +35 -6
- package/dist/chunk-2JNH3T6H.js.map +1 -0
- package/dist/{chunk-NPBOKT63.cjs → chunk-6ZTITCKU.cjs} +35 -6
- package/dist/chunk-6ZTITCKU.cjs.map +1 -0
- package/dist/{chunk-M66XAHSW.cjs → chunk-HIVSXIER.cjs} +16 -16
- package/dist/{chunk-M66XAHSW.cjs.map → chunk-HIVSXIER.cjs.map} +1 -1
- package/dist/{chunk-YHW6JZEF.js → chunk-SMNZHZM7.js} +3 -3
- package/dist/{chunk-YHW6JZEF.js.map → chunk-SMNZHZM7.js.map} +1 -1
- package/dist/experimental/index.cjs +2 -2
- package/dist/experimental/index.js +1 -1
- package/dist/react/index.cjs +62 -62
- package/dist/react/index.d.cts +15 -0
- package/dist/react/index.d.ts +15 -0
- package/dist/react/index.js +2 -2
- package/dist/styles.css +26 -0
- package/dist/ui/index.cjs +89 -20
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +3 -1
- package/dist/ui/index.d.ts +3 -1
- package/dist/ui/index.js +86 -17
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-NPBOKT63.cjs.map +0 -1
- package/dist/chunk-UZHGMDOK.js.map +0 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -1468,6 +1468,8 @@ type ChatProps = {
|
|
|
1468
1468
|
onStop?: () => void;
|
|
1469
1469
|
/** Whether AI is currently generating */
|
|
1470
1470
|
isLoading?: boolean;
|
|
1471
|
+
/** Current error from the AI (shown as a dismissible banner above the input) */
|
|
1472
|
+
error?: Error | null;
|
|
1471
1473
|
/**
|
|
1472
1474
|
* Children for compound component pattern.
|
|
1473
1475
|
* Use Chat.Home, Chat.Input, Chat.Suggestions as children for custom home screens.
|
|
@@ -1922,7 +1924,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1922
1924
|
*/
|
|
1923
1925
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1924
1926
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1925
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1927
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, error, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1926
1928
|
/**
|
|
1927
1929
|
* Chat component with compound component pattern.
|
|
1928
1930
|
*
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1468,6 +1468,8 @@ type ChatProps = {
|
|
|
1468
1468
|
onStop?: () => void;
|
|
1469
1469
|
/** Whether AI is currently generating */
|
|
1470
1470
|
isLoading?: boolean;
|
|
1471
|
+
/** Current error from the AI (shown as a dismissible banner above the input) */
|
|
1472
|
+
error?: Error | null;
|
|
1471
1473
|
/**
|
|
1472
1474
|
* Children for compound component pattern.
|
|
1473
1475
|
* Use Chat.Home, Chat.Input, Chat.Suggestions as children for custom home screens.
|
|
@@ -1922,7 +1924,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1922
1924
|
*/
|
|
1923
1925
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1924
1926
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1925
|
-
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1927
|
+
declare function ChatComponent({ messages, onSendMessage, onStop, isLoading, error, children, placeholder, welcomeMessage, title, showHeader, header, threadPicker, logo, name, onClose, showPoweredBy, showUserAvatar, userAvatar: userAvatarProp, assistantAvatar: assistantAvatarProp, loaderVariant, fontSize, maxFileSize, allowedFileTypes, attachmentsEnabled, attachmentsDisabledTooltip, upload: uploadProp, processAttachment: deprecatedProcessAttachment, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, wrapMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1926
1928
|
/**
|
|
1927
1929
|
* Chat component with compound component pattern.
|
|
1928
1930
|
*
|
package/dist/ui/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useThreadManager } from '../chunk-
|
|
1
|
+
import { useThreadManager } from '../chunk-SMNZHZM7.js';
|
|
2
2
|
import { DEFAULT_MCP_UI_SANDBOX, parseMCPUIMessage } from '../chunk-G4SF2PNQ.js';
|
|
3
3
|
import { cn, Loader, TextShimmerLoader } from '../chunk-TXQ37MAO.js';
|
|
4
4
|
export { Loader, cn } from '../chunk-TXQ37MAO.js';
|
|
5
|
-
import { useCopilot } from '../chunk-
|
|
5
|
+
import { useCopilot } from '../chunk-2JNH3T6H.js';
|
|
6
6
|
import { createLocalStorageAdapter, createServerAdapter } from '../chunk-J5D3AZF6.js';
|
|
7
7
|
import '../chunk-EWVQWTNV.js';
|
|
8
8
|
import '../chunk-VNLLW3ZI.js';
|
|
@@ -3334,12 +3334,8 @@ function PopoverContent({
|
|
|
3334
3334
|
Popover$1.Popup,
|
|
3335
3335
|
{
|
|
3336
3336
|
className: cn(
|
|
3337
|
+
"csdk-popover-popup",
|
|
3337
3338
|
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",
|
|
3338
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
3339
|
-
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
3340
|
-
"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
|
3341
|
-
"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2",
|
|
3342
|
-
"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
3343
3339
|
className
|
|
3344
3340
|
),
|
|
3345
3341
|
children
|
|
@@ -3474,24 +3470,25 @@ function ThreadPicker({
|
|
|
3474
3470
|
setDisplayedThreads((prev) => prev.filter((t) => t.id !== threadId));
|
|
3475
3471
|
onDeleteThread?.(threadId);
|
|
3476
3472
|
};
|
|
3477
|
-
return /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
3473
|
+
return /* @__PURE__ */ jsx("div", { className: cn("relative w-44", className), children: /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
3478
3474
|
/* @__PURE__ */ jsxs(
|
|
3479
3475
|
PopoverTrigger,
|
|
3480
3476
|
{
|
|
3481
3477
|
disabled: disabled || loading,
|
|
3482
3478
|
className: cn(
|
|
3483
|
-
"flex items-center gap-1 w-full",
|
|
3484
|
-
|
|
3485
|
-
|
|
3479
|
+
"flex items-center gap-1.5 w-full rounded-md px-1.5 py-0.5",
|
|
3480
|
+
"hover:bg-muted/70 transition-colors duration-150",
|
|
3481
|
+
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
3482
|
+
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
3486
3483
|
buttonClassName
|
|
3487
3484
|
),
|
|
3488
3485
|
children: [
|
|
3489
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-xs ", children: loading ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Loading..." }) : selectedThread ? /* @__PURE__ */ jsx("span", { className: "truncate font-medium text-muted-foreground
|
|
3486
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-xs min-w-0 flex-1", children: loading ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground truncate", children: "Loading..." }) : selectedThread ? /* @__PURE__ */ jsx("span", { className: "truncate font-medium text-muted-foreground", children: selectedThread.title || "Untitled conversation" }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/70 truncate", children: placeholder }) }),
|
|
3490
3487
|
/* @__PURE__ */ jsx(
|
|
3491
3488
|
ChevronIcon,
|
|
3492
3489
|
{
|
|
3493
3490
|
className: cn(
|
|
3494
|
-
"flex-shrink-0 size-3 text-muted-foreground transition-transform",
|
|
3491
|
+
"flex-shrink-0 size-3 text-muted-foreground/60 transition-transform duration-150",
|
|
3495
3492
|
isOpen && "rotate-180"
|
|
3496
3493
|
)
|
|
3497
3494
|
}
|
|
@@ -3504,7 +3501,7 @@ function ThreadPicker({
|
|
|
3504
3501
|
{
|
|
3505
3502
|
align: "start",
|
|
3506
3503
|
className: cn(
|
|
3507
|
-
"
|
|
3504
|
+
"p-0 w-56 max-h-[280px] overflow-auto",
|
|
3508
3505
|
dropdownClassName
|
|
3509
3506
|
),
|
|
3510
3507
|
children: [
|
|
@@ -3576,7 +3573,7 @@ function ThreadPicker({
|
|
|
3576
3573
|
]
|
|
3577
3574
|
}
|
|
3578
3575
|
)
|
|
3579
|
-
] });
|
|
3576
|
+
] }) });
|
|
3580
3577
|
}
|
|
3581
3578
|
function formatDate3(date) {
|
|
3582
3579
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -5876,6 +5873,7 @@ function ChatComponent({
|
|
|
5876
5873
|
onSendMessage,
|
|
5877
5874
|
onStop,
|
|
5878
5875
|
isLoading = false,
|
|
5876
|
+
error,
|
|
5879
5877
|
// Compound children
|
|
5880
5878
|
children,
|
|
5881
5879
|
// Labels
|
|
@@ -5954,6 +5952,15 @@ function ChatComponent({
|
|
|
5954
5952
|
const [input, setInput] = useState("");
|
|
5955
5953
|
const [pendingAttachments, setPendingAttachments] = useState([]);
|
|
5956
5954
|
const [isDragging, setIsDragging] = useState(false);
|
|
5955
|
+
const [isDismissed, setIsDismissed] = useState(false);
|
|
5956
|
+
const [displayedError, setDisplayedError] = useState(null);
|
|
5957
|
+
React19__default.useEffect(() => {
|
|
5958
|
+
if (error) {
|
|
5959
|
+
setDisplayedError(error);
|
|
5960
|
+
setIsDismissed(false);
|
|
5961
|
+
}
|
|
5962
|
+
}, [error]);
|
|
5963
|
+
const showErrorBanner = !!error && !isDismissed;
|
|
5957
5964
|
const fileInputRef = useRef(null);
|
|
5958
5965
|
const fileInputId = useId();
|
|
5959
5966
|
const isFileTypeAllowed = useCallback(
|
|
@@ -6044,7 +6051,7 @@ function ChatComponent({
|
|
|
6044
6051
|
(att) => att.id === id ? { ...att, status: "ready", attachment } : att
|
|
6045
6052
|
)
|
|
6046
6053
|
);
|
|
6047
|
-
} catch (
|
|
6054
|
+
} catch (error2) {
|
|
6048
6055
|
setPendingAttachments(
|
|
6049
6056
|
(prev) => prev.map(
|
|
6050
6057
|
(att) => att.id === id ? {
|
|
@@ -6383,6 +6390,66 @@ function ChatComponent({
|
|
|
6383
6390
|
className: classNames.suggestions
|
|
6384
6391
|
}
|
|
6385
6392
|
),
|
|
6393
|
+
displayedError && /* @__PURE__ */ jsx(
|
|
6394
|
+
"div",
|
|
6395
|
+
{
|
|
6396
|
+
className: cn(
|
|
6397
|
+
"mx-2 mb-1 overflow-hidden transition-all duration-200 ease-in-out",
|
|
6398
|
+
showErrorBanner ? "max-h-20 opacity-100" : "max-h-0 opacity-0 mb-0"
|
|
6399
|
+
),
|
|
6400
|
+
onTransitionEnd: () => {
|
|
6401
|
+
if (!showErrorBanner) setDisplayedError(null);
|
|
6402
|
+
},
|
|
6403
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive", children: [
|
|
6404
|
+
/* @__PURE__ */ jsx(
|
|
6405
|
+
"svg",
|
|
6406
|
+
{
|
|
6407
|
+
className: "mt-0.5 h-3.5 w-3.5 flex-shrink-0",
|
|
6408
|
+
fill: "none",
|
|
6409
|
+
viewBox: "0 0 24 24",
|
|
6410
|
+
stroke: "currentColor",
|
|
6411
|
+
strokeWidth: 2,
|
|
6412
|
+
children: /* @__PURE__ */ jsx(
|
|
6413
|
+
"path",
|
|
6414
|
+
{
|
|
6415
|
+
strokeLinecap: "round",
|
|
6416
|
+
strokeLinejoin: "round",
|
|
6417
|
+
d: "M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"
|
|
6418
|
+
}
|
|
6419
|
+
)
|
|
6420
|
+
}
|
|
6421
|
+
),
|
|
6422
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 leading-relaxed", children: displayedError.message }),
|
|
6423
|
+
/* @__PURE__ */ jsx(
|
|
6424
|
+
"button",
|
|
6425
|
+
{
|
|
6426
|
+
type: "button",
|
|
6427
|
+
onClick: () => setIsDismissed(true),
|
|
6428
|
+
className: "flex-shrink-0 opacity-60 hover:opacity-100",
|
|
6429
|
+
"aria-label": "Dismiss error",
|
|
6430
|
+
children: /* @__PURE__ */ jsx(
|
|
6431
|
+
"svg",
|
|
6432
|
+
{
|
|
6433
|
+
className: "h-3 w-3",
|
|
6434
|
+
fill: "none",
|
|
6435
|
+
viewBox: "0 0 24 24",
|
|
6436
|
+
stroke: "currentColor",
|
|
6437
|
+
strokeWidth: 2,
|
|
6438
|
+
children: /* @__PURE__ */ jsx(
|
|
6439
|
+
"path",
|
|
6440
|
+
{
|
|
6441
|
+
strokeLinecap: "round",
|
|
6442
|
+
strokeLinejoin: "round",
|
|
6443
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
6444
|
+
}
|
|
6445
|
+
)
|
|
6446
|
+
}
|
|
6447
|
+
)
|
|
6448
|
+
}
|
|
6449
|
+
)
|
|
6450
|
+
] })
|
|
6451
|
+
}
|
|
6452
|
+
),
|
|
6386
6453
|
renderInput ? renderInput() : /* @__PURE__ */ jsxs("div", { className: cn("p-2 pt-0", classNames.input), children: [
|
|
6387
6454
|
pendingAttachments.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 p-2 mb-2 bg-muted/30 rounded-lg", children: pendingAttachments.map((att) => /* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
6388
6455
|
att.attachment.type === "image" ? /* @__PURE__ */ jsx(
|
|
@@ -7040,7 +7107,8 @@ function CopilotChatBase(props) {
|
|
|
7040
7107
|
registeredTools,
|
|
7041
7108
|
switchBranch,
|
|
7042
7109
|
getBranchInfo,
|
|
7043
|
-
editMessage
|
|
7110
|
+
editMessage,
|
|
7111
|
+
error: chatError
|
|
7044
7112
|
} = useCopilot();
|
|
7045
7113
|
const toolExecutions = rawToolExecutions.map(
|
|
7046
7114
|
(exec) => ({
|
|
@@ -7232,6 +7300,7 @@ function CopilotChatBase(props) {
|
|
|
7232
7300
|
onSendMessage: sendMessage,
|
|
7233
7301
|
onStop: stop,
|
|
7234
7302
|
isLoading,
|
|
7303
|
+
error: chatError,
|
|
7235
7304
|
showPoweredBy: chatProps.showPoweredBy ?? true,
|
|
7236
7305
|
suggestions,
|
|
7237
7306
|
isProcessing: isProcessingToolResults,
|