@opencode/schema 2.4.1 → 2.4.2

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/agent.d.ts CHANGED
@@ -107,6 +107,19 @@ export declare const Info: Schema.Struct<{
107
107
  readonly body: Schema.$Record<Schema.String, Schema.Any>;
108
108
  }>;
109
109
  readonly system: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
110
+ /**
111
+ * Added to the default prompt while the agent is selected, without replacing it like `system`. A string is
112
+ * introduced as this agent's instructions, and core tells the model when they stop applying. `{ selected, unselected }`
113
+ * sends both texts exactly as written: `selected` while the agent is selected, `unselected` once when the session
114
+ * switches away.
115
+ */
116
+ readonly instructions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.String, Schema.Struct<{
117
+ readonly selected: Schema.String;
118
+ readonly unselected: Schema.String;
119
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Struct<{
120
+ readonly selected: Schema.String;
121
+ readonly unselected: Schema.String;
122
+ }>]>>, never, never>;
110
123
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
111
124
  readonly mode: Schema.Literals<readonly ["subagent", "primary", "all"]>;
112
125
  readonly hidden: Schema.Boolean;
package/dist/agent.js CHANGED
@@ -16,6 +16,13 @@ export const Info = Schema.Struct({
16
16
  model: Model.Ref.pipe(optional),
17
17
  request: Provider.Request,
18
18
  system: Schema.String.pipe(optional),
19
+ /**
20
+ * Added to the default prompt while the agent is selected, without replacing it like `system`. A string is
21
+ * introduced as this agent's instructions, and core tells the model when they stop applying. `{ selected, unselected }`
22
+ * sends both texts exactly as written: `selected` while the agent is selected, `unselected` once when the session
23
+ * switches away.
24
+ */
25
+ instructions: Schema.Union([Schema.String, Schema.Struct({ selected: Schema.String, unselected: Schema.String })]).pipe(optional),
19
26
  description: Schema.String.pipe(optional),
20
27
  mode: Schema.Literals(["subagent", "primary", "all"]),
21
28
  hidden: Schema.Boolean,
@@ -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.",
@@ -99,10 +99,12 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
99
99
  readonly effect: Schema.Literals<readonly ["allow", "deny"]>;
100
100
  }>, never, never>>>, never, never>;
101
101
  readonly artifacts: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
102
+ readonly compaction_jobs: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
102
103
  readonly console_watches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
103
104
  readonly full_codemode: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
104
105
  readonly home_memory: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
105
106
  readonly machines: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
107
+ readonly mcp_skills: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
106
108
  readonly media_blob: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
107
109
  readonly model_speeds: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
108
110
  readonly opencode_api: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -17,6 +17,8 @@ export declare const registry: {
17
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.";
18
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
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.';
20
+ readonly mcp_skills: "Load skills from MCP servers that offer them (the io.modelcontextprotocol/skills extension), named <server>:<skill>. A server that offers skills no longer has its instructions included.";
21
+ readonly compaction_jobs: "List a session's subagents, with their session IDs, and its running background jobs in its compaction checkpoints, so the agent can still continue or account for them after compacting.";
20
22
  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.";
21
23
  };
22
24
  export type Key = keyof typeof registry;
@@ -17,6 +17,8 @@ export const registry = {
17
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.",
18
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
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.',
20
+ mcp_skills: "Load skills from MCP servers that offer them (the io.modelcontextprotocol/skills extension), named <server>:<skill>. A server that offers skills no longer has its instructions included.",
21
+ compaction_jobs: "List a session's subagents, with their session IDs, and its running background jobs in its compaction checkpoints, so the agent can still continue or account for them after compacting.",
20
22
  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.",
21
23
  };
22
24
  export const optInOnly = new Set(["todo", "opencode_api"]);
@@ -6120,6 +6120,38 @@ export declare const ServerDefinitions: readonly [Schema.Struct<{
6120
6120
  durability: "ephemeral";
6121
6121
  durable: undefined;
6122
6122
  data: Schema.Struct<{}>;
6123
+ }, Schema.Struct<{
6124
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
6125
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
6126
+ };
6127
+ readonly created: Schema.Finite;
6128
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
6129
+ readonly type: Schema.Literal<"experimental.push.updated">;
6130
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
6131
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
6132
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
6133
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6134
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6135
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
6136
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6137
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6138
+ }>, never, never>;
6139
+ }>>>, Schema.optionalKey<Schema.Struct<{
6140
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
6141
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
6142
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6143
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6144
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
6145
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
6146
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
6147
+ }>, never, never>;
6148
+ }>>, never, never>;
6149
+ readonly data: Schema.Struct<{}>;
6150
+ }> & {
6151
+ type: "experimental.push.updated";
6152
+ durability: "ephemeral";
6153
+ durable: undefined;
6154
+ data: Schema.Struct<{}>;
6123
6155
  }, Schema.Struct<{
6124
6156
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
6125
6157
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -12858,6 +12890,38 @@ export declare const Definitions: readonly [Schema.Struct<{
12858
12890
  durability: "ephemeral";
12859
12891
  durable: undefined;
12860
12892
  data: Schema.Struct<{}>;
12893
+ }, Schema.Struct<{
12894
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
12895
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
12896
+ };
12897
+ readonly created: Schema.Finite;
12898
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
12899
+ readonly type: Schema.Literal<"experimental.push.updated">;
12900
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
12901
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
12902
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
12903
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
12904
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
12905
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
12906
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
12907
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
12908
+ }>, never, never>;
12909
+ }>>>, Schema.optionalKey<Schema.Struct<{
12910
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
12911
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
12912
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
12913
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
12914
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
12915
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
12916
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
12917
+ }>, never, never>;
12918
+ }>>, never, never>;
12919
+ readonly data: Schema.Struct<{}>;
12920
+ }> & {
12921
+ type: "experimental.push.updated";
12922
+ durability: "ephemeral";
12923
+ durable: undefined;
12924
+ data: Schema.Struct<{}>;
12861
12925
  }, Schema.Struct<{
12862
12926
  readonly id: Schema.brand<Schema.String, "Event.ID"> & {
12863
12927
  create: () => string & import("effect/Brand").Brand<"Event.ID">;
@@ -37,9 +37,10 @@ import { VcsEvent } from "./vcs-event.js";
37
37
  import { WorkspaceEvent } from "./workspace-event.js";
38
38
  import { WorktreeEvent } from "./worktree-event.js";
39
39
  import { WebSearch } from "./websearch.js";
40
+ import { Push } from "./push.js";
40
41
  const coreDefinitions = Event.inventory(...SessionEvent.Definitions);
41
42
  const foundationDefinitions = Event.inventory(...LocationEvent.Definitions, ...ModelsDev.Event.Definitions, ...Credential.Event.Definitions, ...Integration.Event.Definitions, ...Provider.Event.Definitions, ...Model.Event.Definitions, ...Agent.Event.Definitions, ...coreDefinitions);
42
- const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...Project.Event.Definitions, ...Worktree.Event.Definitions, ...Command.Event.Definitions, ...Config.Event.Definitions, ...Skill.Event.Definitions, ...Pty.Event.Definitions, ...PersistentPty.Event.Definitions, ...Shell.Event.Definitions, ...Job.Event.Definitions, ...Form.Event.Definitions, ...WebSearch.Event.Definitions, ...Artifact.Event.Definitions);
43
+ const featureDefinitions = Event.inventory(...FileSystem.Event.Definitions, ...Reference.Event.Definitions, ...Permission.Event.Definitions, ...Plugin.Event.Definitions, ...Project.Event.Definitions, ...Worktree.Event.Definitions, ...Command.Event.Definitions, ...Config.Event.Definitions, ...Skill.Event.Definitions, ...Pty.Event.Definitions, ...PersistentPty.Event.Definitions, ...Shell.Event.Definitions, ...Job.Event.Definitions, ...Form.Event.Definitions, ...WebSearch.Event.Definitions, ...Push.Event.Definitions, ...Artifact.Event.Definitions);
43
44
  export const ServerDefinitions = Event.inventory(...foundationDefinitions, ...featureDefinitions,
44
45
  // Current events the TUI consumes from the public stream.
45
46
  ...SessionStatusEvent.Definitions, ...TuiEvent.Definitions, ...InstallationEvent.Definitions, ...VcsEvent.Definitions, McpEvent.StatusChanged, McpEvent.ResourcesChanged, McpEvent.ExperimentalEvent);
@@ -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({ identifier: "Prompt.AgentAttachment" });
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/push.d.ts ADDED
@@ -0,0 +1,173 @@
1
+ export * as Push from "./push.js";
2
+ import { Schema } from "effect";
3
+ export declare const DeviceID: Schema.brand<Schema.String, "Push.DeviceID">;
4
+ export type DeviceID = typeof DeviceID.Type;
5
+ export declare const Time: Schema.Int;
6
+ export declare const Level: Schema.Literals<readonly ["all", "attention", "none"]>;
7
+ export type Level = typeof Level.Type;
8
+ export interface Bell extends Schema.Schema.Type<typeof Bell> {
9
+ }
10
+ export declare const Bell: Schema.Struct<{
11
+ readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
12
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
13
+ }>;
14
+ export interface Settings extends Schema.Schema.Type<typeof Settings> {
15
+ }
16
+ export declare const Settings: Schema.Struct<{
17
+ readonly paused: Schema.Boolean;
18
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
19
+ }>;
20
+ export interface DeviceSettings extends Schema.Schema.Type<typeof DeviceSettings> {
21
+ }
22
+ export declare const DeviceSettings: Schema.Struct<{
23
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
24
+ }>;
25
+ export declare const Platform: Schema.Literals<readonly ["android", "ios"]>;
26
+ export type Platform = typeof Platform.Type;
27
+ export interface Register extends Schema.Schema.Type<typeof Register> {
28
+ }
29
+ export declare const Register: Schema.Struct<{
30
+ readonly callbackURL: Schema.String;
31
+ readonly expiresAt: Schema.Int;
32
+ readonly publicKey: Schema.String;
33
+ readonly platform: Schema.Literals<readonly ["android", "ios"]>;
34
+ readonly name: Schema.String;
35
+ readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
36
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
37
+ }>>>, Schema.optionalKey<Schema.Struct<{
38
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
39
+ }>>, never, never>;
40
+ }>;
41
+ export interface Registered extends Schema.Schema.Type<typeof Registered> {
42
+ }
43
+ export declare const Registered: Schema.Struct<{
44
+ readonly publicKey: Schema.String;
45
+ }>;
46
+ export interface DevicePatch extends Schema.Schema.Type<typeof DevicePatch> {
47
+ }
48
+ export declare const DevicePatch: Schema.Struct<{
49
+ readonly paused: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
50
+ readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
51
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
52
+ }>>>, Schema.optionalKey<Schema.Struct<{
53
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
54
+ }>>, never, never>;
55
+ }>;
56
+ export interface Device extends Schema.Schema.Type<typeof Device> {
57
+ }
58
+ export declare const Device: Schema.Struct<{
59
+ readonly id: Schema.brand<Schema.String, "Push.DeviceID">;
60
+ readonly name: Schema.String;
61
+ readonly platform: Schema.Literals<readonly ["android", "ios"]>;
62
+ readonly expiresAt: Schema.Int;
63
+ readonly settings: Schema.Struct<{
64
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
65
+ }>;
66
+ readonly paused: Schema.Boolean;
67
+ readonly sessions: Schema.$Record<Schema.String, Schema.Struct<{
68
+ readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
69
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
70
+ }>>;
71
+ readonly time: Schema.Struct<{
72
+ readonly created: Schema.Int;
73
+ readonly updated: Schema.Int;
74
+ }>;
75
+ }>;
76
+ export interface Info extends Schema.Schema.Type<typeof Info> {
77
+ }
78
+ export declare const Info: Schema.Struct<{
79
+ readonly settings: Schema.Struct<{
80
+ readonly paused: Schema.Boolean;
81
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
82
+ }>;
83
+ readonly devices: Schema.$Array<Schema.Struct<{
84
+ readonly id: Schema.brand<Schema.String, "Push.DeviceID">;
85
+ readonly name: Schema.String;
86
+ readonly platform: Schema.Literals<readonly ["android", "ios"]>;
87
+ readonly expiresAt: Schema.Int;
88
+ readonly settings: Schema.Struct<{
89
+ readonly default: Schema.Literals<readonly ["all", "attention", "none"]>;
90
+ }>;
91
+ readonly paused: Schema.Boolean;
92
+ readonly sessions: Schema.$Record<Schema.String, Schema.Struct<{
93
+ readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
94
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
95
+ }>>;
96
+ readonly time: Schema.Struct<{
97
+ readonly created: Schema.Int;
98
+ readonly updated: Schema.Int;
99
+ }>;
100
+ }>>;
101
+ readonly sessions: Schema.$Record<Schema.String, Schema.Struct<{
102
+ readonly level: Schema.Literals<readonly ["all", "attention", "none"]>;
103
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
104
+ }>>;
105
+ }>;
106
+ export declare const Event: {
107
+ Updated: Schema.Struct<{
108
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
109
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
110
+ };
111
+ readonly created: Schema.Finite;
112
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
113
+ readonly type: Schema.Literal<"experimental.push.updated">;
114
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
115
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
116
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
117
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
118
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
119
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
120
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
121
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
122
+ }>, never, never>;
123
+ }>>>, Schema.optionalKey<Schema.Struct<{
124
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
125
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
126
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
127
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
128
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
129
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
130
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
131
+ }>, never, never>;
132
+ }>>, never, never>;
133
+ readonly data: Schema.Struct<{}>;
134
+ }> & {
135
+ type: "experimental.push.updated";
136
+ durability: "ephemeral";
137
+ durable: undefined;
138
+ data: Schema.Struct<{}>;
139
+ };
140
+ Definitions: readonly [Schema.Struct<{
141
+ readonly id: Schema.brand<Schema.String, "Event.ID"> & {
142
+ create: () => string & import("effect/Brand").Brand<"Event.ID">;
143
+ };
144
+ readonly created: Schema.Finite;
145
+ readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
146
+ readonly type: Schema.Literal<"experimental.push.updated">;
147
+ readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
148
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
149
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
150
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
151
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
152
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
153
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
154
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
155
+ }>, never, never>;
156
+ }>>>, Schema.optionalKey<Schema.Struct<{
157
+ readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
158
+ readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
159
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
160
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
161
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
162
+ ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
163
+ create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
164
+ }>, never, never>;
165
+ }>>, never, never>;
166
+ readonly data: Schema.Struct<{}>;
167
+ }> & {
168
+ type: "experimental.push.updated";
169
+ durability: "ephemeral";
170
+ durable: undefined;
171
+ data: Schema.Struct<{}>;
172
+ }];
173
+ };
package/dist/push.js ADDED
@@ -0,0 +1,56 @@
1
+ export * as Push from "./push.js";
2
+ import { Schema } from "effect";
3
+ import { ephemeral, inventory } from "./event.js";
4
+ import { NonNegativeInt, optional } from "./schema.js";
5
+ export const DeviceID = Schema.String.check(Schema.isPattern(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)).pipe(Schema.brand("Push.DeviceID"), Schema.annotate({ identifier: "Push.DeviceID", description: "A lowercase canonical UUID chosen by the phone" }));
6
+ export const Time = NonNegativeInt.annotate({
7
+ description: "Milliseconds since the Unix epoch",
8
+ });
9
+ export const Level = Schema.Literals(["all", "attention", "none"]).annotate({ identifier: "Push.Level" });
10
+ export const Bell = Schema.Struct({
11
+ level: Level,
12
+ until: Time.pipe(optional),
13
+ }).annotate({ identifier: "Push.Bell" });
14
+ export const Settings = Schema.Struct({
15
+ paused: Schema.Boolean,
16
+ until: Time.pipe(optional),
17
+ }).annotate({ identifier: "Push.Settings" });
18
+ export const DeviceSettings = Schema.Struct({
19
+ default: Level,
20
+ }).annotate({ identifier: "Push.DeviceSettings" });
21
+ export const Platform = Schema.Literals(["android", "ios"]).annotate({ identifier: "Push.Platform" });
22
+ export const Register = Schema.Struct({
23
+ callbackURL: Schema.String,
24
+ expiresAt: Time,
25
+ publicKey: Schema.String,
26
+ platform: Platform,
27
+ name: Schema.String,
28
+ settings: DeviceSettings.pipe(optional),
29
+ }).annotate({ identifier: "Push.Register" });
30
+ export const Registered = Schema.Struct({
31
+ publicKey: Schema.String,
32
+ }).annotate({ identifier: "Push.Registered" });
33
+ export const DevicePatch = Schema.Struct({
34
+ paused: Schema.Boolean.pipe(optional),
35
+ settings: DeviceSettings.pipe(optional),
36
+ }).annotate({ identifier: "Push.DevicePatch" });
37
+ export const Device = Schema.Struct({
38
+ id: DeviceID,
39
+ name: Schema.String,
40
+ platform: Platform,
41
+ expiresAt: Time,
42
+ settings: DeviceSettings,
43
+ paused: Schema.Boolean,
44
+ sessions: Schema.Record(Schema.String, Bell),
45
+ time: Schema.Struct({
46
+ created: Time,
47
+ updated: Time,
48
+ }),
49
+ }).annotate({ identifier: "Push.Device" });
50
+ export const Info = Schema.Struct({
51
+ settings: Settings,
52
+ devices: Schema.Array(Device),
53
+ sessions: Schema.Record(Schema.String, Bell),
54
+ }).annotate({ identifier: "Push.Info" });
55
+ const Updated = ephemeral({ type: "experimental.push.updated", schema: {} });
56
+ export const Event = { Updated, Definitions: inventory(Updated) };
@@ -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({ identifier: "Session.Inbox.Delivery" });
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
- limit: optional(NonNegativeInt),
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/skill.js CHANGED
@@ -19,7 +19,9 @@ export const Info = Schema.Struct({
19
19
  description: Schema.String.pipe(optional),
20
20
  autoinvoke: Schema.Boolean.pipe(optional),
21
21
  path: AbsolutePath,
22
- content: Schema.String,
22
+ content: Schema.String.annotate({
23
+ description: "The SKILL.md body. Empty for a skill whose body loads on demand, such as an MCP skill.",
24
+ }),
23
25
  }).annotate({ identifier: "Skill.Info" });
