@fungi.computer/shiitake 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +454 -2
  3. package/dist/agar-extension.d.ts +9 -0
  4. package/dist/agar-extension.js +38 -0
  5. package/dist/agent-control.d.ts +77 -0
  6. package/dist/agent-control.js +434 -0
  7. package/dist/client-entry.d.ts +211 -0
  8. package/dist/client-entry.js +101 -0
  9. package/dist/client-wire.d.ts +199 -0
  10. package/dist/client-wire.js +271 -0
  11. package/dist/client.d.ts +439 -0
  12. package/dist/client.js +4 -0
  13. package/dist/cloudflare.d.ts +220 -0
  14. package/dist/cloudflare.js +531 -0
  15. package/dist/effect.d.ts +42 -0
  16. package/dist/effect.js +20 -0
  17. package/dist/errors.d.ts +50 -0
  18. package/dist/errors.js +81 -0
  19. package/dist/extension-client.d.ts +38 -0
  20. package/dist/extension-client.js +56 -0
  21. package/dist/extension-contract.d.ts +73 -0
  22. package/dist/extension-contract.js +11 -0
  23. package/dist/extensions.d.ts +589 -0
  24. package/dist/extensions.js +263 -0
  25. package/dist/fleet.d.ts +313 -0
  26. package/dist/fleet.js +540 -0
  27. package/dist/hosted.d.ts +133 -0
  28. package/dist/hosted.js +265 -0
  29. package/dist/http-routes.d.ts +772 -0
  30. package/dist/http-routes.js +242 -0
  31. package/dist/http.d.ts +1 -0
  32. package/dist/http.js +1 -0
  33. package/dist/index.d.ts +35 -0
  34. package/dist/index.js +13 -0
  35. package/dist/internal/accepted-run-executor.d.ts +23 -0
  36. package/dist/internal/accepted-run-executor.js +129 -0
  37. package/dist/internal/admission-door.d.ts +75 -0
  38. package/dist/internal/admission-door.js +105 -0
  39. package/dist/internal/agent-close.d.ts +4 -0
  40. package/dist/internal/agent-close.js +42 -0
  41. package/dist/internal/browser-sessions.d.ts +31 -0
  42. package/dist/internal/browser-sessions.js +173 -0
  43. package/dist/internal/client-boundary.d.ts +262 -0
  44. package/dist/internal/client-boundary.js +202 -0
  45. package/dist/internal/compaction/compaction.d.ts +54 -0
  46. package/dist/internal/compaction/compaction.js +291 -0
  47. package/dist/internal/compaction/session-compaction.d.ts +69 -0
  48. package/dist/internal/compaction/session-compaction.js +330 -0
  49. package/dist/internal/compaction/settings.d.ts +11 -0
  50. package/dist/internal/compaction/settings.js +40 -0
  51. package/dist/internal/compaction/utils.d.ts +45 -0
  52. package/dist/internal/compaction/utils.js +319 -0
  53. package/dist/internal/contracts.d.ts +235 -0
  54. package/dist/internal/contracts.js +1 -0
  55. package/dist/internal/coordinator.d.ts +18 -0
  56. package/dist/internal/coordinator.js +362 -0
  57. package/dist/internal/document-codec.d.ts +11 -0
  58. package/dist/internal/document-codec.js +39 -0
  59. package/dist/internal/effect-client.d.ts +13 -0
  60. package/dist/internal/effect-client.js +102 -0
  61. package/dist/internal/effect-contracts.d.ts +236 -0
  62. package/dist/internal/effect-contracts.js +2 -0
  63. package/dist/internal/extension-command-registry.d.ts +11 -0
  64. package/dist/internal/extension-command-registry.js +29 -0
  65. package/dist/internal/extension-command-tools.d.ts +17 -0
  66. package/dist/internal/extension-command-tools.js +50 -0
  67. package/dist/internal/extension-context.d.ts +25 -0
  68. package/dist/internal/extension-context.js +35 -0
  69. package/dist/internal/extension-definitions.d.ts +5 -0
  70. package/dist/internal/extension-definitions.js +6 -0
  71. package/dist/internal/extension-hook.d.ts +25 -0
  72. package/dist/internal/extension-hook.js +46 -0
  73. package/dist/internal/extension-roster.d.ts +23 -0
  74. package/dist/internal/extension-roster.js +228 -0
  75. package/dist/internal/extension-runtime.d.ts +63 -0
  76. package/dist/internal/extension-runtime.js +1004 -0
  77. package/dist/internal/failure.d.ts +2 -0
  78. package/dist/internal/failure.js +9 -0
  79. package/dist/internal/host-meta.d.ts +41 -0
  80. package/dist/internal/host-meta.js +39 -0
  81. package/dist/internal/json-value.d.ts +4 -0
  82. package/dist/internal/json-value.js +3 -0
  83. package/dist/internal/model-acquisition.d.ts +21 -0
  84. package/dist/internal/model-acquisition.js +98 -0
  85. package/dist/internal/model-preference.d.ts +21 -0
  86. package/dist/internal/model-preference.js +20 -0
  87. package/dist/internal/observation-kernel.d.ts +28 -0
  88. package/dist/internal/observation-kernel.js +169 -0
  89. package/dist/internal/promise-facade.d.ts +18 -0
  90. package/dist/internal/promise-facade.js +172 -0
  91. package/dist/internal/run-scope.d.ts +27 -0
  92. package/dist/internal/run-scope.js +214 -0
  93. package/dist/internal/runtime-coordinator.d.ts +34 -0
  94. package/dist/internal/runtime-coordinator.js +233 -0
  95. package/dist/internal/runtime-core.d.ts +19 -0
  96. package/dist/internal/runtime-core.js +39 -0
  97. package/dist/internal/runtime-reconciliation.d.ts +18 -0
  98. package/dist/internal/runtime-reconciliation.js +162 -0
  99. package/dist/internal/session-context.d.ts +11 -0
  100. package/dist/internal/session-context.js +67 -0
  101. package/dist/internal/session-status.d.ts +10 -0
  102. package/dist/internal/session-status.js +52 -0
  103. package/dist/internal/woodstock/agent-reply.d.ts +25 -0
  104. package/dist/internal/woodstock/agent-reply.js +67 -0
  105. package/dist/internal/woodstock/client-projection.d.ts +29 -0
  106. package/dist/internal/woodstock/client-projection.js +512 -0
  107. package/dist/internal/woodstock/compaction-activity.d.ts +17 -0
  108. package/dist/internal/woodstock/compaction-activity.js +32 -0
  109. package/dist/internal/woodstock/cursor.d.ts +9 -0
  110. package/dist/internal/woodstock/cursor.js +44 -0
  111. package/dist/internal/woodstock/extension-store.d.ts +72 -0
  112. package/dist/internal/woodstock/extension-store.js +262 -0
  113. package/dist/internal/woodstock/fleet-store.d.ts +36 -0
  114. package/dist/internal/woodstock/fleet-store.js +100 -0
  115. package/dist/internal/woodstock/identities.d.ts +6 -0
  116. package/dist/internal/woodstock/identities.js +11 -0
  117. package/dist/internal/woodstock/index.d.ts +170 -0
  118. package/dist/internal/woodstock/index.js +546 -0
  119. package/dist/internal/woodstock/progress.d.ts +32 -0
  120. package/dist/internal/woodstock/progress.js +89 -0
  121. package/dist/internal/woodstock/run-recovery.d.ts +8 -0
  122. package/dist/internal/woodstock/run-recovery.js +95 -0
  123. package/dist/internal/woodstock/session-attention.d.ts +16 -0
  124. package/dist/internal/woodstock/session-attention.js +88 -0
  125. package/dist/internal/woodstock/session-documents.d.ts +18 -0
  126. package/dist/internal/woodstock/session-documents.js +51 -0
  127. package/dist/internal/woodstock/session-entry.d.ts +478 -0
  128. package/dist/internal/woodstock/session-entry.js +484 -0
  129. package/dist/internal/woodstock/session-grants.d.ts +24 -0
  130. package/dist/internal/woodstock/session-grants.js +84 -0
  131. package/dist/internal/woodstock/session-inbox.d.ts +56 -0
  132. package/dist/internal/woodstock/session-inbox.js +307 -0
  133. package/dist/internal/woodstock/session-store.d.ts +432 -0
  134. package/dist/internal/woodstock/session-store.js +2006 -0
  135. package/dist/internal/woodstock/storage-admission.d.ts +14 -0
  136. package/dist/internal/woodstock/storage-admission.js +44 -0
  137. package/dist/model-preference.d.ts +20 -0
  138. package/dist/model-preference.js +30 -0
  139. package/dist/node.d.ts +64 -0
  140. package/dist/node.js +256 -0
  141. package/dist/remote-client.d.ts +11 -0
  142. package/dist/remote-client.js +298 -0
  143. package/dist/session-attention.d.ts +35 -0
  144. package/dist/session-attention.js +22 -0
  145. package/dist/session-documents.d.ts +28 -0
  146. package/dist/session-documents.js +1 -0
  147. package/dist/testing.d.ts +54 -0
  148. package/dist/testing.js +215 -0
  149. package/docs/api/README.md +26 -0
  150. package/docs/api/agar-extension.md +40 -0
  151. package/docs/api/agent-control.md +151 -0
  152. package/docs/api/client-entry.md +344 -0
  153. package/docs/api/client.md +1112 -0
  154. package/docs/api/cloudflare.md +500 -0
  155. package/docs/api/effect.md +884 -0
  156. package/docs/api/extensions.md +2003 -0
  157. package/docs/api/fleet.md +734 -0
  158. package/docs/api/hosted.md +382 -0
  159. package/docs/api/http.md +111 -0
  160. package/docs/api/index.md +1116 -0
  161. package/docs/api/model-preference.md +151 -0
  162. package/docs/api/node.md +142 -0
  163. package/docs/api/testing.md +250 -0
  164. package/package.json +130 -3
