@witqq/agent-sdk 0.6.1 → 0.8.0
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/README.md +539 -6
- package/dist/{types-BvwNzZCj.d.cts → agent-CW9XbmG_.d.ts} +148 -95
- package/dist/{types-BvwNzZCj.d.ts → agent-DxY68NZL.d.cts} +148 -95
- package/dist/auth/index.cjs +260 -2
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +21 -138
- package/dist/auth/index.d.ts +21 -138
- package/dist/auth/index.js +260 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/backends/claude.cjs +653 -140
- package/dist/backends/claude.cjs.map +1 -1
- package/dist/backends/claude.d.cts +4 -1
- package/dist/backends/claude.d.ts +4 -1
- package/dist/backends/claude.js +653 -140
- package/dist/backends/claude.js.map +1 -1
- package/dist/backends/copilot.cjs +428 -88
- package/dist/backends/copilot.cjs.map +1 -1
- package/dist/backends/copilot.d.cts +13 -4
- package/dist/backends/copilot.d.ts +13 -4
- package/dist/backends/copilot.js +428 -88
- package/dist/backends/copilot.js.map +1 -1
- package/dist/backends/vercel-ai.cjs +349 -77
- package/dist/backends/vercel-ai.cjs.map +1 -1
- package/dist/backends/vercel-ai.d.cts +3 -1
- package/dist/backends/vercel-ai.d.ts +3 -1
- package/dist/backends/vercel-ai.js +349 -77
- package/dist/backends/vercel-ai.js.map +1 -1
- package/dist/backends-BSrsBYFn.d.cts +39 -0
- package/dist/backends-BSrsBYFn.d.ts +39 -0
- package/dist/chat/accumulator.cjs +147 -0
- package/dist/chat/accumulator.cjs.map +1 -0
- package/dist/chat/accumulator.d.cts +64 -0
- package/dist/chat/accumulator.d.ts +64 -0
- package/dist/chat/accumulator.js +145 -0
- package/dist/chat/accumulator.js.map +1 -0
- package/dist/chat/backends.cjs +3524 -0
- package/dist/chat/backends.cjs.map +1 -0
- package/dist/chat/backends.d.cts +66 -0
- package/dist/chat/backends.d.ts +66 -0
- package/dist/chat/backends.js +3512 -0
- package/dist/chat/backends.js.map +1 -0
- package/dist/chat/context.cjs +280 -0
- package/dist/chat/context.cjs.map +1 -0
- package/dist/chat/context.d.cts +191 -0
- package/dist/chat/context.d.ts +191 -0
- package/dist/chat/context.js +277 -0
- package/dist/chat/context.js.map +1 -0
- package/dist/chat/core.cjs +305 -0
- package/dist/chat/core.cjs.map +1 -0
- package/dist/chat/core.d.cts +84 -0
- package/dist/chat/core.d.ts +84 -0
- package/dist/chat/core.js +282 -0
- package/dist/chat/core.js.map +1 -0
- package/dist/chat/errors.cjs +273 -0
- package/dist/chat/errors.cjs.map +1 -0
- package/dist/chat/errors.d.cts +97 -0
- package/dist/chat/errors.d.ts +97 -0
- package/dist/chat/errors.js +266 -0
- package/dist/chat/errors.js.map +1 -0
- package/dist/chat/events.cjs +203 -0
- package/dist/chat/events.cjs.map +1 -0
- package/dist/chat/events.d.cts +245 -0
- package/dist/chat/events.d.ts +245 -0
- package/dist/chat/events.js +196 -0
- package/dist/chat/events.js.map +1 -0
- package/dist/chat/index.cjs +5550 -0
- package/dist/chat/index.cjs.map +1 -0
- package/dist/chat/index.d.cts +77 -0
- package/dist/chat/index.d.ts +77 -0
- package/dist/chat/index.js +5505 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chat/react/theme.css +2517 -0
- package/dist/chat/react.cjs +3589 -0
- package/dist/chat/react.cjs.map +1 -0
- package/dist/chat/react.d.cts +1088 -0
- package/dist/chat/react.d.ts +1088 -0
- package/dist/chat/react.js +3547 -0
- package/dist/chat/react.js.map +1 -0
- package/dist/chat/runtime.cjs +1245 -0
- package/dist/chat/runtime.cjs.map +1 -0
- package/dist/chat/runtime.d.cts +182 -0
- package/dist/chat/runtime.d.ts +182 -0
- package/dist/chat/runtime.js +1243 -0
- package/dist/chat/runtime.js.map +1 -0
- package/dist/chat/server.cjs +2668 -0
- package/dist/chat/server.cjs.map +1 -0
- package/dist/chat/server.d.cts +648 -0
- package/dist/chat/server.d.ts +648 -0
- package/dist/chat/server.js +2628 -0
- package/dist/chat/server.js.map +1 -0
- package/dist/chat/sessions.cjs +380 -0
- package/dist/chat/sessions.cjs.map +1 -0
- package/dist/chat/sessions.d.cts +158 -0
- package/dist/chat/sessions.d.ts +158 -0
- package/dist/chat/sessions.js +376 -0
- package/dist/chat/sessions.js.map +1 -0
- package/dist/chat/sqlite.cjs +441 -0
- package/dist/chat/sqlite.cjs.map +1 -0
- package/dist/chat/sqlite.d.cts +128 -0
- package/dist/chat/sqlite.d.ts +128 -0
- package/dist/chat/sqlite.js +435 -0
- package/dist/chat/sqlite.js.map +1 -0
- package/dist/chat/state.cjs +190 -0
- package/dist/chat/state.cjs.map +1 -0
- package/dist/chat/state.d.cts +95 -0
- package/dist/chat/state.d.ts +95 -0
- package/dist/chat/state.js +180 -0
- package/dist/chat/state.js.map +1 -0
- package/dist/chat/storage.cjs +249 -0
- package/dist/chat/storage.cjs.map +1 -0
- package/dist/chat/storage.d.cts +197 -0
- package/dist/chat/storage.d.ts +197 -0
- package/dist/chat/storage.js +245 -0
- package/dist/chat/storage.js.map +1 -0
- package/dist/errors-C-so0M4t.d.cts +33 -0
- package/dist/errors-C-so0M4t.d.ts +33 -0
- package/dist/errors-CmVvczxZ.d.cts +28 -0
- package/dist/errors-CmVvczxZ.d.ts +28 -0
- package/dist/in-process-transport-C1JnJGVR.d.ts +228 -0
- package/dist/in-process-transport-C7DSqPyX.d.cts +228 -0
- package/dist/index.cjs +365 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +322 -125
- package/dist/index.d.ts +322 -125
- package/dist/index.js +359 -60
- package/dist/index.js.map +1 -1
- package/dist/provider-types-PTSlRPNB.d.cts +39 -0
- package/dist/provider-types-PTSlRPNB.d.ts +39 -0
- package/dist/refresh-manager-B81PpYBr.d.cts +153 -0
- package/dist/refresh-manager-Dlv_iNZi.d.ts +153 -0
- package/dist/testing.cjs +383 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +132 -0
- package/dist/testing.d.ts +132 -0
- package/dist/testing.js +377 -0
- package/dist/testing.js.map +1 -0
- package/dist/token-store-CSUBgYwn.d.ts +48 -0
- package/dist/token-store-CuC4hB9Z.d.cts +48 -0
- package/dist/transport-Cdh3M0tS.d.cts +68 -0
- package/dist/transport-Ciap4PWK.d.ts +68 -0
- package/dist/types-4vbcmPTp.d.cts +143 -0
- package/dist/types-BxggH0Yh.d.ts +143 -0
- package/dist/types-DRgd_9R7.d.cts +363 -0
- package/dist/types-ajANVzf7.d.ts +363 -0
- package/package.json +178 -6
|
@@ -0,0 +1,1088 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ComponentType } from 'react';
|
|
3
|
+
import { IChatClient, BackendInfo, SelectionChangeCallback } from './runtime.js';
|
|
4
|
+
import { c as ChatMessage, R as RuntimeStatus, r as SessionInfo, u as TextPart, q as ReasoningPart, v as ToolCallPart, t as SourcePart, F as FilePart, g as ChatSession, a as ChatEvent, b as ChatId, f as ChatIdLike, S as SendMessageOptions } from '../types-ajANVzf7.js';
|
|
5
|
+
import { A as AuthToken } from '../types-BxggH0Yh.js';
|
|
6
|
+
import { P as ProviderConfig } from '../provider-types-PTSlRPNB.js';
|
|
7
|
+
import { ContextStats } from './context.js';
|
|
8
|
+
import { M as ModelInfo } from '../agent-CW9XbmG_.js';
|
|
9
|
+
import { CreateSessionOptions, SessionListOptions } from './sessions.js';
|
|
10
|
+
import '../errors-C-so0M4t.js';
|
|
11
|
+
import 'zod';
|
|
12
|
+
import './storage.js';
|
|
13
|
+
import '../errors-CmVvczxZ.js';
|
|
14
|
+
|
|
15
|
+
/** Props for ChatProvider. */
|
|
16
|
+
interface ChatProviderProps {
|
|
17
|
+
/** The chat runtime or client instance to provide to descendants. Accepts IChatClient (or any structurally compatible type). */
|
|
18
|
+
runtime: IChatClient;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* React context provider wrapping IChatClient.
|
|
23
|
+
* All chat hooks must be used within a ChatProvider.
|
|
24
|
+
*/
|
|
25
|
+
declare function ChatProvider({ runtime, children }: ChatProviderProps): react.FunctionComponentElement<react.ProviderProps<IChatClient<Record<string, unknown>> | null>>;
|
|
26
|
+
/**
|
|
27
|
+
* Access the IChatClient from context.
|
|
28
|
+
* Must be used within a ChatProvider.
|
|
29
|
+
*
|
|
30
|
+
* @throws {Error} If used outside ChatProvider
|
|
31
|
+
*/
|
|
32
|
+
declare function useChatRuntime(): IChatClient;
|
|
33
|
+
|
|
34
|
+
/** Options for the useChat hook. */
|
|
35
|
+
interface UseChatOptions {
|
|
36
|
+
/** Session ID. If omitted, a new session is created on first send. */
|
|
37
|
+
sessionId?: string;
|
|
38
|
+
/** Called on error during send. */
|
|
39
|
+
onError?: (error: Error) => void;
|
|
40
|
+
/** Auto-dismiss errors after this many ms (0 = disabled, default: 0). */
|
|
41
|
+
autoDismissMs?: number;
|
|
42
|
+
}
|
|
43
|
+
/** Token usage data from the last completed response. */
|
|
44
|
+
interface ChatUsage {
|
|
45
|
+
promptTokens: number;
|
|
46
|
+
completionTokens: number;
|
|
47
|
+
totalTokens: number;
|
|
48
|
+
model?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Return value from useChat. */
|
|
51
|
+
interface UseChatReturn {
|
|
52
|
+
/** Current session ID (null until session created). */
|
|
53
|
+
sessionId: string | null;
|
|
54
|
+
/** Ordered messages in the current session. */
|
|
55
|
+
messages: ChatMessage[];
|
|
56
|
+
/** Send a user message and trigger assistant response. */
|
|
57
|
+
sendMessage: (content: string) => Promise<void>;
|
|
58
|
+
/** Abort the current generation. */
|
|
59
|
+
stop: () => void;
|
|
60
|
+
/** Whether the assistant is currently generating. */
|
|
61
|
+
isGenerating: boolean;
|
|
62
|
+
/** Current runtime status. */
|
|
63
|
+
status: RuntimeStatus;
|
|
64
|
+
/** Current error, if any. */
|
|
65
|
+
error: Error | null;
|
|
66
|
+
/** Clear the error state. */
|
|
67
|
+
clearError: () => void;
|
|
68
|
+
/** Retry the last failed message. No-op if no error or no last user message. */
|
|
69
|
+
retryLastMessage: () => Promise<void>;
|
|
70
|
+
/** Create a new session, resetting messages. */
|
|
71
|
+
newSession: () => Promise<string>;
|
|
72
|
+
/** Token usage from the last completed response. */
|
|
73
|
+
usage: ChatUsage | null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Convenience hook for chat interaction.
|
|
77
|
+
* Wraps IChatRuntime with React state management and progressive streaming.
|
|
78
|
+
* Messages update in real-time as tokens arrive (not after full response).
|
|
79
|
+
*/
|
|
80
|
+
declare function useChat(options?: UseChatOptions): UseChatReturn;
|
|
81
|
+
|
|
82
|
+
/** Options for the useMessages hook. */
|
|
83
|
+
interface UseMessagesOptions {
|
|
84
|
+
/** Session ID to observe. */
|
|
85
|
+
sessionId: string;
|
|
86
|
+
}
|
|
87
|
+
/** Return value from useMessages. */
|
|
88
|
+
interface UseMessagesReturn {
|
|
89
|
+
/** Ordered messages in the session. */
|
|
90
|
+
messages: ChatMessage[];
|
|
91
|
+
/** Whether the session was found. */
|
|
92
|
+
isLoaded: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Reactive message list via useSyncExternalStore.
|
|
96
|
+
*
|
|
97
|
+
* If the session supports subscribe/getSnapshot (reactive session),
|
|
98
|
+
* uses useSyncExternalStore for granular updates.
|
|
99
|
+
* Otherwise, falls back to polling via getSession().
|
|
100
|
+
*/
|
|
101
|
+
declare function useMessages(options: UseMessagesOptions): UseMessagesReturn;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @witqq/agent-sdk/chat/react — useSessions
|
|
105
|
+
*
|
|
106
|
+
* Reactive session list hook that subscribes to runtime session changes.
|
|
107
|
+
* Auto-updates without manual polling via `onSessionChange` subscription.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
/** Return type of useSessions hook. */
|
|
111
|
+
interface UseSessionsReturn {
|
|
112
|
+
/** Current session list (lightweight SessionInfo format) */
|
|
113
|
+
sessions: SessionInfo[];
|
|
114
|
+
/** Whether initial load or refresh is in progress */
|
|
115
|
+
loading: boolean;
|
|
116
|
+
/** Last error from session fetch */
|
|
117
|
+
error: Error | null;
|
|
118
|
+
/** Manually trigger a refresh */
|
|
119
|
+
refresh: () => void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Reactive session list hook.
|
|
123
|
+
* Subscribes to `runtime.onSessionChange()` and refreshes the list automatically
|
|
124
|
+
* on create, delete, and message send completion.
|
|
125
|
+
*/
|
|
126
|
+
declare function useSessions(): UseSessionsReturn;
|
|
127
|
+
|
|
128
|
+
/** Props for the Message component. */
|
|
129
|
+
interface MessageProps {
|
|
130
|
+
message: ChatMessage;
|
|
131
|
+
renderText?: (part: TextPart, index: number) => ReactNode;
|
|
132
|
+
renderReasoning?: (part: ReasoningPart, index: number) => ReactNode;
|
|
133
|
+
renderToolCall?: (part: ToolCallPart, index: number) => ReactNode;
|
|
134
|
+
renderSource?: (part: SourcePart, index: number) => ReactNode;
|
|
135
|
+
renderFile?: (part: FilePart, index: number) => ReactNode;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Headless message component rendering ChatMessage parts.
|
|
139
|
+
* Wraps parts in a div with data-role and data-status attributes.
|
|
140
|
+
*/
|
|
141
|
+
declare function Message(props: MessageProps): ReactNode;
|
|
142
|
+
|
|
143
|
+
/** Props for the ThinkingBlock component. */
|
|
144
|
+
interface ThinkingBlockProps {
|
|
145
|
+
text: string;
|
|
146
|
+
isStreaming?: boolean;
|
|
147
|
+
defaultOpen?: boolean;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Headless thinking/reasoning block using native details/summary elements.
|
|
151
|
+
* Displays "Thinking..." while streaming, "Reasoning" when complete.
|
|
152
|
+
*/
|
|
153
|
+
declare function ThinkingBlock({ text, isStreaming, defaultOpen }: ThinkingBlockProps): ReactNode;
|
|
154
|
+
|
|
155
|
+
/** Props for the ToolCallView component. */
|
|
156
|
+
interface ToolCallViewProps {
|
|
157
|
+
part: ToolCallPart;
|
|
158
|
+
onApprove?: () => void;
|
|
159
|
+
onDeny?: () => void;
|
|
160
|
+
renderArgs?: (args: unknown) => ReactNode;
|
|
161
|
+
renderResult?: (result: unknown) => ReactNode;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Headless tool call display component.
|
|
165
|
+
* Shows tool name, status, collapsible args/result, and approval buttons when needed.
|
|
166
|
+
*/
|
|
167
|
+
declare function ToolCallView({ part, onApprove, onDeny, renderArgs, renderResult }: ToolCallViewProps): ReactNode;
|
|
168
|
+
|
|
169
|
+
/** A pending tool call requiring user approval. */
|
|
170
|
+
interface PendingToolRequest {
|
|
171
|
+
toolCallId: string;
|
|
172
|
+
toolName: string;
|
|
173
|
+
toolArgs: Record<string, unknown>;
|
|
174
|
+
messageId: string;
|
|
175
|
+
}
|
|
176
|
+
/** Return value from useToolApproval. */
|
|
177
|
+
interface UseToolApprovalReturn {
|
|
178
|
+
pendingRequests: PendingToolRequest[];
|
|
179
|
+
approve: (toolCallId: string) => void;
|
|
180
|
+
deny: (toolCallId: string) => void;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Hook that tracks tool calls requiring approval from messages.
|
|
184
|
+
*
|
|
185
|
+
* Scans messages for ToolCallParts with status "requires_approval"
|
|
186
|
+
* and provides approve/deny callbacks. Currently state-only
|
|
187
|
+
* (no ChatEventBus integration).
|
|
188
|
+
*
|
|
189
|
+
* @param messages - Messages to scan for pending tool approvals
|
|
190
|
+
* @param onApprove - Called when a tool call is approved
|
|
191
|
+
* @param onDeny - Called when a tool call is denied
|
|
192
|
+
*/
|
|
193
|
+
declare function useToolApproval(messages: ChatMessage[], onApprove?: (toolCallId: string) => void, onDeny?: (toolCallId: string) => void): UseToolApprovalReturn;
|
|
194
|
+
|
|
195
|
+
/** Props for the MarkdownRenderer component. */
|
|
196
|
+
interface MarkdownRendererProps {
|
|
197
|
+
content: string;
|
|
198
|
+
renderCode?: (code: string, language?: string) => ReactNode;
|
|
199
|
+
renderLink?: (href: string, text: string) => ReactNode;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Headless markdown renderer.
|
|
203
|
+
* Parses markdown text to semantic HTML elements via createElement.
|
|
204
|
+
* Supports headings, paragraphs, bold, italic, inline code, code blocks,
|
|
205
|
+
* links, blockquotes, and lists. No external dependencies.
|
|
206
|
+
*/
|
|
207
|
+
declare function MarkdownRenderer(props: MarkdownRendererProps): ReactNode;
|
|
208
|
+
|
|
209
|
+
/** Props for the Thread component. */
|
|
210
|
+
interface ThreadProps {
|
|
211
|
+
messages: ChatMessage[];
|
|
212
|
+
isGenerating?: boolean;
|
|
213
|
+
autoScroll?: boolean;
|
|
214
|
+
className?: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Headless thread component wrapping a scrollable message list.
|
|
218
|
+
* Auto-scrolls to bottom when new messages arrive unless user has scrolled up.
|
|
219
|
+
* Shows a scroll-to-bottom button when scrolled up and an empty state when no messages.
|
|
220
|
+
*/
|
|
221
|
+
declare function Thread({ messages, isGenerating, autoScroll, className, }: ThreadProps): ReactNode;
|
|
222
|
+
|
|
223
|
+
/** Props for the Composer component. */
|
|
224
|
+
interface ComposerProps {
|
|
225
|
+
onSend: (text: string) => void;
|
|
226
|
+
onStop?: () => void;
|
|
227
|
+
isGenerating?: boolean;
|
|
228
|
+
disabled?: boolean;
|
|
229
|
+
placeholder?: string;
|
|
230
|
+
maxRows?: number;
|
|
231
|
+
className?: string;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Headless composer component for sending messages.
|
|
235
|
+
* Includes auto-resizing textarea, send/stop buttons, and keyboard shortcuts.
|
|
236
|
+
*/
|
|
237
|
+
declare function Composer({ onSend, onStop, isGenerating, disabled, placeholder, maxRows, className, }: ComposerProps): ReactNode;
|
|
238
|
+
|
|
239
|
+
/** Slot override functions for Thread customization. */
|
|
240
|
+
interface ThreadSlotOverrides {
|
|
241
|
+
renderMessage?: (message: ChatMessage, index: number) => ReactNode;
|
|
242
|
+
renderToolCall?: (part: ToolCallPart, index: number) => ReactNode;
|
|
243
|
+
renderThinkingBlock?: (part: ReasoningPart, index: number) => ReactNode;
|
|
244
|
+
}
|
|
245
|
+
/** Props for ThreadProvider. */
|
|
246
|
+
interface ThreadProviderProps extends ThreadSlotOverrides {
|
|
247
|
+
children: ReactNode;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Provides slot-based customization for Thread message rendering.
|
|
251
|
+
* Wrap a Thread in ThreadProvider to override how messages, tool calls,
|
|
252
|
+
* or thinking blocks are rendered.
|
|
253
|
+
*/
|
|
254
|
+
declare function ThreadProvider({ children, renderMessage, renderToolCall, renderThinkingBlock, }: ThreadProviderProps): ReactNode;
|
|
255
|
+
/**
|
|
256
|
+
* Access slot overrides from ThreadProvider context.
|
|
257
|
+
* @throws {Error} If used outside a ThreadProvider
|
|
258
|
+
*/
|
|
259
|
+
declare function useThreadSlots(): ThreadSlotOverrides;
|
|
260
|
+
/**
|
|
261
|
+
* Access slot overrides if inside a ThreadProvider, or null if not.
|
|
262
|
+
* Safe to call without a ThreadProvider ancestor.
|
|
263
|
+
*/
|
|
264
|
+
declare function useOptionalThreadSlots(): ThreadSlotOverrides | null;
|
|
265
|
+
|
|
266
|
+
/** A session item that ThreadList can display — either full ChatSession or lightweight SessionInfo. */
|
|
267
|
+
type SessionItem = SessionInfo | ChatSession;
|
|
268
|
+
/** Props for the ThreadList component. */
|
|
269
|
+
interface ThreadListProps {
|
|
270
|
+
sessions: SessionItem[];
|
|
271
|
+
activeSessionId?: string;
|
|
272
|
+
onSelect: (id: string) => void;
|
|
273
|
+
onCreate?: () => void;
|
|
274
|
+
onDelete?: (id: string) => void;
|
|
275
|
+
searchQuery?: string;
|
|
276
|
+
onSearchChange?: (query: string) => void;
|
|
277
|
+
className?: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Session sidebar component for listing, searching, creating, and deleting sessions.
|
|
281
|
+
*/
|
|
282
|
+
declare function ThreadList({ sessions, activeSessionId, onSelect, onCreate, onDelete, searchQuery, onSearchChange, className, }: ThreadListProps): ReactNode;
|
|
283
|
+
|
|
284
|
+
/** Connection status of the SSE hook. */
|
|
285
|
+
type SSEStatus = "idle" | "connecting" | "open" | "closed" | "error";
|
|
286
|
+
/** Options for the useSSE hook. */
|
|
287
|
+
interface UseSSEOptions {
|
|
288
|
+
/** HTTP method (default: "GET") */
|
|
289
|
+
method?: "GET" | "POST";
|
|
290
|
+
/** Request body for POST requests (JSON-serialized automatically) */
|
|
291
|
+
body?: unknown;
|
|
292
|
+
headers?: Record<string, string>;
|
|
293
|
+
onEvent?: (event: ChatEvent) => void;
|
|
294
|
+
onError?: (error: Error) => void;
|
|
295
|
+
reconnect?: boolean;
|
|
296
|
+
reconnectInterval?: number;
|
|
297
|
+
}
|
|
298
|
+
/** Return type for the useSSE hook. */
|
|
299
|
+
interface UseSSEReturn {
|
|
300
|
+
status: SSEStatus;
|
|
301
|
+
connect: () => void;
|
|
302
|
+
disconnect: () => void;
|
|
303
|
+
lastEvent: ChatEvent | null;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* SSE transport hook using fetch (not EventSource).
|
|
307
|
+
* Parses text/event-stream format with support for multi-line data and event types.
|
|
308
|
+
*/
|
|
309
|
+
declare function useSSE(url: string | null, options?: UseSSEOptions): UseSSEReturn;
|
|
310
|
+
|
|
311
|
+
/** Model display option returned by useModels (mapped from core ModelInfo). */
|
|
312
|
+
interface ModelOption {
|
|
313
|
+
id: string;
|
|
314
|
+
name: string;
|
|
315
|
+
tier?: string;
|
|
316
|
+
/** Provider/backend name for multi-provider context. */
|
|
317
|
+
provider?: string;
|
|
318
|
+
}
|
|
319
|
+
/** Return type for the useModels hook. */
|
|
320
|
+
interface UseModelsReturn {
|
|
321
|
+
models: ModelOption[];
|
|
322
|
+
isLoading: boolean;
|
|
323
|
+
error: Error | null;
|
|
324
|
+
refresh: () => void;
|
|
325
|
+
search: (query: string) => ModelOption[];
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Hook for fetching and searching available models from the chat runtime.
|
|
329
|
+
*/
|
|
330
|
+
declare function useModels(): UseModelsReturn;
|
|
331
|
+
|
|
332
|
+
/** Props for the ModelSelector component. */
|
|
333
|
+
interface ModelSelectorProps {
|
|
334
|
+
models: ModelOption[];
|
|
335
|
+
selectedModel?: string;
|
|
336
|
+
onSelect: (modelId: string) => void;
|
|
337
|
+
placeholder?: string;
|
|
338
|
+
className?: string;
|
|
339
|
+
/** Allow free-text model input when models list is empty. Default: true. */
|
|
340
|
+
allowFreeText?: boolean;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Dropdown model selector with search and keyboard navigation.
|
|
344
|
+
* Falls back to a free-text input when models list is empty.
|
|
345
|
+
*/
|
|
346
|
+
declare function ModelSelector({ models, selectedModel, onSelect, placeholder, className, allowFreeText, }: ModelSelectorProps): ReactNode;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* @witqq/agent-sdk/chat/react — useRemoteAuth
|
|
350
|
+
*
|
|
351
|
+
* Server-delegated authentication hook. Delegates all auth flows to
|
|
352
|
+
* the server auth handler (createAuthHandler) via HTTP, avoiding
|
|
353
|
+
* browser crypto dependencies entirely.
|
|
354
|
+
*
|
|
355
|
+
* Replaces useAuth for browser contexts. Same interface shape for easy migration.
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
/** Supported remote auth backends. */
|
|
359
|
+
type RemoteAuthBackend = "copilot" | "claude" | "vercel-ai";
|
|
360
|
+
/** Auth status state machine: idle → pending → authenticated | error. */
|
|
361
|
+
type RemoteAuthStatus = "idle" | "pending" | "authenticated" | "error";
|
|
362
|
+
/** Options for the useRemoteAuth hook. */
|
|
363
|
+
interface UseRemoteAuthOptions {
|
|
364
|
+
/** Auth backend to use */
|
|
365
|
+
backend: RemoteAuthBackend;
|
|
366
|
+
/** Base URL of the auth server (e.g. "http://localhost:3456/api/auth") */
|
|
367
|
+
baseUrl: string;
|
|
368
|
+
/** Called after successful authentication */
|
|
369
|
+
onAuthenticated?: (token: AuthToken) => void;
|
|
370
|
+
/** Optional fetch override (for testing) */
|
|
371
|
+
fetch?: typeof globalThis.fetch;
|
|
372
|
+
/** Optional headers for all requests */
|
|
373
|
+
headers?: Record<string, string>;
|
|
374
|
+
}
|
|
375
|
+
/** Return value from useRemoteAuth. */
|
|
376
|
+
interface UseRemoteAuthReturn {
|
|
377
|
+
status: RemoteAuthStatus;
|
|
378
|
+
error: Error | null;
|
|
379
|
+
startDeviceFlow: () => Promise<void>;
|
|
380
|
+
deviceCode: string | null;
|
|
381
|
+
verificationUrl: string | null;
|
|
382
|
+
startOAuthFlow: () => Promise<void>;
|
|
383
|
+
authorizeUrl: string | null;
|
|
384
|
+
completeOAuth: (codeOrUrl: string) => Promise<void>;
|
|
385
|
+
submitApiKey: (key: string, baseUrl?: string) => Promise<void>;
|
|
386
|
+
start: (provider?: RemoteAuthBackend) => Promise<void>;
|
|
387
|
+
token: AuthToken | null;
|
|
388
|
+
reset: () => void;
|
|
389
|
+
savedProviders: string[];
|
|
390
|
+
loadSavedTokens: () => Promise<void>;
|
|
391
|
+
useSavedToken: (provider: RemoteAuthBackend) => Promise<void>;
|
|
392
|
+
clearTokens: () => Promise<void>;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Server-delegated authentication hook.
|
|
396
|
+
*
|
|
397
|
+
* Communicates with server auth handler endpoints (POST /auth/start,
|
|
398
|
+
* POST /auth/copilot/poll, etc.) instead of running auth flows in the browser.
|
|
399
|
+
* No node:crypto dependency since all crypto operations happen server-side.
|
|
400
|
+
*
|
|
401
|
+
* @param options - Hook configuration
|
|
402
|
+
* @returns Auth state and action methods
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```ts
|
|
406
|
+
* const auth = useRemoteAuth({
|
|
407
|
+
* backend: "copilot",
|
|
408
|
+
* baseUrl: "/api/auth",
|
|
409
|
+
* onAuthenticated: (token) => console.log("Authenticated:", token),
|
|
410
|
+
* });
|
|
411
|
+
* ```
|
|
412
|
+
*/
|
|
413
|
+
declare function useRemoteAuth(options: UseRemoteAuthOptions): UseRemoteAuthReturn;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @witqq/agent-sdk/chat/react — useRemoteChat
|
|
417
|
+
*
|
|
418
|
+
* Lifecycle hook that orchestrates auth → runtime → session.
|
|
419
|
+
*
|
|
420
|
+
* On mount, checks for saved auth tokens and auto-restores.
|
|
421
|
+
* Once authenticated, creates a RemoteChatClient and initial session.
|
|
422
|
+
* Exposes readiness phase, the client instance, and the auth sub-hook.
|
|
423
|
+
*/
|
|
424
|
+
|
|
425
|
+
/** Lifecycle phase for the useRemoteChat hook. */
|
|
426
|
+
type RemoteChatPhase = "initializing" | "unauthenticated" | "authenticating" | "creating" | "ready" | "error";
|
|
427
|
+
/** Options for useRemoteChat. */
|
|
428
|
+
interface UseRemoteChatOptions {
|
|
429
|
+
/** Base URL for chat API (e.g. "/api/chat"). */
|
|
430
|
+
chatBaseUrl: string;
|
|
431
|
+
/** Base URL for auth API (e.g. "/api/auth"). */
|
|
432
|
+
authBaseUrl: string;
|
|
433
|
+
/** Auth backend to use. */
|
|
434
|
+
backend: RemoteAuthBackend;
|
|
435
|
+
/** Called when lifecycle reaches "ready" phase. */
|
|
436
|
+
onReady?: () => void;
|
|
437
|
+
/** Custom fetch for testability. */
|
|
438
|
+
fetch?: typeof globalThis.fetch;
|
|
439
|
+
/** Optional headers for all requests. */
|
|
440
|
+
headers?: Record<string, string>;
|
|
441
|
+
}
|
|
442
|
+
/** Return value from useRemoteChat. */
|
|
443
|
+
interface UseRemoteChatReturn {
|
|
444
|
+
/** Current lifecycle phase. */
|
|
445
|
+
phase: RemoteChatPhase;
|
|
446
|
+
/** Chat client (null until phase = "ready"). */
|
|
447
|
+
runtime: IChatClient | null;
|
|
448
|
+
/** Initial session ID (null until phase = "ready"). */
|
|
449
|
+
sessionId: string | null;
|
|
450
|
+
/** Auth sub-hook for manual auth control. */
|
|
451
|
+
auth: UseRemoteAuthReturn;
|
|
452
|
+
/** Current error (null when no error). */
|
|
453
|
+
error: Error | null;
|
|
454
|
+
/** Create a new chat session. Returns session ID. */
|
|
455
|
+
newSession: () => Promise<string>;
|
|
456
|
+
/** Logout: clear tokens, dispose runtime, reset to unauthenticated. */
|
|
457
|
+
logout: () => Promise<void>;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Lifecycle hook: auth → runtime → session.
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```tsx
|
|
464
|
+
* const chat = useRemoteChat({
|
|
465
|
+
* chatBaseUrl: "/api/chat",
|
|
466
|
+
* authBaseUrl: "/api/auth",
|
|
467
|
+
* backend: "copilot",
|
|
468
|
+
* });
|
|
469
|
+
*
|
|
470
|
+
* if (chat.phase === "unauthenticated") {
|
|
471
|
+
* return <button onClick={() => chat.auth.start()}>Login</button>;
|
|
472
|
+
* }
|
|
473
|
+
* if (chat.phase === "ready" && chat.runtime) {
|
|
474
|
+
* return <ChatProvider runtime={chat.runtime}>...</ChatProvider>;
|
|
475
|
+
* }
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
declare function useRemoteChat(options: UseRemoteChatOptions): UseRemoteChatReturn;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Props passed to per-backend auth form components.
|
|
482
|
+
* Each backend implements its own form using these props.
|
|
483
|
+
*/
|
|
484
|
+
interface AuthFormProps {
|
|
485
|
+
/** The remote auth hook instance, pre-configured for this backend. */
|
|
486
|
+
auth: UseRemoteAuthReturn;
|
|
487
|
+
/** Called when authentication completes successfully. */
|
|
488
|
+
onAuthComplete: () => void;
|
|
489
|
+
}
|
|
490
|
+
/** A backend auth form component. */
|
|
491
|
+
type AuthFormComponent = (props: AuthFormProps) => ReactNode;
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Copilot (GitHub) auth form — device flow.
|
|
495
|
+
*
|
|
496
|
+
* Shows "Authenticate with GitHub" button → device code + verification URL →
|
|
497
|
+
* "Waiting..." → "✓ Authenticated" + "Continue →".
|
|
498
|
+
*
|
|
499
|
+
* Co-located with the Copilot backend.
|
|
500
|
+
*/
|
|
501
|
+
declare function CopilotAuthForm({ auth, onAuthComplete }: AuthFormProps): ReactNode;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Claude auth form — OAuth Authorization Code + PKCE.
|
|
505
|
+
*
|
|
506
|
+
* Shows "Authenticate with Claude" button → authorize URL link +
|
|
507
|
+
* paste-code input + "Submit" button.
|
|
508
|
+
*
|
|
509
|
+
* Co-located with the Claude backend.
|
|
510
|
+
*/
|
|
511
|
+
declare function ClaudeAuthForm({ auth, onAuthComplete }: AuthFormProps): ReactNode;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Vercel AI auth form — API key + optional base URL.
|
|
515
|
+
*
|
|
516
|
+
* Shows base URL input + API key input + "Connect" button.
|
|
517
|
+
*
|
|
518
|
+
* Co-located with the Vercel AI backend.
|
|
519
|
+
*/
|
|
520
|
+
declare function VercelAIAuthForm({ auth, onAuthComplete }: AuthFormProps): ReactNode;
|
|
521
|
+
|
|
522
|
+
/** Props for the BackendSelector component. */
|
|
523
|
+
interface BackendSelectorProps {
|
|
524
|
+
backends: BackendInfo[];
|
|
525
|
+
onSelect: (name: string) => void;
|
|
526
|
+
className?: string;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Headless backend selector showing registered backends with active indicator.
|
|
530
|
+
* Uses data attributes for styling:
|
|
531
|
+
* - `[data-backend-selector]` on root
|
|
532
|
+
* - `[data-backend-item]` on each item
|
|
533
|
+
* - `[data-backend-active="true"]` on the active backend
|
|
534
|
+
* - `[data-backend-name]` with backend name value
|
|
535
|
+
*/
|
|
536
|
+
declare function BackendSelector({ backends, onSelect, className, }: BackendSelectorProps): ReactNode;
|
|
537
|
+
|
|
538
|
+
/** Return type for the useBackends hook. */
|
|
539
|
+
interface UseBackendsReturn {
|
|
540
|
+
backends: BackendInfo[];
|
|
541
|
+
isLoading: boolean;
|
|
542
|
+
error: Error | null;
|
|
543
|
+
refresh: () => void;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Hook for discovering registered backends and switching between them.
|
|
547
|
+
*/
|
|
548
|
+
declare function useBackends(): UseBackendsReturn;
|
|
549
|
+
|
|
550
|
+
/** Return type for the useProviders hook. */
|
|
551
|
+
interface UseProvidersReturn {
|
|
552
|
+
providers: ProviderConfig[];
|
|
553
|
+
isLoading: boolean;
|
|
554
|
+
error: Error | null;
|
|
555
|
+
refresh: () => void;
|
|
556
|
+
createProvider: (config: Omit<ProviderConfig, "id" | "createdAt">) => Promise<void>;
|
|
557
|
+
updateProvider: (id: string, changes: Partial<Omit<ProviderConfig, "id" | "createdAt">>) => Promise<void>;
|
|
558
|
+
deleteProvider: (id: string) => Promise<void>;
|
|
559
|
+
selectProvider: (id: string) => void;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Hook for managing providers (backend + model combos).
|
|
563
|
+
* Requires an IChatClient with provider methods (e.g. RemoteChatClient).
|
|
564
|
+
*/
|
|
565
|
+
declare function useProviders(): UseProvidersReturn;
|
|
566
|
+
|
|
567
|
+
/** Props for the ProviderSelector component. */
|
|
568
|
+
interface ProviderSelectorProps {
|
|
569
|
+
providers: ProviderConfig[];
|
|
570
|
+
activeProviderId?: string;
|
|
571
|
+
onSelect: (id: string) => void;
|
|
572
|
+
onSettingsClick?: () => void;
|
|
573
|
+
className?: string;
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* Headless dropdown for selecting a configured provider.
|
|
577
|
+
* Uses data attributes for styling hooks. Follows ModelSelector pattern.
|
|
578
|
+
*/
|
|
579
|
+
declare function ProviderSelector({ providers, activeProviderId, onSelect, onSettingsClick, className, }: ProviderSelectorProps): ReactNode;
|
|
580
|
+
|
|
581
|
+
/** A unified item rendered in the ProviderModelSelector dropdown. */
|
|
582
|
+
interface ProviderModelItem {
|
|
583
|
+
id: string;
|
|
584
|
+
label: string;
|
|
585
|
+
sublabel?: string;
|
|
586
|
+
tier?: string;
|
|
587
|
+
type: "provider" | "model";
|
|
588
|
+
}
|
|
589
|
+
/** Props for the ProviderModelSelector component. */
|
|
590
|
+
interface ProviderModelSelectorProps {
|
|
591
|
+
/** Configured providers (backend + model combos). When non-empty, provider mode is used. */
|
|
592
|
+
providers?: ProviderConfig[];
|
|
593
|
+
/** Available models. Used when providers is empty or undefined. */
|
|
594
|
+
models?: ModelOption[];
|
|
595
|
+
/** Currently selected provider ID. */
|
|
596
|
+
activeProviderId?: string;
|
|
597
|
+
/** Currently selected model ID (fallback mode). */
|
|
598
|
+
selectedModel?: string;
|
|
599
|
+
/** Called when a provider is selected. */
|
|
600
|
+
onSelectProvider?: (id: string) => void;
|
|
601
|
+
/** Called when a model is selected (fallback mode). */
|
|
602
|
+
onSelectModel?: (modelId: string) => void;
|
|
603
|
+
/** Called when settings gear is clicked. */
|
|
604
|
+
onSettingsClick?: () => void;
|
|
605
|
+
/** Placeholder text for the trigger button. */
|
|
606
|
+
placeholder?: string;
|
|
607
|
+
className?: string;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Unified selector that shows providers when available, falls back to model list.
|
|
611
|
+
* Replaces the need for separate ProviderSelector + ModelSelector in ChatUI.
|
|
612
|
+
*/
|
|
613
|
+
declare function ProviderModelSelector({ providers, models, activeProviderId, selectedModel, onSelectProvider, onSelectModel, onSettingsClick, placeholder, className, }: ProviderModelSelectorProps): ReactNode;
|
|
614
|
+
|
|
615
|
+
/** Props for the ProviderSettings component. */
|
|
616
|
+
interface ProviderSettingsProps {
|
|
617
|
+
providers: ProviderConfig[];
|
|
618
|
+
onClose?: () => void;
|
|
619
|
+
onProviderCreated?: (p: ProviderConfig) => void;
|
|
620
|
+
onProviderDeleted?: (id: string) => void;
|
|
621
|
+
onProviderUpdated?: (id: string, changes: {
|
|
622
|
+
model?: string;
|
|
623
|
+
label?: string;
|
|
624
|
+
}) => void;
|
|
625
|
+
/** Called when authentication succeeds (before configure step). Parent should refresh providers. */
|
|
626
|
+
onAuthCompleted?: (backend: string) => void;
|
|
627
|
+
authBaseUrl?: string;
|
|
628
|
+
className?: string;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Headless settings panel for managing providers.
|
|
632
|
+
* States: list (all providers), add (new provider flow), edit (existing).
|
|
633
|
+
*/
|
|
634
|
+
declare function ProviderSettings({ providers, onClose, onProviderCreated, onProviderDeleted, onProviderUpdated, onAuthCompleted, authBaseUrl, className, }: ProviderSettingsProps): ReactNode;
|
|
635
|
+
|
|
636
|
+
/** Props for the ContextStatsDisplay component. */
|
|
637
|
+
interface ContextStatsDisplayProps {
|
|
638
|
+
/** Context stats from runtime.getContextStats(sessionId). Null = nothing to display. */
|
|
639
|
+
stats: ContextStats | null;
|
|
640
|
+
/** CSS class on the root element. */
|
|
641
|
+
className?: string;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Headless component displaying context window statistics.
|
|
645
|
+
*
|
|
646
|
+
* When real usage data is available (realPromptTokens + modelContextWindow),
|
|
647
|
+
* displays actual token usage and model context window size.
|
|
648
|
+
* When real data is not yet available (before first API response), returns null.
|
|
649
|
+
*
|
|
650
|
+
* All elements use `data-*` attributes for CSS styling — no inline styles.
|
|
651
|
+
*/
|
|
652
|
+
declare function ContextStatsDisplay({ stats, className }: ContextStatsDisplayProps): ReactNode;
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* @witqq/agent-sdk/chat/react — ChatUI
|
|
656
|
+
*
|
|
657
|
+
* Composite component that wires Thread, Composer, ThreadList, ModelSelector,
|
|
658
|
+
* and ProviderSettings into a complete chat interface. Consumers get a full AI chat
|
|
659
|
+
* in ~3 lines:
|
|
660
|
+
*
|
|
661
|
+
* import { ChatUI } from "@witqq/agent-sdk/chat/react";
|
|
662
|
+
* <ChatUI runtime={myRuntime} />
|
|
663
|
+
*
|
|
664
|
+
* Slot system: replace any sub-component while keeping all others as defaults.
|
|
665
|
+
*
|
|
666
|
+
* Built from composable sub-components: ChatLayout, ChatHeader, ChatInputArea,
|
|
667
|
+
* ChatSettingsOverlay — each usable independently for custom layouts.
|
|
668
|
+
*/
|
|
669
|
+
|
|
670
|
+
/** Slot overrides for ChatUI sub-components. */
|
|
671
|
+
interface ChatUISlots {
|
|
672
|
+
/** Replace the Thread component. */
|
|
673
|
+
thread?: ComponentType<ThreadProps>;
|
|
674
|
+
/** Replace the Composer component. */
|
|
675
|
+
composer?: ComponentType<ComposerProps>;
|
|
676
|
+
/** Replace the ThreadList (sidebar) component. */
|
|
677
|
+
threadList?: ComponentType<ThreadListProps>;
|
|
678
|
+
/** Replace the ModelSelector component (used in header when no providers). */
|
|
679
|
+
modelSelector?: ComponentType<ModelSelectorProps>;
|
|
680
|
+
/** Replace the BackendSelector component. */
|
|
681
|
+
backendSelector?: ComponentType<BackendSelectorProps>;
|
|
682
|
+
/** Replace the ProviderSelector component (legacy, use providerModelSelector). */
|
|
683
|
+
providerSelector?: ComponentType<ProviderSelectorProps>;
|
|
684
|
+
/** Replace the unified ProviderModelSelector component (near composer). */
|
|
685
|
+
providerModelSelector?: ComponentType<ProviderModelSelectorProps>;
|
|
686
|
+
/** Replace the ProviderSettings component. */
|
|
687
|
+
providerSettings?: ComponentType<ProviderSettingsProps>;
|
|
688
|
+
/** Replace the ContextStatsDisplay component. */
|
|
689
|
+
contextStats?: ComponentType<ContextStatsDisplayProps>;
|
|
690
|
+
/** Custom auth dialog element rendered when provided. */
|
|
691
|
+
authDialog?: ReactNode;
|
|
692
|
+
/** Custom message renderer (forwarded to ThreadProvider). */
|
|
693
|
+
renderMessage?: (message: ChatMessage, index: number) => ReactNode;
|
|
694
|
+
/** Custom tool call renderer (forwarded to ThreadProvider). */
|
|
695
|
+
renderToolCall?: (part: ToolCallPart, index: number) => ReactNode;
|
|
696
|
+
/** Custom thinking block renderer (forwarded to ThreadProvider). */
|
|
697
|
+
renderThinkingBlock?: (part: ReasoningPart, index: number) => ReactNode;
|
|
698
|
+
}
|
|
699
|
+
/** Props for the ChatUI composite component. */
|
|
700
|
+
interface ChatUIProps {
|
|
701
|
+
/** The chat runtime or client instance. ChatUI wraps it in ChatProvider. Accepts IChatClient. */
|
|
702
|
+
runtime: IChatClient;
|
|
703
|
+
/** Slot overrides for sub-components. */
|
|
704
|
+
slots?: ChatUISlots;
|
|
705
|
+
/** CSS class on the root element. */
|
|
706
|
+
className?: string;
|
|
707
|
+
/** Show the session sidebar. Default: true. */
|
|
708
|
+
showSidebar?: boolean;
|
|
709
|
+
/** Show the model selector header. Default: true. */
|
|
710
|
+
showModelSelector?: boolean;
|
|
711
|
+
/** Show the backend selector in header. Default: false. */
|
|
712
|
+
showBackendSelector?: boolean;
|
|
713
|
+
/** Show the provider selector near composer. Default: auto (true when providers available). */
|
|
714
|
+
showProviderSelector?: boolean;
|
|
715
|
+
/** Base URL for auth API (needed by ProviderSettings). */
|
|
716
|
+
authBaseUrl?: string;
|
|
717
|
+
/** Placeholder text for the Composer textarea. */
|
|
718
|
+
placeholder?: string;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Composite chat component — complete AI chat interface in one import.
|
|
722
|
+
*
|
|
723
|
+
* ```tsx
|
|
724
|
+
* import { ChatUI } from "@witqq/agent-sdk/chat/react";
|
|
725
|
+
*
|
|
726
|
+
* function App() {
|
|
727
|
+
* return <ChatUI runtime={myRuntime} />;
|
|
728
|
+
* }
|
|
729
|
+
* ```
|
|
730
|
+
*/
|
|
731
|
+
declare function ChatUI({ runtime, ...rest }: ChatUIProps): ReactNode;
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* @witqq/agent-sdk/chat/react — ChatLayout
|
|
735
|
+
*
|
|
736
|
+
* Pure layout container for chat interfaces. Renders sidebar + main area
|
|
737
|
+
* without any logic or state. ChatUI uses this internally.
|
|
738
|
+
*/
|
|
739
|
+
|
|
740
|
+
/** Props for the ChatLayout component. */
|
|
741
|
+
interface ChatLayoutProps {
|
|
742
|
+
/** Main chat content (thread, input area, etc.). */
|
|
743
|
+
children: ReactNode;
|
|
744
|
+
/** Sidebar content (thread list, session list, etc.). */
|
|
745
|
+
sidebar?: ReactNode;
|
|
746
|
+
/** Modal/overlay content. Accepts a single node or array of nodes. */
|
|
747
|
+
overlay?: ReactNode | ReactNode[];
|
|
748
|
+
/** CSS class on the root element. */
|
|
749
|
+
className?: string;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* Pure layout container — flex row with optional sidebar and overlay.
|
|
753
|
+
*
|
|
754
|
+
* Renders `[data-chat-ui]` root with:
|
|
755
|
+
* - overlay (rendered first for z-index stacking)
|
|
756
|
+
* - sidebar (rendered before main content)
|
|
757
|
+
* - children (main chat area)
|
|
758
|
+
*/
|
|
759
|
+
declare function ChatLayout({ children, sidebar, overlay, className }: ChatLayoutProps): ReactNode;
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* @witqq/agent-sdk/chat/react — ChatHeader
|
|
763
|
+
*
|
|
764
|
+
* Selector composition for the chat header area. Renders backend selector,
|
|
765
|
+
* model selector, or nothing based on configuration.
|
|
766
|
+
*/
|
|
767
|
+
|
|
768
|
+
/** Props for the ChatHeader component. */
|
|
769
|
+
interface ChatHeaderProps {
|
|
770
|
+
/** Whether to show backend selector. Default: false. */
|
|
771
|
+
showBackendSelector?: boolean;
|
|
772
|
+
/** Whether to show model selector. Default: true. */
|
|
773
|
+
showModelSelector?: boolean;
|
|
774
|
+
/** Whether providers are configured (hides model selector when true). */
|
|
775
|
+
hasProviders?: boolean;
|
|
776
|
+
/** Available backends list. */
|
|
777
|
+
backends?: BackendInfo[];
|
|
778
|
+
/** Available models list. */
|
|
779
|
+
models?: ModelOption[];
|
|
780
|
+
/** Currently selected model. */
|
|
781
|
+
selectedModel?: string;
|
|
782
|
+
/** Backend selection handler. */
|
|
783
|
+
onBackendSelect?: (name: string) => void;
|
|
784
|
+
/** Model selection handler. */
|
|
785
|
+
onModelSelect?: (modelId: string) => void;
|
|
786
|
+
/** Slot override for BackendSelector. */
|
|
787
|
+
BackendSelectorComponent?: ComponentType<BackendSelectorProps>;
|
|
788
|
+
/** Slot override for ModelSelector. */
|
|
789
|
+
ModelSelectorComponent?: ComponentType<ModelSelectorProps>;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Header area with backend and model selectors.
|
|
793
|
+
* Returns null when no selectors need to be shown.
|
|
794
|
+
*/
|
|
795
|
+
declare function ChatHeader({ showBackendSelector, showModelSelector, hasProviders, backends, models, selectedModel, onBackendSelect, onModelSelect, BackendSelectorComponent: BSC, ModelSelectorComponent: MSC, }: ChatHeaderProps): ReactNode;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* @witqq/agent-sdk/chat/react — ChatInputArea
|
|
799
|
+
*
|
|
800
|
+
* Input area combining the unified provider/model selector with the composer.
|
|
801
|
+
*/
|
|
802
|
+
|
|
803
|
+
/** Props for the ChatInputArea component. */
|
|
804
|
+
interface ChatInputAreaProps {
|
|
805
|
+
/** Send message handler. */
|
|
806
|
+
onSend: (message: string) => void;
|
|
807
|
+
/** Stop generation handler. */
|
|
808
|
+
onStop?: () => void;
|
|
809
|
+
/** Whether generation is in progress. */
|
|
810
|
+
isGenerating?: boolean;
|
|
811
|
+
/** Placeholder text for the textarea. */
|
|
812
|
+
placeholder?: string;
|
|
813
|
+
/** Available providers. */
|
|
814
|
+
providers?: ProviderConfig[];
|
|
815
|
+
/** Available models. */
|
|
816
|
+
models?: ModelOption[];
|
|
817
|
+
/** Active provider ID. */
|
|
818
|
+
activeProviderId?: string;
|
|
819
|
+
/** Selected model. */
|
|
820
|
+
selectedModel?: string;
|
|
821
|
+
/** Provider selection handler. */
|
|
822
|
+
onSelectProvider?: (id: string) => void;
|
|
823
|
+
/** Model selection handler. */
|
|
824
|
+
onSelectModel?: (modelId: string) => void;
|
|
825
|
+
/** Settings button handler. */
|
|
826
|
+
onSettingsClick?: () => void;
|
|
827
|
+
/** Slot override for Composer. */
|
|
828
|
+
ComposerComponent?: ComponentType<ComposerProps>;
|
|
829
|
+
/** Slot override for ProviderModelSelector. */
|
|
830
|
+
ProviderModelSelectorComponent?: ComponentType<ProviderModelSelectorProps>;
|
|
831
|
+
/** Token usage data to display. */
|
|
832
|
+
usage?: ChatUsage | null;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Input area — unified selector + composer in a `[data-chat-input-area]` container.
|
|
836
|
+
*/
|
|
837
|
+
declare function ChatInputArea({ onSend, onStop, isGenerating, placeholder, providers, models, activeProviderId, selectedModel, onSelectProvider, onSelectModel, onSettingsClick, ComposerComponent: CC, ProviderModelSelectorComponent: PMSC, usage, }: ChatInputAreaProps): ReactNode;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* @witqq/agent-sdk/chat/react — ChatSettingsOverlay
|
|
841
|
+
*
|
|
842
|
+
* Modal overlay for provider settings management.
|
|
843
|
+
* Features: backdrop click-to-close, ESC key handler, focus trap.
|
|
844
|
+
*/
|
|
845
|
+
|
|
846
|
+
/** Props for the ChatSettingsOverlay component. */
|
|
847
|
+
interface ChatSettingsOverlayProps {
|
|
848
|
+
/** Whether the overlay is visible. */
|
|
849
|
+
open: boolean;
|
|
850
|
+
/** Close handler. */
|
|
851
|
+
onClose: () => void;
|
|
852
|
+
/** Available providers. */
|
|
853
|
+
providers?: ProviderConfig[];
|
|
854
|
+
/** Auth API base URL. */
|
|
855
|
+
authBaseUrl?: string;
|
|
856
|
+
/** Provider created handler. */
|
|
857
|
+
onProviderCreated?: (provider: {
|
|
858
|
+
backend: string;
|
|
859
|
+
model: string;
|
|
860
|
+
label?: string;
|
|
861
|
+
}) => void;
|
|
862
|
+
/** Provider deleted handler. */
|
|
863
|
+
onProviderDeleted?: (id: string) => void;
|
|
864
|
+
/** Provider updated handler. */
|
|
865
|
+
onProviderUpdated?: (id: string, changes: Partial<ProviderConfig>) => void;
|
|
866
|
+
/** Called when authentication succeeds. Parent should refresh providers. */
|
|
867
|
+
onAuthCompleted?: (backend: string) => void;
|
|
868
|
+
/** Slot override for ProviderSettings. */
|
|
869
|
+
ProviderSettingsComponent?: ComponentType<ProviderSettingsProps>;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Settings modal — renders `[data-provider-settings-overlay]` when open.
|
|
873
|
+
* Returns null when closed.
|
|
874
|
+
* Backdrop click and Escape key close the overlay with exit animation.
|
|
875
|
+
* Focus is trapped within the overlay content.
|
|
876
|
+
*/
|
|
877
|
+
declare function ChatSettingsOverlay({ open, onClose, providers, authBaseUrl, onProviderCreated, onProviderDeleted, onProviderUpdated, onAuthCompleted, ProviderSettingsComponent: PSC, }: ChatSettingsOverlayProps): ReactNode;
|
|
878
|
+
|
|
879
|
+
/** Props for the UsageBadge component. */
|
|
880
|
+
interface UsageBadgeProps {
|
|
881
|
+
usage: ChatUsage | null;
|
|
882
|
+
className?: string;
|
|
883
|
+
}
|
|
884
|
+
/** Compact token usage display. Shows prompt/completion/total tokens. */
|
|
885
|
+
declare function UsageBadge({ usage, className }: UsageBadgeProps): ReactNode;
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* Client-side adapter that implements IChatClient by delegating
|
|
889
|
+
* operations over HTTP/SSE to a remote server.
|
|
890
|
+
*
|
|
891
|
+
* Bridges the gap between SDK React hooks (which require an in-process runtime)
|
|
892
|
+
* and the common architecture where ChatRuntime runs on a server.
|
|
893
|
+
*
|
|
894
|
+
* @example
|
|
895
|
+
* ```ts
|
|
896
|
+
* import { RemoteChatClient } from "@witqq/agent-sdk/chat/react";
|
|
897
|
+
* import { ChatProvider } from "@witqq/agent-sdk/chat/react";
|
|
898
|
+
*
|
|
899
|
+
* const client = new RemoteChatClient({ baseUrl: "/api" });
|
|
900
|
+
* <ChatProvider runtime={client}> ... </ChatProvider>
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Standard server endpoint contract.
|
|
906
|
+
* Server implementations expose these routes to work with RemoteChatClient.
|
|
907
|
+
*
|
|
908
|
+
* POST {baseUrl}/sessions/create — Create session
|
|
909
|
+
* GET {baseUrl}/sessions/{id} — Get session
|
|
910
|
+
* GET {baseUrl}/sessions — List sessions
|
|
911
|
+
* DELETE {baseUrl}/sessions/{id} — Delete session
|
|
912
|
+
* GET {baseUrl}/sessions/{id}/context-stats — Get context window stats
|
|
913
|
+
* POST {baseUrl}/send — Send message (SSE stream response)
|
|
914
|
+
* POST {baseUrl}/abort — Abort current stream
|
|
915
|
+
* GET {baseUrl}/models — List models
|
|
916
|
+
* GET {baseUrl}/backends — List backends
|
|
917
|
+
* POST {baseUrl}/model/switch — Switch model
|
|
918
|
+
* POST {baseUrl}/provider/switch — Switch provider (backend + model)
|
|
919
|
+
* GET {baseUrl}/providers — List providers
|
|
920
|
+
* POST {baseUrl}/providers — Create provider
|
|
921
|
+
* PUT {baseUrl}/providers/{id} — Update provider
|
|
922
|
+
* DELETE {baseUrl}/providers/{id} — Delete provider
|
|
923
|
+
*/
|
|
924
|
+
interface RemoteChatClientOptions {
|
|
925
|
+
/** Base URL for API endpoints (e.g. "/api" or "https://example.com/api") */
|
|
926
|
+
baseUrl: string;
|
|
927
|
+
/** Optional headers for all requests (e.g. auth tokens) */
|
|
928
|
+
headers?: Record<string, string>;
|
|
929
|
+
/** Custom fetch implementation for testability */
|
|
930
|
+
fetch?: typeof globalThis.fetch;
|
|
931
|
+
}
|
|
932
|
+
declare class RemoteChatClient implements IChatClient {
|
|
933
|
+
private _status;
|
|
934
|
+
private _activeSessionId;
|
|
935
|
+
private _selectedProviderId;
|
|
936
|
+
private _abortController;
|
|
937
|
+
private readonly baseUrl;
|
|
938
|
+
private readonly headers;
|
|
939
|
+
private readonly _fetch;
|
|
940
|
+
private readonly _selectionListeners;
|
|
941
|
+
constructor(options: RemoteChatClientOptions);
|
|
942
|
+
get status(): RuntimeStatus;
|
|
943
|
+
dispose(): Promise<void>;
|
|
944
|
+
private assertNotDisposed;
|
|
945
|
+
get selectedProviderId(): string | null;
|
|
946
|
+
selectProvider(providerId: string): void;
|
|
947
|
+
onSelectionChange(callback: SelectionChangeCallback): () => void;
|
|
948
|
+
private _notifySelectionChange;
|
|
949
|
+
get activeSessionId(): ChatId | null;
|
|
950
|
+
createSession(options: CreateSessionOptions): Promise<ChatSession>;
|
|
951
|
+
getSession(id: ChatIdLike): Promise<ChatSession | null>;
|
|
952
|
+
listSessions(_options?: SessionListOptions): Promise<ChatSession[]>;
|
|
953
|
+
deleteSession(id: ChatIdLike): Promise<void>;
|
|
954
|
+
/**
|
|
955
|
+
* Fetch context window stats from server.
|
|
956
|
+
* Returns null if stats not available (e.g. no messages sent yet).
|
|
957
|
+
*/
|
|
958
|
+
getContextStats(sessionId: ChatIdLike): Promise<ContextStats | null>;
|
|
959
|
+
switchSession(id: ChatIdLike): Promise<ChatSession>;
|
|
960
|
+
send(sessionId: ChatIdLike, message: string, options?: SendMessageOptions): AsyncIterable<ChatEvent>;
|
|
961
|
+
abort(): void;
|
|
962
|
+
listModels(): Promise<ModelInfo[]>;
|
|
963
|
+
listBackends(): Promise<BackendInfo[]>;
|
|
964
|
+
listProviders(): Promise<ProviderConfig[]>;
|
|
965
|
+
createProvider(config: Omit<ProviderConfig, "id" | "createdAt">): Promise<ProviderConfig>;
|
|
966
|
+
updateProvider(id: string, changes: Partial<Omit<ProviderConfig, "id" | "createdAt">>): Promise<void>;
|
|
967
|
+
deleteProvider(id: string): Promise<void>;
|
|
968
|
+
private readonly _sessionListeners;
|
|
969
|
+
onSessionChange(callback: () => void): () => void;
|
|
970
|
+
private _notifySessionChange;
|
|
971
|
+
private _get;
|
|
972
|
+
private _post;
|
|
973
|
+
private _delete;
|
|
974
|
+
private _put;
|
|
975
|
+
private _parseSSEStream;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* @witqq/agent-sdk/chat/react — useCopilotAuth
|
|
980
|
+
*
|
|
981
|
+
* Server-delegated Copilot Device Flow authentication hook.
|
|
982
|
+
* Independently usable — does not require useRemoteAuth orchestrator.
|
|
983
|
+
*/
|
|
984
|
+
|
|
985
|
+
/** Options for useCopilotAuth. */
|
|
986
|
+
interface UseCopilotAuthOptions {
|
|
987
|
+
/** Base URL of the auth server (e.g. "/api/auth") */
|
|
988
|
+
baseUrl: string;
|
|
989
|
+
/** Called after successful authentication */
|
|
990
|
+
onAuthenticated?: (token: AuthToken) => void;
|
|
991
|
+
/** Called on authentication error */
|
|
992
|
+
onError?: (error: Error) => void;
|
|
993
|
+
/** Optional fetch override (for testing) */
|
|
994
|
+
fetch?: typeof globalThis.fetch;
|
|
995
|
+
/** Optional headers for all requests */
|
|
996
|
+
headers?: Record<string, string>;
|
|
997
|
+
}
|
|
998
|
+
/** Return value from useCopilotAuth. */
|
|
999
|
+
interface UseCopilotAuthReturn {
|
|
1000
|
+
status: "idle" | "pending" | "authenticated" | "error";
|
|
1001
|
+
error: Error | null;
|
|
1002
|
+
token: AuthToken | null;
|
|
1003
|
+
deviceCode: string | null;
|
|
1004
|
+
verificationUrl: string | null;
|
|
1005
|
+
/** Start the device flow. Shows deviceCode and verificationUrl, then polls for completion. */
|
|
1006
|
+
start: () => Promise<void>;
|
|
1007
|
+
reset: () => void;
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Copilot Device Flow authentication.
|
|
1011
|
+
* Starts device flow on server, provides code/URL for user, polls until complete.
|
|
1012
|
+
*/
|
|
1013
|
+
declare function useCopilotAuth(options: UseCopilotAuthOptions): UseCopilotAuthReturn;
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* @witqq/agent-sdk/chat/react — useClaudeAuth
|
|
1017
|
+
*
|
|
1018
|
+
* Server-delegated Claude OAuth + PKCE authentication hook.
|
|
1019
|
+
* Independently usable — does not require useRemoteAuth orchestrator.
|
|
1020
|
+
*/
|
|
1021
|
+
|
|
1022
|
+
/** Options for useClaudeAuth. */
|
|
1023
|
+
interface UseClaudeAuthOptions {
|
|
1024
|
+
/** Base URL of the auth server (e.g. "/api/auth") */
|
|
1025
|
+
baseUrl: string;
|
|
1026
|
+
/** Called after successful authentication */
|
|
1027
|
+
onAuthenticated?: (token: AuthToken) => void;
|
|
1028
|
+
/** Called on authentication error */
|
|
1029
|
+
onError?: (error: Error) => void;
|
|
1030
|
+
/** Optional fetch override (for testing) */
|
|
1031
|
+
fetch?: typeof globalThis.fetch;
|
|
1032
|
+
/** Optional headers for all requests */
|
|
1033
|
+
headers?: Record<string, string>;
|
|
1034
|
+
}
|
|
1035
|
+
/** Return value from useClaudeAuth. */
|
|
1036
|
+
interface UseClaudeAuthReturn {
|
|
1037
|
+
status: "idle" | "pending" | "authenticated" | "error";
|
|
1038
|
+
error: Error | null;
|
|
1039
|
+
token: AuthToken | null;
|
|
1040
|
+
authorizeUrl: string | null;
|
|
1041
|
+
/** Start OAuth flow. Sets authorizeUrl for user redirect. */
|
|
1042
|
+
start: () => Promise<void>;
|
|
1043
|
+
/** Complete OAuth after redirect. Pass the code or callback URL. */
|
|
1044
|
+
complete: (codeOrUrl: string) => Promise<void>;
|
|
1045
|
+
reset: () => void;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Claude OAuth + PKCE authentication.
|
|
1049
|
+
* Two-step flow: start() gets authorizeUrl → user redirects → complete(code) finishes.
|
|
1050
|
+
*/
|
|
1051
|
+
declare function useClaudeAuth(options: UseClaudeAuthOptions): UseClaudeAuthReturn;
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* @witqq/agent-sdk/chat/react — useApiKeyAuth
|
|
1055
|
+
*
|
|
1056
|
+
* Server-delegated API key authentication hook (for Vercel AI / OpenRouter / etc.).
|
|
1057
|
+
* Independently usable — does not require useRemoteAuth orchestrator.
|
|
1058
|
+
*/
|
|
1059
|
+
|
|
1060
|
+
/** Options for useApiKeyAuth. */
|
|
1061
|
+
interface UseApiKeyAuthOptions {
|
|
1062
|
+
/** Base URL of the auth server (e.g. "/api/auth") */
|
|
1063
|
+
baseUrl: string;
|
|
1064
|
+
/** Called after successful authentication */
|
|
1065
|
+
onAuthenticated?: (token: AuthToken) => void;
|
|
1066
|
+
/** Called on authentication error */
|
|
1067
|
+
onError?: (error: Error) => void;
|
|
1068
|
+
/** Optional fetch override (for testing) */
|
|
1069
|
+
fetch?: typeof globalThis.fetch;
|
|
1070
|
+
/** Optional headers for all requests */
|
|
1071
|
+
headers?: Record<string, string>;
|
|
1072
|
+
}
|
|
1073
|
+
/** Return value from useApiKeyAuth. */
|
|
1074
|
+
interface UseApiKeyAuthReturn {
|
|
1075
|
+
status: "idle" | "pending" | "authenticated" | "error";
|
|
1076
|
+
error: Error | null;
|
|
1077
|
+
token: AuthToken | null;
|
|
1078
|
+
/** Submit an API key (and optional provider base URL). */
|
|
1079
|
+
submit: (key: string, apiBaseUrl?: string) => Promise<void>;
|
|
1080
|
+
reset: () => void;
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* API key authentication.
|
|
1084
|
+
* Sends key to server for validation and storage.
|
|
1085
|
+
*/
|
|
1086
|
+
declare function useApiKeyAuth(options: UseApiKeyAuthOptions): UseApiKeyAuthReturn;
|
|
1087
|
+
|
|
1088
|
+
export { type AuthFormComponent, type AuthFormProps, BackendSelector, type BackendSelectorProps, ChatHeader, type ChatHeaderProps, ChatInputArea, type ChatInputAreaProps, ChatLayout, type ChatLayoutProps, ChatProvider, ChatSettingsOverlay, type ChatSettingsOverlayProps, ChatUI, type ChatUIProps, type ChatUISlots, type ChatUsage, ClaudeAuthForm, Composer, type ComposerProps, ContextStatsDisplay, type ContextStatsDisplayProps, CopilotAuthForm, MarkdownRenderer, type MarkdownRendererProps, Message, type MessageProps, type ModelOption, ModelSelector, type ModelSelectorProps, type PendingToolRequest, type ProviderModelItem, ProviderModelSelector, type ProviderModelSelectorProps, ProviderSelector, type ProviderSelectorProps, ProviderSettings, type ProviderSettingsProps, type RemoteAuthBackend, type RemoteAuthStatus, RemoteChatClient, type RemoteChatClientOptions, type RemoteChatPhase, type SSEStatus, ThinkingBlock, type ThinkingBlockProps, Thread, ThreadList, type ThreadListProps, type ThreadProps, ThreadProvider, type ThreadProviderProps, type ThreadSlotOverrides, ToolCallView, type ToolCallViewProps, UsageBadge, type UsageBadgeProps, type UseApiKeyAuthOptions, type UseApiKeyAuthReturn, type UseBackendsReturn, type UseChatOptions, type UseChatReturn, type UseClaudeAuthOptions, type UseClaudeAuthReturn, type UseCopilotAuthOptions, type UseCopilotAuthReturn, type UseMessagesOptions, type UseMessagesReturn, type UseModelsReturn, type UseProvidersReturn, type UseRemoteAuthOptions, type UseRemoteAuthReturn, type UseRemoteChatOptions, type UseRemoteChatReturn, type UseSSEOptions, type UseSSEReturn, type UseSessionsReturn, type UseToolApprovalReturn, VercelAIAuthForm, useApiKeyAuth, useBackends, useChat, useChatRuntime, useClaudeAuth, useCopilotAuth, useMessages, useModels, useOptionalThreadSlots, useProviders, useRemoteAuth, useRemoteChat, useSSE, useSessions, useThreadSlots, useToolApproval };
|