@fungi.computer/agar 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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +766 -2
  3. package/dist/agent-message-meta.d.ts +74 -0
  4. package/dist/agent-message-meta.js +63 -0
  5. package/dist/agents.d.ts +170 -0
  6. package/dist/agents.js +218 -0
  7. package/dist/app-build-contract.d.ts +43 -0
  8. package/dist/app-build-contract.js +24 -0
  9. package/dist/apps.d.ts +66 -0
  10. package/dist/apps.js +47 -0
  11. package/dist/backend-declaration.d.ts +6 -0
  12. package/dist/backend-declaration.js +65 -0
  13. package/dist/backend-definition.d.ts +88 -0
  14. package/dist/backend-definition.js +158 -0
  15. package/dist/backend-refusal.d.ts +10 -0
  16. package/dist/backend-refusal.js +10 -0
  17. package/dist/backend.d.ts +30 -0
  18. package/dist/backend.js +28 -0
  19. package/dist/capabilities.d.ts +30 -0
  20. package/dist/capabilities.js +50 -0
  21. package/dist/channels.d.ts +142 -0
  22. package/dist/channels.js +97 -0
  23. package/dist/commands.d.ts +33 -0
  24. package/dist/commands.js +46 -0
  25. package/dist/computer-contracts.d.ts +73 -0
  26. package/dist/computer-contracts.js +57 -0
  27. package/dist/computer.d.ts +294 -0
  28. package/dist/computer.js +319 -0
  29. package/dist/connect.d.ts +11 -0
  30. package/dist/connect.js +211 -0
  31. package/dist/errors.d.ts +34 -0
  32. package/dist/errors.js +106 -0
  33. package/dist/failure.d.ts +2 -0
  34. package/dist/failure.js +9 -0
  35. package/dist/files.d.ts +25 -0
  36. package/dist/files.js +84 -0
  37. package/dist/game-servers.d.ts +530 -0
  38. package/dist/game-servers.js +244 -0
  39. package/dist/gills.d.ts +43 -0
  40. package/dist/gills.js +174 -0
  41. package/dist/git-commit.d.ts +143 -0
  42. package/dist/git-commit.js +251 -0
  43. package/dist/git-rpc.d.ts +310 -0
  44. package/dist/git-rpc.js +166 -0
  45. package/dist/git-steps.d.ts +579 -0
  46. package/dist/git-steps.js +804 -0
  47. package/dist/git-wire.d.ts +33 -0
  48. package/dist/git-wire.js +240 -0
  49. package/dist/git.d.ts +322 -0
  50. package/dist/git.js +98 -0
  51. package/dist/host.d.ts +97 -0
  52. package/dist/host.js +732 -0
  53. package/dist/inbox.d.ts +99 -0
  54. package/dist/inbox.js +184 -0
  55. package/dist/index.d.ts +31 -0
  56. package/dist/index.js +15 -0
  57. package/dist/inference.d.ts +17 -0
  58. package/dist/inference.js +115 -0
  59. package/dist/internal/app-error.d.ts +8 -0
  60. package/dist/internal/app-error.js +36 -0
  61. package/dist/internal/app-session.d.ts +8 -0
  62. package/dist/internal/app-session.js +551 -0
  63. package/dist/internal/back-inputs.d.ts +22 -0
  64. package/dist/internal/back-inputs.js +93 -0
  65. package/dist/internal/browser-bridge.d.ts +30 -0
  66. package/dist/internal/browser-bridge.js +203 -0
  67. package/dist/internal/capabilities.d.ts +13 -0
  68. package/dist/internal/capabilities.js +138 -0
  69. package/dist/internal/commands.d.ts +9 -0
  70. package/dist/internal/commands.js +257 -0
  71. package/dist/internal/disconnect-host.d.ts +7 -0
  72. package/dist/internal/disconnect-host.js +19 -0
  73. package/dist/internal/git-edit-tree.d.ts +6 -0
  74. package/dist/internal/git-edit-tree.js +46 -0
  75. package/dist/internal/memory-fs.d.ts +39 -0
  76. package/dist/internal/memory-fs.js +154 -0
  77. package/dist/internal/protocol.d.ts +116 -0
  78. package/dist/internal/protocol.js +6 -0
  79. package/dist/internal/query-feed.d.ts +23 -0
  80. package/dist/internal/query-feed.js +111 -0
  81. package/dist/internal/result.d.ts +22 -0
  82. package/dist/internal/result.js +61 -0
  83. package/dist/internal/rpc-contract.d.ts +24 -0
  84. package/dist/internal/rpc-contract.js +78 -0
  85. package/dist/internal/schemas.d.ts +307 -0
  86. package/dist/internal/schemas.js +524 -0
  87. package/dist/internal/store.d.ts +8 -0
  88. package/dist/internal/store.js +30 -0
  89. package/dist/internal/terminal-gate.d.ts +17 -0
  90. package/dist/internal/terminal-gate.js +94 -0
  91. package/dist/lifecycle.d.ts +44 -0
  92. package/dist/lifecycle.js +1 -0
  93. package/dist/marketplace.d.ts +159 -0
  94. package/dist/marketplace.js +102 -0
  95. package/dist/media-json.d.ts +181 -0
  96. package/dist/media-json.js +204 -0
  97. package/dist/media-library.d.ts +11 -0
  98. package/dist/media-library.js +15 -0
  99. package/dist/media-request-id.d.ts +7 -0
  100. package/dist/media-request-id.js +16 -0
  101. package/dist/media.d.ts +354 -0
  102. package/dist/media.js +654 -0
  103. package/dist/method-refusal.d.ts +64 -0
  104. package/dist/method-refusal.js +48 -0
  105. package/dist/pending.d.ts +10 -0
  106. package/dist/pending.js +10 -0
  107. package/dist/query.d.ts +76 -0
  108. package/dist/query.js +195 -0
  109. package/dist/react-mount.d.ts +23 -0
  110. package/dist/react-mount.js +108 -0
  111. package/dist/react.d.ts +41 -0
  112. package/dist/react.js +111 -0
  113. package/dist/read-copy.d.ts +103 -0
  114. package/dist/read-copy.js +195 -0
  115. package/dist/roles/files.d.ts +295 -0
  116. package/dist/roles/files.js +184 -0
  117. package/dist/root.d.ts +21 -0
  118. package/dist/root.js +1 -0
  119. package/dist/rpc.d.ts +1 -0
  120. package/dist/rpc.js +1 -0
  121. package/dist/status.d.ts +17 -0
  122. package/dist/status.js +50 -0
  123. package/dist/storage-wire.d.ts +167 -0
  124. package/dist/storage-wire.js +115 -0
  125. package/dist/storage.d.ts +72 -0
  126. package/dist/storage.js +143 -0
  127. package/dist/store.d.ts +11 -0
  128. package/dist/store.js +1 -0
  129. package/dist/test-kit/git.d.ts +31 -0
  130. package/dist/test-kit/git.js +174 -0
  131. package/dist/ui.d.ts +169 -0
  132. package/dist/ui.js +10 -0
  133. package/dist/window.d.ts +41 -0
  134. package/dist/window.js +15 -0
  135. package/dist/world.d.ts +16 -0
  136. package/dist/world.js +17 -0
  137. package/docs/api/README.md +28 -0
  138. package/docs/api/app-build-contract.md +113 -0
  139. package/docs/api/backend-declaration.md +62 -0
  140. package/docs/api/backend-definition.md +215 -0
  141. package/docs/api/backend.md +269 -0
  142. package/docs/api/errors.md +169 -0
  143. package/docs/api/files.md +91 -0
  144. package/docs/api/gills.md +164 -0
  145. package/docs/api/git-commit.md +279 -0
  146. package/docs/api/git-rpc.md +243 -0
  147. package/docs/api/git-steps.md +1010 -0
  148. package/docs/api/git-wire.md +197 -0
  149. package/docs/api/git.md +579 -0
  150. package/docs/api/index.md +2880 -0
  151. package/docs/api/media-json.md +507 -0
  152. package/docs/api/media-request-id.md +32 -0
  153. package/docs/api/modules.md +32 -0
  154. package/docs/api/query.md +253 -0
  155. package/docs/api/react.md +216 -0
  156. package/docs/api/read-copy.md +204 -0
  157. package/docs/api/rpc.md +128 -0
  158. package/docs/api/storage.md +620 -0
  159. package/package.json +197 -3
