@opencode-ai/ai 0.0.0-next-16006 → 0.0.0-next-16008
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/openai-chat.d.ts +18 -14
- package/dist/protocols/openai-chat.js +41 -30
- package/dist/protocols/openai-compatible-chat.d.ts +2 -1
- package/dist/providers/azure.d.ts +2 -1
- package/dist/providers/cloudflare.d.ts +6 -3
- package/dist/providers/github-copilot.d.ts +2 -1
- package/dist/providers/google-vertex-chat.d.ts +2 -1
- package/dist/providers/openai-compatible.d.ts +2 -1
- package/dist/providers/openai.d.ts +2 -1
- package/dist/providers/openrouter.d.ts +11 -7
- package/dist/providers/xai.d.ts +2 -1
- package/dist/schema/options.d.ts +1 -0
- package/dist/schema/options.js +1 -0
- package/package.json +3 -3
|
@@ -23,7 +23,7 @@ export declare const bodyFields: {
|
|
|
23
23
|
readonly url: Schema.String;
|
|
24
24
|
}>;
|
|
25
25
|
}>]>>]>;
|
|
26
|
-
}>, Schema.Struct<{
|
|
26
|
+
}>, Schema.StructWithRest<Schema.Struct<{
|
|
27
27
|
readonly role: Schema.Literal<"assistant">;
|
|
28
28
|
readonly content: Schema.NullOr<Schema.String>;
|
|
29
29
|
readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
@@ -37,8 +37,8 @@ export declare const bodyFields: {
|
|
|
37
37
|
readonly reasoning_content: Schema.optional<Schema.String>;
|
|
38
38
|
readonly reasoning: Schema.optional<Schema.String>;
|
|
39
39
|
readonly reasoning_text: Schema.optional<Schema.String>;
|
|
40
|
-
readonly reasoning_details: Schema.optional<Schema
|
|
41
|
-
}>, Schema.Struct<{
|
|
40
|
+
readonly reasoning_details: Schema.optional<Schema.Unknown>;
|
|
41
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
|
|
42
42
|
readonly role: Schema.Literal<"tool">;
|
|
43
43
|
readonly tool_call_id: Schema.String;
|
|
44
44
|
readonly content: Schema.String;
|
|
@@ -87,7 +87,7 @@ declare const OpenAIChatBody: Schema.Struct<{
|
|
|
87
87
|
readonly url: Schema.String;
|
|
88
88
|
}>;
|
|
89
89
|
}>]>>]>;
|
|
90
|
-
}>, Schema.Struct<{
|
|
90
|
+
}>, Schema.StructWithRest<Schema.Struct<{
|
|
91
91
|
readonly role: Schema.Literal<"assistant">;
|
|
92
92
|
readonly content: Schema.NullOr<Schema.String>;
|
|
93
93
|
readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
@@ -101,8 +101,8 @@ declare const OpenAIChatBody: Schema.Struct<{
|
|
|
101
101
|
readonly reasoning_content: Schema.optional<Schema.String>;
|
|
102
102
|
readonly reasoning: Schema.optional<Schema.String>;
|
|
103
103
|
readonly reasoning_text: Schema.optional<Schema.String>;
|
|
104
|
-
readonly reasoning_details: Schema.optional<Schema
|
|
105
|
-
}>, Schema.Struct<{
|
|
104
|
+
readonly reasoning_details: Schema.optional<Schema.Unknown>;
|
|
105
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
|
|
106
106
|
readonly role: Schema.Literal<"tool">;
|
|
107
107
|
readonly tool_call_id: Schema.String;
|
|
108
108
|
readonly content: Schema.String;
|
|
@@ -138,12 +138,12 @@ declare const OpenAIChatBody: Schema.Struct<{
|
|
|
138
138
|
export type OpenAIChatBody = Schema.Schema.Type<typeof OpenAIChatBody>;
|
|
139
139
|
export declare const OpenAIChatEvent: Schema.Struct<{
|
|
140
140
|
readonly choices: Schema.$Array<Schema.Struct<{
|
|
141
|
-
readonly delta: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
141
|
+
readonly delta: Schema.optional<Schema.NullOr<Schema.StructWithRest<Schema.Struct<{
|
|
142
142
|
readonly content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
143
143
|
readonly reasoning_content: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
144
144
|
readonly reasoning: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
145
145
|
readonly reasoning_text: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
146
|
-
readonly reasoning_details: Schema.optional<Schema.NullOr<Schema
|
|
146
|
+
readonly reasoning_details: Schema.optional<Schema.NullOr<Schema.Unknown>>;
|
|
147
147
|
readonly tool_calls: Schema.optional<Schema.NullOr<Schema.$Array<Schema.Struct<{
|
|
148
148
|
readonly index: Schema.Number;
|
|
149
149
|
readonly id: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
@@ -152,7 +152,7 @@ export declare const OpenAIChatEvent: Schema.Struct<{
|
|
|
152
152
|
readonly arguments: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
153
153
|
}>>>;
|
|
154
154
|
}>>>>;
|
|
155
|
-
}>>>;
|
|
155
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>>>;
|
|
156
156
|
readonly finish_reason: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
157
157
|
}>>;
|
|
158
158
|
readonly usage: Schema.optional<Schema.NullOr<Schema.Struct<{
|
|
@@ -180,7 +180,7 @@ export interface ParserState {
|
|
|
180
180
|
readonly usage?: Usage;
|
|
181
181
|
readonly finishReason?: FinishReason;
|
|
182
182
|
readonly lifecycle: Lifecycle.State;
|
|
183
|
-
readonly reasoningField?:
|
|
183
|
+
readonly reasoningField?: string;
|
|
184
184
|
readonly reasoningDetails: Array<unknown>;
|
|
185
185
|
readonly reasoningDetailsObserved: boolean;
|
|
186
186
|
readonly reasoningEmitted: boolean;
|
|
@@ -207,6 +207,7 @@ export declare const protocol: Protocol<{
|
|
|
207
207
|
}>;
|
|
208
208
|
}>]>>]>;
|
|
209
209
|
}, "Type"> | {
|
|
210
|
+
readonly [x: string]: unknown;
|
|
210
211
|
readonly content: string | null;
|
|
211
212
|
readonly role: "assistant";
|
|
212
213
|
readonly reasoning?: string | undefined;
|
|
@@ -220,7 +221,7 @@ export declare const protocol: Protocol<{
|
|
|
220
221
|
}, "Type">[] | undefined;
|
|
221
222
|
readonly reasoning_content?: string | undefined;
|
|
222
223
|
readonly reasoning_text?: string | undefined;
|
|
223
|
-
readonly reasoning_details?:
|
|
224
|
+
readonly reasoning_details?: unknown;
|
|
224
225
|
} | Schema.Struct.ReadonlySide<{
|
|
225
226
|
readonly role: Schema.Literal<"tool">;
|
|
226
227
|
readonly tool_call_id: Schema.String;
|
|
@@ -257,6 +258,7 @@ export declare const protocol: Protocol<{
|
|
|
257
258
|
}, string, {
|
|
258
259
|
readonly choices: readonly {
|
|
259
260
|
readonly delta?: {
|
|
261
|
+
readonly [x: string]: unknown;
|
|
260
262
|
readonly content?: string | null | undefined;
|
|
261
263
|
readonly reasoning?: string | null | undefined;
|
|
262
264
|
readonly tool_calls?: readonly {
|
|
@@ -269,7 +271,7 @@ export declare const protocol: Protocol<{
|
|
|
269
271
|
}[] | null | undefined;
|
|
270
272
|
readonly reasoning_content?: string | null | undefined;
|
|
271
273
|
readonly reasoning_text?: string | null | undefined;
|
|
272
|
-
readonly reasoning_details?:
|
|
274
|
+
readonly reasoning_details?: unknown;
|
|
273
275
|
} | null | undefined;
|
|
274
276
|
readonly finish_reason?: string | null | undefined;
|
|
275
277
|
}[];
|
|
@@ -301,6 +303,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
301
303
|
}>;
|
|
302
304
|
}>]>>]>;
|
|
303
305
|
}, "Type"> | {
|
|
306
|
+
readonly [x: string]: unknown;
|
|
304
307
|
readonly content: string | null;
|
|
305
308
|
readonly role: "assistant";
|
|
306
309
|
readonly reasoning?: string | undefined;
|
|
@@ -314,7 +317,7 @@ export declare const httpTransport: HttpTransport.HttpJsonTransport<{
|
|
|
314
317
|
}, "Type">[] | undefined;
|
|
315
318
|
readonly reasoning_content?: string | undefined;
|
|
316
319
|
readonly reasoning_text?: string | undefined;
|
|
317
|
-
readonly reasoning_details?:
|
|
320
|
+
readonly reasoning_details?: unknown;
|
|
318
321
|
} | Schema.Struct.ReadonlySide<{
|
|
319
322
|
readonly role: Schema.Literal<"tool">;
|
|
320
323
|
readonly tool_call_id: Schema.String;
|
|
@@ -365,6 +368,7 @@ export declare const route: Route<{
|
|
|
365
368
|
}>;
|
|
366
369
|
}>]>>]>;
|
|
367
370
|
}, "Type"> | {
|
|
371
|
+
readonly [x: string]: unknown;
|
|
368
372
|
readonly content: string | null;
|
|
369
373
|
readonly role: "assistant";
|
|
370
374
|
readonly reasoning?: string | undefined;
|
|
@@ -378,7 +382,7 @@ export declare const route: Route<{
|
|
|
378
382
|
}, "Type">[] | undefined;
|
|
379
383
|
readonly reasoning_content?: string | undefined;
|
|
380
384
|
readonly reasoning_text?: string | undefined;
|
|
381
|
-
readonly reasoning_details?:
|
|
385
|
+
readonly reasoning_details?: unknown;
|
|
382
386
|
} | Schema.Struct.ReadonlySide<{
|
|
383
387
|
readonly role: Schema.Literal<"tool">;
|
|
384
388
|
readonly tool_call_id: Schema.String;
|
|
@@ -12,6 +12,7 @@ import { ToolSchemaProjection } from "./utils/tool-schema";
|
|
|
12
12
|
import { ToolStream } from "./utils/tool-stream";
|
|
13
13
|
const ADAPTER = "openai-chat";
|
|
14
14
|
const IMAGE_MIMES = new Set(ProviderShared.IMAGE_MIMES);
|
|
15
|
+
const RESERVED_REASONING_FIELDS = new Set(["role", "content", "tool_calls"]);
|
|
15
16
|
export const DEFAULT_BASE_URL = "https://api.openai.com/v1";
|
|
16
17
|
export const PATH = "/chat/completions";
|
|
17
18
|
// =============================================================================
|
|
@@ -50,15 +51,15 @@ const OpenAIChatMessage = Schema.Union([
|
|
|
50
51
|
role: Schema.Literal("user"),
|
|
51
52
|
content: Schema.Union([Schema.String, Schema.Array(OpenAIChatUserContent)]),
|
|
52
53
|
}),
|
|
53
|
-
Schema.Struct({
|
|
54
|
+
Schema.StructWithRest(Schema.Struct({
|
|
54
55
|
role: Schema.Literal("assistant"),
|
|
55
56
|
content: Schema.NullOr(Schema.String),
|
|
56
57
|
tool_calls: optionalArray(OpenAIChatAssistantToolCall),
|
|
57
58
|
reasoning_content: Schema.optional(Schema.String),
|
|
58
59
|
reasoning: Schema.optional(Schema.String),
|
|
59
60
|
reasoning_text: Schema.optional(Schema.String),
|
|
60
|
-
reasoning_details:
|
|
61
|
-
}),
|
|
61
|
+
reasoning_details: Schema.optional(Schema.Unknown),
|
|
62
|
+
}), [Schema.Record(Schema.String, Schema.Unknown)]),
|
|
62
63
|
Schema.Struct({ role: Schema.Literal("tool"), tool_call_id: Schema.String, content: Schema.String }),
|
|
63
64
|
]).pipe(Schema.toTaggedUnion("role"));
|
|
64
65
|
const OpenAIChatToolChoice = Schema.Union([
|
|
@@ -112,14 +113,14 @@ const OpenAIChatToolCallDelta = Schema.Struct({
|
|
|
112
113
|
id: optionalNull(Schema.String),
|
|
113
114
|
function: optionalNull(OpenAIChatToolCallDeltaFunction),
|
|
114
115
|
});
|
|
115
|
-
const OpenAIChatDelta = Schema.Struct({
|
|
116
|
+
const OpenAIChatDelta = Schema.StructWithRest(Schema.Struct({
|
|
116
117
|
content: optionalNull(Schema.String),
|
|
117
118
|
reasoning_content: optionalNull(Schema.String),
|
|
118
119
|
reasoning: optionalNull(Schema.String),
|
|
119
120
|
reasoning_text: optionalNull(Schema.String),
|
|
120
|
-
reasoning_details: optionalNull(Schema.
|
|
121
|
+
reasoning_details: optionalNull(Schema.Unknown),
|
|
121
122
|
tool_calls: optionalNull(Schema.Array(OpenAIChatToolCallDelta)),
|
|
122
|
-
});
|
|
123
|
+
}), [Schema.Record(Schema.String, Schema.Unknown)]);
|
|
123
124
|
const OpenAIChatChoice = Schema.Struct({
|
|
124
125
|
delta: optionalNull(OpenAIChatDelta),
|
|
125
126
|
finish_reason: optionalNull(Schema.String),
|
|
@@ -163,8 +164,7 @@ const lowerMedia = Effect.fn("OpenAIChat.lowerMedia")(function* (part) {
|
|
|
163
164
|
const openAICompatibleReasoningContent = (native) => isRecord(native) && typeof native.reasoning_content === "string" ? native.reasoning_content : undefined;
|
|
164
165
|
const reasoningField = (part) => {
|
|
165
166
|
const field = part.providerMetadata?.openai?.reasoningField;
|
|
166
|
-
|
|
167
|
-
return field;
|
|
167
|
+
return typeof field === "string" ? field : undefined;
|
|
168
168
|
};
|
|
169
169
|
const reasoningDetails = (parts, native) => {
|
|
170
170
|
const observed = parts.flatMap((part) => {
|
|
@@ -193,7 +193,7 @@ const lowerUserMessage = Effect.fn("OpenAIChat.lowerUserMessage")(function* (mes
|
|
|
193
193
|
return { role: "user", content: content.map((part) => part.text).join("") };
|
|
194
194
|
return { role: "user", content };
|
|
195
195
|
});
|
|
196
|
-
const lowerAssistantMessage = Effect.fn("OpenAIChat.lowerAssistantMessage")(function* (message) {
|
|
196
|
+
const lowerAssistantMessage = Effect.fn("OpenAIChat.lowerAssistantMessage")(function* (message, configuredField) {
|
|
197
197
|
const content = [];
|
|
198
198
|
const reasoning = [];
|
|
199
199
|
const toolCalls = [];
|
|
@@ -219,8 +219,10 @@ const lowerAssistantMessage = Effect.fn("OpenAIChat.lowerAssistantMessage")(func
|
|
|
219
219
|
const nativeReasoning = openAICompatibleReasoningContent(message.native?.openaiCompatible);
|
|
220
220
|
const fullyStructured = reasoning.every((part) => Array.isArray(part.providerMetadata?.openai?.reasoningDetails));
|
|
221
221
|
const field = (() => {
|
|
222
|
+
if (configuredField !== undefined)
|
|
223
|
+
return configuredField;
|
|
222
224
|
if (reasoning.length === 0)
|
|
223
|
-
return;
|
|
225
|
+
return undefined;
|
|
224
226
|
if (observedField !== undefined)
|
|
225
227
|
return observedField;
|
|
226
228
|
if (nativeReasoning !== undefined)
|
|
@@ -228,21 +230,22 @@ const lowerAssistantMessage = Effect.fn("OpenAIChat.lowerAssistantMessage")(func
|
|
|
228
230
|
if (!fullyStructured)
|
|
229
231
|
return "reasoning_content";
|
|
230
232
|
})();
|
|
231
|
-
const
|
|
233
|
+
const reasoningText = (() => {
|
|
234
|
+
if (configuredField !== undefined)
|
|
235
|
+
return reasoning.length === 0 ? (nativeReasoning ?? "") : text;
|
|
232
236
|
if (reasoning.length === 0)
|
|
233
237
|
return nativeReasoning;
|
|
234
|
-
|
|
235
|
-
return text;
|
|
238
|
+
return text;
|
|
236
239
|
})();
|
|
237
|
-
|
|
240
|
+
const result = {
|
|
238
241
|
role: "assistant",
|
|
239
242
|
content: content.length === 0 ? null : ProviderShared.joinText(content),
|
|
240
243
|
tool_calls: toolCalls.length === 0 ? undefined : toolCalls,
|
|
241
|
-
reasoning_content: reasoningContent,
|
|
242
|
-
reasoning: reasoning.length > 0 && field === "reasoning" ? text : undefined,
|
|
243
|
-
reasoning_text: reasoning.length > 0 && field === "reasoning_text" ? text : undefined,
|
|
244
244
|
reasoning_details: details,
|
|
245
245
|
};
|
|
246
|
+
if (field === undefined || reasoningText === undefined)
|
|
247
|
+
return result;
|
|
248
|
+
return { ...result, [field]: reasoningText };
|
|
246
249
|
});
|
|
247
250
|
const lowerToolMessages = Effect.fn("OpenAIChat.lowerToolMessages")(function* (message) {
|
|
248
251
|
const messages = [];
|
|
@@ -262,11 +265,11 @@ const lowerToolMessages = Effect.fn("OpenAIChat.lowerToolMessages")(function* (m
|
|
|
262
265
|
}
|
|
263
266
|
return { messages, images };
|
|
264
267
|
});
|
|
265
|
-
const lowerMessage = Effect.fn("OpenAIChat.lowerMessage")(function* (message) {
|
|
268
|
+
const lowerMessage = Effect.fn("OpenAIChat.lowerMessage")(function* (message, reasoningField) {
|
|
266
269
|
if (message.role === "user")
|
|
267
270
|
return [yield* lowerUserMessage(message)];
|
|
268
271
|
if (message.role === "assistant")
|
|
269
|
-
return [yield* lowerAssistantMessage(message)];
|
|
272
|
+
return [yield* lowerAssistantMessage(message, reasoningField)];
|
|
270
273
|
return (yield* lowerToolMessages(message)).messages;
|
|
271
274
|
});
|
|
272
275
|
const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request) {
|
|
@@ -304,7 +307,7 @@ const lowerMessages = Effect.fn("OpenAIChat.lowerMessages")(function* (request)
|
|
|
304
307
|
continue;
|
|
305
308
|
}
|
|
306
309
|
flushImages();
|
|
307
|
-
messages.push(...(yield* lowerMessage(message)));
|
|
310
|
+
messages.push(...(yield* lowerMessage(message, request.model.compatibility?.reasoningField)));
|
|
308
311
|
}
|
|
309
312
|
flushImages();
|
|
310
313
|
return messages;
|
|
@@ -320,6 +323,9 @@ const lowerOptions = Effect.fn("OpenAIChat.lowerOptions")(function* (request) {
|
|
|
320
323
|
const fromRequest = Effect.fn("OpenAIChat.fromRequest")(function* (request) {
|
|
321
324
|
// `fromRequest` returns the provider body only. Endpoint, auth, framing,
|
|
322
325
|
// validation, and HTTP execution are composed by `Route.make`.
|
|
326
|
+
const reasoningField = request.model.compatibility?.reasoningField;
|
|
327
|
+
if (reasoningField && RESERVED_REASONING_FIELDS.has(reasoningField))
|
|
328
|
+
return yield* ProviderShared.invalidRequest(`OpenAI Chat reasoning field conflicts with reserved field ${reasoningField}`);
|
|
323
329
|
const generation = request.generation;
|
|
324
330
|
const toolSchemaCompatibility = request.model.compatibility?.toolSchema;
|
|
325
331
|
return {
|
|
@@ -379,13 +385,18 @@ const mapUsage = (usage) => {
|
|
|
379
385
|
providerMetadata: { openai: usage },
|
|
380
386
|
});
|
|
381
387
|
};
|
|
382
|
-
const reasoningDelta = (delta) => {
|
|
383
|
-
if (delta
|
|
384
|
-
return
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
388
|
+
const reasoningDelta = (delta, configuredField) => {
|
|
389
|
+
if (!delta)
|
|
390
|
+
return undefined;
|
|
391
|
+
const fields = new Set([configuredField, "reasoning_content", "reasoning", "reasoning_text"]);
|
|
392
|
+
for (const field of fields) {
|
|
393
|
+
if (field === undefined)
|
|
394
|
+
continue;
|
|
395
|
+
const text = delta[field];
|
|
396
|
+
if (typeof text === "string" && text.length > 0)
|
|
397
|
+
return { field, text };
|
|
398
|
+
}
|
|
399
|
+
return undefined;
|
|
389
400
|
};
|
|
390
401
|
const detailText = (details) => {
|
|
391
402
|
const text = details.flatMap((detail) => {
|
|
@@ -442,7 +453,7 @@ const step = (state, event) => Effect.gen(function* () {
|
|
|
442
453
|
let tools = state.tools;
|
|
443
454
|
let pendingTools = state.pendingTools;
|
|
444
455
|
let lifecycle = state.lifecycle;
|
|
445
|
-
const reasoning = reasoningDelta(delta);
|
|
456
|
+
const reasoning = reasoningDelta(delta, state.reasoningField);
|
|
446
457
|
const reasoningField = state.reasoningField ?? (!state.lifecycle.text.has("text-0") ? reasoning?.field : undefined);
|
|
447
458
|
const detailDelta = Array.isArray(delta?.reasoning_details) ? delta.reasoning_details : undefined;
|
|
448
459
|
if (detailDelta !== undefined)
|
|
@@ -538,12 +549,12 @@ export const protocol = Protocol.make({
|
|
|
538
549
|
},
|
|
539
550
|
stream: {
|
|
540
551
|
event: Protocol.jsonEvent(OpenAIChatEvent),
|
|
541
|
-
initial: () => ({
|
|
552
|
+
initial: (request) => ({
|
|
542
553
|
tools: ToolStream.empty(),
|
|
543
554
|
pendingTools: {},
|
|
544
555
|
toolCallEvents: [],
|
|
545
556
|
lifecycle: Lifecycle.initial(),
|
|
546
|
-
reasoningField:
|
|
557
|
+
reasoningField: request.model.compatibility?.reasoningField,
|
|
547
558
|
reasoningDetails: [],
|
|
548
559
|
reasoningDetailsObserved: false,
|
|
549
560
|
reasoningEmitted: false,
|
|
@@ -23,6 +23,7 @@ export declare const route: Route<{
|
|
|
23
23
|
}>;
|
|
24
24
|
}>]>>]>;
|
|
25
25
|
}, "Type"> | {
|
|
26
|
+
readonly [x: string]: unknown;
|
|
26
27
|
readonly content: string | null;
|
|
27
28
|
readonly role: "assistant";
|
|
28
29
|
readonly reasoning?: string | undefined;
|
|
@@ -36,7 +37,7 @@ export declare const route: Route<{
|
|
|
36
37
|
}, "Type">[] | undefined;
|
|
37
38
|
readonly reasoning_content?: string | undefined;
|
|
38
39
|
readonly reasoning_text?: string | undefined;
|
|
39
|
-
readonly reasoning_details?:
|
|
40
|
+
readonly reasoning_details?: unknown;
|
|
40
41
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
41
42
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
42
43
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -37,6 +37,7 @@ export declare const routes: (RouteDef<{
|
|
|
37
37
|
}>;
|
|
38
38
|
}>]>>]>;
|
|
39
39
|
}, "Type"> | {
|
|
40
|
+
readonly [x: string]: unknown;
|
|
40
41
|
readonly content: string | null;
|
|
41
42
|
readonly role: "assistant";
|
|
42
43
|
readonly reasoning?: string | undefined;
|
|
@@ -50,7 +51,7 @@ export declare const routes: (RouteDef<{
|
|
|
50
51
|
}, "Type">[] | undefined;
|
|
51
52
|
readonly reasoning_content?: string | undefined;
|
|
52
53
|
readonly reasoning_text?: string | undefined;
|
|
53
|
-
readonly reasoning_details?:
|
|
54
|
+
readonly reasoning_details?: unknown;
|
|
54
55
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
55
56
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
56
57
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -40,6 +40,7 @@ export declare const aiGatewayRoute: import("../route").Route<{
|
|
|
40
40
|
}>;
|
|
41
41
|
}>]>>]>;
|
|
42
42
|
}, "Type"> | {
|
|
43
|
+
readonly [x: string]: unknown;
|
|
43
44
|
readonly content: string | null;
|
|
44
45
|
readonly role: "assistant";
|
|
45
46
|
readonly reasoning?: string | undefined;
|
|
@@ -53,7 +54,7 @@ export declare const aiGatewayRoute: import("../route").Route<{
|
|
|
53
54
|
}, "Type">[] | undefined;
|
|
54
55
|
readonly reasoning_content?: string | undefined;
|
|
55
56
|
readonly reasoning_text?: string | undefined;
|
|
56
|
-
readonly reasoning_details?:
|
|
57
|
+
readonly reasoning_details?: unknown;
|
|
57
58
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
58
59
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
59
60
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -104,6 +105,7 @@ export declare const workersAIRoute: import("../route").Route<{
|
|
|
104
105
|
}>;
|
|
105
106
|
}>]>>]>;
|
|
106
107
|
}, "Type"> | {
|
|
108
|
+
readonly [x: string]: unknown;
|
|
107
109
|
readonly content: string | null;
|
|
108
110
|
readonly role: "assistant";
|
|
109
111
|
readonly reasoning?: string | undefined;
|
|
@@ -117,7 +119,7 @@ export declare const workersAIRoute: import("../route").Route<{
|
|
|
117
119
|
}, "Type">[] | undefined;
|
|
118
120
|
readonly reasoning_content?: string | undefined;
|
|
119
121
|
readonly reasoning_text?: string | undefined;
|
|
120
|
-
readonly reasoning_details?:
|
|
122
|
+
readonly reasoning_details?: unknown;
|
|
121
123
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
122
124
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
123
125
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -168,6 +170,7 @@ export declare const routes: import("../route").Route<{
|
|
|
168
170
|
}>;
|
|
169
171
|
}>]>>]>;
|
|
170
172
|
}, "Type"> | {
|
|
173
|
+
readonly [x: string]: unknown;
|
|
171
174
|
readonly content: string | null;
|
|
172
175
|
readonly role: "assistant";
|
|
173
176
|
readonly reasoning?: string | undefined;
|
|
@@ -181,7 +184,7 @@ export declare const routes: import("../route").Route<{
|
|
|
181
184
|
}, "Type">[] | undefined;
|
|
182
185
|
readonly reasoning_content?: string | undefined;
|
|
183
186
|
readonly reasoning_text?: string | undefined;
|
|
184
|
-
readonly reasoning_details?:
|
|
187
|
+
readonly reasoning_details?: unknown;
|
|
185
188
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
186
189
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
187
190
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -25,6 +25,7 @@ export declare const routes: (import("../route").Route<{
|
|
|
25
25
|
}>;
|
|
26
26
|
}>]>>]>;
|
|
27
27
|
}, "Type"> | {
|
|
28
|
+
readonly [x: string]: unknown;
|
|
28
29
|
readonly content: string | null;
|
|
29
30
|
readonly role: "assistant";
|
|
30
31
|
readonly reasoning?: string | undefined;
|
|
@@ -38,7 +39,7 @@ export declare const routes: (import("../route").Route<{
|
|
|
38
39
|
}, "Type">[] | undefined;
|
|
39
40
|
readonly reasoning_content?: string | undefined;
|
|
40
41
|
readonly reasoning_text?: string | undefined;
|
|
41
|
-
readonly reasoning_details?:
|
|
42
|
+
readonly reasoning_details?: unknown;
|
|
42
43
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
43
44
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
44
45
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -32,6 +32,7 @@ export declare const routes: import("../route").Route<{
|
|
|
32
32
|
}>;
|
|
33
33
|
}>]>>]>;
|
|
34
34
|
}, "Type"> | {
|
|
35
|
+
readonly [x: string]: unknown;
|
|
35
36
|
readonly content: string | null;
|
|
36
37
|
readonly role: "assistant";
|
|
37
38
|
readonly reasoning?: string | undefined;
|
|
@@ -45,7 +46,7 @@ export declare const routes: import("../route").Route<{
|
|
|
45
46
|
}, "Type">[] | undefined;
|
|
46
47
|
readonly reasoning_content?: string | undefined;
|
|
47
48
|
readonly reasoning_text?: string | undefined;
|
|
48
|
-
readonly reasoning_details?:
|
|
49
|
+
readonly reasoning_details?: unknown;
|
|
49
50
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
50
51
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
51
52
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -31,6 +31,7 @@ export declare const routes: import("../route").Route<{
|
|
|
31
31
|
}>;
|
|
32
32
|
}>]>>]>;
|
|
33
33
|
}, "Type"> | {
|
|
34
|
+
readonly [x: string]: unknown;
|
|
34
35
|
readonly content: string | null;
|
|
35
36
|
readonly role: "assistant";
|
|
36
37
|
readonly reasoning?: string | undefined;
|
|
@@ -44,7 +45,7 @@ export declare const routes: import("../route").Route<{
|
|
|
44
45
|
}, "Type">[] | undefined;
|
|
45
46
|
readonly reasoning_content?: string | undefined;
|
|
46
47
|
readonly reasoning_text?: string | undefined;
|
|
47
|
-
readonly reasoning_details?:
|
|
48
|
+
readonly reasoning_details?: unknown;
|
|
48
49
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
49
50
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
50
51
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -23,6 +23,7 @@ export declare const routes: (Route<{
|
|
|
23
23
|
}>;
|
|
24
24
|
}>]>>]>;
|
|
25
25
|
}, "Type"> | {
|
|
26
|
+
readonly [x: string]: unknown;
|
|
26
27
|
readonly content: string | null;
|
|
27
28
|
readonly role: "assistant";
|
|
28
29
|
readonly reasoning?: string | undefined;
|
|
@@ -36,7 +37,7 @@ export declare const routes: (Route<{
|
|
|
36
37
|
}, "Type">[] | undefined;
|
|
37
38
|
readonly reasoning_content?: string | undefined;
|
|
38
39
|
readonly reasoning_text?: string | undefined;
|
|
39
|
-
readonly reasoning_details?:
|
|
40
|
+
readonly reasoning_details?: unknown;
|
|
40
41
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
41
42
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
42
43
|
readonly tool_call_id: import("effect/Schema").String;
|
|
@@ -38,7 +38,7 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
|
38
38
|
readonly url: Schema.String;
|
|
39
39
|
}>;
|
|
40
40
|
}>]>>]>;
|
|
41
|
-
}>, Schema.Struct<{
|
|
41
|
+
}>, Schema.StructWithRest<Schema.Struct<{
|
|
42
42
|
readonly role: Schema.Literal<"assistant">;
|
|
43
43
|
readonly content: Schema.NullOr<Schema.String>;
|
|
44
44
|
readonly tool_calls: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
@@ -52,8 +52,8 @@ declare const OpenRouterBody: Schema.StructWithRest<Schema.Struct<{
|
|
|
52
52
|
readonly reasoning_content: Schema.optional<Schema.String>;
|
|
53
53
|
readonly reasoning: Schema.optional<Schema.String>;
|
|
54
54
|
readonly reasoning_text: Schema.optional<Schema.String>;
|
|
55
|
-
readonly reasoning_details: Schema.optional<Schema
|
|
56
|
-
}>, Schema.Struct<{
|
|
55
|
+
readonly reasoning_details: Schema.optional<Schema.Unknown>;
|
|
56
|
+
}>, readonly [Schema.$Record<Schema.String, Schema.Unknown>]>, Schema.Struct<{
|
|
57
57
|
readonly role: Schema.Literal<"tool">;
|
|
58
58
|
readonly tool_call_id: Schema.String;
|
|
59
59
|
readonly content: Schema.String;
|
|
@@ -104,6 +104,7 @@ export declare const protocol: Protocol<{
|
|
|
104
104
|
}>;
|
|
105
105
|
}>]>>]>;
|
|
106
106
|
}, "Type"> | {
|
|
107
|
+
readonly [x: string]: unknown;
|
|
107
108
|
readonly content: string | null;
|
|
108
109
|
readonly role: "assistant";
|
|
109
110
|
readonly reasoning?: string | undefined;
|
|
@@ -117,7 +118,7 @@ export declare const protocol: Protocol<{
|
|
|
117
118
|
}, "Type">[] | undefined;
|
|
118
119
|
readonly reasoning_content?: string | undefined;
|
|
119
120
|
readonly reasoning_text?: string | undefined;
|
|
120
|
-
readonly reasoning_details?:
|
|
121
|
+
readonly reasoning_details?: unknown;
|
|
121
122
|
} | Schema.Struct.ReadonlySide<{
|
|
122
123
|
readonly role: Schema.Literal<"tool">;
|
|
123
124
|
readonly tool_call_id: Schema.String;
|
|
@@ -154,6 +155,7 @@ export declare const protocol: Protocol<{
|
|
|
154
155
|
}, string, {
|
|
155
156
|
readonly choices: readonly {
|
|
156
157
|
readonly delta?: {
|
|
158
|
+
readonly [x: string]: unknown;
|
|
157
159
|
readonly content?: string | null | undefined;
|
|
158
160
|
readonly reasoning?: string | null | undefined;
|
|
159
161
|
readonly tool_calls?: readonly {
|
|
@@ -166,7 +168,7 @@ export declare const protocol: Protocol<{
|
|
|
166
168
|
}[] | null | undefined;
|
|
167
169
|
readonly reasoning_content?: string | null | undefined;
|
|
168
170
|
readonly reasoning_text?: string | null | undefined;
|
|
169
|
-
readonly reasoning_details?:
|
|
171
|
+
readonly reasoning_details?: unknown;
|
|
170
172
|
} | null | undefined;
|
|
171
173
|
readonly finish_reason?: string | null | undefined;
|
|
172
174
|
}[];
|
|
@@ -199,6 +201,7 @@ export declare const route: Route<{
|
|
|
199
201
|
}>;
|
|
200
202
|
}>]>>]>;
|
|
201
203
|
}, "Type"> | {
|
|
204
|
+
readonly [x: string]: unknown;
|
|
202
205
|
readonly content: string | null;
|
|
203
206
|
readonly role: "assistant";
|
|
204
207
|
readonly reasoning?: string | undefined;
|
|
@@ -212,7 +215,7 @@ export declare const route: Route<{
|
|
|
212
215
|
}, "Type">[] | undefined;
|
|
213
216
|
readonly reasoning_content?: string | undefined;
|
|
214
217
|
readonly reasoning_text?: string | undefined;
|
|
215
|
-
readonly reasoning_details?:
|
|
218
|
+
readonly reasoning_details?: unknown;
|
|
216
219
|
} | Schema.Struct.ReadonlySide<{
|
|
217
220
|
readonly role: Schema.Literal<"tool">;
|
|
218
221
|
readonly tool_call_id: Schema.String;
|
|
@@ -264,6 +267,7 @@ export declare const routes: Route<{
|
|
|
264
267
|
}>;
|
|
265
268
|
}>]>>]>;
|
|
266
269
|
}, "Type"> | {
|
|
270
|
+
readonly [x: string]: unknown;
|
|
267
271
|
readonly content: string | null;
|
|
268
272
|
readonly role: "assistant";
|
|
269
273
|
readonly reasoning?: string | undefined;
|
|
@@ -277,7 +281,7 @@ export declare const routes: Route<{
|
|
|
277
281
|
}, "Type">[] | undefined;
|
|
278
282
|
readonly reasoning_content?: string | undefined;
|
|
279
283
|
readonly reasoning_text?: string | undefined;
|
|
280
|
-
readonly reasoning_details?:
|
|
284
|
+
readonly reasoning_details?: unknown;
|
|
281
285
|
} | Schema.Struct.ReadonlySide<{
|
|
282
286
|
readonly role: Schema.Literal<"tool">;
|
|
283
287
|
readonly tool_call_id: Schema.String;
|
package/dist/providers/xai.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare const routes: (import("../route").Route<{
|
|
|
22
22
|
}>;
|
|
23
23
|
}>]>>]>;
|
|
24
24
|
}, "Type"> | {
|
|
25
|
+
readonly [x: string]: unknown;
|
|
25
26
|
readonly content: string | null;
|
|
26
27
|
readonly role: "assistant";
|
|
27
28
|
readonly reasoning?: string | undefined;
|
|
@@ -35,7 +36,7 @@ export declare const routes: (import("../route").Route<{
|
|
|
35
36
|
}, "Type">[] | undefined;
|
|
36
37
|
readonly reasoning_content?: string | undefined;
|
|
37
38
|
readonly reasoning_text?: string | undefined;
|
|
38
|
-
readonly reasoning_details?:
|
|
39
|
+
readonly reasoning_details?: unknown;
|
|
39
40
|
} | import("effect/Schema").Struct.ReadonlySide<{
|
|
40
41
|
readonly role: import("effect/Schema").Literal<"tool">;
|
|
41
42
|
readonly tool_call_id: import("effect/Schema").String;
|
package/dist/schema/options.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export declare const ModelToolSchemaCompatibility: Schema.Literals<readonly ["ge
|
|
|
80
80
|
export type ModelToolSchemaCompatibility = Schema.Schema.Type<typeof ModelToolSchemaCompatibility>;
|
|
81
81
|
declare const ModelCompatibility_base: Schema.Class<ModelCompatibility, Schema.Struct<{
|
|
82
82
|
readonly toolSchema: Schema.optional<Schema.Literals<readonly ["gemini", "moonshot"]>>;
|
|
83
|
+
readonly reasoningField: Schema.optional<Schema.String>;
|
|
83
84
|
}>, {}>;
|
|
84
85
|
export declare class ModelCompatibility extends ModelCompatibility_base {
|
|
85
86
|
}
|
package/dist/schema/options.js
CHANGED
|
@@ -119,6 +119,7 @@ export class ModelDefaults extends Schema.Class("LLM.ModelDefaults")({
|
|
|
119
119
|
export const ModelToolSchemaCompatibility = Schema.Literals(["gemini", "moonshot"]);
|
|
120
120
|
export class ModelCompatibility extends Schema.Class("LLM.ModelCompatibility")({
|
|
121
121
|
toolSchema: Schema.optional(ModelToolSchemaCompatibility),
|
|
122
|
+
reasoningField: Schema.optional(Schema.String),
|
|
122
123
|
}) {
|
|
123
124
|
}
|
|
124
125
|
(function (ModelCompatibility) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-16008",
|
|
4
4
|
"name": "@opencode-ai/ai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@clack/prompts": "1.0.0-alpha.1",
|
|
28
28
|
"@effect/platform-node": "4.0.0-beta.98",
|
|
29
|
-
"@opencode-ai/http-recorder": "0.0.0-next-
|
|
29
|
+
"@opencode-ai/http-recorder": "0.0.0-next-16008",
|
|
30
30
|
"@tsconfig/bun": "1.0.9",
|
|
31
31
|
"@types/bun": "1.3.13",
|
|
32
32
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@smithy/eventstream-codec": "4.2.14",
|
|
37
37
|
"@smithy/util-utf8": "4.2.2",
|
|
38
|
-
"@opencode-ai/schema": "0.0.0-next-
|
|
38
|
+
"@opencode-ai/schema": "0.0.0-next-16008",
|
|
39
39
|
"aws4fetch": "1.0.20",
|
|
40
40
|
"effect": "4.0.0-beta.98",
|
|
41
41
|
"google-auth-library": "10.5.0"
|