@opencode/schema 0.0.0-dev-1312 → 0.0.0-dev-1314

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.
@@ -4,6 +4,44 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
4
4
  readonly portable_shell_scanner: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
5
5
  readonly codemode_vm: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
6
6
  readonly all_flags: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
7
+ readonly todo: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
8
+ readonly video_generate: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Boolean, Schema.Struct<{
9
+ readonly model: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.Struct<{
10
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
11
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
12
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
13
+ }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
14
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
15
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
16
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
17
+ }>]>, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.Struct<{
18
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
19
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
20
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
21
+ }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
22
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
23
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
24
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
25
+ }>]>, never, never>>, never, never>;
26
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.Struct<{
27
+ readonly model: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.Struct<{
28
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
29
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
30
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
31
+ }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
32
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
33
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
34
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
35
+ }>]>, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.Struct<{
36
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
37
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
38
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
39
+ }>, Schema.Union<readonly [Schema.String, Schema.Struct<{
40
+ readonly providerID: Schema.brand<Schema.String, "Provider.ID">;
41
+ readonly model: Schema.brand<Schema.String, "Model.ID">;
42
+ readonly variant: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Model.VariantID">>>, Schema.optionalKey<Schema.brand<Schema.String, "Model.VariantID">>, never, never>;
43
+ }>]>, never, never>>, never, never>;
44
+ }>]>>, never, never>;
7
45
  readonly schedules: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
8
46
  readonly part_rows: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
9
47
  readonly image_generate: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Boolean, Schema.Struct<{
@@ -68,8 +106,6 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
68
106
  readonly full_codemode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
69
107
  readonly mcp_events: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
70
108
  readonly media_blob: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
71
- readonly todo: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
72
- readonly video_generate: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
73
109
  }>, {}>;
74
110
  export declare class Info extends Info_base {
75
111
  }
@@ -12,13 +12,27 @@ export class Info extends Schema.Class("ConfigExperimental.Info")({
12
12
  description: "Deprecated: ignored because Code Mode always runs on the VM.",
13
13
  }),
14
14
  all_flags: Schema.Boolean.pipe(optional).annotate({
15
- description: "Enable all flags except opt-in-only flags on any build channel, like OPENCODE_FLAGS=all. Per-flag config settings take precedence over all_flags; false leaves the build defaults in effect.",
15
+ description: "Turn every feature flag on regardless of the build channel, like OPENCODE_FLAGS=all; explicit per-flag settings still win, and false is not a kill switch.",
16
16
  }),
17
- ...Record.map(ConfigFlag.registry, (description, key) => Schema.Boolean.pipe(optional).annotate({
18
- description: ConfigFlag.optInOnly.has(key)
19
- ? description
20
- : `${description} Defaults to on in local and dev builds and off in releases.`,
17
+ todo: Schema.Boolean.pipe(optional).annotate({
18
+ description: "Enable the experimental todowrite tool. Defaults to false.",
19
+ }),
20
+ ...Record.map(ConfigFlag.registry, (description) => Schema.Boolean.pipe(optional).annotate({
21
+ description: `${description} Defaults to on in local and dev builds and off in releases.`,
21
22
  })),
23
+ // The flag also takes settings; an object turns it on.
24
+ video_generate: Schema.Union([
25
+ Schema.Boolean,
26
+ Schema.Struct({
27
+ model: ConfigModel.Selection.pipe(optional).annotate({
28
+ description: "Default model for the experimental_video_generate tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
29
+ }),
30
+ }),
31
+ ])
32
+ .pipe(optional)
33
+ .annotate({
34
+ description: `${ConfigFlag.registry.video_generate} Defaults to on in local and dev builds and off in releases. An object turns it on and sets the tool's options.`,
35
+ }),
22
36
  schedules: Schema.Boolean.pipe(optional).annotate({
23
37
  description: "Deprecated: use experimental.automations.",
24
38
  }),
@@ -1,22 +1,21 @@
1
1
  export * as ConfigFlag from "./flag.js";
2
- /** The `OPENCODE_FLAGS` entry that enables all flags except opt-in-only flags, as in `all,-media_blob`. */
2
+ /** The `OPENCODE_FLAGS` entry that turns every flag on, as in `all,-media_blob`. It is not a flag key. */
3
3
  export declare const wildcard = "all";
4
4
  /**
5
- * Flags default to on in local and dev builds and off in releases, except for `optInOnly` flags, which must be
6
- * named explicitly in `experimental.<key>` or `OPENCODE_FLAGS`. Read a flag with Core's `Flag.enabled("<key>")`.
5
+ * Every feature flag, by key, with what it turns on. Flags default to on in local and dev builds and off in releases;
6
+ * `experimental.<key>` in config and `OPENCODE_FLAGS` override that, and `OPENCODE_FLAGS=all` or
7
+ * `experimental.all_flags: true` turn every flag on. Read one with Core's `Flag.enabled("<key>")`.
7
8
  */
8
9
  export declare const registry: {
9
- readonly todo: "Enable the experimental todowrite tool. Off by default in every build, including local and dev; opt in with OPENCODE_FLAGS=todo or experimental.todo: true.";
10
10
  readonly media_blob: "Store new session media once in a deduplicated blob table instead of inline in every message row.";
11
11
  readonly automations: "Run a prompt or Code Mode action on a timer, or on a connected MCP server's push event when mcp_events is enabled.";
12
12
  readonly artifacts: "Enable experimental artifacts backed by pluggable providers.";
13
- readonly video_generate: "Enable the experimental video generation API.";
13
+ readonly video_generate: "Enable experimental video generation: the HTTP API that starts a video job and stores the result, and the agent tool that saves the videos into the workspace.";
14
14
  readonly console_watches: "Watch Slack threads, GitHub pull requests, issues, commits and Actions runs, and the workspace's MCP servers' events through OpenCode Console, and wake sessions when they change.";
15
15
  readonly mcp_events: "Enable experimental MCP Events, a draft MCP extension: declare support to MCP servers and read the events of servers that offer them.";
16
- readonly full_codemode: "Enable the full Code Mode work in progress. Off by default in every build, including local and dev; opt in with OPENCODE_FLAGS=full_codemode or experimental.full_codemode: true.";
16
+ readonly full_codemode: "Enable the full Code Mode work in progress.";
17
17
  };
18
18
  export type Key = keyof typeof registry;
19
- export declare const optInOnly: ReadonlySet<Key>;
20
19
  /** Earlier names of a flag, still read from `experimental.<name>` and `OPENCODE_FLAGS` when the new key is unset. */
21
20
  export declare const aliases: {
22
21
  readonly schedules: "automations";
@@ -1,21 +1,20 @@
1
1
  export * as ConfigFlag from "./flag.js";
2
- /** The `OPENCODE_FLAGS` entry that enables all flags except opt-in-only flags, as in `all,-media_blob`. */
2
+ /** The `OPENCODE_FLAGS` entry that turns every flag on, as in `all,-media_blob`. It is not a flag key. */
3
3
  export const wildcard = "all";
4
4
  /**
5
- * Flags default to on in local and dev builds and off in releases, except for `optInOnly` flags, which must be
6
- * named explicitly in `experimental.<key>` or `OPENCODE_FLAGS`. Read a flag with Core's `Flag.enabled("<key>")`.
5
+ * Every feature flag, by key, with what it turns on. Flags default to on in local and dev builds and off in releases;
6
+ * `experimental.<key>` in config and `OPENCODE_FLAGS` override that, and `OPENCODE_FLAGS=all` or
7
+ * `experimental.all_flags: true` turn every flag on. Read one with Core's `Flag.enabled("<key>")`.
7
8
  */
8
9
  export const registry = {
9
- todo: "Enable the experimental todowrite tool. Off by default in every build, including local and dev; opt in with OPENCODE_FLAGS=todo or experimental.todo: true.",
10
10
  media_blob: "Store new session media once in a deduplicated blob table instead of inline in every message row.",
11
11
  automations: "Run a prompt or Code Mode action on a timer, or on a connected MCP server's push event when mcp_events is enabled.",
12
12
  artifacts: "Enable experimental artifacts backed by pluggable providers.",
13
- video_generate: "Enable the experimental video generation API.",
13
+ video_generate: "Enable experimental video generation: the HTTP API that starts a video job and stores the result, and the agent tool that saves the videos into the workspace.",
14
14
  console_watches: "Watch Slack threads, GitHub pull requests, issues, commits and Actions runs, and the workspace's MCP servers' events through OpenCode Console, and wake sessions when they change.",
15
15
  mcp_events: "Enable experimental MCP Events, a draft MCP extension: declare support to MCP servers and read the events of servers that offer them.",
16
- full_codemode: "Enable the full Code Mode work in progress. Off by default in every build, including local and dev; opt in with OPENCODE_FLAGS=full_codemode or experimental.full_codemode: true.",
16
+ full_codemode: "Enable the full Code Mode work in progress.",
17
17
  };
18
- export const optInOnly = new Set(["todo", "full_codemode"]);
19
18
  /** Earlier names of a flag, still read from `experimental.<name>` and `OPENCODE_FLAGS` when the new key is unset. */
20
19
  export const aliases = {
21
20
  schedules: "automations",
package/dist/generate.js CHANGED
@@ -85,7 +85,7 @@ export const VideoRequest = Schema.Struct({
85
85
  }).annotate({ identifier: "Generate.VideoRequest" });
86
86
  export const VideoErrorReason = Schema.Literals(["failed", "cancelled", "expired", "unknown"]).annotate({
87
87
  identifier: "Generate.VideoErrorReason",
88
- description: "failed: the provider failed the job. cancelled: the provider cancelled it. expired: the provider expired it. unknown: the provider gave no result in time, or the server stopped while submitting the job",
88
+ description: "failed: the provider failed the job. cancelled: the provider cancelled it. expired: the provider expired it. unknown: the provider gave no result in time",
89
89
  });
90
90
  export const VideoRunning = Schema.Struct({
91
91
  id: VideoID,
package/dist/job.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * as Job from "./job.js";
2
2
  import { Schema } from "effect";
3
- export declare const Kind: Schema.Literals<readonly ["shell", "subagent", "image", "codemode"]>;
3
+ export declare const Kind: Schema.Literals<readonly ["shell", "subagent", "image", "video", "codemode"]>;
4
4
  export type Kind = typeof Kind.Type;
5
5
  export declare const Status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
6
6
  export type Status = typeof Status.Type;
@@ -64,6 +64,22 @@ export declare const Image: Schema.Struct<{
64
64
  readonly path: Schema.String;
65
65
  readonly model: Schema.String;
66
66
  }>;
67
+ export interface Video extends Schema.Schema.Type<typeof Video> {
68
+ }
69
+ export declare const Video: Schema.Struct<{
70
+ readonly id: Schema.String;
71
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
72
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
73
+ };
74
+ readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
75
+ readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
76
+ readonly time: Schema.Struct<{
77
+ readonly started: Schema.Finite;
78
+ readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
79
+ }>;
80
+ readonly kind: Schema.tag<"video">;
81
+ readonly path: Schema.String;
82
+ }>;
67
83
  export interface CodeMode extends Schema.Schema.Type<typeof CodeMode> {
68
84
  }
69
85
  export declare const CodeMode: Schema.Struct<{
@@ -124,6 +140,19 @@ export declare const Info: Schema.Union<readonly [Schema.Struct<{
124
140
  readonly kind: Schema.tag<"image">;
125
141
  readonly path: Schema.String;
126
142
  readonly model: Schema.String;
143
+ }>, Schema.Struct<{
144
+ readonly id: Schema.String;
145
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
146
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
147
+ };
148
+ readonly status: Schema.Literals<readonly ["running", "completed", "error", "cancelled"]>;
149
+ readonly title: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
150
+ readonly time: Schema.Struct<{
151
+ readonly started: Schema.Finite;
152
+ readonly completed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Finite>>, Schema.optionalKey<Schema.Finite>, never, never>;
153
+ }>;
154
+ readonly kind: Schema.tag<"video">;
155
+ readonly path: Schema.String;
127
156
  }>, Schema.Struct<{
128
157
  readonly id: Schema.String;
129
158
  readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
package/dist/job.js CHANGED
@@ -2,7 +2,9 @@ export * as Job from "./job.js";
2
2
  import { Schema } from "effect";
3
3
  import { optional } from "./schema.js";
4
4
  import { SessionID } from "./session-id.js";
5
- export const Kind = Schema.Literals(["shell", "subagent", "image", "codemode"]).annotate({ identifier: "Job.Kind" });
5
+ export const Kind = Schema.Literals(["shell", "subagent", "image", "video", "codemode"]).annotate({
6
+ identifier: "Job.Kind",
7
+ });
6
8
  export const Status = Schema.Literals(["running", "completed", "error", "cancelled"]).annotate({
7
9
  identifier: "Job.Status",
8
10
  });
@@ -38,7 +40,12 @@ export const Image = Schema.Struct({
38
40
  path: Schema.String,
39
41
  model: Schema.String,
40
42
  }).annotate({ identifier: "Job.Image" });
43
+ export const Video = Schema.Struct({
44
+ kind: Schema.tag("video"),
45
+ ...Base,
46
+ path: Schema.String,
47
+ }).annotate({ identifier: "Job.Video" });
41
48
  export const CodeMode = Schema.Struct({ kind: Schema.tag("codemode"), ...Base }).annotate({
42
49
  identifier: "Job.CodeMode",
43
50
  });
44
- export const Info = Schema.Union([Shell, Subagent, Image, CodeMode]).pipe(Schema.toTaggedUnion("kind"), Schema.annotate({ identifier: "Job.Info" }));
51
+ export const Info = Schema.Union([Shell, Subagent, Image, Video, CodeMode]).pipe(Schema.toTaggedUnion("kind"), Schema.annotate({ identifier: "Job.Info" }));
package/dist/tool.d.ts CHANGED
@@ -30,25 +30,28 @@ export interface Context {
30
30
  * has; a tool that does not is interrupted.
31
31
  */
32
32
  readonly cancel?: Effect.Effect<void>;
33
+ /** True when the tool is invoked from inside Code Mode (`execute`). */
34
+ readonly codemode?: boolean;
33
35
  }
34
36
  export interface Namespace {
35
37
  readonly name: string;
36
38
  readonly description: string;
37
39
  }
38
- interface BaseOptions {
40
+ export interface Options<CMInput extends ValueSchema<any> = ValueSchema<any>, CMOutput extends ValueSchema<any> | undefined = ValueSchema<any> | undefined> {
39
41
  readonly namespace?: string;
40
42
  readonly permission?: string;
41
- }
42
- export type Options = BaseOptions & ({
43
- readonly codemode?: true;
43
+ readonly codemode?: boolean | {
44
+ readonly pinned?: boolean;
45
+ readonly description?: string;
46
+ readonly input?: CMInput;
47
+ readonly output?: CMOutput;
48
+ };
49
+ /** @deprecated Use `codemode.pinned` instead. Removed in the next minor. */
44
50
  readonly pinned?: boolean;
45
- } | {
46
- readonly codemode: boolean;
47
- readonly pinned?: never;
48
- });
51
+ }
49
52
  export type ValueSchema<A = unknown> = Schema.Codec<A, any> | StandardSchemaV1<any, A> | JsonSchema.JsonSchema;
50
53
  type InputValue<S> = 0 extends 1 & S ? any : S extends Schema.Codec<infer A, any> ? A : S extends StandardSchemaV1<any, infer A> ? A : unknown;
51
- type OutputValue<S> = S extends undefined ? never : S extends Schema.Codec<infer A, any> ? A : S extends StandardSchemaV1<infer A, any> ? A : any;
54
+ type OutputValue<S> = 0 extends 1 & S ? any : S extends undefined ? never : S extends Schema.Codec<infer A, any> ? A : S extends StandardSchemaV1<infer A, any> ? A : any;
52
55
  declare const Error_base: Schema.Class<Error, Schema.TaggedStruct<"Tool.Error", {
53
56
  readonly message: Schema.String;
54
57
  readonly error: Schema.optional<Schema.Defect>;
@@ -85,12 +88,12 @@ export interface Result<Output extends ValueSchema<any> | undefined = ValueSchem
85
88
  readonly content?: string | ReadonlyArray<Content>;
86
89
  readonly metadata?: Metadata;
87
90
  }
88
- export type Info<Input extends ValueSchema<any> = ValueSchema<any>, Output extends ValueSchema<any> | undefined = ValueSchema<any> | undefined> = {
91
+ export type Info<Input extends ValueSchema<any> = ValueSchema<any>, Output extends ValueSchema<any> | undefined = ValueSchema<any> | undefined, CMInput extends ValueSchema<any> = Input, CMOutput extends ValueSchema<any> | undefined = Output> = {
89
92
  readonly name: string;
90
93
  readonly input: Input;
91
94
  readonly freeform?: Freeform;
92
95
  readonly description: string;
93
- readonly execute: (input: InputValue<Input>, context: Context) => Effect.Effect<Result<Output>, Error>;
96
+ readonly execute: (input: InputValue<Input> | InputValue<CMInput>, context: Context) => Effect.Effect<Result<Output | CMOutput>, Error>;
94
97
  readonly output?: Output;
95
- readonly options?: Options;
98
+ readonly options?: Options<CMInput, CMOutput>;
96
99
  };
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-1312",
4
+ "version": "0.0.0-dev-1314",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {