@codehz/ai 0.2.0 → 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 +9 -3
- package/dist/index.d.mts +151 -27
- package/dist/index.mjs +1284 -702
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/adapters/chat-completions.ts +243 -196
- package/src/adapters/messages.ts +150 -124
- package/src/adapters/mock.ts +44 -11
- package/src/adapters/ollama.ts +219 -191
- package/src/adapters/responses.ts +222 -137
- package/src/core/aggregator.ts +218 -61
- package/src/core/errors.ts +7 -1
- package/src/core/event-factory.ts +24 -14
- package/src/core/merge-auxiliary.ts +22 -0
- package/src/core/normalize.ts +15 -1
- package/src/core/validation.ts +29 -21
- package/src/helpers/adapter-base.ts +23 -25
- package/src/helpers/adapter-security.ts +126 -0
- package/src/helpers/incremental-stream-parser.ts +84 -0
- package/src/helpers/index.ts +19 -0
- package/src/helpers/request-mapper.ts +72 -0
- package/src/helpers/sse-parser.ts +51 -25
- package/src/helpers/synthetic-stream.ts +13 -21
- package/src/helpers/usage-mapping.ts +4 -9
- package/src/types/adapter.ts +12 -1
- package/src/types/events.ts +14 -10
- package/src/types/index.ts +9 -1
- package/src/types/response.ts +0 -1
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.
|
|
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
|
-
|
|
174
|
+
`nativeStreaming` 已由 `capabilities` 直接替代。响应级 `backend.isSyntheticStream` 根据
|
|
175
|
+
`textStreaming === "synthetic"` 推导;具体响应内容仍应从本次事件流、warning 和 `replay` 判断。
|
|
170
176
|
|
|
171
177
|
## Mock 后端
|
|
172
178
|
|
package/dist/index.d.mts
CHANGED
|
@@ -165,7 +165,14 @@ type ResponseAuxiliaryEvent = StreamEventBase & {
|
|
|
165
165
|
};
|
|
166
166
|
type ResponseCompletedEvent = StreamEventBase & {
|
|
167
167
|
type: "response.completed";
|
|
168
|
-
|
|
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>;
|
|
169
176
|
};
|
|
170
177
|
type MessageStartedEvent = StreamEventBase & {
|
|
171
178
|
type: "message.started";
|
|
@@ -177,14 +184,11 @@ type MessageStartedEvent = StreamEventBase & {
|
|
|
177
184
|
type MessageDeltaEvent = StreamEventBase & {
|
|
178
185
|
type: "message.delta";
|
|
179
186
|
itemId: string;
|
|
180
|
-
delta:
|
|
181
|
-
type: "text";
|
|
182
|
-
text: string;
|
|
183
|
-
};
|
|
187
|
+
delta: ContentBlock;
|
|
184
188
|
};
|
|
185
189
|
type MessageCompletedEvent = StreamEventBase & {
|
|
186
190
|
type: "message.completed";
|
|
187
|
-
|
|
191
|
+
itemId: string;
|
|
188
192
|
};
|
|
189
193
|
type ReasoningStartedEvent = StreamEventBase & {
|
|
190
194
|
type: "reasoning.started";
|
|
@@ -200,7 +204,7 @@ type ReasoningDeltaEvent = StreamEventBase & {
|
|
|
200
204
|
};
|
|
201
205
|
type ReasoningCompletedEvent = StreamEventBase & {
|
|
202
206
|
type: "reasoning.completed";
|
|
203
|
-
|
|
207
|
+
itemId: string;
|
|
204
208
|
};
|
|
205
209
|
type ToolCallStartedEvent = StreamEventBase & {
|
|
206
210
|
type: "tool_call.started";
|
|
@@ -218,7 +222,7 @@ type ToolCallDeltaEvent = StreamEventBase & {
|
|
|
218
222
|
};
|
|
219
223
|
type ToolCallCompletedEvent = StreamEventBase & {
|
|
220
224
|
type: "tool_call.completed";
|
|
221
|
-
|
|
225
|
+
itemId: string;
|
|
222
226
|
};
|
|
223
227
|
type AIStreamEvent = ResponseStartedEvent | ResponseWarningEvent | ResponseAuxiliaryEvent | MessageStartedEvent | MessageDeltaEvent | MessageCompletedEvent | ReasoningStartedEvent | ReasoningDeltaEvent | ReasoningCompletedEvent | ToolCallStartedEvent | ToolCallDeltaEvent | ToolCallCompletedEvent | ResponseCompletedEvent;
|
|
224
228
|
//#endregion
|
|
@@ -229,9 +233,18 @@ type NormalizedRequest = AIRequest & {
|
|
|
229
233
|
model: string;
|
|
230
234
|
requestId: string;
|
|
231
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
|
+
};
|
|
232
245
|
interface BackendAdapter {
|
|
233
246
|
readonly kind: "chat-completions" | "messages" | "responses" | "ollama" | "mock";
|
|
234
|
-
readonly
|
|
247
|
+
readonly capabilities: AdapterCapabilities;
|
|
235
248
|
stream(request: NormalizedRequest): AsyncIterable<AIStreamEvent>;
|
|
236
249
|
}
|
|
237
250
|
type CreateAIClientOptions = {
|
|
@@ -294,7 +307,16 @@ declare class AIError extends Error {
|
|
|
294
307
|
}
|
|
295
308
|
/** 请求构造失败 — 参数校验不通过。在进入 adapter 前同步抛错。 */
|
|
296
309
|
declare class AIRequestError extends AIError {
|
|
297
|
-
|
|
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);
|
|
298
320
|
}
|
|
299
321
|
/** Provider 调用失败 — HTTP 非 2xx、网络错误。由 AdapterBase 捕获转为 warning。 */
|
|
300
322
|
declare class AIProviderError extends AIError {
|
|
@@ -323,7 +345,8 @@ declare const WarningCode: {
|
|
|
323
345
|
readonly LOOKUP_TIMEOUT: "LOOKUP_TIMEOUT"; /** 流提前中断 */
|
|
324
346
|
readonly STREAM_INCOMPLETE: "STREAM_INCOMPLETE"; /** 能力降级 */
|
|
325
347
|
readonly CAPABILITY_DOWNGRADE: "CAPABILITY_DOWNGRADE"; /** 模拟流式 */
|
|
326
|
-
readonly SYNTHETIC_STREAM: "SYNTHETIC_STREAM";
|
|
348
|
+
readonly SYNTHETIC_STREAM: "SYNTHETIC_STREAM"; /** 工具调用以批量方式到达(非 token 级流式) */
|
|
349
|
+
readonly TOOL_CALL_BATCHED: "TOOL_CALL_BATCHED";
|
|
327
350
|
};
|
|
328
351
|
//#endregion
|
|
329
352
|
//#region src/core/event-factory.d.ts
|
|
@@ -343,18 +366,27 @@ declare function createEventFactory(state: EventFactoryState): {
|
|
|
343
366
|
billing?: BillingInfo;
|
|
344
367
|
auxiliary?: Partial<AuxiliaryInfo>;
|
|
345
368
|
}): ResponseAuxiliaryEvent;
|
|
346
|
-
responseCompleted(
|
|
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;
|
|
347
379
|
messageStarted(id: string): MessageStartedEvent;
|
|
348
|
-
messageDelta(itemId: string,
|
|
349
|
-
messageCompleted(
|
|
380
|
+
messageDelta(itemId: string, delta: ContentBlock): MessageDeltaEvent;
|
|
381
|
+
messageCompleted(itemId: string): MessageCompletedEvent;
|
|
350
382
|
reasoningStarted(id: string, visibility: ReasoningItem["visibility"]): ReasoningStartedEvent;
|
|
351
383
|
reasoningDelta(itemId: string, delta: ContentBlock): ReasoningDeltaEvent;
|
|
352
|
-
reasoningCompleted(
|
|
384
|
+
reasoningCompleted(itemId: string): ReasoningCompletedEvent;
|
|
353
385
|
toolCallStarted(id: string, name: string): ToolCallStartedEvent;
|
|
354
386
|
toolCallDelta(itemId: string, delta: {
|
|
355
387
|
argumentsText?: string;
|
|
356
388
|
}): ToolCallDeltaEvent;
|
|
357
|
-
toolCallCompleted(
|
|
389
|
+
toolCallCompleted(itemId: string): ToolCallCompletedEvent; /** 返回当前已发出的 sequence 计数(用于断言) */
|
|
358
390
|
readonly sequence: number; /** 返回当前已记录的 warning 副本。 */
|
|
359
391
|
readonly warnings: string[];
|
|
360
392
|
};
|
|
@@ -365,7 +397,7 @@ type EventFactory = ReturnType<typeof createEventFactory>;
|
|
|
365
397
|
* 将事件数组聚合为 AIResponse。
|
|
366
398
|
* 适用于测试和离线处理场景。
|
|
367
399
|
*/
|
|
368
|
-
declare function aggregateEvents(events: AIStreamEvent[]): AIResponse;
|
|
400
|
+
declare function aggregateEvents(events: readonly AIStreamEvent[]): AIResponse;
|
|
369
401
|
//#endregion
|
|
370
402
|
//#region src/core/collect-stream.d.ts
|
|
371
403
|
declare function collectStream(stream: AsyncIterable<AIStreamEvent>): Promise<AIResponse>;
|
|
@@ -491,7 +523,7 @@ type StreamResult = {
|
|
|
491
523
|
};
|
|
492
524
|
declare abstract class AdapterBase implements BackendAdapter {
|
|
493
525
|
abstract readonly kind: "chat-completions" | "messages" | "responses" | "ollama" | "mock";
|
|
494
|
-
abstract readonly
|
|
526
|
+
abstract readonly capabilities: AdapterCapabilities;
|
|
495
527
|
/**
|
|
496
528
|
* stream 模板方法:
|
|
497
529
|
* 1. 创建事件工厂,发射 response.started
|
|
@@ -584,7 +616,7 @@ type ResponsesTool = {
|
|
|
584
616
|
};
|
|
585
617
|
declare class ResponsesAdapter extends AdapterBase {
|
|
586
618
|
readonly kind: "responses";
|
|
587
|
-
readonly
|
|
619
|
+
readonly capabilities: AdapterCapabilities;
|
|
588
620
|
private apiKey;
|
|
589
621
|
private baseUrl;
|
|
590
622
|
private fetchFn;
|
|
@@ -652,14 +684,12 @@ type MessagesAPITool = {
|
|
|
652
684
|
};
|
|
653
685
|
declare class MessagesAdapter extends AdapterBase {
|
|
654
686
|
readonly kind: "messages";
|
|
655
|
-
readonly
|
|
687
|
+
readonly capabilities: AdapterCapabilities;
|
|
656
688
|
private apiKey;
|
|
657
689
|
private apiVersion;
|
|
658
690
|
private baseUrl;
|
|
659
691
|
private fetchFn;
|
|
660
|
-
private warningAccumulator;
|
|
661
692
|
constructor(options: MessagesAdapterOptions);
|
|
662
|
-
protected warn(message: string, _code?: string): void;
|
|
663
693
|
protected buildRequest(request: NormalizedRequest): MessagesAPIRequest;
|
|
664
694
|
protected runStream(providerRequest: MessagesAPIRequest, factory: EventFactory, request: NormalizedRequest): AsyncIterable<AIStreamEvent>;
|
|
665
695
|
}
|
|
@@ -684,6 +714,7 @@ type ChatRequest = {
|
|
|
684
714
|
temperature?: number;
|
|
685
715
|
max_tokens?: number;
|
|
686
716
|
stream: true;
|
|
717
|
+
n: 1;
|
|
687
718
|
};
|
|
688
719
|
type ChatMessage = {
|
|
689
720
|
role: "system" | "user" | "assistant" | "tool";
|
|
@@ -711,7 +742,7 @@ type ChatTool = {
|
|
|
711
742
|
};
|
|
712
743
|
declare class ChatCompletionsAdapter extends AdapterBase {
|
|
713
744
|
readonly kind: "chat-completions";
|
|
714
|
-
readonly
|
|
745
|
+
readonly capabilities: AdapterCapabilities;
|
|
715
746
|
private apiKey;
|
|
716
747
|
private baseUrl;
|
|
717
748
|
private fetchFn;
|
|
@@ -759,7 +790,7 @@ type OllamaTool = {
|
|
|
759
790
|
};
|
|
760
791
|
declare class OllamaAdapter extends AdapterBase {
|
|
761
792
|
readonly kind: "ollama";
|
|
762
|
-
readonly
|
|
793
|
+
readonly capabilities: AdapterCapabilities;
|
|
763
794
|
private baseUrl;
|
|
764
795
|
private apiKey;
|
|
765
796
|
private fetchFn;
|
|
@@ -908,7 +939,14 @@ type MockProviderRequest = {
|
|
|
908
939
|
declare function assertMockRequest(request: NormalizedRequest, expectation: MockRequestExpectation, context: MockHandlerContext): void;
|
|
909
940
|
declare class MockAdapter extends AdapterBase {
|
|
910
941
|
readonly kind: "mock";
|
|
911
|
-
readonly
|
|
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
|
+
};
|
|
912
950
|
private readonly handler;
|
|
913
951
|
private readonly providerMetadata?;
|
|
914
952
|
private cursor;
|
|
@@ -998,6 +1036,9 @@ type SSEParseResult = {
|
|
|
998
1036
|
rest: string;
|
|
999
1037
|
malformedEvents: number;
|
|
1000
1038
|
};
|
|
1039
|
+
type ParseSSEOptions = {
|
|
1040
|
+
allowEOF?: boolean;
|
|
1041
|
+
};
|
|
1001
1042
|
/**
|
|
1002
1043
|
* 将 SSE 文本块解析为事件数组。
|
|
1003
1044
|
* 累积事件行直到遇到空行,支持 [DONE] 标记。
|
|
@@ -1008,7 +1049,7 @@ type SSEParseResult = {
|
|
|
1008
1049
|
* - 未完成的行保留在 rest 中,等待下次 chunk 补全
|
|
1009
1050
|
* - 支持跨 chunk 的 event 分片
|
|
1010
1051
|
*/
|
|
1011
|
-
declare function parseSSEEvents(chunk: string): SSEParseResult;
|
|
1052
|
+
declare function parseSSEEvents(chunk: string, options?: ParseSSEOptions): SSEParseResult;
|
|
1012
1053
|
//#endregion
|
|
1013
1054
|
//#region src/helpers/synthetic-stream.d.ts
|
|
1014
1055
|
type SyntheticStreamOptions = {
|
|
@@ -1088,5 +1129,88 @@ declare function usageFromOllama(raw: {
|
|
|
1088
1129
|
eval_count?: number;
|
|
1089
1130
|
}): Partial<Usage>;
|
|
1090
1131
|
//#endregion
|
|
1091
|
-
|
|
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 };
|
|
1092
1216
|
//# sourceMappingURL=index.d.mts.map
|