@aomi-labs/widget-lib 0.2.0 → 1.0.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 +23 -292
- package/dist/index.cjs +3780 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +302 -0
- package/dist/index.d.ts +277 -791
- package/dist/index.js +3654 -3247
- package/dist/index.js.map +1 -1
- package/dist/styles.css +168 -0
- package/package.json +91 -72
- package/dist/core/AomiChatWidget.d.ts +0 -41
- package/dist/core/AomiChatWidget.d.ts.map +0 -1
- package/dist/core/ChatManager.d.ts +0 -81
- package/dist/core/ChatManager.d.ts.map +0 -1
- package/dist/core/ThemeManager.d.ts +0 -80
- package/dist/core/ThemeManager.d.ts.map +0 -1
- package/dist/core/WalletManager.d.ts +0 -105
- package/dist/core/WalletManager.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.mjs +0 -3215
- package/dist/index.mjs.map +0 -1
- package/dist/index.umd.js +0 -3295
- package/dist/index.umd.js.map +0 -1
- package/dist/types/constants.d.ts +0 -91
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/errors.d.ts +0 -102
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -263
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -99
- package/dist/utils/index.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,816 +1,302 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import { CSSProperties, ReactNode, FC, ComponentPropsWithRef } from 'react';
|
|
4
|
+
import { ThreadMessageLike, ToolCallMessagePartComponent } from '@assistant-ui/react';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
7
|
+
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
8
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
9
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
10
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
11
|
+
import { ClassValue } from 'clsx';
|
|
2
12
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare const DEFAULT_RECONNECT_DELAY = 3000;
|
|
9
|
-
declare const SUPPORTED_CHAINS: Record<SupportedChainId, string>;
|
|
10
|
-
declare const DEFAULT_CHAIN_ID: SupportedChainId;
|
|
11
|
-
declare const THEME_PALETTES: Record<string, AomiChatWidgetPaletteColors>;
|
|
12
|
-
declare const PREDEFINED_THEMES: Record<string, ThemeDefinition>;
|
|
13
|
-
declare const ERROR_CODES: {
|
|
14
|
-
readonly INVALID_CONFIG: "INVALID_CONFIG";
|
|
15
|
-
readonly MISSING_APP_CODE: "MISSING_APP_CODE";
|
|
16
|
-
readonly INVALID_THEME: "INVALID_THEME";
|
|
17
|
-
readonly INVALID_DIMENSIONS: "INVALID_DIMENSIONS";
|
|
18
|
-
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
19
|
-
readonly CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
20
|
-
readonly BACKEND_UNAVAILABLE: "BACKEND_UNAVAILABLE";
|
|
21
|
-
readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
|
|
22
|
-
readonly WALLET_NOT_CONNECTED: "WALLET_NOT_CONNECTED";
|
|
23
|
-
readonly WALLET_CONNECTION_FAILED: "WALLET_CONNECTION_FAILED";
|
|
24
|
-
readonly UNSUPPORTED_NETWORK: "UNSUPPORTED_NETWORK";
|
|
25
|
-
readonly TRANSACTION_FAILED: "TRANSACTION_FAILED";
|
|
26
|
-
readonly TRANSACTION_REJECTED: "TRANSACTION_REJECTED";
|
|
27
|
-
readonly MESSAGE_TOO_LONG: "MESSAGE_TOO_LONG";
|
|
28
|
-
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
29
|
-
readonly INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
30
|
-
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
31
|
-
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
32
|
-
readonly INITIALIZATION_FAILED: "INITIALIZATION_FAILED";
|
|
33
|
-
readonly PROVIDER_ERROR: "PROVIDER_ERROR";
|
|
34
|
-
};
|
|
35
|
-
declare const WIDGET_EVENTS: {
|
|
36
|
-
readonly READY: "ready";
|
|
37
|
-
readonly DESTROY: "destroy";
|
|
38
|
-
readonly RESIZE: "resize";
|
|
39
|
-
readonly MESSAGE: "message";
|
|
40
|
-
readonly TYPING_CHANGE: "typingChange";
|
|
41
|
-
readonly PROCESSING_CHANGE: "processingChange";
|
|
42
|
-
readonly CONNECTION_CHANGE: "connectionChange";
|
|
43
|
-
readonly SESSION_START: "sessionStart";
|
|
44
|
-
readonly SESSION_END: "sessionEnd";
|
|
45
|
-
readonly WALLET_CONNECT: "walletConnect";
|
|
46
|
-
readonly WALLET_DISCONNECT: "walletDisconnect";
|
|
47
|
-
readonly NETWORK_CHANGE: "networkChange";
|
|
48
|
-
readonly TRANSACTION_REQUEST: "transactionRequest";
|
|
49
|
-
readonly ERROR: "error";
|
|
50
|
-
};
|
|
51
|
-
declare const CSS_CLASSES: {
|
|
52
|
-
readonly WIDGET_ROOT: "aomi-chat-widget";
|
|
53
|
-
readonly WIDGET_CONTAINER: "aomi-chat-container";
|
|
54
|
-
readonly WIDGET_IFRAME: "aomi-chat-iframe";
|
|
55
|
-
readonly THEME_LIGHT: "aomi-theme-light";
|
|
56
|
-
readonly THEME_DARK: "aomi-theme-dark";
|
|
57
|
-
readonly THEME_TERMINAL: "aomi-theme-terminal";
|
|
58
|
-
readonly THEME_NEON: "aomi-theme-neon";
|
|
59
|
-
readonly THEME_MINIMAL: "aomi-theme-minimal";
|
|
60
|
-
readonly MODE_FULL: "aomi-mode-full";
|
|
61
|
-
readonly MODE_MINIMAL: "aomi-mode-minimal";
|
|
62
|
-
readonly MODE_COMPACT: "aomi-mode-compact";
|
|
63
|
-
readonly MODE_TERMINAL: "aomi-mode-terminal";
|
|
64
|
-
readonly CHAT_INTERFACE: "aomi-chat-interface";
|
|
65
|
-
readonly CHAT_HEADER: "aomi-chat-header";
|
|
66
|
-
readonly CHAT_TITLE: "aomi-chat-title";
|
|
67
|
-
readonly CHAT_BODY: "aomi-chat-body";
|
|
68
|
-
readonly STATUS_BADGE: "aomi-status-badge";
|
|
69
|
-
readonly MESSAGE_LIST: "aomi-message-list";
|
|
70
|
-
readonly MESSAGE_CONTAINER: "aomi-message-container";
|
|
71
|
-
readonly MESSAGE_BUBBLE: "aomi-message";
|
|
72
|
-
readonly MESSAGE_USER: "aomi-message-user";
|
|
73
|
-
readonly MESSAGE_ASSISTANT: "aomi-message-assistant";
|
|
74
|
-
readonly MESSAGE_SYSTEM: "aomi-message-system";
|
|
75
|
-
readonly ACTION_BAR: "aomi-action-bar";
|
|
76
|
-
readonly MESSAGE_INPUT: "aomi-message-input";
|
|
77
|
-
readonly INPUT_FORM: "aomi-chat-input-form";
|
|
78
|
-
readonly INPUT_FIELD: "aomi-chat-input-field";
|
|
79
|
-
readonly SEND_BUTTON: "aomi-chat-send-button";
|
|
80
|
-
readonly WALLET_STATUS: "aomi-wallet-status";
|
|
81
|
-
readonly TYPING_INDICATOR: "aomi-typing-indicator";
|
|
82
|
-
readonly LOADING: "aomi-loading";
|
|
83
|
-
readonly ERROR: "aomi-error";
|
|
84
|
-
readonly DISABLED: "aomi-disabled";
|
|
85
|
-
readonly CONNECTED: "aomi-connected";
|
|
86
|
-
readonly DISCONNECTED: "aomi-disconnected";
|
|
87
|
-
};
|
|
88
|
-
declare const API_ENDPOINTS: {
|
|
89
|
-
readonly CHAT: "/api/chat";
|
|
90
|
-
readonly CHAT_STREAM: "/api/chat/stream";
|
|
91
|
-
readonly STATE: "/api/state";
|
|
92
|
-
readonly INTERRUPT: "/api/interrupt";
|
|
93
|
-
readonly SYSTEM: "/api/system";
|
|
94
|
-
readonly MCP_COMMAND: "/api/mcp-command";
|
|
95
|
-
readonly HEALTH: "/health";
|
|
13
|
+
type WalletButtonState = {
|
|
14
|
+
address?: string;
|
|
15
|
+
chainId?: number;
|
|
16
|
+
isConnected: boolean;
|
|
17
|
+
ensName?: string;
|
|
96
18
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
readonly CONNECTION_TIMEOUT: 10000;
|
|
101
|
-
readonly RETRY_DELAY: 1000;
|
|
102
|
-
readonly HEARTBEAT_INTERVAL: 30000;
|
|
103
|
-
readonly SESSION_TIMEOUT: 3600000;
|
|
19
|
+
type WalletFooterProps = {
|
|
20
|
+
wallet: WalletButtonState;
|
|
21
|
+
setWallet: (data: Partial<WalletButtonState>) => void;
|
|
104
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Get network name from chainId
|
|
25
|
+
*/
|
|
26
|
+
declare const getNetworkName: (chainId: number | string | undefined) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Format wallet address for display (0x1234...5678)
|
|
29
|
+
*/
|
|
30
|
+
declare const formatAddress: (addr?: string) => string;
|
|
105
31
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
readonly details?: unknown;
|
|
110
|
-
constructor(code: string, message: string, details?: unknown);
|
|
111
|
-
toJSON(): {
|
|
112
|
-
name: string;
|
|
113
|
-
code: string;
|
|
114
|
-
message: string;
|
|
115
|
-
timestamp: string;
|
|
116
|
-
details: unknown;
|
|
117
|
-
stack: string | undefined;
|
|
118
|
-
};
|
|
119
|
-
toString(): string;
|
|
120
|
-
}
|
|
121
|
-
declare class ConfigurationError extends AomiChatError$1 {
|
|
122
|
-
constructor(message: string, details?: unknown);
|
|
123
|
-
}
|
|
124
|
-
declare class ConnectionError extends AomiChatError$1 {
|
|
125
|
-
constructor(message: string, details?: unknown);
|
|
126
|
-
}
|
|
127
|
-
declare class WalletError extends AomiChatError$1 {
|
|
128
|
-
constructor(code: string, message: string, details?: unknown);
|
|
129
|
-
}
|
|
130
|
-
declare class TransactionError extends WalletError {
|
|
131
|
-
constructor(message: string, details?: unknown);
|
|
132
|
-
}
|
|
133
|
-
declare class ChatError extends AomiChatError$1 {
|
|
134
|
-
constructor(code: string, message: string, details?: unknown);
|
|
135
|
-
}
|
|
136
|
-
declare class RateLimitError extends ChatError {
|
|
137
|
-
constructor(message: string, details?: unknown);
|
|
138
|
-
}
|
|
139
|
-
declare class SessionError extends AomiChatError$1 {
|
|
140
|
-
constructor(message: string, details?: unknown);
|
|
141
|
-
}
|
|
142
|
-
declare function createConfigurationError(message: string, details?: unknown): ConfigurationError;
|
|
143
|
-
declare function createConnectionError(message: string, details?: unknown): ConnectionError;
|
|
144
|
-
declare function createWalletError(code: string, message: string, details?: unknown): WalletError;
|
|
145
|
-
declare function createTransactionError(message: string, details?: unknown): TransactionError;
|
|
146
|
-
declare function createChatError(code: string, message: string, details?: unknown): ChatError;
|
|
147
|
-
declare function createRateLimitError(message: string, details?: unknown): RateLimitError;
|
|
148
|
-
declare function createSessionError(message: string, details?: unknown): SessionError;
|
|
149
|
-
declare function isAomiChatError(error: unknown): error is AomiChatError$1;
|
|
150
|
-
declare function isConfigurationError(error: unknown): error is ConfigurationError;
|
|
151
|
-
declare function isConnectionError(error: unknown): error is ConnectionError;
|
|
152
|
-
declare function isWalletError(error: unknown): error is WalletError;
|
|
153
|
-
declare function isTransactionError(error: unknown): error is TransactionError;
|
|
154
|
-
declare function isChatError(error: unknown): error is ChatError;
|
|
155
|
-
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
156
|
-
declare function isSessionError(error: unknown): error is SessionError;
|
|
157
|
-
|
|
158
|
-
type SupportedChainId = 1 | 5 | 10 | 100 | 1337 | 31337 | 137 | 42161 | 59140 | 59144 | 8453 | 11155111;
|
|
159
|
-
type PerNetworkConfig<T> = Partial<Record<SupportedChainId, T>>;
|
|
160
|
-
type PerModeConfig<T> = Partial<Record<AomiChatMode, T>>;
|
|
161
|
-
type FlexibleConfig<T> = T | PerNetworkConfig<T> | PerModeConfig<T> | PerModeConfig<PerNetworkConfig<T>> | PerNetworkConfig<PerModeConfig<T>>;
|
|
162
|
-
interface ChatMessage {
|
|
163
|
-
id: string;
|
|
164
|
-
type: 'user' | 'assistant' | 'system';
|
|
165
|
-
content: string;
|
|
166
|
-
timestamp: Date;
|
|
167
|
-
toolStream?: {
|
|
168
|
-
topic: string;
|
|
169
|
-
content: string;
|
|
170
|
-
};
|
|
171
|
-
metadata?: Record<string, unknown>;
|
|
172
|
-
}
|
|
173
|
-
interface WalletTransaction {
|
|
174
|
-
to: string;
|
|
175
|
-
value: string;
|
|
176
|
-
data: string;
|
|
177
|
-
gas?: string;
|
|
178
|
-
description: string;
|
|
179
|
-
timestamp: string;
|
|
180
|
-
}
|
|
181
|
-
type AomiChatMode = 'full' | 'minimal' | 'compact' | 'terminal';
|
|
182
|
-
type AomiChatTheme = 'light' | 'dark' | 'terminal' | 'neon' | 'minimal';
|
|
183
|
-
interface AomiChatWidgetPaletteColors {
|
|
184
|
-
primary: string;
|
|
185
|
-
background: string;
|
|
186
|
-
surface: string;
|
|
187
|
-
text: string;
|
|
188
|
-
textSecondary: string;
|
|
189
|
-
border: string;
|
|
190
|
-
success: string;
|
|
191
|
-
error: string;
|
|
192
|
-
warning: string;
|
|
193
|
-
accent: string;
|
|
194
|
-
}
|
|
195
|
-
interface AomiChatWidgetPalette extends AomiChatWidgetPaletteColors {
|
|
196
|
-
baseTheme: AomiChatTheme;
|
|
197
|
-
}
|
|
198
|
-
interface RateLimitConfig {
|
|
199
|
-
maxMessages?: number;
|
|
200
|
-
windowMs?: number;
|
|
201
|
-
skipWhenConnected?: boolean;
|
|
202
|
-
}
|
|
203
|
-
interface AnalyticsConfig {
|
|
204
|
-
trackEvents?: boolean;
|
|
205
|
-
customId?: string;
|
|
206
|
-
excludeContent?: boolean;
|
|
207
|
-
}
|
|
208
|
-
interface ChatCommand {
|
|
209
|
-
command: string;
|
|
210
|
-
description: string;
|
|
211
|
-
handler: (args: string[]) => Promise<void> | void;
|
|
212
|
-
}
|
|
213
|
-
interface AomiChatWidgetParams {
|
|
214
|
-
appCode: string;
|
|
215
|
-
width?: string;
|
|
216
|
-
height?: string;
|
|
217
|
-
maxHeight?: number;
|
|
218
|
-
baseUrl?: string;
|
|
219
|
-
sessionId?: string;
|
|
220
|
-
theme?: AomiChatTheme | AomiChatWidgetPalette;
|
|
221
|
-
mode?: AomiChatMode;
|
|
222
|
-
welcomeMessage?: string;
|
|
223
|
-
placeholder?: string;
|
|
224
|
-
showWalletStatus?: boolean;
|
|
225
|
-
showNetworkSelector?: boolean;
|
|
226
|
-
hideHeader?: boolean;
|
|
227
|
-
hideFooter?: boolean;
|
|
228
|
-
chainId?: SupportedChainId;
|
|
229
|
-
supportedChains?: SupportedChainId[];
|
|
230
|
-
enableTransactions?: boolean;
|
|
231
|
-
requireWalletConnection?: boolean;
|
|
232
|
-
sessionPersistence?: boolean;
|
|
233
|
-
autoConnect?: boolean;
|
|
234
|
-
standaloneMode?: boolean;
|
|
235
|
-
customCommands?: ChatCommand[];
|
|
236
|
-
rateLimiting?: FlexibleConfig<RateLimitConfig>;
|
|
237
|
-
apiKey?: string;
|
|
238
|
-
webhookUrl?: string;
|
|
239
|
-
analytics?: AnalyticsConfig;
|
|
240
|
-
sounds?: {
|
|
241
|
-
messageReceived?: string | null;
|
|
242
|
-
messageSent?: string | null;
|
|
243
|
-
transactionSuccess?: string | null;
|
|
244
|
-
transactionError?: string | null;
|
|
245
|
-
};
|
|
246
|
-
content?: {
|
|
247
|
-
welcomeTitle?: string;
|
|
248
|
-
connectWalletText?: string;
|
|
249
|
-
disconnectText?: string;
|
|
250
|
-
networkSwitchText?: string;
|
|
251
|
-
errorMessages?: Record<string, string>;
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
declare enum ConnectionStatus {
|
|
255
|
-
CONNECTING = "connecting",
|
|
256
|
-
CONNECTED = "connected",
|
|
257
|
-
DISCONNECTED = "disconnected",
|
|
258
|
-
ERROR = "error",
|
|
259
|
-
RECONNECTING = "reconnecting"
|
|
260
|
-
}
|
|
261
|
-
declare enum ReadinessPhase {
|
|
262
|
-
INITIALIZING = "initializing",
|
|
263
|
-
CONNECTING_MCP = "connecting_mcp",
|
|
264
|
-
VALIDATING_ANTHROPIC = "validating_anthropic",
|
|
265
|
-
READY = "ready",
|
|
266
|
-
MISSING_API_KEY = "missing_api_key",
|
|
267
|
-
ERROR = "error"
|
|
268
|
-
}
|
|
269
|
-
interface BackendReadiness {
|
|
270
|
-
phase: ReadinessPhase;
|
|
271
|
-
detail?: string;
|
|
272
|
-
retryCount?: number;
|
|
273
|
-
}
|
|
274
|
-
interface WalletState {
|
|
275
|
-
isConnected: boolean;
|
|
276
|
-
address?: string;
|
|
277
|
-
chainId?: SupportedChainId;
|
|
278
|
-
networkName?: string;
|
|
279
|
-
balance?: string;
|
|
280
|
-
}
|
|
281
|
-
interface ChatState {
|
|
282
|
-
messages: ChatMessage[];
|
|
283
|
-
isTyping: boolean;
|
|
284
|
-
isProcessing: boolean;
|
|
285
|
-
connectionStatus: ConnectionStatus;
|
|
286
|
-
readiness: BackendReadiness;
|
|
287
|
-
walletState: WalletState;
|
|
288
|
-
sessionId: string;
|
|
289
|
-
pendingTransaction?: WalletTransaction;
|
|
290
|
-
}
|
|
291
|
-
interface AomiChatEventListeners {
|
|
292
|
-
onReady?: () => void;
|
|
293
|
-
onMessage?: (message: ChatMessage) => void;
|
|
294
|
-
onTransactionRequest?: (transaction: WalletTransaction) => void;
|
|
295
|
-
onError?: (error: AomiChatError) => void;
|
|
296
|
-
onSessionStart?: (sessionId: string) => void;
|
|
297
|
-
onSessionEnd?: (sessionId: string) => void;
|
|
298
|
-
onNetworkChange?: (chainId: SupportedChainId) => void;
|
|
299
|
-
onWalletConnect?: (address: string) => void;
|
|
300
|
-
onWalletDisconnect?: () => void;
|
|
301
|
-
onTypingChange?: (isTyping: boolean) => void;
|
|
302
|
-
onProcessingChange?: (isProcessing: boolean) => void;
|
|
303
|
-
onConnectionChange?: (status: ConnectionStatus) => void;
|
|
304
|
-
onResize?: (dimensions: {
|
|
305
|
-
width: number;
|
|
306
|
-
height: number;
|
|
307
|
-
}) => void;
|
|
308
|
-
}
|
|
309
|
-
interface AomiChatError {
|
|
310
|
-
code: string;
|
|
311
|
-
message: string;
|
|
312
|
-
details?: unknown;
|
|
313
|
-
timestamp: Date;
|
|
314
|
-
}
|
|
315
|
-
interface AomiChatWidgetHandler {
|
|
316
|
-
sendMessage: (message: string) => Promise<void>;
|
|
317
|
-
updateParams: (params: Partial<AomiChatWidgetParams>) => void;
|
|
318
|
-
updateProvider: (provider?: EthereumProvider) => void;
|
|
319
|
-
destroy: () => void;
|
|
320
|
-
getState: () => ChatState;
|
|
321
|
-
getSessionId: () => string;
|
|
322
|
-
isReady: () => boolean;
|
|
323
|
-
on: <K extends keyof AomiChatEventListeners>(event: K, listener: NonNullable<AomiChatEventListeners[K]>) => AomiChatWidgetHandler;
|
|
324
|
-
off: <K extends keyof AomiChatEventListeners>(event: K, listener: NonNullable<AomiChatEventListeners[K]>) => AomiChatWidgetHandler;
|
|
325
|
-
clearChat: () => void;
|
|
326
|
-
exportChat: () => ChatMessage[];
|
|
327
|
-
resize: (width?: string, height?: string) => void;
|
|
328
|
-
focus: () => void;
|
|
329
|
-
}
|
|
330
|
-
interface JsonRpcRequest {
|
|
331
|
-
id: number;
|
|
332
|
-
method: string;
|
|
333
|
-
params: unknown[];
|
|
334
|
-
}
|
|
335
|
-
interface EthereumProvider {
|
|
336
|
-
request<T>(params: JsonRpcRequest): Promise<T>;
|
|
337
|
-
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
338
|
-
removeListener?(event: string, handler: (...args: unknown[]) => void): void;
|
|
339
|
-
isMetaMask?: boolean;
|
|
340
|
-
isWalletConnect?: boolean;
|
|
341
|
-
}
|
|
342
|
-
interface WidgetConfig {
|
|
343
|
-
params: AomiChatWidgetParams;
|
|
344
|
-
provider?: EthereumProvider;
|
|
345
|
-
listeners?: AomiChatEventListeners;
|
|
346
|
-
}
|
|
347
|
-
interface ChatManagerConfig {
|
|
348
|
-
backendUrl: string;
|
|
349
|
-
sessionId: string;
|
|
350
|
-
maxMessageLength?: number;
|
|
351
|
-
reconnectAttempts?: number;
|
|
352
|
-
reconnectDelay?: number;
|
|
353
|
-
}
|
|
354
|
-
interface ChatInterfaceProps {
|
|
355
|
-
messages: ChatMessage[];
|
|
356
|
-
isTyping: boolean;
|
|
357
|
-
isProcessing: boolean;
|
|
358
|
-
onSendMessage: (message: string) => void;
|
|
359
|
-
placeholder?: string;
|
|
360
|
-
disabled?: boolean;
|
|
361
|
-
className?: string;
|
|
362
|
-
}
|
|
363
|
-
interface MessageListProps {
|
|
364
|
-
messages: ChatMessage[];
|
|
365
|
-
isTyping: boolean;
|
|
366
|
-
className?: string;
|
|
367
|
-
}
|
|
368
|
-
interface MessageInputProps {
|
|
369
|
-
onSendMessage: (message: string) => void;
|
|
370
|
-
placeholder?: string;
|
|
371
|
-
disabled?: boolean;
|
|
372
|
-
maxLength?: number;
|
|
373
|
-
className?: string;
|
|
374
|
-
}
|
|
375
|
-
interface WalletStatusProps {
|
|
376
|
-
walletState: WalletState;
|
|
377
|
-
onConnect?: () => void;
|
|
378
|
-
onDisconnect?: () => void;
|
|
379
|
-
onNetworkSwitch?: (chainId: SupportedChainId) => void;
|
|
380
|
-
showNetworkSelector?: boolean;
|
|
32
|
+
type AomiFrameProps = {
|
|
33
|
+
width?: CSSProperties["width"];
|
|
34
|
+
height?: CSSProperties["height"];
|
|
381
35
|
className?: string;
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
interface ThemeDefinition {
|
|
388
|
-
name: string;
|
|
389
|
-
palette: AomiChatWidgetPaletteColors;
|
|
390
|
-
fonts?: {
|
|
391
|
-
primary?: string;
|
|
392
|
-
monospace?: string;
|
|
393
|
-
};
|
|
394
|
-
spacing?: {
|
|
395
|
-
xs?: string;
|
|
396
|
-
sm?: string;
|
|
397
|
-
md?: string;
|
|
398
|
-
lg?: string;
|
|
399
|
-
xl?: string;
|
|
400
|
-
};
|
|
401
|
-
borderRadius?: {
|
|
402
|
-
sm?: string;
|
|
403
|
-
md?: string;
|
|
404
|
-
lg?: string;
|
|
405
|
-
};
|
|
406
|
-
shadows?: {
|
|
407
|
-
sm?: string;
|
|
408
|
-
md?: string;
|
|
409
|
-
lg?: string;
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
type DeepPartial<T> = {
|
|
413
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
/** Render prop for wallet footer - receives wallet state and setter from lib */
|
|
38
|
+
walletFooter?: (props: WalletFooterProps) => ReactNode;
|
|
39
|
+
/** Additional content to render inside the frame */
|
|
40
|
+
children?: ReactNode;
|
|
414
41
|
};
|
|
415
|
-
|
|
416
|
-
type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Creates and initializes an Aomi Chat Widget
|
|
420
|
-
*/
|
|
421
|
-
declare function createAomiChatWidget(container: HTMLElement, config: WidgetConfig): AomiChatWidgetHandler;
|
|
42
|
+
declare const AomiFrame: ({ width, height, className, style, walletFooter, children, }: AomiFrameProps) => react_jsx_runtime.JSX.Element;
|
|
422
43
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
message: [ChatMessage];
|
|
426
|
-
error: [AomiChatError];
|
|
427
|
-
connectionChange: [ConnectionStatus];
|
|
428
|
-
transactionRequest: [WalletTransaction];
|
|
429
|
-
}
|
|
430
|
-
type NetworkSwitchResult = {
|
|
431
|
-
success: boolean;
|
|
432
|
-
message: string;
|
|
433
|
-
data?: Record<string, unknown>;
|
|
44
|
+
type RuntimeActions = {
|
|
45
|
+
sendSystemMessage: (message: string) => Promise<void>;
|
|
434
46
|
};
|
|
435
|
-
declare
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
private heartbeatTimer;
|
|
442
|
-
private lastPendingTransactionRaw;
|
|
443
|
-
constructor(config?: Partial<ChatManagerConfig>);
|
|
444
|
-
getState(): ChatState;
|
|
445
|
-
getSessionId(): string;
|
|
446
|
-
setSessionId(sessionId: string): void;
|
|
447
|
-
connectSSE(): Promise<void>;
|
|
448
|
-
disconnectSSE(): void;
|
|
449
|
-
sendMessage(message: string): Promise<void>;
|
|
450
|
-
sendSystemMessage(message: string): Promise<void>;
|
|
451
|
-
interrupt(): Promise<void>;
|
|
452
|
-
sendNetworkSwitchRequest(networkName: string): Promise<NetworkSwitchResult>;
|
|
453
|
-
sendTransactionResult(success: boolean, transactionHash?: string, error?: string): Promise<void>;
|
|
454
|
-
clearPendingTransaction(): void;
|
|
455
|
-
clearMessages(): void;
|
|
456
|
-
updateWalletState(walletState: Partial<WalletState>): void;
|
|
457
|
-
destroy(): void;
|
|
458
|
-
private processBackendPayload;
|
|
459
|
-
private buildMessages;
|
|
460
|
-
private normaliseSender;
|
|
461
|
-
private parseTimestamp;
|
|
462
|
-
private normaliseReadiness;
|
|
463
|
-
private updateReadiness;
|
|
464
|
-
private setConnectionStatus;
|
|
465
|
-
private emitStateChange;
|
|
466
|
-
private postToBackend;
|
|
467
|
-
private refreshState;
|
|
468
|
-
private handleConnectionError;
|
|
469
|
-
private scheduleReconnect;
|
|
470
|
-
private clearReconnectTimer;
|
|
471
|
-
private startHeartbeat;
|
|
472
|
-
private stopHeartbeat;
|
|
473
|
-
private teardownEventSource;
|
|
474
|
-
}
|
|
47
|
+
declare const useRuntimeActions: () => RuntimeActions;
|
|
48
|
+
declare function AomiRuntimeProvider({ children, backendUrl, publicKey, }: Readonly<{
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
backendUrl?: string;
|
|
51
|
+
publicKey?: string;
|
|
52
|
+
}>): react_jsx_runtime.JSX.Element;
|
|
475
53
|
|
|
476
|
-
declare class ThemeManager {
|
|
477
|
-
private currentTheme;
|
|
478
|
-
private customPalette;
|
|
479
|
-
constructor(theme?: AomiChatTheme | AomiChatWidgetPalette);
|
|
480
|
-
/**
|
|
481
|
-
* Updates the current theme
|
|
482
|
-
*/
|
|
483
|
-
updateTheme(theme?: AomiChatTheme | AomiChatWidgetPalette): void;
|
|
484
|
-
/**
|
|
485
|
-
* Gets the current computed theme
|
|
486
|
-
*/
|
|
487
|
-
getComputedTheme(): ThemeDefinition;
|
|
488
|
-
/**
|
|
489
|
-
* Gets a specific color from the current theme
|
|
490
|
-
*/
|
|
491
|
-
getColor(colorKey: keyof AomiChatWidgetPaletteColors): string;
|
|
492
|
-
/**
|
|
493
|
-
* Gets the CSS class name for the current theme
|
|
494
|
-
*/
|
|
495
|
-
getThemeClass(): string;
|
|
496
|
-
/**
|
|
497
|
-
* Gets the font family for the current theme
|
|
498
|
-
*/
|
|
499
|
-
getFontFamily(): string;
|
|
500
|
-
/**
|
|
501
|
-
* Gets the monospace font family for the current theme
|
|
502
|
-
*/
|
|
503
|
-
getMonospaceFontFamily(): string;
|
|
504
|
-
/**
|
|
505
|
-
* Gets a spacing value for the current theme
|
|
506
|
-
*/
|
|
507
|
-
getSpacing(size: 'xs' | 'sm' | 'md' | 'lg' | 'xl'): string;
|
|
508
|
-
/**
|
|
509
|
-
* Gets a border radius value for the current theme
|
|
510
|
-
*/
|
|
511
|
-
getBorderRadius(size: 'sm' | 'md' | 'lg'): string;
|
|
512
|
-
/**
|
|
513
|
-
* Gets a shadow value for the current theme
|
|
514
|
-
*/
|
|
515
|
-
getShadow(size: 'sm' | 'md' | 'lg'): string;
|
|
516
|
-
/**
|
|
517
|
-
* Generates CSS custom properties for the current theme
|
|
518
|
-
*/
|
|
519
|
-
getCSSCustomProperties(): Record<string, string>;
|
|
520
|
-
/**
|
|
521
|
-
* Applies the theme to a DOM element
|
|
522
|
-
*/
|
|
523
|
-
applyThemeToElement(element: HTMLElement): void;
|
|
524
|
-
/**
|
|
525
|
-
* Generates CSS string for the current theme
|
|
526
|
-
*/
|
|
527
|
-
generateCSS(selector?: string): string;
|
|
528
|
-
/**
|
|
529
|
-
* Destroys the theme manager
|
|
530
|
-
*/
|
|
531
|
-
destroy(): void;
|
|
532
|
-
private resolveTheme;
|
|
533
|
-
private isCustomPalette;
|
|
534
|
-
private getBaseThemeName;
|
|
535
|
-
private isPaletteEqual;
|
|
536
|
-
private generateComponentCSS;
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* Creates a theme manager instance
|
|
540
|
-
*/
|
|
541
|
-
declare function createThemeManager(theme?: AomiChatTheme | AomiChatWidgetPalette): ThemeManager;
|
|
542
54
|
/**
|
|
543
|
-
*
|
|
55
|
+
* Thread Context Value
|
|
56
|
+
*
|
|
57
|
+
* Manages global state for multi-thread support:
|
|
58
|
+
* - Current active thread ID
|
|
59
|
+
* - Message history for all threads
|
|
60
|
+
* - Thread metadata (title, archived status)
|
|
544
61
|
*/
|
|
545
|
-
|
|
62
|
+
type ThreadContextValue = {
|
|
63
|
+
currentThreadId: string;
|
|
64
|
+
setCurrentThreadId: (id: string) => void;
|
|
65
|
+
threadViewKey: number;
|
|
66
|
+
bumpThreadViewKey: () => void;
|
|
67
|
+
threads: Map<string, ThreadMessageLike[]>;
|
|
68
|
+
setThreads: React.Dispatch<React.SetStateAction<Map<string, ThreadMessageLike[]>>>;
|
|
69
|
+
threadMetadata: Map<string, ThreadMetadata>;
|
|
70
|
+
setThreadMetadata: React.Dispatch<React.SetStateAction<Map<string, ThreadMetadata>>>;
|
|
71
|
+
threadCnt: number;
|
|
72
|
+
setThreadCnt: React.Dispatch<React.SetStateAction<number>>;
|
|
73
|
+
getThreadMessages: (threadId: string) => ThreadMessageLike[];
|
|
74
|
+
setThreadMessages: (threadId: string, messages: ThreadMessageLike[]) => void;
|
|
75
|
+
getThreadMetadata: (threadId: string) => ThreadMetadata | undefined;
|
|
76
|
+
updateThreadMetadata: (threadId: string, updates: Partial<ThreadMetadata>) => void;
|
|
77
|
+
};
|
|
78
|
+
type ThreadMetadata = {
|
|
79
|
+
title: string;
|
|
80
|
+
status: "regular" | "archived" | "pending";
|
|
81
|
+
lastActiveAt?: string | number;
|
|
82
|
+
};
|
|
546
83
|
/**
|
|
547
|
-
*
|
|
84
|
+
* Hook to access Thread Context
|
|
85
|
+
*
|
|
86
|
+
* Must be used within a ThreadContextProvider
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* const { currentThreadId, setCurrentThreadId } = useThreadContext();
|
|
91
|
+
* ```
|
|
548
92
|
*/
|
|
549
|
-
declare function
|
|
93
|
+
declare function useThreadContext(): ThreadContextValue;
|
|
550
94
|
/**
|
|
551
|
-
*
|
|
95
|
+
* Thread Context Provider Props
|
|
552
96
|
*/
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
interface TransactionRequest {
|
|
556
|
-
to: string;
|
|
557
|
-
value: string;
|
|
558
|
-
data: string;
|
|
559
|
-
gas?: string;
|
|
560
|
-
}
|
|
561
|
-
interface WalletManagerEvents {
|
|
562
|
-
connect: [string];
|
|
563
|
-
disconnect: [];
|
|
564
|
-
chainChange: [SupportedChainId];
|
|
565
|
-
accountsChange: [string[]];
|
|
566
|
-
error: [AomiChatError];
|
|
567
|
-
}
|
|
568
|
-
declare class WalletManager extends EventEmitter<WalletManagerEvents> {
|
|
569
|
-
private provider;
|
|
570
|
-
private currentAccount;
|
|
571
|
-
private currentChainId;
|
|
572
|
-
private isConnected;
|
|
573
|
-
constructor(provider: EthereumProvider);
|
|
574
|
-
/**
|
|
575
|
-
* Gets the current connected account
|
|
576
|
-
*/
|
|
577
|
-
getCurrentAccount(): string | null;
|
|
97
|
+
type ThreadContextProviderProps = {
|
|
98
|
+
children: ReactNode;
|
|
578
99
|
/**
|
|
579
|
-
*
|
|
100
|
+
* Initial thread ID to set as current
|
|
101
|
+
* @default Generated UUID v4 (matches backend's generate_session_id)
|
|
580
102
|
*/
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
* Gets the current network name
|
|
584
|
-
*/
|
|
585
|
-
getCurrentNetworkName(): string | null;
|
|
586
|
-
/**
|
|
587
|
-
* Checks if wallet is connected
|
|
588
|
-
*/
|
|
589
|
-
getIsConnected(): boolean;
|
|
590
|
-
/**
|
|
591
|
-
* Connects to the wallet
|
|
592
|
-
*/
|
|
593
|
-
connect(): Promise<string>;
|
|
594
|
-
/**
|
|
595
|
-
* Disconnects from the wallet
|
|
596
|
-
*/
|
|
597
|
-
disconnect(): void;
|
|
598
|
-
/**
|
|
599
|
-
* Switches to a specific network
|
|
600
|
-
*/
|
|
601
|
-
switchNetwork(chainId: SupportedChainId): Promise<void>;
|
|
602
|
-
/**
|
|
603
|
-
* Sends a transaction
|
|
604
|
-
*/
|
|
605
|
-
sendTransaction(transaction: TransactionRequest): Promise<string>;
|
|
606
|
-
/**
|
|
607
|
-
* Signs a message
|
|
608
|
-
*/
|
|
609
|
-
signMessage(message: string): Promise<string>;
|
|
610
|
-
/**
|
|
611
|
-
* Gets account balance
|
|
612
|
-
*/
|
|
613
|
-
getBalance(address?: string): Promise<string>;
|
|
614
|
-
/**
|
|
615
|
-
* Updates the provider
|
|
616
|
-
*/
|
|
617
|
-
updateProvider(provider: EthereumProvider): void;
|
|
618
|
-
/**
|
|
619
|
-
* Destroys the wallet manager
|
|
620
|
-
*/
|
|
621
|
-
destroy(): void;
|
|
622
|
-
private initializeState;
|
|
623
|
-
private updateChainId;
|
|
624
|
-
private setupEventListeners;
|
|
625
|
-
private removeProviderListeners;
|
|
626
|
-
private handleAccountsChanged;
|
|
627
|
-
private handleChainChanged;
|
|
628
|
-
private handleDisconnect;
|
|
629
|
-
private validateTransaction;
|
|
630
|
-
private addNetwork;
|
|
631
|
-
private getNetworkConfig;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Creates a wallet manager instance
|
|
635
|
-
*/
|
|
636
|
-
declare function createWalletManager(provider: EthereumProvider): WalletManager;
|
|
637
|
-
/**
|
|
638
|
-
* Checks if a provider supports the required methods
|
|
639
|
-
*/
|
|
640
|
-
declare function isValidProvider(provider: unknown): provider is EthereumProvider;
|
|
103
|
+
initialThreadId?: string;
|
|
104
|
+
};
|
|
641
105
|
/**
|
|
642
|
-
*
|
|
106
|
+
* Thread Context Provider
|
|
107
|
+
*
|
|
108
|
+
* Provides global state for multi-thread management.
|
|
109
|
+
* Should be placed high in your component tree, typically in your root layout.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* // app/layout.tsx
|
|
114
|
+
* export default function Layout({ children }) {
|
|
115
|
+
* return (
|
|
116
|
+
* <ThreadContextProvider>
|
|
117
|
+
* <AomiRuntimeProvider>
|
|
118
|
+
* {children}
|
|
119
|
+
* </AomiRuntimeProvider>
|
|
120
|
+
* </ThreadContextProvider>
|
|
121
|
+
* );
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
643
124
|
*/
|
|
644
|
-
declare function
|
|
645
|
-
name: string;
|
|
646
|
-
provider: EthereumProvider;
|
|
647
|
-
}>;
|
|
648
|
-
declare global {
|
|
649
|
-
interface Window {
|
|
650
|
-
ethereum?: EthereumProvider & {
|
|
651
|
-
isMetaMask?: boolean;
|
|
652
|
-
isWalletConnect?: boolean;
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
}
|
|
125
|
+
declare function ThreadContextProvider({ children, initialThreadId, }: ThreadContextProviderProps): react_jsx_runtime.JSX.Element;
|
|
656
126
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
declare function
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
children?: (HTMLElement | string)[];
|
|
689
|
-
}): HTMLElementTagNameMap[K];
|
|
690
|
-
/**
|
|
691
|
-
* Checks if an element is visible in the viewport
|
|
692
|
-
*/
|
|
693
|
-
declare function isElementVisible(element: HTMLElement): boolean;
|
|
694
|
-
/**
|
|
695
|
-
* Type guard to check if a value is a valid Ethereum address
|
|
696
|
-
*/
|
|
697
|
-
declare function isEthereumAddress(value: unknown): value is string;
|
|
698
|
-
/**
|
|
699
|
-
* Type guard to check if a value is a valid transaction hash
|
|
700
|
-
*/
|
|
701
|
-
declare function isTransactionHash(value: unknown): value is string;
|
|
702
|
-
/**
|
|
703
|
-
* Type guard to check if an object has a specific property
|
|
704
|
-
*/
|
|
705
|
-
declare function hasProperty<T extends object, K extends string | number | symbol>(obj: T, prop: K): obj is T & Record<K, unknown>;
|
|
706
|
-
/**
|
|
707
|
-
* Delays execution for a specified number of milliseconds
|
|
708
|
-
*/
|
|
709
|
-
declare function delay(ms: number): Promise<void>;
|
|
710
|
-
/**
|
|
711
|
-
* Creates a promise that rejects after a timeout
|
|
712
|
-
*/
|
|
713
|
-
declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number): Promise<T>;
|
|
714
|
-
/**
|
|
715
|
-
* Retries a function with exponential backoff
|
|
716
|
-
*/
|
|
717
|
-
declare function retry<T>(fn: () => Promise<T>, options?: {
|
|
718
|
-
maxAttempts?: number;
|
|
719
|
-
delay?: number;
|
|
720
|
-
backoffFactor?: number;
|
|
721
|
-
shouldRetry?: (error: unknown) => boolean;
|
|
722
|
-
}): Promise<T>;
|
|
723
|
-
/**
|
|
724
|
-
* Detects if running in a browser environment
|
|
725
|
-
*/
|
|
726
|
-
declare function isBrowser(): boolean;
|
|
727
|
-
/**
|
|
728
|
-
* Detects if running on a mobile device
|
|
729
|
-
*/
|
|
730
|
-
declare function isMobile(): boolean;
|
|
731
|
-
/**
|
|
732
|
-
* Gets the current viewport dimensions
|
|
733
|
-
*/
|
|
734
|
-
declare function getViewportDimensions(): {
|
|
735
|
-
width: number;
|
|
736
|
-
height: number;
|
|
127
|
+
declare const Thread: FC;
|
|
128
|
+
|
|
129
|
+
declare const ThreadList: FC;
|
|
130
|
+
|
|
131
|
+
declare const buttonVariants: (props?: ({
|
|
132
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
|
|
133
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
134
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
135
|
+
declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
136
|
+
asChild?: boolean;
|
|
137
|
+
}): react_jsx_runtime.JSX.Element;
|
|
138
|
+
|
|
139
|
+
declare function Input({ className, type, ...props }: React$1.ComponentProps<"input">): react_jsx_runtime.JSX.Element;
|
|
140
|
+
|
|
141
|
+
declare function Separator({ className, orientation, decorative, ...props }: React$1.ComponentProps<typeof SeparatorPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
142
|
+
|
|
143
|
+
declare function TooltipProvider({ delayDuration, ...props }: React$1.ComponentProps<typeof TooltipPrimitive.Provider>): react_jsx_runtime.JSX.Element;
|
|
144
|
+
declare function Tooltip({ ...props }: React$1.ComponentProps<typeof TooltipPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
145
|
+
declare function TooltipTrigger({ ...props }: React$1.ComponentProps<typeof TooltipPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
146
|
+
declare function TooltipContent({ className, sideOffset, children, ...props }: React$1.ComponentProps<typeof TooltipPrimitive.Content>): react_jsx_runtime.JSX.Element;
|
|
147
|
+
|
|
148
|
+
type SidebarContextProps = {
|
|
149
|
+
state: "expanded" | "collapsed";
|
|
150
|
+
open: boolean;
|
|
151
|
+
setOpen: (open: boolean) => void;
|
|
152
|
+
openMobile: boolean;
|
|
153
|
+
setOpenMobile: (open: boolean) => void;
|
|
154
|
+
isMobile: boolean;
|
|
155
|
+
toggleSidebar: () => void;
|
|
156
|
+
sidebarWidth: number;
|
|
157
|
+
setSidebarWidth: (width: number) => void;
|
|
737
158
|
};
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
declare function
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
}):
|
|
159
|
+
declare function useSidebar(): SidebarContextProps;
|
|
160
|
+
declare function SidebarProvider({ defaultOpen, open: openProp, onOpenChange: setOpenProp, className, style, children, ...props }: React$1.ComponentProps<"div"> & {
|
|
161
|
+
defaultOpen?: boolean;
|
|
162
|
+
open?: boolean;
|
|
163
|
+
onOpenChange?: (open: boolean) => void;
|
|
164
|
+
}): react_jsx_runtime.JSX.Element;
|
|
165
|
+
declare function Sidebar({ side, variant, collapsible, className, children, ...props }: React$1.ComponentProps<"div"> & {
|
|
166
|
+
side?: "left" | "right";
|
|
167
|
+
variant?: "sidebar" | "floating" | "inset";
|
|
168
|
+
collapsible?: "offcanvas" | "icon" | "none";
|
|
169
|
+
}): react_jsx_runtime.JSX.Element;
|
|
170
|
+
declare function SidebarTrigger({ className, onClick, ...props }: React$1.ComponentProps<typeof Button>): react_jsx_runtime.JSX.Element;
|
|
171
|
+
declare function SidebarRail({ className, ...props }: React$1.ComponentProps<"button">): react_jsx_runtime.JSX.Element;
|
|
172
|
+
declare function SidebarInset({ className, ...props }: React$1.ComponentProps<"main">): react_jsx_runtime.JSX.Element;
|
|
173
|
+
declare function SidebarHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
174
|
+
declare function SidebarFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
175
|
+
declare function SidebarSeparator({ className, ...props }: React$1.ComponentProps<typeof Separator>): react_jsx_runtime.JSX.Element;
|
|
176
|
+
declare function SidebarContent({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
177
|
+
declare function SidebarGroup({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
178
|
+
declare function SidebarGroupLabel({ className, asChild, ...props }: React$1.ComponentProps<"div"> & {
|
|
179
|
+
asChild?: boolean;
|
|
180
|
+
}): react_jsx_runtime.JSX.Element;
|
|
181
|
+
declare function SidebarGroupAction({ className, asChild, ...props }: React$1.ComponentProps<"button"> & {
|
|
182
|
+
asChild?: boolean;
|
|
183
|
+
}): react_jsx_runtime.JSX.Element;
|
|
184
|
+
declare function SidebarGroupContent({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
185
|
+
declare function SidebarMenu({ className, ...props }: React$1.ComponentProps<"ul">): react_jsx_runtime.JSX.Element;
|
|
186
|
+
declare function SidebarMenuItem({ className, ...props }: React$1.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
187
|
+
declare const sidebarMenuButtonVariants: (props?: ({
|
|
188
|
+
variant?: "default" | "outline" | null | undefined;
|
|
189
|
+
size?: "default" | "sm" | "lg" | null | undefined;
|
|
190
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
191
|
+
declare function SidebarMenuButton({ asChild, isActive, variant, size, tooltip, className, ...props }: React$1.ComponentProps<"button"> & {
|
|
192
|
+
asChild?: boolean;
|
|
193
|
+
isActive?: boolean;
|
|
194
|
+
tooltip?: string | React$1.ComponentProps<typeof TooltipContent>;
|
|
195
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>): react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare function SidebarMenuAction({ className, asChild, showOnHover, ...props }: React$1.ComponentProps<"button"> & {
|
|
197
|
+
asChild?: boolean;
|
|
198
|
+
showOnHover?: boolean;
|
|
199
|
+
}): react_jsx_runtime.JSX.Element;
|
|
200
|
+
declare function SidebarMenuBadge({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
201
|
+
declare function SidebarMenuSub({ className, ...props }: React$1.ComponentProps<"ul">): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function SidebarMenuSubItem({ className, ...props }: React$1.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
203
|
+
declare function SidebarMenuSubButton({ asChild, size, isActive, className, ...props }: React$1.ComponentProps<"a"> & {
|
|
204
|
+
asChild?: boolean;
|
|
205
|
+
size?: "sm" | "md";
|
|
206
|
+
isActive?: boolean;
|
|
207
|
+
}): react_jsx_runtime.JSX.Element;
|
|
754
208
|
|
|
755
|
-
|
|
209
|
+
type BaseSidebarProps = React$1.ComponentProps<typeof Sidebar> & {
|
|
210
|
+
/** Label to display on the footer button */
|
|
211
|
+
footerLabel?: string;
|
|
212
|
+
/** Secondary label (e.g., network name) */
|
|
213
|
+
footerSecondaryLabel?: string;
|
|
214
|
+
/** Click handler for footer button */
|
|
215
|
+
onFooterClick?: () => void;
|
|
216
|
+
/** Logo URL (defaults to aomi logo) */
|
|
217
|
+
logoUrl?: string;
|
|
218
|
+
/** Logo link href */
|
|
219
|
+
logoHref?: string;
|
|
220
|
+
};
|
|
221
|
+
declare function BaseSidebar({ footerLabel, footerSecondaryLabel, onFooterClick, logoUrl, logoHref, ...props }: BaseSidebarProps): react_jsx_runtime.JSX.Element;
|
|
756
222
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
width?: string;
|
|
761
|
-
height?: string;
|
|
762
|
-
baseUrl?: string;
|
|
763
|
-
provider?: EthereumProvider;
|
|
764
|
-
onReady?: () => void;
|
|
765
|
-
onMessage?: (message: ChatMessage) => void;
|
|
766
|
-
onError?: (error: AomiChatError) => void;
|
|
767
|
-
}
|
|
768
|
-
declare function createChatWidget(containerId: string | HTMLElement, options: CreateChatWidgetOptions): AomiChatWidgetHandler;
|
|
769
|
-
declare const _default: {
|
|
770
|
-
createChatWidget: typeof createChatWidget;
|
|
771
|
-
createAomiChatWidget: typeof createAomiChatWidget;
|
|
772
|
-
VERSION: string;
|
|
773
|
-
SUPPORTED_CHAINS: Record<SupportedChainId, string>;
|
|
774
|
-
PREDEFINED_THEMES: Record<string, ThemeDefinition>;
|
|
775
|
-
ERROR_CODES: {
|
|
776
|
-
readonly INVALID_CONFIG: "INVALID_CONFIG";
|
|
777
|
-
readonly MISSING_APP_CODE: "MISSING_APP_CODE";
|
|
778
|
-
readonly INVALID_THEME: "INVALID_THEME";
|
|
779
|
-
readonly INVALID_DIMENSIONS: "INVALID_DIMENSIONS";
|
|
780
|
-
readonly CONNECTION_FAILED: "CONNECTION_FAILED";
|
|
781
|
-
readonly CONNECTION_TIMEOUT: "CONNECTION_TIMEOUT";
|
|
782
|
-
readonly BACKEND_UNAVAILABLE: "BACKEND_UNAVAILABLE";
|
|
783
|
-
readonly AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED";
|
|
784
|
-
readonly WALLET_NOT_CONNECTED: "WALLET_NOT_CONNECTED";
|
|
785
|
-
readonly WALLET_CONNECTION_FAILED: "WALLET_CONNECTION_FAILED";
|
|
786
|
-
readonly UNSUPPORTED_NETWORK: "UNSUPPORTED_NETWORK";
|
|
787
|
-
readonly TRANSACTION_FAILED: "TRANSACTION_FAILED";
|
|
788
|
-
readonly TRANSACTION_REJECTED: "TRANSACTION_REJECTED";
|
|
789
|
-
readonly MESSAGE_TOO_LONG: "MESSAGE_TOO_LONG";
|
|
790
|
-
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
791
|
-
readonly INVALID_MESSAGE: "INVALID_MESSAGE";
|
|
792
|
-
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
793
|
-
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
794
|
-
readonly INITIALIZATION_FAILED: "INITIALIZATION_FAILED";
|
|
795
|
-
readonly PROVIDER_ERROR: "PROVIDER_ERROR";
|
|
796
|
-
};
|
|
797
|
-
WIDGET_EVENTS: {
|
|
798
|
-
readonly READY: "ready";
|
|
799
|
-
readonly DESTROY: "destroy";
|
|
800
|
-
readonly RESIZE: "resize";
|
|
801
|
-
readonly MESSAGE: "message";
|
|
802
|
-
readonly TYPING_CHANGE: "typingChange";
|
|
803
|
-
readonly PROCESSING_CHANGE: "processingChange";
|
|
804
|
-
readonly CONNECTION_CHANGE: "connectionChange";
|
|
805
|
-
readonly SESSION_START: "sessionStart";
|
|
806
|
-
readonly SESSION_END: "sessionEnd";
|
|
807
|
-
readonly WALLET_CONNECT: "walletConnect";
|
|
808
|
-
readonly WALLET_DISCONNECT: "walletDisconnect";
|
|
809
|
-
readonly NETWORK_CHANGE: "networkChange";
|
|
810
|
-
readonly TRANSACTION_REQUEST: "transactionRequest";
|
|
811
|
-
readonly ERROR: "error";
|
|
812
|
-
};
|
|
223
|
+
type ThreadListSidebarProps = React$1.ComponentProps<typeof Sidebar> & {
|
|
224
|
+
/** Optional footer component (e.g., WalletFooter from consumer app) */
|
|
225
|
+
footer?: React$1.ReactNode;
|
|
813
226
|
};
|
|
227
|
+
declare function ThreadListSidebar({ footer, ...props }: ThreadListSidebarProps): react_jsx_runtime.JSX.Element;
|
|
228
|
+
|
|
229
|
+
declare const MarkdownText: React$1.MemoExoticComponent<() => react_jsx_runtime.JSX.Element>;
|
|
230
|
+
|
|
231
|
+
declare const ToolFallback: ToolCallMessagePartComponent;
|
|
232
|
+
|
|
233
|
+
type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {
|
|
234
|
+
tooltip: string;
|
|
235
|
+
side?: "top" | "bottom" | "left" | "right";
|
|
236
|
+
};
|
|
237
|
+
declare const TooltipIconButton: React$1.ForwardRefExoticComponent<Omit<TooltipIconButtonProps, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
|
|
238
|
+
|
|
239
|
+
declare const UserMessageAttachments: FC;
|
|
240
|
+
declare const ComposerAttachments: FC;
|
|
241
|
+
|
|
242
|
+
declare const Card: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
243
|
+
declare const CardHeader: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
244
|
+
declare const CardTitle: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLHeadingElement> & React$1.RefAttributes<HTMLParagraphElement>>;
|
|
245
|
+
declare const CardDescription: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLParagraphElement> & React$1.RefAttributes<HTMLParagraphElement>>;
|
|
246
|
+
declare const CardContent: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
247
|
+
declare const CardFooter: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLDivElement> & React$1.RefAttributes<HTMLDivElement>>;
|
|
248
|
+
|
|
249
|
+
declare function Dialog({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
250
|
+
declare function DialogTrigger({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
251
|
+
declare function DialogPortal({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Portal>): react_jsx_runtime.JSX.Element;
|
|
252
|
+
declare function DialogClose({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
|
|
253
|
+
declare function DialogOverlay({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Overlay>): react_jsx_runtime.JSX.Element;
|
|
254
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
255
|
+
showCloseButton?: boolean;
|
|
256
|
+
}): react_jsx_runtime.JSX.Element;
|
|
257
|
+
declare function DialogHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
258
|
+
declare function DialogFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
259
|
+
declare function DialogTitle({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
260
|
+
declare function DialogDescription({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
261
|
+
|
|
262
|
+
declare function Avatar({ className, ...props }: React$1.ComponentProps<typeof AvatarPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
263
|
+
declare function AvatarImage({ className, ...props }: React$1.ComponentProps<typeof AvatarPrimitive.Image>): react_jsx_runtime.JSX.Element;
|
|
264
|
+
declare function AvatarFallback({ className, ...props }: React$1.ComponentProps<typeof AvatarPrimitive.Fallback>): react_jsx_runtime.JSX.Element;
|
|
265
|
+
|
|
266
|
+
declare const badgeVariants: (props?: ({
|
|
267
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
268
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
269
|
+
interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
270
|
+
}
|
|
271
|
+
declare function Badge({ className, variant, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
272
|
+
|
|
273
|
+
declare const Label: React$1.ForwardRefExoticComponent<React$1.LabelHTMLAttributes<HTMLLabelElement> & React$1.RefAttributes<HTMLLabelElement>>;
|
|
274
|
+
|
|
275
|
+
declare function Skeleton({ className, ...props }: React.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
276
|
+
|
|
277
|
+
declare function Breadcrumb({ ...props }: React$1.ComponentProps<"nav">): react_jsx_runtime.JSX.Element;
|
|
278
|
+
declare function BreadcrumbList({ className, ...props }: React$1.ComponentProps<"ol">): react_jsx_runtime.JSX.Element;
|
|
279
|
+
declare function BreadcrumbItem({ className, ...props }: React$1.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
280
|
+
declare function BreadcrumbLink({ asChild, className, ...props }: React$1.ComponentProps<"a"> & {
|
|
281
|
+
asChild?: boolean;
|
|
282
|
+
}): react_jsx_runtime.JSX.Element;
|
|
283
|
+
declare function BreadcrumbPage({ className, ...props }: React$1.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare function BreadcrumbSeparator({ children, className, ...props }: React$1.ComponentProps<"li">): react_jsx_runtime.JSX.Element;
|
|
285
|
+
declare function BreadcrumbEllipsis({ className, ...props }: React$1.ComponentProps<"span">): react_jsx_runtime.JSX.Element;
|
|
286
|
+
|
|
287
|
+
declare function Sheet({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
288
|
+
declare function SheetTrigger({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Trigger>): react_jsx_runtime.JSX.Element;
|
|
289
|
+
declare function SheetClose({ ...props }: React$1.ComponentProps<typeof DialogPrimitive.Close>): react_jsx_runtime.JSX.Element;
|
|
290
|
+
declare function SheetContent({ className, children, side, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
291
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
292
|
+
}): react_jsx_runtime.JSX.Element;
|
|
293
|
+
declare function SheetHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
294
|
+
declare function SheetFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
295
|
+
declare function SheetTitle({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Title>): react_jsx_runtime.JSX.Element;
|
|
296
|
+
declare function SheetDescription({ className, ...props }: React$1.ComponentProps<typeof DialogPrimitive.Description>): react_jsx_runtime.JSX.Element;
|
|
297
|
+
|
|
298
|
+
declare function useIsMobile(): boolean;
|
|
299
|
+
|
|
300
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
814
301
|
|
|
815
|
-
export {
|
|
816
|
-
export type { AomiChatEventListeners, AomiChatMode, AomiChatTheme, AomiChatWidgetHandler, AomiChatWidgetPalette, AomiChatWidgetPaletteColors, AomiChatWidgetParams, BackendReadiness, ChatInterfaceProps, ChatMessage, ChatState, DeepPartial, EthereumProvider, FlexibleConfig, JsonRpcRequest, MessageInputProps, MessageListProps, OptionalKeys, RequiredKeys, SupportedChainId, ThemeDefinition, TypingIndicatorProps, WalletState, WalletStatusProps, WalletTransaction, WidgetConfig };
|
|
302
|
+
export { AomiFrame, AomiRuntimeProvider, Avatar, AvatarFallback, AvatarImage, Badge, BaseSidebar, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ComposerAttachments, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, Input, Label, MarkdownText, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Thread, ThreadContextProvider, ThreadList, ThreadListSidebar, ToolFallback, Tooltip, TooltipContent, TooltipIconButton, TooltipProvider, TooltipTrigger, UserMessageAttachments, type WalletButtonState, type WalletFooterProps, badgeVariants, buttonVariants, cn, formatAddress, getNetworkName, useIsMobile, useRuntimeActions, useSidebar, useThreadContext };
|