@opencode/schema 0.0.0-dev-241 → 0.0.0-dev-256

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.
@@ -20,13 +20,13 @@ export class Info extends Schema.Class("ConfigExperimental.Info")({
20
20
  Schema.Boolean,
21
21
  Schema.Struct({
22
22
  model: ConfigModel.Selection.pipe(optional).annotate({
23
- description: "Default model for the image_generate tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
23
+ description: "Default model for the experimental_image_generate tool when the agent doesn't choose one, as providerID/modelID. Falls back to automatic selection when it isn't available.",
24
24
  }),
25
25
  }),
26
26
  ])
27
27
  .pipe(optional)
28
28
  .annotate({
29
- description: "Enable the experimental image_generate tool, offered while a connected provider has an image model. Set to true, or to an object with an optional default model. Defaults to false.",
29
+ description: "Settings for the experimental_image_generate tool, which is offered while a connected provider has an image model.",
30
30
  }),
31
31
  schedules: Schema.Boolean.pipe(optional).annotate({
32
32
  description: "Enable experimental scheduled tasks that wake a session with a prompt. Defaults to false.",
@@ -4,6 +4,17 @@ export interface FileAttachment extends Schema.Schema.Type<typeof FileAttachment
4
4
  }
5
5
  export declare const FileAttachment: Schema.Struct<{
6
6
  readonly uri: Schema.String;
7
+ readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
8
+ readonly type: Schema.Literal<"inline">;
9
+ }>, Schema.Struct<{
10
+ readonly type: Schema.Literal<"uri">;
11
+ readonly uri: Schema.String;
12
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
13
+ readonly type: Schema.Literal<"inline">;
14
+ }>, Schema.Struct<{
15
+ readonly type: Schema.Literal<"uri">;
16
+ readonly uri: Schema.String;
17
+ }>]>>, never, never>;
7
18
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
8
19
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
9
20
  readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
@@ -36,6 +47,17 @@ export declare const Prompt: Schema.Struct<{
36
47
  readonly text: Schema.String;
37
48
  readonly files: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
38
49
  readonly uri: Schema.String;
50
+ readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
51
+ readonly type: Schema.Literal<"inline">;
52
+ }>, Schema.Struct<{
53
+ readonly type: Schema.Literal<"uri">;
54
+ readonly uri: Schema.String;
55
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
56
+ readonly type: Schema.Literal<"inline">;
57
+ }>, Schema.Struct<{
58
+ readonly type: Schema.Literal<"uri">;
59
+ readonly uri: Schema.String;
60
+ }>]>>, never, never>;
39
61
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
40
62
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
41
63
  readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
@@ -49,6 +71,17 @@ export declare const Prompt: Schema.Struct<{
49
71
  }>>, never, never>;
50
72
  }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
51
73
  readonly uri: Schema.String;
74
+ readonly source: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
75
+ readonly type: Schema.Literal<"inline">;
76
+ }>, Schema.Struct<{
77
+ readonly type: Schema.Literal<"uri">;
78
+ readonly uri: Schema.String;
79
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
80
+ readonly type: Schema.Literal<"inline">;
81
+ }>, Schema.Struct<{
82
+ readonly type: Schema.Literal<"uri">;
83
+ readonly uri: Schema.String;
84
+ }>]>>, never, never>;
52
85
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
53
86
  readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
54
87
  readonly mention: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
@@ -1,10 +1,12 @@
1
1
  export * as PromptInput from "./prompt-input.js";
2
2
  import { Schema } from "effect";
3
- import { AgentAttachment, PromptMention } from "./prompt.js";
3
+ 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
7
  uri: Schema.String,
8
+ // Source metadata does not require reopening the original file.
9
+ source: FileSource.pipe(optional),
8
10
  name: Schema.String.pipe(optional),
9
11
  description: Schema.String.pipe(optional),
10
12
  mention: PromptMention.pipe(optional),
@@ -64,9 +64,45 @@ export declare const Action: Schema.Union<readonly [Schema.Struct<{
64
64
  readonly prompt: Schema.String;
65
65
  }>]>;
66
66
  export type Action = typeof Action.Type;
