@opencode/schema 2.2.0 → 2.2.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.
@@ -5,6 +5,44 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
5
5
  readonly todo: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
6
6
  readonly background_compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
7
7
  readonly media_blob: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
8
+ readonly image_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>;
45
+ readonly schedules: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
8
46
  readonly subagent_depth: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
9
47
  readonly location_idle_timeout: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.DurationFromString, Schema.Literal<false>]>>>, Schema.optionalKey<Schema.Union<readonly [Schema.DurationFromString, Schema.Literal<false>]>>, never, never>;
10
48
  readonly policies: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
@@ -1,6 +1,7 @@
1
1
  export * as ConfigExperimental from "./experimental.js";
2
2
  import { Schema } from "effect";
3
3
  import { NonNegativeInt, optional } from "../schema.js";
4
+ import { ConfigModel } from "./model.js";
4
5
  import { ConfigPolicy } from "./policy.js";
5
6
  export class Info extends Schema.Class("ConfigExperimental.Info")({
6
7
  portable_shell_scanner: Schema.Boolean.pipe(optional).annotate({
@@ -15,6 +16,21 @@ export class Info extends Schema.Class("ConfigExperimental.Info")({
15
16
  media_blob: Schema.Boolean.pipe(optional).annotate({
16
17
  description: "Store new session media once in a deduplicated blob table instead of inline in every message row. Defaults to false.",
17
18
  }),
19
+ image_generate: Schema.Union([
20
+ Schema.Boolean,
21
+ Schema.Struct({
22
+ model: ConfigModel.Selection.pipe(optional).annotate({
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
+ }),
25
+ }),
26
+ ])
27
+ .pipe(optional)
28
+ .annotate({
29
+ description: "Settings for the experimental_image_generate tool, which is offered while a connected provider has an image model.",
30
+ }),
31
+ schedules: Schema.Boolean.pipe(optional).annotate({
32
+ description: "Enable experimental scheduled tasks that wake a session with a prompt. Defaults to false.",
33
+ }),
18
34
  subagent_depth: NonNegativeInt.pipe(optional).annotate({
19
35
  description: "Maximum subagent nesting depth. Defaults to 1.",
20
36
  }),
@@ -279,6 +279,9 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
279
279
  }>]>>, never, never>;
280
280
  }>>, never, never>;
281
281
  readonly variants: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
282
+ readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
283
+ readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
284
+ readonly id: Schema.brand<Schema.String, "Model.VariantID">;
282
285
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
283
286
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
284
287
  readonly type: Schema.Literal<"summary">;
@@ -289,11 +292,6 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
289
292
  }>, Schema.Struct<{
290
293
  readonly type: Schema.Literal<"native">;
291
294
  }>]>>, never, never>;
292
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
293
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
294
- }>>>, Schema.optionalKey<Schema.Struct<{
295
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
296
- }>>, never, never>;
297
295
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
298
296
  }>, readonly [Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
299
297
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -305,17 +303,12 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
305
303
  }>, Schema.Struct<{
306
304
  readonly type: Schema.Literal<"native">;
307
305
  }>]>>, never, never>;
308
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
309
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
310
- }>>>, Schema.optionalKey<Schema.Struct<{
311
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
312
- }>>, never, never>;
313
306
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
314
307
  }>, readonly [Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>]>>, never, never>;
308
+ }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
315
309
  readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
316
310
  readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
317
311
  readonly id: Schema.brand<Schema.String, "Model.VariantID">;
318
- }>>>>, Schema.optionalKey<Schema.$Array<Schema.Struct<{
319
312
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
320
313
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
321
314
  readonly type: Schema.Literal<"summary">;
@@ -326,11 +319,6 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
326
319
  }>, Schema.Struct<{
327
320
  readonly type: Schema.Literal<"native">;
328
321
  }>]>>, never, never>;
329
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
330
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
331
- }>>>, Schema.optionalKey<Schema.Struct<{
332
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
333
- }>>, never, never>;
334
322
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
335
323
  }>, readonly [Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
336
324
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -342,16 +330,8 @@ declare const ModelConfig_base: Schema.Class<ModelConfig, Schema.Struct<{
342
330
  }>, Schema.Struct<{
343
331
  readonly type: Schema.Literal<"native">;
344
332
  }>]>>, never, never>;
345
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
346
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
347
- }>>>, Schema.optionalKey<Schema.Struct<{
348
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
349
- }>>, never, never>;
350
333
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
351
334
  }>, readonly [Schema.$Record<Schema.String, Schema.UndefinedOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>>]>>, never, never>;
352
- readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
353
- readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>, never, never>;
354
- readonly id: Schema.brand<Schema.String, "Model.VariantID">;
355
335
  }>>>, never, never>;
356
336
  readonly cost: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [typeof Cost, Schema.$Array<typeof Cost>]>>>, Schema.optionalKey<Schema.Union<readonly [typeof Cost, Schema.$Array<typeof Cost>]>>, never, never>;
357
337
  readonly disabled: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
@@ -1,5 +1,5 @@
1
1
  export * as ConfigProvider from "./provider.js";
2
- import { Schema } from "effect";
2
+ import { Schema, Struct } from "effect";
3
3
  import { Money } from "../money.js";
4
4
  import { Capabilities, Compatibility, Family, ID, Model, Type, VariantID } from "../model.js";
5
5
  import { ProviderCompatibility } from "../model-compatibility.js";
@@ -85,6 +85,10 @@ class ModelConfig extends Schema.Class("Config.Model")({
85
85
  variants: Schema.Struct({
86
86
  id: VariantID,
87
87
  ...ModelOverlays,
88
+ // The prompt cache belongs to the model, so a variant can't change it.
89
+ settings: Schema.StructWithRest(Schema.Struct(Struct.omit(ModelSettings.schema.fields, ["cache"])), ModelSettings.records)
90
+ .annotate({ identifier: "Config.Model.VariantSettings" })
91
+ .pipe(optional),
88
92
  }).pipe(Schema.Array, optional),
89
93
  cost: Schema.Union([Cost, Cost.pipe(Schema.Array)]).pipe(optional),
90
94
  disabled: Schema.Boolean.pipe(optional),
package/dist/config.d.ts CHANGED
@@ -44,6 +44,7 @@ declare const Info_base: Schema.Class<Info, Schema.Struct<{
44
44
  readonly url: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
45
45
  }>>, never, never>;
46
46
  readonly username: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
47
+ readonly timezone: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
47
48
  readonly permissions: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
48
49
  readonly action: Schema.String;
49
50
  readonly resource: Schema.String;
package/dist/config.js CHANGED
@@ -50,6 +50,9 @@ export class Info extends Schema.Class("Config.Info")({
50
50
  username: Schema.String.pipe(optional).annotate({
51
51
  description: "Username displayed in conversations and used for telemetry identity",
52
52
  }),
53
+ timezone: Schema.String.pipe(optional).annotate({
54
+ description: "IANA time zone for schedules, e.g. America/Los_Angeles. Defaults to the server's local zone",
55
+ }),
53
56
  permissions: Permission.Ruleset.pipe(optional).annotate({
54
57
  description: "Ordered tool permission rules applied to agent tool use",
55
58
  }),
package/dist/goal.d.ts ADDED
@@ -0,0 +1,126 @@
1
+ export * as Goal from "./goal.js";
2
+ import { Schema } from "effect";
3
+ export declare const Status: Schema.Literals<readonly ["active", "paused", "complete"]>;
4
+ export type Status = typeof Status.Type;
5
+ export interface State extends Schema.Schema.Type<typeof State> {
6
+ }
7
+ export declare const State: Schema.Struct<{
8
+ readonly id: Schema.String;
9
+ readonly objective: Schema.String;
10
+ readonly status: Schema.Literals<readonly ["active", "paused", "complete"]>;
11
+ /** Why the goal last changed: the reviewer's reason, or what paused it. */
12
+ readonly reason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
13
+ /** Continuations sent since the goal was set or last resumed. */
14
+ readonly rounds: Schema.Number;
15
+ /** A backstop for loops that stall detection misses. */
16
+ readonly maxRounds: Schema.Number;
17
+ /** Rounds in a row without progress: no tool calls, or the same reason as the round before. */
18
+ readonly stalls: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Number>>, Schema.optionalKey<Schema.Number>, never, never>;
19
+ /** The server process that armed the goal. */
20
+ readonly boot: Schema.String;
21
+ readonly updatedAt: Schema.Number;
22
+ }>;
23
+ /**
24
+ * The `/goal` plugin's RPC. Clients read a Session's goal with `get` and keep it current from `changed`, which the
25
+ * plugin publishes in the Session's Location on every write. A Session's goal is its own: children and forks start
26
+ * without one. The schemas are Standard Schemas too, so Promise clients can call it.
27
+ */
28
+ export declare const Definition: {
29
+ readonly id: "opencode.goal";
30
+ readonly methods: {
31
+ get: {
32
+ input: import("effect/StandardSchema").StandardSchemaV1<{
33
+ readonly sessionID: string;
34
+ }, {
35
+ readonly sessionID: string;
36
+ }> & Schema.Struct<{
37
+ readonly sessionID: Schema.String;
38
+ }>;
39
+ output: import("effect/StandardSchema").StandardSchemaV1<{
40
+ readonly id: string;
41
+ readonly objective: string;
42
+ readonly status: "active" | "complete" | "paused";
43
+ readonly reason?: string | undefined;
44
+ readonly rounds: number;
45
+ readonly maxRounds: number;
46
+ readonly stalls?: number | undefined;
47
+ readonly boot: string;
48
+ readonly updatedAt: number;
49
+ } | null, {
50
+ readonly id: string;
51
+ readonly objective: string;
52
+ readonly status: "active" | "complete" | "paused";
53
+ readonly reason?: string | undefined;
54
+ readonly rounds: number;
55
+ readonly maxRounds: number;
56
+ readonly stalls?: number | undefined;
57
+ readonly boot: string;
58
+ readonly updatedAt: number;
59
+ } | null> & Schema.NullOr<Schema.Struct<{
60
+ readonly id: Schema.String;
61
+ readonly objective: Schema.String;
62
+ readonly status: Schema.Literals<readonly ["active", "paused", "complete"]>;
63
+ /** Why the goal last changed: the reviewer's reason, or what paused it. */
64
+ readonly reason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
65
+ /** Continuations sent since the goal was set or last resumed. */
66
+ readonly rounds: Schema.Number;
67
+ /** A backstop for loops that stall detection misses. */
68
+ readonly maxRounds: Schema.Number;
69
+ /** Rounds in a row without progress: no tool calls, or the same reason as the round before. */
70
+ readonly stalls: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Number>>, Schema.optionalKey<Schema.Number>, never, never>;
71
+ /** The server process that armed the goal. */
72
+ readonly boot: Schema.String;
73
+ readonly updatedAt: Schema.Number;
74
+ }>>;
75
+ };
76
+ };
77
+ readonly events: {
78
+ changed: {
79
+ schema: import("effect/StandardSchema").StandardSchemaV1<{
80
+ readonly sessionID: string;
81
+ readonly goal: {
82
+ readonly id: string;
83
+ readonly objective: string;
84
+ readonly status: "active" | "complete" | "paused";
85
+ readonly reason?: string | undefined;
86
+ readonly rounds: number;
87
+ readonly maxRounds: number;
88
+ readonly stalls?: number | undefined;
89
+ readonly boot: string;
90
+ readonly updatedAt: number;
91
+ } | null;
92
+ }, {
93
+ readonly sessionID: string;
94
+ readonly goal: {
95
+ readonly id: string;
96
+ readonly objective: string;
97
+ readonly status: "active" | "complete" | "paused";
98
+ readonly reason?: string | undefined;
99
+ readonly rounds: number;
100
+ readonly maxRounds: number;
101
+ readonly stalls?: number | undefined;
102
+ readonly boot: string;
103
+ readonly updatedAt: number;
104
+ } | null;
105
+ }> & Schema.Struct<{
106
+ readonly sessionID: Schema.String;
107
+ readonly goal: Schema.NullOr<Schema.Struct<{
108
+ readonly id: Schema.String;
109
+ readonly objective: Schema.String;
110
+ readonly status: Schema.Literals<readonly ["active", "paused", "complete"]>;
111
+ /** Why the goal last changed: the reviewer's reason, or what paused it. */
112
+ readonly reason: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
113
+ /** Continuations sent since the goal was set or last resumed. */
114
+ readonly rounds: Schema.Number;
115
+ /** A backstop for loops that stall detection misses. */
116
+ readonly maxRounds: Schema.Number;
117
+ /** Rounds in a row without progress: no tool calls, or the same reason as the round before. */
118
+ readonly stalls: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Number>>, Schema.optionalKey<Schema.Number>, never, never>;
119
+ /** The server process that armed the goal. */
120
+ readonly boot: Schema.String;
121
+ readonly updatedAt: Schema.Number;
122
+ }>>;
123
+ }>;
124
+ };
125
+ };
126
+ };
package/dist/goal.js ADDED
@@ -0,0 +1,40 @@
1
+ export * as Goal from "./goal.js";
2
+ import { Schema } from "effect";
3
+ import { Rpc } from "./rpc.js";
4
+ import { optional } from "./schema.js";
5
+ export const Status = Schema.Literals(["active", "paused", "complete"]);
6
+ export const State = Schema.Struct({
7
+ id: Schema.String,
8
+ objective: Schema.String,
9
+ status: Status,
10
+ /** Why the goal last changed: the reviewer's reason, or what paused it. */
11
+ reason: optional(Schema.String),
12
+ /** Continuations sent since the goal was set or last resumed. */
13
+ rounds: Schema.Number,
14
+ /** A backstop for loops that stall detection misses. */
15
+ maxRounds: Schema.Number,
16
+ /** Rounds in a row without progress: no tool calls, or the same reason as the round before. */
17
+ stalls: optional(Schema.Number),
18
+ /** The server process that armed the goal. */
19
+ boot: Schema.String,
20
+ updatedAt: Schema.Number,
21
+ }).annotate({ identifier: "Goal.State" });
22
+ /**
23
+ * The `/goal` plugin's RPC. Clients read a Session's goal with `get` and keep it current from `changed`, which the
24
+ * plugin publishes in the Session's Location on every write. A Session's goal is its own: children and forks start
25
+ * without one. The schemas are Standard Schemas too, so Promise clients can call it.
26
+ */
27
+ export const Definition = Rpc.define({
28
+ id: "opencode.goal",
29
+ methods: {
30
+ get: {
31
+ input: Schema.toStandardSchemaV1(Schema.Struct({ sessionID: Schema.String })),
32
+ output: Schema.toStandardSchemaV1(Schema.NullOr(State)),
33
+ },
34
+ },
35
+ events: {
36
+ changed: {
37
+ schema: Schema.toStandardSchemaV1(Schema.Struct({ sessionID: Schema.String, goal: Schema.NullOr(State) })),
38
+ },
39
+ },
40
+ });
package/dist/model.d.ts CHANGED
@@ -203,6 +203,9 @@ export declare const Cost: Schema.Struct<{
203
203
  export interface Variant extends Schema.Schema.Type<typeof Variant> {
204
204
  }
205
205
  export declare const Variant: Schema.Struct<{
206
+ readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
207
+ readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
208
+ readonly id: Schema.brand<Schema.String, "Model.VariantID">;
206
209
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
207
210
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
208
211
  readonly type: Schema.Literal<"summary">;
@@ -213,11 +216,6 @@ export declare const Variant: Schema.Struct<{
213
216
  }>, Schema.Struct<{
214
217
  readonly type: Schema.Literal<"native">;
215
218
  }>]>>, never, never>;
216
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
217
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
218
- }>>>, Schema.optionalKey<Schema.Struct<{
219
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
220
- }>>, never, never>;
221
219
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
222
220
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
223
221
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -229,16 +227,8 @@ export declare const Variant: Schema.Struct<{
229
227
  }>, Schema.Struct<{
230
228
  readonly type: Schema.Literal<"native">;
231
229
  }>]>>, never, never>;
232
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
233
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
234
- }>>>, Schema.optionalKey<Schema.Struct<{
235
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
236
- }>>, never, never>;
237
230
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
238
231
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
239
- readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
240
- readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
241
- readonly id: Schema.brand<Schema.String, "Model.VariantID">;
242
232
  }>;
243
233
  export interface Info extends Schema.Schema.Type<typeof Info> {
244
234
  }
@@ -361,6 +351,9 @@ export declare const Info: Schema.Struct<{
361
351
  };
362
352
  };
363
353
  readonly variants: Schema.$Array<Schema.Struct<{
354
+ readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
355
+ readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
356
+ readonly id: Schema.brand<Schema.String, "Model.VariantID">;
364
357
  readonly settings: Schema.decodeTo<Schema.optional<Schema.toType<Schema.StructWithRest<Schema.Struct<{
365
358
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
366
359
  readonly type: Schema.Literal<"summary">;
@@ -371,11 +364,6 @@ export declare const Info: Schema.Struct<{
371
364
  }>, Schema.Struct<{
372
365
  readonly type: Schema.Literal<"native">;
373
366
  }>]>>, never, never>;
374
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
375
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
376
- }>>>, Schema.optionalKey<Schema.Struct<{
377
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
378
- }>>, never, never>;
379
367
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
380
368
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>>, Schema.optionalKey<Schema.StructWithRest<Schema.Struct<{
381
369
  readonly compaction: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
@@ -387,16 +375,8 @@ export declare const Info: Schema.Struct<{
387
375
  }>, Schema.Struct<{
388
376
  readonly type: Schema.Literal<"native">;
389
377
  }>]>>, never, never>;
390
- readonly cache: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
391
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
392
- }>>>, Schema.optionalKey<Schema.Struct<{
393
- readonly ttl: Schema.decodeTo<Schema.optional<Schema.toType<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>>, Schema.optionalKey<Schema.TemplateLiteral<readonly [Schema.Number, Schema.Literals<readonly ["ms", "s", "m", "h", "d"]>]>>, never, never>;
394
- }>>, never, never>;
395
378
  readonly encoding: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Literals<readonly ["zstd", "gzip", "none"]>>>, Schema.optionalKey<Schema.Literals<readonly ["zstd", "gzip", "none"]>>, never, never>;
396
379
  }>, readonly [Schema.$Record<Schema.String, Schema.Any>]>>, never, never>;
397
- readonly headers: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.String>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>, never, never>;
398
- readonly body: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Any>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Any>>, never, never>;
399
- readonly id: Schema.brand<Schema.String, "Model.VariantID">;
400
380
  }>>;
401
381
  readonly time: Schema.Struct<{
402
382
  readonly released: Schema.Finite;
package/dist/model.js CHANGED
@@ -42,6 +42,8 @@ export const Type = Schema.Union([
42
42
  export const Settings = Schema.StructWithRest(Schema.Struct(Struct.pick(Provider.Settings.schema.fields, ["compaction", "cache", "encoding"])),
43
43
  // Provider packages may define arbitrary model-level options beyond OpenCode's shared compaction policy.
44
44
  [Schema.Record(Schema.String, Schema.Any)]).annotate({ identifier: "Model.Settings" });
45
+ // Variants switch request settings. The prompt cache belongs to the model, so a variant can't change it.
46
+ const VariantSettings = Schema.StructWithRest(Schema.Struct(Struct.omit(Settings.schema.fields, ["cache"])), Settings.records).annotate({ identifier: "Model.VariantSettings" });
45
47
  export const Overlays = {
46
48
  settings: Settings.pipe(optional),
47
49
  headers: Schema.Record(Schema.String, Schema.String).pipe(optional),
@@ -73,6 +75,7 @@ export const Cost = Schema.Struct({
73
75
  export const Variant = Schema.Struct({
74
76
  id: VariantID,
75
77
  ...Overlays,
78
+ settings: VariantSettings.pipe(optional),
76
79
  }).annotate({ identifier: "Model.Variant" });
77
80
  export const Info = Schema.Struct({
78
81
  id: ID,
@@ -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),
@@ -0,0 +1,384 @@
1
+ export * as Schedule from "./schedule.js";
2
+ import { Option, Schema } from "effect";
3
+ import { SessionID } from "./session-id.js";
4
+ export declare const ID: Schema.brand<Schema.String, "Schedule.ID"> & {
5
+ create: () => string & import("effect/Brand").Brand<"Schedule.ID">;
6
+ };
7
+ export type ID = typeof ID.Type;
8
+ /** Milliseconds in a duration string, or `None` when it is not one. */
9
+ export declare const durationMillis: (value: string) => Option.Option<number>;
10
+ /** A duration such as "90 seconds", "5 minutes" or "2 hours". The service validates it, since clients cannot run a custom check. */
11
+ export declare const DurationString: Schema.String;
12
+ export declare const In: Schema.Struct<{
13
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
14
+ readonly type: Schema.tag<"in">;
15
+ readonly in: Schema.String;
16
+ }>;
17
+ /** An instant with an offset, or a wall-clock time in `tz`, e.g. "2026-10-27T09:00". */
18
+ export declare const At: Schema.Struct<{
19
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
20
+ readonly type: Schema.tag<"at">;
21
+ readonly at: Schema.String;
22
+ }>;
23
+ export declare const Every: Schema.Struct<{
24
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
25
+ readonly type: Schema.tag<"every">;
26
+ readonly every: Schema.String;
27
+ }>;
28
+ export declare const Cron: Schema.Struct<{
29
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
30
+ readonly type: Schema.tag<"cron">;
31
+ readonly cron: Schema.String;
32
+ }>;
33
+ export declare const When: Schema.Union<readonly [Schema.Struct<{
34
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
35
+ readonly type: Schema.tag<"in">;
36
+ readonly in: Schema.String;
37
+ }>, Schema.Struct<{
38
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
39
+ readonly type: Schema.tag<"at">;
40
+ readonly at: Schema.String;
41
+ }>, Schema.Struct<{
42
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
43
+ readonly type: Schema.tag<"every">;
44
+ readonly every: Schema.String;
45
+ }>, Schema.Struct<{
46
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
47
+ readonly type: Schema.tag<"cron">;
48
+ readonly cron: Schema.String;
49
+ }>]>;
50
+ export type When = typeof When.Type;
51
+ /** Stops a repeating schedule at whichever limit comes first. */
52
+ export declare const Ends: Schema.Struct<{
53
+ readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
54
+ readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
55
+ readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
56
+ }>;
57
+ export type Ends = typeof Ends.Type;
58
+ export declare const PromptAction: Schema.Struct<{
59
+ readonly type: Schema.tag<"prompt">;
60
+ readonly prompt: Schema.String;
61
+ }>;
62
+ export declare const Action: Schema.Union<readonly [Schema.Struct<{
63
+ readonly type: Schema.tag<"prompt">;
64
+ readonly prompt: Schema.String;
65
+ }>]>;
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;
103
+ export declare const Status: Schema.Literals<readonly ["active", "paused", "done"]>;
104
+ export type Status = typeof Status.Type;
105
+ export declare const Outcome: Schema.Literals<readonly ["fired", "late", "checked", "expired", "skipped", "disabled", "failed"]>;
106
+ export type Outcome = typeof Outcome.Type;
107
+ export declare const Info: Schema.Struct<{
108
+ readonly id: Schema.brand<Schema.String, "Schedule.ID"> & {
109
+ create: () => string & import("effect/Brand").Brand<"Schedule.ID">;
110
+ };
111
+ readonly sessionID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "SessionID"> & {
112
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
113
+ }>>, Schema.optionalKey<Schema.brand<Schema.String, "SessionID"> & {
114
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
115
+ }>, never, never>;
116
+ readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
117
+ readonly when: Schema.Union<readonly [Schema.Struct<{
118
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
119
+ readonly type: Schema.tag<"in">;
120
+ readonly in: Schema.String;
121
+ }>, Schema.Struct<{
122
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
123
+ readonly type: Schema.tag<"at">;
124
+ readonly at: Schema.String;
125
+ }>, Schema.Struct<{
126
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
127
+ readonly type: Schema.tag<"every">;
128
+ readonly every: Schema.String;
129
+ }>, Schema.Struct<{
130
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
131
+ readonly type: Schema.tag<"cron">;
132
+ readonly cron: Schema.String;
133
+ }>]>;
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>;
161
+ readonly action: Schema.Union<readonly [Schema.Struct<{
162
+ readonly type: Schema.tag<"prompt">;
163
+ readonly prompt: Schema.String;
164
+ }>]>;
165
+ readonly status: Schema.Literals<readonly ["active", "paused", "done"]>;
166
+ readonly nextDueAt: 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>;
167
+ readonly endsAt: 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>;
168
+ readonly remainingRuns: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
169
+ readonly runCount: Schema.Int;
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>;
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>;
173
+ readonly time: Schema.Struct<{
174
+ readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
175
+ readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
176
+ }>;
177
+ }>;
178
+ export type Info = typeof Info.Type;
179
+ export declare const CreateInput: Schema.Struct<{
180
+ readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
181
+ create: () => string & import("effect/Brand").Brand<"SessionID">;
182
+ };
183
+ readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
184
+ readonly when: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
185
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
186
+ readonly type: Schema.tag<"in">;
187
+ readonly in: Schema.String;
188
+ }>, Schema.Struct<{
189
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
190
+ readonly type: Schema.tag<"at">;
191
+ readonly at: Schema.String;
192
+ }>, Schema.Struct<{
193
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
194
+ readonly type: Schema.tag<"every">;
195
+ readonly every: Schema.String;
196
+ }>, Schema.Struct<{
197
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
198
+ readonly type: Schema.tag<"cron">;
199
+ readonly cron: Schema.String;
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>;
243
+ readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
244
+ readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
245
+ readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
246
+ readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
247
+ }>>>, Schema.optionalKey<Schema.Struct<{
248
+ readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
249
+ readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
250
+ readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
251
+ }>>, never, never>;
252
+ readonly action: Schema.Union<readonly [Schema.Struct<{
253
+ readonly type: Schema.tag<"prompt">;
254
+ readonly prompt: Schema.String;
255
+ }>]>;
256
+ }>;
257
+ export type CreateInput = typeof CreateInput.Type;
258
+ /** The `when` callers write: exactly one of `in`, `at`, `every` or `cron`, with an optional `tz`. */
259
+ export declare const WhenInput: Schema.Union<readonly [Schema.Struct<{
260
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
261
+ readonly in: Schema.String;
262
+ readonly at: Schema.optionalKey<Schema.Never>;
263
+ readonly every: Schema.optionalKey<Schema.Never>;
264
+ readonly cron: Schema.optionalKey<Schema.Never>;
265
+ }>, Schema.Struct<{
266
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
267
+ readonly at: Schema.String;
268
+ readonly in: Schema.optionalKey<Schema.Never>;
269
+ readonly every: Schema.optionalKey<Schema.Never>;
270
+ readonly cron: Schema.optionalKey<Schema.Never>;
271
+ }>, Schema.Struct<{
272
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
273
+ readonly every: Schema.String;
274
+ readonly in: Schema.optionalKey<Schema.Never>;
275
+ readonly at: Schema.optionalKey<Schema.Never>;
276
+ readonly cron: Schema.optionalKey<Schema.Never>;
277
+ }>, Schema.Struct<{
278
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
279
+ readonly cron: Schema.String;
280
+ readonly in: Schema.optionalKey<Schema.Never>;
281
+ readonly at: Schema.optionalKey<Schema.Never>;
282
+ readonly every: Schema.optionalKey<Schema.Never>;
283
+ }>]>;
284
+ export type WhenInput = typeof WhenInput.Type;
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. */
299
+ export declare const Request: Schema.Struct<{
300
+ readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
301
+ readonly when: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Union<readonly [Schema.Struct<{
302
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
303
+ readonly in: Schema.String;
304
+ readonly at: Schema.optionalKey<Schema.Never>;
305
+ readonly every: Schema.optionalKey<Schema.Never>;
306
+ readonly cron: Schema.optionalKey<Schema.Never>;
307
+ }>, Schema.Struct<{
308
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
309
+ readonly at: Schema.String;
310
+ readonly in: Schema.optionalKey<Schema.Never>;
311
+ readonly every: Schema.optionalKey<Schema.Never>;
312
+ readonly cron: Schema.optionalKey<Schema.Never>;
313
+ }>, Schema.Struct<{
314
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
315
+ readonly every: Schema.String;
316
+ readonly in: Schema.optionalKey<Schema.Never>;
317
+ readonly at: Schema.optionalKey<Schema.Never>;
318
+ readonly cron: Schema.optionalKey<Schema.Never>;
319
+ }>, Schema.Struct<{
320
+ readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
321
+ readonly cron: Schema.String;
322
+ readonly in: Schema.optionalKey<Schema.Never>;
323
+ readonly at: Schema.optionalKey<Schema.Never>;
324
+ readonly every: Schema.optionalKey<Schema.Never>;
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>;
372
+ readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
373
+ readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
374
+ readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
375
+ readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
376
+ }>>>, Schema.optionalKey<Schema.Struct<{
377
+ readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
378
+ readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
379
+ readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
380
+ }>>, never, never>;
381
+ readonly prompt: Schema.String;
382
+ }>;
383
+ export type Request = typeof Request.Type;
384
+ export declare const toCreateInput: (sessionID: SessionID, request: Request) => CreateInput;
@@ -0,0 +1,173 @@
1
+ export * as Schedule from "./schedule.js";
2
+ import { Duration, Option, Schema } from "effect";
3
+ import { ascending } from "./identifier.js";
4
+ import { DateTimeUtcFromMillis, NonNegativeInt, PositiveInt, optional, statics } from "./schema.js";
5
+ import { SessionID } from "./session-id.js";
6
+ export const ID = Schema.String.check(Schema.isStartingWith("sch_")).pipe(Schema.brand("Schedule.ID"), Schema.annotate({ identifier: "Schedule.ID" }), statics((schema) => ({
7
+ create: () => schema.make("sch_" + ascending()),
8
+ })));
9
+ const decodeDuration = Schema.decodeUnknownOption(Schema.DurationFromString);
10
+ /** Milliseconds in a duration string, or `None` when it is not one. */
11
+ export const durationMillis = (value) => decodeDuration(value).pipe(Option.map(Duration.toMillis));
12
+ /** A duration such as "90 seconds", "5 minutes" or "2 hours". The service validates it, since clients cannot run a custom check. */
13
+ export const DurationString = Schema.String.annotate({
14
+ identifier: "Schedule.Duration",
15
+ description: 'A duration such as "90 seconds", "5 minutes" or "2 hours".',
16
+ });
17
+ const zone = {
18
+ tz: Schema.String.pipe(optional).annotate({
19
+ description: "IANA time zone. Defaults to the configured timezone, then the server's local zone.",
20
+ }),
21
+ };
22
+ export const In = Schema.Struct({ type: Schema.tag("in"), in: DurationString, ...zone }).annotate({
23
+ identifier: "Schedule.When.In",
24
+ });
25
+ /** An instant with an offset, or a wall-clock time in `tz`, e.g. "2026-10-27T09:00". */
26
+ export const At = Schema.Struct({ type: Schema.tag("at"), at: Schema.String, ...zone }).annotate({
27
+ identifier: "Schedule.When.At",
28
+ });
29
+ export const Every = Schema.Struct({ type: Schema.tag("every"), every: DurationString, ...zone }).annotate({
30
+ identifier: "Schedule.When.Every",
31
+ });
32
+ export const Cron = Schema.Struct({ type: Schema.tag("cron"), cron: Schema.String, ...zone }).annotate({
33
+ identifier: "Schedule.When.Cron",
34
+ });
35
+ export const When = Schema.Union([In, At, Every, Cron]).pipe(Schema.toTaggedUnion("type"), Schema.annotate({ identifier: "Schedule.When" }));
36
+ /** Stops a repeating schedule at whichever limit comes first. */
37
+ export const Ends = Schema.Struct({
38
+ after: DurationString.pipe(optional),
39
+ at: Schema.String.pipe(optional),
40
+ times: PositiveInt.pipe(optional),
41
+ }).annotate({ identifier: "Schedule.Ends" });
42
+ export const PromptAction = Schema.Struct({ type: Schema.tag("prompt"), prompt: Schema.String }).annotate({
43
+ identifier: "Schedule.Action.Prompt",
44
+ });
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" });
66
+ export const Status = Schema.Literals(["active", "paused", "done"]).annotate({ identifier: "Schedule.Status" });
67
+ export const Outcome = Schema.Literals([
68
+ "fired",
69
+ "late",
70
+ "checked",
71
+ "expired",
72
+ "skipped",
73
+ "disabled",
74
+ "failed",
75
+ ]).annotate({
76
+ identifier: "Schedule.Outcome",
77
+ });
78
+ export const Info = Schema.Struct({
79
+ id: ID,
80
+ sessionID: SessionID.pipe(optional),
81
+ name: Schema.String.pipe(optional),
82
+ when: When,
83
+ tz: Schema.String,
84
+ if: Condition.pipe(optional),
85
+ until: Condition.pipe(optional),
86
+ action: Action,
87
+ status: Status,
88
+ nextDueAt: DateTimeUtcFromMillis.pipe(optional),
89
+ endsAt: DateTimeUtcFromMillis.pipe(optional),
90
+ remainingRuns: NonNegativeInt.pipe(optional),
91
+ runCount: NonNegativeInt,
92
+ lastFiredAt: DateTimeUtcFromMillis.pipe(optional),
93
+ lastOutcome: Outcome.pipe(optional),
94
+ lastOutput: Schema.String.pipe(optional),
95
+ time: Schema.Struct({ created: DateTimeUtcFromMillis, updated: DateTimeUtcFromMillis }),
96
+ }).annotate({ identifier: "Schedule.Info" });
97
+ export const CreateInput = Schema.Struct({
98
+ sessionID: SessionID,
99
+ name: Schema.String.pipe(optional),
100
+ when: When.pipe(optional),
101
+ if: Condition.pipe(optional),
102
+ until: Condition.pipe(optional),
103
+ ends: Ends.pipe(optional),
104
+ action: Action,
105
+ }).annotate({ identifier: "Schedule.CreateInput" });
106
+ /** Declares a trigger absent, so `{ in, every }` fails instead of decoding as a one-shot. */
107
+ const absent = Schema.optionalKey(Schema.Never);
108
+ /** The `when` callers write: exactly one of `in`, `at`, `every` or `cron`, with an optional `tz`. */
109
+ export const WhenInput = Schema.Union([
110
+ Schema.Struct({ in: In.fields.in, at: absent, every: absent, cron: absent, ...zone }),
111
+ Schema.Struct({ at: At.fields.at, in: absent, every: absent, cron: absent, ...zone }),
112
+ Schema.Struct({ every: Every.fields.every, in: absent, at: absent, cron: absent, ...zone }),
113
+ Schema.Struct({ cron: Cron.fields.cron, in: absent, at: absent, every: absent, ...zone }),
114
+ ]).annotate({ identifier: "Schedule.WhenInput" });
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. */
131
+ export const Request = Schema.Struct({
132
+ name: Schema.String.pipe(optional).annotate({ description: "A short label for the schedule." }),
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".',
141
+ }),
142
+ ends: Ends.pipe(optional).annotate({
143
+ description: 'Stops a repeating schedule at the first limit reached: { after: "8 hours" }, { at }, { times: 3 }.',
144
+ }),
145
+ prompt: Schema.String.check(Schema.isMinLength(1)).annotate({
146
+ description: "The message the Session receives when the schedule wakes.",
147
+ }),
148
+ }).annotate({ identifier: "Schedule.Request" });
149
+ export const toCreateInput = (sessionID, request) => ({
150
+ sessionID,
151
+ name: request.name,
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),
155
+ ends: request.ends,
156
+ action: { type: "prompt", prompt: request.prompt },
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
+ });
165
+ const toWhen = (when) => {
166
+ if (when.in !== undefined)
167
+ return { type: "in", in: when.in, tz: when.tz };
168
+ if (when.at !== undefined)
169
+ return { type: "at", at: when.at, tz: when.tz };
170
+ if (when.every !== undefined)
171
+ return { type: "every", every: when.every, tz: when.tz };
172
+ return { type: "cron", cron: when.cron, tz: when.tz };
173
+ };
@@ -5,3 +5,5 @@ export declare function event(type: string, data: unknown): unknown;
5
5
  export declare function message(type: unknown, data: Record<string, unknown>): Record<string, unknown>;
6
6
  /** Upgrades complete messages, such as those in an exported session, before decoding. */
7
7
  export declare function messages(values: ReadonlyArray<unknown>): unknown[];
8
+ /** Upgrades an assistant content part written before v2.1. */
9
+ export declare function part(value: unknown): unknown;
@@ -47,7 +47,8 @@ function content(data) {
47
47
  return data;
48
48
  return { ...data, content: data.content.map(part) };
49
49
  }
50
- function part(value) {
50
+ /** Upgrades an assistant content part written before v2.1. */
51
+ export function part(value) {
51
52
  if (!isRecord(value))
52
53
  return value;
53
54
  if (value.type === "text" || value.type === "reasoning")
@@ -168,6 +168,7 @@ export declare const PersistedRevert: Schema.decodeTo<Schema.toType<Schema.Struc
168
168
  readonly patch: Schema.String;
169
169
  }>>>, never, never>;
170
170
  }>, never, never>]> & {
171
+ readonly tag: "source";
171
172
  readonly discriminants: readonly ["current", "legacy"];
172
173
  readonly cases: {
173
174
  current: Schema.decodeTo<Schema.Struct<{
@@ -112,6 +112,7 @@ export declare const Data: Schema.Struct<{
112
112
  readonly time: Schema.Struct<{
113
113
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
114
114
  readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
115
+ readonly busy: 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>;
115
116
  readonly idle: 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>;
116
117
  readonly viewed: 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>;
117
118
  readonly archived: 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>;
package/dist/session.d.ts CHANGED
@@ -139,6 +139,9 @@ export declare const Info: Schema.Struct<{
139
139
  readonly time: Schema.Struct<{
140
140
  readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
141
141
  readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
142
+ /** Start of the most recent execution. While it runs, `idle` still holds the previous execution's end. Resuming after a restart starts a new execution. */
143
+ readonly busy: 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>;
144
+ /** End of the most recent completed execution. */
142
145
  readonly idle: 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>;
143
146
  readonly viewed: 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>;
144
147
  readonly archived: 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>;
package/dist/session.js CHANGED
@@ -36,6 +36,9 @@ export const Info = Schema.Struct({
36
36
  time: Schema.Struct({
37
37
  created: DateTimeUtcFromMillis,
38
38
  updated: DateTimeUtcFromMillis,
39
+ /** Start of the most recent execution. While it runs, `idle` still holds the previous execution's end. Resuming after a restart starts a new execution. */
40
+ busy: DateTimeUtcFromMillis.pipe(optional),
41
+ /** End of the most recent completed execution. */
39
42
  idle: DateTimeUtcFromMillis.pipe(optional),
40
43
  viewed: DateTimeUtcFromMillis.pipe(optional),
41
44
  archived: DateTimeUtcFromMillis.pipe(optional),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/schema",
4
- "version": "2.2.0",
4
+ "version": "2.2.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@standard-schema/spec": "1.1.0",
37
- "effect": "4.0.1"
37
+ "effect": "4.0.6"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@tsconfig/bun": "1.0.9",