@fungi.computer/shiitake 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -21
- package/dist/agent-control.d.ts +1 -1
- package/dist/agent-control.js +40 -21
- package/dist/client-visitor.d.ts +2 -0
- package/dist/client-visitor.js +6 -1
- package/dist/client-wire.d.ts +4 -0
- package/dist/client-wire.js +18 -3
- package/dist/client.d.ts +24 -4
- package/dist/client.js +22 -0
- package/dist/cloudflare.d.ts +20 -0
- package/dist/cloudflare.js +4 -1
- package/dist/delegation.d.ts +5 -0
- package/dist/delegation.js +24 -8
- package/dist/effect.d.ts +1 -1
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +2 -0
- package/dist/extensions.d.ts +1 -1
- package/dist/fleet.d.ts +10 -2
- package/dist/fleet.js +77 -19
- package/dist/http-routes.d.ts +12 -9
- package/dist/http.d.ts +1 -0
- package/dist/http.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/internal/admission-door.d.ts +1 -1
- package/dist/internal/admission-door.js +8 -4
- package/dist/internal/contracts.d.ts +5 -0
- package/dist/internal/coordinator.js +107 -50
- package/dist/internal/effect-contracts.d.ts +5 -0
- package/dist/internal/extension-runtime.js +5 -3
- package/dist/internal/promise-facade.js +2 -0
- package/dist/internal/run-scope.js +27 -7
- package/dist/internal/runtime-coordinator.d.ts +14 -0
- package/dist/internal/runtime-coordinator.js +52 -10
- package/dist/internal/runtime-core.d.ts +3 -0
- package/dist/internal/runtime-core.js +1 -0
- package/dist/internal/runtime-reconciliation.js +4 -1
- 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/client-projection.js +5 -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 +3 -3
- package/dist/internal/woodstock/index.js +16 -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 +2 -1
- package/dist/internal/woodstock/session-store.d.ts +14 -2
- package/dist/internal/woodstock/session-store.js +329 -66
- package/dist/node.js +11 -2
- package/dist/server-visitor-stream.js +33 -24
- package/docs/api/agent-control.md +3 -2
- package/docs/api/client.md +77 -8
- package/docs/api/cloudflare.md +16 -0
- package/docs/api/delegation.md +84 -50
- package/docs/api/effect.md +85 -7
- package/docs/api/extensions.md +8 -8
- package/docs/api/fleet.md +87 -27
- package/docs/api/http.md +28 -0
- package/docs/api/index.md +39 -15
- package/docs/api/testing.md +9 -7
- package/package.json +5 -5
|
@@ -54,26 +54,17 @@ export function visitorStream(options) {
|
|
|
54
54
|
});
|
|
55
55
|
}, 30_000);
|
|
56
56
|
};
|
|
57
|
-
const publish = async (snapshot
|
|
57
|
+
const publish = async (snapshot) => {
|
|
58
58
|
if (!(await admitted()))
|
|
59
59
|
return false;
|
|
60
60
|
const baseline = visitorSnapshot(options.filter(snapshot), options.visitorId);
|
|
61
|
-
await stream.writeSSE(
|
|
62
|
-
? {
|
|
63
|
-
event: "frame",
|
|
64
|
-
data: JSON.stringify({
|
|
65
|
-
kind: "progress",
|
|
66
|
-
progress: baseline.progress,
|
|
67
|
-
activity: baseline.activity,
|
|
68
|
-
}),
|
|
69
|
-
}
|
|
70
|
-
: { event: "session", data: JSON.stringify(baseline) });
|
|
61
|
+
await stream.writeSSE({ event: "session", data: JSON.stringify(baseline) });
|
|
71
62
|
return !ending;
|
|
72
63
|
};
|
|
73
64
|
const pump = async () => {
|
|
74
65
|
try {
|
|
75
66
|
let snapshot = options.watch.snapshot;
|
|
76
|
-
if (!(await publish(snapshot
|
|
67
|
+
if (!(await publish(snapshot)))
|
|
77
68
|
return;
|
|
78
69
|
heartbeat = setTimeout(() => {
|
|
79
70
|
void beat().catch((cause) => {
|
|
@@ -88,19 +79,37 @@ export function visitorStream(options) {
|
|
|
88
79
|
break;
|
|
89
80
|
if (frame.kind === "tool_output")
|
|
90
81
|
continue;
|
|
82
|
+
if (frame.kind === "progress" || frame.kind === "activity") {
|
|
83
|
+
if (!(await admitted()))
|
|
84
|
+
break;
|
|
85
|
+
snapshot = { ...snapshot, activity: frame.activity };
|
|
86
|
+
const baseline = visitorSnapshot(options.filter(snapshot), options.visitorId);
|
|
87
|
+
if (baseline.activity.queue.state === "idle") {
|
|
88
|
+
if (frame.kind === "activity")
|
|
89
|
+
await stream.writeSSE({
|
|
90
|
+
event: "session",
|
|
91
|
+
data: JSON.stringify(baseline),
|
|
92
|
+
});
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
await stream.writeSSE({
|
|
96
|
+
event: "frame",
|
|
97
|
+
data: JSON.stringify(frame.kind === "activity"
|
|
98
|
+
? { kind: "activity", activity: baseline.activity }
|
|
99
|
+
: {
|
|
100
|
+
...frame,
|
|
101
|
+
progress: {
|
|
102
|
+
...frame.progress,
|
|
103
|
+
thinking: { offset: 0, append: "" },
|
|
104
|
+
},
|
|
105
|
+
activity: baseline.activity,
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
91
110
|
snapshot =
|
|
92
|
-
frame.kind === "
|
|
93
|
-
|
|
94
|
-
...snapshot,
|
|
95
|
-
progress: frame.progress,
|
|
96
|
-
activity: frame.activity,
|
|
97
|
-
}
|
|
98
|
-
: frame.kind === "activity"
|
|
99
|
-
? { ...snapshot, activity: frame.activity }
|
|
100
|
-
: frame.kind === "reset"
|
|
101
|
-
? frame.baseline
|
|
102
|
-
: await options.read();
|
|
103
|
-
if (!(await publish(snapshot, frame.kind === "progress")))
|
|
111
|
+
frame.kind === "reset" ? frame.baseline : await options.read();
|
|
112
|
+
if (!(await publish(snapshot)))
|
|
104
113
|
break;
|
|
105
114
|
}
|
|
106
115
|
}
|
|
@@ -31,7 +31,7 @@ new AgentArchiveRefused(reason, message): AgentArchiveRefused;
|
|
|
31
31
|
|
|
32
32
|
| Parameter | Type |
|
|
33
33
|
| --------- | ---------------------------------------------------------------------------------------------- |
|
|
34
|
-
| `reason` | \| `"
|
|
34
|
+
| `reason` | \| `"archived"` \| `"running"` \| `"pending"` \| `"not_creator"` \| `"self"` \| `"unreadable"` |
|
|
35
35
|
| `message` | `string` |
|
|
36
36
|
|
|
37
37
|
###### Returns
|
|
@@ -62,9 +62,9 @@ Error.name;
|
|
|
62
62
|
|
|
63
63
|
```ts
|
|
64
64
|
readonly reason:
|
|
65
|
+
| "archived"
|
|
65
66
|
| "running"
|
|
66
67
|
| "pending"
|
|
67
|
-
| "archived"
|
|
68
68
|
| "not_creator"
|
|
69
69
|
| "self"
|
|
70
70
|
| "unreadable";
|
|
@@ -235,6 +235,7 @@ type AgentDelegationInput = Readonly<{
|
|
|
235
235
|
| Readonly<{
|
|
236
236
|
sessionId?: string;
|
|
237
237
|
delivery: "followUp";
|
|
238
|
+
goal?: string | false;
|
|
238
239
|
}>;
|
|
239
240
|
```
|
|
240
241
|
|
package/docs/api/client.md
CHANGED
|
@@ -41,6 +41,16 @@ What a visitor may see of their own conversation Session.
|
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
44
|
+
### VisitorLine
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
type VisitorLine = VisitorView["lines"][number];
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
One visitor-visible line without internal attribution or tool metadata.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
44
54
|
### VisitorPendingPrompt
|
|
45
55
|
|
|
46
56
|
```ts
|
|
@@ -404,6 +414,7 @@ type AgentRunningWork =
|
|
|
404
414
|
kind: "session";
|
|
405
415
|
sessionId: string;
|
|
406
416
|
commandId: string;
|
|
417
|
+
title: string;
|
|
407
418
|
}>
|
|
408
419
|
| Readonly<{
|
|
409
420
|
kind: "host";
|
|
@@ -412,8 +423,8 @@ type AgentRunningWork =
|
|
|
412
423
|
}>;
|
|
413
424
|
```
|
|
414
425
|
|
|
415
|
-
|
|
416
|
-
|
|
426
|
+
Blocking executor identity and Session display metadata, never messages or
|
|
427
|
+
provider data.
|
|
417
428
|
|
|
418
429
|
---
|
|
419
430
|
|
|
@@ -469,7 +480,7 @@ Encoded extension slots keyed by extension identity; absent means unavailable.
|
|
|
469
480
|
|
|
470
481
|
```ts
|
|
471
482
|
type SessionExtensionControls = Readonly<{
|
|
472
|
-
call: (command, input) => Promise<Json>;
|
|
483
|
+
call: (command, input, caller?) => Promise<Json>;
|
|
473
484
|
}>;
|
|
474
485
|
```
|
|
475
486
|
|
|
@@ -515,6 +526,8 @@ type SessionProgress = Readonly<{
|
|
|
515
526
|
revision: number;
|
|
516
527
|
text: string;
|
|
517
528
|
thinking: string;
|
|
529
|
+
textOffset: number;
|
|
530
|
+
thinkingOffset: number;
|
|
518
531
|
textTruncated: boolean;
|
|
519
532
|
thinkingTruncated: boolean;
|
|
520
533
|
}>;
|
|
@@ -524,6 +537,27 @@ Process-local assistant progress; never a durable Session fact.
|
|
|
524
537
|
|
|
525
538
|
---
|
|
526
539
|
|
|
540
|
+
### SessionProgressDelta
|
|
541
|
+
|
|
542
|
+
```ts
|
|
543
|
+
type SessionProgressDelta = Readonly<{
|
|
544
|
+
messageId: string;
|
|
545
|
+
revision: number;
|
|
546
|
+
text: Readonly<{
|
|
547
|
+
offset: number;
|
|
548
|
+
append: string;
|
|
549
|
+
}>;
|
|
550
|
+
thinking: Readonly<{
|
|
551
|
+
offset: number;
|
|
552
|
+
append: string;
|
|
553
|
+
}>;
|
|
554
|
+
}>;
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Append-only progress on the wire. Offsets count JavaScript string units.
|
|
558
|
+
|
|
559
|
+
---
|
|
560
|
+
|
|
527
561
|
### SessionPendingPrompt
|
|
528
562
|
|
|
529
563
|
```ts
|
|
@@ -679,7 +713,7 @@ type SessionFrame =
|
|
|
679
713
|
}>
|
|
680
714
|
| Readonly<{
|
|
681
715
|
kind: "progress";
|
|
682
|
-
progress:
|
|
716
|
+
progress: SessionProgressDelta;
|
|
683
717
|
activity: SessionActivity;
|
|
684
718
|
}>
|
|
685
719
|
| Readonly<{
|
|
@@ -1102,10 +1136,10 @@ operator replies.
|
|
|
1102
1136
|
|
|
1103
1137
|
#### Parameters
|
|
1104
1138
|
|
|
1105
|
-
| Parameter | Type
|
|
1106
|
-
| ----------- |
|
|
1107
|
-
| `snapshot` | \| `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`: `string`; `correlation`: `string` \| `null`; \}\>; `id`: `string`; `sequence`: `number`; `commandId`: `string` \| `null`; `value`: [`ModelMessage`](#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`](#sessioncompactiontrigger) \| `null`; \}\>[]; `compactionNotices?`: readonly `Readonly`\<\{ `id`: `string`; `sequence`: `number`; `at`: `number`; `trigger`: [`SessionCompactionTrigger`](#sessioncompactiontrigger); `result`: `"failed"` \| `"nothing_to_compact"` \| `"stale"` \| `"insufficient"`; `diagnostic`: `string` \| `null`; \}\>[]; `sandboxFailures?`: readonly `object`[]; `pending`: [`SessionPendingPrompts`](#sessionpendingprompts); `activity`: [`SessionActivity`](#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`](#sessionextensionslots); `attention`: readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`: `number` \| `null`; \}\>; \}\> \| `null` |
|
|
1108
|
-
| `visitorId` | `string`
|
|
1139
|
+
| Parameter | Type |
|
|
1140
|
+
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1141
|
+
| `snapshot` | \| `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`: `string`; `correlation`: `string` \| `null`; \}\>; `id`: `string`; `sequence`: `number`; `commandId`: `string` \| `null`; `value`: [`ModelMessage`](#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`](#sessioncompactiontrigger) \| `null`; \}\>[]; `compactionNotices?`: readonly `Readonly`\<\{ `id`: `string`; `sequence`: `number`; `at`: `number`; `trigger`: [`SessionCompactionTrigger`](#sessioncompactiontrigger); `result`: `"failed"` \| `"nothing_to_compact"` \| `"stale"` \| `"insufficient"`; `diagnostic`: `string` \| `null`; \}\>[]; `sandboxFailures?`: readonly `object`[]; `pending`: [`SessionPendingPrompts`](#sessionpendingprompts); `activity`: [`SessionActivity`](#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`](#sessionextensionslots); `attention`: readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`: `number` \| `null`; \}\>; \}\> \| `null` |
|
|
1142
|
+
| `visitorId` | `string` |
|
|
1109
1143
|
|
|
1110
1144
|
#### Returns
|
|
1111
1145
|
|
|
@@ -1268,6 +1302,41 @@ Decode the existing bounded saved-conversation projection.
|
|
|
1268
1302
|
|
|
1269
1303
|
---
|
|
1270
1304
|
|
|
1305
|
+
### appendSessionProgress()
|
|
1306
|
+
|
|
1307
|
+
```ts
|
|
1308
|
+
function appendSessionProgress(
|
|
1309
|
+
current,
|
|
1310
|
+
delta,
|
|
1311
|
+
): Readonly<{
|
|
1312
|
+
messageId: string;
|
|
1313
|
+
revision: number;
|
|
1314
|
+
text: string;
|
|
1315
|
+
thinking: string;
|
|
1316
|
+
textOffset: number;
|
|
1317
|
+
thinkingOffset: number;
|
|
1318
|
+
textTruncated: boolean;
|
|
1319
|
+
thinkingTruncated: boolean;
|
|
1320
|
+
}> | null;
|
|
1321
|
+
```
|
|
1322
|
+
|
|
1323
|
+
Fold a decoded append once; a missing prefix waits for an owner reset.
|
|
1324
|
+
|
|
1325
|
+
#### Parameters
|
|
1326
|
+
|
|
1327
|
+
| Parameter | Type |
|
|
1328
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1329
|
+
| `current` | \| `Readonly`\<\{ `messageId`: `string`; `revision`: `number`; `text`: `string`; `thinking`: `string`; `textOffset`: `number`; `thinkingOffset`: `number`; `textTruncated`: `boolean`; `thinkingTruncated`: `boolean`; \}\> \| `null` |
|
|
1330
|
+
| `delta` | [`SessionProgressDelta`](#sessionprogressdelta) |
|
|
1331
|
+
|
|
1332
|
+
#### Returns
|
|
1333
|
+
|
|
1334
|
+
\| `Readonly`\<\{ `messageId`: `string`; `revision`: `number`; `text`: `string`;
|
|
1335
|
+
`thinking`: `string`; `textOffset`: `number`; `thinkingOffset`: `number`;
|
|
1336
|
+
`textTruncated`: `boolean`; `thinkingTruncated`: `boolean`; \}\> \| `null`
|
|
1337
|
+
|
|
1338
|
+
---
|
|
1339
|
+
|
|
1271
1340
|
### bindSessionExtension()
|
|
1272
1341
|
|
|
1273
1342
|
```ts
|
package/docs/api/cloudflare.md
CHANGED
|
@@ -405,6 +405,9 @@ type CloudflareShiitakeOptions = Readonly<{
|
|
|
405
405
|
instructions: InstructionSource;
|
|
406
406
|
tools?: readonly [] | CloudflareShiitakeTools;
|
|
407
407
|
storagePressure?: StoragePressureCheck;
|
|
408
|
+
admission?: Readonly<{
|
|
409
|
+
assertOpen: () => void;
|
|
410
|
+
}>;
|
|
408
411
|
compaction?: CompactionOptions;
|
|
409
412
|
extensions: ExtensionRosterV0;
|
|
410
413
|
initialize?: (agent) => Promise<void>;
|
|
@@ -424,6 +427,19 @@ Cloudflare host inputs; the model owner resolves one frozen run selection.
|
|
|
424
427
|
```ts
|
|
425
428
|
type CloudflareShiitake = ShiitakeOwnerAgent &
|
|
426
429
|
Readonly<{
|
|
430
|
+
busySync: () =>
|
|
431
|
+
| Readonly<{
|
|
432
|
+
kind: "session";
|
|
433
|
+
sessionId: string;
|
|
434
|
+
commandId: string;
|
|
435
|
+
}>
|
|
436
|
+
| Readonly<{
|
|
437
|
+
kind: "delegation";
|
|
438
|
+
agentId: string;
|
|
439
|
+
sessionId: string;
|
|
440
|
+
commandId: string;
|
|
441
|
+
}>
|
|
442
|
+
| undefined;
|
|
427
443
|
readSettlement: (
|
|
428
444
|
sessionId,
|
|
429
445
|
commandId,
|
package/docs/api/delegation.md
CHANGED
|
@@ -34,6 +34,26 @@ new AgentDelegation(deps): AgentDelegation;
|
|
|
34
34
|
|
|
35
35
|
#### Methods
|
|
36
36
|
|
|
37
|
+
##### refreshOutstanding()
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
refreshOutstanding(readSettlement): Promise<void>;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Best-effort remote refresh before an owner-local archive transaction. Confirmed
|
|
44
|
+
settlements are recorded by Shiitake; unreadable targets leave their local
|
|
45
|
+
accepted receipt outstanding for busySync to refuse.
|
|
46
|
+
|
|
47
|
+
###### Parameters
|
|
48
|
+
|
|
49
|
+
| Parameter | Type |
|
|
50
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `readSettlement` | (`agentId`, `sessionId`, `commandId`) => `Promise`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `delegator`: `string` \| `null`; `terminal`: [`SessionTerminal`](client.md#sessionterminal); `content`: `string`; `usage`: readonly `Pick`\<`AssistantMessage`, `"model"` \| `"provider"` \| `"usage"`\>[]; `toolCalls`: `number`; `waitingOnYou`: readonly `Readonly`\<\{ `itemId`: `string`; `kind`: `string`; `summary`: `string`; \}\>[]; \}\> \| `undefined`\> |
|
|
52
|
+
|
|
53
|
+
###### Returns
|
|
54
|
+
|
|
55
|
+
`Promise`\<`void`\>
|
|
56
|
+
|
|
37
57
|
##### settlement()
|
|
38
58
|
|
|
39
59
|
```ts
|
|
@@ -45,10 +65,16 @@ settlement(
|
|
|
45
65
|
): Promise<
|
|
46
66
|
| Readonly<{
|
|
47
67
|
acceptedSender: string | null;
|
|
68
|
+
delegator: string | null;
|
|
48
69
|
terminal: SessionTerminal;
|
|
49
70
|
content: string;
|
|
50
71
|
usage: readonly Pick<AssistantMessage, "model" | "provider" | "usage">[];
|
|
51
72
|
toolCalls: number;
|
|
73
|
+
waitingOnYou: readonly Readonly<{
|
|
74
|
+
itemId: string;
|
|
75
|
+
kind: string;
|
|
76
|
+
summary: string;
|
|
77
|
+
}>[];
|
|
52
78
|
}>
|
|
53
79
|
| undefined>;
|
|
54
80
|
```
|
|
@@ -66,10 +92,12 @@ Recipient-local disclosure through the public host, never another Agent's RPC.
|
|
|
66
92
|
|
|
67
93
|
###### Returns
|
|
68
94
|
|
|
69
|
-
`Promise`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `
|
|
70
|
-
[`SessionTerminal`](client.md#sessionterminal);
|
|
71
|
-
readonly `Pick`\<`AssistantMessage`, `"model"` \|
|
|
72
|
-
`toolCalls`: `number`;
|
|
95
|
+
`Promise`\< \| `Readonly`\<\{ `acceptedSender`: `string` \| `null`; `delegator`:
|
|
96
|
+
`string` \| `null`; `terminal`: [`SessionTerminal`](client.md#sessionterminal);
|
|
97
|
+
`content`: `string`; `usage`: readonly `Pick`\<`AssistantMessage`, `"model"` \|
|
|
98
|
+
`"provider"` \| `"usage"`\>[]; `toolCalls`: `number`; `waitingOnYou`: readonly
|
|
99
|
+
`Readonly`\<\{ `itemId`: `string`; `kind`: `string`; `summary`: `string`;
|
|
100
|
+
\}\>[]; \}\> \| `undefined`\>
|
|
73
101
|
|
|
74
102
|
##### send()
|
|
75
103
|
|
|
@@ -82,8 +110,8 @@ send(
|
|
|
82
110
|
): Promise<DelegationReceipt>;
|
|
83
111
|
```
|
|
84
112
|
|
|
85
|
-
Delegate work to an in-scope Agent
|
|
86
|
-
|
|
113
|
+
Delegate work to an in-scope Agent through fleet correspondence; a steer rides
|
|
114
|
+
the mail.
|
|
87
115
|
|
|
88
116
|
###### Parameters
|
|
89
117
|
|
|
@@ -366,6 +394,7 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
366
394
|
commandId: string;
|
|
367
395
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
368
396
|
diagnostic?: string;
|
|
397
|
+
waitingOnYou?: readonly object[];
|
|
369
398
|
}
|
|
370
399
|
| {
|
|
371
400
|
outcome: "accepted";
|
|
@@ -416,6 +445,7 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
416
445
|
commandId: string;
|
|
417
446
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
418
447
|
diagnostic?: string;
|
|
448
|
+
waitingOnYou?: readonly object[];
|
|
419
449
|
}
|
|
420
450
|
| {
|
|
421
451
|
outcome: "accepted";
|
|
@@ -466,6 +496,7 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
466
496
|
commandId: string;
|
|
467
497
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
468
498
|
diagnostic?: string;
|
|
499
|
+
waitingOnYou?: readonly object[];
|
|
469
500
|
}
|
|
470
501
|
| {
|
|
471
502
|
outcome: "accepted";
|
|
@@ -516,6 +547,7 @@ function agentMailRoute(namespace, replySettlement): PostRoute<AgentMailAddress,
|
|
|
516
547
|
commandId: string;
|
|
517
548
|
outcome: "completed" | "failed" | "cancelled" | "interrupted" | "outcome_unknown";
|
|
518
549
|
diagnostic?: string;
|
|
550
|
+
waitingOnYou?: readonly object[];
|
|
519
551
|
}
|
|
520
552
|
| {
|
|
521
553
|
outcome: "accepted";
|
|
@@ -595,7 +627,33 @@ retries.
|
|
|
595
627
|
`PostRoute`\<`AgentMailAddress`, \| \{ `from`: \{ `kind`: `"agent"`; `agentId`:
|
|
596
628
|
`string`; `sessionId`: `string`; \}; `reply?`: \| \{ `commandId`: `string`;
|
|
597
629
|
`outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \|
|
|
598
|
-
`"outcome_unknown"`; `diagnostic?`: `string`;
|
|
630
|
+
`"outcome_unknown"`; `diagnostic?`: `string`; `waitingOnYou?`: readonly
|
|
631
|
+
`object`[]; \} \| \{ `outcome`: `"accepted"`; `commandId`: `string`; \} \| \{
|
|
632
|
+
`outcome`: `"undeliverable"`; `reason`: `"recipient_left"`; \}; `key`: `string`;
|
|
633
|
+
`to`: \{ `kind`: `"agent"`; `agentId`: `string`; `sessionId?`: `string`; \};
|
|
634
|
+
`replyTo`: readonly `object`[]; `content`: `string`; `createdAt`: `number`;
|
|
635
|
+
`meta?`: Json \| undefined; \} \| \{ `from`: \{ `kind`: `"system"`; `systemId`:
|
|
636
|
+
`"hub"`; \}; `reply`: \{ `outcome`: `"undeliverable"`; `reason`:
|
|
637
|
+
`"recipient_offline"`; \}; `key`: `string`; `to`: \{ `kind`: `"agent"`;
|
|
638
|
+
`agentId`: `string`; `sessionId?`: `string`; \}; `replyTo`: readonly `object`[];
|
|
639
|
+
`content`: `string`; `createdAt`: `number`; `meta?`: Json \| undefined; \}, \|
|
|
640
|
+
\{ `from`: \{ `kind`: `"agent"`; `agentId`: `string`; `sessionId`: `string`; \};
|
|
641
|
+
`reply?`: \| \{ `commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \|
|
|
642
|
+
`"cancelled"` \| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`:
|
|
643
|
+
`string`; `waitingOnYou?`: readonly `object`[]; \} \| \{ `outcome`:
|
|
644
|
+
`"accepted"`; `commandId`: `string`; \} \| \{ `outcome`: `"undeliverable"`;
|
|
645
|
+
`reason`: `"recipient_left"`; \}; `key`: `string`; `to`: \{ `kind`: `"agent"`;
|
|
646
|
+
`agentId`: `string`; `sessionId?`: `string`; \}; `replyTo`: readonly `object`[];
|
|
647
|
+
`content`: `string`; `createdAt`: `number`; `meta?`: Json \| undefined; \} \| \{
|
|
648
|
+
`from`: \{ `kind`: `"system"`; `systemId`: `"hub"`; \}; `reply`: \{ `outcome`:
|
|
649
|
+
`"undeliverable"`; `reason`: `"recipient_offline"`; \}; `key`: `string`; `to`:
|
|
650
|
+
\{ `kind`: `"agent"`; `agentId`: `string`; `sessionId?`: `string`; \};
|
|
651
|
+
`replyTo`: readonly `object`[]; `content`: `string`; `createdAt`: `number`;
|
|
652
|
+
`meta?`: Json \| undefined; \}, `AgentMailAddress`, \| \{ `from`: \{ `kind`:
|
|
653
|
+
`"agent"`; `agentId`: `string`; `sessionId`: `string`; \}; `reply?`: \| \{
|
|
654
|
+
`commandId`: `string`; `outcome`: `"completed"` \| `"failed"` \| `"cancelled"`
|
|
655
|
+
\| `"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`;
|
|
656
|
+
`waitingOnYou?`: readonly `object`[]; \} \| \{ `outcome`: `"accepted"`;
|
|
599
657
|
`commandId`: `string`; \} \| \{ `outcome`: `"undeliverable"`; `reason`:
|
|
600
658
|
`"recipient_left"`; \}; `key`: `string`; `to`: \{ `kind`: `"agent"`; `agentId`:
|
|
601
659
|
`string`; `sessionId?`: `string`; \}; `replyTo`: readonly `object`[]; `content`:
|
|
@@ -607,50 +665,26 @@ retries.
|
|
|
607
665
|
`meta?`: Json \| undefined; \}, \| \{ `from`: \{ `kind`: `"agent"`; `agentId`:
|
|
608
666
|
`string`; `sessionId`: `string`; \}; `reply?`: \| \{ `commandId`: `string`;
|
|
609
667
|
`outcome`: `"completed"` \| `"failed"` \| `"cancelled"` \| `"interrupted"` \|
|
|
610
|
-
`"outcome_unknown"`; `diagnostic?`: `string`;
|
|
611
|
-
`
|
|
612
|
-
`"
|
|
613
|
-
`string`; `sessionId?`: `string`; \};
|
|
614
|
-
`string`; `createdAt`: `number`; `meta?`: Json \| undefined; \} \| \{ `from`: \{
|
|
615
|
-
`kind`: `"system"`; `systemId`: `"hub"`; \}; `reply`: \{ `outcome`:
|
|
616
|
-
`"undeliverable"`; `reason`: `"recipient_offline"`; \}; `key`: `string`; `to`:
|
|
617
|
-
\{ `kind`: `"agent"`; `agentId`: `string`; `sessionId?`: `string`; \};
|
|
668
|
+
`"outcome_unknown"`; `diagnostic?`: `string`; `waitingOnYou?`: readonly
|
|
669
|
+
`object`[]; \} \| \{ `outcome`: `"accepted"`; `commandId`: `string`; \} \| \{
|
|
670
|
+
`outcome`: `"undeliverable"`; `reason`: `"recipient_left"`; \}; `key`: `string`;
|
|
671
|
+
`to`: \{ `kind`: `"agent"`; `agentId`: `string`; `sessionId?`: `string`; \};
|
|
618
672
|
`replyTo`: readonly `object`[]; `content`: `string`; `createdAt`: `number`;
|
|
619
|
-
`meta?`: Json \| undefined; \}
|
|
620
|
-
`"
|
|
621
|
-
`
|
|
622
|
-
|
|
623
|
-
`
|
|
624
|
-
`
|
|
625
|
-
`
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
`
|
|
629
|
-
`
|
|
630
|
-
`string`;
|
|
631
|
-
`
|
|
632
|
-
`
|
|
633
|
-
`
|
|
634
|
-
`"interrupted"` \| `"outcome_unknown"`; `diagnostic?`: `string`; \} \| \{
|
|
635
|
-
`outcome`: `"accepted"`; `commandId`: `string`; \} \| \{ `outcome`:
|
|
636
|
-
`"undeliverable"`; `reason`: `"recipient_left"`; \}; `key`: `string`; `to`: \{
|
|
637
|
-
`kind`: `"agent"`; `agentId`: `string`; `sessionId?`: `string`; \}; `replyTo`:
|
|
638
|
-
readonly `object`[]; `content`: `string`; `createdAt`: `number`; `meta?`: Json
|
|
639
|
-
\| undefined; \} \| \{ `from`: \{ `kind`: `"system"`; `systemId`: `"hub"`; \};
|
|
640
|
-
`reply`: \{ `outcome`: `"undeliverable"`; `reason`: `"recipient_offline"`; \};
|
|
641
|
-
`key`: `string`; `to`: \{ `kind`: `"agent"`; `agentId`: `string`; `sessionId?`:
|
|
642
|
-
`string`; \}; `replyTo`: readonly `object`[]; `content`: `string`; `createdAt`:
|
|
643
|
-
`number`; `meta?`: Json \| undefined; \}\> & `Omit`\<`Readonly`\<\{
|
|
644
|
-
`addressKind`: `string`; `deadlineMs?`: `number`; `address`: `Codec`\<`unknown`,
|
|
645
|
-
`unknown`\>; `event`: `Codec`\<`unknown`, `unknown`\>; `encodeEnvelope`:
|
|
646
|
-
(`envelope`) => `object`; `parseDelivery`: (`envelope`) => `object`;
|
|
647
|
-
`prepareEnvelope?`: (`envelope`, `signal`) => `Promise`\<\{ `key`: `string`;
|
|
648
|
-
`kind`: `string`; `address`: `unknown`; `event`: `unknown`; \}\>;
|
|
649
|
-
`recordDelivered?`: (`envelope`) => `void`; `nameOf`: (`envelope`) => `string`;
|
|
650
|
-
`namespace`: `Readonly`\<\{ `getByName`: (`name`) => `Readonly`\<\{ `deliver`:
|
|
651
|
-
(`envelope`) => `Promise`\<...\>; \}\>; \}\>; `recordCursor?`: (`envelope`,
|
|
652
|
-
`cursor`) => `void`; `recordRefused?`: (`envelope`) => `void`; \}\>, `"event"`
|
|
653
|
-
\| `"address"`\>
|
|
673
|
+
`meta?`: Json \| undefined; \} \| \{ `from`: \{ `kind`: `"system"`; `systemId`:
|
|
674
|
+
`"hub"`; \}; `reply`: \{ `outcome`: `"undeliverable"`; `reason`:
|
|
675
|
+
`"recipient_offline"`; \}; `key`: `string`; `to`: \{ `kind`: `"agent"`;
|
|
676
|
+
`agentId`: `string`; `sessionId?`: `string`; \}; `replyTo`: readonly `object`[];
|
|
677
|
+
`content`: `string`; `createdAt`: `number`; `meta?`: Json \| undefined; \}\> &
|
|
678
|
+
`Omit`\<`Readonly`\<\{ `addressKind`: `string`; `deadlineMs?`: `number`;
|
|
679
|
+
`address`: `Codec`\<`unknown`, `unknown`\>; `event`: `Codec`\<`unknown`,
|
|
680
|
+
`unknown`\>; `encodeEnvelope`: (`envelope`) => `object`; `parseDelivery`:
|
|
681
|
+
(`envelope`) => `object`; `prepareEnvelope?`: (`envelope`, `signal`) =>
|
|
682
|
+
`Promise`\<\{ `key`: `string`; `kind`: `string`; `address`: `unknown`; `event`:
|
|
683
|
+
`unknown`; \}\>; `recordDelivered?`: (`envelope`) => `void`; `nameOf`:
|
|
684
|
+
(`envelope`) => `string`; `namespace`: `Readonly`\<\{ `getByName`: (`name`) =>
|
|
685
|
+
`Readonly`\<\{ `deliver`: (`envelope`) => `Promise`\<...\>; \}\>; \}\>;
|
|
686
|
+
`recordCursor?`: (`envelope`, `cursor`) => `void`; `recordRefused?`:
|
|
687
|
+
(`envelope`) => `void`; \}\>, `"event"` \| `"address"`\>
|
|
654
688
|
|
|
655
689
|
---
|
|
656
690
|
|
package/docs/api/effect.md
CHANGED
|
@@ -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`; `
|
|
521
|
-
[`SessionTerminal`](client.md#sessionterminal);
|
|
522
|
-
readonly `Pick`\<`AssistantMessage`, ... \| ... \|
|
|
523
|
-
`number`;
|
|
524
|
-
`
|
|
525
|
-
`
|
|
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)
|