@warmhub/sdk-ts 0.44.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,3316 @@
1
+ type ActionAttempt = {
2
+ attempt: number;
3
+ status: string;
4
+ startedAt: number;
5
+ finishedAt?: number;
6
+ httpStatus?: number;
7
+ errorCode?: string;
8
+ errorMessage?: string;
9
+ responseSnippet?: string;
10
+ };
11
+ type ActionLiveFeedResult = {
12
+ items: Array<{
13
+ subscriptionName: string;
14
+ runId?: string;
15
+ status: string;
16
+ matchedOperationIndexes: Array<number>;
17
+ matchedOperations: Array<{
18
+ index: number;
19
+ operation?: unknown;
20
+ }>;
21
+ createdAt: number;
22
+ updatedAt?: number;
23
+ runStatus?: string;
24
+ attemptCount?: number;
25
+ maxAttempts?: number;
26
+ lastErrorCode?: string;
27
+ lastErrorMessage?: string;
28
+ lastResponseSnippet?: string;
29
+ traceId?: string;
30
+ causationId?: string;
31
+ hopCount?: number;
32
+ originRunId?: string;
33
+ originRepoId?: string;
34
+ actionContainer?: string;
35
+ }>;
36
+ nextCursor?: string;
37
+ };
38
+ type ActionNotification = {
39
+ subscriptionName?: string;
40
+ attempt: number;
41
+ channel: string;
42
+ status: string;
43
+ eventType?: string;
44
+ errorCode?: string;
45
+ errorMessage?: string;
46
+ createdAt: number;
47
+ };
48
+ type ActionRun = {
49
+ runId: string;
50
+ subscriptionName?: string;
51
+ status: string;
52
+ matchedOperationIndexes: Array<number>;
53
+ attemptCount: number;
54
+ maxAttempts: number;
55
+ lastErrorCode?: string;
56
+ lastErrorMessage?: string;
57
+ traceId?: string;
58
+ causationId?: string;
59
+ hopCount?: number;
60
+ originRunId?: string;
61
+ originRepoId?: string;
62
+ createdAt: number;
63
+ updatedAt: number;
64
+ };
65
+ type AuthSyncResult = {
66
+ success: boolean;
67
+ };
68
+ type CollectionAbout$2 = {
69
+ pair: [string, string];
70
+ } | {
71
+ triple: [string, string, string];
72
+ } | {
73
+ set: Array<string>;
74
+ } | {
75
+ list: Array<string>;
76
+ };
77
+ type CollectionTag$1 = 'pair' | 'triple' | 'set' | 'list';
78
+ type CommitApplyResult = {
79
+ committer?: string;
80
+ createdByEmail?: string;
81
+ message?: string;
82
+ operationCount: number;
83
+ operations: Array<{
84
+ name: string;
85
+ operation: 'add' | 'revise' | 'retract' | 'noop';
86
+ version: number;
87
+ dataHash: string;
88
+ warnings?: {
89
+ undeclaredFields: Array<string>;
90
+ undeclaredFieldsTruncated?: true;
91
+ totalUndeclared?: number;
92
+ };
93
+ }>;
94
+ };
95
+ type ComponentDetail = {
96
+ componentId: string;
97
+ componentName: string;
98
+ version?: string;
99
+ state?: string;
100
+ source?: string;
101
+ sourceRef?: string;
102
+ resolvedSha?: string;
103
+ manifestHash?: string;
104
+ installedAt?: string;
105
+ checkedAt?: string;
106
+ active: boolean;
107
+ wref: string;
108
+ install: {
109
+ wref: string;
110
+ pinnedWref?: string;
111
+ name: string;
112
+ kind: 'shape' | 'thing' | 'assertion' | 'collection';
113
+ shape?: string;
114
+ shapeName?: string;
115
+ validatedShape?: string;
116
+ version: number;
117
+ data?: unknown;
118
+ active: boolean;
119
+ aboutWref?: string;
120
+ committerWref?: string;
121
+ createdByWref?: string;
122
+ };
123
+ ownedShapes: Array<{
124
+ name: string;
125
+ kind: 'shape';
126
+ active: boolean;
127
+ version: {
128
+ version: number;
129
+ operation: 'add' | 'revise' | 'retract';
130
+ data: unknown;
131
+ dataHash: string;
132
+ } | null;
133
+ componentId?: string;
134
+ }>;
135
+ ownedThings: Array<{
136
+ wref: string;
137
+ name: string;
138
+ kind: 'shape' | 'thing' | 'assertion' | 'collection';
139
+ shapeName?: string;
140
+ componentId?: string;
141
+ version: number;
142
+ createdAt: number;
143
+ data?: unknown;
144
+ active: boolean;
145
+ aboutWref?: string;
146
+ }>;
147
+ };
148
+ type ComponentListResult = {
149
+ items: Array<{
150
+ componentId: string;
151
+ componentName: string;
152
+ version?: string;
153
+ state?: string;
154
+ source?: string;
155
+ sourceRef?: string;
156
+ resolvedSha?: string;
157
+ manifestHash?: string;
158
+ installedAt?: string;
159
+ checkedAt?: string;
160
+ active: boolean;
161
+ wref: string;
162
+ }>;
163
+ nextCursor?: string;
164
+ };
165
+ type ComponentSummary = {
166
+ componentId: string;
167
+ componentName: string;
168
+ version?: string;
169
+ state?: string;
170
+ source?: string;
171
+ sourceRef?: string;
172
+ resolvedSha?: string;
173
+ manifestHash?: string;
174
+ installedAt?: string;
175
+ checkedAt?: string;
176
+ active: boolean;
177
+ wref: string;
178
+ };
179
+ type InstallBundledSystemComponentResult = {
180
+ componentId: string;
181
+ componentName: string;
182
+ version: string;
183
+ state: 'ready' | 'unchanged';
184
+ componentInstallShapeCreated: boolean;
185
+ componentInstallShapeReconciled: boolean;
186
+ componentConfigShapeCreated: boolean;
187
+ componentConfigShapeReconciled: boolean;
188
+ componentInstallRecordCreated: boolean;
189
+ componentInstallRecordReconciled: boolean;
190
+ identityShapeCreated: boolean;
191
+ identityShapeReconciled: boolean;
192
+ };
193
+ type CredentialDeleteResult$1 = {
194
+ ok: true;
195
+ name: string;
196
+ };
197
+ type CredentialKeyMutationResult$1 = {
198
+ ok: true;
199
+ keyName?: string;
200
+ keyNames: Array<string>;
201
+ };
202
+ type CredentialRevokeResult$1 = {
203
+ revoked: boolean;
204
+ };
205
+ type Capabilities = {
206
+ apiVersion: string;
207
+ minSupportedSdk: string;
208
+ features: Record<string, boolean>;
209
+ };
210
+ type StreamAppendInput$1 = {
211
+ orgName: string;
212
+ repoName: string;
213
+ streamId: string;
214
+ componentId?: string;
215
+ workspaceName?: never;
216
+ committer?: string;
217
+ allocatedTokens?: Array<{
218
+ tokenNumber: number;
219
+ }>;
220
+ operations: Array<{
221
+ operation: 'add';
222
+ kind: 'shape';
223
+ name: string;
224
+ data: unknown;
225
+ skipExisting?: boolean;
226
+ } | {
227
+ operation: 'add';
228
+ kind: 'thing';
229
+ name: string;
230
+ data: unknown;
231
+ skipExisting?: boolean;
232
+ } | {
233
+ operation: 'add';
234
+ kind: 'assertion';
235
+ name: string;
236
+ about: string | {
237
+ pair: [string, string];
238
+ } | {
239
+ triple: [string, string, string];
240
+ } | {
241
+ set: Array<string>;
242
+ } | {
243
+ list: Array<string>;
244
+ };
245
+ data: unknown;
246
+ skipExisting?: boolean;
247
+ } | {
248
+ operation: 'add';
249
+ kind: 'collection';
250
+ name?: string;
251
+ type: 'pair' | 'triple' | 'set' | 'list';
252
+ members: Array<string>;
253
+ skipExisting?: boolean;
254
+ } | {
255
+ operation: 'revise';
256
+ kind: 'shape';
257
+ name: string;
258
+ data: unknown;
259
+ active?: never;
260
+ } | {
261
+ operation: 'revise';
262
+ kind: 'thing';
263
+ name: string;
264
+ data: unknown;
265
+ active?: never;
266
+ } | {
267
+ operation: 'revise';
268
+ kind: 'assertion';
269
+ name: string;
270
+ data: unknown;
271
+ active?: never;
272
+ } | {
273
+ operation: 'retract';
274
+ name: string;
275
+ kind?: 'thing' | 'assertion' | 'shape' | 'collection';
276
+ reason?: string;
277
+ }>;
278
+ };
279
+ type StreamAppendResult$1 = {
280
+ allocatedTokens: Array<{
281
+ tokenNumber: number;
282
+ }>;
283
+ results: Array<{
284
+ name: string;
285
+ operation?: 'add' | 'revise' | 'retract' | 'noop';
286
+ version?: number;
287
+ dataHash?: string;
288
+ status?: 'success' | 'noop' | 'failed';
289
+ error?: {
290
+ code: string;
291
+ message: string;
292
+ };
293
+ warnings?: {
294
+ undeclaredFields: Array<string>;
295
+ undeclaredFieldsTruncated?: true;
296
+ totalUndeclared?: number;
297
+ };
298
+ }>;
299
+ appendTotalMs?: number;
300
+ appendResolveRepoMs?: number;
301
+ appendTokenResolveMs?: number;
302
+ appendApplyMs?: number;
303
+ applySubphases?: {
304
+ addThingMs?: number;
305
+ addAssertionMs?: number;
306
+ addAssertionResolveAboutMs?: number;
307
+ reviseThingMs?: number;
308
+ reviseAssertionMs?: number;
309
+ reviseCollectionMs?: number;
310
+ preparePinnedLoadShapeFieldsMs?: number;
311
+ preparePinnedPinWrefsMs?: number;
312
+ preparePinnedResolveTokensMs?: number;
313
+ preparePinnedValidateMs?: number;
314
+ operationLoopMs?: number;
315
+ persistMs?: number;
316
+ persistThingsMs?: number;
317
+ persistVersionsMs?: number;
318
+ persistAssertionsMs?: number;
319
+ persistUpdatesMs?: number;
320
+ persistOutboxMs?: number;
321
+ refInsertMs?: number;
322
+ refSourceCount?: number;
323
+ };
324
+ };
325
+ type Org = {
326
+ name: string;
327
+ displayName: string;
328
+ description?: string;
329
+ tier: 'free' | 'pro' | 'enterprise';
330
+ archivedAt?: number;
331
+ createdAt: number;
332
+ repoCount?: number;
333
+ errorCount?: number;
334
+ lastActivityAt?: number;
335
+ };
336
+ type OrgListResult = Array<{
337
+ name: string;
338
+ displayName: string;
339
+ description?: string;
340
+ tier: 'free' | 'pro' | 'enterprise';
341
+ archivedAt?: number;
342
+ createdAt: number;
343
+ repoCount?: number;
344
+ errorCount?: number;
345
+ lastActivityAt?: number;
346
+ }>;
347
+ type OrgMember = {
348
+ email: string;
349
+ firstName?: string;
350
+ lastName?: string;
351
+ role: 'owner' | 'admin' | 'editor' | 'viewer';
352
+ status: 'active' | 'pending';
353
+ invitedBy?: string;
354
+ createdAt: number;
355
+ };
356
+ type RefsResult$1 = {
357
+ items: Array<{
358
+ wref: string;
359
+ kind?: 'shape' | 'thing' | 'assertion' | 'collection';
360
+ shapeName?: string;
361
+ version?: number;
362
+ fieldPath?: string;
363
+ }>;
364
+ nextCursor?: string;
365
+ };
366
+ type ShapeGetResult = {
367
+ name: string;
368
+ kind: 'shape';
369
+ active: boolean;
370
+ version: {
371
+ version: number;
372
+ operation: 'add' | 'revise' | 'retract';
373
+ data: unknown;
374
+ dataHash: string;
375
+ } | null;
376
+ componentId?: string;
377
+ };
378
+ type ShapeListResult = {
379
+ items: Array<{
380
+ name: string;
381
+ kind: 'shape';
382
+ active: boolean;
383
+ version: {
384
+ version: number;
385
+ operation: 'add' | 'revise' | 'retract';
386
+ data: unknown;
387
+ dataHash: string;
388
+ } | null;
389
+ componentId?: string;
390
+ }>;
391
+ };
392
+ type ThingGetManyResult$1 = {
393
+ requested: number;
394
+ items: Array<{
395
+ wref: string;
396
+ pinnedWref?: string;
397
+ name: string;
398
+ kind: 'shape' | 'thing' | 'assertion' | 'collection';
399
+ shape?: string;
400
+ shapeName?: string;
401
+ validatedShape?: string;
402
+ version: number;
403
+ data?: unknown;
404
+ active: boolean;
405
+ aboutWref?: string;
406
+ committerWref?: string;
407
+ createdByWref?: string;
408
+ }>;
409
+ missing: Array<string>;
410
+ };
411
+ type RenameResult$1 = {
412
+ renamed: true;
413
+ };
414
+ type RepoConfigureStats = {
415
+ subscriptionCount: number;
416
+ };
417
+ type RepoDescribeResult$1 = {
418
+ repo: {
419
+ orgName: string;
420
+ name: string;
421
+ description?: string;
422
+ visibility: 'public' | 'private';
423
+ archivedAt?: number;
424
+ createdAt: number;
425
+ };
426
+ shapes: {
427
+ items: Array<unknown>;
428
+ };
429
+ subscriptions: Array<unknown>;
430
+ stats: {
431
+ total: number;
432
+ byKind: {
433
+ shape: number;
434
+ thing: number;
435
+ assertion: number;
436
+ };
437
+ byShape: Record<string, number>;
438
+ };
439
+ configureStats: {
440
+ subscriptionCount: number;
441
+ };
442
+ head: {
443
+ items: Array<unknown>;
444
+ };
445
+ additionalInformation: Array<{
446
+ name: string;
447
+ wref: string;
448
+ synthesized: boolean;
449
+ }>;
450
+ };
451
+ type RepoListResult = {
452
+ items: Array<{
453
+ orgName: string;
454
+ name: string;
455
+ description?: string;
456
+ visibility: 'public' | 'private';
457
+ archivedAt?: number;
458
+ createdAt: number;
459
+ }>;
460
+ nextCursor?: string;
461
+ };
462
+ type RepoShapeInstanceCounts = Record<string, {
463
+ things: number;
464
+ assertions: number;
465
+ }>;
466
+ type RepoStats = {
467
+ total: number;
468
+ byKind: {
469
+ shape: number;
470
+ thing: number;
471
+ assertion: number;
472
+ };
473
+ byShape: Record<string, number>;
474
+ };
475
+ type RepoStatsBatchResult$1 = {
476
+ items: Array<{
477
+ orgName: string;
478
+ repoName: string;
479
+ total: number;
480
+ byKind?: {
481
+ shape: number;
482
+ thing: number;
483
+ assertion: number;
484
+ };
485
+ }>;
486
+ };
487
+ type RepoVisibility = 'public' | 'private';
488
+ type SynthesizedRepoContent$1 = {
489
+ shape: 'Content';
490
+ name: 'LlmsTxt';
491
+ active: true;
492
+ synthesized: true;
493
+ data: {
494
+ content: string;
495
+ };
496
+ refs?: {
497
+ outbound: {
498
+ sameOrg: Array<{
499
+ wref: string;
500
+ title: string;
501
+ description?: string;
502
+ }>;
503
+ crossOrg: Array<{
504
+ wref: string;
505
+ title: string;
506
+ description?: string;
507
+ }>;
508
+ };
509
+ inbound: {
510
+ sameOrg: Array<{
511
+ wref: string;
512
+ title: string;
513
+ description?: string;
514
+ }>;
515
+ crossOrg: Array<{
516
+ wref: string;
517
+ title: string;
518
+ description?: string;
519
+ }>;
520
+ };
521
+ };
522
+ };
523
+ type ShapeChangeResult = {
524
+ name: string;
525
+ operation: 'add' | 'revise' | 'retract';
526
+ version: number;
527
+ dataHash: string;
528
+ };
529
+ type SubscriptionBindCredentialsResult$1 = {
530
+ bound: true;
531
+ subscriptionName: string;
532
+ credentialSetName: string;
533
+ };
534
+ type SubscriptionUnbindCredentialsResult$1 = {
535
+ unbound: true;
536
+ subscriptionName: string;
537
+ };
538
+ type TokenCreateInput = {
539
+ name: string;
540
+ scopes?: Array<{
541
+ resource?: string;
542
+ permissions: Array<string>;
543
+ allowedMatches?: Array<string>;
544
+ }>;
545
+ structured?: boolean;
546
+ description?: string;
547
+ expiresAt?: number;
548
+ committerIdentityWref?: string;
549
+ };
550
+ type TokenCreateResult = {
551
+ token: string;
552
+ name: string;
553
+ scopes?: Array<{
554
+ resource?: string;
555
+ permissions: Array<string>;
556
+ allowedMatches?: Array<string>;
557
+ }>;
558
+ warnings?: Array<string>;
559
+ expiresAt: number;
560
+ createdAt: number;
561
+ };
562
+ type TokenRevokeResult = {
563
+ ok: boolean;
564
+ };
565
+ type WireScopeEntry$1 = {
566
+ resource?: string;
567
+ permissions: Array<string>;
568
+ allowedMatches?: Array<string>;
569
+ };
570
+
571
+ /**
572
+ * Add operation accepted by `client.commit.apply`. Use this shape to create new
573
+ * shapes, things, assertions, or collections in a single commit.
574
+ *
575
+ * @see https://docs.warmhub.ai/commits/operations/#add-operations
576
+ */
577
+ interface AddOperation {
578
+ /**
579
+ * Operation discriminator. Defaults to `add` when omitted.
580
+ */
581
+ operation?: 'add';
582
+ /**
583
+ * Optional kind override: `shape`, `thing`, `assertion`, or `collection`.
584
+ * When omitted, kind is inferred from `name` segmentation (1-seg → thing,
585
+ * 2-seg `Shape/name` → thing, 3+ segments → assertion).
586
+ */
587
+ kind?: 'shape' | 'thing' | 'assertion' | 'collection';
588
+ /**
589
+ * Target name. Use `Shape/localName` for things and assertions; use the
590
+ * plain shape name for shapes.
591
+ */
592
+ name?: string;
593
+ /**
594
+ * Assertion target wref or inline collection descriptor. Presence of
595
+ * `about` makes the add an assertion unless `kind` overrides it.
596
+ */
597
+ about?: string | CollectionAbout$2;
598
+ /**
599
+ * Shape-validated data payload for shape, thing, or assertion adds.
600
+ */
601
+ data?: unknown;
602
+ /**
603
+ * Collection type. Used only for collection adds.
604
+ */
605
+ type?: CollectionTag$1;
606
+ /**
607
+ * Collection member wrefs. Used only for collection adds.
608
+ */
609
+ members?: string[];
610
+ /**
611
+ * When true, an existing target returns `noop` instead of failing with
612
+ * `ALREADY_EXISTS`. Use for caller-side idempotency on retried writes.
613
+ */
614
+ skipExisting?: boolean;
615
+ }
616
+ /**
617
+ * Revise operation accepted by `client.commit.apply`. Replaces the shape-validated
618
+ * data on an existing shape, thing, or assertion and creates a new version.
619
+ *
620
+ * `data` is a full replacement, not a patch — include every shape field, not
621
+ * just the ones that changed. Revise cannot deactivate a target: the `active`
622
+ * field is declared `never` at the type level, so passing `active: false` is
623
+ * a compile error. Use a {@link RetractOperation} to mark an entity inactive.
624
+ *
625
+ * @see https://docs.warmhub.ai/commits/operations/#revise-operations
626
+ */
627
+ interface ReviseOperation {
628
+ /**
629
+ * Operation discriminator. Defaults to `revise` when omitted.
630
+ */
631
+ operation?: 'revise';
632
+ /**
633
+ * Optional kind safety hint: `shape`, `thing`, `assertion`, or `collection`.
634
+ */
635
+ kind?: 'shape' | 'thing' | 'assertion' | 'collection';
636
+ /**
637
+ * Target name to revise. Equivalent to `wref` for local paths.
638
+ */
639
+ name?: string;
640
+ /**
641
+ * Target wref to revise. Cross-repo references use `wh:org/repo/Shape/name`.
642
+ */
643
+ wref?: string;
644
+ /**
645
+ * New shape-validated data payload.
646
+ */
647
+ data?: unknown;
648
+ /**
649
+ * Type-level guard: revise cannot toggle activity. The field is declared
650
+ * `never` so passing `active: true` or `active: false` is a TypeScript error.
651
+ * To mark an entity inactive, use a {@link RetractOperation} instead.
652
+ */
653
+ active?: never;
654
+ }
655
+ /**
656
+ * Retract operation accepted by `client.commit.apply`. Marks the target as
657
+ * retracted in a new version; prior versions remain queryable by history.
658
+ *
659
+ * @see https://docs.warmhub.ai/commits/operations/#retract-operations
660
+ */
661
+ interface RetractOperation {
662
+ /**
663
+ * Operation discriminator. Required.
664
+ */
665
+ operation: 'retract';
666
+ /**
667
+ * Target wref or local name to retract.
668
+ */
669
+ name: string;
670
+ /**
671
+ * Optional kind safety hint: `thing`, `assertion`, `shape`, or `collection`.
672
+ */
673
+ kind?: 'thing' | 'assertion' | 'shape' | 'collection';
674
+ /**
675
+ * Optional human-readable retraction reason.
676
+ */
677
+ reason?: string;
678
+ }
679
+ /**
680
+ * Commit operation accepted by `client.commit.apply`. Discriminated union over
681
+ * {@link AddOperation}, {@link ReviseOperation}, and {@link RetractOperation},
682
+ * keyed on `operation`.
683
+ *
684
+ * Inline array literals passed directly to `client.commit.apply` are
685
+ * contextually typed by the parameter, so `operation: "add"` stays narrowed
686
+ * and the call typechecks. Binding the array to a variable **without** a
687
+ * type annotation widens `operation` to `string`, so the variable no
688
+ * longer assigns to the `Operation[]` parameter. Either annotate the
689
+ * variable as `Operation[]` (contextually typed by the annotation) or use
690
+ * `satisfies Operation[]` to preserve the inferred literal types:
691
+ *
692
+ * ```ts
693
+ * // 1. Annotate the variable.
694
+ * const ops: Operation[] = [
695
+ * { operation: "add", kind: "thing", name: "Sensor/temp-1", data: { x: 1 } },
696
+ * { operation: "revise", name: "Sensor/temp-1", data: { x: 2 } },
697
+ * ];
698
+ *
699
+ * // 2. Or use `satisfies` to keep the inferred literal types.
700
+ * const ops2 = [
701
+ * { operation: "add", kind: "thing", name: "Sensor/temp-1", data: { x: 1 } },
702
+ * { operation: "revise", name: "Sensor/temp-1", data: { x: 2 } },
703
+ * ] satisfies Operation[];
704
+ *
705
+ * await client.commit.apply("acme", "world", "seed", ops);
706
+ * ```
707
+ *
708
+ * @see https://docs.warmhub.ai/sdk/commit-vs-builder/#typing-operation-arrays
709
+ */
710
+ type Operation = AddOperation | ReviseOperation | RetractOperation;
711
+
712
+ /**
713
+ * Default number of operations the SDK sends per stream append chunk.
714
+ * @see https://docs.warmhub.ai/sdk-reference/variables/default_stream_chunk_size/
715
+ */
716
+ declare const DEFAULT_STREAM_CHUNK_SIZE = 1000;
717
+ /**
718
+ * Maximum number of operations accepted by one stream append chunk.
719
+ * @see https://docs.warmhub.ai/sdk-reference/variables/max_stream_append_operation_count/
720
+ */
721
+ declare const MAX_STREAM_APPEND_OPERATION_COUNT = 10000;
722
+ interface OperationStreamClient {
723
+ stream: {
724
+ append(input: StreamAppendInput$1): Promise<StreamAppendResult$1>;
725
+ };
726
+ }
727
+ type SubmittedStreamResult = {
728
+ committer?: string;
729
+ message: string | undefined;
730
+ operationCount: number;
731
+ operations: Array<{
732
+ name: string;
733
+ operation: 'add' | 'revise' | 'retract' | 'noop';
734
+ dataHash: string;
735
+ version: number;
736
+ status?: 'success' | 'noop' | 'failed';
737
+ error?: {
738
+ code: string;
739
+ message: string;
740
+ };
741
+ /**
742
+ * Non-blocking warnings collected during shape validation — see GH-1418.
743
+ * Aliased to the generated wire shape so this type cannot drift from
744
+ * the backend's `streamMutationResultEntrySchema.warnings`.
745
+ */
746
+ warnings?: NonNullable<StreamAppendResult$1['results'][number]['warnings']>;
747
+ }>;
748
+ };
749
+ /**
750
+ * Continuation state for caller-managed streamed commit submissions.
751
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamcontinuationstate/
752
+ */
753
+ type StreamContinuationState = {
754
+ streamId: string;
755
+ allocatedTokens: StreamAppendResult$1['allocatedTokens'];
756
+ };
757
+ /**
758
+ * Caller-facing knobs for the SDK's auto-idempotency retry on transient
759
+ * first-chunk failures.
760
+ *
761
+ * Defaults are tuned for interactive and agent latency budgets: 3 attempts
762
+ * with exponential backoff capped at 8s, so a one-off flake recovers without
763
+ * user-perceptible latency. Override individual fields as needed.
764
+ *
765
+ * @see https://docs.warmhub.ai/sdk/transient-retry/#tuning-retry
766
+ */
767
+ type RetryPolicyOptions = {
768
+ maxAttempts?: number;
769
+ baseDelayMs?: number;
770
+ maxDelayMs?: number;
771
+ };
772
+ /**
773
+ * Error raised when a streamed commit submission fails after an ambiguous or
774
+ * partial append.
775
+ *
776
+ * The `completedOperations` field contains operations the SDK knows completed.
777
+ * Before retrying manually, inspect repository state because the failed append
778
+ * may have committed additional operations that were not reflected locally.
779
+ *
780
+ * @see https://docs.warmhub.ai/sdk/transient-retry/#partial-submissions
781
+ */
782
+ declare class PartialStreamSubmissionError extends Error {
783
+ /**
784
+ * Stable error code. Always `'PARTIAL_STREAM_SUBMISSION'`.
785
+ */
786
+ readonly code = "PARTIAL_STREAM_SUBMISSION";
787
+ /**
788
+ * Operations the SDK confirmed completed before the ambiguous or failing
789
+ * append. The remaining operations may or may not have landed; inspect
790
+ * repository state before retrying manually.
791
+ * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#completedoperations
792
+ */
793
+ readonly completedOperations: SubmittedStreamResult['operations'];
794
+ /**
795
+ * Underlying error that triggered the partial submission, preserved for
796
+ * diagnostics. Inspect via `isWarmHubError(err.cause)` / `err.cause.kind`.
797
+ * @see https://docs.warmhub.ai/sdk-reference/classes/partialstreamsubmissionerror/#cause
798
+ */
799
+ readonly cause: unknown;
800
+ constructor(input: {
801
+ cause: unknown;
802
+ completedOperations: SubmittedStreamResult['operations'];
803
+ });
804
+ }
805
+ /**
806
+ * Submit `operations` to the WarmHub stream-append surface, chunked to
807
+ * stay under MAX_STREAM_APPEND_OPERATION_COUNT.
808
+ *
809
+ * **Retry policy (default-on, first-chunk + single-op only).** A
810
+ * transport-ambiguous failure (timeout / 5xx / network reset / no-code
811
+ * error) on the first chunk triggers a bounded retry — but only when
812
+ * the first chunk contains exactly one operation. The SDK mints a
813
+ * fresh `streamId`, resets `allocatedTokens`, sleeps with jittered
814
+ * exponential backoff, and re-issues the same operation. The retried
815
+ * call is observationally indistinguishable from a single clean
816
+ * apply — the SDK does not rewrite the request or the response.
817
+ *
818
+ * Multi-op chunks bypass retry entirely because the backend applies
819
+ * operations one-at-a-time in their own transactions, so a mid-chunk
820
+ * transport failure on attempt 1 may have committed an arbitrary
821
+ * prefix. Chunks that allocate or reference `$N`/`#N` tokens also
822
+ * bypass retry — the backend resolves those tokens against `streamId`,
823
+ * so re-issuing under a fresh `streamId` would commit a different
824
+ * identity than the first attempt may have landed. Multi-chunk
825
+ * mid-flight failures (`chunkResults.length > 0`) also bypass retry.
826
+ * All three surface `PartialStreamSubmissionError` exactly as before;
827
+ * the existing CLI continuation flags (`--stream-id`,
828
+ * `--allocated-tokens`, `--operation-offset`) remain the manual-resume
829
+ * contract.
830
+ *
831
+ * Definite client rejections (`UNAUTHENTICATED`, `VALIDATION_ERROR`,
832
+ * `CONFLICT`, `RATE_LIMITED`, `UNRESOLVED_TOKEN`, `ALREADY_RETRACTED`,
833
+ * …) on the first chunk still rethrow the raw cause unchanged — they
834
+ * are not transient, and structured detail (e.g. `retryAfter` on
835
+ * `RATE_LIMITED`) survives. If the caller's original attempt landed but
836
+ * the response was lost, the retry surfaces the resulting `CONFLICT`
837
+ * (for `add`) or `ALREADY_RETRACTED` (for `retract`) directly so the
838
+ * caller sees the truth.
839
+ *
840
+ * **Ambiguity preservation across attempts.** Once any attempt has
841
+ * been transport-ambiguous (timeout / 5xx / reset), a subsequent
842
+ * definite-reject (e.g. `RATE_LIMITED` on a quota check) does *not*
843
+ * prove the prior attempt didn't land. In that case the SDK wraps the
844
+ * cause as `PartialStreamSubmissionError` instead of rethrowing raw,
845
+ * so the "inspect repo state before continuing" warning survives.
846
+ *
847
+ * **Operation normalization.** `args.operations` accepts the public
848
+ * `Operation[]` write contract. The SDK normalizes operations to the
849
+ * backend stream shape before chunking, token checks, and appends.
850
+ *
851
+ * **Idempotency is the caller's responsibility.** To make `add` ops
852
+ * idempotent under retry (the GH #2243 agent-health-write use case),
853
+ * pass `skipExisting: true` per-op, via `args.skipExisting`, or via
854
+ * `commit.apply`'s `opts`:
855
+ *
856
+ * ```ts
857
+ * client.commit.apply(org, repo, msg, ops, { skipExisting: true })
858
+ * ```
859
+ *
860
+ * `args.skipExisting: true` applies `skipExisting: true` to every
861
+ * normalized `add` op. The server then returns `noop` for `add` ops
862
+ * whose target already exists. `revise` is naturally idempotent on
863
+ * equal `dataHash` + `aboutThingId`; built-in collection adds dedupe
864
+ * on `dataHash`.
865
+ *
866
+ * Pass `args.retry: false` to disable retry entirely; pass
867
+ * `args.retry: { maxAttempts, baseDelayMs, maxDelayMs }` to override
868
+ * any subset of the defaults (`{ 3, 250, 8_000 }`).
869
+ *
870
+ * Retry is automatically suppressed when the caller supplies
871
+ * `args.streamId` or a non-empty `args.allocatedTokens` (manual-resume
872
+ * mode). Re-minting a fresh `streamId` on retry would invalidate the
873
+ * `$N`/`#N` token bindings carried in the supplied `allocatedTokens`,
874
+ * so a resumed call instead surfaces `PartialStreamSubmissionError` on
875
+ * any append failure exactly as before.
876
+ *
877
+ * The server remains stateless across `stream.append` calls — there is
878
+ * no `streamId`-keyed dedup table. See docs/dev/commit-flow.md for the
879
+ * full idempotency contract.
880
+ *
881
+ * @see https://docs.warmhub.ai/sdk/transient-retry/
882
+ */
883
+ declare function submitOperationsViaStream(client: OperationStreamClient, args: {
884
+ orgName: string;
885
+ repoName: string;
886
+ committer?: string;
887
+ message?: string;
888
+ operations: Operation[];
889
+ componentId?: string;
890
+ chunkSize?: number;
891
+ skipExisting?: boolean;
892
+ streamId?: string;
893
+ allocatedTokens?: StreamAppendResult$1['allocatedTokens'];
894
+ /**
895
+ * Bounded auto-idempotency retry for transient first-chunk failures.
896
+ * Default-on (3 attempts, 250ms base, 8s cap, jittered exponential).
897
+ * Pass `false` to disable. Multi-chunk mid-flight failures still
898
+ * surface PartialStreamSubmissionError unchanged.
899
+ */
900
+ retry?: RetryPolicyOptions | false;
901
+ }): Promise<SubmittedStreamResult>;
902
+
903
+ type CollectionAbout$1 = {
904
+ pair: [string, string];
905
+ } | {
906
+ triple: [string, string, string];
907
+ } | {
908
+ set: string[];
909
+ } | {
910
+ list: string[];
911
+ };
912
+
913
+ /**
914
+ * Hardcoded meta-schema for validating shape definitions.
915
+ * Shapes are NOT validated against a DB-stored shape — they validate against this constant.
916
+ * This avoids the bootstrap chicken-and-egg problem.
917
+ *
918
+ * A valid shape definition is:
919
+ * { fields: Record<string, TypeSpec>, description?: string }
920
+ * where TypeSpec is one of:
921
+ * - primitive string: "number", "string", "boolean", "wref"
922
+ * - optional primitive: "number?", "string?", "boolean?", "wref?"
923
+ * - typed field object: { type: primitive, description?: string }
924
+ * - array: [TypeSpec]
925
+ * - nested object: { fieldName: TypeSpec, ... } (key may end with "?" for optional)
926
+ * @see https://docs.warmhub.ai/sdk-reference/variables/max_content_field_bytes/
927
+ */
928
+ declare const MAX_CONTENT_FIELD_BYTES: number;
929
+ /**
930
+ * @see https://docs.warmhub.ai/sdk-reference/variables/content_field_limit_error/
931
+ */
932
+ declare const CONTENT_FIELD_LIMIT_ERROR: string;
933
+ /**
934
+ * @see https://docs.warmhub.ai/sdk-reference/functions/contentfieldlimiterror/
935
+ */
936
+ declare function contentFieldLimitError(path: string, value: string): string | null;
937
+ /**
938
+ * Validate a data payload against shape field definitions.
939
+ *
940
+ * Shape field types:
941
+ * - "number", "string", "boolean": primitive types
942
+ * - "wref": string (reference to another thing)
943
+ * - Typed field objects: { type: primitive, description?: string }
944
+ * - Nested objects: { fieldName: type, ... }
945
+ * - Arrays: [elementType]
946
+ * - Optional fields: field name ending with "?" (e.g. "terminal_reason?": "string")
947
+ * OR type string ending with "?" (e.g. "terminal_reason": "string?")
948
+ * OR typed object type ending with "?" (e.g. { type: "string?" })
949
+ *
950
+ * For v1 this is permissive: validates top-level field existence and basic types.
951
+ * Returns a {@link ShapeValidatorResult} discriminated union — read `result.valid`
952
+ * to branch, then `result.errors` (only present when invalid) for the list of
953
+ * messages. `result.warnings` may be present in either branch and carries
954
+ * undeclared top-level field names.
955
+ *
956
+ * @example
957
+ * ```ts
958
+ * import { validateAgainstShape } from "@warmhub/sdk-ts";
959
+ *
960
+ * const shapeFields = { x: "number", y: "number", label: "string?" };
961
+ *
962
+ * const ok = validateAgainstShape({ x: 1, y: 2 }, shapeFields);
963
+ * // ok.valid === true
964
+ *
965
+ * const bad = validateAgainstShape({ x: "not-a-number" }, shapeFields);
966
+ * if (!bad.valid) {
967
+ * for (const message of bad.errors) console.error(message);
968
+ * // ['Field "x" must be a number', 'Missing required field: "y"']
969
+ * }
970
+ * ```
971
+ * @see https://docs.warmhub.ai/sdk-reference/functions/validateagainstshape/
972
+ */
973
+ declare function validateAgainstShape(data: Record<string, unknown>, shapeFields: Record<string, unknown>): ShapeValidatorResult;
974
+ /**
975
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/undeclaredfieldswarning/
976
+ */
977
+ type UndeclaredFieldsWarning = {
978
+ undeclaredFields: string[];
979
+ undeclaredFieldsTruncated?: true;
980
+ totalUndeclared?: number;
981
+ };
982
+ /**
983
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/shapevalidatorresult/
984
+ */
985
+ type ShapeValidatorResult = {
986
+ valid: true;
987
+ warnings?: UndeclaredFieldsWarning;
988
+ } | {
989
+ valid: false;
990
+ errors: string[];
991
+ warnings?: UndeclaredFieldsWarning;
992
+ };
993
+
994
+ /**
995
+ * Shape field definitions — the value side of a shape's data.fields
996
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/shapefields/
997
+ */
998
+ type ShapeFields = Record<string, unknown>;
999
+
1000
+ /**
1001
+ * Builder add operation for shapes, things, assertions, and collections.
1002
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/addop/
1003
+ */
1004
+ interface AddOp {
1005
+ /**
1006
+ * Operation discriminator. Always `add`.
1007
+ */
1008
+ readonly operation: 'add';
1009
+ /**
1010
+ * Target name. Use `Shape/localName` for things and assertions; use the plain shape name for shapes.
1011
+ */
1012
+ readonly name: string;
1013
+ /**
1014
+ * Optional kind override: `shape`, `thing`, `assertion`, or `collection`.
1015
+ */
1016
+ readonly kind?: string;
1017
+ /**
1018
+ * Assertion target wref or inline collection descriptor. Presence of `about` makes the add an assertion unless `kind` overrides it.
1019
+ */
1020
+ readonly about?: string | CollectionAbout$1;
1021
+ /**
1022
+ * Collection type. Used only for collection adds.
1023
+ */
1024
+ readonly type?: string;
1025
+ /**
1026
+ * Collection member wrefs. Used only for collection adds.
1027
+ */
1028
+ readonly members?: string[];
1029
+ /**
1030
+ * Optional shape wref used by local validation.
1031
+ */
1032
+ readonly shapeWref?: string;
1033
+ /**
1034
+ * Deprecated spelling for `about`; retained for compatibility.
1035
+ */
1036
+ readonly aboutWref?: string;
1037
+ /**
1038
+ * Shape-validated data payload for shape, thing, or assertion adds.
1039
+ */
1040
+ readonly data?: unknown;
1041
+ /**
1042
+ * When true, an existing target returns `noop` instead of failing.
1043
+ */
1044
+ readonly skipExisting?: boolean;
1045
+ }
1046
+ /**
1047
+ * Builder revise operation.
1048
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/reviseop/
1049
+ */
1050
+ interface ReviseOp {
1051
+ /**
1052
+ * Operation discriminator. Always `revise`.
1053
+ */
1054
+ readonly operation: 'revise';
1055
+ /**
1056
+ * Target wref to revise.
1057
+ */
1058
+ readonly wref?: string;
1059
+ /**
1060
+ * Target name to revise. Equivalent to `wref` for local paths.
1061
+ */
1062
+ readonly name?: string;
1063
+ /**
1064
+ * Optional kind safety hint: `shape`, `thing`, `assertion`, or `collection`.
1065
+ */
1066
+ readonly kind?: string;
1067
+ /**
1068
+ * New shape-validated data payload.
1069
+ */
1070
+ readonly data?: unknown;
1071
+ }
1072
+ /**
1073
+ * Builder retract operation.
1074
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/retractop/
1075
+ */
1076
+ interface RetractOp {
1077
+ /**
1078
+ * Operation discriminator. Always `retract`.
1079
+ */
1080
+ readonly operation: 'retract';
1081
+ /**
1082
+ * Target wref or local name to retract.
1083
+ */
1084
+ readonly name: string;
1085
+ /**
1086
+ * Optional kind safety hint: `thing`, `assertion`, `shape`, or `collection`.
1087
+ */
1088
+ readonly kind?: 'thing' | 'assertion' | 'shape' | 'collection';
1089
+ /**
1090
+ * Optional human-readable retraction reason.
1091
+ */
1092
+ readonly reason?: string;
1093
+ }
1094
+ /**
1095
+ * Operation queued by `OperationBuilder`.
1096
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationbuilderop/
1097
+ */
1098
+ type OperationBuilderOp = AddOp | ReviseOp | RetractOp;
1099
+ type OperationSubmitResult$1 = SubmittedStreamResult;
1100
+ /**
1101
+ * Client-side validation diagnostic returned by `OperationBuilder.validate`.
1102
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/validationdiagnostic/
1103
+ */
1104
+ interface ValidationDiagnostic {
1105
+ /**
1106
+ * Machine-readable diagnostic code.
1107
+ */
1108
+ code: string;
1109
+ /**
1110
+ * Zero-based operation index, or `-1` for whole-builder diagnostics.
1111
+ */
1112
+ operationIndex: number;
1113
+ /**
1114
+ * Human-readable diagnostic message.
1115
+ */
1116
+ message: string;
1117
+ }
1118
+ /**
1119
+ * Result returned by `OperationBuilder.validate`.
1120
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/validationresult/
1121
+ */
1122
+ interface ValidationResult {
1123
+ /**
1124
+ * Whether validation produced no errors.
1125
+ */
1126
+ valid: boolean;
1127
+ /**
1128
+ * Blocking diagnostics that prevent commit submission.
1129
+ */
1130
+ errors: ValidationDiagnostic[];
1131
+ /**
1132
+ * Non-blocking diagnostics for suspicious but possibly valid operations.
1133
+ */
1134
+ warnings: ValidationDiagnostic[];
1135
+ }
1136
+ /**
1137
+ * Options for constructing an `OperationBuilder`.
1138
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/operationbuilderoptions/
1139
+ */
1140
+ interface OperationBuilderOptions {
1141
+ /**
1142
+ * Known shape definitions used for local data validation.
1143
+ */
1144
+ shapes?: Record<string, ShapeFields>;
1145
+ }
1146
+ /** @internal */
1147
+ type OperationBuilderClient = OperationStreamClient;
1148
+ type AddInput = Omit<AddOp, 'operation'> | AddOp;
1149
+ type ReviseInput = Omit<ReviseOp, 'operation'> | ReviseOp;
1150
+ /**
1151
+ * Fluent builder for composing, validating, and submitting WarmHub commit
1152
+ * operations.
1153
+ *
1154
+ * Use this when a caller needs to build a batch incrementally, run local
1155
+ * preflight checks, optionally validate data against known shapes, and submit
1156
+ * through the SDK stream-append path with continuation and retry options.
1157
+ *
1158
+ * The builder is not a promise — there is no `build()` method, and `await cb`
1159
+ * alone will not submit anything. Finalize the batch by calling
1160
+ * `await cb.commit({ client, orgName, repoName, ... })`, which validates,
1161
+ * submits, and seals the builder in one step. Reusing a sealed builder throws.
1162
+ *
1163
+ * @example
1164
+ * ```ts
1165
+ * const cb = new OperationBuilder();
1166
+ * cb
1167
+ * .add({ name: "Sensor/temp-1", data: { location: "A" } })
1168
+ * .revise({ name: "Sensor/temp-1", data: { location: "B" } });
1169
+ * const result = await cb.commit({ client, orgName: "acme", repoName: "world" });
1170
+ * ```
1171
+ *
1172
+ * @see https://docs.warmhub.ai/sdk/commit-vs-builder/
1173
+ */
1174
+ declare class OperationBuilder {
1175
+ private readonly ops;
1176
+ private readonly pendingNames;
1177
+ private readonly shapes;
1178
+ private readonly wrefToShape;
1179
+ private submitted;
1180
+ private inFlight;
1181
+ /**
1182
+ * Create an empty operation builder.
1183
+ *
1184
+ * Pass known shape definitions when you want local data validation before submitting operations.
1185
+ */
1186
+ constructor(options?: OperationBuilderOptions);
1187
+ /**
1188
+ * Add a shape, thing, assertion, or collection operation.
1189
+ *
1190
+ * For things and assertions, names use `Shape/localName`. Supplying `about` makes the operation an assertion. Supplying collection `type` and `members` makes it a collection. Otherwise the builder infers kind from the name.
1191
+ *
1192
+ * Set `kind: 'thing'` explicitly for hierarchical thing names that would otherwise look like assertion paths.
1193
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#add
1194
+ */
1195
+ add(op: AddInput): this;
1196
+ /**
1197
+ * Add a revise operation.
1198
+ *
1199
+ * The target can be supplied as `name` or `wref`. When shape definitions were provided to the constructor, revise data is validated locally before the operation is queued.
1200
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#revise
1201
+ */
1202
+ revise(op: ReviseInput): this;
1203
+ /**
1204
+ * Add a retract operation.
1205
+ *
1206
+ * Pass a wref string shorthand or an object with a target name, optional kind safety hint, and optional reason.
1207
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#retract
1208
+ */
1209
+ retract(target: string | {
1210
+ name: string;
1211
+ kind?: 'thing' | 'assertion' | 'shape' | 'collection';
1212
+ reason?: string;
1213
+ }): this;
1214
+ /**
1215
+ * Return the queued operations.
1216
+ *
1217
+ * The returned array is read-only; use `add`, `revise`, and `retract` to modify the builder.
1218
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#operations
1219
+ */
1220
+ get operations(): ReadonlyArray<OperationBuilderOp>;
1221
+ /**
1222
+ * Return the number of queued operations.
1223
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#size
1224
+ */
1225
+ get size(): number;
1226
+ /**
1227
+ * Return whether this builder has queued an add operation for a name.
1228
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#has
1229
+ */
1230
+ has(name: string): boolean;
1231
+ /**
1232
+ * Run client-side validation without contacting the server.
1233
+ *
1234
+ * Validation checks for empty commits, duplicate adds, missing revise targets, revise-after-retract patterns, local shape-data errors when shapes were provided, and the same preflight diagnostics used before commit submission.
1235
+ *
1236
+ * Returns a {@link ValidationResult} object (`{ valid, errors, warnings }`) —
1237
+ * not a boolean. Read `result.valid` to gate submission, and iterate
1238
+ * `result.errors` for blocking diagnostics or `result.warnings` for
1239
+ * informational ones.
1240
+ *
1241
+ * @example
1242
+ * ```ts
1243
+ * const cb = new OperationBuilder();
1244
+ * cb.add({ name: "Location/cave", data: { x: 0, y: 0 } });
1245
+ * const result = cb.validate();
1246
+ * if (!result.valid) {
1247
+ * for (const err of result.errors) {
1248
+ * console.error(`op ${err.operationIndex}: ${err.code} — ${err.message}`);
1249
+ * }
1250
+ * throw new Error("validation failed");
1251
+ * }
1252
+ * for (const warn of result.warnings) console.warn(warn.message);
1253
+ * ```
1254
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#validate
1255
+ */
1256
+ validate(): ValidationResult;
1257
+ /**
1258
+ * Validate, submit, and seal the builder.
1259
+ *
1260
+ * A successful call submits operations through the same stream path as `client.commit.apply` and makes the builder single-use. Validation failures throw before any server request is made. Ambiguous multi-chunk failures surface as `PartialStreamSubmissionError`.
1261
+ *
1262
+ * @param params.client WarmHub client or compatible stream client used for submission.
1263
+ * @param params.message Optional commit message.
1264
+ * @param params.committer Optional wref identifying the actor on whose behalf the write is made.
1265
+ * @param params.chunkSize Maximum operations per stream append.
1266
+ * @param params.streamId Advanced continuation hook for caller-managed streams.
1267
+ * @param params.allocatedTokens Advanced continuation hook for `$N` / `#N` token allocation state.
1268
+ * @param params.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry.
1269
+ * @see https://docs.warmhub.ai/sdk-reference/classes/operationbuilder/#commit
1270
+ */
1271
+ commit(params: {
1272
+ client: OperationBuilderClient;
1273
+ orgName: string;
1274
+ repoName: string;
1275
+ committer?: string;
1276
+ message?: string;
1277
+ chunkSize?: number;
1278
+ streamId?: string;
1279
+ allocatedTokens?: StreamContinuationState['allocatedTokens'];
1280
+ retry?: RetryPolicyOptions | false;
1281
+ }): Promise<OperationSubmitResult$1>;
1282
+ private assertNotSubmitted;
1283
+ }
1284
+
1285
+ /** @internal */
1286
+ type CollectionAbout = CollectionAbout$2;
1287
+ /** @internal */
1288
+ type CollectionTag = CollectionTag$1;
1289
+ /** @internal */
1290
+ type WireScopeEntry = WireScopeEntry$1;
1291
+ /**
1292
+ * Low-level stream append input accepted by `client.stream.append`.
1293
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamappendinput/
1294
+ */
1295
+ type StreamAppendInput = StreamAppendInput$1;
1296
+ /**
1297
+ * Low-level stream append result returned by `client.stream.append`.
1298
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/streamappendresult/
1299
+ */
1300
+ type StreamAppendResult = StreamAppendResult$1;
1301
+ /**
1302
+ * Remove an `@vN`, `@HEAD`, or `@ALL` version suffix from a wref.
1303
+ *
1304
+ * @see https://docs.warmhub.ai/data-modeling/wrefs/#version-modifiers
1305
+ */
1306
+ declare function normalizeWref(wref: string): string;
1307
+ /**
1308
+ * Options for constructing a `WarmHubClient`.
1309
+ * @see https://docs.warmhub.ai/sdk-reference/interfaces/warmhubclientoptions/
1310
+ */
1311
+ interface WarmHubClientOptions {
1312
+ /**
1313
+ * Override the WarmHub API URL. Defaults to the public WarmHub API.
1314
+ */
1315
+ apiUrl?: string;
1316
+ /**
1317
+ * Custom `fetch` implementation for non-standard runtimes or tests.
1318
+ */
1319
+ fetch?: typeof globalThis.fetch;
1320
+ /**
1321
+ * Static token or sync/async token provider used for authenticated requests.
1322
+ */
1323
+ accessToken?: AccessTokenProvider;
1324
+ /**
1325
+ * Authentication provider object. Prefer `auth.getToken` when integrating with an existing session system.
1326
+ */
1327
+ auth?: {
1328
+ getToken: () => Promise<string | undefined>;
1329
+ };
1330
+ /**
1331
+ * Control replay of backend function log lines. Defaults to `off`.
1332
+ */
1333
+ functionLogs?: FunctionLogMode;
1334
+ }
1335
+ /**
1336
+ * Version string for the installed SDK package.
1337
+ * @see https://docs.warmhub.ai/sdk-reference/variables/sdk_version/
1338
+ */
1339
+ declare const SDK_VERSION: string;
1340
+ /**
1341
+ * Default WarmHub API URL used when a client is constructed without `apiUrl`.
1342
+ * @see https://docs.warmhub.ai/sdk-reference/variables/default_api_url/
1343
+ */
1344
+ declare const DEFAULT_API_URL = "https://api.warmhub.ai";
1345
+ /** @internal */
1346
+ type FunctionLogMode = 'raw' | 'off';
1347
+ /** @internal */
1348
+ interface RequestEvent {
1349
+ operation: 'query' | 'mutation' | 'action';
1350
+ functionPath: string;
1351
+ }
1352
+ /** @internal */
1353
+ type CoreErrorKind = 'BACKEND' | 'NOT_FOUND' | 'FORBIDDEN' | 'UNAUTHENTICATED' | 'VALIDATION_ERROR' | 'CONFLICT' | 'RATE_LIMITED' | 'CANCELLED' | 'NETWORK';
1354
+ /**
1355
+ * Stable SDK error kinds plus backend domain codes that pass through as strings.
1356
+ *
1357
+ * Branch on this (or {@link WarmHubError.kind}) to recover from expected
1358
+ * failures. {@link isRetryable} returns the retryability column verbatim.
1359
+ *
1360
+ * @remarks
1361
+ * Stable kinds (members of `CoreErrorKind`):
1362
+ *
1363
+ * - `BACKEND` — cause: server-side failure that did not carry a more specific domain code (tRPC error data has no `data.warmhub.code`, REST status mapped to the catch-all default — primarily 5xx that lack a body `error.code` — or an SDK transport throw such as a non-OK SSE response); retryable: true; action: retry with backoff and surface the message if it persists; if the underlying error is a deterministic local-adapter failure (e.g. a misconfigured custom `fetch`), fix the adapter rather than retrying; origin: SDK tRPC fallback, `httpStatusToWarmHubCode` default for unmapped HTTP statuses, SSE transport, unknown thrown values inside tRPC paths (custom-`fetch` adapter throws are normalized to `BACKEND` only on tRPC surfaces — on REST and `ping` surfaces the raw error escapes uncaught). REST responses with a parseable body surface as their pass-through `error.code` (typically `INTERNAL_ERROR`), and REST 4xx responses without a body code fall through to the HTTP-status mapping (`NOT_FOUND`, `UNAUTHENTICATED`, `FORBIDDEN`, `CONFLICT`, `VALIDATION_ERROR`, `RATE_LIMITED`), not `BACKEND`.
1364
+ * - `NOT_FOUND` — cause: a referenced entity (repo, org, thing, shape, subscription, credential set, etc.) is missing or the caller cannot see it; retryable: false; action: verify the identifier the call site used (wref, slug, name) and escalate to a caller with read access if the entity should exist; origin: SDK reads across all surfaces, commit pipeline, REST query endpoints
1365
+ * - `FORBIDDEN` — cause: caller is authenticated but lacks the required permission; retryable: false; action: request the missing permission or use a token with broader scope; origin: SDK + REST authorization middleware
1366
+ * - `UNAUTHENTICATED` — cause: missing, expired, or invalid bearer token on a tRPC or REST call; retryable: false; action: mint a fresh PAT and update whichever client option the application wires it into (`auth.getToken` callback or `accessToken` — the SDK does not read `WH_TOKEN` or any env var directly); `wh auth login` only refreshes the CLI's on-disk credentials and does not propagate to a constructed SDK client; for export tickets, remint via the appropriate backend endpoint; origin: SDK + REST auth middleware. Live-ticket SSE auth failures surface as `BACKEND`, not `UNAUTHENTICATED`, because `openSse` maps every non-OK SSE response to `BACKEND`.
1367
+ * - `VALIDATION_ERROR` — cause: input failed schema, shape, or content-length validation; retryable: false; action: fix the offending field per the error message; origin: commit pipeline, SDK writes, client-side content limits
1368
+ * - `CONFLICT` — cause: write collides with current state (concurrent edit, name already in use); retryable: false; action: refetch the current state and reconcile before retrying the write; origin: commit pipeline, repo/org creation. Archived org / repo writes surface as the pass-through code `ARCHIVED`, not `CONFLICT`.
1369
+ * - `RATE_LIMITED` — cause: caller exceeded the per-token or per-org request budget; retryable: true; action: wait {@link WarmHubError.retryAfter} seconds before retrying; origin: REST + tRPC throttling
1370
+ * - `CANCELLED` — cause: caller aborted the request via `AbortSignal`; retryable: true; action: retry only if the caller still wants the result; origin: SDK `AbortError` mapping
1371
+ * - `NETWORK` — cause: connection failed before the server produced a response (DNS, refused, timeout, fetch error); retryable: true; action: check connectivity to the configured `apiUrl` and retry with backoff; origin: SDK `fetchWithAuth` connection-error mapping
1372
+ *
1373
+ * Backend domain codes (e.g. `SHAPE_MISMATCH`, `WREF_UNRESOLVABLE`,
1374
+ * `UNRESOLVED_TOKEN`, `ARCHIVED`, `INTERNAL_ERROR`) pass through unchanged on
1375
+ * `code` / `kind`. Surface the `message` and `hint` verbatim and use the
1376
+ * message to decide whether to retry — most pass-through codes are terminal,
1377
+ * but the backend reuses some codes for transient failures (notably
1378
+ * `INTERNAL_ERROR`, which the webhook-validation path emits with a
1379
+ * `please retry` message when DNS or HEAD probes flake). See the
1380
+ * [HTTP error catalog](/http-api/overview/#response-format)
1381
+ * for HTTP-status mapping and the most common backend codes (the catalog is
1382
+ * not exhaustive — rarer codes such as `UNRESOLVED_TOKEN` and
1383
+ * `WREF_UNRESOLVABLE` are emitted by the backend but not yet tabulated).
1384
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/errorkind/
1385
+ */
1386
+ type ErrorKind = CoreErrorKind | (string & {});
1387
+ /**
1388
+ * Result returned by successful commit submissions.
1389
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/operationsubmitresult/
1390
+ */
1391
+ type OperationSubmitResult = SubmittedStreamResult;
1392
+ /** @internal */
1393
+ type ShapeChange = ShapeChangeResult;
1394
+ /** @internal */
1395
+ type Shape = ShapeGetResult;
1396
+ /** @internal */
1397
+ type ShapeList = ShapeListResult;
1398
+ /**
1399
+ * Result of `client.shape.remove` — confirms the retraction with the new version metadata.
1400
+ * @internal
1401
+ */
1402
+ type ShapeRemove = {
1403
+ name: string;
1404
+ operation: 'add' | 'revise' | 'retract';
1405
+ version: number;
1406
+ dataHash: string;
1407
+ removed: true;
1408
+ };
1409
+ /**
1410
+ * Shape of a subscription record returned from `client.subscription.list`,
1411
+ * `client.subscription.get`, `client.subscription.create`, and
1412
+ * `client.subscription.update`.
1413
+ *
1414
+ * `filterJson` is typed as `unknown`; treat it as an opaque value owned by
1415
+ * the server and pass it through unchanged on updates. `actionContainer`
1416
+ * and `actionContainerConfig` appear on the type as optional fields but are
1417
+ * always returned as `undefined` on reads.
1418
+ *
1419
+ * @internal
1420
+ */
1421
+ type SubscriptionInfo = {
1422
+ name: string;
1423
+ kind: 'webhook' | 'cron';
1424
+ active: boolean;
1425
+ shapeName?: string;
1426
+ sourceRepo?: string;
1427
+ filterJson?: unknown;
1428
+ webhookUrl?: string;
1429
+ fallbackWebhookUrl?: string;
1430
+ actionContainerConfig?: unknown;
1431
+ actionContainer?: string;
1432
+ cronConfig?: {
1433
+ cronspec: string;
1434
+ timezone?: string;
1435
+ };
1436
+ allowTraceReentry?: boolean;
1437
+ notifyOnSuccess?: boolean;
1438
+ componentId?: string;
1439
+ credentialSetNames: Array<string>;
1440
+ createdAt: number;
1441
+ };
1442
+ /**
1443
+ * Array result type for `client.subscription.list`.
1444
+ * @internal
1445
+ */
1446
+ type SubscriptionList = SubscriptionInfo[];
1447
+ /**
1448
+ * Input shape for `client.subscription.create`. Non-cron subscriptions
1449
+ * require either `shapeName` or `filterJson.shape` (or a shape-lifecycle
1450
+ * `filterJson` such as `{ kind: 'shape' }`).
1451
+ *
1452
+ * @see https://docs.warmhub.ai/subscriptions/creating/
1453
+ */
1454
+ type SubscriptionCompatCreateInput = {
1455
+ orgName: string;
1456
+ repoName: string;
1457
+ shapeName?: string;
1458
+ name: string;
1459
+ filterJson?: Record<string, unknown>;
1460
+ kind: 'webhook' | 'cron';
1461
+ webhookUrl?: string;
1462
+ fallbackWebhookUrl?: string;
1463
+ cronConfig?: {
1464
+ cronspec: string;
1465
+ timezone?: string;
1466
+ };
1467
+ allowTraceReentry?: boolean;
1468
+ notifyOnSuccess?: boolean;
1469
+ componentId?: string;
1470
+ sourceRepoRef?: string;
1471
+ workspacePolicy?: never;
1472
+ /** @internal */
1473
+ actionContainer?: string;
1474
+ /** @internal */
1475
+ actionContainerConfig?: unknown;
1476
+ };
1477
+ /**
1478
+ * Input shape for `client.subscription.update`. `orgName`, `repoName`, and
1479
+ * `name` identify the subscription; all other fields are optional and only
1480
+ * the ones you provide get patched.
1481
+ *
1482
+ * @see https://docs.warmhub.ai/subscriptions/managing/#update-subscription
1483
+ */
1484
+ type SubscriptionCompatUpdateInput = {
1485
+ orgName: string;
1486
+ repoName: string;
1487
+ name: string;
1488
+ shapeName?: string;
1489
+ filterJson?: Record<string, unknown>;
1490
+ webhookUrl?: string;
1491
+ fallbackWebhookUrl?: string | null;
1492
+ cronConfig?: {
1493
+ cronspec: string;
1494
+ timezone?: string;
1495
+ };
1496
+ allowTraceReentry?: boolean;
1497
+ notifyOnSuccess?: boolean;
1498
+ /** @internal Back-compat field; not consumed by the backend update mutation. */
1499
+ sourceRepoRef?: string;
1500
+ workspacePolicy?: never;
1501
+ /** @internal */
1502
+ actionContainer?: string;
1503
+ /** @internal */
1504
+ actionContainerConfig?: unknown;
1505
+ };
1506
+ /** @internal */
1507
+ type ActionRunInfo = ActionRun;
1508
+ /** @internal */
1509
+ type ActionAttemptInfo = ActionAttempt;
1510
+ /** @internal */
1511
+ type ActionNotificationInfo = ActionNotification;
1512
+ /** @internal */
1513
+ type ActionLiveFeed = ActionLiveFeedResult;
1514
+ /** @internal */
1515
+ type ActionLeaseAcquire = {
1516
+ ok: true;
1517
+ reused: boolean;
1518
+ } | {
1519
+ ok: false;
1520
+ reason: string;
1521
+ };
1522
+ /** @internal */
1523
+ type ActionLeaseOp = {
1524
+ ok: true;
1525
+ } | {
1526
+ ok: false;
1527
+ reason: string;
1528
+ };
1529
+ /**
1530
+ * Result returned by in-place rename mutations: `client.shape.rename` and
1531
+ * `client.thing.rename`. A rename patches the identity field directly and
1532
+ * preserves the existing version history; no new version is created. The
1533
+ * `renamed: true` discriminator distinguishes the success shape from a
1534
+ * rejected request (which throws `WarmHubError`).
1535
+ *
1536
+ * @see https://docs.warmhub.ai/data-modeling/naming-as-navigation/
1537
+ */
1538
+ type RenameResult = RenameResult$1;
1539
+ /** @internal */
1540
+ type ComponentInfo = ComponentSummary;
1541
+ /** @internal */
1542
+ type ComponentView = ComponentDetail;
1543
+ /** @internal */
1544
+ type ComponentList = ComponentListResult;
1545
+ /** @internal */
1546
+ type ComponentListOptions = {
1547
+ limit?: number;
1548
+ cursor?: string;
1549
+ };
1550
+ /** @internal */
1551
+ type ComponentInstallSystemResult = InstallBundledSystemComponentResult;
1552
+ type ComponentRegistryInfo = {
1553
+ id: string;
1554
+ ownerOrgName: string;
1555
+ componentName: string;
1556
+ ref: string;
1557
+ isPrivate: boolean;
1558
+ mintedTokens: boolean;
1559
+ sourceUrl?: string;
1560
+ sourceDefaultRef?: string;
1561
+ setupUrl?: string;
1562
+ uninstallUrl?: string;
1563
+ allowedCallbackDomains: string[];
1564
+ credentialSetId?: string;
1565
+ credentialSetName?: string;
1566
+ description?: string;
1567
+ createdAt: number;
1568
+ updatedAt: number;
1569
+ };
1570
+ type ComponentRegistryList = {
1571
+ items: ComponentRegistryInfo[];
1572
+ };
1573
+ type ComponentRegistryMutationInput = {
1574
+ isPrivate?: boolean;
1575
+ mintedTokens?: boolean;
1576
+ sourceUrl?: string;
1577
+ sourceDefaultRef?: string;
1578
+ setupUrl?: string;
1579
+ uninstallUrl?: string;
1580
+ allowedCallbackDomains?: string[];
1581
+ credentialSetName?: string;
1582
+ description?: string;
1583
+ };
1584
+ type ComponentRegistryResolveResult = {
1585
+ sourceUrl: string;
1586
+ sourceDefaultRef?: string;
1587
+ hasSetup: boolean;
1588
+ installId: string;
1589
+ };
1590
+ type ComponentRegistrySourceDownloadInput = {
1591
+ installRepo: string;
1592
+ ref?: string;
1593
+ };
1594
+ type ComponentRegistrySourceDownloadResult = {
1595
+ archive: Uint8Array;
1596
+ sourceUrl: string;
1597
+ sourceRef?: string;
1598
+ resolvedSha?: string;
1599
+ componentRef: string;
1600
+ contentType: string;
1601
+ };
1602
+ type ComponentRegistrySetupCallInput = {
1603
+ installId: string;
1604
+ installRepo: string;
1605
+ ref?: string;
1606
+ resolvedSha?: string;
1607
+ };
1608
+ type ComponentRegistrySetupCallResult = {
1609
+ ok: boolean;
1610
+ status: number;
1611
+ body?: string;
1612
+ warnings: string[];
1613
+ };
1614
+ type ComponentRegistryCliCallInput = {
1615
+ installRepo: string;
1616
+ args?: Record<string, unknown>;
1617
+ };
1618
+ /**
1619
+ * Backend wraps the component-service response in an envelope identical to
1620
+ * `ComponentRegistrySetupCallResult`. The type alias keeps the SDK drift gate
1621
+ * happy (no new *Result shape to audit) and signals that callers should expect
1622
+ * the same `{ ok, status, body?, warnings }` contract — upstream non-2xx
1623
+ * comes back as `{ ok: false, status, body }`, not a thrown `WarmHubError`.
1624
+ */
1625
+ type ComponentRegistryCliCallResult = ComponentRegistrySetupCallResult;
1626
+ /** @internal */
1627
+ type ShapeListOptions = {
1628
+ match?: string;
1629
+ componentId?: string;
1630
+ excludeComponents?: boolean;
1631
+ includeRetracted?: boolean;
1632
+ };
1633
+ /** @internal */
1634
+ type ShapeGetOptions = {
1635
+ includeRetracted?: boolean;
1636
+ };
1637
+ /** @internal */
1638
+ type ShapeCreateOptions = {
1639
+ description?: string;
1640
+ };
1641
+ /** @internal */
1642
+ type ShapeReviseOptions = {
1643
+ description?: string;
1644
+ };
1645
+ /** @internal */
1646
+ interface ShapeHistoryOptions {
1647
+ includeRetracted?: boolean;
1648
+ limit?: number;
1649
+ cursor?: string;
1650
+ }
1651
+ /** @internal */
1652
+ type ShapeHistory = HistoryResult;
1653
+ /** @internal */
1654
+ type OrgInfo = Org;
1655
+ /** @internal */
1656
+ type OrgList = OrgListResult;
1657
+ /** @internal */
1658
+ type OrgMemberInfo = OrgMember;
1659
+ /**
1660
+ * Caller's role within an organization. Returned by
1661
+ * `client.org.getCallerRole`, carried as `callerRole` on
1662
+ * `client.org.listMembers` results, and accepted by
1663
+ * `client.org.changeMemberRole` to set a member's role (only owners
1664
+ * may promote to or demote from `'owner'`; the last owner cannot be
1665
+ * demoted). Mirrors `orgRoleSchema` in `@warmhub/backend`; the
1666
+ * static check below blocks any drift between this literal and the
1667
+ * generated copy.
1668
+ *
1669
+ * @see https://docs.warmhub.ai/auth/personal-access-tokens/#available-permissions
1670
+ */
1671
+ type OrgRole = 'owner' | 'admin' | 'editor' | 'viewer';
1672
+ /** @internal */
1673
+ type OrgMemberList = {
1674
+ members: OrgMemberInfo[];
1675
+ callerRole: OrgRole;
1676
+ };
1677
+ /**
1678
+ * Repository metadata returned by `client.repo.get`, `create`,
1679
+ * `setDescription`, `setVisibility`, `rename`, `archive`, and `unarchive`.
1680
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/repoinfo/
1681
+ */
1682
+ type RepoInfo = {
1683
+ orgName: string;
1684
+ name: string;
1685
+ description?: string;
1686
+ visibility: 'public' | 'private';
1687
+ archivedAt?: number;
1688
+ createdAt: number;
1689
+ };
1690
+ /** @internal */
1691
+ type RepoList = RepoListResult;
1692
+ /** @internal */
1693
+ type OrgListOptions = {
1694
+ includeArchived?: boolean;
1695
+ };
1696
+ /** @internal */
1697
+ type OrgListMembersOptions = {
1698
+ pending?: boolean;
1699
+ };
1700
+ /** @internal */
1701
+ type RepoStatsView = RepoStats;
1702
+ /** @internal */
1703
+ type RepoConfigureStatsView = RepoConfigureStats;
1704
+ /** @internal */
1705
+ type RepoShapeInstanceCountsView = RepoShapeInstanceCounts;
1706
+ /** @internal */
1707
+ type RepoStatsBatchResult = RepoStatsBatchResult$1;
1708
+ /** @internal */
1709
+ type RepoWithStatsInfo = {
1710
+ orgName: string;
1711
+ name: string;
1712
+ description?: string;
1713
+ visibility: 'public' | 'private';
1714
+ archivedAt?: number;
1715
+ createdAt: number;
1716
+ total: number;
1717
+ byKind: {
1718
+ thing: number;
1719
+ assertion: number;
1720
+ shape: number;
1721
+ };
1722
+ lastWriteAt?: number;
1723
+ hasErrors: boolean;
1724
+ };
1725
+ /** @internal */
1726
+ type RepoListPageResult = Page<RepoWithStatsInfo>;
1727
+ /** @internal */
1728
+ type RepoSort = 'newest' | 'oldest' | 'nameAsc' | 'nameDesc';
1729
+ /** @internal */
1730
+ type RepoListPageOptions = {
1731
+ limit?: number;
1732
+ cursor?: string;
1733
+ includeArchived?: boolean;
1734
+ search?: string;
1735
+ sort?: RepoSort;
1736
+ };
1737
+ /** @internal */
1738
+ type CurrentUserInfo = {
1739
+ id: string;
1740
+ email: string;
1741
+ firstName?: string;
1742
+ lastName?: string;
1743
+ identityWref: string | null;
1744
+ } | null;
1745
+ /** @internal */
1746
+ type WhoamiScopeEntry = {
1747
+ resource?: string;
1748
+ redactedResource?: true;
1749
+ permissions: string[];
1750
+ allowedMatches?: string[];
1751
+ };
1752
+ /** @internal */
1753
+ type WhoamiInfo = {
1754
+ authenticated: false;
1755
+ error?: string;
1756
+ } | {
1757
+ authenticated: true;
1758
+ email: string;
1759
+ userId: string;
1760
+ authMethod: 'interactive' | 'pat';
1761
+ tokenName: string | null;
1762
+ tokenDescription: string | null;
1763
+ scopes: WhoamiScopeEntry[] | null;
1764
+ expiresAt: number | null;
1765
+ identityWref: string | null;
1766
+ };
1767
+ /** @internal */
1768
+ type RepoListOptions = {
1769
+ limit?: number;
1770
+ cursor?: string;
1771
+ includeArchived?: boolean;
1772
+ search?: string;
1773
+ sort?: RepoSort;
1774
+ };
1775
+ /** @internal */
1776
+ type PageRequest = {
1777
+ limit?: number;
1778
+ cursor?: string;
1779
+ };
1780
+ /**
1781
+ * Cursor page envelope used by paginated SDK methods.
1782
+ *
1783
+ * `Page` is generic over the item type — always supply the type argument when
1784
+ * annotating a variable that holds a page (`Page<ThingItem>`, `Page<RepoInfo>`,
1785
+ * etc.). Using the bare name `Page` fails with `TS2314: Generic type 'Page'
1786
+ * requires 1 type argument(s)`.
1787
+ *
1788
+ * @example
1789
+ * ```ts
1790
+ * import type { Page, ThingItem } from "@warmhub/sdk-ts";
1791
+ *
1792
+ * const page: Page<ThingItem> = await client.thing.head("acme", "world", { limit: 50 });
1793
+ * for (const item of page.items) console.log(item.wref);
1794
+ * if (page.nextCursor) {
1795
+ * // pass page.nextCursor back as `cursor` on the next call
1796
+ * }
1797
+ * ```
1798
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/page/
1799
+ */
1800
+ type Page<T> = {
1801
+ items: T[];
1802
+ nextCursor?: string;
1803
+ };
1804
+ /** @internal */
1805
+ type OrgRef = OrgInfo;
1806
+ /** @internal */
1807
+ type RepoRef = RepoInfo;
1808
+ /** @internal */
1809
+ type ShapeRef = ShapeChange;
1810
+ /** @internal */
1811
+ type RepoLocator = {
1812
+ orgName: string;
1813
+ repoName: string;
1814
+ };
1815
+ /** @internal */
1816
+ type ThingItem = {
1817
+ wref: string;
1818
+ name: string;
1819
+ kind: string;
1820
+ shapeName?: string;
1821
+ version: number;
1822
+ createdAt: number;
1823
+ active?: boolean;
1824
+ data?: unknown;
1825
+ aboutWref?: string;
1826
+ [key: string]: unknown;
1827
+ };
1828
+ /** @internal */
1829
+ type ThingHeadOptions = Omit<ThingHeadRequest, 'orgName' | 'repoName'>;
1830
+ /** @internal */
1831
+ type HeadResult = {
1832
+ items: ThingItem[];
1833
+ nextCursor?: string;
1834
+ };
1835
+ /** @internal */
1836
+ type ThingGet = ThingDetail;
1837
+ /**
1838
+ * Full record shape for a single Thing returned by single-record SDK
1839
+ * reads. Returned by `client.thing.get` and `client.thing.resolve`, the
1840
+ * `items[]` element type for `client.thing.getMany`, the base of
1841
+ * `client.thing.graph`, and the return of `client.repo.getReadme` and
1842
+ * `getAgents` (nullable). Identity fields (`wref`, `name`, `kind`,
1843
+ * `shape`/`shapeName`) are always populated. `data` carries the
1844
+ * shape-validated payload when present; `active` is `false` for retracted
1845
+ * reads. The `[key: string]: unknown` index signature is a forward-compat
1846
+ * affordance — current callers should rely on the named fields. Note: list
1847
+ * reads — `client.thing.head`, `query`, and `search` — return a thinner
1848
+ * row shape (no `shape`, `validatedShape`, or `committerWref`); use
1849
+ * `client.thing.get` to hydrate a full `ThingDetail` from a list result.
1850
+ *
1851
+ * @see https://docs.warmhub.ai/data-modeling/things/
1852
+ */
1853
+ type ThingDetail = {
1854
+ wref: string;
1855
+ pinnedWref?: string;
1856
+ name: string;
1857
+ kind: string;
1858
+ shape?: string;
1859
+ shapeName?: string;
1860
+ validatedShape?: string;
1861
+ version: number;
1862
+ active: boolean;
1863
+ data?: unknown;
1864
+ aboutWref?: string;
1865
+ committerWref?: string;
1866
+ createdByWref?: string;
1867
+ [key: string]: unknown;
1868
+ };
1869
+ /** @internal */
1870
+ type RefLink = RefsResult$1['items'][number];
1871
+ /** @internal */
1872
+ type SynthesizedRepoContent = SynthesizedRepoContent$1;
1873
+ /** @internal */
1874
+ type RepoDescribeResult = RepoDescribeResult$1;
1875
+ /** @internal */
1876
+ type ThingGraphValue = ThingGraphResult | string | number | boolean | null | ThingGraphValue[];
1877
+ /** @internal */
1878
+ type ThingGraphResult = ThingDetail & {
1879
+ about?: ThingGraphValue;
1880
+ assertions?: ThingGraphResult[];
1881
+ resolved?: Record<string, ThingGraphValue>;
1882
+ graph?: {
1883
+ depth: number;
1884
+ limit: number;
1885
+ truncated: boolean;
1886
+ };
1887
+ };
1888
+ /** @internal */
1889
+ type ThingHistory = HistoryResult;
1890
+ /** @internal */
1891
+ type HistoryResult = {
1892
+ thing?: {
1893
+ wref: string;
1894
+ name?: string;
1895
+ kind: string;
1896
+ shapeName?: string;
1897
+ };
1898
+ versions: Array<{
1899
+ version: number;
1900
+ wref: string;
1901
+ operation: 'add' | 'revise' | 'retract';
1902
+ retractReason?: string;
1903
+ active: boolean;
1904
+ createdAt: number;
1905
+ thingName?: string;
1906
+ thingKind?: string;
1907
+ shapeName?: string;
1908
+ data?: unknown;
1909
+ committerWref?: string;
1910
+ createdByWref?: string;
1911
+ [key: string]: unknown;
1912
+ }>;
1913
+ nextCursor?: string;
1914
+ };
1915
+ /** @internal */
1916
+ type ThingHeadRequest = {
1917
+ orgName: string;
1918
+ repoName: string;
1919
+ shape?: string;
1920
+ kind?: string;
1921
+ match?: string;
1922
+ dataMode?: 'full' | 'summary' | 'none';
1923
+ includeRetracted?: boolean;
1924
+ limit?: number;
1925
+ cursor?: string;
1926
+ componentId?: string;
1927
+ excludeComponents?: boolean;
1928
+ excludeInfraShapes?: boolean;
1929
+ };
1930
+ /** @internal */
1931
+ type ThingHead = HeadResult;
1932
+ /** @internal */
1933
+ type LiveWatchResult = {
1934
+ updates: number;
1935
+ };
1936
+ /**
1937
+ * Handle returned by live subscription helpers.
1938
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/livehandle/
1939
+ */
1940
+ type LiveHandle = {
1941
+ close: () => void;
1942
+ closed: Promise<LiveWatchResult>;
1943
+ };
1944
+ /** @internal */
1945
+ type LiveThingHeadOptions = ThingHeadOptions & {
1946
+ signal?: AbortSignal;
1947
+ };
1948
+ /** @internal */
1949
+ type LiveThingHistoryOptions = ThingHistoryOptions & {
1950
+ signal?: AbortSignal;
1951
+ };
1952
+ /** @internal */
1953
+ type LiveSubscriptionLogOptions = ActionLiveFeedOptions & {
1954
+ signal?: AbortSignal;
1955
+ };
1956
+ /**
1957
+ * Raw SSE invalidation event from a watched repo.
1958
+ *
1959
+ * @see https://docs.warmhub.ai/subscriptions/overview/#how-subscriptions-work
1960
+ */
1961
+ type LiveRepoEvent = {
1962
+ topic: 'commit.applied' | 'action.updated';
1963
+ affectedShapes: string[];
1964
+ affectedThings: string[];
1965
+ affectedTargets: string[];
1966
+ hasNewCommit: boolean;
1967
+ };
1968
+ /** @internal */
1969
+ type ActionListRunsOptions = {
1970
+ subscriptionName?: string;
1971
+ status?: 'pending' | 'running' | 'retry_wait' | 'succeeded' | 'failed_terminal' | 'dead_letter';
1972
+ since?: number;
1973
+ limit?: number;
1974
+ };
1975
+ /** @internal */
1976
+ type ActionLiveFeedOptions = {
1977
+ limit?: number;
1978
+ cursor?: string;
1979
+ };
1980
+ /** @internal */
1981
+ type ActionListNotificationsOptions = {
1982
+ since?: number;
1983
+ limit?: number;
1984
+ };
1985
+ /** @internal */
1986
+ type ThingHistoryOptions = {
1987
+ wref?: string;
1988
+ shape?: string;
1989
+ about?: string;
1990
+ includeRetracted?: boolean;
1991
+ resolveCollections?: boolean;
1992
+ match?: string;
1993
+ limit?: number;
1994
+ cursor?: string;
1995
+ };
1996
+ /** @internal */
1997
+ type ThingGetOptions = {
1998
+ includeRetracted?: boolean;
1999
+ };
2000
+ /** @internal */
2001
+ type ThingGraphOptions = {
2002
+ version?: number;
2003
+ depth?: number;
2004
+ limit?: number;
2005
+ };
2006
+ /**
2007
+ * Result from `client.token.create`. Includes the one-time secret token
2008
+ * value and its metadata — persist the secret immediately, it is only
2009
+ * returned on creation.
2010
+ *
2011
+ * @internal
2012
+ */
2013
+ type TokenResult = TokenCreateResult;
2014
+ /**
2015
+ * Shape of an access token record returned from `client.token.list` and
2016
+ * `client.token.get`.
2017
+ *
2018
+ * `expiresAt` and `revokedAt` are normalized to `number | null` so
2019
+ * "never expires" / "not revoked" (`null`) is distinguishable from
2020
+ * "expired at timestamp" / "revoked at timestamp" without probing for
2021
+ * `undefined`.
2022
+ *
2023
+ * @internal
2024
+ */
2025
+ type TokenInfo = {
2026
+ name: string;
2027
+ description?: string;
2028
+ scopes?: Array<{
2029
+ resource?: string;
2030
+ permissions: Array<string>;
2031
+ allowedMatches?: Array<string>;
2032
+ redactedResource?: true;
2033
+ }>;
2034
+ expiresAt: number | null;
2035
+ revokedAt: number | null;
2036
+ createdAt: number;
2037
+ /**
2038
+ * Default committer identity wref. Null when this PAT has no
2039
+ * associated identity.
2040
+ */
2041
+ committerIdentityWref?: string | null;
2042
+ };
2043
+ /** @internal */
2044
+ type CredentialInfo = {
2045
+ name: string;
2046
+ scope: 'org' | 'repo';
2047
+ description?: string;
2048
+ keyNames: string[];
2049
+ revokedAt?: number;
2050
+ createdAt: number;
2051
+ updatedAt: number;
2052
+ };
2053
+ /** @internal */
2054
+ type CredentialAuditEntry = {
2055
+ timestamp: number;
2056
+ action: string;
2057
+ actorId: string;
2058
+ };
2059
+ /** @internal */
2060
+ type CredentialGrantResult = {
2061
+ granted: boolean;
2062
+ repoName: string;
2063
+ };
2064
+ /** @internal */
2065
+ type CredentialUngrantResult = {
2066
+ ungranted: boolean;
2067
+ repoName: string;
2068
+ };
2069
+ /** @internal */
2070
+ type CredentialKeyMutationResult = CredentialKeyMutationResult$1;
2071
+ /** @internal */
2072
+ type CredentialDeleteResult = CredentialDeleteResult$1;
2073
+ /** @internal */
2074
+ type CredentialRevokeResult = CredentialRevokeResult$1;
2075
+ /** @internal */
2076
+ type SubscriptionBindCredentialsResult = SubscriptionBindCredentialsResult$1;
2077
+ /** @internal */
2078
+ type SubscriptionUnbindCredentialsResult = SubscriptionUnbindCredentialsResult$1;
2079
+ /** @internal */
2080
+ type Assertion = ThingDetail & {
2081
+ children: Assertion[];
2082
+ };
2083
+ /** @internal */
2084
+ type AboutResult = {
2085
+ target?: ThingDetail;
2086
+ assertions: Assertion[];
2087
+ nextCursor?: string;
2088
+ };
2089
+ /** @internal */
2090
+ type FilterResult = HeadResult;
2091
+ /** @internal */
2092
+ type SearchResult = HeadResult;
2093
+ /** @internal */
2094
+ type RefsResult = RefsResult$1;
2095
+ /** @internal */
2096
+ type ResolveWrefResult = ThingDetail;
2097
+ /** @internal */
2098
+ type ThingGetManyResult = ThingGetManyResult$1;
2099
+ /** @internal */
2100
+ type CountResult = {
2101
+ count: number;
2102
+ };
2103
+ /** @internal */
2104
+ type AboutOptions = {
2105
+ shape?: string;
2106
+ match?: string;
2107
+ includeRetracted?: boolean;
2108
+ depth?: number;
2109
+ resolveCollections?: boolean;
2110
+ limit?: number;
2111
+ cursor?: string;
2112
+ };
2113
+ /**
2114
+ * Filter options for `client.thing.query`.
2115
+ *
2116
+ * All fields are optional and combine as AND filters; unspecified fields do
2117
+ * not constrain the result set. See [Read Semantics](/sdk/read-semantics/)
2118
+ * for glob `match` behavior, retraction visibility, and pagination rules.
2119
+ *
2120
+ * @see https://docs.warmhub.ai/sdk/read-semantics/
2121
+ */
2122
+ type FilterOptions = {
2123
+ /** Filter to records of this shape name (for example `Player`). */
2124
+ shape?: string;
2125
+ /** Filter to records of this kind: `shape`, `thing`, `assertion`, or `collection`. */
2126
+ kind?: string;
2127
+ /** Filter assertions whose `about` target wref matches the supplied value. */
2128
+ about?: string;
2129
+ /** Glob pattern matched against record names (for example `Player/*`). */
2130
+ match?: string;
2131
+ /** Include retracted versions in the result set. */
2132
+ includeRetracted?: boolean;
2133
+ /** Maximum records returned per page. */
2134
+ limit?: number;
2135
+ /** Pagination cursor returned by the prior call. */
2136
+ cursor?: string;
2137
+ /** Filter to records attributed to this component identifier. */
2138
+ componentId?: string;
2139
+ /** Exclude records attributed to any component. */
2140
+ excludeComponents?: boolean;
2141
+ /** Exclude internal infrastructure shapes from the result set. */
2142
+ excludeInfraShapes?: boolean;
2143
+ /** Expand collection targets to their members in the result. */
2144
+ resolveCollections?: boolean;
2145
+ };
2146
+ /**
2147
+ * Options for `client.thing.search`. Extends {@link FilterOptions} with
2148
+ * search-specific fields.
2149
+ *
2150
+ * When `about` is set or `resolveCollections` is true, result pages may be
2151
+ * sparse — keep paginating until `nextCursor` is absent.
2152
+ *
2153
+ * @see https://docs.warmhub.ai/sdk/read-semantics/#search-modes
2154
+ */
2155
+ type SearchOptions = FilterOptions & {
2156
+ /** Restrict the search to assertions about this wref target. */
2157
+ about?: string;
2158
+ /** Search mode: `text` (BM25), `vector` (semantic), or `hybrid` (combined). Defaults to `text`. */
2159
+ mode?: 'text' | 'vector' | 'hybrid';
2160
+ /** Expand collection members in the result; pages may be sparse when set. */
2161
+ resolveCollections?: boolean;
2162
+ /** Exclude internal infrastructure shapes from results. */
2163
+ excludeInfraShapes?: boolean;
2164
+ };
2165
+ /**
2166
+ * Options for `client.thing.count`. Same filter set as {@link FilterOptions};
2167
+ * pagination fields (`limit`, `cursor`) are ignored.
2168
+ * @see https://docs.warmhub.ai/sdk-reference/type-aliases/countoptions/
2169
+ */
2170
+ type CountOptions = FilterOptions;
2171
+ /**
2172
+ * Options for `client.thing.refs` — wref-field reverse and forward lookups.
2173
+ *
2174
+ * @see https://docs.warmhub.ai/sdk/read-semantics/#reference-queries
2175
+ */
2176
+ type RefsOptions = {
2177
+ /** `inbound` finds records whose wref fields point at the target; `outbound` finds records the target points to. Defaults to `inbound`. */
2178
+ direction?: 'inbound' | 'outbound';
2179
+ /** Narrow an inbound search to a specific wref field path on the source shape. */
2180
+ fieldPath?: string;
2181
+ /** Maximum references returned per page. */
2182
+ limit?: number;
2183
+ /** Pagination cursor returned by the prior call. */
2184
+ cursor?: string;
2185
+ };
2186
+ /** @internal */
2187
+ type PingResult = {
2188
+ ok: boolean;
2189
+ error?: string;
2190
+ };
2191
+ /** @internal */
2192
+ type AccessTokenProvider = string | (() => string | undefined | Promise<string | undefined>);
2193
+ /** @internal */
2194
+ declare function resolveFunctionLogMode(mode?: FunctionLogMode): FunctionLogMode;
2195
+ /** @internal */
2196
+ declare function sanitizeErrorMessage(message: string): string;
2197
+ /**
2198
+ * Normalized error shape thrown by the WarmHub SDK.
2199
+ *
2200
+ * SDK helpers convert transport, tRPC, validation, and backend failures into
2201
+ * this class so callers can branch on stable `code` / `kind` values and read
2202
+ * optional response metadata such as `status`, `hint`, and `retryAfter`.
2203
+ *
2204
+ * See {@link ErrorKind} for the catalog of stable kinds with cause,
2205
+ * retryability, corrective action, and origin per kind, and
2206
+ * {@link isRetryable} for the canonical retry test.
2207
+ *
2208
+ * @example
2209
+ * ```ts
2210
+ * try {
2211
+ * await client.repo.get('acme', 'world')
2212
+ * } catch (err) {
2213
+ * if (isWarmHubError(err) && err.kind === 'NOT_FOUND') {
2214
+ * // handle missing repo
2215
+ * } else if (isRetryable(err)) {
2216
+ * // safe to retry (NETWORK, CANCELLED, BACKEND, RATE_LIMITED)
2217
+ * } else {
2218
+ * throw err
2219
+ * }
2220
+ * }
2221
+ * ```
2222
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhuberror/
2223
+ */
2224
+ declare class WarmHubError extends Error {
2225
+ /**
2226
+ * Stable SDK error code or pass-through backend domain code. Branch on this
2227
+ * (or the alias {@link kind}) to handle expected failure modes.
2228
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhuberror/#code
2229
+ */
2230
+ readonly code: string;
2231
+ /**
2232
+ * HTTP status from the failing response when one was available.
2233
+ */
2234
+ readonly status?: number;
2235
+ /**
2236
+ * Optional human-readable hint surfaced by the backend.
2237
+ */
2238
+ readonly hint?: string;
2239
+ /**
2240
+ * Seconds the caller should wait before retrying. Present on `RATE_LIMITED`
2241
+ * responses and other backend signals that carry a Retry-After header.
2242
+ */
2243
+ readonly retryAfter?: number;
2244
+ constructor(code: string, message: string, status?: number, hint?: string, retryAfter?: number);
2245
+ get kind(): ErrorKind;
2246
+ }
2247
+ /**
2248
+ * Normalize an unknown thrown value into `WarmHubError`.
2249
+ * @see https://docs.warmhub.ai/sdk-reference/functions/towarmhuberror/
2250
+ */
2251
+ declare function toWarmHubError(error: unknown): WarmHubError;
2252
+ /**
2253
+ * Return whether a thrown value is already a `WarmHubError`.
2254
+ * @see https://docs.warmhub.ai/sdk-reference/functions/iswarmhuberror/
2255
+ */
2256
+ declare function isWarmHubError(error: unknown): error is WarmHubError;
2257
+ /**
2258
+ * Return whether an error kind is generally safe to retry.
2259
+ *
2260
+ * Returns `true` for these {@link ErrorKind} values:
2261
+ *
2262
+ * - `NETWORK` — transport-level failure during a request (DNS, refused,
2263
+ * timeout, mid-flight fetch error). Safe to retry GETs and other read
2264
+ * surfaces; for side-effectful POSTs the request may already have landed
2265
+ * on the server, so retry only when the surface is idempotent or use an
2266
+ * idempotency key / state reconciliation before replaying.
2267
+ * - `CANCELLED` — the caller aborted; retry only if the caller still wants
2268
+ * the result.
2269
+ * - `BACKEND` — generic server-side failure with no specific domain code;
2270
+ * retry with backoff and surface the message if it persists.
2271
+ * - `RATE_LIMITED` — caller exceeded the budget; retry after the
2272
+ * {@link WarmHubError.retryAfter} interval.
2273
+ *
2274
+ * All other kinds — including backend pass-through domain codes such as
2275
+ * `SHAPE_MISMATCH` or `WREF_UNRESOLVABLE` — return `false`. This is a
2276
+ * conservative default: for most pass-through codes the caller must fix the
2277
+ * input or escalate, but the backend reuses some codes for transient
2278
+ * conditions (notably `INTERNAL_ERROR` from the webhook-validation path,
2279
+ * whose `message` literally says `please retry`). See the pass-through
2280
+ * paragraph on {@link ErrorKind} — read `WarmHubError.message` before
2281
+ * giving up on a `false` return from this helper.
2282
+ * @see https://docs.warmhub.ai/sdk-reference/functions/isretryable/
2283
+ */
2284
+ declare function isRetryable(error: unknown): boolean;
2285
+ /**
2286
+ * True if `error` is a connection-level fetch failure — raised before the
2287
+ * server produced a response. Detects both `TypeError('fetch failed')` (Node
2288
+ * undici, browsers) and Bun's native `Error` with a `code` like
2289
+ * `ConnectionRefused` / `ECONNREFUSED`.
2290
+ * @see https://docs.warmhub.ai/sdk-reference/functions/isconnectionerror/
2291
+ */
2292
+ declare function isConnectionError(error: unknown): boolean;
2293
+ /**
2294
+ * Canonical user-facing message for a connection-level failure. Embeds the
2295
+ * target URL so the user can see which endpoint was unreachable.
2296
+ * @see https://docs.warmhub.ai/sdk-reference/functions/connectionerrormessage/
2297
+ */
2298
+ declare function connectionErrorMessage(url: string): string;
2299
+ /**
2300
+ * Primary TypeScript client for the WarmHub API.
2301
+ *
2302
+ * The client groups API calls by domain (`repo`, `thing`, `shape`, `commit`,
2303
+ * `subscription`, and related surfaces), applies configured authentication to
2304
+ * every request, and normalizes most transport and backend failures through
2305
+ * `WarmHubError`. Streamed commit writes may instead throw
2306
+ * `PartialStreamSubmissionError` when an append outcome is ambiguous.
2307
+ *
2308
+ * @see https://docs.warmhub.ai/sdk/client/
2309
+ */
2310
+ declare class WarmHubClient {
2311
+ /**
2312
+ * The resolved API base URL the client issues requests against. Defaults to
2313
+ * {@link DEFAULT_API_URL} when no `apiUrl` is passed to the constructor.
2314
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#apiurl
2315
+ */
2316
+ readonly apiUrl: string;
2317
+ private readonly fetchImpl;
2318
+ private readonly accessToken;
2319
+ protected readonly functionLogMode: FunctionLogMode;
2320
+ protected readonly getToken?: () => Promise<string | undefined>;
2321
+ private readonly trpc;
2322
+ /**
2323
+ * Authentication helpers for browser sign-in flows, session checks, and token diagnostics.
2324
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#auth
2325
+ */
2326
+ readonly auth: {
2327
+ /**
2328
+ * Return the configured browser authentication client ID.
2329
+ *
2330
+ * Use this in browser sign-in flows that need to initialize the configured auth provider before redirecting or opening a login UI.
2331
+ */
2332
+ getClientId: () => Promise<string>;
2333
+ /**
2334
+ * Sync the authenticated identity with WarmHub.
2335
+ *
2336
+ * Call after a browser or server session is established so WarmHub can provision or refresh the corresponding user and personal organization records.
2337
+ */
2338
+ sync: () => Promise<AuthSyncResult>;
2339
+ /**
2340
+ * Return the current authenticated WarmHub user.
2341
+ *
2342
+ * Throws when the request is unauthenticated or the token cannot be resolved.
2343
+ */
2344
+ currentUser: () => Promise<CurrentUserInfo>;
2345
+ /**
2346
+ * Return authentication status, identity details, and token scope diagnostics for the current request.
2347
+ */
2348
+ whoami: () => Promise<WhoamiInfo>;
2349
+ };
2350
+ /**
2351
+ * Lightweight permission checks for UI gating and service-side authorization probes.
2352
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#access
2353
+ */
2354
+ readonly access: {
2355
+ /**
2356
+ * Check whether the caller has a repo-scoped permission.
2357
+ *
2358
+ * @param permission Permission string such as `repo:read`, `repo:write`, `repo:configure`, or `repo:admin`.
2359
+ */
2360
+ checkRepoPermission: (orgName: string, repoName: string, permission: string) => Promise<boolean>;
2361
+ /**
2362
+ * Check whether the caller has an org-scoped permission.
2363
+ *
2364
+ * @param permission Permission string such as `org:read`, `org:configure`, or `org:admin`.
2365
+ */
2366
+ checkOrgPermission: (orgName: string, permission: string) => Promise<boolean>;
2367
+ };
2368
+ /**
2369
+ * Connectivity and compatibility helpers for checking the configured WarmHub backend.
2370
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#diagnostics
2371
+ */
2372
+ readonly diagnostics: {
2373
+ /**
2374
+ * Perform a health-check request against the configured backend URL.
2375
+ *
2376
+ * This uses the HTTP health endpoint rather than tRPC, so it is useful for distinguishing connection failures from procedure-level errors.
2377
+ */
2378
+ ping: () => Promise<PingResult>;
2379
+ /**
2380
+ * Return backend API version, minimum supported SDK version, and feature flags.
2381
+ */
2382
+ capabilities: () => Promise<Capabilities>;
2383
+ };
2384
+ /**
2385
+ * Installed component inspection for packages that add shapes, subscriptions, credentials, and seed data to a repository.
2386
+ *
2387
+ * The top-level methods cover per-repo installation queries, bundled system installs, and the registry-backed install pipeline used by `wh component install <org/name>`.
2388
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#component
2389
+ */
2390
+ readonly component: {
2391
+ /**
2392
+ * List components installed in a repository.
2393
+ *
2394
+ * Pass pagination options when a repository may have many installed components.
2395
+ */
2396
+ list: (orgName: string, repoName: string, opts?: ComponentListOptions) => Promise<ComponentList>;
2397
+ /**
2398
+ * Fetch one installed component by component ID.
2399
+ */
2400
+ get: (orgName: string, repoName: string, componentId: string) => Promise<ComponentView>;
2401
+ /**
2402
+ * Install an allowlisted bundled system component into a repository.
2403
+ */
2404
+ installSystem: (orgName: string, repoName: string, componentId: string) => Promise<ComponentInstallSystemResult>;
2405
+ /**
2406
+ * Registered-component identity and install-pipeline operations.
2407
+ *
2408
+ * This sub-surface drives the backend-mediated install flow that powers `wh component install <org/name>`. It manages registered component identities (`register`, `unregister`, `list`, `view`, `update`) and the install pipeline (`resolve` mints an install id, `downloadSource` fetches the source archive through the backend, `setupCall` dispatches the optional setup callback). Use these when building a custom installer; most callers should run the CLI instead.
2409
+ */
2410
+ registry: {
2411
+ register: (orgName: string, componentName: string, input?: ComponentRegistryMutationInput) => Promise<ComponentRegistryInfo>;
2412
+ unregister: (orgName: string, componentName: string) => Promise<{
2413
+ unregistered: true;
2414
+ }>;
2415
+ list: (orgName: string) => Promise<ComponentRegistryList>;
2416
+ view: (orgName: string, componentName: string) => Promise<ComponentRegistryInfo>;
2417
+ update: (orgName: string, componentName: string, input: ComponentRegistryMutationInput) => Promise<ComponentRegistryInfo>;
2418
+ resolve: (orgName: string, componentName: string, installRepo: string) => Promise<ComponentRegistryResolveResult>;
2419
+ downloadSource: (orgName: string, componentName: string, input: ComponentRegistrySourceDownloadInput) => Promise<ComponentRegistrySourceDownloadResult>;
2420
+ setupCall: (orgName: string, componentName: string, input: ComponentRegistrySetupCallInput) => Promise<ComponentRegistrySetupCallResult>;
2421
+ };
2422
+ /**
2423
+ * Operator-invoked CLI methods (GH-3193).
2424
+ *
2425
+ * `cli.call(orgName, componentName, method, { installRepo, args })`
2426
+ * dispatches a component-declared method via the backend. The backend
2427
+ * loads the install's manifest snapshot, verifies the method exists,
2428
+ * authorizes the operator, signs the request with the install-repo
2429
+ * credential set (HMAC over `${timestamp}.${body}` by default), and
2430
+ * proxies the component service's JSON response back as the envelope's
2431
+ * `body`.
2432
+ *
2433
+ * WarmHub-level failures (component not installed, method not in snapshot,
2434
+ * `ComponentConfig.cliBaseUrl` missing, credentials missing, operator
2435
+ * lacks `requiresPermission`) come back as a thrown `WarmHubError`.
2436
+ * Upstream non-2xx responses do **not** throw — they arrive inside the
2437
+ * envelope as `{ ok: false, status, body }` so the CLI can pretty-print
2438
+ * the component's own error payload.
2439
+ */
2440
+ cli: {
2441
+ call: (orgName: string, componentName: string, method: string, input: ComponentRegistryCliCallInput) => Promise<ComponentRegistryCliCallResult>;
2442
+ };
2443
+ };
2444
+ /**
2445
+ * High-level write surface for submitting WarmHub operations through the commit pipeline.
2446
+ *
2447
+ * @see https://docs.warmhub.ai/sdk/commit-vs-builder/
2448
+ */
2449
+ readonly commit: {
2450
+ /**
2451
+ * Submit one or more operations through WarmHub's commit pipeline.
2452
+ *
2453
+ * This is the primary write path for SDK callers. It streams operations to the backend, preserves server-side per-operation results, supports chunking for large submissions, and can attribute writes to a committer wref or installed component.
2454
+ *
2455
+ * Simple first-chunk transport failures are retried by default. Multi-chunk ambiguous failures are surfaced as `PartialStreamSubmissionError` so callers can inspect repository state before deciding whether to resume or retry. See [Transient Retry](/sdk/transient-retry/) for the full retry and partial-submission rules.
2456
+ *
2457
+ * Writing to an archived organization or repository fails with an `ARCHIVED` error before any operations are applied.
2458
+ *
2459
+ * @param message Optional commit message stored with the submitted operations.
2460
+ * @param operations Add, revise, or retract operations to submit in order.
2461
+ * @param opts.committer Optional wref identifying the actor on whose behalf the write is made. Must be a full wref string like `"Agent/bot-1"` (a thing that already exists), or a cross-repo wref like `"wh:other-org/other-repo/Agent/bot-1"`. Bare names such as `"eval-runner"` are rejected by the backend with a "Thing wref required" error — there is no implicit shape.
2462
+ * @param opts.componentId Attribute writes to an installed component when the caller is allowed to claim it.
2463
+ * @param opts.chunkSize Maximum operations per stream append. Values are clamped by the SDK.
2464
+ * @param opts.skipExisting Return `noop` for add operations whose target already exists.
2465
+ * @param opts.streamId Advanced continuation hook for caller-managed streams.
2466
+ * @param opts.allocatedTokens Advanced continuation hook for `$N` / `#N` token allocation state.
2467
+ * @param opts.retry Retry policy for transient first-chunk failures, or `false` to disable automatic retry.
2468
+ */
2469
+ apply: (orgName: string, repoName: string, message: string | undefined, operations: Operation[], opts?: {
2470
+ committer?: string;
2471
+ componentId?: string;
2472
+ chunkSize?: number;
2473
+ skipExisting?: boolean;
2474
+ streamId?: string;
2475
+ allocatedTokens?: StreamAppendResult$1["allocatedTokens"];
2476
+ retry?: RetryPolicyOptions | false;
2477
+ }) => Promise<OperationSubmitResult>;
2478
+ };
2479
+ /**
2480
+ * Organization management surface for namespaces, membership, roles, and scoped member permissions.
2481
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#org
2482
+ */
2483
+ readonly org: {
2484
+ /**
2485
+ * Get an organization by name.
2486
+ */
2487
+ get: (orgName: string) => Promise<OrgInfo>;
2488
+ /**
2489
+ * Return the caller's role in an organization, or `null` when the caller is not a member.
2490
+ *
2491
+ * Useful for UI gating before showing organization-level controls.
2492
+ */
2493
+ getCallerRole: (orgName: string) => Promise<OrgRole | null>;
2494
+ /**
2495
+ * List organizations visible to the caller.
2496
+ *
2497
+ * Archived organizations are hidden unless `includeArchived` is set.
2498
+ */
2499
+ list: (opts?: OrgListOptions) => Promise<Page<OrgInfo>>;
2500
+ /**
2501
+ * Create a new organization.
2502
+ *
2503
+ * The description is trimmed and empty strings are ignored. Organization names must avoid reserved public slugs such as `docs`, `api`, `login`, and `warmhub`.
2504
+ *
2505
+ * @param displayName Optional display label. Defaults to the organization name when omitted.
2506
+ */
2507
+ create: (name: string, displayName?: string, description?: string) => Promise<OrgInfo>;
2508
+ /**
2509
+ * Set or clear an organization description.
2510
+ *
2511
+ * Descriptions are trimmed; empty strings clear the stored value.
2512
+ */
2513
+ setDescription: (orgName: string, description?: string) => Promise<OrgInfo>;
2514
+ /**
2515
+ * Update an organization's display name.
2516
+ *
2517
+ * Display names are trimmed; empty or whitespace-only values are rejected.
2518
+ */
2519
+ setDisplayName: (orgName: string, displayName: string) => Promise<OrgInfo>;
2520
+ /**
2521
+ * Rename an organization in place.
2522
+ *
2523
+ * The new slug must satisfy the same naming and reserved-name rules as organization creation.
2524
+ */
2525
+ rename: (orgName: string, newName: string) => Promise<OrgInfo>;
2526
+ /**
2527
+ * Atomic combined update of an organization's display name and/or slug.
2528
+ *
2529
+ * Both writes run in a single backend transaction so a slug conflict cannot leave a partial display-name change behind. Pass at least one of `displayName` or `newName`.
2530
+ */
2531
+ update: (input: {
2532
+ orgName: string;
2533
+ displayName?: string;
2534
+ newName?: string;
2535
+ }) => Promise<OrgInfo>;
2536
+ /**
2537
+ * Add a member to an organization or create a pending invite.
2538
+ *
2539
+ * The role defaults to `editor`. If the email address does not belong to an existing WarmHub user, WarmHub creates a pending invite and attempts to send the invite email asynchronously. Only owners can assign the `owner` role.
2540
+ *
2541
+ * @param role Organization role to assign. Defaults to `editor`.
2542
+ */
2543
+ addMember: (orgName: string, email: string, role?: "owner" | "admin" | "editor" | "viewer") => Promise<OrgMemberInfo>;
2544
+ /**
2545
+ * Remove an active member or revoke a pending invite by email address.
2546
+ */
2547
+ removeMember: (orgName: string, email: string) => Promise<void>;
2548
+ /**
2549
+ * Change a member's organization role.
2550
+ *
2551
+ * Only owners can promote another member to owner or demote an existing owner. WarmHub rejects attempts to remove the final owner.
2552
+ */
2553
+ changeMemberRole: (orgName: string, email: string, role: "owner" | "admin" | "editor" | "viewer") => Promise<OrgMemberInfo>;
2554
+ /**
2555
+ * Replace a member's scoped permission entries.
2556
+ *
2557
+ * Each entry targets either the organization (`acme`) or one repository (`acme/world`) and carries the full desired permission set for that resource. Matching entries replace the role-derived permission set for that resource; include every permission the member should retain.
2558
+ *
2559
+ * Member scope entries share the same wire shape as personal access token scopes, but `allowedMatches` is enforced for PATs only. Member scopes cannot restrict access by thing-name glob.
2560
+ *
2561
+ * @param scopes Scoped permission entries with `resource` and `permissions` fields.
2562
+ */
2563
+ setMemberScopes: (orgName: string, email: string, scopes: WireScopeEntry[]) => Promise<void>;
2564
+ /**
2565
+ * Remove all scoped permission entries from a member.
2566
+ *
2567
+ * After clearing, the member's effective access comes from their organization role only.
2568
+ */
2569
+ clearMemberScopes: (orgName: string, email: string) => Promise<void>;
2570
+ /**
2571
+ * List organization members and pending invites.
2572
+ *
2573
+ * The response includes the caller's current organization role so frontend settings pages can gate owner/admin-only controls without making a second request.
2574
+ *
2575
+ * @param opts.pending When `true`, return only pending invites.
2576
+ */
2577
+ listMembers: (orgName: string, opts?: OrgListMembersOptions) => Promise<OrgMemberList>;
2578
+ /**
2579
+ * Archive an organization, blocking new repositories and membership changes.
2580
+ */
2581
+ archive: (orgName: string) => Promise<OrgInfo>;
2582
+ /**
2583
+ * Unarchive an organization.
2584
+ */
2585
+ unarchive: (orgName: string) => Promise<OrgInfo>;
2586
+ };
2587
+ /**
2588
+ * Repository management surface for lifecycle operations, metadata, statistics, and content documents.
2589
+ *
2590
+ * @see https://docs.warmhub.ai/sdk/repo-stats/
2591
+ */
2592
+ readonly repo: {
2593
+ /**
2594
+ * Get a repository by organization and repository name.
2595
+ */
2596
+ get: (orgName: string, repoName: string) => Promise<RepoInfo>;
2597
+ /**
2598
+ * Return authoritative active-item totals for a single repository.
2599
+ *
2600
+ * The returned `total` is the sum of active shapes, things, and assertions. Use this when billing, quota checks, health reports, or per-shape breakdowns need single-repo stats.
2601
+ *
2602
+ * The per-shape breakdown counts active things by shape; assertions are not included in that map.
2603
+ */
2604
+ getStats: (orgName: string, repoName: string) => Promise<RepoStatsView>;
2605
+ /**
2606
+ * Return active-item totals for up to 100 repositories in one request.
2607
+ *
2608
+ * Use this instead of issuing one `getStats` request per repository when building organization dashboards. Batch entries include the exact `total` for visible repositories; call `getStats` for an individual repository when you need the per-shape map.
2609
+ */
2610
+ getStatsBatch: (orgName: string, repoNames: string[]) => Promise<RepoStatsBatchResult>;
2611
+ /**
2612
+ * Return configuration-surface counts for a repository.
2613
+ *
2614
+ * Currently this reports the number of subscriptions attached to the repository, which is useful before delete or visibility-change flows.
2615
+ */
2616
+ getConfigureStats: (orgName: string, repoName: string) => Promise<RepoConfigureStatsView>;
2617
+ /**
2618
+ * Return per-shape thing and assertion counts for a repository.
2619
+ *
2620
+ * The server computes the totals directly, so callers do not need to page through repository contents to build shape summary UI.
2621
+ */
2622
+ getShapeInstanceCounts: (orgName: string, repoName: string) => Promise<RepoShapeInstanceCountsView>;
2623
+ /**
2624
+ * List repositories in an organization.
2625
+ *
2626
+ * Archived repositories are hidden by default. Search and sort options are applied before pagination.
2627
+ */
2628
+ list: (orgName: string, opts?: RepoListOptions) => Promise<RepoList>;
2629
+ /**
2630
+ * Create a repository inside an organization.
2631
+ *
2632
+ * Repositories are private by default. Descriptions are trimmed and capped by the backend.
2633
+ *
2634
+ * @param visibility `public` or `private`; defaults to `private`.
2635
+ */
2636
+ create: (orgName: string, repoName: string, description?: string, visibility?: RepoVisibility) => Promise<RepoInfo>;
2637
+ /**
2638
+ * Set or clear a repository description.
2639
+ *
2640
+ * Descriptions are trimmed; empty strings clear the stored value.
2641
+ */
2642
+ setDescription: (orgName: string, repoName: string, description?: string) => Promise<RepoInfo>;
2643
+ /**
2644
+ * Set a repository's visibility to `public` or `private`.
2645
+ */
2646
+ setVisibility: (orgName: string, repoName: string, visibility: RepoVisibility) => Promise<RepoInfo>;
2647
+ /**
2648
+ * Rename a repository within its organization.
2649
+ *
2650
+ * The new name must be unused in the organization and follow the same path-segment rules as repository creation.
2651
+ */
2652
+ rename: (orgName: string, repoName: string, newName: string) => Promise<RepoInfo>;
2653
+ /**
2654
+ * Archive a repository, blocking new writes.
2655
+ */
2656
+ archive: (orgName: string, repoName: string) => Promise<RepoInfo>;
2657
+ /**
2658
+ * Unarchive a repository.
2659
+ */
2660
+ unarchive: (orgName: string, repoName: string) => Promise<RepoInfo>;
2661
+ /**
2662
+ * Soft-delete a repository.
2663
+ *
2664
+ * The repository is hidden immediately and scheduled for permanent purge after a 30-day grace window. WarmHub blocks deletion when another repository still has inbound cross-repo references, active subscriptions, or active credential grants that depend on the repository.
2665
+ */
2666
+ delete: (orgName: string, repoName: string) => Promise<{
2667
+ graceExpiresAt: Date;
2668
+ }>;
2669
+ /**
2670
+ * Immediately and irreversibly purge a repository.
2671
+ *
2672
+ * This owner-only operation has no grace window and uses the same inbound-reference guard as `delete`.
2673
+ */
2674
+ hardDelete: (orgName: string, repoName: string) => Promise<void>;
2675
+ /**
2676
+ * List repositories with dashboard-oriented per-repository metadata.
2677
+ *
2678
+ * Each item includes exact active counts, an activity-oriented `lastWriteAt`, and a `hasErrors` flag for terminal action failures.
2679
+ *
2680
+ * Search and sort are applied before pagination, so cursors remain stable across the filtered and ordered list.
2681
+ */
2682
+ listPage: (orgName: string, opts?: RepoListPageOptions) => Promise<RepoListPageResult>;
2683
+ /**
2684
+ * Fetch a repository's `Content/Readme` markdown record.
2685
+ *
2686
+ * The SDK contract allows `null`; current backend behavior returns a synthesized empty stub for repositories that have not committed README content yet. Callers should still null-check defensively.
2687
+ */
2688
+ getReadme: (orgName: string, repoName: string) => Promise<ThingDetail | null>;
2689
+ /**
2690
+ * Generate a README draft from the repository's current shapes, things, and assertions.
2691
+ *
2692
+ * This does not commit the draft. Save returned content with `setReadme` after review.
2693
+ */
2694
+ generateReadme: (orgName: string, repoName: string) => Promise<{
2695
+ content: string;
2696
+ }>;
2697
+ /**
2698
+ * Fetch a repository's `Content/Agents` markdown record.
2699
+ *
2700
+ * The SDK contract allows `null`; current backend behavior mirrors `getReadme` and returns a synthesized empty stub when no AGENTS.md content has been committed yet.
2701
+ */
2702
+ getAgents: (orgName: string, repoName: string) => Promise<ThingDetail | null>;
2703
+ /**
2704
+ * Commit a new `Content/Readme` value.
2705
+ *
2706
+ * The backend adds or revises the content record through the normal commit pipeline.
2707
+ */
2708
+ setReadme: (orgName: string, repoName: string, content: string) => Promise<CommitApplyResult>;
2709
+ /**
2710
+ * Commit a new `Content/Agents` value through the normal commit pipeline.
2711
+ */
2712
+ setAgents: (orgName: string, repoName: string, content: string) => Promise<CommitApplyResult>;
2713
+ /**
2714
+ * Generate an AGENTS.md draft from the repository's current content and schema.
2715
+ *
2716
+ * This does not commit the draft. Save returned content with `setAgents` after review.
2717
+ */
2718
+ generateAgents: (orgName: string, repoName: string) => Promise<{
2719
+ content: string;
2720
+ }>;
2721
+ /**
2722
+ * Fetch the synthesized `Content/LlmsTxt` sitemap for a repository.
2723
+ *
2724
+ * The returned markdown follows the llms.txt convention. Authenticated callers also receive structured reference metadata partitioned by readable outbound and inbound references; cross-org references the caller cannot read are omitted.
2725
+ */
2726
+ getLlmsTxt: (orgName: string, repoName: string) => Promise<SynthesizedRepoContent>;
2727
+ };
2728
+ /**
2729
+ * Shape management surface for schema definitions that validate things and assertions.
2730
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#shape
2731
+ */
2732
+ readonly shape: {
2733
+ /**
2734
+ * List shape definitions in a repository.
2735
+ *
2736
+ * Options can include retracted shapes, filter by component ownership, or hide component-owned shapes.
2737
+ */
2738
+ list: (orgName: string, repoName: string, opts?: ShapeListOptions) => Promise<ShapeList>;
2739
+ /**
2740
+ * Get one shape definition by name.
2741
+ *
2742
+ * Returns the full shape thing record, with `name`,
2743
+ * `kind: "shape"`, `active`, and a nested `version: { version, operation,
2744
+ * data, dataHash } | null`. This is **not** the same shape as the
2745
+ * shape returned by `create` and `revise`: the change result
2746
+ * is flat (`name`, `operation`, `version: number`, `dataHash`) and does
2747
+ * not carry `data`. To read shape fields, call `get` and read
2748
+ * `result.version?.data` — the change result alone is not enough.
2749
+ *
2750
+ * @param opts.includeRetracted Include a retracted shape instead of treating it as missing.
2751
+ */
2752
+ get: (orgName: string, repoName: string, shapeName: string, opts?: ShapeGetOptions) => Promise<Shape>;
2753
+ /**
2754
+ * Create a shape definition.
2755
+ *
2756
+ * Shape data should describe the fields used to validate things and assertions with that shape.
2757
+ *
2758
+ * Returns `{ name, operation, version, dataHash }`.
2759
+ * The result confirms the write and exposes the new version number, but it
2760
+ * does **not** include the shape data — call `client.shape.get` for the
2761
+ * full shape record (with `kind`, `active`, and nested
2762
+ * `version.data`).
2763
+ *
2764
+ * @param opts.description Optional human-readable shape description.
2765
+ */
2766
+ create: (orgName: string, repoName: string, shapeName: string, fields: Record<string, unknown>, opts?: ShapeCreateOptions) => Promise<ShapeChange>;
2767
+ /**
2768
+ * Revise a shape definition, creating a new shape version.
2769
+ *
2770
+ * Returns `{ name, operation, version, dataHash }`,
2771
+ * the same flat shape as `create`. To read the revised fields back, call
2772
+ * `client.shape.get` for the full shape record.
2773
+ *
2774
+ * @param opts.description Optional human-readable description for the revised shape.
2775
+ */
2776
+ revise: (orgName: string, repoName: string, shapeName: string, newFields: Record<string, unknown>, opts?: ShapeReviseOptions) => Promise<ShapeChange>;
2777
+ /**
2778
+ * Retract a shape definition.
2779
+ */
2780
+ remove: (orgName: string, repoName: string, shapeName: string) => Promise<ShapeRemove>;
2781
+ /**
2782
+ * Rename a shape within a repository.
2783
+ *
2784
+ * The rename is applied in place: the existing shape history is preserved and no new version is created.
2785
+ */
2786
+ rename: (orgName: string, repoName: string, oldName: string, newName: string) => Promise<RenameResult>;
2787
+ /**
2788
+ * Return add, revise, retract, and rename history for a shape.
2789
+ *
2790
+ * Use pagination options for long-lived shapes with many revisions.
2791
+ */
2792
+ history: (orgName: string, repoName: string, name: string, opts?: ShapeHistoryOptions) => Promise<ShapeHistory>;
2793
+ };
2794
+ /**
2795
+ * Webhook and cron subscription management surface scoped to a repository.
2796
+ *
2797
+ * @see https://docs.warmhub.ai/sdk/component-identity/#subscriptions
2798
+ */
2799
+ readonly subscription: {
2800
+ /**
2801
+ * Create a webhook or cron subscription.
2802
+ *
2803
+ * Both subscription kinds require a delivery URL. Webhook subscriptions can also forward events from another repository, allow trace reentry, bind fallback delivery, and opt into success notifications. Component identity is set at creation time and follows the same authority rules as commit writes.
2804
+ *
2805
+ * Webhook subscriptions must specify a shape filter via `shapeName` or `filterJson.shape`, except [shape-lifecycle subscriptions](/subscriptions/creating/#shape-lifecycle-subscriptions) which omit both and rely on a `{ kind: 'shape', ... }` filter.
2806
+ */
2807
+ create: (input: SubscriptionCompatCreateInput) => Promise<SubscriptionInfo>;
2808
+ /**
2809
+ * Get one subscription by name.
2810
+ */
2811
+ get: (orgName: string, repoName: string, name: string) => Promise<SubscriptionInfo>;
2812
+ /**
2813
+ * List subscriptions attached to a repository.
2814
+ */
2815
+ list: (orgName: string, repoName: string) => Promise<SubscriptionList>;
2816
+ /**
2817
+ * Update an existing webhook or cron subscription.
2818
+ *
2819
+ * Use `null` for nullable fields such as fallback webhook URL when you need to clear an existing value.
2820
+ */
2821
+ update: (input: SubscriptionCompatUpdateInput) => Promise<SubscriptionInfo>;
2822
+ /**
2823
+ * Pause a subscription.
2824
+ */
2825
+ pause: (orgName: string, repoName: string, name: string) => Promise<{
2826
+ name: string;
2827
+ active: boolean;
2828
+ }>;
2829
+ /**
2830
+ * Resume a paused subscription.
2831
+ */
2832
+ resume: (orgName: string, repoName: string, name: string) => Promise<{
2833
+ name: string;
2834
+ active: boolean;
2835
+ }>;
2836
+ /**
2837
+ * Delete a subscription.
2838
+ */
2839
+ remove: (orgName: string, repoName: string, name: string) => Promise<{
2840
+ ok: true;
2841
+ }>;
2842
+ /**
2843
+ * Bind a credential set to a subscription for outbound webhook authentication.
2844
+ */
2845
+ bindCredentials: (orgName: string, repoName: string, subscriptionName: string, credentialSetName: string) => Promise<SubscriptionBindCredentialsResult>;
2846
+ /**
2847
+ * Remove the credential set currently bound to a subscription.
2848
+ */
2849
+ unbindCredentials: (orgName: string, repoName: string, subscriptionName: string) => Promise<SubscriptionUnbindCredentialsResult>;
2850
+ };
2851
+ /**
2852
+ * Low-level action lease, delivery, run, and notification primitives for subscription consumers.
2853
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#action
2854
+ */
2855
+ readonly action: {
2856
+ /**
2857
+ * Acquire an exclusive processing lease for a subscription consumer.
2858
+ *
2859
+ * @param holderId Stable identifier for the process claiming the lease.
2860
+ * @param holderType Kind of consumer claiming the lease.
2861
+ */
2862
+ acquireLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, holderType: "sdk" | "cli", opts?: {
2863
+ graceMs?: number;
2864
+ ttlMs?: number;
2865
+ }) => Promise<ActionLeaseAcquire>;
2866
+ /**
2867
+ * Extend the TTL for an existing processing lease.
2868
+ */
2869
+ heartbeatLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, ttlMs?: number) => Promise<ActionLeaseOp>;
2870
+ /**
2871
+ * Release an existing processing lease.
2872
+ */
2873
+ releaseLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string) => Promise<ActionLeaseOp>;
2874
+ /**
2875
+ * Claim one action delivery run for processing.
2876
+ */
2877
+ claimDelivery: (orgName: string, repoName: string, runId: string, holderId: string) => Promise<ActionLeaseOp>;
2878
+ /**
2879
+ * Mark one claimed action delivery run as complete.
2880
+ */
2881
+ completeDelivery: (orgName: string, repoName: string, runId: string, holderId: string) => Promise<ActionLeaseOp>;
2882
+ /**
2883
+ * Query the live delivery feed for a subscription.
2884
+ *
2885
+ * Use this for polling or live-log views that need recent delivery status entries.
2886
+ */
2887
+ liveFeed: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions) => Promise<ActionLiveFeed>;
2888
+ /**
2889
+ * List subscription action runs for a repository.
2890
+ *
2891
+ * The result can be filtered by subscription name, status, and start time.
2892
+ */
2893
+ listRuns: (orgName: string, repoName: string, opts?: ActionListRunsOptions) => Promise<ActionRunInfo[]>;
2894
+ /**
2895
+ * List delivery attempts for one action run.
2896
+ */
2897
+ getRunAttempts: (orgName: string, repoName: string, runId: string) => Promise<ActionAttemptInfo[]>;
2898
+ /**
2899
+ * List repo-scoped action notifications.
2900
+ *
2901
+ * Use `since` or `limit` to bound notification-center style reads.
2902
+ */
2903
+ listNotifications: (orgName: string, repoName: string, opts?: ActionListNotificationsOptions) => Promise<ActionNotificationInfo[]>;
2904
+ };
2905
+ /**
2906
+ * Read surface for things, assertions, histories, references, search, and in-place thing renames.
2907
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#thing
2908
+ */
2909
+ readonly thing: {
2910
+ /**
2911
+ * Return the current HEAD snapshot for repository contents.
2912
+ *
2913
+ * Filter by shape, kind, assertion target, or glob `match` pattern, and choose the data mode appropriate for the payload size. Component filters can narrow results to component-owned records or hide component infrastructure records.
2914
+ *
2915
+ * Tokenless reads of public repositories have stricter page-size and page-count limits than authenticated reads.
2916
+ */
2917
+ head: (orgName: string, repoName: string, opts?: ThingHeadOptions) => Promise<ThingHead>;
2918
+ /**
2919
+ * Iterate every current HEAD row matching the supplied filters.
2920
+ *
2921
+ * Prefer this over hand-written cursor loops when scanning all matching records. Pass `opts.cursor` to resume from a saved cursor; the iterator advances the cursor automatically after the first request. Pass `limit` to control page size.
2922
+ */
2923
+ headIter: (orgName: string, repoName: string, opts?: ThingHeadOptions) => AsyncIterableIterator<ThingItem>;
2924
+ /**
2925
+ * Materialize every current HEAD row matching the supplied filters.
2926
+ *
2927
+ * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` items have actually been observed across pages.
2928
+ */
2929
+ headAll: (orgName: string, repoName: string, opts?: ThingHeadOptions & {
2930
+ max?: number;
2931
+ }) => Promise<ThingItem[]>;
2932
+ /**
2933
+ * Get one thing, assertion, shape, or collection by wref.
2934
+ *
2935
+ * @param version Optional exact version to pin when the wref is not already version-qualified.
2936
+ * @param opts.includeRetracted Include retracted records instead of treating them as missing.
2937
+ */
2938
+ get: (orgName: string, repoName: string, wref: string, version?: number, opts?: ThingGetOptions) => Promise<ThingGet>;
2939
+ /**
2940
+ * Get one record and its embedded assertion, about, and wref graph.
2941
+ *
2942
+ * Depth and limit options bound traversal size. References the caller cannot read remain string wrefs in the returned graph.
2943
+ */
2944
+ graph: (orgName: string, repoName: string, wref: string, opts?: ThingGraphOptions) => Promise<ThingGraphResult>;
2945
+ /**
2946
+ * Batch-fetch wrefs, auto-chunking above the backend's 500-wref transport cap.
2947
+ *
2948
+ * The result preserves duplicate requested wrefs and reports inaccessible or missing refs in `missing` rather than throwing per item. A top-level version pins every unqualified wref; per-wref version pins remain intact.
2949
+ *
2950
+ * @param version Optional exact version to apply to unqualified wrefs.
2951
+ * @param opts.includeRetracted Include retracted records in `items` instead of reporting them in `missing`.
2952
+ * @param opts.chunkSize Maximum wrefs per backend request. Defaults to 500 and is clamped to the backend cap.
2953
+ * @param opts.chunkConcurrency Maximum concurrent chunk requests. Defaults to 1 and is clamped to 8.
2954
+ */
2955
+ getMany: (orgName: string, repoName: string, wrefs: string[], version?: number, opts?: {
2956
+ includeRetracted?: boolean;
2957
+ chunkSize?: number;
2958
+ chunkConcurrency?: number;
2959
+ }) => Promise<ThingGetManyResult>;
2960
+ /**
2961
+ * Return version history and timeline metadata for repository records.
2962
+ *
2963
+ * Provide at least one selector: a concrete wref, a shape filter, or an assertion target. Shape- and target-filtered histories support pagination and optional collection resolution.
2964
+ */
2965
+ history: (orgName: string, repoName: string, opts: ThingHistoryOptions) => Promise<ThingHistory>;
2966
+ /**
2967
+ * Rename a thing within its shape namespace.
2968
+ *
2969
+ * The rename is applied in place: the thing's existing history is preserved and no new version is created.
2970
+ */
2971
+ rename: (orgName: string, repoName: string, shapeName: string, oldName: string, newName: string) => Promise<RenameResult>;
2972
+ /**
2973
+ * Resolve a wref to its current projected record.
2974
+ */
2975
+ resolve: (orgName: string, repoName: string, wref: string) => Promise<ResolveWrefResult>;
2976
+ /**
2977
+ * Return assertions about a thing or collection target.
2978
+ *
2979
+ * Filter by assertion shape or glob `match` pattern, optionally resolve collection targets, and page through large assertion sets with `limit` and `cursor`.
2980
+ *
2981
+ * Returns `{ target?, assertions, nextCursor? }`.
2982
+ * The array is named `assertions`, **not** `items`. This breaks the repo-wide
2983
+ * `items` convention used by `HeadResult`, `FilterResult`, `SearchResult`,
2984
+ * `RefsResult`, and `LogResult`; destructure explicitly to avoid the trap:
2985
+ *
2986
+ * ```ts
2987
+ * const { target, assertions } = await client.thing.about(org, repo, "Location/cave");
2988
+ * for (const a of assertions) console.log(a.wref);
2989
+ * ```
2990
+ *
2991
+ * Any returned subjective-logic opinion tuple `(b, d, u, α)` is a binomial opinion — well-formed only when the underlying assertion expresses a binary proposition. See [Opinions as Separate Assertions](/data-modeling/patterns/#opinions-as-separate-assertions).
2992
+ */
2993
+ about: (orgName: string, repoName: string, wref: string, opts?: AboutOptions) => Promise<AboutResult>;
2994
+ /**
2995
+ * Iterate every assertion about a thing or collection target.
2996
+ *
2997
+ * Prefer this over hand-written cursor loops when scanning all matching assertions. The iterator reads the `assertions` envelope field and advances the cursor automatically; pass `opts.cursor` to resume from a saved cursor and `limit` to control page size.
2998
+ */
2999
+ aboutIter: (orgName: string, repoName: string, wref: string, opts?: AboutOptions) => AsyncIterableIterator<Assertion>;
3000
+ /**
3001
+ * Materialize every assertion about a thing or collection target.
3002
+ *
3003
+ * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` assertions have actually been observed across pages.
3004
+ */
3005
+ aboutAll: (orgName: string, repoName: string, wref: string, opts?: AboutOptions & {
3006
+ max?: number;
3007
+ }) => Promise<Assertion[]>;
3008
+ /**
3009
+ * Query repository records by shape, kind, assertion target, text filters, or glob `match` pattern.
3010
+ *
3011
+ * Use this for structured reads where the caller controls filters. For ranked text or vector search, use `thing.search`. For count-only reads, use `thing.count`.
3012
+ */
3013
+ query: (orgName: string, repoName: string, opts?: FilterOptions) => Promise<FilterResult>;
3014
+ /**
3015
+ * Iterate every repository record matching the supplied filters.
3016
+ *
3017
+ * Prefer this over hand-written cursor loops when scanning all matching records. Pass `opts.cursor` to resume from a saved cursor; the iterator advances the cursor automatically after the first request. Pass `limit` to control page size.
3018
+ */
3019
+ queryIter: (orgName: string, repoName: string, opts?: FilterOptions) => AsyncIterableIterator<ThingItem>;
3020
+ /**
3021
+ * Materialize every repository record matching the supplied filters.
3022
+ *
3023
+ * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` items have actually been observed across pages.
3024
+ */
3025
+ queryAll: (orgName: string, repoName: string, opts?: FilterOptions & {
3026
+ max?: number;
3027
+ }) => Promise<ThingItem[]>;
3028
+ /**
3029
+ * Search repository records with text, vector, or hybrid mode.
3030
+ *
3031
+ * When searching with an assertion target or collection resolution, pages may be sparse; keep paginating until `nextCursor` is absent.
3032
+ */
3033
+ search: (orgName: string, repoName: string, query: string, opts?: SearchOptions) => Promise<SearchResult>;
3034
+ /**
3035
+ * Count matching repository records without returning record data.
3036
+ */
3037
+ count: (orgName: string, repoName: string, opts?: CountOptions) => Promise<CountResult>;
3038
+ /**
3039
+ * Query wref-typed field references for a record.
3040
+ *
3041
+ * Inbound mode finds records whose wref fields point at the supplied wref. Outbound mode finds records that the supplied record points to. Inbound queries can be narrowed to a field path.
3042
+ */
3043
+ refs: (orgName: string, repoName: string, wref: string, opts?: RefsOptions) => Promise<RefsResult>;
3044
+ /**
3045
+ * Iterate every wref-typed field reference for a record.
3046
+ *
3047
+ * Prefer this over hand-written cursor loops when scanning all matching references. Pass `opts.cursor` to resume from a saved cursor; the iterator advances the cursor automatically after the first request. Pass `limit` to control page size.
3048
+ */
3049
+ refsIter: (orgName: string, repoName: string, wref: string, opts?: RefsOptions) => AsyncIterableIterator<RefLink>;
3050
+ /**
3051
+ * Materialize every wref-typed field reference for a record.
3052
+ *
3053
+ * Use `max` to guard memory usage; throws a `WarmHubError` with kind `VALIDATION_ERROR` once more than `max` refs have actually been observed across pages.
3054
+ */
3055
+ refsAll: (orgName: string, repoName: string, wref: string, opts?: RefsOptions & {
3056
+ max?: number;
3057
+ }) => Promise<RefLink[]>;
3058
+ };
3059
+ /**
3060
+ * Live repository update surface backed by server-sent events.
3061
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#live
3062
+ */
3063
+ readonly live: {
3064
+ /**
3065
+ * Stream refreshed `thing.head` results whenever the repository changes.
3066
+ *
3067
+ * The SDK re-runs the underlying `thing.head` query after each invalidation and passes the latest snapshot to `onUpdate`.
3068
+ */
3069
+ thingHead: (orgName: string, repoName: string, opts: LiveThingHeadOptions | undefined, onUpdate: (result: ThingHead) => void | Promise<void>) => Promise<LiveHandle>;
3070
+ /**
3071
+ * Stream refreshed history results for a single wref whenever the repository changes.
3072
+ */
3073
+ thingHistory: (orgName: string, repoName: string, opts: LiveThingHistoryOptions, onUpdate: (result: ThingHistory) => void | Promise<void>) => Promise<LiveHandle>;
3074
+ /**
3075
+ * Stream refreshed action live-feed entries for a subscription.
3076
+ */
3077
+ subscriptionLog: (orgName: string, repoName: string, subscriptionName: string, opts: LiveSubscriptionLogOptions | undefined, onUpdate: (result: ActionLiveFeed) => void | Promise<void>) => Promise<LiveHandle>;
3078
+ /**
3079
+ * Subscribe to raw repository invalidation events.
3080
+ *
3081
+ * Unlike the higher-level live helpers, this method does not re-query. It
3082
+ * forwards invalidation metadata such as affected shapes, affected things,
3083
+ * affected assertion targets, and whether the event corresponds to a new
3084
+ * commit.
3085
+ *
3086
+ * @param opts.signal Optional abort signal used to close the SSE stream.
3087
+ * @param onEvent Callback invoked for each repository invalidation event.
3088
+ */
3089
+ subscribe: (orgName: string, repoName: string, opts: {
3090
+ signal?: AbortSignal;
3091
+ } | undefined, onEvent: (event: LiveRepoEvent) => void | Promise<void>) => Promise<LiveHandle>;
3092
+ };
3093
+ /**
3094
+ * Personal access token management for the authenticated user.
3095
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#token
3096
+ */
3097
+ readonly token: {
3098
+ /**
3099
+ * Create a personal access token for the authenticated user.
3100
+ *
3101
+ * Omit `scopes` to mint a token with the same authority as the calling principal. PATs cannot create or revoke other PATs — token-management permissions are excluded from the grantable set. Server enforces a maximum lifetime; pass an `expiresAt` unix-millis value to clamp earlier.
3102
+ *
3103
+ * See [Personal Access Tokens](/auth/personal-access-tokens/) for scope grammar (resource format, permission strings, `allowedMatches`), rotation, and CI usage.
3104
+ *
3105
+ * @param input.name Caller-chosen identifier for the token, returned in `list`, `get`, and `revoke`.
3106
+ * @param input.scopes Scope entries narrowing the token's authority. Omit for full-principal authority.
3107
+ * @param input.expiresAt Unix epoch milliseconds at which the token expires.
3108
+ * @param input.description Human-readable description shown in token listings.
3109
+ */
3110
+ create: (input: TokenCreateInput) => Promise<TokenResult>;
3111
+ /**
3112
+ * List personal access tokens for the authenticated user.
3113
+ */
3114
+ list: () => Promise<TokenInfo[]>;
3115
+ /**
3116
+ * Get one personal access token by name.
3117
+ */
3118
+ get: (name: string) => Promise<TokenInfo | null>;
3119
+ /**
3120
+ * Revoke a personal access token by name.
3121
+ */
3122
+ revoke: (name: string) => Promise<TokenRevokeResult>;
3123
+ };
3124
+ /**
3125
+ * Low-level stream append surface for callers that already have backend stream operations.
3126
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#stream
3127
+ */
3128
+ readonly stream: {
3129
+ /**
3130
+ * Append one non-empty chunk of stream operations to a repository.
3131
+ *
3132
+ * Most callers should prefer `commit.apply` or `OperationBuilder`. Use this low-level surface only when you already have stream operations, a stream ID, and any allocated `$N` / `#N` token state you need to continue.
3133
+ */
3134
+ append: (input: StreamAppendInput$1) => Promise<StreamAppendResult$1>;
3135
+ };
3136
+ /**
3137
+ * Credential set management for subscription webhook authentication and component integrations.
3138
+ *
3139
+ * Sets are scoped at creation time. Repo-scoped sets are visible only to the owning repo; org-scoped sets can be granted to multiple repositories in the same organization. Methods that operate on a specific set accept `repoName: string | undefined` — pass the owning repo name for repo-scoped sets or `undefined` for org-scoped sets.
3140
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#credential
3141
+ */
3142
+ readonly credential: {
3143
+ /**
3144
+ * Create a credential set.
3145
+ *
3146
+ * Credential sets are repo-scoped by default. Org-scoped sets can be granted to multiple repositories in the same organization.
3147
+ */
3148
+ createSet: (orgName: string, repoName: string | undefined, name: string, opts?: {
3149
+ scope?: "org" | "repo";
3150
+ description?: string;
3151
+ }) => Promise<CredentialInfo>;
3152
+ /**
3153
+ * List credential sets visible from a repository.
3154
+ */
3155
+ listSets: (orgName: string, repoName?: string) => Promise<CredentialInfo[]>;
3156
+ /**
3157
+ * Get credential set metadata without secret values.
3158
+ */
3159
+ getSet: (orgName: string, repoName: string | undefined, name: string) => Promise<CredentialInfo>;
3160
+ /**
3161
+ * Set or replace one secret key in a credential set.
3162
+ */
3163
+ setKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string, value: string) => Promise<CredentialKeyMutationResult>;
3164
+ /**
3165
+ * Set or replace multiple secret keys in one request.
3166
+ */
3167
+ setKeys: (orgName: string, repoName: string | undefined, setName: string, secrets: Record<string, string>) => Promise<CredentialKeyMutationResult>;
3168
+ /**
3169
+ * Remove one secret key from a credential set.
3170
+ */
3171
+ unsetKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string) => Promise<CredentialKeyMutationResult>;
3172
+ /**
3173
+ * Delete a credential set and its stored secrets.
3174
+ */
3175
+ deleteSet: (orgName: string, repoName: string | undefined, setName: string) => Promise<CredentialDeleteResult>;
3176
+ /**
3177
+ * List audit entries for a credential set.
3178
+ */
3179
+ listAuditLog: (orgName: string, repoName: string | undefined, setName: string, opts?: {
3180
+ limit?: number;
3181
+ }) => Promise<CredentialAuditEntry[]>;
3182
+ /**
3183
+ * Revoke a credential set so it can no longer be exported or bound.
3184
+ */
3185
+ revokeSet: (orgName: string, repoName: string | undefined, setName: string, opts?: {
3186
+ reason?: string;
3187
+ }) => Promise<CredentialRevokeResult>;
3188
+ };
3189
+ /**
3190
+ * Alias for `credential`.
3191
+ *
3192
+ * @hidden
3193
+ */
3194
+ readonly credentials: {
3195
+ /**
3196
+ * Create a credential set.
3197
+ *
3198
+ * Credential sets are repo-scoped by default. Org-scoped sets can be granted to multiple repositories in the same organization.
3199
+ */
3200
+ createSet: (orgName: string, repoName: string | undefined, name: string, opts?: {
3201
+ scope?: "org" | "repo";
3202
+ description?: string;
3203
+ }) => Promise<CredentialInfo>;
3204
+ /**
3205
+ * List credential sets visible from a repository.
3206
+ */
3207
+ listSets: (orgName: string, repoName?: string) => Promise<CredentialInfo[]>;
3208
+ /**
3209
+ * Get credential set metadata without secret values.
3210
+ */
3211
+ getSet: (orgName: string, repoName: string | undefined, name: string) => Promise<CredentialInfo>;
3212
+ /**
3213
+ * Set or replace one secret key in a credential set.
3214
+ */
3215
+ setKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string, value: string) => Promise<CredentialKeyMutationResult>;
3216
+ /**
3217
+ * Set or replace multiple secret keys in one request.
3218
+ */
3219
+ setKeys: (orgName: string, repoName: string | undefined, setName: string, secrets: Record<string, string>) => Promise<CredentialKeyMutationResult>;
3220
+ /**
3221
+ * Remove one secret key from a credential set.
3222
+ */
3223
+ unsetKey: (orgName: string, repoName: string | undefined, setName: string, keyName: string) => Promise<CredentialKeyMutationResult>;
3224
+ /**
3225
+ * Delete a credential set and its stored secrets.
3226
+ */
3227
+ deleteSet: (orgName: string, repoName: string | undefined, setName: string) => Promise<CredentialDeleteResult>;
3228
+ /**
3229
+ * List audit entries for a credential set.
3230
+ */
3231
+ listAuditLog: (orgName: string, repoName: string | undefined, setName: string, opts?: {
3232
+ limit?: number;
3233
+ }) => Promise<CredentialAuditEntry[]>;
3234
+ /**
3235
+ * Revoke a credential set so it can no longer be exported or bound.
3236
+ */
3237
+ revokeSet: (orgName: string, repoName: string | undefined, setName: string, opts?: {
3238
+ reason?: string;
3239
+ }) => Promise<CredentialRevokeResult>;
3240
+ };
3241
+ /**
3242
+ * Create a WarmHub client.
3243
+ *
3244
+ * Pass either an options object or the legacy `(apiUrl, options)` form. The
3245
+ * options object form is preferred for new code.
3246
+ */
3247
+ constructor(apiUrl?: string, options?: WarmHubClientOptions);
3248
+ constructor(options?: WarmHubClientOptions);
3249
+ /**
3250
+ * Return a new client that shares this client's backend URL and fetch implementation but uses a different access-token provider.
3251
+ * @see https://docs.warmhub.ai/sdk-reference/classes/warmhubclient/#withaccesstoken
3252
+ */
3253
+ withAccessToken(accessToken: AccessTokenProvider): WarmHubClient;
3254
+ /**
3255
+ * Alias for `action`.
3256
+ *
3257
+ * @hidden
3258
+ */
3259
+ readonly actions: {
3260
+ /**
3261
+ * Acquire an exclusive processing lease for a subscription consumer.
3262
+ *
3263
+ * @param holderId Stable identifier for the process claiming the lease.
3264
+ * @param holderType Kind of consumer claiming the lease.
3265
+ */
3266
+ acquireLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, holderType: "sdk" | "cli", opts?: {
3267
+ graceMs?: number;
3268
+ ttlMs?: number;
3269
+ }) => Promise<ActionLeaseAcquire>;
3270
+ /**
3271
+ * Extend the TTL for an existing processing lease.
3272
+ */
3273
+ heartbeatLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string, ttlMs?: number) => Promise<ActionLeaseOp>;
3274
+ /**
3275
+ * Release an existing processing lease.
3276
+ */
3277
+ releaseLease: (orgName: string, repoName: string, subscriptionName: string, holderId: string) => Promise<ActionLeaseOp>;
3278
+ /**
3279
+ * Claim one action delivery run for processing.
3280
+ */
3281
+ claimDelivery: (orgName: string, repoName: string, runId: string, holderId: string) => Promise<ActionLeaseOp>;
3282
+ /**
3283
+ * Mark one claimed action delivery run as complete.
3284
+ */
3285
+ completeDelivery: (orgName: string, repoName: string, runId: string, holderId: string) => Promise<ActionLeaseOp>;
3286
+ /**
3287
+ * Query the live delivery feed for a subscription.
3288
+ *
3289
+ * Use this for polling or live-log views that need recent delivery status entries.
3290
+ */
3291
+ liveFeed: (orgName: string, repoName: string, subscriptionName: string, opts?: ActionLiveFeedOptions) => Promise<ActionLiveFeed>;
3292
+ /**
3293
+ * List subscription action runs for a repository.
3294
+ *
3295
+ * The result can be filtered by subscription name, status, and start time.
3296
+ */
3297
+ listRuns: (orgName: string, repoName: string, opts?: ActionListRunsOptions) => Promise<ActionRunInfo[]>;
3298
+ /**
3299
+ * List delivery attempts for one action run.
3300
+ */
3301
+ getRunAttempts: (orgName: string, repoName: string, runId: string) => Promise<ActionAttemptInfo[]>;
3302
+ /**
3303
+ * List repo-scoped action notifications.
3304
+ *
3305
+ * Use `since` or `limit` to bound notification-center style reads.
3306
+ */
3307
+ listNotifications: (orgName: string, repoName: string, opts?: ActionListNotificationsOptions) => Promise<ActionNotificationInfo[]>;
3308
+ };
3309
+ private openSse;
3310
+ private fetchWithAuth;
3311
+ private requestResponse;
3312
+ private requestJson;
3313
+ private watchRepoQuery;
3314
+ }
3315
+
3316
+ export { type AboutOptions, type AboutResult, type AccessTokenProvider, type ActionAttemptInfo, type ActionLeaseAcquire, type ActionLeaseOp, type ActionListNotificationsOptions, type ActionListRunsOptions, type ActionLiveFeed, type ActionLiveFeedOptions, type ActionNotificationInfo, type ActionRunInfo, type AddOp, type AddOperation, type Assertion, CONTENT_FIELD_LIMIT_ERROR, type CollectionAbout, type CollectionTag, type ComponentInfo, type ComponentInstallSystemResult, type ComponentList, type ComponentListOptions, type ComponentView, type CoreErrorKind, type CountOptions, type CountResult, type CredentialAuditEntry, type CredentialDeleteResult, type CredentialGrantResult, type CredentialInfo, type CredentialKeyMutationResult, type CredentialRevokeResult, type CredentialUngrantResult, type CurrentUserInfo, DEFAULT_API_URL, DEFAULT_STREAM_CHUNK_SIZE, type ErrorKind, type FilterOptions, type FilterResult, type FunctionLogMode, type HeadResult, type HistoryResult, type LiveHandle, type LiveRepoEvent, type LiveSubscriptionLogOptions, type LiveThingHeadOptions, type LiveThingHistoryOptions, type LiveWatchResult, MAX_CONTENT_FIELD_BYTES, MAX_STREAM_APPEND_OPERATION_COUNT, type Operation, OperationBuilder, type OperationBuilderClient, type OperationBuilderOp, type OperationBuilderOptions, type OperationSubmitResult, type OrgInfo, type OrgList, type OrgListMembersOptions, type OrgListOptions, type OrgMemberInfo, type OrgMemberList, type OrgRef, type OrgRole, type Page, type PageRequest, PartialStreamSubmissionError, type PingResult, type RefLink, type RefsOptions, type RefsResult, type RenameResult, type RepoConfigureStatsView, type RepoDescribeResult, type RepoInfo, type RepoList, type RepoListOptions, type RepoListPageOptions, type RepoListPageResult, type RepoLocator, type RepoRef, type RepoShapeInstanceCountsView, type RepoSort, type RepoStatsBatchResult, type RepoStatsView, type RepoWithStatsInfo, type RequestEvent, type ResolveWrefResult, type RetractOp, type RetractOperation, type RetryPolicyOptions, type ReviseOp, type ReviseOperation, SDK_VERSION, type SearchOptions, type SearchResult, type Shape, type ShapeChange, type ShapeCreateOptions, type ShapeFields, type ShapeGetOptions, type ShapeHistory, type ShapeHistoryOptions, type ShapeList, type ShapeListOptions, type ShapeRef, type ShapeRemove, type ShapeReviseOptions, type ShapeValidatorResult, type StreamAppendInput, type StreamAppendResult, type StreamContinuationState, type SubscriptionBindCredentialsResult, type SubscriptionCompatCreateInput, type SubscriptionCompatUpdateInput, type SubscriptionInfo, type SubscriptionList, type SubscriptionUnbindCredentialsResult, type SynthesizedRepoContent, type ThingDetail, type ThingGet, type ThingGetManyResult, type ThingGetOptions, type ThingGraphOptions, type ThingGraphResult, type ThingGraphValue, type ThingHead, type ThingHeadOptions, type ThingHeadRequest, type ThingHistory, type ThingHistoryOptions, type ThingItem, type TokenInfo, type TokenResult, type UndeclaredFieldsWarning, type ValidationDiagnostic, type ValidationResult, WarmHubClient, type WarmHubClientOptions, WarmHubError, type WhoamiInfo, type WhoamiScopeEntry, type WireScopeEntry, connectionErrorMessage, contentFieldLimitError, isConnectionError, isRetryable, isWarmHubError, normalizeWref, resolveFunctionLogMode, sanitizeErrorMessage, submitOperationsViaStream, toWarmHubError, validateAgainstShape };