@opencode/ai 2.0.3 → 2.0.4

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.
Files changed (77) hide show
  1. package/dist/cache-policy.js +10 -2
  2. package/dist/effort-updates.d.ts +12 -0
  3. package/dist/effort-updates.js +23 -0
  4. package/dist/protocols/alibaba-messages.d.ts +4 -1
  5. package/dist/protocols/alibaba-responses.d.ts +3 -1
  6. package/dist/protocols/anthropic-messages.d.ts +11 -2
  7. package/dist/protocols/anthropic-messages.js +48 -17
  8. package/dist/protocols/bedrock-converse.js +17 -12
  9. package/dist/protocols/meta-messages.d.ts +4 -1
  10. package/dist/protocols/meta-responses.d.ts +8 -4
  11. package/dist/protocols/mistral-chat.js +5 -33
  12. package/dist/protocols/open-responses-channel.js +4 -0
  13. package/dist/protocols/open-responses.d.ts +27 -9
  14. package/dist/protocols/open-responses.js +24 -8
  15. package/dist/protocols/openai-chat.d.ts +7 -7
  16. package/dist/protocols/openai-chat.js +10 -4
  17. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  18. package/dist/protocols/openai-compatible-responses.d.ts +4 -2
  19. package/dist/protocols/openai-responses.d.ts +74 -31
  20. package/dist/protocols/openai-responses.js +27 -6
  21. package/dist/protocols/utils/bedrock-media.d.ts +10 -8
  22. package/dist/protocols/utils/bedrock-media.js +29 -5
  23. package/dist/protocols/utils/mistral-tool-id.d.ts +5 -0
  24. package/dist/protocols/utils/mistral-tool-id.js +31 -0
  25. package/dist/protocols/utils/open-responses-options.d.ts +2 -4
  26. package/dist/protocols/utils/open-responses-options.js +2 -2
  27. package/dist/protocols/utils/responses-compaction.js +3 -1
  28. package/dist/protocols/xai-responses.d.ts +4 -2
  29. package/dist/protocols/zai-chat.d.ts +1 -1
  30. package/dist/protocols/zai-messages.d.ts +4 -1
  31. package/dist/provider-error.js +40 -4
  32. package/dist/providers/alibaba.d.ts +15 -10
  33. package/dist/providers/amazon-bedrock-mantle.d.ts +5 -3
  34. package/dist/providers/anthropic-compatible.d.ts +4 -1
  35. package/dist/providers/anthropic.d.ts +4 -1
  36. package/dist/providers/azure.d.ts +19 -5
  37. package/dist/providers/azure.js +1 -8
  38. package/dist/providers/baseten.d.ts +2 -2
  39. package/dist/providers/cerebras.d.ts +2 -2
  40. package/dist/providers/cerebras.js +1 -1
  41. package/dist/providers/cloudflare-ai-gateway.d.ts +1024 -13
  42. package/dist/providers/cloudflare-ai-gateway.js +64 -27
  43. package/dist/providers/cloudflare-workers-ai.d.ts +3 -3
  44. package/dist/providers/cloudflare-workers-ai.js +1 -1
  45. package/dist/providers/deepinfra.d.ts +2 -2
  46. package/dist/providers/deepinfra.js +1 -1
  47. package/dist/providers/deepseek.d.ts +2 -2
  48. package/dist/providers/fireworks.d.ts +2 -2
  49. package/dist/providers/fireworks.js +1 -1
  50. package/dist/providers/google-vertex-chat.d.ts +1 -1
  51. package/dist/providers/google-vertex-messages.d.ts +4 -1
  52. package/dist/providers/google-vertex-responses.d.ts +4 -2
  53. package/dist/providers/google-vertex.js +5 -1
  54. package/dist/providers/groq.d.ts +2 -2
  55. package/dist/providers/meta.d.ts +9 -4
  56. package/dist/providers/meta.js +1 -1
  57. package/dist/providers/minimax.d.ts +9 -4
  58. package/dist/providers/moonshot.d.ts +9 -4
  59. package/dist/providers/moonshot.js +1 -0
  60. package/dist/providers/openai-compatible-responses.d.ts +4 -2
  61. package/dist/providers/openai-compatible.d.ts +1 -1
  62. package/dist/providers/openai.d.ts +10 -3
  63. package/dist/providers/openai.js +4 -1
  64. package/dist/providers/openrouter.d.ts +4 -4
  65. package/dist/providers/openrouter.js +1 -1
  66. package/dist/providers/togetherai.d.ts +2 -2
  67. package/dist/providers/xai.d.ts +1 -1
  68. package/dist/providers/zai-coding-plan.d.ts +9 -4
  69. package/dist/providers/zai.d.ts +1 -1
  70. package/dist/route/client.d.ts +1 -0
  71. package/dist/route/client.js +3 -1
  72. package/dist/route/protocol.d.ts +2 -0
  73. package/dist/schema/messages.d.ts +22 -3
  74. package/dist/schema/messages.js +9 -1
  75. package/dist/schema/options.d.ts +6 -0
  76. package/dist/schema/options.js +7 -0
  77. package/package.json +3 -3
