@fungi.computer/shiitake 0.5.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.
- package/README.md +59 -21
- package/dist/agent-control.d.ts +94 -2
- package/dist/agent-control.js +147 -26
- package/dist/client-entry.d.ts +20 -0
- package/dist/client-entry.js +5 -0
- package/dist/client-visitor.d.ts +33 -0
- package/dist/client-visitor.js +231 -0
- package/dist/client-wire.d.ts +9 -0
- package/dist/client-wire.js +24 -3
- package/dist/client.d.ts +27 -6
- package/dist/client.js +23 -0
- package/dist/cloudflare.d.ts +20 -0
- package/dist/cloudflare.js +4 -1
- package/dist/delegation.d.ts +79 -53
- package/dist/delegation.js +26 -21
- package/dist/effect.d.ts +26 -1
- package/dist/effect.js +14 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -0
- package/dist/extensions.d.ts +22 -3
- package/dist/extensions.js +1 -1
- package/dist/fleet.d.ts +25 -2
- package/dist/fleet.js +108 -24
- package/dist/hosted.js +3 -0
- package/dist/http-routes.d.ts +23 -9
- package/dist/http.d.ts +1 -0
- package/dist/http.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/internal/accepted-run-executor.js +2 -1
- package/dist/internal/admission-door.d.ts +6 -1
- package/dist/internal/admission-door.js +33 -3
- package/dist/internal/contracts.d.ts +19 -1
- package/dist/internal/coordinator.js +115 -52
- package/dist/internal/effect-client.js +1 -1
- package/dist/internal/effect-contracts.d.ts +9 -2
- package/dist/internal/extension-command-registry.d.ts +2 -1
- package/dist/internal/extension-command-registry.js +3 -1
- package/dist/internal/extension-runtime.d.ts +3 -1
- package/dist/internal/extension-runtime.js +18 -8
- package/dist/internal/model-acquisition.js +2 -0
- package/dist/internal/observation-kernel.d.ts +2 -0
- package/dist/internal/observation-kernel.js +17 -6
- package/dist/internal/promise-facade.js +2 -0
- package/dist/internal/run-scope.d.ts +14 -0
- package/dist/internal/run-scope.js +58 -15
- package/dist/internal/runtime-coordinator.d.ts +14 -0
- package/dist/internal/runtime-coordinator.js +60 -11
- package/dist/internal/runtime-core.d.ts +3 -0
- package/dist/internal/runtime-core.js +1 -0
- package/dist/internal/runtime-reconciliation.js +123 -25
- package/dist/internal/session-context.d.ts +5 -5
- package/dist/internal/session-context.js +80 -83
- package/dist/internal/session-status.d.ts +2 -2
- package/dist/internal/session-status.js +5 -3
- package/dist/internal/woodstock/agent-reply.d.ts +5 -0
- package/dist/internal/woodstock/agent-reply.js +3 -0
- package/dist/internal/woodstock/client-projection.js +13 -11
- package/dist/internal/woodstock/fleet-store.d.ts +3 -2
- package/dist/internal/woodstock/fleet-store.js +24 -4
- package/dist/internal/woodstock/index.d.ts +7 -3
- package/dist/internal/woodstock/index.js +23 -6
- package/dist/internal/woodstock/progress.d.ts +11 -1
- package/dist/internal/woodstock/progress.js +126 -25
- package/dist/internal/woodstock/session-delegator.d.ts +13 -0
- package/dist/internal/woodstock/session-delegator.js +44 -0
- package/dist/internal/woodstock/session-entry.d.ts +12 -2
- package/dist/internal/woodstock/session-store.d.ts +16 -2
- package/dist/internal/woodstock/session-store.js +349 -66
- package/dist/internal/woodstock/work-senders.d.ts +32 -0
- package/dist/internal/woodstock/work-senders.js +70 -0
- package/dist/node.js +11 -2
- package/dist/remote-client.js +7 -2
- package/dist/server-visitor-stream.d.ts +13 -0
- package/dist/server-visitor-stream.js +124 -0
- package/dist/session-attention.d.ts +30 -0
- package/dist/session-attention.js +14 -0
- package/docs/api/agent-control.md +212 -15
- package/docs/api/client-entry.md +3 -0
- package/docs/api/client.md +209 -5
- package/docs/api/cloudflare.md +23 -1
- package/docs/api/delegation.md +284 -77
- package/docs/api/effect.md +100 -12
- package/docs/api/extensions.md +73 -12
- package/docs/api/fleet.md +138 -25
- package/docs/api/http.md +28 -0
- package/docs/api/index.md +43 -17
- package/docs/api/testing.md +9 -7
- package/package.json +10 -6
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"` \| `"
|
|
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" | "
|
|
50
|
+
readonly reason: "agent" | "expired" | "action" | "delegation_loop" | "delegation_depth";
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
---
|
|
@@ -73,7 +73,7 @@ new DirectoryError(status, code): DirectoryError;
|
|
|
73
73
|
| Parameter | Type |
|
|
74
74
|
| --------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
75
75
|
| `status` | `400` \| `403` \| `404` \| `409` \| `503` |
|
|
76
|
-
| `code` | \| `"not_found"` \| `"
|
|
76
|
+
| `code` | \| `"not_found"` \| `"request_conflict"` \| `"invalid_input"` \| `"name_taken"` \| `"computer_team_conflict"` \| `"partial_init"` |
|
|
77
77
|
|
|
78
78
|
###### Returns
|
|
79
79
|
|
|
@@ -98,15 +98,39 @@ readonly status: 400 | 403 | 404 | 409 | 503;
|
|
|
98
98
|
```ts
|
|
99
99
|
readonly code:
|
|
100
100
|
| "not_found"
|
|
101
|
+
| "request_conflict"
|
|
101
102
|
| "invalid_input"
|
|
102
103
|
| "name_taken"
|
|
103
|
-
| "request_conflict"
|
|
104
104
|
| "computer_team_conflict"
|
|
105
105
|
| "partial_init";
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## Type Aliases
|
|
109
109
|
|
|
110
|
+
### AgentDelegationRequestKeyInput
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
type AgentDelegationRequestKeyInput = Readonly<{
|
|
114
|
+
owner:
|
|
115
|
+
| Readonly<{
|
|
116
|
+
kind: "local";
|
|
117
|
+
agentId: string;
|
|
118
|
+
}>
|
|
119
|
+
| Readonly<{
|
|
120
|
+
kind: "hosted";
|
|
121
|
+
scopeId: string;
|
|
122
|
+
agentId: string;
|
|
123
|
+
}>;
|
|
124
|
+
sourceSessionId: string;
|
|
125
|
+
targetAgentId: string;
|
|
126
|
+
requestId: string;
|
|
127
|
+
}>;
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Inputs shared by Local and hosted delegation request identity.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
110
134
|
### AgentAction
|
|
111
135
|
|
|
112
136
|
```ts
|
|
@@ -524,6 +548,12 @@ const agentDelegationTaskSchema: ZodLazy<
|
|
|
524
548
|
requestId: ZodString;
|
|
525
549
|
agentId: ZodString;
|
|
526
550
|
sessionId: ZodOptional<ZodString>;
|
|
551
|
+
delivery: ZodOptional<
|
|
552
|
+
ZodEnum<{
|
|
553
|
+
followUp: "followUp";
|
|
554
|
+
steer: "steer";
|
|
555
|
+
}>
|
|
556
|
+
>;
|
|
527
557
|
text: ZodString;
|
|
528
558
|
},
|
|
529
559
|
$strict
|
|
@@ -535,6 +565,28 @@ Replay identity and work, with the parent supplied exclusively by the grant.
|
|
|
535
565
|
|
|
536
566
|
## Functions
|
|
537
567
|
|
|
568
|
+
### agentDelegationRequestKey()
|
|
569
|
+
|
|
570
|
+
```ts
|
|
571
|
+
function agentDelegationRequestKey(input): Promise<string>;
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
One idempotency identity for a caller-owned delegation request. The target
|
|
575
|
+
Session is deliberately excluded: a sessionless send learns it only after
|
|
576
|
+
acceptance, when recall must still resolve the original receipt.
|
|
577
|
+
|
|
578
|
+
#### Parameters
|
|
579
|
+
|
|
580
|
+
| Parameter | Type |
|
|
581
|
+
| --------- | ------------------------------------------------------------------- |
|
|
582
|
+
| `input` | [`AgentDelegationRequestKeyInput`](#agentdelegationrequestkeyinput) |
|
|
583
|
+
|
|
584
|
+
#### Returns
|
|
585
|
+
|
|
586
|
+
`Promise`\<`string`\>
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
538
590
|
### assertAgentGrant()
|
|
539
591
|
|
|
540
592
|
```ts
|
|
@@ -601,6 +653,30 @@ together. Physical table names retain the existing Hub store layout.
|
|
|
601
653
|
|
|
602
654
|
---
|
|
603
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
|
+
|
|
604
680
|
### delegationProvenance()
|
|
605
681
|
|
|
606
682
|
```ts
|
|
@@ -666,8 +742,9 @@ that reply's own line and never travel onward.
|
|
|
666
742
|
function delegationReplyMeta(delegation, replierName): DelegationReplyMeta;
|
|
667
743
|
```
|
|
668
744
|
|
|
669
|
-
The host metadata for one authenticated reply line
|
|
670
|
-
|
|
745
|
+
The host metadata for one authenticated reply line. An ordinary reply is
|
|
746
|
+
authored by its replying Agent; a delivery failure is a Hub/system fact, while
|
|
747
|
+
the verified reply retains the failed recipient's identity.
|
|
671
748
|
|
|
672
749
|
#### Parameters
|
|
673
750
|
|
|
@@ -682,6 +759,36 @@ author, and the verified reply rides beside the caller's own path.
|
|
|
682
759
|
|
|
683
760
|
---
|
|
684
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
|
+
|
|
685
792
|
### createFleetCorrespondence()
|
|
686
793
|
|
|
687
794
|
```ts
|
|
@@ -700,11 +807,14 @@ Shiitake owns work deduplication, execution and settlement; Post owns replies.
|
|
|
700
807
|
|
|
701
808
|
#### Returns
|
|
702
809
|
|
|
703
|
-
| Name
|
|
704
|
-
|
|
|
705
|
-
| `start()`
|
|
706
|
-
| `authenticateReply()`
|
|
707
|
-
| `
|
|
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. |
|
|
708
818
|
|
|
709
819
|
---
|
|
710
820
|
|
|
@@ -725,13 +835,16 @@ it.
|
|
|
725
835
|
|
|
726
836
|
#### Returns
|
|
727
837
|
|
|
728
|
-
| Name
|
|
729
|
-
|
|
|
730
|
-
| `start()`
|
|
731
|
-
| `authenticateReply()`
|
|
732
|
-
| `
|
|
733
|
-
| `
|
|
734
|
-
| `
|
|
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. |
|
|
735
848
|
|
|
736
849
|
---
|
|
737
850
|
|
|
@@ -752,10 +865,10 @@ checks a fresh supplied grant and releases its transport without stopping work.
|
|
|
752
865
|
|
|
753
866
|
#### Returns
|
|
754
867
|
|
|
755
|
-
| Name | Type
|
|
756
|
-
| ---------- |
|
|
757
|
-
| `list()` | (`grant`, `agentId`, `after?`) => `Promise`\<`Readonly`\<\{ `sessions`: readonly [`SessionSummaryRow`](client.md#sessionsummaryrow)[]; `next`: `string` \| `undefined`; \}\>\>
|
|
758
|
-
| `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. |
|
|
759
|
-
| `create()` | (`grant`, `agentId`, `requestId`) => `Promise`\<`string`\>
|
|
760
|
-
| `remove()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`boolean`\>
|
|
761
|
-
| `send()` | (`grant`, `agentId`, `sessionId`, `message`) => `Promise`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId`: `string`; \}\>
|
|
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
|
|
40
|
-
| ------------ |
|
|
41
|
-
| `boundary` | \| `"contract"` \| `"extensions"` \| `"instructions"` \| `"model"` \| `"runtime"` \| `"store"` \| `"tools"`
|
|
42
|
-
| `category` | \| `"closed"` \| `"conflict"` \| `"incompatible"` \| `"invalid"` \| `"rejected"` \| `"unavailable"` \| `"state_reset_required"` \| `"storage_pressure"` | Safe category describing why it was rejected. |
|
|
43
|
-
| `message` | `string`
|
|
44
|
-
| `requestId?` | `string`
|
|
45
|
-
| `cause?` | `unknown`
|
|
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.
|
|
@@ -224,7 +225,7 @@ type ShiitakeHost = Readonly<{
|
|
|
224
225
|
commandId,
|
|
225
226
|
) => Promise<CommandSettlement | undefined>;
|
|
226
227
|
agent: ShiitakeOwnerAgent;
|
|
227
|
-
acceptMail: (mail, meta?, reply?) => Promise<Accepted>;
|
|
228
|
+
acceptMail: (mail, meta?, reply?, stageAcceptedNotice?) => Promise<Accepted>;
|
|
228
229
|
}>;
|
|
229
230
|
```
|
|
230
231
|
|
|
@@ -415,6 +416,7 @@ type ModelAcquisition = Readonly<{
|
|
|
415
416
|
retryable: (message) => boolean;
|
|
416
417
|
retryAfterMs?: (message) => number | undefined;
|
|
417
418
|
failureReason?: (message) => string | undefined;
|
|
419
|
+
rejection?: (message) => ProviderRejection | undefined;
|
|
418
420
|
providerError?: (message) => string | undefined;
|
|
419
421
|
release: () => Promise<void>;
|
|
420
422
|
}>;
|
|
@@ -576,6 +578,9 @@ type ShiitakeOptions = Readonly<{
|
|
|
576
578
|
meta?: HostMetaOptions;
|
|
577
579
|
store: SqliteOwner;
|
|
578
580
|
storagePressure?: StoragePressureCheck;
|
|
581
|
+
admission?: Readonly<{
|
|
582
|
+
assertOpen: () => void;
|
|
583
|
+
}>;
|
|
579
584
|
compaction?: CompactionOptions;
|
|
580
585
|
runtime: RuntimeHost;
|
|
581
586
|
model: ModelSource;
|
|
@@ -634,10 +639,16 @@ can.
|
|
|
634
639
|
```ts
|
|
635
640
|
type CommandSettlement = Readonly<{
|
|
636
641
|
acceptedSender: string | null;
|
|
642
|
+
delegator: string | null;
|
|
637
643
|
terminal: SessionTerminal;
|
|
638
644
|
content: string;
|
|
639
645
|
usage: readonly Pick<AssistantMessage, "provider" | "model" | "usage">[];
|
|
640
646
|
toolCalls: number;
|
|
647
|
+
waitingOnYou: readonly Readonly<{
|
|
648
|
+
itemId: string;
|
|
649
|
+
kind: string;
|
|
650
|
+
summary: string;
|
|
651
|
+
}>[];
|
|
641
652
|
}>;
|
|
642
653
|
```
|
|
643
654
|
|
|
@@ -925,16 +936,23 @@ function makeHost(options, mailRoom): Promise<Readonly<{
|
|
|
925
936
|
readSettlement: (sessionId, commandId) => Promise<
|
|
926
937
|
| Readonly<{
|
|
927
938
|
acceptedSender: string | null;
|
|
939
|
+
delegator: string | null;
|
|
928
940
|
terminal: SessionTerminal;
|
|
929
941
|
content: string;
|
|
930
942
|
usage: readonly Pick<AssistantMessage, ... | ... | ...>[];
|
|
931
943
|
toolCalls: number;
|
|
944
|
+
waitingOnYou: readonly Readonly<{
|
|
945
|
+
itemId: ...;
|
|
946
|
+
kind: ...;
|
|
947
|
+
summary: ...;
|
|
948
|
+
}>[];
|
|
932
949
|
}>
|
|
933
950
|
| undefined>;
|
|
934
951
|
agent: ShiitakeOwnerAgent;
|
|
935
|
-
acceptMail: (mail, meta?, reply?) => Promise<Readonly<{
|
|
952
|
+
acceptMail: (mail, meta?, reply?, stageAcceptedNotice?) => Promise<Readonly<{
|
|
936
953
|
status: "accepted";
|
|
937
954
|
commandId: string;
|
|
955
|
+
sessionId?: string;
|
|
938
956
|
}>>;
|
|
939
957
|
}>>;
|
|
940
958
|
```
|
|
@@ -951,13 +969,15 @@ Construct the host-only Promise facade over the canonical Effect program.
|
|
|
951
969
|
#### Returns
|
|
952
970
|
|
|
953
971
|
`Promise`\<`Readonly`\<\{ `readSettlement`: (`sessionId`, `commandId`) =>
|
|
954
|
-
`Promise`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `
|
|
955
|
-
[`SessionTerminal`](client.md#sessionterminal);
|
|
956
|
-
readonly `Pick`\<`AssistantMessage`, ... \| ... \|
|
|
957
|
-
`number`;
|
|
958
|
-
|
|
959
|
-
`
|
|
960
|
-
`
|
|
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
|
+
\}\>\>
|
|
961
981
|
|
|
962
982
|
## References
|
|
963
983
|
|
|
@@ -1045,6 +1065,12 @@ Re-exports [SessionProgress](client.md#sessionprogress)
|
|
|
1045
1065
|
|
|
1046
1066
|
---
|
|
1047
1067
|
|
|
1068
|
+
### SessionProgressDelta
|
|
1069
|
+
|
|
1070
|
+
Re-exports [SessionProgressDelta](client.md#sessionprogressdelta)
|
|
1071
|
+
|
|
1072
|
+
---
|
|
1073
|
+
|
|
1048
1074
|
### SessionToolOutput
|
|
1049
1075
|
|
|
1050
1076
|
Re-exports [SessionToolOutput](client.md#sessiontooloutput)
|
package/docs/api/testing.md
CHANGED
|
@@ -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`; `
|
|
257
|
-
`
|
|
258
|
-
|
|
259
|
-
`number`; \}\>[];
|
|
260
|
-
[`SessionExtensionSlots`](client.md#sessionextensionslots);
|
|
261
|
-
readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`;
|
|
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.
|
|
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",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"types": "./dist/client.d.ts",
|
|
20
20
|
"import": "./dist/client.js"
|
|
21
21
|
},
|
|
22
|
+
"./server-visitor-stream": {
|
|
23
|
+
"types": "./dist/server-visitor-stream.d.ts",
|
|
24
|
+
"import": "./dist/server-visitor-stream.js"
|
|
25
|
+
},
|
|
22
26
|
"./agent-control": {
|
|
23
27
|
"types": "./dist/agent-control.d.ts",
|
|
24
28
|
"import": "./dist/agent-control.js"
|
|
@@ -82,19 +86,19 @@
|
|
|
82
86
|
"node": ">=22.13"
|
|
83
87
|
},
|
|
84
88
|
"dependencies": {
|
|
85
|
-
"@fungi.computer/bird-dog": "0.
|
|
89
|
+
"@fungi.computer/bird-dog": "0.3.1",
|
|
86
90
|
"@fungi.computer/cairn": "0.1.0",
|
|
87
91
|
"@fungi.computer/carrier": "0.2.0",
|
|
88
|
-
"@fungi.computer/knapsack": "0.
|
|
89
|
-
"@fungi.computer/mule": "0.2.
|
|
90
|
-
"@fungi.computer/mycelium": "0.
|
|
92
|
+
"@fungi.computer/knapsack": "0.4.1",
|
|
93
|
+
"@fungi.computer/mule": "0.2.1",
|
|
94
|
+
"@fungi.computer/mycelium": "0.3.0",
|
|
91
95
|
"@fungi.computer/seam": "0.2.0",
|
|
92
96
|
"@fungi.computer/watchdog": "0.1.0",
|
|
93
97
|
"effect": "4.0.2",
|
|
94
98
|
"zod": "4.4.3",
|
|
95
99
|
"@earendil-works/pi-ai": "1.3.0",
|
|
96
100
|
"@fungi.computer/gills": "0.2.0",
|
|
97
|
-
"@fungi.computer/agar": "0.
|
|
101
|
+
"@fungi.computer/agar": "0.6.0"
|
|
98
102
|
},
|
|
99
103
|
"devDependencies": {
|
|
100
104
|
"@cloudflare/workers-types": "5.20260828.1",
|