@fungi.computer/shiitake-extensions 0.4.0 → 0.5.0

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.
@@ -0,0 +1,481 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/shiitake-extensions**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/shiitake-extensions](README.md) / schedules
8
+
9
+ # schedules
10
+
11
+ ## Type Aliases
12
+
13
+ ### AgentScheduleRow
14
+
15
+ ```ts
16
+ type AgentScheduleRow = typeof agentScheduleRowSchema.Type;
17
+ ```
18
+
19
+ One Agent's retained schedule, including its native content.
20
+
21
+ ---
22
+
23
+ ### AgentScheduleTarget
24
+
25
+ ```ts
26
+ type AgentScheduleTarget = z.output<typeof agentScheduleTargetSchema>;
27
+ ```
28
+
29
+ Identity to admit before acquiring the corresponding Agent owner.
30
+
31
+ ---
32
+
33
+ ### AgentSchedulePage
34
+
35
+ ```ts
36
+ type AgentSchedulePage = typeof agentSchedulePageSchema.Type;
37
+ ```
38
+
39
+ One Agent's page, with no directory fan-out or availability policy.
40
+
41
+ ---
42
+
43
+ ### AgentScheduleControlReceipt
44
+
45
+ ```ts
46
+ type AgentScheduleControlReceipt =
47
+ typeof agentScheduleControlReceiptSchema.Type;
48
+ ```
49
+
50
+ Content-free acknowledgement of the native owner's completed transition.
51
+
52
+ ## Variables
53
+
54
+ ### agentScheduleCursorSchema
55
+
56
+ ```ts
57
+ const agentScheduleCursorSchema: ZodObject<
58
+ {
59
+ agentId: ZodString;
60
+ kind: ZodUnion<readonly [ZodLiteral<"almanac">, ZodLiteral<"loop">]>;
61
+ after: ZodOptional<ZodString>;
62
+ },
63
+ $strict
64
+ >;
65
+ ```
66
+
67
+ Exclusive native key within one Agent's Almanac-then-Loop traversal.
68
+
69
+ ---
70
+
71
+ ### agentScheduleListInputSchema
72
+
73
+ ```ts
74
+ const agentScheduleListInputSchema: ZodObject<
75
+ {
76
+ after: ZodOptional<
77
+ ZodObject<
78
+ {
79
+ agentId: ZodString;
80
+ kind: ZodUnion<readonly [ZodLiteral<"almanac">, ZodLiteral<"loop">]>;
81
+ after: ZodOptional<ZodString>;
82
+ },
83
+ $strict
84
+ >
85
+ >;
86
+ limit: ZodDefault<ZodNumber>;
87
+ },
88
+ $strict
89
+ >;
90
+ ```
91
+
92
+ One bounded read; a full native page conservatively carries continuation.
93
+
94
+ ---
95
+
96
+ ### agentScheduleRowSchema
97
+
98
+ ```ts
99
+ const agentScheduleRowSchema: Union<
100
+ readonly [
101
+ Struct<{
102
+ agentId: String;
103
+ kind: Literal<"almanac">;
104
+ schedule: Struct<{
105
+ id: String;
106
+ sessionId: String;
107
+ prompt: String;
108
+ cron: NullOr<
109
+ Struct<{
110
+ expression: String;
111
+ timeZone: String;
112
+ }>
113
+ >;
114
+ nextDueAt: Int;
115
+ state: Literals<readonly ["active", "paused", "cancelled", "finished"]>;
116
+ lastCommandId: NullOr<String>;
117
+ lastError: NullOr<String>;
118
+ attempt: Int;
119
+ }>;
120
+ }>,
121
+ Struct<{
122
+ agentId: String;
123
+ kind: Literal<"loop">;
124
+ schedule: Struct<{
125
+ loopId: String;
126
+ origin: Literals<readonly ["human", "model"]>;
127
+ expiresAt: NullOr<Int>;
128
+ prompt: String;
129
+ mode: Literals<readonly ["self_paced", "fixed_interval"]>;
130
+ cron: NullOr<
131
+ Struct<{
132
+ expression: String;
133
+ timeZone: String;
134
+ }>
135
+ >;
136
+ state: Literals<
137
+ readonly ["active", "paused", "finished", "failed", "cancelled"]
138
+ >;
139
+ commandId: String;
140
+ reason: NullOr<String>;
141
+ nextDueAt: NullOr<Int>;
142
+ lastError: NullOr<String>;
143
+ consecutiveFailures: Int;
144
+ sessionId: String;
145
+ }>;
146
+ }>,
147
+ ]
148
+ >;
149
+ ```
150
+
151
+ Content-bearing read projection, decoded by the retained native contracts.
152
+
153
+ ---
154
+
155
+ ### agentScheduleTargetSchema
156
+
157
+ ```ts
158
+ const agentScheduleTargetSchema: ZodDiscriminatedUnion<
159
+ [
160
+ ZodObject<
161
+ {
162
+ kind: ZodLiteral<"almanac">;
163
+ agentId: ZodString;
164
+ scheduleId: ZodString &
165
+ ZodType<string, string, $ZodTypeInternals<string, string>>;
166
+ },
167
+ $strict
168
+ >,
169
+ ZodObject<
170
+ {
171
+ kind: ZodLiteral<"loop">;
172
+ agentId: ZodString;
173
+ sessionId: ZodString &
174
+ ZodType<string, string, $ZodTypeInternals<string, string>>;
175
+ loopId: ZodString &
176
+ ZodType<string, string, $ZodTypeInternals<string, string>>;
177
+ },
178
+ $strict
179
+ >,
180
+ ],
181
+ "kind"
182
+ >;
183
+ ```
184
+
185
+ Exact listed identity; a Loop target never selects its later replacement.
186
+
187
+ ---
188
+
189
+ ### agentSchedulePageSchema
190
+
191
+ ```ts
192
+ const agentSchedulePageSchema: Struct<{
193
+ items: $Array<Union<readonly [Struct<{
194
+ agentId: String;
195
+ kind: Literal<"almanac">;
196
+ schedule: Struct<{
197
+ id: String;
198
+ sessionId: String;
199
+ prompt: String;
200
+ cron: NullOr<Struct<...>>;
201
+ nextDueAt: Int;
202
+ state: Literals<readonly [..., ..., ..., ...]>;
203
+ lastCommandId: NullOr<String>;
204
+ lastError: NullOr<String>;
205
+ attempt: Int;
206
+ }>;
207
+ }>, Struct<{
208
+ agentId: String;
209
+ kind: Literal<"loop">;
210
+ schedule: Struct<{
211
+ loopId: String;
212
+ origin: Literals<readonly [..., ...]>;
213
+ expiresAt: NullOr<Int>;
214
+ prompt: String;
215
+ mode: Literals<readonly [..., ...]>;
216
+ cron: NullOr<Struct<...>>;
217
+ state: Literals<readonly [..., ..., ..., ..., ...]>;
218
+ commandId: String;
219
+ reason: NullOr<String>;
220
+ nextDueAt: NullOr<Int>;
221
+ lastError: NullOr<String>;
222
+ consecutiveFailures: Int;
223
+ sessionId: String;
224
+ }>;
225
+ }>]>>;
226
+ next: NullOr<Struct<{
227
+ agentId: String;
228
+ kind: Literals<readonly ["almanac", "loop"]>;
229
+ after: optionalKey<String>;
230
+ }>>;
231
+ }>;
232
+ ```
233
+
234
+ A bounded content-bearing page; owner failures reject rather than look empty.
235
+
236
+ ---
237
+
238
+ ### agentScheduleControlReceiptSchema
239
+
240
+ ```ts
241
+ const agentScheduleControlReceiptSchema: Union<
242
+ readonly [
243
+ Struct<{
244
+ agentId: String;
245
+ kind: Literal<"almanac">;
246
+ scheduleId: String;
247
+ state: Literals<readonly ["active", "paused", "cancelled", "finished"]>;
248
+ }>,
249
+ Struct<{
250
+ agentId: String;
251
+ kind: Literal<"loop">;
252
+ sessionId: String;
253
+ loopId: String;
254
+ state: Literals<
255
+ readonly ["active", "paused", "finished", "failed", "cancelled"]
256
+ >;
257
+ }>,
258
+ ]
259
+ >;
260
+ ```
261
+
262
+ Manage-only result: exact target and native state, never prompt or history.
263
+
264
+ ## Functions
265
+
266
+ ### readAgentSchedulePage()
267
+
268
+ ```ts
269
+ function readAgentSchedulePage(
270
+ agentId,
271
+ owner,
272
+ input?,
273
+ ): Promise<{
274
+ items: readonly (
275
+ | {
276
+ agentId: string;
277
+ kind: "almanac";
278
+ schedule: {
279
+ id: string;
280
+ sessionId: string;
281
+ prompt: string;
282
+ cron: {
283
+ expression: string;
284
+ timeZone: string;
285
+ } | null;
286
+ nextDueAt: number;
287
+ state: "active" | "paused" | "cancelled" | "finished";
288
+ lastCommandId: string | null;
289
+ lastError: string | null;
290
+ attempt: number;
291
+ };
292
+ }
293
+ | {
294
+ agentId: string;
295
+ kind: "loop";
296
+ schedule: {
297
+ loopId: string;
298
+ origin: "human" | "model";
299
+ expiresAt: number | null;
300
+ prompt: string;
301
+ mode: "self_paced" | "fixed_interval";
302
+ cron: {
303
+ expression: string;
304
+ timeZone: string;
305
+ } | null;
306
+ state: "active" | "paused" | "cancelled" | "finished" | "failed";
307
+ commandId: string;
308
+ reason: string | null;
309
+ nextDueAt: number | null;
310
+ lastError: string | null;
311
+ consecutiveFailures: number;
312
+ sessionId: string;
313
+ };
314
+ }
315
+ )[];
316
+ next: {
317
+ agentId: string;
318
+ kind: "loop" | "almanac";
319
+ after?: string;
320
+ } | null;
321
+ }>;
322
+ ```
323
+
324
+ Read one already-admitted Agent, without scanning Sessions or draining pages.
325
+ The caller owns Agent, home and resource authorization and the owner's lifetime.
326
+
327
+ #### Parameters
328
+
329
+ | Parameter | Type | Description |
330
+ | --------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
331
+ | `agentId` | `string` | - |
332
+ | `owner` | `Pick`\<`ShiitakeAgent`, `"extensions"`\> | - |
333
+ | `input` | \{ `after?`: \{ `agentId`: `string`; `kind`: `"loop"` \| `"almanac"`; `after?`: `string`; \}; `limit?`: `number`; \} | - |
334
+ | `input.after?` | \{ `agentId`: `string`; `kind`: `"loop"` \| `"almanac"`; `after?`: `string`; \} | Native continuation from the previous page of this Agent's schedules. |
335
+ | `input.after.agentId` | `string` | Agent whose retained schedules this continuation traverses. |
336
+ | `input.after.kind` | `"loop"` \| `"almanac"` | Native owner to continue; Almanac precedes Loop in a fresh traversal. |
337
+ | `input.after.after?` | `string` | Exclusive Almanac schedule ID or Loop Session ID; absent starts the kind. |
338
+ | `input.limit?` | `number` | Shared row budget across both native kinds; defaults to and cannot exceed 64. |
339
+
340
+ #### Returns
341
+
342
+ `Promise`\<\{ `items`: readonly ( \| \{ `agentId`: `string`; `kind`:
343
+ `"almanac"`; `schedule`: \{ `id`: `string`; `sessionId`: `string`; `prompt`:
344
+ `string`; `cron`: \| \{ `expression`: `string`; `timeZone`: `string`; \} \|
345
+ `null`; `nextDueAt`: `number`; `state`: `"active"` \| `"paused"` \|
346
+ `"cancelled"` \| `"finished"`; `lastCommandId`: `string` \| `null`; `lastError`:
347
+ `string` \| `null`; `attempt`: `number`; \}; \} \| \{ `agentId`: `string`;
348
+ `kind`: `"loop"`; `schedule`: \{ `loopId`: `string`; `origin`: `"human"` \|
349
+ `"model"`; `expiresAt`: `number` \| `null`; `prompt`: `string`; `mode`:
350
+ `"self_paced"` \| `"fixed_interval"`; `cron`: \| \{ `expression`: `string`;
351
+ `timeZone`: `string`; \} \| `null`; `state`: `"active"` \| `"paused"` \|
352
+ `"cancelled"` \| `"finished"` \| `"failed"`; `commandId`: `string`; `reason`:
353
+ `string` \| `null`; `nextDueAt`: `number` \| `null`; `lastError`: `string` \|
354
+ `null`; `consecutiveFailures`: `number`; `sessionId`: `string`; \}; \})[];
355
+ `next`: \| \{ `agentId`: `string`; `kind`: `"loop"` \| `"almanac"`; `after?`:
356
+ `string`; \} \| `null`; \}\>
357
+
358
+ ---
359
+
360
+ ### controlAgentScheduleWithContent()
361
+
362
+ ```ts
363
+ function controlAgentScheduleWithContent(
364
+ owner,
365
+ input,
366
+ action,
367
+ ): Promise<
368
+ | {
369
+ agentId: string;
370
+ kind: "almanac";
371
+ schedule: {
372
+ id: string;
373
+ sessionId: string;
374
+ prompt: string;
375
+ cron: {
376
+ expression: string;
377
+ timeZone: string;
378
+ } | null;
379
+ nextDueAt: number;
380
+ state: "active" | "paused" | "cancelled" | "finished";
381
+ lastCommandId: string | null;
382
+ lastError: string | null;
383
+ attempt: number;
384
+ };
385
+ }
386
+ | {
387
+ agentId: string;
388
+ kind: "loop";
389
+ schedule: {
390
+ loopId: string;
391
+ origin: "human" | "model";
392
+ expiresAt: number | null;
393
+ prompt: string;
394
+ mode: "self_paced" | "fixed_interval";
395
+ cron: {
396
+ expression: string;
397
+ timeZone: string;
398
+ } | null;
399
+ state: "active" | "paused" | "cancelled" | "finished" | "failed";
400
+ commandId: string;
401
+ reason: string | null;
402
+ nextDueAt: number | null;
403
+ lastError: string | null;
404
+ consecutiveFailures: number;
405
+ sessionId: string;
406
+ };
407
+ }
408
+ >;
409
+ ```
410
+
411
+ Explicit content-returning control for callers admitted to both read and manage.
412
+ In particular, private Local retains its native-row reply. The supplied owner
413
+ must already be admitted for target.agentId; this helper grants no authority.
414
+
415
+ #### Parameters
416
+
417
+ | Parameter | Type |
418
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
419
+ | `owner` | `Pick`\<`ShiitakeAgent`, `"extensions"`\> |
420
+ | `input` | \| \{ `kind`: `"almanac"`; `agentId`: `string`; `scheduleId`: `string`; \} \| \{ `kind`: `"loop"`; `agentId`: `string`; `sessionId`: `string`; `loopId`: `string`; \} |
421
+ | `action` | `"pause"` \| `"delete"` |
422
+
423
+ #### Returns
424
+
425
+ `Promise`\< \| \{ `agentId`: `string`; `kind`: `"almanac"`; `schedule`: \{ `id`:
426
+ `string`; `sessionId`: `string`; `prompt`: `string`; `cron`: \| \{ `expression`:
427
+ `string`; `timeZone`: `string`; \} \| `null`; `nextDueAt`: `number`; `state`:
428
+ `"active"` \| `"paused"` \| `"cancelled"` \| `"finished"`; `lastCommandId`:
429
+ `string` \| `null`; `lastError`: `string` \| `null`; `attempt`: `number`; \}; \}
430
+ \| \{ `agentId`: `string`; `kind`: `"loop"`; `schedule`: \{ `loopId`: `string`;
431
+ `origin`: `"human"` \| `"model"`; `expiresAt`: `number` \| `null`; `prompt`:
432
+ `string`; `mode`: `"self_paced"` \| `"fixed_interval"`; `cron`: \| \{
433
+ `expression`: `string`; `timeZone`: `string`; \} \| `null`; `state`: `"active"`
434
+ \| `"paused"` \| `"cancelled"` \| `"finished"` \| `"failed"`; `commandId`:
435
+ `string`; `reason`: `string` \| `null`; `nextDueAt`: `number` \| `null`;
436
+ `lastError`: `string` \| `null`; `consecutiveFailures`: `number`; `sessionId`:
437
+ `string`; \}; \}\>
438
+
439
+ ---
440
+
441
+ ### controlAgentSchedule()
442
+
443
+ ```ts
444
+ function controlAgentSchedule(
445
+ owner,
446
+ target,
447
+ action,
448
+ ): Promise<
449
+ | {
450
+ agentId: string;
451
+ kind: "almanac";
452
+ scheduleId: string;
453
+ state: "active" | "paused" | "cancelled" | "finished";
454
+ }
455
+ | {
456
+ agentId: string;
457
+ kind: "loop";
458
+ sessionId: string;
459
+ loopId: string;
460
+ state: "active" | "paused" | "cancelled" | "finished" | "failed";
461
+ }
462
+ >;
463
+ ```
464
+
465
+ Control an already-admitted owner; manage-only callers receive no read content.
466
+
467
+ #### Parameters
468
+
469
+ | Parameter | Type |
470
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
471
+ | `owner` | `Pick`\<`ShiitakeAgent`, `"extensions"`\> |
472
+ | `target` | \| \{ `kind`: `"almanac"`; `agentId`: `string`; `scheduleId`: `string`; \} \| \{ `kind`: `"loop"`; `agentId`: `string`; `sessionId`: `string`; `loopId`: `string`; \} |
473
+ | `action` | `"pause"` \| `"delete"` |
474
+
475
+ #### Returns
476
+
477
+ `Promise`\< \| \{ `agentId`: `string`; `kind`: `"almanac"`; `scheduleId`:
478
+ `string`; `state`: `"active"` \| `"paused"` \| `"cancelled"` \| `"finished"`; \}
479
+ \| \{ `agentId`: `string`; `kind`: `"loop"`; `sessionId`: `string`; `loopId`:
480
+ `string`; `state`: `"active"` \| `"paused"` \| `"cancelled"` \| `"finished"` \|
481
+ `"failed"`; \}\>
@@ -78,7 +78,6 @@ stops the Agent's work.
78
78
  type SubagentTiming = Readonly<{
79
79
  refreshMs: number;
80
80
  pollMs: number;
81
- interestMs: number;
82
81
  }>;
