@opencode/ai 0.0.0-dev-19594 → 0.0.0-dev-19595

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 (56) 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/anthropic-messages.d.ts +11 -2
  6. package/dist/protocols/anthropic-messages.js +48 -17
  7. package/dist/protocols/meta-messages.d.ts +4 -1
  8. package/dist/protocols/meta-responses.d.ts +2 -2
  9. package/dist/protocols/open-responses.d.ts +9 -2
  10. package/dist/protocols/open-responses.js +17 -2
  11. package/dist/protocols/openai-chat.d.ts +7 -7
  12. package/dist/protocols/openai-compatible-chat.d.ts +1 -1
  13. package/dist/protocols/openai-compatible-responses.d.ts +1 -1
  14. package/dist/protocols/openai-responses.d.ts +56 -25
  15. package/dist/protocols/openai-responses.js +23 -4
  16. package/dist/protocols/utils/open-responses-options.d.ts +2 -4
  17. package/dist/protocols/utils/open-responses-options.js +2 -2
  18. package/dist/protocols/utils/responses-compaction.js +3 -1
  19. package/dist/protocols/xai-responses.d.ts +1 -1
  20. package/dist/protocols/zai-chat.d.ts +1 -1
  21. package/dist/protocols/zai-messages.d.ts +4 -1
  22. package/dist/providers/alibaba.d.ts +12 -9
  23. package/dist/providers/amazon-bedrock-mantle.d.ts +2 -2
  24. package/dist/providers/anthropic-compatible.d.ts +4 -1
  25. package/dist/providers/anthropic.d.ts +4 -1
  26. package/dist/providers/azure.d.ts +13 -3
  27. package/dist/providers/baseten.d.ts +2 -2
  28. package/dist/providers/cerebras.d.ts +2 -2
  29. package/dist/providers/cloudflare-ai-gateway.d.ts +2 -2
  30. package/dist/providers/cloudflare-workers-ai.d.ts +2 -2
  31. package/dist/providers/deepinfra.d.ts +2 -2
  32. package/dist/providers/deepseek.d.ts +2 -2
  33. package/dist/providers/fireworks.d.ts +2 -2
  34. package/dist/providers/google-vertex-chat.d.ts +1 -1
  35. package/dist/providers/google-vertex-messages.d.ts +4 -1
  36. package/dist/providers/google-vertex-responses.d.ts +1 -1
  37. package/dist/providers/groq.d.ts +2 -2
  38. package/dist/providers/meta.d.ts +6 -3
  39. package/dist/providers/minimax.d.ts +6 -3
  40. package/dist/providers/moonshot.d.ts +6 -3
  41. package/dist/providers/openai-compatible-responses.d.ts +1 -1
  42. package/dist/providers/openai-compatible.d.ts +1 -1
  43. package/dist/providers/openai.d.ts +7 -2
  44. package/dist/providers/openrouter.d.ts +4 -4
  45. package/dist/providers/togetherai.d.ts +2 -2
  46. package/dist/providers/xai.d.ts +1 -1
  47. package/dist/providers/zai-coding-plan.d.ts +6 -3
  48. package/dist/providers/zai.d.ts +1 -1
  49. package/dist/route/client.d.ts +1 -0
  50. package/dist/route/client.js +3 -1
  51. package/dist/route/protocol.d.ts +2 -0
  52. package/dist/schema/messages.d.ts +22 -3
  53. package/dist/schema/messages.js +9 -1
  54. package/dist/schema/options.d.ts +5 -0
  55. package/dist/schema/options.js +4 -0
  56. package/package.json +3 -3
@@ -3,6 +3,7 @@ import { Route } from "../route/client.js";
3
3
  import { Protocol } from "../route/protocol.js";
4
4
  import { HttpTransport } from "../route/transport/index.js";
5
5
  import { OpenResponses } from "./open-responses.js";
6
+ import { OpenResponsesOptions } from "./utils/open-responses-options.js";
6
7
  export declare const DEFAULT_BASE_URL = "https://api.openai.com/v1";
7
8
  export declare const PATH = "/responses";
