@opencode/ai 0.0.0-dev-21920 → 0.0.0-dev-44
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 +61 -19
- package/dist/ai-client.d.ts +2 -2
- package/dist/cache-policy.d.ts +4 -0
- package/dist/cache-policy.js +20 -6
- package/dist/decision-client.d.ts +3 -3
- package/dist/decision.d.ts +4 -1
- package/dist/decision.js +3 -0
- package/dist/effect.d.ts +4 -5
- package/dist/effect.js +2 -3
- package/dist/experimental/realtime.d.ts +3 -2
- package/dist/image-client.d.ts +1 -1
- package/dist/image.js +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/llm.d.ts +3 -0
- package/dist/media-client.d.ts +2 -1
- package/dist/media-model.d.ts +3 -0
- package/dist/media-model.js +4 -1
- package/dist/protocols/alibaba-chat.d.ts +4 -0
- package/dist/protocols/alibaba-messages.d.ts +19 -19
- package/dist/protocols/alibaba-responses.d.ts +3 -3
- package/dist/protocols/anthropic-messages.d.ts +59 -59
- package/dist/protocols/anthropic-messages.js +3 -5
- package/dist/protocols/bedrock-converse.d.ts +110 -15
- package/dist/protocols/bedrock-converse.js +112 -15
- package/dist/protocols/bedrock-event-stream.js +1 -0
- package/dist/protocols/meta-messages.d.ts +19 -19
- package/dist/protocols/meta-messages.js +2 -1
- package/dist/protocols/open-responses.d.ts +3 -0
- package/dist/protocols/openai-chat.d.ts +588 -1
- package/dist/protocols/openai-chat.js +7 -2
- package/dist/protocols/openai-compatible-chat.d.ts +6 -2
- package/dist/protocols/openai-compatible-responses.d.ts +3 -3
- package/dist/protocols/openai-responses.d.ts +24 -0
- package/dist/protocols/openai-responses.js +5 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +2 -2
- package/dist/protocols/utils/bedrock-cache.js +7 -6
- package/dist/protocols/utils/cache.d.ts +14 -3
- package/dist/protocols/utils/cache.js +11 -4
- package/dist/protocols/utils/gemini-json-schema.d.ts +5 -0
- package/dist/protocols/utils/gemini-json-schema.js +3 -3
- package/dist/protocols/utils/tool-schema.js +15 -5
- package/dist/protocols/utils/tool-stream.d.ts +9 -0
- package/dist/protocols/venice-chat.d.ts +3 -0
- package/dist/protocols/venice-chat.js +1 -1
- package/dist/protocols/zai-chat.d.ts +4 -0
- package/dist/protocols/zai-messages.d.ts +19 -19
- package/dist/providers/alibaba/images.d.ts +2 -0
- package/dist/providers/alibaba/images.js +1 -0
- package/dist/providers/alibaba.d.ts +26 -21
- package/dist/providers/alibaba.js +12 -8
- package/dist/providers/amazon-bedrock-mantle.d.ts +23 -19
- package/dist/providers/amazon-bedrock.d.ts +34 -14
- package/dist/providers/amazon-bedrock.js +11 -11
- package/dist/providers/anthropic-compatible.d.ts +19 -19
- package/dist/providers/anthropic.d.ts +19 -19
- package/dist/providers/azure/images.d.ts +2 -0
- package/dist/providers/azure/images.js +1 -0
- package/dist/providers/azure.d.ts +15 -1
- package/dist/providers/azure.js +19 -1
- package/dist/providers/baseten/decisions.d.ts +2 -0
- package/dist/providers/baseten/decisions.js +1 -0
- package/dist/providers/baseten.d.ts +13 -4
- package/dist/providers/baseten.js +15 -8
- package/dist/providers/cerebras.d.ts +8 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-ai-gateway/decisions.js +1 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +57 -40
- package/dist/providers/cloudflare-ai-gateway.js +11 -6
- package/dist/providers/cloudflare-workers-ai/decisions.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/decisions.js +1 -0
- package/dist/providers/cloudflare-workers-ai/images.d.ts +2 -0
- package/dist/providers/cloudflare-workers-ai/images.js +1 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +13 -3
- package/dist/providers/cloudflare-workers-ai.js +16 -7
- package/dist/providers/cohere.d.ts +8 -0
- package/dist/providers/deepinfra.d.ts +8 -0
- package/dist/providers/deepseek.d.ts +8 -0
- package/dist/providers/digitalocean/decisions.d.ts +2 -0
- package/dist/providers/digitalocean/decisions.js +1 -0
- package/dist/providers/digitalocean/images.d.ts +2 -0
- package/dist/providers/digitalocean/images.js +1 -0
- package/dist/providers/digitalocean.d.ts +21 -4
- package/dist/providers/digitalocean.js +25 -8
- package/dist/providers/fireworks.d.ts +8 -0
- package/dist/providers/google/images.d.ts +2 -0
- package/dist/providers/google/images.js +1 -0
- package/dist/providers/google-vertex/images.d.ts +2 -0
- package/dist/providers/google-vertex/images.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +4 -0
- package/dist/providers/google-vertex-messages.d.ts +19 -19
- package/dist/providers/google-vertex.d.ts +3 -1
- package/dist/providers/google-vertex.js +30 -13
- package/dist/providers/google.d.ts +5 -4
- package/dist/providers/google.js +15 -8
- package/dist/providers/groq.d.ts +8 -0
- package/dist/providers/meta.d.ts +23 -19
- package/dist/providers/minimax.d.ts +23 -19
- package/dist/providers/moonshot.d.ts +23 -19
- package/dist/providers/openai/images.d.ts +2 -0
- package/dist/providers/openai/images.js +1 -0
- package/dist/providers/openai-compatible/images.d.ts +2 -0
- package/dist/providers/openai-compatible/images.js +1 -0
- package/dist/providers/openai-compatible.d.ts +7 -1
- package/dist/providers/openai-compatible.js +21 -9
- package/dist/providers/openai.d.ts +18 -8
- package/dist/providers/openai.js +10 -2
- package/dist/providers/opencode/decisions.d.ts +2 -0
- package/dist/providers/opencode/decisions.js +1 -0
- package/dist/providers/opencode.d.ts +9 -4
- package/dist/providers/opencode.js +2 -1
- package/dist/providers/openrouter/decisions.d.ts +2 -0
- package/dist/providers/openrouter/decisions.js +1 -0
- package/dist/providers/openrouter/images.d.ts +2 -0
- package/dist/providers/openrouter/images.js +1 -0
- package/dist/providers/openrouter.d.ts +25 -4
- package/dist/providers/openrouter.js +31 -9
- package/dist/providers/togetherai.d.ts +8 -0
- package/dist/providers/typesafe-ai/decisions.d.ts +2 -0
- package/dist/providers/typesafe-ai/decisions.js +1 -0
- package/dist/providers/typesafe-ai.d.ts +9 -4
- package/dist/providers/typesafe-ai.js +2 -1
- package/dist/providers/venice.d.ts +3 -0
- package/dist/providers/vercel-ai-gateway/decisions.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/decisions.js +1 -0
- package/dist/providers/vercel-ai-gateway/images.d.ts +2 -0
- package/dist/providers/vercel-ai-gateway/images.js +1 -0
- package/dist/providers/vercel-ai-gateway.d.ts +9 -7
- package/dist/providers/vercel-ai-gateway.js +18 -10
- package/dist/providers/xai/images.d.ts +2 -0
- package/dist/providers/xai/images.js +1 -0
- package/dist/providers/xai.d.ts +9 -4
- package/dist/providers/xai.js +15 -8
- package/dist/providers/zai/images.d.ts +2 -0
- package/dist/providers/zai/images.js +1 -0
- package/dist/providers/zai-coding-plan.d.ts +23 -19
- package/dist/providers/zai.d.ts +9 -4
- package/dist/providers/zai.js +15 -8
- package/dist/route/client.d.ts +2 -2
- package/dist/route/client.js +15 -4
- package/dist/route/decision.d.ts +2 -1
- package/dist/route/decision.js +1 -0
- package/dist/route/executor.d.ts +1 -1
- package/dist/route/framing.d.ts +2 -0
- package/dist/route/index.d.ts +3 -0
- package/dist/route/index.js +3 -0
- package/dist/route/media.d.ts +5 -1
- package/dist/route/media.js +6 -2
- package/dist/route/transport/http.js +1 -0
- package/dist/route/transport/index.d.ts +1 -0
- package/dist/schema/events.d.ts +135 -6
- package/dist/schema/events.js +10 -0
- package/dist/schema/messages.d.ts +6 -2
- package/dist/schema/messages.js +3 -0
- package/dist/schema/options.d.ts +5 -3
- package/dist/schema/options.js +8 -3
- package/dist/speech-client.d.ts +1 -1
- package/dist/speech.js +2 -1
- package/dist/testing.d.ts +25 -24
- package/dist/testing.js +3 -21
- package/dist/transcription-client.d.ts +1 -1
- package/dist/transcription.js +1 -0
- package/dist/video-client.d.ts +1 -1
- package/dist/video.js +1 -0
- package/package.json +510 -8
- package/dist/provider.d.ts +0 -23
- package/dist/provider.js +0 -2
package/dist/schema/events.d.ts
CHANGED
|
@@ -410,6 +410,12 @@ export declare const ProviderErrorEvent: Schema.Struct<{
|
|
|
410
410
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
411
411
|
}>;
|
|
412
412
|
export type ProviderErrorEvent = Schema.Schema.Type<typeof ProviderErrorEvent>;
|
|
413
|
+
/** One provider frame as received, emitted before the events parsed from it when the request sets `includeRaw`. */
|
|
414
|
+
export declare const RawEvent: Schema.Struct<{
|
|
415
|
+
readonly type: Schema.tag<"raw">;
|
|
416
|
+
readonly data: Schema.Unknown;
|
|
417
|
+
}>;
|
|
418
|
+
export type RawEvent = Schema.Schema.Type<typeof RawEvent>;
|
|
413
419
|
declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.refine<{
|
|
414
420
|
readonly type: "compaction";
|
|
415
421
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -643,6 +649,9 @@ declare const llmEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.refi
|
|
|
643
649
|
readonly message: Schema.String;
|
|
644
650
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
645
651
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
652
|
+
}>, Schema.Struct<{
|
|
653
|
+
readonly type: Schema.tag<"raw">;
|
|
654
|
+
readonly data: Schema.Unknown;
|
|
646
655
|
}>]>;
|
|
647
656
|
type WithID<Event extends {
|
|
648
657
|
readonly id: unknown;
|
|
@@ -892,8 +901,11 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
892
901
|
readonly message: Schema.String;
|
|
893
902
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
894
903
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
904
|
+
}>, Schema.Struct<{
|
|
905
|
+
readonly type: Schema.tag<"raw">;
|
|
906
|
+
readonly data: Schema.Unknown;
|
|
895
907
|
}>]> & {
|
|
896
|
-
readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "tool-error", "media", "step-finish", "finish", "provider-error"];
|
|
908
|
+
readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "tool-error", "media", "step-finish", "finish", "provider-error", "raw"];
|
|
897
909
|
readonly cases: {
|
|
898
910
|
compaction: Schema.refine<{
|
|
899
911
|
readonly type: "compaction";
|
|
@@ -976,6 +988,10 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
976
988
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
977
989
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
978
990
|
}>;
|
|
991
|
+
raw: Schema.Struct<{
|
|
992
|
+
readonly type: Schema.tag<"raw">;
|
|
993
|
+
readonly data: Schema.Unknown;
|
|
994
|
+
}>;
|
|
979
995
|
"reasoning-delta": Schema.Struct<{
|
|
980
996
|
readonly type: Schema.tag<"reasoning-delta">;
|
|
981
997
|
readonly id: Schema.String;
|
|
@@ -1151,6 +1167,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
1151
1167
|
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
1152
1168
|
readonly type: "step-start";
|
|
1153
1169
|
readonly index: number;
|
|
1170
|
+
} | {
|
|
1171
|
+
readonly type: "raw";
|
|
1172
|
+
readonly data: unknown;
|
|
1154
1173
|
} | {
|
|
1155
1174
|
readonly type: "text-start";
|
|
1156
1175
|
readonly id: string;
|
|
@@ -1368,6 +1387,11 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
1368
1387
|
readonly index: number;
|
|
1369
1388
|
}, {
|
|
1370
1389
|
readonly type: Keys;
|
|
1390
|
+
}> | Extract<{
|
|
1391
|
+
readonly type: "raw";
|
|
1392
|
+
readonly data: unknown;
|
|
1393
|
+
}, {
|
|
1394
|
+
readonly type: Keys;
|
|
1371
1395
|
}> | Extract<{
|
|
1372
1396
|
readonly type: "text-start";
|
|
1373
1397
|
readonly id: string;
|
|
@@ -1673,6 +1697,10 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
1673
1697
|
};
|
|
1674
1698
|
} | undefined;
|
|
1675
1699
|
};
|
|
1700
|
+
raw: (u: unknown) => u is {
|
|
1701
|
+
readonly type: "raw";
|
|
1702
|
+
readonly data: unknown;
|
|
1703
|
+
};
|
|
1676
1704
|
"reasoning-delta": (u: unknown) => u is {
|
|
1677
1705
|
readonly type: "reasoning-delta";
|
|
1678
1706
|
readonly id: string;
|
|
@@ -2069,6 +2097,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
2069
2097
|
readonly message: Schema.String;
|
|
2070
2098
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
2071
2099
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2100
|
+
}> | Schema.Struct<{
|
|
2101
|
+
readonly type: Schema.tag<"raw">;
|
|
2102
|
+
readonly data: Schema.Unknown;
|
|
2072
2103
|
}> | (Schema.refine<{
|
|
2073
2104
|
readonly type: "compaction";
|
|
2074
2105
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -2098,6 +2129,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
2098
2129
|
}) as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
|
|
2099
2130
|
readonly type: "step-start";
|
|
2100
2131
|
readonly index: number;
|
|
2132
|
+
} | {
|
|
2133
|
+
readonly type: "raw";
|
|
2134
|
+
readonly data: unknown;
|
|
2101
2135
|
} | {
|
|
2102
2136
|
readonly type: "text-start";
|
|
2103
2137
|
readonly id: string;
|
|
@@ -2518,6 +2552,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
2518
2552
|
readonly message: Schema.String;
|
|
2519
2553
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
2520
2554
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
2555
|
+
}> | Schema.Struct<{
|
|
2556
|
+
readonly type: Schema.tag<"raw">;
|
|
2557
|
+
readonly data: Schema.Unknown;
|
|
2521
2558
|
}> | (Schema.refine<{
|
|
2522
2559
|
readonly type: "compaction";
|
|
2523
2560
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -2547,6 +2584,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
2547
2584
|
}) as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
|
|
2548
2585
|
readonly type: "step-start";
|
|
2549
2586
|
readonly index: number;
|
|
2587
|
+
} | {
|
|
2588
|
+
readonly type: "raw";
|
|
2589
|
+
readonly data: unknown;
|
|
2550
2590
|
} | {
|
|
2551
2591
|
readonly type: "text-start";
|
|
2552
2592
|
readonly id: string;
|
|
@@ -2969,6 +3009,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
2969
3009
|
readonly message: Schema.String;
|
|
2970
3010
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
2971
3011
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
3012
|
+
}> | Schema.Struct<{
|
|
3013
|
+
readonly type: Schema.tag<"raw">;
|
|
3014
|
+
readonly data: Schema.Unknown;
|
|
2972
3015
|
}> | (Schema.refine<{
|
|
2973
3016
|
readonly type: "compaction";
|
|
2974
3017
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -2995,9 +3038,12 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
2995
3038
|
readonly text: string | null;
|
|
2996
3039
|
readonly encrypted?: never;
|
|
2997
3040
|
})) => CompactionPart;
|
|
2998
|
-
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
3041
|
+
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
2999
3042
|
readonly type: "step-start";
|
|
3000
3043
|
readonly index: number;
|
|
3044
|
+
} | {
|
|
3045
|
+
readonly type: "raw";
|
|
3046
|
+
readonly data: unknown;
|
|
3001
3047
|
} | {
|
|
3002
3048
|
readonly type: "text-start";
|
|
3003
3049
|
readonly id: string;
|
|
@@ -3213,6 +3259,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
3213
3259
|
})), { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
|
|
3214
3260
|
readonly type: "step-start";
|
|
3215
3261
|
readonly index: number;
|
|
3262
|
+
} | {
|
|
3263
|
+
readonly type: "raw";
|
|
3264
|
+
readonly data: unknown;
|
|
3216
3265
|
} | {
|
|
3217
3266
|
readonly type: "text-start";
|
|
3218
3267
|
readonly id: string;
|
|
@@ -3633,6 +3682,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
3633
3682
|
readonly message: Schema.String;
|
|
3634
3683
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
3635
3684
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
3685
|
+
}> | Schema.Struct<{
|
|
3686
|
+
readonly type: Schema.tag<"raw">;
|
|
3687
|
+
readonly data: Schema.Unknown;
|
|
3636
3688
|
}> | (Schema.refine<{
|
|
3637
3689
|
readonly type: "compaction";
|
|
3638
3690
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -3659,9 +3711,12 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
3659
3711
|
readonly text: string | null;
|
|
3660
3712
|
readonly encrypted?: never;
|
|
3661
3713
|
})) => CompactionPart;
|
|
3662
|
-
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
3714
|
+
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
3663
3715
|
readonly type: "step-start";
|
|
3664
3716
|
readonly index: number;
|
|
3717
|
+
} | {
|
|
3718
|
+
readonly type: "raw";
|
|
3719
|
+
readonly data: unknown;
|
|
3665
3720
|
} | {
|
|
3666
3721
|
readonly type: "text-start";
|
|
3667
3722
|
readonly id: string;
|
|
@@ -3877,6 +3932,9 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
3877
3932
|
})), { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
3878
3933
|
readonly type: "step-start";
|
|
3879
3934
|
readonly index: number;
|
|
3935
|
+
} | {
|
|
3936
|
+
readonly type: "raw";
|
|
3937
|
+
readonly data: unknown;
|
|
3880
3938
|
} | {
|
|
3881
3939
|
readonly type: "text-start";
|
|
3882
3940
|
readonly id: string;
|
|
@@ -4358,6 +4416,13 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
4358
4416
|
};
|
|
4359
4417
|
} | undefined;
|
|
4360
4418
|
};
|
|
4419
|
+
raw: (input: {
|
|
4420
|
+
readonly type?: "raw" | undefined;
|
|
4421
|
+
readonly data: unknown;
|
|
4422
|
+
}, options?: Schema.MakeOptions) => {
|
|
4423
|
+
readonly type: "raw";
|
|
4424
|
+
readonly data: unknown;
|
|
4425
|
+
};
|
|
4361
4426
|
is: {
|
|
4362
4427
|
compaction: (u: unknown) => u is {
|
|
4363
4428
|
readonly type: "compaction";
|
|
@@ -4593,6 +4658,10 @@ export declare const LLMEvent: Schema.Union<readonly [Schema.refine<{
|
|
|
4593
4658
|
};
|
|
4594
4659
|
} | undefined;
|
|
4595
4660
|
};
|
|
4661
|
+
raw: (u: unknown) => u is {
|
|
4662
|
+
readonly type: "raw";
|
|
4663
|
+
readonly data: unknown;
|
|
4664
|
+
};
|
|
4596
4665
|
};
|
|
4597
4666
|
};
|
|
4598
4667
|
export type LLMEvent = Schema.Schema.Type<typeof llmEventTagged>;
|
|
@@ -4853,8 +4922,11 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
4853
4922
|
readonly message: Schema.String;
|
|
4854
4923
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
4855
4924
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
4925
|
+
}>, Schema.Struct<{
|
|
4926
|
+
readonly type: Schema.tag<"raw">;
|
|
4927
|
+
readonly data: Schema.Unknown;
|
|
4856
4928
|
}>]> & {
|
|
4857
|
-
readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "tool-error", "media", "step-finish", "finish", "provider-error"];
|
|
4929
|
+
readonly discriminants: readonly ["compaction", "step-start", "text-start", "text-delta", "text-end", "reasoning-start", "reasoning-delta", "reasoning-end", "tool-input-start", "tool-input-delta", "tool-input-end", "tool-input-error", "tool-call", "tool-result", "tool-error", "media", "step-finish", "finish", "provider-error", "raw"];
|
|
4858
4930
|
readonly cases: {
|
|
4859
4931
|
compaction: Schema.refine<{
|
|
4860
4932
|
readonly type: "compaction";
|
|
@@ -4937,6 +5009,10 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
4937
5009
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
4938
5010
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
4939
5011
|
}>;
|
|
5012
|
+
raw: Schema.Struct<{
|
|
5013
|
+
readonly type: Schema.tag<"raw">;
|
|
5014
|
+
readonly data: Schema.Unknown;
|
|
5015
|
+
}>;
|
|
4940
5016
|
"reasoning-delta": Schema.Struct<{
|
|
4941
5017
|
readonly type: Schema.tag<"reasoning-delta">;
|
|
4942
5018
|
readonly id: Schema.String;
|
|
@@ -5112,6 +5188,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
5112
5188
|
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
5113
5189
|
readonly type: "step-start";
|
|
5114
5190
|
readonly index: number;
|
|
5191
|
+
} | {
|
|
5192
|
+
readonly type: "raw";
|
|
5193
|
+
readonly data: unknown;
|
|
5115
5194
|
} | {
|
|
5116
5195
|
readonly type: "text-start";
|
|
5117
5196
|
readonly id: string;
|
|
@@ -5329,6 +5408,11 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
5329
5408
|
readonly index: number;
|
|
5330
5409
|
}, {
|
|
5331
5410
|
readonly type: Keys;
|
|
5411
|
+
}> | Extract<{
|
|
5412
|
+
readonly type: "raw";
|
|
5413
|
+
readonly data: unknown;
|
|
5414
|
+
}, {
|
|
5415
|
+
readonly type: Keys;
|
|
5332
5416
|
}> | Extract<{
|
|
5333
5417
|
readonly type: "text-start";
|
|
5334
5418
|
readonly id: string;
|
|
@@ -5634,6 +5718,10 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
5634
5718
|
};
|
|
5635
5719
|
} | undefined;
|
|
5636
5720
|
};
|
|
5721
|
+
raw: (u: unknown) => u is {
|
|
5722
|
+
readonly type: "raw";
|
|
5723
|
+
readonly data: unknown;
|
|
5724
|
+
};
|
|
5637
5725
|
"reasoning-delta": (u: unknown) => u is {
|
|
5638
5726
|
readonly type: "reasoning-delta";
|
|
5639
5727
|
readonly id: string;
|
|
@@ -6030,6 +6118,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
6030
6118
|
readonly message: Schema.String;
|
|
6031
6119
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
6032
6120
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
6121
|
+
}> | Schema.Struct<{
|
|
6122
|
+
readonly type: Schema.tag<"raw">;
|
|
6123
|
+
readonly data: Schema.Unknown;
|
|
6033
6124
|
}> | (Schema.refine<{
|
|
6034
6125
|
readonly type: "compaction";
|
|
6035
6126
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -6059,6 +6150,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
6059
6150
|
}) as M["Type"]["type"]]: (value: M["Type"]) => any; }>(value: {
|
|
6060
6151
|
readonly type: "step-start";
|
|
6061
6152
|
readonly index: number;
|
|
6153
|
+
} | {
|
|
6154
|
+
readonly type: "raw";
|
|
6155
|
+
readonly data: unknown;
|
|
6062
6156
|
} | {
|
|
6063
6157
|
readonly type: "text-start";
|
|
6064
6158
|
readonly id: string;
|
|
@@ -6479,6 +6573,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
6479
6573
|
readonly message: Schema.String;
|
|
6480
6574
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
6481
6575
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
6576
|
+
}> | Schema.Struct<{
|
|
6577
|
+
readonly type: Schema.tag<"raw">;
|
|
6578
|
+
readonly data: Schema.Unknown;
|
|
6482
6579
|
}> | (Schema.refine<{
|
|
6483
6580
|
readonly type: "compaction";
|
|
6484
6581
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -6508,6 +6605,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
6508
6605
|
}) as M["Type"]["type"]]: (value: M["Type"]) => any; }>(cases: Cases): (value: {
|
|
6509
6606
|
readonly type: "step-start";
|
|
6510
6607
|
readonly index: number;
|
|
6608
|
+
} | {
|
|
6609
|
+
readonly type: "raw";
|
|
6610
|
+
readonly data: unknown;
|
|
6511
6611
|
} | {
|
|
6512
6612
|
readonly type: "text-start";
|
|
6513
6613
|
readonly id: string;
|
|
@@ -6930,6 +7030,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
6930
7030
|
readonly message: Schema.String;
|
|
6931
7031
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
6932
7032
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
7033
|
+
}> | Schema.Struct<{
|
|
7034
|
+
readonly type: Schema.tag<"raw">;
|
|
7035
|
+
readonly data: Schema.Unknown;
|
|
6933
7036
|
}> | (Schema.refine<{
|
|
6934
7037
|
readonly type: "compaction";
|
|
6935
7038
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -6956,9 +7059,12 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
6956
7059
|
readonly text: string | null;
|
|
6957
7060
|
readonly encrypted?: never;
|
|
6958
7061
|
})) => CompactionPart;
|
|
6959
|
-
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
7062
|
+
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
6960
7063
|
readonly type: "step-start";
|
|
6961
7064
|
readonly index: number;
|
|
7065
|
+
} | {
|
|
7066
|
+
readonly type: "raw";
|
|
7067
|
+
readonly data: unknown;
|
|
6962
7068
|
} | {
|
|
6963
7069
|
readonly type: "text-start";
|
|
6964
7070
|
readonly id: string;
|
|
@@ -7174,6 +7280,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
7174
7280
|
})), { readonly [K in "type"]: keyof Cases; }>) => any>(value: {
|
|
7175
7281
|
readonly type: "step-start";
|
|
7176
7282
|
readonly index: number;
|
|
7283
|
+
} | {
|
|
7284
|
+
readonly type: "raw";
|
|
7285
|
+
readonly data: unknown;
|
|
7177
7286
|
} | {
|
|
7178
7287
|
readonly type: "text-start";
|
|
7179
7288
|
readonly id: string;
|
|
@@ -7594,6 +7703,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
7594
7703
|
readonly message: Schema.String;
|
|
7595
7704
|
readonly classification: Schema.optional<Schema.Literals<readonly ["context-overflow", "payload-too-large"]>>;
|
|
7596
7705
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
7706
|
+
}> | Schema.Struct<{
|
|
7707
|
+
readonly type: Schema.tag<"raw">;
|
|
7708
|
+
readonly data: Schema.Unknown;
|
|
7597
7709
|
}> | (Schema.refine<{
|
|
7598
7710
|
readonly type: "compaction";
|
|
7599
7711
|
readonly provider: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
@@ -7620,9 +7732,12 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
7620
7732
|
readonly text: string | null;
|
|
7621
7733
|
readonly encrypted?: never;
|
|
7622
7734
|
})) => CompactionPart;
|
|
7623
|
-
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
7735
|
+
}) as M["Type"]["type"]]+?: (value: M["Type"]) => any; } & { [K in Exclude<keyof Cases, "compaction" | "finish" | "media" | "provider-error" | "raw" | "reasoning-delta" | "reasoning-end" | "reasoning-start" | "step-finish" | "step-start" | "text-delta" | "text-end" | "text-start" | "tool-call" | "tool-error" | "tool-input-delta" | "tool-input-end" | "tool-input-error" | "tool-input-start" | "tool-result">]: never; }, OrElse extends (value: Exclude<{
|
|
7624
7736
|
readonly type: "step-start";
|
|
7625
7737
|
readonly index: number;
|
|
7738
|
+
} | {
|
|
7739
|
+
readonly type: "raw";
|
|
7740
|
+
readonly data: unknown;
|
|
7626
7741
|
} | {
|
|
7627
7742
|
readonly type: "text-start";
|
|
7628
7743
|
readonly id: string;
|
|
@@ -7838,6 +7953,9 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
7838
7953
|
})), { readonly [K in "type"]: keyof Cases; }>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
7839
7954
|
readonly type: "step-start";
|
|
7840
7955
|
readonly index: number;
|
|
7956
|
+
} | {
|
|
7957
|
+
readonly type: "raw";
|
|
7958
|
+
readonly data: unknown;
|
|
7841
7959
|
} | {
|
|
7842
7960
|
readonly type: "text-start";
|
|
7843
7961
|
readonly id: string;
|
|
@@ -8319,6 +8437,13 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
8319
8437
|
};
|
|
8320
8438
|
} | undefined;
|
|
8321
8439
|
};
|
|
8440
|
+
raw: (input: {
|
|
8441
|
+
readonly type?: "raw" | undefined;
|
|
8442
|
+
readonly data: unknown;
|
|
8443
|
+
}, options?: Schema.MakeOptions) => {
|
|
8444
|
+
readonly type: "raw";
|
|
8445
|
+
readonly data: unknown;
|
|
8446
|
+
};
|
|
8322
8447
|
is: {
|
|
8323
8448
|
compaction: (u: unknown) => u is {
|
|
8324
8449
|
readonly type: "compaction";
|
|
@@ -8554,6 +8679,10 @@ declare const LLMResponse_base: Schema.Class<LLMResponse, Schema.Struct<{
|
|
|
8554
8679
|
};
|
|
8555
8680
|
} | undefined;
|
|
8556
8681
|
};
|
|
8682
|
+
raw: (u: unknown) => u is {
|
|
8683
|
+
readonly type: "raw";
|
|
8684
|
+
readonly data: unknown;
|
|
8685
|
+
};
|
|
8557
8686
|
};
|
|
8558
8687
|
}>;
|
|
8559
8688
|
readonly usage: Schema.optional<typeof Usage>;
|
package/dist/schema/events.js
CHANGED
|
@@ -247,6 +247,11 @@ export const ProviderErrorEvent = Schema.Struct({
|
|
|
247
247
|
classification: Schema.optional(ProviderFailureClassification),
|
|
248
248
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
249
249
|
}).annotate({ identifier: "LLM.Event.ProviderError" });
|
|
250
|
+
/** One provider frame as received, emitted before the events parsed from it when the request sets `includeRaw`. */
|
|
251
|
+
export const RawEvent = Schema.Struct({
|
|
252
|
+
type: Schema.tag("raw"),
|
|
253
|
+
data: Schema.Unknown,
|
|
254
|
+
}).annotate({ identifier: "LLM.Event.Raw" });
|
|
250
255
|
const llmEventTagged = Schema.Union([
|
|
251
256
|
CompactionPart,
|
|
252
257
|
StepStart,
|
|
@@ -267,6 +272,7 @@ const llmEventTagged = Schema.Union([
|
|
|
267
272
|
StepFinish,
|
|
268
273
|
Finish,
|
|
269
274
|
ProviderErrorEvent,
|
|
275
|
+
RawEvent,
|
|
270
276
|
]).pipe(Schema.toTaggedUnion("type"));
|
|
271
277
|
const contentBlockID = (value) => ContentBlockID.make(value);
|
|
272
278
|
const toolCallID = (value) => ToolCallID.make(value);
|
|
@@ -305,6 +311,7 @@ export const LLMEvent = Object.assign(llmEventTagged, {
|
|
|
305
311
|
usage: input.usage === undefined ? undefined : Usage.from(input.usage),
|
|
306
312
|
}),
|
|
307
313
|
providerError: ProviderErrorEvent.make,
|
|
314
|
+
raw: RawEvent.make,
|
|
308
315
|
is: {
|
|
309
316
|
compaction: llmEventTagged.guards.compaction,
|
|
310
317
|
stepStart: llmEventTagged.guards["step-start"],
|
|
@@ -325,6 +332,7 @@ export const LLMEvent = Object.assign(llmEventTagged, {
|
|
|
325
332
|
stepFinish: llmEventTagged.guards["step-finish"],
|
|
326
333
|
finish: llmEventTagged.guards.finish,
|
|
327
334
|
providerError: llmEventTagged.guards["provider-error"],
|
|
335
|
+
raw: llmEventTagged.guards.raw,
|
|
328
336
|
},
|
|
329
337
|
});
|
|
330
338
|
/** Joins deltas per fragment, letting an authoritative end value replace that fragment's accumulated deltas. */
|
|
@@ -509,6 +517,8 @@ const reduceToolCall = (state, event) => {
|
|
|
509
517
|
return { ...appendContent(state, toolCallContent(event)), toolInputs };
|
|
510
518
|
};
|
|
511
519
|
const reduceResponseState = (state, event) => {
|
|
520
|
+
if (event.type === "raw")
|
|
521
|
+
return state;
|
|
512
522
|
const next = appendEvent(state, event);
|
|
513
523
|
switch (event.type) {
|
|
514
524
|
case "compaction":
|
|
@@ -691,10 +691,12 @@ declare const requestSchema: Schema.Struct<{
|
|
|
691
691
|
readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
|
|
692
692
|
readonly tail: Schema.Natural;
|
|
693
693
|
}>]>>;
|
|
694
|
-
readonly
|
|
694
|
+
readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
|
|
695
695
|
}>]>>;
|
|
696
696
|
readonly promptCacheKey: Schema.optional<Schema.String>;
|
|
697
697
|
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
698
|
+
/** Emit a `raw` event with each provider frame before the events parsed from it. */
|
|
699
|
+
readonly includeRaw: Schema.optional<Schema.Boolean>;
|
|
698
700
|
}>;
|
|
699
701
|
declare const LLMRequest_base: Schema.Class<LLMRequest<LanguageModel<{
|
|
700
702
|
readonly [x: string]: unknown;
|
|
@@ -728,10 +730,12 @@ declare const LLMRequest_base: Schema.Class<LLMRequest<LanguageModel<{
|
|
|
728
730
|
readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
|
|
729
731
|
readonly tail: Schema.Natural;
|
|
730
732
|
}>]>>;
|
|
731
|
-
readonly
|
|
733
|
+
readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
|
|
732
734
|
}>]>>;
|
|
733
735
|
readonly promptCacheKey: Schema.optional<Schema.String>;
|
|
734
736
|
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
737
|
+
/** Emit a `raw` event with each provider frame before the events parsed from it. */
|
|
738
|
+
readonly includeRaw: Schema.optional<Schema.Boolean>;
|
|
735
739
|
}>, {}>;
|
|
736
740
|
export declare class LLMRequest<Model extends LanguageModel = LanguageModel> extends LLMRequest_base {
|
|
737
741
|
readonly model: Model;
|
package/dist/schema/messages.js
CHANGED
|
@@ -273,6 +273,8 @@ const requestSchema = Schema.Struct({
|
|
|
273
273
|
// Stable cache affinity for protocols that support provider-managed prompt caching.
|
|
274
274
|
promptCacheKey: Schema.optional(Schema.String),
|
|
275
275
|
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
|
|
276
|
+
/** Emit a `raw` event with each provider frame before the events parsed from it. */
|
|
277
|
+
includeRaw: Schema.optional(Schema.Boolean),
|
|
276
278
|
});
|
|
277
279
|
export class LLMRequest extends Schema.Class("LLM.Request")(requestSchema.fields) {
|
|
278
280
|
// Preserve model inference instead of inheriting the schema's erased constructor signature.
|
|
@@ -295,6 +297,7 @@ export class LLMRequest extends Schema.Class("LLM.Request")(requestSchema.fields
|
|
|
295
297
|
cache: request.cache,
|
|
296
298
|
promptCacheKey: request.promptCacheKey,
|
|
297
299
|
metadata: request.metadata,
|
|
300
|
+
includeRaw: request.includeRaw,
|
|
298
301
|
});
|
|
299
302
|
function update(request, patch) {
|
|
300
303
|
if (Object.keys(patch).length === 0)
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -170,9 +170,11 @@ export declare const LanguageModelSchema: Schema.declare<LanguageModel<{
|
|
|
170
170
|
}, CompactionOperations | undefined>, LanguageModel<{
|
|
171
171
|
readonly [x: string]: unknown;
|
|
172
172
|
}, CompactionOperations | undefined>>;
|
|
173
|
+
export declare const CacheTTL: Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>;
|
|
174
|
+
export type CacheTTL = typeof CacheTTL.Type;
|
|
173
175
|
declare const CacheHint_base: Schema.Class<CacheHint, Schema.Struct<{
|
|
174
176
|
readonly type: Schema.Literals<readonly ["ephemeral", "persistent"]>;
|
|
175
|
-
readonly
|
|
177
|
+
readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
|
|
176
178
|
}>, {}>;
|
|
177
179
|
export declare class CacheHint extends CacheHint_base {
|
|
178
180
|
}
|
|
@@ -182,7 +184,7 @@ export declare const CachePolicyObject: Schema.Struct<{
|
|
|
182
184
|
readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
|
|
183
185
|
readonly tail: Schema.Natural;
|
|
184
186
|
}>]>>;
|
|
185
|
-
readonly
|
|
187
|
+
readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
|
|
186
188
|
}>;
|
|
187
189
|
export type CachePolicyObject = Schema.Schema.Type<typeof CachePolicyObject>;
|
|
188
190
|
export declare const CachePolicy: Schema.Union<readonly [Schema.Literal<"auto">, Schema.Literal<"none">, Schema.Struct<{
|
|
@@ -191,7 +193,7 @@ export declare const CachePolicy: Schema.Union<readonly [Schema.Literal<"auto">,
|
|
|
191
193
|
readonly messages: Schema.optional<Schema.Union<readonly [Schema.Literal<"latest-user-message">, Schema.Literal<"latest-assistant">, Schema.Struct<{
|
|
192
194
|
readonly tail: Schema.Natural;
|
|
193
195
|
}>]>>;
|
|
194
|
-
readonly
|
|
196
|
+
readonly ttl: Schema.optional<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>;
|
|
195
197
|
}>]>;
|
|
196
198
|
export type CachePolicy = Schema.Schema.Type<typeof CachePolicy>;
|
|
197
199
|
export {};
|
package/dist/schema/options.js
CHANGED
|
@@ -210,9 +210,12 @@ export class LanguageModel {
|
|
|
210
210
|
export const LanguageModelSchema = Schema.declare((value) => value instanceof LanguageModel, {
|
|
211
211
|
expected: "LLM.LanguageModel",
|
|
212
212
|
});
|
|
213
|
+
// Provider cache lifetime such as "5m", "30m", "1h" or "24h", in models.dev's duration format. It is sent as given;
|
|
214
|
+
// each provider accepts its own set, and omitting it keeps the provider default.
|
|
215
|
+
export const CacheTTL = Schema.TemplateLiteral([Schema.Number, Schema.Literals(["ms", "s", "m", "h", "d"])]).check(Schema.isPattern(/^\d+(ms|s|m|h|d)$/));
|
|
213
216
|
export class CacheHint extends Schema.Class("LLM.CacheHint")({
|
|
214
217
|
type: Schema.Literals(["ephemeral", "persistent"]),
|
|
215
|
-
|
|
218
|
+
ttl: Schema.optional(CacheTTL),
|
|
216
219
|
}) {
|
|
217
220
|
}
|
|
218
221
|
// Auto-placement policy for prompt caching. The protocol-neutral lowering step
|
|
@@ -224,7 +227,9 @@ export class CacheHint extends Schema.Class("LLM.CacheHint")({
|
|
|
224
227
|
// tool loops.
|
|
225
228
|
//
|
|
226
229
|
// Pass `"none"` to opt out entirely (the legacy behavior). Pass the granular
|
|
227
|
-
// object form to
|
|
230
|
+
// object form to choose placements exactly; an object with only `ttl` keeps
|
|
231
|
+
// the automatic placements and sets their lifetime. Routes without inline
|
|
232
|
+
// markers send `ttl` as a request-level cache option where one exists.
|
|
228
233
|
export const CachePolicyObject = Schema.Struct({
|
|
229
234
|
tools: Schema.optional(Schema.Boolean),
|
|
230
235
|
system: Schema.optional(Schema.Boolean),
|
|
@@ -233,6 +238,6 @@ export const CachePolicyObject = Schema.Struct({
|
|
|
233
238
|
Schema.Literal("latest-assistant"),
|
|
234
239
|
Schema.Struct({ tail: Schema.Natural }),
|
|
235
240
|
])),
|
|
236
|
-
|
|
241
|
+
ttl: Schema.optional(CacheTTL),
|
|
237
242
|
});
|
|
238
243
|
export const CachePolicy = Schema.Union([Schema.Literal("auto"), Schema.Literal("none"), CachePolicyObject]);
|
package/dist/speech-client.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class SpeechClientService extends SpeechClientService_base {
|
|
|
8
8
|
export declare const Service: typeof SpeechClientService;
|
|
9
9
|
export type Service = SpeechClientService;
|
|
10
10
|
export declare const SpeechClient: {
|
|
11
|
-
readonly layer: import("effect/Layer").Layer<SpeechClientService, never, import("./route
|
|
11
|
+
readonly layer: import("effect/Layer").Layer<SpeechClientService, never, import("./route.js").RequestExecutorService>;
|
|
12
12
|
readonly generate: (request: SpeechRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Effect").Effect<SpeechResponse, import("./effect.js").AIError, SpeechClientService>;
|
|
13
13
|
readonly stream: (request: SpeechRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Stream").Stream<{
|
|
14
14
|
readonly type: "audio-delta";
|
package/dist/speech.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ProgressEvent, QueuedEvent } from "./generation.js";
|
|
|
3
3
|
import { Media } from "./media.js";
|
|
4
4
|
import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
|
|
5
5
|
import { MediaRoute } from "./route/media.js";
|
|
6
|
-
import { AIError, HttpOptions, MediaUsage, ProviderMetadata, ProviderOptions
|
|
6
|
+
import { AIError, HttpOptions, MediaUsage, ProviderMetadata, ProviderOptions } from "./schema/index.js";
|
|
7
7
|
import { SpeechClient, Service } from "./speech-client.js";
|
|
8
8
|
export class SpeechModel extends MediaModel {
|
|
9
9
|
static fromRoute(route, input) {
|
|
@@ -11,6 +11,7 @@ export class SpeechModel extends MediaModel {
|
|
|
11
11
|
id: input.id,
|
|
12
12
|
provider: route.protocol.provider,
|
|
13
13
|
http: input.http,
|
|
14
|
+
providerOptions: input.providerOptions,
|
|
14
15
|
route: composeRoute(route, input, collectResponse),
|
|
15
16
|
});
|
|
16
17
|
}
|