@opencode/schema 0.0.0-dev-176 → 0.0.0-dev-187
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/experimental.d.ts +1 -0
- package/dist/config/experimental.js +3 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +3 -0
- package/dist/schedule.d.ts +151 -0
- package/dist/schedule.js +72 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ 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 schedules: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
8
9
|
readonly subagent_depth: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
9
10
|
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
11
|
readonly policies: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Array<Schema.Struct<{
|
|
@@ -15,6 +15,9 @@ export class Info extends Schema.Class("ConfigExperimental.Info")({
|
|
|
15
15
|
media_blob: Schema.Boolean.pipe(optional).annotate({
|
|
16
16
|
description: "Store new session media once in a deduplicated blob table instead of inline in every message row. Defaults to false.",
|
|
17
17
|
}),
|
|
18
|
+
schedules: Schema.Boolean.pipe(optional).annotate({
|
|
19
|
+
description: "Enable experimental scheduled tasks that wake a session with a prompt. Defaults to false.",
|
|
20
|
+
}),
|
|
18
21
|
subagent_depth: NonNegativeInt.pipe(optional).annotate({
|
|
19
22
|
description: "Maximum subagent nesting depth. Defaults to 1.",
|
|
20
23
|
}),
|
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
|
}),
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
export * as Schedule from "./schedule.js";
|
|
2
|
+
import { Option, Schema } from "effect";
|
|
3
|
+
export declare const ID: Schema.brand<Schema.String, "Schedule.ID"> & {
|
|
4
|
+
create: () => string & import("effect/Brand").Brand<"Schedule.ID">;
|
|
5
|
+
};
|
|
6
|
+
export type ID = typeof ID.Type;
|
|
7
|
+
/** Milliseconds in a duration string, or `None` when it is not one. */
|
|
8
|
+
export declare const durationMillis: (value: string) => Option.Option<number>;
|
|
9
|
+
/** A duration such as "90 seconds", "5 minutes" or "2 hours". */
|
|
10
|
+
export declare const DurationString: Schema.String;
|
|
11
|
+
export declare const In: Schema.Struct<{
|
|
12
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
13
|
+
readonly type: Schema.tag<"in">;
|
|
14
|
+
readonly in: Schema.String;
|
|
15
|
+
}>;
|
|
16
|
+
/** An instant with an offset, or a wall-clock time in `tz`, e.g. "2026-10-27T09:00". */
|
|
17
|
+
export declare const At: Schema.Struct<{
|
|
18
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
19
|
+
readonly type: Schema.tag<"at">;
|
|
20
|
+
readonly at: Schema.String;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const Every: Schema.Struct<{
|
|
23
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
24
|
+
readonly type: Schema.tag<"every">;
|
|
25
|
+
readonly every: Schema.String;
|
|
26
|
+
}>;
|
|
27
|
+
export declare const Cron: Schema.Struct<{
|
|
28
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
29
|
+
readonly type: Schema.tag<"cron">;
|
|
30
|
+
readonly cron: Schema.String;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const When: Schema.Union<readonly [Schema.Struct<{
|
|
33
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
34
|
+
readonly type: Schema.tag<"in">;
|
|
35
|
+
readonly in: Schema.String;
|
|
36
|
+
}>, Schema.Struct<{
|
|
37
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
38
|
+
readonly type: Schema.tag<"at">;
|
|
39
|
+
readonly at: Schema.String;
|
|
40
|
+
}>, Schema.Struct<{
|
|
41
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
42
|
+
readonly type: Schema.tag<"every">;
|
|
43
|
+
readonly every: Schema.String;
|
|
44
|
+
}>, Schema.Struct<{
|
|
45
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
46
|
+
readonly type: Schema.tag<"cron">;
|
|
47
|
+
readonly cron: Schema.String;
|
|
48
|
+
}>]>;
|
|
49
|
+
export type When = typeof When.Type;
|
|
50
|
+
/** Stops a repeating schedule at whichever limit comes first. */
|
|
51
|
+
export declare const Ends: Schema.Struct<{
|
|
52
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
53
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
54
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
55
|
+
}>;
|
|
56
|
+
export type Ends = typeof Ends.Type;
|
|
57
|
+
export declare const PromptAction: Schema.Struct<{
|
|
58
|
+
readonly type: Schema.tag<"prompt">;
|
|
59
|
+
readonly prompt: Schema.String;
|
|
60
|
+
}>;
|
|
61
|
+
export declare const Action: Schema.Union<readonly [Schema.Struct<{
|
|
62
|
+
readonly type: Schema.tag<"prompt">;
|
|
63
|
+
readonly prompt: Schema.String;
|
|
64
|
+
}>]>;
|
|
65
|
+
export type Action = typeof Action.Type;
|
|
66
|
+
export declare const Status: Schema.Literals<readonly ["active", "paused", "done"]>;
|
|
67
|
+
export type Status = typeof Status.Type;
|
|
68
|
+
export declare const Outcome: Schema.Literals<readonly ["fired", "late", "skipped", "disabled", "failed"]>;
|
|
69
|
+
export type Outcome = typeof Outcome.Type;
|
|
70
|
+
export declare const Info: Schema.Struct<{
|
|
71
|
+
readonly id: Schema.brand<Schema.String, "Schedule.ID"> & {
|
|
72
|
+
create: () => string & import("effect/Brand").Brand<"Schedule.ID">;
|
|
73
|
+
};
|
|
74
|
+
readonly sessionID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "SessionID"> & {
|
|
75
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
76
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "SessionID"> & {
|
|
77
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
78
|
+
}>, never, never>;
|
|
79
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
80
|
+
readonly when: Schema.Union<readonly [Schema.Struct<{
|
|
81
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
82
|
+
readonly type: Schema.tag<"in">;
|
|
83
|
+
readonly in: Schema.String;
|
|
84
|
+
}>, Schema.Struct<{
|
|
85
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
86
|
+
readonly type: Schema.tag<"at">;
|
|
87
|
+
readonly at: Schema.String;
|
|
88
|
+
}>, Schema.Struct<{
|
|
89
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
90
|
+
readonly type: Schema.tag<"every">;
|
|
91
|
+
readonly every: Schema.String;
|
|
92
|
+
}>, Schema.Struct<{
|
|
93
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
94
|
+
readonly type: Schema.tag<"cron">;
|
|
95
|
+
readonly cron: Schema.String;
|
|
96
|
+
}>]>;
|
|
97
|
+
readonly tz: Schema.String;
|
|
98
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
99
|
+
readonly type: Schema.tag<"prompt">;
|
|
100
|
+
readonly prompt: Schema.String;
|
|
101
|
+
}>]>;
|
|
102
|
+
readonly status: Schema.Literals<readonly ["active", "paused", "done"]>;
|
|
103
|
+
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>;
|
|
104
|
+
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>;
|
|
105
|
+
readonly remainingRuns: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
106
|
+
readonly runCount: Schema.Int;
|
|
107
|
+
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>;
|
|
108
|
+
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>;
|
|
109
|
+
readonly time: Schema.Struct<{
|
|
110
|
+
readonly created: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
111
|
+
readonly updated: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
|
112
|
+
}>;
|
|
113
|
+
}>;
|
|
114
|
+
export type Info = typeof Info.Type;
|
|
115
|
+
export declare const CreateInput: Schema.Struct<{
|
|
116
|
+
readonly sessionID: Schema.brand<Schema.String, "SessionID"> & {
|
|
117
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
118
|
+
};
|
|
119
|
+
readonly name: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
120
|
+
readonly when: Schema.Union<readonly [Schema.Struct<{
|
|
121
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
122
|
+
readonly type: Schema.tag<"in">;
|
|
123
|
+
readonly in: Schema.String;
|
|
124
|
+
}>, Schema.Struct<{
|
|
125
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
126
|
+
readonly type: Schema.tag<"at">;
|
|
127
|
+
readonly at: Schema.String;
|
|
128
|
+
}>, Schema.Struct<{
|
|
129
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
130
|
+
readonly type: Schema.tag<"every">;
|
|
131
|
+
readonly every: Schema.String;
|
|
132
|
+
}>, Schema.Struct<{
|
|
133
|
+
readonly tz: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
134
|
+
readonly type: Schema.tag<"cron">;
|
|
135
|
+
readonly cron: Schema.String;
|
|
136
|
+
}>]>;
|
|
137
|
+
readonly ends: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
138
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
139
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
140
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
141
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
142
|
+
readonly after: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
143
|
+
readonly at: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
144
|
+
readonly times: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
145
|
+
}>>, never, never>;
|
|
146
|
+
readonly action: Schema.Union<readonly [Schema.Struct<{
|
|
147
|
+
readonly type: Schema.tag<"prompt">;
|
|
148
|
+
readonly prompt: Schema.String;
|
|
149
|
+
}>]>;
|
|
150
|
+
}>;
|
|
151
|
+
export type CreateInput = typeof CreateInput.Type;
|
package/dist/schedule.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
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". */
|
|
13
|
+
export const DurationString = Schema.String.check(Schema.makeFilter((value) => Option.match(durationMillis(value), {
|
|
14
|
+
onNone: () => `expected a duration such as "5 minutes", got ${JSON.stringify(value)}`,
|
|
15
|
+
onSome: (millis) => millis > 0 || "expected a positive duration",
|
|
16
|
+
}))).annotate({ identifier: "Schedule.Duration" });
|
|
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
|
+
export const Status = Schema.Literals(["active", "paused", "done"]).annotate({ identifier: "Schedule.Status" });
|
|
47
|
+
export const Outcome = Schema.Literals(["fired", "late", "skipped", "disabled", "failed"]).annotate({
|
|
48
|
+
identifier: "Schedule.Outcome",
|
|
49
|
+
});
|
|
50
|
+
export const Info = Schema.Struct({
|
|
51
|
+
id: ID,
|
|
52
|
+
sessionID: SessionID.pipe(optional),
|
|
53
|
+
name: Schema.String.pipe(optional),
|
|
54
|
+
when: When,
|
|
55
|
+
tz: Schema.String,
|
|
56
|
+
action: Action,
|
|
57
|
+
status: Status,
|
|
58
|
+
nextDueAt: DateTimeUtcFromMillis.pipe(optional),
|
|
59
|
+
endsAt: DateTimeUtcFromMillis.pipe(optional),
|
|
60
|
+
remainingRuns: NonNegativeInt.pipe(optional),
|
|
61
|
+
runCount: NonNegativeInt,
|
|
62
|
+
lastFiredAt: DateTimeUtcFromMillis.pipe(optional),
|
|
63
|
+
lastOutcome: Outcome.pipe(optional),
|
|
64
|
+
time: Schema.Struct({ created: DateTimeUtcFromMillis, updated: DateTimeUtcFromMillis }),
|
|
65
|
+
}).annotate({ identifier: "Schedule.Info" });
|
|
66
|
+
export const CreateInput = Schema.Struct({
|
|
67
|
+
sessionID: SessionID,
|
|
68
|
+
name: Schema.String.pipe(optional),
|
|
69
|
+
when: When,
|
|
70
|
+
ends: Ends.pipe(optional),
|
|
71
|
+
action: Action,
|
|
72
|
+
}).annotate({ identifier: "Schedule.CreateInput" });
|