@fungi.computer/shiitake 0.6.0 → 0.7.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 (63) hide show
  1. package/README.md +59 -21
  2. package/dist/agent-control.d.ts +1 -1
  3. package/dist/agent-control.js +40 -21
  4. package/dist/client-visitor.d.ts +2 -0
  5. package/dist/client-visitor.js +6 -1
  6. package/dist/client-wire.d.ts +4 -0
  7. package/dist/client-wire.js +18 -3
  8. package/dist/client.d.ts +24 -4
  9. package/dist/client.js +22 -0
  10. package/dist/cloudflare.d.ts +20 -0
  11. package/dist/cloudflare.js +4 -1
  12. package/dist/delegation.d.ts +5 -0
  13. package/dist/delegation.js +24 -8
  14. package/dist/effect.d.ts +1 -1
  15. package/dist/errors.d.ts +2 -2
  16. package/dist/errors.js +2 -0
  17. package/dist/extensions.d.ts +1 -1
  18. package/dist/fleet.d.ts +10 -2
  19. package/dist/fleet.js +77 -19
  20. package/dist/http-routes.d.ts +12 -9
  21. package/dist/http.d.ts +1 -0
  22. package/dist/http.js +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/internal/admission-door.d.ts +1 -1
  25. package/dist/internal/admission-door.js +8 -4
  26. package/dist/internal/contracts.d.ts +5 -0
  27. package/dist/internal/coordinator.js +107 -50
  28. package/dist/internal/effect-contracts.d.ts +5 -0
  29. package/dist/internal/extension-runtime.js +5 -3
  30. package/dist/internal/promise-facade.js +2 -0
  31. package/dist/internal/run-scope.js +27 -7
  32. package/dist/internal/runtime-coordinator.d.ts +14 -0
  33. package/dist/internal/runtime-coordinator.js +52 -10
  34. package/dist/internal/runtime-core.d.ts +3 -0
  35. package/dist/internal/runtime-core.js +1 -0
  36. package/dist/internal/runtime-reconciliation.js +4 -1
  37. package/dist/internal/session-context.d.ts +5 -5
  38. package/dist/internal/session-context.js +80 -83
  39. package/dist/internal/session-status.d.ts +2 -2
  40. package/dist/internal/session-status.js +5 -3
  41. package/dist/internal/woodstock/client-projection.js +5 -11
  42. package/dist/internal/woodstock/fleet-store.d.ts +3 -2
  43. package/dist/internal/woodstock/fleet-store.js +24 -4
  44. package/dist/internal/woodstock/index.d.ts +3 -3
  45. package/dist/internal/woodstock/index.js +16 -6
  46. package/dist/internal/woodstock/progress.d.ts +11 -1
  47. package/dist/internal/woodstock/progress.js +126 -25
  48. package/dist/internal/woodstock/session-delegator.d.ts +2 -1
  49. package/dist/internal/woodstock/session-store.d.ts +14 -2
  50. package/dist/internal/woodstock/session-store.js +329 -66
  51. package/dist/node.js +11 -2
  52. package/dist/server-visitor-stream.js +33 -24
  53. package/docs/api/agent-control.md +3 -2
  54. package/docs/api/client.md +77 -8
  55. package/docs/api/cloudflare.md +16 -0
  56. package/docs/api/delegation.md +84 -50
  57. package/docs/api/effect.md +85 -7
  58. package/docs/api/extensions.md +8 -8
  59. package/docs/api/fleet.md +87 -27
  60. package/docs/api/http.md +28 -0
  61. package/docs/api/index.md +39 -15
  62. package/docs/api/testing.md +9 -7
  63. package/package.json +5 -5
@@ -162,7 +162,7 @@ The door refused an extension admission.
162
162
  #### Extends
163
163
 
164
164
  - `YieldableError`\<`this`\> & `object` & `Readonly`\<\{ `reason`: `"closed"` \|
165
- `"conflict"` \| `"invalid"`; `message`: `string`; \}\>
165
+ `"conflict"` \| `"invalid"` \| `"archived"`; `message`: `string`; \}\>
166
166
 
167
167
  #### Constructors
168
168
 
@@ -174,11 +174,11 @@ new AdmissionError(args): AdmissionError;
174
174
 
175
175
  ###### Parameters
176
176
 
