@moonbooth/sdk 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1531 @@
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
+ getBoothAlias(id: string): Promise<{
381
+ alias: BoothAliasView | null;
382
+ }>;
383
+ claimBoothAlias(id: string, slug: string): Promise<{
384
+ alias: BoothAliasView;
385
+ }>;
386
+ renameBoothAlias(id: string, slug: string): Promise<{
387
+ alias: BoothAliasView;
388
+ }>;
389
+ releaseBoothAlias(id: string): Promise<{
390
+ alias: BoothAliasView;
391
+ }>;
392
+ /** Resolve an alias (@namespace/slug) to its booth's public discovery document. */
393
+ resolveAlias(namespace: string, slug: string): Promise<{
394
+ alias: string;
395
+ booth: Record<string, unknown>;
396
+ }>;
397
+ }
398
+ /** The account's namespace view (Phase 7). */
399
+ export interface NamespaceView {
400
+ name: string;
401
+ slug: string;
402
+ created_at: string;
403
+ renamed_at: string | null;
404
+ }
405
+ /** A persistent booth in its owner's admin view (Phase 7). */
406
+ export interface OwnedBoothView {
407
+ id: string;
408
+ url: string;
409
+ kind: string;
410
+ status: string;
411
+ lifecycle: Record<string, unknown>;
412
+ name: string | null;
413
+ objective: string | null;
414
+ alias: string | null;
415
+ access_mode: string;
416
+ created_at: string;
417
+ expires_at: string | null;
418
+ closed_at: string | null;
419
+ archived_at: string | null;
420
+ deleted_at: string | null;
421
+ limits: {
422
+ max_participants?: number | null;
423
+ retention_days?: number | null;
424
+ } | null;
425
+ }
426
+ /** An alias naming one persistent booth inside a namespace (Phase 7). */
427
+ export interface BoothAliasView {
428
+ name: string;
429
+ namespace: string;
430
+ slug: string;
431
+ booth_id: string;
432
+ url: string;
433
+ status: string;
434
+ created_at: string;
435
+ released_at: string | null;
436
+ }
437
+ export interface CreatePersistentBoothInput {
438
+ displayName?: string;
439
+ objective?: string;
440
+ accessMode?: "link_only" | "generated_key" | "password" | "invitation_only";
441
+ password?: string;
442
+ invitations?: Array<Record<string, unknown>>;
443
+ /**
444
+ * Phase 8: create this booth as the child of a persistent booth the
445
+ * same account owns (the parent's public id). The session is the
446
+ * standing; a parent owned by another account reads as not found.
447
+ */
448
+ parentBoothId?: string;
449
+ }
450
+ export interface ConfigureOwnedBoothInput {
451
+ displayName?: string | null;
452
+ objective?: string | null;
453
+ limits?: {
454
+ maxParticipants?: number | null;
455
+ retentionDays?: number | null;
456
+ };
457
+ }
458
+ /** One rotated participant credential, shown once by rotateOwnedBoothCredentials. */
459
+ export interface RotatedCredentialView {
460
+ participant_id: string;
461
+ kind: string;
462
+ transfer_role: string | null;
463
+ credential: string;
464
+ }
465
+ /** The metadata view of an account webhook. Never carries the secret or its stored form. */
466
+ export interface WebhookView {
467
+ id: string;
468
+ url: string;
469
+ scope: "booth" | "account";
470
+ booth_id: string | null;
471
+ event_types: string[] | null;
472
+ status: "active" | "paused";
473
+ last_delivery_at: string | null;
474
+ created_at: string;
475
+ updated_at: string;
476
+ paused_at: string | null;
477
+ }
478
+ export interface CreateWebhookInput {
479
+ url: string;
480
+ /** Filter entries from the webhook vocabulary; omit or null for every event. */
481
+ eventTypes?: string[] | null;
482
+ /** A booth's public id, to scope the webhook to that booth. */
483
+ boothId?: string | null;
484
+ /** A participant credential for the named booth, proving the account takes part in it. */
485
+ participantCredential?: string | null;
486
+ }
487
+ export interface UpdateWebhookInput {
488
+ url?: string;
489
+ eventTypes?: string[] | null;
490
+ status?: "active" | "paused";
491
+ }
492
+ export interface WebhookDeliveryView {
493
+ id: string;
494
+ delivery_id: string;
495
+ webhook_id: string;
496
+ booth_id: string | null;
497
+ event_id: string | null;
498
+ signal_key: string | null;
499
+ event_type: string;
500
+ kind: "event" | "signal" | "lifecycle" | "test";
501
+ attempt: number;
502
+ state: "delivered" | "failed" | "dead";
503
+ status_code: number | null;
504
+ error_category: string | null;
505
+ created_at: string;
506
+ }
507
+ /** One invitation to issue at creation or through the invitations endpoint (Locked Booths L3). */
508
+ export interface BoothInvitationSpec {
509
+ /** The role a redemption joins under; "participant" (or omitting it) leaves the role to the redemption. */
510
+ role?: "sender" | "recipient" | "participant";
511
+ /** The permission subset the redeemed credential carries. Defaults to the bound role's default set. */
512
+ scopes?: string[];
513
+ label?: string;
514
+ subjectRestrictions?: string[];
515
+ maxRedemptions?: number;
516
+ expiresInSeconds?: number;
517
+ }
518
+ /** The metadata view of a booth invitation. Never carries the token or its hash. */
519
+ export interface BoothInvitationView {
520
+ id: string;
521
+ booth_id: string;
522
+ issuer: {
523
+ kind: "creator" | "participant";
524
+ participant_id?: string | null;
525
+ };
526
+ role_binding: string | null;
527
+ scopes: string[];
528
+ subject_restrictions: string[] | null;
529
+ label: string | null;
530
+ max_redemptions: number;
531
+ redemption_count: number;
532
+ state: "active" | "revoked" | "expired" | "exhausted";
533
+ expires_at: string;
534
+ revoked_at: string | null;
535
+ created_at: string;
536
+ }
537
+ /** The metadata view of a participant grant (Locked Booths L4). Never carries the credential or its hash. */
538
+ export interface BoothParticipantView {
539
+ id: string;
540
+ kind: "transfer" | "participant";
541
+ transfer_role: string | null;
542
+ display_name: string | null;
543
+ permissions: string[];
544
+ invitation_id: string | null;
545
+ issuer_participant_id: string | null;
546
+ subject_restrictions: string[] | null;
547
+ state: "active" | "revoked" | "expired";
548
+ joined_at: string;
549
+ expires_at: string | null;
550
+ revoked_at: string | null;
551
+ }
552
+ /** The result of rotating a booth's admission secret (L4). admission_secret is present only for a generated-key rotation. */
553
+ export interface BoothRotateSecretResult {
554
+ admission_method: "generated_key" | "password";
555
+ admission_secret?: string;
556
+ admission_secret_note: string;
557
+ access: unknown;
558
+ }
559
+ /** The result of protecting a link-only booth (L5). admission_secret is present only for a generated key, and shown once. */
560
+ export interface BoothProtectResult {
561
+ admission_method: "generated_key" | "password";
562
+ admission_secret?: string;
563
+ admission_secret_note: string;
564
+ access: unknown;
565
+ }
566
+ /** One access request (Locked Booths L4). Filing grants nothing and admits no one. */
567
+ export interface BoothAccessRequestView {
568
+ id: string;
569
+ booth_id: string;
570
+ label: string | null;
571
+ message: string | null;
572
+ requested_role: string | null;
573
+ status: "pending";
574
+ created_at: string;
575
+ }
576
+ /** An invitation as returned at issuance: the metadata view plus its one-time token. */
577
+ export interface BoothInvitationIssuedView extends BoothInvitationView {
578
+ /** The invitation token (mbi_ prefix), shown once. Presenting it at unlock redeems the invitation. */
579
+ token: string;
580
+ }
581
+ export interface BoothCreateResult {
582
+ id: string;
583
+ url: string;
584
+ expires_at: string;
585
+ ttl_seconds?: number;
586
+ close_condition?: string | null;
587
+ /** Shown once; authorizes closing the booth. Present on a fresh create only. */
588
+ creator_credential?: string;
589
+ /** Locked creation only: the access policy the booth was created with. */
590
+ access?: unknown;
591
+ /** Locked creation only: the admission method ("generated_key" or "password"). */
592
+ admission_method?: string | null;
593
+ /** Shown once, locked creation with a generated key only: the admission key. */
594
+ admission_secret?: string | null;
595
+ /** L3: invitations issued inside the create, each with its one-time token. */
596
+ invitations?: BoothInvitationIssuedView[];
597
+ /**
598
+ * Phase 8: present when the booth was created as a child — the
599
+ * parent's public id and the child booth's own URL.
600
+ */
601
+ parent?: {
602
+ id: string;
603
+ url: string;
604
+ };
605
+ [key: string]: unknown;
606
+ }
607
+ export interface BoothJoinResult {
608
+ role: string;
609
+ participant_id?: string;
610
+ credential: string;
611
+ credential_note: string;
612
+ discovery: unknown;
613
+ }
614
+ /** Phase 10: one cross-booth subscription as the API returns it. */
615
+ export interface BoothCrossSubscriptionView {
616
+ id: string;
617
+ source_booth_id: string;
618
+ destination_booth_id: string;
619
+ participant_id: string;
620
+ subjects: string[];
621
+ event_types: string[] | null;
622
+ state: "active" | "revoked";
623
+ created_at: string;
624
+ }
625
+ /** Phase 10: the create response — created is false when an identical active subscription already existed. */
626
+ export interface BoothCrossSubscriptionResult {
627
+ subscription: BoothCrossSubscriptionView;
628
+ created: boolean;
629
+ }
630
+ /** Phase 8: the publication record returned by the publish endpoint. */
631
+ export interface BoothPublishResult {
632
+ /** The service-authored result_published event as it landed in the parent. */
633
+ event: {
634
+ id: string;
635
+ seq: number;
636
+ type: string;
637
+ subject: string | null;
638
+ payload: {
639
+ child_booth_id: string;
640
+ child_url: string;
641
+ events: Array<{
642
+ event_id: string;
643
+ seq: number;
644
+ type: string;
645
+ subject: string | null;
646
+ digest: string;
647
+ }>;
648
+ receipt?: {
649
+ receipt_id: string;
650
+ receipt_digest: string;
651
+ };
652
+ [key: string]: unknown;
653
+ };
654
+ [key: string]: unknown;
655
+ };
656
+ parent: {
657
+ id: string;
658
+ url: string;
659
+ };
660
+ child: {
661
+ id: string;
662
+ };
663
+ /** True when an idempotency key replayed the original publication. */
664
+ replayed: boolean;
665
+ }
666
+ export interface BoothUnlockResult {
667
+ role: string;
668
+ participant_id?: string;
669
+ credential: string;
670
+ credential_note: string;
671
+ /** Which admission method the secret matched: "generated_key", "password", or "invitation". */
672
+ admission_method: string;
673
+ discovery: unknown;
674
+ }
675
+ export interface BoothEventView {
676
+ id: string;
677
+ seq: number;
678
+ type: string;
679
+ subject: string;
680
+ payload: Record<string, unknown>;
681
+ author: unknown;
682
+ in_reply_to: string | null;
683
+ related_ids: string[] | null;
684
+ created_at: string;
685
+ status?: string;
686
+ status_reason?: string | null;
687
+ /** Changes feed only: why this event surfaced for the caller. */
688
+ reasons?: string[];
689
+ relevance?: {
690
+ reasons: string[];
691
+ };
692
+ }
693
+ export interface BoothSubscriptionView {
694
+ id: string;
695
+ booth_id: string;
696
+ participant_id: string;
697
+ subjects: string[];
698
+ /** The watchers declared on this subscription (Phase 6), in declaration order. */
699
+ conditions: BoothWatcherView[];
700
+ event_types: string[] | null;
701
+ delivery_mode: string;
702
+ delivered_cursor: number;
703
+ acked_cursor: number;
704
+ state: string;
705
+ last_delivery_at: string | null;
706
+ created_at: string;
707
+ }
708
+ /**
709
+ * One watcher declaration (Living Network Phase 6): a typed
710
+ * condition on the participant's subscription, from a closed set —
711
+ * contract_changed { subject }, contract_version { subject, version },
712
+ * pact_deadline_within { window_seconds }, check_failed
713
+ * { check_event_id | subject }, evidence_present
714
+ * { subject, evidence_kind }, offer_on_subject { subject },
715
+ * dependency_invalidated { subject }, booth_expiring_within
716
+ * { window_seconds }. When the condition holds against the booth's
717
+ * log, it derives as a signal with reason watcher_triggered.
718
+ */
719
+ export interface BoothWatcherSpec {
720
+ kind: string;
721
+ subject?: string;
722
+ version?: string;
723
+ window_seconds?: number;
724
+ check_event_id?: string;
725
+ evidence_kind?: string;
726
+ }
727
+ export interface BoothWatcherView {
728
+ id: string;
729
+ kind: string;
730
+ subject: string | null;
731
+ version: string | null;
732
+ window_seconds: number | null;
733
+ check_event_id: string | null;
734
+ evidence_kind: string | null;
735
+ created_at: string;
736
+ }
737
+ export interface BoothWatchersView {
738
+ watchers: BoothWatcherView[];
739
+ subscription_id: string;
740
+ participant_id: string;
741
+ }
742
+ export interface BoothChangesView {
743
+ events: BoothEventView[];
744
+ latest_seq: number;
745
+ acked_seq: number;
746
+ next_since: number;
747
+ subscription: BoothSubscriptionView;
748
+ wake: {
749
+ poll_after_seconds: number;
750
+ long_poll_max_seconds: number;
751
+ };
752
+ }
753
+ export interface BoothChangesOptions {
754
+ since?: number;
755
+ until?: number;
756
+ mode?: "relevant" | "all";
757
+ /** Hold the request open for a relevant event, up to 25 seconds server-side. */
758
+ waitSeconds?: number;
759
+ }
760
+ export interface BoothSignalView {
761
+ signal_key: string;
762
+ source_event_id: string;
763
+ subject: string;
764
+ participant_id: string;
765
+ reason: string;
766
+ severity: "high" | "medium" | "low";
767
+ state_ref: number;
768
+ created_from_seq: number;
769
+ /** Watcher signals only (Phase 6): the declared condition that triggered. */
770
+ watcher_id?: string;
771
+ watcher_kind?: string;
772
+ }
773
+ export interface BoothSignalsView {
774
+ signals: BoothSignalView[];
775
+ latest_seq: number;
776
+ counts: {
777
+ pending: number;
778
+ acknowledged: number;
779
+ dismissed: number;
780
+ };
781
+ participant_id: string;
782
+ }
783
+ /**
784
+ * One typed condition in a pact proposal (Living Network Phase 3).
785
+ * The closed set the service can evaluate: contract_version
786
+ * { subject, version }, event_exists { type, subject },
787
+ * acks_complete { seq | subject }, digest_matches
788
+ * { capability_version_id | subject, digest }, decision_accepted
789
+ * { subject }, deadline { at }. Any other kind is accepted at
790
+ * propose time and evaluates to requires_review — the pact can
791
+ * never read fulfilled on a condition the service cannot check.
792
+ */
793
+ export interface BoothPactConditionSpec {
794
+ kind: string;
795
+ subject?: string;
796
+ version?: string;
797
+ type?: string;
798
+ seq?: number;
799
+ capability_version_id?: string;
800
+ digest?: string;
801
+ at?: string;
802
+ [key: string]: unknown;
803
+ }
804
+ export interface BoothPactProposal {
805
+ /** The commitment, in one line. Required. */
806
+ title: string;
807
+ /** The event subject the pact hangs on. Defaults to the first of subjects, or "pact". */
808
+ subject?: string;
809
+ /** Subjects the pact concerns (contract subjects, capability subjects, decision subjects). */
810
+ subjects?: string[];
811
+ /** Participant ids or transfer roles ("sender", "recipient") the pact binds. Every named party must endorse before the pact can fulfill. */
812
+ parties?: string[];
813
+ /** The commitments themselves, as text. The service stores them verbatim and never interprets them. */
814
+ commitments?: string[];
815
+ /** Typed conditions the service evaluates against the booth log. */
816
+ conditions?: BoothPactConditionSpec[];
817
+ /** ISO timestamp; a pact whose conditions are unmet at its deadline reads failed (endorsed) or expired (not yet endorsed by every party). */
818
+ dueAt?: string;
819
+ }
820
+ export interface BoothPactConditionView extends BoothPactConditionSpec {
821
+ status: "met" | "unmet" | "requires_review";
822
+ detail: string;
823
+ satisfied_at: string | null;
824
+ }
825
+ export interface BoothPactView {
826
+ event_id: string;
827
+ seq: number;
828
+ subject: string;
829
+ title: string | null;
830
+ proposer_participant_id: string;
831
+ parties: string[];
832
+ party_participant_ids: string[];
833
+ endorsed_by: string[];
834
+ commitments: string[];
835
+ conditions: BoothPactConditionView[];
836
+ due_at: string | null;
837
+ status: "proposed" | "endorsed" | "active" | "evidence_pending" | "fulfilled" | "failed" | "expired" | "cancelled" | "requires_review";
838
+ status_reason: string | null;
839
+ created_at: string;
840
+ }
841
+ /**
842
+ * One typed assertion in a check declaration (Living Network
843
+ * Phase 5). The set the service can evaluate: evidence_present
844
+ * { evidence_kind, subject }, contract_versions_aligned
845
+ * { subjects, version? }, digest_matches
846
+ * { capability_version_id | subject, digest }, acks_complete
847
+ * { seq | subject }, pacts_fulfilled { pact_ids },
848
+ * no_open_blocking_conflicts { subject? }. Any other kind is
849
+ * accepted at declare time and evaluates to unsupported — a check
850
+ * can never read passed on an assertion the service cannot
851
+ * evaluate.
852
+ */
853
+ export interface BoothCheckAssertionSpec {
854
+ kind: string;
855
+ evidence_kind?: string;
856
+ subject?: string;
857
+ subjects?: string[];
858
+ version?: string;
859
+ capability_version_id?: string;
860
+ digest?: string;
861
+ seq?: number;
862
+ pact_ids?: string[];
863
+ [key: string]: unknown;
864
+ }
865
+ export interface BoothCheckTarget {
866
+ kind: "booth" | "transfer" | "pact" | "contract";
867
+ /** Required when kind is "pact": the pact event the check is about. */
868
+ pact_event_id?: string;
869
+ /** Required when kind is "contract": the contract subject the check is about. */
870
+ subject?: string;
871
+ }
872
+ export interface BoothCheckSpec {
873
+ /** What the check verifies, in one line. Required. */
874
+ title: string;
875
+ /** The event subject the check hangs on. Defaults to "check". */
876
+ subject?: string;
877
+ /** What the check is about. Defaults to the whole booth. */
878
+ target?: BoothCheckTarget;
879
+ /** Typed assertions the service evaluates against the booth log. Omit for a not_run check. */
880
+ assertions?: BoothCheckAssertionSpec[];
881
+ }
882
+ export interface BoothAssertionView {
883
+ kind: string;
884
+ status: "passed" | "failed" | "incomplete" | "awaiting_evidence" | "unsupported";
885
+ detail: string;
886
+ /** self_reported: a participant's attestation. service_computed: derived by the service from records it holds. verified: receipt-backed. */
887
+ assurance: "self_reported" | "service_computed" | "verified";
888
+ /** The log events the evaluation relied on — the result's evidence citation. */
889
+ evidence_event_ids: string[];
890
+ receipt_id: string | null;
891
+ }
892
+ export interface BoothCheckView {
893
+ check_event_id: string;
894
+ seq: number;
895
+ subject: string;
896
+ title: string;
897
+ target: {
898
+ kind: string;
899
+ pact_event_id: string | null;
900
+ subject: string | null;
901
+ };
902
+ status: "passed" | "failed" | "incomplete" | "awaiting_evidence" | "not_run" | "unsupported";
903
+ status_reason: string | null;
904
+ assertions: BoothAssertionView[];
905
+ author_participant_id: string | null;
906
+ created_at: string;
907
+ /** The log position this evaluation ran against. A re-read after new events is a new evaluation. */
908
+ evaluated_seq: number;
909
+ }
910
+ export interface BoothCloseConditionResult {
911
+ id: string;
912
+ status: string;
913
+ lifecycle: unknown;
914
+ close_condition: string | null;
915
+ }
916
+ /**
917
+ * Filters for the booth Brief (Living Network Phase 4): the state
918
+ * cut to what the filters admit. Accepted and proposed material sit
919
+ * in separate sections, every entry carries its source event id,
920
+ * and the response's omitted block counts what the filters and
921
+ * limits cut, with the reason.
922
+ */
923
+ export interface BoothBriefOptions {
924
+ /** Participant the brief is centered on; defaults to the caller. */
925
+ participant?: string;
926
+ /** Keep only records on this subject. */
927
+ subject?: string;
928
+ /** Keep only records authored by participants holding this role. */
929
+ role?: "sender" | "recipient" | "participant";
930
+ /** A participant id, or "caller": keep only subjects that participant depends on. */
931
+ dependencyOf?: string;
932
+ /** Keep only records with a sequence number greater than this. */
933
+ since?: number;
934
+ /** Most records kept per section (default 500 server-side). */
935
+ maxRecords?: number;
936
+ /** Byte budget for the serialized brief (default 1000000 server-side). */
937
+ maxBytes?: number;
938
+ }
939
+ export interface BoothBriefView {
940
+ booth: {
941
+ id: string;
942
+ status: string;
943
+ expires_at: string;
944
+ };
945
+ snapshot_seq: number;
946
+ generated_at: string;
947
+ filters_applied: {
948
+ participant: string;
949
+ subject: string | null;
950
+ role: string | null;
951
+ dependency_of: string | null;
952
+ since: number;
953
+ max_records: number;
954
+ max_bytes: number;
955
+ };
956
+ participant: {
957
+ participant_id: string;
958
+ label: string;
959
+ your_ack_seq: number;
960
+ };
961
+ sections: {
962
+ participants: Array<Record<string, unknown>>;
963
+ intents: BoothEventView[];
964
+ contracts: Array<Record<string, unknown>>;
965
+ assumptions: BoothEventView[];
966
+ decisions_accepted: BoothEventView[];
967
+ decisions_proposed: BoothEventView[];
968
+ pacts: Array<Record<string, unknown>>;
969
+ conflicts_open: Array<Record<string, unknown>>;
970
+ conflicts_resolved: Array<Record<string, unknown>>;
971
+ capability_offers: BoothEventView[];
972
+ checks: Array<Record<string, unknown>>;
973
+ evidence: BoothEventView[];
974
+ };
975
+ omitted: Record<string, Array<{
976
+ count: number;
977
+ reason: string;
978
+ }>>;
979
+ }
980
+ /**
981
+ * One hypothetical event input for a What-If evaluation (Living
982
+ * Network Phase 11): the append path's event shape, plus an
983
+ * optional id label so a later input in the same evaluation can
984
+ * reference this one (a decision_accept naming an earlier
985
+ * hypothetical decision, for example).
986
+ */
987
+ export interface BoothWhatIfEventInput {
988
+ id?: string;
989
+ type: string;
990
+ subject: string;
991
+ payload: Record<string, unknown>;
992
+ in_reply_to?: string;
993
+ related_ids?: string[];
994
+ }
995
+ /**
996
+ * The What-If delta (Living Network Phase 11): what would change
997
+ * if the hypothetical events landed, computed from base_seq.
998
+ * Every delta entry is labeled hypothetical and carries base_seq.
999
+ * Nothing in the booth changed.
1000
+ */
1001
+ export interface BoothWhatIfView {
1002
+ booth: {
1003
+ id: string;
1004
+ status: string;
1005
+ };
1006
+ hypothetical: boolean;
1007
+ base_seq: number;
1008
+ evaluated_seq: number;
1009
+ hypothetical_events: Array<{
1010
+ event_id: string;
1011
+ seq: number;
1012
+ type: string;
1013
+ subject: string;
1014
+ }>;
1015
+ delta: {
1016
+ new_conflicts: Array<Record<string, unknown>>;
1017
+ competing_contracts: Array<Record<string, unknown>>;
1018
+ stale_assumptions: Array<Record<string, unknown>>;
1019
+ affected_participants: Array<Record<string, unknown>>;
1020
+ pact_status_changes: Array<Record<string, unknown>>;
1021
+ check_status_changes: Array<Record<string, unknown>>;
1022
+ };
1023
+ /** The coverage boundary: declared dependencies and subject links only. */
1024
+ boundary: string;
1025
+ note: string;
1026
+ participant_id: string;
1027
+ }
1028
+ export interface BoothReplayOptions {
1029
+ /** Compute the state over events with a sequence number at most this; defaults to the latest. */
1030
+ untilSeq?: number;
1031
+ /** Narrow the returned event slice to this subject. The state view is not narrowed. */
1032
+ subject?: string;
1033
+ /** Participant whose reached-changes derivation to include. */
1034
+ participant?: string;
1035
+ }
1036
+ export interface BoothReplayView {
1037
+ booth: {
1038
+ id: string;
1039
+ status: string;
1040
+ expires_at: string;
1041
+ };
1042
+ as_of_seq: number;
1043
+ latest_seq: number;
1044
+ filters_applied: {
1045
+ until_seq: number | null;
1046
+ subject: string | null;
1047
+ participant: string | null;
1048
+ };
1049
+ /** The replay never asserts causation; this field says so, in the response. */
1050
+ causation_note: string;
1051
+ /** Ack cursors in the response are current values, not as of as_of_seq; this field says so. */
1052
+ ack_note: string;
1053
+ state: Record<string, unknown>;
1054
+ events: BoothEventView[];
1055
+ reached: {
1056
+ participant_id: string;
1057
+ entries: BoothEventView[];
1058
+ ack: {
1059
+ last_ack_seq: number;
1060
+ as_of: boolean;
1061
+ note: string;
1062
+ };
1063
+ } | null;
1064
+ }
1065
+ export interface BoothAskOptions {
1066
+ /** Exact subject to look up. */
1067
+ subject?: string;
1068
+ /** Exact event type to restrict to. */
1069
+ type?: string;
1070
+ /** Substring matched over subjects and payload summary fields — not semantic search. */
1071
+ q?: string;
1072
+ }
1073
+ export interface BoothAskRecord extends BoothEventView {
1074
+ citation: {
1075
+ event_id: string;
1076
+ seq: number;
1077
+ author_label: string;
1078
+ };
1079
+ }
1080
+ export interface BoothAskView {
1081
+ booth: {
1082
+ id: string;
1083
+ };
1084
+ query: {
1085
+ subject: string | null;
1086
+ type: string | null;
1087
+ q: string | null;
1088
+ };
1089
+ /** Per supplied parameter, how it matched: exact, or substring for q. */
1090
+ match: Record<string, string>;
1091
+ match_note: string;
1092
+ records: BoothAskRecord[];
1093
+ count: number;
1094
+ }
1095
+ /** Create a booth. Anonymous: no credential of any kind is sent. */
1096
+ export declare function createBooth(baseUrl: string, input?: {
1097
+ ttlSeconds?: number;
1098
+ closeCondition?: string;
1099
+ /**
1100
+ * Lock the booth at creation: { mode: "locked", method:
1101
+ * "generated_key" } returns the admission key once in
1102
+ * admission_secret; { mode: "locked", method: "password",
1103
+ * password } sets a human password the service never echoes.
1104
+ * { mode: "invitation_only" } creates a booth with no shared
1105
+ * admission secret, entered only by redeeming an invitation. On
1106
+ * either non-default mode, invitations issues the creator's first
1107
+ * invitations inside the create; their tokens return once in the
1108
+ * result's invitations. Omit for a link-only booth.
1109
+ */
1110
+ access?: {
1111
+ mode: string;
1112
+ method?: string;
1113
+ password?: string;
1114
+ defaultScopes?: string[];
1115
+ invitations?: BoothInvitationSpec[];
1116
+ };
1117
+ /**
1118
+ * Phase 8: create this booth as the child of a parent booth.
1119
+ * boothId is the parent's public id or its @namespace/slug alias;
1120
+ * credential proves standing in the parent (a parent participant
1121
+ * credential or the parent's creator credential). Omit credential
1122
+ * only when the call itself carries the parent owner's account
1123
+ * session. A refused parent creates nothing.
1124
+ */
1125
+ parent?: {
1126
+ boothId: string;
1127
+ credential?: string;
1128
+ };
1129
+ }, fetchFn?: FetchFn): Promise<BoothCreateResult>;
1130
+ export interface BoothClientOptions {
1131
+ baseUrl: string;
1132
+ boothId: string;
1133
+ /** A booth credential from a join. Optional until a join happens. */
1134
+ credential?: string;
1135
+ fetchFn?: FetchFn;
1136
+ }
1137
+ export declare class BoothClient {
1138
+ private readonly baseUrl;
1139
+ private readonly boothId;
1140
+ private credential;
1141
+ private readonly fetchFn;
1142
+ constructor(options: BoothClientOptions);
1143
+ /** The credential this client sends, once a join has provided one. */
1144
+ get currentCredential(): string | undefined;
1145
+ private request;
1146
+ /** The booth's discovery document (no credential required). */
1147
+ discovery<T = unknown>(): Promise<T>;
1148
+ /**
1149
+ * Phase 8: publish this child booth's results to its parent. This
1150
+ * client's credential is the caller's credential in this booth
1151
+ * (the child) and must hold events.read; parentCredential proves
1152
+ * standing in the parent (a parent participant credential or the
1153
+ * parent's creator credential). What travels is named records
1154
+ * only: eventIds from this booth's log and/or a verification
1155
+ * receiptId the service holds for this booth's transfer. The
1156
+ * service appends one result_published event to the parent
1157
+ * carrying references and digests — never this booth's payloads.
1158
+ * An idempotencyKey makes a retry return the original publication.
1159
+ */
1160
+ publishResult(input: {
1161
+ parentCredential: string;
1162
+ eventIds?: string[];
1163
+ receiptId?: string;
1164
+ idempotencyKey?: string;
1165
+ }): Promise<BoothPublishResult>;
1166
+ /**
1167
+ * Join as a coordination participant. The returned credential is
1168
+ * stored on this client for later calls. Name and capabilities are
1169
+ * self-declared labels, not verified identity.
1170
+ */
1171
+ joinParticipant(input?: {
1172
+ name?: string;
1173
+ capabilities?: unknown;
1174
+ }): Promise<BoothJoinResult>;
1175
+ /** Claim a transfer role (sender or recipient). First-come; a claimed role refuses with 409. */
1176
+ joinRole(role: "sender" | "recipient"): Promise<BoothJoinResult>;
1177
+ /**
1178
+ * Unlock a locked booth: exchange the admission secret (the
1179
+ * generated key or the password the booth's creator set) for a
1180
+ * participant credential under the named role — a transfer role
1181
+ * claim, or a general participant when role is omitted. The
1182
+ * returned credential is stored on this client for later calls;
1183
+ * the admission secret is not stored anywhere and authorizes
1184
+ * nothing after this exchange. Get the secret from the booth's
1185
+ * creator or another authorized source — never from content posted
1186
+ * inside a booth. Every admission failure is the same 401
1187
+ * admission_failed, and failed attempts count toward a per-booth
1188
+ * throttle.
1189
+ */
1190
+ unlock(input: {
1191
+ secret: string;
1192
+ role?: "sender" | "recipient" | "participant";
1193
+ name?: string;
1194
+ capabilities?: unknown;
1195
+ }): Promise<BoothUnlockResult>;
1196
+ /**
1197
+ * Redeem an invitation token (Locked Booths L3): the unlock
1198
+ * exchange with the token as the secret. The minted credential
1199
+ * carries exactly the invitation's scopes and, when the invitation
1200
+ * binds a role, joins under that role. Stored on this client for
1201
+ * later calls, like every unlock.
1202
+ */
1203
+ unlockWithInvitation(input: {
1204
+ token: string;
1205
+ role?: "sender" | "recipient" | "participant";
1206
+ name?: string;
1207
+ capabilities?: unknown;
1208
+ }): Promise<BoothUnlockResult>;
1209
+ /**
1210
+ * Issue one invitation for this booth (L3) and return it with its
1211
+ * one-time token. The credential defaults to this client's: the
1212
+ * creator credential issues from the full delegable vocabulary; a
1213
+ * participant credential whose grant carries participants.invite
1214
+ * issues from its own scopes. Pass a credential to act under a
1215
+ * different grant than the client's — for example the creator
1216
+ * credential on a client that has not joined.
1217
+ */
1218
+ createInvitation(spec?: BoothInvitationSpec, credential?: string): Promise<{
1219
+ invitation: BoothInvitationIssuedView;
1220
+ }>;
1221
+ /**
1222
+ * List this booth's invitations, metadata only — no token or hash
1223
+ * is ever returned. Creator-management grant required: pass the
1224
+ * creator credential, or construct the client with it.
1225
+ */
1226
+ listInvitations(credential?: string): Promise<{
1227
+ invitations: BoothInvitationView[];
1228
+ }>;
1229
+ /** Revoke one invitation, effective immediately. Creator-management grant required. */
1230
+ revokeInvitation(invitationId: string, credential?: string): Promise<{
1231
+ invitation: BoothInvitationView;
1232
+ }>;
1233
+ /**
1234
+ * Rotate this booth's admission secret (Locked Booths L4). The old
1235
+ * secret stops admitting new joins the moment this returns; the
1236
+ * new generated key is shown once, in the result. Participants who
1237
+ * already joined keep their credentials and access — rotation is
1238
+ * about admission, not eviction. Omitting method keeps the booth's
1239
+ * current method; a password rotation (or a switch to password)
1240
+ * requires the new password, which the service never echoes.
1241
+ * Creator-management grant required: pass the creator credential,
1242
+ * or construct the client with it.
1243
+ */
1244
+ rotateAdmissionSecret(input?: {
1245
+ method?: "generated_key" | "password";
1246
+ password?: string;
1247
+ }, credential?: string): Promise<BoothRotateSecretResult>;
1248
+ /**
1249
+ * Protect this booth (Locked Booths L5): lock a booth that was
1250
+ * created link-only, applying the create-time admission machinery
1251
+ * to it atomically — the verifier and the locked policy land
1252
+ * together or not at all. Omitting method mints a generated key,
1253
+ * shown once in the result; a password lock requires the password,
1254
+ * which the service never echoes. Participants who joined while
1255
+ * the booth was link-only keep their credentials and access —
1256
+ * locking closes admission behind them, it does not remove them.
1257
+ * A booth that is already locked (or invitation-only) refuses.
1258
+ * Creator-management grant required: pass the creator credential,
1259
+ * or construct the client with it.
1260
+ */
1261
+ protectBooth(input?: {
1262
+ method?: "generated_key" | "password";
1263
+ password?: string;
1264
+ }, credential?: string): Promise<BoothProtectResult>;
1265
+ /**
1266
+ * List this booth's participant grants, metadata only — no
1267
+ * credential or hash is ever returned. Creator-management grant
1268
+ * required: pass the creator credential, or construct the client
1269
+ * with it.
1270
+ */
1271
+ listParticipants(credential?: string): Promise<{
1272
+ participants: BoothParticipantView[];
1273
+ }>;
1274
+ /**
1275
+ * Revoke one participant grant (L4), effective on the revoked
1276
+ * credential's very next call. The participant's browser sessions
1277
+ * and subscription row are revoked in the same step; revoking a
1278
+ * transfer-role grant also releases the role claim.
1279
+ * Creator-management grant required — participants.revoke is
1280
+ * non-delegable, so no participant credential authorizes this.
1281
+ */
1282
+ revokeParticipant(participantId: string, credential?: string): Promise<{
1283
+ participant: BoothParticipantView;
1284
+ }>;
1285
+ /**
1286
+ * Revoke every live grant one invitation issued (L4) — the
1287
+ * distinct companion to revokeInvitation, which stops new
1288
+ * redemptions and leaves issued grants standing. Each grant dies
1289
+ * exactly as if revoked directly. Creator-management grant
1290
+ * required.
1291
+ */
1292
+ revokeInvitationGrants(invitationId: string, credential?: string): Promise<{
1293
+ invitation: BoothInvitationView;
1294
+ revoked_count: number;
1295
+ participants: BoothParticipantView[];
1296
+ }>;
1297
+ /**
1298
+ * File an access request against this booth (L4): a bounded note
1299
+ * for the booth's creator from a caller who cannot unlock it. No
1300
+ * credential is sent — the filer is precisely a caller without
1301
+ * one — and the request grants nothing and admits no one. The
1302
+ * creator acts on it, if at all, by issuing an invitation.
1303
+ */
1304
+ requestAccess(input?: {
1305
+ label?: string;
1306
+ message?: string;
1307
+ role?: "sender" | "recipient" | "participant";
1308
+ }): Promise<{
1309
+ access_request: BoothAccessRequestView;
1310
+ note: string;
1311
+ }>;
1312
+ /**
1313
+ * List this booth's access requests in filing order.
1314
+ * Creator-management grant required: pass the creator credential,
1315
+ * or construct the client with it.
1316
+ */
1317
+ listAccessRequests(credential?: string): Promise<{
1318
+ access_requests: BoothAccessRequestView[];
1319
+ }>;
1320
+ listEvents(options?: {
1321
+ since?: number;
1322
+ type?: string;
1323
+ subject?: string;
1324
+ }): Promise<{
1325
+ events: BoothEventView[];
1326
+ latest_seq: number;
1327
+ }>;
1328
+ appendEvent(input: {
1329
+ type: string;
1330
+ subject: string;
1331
+ payload: Record<string, unknown>;
1332
+ idempotencyKey?: string;
1333
+ inReplyTo?: string;
1334
+ relatedIds?: string[];
1335
+ }): Promise<{
1336
+ event: BoothEventView;
1337
+ replayed: boolean;
1338
+ }>;
1339
+ getState<T = unknown>(): Promise<T>;
1340
+ /**
1341
+ * Propose a pact (Living Network Phase 3): a commitment record in
1342
+ * the booth log. The named parties endorse it with acceptPact —
1343
+ * never the proposer; endorsement here means a second credential
1344
+ * stood behind the pact, and "authorized" is reserved for account
1345
+ * holders. Fulfillment is computed from the log: every named
1346
+ * party endorsed and every checkable condition met.
1347
+ */
1348
+ proposePact(input: BoothPactProposal): Promise<{
1349
+ event: BoothEventView;
1350
+ replayed: boolean;
1351
+ }>;
1352
+ /**
1353
+ * Endorse a pact. Refused from the pact's proposer (403
1354
+ * pact_self_accept), mirroring decision acceptance: an
1355
+ * endorsement is a second participant standing behind the pact.
1356
+ */
1357
+ acceptPact(pactEventId: string): Promise<{
1358
+ event: BoothEventView;
1359
+ replayed: boolean;
1360
+ }>;
1361
+ /**
1362
+ * Cancel a pact. Only the pact's proposer or one of its endorsers
1363
+ * may cancel (403 pact_cancel_forbidden otherwise); a cancelled
1364
+ * pact is terminal.
1365
+ */
1366
+ cancelPact(pactEventId: string): Promise<{
1367
+ event: BoothEventView;
1368
+ replayed: boolean;
1369
+ }>;
1370
+ /** The booth's pacts with their computed statuses, from the state document. */
1371
+ listPacts(): Promise<BoothPactView[]>;
1372
+ /**
1373
+ * Declare a check (Living Network Phase 5): a set of typed
1374
+ * assertions the service evaluates against the booth's log. The
1375
+ * declaration is an ordinary log event; the result is computed
1376
+ * on read by getCheck / listChecks and is never stored, so the
1377
+ * same declaration re-evaluates as evidence lands. The service
1378
+ * never runs package code — assertions are data, evaluated by
1379
+ * the service's deterministic evaluator.
1380
+ */
1381
+ declareCheck(input: BoothCheckSpec): Promise<{
1382
+ event: BoothEventView;
1383
+ replayed: boolean;
1384
+ }>;
1385
+ /** The booth's checks with their computed results. */
1386
+ listChecks(): Promise<BoothCheckView[]>;
1387
+ /** One check's computed result, by the check event's id. */
1388
+ getCheck(checkEventId: string): Promise<BoothCheckView>;
1389
+ /**
1390
+ * Set or clear the booth's close condition (Phase 3). Pass
1391
+ * "pact_terminal:<pact event id>" to close the booth when the
1392
+ * named pact reaches a terminal state, "transfer_accepted" or
1393
+ * "all_acks" for the standing conditions, or null to clear.
1394
+ * Creator-management grant required: pass the creator credential,
1395
+ * or construct the client with it.
1396
+ */
1397
+ setCloseCondition(closeCondition: string | null, credential?: string): Promise<BoothCloseConditionResult>;
1398
+ /**
1399
+ * The changes feed: events relevant to this participant after the
1400
+ * cursor, with reasons. waitSeconds holds the request open for a
1401
+ * relevant event (25 seconds at most) and returns early when one
1402
+ * lands. Delivery is at-least-once; resume with next_since.
1403
+ */
1404
+ getChanges(options?: BoothChangesOptions): Promise<BoothChangesView>;
1405
+ /** Record that this participant has seen events up to seq. An ack never resolves a conflict. */
1406
+ ack(seq: number): Promise<{
1407
+ acked_seq: number;
1408
+ latest_seq: number;
1409
+ closed?: boolean;
1410
+ }>;
1411
+ /** Replace this participant's subject subscriptions in full. */
1412
+ setSubscriptions(subjects: string[]): Promise<{
1413
+ subjects: string[];
1414
+ subscription: BoothSubscriptionView;
1415
+ }>;
1416
+ /** Read this participant's durable subscription (subjects, delivery mode, cursors). */
1417
+ getSubscription(): Promise<{
1418
+ subscription: BoothSubscriptionView;
1419
+ }>;
1420
+ /** The participant's pending signals: what in this booth needs their attention, and why. */
1421
+ listSignals(): Promise<BoothSignalsView>;
1422
+ /** Acknowledge a signal. This records that it was seen; it never changes the underlying condition. */
1423
+ ackSignal(signalKey: string): Promise<{
1424
+ signal_key: string;
1425
+ state: string;
1426
+ signal: BoothSignalView;
1427
+ }>;
1428
+ /** Dismiss a signal: seen, and no action will be taken on it. */
1429
+ dismissSignal(signalKey: string): Promise<{
1430
+ signal_key: string;
1431
+ state: string;
1432
+ signal: BoothSignalView;
1433
+ }>;
1434
+ /**
1435
+ * Declare a watcher: one typed condition on this participant's
1436
+ * subscription (Phase 6). When the condition holds against the
1437
+ * booth's log it derives as a signal with reason watcher_triggered.
1438
+ * Declaring the same condition again returns the existing watcher
1439
+ * with created false.
1440
+ */
1441
+ createWatcher(condition: BoothWatcherSpec): Promise<{
1442
+ watcher: BoothWatcherView;
1443
+ created: boolean;
1444
+ subscription: BoothSubscriptionView;
1445
+ }>;
1446
+ /** This participant's declared watchers in this booth. */
1447
+ listWatchers(): Promise<BoothWatchersView>;
1448
+ /** Revoke one of this participant's watchers, by its id. */
1449
+ revokeWatcher(watcherId: string): Promise<{
1450
+ revoked: string;
1451
+ watchers: BoothWatcherView[];
1452
+ subscription: BoothSubscriptionView;
1453
+ }>;
1454
+ /**
1455
+ * Phase 10: create a cross-booth subscription into this booth.
1456
+ * This client's credential is the caller's credential in this
1457
+ * booth (the destination) and must hold subscriptions.manage;
1458
+ * sourceCredential proves standing in the source (a source
1459
+ * participant holding events.read, or the source's creator
1460
+ * credential) and is checked at creation, never stored. The
1461
+ * source must be account-owned in v1, and its owner must have set
1462
+ * a publication policy for anything to cross. subjects and
1463
+ * eventTypes narrow what this subscription receives on top of the
1464
+ * policy. An identical active subscription is returned with
1465
+ * created false.
1466
+ */
1467
+ createCrossSubscription(input: {
1468
+ sourceBoothId: string;
1469
+ sourceCredential: string;
1470
+ subjects?: string[];
1471
+ eventTypes?: string[] | null;
1472
+ }): Promise<BoothCrossSubscriptionResult>;
1473
+ /** This participant's cross-booth subscriptions into this booth. */
1474
+ listCrossSubscriptions(): Promise<{
1475
+ subscriptions: BoothCrossSubscriptionView[];
1476
+ }>;
1477
+ /**
1478
+ * Revoke one of this participant's cross-booth subscriptions, by
1479
+ * its id. Revoking stops further forwards from that source into
1480
+ * this booth; events already forwarded stay in the log.
1481
+ */
1482
+ revokeCrossSubscription(subscriptionId: string): Promise<{
1483
+ revoked: string;
1484
+ subscription: BoothCrossSubscriptionView;
1485
+ }>;
1486
+ private briefSuffix;
1487
+ /**
1488
+ * The booth Brief (Living Network Phase 4): the state cut to the
1489
+ * given filters, as a deterministic projection of the log.
1490
+ * Accepted and proposed material sit in separate sections, every
1491
+ * entry carries its source event id, and omitted counts what the
1492
+ * filters and limits cut, with the reason. Nothing is stored and
1493
+ * nothing is reworded.
1494
+ */
1495
+ getBrief(options?: BoothBriefOptions): Promise<BoothBriefView>;
1496
+ /** The same Brief rendered as Markdown (the server's format=md form). */
1497
+ getBriefMarkdown(options?: BoothBriefOptions): Promise<string>;
1498
+ /**
1499
+ * The booth Replay (Living Network Phase 4): the state as of a
1500
+ * sequence number, plus the event slice. With a participant, also
1501
+ * the changes that reached them by then; their ack cursor is
1502
+ * labeled as a current value, not as-of, and the response carries
1503
+ * its causation note — sequence order is never causation.
1504
+ */
1505
+ getReplay(options?: BoothReplayOptions): Promise<BoothReplayView>;
1506
+ /**
1507
+ * Ask the Booth (Living Network Phase 4): an exact-subject lookup
1508
+ * over the log with citations on every record. q is a substring
1509
+ * match over subjects and summary fields — the response labels it
1510
+ * as substring matching, not semantic search. At least one of
1511
+ * subject, type, or q is required.
1512
+ */
1513
+ ask(options?: BoothAskOptions): Promise<BoothAskView>;
1514
+ /**
1515
+ * The booth What-If evaluation (Living Network Phase 11):
1516
+ * validate the hypothetical event inputs with the append path's
1517
+ * own validation, append them in memory to a copy of the log
1518
+ * (truncated at atSeq when given), and return the delta — new
1519
+ * conflicts, competing contracts, stale assumptions, affected
1520
+ * participants, pact and check status changes — every entry
1521
+ * labeled hypothetical with its base seq. Nothing is written:
1522
+ * the booth's log and state are unchanged, and making any of it
1523
+ * real means posting the events. The impact graph covers
1524
+ * declared dependencies and subject links only; the evaluation
1525
+ * cannot see anything the log does not declare.
1526
+ */
1527
+ evaluateWhatIf(input: {
1528
+ events: BoothWhatIfEventInput[];
1529
+ atSeq?: number;
1530
+ }): Promise<BoothWhatIfView>;
1531
+ }