@@ -166,7 +166,7 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
166
166
  }>>;
167
167
  store: Schema.optional<Schema.Boolean>;
168
168
  prompt_cache_key: Schema.optional<Schema.String>;
169
- reasoning_effort: Schema.optional<Schema.declare<import("../protocols/utils/open-responses-options.js").ReasoningEffort, import("../protocols/utils/open-responses-options.js").ReasoningEffort>>;
169
+ reasoning_effort: Schema.optional<Schema.declare<import("../schema/options.js").ReasoningEffort, import("../schema/options.js").ReasoningEffort>>;
170
170
  tool_stream: Schema.optional<Schema.Boolean>;
171
171
  max_completion_tokens: Schema.optional<Schema.Number>;
172
172
  max_tokens: Schema.optional<Schema.Number>;
@@ -271,7 +271,7 @@ export declare const protocol: Protocol<{
271
271
  readonly frequency_penalty?: number | undefined;
272
272
  readonly presence_penalty?: number | undefined;
273
273
  readonly prompt_cache_key?: string | undefined;
274
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
274
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
275
275
  readonly store?: boolean | undefined;
276
276
  readonly stream_options?: {
277
277
  readonly include_usage: boolean;
@@ -438,7 +438,7 @@ export declare const route: Route<{
438
438
  readonly frequency_penalty?: number | undefined;
439
439
  readonly presence_penalty?: number | undefined;
440
440
  readonly prompt_cache_key?: string | undefined;
441
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
441
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
442
442
  readonly store?: boolean | undefined;
443
443
  readonly stream_options?: {
444
444
  readonly include_usage: boolean;
@@ -538,7 +538,7 @@ export declare const routes: Route<{
538
538
  readonly frequency_penalty?: number | undefined;
539
539
  readonly presence_penalty?: number | undefined;
540
540
  readonly prompt_cache_key?: string | undefined;
541
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
541
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
542
542
  readonly store?: boolean | undefined;
543
543
  readonly stream_options?: {
544
544
  readonly include_usage: boolean;
@@ -100,7 +100,7 @@ export const configure = (input = {}) => {
100
100
  const route = configuredRoute(input);
101
101
  return {
102
102
  id,
103
- model: (modelID) => route.model({ id: modelID }),
103
+ model: (modelID) => route.model({ id: modelID, compatibility: { supportsPromptCacheKey: true } }),
104
104
  configure,
105
105
  };
106
106
  };
@@ -104,7 +104,7 @@ export declare const route: Route<{
104
104
  readonly frequency_penalty?: number | undefined;
105
105
  readonly presence_penalty?: number | undefined;
106
106
  readonly prompt_cache_key?: string | undefined;
107
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
107
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
108
108
  readonly store?: boolean | undefined;
109
109
  readonly stream_options?: {
110
110
  readonly include_usage: boolean;
@@ -203,7 +203,7 @@ export declare const routes: Route<{
203
203
  readonly frequency_penalty?: number | undefined;
204
204
  readonly presence_penalty?: number | undefined;
205
205
  readonly prompt_cache_key?: string | undefined;
206
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
206
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
207
207
  readonly store?: boolean | undefined;
208
208
  readonly stream_options?: {
209
209
  readonly include_usage: boolean;
@@ -111,7 +111,7 @@ export declare const routes: (Route<{
111
111
  readonly frequency_penalty?: number | undefined;
112
112
  readonly presence_penalty?: number | undefined;
113
113
  readonly prompt_cache_key?: string | undefined;
114
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
114
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
115
115
  readonly store?: boolean | undefined;
116
116
  readonly stream_options?: {
117
117
  readonly include_usage: boolean;
@@ -70,12 +70,15 @@ export declare const routes: (Route<{
70
70
  readonly encrypted_content: string;
71
71
  readonly id?: string | null | undefined;
72
72
  } | {
73
+ readonly type: "message";
73
74
  readonly role: "system";
74
75
  readonly content: string;
75
76
  } | {
77
+ readonly type: "message";
76
78
  readonly role: "developer";
77
79
  readonly content: string;
78
80
  } | {
81
+ readonly type: "message";
79
82
  readonly content: readonly ({
80
83
  readonly type: "input_image";
81
84
  readonly image_url: string;
@@ -92,7 +95,6 @@ export declare const routes: (Route<{
92
95
  })[];
93
96
  readonly role: "user";
94
97
  readonly id?: string | undefined;
95
- readonly type?: "message" | undefined;
96
98
  readonly status?: string | undefined;
97
99
  } | {
98
100
  readonly type: "message";
@@ -140,7 +142,7 @@ export declare const routes: (Route<{
140
142
  readonly instructions?: string | undefined;
141
143
  readonly reasoning?: {
142
144
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
143
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
145
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
144
146
  } | undefined;
145
147
  readonly tools?: readonly {
146
148
  readonly type: "function";
@@ -279,7 +281,7 @@ export declare const routes: (Route<{
279
281
  readonly frequency_penalty?: number | undefined;
280
282
  readonly presence_penalty?: number | undefined;
281
283
  readonly prompt_cache_key?: string | undefined;
282
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
284
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
283
285
  readonly store?: boolean | undefined;
284
286
  readonly stream_options?: {
285
287
  readonly include_usage: boolean;
@@ -466,7 +468,6 @@ export declare const routes: (Route<{
466
468
  readonly content: string | null;
467
469
  })[];
468
470
  } | {
469
- readonly role: "system";
470
471
  readonly content: readonly {
471
472
  readonly type: "text";
472
473
  readonly text: string;
@@ -475,6 +476,10 @@ export declare const routes: (Route<{
475
476
  readonly ttl?: "1h" | "5m" | undefined;
476
477
  } | undefined;
477
478
  }[];
479
+ readonly role: "system";
480
+ readonly output_config?: {
481
+ readonly effort: string;
482
+ } | undefined;
478
483
  })[];
479
484
  readonly stream: true;
480
485
  readonly metadata?: {
@@ -111,7 +111,7 @@ export declare const routes: Route<{
111
111
  readonly frequency_penalty?: number | undefined;
112
112
  readonly presence_penalty?: number | undefined;
113
113
  readonly prompt_cache_key?: string | undefined;
114
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
114
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
115
115
  readonly store?: boolean | undefined;
116
116
  readonly stream_options?: {
117
117
  readonly include_usage: boolean;
@@ -30,6 +30,7 @@ export interface Route<Body, Prepared = unknown, Compact extends CompactionOpera
30
30
  readonly transport: Transport<Body, Prepared, unknown>;
31
31
  readonly defaults: RouteDefaults;
32
32
  readonly body: RouteBody<Body>;
33
+ readonly supportsEffortUpdates?: (request: LLMRequest) => boolean;
33
34
  readonly with: {
34
35
  <Next extends CompactionOperations | undefined>(patch: RoutePatch<Body, Prepared> & {
35
36
  readonly compact: Next;
@@ -5,6 +5,7 @@ import { RequestExecutor } from "./executor.js";
5
5
  import { Framing } from "./framing.js";
6
6
  import { HttpTransport } from "./transport/index.js";
7
7
  import { applyCachePolicy } from "../cache-policy.js";
8
+ import { applyEffortUpdates } from "../effort-updates.js";
8
9
  import { normalizeToolHistory } from "../tool-history.js";
9
10
  import { sanitizeSurrogates } from "../utils/sanitize.js";
10
11
  import * as ProviderShared from "../protocols/shared.js";
@@ -120,6 +121,7 @@ function makeFromTransport(input) {
120
121
  transport: routeInput.transport,
121
122
  defaults: routeInput.defaults ?? {},
122
123
  body: protocol.body,
124
+ supportsEffortUpdates: protocol.supportsEffortUpdates,
123
125
  with: (patch) => {
124
126
  const { compact, id, provider, providerMetadataKey, auth, transport, endpoint, ...defaults } = patch;
125
127
  return build({
@@ -212,7 +214,7 @@ const prepareRequest = (request) => {
212
214
  const sanitized = LLMRequest.update(original, sanitizeSurrogates({ ...LLMRequest.input(original), model: undefined }));
213
215
  // Deduplicate per sibling level; a tool and a namespace may share a name.
214
216
  const dedupe = (tools) => [...new Map(tools.map((tool) => [`${tool.type}:${tool.name}`, tool])).values()].map((tool) => tool.type === "tool" ? tool : { ...tool, tools: dedupe(tool.tools) });
215
- const resolved = applyCachePolicy(LLMRequest.update(sanitized, { tools: dedupe(sanitized.tools) }));
217
+ const resolved = applyCachePolicy(applyEffortUpdates(LLMRequest.update(sanitized, { tools: dedupe(sanitized.tools) })));
216
218
  const headers = resolved.model.route.headers?.({ request: resolved });
217
219
  return headers === undefined
218
220
  ? resolved
@@ -40,6 +40,8 @@ export interface Protocol<Body, Frame, Event, State> {
40
40
  readonly body: ProtocolBody<Body>;
41
41
  /** Response side: streaming state machine. */
42
42
  readonly stream: ProtocolStream<Frame, Event, State>;
43
+ /** Whether `body.from` lowers `Message.effort(...)` markers; wrappers around another `body.from` must forward it. */
44
+ readonly supportsEffortUpdates?: (request: LLMRequest) => boolean;
43
45
  }
44
46
  export interface ProtocolBody<Body> {
45
47
  /** Schema for the validated provider-native body sent as the JSON request. */
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { Tool } from "@opencode/schema/tool";
3
- import { CacheHint, GenerationOptions, HttpOptions, type LanguageModel } from "./options.js";
3
+ import { CacheHint, GenerationOptions, HttpOptions, type LanguageModel, ReasoningEffort } from "./options.js";
4
4
  export declare const MessageRole: Schema.Literals<readonly ["system", "user", "assistant", "tool"]>;
5
5
  export type MessageRole = Schema.Schema.Type<typeof MessageRole>;
6
6
  export declare const ProviderMetadata: Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>;
@@ -247,6 +247,13 @@ export declare const CompactionPart: Schema.refine<{
247
247
  }>> & {
248
248
  make: (input: Omit<CompactionPart, "type" | "encrypted" | "text"> & CompactionContent) => CompactionPart;
249
249
  };
250
+ /** Reasoning effort changed here, from `previous` to `effort`; `undefined` is the model default. */
251
+ export declare const EffortPart: Schema.Struct<{
252
+ readonly type: Schema.Literal<"effort">;
253
+ readonly effort: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
254
+ readonly previous: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
255
+ }>;
256
+ export type EffortPart = Schema.Schema.Type<typeof EffortPart>;
250
257
  export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
251
258
  readonly type: Schema.Literal<"text">;
252
259
  readonly text: Schema.String;
@@ -353,7 +360,11 @@ export declare const ContentPart: Schema.toTaggedUnion<"type", readonly [Schema.
353
360
  readonly text: Schema.optional<Schema.NullOr<Schema.String>>;
354
361
  }>> & {
355
362
  make: (input: Omit<CompactionPart, "type" | "encrypted" | "text"> & CompactionContent) => CompactionPart;
356
- }]>;
363
+ }, Schema.Struct<{
364
+ readonly type: Schema.Literal<"effort">;
365
+ readonly effort: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
366
+ readonly previous: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
367
+ }>]>;
357
368
  export type ContentPart = Schema.Schema.Type<typeof ContentPart>;
358
369
  declare const Message_base: Schema.Class<Message, Schema.Struct<{
359
370
  readonly id: Schema.optional<Schema.String>;
@@ -464,7 +475,11 @@ declare const Message_base: Schema.Class<Message, Schema.Struct<{
464
475
  readonly text: Schema.optional<Schema.NullOr<Schema.String>>;
465
476
  }>> & {
466
477
  make: (input: Omit<CompactionPart, "type" | "encrypted" | "text"> & CompactionContent) => CompactionPart;
467
- }]>>;
478
+ }, Schema.Struct<{
479
+ readonly type: Schema.Literal<"effort">;
480
+ readonly effort: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
481
+ readonly previous: Schema.optional<Schema.declare<ReasoningEffort, ReasoningEffort>>;
482
+ }>]>>;
468
483
  readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
469
484
  readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
470
485
  readonly native: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
@@ -489,6 +504,10 @@ export declare namespace Message {
489
504
  * updates; pass that untrusted content through ordinary user/tool channels.
490
505
  */
491
506
  const system: (content: SystemContentInput) => Message;
507
+ const effort: (input: {
508
+ readonly effort?: ReasoningEffort;
509
+ readonly previous?: ReasoningEffort;
510
+ }) => Message;
492
511
  const tool: (result: ToolResultPart | Parameters<typeof ToolResultPart.make>[0]) => Message;
493
512
  }
494
513
  declare const toolDefinitionFields: {
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { Tool } from "@opencode/schema/tool";
3
- import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, JsonSchema, LanguageModelSchema, ProviderOptions, } from "./options.js";
3
+ import { CacheHint, CachePolicy, GenerationOptions, HttpOptions, JsonSchema, LanguageModelSchema, ProviderOptions, ReasoningEffort, } from "./options.js";
4
4
  import { ProviderID } from "./ids.js";
5
5
  export const MessageRole = Schema.Literals(["system", "user", "assistant", "tool"]);
6
6
  export const ProviderMetadata = Schema.Record(Schema.String, Schema.Record(Schema.String, Schema.Unknown)).annotate({
@@ -158,6 +158,12 @@ const compactionPartSchema = Schema.Struct({
158
158
  export const CompactionPart = Object.assign(compactionPartSchema, {
159
159
  make: (input) => Schema.decodeUnknownSync(compactionPartSchema)({ type: "compaction", ...input }),
160
160
  });
161
+ /** Reasoning effort changed here, from `previous` to `effort`; `undefined` is the model default. */
162
+ export const EffortPart = Schema.Struct({
163
+ type: Schema.Literal("effort"),
164
+ effort: Schema.optional(ReasoningEffort),
165
+ previous: Schema.optional(ReasoningEffort),
166
+ }).annotate({ identifier: "LLM.Content.Effort" });
161
167
  export const ContentPart = Schema.Union([
162
168
  TextPart,
163
169
  MediaPart,
@@ -165,6 +171,7 @@ export const ContentPart = Schema.Union([
165
171
  ToolResultPart,
166
172
  ReasoningPart,
167
173
  CompactionPart,
174
+ EffortPart,
168
175
  ]).pipe(Schema.toTaggedUnion("type"));
169
176
  export class Message extends Schema.Class("LLM.Message")({
170
177
  id: Schema.optional(Schema.String),
@@ -192,6 +199,7 @@ export class Message extends Schema.Class("LLM.Message")({
192
199
  * updates; pass that untrusted content through ordinary user/tool channels.
193
200
  */
194
201
  Message.system = (content) => Message.make({ role: "system", content });
202
+ Message.effort = (input) => Message.make({ role: "system", content: [{ type: "effort", effort: input.effort, previous: input.previous }] });
195
203
  Message.tool = (result) => Message.make({ role: "tool", content: ["type" in result ? result : ToolResultPart.make(result)] });
196
204
  })(Message || (Message = {}));
197
205
  const toolDefinitionFields = {
@@ -65,6 +65,9 @@ export declare namespace LanguageModelDefaults {
65
65
  /** Normalize selected-model request defaults without applying precedence. */
66
66
  const make: (input: Input) => LanguageModelDefaults;
67
67
  }
68
+ export declare const ReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
69
+ export type ReasoningEffort = (typeof ReasoningEfforts)[number] | (string & {});
70
+ export declare const ReasoningEffort: Schema.declare<ReasoningEffort, ReasoningEffort>;
68
71
  export declare const LanguageModelToolSchemaCompatibility: Schema.Literals<readonly ["gemini", "moonshot"]>;
69
72
  export type LanguageModelToolSchemaCompatibility = Schema.Schema.Type<typeof LanguageModelToolSchemaCompatibility>;
70
73
  export declare const LanguageModelMaxTokensFieldCompatibility: Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>;
@@ -80,10 +83,13 @@ declare const LanguageModelCompatibility_base: Schema.Class<LanguageModelCompati
80
83
  readonly supportsStore: Schema.optional<Schema.Boolean>;
81
84
  readonly supportsUsageInStreaming: Schema.optional<Schema.Boolean>;
82
85
  readonly supportsStrictMode: Schema.optional<Schema.Boolean>;
86
+ readonly supportsPromptCacheKey: Schema.optional<Schema.Boolean>;
83
87
  readonly zaiToolStream: Schema.optional<Schema.Boolean>;
84
88
  readonly requireSignature: Schema.optional<Schema.Boolean>;
85
89
  /** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
86
90
  readonly supportsThinkingBlockBinding: Schema.optional<Schema.Boolean>;
91
+ /** Supports per-message effort updates. Overrides model-ID detection. */
92
+ readonly supportsEffortUpdates: Schema.optional<Schema.Boolean>;
87
93
  }>, {}>;
88
94
  export declare class LanguageModelCompatibility extends LanguageModelCompatibility_base {
89
95
  }
@@ -94,6 +94,8 @@ export class LanguageModelDefaults extends Schema.Class("LLM.LanguageModelDefaul
94
94
  });
95
95
  };
96
96
  })(LanguageModelDefaults || (LanguageModelDefaults = {}));
97
+ export const ReasoningEfforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
98
+ export const ReasoningEffort = Schema.declare((value) => typeof value === "string", { title: "ReasoningEffort" });
97
99
  export const LanguageModelToolSchemaCompatibility = Schema.Literals(["gemini", "moonshot"]);
98
100
  export const LanguageModelMaxTokensFieldCompatibility = Schema.Literals(["max_completion_tokens", "max_tokens"]);
99
101
  export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelCompatibility")({
@@ -107,10 +109,15 @@ export class LanguageModelCompatibility extends Schema.Class("LLM.LanguageModelC
107
109
  supportsStore: Schema.optional(Schema.Boolean),
108
110
  supportsUsageInStreaming: Schema.optional(Schema.Boolean),
109
111
  supportsStrictMode: Schema.optional(Schema.Boolean),
112
+ // Accepts `prompt_cache_key` in the Chat Completions body. Chat omits the
113
+ // key unless this is set; session-affinity headers still flow regardless.
114
+ supportsPromptCacheKey: Schema.optional(Schema.Boolean),
110
115
  zaiToolStream: Schema.optional(Schema.Boolean),
111
116
  requireSignature: Schema.optional(Schema.Boolean),
112
117
  /** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
113
118
  supportsThinkingBlockBinding: Schema.optional(Schema.Boolean),
119
+ /** Supports per-message effort updates. Overrides model-ID detection. */
120
+ supportsEffortUpdates: Schema.optional(Schema.Boolean),
114
121
  }) {
115
122
  }
116
123
  (function (LanguageModelCompatibility) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "name": "@opencode/ai",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@clack/prompts": "1.0.0-alpha.1",
32
32
  "@effect/platform-node": "4.0.0-rc.112",
33
- "@opencode/http-recorder": "2.0.3",
33
+ "@opencode/http-recorder": "2.0.4",
34
34
  "@tsconfig/bun": "1.0.9",
35
35
  "@types/bun": "1.4.0",
36
36
  "@typescript/native-preview": "7.0.0-dev.20251207.1",
@@ -40,7 +40,7 @@
40
40
  "@aws-sdk/credential-providers": "3.1057.0",
41
41
  "@smithy/eventstream-codec": "4.2.14",
42
42
  "@smithy/util-utf8": "4.2.2",
43
- "@opencode/schema": "2.0.3",
43
+ "@opencode/schema": "2.0.4",
44
44
  "aws4fetch": "1.0.20",
45
45
  "effect": "4.0.0-rc.112",
46
46
  "google-auth-library": "10.5.0"