@@ -0,0 +1,734 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/shiitake**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/shiitake](README.md) / fleet
8
+
9
+ # fleet
10
+
11
+ ## Classes
12
+
13
+ ### AgentGrantError
14
+
15
+ Refusal of supplied authority; no host policy lookup is performed.
16
+
17
+ #### Extends
18
+
19
+ - `Error`
20
+
21
+ #### Constructors
22
+
23
+ ##### Constructor
24
+
25
+ ```ts
26
+ new AgentGrantError(reason): AgentGrantError;
27
+ ```
28
+
29
+ ###### Parameters
30
+
31
+ | Parameter | Type |
32
+ | --------- | ------------------------------------------------------------------------------------- |
33
+ | `reason` | `"agent"` \| `"action"` \| `"expired"` \| `"delegation_loop"` \| `"delegation_depth"` |
34
+
35
+ ###### Returns
36
+
37
+ [`AgentGrantError`](#agentgranterror)
38
+
39
+ ###### Overrides
40
+
41
+ ```ts
42
+ Error.constructor;
43
+ ```
44
+
45
+ #### Properties
46
+
47
+ ##### reason
48
+
49
+ ```ts
50
+ readonly reason: "agent" | "action" | "expired" | "delegation_loop" | "delegation_depth";
51
+ ```
52
+
53
+ ---
54
+
55
+ ### DirectoryError
56
+
57
+ Directory input, replay or storage refusal.
58
+
59
+ #### Extends
60
+
61
+ - `Error`
62
+
63
+ #### Constructors
64
+
65
+ ##### Constructor
66
+
67
+ ```ts
68
+ new DirectoryError(status, code): DirectoryError;
69
+ ```
70
+
71
+ ###### Parameters
72
+
73
+ | Parameter | Type |
74
+ | --------- | --------------------------------------------------------------------------------------------------------------------------------- |
75
+ | `status` | `400` \| `403` \| `404` \| `409` \| `503` |
76
+ | `code` | \| `"not_found"` \| `"invalid_input"` \| `"name_taken"` \| `"request_conflict"` \| `"computer_team_conflict"` \| `"partial_init"` |
77
+
78
+ ###### Returns
79
+
80
+ [`DirectoryError`](#directoryerror)
81
+
82
+ ###### Overrides
83
+
84
+ ```ts
85
+ Error.constructor;
86
+ ```
87
+
88
+ #### Properties
89
+
90
+ ##### status
91
+
92
+ ```ts
93
+ readonly status: 400 | 403 | 404 | 409 | 503;
94
+ ```
95
+
96
+ ##### code
97
+
98
+ ```ts
99
+ readonly code:
100
+ | "not_found"
101
+ | "invalid_input"
102
+ | "name_taken"
103
+ | "request_conflict"
104
+ | "computer_team_conflict"
105
+ | "partial_init";
106
+ ```
107
+
108
+ ## Type Aliases
109
+
110
+ ### AgentAction
111
+
112
+ ```ts
113
+ type AgentAction = z.infer<typeof agentActionSchema>;
114
+ ```
115
+
116
+ One host-admitted fleet operation.
117
+
118
+ ---
119
+
120
+ ### AgentGrant
121
+
122
+ ```ts
123
+ type AgentGrant = z.infer<typeof agentGrantSchema>;
124
+ ```
125
+
126
+ A trusted host's bounded, addressed authority for fleet operations.
127
+
128
+ ---
129
+
130
+ ### AgentLifecycleFact
131
+
132
+ ```ts
133
+ type AgentLifecycleFact = Readonly<{
134
+ kind: "created" | "deleted";
135
+ agentId: string;
136
+ provenance: AgentGrant["provenance"];
137
+ }>;
138
+ ```
139
+
140
+ A committed directory transition, returned in the host's transaction.
141
+
142
+ ---
143
+
144
+ ### AgentId
145
+
146
+ ```ts
147
+ type AgentId = CairnId<"agent", "agent">;
148
+ ```
149
+
150
+ An ordinary Agent directory identity.
151
+
152
+ ---
153
+
154
+ ### AgentCreation
155
+
156
+ ```ts
157
+ type AgentCreation = z.infer<typeof agentCreationSchema>;
158
+ ```
159
+
160
+ One idempotent directory reservation.
161
+
162
+ ---
163
+
164
+ ### AgentRename
165
+
166
+ ```ts
167
+ type AgentRename = z.infer<typeof agentRenameSchema>;
168
+ ```
169
+
170
+ Input to [createAgentDirectory](#createagentdirectory)'s `rename`.
171
+
172
+ ---
173
+
174
+ ### DirectoryAgent
175
+
176
+ ```ts
177
+ type DirectoryAgent = Readonly<{
178
+ agentId: AgentId;
179
+ name: string;
180
+ createdAt: number;
181
+ updatedAt: number;
182
+ }>;
183
+ ```
184
+
185
+ One durable Agent directory record.
186
+
187
+ ---
188
+
189
+ ### AgentDelegationTask
190
+
191
+ ```ts
192
+ type AgentDelegationTask = z.infer<typeof agentDelegationTaskSchema>;
193
+ ```
194
+
195
+ A caller reuses this task unchanged while polling Pending.
196
+
197
+ ---
198
+
199
+ ### AgentDelegationOutcome
200
+
201
+ ```ts
202
+ type AgentDelegationOutcome = Readonly<{
203
+ kind: "settled";
204
+ agentId: string;
205
+ sessionId: string;
206
+ }> &
207
+ CommandSettlement;
208
+ ```
209
+
210
+ Exact settled Session facts, including Pi usage and tool-call records.
211
+
212
+ ---
213
+
214
+ ### FleetDelegationOptions
215
+
216
+ ```ts
217
+ type FleetDelegationOptions = Readonly<{
218
+ storage: WatchdogSqliteOwner;
219
+ deliver: (mail) => Promise<Accepted>;
220
+ readSettlement: (
221
+ agentId,
222
+ sessionId,
223
+ commandId,
224
+ ) => Promise<CommandSettlement | undefined>;
225
+ open: (agentId) => Promise<
226
+ Readonly<{
227
+ agent: ShiitakeAgent;
228
+ release: () => Promise<void>;
229
+ }>
230
+ >;
231
+ }>;
232
+ ```
233
+
234
+ Ordinary runtime and mail transports; these ports do not decide host policy.
235
+
236
+ ---
237
+
238
+ ### AuthenticatedDelegationReply
239
+
240
+ ```ts
241
+ type AuthenticatedDelegationReply = Readonly<{
242
+ ancestors: readonly string[];
243
+ maxDepth: number;
244
+ reply: VerifiedAgentReply;
245
+ }>;
246
+ ```
247
+
248
+ The delegation meta the host attaches to an authenticated reply: the caller's
249
+ own path plus the verified reply, whose `agentId` is the reply's author.
250
+
251
+ ---
252
+
253
+ ### DelegationSendMeta
254
+
255
+ ```ts
256
+ type DelegationSendMeta = object;
257
+ ```
258
+
259
+ The host metadata a delegated send carries, as JSON.
260
+
261
+ #### Properties
262
+
263
+ ##### author
264
+
265
+ ```ts
266
+ author: FungiAuthor;
267
+ ```
268
+
269
+ ##### delegation?
270
+
271
+ ```ts
272
+ optional delegation?: object;
273
+ ```
274
+
275
+ ###### ancestors
276
+
277
+ ```ts
278
+ ancestors: string[];
279
+ ```
280
+
281
+ ###### maxDepth
282
+
283
+ ```ts
284
+ maxDepth: number;
285
+ ```
286
+
287
+ ---
288
+
289
+ ### DelegationReplyMeta
290
+
291
+ ```ts
292
+ type DelegationReplyMeta = Readonly<{
293
+ author: FungiAuthor;
294
+ delegation: Readonly<{
295
+ ancestors: readonly string[];
296
+ maxDepth: number;
297
+ reply: VerifiedAgentReply;
298
+ }>;
299
+ }>;
300
+ ```
301
+
302
+ The host metadata on one authenticated reply line, as JSON.
303
+
304
+ ---
305
+
306
+ ### FleetRecipient
307
+
308
+ ```ts
309
+ type FleetRecipient = Readonly<{
310
+ agentId: string;
311
+ sessionId: string;
312
+ sentAt: number;
313
+ }>;
314
+ ```
315
+
316
+ One Agent a Session sent work to: its latest addressed conversation.
317
+
318
+ ---
319
+
320
+ ### FleetRecipients
321
+
322
+ ```ts
323
+ type FleetRecipients = Readonly<{
324
+ recipients: readonly FleetRecipient[];
325
+ more: number;
326
+ }>;
327
+ ```
328
+
329
+ A bounded page of recipients and how many more exist past it.
330
+
331
+ ---
332
+
333
+ ### FleetAgentAccess
334
+
335
+ ```ts
336
+ type FleetAgentAccess = (
337
+ agentId,
338
+ meta?,
339
+ ) => Promise<
340
+ Readonly<{
341
+ agent: ShiitakeAgent;
342
+ release: () => Promise<void>;
343
+ }>
344
+ >;
345
+ ```
346
+
347
+ Acquire ordinary Session access; an in-process host applies meta with withMeta.
348
+
349
+ #### Parameters
350
+
351
+ | Parameter | Type |
352
+ | --------- | ---------------------------- |
353
+ | `agentId` | `string` |
354
+ | `meta?` | [`Json`](extensions.md#json) |
355
+
356
+ #### Returns
357
+
358
+ `Promise`\<`Readonly`\<\{ `agent`: [`ShiitakeAgent`](client.md#shiitakeagent);
359
+ `release`: () => `Promise`\<`void`\>; \}\>\>
360
+
361
+ ---
362
+
363
+ ### FleetMessage
364
+
365
+ ```ts
366
+ type FleetMessage = Readonly<{
367
+ requestId: string;
368
+ text: string;
369
+ delivery?: "steer" | "followUp";
370
+ }>;
371
+ ```
372
+
373
+ One idempotent prompt, using the Session owner's existing delivery grammar.
374
+
375
+ ## Variables
376
+
377
+ ### agentActionSchema
378
+
379
+ ```ts
380
+ const agentActionSchema: ZodEnum<{
381
+ send: "send";
382
+ read: "read";
383
+ create: "create";
384
+ manage: "manage";
385
+ delegate: "delegate";
386
+ }>;
387
+ ```
388
+
389
+ Operations explicitly admitted by the host.
390
+
391
+ ---
392
+
393
+ ### agentProvenanceSchema
394
+
395
+ ```ts
396
+ const agentProvenanceSchema: ZodObject<
397
+ {
398
+ actor: ZodString;
399
+ workflowRunId: ZodOptional<ZodString>;
400
+ toolCallInputDigest: ZodOptional<ZodString>;
401
+ session: ZodOptional<
402
+ ZodObject<
403
+ {
404
+ agentId: ZodString;
405
+ sessionId: ZodString;
406
+ },
407
+ $strict
408
+ >
409
+ >;
410
+ },
411
+ $strict
412
+ >;
413
+ ```
414
+
415
+ Attribution supplied by the admitting host, without Team semantics.
416
+
417
+ ---
418
+
419
+ ### agentGrantSchema
420
+
421
+ ```ts
422
+ const agentGrantSchema: ZodObject<
423
+ {
424
+ agents: ZodUnion<readonly [ZodLiteral<"all">, ZodArray<ZodString>]>;
425
+ actions: ZodArray<
426
+ ZodEnum<{
427
+ send: "send";
428
+ read: "read";
429
+ create: "create";
430
+ manage: "manage";
431
+ delegate: "delegate";
432
+ }>
433
+ >;
434
+ expiresAt: ZodNumber;
435
+ provenance: ZodObject<
436
+ {
437
+ actor: ZodString;
438
+ workflowRunId: ZodOptional<ZodString>;
439
+ toolCallInputDigest: ZodOptional<ZodString>;
440
+ session: ZodOptional<
441
+ ZodObject<
442
+ {
443
+ agentId: ZodString;
444
+ sessionId: ZodString;
445
+ },
446
+ $strict
447
+ >
448
+ >;
449
+ },
450
+ $strict
451
+ >;
452
+ meta: ZodOptional<ZodJSONSchema>;
453
+ maxDepth: ZodOptional<ZodNumber>;
454
+ },
455
+ $strict
456
+ >;
457
+ ```
458
+
459
+ Fleet authority is supplied, never looked up in host policy.
460
+
461
+ ---
462
+
463
+ ### agentIds
464
+
465
+ ```ts
466
+ const agentIds: Readonly<{
467
+ agent: IdCodec<"agent", "agent", 1>;
468
+ }>;
469
+ ```
470
+
471
+ Stable Agent identities, retained across host compositions.
472
+
473
+ ---
474
+
475
+ ### agentCreationSchema
476
+
477
+ ```ts
478
+ const agentCreationSchema: ZodObject<
479
+ {
480
+ name: ZodString;
481
+ requestId: ZodString;
482
+ configuration: ZodString;
483
+ },
484
+ $strict
485
+ >;
486
+ ```
487
+
488
+ Stable replay input; configuration is an opaque host creation choice.
489
+
490
+ ---
491
+
492
+ ### agentRenameSchema
493
+
494
+ ```ts
495
+ const agentRenameSchema: ZodObject<
496
+ {
497
+ name: ZodString;
498
+ },
499
+ $strict
500
+ >;
501
+ ```
502
+
503
+ Owner-only rename input: an Agent's new display name.
504
+
505
+ ---
506
+
507
+ ### agentDelegationTaskSchema
508
+
509
+ ```ts
510
+ const agentDelegationTaskSchema: ZodObject<
511
+ {
512
+ requestId: ZodString;
513
+ agentId: ZodString;
514
+ sessionId: ZodOptional<ZodString>;
515
+ text: ZodString;
516
+ },
517
+ $strict
518
+ >;
519
+ ```
520
+
521
+ Replay identity and work, with the parent supplied exclusively by the grant.
522
+
523
+ ---
524
+
525
+ ### commandSettlementSchema
526
+
527
+ ```ts
528
+ const commandSettlementSchema: Schema.Codec<CommandSettlement>;
529
+ ```
530
+
531
+ Exact host facts encoded over internal transports, without transcript content.
532
+
533
+ ## Functions
534
+
535
+ ### assertAgentGrant()
536
+
537
+ ```ts
538
+ function assertAgentGrant(grant, action, agentId?): void;
539
+ ```
540
+
541
+ Check every operation against its explicit authority.
542
+
543
+ #### Parameters
544
+
545
+ | Parameter | Type | Description |
546
+ | --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
547
+ | `grant` | \{ `agents`: `string`[] \| `"all"`; `actions`: (`"send"` \| `"read"` \| `"create"` \| `"manage"` \| `"delegate"`)[]; `expiresAt`: `number`; `provenance`: \{ `actor`: `string`; `workflowRunId?`: `string`; `toolCallInputDigest?`: `string`; `session?`: \{ `agentId`: `string`; `sessionId`: `string`; \}; \}; `meta?`: `JSONType`; `maxDepth?`: `number`; \} | - |
548
+ | `grant.agents` | `string`[] \| `"all"` | - |
549
+ | `grant.actions` | (`"send"` \| `"read"` \| `"create"` \| `"manage"` \| `"delegate"`)[] | - |
550
+ | `grant.expiresAt?` | `number` | - |
551
+ | `grant.provenance?` | \{ `actor`: `string`; `workflowRunId?`: `string`; `toolCallInputDigest?`: `string`; `session?`: \{ `agentId`: `string`; `sessionId`: `string`; \}; \} | - |
552
+ | `grant.provenance.actor?` | `string` | - |
553
+ | `grant.provenance.workflowRunId?` | `string` | - |
554
+ | `grant.provenance.toolCallInputDigest?` | `string` | Host fingerprint of the enclosing model program, frozen with replay input. |
555
+ | `grant.provenance.session?` | \{ `agentId`: `string`; `sessionId`: `string`; \} | - |
556
+ | `grant.provenance.session.agentId?` | `string` | - |
557
+ | `grant.provenance.session.sessionId?` | `string` | - |
558
+ | `grant.meta?` | `JSONType` | - |
559
+ | `grant.maxDepth?` | `number` | Delegation abuse bound; inherited paths may only narrow it. |
560
+ | `action?` | `"send"` \| `"read"` \| `"create"` \| `"manage"` \| `"delegate"` | - |
561
+ | `agentId?` | `string` | - |
562
+
563
+ #### Returns
564
+
565
+ `void`
566
+
567
+ ---
568
+
569
+ ### createAgentDirectory()
570
+
571
+ ```ts
572
+ function createAgentDirectory(sql): object;
573
+ ```
574
+
575
+ Agent identities, replay receipts and erasure roster. Mutations belong inside
576
+ the caller's storage transaction, so lifecycle facts and host projections commit
577
+ together. Physical table names retain the existing Hub store layout.
578
+
579
+ #### Parameters
580
+
581
+ | Parameter | Type |
582
+ | --------- | ----------------------------------------------------------------------------------- |
583
+ | `sql` | `Readonly`\<\{ `exec`: (`statement`, ...`bindings`) => `WatchdogSqliteCursor`; \}\> |
584
+
585
+ #### Returns
586
+
587
+ | Name | Type | Default value | Description |
588
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
589
+ | `readCreation()` | (`grant`, `raw`) => \| `Readonly`\<\{ `agentId`: [`AgentId`](#agentid); `name`: `string`; `createdAt`: `number`; `updatedAt`: `number`; \}\> \| `null` | - | Resolve a matching creation receipt before host admission of a new reservation. |
590
+ | `create()` | (`grant`, `raw`) => \| \{ `agent`: `Readonly`\<\{ `agentId`: [`AgentId`](#agentid); `name`: `string`; `createdAt`: `number`; `updatedAt`: `number`; \}\>; `fact`: `null`; \} \| \{ `agent`: `Readonly`\<\{ `agentId`: [`AgentId`](#agentid); `name`: `string`; `createdAt`: `number`; `updatedAt`: `number`; \}\>; `fact`: \{ `kind`: `"created"`; `agentId`: `CairnId`\<`"agent"`, `"agent"`, `1`\>; `provenance`: \{ `actor`: `string`; `workflowRunId?`: `string`; `toolCallInputDigest?`: `string`; `session?`: \{ `agentId`: `string`; `sessionId`: `string`; \}; \}; \}; \} | - | Reserve an Agent once and return its committed lifecycle fact. |
591
+ | `read()` | (`grant`, `agentId`) => \| `Readonly`\<\{ `agentId`: [`AgentId`](#agentid); `name`: `string`; `createdAt`: `number`; `updatedAt`: `number`; \}\> \| `null` | - | Read one admitted Agent identity. |
592
+ | `list()` | (`grant`) => readonly `Readonly`\<\{ `agentId`: [`AgentId`](#agentid); `name`: `string`; `createdAt`: `number`; `updatedAt`: `number`; \}\>[] | - | List only identities covered by the supplied grant. |
593
+ | `remove()` | (`grant`, `agentId`) => \| `Readonly`\<\{ `kind`: `"deleted"` \| `"created"`; `agentId`: `string`; `provenance`: \{ `actor`: `string`; `workflowRunId?`: `string`; `toolCallInputDigest?`: `string`; `session?`: \{ `agentId`: `string`; `sessionId`: `string`; \}; \}; \}\> \| `null` | - | Remove an identity while retaining its erasure address. |
594
+ | `rename()` | (`grant`, `agentId`, `raw`) => [`DirectoryAgent`](#directoryagent) | - | Rename an existing Agent; refuses a name already held by another one. Owner-only rename; refuses a name already held by another Agent. |
595
+ | `readCreator()` | (`grant`, `agentId`) => `string` \| `null` | - | Read the host actor recorded at creation. The user who created an Agent; that user's own credentials follow it. |
596
+ | `listErasureIds()` | () => readonly `string`[] | `store.listErasureIds` | Enumerate retained addresses for host erasure. |
597
+ | `erasureRosterComplete()` | () => `boolean` | `store.erasureRosterComplete` | Whether the retained erasure roster covers this store. |
598
+
599
+ ---
600
+
601
+ ### delegationProvenance()
602
+
603
+ ```ts
604
+ function delegationProvenance(
605
+ session,
606
+ toolCallCode?,
607
+ ): Promise<{
608
+ actor: string;
609
+ workflowRunId?: string;
610
+ toolCallInputDigest?: string;
611
+ session?: {
612
+ agentId: string;
613
+ sessionId: string;
614
+ };
615
+ }>;
616
+ ```
617
+
618
+ Provenance for one delegated send from the invoking Agent's Session. The model
619
+ program's digest is frozen with the replay input, so a retried tool call that
620
+ changed its code conflicts instead of replaying.
621
+
622
+ #### Parameters
623
+
624
+ | Parameter | Type |
625
+ | --------------- | --------------------------------------------------------------- |
626
+ | `session` | `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; \}\> |
627
+ | `toolCallCode?` | `string` |
628
+
629
+ #### Returns
630
+
631
+ `Promise`\<\{ `actor`: `string`; `workflowRunId?`: `string`;
632
+ `toolCallInputDigest?`: `string`; `session?`: \{ `agentId`: `string`;
633
+ `sessionId`: `string`; \}; \}\>
634
+
635
+ ---
636
+
637
+ ### delegationSendMeta()
638
+
639
+ ```ts
640
+ function delegationSendMeta(sender, invocationMeta?): DelegationSendMeta;
641
+ ```
642
+
643
+ The host metadata one delegated send carries: the sending Agent as author and
644
+ only the path inherited from the invoking line. A reply's verified facts stay on
645
+ that reply's own line and never travel onward.
646
+
647
+ #### Parameters
648
+
649
+ | Parameter | Type |
650
+ | ----------------- | --------------------------------------- |
651
+ | `sender` | \{ `id`: `string`; `name`: `string`; \} |
652
+ | `sender.id` | `string` |
653
+ | `sender.name?` | `string` |
654
+ | `invocationMeta?` | [`Json`](extensions.md#json) |
655
+
656
+ #### Returns
657
+
658
+ [`DelegationSendMeta`](#delegationsendmeta)
659
+
660
+ ---
661
+
662
+ ### delegationReplyMeta()
663
+
664
+ ```ts
665
+ function delegationReplyMeta(delegation, replierName): DelegationReplyMeta;
666
+ ```
667
+
668
+ The host metadata for one authenticated reply line: the replying Agent is its
669
+ author, and the verified reply rides beside the caller's own path.
670
+
671
+ #### Parameters
672
+
673
+ | Parameter | Type |
674
+ | ------------- | --------------------------------------------------------------- |
675
+ | `delegation` | [`AuthenticatedDelegationReply`](#authenticateddelegationreply) |
676
+ | `replierName` | `string` |
677
+
678
+ #### Returns
679
+
680
+ [`DelegationReplyMeta`](#delegationreplymeta)
681
+
682
+ ---
683
+
684
+ ### createFleetDelegation()
685
+
686
+ ```ts
687
+ function createFleetDelegation(options): object;
688
+ ```
689
+
690
+ Hosted BirdDog submission and Pending observation. The durable row freezes
691
+ correspondence before transport; an ambiguous delivery reuses that exact mail.
692
+ Shiitake owns work deduplication, execution and settlement; Post owns replies.
693
+
694
+ #### Parameters
695
+
696
+ | Parameter | Type |
697
+ | --------- | --------------------------------------------------- |
698
+ | `options` | [`FleetDelegationOptions`](#fleetdelegationoptions) |
699
+
700
+ #### Returns
701
+
702
+ | Name | Type | Description |
703
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
704
+ | `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` | Authenticate a reply against its frozen mail and restore the caller's 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. |
705
+ | `recipients()` | (`parent`, `limit`) => [`FleetRecipients`](#fleetrecipients) | One grouped read of the Agents a parent Session sent work to. The distinct Agents one parent Session sent work to, newest send first, with how many more exist past `limit`. Read-only over the frozen mail. |
706
+ | `start()` | (`grant`, `raw`) => `Promise`\<`Readonly`\<\{ `status`: `"accepted"`; `commandId`: `string`; \}\>\> | Submit once and return the existing Shiitake admission receipt. |
707
+ | `delegate()` | (`grant`, `task`) => `Promise`\< \| `Readonly`\<\{ `kind`: `"pending"`; `retryAfterMs`: `number`; \}\> \| [`AgentDelegationOutcome`](#agentdelegationoutcome)\> | Submit or poll the exact turn, yielding Agar Pending until settled. |
708
+
709
+ ---
710
+
711
+ ### createFleetSessions()
712
+
713
+ ```ts
714
+ function createFleetSessions(open): object;
715
+ ```
716
+
717
+ Addressed Session operations over the existing Shiitake client. Each operation
718
+ checks a fresh supplied grant and releases its transport without stopping work.
719
+
720
+ #### Parameters
721
+
722
+ | Parameter | Type |
723
+ | --------- | --------------------------------------- |
724
+ | `open` | [`FleetAgentAccess`](#fleetagentaccess) |
725
+
726
+ #### Returns
727
+
728
+ | Name | Type | Description |
729
+ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
730
+ | `list()` | (`grant`, `agentId`, `after?`) => `Promise`\<`Readonly`\<\{ `sessions`: readonly [`SessionSummaryRow`](client.md#sessionsummaryrow)[]; `next`: `string` \| `undefined`; \}\>\> | Enumerate existing Sessions through the owner's bounded cursor. |
731
+ | `read()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`Readonly`\<\{ `sessionId`: `string`; `cursor`: `string` \| `null`; `hasMore`: `boolean`; `oldestCursor?`: `string` \| `null`; `messages`: readonly `Readonly`\<\{ `meta?`: [`Json`](extensions.md#json); `origin?`: `Readonly`\<\{ `extensionId`: ...; `correlation`: ...; \}\>; `id`: `string`; `sequence`: `number`; `commandId`: `string` \| `null`; `value`: `Message`; \}\>[]; `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"`; `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`; `extensions`: [`SessionExtensionSlots`](client.md#sessionextensionslots); `attention`: readonly `object`[]; `context?`: `Readonly`\<\{ `tokens`: `number`; `window`: `number` \| `null`; \}\>; \}\>\> | Open the exact saved conversation without creating work. |
732
+ | `create()` | (`grant`, `agentId`, `requestId`) => `Promise`\<`string`\> | Create a Session once under the caller's replay identity. |
733
+ | `remove()` | (`grant`, `agentId`, `sessionId`) => `Promise`\<`boolean`\> | Remove a Session through its runtime owner. |
734
+ | `send()` | (`grant`, `agentId`, `sessionId`, `message`) => `Promise`\<\{ `status`: `"accepted"`; `commandId`: `string`; `sessionId`: `string`; \}\> | Send once; an omitted Session is created under the same replay identity. |