@yourgpt/copilot-sdk 2.1.5-alpha.1 → 2.1.5-alpha.3
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-4QXY2PBG.js → chunk-3AONOZLY.js} +2 -2
- package/dist/{chunk-4QXY2PBG.js.map → chunk-3AONOZLY.js.map} +1 -1
- package/dist/{chunk-JKGFQUHJ.cjs → chunk-MDS23G2S.cjs} +5 -5
- package/dist/{chunk-JKGFQUHJ.cjs.map → chunk-MDS23G2S.cjs.map} +1 -1
- package/dist/{chunk-5Q72LZ5H.js → chunk-PT2TOHG5.js} +7 -3
- package/dist/chunk-PT2TOHG5.js.map +1 -0
- package/dist/{chunk-ENFWM3EY.js → chunk-RKGRQRZU.js} +3 -3
- package/dist/{chunk-ENFWM3EY.js.map → chunk-RKGRQRZU.js.map} +1 -1
- package/dist/{chunk-IXWNDR7H.cjs → chunk-TCPAT3WG.cjs} +35 -31
- package/dist/chunk-TCPAT3WG.cjs.map +1 -0
- package/dist/{chunk-246B6X5D.cjs → chunk-TPB7XED6.cjs} +2 -2
- package/dist/{chunk-246B6X5D.cjs.map → chunk-TPB7XED6.cjs.map} +1 -1
- package/dist/{chunk-I3SQUNTT.cjs → chunk-WIXFZUEZ.cjs} +23 -23
- package/dist/{chunk-I3SQUNTT.cjs.map → chunk-WIXFZUEZ.cjs.map} +1 -1
- package/dist/{chunk-UXJ6LIZB.js → chunk-WZ2TOZ7M.js} +4 -4
- package/dist/{chunk-UXJ6LIZB.js.map → chunk-WZ2TOZ7M.js.map} +1 -1
- package/dist/core/index.cjs +82 -82
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +3 -3
- package/dist/{index-CiExk87c.d.cts → index-CzJB8Ddo.d.cts} +1 -1
- package/dist/{index-Dwrcf-CP.d.ts → index-D7169xuR.d.ts} +1 -1
- package/dist/mcp/index.d.cts +3 -3
- package/dist/mcp/index.d.ts +3 -3
- package/dist/react/index.cjs +65 -65
- package/dist/react/index.d.cts +8 -4
- package/dist/react/index.d.ts +8 -4
- package/dist/react/index.js +4 -4
- package/dist/styles.css +43 -0
- package/dist/tools/anthropic/index.d.cts +1 -1
- package/dist/tools/anthropic/index.d.ts +1 -1
- package/dist/tools/brave/index.cjs +2 -2
- package/dist/tools/brave/index.d.cts +1 -1
- package/dist/tools/brave/index.d.ts +1 -1
- package/dist/tools/brave/index.js +1 -1
- package/dist/tools/exa/index.cjs +2 -2
- package/dist/tools/exa/index.d.cts +1 -1
- package/dist/tools/exa/index.d.ts +1 -1
- package/dist/tools/exa/index.js +1 -1
- package/dist/tools/google/index.cjs +2 -2
- package/dist/tools/google/index.d.cts +1 -1
- package/dist/tools/google/index.d.ts +1 -1
- package/dist/tools/google/index.js +1 -1
- package/dist/tools/openai/index.cjs +2 -2
- package/dist/tools/openai/index.d.cts +1 -1
- package/dist/tools/openai/index.d.ts +1 -1
- package/dist/tools/openai/index.js +1 -1
- package/dist/tools/searxng/index.cjs +2 -2
- package/dist/tools/searxng/index.d.cts +1 -1
- package/dist/tools/searxng/index.d.ts +1 -1
- package/dist/tools/searxng/index.js +1 -1
- package/dist/tools/serper/index.cjs +2 -2
- package/dist/tools/serper/index.d.cts +1 -1
- package/dist/tools/serper/index.d.ts +1 -1
- package/dist/tools/serper/index.js +1 -1
- package/dist/tools/tavily/index.cjs +2 -2
- package/dist/tools/tavily/index.d.cts +1 -1
- package/dist/tools/tavily/index.d.ts +1 -1
- package/dist/tools/tavily/index.js +1 -1
- package/dist/tools/web-search/index.cjs +3 -3
- package/dist/tools/web-search/index.d.cts +2 -2
- package/dist/tools/web-search/index.d.ts +2 -2
- package/dist/tools/web-search/index.js +2 -2
- package/dist/{tools-DHZhF5km.d.cts → tools-tmksfhUo.d.cts} +9 -0
- package/dist/{tools-DHZhF5km.d.ts → tools-tmksfhUo.d.ts} +9 -0
- package/dist/{types-BdX7uPj0.d.cts → types-BLw7mxtW.d.cts} +1 -1
- package/dist/{types-BTyJu0WD.d.ts → types-BqwW3Baj.d.ts} +1 -1
- package/dist/ui/index.cjs +798 -417
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +337 -108
- package/dist/ui/index.d.ts +337 -108
- package/dist/ui/index.js +745 -365
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-5Q72LZ5H.js.map +0 -1
- package/dist/chunk-IXWNDR7H.cjs.map +0 -1
package/dist/ui/index.d.cts
CHANGED
|
@@ -8,62 +8,11 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
8
8
|
import * as use_stick_to_bottom from 'use-stick-to-bottom';
|
|
9
9
|
import { d as WebSearchResult, f as WebSearchResponse } from '../types-ZguuKEs_.cjs';
|
|
10
10
|
import { a as Thread, c as ThreadStorageAdapter, A as AsyncThreadStorageAdapter } from '../types-BeFBBZ5i.cjs';
|
|
11
|
-
import { T as ToolDefinition } from '../tools-
|
|
11
|
+
import { T as ToolDefinition } from '../tools-tmksfhUo.cjs';
|
|
12
12
|
import { B as BranchInfo } from '../MessageTree-CoIt_4nB.cjs';
|
|
13
13
|
import { d as MCPUIIntent, n as MCPUIFrameProps, M as MCPUIResource } from '../types-B20VCJXL.cjs';
|
|
14
14
|
import { ClassValue } from 'clsx';
|
|
15
15
|
|
|
16
|
-
interface LoaderProps {
|
|
17
|
-
variant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
18
|
-
size?: "sm" | "md" | "lg";
|
|
19
|
-
text?: string;
|
|
20
|
-
className?: string;
|
|
21
|
-
}
|
|
22
|
-
declare function Loader({ variant, size, text, className, }: LoaderProps): react_jsx_runtime.JSX.Element;
|
|
23
|
-
|
|
24
|
-
type MarkdownProps = {
|
|
25
|
-
children: string;
|
|
26
|
-
id?: string;
|
|
27
|
-
className?: string;
|
|
28
|
-
isStreaming?: boolean;
|
|
29
|
-
/** Link safety modal configuration. Disabled by default. */
|
|
30
|
-
linkSafety?: LinkSafetyConfig;
|
|
31
|
-
};
|
|
32
|
-
declare function MarkdownComponent({ children, className, isStreaming, linkSafety, }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
33
|
-
declare const Markdown: React$1.MemoExoticComponent<typeof MarkdownComponent>;
|
|
34
|
-
|
|
35
|
-
type CodeBlockProps = {
|
|
36
|
-
children?: React__default.ReactNode;
|
|
37
|
-
className?: string;
|
|
38
|
-
} & React__default.HTMLProps<HTMLDivElement>;
|
|
39
|
-
declare function CodeBlock({ children, className, ...props }: CodeBlockProps): react_jsx_runtime.JSX.Element;
|
|
40
|
-
|
|
41
|
-
declare const buttonVariants: (props?: ({
|
|
42
|
-
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
43
|
-
size?: "sm" | "lg" | "default" | "icon" | null | undefined;
|
|
44
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
45
|
-
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
46
|
-
asChild?: boolean;
|
|
47
|
-
}
|
|
48
|
-
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
49
|
-
|
|
50
|
-
type FeedbackBarProps = {
|
|
51
|
-
className?: string;
|
|
52
|
-
title?: string;
|
|
53
|
-
icon?: React.ReactNode;
|
|
54
|
-
onHelpful?: () => void;
|
|
55
|
-
onNotHelpful?: () => void;
|
|
56
|
-
onClose?: () => void;
|
|
57
|
-
};
|
|
58
|
-
declare function FeedbackBar({ className, title, icon, onHelpful, onNotHelpful, onClose, }: FeedbackBarProps): react_jsx_runtime.JSX.Element;
|
|
59
|
-
|
|
60
|
-
type ScrollButtonProps = {
|
|
61
|
-
className?: string;
|
|
62
|
-
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
63
|
-
size?: VariantProps<typeof buttonVariants>["size"];
|
|
64
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
65
|
-
declare function ScrollButton({ className, variant, size, ...props }: ScrollButtonProps): react_jsx_runtime.JSX.Element;
|
|
66
|
-
|
|
67
16
|
type TooltipProviderProps = {
|
|
68
17
|
children: React__default.ReactNode;
|
|
69
18
|
delayDuration?: number;
|
|
@@ -92,6 +41,17 @@ type TooltipContentProps = {
|
|
|
92
41
|
};
|
|
93
42
|
declare function TooltipContent({ children, className, side, align, sideOffset, showArrow, }: TooltipContentProps): react_jsx_runtime.JSX.Element;
|
|
94
43
|
|
|
44
|
+
type MarkdownProps = {
|
|
45
|
+
children: string;
|
|
46
|
+
id?: string;
|
|
47
|
+
className?: string;
|
|
48
|
+
isStreaming?: boolean;
|
|
49
|
+
/** Link safety modal configuration. Disabled by default. */
|
|
50
|
+
linkSafety?: LinkSafetyConfig;
|
|
51
|
+
};
|
|
52
|
+
declare function MarkdownComponent({ children, className, isStreaming, linkSafety, }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
53
|
+
declare const Markdown: React$1.MemoExoticComponent<typeof MarkdownComponent>;
|
|
54
|
+
|
|
95
55
|
type MessageProps = {
|
|
96
56
|
children: React.ReactNode;
|
|
97
57
|
className?: string;
|
|
@@ -120,6 +80,56 @@ type MessageContentProps = {
|
|
|
120
80
|
size?: "sm" | "base" | "lg";
|
|
121
81
|
} & React.ComponentProps<typeof Markdown> & Omit<React.HTMLProps<HTMLDivElement>, "size">;
|
|
122
82
|
declare const MessageContent: ({ children, markdown, className, size, ...props }: MessageContentProps) => react_jsx_runtime.JSX.Element;
|
|
83
|
+
type MessageActionsProps$1 = {
|
|
84
|
+
children: React.ReactNode;
|
|
85
|
+
className?: string;
|
|
86
|
+
} & React.HTMLProps<HTMLDivElement>;
|
|
87
|
+
type MessageActionProps = {
|
|
88
|
+
className?: string;
|
|
89
|
+
tooltip: React.ReactNode;
|
|
90
|
+
children: React.ReactNode;
|
|
91
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
92
|
+
} & React.ComponentProps<typeof Tooltip>;
|
|
93
|
+
|
|
94
|
+
interface LoaderProps {
|
|
95
|
+
variant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
96
|
+
size?: "sm" | "md" | "lg";
|
|
97
|
+
text?: string;
|
|
98
|
+
className?: string;
|
|
99
|
+
}
|
|
100
|
+
declare function Loader({ variant, size, text, className, }: LoaderProps): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
102
|
+
type CodeBlockProps = {
|
|
103
|
+
children?: React__default.ReactNode;
|
|
104
|
+
className?: string;
|
|
105
|
+
} & React__default.HTMLProps<HTMLDivElement>;
|
|
106
|
+
declare function CodeBlock({ children, className, ...props }: CodeBlockProps): react_jsx_runtime.JSX.Element;
|
|
107
|
+
|
|
108
|
+
declare const buttonVariants: (props?: ({
|
|
109
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
110
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
111
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
112
|
+
interface ButtonProps extends React$1.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
113
|
+
asChild?: boolean;
|
|
114
|
+
}
|
|
115
|
+
declare const Button: React$1.ForwardRefExoticComponent<ButtonProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
116
|
+
|
|
117
|
+
type FeedbackBarProps = {
|
|
118
|
+
className?: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
icon?: React.ReactNode;
|
|
121
|
+
onHelpful?: () => void;
|
|
122
|
+
onNotHelpful?: () => void;
|
|
123
|
+
onClose?: () => void;
|
|
124
|
+
};
|
|
125
|
+
declare function FeedbackBar({ className, title, icon, onHelpful, onNotHelpful, onClose, }: FeedbackBarProps): react_jsx_runtime.JSX.Element;
|
|
126
|
+
|
|
127
|
+
type ScrollButtonProps = {
|
|
128
|
+
className?: string;
|
|
129
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
130
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
131
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
132
|
+
declare function ScrollButton({ className, variant, size, ...props }: ScrollButtonProps): react_jsx_runtime.JSX.Element;
|
|
123
133
|
|
|
124
134
|
declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
125
135
|
|
|
@@ -742,83 +752,30 @@ interface SimpleConfirmationProps {
|
|
|
742
752
|
*/
|
|
743
753
|
declare function SimpleConfirmation({ state, message, onApprove, onReject, rejectLabel, approveLabel, className, }: SimpleConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
744
754
|
|
|
745
|
-
/**
|
|
746
|
-
* Permission level for tool execution
|
|
747
|
-
*/
|
|
748
755
|
type PermissionLevel = "ask" | "allow_always" | "deny_always" | "session";
|
|
749
|
-
/**
|
|
750
|
-
* Permission option for dropdown/selection
|
|
751
|
-
*/
|
|
752
756
|
interface PermissionOption {
|
|
753
757
|
value: PermissionLevel;
|
|
754
758
|
label: string;
|
|
755
759
|
description?: string;
|
|
756
760
|
}
|
|
757
|
-
/**
|
|
758
|
-
* Default permission options
|
|
759
|
-
*/
|
|
760
761
|
declare const DEFAULT_PERMISSION_OPTIONS: PermissionOption[];
|
|
761
762
|
type ConfirmationState = "pending" | "approved" | "rejected";
|
|
762
763
|
interface PermissionConfirmationProps {
|
|
763
|
-
/** Current state: pending, approved, or rejected */
|
|
764
764
|
state: ConfirmationState;
|
|
765
|
-
/** Tool name */
|
|
766
765
|
toolName?: string;
|
|
767
|
-
/** Message to display */
|
|
768
766
|
message?: string;
|
|
769
|
-
/** Called when user approves with permission level */
|
|
770
767
|
onApprove?: (permissionLevel: PermissionLevel) => void;
|
|
771
|
-
/** Called when user rejects with permission level */
|
|
772
768
|
onReject?: (permissionLevel?: PermissionLevel) => void;
|
|
773
|
-
/** Show permission options (default: true) */
|
|
774
|
-
showPermissionOptions?: boolean;
|
|
775
|
-
/** Available permission options */
|
|
776
|
-
permissionOptions?: PermissionOption[];
|
|
777
|
-
/** Additional class name */
|
|
778
769
|
className?: string;
|
|
779
770
|
}
|
|
780
|
-
|
|
781
|
-
* PermissionConfirmation - Enhanced confirmation with permission level selection
|
|
782
|
-
*
|
|
783
|
-
* Shows a confirmation dialog for tool approval with options to remember the choice.
|
|
784
|
-
*
|
|
785
|
-
* @example
|
|
786
|
-
* ```tsx
|
|
787
|
-
* <PermissionConfirmation
|
|
788
|
-
* state="pending"
|
|
789
|
-
* toolName="capture_screenshot"
|
|
790
|
-
* message="Take a screenshot of the current screen?"
|
|
791
|
-
* onApprove={(level) => approveToolExecution(tool.id, level)}
|
|
792
|
-
* onReject={(level) => rejectToolExecution(tool.id, undefined, level)}
|
|
793
|
-
* />
|
|
794
|
-
* ```
|
|
795
|
-
*/
|
|
796
|
-
declare function PermissionConfirmation({ state, toolName, message, onApprove, onReject, showPermissionOptions, permissionOptions, className, }: PermissionConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
771
|
+
declare function PermissionConfirmation({ state, toolName, message, onApprove, onReject, className, }: PermissionConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
797
772
|
interface CompactPermissionConfirmationProps {
|
|
798
|
-
/** Current state: pending, approved, or rejected */
|
|
799
773
|
state: ConfirmationState;
|
|
800
|
-
/** Message to display */
|
|
801
774
|
message?: string;
|
|
802
|
-
/** Called when user approves */
|
|
803
775
|
onApprove?: (permissionLevel: PermissionLevel) => void;
|
|
804
|
-
/** Called when user rejects */
|
|
805
776
|
onReject?: (permissionLevel?: PermissionLevel) => void;
|
|
806
|
-
/** Additional class name */
|
|
807
777
|
className?: string;
|
|
808
778
|
}
|
|
809
|
-
/**
|
|
810
|
-
* CompactPermissionConfirmation - Simpler version with "Don't ask again" checkbox
|
|
811
|
-
*
|
|
812
|
-
* @example
|
|
813
|
-
* ```tsx
|
|
814
|
-
* <CompactPermissionConfirmation
|
|
815
|
-
* state="pending"
|
|
816
|
-
* message="Take a screenshot?"
|
|
817
|
-
* onApprove={(level) => approveToolExecution(tool.id, level)}
|
|
818
|
-
* onReject={(level) => rejectToolExecution(tool.id, undefined, level)}
|
|
819
|
-
* />
|
|
820
|
-
* ```
|
|
821
|
-
*/
|
|
822
779
|
declare function CompactPermissionConfirmation({ state, message, onApprove, onReject, className, }: CompactPermissionConfirmationProps): react_jsx_runtime.JSX.Element;
|
|
823
780
|
|
|
824
781
|
type FollowUpProps = {
|
|
@@ -1299,6 +1256,8 @@ interface ToolExecutionData {
|
|
|
1299
1256
|
duration?: number;
|
|
1300
1257
|
/** Approval status for human-in-the-loop tools */
|
|
1301
1258
|
approvalStatus?: ToolApprovalStatus;
|
|
1259
|
+
/** Title shown in approval UI */
|
|
1260
|
+
approvalTitle?: string;
|
|
1302
1261
|
/** Message shown in approval UI */
|
|
1303
1262
|
approvalMessage?: string;
|
|
1304
1263
|
/** Data passed from user's approval action (e.g., selected item) */
|
|
@@ -1440,6 +1399,10 @@ interface ToolRendererProps {
|
|
|
1440
1399
|
error?: string;
|
|
1441
1400
|
/** Approval status for tools requiring confirmation */
|
|
1442
1401
|
approvalStatus?: ToolApprovalStatus;
|
|
1402
|
+
/** Title shown in approval UI */
|
|
1403
|
+
approvalTitle?: string;
|
|
1404
|
+
/** Message shown in approval UI */
|
|
1405
|
+
approvalMessage?: string;
|
|
1443
1406
|
/** Data passed from user's approval action */
|
|
1444
1407
|
approvalData?: Record<string, unknown>;
|
|
1445
1408
|
/** Tool source (mcp, native, custom) - useful for MCP tool identification */
|
|
@@ -1659,6 +1622,37 @@ type ChatProps = {
|
|
|
1659
1622
|
onApproveToolExecution?: (executionId: string, extraData?: Record<string, unknown>, permissionLevel?: PermissionLevel) => void;
|
|
1660
1623
|
/** Called when user rejects a tool execution */
|
|
1661
1624
|
onRejectToolExecution?: (executionId: string, reason?: string, permissionLevel?: PermissionLevel) => void;
|
|
1625
|
+
/**
|
|
1626
|
+
* Custom message list view.
|
|
1627
|
+
* Gives full control over how the message list is rendered.
|
|
1628
|
+
* Receives pre-rendered `messageElements` (default SDK output) and raw `messages`
|
|
1629
|
+
* so you can inject custom UI, reorder, or conditionally replace messages.
|
|
1630
|
+
*
|
|
1631
|
+
* @example
|
|
1632
|
+
* ```tsx
|
|
1633
|
+
* <CopilotChat
|
|
1634
|
+
* messageView={{
|
|
1635
|
+
* children: ({ messageElements, messages }) => (
|
|
1636
|
+
* <>
|
|
1637
|
+
* {messages.map((msg, i) =>
|
|
1638
|
+
* msg.metadata?.type === "plan"
|
|
1639
|
+
* ? <PlanCard key={msg.id} data={msg.metadata} />
|
|
1640
|
+
* : messageElements[i]
|
|
1641
|
+
* )}
|
|
1642
|
+
* </>
|
|
1643
|
+
* )
|
|
1644
|
+
* }}
|
|
1645
|
+
* />
|
|
1646
|
+
* ```
|
|
1647
|
+
*/
|
|
1648
|
+
messageView?: {
|
|
1649
|
+
children?: (props: {
|
|
1650
|
+
/** Raw messages array */
|
|
1651
|
+
messages: ChatMessage[];
|
|
1652
|
+
/** Pre-rendered message elements (default SDK rendering) */
|
|
1653
|
+
messageElements: React__default.ReactNode[];
|
|
1654
|
+
}) => React__default.ReactNode;
|
|
1655
|
+
};
|
|
1662
1656
|
/** Custom message renderer */
|
|
1663
1657
|
renderMessage?: (message: ChatMessage, index: number) => React__default.ReactNode;
|
|
1664
1658
|
/** Custom input renderer (replaces entire input area) */
|
|
@@ -1717,6 +1711,76 @@ type ChatProps = {
|
|
|
1717
1711
|
onEditMessage?: (messageId: string, newContent: string) => void;
|
|
1718
1712
|
};
|
|
1719
1713
|
|
|
1714
|
+
interface CopyActionProps {
|
|
1715
|
+
tooltip?: string;
|
|
1716
|
+
className?: string;
|
|
1717
|
+
}
|
|
1718
|
+
/** Built-in copy-to-clipboard action. Use inside CopilotChat.MessageActions. */
|
|
1719
|
+
declare function CopyAction({ tooltip, className }: CopyActionProps): null;
|
|
1720
|
+
declare namespace CopyAction {
|
|
1721
|
+
var displayName: string;
|
|
1722
|
+
}
|
|
1723
|
+
interface EditActionProps {
|
|
1724
|
+
tooltip?: string;
|
|
1725
|
+
className?: string;
|
|
1726
|
+
}
|
|
1727
|
+
/** Built-in edit action for user messages. Use inside CopilotChat.MessageActions role="user". */
|
|
1728
|
+
declare function EditAction({ tooltip, className }: EditActionProps): null;
|
|
1729
|
+
declare namespace EditAction {
|
|
1730
|
+
var displayName: string;
|
|
1731
|
+
}
|
|
1732
|
+
interface FeedbackActionProps {
|
|
1733
|
+
onFeedback?: (message: ChatMessage, type: "helpful" | "not-helpful") => void;
|
|
1734
|
+
tooltip?: string;
|
|
1735
|
+
className?: string;
|
|
1736
|
+
}
|
|
1737
|
+
/** Built-in thumbs up/down feedback action. Use inside CopilotChat.MessageActions. */
|
|
1738
|
+
declare function FeedbackAction({ onFeedback, tooltip, className, }: FeedbackActionProps): null;
|
|
1739
|
+
declare namespace FeedbackAction {
|
|
1740
|
+
var displayName: string;
|
|
1741
|
+
}
|
|
1742
|
+
interface ActionProps {
|
|
1743
|
+
id?: string;
|
|
1744
|
+
icon: React__default.ReactNode;
|
|
1745
|
+
tooltip: string;
|
|
1746
|
+
onClick: (props: {
|
|
1747
|
+
message: ChatMessage;
|
|
1748
|
+
}) => void;
|
|
1749
|
+
hidden?: boolean | ((props: {
|
|
1750
|
+
message: ChatMessage;
|
|
1751
|
+
}) => boolean);
|
|
1752
|
+
className?: string;
|
|
1753
|
+
}
|
|
1754
|
+
/** Custom action button. Use inside CopilotChat.MessageActions. */
|
|
1755
|
+
declare function Action({ icon, tooltip, onClick, hidden, className, }: ActionProps): null;
|
|
1756
|
+
declare namespace Action {
|
|
1757
|
+
var displayName: string;
|
|
1758
|
+
}
|
|
1759
|
+
interface MessageActionsProps {
|
|
1760
|
+
role: "user" | "assistant";
|
|
1761
|
+
children?: React__default.ReactNode;
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* Registers message actions for a specific role.
|
|
1765
|
+
* Place inside <CopilotChat> as a direct child.
|
|
1766
|
+
*
|
|
1767
|
+
* @example
|
|
1768
|
+
* ```tsx
|
|
1769
|
+
* <CopilotChat>
|
|
1770
|
+
* <CopilotChat.MessageActions role="assistant">
|
|
1771
|
+
* <CopilotChat.CopyAction />
|
|
1772
|
+
* <CopilotChat.FeedbackAction onFeedback={(msg, type) => log(type)} />
|
|
1773
|
+
* <CopilotChat.Action icon={<ShareIcon />} tooltip="Share" onClick={({ message }) => share(message)} />
|
|
1774
|
+
* </CopilotChat.MessageActions>
|
|
1775
|
+
*
|
|
1776
|
+
* <CopilotChat.MessageActions role="user">
|
|
1777
|
+
* <CopilotChat.EditAction />
|
|
1778
|
+
* </CopilotChat.MessageActions>
|
|
1779
|
+
* </CopilotChat>
|
|
1780
|
+
* ```
|
|
1781
|
+
*/
|
|
1782
|
+
declare function MessageActions({ role, children }: MessageActionsProps): null;
|
|
1783
|
+
|
|
1720
1784
|
interface CopilotChatInternalContext {
|
|
1721
1785
|
view: "home" | "chat";
|
|
1722
1786
|
send: (message: string, attachments?: MessageAttachment[]) => void;
|
|
@@ -1724,6 +1788,8 @@ interface CopilotChatInternalContext {
|
|
|
1724
1788
|
onStop?: () => void;
|
|
1725
1789
|
attachmentsEnabled: boolean;
|
|
1726
1790
|
placeholder: string;
|
|
1791
|
+
messages: ChatMessage[];
|
|
1792
|
+
registeredTools?: ToolDefinition[];
|
|
1727
1793
|
onNewChat?: () => void;
|
|
1728
1794
|
threads?: Thread[];
|
|
1729
1795
|
currentThreadId?: string | null;
|
|
@@ -1825,7 +1891,7 @@ declare function BackButton({ className, children, disabled, "aria-label": ariaL
|
|
|
1825
1891
|
*/
|
|
1826
1892
|
type ThreadPickerCompoundProps = Omit<ThreadPickerProps, "value" | "threads" | "onSelect" | "onNewThread" | "onDeleteThread" | "disabled">;
|
|
1827
1893
|
declare function ThreadPickerCompound(props: ThreadPickerCompoundProps): react_jsx_runtime.JSX.Element | null;
|
|
1828
|
-
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, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, renderMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1894
|
+
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, processAttachment: processAttachmentProp, suggestions, onSuggestionClick, welcome, recentThreads, onSelectThread, onDeleteThread, onViewMoreThreads, isProcessing, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, followUpClassName, followUpButtonClassName, citations, messageView, renderMessage, renderInput, renderHeader, groupConsecutiveMessages, className, classNames, onNewChat, threads, currentThreadId, onSwitchThread, isThreadBusy, getBranchInfo, onSwitchBranch, onEditMessage, }: ChatProps): react_jsx_runtime.JSX.Element;
|
|
1829
1895
|
/**
|
|
1830
1896
|
* Chat component with compound component pattern.
|
|
1831
1897
|
*
|
|
@@ -1884,8 +1950,56 @@ declare const Chat: typeof ChatComponent & {
|
|
|
1884
1950
|
Suggestions: typeof SuggestionsCompound;
|
|
1885
1951
|
BackButton: typeof BackButton;
|
|
1886
1952
|
ThreadPicker: typeof ThreadPickerCompound;
|
|
1953
|
+
MessageActions: typeof MessageActions;
|
|
1954
|
+
CopyAction: typeof CopyAction;
|
|
1955
|
+
EditAction: typeof EditAction;
|
|
1956
|
+
FeedbackAction: typeof FeedbackAction;
|
|
1957
|
+
Action: typeof Action;
|
|
1887
1958
|
};
|
|
1888
1959
|
|
|
1960
|
+
interface MessageListProps {
|
|
1961
|
+
/**
|
|
1962
|
+
* Render function called for each message.
|
|
1963
|
+
* Return your own component or fall back to <Chat.DefaultMessage />.
|
|
1964
|
+
*
|
|
1965
|
+
* @example
|
|
1966
|
+
* ```tsx
|
|
1967
|
+
* <Chat.MessageList>
|
|
1968
|
+
* {(message) =>
|
|
1969
|
+
* message.metadata?.type === "plan"
|
|
1970
|
+
* ? <PlanCard key={message.id} data={message.metadata} />
|
|
1971
|
+
* : <Chat.DefaultMessage key={message.id} message={message} />
|
|
1972
|
+
* }
|
|
1973
|
+
* </Chat.MessageList>
|
|
1974
|
+
* ```
|
|
1975
|
+
*/
|
|
1976
|
+
children?: (message: ChatMessage, index: number) => React$1.ReactNode;
|
|
1977
|
+
className?: string;
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* Chat.MessageList — renders the message list using a render-prop pattern.
|
|
1981
|
+
* Must be used inside <CopilotChat>.
|
|
1982
|
+
*
|
|
1983
|
+
* If no children are provided, renders all messages with the default SDK layout.
|
|
1984
|
+
*/
|
|
1985
|
+
declare function MessageList({ children, className }: MessageListProps): react_jsx_runtime.JSX.Element;
|
|
1986
|
+
|
|
1987
|
+
type ChatHeaderProps = {
|
|
1988
|
+
/** Logo image URL (pass empty string to hide logo) */
|
|
1989
|
+
logo?: string;
|
|
1990
|
+
/** Copilot name */
|
|
1991
|
+
name?: string;
|
|
1992
|
+
/** @deprecated Use `name` instead */
|
|
1993
|
+
title?: string;
|
|
1994
|
+
/** Thread picker element (injected by parent) */
|
|
1995
|
+
threadPicker?: React__default.ReactNode;
|
|
1996
|
+
/** Called when close button is clicked */
|
|
1997
|
+
onClose?: () => void;
|
|
1998
|
+
/** Additional class names */
|
|
1999
|
+
className?: string;
|
|
2000
|
+
};
|
|
2001
|
+
declare function ChatHeader({ logo, name, title, threadPicker, onClose, className, }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
|
|
2002
|
+
|
|
1889
2003
|
interface ChatWelcomeProps {
|
|
1890
2004
|
/** Welcome screen configuration */
|
|
1891
2005
|
config?: WelcomeConfig;
|
|
@@ -1928,6 +2042,73 @@ interface ChatWelcomeProps {
|
|
|
1928
2042
|
}
|
|
1929
2043
|
declare function ChatWelcome({ config, suggestions, recentThreads, onSendMessage, onSelectThread, onDeleteThread, onViewMoreThreads, isLoading, onStop, placeholder, attachmentsEnabled, attachmentsDisabledTooltip, maxFileSize, allowedFileTypes, processAttachment: processAttachmentProp, classNames, }: ChatWelcomeProps): react_jsx_runtime.JSX.Element;
|
|
1930
2044
|
|
|
2045
|
+
type DefaultMessageProps = {
|
|
2046
|
+
message: ChatMessage;
|
|
2047
|
+
userAvatar: {
|
|
2048
|
+
src?: string;
|
|
2049
|
+
fallback?: string;
|
|
2050
|
+
component?: React$1.ReactNode;
|
|
2051
|
+
className?: string;
|
|
2052
|
+
};
|
|
2053
|
+
assistantAvatar: {
|
|
2054
|
+
src?: string;
|
|
2055
|
+
fallback?: string;
|
|
2056
|
+
component?: React$1.ReactNode;
|
|
2057
|
+
className?: string;
|
|
2058
|
+
};
|
|
2059
|
+
showUserAvatar?: boolean;
|
|
2060
|
+
userMessageClassName?: string;
|
|
2061
|
+
assistantMessageClassName?: string;
|
|
2062
|
+
/** Font size variant: 'sm' (14px), 'base' (16px), 'lg' (18px) */
|
|
2063
|
+
size?: "sm" | "base" | "lg";
|
|
2064
|
+
/** Whether this is the last message (for streaming state) */
|
|
2065
|
+
isLastMessage?: boolean;
|
|
2066
|
+
/** Whether the chat is currently loading/streaming */
|
|
2067
|
+
isLoading?: boolean;
|
|
2068
|
+
/** Whether waiting for server after tool completion */
|
|
2069
|
+
isProcessing?: boolean;
|
|
2070
|
+
/** Loader variant for typing indicator */
|
|
2071
|
+
loaderVariant?: "dots" | "typing" | "wave" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
2072
|
+
/** Registered tools (for accessing tool's render function) */
|
|
2073
|
+
registeredTools?: ToolDefinition[];
|
|
2074
|
+
/** Custom renderers for tool results (Generative UI) - fallback when tool has no render prop */
|
|
2075
|
+
toolRenderers?: ToolRenderers;
|
|
2076
|
+
/** Catch-all renderer for MCP tools (tools with source: "mcp") */
|
|
2077
|
+
mcpToolRenderer?: React$1.ComponentType<ToolRendererProps>;
|
|
2078
|
+
/** Catch-all renderer for any tool not matched by toolRenderers */
|
|
2079
|
+
fallbackToolRenderer?: React$1.ComponentType<ToolRendererProps>;
|
|
2080
|
+
/** Called when user approves a tool execution */
|
|
2081
|
+
onApproveToolExecution?: (executionId: string, extraData?: Record<string, unknown>, permissionLevel?: PermissionLevel) => void;
|
|
2082
|
+
/** Called when user rejects a tool execution */
|
|
2083
|
+
onRejectToolExecution?: (executionId: string, reason?: string, permissionLevel?: PermissionLevel) => void;
|
|
2084
|
+
/** Show follow-up questions (default: true) */
|
|
2085
|
+
showFollowUps?: boolean;
|
|
2086
|
+
/** Called when a follow-up question is clicked */
|
|
2087
|
+
onFollowUpClick?: (question: string) => void;
|
|
2088
|
+
/** Custom class for follow-up container */
|
|
2089
|
+
followUpClassName?: string;
|
|
2090
|
+
/** Custom class for follow-up buttons */
|
|
2091
|
+
followUpButtonClassName?: string;
|
|
2092
|
+
/** Citation/Sources configuration */
|
|
2093
|
+
citations?: CitationConfig;
|
|
2094
|
+
/**
|
|
2095
|
+
* Branch navigation info for this message.
|
|
2096
|
+
* When non-null and totalSiblings > 1, the BranchNavigator is shown.
|
|
2097
|
+
*/
|
|
2098
|
+
branchInfo?: BranchInfo | null;
|
|
2099
|
+
/**
|
|
2100
|
+
* Called when the user navigates to a sibling branch.
|
|
2101
|
+
* Receives the message ID to switch to.
|
|
2102
|
+
*/
|
|
2103
|
+
onSwitchBranch?: (messageId: string) => void;
|
|
2104
|
+
/**
|
|
2105
|
+
* Called when the user submits an edited message.
|
|
2106
|
+
* Triggers a new branch from the same parent as messageId.
|
|
2107
|
+
*/
|
|
2108
|
+
onEditMessage?: (messageId: string, newContent: string) => void;
|
|
2109
|
+
};
|
|
2110
|
+
declare function DefaultMessage({ message, userAvatar, assistantAvatar, showUserAvatar, userMessageClassName, assistantMessageClassName, size, isLastMessage, isLoading, isProcessing, loaderVariant, registeredTools, toolRenderers, mcpToolRenderer, fallbackToolRenderer, onApproveToolExecution, onRejectToolExecution, showFollowUps, onFollowUpClick, followUpClassName, followUpButtonClassName, citations, branchInfo, onSwitchBranch, onEditMessage, }: DefaultMessageProps): react_jsx_runtime.JSX.Element;
|
|
2111
|
+
|
|
1931
2112
|
interface ToolExecutionMessageProps {
|
|
1932
2113
|
executions: ToolExecutionData[];
|
|
1933
2114
|
assistantAvatar?: {
|
|
@@ -2234,4 +2415,52 @@ declare function MCPUIFrameList({ resources, onIntent, onError, className, frame
|
|
|
2234
2415
|
|
|
2235
2416
|
declare function cn(...inputs: ClassValue[]): string;
|
|
2236
2417
|
|
|
2237
|
-
|
|
2418
|
+
/**
|
|
2419
|
+
* ChatPrimitives — composable primitives for building custom chat layouts.
|
|
2420
|
+
* Must be used inside <CopilotChat>.
|
|
2421
|
+
*
|
|
2422
|
+
* @example
|
|
2423
|
+
* ```tsx
|
|
2424
|
+
* import { ChatPrimitives as Chat } from '@yourgpt/copilot-sdk-ui';
|
|
2425
|
+
*
|
|
2426
|
+
* <CopilotChat>
|
|
2427
|
+
* <Chat.Header />
|
|
2428
|
+
* <Chat.MessageList>
|
|
2429
|
+
* {(message) =>
|
|
2430
|
+
* message.metadata?.type === "plan"
|
|
2431
|
+
* ? <PlanCard key={message.id} />
|
|
2432
|
+
* : <Chat.DefaultMessage key={message.id} message={message} />
|
|
2433
|
+
* }
|
|
2434
|
+
* </Chat.MessageList>
|
|
2435
|
+
* <Chat.Input />
|
|
2436
|
+
* </CopilotChat>
|
|
2437
|
+
* ```
|
|
2438
|
+
*/
|
|
2439
|
+
declare const ChatPrimitives: {
|
|
2440
|
+
/** Renders the message list via render-prop. Falls back to DefaultMessage if no children. */
|
|
2441
|
+
MessageList: typeof MessageList;
|
|
2442
|
+
/** Full SDK message bubble (user + assistant + tools). Use as fallback inside MessageList. */
|
|
2443
|
+
DefaultMessage: typeof DefaultMessage;
|
|
2444
|
+
/** Low-level message row wrapper (flex layout + avatar slot) */
|
|
2445
|
+
Message: ({ children, className, ...props }: MessageProps) => react_jsx_runtime.JSX.Element;
|
|
2446
|
+
/** Message avatar — image with fallback text/icon */
|
|
2447
|
+
MessageAvatar: ({ src, alt, fallback, fallbackIcon, children, delayMs, className, }: MessageAvatarProps) => react_jsx_runtime.JSX.Element;
|
|
2448
|
+
/** Message content bubble — supports markdown */
|
|
2449
|
+
MessageContent: ({ children, markdown, className, size, ...props }: MessageContentProps) => react_jsx_runtime.JSX.Element;
|
|
2450
|
+
/** Action bar below a message (copy, feedback, etc.) */
|
|
2451
|
+
MessageActions: ({ children, className, ...props }: MessageActionsProps$1) => react_jsx_runtime.JSX.Element;
|
|
2452
|
+
/** Single action button with tooltip inside MessageActions */
|
|
2453
|
+
MessageAction: ({ tooltip, children, className, side, ...props }: MessageActionProps) => react_jsx_runtime.JSX.Element;
|
|
2454
|
+
/** Chat header bar with title and controls */
|
|
2455
|
+
Header: typeof ChatHeader;
|
|
2456
|
+
/** Welcome screen shown when there are no messages */
|
|
2457
|
+
Welcome: typeof ChatWelcome;
|
|
2458
|
+
/** Chat input / composer */
|
|
2459
|
+
Input: typeof PromptInput;
|
|
2460
|
+
/** Scroll anchor — keeps the view pinned to the latest message */
|
|
2461
|
+
ScrollAnchor: typeof ChatContainerScrollAnchor;
|
|
2462
|
+
/** Loading / streaming indicator (dots, wave, typing variants) */
|
|
2463
|
+
Loader: typeof Loader;
|
|
2464
|
+
};
|
|
2465
|
+
|
|
2466
|
+
export { AlertTriangleIcon, type BackButtonProps, BotIcon, BranchNavigator, type BranchNavigatorProps, Button, CapabilityBadge, type CapabilityBadgeProps, CapabilityList, type CapabilityListProps, type CapabilityType, Chat, ChatContainerContent, ChatContainerRoot, ChatContainerScrollAnchor, type ChatMessage, ChatPrimitives, type ChatProps, type ChatViewProps, ChatWelcome, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronUpIcon, type Citation, CitationBadge, type CitationBadgeProps, type CitationConfig, CitationSuperscript, type CitationSuperscriptProps, type CitationsConfig, CloseIcon, type CloudPersistenceConfig, CodeBlock, CompactPermissionConfirmation, type CompactPermissionConfirmationProps, Confirmation, ConfirmationActions, type ConfirmationActionsProps, ConfirmationApproved, type ConfirmationApprovedProps, ConfirmationMessage, type ConfirmationMessageProps, ConfirmationPending, type ConfirmationPendingProps, type ConfirmationProps, ConfirmationRejected, type ConfirmationRejectedProps, type ConfirmationState$1 as ConfirmationState, ConnectedChat, type ConnectedChatProps, CopilotChat, type CopilotChatClassNames, type CopilotChatPersistenceConfig, type CopilotChatProps, type CopilotUIConfig, type CopilotUIContextValue, CopilotUIProvider, type CopilotUIProviderProps, CopyIcon, DEFAULT_PERMISSION_OPTIONS, DevLogger, type DevLoggerProps, type DevLoggerState, FeedbackBar, type FollowUpProps, FollowUpQuestions, type FooterProps, type HeaderProps, type HomeViewProps as HomeProps, type HomeViewProps, InlineToolSteps, type InlineToolStepsProps, Loader, type LocalPersistenceConfig, MCPUIFrame, MCPUIFrameList, type MCPUIFrameListProps, MCPUIFrameProps, Markdown, MessageAvatar, MessageContent, type MessageListProps, Message as MessagePrimitive, MessageWithCitations, type MessageWithCitationsProps, type ModelOption, ModelSelector, type ModelSelectorProps, PermissionConfirmation, type PermissionConfirmationProps, type PermissionLevel, type PermissionOption, PoweredBy, type PoweredByProps, PromptInput, PromptInputAction, PromptInputActions, PromptInputTextarea, type ProviderGroup, Reasoning, ReasoningContent, type ReasoningContentProps, type ReasoningProps, ReasoningTrigger, type ReasoningTriggerProps, RefreshIcon, ScrollButton, SearchAnswer, type SearchAnswerProps, SearchResults, type SearchResultsProps, SearchResultsWithAnswer, type SearchResultsWithAnswerProps, SendIcon, type ServerPersistenceConfig, SimpleConfirmation, type SimpleConfirmationProps, SimpleModelSelector, type SimpleModelSelectorProps, SimpleReasoning, type SimpleReasoningProps, SimpleSource, type SimpleSourceProps, Source, SourceContent, type SourceContentProps, SourceGroup, type SourceGroupProps, type SourceItem, SourcePill, type SourcePillProps, type SourceProps, SourceTrigger, type SourceTriggerProps, SourcesBar, type SourcesBarProps, SourcesCollapsible, type SourcesCollapsibleProps, SourcesList, type SourcesListProps, StopIcon, ThreadCard, type ThreadCardProps, ThreadList, type ThreadListProps, ThreadPicker, type ThreadPickerCompoundProps, type ThreadPickerProps, ThumbsDownIcon, ThumbsUpIcon, ToolExecutionMessage, type ToolRendererProps, type ToolRenderers, ToolStep, type ToolStepData, type ToolStepProps, type ToolStepStatus, ToolSteps, type ToolStepsProps, Tooltip, TooltipContent, type TooltipContentProps, type TooltipProps, TooltipProvider, type TooltipProviderProps, TooltipTrigger, type TooltipTriggerProps, UserIcon, type WelcomeConfig, XIcon, annotationsToCitations, cn, parseFollowUps, resultsToCitations, useChatContainer, useCopilotChatContext, useCopilotUI };
|