8
9
  export declare const ContextManagement: Schema.$Array<Schema.Struct<{
@@ -132,7 +133,12 @@ declare const OpenAIResponsesBody: Schema.Struct<{
132
133
  readonly result: Schema.optional<Schema.NullOr<Schema.String>>;
133
134
  readonly output_format: Schema.optional<Schema.Literals<readonly ["png", "jpeg", "webp"]>>;
134
135
  readonly revised_prompt: Schema.optional<Schema.NullOr<Schema.String>>;
135
- }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>]>>;
136
+ }>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>]>, Schema.Struct<{
137
+ readonly type: Schema.Literal<"configuration_update">;
138
+ readonly reasoning: Schema.Struct<{
139
+ readonly effort: Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>;
140
+ }>;
141
+ }>]>>;
136
142
  readonly tools: Schema.optional<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
137
143
  readonly type: Schema.tag<"function">;
138
144
  readonly name: Schema.String;
@@ -188,15 +194,15 @@ declare const OpenAIResponsesBody: Schema.Struct<{
188
194
  }>>;
189
195
  readonly top_logprobs: Schema.optional<Schema.Int>;
190
196
  readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
191
- readonly service_tier: Schema.optional<Schema.declare<import("./utils/open-responses-options.js").ServiceTier, import("./utils/open-responses-options.js").ServiceTier>>;
197
+ readonly service_tier: Schema.optional<Schema.declare<OpenResponsesOptions.ServiceTier, OpenResponsesOptions.ServiceTier>>;
192
198
  readonly prompt_cache_key: Schema.optional<Schema.String>;
193
- readonly include: Schema.optional<Schema.$Array<Schema.declare<import("./utils/open-responses-options.js").ResponseIncludable, import("./utils/open-responses-options.js").ResponseIncludable>>>;
199
+ readonly include: Schema.optional<Schema.$Array<Schema.declare<OpenResponsesOptions.ResponseIncludable, OpenResponsesOptions.ResponseIncludable>>>;
194
200
  readonly reasoning: Schema.optional<Schema.Struct<{
195
- readonly effort: Schema.optional<Schema.declare<import("./utils/open-responses-options.js").ReasoningEffort, import("./utils/open-responses-options.js").ReasoningEffort>>;
201
+ readonly effort: Schema.optional<Schema.declare<OpenResponsesOptions.ReasoningEffort, OpenResponsesOptions.ReasoningEffort>>;
196
202
  readonly summary: Schema.optional<Schema.Literals<readonly ["auto", "concise", "detailed"]>>;
197
203
  }>>;
198
204
  readonly text: Schema.optional<Schema.Struct<{
199
- readonly verbosity: Schema.optional<Schema.declare<import("./utils/open-responses-options.js").TextVerbosity, import("./utils/open-responses-options.js").TextVerbosity>>;
205
+ readonly verbosity: Schema.optional<Schema.declare<OpenResponsesOptions.TextVerbosity, OpenResponsesOptions.TextVerbosity>>;
200
206
  }>>;
201
207
  readonly max_output_tokens: Schema.optional<Schema.Number>;
202
208
  readonly max_tool_calls: Schema.optional<Schema.Int>;
