@fungi.computer/shiitake 0.3.0 → 0.4.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 +18 -8
- package/dist/agent-control.d.ts +19 -15
- package/dist/agent-control.js +66 -126
- package/dist/client-wire.d.ts +12 -3
- package/dist/client-wire.js +33 -8
- package/dist/client.d.ts +34 -3
- package/dist/client.js +1 -1
- package/dist/cloudflare.d.ts +3 -1
- package/dist/cloudflare.js +2 -2
- package/dist/delegation.d.ts +145 -13
- package/dist/delegation.js +109 -37
- package/dist/effect.d.ts +1 -1
- package/dist/fleet.d.ts +30 -8
- package/dist/fleet.js +142 -38
- package/dist/http-routes.d.ts +91 -19
- package/dist/http-routes.js +15 -1
- package/dist/index.d.ts +2 -2
- package/dist/internal/admission-door.d.ts +2 -0
- package/dist/internal/admission-door.js +2 -0
- package/dist/internal/client-boundary.d.ts +10 -0
- package/dist/internal/client-boundary.js +10 -0
- package/dist/internal/compaction/compaction.d.ts +5 -5
- package/dist/internal/compaction/compaction.js +4 -5
- package/dist/internal/compaction/settings.d.ts +1 -1
- package/dist/internal/compaction/utils.d.ts +1 -1
- package/dist/internal/contracts.d.ts +2 -0
- package/dist/internal/coordinator.d.ts +3 -1
- package/dist/internal/coordinator.js +98 -13
- package/dist/internal/effect-client.d.ts +3 -1
- package/dist/internal/effect-client.js +3 -2
- package/dist/internal/effect-contracts.d.ts +6 -2
- package/dist/internal/model-acquisition.js +2 -0
- package/dist/internal/model-preference.d.ts +2 -2
- package/dist/internal/observation-kernel.d.ts +8 -4
- package/dist/internal/observation-kernel.js +44 -9
- package/dist/internal/promise-facade.d.ts +1 -1
- package/dist/internal/promise-facade.js +1 -1
- package/dist/internal/run-scope.js +37 -8
- package/dist/internal/runtime-coordinator.d.ts +5 -0
- package/dist/internal/runtime-coordinator.js +8 -4
- package/dist/internal/runtime-core.d.ts +2 -1
- package/dist/internal/runtime-core.js +6 -1
- package/dist/internal/session-context.d.ts +1 -1
- package/dist/internal/session-context.js +84 -13
- package/dist/internal/woodstock/agent-reply.d.ts +7 -2
- package/dist/internal/woodstock/agent-reply.js +22 -13
- package/dist/internal/woodstock/fleet-store.d.ts +3 -2
- package/dist/internal/woodstock/fleet-store.js +43 -6
- package/dist/internal/woodstock/index.d.ts +2 -0
- package/dist/internal/woodstock/index.js +11 -5
- package/dist/internal/woodstock/run-recovery.js +4 -1
- package/dist/internal/woodstock/session-entry.d.ts +14 -4
- package/dist/internal/woodstock/session-entry.js +1 -0
- package/dist/internal/woodstock/session-store.d.ts +4 -0
- package/dist/internal/woodstock/session-store.js +26 -19
- package/dist/remote-client.js +5 -1
- package/dist/testing.d.ts +6 -3
- package/dist/testing.js +4 -2
- package/docs/api/agent-control.md +18 -12
- package/docs/api/client.md +78 -0
- package/docs/api/delegation.md +72 -55
- package/docs/api/effect.md +5 -0
- package/docs/api/fleet.md +23 -23
- package/docs/api/http.md +2 -1
- package/docs/api/index.md +13 -0
- package/docs/api/model-preference.md +10 -10
- package/docs/api/testing.md +3 -3
- package/package.json +9 -8
package/dist/testing.js
CHANGED
|
@@ -176,12 +176,14 @@ export async function memoryHost(options = {}) {
|
|
|
176
176
|
return {
|
|
177
177
|
agent,
|
|
178
178
|
reconcile: async () => requireBound().reconcile(),
|
|
179
|
-
settle: async (sessionId, maxTicks) => {
|
|
179
|
+
settle: async (sessionId, maxTicks, beforeRead) => {
|
|
180
180
|
const budget = settlementBudgetSchema.parse(maxTicks);
|
|
181
181
|
for (let tick = 0; tick < budget; tick += 1) {
|
|
182
182
|
const host = requireBound();
|
|
183
|
-
if (!(await host.pendingWork()).pending)
|
|
183
|
+
if (!(await host.pendingWork()).pending) {
|
|
184
|
+
await beforeRead?.();
|
|
184
185
|
return agent.session(sessionId).read();
|
|
186
|
+
}
|
|
185
187
|
await host.reconcile();
|
|
186
188
|
}
|
|
187
189
|
throw new Error(`Memory host did not settle within ${String(budget)} reconciliation ticks`);
|
|
@@ -219,7 +219,12 @@ Host-only identity and admitted command metadata for one delegated send.
|
|
|
219
219
|
```ts
|
|
220
220
|
type AgentControlDirectory = Readonly<{
|
|
221
221
|
list: (signal, options?) => Promise<readonly AgentControlAgent[]>;
|
|
222
|
-
send?: (
|
|
222
|
+
send?: (
|
|
223
|
+
input,
|
|
224
|
+
sourceSessionId,
|
|
225
|
+
signal,
|
|
226
|
+
invocation?,
|
|
227
|
+
) => Promise<Accepted | Held>;
|
|
223
228
|
recall?: (input, sourceSessionId, signal) => Promise<CancelResult>;
|
|
224
229
|
create?: (input, signal) => Promise<AgentControlAgent>;
|
|
225
230
|
setModel?: (input, signal) => Promise<void>;
|
|
@@ -262,10 +267,10 @@ report back, its store predates the current schema, or the Agent is archived.
|
|
|
262
267
|
|
|
263
268
|
## Functions
|
|
264
269
|
|
|
265
|
-
###
|
|
270
|
+
### waitForAgentSettlement()
|
|
266
271
|
|
|
267
272
|
```ts
|
|
268
|
-
function
|
|
273
|
+
function waitForAgentSettlement(
|
|
269
274
|
session,
|
|
270
275
|
commandId,
|
|
271
276
|
timeoutMs,
|
|
@@ -273,16 +278,16 @@ function waitForAgentTerminal(
|
|
|
273
278
|
startedAt?,
|
|
274
279
|
): Promise<
|
|
275
280
|
Readonly<{
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
acceptedSender: string | null;
|
|
282
|
+
terminal: SessionTerminal;
|
|
283
|
+
content: string;
|
|
284
|
+
usage: readonly Pick<AssistantMessage, "model" | "provider" | "usage">[];
|
|
285
|
+
toolCalls: number;
|
|
281
286
|
}>
|
|
282
287
|
>;
|
|
283
288
|
```
|
|
284
289
|
|
|
285
|
-
|
|
290
|
+
Await one exact durable terminal without opening a transcript observation.
|
|
286
291
|
|
|
287
292
|
#### Parameters
|
|
288
293
|
|
|
@@ -296,9 +301,10 @@ Observe one durable terminal; timeout or abort closes observation, not the work.
|
|
|
296
301
|
|
|
297
302
|
#### Returns
|
|
298
303
|
|
|
299
|
-
`Promise`\<`Readonly`\<\{ `
|
|
300
|
-
`
|
|
301
|
-
`
|
|
304
|
+
`Promise`\<`Readonly`\<\{ `acceptedSender`: `string` \| `null`; `terminal`:
|
|
305
|
+
[`SessionTerminal`](client.md#sessionterminal); `content`: `string`; `usage`:
|
|
306
|
+
readonly `Pick`\<`AssistantMessage`, `"model"` \| `"provider"` \| `"usage"`\>[];
|
|
307
|
+
`toolCalls`: `number`; \}\>\>
|
|
302
308
|
|
|
303
309
|
---
|
|
304
310
|
|
package/docs/api/client.md
CHANGED
|
@@ -23,6 +23,30 @@ Semantic acknowledgement returned after one durable acceptance commit.
|
|
|
23
23
|
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
+
### Held
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
type Held = Readonly<{
|
|
30
|
+
status: "held";
|
|
31
|
+
reason: "recipient_offline";
|
|
32
|
+
message: "waiting: recipient offline";
|
|
33
|
+
}>;
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Durable relay custody, not acceptance of a command by the recipient.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### DelegationReceipt
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
type DelegationReceipt = Accepted | Held;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
A delegation send can be accepted by the Agent or held by its relay.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
26
50
|
### TooLate
|
|
27
51
|
|
|
28
52
|
```ts
|
|
@@ -581,6 +605,10 @@ Bounded Session baseline at one opaque owner cursor.
|
|
|
581
605
|
|
|
582
606
|
```ts
|
|
583
607
|
type SessionFrame =
|
|
608
|
+
| Readonly<{
|
|
609
|
+
kind: "activity";
|
|
610
|
+
activity: SessionActivity;
|
|
611
|
+
}>
|
|
584
612
|
| Readonly<{
|
|
585
613
|
kind: "tool_output";
|
|
586
614
|
toolOutput: readonly SessionToolOutput[];
|
|
@@ -686,6 +714,10 @@ type ShiitakeSession = Readonly<{
|
|
|
686
714
|
set: (preference) => Promise<void>;
|
|
687
715
|
}>;
|
|
688
716
|
read: (input?) => Promise<SessionSnapshot>;
|
|
717
|
+
readSettlement: (
|
|
718
|
+
commandId,
|
|
719
|
+
options?,
|
|
720
|
+
) => Promise<CommandSettlement | undefined>;
|
|
689
721
|
subscribe: (input) => AsyncIterable<SessionFrame>;
|
|
690
722
|
watch: (input?) => Promise<SessionWatch>;
|
|
691
723
|
}>;
|
|
@@ -924,8 +956,48 @@ const AcceptedSchema: Schema.Codec<Accepted>;
|
|
|
924
956
|
|
|
925
957
|
Decode a durable command acceptance value at an RPC boundary.
|
|
926
958
|
|
|
959
|
+
---
|
|
960
|
+
|
|
961
|
+
### HeldSchema
|
|
962
|
+
|
|
963
|
+
```ts
|
|
964
|
+
const HeldSchema: Schema.Codec<Held>;
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
Parse the relay's custody acknowledgment without implying Agent acceptance.
|
|
968
|
+
|
|
969
|
+
---
|
|
970
|
+
|
|
971
|
+
### DelegationReceiptSchema
|
|
972
|
+
|
|
973
|
+
```ts
|
|
974
|
+
const DelegationReceiptSchema: Schema.Codec<DelegationReceipt>;
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
A delegated send is accepted by its owner or held in durable mail custody.
|
|
978
|
+
|
|
927
979
|
## Functions
|
|
928
980
|
|
|
981
|
+
### parseDelegationReceipt()
|
|
982
|
+
|
|
983
|
+
```ts
|
|
984
|
+
function parseDelegationReceipt(value): DelegationReceipt;
|
|
985
|
+
```
|
|
986
|
+
|
|
987
|
+
Decode one delegated send's acceptance or durable-custody result.
|
|
988
|
+
|
|
989
|
+
#### Parameters
|
|
990
|
+
|
|
991
|
+
| Parameter | Type |
|
|
992
|
+
| --------- | -------- |
|
|
993
|
+
| `value` | `string` |
|
|
994
|
+
|
|
995
|
+
#### Returns
|
|
996
|
+
|
|
997
|
+
[`DelegationReceipt`](#delegationreceipt)
|
|
998
|
+
|
|
999
|
+
---
|
|
1000
|
+
|
|
929
1001
|
### parseWithdrawResult()
|
|
930
1002
|
|
|
931
1003
|
```ts
|
|
@@ -1145,6 +1217,12 @@ Connect to a remotely hosted Shiitake agent.
|
|
|
1145
1217
|
|
|
1146
1218
|
## References
|
|
1147
1219
|
|
|
1220
|
+
### CommandSettlement
|
|
1221
|
+
|
|
1222
|
+
Re-exports [CommandSettlement](index.md#commandsettlement)
|
|
1223
|
+
|
|
1224
|
+
---
|
|
1225
|
+
|
|
1148
1226
|
### parseForkedSession
|
|
1149
1227
|
|
|
1150
1228
|
Re-exports [parseForkedSession](index.md#parseforkedsession)
|
package/docs/api/delegation.md
CHANGED
|
@@ -24,9 +24,9 @@ new AgentDelegation(deps): AgentDelegation;
|
|
|
24
24
|
|
|
25
25
|
###### Parameters
|
|
26
26
|
|
|
27
|
-
| Parameter | Type
|
|
28
|
-
| --------- |
|
|
29
|
-
| `deps` | `Readonly`\<\{ `storage`: `WatchdogSqliteOwner`; `expiresAt`: () => `number`; `identity`: () => \| [`DelegationIdentity`](#delegationidentity) \| `null` \| `Promise`\<[`DelegationIdentity`](#delegationidentity) \| `null`\>; `directory`: () => [`AgentControlDirectory`](agent-control.md#agentcontroldirectory); `deliver`: (`mail`) => `Promise`\<[`
|
|
27
|
+
| Parameter | Type |
|
|
28
|
+
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `deps` | `Readonly`\<\{ `storage`: `WatchdogSqliteOwner`; `expiresAt`: () => `number`; `identity`: () => \| [`DelegationIdentity`](#delegationidentity) \| `null` \| `Promise`\<[`DelegationIdentity`](#delegationidentity) \| `null`\>; `directory`: () => [`AgentControlDirectory`](agent-control.md#agentcontroldirectory); `deliver`: (`mail`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\>; `prepare`: (`mail`) => `Promise`\<`void`\>; `accept`: (`mail`, `reply?`) => `Promise`\<[`Accepted`](client.md#accepted)\>; \}\> |
|
|
30
30
|
|
|
31
31
|
###### Returns
|
|
32
32
|
|
|
@@ -79,10 +79,7 @@ send(
|
|
|
79
79
|
sourceSessionId,
|
|
80
80
|
signal,
|
|
81
81
|
invocation?
|
|
82
|
-
): Promise<
|
|
83
|
-
status: "accepted";
|
|
84
|
-
commandId: string;
|
|
85
|
-
}>>;
|
|
82
|
+
): Promise<DelegationReceipt>;
|
|
86
83
|
```
|
|
87
84
|
|
|
88
85
|
Delegate work to an in-scope Agent: steer its Session, or start fleet
|
|
@@ -99,7 +96,7 @@ correspondence.
|
|
|
99
96
|
|
|
100
97
|
###### Returns
|
|
101
98
|
|
|
102
|
-
`Promise
|
|
99
|
+
`Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\>
|
|
103
100
|
|
|
104
101
|
##### recall()
|
|
105
102
|
|
|
@@ -205,13 +202,10 @@ new AgentMail(deps): AgentMail;
|
|
|
205
202
|
##### send()
|
|
206
203
|
|
|
207
204
|
```ts
|
|
208
|
-
send(mail): Promise<
|
|
209
|
-
status: "accepted";
|
|
210
|
-
commandId: string;
|
|
211
|
-
}>>;
|
|
205
|
+
send(mail): Promise<DelegationReceipt>;
|
|
212
206
|
```
|
|
213
207
|
|
|
214
|
-
Submit one mail and return
|
|
208
|
+
Submit one mail and return recipient acceptance or relay-held custody.
|
|
215
209
|
|
|
216
210
|
###### Parameters
|
|
217
211
|
|
|
@@ -221,7 +215,7 @@ Submit one mail and return the recipient's Accepted receipt.
|
|
|
221
215
|
|
|
222
216
|
###### Returns
|
|
223
217
|
|
|
224
|
-
`Promise
|
|
218
|
+
`Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\>
|
|
225
219
|
|
|
226
220
|
##### mailRoom()
|
|
227
221
|
|
|
@@ -297,11 +291,11 @@ link routes Agent work without owning Shiitake's grammar.
|
|
|
297
291
|
|
|
298
292
|
#### Type Declaration
|
|
299
293
|
|
|
300
|
-
| Name | Type | Description
|
|
301
|
-
| ------------------- | ------------------------------------------------------------------- |
|
|
302
|
-
| `sessionCreation()` | (`body`) => \| `Readonly`\<\{ `requestId`: `string`; \}\> \| `null` | The Session-creation intent, or null when the body is not one.
|
|
303
|
-
| `settlement()` | (`encoded`) => [`CommandSettlement`](index.md#commandsettlement) | One serialized settlement from a hosted or machine-homed Agent.
|
|
304
|
-
| `accepted()` | (`receipt`) => `void` | Throws unless an acknowledgment carries a
|
|
294
|
+
| Name | Type | Description |
|
|
295
|
+
| ------------------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
296
|
+
| `sessionCreation()` | (`body`) => \| `Readonly`\<\{ `requestId`: `string`; \}\> \| `null` | The Session-creation intent, or null when the body is not one. |
|
|
297
|
+
| `settlement()` | (`encoded`) => [`CommandSettlement`](index.md#commandsettlement) | One serialized settlement from a hosted or machine-homed Agent. |
|
|
298
|
+
| `accepted()` | (`receipt`) => `void` | Throws unless an acknowledgment carries a valid acceptance or Held result. |
|
|
305
299
|
|
|
306
300
|
## Functions
|
|
307
301
|
|
|
@@ -324,11 +318,15 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
324
318
|
content: string;
|
|
325
319
|
createdAt: number;
|
|
326
320
|
meta?: Json | undefined;
|
|
327
|
-
reply?: {
|
|
321
|
+
reply?: | {
|
|
328
322
|
commandId: string;
|
|
329
323
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
330
324
|
diagnostic?: string;
|
|
331
|
-
|
|
325
|
+
}
|
|
326
|
+
| {
|
|
327
|
+
outcome: "undeliverable";
|
|
328
|
+
reason: "recipient_offline" | "recipient_left";
|
|
329
|
+
};
|
|
332
330
|
}, {
|
|
333
331
|
key: string;
|
|
334
332
|
to: {
|
|
@@ -345,11 +343,15 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
345
343
|
content: string;
|
|
346
344
|
createdAt: number;
|
|
347
345
|
meta?: Json | undefined;
|
|
348
|
-
reply?: {
|
|
346
|
+
reply?: | {
|
|
349
347
|
commandId: string;
|
|
350
348
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
351
349
|
diagnostic?: string;
|
|
352
|
-
|
|
350
|
+
}
|
|
351
|
+
| {
|
|
352
|
+
outcome: "undeliverable";
|
|
353
|
+
reason: "recipient_offline" | "recipient_left";
|
|
354
|
+
};
|
|
353
355
|
}, AgentMailAddress, {
|
|
354
356
|
key: string;
|
|
355
357
|
to: {
|
|
@@ -366,11 +368,15 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
366
368
|
content: string;
|
|
367
369
|
createdAt: number;
|
|
368
370
|
meta?: Json | undefined;
|
|
369
|
-
reply?: {
|
|
371
|
+
reply?: | {
|
|
370
372
|
commandId: string;
|
|
371
373
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
372
374
|
diagnostic?: string;
|
|
373
|
-
|
|
375
|
+
}
|
|
376
|
+
| {
|
|
377
|
+
outcome: "undeliverable";
|
|
378
|
+
reason: "recipient_offline" | "recipient_left";
|
|
379
|
+
};
|
|
374
380
|
}, {
|
|
375
381
|
key: string;
|
|
376
382
|
to: {
|
|
@@ -387,13 +393,18 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
387
393
|
content: string;
|
|
388
394
|
createdAt: number;
|
|
389
395
|
meta?: Json | undefined;
|
|
390
|
-
reply?: {
|
|
396
|
+
reply?: | {
|
|
391
397
|
commandId: string;
|
|
392
398
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
393
399
|
diagnostic?: string;
|
|
394
|
-
|
|
400
|
+
}
|
|
401
|
+
| {
|
|
402
|
+
outcome: "undeliverable";
|
|
403
|
+
reason: "recipient_offline" | "recipient_left";
|
|
404
|
+
};
|
|
395
405
|
}> & Omit<Readonly<{
|
|
396
406
|
addressKind: string;
|
|
407
|
+
deadlineMs?: number;
|
|
397
408
|
address: Codec<unknown, unknown>;
|
|
398
409
|
event: Codec<unknown, unknown>;
|
|
399
410
|
encodeEnvelope: (envelope) => object;
|
|
@@ -432,35 +443,41 @@ retries.
|
|
|
432
443
|
`agentId`: `string`; `sessionId`: `string`; \}; `from`: \{ `kind`: `"agent"`;
|
|
433
444
|
`agentId`: `string`; `sessionId`: `string`; \}; `replyTo`: readonly `object`[];
|
|
434
445
|
`content`: `string`; `createdAt`: `number`; `meta?`: Json \| undefined;
|
|
435
|
-
`reply?`: \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \|
|
|
446
|
+
`reply?`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \|
|
|
447
|
+
`"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`:
|
|
448
|
+
`string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"`
|
|
449
|
+
\| `"recipient_left"`; \}; \}, \{ `key`: `string`; `to`: \{ `kind`: `"agent"`;
|
|
450
|
+
`agentId`: `string`; `sessionId`: `string`; \}; `from`: \{ `kind`: `"agent"`;
|
|
451
|
+
`agentId`: `string`; `sessionId`: `string`; \}; `replyTo`: readonly `object`[];
|
|
452
|
+
`content`: `string`; `createdAt`: `number`; `meta?`: Json \| undefined;
|
|
453
|
+
`reply?`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \|
|
|
436
454
|
`"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`:
|
|
437
|
-
`string`; \}
|
|
438
|
-
|
|
439
|
-
`string`; `sessionId`: `string`; \}; `
|
|
440
|
-
`
|
|
441
|
-
`
|
|
442
|
-
\| `
|
|
443
|
-
`
|
|
444
|
-
`
|
|
445
|
-
`
|
|
446
|
-
`
|
|
447
|
-
`
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
`
|
|
451
|
-
`string`; \}
|
|
452
|
-
`
|
|
453
|
-
`
|
|
454
|
-
`
|
|
455
|
-
`
|
|
456
|
-
`
|
|
457
|
-
`
|
|
458
|
-
`
|
|
459
|
-
`
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
(`envelope`) => `void`; \}\>, `"event"` \| `"address"`\>
|
|
455
|
+
`string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"`
|
|
456
|
+
\| `"recipient_left"`; \}; \}, `AgentMailAddress`, \{ `key`: `string`; `to`: \{
|
|
457
|
+
`kind`: `"agent"`; `agentId`: `string`; `sessionId`: `string`; \}; `from`: \{
|
|
458
|
+
`kind`: `"agent"`; `agentId`: `string`; `sessionId`: `string`; \}; `replyTo`:
|
|
459
|
+
readonly `object`[]; `content`: `string`; `createdAt`: `number`; `meta?`: Json
|
|
460
|
+
\| undefined; `reply?`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \|
|
|
461
|
+
`"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`;
|
|
462
|
+
`diagnostic?`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`:
|
|
463
|
+
`"recipient_offline"` \| `"recipient_left"`; \}; \}, \{ `key`: `string`; `to`:
|
|
464
|
+
\{ `kind`: `"agent"`; `agentId`: `string`; `sessionId`: `string`; \}; `from`: \{
|
|
465
|
+
`kind`: `"agent"`; `agentId`: `string`; `sessionId`: `string`; \}; `replyTo`:
|
|
466
|
+
readonly `object`[]; `content`: `string`; `createdAt`: `number`; `meta?`: Json
|
|
467
|
+
\| undefined; `reply?`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \|
|
|
468
|
+
`"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`;
|
|
469
|
+
`diagnostic?`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`:
|
|
470
|
+
`"recipient_offline"` \| `"recipient_left"`; \}; \}\> & `Omit`\<`Readonly`\<\{
|
|
471
|
+
`addressKind`: `string`; `deadlineMs?`: `number`; `address`: `Codec`\<`unknown`,
|
|
472
|
+
`unknown`\>; `event`: `Codec`\<`unknown`, `unknown`\>; `encodeEnvelope`:
|
|
473
|
+
(`envelope`) => `object`; `parseDelivery`: (`envelope`) => `object`;
|
|
474
|
+
`prepareEnvelope?`: (`envelope`, `signal`) => `Promise`\<\{ `key`: `string`;
|
|
475
|
+
`kind`: `string`; `address`: `unknown`; `event`: `unknown`; \}\>;
|
|
476
|
+
`recordDelivered?`: (`envelope`) => `void`; `nameOf`: (`envelope`) => `string`;
|
|
477
|
+
`namespace`: `Readonly`\<\{ `getByName`: (`name`) => `Readonly`\<\{ `deliver`:
|
|
478
|
+
(`envelope`) => `Promise`\<...\>; \}\>; \}\>; `recordCursor?`: (`envelope`,
|
|
479
|
+
`cursor`) => `void`; `recordRefused?`: (`envelope`) => `void`; \}\>, `"event"`
|
|
480
|
+
\| `"address"`\>
|
|
464
481
|
|
|
465
482
|
---
|
|
466
483
|
|
package/docs/api/effect.md
CHANGED
|
@@ -36,6 +36,7 @@ type ModelAcquisitionEffect = Readonly<{
|
|
|
36
36
|
retryAfterMs?: (message) => number | undefined;
|
|
37
37
|
retryable: (message) => boolean;
|
|
38
38
|
failureReason?: (message) => string | undefined;
|
|
39
|
+
providerError?: (message) => string | undefined;
|
|
39
40
|
release: Effect.Effect<void, ShiitakeError>;
|
|
40
41
|
}>;
|
|
41
42
|
```
|
|
@@ -322,6 +323,10 @@ type ShiitakeEffectSession = Readonly<{
|
|
|
322
323
|
set: (preference) => Effect.Effect<void, ShiitakeError>;
|
|
323
324
|
}>;
|
|
324
325
|
read: (input?) => Effect.Effect<SessionSnapshot, ShiitakeError>;
|
|
326
|
+
readSettlement: (
|
|
327
|
+
commandId,
|
|
328
|
+
timeoutMs?,
|
|
329
|
+
) => Effect.Effect<CommandSettlement | undefined, ShiitakeError>;
|
|
325
330
|
subscribe: (input) => Stream.Stream<SessionFrame, ShiitakeError>;
|
|
326
331
|
watch: (input?) => Effect.Effect<ShiitakeEffectWatch, ShiitakeError>;
|
|
327
332
|
}>;
|
package/docs/api/fleet.md
CHANGED
|
@@ -217,7 +217,7 @@ Exact settled Session facts, including Pi usage and tool-call records.
|
|
|
217
217
|
```ts
|
|
218
218
|
type FleetDelegationOptions = Readonly<{
|
|
219
219
|
storage: WatchdogSqliteOwner;
|
|
220
|
-
deliver: (mail) => Promise<
|
|
220
|
+
deliver: (mail) => Promise<DelegationReceipt>;
|
|
221
221
|
readSettlement: (
|
|
222
222
|
agentId,
|
|
223
223
|
sessionId,
|
|
@@ -364,6 +364,16 @@ One idempotent prompt, using the Session owner's existing delivery grammar.
|
|
|
364
364
|
|
|
365
365
|
## Variables
|
|
366
366
|
|
|
367
|
+
### commandSettlementSchema
|
|
368
|
+
|
|
369
|
+
```ts
|
|
370
|
+
const commandSettlementSchema: Schema.Codec<CommandSettlement>;
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Exact command facts shared by Session clients and host fleet transports.
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
367
377
|
### agentActionSchema
|
|
368
378
|
|
|
369
379
|
```ts
|
|
@@ -523,16 +533,6 @@ const agentDelegationTaskSchema: ZodLazy<
|
|
|
523
533
|
|
|
524
534
|
Replay identity and work, with the parent supplied exclusively by the grant.
|
|
525
535
|
|
|
526
|
-
---
|
|
527
|
-
|
|
528
|
-
### commandSettlementSchema
|
|
529
|
-
|
|
530
|
-
```ts
|
|
531
|
-
const commandSettlementSchema: Schema.Codec<CommandSettlement>;
|
|
532
|
-
```
|
|
533
|
-
|
|
534
|
-
Exact host facts encoded over internal transports, without transcript content.
|
|
535
|
-
|
|
536
536
|
## Functions
|
|
537
537
|
|
|
538
538
|
### assertAgentGrant()
|
|
@@ -700,11 +700,11 @@ Shiitake owns work deduplication, execution and settlement; Post owns replies.
|
|
|
700
700
|
|
|
701
701
|
#### Returns
|
|
702
702
|
|
|
703
|
-
| Name | Type
|
|
704
|
-
| --------------------- |
|
|
705
|
-
| `start()` | (`grant`, `raw`) => `Promise
|
|
706
|
-
| `authenticateReply()` | (`mail`) => \| `Readonly`\<\{ `ancestors`: readonly `string`[]; `maxDepth`: `number`; `reply`: \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; `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. |
|
|
707
|
-
| `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; \}\> \| `undefined`
|
|
703
|
+
| Name | Type | Description |
|
|
704
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
705
|
+
| `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
|
|
706
|
+
| `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. |
|
|
707
|
+
| `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; \}\> \| `undefined` | Read an existing acceptance receipt without reserving or delivering mail. Read only the existing acceptance receipt; do not reserve or deliver mail. |
|
|
708
708
|
|
|
709
709
|
---
|
|
710
710
|
|
|
@@ -725,13 +725,13 @@ it.
|
|
|
725
725
|
|
|
726
726
|
#### Returns
|
|
727
727
|
|
|
728
|
-
| Name | Type
|
|
729
|
-
| --------------------- |
|
|
730
|
-
| `start()` | (`grant`, `raw`) => `Promise
|
|
731
|
-
| `authenticateReply()` | (`mail`) => \| `Readonly`\<\{ `ancestors`: readonly `string`[]; `maxDepth`: `number`; `reply`: \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; `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. |
|
|
732
|
-
| `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; \}\> \| `undefined`
|
|
733
|
-
| `outstanding()` | () => `Promise`\< \| `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; `commandId`: `string`; `unreadable?`: `string`; \}\> \| `undefined`\>
|
|
734
|
-
| `delegate()` | (`grant`, `task`) => `Promise`\< \| `Readonly`\<\{ `kind`: `"pending"`; `retryAfterMs`: `number`; \}\> \| [`AgentDelegationOutcome`](#agentdelegationoutcome)\>
|
|
728
|
+
| Name | Type | Description |
|
|
729
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
730
|
+
| `start()` | (`grant`, `raw`) => `Promise`\<[`DelegationReceipt`](client.md#delegationreceipt)\> | Submit frozen mail or reuse its recorded Session admission receipt. |
|
|
731
|
+
| `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. |
|
|
732
|
+
| `receipt()` | (`requestId`) => \| `Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; \}\> \| `undefined` | Read an existing acceptance receipt without reserving or delivering mail. Read only the existing acceptance receipt; do not reserve or deliver mail. |
|
|
733
|
+
| `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. |
|
|
734
|
+
| `delegate()` | (`grant`, `task`) => `Promise`\< \| `Readonly`\<\{ `kind`: `"pending"`; `retryAfterMs`: `number`; \}\> \| [`AgentDelegationOutcome`](#agentdelegationoutcome)\> | Submit or poll the exact turn, yielding Agar Pending until settled. |
|
|
735
735
|
|
|
736
736
|
---
|
|
737
737
|
|
package/docs/api/http.md
CHANGED
|
@@ -88,6 +88,7 @@ function createShiitakeHttpRoutes(
|
|
|
88
88
|
object &
|
|
89
89
|
object &
|
|
90
90
|
object &
|
|
91
|
+
object &
|
|
91
92
|
object,
|
|
92
93
|
"/",
|
|
93
94
|
"/sessions/:sessionId/events"
|
|
@@ -110,5 +111,5 @@ Build Shiitake's typed HTTP routes around an existing Session owner.
|
|
|
110
111
|
|
|
111
112
|
`Hono`\<[`ShiitakeHttpEnv`](#shiitakehttpenv), `object` & `object` & `object` &
|
|
112
113
|
`object` & `object` & `object` & `object` & `object` & `object` & `object` &
|
|
113
|
-
`object` & `object` & `object` & `object`, `"/"`,
|
|
114
|
+
`object` & `object` & `object` & `object` & `object`, `"/"`,
|
|
114
115
|
`"/sessions/:sessionId/events"`\>
|
package/docs/api/index.md
CHANGED
|
@@ -415,6 +415,7 @@ type ModelAcquisition = Readonly<{
|
|
|
415
415
|
retryable: (message) => boolean;
|
|
416
416
|
retryAfterMs?: (message) => number | undefined;
|
|
417
417
|
failureReason?: (message) => string | undefined;
|
|
418
|
+
providerError?: (message) => string | undefined;
|
|
418
419
|
release: () => Promise<void>;
|
|
419
420
|
}>;
|
|
420
421
|
```
|
|
@@ -978,6 +979,18 @@ Re-exports [Accepted](client.md#accepted)
|
|
|
978
979
|
|
|
979
980
|
---
|
|
980
981
|
|
|
982
|
+
### DelegationReceipt
|
|
983
|
+
|
|
984
|
+
Re-exports [DelegationReceipt](client.md#delegationreceipt)
|
|
985
|
+
|
|
986
|
+
---
|
|
987
|
+
|
|
988
|
+
### Held
|
|
989
|
+
|
|
990
|
+
Re-exports [Held](client.md#held)
|
|
991
|
+
|
|
992
|
+
---
|
|
993
|
+
|
|
981
994
|
### ForkedSession
|
|
982
995
|
|
|
983
996
|
Re-exports [ForkedSession](client.md#forkedsession)
|