177
- | Parameter | Type |
178
- | -------------- | ------------------------------------------------------------------------------- |
179
- | `args` | \{ `reason`: `"closed"` \| `"conflict"` \| `"invalid"`; `message`: `string`; \} |
180
- | `args.reason` | `"closed"` \| `"conflict"` \| `"invalid"` |
181
- | `args.message` | `string` |
177
+ | Parameter | Type |
178
+ | -------------- | ----------------------------------------------------------------------------------------------- |
179
+ | `args` | \{ `reason`: `"closed"` \| `"conflict"` \| `"invalid"` \| `"archived"`; `message`: `string`; \} |
180
+ | `args.reason` | `"closed"` \| `"conflict"` \| `"invalid"` \| `"archived"` |
181
+ | `args.message` | `string` |
182
182
 
183
183
  ###### Returns
184
184
 
@@ -188,7 +188,7 @@ new AdmissionError(args): AdmissionError;
188
188
 
189
189
  ```ts
190
190
  Data.TaggedError("AdmissionError")<{
191
- reason: "invalid" | "conflict" | "closed";
191
+ reason: "invalid" | "conflict" | "closed" | "archived";
192
192
  message: string;
193
193
  }>.constructor
194
194
  ```
@@ -198,7 +198,7 @@ Data.TaggedError("AdmissionError")<{
198
198
  ##### reason
199
199
 
200
200
  ```ts
201
- readonly reason: "closed" | "conflict" | "invalid";
201
+ readonly reason: "closed" | "conflict" | "invalid" | "archived";
202
202
  ```
203
203
 
204
204
  ###### Inherited from
package/docs/api/fleet.md CHANGED
@@ -30,7 +30,7 @@ new AgentGrantError(reason): AgentGrantError;
30
30
 
31
31
  | Parameter | Type |
32
32
  | --------- | ------------------------------------------------------------------------------------- |
33
- | `reason` | `"agent"` \| `"action"` \| `"expired"` \| `"delegation_loop"` \| `"delegation_depth"` |
33
+ | `reason` | `"agent"` \| `"expired"` \| `"action"` \| `"delegation_loop"` \| `"delegation_depth"` |
34
34
 
35
35
  ###### Returns
36
36
 
@@ -47,7 +47,7 @@ Error.constructor;
47
47
  ##### reason
48
48
 
49
49
  ```ts
50
- readonly reason: "agent" | "action" | "expired" | "delegation_loop" | "delegation_depth";
50
+ readonly reason: "agent" | "expired" | "action" | "delegation_loop" | "delegation_depth";
51
51
  ```
52
52
 
53
53
  ---
@@ -548,6 +548,12 @@ const agentDelegationTaskSchema: ZodLazy<
548
548
  requestId: ZodString;
549
549
  agentId: ZodString;
550
550
  sessionId: ZodOptional<ZodString>;
551
+ delivery: ZodOptional<
552
+ ZodEnum<{
553
+ followUp: "followUp";
554
+ steer: "steer";
555
+ }>
556
+ >;
551
557
  text: ZodString;
552
558
  },
553
559
  $strict
@@ -647,6 +653,30 @@ together. Physical table names retain the existing Hub store layout.
647
653
 
648
654
  ---
649
655
 
656
+ ### settlementReadableBy()
657
+
658
+ ```ts
659
+ function settlementReadableBy(facts, agentId): boolean;
660
+ ```
661
+
662
+ Whether an Agent may read one command's settlement: the Agent whose mail the
663
+ command answered, or the Session's delegator of record for work no Agent's mail
664
+ admitted (goal, loop and person turns, the work its reports carry). Another
665
+ Agent's correspondence stays with that Agent.
666
+
667
+ #### Parameters
668
+
669
+ | Parameter | Type |
670
+ | --------- | ------------------------------------------------------------------------------------------------ |
671
+ | `facts` | `Pick`\<[`CommandSettlement`](index.md#commandsettlement), `"acceptedSender"` \| `"delegator"`\> |
672
+ | `agentId` | `string` |
673
+
674
+ #### Returns
675
+
676
+ `boolean`
677
+
678
+ ---
679
+
650
680
  ### delegationProvenance()
651
681
 
652
682
  ```ts
@@ -729,6 +759,36 @@ the verified reply retains the failed recipient's identity.
729
759
 
730
760
  ---
731
761
 
762
+ ### readOutstandingDelegationSync()
763
+
764
+ ```ts
765
+ function readOutstandingDelegationSync(storage):
766
+ | Readonly<{
767
+ agentId: string;
768
+ sessionId: string;
769
+ commandId: string;
770
+ unreadable?: string;
771
+ }>
772
+ | undefined;
773
+ ```
774
+
775
+ Read confirmed sender receipts that have no locally observed settlement. Call
776
+ inside the Agent owner's transaction that also changes archived state. Remote
777
+ reads happen separately; an unobserved settlement remains busy.
778
+
779
+ #### Parameters
780
+
781
+ | Parameter | Type |
782
+ | --------- | --------------------- |
783
+ | `storage` | `WatchdogSqliteOwner` |
784
+
785
+ #### Returns
786
+
787
+ \| `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; `commandId`:
788
+ `string`; `unreadable?`: `string`; \}\> \| `undefined`
789
+
790
+ ---
791
+
732
792
  ### createFleetCorrespondence()
