@fungi.computer/shiitake 0.6.0 → 0.8.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 (67) 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 +26 -15
  8. package/dist/client.d.ts +23 -11
  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 +14 -2
  19. package/dist/fleet.js +81 -19
  20. package/dist/http-routes.d.ts +12 -16
  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/observation-kernel.js +12 -3
  31. package/dist/internal/promise-facade.js +2 -0
  32. package/dist/internal/run-scope.d.ts +1 -0
  33. package/dist/internal/run-scope.js +29 -7
  34. package/dist/internal/runtime-coordinator.d.ts +14 -0
  35. package/dist/internal/runtime-coordinator.js +57 -10
  36. package/dist/internal/runtime-core.d.ts +3 -0
  37. package/dist/internal/runtime-core.js +1 -0
  38. package/dist/internal/runtime-reconciliation.js +4 -1
  39. package/dist/internal/session-context.d.ts +5 -5
  40. package/dist/internal/session-context.js +80 -83
  41. package/dist/internal/session-status.d.ts +4 -2
  42. package/dist/internal/session-status.js +22 -4
  43. package/dist/internal/woodstock/client-projection.js +5 -11
  44. package/dist/internal/woodstock/fleet-store.d.ts +3 -2
  45. package/dist/internal/woodstock/fleet-store.js +24 -4
  46. package/dist/internal/woodstock/index.d.ts +3 -3
  47. package/dist/internal/woodstock/index.js +18 -7
  48. package/dist/internal/woodstock/progress.d.ts +13 -1
  49. package/dist/internal/woodstock/progress.js +130 -24
  50. package/dist/internal/woodstock/session-delegator.d.ts +2 -1
  51. package/dist/internal/woodstock/session-store.d.ts +14 -2
  52. package/dist/internal/woodstock/session-store.js +329 -66
  53. package/dist/node.js +11 -2
  54. package/dist/server-visitor-stream.js +33 -24
  55. package/dist/testing.d.ts +2 -0
  56. package/dist/testing.js +2 -0
  57. package/docs/api/agent-control.md +3 -2
  58. package/docs/api/client.md +79 -19
  59. package/docs/api/cloudflare.md +16 -0
  60. package/docs/api/delegation.md +84 -50
  61. package/docs/api/effect.md +85 -7
  62. package/docs/api/extensions.md +8 -8
  63. package/docs/api/fleet.md +118 -29
  64. package/docs/api/http.md +28 -0
  65. package/docs/api/index.md +39 -15
  66. package/docs/api/testing.md +20 -7
  67. package/package.json +5 -5
