@opentiny/tiny-robot-kit 0.4.2-alpha.4 → 0.4.2-alpha.5

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.
@@ -1,548 +0,0 @@
1
- import { ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionFunctionTool, ChatCompletion, ChatCompletionChunk, ChatCompletionMessageFunctionToolCall, ChatCompletionSystemMessageParam } from 'openai/resources';
2
- import { S as SkillDefinition } from './types-ChCZ8jKB.mjs';
3
-
4
- /**
5
- * 模型Provider基类
6
- */
7
- declare abstract class BaseModelProvider {
8
- protected config: AIModelConfig;
9
- /**
10
- * @param config AI模型配置
11
- */
12
- constructor(config: AIModelConfig);
13
- /**
14
- * 发送聊天请求并获取响应
15
- * @param request 聊天请求参数
16
- * @returns 聊天响应
17
- */
18
- abstract chat(request: ChatCompletionRequest): Promise<ChatCompletionResponse>;
19
- /**
20
- * 发送流式聊天请求并通过处理器处理响应
21
- * @param request 聊天请求参数
22
- * @param handler 流式响应处理器
23
- */
24
- abstract chatStream(request: ChatCompletionRequest, handler: StreamHandler): Promise<void>;
25
- /**
26
- * 更新配置
27
- * @param config 新的AI模型配置
28
- */
29
- updateConfig(config: AIModelConfig): void;
30
- /**
31
- * 获取当前配置
32
- * @returns AI模型配置
33
- */
34
- getConfig(): AIModelConfig;
35
- /**
36
- * 验证请求参数
37
- * @param request 聊天请求参数
38
- */
39
- protected validateRequest(request: ChatCompletionRequest): void;
40
- }
41
-
42
- type MaybePromise<T> = T | Promise<T>;
43
- /**
44
- * 消息角色类型
45
- */
46
- type MessageRole = 'system' | 'user' | 'assistant';
47
- interface ToolCall {
48
- index: number;
49
- id: string;
50
- type: 'function';
51
- function: {
52
- name: string;
53
- arguments: string;
54
- result?: string;
55
- };
56
- }
57
- interface MessageMetadata {
58
- createdAt?: number;
59
- updatedAt?: number;
60
- id?: string;
61
- model?: string;
62
- [key: string]: any;
63
- }
64
- /**
65
- * 聊天消息接口
66
- */
67
- interface ChatMessage$1 {
68
- role: string;
69
- content: string;
70
- reasoning_content?: string;
71
- metadata?: MessageMetadata;
72
- tool_calls?: ToolCall[];
73
- tool_call_id?: string;
74
- [key: string]: any;
75
- [key: symbol]: any;
76
- }
77
- /**
78
- * 聊天历史记录
79
- */
80
- type ChatHistory = ChatMessage$1[];
81
- /**
82
- * 聊天完成请求选项
83
- */
84
- interface ChatCompletionOptions {
85
- model?: string;
86
- temperature?: number;
87
- top_p?: number;
88
- n?: number;
89
- stream?: boolean;
90
- max_tokens?: number;
91
- signal?: AbortSignal;
92
- }
93
- /**
94
- * 聊天完成请求参数
95
- */
96
- interface ChatCompletionRequest {
97
- messages: ChatMessage$1[];
98
- options?: ChatCompletionOptions;
99
- }
100
- /**
101
- * 聊天完成响应消息
102
- */
103
- interface ChatCompletionResponseMessage {
104
- role: MessageRole;
105
- content: string;
106
- [x: string]: unknown;
107
- }
108
- /**
109
- * 聊天完成响应选择
110
- */
111
- interface ChatCompletionResponseChoice {
112
- index: number;
113
- message: ChatCompletionResponseMessage;
114
- finish_reason: string;
115
- }
116
- /**
117
- * 聊天完成响应使用情况
118
- */
119
- interface ChatCompletionResponseUsage {
120
- prompt_tokens: number;
121
- completion_tokens: number;
122
- total_tokens: number;
123
- }
124
- /**
125
- * 聊天完成响应
126
- */
127
- interface ChatCompletionResponse {
128
- id: string;
129
- object: string;
130
- created: number;
131
- model: string;
132
- choices: ChatCompletionResponseChoice[];
133
- usage: ChatCompletionResponseUsage;
134
- }
135
- /**
136
- * 流式聊天完成响应增量
137
- */
138
- interface ChatCompletionStreamResponseDelta {
139
- content?: string;
140
- role?: MessageRole;
141
- [x: string]: unknown;
142
- }
143
- /**
144
- * 流式聊天完成响应选择
145
- */
146
- interface ChatCompletionStreamResponseChoice {
147
- index: number;
148
- delta: ChatCompletionStreamResponseDelta;
149
- finish_reason: string | null;
150
- }
151
- /**
152
- * 流式聊天完成响应
153
- */
154
- interface ChatCompletionStreamResponse {
155
- id: string;
156
- object: string;
157
- created: number;
158
- model: string;
159
- choices: ChatCompletionStreamResponseChoice[];
160
- }
161
- /**
162
- * AI模型提供商类型
163
- */
164
- type AIProvider = 'openai' | 'deepseek' | 'custom';
165
- /**
166
- * AI模型配置接口
167
- */
168
- interface AIModelConfig {
169
- provider: AIProvider;
170
- providerImplementation?: BaseModelProvider;
171
- apiKey?: string;
172
- apiUrl?: string;
173
- apiVersion?: string;
174
- defaultModel?: string;
175
- defaultOptions?: ChatCompletionOptions;
176
- }
177
- /**
178
- * 错误类型
179
- */
180
- declare enum ErrorType {
181
- NETWORK_ERROR = "network_error",
182
- AUTHENTICATION_ERROR = "authentication_error",
183
- RATE_LIMIT_ERROR = "rate_limit_error",
184
- SERVER_ERROR = "server_error",
185
- MODEL_ERROR = "model_error",
186
- TIMEOUT_ERROR = "timeout_error",
187
- UNKNOWN_ERROR = "unknown_error"
188
- }
189
- /**
190
- * AI适配器错误
191
- */
192
- interface AIAdapterError {
193
- type: ErrorType;
194
- message: string;
195
- statusCode?: number;
196
- originalError?: object;
197
- }
198
- /**
199
- * 流式响应事件类型
200
- */
201
- declare enum StreamEventType {
202
- DATA = "data",
203
- ERROR = "error",
204
- DONE = "done"
205
- }
206
- /**
207
- * 流式响应处理器
208
- */
209
- interface StreamHandler {
210
- onData: (data: ChatCompletionStreamResponse) => void;
211
- onError: (error: AIAdapterError) => void;
212
- onDone: (finishReason?: string) => void;
213
- }
214
-
215
- type DeepReadonly<T> = T extends (...args: any[]) => any ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends object ? {
216
- readonly [K in keyof T]: DeepReadonly<T[K]>;
217
- } : T;
218
- type RequestState = 'idle' | 'processing' | 'completed' | 'aborted' | 'error';
219
- type RequestProcessingState = 'requesting' | 'completing' | string;
220
- type ChatMessage<Metadata extends object = Record<string, unknown>, State extends object = Record<string, unknown>> = ChatCompletionMessageParam & {
221
- tool_calls?: Array<ChatCompletionMessageToolCall>;
222
- loading?: boolean;
223
- metadata?: Metadata;
224
- state?: State;
225
- [key: string]: any;
226
- };
227
- interface MessageRequestBody {
228
- messages: Array<ChatMessage>;
229
- tools?: Array<ChatCompletionFunctionTool>;
230
- [key: string]: any;
231
- }
232
- type ResponseProvider<T extends ChatCompletion | ChatCompletionChunk = ChatCompletion | ChatCompletionChunk> = (requestBody: MessageRequestBody, abortSignal: AbortSignal) => Promise<T> | AsyncGenerator<T> | Promise<AsyncGenerator<T>>;
233
- interface PublicMessageState {
234
- requestState: RequestState;
235
- processingState?: RequestProcessingState;
236
- messages: ChatMessage[];
237
- isProcessing: boolean;
238
- }
239
- interface InternalMessageState {
240
- requestState: RequestState;
241
- processingState?: RequestProcessingState;
242
- messages: ChatMessage[];
243
- }
244
- interface MessageRuntime {
245
- currentTurn: ChatMessage[];
246
- customContext: Record<string, unknown>;
247
- abortController: AbortController | null;
248
- responseProvider: ResponseProvider;
249
- }
250
- interface MessageEngine {
251
- getState(): PublicMessageState;
252
- subscribe(listener: (state: PublicMessageState) => void): () => void;
253
- subscribe(kinds: MessageUpdateKinds, listener: (state: PublicMessageState) => void): () => void;
254
- sendMessage(content: string): Promise<void>;
255
- send(...msgs: ChatMessage[]): Promise<void>;
256
- abort(): Promise<void>;
257
- setResponseProvider(provider: ResponseProvider): void;
258
- }
259
- type MessageUpdateKind = 'messages' | 'requestState';
260
- type MessageUpdateKinds = MessageUpdateKind | MessageUpdateKind[];
261
- type MessageMutationRecipe = (draft: InternalMessageState, skipNotify: () => void) => void;
262
- interface MutateMessageStateFn {
263
- /**
264
- * 在受控上下文中修改消息状态,并按声明的更新类型分发状态变更通知。
265
- *
266
- * 这里的“通知”语义对应 `subscribe` 订阅链路,用于驱动依赖 engine 状态快照的观察者;
267
- * 它并不等同于具体框架的响应式更新机制。对于 Vue 等运行时,界面更新可能同时依赖
268
- * 框架自身的响应式追踪与 `subscribe` 侧的状态通知,两者职责不同,不应混用。
269
- */
270
- (kinds: MessageUpdateKinds, recipe: MessageMutationRecipe): void;
271
- }
272
- interface MessageStateAdapter {
273
- initialize(initialState: InternalMessageState): void;
274
- getState(): PublicMessageState;
275
- /**
276
- * 创建一条适配当前运行时的消息对象。
277
- *
278
- * engine 和 core 插件里凡是“新建消息”的入口,都应统一走这个方法,
279
- * 以便不同平台注入各自的运行时能力。
280
- *
281
- * 例如:
282
- * - native/纯 TS 场景:直接返回原对象即可
283
- * `createMessage(message) { return message }`
284
- * - Vue 场景:返回 reactive proxy,使后续对 message.content / message.state 的原地修改能够被追踪
285
- * `createMessage(message) { return reactive(message) }`
286
- */
287
- createMessage<T extends ChatMessage>(message: T): T;
288
- mutate: MutateMessageStateFn;
289
- subscribe(listener: (state: PublicMessageState) => void): () => void;
290
- subscribe(kinds: MessageUpdateKinds, listener: (state: PublicMessageState) => void): () => void;
291
- }
292
- interface BasePluginContext {
293
- getState(): PublicMessageState;
294
- /**
295
- * 创建一条适配当前运行时的消息对象。
296
- *
297
- * 插件在运行过程中如果需要主动创建并追加消息,应统一通过此接口构造消息实例,
298
- * 而不是直接持有普通对象字面量。这样可以确保消息对象具备当前平台所要求的运行时能力。
299
- *
300
- * 对于采用响应式机制的平台(例如 Vue),该接口通常会返回带有响应式包装的消息实例。
301
- * 如果插件绕过此接口直接创建普通对象,再参与后续的状态更新或原地字段修改,
302
- * 可能导致消息内容、状态字段等变更无法被正确追踪。
303
- */
304
- createMessage<T extends ChatMessage>(message: T): T;
305
- /**
306
- * 在受控上下文中修改状态,并触发与 `subscribe` 对应的状态更新通知。
307
- *
308
- * 该通知机制面向 engine 的订阅接口,而不是具体框架的响应式系统本身。
309
- * 因此,在需要让 `subscribe` 观察者感知到变更时,应通过此接口完成状态写入。
310
- */
311
- mutate: MutateMessageStateFn;
312
- abortSignal: AbortSignal;
313
- currentTurn: ChatMessage[];
314
- /**
315
- * 当前 engine 中已注册的插件列表。
316
- *
317
- * 插件可基于该列表发现其他插件暴露的轻量协议,例如 toolPlugin 收集 provideTools。
318
- */
319
- plugins: readonly MessageEnginePlugin[];
320
- customContext: Record<string, unknown>;
321
- setRequestState: (state: RequestState, processingState?: RequestProcessingState) => void;
322
- setCustomContext: (data: Record<string, unknown>) => void;
323
- }
324
- interface BeforeRequestContext extends BasePluginContext {
325
- requestBody: MessageRequestBody;
326
- }
327
- interface AfterRequestContext extends BasePluginContext {
328
- currentMessage: DeepReadonly<ChatMessage>;
329
- lastChoice?: ChatCompletion.Choice | ChatCompletionChunk.Choice;
330
- /**
331
- * 使用 appendMessage 函数追加消息,可触发消息更新通知。
332
- */
333
- appendMessage: (message: ChatMessage | ChatMessage[]) => void;
334
- requestNext: () => void;
335
- }
336
- interface CompletionChunkContext extends BasePluginContext {
337
- /**
338
- * 当前消息,只读。需要使用 updateCurrentMessage 函数修改当前消息,才能正常触发消息更新通知。
339
- */
340
- currentMessage: DeepReadonly<ChatMessage>;
341
- /**
342
- * 使用 updateCurrentMessage 函数修改当前消息,才能正常触发消息更新通知。
343
- */
344
- updateCurrentMessage: (recipe: (message: ChatMessage) => void) => void;
345
- choice: ChatCompletion.Choice | ChatCompletionChunk.Choice;
346
- chunk: ChatCompletion | ChatCompletionChunk;
347
- }
348
- interface MessageEnginePlugin {
349
- /**
350
- * 插件名称。
351
- */
352
- name?: string;
353
- /**
354
- * 是否禁用插件。
355
- */
356
- disabled?: boolean | ((context: BasePluginContext) => boolean);
357
- /**
358
- * 一次对话回合(turn)开始钩子:用户消息入队后、正式发起请求之前触发。
359
- * 按插件注册顺序串行执行,便于做有序初始化/校验;出错则中断流程。
360
- */
361
- onTurnStart?: (context: BasePluginContext) => MaybePromise<void>;
362
- /**
363
- * 一次对话回合(turn)结束的生命周期钩子。
364
- * 触发时机:本轮对话完成(成功、被中止)后。
365
- * 执行策略:按插件注册顺序串行执行,有错误则中断流程。
366
- */
367
- onTurnEnd?: (context: BasePluginContext) => MaybePromise<void>;
368
- /**
369
- * 请求开始前的生命周期钩子。
370
- * 触发时机:已组装 requestBody,正式发起请求之前。
371
- * 执行策略:按插件注册顺序串行执行,避免并发修改 requestBody 产生冲突。
372
- */
373
- onBeforeRequest?: (context: BeforeRequestContext) => MaybePromise<void>;
374
- /**
375
- * 请求完成后的生命周期钩子。
376
- * 触发时机:本次请求(含流式)结束后。
377
- * 执行策略:并行执行(Promise.all)。
378
- */
379
- onAfterRequest?: (context: AfterRequestContext) => MaybePromise<void>;
380
- /**
381
- * 数据块处理钩子,在接收到每个响应数据块时触发。
382
- * 无论是流式响应(多个增量数据块)还是非流式响应(单个完整数据块),都会触发此钩子。
383
- */
384
- onCompletionChunk?: (context: CompletionChunkContext) => void;
385
- onError?: (context: BasePluginContext & {
386
- error: unknown;
387
- }) => void;
388
- onFinally?: (context: BasePluginContext) => void;
389
- }
390
- interface CreateMessageEngineOptions {
391
- initialMessages?: ChatMessage[];
392
- /**
393
- * 请求消息时,要包含的字段(白名单)。默认包含所有字段。
394
- * 如果 `requestMessageFieldsExclude` 存在,会先取 `requestMessageFields` 中的字段,再排除 `requestMessageFieldsExclude` 中的字段
395
- */
396
- requestMessageFields?: string[];
397
- /**
398
- * 请求消息时,要排除的字段(黑名单)。默认会排除 `state`、`metadata`、`loading` 字段(这几个字段是给UI展示用的)。
399
- * 如果 `requestMessageFields` 存在,会先取 `requestMessageFields` 中的字段,再排除 `requestMessageFieldsExclude` 中的字段
400
- */
401
- requestMessageFieldsExclude?: string[];
402
- responseProvider?: ResponseProvider;
403
- /**
404
- * 全局的数据块处理钩子,在接收到每个响应数据块时触发。
405
- * 注意:此钩子与插件中的 onCompletionChunk 有区别。
406
- * 如果传入了此参数,默认的 chunk 处理逻辑不会自动执行,需要手动调用 runDefault 来执行默认处理逻辑。
407
- */
408
- onCompletionChunk?: (context: CompletionChunkContext, runDefault: () => void) => void;
409
- plugins?: MessageEnginePlugin[];
410
- }
411
-
412
- type AssistantMessageWithState = ChatMessage<Record<string, unknown>, {
413
- toolCall?: Record<string, Record<string, unknown>>;
414
- }>;
415
- type ToolSource = {
416
- type: 'toolPlugin';
417
- } | {
418
- type: 'toolProvider';
419
- pluginName?: string;
420
- } | {
421
- type: 'unknown';
422
- };
423
- type ToolCallContext = BasePluginContext & {
424
- assistantMessage: AssistantMessageWithState;
425
- toolMessage: ChatMessage;
426
- /**
427
- * 当前工具的来源。
428
- */
429
- toolSource: ToolSource;
430
- };
431
- type ToolCallResult = string | Record<string, any>;
432
- type ToolCallReturn = ToolCallResult | Promise<ToolCallResult> | AsyncGenerator<ToolCallResult>;
433
- interface RuntimeTool {
434
- tool: ChatCompletionFunctionTool;
435
- handler: (toolCall: ChatCompletionMessageFunctionToolCall, context: ToolCallContext) => ToolCallReturn;
436
- }
437
- type ToolProviderItem = ChatCompletionFunctionTool | RuntimeTool;
438
- interface ToolProvider {
439
- provideTools: (context: BasePluginContext) => MaybePromise<ToolProviderItem[]>;
440
- }
441
- declare const toolPlugin: (options: MessageEnginePlugin & {
442
- /**
443
- * 获取本轮可用工具。可以返回普通 tool schema,也可以返回带执行函数的 runtime tool。
444
- */
445
- getTools: (context: BasePluginContext) => MaybePromise<ToolProviderItem[]>;
446
- /**
447
- * 在处理包含 tool_calls 的响应前调用。
448
- */
449
- beforeCallTools?: (toolCalls: ChatCompletionMessageToolCall[], context: BasePluginContext & {
450
- assistantMessage: AssistantMessageWithState;
451
- }) => Promise<void>;
452
- /**
453
- * 执行单个工具调用并返回其文本结果的函数。
454
- */
455
- callTool: (toolCall: ChatCompletionMessageToolCall, context: ToolCallContext) => Promise<ToolCallResult> | AsyncGenerator<ToolCallResult>;
456
- /**
457
- * 工具调用开始时的回调函数。
458
- * 触发时机:工具消息已创建并追加后,调用 callTool 之前触发。
459
- * @param toolCall - 工具调用对象
460
- * @param context - 插件上下文,包含当前工具消息
461
- */
462
- onToolCallStart?: (toolCall: ChatCompletionMessageToolCall, context: ToolCallContext) => void;
463
- /**
464
- * 工具调用结束时的回调函数。
465
- * 触发时机:工具调用完成(成功、失败或取消)时触发。
466
- * @param toolCall - 工具调用对象
467
- * @param context - 插件上下文,包含当前工具消息、状态和错误信息
468
- * @param context.status - 工具调用状态:'success' | 'failed' | 'cancelled'
469
- * @param context.error - 当状态为 'failed' 或 'cancelled' 时,可能包含错误信息
470
- */
471
- onToolCallEnd?: (toolCall: ChatCompletionMessageToolCall, context: ToolCallContext & {
472
- status: "success" | "failed" | "cancelled";
473
- error?: Error;
474
- }) => void;
475
- /**
476
- * 当请求被中止时用于工具调用取消的消息内容。
477
- */
478
- toolCallCancelledContent?: string;
479
- /**
480
- * 当工具调用执行失败(抛错或拒绝)时使用的消息内容。
481
- */
482
- toolCallFailedContent?: string;
483
- /**
484
- * 是否在请求前自动补充缺失的 tool 消息。
485
- * 当 assistant 响应了 tool_calls 但未追加对应的 tool 消息时,
486
- * 插件将自动补充"工具调用已取消"的 tool 消息。默认:false。
487
- */
488
- autoFillMissingToolMessages?: boolean;
489
- }) => MessageEnginePlugin;
490
-
491
- type SkillCommandRequest = {
492
- skillName: string;
493
- command: string;
494
- args: string[];
495
- skill: SkillDefinition;
496
- };
497
- type SkillCommandResult = string | Record<string, unknown>;
498
- type SkillCommandExecutor = (request: SkillCommandRequest) => MaybePromise<SkillCommandResult>;
499
- type SkillRuntimeToolsOptions = {
500
- /**
501
- * @experimental 该 API 仍在设计和验证中,命令协议、返回结构和安全边界后续可能调整。
502
- */
503
- executeSkillCommand?: SkillCommandExecutor;
504
- };
505
- /**
506
- * 创建 skill 运行时工具。
507
- *
508
- * 默认只根据 skill 文件创建基础文件工具;传入 executeSkillCommand 时会额外创建命令执行工具。
509
- */
510
- declare const createSkillRuntimeTools: (skills: SkillDefinition[], options?: SkillRuntimeToolsOptions) => RuntimeTool[];
511
- declare const compileSkillInstructions: (skills: SkillDefinition[]) => Promise<ChatCompletionSystemMessageParam | undefined>;
512
-
513
- /**
514
- * Skill 插件的转换状态。
515
- *
516
- * 该状态会写入 customContext.__tiny_robot_skill,供消息钩子和插件回调读取同一份编译结果。
517
- */
518
- interface SkillPluginState {
519
- skills: SkillDefinition[];
520
- skillNames: string[];
521
- runtimeTools: RuntimeTool[];
522
- }
523
- /**
524
- * 将已选择的 skills 转换为消息指令和工具的配置项。
525
- */
526
- type SkillPluginOptions = MessageEnginePlugin & {
527
- /**
528
- * 返回本次请求要使用的 skills。
529
- *
530
- * 插件只转换返回的 skills;选择、存储和集合管理由调用方负责。
531
- */
532
- getSkills?: (context: BasePluginContext) => MaybePromise<SkillDefinition[] | undefined>;
533
- /**
534
- * 执行模型为某个 skill 规划的后端命令。
535
- *
536
- * @experimental 该 API 仍在设计和验证中,命令协议、返回结构和安全边界后续可能调整。
537
- *
538
- * 插件只负责暴露 execute_skill_command 并转发参数;沙箱、镜像和权限控制由调用方实现。
539
- */
540
- executeSkillCommand?: (request: SkillCommandRequest, context: BasePluginContext) => MaybePromise<SkillCommandResult>;
541
- /**
542
- * skills 解析并规整为插件状态后触发。
543
- */
544
- onSkillsResolved?: (state: SkillPluginState, context: BasePluginContext) => MaybePromise<void>;
545
- };
546
- declare const skillPlugin: (options: SkillPluginOptions) => MessageEnginePlugin & ToolProvider;
547
-
548
- export { type ToolSource as $, type AIAdapterError as A, BaseModelProvider as B, type ChatCompletionOptions as C, type DeepReadonly as D, ErrorType as E, type MessageUpdateKind as F, type MessageUpdateKinds as G, type MutateMessageStateFn as H, type InternalMessageState as I, type RequestState as J, type ResponseProvider as K, type RuntimeTool as L, type MaybePromise as M, type SkillCommandRequest as N, type SkillCommandResult as O, type PublicMessageState as P, type SkillPluginOptions as Q, type RequestProcessingState as R, type SkillCommandExecutor as S, type SkillPluginState as T, type SkillRuntimeToolsOptions as U, StreamEventType as V, type StreamHandler as W, type ToolCall as X, type ToolCallContext as Y, type ToolProvider as Z, type ToolProviderItem as _, type AIModelConfig as a, compileSkillInstructions as a0, createSkillRuntimeTools as a1, skillPlugin as a2, toolPlugin as a3, type AIProvider as b, type AfterRequestContext as c, type BasePluginContext as d, type BeforeRequestContext as e, type ChatCompletionRequest as f, type ChatCompletionResponse as g, type ChatCompletionResponseChoice as h, type ChatCompletionResponseMessage as i, type ChatCompletionResponseUsage as j, type ChatCompletionStreamResponse as k, type ChatCompletionStreamResponseChoice as l, type ChatCompletionStreamResponseDelta as m, type ChatHistory as n, type ChatMessage as o, type ChatMessage$1 as p, type CompletionChunkContext as q, type CreateMessageEngineOptions as r, type MessageEngine as s, type MessageEnginePlugin as t, type MessageMetadata as u, type MessageMutationRecipe as v, type MessageRequestBody as w, type MessageRole as x, type MessageRuntime as y, type MessageStateAdapter as z };