733
793
 
734
794
  ```ts
@@ -747,14 +807,14 @@ Shiitake owns work deduplication, execution and settlement; Post owns replies.
747
807
 
748
808
  #### Returns
749
809
 
750
- | Name | Type | Description |
751
- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
752
- | `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
753
- | `authenticateReply()` | (`mail`) => \| `Readonly`\<\{ `ancestors`: readonly `string`[]; `maxDepth`: `number`; `reply`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; `agentId`: `string`; `sessionId`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"` \| `"recipient_left"`; `agentId`: `string`; `sessionId?`: `string`; \}; \}\> \| `undefined` | Match a reply to frozen mail and restore the caller's delegation path. Authenticate one arriving reply against the frozen mail this owner sent. It must be BirdDog's single reply key for that mail, mirror its sender and recipient exactly, carry BirdDog's settlement facts and, once the send's receipt is recorded, name that receipt's `commandId`. The result restores the caller's own delegation path and the verified reply; it never reads the reply's text or any settlement metadata. |
754
- | `recordLocalUndeliverable()` | (`original`, `reply`) => `boolean` | Bind exhausted local delivery to its frozen sender correspondence. Bind an exhausted local Carrier row to its frozen sender correspondence. |
755
- | `recordUndeliverableReply()` | (`mailKey`) => `boolean` | Prevent replay after a system undeliverable reply is admitted. Make a successfully admitted system disposition replay-ineligible. |
756
- | `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Read an existing acceptance receipt without reserving or delivering mail. Read only the existing acceptance receipt; do not reserve or deliver mail. |
757
- | `recordAcceptedNotice()` | (`mail`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Consume a recipient's stable `<mailKey>:accepted` notice. Atomically bind the recipient Session carried by a late acceptance notice. |
810
+ | Name | Type | Description |
811
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
812
+ | `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
813
+ | `authenticateReply()` | (`mail`) => \| `Readonly`\<\{ `ancestors`: readonly `string`[]; `maxDepth`: `number`; `reply`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; `waitingOnYou?`: readonly `object`[]; `agentId`: `string`; `sessionId`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"` \| `"recipient_left"`; `agentId`: `string`; `sessionId?`: `string`; \}; \}\> \| `undefined` | Match a reply to frozen mail and restore the caller's delegation path. Authenticate one arriving reply against the frozen mail this owner sent. It must be BirdDog's single reply key for that mail, mirror its sender and recipient exactly, carry BirdDog's settlement facts and, once the send's receipt is recorded, name that receipt's `commandId`. The result restores the caller's own delegation path and the verified reply; it never reads the reply's text or any settlement metadata. |
814
+ | `recordLocalUndeliverable()` | (`original`, `reply`) => `boolean` | Bind exhausted local delivery to its frozen sender correspondence. Bind an exhausted local Carrier row to its frozen sender correspondence. |
815
+ | `recordUndeliverableReply()` | (`mailKey`) => `boolean` | Prevent replay after a system undeliverable reply is admitted. Make a successfully admitted system disposition replay-ineligible. |
816
+ | `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Read an existing acceptance receipt without reserving or delivering mail. Read only the existing acceptance receipt; do not reserve or deliver mail. |
817
+ | `recordAcceptedNotice()` | (`mail`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Consume a recipient's stable `<mailKey>:accepted` notice. Atomically bind the recipient Session carried by a late acceptance notice. |
758
818
 
759
819
  ---
760
820
 
@@ -775,16 +835,16 @@ it.
775
835
 
776
836
  #### Returns
777
837
 
778
- | Name | Type | Description |
779
- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
780
- | `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
781
- | `authenticateReply()` | (`mail`) => \| `Readonly`\<\{ `ancestors`: readonly `string`[]; `maxDepth`: `number`; `reply`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; `agentId`: `string`; `sessionId`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"` \| `"recipient_left"`; `agentId`: `string`; `sessionId?`: `string`; \}; \}\> \| `undefined` | Match a reply to frozen mail and restore the caller's delegation path. Authenticate one arriving reply against the frozen mail this owner sent. It must be BirdDog's single reply key for that mail, mirror its sender and recipient exactly, carry BirdDog's settlement facts and, once the send's receipt is recorded, name that receipt's `commandId`. The result restores the caller's own delegation path and the verified reply; it never reads the reply's text or any settlement metadata. |
782
- | `recordLocalUndeliverable()` | (`original`, `reply`) => `boolean` | Bind exhausted local delivery to its frozen sender correspondence. Bind an exhausted local Carrier row to its frozen sender correspondence. |
783
- | `recordUndeliverableReply()` | (`mailKey`) => `boolean` | Prevent replay after a system undeliverable reply is admitted. Make a successfully admitted system disposition replay-ineligible. |
784
- | `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Read an existing acceptance receipt without reserving or delivering mail. Read only the existing acceptance receipt; do not reserve or deliver mail. |
785
- | `recordAcceptedNotice()` | (`mail`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Consume a recipient's stable `<mailKey>:accepted` notice. Atomically bind the recipient Session carried by a late acceptance notice. |
786
- | `outstanding()` | () => `Promise`\< \| `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; `commandId`: `string`; `unreadable?`: `string`; \}\> \| `undefined`\> | The delegated work this owner still waits on, if any. The newest delegation this owner sent whose work has not settled at its target, so the owner is still waiting for a reply; undefined when none. |
787
- | `delegate()` | (`grant`, `task`) => `Promise`\< \| `Readonly`\<\{ `kind`: `"pending"`; `retryAfterMs`: `number`; \}\> \| [`AgentDelegationOutcome`](#agentdelegationoutcome)\> | Submit or poll the exact turn, yielding Agar Pending until settled. |
838
+ | Name | Type | Description |
839
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
840
+ | `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
841
+ | `authenticateReply()` | (`mail`) => \| `Readonly`\<\{ `ancestors`: readonly `string`[]; `maxDepth`: `number`; `reply`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; `waitingOnYou?`: readonly `object`[]; `agentId`: `string`; `sessionId`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"` \| `"recipient_left"`; `agentId`: `string`; `sessionId?`: `string`; \}; \}\> \| `undefined` | Match a reply to frozen mail and restore the caller's delegation path. Authenticate one arriving reply against the frozen mail this owner sent. It must be BirdDog's single reply key for that mail, mirror its sender and recipient exactly, carry BirdDog's settlement facts and, once the send's receipt is recorded, name that receipt's `commandId`. The result restores the caller's own delegation path and the verified reply; it never reads the reply's text or any settlement metadata. |
842
+ | `recordLocalUndeliverable()` | (`original`, `reply`) => `boolean` | Bind exhausted local delivery to its frozen sender correspondence. Bind an exhausted local Carrier row to its frozen sender correspondence. |
843
+ | `recordUndeliverableReply()` | (`mailKey`) => `boolean` | Prevent replay after a system undeliverable reply is admitted. Make a successfully admitted system disposition replay-ineligible. |
844
+ | `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Read an existing acceptance receipt without reserving or delivering mail. Read only the existing acceptance receipt; do not reserve or deliver mail. |
845
+ | `recordAcceptedNotice()` | (`mail`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\> \| `undefined` | Consume a recipient's stable `<mailKey>:accepted` notice. Atomically bind the recipient Session carried by a late acceptance notice. |
846
+ | `outstanding()` | () => `Promise`\< \| `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; `commandId`: `string`; `unreadable?`: `string`; \}\> \| `undefined`\> | The delegated work this owner still waits on, if any. The newest delegation this owner sent whose work has not settled at its target, so the owner is still waiting for a reply; undefined when none. |
847
+ | `delegate()` | (`grant`, `task`) => `Promise`\< \| `Readonly`\<\{ `kind`: `"pending"`; `retryAfterMs`: `number`; \}\> \| [`AgentDelegationOutcome`](#agentdelegationoutcome)\> | Submit or poll the exact turn, yielding Agar Pending until settled. |
788
848
 
789
849
  ---
790
850
 
@@ -805,10 +865,10 @@ checks a fresh supplied grant and releases its transport without stopping work.
805
865
 
806
866
  #### Returns
807
867
 
808
- | Name | Type | Description |
809
- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
810
- | `list()` | (`grant`, `agentId`, `after?`) => `Promise`\<`Readonly`\<\{ `sessions`: readonly [`SessionSummaryRow`](client.md#sessionsummaryrow)[]; `next`: `string` \| `undefined`; \}\>\> | Enumerate existing Sessions through the owner's bounded cursor. |
811
- | `read()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`Readonly`\<\{ `sessionId`: `string`; `cursor`: `string` \| `null`; `hasMore`: `boolean`; `oldestCursor?`: `string` \| `null`; `messages`: readonly `Readonly`\<\{ `requestId?`: `string`; `meta?`: [`Json`](extensions.md#json); `data?`: [`Json`](extensions.md#json); `origin?`: `Readonly`\<\{ `extensionId`: ...; `correlation`: ...; \}\>; `id`: `string`; `sequence`: `number`; `commandId`: `string` \| `null`; `value`: [`ModelMessage`](client.md#modelmessage); \}\>[]; `terminals`: readonly `Readonly`\<\{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"`; `sequence`: `number`; `diagnostic`: `string` \| `null`; `meta?`: [`Json`](extensions.md#json); \}\>[]; `compactions?`: readonly `Readonly`\<\{ `id`: `string`; `sequence`: `number`; `at`: `number`; `tokensBefore`: `number`; `tokensAfter`: `number` \| `null`; `trigger`: [`SessionCompactionTrigger`](client.md#sessioncompactiontrigger) \| `null`; \}\>[]; `compactionNotices?`: readonly `Readonly`\<\{ `id`: `string`; `sequence`: `number`; `at`: `number`; `trigger`: [`SessionCompactionTrigger`](client.md#sessioncompactiontrigger); `result`: `"failed"` \| `"nothing_to_compact"` \| `"stale"` \| `"insufficient"`; `diagnostic`: `string` \| `null`; \}\>[]; `sandboxFailures?`: readonly `object`[]; `pending`: [`SessionPendingPrompts`](client.md#sessionpendingprompts); `activity`: [`SessionActivity`](client.md#sessionactivity); `progress`: \| `Readonly`\<\{ `messageId`: `string`; `revision`: `number`; `text`: `string`; `thinking`: `string`; `textTruncated`: `boolean`; `thinkingTruncated`: `boolean`; \}\> \| `null`; `toolOutput`: readonly `Readonly`\<\{ `toolCallId`: `string`; `revision`: `number`; `tail`: `string`; `droppedBytes`: `number`; `totalBytes`: `number`; \}\>[]; `extensions`: [`SessionExtensionSlots`](client.md#sessionextensionslots); `attention`: readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`: `number` \| `null`; \}\>; \}\>\> | Open the exact saved conversation without creating work. |
812
- | `create()` | (`grant`, `agentId`, `requestId`) => `Promise`\<`string`\> | Create a Session once under the caller's replay identity. |
813
- | `remove()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`boolean`\> | Remove a Session through its runtime owner. |
814
- | `send()` | (`grant`, `agentId`, `sessionId`, `message`) => `Promise`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId`: `string`; \}\> | Send once; an omitted Session is created under the same replay identity. |
868
+ | Name | Type | Description |
869
+ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
870
+ | `list()` | (`grant`, `agentId`, `after?`) => `Promise`\<`Readonly`\<\{ `sessions`: readonly [`SessionSummaryRow`](client.md#sessionsummaryrow)[]; `next`: `string` \| `undefined`; \}\>\> | Enumerate existing Sessions through the owner's bounded cursor. |
871
+ | `read()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`Readonly`\<\{ `sessionId`: `string`; `cursor`: `string` \| `null`; `hasMore`: `boolean`; `oldestCursor?`: `string` \| `null`; `messages`: readonly `Readonly`\<\{ `requestId?`: `string`; `meta?`: [`Json`](extensions.md#json); `data?`: [`Json`](extensions.md#json); `origin?`: `Readonly`\<\{ `extensionId`: ...; `correlation`: ...; \}\>; `id`: `string`; `sequence`: `number`; `commandId`: `string` \| `null`; `value`: [`ModelMessage`](client.md#modelmessage); \}\>[]; `terminals`: readonly `Readonly`\<\{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"`; `sequence`: `number`; `diagnostic`: `string` \| `null`; `meta?`: [`Json`](extensions.md#json); \}\>[]; `compactions?`: readonly `Readonly`\<\{ `id`: `string`; `sequence`: `number`; `at`: `number`; `tokensBefore`: `number`; `tokensAfter`: `number` \| `null`; `trigger`: [`SessionCompactionTrigger`](client.md#sessioncompactiontrigger) \| `null`; \}\>[]; `compactionNotices?`: readonly `Readonly`\<\{ `id`: `string`; `sequence`: `number`; `at`: `number`; `trigger`: [`SessionCompactionTrigger`](client.md#sessioncompactiontrigger); `result`: `"failed"` \| `"nothing_to_compact"` \| `"stale"` \| `"insufficient"`; `diagnostic`: `string` \| `null`; \}\>[]; `sandboxFailures?`: readonly `object`[]; `pending`: [`SessionPendingPrompts`](client.md#sessionpendingprompts); `activity`: [`SessionActivity`](client.md#sessionactivity); `progress`: \| `Readonly`\<\{ `messageId`: `string`; `revision`: `number`; `text`: `string`; `thinking`: `string`; `textOffset`: `number`; `thinkingOffset`: `number`; `textTruncated`: `boolean`; `thinkingTruncated`: `boolean`; \}\> \| `null`; `toolOutput`: readonly `Readonly`\<\{ `toolCallId`: `string`; `revision`: `number`; `tail`: `string`; `droppedBytes`: `number`; `totalBytes`: `number`; \}\>[]; `extensions`: [`SessionExtensionSlots`](client.md#sessionextensionslots); `attention`: readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`: `number` \| `null`; \}\>; \}\>\> | Open the exact saved conversation without creating work. |
872
+ | `create()` | (`grant`, `agentId`, `requestId`) => `Promise`\<`string`\> | Create a Session once under the caller's replay identity. |
873
+ | `remove()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`boolean`\> | Remove a Session through its runtime owner. |
874
+ | `send()` | (`grant`, `agentId`, `sessionId`, `message`) => `Promise`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId`: `string`; \}\> | Send once; an omitted Session is created under the same replay identity. |
package/docs/api/http.md CHANGED
@@ -64,6 +64,34 @@ it.
64
64
 
65
65
  ## Functions
66
66
 
67
+ ### toShiitakeErrorWire()
68
+
69
+ ```ts
70
+ function toShiitakeErrorWire(cause): object;
71
+ ```
72
+
73
+ Sanitize one caught host failure for Shiitake's public wire.
74
+
75
+ #### Parameters
76
+
77
+ | Parameter | Type |
78
+ | --------- | --------- |
79
+ | `cause` | `unknown` |
80
+
81
+ #### Returns
82
+
83
+ `object`
84
+
85
+ | Name | Type | Default value |
86
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
87
+ | `_tag` | `"ShiitakeError"` | - |
88
+ | `boundary` | \| `"contract"` \| `"extensions"` \| `"instructions"` \| `"model"` \| `"runtime"` \| `"store"` \| `"tools"` | `ShiitakeErrorBoundarySchema` |
89
+ | `cause` | \| `"closed"` \| `"conflict"` \| `"incompatible"` \| `"invalid"` \| `"rejected"` \| `"unavailable"` \| `"state_reset_required"` \| `"storage_pressure"` \| `"archived"` | `ShiitakeErrorCauseSchema` |
90
+ | `message` | `string` | `Schema.String` |
91
+ | `requestId?` | `string` | - |
92
+
93
+ ---
94
+
67
95
  ### createShiitakeHttpRoutes()
68
96
 
69
97
  ```ts
package/docs/api/index.md CHANGED
@@ -36,13 +36,13 @@ Construct a sanitized boundary failure.
36
36
 
37
37
  ###### Parameters
38
38
 
39
- | Parameter | Type | Description |
40
- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
41
- | `boundary` | \| `"contract"` \| `"extensions"` \| `"instructions"` \| `"model"` \| `"runtime"` \| `"store"` \| `"tools"` | Boundary that rejected the operation. |
42
- | `category` | \| `"closed"` \| `"conflict"` \| `"incompatible"` \| `"invalid"` \| `"rejected"` \| `"unavailable"` \| `"state_reset_required"` \| `"storage_pressure"` | Safe category describing why it was rejected. |
43
- | `message` | `string` | Human-readable message safe for callers to display. |
44
- | `requestId?` | `string` | Request identity recoverable when a send may have reached the owner. |
45
- | `cause?` | `unknown` | The original thrown value, kept for server-side diagnosis only. It is never serialized: the wire encoder copies named fields only. |
39
+ | Parameter | Type | Description |
40
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
41
+ | `boundary` | \| `"contract"` \| `"extensions"` \| `"instructions"` \| `"model"` \| `"runtime"` \| `"store"` \| `"tools"` | Boundary that rejected the operation. |
42
+ | `category` | \| `"closed"` \| `"conflict"` \| `"incompatible"` \| `"invalid"` \| `"rejected"` \| `"unavailable"` \| `"state_reset_required"` \| `"storage_pressure"` \| `"archived"` | Safe category describing why it was rejected. |
43
+ | `message` | `string` | Human-readable message safe for callers to display. |
44
+ | `requestId?` | `string` | Request identity recoverable when a send may have reached the owner. |
45
+ | `cause?` | `unknown` | The original thrown value, kept for server-side diagnosis only. It is never serialized: the wire encoder copies named fields only. |
46
46
 
47
47
  ###### Returns
48
48
 
@@ -75,7 +75,8 @@ readonly cause:
75
75
  | "rejected"
76
76
  | "unavailable"
77
77
  | "state_reset_required"
78
- | "storage_pressure";
78
+ | "storage_pressure"
79
+ | "archived";
79
80
  ```
80
81
 
81
82
  Safe category describing why it was rejected.
@@ -577,6 +578,9 @@ type ShiitakeOptions = Readonly<{
577
578
  meta?: HostMetaOptions;
578
579
  store: SqliteOwner;
579
580
  storagePressure?: StoragePressureCheck;
581
+ admission?: Readonly<{
582
+ assertOpen: () => void;
583
+ }>;
580
584
  compaction?: CompactionOptions;
581
585
  runtime: RuntimeHost;
582
586
  model: ModelSource;
@@ -635,10 +639,16 @@ can.
635
639
  ```ts
636
640
  type CommandSettlement = Readonly<{
637
641
  acceptedSender: string | null;
642
+ delegator: string | null;
638
643
  terminal: SessionTerminal;
639
644
  content: string;
640
645
  usage: readonly Pick<AssistantMessage, "provider" | "model" | "usage">[];
641
646
  toolCalls: number;
647
+ waitingOnYou: readonly Readonly<{
648
+ itemId: string;
649
+ kind: string;
650
+ summary: string;
651
+ }>[];
642
652
  }>;
643
653
  ```
644
654
 
@@ -926,10 +936,16 @@ function makeHost(options, mailRoom): Promise<Readonly<{
926
936
  readSettlement: (sessionId, commandId) => Promise<
927
937
  | Readonly<{
928
938
  acceptedSender: string | null;
939
+ delegator: string | null;
929
940
  terminal: SessionTerminal;
930
941
  content: string;
931
942
  usage: readonly Pick<AssistantMessage, ... | ... | ...>[];
932
943
  toolCalls: number;
944
+ waitingOnYou: readonly Readonly<{
945
+ itemId: ...;
946
+ kind: ...;
947
+ summary: ...;
948
+ }>[];
933
949
  }>
934
950
  | undefined>;
935
951
  agent: ShiitakeOwnerAgent;
@@ -953,13 +969,15 @@ Construct the host-only Promise facade over the canonical Effect program.
953
969
  #### Returns
954
970
 
955
971
  `Promise`\<`Readonly`\<\{ `readSettlement`: (`sessionId`, `commandId`) =>
956
- `Promise`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `terminal`:
957
- [`SessionTerminal`](client.md#sessionterminal); `content`: `string`; `usage`:
958
- readonly `Pick`\<`AssistantMessage`, ... \| ... \| ...\>[]; `toolCalls`:
959
- `number`; \}\> \| `undefined`\>; `agent`:
960
- [`ShiitakeOwnerAgent`](#shiitakeowneragent); `acceptMail`: (`mail`, `meta?`,
961
- `reply?`, `stageAcceptedNotice?`) => `Promise`\<`Readonly`\<\{ `status`:
962
- `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\>\>; \}\>\>
972
+ `Promise`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `delegator`:
973
+ `string` \| `null`; `terminal`: [`SessionTerminal`](client.md#sessionterminal);
974
+ `content`: `string`; `usage`: readonly `Pick`\<`AssistantMessage`, ... \| ... \|
975
+ ...\>[]; `toolCalls`: `number`; `waitingOnYou`: readonly `Readonly`\<\{
976
+ `itemId`: ...; `kind`: ...; `summary`: ...; \}\>[]; \}\> \| `undefined`\>;
977
+ `agent`: [`ShiitakeOwnerAgent`](#shiitakeowneragent); `acceptMail`: (`mail`,
978
+ `meta?`, `reply?`, `stageAcceptedNotice?`) => `Promise`\<`Readonly`\<\{
979
+ `status`: `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\>\>;
980
+ \}\>\>
963
981
 
964
982
  ## References
965
983
 
@@ -1047,6 +1065,12 @@ Re-exports [SessionProgress](client.md#sessionprogress)
1047
1065
 
1048
1066
  ---
1049
1067
 
1068
+ ### SessionProgressDelta
1069
+
1070
+ Re-exports [SessionProgressDelta](client.md#sessionprogressdelta)
1071
+
1072
+ ---
1073
+
1050
1074
  ### SessionToolOutput
1051
1075
 
1052
1076
  Re-exports [SessionToolOutput](client.md#sessiontooloutput)
@@ -200,6 +200,8 @@ function memoryHost(options?): Promise<Readonly<{
200
200
  revision: number;
201
201
  text: string;
202
202
  thinking: string;
203
+ textOffset: number;
204
+ thinkingOffset: number;
203
205
  textTruncated: boolean;
204
206
  thinkingTruncated: boolean;
205
207
  }>
@@ -253,10 +255,10 @@ privileges. No submitted JavaScript is evaluated by this helper.
253
255
  [`SessionPendingPrompts`](client.md#sessionpendingprompts); `activity`:
254
256
  [`SessionActivity`](client.md#sessionactivity); `progress`: \| `Readonly`\<\{
255
257
  `messageId`: `string`; `revision`: `number`; `text`: `string`; `thinking`:
256
- `string`; `textTruncated`: `boolean`; `thinkingTruncated`: `boolean`; \}\> \|
257
- `null`; `toolOutput`: readonly `Readonly`\<\{ `toolCallId`: `string`;
258
- `revision`: `number`; `tail`: `string`; `droppedBytes`: `number`; `totalBytes`:
259
- `number`; \}\>[]; `extensions`:
260
- [`SessionExtensionSlots`](client.md#sessionextensionslots); `attention`:
261
- readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`:
262
- ... \| ...; \}\>; \}\>\>; `close`: () => `Promise`\<`void`\>; \}\>\>
258
+ `string`; `textOffset`: `number`; `thinkingOffset`: `number`; `textTruncated`:
259
+ `boolean`; `thinkingTruncated`: `boolean`; \}\> \| `null`; `toolOutput`:
260
+ readonly `Readonly`\<\{ `toolCallId`: `string`; `revision`: `number`; `tail`:
261
+ `string`; `droppedBytes`: `number`; `totalBytes`: `number`; \}\>[];
262
+ `extensions`: [`SessionExtensionSlots`](client.md#sessionextensionslots);
263
+ `attention`: readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`;
264
+ `window`: ... \| ...; \}\>; \}\>\>; `close`: () => `Promise`\<`void`\>; \}\>\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/shiitake",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Effect-native durable Session acceptance and bounded run orchestration",
6
6
  "type": "module",
@@ -86,19 +86,19 @@
86
86
  "node": ">=22.13"
87
87
  },
88
88
  "dependencies": {
89
- "@fungi.computer/bird-dog": "0.3.0",
89
+ "@fungi.computer/bird-dog": "0.3.1",
90
90
  "@fungi.computer/cairn": "0.1.0",
91
91
  "@fungi.computer/carrier": "0.2.0",
92
- "@fungi.computer/knapsack": "0.4.0",
92
+ "@fungi.computer/knapsack": "0.4.1",
93
93
  "@fungi.computer/mule": "0.2.1",
94
- "@fungi.computer/mycelium": "0.2.3",
94
+ "@fungi.computer/mycelium": "0.3.0",
95
95
  "@fungi.computer/seam": "0.2.0",
96
96
  "@fungi.computer/watchdog": "0.1.0",
97
97
  "effect": "4.0.2",
98
98
  "zod": "4.4.3",
99
99
  "@earendil-works/pi-ai": "1.3.0",
100
100
  "@fungi.computer/gills": "0.2.0",
101
- "@fungi.computer/agar": "0.5.0"
101
+ "@fungi.computer/agar": "0.6.0"
102
102
  },
103
103
  "devDependencies": {
104
104
  "@cloudflare/workers-types": "5.20260828.1",