@fungi.computer/shiitake-extensions 0.3.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.
Files changed (39) hide show
  1. package/README.md +20 -16
  2. package/dist/goal/contract.d.ts +6 -0
  3. package/dist/goal/contract.js +6 -0
  4. package/dist/goal/host.js +183 -31
  5. package/dist/loop/contract.d.ts +136 -2
  6. package/dist/loop/contract.js +45 -2
  7. package/dist/loop/host.js +23 -0
  8. package/dist/question/answer-flow.d.ts +27 -0
  9. package/dist/question/answer-flow.js +115 -0
  10. package/dist/question/client.d.ts +1 -1
  11. package/dist/question/client.js +22 -3
  12. package/dist/question/contract.d.ts +202 -60
  13. package/dist/question/contract.js +78 -22
  14. package/dist/question/host.d.ts +4 -0
  15. package/dist/question/host.js +348 -339
  16. package/dist/roster/conversation-agents.d.ts +21 -1
  17. package/dist/roster/conversation-agents.js +47 -2
  18. package/dist/roster.d.ts +5 -2
  19. package/dist/roster.js +16 -5
  20. package/dist/schedules.d.ts +178 -0
  21. package/dist/schedules.js +182 -0
  22. package/dist/subagents/client.js +64 -20
  23. package/dist/subagents/contract.d.ts +123 -10
  24. package/dist/subagents/contract.js +38 -5
  25. package/dist/subagents/host.d.ts +2 -4
  26. package/dist/subagents/host.js +152 -22
  27. package/docs/api/README.md +1 -0
  28. package/docs/api/goal/contract.md +1 -1
  29. package/docs/api/goal/host.md +22 -1
  30. package/docs/api/loop/contract.md +43 -31
  31. package/docs/api/question/client.md +2 -1
  32. package/docs/api/question/contract.md +183 -51
  33. package/docs/api/question/host.md +30 -0
  34. package/docs/api/roster/conversation-agents.md +34 -8
  35. package/docs/api/roster.md +39 -2
  36. package/docs/api/schedules.md +481 -0
  37. package/docs/api/subagents/contract.md +101 -28
  38. package/docs/api/subagents/host.md +5 -3
  39. package/package.json +9 -6
@@ -16,4 +16,34 @@
16
16
  const questionExtension: RosteredExtensionV0;
17
17
  ```
18
18
 
19
+ Hub's shared roster sends every Ask to a person.
20
+
21
+ ---
22
+
23
+ ### localQuestionExtension
24
+
25
+ ```ts
26
+ const localQuestionExtension: RosteredExtensionV0;
27
+ ```
28
+
29
+ Local's roster sends an Ask to the Agent that sent the asking work first.
30
+
31
+ ## Functions
32
+
33
+ ### questionExtensionFor()
34
+
35
+ ```ts
36
+ function questionExtensionFor(routesToSender): RosteredExtensionV0;
37
+ ```
38
+
19
39
  One durable question owner over the ordinary extension doors.
40
+
41
+ #### Parameters
42
+
43
+ | Parameter | Type |
44
+ | ---------------- | --------- |
45
+ | `routesToSender` | `boolean` |
46
+
47
+ #### Returns
48
+
49
+ `RosteredExtensionV0`
@@ -8,6 +8,24 @@
8
8
 
9
9
  # roster/conversation-agents
10
10
 
11
+ ## Type Aliases
12
+
13
+ ### SendingDirectory
14
+
15
+ ```ts
16
+ type SendingDirectory = Omit<AgentControlDirectory, "open"> & Readonly<{
17
+ open: (agentId, signal) => Promise<Readonly<{
18
+ agent: Readonly<{
19
+ session: (sessionId) => Pick<..., ...>;
20
+ }>;
21
+ release: () => Promise<void>;
22
+ }>>;
23
+ }>;
24
+ ```
25
+
26
+ The directory a conversation sends through; opening a recipient only needs its
27
+ Sessions' extension doors.
28
+
11
29
  ## Functions
12
30
 
13
31
  ### assertOrdinaryAgentCreation()
@@ -39,8 +57,10 @@ function createConversationAgents(storage): object;
39
57
 
40
58
  This host's own record of the Agents each conversation created or sent accepted
41
59
  work to, written as its Agent-control directory accepts them (Wiki:
42
- agent-runtime-tools-and-clients, read-only sub-agent view). It feeds the footer
43
- only; it owns no relationship and grants nothing.
60
+ agent-runtime-tools-and-clients, read-only sub-agent view). Accepted child
61
+ command receipts are separately reconciled against their owner's settlement
62
+ records for the parent's goal guard. Neither record grants authority over a
63
+ child.
44
64
 
45
65
  #### Parameters
46
66
 
@@ -52,7 +72,7 @@ only; it owns no relationship and grants nothing.
52
72
 
53
73
  | Name | Type | Description |
54
74
  | ------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- |
55
- | `recording()` | (`parentSessionId`, `directory`) => `AgentControlDirectory` | Bind acceptance recording to this conversation's existing directory. One conversation's directory: its accepted creates and sends are recorded. |
75
+ | `recording()` | \<`Directory`\>(`parentSessionId`, `directory`) => `Directory` | Bind acceptance recording to this conversation's existing directory. One conversation's directory: its accepted creates and sends are recorded. |
56
76
  | `control()` | (`directoryFor`) => `CapabilitySource` | Agent-control tools bound to the conversation that acquires them. |
57
77
  | `source()` | (`directory`) => [`SubagentSource`](../subagents/host.md#subagentsource) | The footer rows for one conversation; archived and unknown Agents leave it. |
58
78
 
@@ -61,7 +81,14 @@ only; it owns no relationship and grants nothing.
61
81
  ### oysterAgentExtensions()
62
82
 
63
83
  ```ts
