@opencode/schema 0.0.0-dev-1338 → 0.0.0-dev-1343
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/automation.js +1 -0
- package/dist/config/experimental.d.ts +2 -0
- package/dist/config/experimental.js +1 -1
- package/dist/config/flag.d.ts +4 -0
- package/dist/config/flag.js +5 -1
- package/dist/model.d.ts +48 -0
- package/dist/model.js +10 -0
- package/dist/prompt-input.js +3 -1
- package/dist/prompt.js +4 -1
- package/dist/session-inbox.js +4 -1
- package/dist/shell.js +5 -2
- package/dist/tool.d.ts +8 -0
- package/package.json +1 -1
package/dist/automation.js
CHANGED
|
@@ -119,6 +119,7 @@ export const CodeActionInput = Schema.Struct({
|
|
|
119
119
|
description: [
|
|
120
120
|
"Code Mode JavaScript run on each trigger with no model (32 KB output cap).",
|
|
121
121
|
'Call tools statically as tools.<ns>.<tool>(...) or tools["ns-name"].tool(...); each is authorized once at creation to run unattended.',
|
|
122
|
+
"A shell command still running at its timeout is stopped and the call throws; it never moves to the background.",
|
|
122
123
|
"Receives input = { state, now, runs, args } (also globals): state starts null, now is epoch ms, runs counts earlier runs.",
|
|
123
124
|
"Event triggers also receive input.event = { id, timestamp, data }; data follows the event type's payloadSchema.",
|
|
124
125
|
"Return nothing, or { state?, done?, send? }. JSON state is kept for the next run; done: true stops. lastOutput shows the delivery target and any logs.",
|
|
@@ -104,6 +104,8 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
|
|
|
104
104
|
readonly home_memory: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
105
105
|
readonly machines: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
106
106
|
readonly media_blob: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
107
|
+
readonly model_speeds: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
108
|
+
readonly opencode_api: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
107
109
|
readonly project_overlay: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
108
110
|
readonly recommended_api: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
109
111
|
readonly sqlite_fts: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
@@ -15,7 +15,7 @@ export class Info extends Schema.Class("ConfigExperimental.Info")({
|
|
|
15
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.",
|
|
16
16
|
}),
|
|
17
17
|
...Record.map(ConfigFlag.registry, (description, key) => Schema.Boolean.pipe(optional).annotate({
|
|
18
|
-
description: ConfigFlag.optInOnly.has(key)
|
|
18
|
+
description: ConfigFlag.optInOnly.has(key) || ConfigFlag.localOnly.has(key)
|
|
19
19
|
? description
|
|
20
20
|
: `${description} Defaults to on in local and dev builds and off in releases.`,
|
|
21
21
|
})),
|
package/dist/config/flag.d.ts
CHANGED
|
@@ -11,11 +11,15 @@ export declare const registry: {
|
|
|
11
11
|
readonly artifacts: "Enable experimental artifacts backed by pluggable providers.";
|
|
12
12
|
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.";
|
|
13
13
|
readonly recommended_api: "Use each model's recommended API from models.dev instead of the first API it lists.";
|
|
14
|
+
readonly model_speeds: "Offer a model's faster and slower service tiers (fast, flex…) as speeds of that model: one entry in the model picker with a speed selector, instead of a separate entry per tier such as gpt-5.5-fast.";
|
|
14
15
|
readonly full_codemode: "Enable the full Code Mode work in progress.";
|
|
15
16
|
readonly machines: "Let a tool path name a machine, as in gpu:/work/train.py, and act on that machine's files and processes.";
|
|
16
17
|
readonly home_memory: "Give sessions in the home folder a persistent memory/, docs/ and scripts/ workspace the agent can use freely, tidied by a daily maintenance session that reads the day's home-folder conversations.";
|
|
17
18
|
readonly project_overlay: "Load a personal config dir for each project from ~/.config/opencode/project/<project-id>/, read like an extra .opencode dir that ranks above the repo's own, and let home memory keep the skills it builds for the user there.";
|
|
19
|
+
readonly opencode_api: 'Let Code Mode scripts call the OpenCode HTTP API with fetch("opencode:///api/..."), in-process and already signed in, with no permission checks. Only in local and dev builds, and off there until you opt in with OPENCODE_FLAGS=opencode_api or experimental.opencode_api: true.';
|
|
18
20
|
readonly sqlite_fts: "Build an SQLite full-text index of session titles and message text in the background, and enable the opencode.session.search and opencode.session.read tools. The index covers every session in the database and starts while any loaded location enables it; SQLite keeps it current from then on, also after this is turned off.";
|
|
19
21
|
};
|
|
20
22
|
export type Key = keyof typeof registry;
|
|
21
23
|
export declare const optInOnly: ReadonlySet<Key>;
|
|
24
|
+
/** Flags that stay off outside local and dev builds, whatever `OPENCODE_FLAGS` or config say. */
|
|
25
|
+
export declare const localOnly: ReadonlySet<Key>;
|
package/dist/config/flag.js
CHANGED
|
@@ -11,10 +11,14 @@ export const registry = {
|
|
|
11
11
|
artifacts: "Enable experimental artifacts backed by pluggable providers.",
|
|
12
12
|
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.",
|
|
13
13
|
recommended_api: "Use each model's recommended API from models.dev instead of the first API it lists.",
|
|
14
|
+
model_speeds: "Offer a model's faster and slower service tiers (fast, flex…) as speeds of that model: one entry in the model picker with a speed selector, instead of a separate entry per tier such as gpt-5.5-fast.",
|
|
14
15
|
full_codemode: "Enable the full Code Mode work in progress.",
|
|
15
16
|
machines: "Let a tool path name a machine, as in gpu:/work/train.py, and act on that machine's files and processes.",
|
|
16
17
|
home_memory: "Give sessions in the home folder a persistent memory/, docs/ and scripts/ workspace the agent can use freely, tidied by a daily maintenance session that reads the day's home-folder conversations.",
|
|
17
18
|
project_overlay: "Load a personal config dir for each project from ~/.config/opencode/project/<project-id>/, read like an extra .opencode dir that ranks above the repo's own, and let home memory keep the skills it builds for the user there.",
|
|
19
|
+
opencode_api: 'Let Code Mode scripts call the OpenCode HTTP API with fetch("opencode:///api/..."), in-process and already signed in, with no permission checks. Only in local and dev builds, and off there until you opt in with OPENCODE_FLAGS=opencode_api or experimental.opencode_api: true.',
|
|
18
20
|
sqlite_fts: "Build an SQLite full-text index of session titles and message text in the background, and enable the opencode.session.search and opencode.session.read tools. The index covers every session in the database and starts while any loaded location enables it; SQLite keeps it current from then on, also after this is turned off.",
|
|
19
21
|
};
|
|
20
|
-
export const optInOnly = new Set(["todo"]);
|
|
22
|
+
export const optInOnly = new Set(["todo", "opencode_api"]);
|
|
23
|
+
/** Flags that stay off outside local and dev builds, whatever `OPENCODE_FLAGS` or config say. */
|
|
24
|
+
export const localOnly = new Set(["opencode_api"]);
|
package/dist/model.d.ts
CHANGED
|
@@ -275,6 +275,20 @@ export declare const Variant: Schema.Struct<{
|
|
|
275
275
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
276
276
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
277
277
|
}>;
|
|
278
|
+
/**
|
|
279
|
+
* Set on a model that is another model served faster or slower, such as "gpt-5.5-fast" for "gpt-5.5". Clients offer
|
|
280
|
+
* it as a speed of that model instead of listing it.
|
|
281
|
+
*/
|
|
282
|
+
export interface Speed extends Schema.Schema.Type<typeof Speed> {
|
|
283
|
+
}
|
|
284
|
+
export declare const Speed: Schema.Struct<{
|
|
285
|
+
/** The same provider's model at its standard speed. */
|
|
286
|
+
readonly base: Schema.brand<Schema.String, "Model.ID">;
|
|
287
|
+
/** The speed's name, such as "fast" or "flex". */
|
|
288
|
+
readonly id: Schema.String;
|
|
289
|
+
/** Whether it is faster than the standard speed. A slower speed trades latency for a lower price. */
|
|
290
|
+
readonly faster: Schema.Boolean;
|
|
291
|
+
}>;
|
|
278
292
|
export interface Info extends Schema.Schema.Type<typeof Info> {
|
|
279
293
|
}
|
|
280
294
|
export declare const Info: Schema.Struct<{
|
|
@@ -456,6 +470,40 @@ export declare const Info: Schema.Struct<{
|
|
|
456
470
|
readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
|
|
457
471
|
}>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
|
|
458
472
|
}>>;
|
|
473
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
474
|
+
readonly experimental: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
475
|
+
readonly speed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
476
|
+
/** The same provider's model at its standard speed. */
|
|
477
|
+
readonly base: Schema.brand<Schema.String, "Model.ID">;
|
|
478
|
+
/** The speed's name, such as "fast" or "flex". */
|
|
479
|
+
readonly id: Schema.String;
|
|
480
|
+
/** Whether it is faster than the standard speed. A slower speed trades latency for a lower price. */
|
|
481
|
+
readonly faster: Schema.Boolean;
|
|
482
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
483
|
+
/** The same provider's model at its standard speed. */
|
|
484
|
+
readonly base: Schema.brand<Schema.String, "Model.ID">;
|
|
485
|
+
/** The speed's name, such as "fast" or "flex". */
|
|
486
|
+
readonly id: Schema.String;
|
|
487
|
+
/** Whether it is faster than the standard speed. A slower speed trades latency for a lower price. */
|
|
488
|
+
readonly faster: Schema.Boolean;
|
|
489
|
+
}>>, never, never>;
|
|
490
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
491
|
+
readonly speed: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
492
|
+
/** The same provider's model at its standard speed. */
|
|
493
|
+
readonly base: Schema.brand<Schema.String, "Model.ID">;
|
|
494
|
+
/** The speed's name, such as "fast" or "flex". */
|
|
495
|
+
readonly id: Schema.String;
|
|
496
|
+
/** Whether it is faster than the standard speed. A slower speed trades latency for a lower price. */
|
|
497
|
+
readonly faster: Schema.Boolean;
|
|
498
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
499
|
+
/** The same provider's model at its standard speed. */
|
|
500
|
+
readonly base: Schema.brand<Schema.String, "Model.ID">;
|
|
501
|
+
/** The speed's name, such as "fast" or "flex". */
|
|
502
|
+
readonly id: Schema.String;
|
|
503
|
+
/** Whether it is faster than the standard speed. A slower speed trades latency for a lower price. */
|
|
504
|
+
readonly faster: Schema.Boolean;
|
|
505
|
+
}>>, never, never>;
|
|
506
|
+
}>>, never, never>;
|
|
459
507
|
readonly time: Schema.Struct<{
|
|
460
508
|
readonly released: Schema.Finite;
|
|
461
509
|
}>;
|
package/dist/model.js
CHANGED
|
@@ -80,6 +80,14 @@ export const Variant = Schema.Struct({
|
|
|
80
80
|
...Overlays,
|
|
81
81
|
settings: VariantSettings.pipe(optional),
|
|
82
82
|
}).annotate({ identifier: "Model.Variant" });
|
|
83
|
+
export const Speed = Schema.Struct({
|
|
84
|
+
/** The same provider's model at its standard speed. */
|
|
85
|
+
base: ID,
|
|
86
|
+
/** The speed's name, such as "fast" or "flex". */
|
|
87
|
+
id: Schema.String,
|
|
88
|
+
/** Whether it is faster than the standard speed. A slower speed trades latency for a lower price. */
|
|
89
|
+
faster: Schema.Boolean,
|
|
90
|
+
}).annotate({ identifier: "Model.Speed" });
|
|
83
91
|
export const Info = Schema.Struct({
|
|
84
92
|
id: ID,
|
|
85
93
|
modelID: ID,
|
|
@@ -93,6 +101,8 @@ export const Info = Schema.Struct({
|
|
|
93
101
|
...Overlays,
|
|
94
102
|
capabilities: Capabilities,
|
|
95
103
|
variants: Schema.Array(Variant),
|
|
104
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
105
|
+
experimental: Schema.Struct({ speed: Speed.pipe(optional) }).pipe(optional),
|
|
96
106
|
time: Schema.Struct({
|
|
97
107
|
released: Schema.Finite,
|
|
98
108
|
}),
|
package/dist/prompt-input.js
CHANGED
|
@@ -4,7 +4,9 @@ import { AgentAttachment, FileSource, PromptMention } from "./prompt.js";
|
|
|
4
4
|
import { optional } from "./schema.js";
|
|
5
5
|
import { Skill } from "./skill.js";
|
|
6
6
|
export const FileAttachment = Schema.Struct({
|
|
7
|
-
uri: Schema.String
|
|
7
|
+
uri: Schema.String.annotate({
|
|
8
|
+
description: "A file: URL on the server (a file, a directory, or ?start=N&end=M for lines of a text file), a data: URL, or a media: ref from a message. Up to 20 MB.",
|
|
9
|
+
}),
|
|
8
10
|
// Source metadata does not require reopening the original file.
|
|
9
11
|
source: FileSource.pipe(optional),
|
|
10
12
|
name: Schema.String.pipe(optional),
|
package/dist/prompt.js
CHANGED
|
@@ -52,7 +52,10 @@ export const Attachment = Schema.Union([FileAttachment, MediaFileAttachment]).an
|
|
|
52
52
|
export const AgentAttachment = Schema.Struct({
|
|
53
53
|
name: Schema.String,
|
|
54
54
|
mention: PromptMention.pipe(optional),
|
|
55
|
-
}).annotate({
|
|
55
|
+
}).annotate({
|
|
56
|
+
identifier: "Prompt.AgentAttachment",
|
|
57
|
+
description: "An agent @-mentioned in the prompt, such as @explore, to suggest the model use it. Only the @name in text reaches the model; this records which agent it names and doesn't change the session's own agent.",
|
|
58
|
+
});
|
|
56
59
|
export const SkillAttachment = Schema.Struct({
|
|
57
60
|
id: Skill.ID,
|
|
58
61
|
name: Skill.Name,
|
package/dist/session-inbox.js
CHANGED
|
@@ -6,7 +6,10 @@ import { Attachment, Prompt } from "./prompt.js";
|
|
|
6
6
|
import { DateTimeUtcFromMillis, optional, RelativePath } from "./schema.js";
|
|
7
7
|
import { SessionID } from "./session-id.js";
|
|
8
8
|
import { SessionMessage } from "./session-message.js";
|
|
9
|
-
export const Delivery = Schema.Literals(["steer", "queue"]).annotate({
|
|
9
|
+
export const Delivery = Schema.Literals(["steer", "queue"]).annotate({
|
|
10
|
+
identifier: "Session.Inbox.Delivery",
|
|
11
|
+
description: "steer delivers before the agent's next model call, even mid-work. queue waits until the agent finishes its current work, then delivers one queued item at a time. Sending defaults to steer.",
|
|
12
|
+
});
|
|
10
13
|
export const UserPayload = Schema.Struct({
|
|
11
14
|
...Prompt.fields,
|
|
12
15
|
metadata: Schema.Record(Schema.String, Schema.Unknown).pipe(optional),
|
package/dist/shell.js
CHANGED
|
@@ -47,9 +47,12 @@ export const CreateInput = Schema.Struct({
|
|
|
47
47
|
timeout: optional(NonNegativeInt),
|
|
48
48
|
metadata: optional(Metadata),
|
|
49
49
|
});
|
|
50
|
+
// Descriptions sit on the inner schema because the query string codec drops annotations on `optional` itself.
|
|
50
51
|
export const OutputInput = Schema.Struct({
|
|
51
|
-
cursor: optional(NonNegativeInt
|
|
52
|
-
|
|
52
|
+
cursor: optional(NonNegativeInt.annotateKey({
|
|
53
|
+
description: "Byte offset to read from, such as the cursor of the previous page. Defaults to 0.",
|
|
54
|
+
})),
|
|
55
|
+
limit: optional(NonNegativeInt.annotateKey({ description: "Maximum number of bytes to return. Defaults to 65536." })),
|
|
53
56
|
});
|
|
54
57
|
export const Output = Schema.Struct({
|
|
55
58
|
output: Schema.String,
|
package/dist/tool.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * as Tool from "./tool.js";
|
|
|
2
2
|
import { Effect, JsonSchema, Schema } from "effect";
|
|
3
3
|
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
import type { Agent } from "./agent.js";
|
|
5
|
+
import type { Automation } from "./automation.js";
|
|
5
6
|
import type { Session } from "./session.js";
|
|
6
7
|
import type { SessionMessage } from "./session-message.js";
|
|
7
8
|
export type Metadata = Readonly<Record<string, any>>;
|
|
@@ -32,6 +33,13 @@ export interface Context {
|
|
|
32
33
|
readonly cancel?: Effect.Effect<void>;
|
|
33
34
|
/** True when the tool is invoked from inside Code Mode (`execute`). */
|
|
34
35
|
readonly codemode?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Set when an automation's code makes the call. No model waits on it, and nobody hears about work it leaves
|
|
38
|
+
* running, so a tool must finish its work within the call.
|
|
39
|
+
*/
|
|
40
|
+
readonly automation?: {
|
|
41
|
+
readonly id: Automation.ID;
|
|
42
|
+
};
|
|
35
43
|
}
|
|
36
44
|
export interface Namespace {
|
|
37
45
|
readonly name: string;
|