67
+ /**
68
+ * Runs `run` in the Session's directory before firing, with no model call. With none of `is`, `matches` or `changes`
69
+ * set, exit 0 wakes and any non-zero exit is "not yet". With `is`, `matches` or `changes`, non-zero exit is a check
70
+ * error, and exit 0 wakes when trimmed stdout equals `is`, stdout matches `matches`, or stdout differs from the
71
+ * previous run (`changes`).
72
+ */
73
+ export declare const ShellCondition: Schema.Struct<{
74
+ readonly type: Schema.tag<"shell">;
75
+ readonly run: Schema.String;
76
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
77
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
78
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
79
+ }>;
80
+ export type ShellCondition = typeof ShellCondition.Type;
81
+ /** Checked before firing; the schedule wakes the Session only when the condition passes. */
82
+ export declare const Condition: Schema.Union<readonly [Schema.Struct<{
83
+ readonly type: Schema.tag<"shell">;
84
+ readonly run: Schema.String;
85
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
86
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
87
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
88
+ }>]>;
89
+ export type Condition = typeof Condition.Type;
90
+ export declare const CheckMode: Schema.Literals<readonly ["if", "until"]>;
91
+ export type CheckMode = typeof CheckMode.Type;
92
+ export declare const StoredCheck: Schema.Struct<{
93
+ readonly mode: Schema.Literals<readonly ["if", "until"]>;
94
+ readonly condition: Schema.Union<readonly [Schema.Struct<{
95
+ readonly type: Schema.tag<"shell">;
96
+ readonly run: Schema.String;
97
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
98
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
99
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
100
+ }>]>;
101
+ }>;
102
+ export type StoredCheck = typeof StoredCheck.Type;
67
103
  export declare const Status: Schema.Literals<readonly ["active", "paused", "done"]>;
68
104
  export type Status = typeof Status.Type;
69
- export declare const Outcome: Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>;
105
+ export declare const Outcome: Schema.Literals<readonly ["fired", "late", "checked", "expired", "skipped", "disabled", "failed"]>;
70
106
  export type Outcome = typeof Outcome.Type;
71
107
  export declare const Info: Schema.Struct<{
72
108
  readonly id: Schema.brand<Schema.String, "Schedule.ID"> & {
@@ -96,6 +132,32 @@ export declare const Info: Schema.Struct<{
96
132
  readonly cron: Schema.String;
97
133
  }>]>;
98
134
  readonly tz: Schema.String;
135
+ readonly if: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
136
+ readonly type: Schema.tag<"shell">;
137
+ readonly run: Schema.String;
138
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
139
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
140
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
141
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
142
+ readonly type: Schema.tag<"shell">;
143
+ readonly run: Schema.String;
144
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
145
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
146
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
147
+ }>]>>, never, never>;
148
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
149
+ readonly type: Schema.tag<"shell">;
150
+ readonly run: Schema.String;
151
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
152
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
153
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
154
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
155
+ readonly type: Schema.tag<"shell">;
156
+ readonly run: Schema.String;
157
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
158
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
159
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
160
+ }>]>>, never, never>;
99
161
  readonly action: Schema.Union<readonly [Schema.Struct<{
100
162
  readonly type: Schema.tag<"prompt">;
101
163
  readonly prompt: Schema.String;
@@ -106,7 +168,8 @@ export declare const Info: Schema.Struct<{
106
168
  readonly remainingRuns: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
107
169
  readonly runCount: Schema.Int;
108
170
  readonly lastFiredAt: Schema.decodeTo<Schema.optional<Schema.toType<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>>, Schema.optionalKey<Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>>, never, never>;
109
- readonly lastOutcome: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>>>, Schema.optionalKey<Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>>, never, never>;
171
+ readonly lastOutcome: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["fired", "late", "checked", "expired", "skipped", "disabled", "failed"]>>>, Schema.optionalKey<Schema.Literals<readonly ["fired", "late", "checked", "expired", "skipped", "disabled", "failed"]>>, never, never>;
172
+ readonly lastOutput: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
110
173
  readonly time: Schema.Struct<{
111
174
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
112
175
  readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
@@ -118,7 +181,7 @@ export declare const CreateInput: Schema.Struct<{
118
181
  create: () => string & import("effect/Brand").Brand<"SessionID">;
119
182
  };
120
183
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
121
- readonly when: Schema.Union<readonly [Schema.Struct<{
184
+ readonly when: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
122
185
  readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
123
186
  readonly type: Schema.tag<"in">;
124
187
  readonly in: Schema.String;
@@ -134,7 +197,49 @@ export declare const CreateInput: Schema.Struct<{
134
197
  readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
135
198
  readonly type: Schema.tag<"cron">;
136
199
  readonly cron: Schema.String;
137
- }>]>;
200
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
201
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
202
+ readonly type: Schema.tag<"in">;
203
+ readonly in: Schema.String;
204
+ }>, Schema.Struct<{
205
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
206
+ readonly type: Schema.tag<"at">;
207
+ readonly at: Schema.String;
208
+ }>, Schema.Struct<{
209
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
210
+ readonly type: Schema.tag<"every">;
211
+ readonly every: Schema.String;
212
+ }>, Schema.Struct<{
213
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
214
+ readonly type: Schema.tag<"cron">;
215
+ readonly cron: Schema.String;
216
+ }>]>>, never, never>;
217
+ readonly if: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
218
+ readonly type: Schema.tag<"shell">;
219
+ readonly run: Schema.String;
220
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
221
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
222
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
223
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
224
+ readonly type: Schema.tag<"shell">;
225
+ readonly run: Schema.String;
226
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
227
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
228
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
229
+ }>]>>, never, never>;
230
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
231
+ readonly type: Schema.tag<"shell">;
232
+ readonly run: Schema.String;
233
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
234
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
235
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
236
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
237
+ readonly type: Schema.tag<"shell">;
238
+ readonly run: Schema.String;
239
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
240
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
241
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
242
+ }>]>>, never, never>;
138
243
  readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