24
26
  const Updated = ephemeral({ type: "skill.updated", schema: {} });
25
27
  export const Event = { Updated, Definitions: inventory(Updated) };
package/dist/tool.d.ts CHANGED
@@ -2,18 +2,27 @@ 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>>;
8
- /** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
9
+ /**
10
+ * Optional wire encoding of a tool's single required string field. Execution still receives the object.
11
+ *
12
+ * `field` names that required string field, so the tool can have other parameters. Models that take raw text then set
13
+ * those on an optional first line, which the AI package describes and parses; the format constrains the rest.
14
+ */
9
15
  export declare const Freeform: Schema.Union<readonly [Schema.Struct<{
10
16
  readonly type: Schema.Literal<"text">;
17
+ readonly field: Schema.optionalKey<Schema.String>;
11
18
  }>, Schema.Struct<{
12
19
  readonly type: Schema.Literal<"regex">;
13
20
  readonly pattern: Schema.String;
21
+ readonly field: Schema.optionalKey<Schema.String>;
14
22
  }>, Schema.Struct<{
15
23
  readonly type: Schema.Literal<"lark">;
16
24
  readonly grammar: Schema.String;
25
+ readonly field: Schema.optionalKey<Schema.String>;
17
26
  }>]>;
18
27
  export type Freeform = typeof Freeform.Type;
19
28
  export declare const FreeformFormat: Schema.Literals<("lark" | "regex" | "text")[]>;
@@ -32,6 +41,13 @@ export interface Context {
32
41
  readonly cancel?: Effect.Effect<void>;
33
42
  /** True when the tool is invoked from inside Code Mode (`execute`). */
34
43
  readonly codemode?: boolean;
44
+ /**
45
+ * Set when an automation's code makes the call. No model waits on it, and nobody hears about work it leaves
46
+ * running, so a tool must finish its work within the call.
47
+ */
48
+ readonly automation?: {
49
+ readonly id: Automation.ID;
50
+ };
35
51
  }
36
52
  export interface Namespace {
37
53
  readonly name: string;
package/dist/tool.js CHANGED
@@ -1,10 +1,16 @@
1
1
  export * as Tool from "./tool.js";
2
2
  import { Effect, JsonSchema, Schema } from "effect";
3
- /** Optional wire encoding of a tool's single required string field. Execution still receives the object. */
3
+ const field = Schema.optionalKey(Schema.String);
4
+ /**
5
+ * Optional wire encoding of a tool's single required string field. Execution still receives the object.
6
+ *
7
+ * `field` names that required string field, so the tool can have other parameters. Models that take raw text then set
8
+ * those on an optional first line, which the AI package describes and parses; the format constrains the rest.
9
+ */
4
10
  export const Freeform = Schema.Union([
5
- Schema.Struct({ type: Schema.Literal("text") }),
6
- Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String }),
7
- Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String }),
11
+ Schema.Struct({ type: Schema.Literal("text"), field }),
12
+ Schema.Struct({ type: Schema.Literal("regex"), pattern: Schema.String, field }),
13
+ Schema.Struct({ type: Schema.Literal("lark"), grammar: Schema.String, field }),
8
14
  ]).annotate({ identifier: "Tool.Freeform" });
9
15
  export const FreeformFormat = Schema.Literals(Freeform.members.map((member) => member.fields.type.literal)).annotate({
10
16
  identifier: "Tool.FreeformFormat",
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": "2.4.1",
4
+ "version": "2.4.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {