@opencode/schema 2.1.4 → 2.2.0
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/agent.d.ts +5 -0
- package/dist/config/experimental.d.ts +1 -0
- package/dist/config/experimental.js +3 -0
- package/dist/config/provider.d.ts +73 -7
- package/dist/config/provider.js +10 -15
- package/dist/event-manifest.d.ts +8 -0
- package/dist/file-diff.d.ts +2 -0
- package/dist/file-diff.js +2 -0
- package/dist/generate.d.ts +355 -0
- package/dist/generate.js +134 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +2 -0
- package/dist/model-compatibility.d.ts +15 -4
- package/dist/model-compatibility.js +15 -4
- package/dist/model.d.ts +53 -2
- package/dist/model.js +9 -7
- package/dist/plugin.d.ts +15 -0
- package/dist/plugin.js +11 -1
- package/dist/prompt.d.ts +96 -0
- package/dist/prompt.js +17 -1
- package/dist/provider.d.ts +40 -0
- package/dist/provider.js +14 -3
- package/dist/session-event.d.ts +20 -0
- package/dist/session-inbox.d.ts +714 -86
- package/dist/session-inbox.js +10 -1
- package/dist/session-message.d.ts +968 -0
- package/dist/session-message.js +19 -1
- package/dist/session-revert.d.ts +37 -0
- package/dist/session-transfer.d.ts +4 -0
- package/dist/session.d.ts +4 -0
- package/dist/usage-limits.d.ts +227 -0
- package/dist/usage-limits.js +59 -0
- package/dist/vcs.d.ts +3 -0
- package/dist/vcs.js +2 -0
- package/package.json +2 -1
package/dist/model.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as Model from "./model.js";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { Provider } from "./provider.js";
|
|
4
|
-
import { Compatibility, MaxTokensField, ReasoningField } from "./model-compatibility.js";
|
|
4
|
+
import { Compatibility, MaxTokensField, MediaInput, ReasoningField } from "./model-compatibility.js";
|
|
5
5
|
export declare const ID: Schema.brand<Schema.String, "Model.ID">;
|
|
6
6
|
export type ID = typeof ID.Type;
|
|
7
7
|
export declare const Event: {
|
|
@@ -99,9 +99,12 @@ export declare const Ref: Schema.Struct<{
|
|
|
99
99
|
};
|
|
100
100
|
export interface Ref extends Schema.Schema.Type<typeof Ref> {
|
|
101
101
|
}
|
|
102
|
-
export { Compatibility, MaxTokensField, ReasoningField };
|
|
102
|
+
export { Compatibility, MaxTokensField, MediaInput, ReasoningField };
|
|
103
103
|
export declare const Family: Schema.brand<Schema.String, "Model.Family">;
|
|
104
104
|
export type Family = typeof Family.Type;
|
|
105
|
+
/** What a model produces, from models.dev. Open-ended: new types keep being added. Only chat models are offered for sessions; an unset type means chat. */
|
|
106
|
+
export type Type = "chat" | "decision" | "image" | (string & {});
|
|
107
|
+
export declare const Type: Schema.Codec<Type>;
|
|
105
108
|
export declare const Settings: Schema.StructWithRest<Schema.Struct<{
|
|
106
109
|
readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
107
110
|
readonly type: Schema.Literal<"summary">;
|
|
@@ -112,6 +115,11 @@ export declare const Settings: Schema.StructWithRest<Schema.Struct<{
|
|
|
112
115
|
}>, Schema.Struct<{
|
|
113
116
|
readonly type: Schema.Literal<"native">;
|
|
114
117
|
}>]>>, never, never>;
|
|
118
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
119
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
120
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
121
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
122
|
+
}>>, never, never>;
|
|
115
123
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
116
124
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>;
|
|
117
125
|
export type Settings = typeof Settings.Type;
|
|
@@ -126,6 +134,11 @@ export declare const Overlays: {
|
|
|
126
134
|
}>, Schema.Struct<{
|
|
127
135
|
readonly type: Schema.Literal<"native">;
|
|
128
136
|
}>]>>, never, never>;
|
|
137
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
138
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
139
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
140
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
141
|
+
}>>, never, never>;
|
|
129
142
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
130
143
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
131
144
|
readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -137,6 +150,11 @@ export declare const Overlays: {
|
|
|
137
150
|
}>, Schema.Struct<{
|
|
138
151
|
readonly type: Schema.Literal<"native">;
|
|
139
152
|
}>]>>, never, never>;
|
|
153
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
154
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
155
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
156
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
157
|
+
}>>, never, never>;
|
|
140
158
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
141
159
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
142
160
|
headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
@@ -195,6 +213,11 @@ export declare const Variant: Schema.Struct<{
|
|
|
195
213
|
}>, Schema.Struct<{
|
|
196
214
|
readonly type: Schema.Literal<"native">;
|
|
197
215
|
}>]>>, never, never>;
|
|
216
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
217
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
218
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
219
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
220
|
+
}>>, never, never>;
|
|
198
221
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
199
222
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
200
223
|
readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -206,6 +229,11 @@ export declare const Variant: Schema.Struct<{
|
|
|
206
229
|
}>, Schema.Struct<{
|
|
207
230
|
readonly type: Schema.Literal<"native">;
|
|
208
231
|
}>]>>, never, never>;
|
|
232
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
233
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
234
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
235
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
236
|
+
}>>, never, never>;
|
|
209
237
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
210
238
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
211
239
|
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
@@ -225,6 +253,11 @@ export declare const Info: Schema.Struct<{
|
|
|
225
253
|
}>, Schema.Struct<{
|
|
226
254
|
readonly type: Schema.Literal<"native">;
|
|
227
255
|
}>]>>, never, never>;
|
|
256
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
257
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
258
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
259
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
260
|
+
}>>, never, never>;
|
|
228
261
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
229
262
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
230
263
|
readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -236,6 +269,11 @@ export declare const Info: Schema.Struct<{
|
|
|
236
269
|
}>, Schema.Struct<{
|
|
237
270
|
readonly type: Schema.Literal<"native">;
|
|
238
271
|
}>]>>, never, never>;
|
|
272
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
273
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
274
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
275
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
276
|
+
}>>, never, never>;
|
|
239
277
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
240
278
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
241
279
|
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
|
@@ -280,6 +318,7 @@ export declare const Info: Schema.Struct<{
|
|
|
280
318
|
mistral: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
281
319
|
gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
|
|
282
320
|
}>, never, never>;
|
|
321
|
+
readonly type: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Type, Type, never, never>>>, Schema.optionalKey<Schema.Codec<Type, Type, never, never>>, never, never>;
|
|
283
322
|
readonly family: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.Family">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.Family">>, never, never>;
|
|
284
323
|
readonly name: Schema.String;
|
|
285
324
|
readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
@@ -293,6 +332,7 @@ export declare const Info: Schema.Struct<{
|
|
|
293
332
|
readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
|
|
294
333
|
readonly supportsThinkingBlockBinding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
295
334
|
readonly supportsEffortUpdates: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
335
|
+
readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
|
|
296
336
|
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
297
337
|
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<ReasoningField, ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<ReasoningField, ReasoningField, never, never>>, never, never>;
|
|
298
338
|
readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
@@ -304,6 +344,7 @@ export declare const Info: Schema.Struct<{
|
|
|
304
344
|
readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
|
|
305
345
|
readonly supportsThinkingBlockBinding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
306
346
|
readonly supportsEffortUpdates: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
347
|
+
readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
|
|
307
348
|
}>>, never, never>;
|
|
308
349
|
readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
309
350
|
readonly capabilities: Schema.Struct<{
|
|
@@ -330,6 +371,11 @@ export declare const Info: Schema.Struct<{
|
|
|
330
371
|
}>, Schema.Struct<{
|
|
331
372
|
readonly type: Schema.Literal<"native">;
|
|
332
373
|
}>]>>, never, never>;
|
|
374
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
375
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
376
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
377
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
378
|
+
}>>, never, never>;
|
|
333
379
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
334
380
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
335
381
|
readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
|
|
@@ -341,6 +387,11 @@ export declare const Info: Schema.Struct<{
|
|
|
341
387
|
}>, Schema.Struct<{
|
|
342
388
|
readonly type: Schema.Literal<"native">;
|
|
343
389
|
}>]>>, never, never>;
|
|
390
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
391
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
392
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
393
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
394
|
+
}>>, never, never>;
|
|
344
395
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
345
396
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
346
397
|
readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
|
package/dist/model.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as Model from "./model.js";
|
|
2
|
-
import { Schema } from "effect";
|
|
2
|
+
import { Schema, Struct } from "effect";
|
|
3
3
|
import { optional, statics } from "./schema.js";
|
|
4
4
|
import { Provider } from "./provider.js";
|
|
5
|
-
import { Compatibility, MaxTokensField, ReasoningField } from "./model-compatibility.js";
|
|
5
|
+
import { Compatibility, MaxTokensField, MediaInput, ReasoningField } from "./model-compatibility.js";
|
|
6
6
|
import { Money } from "./money.js";
|
|
7
7
|
import { ephemeral, inventory } from "./event.js";
|
|
8
8
|
export const ID = Schema.String.pipe(Schema.brand("Model.ID"));
|
|
@@ -33,12 +33,13 @@ export const Ref = Schema.Struct({
|
|
|
33
33
|
});
|
|
34
34
|
},
|
|
35
35
|
})));
|
|
36
|
-
export { Compatibility, MaxTokensField, ReasoningField };
|
|
36
|
+
export { Compatibility, MaxTokensField, MediaInput, ReasoningField };
|
|
37
37
|
export const Family = Schema.String.pipe(Schema.brand("Model.Family"));
|
|
38
|
-
export const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
38
|
+
export const Type = Schema.Union([
|
|
39
|
+
Schema.Literals(["chat", "decision", "image"]),
|
|
40
|
+
Schema.String,
|
|
41
|
+
]).annotate({ identifier: "Model.Type" });
|
|
42
|
+
export const Settings = Schema.StructWithRest(Schema.Struct(Struct.pick(Provider.Settings.schema.fields, ["compaction", "cache", "encoding"])),
|
|
42
43
|
// Provider packages may define arbitrary model-level options beyond OpenCode's shared compaction policy.
|
|
43
44
|
[Schema.Record(Schema.String, Schema.Any)]).annotate({ identifier: "Model.Settings" });
|
|
44
45
|
export const Overlays = {
|
|
@@ -78,6 +79,7 @@ export const Info = Schema.Struct({
|
|
|
78
79
|
modelID: ID,
|
|
79
80
|
providerID: Provider.ID,
|
|
80
81
|
canonical: Provider.ID.pipe(optional),
|
|
82
|
+
type: Type.pipe(optional),
|
|
81
83
|
family: Family.pipe(optional),
|
|
82
84
|
name: Schema.String,
|
|
83
85
|
compatibility: Compatibility.pipe(optional),
|
package/dist/plugin.d.ts
CHANGED
|
@@ -21,8 +21,21 @@ export declare const Features: Schema.Struct<{
|
|
|
21
21
|
readonly server: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
22
22
|
readonly tui: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
23
23
|
readonly rpc: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
24
|
+
/** The package exports `./gui-experimental`, the GUI bundle the desktop app loads. */
|
|
25
|
+
readonly gui: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
24
26
|
}>;
|
|
25
27
|
export type Features = typeof Features.Type;
|
|
28
|
+
/** A plugin's prebuilt CommonJS `./gui-experimental` bundle. */
|
|
29
|
+
export interface GuiBundle extends Schema.Schema.Type<typeof GuiBundle> {
|
|
30
|
+
}
|
|
31
|
+
export declare const GuiBundle: Schema.Struct<{
|
|
32
|
+
/** The bundle's CommonJS code. */
|
|
33
|
+
readonly code: Schema.String;
|
|
34
|
+
/** An opaque value that changes whenever the plugin, its options or its bundle change. */
|
|
35
|
+
readonly revision: Schema.String;
|
|
36
|
+
/** The plugin's options from its `opencode.json` entry, as its server entry receives them. */
|
|
37
|
+
readonly options: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
38
|
+
}>;
|
|
26
39
|
export declare const State: Schema.Union<readonly [Schema.Struct<{
|
|
27
40
|
readonly status: Schema.Literal<"active">;
|
|
28
41
|
}>, Schema.Struct<{
|
|
@@ -53,6 +66,8 @@ export declare const Info: Schema.Struct<{
|
|
|
53
66
|
readonly server: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
54
67
|
readonly tui: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
55
68
|
readonly rpc: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
69
|
+
/** The package exports `./gui-experimental`, the GUI bundle the desktop app loads. */
|
|
70
|
+
readonly gui: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literal<true>>>, Schema.optionalKey<Schema.Literal<true>>, never, never>;
|
|
56
71
|
}>;
|
|
57
72
|
readonly state: Schema.Union<readonly [Schema.Struct<{
|
|
58
73
|
readonly status: Schema.Literal<"active">;
|
package/dist/plugin.js
CHANGED
|
@@ -2,7 +2,7 @@ export * as Plugin from "./plugin.js";
|
|
|
2
2
|
import { Schema } from "effect";
|
|
3
3
|
import { ephemeral, inventory } from "./event.js";
|
|
4
4
|
import { optional } from "./schema.js";
|
|
5
|
-
export const ID = Schema.String.pipe(Schema.brand("Plugin.ID"));
|
|
5
|
+
export const ID = Schema.String.pipe(Schema.brand("Plugin.ID"), Schema.annotate({ identifier: "Plugin.ID" }));
|
|
6
6
|
export const Source = Schema.Union([
|
|
7
7
|
Schema.Struct({ type: Schema.Literal("builtin") }),
|
|
8
8
|
Schema.Struct({
|
|
@@ -19,7 +19,17 @@ export const Features = Schema.Struct({
|
|
|
19
19
|
server: Schema.Literal(true).pipe(optional),
|
|
20
20
|
tui: Schema.Literal(true).pipe(optional),
|
|
21
21
|
rpc: Schema.Literal(true).pipe(optional),
|
|
22
|
+
/** The package exports `./gui-experimental`, the GUI bundle the desktop app loads. */
|
|
23
|
+
gui: Schema.Literal(true).pipe(optional),
|
|
22
24
|
}).annotate({ identifier: "Plugin.Features" });
|
|
25
|
+
export const GuiBundle = Schema.Struct({
|
|
26
|
+
/** The bundle's CommonJS code. */
|
|
27
|
+
code: Schema.String,
|
|
28
|
+
/** An opaque value that changes whenever the plugin, its options or its bundle change. */
|
|
29
|
+
revision: Schema.String,
|
|
30
|
+
/** The plugin's options from its `opencode.json` entry, as its server entry receives them. */
|
|
31
|
+
options: Schema.Record(Schema.String, Schema.Json),
|
|
32
|
+
}).annotate({ identifier: "Plugin.GuiBundle" });
|
|
23
33
|
export const State = Schema.Union([
|
|
24
34
|
Schema.Struct({ status: Schema.Literal("active") }),
|
|
25
35
|
Schema.Struct({ status: Schema.Literal("failed"), error: Schema.String, ref: Schema.String.pipe(optional) }),
|
package/dist/prompt.d.ts
CHANGED
|
@@ -56,6 +56,102 @@ export declare const FileAttachment: Schema.Struct<{
|
|
|
56
56
|
} | undefined;
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
|
+
/** `media:` and the lowercase hex SHA-256 of a stored blob's bytes. Names no server route. */
|
|
60
|
+
export declare const MediaRef: Schema.String;
|
|
61
|
+
export type MediaRef = typeof MediaRef.Type;
|
|
62
|
+
/**
|
|
63
|
+
* An attachment whose bytes stay on the server, sent to clients that opt in with the experimental `experimental-media-uri`
|
|
64
|
+
* capability. Fetch the bytes from `GET /api/experimental/media/:hash`.
|
|
65
|
+
*/
|
|
66
|
+
export interface MediaFileAttachment extends Schema.Schema.Type<typeof MediaFileAttachment> {
|
|
67
|
+
}
|
|
68
|
+
export declare const MediaFileAttachment: Schema.Struct<{
|
|
69
|
+
readonly mime: Schema.String;
|
|
70
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
71
|
+
readonly type: Schema.Literal<"inline">;
|
|
72
|
+
}>, Schema.Struct<{
|
|
73
|
+
readonly type: Schema.Literal<"uri">;
|
|
74
|
+
readonly uri: Schema.String;
|
|
75
|
+
}>]>;
|
|
76
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
77
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
78
|
+
readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
79
|
+
readonly start: Schema.Finite;
|
|
80
|
+
readonly end: Schema.Finite;
|
|
81
|
+
readonly text: Schema.String;
|
|
82
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
83
|
+
readonly start: Schema.Finite;
|
|
84
|
+
readonly end: Schema.Finite;
|
|
85
|
+
readonly text: Schema.String;
|
|
86
|
+
}>>, never, never>;
|
|
87
|
+
readonly uri: Schema.String;
|
|
88
|
+
readonly bytes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
89
|
+
readonly width: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
90
|
+
readonly height: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
91
|
+
}>;
|
|
92
|
+
export declare const Attachment: Schema.Union<readonly [Schema.Struct<{
|
|
93
|
+
readonly data: Schema.String;
|
|
94
|
+
readonly mime: Schema.String;
|
|
95
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
96
|
+
readonly type: Schema.Literal<"inline">;
|
|
97
|
+
}>, Schema.Struct<{
|
|
98
|
+
readonly type: Schema.Literal<"uri">;
|
|
99
|
+
readonly uri: Schema.String;
|
|
100
|
+
}>]>;
|
|
101
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
102
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
103
|
+
readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
104
|
+
readonly start: Schema.Finite;
|
|
105
|
+
readonly end: Schema.Finite;
|
|
106
|
+
readonly text: Schema.String;
|
|
107
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
108
|
+
readonly start: Schema.Finite;
|
|
109
|
+
readonly end: Schema.Finite;
|
|
110
|
+
readonly text: Schema.String;
|
|
111
|
+
}>>, never, never>;
|
|
112
|
+
}> & {
|
|
113
|
+
create: (input: FileAttachment) => {
|
|
114
|
+
readonly data: string;
|
|
115
|
+
readonly mime: string;
|
|
116
|
+
readonly source: {
|
|
117
|
+
readonly type: "inline";
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "uri";
|
|
120
|
+
readonly uri: string;
|
|
121
|
+
};
|
|
122
|
+
readonly name?: string | undefined;
|
|
123
|
+
readonly description?: string | undefined;
|
|
124
|
+
readonly mention?: {
|
|
125
|
+
readonly start: number;
|
|
126
|
+
readonly end: number;
|
|
127
|
+
readonly text: string;
|
|
128
|
+
} | undefined;
|
|
129
|
+
};
|
|
130
|
+
}, Schema.Struct<{
|
|
131
|
+
readonly mime: Schema.String;
|
|
132
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
133
|
+
readonly type: Schema.Literal<"inline">;
|
|
134
|
+
}>, Schema.Struct<{
|
|
135
|
+
readonly type: Schema.Literal<"uri">;
|
|
136
|
+
readonly uri: Schema.String;
|
|
137
|
+
}>]>;
|
|
138
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
139
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
140
|
+
readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
141
|
+
readonly start: Schema.Finite;
|
|
142
|
+
readonly end: Schema.Finite;
|
|
143
|
+
readonly text: Schema.String;
|
|
144
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
145
|
+
readonly start: Schema.Finite;
|
|
146
|
+
readonly end: Schema.Finite;
|
|
147
|
+
readonly text: Schema.String;
|
|
148
|
+
}>>, never, never>;
|
|
149
|
+
readonly uri: Schema.String;
|
|
150
|
+
readonly bytes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
151
|
+
readonly width: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
152
|
+
readonly height: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
153
|
+
}>]>;
|
|
154
|
+
export type Attachment = typeof Attachment.Type;
|
|
59
155
|
export interface AgentAttachment extends Schema.Schema.Type<typeof AgentAttachment> {
|
|
60
156
|
}
|
|
61
157
|
export declare const AgentAttachment: Schema.Struct<{
|
package/dist/prompt.js
CHANGED
|
@@ -13,7 +13,8 @@ export const FileSource = Schema.Union([
|
|
|
13
13
|
])
|
|
14
14
|
.pipe(Schema.toTaggedUnion("type"))
|
|
15
15
|
.annotate({ identifier: "Prompt.FileSource" });
|
|
16
|
-
|
|
16
|
+
// The canonical pattern backtracks on large inputs, so it only supplies metadata (OpenAPI, errors) while an equivalent linear check runs.
|
|
17
|
+
export const Base64 = Schema.String.check(Schema.makeFilter((value) => value.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/u.test(value), Schema.isPattern(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u).annotations)).annotate({ identifier: "Prompt.Base64" });
|
|
17
18
|
export const FileAttachment = Schema.Struct({
|
|
18
19
|
data: Base64,
|
|
19
20
|
mime: Schema.String,
|
|
@@ -33,6 +34,21 @@ export const FileAttachment = Schema.Struct({
|
|
|
33
34
|
mention: input.mention,
|
|
34
35
|
}),
|
|
35
36
|
})));
|
|
37
|
+
/** `media:` and the lowercase hex SHA-256 of a stored blob's bytes. Names no server route. */
|
|
38
|
+
export const MediaRef = Schema.String.check(Schema.isPattern(/^media:[0-9a-f]{64}$/)).annotate({
|
|
39
|
+
identifier: "Prompt.MediaRef",
|
|
40
|
+
});
|
|
41
|
+
const { data: _, ...fileAttachmentFields } = FileAttachment.fields;
|
|
42
|
+
export const MediaFileAttachment = Schema.Struct({
|
|
43
|
+
...fileAttachmentFields,
|
|
44
|
+
uri: MediaRef,
|
|
45
|
+
bytes: Schema.Int.pipe(optional),
|
|
46
|
+
width: Schema.Int.pipe(optional),
|
|
47
|
+
height: Schema.Int.pipe(optional),
|
|
48
|
+
}).annotate({ identifier: "Prompt.MediaFileAttachment" });
|
|
49
|
+
export const Attachment = Schema.Union([FileAttachment, MediaFileAttachment]).annotate({
|
|
50
|
+
identifier: "Prompt.Attachment",
|
|
51
|
+
});
|
|
36
52
|
export const AgentAttachment = Schema.Struct({
|
|
37
53
|
name: Schema.String,
|
|
38
54
|
mention: PromptMention.pipe(optional),
|
package/dist/provider.d.ts
CHANGED
|
@@ -95,6 +95,14 @@ export type Compaction = typeof Compaction.Type;
|
|
|
95
95
|
/** "websocket" on a route without a WebSocket channel warns and falls back to HTTP. */
|
|
96
96
|
export declare const Transport: Schema.Literals<readonly ["http", "websocket"]>;
|
|
97
97
|
export type Transport = typeof Transport.Type;
|
|
98
|
+
/** Prompt-cache lifetime such as "5m", "30m", "1h" or "24h", in models.dev's duration format. */
|
|
99
|
+
export declare const CacheTTL: Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>;
|
|
100
|
+
export type CacheTTL = typeof CacheTTL.Type;
|
|
101
|
+
/** Prompt-cache settings. `ttl` is sent to the provider as given; each provider accepts its own set. */
|
|
102
|
+
export declare const Cache: Schema.Struct<{
|
|
103
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
104
|
+
}>;
|
|
105
|
+
export type Cache = typeof Cache.Type;
|
|
98
106
|
/** HTTP request body compression; only endpoints known to decode it should enable it. */
|
|
99
107
|
export declare const Encoding: Schema.Literals<readonly ["zstd", "gzip", "none"]>;
|
|
100
108
|
export type Encoding = typeof Encoding.Type;
|
|
@@ -111,6 +119,11 @@ export declare const Settings: Schema.StructWithRest<Schema.Struct<{
|
|
|
111
119
|
}>, Schema.Struct<{
|
|
112
120
|
readonly type: Schema.Literal<"native">;
|
|
113
121
|
}>]>>, never, never>;
|
|
122
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
123
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
124
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
125
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
126
|
+
}>>, never, never>;
|
|
114
127
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
115
128
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
116
129
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>;
|
|
@@ -129,6 +142,11 @@ export declare const Overlays: {
|
|
|
129
142
|
}>, Schema.Struct<{
|
|
130
143
|
readonly type: Schema.Literal<"native">;
|
|
131
144
|
}>]>>, never, never>;
|
|
145
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
146
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
147
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
148
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
149
|
+
}>>, never, never>;
|
|
132
150
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
133
151
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
134
152
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
@@ -144,6 +162,11 @@ export declare const Overlays: {
|
|
|
144
162
|
}>, Schema.Struct<{
|
|
145
163
|
readonly type: Schema.Literal<"native">;
|
|
146
164
|
}>]>>, never, never>;
|
|
165
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
166
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
167
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
168
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
169
|
+
}>>, never, never>;
|
|
147
170
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
148
171
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
149
172
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
@@ -166,6 +189,11 @@ export declare const Request: Schema.Struct<{
|
|
|
166
189
|
}>, Schema.Struct<{
|
|
167
190
|
readonly type: Schema.Literal<"native">;
|
|
168
191
|
}>]>>, never, never>;
|
|
192
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
193
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
194
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
195
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
196
|
+
}>>, never, never>;
|
|
169
197
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
170
198
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
171
199
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>;
|
|
@@ -188,6 +216,11 @@ export declare const Info: Schema.Struct<{
|
|
|
188
216
|
}>, Schema.Struct<{
|
|
189
217
|
readonly type: Schema.Literal<"native">;
|
|
190
218
|
}>]>>, never, never>;
|
|
219
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
220
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
221
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
222
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
223
|
+
}>>, never, never>;
|
|
191
224
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
192
225
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
193
226
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
|
|
@@ -203,6 +236,11 @@ export declare const Info: Schema.Struct<{
|
|
|
203
236
|
}>, Schema.Struct<{
|
|
204
237
|
readonly type: Schema.Literal<"native">;
|
|
205
238
|
}>]>>, never, never>;
|
|
239
|
+
readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
240
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
241
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
242
|
+
readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
|
|
243
|
+
}>>, never, never>;
|
|
206
244
|
readonly transport: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["http", "websocket"]>>>, Schema.optionalKey<Schema.Literals<readonly ["http", "websocket"]>>, never, never>;
|
|
207
245
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
208
246
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
@@ -260,6 +298,7 @@ export declare const Info: Schema.Struct<{
|
|
|
260
298
|
readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
261
299
|
readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
262
300
|
readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
|
|
301
|
+
readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
|
|
263
302
|
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
264
303
|
readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<import("./model-compatibility.js").ReasoningField, import("./model-compatibility.js").ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<import("./model-compatibility.js").ReasoningField, import("./model-compatibility.js").ReasoningField, never, never>>, never, never>;
|
|
265
304
|
readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
@@ -269,6 +308,7 @@ export declare const Info: Schema.Struct<{
|
|
|
269
308
|
readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
270
309
|
readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
271
310
|
readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
|
|
311
|
+
readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
|
|
272
312
|
}>>, never, never>;
|
|
273
313
|
}> & {
|
|
274
314
|
empty: (id: ID) => Info;
|
package/dist/provider.js
CHANGED
|
@@ -29,13 +29,24 @@ export const Compaction = Schema.Union([
|
|
|
29
29
|
.annotate({ identifier: "Provider.Compaction" });
|
|
30
30
|
/** "websocket" on a route without a WebSocket channel warns and falls back to HTTP. */
|
|
31
31
|
export const Transport = Schema.Literals(["http", "websocket"]).annotate({ identifier: "Provider.Transport" });
|
|
32
|
+
/** Prompt-cache lifetime such as "5m", "30m", "1h" or "24h", in models.dev's duration format. */
|
|
33
|
+
export const CacheTTL = Schema.TemplateLiteral([Schema.Number, Schema.Literals(["ms", "s", "m", "h", "d"])])
|
|
34
|
+
.check(Schema.isPattern(/^\d+(ms|s|m|h|d)$/))
|
|
35
|
+
.annotate({ identifier: "Provider.CacheTTL" });
|
|
36
|
+
/** Prompt-cache settings. `ttl` is sent to the provider as given; each provider accepts its own set. */
|
|
37
|
+
export const Cache = Schema.Struct({
|
|
38
|
+
ttl: CacheTTL.pipe(optional),
|
|
39
|
+
}).annotate({ identifier: "Provider.Cache" });
|
|
32
40
|
/** HTTP request body compression; only endpoints known to decode it should enable it. */
|
|
33
41
|
export const Encoding = Schema.Literals(["zstd", "gzip", "none"]).annotate({ identifier: "Provider.Encoding" });
|
|
42
|
+
const Timeout = Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional);
|
|
43
|
+
// The named fields are the settings OpenCode reads itself; every other key is a provider option for the provider package.
|
|
34
44
|
export const Settings = Schema.StructWithRest(Schema.Struct({
|
|
35
|
-
timeout:
|
|
36
|
-
headerTimeout:
|
|
37
|
-
chunkTimeout:
|
|
45
|
+
timeout: Timeout,
|
|
46
|
+
headerTimeout: Timeout,
|
|
47
|
+
chunkTimeout: Timeout,
|
|
38
48
|
compaction: Compaction.pipe(optional),
|
|
49
|
+
cache: Cache.pipe(optional),
|
|
39
50
|
transport: Transport.pipe(optional),
|
|
40
51
|
encoding: Encoding.pipe(optional),
|
|
41
52
|
}), [Schema.Record(Schema.String, Schema.Any)]).annotate({ identifier: "Provider.Settings" });
|