@opencode/schema 2.1.4 → 2.2.1

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 (43) hide show
  1. package/dist/agent.d.ts +5 -0
  2. package/dist/config/experimental.d.ts +39 -0
  3. package/dist/config/experimental.js +19 -0
  4. package/dist/config/provider.d.ts +57 -11
  5. package/dist/config/provider.js +15 -16
  6. package/dist/config.d.ts +1 -0
  7. package/dist/config.js +3 -0
  8. package/dist/event-manifest.d.ts +8 -0
  9. package/dist/file-diff.d.ts +2 -0
  10. package/dist/file-diff.js +2 -0
  11. package/dist/generate.d.ts +355 -0
  12. package/dist/generate.js +134 -0
  13. package/dist/goal.d.ts +126 -0
  14. package/dist/goal.js +40 -0
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +1 -1
  17. package/dist/mcp.d.ts +1 -0
  18. package/dist/mcp.js +2 -0
  19. package/dist/model-compatibility.d.ts +15 -4
  20. package/dist/model-compatibility.js +15 -4
  21. package/dist/model.d.ts +39 -8
  22. package/dist/model.js +12 -7
  23. package/dist/plugin.d.ts +15 -0
  24. package/dist/plugin.js +11 -1
  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/schedule.d.ts +220 -0
  30. package/dist/schedule.js +110 -0
  31. package/dist/session-event.d.ts +20 -0
  32. package/dist/session-inbox.d.ts +714 -86
  33. package/dist/session-inbox.js +10 -1
  34. package/dist/session-message.d.ts +968 -0
  35. package/dist/session-message.js +19 -1
  36. package/dist/session-revert.d.ts +37 -0
  37. package/dist/session-transfer.d.ts +4 -0
  38. package/dist/session.d.ts +4 -0
  39. package/dist/usage-limits.d.ts +227 -0
  40. package/dist/usage-limits.js +59 -0
  41. package/dist/vcs.d.ts +3 -0
  42. package/dist/vcs.js +2 -0
  43. package/package.json +2 -1
package/dist/index.d.ts CHANGED
@@ -36,6 +36,6 @@ export { PersistentPty } from "./persistent-pty.js";
36
36
  export { PtyTicket } from "./pty-ticket.js";
37
37
  export { Question } from "./question.js";
38
38
  export { Workspace } from "./workspace.js";
39
- export { Prompt, PromptMention, FileSource, FileAttachment, AgentAttachment } from "./prompt.js";
39
+ export { Prompt, PromptMention, FileSource, FileAttachment, MediaRef, MediaFileAttachment, Attachment, AgentAttachment, } from "./prompt.js";
40
40
  export { PromptInput } from "./prompt-input.js";
41
41
  export * from "./schema.js";
package/dist/index.js CHANGED
@@ -36,6 +36,6 @@ export { PersistentPty } from "./persistent-pty.js";
36
36
  export { PtyTicket } from "./pty-ticket.js";
37
37
  export { Question } from "./question.js";
38
38
  export { Workspace } from "./workspace.js";
39
- export { Prompt, PromptMention, FileSource, FileAttachment, AgentAttachment } from "./prompt.js";
39
+ export { Prompt, PromptMention, FileSource, FileAttachment, MediaRef, MediaFileAttachment, Attachment, AgentAttachment, } from "./prompt.js";
40
40
  export { PromptInput } from "./prompt-input.js";
41
41
  export * from "./schema.js";
package/dist/mcp.d.ts CHANGED
@@ -76,6 +76,7 @@ export declare const Server: Schema.Struct<{
76
76
  readonly status: Schema.Literal<"needs_auth">;
77
77
  readonly error: Schema.String;
78
78
  }>]>;
79
+ readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
79
80
  readonly integrationID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Integration.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Integration.ID">>, never, never>;
80
81
  }>;
81
82
  export interface Resource extends Schema.Schema.Type<typeof Resource> {
package/dist/mcp.js CHANGED
@@ -77,6 +77,8 @@ export const Status = Schema.Union([Connected, Pending, Disabled, Failed, NeedsA
77
77
  export const Server = Schema.Struct({
78
78
  name: Schema.String,
79
79
  status: Status,
80
+ // Display title from the connected server's `serverInfo.title`; absent while disconnected or when not provided.
81
+ title: optional(Schema.String),
80
82
  // Set for remote servers registered as OAuth integrations; lets clients act on the right integration
81
83
  // without matching by name, which could collide with provider or plugin integrations.
82
84
  integrationID: optional(IntegrationID),
@@ -3,26 +3,36 @@ export type ReasoningField = "reasoning" | "reasoning_content" | "reasoning_text
3
3
  export declare const ReasoningField: Schema.Codec<ReasoningField>;
4
4
  export declare const MaxTokensField: Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>;
5
5
  export type MaxTokensField = typeof MaxTokensField.Type;
6
+ /** Where a System One decision host reads media, from models.dev `compatibility.media_input`. */
7
+ export declare const MediaInput: Schema.Literals<readonly ["assets", "state", "root"]>;
8
+ export type MediaInput = typeof MediaInput.Type;
6
9
  export declare const CacheFormat: Schema.Literals<readonly ["anthropic", "alibaba"]>;
7
10
  export type CacheFormat = typeof CacheFormat.Type;
8
11
  export interface Compatibility extends Schema.Schema.Type<typeof Compatibility> {
9
12
  }
10
13
  export declare const Compatibility: Schema.Struct<{
14
+ /** OpenAI Chat: assistant-message field that carries reasoning. Unset uses the streamed field, else `reasoning_content`. */
11
15
  readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<ReasoningField, ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<ReasoningField, ReasoningField, never, never>>, never, never>;
12
- /** Require every assistant message to include its reasoning field, even when empty. */
16
+ /** OpenAI Chat: send the reasoning field on every prior assistant message, even when empty. */
13
17
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
18
+ /** OpenAI Chat: body field for the output token limit. Unset detects it from the provider. */
14
19
  readonly maxTokensField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>>, Schema.optionalKey<Schema.Literals<readonly ["max_completion_tokens", "max_tokens"]>>, never, never>;
20
+ /** OpenAI Chat: fail a stream that ends without `finish_reason`. Defaults to true. */
15
21
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
22
+ /** OpenAI Chat: insert an assistant message between a tool result and the next user message. */
16
23
  readonly requireAssistantAfterTool: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
24
+ /** OpenAI Chat, OpenAI Responses and Mistral: whether the endpoint accepts `prompt_cache_key`. */
17
25
  readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
18
- /** Request usage in the stream with `stream_options.include_usage`. Defaults to true. */
26
+ /** OpenAI Chat: request usage in the stream with `stream_options.include_usage`. Defaults to true. */
19
27
  readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
20
28
  /** Prompt-cache marker syntax the endpoint accepts. Overrides the route default; both send `cache_control`, and `alibaba` skips tool definitions. */
21
29
  readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
22
- /** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
30
+ /** Anthropic Messages and Bedrock Converse: supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
23
31
  readonly supportsThinkingBlockBinding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
24
- /** Supports per-message effort updates. Overrides model-ID detection. */
32
+ /** Anthropic Messages and OpenAI Responses: supports per-message effort updates. Overrides model-ID detection. */
25
33
  readonly supportsEffortUpdates: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
34
+ /** System One: where the decision host reads media. Unset keeps the route default. */
35
+ readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
26
36
  }>;
27
37
  export interface ProviderCompatibility extends Schema.Schema.Type<typeof ProviderCompatibility> {
28
38
  }
@@ -35,4 +45,5 @@ export declare const ProviderCompatibility: Schema.Struct<{
35
45
  readonly supportsPromptCacheKey: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
36
46
  readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
37
47
  readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
48
+ readonly mediaInput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["assets", "state", "root"]>>>, Schema.optionalKey<Schema.Literals<readonly ["assets", "state", "root"]>>, never, never>;
38
49
  }>;
@@ -7,22 +7,33 @@ export const ReasoningField = Schema.Union([
7
7
  export const MaxTokensField = Schema.Literals(["max_completion_tokens", "max_tokens"]).annotate({
8
8
  identifier: "Model.MaxTokensField",
9
9
  });
10
+ /** Where a System One decision host reads media, from models.dev `compatibility.media_input`. */
11
+ export const MediaInput = Schema.Literals(["assets", "state", "root"]).annotate({
12
+ identifier: "Model.MediaInput",
13
+ });
10
14
  export const CacheFormat = Schema.Literals(["anthropic", "alibaba"]).annotate({ identifier: "Model.CacheFormat" });
11
15
  export const Compatibility = Schema.Struct({
16
+ /** OpenAI Chat: assistant-message field that carries reasoning. Unset uses the streamed field, else `reasoning_content`. */
12
17
  reasoningField: ReasoningField.pipe(optional),
13
- /** Require every assistant message to include its reasoning field, even when empty. */
18
+ /** OpenAI Chat: send the reasoning field on every prior assistant message, even when empty. */
14
19
  requireReasoning: Schema.Boolean.pipe(optional),
20
+ /** OpenAI Chat: body field for the output token limit. Unset detects it from the provider. */
15
21
  maxTokensField: MaxTokensField.pipe(optional),
22
+ /** OpenAI Chat: fail a stream that ends without `finish_reason`. Defaults to true. */
16
23
  requireFinishReason: Schema.Boolean.pipe(optional),
24
+ /** OpenAI Chat: insert an assistant message between a tool result and the next user message. */
17
25
  requireAssistantAfterTool: Schema.Boolean.pipe(optional),
26
+ /** OpenAI Chat, OpenAI Responses and Mistral: whether the endpoint accepts `prompt_cache_key`. */
18
27
  supportsPromptCacheKey: Schema.Boolean.pipe(optional),
19
- /** Request usage in the stream with `stream_options.include_usage`. Defaults to true. */
28
+ /** OpenAI Chat: request usage in the stream with `stream_options.include_usage`. Defaults to true. */
20
29
  streamUsage: Schema.Boolean.pipe(optional),
21
30
  /** Prompt-cache marker syntax the endpoint accepts. Overrides the route default; both send `cache_control`, and `alibaba` skips tool definitions. */
22
31
  cacheFormat: CacheFormat.pipe(optional),
23
- /** Supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
32
+ /** Anthropic Messages and Bedrock Converse: supports Anthropic's thinking-prefix mismatch controls. Overrides model-ID detection. */
24
33
  supportsThinkingBlockBinding: Schema.Boolean.pipe(optional),
25
- /** Supports per-message effort updates. Overrides model-ID detection. */
34
+ /** Anthropic Messages and OpenAI Responses: supports per-message effort updates. Overrides model-ID detection. */
26
35
  supportsEffortUpdates: Schema.Boolean.pipe(optional),
36
+ /** System One: where the decision host reads media. Unset keeps the route default. */
37
+ mediaInput: MediaInput.pipe(optional),
27
38
  }).annotate({ identifier: "Model.Compatibility" });
28
39
  export const ProviderCompatibility = Schema.Struct(Struct.omit(Compatibility.fields, ["supportsThinkingBlockBinding", "supportsEffortUpdates"])).annotate({ identifier: "Provider.Compatibility" });
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>;
@@ -185,6 +203,9 @@ export declare const Cost: Schema.Struct<{
185
203
  export interface Variant extends Schema.Schema.Type<typeof Variant> {
186
204
  }
187
205
  export declare const Variant: Schema.Struct<{
206
+ readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
207
+ readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
208
+ readonly id: Schema.brand<Schema.String, "Model.VariantID">;
188
209
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
189
210
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
190
211
  readonly type: Schema.Literal<"summary">;
@@ -208,9 +229,6 @@ export declare const Variant: Schema.Struct<{
208
229
  }>]>>, never, never>;
209
230
  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
231
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
211
- readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
212
- readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
213
- readonly id: Schema.brand<Schema.String, "Model.VariantID">;
214
232
  }>;
215
233
  export interface Info extends Schema.Schema.Type<typeof Info> {
216
234
  }
@@ -225,6 +243,11 @@ export declare const Info: Schema.Struct<{
225
243
  }>, Schema.Struct<{
226
244
  readonly type: Schema.Literal<"native">;
227
245
  }>]>>, never, never>;
246
+ readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
247
+ 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>;
248
+ }>>>, Schema.optionalKey<Schema.Struct<{
249
+ 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>;
250
+ }>>, never, never>;
228
251
  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
252
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
230
253
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -236,6 +259,11 @@ export declare const Info: Schema.Struct<{
236
259
  }>, Schema.Struct<{
237
260
  readonly type: Schema.Literal<"native">;
238
261
  }>]>>, never, never>;
262
+ readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
263
+ 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>;
264
+ }>>>, Schema.optionalKey<Schema.Struct<{
265
+ 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>;
266
+ }>>, never, never>;
239
267
  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
268
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
241
269
  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 +308,7 @@ export declare const Info: Schema.Struct<{
280
308
  mistral: string & import("effect/Brand").Brand<"Provider.ID">;
281
309
  gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
282
310
  }>, never, never>;
311
+ 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
312
  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
313
  readonly name: Schema.String;
285
314
  readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
@@ -293,6 +322,7 @@ export declare const Info: Schema.Struct<{
293
322
  readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
294
323
  readonly supportsThinkingBlockBinding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
295
324
  readonly supportsEffortUpdates: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
325
+ 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
326
  }>>>, Schema.optionalKey<Schema.Struct<{
297
327
  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
328
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -304,6 +334,7 @@ export declare const Info: Schema.Struct<{
304
334
  readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
305
335
  readonly supportsThinkingBlockBinding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
306
336
  readonly supportsEffortUpdates: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
337
+ 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
338
  }>>, never, never>;
308
339
  readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
309
340
  readonly capabilities: Schema.Struct<{
@@ -320,6 +351,9 @@ export declare const Info: Schema.Struct<{
320
351
  };
321
352
  };
322
353
  readonly variants: Schema.$Array<Schema.Struct<{
354
+ readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
355
+ readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
356
+ readonly id: Schema.brand<Schema.String, "Model.VariantID">;
323
357
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
324
358
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
325
359
  readonly type: Schema.Literal<"summary">;
@@ -343,9 +377,6 @@ export declare const Info: Schema.Struct<{
343
377
  }>]>>, never, never>;
344
378
  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
379
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
346
- readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
347
- readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
348
- readonly id: Schema.brand<Schema.String, "Model.VariantID">;
349
380
  }>>;
350
381
  readonly time: Schema.Struct<{
351
382
  readonly released: Schema.Finite;
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,14 +33,17 @@ 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 Settings = Schema.StructWithRest(Schema.Struct({
39
- compaction: Provider.Compaction.pipe(optional),
40
- encoding: Provider.Encoding.pipe(optional),
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" });
45
+ // Variants switch request settings. The prompt cache belongs to the model, so a variant can't change it.
46
+ const VariantSettings = Schema.StructWithRest(Schema.Struct(Struct.omit(Settings.schema.fields, ["cache"])), Settings.records).annotate({ identifier: "Model.VariantSettings" });
44
47
  export const Overlays = {
45
48
  settings: Settings.pipe(optional),
46
49
  headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
@@ -72,12 +75,14 @@ export const Cost = Schema.Struct({
72
75
  export const Variant = Schema.Struct({
73
76
  id: VariantID,
74
77
  ...Overlays,
78
+ settings: VariantSettings.pipe(optional),
75
79
  }).annotate({ identifier: "Model.Variant" });
76
80
  export const Info = Schema.Struct({
77
81
  id: ID,
78
82
  modelID: ID,
79
83
  providerID: Provider.ID,
80
84
  canonical: Provider.ID.pipe(optional),
85
+ type: Type.pipe(optional),
81
86
  family: Family.pipe(optional),
82
87
  name: Schema.String,
83
88
  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
- 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),