64
- function oysterAgentExtensions(source): object;
84
+ function oysterAgentExtensions(source): Readonly<{
85
+ roster: readonly RosteredExtensionV0[];
86
+ grants: readonly Readonly<{
87
+ id: string & Brand<"ExtensionId">;
88
+ capabilities: readonly ExtensionCapabilityV0[];
89
+ grantKey?: string;
90
+ }>[];
91
+ }>;
65
92
  ```
66
93
 
67
94
  Both hosts compose the ordinary roster and its read-only created-Agent footer.
@@ -74,7 +101,6 @@ Both hosts compose the ordinary roster and its read-only created-Agent footer.
74
101
 
75
102
  #### Returns
76
103
 
77
- | Name | Type | Description |
78
- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
79
- | `roster` | `RosteredExtensionV0`[] | Ordinary extensions plus the read-only created-Agent footer. |
80
- | `grants` | `Readonly`\<\{ `id`: `string` & `Brand`\<`"ExtensionId"`\>; `capabilities`: readonly `ExtensionCapabilityV0`[]; `grantKey?`: `string`; \}\>[] | Host grants corresponding to the composed extension roster. |
104
+ `Readonly`\<\{ `roster`: readonly `RosteredExtensionV0`[]; `grants`: readonly
105
+ `Readonly`\<\{ `id`: `string` & `Brand`\<`"ExtensionId"`\>; `capabilities`:
106
+ readonly `ExtensionCapabilityV0`[]; `grantKey?`: `string`; \}\>[]; \}\>
@@ -16,11 +16,33 @@
16
16
  const botanicalAgentExtensions: ExtensionRosterV0;
17
17
  ```
18
18
 
19
- Botanical's product roster with explicit grants. Hub and Local pass this same
20
- value; a stranger host passes its own (or an empty) roster.
19
+ Botanical's shared roster with explicit grants. Local composes its
20
+ sender-routing question extension through `botanicalExtensionsWithSkills`; hosts
21
+ without that Local capability send every Ask to a person.
21
22
 
22
23
  ## Functions
23
24
 
25
+ ### botanicalExtensionsWithSubagents()
26
+
27
+ ```ts
28
+ function botanicalExtensionsWithSubagents(base, source): ExtensionRosterV0;
29
+ ```
30
+
31
+ Compose the goal and footer over one source; an absent goal is a wiring error.
32
+
33
+ #### Parameters
34
+
35
+ | Parameter | Type |
36
+ | --------- | ---------------------------------------------------- |
37
+ | `base` | `ExtensionRosterV0` |
38
+ | `source` | [`SubagentSource`](subagents/host.md#subagentsource) |
39
+
40
+ #### Returns
41
+
42
+ `ExtensionRosterV0`
43
+
44
+ ---
45
+
24
46
  ### botanicalExtensionsWithSkills()
25
47
 
26
48
  ```ts
@@ -38,3 +60,18 @@ A host with a SkillSource grants read-only skill discovery for its own runs.
38
60
  #### Returns
39
61
 
40
62
  `ExtensionRosterV0`
63
+
64
+ ---
65
+
66
+ ### botanicalExtensionsWithSenderRouting()
67
+
68
+ ```ts
69
+ function botanicalExtensionsWithSenderRouting(): ExtensionRosterV0;
70
+ ```
71
+
72
+ Route Asks to the Agent that sent the work, only in a host that owns the Local
73
+ answer door.
74
+
75
+ #### Returns
76
+
77
+ `ExtensionRosterV0`
@@ -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"`; \}\>