@scenemesh/entity-engine-aimodule 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/LICENSE +21 -0
- package/README.md +854 -0
- package/dist/ai-core-LBGYFGOK.mjs +17 -0
- package/dist/ai-core-LBGYFGOK.mjs.map +1 -0
- package/dist/ai-core-UGJWSCQN.js +17 -0
- package/dist/ai-core-UGJWSCQN.js.map +1 -0
- package/dist/ai-core-manager-B3Z34RHA.mjs +9 -0
- package/dist/ai-core-manager-B3Z34RHA.mjs.map +1 -0
- package/dist/ai-core-manager-W7SSDCG5.js +9 -0
- package/dist/ai-core-manager-W7SSDCG5.js.map +1 -0
- package/dist/ai-embeddings-5ED5LDXX.mjs +17 -0
- package/dist/ai-embeddings-5ED5LDXX.mjs.map +1 -0
- package/dist/ai-embeddings-WCXZMMTZ.js +17 -0
- package/dist/ai-embeddings-WCXZMMTZ.js.map +1 -0
- package/dist/ai-form-renderer-24IWNMX5.js +233 -0
- package/dist/ai-form-renderer-24IWNMX5.js.map +1 -0
- package/dist/ai-form-renderer-BORQABF2.mjs +233 -0
- package/dist/ai-form-renderer-BORQABF2.mjs.map +1 -0
- package/dist/ai-provider-3PSCVEEN.mjs +17 -0
- package/dist/ai-provider-3PSCVEEN.mjs.map +1 -0
- package/dist/ai-provider-WMPMVZFL.js +17 -0
- package/dist/ai-provider-WMPMVZFL.js.map +1 -0
- package/dist/ai-renderer-7WGGWH5D.mjs +134 -0
- package/dist/ai-renderer-7WGGWH5D.mjs.map +1 -0
- package/dist/ai-renderer-OILYWAJV.js +134 -0
- package/dist/ai-renderer-OILYWAJV.js.map +1 -0
- package/dist/ai-settings-DGCFPK3U.js +15 -0
- package/dist/ai-settings-DGCFPK3U.js.map +1 -0
- package/dist/ai-settings-DTXEAB64.mjs +15 -0
- package/dist/ai-settings-DTXEAB64.mjs.map +1 -0
- package/dist/ai-structured-EGZ26ZS4.mjs +13 -0
- package/dist/ai-structured-EGZ26ZS4.mjs.map +1 -0
- package/dist/ai-structured-N2FZLO4A.js +13 -0
- package/dist/ai-structured-N2FZLO4A.js.map +1 -0
- package/dist/ai-tools-B3R77HZ3.js +19 -0
- package/dist/ai-tools-B3R77HZ3.js.map +1 -0
- package/dist/ai-tools-JAPVYQGE.mjs +19 -0
- package/dist/ai-tools-JAPVYQGE.mjs.map +1 -0
- package/dist/ai.module-GAHVCBTP.js +7 -0
- package/dist/ai.module-GAHVCBTP.js.map +1 -0
- package/dist/ai.module-TTPMTPB3.mjs +7 -0
- package/dist/ai.module-TTPMTPB3.mjs.map +1 -0
- package/dist/chunk-25C2NRSD.mjs +611 -0
- package/dist/chunk-25C2NRSD.mjs.map +1 -0
- package/dist/chunk-4JQ7UOXH.js +427 -0
- package/dist/chunk-4JQ7UOXH.js.map +1 -0
- package/dist/chunk-6IUKES2L.js +290 -0
- package/dist/chunk-6IUKES2L.js.map +1 -0
- package/dist/chunk-COWPK7XN.mjs +834 -0
- package/dist/chunk-COWPK7XN.mjs.map +1 -0
- package/dist/chunk-CTEXPMVZ.js +512 -0
- package/dist/chunk-CTEXPMVZ.js.map +1 -0
- package/dist/chunk-DXQTHA75.js +573 -0
- package/dist/chunk-DXQTHA75.js.map +1 -0
- package/dist/chunk-DZFQ6I23.js +72 -0
- package/dist/chunk-DZFQ6I23.js.map +1 -0
- package/dist/chunk-J323UTPE.mjs +650 -0
- package/dist/chunk-J323UTPE.mjs.map +1 -0
- package/dist/chunk-LHNNALVF.js +834 -0
- package/dist/chunk-LHNNALVF.js.map +1 -0
- package/dist/chunk-O7SZSMXV.js +1621 -0
- package/dist/chunk-O7SZSMXV.js.map +1 -0
- package/dist/chunk-OTNOFOVW.js +650 -0
- package/dist/chunk-OTNOFOVW.js.map +1 -0
- package/dist/chunk-PRIGZEI4.mjs +72 -0
- package/dist/chunk-PRIGZEI4.mjs.map +1 -0
- package/dist/chunk-SBSZ3IPB.mjs +573 -0
- package/dist/chunk-SBSZ3IPB.mjs.map +1 -0
- package/dist/chunk-SXPA6SSD.mjs +1621 -0
- package/dist/chunk-SXPA6SSD.mjs.map +1 -0
- package/dist/chunk-T5A4KAVS.mjs +512 -0
- package/dist/chunk-T5A4KAVS.mjs.map +1 -0
- package/dist/chunk-TDRKKUNT.mjs +357 -0
- package/dist/chunk-TDRKKUNT.mjs.map +1 -0
- package/dist/chunk-TJFNODPE.js +357 -0
- package/dist/chunk-TJFNODPE.js.map +1 -0
- package/dist/chunk-V2SSI3SL.mjs +427 -0
- package/dist/chunk-V2SSI3SL.mjs.map +1 -0
- package/dist/chunk-X42L6MTY.mjs +290 -0
- package/dist/chunk-X42L6MTY.mjs.map +1 -0
- package/dist/chunk-YSVMY77H.js +611 -0
- package/dist/chunk-YSVMY77H.js.map +1 -0
- package/dist/core-ANYRS6EF.mjs +73 -0
- package/dist/core-ANYRS6EF.mjs.map +1 -0
- package/dist/core-K5K34DCS.js +73 -0
- package/dist/core-K5K34DCS.js.map +1 -0
- package/dist/core-index.d.mts +1668 -0
- package/dist/core-index.d.ts +1668 -0
- package/dist/core-index.js +101 -0
- package/dist/core-index.js.map +1 -0
- package/dist/core-index.mjs +101 -0
- package/dist/core-index.mjs.map +1 -0
- package/dist/index.d.mts +2911 -0
- package/dist/index.d.ts +2911 -0
- package/dist/index.js +1177 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1177 -0
- package/dist/index.mjs.map +1 -0
- package/dist/tools-352X7A6X.mjs +366 -0
- package/dist/tools-352X7A6X.mjs.map +1 -0
- package/dist/tools-YLEX6GNO.js +366 -0
- package/dist/tools-YLEX6GNO.js.map +1 -0
- package/dist/ui-index.d.mts +627 -0
- package/dist/ui-index.d.ts +627 -0
- package/dist/ui-index.js +2354 -0
- package/dist/ui-index.js.map +1 -0
- package/dist/ui-index.mjs +2353 -0
- package/dist/ui-index.mjs.map +1 -0
- package/package.json +105 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
import * as _ai_sdk_react from '@ai-sdk/react';
|
|
2
|
+
import { useChat as useChat$1, useCompletion as useCompletion$1 } from '@ai-sdk/react';
|
|
3
|
+
export { UseChatOptions as ChatOptions, UseChatHelpers as ChatReturn, UseCompletionOptions as CompletionOptions, UseCompletionHelpers as CompletionReturn, Experimental_UseObjectOptions as ObjectOptions, Experimental_UseObjectHelpers as ObjectReturn } from '@ai-sdk/react';
|
|
4
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
5
|
+
import * as ai from 'ai';
|
|
6
|
+
import { UIMessage, DataUIPart, FileUIPart } from 'ai';
|
|
7
|
+
export { DataUIPart, DefaultChatTransport, FileUIPart, TextStreamChatTransport, TextUIPart, ToolResultPart, UIMessage, UIMessagePart, convertToModelMessages, createUIMessageStream, createUIMessageStreamResponse, lastAssistantMessageIsCompleteWithToolCalls, readUIMessageStream } from 'ai';
|
|
8
|
+
import * as zod from 'zod';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
11
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
12
|
+
import React$1 from 'react';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Entity Engine AI - useChat Hook
|
|
16
|
+
*
|
|
17
|
+
* Official AI SDK useChat Hook implementation
|
|
18
|
+
* Fully compatible with AI SDK API
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare const useChat: typeof useChat$1;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Entity Engine AI - useObject Hook
|
|
25
|
+
*
|
|
26
|
+
* Official AI SDK experimental_useObject Hook implementation
|
|
27
|
+
* Strict compliance with official specifications
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* useObject Hook
|
|
31
|
+
* Based on official AI SDK experimental_useObject
|
|
32
|
+
*/
|
|
33
|
+
declare const useObject: <SCHEMA extends zod_v4_core.$ZodType | zod.ZodType | ai.Schema, RESULT = _ai_sdk_provider_utils.InferSchema<SCHEMA>, INPUT = any>({ api, id, schema, initialValue, fetch, onError, onFinish, headers, credentials, }: _ai_sdk_react.Experimental_UseObjectOptions<SCHEMA, RESULT>) => _ai_sdk_react.Experimental_UseObjectHelpers<RESULT, INPUT>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Entity Engine AI - useCompletion Hook
|
|
37
|
+
*
|
|
38
|
+
* Official AI SDK useCompletion Hook implementation
|
|
39
|
+
* Strict compliance with official specifications
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* useCompletion Hook
|
|
44
|
+
* Based on official AI SDK useCompletion implementation
|
|
45
|
+
*/
|
|
46
|
+
declare const useCompletion: typeof useCompletion$1;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Entity Engine AI - Complete Type Definitions
|
|
50
|
+
*
|
|
51
|
+
* Complete type system for AI integration
|
|
52
|
+
* 确保所有功能的类型安全性
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Standard UI message types
|
|
57
|
+
* 不添加任何非标准字段,确保完全兼容
|
|
58
|
+
*/
|
|
59
|
+
type StandardUIMessage = UIMessage;
|
|
60
|
+
/**
|
|
61
|
+
* 消息角色类型
|
|
62
|
+
*/
|
|
63
|
+
type MessageRole = 'system' | 'user' | 'assistant';
|
|
64
|
+
/**
|
|
65
|
+
* 消息状态类型
|
|
66
|
+
*/
|
|
67
|
+
type MessageStatus = 'submitted' | 'streaming' | 'ready' | 'error';
|
|
68
|
+
/**
|
|
69
|
+
* Tool call status types
|
|
70
|
+
* 支持流式工具调用的完整状态,包括input-streaming
|
|
71
|
+
*/
|
|
72
|
+
type ToolCallState = 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
73
|
+
/**
|
|
74
|
+
* 工具类型定义
|
|
75
|
+
*/
|
|
76
|
+
interface ToolDefinition {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
inputSchema: z.ZodSchema;
|
|
80
|
+
type: 'server-side' | 'client-side' | 'user-interaction';
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 工具执行结果
|
|
84
|
+
*/
|
|
85
|
+
interface ToolExecutionResult {
|
|
86
|
+
toolCallId: string;
|
|
87
|
+
toolName: string;
|
|
88
|
+
result: any;
|
|
89
|
+
error?: string;
|
|
90
|
+
executionTime?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 用户交互工具选项
|
|
94
|
+
*/
|
|
95
|
+
interface UserInteractionToolOptions {
|
|
96
|
+
title: string;
|
|
97
|
+
description?: string;
|
|
98
|
+
actions: Array<{
|
|
99
|
+
label: string;
|
|
100
|
+
value: any;
|
|
101
|
+
variant?: 'default' | 'destructive' | 'outline' | 'secondary';
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Chat configuration options
|
|
106
|
+
*/
|
|
107
|
+
interface ChatOptions<TMessage extends StandardUIMessage = StandardUIMessage> {
|
|
108
|
+
/** 聊天ID */
|
|
109
|
+
id?: string;
|
|
110
|
+
/** 初始消息 */
|
|
111
|
+
initialMessages?: TMessage[];
|
|
112
|
+
/** Transport configuration */
|
|
113
|
+
transport?: any;
|
|
114
|
+
/** API端点 - 向后兼容 */
|
|
115
|
+
api?: string;
|
|
116
|
+
/** 请求头 - 向后兼容 */
|
|
117
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
118
|
+
/** 请求体 - 向后兼容 */
|
|
119
|
+
body?: Record<string, any> | (() => Record<string, any>);
|
|
120
|
+
/** 凭据模式 - 向后兼容 */
|
|
121
|
+
credentials?: RequestCredentials;
|
|
122
|
+
/** 工具调用回调 */
|
|
123
|
+
onToolCall?: (options: {
|
|
124
|
+
toolCall: any;
|
|
125
|
+
}) => void | Promise<void>;
|
|
126
|
+
/** 自动发送条件 */
|
|
127
|
+
sendAutomaticallyWhen?: (options: {
|
|
128
|
+
messages: TMessage[];
|
|
129
|
+
}) => boolean | PromiseLike<boolean>;
|
|
130
|
+
/** 完成回调 */
|
|
131
|
+
onFinish?: (options: {
|
|
132
|
+
message: TMessage;
|
|
133
|
+
messages: TMessage[];
|
|
134
|
+
isAbort: boolean;
|
|
135
|
+
isDisconnect: boolean;
|
|
136
|
+
isError: boolean;
|
|
137
|
+
}) => void;
|
|
138
|
+
/** 错误回调 */
|
|
139
|
+
onError?: (error: Error) => void;
|
|
140
|
+
/** 数据回调 */
|
|
141
|
+
onData?: (dataPart: DataUIPart<any>) => void;
|
|
142
|
+
/** UI更新节流 */
|
|
143
|
+
experimental_throttle?: number;
|
|
144
|
+
/** 是否恢复流 */
|
|
145
|
+
resume?: boolean;
|
|
146
|
+
/** 视图控制器实例 - 支持客户端工具调用 */
|
|
147
|
+
viewController?: any;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* 聊天对话框属性 - 扩展支持更多UI功能
|
|
151
|
+
*/
|
|
152
|
+
interface ChatDialogProps {
|
|
153
|
+
/** 聊天选项 */
|
|
154
|
+
chatOptions?: ChatOptions;
|
|
155
|
+
/** 对话框标题 */
|
|
156
|
+
title?: string;
|
|
157
|
+
/** 对话框描述 */
|
|
158
|
+
description?: string;
|
|
159
|
+
/** 是否打开 */
|
|
160
|
+
open?: boolean;
|
|
161
|
+
/** 打开状态变化回调 */
|
|
162
|
+
onOpenChange?: (open: boolean) => void;
|
|
163
|
+
/** 输入框占位符 */
|
|
164
|
+
placeholder?: string;
|
|
165
|
+
/** 自定义样式类 */
|
|
166
|
+
className?: string;
|
|
167
|
+
/** 是否显示头部 */
|
|
168
|
+
showHeader?: boolean;
|
|
169
|
+
/** 是否允许文件上传 */
|
|
170
|
+
allowFileUpload?: boolean;
|
|
171
|
+
/** 接受的文件类型 */
|
|
172
|
+
acceptedFileTypes?: string[];
|
|
173
|
+
/** 最大文件大小 */
|
|
174
|
+
maxFileSize?: number;
|
|
175
|
+
/** 工具渲染器 */
|
|
176
|
+
toolRenderers?: Record<string, React.ComponentType<any>>;
|
|
177
|
+
/** 消息渲染器 */
|
|
178
|
+
messageRenderer?: React.ComponentType<any>;
|
|
179
|
+
/** 主题配置 */
|
|
180
|
+
theme?: ThemeConfig | string;
|
|
181
|
+
/** 启用推理显示 */
|
|
182
|
+
enableReasoning?: boolean;
|
|
183
|
+
/** 启用生成式UI */
|
|
184
|
+
enableGenerativeUI?: boolean;
|
|
185
|
+
/** 默认显示推理 */
|
|
186
|
+
showReasoningByDefault?: boolean;
|
|
187
|
+
/** 页面上下文信息 */
|
|
188
|
+
pageContext?: any;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* 消息气泡属性 - 扩展支持更多显示选项
|
|
192
|
+
*/
|
|
193
|
+
interface MessageBubbleProps {
|
|
194
|
+
/** 消息对象 */
|
|
195
|
+
message: UIMessage;
|
|
196
|
+
/** 是否显示头像 */
|
|
197
|
+
showAvatar?: boolean;
|
|
198
|
+
/** 是否显示时间戳 */
|
|
199
|
+
showTimestamp?: boolean;
|
|
200
|
+
/** 工具结果回调 */
|
|
201
|
+
onToolResult?: (result: any) => void;
|
|
202
|
+
/** 启用推理显示 */
|
|
203
|
+
enableReasoning?: boolean;
|
|
204
|
+
/** 启用生成式UI */
|
|
205
|
+
enableGenerativeUI?: boolean;
|
|
206
|
+
/** 默认显示推理 */
|
|
207
|
+
showReasoningByDefault?: boolean;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 文件查看器属性
|
|
211
|
+
*/
|
|
212
|
+
interface FileViewerProps {
|
|
213
|
+
/** 文件对象 */
|
|
214
|
+
file: FileUIPart;
|
|
215
|
+
/** 是否显示下载按钮 */
|
|
216
|
+
showDownload?: boolean;
|
|
217
|
+
/** 是否显示删除按钮 */
|
|
218
|
+
showRemove?: boolean;
|
|
219
|
+
/** 删除回调 */
|
|
220
|
+
onRemove?: (file: FileUIPart) => void;
|
|
221
|
+
/** 自定义样式类 */
|
|
222
|
+
className?: string;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* 自定义Transport配置
|
|
226
|
+
*/
|
|
227
|
+
interface CustomTransportOptions {
|
|
228
|
+
/** API端点 */
|
|
229
|
+
api?: string;
|
|
230
|
+
/** 请求头 */
|
|
231
|
+
headers?: Record<string, string> | (() => Record<string, string>);
|
|
232
|
+
/** 请求体 */
|
|
233
|
+
body?: Record<string, any> | (() => Record<string, any>);
|
|
234
|
+
/** 凭据模式 */
|
|
235
|
+
credentials?: RequestCredentials | (() => RequestCredentials);
|
|
236
|
+
/** 请求准备函数 */
|
|
237
|
+
prepareSendMessagesRequest?: (options: any) => any;
|
|
238
|
+
/** 重连请求准备函数 */
|
|
239
|
+
prepareReconnectToStreamRequest?: (options: any) => any;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* 自定义数据部分类型
|
|
243
|
+
*/
|
|
244
|
+
interface CustomDataParts {
|
|
245
|
+
/** 天气数据 */
|
|
246
|
+
weather: {
|
|
247
|
+
city: string;
|
|
248
|
+
weather?: string;
|
|
249
|
+
temperature?: number;
|
|
250
|
+
status: 'loading' | 'success' | 'error';
|
|
251
|
+
};
|
|
252
|
+
/** 通知数据 */
|
|
253
|
+
notification: {
|
|
254
|
+
message: string;
|
|
255
|
+
level: 'info' | 'warning' | 'error' | 'success';
|
|
256
|
+
duration?: number;
|
|
257
|
+
};
|
|
258
|
+
/** 进度数据 */
|
|
259
|
+
progress: {
|
|
260
|
+
current: number;
|
|
261
|
+
total: number;
|
|
262
|
+
label?: string;
|
|
263
|
+
};
|
|
264
|
+
/** 状态数据 */
|
|
265
|
+
status: {
|
|
266
|
+
type: 'processing' | 'complete' | 'error' | 'cancelled';
|
|
267
|
+
message: string;
|
|
268
|
+
details?: any;
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* 扩展的UI消息类型,包含自定义数据部分
|
|
273
|
+
*/
|
|
274
|
+
type CustomUIMessage = UIMessage;
|
|
275
|
+
/**
|
|
276
|
+
* 扩展的UI消息类型 - 向后兼容
|
|
277
|
+
*/
|
|
278
|
+
type ExtendedUIMessage = UIMessage;
|
|
279
|
+
/**
|
|
280
|
+
* 主题配置
|
|
281
|
+
*/
|
|
282
|
+
interface ThemeConfig {
|
|
283
|
+
/** 主题模式 */
|
|
284
|
+
mode: 'light' | 'dark' | 'system';
|
|
285
|
+
/** 主色调 */
|
|
286
|
+
primaryColor?: string;
|
|
287
|
+
/** 圆角大小 */
|
|
288
|
+
borderRadius?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
|
|
289
|
+
/** 字体族 */
|
|
290
|
+
fontFamily?: string;
|
|
291
|
+
/** 动画持续时间 */
|
|
292
|
+
animationDuration?: 'fast' | 'normal' | 'slow';
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* 样式变体
|
|
296
|
+
*/
|
|
297
|
+
interface StyleVariants {
|
|
298
|
+
/** 消息气泡变体 */
|
|
299
|
+
messageBubble?: 'default' | 'minimal' | 'rounded' | 'bordered';
|
|
300
|
+
/** 输入框变体 */
|
|
301
|
+
inputField?: 'default' | 'filled' | 'outlined' | 'underlined';
|
|
302
|
+
/** 按钮变体 */
|
|
303
|
+
button?: 'default' | 'ghost' | 'outline' | 'solid';
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* 聊天事件类型
|
|
307
|
+
*/
|
|
308
|
+
interface ChatEvents {
|
|
309
|
+
/** 消息发送 */
|
|
310
|
+
'message:sent': {
|
|
311
|
+
message: UIMessage;
|
|
312
|
+
};
|
|
313
|
+
/** 消息接收 */
|
|
314
|
+
'message:received': {
|
|
315
|
+
message: UIMessage;
|
|
316
|
+
};
|
|
317
|
+
/** 工具调用 */
|
|
318
|
+
'tool:called': {
|
|
319
|
+
toolName: string;
|
|
320
|
+
input: any;
|
|
321
|
+
};
|
|
322
|
+
/** 工具结果 */
|
|
323
|
+
'tool:result': {
|
|
324
|
+
toolName: string;
|
|
325
|
+
output: any;
|
|
326
|
+
};
|
|
327
|
+
/** 错误发生 */
|
|
328
|
+
'error:occurred': {
|
|
329
|
+
error: Error;
|
|
330
|
+
};
|
|
331
|
+
/** 流开始 */
|
|
332
|
+
'stream:started': {
|
|
333
|
+
timestamp: number;
|
|
334
|
+
};
|
|
335
|
+
/** 流结束 */
|
|
336
|
+
'stream:ended': {
|
|
337
|
+
timestamp: number;
|
|
338
|
+
duration: number;
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Main chat dialog component
|
|
344
|
+
*/
|
|
345
|
+
declare function ChatDialog({ chatOptions, title, description, open, onOpenChange, placeholder, className, showHeader, allowFileUpload, acceptedFileTypes, maxFileSize, // 10MB
|
|
346
|
+
messageRenderer, theme, enableReasoning, enableGenerativeUI, showReasoningByDefault, }: ChatDialogProps): react_jsx_runtime.JSX.Element;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* 文件查看器组件
|
|
350
|
+
*/
|
|
351
|
+
declare function FileViewer({ file, showDownload, showRemove, onRemove, className, }: FileViewerProps): react_jsx_runtime.JSX.Element;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Message bubble component with hybrid architecture implementation
|
|
355
|
+
*
|
|
356
|
+
* Supports two rendering modes:
|
|
357
|
+
* 1. 静态工具模式:tool-${toolName} → 使用GenerativeUI组件
|
|
358
|
+
* 2. 动态工具模式:dynamic-tool → 使用DynamicUI组件
|
|
359
|
+
*
|
|
360
|
+
* Standard state handling and naming conventions
|
|
361
|
+
*/
|
|
362
|
+
declare function MessageBubble({ message, showAvatar, // 不再使用头像
|
|
363
|
+
showTimestamp, onToolResult, enableReasoning, enableGenerativeUI, showReasoningByDefault }: MessageBubbleProps): react_jsx_runtime.JSX.Element;
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* 🎨 预置生成式UI组件
|
|
367
|
+
*
|
|
368
|
+
* Pure component definitions without registration system
|
|
369
|
+
* Reference: Generative User Interfaces documentation
|
|
370
|
+
* 实现原理:直接导入使用,不再使用动态注册系统
|
|
371
|
+
*/
|
|
372
|
+
|
|
373
|
+
interface WeatherProps {
|
|
374
|
+
temperature?: number;
|
|
375
|
+
weather?: string;
|
|
376
|
+
location?: string;
|
|
377
|
+
humidity?: number;
|
|
378
|
+
windSpeed?: number;
|
|
379
|
+
}
|
|
380
|
+
declare const WeatherComponent: React$1.FC<WeatherProps>;
|
|
381
|
+
interface LocationProps {
|
|
382
|
+
city?: string;
|
|
383
|
+
country?: string;
|
|
384
|
+
province?: string;
|
|
385
|
+
coordinates?: {
|
|
386
|
+
lat: number;
|
|
387
|
+
lng: number;
|
|
388
|
+
};
|
|
389
|
+
timezone?: string;
|
|
390
|
+
population?: number;
|
|
391
|
+
area?: number;
|
|
392
|
+
}
|
|
393
|
+
declare const LocationComponent: React$1.FC<LocationProps>;
|
|
394
|
+
interface CodeExecutionProps {
|
|
395
|
+
code?: string;
|
|
396
|
+
language?: string;
|
|
397
|
+
output?: string;
|
|
398
|
+
status?: 'success' | 'error' | 'running';
|
|
399
|
+
}
|
|
400
|
+
declare const CodeExecutionComponent: React$1.FC<CodeExecutionProps>;
|
|
401
|
+
|
|
402
|
+
interface DynamicToolPartProps {
|
|
403
|
+
toolName: string;
|
|
404
|
+
input: any;
|
|
405
|
+
output: any;
|
|
406
|
+
state: 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
|
|
407
|
+
}
|
|
408
|
+
declare function DynamicToolRenderer({ toolName, input, output, state }: DynamicToolPartProps): react_jsx_runtime.JSX.Element;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Entity Engine Integrated Dynamic Components
|
|
412
|
+
*
|
|
413
|
+
* Uses Entity Engine standard components for dynamic rendering
|
|
414
|
+
* 专注于grid和form视图的集成,无冗余逻辑
|
|
415
|
+
*/
|
|
416
|
+
|
|
417
|
+
interface DynamicEntityComponentProps {
|
|
418
|
+
toolName: string;
|
|
419
|
+
modelName?: string;
|
|
420
|
+
displayMode?: string;
|
|
421
|
+
data?: any[];
|
|
422
|
+
totalCount?: number;
|
|
423
|
+
pagination?: {
|
|
424
|
+
pageSize: number;
|
|
425
|
+
pageIndex: number;
|
|
426
|
+
totalPages: number;
|
|
427
|
+
hasNextPage: boolean;
|
|
428
|
+
hasPreviousPage: boolean;
|
|
429
|
+
};
|
|
430
|
+
query?: {
|
|
431
|
+
sortBy?: Record<string, 'asc' | 'desc'>;
|
|
432
|
+
filters?: Record<string, any>;
|
|
433
|
+
};
|
|
434
|
+
executedAt?: string;
|
|
435
|
+
toolCallId?: string;
|
|
436
|
+
_renderHint?: {
|
|
437
|
+
componentType: string;
|
|
438
|
+
preferredLayout?: string;
|
|
439
|
+
features?: string[];
|
|
440
|
+
dataSchema?: string[];
|
|
441
|
+
capabilities?: string[];
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
interface DynamicEntityGridProps extends DynamicEntityComponentProps {
|
|
445
|
+
displayMode?: 'table' | 'grid';
|
|
446
|
+
}
|
|
447
|
+
declare const DynamicEntityGridComponent: React$1.FC<DynamicEntityGridProps>;
|
|
448
|
+
interface DynamicEntityFormProps extends DynamicEntityComponentProps {
|
|
449
|
+
baseObjectId?: string;
|
|
450
|
+
mode?: 'display' | 'edit';
|
|
451
|
+
toCreating?: boolean;
|
|
452
|
+
}
|
|
453
|
+
interface DynamicEntityKanbanProps extends DynamicEntityComponentProps {
|
|
454
|
+
displayMode?: 'kanban';
|
|
455
|
+
}
|
|
456
|
+
interface DynamicEntityDashboardProps extends DynamicEntityComponentProps {
|
|
457
|
+
displayMode?: 'dashboard';
|
|
458
|
+
}
|
|
459
|
+
interface DynamicEntityMastailProps extends DynamicEntityComponentProps {
|
|
460
|
+
displayMode?: 'mastail';
|
|
461
|
+
baseObjectId?: string;
|
|
462
|
+
}
|
|
463
|
+
declare const DynamicEntityFormComponent: React$1.FC<DynamicEntityFormProps>;
|
|
464
|
+
declare const DynamicEntityKanbanComponent: React$1.FC<DynamicEntityKanbanProps>;
|
|
465
|
+
declare const DynamicEntityDashboardComponent: React$1.FC<DynamicEntityDashboardProps>;
|
|
466
|
+
declare const DynamicEntityMastailComponent: React$1.FC<DynamicEntityMastailProps>;
|
|
467
|
+
interface DynamicErrorDisplayProps extends DynamicEntityComponentProps {
|
|
468
|
+
error: string;
|
|
469
|
+
errorDetails?: string;
|
|
470
|
+
errorType?: string;
|
|
471
|
+
}
|
|
472
|
+
declare const ENTITY_DYNAMIC_COMPONENTS: {
|
|
473
|
+
readonly DynamicDataTable: React$1.FC<DynamicEntityGridProps>;
|
|
474
|
+
readonly DynamicDataGrid: React$1.FC<DynamicEntityGridProps>;
|
|
475
|
+
readonly DynamicDataList: React$1.FC<DynamicEntityGridProps>;
|
|
476
|
+
readonly DynamicEntityForm: React$1.FC<DynamicEntityFormProps>;
|
|
477
|
+
readonly DynamicEntityKanban: React$1.FC<DynamicEntityKanbanProps>;
|
|
478
|
+
readonly DynamicEntityDashboard: React$1.FC<DynamicEntityDashboardProps>;
|
|
479
|
+
readonly DynamicEntityMastail: React$1.FC<DynamicEntityMastailProps>;
|
|
480
|
+
readonly DynamicErrorDisplay: React$1.FC<DynamicErrorDisplayProps>;
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Entity Engine AI - Utility Functions
|
|
485
|
+
*
|
|
486
|
+
* Collection of utility functions for common operations
|
|
487
|
+
*/
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Extract text content from message
|
|
491
|
+
*/
|
|
492
|
+
declare function extractMessageText(message: ExtendedUIMessage): string;
|
|
493
|
+
/**
|
|
494
|
+
* Check if message contains tool calls
|
|
495
|
+
*/
|
|
496
|
+
declare function hasToolCalls(message: ExtendedUIMessage): boolean;
|
|
497
|
+
/**
|
|
498
|
+
* Get tool calls list from message
|
|
499
|
+
*/
|
|
500
|
+
declare function getToolCalls(message: ExtendedUIMessage): Array<{
|
|
501
|
+
toolName: string;
|
|
502
|
+
state: string;
|
|
503
|
+
input?: any;
|
|
504
|
+
output?: any;
|
|
505
|
+
}>;
|
|
506
|
+
/**
|
|
507
|
+
* Check if message contains file attachments
|
|
508
|
+
*/
|
|
509
|
+
declare function hasFileAttachments(message: ExtendedUIMessage): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Get file attachments list from message
|
|
512
|
+
*/
|
|
513
|
+
declare function getFileAttachments(message: ExtendedUIMessage): any[];
|
|
514
|
+
/**
|
|
515
|
+
* Format timestamp
|
|
516
|
+
*/
|
|
517
|
+
declare function formatTimestamp(timestamp?: number, options?: {
|
|
518
|
+
format?: 'short' | 'long' | 'relative';
|
|
519
|
+
includeDate?: boolean;
|
|
520
|
+
}): string;
|
|
521
|
+
/**
|
|
522
|
+
* Format relative time
|
|
523
|
+
*/
|
|
524
|
+
declare function formatRelativeTime(timestamp: number): string;
|
|
525
|
+
/**
|
|
526
|
+
* Format file size
|
|
527
|
+
*/
|
|
528
|
+
declare function formatFileSize(bytes: number): string;
|
|
529
|
+
/**
|
|
530
|
+
* Get file extension
|
|
531
|
+
*/
|
|
532
|
+
declare function getFileExtension(filename: string): string;
|
|
533
|
+
/**
|
|
534
|
+
* Check if file type is accepted
|
|
535
|
+
*/
|
|
536
|
+
declare function isFileTypeAccepted(file: File, acceptedTypes: string[]): boolean;
|
|
537
|
+
/**
|
|
538
|
+
* Create file URL
|
|
539
|
+
*/
|
|
540
|
+
declare function createFileUrl(file: File): string;
|
|
541
|
+
/**
|
|
542
|
+
* Revoke file URL
|
|
543
|
+
*/
|
|
544
|
+
declare function revokeFileUrl(url: string): void;
|
|
545
|
+
/**
|
|
546
|
+
* Truncate text
|
|
547
|
+
*/
|
|
548
|
+
declare function truncateText(text: string, maxLength: number): string;
|
|
549
|
+
/**
|
|
550
|
+
* Highlight search terms
|
|
551
|
+
*/
|
|
552
|
+
declare function highlightSearchTerms(text: string, searchTerms: string[]): string;
|
|
553
|
+
/**
|
|
554
|
+
* Convert camelCase to space-separated
|
|
555
|
+
*/
|
|
556
|
+
declare function camelToSpaced(str: string): string;
|
|
557
|
+
/**
|
|
558
|
+
* Check if string is valid URL
|
|
559
|
+
*/
|
|
560
|
+
declare function isValidUrl(string: string): boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Check if string is valid JSON
|
|
563
|
+
*/
|
|
564
|
+
declare function isValidJson(string: string): boolean;
|
|
565
|
+
/**
|
|
566
|
+
* Safe JSON parse
|
|
567
|
+
*/
|
|
568
|
+
declare function safeJsonParse<T>(string: string, fallback: T): T;
|
|
569
|
+
/**
|
|
570
|
+
* Combine CSS class names (simplified clsx)
|
|
571
|
+
*/
|
|
572
|
+
declare function cn(...classes: (string | undefined | null | false)[]): string;
|
|
573
|
+
/**
|
|
574
|
+
* Safely execute async function
|
|
575
|
+
*/
|
|
576
|
+
declare function safeAsync<T>(fn: () => Promise<T>, fallback?: T): Promise<{
|
|
577
|
+
data?: T;
|
|
578
|
+
error?: Error;
|
|
579
|
+
}>;
|
|
580
|
+
/**
|
|
581
|
+
* Create error message
|
|
582
|
+
*/
|
|
583
|
+
declare function createErrorMessage(error: unknown): string;
|
|
584
|
+
/**
|
|
585
|
+
* Debounce function
|
|
586
|
+
*/
|
|
587
|
+
declare function debounce<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
|
|
588
|
+
/**
|
|
589
|
+
* Throttle function
|
|
590
|
+
*/
|
|
591
|
+
declare function throttle<T extends (...args: any[]) => any>(func: T, delay: number): (...args: Parameters<T>) => void;
|
|
592
|
+
/**
|
|
593
|
+
* Safe localStorage operations
|
|
594
|
+
*/
|
|
595
|
+
declare const storage: {
|
|
596
|
+
get<T>(key: string, fallback?: T): T | null;
|
|
597
|
+
set<T>(key: string, value: T): boolean;
|
|
598
|
+
remove(key: string): boolean;
|
|
599
|
+
clear(): boolean;
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* 🎯 Entity Engine AIUI - Main Export
|
|
604
|
+
*
|
|
605
|
+
* Complete AI SDK UI implementation with dialog-style interface
|
|
606
|
+
* 基于AI SDK官方规范的完整前端UI包主入口
|
|
607
|
+
*/
|
|
608
|
+
|
|
609
|
+
declare const version = "1.0.0";
|
|
610
|
+
declare const packageName = "entity-engine-aiui";
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Default export containing all main functionality
|
|
614
|
+
* Components are loaded dynamically to avoid server-side React imports
|
|
615
|
+
*/
|
|
616
|
+
declare const EntityEngineAIUI: {
|
|
617
|
+
readonly useChat: any;
|
|
618
|
+
readonly useCompletion: any;
|
|
619
|
+
readonly useObject: any;
|
|
620
|
+
readonly ChatDialog: any;
|
|
621
|
+
readonly MessageBubble: any;
|
|
622
|
+
readonly FileViewer: any;
|
|
623
|
+
version: string;
|
|
624
|
+
packageName: string;
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
export { ChatDialog, type ChatDialogProps, type ChatEvents, CodeExecutionComponent, type CustomDataParts, type CustomTransportOptions, type CustomUIMessage, DynamicEntityDashboardComponent, DynamicEntityFormComponent, DynamicEntityGridComponent, DynamicEntityKanbanComponent, DynamicEntityMastailComponent, DynamicToolRenderer, ENTITY_DYNAMIC_COMPONENTS, type ExtendedUIMessage, FileViewer, type FileViewerProps, LocationComponent, MessageBubble, type MessageBubbleProps, type MessageRole, type MessageStatus, type StyleVariants, type ThemeConfig, type ToolCallState, type ToolDefinition, type ToolExecutionResult, type UserInteractionToolOptions, WeatherComponent, camelToSpaced, cn, createErrorMessage, createFileUrl, debounce, EntityEngineAIUI as default, extractMessageText, formatFileSize, formatRelativeTime, formatTimestamp, getFileAttachments, getFileExtension, getToolCalls, hasFileAttachments, hasToolCalls, highlightSearchTerms, isFileTypeAccepted, isValidJson, isValidUrl, packageName, revokeFileUrl, safeAsync, safeJsonParse, storage, throttle, truncateText, useChat, useCompletion, useObject, version };
|