@@ -0,0 +1,2880 @@
1
+ <!-- Generated by Botanical API docs (TypeDoc + typedoc-plugin-markdown). Do not edit. -->
2
+
3
+ [**@fungi.computer/agar**](README.md)
4
+
5
+ ---
6
+
7
+ [@fungi.computer/agar](modules.md) / index
8
+
9
+ # index
10
+
11
+ ## Type Aliases
12
+
13
+ ### FungiAuthor
14
+
15
+ ```ts
16
+ type FungiAuthor = z.infer<typeof FungiAuthorSchema>;
17
+ ```
18
+
19
+ Who a Session line came from, as the admitting host authenticated them.
20
+
21
+ ---
22
+
23
+ ### FungiDelegationReply
24
+
25
+ ```ts
26
+ type FungiDelegationReply = z.infer<typeof FungiDelegationReplySchema>;
27
+ ```
28
+
29
+ A delegated Agent's reply as the admitting host authenticated it.
30
+
31
+ ---
32
+
33
+ ### FungiMessageMeta
34
+
35
+ ```ts
36
+ type FungiMessageMeta = z.infer<typeof FungiMessageMetaSchema>;
37
+ ```
38
+
39
+ The metadata the host attaches to every prompt and operator line it admits.
40
+
41
+ ---
42
+
43
+ ### MessageMetaValue
44
+
45
+ ```ts
46
+ type MessageMetaValue =
47
+ | string
48
+ | number
49
+ | boolean
50
+ | null
51
+ | readonly MessageMetaValue[]
52
+ | Readonly<{
53
+ [key: string]: MessageMetaValue;
54
+ }>;
55
+ ```
56
+
57
+ Any JSON value, as Shiitake returns a message's metadata.
58
+
59
+ ---
60
+
61
+ ### AuthorMeta
62
+
63
+ ```ts
64
+ type AuthorMeta = Readonly<{
65
+ author: Readonly<FungiAuthor>;
66
+ }>;
67
+ ```
68
+
69
+ The metadata the host attaches for one authenticated author, as JSON.
70
+
71
+ ---
72
+
73
+ ### AppAgent
74
+
75
+ ```ts
76
+ type AppAgent = Schema.Schema.Type<typeof appAgentSchema>;
77
+ ```
78
+
79
+ An Agent record as decoded from the host: its id, display name, and which
80
+ session operations this App is permitted to perform on it.
81
+
82
+ ---
83
+
84
+ ### AppAgentCreateInput
85
+
86
+ ```ts
87
+ type AppAgentCreateInput = Readonly<
88
+ Schema.Schema.Type<typeof appAgentCreateInputSchema>
89
+ >;
90
+ ```
91
+
92
+ Input for creating a new Agent: its name, a caller-chosen request id for
93
+ idempotency, and whether to provision a new Computer for it.
94
+
95
+ ---
96
+
97
+ ### AppAgentTransportHandle
98
+
99
+ ```ts
100
+ type AppAgentTransportHandle = object;
101
+ ```
102
+
103
+ Live object-capability shape received from Cap'n Web.
104
+
105
+ #### Methods
106
+
107
+ ##### fetch()
108
+
109
+ ```ts
110
+ fetch(request): Promise<Response>;
111
+ ```
112
+
113
+ Send one request to the Agent's session endpoint.
114
+
115
+ ###### Parameters
116
+
117
+ | Parameter | Type |
118
+ | --------- | --------- |
119
+ | `request` | `Request` |
120
+
121
+ ###### Returns
122
+
123
+ `Promise`\<`Response`\>
124
+
125
+ ##### close()
126
+
127
+ ```ts
128
+ close(): Promise<void>;
129
+ ```
130
+
131
+ Release the underlying object capability.
132
+
133
+ ###### Returns
134
+
135
+ `Promise`\<`void`\>
136
+
137
+ ##### \[dispose\]()
138
+
139
+ ```ts
140
+ dispose: void;
141
+ ```
142
+
143
+ Synchronously release local resources, for `using` disposal.
144
+
145
+ ###### Returns
146
+
147
+ `void`
148
+
149
+ ---
150
+
151
+ ### AppAgentListHandle
152
+
153
+ ```ts
154
+ type AppAgentListHandle = object;
155
+ ```
156
+
157
+ Capability handle for listing the Agents in a directory.
158
+
159
+ #### Methods
160
+
161
+ ##### list()
162
+
163
+ ```ts
164
+ list(): Promise<readonly object[]>;
165
+ ```
166
+
167
+ List the Agents visible to this App in the directory.
168
+
169
+ ###### Returns
170
+
171
+ `Promise`\<readonly `object`[]\>
172
+
173
+ ---
174
+
175
+ ### AppAgentCreateHandle
176
+
177
+ ```ts
178
+ type AppAgentCreateHandle = object;
179
+ ```
180
+
181
+ Capability handle for creating a new Agent in a directory.
182
+
183
+ #### Methods
184
+
185
+ ##### create()
186
+
187
+ ```ts
188
+ create(input): Promise<{
189
+ agentId: string;
190
+ name: string;
191
+ sessionOperations: readonly ("agent.manage" | "agent.read" | "agent.send")[];
192
+ }>;
193
+ ```
194
+
195
+ Create a new Agent with the given name and request id.
196
+
197
+ ###### Parameters
198
+
199
+ | Parameter | Type |
200
+ | --------- | --------------------------------------------- |
201
+ | `input` | [`AppAgentCreateInput`](#appagentcreateinput) |
202
+
203
+ ###### Returns
204
+
205
+ `Promise`\<\{ `agentId`: `string`; `name`: `string`; `sessionOperations`:
206
+ readonly (`"agent.manage"` \| `"agent.read"` \| `"agent.send"`)[]; \}\>
207
+
208
+ ---
209
+
210
+ ### AppAgentDirectoryHandle
211
+
212
+ ```ts
213
+ type AppAgentDirectoryHandle = AppAgentListHandle &
214
+ AppAgentCreateHandle &
215
+ object;
216
+ ```
217
+
218
+ Live capability handle for listing and creating Agents in a Team or
219
+ local-project directory, and opening transports to them.
220
+
221
+ #### Type Declaration
222
+
223
+ | Name | Type | Description |
224
+ | ------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------- |
225
+ | `open()` | (`input`) => `Promise`\<[`AppAgentTransportHandle`](#appagenttransporthandle)\> | Open a transport to the Agent identified by `agentId`. |
226
+ | `openInbox()` | () => `Promise`\<[`AppAgentTransportHandle`](#appagenttransporthandle)\> | The member's inbox feed, limited to Agents this App may read. |
227
+
228
+ ---
229
+
230
+ ### AppAgentRenameInput
231
+
232
+ ```ts
233
+ type AppAgentRenameInput = Readonly<
234
+ Schema.Schema.Type<typeof appAgentRenameInputSchema>
235
+ >;
236
+ ```
237
+
238
+ Input for renaming an existing Agent: its id and the owner's chosen replacement
239
+ display name.
240
+
241
+ ---
242
+
243
+ ### AppAgentRenameHandle
244
+
245
+ ```ts
246
+ type AppAgentRenameHandle = object;
247
+ ```
248
+
249
+ Capability handle for renaming an Agent the owner already created.
250
+
251
+ #### Methods
252
+
253
+ ##### rename()
254
+
255
+ ```ts
256
+ rename(input): Promise<{
257
+ agentId: string;
258
+ name: string;
259
+ sessionOperations: readonly ("agent.manage" | "agent.read" | "agent.send")[];
260
+ }>;
261
+ ```
262
+
263
+ Rename an existing Agent and return its updated record.
264
+
265
+ ###### Parameters
266
+
267
+ | Parameter | Type |
268
+ | --------- | --------------------------------------------- |
269
+ | `input` | [`AppAgentRenameInput`](#appagentrenameinput) |
270
+
271
+ ###### Returns
272
+
273
+ `Promise`\<\{ `agentId`: `string`; `name`: `string`; `sessionOperations`:
274
+ readonly (`"agent.manage"` \| `"agent.read"` \| `"agent.send"`)[]; \}\>
275
+
276
+ ---
277
+
278
+ ### AppAgentToolPolicyStatus
279
+
280
+ ```ts
281
+ type AppAgentToolPolicyStatus = z.infer<typeof appAgentToolPolicyStatusSchema>;
282
+ ```
283
+
284
+ Whether an Agent's App tools are still pending the owner's approval.
285
+
286
+ ---
287
+
288
+ ### AppAgentToolPolicyResult
289
+
290
+ ```ts
291
+ type AppAgentToolPolicyResult = z.infer<typeof appAgentToolPolicyResultSchema>;
292
+ ```
293
+
294
+ The outcome of an owner's direct App-tool approval.
295
+
296
+ ---
297
+
298
+ ### AppAgentToolPolicyHandle
299
+
300
+ ```ts
301
+ type AppAgentToolPolicyHandle = object;
302
+ ```
303
+
304
+ Capability handle for reading and approving an Agent's App-tool policy.
305
+
306
+ #### Methods
307
+
308
+ ##### status()
309
+
310
+ ```ts
311
+ status(input): Promise<
312
+ | {
313
+ status: "pending";
314
+ revision: string;
315
+ }
316
+ | {
317
+ status: "approved";
318
+ revision: string;
319
+ }
320
+ | null>;
321
+ ```
322
+
323
+ This Agent's current policy status, or `null` for no such Agent.
324
+
325
+ ###### Parameters
326
+
327
+ | Parameter | Type |
328
+ | --------------- | -------------------------- |
329
+ | `input` | \{ `agentId`: `string`; \} |
330
+ | `input.agentId` | `string` |
331
+
332
+ ###### Returns
333
+
334
+ `Promise`\< \| \{ `status`: `"pending"`; `revision`: `string`; \} \| \{
335
+ `status`: `"approved"`; `revision`: `string`; \} \| `null`\>
336
+
337
+ ##### approve()
338
+
339
+ ```ts
340
+ approve(input): Promise<
341
+ | {
342
+ status: "pending";
343
+ revision: string;
344
+ }
345
+ | {
346
+ status: "approved";
347
+ revision: string;
348
+ }
349
+ | {
350
+ error: string;
351
+ }>;
352
+ ```
353
+
354
+ Approve (or re-request) this Agent's App tools under a CAS revision.
355
+
356
+ ###### Parameters
357
+
358
+ | Parameter | Type |
359
+ | ------------------------ | -------------------------------------------------------------------------------------------------- |
360
+ | `input` | \{ `agentId`: `string`; `level`: `"read"` \| `"write"`; `expectedRevision`: `string` \| `null`; \} |
361
+ | `input.agentId` | `string` |
362
+ | `input.level` | `"read"` \| `"write"` |
363
+ | `input.expectedRevision` | `string` \| `null` |
364
+
365
+ ###### Returns
366
+
367
+ `Promise`\< \| \{ `status`: `"pending"`; `revision`: `string`; \} \| \{
368
+ `status`: `"approved"`; `revision`: `string`; \} \| \{ `error`: `string`; \}\>
369
+
370
+ ---
371
+
372
+ ### AppAgentTransport
373
+
374
+ ```ts
375
+ type AppAgentTransport = Readonly<{
376
+ baseUrl: string;
377
+ fetch: typeof globalThis.fetch;
378
+ close: () => Promise<void>;
379
+ }>;
380
+ ```
381
+
382
+ A Fetch-based transport to one Agent's session endpoint, scoped to this App and
383
+ safe to hand to an HTTP client adapter.
384
+
385
+ ---
386
+
387
+ ### CapabilityContract
388
+
389
+ ```ts
390
+ type CapabilityContract<T> = object;
391
+ ```
392
+
393
+ A capability owner's frozen, typed descriptor. Descriptor identity is not
394
+ authority.
395
+
396
+ #### Type Parameters
397
+
398
+ | Type Parameter |
399
+ | -------------- |
400
+ | `T` |
401
+
402
+ #### Properties
403
+
404
+ ##### id
405
+
406
+ ```ts
407
+ readonly id: string;
408
+ ```
409
+
410
+ ##### version
411
+
412
+ ```ts
413
+ readonly version: number;
414
+ ```
415
+
416
+ ##### schema
417
+
418
+ ```ts
419
+ readonly schema: z.ZodType<T>;
420
+ ```
421
+
422
+ ---
423
+
424
+ ### CapabilityDirectory
425
+
426
+ ```ts
427
+ type CapabilityDirectory = object;
428
+ ```
429
+
430
+ The App's read-only view of its currently admitted capabilities.
431
+
432
+ #### Properties
433
+
434
+ ##### version
435
+
436
+ ```ts
437
+ readonly version: number;
438
+ ```
439
+
440
+ Changes after a successful grant replacement or disconnection.
441
+
442
+ #### Methods
443
+
444
+ ##### subscribe()
445
+
446
+ ```ts
447
+ subscribe(listener): Disposer;
448
+ ```
449
+
450
+ Read the current directory after a change. Does not emit on subscribe.
451
+
452
+ ###### Parameters
453
+
454
+ | Parameter | Type |
455
+ | ---------- | ------------ |
456
+ | `listener` | () => `void` |
457
+
458
+ ###### Returns
459
+
460
+ [`Disposer`](#disposer)
461
+
462
+ ##### has()
463
+
464
+ ```ts
465
+ has(contract): boolean;
466
+ ```
467
+
468
+ Whether an implementation for this contract is currently admitted.
469
+
470
+ ###### Parameters
471
+
472
+ | Parameter | Type |
473
+ | ---------- | -------------------------------------------------------- |
474
+ | `contract` | [`CapabilityContract`](#capabilitycontract)\<`unknown`\> |
475
+
476
+ ###### Returns
477
+
478
+ `boolean`
479
+
480
+ ##### require()
481
+
482
+ ```ts
483
+ require<T>(contract): T;
484
+ ```
485
+
486
+ The admitted implementation for this contract, or throw a `CAPABILITY_DENIED`
487
+ AppError when none is granted.
488
+
489
+ ###### Type Parameters
490
+
491
+ | Type Parameter |
492
+ | -------------- |
493
+ | `T` |
494
+
495
+ ###### Parameters
496
+
497
+ | Parameter | Type |
498
+ | ---------- | -------------------------------------------------- |
499
+ | `contract` | [`CapabilityContract`](#capabilitycontract)\<`T`\> |
500
+
501
+ ###### Returns
502
+
503
+ `T`
504
+
505
+ ---
506
+
507
+ ### CapabilityRegistry
508
+
509
+ ```ts
510
+ type CapabilityRegistry = CapabilityDirectory & object;
511
+ ```
512
+
513
+ Local capabilities admitted through their owner's typed contract.
514
+
515
+ #### Type Declaration
516
+
517
+ | Name | Type | Description |
518
+ | ----------- | ----------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
519
+ | `provide()` | \<`T`\>(`contract`, `implementation`) => `void` | Admit an implementation for this contract, replacing any previous one and bumping `version` so subscribers can react. |
520
+
521
+ ---
522
+
523
+ ### AppCommand
524
+
525
+ ```ts
526
+ type AppCommand = WhistleCommandDefinition;
527
+ ```
528
+
529
+ Semantic command metadata supplied by an App and owned by Whistle.
530
+
531
+ ---
532
+
533
+ ### AppCommandHandler
534
+
535
+ ```ts
536
+ type AppCommandHandler = (
537
+ invocation,
538
+ ) => Promise<WhistleJsonValue | undefined> | WhistleJsonValue | undefined;
539
+ ```
540
+
541
+ One invocation's semantic input; host correlation IDs are private.
542
+
543
+ #### Parameters
544
+
545
+ | Parameter | Type |
546
+ | ------------ | ----------------------------------------------- |
547
+ | `invocation` | [`AppCommandInvocation`](#appcommandinvocation) |
548
+
549
+ #### Returns
550
+
551
+ \| `Promise`\<`WhistleJsonValue` \| `undefined`\> \| `WhistleJsonValue` \|
552
+ `undefined`
553
+
554
+ ---
555
+
556
+ ### AppCommandInvocation
557
+
558
+ ```ts
559
+ type AppCommandInvocation = object;
560
+ ```
561
+
562
+ One command invocation's semantic input, passed to its handler.
563
+
564
+ #### Properties
565
+
566
+ ##### arguments?
567
+
568
+ ```ts
569
+ readonly optional arguments?: WhistleJsonValue;
570
+ ```
571
+
572
+ ##### origin
573
+
574
+ ```ts
575
+ readonly origin: WhistleExecutionOrigin;
576
+ ```
577
+
578
+ ##### signal
579
+
580
+ ```ts
581
+ readonly signal: AbortSignal;
582
+ ```
583
+
584
+ ---
585
+
586
+ ### AppCommands
587
+
588
+ ```ts
589
+ type AppCommands = object;
590
+ ```
591
+
592
+ Registers a command with the authenticated host for this page session. The
593
+ promise resolves only after the host accepts the registration.
594
+
595
+ #### Methods
596
+
597
+ ##### register()
598
+
599
+ ```ts
600
+ register(command, handler): Promise<Disposer>;
601
+ ```
602
+
603
+ Register one command and its handler with the host; resolves once the host
604
+ accepts it. Call the returned Disposer to unregister.
605
+
606
+ ###### Parameters
607
+
608
+ | Parameter | Type |
609
+ | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
610
+ | `command` | \{ `id`: `z.ZodString`; `title`: `z.ZodString`; `category`: `z.ZodString`; `description?`: `z.ZodOptional`\<`z.ZodString`\>; `projections?`: `z.ZodOptional`\<`z.ZodObject`\<\{ `bindings`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; `values`: `z.ZodArray`\<`z.ZodString`\>; \}, `z.core.$strict`\>\>; `agent`: `z.ZodOptional`\<`z.ZodObject`\<\{ `keybind`: `z.ZodOptional`\<`z.ZodString`\>; `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `help`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `menu`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `palette`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `slash`: `z.ZodOptional`\<`z.ZodObject`\<\{ `aliases`: `z.ZodArray`\<`z.ZodString`\>; `order`: `z.ZodOptional`\<`z.ZodNumber`\>; `arguments`: `z.ZodOptional`\<`z.ZodObject`\<\{ `hint`: ...; `words`: ...; `text`: ...; \}, `z.core.$strict`\>\>; \}, `z.core.$strict`\>\>; \}, `z.core.$strict`\>\>; `action?`: `z.ZodOptional`\<`z.ZodObject`\<\{ `inputSchema`: `z.ZodOptional`\<`z.ZodRecord`\<`z.ZodString`, `z.ZodJSONSchema`\>\>; `outputSchema`: `z.ZodOptional`\<`z.ZodRecord`\<`z.ZodString`, `z.ZodJSONSchema`\>\>; `presentation`: `z.ZodOptional`\<`z.ZodUnion`\<readonly \[`z.ZodObject`\<\{ `type`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `data`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `options`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `submitLabel`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `message`: ...; `confirmLabel`: ...; `cancelLabel`: ...; \}, `z.core.$strict`\>\]\>\>; \}, `z.core.$strict`\>\>; `availability?`: `z.ZodOptional`\<`z.ZodDiscriminatedUnion`\<\[`z.ZodObject`\<\{ `status`: `z.ZodLiteral`\<`"available"`\>; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `status`: `z.ZodLiteral`\<`"unavailable"`\>; `reason`: `z.ZodString`; \}, `z.core.$strict`\>\], `"status"`\>\>; \} |
611
+ | `command.id` | `z.ZodString` |
612
+ | `command.title` | `z.ZodString` |
613
+ | `command.category` | `z.ZodString` |
614
+ | `command.description?` | `z.ZodOptional`\<`z.ZodString`\> |
615
+ | `command.projections?` | `z.ZodOptional`\<`z.ZodObject`\<\{ `bindings`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; `values`: `z.ZodArray`\<`z.ZodString`\>; \}, `z.core.$strict`\>\>; `agent`: `z.ZodOptional`\<`z.ZodObject`\<\{ `keybind`: `z.ZodOptional`\<`z.ZodString`\>; `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `help`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `menu`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `palette`: `z.ZodOptional`\<`z.ZodObject`\<\{ `order`: `z.ZodOptional`\<`z.ZodNumber`\>; \}, `z.core.$strict`\>\>; `slash`: `z.ZodOptional`\<`z.ZodObject`\<\{ `aliases`: `z.ZodArray`\<`z.ZodString`\>; `order`: `z.ZodOptional`\<`z.ZodNumber`\>; `arguments`: `z.ZodOptional`\<`z.ZodObject`\<\{ `hint`: ...; `words`: ...; `text`: ...; \}, `z.core.$strict`\>\>; \}, `z.core.$strict`\>\>; \}, `z.core.$strict`\>\> |
616
+ | `command.action?` | `z.ZodOptional`\<`z.ZodObject`\<\{ `inputSchema`: `z.ZodOptional`\<`z.ZodRecord`\<`z.ZodString`, `z.ZodJSONSchema`\>\>; `outputSchema`: `z.ZodOptional`\<`z.ZodRecord`\<`z.ZodString`, `z.ZodJSONSchema`\>\>; `presentation`: `z.ZodOptional`\<`z.ZodUnion`\<readonly \[`z.ZodObject`\<\{ `type`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `data`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `options`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `submitLabel`: ...; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `type`: ...; `message`: ...; `confirmLabel`: ...; `cancelLabel`: ...; \}, `z.core.$strict`\>\]\>\>; \}, `z.core.$strict`\>\> |
617
+ | `command.availability?` | `z.ZodOptional`\<`z.ZodDiscriminatedUnion`\<\[`z.ZodObject`\<\{ `status`: `z.ZodLiteral`\<`"available"`\>; \}, `z.core.$strict`\>, `z.ZodObject`\<\{ `status`: `z.ZodLiteral`\<`"unavailable"`\>; `reason`: `z.ZodString`; \}, `z.core.$strict`\>\], `"status"`\>\> |
618
+ | `handler` | [`AppCommandHandler`](#appcommandhandler) |
619
+
620
+ ###### Returns
621
+
622
+ `Promise`\<[`Disposer`](#disposer)\>
623
+
624
+ ---
625
+
626
+ ### ConnectAppOptions
627
+
628
+ ```ts
629
+ type ConnectAppOptions = object;
630
+ ```
631
+
632
+ Options for connecting this iframe page to its authenticated host.
633
+
634
+ #### Properties
635
+
636
+ ##### expectedHostOrigin
637
+
638
+ ```ts
639
+ readonly expectedHostOrigin: string;
640
+ ```
641
+
642
+ The origin the host handshake message must come from; the connection is refused
643
+ when it comes from anywhere else.
644
+
645
+ ##### signal?
646
+
647
+ ```ts
648
+ readonly optional signal?: AbortSignal;
649
+ ```
650
+
651
+ Cancels a pending connection attempt.
652
+
653
+ ---
654
+
655
+ ### AppConnectMessage
656
+
657
+ ```ts
658
+ type AppConnectMessage = object;
659
+ ```
660
+
661
+ The host's handshake message that hands the App its RPC MessagePort.
662
+
663
+ #### Properties
664
+
665
+ ##### epoch
666
+
667
+ ```ts
668
+ readonly epoch: string;
669
+ ```
670
+
671
+ ##### protocolVersion
672
+
673
+ ```ts
674
+ readonly protocolVersion: typeof APP_PROTOCOL_VERSION;
675
+ ```
676
+
677
+ ##### type
678
+
679
+ ```ts
680
+ readonly type: typeof APP_CONNECT_TYPE;
681
+ ```
682
+
683
+ ---
684
+
685
+ ### AppReadyMessage
686
+
687
+ ```ts
688
+ type AppReadyMessage = object;
689
+ ```
690
+
691
+ The App iframe's handshake message announcing it is ready to connect.
692
+
693
+ #### Properties
694
+
695
+ ##### protocolVersion
696
+
697
+ ```ts
698
+ readonly protocolVersion: typeof APP_PROTOCOL_VERSION;
699
+ ```
700
+
701
+ ##### type
702
+
703
+ ```ts
704
+ readonly type: typeof APP_READY_TYPE;
705
+ ```
706
+
707
+ ---
708
+
709
+ ### AppContext
710
+
711
+ ```ts
712
+ type AppContext = object;
713
+ ```
714
+
715
+ The host-published state surrounding a connected App: its Computer selection,
716
+ focus, visibility, and any pending open request.
717
+
718
+ #### Properties
719
+
720
+ ##### computerId
721
+
722
+ ```ts
723
+ readonly computerId: string | null;
724
+ ```
725
+
726
+ Host-selected Computer backing this App's admitted resource capabilities.
727
+
728
+ ##### teamHasComputers?
729
+
730
+ ```ts
731
+ readonly optional teamHasComputers?: boolean | null;
732
+ ```
733
+
734
+ Whether the Team has Computers, when this host owns its Team directory.
735
+
736
+ ##### computerAccessGranted?
737
+
738
+ ```ts
739
+ readonly optional computerAccessGranted?: boolean;
740
+ ```
741
+
742
+ Whether this App has execute access across the Team, when known.
743
+
744
+ ##### focus
745
+
746
+ ```ts
747
+ readonly focus: FocusState;
748
+ ```
749
+
750
+ ##### openRequest
751
+
752
+ ```ts
753
+ readonly openRequest: AppOpenRequest | null;
754
+ ```
755
+
756
+ One host-issued App open action, present only on the launch/reconfigure.
757
+
758
+ ##### visibility
759
+
760
+ ```ts
761
+ readonly visibility: "hidden" | "visible";
762
+ ```
763
+
764
+ ---
765
+
766
+ ### AppOpenRequest
767
+
768
+ ```ts
769
+ type AppOpenRequest =
770
+ | Readonly<{
771
+ kind: "compose";
772
+ requestId: string;
773
+ text: string;
774
+ }>
775
+ | Readonly<{
776
+ kind: "navigate";
777
+ requestId: string;
778
+ params: readonly Readonly<{
779
+ key: string;
780
+ value: string;
781
+ }>[];
782
+ }>;
783
+ ```
784
+
785
+ One host-issued action an App must act on when it opens or reconfigures: start
786
+ composing given text, or navigate to the given params. Each carries a
787
+ `requestId` so the App can tell a repeated open from a fresh one.
788
+
789
+ ---
790
+
791
+ ### AppIdentity
792
+
793
+ ```ts
794
+ type AppIdentity = object;
795
+ ```
796
+
797
+ The App's own identity, as admitted by its host.
798
+
799
+ #### Properties
800
+
801
+ ##### appId
802
+
803
+ ```ts
804
+ readonly appId: string;
805
+ ```
806
+
807
+ ##### releaseId
808
+
809
+ ```ts
810
+ readonly releaseId: string;
811
+ ```
812
+
813
+ ##### surfaceId
814
+
815
+ ```ts
816
+ readonly surfaceId: string;
817
+ ```
818
+
819
+ ---
820
+
821
+ ### AppLifecycle
822
+
823
+ ```ts
824
+ type AppLifecycle =
825
+ | "connected"
826
+ | "connecting"
827
+ | "disconnected"
828
+ | "disposed"
829
+ | "disposing"
830
+ | "suspended";
831
+ ```
832
+
833
+ The connection state of this App's session with its host.
834
+
835
+ ---
836
+
837
+ ### FocusState
838
+
839
+ ```ts
840
+ type FocusState = object;
841
+ ```
842
+
843
+ Whether the App's own surface is being edited and which surface, if any, the
844
+ host considers focused.
845
+
846
+ #### Properties
847
+
848
+ ##### editing
849
+
850
+ ```ts
851
+ readonly editing: boolean;
852
+ ```
853
+
854
+ ##### surface
855
+
856
+ ```ts
857
+ readonly surface: null | string;
858
+ ```
859
+
860
+ ---
861
+
862
+ ### MediaGenerationInput
863
+
864
+ ```ts
865
+ type MediaGenerationInput = Readonly<{
866
+ destination: Readonly<{
867
+ path: string;
868
+ }>;
869
+ settings: MediaGenerationSelection;
870
+ }>;
871
+ ```
872
+
873
+ The Media owner decides Team, Installation, Release, Grant and Computer
874
+ authority before issuing this handle. The App contributes only generation
875
+ settings and selected destination/references. The IDs in those selections are
876
+ not authority: the host revalidates every one against its current admitted
877
+ Computer scope when it accepts a generation.
878
+
879
+ The owner intentionally returns completed metadata. Operation state, provider
880
+ identifiers and billing records remain owner facts. The exposed request
881
+ reference identifies a replay; it grants no authority.
882
+
883
+ ---
884
+
885
+ ### MediaOutputFormat
886
+
887
+ ```ts
888
+ type MediaOutputFormat = "png" | "jpeg" | "gif" | "webp" | "mp4";
889
+ ```
890
+
891
+ The encodings a completed generation can be saved as.
892
+
893
+ ---
894
+
895
+ ### MediaGenerationResult
896
+
897
+ ```ts
898
+ type MediaGenerationResult = Readonly<{
899
+ bytes: number;
900
+ costMilliunits: number;
901
+ destination: Readonly<{
902
+ computerId: string;
903
+ path: string;
904
+ }>;
905
+ format: MediaOutputFormat;
906
+ height: number;
907
+ model: string;
908
+ width: number;
909
+ }>;
910
+ ```
911
+
912
+ Metadata for one completed generation: the saved destination, pixel dimensions,
913
+ format, model used, and its cost.
914
+
915
+ ---
916
+
917
+ ### MediaGenerationFailure
918
+
919
+ ```ts
920
+ type MediaGenerationFailure = Schema.Schema.Type<
921
+ typeof mediaGenerationFailureSchema
922
+ >;
923
+ ```
924
+
925
+ The host's typed reason a generation failed: code, message, retry truth and,
926
+ when known, the stage that failed.
927
+
928
+ ---
929
+
930
+ ### MediaGenerationOutcome
931
+
932
+ ```ts
933
+ type MediaGenerationOutcome =
934
+ | Readonly<{
935
+ kind: "succeeded";
936
+ result: MediaGenerationResult;
937
+ }>
938
+ | Readonly<{
939
+ kind: "failed";
940
+ failure: MediaGenerationFailure;
941
+ }>;
942
+ ```
943
+
944
+ Transport-safe result from the host-owned generation attempt.
945
+
946
+ ---
947
+
948
+ ### MediaGenerationHandle
949
+
950
+ ```ts
951
+ type MediaGenerationHandle = object;
952
+ ```
953
+
954
+ Live object-capability shape supplied by the host.
955
+
956
+ #### Methods
957
+
958
+ ##### describe()
959
+
960
+ ```ts
961
+ describe(): Promise<Partial<Disposable> & object>;
962
+ ```
963
+
964
+ Fetch the Computer scope, available models, and whether generation is currently
965
+ allowed.
966
+
967
+ ###### Returns
968
+
969
+ `Promise`\<`Partial`\<`Disposable`\> & `object`\>
970
+
971
+ ##### createAttempt()
972
+
973
+ ```ts
974
+ createAttempt(): Promise<MediaGenerationAttemptHandle>;
975
+ ```
976
+
977
+ Begin a new generation attempt on the host and return its handle.
978
+
979
+ ###### Returns
980
+
981
+ `Promise`\<[`MediaGenerationAttemptHandle`](#mediagenerationattempthandle)\>
982
+
983
+ ##### restoreAttempt()
984
+
985
+ ```ts
986
+ restoreAttempt(reference): Promise<MediaGenerationAttemptHandle>;
987
+ ```
988
+
989
+ Resume a previously started attempt identified by its reference.
990
+
991
+ ###### Parameters
992
+
993
+ | Parameter | Type |
994
+ | ---------------------- | ---------------------------------------------------- |
995
+ | `reference` | \{ `requestId`: `string`; `computerId`: `string`; \} |
996
+ | `reference.requestId` | `string` |
997
+ | `reference.computerId` | `string` |
998
+
999
+ ###### Returns
1000
+
1001
+ `Promise`\<[`MediaGenerationAttemptHandle`](#mediagenerationattempthandle)\>
1002
+
1003
+ ##### cancelAttempt()
1004
+
1005
+ ```ts
1006
+ cancelAttempt(reference): Promise<void>;
1007
+ ```
1008
+
1009
+ Tell the host to stop an in-flight or pending attempt.
1010
+
1011
+ ###### Parameters
1012
+
1013
+ | Parameter | Type |
1014
+ | ---------------------- | ---------------------------------------------------- |
1015
+ | `reference` | \{ `requestId`: `string`; `computerId`: `string`; \} |
1016
+ | `reference.requestId` | `string` |
1017
+ | `reference.computerId` | `string` |
1018
+
1019
+ ###### Returns
1020
+
1021
+ `Promise`\<`void`\>
1022
+
1023
+ ---
1024
+
1025
+ ### MediaGenerationAttemptHandle
1026
+
1027
+ ```ts
1028
+ type MediaGenerationAttemptHandle = Partial<Disposable> & object;
1029
+ ```
1030
+
1031
+ Host-supplied object-capability for one attempt, before Agar wraps it into the
1032
+ typed MediaGenerationAttempt.
1033
+
1034
+ #### Type Declaration
1035
+
1036
+ | Name | Type | Description |
1037
+ | ------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- |
1038
+ | `reference()` | () => `Promise`\<`object` & `Partial`\<`Disposable`\>\> | Fetch this attempt's replay reference from the host. |
1039
+ | `generate()` | (`input`) => `Promise`\<[`MediaGenerationOutcome`](#mediagenerationoutcome) & `Partial`\<`Disposable`\>\> | Ask the host to run generation for this attempt with the given input. |
1040
+
1041
+ ---
1042
+
1043
+ ### MediaGenerationAttempt
1044
+
1045
+ ```ts
1046
+ type MediaGenerationAttempt = Disposable & object;
1047
+ ```
1048
+
1049
+ One generation attempt: a stable reference plus the ability to run (or retry)
1050
+ generation against it until disposed.
1051
+
1052
+ #### Type Declaration
1053
+
1054
+ | Name | Type | Description |
1055
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
1056
+ | `reference` | [`MediaGenerationReference`](#mediagenerationreference) | - |
1057
+ | `generate()` | (`input`, `options?`) => `Promise`\<`Readonly`\<\{ `bytes`: `number`; `costMilliunits`: `number`; `destination`: `Readonly`\<\{ `computerId`: `string`; `path`: `string`; \}\>; `format`: [`MediaOutputFormat`](#mediaoutputformat); `height`: `number`; `model`: `string`; `width`: `number`; \}\>\> | Run generation for this attempt and return the saved result, or throw MediaGenerationError on failure; an abort signal cancels it. |
1058
+
1059
+ ---
1060
+
1061
+ ### MediaGenerationSession
1062
+
1063
+ ```ts
1064
+ type MediaGenerationSession = Readonly<{
1065
+ computerId: string;
1066
+ canGenerate: boolean;
1067
+ models: readonly MediaModel[];
1068
+ createAttempt: Promise<MediaGenerationAttempt>;
1069
+ restoreAttempt: Promise<MediaGenerationAttempt>;
1070
+ }>;
1071
+ ```
1072
+
1073
+ The validated, App-facing handle returned by openMediaGeneration: the Computer's
1074
+ model catalog plus the ability to start or resume attempts.
1075
+
1076
+ ---
1077
+
1078
+ ### MediaGenerationReference
1079
+
1080
+ ```ts
1081
+ type MediaGenerationReference = Schema.Schema.Type<
1082
+ typeof mediaGenerationReferenceSchema
1083
+ >;
1084
+ ```
1085
+
1086
+ An opaque replay identity for one attempt; it identifies a request, not an
1087
+ authorization to use it.
1088
+
1089
+ ---
1090
+
1091
+ ### MediaModel
1092
+
1093
+ ```ts
1094
+ type MediaModel = Schema.Schema.Type<typeof mediaModelSchema>;
1095
+ ```
1096
+
1097
+ One generation model as the host describes it: identity, tier, input limits and
1098
+ supported output formats. The host owns the catalog.
1099
+
1100
+ ---
1101
+
1102
+ ### MediaGenerationSelection
1103
+
1104
+ ```ts
1105
+ type MediaGenerationSelection = Schema.Schema.Type<
1106
+ typeof mediaGenerationSelectionSchema
1107
+ >;
1108
+ ```
1109
+
1110
+ An App's generation settings: model, prompt, size and optional steps, duration
1111
+ and Computer-relative reference paths.
1112
+
1113
+ ---
1114
+
1115
+ ### Pending
1116
+
1117
+ ```ts
1118
+ type Pending = Readonly<z.output<typeof pendingSchema>>;
1119
+ ```
1120
+
1121
+ The shared polling result, owned by the App contract.
1122
+
1123
+ ---
1124
+
1125
+ ### AppRoot
1126
+
1127
+ ```ts
1128
+ type AppRoot = object;
1129
+ ```
1130
+
1131
+ The App's live connection to its host: its admitted capabilities, commands,
1132
+ context, theme, UI door and window, all torn down together by `dispose`.
1133
+ Returned by `connectApp` and passed to `mountApp`.
1134
+
1135
+ #### Properties
1136
+
1137
+ ##### capabilities
1138
+
1139
+ ```ts
1140
+ readonly capabilities: CapabilityDirectory;
1141
+ ```
1142
+
1143
+ ##### commands
1144
+
1145
+ ```ts
1146
+ readonly commands: AppCommands;
1147
+ ```
1148
+
1149
+ ##### context
1150
+
1151
+ ```ts
1152
+ readonly context: ReadonlyStore<AppContext>;
1153
+ ```
1154
+
1155
+ ##### identity
1156
+
1157
+ ```ts
1158
+ readonly identity: Readonly<AppIdentity>;
1159
+ ```
1160
+
1161
+ ##### lifecycle
1162
+
1163
+ ```ts
1164
+ readonly lifecycle: ReadonlyStore<AppLifecycle>;
1165
+ ```
1166
+
1167
+ ##### theme
1168
+
1169
+ ```ts
1170
+ readonly theme: ReadonlyStore<string>;
1171
+ ```
1172
+
1173
+ ##### ui
1174
+
1175
+ ```ts
1176
+ readonly ui: HostUi;
1177
+ ```
1178
+
1179
+ ##### window
1180
+
1181
+ ```ts
1182
+ readonly window: AppWindow;
1183
+ ```
1184
+
1185
+ #### Methods
1186
+
1187
+ ##### dispose()
1188
+
1189
+ ```ts
1190
+ dispose(): void;
1191
+ ```
1192
+
1193
+ End this App's connection to its host and release everything it owns.
1194
+
1195
+ ###### Returns
1196
+
1197
+ `void`
1198
+
1199
+ ---
1200
+
1201
+ ### Disposer
1202
+
1203
+ ```ts
1204
+ type Disposer = () => void;
1205
+ ```
1206
+
1207
+ Releases a subscription or other held resource. Call once; further calls are a
1208
+ no-op.
1209
+
1210
+ #### Returns
1211
+
1212
+ `void`
1213
+
1214
+ ---
1215
+
1216
+ ### ReadonlyStore
1217
+
1218
+ ```ts
1219
+ type ReadonlyStore<T> = object;
1220
+ ```
1221
+
1222
+ A retained SDK-owned snapshot.
1223
+
1224
+ #### Type Parameters
1225
+
1226
+ | Type Parameter |
1227
+ | -------------- |
1228
+ | `T` |
1229
+
1230
+ #### Methods
1231
+
1232
+ ##### get()
1233
+
1234
+ ```ts
1235
+ get(): T;
1236
+ ```
1237
+
1238
+ The current value; always available, even before any subscription.
1239
+
1240
+ ###### Returns
1241
+
1242
+ `T`
1243
+
1244
+ ##### subscribe()
1245
+
1246
+ ```ts
1247
+ subscribe(listener): Disposer;
1248
+ ```
1249
+
1250
+ Call `listener` on every change until the returned Disposer runs. Does not emit
1251
+ the current value immediately on subscribe.
1252
+
1253
+ ###### Parameters
1254
+
1255
+ | Parameter | Type |
1256
+ | ---------- | ------------------- |
1257
+ | `listener` | (`value`) => `void` |
1258
+
1259
+ ###### Returns
1260
+
1261
+ [`Disposer`](#disposer)
1262
+
1263
+ ---
1264
+
1265
+ ### HostUi
1266
+
1267
+ ```ts
1268
+ type HostUi = object;
1269
+ ```
1270
+
1271
+ Deliberately narrow shell affordances; domain work belongs to capabilities.
1272
+
1273
+ #### Methods
1274
+
1275
+ ##### requestComputerChoice()
1276
+
1277
+ ```ts
1278
+ requestComputerChoice(): Promise<void>;
1279
+ ```
1280
+
1281
+ Open the host-owned Computer picker; selection arrives through App context.
1282
+
1283
+ ###### Returns
1284
+
1285
+ `Promise`\<`void`\>
1286
+
1287
+ ##### requestBrowserAction()
1288
+
1289
+ ```ts
1290
+ requestBrowserAction(input): Promise<AppBrowserActionOutcome>;
1291
+ ```
1292
+
1293
+ Request a host browser action from a fresh user click in this App.
1294
+
1295
+ ###### Parameters
1296
+
1297
+ | Parameter | Type |
1298
+ | --------- | --------------------------------------- |
1299
+ | `input` | [`AppBrowserAction`](#appbrowseraction) |
1300
+
1301
+ ###### Returns
1302
+
1303
+ `Promise`\<[`AppBrowserActionOutcome`](#appbrowseractionoutcome)\>
1304
+
1305
+ ##### requestAppPermissions()
1306
+
1307
+ ```ts
1308
+ requestAppPermissions(input): Promise<AppPermissionOutcome>;
1309
+ ```
1310
+
1311
+ Ask the trusted host for App rights. The host, never the App, renders the
1312
+ consent and writes any grant; an empty request opens App permissions.
1313
+
1314
+ ###### Parameters
1315
+
1316
+ | Parameter | Type |
1317
+ | --------- | ----------------------------------------------- |
1318
+ | `input` | [`AppPermissionRequest`](#apppermissionrequest) |
1319
+
1320
+ ###### Returns
1321
+
1322
+ `Promise`\<[`AppPermissionOutcome`](#apppermissionoutcome)\>
1323
+
1324
+ ##### openNavigation()
1325
+
1326
+ ```ts
1327
+ openNavigation(input): Promise<void>;
1328
+ ```
1329
+
1330
+ Ask the host to open an already admitted Computer file.
1331
+
1332
+ ###### Parameters
1333
+
1334
+ | Parameter | Type |
1335
+ | --------- | --------------------------------------------- |
1336
+ | `input` | [`FileNavigationInput`](#filenavigationinput) |
1337
+
1338
+ ###### Returns
1339
+
1340
+ `Promise`\<`void`\>
1341
+
1342
+ ##### reportStatus()
1343
+
1344
+ ```ts
1345
+ reportStatus(items): Promise<void>;
1346
+ ```
1347
+
1348
+ Declare this window's status bar items, such as "2 documents" or a Ports button.
1349
+ The host renders them beside the Computer it owns; the newest report wins and an
1350
+ empty list clears them.
1351
+
1352
+ ###### Parameters
1353
+
1354
+ | Parameter | Type |
1355
+ | --------- | -------------------------------------------- |
1356
+ | `items` | readonly [`AppStatusItem`](#appstatusitem)[] |
1357
+
1358
+ ###### Returns
1359
+
1360
+ `Promise`\<`void`\>
1361
+
1362
+ ##### onStatusAction()
1363
+
1364
+ ```ts
1365
+ onStatusAction(handler): () => void;
1366
+ ```
1367
+
1368
+ Hear the person use one of this window's declared status items. One owner at a
1369
+ time; the host never renders App UI in its chrome.
1370
+
1371
+ ###### Parameters
1372
+
1373
+ | Parameter | Type |
1374
+ | --------- | --------------------------------------------------- |
1375
+ | `handler` | [`AppStatusActionHandler`](#appstatusactionhandler) |
1376
+
1377
+ ###### Returns
1378
+
1379
+ () => `void`
1380
+
1381
+ ##### openTeamBilling()
1382
+
1383
+ ```ts
1384
+ openTeamBilling(): Promise<void>;
1385
+ ```
1386
+
1387
+ Leave the App for the host's Billing page for this Team.
1388
+
1389
+ ###### Returns
1390
+
1391
+ `Promise`\<`void`\>
1392
+
1393
+ ##### openDesktopSettings()
1394
+
1395
+ ```ts
1396
+ openDesktopSettings(): Promise<void>;
1397
+ ```
1398
+
1399
+ Suggest this App's desktop Gills while focused with browser activation. The host
1400
+ shows a notice; the member must choose Review to open Settings. The App receives
1401
+ no layout or placement authority.
1402
+
1403
+ ###### Returns
1404
+
1405
+ `Promise`\<`void`\>
1406
+
1407
+ ##### reportAgentSessionSelection()
1408
+
1409
+ ```ts
1410
+ reportAgentSessionSelection(selection): Promise<void>;
1411
+ ```
1412
+
1413
+ Tell the host which Agent conversation this App currently has selected, or null
1414
+ when none is selected.
1415
+
1416
+ ###### Parameters
1417
+
1418
+ | Parameter | Type |
1419
+ | ----------- | ---------------------------------------------------------------------------- |
1420
+ | `selection` | \| `Readonly`\<\{ `agentId`: `string`; `sessionId`: `string`; \}\> \| `null` |
1421
+
1422
+ ###### Returns
1423
+
1424
+ `Promise`\<`void`\>
1425
+
1426
+ ##### showToast()
1427
+
1428
+ ```ts
1429
+ showToast(input): Promise<void>;
1430
+ ```
1431
+
1432
+ Ask the host to show a transient toast notification.
1433
+
1434
+ ###### Parameters
1435
+
1436
+ | Parameter | Type |
1437
+ | --------- | --------------------------- |
1438
+ | `input` | [`ToastInput`](#toastinput) |
1439
+
1440
+ ###### Returns
1441
+
1442
+ `Promise`\<`void`\>
1443
+
1444
+ ---
1445
+
1446
+ ### AppStatusIcon
1447
+
1448
+ ```ts
1449
+ type AppStatusIcon = "folder" | "ports" | "processes" | "access";
1450
+ ```
1451
+
1452
+ The marks a host can draw before a status button's label.
1453
+
1454
+ ---
1455
+
1456
+ ### AppStatusTone
1457
+
1458
+ ```ts
1459
+ type AppStatusTone = "neutral" | "success" | "warning" | "error";
1460
+ ```
1461
+
1462
+ A readout's live state, shown as a small light before its text.
1463
+
1464
+ ---
1465
+
1466
+ ### AppStatusOption
1467
+
1468
+ ```ts
1469
+ type AppStatusOption = Readonly<{
1470
+ id: string;
1471
+ text: string;
1472
+ checked?: boolean;
1473
+ disabled?: boolean;
1474
+ }>;
1475
+ ```
1476
+
1477
+ One choice in a status menu, such as a folder or a port.
1478
+
1479
+ ---
1480
+
1481
+ ### AppStatusItem
1482
+
1483
+ ```ts
1484
+ type AppStatusItem =
1485
+ | Readonly<{
1486
+ id: string;
1487
+ text: string;
1488
+ end?: boolean;
1489
+ kind: "text";
1490
+ tone?: AppStatusTone;
1491
+ }>
1492
+ | Readonly<{
1493
+ id: string;
1494
+ text: string;
1495
+ end?: boolean;
1496
+ kind: "button";
1497
+ icon?: AppStatusIcon;
1498
+ count?: number;
1499
+ title?: string;
1500
+ disabled?: boolean;
1501
+ opens?: "dialog";
1502
+ expanded?: boolean;
1503
+ }>
1504
+ | Readonly<{
1505
+ id: string;
1506
+ text: string;
1507
+ end?: boolean;
1508
+ kind: "toggle";
1509
+ pressed: boolean;
1510
+ }>
1511
+ | Readonly<{
1512
+ id: string;
1513
+ text: string;
1514
+ end?: boolean;
1515
+ kind: "menu";
1516
+ count?: number;
1517
+ title?: string;
1518
+ options: readonly AppStatusOption[];
1519
+ }>;
1520
+ ```
1521
+
1522
+ One item an App declares for its window's status bar, as data: a readout, a
1523
+ button, a toggle, or a menu of choices. Using one delivers an
1524
+ [AppStatusAction](#appstatusaction) back to the App.
1525
+
1526
+ ---
1527
+
1528
+ ### AppStatusAction
1529
+
1530
+ ```ts
1531
+ type AppStatusAction = Readonly<{
1532
+ itemId: string;
1533
+ optionId?: string;
1534
+ anchor?: Readonly<{
1535
+ start: number;
1536
+ width: number;
1537
+ }>;
1538
+ }>;
1539
+ ```
1540
+
1541
+ The person used a status item; `optionId` names a chosen menu option. `anchor`
1542
+ is where the item sits along the App's surface, in CSS pixels from its inline
1543
+ start, so App UI it opens can sit above it.
1544
+
1545
+ ---
1546
+
1547
+ ### AppStatusActionHandler
1548
+
1549
+ ```ts
1550
+ type AppStatusActionHandler = (action) => boolean | Promise<boolean>;
1551
+ ```
1552
+
1553
+ Handles one status action; `true` when the App acted on it.
1554
+
1555
+ #### Parameters
1556
+
1557
+ | Parameter | Type |
1558
+ | --------- | ------------------------------------- |
1559
+ | `action` | [`AppStatusAction`](#appstatusaction) |
1560
+
1561
+ #### Returns
1562
+
1563
+ `boolean` \| `Promise`\<`boolean`\>
1564
+
1565
+ ---
1566
+
1567
+ ### AgentSessionSelection
1568
+
1569
+ ```ts
1570
+ type AgentSessionSelection = Readonly<{
1571
+ agentId: string;
1572
+ sessionId: string;
1573
+ }>;
1574
+ ```
1575
+
1576
+ Exact Agent conversation selected by an App for the authenticated shell.
1577
+
1578
+ ---
1579
+
1580
+ ### FileNavigationInput
1581
+
1582
+ ```ts
1583
+ type FileNavigationInput = object;
1584
+ ```
1585
+
1586
+ A presentation-neutral request to open an already admitted Computer file.
1587
+
1588
+ #### Properties
1589
+
1590
+ ##### computerId
1591
+
1592
+ ```ts
1593
+ readonly computerId: string;
1594
+ ```
1595
+
1596
+ ##### path
1597
+
1598
+ ```ts
1599
+ readonly path: string;
1600
+ ```
1601
+
1602
+ ---
1603
+
1604
+ ### ToastInput
1605
+
1606
+ ```ts
1607
+ type ToastInput = object;
1608
+ ```
1609
+
1610
+ A transient notification an App asks its host to show.
1611
+
1612
+ #### Properties
1613
+
1614
+ ##### message
1615
+
1616
+ ```ts
1617
+ readonly message: string;
1618
+ ```
1619
+
1620
+ ##### tone?
1621
+
1622
+ ```ts
1623
+ readonly optional tone?: "error" | "info" | "success" | "warning";
1624
+ ```
1625
+
1626
+ ---
1627
+
1628
+ ### AgentAccessOperation
1629
+
1630
+ ```ts
1631
+ type AgentAccessOperation =
1632
+ "agent.list" | "agent.manage" | "agent.read" | "agent.send";
1633
+ ```
1634
+
1635
+ Agent rights an App may ask its host to grant through consent.
1636
+
1637
+ ---
1638
+
1639
+ ### ComputerAccessOperation
1640
+
1641
+ ```ts
1642
+ type ComputerAccessOperation =
1643
+ | "computer.list"
1644
+ | "computer.readFile"
1645
+ | "computer.writeFile"
1646
+ | "computer.execute";
1647
+ ```
1648
+
1649
+ Computer rights an App may ask its host to grant through consent.
1650
+
1651
+ ---
1652
+
1653
+ ### AppPermissionRequest
1654
+
1655
+ ```ts
1656
+ type AppPermissionRequest = Readonly<{
1657
+ agents?: readonly AgentAccessOperation[];
1658
+ computers?: readonly ComputerAccessOperation[];
1659
+ }>;
1660
+ ```
1661
+
1662
+ The rights an App asks for; the host bounds them by its declared ceiling.
1663
+
1664
+ ---
1665
+
1666
+ ### AppPermissionOutcome
1667
+
1668
+ ```ts
1669
+ type AppPermissionOutcome = "granted" | "declined" | "customize";
1670
+ ```
1671
+
1672
+ `granted`: the host saved a grant covering the request. `declined`: the user
1673
+ said not now. `customize`: the host opened its full permission settings.
1674
+
1675
+ ---
1676
+
1677
+ ### AppBrowserAction
1678
+
1679
+ ```ts
1680
+ type AppBrowserAction =
1681
+ | Readonly<{
1682
+ kind: "saveFile";
1683
+ name: string;
1684
+ mime: string;
1685
+ bytes: Uint8Array;
1686
+ }>
1687
+ | Readonly<{
1688
+ kind: "copyText";
1689
+ text: string;
1690
+ }>;
1691
+ ```
1692
+
1693
+ Data only; browser authority and the gesture check belong to the host.
1694
+
1695
+ ---
1696
+
1697
+ ### AppBrowserActionRefusal
1698
+
1699
+ ```ts
1700
+ type AppBrowserActionRefusal = Readonly<{
1701
+ kind: "refused";
1702
+ reason:
1703
+ | "no-user-gesture"
1704
+ | "too-large"
1705
+ | "invalid-request"
1706
+ | "unavailable"
1707
+ | "denied"
1708
+ | "busy";
1709
+ }>;
1710
+ ```
1711
+
1712
+ A browser action can be refused without disconnecting the App.
1713
+
1714
+ ---
1715
+
1716
+ ### AppBrowserActionOutcome
1717
+
1718
+ ```ts
1719
+ type AppBrowserActionOutcome =
1720
+ | Readonly<{
1721
+ kind: "saved";
1722
+ }>
1723
+ | Readonly<{
1724
+ kind: "copied";
1725
+ }>
1726
+ | AppBrowserActionRefusal;
1727
+ ```
1728
+
1729
+ Saved means a browser download was initiated, not a confirmed disk write.
1730
+
1731
+ ---
1732
+
1733
+ ### BeforeAppClose
1734
+
1735
+ ```ts
1736
+ type BeforeAppClose = () => boolean | Promise<boolean>;
1737
+ ```
1738
+
1739
+ Consulted before the person closes the App's window; return (or resolve) `true`
1740
+ to allow the close.
1741
+
1742
+ #### Returns
1743
+
1744
+ `boolean` \| `Promise`\<`boolean`\>
1745
+
1746
+ ---
1747
+
1748
+ ### AppNavigationState
1749
+
1750
+ ```ts
1751
+ type AppNavigationState = Readonly<{
1752
+ canGoBack: boolean;
1753
+ title?: string;
1754
+ }>;
1755
+ ```
1756
+
1757
+ What the App's own router can do right now. The App owns its history; the host
1758
+ only offers a Back affordance and relays the person's request.
1759
+
1760
+ ---
1761
+
1762
+ ### AppBackHandler
1763
+
1764
+ ```ts
1765
+ type AppBackHandler = () => boolean | Promise<boolean>;
1766
+ ```
1767
+
1768
+ Go back one step in the App's own history; `true` when it moved.
1769
+
1770
+ #### Returns
1771
+
1772
+ `boolean` \| `Promise`\<`boolean`\>
1773
+
1774
+ ---
1775
+
1776
+ ### HostNavigation
1777
+
1778
+ ```ts
1779
+ type HostNavigation = Readonly<{
1780
+ publish: Promise<void>;
1781
+ onBack: Disposer;
1782
+ }>;
1783
+ ```
1784
+
1785
+ The App's half of the host navigation contract.
1786
+
1787
+ ---
1788
+
1789
+ ### AppWindow
1790
+
1791
+ ```ts
1792
+ type AppWindow = Readonly<{
1793
+ onBeforeClose: Disposer;
1794
+ navigation: HostNavigation;
1795
+ }>;
1796
+ ```
1797
+
1798
+ App-owned presentation policy consulted before a user closes its window.
1799
+
1800
+ ## Variables
1801
+
1802
+ ### FungiAuthorSchema
1803
+
1804
+ ```ts
1805
+ const FungiAuthorSchema: ZodObject<
1806
+ {
1807
+ id: ZodString;
1808
+ name: ZodString;
1809
+ },
1810
+ $strict
1811
+ >;
1812
+ ```
1813
+
1814
+ Who a Session line came from, as the admitting host authenticated them.
1815
+
1816
+ ---
1817
+
1818
+ ### FungiDelegationReplySchema
1819
+
1820
+ ```ts
1821
+ const FungiDelegationReplySchema: ZodObject<
1822
+ {
1823
+ agentId: ZodString;
1824
+ sessionId: ZodString;
1825
+ commandId: ZodString;
1826
+ outcome: ZodEnum<{
1827
+ completed: "completed";
1828
+ failed: "failed";
1829
+ interrupted: "interrupted";
1830
+ cancelled: "cancelled";
1831
+ outcome_unknown: "outcome_unknown";
1832
+ }>;
1833
+ diagnostic: ZodOptional<ZodString>;
1834
+ },
1835
+ $strict
1836
+ >;
1837
+ ```
1838
+
1839
+ A delegated Agent's reply as the admitting host authenticated it against the
1840
+ mail it sent. `commandId` is the replying Session's accepted command, the same
1841
+ id as the sender's `agents.send` receipt.
1842
+
1843
+ ---
1844
+
1845
+ ### FungiMessageMetaSchema
1846
+
1847
+ ```ts
1848
+ const FungiMessageMetaSchema: ZodObject<
1849
+ {
1850
+ author: ZodOptional<
1851
+ ZodObject<
1852
+ {
1853
+ id: ZodString;
1854
+ name: ZodString;
1855
+ },
1856
+ $strict
1857
+ >
1858
+ >;
1859
+ delegation: ZodOptional<
1860
+ ZodObject<
1861
+ {
1862
+ ancestors: ZodArray<ZodString>;
1863
+ maxDepth: ZodNumber;
1864
+ reply: ZodOptional<
1865
+ ZodObject<
1866
+ {
1867
+ agentId: ZodString;
1868
+ sessionId: ZodString;
1869
+ commandId: ZodString;
1870
+ outcome: ZodEnum<{
1871
+ completed: "completed";
1872
+ failed: "failed";
1873
+ interrupted: "interrupted";
1874
+ cancelled: "cancelled";
1875
+ outcome_unknown: "outcome_unknown";
1876
+ }>;
1877
+ diagnostic: ZodOptional<ZodString>;
1878
+ },
1879
+ $strict
1880
+ >
1881
+ >;
1882
+ },
1883
+ $strict
1884
+ >
1885
+ >;
1886
+ },
1887
+ $strict
1888
+ >;
1889
+ ```
1890
+
1891
+ The metadata the host attaches to every prompt and operator line it admits.
1892
+ Shiitake stores it opaquely; the host writes it and Apps read it.
1893
+
1894
+ ---
1895
+
1896
+ ### appAgentSchema
1897
+
1898
+ ```ts
1899
+ const appAgentSchema: Struct<{
1900
+ agentId: String;
1901
+ name: String;
1902
+ sessionOperations: $Array<
1903
+ Literals<readonly ["agent.read", "agent.send", "agent.manage"]>
1904
+ >;
1905
+ }>;
1906
+ ```
1907
+
1908
+ Validates the wire shape of an Agent record: its id, display name, and which
1909
+ session operations (read, send, manage) this App may perform on it.
1910
+
1911
+ ---
1912
+
1913
+ ### appAgentCreateInputSchema
1914
+
1915
+ ```ts
1916
+ const appAgentCreateInputSchema: Struct<{
1917
+ name: String;
1918
+ requestId: String;
1919
+ computer: optionalKey<Literals<readonly ["new", "none"]>>;
1920
+ }>;
1921
+ ```
1922
+
1923
+ Validates Agent creation input: a name, a caller-chosen request id and an
1924
+ optional Computer provisioning choice.
1925
+
1926
+ ---
1927
+
1928
+ ### agentList
1929
+
1930
+ ```ts
1931
+ const agentList: CapabilityContract<AppAgentListHandle>;
1932
+ ```
1933
+
1934
+ Capability to list the Agents visible to this App in read-only form.
1935
+
1936
+ ---
1937
+
1938
+ ### agentManage
1939
+
1940
+ ```ts
1941
+ const agentManage: CapabilityContract<
1942
+ Pick<AppAgentDirectoryHandle, "create" | "open">
1943
+ >;
1944
+ ```
1945
+
1946
+ Capability to create new Agents and open transports to them.
1947
+
1948
+ ---
1949
+
1950
+ ### appAgentRenameInputSchema
1951
+
1952
+ ```ts
1953
+ const appAgentRenameInputSchema: Struct<{
1954
+ agentId: String;
1955
+ name: String;
1956
+ }>;
1957
+ ```
1958
+
1959
+ Validates Agent rename input: the target Agent and its new display name.
1960
+
1961
+ ---
1962
+
1963
+ ### agentRename
1964
+
1965
+ ```ts
1966
+ const agentRename: CapabilityContract<AppAgentRenameHandle>;
1967
+ ```
1968
+
1969
+ Owner-only capability to rename an existing Agent; not every host grants it.
1970
+
1971
+ ---
1972
+
1973
+ ### appAgentToolPolicyStatusSchema
1974
+
1975
+ ```ts
1976
+ const appAgentToolPolicyStatusSchema: ZodUnion<
1977
+ readonly [
1978
+ ZodObject<
1979
+ {
1980
+ status: ZodLiteral<"pending">;
1981
+ revision: ZodString;
1982
+ },
1983
+ $strip
1984
+ >,
1985
+ ZodObject<
1986
+ {
1987
+ status: ZodLiteral<"approved">;
1988
+ revision: ZodString;
1989
+ },
1990
+ $strip
1991
+ >,
1992
+ ]
1993
+ >;
1994
+ ```
1995
+
1996
+ One Agent's App-tool policy, as the owner-only policy capability reports it.
1997
+
1998
+ ---
1999
+
2000
+ ### appAgentToolPolicyResultSchema
2001
+
2002
+ ```ts
2003
+ const appAgentToolPolicyResultSchema: ZodUnion<
2004
+ readonly [
2005
+ ZodUnion<
2006
+ readonly [
2007
+ ZodObject<
2008
+ {
2009
+ status: ZodLiteral<"pending">;
2010
+ revision: ZodString;
2011
+ },
2012
+ $strip
2013
+ >,
2014
+ ZodObject<
2015
+ {
2016
+ status: ZodLiteral<"approved">;
2017
+ revision: ZodString;
2018
+ },
2019
+ $strip
2020
+ >,
2021
+ ]
2022
+ >,
2023
+ ZodObject<
2024
+ {
2025
+ error: ZodString;
2026
+ },
2027
+ $strip
2028
+ >,
2029
+ ]
2030
+ >;
2031
+ ```
2032
+
2033
+ The outcome of an owner's direct App-tool approval.
2034
+
2035
+ ---
2036
+
2037
+ ### agentToolPolicy
2038
+
2039
+ ```ts
2040
+ const agentToolPolicy: CapabilityContract<AppAgentToolPolicyHandle>;
2041
+ ```
2042
+
2043
+ Owner-only capability to read and approve an Agent's App-tool policy.
2044
+
2045
+ ---
2046
+
2047
+ ### agentSessionRead
2048
+
2049
+ ```ts
2050
+ const agentSessionRead: CapabilityContract<
2051
+ Pick<AppAgentDirectoryHandle, "open" | "openInbox">
2052
+ >;
2053
+ ```
2054
+
2055
+ Capability for read-only Agent sessions: open a transport to an existing Agent,
2056
+ or read the member's inbox feed.
2057
+
2058
+ ---
2059
+
2060
+ ### agentSessionWrite
2061
+
2062
+ ```ts
2063
+ const agentSessionWrite: CapabilityContract<
2064
+ Pick<AppAgentDirectoryHandle, "open" | "openInbox">
2065
+ >;
2066
+ ```
2067
+
2068
+ Capability for read-write Agent sessions: open a transport to an existing Agent
2069
+ and send to it, including the member's inbox feed.
2070
+
2071
+ ---
2072
+
2073
+ ### APP\_PROTOCOL\_VERSION
2074
+
2075
+ ```ts
2076
+ const APP_PROTOCOL_VERSION: 2;
2077
+ ```
2078
+
2079
+ The iframe handshake version both App and host must speak.
2080
+
2081
+ ---
2082
+
2083
+ ### APP\_READY\_TYPE
2084
+
2085
+ ```ts
2086
+ const APP_READY_TYPE: "fungi.app.ready";
2087
+ ```
2088
+
2089
+ Message type the App iframe posts to announce it is ready to connect.
2090
+
2091
+ ---
2092
+
2093
+ ### APP\_CONNECT\_TYPE
2094
+
2095
+ ```ts
2096
+ const APP_CONNECT_TYPE: "fungi.app.connect";
2097
+ ```
2098
+
2099
+ Message type the host posts to hand the App its RPC MessagePort.
2100
+
2101
+ ---
2102
+
2103
+ ### parseAppStatusItems
2104
+
2105
+ ```ts
2106
+ const parseAppStatusItems: (...a) => readonly AppStatusItem[];
2107
+ ```
2108
+
2109
+ Both edges: one window's status items, bounded and copied.
2110
+
2111
+ #### Parameters
2112
+
2113
+ | Parameter | Type |
2114
+ | --------- | ----------------------------- |
2115
+ | ...`a` | \[`unknown`, `ParseOptions`\] |
2116
+
2117
+ #### Returns
2118
+
2119
+ readonly [`AppStatusItem`](#appstatusitem)[]
2120
+
2121
+ ---
2122
+
2123
+ ### parseAppStatusAction
2124
+
2125
+ ```ts
2126
+ const parseAppStatusAction: (...a) => C;
2127
+ ```
2128
+
2129
+ App edge: the status item the person used, as the host relays it.
2130
+
2131
+ #### Parameters
2132
+
2133
+ | Parameter | Type |
2134
+ | --------- | ----------------------------- |
2135
+ | ...`a` | \[`unknown`, `ParseOptions`\] |
2136
+
2137
+ #### Returns
2138
+
2139
+ `C`
2140
+
2141
+ ---
2142
+
2143
+ ### mediaGenerationReferenceSchema
2144
+
2145
+ ```ts
2146
+ const mediaGenerationReferenceSchema: Struct<{
2147
+ requestId: String;
2148
+ computerId: String;
2149
+ }>;
2150
+ ```
2151
+
2152
+ A replay identity, never an authorization capability.
2153
+
2154
+ ---
2155
+
2156
+ ### mediaModelSchema
2157
+
2158
+ ```ts
2159
+ const mediaModelSchema: Struct<{
2160
+ id: String;
2161
+ input: Struct<{
2162
+ defaultHeight: Number;
2163
+ defaultSteps: NullOr<Number>;
2164
+ defaultWidth: Number;
2165
+ dimensions: Literals<readonly ["none", "own"]>;
2166
+ maxDimension: NullOr<Number>;
2167
+ maxReferences: Number;
2168
+ maxSteps: NullOr<Number>;
2169
+ referenceField: NullOr<String>;
2170
+ steps: Literals<readonly ["steps", "num_steps", "fixed"]>;
2171
+ transport: Literals<readonly ["json", "multipart"]>;
2172
+ }>;
2173
+ kind: Literals<readonly ["image", "video"]>;
2174
+ label: String;
2175
+ tier: Literals<readonly ["draft", "balanced", "premium", "max"]>;
2176
+ outputFormats: $Array<Literals<readonly ["png", "jpeg", "webp"]>>;
2177
+ sizes: NullOr<$Array<String>>;
2178
+ video: NullOr<
2179
+ Struct<{
2180
+ minSeconds: Number;
2181
+ maxSeconds: Number;
2182
+ defaultSeconds: Number;
2183
+ durations: $Array<Number>;
2184
+ provider: Literals<readonly ["seedance", "veo", "minimax"]>;
2185
+ formats: $Array<
2186
+ Struct<{
2187
+ resolution: Literals<
2188
+ readonly ["480p", "720p", "768p", "1080p", "4k"]
2189
+ >;
2190
+ aspectRatio: Literals<
2191
+ readonly ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "9:21"]
2192
+ >;
2193
+ width: Number;
2194
+ height: Number;
2195
+ }>
2196
+ >;
2197
+ defaultResolution: Literals<
2198
+ readonly ["480p", "720p", "768p", "1080p", "4k"]
2199
+ >;
2200
+ defaultAspectRatio: Literals<
2201
+ readonly ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "9:21"]
2202
+ >;
2203
+ defaultGenerateAudio: NullOr<Boolean>;
2204
+ maxPromptLength: Number;
2205
+ referenceRoles: $Array<
2206
+ Literals<readonly ["first-frame", "last-frame", "reference"]>
2207
+ >;
2208
+ maxReferenceImages: Number;
2209
+ referenceResolutions: $Array<
2210
+ Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>
2211
+ >;
2212
+ prices: $Array<
2213
+ Struct<{
2214
+ resolution: Literals<
2215
+ readonly ["480p", "720p", "768p", "1080p", "4k"]
2216
+ >;
2217
+ silentMilliunitsPerSecond: Number;
2218
+ audioMilliunitsPerSecond: Number;
2219
+ }>
2220
+ >;
2221
+ }>
2222
+ >;
2223
+ }>;
2224
+ ```
2225
+
2226
+ Validates one model row of the host's Media catalog.
2227
+
2228
+ ---
2229
+
2230
+ ### mediaGenerationSelectionSchema
2231
+
2232
+ ```ts
2233
+ const mediaGenerationSelectionSchema: Struct<{
2234
+ model: String;
2235
+ prompt: String;
2236
+ width: Number;
2237
+ height: Number;
2238
+ steps: optional<Number>;
2239
+ durationSeconds: optional<Number>;
2240
+ resolution: optional<
2241
+ Literals<readonly ["480p", "720p", "768p", "1080p", "4k"]>
2242
+ >;
2243
+ aspectRatio: optional<
2244
+ Literals<readonly ["16:9", "4:3", "1:1", "3:4", "9:16", "21:9", "9:21"]>
2245
+ >;
2246
+ generateAudio: optional<Boolean>;
2247
+ references: optional<
2248
+ $Array<
2249
+ Struct<{
2250
+ path: String;
2251
+ role: optional<
2252
+ Literals<readonly ["first-frame", "last-frame", "reference"]>
2253
+ >;
2254
+ }>
2255
+ >
2256
+ >;
2257
+ }>;
2258
+ ```
2259
+
2260
+ Validates the shape of an App's generation settings. Model-specific limits
2261
+ (sizes, steps, durations, reference counts) and defaults are the host's: it
2262
+ checks the selection against its catalog when it accepts a generation.
2263
+
2264
+ ---
2265
+
2266
+ ### mediaGenerationFailureSchema
2267
+
2268
+ ```ts
2269
+ const mediaGenerationFailureSchema: Struct<{
2270
+ message: String;
2271
+ stage: optional<
2272
+ Literals<
2273
+ readonly [
2274
+ "admission",
2275
+ "generation-authorization",
2276
+ "settings",
2277
+ "estimate",
2278
+ "billing",
2279
+ "operation",
2280
+ "provider",
2281
+ "normalization",
2282
+ "artifact",
2283
+ "destination-authorization",
2284
+ "destination-write",
2285
+ ]
2286
+ >
2287
+ >;
2288
+ code: Literals<
2289
+ readonly [
2290
+ "CANCELLED",
2291
+ "CAPABILITY_DENIED",
2292
+ "CAPABILITY_REVOKED",
2293
+ "DISCONNECTED",
2294
+ "HOST_FAILURE",
2295
+ "IDENTITY",
2296
+ "INSUFFICIENT_CREDIT",
2297
+ "INVALID_ARGUMENT",
2298
+ "PROTOCOL",
2299
+ "SAFETY_FILTER_REFUSED",
2300
+ "TIMEOUT",
2301
+ ]
2302
+ >;
2303
+ retryable: Boolean;
2304
+ }>;
2305
+ ```
2306
+
2307
+ Validates the typed failure a host reports for a generation attempt.
2308
+
2309
+ ---
2310
+
2311
+ ### mediaGeneration
2312
+
2313
+ ```ts
2314
+ const mediaGeneration: CapabilityContract<MediaGenerationHandle>;
2315
+ ```
2316
+
2317
+ Capability contract for generating Media (images or video). Apps declare it to
2318
+ request access; openMediaGeneration uses it to obtain the host's handle.
2319
+
2320
+ ---
2321
+
2322
+ ### pendingSchema
2323
+
2324
+ ```ts
2325
+ const pendingSchema: ZodObject<
2326
+ {
2327
+ kind: ZodLiteral<"pending">;
2328
+ retryAfterMs: ZodNumber;
2329
+ },
2330
+ $strict
2331
+ >;
2332
+ ```
2333
+
2334
+ An opted-in App method is still working; poll again after this bounded delay.
2335
+
2336
+ ---
2337
+
2338
+ ### APP\_STATUS\_ITEMS\_MAX
2339
+
2340
+ ```ts
2341
+ const APP_STATUS_ITEMS_MAX: 6 = 6;
2342
+ ```
2343
+
2344
+ The most readouts one App window's status bar shows.
2345
+
2346
+ ---
2347
+
2348
+ ### APP\_STATUS\_TEXT\_MAX
2349
+
2350
+ ```ts
2351
+ const APP_STATUS_TEXT_MAX: 80 = 80;
2352
+ ```
2353
+
2354
+ The longest readout a window's status bar shows.
2355
+
2356
+ ---
2357
+
2358
+ ### APP\_STATUS\_OPTIONS\_MAX
2359
+
2360
+ ```ts
2361
+ const APP_STATUS_OPTIONS_MAX: 16 = 16;
2362
+ ```
2363
+
2364
+ The most choices one status menu offers.
2365
+
2366
+ ---
2367
+
2368
+ ### APP\_BROWSER\_SAVE\_MAX\_BYTES
2369
+
2370
+ ```ts
2371
+ const APP_BROWSER_SAVE_MAX_BYTES: number;
2372
+ ```
2373
+
2374
+ Maximum file size sent through the user-initiated host browser door.
2375
+
2376
+ ---
2377
+
2378
+ ### APP\_BROWSER\_COPY\_MAX\_BYTES
2379
+
2380
+ ```ts
2381
+ const APP_BROWSER_COPY_MAX_BYTES: number;
2382
+ ```
2383
+
2384
+ Maximum UTF-8 text size sent to the host clipboard.
2385
+
2386
+ ---
2387
+
2388
+ ### APP\_NAVIGATION\_CONTRACT\_VERSION
2389
+
2390
+ ```ts
2391
+ const APP_NAVIGATION_CONTRACT_VERSION: 1;
2392
+ ```
2393
+
2394
+ Version of the navigation contract an App publishes. The host rejects any other
2395
+ version, so a future shape can never be misread as this one.
2396
+
2397
+ ---
2398
+
2399
+ ### APP\_NAVIGATION\_TITLE\_MAX
2400
+
2401
+ ```ts
2402
+ const APP_NAVIGATION_TITLE_MAX: 80 = 80;
2403
+ ```
2404
+
2405
+ The longest page title a host shows beside the App's own name.
2406
+
2407
+ ---
2408
+
2409
+ ### inertHostNavigation
2410
+
2411
+ ```ts
2412
+ const inertHostNavigation: HostNavigation;
2413
+ ```
2414
+
2415
+ Navigation for a root with no host chrome, such as a workbench fixture: it
2416
+ accepts every report and never asks the App to go back.
2417
+
2418
+ ## Functions
2419
+
2420
+ ### messageAuthor()
2421
+
2422
+ ```ts
2423
+ function messageAuthor(meta):
2424
+ | {
2425
+ id: string;
2426
+ name: string;
2427
+ }
2428
+ | undefined;
2429
+ ```
2430
+
2431
+ The author a message's metadata names; none for anything else.
2432
+
2433
+ #### Parameters
2434
+
2435
+ | Parameter | Type |
2436
+ | --------- | ------------------------------------------------------ |
2437
+ | `meta` | [`MessageMetaValue`](#messagemetavalue) \| `undefined` |
2438
+
2439
+ #### Returns
2440
+
2441
+ \| \{ `id`: `string`; `name`: `string`; \} \| `undefined`
2442
+
2443
+ ---
2444
+
2445
+ ### messageDelegationReply()
2446
+
2447
+ ```ts
2448
+ function messageDelegationReply(meta):
2449
+ | {
2450
+ agentId: string;
2451
+ sessionId: string;
2452
+ commandId: string;
2453
+ outcome:
2454
+ | "completed"
2455
+ | "failed"
2456
+ | "interrupted"
2457
+ | "cancelled"
2458
+ | "outcome_unknown";
2459
+ diagnostic?: string;
2460
+ }
2461
+ | undefined;
2462
+ ```
2463
+
2464
+ The authenticated delegation reply a message's metadata carries; none for any
2465
+ other line, including text that merely looks like a reply.
2466
+
2467
+ #### Parameters
2468
+
2469
+ | Parameter | Type |
2470
+ | --------- | ------------------------------------------------------ |
2471
+ | `meta` | [`MessageMetaValue`](#messagemetavalue) \| `undefined` |
2472
+
2473
+ #### Returns
2474
+
2475
+ ##### Type Literal
2476
+
2477
+ ```ts
2478
+ {
2479
+ agentId: string;
2480
+ sessionId: string;
2481
+ commandId: string;
2482
+ outcome: "completed" | "failed" | "interrupted" | "cancelled" | "outcome_unknown";
2483
+ diagnostic?: string;
2484
+ }
2485
+ ```
2486
+
2487
+ | Name | Type | Default value | Description |
2488
+ | ------------- | -------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------ |
2489
+ | `agentId` | `string` | `identifier` | - |
2490
+ | `sessionId` | `string` | `identifier` | - |
2491
+ | `commandId` | `string` | `identifier` | - |
2492
+ | `outcome` | `"completed"` \| `"failed"` \| `"interrupted"` \| `"cancelled"` \| `"outcome_unknown"` | - | The exact settlement outcome; failures are never collapsed. |
2493
+ | `diagnostic?` | `string` | - | Bounded, single-line terminal diagnostic for work that did not complete. |
2494
+
2495
+ ---
2496
+
2497
+ `undefined`
2498
+
2499
+ ---
2500
+
2501
+ ### authorMeta()
2502
+
2503
+ ```ts
2504
+ function authorMeta(author): AuthorMeta;
2505
+ ```
2506
+
2507
+ The metadata the host attaches for one authenticated author.
2508
+
2509
+ #### Parameters
2510
+
2511
+ | Parameter | Type |
2512
+ | ------------- | --------------------------------------- |
2513
+ | `author` | \{ `id`: `string`; `name`: `string`; \} |
2514
+ | `author.id` | `string` |
2515
+ | `author.name` | `string` |
2516
+
2517
+ #### Returns
2518
+
2519
+ [`AuthorMeta`](#authormeta)
2520
+
2521
+ ---
2522
+
2523
+ ### renameAppAgent()
2524
+
2525
+ ```ts
2526
+ function renameAppAgent(
2527
+ capabilities,
2528
+ input,
2529
+ ): Promise<{
2530
+ agentId: string;
2531
+ name: string;
2532
+ sessionOperations: readonly ("agent.manage" | "agent.read" | "agent.send")[];
2533
+ }>;
2534
+ ```
2535
+
2536
+ Rename an Agent through the host-granted owner-only capability.
2537
+
2538
+ #### Parameters
2539
+
2540
+ | Parameter | Type |
2541
+ | -------------- | --------------------------------------------- |
2542
+ | `capabilities` | [`CapabilityDirectory`](#capabilitydirectory) |
2543
+ | `input` | [`AppAgentRenameInput`](#appagentrenameinput) |
2544
+
2545
+ #### Returns
2546
+
2547
+ `Promise`\<\{ `agentId`: `string`; `name`: `string`; `sessionOperations`:
2548
+ readonly (`"agent.manage"` \| `"agent.read"` \| `"agent.send"`)[]; \}\>
2549
+
2550
+ ---
2551
+
2552
+ ### listAppAgents()
2553
+
2554
+ ```ts
2555
+ function listAppAgents(capabilities): Promise<readonly object[]>;
2556
+ ```
2557
+
2558
+ List the Agents in the host-granted Team or local-project scope.
2559
+
2560
+ #### Parameters
2561
+
2562
+ | Parameter | Type |
2563
+ | -------------- | --------------------------------------------- |
2564
+ | `capabilities` | [`CapabilityDirectory`](#capabilitydirectory) |
2565
+
2566
+ #### Returns
2567
+
2568
+ `Promise`\<readonly `object`[]\>
2569
+
2570
+ ---
2571
+
2572
+ ### createAppAgent()
2573
+
2574
+ ```ts
2575
+ function createAppAgent(
2576
+ capabilities,
2577
+ input,
2578
+ ): Promise<{
2579
+ agentId: string;
2580
+ name: string;
2581
+ sessionOperations: readonly ("agent.manage" | "agent.read" | "agent.send")[];
2582
+ }>;
2583
+ ```
2584
+
2585
+ Create an Agent through the Team directory selected by the host.
2586
+
2587
+ #### Parameters
2588
+
2589
+ | Parameter | Type |
2590
+ | -------------- | --------------------------------------------- |
2591
+ | `capabilities` | [`CapabilityDirectory`](#capabilitydirectory) |
2592
+ | `input` | [`AppAgentCreateInput`](#appagentcreateinput) |
2593
+
2594
+ #### Returns
2595
+
2596
+ `Promise`\<\{ `agentId`: `string`; `name`: `string`; `sessionOperations`:
2597
+ readonly (`"agent.manage"` \| `"agent.read"` \| `"agent.send"`)[]; \}\>
2598
+
2599
+ ---
2600
+
2601
+ ### openAppAgent()
2602
+
2603
+ ```ts
2604
+ function openAppAgent(
2605
+ capabilities,
2606
+ input,
2607
+ ): Promise<
2608
+ Readonly<{
2609
+ baseUrl: string;
2610
+ fetch: {
2611
+ (input, init?): Promise<Response>;
2612
+ (input, init?): Promise<Response>;
2613
+ };
2614
+ close: () => Promise<void>;
2615
+ }>
2616
+ >;
2617
+ ```
2618
+
2619
+ Adapt one live object capability to Fetch without exposing the parent's
2620
+ authenticated URL or credentials to the isolated App.
2621
+
2622
+ #### Parameters
2623
+
2624
+ | Parameter | Type |
2625
+ | --------------- | --------------------------------------------- |
2626
+ | `capabilities` | [`CapabilityDirectory`](#capabilitydirectory) |
2627
+ | `input` | \{ `agentId`: `string`; \} |
2628
+ | `input.agentId` | `string` |
2629
+
2630
+ #### Returns
2631
+
2632
+ `Promise`\<`Readonly`\<\{ `baseUrl`: `string`; `fetch`: \{ (`input`, `init?`):
2633
+ `Promise`\<`Response`\>; (`input`, `init?`): `Promise`\<`Response`\>; \};
2634
+ `close`: () => `Promise`\<`void`\>; \}\>\>
2635
+
2636
+ ---
2637
+
2638
+ ### defineCapability()
2639
+
2640
+ ```ts
2641
+ function defineCapability<T>(id, version, schema): CapabilityContract<T>;
2642
+ ```
2643
+
2644
+ Define a capability with the owner's decoder for its live RPC interface.
2645
+
2646
+ #### Type Parameters
2647
+
2648
+ | Type Parameter |
2649
+ | -------------- |
2650
+ | `T` |
2651
+
2652
+ #### Parameters
2653
+
2654
+ | Parameter | Type |
2655
+ | --------- | ---------------- |
2656
+ | `id` | `string` |
2657
+ | `version` | `number` |
2658
+ | `schema` | `ZodType`\<`T`\> |
2659
+
2660
+ #### Returns
2661
+
2662
+ [`CapabilityContract`](#capabilitycontract)\<`T`\>
2663
+
2664
+ ---
2665
+
2666
+ ### createCapabilityRegistry()
2667
+
2668
+ ```ts
2669
+ function createCapabilityRegistry(): CapabilityRegistry;
2670
+ ```
2671
+
2672
+ Register typed local implementations without reopening their erased types.
2673
+
2674
+ #### Returns
2675
+
2676
+ [`CapabilityRegistry`](#capabilityregistry)
2677
+
2678
+ ---
2679
+
2680
+ ### registerCatalog()
2681
+
2682
+ ```ts
2683
+ function registerCatalog(commands, catalog): Disposer;
2684
+ ```
2685
+
2686
+ Register one App's Whistle catalog with its host. An App defines each command
2687
+ once, contributes the same catalog to its own composer runtime for slash
2688
+ commands, and registers it here so the shell projects it into the palette,
2689
+ menus, keys and the agent view. Availability is read once at registration;
2690
+ register again to publish a change.
2691
+
2692
+ #### Parameters
2693
+
2694
+ | Parameter | Type | Description |
2695
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
2696
+ | `commands` | [`AppCommands`](#appcommands) | The App's host command door, `app.commands`. |
2697
+ | `catalog` | readonly `Readonly`\<\{ `id`: `string`; `title`: `string`; `category`: `string`; `description?`: `string`; `projections?`: \{ `bindings?`: \{ `order?`: `number`; `values`: readonly `string`[]; \}; `agent?`: \{ `keybind?`: `string`; `order?`: `number`; \}; `help?`: \{ `order?`: `number`; \}; `menu?`: \{ `order?`: `number`; \}; `palette?`: \{ `order?`: `number`; \}; `slash?`: \{ `aliases`: readonly `string`[]; `order?`: `number`; `arguments?`: \{ `hint`: `string`; `words?`: readonly ...[]; `text?`: \{ `field`: ...; `arguments`: ...; `requestIdField?`: ...; \}; \}; \}; \}; `action?`: \{ `inputSchema?`: \{ \[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; `outputSchema?`: \{ \[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; `presentation?`: \| \{ `type`: `"action"`; \} \| \{ `type`: `"custom"`; `data`: \{ \[`key`: `string`\]: \| `string` \| `number` \| `boolean` \| readonly string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...[] \| \{ \[`key`: `string`\]: string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| number \| boolean \| readonly (string \| ... 4 more ... \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| null)\[\] \| \{ ...; \} \| ...; \} \| `null`; \}; \} \| \{ `type`: `"choice"`; `options`: readonly `object`[]; \} \| \{ `type`: `"form"`; `submitLabel?`: `string`; \} \| \{ `type`: `"confirmation"`; `message`: `string`; `confirmLabel?`: `string`; `cancelLabel?`: `string`; \}; \}; `availability?`: () => `WhistleAvailability`; `handler`: (`input`) => `unknown`; \}\>[] | The App's Whistle commands, handlers included. |
2698
+
2699
+ #### Returns
2700
+
2701
+ [`Disposer`](#disposer)
2702
+
2703
+ Release every registration made by this call.
2704
+
2705
+ ---
2706
+
2707
+ ### connectApp()
2708
+
2709
+ ```ts
2710
+ function connectApp(options): Promise<AppRoot>;
2711
+ ```
2712
+
2713
+ Connects this iframe page to its authenticated host.
2714
+
2715
+ #### Parameters
2716
+
2717
+ | Parameter | Type |
2718
+ | --------- | ----------------------------------------- |
2719
+ | `options` | [`ConnectAppOptions`](#connectappoptions) |
2720
+
2721
+ #### Returns
2722
+
2723
+ `Promise`\<[`AppRoot`](#approot)\>
2724
+
2725
+ ---
2726
+
2727
+ ### openMediaGeneration()
2728
+
2729
+ ```ts
2730
+ function openMediaGeneration(capabilities): Promise<
2731
+ Readonly<{
2732
+ computerId: string;
2733
+ canGenerate: boolean;
2734
+ models: readonly object[];
2735
+ createAttempt: Promise<MediaGenerationAttempt>;
2736
+ restoreAttempt: Promise<MediaGenerationAttempt>;
2737
+ }>
2738
+ >;
2739
+ ```
2740
+
2741
+ Discover the exact retained model catalog surfaced by the owner.
2742
+
2743
+ #### Parameters
2744
+
2745
+ | Parameter | Type |
2746
+ | -------------- | --------------------------------------------- |
2747
+ | `capabilities` | [`CapabilityDirectory`](#capabilitydirectory) |
2748
+
2749
+ #### Returns
2750
+
2751
+ `Promise`\<`Readonly`\<\{ `computerId`: `string`; `canGenerate`: `boolean`;
2752
+ `models`: readonly `object`[]; `createAttempt`:
2753
+ `Promise`\<[`MediaGenerationAttempt`](#mediagenerationattempt)\>;
2754
+ `restoreAttempt`:
2755
+ `Promise`\<[`MediaGenerationAttempt`](#mediagenerationattempt)\>; \}\>\>
2756
+
2757
+ ---
2758
+
2759
+ ### pending()
2760
+
2761
+ ```ts
2762
+ function pending(retryAfterMs): Pending;
2763
+ ```
2764
+
2765
+ Return Pending with a polling delay between one and sixty seconds.
2766
+
2767
+ #### Parameters
2768
+
2769
+ | Parameter | Type |
2770
+ | -------------- | -------- |
2771
+ | `retryAfterMs` | `number` |
2772
+
2773
+ #### Returns
2774
+
2775
+ [`Pending`](#pending)
2776
+
2777
+ ---
2778
+
2779
+ ### statusText()
2780
+
2781
+ ```ts
2782
+ function statusText(value, max?): string;
2783
+ ```
2784
+
2785
+ Make person- or Computer-supplied text fit one status item: drop unsafe
2786
+ characters, collapse whitespace and shorten with an ellipsis.
2787
+
2788
+ #### Parameters
2789
+
2790
+ | Parameter | Type | Default value |
2791
+ | --------- | -------- | --------------------- |
2792
+ | `value` | `string` | `undefined` |
2793
+ | `max` | `number` | `APP_STATUS_TEXT_MAX` |
2794
+
2795
+ #### Returns
2796
+
2797
+ `string`
2798
+
2799
+ ---
2800
+
2801
+ ### statusActionAllowed()
2802
+
2803
+ ```ts
2804
+ function statusActionAllowed(items, action): boolean;
2805
+ ```
2806
+
2807
+ Whether an action names something the App declares now: an enabled item, and for
2808
+ a menu exactly one enabled option. Every hop that delivers an action applies
2809
+ this rule against its own latest copy of the items.
2810
+
2811
+ #### Parameters
2812
+
2813
+ | Parameter | Type |
2814
+ | --------- | -------------------------------------------- |
2815
+ | `items` | readonly [`AppStatusItem`](#appstatusitem)[] |
2816
+ | `action` | [`AppStatusAction`](#appstatusaction) |
2817
+
2818
+ #### Returns
2819
+
2820
+ `boolean`
2821
+
2822
+ ## References
2823
+
2824
+ ### AppError
2825
+
2826
+ Re-exports [AppError](errors.md#apperror)
2827
+
2828
+ ---
2829
+
2830
+ ### AppErrorCode
2831
+
2832
+ Re-exports [AppErrorCode](errors.md#apperrorcode)
2833
+
2834
+ ---
2835
+
2836
+ ### AppErrorOptions
2837
+
2838
+ Re-exports [AppErrorOptions](errors.md#apperroroptions)
2839
+
2840
+ ---
2841
+
2842
+ ### appStorage
2843
+
2844
+ Re-exports [appStorage](storage.md#appstorage-1)
2845
+
2846
+ ---
2847
+
2848
+ ### AppStorageError
2849
+
2850
+ Re-exports [AppStorageError](storage.md#appstorageerror)
2851
+
2852
+ ---
2853
+
2854
+ ### AppStorage
2855
+
2856
+ Re-exports [AppStorage](storage.md#appstorage)
2857
+
2858
+ ---
2859
+
2860
+ ### AppStorageWatch
2861
+
2862
+ Re-exports [AppStorageWatch](storage.md#appstoragewatch)
2863
+
2864
+ ---
2865
+
2866
+ ### AppStorageWrite
2867
+
2868
+ Re-exports [AppStorageWrite](storage.md#appstoragewrite)
2869
+
2870
+ ---
2871
+
2872
+ ### AppStorageReset
2873
+
2874
+ Re-exports [AppStorageReset](storage.md#appstoragereset)
2875
+
2876
+ ---
2877
+
2878
+ ### ResolvedAppStorage
2879
+
2880
+ Re-exports [ResolvedAppStorage](storage.md#resolvedappstorage)