@fungi.computer/shiitake 0.0.0-stage → 0.0.1

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 +72 -0
  6. package/dist/agent-control.js +431 -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 +297 -0
  26. package/dist/fleet.js +515 -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 +292 -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 +32 -0
  114. package/dist/internal/woodstock/fleet-store.js +93 -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 +904 -0
  156. package/docs/api/extensions.md +2003 -0
  157. package/docs/api/fleet.md +706 -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,1116 @@
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) / index
8
+
9
+ # index
10
+
11
+ ## Classes
12
+
13
+ ### ShiitakeError
14
+
15
+ Sanitized failure from a parsed Shiitake boundary.
16
+
17
+ #### Extends
18
+
19
+ - `Error`
20
+
21
+ #### Constructors
22
+
23
+ ##### Constructor
24
+
25
+ ```ts
26
+ new ShiitakeError(
27
+ boundary,
28
+ category,
29
+ message,
30
+ requestId?,
31
+ cause?
32
+ ): ShiitakeError;
33
+ ```
34
+
35
+ Construct a sanitized boundary failure.
36
+
37
+ ###### Parameters
38
+
39
+ | Parameter | Type | Description |
40
+ | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
41
+ | `boundary` | \| `"contract"` \| `"extensions"` \| `"instructions"` \| `"model"` \| `"runtime"` \| `"store"` \| `"tools"` | Boundary that rejected the operation. |
42
+ | `category` | \| `"closed"` \| `"conflict"` \| `"incompatible"` \| `"invalid"` \| `"rejected"` \| `"unavailable"` \| `"storage_pressure"` \| `"context_too_large"` | Safe category describing why it was rejected. |
43
+ | `message` | `string` | Human-readable message safe for callers to display. |
44
+ | `requestId?` | `string` | Request identity recoverable when a send may have reached the owner. |
45
+ | `cause?` | `unknown` | The original thrown value, kept for server-side diagnosis only. It is never serialized: the wire encoder copies named fields only. |
46
+
47
+ ###### Returns
48
+
49
+ [`ShiitakeError`](#shiitakeerror)
50
+
51
+ ###### Overrides
52
+
53
+ ```ts
54
+ Error.constructor;
55
+ ```
56
+
57
+ #### Properties
58
+
59
+ ##### \_tag
60
+
61
+ ```ts
62
+ readonly _tag: "ShiitakeError";
63
+ ```
64
+
65
+ Stable runtime tag for typed Shiitake failures.
66
+
67
+ ##### cause
68
+
69
+ ```ts
70
+ readonly cause:
71
+ | "closed"
72
+ | "conflict"
73
+ | "incompatible"
74
+ | "invalid"
75
+ | "rejected"
76
+ | "unavailable"
77
+ | "storage_pressure"
78
+ | "context_too_large";
79
+ ```
80
+
81
+ Safe category describing why it was rejected.
82
+
83
+ ###### Overrides
84
+
85
+ ```ts
86
+ Error.cause;
87
+ ```
88
+
89
+ ##### underlying?
90
+
91
+ ```ts
92
+ readonly optional underlying?: unknown;
93
+ ```
94
+
95
+ Original cause retained only for server-side diagnosis.
96
+
97
+ ##### boundary
98
+
99
+ ```ts
100
+ readonly boundary:
101
+ | "contract"
102
+ | "extensions"
103
+ | "instructions"
104
+ | "model"
105
+ | "runtime"
106
+ | "store"
107
+ | "tools";
108
+ ```
109
+
110
+ Boundary that rejected the operation.
111
+
112
+ ##### requestId?
113
+
114
+ ```ts
115
+ readonly optional requestId?: string;
116
+ ```
117
+
118
+ Request identity recoverable when a send may have reached the owner.
119
+
120
+ ## Type Aliases
121
+
122
+ ### ShiitakeErrorBoundary
123
+
124
+ ```ts
125
+ type ShiitakeErrorBoundary = Schema.Schema.Type<
126
+ typeof ShiitakeErrorBoundarySchema
127
+ >;
128
+ ```
129
+
130
+ Stable boundary that rejected a Shiitake operation.
131
+
132
+ ---
133
+
134
+ ### ShiitakeErrorCause
135
+
136
+ ```ts
137
+ type ShiitakeErrorCause = Schema.Schema.Type<typeof ShiitakeErrorCauseSchema>;
138
+ ```
139
+
140
+ Safe failure category exposed by both Shiitake facades.
141
+
142
+ ---
143
+
144
+ ### ExtensionCapabilityV0
145
+
146
+ ```ts
147
+ type ExtensionCapabilityV0 =
148
+ | "state"
149
+ | "attention"
150
+ | "settled"
151
+ | "send"
152
+ | "timers"
153
+ | "commands"
154
+ | "projection"
155
+ | "run_tools"
156
+ | "files"
157
+ | "prompt"
158
+ | "compaction_handoff";
159
+ ```
160
+
161
+ Closed, versioned, feature-free capability vocabulary.
162
+
163
+ ---
164
+
165
+ ### ShiitakeApi
166
+
167
+ ```ts
168
+ type ShiitakeApi = Readonly<{
169
+ make: (options) => Promise<ShiitakeOwnerAgent>;
170
+ }>;
171
+ ```
172
+
173
+ Public construction namespace for the Promise-facing durable harness.
174
+
175
+ ---
176
+
177
+ ### ShiitakeHost
178
+
179
+ ```ts
180
+ type ShiitakeHost = Readonly<{
181
+ readSettlement: (
182
+ sessionId,
183
+ commandId,
184
+ ) => Promise<CommandSettlement | undefined>;
185
+ agent: ShiitakeOwnerAgent;
186
+ acceptMail: (mail, meta?, reply?) => Promise<Accepted>;
187
+ }>;
188
+ ```
189
+
190
+ Promise-facing host composition with addressed mail kept off Session.
191
+
192
+ ---
193
+
194
+ ### PromptDelivery
195
+
196
+ ```ts
197
+ type PromptDelivery = "steer" | "followUp";
198
+ ```
199
+
200
+ Delivery policy for input accepted while a Session run is active.
201
+
202
+ ---
203
+
204
+ ### SessionCommand
205
+
206
+ ```ts
207
+ type SessionCommand = Schema.Schema.Type<typeof SessionCommandSchema>;
208
+ ```
209
+
210
+ Public Session command inferred from its one runtime parser.
211
+
212
+ ---
213
+
214
+ ### PromptCommand
215
+
216
+ ```ts
217
+ type PromptCommand = Schema.Schema.Type<typeof PromptCommandSchema>;
218
+ ```
219
+
220
+ Public prompt command accepted as durable Session work.
221
+
222
+ ---
223
+
224
+ ### AbortCommand
225
+
226
+ ```ts
227
+ type AbortCommand = Schema.Schema.Type<typeof AbortCommandSchema>;
228
+ ```
229
+
230
+ Cancel the running turn and all queued prompts, retaining their text.
231
+
232
+ ---
233
+
234
+ ### CancelCommand
235
+
236
+ ```ts
237
+ type CancelCommand = Schema.Schema.Type<typeof CancelCommandSchema>;
238
+ ```
239
+
240
+ Public command that cancels exactly one accepted request.
241
+
242
+ ---
243
+
244
+ ### BranchCommand
245
+
246
+ ```ts
247
+ type BranchCommand = Extract<
248
+ SessionCommand,
249
+ Readonly<{
250
+ type: "branch";
251
+ }>
252
+ >;
253
+ ```
254
+
255
+ Public command that selects one complete entry as the active lineage leaf.
256
+
257
+ ---
258
+
259
+ ### CompactCommand
260
+
261
+ ```ts
262
+ type CompactCommand = Extract<
263
+ SessionCommand,
264
+ Readonly<{
265
+ type: "compact";
266
+ }>
267
+ >;
268
+ ```
269
+
270
+ Public command that compacts the Session's context as queued work.
271
+
272
+ ---
273
+
274
+ ### ForkCommand
275
+
276
+ ```ts
277
+ type ForkCommand = Extract<
278
+ SessionCommand,
279
+ Readonly<{
280
+ type: "fork";
281
+ }>
282
+ >;
283
+ ```
284
+
285
+ Public command that creates a new Session from one complete entry lineage.
286
+
287
+ ---
288
+
289
+ ### SqliteValue
290
+
291
+ ```ts
292
+ type SqliteValue = WatchdogSqliteValue;
293
+ ```
294
+
295
+ Native SQLite scalar and row grammar shared with the work queue owner.
296
+
297
+ ---
298
+
299
+ ### SqliteRow
300
+
301
+ ```ts
302
+ type SqliteRow = WatchdogSqliteRow;
303
+ ```
304
+
305
+ Raw row grammar shared by Woodstock and Watchdog.
306
+
307
+ ---
308
+
309
+ ### SqliteCursor
310
+
311
+ ```ts
312
+ type SqliteCursor = WatchdogSqliteCursor &
313
+ Readonly<{
314
+ one: () => SqliteRow;
315
+ }>;
316
+ ```
317
+
318
+ Native rows stay raw until the query's maintained schema decodes them.
319
+
320
+ ---
321
+
322
+ ### SqliteOwner
323
+
324
+ ```ts
325
+ type SqliteOwner = Omit<WatchdogSqliteOwner, "sql"> &
326
+ Readonly<{
327
+ sql: Readonly<{
328
+ exec: (statement, ...bindings) => SqliteCursor;
329
+ }>;
330
+ }>;
331
+ ```
332
+
333
+ Synchronous SQL and transactions held by the surrounding runtime.
334
+
335
+ ---
336
+
337
+ ### ModelAcquisition
338
+
339
+ ```ts
340
+ type ModelAcquisition = Readonly<{
341
+ model: Model<Api>;
342
+ stream?: MuleStreamFunction;
343
+ retryAfterMs?: (message) => number | undefined;
344
+ release: () => Promise<void>;
345
+ }>;
346
+ ```
347
+
348
+ Acquired Pi model and optional explicit Pi stream function.
349
+
350
+ ---
351
+
352
+ ### ModelSource
353
+
354
+ ```ts
355
+ type ModelSource = Readonly<{
356
+ acquire: (input) => Promise<ModelAcquisition>;
357
+ describe?: (input) => Promise<ModelDescription>;
358
+ }>;
359
+ ```
360
+
361
+ Deterministic host seam for model selection and ready egress.
362
+
363
+ ---
364
+
365
+ ### ModelDescription
366
+
367
+ ```ts
368
+ type ModelDescription = Readonly<{
369
+ contextWindow: number | null;
370
+ }>;
371
+ ```
372
+
373
+ What a Session's footer may know about its selected model.
374
+
375
+ ---
376
+
377
+ ### InstructionSnapshot
378
+
379
+ ```ts
380
+ type InstructionSnapshot = Readonly<{
381
+ revision: string;
382
+ text: string;
383
+ modules?: readonly ModuleRegistration[];
384
+ release?: () => void;
385
+ }>;
386
+ ```
387
+
388
+ Immutable instruction snapshot captured for one run.
389
+
390
+ ---
391
+
392
+ ### InstructionSource
393
+
394
+ ```ts
395
+ type InstructionSource = Readonly<{
396
+ load: (input) => Promise<InstructionSnapshot>;
397
+ }>;
398
+ ```
399
+
400
+ Host seam for one bounded instruction snapshot.
401
+
402
+ ---
403
+
404
+ ### ToolSource
405
+
406
+ ```ts
407
+ type ToolSource = Readonly<{
408
+ execution?: ExecutionOptions;
409
+ modules?: readonly ModuleRegistration[];
410
+ sources?: readonly CapabilitySource[];
411
+ sandbox: Sandbox;
412
+ access?: ToolAccess;
413
+ }>;
414
+ ```
415
+
416
+ Mycelium construction inputs captured by the Shiitake-owned run scope.
417
+
418
+ ---
419
+
420
+ ### RuntimePendingWork
421
+
422
+ ```ts
423
+ type RuntimePendingWork = Readonly<{
424
+ pending: boolean;
425
+ nextWakeAt: number | null;
426
+ }>;
427
+ ```
428
+
429
+ Promise host for scheduling the opaque durable reconciler.
430
+
431
+ ---
432
+
433
+ ### RuntimeHost
434
+
435
+ ```ts
436
+ type RuntimeHost = Readonly<{
437
+ bind: (input) => Promise<
438
+ Readonly<{
439
+ commit: <A>(mutation) => Promise<A>;
440
+ requestWake: () => Promise<void>;
441
+ close: () => Promise<void>;
442
+ }>
443
+ >;
444
+ }>;
445
+ ```
446
+
447
+ Promise host for scheduling the opaque durable reconciler.
448
+
449
+ ---
450
+
451
+ ### StorageBudget
452
+
453
+ ```ts
454
+ type StorageBudget = Readonly<{
455
+ usedBytes: () => number;
456
+ budgetBytes: number;
457
+ }>;
458
+ ```
459
+
460
+ A host's disk budget for owner storage, with the platform's own measure of it.
461
+ Near the budget, Shiitake refuses new Sessions and new prompts with a typed
462
+ `storage_pressure` error while admitted work finishes.
463
+
464
+ ---
465
+
466
+ ### CompactionBudget
467
+
468
+ ```ts
469
+ type CompactionBudget = Readonly<{
470
+ reserveTokens?: number;
471
+ keepRecentTokens?: number;
472
+ }>;
473
+ ```
474
+
475
+ One model's compaction token budgets; omitted fields fall back.
476
+
477
+ ---
478
+
479
+ ### CompactionOptions
480
+
481
+ ```ts
482
+ type CompactionOptions = CompactionBudget &
483
+ Readonly<{
484
+ enabled?: boolean;
485
+ modelOverrides?: Readonly<Record<string, CompactionBudget>>;
486
+ }>;
487
+ ```
488
+
489
+ Pi's compaction settings. Each budget resolves through the exact
490
+ `provider/modelId` override, then the ordinary value, then Pi's default (16384
491
+ reserve, 20000 kept). `enabled` is global and governs automatic compaction only;
492
+ a manual compaction always runs.
493
+
494
+ ---
495
+
496
+ ### ShiitakeOptions
497
+
498
+ ```ts
499
+ type ShiitakeOptions = Readonly<{
500
+ meta?: HostMetaOptions;
501
+ store: SqliteOwner;
502
+ storageBudget?: StorageBudget;
503
+ compaction?: CompactionOptions;
504
+ runtime: RuntimeHost;
505
+ model: ModelSource;
506
+ instructions: InstructionSource;
507
+ tools?: ToolSource;
508
+ extensions: ExtensionRosterV0;
509
+ }>;
510
+ ```
511
+
512
+ Validated immutable construction bag for the durable harness.
513
+
514
+ ---
515
+
516
+ ### ToolAccess
517
+
518
+ ```ts
519
+ type ToolAccess = Pick<
520
+ AccessOptions,
521
+ "grants" | "required" | "confirm" | "onRefused"
522
+ >;
523
+ ```
524
+
525
+ A host's access data for its Agent's tools. Grants are keyed by module id; a
526
+ module an extension built is granted by that extension's id. A missing id keeps
527
+ full access, so a first-time host writes no permission code.
528
+
529
+ ---
530
+
531
+ ### ShiitakeOwnerAgent
532
+
533
+ ```ts
534
+ type ShiitakeOwnerAgent = ShiitakeAgent &
535
+ Readonly<{
536
+ grants: Readonly<{
537
+ deliver: (sessionId, delivery) => GrantsDeliveryResult;
538
+ read: (sessionId) => GrantsDelivery | null;
539
+ }>;
540
+ withMeta: (meta) => ShiitakeAgent;
541
+ }>;
542
+ ```
543
+
544
+ The in-process owner of a durable harness. Only the host holds it, so only the
545
+ host can write a Session's grants or attach metadata; no HTTP or remote client
546
+ can.
547
+
548
+ ---
549
+
550
+ ### CommandSettlement
551
+
552
+ ```ts
553
+ type CommandSettlement = Readonly<{
554
+ terminal: SessionTerminal;
555
+ content: string;
556
+ usage: readonly Pick<AssistantMessage, "provider" | "model" | "usage">[];
557
+ toolCalls: number;
558
+ }>;
559
+ ```
560
+
561
+ Exact accepted-work facts, independent of the current Session branch or page.
562
+
563
+ ---
564
+
565
+ ### StandardHostMetaSchema
566
+
567
+ ```ts
568
+ type StandardHostMetaSchema = Readonly<{
569
+ ~standard: Readonly<{
570
+ validate: (value) =>
571
+ | StandardHostMetaResult
572
+ | PromiseLike<StandardHostMetaResult>;
573
+ }>;
574
+ }>;
575
+ ```
576
+
577
+ Any Standard Schema, such as a Zod 4 schema, whose `validate` settles
578
+ synchronously. Shiitake only asks whether a value is accepted.
579
+
580
+ ---
581
+
582
+ ### StandardHostMetaResult
583
+
584
+ ```ts
585
+ type StandardHostMetaResult =
586
+ | Readonly<{
587
+ issues?: undefined;
588
+ }>
589
+ | Readonly<{
590
+ issues: readonly Readonly<{
591
+ message: string;
592
+ }>[];
593
+ }>;
594
+ ```
595
+
596
+ One Standard Schema validation outcome; only acceptance matters here.
597
+
598
+ ---
599
+
600
+ ### HostMetaOptions
601
+
602
+ ```ts
603
+ type HostMetaOptions = Readonly<{
604
+ schema: Schema.Codec<unknown, Json> | StandardHostMetaSchema;
605
+ }>;
606
+ ```
607
+
608
+ The one schema a host supplies at Agent creation for the metadata it attaches to
609
+ prompts and operator lines: an Effect schema whose encoded side is JSON, or a
610
+ synchronous Standard Schema. Shiitake checks each value against it before
611
+ writing; it never reads the decoded form.
612
+
613
+ ---
614
+
615
+ ### ModelPreference
616
+
617
+ ```ts
618
+ type ModelPreference = Schema.Schema.Type<typeof ModelPreferenceSchema>;
619
+ ```
620
+
621
+ Null at the Session boundary means inherit the Agent default.
622
+
623
+ ---
624
+
625
+ ### VerifiedAgentReply
626
+
627
+ ```ts
628
+ type VerifiedAgentReply = typeof VerifiedAgentReplySchema.Type;
629
+ ```
630
+
631
+ A delegated Agent's reply after the admitting host authenticated it.
632
+
633
+ ---
634
+
635
+ ### GrantsDelivery
636
+
637
+ ```ts
638
+ type GrantsDelivery = Readonly<{
639
+ version: number;
640
+ grants: Grants;
641
+ }>;
642
+ ```
643
+
644
+ One versioned delivery of a Session's grants.
645
+
646
+ ---
647
+
648
+ ### GrantsDeliveryResult
649
+
650
+ ```ts
651
+ type GrantsDeliveryResult = "applied" | "unchanged";
652
+ ```
653
+
654
+ Whether a delivery replaced the stored grants or repeated them.
655
+
656
+ ---
657
+
658
+ ### DocumentForkPolicyV0
659
+
660
+ ```ts
661
+ type DocumentForkPolicyV0 = "inherit-at-fork-point" | "current" | "fresh";
662
+ ```
663
+
664
+ Which source value a new Session starts with.
665
+
666
+ ---
667
+
668
+ ### DocumentSpecV0
669
+
670
+ ```ts
671
+ type DocumentSpecV0<A, I> = Readonly<{
672
+ schema: Schema.Codec<A, I>;
673
+ initial: A;
674
+ fork: DocumentForkPolicyV0;
675
+ maxBytes: number;
676
+ }>;
677
+ ```
678
+
679
+ A typed JSON document, bounded by its encoded UTF-8 size.
680
+
681
+ #### Type Parameters
682
+
683
+ | Type Parameter | Default type |
684
+ | -------------- | ------------ |
685
+ | `A` | - |
686
+ | `I` | `A` |
687
+
688
+ ---
689
+
690
+ ### DocumentsV0
691
+
692
+ ```ts
693
+ type DocumentsV0 = Readonly<
694
+ Record<
695
+ string,
696
+ Readonly<{
697
+ schema: Schema.Codec<unknown>;
698
+ initial: unknown;
699
+ fork: DocumentForkPolicyV0;
700
+ maxBytes: number;
701
+ }>
702
+ >
703
+ >;
704
+ ```
705
+
706
+ Existential declarations; each initial value is decoded by its own schema.
707
+
708
+ ---
709
+
710
+ ### DocumentHandleV0
711
+
712
+ ```ts
713
+ type DocumentHandleV0<A> = Readonly<{
714
+ read: (sessionId) => A;
715
+ update: (sessionId, change) => void;
716
+ }>;
717
+ ```
718
+
719
+ Both operations require the declaring extension's active core transaction.
720
+
721
+ #### Type Parameters
722
+
723
+ | Type Parameter |
724
+ | -------------- |
725
+ | `A` |
726
+
727
+ ---
728
+
729
+ ### DocumentHandlesV0
730
+
731
+ ```ts
732
+ type DocumentHandlesV0<D> = {
733
+ readonly [K in keyof D]: DocumentHandleV0<D[K]["schema"]["Type"]>;
734
+ };
735
+ ```
736
+
737
+ Handles preserve the decoded type of each declared document.
738
+
739
+ #### Type Parameters
740
+
741
+ | Type Parameter |
742
+ | ------------------------------------------- |
743
+ | `D` _extends_ [`DocumentsV0`](#documentsv0) |
744
+
745
+ ## Variables
746
+
747
+ ### Shiitake
748
+
749
+ ```ts
750
+ const Shiitake: ShiitakeApi;
751
+ ```
752
+
753
+ Construct the Promise facade over the canonical Effect program.
754
+
755
+ ---
756
+
757
+ ### sqliteRowSchema
758
+
759
+ ```ts
760
+ const sqliteRowSchema: Schema.$Record<
761
+ Schema.String,
762
+ Schema.Union<
763
+ readonly [
764
+ Schema.instanceOf<ArrayBuffer, unknown>,
765
+ Schema.String,
766
+ Schema.Number,
767
+ Schema.Null,
768
+ ]
769
+ >
770
+ >;
771
+ ```
772
+
773
+ A native row is a scalar record; each query owner decodes its own projection.
774
+
775
+ ## Functions
776
+
777
+ ### parseForkedSession()
778
+
779
+ ```ts
780
+ function parseForkedSession(value): ForkedSession;
781
+ ```
782
+
783
+ Parse one serialized fork result using Shiitake's public client grammar.
784
+
785
+ #### Parameters
786
+
787
+ | Parameter | Type |
788
+ | --------- | -------- |
789
+ | `value` | `string` |
790
+
791
+ #### Returns
792
+
793
+ [`ForkedSession`](client.md#forkedsession)
794
+
795
+ ---
796
+
797
+ ### parseSessionSnapshot()
798
+
799
+ ```ts
800
+ function parseSessionSnapshot(value): SessionSnapshot;
801
+ ```
802
+
803
+ Parse one serialized snapshot using Shiitake's public client grammar.
804
+
805
+ #### Parameters
806
+
807
+ | Parameter | Type |
808
+ | --------- | -------- |
809
+ | `value` | `string` |
810
+
811
+ #### Returns
812
+
813
+ [`SessionSnapshot`](client.md#sessionsnapshot)
814
+
815
+ ---
816
+
817
+ ### parseSessionFrame()
818
+
819
+ ```ts
820
+ function parseSessionFrame(value): SessionFrame;
821
+ ```
822
+
823
+ Parse one serialized frame using Shiitake's public client grammar.
824
+
825
+ #### Parameters
826
+
827
+ | Parameter | Type |
828
+ | --------- | -------- |
829
+ | `value` | `string` |
830
+
831
+ #### Returns
832
+
833
+ [`SessionFrame`](client.md#sessionframe)
834
+
835
+ ---
836
+
837
+ ### makeHost()
838
+
839
+ ```ts
840
+ function makeHost(options, mailRoom): Promise<Readonly<{
841
+ readSettlement: (sessionId, commandId) => Promise<
842
+ | Readonly<{
843
+ terminal: SessionTerminal;
844
+ content: string;
845
+ usage: readonly Pick<AssistantMessage, ... | ... | ...>[];
846
+ toolCalls: number;
847
+ }>
848
+ | undefined>;
849
+ agent: ShiitakeOwnerAgent;
850
+ acceptMail: (mail, meta?, reply?) => Promise<Readonly<{
851
+ status: "accepted";
852
+ commandId: string;
853
+ }>>;
854
+ }>>;
855
+ ```
856
+
857
+ Construct the host-only Promise facade over the canonical Effect program.
858
+
859
+ #### Parameters
860
+
861
+ | Parameter | Type |
862
+ | ---------- | ------------------------------------- |
863
+ | `options` | [`ShiitakeOptions`](#shiitakeoptions) |
864
+ | `mailRoom` | `BirdDogEffect` |
865
+
866
+ #### Returns
867
+
868
+ `Promise`\<`Readonly`\<\{ `readSettlement`: (`sessionId`, `commandId`) =>
869
+ `Promise`\< \| `Readonly`\<\{ `terminal`:
870
+ [`SessionTerminal`](client.md#sessionterminal); `content`: `string`; `usage`:
871
+ readonly `Pick`\<`AssistantMessage`, ... \| ... \| ...\>[]; `toolCalls`:
872
+ `number`; \}\> \| `undefined`\>; `agent`:
873
+ [`ShiitakeOwnerAgent`](#shiitakeowneragent); `acceptMail`: (`mail`, `meta?`,
874
+ `reply?`) => `Promise`\<`Readonly`\<\{ `status`: `"accepted"`; `commandId`:
875
+ `string`; \}\>\>; \}\>\>
876
+
877
+ ## References
878
+
879
+ ### AgentExtensionControls
880
+
881
+ Re-exports [AgentExtensionControls](client.md#agentextensioncontrols)
882
+
883
+ ---
884
+
885
+ ### CancelResult
886
+
887
+ Re-exports [CancelResult](client.md#cancelresult)
888
+
889
+ ---
890
+
891
+ ### Accepted
892
+
893
+ Re-exports [Accepted](client.md#accepted)
894
+
895
+ ---
896
+
897
+ ### ForkedSession
898
+
899
+ Re-exports [ForkedSession](client.md#forkedsession)
900
+
901
+ ---
902
+
903
+ ### SendOptions
904
+
905
+ Re-exports [SendOptions](client.md#sendoptions)
906
+
907
+ ---
908
+
909
+ ### ReadOptions
910
+
911
+ Re-exports [ReadOptions](client.md#readoptions)
912
+
913
+ ---
914
+
915
+ ### SessionCommandHandler
916
+
917
+ Re-exports [SessionCommandHandler](client.md#sessioncommandhandler)
918
+
919
+ ---
920
+
921
+ ### SessionExtensionControls
922
+
923
+ Re-exports [SessionExtensionControls](client.md#sessionextensioncontrols)
924
+
925
+ ---
926
+
927
+ ### SessionExtensionSlots
928
+
929
+ Re-exports [SessionExtensionSlots](client.md#sessionextensionslots)
930
+
931
+ ---
932
+
933
+ ### SessionFrame
934
+
935
+ Re-exports [SessionFrame](client.md#sessionframe)
936
+
937
+ ---
938
+
939
+ ### SessionMessage
940
+
941
+ Re-exports [SessionMessage](client.md#sessionmessage)
942
+
943
+ ---
944
+
945
+ ### SessionProgress
946
+
947
+ Re-exports [SessionProgress](client.md#sessionprogress)
948
+
949
+ ---
950
+
951
+ ### SessionContext
952
+
953
+ Re-exports [SessionContext](client.md#sessioncontext)
954
+
955
+ ---
956
+
957
+ ### SessionSnapshot
958
+
959
+ Re-exports [SessionSnapshot](client.md#sessionsnapshot)
960
+
961
+ ---
962
+
963
+ ### SessionInboxState
964
+
965
+ Re-exports [SessionInboxState](client.md#sessioninboxstate)
966
+
967
+ ---
968
+
969
+ ### SessionSummary
970
+
971
+ Re-exports [SessionSummary](client.md#sessionsummary)
972
+
973
+ ---
974
+
975
+ ### SessionSummaryPage
976
+
977
+ Re-exports [SessionSummaryPage](client.md#sessionsummarypage)
978
+
979
+ ---
980
+
981
+ ### SessionSummaryRow
982
+
983
+ Re-exports [SessionSummaryRow](client.md#sessionsummaryrow)
984
+
985
+ ---
986
+
987
+ ### SessionActivity
988
+
989
+ Re-exports [SessionActivity](client.md#sessionactivity)
990
+
991
+ ---
992
+
993
+ ### AgentRunningWork
994
+
995
+ Re-exports [AgentRunningWork](client.md#agentrunningwork)
996
+
997
+ ---
998
+
999
+ ### SessionTerminal
1000
+
1001
+ Re-exports [SessionTerminal](client.md#sessionterminal)
1002
+
1003
+ ---
1004
+
1005
+ ### SessionCompactionMarker
1006
+
1007
+ Re-exports [SessionCompactionMarker](client.md#sessioncompactionmarker)
1008
+
1009
+ ---
1010
+
1011
+ ### SessionCompactionNotice
1012
+
1013
+ Re-exports [SessionCompactionNotice](client.md#sessioncompactionnotice)
1014
+
1015
+ ---
1016
+
1017
+ ### SessionCompactionTrigger
1018
+
1019
+ Re-exports [SessionCompactionTrigger](client.md#sessioncompactiontrigger)
1020
+
1021
+ ---
1022
+
1023
+ ### ShiitakeEventSourceConstructor
1024
+
1025
+ Re-exports
1026
+ [ShiitakeEventSourceConstructor](client.md#shiitakeeventsourceconstructor)
1027
+
1028
+ ---
1029
+
1030
+ ### SessionWatch
1031
+
1032
+ Re-exports [SessionWatch](client.md#sessionwatch)
1033
+
1034
+ ---
1035
+
1036
+ ### ShiitakeAgent
1037
+
1038
+ Re-exports [ShiitakeAgent](client.md#shiitakeagent)
1039
+
1040
+ ---
1041
+
1042
+ ### ShiitakeSession
1043
+
1044
+ Re-exports [ShiitakeSession](client.md#shiitakesession)
1045
+
1046
+ ---
1047
+
1048
+ ### SubscribeOptions
1049
+
1050
+ Re-exports [SubscribeOptions](client.md#subscribeoptions)
1051
+
1052
+ ---
1053
+
1054
+ ### TooLate
1055
+
1056
+ Re-exports [TooLate](client.md#toolate)
1057
+
1058
+ ---
1059
+
1060
+ ### WatchOptions
1061
+
1062
+ Re-exports [WatchOptions](client.md#watchoptions)
1063
+
1064
+ ---
1065
+
1066
+ ### BorrowedCompactionViewV0
1067
+
1068
+ Re-exports [BorrowedCompactionViewV0](extensions.md#borrowedcompactionviewv0)
1069
+
1070
+ ---
1071
+
1072
+ ### CompactionHandoffErrorV0
1073
+
1074
+ Re-exports [CompactionHandoffErrorV0](extensions.md#compactionhandofferrorv0)
1075
+
1076
+ ---
1077
+
1078
+ ### CompactionHandoffResultV0
1079
+
1080
+ Re-exports [CompactionHandoffResultV0](extensions.md#compactionhandoffresultv0)
1081
+
1082
+ ---
1083
+
1084
+ ### CompactionHandoffV0
1085
+
1086
+ Re-exports [CompactionHandoffV0](extensions.md#compactionhandoffv0)
1087
+
1088
+ ---
1089
+
1090
+ ### ExtensionGrantV0
1091
+
1092
+ Re-exports [ExtensionGrantV0](extensions.md#extensiongrantv0)
1093
+
1094
+ ---
1095
+
1096
+ ### ExtensionRosterV0
1097
+
1098
+ Re-exports [ExtensionRosterV0](extensions.md#extensionrosterv0)
1099
+
1100
+ ---
1101
+
1102
+ ### ExtensionSlotV0
1103
+
1104
+ Re-exports [ExtensionSlotV0](extensions.md#extensionslotv0)
1105
+
1106
+ ---
1107
+
1108
+ ### ExtensionStatusV0
1109
+
1110
+ Re-exports [ExtensionStatusV0](extensions.md#extensionstatusv0)
1111
+
1112
+ ---
1113
+
1114
+ ### RosteredExtensionV0
1115
+
1116
+ Re-exports [RosteredExtensionV0](extensions.md#rosteredextensionv0)