@fungi.computer/shiitake-extensions 0.0.2 → 0.1.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.
Files changed (66) hide show
  1. package/README.md +43 -13
  2. package/dist/almanac/contract.d.ts +94 -0
  3. package/dist/almanac/contract.js +71 -5
  4. package/dist/goal/client.d.ts +5 -2
  5. package/dist/goal/client.js +66 -72
  6. package/dist/goal/contract.d.ts +181 -64
  7. package/dist/goal/contract.js +102 -12
  8. package/dist/goal/host.js +206 -124
  9. package/dist/home/contract.d.ts +18 -0
  10. package/dist/home/contract.js +24 -3
  11. package/dist/home/host.d.ts +3 -0
  12. package/dist/home/host.js +1 -2
  13. package/dist/home/routing.js +13 -24
  14. package/dist/internal/history.d.ts +16 -0
  15. package/dist/internal/history.js +8 -0
  16. package/dist/loop/client.d.ts +1 -1
  17. package/dist/loop/client.js +28 -34
  18. package/dist/loop/contract.d.ts +129 -84
  19. package/dist/loop/contract.js +79 -9
  20. package/dist/loop/host.d.ts +1 -0
  21. package/dist/loop/host.js +89 -48
  22. package/dist/plan/client.d.ts +1 -1
  23. package/dist/plan/contract.d.ts +33 -0
  24. package/dist/plan/contract.js +28 -3
  25. package/dist/plan/host.js +12 -7
  26. package/dist/question/client.d.ts +1 -1
  27. package/dist/question/contract.d.ts +158 -0
  28. package/dist/question/contract.js +92 -7
  29. package/dist/question/host.js +34 -20
  30. package/dist/roster/conversation-agents.d.ts +31 -0
  31. package/dist/roster/conversation-agents.js +114 -0
  32. package/dist/roster.js +1 -0
  33. package/dist/skills/host.d.ts +1 -0
  34. package/dist/skills/host.js +22 -17
  35. package/dist/skills/source.d.ts +34 -0
  36. package/dist/subagents/client.d.ts +1 -1
  37. package/dist/subagents/client.js +43 -12
  38. package/dist/subagents/contract.d.ts +46 -8
  39. package/dist/subagents/contract.js +38 -8
  40. package/dist/subagents/host.d.ts +20 -8
  41. package/dist/subagents/host.js +58 -12
  42. package/docs/api/README.md +35 -0
  43. package/docs/api/almanac/contract.md +90 -0
  44. package/docs/api/almanac/host.md +19 -0
  45. package/docs/api/goal/client.md +26 -0
  46. package/docs/api/goal/contract.md +247 -0
  47. package/docs/api/goal/host.md +29 -0
  48. package/docs/api/home/contract.md +58 -0
  49. package/docs/api/home/host.md +55 -0
  50. package/docs/api/loop/client.md +25 -0
  51. package/docs/api/loop/contract.md +161 -0
  52. package/docs/api/loop/host.md +30 -0
  53. package/docs/api/plan/client.md +26 -0
  54. package/docs/api/plan/contract.md +163 -0
  55. package/docs/api/plan/host.md +19 -0
  56. package/docs/api/question/client.md +25 -0
  57. package/docs/api/question/contract.md +377 -0
  58. package/docs/api/question/host.md +19 -0
  59. package/docs/api/roster/conversation-agents.md +80 -0
  60. package/docs/api/roster.md +40 -0
  61. package/docs/api/skills/host.md +39 -0
  62. package/docs/api/skills/source.md +104 -0
  63. package/docs/api/subagents/client.md +26 -0
  64. package/docs/api/subagents/contract.md +131 -0
  65. package/docs/api/subagents/host.md +115 -0
  66. package/package.json +14 -8
package/README.md CHANGED
@@ -68,27 +68,46 @@ helper borrows the Agent. Its owner closes it when the host's lifetime ends.
68
68
  | Extension | Ownership and behavior |
69
69
  | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
70
  | Ask | Up to four open decisions per Session. The model asks or withdraws; humans answer or decline. A live waiter receives the answer, while a parked question resumes through one follow-up. |