83
82
  ```
84
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/shiitake-extensions",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "private": false,
6
6
  "description": "Botanical's product Shiitake extensions: goal, loop and Almanac on the generic extension surface",
@@ -46,6 +46,10 @@
46
46
  "types": "./dist/roster.d.ts",
47
47
  "import": "./dist/roster.js"
48
48
  },
49
+ "./schedules": {
50
+ "types": "./dist/schedules.d.ts",
51
+ "import": "./dist/schedules.js"
52
+ },
49
53
  "./roster/conversation-agents": {
50
54
  "types": "./dist/roster/conversation-agents.d.ts",
51
55
  "import": "./dist/roster/conversation-agents.js"
@@ -108,9 +112,9 @@
108
112
  "dependencies": {
109
113
  "@fungi.computer/almanac": "0.2.0",
110
114
  "@fungi.computer/cairn": "0.1.0",
111
- "@fungi.computer/knapsack": "0.4.0",
112
- "@fungi.computer/mycelium": "0.2.3",
113
- "@fungi.computer/shiitake": "0.6.0",
115
+ "@fungi.computer/knapsack": "0.4.1",
116
+ "@fungi.computer/mycelium": "0.3.0",
117
+ "@fungi.computer/shiitake": "0.7.0",
114
118
  "@fungi.computer/watchdog": "0.1.0",
115
119
  "@fungi.computer/whistle": "0.3.0",
116
120
  "effect": "4.0.2",