@fungi.computer/shiitake-extensions 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/README.md +262 -2
- package/dist/almanac/contract.d.ts +213 -0
- package/dist/almanac/contract.js +77 -0
- package/dist/almanac/host.d.ts +3 -0
- package/dist/almanac/host.js +171 -0
- package/dist/goal/client.d.ts +10 -0
- package/dist/goal/client.js +88 -0
- package/dist/goal/contract.d.ts +172 -0
- package/dist/goal/contract.js +76 -0
- package/dist/goal/host.d.ts +5 -0
- package/dist/goal/host.js +542 -0
- package/dist/home/contract.d.ts +33 -0
- package/dist/home/contract.js +25 -0
- package/dist/home/host.d.ts +18 -0
- package/dist/home/host.js +136 -0
- package/dist/home/routing.d.ts +3 -0
- package/dist/home/routing.js +80 -0
- package/dist/internal/catalog.d.ts +20 -0
- package/dist/internal/catalog.js +33 -0
- package/dist/internal/cron.d.ts +5 -0
- package/dist/internal/cron.js +14 -0
- package/dist/internal/history.d.ts +29 -0
- package/dist/internal/history.js +41 -0
- package/dist/loop/client.d.ts +10 -0
- package/dist/loop/client.js +89 -0
- package/dist/loop/contract.d.ts +342 -0
- package/dist/loop/contract.js +94 -0
- package/dist/loop/host.d.ts +4 -0
- package/dist/loop/host.js +637 -0
- package/dist/plan/client.d.ts +13 -0
- package/dist/plan/client.js +51 -0
- package/dist/plan/contract.d.ts +105 -0
- package/dist/plan/contract.js +38 -0
- package/dist/plan/host.d.ts +3 -0
- package/dist/plan/host.js +154 -0
- package/dist/question/client.d.ts +10 -0
- package/dist/question/client.js +28 -0
- package/dist/question/contract.d.ts +251 -0
- package/dist/question/contract.js +114 -0
- package/dist/question/host.d.ts +3 -0
- package/dist/question/host.js +997 -0
- package/dist/roster.d.ts +9 -0
- package/dist/roster.js +80 -0
- package/dist/skills/host.d.ts +7 -0
- package/dist/skills/host.js +223 -0
- package/dist/skills/source.d.ts +28 -0
- package/dist/skills/source.js +1 -0
- package/dist/subagents/client.d.ts +10 -0
- package/dist/subagents/client.js +53 -0
- package/dist/subagents/contract.d.ts +54 -0
- package/dist/subagents/contract.js +38 -0
- package/dist/subagents/host.d.ts +50 -0
- package/dist/subagents/host.js +176 -0
- package/package.json +117 -3
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
/** A named cron cadence evaluated in one IANA time zone. */
|
|
3
|
+
export declare const LoopCron: Schema.Struct<{
|
|
4
|
+
readonly expression: Schema.String;
|
|
5
|
+
readonly timeZone: Schema.String;
|
|
6
|
+
}>;
|
|
7
|
+
/** One Session's loop as every client sees it. */
|
|
8
|
+
export declare const Loop: Schema.Struct<{
|
|
9
|
+
readonly loopId: Schema.String;
|
|
10
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
11
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
12
|
+
/** Original instruction repeated for every occurrence. */
|
|
13
|
+
readonly prompt: Schema.String;
|
|
14
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
15
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
16
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
17
|
+
readonly expression: Schema.String;
|
|
18
|
+
readonly timeZone: Schema.String;
|
|
19
|
+
}>>;
|
|
20
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
21
|
+
/** Latest accepted command associated with this loop. */
|
|
22
|
+
readonly commandId: Schema.String;
|
|
23
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
24
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
25
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
26
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
27
|
+
/** Visible explanation when loop work failed. */
|
|
28
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
29
|
+
}>;
|
|
30
|
+
/** One Session's loop. */
|
|
31
|
+
export type Loop = Schema.Schema.Type<typeof Loop>;
|
|
32
|
+
/**
|
|
33
|
+
* Arguments of the human `/loop` command. `start` carries the typed text:
|
|
34
|
+
* `<prompt>` paces itself, `<N>m <prompt>` or `<N>h <prompt>` runs on an
|
|
35
|
+
* interval. A bare call opens the controls.
|
|
36
|
+
*/
|
|
37
|
+
export declare const LoopCommandInput: Schema.Union<readonly [Schema.Struct<{
|
|
38
|
+
readonly action: Schema.Literal<"start">;
|
|
39
|
+
readonly text: Schema.String;
|
|
40
|
+
readonly requestId: Schema.String;
|
|
41
|
+
}>, Schema.Struct<{
|
|
42
|
+
readonly action: Schema.Literals<readonly ["status", "pause", "resume", "stop", "new"]>;
|
|
43
|
+
}>, Schema.Struct<{}>]>;
|
|
44
|
+
/** Loop's contract: Session-scope controls and one projection slot. */
|
|
45
|
+
export declare const LoopProjection: Schema.Struct<{
|
|
46
|
+
readonly loop: Schema.NullOr<Schema.Struct<{
|
|
47
|
+
readonly loopId: Schema.String;
|
|
48
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
49
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
50
|
+
/** Original instruction repeated for every occurrence. */
|
|
51
|
+
readonly prompt: Schema.String;
|
|
52
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
53
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
54
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
55
|
+
readonly expression: Schema.String;
|
|
56
|
+
readonly timeZone: Schema.String;
|
|
57
|
+
}>>;
|
|
58
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
59
|
+
/** Latest accepted command associated with this loop. */
|
|
60
|
+
readonly commandId: Schema.String;
|
|
61
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
62
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
63
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
64
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
65
|
+
/** Visible explanation when loop work failed. */
|
|
66
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
67
|
+
}>>;
|
|
68
|
+
readonly history: Schema.Struct<{
|
|
69
|
+
readonly nextSequence: Schema.Int;
|
|
70
|
+
readonly omitted: Schema.Int;
|
|
71
|
+
readonly events: Schema.$Array<Schema.Struct<{
|
|
72
|
+
readonly id: Schema.String;
|
|
73
|
+
readonly sequence: Schema.Int;
|
|
74
|
+
readonly at: Schema.Int;
|
|
75
|
+
readonly commandId: Schema.NullOr<Schema.String>;
|
|
76
|
+
readonly event: Schema.Codec<{
|
|
77
|
+
readonly loopId: string;
|
|
78
|
+
readonly origin: "human" | "model";
|
|
79
|
+
readonly expiresAt: number | null;
|
|
80
|
+
readonly prompt: string;
|
|
81
|
+
readonly mode: "self_paced" | "fixed_interval";
|
|
82
|
+
readonly cron: {
|
|
83
|
+
readonly expression: string;
|
|
84
|
+
readonly timeZone: string;
|
|
85
|
+
} | null;
|
|
86
|
+
readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
|
|
87
|
+
readonly commandId: string;
|
|
88
|
+
readonly reason: string | null;
|
|
89
|
+
readonly nextDueAt: number | null;
|
|
90
|
+
readonly lastError: string | null;
|
|
91
|
+
}, {
|
|
92
|
+
readonly loopId: string;
|
|
93
|
+
readonly origin: "human" | "model";
|
|
94
|
+
readonly expiresAt: number | null;
|
|
95
|
+
readonly prompt: string;
|
|
96
|
+
readonly mode: "self_paced" | "fixed_interval";
|
|
97
|
+
readonly cron: {
|
|
98
|
+
readonly expression: string;
|
|
99
|
+
readonly timeZone: string;
|
|
100
|
+
} | null;
|
|
101
|
+
readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
|
|
102
|
+
readonly commandId: string;
|
|
103
|
+
readonly reason: string | null;
|
|
104
|
+
readonly nextDueAt: number | null;
|
|
105
|
+
readonly lastError: string | null;
|
|
106
|
+
}, never, never>;
|
|
107
|
+
}>>;
|
|
108
|
+
}>;
|
|
109
|
+
}>;
|
|
110
|
+
export declare const loopContract: {
|
|
111
|
+
readonly id: string & import("effect/Brand").Brand<"ExtensionId">;
|
|
112
|
+
readonly commands: {
|
|
113
|
+
readonly loop: {
|
|
114
|
+
readonly scope: "session";
|
|
115
|
+
readonly input: Schema.Union<readonly [Schema.Struct<{
|
|
116
|
+
readonly action: Schema.Literal<"start">;
|
|
117
|
+
readonly text: Schema.String;
|
|
118
|
+
readonly requestId: Schema.String;
|
|
119
|
+
}>, Schema.Struct<{
|
|
120
|
+
readonly action: Schema.Literals<readonly ["status", "pause", "resume", "stop", "new"]>;
|
|
121
|
+
}>, Schema.Struct<{}>]>;
|
|
122
|
+
readonly output: Schema.declare<import("@fungi.computer/whistle/catalog").WhistleCatalogStepV1, import("@fungi.computer/whistle/catalog").WhistleCatalogStepV1>;
|
|
123
|
+
};
|
|
124
|
+
readonly startSelfPaced: {
|
|
125
|
+
readonly scope: "session";
|
|
126
|
+
readonly input: Schema.Struct<{
|
|
127
|
+
readonly prompt: Schema.String;
|
|
128
|
+
readonly requestId: Schema.String;
|
|
129
|
+
}>;
|
|
130
|
+
readonly output: Schema.Struct<{
|
|
131
|
+
readonly loop: Schema.Struct<{
|
|
132
|
+
readonly loopId: Schema.String;
|
|
133
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
134
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
135
|
+
/** Original instruction repeated for every occurrence. */
|
|
136
|
+
readonly prompt: Schema.String;
|
|
137
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
138
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
139
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
140
|
+
readonly expression: Schema.String;
|
|
141
|
+
readonly timeZone: Schema.String;
|
|
142
|
+
}>>;
|
|
143
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
144
|
+
/** Latest accepted command associated with this loop. */
|
|
145
|
+
readonly commandId: Schema.String;
|
|
146
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
147
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
148
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
149
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
150
|
+
/** Visible explanation when loop work failed. */
|
|
151
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
152
|
+
}>;
|
|
153
|
+
readonly accepted: Schema.Struct<{
|
|
154
|
+
readonly status: Schema.Literal<"accepted">;
|
|
155
|
+
readonly commandId: Schema.String;
|
|
156
|
+
}>;
|
|
157
|
+
}>;
|
|
158
|
+
};
|
|
159
|
+
readonly startFixedInterval: {
|
|
160
|
+
readonly scope: "session";
|
|
161
|
+
readonly input: Schema.Struct<{
|
|
162
|
+
readonly expression: Schema.String;
|
|
163
|
+
readonly timeZone: Schema.String;
|
|
164
|
+
readonly prompt: Schema.String;
|
|
165
|
+
readonly requestId: Schema.String;
|
|
166
|
+
}>;
|
|
167
|
+
readonly output: Schema.Struct<{
|
|
168
|
+
readonly loop: Schema.Struct<{
|
|
169
|
+
readonly loopId: Schema.String;
|
|
170
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
171
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
172
|
+
/** Original instruction repeated for every occurrence. */
|
|
173
|
+
readonly prompt: Schema.String;
|
|
174
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
175
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
176
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
177
|
+
readonly expression: Schema.String;
|
|
178
|
+
readonly timeZone: Schema.String;
|
|
179
|
+
}>>;
|
|
180
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
181
|
+
/** Latest accepted command associated with this loop. */
|
|
182
|
+
readonly commandId: Schema.String;
|
|
183
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
184
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
185
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
186
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
187
|
+
/** Visible explanation when loop work failed. */
|
|
188
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
189
|
+
}>;
|
|
190
|
+
readonly accepted: Schema.Struct<{
|
|
191
|
+
readonly status: Schema.Literal<"accepted">;
|
|
192
|
+
readonly commandId: Schema.String;
|
|
193
|
+
}>;
|
|
194
|
+
}>;
|
|
195
|
+
};
|
|
196
|
+
readonly pause: {
|
|
197
|
+
readonly scope: "session";
|
|
198
|
+
readonly input: Schema.Struct<{}>;
|
|
199
|
+
readonly output: Schema.Struct<{
|
|
200
|
+
readonly loopId: Schema.String;
|
|
201
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
202
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
203
|
+
/** Original instruction repeated for every occurrence. */
|
|
204
|
+
readonly prompt: Schema.String;
|
|
205
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
206
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
207
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
208
|
+
readonly expression: Schema.String;
|
|
209
|
+
readonly timeZone: Schema.String;
|
|
210
|
+
}>>;
|
|
211
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
212
|
+
/** Latest accepted command associated with this loop. */
|
|
213
|
+
readonly commandId: Schema.String;
|
|
214
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
215
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
216
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
217
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
218
|
+
/** Visible explanation when loop work failed. */
|
|
219
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
220
|
+
}>;
|
|
221
|
+
};
|
|
222
|
+
readonly resume: {
|
|
223
|
+
readonly scope: "session";
|
|
224
|
+
readonly input: Schema.Struct<{}>;
|
|
225
|
+
readonly output: Schema.Struct<{
|
|
226
|
+
readonly loopId: Schema.String;
|
|
227
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
228
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
229
|
+
/** Original instruction repeated for every occurrence. */
|
|
230
|
+
readonly prompt: Schema.String;
|
|
231
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
232
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
233
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
234
|
+
readonly expression: Schema.String;
|
|
235
|
+
readonly timeZone: Schema.String;
|
|
236
|
+
}>>;
|
|
237
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
238
|
+
/** Latest accepted command associated with this loop. */
|
|
239
|
+
readonly commandId: Schema.String;
|
|
240
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
241
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
242
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
243
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
244
|
+
/** Visible explanation when loop work failed. */
|
|
245
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
246
|
+
}>;
|
|
247
|
+
};
|
|
248
|
+
readonly stop: {
|
|
249
|
+
readonly scope: "session";
|
|
250
|
+
readonly input: Schema.Struct<{}>;
|
|
251
|
+
readonly output: Schema.Struct<{
|
|
252
|
+
readonly loopId: Schema.String;
|
|
253
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
254
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
255
|
+
/** Original instruction repeated for every occurrence. */
|
|
256
|
+
readonly prompt: Schema.String;
|
|
257
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
258
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
259
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
260
|
+
readonly expression: Schema.String;
|
|
261
|
+
readonly timeZone: Schema.String;
|
|
262
|
+
}>>;
|
|
263
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
264
|
+
/** Latest accepted command associated with this loop. */
|
|
265
|
+
readonly commandId: Schema.String;
|
|
266
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
267
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
268
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
269
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
270
|
+
/** Visible explanation when loop work failed. */
|
|
271
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
272
|
+
}>;
|
|
273
|
+
};
|
|
274
|
+
};
|
|
275
|
+
readonly projection: {
|
|
276
|
+
readonly schema: Schema.Struct<{
|
|
277
|
+
readonly loop: Schema.NullOr<Schema.Struct<{
|
|
278
|
+
readonly loopId: Schema.String;
|
|
279
|
+
readonly origin: Schema.Literals<readonly ["human", "model"]>;
|
|
280
|
+
readonly expiresAt: Schema.NullOr<Schema.Int>;
|
|
281
|
+
/** Original instruction repeated for every occurrence. */
|
|
282
|
+
readonly prompt: Schema.String;
|
|
283
|
+
readonly mode: Schema.Literals<readonly ["self_paced", "fixed_interval"]>;
|
|
284
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
285
|
+
readonly cron: Schema.NullOr<Schema.Struct<{
|
|
286
|
+
readonly expression: Schema.String;
|
|
287
|
+
readonly timeZone: Schema.String;
|
|
288
|
+
}>>;
|
|
289
|
+
readonly state: Schema.Literals<readonly ["active", "paused", "finished", "failed", "cancelled"]>;
|
|
290
|
+
/** Latest accepted command associated with this loop. */
|
|
291
|
+
readonly commandId: Schema.String;
|
|
292
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
293
|
+
readonly reason: Schema.NullOr<Schema.String>;
|
|
294
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
295
|
+
readonly nextDueAt: Schema.NullOr<Schema.Int>;
|
|
296
|
+
/** Visible explanation when loop work failed. */
|
|
297
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
298
|
+
}>>;
|
|
299
|
+
readonly history: Schema.Struct<{
|
|
300
|
+
readonly nextSequence: Schema.Int;
|
|
301
|
+
readonly omitted: Schema.Int;
|
|
302
|
+
readonly events: Schema.$Array<Schema.Struct<{
|
|
303
|
+
readonly id: Schema.String;
|
|
304
|
+
readonly sequence: Schema.Int;
|
|
305
|
+
readonly at: Schema.Int;
|
|
306
|
+
readonly commandId: Schema.NullOr<Schema.String>;
|
|
307
|
+
readonly event: Schema.Codec<{
|
|
308
|
+
readonly loopId: string;
|
|
309
|
+
readonly origin: "human" | "model";
|
|
310
|
+
readonly expiresAt: number | null;
|
|
311
|
+
readonly prompt: string;
|
|
312
|
+
readonly mode: "self_paced" | "fixed_interval";
|
|
313
|
+
readonly cron: {
|
|
314
|
+
readonly expression: string;
|
|
315
|
+
readonly timeZone: string;
|
|
316
|
+
} | null;
|
|
317
|
+
readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
|
|
318
|
+
readonly commandId: string;
|
|
319
|
+
readonly reason: string | null;
|
|
320
|
+
readonly nextDueAt: number | null;
|
|
321
|
+
readonly lastError: string | null;
|
|
322
|
+
}, {
|
|
323
|
+
readonly loopId: string;
|
|
324
|
+
readonly origin: "human" | "model";
|
|
325
|
+
readonly expiresAt: number | null;
|
|
326
|
+
readonly prompt: string;
|
|
327
|
+
readonly mode: "self_paced" | "fixed_interval";
|
|
328
|
+
readonly cron: {
|
|
329
|
+
readonly expression: string;
|
|
330
|
+
readonly timeZone: string;
|
|
331
|
+
} | null;
|
|
332
|
+
readonly state: "active" | "paused" | "cancelled" | "finished" | "failed";
|
|
333
|
+
readonly commandId: string;
|
|
334
|
+
readonly reason: string | null;
|
|
335
|
+
readonly nextDueAt: number | null;
|
|
336
|
+
readonly lastError: string | null;
|
|
337
|
+
}, never, never>;
|
|
338
|
+
}>>;
|
|
339
|
+
}>;
|
|
340
|
+
}>;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { historySchema } from "../internal/history.js";
|
|
2
|
+
import { ExtensionId } from "@fungi.computer/shiitake/extensions";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
4
|
+
import { CatalogStep } from "../internal/catalog.js";
|
|
5
|
+
/**
|
|
6
|
+
* Session loop: one repeated prompt per Session, either paced by the model
|
|
7
|
+
* (`schedule_next`) or by a fixed cron cadence. Shared by the server
|
|
8
|
+
* extension and every client; its schemas are the one decoder.
|
|
9
|
+
*/
|
|
10
|
+
const Prompt = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(256 * 1024)));
|
|
11
|
+
const RequestId = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(200)));
|
|
12
|
+
/** A named cron cadence evaluated in one IANA time zone. */
|
|
13
|
+
export const LoopCron = Schema.Struct({
|
|
14
|
+
expression: Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(256))),
|
|
15
|
+
timeZone: Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(128))),
|
|
16
|
+
});
|
|
17
|
+
/** One Session's loop as every client sees it. */
|
|
18
|
+
export const Loop = Schema.Struct({
|
|
19
|
+
loopId: Schema.String,
|
|
20
|
+
origin: Schema.Literals(["human", "model"]),
|
|
21
|
+
expiresAt: Schema.NullOr(Schema.Int),
|
|
22
|
+
/** Original instruction repeated for every occurrence. */
|
|
23
|
+
prompt: Prompt,
|
|
24
|
+
mode: Schema.Literals(["self_paced", "fixed_interval"]),
|
|
25
|
+
/** Cadence of a fixed-interval loop; null when the model paces it. */
|
|
26
|
+
cron: Schema.NullOr(LoopCron),
|
|
27
|
+
state: Schema.Literals([
|
|
28
|
+
"active",
|
|
29
|
+
"paused",
|
|
30
|
+
"finished",
|
|
31
|
+
"failed",
|
|
32
|
+
"cancelled",
|
|
33
|
+
]),
|
|
34
|
+
/** Latest accepted command associated with this loop. */
|
|
35
|
+
commandId: Schema.String,
|
|
36
|
+
/** The model's stated reason for the next self-paced occurrence. */
|
|
37
|
+
reason: Schema.NullOr(Schema.String),
|
|
38
|
+
/** When the next occurrence is due, if one is scheduled. */
|
|
39
|
+
nextDueAt: Schema.NullOr(Schema.Int),
|
|
40
|
+
/** Visible explanation when loop work failed. */
|
|
41
|
+
lastError: Schema.NullOr(Schema.String),
|
|
42
|
+
});
|
|
43
|
+
const StartResult = Schema.Struct({
|
|
44
|
+
loop: Loop,
|
|
45
|
+
accepted: Schema.Struct({
|
|
46
|
+
status: Schema.Literal("accepted"),
|
|
47
|
+
commandId: Schema.String,
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
/**
|
|
51
|
+
* Arguments of the human `/loop` command. `start` carries the typed text:
|
|
52
|
+
* `<prompt>` paces itself, `<N>m <prompt>` or `<N>h <prompt>` runs on an
|
|
53
|
+
* interval. A bare call opens the controls.
|
|
54
|
+
*/
|
|
55
|
+
export const LoopCommandInput = Schema.Union([
|
|
56
|
+
Schema.Struct({
|
|
57
|
+
action: Schema.Literal("start"),
|
|
58
|
+
text: Prompt,
|
|
59
|
+
requestId: RequestId,
|
|
60
|
+
}),
|
|
61
|
+
Schema.Struct({
|
|
62
|
+
action: Schema.Literals(["status", "pause", "resume", "stop", "new"]),
|
|
63
|
+
}),
|
|
64
|
+
Schema.Struct({}),
|
|
65
|
+
]);
|
|
66
|
+
/** Loop's contract: Session-scope controls and one projection slot. */
|
|
67
|
+
export const LoopProjection = Schema.Struct({
|
|
68
|
+
loop: Schema.NullOr(Loop),
|
|
69
|
+
history: historySchema(Loop),
|
|
70
|
+
});
|
|
71
|
+
export const loopContract = {
|
|
72
|
+
id: ExtensionId.make("botanical-session-loop"),
|
|
73
|
+
commands: {
|
|
74
|
+
loop: { scope: "session", input: LoopCommandInput, output: CatalogStep },
|
|
75
|
+
startSelfPaced: {
|
|
76
|
+
scope: "session",
|
|
77
|
+
input: Schema.Struct({ prompt: Prompt, requestId: RequestId }),
|
|
78
|
+
output: StartResult,
|
|
79
|
+
},
|
|
80
|
+
startFixedInterval: {
|
|
81
|
+
scope: "session",
|
|
82
|
+
input: Schema.Struct({
|
|
83
|
+
prompt: Prompt,
|
|
84
|
+
requestId: RequestId,
|
|
85
|
+
...LoopCron.fields,
|
|
86
|
+
}),
|
|
87
|
+
output: StartResult,
|
|
88
|
+
},
|
|
89
|
+
pause: { scope: "session", input: Schema.Struct({}), output: Loop },
|
|
90
|
+
resume: { scope: "session", input: Schema.Struct({}), output: Loop },
|
|
91
|
+
stop: { scope: "session", input: Schema.Struct({}), output: Loop },
|
|
92
|
+
},
|
|
93
|
+
projection: { schema: LoopProjection },
|
|
94
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type RosteredExtensionV0 } from "@fungi.computer/shiitake/extensions";
|
|
2
|
+
/** The commands this extension advertises to every client. */
|
|
3
|
+
export declare const loopCatalog: import("@fungi.computer/shiitake/extensions").Json;
|
|
4
|
+
export declare const loopExtension: RosteredExtensionV0;
|