71
- | Goal | One objective per Session. The model creates, reads and completes it through `goal.*` tools; humans set, pause, resume or clear it. Three tool-less continuations pause it as stalled. |
71
+ | Goal | One live or paused objective per Session. The model creates, reads and completes it through `goal.*` tools; humans set, pause, resume or clear it. Esc, failed work, a block or three tool-less continuations pause it. Closing the app pauses it only if work stops without resuming; background work and runtime-auto-resumed turns keep it live. An achieved or cleared goal becomes one chat line in its history. |
72
72
  | Loop | One repeated prompt per Session. It runs on a fixed cron cadence or lets its own active run request the next occurrence. Commands start, pause, resume and stop it. |
73
73
  | Plan | One checklist per Session. `plan.update_plan` replaces it whole, with at most one step in progress and at most 50 steps; `steps: []` clears it. The human clears it with `/plan clear` or the footer row's Clear plan action, through the same owner. `/plan` opens the full checklist in the footer; updates keep only the current step and progress visible, and a finished or cleared plan leaves the footer while its history stays in state. |
74
74
  | Almanac | Agent-scope one-shot or recurring schedules. Each schedule targets a Session and tracks admission, retry and its next due time. |
75
75
  | Skills | Host-supplied, read-only skill discovery. Metadata enters the prompt; `skill.load` reads a skill body or supporting file; `/skills` lists them. |
76
76
  | Home | Agent-scope choice of an attached Computer. Each run captures its scoped file tools and current attachment choice. |
77
- | Subagents | A read-only footer view: one row per Agent this Session sent work to or created, with its live status (working, waiting on you, idle, failed, unavailable). A row opens that Agent's conversation. It owns no relationship and no durable state. |
77
+ | Subagents | A read-only footer view: one row per Agent this Session sent work to or created, with its live status (working, waiting on you, idle, failed, unavailable). A row opens that Agent's conversation, and `/agents` collapses the rows to one summary row and expands them again. It owns no relationship and no durable state. |
78
78
 
79
79
  An active Goal is quiet system context on every run. Continuation instructions
80
80
  apply only to runs admitted by Goal with its continuation correlation; human
81
81
  messages receive the Goal context without that directive. Both sections are
