@codehz/ai 0.1.8 → 0.2.1

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 CHANGED
@@ -159,14 +159,20 @@ const mock = new MockAdapter({
159
159
  });
160
160
  ```
161
161
 
162
- 公开 adapter 接口只暴露稳定的标识与流式来源:
162
+ 公开 adapter 接口暴露稳定标识和各维度能力:
163
163
 
164
164
  ```ts
165
165
  adapter.kind; // "responses" | "messages" | "chat-completions" | ...
166
- adapter.nativeStreaming; // 是否为 provider 原生流,而不是本地模拟分片
166
+ adapter.capabilities.textStreaming; // "native" | "synthetic" | "none"
167
+ adapter.capabilities.reasoningStreaming;
168
+ adapter.capabilities.toolCallStreaming;
169
+ adapter.capabilities.replay; // "canonical" | "opaque" | "none"
170
+ adapter.capabilities.usage; // "stream" | "final" | "none"
171
+ adapter.capabilities.toolResultOutcomes;
167
172
  ```
168
173
 
169
- reasoning、tool call、`replay` 材料这类响应特征,应直接从本次事件流、warning `replay` 内容判断。
174
+ `nativeStreaming` 已由 `capabilities` 直接替代。响应级 `backend.isSyntheticStream` 根据
175
+ `textStreaming === "synthetic"` 推导;具体响应内容仍应从本次事件流、warning 和 `replay` 判断。
170
176
 
171
177
  ## Mock 后端
172
178
 
package/dist/index.d.mts CHANGED
@@ -99,9 +99,7 @@ type Usage = {
99
99
  reasoningTokens?: number;
100
100
  totalTokens?: number; /** Tokens read from prompt cache (OpenAI cached_tokens, Anthropic cache_read_input_tokens) */
101
101
  cachedInputTokens?: number; /** Tokens written to prompt cache (Anthropic cache_creation_input_tokens) */
102
- cacheWriteInputTokens?: number; /** Best-effort billable input (full-rate input; excludes discounted cache reads where known) */
103
- billableInputTokens?: number; /** Best-effort billable output (non-reasoning slice when provider gives reasoning breakdown) */
104
- billableOutputTokens?: number;
102
+ cacheWriteInputTokens?: number;
105
103
  };
106
104
  type BillingInfo = {
107
105
  amount?: number;
@@ -167,7 +165,14 @@ type ResponseAuxiliaryEvent = StreamEventBase & {
167
165
  };
168
166
  type ResponseCompletedEvent = StreamEventBase & {
169
167
  type: "response.completed";
170
- response: AIResponse;
168
+ replay: ReplayItem[];
169
+ stopReason?: StopReason;
170
+ usage?: Usage;
171
+ billing?: BillingInfo;
172
+ auxiliary?: AuxiliaryInfo;
173
+ warnings?: string[];
174
+ opaqueOutput?: OpaqueItem[];
175
+ trace?: Partial<BackendTrace>;
171
176
  };
172
177
  type MessageStartedEvent = StreamEventBase & {
173
178
  type: "message.started";
@@ -179,14 +184,11 @@ type MessageStartedEvent = StreamEventBase & {
179
184
  type MessageDeltaEvent = StreamEventBase & {
180
185
  type: "message.delta";
181
186
  itemId: string;
182
- delta: {
183
- type: "text";
184
- text: string;
185
- };
187
+ delta: ContentBlock;
186
188
  };
187
189
  type MessageCompletedEvent = StreamEventBase & {
188
190
  type: "message.completed";
189
- item: MessageItem;
191
+ itemId: string;
190
192
  };
191
193
  type ReasoningStartedEvent = StreamEventBase & {
192
194
  type: "reasoning.started";
@@ -202,7 +204,7 @@ type ReasoningDeltaEvent = StreamEventBase & {
202
204
  };
203
205
  type ReasoningCompletedEvent = StreamEventBase & {
204
206
  type: "reasoning.completed";
205
- item: ReasoningItem;
207
+ itemId: string;
206
208
  };
207
209
  type ToolCallStartedEvent = StreamEventBase & {
208
210
  type: "tool_call.started";
@@ -220,7 +222,7 @@ type ToolCallDeltaEvent = StreamEventBase & {
220
222
  };
221
223
  type ToolCallCompletedEvent = StreamEventBase & {
222
224
  type: "tool_call.completed";
223
- item: ToolCallItem;
225
+ itemId: string;
224
226
  };
225
227
  type AIStreamEvent = ResponseStartedEvent | ResponseWarningEvent | ResponseAuxiliaryEvent | MessageStartedEvent | MessageDeltaEvent | MessageCompletedEvent | ReasoningStartedEvent | ReasoningDeltaEvent | ReasoningCompletedEvent | ToolCallStartedEvent | ToolCallDeltaEvent | ToolCallCompletedEvent | ResponseCompletedEvent;
226
228
  //#endregion
@@ -231,9 +233,18 @@ type NormalizedRequest = AIRequest & {
231
233
  model: string;
232
234
  requestId: string;
233
235
  };
236
+ type StreamingCapability = "native" | "synthetic" | "none";
237
+ type AdapterCapabilities = {
238
+ readonly textStreaming: StreamingCapability;
239
+ readonly reasoningStreaming: StreamingCapability;
240
+ readonly toolCallStreaming: StreamingCapability;
241
+ readonly replay: "canonical" | "opaque" | "none";
242
+ readonly usage: "stream" | "final" | "none";
243
+ readonly toolResultOutcomes: ReadonlyArray<"success" | "error" | "rejected">;
244
+ };
234
245
  interface BackendAdapter {
235
246
  readonly kind: "chat-completions" | "messages" | "responses" | "ollama" | "mock";
236
- readonly nativeStreaming: boolean;
247
+ readonly capabilities: AdapterCapabilities;
237
248
  stream(request: NormalizedRequest): AsyncIterable<AIStreamEvent>;
238
249
  }
239
250
  type CreateAIClientOptions = {
@@ -296,7 +307,16 @@ declare class AIError extends Error {
296
307
  }
297
308
  /** 请求构造失败 — 参数校验不通过。在进入 adapter 前同步抛错。 */
298
309
  declare class AIRequestError extends AIError {
299
- constructor(message: string, code: ErrorCode);
310
+ readonly issues?: readonly {
311
+ field: string;
312
+ code: string;
313
+ message: string;
314
+ }[] | undefined;
315
+ constructor(message: string, code: ErrorCode, issues?: readonly {
316
+ field: string;
317
+ code: string;
318
+ message: string;
319
+ }[] | undefined);
300
320
  }
301
321
  /** Provider 调用失败 — HTTP 非 2xx、网络错误。由 AdapterBase 捕获转为 warning。 */
302
322
  declare class AIProviderError extends AIError {
@@ -325,7 +345,8 @@ declare const WarningCode: {
325
345
  readonly LOOKUP_TIMEOUT: "LOOKUP_TIMEOUT"; /** 流提前中断 */
326
346
  readonly STREAM_INCOMPLETE: "STREAM_INCOMPLETE"; /** 能力降级 */
327
347
  readonly CAPABILITY_DOWNGRADE: "CAPABILITY_DOWNGRADE"; /** 模拟流式 */
328
- readonly SYNTHETIC_STREAM: "SYNTHETIC_STREAM";
348
+ readonly SYNTHETIC_STREAM: "SYNTHETIC_STREAM"; /** 工具调用以批量方式到达(非 token 级流式) */
349
+ readonly TOOL_CALL_BATCHED: "TOOL_CALL_BATCHED";
329
350
  };
330
351
  //#endregion
331
352
  //#region src/core/event-factory.d.ts
@@ -345,18 +366,27 @@ declare function createEventFactory(state: EventFactoryState): {
345
366
  billing?: BillingInfo;
346
367
  auxiliary?: Partial<AuxiliaryInfo>;
347
368
  }): ResponseAuxiliaryEvent;
348
- responseCompleted(response: AIResponse): ResponseCompletedEvent;
369
+ responseCompleted(completion: {
370
+ replay: ReplayItem[];
371
+ stopReason?: StopReason;
372
+ usage?: Usage;
373
+ billing?: BillingInfo;
374
+ auxiliary?: AuxiliaryInfo;
375
+ warnings?: string[];
376
+ opaqueOutput?: OpaqueItem[];
377
+ trace?: Partial<BackendTrace>;
378
+ }): ResponseCompletedEvent;
349
379
  messageStarted(id: string): MessageStartedEvent;
350
- messageDelta(itemId: string, text: string): MessageDeltaEvent;
351
- messageCompleted(item: MessageItem): MessageCompletedEvent;
380
+ messageDelta(itemId: string, delta: ContentBlock): MessageDeltaEvent;
381
+ messageCompleted(itemId: string): MessageCompletedEvent;
352
382
  reasoningStarted(id: string, visibility: ReasoningItem["visibility"]): ReasoningStartedEvent;
353
383
  reasoningDelta(itemId: string, delta: ContentBlock): ReasoningDeltaEvent;
354
- reasoningCompleted(item: ReasoningItem): ReasoningCompletedEvent;
384
+ reasoningCompleted(itemId: string): ReasoningCompletedEvent;
355
385
  toolCallStarted(id: string, name: string): ToolCallStartedEvent;
356
386
  toolCallDelta(itemId: string, delta: {
357
387
  argumentsText?: string;
358
388
  }): ToolCallDeltaEvent;
359
- toolCallCompleted(item: ToolCallItem): ToolCallCompletedEvent; /** 返回当前已发出的 sequence 计数(用于断言) */
389
+ toolCallCompleted(itemId: string): ToolCallCompletedEvent; /** 返回当前已发出的 sequence 计数(用于断言) */
360
390
  readonly sequence: number; /** 返回当前已记录的 warning 副本。 */
361
391
  readonly warnings: string[];
362
392
  };
@@ -367,7 +397,7 @@ type EventFactory = ReturnType<typeof createEventFactory>;
367
397
  * 将事件数组聚合为 AIResponse。
368
398
  * 适用于测试和离线处理场景。
369
399
  */
370
- declare function aggregateEvents(events: AIStreamEvent[]): AIResponse;
400
+ declare function aggregateEvents(events: readonly AIStreamEvent[]): AIResponse;
371
401
  //#endregion
372
402
  //#region src/core/collect-stream.d.ts
373
403
  declare function collectStream(stream: AsyncIterable<AIStreamEvent>): Promise<AIResponse>;
@@ -493,7 +523,7 @@ type StreamResult = {
493
523
  };
494
524
  declare abstract class AdapterBase implements BackendAdapter {
495
525
  abstract readonly kind: "chat-completions" | "messages" | "responses" | "ollama" | "mock";
496
- abstract readonly nativeStreaming: boolean;
526
+ abstract readonly capabilities: AdapterCapabilities;
497
527
  /**
498
528
  * stream 模板方法:
499
529
  * 1. 创建事件工厂,发射 response.started
@@ -586,7 +616,7 @@ type ResponsesTool = {
586
616
  };
587
617
  declare class ResponsesAdapter extends AdapterBase {
588
618
  readonly kind: "responses";
589
- readonly nativeStreaming = true;
619
+ readonly capabilities: AdapterCapabilities;
590
620
  private apiKey;
591
621
  private baseUrl;
592
622
  private fetchFn;
@@ -654,14 +684,12 @@ type MessagesAPITool = {
654
684
  };
655
685
  declare class MessagesAdapter extends AdapterBase {
656
686
  readonly kind: "messages";
657
- readonly nativeStreaming = true;
687
+ readonly capabilities: AdapterCapabilities;
658
688
  private apiKey;
659
689
  private apiVersion;
660
690
  private baseUrl;
661
691
  private fetchFn;
662
- private warningAccumulator;
663
692
  constructor(options: MessagesAdapterOptions);
664
- protected warn(message: string, _code?: string): void;
665
693
  protected buildRequest(request: NormalizedRequest): MessagesAPIRequest;
666
694
  protected runStream(providerRequest: MessagesAPIRequest, factory: EventFactory, request: NormalizedRequest): AsyncIterable<AIStreamEvent>;
667
695
  }
@@ -686,6 +714,7 @@ type ChatRequest = {
686
714
  temperature?: number;
687
715
  max_tokens?: number;
688
716
  stream: true;
717
+ n: 1;
689
718
  };
690
719
  type ChatMessage = {
691
720
  role: "system" | "user" | "assistant" | "tool";
@@ -713,7 +742,7 @@ type ChatTool = {
713
742
  };
714
743
  declare class ChatCompletionsAdapter extends AdapterBase {
715
744
  readonly kind: "chat-completions";
716
- readonly nativeStreaming = true;
745
+ readonly capabilities: AdapterCapabilities;
717
746
  private apiKey;
718
747
  private baseUrl;
719
748
  private fetchFn;
@@ -761,7 +790,7 @@ type OllamaTool = {
761
790
  };
762
791
  declare class OllamaAdapter extends AdapterBase {
763
792
  readonly kind: "ollama";
764
- readonly nativeStreaming = true;
793
+ readonly capabilities: AdapterCapabilities;
765
794
  private baseUrl;
766
795
  private apiKey;
767
796
  private fetchFn;
@@ -910,7 +939,14 @@ type MockProviderRequest = {
910
939
  declare function assertMockRequest(request: NormalizedRequest, expectation: MockRequestExpectation, context: MockHandlerContext): void;
911
940
  declare class MockAdapter extends AdapterBase {
912
941
  readonly kind: "mock";
913
- readonly nativeStreaming = false;
942
+ readonly capabilities: {
943
+ readonly textStreaming: "synthetic";
944
+ readonly reasoningStreaming: "synthetic";
945
+ readonly toolCallStreaming: "synthetic";
946
+ readonly replay: "canonical";
947
+ readonly usage: "final";
948
+ readonly toolResultOutcomes: readonly ["success", "error", "rejected"];
949
+ };
914
950
  private readonly handler;
915
951
  private readonly providerMetadata?;
916
952
  private cursor;
@@ -1000,6 +1036,9 @@ type SSEParseResult = {
1000
1036
  rest: string;
1001
1037
  malformedEvents: number;
1002
1038
  };
1039
+ type ParseSSEOptions = {
1040
+ allowEOF?: boolean;
1041
+ };
1003
1042
  /**
1004
1043
  * 将 SSE 文本块解析为事件数组。
1005
1044
  * 累积事件行直到遇到空行,支持 [DONE] 标记。
@@ -1010,7 +1049,7 @@ type SSEParseResult = {
1010
1049
  * - 未完成的行保留在 rest 中,等待下次 chunk 补全
1011
1050
  * - 支持跨 chunk 的 event 分片
1012
1051
  */
1013
- declare function parseSSEEvents(chunk: string): SSEParseResult;
1052
+ declare function parseSSEEvents(chunk: string, options?: ParseSSEOptions): SSEParseResult;
1014
1053
  //#endregion
1015
1054
  //#region src/helpers/synthetic-stream.d.ts
1016
1055
  type SyntheticStreamOptions = {
@@ -1084,11 +1123,94 @@ declare function usageFromAnthropicMessages(raw: {
1084
1123
  cache_read_input_tokens?: number;
1085
1124
  [key: string]: unknown;
1086
1125
  }): Partial<Usage>;
1087
- /** Ollama 流式 chunk(无 cache / reasoning 细分时仅填基础与 billable 镜像) */
1126
+ /** Ollama 流式 chunk */
1088
1127
  declare function usageFromOllama(raw: {
1089
1128
  prompt_eval_count?: number;
1090
1129
  eval_count?: number;
1091
1130
  }): Partial<Usage>;
1092
1131
  //#endregion
1093
- export { type AIClient, AIError, AIMappingError, AIProviderError, type AIRequest, AIRequestError, type AIResponse, AIStreamError, type AIStreamEvent, AdapterAuxiliaryState, AdapterBase, AuxiliaryCollector, type AuxiliaryFinalizeOptions, type AuxiliaryFinalizeResult, type AuxiliaryInfo, type BackendAdapter, type BackendTrace, type BillingInfo, type BillingPostprocessHook, type BillingSource, ChatCompletionsAdapter, type ChatCompletionsAdapterOptions, type ContentBlock, type CreateAIClientOptions, type EventFactory, type EventFactoryBackend, type EventFactoryState, type FetchFn, type IncludeSettings, type InputItem, type InstructionBlock, type JsonContentBlock, type LookupResult, type MessageCompletedEvent, type MessageDeltaEvent, type MessageItem, type MessageStartedEvent, MessagesAdapter, type MessagesAdapterOptions, MockAdapter, type MockAdapterOptions, type MockAuxiliaryStep, type MockCompleteStep, type MockErrorStep, type MockHandler, type MockHandlerContext, type MockHistoryRecord, type MockInputExpectation, type MockInterruptStep, type MockMessageStep, type MockOutputStep, type MockReasoningStep, type MockRequestExpectation, type MockStaticHandler, type MockStep, type MockTextStreamOptions, type MockThrowStep, type MockToolCallStep, type MockWarningStep, type NormalizeOptions, type NormalizedRequest, OllamaAdapter, type OllamaAdapterOptions, type OpaqueItem, type OutputItem, type ReasoningCompletedEvent, type ReasoningDeltaEvent, type ReasoningItem, type ReasoningStartedEvent, type ReplayItem, type ResponseAuxiliaryEvent, type ResponseCompletedEvent, type ResponseStartedEvent, type ResponseWarningEvent, ResponsesAdapter, type ResponsesAdapterOptions, type SSEEvent, type StopReason, type StreamEventBase, type StreamResult, type SyntheticStreamOptions, type TextContentBlock, type ToolCallCompletedEvent, type ToolCallDeltaEvent, type ToolCallItem, type ToolCallStartedEvent, type ToolChoice, type ToolDefinition, type ToolResultItem, type Usage, type UsageSource, type ValidationIssue, WarningCode, aggregateEvents, assertMockRequest, assertValidRequest, blockToText, collectStream, contentBlocksToText, createAIClient, createEventFactory, emitMalformedStreamWarning, extractText, imageBlock, instructionsToText, jsonBlock, mapReasoningVisibility, mapStopReason, messageItem, metadataSourceList, normalizeRequest, opaqueBlock, opaqueItem, parseSSEEvents, reasoningItem, replayFromOutput, syntheticStream, textBlock, toolCallItem, toolResultItem, usageFromAnthropicMessages, usageFromChatCompletions, usageFromOllama, usageFromOpenAIResponses, validateRequest, withMockStreaming };
1132
+ //#region src/helpers/adapter-security.d.ts
1133
+ declare const MAX_OPAQUE_PAYLOAD_BYTES = 65536;
1134
+ declare const MAX_OPAQUE_JSON_DEPTH = 8;
1135
+ declare const PROVIDER_ERROR_MESSAGE_MAX_LEN = 500;
1136
+ declare const PROVIDER_ERROR_RAW_BODY_THRESHOLD = 200;
1137
+ type OpaqueEnvelopeResult = {
1138
+ ok: true;
1139
+ } | {
1140
+ ok: false;
1141
+ reason: string;
1142
+ };
1143
+ /** 测量 JSON 值嵌套深度(对象/数组);循环引用按已访问节点深度计。 */
1144
+ declare function measureJsonDepth(value: unknown, seen?: WeakSet<object>): number;
1145
+ /**
1146
+ * Opaque replay 通用 envelope:必须是 object、体积 ≤ 64KB、深度 ≤ 8。
1147
+ * 不校验 adapter 专用字段形状。
1148
+ */
1149
+ declare function validateOpaqueReplayEnvelope(payload: unknown): OpaqueEnvelopeResult;
1150
+ /** envelope 失败时抛 AIRequestError。 */
1151
+ declare function assertOpaqueReplayEnvelope(payload: unknown): void;
1152
+ /**
1153
+ * 从 provider HTTP 错误 body 提取可对外暴露的短消息,避免泄漏 HTML / 内部路径等。
1154
+ */
1155
+ declare function extractProviderErrorMessage(body: string, status: number): string;
1156
+ /** 统一构造脱敏后的 AIProviderError。 */
1157
+ declare function providerHttpError(status: number, body: string): AIProviderError;
1158
+ //#endregion
1159
+ //#region src/helpers/incremental-stream-parser.d.ts
1160
+ type StreamSplitResult = {
1161
+ items: string[];
1162
+ rest: string;
1163
+ };
1164
+ type StreamParseResult<T> = {
1165
+ status: "parsed";
1166
+ value: T;
1167
+ } | {
1168
+ status: "ignored";
1169
+ } | {
1170
+ status: "malformed";
1171
+ };
1172
+ declare class IncrementalStreamParser<T> {
1173
+ private readonly split;
1174
+ private readonly parse;
1175
+ private buffer;
1176
+ private readonly decoder;
1177
+ constructor(split: (buffer: string, allowEOF: boolean) => StreamSplitResult, parse: (item: string) => StreamParseResult<T>);
1178
+ feed(value: Uint8Array): {
1179
+ items: T[];
1180
+ malformed: number;
1181
+ };
1182
+ flush(): {
1183
+ items: T[];
1184
+ malformed: number;
1185
+ };
1186
+ getRemaining(): string;
1187
+ private consume;
1188
+ }
1189
+ declare function splitLines(buffer: string, allowEOF: boolean): StreamSplitResult;
1190
+ declare function splitSSEFrames(buffer: string, allowEOF: boolean): StreamSplitResult;
1191
+ //#endregion
1192
+ //#region src/helpers/request-mapper.d.ts
1193
+ type ProviderProfile = {
1194
+ readonly kind: string;
1195
+ readonly instructionsMode: "system_message" | "instructions_field" | "none";
1196
+ readonly supportedBlockTypes: ReadonlyArray<ContentBlock["type"]>;
1197
+ readonly reasoningBlockTypes: ReadonlyArray<ContentBlock["type"]>;
1198
+ readonly capabilities: AdapterCapabilities;
1199
+ };
1200
+ declare class NormalizedRequestMapper {
1201
+ readonly profile: ProviderProfile;
1202
+ constructor(profile: ProviderProfile);
1203
+ mapInstructions(instructions: string | InstructionBlock[]): string;
1204
+ ensureTextBlocks(blocks: ContentBlock[], field: string): ContentBlock[];
1205
+ ensureReasoningBlocks(blocks: ContentBlock[], field: string): Array<Extract<ContentBlock, {
1206
+ type: "text";
1207
+ }>>;
1208
+ assertToolResultOutcome(outcome: ToolResultItem["outcome"]): void;
1209
+ rollbackTrailingAssistantMessages<T extends {
1210
+ role: string;
1211
+ }>(messages: T[]): void;
1212
+ private ensureBlocks;
1213
+ }
1214
+ //#endregion
1215
+ export { type AIClient, AIError, AIMappingError, AIProviderError, type AIRequest, AIRequestError, type AIResponse, AIStreamError, type AIStreamEvent, AdapterAuxiliaryState, AdapterBase, type AdapterCapabilities, AuxiliaryCollector, type AuxiliaryFinalizeOptions, type AuxiliaryFinalizeResult, type AuxiliaryInfo, type BackendAdapter, type BackendTrace, type BillingInfo, type BillingPostprocessHook, type BillingSource, ChatCompletionsAdapter, type ChatCompletionsAdapterOptions, type ContentBlock, type CreateAIClientOptions, type EventFactory, type EventFactoryBackend, type EventFactoryState, type FetchFn, type IncludeSettings, IncrementalStreamParser, type InputItem, type InstructionBlock, type JsonContentBlock, type LookupResult, MAX_OPAQUE_JSON_DEPTH, MAX_OPAQUE_PAYLOAD_BYTES, type MessageCompletedEvent, type MessageDeltaEvent, type MessageItem, type MessageStartedEvent, MessagesAdapter, type MessagesAdapterOptions, MockAdapter, type MockAdapterOptions, type MockAuxiliaryStep, type MockCompleteStep, type MockErrorStep, type MockHandler, type MockHandlerContext, type MockHistoryRecord, type MockInputExpectation, type MockInterruptStep, type MockMessageStep, type MockOutputStep, type MockReasoningStep, type MockRequestExpectation, type MockStaticHandler, type MockStep, type MockTextStreamOptions, type MockThrowStep, type MockToolCallStep, type MockWarningStep, type NormalizeOptions, type NormalizedRequest, NormalizedRequestMapper, OllamaAdapter, type OllamaAdapterOptions, type OpaqueEnvelopeResult, type OpaqueItem, type OutputItem, PROVIDER_ERROR_MESSAGE_MAX_LEN, PROVIDER_ERROR_RAW_BODY_THRESHOLD, type ProviderProfile, type ReasoningCompletedEvent, type ReasoningDeltaEvent, type ReasoningItem, type ReasoningStartedEvent, type ReplayItem, type ResponseAuxiliaryEvent, type ResponseCompletedEvent, type ResponseStartedEvent, type ResponseWarningEvent, ResponsesAdapter, type ResponsesAdapterOptions, type SSEEvent, type StopReason, type StreamEventBase, type StreamParseResult, type StreamResult, type StreamSplitResult, type StreamingCapability, type SyntheticStreamOptions, type TextContentBlock, type ToolCallCompletedEvent, type ToolCallDeltaEvent, type ToolCallItem, type ToolCallStartedEvent, type ToolChoice, type ToolDefinition, type ToolResultItem, type Usage, type UsageSource, type ValidationIssue, WarningCode, aggregateEvents, assertMockRequest, assertOpaqueReplayEnvelope, assertValidRequest, blockToText, collectStream, contentBlocksToText, createAIClient, createEventFactory, emitMalformedStreamWarning, extractProviderErrorMessage, extractText, imageBlock, instructionsToText, jsonBlock, mapReasoningVisibility, mapStopReason, measureJsonDepth, messageItem, metadataSourceList, normalizeRequest, opaqueBlock, opaqueItem, parseSSEEvents, providerHttpError, reasoningItem, replayFromOutput, splitLines, splitSSEFrames, syntheticStream, textBlock, toolCallItem, toolResultItem, usageFromAnthropicMessages, usageFromChatCompletions, usageFromOllama, usageFromOpenAIResponses, validateOpaqueReplayEnvelope, validateRequest, withMockStreaming };
1094
1216
  //# sourceMappingURL=index.d.mts.map