@@ -249,6 +255,11 @@ export declare const protocol: Protocol<{
249
255
  readonly error?: unknown;
250
256
  readonly arguments?: string | undefined;
251
257
  readonly server_label?: string | undefined;
258
+ } | {
259
+ readonly type: "configuration_update";
260
+ readonly reasoning: {
261
+ readonly effort: OpenResponsesOptions.ReasoningEffort;
262
+ };
252
263
  } | {
253
264
  readonly type: "reasoning";
254
265
  readonly summary: readonly {
@@ -360,7 +371,7 @@ export declare const protocol: Protocol<{
360
371
  readonly instructions?: string | undefined;
361
372
  readonly reasoning?: {
362
373
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
363
- readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
374
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
364
375
  } | undefined;
365
376
  readonly tools?: readonly ({
366
377
  readonly type: "function";
@@ -395,10 +406,10 @@ export declare const protocol: Protocol<{
395
406
  }[];
396
407
  })[] | undefined;
397
408
  readonly text?: {
398
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
409
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
399
410
  } | undefined;
400
411
  readonly temperature?: number | undefined;
401
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
412
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
402
413
  readonly context_management?: readonly {
403
414
  readonly type: "compaction";
404
415
  readonly compact_threshold?: number | undefined;
@@ -422,7 +433,7 @@ export declare const protocol: Protocol<{
422
433
  readonly prompt_cache_key?: string | undefined;
423
434
  readonly parallel_tool_calls?: boolean | undefined;
424
435
  readonly store?: boolean | undefined;
425
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
436
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
426
437
  readonly truncation?: "auto" | "disabled" | undefined;
427
438
  readonly stream_options?: {
428
439
  readonly include_obfuscation?: boolean | undefined;
@@ -537,6 +548,11 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
537
548
  readonly error?: unknown;
538
549
  readonly arguments?: string | undefined;
539
550
  readonly server_label?: string | undefined;
551
+ } | {
552
+ readonly type: "configuration_update";
553
+ readonly reasoning: {
554
+ readonly effort: OpenResponsesOptions.ReasoningEffort;
555
+ };
540
556
  } | {
541
557
  readonly type: "reasoning";
542
558
  readonly summary: readonly {
@@ -648,7 +664,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
648
664
  readonly instructions?: string | undefined;
649
665
  readonly reasoning?: {
650
666
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
651
- readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
667
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
652
668
  } | undefined;
653
669
  readonly tools?: readonly ({
654
670
  readonly type: "function";
@@ -683,10 +699,10 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
683
699
  }[];
684
700
  })[] | undefined;
685
701
  readonly text?: {
686
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
702
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
687
703
  } | undefined;
688
704
  readonly temperature?: number | undefined;
689
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
705
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
690
706
  readonly context_management?: readonly {
691
707
  readonly type: "compaction";
692
708
  readonly compact_threshold?: number | undefined;
@@ -710,7 +726,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
710
726
  readonly prompt_cache_key?: string | undefined;
711
727
  readonly parallel_tool_calls?: boolean | undefined;
712
728
  readonly store?: boolean | undefined;
713
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
729
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
714
730
  readonly truncation?: "auto" | "disabled" | undefined;
715
731
  readonly stream_options?: {
716
732
  readonly include_obfuscation?: boolean | undefined;
@@ -758,6 +774,11 @@ export declare const channelTransport: (options: import("./open-responses-channe
758
774
  readonly error?: unknown;
759
775
  readonly arguments?: string | undefined;
760
776
  readonly server_label?: string | undefined;
777
+ } | {
778
+ readonly type: "configuration_update";
779
+ readonly reasoning: {
780
+ readonly effort: OpenResponsesOptions.ReasoningEffort;
781
+ };
761
782
  } | {
762
783
  readonly type: "reasoning";
763
784
  readonly summary: readonly {
@@ -869,7 +890,7 @@ export declare const channelTransport: (options: import("./open-responses-channe
869
890
  readonly instructions?: string | undefined;
870
891
  readonly reasoning?: {
871
892
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
872
- readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
893
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
873
894
  } | undefined;
874
895
  readonly tools?: readonly ({
875
896
  readonly type: "function";
@@ -904,10 +925,10 @@ export declare const channelTransport: (options: import("./open-responses-channe
904
925
  }[];
905
926
  })[] | undefined;
906
927
  readonly text?: {
907
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
928
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
908
929
  } | undefined;
909
930
  readonly temperature?: number | undefined;
910
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
931
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
911
932
  readonly context_management?: readonly {
912
933
  readonly type: "compaction";
913
934
  readonly compact_threshold?: number | undefined;
@@ -931,7 +952,7 @@ export declare const channelTransport: (options: import("./open-responses-channe
931
952
  readonly prompt_cache_key?: string | undefined;
932
953
  readonly parallel_tool_calls?: boolean | undefined;
933
954
  readonly store?: boolean | undefined;
934
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
955
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
935
956
  readonly truncation?: "auto" | "disabled" | undefined;
936
957
  readonly stream_options?: {
937
958
  readonly include_obfuscation?: boolean | undefined;
@@ -979,6 +1000,11 @@ export declare const transport: import("../route/transport/index.js").Transport<
979
1000
  readonly error?: unknown;
980
1001
  readonly arguments?: string | undefined;
981
1002
  readonly server_label?: string | undefined;
1003
+ } | {
1004
+ readonly type: "configuration_update";
1005
+ readonly reasoning: {
1006
+ readonly effort: OpenResponsesOptions.ReasoningEffort;
1007
+ };
982
1008
  } | {
983
1009
  readonly type: "reasoning";
984
1010
  readonly summary: readonly {
@@ -1090,7 +1116,7 @@ export declare const transport: import("../route/transport/index.js").Transport<
1090
1116
  readonly instructions?: string | undefined;
1091
1117
  readonly reasoning?: {
1092
1118
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
1093
- readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
1119
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1094
1120
  } | undefined;
1095
1121
  readonly tools?: readonly ({
1096
1122
  readonly type: "function";
@@ -1125,10 +1151,10 @@ export declare const transport: import("../route/transport/index.js").Transport<
1125
1151
  }[];
1126
1152
  })[] | undefined;
1127
1153
  readonly text?: {
1128
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
1154
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
1129
1155
  } | undefined;
1130
1156
  readonly temperature?: number | undefined;
1131
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
1157
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
1132
1158
  readonly context_management?: readonly {
1133
1159
  readonly type: "compaction";
1134
1160
  readonly compact_threshold?: number | undefined;
@@ -1152,7 +1178,7 @@ export declare const transport: import("../route/transport/index.js").Transport<
1152
1178
  readonly prompt_cache_key?: string | undefined;
1153
1179
  readonly parallel_tool_calls?: boolean | undefined;
1154
1180
  readonly store?: boolean | undefined;
1155
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
1181
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
1156
1182
  readonly truncation?: "auto" | "disabled" | undefined;
1157
1183
  readonly stream_options?: {
1158
1184
  readonly include_obfuscation?: boolean | undefined;
@@ -1200,6 +1226,11 @@ export declare const route: Route<{
1200
1226
  readonly error?: unknown;
1201
1227
  readonly arguments?: string | undefined;
1202
1228
  readonly server_label?: string | undefined;
1229
+ } | {
1230
+ readonly type: "configuration_update";
1231
+ readonly reasoning: {
1232
+ readonly effort: OpenResponsesOptions.ReasoningEffort;
1233
+ };
1203
1234
  } | {
1204
1235
  readonly type: "reasoning";
1205
1236
  readonly summary: readonly {
@@ -1311,7 +1342,7 @@ export declare const route: Route<{
1311
1342
  readonly instructions?: string | undefined;
1312
1343
  readonly reasoning?: {
1313
1344
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
1314
- readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
1345
+ readonly effort?: OpenResponsesOptions.ReasoningEffort | undefined;
1315
1346
  } | undefined;
1316
1347
  readonly tools?: readonly ({
1317
1348
  readonly type: "function";
@@ -1346,10 +1377,10 @@ export declare const route: Route<{
1346
1377
  }[];
1347
1378
  })[] | undefined;
1348
1379
  readonly text?: {
1349
- readonly verbosity?: import("./utils/open-responses-options.js").TextVerbosity | undefined;
1380
+ readonly verbosity?: OpenResponsesOptions.TextVerbosity | undefined;
1350
1381
  } | undefined;
1351
1382
  readonly temperature?: number | undefined;
1352
- readonly service_tier?: import("./utils/open-responses-options.js").ServiceTier | undefined;
1383
+ readonly service_tier?: OpenResponsesOptions.ServiceTier | undefined;
1353
1384
  readonly context_management?: readonly {
1354
1385
  readonly type: "compaction";
1355
1386
  readonly compact_threshold?: number | undefined;
@@ -1373,7 +1404,7 @@ export declare const route: Route<{
1373
1404
  readonly prompt_cache_key?: string | undefined;
1374
1405
  readonly parallel_tool_calls?: boolean | undefined;
1375
1406
  readonly store?: boolean | undefined;
1376
- readonly include?: readonly import("./utils/open-responses-options.js").ResponseIncludable[] | undefined;
1407
+ readonly include?: readonly OpenResponsesOptions.ResponseIncludable[] | undefined;
1377
1408
  readonly truncation?: "auto" | "disabled" | undefined;
1378
1409
  readonly stream_options?: {
1379
1410
  readonly include_obfuscation?: boolean | undefined;
@@ -6,7 +6,9 @@ import { Endpoint } from "../route/endpoint.js";
6
6
  import { Protocol } from "../route/protocol.js";
7
7
  import { HttpTransport } from "../route/transport/index.js";
8
8
  import { LLMRequest, mergeJsonRecords } from "../schema/index.js";
9
+ import { resolveEffortUpdates } from "../effort-updates.js";
9
10
  import { OpenResponses } from "./open-responses.js";
11
+ import { OpenResponsesOptions } from "./utils/open-responses-options.js";
10
12
  import { JsonObject, optionalArray, optionalNull, ProviderShared } from "./shared.js";
11
13
  import { OpenAIImage } from "./utils/openai-image.js";
12
14
  import { ResponsesHostedTools } from "./utils/responses-hosted-tools.js";
@@ -74,9 +76,14 @@ const OpenAIResponsesToolChoice = Schema.Union([
74
76
  OpenResponses.ToolChoice,
75
77
  Schema.Struct({ type: Schema.tag("image_generation") }),
76
78
  ]);
79
+ const OpenAIResponsesInputItem = Schema.Union([
80
+ OpenResponses.InputItem,
81
+ OpenAIResponsesHostedToolItem,
82
+ OpenResponses.ConfigurationUpdate,
83
+ ]);
77
84
  const OpenAIResponsesCoreFields = {
78
85
  ...OpenResponses.coreFields,
79
- input: Schema.Array(Schema.Union([OpenResponses.InputItem, OpenAIResponsesHostedToolItem])),
86
+ input: Schema.Array(OpenAIResponsesInputItem),
80
87
  tools: optionalArray(OpenAIResponsesTools),
81
88
  tool_choice: Schema.optional(OpenAIResponsesToolChoice),
82
89
  context_management: Schema.optional(Schema.Array(Schema.Struct({
@@ -92,7 +99,7 @@ const OpenAIResponsesBody = Schema.Struct({
92
99
  export const CompactionTrigger = Schema.Struct({ type: Schema.Literal("compaction_trigger") });
93
100
  const CheckpointBody = Schema.Struct({
94
101
  ...OpenAIResponsesBody.fields,
95
- input: Schema.Array(Schema.Union([OpenResponses.InputItem, OpenAIResponsesHostedToolItem, CompactionTrigger])),
102
+ input: Schema.Array(Schema.Union([OpenAIResponsesInputItem, CompactionTrigger])),
96
103
  store: Schema.Literal(false),
97
104
  prompt_cache_retention: optionalNull(Schema.String),
98
105
  prompt_cache_options: optionalNull(Schema.Struct({ mode: Schema.optional(Schema.String), ttl: Schema.optional(Schema.String) })),
@@ -102,6 +109,15 @@ const adapter = {
102
109
  name: NAME,
103
110
  restoreHostedToolItem: (item) => (Schema.is(OpenAIResponsesHostedToolItem)(item) ? item : undefined),
104
111
  };
112
+ // Only GPT-6 Astra accepts `configuration_update`, and never alongside automatic `context_management` compaction.
113
+ const supportsEffortUpdates = (request) => {
114
+ if (request.providerOptions?.contextManagement !== undefined)
115
+ return false;
116
+ const override = request.model.compatibility?.supportsEffortUpdates;
117
+ if (override !== undefined)
118
+ return override;
119
+ return /(?:^|\/)gpt-6-astra$/i.test(request.model.id);
120
+ };
105
121
  const nativeImageToolInput = (tool) => {
106
122
  const native = tool.native?.openai;
107
123
  return ProviderShared.isRecord(native) && native.type === "image_generation" ? native : undefined;
@@ -144,10 +160,12 @@ const lowerToolChoice = (toolChoice, tools) => ProviderShared.matchToolChoice(NA
144
160
  const decodeBody = ProviderShared.validateWith(Schema.decodeUnknownEffect(OpenAIResponsesBody));
145
161
  const fromRequest = Effect.fn("OpenAIResponses.fromRequest")(function* (request) {
146
162
  const management = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Schema.UndefinedOr(ContextManagement)))(request.providerOptions?.contextManagement);
163
+ const options = OpenResponsesOptions.resolve(request);
164
+ const updates = resolveEffortUpdates(request, options.reasoningEffort);
147
165
  const toolSchemaCompatibility = request.model.compatibility?.toolSchema;
148
166
  return yield* decodeBody({
149
- ...(yield* OpenResponses.lowerConversation(request, adapter)),
150
- ...OpenResponses.lowerGeneration(request),
167
+ ...(yield* OpenResponses.lowerConversation(updates.request, adapter)),
168
+ ...OpenResponses.lowerGeneration(request, { ...options, reasoningEffort: updates.effort }),
151
169
  context_management: management?.map((edit) => ({ type: edit.type, compact_threshold: edit.compactThreshold })),
152
170
  tools: request.tools.length === 0
153
171
  ? undefined
@@ -237,6 +255,7 @@ export const protocol = Protocol.make({
237
255
  step,
238
256
  terminal: OpenResponses.terminal,
239
257
  },
258
+ supportsEffortUpdates,
240
259
  });
241
260
  const endpoint = Endpoint.path(PATH, { baseURL: DEFAULT_BASE_URL });
242
261
  const auth = Auth.none;
@@ -1,8 +1,6 @@
1
1
  import { Schema } from "effect";
2
- import type { LLMRequest } from "../../schema/index.js";
3
- export declare const ReasoningEfforts: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
4
- export type ReasoningEffort = (typeof ReasoningEfforts)[number] | (string & {});
5
- export declare const ReasoningEffort: Schema.declare<ReasoningEffort, ReasoningEffort>;
2
+ import { ReasoningEffort, ReasoningEfforts, type LLMRequest } from "../../schema/index.js";
3
+ export { ReasoningEffort, ReasoningEfforts };
6
4
  export declare const TextVerbosities: readonly ["low", "medium", "high"];
7
5
  export type TextVerbosity = (typeof TextVerbosities)[number] | (string & {});
8
6
  export declare const TextVerbosity: Schema.declare<TextVerbosity, TextVerbosity>;
@@ -1,6 +1,6 @@
1
1
  import { Option, Schema } from "effect";
2
- export const ReasoningEfforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
3
- export const ReasoningEffort = Schema.declare((value) => typeof value === "string", { title: "ReasoningEffort" });
2
+ import { ReasoningEffort, ReasoningEfforts } from "../../schema/index.js";
3
+ export { ReasoningEffort, ReasoningEfforts };
4
4
  export const TextVerbosities = ["low", "medium", "high"];
5
5
  export const TextVerbosity = Schema.declare((value) => typeof value === "string", { title: "TextVerbosity" });
6
6
  export const ResponseIncludables = [
@@ -1,5 +1,6 @@
1
1
  import { Effect, Schema, Stream } from "effect";
2
2
  import { AIError, InvalidProviderOutputError, CompactionPart, CompactionResponse, HttpOptions, LLMRequest, Message, mergeJsonRecords, } from "../../schema/index.js";
3
+ import { stripEffortUpdates } from "../../effort-updates.js";
3
4
  import { Endpoint } from "../../route/endpoint.js";
4
5
  import { RequestExecutor } from "../../route/executor.js";
5
6
  import { HttpTransport } from "../../route/transport/index.js";
@@ -54,7 +55,8 @@ const Response = Schema.Struct({
54
55
  });
55
56
  export const make = (adapter) => Effect.fn("ResponsesCompaction.execute")(function* (request, executor, options) {
56
57
  const route = request.model.route;
57
- const native = yield* OpenResponses.lowerConversation(request, adapter);
58
+ // The standalone compaction endpoint rejects histories containing configuration updates.
59
+ const native = yield* OpenResponses.lowerConversation(stripEffortUpdates(request), adapter);
58
60
  const body = yield* ProviderShared.validateWith(Schema.decodeUnknownEffect(Body))(mergeJsonRecords({
59
61
  ...native,
60
62
  service_tier: request.providerOptions?.serviceTier,
@@ -136,7 +136,7 @@ export declare const protocol: Protocol<{
136
136
  readonly instructions?: string | undefined;
137
137
  readonly reasoning?: {
138
138
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
139
- readonly effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
139
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
140
140
  } | undefined;
141
141
  readonly tools?: readonly {
142
142
  readonly type: "function";
@@ -120,7 +120,7 @@ export declare const protocol: Protocol<{
120
120
  readonly frequency_penalty?: number | undefined;
121
121
  readonly presence_penalty?: number | undefined;
122
122
  readonly prompt_cache_key?: string | undefined;
123
- readonly reasoning_effort?: import("./utils/open-responses-options.js").ReasoningEffort | undefined;
123
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
124
124
  readonly store?: boolean | undefined;
125
125
  readonly stream_options?: {
126
126
  readonly include_usage: boolean;
@@ -182,7 +182,6 @@ export declare const protocol: Protocol<{
182
182
  readonly content: string | null;
183
183
  })[];
184
184
  } | {
185
- readonly role: "system";
186
185
  readonly content: readonly {
187
186
  readonly type: "text";
188
187
  readonly text: string;
@@ -191,6 +190,10 @@ export declare const protocol: Protocol<{
191
190
  readonly ttl?: "1h" | "5m" | undefined;
192
191
  } | undefined;
193
192
  }[];
193
+ readonly role: "system";
194
+ readonly output_config?: {
195
+ readonly effort: string;
196
+ } | undefined;
194
197
  })[];
195
198
  readonly stream: true;
196
199
  readonly metadata?: {
@@ -120,7 +120,7 @@ export declare const routes: (Route<{
120
120
  readonly presence_penalty?: number | undefined;
121
121
  readonly prompt_cache_key?: string | undefined;
122
122
  readonly parallel_tool_calls?: boolean | undefined;
123
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
123
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
124
124
  readonly store?: boolean | undefined;
125
125
  readonly stream_options?: {
126
126
  readonly include_usage: boolean;
@@ -319,7 +319,6 @@ export declare const routes: (Route<{
319
319
  readonly content: string | null;
320
320
  })[];
321
321
  } | {
322
- readonly role: "system";
323
322
  readonly content: readonly {
324
323
  readonly type: "text";
325
324
  readonly text: string;
@@ -328,6 +327,10 @@ export declare const routes: (Route<{
328
327
  readonly ttl?: "1h" | "5m" | undefined;
329
328
  } | undefined;
330
329
  }[];
330
+ readonly role: "system";
331
+ readonly output_config?: {
332
+ readonly effort: string;
333
+ } | undefined;
331
334
  })[];
332
335
  readonly stream: true;
333
336
  readonly metadata?: {
@@ -527,7 +530,7 @@ export declare const routes: (Route<{
527
530
  readonly instructions?: string | undefined;
528
531
  readonly reasoning?: {
529
532
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
530
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
533
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
531
534
  } | undefined;
532
535
  readonly tools?: readonly ({
533
536
  readonly type: "function";
@@ -583,7 +586,7 @@ export declare const configure: (input: Config) => {
583
586
  } | undefined;
584
587
  readonly thinkingBudget?: number | undefined;
585
588
  readonly parallelToolCalls?: boolean | undefined;
586
- readonly reasoningEffort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
589
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
587
590
  readonly enableThinking?: boolean | undefined;
588
591
  readonly preserveThinking?: boolean | undefined;
589
592
  readonly clearThinking?: boolean | undefined;
@@ -608,7 +611,7 @@ export declare const configure: (input: Config) => {
608
611
  } | undefined;
609
612
  readonly thinkingBudget?: number | undefined;
610
613
  readonly parallelToolCalls?: boolean | undefined;
611
- readonly reasoningEffort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
614
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
612
615
  readonly enableThinking?: boolean | undefined;
613
616
  readonly preserveThinking?: boolean | undefined;
614
617
  readonly clearThinking?: boolean | undefined;
@@ -629,7 +632,7 @@ export declare const configure: (input: Config) => {
629
632
  }, import("../route/client.js").CompactionOperations | undefined>;
630
633
  messages: (id: string | ModelID) => import("../schema/options.js").LanguageModel<AlibabaMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
631
634
  responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
632
- readonly reasoningEffort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
635
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
633
636
  readonly store?: boolean | undefined;
634
637
  readonly conversation?: string | undefined;
635
638
  readonly enableThinking?: boolean | undefined;
@@ -647,7 +650,7 @@ export declare const provider: {
647
650
  } | undefined;
648
651
  readonly thinkingBudget?: number | undefined;
649
652
  readonly parallelToolCalls?: boolean | undefined;
650
- readonly reasoningEffort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
653
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
651
654
  readonly enableThinking?: boolean | undefined;
652
655
  readonly preserveThinking?: boolean | undefined;
653
656
  readonly clearThinking?: boolean | undefined;
@@ -672,7 +675,7 @@ export declare const provider: {
672
675
  } | undefined;
673
676
  readonly thinkingBudget?: number | undefined;
674
677
  readonly parallelToolCalls?: boolean | undefined;
675
- readonly reasoningEffort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
678
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
676
679
  readonly enableThinking?: boolean | undefined;
677
680
  readonly preserveThinking?: boolean | undefined;
678
681
  readonly clearThinking?: boolean | undefined;
@@ -693,7 +696,7 @@ export declare const provider: {
693
696
  }, import("../route/client.js").CompactionOperations | undefined>;
694
697
  messages: (id: string | ModelID) => import("../schema/options.js").LanguageModel<AlibabaMessages.OptionsInput, import("../route/client.js").CompactionOperations | undefined>;
695
698
  responses: (id: string | ModelID) => import("../schema/options.js").LanguageModel<{
696
- readonly reasoningEffort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
699
+ readonly reasoningEffort?: import("../schema/options.js").ReasoningEffort | undefined;
697
700
  readonly store?: boolean | undefined;
698
701
  readonly conversation?: string | undefined;
699
702
  readonly enableThinking?: boolean | undefined;
@@ -118,7 +118,7 @@ export declare const routes: (Route<{
118
118
  readonly frequency_penalty?: number | undefined;
119
119
  readonly presence_penalty?: number | undefined;
120
120
  readonly prompt_cache_key?: string | undefined;
121
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
121
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
122
122
  readonly store?: boolean | undefined;
123
123
  readonly stream_options?: {
124
124
  readonly include_usage: boolean;
@@ -245,7 +245,7 @@ export declare const routes: (Route<{
245
245
  readonly instructions?: string | undefined;
246
246
  readonly reasoning?: {
247
247
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
248
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
248
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
249
249
  } | undefined;
250
250
  readonly tools?: readonly {
251
251
  readonly type: "function";
@@ -198,7 +198,6 @@ export declare const routes: import("../route/client.js").Route<{
198
198
  readonly content: string | null;
199
199
  })[];
200
200
  } | {
201
- readonly role: "system";
202
201
  readonly content: readonly {
203
202
  readonly type: "text";
204
203
  readonly text: string;
@@ -207,6 +206,10 @@ export declare const routes: import("../route/client.js").Route<{
207
206
  readonly ttl?: "1h" | "5m" | undefined;
208
207
  } | undefined;
209
208
  }[];
209
+ readonly role: "system";
210
+ readonly output_config?: {
211
+ readonly effort: string;
212
+ } | undefined;
210
213
  })[];
211
214
  readonly stream: true;
212
215
  readonly metadata?: {
@@ -183,7 +183,6 @@ export declare const routes: import("../route/client.js").Route<{
183
183
  readonly content: string | null;
184
184
  })[];
185
185
  } | {
186
- readonly role: "system";
187
186
  readonly content: readonly {
188
187
  readonly type: "text";
189
188
  readonly text: string;
@@ -192,6 +191,10 @@ export declare const routes: import("../route/client.js").Route<{
192
191
  readonly ttl?: "1h" | "5m" | undefined;
193
192
  } | undefined;
194
193
  }[];
194
+ readonly role: "system";
195
+ readonly output_config?: {
196
+ readonly effort: string;
197
+ } | undefined;
195
198
  })[];
196
199
  readonly stream: true;
197
200
  readonly metadata?: {
@@ -59,6 +59,11 @@ declare const responsesRoute: Route<{
59
59
  readonly error?: unknown;
60
60
  readonly arguments?: string | undefined;
61
61
  readonly server_label?: string | undefined;
62
+ } | {
63
+ readonly type: "configuration_update";
64
+ readonly reasoning: {
65
+ readonly effort: import("../schema/options.js").ReasoningEffort;
66
+ };
62
67
  } | {
63
68
  readonly type: "reasoning";
64
69
  readonly summary: readonly {
@@ -170,7 +175,7 @@ declare const responsesRoute: Route<{
170
175
  readonly instructions?: string | undefined;
171
176
  readonly reasoning?: {
172
177
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
173
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
178
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
174
179
  } | undefined;
175
180
  readonly tools?: readonly ({
176
181
  readonly type: "function";
@@ -336,7 +341,7 @@ export declare const routes: (Route<{
336
341
  readonly frequency_penalty?: number | undefined;
337
342
  readonly presence_penalty?: number | undefined;
338
343
  readonly prompt_cache_key?: string | undefined;
339
- readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
344
+ readonly reasoning_effort?: import("../schema/options.js").ReasoningEffort | undefined;
340
345
  readonly store?: boolean | undefined;
341
346
  readonly stream_options?: {
342
347
  readonly include_usage: boolean;
@@ -380,6 +385,11 @@ export declare const routes: (Route<{
380
385
  readonly error?: unknown;
381
386
  readonly arguments?: string | undefined;
382
387
  readonly server_label?: string | undefined;
388
+ } | {
389
+ readonly type: "configuration_update";
390
+ readonly reasoning: {
391
+ readonly effort: import("../schema/options.js").ReasoningEffort;
392
+ };
383
393
  } | {
384
394
  readonly type: "reasoning";
385
395
  readonly summary: readonly {
@@ -491,7 +501,7 @@ export declare const routes: (Route<{
491
501
  readonly instructions?: string | undefined;
492
502
  readonly reasoning?: {
493
503
  readonly summary?: "auto" | "concise" | "detailed" | undefined;
494
- readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
504
+ readonly effort?: import("../schema/options.js").ReasoningEffort | undefined;
495
505
  } | undefined;
496
506
  readonly tools?: readonly ({
497
507
  readonly type: "function";
@@ -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;
@@ -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;