@@ -120,6 +120,9 @@ type ShiitakeEffectOptions = Readonly<{
120
120
  meta?: HostMetaOptions;
121
121
  store: SqliteOwner;
122
122
  storagePressure?: StoragePressureCheck;
123
+ admission?: Readonly<{
124
+ assertOpen: () => void;
125
+ }>;
123
126
  compaction?: CompactionOptions;
124
127
  hostJobs?: Readonly<{
125
128
  lane: string;
@@ -348,7 +351,7 @@ Effect-native addressable Session handle.
348
351
 
349
352
  ```ts
350
353
  type ShiitakeEffectSessionExtension = Readonly<{
351
- call: (command, input) => Effect.Effect<Json, ShiitakeError>;
354
+ call: (command, input, caller?) => Effect.Effect<Json, ShiitakeError>;
352
355
  }>;
353
356
  ```
354
357
 
@@ -490,10 +493,16 @@ function openHost(options, mailRoom): Effect<Readonly<{
490
493
  readSettlement: (sessionId, commandId) => Effect<
491
494
  | Readonly<{
492
495
  acceptedSender: string | null;
496
+ delegator: string | null;
493
497
  terminal: SessionTerminal;
494
498
  content: string;
495
499
  usage: readonly Pick<AssistantMessage, ... | ... | ...>[];
496
500
  toolCalls: number;
501
+ waitingOnYou: readonly Readonly<{
502
+ itemId: ...;
503
+ kind: ...;
504
+ summary: ...;
505
+ }>[];
497
506
  }>
498
507
  | undefined, ShiitakeError>;
499
508
  agent: ShiitakeEffectOwner;
@@ -517,12 +526,14 @@ Open the Effect-native host composition with addressed mail.
517
526
  #### Returns
518
527
 
519
528
  `Effect`\<`Readonly`\<\{ `readSettlement`: (`sessionId`, `commandId`) =>
520
- `Effect`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `terminal`:
521
- [`SessionTerminal`](client.md#sessionterminal); `content`: `string`; `usage`:
522
- readonly `Pick`\<`AssistantMessage`, ... \| ... \| ...\>[]; `toolCalls`:
523
- `number`; \}\> \| `undefined`, [`ShiitakeError`](index.md#shiitakeerror)\>;
524
- `agent`: [`ShiitakeEffectOwner`](#shiitakeeffectowner); `acceptMail`: (`mail`,
525
- `meta?`, `reply?`, `stageAcceptedNotice?`) => `Effect`\<`Readonly`\<\{ `status`:
529
+ `Effect`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `delegator`:
530
+ `string` \| `null`; `terminal`: [`SessionTerminal`](client.md#sessionterminal);
531
+ `content`: `string`; `usage`: readonly `Pick`\<`AssistantMessage`, ... \| ... \|
532
+ ...\>[]; `toolCalls`: `number`; `waitingOnYou`: readonly `Readonly`\<\{
533
+ `itemId`: ...; `kind`: ...; `summary`: ...; \}\>[]; \}\> \| `undefined`,
534
+ [`ShiitakeError`](index.md#shiitakeerror)\>; `agent`:
535
+ [`ShiitakeEffectOwner`](#shiitakeeffectowner); `acceptMail`: (`mail`, `meta?`,
536
+ `reply?`, `stageAcceptedNotice?`) => `Effect`\<`Readonly`\<\{ `status`:
526
537
  `"accepted"`; `commandId`: `string`; `sessionId?`: `string`; \}\>,
527
538
  [`ShiitakeError`](index.md#shiitakeerror)\>; \}\>,
528
539
  [`ShiitakeError`](index.md#shiitakeerror)\>
@@ -562,6 +573,67 @@ for it. An unreadable Session is its own `unavailable` row.
562
573
  [`StoredSessionSummaryRow`](#storedsessionsummaryrow)[]; `next`: `string` \|
563
574
  `undefined`; \}\>, [`ShiitakeError`](index.md#shiitakeerror), `never`\>
564
575
 
576
+ ---
577
+
578
+ ### readStoredSessionStates()
579
+
580
+ ```ts
581
+ function readStoredSessionStates(
582
+ owner,
583
+ after?,
584
+ ): Effect<
585
+ Readonly<{
586
+ sessions: readonly SessionSummaryRow[];
587
+ next: string | undefined;
588
+ }>,
589
+ ShiitakeError,
590
+ never
591
+ >;
592
+ ```
593
+
594
+ One page of saved conversations with their stored run state (needs_you, running,
595
+ errored, done), in tier then newest-activity order, read from the store alone:
596
+ no Agent runtime starts. The state is as the runtime last wrote it, so it can
597
+ lag work a stopped runtime left behind.
598
+
599
+ #### Parameters
600
+
601
+ | Parameter | Type |
602
+ | --------- | ------------------------------------- |
603
+ | `owner` | [`SqliteOwner`](index.md#sqliteowner) |
604
+ | `after?` | `string` |
605
+
606
+ #### Returns
607
+
608
+ `Effect`\<`Readonly`\<\{ `sessions`: readonly
609
+ [`SessionSummaryRow`](client.md#sessionsummaryrow)[]; `next`: `string` \|
610
+ `undefined`; \}\>, [`ShiitakeError`](index.md#shiitakeerror), `never`\>
611
+
612
+ ---
613
+
614
+ ### readStoredAttention()
615
+
616
+ ```ts
617
+ function readStoredAttention(
618
+ owner,
619
+ sessionId,
620
+ ): Effect<readonly object[], ShiitakeError, never>;
621
+ ```
622
+
623
+ One saved conversation's open attention items, read from the store alone.
624
+
625
+ #### Parameters
626
+
627
+ | Parameter | Type |
628
+ | ----------- | ------------------------------------- |
629
+ | `owner` | [`SqliteOwner`](index.md#sqliteowner) |
630
+ | `sessionId` | `string` |
631
+
632
+ #### Returns
633
+
634
+ `Effect`\<readonly `object`[], [`ShiitakeError`](index.md#shiitakeerror),
635
+ `never`\>
636
+
565
637
  ## References
566
638
 
567
639
  ### AbortCommand
@@ -660,6 +732,12 @@ Re-exports [SessionProgress](client.md#sessionprogress)
660
732
 
661
733
  ---
662
734
 
735
+ ### SessionProgressDelta
736
+
737
+ Re-exports [SessionProgressDelta](client.md#sessionprogressdelta)
738
+
739
+ ---
740
+
663
741
  ### SessionToolOutput
664
742
 
665
743
  Re-exports [SessionToolOutput](client.md#sessiontooloutput)
@@ -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
@@ -28,9 +28,9 @@ new AgentGrantError(reason): AgentGrantError;
28
28
 
29
29
  ###### Parameters
30
30
 
31
- | Parameter | Type |
32
- | --------- | ------------------------------------------------------------------------------------- |
33
- | `reason` | `"agent"` \| `"action"` \| `"expired"` \| `"delegation_loop"` \| `"delegation_depth"` |
31
+ | Parameter | Type |
32
+ | --------- | ----------------------------------------------------------------------------------------------------------------- |
33
+ | `reason` | \| `"agent"` \| `"expired"` \| `"action"` \| `"delegation_loop"` \| `"delegation_depth"` \| `"delegator_missing"` |
34
34
 
35
35
  ###### Returns
36
36
 
@@ -47,7 +47,13 @@ Error.constructor;
47
47
  ##### reason
48
48
 
49
49
  ```ts
50
- readonly reason: "agent" | "action" | "expired" | "delegation_loop" | "delegation_depth";
50
+ readonly reason:
51
+ | "agent"
52
+ | "expired"
53
+ | "action"
54
+ | "delegation_loop"
55
+ | "delegation_depth"
56
+ | "delegator_missing";
51
57
  ```
52
58
 
53
59
  ---
@@ -548,6 +554,13 @@ const agentDelegationTaskSchema: ZodLazy<
548
554
  requestId: ZodString;
549
555
  agentId: ZodString;
550
556
  sessionId: ZodOptional<ZodString>;
557
+ delivery: ZodOptional<
558
+ ZodEnum<{
559
+ followUp: "followUp";
560
+ steer: "steer";
561
+ }>
562
+ >;
563
+ goal: ZodOptional<ZodUnion<readonly [ZodString, ZodLiteral<false>]>>;
551
564
  text: ZodString;
552
565
  },
553
566
  $strict
@@ -647,6 +660,30 @@ together. Physical table names retain the existing Hub store layout.
647
660
 
648
661
  ---
649
662
 
663
+ ### settlementReadableBy()
664
+
665
+ ```ts
666
+ function settlementReadableBy(facts, agentId): boolean;
667
+ ```
668
+
669
+ Whether an Agent may read one command's settlement: the Agent whose mail the
670
+ command answered, or the Session's delegator of record for work no Agent's mail
671
+ admitted (goal, loop and person turns, the work its reports carry). Another
672
+ Agent's correspondence stays with that Agent.
673
+
674
+ #### Parameters
675
+
676
+ | Parameter | Type |
677
+ | --------- | ------------------------------------------------------------------------------------------------ |
678
+ | `facts` | `Pick`\<[`CommandSettlement`](index.md#commandsettlement), `"acceptedSender"` \| `"delegator"`\> |
679
+ | `agentId` | `string` |
680
+
681
+ #### Returns
682
+
683
+ `boolean`
684
+
685
+ ---
686
+
650
687
  ### delegationProvenance()
651
688
 
652
689
  ```ts
@@ -729,6 +766,58 @@ the verified reply retains the failed recipient's identity.
729
766
 
730
767
  ---
731
768
 
769
+ ### isOneWayAncestorNotice()
770
+
771
+ ```ts
772
+ function isOneWayAncestorNotice(mail): boolean;
773
+ ```
774
+
775
+ Shape check for a one-way ancestor notice, not sender provenance. The Local mail
776
+ receiver checks mesh membership before calling it. This addressed mail is still
777
+ work and may steer the parent's running turn when admitted.
778
+
779
+ #### Parameters
780
+
781
+ | Parameter | Type |
782
+ | --------- | ------------- |
783
+ | `mail` | `BirdDogMail` |
784
+
785
+ #### Returns
786
+
787
+ `boolean`
788
+
789
+ ---
790
+
791
+ ### readOutstandingDelegationSync()
792
+
793
+ ```ts
794
+ function readOutstandingDelegationSync(storage):
795
+ | Readonly<{
796
+ agentId: string;
797
+ sessionId: string;
798
+ commandId: string;
799
+ unreadable?: string;
800
+ }>
801
+ | undefined;
802
+ ```
803
+
804
+ Read confirmed sender receipts that have no locally observed settlement. Call
805
+ inside the Agent owner's transaction that also changes archived state. Remote
806
+ reads happen separately; an unobserved settlement remains busy.
807
+
808
+ #### Parameters
809
+
810
+ | Parameter | Type |
811
+ | --------- | --------------------- |
812
+ | `storage` | `WatchdogSqliteOwner` |
813
+
814
+ #### Returns
815
+
816
+ \| `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; `commandId`:
817
+ `string`; `unreadable?`: `string`; \}\> \| `undefined`
818
+
819
+ ---
820
+
732
821
  ### createFleetCorrespondence()
733
822
 
734
823
  ```ts
@@ -747,14 +836,14 @@ Shiitake owns work deduplication, execution and settlement; Post owns replies.
747
836
 
748
837
  #### Returns
749
838
 
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. |
839
+ | Name | Type | Description |
840
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
841
+ | `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
842
+ | `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. |
843
+ | `recordLocalUndeliverable()` | (`original`, `reply`) => `boolean` | Bind exhausted local delivery to its frozen sender correspondence. Bind an exhausted local Carrier row to its frozen sender correspondence. |
844
+ | `recordUndeliverableReply()` | (`mailKey`) => `boolean` | Prevent replay after a system undeliverable reply is admitted. Make a successfully admitted system disposition replay-ineligible. |
845
+ | `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. |
846
+ | `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
847
 
759
848
  ---
760
849
 
@@ -775,16 +864,16 @@ it.
775
864
 
776
865
  #### Returns
777
866
 
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. |
867
+ | Name | Type | Description |
868
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
869
+ | `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
870
+ | `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. |
871
+ | `recordLocalUndeliverable()` | (`original`, `reply`) => `boolean` | Bind exhausted local delivery to its frozen sender correspondence. Bind an exhausted local Carrier row to its frozen sender correspondence. |
872
+ | `recordUndeliverableReply()` | (`mailKey`) => `boolean` | Prevent replay after a system undeliverable reply is admitted. Make a successfully admitted system disposition replay-ineligible. |
873
+ | `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. |
874
+ | `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. |
875
+ | `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. |
876
+ | `delegate()` | (`grant`, `task`) => `Promise`\< \| `Readonly`\<\{ `kind`: `"pending"`; `retryAfterMs`: `number`; \}\> \| [`AgentDelegationOutcome`](#agentdelegationoutcome)\> | Submit or poll the exact turn, yielding Agar Pending until settled. |
788
877
 
789
878
  ---
790
879
 
@@ -805,10 +894,10 @@ checks a fresh supplied grant and releases its transport without stopping work.
805
894
 
806
895
  #### Returns
807
896
 
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. |
897
+ | Name | Type | Description |
898
+ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
899
+ | `list()` | (`grant`, `agentId`, `after?`) => `Promise`\<`Readonly`\<\{ `sessions`: readonly [`SessionSummaryRow`](client.md#sessionsummaryrow)[]; `next`: `string` \| `undefined`; \}\>\> | Enumerate existing Sessions through the owner's bounded cursor. |
900
+ | `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. |
901
+ | `create()` | (`grant`, `agentId`, `requestId`) => `Promise`\<`string`\> | Create a Session once under the caller's replay identity. |
902
+ | `remove()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`boolean`\> | Remove a Session through its runtime owner. |
903
+ | `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