139
244
  readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
140
245
  readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
@@ -177,10 +282,23 @@ export declare const WhenInput: Schema.Union<readonly [Schema.Struct<{
177
282
  readonly every: Schema.optionalKey<Schema.Never>;
178
283
  }>]>;
179
284
  export type WhenInput = typeof WhenInput.Type;
180
- /** A schedule as callers describe it: when it fires, when it stops, and the prompt it wakes the Session with. */
285
+ export declare const ShellConditionInput: Schema.Struct<{
286
+ readonly run: Schema.String;
287
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
288
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
289
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
290
+ }>;
291
+ export type ConditionInput = typeof ShellConditionInput.Type;
292
+ export declare const ConditionInput: Schema.Struct<{
293
+ readonly run: Schema.String;
294
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
295
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
296
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
297
+ }>;
298
+ /** A schedule as callers describe it: when it fires, optional condition, when it stops, and the prompt it sends. */
181
299
  export declare const Request: Schema.Struct<{
182
300
  readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
183
- readonly when: Schema.Union<readonly [Schema.Struct<{
301
+ readonly when: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
184
302
  readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
185
303
  readonly in: Schema.String;
186
304
  readonly at: Schema.optionalKey<Schema.Never>;
@@ -204,7 +322,53 @@ export declare const Request: Schema.Struct<{
204
322
  readonly in: Schema.optionalKey<Schema.Never>;
205
323
  readonly at: Schema.optionalKey<Schema.Never>;
206
324
  readonly every: Schema.optionalKey<Schema.Never>;
207
- }>]>;
325
+ }>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
326
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
327
+ readonly in: Schema.String;
328
+ readonly at: Schema.optionalKey<Schema.Never>;
329
+ readonly every: Schema.optionalKey<Schema.Never>;
330
+ readonly cron: Schema.optionalKey<Schema.Never>;
331
+ }>, Schema.Struct<{
332
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
333
+ readonly at: Schema.String;
334
+ readonly in: Schema.optionalKey<Schema.Never>;
335
+ readonly every: Schema.optionalKey<Schema.Never>;
336
+ readonly cron: Schema.optionalKey<Schema.Never>;
337
+ }>, Schema.Struct<{
338
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
339
+ readonly every: Schema.String;
340
+ readonly in: Schema.optionalKey<Schema.Never>;
341
+ readonly at: Schema.optionalKey<Schema.Never>;
342
+ readonly cron: Schema.optionalKey<Schema.Never>;
343
+ }>, Schema.Struct<{
344
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
345
+ readonly cron: Schema.String;
346
+ readonly in: Schema.optionalKey<Schema.Never>;
347
+ readonly at: Schema.optionalKey<Schema.Never>;
348
+ readonly every: Schema.optionalKey<Schema.Never>;
349
+ }>]>>, never, never>;
350
+ readonly if: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
351
+ readonly run: Schema.String;
352
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
353
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
354
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
355
+ }>>>, Schema.optionalKey<Schema.Struct<{
356
+ readonly run: Schema.String;
357
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
358
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
359
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
360
+ }>>, never, never>;
361
+ readonly until: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
362
+ readonly run: Schema.String;
363
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
364
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
365
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
366
+ }>>>, Schema.optionalKey<Schema.Struct<{
367
+ readonly run: Schema.String;
368
+ readonly is: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
369
+ readonly matches: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
370
+ readonly changes: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
371
+ }>>, never, never>;
208
372
  readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
