@fungi.computer/shiitake-extensions 0.4.0 → 0.6.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,228 @@
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/client
8
+
9
+ # schedules/client
10
+
11
+ ## Functions
12
+
13
+ ### readAgentSchedulePage()
14
+
15
+ ```ts
16
+ function readAgentSchedulePage(
17
+ agentId,
18
+ owner,
19
+ input?,
20
+ ): Promise<{
21
+ items: readonly (
22
+ | {
23
+ agentId: string;
24
+ kind: "almanac";
25
+ schedule: {
26
+ id: string;
27
+ sessionId: string;
28
+ prompt: string;
29
+ cron: {
30
+ expression: string;
31
+ timeZone: string;
32
+ } | null;
33
+ nextDueAt: number;
34
+ state: "active" | "paused" | "cancelled" | "finished";
35
+ lastCommandId: string | null;
36
+ lastError: string | null;
37
+ attempt: number;
38
+ };
39
+ }
40
+ | {
41
+ agentId: string;
42
+ kind: "loop";
43
+ schedule: {
44
+ loopId: string;
45
+ origin: "human" | "model";
46
+ expiresAt: number | null;
47
+ prompt: string;
48
+ mode: "self_paced" | "fixed_interval";
49
+ cron: {
50
+ expression: string;
51
+ timeZone: string;
52
+ } | null;
53
+ state: "active" | "paused" | "cancelled" | "finished" | "failed";
54
+ commandId: string;
55
+ reason: string | null;
56
+ nextDueAt: number | null;
57
+ lastError: string | null;
58
+ consecutiveFailures: number;
59
+ sessionId: string;
60
+ };
61
+ }
62
+ )[];
63
+ next: {
64
+ agentId: string;
65
+ kind: "loop" | "almanac";
66
+ after?: string;
67
+ } | null;
68
+ }>;
69
+ ```
70
+
71
+ Read one already-admitted Agent, without scanning Sessions or draining pages.
72
+ The caller owns Agent, home and resource authorization and the owner's lifetime.
73
+
74
+ #### Parameters
75
+
76
+ | Parameter | Type | Description |
77
+ | --------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
78
+ | `agentId` | `string` | - |
79
+ | `owner` | `Pick`\<`ShiitakeAgent`, `"extensions"`\> | - |
80
+ | `input` | \{ `after?`: \{ `agentId`: `string`; `kind`: `"loop"` \| `"almanac"`; `after?`: `string`; \}; `limit?`: `number`; \} | - |
81
+ | `input.after?` | \{ `agentId`: `string`; `kind`: `"loop"` \| `"almanac"`; `after?`: `string`; \} | Native continuation from the previous page of this Agent's schedules. |
82
+ | `input.after.agentId` | `string` | Agent whose retained schedules this continuation traverses. |
83
+ | `input.after.kind` | `"loop"` \| `"almanac"` | Native owner to continue; Almanac precedes Loop in a fresh traversal. |
84
+ | `input.after.after?` | `string` | Exclusive Almanac schedule ID or Loop Session ID; absent starts the kind. |
85
+ | `input.limit?` | `number` | Shared row budget across both native kinds; defaults to and cannot exceed 64. |
86
+
87
+ #### Returns
88
+
89
+ `Promise`\<\{ `items`: readonly ( \| \{ `agentId`: `string`; `kind`:
90
+ `"almanac"`; `schedule`: \{ `id`: `string`; `sessionId`: `string`; `prompt`:
91
+ `string`; `cron`: \| \{ `expression`: `string`; `timeZone`: `string`; \} \|
92
+ `null`; `nextDueAt`: `number`; `state`: `"active"` \| `"paused"` \|
93
+ `"cancelled"` \| `"finished"`; `lastCommandId`: `string` \| `null`; `lastError`:
94
+ `string` \| `null`; `attempt`: `number`; \}; \} \| \{ `agentId`: `string`;
95
+ `kind`: `"loop"`; `schedule`: \{ `loopId`: `string`; `origin`: `"human"` \|
96
+ `"model"`; `expiresAt`: `number` \| `null`; `prompt`: `string`; `mode`:
97
+ `"self_paced"` \| `"fixed_interval"`; `cron`: \| \{ `expression`: `string`;
98
+ `timeZone`: `string`; \} \| `null`; `state`: `"active"` \| `"paused"` \|
99
+ `"cancelled"` \| `"finished"` \| `"failed"`; `commandId`: `string`; `reason`:
100
+ `string` \| `null`; `nextDueAt`: `number` \| `null`; `lastError`: `string` \|
101
+ `null`; `consecutiveFailures`: `number`; `sessionId`: `string`; \}; \})[];
102
+ `next`: \| \{ `agentId`: `string`; `kind`: `"loop"` \| `"almanac"`; `after?`:
103
+ `string`; \} \| `null`; \}\>
104
+
105
+ ---
106
+
107
+ ### controlAgentScheduleWithContent()
108
+
109
+ ```ts
110
+ function controlAgentScheduleWithContent(
111
+ owner,
112
+ input,
113
+ action,
114
+ ): Promise<
115
+ | {
116
+ agentId: string;
117
+ kind: "almanac";
118
+ schedule: {
119
+ id: string;
120
+ sessionId: string;
121
+ prompt: string;
122
+ cron: {
123
+ expression: string;
124
+ timeZone: string;
125
+ } | null;
126
+ nextDueAt: number;
127
+ state: "active" | "paused" | "cancelled" | "finished";
128
+ lastCommandId: string | null;
129
+ lastError: string | null;
130
+ attempt: number;
131
+ };
132
+ }
133
+ | {
134
+ agentId: string;
135
+ kind: "loop";
136
+ schedule: {
137
+ loopId: string;
138
+ origin: "human" | "model";
139
+ expiresAt: number | null;
140
+ prompt: string;
141
+ mode: "self_paced" | "fixed_interval";
142
+ cron: {
143
+ expression: string;
144
+ timeZone: string;
145
+ } | null;
146
+ state: "active" | "paused" | "cancelled" | "finished" | "failed";
147
+ commandId: string;
148
+ reason: string | null;
149
+ nextDueAt: number | null;
150
+ lastError: string | null;
151
+ consecutiveFailures: number;
152
+ sessionId: string;
153
+ };
154
+ }
155
+ >;
156
+ ```
157
+
158
+ Explicit content-returning control for callers admitted to both read and manage.
159
+ In particular, private Local retains its native-row reply. The supplied owner
160
+ must already be admitted for target.agentId; this helper grants no authority.
161
+
162
+ #### Parameters
163
+
164
+ | Parameter | Type |
165
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
166
+ | `owner` | `Pick`\<`ShiitakeAgent`, `"extensions"`\> |
167
+ | `input` | \| \{ `kind`: `"almanac"`; `agentId`: `string`; `scheduleId`: `string`; \} \| \{ `kind`: `"loop"`; `agentId`: `string`; `sessionId`: `string`; `loopId`: `string`; \} |
168
+ | `action` | `"pause"` \| `"resume"` \| `"delete"` |
169
+
170
+ #### Returns
171
+
172
+ `Promise`\< \| \{ `agentId`: `string`; `kind`: `"almanac"`; `schedule`: \{ `id`:
173
+ `string`; `sessionId`: `string`; `prompt`: `string`; `cron`: \| \{ `expression`:
174
+ `string`; `timeZone`: `string`; \} \| `null`; `nextDueAt`: `number`; `state`:
175
+ `"active"` \| `"paused"` \| `"cancelled"` \| `"finished"`; `lastCommandId`:
176
+ `string` \| `null`; `lastError`: `string` \| `null`; `attempt`: `number`; \}; \}
177
+ \| \{ `agentId`: `string`; `kind`: `"loop"`; `schedule`: \{ `loopId`: `string`;
178
+ `origin`: `"human"` \| `"model"`; `expiresAt`: `number` \| `null`; `prompt`:
179
+ `string`; `mode`: `"self_paced"` \| `"fixed_interval"`; `cron`: \| \{
180
+ `expression`: `string`; `timeZone`: `string`; \} \| `null`; `state`: `"active"`
181
+ \| `"paused"` \| `"cancelled"` \| `"finished"` \| `"failed"`; `commandId`:
182
+ `string`; `reason`: `string` \| `null`; `nextDueAt`: `number` \| `null`;
183
+ `lastError`: `string` \| `null`; `consecutiveFailures`: `number`; `sessionId`:
184
+ `string`; \}; \}\>
185
+
186
+ ---
187
+
188
+ ### controlAgentSchedule()
189
+
190
+ ```ts
191
+ function controlAgentSchedule(
192
+ owner,
193
+ target,
194
+ action,
195
+ ): Promise<
196
+ | {
197
+ agentId: string;
198
+ kind: "almanac";
199
+ scheduleId: string;
200
+ state: "active" | "paused" | "cancelled" | "finished";
201
+ }
202
+ | {
203
+ agentId: string;
204
+ kind: "loop";
205
+ sessionId: string;
206
+ loopId: string;
207
+ state: "active" | "paused" | "cancelled" | "finished" | "failed";
208
+ }
209
+ >;
210
+ ```
211
+
212
+ Control an already-admitted owner; manage-only callers receive no read content.
213
+
214
+ #### Parameters
215
+
216
+ | Parameter | Type |
217
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
218
+ | `owner` | `Pick`\<`ShiitakeAgent`, `"extensions"`\> |
219
+ | `target` | \| \{ `kind`: `"almanac"`; `agentId`: `string`; `scheduleId`: `string`; \} \| \{ `kind`: `"loop"`; `agentId`: `string`; `sessionId`: `string`; `loopId`: `string`; \} |
220
+ | `action` | `"pause"` \| `"resume"` \| `"delete"` |
221
+
222
+ #### Returns
223
+
224
+ `Promise`\< \| \{ `agentId`: `string`; `kind`: `"almanac"`; `scheduleId`:
225
+ `string`; `state`: `"active"` \| `"paused"` \| `"cancelled"` \| `"finished"`; \}
226
+ \| \{ `agentId`: `string`; `kind`: `"loop"`; `sessionId`: `string`; `loopId`:
227
+ `string`; `state`: `"active"` \| `"paused"` \| `"cancelled"` \| `"finished"` \|
228
+ `"failed"`; \}\>
@@ -0,0 +1,262 @@
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.
@@ -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.6.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,14 @@
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
+ },
53
+ "./schedules/client": {
54
+ "types": "./dist/schedules/client.d.ts",
55
+ "import": "./dist/schedules/client.js"
56
+ },
49
57
  "./roster/conversation-agents": {
50
58
  "types": "./dist/roster/conversation-agents.d.ts",
51
59
  "import": "./dist/roster/conversation-agents.js"
@@ -108,9 +116,9 @@
108
116
  "dependencies": {
109
117
  "@fungi.computer/almanac": "0.2.0",
110
118
  "@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",
119
+ "@fungi.computer/knapsack": "0.4.2",
120
+ "@fungi.computer/mycelium": "0.3.1",
121
+ "@fungi.computer/shiitake": "0.8.0",
114
122
  "@fungi.computer/watchdog": "0.1.0",
115
123
  "@fungi.computer/whistle": "0.3.0",
116
124
  "effect": "4.0.2",