@opencode/schema 2.1.3 → 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.
Files changed (50) hide show
  1. package/dist/agent.d.ts +5 -0
  2. package/dist/config/experimental.d.ts +2 -0
  3. package/dist/config/experimental.js +6 -0
  4. package/dist/config/provider.d.ts +73 -7
  5. package/dist/config/provider.js +10 -15
  6. package/dist/event-manifest.d.ts +128 -366
  7. package/dist/file-diff.d.ts +2 -0
  8. package/dist/file-diff.js +2 -0
  9. package/dist/generate.d.ts +355 -0
  10. package/dist/generate.js +134 -0
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/mcp.d.ts +1 -0
  14. package/dist/mcp.js +2 -0
  15. package/dist/model-compatibility.d.ts +15 -4
  16. package/dist/model-compatibility.js +15 -4
  17. package/dist/model.d.ts +53 -2
  18. package/dist/model.js +9 -7
  19. package/dist/permission.d.ts +0 -9
  20. package/dist/persistent-pty.d.ts +0 -20
  21. package/dist/plugin.d.ts +15 -0
  22. package/dist/plugin.js +11 -1
  23. package/dist/prompt-input.d.ts +3 -36
  24. package/dist/prompt-input.js +2 -6
  25. package/dist/prompt.d.ts +96 -0
  26. package/dist/prompt.js +17 -1
  27. package/dist/provider.d.ts +40 -0
  28. package/dist/provider.js +14 -3
  29. package/dist/session-event.d.ts +320 -852
  30. package/dist/session-event.js +0 -7
  31. package/dist/session-fork.d.ts +2 -2
  32. package/dist/session-id.d.ts +0 -1
  33. package/dist/session-id.js +3 -7
  34. package/dist/session-inbox.d.ts +721 -101
  35. package/dist/session-inbox.js +10 -1
  36. package/dist/session-message.d.ts +998 -31
  37. package/dist/session-message.js +19 -2
  38. package/dist/session-revert.d.ts +64 -27
  39. package/dist/session-status-event.d.ts +0 -8
  40. package/dist/session-transfer.d.ts +23 -24
  41. package/dist/session.d.ts +12 -22
  42. package/dist/usage-limits.d.ts +227 -0
  43. package/dist/usage-limits.js +59 -0
  44. package/dist/v1/legacy-event.d.ts +0 -4
  45. package/dist/v1/permission.d.ts +0 -10
  46. package/dist/v1/session.d.ts +0 -177
  47. package/dist/vcs.d.ts +3 -0
  48. package/dist/vcs.js +2 -0
  49. package/dist/workspace-id.js +0 -2
  50. package/package.json +5 -3
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
- export const Base64 = Schema.String.check(Schema.isPattern(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u)).annotate({ identifier: "Prompt.Base64" });
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),
@@ -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: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
36
- headerTimeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
37
- chunkTimeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
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" });