209
373
  readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
210
374
  readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
package/dist/schedule.js CHANGED
@@ -43,8 +43,36 @@ export const PromptAction = Schema.Struct({ type: Schema.tag("prompt"), prompt:
43
43
  identifier: "Schedule.Action.Prompt",
44
44
  });
45
45
  export const Action = Schema.Union([PromptAction]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Schedule.Action" }));
46
+ /**
47
+ * Runs `run` in the Session's directory before firing, with no model call. With none of `is`, `matches` or `changes`
48
+ * set, exit 0 wakes and any non-zero exit is "not yet". With `is`, `matches` or `changes`, non-zero exit is a check
49
+ * error, and exit 0 wakes when trimmed stdout equals `is`, stdout matches `matches`, or stdout differs from the
50
+ * previous run (`changes`).
51
+ */
52
+ export const ShellCondition = Schema.Struct({
53
+ type: Schema.tag("shell"),
54
+ run: Schema.String,
55
+ is: Schema.String.pipe(optional),
56
+ matches: Schema.String.pipe(optional),
57
+ changes: Schema.Boolean.pipe(optional),
58
+ }).annotate({ identifier: "Schedule.Condition.Shell" });
59
+ /** Checked before firing; the schedule wakes the Session only when the condition passes. */
60
+ export const Condition = Schema.Union([ShellCondition]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Schedule.Condition" }));
61
+ export const CheckMode = Schema.Literals(["if", "until"]).annotate({ identifier: "Schedule.CheckMode" });
62
+ export const StoredCheck = Schema.Struct({
63
+ mode: CheckMode,
64
+ condition: Condition,
65
+ }).annotate({ identifier: "Schedule.StoredCheck" });
46
66
  export const Status = Schema.Literals(["active", "paused", "done"]).annotate({ identifier: "Schedule.Status" });
47
- export const Outcome = Schema.Literals(["fired", "late", "skipped", "disabled", "failed"]).annotate({
67
+ export const Outcome = Schema.Literals([
68
+ "fired",
69
+ "late",
70
+ "checked",
71
+ "expired",
72
+ "skipped",
73
+ "disabled",
74
+ "failed",
75
+ ]).annotate({
48
76
  identifier: "Schedule.Outcome",
49
77
  });
50
78
  export const Info = Schema.Struct({
@@ -53,6 +81,8 @@ export const Info = Schema.Struct({
53
81
  name: Schema.String.pipe(optional),
54
82
  when: When,
55
83
  tz: Schema.String,
84
+ if: Condition.pipe(optional),
85
+ until: Condition.pipe(optional),
56
86
  action: Action,
57
87
  status: Status,
58
88
  nextDueAt: DateTimeUtcFromMillis.pipe(optional),
@@ -61,12 +91,15 @@ export const Info = Schema.Struct({
61
91
  runCount: NonNegativeInt,
62
92
  lastFiredAt: DateTimeUtcFromMillis.pipe(optional),
63
93
  lastOutcome: Outcome.pipe(optional),
94
+ lastOutput: Schema.String.pipe(optional),
64
95
  time: Schema.Struct({ created: DateTimeUtcFromMillis, updated: DateTimeUtcFromMillis }),
65
96
  }).annotate({ identifier: "Schedule.Info" });
66
97
  export const CreateInput = Schema.Struct({
67
98
  sessionID: SessionID,
68
99
  name: Schema.String.pipe(optional),
69
- when: When,
100
+ when: When.pipe(optional),
101
+ if: Condition.pipe(optional),
102
+ until: Condition.pipe(optional),
70
103
  ends: Ends.pipe(optional),
71
104
  action: Action,
72
105
  }).annotate({ identifier: "Schedule.CreateInput" });
@@ -79,26 +112,56 @@ export const WhenInput = Schema.Union([
79
112
  Schema.Struct({ every: Every.fields.every, in: absent, at: absent, cron: absent, ...zone }),
80
113
  Schema.Struct({ cron: Cron.fields.cron, in: absent, at: absent, every: absent, ...zone }),
81
114
  ]).annotate({ identifier: "Schedule.WhenInput" });
82
- /** A schedule as callers describe it: when it fires, when it stops, and the prompt it wakes the Session with. */
115
+ export const ShellConditionInput = Schema.Struct({
116
+ run: Schema.String.check(Schema.isMinLength(1)).annotate({
117
+ description: "Shell command to run in the Session's directory. Alone, exit 0 wakes and stdout is appended.",
118
+ }),
119
+ is: Schema.String.pipe(optional).annotate({
120
+ description: "Wake when exit is 0 and trimmed stdout equals this value.",
121
+ }),
122
+ matches: Schema.String.pipe(optional).annotate({
123
+ description: "Wake when exit is 0 and stdout matches this regular expression.",
124
+ }),
125
+ changes: Schema.Boolean.pipe(optional).annotate({
126
+ description: "Wake when exit is 0 and stdout differs from the previous check.",
127
+ }),
128
+ }).annotate({ identifier: "Schedule.ConditionInput" });
129
+ export const ConditionInput = ShellConditionInput;
130
+ /** A schedule as callers describe it: when it fires, optional condition, when it stops, and the prompt it sends. */
83
131
  export const Request = Schema.Struct({
84
132
  name: Schema.String.pipe(optional).annotate({ description: "A short label for the schedule." }),
85
- when: WhenInput.annotate({
86
- description: 'When it fires: { in: "20 minutes" }, { at: "2026-10-27T09:00" }, { every: "1 hour" } or { cron: "0 9 * * 1-5" }. Wall-clock times use tz.',
133
+ when: WhenInput.pipe(optional).annotate({
134
+ description: 'When it fires: { in: "20 minutes" }, { at: "2026-10-27T09:00" }, { every: "1 hour" } or { cron: "0 9 * * 1-5" }. Optional with `until` (defaults to { every: "30 seconds" }).',
135
+ }),
136
+ if: ConditionInput.pipe(optional).annotate({
137
+ description: "Recurring gate: check on each slot with no model call, and wake on every slot where it passes.",
138
+ }),
139
+ until: ConditionInput.pipe(optional).annotate({
140
+ description: 'One-shot gate: poll with no model call, wake once when it passes, and stop. Defaults ends.after to "24 hours".',
87
141
  }),
88
142
  ends: Ends.pipe(optional).annotate({
89
143
  description: 'Stops a repeating schedule at the first limit reached: { after: "8 hours" }, { at }, { times: 3 }.',
90
144
  }),
91
145
  prompt: Schema.String.check(Schema.isMinLength(1)).annotate({
92
- description: "The message the Session receives each time the schedule fires.",
146
+ description: "The message the Session receives when the schedule wakes.",
93
147
  }),
94
148
  }).annotate({ identifier: "Schedule.Request" });
95
149
  export const toCreateInput = (sessionID, request) => ({
96
150
  sessionID,
97
151
  name: request.name,
98
- when: toWhen(request.when),
152
+ when: request.when === undefined ? undefined : toWhen(request.when),
153
+ if: request.if === undefined ? undefined : toCondition(request.if),
154
+ until: request.until === undefined ? undefined : toCondition(request.until),
99
155
  ends: request.ends,
100
156
  action: { type: "prompt", prompt: request.prompt },
101
157
  });
158
+ const toCondition = (condition) => ({
159
+ type: "shell",
160
+ run: condition.run,
161
+ is: condition.is,
162
+ matches: condition.matches,
163
+ changes: condition.changes,
164
+ });
102
165
  const toWhen = (when) => {
103
166
  if (when.in !== undefined)
104
167
  return { type: "in", in: when.in, tz: when.tz };
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-241",
4
+ "version": "0.0.0-dev-256",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {