@opencode/schema 0.0.0-dev-21922 → 0.0.0-dev-44

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.
@@ -1,5 +1,6 @@
1
1
  export * as ConfigProvider from "./provider.js";
2
2
  import { Schema } from "effect";
3
+ import { Model, Type } from "../model.js";
3
4
  export declare const Settings: Schema.StructWithRest<Schema.Struct<{
4
5
  readonly timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
5
6
  readonly headerTimeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.Literal<false>]>>, never, never>;
@@ -145,7 +146,7 @@ export declare const Reasoning: Schema.Union<readonly [Schema.Struct<{
145
146
  }>>, never, never>;
146
147
  }>]>;
147
148
  export type Reasoning = typeof Reasoning.Type;
148
- declare const Model_base: Schema.Class<Model, Schema.Struct<{
149
+ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
149
150
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
150
151
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
151
152
  readonly type: Schema.Literal<"summary">;
@@ -182,11 +183,12 @@ declare const Model_base: Schema.Class<Model, Schema.Struct<{
182
183
  readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
183
184
  readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
184
185
  readonly modelID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.ID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.ID">>, never, never>;
186
+ readonly type: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Type, Type, never, never>>>, Schema.optionalKey<Schema.Codec<Type, Type, never, never>>, never, never>;
185
187
  readonly family: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.Family">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.Family">>, never, never>;
186
188
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
187
189
  readonly releaseDate: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
188
190
  readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
189
- 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>;
191
+ readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
190
192
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
191
193
  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>;
192
194
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -197,7 +199,7 @@ declare const Model_base: Schema.Class<Model, Schema.Struct<{
197
199
  readonly supportsThinkingBlockBinding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
198
200
  readonly supportsEffortUpdates: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
199
201
  }>>>, Schema.optionalKey<Schema.Struct<{
200
- 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>;
202
+ readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
201
203
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
202
204
  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>;
203
205
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -353,7 +355,7 @@ declare const Model_base: Schema.Class<Model, Schema.Struct<{
353
355
  readonly disabled: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
354
356
  readonly limit: Schema.decodeTo<Schema.optional<Schema.toType<typeof Limit>>, Schema.optionalKey<typeof Limit>, never, never>;
355
357
  }>, {}>;
356
- declare class Model extends Model_base {
358
+ declare class ModelConfig extends ModelConfig_base {
357
359
  }
358
360
  declare const Info_base: Schema.Class<Info, Schema.Struct<{
359
361
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
@@ -428,7 +430,7 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
428
430
  readonly env: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.String>>>, Schema.optionalKey<Schema.$Array<Schema.String>>, never, never>;
429
431
  readonly package: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
430
432
  readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
431
- 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>;
433
+ readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
432
434
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
433
435
  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>;
434
436
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -437,7 +439,7 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
437
439
  readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
438
440
  readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
439
441
  }>>>, Schema.optionalKey<Schema.Struct<{
440
- 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>;
442
+ readonly reasoningField: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>>, Schema.optionalKey<Schema.Codec<Model.ReasoningField, Model.ReasoningField, never, never>>, never, never>;
441
443
  readonly requireReasoning: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
442
444
  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>;
443
445
  readonly requireFinishReason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -446,7 +448,7 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
446
448
  readonly streamUsage: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
447
449
  readonly cacheFormat: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["anthropic", "alibaba"]>>>, Schema.optionalKey<Schema.Literals<readonly ["anthropic", "alibaba"]>>, never, never>;
448
450
  }>>, never, never>;
449
- readonly models: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, typeof Model>>>, Schema.optionalKey<Schema.$Record<Schema.String, typeof Model>>, never, never>;
451
+ readonly models: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, typeof ModelConfig>>>, Schema.optionalKey<Schema.$Record<Schema.String, typeof ModelConfig>>, never, never>;
450
452
  }>, {}>;
451
453
  export declare class Info extends Info_base {
452
454
  }
@@ -1,24 +1,16 @@
1
1
  export * as ConfigProvider from "./provider.js";
2
2
  import { Schema } from "effect";
3
3
  import { Money } from "../money.js";
4
- import { Capabilities, Compatibility, Family, ID, VariantID } from "../model.js";
4
+ import { Capabilities, Compatibility, Family, ID, Model, Type, VariantID } from "../model.js";
5
5
  import { ProviderCompatibility } from "../model-compatibility.js";
6
6
  import { Provider } from "../provider.js";
7
7
  import { optional } from "../schema.js";
8
- export const Settings = Schema.StructWithRest(Schema.Struct({
9
- timeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
10
- headerTimeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
11
- chunkTimeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
12
- compaction: Provider.Compaction.pipe(optional),
13
- cache: Provider.Cache.pipe(optional),
14
- transport: Provider.Transport.pipe(optional),
15
- encoding: Provider.Encoding.pipe(optional),
16
- }), [Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json))]).annotate({ identifier: "Config.Provider.Settings" });
17
- export const ModelSettings = Schema.StructWithRest(Schema.Struct({
18
- compaction: Provider.Compaction.pipe(optional),
19
- cache: Provider.Cache.pipe(optional),
20
- encoding: Provider.Encoding.pipe(optional),
21
- }), [Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json))]).annotate({ identifier: "Config.Model.Settings" });
8
+ export const Settings = Schema.StructWithRest(Schema.Struct(Provider.Settings.schema.fields), [
9
+ Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json)),
10
+ ]).annotate({ identifier: "Config.Provider.Settings" });
11
+ export const ModelSettings = Schema.StructWithRest(Schema.Struct(Model.Settings.schema.fields), [
12
+ Schema.Record(Schema.String, Schema.UndefinedOr(Schema.Json)),
13
+ ]).annotate({ identifier: "Config.Model.Settings" });
22
14
  const JsonRecord = Schema.Record(Schema.String, Schema.Json);
23
15
  export const Overlays = {
24
16
  settings: Settings.pipe(optional),
@@ -69,8 +61,9 @@ export const Reasoning = Schema.Union([
69
61
  }).pipe(optional),
70
62
  }),
71
63
  ]).annotate({ identifier: "Config.Model.Reasoning" });
72
- class Model extends Schema.Class("Config.Model")({
64
+ class ModelConfig extends Schema.Class("Config.Model")({
73
65
  modelID: ID.pipe(optional),
66
+ type: Type.pipe(optional),
74
67
  family: Family.pipe(optional),
75
68
  name: Schema.String.pipe(optional),
76
69
  releaseDate: Schema.String.check(Schema.isPattern(/^\d{4}-\d{2}(-\d{2})?$/u))
@@ -106,6 +99,6 @@ export class Info extends Schema.Class("Config.Provider")({
106
99
  // Defaults for every model of this provider; model compatibility overrides individual fields.
107
100
  compatibility: ProviderCompatibility.pipe(optional),
108
101
  ...Overlays,
109
- models: Schema.Record(Schema.String, Model).pipe(optional),
102
+ models: Schema.Record(Schema.String, ModelConfig).pipe(optional),
110
103
  }) {
111
104
  }
@@ -1555,11 +1555,14 @@ export interface Ref extends Schema.Schema.Type<typeof Ref> {
1555
1555
  export declare const Ref: Schema.Struct<{
1556
1556
  readonly id: Schema.brand<Schema.String, "Integration.ID">;
1557
1557
  readonly name: Schema.String;
1558
+ /** Declared in provider configuration, independently of credential connections. */
1559
+ readonly configured: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
1558
1560
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
1559
1561
  }>;
1560
1562
  export declare const Info: Schema.Struct<{
1561
1563
  readonly id: Schema.brand<Schema.String, "Integration.ID">;
1562
1564
  readonly name: Schema.String;
1565
+ readonly configured: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
1563
1566
  readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
1564
1567
  readonly methods: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
1565
1568
  readonly id: Schema.brand<Schema.String, "Integration.MethodID">;
@@ -47,11 +47,14 @@ export const Event = { Updated, Definitions: inventory(Updated) };
47
47
  export const Ref = Schema.Struct({
48
48
  id: ID,
49
49
  name: Schema.String,
50
+ /** Declared in provider configuration, independently of credential connections. */
51
+ configured: optional(Schema.Boolean),
50
52
  metadata: optional(Schema.Record(Schema.String, Schema.Any)),
51
53
  }).annotate({ identifier: "Integration.Ref" });
52
54
  export const Info = Schema.Struct({
53
55
  id: ID,
54
56
  name: Schema.String,
57
+ configured: optional(Schema.Boolean),
55
58
  metadata: optional(Schema.Record(Schema.String, Schema.Any)),
56
59
  methods: Schema.Array(Method),
57
60
  connections: Schema.Array(Connection.Info),
package/dist/model.d.ts CHANGED
@@ -102,6 +102,9 @@ export interface Ref extends Schema.Schema.Type<typeof Ref> {
102
102
  export { Compatibility, MaxTokensField, 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">;
@@ -315,6 +318,7 @@ export declare const Info: Schema.Struct<{
315
318
  mistral: string & import("effect/Brand").Brand<"Provider.ID">;
316
319
  gitlab: string & import("effect/Brand").Brand<"Provider.ID">;
317
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>;
318
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>;
319
323
  readonly name: Schema.String;
320
324
  readonly compatibility: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
package/dist/model.js CHANGED
@@ -1,5 +1,5 @@
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
5
  import { Compatibility, MaxTokensField, ReasoningField } from "./model-compatibility.js";
@@ -35,11 +35,11 @@ export const Ref = Schema.Struct({
35
35
  })));
36
36
  export { Compatibility, MaxTokensField, 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
- cache: Provider.Cache.pipe(optional),
41
- encoding: Provider.Encoding.pipe(optional),
42
- }),
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"])),
43
43
  // Provider packages may define arbitrary model-level options beyond OpenCode's shared compaction policy.
44
44
  [Schema.Record(Schema.String, Schema.Any)]).annotate({ identifier: "Model.Settings" });
45
45
  export const Overlays = {
@@ -79,6 +79,7 @@ export const Info = Schema.Struct({
79
79
  modelID: ID,
80
80
  providerID: Provider.ID,
81
81
  canonical: Provider.ID.pipe(optional),
82
+ type: Type.pipe(optional),
82
83
  family: Family.pipe(optional),
83
84
  name: Schema.String,
84
85
  compatibility: Compatibility.pipe(optional),
package/dist/provider.js CHANGED
@@ -39,10 +39,12 @@ export const Cache = Schema.Struct({
39
39
  }).annotate({ identifier: "Provider.Cache" });
40
40
  /** HTTP request body compression; only endpoints known to decode it should enable it. */
41
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.
42
44
  export const Settings = Schema.StructWithRest(Schema.Struct({
43
- timeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
44
- headerTimeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
45
- chunkTimeout: Schema.Union([Schema.Finite, Schema.Literal(false)]).pipe(optional),
45
+ timeout: Timeout,
46
+ headerTimeout: Timeout,
47
+ chunkTimeout: Timeout,
46
48
  compaction: Compaction.pipe(optional),
47
49
  cache: Cache.pipe(optional),
48
50
  transport: Transport.pipe(optional),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/schema",
4
- "version": "0.0.0-dev-21922",
4
+ "version": "0.0.0-dev-44",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "scripts": {
29
29
  "build": "bun run script/build.ts",
30
+ "pack": "bun run script/pack.ts",
30
31
  "test": "bun test --only-failures",
31
32
  "typecheck": "bun check --no-script",
32
33
  "typecheck:tsc": "tsc --noEmit"