82
- bounded by UTF-8 bytes. Correlated Goal turns appear as compact transcript
83
- notes; other extensions keep their own display policy.
82
+ bounded by UTF-8 bytes. Goal turns stay out of the transcript; the footer shows
83
+ only a live goal ("Pursuing goal since 14:02") or a paused one ("Goal paused
84
+ (/goal resume)"), and each finished goal adds one chat line after its last work.
85
+ Other extensions keep their own display policy.
84
86
 
85
87
  Known limitation: Session forks copy transcript entries without their original
86
88
  command-admission rows. Inherited Goal turns therefore lose the extension-origin
87
89
  metadata used for compact notes and appear as ordinary message bubbles.
88
90
 
89
91
  Goal pause stops continuation, not already accepted work. Model-requested
90
- completion or blocking is provisional until successful settlement. Human
91
- replacement uses the observed revision to avoid replacing a newer goal.
92
+ completion or blocking is provisional until successful settlement; a blocked
93
+ goal pauses and resumes like any paused goal. Only a live or paused goal asks
94
+ before a replacement, which uses the observed revision to avoid replacing a
95
+ newer goal; the replaced goal is recorded as cleared. When a runtime restart (a
96
+ Hub deploy or eviction, a Local service restart) interrupts a goal turn, the
97
+ turn resumes and the goal stays live. A live goal pauses when any turn of its
98
+ Session fails, cannot resume or is stopped by a person (Esc), including the
99
+ person's own messages ("The last turn failed"). A missing extension origin does
100
+ not establish a human sender; mail and host admissions can also lack one.
101
+
102
+ Goal's shared wire and durable row use `pauseCause: { kind, detail }` while
103
+ paused and `null` while active. The closed kinds are `person`, `blocked`,
104
+ `stalled`, `cancelled`, `failed`, and `no-terminal`; display detail is nullable
105
+ text, never a discriminator. Only blocked/stalled goals emit `goal-blocked` or
106
+ `goal-stalled` attention, kept out of the main inbox with `inbox: false`.
107
+ Questions and these two Goal kinds ask for a person in Herdr activity;
108
+ person-paused, cancelled and failed goals do not. State version 6 discards
109
+ disposable preview Goal rows from versions 4 and 5 rather than reading the
110
+ superseded representation.
92
111
 
93
112
  Loop tools are offered in every run. `loop.get`, `loop.start` and `loop.stop`
94
113
  work from any run of the Session, and the model may start a loop itself.
@@ -196,7 +215,7 @@ never changes Home. The Session command changes Agent state, so other Sessions
196
215
  see that choice on their next run.
197
216
 
198
217
  Each run captures its table, Home and prompt once. The tools are Knapsack's
199
- branded `read`, `list`, `glob` and `grep`, with `apply_patch` only when Home's
218
+ branded `read`, `list`, `glob`, and `grep`, with `apply_patch` only when Home's
200
219
  port has a native patch engine. Bare paths and `computer://home/` use Home;
201
220
  `computer://<name>/` uses another captured attachment. Patches always use Home's
202
221
  native engine and path jail. Returned file identity stays owned by the scoped
@@ -238,12 +257,14 @@ not require a provider account or make a provider call.
238
257
  ## Subagents
239
258
 
240
259
  The host creates `subagentsExtension({ source })` and adds `subagentsGrant`
241
- (`projection` only). `source.read(sessionId, limit)` returns the Agents that
242
- Session sent work to or created, newest first, with a count of the rest;
243
- `source.open` is the host's existing Agent access. Each child's status is its
244
- owner's own Session state: `running` is working, any open attention (a question
245
- or a tool approval) is waiting on you, `done` is idle and `errored` is failed. A
246
- child whose state cannot be read is unavailable, never idle.
260
+ (`projection` and `commands`: the human `/agents` command only collapses or
261
+ expands the footer rows, per Session and in memory).
262
+ `source.read(sessionId, limit)` returns the Agents that Session sent work to or
263
+ created, newest first, with a count of the rest; `source.open` is the host's
264
+ existing Agent access. Each child's status is its owner's own Session state:
265
+ `running` is working, any open attention (a question or a tool approval) is
266
+ waiting on you, `done` is idle and `errored` is failed. A child whose state
267
+ cannot be read is unavailable, never idle.
247
268
 
248
269
  Rows refresh when a watcher reads the parent Session and they are at least a
249
270
  second old. While a row is working or waiting, they poll every five seconds
@@ -261,3 +282,12 @@ split.
261
282
 
262
283
  See [LICENSE](LICENSE) for the license and the package manifest for its public
263
284
  repository destination.
285
+
286
+ ## Conversation Agent composition
287
+
288
+ `@fungi.computer/shiitake-extensions/roster/conversation-agents` supplies the
289
+ shared Local, Hub and Oyster conversation-Agent composition. The host supplies
290
+ its authorized Agent directory and SQLite owner; the roster records accepted
291
+ creates and sends for a read-only footer without granting relationships or
292
+ authority. Storage is prepared lazily. The host remains responsible for creation
293
+ admission, Agent access and resource lifetime.
@@ -1,16 +1,22 @@
1
1
  import * as Schema from "effect/Schema";
2
2
  /** One durable schedule as every caller sees it. */
