@tangle-network/hub-sdk 1.0.4 → 1.0.5

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,2571 @@
1
+ //#region src/allowances.d.ts
2
+ /**
3
+ * Allowances: a developer's per-member daily allowance on a meter, and the
4
+ * paywall decision past it. The platform counts every admitted turn and reads
5
+ * each payer's dollars from the ledger; the app keeps only its checkout and
6
+ * records a paying member with {@link HubAllowancesClient.grant}.
7
+ *
8
+ * Only the meter's owner may call these, signed in or with a root API key of
9
+ * their own. A delegated or resource-bound key, such as the key a hosted end
10
+ * user's sandbox runs on, is refused.
11
+ */
12
+ type HubAllowanceTier = "free" | "paid" | "owner";
13
+ type HubAllowanceRole = "owner" | "member";
14
+ interface HubAllowancePlanInput {
15
+ free: {
16
+ turnsPerDay: number;
17
+ usdPerDay: number | null;
18
+ };
19
+ /** Null turns billing off: past the free allowance nothing lifts the limit. */
20
+ paid: {
21
+ turnsPerDay: number;
22
+ usdPerDay: number | null;
23
+ priceUsdMonthly: number;
24
+ } | null;
25
+ owner?: {
26
+ turnsPerDay: number;
27
+ };
28
+ /** Key resource type whose ledger spend counts against a payer's dollars. */
29
+ spendResourceType: string | null;
30
+ }
31
+ interface HubAllowancePlan extends HubAllowancePlanInput {
32
+ meter: string;
33
+ owner: {
34
+ turnsPerDay: number;
35
+ };
36
+ /** False while the meter runs on the default plan. */
37
+ configured: boolean;
38
+ updatedAt: string | null;
39
+ }
40
+ interface HubAllowanceSubject {
41
+ member: string;
42
+ role?: HubAllowanceRole;
43
+ /** The member whose keys pay for the turn, when that is someone else. */
44
+ payer?: string;
45
+ payerRole?: HubAllowanceRole;
46
+ }
47
+ interface HubAllowanceDecision {
48
+ /** `paywall`: paying lifts the limit. `allowance_reached`: nothing does today. */
49
+ decision: "admit" | "paywall" | "allowance_reached";
50
+ tier: HubAllowanceTier;
51
+ paywall: boolean;
52
+ turns: {
53
+ used: number;
54
+ limit: number;
55
+ };
56
+ usd: {
57
+ spent: number;
58
+ limit: number;
59
+ remaining: number;
60
+ } | null;
61
+ day: string;
62
+ resetsAt: string;
63
+ /**
64
+ * A paying payer's spend in the current paid period against what funds it:
65
+ * the plan price less Tangle's 10% fee, plus the free daily allowance for
66
+ * the period. A paid turn is refused once `remaining` is gone.
67
+ */
68
+ period?: {
69
+ spent: number;
70
+ funded: number;
71
+ remaining: number;
72
+ startsAt: string;
73
+ endsAt: string;
74
+ };
75
+ replay?: boolean;
76
+ }
77
+ interface HubAllowanceUsage {
78
+ day: string;
79
+ turns: number;
80
+ members: Array<{
81
+ member: string;
82
+ turns: number;
83
+ tier: HubAllowanceTier;
84
+ usdSpent: number | null;
85
+ }>;
86
+ lines: Array<{
87
+ line: string;
88
+ turns: number;
89
+ }>;
90
+ }
91
+ interface HubAllowanceSyncInput {
92
+ source: string;
93
+ revision: number;
94
+ expiresAt: string | null;
95
+ reference: string | null;
96
+ }
97
+ interface HubAllowanceSyncReceipt extends HubAllowanceSyncInput {
98
+ member: string;
99
+ }
100
+ interface HubAllowanceGrant {
101
+ member: string;
102
+ tier: "paid";
103
+ expiresAt: string;
104
+ reference: string | null;
105
+ }
106
+ declare class HubAllowancesClient {
107
+ private readonly request;
108
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
109
+ plan(meter: string): Promise<HubAllowancePlan>;
110
+ setPlan(meter: string, plan: HubAllowancePlanInput): Promise<HubAllowancePlan>;
111
+ /** Admit one turn or refuse it. Retrying the same `turnId` never counts twice. */
112
+ admit(meter: string, input: HubAllowanceSubject & {
113
+ turnId: string;
114
+ line?: string;
115
+ channel?: string;
116
+ }): Promise<HubAllowanceDecision>;
117
+ /** What the member's next turn would get, without counting anything. */
118
+ status(meter: string, subject: HubAllowanceSubject): Promise<HubAllowanceDecision>;
119
+ /** Move a member to the paid allowance until `expiresAt` (the paid period's end). */
120
+ grant(meter: string, member: string, input: {
121
+ expiresAt: string;
122
+ reference?: string | null;
123
+ }): Promise<HubAllowanceGrant>;
124
+ /** Synchronize a paid grant by durable product revision. Null expiry writes
125
+ * a retained revocation. A delayed older update is refused, never reactivated.
126
+ * There is no fallback to the unversioned grant endpoint on older servers. */
127
+ syncGrant(meter: string, member: string, input: HubAllowanceSyncInput): Promise<HubAllowanceSyncReceipt>;
128
+ revoke(meter: string, member: string): Promise<void>;
129
+ /** Turns per member and per line on one UTC day (default today). */
130
+ usage(meter: string, day?: string): Promise<HubAllowanceUsage>;
131
+ private path;
132
+ private memberPath;
133
+ private body;
134
+ }
135
+ //#endregion
136
+ //#region src/apps.d.ts
137
+ /** The compliance claim an owner latches through a BAA acceptance. Positive
138
+ * claims only: `{ hipaa: true }` or absent — `hipaa: false` is unspellable. */
139
+ interface HubAppComplianceClaim {
140
+ hipaa: true;
141
+ }
142
+ /** Owner-facing compliance state: the latched claim and the acceptance behind it. */
143
+ interface HubAppComplianceState {
144
+ compliance: HubAppComplianceClaim | null;
145
+ agreement: {
146
+ version: string;
147
+ url: string;
148
+ } | null;
149
+ acceptance: {
150
+ agreementVersion: string;
151
+ agreementUrl: string;
152
+ acceptedByUserId: string;
153
+ acceptedAt: string;
154
+ } | null;
155
+ }
156
+ /** App identity and customer permissions over the existing Platform transport.
157
+ * These operations do not authorize spending or expose upstream credentials. */
158
+ interface HubApp {
159
+ id: string;
160
+ clientId: string;
161
+ oauthClientId: string | null;
162
+ name: string;
163
+ redirectUris: string[];
164
+ allowedScopes: string[];
165
+ homepageUrl: string | null;
166
+ accessPayer?: "user" | "app-owner";
167
+ /** Latched HIPAA declaration; absent or null means "no claim". */
168
+ compliance?: HubAppComplianceClaim | null;
169
+ status: "active" | "revoked";
170
+ createdAt: string;
171
+ updatedAt: string;
172
+ }
173
+ interface HubAppCreateInput {
174
+ name: string;
175
+ redirectUris: string[];
176
+ allowedScopes: string[];
177
+ homepageUrl?: string;
178
+ /** The registered app owner funds eligibility; customer permissions remain separate. */
179
+ accessPayer?: "user" | "app-owner";
180
+ /** Associate an existing owned login client in the same transaction as creation. */
181
+ oauthClientId?: string;
182
+ }
183
+ interface HubAppGrant {
184
+ id: string;
185
+ appId: string;
186
+ userId: string;
187
+ connectionId: string;
188
+ scopes: string[];
189
+ status: "active" | "revoked";
190
+ createdAt: string;
191
+ updatedAt: string;
192
+ revokedAt: string | null;
193
+ /** Display metadata is additive; older deployments may omit it. */
194
+ appName?: string | null;
195
+ oauthClientId?: string | null;
196
+ providerId?: string | null;
197
+ accountDisplay?: string | null;
198
+ connectionDisplayName?: string | null;
199
+ }
200
+ interface HubAppGrantRevoked {
201
+ grantId: string;
202
+ status: "revoked";
203
+ revokedAt: string | null;
204
+ tokensRevoked: number;
205
+ }
206
+ declare class HubAppsClient {
207
+ private readonly request;
208
+ readonly grants: {
209
+ list: () => Promise<HubAppGrant[]>;
210
+ revoke: (grantId: string) => Promise<HubAppGrantRevoked>;
211
+ };
212
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
213
+ list(): Promise<HubApp[]>;
214
+ /** The secret is returned only by creation; keep it in your server vault. */
215
+ create(input: HubAppCreateInput): Promise<{
216
+ app: HubApp;
217
+ clientSecret: string;
218
+ }>;
219
+ /** Immutable association of two existing records with the same owner. */
220
+ linkOAuthClient(appId: string, clientId: string): Promise<{
221
+ appId: string;
222
+ oauthClientId: string;
223
+ }>;
224
+ revoke(appId: string): Promise<{
225
+ appId: string;
226
+ grantsRevoked: number;
227
+ tokensRevoked: number;
228
+ }>;
229
+ /** Current latched compliance state and the BAA acceptance behind it. */
230
+ getCompliance(appId: string): Promise<HubAppComplianceState>;
231
+ /**
232
+ * Latch HIPAA compliance for this app. The request MUST carry the exact
233
+ * `agreementVersion` the deployment currently offers — the acceptance is
234
+ * recorded before the claim exists, and the claim can never be cleared:
235
+ * `hipaa: false` on a latched app is a 409, on an unlatched app a no-op.
236
+ */
237
+ setCompliance(appId: string, input: {
238
+ hipaa: boolean;
239
+ agreementVersion?: string;
240
+ }): Promise<HubAppComplianceState>;
241
+ }
242
+ //#endregion
243
+ //#region src/tool-types.d.ts
244
+ interface HubToolSource {
245
+ sourceId: string;
246
+ providerId: string;
247
+ displayName: string;
248
+ toolCount: number;
249
+ connectionStatus: "connected" | "missing" | "unknown";
250
+ health: "healthy" | "unhealthy" | "rate_limited" | "unknown";
251
+ configured: boolean;
252
+ }
253
+ /** Per-tool catalog risk class. The first three mirror the platform's
254
+ * `HubActionRisk`; `unknown` is surfaced honestly for tools the catalog can't
255
+ * classify (substrate connectors). */
256
+ type HubToolRisk = "read" | "write" | "destructive" | "unknown";
257
+ interface HubTool {
258
+ path: string;
259
+ providerId?: string;
260
+ title?: string;
261
+ description?: string;
262
+ inputSchema?: unknown;
263
+ outputSchema?: unknown;
264
+ connectionRequired?: boolean;
265
+ connectionStatus?: "connected" | "missing" | "unknown";
266
+ requiredConnectionProviderId?: string;
267
+ policyState?: "allow" | "ask" | "deny" | "unknown";
268
+ risk?: HubToolRisk;
269
+ }
270
+ interface HubToolSourcesResponse {
271
+ sources: HubToolSource[];
272
+ }
273
+ interface HubToolsSearchResponse {
274
+ tools: HubTool[];
275
+ }
276
+ interface HubToolsDescribeResponse {
277
+ tool: HubTool;
278
+ }
279
+ interface HubExecResponse<TResult = unknown> {
280
+ result: TResult;
281
+ /** True when the result was replayed from a previous call with the same
282
+ * idempotency key, so the action did not run again. */
283
+ replayed?: boolean;
284
+ }
285
+ //#endregion
286
+ //#region src/knowledge-management.d.ts
287
+ interface KnowledgeReference {
288
+ sourceId: string;
289
+ generation: string;
290
+ }
291
+ /** Connection references only. Provider credentials never enter this contract. */
292
+ interface KnowledgeEmbeddingSpace {
293
+ connectionId: string;
294
+ model: string;
295
+ dimensions: number;
296
+ }
297
+ type KnowledgeSourceInput = {
298
+ kind: "file";
299
+ name: string;
300
+ base64: string;
301
+ mediaType: string;
302
+ } | {
303
+ kind: "git";
304
+ connectionId: string;
305
+ owner: string;
306
+ repo: string;
307
+ ref: string;
308
+ pathPrefix?: string;
309
+ } | {
310
+ kind: "url";
311
+ url: string;
312
+ } | {
313
+ kind: "s3";
314
+ connectionId: string;
315
+ bucket: string;
316
+ prefix: string;
317
+ } | {
318
+ kind: "vector";
319
+ connectionId: string;
320
+ provider: "pinecone" | "qdrant" | "weaviate";
321
+ indexName: string;
322
+ namespace?: string;
323
+ embedding: KnowledgeEmbeddingSpace;
324
+ textField: string;
325
+ sourceUriField: string;
326
+ };
327
+ interface KnowledgeCapability {
328
+ supported: boolean;
329
+ reason?: string;
330
+ }
331
+ interface KnowledgeCapabilities {
332
+ delegation?: KnowledgeCapability & {
333
+ resource?: string;
334
+ scopes?: string[];
335
+ };
336
+ sources: Record<KnowledgeSourceInput["kind"], KnowledgeCapability>;
337
+ vectorProviders: Record<"pinecone" | "qdrant" | "weaviate", KnowledgeCapability>;
338
+ managedVector: KnowledgeCapability;
339
+ file: {
340
+ mediaTypes: string[];
341
+ maxBytes: number;
342
+ maxObjects: number;
343
+ };
344
+ }
345
+ interface KnowledgeSourceSummary {
346
+ /** Required query authorization, not proof that an owner policy currently permits it. */
347
+ retrieval?: {
348
+ kind: "lexical";
349
+ } | {
350
+ kind: "vector";
351
+ embeddingPolicy: {
352
+ connectionId: string;
353
+ actionPath: "openai.embeddings.create";
354
+ scope: "owner-connection-action";
355
+ };
356
+ };
357
+ id: string;
358
+ name: string;
359
+ kind: KnowledgeSourceInput["kind"];
360
+ status: "ready" | "refreshing" | "failed" | "awaiting-approval";
361
+ approval?: {
362
+ id: string;
363
+ path: string;
364
+ preview: {
365
+ provider: string;
366
+ connectionId: string;
367
+ collection: string;
368
+ sourceId: string;
369
+ requestId: string;
370
+ embedding: KnowledgeEmbeddingSpace;
371
+ chunkCount: number;
372
+ sourceCount: number;
373
+ dataSharing: string;
374
+ };
375
+ };
376
+ refreshRequestId?: string;
377
+ generation: string | null;
378
+ lastError: {
379
+ code: string;
380
+ message: string;
381
+ } | null;
382
+ updatedAt: string;
383
+ }
384
+ type KnowledgeAttachmentAuthorization = {
385
+ status: "active";
386
+ } | {
387
+ status: "unavailable";
388
+ code: "APP_CONSENT_REVOKED" | "KEY_REVOKED" | "CONNECTION_UNAVAILABLE" | "ATTACHMENT_REVOKED" | "GENERATION_UNAVAILABLE" | "RUNTIME_AUTHORITY_REVOKED";
389
+ };
390
+ interface KnowledgeAttachment {
391
+ /** Snapshot of live grant/key/connection authority, separate from durable pin state. */
392
+ authorization?: KnowledgeAttachmentAuthorization;
393
+ id: string;
394
+ sourceId: string;
395
+ sandboxId: string;
396
+ generation: string;
397
+ status: "active" | "detached";
398
+ }
399
+ interface KnowledgeSourceCreate {
400
+ requestId: string;
401
+ name: string;
402
+ source: KnowledgeSourceInput;
403
+ target?: {
404
+ kind: "lexical";
405
+ } | {
406
+ kind: "managed-vector";
407
+ provider: "qdrant";
408
+ connectionId: string;
409
+ embedding: KnowledgeEmbeddingSpace;
410
+ };
411
+ }
412
+ /** Owner-only management. Runtime tools use HubKnowledgeClient.query instead. */
413
+ interface KnowledgeAuthorization {
414
+ userId: string;
415
+ clientId: string;
416
+ resource: string;
417
+ scopes: Array<"knowledge:read" | "knowledge:write">;
418
+ }
419
+ declare class HubKnowledgeManagementClient {
420
+ private readonly request;
421
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
422
+ materialize(input: {
423
+ sandboxId: string;
424
+ references: KnowledgeReference[];
425
+ }): Promise<KnowledgeAttachment[]>;
426
+ authorization(): Promise<KnowledgeAuthorization>;
427
+ disconnectAuthorization(): Promise<{
428
+ revoked: true;
429
+ }>;
430
+ capabilities(): Promise<KnowledgeCapabilities>;
431
+ list(): Promise<KnowledgeSourceSummary[]>;
432
+ get(sourceId: string): Promise<KnowledgeSourceSummary>;
433
+ create(input: KnowledgeSourceCreate): Promise<KnowledgeSourceSummary>;
434
+ refresh(sourceId: string, input: {
435
+ requestId: string;
436
+ approvalToken?: string;
437
+ }): Promise<KnowledgeSourceSummary>;
438
+ attach(sourceId: string, input: {
439
+ sandboxId: string;
440
+ generation: string;
441
+ expectedGeneration?: string;
442
+ }): Promise<KnowledgeAttachment>;
443
+ attachments(sandboxId?: string): Promise<KnowledgeAttachment[]>;
444
+ detach(attachmentId: string): Promise<KnowledgeAttachment>;
445
+ }
446
+ //#endregion
447
+ //#region src/knowledge.d.ts
448
+ interface HubKnowledgeRetrievalResult {
449
+ attachmentId: string;
450
+ generation: string;
451
+ provenance: "ingested" | "record-supplied";
452
+ hits: Array<{
453
+ id: string;
454
+ title: string;
455
+ snippet: string;
456
+ score?: number;
457
+ citations?: Array<{
458
+ sourceId: string;
459
+ sourceUri: string;
460
+ revision?: string;
461
+ }>;
462
+ }>;
463
+ elapsedMs?: number;
464
+ }
465
+ interface HubKnowledgeQueryResult {
466
+ results: HubKnowledgeRetrievalResult[];
467
+ /** Individual unavailable sources do not hide evidence from healthy sources. */
468
+ failures: Array<{
469
+ attachmentId: string;
470
+ code: string;
471
+ message: string;
472
+ }>;
473
+ partial: boolean;
474
+ }
475
+ /** Runtime-only retrieval. The authenticated sandbox credential determines the
476
+ * scope on the server; neither a caller nor an agent can supply another scope. */
477
+ declare class HubKnowledgeClient {
478
+ private readonly request;
479
+ readonly management: HubKnowledgeManagementClient;
480
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
481
+ bindings(): Promise<{
482
+ references: KnowledgeReference[];
483
+ }>;
484
+ query(input: {
485
+ query: string;
486
+ limit?: number;
487
+ expectedReferences?: KnowledgeReference[];
488
+ }, options?: {
489
+ signal?: AbortSignal;
490
+ }): Promise<HubKnowledgeQueryResult>;
491
+ }
492
+ //#endregion
493
+ //#region src/audit-types.d.ts
494
+ interface HubAuditEvent {
495
+ id: string;
496
+ action: string;
497
+ targetUserId: string | null;
498
+ targetKeyId: string | null;
499
+ metadata: unknown;
500
+ createdAt: string;
501
+ }
502
+ interface HubAuditListRequest {
503
+ provider?: string;
504
+ action?: string;
505
+ status?: string;
506
+ since?: string;
507
+ until?: string;
508
+ cursor?: string;
509
+ limit?: number;
510
+ }
511
+ interface HubAuditResponse {
512
+ events: HubAuditEvent[];
513
+ nextCursor: string | null;
514
+ }
515
+ //#endregion
516
+ //#region src/transport-types.d.ts
517
+ type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
518
+ interface HubSuccessEnvelope<TData> {
519
+ success: true;
520
+ data: TData;
521
+ }
522
+ interface HubErrorEnvelope {
523
+ success: false;
524
+ error: HubErrorBody;
525
+ }
526
+ interface HubErrorBody {
527
+ code: HubErrorCode;
528
+ message: string;
529
+ details?: unknown;
530
+ }
531
+ type HubErrorCode = "HUB_UNAUTHENTICATED" | "HUB_FORBIDDEN" | "HUB_INVALID_INPUT" | "HUB_INVALID_STATE" | "HUB_PROVIDER_MISSING" | "HUB_CONNECTION_MISSING" | "HUB_CONNECTION_REVOKED" | "HUB_TOKEN_EXPIRED" | "HUB_TOKEN_REPLAYED" | "HUB_TOKEN_REVOKED" | "HUB_TOKEN_ACTION_MISMATCH" | "HUB_POLICY_DENIED" | "HUB_APPROVAL_REQUIRED" | "HUB_EXECUTOR_FAILURE" | "HUB_PROVIDER_FAILURE" | "HUB_PROVIDER_REJECTED" | "HUB_CONFIG_MISSING" | "HUB_CONFIG_INVALID" | "HUB_NOT_FOUND" | "HUB_NOT_IMPLEMENTED" | "HUB_CONFLICT" | "HUB_IDEMPOTENCY_CONFLICT" | "HUB_IDEMPOTENCY_IN_FLIGHT" | "VALIDATION_ERROR" | "WORKFLOW_INVALID" | "NOT_FOUND" | "UNAUTHORIZED" | "CONFLICT" | "MISSING_RUN_INPUTS" | "WORKFLOW_DISABLED" | "PAYLOAD_TOO_LARGE" | "WORKFLOW_RUN_TIMEOUT" | "SERVICE_DRAINING" | "WORKFLOW_STREAM_INTERRUPTED" | `HUB_HTTP_${number}`;
532
+ interface HubStatusResponse {
533
+ contract: unknown;
534
+ principal: HubPrincipal;
535
+ connections: HubStatusConnections;
536
+ }
537
+ interface HubPrincipal {
538
+ kind: HubPrincipalKind;
539
+ userId: string;
540
+ apiKeyId?: string;
541
+ sandboxId?: string;
542
+ requestId?: string;
543
+ }
544
+ interface HubStatusConnections {
545
+ connectedProviderCount: number;
546
+ unhealthyProviderCount: number;
547
+ }
548
+ //#endregion
549
+ //#region src/authorization-types.d.ts
550
+ interface HubTokenMintResponse {
551
+ token: string;
552
+ tokenId: string;
553
+ expiresAt: string;
554
+ }
555
+ interface HubCapabilityToken {
556
+ id: string;
557
+ providerId: string;
558
+ connectionId: string;
559
+ connectionDisplay: string | null;
560
+ actionPath: string;
561
+ expiresAt: string;
562
+ status: "active" | "consumed" | "expired" | "revoked";
563
+ principalKind: HubPrincipalKind;
564
+ createdAt: string;
565
+ }
566
+ interface HubTokensListResponse {
567
+ tokens: HubCapabilityToken[];
568
+ }
569
+ interface HubTokenRevokeResponse {
570
+ tokenId: string;
571
+ status: HubCapabilityToken["status"];
572
+ }
573
+ type HubPolicyDecision = "allow" | "ask" | "deny";
574
+ interface HubPolicyUpdateRequest {
575
+ connectionId: string;
576
+ actionPath: string;
577
+ decision: HubPolicyDecision;
578
+ }
579
+ interface HubPolicyDeleteRequest {
580
+ connectionId: string;
581
+ actionPath: string;
582
+ }
583
+ interface HubPolicyDeleteResponse {
584
+ connectionId: string;
585
+ actionPath: string;
586
+ /** Whether a stored override existed and was removed (false = already default). */
587
+ deleted: boolean;
588
+ }
589
+ interface HubPolicy {
590
+ id: string;
591
+ connectionId: string;
592
+ providerId: string;
593
+ actionPath: string;
594
+ decision: HubPolicyDecision;
595
+ createdAt: string;
596
+ updatedAt: string;
597
+ }
598
+ interface HubPolicyResponse {
599
+ policy: HubPolicy;
600
+ }
601
+ interface HubPolicyListResponse {
602
+ policies: HubPolicy[];
603
+ }
604
+ interface HubAllowWritesResponse {
605
+ connectionId: string;
606
+ providerId: string;
607
+ /** Write actions the connection's provider exposes. */
608
+ writeActions: number;
609
+ /** Rows newly created (excludes actions that already had a policy). */
610
+ granted: number;
611
+ actionPaths: string[];
612
+ }
613
+ interface HubRevertWritesResponse {
614
+ connectionId: string;
615
+ /** `allow_writes` rows deleted. */
616
+ reverted: number;
617
+ }
618
+ type HubApprovalStatus = "pending" | "approved" | "denied" | "expired" | "consumed";
619
+ interface HubApproval {
620
+ id: string;
621
+ connectionId: string;
622
+ providerId: string;
623
+ actionPath: string;
624
+ inputHash: string;
625
+ requesterPrincipal: Record<string, unknown>;
626
+ status: HubApprovalStatus;
627
+ requestedAt: string;
628
+ expiresAt: string;
629
+ resolvedAt: string | null;
630
+ }
631
+ interface HubApprovalCapabilityToken {
632
+ tokenId: string;
633
+ token: string;
634
+ expiresAt: string;
635
+ }
636
+ interface HubApprovalDecisionResponse {
637
+ approval: HubApproval;
638
+ capabilityToken?: HubApprovalCapabilityToken;
639
+ }
640
+ interface HubApprovalListResponse {
641
+ approvals: HubApproval[];
642
+ }
643
+ //#endregion
644
+ //#region src/channel-types.d.ts
645
+ interface HubEmailChannel {
646
+ id: string;
647
+ kind: "email";
648
+ providerId: "email";
649
+ connectionId: string;
650
+ clientReference: string | null;
651
+ label: string | null;
652
+ address: string;
653
+ status: "active";
654
+ createdAt: string;
655
+ updatedAt: string;
656
+ }
657
+ type HubChannel = HubEmailChannel;
658
+ interface HubChannelsResponse {
659
+ channels: HubChannel[];
660
+ }
661
+ interface HubEmailChannelCreateRequest {
662
+ /**
663
+ * Product-owned idempotency key. Retrying the same request returns the
664
+ * original mailbox instead of provisioning another address.
665
+ */
666
+ clientReference?: string;
667
+ label?: string;
668
+ }
669
+ interface HubChannelCreateResponse {
670
+ channel: HubChannel;
671
+ /** True only when this request created the channel. */
672
+ created: boolean;
673
+ }
674
+ interface HubChannelDeleteResponse {
675
+ removed: true;
676
+ }
677
+ type HubEventConditionScalar = string | number | boolean | null;
678
+ type HubEventCondition = {
679
+ path: string;
680
+ op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
681
+ value?: HubEventConditionScalar | HubEventConditionScalar[];
682
+ } | {
683
+ all: HubEventCondition[];
684
+ } | {
685
+ any: HubEventCondition[];
686
+ } | {
687
+ not: HubEventCondition;
688
+ };
689
+ interface HubEventSubscriptionFilter {
690
+ action?: string;
691
+ repo?: string;
692
+ when?: HubEventCondition;
693
+ }
694
+ type HubEventSubscriptionSource = {
695
+ type: "channel";
696
+ channelId: string;
697
+ } | {
698
+ type: "connection";
699
+ connectionId: string;
700
+ };
701
+ interface HubEventSubscriptionCallback {
702
+ url: string;
703
+ secret: string;
704
+ }
705
+ interface HubEventSubscriptionCreateRequest {
706
+ /**
707
+ * Product-owned idempotency key. Reusing it with the same source and filter
708
+ * returns the existing subscription; reusing it for different input fails.
709
+ */
710
+ clientReference: string;
711
+ label?: string;
712
+ source: HubEventSubscriptionSource;
713
+ event: string;
714
+ filter?: HubEventSubscriptionFilter;
715
+ callback: HubEventSubscriptionCallback;
716
+ }
717
+ interface HubEventSubscription {
718
+ id: string;
719
+ clientReference: string;
720
+ label: string | null;
721
+ source: HubEventSubscriptionSource;
722
+ providerId: string;
723
+ connectionId: string;
724
+ event: string;
725
+ filter: HubEventSubscriptionFilter;
726
+ workflowId: string;
727
+ status: "active" | "error";
728
+ lastError: string | null;
729
+ createdAt: string;
730
+ updatedAt: string;
731
+ }
732
+ interface HubEventSubscriptionsResponse {
733
+ subscriptions: HubEventSubscription[];
734
+ }
735
+ interface HubEventSubscriptionCreateResponse {
736
+ subscription: HubEventSubscription;
737
+ /** True only when this request created the subscription; false on idempotent reuse. */
738
+ created: boolean;
739
+ }
740
+ interface HubEventSubscriptionDeleteResponse {
741
+ removed: true;
742
+ }
743
+ interface HubProviderEvent {
744
+ provider: string;
745
+ connectionId: string;
746
+ type: string;
747
+ action?: string;
748
+ repo?: string;
749
+ deliveryId?: string;
750
+ payload: unknown;
751
+ }
752
+ interface HubEventDelivery {
753
+ subscriptionId: string;
754
+ workflowId: string;
755
+ runId: string;
756
+ source: {
757
+ kind: "channel" | "connection";
758
+ id: string;
759
+ provider: string;
760
+ event: string;
761
+ };
762
+ providerEvent: HubProviderEvent;
763
+ firedAt: string;
764
+ }
765
+ //#endregion
766
+ //#region src/connection-types.d.ts
767
+ interface HubConnection {
768
+ id: string;
769
+ providerId: string;
770
+ displayName: string;
771
+ accountDisplay: string | null;
772
+ providerAccountId: string | null;
773
+ scopes: string[];
774
+ status: "active" | "revoked" | "unhealthy" | "reconnect_required";
775
+ health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
776
+ createdAt: string;
777
+ updatedAt: string;
778
+ lastUsedAt: string | null;
779
+ }
780
+ interface HubConnectionsResponse {
781
+ connections: HubConnection[];
782
+ }
783
+ /** A connector's auth model. */
784
+ type HubProviderAuthKind = "oauth2" | "api_key" | "none" | "custom";
785
+ /** One non-secret value needed before an OAuth redirect can be built. Tenant-
786
+ * scoped providers use this for the account label in their OAuth hostname. */
787
+ interface HubOAuthConnectionParameter {
788
+ key: string;
789
+ label: string;
790
+ description: string;
791
+ placeholder: string;
792
+ required: true;
793
+ }
794
+ interface HubProvider {
795
+ providerId: string;
796
+ title: string;
797
+ /** The connector's auth model. */
798
+ authKind: HubProviderAuthKind;
799
+ /** For api-key connectors, the manifest's free-text hint shown when
800
+ * collecting the key (e.g. "Paste your Airtable personal access token");
801
+ * null for OAuth/native providers that don't collect a key inline. */
802
+ authHint: string | null;
803
+ category: string;
804
+ scopes: string[];
805
+ /** Actions + trigger events combined (legacy census; prefer the split
806
+ * counts below when present). */
807
+ capabilityCount: number;
808
+ /** Actions callable via `integration.invoke`. Absent on older servers, and
809
+ * for native GitHub when the executor catalog is unavailable. */
810
+ actionCount?: number;
811
+ /** Trigger events the connector delivers (not invokable). Absent on older
812
+ * servers. */
813
+ triggerCount?: number;
814
+ /** True for the native GitHub path; false for substrate-bundled connectors. */
815
+ native: boolean;
816
+ /** True when the provider's OAuth app credentials are wired, i.e. a connect
817
+ * flow can actually start. UIs offer Connect only for configured providers. */
818
+ configured: boolean;
819
+ /** Values the user must supply before OAuth starts. Empty or absent means the
820
+ * provider can redirect immediately. */
821
+ connectionParameters?: HubOAuthConnectionParameter[];
822
+ /**
823
+ * True when this deployment can receive this provider's inbound events.
824
+ * This is separate from `configured`: OAuth can be ready while the shared
825
+ * webhook secret or bot identity is still absent.
826
+ */
827
+ eventIngressConfigured?: boolean;
828
+ }
829
+ interface HubProvidersResponse {
830
+ providers: HubProvider[];
831
+ /** Count of substrate-bundled connector manifests behind this catalog. */
832
+ substrateBundled: number;
833
+ }
834
+ interface HubOAuthStartResponse {
835
+ provider: string;
836
+ redirectUrl: string;
837
+ state: string;
838
+ expiresAt: string;
839
+ scopes: string[];
840
+ cli: boolean;
841
+ }
842
+ interface HubWhatsappEmbeddedSignupStartRequest {
843
+ returnUrl?: string;
844
+ }
845
+ interface HubWhatsappEmbeddedSignupStartResponse {
846
+ provider: "whatsapp-business";
847
+ appId: string;
848
+ configId: string;
849
+ sdkVersion: string;
850
+ /** Embedded Signup flow the login configuration selects. "v4" takes empty
851
+ * extras; "v2" needs featureType and sessionInfoVersion. Absent means "v2". */
852
+ signupVersion?: "v2" | "v4";
853
+ state: string;
854
+ expiresAt: string;
855
+ scopes: string[];
856
+ }
857
+ interface HubWhatsappEmbeddedSignupCompleteRequest {
858
+ code: string;
859
+ state: string;
860
+ wabaId: string;
861
+ phoneNumberId: string;
862
+ businessId?: string;
863
+ flowEvent?: string;
864
+ }
865
+ interface HubWhatsappEmbeddedSignupCompleteResponse {
866
+ connectionId: string;
867
+ provider: "whatsapp-business";
868
+ reconnected: boolean;
869
+ connection: HubConnection | null;
870
+ }
871
+ /** Connect a non-OAuth (api-key) connector by submitting the user's key. The
872
+ * server validates the key with a live probe before persisting; `provider` is
873
+ * carried in the path, `apiKey` in the body. */
874
+ interface HubApiKeyConnectRequest {
875
+ provider: string;
876
+ apiKey: string;
877
+ /** Connector-owned setup values. Hub validates them before testing the key. */
878
+ metadata?: HubApiKeyConnectionMetadata;
879
+ }
880
+ type HubApiKeyConnectionMetadata = {
881
+ propertyId: string;
882
+ currency?: string;
883
+ } | {
884
+ listings: Array<{
885
+ id: string;
886
+ pms: string;
887
+ }>;
888
+ };
889
+ /** Result of an api-key connect: the created (or reconnected) connection.
890
+ * Synchronous — there is no redirect leg, unlike the OAuth flow. */
891
+ interface HubApiKeyConnectResponse {
892
+ connection: HubConnection;
893
+ reconnected: boolean;
894
+ }
895
+ interface HubConnectionDeleteResponse {
896
+ connection: HubConnection;
897
+ }
898
+ type HubConnectionHealthStatus = "healthy" | "reconnect_required" | "unhealthy" | "rate_limited" | "unsupported";
899
+ interface HubConnectionHealthError {
900
+ code: string;
901
+ message: string;
902
+ }
903
+ interface HubConnectionHealthInfo {
904
+ status: HubConnectionHealthStatus;
905
+ checkedAt: string;
906
+ error?: HubConnectionHealthError;
907
+ }
908
+ interface HubConnectionHealthResponse {
909
+ connection: HubConnection;
910
+ health: HubConnectionHealthInfo;
911
+ }
912
+ //#endregion
913
+ //#region src/github-app-types.d.ts
914
+ interface HubGithubAppMintInstallationTokenRequest {
915
+ /** HTTPS or SSH GitHub URL — alternative to installationId. */
916
+ repoUrl?: string;
917
+ /** Explicit installation id — alternative to repoUrl. */
918
+ installationId?: number;
919
+ /**
920
+ * Permission narrowing. The hub MAY refuse a permission broader than the
921
+ * grant authorized; absent, defaults to `{ contents: "read" }` (the
922
+ * conservative clone-only floor the autonomous-improvement loop needs).
923
+ */
924
+ permissions?: Record<string, "read" | "write" | "admin">;
925
+ /** Hint passed to GitHub. Server caps at the configured maximum. */
926
+ ttlSeconds?: number;
927
+ }
928
+ interface HubGithubAppMintInstallationTokenResponse {
929
+ token: string;
930
+ expiresAt: string;
931
+ installationId: number;
932
+ owner: string;
933
+ repo: string;
934
+ }
935
+ interface HubGithubAppInstallation {
936
+ installationId: number;
937
+ /** Org/user login the App is installed on (lowercased). */
938
+ accountLogin: string;
939
+ accountType: string | null;
940
+ /** "all" ⇒ every repo under the account; "selected" ⇒ only repoFullNames. */
941
+ repositorySelection: "all" | "selected";
942
+ /** Metadata omits names; use githubApp.listRepos(id) for a live caller-safe list. */
943
+ repoFullNames: string[];
944
+ suspended: boolean;
945
+ }
946
+ interface HubGithubAppInstallationResponse {
947
+ installation: HubGithubAppInstallation;
948
+ }
949
+ /** An installation as the management surface renders it: the registry record
950
+ * plus where to manage it on GitHub (org and personal accounts have different
951
+ * settings paths, and the id is not discoverable in GitHub's own UI). */
952
+ interface HubGithubAppManagedInstallation extends HubGithubAppInstallation {
953
+ manageUrl: string;
954
+ }
955
+ interface HubGithubAppListInstallationsResponse {
956
+ installations: HubGithubAppManagedInstallation[];
957
+ /** GitHub's install URL for this deployment, or null when the App slug is
958
+ * unconfigured — in which case there is no way to add another account and
959
+ * the UI must say so rather than link nowhere. */
960
+ installUrl: string | null;
961
+ /** Whether this deployment can ask GitHub for installations it never
962
+ * witnessed. Rests on the App CREDENTIAL, not the slug behind `installUrl` —
963
+ * a deployment can have one without the other. */
964
+ syncAvailable?: boolean;
965
+ }
966
+ interface HubGithubAppDisconnectResponse {
967
+ installationId: number;
968
+ disconnected: boolean;
969
+ }
970
+ interface HubGithubAppSyncedInstallation {
971
+ installationId: number;
972
+ accountLogin: string;
973
+ accountType: string | null;
974
+ repositorySelection: "all" | "selected";
975
+ /** False when this run is what linked it — the newly reachable access. */
976
+ alreadyLinked: boolean;
977
+ }
978
+ /** Result of reconciling the caller's installations from GitHub. */
979
+ interface HubGithubAppSyncResponse {
980
+ /** How many of the caller's GitHub accounts were examined. */
981
+ accountsChecked: number;
982
+ /** Installations the caller may act through once this returns. */
983
+ linked: HubGithubAppSyncedInstallation[];
984
+ /** An installation was found but not linked, and why. An account with no
985
+ * installation is absent — that is the ordinary case, not a problem. */
986
+ skipped: Array<{
987
+ accountLogin: string;
988
+ reason: string;
989
+ }>;
990
+ /** Why the examined set is not everything, when it isn't. */
991
+ incomplete?: string;
992
+ }
993
+ interface HubGithubAppListReposResponse {
994
+ installationId: number;
995
+ /** Complete live intersection of App coverage and the caller's GitHub access. */
996
+ repoFullNames: string[];
997
+ /** True only when both upstream listings completed; failures return an error. */
998
+ complete: true;
999
+ }
1000
+ interface HubGithubAppIsRepoInstalledResponse {
1001
+ installed: boolean;
1002
+ installationId: number | null;
1003
+ }
1004
+ //#endregion
1005
+ //#region src/workflow-graph-types.d.ts
1006
+ /** How a node's incoming edges release it (default `"all"` — omitted on the
1007
+ * wire for it, so specs compiled before join rules existed round-trip). */
1008
+ type HubWorkflowGraphJoinRule = "all" | "any" | "any_failed" | "all_done";
1009
+ type HubWorkflowConditionOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
1010
+ type HubWorkflowConditionScalar = string | number | boolean | null;
1011
+ /** The predicate on a guarded edge (`needs: [{ id, when }]`), evaluated by the
1012
+ * runner against the steps context on the source node's completion. */
1013
+ type HubWorkflowCondition = {
1014
+ path: string;
1015
+ op: HubWorkflowConditionOp;
1016
+ value?: HubWorkflowConditionScalar | HubWorkflowConditionScalar[];
1017
+ } | {
1018
+ all: HubWorkflowCondition[];
1019
+ } | {
1020
+ any: HubWorkflowCondition[];
1021
+ } | {
1022
+ not: HubWorkflowCondition;
1023
+ };
1024
+ interface HubWorkflowGraphNode {
1025
+ id: string;
1026
+ index: number;
1027
+ join?: HubWorkflowGraphJoinRule;
1028
+ }
1029
+ interface HubWorkflowGraphEdge {
1030
+ from: string;
1031
+ to: string;
1032
+ /** Guard the runner evaluates on the source's completion; unguarded edges
1033
+ * carry no `when`. */
1034
+ when?: HubWorkflowCondition;
1035
+ }
1036
+ /** JSON-serializable form of a validated graph (as stored on run/workflow rows). */
1037
+ interface HubWorkflowGraphSpec {
1038
+ nodes: HubWorkflowGraphNode[];
1039
+ edges: HubWorkflowGraphEdge[];
1040
+ maxNodeVisits: number;
1041
+ }
1042
+ //#endregion
1043
+ //#region src/workflow-run-types.d.ts
1044
+ type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
1045
+ /** One agent iteration of an `agent.run`, as the single-run detail carries it
1046
+ * (JSON-clean ISO timestamps) — including the round's own output `text`. */
1047
+ interface HubAgentIterationSpan {
1048
+ index: number;
1049
+ name: string;
1050
+ status: "succeeded" | "failed";
1051
+ startedAt: string;
1052
+ completedAt: string;
1053
+ model?: string;
1054
+ inputTokens?: number;
1055
+ outputTokens?: number;
1056
+ costUsd?: number;
1057
+ error?: string;
1058
+ text?: string;
1059
+ }
1060
+ /** An `agent.run`'s execution detail (single-run detail endpoint): per-iteration
1061
+ * spans plus aggregate usage, present on success AND failure. `partialText` is
1062
+ * failure-only — on success the final text is the action's `output`. */
1063
+ interface HubAgentRunDetail {
1064
+ model?: string;
1065
+ inputTokens?: number;
1066
+ outputTokens?: number;
1067
+ costUsd?: number;
1068
+ partialText?: string;
1069
+ iterations?: HubAgentIterationSpan[];
1070
+ }
1071
+ /** Per-action result inside a run. `output` on success, `error` on failure. */
1072
+ interface HubWorkflowActionResult {
1073
+ index: number;
1074
+ kind: string;
1075
+ /** `running` is the provisional in-flight status the run-history list and
1076
+ * single-run detail endpoints return for an action of a run that is still
1077
+ * executing (reconciled to `failed` only once the run itself reaches a
1078
+ * terminal state); a consumer polling either endpoint can observe it.
1079
+ * `skipped` is an action whose `if` guard resolved false, so it never ran —
1080
+ * terminal and distinct from `failed` (it has no `output`, `error`, or cost). */
1081
+ status: "succeeded" | "failed" | "running" | "skipped";
1082
+ /**
1083
+ * Action output on success. Present on the single-run detail endpoint;
1084
+ * intentionally omitted from the paginated run-history list response (an
1085
+ * output can be an arbitrarily large response body, and the list would
1086
+ * otherwise carry unbounded payloads), so it is absent there.
1087
+ */
1088
+ output?: unknown;
1089
+ error?: string;
1090
+ costUsd?: number;
1091
+ /** Graph-run identity: the topology node this action row belongs to. Present
1092
+ * when the id says something the row's position does not — an author's DAG
1093
+ * node id, and every cycle re-entry row (a node visited more than once
1094
+ * produces one row per visit). Absent on a linear run's rows, whose node id
1095
+ * IS their position: read it as `step-${index + 1}`. */
1096
+ nodeId?: string;
1097
+ /** Which visit of `nodeId` this row is (1-based). Present on cycle re-entry
1098
+ * rows only; a single-visit row omits it. */
1099
+ visit?: number;
1100
+ /** `script.run` only (single-run detail): the script's captured stdout
1101
+ * (size-capped), or an artifact ref carrying the full log by reference. */
1102
+ logs?: unknown;
1103
+ /** How an `onError` policy handled this action's failure so the run
1104
+ * continued (the action still reads `failed`). */
1105
+ onError?: HubWorkflowOnErrorOutcome;
1106
+ /** `agent.run` only (single-run detail): the agent's execution detail —
1107
+ * per-iteration spans (each with text), aggregate usage, partial text. */
1108
+ agentRun?: HubAgentRunDetail;
1109
+ }
1110
+ /** A single workflow run, as returned by the run-history endpoint. */
1111
+ interface HubWorkflowRun {
1112
+ id: string;
1113
+ status: HubWorkflowRunStatus;
1114
+ actionResults: HubWorkflowActionResult[];
1115
+ /** Terminal run error (credit-exhausted, connection revoked, …); null on a clean run. */
1116
+ error: string | null;
1117
+ attempts: number;
1118
+ /** Single-run detail only: the definition YAML captured at enqueue (null for
1119
+ * runs from before snapshots, or a workflow with no stored definition). */
1120
+ definitionSnapshot?: string | null;
1121
+ /** Single-run detail only: the trigger payload/context the run executed
1122
+ * against (capped server-side). Absent on the paginated list. */
1123
+ triggerContext?: unknown;
1124
+ createdAt: string;
1125
+ startedAt: string | null;
1126
+ completedAt: string | null;
1127
+ }
1128
+ /**
1129
+ * A single run as returned by the single-run detail endpoint
1130
+ * (`GET /v1/workflows/:id/runs/:runId`) and carried in the `snapshot` stream
1131
+ * event. Unlike a run-history list item it always carries `workflowId` and the
1132
+ * per-action `output` / `agentRun` detail (all size-capped server-side).
1133
+ */
1134
+ interface HubWorkflowRunDetail extends HubWorkflowRun {
1135
+ workflowId: string;
1136
+ /** The detail endpoint always returns these (unlike the run-history list,
1137
+ * where they're absent) — narrowed to required here so a consumer of
1138
+ * `getRun` / a `snapshot` event reads them without re-checking presence. */
1139
+ triggerContext: unknown;
1140
+ definitionSnapshot: string | null;
1141
+ /** The terminal failed/cancelled run this one retries (enqueued via
1142
+ * {@link HubWorkflowsClient.retryRun}); null on runs that are not retries. */
1143
+ retriedFromRunId: string | null;
1144
+ /** The compiled graph topology the run executed (resolved from the run's
1145
+ * definition snapshot, so a post-run edit can't mislabel it) — null for a
1146
+ * linear run. Present on the HTTP run-detail response. */
1147
+ graph?: HubWorkflowGraphSpec | null;
1148
+ /** Per-completion guard verdicts (keyed `"from->to"`), present only when the
1149
+ * run carries a graph journal — i.e. a parked (`waiting`) graph run. */
1150
+ edgeVerdicts?: HubWorkflowEdgeVerdicts[];
1151
+ }
1152
+ /**
1153
+ * The trigger fields a manual "Run now" supplies, as a flat `{ path: value }`
1154
+ * map (e.g. `{ "pull_request.number": "123" }`). Keys are the `path`s of the
1155
+ * workflow's {@link HubManualRunInput}s; the server nests them into a trigger
1156
+ * context so the run resolves exactly as a real trigger delivery would.
1157
+ */
1158
+ type HubWorkflowRunInputs = Record<string, string>;
1159
+ /** Response of a manual run enqueue (`POST /v1/workflows/:id/run`). */
1160
+ interface HubWorkflowRunEnqueued {
1161
+ runId: string;
1162
+ }
1163
+ /**
1164
+ * Result of cancelling a run (`POST /v1/workflows/:id/runs/:runId/cancel`).
1165
+ *
1166
+ * `cancelled` — a `queued` run was stopped synchronously in the store; it is
1167
+ * already terminal. `cancelling` — a `running` run was signalled to abort; it
1168
+ * settles `cancelled` a moment later as its in-flight action tears down. Observe
1169
+ * the true terminal state via {@link HubWorkflowRunDetail} (`getRun`) or the run
1170
+ * event stream (`watchRun`). A finished run throws `HubSdkError` with code
1171
+ * `RUN_NOT_CANCELLABLE`; an unknown/foreign run throws `NOT_FOUND`.
1172
+ */
1173
+ interface HubWorkflowRunCancelResult {
1174
+ runId: string;
1175
+ status: "cancelled" | "cancelling";
1176
+ /** Only on a `cancelling` result: whether the abort reached a worker running
1177
+ * this run on the API instance that served the request. `false` → the run
1178
+ * just finished, or executes on another instance and will stop on its own;
1179
+ * watch/poll the run to confirm it settled `cancelled`. */
1180
+ signalled?: boolean;
1181
+ }
1182
+ /**
1183
+ * Response of a run retry (`POST /v1/workflows/:id/runs/:runId/retry`): the
1184
+ * NEWLY enqueued run's id — a fresh run of the same workflow with the same
1185
+ * trigger context — plus the terminal run it was retried from. A finished
1186
+ * run in any other state throws `HubSdkError` with code `RUN_NOT_RETRYABLE`;
1187
+ * an unknown/foreign run throws `NOT_FOUND`.
1188
+ */
1189
+ interface HubWorkflowRunRetried {
1190
+ runId: string;
1191
+ retriedFromRunId: string;
1192
+ }
1193
+ /**
1194
+ * A live event from a run's SSE stream (`GET /v1/workflows/:id/runs/:runId/events`),
1195
+ * as surfaced by {@link HubWorkflowsClient.watchRun}. `snapshot` is the current
1196
+ * persisted run detail sent first; the lifecycle/token events mirror the run as
1197
+ * it executes; `ping` is a keepalive; `run.done` is terminal and closes the
1198
+ * stream. Unknown server event types are dropped rather than surfaced, so new
1199
+ * event kinds don't break older clients.
1200
+ */
1201
+ type HubWorkflowRunStreamEvent = {
1202
+ type: "snapshot";
1203
+ run: HubWorkflowRunDetail;
1204
+ } | {
1205
+ type: "action.started";
1206
+ index: number;
1207
+ kind: string;
1208
+ at: string;
1209
+ } | {
1210
+ type: "action.finished";
1211
+ index: number;
1212
+ kind: string;
1213
+ status: "succeeded" | "failed" | "skipped";
1214
+ costUsd?: number;
1215
+ error?: string;
1216
+ at: string;
1217
+ } | {
1218
+ type: "iteration.started";
1219
+ actionIndex: number;
1220
+ iterationIndex: number;
1221
+ model?: string;
1222
+ at: string;
1223
+ } | {
1224
+ type: "iteration.ended";
1225
+ actionIndex: number;
1226
+ iterationIndex: number;
1227
+ status: "succeeded" | "failed";
1228
+ outputPreview?: string;
1229
+ inputTokens?: number;
1230
+ outputTokens?: number;
1231
+ costUsd?: number;
1232
+ at: string;
1233
+ } | {
1234
+ type: "token";
1235
+ actionIndex: number;
1236
+ delta: string;
1237
+ at: string;
1238
+ } | {
1239
+ type: "ping";
1240
+ } | {
1241
+ type: "run.done";
1242
+ status: "succeeded" | "failed" | "cancelled";
1243
+ error?: string | null;
1244
+ at?: string;
1245
+ } | {
1246
+ type: "run.waiting";
1247
+ decisionId: string;
1248
+ at?: string;
1249
+ };
1250
+ /** Latest-run snapshot attached to each workflow on the list response. */
1251
+ interface HubWorkflowRunSummary {
1252
+ id: string;
1253
+ status: HubWorkflowRunStatus;
1254
+ error: string | null;
1255
+ createdAt: string;
1256
+ completedAt: string | null;
1257
+ /** Execution start; null while queued, absent from older responses. */
1258
+ startedAt?: string | null;
1259
+ }
1260
+ /** One page of run history; `nextCursor` is null on the last page. */
1261
+ interface HubWorkflowRunsPage {
1262
+ runs: HubWorkflowRun[];
1263
+ nextCursor: string | null;
1264
+ }
1265
+ /** Trailing windows the fleet-insights endpoint accepts. */
1266
+ type HubWorkflowFleetWindow = "24h" | "7d" | "30d";
1267
+ /**
1268
+ * One workflow's row in the fleet overview: its run tallies over the window.
1269
+ * `lastRunStatus`/`lastRunAt` describe the newest run INSIDE the window (null
1270
+ * when the workflow didn't run in it), and `successRate` is
1271
+ * `succeeded / runsInWindow` — null, never a fabricated 0 or 1, when there is
1272
+ * no denominator.
1273
+ */
1274
+ interface HubWorkflowFleetEntry {
1275
+ id: string;
1276
+ name: string;
1277
+ enabled: boolean;
1278
+ runsInWindow: number;
1279
+ succeeded: number;
1280
+ failed: number;
1281
+ /** Runs parked on a human `decision` step (status `waiting`). */
1282
+ waiting: number;
1283
+ successRate: number | null;
1284
+ lastRunStatus: HubWorkflowRunStatus | null;
1285
+ lastRunAt: string | null;
1286
+ }
1287
+ /** `GET /v1/workflows/insights/fleet` — the whole fleet, sorted failing-first. */
1288
+ interface HubWorkflowFleetInsights {
1289
+ window: HubWorkflowFleetWindow;
1290
+ /** ISO instant the window starts at (now minus the window length). */
1291
+ windowStart: string;
1292
+ workflows: HubWorkflowFleetEntry[];
1293
+ }
1294
+ /** One journal completion on the wire: the node that completed and the guard
1295
+ * verdict evaluated for each of its guarded outgoing edges, keyed by edgeKey
1296
+ * (`"from->to"`). Only GUARDED edges ever appear. */
1297
+ interface HubWorkflowEdgeVerdicts {
1298
+ nodeId: string;
1299
+ verdicts: Record<string, boolean>;
1300
+ }
1301
+ /** How an action's `onError` policy handled a failure so the run continued
1302
+ * (the action itself still reads `failed`). */
1303
+ interface HubWorkflowOnErrorOutcome {
1304
+ policy: "continue" | "fallback";
1305
+ /** The recovery leaf's result when the policy ran a `{ do }` fallback. */
1306
+ fallback?: {
1307
+ kind: string;
1308
+ status: "succeeded" | "failed";
1309
+ output?: unknown;
1310
+ error?: string;
1311
+ costUsd?: number;
1312
+ };
1313
+ }
1314
+ /** One node's aggregate across the analyzed runs. */
1315
+ interface HubWorkflowNodeHealth {
1316
+ /** The author's graph node id, or `step-N` for a linear run's nodes (and for
1317
+ * a node whose run cannot be mapped back to a definition). */
1318
+ nodeId: string;
1319
+ visits: number;
1320
+ failures: number;
1321
+ /** Null when no visit carried a cost row (never a fabricated 0). */
1322
+ totalCostUsd: number | null;
1323
+ /** Null when no visit recorded duration spans. */
1324
+ avgDurationMs: number | null;
1325
+ }
1326
+ /** Failures grouped by a normalized error signature (ids/numbers/whitespace
1327
+ * stripped), most frequent first (top 5). */
1328
+ interface HubWorkflowFailureCluster {
1329
+ signature: string;
1330
+ count: number;
1331
+ sampleRunIds: string[];
1332
+ }
1333
+ /** An agent.run node whose outputs are near-static across runs — a
1334
+ * CANDIDATE for distillation, reported with its measurements, never a
1335
+ * verdict. */
1336
+ interface HubWorkflowDistillationCandidate {
1337
+ nodeId: string;
1338
+ matchRatio: number;
1339
+ samples: number;
1340
+ avgCostUsd: number | null;
1341
+ }
1342
+ interface HubWorkflowHealth {
1343
+ /** The requested window (the `runs` parameter). */
1344
+ runsWindow: number;
1345
+ /** Terminal runs that actually went into the stats. */
1346
+ runsAnalyzed: number;
1347
+ nodes: HubWorkflowNodeHealth[];
1348
+ failureClusters: HubWorkflowFailureCluster[];
1349
+ distillationCandidates: HubWorkflowDistillationCandidate[];
1350
+ }
1351
+ type HubWorkflowDecisionStatus = "pending" | "resolved" | "expired" | "cancelled";
1352
+ type HubWorkflowDecisionOnTimeout = "wait" | "fail" | "default";
1353
+ /** How the answer arrived: a UI click, a provider-channel event (e.g. a Slack
1354
+ * reaction), or the timeout policy. */
1355
+ type HubWorkflowDecisionResolvedVia = "in_app" | "channel" | "system";
1356
+ interface HubWorkflowDecision {
1357
+ id: string;
1358
+ runId: string;
1359
+ workflowId: string;
1360
+ actionIndex: number;
1361
+ title: string;
1362
+ prompt: string | null;
1363
+ options: string[];
1364
+ status: HubWorkflowDecisionStatus;
1365
+ onTimeout: HubWorkflowDecisionOnTimeout;
1366
+ defaultChoice: string | null;
1367
+ choice: string | null;
1368
+ note: string | null;
1369
+ timedOut: boolean;
1370
+ requestedAt: string;
1371
+ expiresAt: string | null;
1372
+ resolvedAt: string | null;
1373
+ /** Null while pending, and on a row settled without an answer (expired /
1374
+ * cancelled). */
1375
+ resolvedVia: HubWorkflowDecisionResolvedVia | null;
1376
+ /** `channel` answers only: the provider whose event carried the answer and
1377
+ * the raw external actor id it came from. */
1378
+ resolvedViaProvider: string | null;
1379
+ resolvedByExternalActor: string | null;
1380
+ }
1381
+ /** A pending decision on the cross-workflow list, named by its workflow
1382
+ * (null when the workflow was deleted while the run was parked). */
1383
+ interface HubWorkflowPendingDecision extends HubWorkflowDecision {
1384
+ workflowName: string | null;
1385
+ }
1386
+ interface HubWorkflowPendingDecisionsResponse {
1387
+ decisions: HubWorkflowPendingDecision[];
1388
+ }
1389
+ /** Result of resolving a decision. `resumed` is false when the resolution
1390
+ * stuck but the run could not be resumed (already terminal/cancelled). */
1391
+ interface HubWorkflowDecisionResolveResult {
1392
+ runId: string;
1393
+ decisionId: string;
1394
+ choice: string;
1395
+ resumed: boolean;
1396
+ }
1397
+ /** One step of an agent round's execution timeline (reasoning, or a tool call
1398
+ * with args + result), as the step-page endpoint serves it. */
1399
+ type HubWorkflowAgentStep = {
1400
+ kind: "reasoning";
1401
+ text: string;
1402
+ } | {
1403
+ kind: "tool"; /** Tool name, e.g. "read", "bash". */
1404
+ tool: string;
1405
+ status: "pending" | "running" | "completed" | "error"; /** Arguments the tool was called with (pretty JSON). */
1406
+ input?: string; /** Result the tool returned on success (pretty JSON / text). */
1407
+ output?: string; /** Error message when the tool failed. */
1408
+ error?: string;
1409
+ };
1410
+ /** One page of a round's step archive. `nextCursor` is the last `stepIndex`
1411
+ * held — pass it as `after` for the next page; null on the last page. */
1412
+ interface HubWorkflowRunStepsPage {
1413
+ steps: HubWorkflowAgentStep[];
1414
+ nextCursor: number | null;
1415
+ }
1416
+ //#endregion
1417
+ //#region src/workflow-definition-types.d.ts
1418
+ interface HubWorkflowAction {
1419
+ kind: string;
1420
+ config: Record<string, unknown>;
1421
+ }
1422
+ /** Inbound-event matcher for a `provider_event` trigger. */
1423
+ interface HubWorkflowEventFilter {
1424
+ event: string;
1425
+ action?: string;
1426
+ repo?: string;
1427
+ }
1428
+ interface HubWorkflowTrigger {
1429
+ id: string;
1430
+ kind: "provider_event" | "schedule" | "webhook";
1431
+ enabled: boolean;
1432
+ provider: string | null;
1433
+ connectionId: string | null;
1434
+ eventFilter: HubWorkflowEventFilter | null;
1435
+ cron: string | null;
1436
+ timezone: string | null;
1437
+ nextFireAt: string | null;
1438
+ lastFiredAt: string | null;
1439
+ /** Schedule only: the ISO-8601 instant it stops firing; null when unbounded. */
1440
+ until: string | null;
1441
+ }
1442
+ interface HubWorkflowValidationError {
1443
+ path: string;
1444
+ message: string;
1445
+ /** Machine-readable reason where one is defined, e.g. `schedule_outlives_grant`. */
1446
+ code?: string;
1447
+ }
1448
+ interface HubWorkflow {
1449
+ id: string;
1450
+ name: string;
1451
+ description: string | null;
1452
+ enabled: boolean;
1453
+ /** Compiled engine actions (connection refs resolved to ids). */
1454
+ actions: HubWorkflowAction[];
1455
+ /** The durable YAML this workflow compiled from. */
1456
+ definitionYaml: string | null;
1457
+ validationErrors: HubWorkflowValidationError[];
1458
+ /** Current head revision; null on pre-versioning rows until their next
1459
+ * update (they have no revision history to point at yet). */
1460
+ headRev?: number | null;
1461
+ /** Present on get/create/update detail responses; omitted on list. */
1462
+ triggers?: HubWorkflowTrigger[];
1463
+ /** Present on the detail response: the trigger fields a manual run must supply,
1464
+ * derived from the definition's `${trigger.*}` references (empty when none). */
1465
+ manualRunInputs?: HubManualRunInput[];
1466
+ /** Present on the get-detail response: the compiled graph topology (null
1467
+ * when the definition has no graph topology, or is chain-equivalent —
1468
+ * the legacy linear semantics). Omitted on the list projection. */
1469
+ graph?: HubWorkflowGraphSpec | null;
1470
+ /** Create response only, when the definition has a webhook trigger: the
1471
+ * hook delivery URL, plus the plaintext bearer token exactly once at mint
1472
+ * (absent when an active token already exists — rotate to re-reveal). */
1473
+ hook?: HubWorkflowHookEndpoint;
1474
+ /** Present on the list response (latest run, or null if never run); omitted on detail. */
1475
+ lastRun?: HubWorkflowRunSummary | null;
1476
+ createdAt: string;
1477
+ updatedAt: string;
1478
+ }
1479
+ /** A trigger field a manual "Run now" must supply (derived from the
1480
+ * definition's `${trigger.*}` references). `required` is false only when every
1481
+ * read is wrapped in a `default(...)`. */
1482
+ interface HubManualRunInput {
1483
+ path: string;
1484
+ required: boolean;
1485
+ }
1486
+ type HubWorkflowValidateResponse = {
1487
+ valid: true;
1488
+ name: string;
1489
+ actionCount: number;
1490
+ triggerCount: number;
1491
+ } | {
1492
+ valid: false;
1493
+ errors: HubWorkflowValidationError[];
1494
+ };
1495
+ /** JSON Schema for the YAML workflow definition. */
1496
+ type HubWorkflowSchemaResponse = Record<string, unknown>;
1497
+ type HubWorkflowRevisionSource = "user" | "copilot" | "intelligence";
1498
+ /** Lifecycle state of a revision. The head rev only ever points at an
1499
+ * `applied` revision; `proposed` is a service-token-authored suggestion
1500
+ * awaiting an owner decision; `rejected` is a declined proposal (kept for
1501
+ * audit). */
1502
+ type HubWorkflowRevisionStatus = "applied" | "proposed" | "rejected";
1503
+ /** Revision list projection — attribution + note + status, WITHOUT the YAML body. */
1504
+ interface HubWorkflowRevisionMeta {
1505
+ rev: number;
1506
+ createdAt: string;
1507
+ createdBy: string;
1508
+ source: HubWorkflowRevisionSource;
1509
+ note: string | null;
1510
+ status: HubWorkflowRevisionStatus;
1511
+ }
1512
+ /** One revision WITH its YAML (and the actions compiled alongside it). */
1513
+ interface HubWorkflowRevision extends HubWorkflowRevisionMeta {
1514
+ yaml: string;
1515
+ actions: HubWorkflowAction[];
1516
+ }
1517
+ /** A proposal (proposed or rejected revision) WITH its evidence — what the
1518
+ * proposer derived the suggestion from (e.g. health stats), plus
1519
+ * `rejectionReason` once declined. */
1520
+ interface HubWorkflowProposal extends HubWorkflowRevisionMeta {
1521
+ evidence: unknown;
1522
+ }
1523
+ type HubWorkflowTemplateCategory = "Code Review" | "Triage" | "Reports" | "Multi-agent";
1524
+ /** One author-time literal a gallery starter needs the user to supply. Every
1525
+ * declared parameter is required; `example` is a valid value that seeds the
1526
+ * form placeholder. */
1527
+ interface HubWorkflowTemplateParameter {
1528
+ key: string;
1529
+ label: string;
1530
+ type: "string" | "integer";
1531
+ help?: string;
1532
+ example: string;
1533
+ default?: string;
1534
+ defaultFrom?: "native_evaluation";
1535
+ required?: boolean;
1536
+ advanced?: boolean;
1537
+ }
1538
+ interface HubWorkflowTemplate {
1539
+ id: string;
1540
+ name: string;
1541
+ summary: string;
1542
+ category: HubWorkflowTemplateCategory;
1543
+ icon: string;
1544
+ requiresSandbox: boolean;
1545
+ /** Providers the template references (a "uses GitHub" hint), sorted. */
1546
+ providers: string[];
1547
+ parameters: HubWorkflowTemplateParameter[];
1548
+ /** The template with parameter tokens rendered to their example values. */
1549
+ previewYaml: string;
1550
+ setupNotes?: string[];
1551
+ }
1552
+ /** A connection a definition needs, with where to connect it. */
1553
+ interface HubWorkflowConnectionRequirement {
1554
+ provider: string;
1555
+ connected: boolean;
1556
+ kind: "integration" | "github_app";
1557
+ /** Where to satisfy the requirement (App install flow for `github_app`,
1558
+ * integrations page otherwise); null when no target exists. */
1559
+ connectUrl: string | null;
1560
+ /** Another requirement in the same list that must be satisfied first — a
1561
+ * `github_app` install is claimed through the `github` connection, so it is
1562
+ * refused while that connection is missing. Null when nothing blocks this
1563
+ * requirement. The list is ordered prerequisite-first. */
1564
+ prerequisite: {
1565
+ provider: string;
1566
+ kind: "integration" | "github_app";
1567
+ } | null;
1568
+ }
1569
+ /** Stable identity shared by workflow connection requirements and prerequisite references. */
1570
+ declare function workflowConnectionRequirementKey(ref: Readonly<Pick<HubWorkflowConnectionRequirement, "provider" | "kind">>): string;
1571
+ /**
1572
+ * Result of instantiating a template. `created: false` is NOT an error — an
1573
+ * actionable continuation listing the connections to satisfy before retrying
1574
+ * the same call. Invalid parameters or a compile failure throw `HubSdkError`
1575
+ * (400) instead, matching the create route's contract.
1576
+ */
1577
+ type HubWorkflowTemplateInstantiateResult = {
1578
+ created: true;
1579
+ workflow: HubWorkflow;
1580
+ } | {
1581
+ created: false;
1582
+ connectionRequirements: HubWorkflowConnectionRequirement[];
1583
+ };
1584
+ /** A workflow's webhook delivery endpoint. `token` is the plaintext bearer —
1585
+ * revealed only at mint/rotate time (only the hash is stored). */
1586
+ interface HubWorkflowHookEndpoint {
1587
+ url: string;
1588
+ token?: string;
1589
+ }
1590
+ //#endregion
1591
+ //#region src/workflow-storage-types.d.ts
1592
+ /** One KV entry with its metadata — the get/put/cas response shape. */
1593
+ interface HubWorkflowKvEntry {
1594
+ key: string;
1595
+ value: unknown;
1596
+ version: number;
1597
+ updatedAt: string;
1598
+ }
1599
+ /** Keyspace metadata row (never the value) — the list response's entry. */
1600
+ interface HubWorkflowKvEntryMeta {
1601
+ key: string;
1602
+ version: number;
1603
+ updatedAt: string;
1604
+ }
1605
+ interface HubWorkflowKvListResponse {
1606
+ entries: HubWorkflowKvEntryMeta[];
1607
+ }
1608
+ interface HubWorkflowKvDeleteResponse {
1609
+ deleted: boolean;
1610
+ }
1611
+ /** The opaque ref a stored artifact is referred to by — the value a
1612
+ * script.run node returns as its step output. */
1613
+ interface HubWorkflowArtifactRef {
1614
+ $artifact: string;
1615
+ name: string;
1616
+ contentType: string;
1617
+ byteSize: number;
1618
+ preview: string | null;
1619
+ }
1620
+ /** Artifact metadata (never the bytes), oldest first on the list response. */
1621
+ interface HubWorkflowArtifact {
1622
+ id: string;
1623
+ runId: string;
1624
+ workflowId: string;
1625
+ /** The graph node (or `step-N` positional id on linear runs) whose action
1626
+ * emitted the artifact. */
1627
+ nodeId: string;
1628
+ name: string;
1629
+ contentType: string;
1630
+ byteSize: number;
1631
+ /** First 2KiB of textual content; null for binary content types. */
1632
+ preview: string | null;
1633
+ createdAt: string;
1634
+ }
1635
+ interface HubWorkflowArtifactsResponse {
1636
+ artifacts: HubWorkflowArtifact[];
1637
+ }
1638
+ /** Raw artifact bytes from the download route, with their stored content type. */
1639
+ interface HubWorkflowArtifactDownload {
1640
+ bytes: Uint8Array;
1641
+ contentType: string;
1642
+ }
1643
+ //#endregion
1644
+ //#region src/lines.d.ts
1645
+ interface HubLineMember {
1646
+ id: string;
1647
+ label: string | null;
1648
+ role: string;
1649
+ self?: boolean;
1650
+ consent?: "enabled" | "required";
1651
+ }
1652
+ interface HubLineContext {
1653
+ self: {
1654
+ id: string;
1655
+ label: string | null;
1656
+ role: string;
1657
+ };
1658
+ line: {
1659
+ id: string;
1660
+ label: string | null;
1661
+ transport: string;
1662
+ };
1663
+ members: HubLineMember[];
1664
+ capabilities: Record<string, {
1665
+ allowed: boolean;
1666
+ reason?: string;
1667
+ }>;
1668
+ pendingReminders: Array<{
1669
+ messageId: string;
1670
+ wakeAt?: string;
1671
+ prompt: string | null;
1672
+ }>;
1673
+ quotas: {
1674
+ selfMessagesToday: number;
1675
+ selfMessagesPerDay: number;
1676
+ selfMessagesPending: number;
1677
+ selfMessagesPendingLimit: number;
1678
+ };
1679
+ }
1680
+ interface HubLineSendInput {
1681
+ toMember: string;
1682
+ text: string;
1683
+ notBefore?: string;
1684
+ onBehalfOf?: string;
1685
+ idempotencyKey?: string;
1686
+ }
1687
+ /** An asset URL safe to share with the recipient and provider. Hub never fetches it.
1688
+ * Meta WhatsApp API-key lines send it with `text` as the caption. Other transports refuse it.
1689
+ * Use public HTTPS without a query, fragment or credentials. */
1690
+ interface HubLineImage {
1691
+ url: string;
1692
+ }
1693
+ interface HubLineOwnerSendInput {
1694
+ memberId: string;
1695
+ text: string;
1696
+ image?: HubLineImage;
1697
+ notBefore?: string;
1698
+ idempotencyKey: string;
1699
+ /** Ask a coded question; the member's reply that starts with `code` returns here. */
1700
+ reply?: HubLineReplyCodeInput;
1701
+ }
1702
+ interface HubLineReplyCodeInput {
1703
+ /** A letter, then up to seven letters or digits, with at least one digit (`F7`). Hub compares it case-insensitively. */
1704
+ code: string;
1705
+ /** 60 to 604800; the window opens when the send first becomes eligible. */
1706
+ ttlSeconds: number;
1707
+ /**
1708
+ * 1 to 20 distinct texted choices, each 1-32 of `a-z 0-9 _ -` after lower-casing.
1709
+ * An answer must then be `<code> <option>[ <note>]`; any other coded text keeps the question open.
1710
+ */
1711
+ options?: string[];
1712
+ }
1713
+ /** The coded question's state on an owner send receipt. */
1714
+ interface HubLineReplyCode {
1715
+ /** Upper case. */
1716
+ code: string;
1717
+ expiresAt: string;
1718
+ /** Authoritative closure fence; absent on older Hub, never infer it from local time. */
1719
+ closed?: boolean;
1720
+ /** The first coded answer; `text` is null after content retention ends. */
1721
+ answer: {
1722
+ messageId: string;
1723
+ text: string | null;
1724
+ receivedAt: string; /** The named option, lower case; null when the send listed no options. */
1725
+ option: string | null; /** Words after the option; null when there were none or retention ended. */
1726
+ note: string | null;
1727
+ } | null;
1728
+ }
1729
+ interface HubLineReminderInput {
1730
+ text: string;
1731
+ notBefore: string;
1732
+ idempotencyKey: string;
1733
+ }
1734
+ interface HubLineApplicationDispatchCurrentInput {
1735
+ attachmentId: string;
1736
+ memberId: string;
1737
+ memberRevision: string;
1738
+ senderAddress: string;
1739
+ textSha256: string;
1740
+ binding: string;
1741
+ dispatchFence: string;
1742
+ dispatchDeadline: string;
1743
+ }
1744
+ interface HubLineMemberApplication {
1745
+ id: string;
1746
+ lineId: string;
1747
+ attachmentId: string;
1748
+ memberId: string;
1749
+ subjectId: string;
1750
+ status: "active" | "revoked";
1751
+ application: {
1752
+ url: string;
1753
+ binding: string;
1754
+ };
1755
+ /** Hub's name for the app at this callback; present on reads. */
1756
+ app?: {
1757
+ name: string;
1758
+ };
1759
+ createdAt: string;
1760
+ revokedAt: string | null;
1761
+ }
1762
+ interface HubLineMemberApplicationInput {
1763
+ expectedSelectionId: string | null;
1764
+ expectedMemberRevision: string;
1765
+ subjectId: string;
1766
+ application: {
1767
+ url: string;
1768
+ binding: string;
1769
+ secret: string;
1770
+ };
1771
+ }
1772
+ interface HubLineProviderDelivery {
1773
+ provider: "meta_whatsapp";
1774
+ messageId: string;
1775
+ acceptedAt: string;
1776
+ sentAt: string | null;
1777
+ deliveredAt: string | null;
1778
+ readAt: string | null;
1779
+ failedAt: string | null;
1780
+ failureCode: number | null;
1781
+ }
1782
+ interface HubLineSendReceipt {
1783
+ /** Absent on older Hub. Replied/accepted never implies delivered. */
1784
+ delivery?: HubLineProviderDelivery | null;
1785
+ message: {
1786
+ id: string;
1787
+ status: string;
1788
+ text: string | null;
1789
+ image?: HubLineImage;
1790
+ };
1791
+ eligibleAt: string | null;
1792
+ expiresAt: string;
1793
+ /** Null when the send asked no coded question; absent from Hub before reply codes. */
1794
+ reply?: HubLineReplyCode | null;
1795
+ }
1796
+ interface HubLineReminderReceipt {
1797
+ state: "queued" | "skipped";
1798
+ lineId: string;
1799
+ messageId?: string;
1800
+ sessionId?: string;
1801
+ completion?: string;
1802
+ reason?: string;
1803
+ }
1804
+ interface HubLineScheduledSendOptions {
1805
+ lineId: string;
1806
+ memberId: string;
1807
+ text: string;
1808
+ timezone: string;
1809
+ name?: string;
1810
+ notBefore?: string;
1811
+ /**
1812
+ * RFC 3339 instant the schedule stops at. Required when the calling key
1813
+ * expires, and no later than that expiry: a schedule never outlives the
1814
+ * key that wrote it.
1815
+ */
1816
+ until?: string;
1817
+ }
1818
+ interface HubLineCheckinOptions {
1819
+ lineId: string;
1820
+ member: string;
1821
+ timezone: string;
1822
+ prompt: string;
1823
+ name?: string;
1824
+ /** RFC 3339 instant the schedule stops at; see {@link HubLineScheduledSendOptions.until}. */
1825
+ until?: string;
1826
+ }
1827
+ /** Line calls share HubClient authentication and envelope handling. */
1828
+ declare class HubLinesClient {
1829
+ private readonly request;
1830
+ private readonly createWorkflow;
1831
+ private readonly requestApplicationDispatchCurrent?;
1832
+ readonly members: {
1833
+ list: (lineId: string) => Promise<HubLineMember[]>;
1834
+ };
1835
+ readonly memberApplications: {
1836
+ get: (lineId: string, memberId: string) => Promise<{
1837
+ memberRevision: string;
1838
+ selection: HubLineMemberApplication | null;
1839
+ }>;
1840
+ select: (lineId: string, memberId: string, input: HubLineMemberApplicationInput) => Promise<HubLineMemberApplication>;
1841
+ clear: (lineId: string, memberId: string, input: {
1842
+ expectedSelectionId: string;
1843
+ expectedMemberRevision: string;
1844
+ }) => Promise<void>;
1845
+ };
1846
+ readonly checkins: {
1847
+ schedule: (cron: string, options: HubLineCheckinOptions) => Promise<HubWorkflow>;
1848
+ };
1849
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>, createWorkflow: (yaml: string) => Promise<HubWorkflow>, requestApplicationDispatchCurrent?: ((path: string, init: RequestInit, callbackBearer: string) => Promise<{
1850
+ current: boolean;
1851
+ }>) | undefined);
1852
+ scheduleSend(cron: string, options: HubLineScheduledSendOptions): Promise<HubWorkflow>;
1853
+ context(): Promise<HubLineContext>;
1854
+ send(lineId: string, input: HubLineSendInput | HubLineOwnerSendInput): Promise<HubLineSendReceipt>;
1855
+ /** Read an owner send's receipt, including its coded answer. Queued is not delivered. */
1856
+ sentMessage(lineId: string, messageId: string): Promise<HubLineSendReceipt>;
1857
+ remind(lineId: string, input: HubLineReminderInput): Promise<HubLineReminderReceipt>;
1858
+ applicationDispatchCurrent(lineId: string, messageId: string, input: HubLineApplicationDispatchCurrentInput, callbackBearer: string): Promise<boolean>;
1859
+ }
1860
+ //#endregion
1861
+ //#region src/managed-numbers.d.ts
1862
+ interface HubNumberReadiness {
1863
+ configured: boolean;
1864
+ provider: "inkbox";
1865
+ transports: Array<"sms" | "imessage">;
1866
+ billing: "prepaid_activation";
1867
+ automaticRentalBilling: false;
1868
+ deliveryVerified: false;
1869
+ }
1870
+ interface HubNumberQuote {
1871
+ transport: "sms" | "imessage";
1872
+ activationCents: number;
1873
+ currency: "usd";
1874
+ termsVersion: string;
1875
+ terms: string;
1876
+ expiresAt: number;
1877
+ /** The binding the quote was issued for. Absent from older servers. */
1878
+ clientReference?: string;
1879
+ /** Opaque. Pass it back to `create`; never decode it. */
1880
+ token: string;
1881
+ }
1882
+ /** One page of the owner's orders, newest first. */
1883
+ interface HubNumberOrderPage {
1884
+ orders: HubNumberOrder[];
1885
+ /** Present while more orders exist. Older servers omit it and return one
1886
+ * bounded page, so an absent cursor never proves an order does not exist. */
1887
+ nextCursor?: string | null;
1888
+ }
1889
+ interface HubNumberListQuery {
1890
+ /** Only orders requested for this binding, including closed ones. */
1891
+ clientReference?: string;
1892
+ cursor?: string;
1893
+ /** 1 to 100; the server default is 100. */
1894
+ limit?: number;
1895
+ }
1896
+ /** An operator's terminal decision on an order stuck in `needs_review`.
1897
+ * Read-only for a creator: the resolution is made through the platform's
1898
+ * admin surface, never through this client. */
1899
+ interface HubNumberResolution {
1900
+ action: "release" | "settle" | "abandon";
1901
+ operator: string;
1902
+ reason: string;
1903
+ at: number;
1904
+ /** Present while the operator's action is still running. The decision is
1905
+ * not final and the order can still return to review. */
1906
+ pending?: true;
1907
+ /** Present when a `settle` handed a live, unfinished order back to
1908
+ * provisioning, so the order is working again rather than closed. */
1909
+ requeued?: true;
1910
+ }
1911
+ interface HubNumberOrder {
1912
+ id: string;
1913
+ clientReference: string;
1914
+ transport: "sms" | "imessage";
1915
+ status: "pending" | "provider_pending" | "needs_review" | "ready_for_setup" | "cancelled";
1916
+ phase: "identity" | "number" | "credential" | "connection" | "complete";
1917
+ address: string | null;
1918
+ connectionId: string | null;
1919
+ identityId: string | null;
1920
+ providerNumberId: string | null;
1921
+ billingStatus: "unreserved" | "reserved" | "settled" | "released";
1922
+ cancellation: "none" | "requested" | "needs_review" | "released" | "abandoned";
1923
+ errorCode: string | null;
1924
+ nextAttemptAt: number | null;
1925
+ resolution: HubNumberResolution | null;
1926
+ deliveryVerified: false;
1927
+ activationCents: number;
1928
+ currency: "usd";
1929
+ terms: string;
1930
+ }
1931
+ /** Administrative number operations through Hub's authenticated transport.
1932
+ * A mutation is one attempt; an uncertain create reuses its quote and reference. */
1933
+ declare class HubManagedNumbersClient {
1934
+ private readonly request;
1935
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1936
+ readiness(): Promise<HubNumberReadiness>;
1937
+ /** One page of orders. Scope by `clientReference` to ask about one binding,
1938
+ * and follow `nextCursor` for the rest; a page is never ownership evidence. */
1939
+ list(query?: HubNumberListQuery): Promise<HubNumberOrderPage>;
1940
+ get(id: string): Promise<{
1941
+ order: HubNumberOrder;
1942
+ }>;
1943
+ quote(input: {
1944
+ transport: "sms" | "imessage";
1945
+ clientReference: string;
1946
+ }): Promise<{
1947
+ quote: HubNumberQuote;
1948
+ }>;
1949
+ /** `clientReference` and `transport`, when given, must match the signed
1950
+ * quote or Hub refuses the purchase with a conflict. */
1951
+ create(input: {
1952
+ quoteToken: string;
1953
+ consent: true;
1954
+ state?: string;
1955
+ clientReference?: string;
1956
+ transport?: "sms" | "imessage";
1957
+ }): Promise<{
1958
+ order: HubNumberOrder;
1959
+ }>;
1960
+ /** Fences references so no order can take them again. Call it as the last
1961
+ * step before retiring the resource they name: a purchase that races the
1962
+ * retirement is then refused (`409 number_reference_fenced`) instead of
1963
+ * binding a line to a resource that is gone. Refused with
1964
+ * `409 number_reference_held` while a live order holds one of them; cancel
1965
+ * it first. A cancelled order no longer holds its reference, so the fence
1966
+ * succeeds as soon as `cancel` returns, whether or not its release is still
1967
+ * pending. Repeating a fence is harmless. */
1968
+ fence(input: {
1969
+ clientReferences: string[];
1970
+ }): Promise<{
1971
+ clientReferences: string[];
1972
+ }>;
1973
+ advance(id: string): Promise<{
1974
+ order: HubNumberOrder;
1975
+ }>;
1976
+ cancel(id: string): Promise<{
1977
+ order: HubNumberOrder;
1978
+ }>;
1979
+ private path;
1980
+ private post;
1981
+ }
1982
+ //#endregion
1983
+ //#region src/transport.d.ts
1984
+ type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
1985
+ interface HubClientOptions {
1986
+ baseUrl: string;
1987
+ apiKey?: string;
1988
+ authHeaders?: HubAuthHeaders;
1989
+ fetch?: typeof fetch;
1990
+ }
1991
+ declare class HubSdkError extends Error {
1992
+ readonly code: HubErrorBody["code"];
1993
+ readonly details?: unknown;
1994
+ readonly status?: number;
1995
+ constructor(error: HubErrorBody, options?: {
1996
+ status?: number;
1997
+ });
1998
+ }
1999
+ declare class HubTransport {
2000
+ #private;
2001
+ readonly baseUrl: string;
2002
+ readonly fetch: typeof fetch;
2003
+ readonly authHeaders?: HubAuthHeaders;
2004
+ constructor(options: HubClientOptions);
2005
+ /** The API key this client authenticates with, when it has one. */
2006
+ get apiKey(): string | undefined;
2007
+ protected request<TData>(path: string, init: RequestInit, options?: {
2008
+ auth?: "client" | "caller";
2009
+ validateData?: (data: unknown) => data is TData;
2010
+ }): Promise<TData>;
2011
+ protected buildHeaders(headers: HeadersInit | undefined, callerAuth?: boolean): Promise<Headers>;
2012
+ }
2013
+ /** Domain clients receive the existing envelope transport as one request function. */
2014
+ type HubRequest = <TData>(path: string, init: RequestInit) => Promise<TData>;
2015
+ type HubStreamRequest = (path: string, init: RequestInit) => Promise<ReadableStream<Uint8Array>>;
2016
+ type HubArtifactRequest = (path: string, init: RequestInit) => Promise<HubWorkflowArtifactDownload>;
2017
+ /** Whether an error is the hub's "this credential is not accepted" answer. */
2018
+ declare function isHubUnauthenticated(error: unknown): boolean;
2019
+ //#endregion
2020
+ //#region src/environment.d.ts
2021
+ declare const HUB_URL_ENV_VAR: "TANGLE_HUB_URL";
2022
+ declare const HUB_API_KEY_ENV_VAR: "TANGLE_API_KEY";
2023
+ declare const HUB_CAPABILITY_TOKEN_ENV_VAR: "TANGLE_HUB_CAPABILITY_TOKEN";
2024
+ type HubEnv = Record<string, string | undefined>;
2025
+ interface HubClientFromEnvOptions {
2026
+ env?: HubEnv;
2027
+ apiKey?: string;
2028
+ authHeaders?: HubAuthHeaders;
2029
+ fetch?: typeof fetch;
2030
+ }
2031
+ declare function resolveHubBaseUrl(env?: HubEnv): string;
2032
+ declare function resolveHubAuth(env?: HubEnv): string;
2033
+ //#endregion
2034
+ //#region src/authorization.d.ts
2035
+ interface HubTokenListOptions {
2036
+ includeExpired?: boolean;
2037
+ }
2038
+ declare class HubTokensClient {
2039
+ private readonly request;
2040
+ constructor(request: HubRequest);
2041
+ mint(options: {
2042
+ actionPath: string;
2043
+ connectionId?: string;
2044
+ provider?: string;
2045
+ ttlSeconds?: number;
2046
+ }): Promise<HubTokenMintResponse>;
2047
+ list(options?: HubTokenListOptions): Promise<HubTokensListResponse>;
2048
+ revoke(tokenId: string): Promise<HubTokenRevokeResponse>;
2049
+ }
2050
+ declare class HubPermissionsClient {
2051
+ private readonly request;
2052
+ constructor(request: HubRequest);
2053
+ list(connectionId: string): Promise<HubPolicyListResponse>;
2054
+ set(input: HubPolicyUpdateRequest): Promise<HubPolicyResponse>;
2055
+ /** Reset an action to its default by deleting any stored override. */
2056
+ delete(input: HubPolicyDeleteRequest): Promise<HubPolicyDeleteResponse>;
2057
+ /** Bulk-allow every write action of a connection's provider. Reads are
2058
+ * already allowed for sandbox agents; destructive actions stay `ask`.
2059
+ * Idempotent: actions with an existing policy are left untouched. */
2060
+ allowWrites(connectionId: string): Promise<HubAllowWritesResponse>;
2061
+ /** Inverse of `allowWrites`: delete only the rows it created for this
2062
+ * connection. Manual per-action decisions are left intact. */
2063
+ revertWrites(connectionId: string): Promise<HubRevertWritesResponse>;
2064
+ }
2065
+ declare class HubApprovalsClient {
2066
+ private readonly request;
2067
+ constructor(request: HubRequest);
2068
+ list(): Promise<HubApprovalListResponse>;
2069
+ approve(approvalId: string): Promise<HubApprovalDecisionResponse>;
2070
+ deny(approvalId: string): Promise<HubApprovalDecisionResponse>;
2071
+ }
2072
+ //#endregion
2073
+ //#region src/tools.d.ts
2074
+ interface HubToolSearchOptions {
2075
+ provider?: string;
2076
+ /** Max tools to return. The server defaults to a relevance-ranked shortlist
2077
+ * (20); pass a higher value (bounded server-side) to enumerate a provider's
2078
+ * full action list, e.g. for a catalog/browse UI. The cap bounds the MERGED
2079
+ * response across sources — with no `provider` set, a low limit can exclude
2080
+ * some providers' tools, so scope by `provider` when you need one connector's
2081
+ * complete list. */
2082
+ limit?: number;
2083
+ }
2084
+ interface HubToolInvokeOptions {
2085
+ connectionId?: string;
2086
+ approve?: boolean;
2087
+ /** Caller-minted key for this invoke. On the direct exec arm the platform
2088
+ * ledger replays the first call's result for a retry that carries the same
2089
+ * key, and refuses a key bound to a different request. The approval and
2090
+ * capability-token retries re-send the key, and the connector receives it
2091
+ * for provider-native dedupe. Capability-token execution stays at-most-once
2092
+ * per token: it refuses a replay instead of replaying a stored result. */
2093
+ idempotencyKey?: string;
2094
+ }
2095
+ declare class HubToolsClient {
2096
+ private readonly request;
2097
+ constructor(request: HubRequest);
2098
+ search(query: string, options?: HubToolSearchOptions): Promise<HubToolsSearchResponse>;
2099
+ sources(): Promise<HubToolSourcesResponse>;
2100
+ describe(path: string): Promise<HubToolsDescribeResponse>;
2101
+ /**
2102
+ * Run one hub tool. `raw` is the tool input: the SDK forwards it verbatim as
2103
+ * the request body's `input`, and the server validates it against the tool's
2104
+ * own schema, so the client never gives it a shape.
2105
+ */
2106
+ invoke<TResult = unknown>(path: string, raw: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
2107
+ private buildExecInit;
2108
+ }
2109
+ //#endregion
2110
+ //#region src/inbound-webhooks.d.ts
2111
+ /** Provider setup uses the existing authenticated Hub transport and vault. */
2112
+ interface HubInboundWebhookCreateOptions {
2113
+ /** Inkbox identity that owns all selected channels. */
2114
+ identityId?: string;
2115
+ mailboxId?: string;
2116
+ phoneNumberId?: string;
2117
+ imessage?: boolean;
2118
+ /** Linq: explicit owned lines; omitted does not mean every account line. */
2119
+ phoneNumbers?: string[];
2120
+ /** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
2121
+ phoneNumberIds?: string[];
2122
+ /** Contiguity Console secret, or an existing Inkbox identity signing key. */
2123
+ signingSecret?: string;
2124
+ }
2125
+ interface HubInboundWebhookCreateResponse {
2126
+ url: string;
2127
+ /** True only when the provider subscription was created by the server. */
2128
+ provisioned?: boolean;
2129
+ /** Self-configured legacy providers can return a newly minted secret once. */
2130
+ secret?: string;
2131
+ inboundAddress?: string;
2132
+ requiresProviderSetup?: boolean;
2133
+ }
2134
+ interface HubInboundWebhookStatus {
2135
+ configured: boolean;
2136
+ url?: string;
2137
+ /** Configuration is not evidence of a real delivered message. */
2138
+ deliveryVerified: false;
2139
+ requiresProviderSetup?: boolean;
2140
+ }
2141
+ /** Live provider readback for one explicitly selected Linq WhatsApp number. */
2142
+ interface HubInboundPhoneNumberScope {
2143
+ configured: true;
2144
+ provisioned: true;
2145
+ subscribed: true;
2146
+ phoneNumberIds: string[];
2147
+ }
2148
+ declare class HubInboundWebhooksClient {
2149
+ private readonly request;
2150
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
2151
+ create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
2152
+ get(connectionId: string): Promise<HubInboundWebhookStatus>;
2153
+ /** Add one owned Linq WhatsApp number without rotating the webhook secret. */
2154
+ ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
2155
+ /** Remove event subscriptions first. This does not silently rotate a live URL. */
2156
+ delete(connectionId: string): Promise<{
2157
+ removed: boolean;
2158
+ }>;
2159
+ private path;
2160
+ }
2161
+ //#endregion
2162
+ //#region src/connections.d.ts
2163
+ interface HubConnectionStartOptions {
2164
+ returnUrl?: string;
2165
+ cli?: boolean;
2166
+ connectionParameters?: Record<string, string>;
2167
+ /** GitHub accepts the exact read:user, repo, read:org set. */
2168
+ requestedScopes?: readonly string[];
2169
+ }
2170
+ declare class HubConnectionsClient {
2171
+ private readonly request;
2172
+ readonly inboundWebhook: HubInboundWebhooksClient;
2173
+ constructor(request: HubRequest);
2174
+ list(): Promise<HubConnectionsResponse>;
2175
+ /** Connector catalog: every provider the hub can expose, each flagged with
2176
+ * `configured` (whether its OAuth app credentials are wired). Callers render
2177
+ * this alongside `list()` to offer Connect for not-yet-connected providers. */
2178
+ providers(): Promise<HubProvidersResponse>;
2179
+ start(provider: string, options?: HubConnectionStartOptions): Promise<HubOAuthStartResponse>;
2180
+ startWhatsappEmbeddedSignup(options?: HubWhatsappEmbeddedSignupStartRequest): Promise<HubWhatsappEmbeddedSignupStartResponse>;
2181
+ completeWhatsappEmbeddedSignup(input: HubWhatsappEmbeddedSignupCompleteRequest): Promise<HubWhatsappEmbeddedSignupCompleteResponse>;
2182
+ /** Connect a non-OAuth (api-key) connector by submitting the user's key.
2183
+ * The server validates the key with a live probe before persisting and
2184
+ * returns the created (or reconnected) connection — there is no redirect,
2185
+ * unlike `start`. Cloudbeds requires propertyId metadata and PriceLabs
2186
+ * requires listing ID/PMS pairs; other providers have no metadata. */
2187
+ connectApiKey(provider: string, apiKey: string, metadata?: HubApiKeyConnectRequest["metadata"]): Promise<HubApiKeyConnectResponse>;
2188
+ revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
2189
+ health(connectionId: string): Promise<HubConnectionHealthResponse>;
2190
+ }
2191
+ //#endregion
2192
+ //#region src/channels.d.ts
2193
+ declare class HubChannelsClient {
2194
+ private readonly request;
2195
+ constructor(request: HubRequest);
2196
+ list(): Promise<HubChannelsResponse>;
2197
+ createEmail(input?: HubEmailChannelCreateRequest): Promise<HubChannelCreateResponse>;
2198
+ delete(channelId: string): Promise<HubChannelDeleteResponse>;
2199
+ }
2200
+ declare class HubEventSubscriptionsClient {
2201
+ private readonly request;
2202
+ constructor(request: HubRequest);
2203
+ list(): Promise<HubEventSubscriptionsResponse>;
2204
+ create(input: HubEventSubscriptionCreateRequest): Promise<HubEventSubscriptionCreateResponse>;
2205
+ delete(subscriptionId: string): Promise<HubEventSubscriptionDeleteResponse>;
2206
+ }
2207
+ //#endregion
2208
+ //#region src/github-app.d.ts
2209
+ declare class HubGithubAppClient {
2210
+ private readonly request;
2211
+ constructor(request: HubRequest);
2212
+ mintInstallationToken(input: HubGithubAppMintInstallationTokenRequest): Promise<HubGithubAppMintInstallationTokenResponse>;
2213
+ /** Every installation the caller may act through — their own and any org's
2214
+ * they were verified against. The management surface's read. */
2215
+ listInstallations(): Promise<HubGithubAppListInstallationsResponse>;
2216
+ /**
2217
+ * Find installations `listInstallations` cannot show: the hub only registers
2218
+ * what the setup redirect witnessed, so an org install approved out of band —
2219
+ * or created by another member — is invisible until this asks GitHub for it.
2220
+ * Links whatever the caller can prove access to; never uninstalls anything.
2221
+ */
2222
+ syncInstallations(): Promise<HubGithubAppSyncResponse>;
2223
+ /** Give up THIS caller's access. Not an uninstall — the installation is
2224
+ * account-level and other members may still be using it. */
2225
+ disconnectInstallation(installationId: number): Promise<HubGithubAppDisconnectResponse>;
2226
+ getInstallation(installationId: number): Promise<HubGithubAppInstallationResponse>;
2227
+ listRepos(installationId: number): Promise<HubGithubAppListReposResponse>;
2228
+ isRepoInstalled(input: {
2229
+ owner: string;
2230
+ repo: string;
2231
+ }): Promise<HubGithubAppIsRepoInstalledResponse>;
2232
+ }
2233
+ //#endregion
2234
+ //#region src/audit.d.ts
2235
+ declare class HubAuditClient {
2236
+ private readonly request;
2237
+ constructor(request: HubRequest);
2238
+ list(options?: HubAuditListRequest): Promise<HubAuditResponse>;
2239
+ }
2240
+ //#endregion
2241
+ //#region src/workflows-kv.d.ts
2242
+ /** The workflow's durable keyspace, shared by all its runs. */
2243
+ declare class WorkflowKvResource {
2244
+ protected readonly request: HubRequest;
2245
+ constructor(request: HubRequest);
2246
+ /**
2247
+ * The workflow's whole keyspace as metadata (key, version, updatedAt — never
2248
+ * values), key-ordered. Bounded by the server's per-workflow key cap.
2249
+ */
2250
+ listKv(id: string): Promise<HubWorkflowKvListResponse>;
2251
+ /** One KV entry (value + version); `HubSdkError(NOT_FOUND)` when absent. */
2252
+ getKv(id: string, key: string): Promise<HubWorkflowKvEntry>;
2253
+ /**
2254
+ * Upsert a key; returns the entry with its NEW version (increments on every
2255
+ * write). Throws `HubSdkError(KV_VALUE_TOO_LARGE)` past the 64KiB value cap
2256
+ * or `KV_KEY_LIMIT` past the per-workflow key cap. `raw` is the caller's
2257
+ * value, stored and read back verbatim, so the client never gives it a shape.
2258
+ */
2259
+ putKv(id: string, key: string, raw: unknown): Promise<HubWorkflowKvEntry>;
2260
+ /**
2261
+ * Compare-and-swap: the write lands only when the stored version still
2262
+ * equals `expectedVersion`; otherwise `HubSdkError(KV_VERSION_CONFLICT)`
2263
+ * (409) — re-read and retry. Creation is {@link putKv}'s job. `raw` is the
2264
+ * caller's value, stored and read back verbatim, so the client never gives it
2265
+ * a shape.
2266
+ */
2267
+ casKv(id: string, key: string, expectedVersion: number, raw: unknown): Promise<HubWorkflowKvEntry>;
2268
+ /** Delete a key; idempotent — `deleted` reports whether a row was removed. */
2269
+ deleteKv(id: string, key: string): Promise<HubWorkflowKvDeleteResponse>;
2270
+ }
2271
+ //#endregion
2272
+ //#region src/workflows.d.ts
2273
+ declare class HubWorkflowsClient extends WorkflowKvResource {
2274
+ private readonly stream?;
2275
+ private readonly download?;
2276
+ constructor(request: HubRequest, stream?: HubStreamRequest | undefined, download?: HubArtifactRequest | undefined);
2277
+ list(): Promise<HubWorkflow[]>;
2278
+ /**
2279
+ * Owner-wide fleet overview: one row per workflow with its run tallies over
2280
+ * a trailing window (default 7d), sorted failing-first. Answers "how are ALL
2281
+ * my workflows doing" in one call — the per-workflow insights endpoint is
2282
+ * the drill-down, not a way to build this row set client-side.
2283
+ */
2284
+ fleetInsights(opts?: {
2285
+ window?: HubWorkflowFleetWindow;
2286
+ }): Promise<HubWorkflowFleetInsights>;
2287
+ get(id: string): Promise<HubWorkflow>;
2288
+ create(yaml: string): Promise<HubWorkflow>;
2289
+ /**
2290
+ * Replace the workflow's definition from YAML (recompiled server-side,
2291
+ * triggers reconciled). Every landed update appends a revision;
2292
+ * `opts.note` rides onto that revision row (e.g. "why this change"), visible
2293
+ * in {@link listRevisions}. Throws `HubSdkError`: `WORKFLOW_INVALID` when the
2294
+ * YAML doesn't compile or its connections aren't met, `CONFLICT` on a
2295
+ * concurrent modification, `NOT_FOUND` for an unknown/foreign id.
2296
+ */
2297
+ update(id: string, yaml: string, opts?: {
2298
+ note?: string;
2299
+ }): Promise<HubWorkflow>;
2300
+ delete(id: string): Promise<void>;
2301
+ /**
2302
+ * Enable or disable a workflow without editing its YAML. Works even when the
2303
+ * workflow's connection was revoked (a disabled workflow can't be recompiled
2304
+ * via `update`, but it can still be paused/resumed here).
2305
+ */
2306
+ setEnabled(id: string, enabled: boolean): Promise<HubWorkflow>;
2307
+ /**
2308
+ * One page of run history, newest first. Pass the previous page's
2309
+ * `nextCursor` to fetch the next; a null `nextCursor` means the last page.
2310
+ */
2311
+ listRuns(id: string, opts?: {
2312
+ limit?: number;
2313
+ cursor?: string;
2314
+ }): Promise<HubWorkflowRunsPage>;
2315
+ /**
2316
+ * Enqueue an immediate ("Run now") run and return its `runId`. The run goes
2317
+ * through the identical execution path a trigger delivery uses.
2318
+ *
2319
+ * `inputs` supplies the trigger fields the workflow reads (its
2320
+ * {@link HubWorkflow.manualRunInputs}), as a flat `{ path: value }` map — e.g.
2321
+ * `{ "pull_request.number": "123" }`. Omit it for a one-click run of a
2322
+ * workflow that reads no trigger fields. Throws `HubSdkError`:
2323
+ * `MISSING_RUN_INPUTS` when a required field is absent (`details.missing`
2324
+ * names them), `NOT_FOUND` for an unknown/foreign id. A paused workflow
2325
+ * still runs once; pausing only stops its triggers. Pass `opts.signal` to
2326
+ * abort a slow request.
2327
+ */
2328
+ run(id: string, inputs?: HubWorkflowRunInputs, opts?: {
2329
+ signal?: AbortSignal;
2330
+ }): Promise<HubWorkflowRunEnqueued>;
2331
+ /**
2332
+ * A single run's full detail: per-action `output` + `agentRun` execution
2333
+ * detail (size-capped server-side) and the trigger context — the deep "why
2334
+ * did this run do what it did" view. `NOT_FOUND` when the run is unknown or
2335
+ * does not belong to both the caller and this workflow.
2336
+ */
2337
+ getRun(id: string, runId: string, opts?: {
2338
+ signal?: AbortSignal;
2339
+ }): Promise<HubWorkflowRunDetail>;
2340
+ /**
2341
+ * Stop a queued or in-flight run. A `queued` run is cancelled synchronously
2342
+ * and comes back `{ status: "cancelled" }` (already terminal); a `running` run
2343
+ * is signalled to abort and comes back `{ status: "cancelling", signalled }` —
2344
+ * it settles `cancelled` a moment later as its current action tears down, which
2345
+ * a {@link watchRun}/{@link getRun} observes. Throws `HubSdkError`:
2346
+ * `RUN_NOT_CANCELLABLE` when the run already finished, `NOT_FOUND` for an
2347
+ * unknown/foreign run id. Pass `opts.signal` to abort a slow request.
2348
+ */
2349
+ cancel(id: string, runId: string, opts?: {
2350
+ signal?: AbortSignal;
2351
+ }): Promise<HubWorkflowRunCancelResult>;
2352
+ /**
2353
+ * Re-run a terminal failed/cancelled run: enqueues a FRESH run of the same
2354
+ * workflow with the SAME trigger context the original ran against, linked
2355
+ * back to it via `retriedFromRunId`. The original row is never mutated —
2356
+ * execution is at-most-once, so a retry is always a new run, never a
2357
+ * requeue. The response carries the NEW run id (and the run it retried);
2358
+ * follow it with {@link getRun}/{@link watchRun}/{@link waitForRun} like any
2359
+ * other run. Throws `HubSdkError`: `RUN_NOT_RETRYABLE` when the run is not
2360
+ * terminal-failed/cancelled (queued/running/waiting, or succeeded),
2361
+ * `NOT_FOUND` for an unknown/foreign run id; a workflow paused since the
2362
+ * failure still retries. Pass `opts.signal` to abort a slow request.
2363
+ */
2364
+ retryRun(id: string, runId: string, opts?: {
2365
+ signal?: AbortSignal;
2366
+ }): Promise<HubWorkflowRunRetried>;
2367
+ /**
2368
+ * Stream a run's live progress as an async iterable of typed events. The
2369
+ * first event is always a `snapshot` of the current persisted state; then
2370
+ * `action.*` / `iteration.*` / `token` ticks arrive as the run executes;
2371
+ * `ping` is a keepalive; a terminal `run.done` ends the iteration. If the run
2372
+ * is already finished when the stream opens, it yields the snapshot then
2373
+ * `run.done` and completes.
2374
+ *
2375
+ * Live ticks require the worker executing the run to share the API process;
2376
+ * across instances only `snapshot` + `run.done` (from the server's terminal
2377
+ * poll) arrive — the persisted record, read via {@link getRun}, stays the
2378
+ * source of truth. Pass `signal` to cancel; iterating to `run.done` (or
2379
+ * breaking early) releases the connection.
2380
+ *
2381
+ * A stream that ends before `run.done` or `run.waiting` (the Platform is
2382
+ * restarting or handing over) is reopened after a second, as is one refused
2383
+ * with `SERVICE_DRAINING`; the reopened stream starts with a fresh
2384
+ * `snapshot`. After 30 reopens in a row that deliver nothing it throws
2385
+ * `HubSdkError(WORKFLOW_STREAM_INTERRUPTED)`.
2386
+ */
2387
+ watchRun(id: string, runId: string, opts?: {
2388
+ signal?: AbortSignal;
2389
+ }): AsyncGenerator<HubWorkflowRunStreamEvent>;
2390
+ /** One connection's events, then how it ended. */
2391
+ private watchRunOnce;
2392
+ /**
2393
+ * Poll {@link getRun} until the run reaches a terminal state (`succeeded` or
2394
+ * `failed`) and return its detail. The scripting primitive behind "run and
2395
+ * print the result": pairs with {@link run} for a one-call trigger-and-wait.
2396
+ *
2397
+ * Returns as soon as the run leaves the active set (`queued` / `running`) —
2398
+ * i.e. on `succeeded`, `failed`, or any future non-active status — so a new
2399
+ * terminal state can never hang the wait. Polls every `pollIntervalMs`
2400
+ * (default 2000). With `timeoutMs` set, throws
2401
+ * `HubSdkError(WORKFLOW_RUN_TIMEOUT)` — carrying the last observed status on
2402
+ * `details.status` — only once the deadline has actually passed; the last
2403
+ * wait is clamped to the remaining time so a `timeoutMs` shorter than the
2404
+ * poll interval still waits the full requested window rather than giving up a
2405
+ * poll early. Pass `signal` to cancel the wait between polls.
2406
+ */
2407
+ waitForRun(id: string, runId: string, opts?: {
2408
+ pollIntervalMs?: number;
2409
+ timeoutMs?: number;
2410
+ signal?: AbortSignal;
2411
+ }): Promise<HubWorkflowRunDetail>;
2412
+ /**
2413
+ * The workflow's definition history, newest rev first — metadata only (rev,
2414
+ * attribution, note); fetch the YAML per-rev with {@link getRevision}. Empty
2415
+ * for a pre-versioning workflow until its next update.
2416
+ */
2417
+ listRevisions(id: string): Promise<HubWorkflowRevisionMeta[]>;
2418
+ /**
2419
+ * One revision WITH its YAML (and the actions compiled alongside it), for
2420
+ * diff/inspect views. Throws `HubSdkError(REVISION_NOT_FOUND)` for an
2421
+ * unknown rev, `NOT_FOUND` for an unknown/foreign workflow.
2422
+ */
2423
+ getRevision(id: string, rev: number): Promise<HubWorkflowRevision>;
2424
+ /**
2425
+ * Restore a prior rev's YAML as a NEW head revision (history is append-only)
2426
+ * through the same compile path as {@link update}, so the restored definition
2427
+ * is re-validated against today's connections/models. Throws `HubSdkError`:
2428
+ * `REVISION_NOT_FOUND` for an unknown rev, `WORKFLOW_INVALID` when the old
2429
+ * YAML no longer compiles, `CONFLICT` on a concurrent modification.
2430
+ */
2431
+ rollback(id: string, rev: number): Promise<HubWorkflow>;
2432
+ /**
2433
+ * Deterministic health stats over the workflow's last N terminal runs
2434
+ * (default 20, max 100): per-node visits/failures/cost/duration, failure
2435
+ * clusters by normalized error signature, and distillation CANDIDATES
2436
+ * (agent.run nodes with near-static outputs — labeled with their
2437
+ * measurements, never as verdicts). No model in this path.
2438
+ */
2439
+ health(id: string, opts?: {
2440
+ runs?: number;
2441
+ }): Promise<HubWorkflowHealth>;
2442
+ /**
2443
+ * One agent round's execution timeline, paged. `action` is the action's
2444
+ * `${steps[N]}` position and `iteration` the round's position in that
2445
+ * action's `iterations` — both exactly as the run detail serializes them.
2446
+ * Pass the previous page's `nextCursor` as `after` for the next page; a null
2447
+ * `nextCursor` means the round is fully read.
2448
+ */
2449
+ listRunSteps(id: string, runId: string, input: {
2450
+ action: number;
2451
+ iteration: number;
2452
+ after?: number;
2453
+ limit?: number;
2454
+ }): Promise<HubWorkflowRunStepsPage>;
2455
+ /**
2456
+ * Store one artifact for a run (raw bytes) and return the opaque ref — the
2457
+ * value a script.run node returns as its step output. `contentType` defaults
2458
+ * to `application/octet-stream`; `nodeId` attributes the write to a graph
2459
+ * node (owner credential only — a run-scoped token binds its own node).
2460
+ * Throws `HubSdkError(ARTIFACT_TOO_LARGE)` past the server cap.
2461
+ */
2462
+ uploadArtifact(id: string, runId: string, input: {
2463
+ name: string;
2464
+ bytes: Uint8Array;
2465
+ contentType?: string;
2466
+ nodeId?: string;
2467
+ }): Promise<HubWorkflowArtifactRef>;
2468
+ /** Metadata for every artifact of the run (never the bytes), oldest first. */
2469
+ listArtifacts(id: string, runId: string): Promise<HubWorkflowArtifactsResponse>;
2470
+ /**
2471
+ * The artifact's raw bytes with their stored content type — the route every
2472
+ * `downloadUrl` attached to an `$artifact` ref in a run detail points at.
2473
+ */
2474
+ downloadArtifact(id: string, runId: string, artifactId: string): Promise<HubWorkflowArtifactDownload>;
2475
+ /** The curated starter gallery runnable on THIS deployment: metadata,
2476
+ * parameters, referenced providers, and a concrete `previewYaml` per card. */
2477
+ listTemplates(): Promise<HubWorkflowTemplate[]>;
2478
+ /**
2479
+ * One-click create from a gallery template: substitutes `parameters` into
2480
+ * the template server-side, then runs the SAME create path as
2481
+ * {@link create}. A `{ created: false }` result is NOT an error — an
2482
+ * actionable continuation listing the connections to satisfy before
2483
+ * retrying. Invalid parameters or a compile failure throw `HubSdkError`
2484
+ * (400); an unknown template id throws `NOT_FOUND`.
2485
+ */
2486
+ instantiateTemplate(templateId: string, parameters?: Record<string, string>): Promise<HubWorkflowTemplateInstantiateResult>;
2487
+ /**
2488
+ * The caller's open decisions across all workflows — the always-available
2489
+ * "pending approvals" surface. Each entry carries its workflow's name (null
2490
+ * when the workflow was deleted while the run was parked).
2491
+ */
2492
+ listPendingDecisions(): Promise<HubWorkflowPendingDecisionsResponse>;
2493
+ /**
2494
+ * The pending decision a run is parked on. Throws `HubSdkError(NOT_FOUND)`
2495
+ * when the run is unknown/foreign or holds no pending decision.
2496
+ */
2497
+ getRunDecision(id: string, runId: string): Promise<HubWorkflowDecision>;
2498
+ /**
2499
+ * Answer the decision a run is parked on and resume it from the next action.
2500
+ * `decisionId` is REQUIRED: a run can resolve one decision and re-park on the
2501
+ * next, so an answer addressed only by run could silently land on a question
2502
+ * the caller never saw — a mismatch throws `HubSdkError(DECISION_SUPERSEDED)`.
2503
+ * Other typed failures: `INVALID_CHOICE` (400), `DECISION_ALREADY_RESOLVED` /
2504
+ * `DECISION_EXPIRED` (409), `DECISION_NOT_FOUND` (404), `RUN_NOT_WAITING`
2505
+ * (409 — answered, timed out, or cancelled first).
2506
+ */
2507
+ resolveRunDecision(id: string, runId: string, input: {
2508
+ decisionId: string;
2509
+ choice: string;
2510
+ note?: string;
2511
+ }): Promise<HubWorkflowDecisionResolveResult>;
2512
+ /**
2513
+ * Dry-run a YAML definition against the platform compiler without saving it.
2514
+ *
2515
+ * `opts.structural` selects the CI mode: the platform skips its owner-scoped
2516
+ * connection/skill/profile resolution, so the verdict depends only on the
2517
+ * definition and the deployment's capabilities — identical no matter which
2518
+ * providers the calling account has connected. Use it in pipelines that
2519
+ * assert "this YAML is well-formed"; leave it off in an editor, where naming
2520
+ * the unconnected providers is the point.
2521
+ */
2522
+ validate(yaml: string, opts?: {
2523
+ structural?: boolean;
2524
+ }): Promise<HubWorkflowValidateResponse>;
2525
+ schema(): Promise<HubWorkflowSchemaResponse>;
2526
+ }
2527
+ //#endregion
2528
+ //#region src/client.d.ts
2529
+ declare class HubClient extends HubTransport {
2530
+ readonly knowledge: HubKnowledgeClient;
2531
+ readonly allowances: HubAllowancesClient;
2532
+ readonly apps: HubAppsClient;
2533
+ readonly connections: HubConnectionsClient;
2534
+ readonly channels: HubChannelsClient;
2535
+ readonly numbers: HubManagedNumbersClient;
2536
+ readonly eventSubscriptions: HubEventSubscriptionsClient;
2537
+ readonly permissions: HubPermissionsClient;
2538
+ readonly tokens: HubTokensClient;
2539
+ readonly tools: HubToolsClient;
2540
+ readonly approvals: HubApprovalsClient;
2541
+ readonly audit: HubAuditClient;
2542
+ readonly githubApp: HubGithubAppClient;
2543
+ readonly workflows: HubWorkflowsClient;
2544
+ readonly lines: HubLinesClient;
2545
+ constructor(options: HubClientOptions);
2546
+ static fromEnv(options?: HubClientFromEnvOptions): HubClient;
2547
+ status(): Promise<HubStatusResponse>;
2548
+ /**
2549
+ * Open a streaming (Server-Sent Events) response and return its raw body.
2550
+ * Shares auth-header building + `fetch` with {@link request}, but does NOT
2551
+ * buffer or JSON-parse the body — the caller consumes the stream.
2552
+ *
2553
+ * A successful stream comes back as `text/event-stream`. Anything else is an
2554
+ * error envelope (404/429/401 JSON) or a transport failure (gateway/HTML
2555
+ * page); it is surfaced the same way {@link request} surfaces errors — a
2556
+ * typed `HubSdkError` from a `{success:false}` envelope, otherwise an
2557
+ * `HUB_HTTP_<status>` transport error — rather than handed back as bogus SSE.
2558
+ */
2559
+ private stream;
2560
+ /**
2561
+ * Fetch raw (non-envelope) bytes — the artifact download route, whose 200 is
2562
+ * the artifact's own content type, not JSON. Error responses on such routes
2563
+ * are still the standard envelope, so a failure surfaces exactly like
2564
+ * {@link request}: a typed `HubSdkError` from a `{success:false}` body,
2565
+ * otherwise an `HUB_HTTP_<status>` transport error.
2566
+ */
2567
+ private requestBytes;
2568
+ }
2569
+ //#endregion
2570
+ export { HubLineScheduledSendOptions as $, HubEventDelivery as $n, HubTool as $r, HubWorkflowRunDetail as $t, HubSdkError as A, HubConnectionDeleteResponse as An, HubPrincipal as Ar, workflowConnectionRequirementKey as At, HubLineApplicationDispatchCurrentInput as B, HubProvidersResponse as Bn, HubKnowledgeRetrievalResult as Br, HubWorkflowDistillationCandidate as Bt, HUB_URL_ENV_VAR as C, HubGithubAppMintInstallationTokenResponse as Cn, HubRevertWritesResponse as Cr, HubWorkflowTemplate as Ct, resolveHubBaseUrl as D, HubApiKeyConnectResponse as Dn, HubErrorBody as Dr, HubWorkflowTrigger as Dt, resolveHubAuth as E, HubApiKeyConnectRequest as En, HubTokensListResponse as Er, HubWorkflowTemplateParameter as Et, HubNumberOrder as F, HubConnectionsResponse as Fn, HubAuditEvent as Fr, HubWorkflowDecision as Ft, HubLineMemberApplication as G, HubChannel as Gn, KnowledgeCapabilities as Gr, HubWorkflowFleetWindow as Gt, HubLineContext as H, HubWhatsappEmbeddedSignupCompleteResponse as Hn, KnowledgeAttachment as Hr, HubWorkflowFailureCluster as Ht, HubNumberOrderPage as I, HubOAuthConnectionParameter as In, HubAuditListRequest as Ir, HubWorkflowDecisionOnTimeout as It, HubLineProviderDelivery as J, HubChannelsResponse as Jn, KnowledgeReference as Jr, HubWorkflowOnErrorOutcome as Jt, HubLineMemberApplicationInput as K, HubChannelCreateResponse as Kn, KnowledgeCapability as Kr, HubWorkflowHealth as Kt, HubNumberQuote as L, HubOAuthStartResponse as Ln, HubAuditResponse as Lr, HubWorkflowDecisionResolveResult as Lt, isHubUnauthenticated as M, HubConnectionHealthInfo as Mn, HubStatusConnections as Mr, HubAgentRunDetail as Mt, HubManagedNumbersClient as N, HubConnectionHealthResponse as Nn, HubStatusResponse as Nr, HubWorkflowActionResult as Nt, HubAuthHeaders as O, HubApiKeyConnectionMetadata as On, HubErrorCode as Or, HubWorkflowValidateResponse as Ot, HubNumberListQuery as P, HubConnectionHealthStatus as Pn, HubSuccessEnvelope as Pr, HubWorkflowAgentStep as Pt, HubLineReplyCodeInput as Q, HubEventConditionScalar as Qn, HubExecResponse as Qr, HubWorkflowRunCancelResult as Qt, HubNumberReadiness as R, HubProvider as Rn, HubKnowledgeClient as Rr, HubWorkflowDecisionResolvedVia as Rt, HUB_CAPABILITY_TOKEN_ENV_VAR as S, HubAllowancesClient as Si, HubGithubAppMintInstallationTokenRequest as Sn, HubPolicyUpdateRequest as Sr, HubWorkflowSchemaResponse as St, HubEnv as T, HubGithubAppSyncedInstallation as Tn, HubTokenRevokeResponse as Tr, HubWorkflowTemplateInstantiateResult as Tt, HubLineImage as U, HubWhatsappEmbeddedSignupStartRequest as Un, KnowledgeAttachmentAuthorization as Ur, HubWorkflowFleetEntry as Ut, HubLineCheckinOptions as V, HubWhatsappEmbeddedSignupCompleteRequest as Vn, HubKnowledgeManagementClient as Vr, HubWorkflowEdgeVerdicts as Vt, HubLineMember as W, HubWhatsappEmbeddedSignupStartResponse as Wn, KnowledgeAuthorization as Wr, HubWorkflowFleetInsights as Wt, HubLineReminderReceipt as X, HubEmailChannelCreateRequest as Xn, KnowledgeSourceInput as Xr, HubWorkflowPendingDecisionsResponse as Xt, HubLineReminderInput as Y, HubEmailChannel as Yn, KnowledgeSourceCreate as Yr, HubWorkflowPendingDecision as Yt, HubLineReplyCode as Z, HubEventCondition as Zn, KnowledgeSourceSummary as Zr, HubWorkflowRun as Zt, HubApprovalsClient as _, HubAllowanceSubject as _i, HubGithubAppInstallationResponse as _n, HubPolicyDecision as _r, HubWorkflowProposal as _t, HubChannelsClient as a, HubApp as ai, HubWorkflowRunStreamEvent as an, HubEventSubscriptionFilter as ar, HubWorkflowArtifactRef as at, HubTokensClient as b, HubAllowanceTier as bi, HubGithubAppListReposResponse as bn, HubPolicyListResponse as br, HubWorkflowRevisionSource as bt, HubConnectionsClient as c, HubAppCreateInput as ci, HubWorkflowCondition as cn, HubProviderEvent as cr, HubWorkflowKvEntry as ct, HubInboundWebhookCreateResponse as d, HubAppsClient as di, HubWorkflowGraphEdge as dn, HubApprovalCapabilityToken as dr, HubManualRunInput as dt, HubToolRisk as ei, HubWorkflowRunEnqueued as en, HubEventSubscription as er, HubLineSendInput as et, HubInboundWebhookStatus as f, HubAllowanceDecision as fi, HubWorkflowGraphJoinRule as fn, HubApprovalDecisionResponse as fr, HubWorkflow as ft, HubToolsClient as g, HubAllowanceRole as gi, HubGithubAppInstallation as gn, HubPolicy as gr, HubWorkflowHookEndpoint as gt, HubToolSearchOptions as h, HubAllowancePlanInput as hi, HubGithubAppDisconnectResponse as hn, HubCapabilityToken as hr, HubWorkflowEventFilter as ht, HubGithubAppClient as i, HubToolsSearchResponse as ii, HubWorkflowRunStepsPage as in, HubEventSubscriptionDeleteResponse as ir, HubWorkflowArtifactDownload as it, HubTransport as j, HubConnectionHealthError as jn, HubPrincipalKind as jr, HubAgentIterationSpan as jt, HubClientOptions as k, HubConnection as kn, HubErrorEnvelope as kr, HubWorkflowValidationError as kt, HubInboundPhoneNumberScope as l, HubAppGrant as li, HubWorkflowConditionOp as ln, HubAllowWritesResponse as lr, HubWorkflowKvEntryMeta as lt, HubToolInvokeOptions as m, HubAllowancePlan as mi, HubWorkflowGraphSpec as mn, HubApprovalStatus as mr, HubWorkflowConnectionRequirement as mt, HubWorkflowsClient as n, HubToolSourcesResponse as ni, HubWorkflowRunRetried as nn, HubEventSubscriptionCreateRequest as nr, HubLinesClient as nt, HubEventSubscriptionsClient as o, HubAppComplianceClaim as oi, HubWorkflowRunSummary as on, HubEventSubscriptionSource as or, HubWorkflowArtifactsResponse as ot, HubInboundWebhooksClient as p, HubAllowanceGrant as pi, HubWorkflowGraphNode as pn, HubApprovalListResponse as pr, HubWorkflowAction as pt, HubLineOwnerSendInput as q, HubChannelDeleteResponse as qn, KnowledgeEmbeddingSpace as qr, HubWorkflowNodeHealth as qt, HubAuditClient as r, HubToolsDescribeResponse as ri, HubWorkflowRunStatus as rn, HubEventSubscriptionCreateResponse as rr, HubWorkflowArtifact as rt, HubConnectionStartOptions as s, HubAppComplianceState as si, HubWorkflowRunsPage as sn, HubEventSubscriptionsResponse as sr, HubWorkflowKvDeleteResponse as st, HubClient as t, HubToolSource as ti, HubWorkflowRunInputs as tn, HubEventSubscriptionCallback as tr, HubLineSendReceipt as tt, HubInboundWebhookCreateOptions as u, HubAppGrantRevoked as ui, HubWorkflowConditionScalar as un, HubApproval as ur, HubWorkflowKvListResponse as ut, HubPermissionsClient as v, HubAllowanceSyncInput as vi, HubGithubAppIsRepoInstalledResponse as vn, HubPolicyDeleteRequest as vr, HubWorkflowRevision as vt, HubClientFromEnvOptions as w, HubGithubAppSyncResponse as wn, HubTokenMintResponse as wr, HubWorkflowTemplateCategory as wt, HUB_API_KEY_ENV_VAR as x, HubAllowanceUsage as xi, HubGithubAppManagedInstallation as xn, HubPolicyResponse as xr, HubWorkflowRevisionStatus as xt, HubTokenListOptions as y, HubAllowanceSyncReceipt as yi, HubGithubAppListInstallationsResponse as yn, HubPolicyDeleteResponse as yr, HubWorkflowRevisionMeta as yt, HubNumberResolution as z, HubProviderAuthKind as zn, HubKnowledgeQueryResult as zr, HubWorkflowDecisionStatus as zt };
2571
+ //# sourceMappingURL=client-BH3gTLjN.d.ts.map