@opencode-ai/ai 0.0.0-beta-17577 → 0.0.0-beta-17639
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/dist/protocols/anthropic-messages.js +24 -9
- package/dist/protocols/open-responses.d.ts +24 -0
- package/dist/protocols/open-responses.js +7 -9
- package/dist/protocols/openai-compatible-responses.d.ts +4 -0
- package/dist/protocols/openai-responses.d.ts +20 -0
- package/dist/protocols/utils/open-responses-options.d.ts +4 -0
- package/dist/protocols/utils/open-responses-options.js +5 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +4 -0
- package/dist/providers/azure.d.ts +4 -0
- package/dist/providers/google-vertex-responses.d.ts +4 -0
- package/dist/providers/open-responses-options.d.ts +2 -1
- package/dist/providers/openai-compatible-responses.d.ts +4 -0
- package/dist/providers/openai.d.ts +4 -0
- package/dist/providers/xai.d.ts +4 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +7 -2
- package/package.json +3 -3
|
@@ -329,10 +329,20 @@ const lowerToolResultContent = Effect.fnUntraced(function* (part) {
|
|
|
329
329
|
const content = part.result.value;
|
|
330
330
|
return yield* Effect.forEach(content, lowerToolResultContentItem);
|
|
331
331
|
});
|
|
332
|
-
// Mid-conversation system messages
|
|
333
|
-
//
|
|
334
|
-
//
|
|
335
|
-
const supportsNativeSystemUpdates = (request) =>
|
|
332
|
+
// Mid-conversation system messages became available with Opus 4.8 and version
|
|
333
|
+
// 5 of the other supported Claude families. Treat later family versions as
|
|
334
|
+
// compatible without assuming that every Anthropic Messages model is Claude.
|
|
335
|
+
const supportsNativeSystemUpdates = (request) => {
|
|
336
|
+
const match = /(?:^|[./])claude-(fable|haiku|mythos|opus|sonnet)-(\d+)(?:[.-](\d+))?/.exec(String(request.model.id).toLowerCase());
|
|
337
|
+
if (!match)
|
|
338
|
+
return false;
|
|
339
|
+
const major = Number(match[2]);
|
|
340
|
+
if (match[1] !== "opus")
|
|
341
|
+
return major >= 5;
|
|
342
|
+
if (major !== 4)
|
|
343
|
+
return major >= 5;
|
|
344
|
+
return match[3] !== undefined && match[3].length <= 2 && Number(match[3]) >= 8;
|
|
345
|
+
};
|
|
336
346
|
const endsInServerToolUse = (message) => {
|
|
337
347
|
const last = message.content.at(-1);
|
|
338
348
|
return message.role === "assistant" && last?.type === "tool-call" && last.providerExecuted === true;
|
|
@@ -737,6 +747,8 @@ const onContentBlockDelta = Effect.fn("AnthropicMessages.onContentBlockDelta")(f
|
|
|
737
747
|
if (delta?.type === "input_json_delta" && event.index !== undefined) {
|
|
738
748
|
if (!delta.partial_json)
|
|
739
749
|
return [state, NO_EVENTS];
|
|
750
|
+
if (!state.tools[event.index])
|
|
751
|
+
return [state, NO_EVENTS];
|
|
740
752
|
const result = ToolStream.appendExisting(ADAPTER, state.tools, event.index, delta.partial_json, "Anthropic Messages tool argument delta is missing its tool call");
|
|
741
753
|
if (ToolStream.isError(result))
|
|
742
754
|
return yield* result;
|
|
@@ -781,9 +793,12 @@ const onMessageDelta = (state, event) => {
|
|
|
781
793
|
NO_EVENTS,
|
|
782
794
|
];
|
|
783
795
|
};
|
|
784
|
-
const onMessageStop = (state)
|
|
796
|
+
const onMessageStop = Effect.fn("AnthropicMessages.onMessageStop")(function* (state) {
|
|
797
|
+
const result = yield* ToolStream.finishAll(ADAPTER, state.tools);
|
|
785
798
|
const events = [];
|
|
786
|
-
const lifecycle = Lifecycle.
|
|
799
|
+
const lifecycle = result.events.length ? Lifecycle.stepStart(state.lifecycle, events) : state.lifecycle;
|
|
800
|
+
events.push(...result.events);
|
|
801
|
+
const finished = Lifecycle.finish(lifecycle, events, {
|
|
787
802
|
reason: state.pendingFinish?.reason ?? {
|
|
788
803
|
normalized: "unknown",
|
|
789
804
|
raw: undefined,
|
|
@@ -791,8 +806,8 @@ const onMessageStop = (state) => {
|
|
|
791
806
|
usage: state.usage,
|
|
792
807
|
providerMetadata: state.pendingFinish?.providerMetadata,
|
|
793
808
|
});
|
|
794
|
-
return [{ ...state, lifecycle }, events];
|
|
795
|
-
};
|
|
809
|
+
return [{ ...state, lifecycle: finished, tools: result.tools }, events];
|
|
810
|
+
});
|
|
796
811
|
// Prefix `error.type` so overloads, rate limits, and quota errors are visible
|
|
797
812
|
// even when the provider message is generic or empty.
|
|
798
813
|
const providerErrorMessage = (event) => {
|
|
@@ -819,7 +834,7 @@ const step = (state, event) => {
|
|
|
819
834
|
if (event.type === "message_delta")
|
|
820
835
|
return Effect.succeed(onMessageDelta(state, event));
|
|
821
836
|
if (event.type === "message_stop")
|
|
822
|
-
return
|
|
837
|
+
return onMessageStop(state);
|
|
823
838
|
if (event.type === "error")
|
|
824
839
|
return onError(event);
|
|
825
840
|
return Effect.succeed([state, NO_EVENTS]);
|
|
@@ -21,6 +21,9 @@ type MessagePhase = Schema.Schema.Type<typeof MessagePhase>;
|
|
|
21
21
|
export declare const InputItem: Schema.Union<readonly [Schema.Struct<{
|
|
22
22
|
readonly role: Schema.tag<"system">;
|
|
23
23
|
readonly content: Schema.String;
|
|
24
|
+
}>, Schema.Struct<{
|
|
25
|
+
readonly role: Schema.tag<"developer">;
|
|
26
|
+
readonly content: Schema.String;
|
|
24
27
|
}>, Schema.Struct<{
|
|
25
28
|
readonly role: Schema.tag<"user">;
|
|
26
29
|
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -99,6 +102,9 @@ export declare const coreFields: {
|
|
|
99
102
|
input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
100
103
|
readonly role: Schema.tag<"system">;
|
|
101
104
|
readonly content: Schema.String;
|
|
105
|
+
}>, Schema.Struct<{
|
|
106
|
+
readonly role: Schema.tag<"developer">;
|
|
107
|
+
readonly content: Schema.String;
|
|
102
108
|
}>, Schema.Struct<{
|
|
103
109
|
readonly role: Schema.tag<"user">;
|
|
104
110
|
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -165,6 +171,7 @@ export declare const coreFields: {
|
|
|
165
171
|
readonly name: Schema.String;
|
|
166
172
|
}>]>>;
|
|
167
173
|
store: Schema.optional<Schema.Boolean>;
|
|
174
|
+
truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
|
|
168
175
|
service_tier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
|
|
169
176
|
prompt_cache_key: Schema.optional<Schema.String>;
|
|
170
177
|
include: Schema.optional<Schema.$Array<Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>>>;
|
|
@@ -185,6 +192,9 @@ declare const OpenResponsesBody: Schema.Struct<{
|
|
|
185
192
|
readonly input: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
186
193
|
readonly role: Schema.tag<"system">;
|
|
187
194
|
readonly content: Schema.String;
|
|
195
|
+
}>, Schema.Struct<{
|
|
196
|
+
readonly role: Schema.tag<"developer">;
|
|
197
|
+
readonly content: Schema.String;
|
|
188
198
|
}>, Schema.Struct<{
|
|
189
199
|
readonly role: Schema.tag<"user">;
|
|
190
200
|
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -251,6 +261,7 @@ declare const OpenResponsesBody: Schema.Struct<{
|
|
|
251
261
|
readonly name: Schema.String;
|
|
252
262
|
}>]>>;
|
|
253
263
|
readonly store: Schema.optional<Schema.Boolean>;
|
|
264
|
+
readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
|
|
254
265
|
readonly service_tier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
|
|
255
266
|
readonly prompt_cache_key: Schema.optional<Schema.String>;
|
|
256
267
|
readonly include: Schema.optional<Schema.$Array<Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>>>;
|
|
@@ -405,6 +416,7 @@ export declare const lowerToolChoice: (protocolName: string, toolChoice: NonNull
|
|
|
405
416
|
name: string;
|
|
406
417
|
}, AIError, never>;
|
|
407
418
|
export declare const fromRequestWithExtension: (request: LLMRequest, extension: Extension) => Effect.Effect<{
|
|
419
|
+
truncation?: "auto" | "disabled" | undefined;
|
|
408
420
|
service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
409
421
|
text?: {
|
|
410
422
|
verbosity: "low" | "medium" | "high";
|
|
@@ -452,6 +464,9 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
|
|
|
452
464
|
} | {
|
|
453
465
|
readonly role: "system";
|
|
454
466
|
readonly content: string;
|
|
467
|
+
} | {
|
|
468
|
+
readonly role: "developer";
|
|
469
|
+
readonly content: string;
|
|
455
470
|
} | {
|
|
456
471
|
readonly role: "user";
|
|
457
472
|
readonly content: readonly ({
|
|
@@ -521,6 +536,7 @@ export declare const fromRequest: (request: LLMRequest) => Effect.Effect<{
|
|
|
521
536
|
readonly top_p?: number | undefined;
|
|
522
537
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
523
538
|
readonly store?: boolean | undefined;
|
|
539
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
524
540
|
readonly prompt_cache_key?: string | undefined;
|
|
525
541
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
526
542
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -733,6 +749,9 @@ export declare const protocol: Protocol<{
|
|
|
733
749
|
} | {
|
|
734
750
|
readonly role: "system";
|
|
735
751
|
readonly content: string;
|
|
752
|
+
} | {
|
|
753
|
+
readonly role: "developer";
|
|
754
|
+
readonly content: string;
|
|
736
755
|
} | {
|
|
737
756
|
readonly role: "user";
|
|
738
757
|
readonly content: readonly ({
|
|
@@ -802,6 +821,7 @@ export declare const protocol: Protocol<{
|
|
|
802
821
|
readonly top_p?: number | undefined;
|
|
803
822
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
804
823
|
readonly store?: boolean | undefined;
|
|
824
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
805
825
|
readonly prompt_cache_key?: string | undefined;
|
|
806
826
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
807
827
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -875,6 +895,9 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
875
895
|
} | {
|
|
876
896
|
readonly role: "system";
|
|
877
897
|
readonly content: string;
|
|
898
|
+
} | {
|
|
899
|
+
readonly role: "developer";
|
|
900
|
+
readonly content: string;
|
|
878
901
|
} | {
|
|
879
902
|
readonly role: "user";
|
|
880
903
|
readonly content: readonly ({
|
|
@@ -944,6 +967,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
944
967
|
readonly top_p?: number | undefined;
|
|
945
968
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
946
969
|
readonly store?: boolean | undefined;
|
|
970
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
947
971
|
readonly prompt_cache_key?: string | undefined;
|
|
948
972
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
949
973
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -63,6 +63,7 @@ const OpenResponsesFunctionCallOutput = Schema.Union([
|
|
|
63
63
|
]);
|
|
64
64
|
export const InputItem = Schema.Union([
|
|
65
65
|
Schema.Struct({ role: Schema.tag("system"), content: Schema.String }),
|
|
66
|
+
Schema.Struct({ role: Schema.tag("developer"), content: Schema.String }),
|
|
66
67
|
Schema.Struct({ role: Schema.tag("user"), content: Schema.Array(OpenResponsesInputContent) }),
|
|
67
68
|
Schema.Struct({
|
|
68
69
|
role: Schema.tag("assistant"),
|
|
@@ -105,6 +106,7 @@ export const coreFields = {
|
|
|
105
106
|
tools: optionalArray(Tool),
|
|
106
107
|
tool_choice: Schema.optional(ToolChoice),
|
|
107
108
|
store: Schema.optional(Schema.Boolean),
|
|
109
|
+
truncation: Schema.optional(OpenResponsesOptions.TruncationSchema),
|
|
108
110
|
service_tier: Schema.optional(OpenResponsesOptions.ServiceTierSchema),
|
|
109
111
|
prompt_cache_key: Schema.optional(Schema.String),
|
|
110
112
|
include: optionalArray(OpenResponsesOptions.ResponseIncludableSchema),
|
|
@@ -285,15 +287,10 @@ const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (reques
|
|
|
285
287
|
const providerMetadataKey = request.model.route.providerMetadataKey ?? "openresponses";
|
|
286
288
|
for (const message of request.messages) {
|
|
287
289
|
if (message.role === "system") {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
role: "user",
|
|
293
|
-
content: [...previous.content, { type: "input_text", text: part.text }],
|
|
294
|
-
};
|
|
295
|
-
else
|
|
296
|
-
input.push({ role: "user", content: [{ type: "input_text", text: part.text }] });
|
|
290
|
+
input.push({
|
|
291
|
+
role: "developer",
|
|
292
|
+
content: ProviderShared.joinText(yield* ProviderShared.systemUpdateText(extension.name, message)),
|
|
293
|
+
});
|
|
297
294
|
continue;
|
|
298
295
|
}
|
|
299
296
|
if (message.role === "user") {
|
|
@@ -422,6 +419,7 @@ const lowerOptions = (request) => {
|
|
|
422
419
|
: {}),
|
|
423
420
|
...(options.textVerbosity ? { text: { verbosity: options.textVerbosity } } : {}),
|
|
424
421
|
...(options.serviceTier ? { service_tier: options.serviceTier } : {}),
|
|
422
|
+
...(options.truncation ? { truncation: options.truncation } : {}),
|
|
425
423
|
};
|
|
426
424
|
};
|
|
427
425
|
export const fromRequestWithExtension = Effect.fn("OpenResponses.fromRequestWithExtension")(function* (request, extension) {
|
|
@@ -20,6 +20,9 @@ export declare const route: Route<{
|
|
|
20
20
|
} | {
|
|
21
21
|
readonly role: "system";
|
|
22
22
|
readonly content: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly role: "developer";
|
|
25
|
+
readonly content: string;
|
|
23
26
|
} | {
|
|
24
27
|
readonly role: "user";
|
|
25
28
|
readonly content: readonly ({
|
|
@@ -89,6 +92,7 @@ export declare const route: Route<{
|
|
|
89
92
|
readonly top_p?: number | undefined;
|
|
90
93
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
91
94
|
readonly store?: boolean | undefined;
|
|
95
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
92
96
|
readonly prompt_cache_key?: string | undefined;
|
|
93
97
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
94
98
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -17,6 +17,9 @@ declare const OpenAIResponsesBody: Schema.Struct<{
|
|
|
17
17
|
}>, Schema.Union<readonly [Schema.Struct<{
|
|
18
18
|
readonly role: Schema.tag<"system">;
|
|
19
19
|
readonly content: Schema.String;
|
|
20
|
+
}>, Schema.Struct<{
|
|
21
|
+
readonly role: Schema.tag<"developer">;
|
|
22
|
+
readonly content: Schema.String;
|
|
20
23
|
}>, Schema.Struct<{
|
|
21
24
|
readonly role: Schema.tag<"user">;
|
|
22
25
|
readonly content: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -96,6 +99,7 @@ declare const OpenAIResponsesBody: Schema.Struct<{
|
|
|
96
99
|
readonly model: Schema.String;
|
|
97
100
|
readonly instructions: Schema.optional<Schema.String>;
|
|
98
101
|
readonly store: Schema.optional<Schema.Boolean>;
|
|
102
|
+
readonly truncation: Schema.optional<Schema.Literals<readonly ["auto", "disabled"]>>;
|
|
99
103
|
readonly service_tier: Schema.optional<Schema.Literals<readonly ["auto", "default", "flex", "priority"]>>;
|
|
100
104
|
readonly prompt_cache_key: Schema.optional<Schema.String>;
|
|
101
105
|
readonly include: Schema.optional<Schema.$Array<Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>>>;
|
|
@@ -126,6 +130,9 @@ export declare const protocol: Protocol<{
|
|
|
126
130
|
} | {
|
|
127
131
|
readonly role: "system";
|
|
128
132
|
readonly content: string;
|
|
133
|
+
} | {
|
|
134
|
+
readonly role: "developer";
|
|
135
|
+
readonly content: string;
|
|
129
136
|
} | {
|
|
130
137
|
readonly role: "user";
|
|
131
138
|
readonly content: readonly ({
|
|
@@ -214,6 +221,7 @@ export declare const protocol: Protocol<{
|
|
|
214
221
|
readonly top_p?: number | undefined;
|
|
215
222
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
216
223
|
readonly store?: boolean | undefined;
|
|
224
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
217
225
|
readonly prompt_cache_key?: string | undefined;
|
|
218
226
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
219
227
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -287,6 +295,9 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
287
295
|
} | {
|
|
288
296
|
readonly role: "system";
|
|
289
297
|
readonly content: string;
|
|
298
|
+
} | {
|
|
299
|
+
readonly role: "developer";
|
|
300
|
+
readonly content: string;
|
|
290
301
|
} | {
|
|
291
302
|
readonly role: "user";
|
|
292
303
|
readonly content: readonly ({
|
|
@@ -375,6 +386,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
375
386
|
readonly top_p?: number | undefined;
|
|
376
387
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
377
388
|
readonly store?: boolean | undefined;
|
|
389
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
378
390
|
readonly prompt_cache_key?: string | undefined;
|
|
379
391
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
380
392
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -394,6 +406,9 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
394
406
|
} | {
|
|
395
407
|
readonly role: "system";
|
|
396
408
|
readonly content: string;
|
|
409
|
+
} | {
|
|
410
|
+
readonly role: "developer";
|
|
411
|
+
readonly content: string;
|
|
397
412
|
} | {
|
|
398
413
|
readonly role: "user";
|
|
399
414
|
readonly content: readonly ({
|
|
@@ -482,6 +497,7 @@ export declare const transport: import("../route/transport/index.js").Transport<
|
|
|
482
497
|
readonly top_p?: number | undefined;
|
|
483
498
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
484
499
|
readonly store?: boolean | undefined;
|
|
500
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
485
501
|
readonly prompt_cache_key?: string | undefined;
|
|
486
502
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
487
503
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -501,6 +517,9 @@ export declare const route: Route<{
|
|
|
501
517
|
} | {
|
|
502
518
|
readonly role: "system";
|
|
503
519
|
readonly content: string;
|
|
520
|
+
} | {
|
|
521
|
+
readonly role: "developer";
|
|
522
|
+
readonly content: string;
|
|
504
523
|
} | {
|
|
505
524
|
readonly role: "user";
|
|
506
525
|
readonly content: readonly ({
|
|
@@ -589,6 +608,7 @@ export declare const route: Route<{
|
|
|
589
608
|
readonly top_p?: number | undefined;
|
|
590
609
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
591
610
|
readonly store?: boolean | undefined;
|
|
611
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
592
612
|
readonly prompt_cache_key?: string | undefined;
|
|
593
613
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
594
614
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -4,10 +4,13 @@ export declare const ResponseIncludables: readonly ["file_search_call.results",
|
|
|
4
4
|
export type ResponseIncludable = (typeof ResponseIncludables)[number];
|
|
5
5
|
export declare const ServiceTiers: readonly ["auto", "default", "flex", "priority"];
|
|
6
6
|
export type ServiceTier = (typeof ServiceTiers)[number];
|
|
7
|
+
export declare const Truncations: readonly ["auto", "disabled"];
|
|
8
|
+
export type Truncation = (typeof Truncations)[number];
|
|
7
9
|
export declare const ReasoningEffort: Schema.String;
|
|
8
10
|
export declare const TextVerbositySchema: Schema.Literals<readonly ["low", "medium", "high"]>;
|
|
9
11
|
export declare const ResponseIncludableSchema: Schema.Literals<readonly ["file_search_call.results", "web_search_call.results", "web_search_call.action.sources", "message.input_image.image_url", "computer_call_output.output.image_url", "code_interpreter_call.outputs", "reasoning.encrypted_content", "message.output_text.logprobs"]>;
|
|
10
12
|
export declare const ServiceTierSchema: Schema.Literals<readonly ["auto", "default", "flex", "priority"]>;
|
|
13
|
+
export declare const TruncationSchema: Schema.Literals<readonly ["auto", "disabled"]>;
|
|
11
14
|
export interface Resolved {
|
|
12
15
|
readonly instructions?: string;
|
|
13
16
|
readonly store?: boolean;
|
|
@@ -16,6 +19,7 @@ export interface Resolved {
|
|
|
16
19
|
readonly include?: ReadonlyArray<ResponseIncludable>;
|
|
17
20
|
readonly textVerbosity?: Schema.Schema.Type<typeof TextVerbosity>;
|
|
18
21
|
readonly serviceTier?: ServiceTier;
|
|
22
|
+
readonly truncation?: Truncation;
|
|
19
23
|
}
|
|
20
24
|
export declare const resolve: (request: LLMRequest) => Resolved;
|
|
21
25
|
export * as OpenResponsesOptions from "./open-responses-options.js";
|
|
@@ -11,15 +11,19 @@ export const ResponseIncludables = [
|
|
|
11
11
|
"message.output_text.logprobs",
|
|
12
12
|
];
|
|
13
13
|
export const ServiceTiers = ["auto", "default", "flex", "priority"];
|
|
14
|
+
export const Truncations = ["auto", "disabled"];
|
|
14
15
|
const TEXT_VERBOSITY = new Set(["low", "medium", "high"]);
|
|
15
16
|
const INCLUDABLES = new Set(ResponseIncludables);
|
|
16
17
|
const SERVICE_TIERS = new Set(ServiceTiers);
|
|
18
|
+
const TRUNCATIONS = new Set(Truncations);
|
|
17
19
|
const isTextVerbosity = (value) => typeof value === "string" && TEXT_VERBOSITY.has(value);
|
|
18
20
|
const isServiceTier = (value) => typeof value === "string" && SERVICE_TIERS.has(value);
|
|
21
|
+
const isTruncation = (value) => typeof value === "string" && TRUNCATIONS.has(value);
|
|
19
22
|
export const ReasoningEffort = Schema.String;
|
|
20
23
|
export const TextVerbositySchema = TextVerbosity;
|
|
21
24
|
export const ResponseIncludableSchema = Schema.Literals(ResponseIncludables);
|
|
22
25
|
export const ServiceTierSchema = Schema.Literals(ServiceTiers);
|
|
26
|
+
export const TruncationSchema = Schema.Literals(Truncations);
|
|
23
27
|
export const resolve = (request) => {
|
|
24
28
|
const input = request.providerOptions?.[request.model.route.providerMetadataKey ?? "openresponses"];
|
|
25
29
|
const include = Array.isArray(input?.include)
|
|
@@ -36,6 +40,7 @@ export const resolve = (request) => {
|
|
|
36
40
|
include: include.length > 0 ? include : undefined,
|
|
37
41
|
textVerbosity: isTextVerbosity(input?.textVerbosity) ? input.textVerbosity : undefined,
|
|
38
42
|
serviceTier: isServiceTier(input?.serviceTier) ? input.serviceTier : undefined,
|
|
43
|
+
truncation: isTruncation(input?.truncation) ? input.truncation : undefined,
|
|
39
44
|
};
|
|
40
45
|
};
|
|
41
46
|
export * as OpenResponsesOptions from "./open-responses-options.js";
|
|
@@ -130,6 +130,9 @@ export declare const routes: (RouteDef<{
|
|
|
130
130
|
} | {
|
|
131
131
|
readonly role: "system";
|
|
132
132
|
readonly content: string;
|
|
133
|
+
} | {
|
|
134
|
+
readonly role: "developer";
|
|
135
|
+
readonly content: string;
|
|
133
136
|
} | {
|
|
134
137
|
readonly role: "user";
|
|
135
138
|
readonly content: readonly ({
|
|
@@ -218,6 +221,7 @@ export declare const routes: (RouteDef<{
|
|
|
218
221
|
readonly top_p?: number | undefined;
|
|
219
222
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
220
223
|
readonly store?: boolean | undefined;
|
|
224
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
221
225
|
readonly prompt_cache_key?: string | undefined;
|
|
222
226
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
223
227
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -133,6 +133,9 @@ export declare const routes: (RouteDef<{
|
|
|
133
133
|
} | {
|
|
134
134
|
readonly role: "system";
|
|
135
135
|
readonly content: string;
|
|
136
|
+
} | {
|
|
137
|
+
readonly role: "developer";
|
|
138
|
+
readonly content: string;
|
|
136
139
|
} | {
|
|
137
140
|
readonly role: "user";
|
|
138
141
|
readonly content: readonly ({
|
|
@@ -221,6 +224,7 @@ export declare const routes: (RouteDef<{
|
|
|
221
224
|
readonly top_p?: number | undefined;
|
|
222
225
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
223
226
|
readonly store?: boolean | undefined;
|
|
227
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
224
228
|
readonly prompt_cache_key?: string | undefined;
|
|
225
229
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
226
230
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -33,6 +33,9 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
33
33
|
} | {
|
|
34
34
|
readonly role: "system";
|
|
35
35
|
readonly content: string;
|
|
36
|
+
} | {
|
|
37
|
+
readonly role: "developer";
|
|
38
|
+
readonly content: string;
|
|
36
39
|
} | {
|
|
37
40
|
readonly role: "user";
|
|
38
41
|
readonly content: readonly ({
|
|
@@ -102,6 +105,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
102
105
|
readonly top_p?: number | undefined;
|
|
103
106
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
104
107
|
readonly store?: boolean | undefined;
|
|
108
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
105
109
|
readonly prompt_cache_key?: string | undefined;
|
|
106
110
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
107
111
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResponseIncludable, ServiceTier } from "../protocols/utils/open-responses-options.js";
|
|
1
|
+
import type { ResponseIncludable, ServiceTier, Truncation } from "../protocols/utils/open-responses-options.js";
|
|
2
2
|
import type { ProviderOptions, ReasoningEffort, TextVerbosity } from "../schema/index.js";
|
|
3
3
|
export interface OpenResponsesOptionsInput {
|
|
4
4
|
readonly [key: string]: unknown;
|
|
@@ -9,6 +9,7 @@ export interface OpenResponsesOptionsInput {
|
|
|
9
9
|
readonly include?: ReadonlyArray<ResponseIncludable>;
|
|
10
10
|
readonly textVerbosity?: TextVerbosity;
|
|
11
11
|
readonly serviceTier?: ServiceTier;
|
|
12
|
+
readonly truncation?: Truncation;
|
|
12
13
|
}
|
|
13
14
|
export type OpenResponsesProviderOptionsInput = ProviderOptions & {
|
|
14
15
|
readonly openresponses?: OpenResponsesOptionsInput;
|
|
@@ -31,6 +31,9 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
31
31
|
} | {
|
|
32
32
|
readonly role: "system";
|
|
33
33
|
readonly content: string;
|
|
34
|
+
} | {
|
|
35
|
+
readonly role: "developer";
|
|
36
|
+
readonly content: string;
|
|
34
37
|
} | {
|
|
35
38
|
readonly role: "user";
|
|
36
39
|
readonly content: readonly ({
|
|
@@ -100,6 +103,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
100
103
|
readonly top_p?: number | undefined;
|
|
101
104
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
102
105
|
readonly store?: boolean | undefined;
|
|
106
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
103
107
|
readonly prompt_cache_key?: string | undefined;
|
|
104
108
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
105
109
|
readonly max_output_tokens?: number | undefined;
|
|
@@ -118,6 +118,9 @@ export declare const routes: (Route<{
|
|
|
118
118
|
} | {
|
|
119
119
|
readonly role: "system";
|
|
120
120
|
readonly content: string;
|
|
121
|
+
} | {
|
|
122
|
+
readonly role: "developer";
|
|
123
|
+
readonly content: string;
|
|
121
124
|
} | {
|
|
122
125
|
readonly role: "user";
|
|
123
126
|
readonly content: readonly ({
|
|
@@ -206,6 +209,7 @@ export declare const routes: (Route<{
|
|
|
206
209
|
readonly top_p?: number | undefined;
|
|
207
210
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
208
211
|
readonly store?: boolean | undefined;
|
|
212
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
209
213
|
readonly prompt_cache_key?: string | undefined;
|
|
210
214
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
211
215
|
readonly max_output_tokens?: number | undefined;
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -128,6 +128,9 @@ export declare const routes: (Route<{
|
|
|
128
128
|
} | {
|
|
129
129
|
readonly role: "system";
|
|
130
130
|
readonly content: string;
|
|
131
|
+
} | {
|
|
132
|
+
readonly role: "developer";
|
|
133
|
+
readonly content: string;
|
|
131
134
|
} | {
|
|
132
135
|
readonly role: "user";
|
|
133
136
|
readonly content: readonly ({
|
|
@@ -216,6 +219,7 @@ export declare const routes: (Route<{
|
|
|
216
219
|
readonly top_p?: number | undefined;
|
|
217
220
|
readonly include?: readonly ("file_search_call.results" | "web_search_call.results" | "web_search_call.action.sources" | "message.input_image.image_url" | "computer_call_output.output.image_url" | "code_interpreter_call.outputs" | "reasoning.encrypted_content" | "message.output_text.logprobs")[] | undefined;
|
|
218
221
|
readonly store?: boolean | undefined;
|
|
222
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
219
223
|
readonly prompt_cache_key?: string | undefined;
|
|
220
224
|
readonly service_tier?: "default" | "auto" | "flex" | "priority" | undefined;
|
|
221
225
|
readonly max_output_tokens?: number | undefined;
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * as TestLLM from "./testing.js";
|
|
2
2
|
import { type Interface as LLMClientShape } from "./route/client.js";
|
|
3
|
-
import { LLMEvent, type FinishReasonDetails, type AIError, type LLMRequest, type UsageInput } from "./schema/index.js";
|
|
3
|
+
import { LLMEvent, type FinishReasonDetails, type AIError, type LLMRequest, type ProviderMetadata, type UsageInput } from "./schema/index.js";
|
|
4
4
|
import { Context, Effect, Layer, Scope, Stream } from "effect";
|
|
5
5
|
export type Response = readonly LLMEvent[] | Stream.Stream<LLMEvent, AIError>;
|
|
6
6
|
export type Gate = Readonly<{
|
|
@@ -26,6 +26,7 @@ export declare class Service extends Service_base {
|
|
|
26
26
|
export declare const complete: (options: {
|
|
27
27
|
readonly reason: FinishReasonDetails;
|
|
28
28
|
readonly usage?: UsageInput;
|
|
29
|
+
readonly providerMetadata?: ProviderMetadata;
|
|
29
30
|
}, ...events: readonly LLMEvent[]) => ({
|
|
30
31
|
readonly type: "step-start";
|
|
31
32
|
readonly index: number;
|
package/dist/testing.js
CHANGED
|
@@ -7,8 +7,13 @@ export class Service extends Context.Service()("@opencode/ai/TestLLM") {
|
|
|
7
7
|
export const complete = (options, ...events) => [
|
|
8
8
|
LLMEvent.stepStart({ index: 0 }),
|
|
9
9
|
...events,
|
|
10
|
-
LLMEvent.stepFinish({
|
|
11
|
-
|
|
10
|
+
LLMEvent.stepFinish({
|
|
11
|
+
index: 0,
|
|
12
|
+
reason: options.reason,
|
|
13
|
+
usage: options.usage,
|
|
14
|
+
providerMetadata: options.providerMetadata,
|
|
15
|
+
}),
|
|
16
|
+
LLMEvent.finish({ reason: options.reason, providerMetadata: options.providerMetadata }),
|
|
12
17
|
];
|
|
13
18
|
export const stop = (...events) => complete({ reason: { normalized: "stop" } }, ...events);
|
|
14
19
|
export const toolCalls = (...events) => complete({ reason: { normalized: "tool-calls" } }, ...events);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-beta-
|
|
3
|
+
"version": "0.0.0-beta-17639",
|
|
4
4
|
"name": "@opencode-ai/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-beta.107",
|
|
33
|
-
"@opencode-ai/http-recorder": "0.0.0-beta-
|
|
33
|
+
"@opencode-ai/http-recorder": "0.0.0-beta-17639",
|
|
34
34
|
"@tsconfig/bun": "1.0.9",
|
|
35
35
|
"@types/bun": "1.3.13",
|
|
36
36
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@smithy/eventstream-codec": "4.2.14",
|
|
41
41
|
"@smithy/util-utf8": "4.2.2",
|
|
42
|
-
"@opencode-ai/schema": "0.0.0-beta-
|
|
42
|
+
"@opencode-ai/schema": "0.0.0-beta-17639",
|
|
43
43
|
"aws4fetch": "1.0.20",
|
|
44
44
|
"effect": "4.0.0-beta.107",
|
|
45
45
|
"google-auth-library": "10.5.0"
|