3
3
  export declare const Schedule: Schema.Struct<{
4
+ /** Caller-chosen schedule identity. */
4
5
  readonly id: Schema.String;
6
+ /** Session that receives each scheduled prompt. */
5
7
  readonly sessionId: Schema.String;
8
+ /** Original prompt submitted to the destination Session. */
6
9
  readonly prompt: Schema.String;
7
10
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
8
11
  readonly cron: Schema.NullOr<Schema.Struct<{
12
+ /** Cron expression used to calculate occurrences. */
9
13
  readonly expression: Schema.String;
14
+ /** IANA time zone in which the expression is evaluated. */
10
15
  readonly timeZone: Schema.String;
11
16
  }>>;
12
17
  /** The occurrence that fires next (or fired last, once finished). */
13
18
  readonly nextDueAt: Schema.Int;
19
+ /** Current scheduling lifecycle state. */
14
20
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
15
21
  /** Latest command admitted for this schedule. */
16
22
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -23,27 +29,43 @@ export declare const Schedule: Schema.Struct<{
23
29
  export type Schedule = Schema.Schema.Type<typeof Schedule>;
24
30
  /** Almanac's contract: agent-scope schedule CRUD, no Session projection. */
25
31
  export declare const almanacContract: {
32
+ /** Stable extension identity. */
26
33
  readonly id: string & import("effect/Brand").Brand<"ExtensionId">;
34
+ /** Agent-scoped schedule operations. */
27
35
  readonly commands: {
36
+ /** Create a schedule with one due occurrence. */
28
37
  readonly createOneShot: {
38
+ /** The Agent owns the schedule collection. */
29
39
  readonly scope: "agent";
40
+ /** Decode the caller's one-shot schedule request. */
30
41
  readonly input: Schema.Struct<{
42
+ /** Caller-chosen schedule identity and create idempotency key. */
31
43
  readonly requestId: Schema.String;
44
+ /** Session that receives the scheduled prompt. */
32
45
  readonly sessionId: Schema.String;
46
+ /** Prompt to submit when due. */
33
47
  readonly prompt: Schema.String;
48
+ /** Due time in epoch milliseconds. */
34
49
  readonly dueAt: Schema.Int;
35
50
  }>;
51
+ /** Return the created durable schedule. */
36
52
  readonly output: Schema.Struct<{
53
+ /** Caller-chosen schedule identity. */
37
54
  readonly id: Schema.String;
55
+ /** Session that receives each scheduled prompt. */
38
56
  readonly sessionId: Schema.String;
57
+ /** Original prompt submitted to the destination Session. */
39
58
  readonly prompt: Schema.String;
40
59
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
41
60
  readonly cron: Schema.NullOr<Schema.Struct<{
61
+ /** Cron expression used to calculate occurrences. */
42
62
  readonly expression: Schema.String;
63
+ /** IANA time zone in which the expression is evaluated. */
43
64
  readonly timeZone: Schema.String;
44
65
  }>>;
45
66
  /** The occurrence that fires next (or fired last, once finished). */
46
67
  readonly nextDueAt: Schema.Int;
68
+ /** Current scheduling lifecycle state. */
47
69
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
48
70
  /** Latest command admitted for this schedule. */
49
71
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -53,26 +75,41 @@ export declare const almanacContract: {
53
75
  readonly attempt: Schema.Int;
54
76
  }>;
55
77
  };
78
+ /** Create a recurring cron schedule. */
56
79
  readonly createRecurring: {
80
+ /** The Agent owns the schedule collection. */
57
81
  readonly scope: "agent";
82
+ /** Decode the caller's recurring schedule request. */
58
83
  readonly input: Schema.Struct<{
84
+ /** Caller-chosen schedule identity and create idempotency key. */
59
85
  readonly requestId: Schema.String;
86
+ /** Session that receives each occurrence. */
60
87
  readonly sessionId: Schema.String;
88
+ /** Prompt repeated for each occurrence. */
61
89
  readonly prompt: Schema.String;
90
+ /** Cron expression used to calculate occurrences. */
62
91
  readonly expression: Schema.String;
92
+ /** IANA time zone used to evaluate the cron expression. */
63
93
  readonly timeZone: Schema.String;
64
94
  }>;
95
+ /** Return the created durable schedule. */
65
96
  readonly output: Schema.Struct<{
97
+ /** Caller-chosen schedule identity. */
66
98
  readonly id: Schema.String;
99
+ /** Session that receives each scheduled prompt. */
67
100
  readonly sessionId: Schema.String;
101
+ /** Original prompt submitted to the destination Session. */
68
102
  readonly prompt: Schema.String;
69
103
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
70
104
  readonly cron: Schema.NullOr<Schema.Struct<{
105
+ /** Cron expression used to calculate occurrences. */
71
106
  readonly expression: Schema.String;
107
+ /** IANA time zone in which the expression is evaluated. */
72
108
  readonly timeZone: Schema.String;
73
109
  }>>;
74
110
  /** The occurrence that fires next (or fired last, once finished). */
75
111
  readonly nextDueAt: Schema.Int;
112
+ /** Current scheduling lifecycle state. */
76
113
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
77
114
  /** Latest command admitted for this schedule. */
78
115
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -82,22 +119,33 @@ export declare const almanacContract: {
82
119
  readonly attempt: Schema.Int;
83
120
  }>;
84
121
  };
122
+ /** Read one schedule, or null when absent. */
85
123
  readonly read: {
124
+ /** Read from the Agent's schedule collection. */
86
125
  readonly scope: "agent";
126
+ /** Identify the schedule to read. */
87
127
  readonly input: Schema.Struct<{
128
+ /** Existing schedule targeted by the command. */
88
129
  readonly scheduleId: Schema.String;
89
130
  }>;
131
+ /** Decode the schedule or its absence. */
90
132
  readonly output: Schema.NullOr<Schema.Struct<{
133
+ /** Caller-chosen schedule identity. */
91
134
  readonly id: Schema.String;
135
+ /** Session that receives each scheduled prompt. */
92
136
  readonly sessionId: Schema.String;
137
+ /** Original prompt submitted to the destination Session. */
93
138
  readonly prompt: Schema.String;
94
139
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
95
140
  readonly cron: Schema.NullOr<Schema.Struct<{
141
+ /** Cron expression used to calculate occurrences. */
96
142
  readonly expression: Schema.String;
143
+ /** IANA time zone in which the expression is evaluated. */
97
144
  readonly timeZone: Schema.String;
98
145
  }>>;
99
146
  /** The occurrence that fires next (or fired last, once finished). */
100
147
  readonly nextDueAt: Schema.Int;
148
+ /** Current scheduling lifecycle state. */
101
149
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
102
150
  /** Latest command admitted for this schedule. */
103
151
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -107,23 +155,35 @@ export declare const almanacContract: {
107
155
  readonly attempt: Schema.Int;
108
156
  }>>;
109
157
  };
158
+ /** Read a bounded page of schedules after an optional identity. */
110
159
  readonly list: {
160
+ /** Read from the Agent's schedule collection. */
111
161
  readonly scope: "agent";
162
+ /** Decode pagination arguments. */
112
163
  readonly input: Schema.Struct<{
164
+ /** Exclusive schedule cursor. */
113
165
  readonly after: Schema.optionalKey<Schema.String>;
166
+ /** Maximum number of schedules returned. */
114
167
  readonly limit: Schema.optionalKey<Schema.Int>;
115
168
  }>;
169
+ /** Decode the returned schedule rows. */
116
170
  readonly output: Schema.$Array<Schema.Struct<{
171
+ /** Caller-chosen schedule identity. */
117
172
  readonly id: Schema.String;
173
+ /** Session that receives each scheduled prompt. */
118
174
  readonly sessionId: Schema.String;
175
+ /** Original prompt submitted to the destination Session. */
119
176
  readonly prompt: Schema.String;
120
177
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
121
178
  readonly cron: Schema.NullOr<Schema.Struct<{
179
+ /** Cron expression used to calculate occurrences. */
122
180
  readonly expression: Schema.String;
181
+ /** IANA time zone in which the expression is evaluated. */
123
182
  readonly timeZone: Schema.String;
124
183
  }>>;
125
184
  /** The occurrence that fires next (or fired last, once finished). */
126
185
  readonly nextDueAt: Schema.Int;
186
+ /** Current scheduling lifecycle state. */
127
187
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
128
188
  /** Latest command admitted for this schedule. */
129
189
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -133,22 +193,33 @@ export declare const almanacContract: {
133
193
  readonly attempt: Schema.Int;
134
194
  }>>;
135
195
  };
196
+ /** Suspend future occurrences of a schedule. */
136
197
  readonly pause: {
198
+ /** The Agent owns the schedule. */
137
199
  readonly scope: "agent";
200
+ /** Identify the schedule to pause. */
138
201
  readonly input: Schema.Struct<{
202
+ /** Existing schedule targeted by the command. */
139
203
  readonly scheduleId: Schema.String;
140
204
  }>;
205
+ /** Return its updated state. */
141
206
  readonly output: Schema.Struct<{
207
+ /** Caller-chosen schedule identity. */
142
208
  readonly id: Schema.String;
209
+ /** Session that receives each scheduled prompt. */
143
210
  readonly sessionId: Schema.String;
211
+ /** Original prompt submitted to the destination Session. */
144
212
  readonly prompt: Schema.String;
145
213
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
146
214
  readonly cron: Schema.NullOr<Schema.Struct<{
215
+ /** Cron expression used to calculate occurrences. */
147
216
  readonly expression: Schema.String;
217
+ /** IANA time zone in which the expression is evaluated. */
148
218
  readonly timeZone: Schema.String;
149
219
  }>>;
150
220
  /** The occurrence that fires next (or fired last, once finished). */
151
221
  readonly nextDueAt: Schema.Int;
222
+ /** Current scheduling lifecycle state. */
152
223
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
153
224
  /** Latest command admitted for this schedule. */
154
225
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -158,22 +229,33 @@ export declare const almanacContract: {
158
229
  readonly attempt: Schema.Int;
159
230
  }>;
160
231
  };
232
+ /** Restore a paused schedule to active scheduling. */
161
233
  readonly resume: {
234
+ /** The Agent owns the schedule. */
162
235
  readonly scope: "agent";
236
+ /** Identify the schedule to resume. */
163
237
  readonly input: Schema.Struct<{
238
+ /** Existing schedule targeted by the command. */
164
239
  readonly scheduleId: Schema.String;
165
240
  }>;
241
+ /** Return its updated state. */
166
242
  readonly output: Schema.Struct<{
243
+ /** Caller-chosen schedule identity. */
167
244
  readonly id: Schema.String;
245
+ /** Session that receives each scheduled prompt. */
168
246
  readonly sessionId: Schema.String;
247
+ /** Original prompt submitted to the destination Session. */
169
248
  readonly prompt: Schema.String;
170
249
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
171
250
  readonly cron: Schema.NullOr<Schema.Struct<{
251
+ /** Cron expression used to calculate occurrences. */
172
252
  readonly expression: Schema.String;
253
+ /** IANA time zone in which the expression is evaluated. */
173
254
  readonly timeZone: Schema.String;
174
255
  }>>;
175
256
  /** The occurrence that fires next (or fired last, once finished). */
176
257
  readonly nextDueAt: Schema.Int;
258
+ /** Current scheduling lifecycle state. */
177
259
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
178
260
  /** Latest command admitted for this schedule. */
179
261
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -183,22 +265,33 @@ export declare const almanacContract: {
183
265
  readonly attempt: Schema.Int;
184
266
  }>;
185
267
  };
268
+ /** Cancel future occurrences of a schedule. */
186
269
  readonly cancel: {
270
+ /** The Agent owns the schedule. */
187
271
  readonly scope: "agent";
272
+ /** Identify the schedule to cancel. */
188
273
  readonly input: Schema.Struct<{
274
+ /** Existing schedule targeted by the command. */
189
275
  readonly scheduleId: Schema.String;
190
276
  }>;
277
+ /** Return its updated state. */
191
278
  readonly output: Schema.Struct<{
279
+ /** Caller-chosen schedule identity. */
192
280
  readonly id: Schema.String;
281
+ /** Session that receives each scheduled prompt. */
193
282
  readonly sessionId: Schema.String;
283
+ /** Original prompt submitted to the destination Session. */
194
284
  readonly prompt: Schema.String;
195
285
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
196
286
  readonly cron: Schema.NullOr<Schema.Struct<{
287
+ /** Cron expression used to calculate occurrences. */
197
288
  readonly expression: Schema.String;
289
+ /** IANA time zone in which the expression is evaluated. */
198
290
  readonly timeZone: Schema.String;
199
291
  }>>;
200
292
  /** The occurrence that fires next (or fired last, once finished). */
201
293
  readonly nextDueAt: Schema.Int;
294
+ /** Current scheduling lifecycle state. */
202
295
  readonly state: Schema.Literals<readonly ["active", "paused", "cancelled", "finished"]>;
203
296
  /** Latest command admitted for this schedule. */
204
297
  readonly lastCommandId: Schema.NullOr<Schema.String>;
@@ -209,5 +302,6 @@ export declare const almanacContract: {
209
302
  }>;
210
303
  };
211
304
  };
305
+ /** Almanac has no Session projection. */
212
306
  readonly projection: null;
213
307
  };
@@ -15,13 +15,22 @@ const CronExpression = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), S
15
15
  const TimeZone = Schema.String.pipe(Schema.check(Schema.isMinLength(1)), Schema.check(Schema.isMaxLength(128)));
16
16
  /** One durable schedule as every caller sees it. */
17
17
  export const Schedule = Schema.Struct({
18
+ /** Caller-chosen schedule identity. */
18
19
  id: ScheduleId,
20
+ /** Session that receives each scheduled prompt. */
19
21
  sessionId: SessionId,
22
+ /** Original prompt submitted to the destination Session. */
20
23
  prompt: Prompt,
21
24
  /** Cron expression and zone for a recurring schedule; null for one-shot. */
22
- cron: Schema.NullOr(Schema.Struct({ expression: CronExpression, timeZone: TimeZone })),
25
+ cron: Schema.NullOr(Schema.Struct({
26
+ /** Cron expression used to calculate occurrences. */
27
+ expression: CronExpression,
28
+ /** IANA time zone in which the expression is evaluated. */
29
+ timeZone: TimeZone,
30
+ })),
23
31
  /** The occurrence that fires next (or fired last, once finished). */
24
32
  nextDueAt: Instant,
33
+ /** Current scheduling lifecycle state. */
25
34
  state: Schema.Literals(["active", "paused", "cancelled", "finished"]),
26
35
  /** Latest command admitted for this schedule. */
27
36
  lastCommandId: Schema.NullOr(Schema.String),
@@ -30,48 +39,105 @@ export const Schedule = Schema.Struct({
30
39
  /** Consecutive failed admissions of the current occurrence. */
31
40
  attempt: Schema.Int.pipe(Schema.check(Schema.isGreaterThanOrEqualTo(0))),
32
41
  });
33
- const ScheduleRef = Schema.Struct({ scheduleId: ScheduleId });
42
+ const ScheduleRef = Schema.Struct({
43
+ /** Existing schedule targeted by the command. */
44
+ scheduleId: ScheduleId,
45
+ });
34
46
  /** Almanac's contract: agent-scope schedule CRUD, no Session projection. */
35
47
  export const almanacContract = {
48
+ /** Stable extension identity. */
36
49
  id: ExtensionId.make("botanical-almanac"),
50
+ /** Agent-scoped schedule operations. */
37
51
  commands: {
52
+ /** Create a schedule with one due occurrence. */
38
53
  createOneShot: {
54
+ /** The Agent owns the schedule collection. */
39
55
  scope: "agent",
56
+ /** Decode the caller's one-shot schedule request. */
40
57
  input: Schema.Struct({
58
+ /** Caller-chosen schedule identity and create idempotency key. */
41
59
  requestId: ScheduleId,
60
+ /** Session that receives the scheduled prompt. */
42
61
  sessionId: SessionId,
62
+ /** Prompt to submit when due. */
43
63
  prompt: Prompt,
64
+ /** Due time in epoch milliseconds. */
44
65
  dueAt: Instant,
45
66
  }),
67
+ /** Return the created durable schedule. */
46
68
  output: Schedule,
47
69
  },
70
+ /** Create a recurring cron schedule. */
48
71
  createRecurring: {
72
+ /** The Agent owns the schedule collection. */
49
73
  scope: "agent",
74
+ /** Decode the caller's recurring schedule request. */
50
75
  input: Schema.Struct({
76
+ /** Caller-chosen schedule identity and create idempotency key. */
51
77
  requestId: ScheduleId,
78
+ /** Session that receives each occurrence. */
52
79
  sessionId: SessionId,
80
+ /** Prompt repeated for each occurrence. */
53
81
  prompt: Prompt,
82
+ /** Cron expression used to calculate occurrences. */
54
83
  expression: CronExpression,
84
+ /** IANA time zone used to evaluate the cron expression. */
55
85
  timeZone: TimeZone,
56
86
  }),
87
+ /** Return the created durable schedule. */
57
88
  output: Schedule,
58
89
  },
90
+ /** Read one schedule, or null when absent. */
59
91
  read: {
92
+ /** Read from the Agent's schedule collection. */
60
93
  scope: "agent",
94
+ /** Identify the schedule to read. */
61
95
  input: ScheduleRef,
96
+ /** Decode the schedule or its absence. */
62
97
  output: Schema.NullOr(Schedule),
63
98
  },
99
+ /** Read a bounded page of schedules after an optional identity. */
64
100
  list: {
101
+ /** Read from the Agent's schedule collection. */
65
102
  scope: "agent",
103
+ /** Decode pagination arguments. */
66
104
  input: Schema.Struct({
105
+ /** Exclusive schedule cursor. */
67
106
  after: Schema.optionalKey(ScheduleId),
107
+ /** Maximum number of schedules returned. */
68
108
  limit: Schema.optionalKey(Schema.Int.pipe(Schema.check(Schema.isBetween({ minimum: 1, maximum: 64 })))),
69
109
  }),
110
+ /** Decode the returned schedule rows. */
70
111
  output: Schema.Array(Schedule),
71
112
  },
72
- pause: { scope: "agent", input: ScheduleRef, output: Schedule },
73
- resume: { scope: "agent", input: ScheduleRef, output: Schedule },
74
- cancel: { scope: "agent", input: ScheduleRef, output: Schedule },
113
+ /** Suspend future occurrences of a schedule. */
114
+ pause: {
115
+ /** The Agent owns the schedule. */
116
+ scope: "agent",
117
+ /** Identify the schedule to pause. */
118
+ input: ScheduleRef,
119
+ /** Return its updated state. */
120
+ output: Schedule,
121
+ },
122
+ /** Restore a paused schedule to active scheduling. */
123
+ resume: {
124
+ /** The Agent owns the schedule. */
125
+ scope: "agent",
126
+ /** Identify the schedule to resume. */
127
+ input: ScheduleRef,
128
+ /** Return its updated state. */
129
+ output: Schedule,
130
+ },
131
+ /** Cancel future occurrences of a schedule. */
132
+ cancel: {
133
+ /** The Agent owns the schedule. */
134
+ scope: "agent",
135
+ /** Identify the schedule to cancel. */
136
+ input: ScheduleRef,
137
+ /** Return its updated state. */
138
+ output: Schedule,
139
+ },
75
140
  },
141
+ /** Almanac has no Session projection. */
76
142
  projection: null,
77
143
  };
@@ -1,9 +1,12 @@
1
1
  import { type ClientContributionV1 } from "@fungi.computer/shiitake/client-entry";
2
- /** Product copy and controls belong to Goal; every host renders plain rows. */
2
+ /**
3
+ * Product copy and controls belong to Goal; every host renders plain rows.
4
+ * The footer shows only a live or paused goal; finished goals are chat lines.
5
+ */
3
6
  declare const _default: Readonly<{
4
7
  protocol: "shiitake.client/v1";
5
8
  id: import("@fungi.computer/shiitake/extensions").ExtensionId;
6
- correlatedPrompts?: "note";
9
+ promptPresentation?: "footer";
7
10
  attach?: (context: import("@fungi.computer/shiitake/client-entry").ClientExtensionContextV1) => import("effect/Effect").Effect<void, Error, import("effect/Scope").Scope>;
8
11
  contribute?: (slot: import("@fungi.computer/shiitake").ExtensionSlotV0 | undefined) => ClientContributionV1;
9
12
  }>;