@moonbooth/sdk 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1776 @@
1
+ export declare const PACKAGE_NAME = "@moonbooth/sdk";
2
+ /** Structured error returned by the API: { error: { code, message, details? } }. */
3
+ export declare class ActApiError extends Error {
4
+ readonly status: number;
5
+ readonly code: string;
6
+ readonly details?: unknown;
7
+ constructor(status: number, code: string, message: string, details?: unknown);
8
+ }
9
+ export type FetchFn = (url: string, init: RequestInit) => Promise<Response>;
10
+ export interface ActClientOptions {
11
+ baseUrl: string;
12
+ token: string;
13
+ /** Injectable fetch, for tests. Defaults to the global fetch. */
14
+ fetchFn?: FetchFn;
15
+ }
16
+ export interface CapabilitySummary {
17
+ id: string;
18
+ slug: string;
19
+ name: string;
20
+ description: string;
21
+ createdAt?: string;
22
+ versions?: Array<{
23
+ id: string;
24
+ version: string;
25
+ digest: string;
26
+ createdAt: string;
27
+ }>;
28
+ }
29
+ export interface CreateCapabilityInput {
30
+ mode: "paste" | "document" | "skill";
31
+ name: string;
32
+ description: string;
33
+ version?: string;
34
+ content?: string;
35
+ fileName?: string;
36
+ files?: Array<{
37
+ path: string;
38
+ content: string;
39
+ }>;
40
+ tools?: string[];
41
+ permissions?: {
42
+ network?: boolean;
43
+ filesystem_write?: boolean;
44
+ external_side_effects?: boolean;
45
+ };
46
+ }
47
+ export interface CreatedCapability {
48
+ capability: {
49
+ id: string;
50
+ slug: string;
51
+ name: string;
52
+ description: string;
53
+ };
54
+ version: {
55
+ id: string;
56
+ version: string;
57
+ digest: string;
58
+ };
59
+ artifactId: string;
60
+ blocked: boolean;
61
+ scanFindings: unknown[];
62
+ }
63
+ export interface CapabilityDetail {
64
+ capability: CapabilitySummary;
65
+ versions: Array<{
66
+ id: string;
67
+ version: string;
68
+ digest: string;
69
+ manifest: unknown;
70
+ artifactId: string | null;
71
+ blocked: boolean;
72
+ scanFindings: unknown[];
73
+ createdAt: string;
74
+ }>;
75
+ }
76
+ export interface TransferSummary {
77
+ id: string;
78
+ state: string;
79
+ verificationState: string;
80
+ capabilityName: string;
81
+ version: string;
82
+ digest: string;
83
+ direction: "sent" | "received";
84
+ blocked: boolean;
85
+ scanFindings: unknown[];
86
+ recipientEmail: string | null;
87
+ senderId: string;
88
+ recipientId: string | null;
89
+ expiresAt: string | null;
90
+ createdAt: string;
91
+ updatedAt: string;
92
+ }
93
+ export interface ApproveResult {
94
+ transfer: {
95
+ id: string;
96
+ state: string;
97
+ };
98
+ invitation: {
99
+ token: string;
100
+ path: string;
101
+ expiresAt: string;
102
+ };
103
+ }
104
+ export interface PackageView {
105
+ transfer: {
106
+ id: string;
107
+ state: string;
108
+ };
109
+ manifest: unknown;
110
+ digest: string;
111
+ files: Array<{
112
+ path: string;
113
+ content: string;
114
+ }>;
115
+ serialized: string;
116
+ scanFindings: unknown[];
117
+ blocked: boolean;
118
+ }
119
+ export interface Offer {
120
+ transferId: string;
121
+ state: string;
122
+ senderDisplayName: string;
123
+ capabilityName: string;
124
+ capabilityDescription: string;
125
+ version: string;
126
+ recipientEmail: string | null;
127
+ expiresAt: string;
128
+ expired: boolean;
129
+ revoked: boolean;
130
+ }
131
+ export interface ShareLinkSummary {
132
+ id: string;
133
+ transferId: string;
134
+ capabilityName: string;
135
+ version: string;
136
+ digest: string;
137
+ status: string;
138
+ transferState: string;
139
+ createdAt: string;
140
+ expiresAt: string;
141
+ claimedAt: string | null;
142
+ }
143
+ export interface CreatedShareLink {
144
+ link: {
145
+ id: string;
146
+ path: string;
147
+ url: string;
148
+ expiresAt: string;
149
+ status: string;
150
+ };
151
+ transfer: {
152
+ id: string;
153
+ state: string;
154
+ };
155
+ }
156
+ /** Returned (as ActApiError details) when a link is refused because
157
+ * the transfer is not approved yet. */
158
+ export interface NeedsApprovalDetails {
159
+ transferId: string;
160
+ digest: string;
161
+ summary: unknown;
162
+ }
163
+ export interface LinkInspect {
164
+ link: {
165
+ id: string;
166
+ status: string;
167
+ expiresAt: string;
168
+ };
169
+ capability?: {
170
+ name: string;
171
+ description?: string;
172
+ version?: string;
173
+ digest?: string;
174
+ };
175
+ [key: string]: unknown;
176
+ }
177
+ export interface VerificationRunStart {
178
+ id: string;
179
+ transferId: string;
180
+ status: string;
181
+ }
182
+ export interface VerificationView {
183
+ run: {
184
+ id: string;
185
+ status: string;
186
+ suiteId: string;
187
+ suiteVersion: string;
188
+ environment: unknown;
189
+ results: unknown;
190
+ startedAt: string | null;
191
+ finishedAt: string | null;
192
+ };
193
+ receipt: {
194
+ id: string;
195
+ digest: string;
196
+ receipt: unknown;
197
+ } | null;
198
+ }
199
+ export interface ReceiptView {
200
+ id: string;
201
+ digest: string;
202
+ transferId: string;
203
+ receipt: unknown;
204
+ }
205
+ export declare class ActClient {
206
+ private readonly baseUrl;
207
+ private readonly token;
208
+ private readonly fetchFn;
209
+ constructor(options: ActClientOptions);
210
+ /** The service base URL this client was constructed with. */
211
+ get serviceBaseUrl(): string;
212
+ private request;
213
+ createCapability(input: CreateCapabilityInput): Promise<CreatedCapability>;
214
+ listCapabilities(): Promise<{
215
+ capabilities: CapabilitySummary[];
216
+ }>;
217
+ getCapability(id: string): Promise<CapabilityDetail>;
218
+ createTransfer(input: {
219
+ capabilityVersionId: string;
220
+ recipientEmail?: string;
221
+ }): Promise<{
222
+ transfer: TransferSummary;
223
+ }>;
224
+ getTransfer(id: string): Promise<{
225
+ transfer: TransferSummary;
226
+ }>;
227
+ listTransfers(): Promise<{
228
+ transfers: TransferSummary[];
229
+ }>;
230
+ /** Sender approval. The digest must be the digest the sender reviewed. */
231
+ approveTransfer(id: string, digest: string, recipientEmail?: string): Promise<ApproveResult>;
232
+ revokeTransfer(id: string): Promise<{
233
+ transfer: {
234
+ id: string;
235
+ state: string;
236
+ };
237
+ }>;
238
+ getPackage(id: string): Promise<PackageView>;
239
+ acceptTransfer(id: string): Promise<{
240
+ transfer: {
241
+ id: string;
242
+ state: string;
243
+ };
244
+ }>;
245
+ rejectTransfer(id: string, reason?: string): Promise<{
246
+ transfer: {
247
+ id: string;
248
+ state: string;
249
+ };
250
+ }>;
251
+ getOffer(token: string): Promise<{
252
+ offer: Offer;
253
+ }>;
254
+ receiveInvitation(token: string): Promise<{
255
+ transfer: {
256
+ id: string;
257
+ state: string;
258
+ };
259
+ }>;
260
+ /**
261
+ * Create a share link. Name a transferId (the transfer must already
262
+ * be approved and offered; an unapproved transfer fails with an
263
+ * ActApiError whose code is "needs_approval" and whose details carry
264
+ * the package digest and a contents summary), or a
265
+ * capabilityVersionId with the digest the sender reviewed (approval
266
+ * is recorded as part of creation).
267
+ */
268
+ createShareLink(input: {
269
+ transferId?: string;
270
+ capabilityVersionId?: string;
271
+ digest?: string;
272
+ }): Promise<CreatedShareLink>;
273
+ listShareLinks(): Promise<{
274
+ links: ShareLinkSummary[];
275
+ }>;
276
+ revokeShareLink(id: string): Promise<{
277
+ link: {
278
+ id: string;
279
+ revokedAt: string | null;
280
+ };
281
+ }>;
282
+ /** Read the public rendezvous document for a link token. */
283
+ inspectShareLink(token: string): Promise<LinkInspect>;
284
+ /** Claim a link as the token owner (an account claim). */
285
+ claimShareLink(token: string): Promise<{
286
+ transfer: {
287
+ id: string;
288
+ state: string;
289
+ };
290
+ claim: {
291
+ kind: string;
292
+ linkId: string;
293
+ };
294
+ }>;
295
+ requestVerification(transferId: string, profile?: unknown): Promise<{
296
+ run: VerificationRunStart;
297
+ }>;
298
+ getVerification(transferId: string): Promise<VerificationView>;
299
+ getReceipt(receiptId: string): Promise<ReceiptView>;
300
+ /** Register a webhook. The returned secret is shown once: store it now. */
301
+ createWebhook(input: CreateWebhookInput): Promise<{
302
+ webhook: WebhookView;
303
+ secret: string;
304
+ }>;
305
+ listWebhooks(): Promise<{
306
+ webhooks: WebhookView[];
307
+ }>;
308
+ getWebhook(id: string): Promise<{
309
+ webhook: WebhookView;
310
+ }>;
311
+ updateWebhook(id: string, patch: UpdateWebhookInput): Promise<{
312
+ webhook: WebhookView;
313
+ }>;
314
+ /** Replace the signing secret. The new secret is shown once. */
315
+ rotateWebhookSecret(id: string): Promise<{
316
+ webhook: WebhookView;
317
+ secret: string;
318
+ }>;
319
+ deleteWebhook(id: string): Promise<{
320
+ deleted: boolean;
321
+ }>;
322
+ /** Enqueue one signed test delivery to the webhook's target. */
323
+ testWebhook(id: string): Promise<{
324
+ delivery_id: string;
325
+ }>;
326
+ listWebhookDeliveries(id: string, limit?: number): Promise<{
327
+ deliveries: WebhookDeliveryView[];
328
+ }>;
329
+ /** The account's namespace, or null when none is claimed. */
330
+ getNamespace(): Promise<{
331
+ namespace: NamespaceView | null;
332
+ }>;
333
+ /** Claim the account's one namespace. */
334
+ claimNamespace(slug: string): Promise<{
335
+ namespace: NamespaceView;
336
+ }>;
337
+ /** Rename the namespace (at most once every 30 days). */
338
+ renameNamespace(slug: string): Promise<{
339
+ namespace: NamespaceView;
340
+ }>;
341
+ /** Create a persistent booth. The creator credential is shown once. */
342
+ createPersistentBooth(input?: CreatePersistentBoothInput): Promise<{
343
+ booth: OwnedBoothView;
344
+ creator_credential: string;
345
+ admission_secret?: string | null;
346
+ }>;
347
+ listOwnedBooths(): Promise<{
348
+ booths: OwnedBoothView[];
349
+ }>;
350
+ getOwnedBooth(id: string): Promise<{
351
+ booth: OwnedBoothView;
352
+ }>;
353
+ configureOwnedBooth(id: string, patch: ConfigureOwnedBoothInput): Promise<{
354
+ booth: OwnedBoothView;
355
+ }>;
356
+ /** Delete a persistent booth. Records are retained; the booth stops resolving. */
357
+ deleteOwnedBooth(id: string): Promise<{
358
+ booth: OwnedBoothView;
359
+ }>;
360
+ closeOwnedBooth(id: string): Promise<{
361
+ booth: OwnedBoothView;
362
+ }>;
363
+ archiveOwnedBooth(id: string): Promise<{
364
+ booth: OwnedBoothView;
365
+ }>;
366
+ restoreOwnedBooth(id: string): Promise<{
367
+ booth: OwnedBoothView;
368
+ }>;
369
+ /** Rotate every live participant credential. The new credentials are shown once. */
370
+ rotateOwnedBoothCredentials(id: string): Promise<{
371
+ booth: OwnedBoothView;
372
+ rotated: RotatedCredentialView[];
373
+ }>;
374
+ revokeOwnedBoothParticipant(id: string, participantId: string): Promise<{
375
+ revoked: boolean;
376
+ booth: OwnedBoothView;
377
+ }>;
378
+ /** The full booth record export (works on a deleted booth too). */
379
+ exportOwnedBooth(id: string): Promise<Record<string, unknown>>;
380
+ /**
381
+ * Phase 10: read the booth's publication policy — what this
382
+ * booth publishes to other booths. A null publication publishes
383
+ * nothing. Only account-owned booths can be cross-booth sources.
384
+ */
385
+ getPublicationPolicy(id: string): Promise<BoothPublicationPolicyView>;
386
+ /** Set (replace in full) the booth's publication policy. */
387
+ setPublicationPolicy(id: string, input: {
388
+ subjects?: string[];
389
+ eventTypes?: string[] | null;
390
+ }): Promise<BoothPublicationPolicyView>;
391
+ /** Clear the booth's publication policy; the booth publishes nothing. */
392
+ clearPublicationPolicy(id: string): Promise<BoothPublicationPolicyView>;
393
+ getBoothAlias(id: string): Promise<{
394
+ alias: BoothAliasView | null;
395
+ }>;
396
+ claimBoothAlias(id: string, slug: string): Promise<{
397
+ alias: BoothAliasView;
398
+ }>;
399
+ renameBoothAlias(id: string, slug: string): Promise<{
400
+ alias: BoothAliasView;
401
+ }>;
402
+ releaseBoothAlias(id: string): Promise<{
403
+ alias: BoothAliasView;
404
+ }>;
405
+ /** Resolve an alias (@namespace/slug) to its booth's public discovery document. */
406
+ resolveAlias(namespace: string, slug: string): Promise<{
407
+ alias: string;
408
+ booth: Record<string, unknown>;
409
+ }>;
410
+ }
411
+ /** The account's namespace view (Phase 7). */
412
+ export interface NamespaceView {
413
+ name: string;
414
+ slug: string;
415
+ created_at: string;
416
+ renamed_at: string | null;
417
+ }
418
+ /** A persistent booth in its owner's admin view (Phase 7). */
419
+ /**
420
+ * A booth's cross-booth publication policy (Living Network
421
+ * Phase 10): the subject prefixes and event types the booth
422
+ * publishes to other booths. A null publication publishes nothing.
423
+ */
424
+ export interface BoothPublicationPolicyView {
425
+ booth_id: string;
426
+ publication: {
427
+ subjects: string[];
428
+ event_types: string[] | null;
429
+ } | null;
430
+ }
431
+ export interface OwnedBoothView {
432
+ id: string;
433
+ url: string;
434
+ kind: string;
435
+ status: string;
436
+ lifecycle: Record<string, unknown>;
437
+ name: string | null;
438
+ objective: string | null;
439
+ alias: string | null;
440
+ access_mode: string;
441
+ created_at: string;
442
+ expires_at: string | null;
443
+ closed_at: string | null;
444
+ archived_at: string | null;
445
+ deleted_at: string | null;
446
+ limits: {
447
+ max_participants?: number | null;
448
+ retention_days?: number | null;
449
+ } | null;
450
+ }
451
+ /** An alias naming one persistent booth inside a namespace (Phase 7). */
452
+ export interface BoothAliasView {
453
+ name: string;
454
+ namespace: string;
455
+ slug: string;
456
+ booth_id: string;
457
+ url: string;
458
+ status: string;
459
+ created_at: string;
460
+ released_at: string | null;
461
+ }
462
+ export interface CreatePersistentBoothInput {
463
+ displayName?: string;
464
+ objective?: string;
465
+ accessMode?: "link_only" | "generated_key" | "password" | "invitation_only";
466
+ password?: string;
467
+ invitations?: Array<Record<string, unknown>>;
468
+ /**
469
+ * Phase 8: create this booth as the child of a persistent booth the
470
+ * same account owns (the parent's public id). The session is the
471
+ * standing; a parent owned by another account reads as not found.
472
+ */
473
+ parentBoothId?: string;
474
+ }
475
+ export interface ConfigureOwnedBoothInput {
476
+ displayName?: string | null;
477
+ objective?: string | null;
478
+ limits?: {
479
+ maxParticipants?: number | null;
480
+ retentionDays?: number | null;
481
+ };
482
+ }
483
+ /** One rotated participant credential, shown once by rotateOwnedBoothCredentials. */
484
+ export interface RotatedCredentialView {
485
+ participant_id: string;
486
+ kind: string;
487
+ transfer_role: string | null;
488
+ credential: string;
489
+ }
490
+ /** The metadata view of an account webhook. Never carries the secret or its stored form. */
491
+ export interface WebhookView {
492
+ id: string;
493
+ url: string;
494
+ scope: "booth" | "account";
495
+ booth_id: string | null;
496
+ event_types: string[] | null;
497
+ status: "active" | "paused";
498
+ last_delivery_at: string | null;
499
+ created_at: string;
500
+ updated_at: string;
501
+ paused_at: string | null;
502
+ }
503
+ export interface CreateWebhookInput {
504
+ url: string;
505
+ /** Filter entries from the webhook vocabulary; omit or null for every event. */
506
+ eventTypes?: string[] | null;
507
+ /** A booth's public id, to scope the webhook to that booth. */
508
+ boothId?: string | null;
509
+ /** A participant credential for the named booth, proving the account takes part in it. */
510
+ participantCredential?: string | null;
511
+ }
512
+ export interface UpdateWebhookInput {
513
+ url?: string;
514
+ eventTypes?: string[] | null;
515
+ status?: "active" | "paused";
516
+ }
517
+ export interface WebhookDeliveryView {
518
+ id: string;
519
+ delivery_id: string;
520
+ webhook_id: string;
521
+ booth_id: string | null;
522
+ event_id: string | null;
523
+ signal_key: string | null;
524
+ event_type: string;
525
+ kind: "event" | "signal" | "lifecycle" | "test";
526
+ attempt: number;
527
+ state: "delivered" | "failed" | "dead";
528
+ status_code: number | null;
529
+ error_category: string | null;
530
+ created_at: string;
531
+ }
532
+ /** One invitation to issue at creation or through the invitations endpoint (Locked Booths L3). */
533
+ export interface BoothInvitationSpec {
534
+ /** The role a redemption joins under; "participant" (or omitting it) leaves the role to the redemption. */
535
+ role?: "sender" | "recipient" | "participant";
536
+ /** The permission subset the redeemed credential carries. Defaults to the bound role's default set. */
537
+ scopes?: string[];
538
+ label?: string;
539
+ subjectRestrictions?: string[];
540
+ maxRedemptions?: number;
541
+ expiresInSeconds?: number;
542
+ }
543
+ /** The metadata view of a booth invitation. Never carries the token or its hash. */
544
+ export interface BoothInvitationView {
545
+ id: string;
546
+ booth_id: string;
547
+ issuer: {
548
+ kind: "creator" | "participant";
549
+ participant_id?: string | null;
550
+ };
551
+ role_binding: string | null;
552
+ scopes: string[];
553
+ subject_restrictions: string[] | null;
554
+ label: string | null;
555
+ max_redemptions: number;
556
+ redemption_count: number;
557
+ state: "active" | "revoked" | "expired" | "exhausted";
558
+ expires_at: string;
559
+ revoked_at: string | null;
560
+ created_at: string;
561
+ }
562
+ /** The metadata view of a participant grant (Locked Booths L4). Never carries the credential or its hash. */
563
+ export interface BoothParticipantView {
564
+ id: string;
565
+ kind: "transfer" | "participant";
566
+ transfer_role: string | null;
567
+ display_name: string | null;
568
+ permissions: string[];
569
+ invitation_id: string | null;
570
+ issuer_participant_id: string | null;
571
+ subject_restrictions: string[] | null;
572
+ state: "active" | "revoked" | "expired";
573
+ joined_at: string;
574
+ expires_at: string | null;
575
+ revoked_at: string | null;
576
+ }
577
+ /** The result of rotating a booth's admission secret (L4). admission_secret is present only for a generated-key rotation. */
578
+ export interface BoothRotateSecretResult {
579
+ admission_method: "generated_key" | "password";
580
+ admission_secret?: string;
581
+ admission_secret_note: string;
582
+ access: unknown;
583
+ }
584
+ /** The result of protecting a link-only booth (L5). admission_secret is present only for a generated key, and shown once. */
585
+ export interface BoothProtectResult {
586
+ admission_method: "generated_key" | "password";
587
+ admission_secret?: string;
588
+ admission_secret_note: string;
589
+ access: unknown;
590
+ }
591
+ /** One access request (Locked Booths L4). Filing grants nothing and admits no one. */
592
+ export interface BoothAccessRequestView {
593
+ id: string;
594
+ booth_id: string;
595
+ label: string | null;
596
+ message: string | null;
597
+ requested_role: string | null;
598
+ status: "pending";
599
+ created_at: string;
600
+ }
601
+ /** An invitation as returned at issuance: the metadata view plus its one-time token. */
602
+ export interface BoothInvitationIssuedView extends BoothInvitationView {
603
+ /** The invitation token (mbi_ prefix), shown once. Presenting it at unlock redeems the invitation. */
604
+ token: string;
605
+ }
606
+ export interface BoothCreateResult {
607
+ id: string;
608
+ url: string;
609
+ expires_at: string;
610
+ ttl_seconds?: number;
611
+ close_condition?: string | null;
612
+ /** Shown once; authorizes closing the booth. Present on a fresh create only. */
613
+ creator_credential?: string;
614
+ /** Locked creation only: the access policy the booth was created with. */
615
+ access?: unknown;
616
+ /** Locked creation only: the admission method ("generated_key" or "password"). */
617
+ admission_method?: string | null;
618
+ /** Shown once, locked creation with a generated key only: the admission key. */
619
+ admission_secret?: string | null;
620
+ /** L3: invitations issued inside the create, each with its one-time token. */
621
+ invitations?: BoothInvitationIssuedView[];
622
+ /**
623
+ * Phase 8: present when the booth was created as a child — the
624
+ * parent's public id and the child booth's own URL.
625
+ */
626
+ parent?: {
627
+ id: string;
628
+ url: string;
629
+ };
630
+ [key: string]: unknown;
631
+ }
632
+ export interface BoothJoinResult {
633
+ role: string;
634
+ participant_id?: string;
635
+ credential: string;
636
+ credential_note: string;
637
+ discovery: unknown;
638
+ }
639
+ /** Phase 10: one cross-booth subscription as the API returns it. */
640
+ export interface BoothCrossSubscriptionView {
641
+ id: string;
642
+ source_booth_id: string;
643
+ destination_booth_id: string;
644
+ participant_id: string;
645
+ subjects: string[];
646
+ event_types: string[] | null;
647
+ state: "active" | "revoked";
648
+ created_at: string;
649
+ }
650
+ /** Phase 10: the create response — created is false when an identical active subscription already existed. */
651
+ export interface BoothCrossSubscriptionResult {
652
+ subscription: BoothCrossSubscriptionView;
653
+ created: boolean;
654
+ }
655
+ /** Phase 8: the publication record returned by the publish endpoint. */
656
+ export interface BoothPublishResult {
657
+ /** The service-authored result_published event as it landed in the parent. */
658
+ event: {
659
+ id: string;
660
+ seq: number;
661
+ type: string;
662
+ subject: string | null;
663
+ payload: {
664
+ child_booth_id: string;
665
+ child_url: string;
666
+ events: Array<{
667
+ event_id: string;
668
+ seq: number;
669
+ type: string;
670
+ subject: string | null;
671
+ digest: string;
672
+ }>;
673
+ receipt?: {
674
+ receipt_id: string;
675
+ receipt_digest: string;
676
+ };
677
+ [key: string]: unknown;
678
+ };
679
+ [key: string]: unknown;
680
+ };
681
+ parent: {
682
+ id: string;
683
+ url: string;
684
+ };
685
+ child: {
686
+ id: string;
687
+ };
688
+ /** True when an idempotency key replayed the original publication. */
689
+ replayed: boolean;
690
+ }
691
+ export interface BoothUnlockResult {
692
+ role: string;
693
+ participant_id?: string;
694
+ credential: string;
695
+ credential_note: string;
696
+ /** Which admission method the secret matched: "generated_key", "password", or "invitation". */
697
+ admission_method: string;
698
+ discovery: unknown;
699
+ }
700
+ export interface BoothEventView {
701
+ id: string;
702
+ seq: number;
703
+ type: string;
704
+ subject: string;
705
+ payload: Record<string, unknown>;
706
+ author: unknown;
707
+ in_reply_to: string | null;
708
+ related_ids: string[] | null;
709
+ created_at: string;
710
+ status?: string;
711
+ status_reason?: string | null;
712
+ /** Changes feed only: why this event surfaced for the caller. */
713
+ reasons?: string[];
714
+ relevance?: {
715
+ reasons: string[];
716
+ };
717
+ }
718
+ export interface BoothSubscriptionView {
719
+ id: string;
720
+ booth_id: string;
721
+ participant_id: string;
722
+ subjects: string[];
723
+ /** The watchers declared on this subscription (Phase 6), in declaration order. */
724
+ conditions: BoothWatcherView[];
725
+ event_types: string[] | null;
726
+ delivery_mode: string;
727
+ delivered_cursor: number;
728
+ acked_cursor: number;
729
+ state: string;
730
+ last_delivery_at: string | null;
731
+ created_at: string;
732
+ }
733
+ /**
734
+ * One watcher declaration (Living Network Phase 6): a typed
735
+ * condition on the participant's subscription, from a closed set —
736
+ * contract_changed { subject }, contract_version { subject, version },
737
+ * commitment_deadline_within { window_seconds }, check_failed
738
+ * { check_event_id | subject }, evidence_present
739
+ * { subject, evidence_kind }, offer_on_subject { subject },
740
+ * dependency_invalidated { subject }, booth_expiring_within
741
+ * { window_seconds }. When the condition holds against the booth's
742
+ * log, it derives as a signal with reason watcher_triggered.
743
+ */
744
+ export interface BoothWatcherSpec {
745
+ kind: string;
746
+ subject?: string;
747
+ version?: string;
748
+ window_seconds?: number;
749
+ check_event_id?: string;
750
+ evidence_kind?: string;
751
+ }
752
+ export interface BoothWatcherView {
753
+ id: string;
754
+ kind: string;
755
+ subject: string | null;
756
+ version: string | null;
757
+ window_seconds: number | null;
758
+ check_event_id: string | null;
759
+ evidence_kind: string | null;
760
+ created_at: string;
761
+ }
762
+ export interface BoothWatchersView {
763
+ watchers: BoothWatcherView[];
764
+ subscription_id: string;
765
+ participant_id: string;
766
+ }
767
+ export interface BoothChangesView {
768
+ events: BoothEventView[];
769
+ latest_seq: number;
770
+ acked_seq: number;
771
+ next_since: number;
772
+ subscription: BoothSubscriptionView;
773
+ wake: {
774
+ poll_after_seconds: number;
775
+ long_poll_max_seconds: number;
776
+ };
777
+ }
778
+ export interface BoothChangesOptions {
779
+ since?: number;
780
+ until?: number;
781
+ mode?: "relevant" | "all";
782
+ /** Hold the request open for a relevant event, up to 25 seconds server-side. */
783
+ waitSeconds?: number;
784
+ }
785
+ export interface BoothStreamOptions {
786
+ /** Resume from this seq; sent on the wire as the Last-Event-ID header. */
787
+ since?: number;
788
+ mode?: "relevant" | "all";
789
+ /** Abort the stream from the client side. */
790
+ signal?: AbortSignal;
791
+ }
792
+ /**
793
+ * One frame of a booth event stream (Living Network Phase 13): an
794
+ * open frame when the stream starts, one event frame per changes
795
+ * entry as it lands, and an end frame naming why the stream closed
796
+ * and the cursor to resume from.
797
+ */
798
+ export type BoothStreamFrame = {
799
+ type: "open";
800
+ booth: string;
801
+ since: number;
802
+ mode: string;
803
+ latest_seq: number;
804
+ } | {
805
+ type: "event";
806
+ seq: number;
807
+ event: BoothEventView;
808
+ } | {
809
+ type: "end";
810
+ reason: string;
811
+ next_since: number;
812
+ latest_seq: number;
813
+ };
814
+ type ParsedStreamFrame = BoothStreamFrame | {
815
+ type: "error";
816
+ code: string;
817
+ };
818
+ /** Parse one server-sent event block (the text between blank lines). */
819
+ export declare function parseStreamFrame(raw: string): ParsedStreamFrame | null;
820
+ export interface BoothSignalView {
821
+ signal_key: string;
822
+ source_event_id: string;
823
+ subject: string;
824
+ participant_id: string;
825
+ reason: string;
826
+ severity: "high" | "medium" | "low";
827
+ state_ref: number;
828
+ created_from_seq: number;
829
+ /** Watcher signals only (Phase 6): the declared condition that triggered. */
830
+ watcher_id?: string;
831
+ watcher_kind?: string;
832
+ }
833
+ export interface BoothSignalsView {
834
+ signals: BoothSignalView[];
835
+ latest_seq: number;
836
+ counts: {
837
+ pending: number;
838
+ acknowledged: number;
839
+ dismissed: number;
840
+ };
841
+ participant_id: string;
842
+ }
843
+ /**
844
+ * One typed condition in a commitment proposal (Living Network Phase 3).
845
+ * The closed set the service can evaluate: contract_version
846
+ * { subject, version }, event_exists { type, subject },
847
+ * acks_complete { seq | subject }, digest_matches
848
+ * { capability_version_id | subject, digest }, decision_accepted
849
+ * { subject }, deadline { at }. Any other kind is accepted at
850
+ * propose time and evaluates to requires_review — the commitment can
851
+ * never read fulfilled on a condition the service cannot check.
852
+ */
853
+ export interface BoothCommitmentConditionSpec {
854
+ kind: string;
855
+ subject?: string;
856
+ version?: string;
857
+ type?: string;
858
+ seq?: number;
859
+ capability_version_id?: string;
860
+ digest?: string;
861
+ at?: string;
862
+ [key: string]: unknown;
863
+ }
864
+ export interface BoothCommitmentProposal {
865
+ /** The commitment, in one line. Required. */
866
+ title: string;
867
+ /** The event subject the commitment hangs on. Defaults to the first of subjects, or "commitment". */
868
+ subject?: string;
869
+ /** Subjects the commitment concerns (contract subjects, capability subjects, decision subjects). */
870
+ subjects?: string[];
871
+ /** Participant ids or transfer roles ("sender", "recipient") the commitment binds. Every named party must endorse before the commitment can fulfill. */
872
+ parties?: string[];
873
+ /** The commitments themselves, as text. The service stores them verbatim and never interprets them. */
874
+ commitments?: string[];
875
+ /** Typed conditions the service evaluates against the booth log. */
876
+ conditions?: BoothCommitmentConditionSpec[];
877
+ /** ISO timestamp; a commitment whose conditions are unmet at its deadline reads failed (endorsed) or expired (not yet endorsed by every party). */
878
+ dueAt?: string;
879
+ }
880
+ export interface BoothCommitmentConditionView extends BoothCommitmentConditionSpec {
881
+ status: "met" | "unmet" | "requires_review";
882
+ detail: string;
883
+ satisfied_at: string | null;
884
+ }
885
+ export interface BoothCommitmentView {
886
+ event_id: string;
887
+ seq: number;
888
+ subject: string;
889
+ title: string | null;
890
+ proposer_participant_id: string;
891
+ parties: string[];
892
+ party_participant_ids: string[];
893
+ endorsed_by: string[];
894
+ commitments: string[];
895
+ conditions: BoothCommitmentConditionView[];
896
+ due_at: string | null;
897
+ status: "proposed" | "endorsed" | "active" | "evidence_pending" | "fulfilled" | "failed" | "expired" | "cancelled" | "requires_review";
898
+ status_reason: string | null;
899
+ created_at: string;
900
+ }
901
+ /**
902
+ * One typed assertion in a check declaration (Living Network
903
+ * Phase 5). The set the service can evaluate: evidence_present
904
+ * { evidence_kind, subject }, contract_versions_aligned
905
+ * { subjects, version? }, digest_matches
906
+ * { capability_version_id | subject, digest }, acks_complete
907
+ * { seq | subject }, commitments_fulfilled { commitment_ids },
908
+ * no_open_blocking_conflicts { subject? }. Any other kind is
909
+ * accepted at declare time and evaluates to unsupported — a check
910
+ * can never read passed on an assertion the service cannot
911
+ * evaluate.
912
+ */
913
+ export interface BoothCheckAssertionSpec {
914
+ kind: string;
915
+ evidence_kind?: string;
916
+ subject?: string;
917
+ subjects?: string[];
918
+ version?: string;
919
+ capability_version_id?: string;
920
+ digest?: string;
921
+ seq?: number;
922
+ commitment_ids?: string[];
923
+ [key: string]: unknown;
924
+ }
925
+ export interface BoothCheckTarget {
926
+ kind: "booth" | "transfer" | "commitment" | "contract";
927
+ /** Required when kind is "commitment": the commitment event the check is about. */
928
+ commitment_event_id?: string;
929
+ /** Required when kind is "contract": the contract subject the check is about. */
930
+ subject?: string;
931
+ }
932
+ export interface BoothCheckSpec {
933
+ /** What the check verifies, in one line. Required. */
934
+ title: string;
935
+ /** The event subject the check hangs on. Defaults to "check". */
936
+ subject?: string;
937
+ /** What the check is about. Defaults to the whole booth. */
938
+ target?: BoothCheckTarget;
939
+ /** Typed assertions the service evaluates against the booth log. Omit for a not_run check. */
940
+ assertions?: BoothCheckAssertionSpec[];
941
+ }
942
+ export interface BoothAssertionView {
943
+ kind: string;
944
+ status: "passed" | "failed" | "incomplete" | "awaiting_evidence" | "unsupported";
945
+ detail: string;
946
+ /** self_reported: a participant's attestation. service_computed: derived by the service from records it holds. verified: receipt-backed. */
947
+ assurance: "self_reported" | "service_computed" | "verified";
948
+ /** The log events the evaluation relied on — the result's evidence citation. */
949
+ evidence_event_ids: string[];
950
+ receipt_id: string | null;
951
+ }
952
+ export interface BoothCheckView {
953
+ check_event_id: string;
954
+ seq: number;
955
+ subject: string;
956
+ title: string;
957
+ target: {
958
+ kind: string;
959
+ commitment_event_id: string | null;
960
+ subject: string | null;
961
+ };
962
+ status: "passed" | "failed" | "incomplete" | "awaiting_evidence" | "not_run" | "unsupported";
963
+ status_reason: string | null;
964
+ assertions: BoothAssertionView[];
965
+ author_participant_id: string | null;
966
+ created_at: string;
967
+ /** The log position this evaluation ran against. A re-read after new events is a new evaluation. */
968
+ evaluated_seq: number;
969
+ }
970
+ export interface BoothCloseConditionResult {
971
+ id: string;
972
+ status: string;
973
+ lifecycle: unknown;
974
+ close_condition: string | null;
975
+ }
976
+ /**
977
+ * Filters for the booth Brief (Living Network Phase 4): the state
978
+ * cut to what the filters admit. Accepted and proposed material sit
979
+ * in separate sections, every entry carries its source event id,
980
+ * and the response's omitted block counts what the filters and
981
+ * limits cut, with the reason.
982
+ */
983
+ export interface BoothBriefOptions {
984
+ /** Participant the brief is centered on; defaults to the caller. */
985
+ participant?: string;
986
+ /** Keep only records on this subject. */
987
+ subject?: string;
988
+ /** Keep only records authored by participants holding this role. */
989
+ role?: "sender" | "recipient" | "participant";
990
+ /** A participant id, or "caller": keep only subjects that participant depends on. */
991
+ dependencyOf?: string;
992
+ /** Keep only records with a sequence number greater than this. */
993
+ since?: number;
994
+ /** Most records kept per section (default 500 server-side). */
995
+ maxRecords?: number;
996
+ /** Byte budget for the serialized brief (default 1000000 server-side). */
997
+ maxBytes?: number;
998
+ }
999
+ export interface BoothBriefView {
1000
+ booth: {
1001
+ id: string;
1002
+ status: string;
1003
+ expires_at: string;
1004
+ };
1005
+ snapshot_seq: number;
1006
+ generated_at: string;
1007
+ filters_applied: {
1008
+ participant: string;
1009
+ subject: string | null;
1010
+ role: string | null;
1011
+ dependency_of: string | null;
1012
+ since: number;
1013
+ max_records: number;
1014
+ max_bytes: number;
1015
+ };
1016
+ participant: {
1017
+ participant_id: string;
1018
+ label: string;
1019
+ your_ack_seq: number;
1020
+ };
1021
+ sections: {
1022
+ participants: Array<Record<string, unknown>>;
1023
+ intents: BoothEventView[];
1024
+ contracts: Array<Record<string, unknown>>;
1025
+ assumptions: BoothEventView[];
1026
+ decisions_accepted: BoothEventView[];
1027
+ decisions_proposed: BoothEventView[];
1028
+ commitments: Array<Record<string, unknown>>;
1029
+ conflicts_open: Array<Record<string, unknown>>;
1030
+ conflicts_resolved: Array<Record<string, unknown>>;
1031
+ capability_offers: BoothEventView[];
1032
+ checks: Array<Record<string, unknown>>;
1033
+ evidence: BoothEventView[];
1034
+ };
1035
+ omitted: Record<string, Array<{
1036
+ count: number;
1037
+ reason: string;
1038
+ }>>;
1039
+ }
1040
+ /**
1041
+ * One hypothetical event input for a What-If evaluation (Living
1042
+ * Network Phase 11): the append path's event shape, plus an
1043
+ * optional id label so a later input in the same evaluation can
1044
+ * reference this one (a decision_accept naming an earlier
1045
+ * hypothetical decision, for example).
1046
+ */
1047
+ export interface BoothWhatIfEventInput {
1048
+ id?: string;
1049
+ type: string;
1050
+ subject: string;
1051
+ payload: Record<string, unknown>;
1052
+ in_reply_to?: string;
1053
+ related_ids?: string[];
1054
+ }
1055
+ /**
1056
+ * The What-If delta (Living Network Phase 11): what would change
1057
+ * if the hypothetical events landed, computed from base_seq.
1058
+ * Every delta entry is labeled hypothetical and carries base_seq.
1059
+ * Nothing in the booth changed.
1060
+ */
1061
+ export interface BoothWhatIfView {
1062
+ booth: {
1063
+ id: string;
1064
+ status: string;
1065
+ };
1066
+ hypothetical: boolean;
1067
+ base_seq: number;
1068
+ evaluated_seq: number;
1069
+ hypothetical_events: Array<{
1070
+ event_id: string;
1071
+ seq: number;
1072
+ type: string;
1073
+ subject: string;
1074
+ }>;
1075
+ delta: {
1076
+ new_conflicts: Array<Record<string, unknown>>;
1077
+ competing_contracts: Array<Record<string, unknown>>;
1078
+ stale_assumptions: Array<Record<string, unknown>>;
1079
+ affected_participants: Array<Record<string, unknown>>;
1080
+ commitment_status_changes: Array<Record<string, unknown>>;
1081
+ check_status_changes: Array<Record<string, unknown>>;
1082
+ };
1083
+ /** The coverage boundary: declared dependencies and subject links only. */
1084
+ boundary: string;
1085
+ note: string;
1086
+ participant_id: string;
1087
+ }
1088
+ /**
1089
+ * A capsule selection (Living Network Phase 12): the records of a
1090
+ * booth's log a capsule freezes. At least one of eventIds,
1091
+ * subjects, or sections must be named; an event id that is not in
1092
+ * the log refuses the call rather than being silently dropped.
1093
+ * Sections: decisions (decision, decision_accept), contracts
1094
+ * (contract), findings (finding), conflicts (conflict), commitments
1095
+ * (commitment, commitment_accept, commitment_cancel), checks (check), capabilities
1096
+ * (capability_offer).
1097
+ */
1098
+ export interface BoothCapsuleSelection {
1099
+ eventIds?: string[];
1100
+ subjects?: string[];
1101
+ sections?: Array<"decisions" | "contracts" | "findings" | "conflicts" | "commitments" | "checks" | "capabilities">;
1102
+ }
1103
+ /** One manifest entry: a selected record named by type, id, sequence, and the digest of its serialized record. */
1104
+ export interface BoothCapsuleManifestEntry {
1105
+ event_id: string;
1106
+ seq: number;
1107
+ type: string;
1108
+ subject: string;
1109
+ digest: string;
1110
+ }
1111
+ /**
1112
+ * The capsule preview (Living Network Phase 12): exactly what a
1113
+ * selection would include — the manifest entries, the Markdown
1114
+ * summary, and the digest the capsule would carry — with nothing
1115
+ * stored.
1116
+ */
1117
+ export interface BoothCapsulePreview {
1118
+ booth: {
1119
+ id: string;
1120
+ };
1121
+ selection: {
1122
+ event_ids: string[];
1123
+ subjects: string[];
1124
+ sections: string[];
1125
+ };
1126
+ preset: "temporary_org" | null;
1127
+ entries: BoothCapsuleManifestEntry[];
1128
+ counts: {
1129
+ events: number;
1130
+ by_type: Record<string, number>;
1131
+ };
1132
+ digest: string;
1133
+ summary_markdown: string;
1134
+ contracts_visible: boolean;
1135
+ note: string;
1136
+ }
1137
+ /** A stored capsule: its id, digest, and manifest; the read form also carries the summary. */
1138
+ export interface BoothCapsuleView {
1139
+ id: string;
1140
+ source_booth_id: string;
1141
+ created_by_participant_id: string | null;
1142
+ digest: string;
1143
+ created_at: string;
1144
+ manifest: Record<string, unknown>;
1145
+ summary_markdown?: string;
1146
+ }
1147
+ /**
1148
+ * An import's outcome (Living Network Phase 12): the records
1149
+ * imported (each naming its origin event id, the target event it
1150
+ * became, and whether the append was an idempotent replay) and
1151
+ * the records skipped, each with the reason it does not cross.
1152
+ */
1153
+ export interface BoothCapsuleImportResult {
1154
+ capsule_id: string;
1155
+ origin_booth_id: string;
1156
+ target_booth_id: string;
1157
+ imported: Array<{
1158
+ origin_event_id: string;
1159
+ event_id: string;
1160
+ type: string;
1161
+ replayed: boolean;
1162
+ }>;
1163
+ skipped: Array<{
1164
+ origin_event_id: string;
1165
+ type: string;
1166
+ reason: string;
1167
+ }>;
1168
+ note: string;
1169
+ }
1170
+ /** A skill export's outcome (Living Network Phase 12): the new capability version and the provenance its package carries. */
1171
+ export interface BoothCapsuleSkillExport {
1172
+ capability: {
1173
+ id: string;
1174
+ slug: string;
1175
+ name: string;
1176
+ };
1177
+ version: {
1178
+ id: string;
1179
+ version: string;
1180
+ digest: string;
1181
+ };
1182
+ artifact: {
1183
+ id: string;
1184
+ storage_key: string;
1185
+ };
1186
+ provenance: Record<string, unknown>;
1187
+ verification_receipt_ids: string[];
1188
+ }
1189
+ export interface BoothReplayOptions {
1190
+ /** Compute the state over events with a sequence number at most this; defaults to the latest. */
1191
+ untilSeq?: number;
1192
+ /** Narrow the returned event slice to this subject. The state view is not narrowed. */
1193
+ subject?: string;
1194
+ /** Participant whose reached-changes derivation to include. */
1195
+ participant?: string;
1196
+ }
1197
+ export interface BoothReplayView {
1198
+ booth: {
1199
+ id: string;
1200
+ status: string;
1201
+ expires_at: string;
1202
+ };
1203
+ as_of_seq: number;
1204
+ latest_seq: number;
1205
+ filters_applied: {
1206
+ until_seq: number | null;
1207
+ subject: string | null;
1208
+ participant: string | null;
1209
+ };
1210
+ /** The replay never asserts causation; this field says so, in the response. */
1211
+ causation_note: string;
1212
+ /** Ack cursors in the response are current values, not as of as_of_seq; this field says so. */
1213
+ ack_note: string;
1214
+ state: Record<string, unknown>;
1215
+ events: BoothEventView[];
1216
+ reached: {
1217
+ participant_id: string;
1218
+ entries: BoothEventView[];
1219
+ ack: {
1220
+ last_ack_seq: number;
1221
+ as_of: boolean;
1222
+ note: string;
1223
+ };
1224
+ } | null;
1225
+ }
1226
+ export interface BoothAskOptions {
1227
+ /** Exact subject to look up. */
1228
+ subject?: string;
1229
+ /** Exact event type to restrict to. */
1230
+ type?: string;
1231
+ /** Substring matched over subjects and payload summary fields — not semantic search. */
1232
+ q?: string;
1233
+ }
1234
+ export interface BoothAskRecord extends BoothEventView {
1235
+ citation: {
1236
+ event_id: string;
1237
+ seq: number;
1238
+ author_label: string;
1239
+ };
1240
+ }
1241
+ export interface BoothAskView {
1242
+ booth: {
1243
+ id: string;
1244
+ };
1245
+ query: {
1246
+ subject: string | null;
1247
+ type: string | null;
1248
+ q: string | null;
1249
+ };
1250
+ /** Per supplied parameter, how it matched: exact, or substring for q. */
1251
+ match: Record<string, string>;
1252
+ match_note: string;
1253
+ records: BoothAskRecord[];
1254
+ count: number;
1255
+ }
1256
+ /** Create a booth. Anonymous: no credential of any kind is sent. */
1257
+ export declare function createBooth(baseUrl: string, input?: {
1258
+ ttlSeconds?: number;
1259
+ closeCondition?: string;
1260
+ /**
1261
+ * Lock the booth at creation: { mode: "locked", method:
1262
+ * "generated_key" } returns the admission key once in
1263
+ * admission_secret; { mode: "locked", method: "password",
1264
+ * password } sets a human password the service never echoes.
1265
+ * { mode: "invitation_only" } creates a booth with no shared
1266
+ * admission secret, entered only by redeeming an invitation. On
1267
+ * either non-default mode, invitations issues the creator's first
1268
+ * invitations inside the create; their tokens return once in the
1269
+ * result's invitations. Omit for a link-only booth.
1270
+ */
1271
+ access?: {
1272
+ mode: string;
1273
+ method?: string;
1274
+ password?: string;
1275
+ defaultScopes?: string[];
1276
+ invitations?: BoothInvitationSpec[];
1277
+ };
1278
+ /**
1279
+ * Phase 8: create this booth as the child of a parent booth.
1280
+ * boothId is the parent's public id or its @namespace/slug alias;
1281
+ * credential proves standing in the parent (a parent participant
1282
+ * credential or the parent's creator credential). Omit credential
1283
+ * only when the call itself carries the parent owner's account
1284
+ * session. A refused parent creates nothing.
1285
+ */
1286
+ parent?: {
1287
+ boothId: string;
1288
+ credential?: string;
1289
+ };
1290
+ }, fetchFn?: FetchFn): Promise<BoothCreateResult>;
1291
+ export interface BoothClientOptions {
1292
+ baseUrl: string;
1293
+ boothId: string;
1294
+ /** A booth credential from a join. Optional until a join happens. */
1295
+ credential?: string;
1296
+ fetchFn?: FetchFn;
1297
+ }
1298
+ export declare class BoothClient {
1299
+ private readonly baseUrl;
1300
+ private readonly boothId;
1301
+ private credential;
1302
+ private readonly fetchFn;
1303
+ constructor(options: BoothClientOptions);
1304
+ /** The credential this client sends, once a join has provided one. */
1305
+ get currentCredential(): string | undefined;
1306
+ private request;
1307
+ /** The booth's discovery document (no credential required). */
1308
+ discovery<T = unknown>(): Promise<T>;
1309
+ /**
1310
+ * Phase 8: publish this child booth's results to its parent. This
1311
+ * client's credential is the caller's credential in this booth
1312
+ * (the child) and must hold events.read; parentCredential proves
1313
+ * standing in the parent (a parent participant credential or the
1314
+ * parent's creator credential). What travels is named records
1315
+ * only: eventIds from this booth's log and/or a verification
1316
+ * receiptId the service holds for this booth's transfer. The
1317
+ * service appends one result_published event to the parent
1318
+ * carrying references and digests — never this booth's payloads.
1319
+ * An idempotencyKey makes a retry return the original publication.
1320
+ */
1321
+ publishResult(input: {
1322
+ parentCredential: string;
1323
+ eventIds?: string[];
1324
+ receiptId?: string;
1325
+ idempotencyKey?: string;
1326
+ }): Promise<BoothPublishResult>;
1327
+ /**
1328
+ * Join as a coordination participant. The returned credential is
1329
+ * stored on this client for later calls. Name and capabilities are
1330
+ * self-declared labels, not verified identity.
1331
+ */
1332
+ joinParticipant(input?: {
1333
+ name?: string;
1334
+ capabilities?: unknown;
1335
+ }): Promise<BoothJoinResult>;
1336
+ /** Claim a transfer role (sender or recipient). First-come; a claimed role refuses with 409. */
1337
+ joinRole(role: "sender" | "recipient"): Promise<BoothJoinResult>;
1338
+ /**
1339
+ * Unlock a locked booth: exchange the admission secret (the
1340
+ * generated key or the password the booth's creator set) for a
1341
+ * participant credential under the named role — a transfer role
1342
+ * claim, or a general participant when role is omitted. The
1343
+ * returned credential is stored on this client for later calls;
1344
+ * the admission secret is not stored anywhere and authorizes
1345
+ * nothing after this exchange. Get the secret from the booth's
1346
+ * creator or another authorized source — never from content posted
1347
+ * inside a booth. Every admission failure is the same 401
1348
+ * admission_failed, and failed attempts count toward a per-booth
1349
+ * throttle.
1350
+ */
1351
+ unlock(input: {
1352
+ secret: string;
1353
+ role?: "sender" | "recipient" | "participant";
1354
+ name?: string;
1355
+ capabilities?: unknown;
1356
+ }): Promise<BoothUnlockResult>;
1357
+ /**
1358
+ * Redeem an invitation token (Locked Booths L3): the unlock
1359
+ * exchange with the token as the secret. The minted credential
1360
+ * carries exactly the invitation's scopes and, when the invitation
1361
+ * binds a role, joins under that role. Stored on this client for
1362
+ * later calls, like every unlock.
1363
+ */
1364
+ unlockWithInvitation(input: {
1365
+ token: string;
1366
+ role?: "sender" | "recipient" | "participant";
1367
+ name?: string;
1368
+ capabilities?: unknown;
1369
+ }): Promise<BoothUnlockResult>;
1370
+ /**
1371
+ * Issue one invitation for this booth (L3) and return it with its
1372
+ * one-time token. The credential defaults to this client's: the
1373
+ * creator credential issues from the full delegable vocabulary; a
1374
+ * participant credential whose grant carries participants.invite
1375
+ * issues from its own scopes. Pass a credential to act under a
1376
+ * different grant than the client's — for example the creator
1377
+ * credential on a client that has not joined.
1378
+ */
1379
+ createInvitation(spec?: BoothInvitationSpec, credential?: string): Promise<{
1380
+ invitation: BoothInvitationIssuedView;
1381
+ }>;
1382
+ /**
1383
+ * List this booth's invitations, metadata only — no token or hash
1384
+ * is ever returned. Creator-management grant required: pass the
1385
+ * creator credential, or construct the client with it.
1386
+ */
1387
+ listInvitations(credential?: string): Promise<{
1388
+ invitations: BoothInvitationView[];
1389
+ }>;
1390
+ /** Revoke one invitation, effective immediately. Creator-management grant required. */
1391
+ revokeInvitation(invitationId: string, credential?: string): Promise<{
1392
+ invitation: BoothInvitationView;
1393
+ }>;
1394
+ /**
1395
+ * Rotate this booth's admission secret (Locked Booths L4). The old
1396
+ * secret stops admitting new joins the moment this returns; the
1397
+ * new generated key is shown once, in the result. Participants who
1398
+ * already joined keep their credentials and access — rotation is
1399
+ * about admission, not eviction. Omitting method keeps the booth's
1400
+ * current method; a password rotation (or a switch to password)
1401
+ * requires the new password, which the service never echoes.
1402
+ * Creator-management grant required: pass the creator credential,
1403
+ * or construct the client with it.
1404
+ */
1405
+ rotateAdmissionSecret(input?: {
1406
+ method?: "generated_key" | "password";
1407
+ password?: string;
1408
+ }, credential?: string): Promise<BoothRotateSecretResult>;
1409
+ /**
1410
+ * Protect this booth (Locked Booths L5): lock a booth that was
1411
+ * created link-only, applying the create-time admission machinery
1412
+ * to it atomically — the verifier and the locked policy land
1413
+ * together or not at all. Omitting method mints a generated key,
1414
+ * shown once in the result; a password lock requires the password,
1415
+ * which the service never echoes. Participants who joined while
1416
+ * the booth was link-only keep their credentials and access —
1417
+ * locking closes admission behind them, it does not remove them.
1418
+ * A booth that is already locked (or invitation-only) refuses.
1419
+ * Creator-management grant required: pass the creator credential,
1420
+ * or construct the client with it.
1421
+ */
1422
+ protectBooth(input?: {
1423
+ method?: "generated_key" | "password";
1424
+ password?: string;
1425
+ }, credential?: string): Promise<BoothProtectResult>;
1426
+ /**
1427
+ * List this booth's participant grants, metadata only — no
1428
+ * credential or hash is ever returned. Creator-management grant
1429
+ * required: pass the creator credential, or construct the client
1430
+ * with it.
1431
+ */
1432
+ listParticipants(credential?: string): Promise<{
1433
+ participants: BoothParticipantView[];
1434
+ }>;
1435
+ /**
1436
+ * Revoke one participant grant (L4), effective on the revoked
1437
+ * credential's very next call. The participant's browser sessions
1438
+ * and subscription row are revoked in the same step; revoking a
1439
+ * transfer-role grant also releases the role claim.
1440
+ * Creator-management grant required — participants.revoke is
1441
+ * non-delegable, so no participant credential authorizes this.
1442
+ */
1443
+ revokeParticipant(participantId: string, credential?: string): Promise<{
1444
+ participant: BoothParticipantView;
1445
+ }>;
1446
+ /**
1447
+ * Revoke every live grant one invitation issued (L4) — the
1448
+ * distinct companion to revokeInvitation, which stops new
1449
+ * redemptions and leaves issued grants standing. Each grant dies
1450
+ * exactly as if revoked directly. Creator-management grant
1451
+ * required.
1452
+ */
1453
+ revokeInvitationGrants(invitationId: string, credential?: string): Promise<{
1454
+ invitation: BoothInvitationView;
1455
+ revoked_count: number;
1456
+ participants: BoothParticipantView[];
1457
+ }>;
1458
+ /**
1459
+ * File an access request against this booth (L4): a bounded note
1460
+ * for the booth's creator from a caller who cannot unlock it. No
1461
+ * credential is sent — the filer is precisely a caller without
1462
+ * one — and the request grants nothing and admits no one. The
1463
+ * creator acts on it, if at all, by issuing an invitation.
1464
+ */
1465
+ requestAccess(input?: {
1466
+ label?: string;
1467
+ message?: string;
1468
+ role?: "sender" | "recipient" | "participant";
1469
+ }): Promise<{
1470
+ access_request: BoothAccessRequestView;
1471
+ note: string;
1472
+ }>;
1473
+ /**
1474
+ * List this booth's access requests in filing order.
1475
+ * Creator-management grant required: pass the creator credential,
1476
+ * or construct the client with it.
1477
+ */
1478
+ listAccessRequests(credential?: string): Promise<{
1479
+ access_requests: BoothAccessRequestView[];
1480
+ }>;
1481
+ listEvents(options?: {
1482
+ since?: number;
1483
+ type?: string;
1484
+ subject?: string;
1485
+ }): Promise<{
1486
+ events: BoothEventView[];
1487
+ latest_seq: number;
1488
+ }>;
1489
+ appendEvent(input: {
1490
+ type: string;
1491
+ subject: string;
1492
+ payload: Record<string, unknown>;
1493
+ idempotencyKey?: string;
1494
+ inReplyTo?: string;
1495
+ relatedIds?: string[];
1496
+ }): Promise<{
1497
+ event: BoothEventView;
1498
+ replayed: boolean;
1499
+ }>;
1500
+ getState<T = unknown>(): Promise<T>;
1501
+ /**
1502
+ * Propose a commitment (Living Network Phase 3): a commitment record in
1503
+ * the booth log. The named parties endorse it with acceptCommitment —
1504
+ * never the proposer; endorsement here means a second credential
1505
+ * stood behind the commitment, and "authorized" is reserved for account
1506
+ * holders. Fulfillment is computed from the log: every named
1507
+ * party endorsed and every checkable condition met.
1508
+ */
1509
+ proposeCommitment(input: BoothCommitmentProposal): Promise<{
1510
+ event: BoothEventView;
1511
+ replayed: boolean;
1512
+ }>;
1513
+ /**
1514
+ * Endorse a commitment. Refused from the commitment's proposer (403
1515
+ * commitment_self_accept), mirroring decision acceptance: an
1516
+ * endorsement is a second participant standing behind the commitment.
1517
+ */
1518
+ acceptCommitment(commitmentEventId: string): Promise<{
1519
+ event: BoothEventView;
1520
+ replayed: boolean;
1521
+ }>;
1522
+ /**
1523
+ * Cancel a commitment. Only the commitment's proposer or one of its endorsers
1524
+ * may cancel (403 commitment_cancel_forbidden otherwise); a cancelled
1525
+ * commitment is terminal.
1526
+ */
1527
+ cancelCommitment(commitmentEventId: string): Promise<{
1528
+ event: BoothEventView;
1529
+ replayed: boolean;
1530
+ }>;
1531
+ /** The booth's commitments with their computed statuses, from the state document. */
1532
+ listCommitments(): Promise<BoothCommitmentView[]>;
1533
+ /**
1534
+ * Declare a check (Living Network Phase 5): a set of typed
1535
+ * assertions the service evaluates against the booth's log. The
1536
+ * declaration is an ordinary log event; the result is computed
1537
+ * on read by getCheck / listChecks and is never stored, so the
1538
+ * same declaration re-evaluates as evidence lands. The service
1539
+ * never runs package code — assertions are data, evaluated by
1540
+ * the service's deterministic evaluator.
1541
+ */
1542
+ declareCheck(input: BoothCheckSpec): Promise<{
1543
+ event: BoothEventView;
1544
+ replayed: boolean;
1545
+ }>;
1546
+ /** The booth's checks with their computed results. */
1547
+ listChecks(): Promise<BoothCheckView[]>;
1548
+ /** One check's computed result, by the check event's id. */
1549
+ getCheck(checkEventId: string): Promise<BoothCheckView>;
1550
+ /**
1551
+ * Set or clear the booth's close condition (Phase 3). Pass
1552
+ * "commitment_terminal:<commitment event id>" to close the booth when the
1553
+ * named commitment reaches a terminal state, "transfer_accepted" or
1554
+ * "all_acks" for the standing conditions, or null to clear.
1555
+ * Creator-management grant required: pass the creator credential,
1556
+ * or construct the client with it.
1557
+ */
1558
+ setCloseCondition(closeCondition: string | null, credential?: string): Promise<BoothCloseConditionResult>;
1559
+ /**
1560
+ * The changes feed: events relevant to this participant after the
1561
+ * cursor, with reasons. waitSeconds holds the request open for a
1562
+ * relevant event (25 seconds at most) and returns early when one
1563
+ * lands. Delivery is at-least-once; resume with next_since.
1564
+ */
1565
+ getChanges(options?: BoothChangesOptions): Promise<BoothChangesView>;
1566
+ /**
1567
+ * Phase 13: live listening over the durable log — the changes
1568
+ * feed as server-sent events. Yields one open frame, one event
1569
+ * frame per relevant event as it lands, and a final end frame
1570
+ * when the server closes the stream at its set lifetime. Live
1571
+ * listening is best-effort with durable catch-up: a dropped
1572
+ * stream loses nothing, and reconnecting with the last seq
1573
+ * received (options.since) serves everything missed from the
1574
+ * log before the stream goes live again. Pass options.signal
1575
+ * to stop early; leaving the loop also closes the stream.
1576
+ */
1577
+ streamChanges(options?: BoothStreamOptions): AsyncGenerator<BoothStreamFrame>;
1578
+ /** Record that this participant has seen events up to seq. An ack never resolves a conflict. */
1579
+ ack(seq: number): Promise<{
1580
+ acked_seq: number;
1581
+ latest_seq: number;
1582
+ closed?: boolean;
1583
+ }>;
1584
+ /** Replace this participant's subject subscriptions in full. */
1585
+ setSubscriptions(subjects: string[]): Promise<{
1586
+ subjects: string[];
1587
+ subscription: BoothSubscriptionView;
1588
+ }>;
1589
+ /** Read this participant's durable subscription (subjects, delivery mode, cursors). */
1590
+ getSubscription(): Promise<{
1591
+ subscription: BoothSubscriptionView;
1592
+ }>;
1593
+ /** The participant's pending signals: what in this booth needs their attention, and why. */
1594
+ listSignals(): Promise<BoothSignalsView>;
1595
+ /** Acknowledge a signal. This records that it was seen; it never changes the underlying condition. */
1596
+ ackSignal(signalKey: string): Promise<{
1597
+ signal_key: string;
1598
+ state: string;
1599
+ signal: BoothSignalView;
1600
+ }>;
1601
+ /** Dismiss a signal: seen, and no action will be taken on it. */
1602
+ dismissSignal(signalKey: string): Promise<{
1603
+ signal_key: string;
1604
+ state: string;
1605
+ signal: BoothSignalView;
1606
+ }>;
1607
+ /**
1608
+ * Declare a watcher: one typed condition on this participant's
1609
+ * subscription (Phase 6). When the condition holds against the
1610
+ * booth's log it derives as a signal with reason watcher_triggered.
1611
+ * Declaring the same condition again returns the existing watcher
1612
+ * with created false.
1613
+ */
1614
+ createWatcher(condition: BoothWatcherSpec): Promise<{
1615
+ watcher: BoothWatcherView;
1616
+ created: boolean;
1617
+ subscription: BoothSubscriptionView;
1618
+ }>;
1619
+ /** This participant's declared watchers in this booth. */
1620
+ listWatchers(): Promise<BoothWatchersView>;
1621
+ /** Revoke one of this participant's watchers, by its id. */
1622
+ revokeWatcher(watcherId: string): Promise<{
1623
+ revoked: string;
1624
+ watchers: BoothWatcherView[];
1625
+ subscription: BoothSubscriptionView;
1626
+ }>;
1627
+ /**
1628
+ * Phase 10: create a cross-booth subscription into this booth.
1629
+ * This client's credential is the caller's credential in this
1630
+ * booth (the destination) and must hold subscriptions.manage;
1631
+ * sourceCredential proves standing in the source (a source
1632
+ * participant holding events.read, or the source's creator
1633
+ * credential) and is checked at creation, never stored. The
1634
+ * source must be account-owned in v1, and its owner must have set
1635
+ * a publication policy for anything to cross. subjects and
1636
+ * eventTypes narrow what this subscription receives on top of the
1637
+ * policy. An identical active subscription is returned with
1638
+ * created false.
1639
+ */
1640
+ createCrossSubscription(input: {
1641
+ sourceBoothId: string;
1642
+ sourceCredential: string;
1643
+ subjects?: string[];
1644
+ eventTypes?: string[] | null;
1645
+ }): Promise<BoothCrossSubscriptionResult>;
1646
+ /** This participant's cross-booth subscriptions into this booth. */
1647
+ listCrossSubscriptions(): Promise<{
1648
+ subscriptions: BoothCrossSubscriptionView[];
1649
+ }>;
1650
+ /**
1651
+ * Revoke one of this participant's cross-booth subscriptions, by
1652
+ * its id. Revoking stops further forwards from that source into
1653
+ * this booth; events already forwarded stay in the log.
1654
+ */
1655
+ revokeCrossSubscription(subscriptionId: string): Promise<{
1656
+ revoked: string;
1657
+ subscription: BoothCrossSubscriptionView;
1658
+ }>;
1659
+ private briefSuffix;
1660
+ /**
1661
+ * The booth Brief (Living Network Phase 4): the state cut to the
1662
+ * given filters, as a deterministic projection of the log.
1663
+ * Accepted and proposed material sit in separate sections, every
1664
+ * entry carries its source event id, and omitted counts what the
1665
+ * filters and limits cut, with the reason. Nothing is stored and
1666
+ * nothing is reworded.
1667
+ */
1668
+ getBrief(options?: BoothBriefOptions): Promise<BoothBriefView>;
1669
+ /** The same Brief rendered as Markdown (the server's format=md form). */
1670
+ getBriefMarkdown(options?: BoothBriefOptions): Promise<string>;
1671
+ /**
1672
+ * The booth Replay (Living Network Phase 4): the state as of a
1673
+ * sequence number, plus the event slice. With a participant, also
1674
+ * the changes that reached them by then; their ack cursor is
1675
+ * labeled as a current value, not as-of, and the response carries
1676
+ * its causation note — sequence order is never causation.
1677
+ */
1678
+ getReplay(options?: BoothReplayOptions): Promise<BoothReplayView>;
1679
+ /**
1680
+ * Ask the Booth (Living Network Phase 4): an exact-subject lookup
1681
+ * over the log with citations on every record. q is a substring
1682
+ * match over subjects and summary fields — the response labels it
1683
+ * as substring matching, not semantic search. At least one of
1684
+ * subject, type, or q is required.
1685
+ */
1686
+ ask(options?: BoothAskOptions): Promise<BoothAskView>;
1687
+ /**
1688
+ * The booth What-If evaluation (Living Network Phase 11):
1689
+ * validate the hypothetical event inputs with the append path's
1690
+ * own validation, append them in memory to a copy of the log
1691
+ * (truncated at atSeq when given), and return the delta — new
1692
+ * conflicts, competing contracts, stale assumptions, affected
1693
+ * participants, commitment and check status changes — every entry
1694
+ * labeled hypothetical with its base seq. Nothing is written:
1695
+ * the booth's log and state are unchanged, and making any of it
1696
+ * real means posting the events. The impact graph covers
1697
+ * declared dependencies and subject links only; the evaluation
1698
+ * cannot see anything the log does not declare.
1699
+ */
1700
+ evaluateWhatIf(input: {
1701
+ events: BoothWhatIfEventInput[];
1702
+ atSeq?: number;
1703
+ }): Promise<BoothWhatIfView>;
1704
+ private capsuleBody;
1705
+ /**
1706
+ * The capsule selection preview (Living Network Phase 12): the
1707
+ * sensitive-content review step. Returns exactly what the
1708
+ * selection would include — the manifest entries, the Markdown
1709
+ * summary, and the digest the capsule would carry — and stores
1710
+ * nothing. Creation requires the same selection echoed back.
1711
+ */
1712
+ previewCapsule(input: {
1713
+ selection?: BoothCapsuleSelection;
1714
+ preset?: "temporary_org";
1715
+ }): Promise<BoothCapsulePreview>;
1716
+ /**
1717
+ * Create a capsule from the echoed selection (Living Network
1718
+ * Phase 12): a manifest built from the log, a Markdown summary
1719
+ * rendered from the same data, and the full selected records,
1720
+ * stored as one artifact. Pin expectedDigest to a preview's
1721
+ * digest and creation refuses (409 capsule_drift) when the log
1722
+ * has moved since the preview. The temporary_org preset exports
1723
+ * a temporary agent organization: the booth's full working
1724
+ * record plus an organization block (objective, roster,
1725
+ * completion check ids).
1726
+ */
1727
+ createCapsule(input: {
1728
+ selection?: BoothCapsuleSelection;
1729
+ preset?: "temporary_org";
1730
+ expectedDigest?: string;
1731
+ }): Promise<BoothCapsuleView>;
1732
+ /** One capsule created from this booth, with its summary. */
1733
+ getCapsule(capsuleId: string): Promise<BoothCapsuleView>;
1734
+ /** The capsules created from this booth, newest first (ids, digests, counts). */
1735
+ listCapsules(): Promise<Array<{
1736
+ id: string;
1737
+ digest: string;
1738
+ created_at: string;
1739
+ preset: "temporary_org" | null;
1740
+ counts: {
1741
+ events: number;
1742
+ by_type: Record<string, number>;
1743
+ };
1744
+ }>>;
1745
+ /**
1746
+ * Import a capsule into this booth (Living Network Phase 12).
1747
+ * This client is the TARGET booth; the caller's credential here
1748
+ * is the only one involved — a capsule grants no access to its
1749
+ * source booth and no source credential takes part. Records
1750
+ * land as new proposals authored by the caller, each carrying
1751
+ * provenance { capsule_id, origin_booth_id, origin_event_id }:
1752
+ * accepted decisions arrive proposed, contracts arrive as new
1753
+ * versions authored by the caller, and endorsement acts and
1754
+ * service-authored records do not cross (the result lists every
1755
+ * skip with its reason). Importing the same capsule into the
1756
+ * same booth twice replays instead of duplicating.
1757
+ */
1758
+ importCapsule(capsuleId: string): Promise<BoothCapsuleImportResult>;
1759
+ /**
1760
+ * Export a skill from a capsule of this booth (Living Network
1761
+ * Phase 12, §20): package a capability the capsule names (a
1762
+ * capability_offer event's version — picked by eventId or
1763
+ * versionId, or the capsule's only offered version) again
1764
+ * through the standard createCapability path, under the
1765
+ * exporter's booth identity or an ephemeral booth user, with a
1766
+ * provenance.json file added to the package naming the capsule,
1767
+ * the origin booth and event, the origin version and digest,
1768
+ * and the verification receipt ids the log holds for the
1769
+ * capability.
1770
+ */
1771
+ exportCapsuleSkill(capsuleId: string, input?: {
1772
+ eventId?: string;
1773
+ versionId?: string;
1774
+ }): Promise<BoothCapsuleSkillExport>;
1775
+ }
1776
+ export {};