@tangle-network/hub-sdk 0.33.1-develop.20260828203536.11e3e70 → 0.33.2

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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,553 @@
1
- //#region src/types.d.ts
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/broker.d.ts
287
+ interface HubAppBrokerOptions {
288
+ baseUrl: string;
289
+ clientId: string;
290
+ clientSecret: string;
291
+ fetch?: typeof fetch;
292
+ }
293
+ interface HubAppBrokerToken {
294
+ accessToken: string;
295
+ expiresIn: number;
296
+ scopes: string[];
297
+ }
298
+ interface HubAppBrokerExchange extends HubAppBrokerToken {
299
+ grantId: string;
300
+ connectionId: string;
301
+ }
302
+ /** Server-only client. App secrets never become a user's general API key.
303
+ * Every invocation mints and consumes one short-lived, exact-grant token. */
304
+ declare class HubAppBrokerClient {
305
+ private readonly options;
306
+ private readonly baseUrl;
307
+ private readonly fetcher;
308
+ constructor(options: HubAppBrokerOptions);
309
+ private token;
310
+ private readToken;
311
+ exchange(input: {
312
+ code: string;
313
+ redirectUri: string;
314
+ connectionId?: string;
315
+ }): Promise<HubAppBrokerExchange>;
316
+ mint(grantId: string): Promise<HubAppBrokerToken>;
317
+ invoke<T = unknown>(grantId: string, connectionId: string, actionPath: string, input: Record<string, unknown>): Promise<HubExecResponse<T>>;
318
+ }
319
+ //#endregion
320
+ //#region src/knowledge-management.d.ts
321
+ interface KnowledgeReference {
322
+ sourceId: string;
323
+ generation: string;
324
+ }
325
+ /** Connection references only. Provider credentials never enter this contract. */
326
+ interface KnowledgeEmbeddingSpace {
327
+ connectionId: string;
328
+ model: string;
329
+ dimensions: number;
330
+ }
331
+ type KnowledgeSourceInput = {
332
+ kind: "file";
333
+ name: string;
334
+ base64: string;
335
+ mediaType: string;
336
+ } | {
337
+ kind: "git";
338
+ connectionId: string;
339
+ owner: string;
340
+ repo: string;
341
+ ref: string;
342
+ pathPrefix?: string;
343
+ } | {
344
+ kind: "url";
345
+ url: string;
346
+ } | {
347
+ kind: "s3";
348
+ connectionId: string;
349
+ bucket: string;
350
+ prefix: string;
351
+ } | {
352
+ kind: "vector";
353
+ connectionId: string;
354
+ provider: "pinecone" | "qdrant" | "weaviate";
355
+ indexName: string;
356
+ namespace?: string;
357
+ embedding: KnowledgeEmbeddingSpace;
358
+ textField: string;
359
+ sourceUriField: string;
360
+ };
361
+ interface KnowledgeCapability {
362
+ supported: boolean;
363
+ reason?: string;
364
+ }
365
+ interface KnowledgeCapabilities {
366
+ delegation?: KnowledgeCapability & {
367
+ resource?: string;
368
+ scopes?: string[];
369
+ };
370
+ sources: Record<KnowledgeSourceInput["kind"], KnowledgeCapability>;
371
+ vectorProviders: Record<"pinecone" | "qdrant" | "weaviate", KnowledgeCapability>;
372
+ managedVector: KnowledgeCapability;
373
+ file: {
374
+ mediaTypes: string[];
375
+ maxBytes: number;
376
+ maxObjects: number;
377
+ };
378
+ }
379
+ interface KnowledgeSourceSummary {
380
+ /** Required query authorization, not proof that an owner policy currently permits it. */
381
+ retrieval?: {
382
+ kind: "lexical";
383
+ } | {
384
+ kind: "vector";
385
+ embeddingPolicy: {
386
+ connectionId: string;
387
+ actionPath: "openai.embeddings.create";
388
+ scope: "owner-connection-action";
389
+ };
390
+ };
391
+ id: string;
392
+ name: string;
393
+ kind: KnowledgeSourceInput["kind"];
394
+ status: "ready" | "refreshing" | "failed" | "awaiting-approval";
395
+ approval?: {
396
+ id: string;
397
+ path: string;
398
+ preview: {
399
+ provider: string;
400
+ connectionId: string;
401
+ collection: string;
402
+ sourceId: string;
403
+ requestId: string;
404
+ embedding: KnowledgeEmbeddingSpace;
405
+ chunkCount: number;
406
+ sourceCount: number;
407
+ dataSharing: string;
408
+ };
409
+ };
410
+ refreshRequestId?: string;
411
+ generation: string | null;
412
+ lastError: {
413
+ code: string;
414
+ message: string;
415
+ } | null;
416
+ updatedAt: string;
417
+ }
418
+ type KnowledgeAttachmentAuthorization = {
419
+ status: "active";
420
+ } | {
421
+ status: "unavailable";
422
+ code: "APP_CONSENT_REVOKED" | "KEY_REVOKED" | "CONNECTION_UNAVAILABLE" | "ATTACHMENT_REVOKED" | "GENERATION_UNAVAILABLE" | "RUNTIME_AUTHORITY_REVOKED";
423
+ };
424
+ interface KnowledgeAttachment {
425
+ /** Snapshot of live grant/key/connection authority, separate from durable pin state. */
426
+ authorization?: KnowledgeAttachmentAuthorization;
427
+ id: string;
428
+ sourceId: string;
429
+ sandboxId: string;
430
+ generation: string;
431
+ status: "active" | "detached";
432
+ }
433
+ interface KnowledgeSourceCreate {
434
+ requestId: string;
435
+ name: string;
436
+ source: KnowledgeSourceInput;
437
+ target?: {
438
+ kind: "lexical";
439
+ } | {
440
+ kind: "managed-vector";
441
+ provider: "qdrant";
442
+ connectionId: string;
443
+ embedding: KnowledgeEmbeddingSpace;
444
+ };
445
+ }
446
+ /** Owner-only management. Runtime tools use HubKnowledgeClient.query instead. */
447
+ interface KnowledgeAuthorization {
448
+ userId: string;
449
+ clientId: string;
450
+ resource: string;
451
+ scopes: Array<"knowledge:read" | "knowledge:write">;
452
+ }
453
+ declare class HubKnowledgeManagementClient {
454
+ private readonly request;
455
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
456
+ materialize(input: {
457
+ sandboxId: string;
458
+ references: KnowledgeReference[];
459
+ }): Promise<KnowledgeAttachment[]>;
460
+ authorization(): Promise<KnowledgeAuthorization>;
461
+ disconnectAuthorization(): Promise<{
462
+ revoked: true;
463
+ }>;
464
+ capabilities(): Promise<KnowledgeCapabilities>;
465
+ list(): Promise<KnowledgeSourceSummary[]>;
466
+ get(sourceId: string): Promise<KnowledgeSourceSummary>;
467
+ create(input: KnowledgeSourceCreate): Promise<KnowledgeSourceSummary>;
468
+ refresh(sourceId: string, input: {
469
+ requestId: string;
470
+ approvalToken?: string;
471
+ }): Promise<KnowledgeSourceSummary>;
472
+ attach(sourceId: string, input: {
473
+ sandboxId: string;
474
+ generation: string;
475
+ expectedGeneration?: string;
476
+ }): Promise<KnowledgeAttachment>;
477
+ attachments(sandboxId?: string): Promise<KnowledgeAttachment[]>;
478
+ detach(attachmentId: string): Promise<KnowledgeAttachment>;
479
+ }
480
+ //#endregion
481
+ //#region src/knowledge.d.ts
482
+ interface HubKnowledgeRetrievalResult {
483
+ attachmentId: string;
484
+ generation: string;
485
+ provenance: "ingested" | "record-supplied";
486
+ hits: Array<{
487
+ id: string;
488
+ title: string;
489
+ snippet: string;
490
+ score?: number;
491
+ citations?: Array<{
492
+ sourceId: string;
493
+ sourceUri: string;
494
+ revision?: string;
495
+ }>;
496
+ }>;
497
+ elapsedMs?: number;
498
+ }
499
+ interface HubKnowledgeQueryResult {
500
+ results: HubKnowledgeRetrievalResult[];
501
+ /** Individual unavailable sources do not hide evidence from healthy sources. */
502
+ failures: Array<{
503
+ attachmentId: string;
504
+ code: string;
505
+ message: string;
506
+ }>;
507
+ partial: boolean;
508
+ }
509
+ /** Runtime-only retrieval. The authenticated sandbox credential determines the
510
+ * scope on the server; neither a caller nor an agent can supply another scope. */
511
+ declare class HubKnowledgeClient {
512
+ private readonly request;
513
+ readonly management: HubKnowledgeManagementClient;
514
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
515
+ bindings(): Promise<{
516
+ references: KnowledgeReference[];
517
+ }>;
518
+ query(input: {
519
+ query: string;
520
+ limit?: number;
521
+ expectedReferences?: KnowledgeReference[];
522
+ }, options?: {
523
+ signal?: AbortSignal;
524
+ }): Promise<HubKnowledgeQueryResult>;
525
+ }
526
+ //#endregion
527
+ //#region src/audit-types.d.ts
528
+ interface HubAuditEvent {
529
+ id: string;
530
+ action: string;
531
+ targetUserId: string | null;
532
+ targetKeyId: string | null;
533
+ metadata: unknown;
534
+ createdAt: string;
535
+ }
536
+ interface HubAuditListRequest {
537
+ provider?: string;
538
+ action?: string;
539
+ status?: string;
540
+ since?: string;
541
+ until?: string;
542
+ cursor?: string;
543
+ limit?: number;
544
+ }
545
+ interface HubAuditResponse {
546
+ events: HubAuditEvent[];
547
+ nextCursor: string | null;
548
+ }
549
+ //#endregion
550
+ //#region src/transport-types.d.ts
2
551
  type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
3
552
  interface HubSuccessEnvelope<TData> {
4
553
  success: true;
@@ -8,13 +557,12 @@ interface HubErrorEnvelope {
8
557
  success: false;
9
558
  error: HubErrorBody;
10
559
  }
11
- type HubEnvelope<TData> = HubSuccessEnvelope<TData> | HubErrorEnvelope;
12
560
  interface HubErrorBody {
13
561
  code: HubErrorCode;
14
562
  message: string;
15
563
  details?: unknown;
16
564
  }
17
- 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" | `HUB_HTTP_${number}`;
565
+ 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}`;
18
566
  interface HubStatusResponse {
19
567
  contract: unknown;
20
568
  principal: HubPrincipal;
@@ -31,22 +579,103 @@ interface HubStatusConnections {
31
579
  connectedProviderCount: number;
32
580
  unhealthyProviderCount: number;
33
581
  }
34
- interface HubConnection {
582
+ //#endregion
583
+ //#region src/authorization-types.d.ts
584
+ interface HubTokenMintResponse {
585
+ token: string;
586
+ tokenId: string;
587
+ expiresAt: string;
588
+ }
589
+ interface HubCapabilityToken {
35
590
  id: string;
36
591
  providerId: string;
37
- displayName: string;
38
- accountDisplay: string | null;
39
- providerAccountId: string | null;
40
- scopes: string[];
41
- status: "active" | "revoked" | "unhealthy" | "reconnect_required";
42
- health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
592
+ connectionId: string;
593
+ connectionDisplay: string | null;
594
+ actionPath: string;
595
+ expiresAt: string;
596
+ status: "active" | "consumed" | "expired" | "revoked";
597
+ principalKind: HubPrincipalKind;
598
+ createdAt: string;
599
+ }
600
+ interface HubTokensListResponse {
601
+ tokens: HubCapabilityToken[];
602
+ }
603
+ interface HubTokenRevokeResponse {
604
+ tokenId: string;
605
+ status: HubCapabilityToken["status"];
606
+ }
607
+ type HubPolicyDecision = "allow" | "ask" | "deny";
608
+ interface HubPolicyUpdateRequest {
609
+ connectionId: string;
610
+ actionPath: string;
611
+ decision: HubPolicyDecision;
612
+ }
613
+ interface HubPolicyDeleteRequest {
614
+ connectionId: string;
615
+ actionPath: string;
616
+ }
617
+ interface HubPolicyDeleteResponse {
618
+ connectionId: string;
619
+ actionPath: string;
620
+ /** Whether a stored override existed and was removed (false = already default). */
621
+ deleted: boolean;
622
+ }
623
+ interface HubPolicy {
624
+ id: string;
625
+ connectionId: string;
626
+ providerId: string;
627
+ actionPath: string;
628
+ decision: HubPolicyDecision;
43
629
  createdAt: string;
44
630
  updatedAt: string;
45
- lastUsedAt: string | null;
46
631
  }
47
- interface HubConnectionsResponse {
48
- connections: HubConnection[];
632
+ interface HubPolicyResponse {
633
+ policy: HubPolicy;
634
+ }
635
+ interface HubPolicyListResponse {
636
+ policies: HubPolicy[];
637
+ }
638
+ interface HubAllowWritesResponse {
639
+ connectionId: string;
640
+ providerId: string;
641
+ /** Write actions the connection's provider exposes. */
642
+ writeActions: number;
643
+ /** Rows newly created (excludes actions that already had a policy). */
644
+ granted: number;
645
+ actionPaths: string[];
646
+ }
647
+ interface HubRevertWritesResponse {
648
+ connectionId: string;
649
+ /** `allow_writes` rows deleted. */
650
+ reverted: number;
651
+ }
652
+ type HubApprovalStatus = "pending" | "approved" | "denied" | "expired" | "consumed";
653
+ interface HubApproval {
654
+ id: string;
655
+ connectionId: string;
656
+ providerId: string;
657
+ actionPath: string;
658
+ inputHash: string;
659
+ requesterPrincipal: Record<string, unknown>;
660
+ status: HubApprovalStatus;
661
+ requestedAt: string;
662
+ expiresAt: string;
663
+ resolvedAt: string | null;
664
+ }
665
+ interface HubApprovalCapabilityToken {
666
+ tokenId: string;
667
+ token: string;
668
+ expiresAt: string;
669
+ }
670
+ interface HubApprovalDecisionResponse {
671
+ approval: HubApproval;
672
+ capabilityToken?: HubApprovalCapabilityToken;
673
+ }
674
+ interface HubApprovalListResponse {
675
+ approvals: HubApproval[];
49
676
  }
677
+ //#endregion
678
+ //#region src/channel-types.d.ts
50
679
  interface HubEmailChannel {
51
680
  id: string;
52
681
  kind: "email";
@@ -167,6 +796,24 @@ interface HubEventDelivery {
167
796
  providerEvent: HubProviderEvent;
168
797
  firedAt: string;
169
798
  }
799
+ //#endregion
800
+ //#region src/connection-types.d.ts
801
+ interface HubConnection {
802
+ id: string;
803
+ providerId: string;
804
+ displayName: string;
805
+ accountDisplay: string | null;
806
+ providerAccountId: string | null;
807
+ scopes: string[];
808
+ status: "active" | "revoked" | "unhealthy" | "reconnect_required";
809
+ health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
810
+ createdAt: string;
811
+ updatedAt: string;
812
+ lastUsedAt: string | null;
813
+ }
814
+ interface HubConnectionsResponse {
815
+ connections: HubConnection[];
816
+ }
170
817
  /** A connector's auth model. */
171
818
  type HubProviderAuthKind = "oauth2" | "api_key" | "none" | "custom";
172
819
  /** One non-secret value needed before an OAuth redirect can be built. Tenant-
@@ -218,25 +865,6 @@ interface HubProvidersResponse {
218
865
  /** Count of substrate-bundled connector manifests behind this catalog. */
219
866
  substrateBundled: number;
220
867
  }
221
- interface HubOAuthStartRequest {
222
- provider: string;
223
- returnUrl?: string;
224
- cli?: boolean;
225
- connectionParameters?: Record<string, string>;
226
- }
227
- interface HubOAuthCallbackSuccessQuery {
228
- provider: string;
229
- code: string;
230
- state: string;
231
- error?: undefined;
232
- }
233
- interface HubOAuthCallbackErrorQuery {
234
- provider: string;
235
- error: string;
236
- state: string;
237
- code?: undefined;
238
- }
239
- type HubOAuthCallbackQuery = HubOAuthCallbackSuccessQuery | HubOAuthCallbackErrorQuery;
240
868
  interface HubOAuthStartResponse {
241
869
  provider: string;
242
870
  redirectUrl: string;
@@ -253,6 +881,9 @@ interface HubWhatsappEmbeddedSignupStartResponse {
253
881
  appId: string;
254
882
  configId: string;
255
883
  sdkVersion: string;
884
+ /** Embedded Signup flow the login configuration selects. "v4" takes empty
885
+ * extras; "v2" needs featureType and sessionInfoVersion. Absent means "v2". */
886
+ signupVersion?: "v2" | "v4";
256
887
  state: string;
257
888
  expiresAt: string;
258
889
  scopes: string[];
@@ -271,34 +902,33 @@ interface HubWhatsappEmbeddedSignupCompleteResponse {
271
902
  reconnected: boolean;
272
903
  connection: HubConnection | null;
273
904
  }
274
- interface HubOAuthCallbackResponse {
275
- connectionId: string;
276
- provider: string;
277
- cli: boolean;
278
- reconnected: boolean;
279
- }
280
905
  /** Connect a non-OAuth (api-key) connector by submitting the user's key. The
281
906
  * server validates the key with a live probe before persisting; `provider` is
282
907
  * carried in the path, `apiKey` in the body. */
283
908
  interface HubApiKeyConnectRequest {
284
909
  provider: string;
285
910
  apiKey: string;
911
+ /** Connector-owned setup values. Hub validates them before testing the key. */
912
+ metadata?: HubApiKeyConnectionMetadata;
286
913
  }
914
+ type HubApiKeyConnectionMetadata = {
915
+ propertyId: string;
916
+ currency?: string;
917
+ } | {
918
+ listings: Array<{
919
+ id: string;
920
+ pms: string;
921
+ }>;
922
+ };
287
923
  /** Result of an api-key connect: the created (or reconnected) connection.
288
924
  * Synchronous — there is no redirect leg, unlike the OAuth flow. */
289
925
  interface HubApiKeyConnectResponse {
290
926
  connection: HubConnection;
291
927
  reconnected: boolean;
292
928
  }
293
- interface HubConnectionDeleteRequest {
294
- connectionId: string;
295
- }
296
929
  interface HubConnectionDeleteResponse {
297
930
  connection: HubConnection;
298
931
  }
299
- interface HubConnectionHealthRequest {
300
- connectionId: string;
301
- }
302
932
  type HubConnectionHealthStatus = "healthy" | "reconnect_required" | "unhealthy" | "rate_limited" | "unsupported";
303
933
  interface HubConnectionHealthError {
304
934
  code: string;
@@ -313,193 +943,8 @@ interface HubConnectionHealthResponse {
313
943
  connection: HubConnection;
314
944
  health: HubConnectionHealthInfo;
315
945
  }
316
- interface HubToolSource {
317
- sourceId: string;
318
- providerId: string;
319
- displayName: string;
320
- toolCount: number;
321
- connectionStatus: "connected" | "missing" | "unknown";
322
- health: "healthy" | "unhealthy" | "rate_limited" | "unknown";
323
- configured: boolean;
324
- }
325
- /** Per-tool catalog risk class. The first three mirror the platform's
326
- * `HubActionRisk`; `unknown` is surfaced honestly for tools the catalog can't
327
- * classify (substrate connectors). */
328
- type HubToolRisk = "read" | "write" | "destructive" | "unknown";
329
- interface HubTool {
330
- path: string;
331
- providerId?: string;
332
- title?: string;
333
- description?: string;
334
- inputSchema?: unknown;
335
- outputSchema?: unknown;
336
- connectionRequired?: boolean;
337
- connectionStatus?: "connected" | "missing" | "unknown";
338
- requiredConnectionProviderId?: string;
339
- policyState?: "allow" | "ask" | "deny" | "unknown";
340
- risk?: HubToolRisk;
341
- }
342
- interface HubToolSourcesResponse {
343
- sources: HubToolSource[];
344
- }
345
- interface HubToolsSearchRequest {
346
- query: string;
347
- provider?: string;
348
- }
349
- interface HubToolsSearchResponse {
350
- tools: HubTool[];
351
- }
352
- interface HubToolsDescribeRequest {
353
- path: string;
354
- }
355
- interface HubToolsDescribeResponse {
356
- tool: HubTool;
357
- }
358
- interface HubExecRequest {
359
- path: string;
360
- input?: unknown;
361
- connectionId?: string;
362
- /** Caller-minted key for this exec. The platform ledger replays the first
363
- * call's result for a retry that carries the same key, and rejects a key
364
- * reused for a different request. On the capability-token arm the key only
365
- * reaches the connector for provider-native dedupe: that arm is at-most-once
366
- * per token and replays no stored result. */
367
- idempotencyKey?: string;
368
- }
369
- interface HubExecResponse<TResult = unknown> {
370
- result: TResult;
371
- /** True when the result was replayed from a previous call with the same
372
- * idempotency key, so the action did not run again. */
373
- replayed?: boolean;
374
- }
375
- interface HubTokenMintRequest {
376
- connectionId?: string;
377
- provider?: string;
378
- actionPath: string;
379
- ttlSeconds?: number;
380
- }
381
- interface HubTokenMintResponse {
382
- token: string;
383
- tokenId: string;
384
- expiresAt: string;
385
- }
386
- interface HubCapabilityToken {
387
- id: string;
388
- providerId: string;
389
- connectionId: string;
390
- connectionDisplay: string | null;
391
- actionPath: string;
392
- expiresAt: string;
393
- status: "active" | "consumed" | "expired" | "revoked";
394
- principalKind: HubPrincipalKind;
395
- createdAt: string;
396
- }
397
- interface HubTokensListResponse {
398
- tokens: HubCapabilityToken[];
399
- }
400
- interface HubTokenRevokeResponse {
401
- tokenId: string;
402
- status: HubCapabilityToken["status"];
403
- }
404
- type HubPolicyDecision = "allow" | "ask" | "deny";
405
- interface HubPolicyUpdateRequest {
406
- connectionId: string;
407
- actionPath: string;
408
- decision: HubPolicyDecision;
409
- }
410
- interface HubPolicyListRequest {
411
- connectionId: string;
412
- }
413
- interface HubPolicyDeleteRequest {
414
- connectionId: string;
415
- actionPath: string;
416
- }
417
- interface HubPolicyDeleteResponse {
418
- connectionId: string;
419
- actionPath: string;
420
- /** Whether a stored override existed and was removed (false = already default). */
421
- deleted: boolean;
422
- }
423
- interface HubPolicy {
424
- id: string;
425
- connectionId: string;
426
- providerId: string;
427
- actionPath: string;
428
- decision: HubPolicyDecision;
429
- createdAt: string;
430
- updatedAt: string;
431
- }
432
- interface HubPolicyResponse {
433
- policy: HubPolicy;
434
- }
435
- interface HubPolicyListResponse {
436
- policies: HubPolicy[];
437
- }
438
- interface HubAllowWritesResponse {
439
- connectionId: string;
440
- providerId: string;
441
- /** Write actions the connection's provider exposes. */
442
- writeActions: number;
443
- /** Rows newly created (excludes actions that already had a policy). */
444
- granted: number;
445
- actionPaths: string[];
446
- }
447
- interface HubRevertWritesResponse {
448
- connectionId: string;
449
- /** `allow_writes` rows deleted. */
450
- reverted: number;
451
- }
452
- type HubApprovalStatus = "pending" | "approved" | "denied" | "expired" | "consumed";
453
- interface HubApproval {
454
- id: string;
455
- connectionId: string;
456
- providerId: string;
457
- actionPath: string;
458
- inputHash: string;
459
- requesterPrincipal: Record<string, unknown>;
460
- status: HubApprovalStatus;
461
- requestedAt: string;
462
- expiresAt: string;
463
- resolvedAt: string | null;
464
- }
465
- interface HubApprovalCapabilityToken {
466
- tokenId: string;
467
- token: string;
468
- expiresAt: string;
469
- }
470
- interface HubApprovalDecisionResponse {
471
- approval: HubApproval;
472
- capabilityToken?: HubApprovalCapabilityToken;
473
- }
474
- interface HubApprovalListResponse {
475
- approvals: HubApproval[];
476
- }
477
- interface HubAuditEvent {
478
- id: string;
479
- action: string;
480
- targetUserId: string | null;
481
- targetKeyId: string | null;
482
- metadata: unknown;
483
- createdAt: string;
484
- }
485
- interface HubAuditListRequest {
486
- provider?: string;
487
- action?: string;
488
- status?: string;
489
- since?: string;
490
- until?: string;
491
- cursor?: string;
492
- limit?: number;
493
- }
494
- interface HubAuditResponse {
495
- events: HubAuditEvent[];
496
- nextCursor: string | null;
497
- }
498
- interface HubUnimplementedErrorEnvelope extends HubErrorEnvelope {
499
- error: HubErrorEnvelope["error"] & {
500
- code: "HUB_NOT_IMPLEMENTED";
501
- };
502
- }
946
+ //#endregion
947
+ //#region src/github-app-types.d.ts
503
948
  interface HubGithubAppMintInstallationTokenRequest {
504
949
  /** HTTPS or SSH GitHub URL — alternative to installationId. */
505
950
  repoUrl?: string;
@@ -528,7 +973,7 @@ interface HubGithubAppInstallation {
528
973
  accountType: string | null;
529
974
  /** "all" ⇒ every repo under the account; "selected" ⇒ only repoFullNames. */
530
975
  repositorySelection: "all" | "selected";
531
- /** Lowercased "owner/repo" — empty when repositorySelection = "all". */
976
+ /** Metadata omits names; use githubApp.listRepos(id) for a live caller-safe list. */
532
977
  repoFullNames: string[];
533
978
  suspended: boolean;
534
979
  }
@@ -581,43 +1026,55 @@ interface HubGithubAppSyncResponse {
581
1026
  }
582
1027
  interface HubGithubAppListReposResponse {
583
1028
  installationId: number;
584
- /** Lowercased "owner/repo" — covers the full registry view of the install. */
1029
+ /** Complete live intersection of App coverage and the caller's GitHub access. */
585
1030
  repoFullNames: string[];
586
- }
587
- interface HubGithubAppIsRepoInstalledRequest {
588
- owner: string;
589
- repo: string;
1031
+ /** True only when both upstream listings completed; failures return an error. */
1032
+ complete: true;
590
1033
  }
591
1034
  interface HubGithubAppIsRepoInstalledResponse {
592
1035
  installed: boolean;
593
1036
  installationId: number | null;
594
1037
  }
595
- interface HubWorkflowAction {
596
- kind: string;
597
- config: Record<string, unknown>;
598
- }
599
- /** Inbound-event matcher for a `provider_event` trigger. */
600
- interface HubWorkflowEventFilter {
601
- event: string;
602
- action?: string;
603
- repo?: string;
604
- }
605
- interface HubWorkflowTrigger {
1038
+ //#endregion
1039
+ //#region src/workflow-graph-types.d.ts
1040
+ /** How a node's incoming edges release it (default `"all"` — omitted on the
1041
+ * wire for it, so specs compiled before join rules existed round-trip). */
1042
+ type HubWorkflowGraphJoinRule = "all" | "any" | "any_failed" | "all_done";
1043
+ type HubWorkflowConditionOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
1044
+ type HubWorkflowConditionScalar = string | number | boolean | null;
1045
+ /** The predicate on a guarded edge (`needs: [{ id, when }]`), evaluated by the
1046
+ * runner against the steps context on the source node's completion. */
1047
+ type HubWorkflowCondition = {
1048
+ path: string;
1049
+ op: HubWorkflowConditionOp;
1050
+ value?: HubWorkflowConditionScalar | HubWorkflowConditionScalar[];
1051
+ } | {
1052
+ all: HubWorkflowCondition[];
1053
+ } | {
1054
+ any: HubWorkflowCondition[];
1055
+ } | {
1056
+ not: HubWorkflowCondition;
1057
+ };
1058
+ interface HubWorkflowGraphNode {
606
1059
  id: string;
607
- kind: "provider_event" | "schedule" | "webhook";
608
- enabled: boolean;
609
- provider: string | null;
610
- connectionId: string | null;
611
- eventFilter: HubWorkflowEventFilter | null;
612
- cron: string | null;
613
- timezone: string | null;
614
- nextFireAt: string | null;
615
- lastFiredAt: string | null;
1060
+ index: number;
1061
+ join?: HubWorkflowGraphJoinRule;
616
1062
  }
617
- interface HubWorkflowValidationError {
618
- path: string;
619
- message: string;
1063
+ interface HubWorkflowGraphEdge {
1064
+ from: string;
1065
+ to: string;
1066
+ /** Guard the runner evaluates on the source's completion; unguarded edges
1067
+ * carry no `when`. */
1068
+ when?: HubWorkflowCondition;
1069
+ }
1070
+ /** JSON-serializable form of a validated graph (as stored on run/workflow rows). */
1071
+ interface HubWorkflowGraphSpec {
1072
+ nodes: HubWorkflowGraphNode[];
1073
+ edges: HubWorkflowGraphEdge[];
1074
+ maxNodeVisits: number;
620
1075
  }
1076
+ //#endregion
1077
+ //#region src/workflow-run-types.d.ts
621
1078
  type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
622
1079
  /** One agent iteration of an `agent.run`, as the single-run detail carries it
623
1080
  * (JSON-clean ISO timestamps) — including the round's own output `text`. */
@@ -831,6 +1288,8 @@ interface HubWorkflowRunSummary {
831
1288
  error: string | null;
832
1289
  createdAt: string;
833
1290
  completedAt: string | null;
1291
+ /** Execution start; null while queued, absent from older responses. */
1292
+ startedAt?: string | null;
834
1293
  }
835
1294
  /** One page of run history; `nextCursor` is null on the last page. */
836
1295
  interface HubWorkflowRunsPage {
@@ -866,6 +1325,160 @@ interface HubWorkflowFleetInsights {
866
1325
  windowStart: string;
867
1326
  workflows: HubWorkflowFleetEntry[];
868
1327
  }
1328
+ /** One journal completion on the wire: the node that completed and the guard
1329
+ * verdict evaluated for each of its guarded outgoing edges, keyed by edgeKey
1330
+ * (`"from->to"`). Only GUARDED edges ever appear. */
1331
+ interface HubWorkflowEdgeVerdicts {
1332
+ nodeId: string;
1333
+ verdicts: Record<string, boolean>;
1334
+ }
1335
+ /** How an action's `onError` policy handled a failure so the run continued
1336
+ * (the action itself still reads `failed`). */
1337
+ interface HubWorkflowOnErrorOutcome {
1338
+ policy: "continue" | "fallback";
1339
+ /** The recovery leaf's result when the policy ran a `{ do }` fallback. */
1340
+ fallback?: {
1341
+ kind: string;
1342
+ status: "succeeded" | "failed";
1343
+ output?: unknown;
1344
+ error?: string;
1345
+ costUsd?: number;
1346
+ };
1347
+ }
1348
+ /** One node's aggregate across the analyzed runs. */
1349
+ interface HubWorkflowNodeHealth {
1350
+ /** The author's graph node id, or `step-N` for a linear run's nodes (and for
1351
+ * a node whose run cannot be mapped back to a definition). */
1352
+ nodeId: string;
1353
+ visits: number;
1354
+ failures: number;
1355
+ /** Null when no visit carried a cost row (never a fabricated 0). */
1356
+ totalCostUsd: number | null;
1357
+ /** Null when no visit recorded duration spans. */
1358
+ avgDurationMs: number | null;
1359
+ }
1360
+ /** Failures grouped by a normalized error signature (ids/numbers/whitespace
1361
+ * stripped), most frequent first (top 5). */
1362
+ interface HubWorkflowFailureCluster {
1363
+ signature: string;
1364
+ count: number;
1365
+ sampleRunIds: string[];
1366
+ }
1367
+ /** An agent.run node whose outputs are near-static across runs — a
1368
+ * CANDIDATE for distillation, reported with its measurements, never a
1369
+ * verdict. */
1370
+ interface HubWorkflowDistillationCandidate {
1371
+ nodeId: string;
1372
+ matchRatio: number;
1373
+ samples: number;
1374
+ avgCostUsd: number | null;
1375
+ }
1376
+ interface HubWorkflowHealth {
1377
+ /** The requested window (the `runs` parameter). */
1378
+ runsWindow: number;
1379
+ /** Terminal runs that actually went into the stats. */
1380
+ runsAnalyzed: number;
1381
+ nodes: HubWorkflowNodeHealth[];
1382
+ failureClusters: HubWorkflowFailureCluster[];
1383
+ distillationCandidates: HubWorkflowDistillationCandidate[];
1384
+ }
1385
+ type HubWorkflowDecisionStatus = "pending" | "resolved" | "expired" | "cancelled";
1386
+ type HubWorkflowDecisionOnTimeout = "wait" | "fail" | "default";
1387
+ /** How the answer arrived: a UI click, a provider-channel event (e.g. a Slack
1388
+ * reaction), or the timeout policy. */
1389
+ type HubWorkflowDecisionResolvedVia = "in_app" | "channel" | "system";
1390
+ interface HubWorkflowDecision {
1391
+ id: string;
1392
+ runId: string;
1393
+ workflowId: string;
1394
+ actionIndex: number;
1395
+ title: string;
1396
+ prompt: string | null;
1397
+ options: string[];
1398
+ status: HubWorkflowDecisionStatus;
1399
+ onTimeout: HubWorkflowDecisionOnTimeout;
1400
+ defaultChoice: string | null;
1401
+ choice: string | null;
1402
+ note: string | null;
1403
+ timedOut: boolean;
1404
+ requestedAt: string;
1405
+ expiresAt: string | null;
1406
+ resolvedAt: string | null;
1407
+ /** Null while pending, and on a row settled without an answer (expired /
1408
+ * cancelled). */
1409
+ resolvedVia: HubWorkflowDecisionResolvedVia | null;
1410
+ /** `channel` answers only: the provider whose event carried the answer and
1411
+ * the raw external actor id it came from. */
1412
+ resolvedViaProvider: string | null;
1413
+ resolvedByExternalActor: string | null;
1414
+ }
1415
+ /** A pending decision on the cross-workflow list, named by its workflow
1416
+ * (null when the workflow was deleted while the run was parked). */
1417
+ interface HubWorkflowPendingDecision extends HubWorkflowDecision {
1418
+ workflowName: string | null;
1419
+ }
1420
+ interface HubWorkflowPendingDecisionsResponse {
1421
+ decisions: HubWorkflowPendingDecision[];
1422
+ }
1423
+ /** Result of resolving a decision. `resumed` is false when the resolution
1424
+ * stuck but the run could not be resumed (already terminal/cancelled). */
1425
+ interface HubWorkflowDecisionResolveResult {
1426
+ runId: string;
1427
+ decisionId: string;
1428
+ choice: string;
1429
+ resumed: boolean;
1430
+ }
1431
+ /** One step of an agent round's execution timeline (reasoning, or a tool call
1432
+ * with args + result), as the step-page endpoint serves it. */
1433
+ type HubWorkflowAgentStep = {
1434
+ kind: "reasoning";
1435
+ text: string;
1436
+ } | {
1437
+ kind: "tool"; /** Tool name, e.g. "read", "bash". */
1438
+ tool: string;
1439
+ status: "pending" | "running" | "completed" | "error"; /** Arguments the tool was called with (pretty JSON). */
1440
+ input?: string; /** Result the tool returned on success (pretty JSON / text). */
1441
+ output?: string; /** Error message when the tool failed. */
1442
+ error?: string;
1443
+ };
1444
+ /** One page of a round's step archive. `nextCursor` is the last `stepIndex`
1445
+ * held — pass it as `after` for the next page; null on the last page. */
1446
+ interface HubWorkflowRunStepsPage {
1447
+ steps: HubWorkflowAgentStep[];
1448
+ nextCursor: number | null;
1449
+ }
1450
+ //#endregion
1451
+ //#region src/workflow-definition-types.d.ts
1452
+ interface HubWorkflowAction {
1453
+ kind: string;
1454
+ config: Record<string, unknown>;
1455
+ }
1456
+ /** Inbound-event matcher for a `provider_event` trigger. */
1457
+ interface HubWorkflowEventFilter {
1458
+ event: string;
1459
+ action?: string;
1460
+ repo?: string;
1461
+ }
1462
+ interface HubWorkflowTrigger {
1463
+ id: string;
1464
+ kind: "provider_event" | "schedule" | "webhook";
1465
+ enabled: boolean;
1466
+ provider: string | null;
1467
+ connectionId: string | null;
1468
+ eventFilter: HubWorkflowEventFilter | null;
1469
+ cron: string | null;
1470
+ timezone: string | null;
1471
+ nextFireAt: string | null;
1472
+ lastFiredAt: string | null;
1473
+ /** Schedule only: the ISO-8601 instant it stops firing; null when unbounded. */
1474
+ until: string | null;
1475
+ }
1476
+ interface HubWorkflowValidationError {
1477
+ path: string;
1478
+ message: string;
1479
+ /** Machine-readable reason where one is defined, e.g. `schedule_outlives_grant`. */
1480
+ code?: string;
1481
+ }
869
1482
  interface HubWorkflow {
870
1483
  id: string;
871
1484
  name: string;
@@ -890,87 +1503,31 @@ interface HubWorkflow {
890
1503
  graph?: HubWorkflowGraphSpec | null;
891
1504
  /** Create response only, when the definition has a webhook trigger: the
892
1505
  * hook delivery URL, plus the plaintext bearer token exactly once at mint
893
- * (absent when an active token already exists — rotate to re-reveal). */
894
- hook?: HubWorkflowHookEndpoint;
895
- /** Present on the list response (latest run, or null if never run); omitted on detail. */
896
- lastRun?: HubWorkflowRunSummary | null;
897
- createdAt: string;
898
- updatedAt: string;
899
- }
900
- /** A trigger field a manual "Run now" must supply (derived from the
901
- * definition's `${trigger.*}` references). `required` is false only when every
902
- * read is wrapped in a `default(...)`. */
903
- interface HubManualRunInput {
904
- path: string;
905
- required: boolean;
906
- }
907
- type HubWorkflowValidateResponse = {
908
- valid: true;
909
- name: string;
910
- actionCount: number;
911
- triggerCount: number;
912
- } | {
913
- valid: false;
914
- errors: HubWorkflowValidationError[];
915
- };
916
- /** JSON Schema for the YAML workflow definition. */
917
- type HubWorkflowSchemaResponse = Record<string, unknown>;
918
- /** How a node's incoming edges release it (default `"all"` — omitted on the
919
- * wire for it, so specs compiled before join rules existed round-trip). */
920
- type HubWorkflowGraphJoinRule = "all" | "any" | "any_failed" | "all_done";
921
- type HubWorkflowConditionOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
922
- type HubWorkflowConditionScalar = string | number | boolean | null;
923
- /** The predicate on a guarded edge (`needs: [{ id, when }]`), evaluated by the
924
- * runner against the steps context on the source node's completion. */
925
- type HubWorkflowCondition = {
926
- path: string;
927
- op: HubWorkflowConditionOp;
928
- value?: HubWorkflowConditionScalar | HubWorkflowConditionScalar[];
929
- } | {
930
- all: HubWorkflowCondition[];
931
- } | {
932
- any: HubWorkflowCondition[];
933
- } | {
934
- not: HubWorkflowCondition;
935
- };
936
- interface HubWorkflowGraphNode {
937
- id: string;
938
- index: number;
939
- join?: HubWorkflowGraphJoinRule;
940
- }
941
- interface HubWorkflowGraphEdge {
942
- from: string;
943
- to: string;
944
- /** Guard the runner evaluates on the source's completion; unguarded edges
945
- * carry no `when`. */
946
- when?: HubWorkflowCondition;
947
- }
948
- /** JSON-serializable form of a validated graph (as stored on run/workflow rows). */
949
- interface HubWorkflowGraphSpec {
950
- nodes: HubWorkflowGraphNode[];
951
- edges: HubWorkflowGraphEdge[];
952
- maxNodeVisits: number;
953
- }
954
- /** One journal completion on the wire: the node that completed and the guard
955
- * verdict evaluated for each of its guarded outgoing edges, keyed by edgeKey
956
- * (`"from->to"`). Only GUARDED edges ever appear. */
957
- interface HubWorkflowEdgeVerdicts {
958
- nodeId: string;
959
- verdicts: Record<string, boolean>;
960
- }
961
- /** How an action's `onError` policy handled a failure so the run continued
962
- * (the action itself still reads `failed`). */
963
- interface HubWorkflowOnErrorOutcome {
964
- policy: "continue" | "fallback";
965
- /** The recovery leaf's result when the policy ran a `{ do }` fallback. */
966
- fallback?: {
967
- kind: string;
968
- status: "succeeded" | "failed";
969
- output?: unknown;
970
- error?: string;
971
- costUsd?: number;
972
- };
1506
+ * (absent when an active token already exists — rotate to re-reveal). */
1507
+ hook?: HubWorkflowHookEndpoint;
1508
+ /** Present on the list response (latest run, or null if never run); omitted on detail. */
1509
+ lastRun?: HubWorkflowRunSummary | null;
1510
+ createdAt: string;
1511
+ updatedAt: string;
1512
+ }
1513
+ /** A trigger field a manual "Run now" must supply (derived from the
1514
+ * definition's `${trigger.*}` references). `required` is false only when every
1515
+ * read is wrapped in a `default(...)`. */
1516
+ interface HubManualRunInput {
1517
+ path: string;
1518
+ required: boolean;
973
1519
  }
1520
+ type HubWorkflowValidateResponse = {
1521
+ valid: true;
1522
+ name: string;
1523
+ actionCount: number;
1524
+ triggerCount: number;
1525
+ } | {
1526
+ valid: false;
1527
+ errors: HubWorkflowValidationError[];
1528
+ };
1529
+ /** JSON Schema for the YAML workflow definition. */
1530
+ type HubWorkflowSchemaResponse = Record<string, unknown>;
974
1531
  type HubWorkflowRevisionSource = "user" | "copilot" | "intelligence";
975
1532
  /** Lifecycle state of a revision. The head rev only ever points at an
976
1533
  * `applied` revision; `proposed` is a service-token-authored suggestion
@@ -997,51 +1554,75 @@ interface HubWorkflowRevision extends HubWorkflowRevisionMeta {
997
1554
  interface HubWorkflowProposal extends HubWorkflowRevisionMeta {
998
1555
  evidence: unknown;
999
1556
  }
1000
- /** Input to {@link HubWorkflowsClient.propose}. Service-token callers only. */
1001
- interface HubWorkflowProposalInput {
1002
- yaml: string;
1003
- note?: string;
1004
- /** Proposer-supplied justification (any JSON value) — carried verbatim onto
1005
- * the revision and shown on the approval surface. */
1006
- evidence?: unknown;
1007
- }
1008
- /** One node's aggregate across the analyzed runs. */
1009
- interface HubWorkflowNodeHealth {
1010
- /** The author's graph node id, or `step-N` for a linear run's nodes (and for
1011
- * a node whose run cannot be mapped back to a definition). */
1012
- nodeId: string;
1013
- visits: number;
1014
- failures: number;
1015
- /** Null when no visit carried a cost row (never a fabricated 0). */
1016
- totalCostUsd: number | null;
1017
- /** Null when no visit recorded duration spans. */
1018
- avgDurationMs: number | null;
1557
+ type HubWorkflowTemplateCategory = "Code Review" | "Triage" | "Reports" | "Multi-agent";
1558
+ /** One author-time literal a gallery starter needs the user to supply. Every
1559
+ * declared parameter is required; `example` is a valid value that seeds the
1560
+ * form placeholder. */
1561
+ interface HubWorkflowTemplateParameter {
1562
+ key: string;
1563
+ label: string;
1564
+ type: "string" | "integer";
1565
+ help?: string;
1566
+ example: string;
1567
+ default?: string;
1568
+ defaultFrom?: "native_evaluation";
1569
+ required?: boolean;
1570
+ advanced?: boolean;
1019
1571
  }
1020
- /** Failures grouped by a normalized error signature (ids/numbers/whitespace
1021
- * stripped), most frequent first (top 5). */
1022
- interface HubWorkflowFailureCluster {
1023
- signature: string;
1024
- count: number;
1025
- sampleRunIds: string[];
1572
+ interface HubWorkflowTemplate {
1573
+ id: string;
1574
+ name: string;
1575
+ summary: string;
1576
+ category: HubWorkflowTemplateCategory;
1577
+ icon: string;
1578
+ requiresSandbox: boolean;
1579
+ /** Providers the template references (a "uses GitHub" hint), sorted. */
1580
+ providers: string[];
1581
+ parameters: HubWorkflowTemplateParameter[];
1582
+ /** The template with parameter tokens rendered to their example values. */
1583
+ previewYaml: string;
1584
+ setupNotes?: string[];
1026
1585
  }
1027
- /** An agent.run node whose outputs are near-static across runs — a
1028
- * CANDIDATE for distillation, reported with its measurements, never a
1029
- * verdict. */
1030
- interface HubWorkflowDistillationCandidate {
1031
- nodeId: string;
1032
- matchRatio: number;
1033
- samples: number;
1034
- avgCostUsd: number | null;
1586
+ /** A connection a definition needs, with where to connect it. */
1587
+ interface HubWorkflowConnectionRequirement {
1588
+ provider: string;
1589
+ connected: boolean;
1590
+ kind: "integration" | "github_app";
1591
+ /** Where to satisfy the requirement (App install flow for `github_app`,
1592
+ * integrations page otherwise); null when no target exists. */
1593
+ connectUrl: string | null;
1594
+ /** Another requirement in the same list that must be satisfied first — a
1595
+ * `github_app` install is claimed through the `github` connection, so it is
1596
+ * refused while that connection is missing. Null when nothing blocks this
1597
+ * requirement. The list is ordered prerequisite-first. */
1598
+ prerequisite: {
1599
+ provider: string;
1600
+ kind: "integration" | "github_app";
1601
+ } | null;
1035
1602
  }
1036
- interface HubWorkflowHealth {
1037
- /** The requested window (the `runs` parameter). */
1038
- runsWindow: number;
1039
- /** Terminal runs that actually went into the stats. */
1040
- runsAnalyzed: number;
1041
- nodes: HubWorkflowNodeHealth[];
1042
- failureClusters: HubWorkflowFailureCluster[];
1043
- distillationCandidates: HubWorkflowDistillationCandidate[];
1603
+ /** Stable identity shared by workflow connection requirements and prerequisite references. */
1604
+ declare function workflowConnectionRequirementKey(ref: Readonly<Pick<HubWorkflowConnectionRequirement, "provider" | "kind">>): string;
1605
+ /**
1606
+ * Result of instantiating a template. `created: false` is NOT an error — an
1607
+ * actionable continuation listing the connections to satisfy before retrying
1608
+ * the same call. Invalid parameters or a compile failure throw `HubSdkError`
1609
+ * (400) instead, matching the create route's contract.
1610
+ */
1611
+ type HubWorkflowTemplateInstantiateResult = {
1612
+ created: true;
1613
+ workflow: HubWorkflow;
1614
+ } | {
1615
+ created: false;
1616
+ connectionRequirements: HubWorkflowConnectionRequirement[];
1617
+ };
1618
+ /** A workflow's webhook delivery endpoint. `token` is the plaintext bearer —
1619
+ * revealed only at mint/rotate time (only the hash is stored). */
1620
+ interface HubWorkflowHookEndpoint {
1621
+ url: string;
1622
+ token?: string;
1044
1623
  }
1624
+ //#endregion
1625
+ //#region src/workflow-storage-types.d.ts
1045
1626
  /** One KV entry with its metadata — the get/put/cas response shape. */
1046
1627
  interface HubWorkflowKvEntry {
1047
1628
  key: string;
@@ -1093,137 +1674,347 @@ interface HubWorkflowArtifactDownload {
1093
1674
  bytes: Uint8Array;
1094
1675
  contentType: string;
1095
1676
  }
1096
- type HubWorkflowTemplateCategory = "Code Review" | "Triage" | "Reports" | "Multi-agent";
1097
- /** One author-time literal a gallery starter needs the user to supply. Every
1098
- * declared parameter is required; `example` is a valid value that seeds the
1099
- * form placeholder. */
1100
- interface HubWorkflowTemplateParameter {
1101
- key: string;
1102
- label: string;
1103
- type: "string" | "integer";
1104
- help?: string;
1105
- example: string;
1106
- }
1107
- interface HubWorkflowTemplate {
1677
+ //#endregion
1678
+ //#region src/lines.d.ts
1679
+ interface HubLineMember {
1108
1680
  id: string;
1109
- name: string;
1110
- summary: string;
1111
- category: HubWorkflowTemplateCategory;
1112
- icon: string;
1113
- requiresSandbox: boolean;
1114
- /** Providers the template references (a "uses GitHub" hint), sorted. */
1115
- providers: string[];
1116
- parameters: HubWorkflowTemplateParameter[];
1117
- /** The template with parameter tokens rendered to their example values. */
1118
- previewYaml: string;
1681
+ label: string | null;
1682
+ role: string;
1683
+ self?: boolean;
1684
+ consent?: "enabled" | "required";
1119
1685
  }
1120
- /** A connection a definition needs, with where to connect it. */
1121
- interface HubWorkflowConnectionRequirement {
1122
- provider: string;
1123
- connected: boolean;
1124
- kind: "integration" | "github_app";
1125
- /** Where to satisfy the requirement (App install flow for `github_app`,
1126
- * integrations page otherwise); null when no target exists. */
1127
- connectUrl: string | null;
1128
- /** Another requirement in the same list that must be satisfied first — a
1129
- * `github_app` install is claimed through the `github` connection, so it is
1130
- * refused while that connection is missing. Null when nothing blocks this
1131
- * requirement. The list is ordered prerequisite-first. */
1132
- prerequisite: {
1133
- provider: string;
1134
- kind: "integration" | "github_app";
1686
+ interface HubLineContext {
1687
+ self: {
1688
+ id: string;
1689
+ label: string | null;
1690
+ role: string;
1691
+ };
1692
+ line: {
1693
+ id: string;
1694
+ label: string | null;
1695
+ transport: string;
1696
+ };
1697
+ members: HubLineMember[];
1698
+ capabilities: Record<string, {
1699
+ allowed: boolean;
1700
+ reason?: string;
1701
+ }>;
1702
+ pendingReminders: Array<{
1703
+ messageId: string;
1704
+ wakeAt?: string;
1705
+ prompt: string | null;
1706
+ }>;
1707
+ quotas: {
1708
+ selfMessagesToday: number;
1709
+ selfMessagesPerDay: number;
1710
+ selfMessagesPending: number;
1711
+ selfMessagesPendingLimit: number;
1712
+ };
1713
+ }
1714
+ interface HubLineSendInput {
1715
+ toMember: string;
1716
+ text: string;
1717
+ notBefore?: string;
1718
+ onBehalfOf?: string;
1719
+ idempotencyKey?: string;
1720
+ }
1721
+ /** An asset URL safe to share with the recipient and provider. Hub never fetches it.
1722
+ * Meta WhatsApp API-key lines send it with `text` as the caption. Other transports refuse it.
1723
+ * Use public HTTPS without a query, fragment or credentials. */
1724
+ interface HubLineImage {
1725
+ url: string;
1726
+ }
1727
+ interface HubLineOwnerSendInput {
1728
+ memberId: string;
1729
+ text: string;
1730
+ image?: HubLineImage;
1731
+ notBefore?: string;
1732
+ idempotencyKey: string;
1733
+ /** Ask a coded question; the member's reply that starts with `code` returns here. */
1734
+ reply?: HubLineReplyCodeInput;
1735
+ }
1736
+ interface HubLineReplyCodeInput {
1737
+ /** A letter, then up to seven letters or digits, with at least one digit (`F7`). Hub compares it case-insensitively. */
1738
+ code: string;
1739
+ /** 60 to 604800; the window opens when the send first becomes eligible. */
1740
+ ttlSeconds: number;
1741
+ /**
1742
+ * 1 to 20 distinct texted choices, each 1-32 of `a-z 0-9 _ -` after lower-casing.
1743
+ * An answer must then be `<code> <option>[ <note>]`; any other coded text keeps the question open.
1744
+ */
1745
+ options?: string[];
1746
+ }
1747
+ /** The coded question's state on an owner send receipt. */
1748
+ interface HubLineReplyCode {
1749
+ /** Upper case. */
1750
+ code: string;
1751
+ expiresAt: string;
1752
+ /** Authoritative closure fence; absent on older Hub, never infer it from local time. */
1753
+ closed?: boolean;
1754
+ /** The first coded answer; `text` is null after content retention ends. */
1755
+ answer: {
1756
+ messageId: string;
1757
+ text: string | null;
1758
+ receivedAt: string; /** The named option, lower case; null when the send listed no options. */
1759
+ option: string | null; /** Words after the option; null when there were none or retention ended. */
1760
+ note: string | null;
1135
1761
  } | null;
1136
1762
  }
1137
- /**
1138
- * Result of instantiating a template. `created: false` is NOT an error — an
1139
- * actionable continuation listing the connections to satisfy before retrying
1140
- * the same call. Invalid parameters or a compile failure throw `HubSdkError`
1141
- * (400) instead, matching the create route's contract.
1142
- */
1143
- type HubWorkflowTemplateInstantiateResult = {
1144
- created: true;
1145
- workflow: HubWorkflow;
1146
- } | {
1147
- created: false;
1148
- connectionRequirements: HubWorkflowConnectionRequirement[];
1149
- };
1150
- type HubWorkflowDecisionStatus = "pending" | "resolved" | "expired" | "cancelled";
1151
- type HubWorkflowDecisionOnTimeout = "wait" | "fail" | "default";
1152
- /** How the answer arrived: a UI click, a provider-channel event (e.g. a Slack
1153
- * reaction), or the timeout policy. */
1154
- type HubWorkflowDecisionResolvedVia = "in_app" | "channel" | "system";
1155
- interface HubWorkflowDecision {
1763
+ interface HubLineReminderInput {
1764
+ text: string;
1765
+ notBefore: string;
1766
+ idempotencyKey: string;
1767
+ }
1768
+ interface HubLineApplicationDispatchCurrentInput {
1769
+ attachmentId: string;
1770
+ memberId: string;
1771
+ memberRevision: string;
1772
+ senderAddress: string;
1773
+ textSha256: string;
1774
+ binding: string;
1775
+ dispatchFence: string;
1776
+ dispatchDeadline: string;
1777
+ }
1778
+ interface HubLineMemberApplication {
1156
1779
  id: string;
1157
- runId: string;
1158
- workflowId: string;
1159
- actionIndex: number;
1160
- title: string;
1161
- prompt: string | null;
1162
- options: string[];
1163
- status: HubWorkflowDecisionStatus;
1164
- onTimeout: HubWorkflowDecisionOnTimeout;
1165
- defaultChoice: string | null;
1166
- choice: string | null;
1167
- note: string | null;
1168
- timedOut: boolean;
1169
- requestedAt: string;
1170
- expiresAt: string | null;
1171
- resolvedAt: string | null;
1172
- /** Null while pending, and on a row settled without an answer (expired /
1173
- * cancelled). */
1174
- resolvedVia: HubWorkflowDecisionResolvedVia | null;
1175
- /** `channel` answers only: the provider whose event carried the answer and
1176
- * the raw external actor id it came from. */
1177
- resolvedViaProvider: string | null;
1178
- resolvedByExternalActor: string | null;
1179
- }
1180
- /** A pending decision on the cross-workflow list, named by its workflow
1181
- * (null when the workflow was deleted while the run was parked). */
1182
- interface HubWorkflowPendingDecision extends HubWorkflowDecision {
1183
- workflowName: string | null;
1780
+ lineId: string;
1781
+ attachmentId: string;
1782
+ memberId: string;
1783
+ subjectId: string;
1784
+ status: "active" | "revoked";
1785
+ application: {
1786
+ url: string;
1787
+ binding: string;
1788
+ };
1789
+ /** Hub's name for the app at this callback; present on reads. */
1790
+ app?: {
1791
+ name: string;
1792
+ };
1793
+ createdAt: string;
1794
+ revokedAt: string | null;
1795
+ }
1796
+ interface HubLineMemberApplicationInput {
1797
+ expectedSelectionId: string | null;
1798
+ expectedMemberRevision: string;
1799
+ subjectId: string;
1800
+ application: {
1801
+ url: string;
1802
+ binding: string;
1803
+ secret: string;
1804
+ };
1184
1805
  }
1185
- interface HubWorkflowPendingDecisionsResponse {
1186
- decisions: HubWorkflowPendingDecision[];
1806
+ interface HubLineProviderDelivery {
1807
+ provider: "meta_whatsapp";
1808
+ messageId: string;
1809
+ acceptedAt: string;
1810
+ sentAt: string | null;
1811
+ deliveredAt: string | null;
1812
+ readAt: string | null;
1813
+ failedAt: string | null;
1814
+ failureCode: number | null;
1815
+ }
1816
+ interface HubLineSendReceipt {
1817
+ /** Absent on older Hub. Replied/accepted never implies delivered. */
1818
+ delivery?: HubLineProviderDelivery | null;
1819
+ message: {
1820
+ id: string;
1821
+ status: string;
1822
+ text: string | null;
1823
+ image?: HubLineImage;
1824
+ };
1825
+ eligibleAt: string | null;
1826
+ expiresAt: string;
1827
+ /** Null when the send asked no coded question; absent from Hub before reply codes. */
1828
+ reply?: HubLineReplyCode | null;
1829
+ }
1830
+ interface HubLineReminderReceipt {
1831
+ state: "queued" | "skipped";
1832
+ lineId: string;
1833
+ messageId?: string;
1834
+ sessionId?: string;
1835
+ completion?: string;
1836
+ reason?: string;
1837
+ }
1838
+ interface HubLineScheduledSendOptions {
1839
+ lineId: string;
1840
+ memberId: string;
1841
+ text: string;
1842
+ timezone: string;
1843
+ name?: string;
1844
+ notBefore?: string;
1845
+ /**
1846
+ * RFC 3339 instant the schedule stops at. Required when the calling key
1847
+ * expires, and no later than that expiry: a schedule never outlives the
1848
+ * key that wrote it.
1849
+ */
1850
+ until?: string;
1187
1851
  }
1188
- /** Result of resolving a decision. `resumed` is false when the resolution
1189
- * stuck but the run could not be resumed (already terminal/cancelled). */
1190
- interface HubWorkflowDecisionResolveResult {
1191
- runId: string;
1192
- decisionId: string;
1193
- choice: string;
1194
- resumed: boolean;
1852
+ interface HubLineCheckinOptions {
1853
+ lineId: string;
1854
+ member: string;
1855
+ timezone: string;
1856
+ prompt: string;
1857
+ name?: string;
1858
+ /** RFC 3339 instant the schedule stops at; see {@link HubLineScheduledSendOptions.until}. */
1859
+ until?: string;
1195
1860
  }
1196
- /** A workflow's webhook delivery endpoint. `token` is the plaintext bearer —
1197
- * revealed only at mint/rotate time (only the hash is stored). */
1198
- interface HubWorkflowHookEndpoint {
1199
- url: string;
1200
- token?: string;
1861
+ /** Line calls share HubClient authentication and envelope handling. */
1862
+ declare class HubLinesClient {
1863
+ private readonly request;
1864
+ private readonly createWorkflow;
1865
+ private readonly requestApplicationDispatchCurrent?;
1866
+ readonly members: {
1867
+ list: (lineId: string) => Promise<HubLineMember[]>;
1868
+ };
1869
+ readonly memberApplications: {
1870
+ get: (lineId: string, memberId: string) => Promise<{
1871
+ memberRevision: string;
1872
+ selection: HubLineMemberApplication | null;
1873
+ }>;
1874
+ select: (lineId: string, memberId: string, input: HubLineMemberApplicationInput) => Promise<HubLineMemberApplication>;
1875
+ clear: (lineId: string, memberId: string, input: {
1876
+ expectedSelectionId: string;
1877
+ expectedMemberRevision: string;
1878
+ }) => Promise<void>;
1879
+ };
1880
+ readonly checkins: {
1881
+ schedule: (cron: string, options: HubLineCheckinOptions) => Promise<HubWorkflow>;
1882
+ };
1883
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>, createWorkflow: (yaml: string) => Promise<HubWorkflow>, requestApplicationDispatchCurrent?: ((path: string, init: RequestInit, callbackBearer: string) => Promise<{
1884
+ current: boolean;
1885
+ }>) | undefined);
1886
+ scheduleSend(cron: string, options: HubLineScheduledSendOptions): Promise<HubWorkflow>;
1887
+ context(): Promise<HubLineContext>;
1888
+ send(lineId: string, input: HubLineSendInput | HubLineOwnerSendInput): Promise<HubLineSendReceipt>;
1889
+ /** Read an owner send's receipt, including its coded answer. Queued is not delivered. */
1890
+ sentMessage(lineId: string, messageId: string): Promise<HubLineSendReceipt>;
1891
+ remind(lineId: string, input: HubLineReminderInput): Promise<HubLineReminderReceipt>;
1892
+ applicationDispatchCurrent(lineId: string, messageId: string, input: HubLineApplicationDispatchCurrentInput, callbackBearer: string): Promise<boolean>;
1201
1893
  }
1202
- interface HubWorkflowHookToken {
1203
- url: string;
1894
+ //#endregion
1895
+ //#region src/managed-numbers.d.ts
1896
+ interface HubNumberReadiness {
1897
+ configured: boolean;
1898
+ provider: "inkbox";
1899
+ transports: Array<"sms" | "imessage">;
1900
+ billing: "prepaid_activation";
1901
+ automaticRentalBilling: false;
1902
+ deliveryVerified: false;
1903
+ }
1904
+ interface HubNumberQuote {
1905
+ transport: "sms" | "imessage";
1906
+ activationCents: number;
1907
+ currency: "usd";
1908
+ termsVersion: string;
1909
+ terms: string;
1910
+ expiresAt: number;
1911
+ /** The binding the quote was issued for. Absent from older servers. */
1912
+ clientReference?: string;
1913
+ /** Opaque. Pass it back to `create`; never decode it. */
1204
1914
  token: string;
1205
1915
  }
1206
- /** One step of an agent round's execution timeline (reasoning, or a tool call
1207
- * with args + result), as the step-page endpoint serves it. */
1208
- type HubWorkflowAgentStep = {
1209
- kind: "reasoning";
1210
- text: string;
1211
- } | {
1212
- kind: "tool"; /** Tool name, e.g. "read", "bash". */
1213
- tool: string;
1214
- status: "pending" | "running" | "completed" | "error"; /** Arguments the tool was called with (pretty JSON). */
1215
- input?: string; /** Result the tool returned on success (pretty JSON / text). */
1216
- output?: string; /** Error message when the tool failed. */
1217
- error?: string;
1218
- };
1219
- /** One page of a round's step archive. `nextCursor` is the last `stepIndex`
1220
- * held — pass it as `after` for the next page; null on the last page. */
1221
- interface HubWorkflowRunStepsPage {
1222
- steps: HubWorkflowAgentStep[];
1223
- nextCursor: number | null;
1916
+ /** One page of the owner's orders, newest first. */
1917
+ interface HubNumberOrderPage {
1918
+ orders: HubNumberOrder[];
1919
+ /** Present while more orders exist. Older servers omit it and return one
1920
+ * bounded page, so an absent cursor never proves an order does not exist. */
1921
+ nextCursor?: string | null;
1922
+ }
1923
+ interface HubNumberListQuery {
1924
+ /** Only orders requested for this binding, including closed ones. */
1925
+ clientReference?: string;
1926
+ cursor?: string;
1927
+ /** 1 to 100; the server default is 100. */
1928
+ limit?: number;
1929
+ }
1930
+ /** An operator's terminal decision on an order stuck in `needs_review`.
1931
+ * Read-only for a creator: the resolution is made through the platform's
1932
+ * admin surface, never through this client. */
1933
+ interface HubNumberResolution {
1934
+ action: "release" | "settle" | "abandon";
1935
+ operator: string;
1936
+ reason: string;
1937
+ at: number;
1938
+ /** Present while the operator's action is still running. The decision is
1939
+ * not final and the order can still return to review. */
1940
+ pending?: true;
1941
+ /** Present when a `settle` handed a live, unfinished order back to
1942
+ * provisioning, so the order is working again rather than closed. */
1943
+ requeued?: true;
1944
+ }
1945
+ interface HubNumberOrder {
1946
+ id: string;
1947
+ clientReference: string;
1948
+ transport: "sms" | "imessage";
1949
+ status: "pending" | "provider_pending" | "needs_review" | "ready_for_setup" | "cancelled";
1950
+ phase: "identity" | "number" | "credential" | "connection" | "complete";
1951
+ address: string | null;
1952
+ connectionId: string | null;
1953
+ identityId: string | null;
1954
+ providerNumberId: string | null;
1955
+ billingStatus: "unreserved" | "reserved" | "settled" | "released";
1956
+ cancellation: "none" | "requested" | "needs_review" | "released" | "abandoned";
1957
+ errorCode: string | null;
1958
+ nextAttemptAt: number | null;
1959
+ resolution: HubNumberResolution | null;
1960
+ deliveryVerified: false;
1961
+ activationCents: number;
1962
+ currency: "usd";
1963
+ terms: string;
1964
+ }
1965
+ /** Administrative number operations through Hub's authenticated transport.
1966
+ * A mutation is one attempt; an uncertain create reuses its quote and reference. */
1967
+ declare class HubManagedNumbersClient {
1968
+ private readonly request;
1969
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1970
+ readiness(): Promise<HubNumberReadiness>;
1971
+ /** One page of orders. Scope by `clientReference` to ask about one binding,
1972
+ * and follow `nextCursor` for the rest; a page is never ownership evidence. */
1973
+ list(query?: HubNumberListQuery): Promise<HubNumberOrderPage>;
1974
+ get(id: string): Promise<{
1975
+ order: HubNumberOrder;
1976
+ }>;
1977
+ quote(input: {
1978
+ transport: "sms" | "imessage";
1979
+ clientReference: string;
1980
+ }): Promise<{
1981
+ quote: HubNumberQuote;
1982
+ }>;
1983
+ /** `clientReference` and `transport`, when given, must match the signed
1984
+ * quote or Hub refuses the purchase with a conflict. */
1985
+ create(input: {
1986
+ quoteToken: string;
1987
+ consent: true;
1988
+ state?: string;
1989
+ clientReference?: string;
1990
+ transport?: "sms" | "imessage";
1991
+ }): Promise<{
1992
+ order: HubNumberOrder;
1993
+ }>;
1994
+ /** Fences references so no order can take them again. Call it as the last
1995
+ * step before retiring the resource they name: a purchase that races the
1996
+ * retirement is then refused (`409 number_reference_fenced`) instead of
1997
+ * binding a line to a resource that is gone. Refused with
1998
+ * `409 number_reference_held` while a live order holds one of them; cancel
1999
+ * it first. A cancelled order no longer holds its reference, so the fence
2000
+ * succeeds as soon as `cancel` returns, whether or not its release is still
2001
+ * pending. Repeating a fence is harmless. */
2002
+ fence(input: {
2003
+ clientReferences: string[];
2004
+ }): Promise<{
2005
+ clientReferences: string[];
2006
+ }>;
2007
+ advance(id: string): Promise<{
2008
+ order: HubNumberOrder;
2009
+ }>;
2010
+ cancel(id: string): Promise<{
2011
+ order: HubNumberOrder;
2012
+ }>;
2013
+ private path;
2014
+ private post;
1224
2015
  }
1225
2016
  //#endregion
1226
- //#region src/client.d.ts
2017
+ //#region src/transport.d.ts
1227
2018
  type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
1228
2019
  interface HubClientOptions {
1229
2020
  baseUrl: string;
@@ -1239,6 +2030,26 @@ declare class HubSdkError extends Error {
1239
2030
  status?: number;
1240
2031
  });
1241
2032
  }
2033
+ declare class HubTransport {
2034
+ #private;
2035
+ readonly baseUrl: string;
2036
+ readonly fetch: typeof fetch;
2037
+ readonly authHeaders?: HubAuthHeaders;
2038
+ constructor(options: HubClientOptions);
2039
+ /** The API key this client authenticates with, when it has one. */
2040
+ get apiKey(): string | undefined;
2041
+ protected request<TData>(path: string, init: RequestInit, options?: {
2042
+ auth?: "client" | "caller";
2043
+ validateData?: (data: unknown) => data is TData;
2044
+ }): Promise<TData>;
2045
+ protected buildHeaders(headers: HeadersInit | undefined, callerAuth?: boolean): Promise<Headers>;
2046
+ }
2047
+ /** Domain clients receive the existing envelope transport as one request function. */
2048
+ type HubRequest = <TData>(path: string, init: RequestInit) => Promise<TData>;
2049
+ type HubStreamRequest = (path: string, init: RequestInit) => Promise<ReadableStream<Uint8Array>>;
2050
+ type HubArtifactRequest = (path: string, init: RequestInit) => Promise<HubWorkflowArtifactDownload>;
2051
+ //#endregion
2052
+ //#region src/environment.d.ts
1242
2053
  declare const HUB_URL_ENV_VAR: "TANGLE_HUB_URL";
1243
2054
  declare const HUB_API_KEY_ENV_VAR: "TANGLE_API_KEY";
1244
2055
  declare const HUB_CAPABILITY_TOKEN_ENV_VAR: "TANGLE_HUB_CAPABILITY_TOKEN";
@@ -1251,53 +2062,14 @@ interface HubClientFromEnvOptions {
1251
2062
  }
1252
2063
  declare function resolveHubBaseUrl(env?: HubEnv): string;
1253
2064
  declare function resolveHubAuth(env?: HubEnv): string;
1254
- declare class HubClient {
1255
- readonly baseUrl: string;
1256
- readonly fetch: typeof fetch;
1257
- readonly apiKey?: string;
1258
- readonly authHeaders?: HubAuthHeaders;
1259
- readonly connections: HubConnectionsClient;
1260
- readonly channels: HubChannelsClient;
1261
- readonly eventSubscriptions: HubEventSubscriptionsClient;
1262
- readonly permissions: HubPermissionsClient;
1263
- readonly tokens: HubTokensClient;
1264
- readonly tools: HubToolsClient;
1265
- readonly approvals: HubApprovalsClient;
1266
- readonly audit: HubAuditClient;
1267
- readonly githubApp: HubGithubAppClient;
1268
- readonly workflows: HubWorkflowsClient;
1269
- constructor(options: HubClientOptions);
1270
- static fromEnv(options?: HubClientFromEnvOptions): HubClient;
1271
- status(): Promise<HubStatusResponse>;
1272
- private request;
1273
- /**
1274
- * Open a streaming (Server-Sent Events) response and return its raw body.
1275
- * Shares auth-header building + `fetch` with {@link request}, but does NOT
1276
- * buffer or JSON-parse the body — the caller consumes the stream.
1277
- *
1278
- * A successful stream comes back as `text/event-stream`. Anything else is an
1279
- * error envelope (404/429/401 JSON) or a transport failure (gateway/HTML
1280
- * page); it is surfaced the same way {@link request} surfaces errors — a
1281
- * typed `HubSdkError` from a `{success:false}` envelope, otherwise an
1282
- * `HUB_HTTP_<status>` transport error — rather than handed back as bogus SSE.
1283
- */
1284
- private stream;
1285
- /**
1286
- * Fetch raw (non-envelope) bytes — the artifact download route, whose 200 is
1287
- * the artifact's own content type, not JSON. Error responses on such routes
1288
- * are still the standard envelope, so a failure surfaces exactly like
1289
- * {@link request}: a typed `HubSdkError` from a `{success:false}` body,
1290
- * otherwise an `HUB_HTTP_<status>` transport error.
1291
- */
1292
- private requestBytes;
1293
- private buildHeaders;
1294
- }
2065
+ //#endregion
2066
+ //#region src/authorization.d.ts
1295
2067
  interface HubTokenListOptions {
1296
2068
  includeExpired?: boolean;
1297
2069
  }
1298
2070
  declare class HubTokensClient {
1299
2071
  private readonly request;
1300
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
2072
+ constructor(request: HubRequest);
1301
2073
  mint(options: {
1302
2074
  actionPath: string;
1303
2075
  connectionId?: string;
@@ -1309,7 +2081,7 @@ declare class HubTokensClient {
1309
2081
  }
1310
2082
  declare class HubPermissionsClient {
1311
2083
  private readonly request;
1312
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
2084
+ constructor(request: HubRequest);
1313
2085
  list(connectionId: string): Promise<HubPolicyListResponse>;
1314
2086
  set(input: HubPolicyUpdateRequest): Promise<HubPolicyResponse>;
1315
2087
  /** Reset an action to its default by deleting any stored override. */
@@ -1322,6 +2094,15 @@ declare class HubPermissionsClient {
1322
2094
  * connection. Manual per-action decisions are left intact. */
1323
2095
  revertWrites(connectionId: string): Promise<HubRevertWritesResponse>;
1324
2096
  }
2097
+ declare class HubApprovalsClient {
2098
+ private readonly request;
2099
+ constructor(request: HubRequest);
2100
+ list(): Promise<HubApprovalListResponse>;
2101
+ approve(approvalId: string): Promise<HubApprovalDecisionResponse>;
2102
+ deny(approvalId: string): Promise<HubApprovalDecisionResponse>;
2103
+ }
2104
+ //#endregion
2105
+ //#region src/tools.d.ts
1325
2106
  interface HubToolSearchOptions {
1326
2107
  provider?: string;
1327
2108
  /** Max tools to return. The server defaults to a relevance-ranked shortlist
@@ -1345,7 +2126,7 @@ interface HubToolInvokeOptions {
1345
2126
  }
1346
2127
  declare class HubToolsClient {
1347
2128
  private readonly request;
1348
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
2129
+ constructor(request: HubRequest);
1349
2130
  search(query: string, options?: HubToolSearchOptions): Promise<HubToolsSearchResponse>;
1350
2131
  sources(): Promise<HubToolSourcesResponse>;
1351
2132
  describe(path: string): Promise<HubToolsDescribeResponse>;
@@ -1357,28 +2138,71 @@ declare class HubToolsClient {
1357
2138
  invoke<TResult = unknown>(path: string, raw: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
1358
2139
  private buildExecInit;
1359
2140
  }
2141
+ //#endregion
2142
+ //#region src/inbound-webhooks.d.ts
2143
+ /** Provider setup uses the existing authenticated Hub transport and vault. */
2144
+ interface HubInboundWebhookCreateOptions {
2145
+ /** Inkbox identity that owns all selected channels. */
2146
+ identityId?: string;
2147
+ mailboxId?: string;
2148
+ phoneNumberId?: string;
2149
+ imessage?: boolean;
2150
+ /** Linq: explicit owned lines; omitted does not mean every account line. */
2151
+ phoneNumbers?: string[];
2152
+ /** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
2153
+ phoneNumberIds?: string[];
2154
+ /** Contiguity Console secret, or an existing Inkbox identity signing key. */
2155
+ signingSecret?: string;
2156
+ }
2157
+ interface HubInboundWebhookCreateResponse {
2158
+ url: string;
2159
+ /** True only when the provider subscription was created by the server. */
2160
+ provisioned?: boolean;
2161
+ /** Self-configured legacy providers can return a newly minted secret once. */
2162
+ secret?: string;
2163
+ inboundAddress?: string;
2164
+ requiresProviderSetup?: boolean;
2165
+ }
2166
+ interface HubInboundWebhookStatus {
2167
+ configured: boolean;
2168
+ url?: string;
2169
+ /** Configuration is not evidence of a real delivered message. */
2170
+ deliveryVerified: false;
2171
+ requiresProviderSetup?: boolean;
2172
+ }
2173
+ /** Live provider readback for one explicitly selected Linq WhatsApp number. */
2174
+ interface HubInboundPhoneNumberScope {
2175
+ configured: true;
2176
+ provisioned: true;
2177
+ subscribed: true;
2178
+ phoneNumberIds: string[];
2179
+ }
2180
+ declare class HubInboundWebhooksClient {
2181
+ private readonly request;
2182
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
2183
+ create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
2184
+ get(connectionId: string): Promise<HubInboundWebhookStatus>;
2185
+ /** Add one owned Linq WhatsApp number without rotating the webhook secret. */
2186
+ ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
2187
+ /** Remove event subscriptions first. This does not silently rotate a live URL. */
2188
+ delete(connectionId: string): Promise<{
2189
+ removed: boolean;
2190
+ }>;
2191
+ private path;
2192
+ }
2193
+ //#endregion
2194
+ //#region src/connections.d.ts
1360
2195
  interface HubConnectionStartOptions {
1361
2196
  returnUrl?: string;
1362
2197
  cli?: boolean;
1363
2198
  connectionParameters?: Record<string, string>;
1364
- }
1365
- declare class HubChannelsClient {
1366
- private readonly request;
1367
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1368
- list(): Promise<HubChannelsResponse>;
1369
- createEmail(input?: HubEmailChannelCreateRequest): Promise<HubChannelCreateResponse>;
1370
- delete(channelId: string): Promise<HubChannelDeleteResponse>;
1371
- }
1372
- declare class HubEventSubscriptionsClient {
1373
- private readonly request;
1374
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1375
- list(): Promise<HubEventSubscriptionsResponse>;
1376
- create(input: HubEventSubscriptionCreateRequest): Promise<HubEventSubscriptionCreateResponse>;
1377
- delete(subscriptionId: string): Promise<HubEventSubscriptionDeleteResponse>;
2199
+ /** GitHub accepts the exact read:user, repo, read:org set. */
2200
+ requestedScopes?: readonly string[];
1378
2201
  }
1379
2202
  declare class HubConnectionsClient {
1380
2203
  private readonly request;
1381
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
2204
+ readonly inboundWebhook: HubInboundWebhooksClient;
2205
+ constructor(request: HubRequest);
1382
2206
  list(): Promise<HubConnectionsResponse>;
1383
2207
  /** Connector catalog: every provider the hub can expose, each flagged with
1384
2208
  * `configured` (whether its OAuth app credentials are wired). Callers render
@@ -1390,21 +2214,33 @@ declare class HubConnectionsClient {
1390
2214
  /** Connect a non-OAuth (api-key) connector by submitting the user's key.
1391
2215
  * The server validates the key with a live probe before persisting and
1392
2216
  * returns the created (or reconnected) connection — there is no redirect,
1393
- * unlike `start`. */
1394
- connectApiKey(provider: string, apiKey: string): Promise<HubApiKeyConnectResponse>;
2217
+ * unlike `start`. Cloudbeds requires propertyId metadata and PriceLabs
2218
+ * requires listing ID/PMS pairs; other providers have no metadata. */
2219
+ connectApiKey(provider: string, apiKey: string, metadata?: HubApiKeyConnectRequest["metadata"]): Promise<HubApiKeyConnectResponse>;
1395
2220
  revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
1396
2221
  health(connectionId: string): Promise<HubConnectionHealthResponse>;
1397
2222
  }
1398
- declare class HubApprovalsClient {
2223
+ //#endregion
2224
+ //#region src/channels.d.ts
2225
+ declare class HubChannelsClient {
1399
2226
  private readonly request;
1400
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1401
- list(): Promise<HubApprovalListResponse>;
1402
- approve(approvalId: string): Promise<HubApprovalDecisionResponse>;
1403
- deny(approvalId: string): Promise<HubApprovalDecisionResponse>;
2227
+ constructor(request: HubRequest);
2228
+ list(): Promise<HubChannelsResponse>;
2229
+ createEmail(input?: HubEmailChannelCreateRequest): Promise<HubChannelCreateResponse>;
2230
+ delete(channelId: string): Promise<HubChannelDeleteResponse>;
2231
+ }
2232
+ declare class HubEventSubscriptionsClient {
2233
+ private readonly request;
2234
+ constructor(request: HubRequest);
2235
+ list(): Promise<HubEventSubscriptionsResponse>;
2236
+ create(input: HubEventSubscriptionCreateRequest): Promise<HubEventSubscriptionCreateResponse>;
2237
+ delete(subscriptionId: string): Promise<HubEventSubscriptionDeleteResponse>;
1404
2238
  }
2239
+ //#endregion
2240
+ //#region src/github-app.d.ts
1405
2241
  declare class HubGithubAppClient {
1406
2242
  private readonly request;
1407
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
2243
+ constructor(request: HubRequest);
1408
2244
  mintInstallationToken(input: HubGithubAppMintInstallationTokenRequest): Promise<HubGithubAppMintInstallationTokenResponse>;
1409
2245
  /** Every installation the caller may act through — their own and any org's
1410
2246
  * they were verified against. The management surface's read. */
@@ -1426,16 +2262,50 @@ declare class HubGithubAppClient {
1426
2262
  repo: string;
1427
2263
  }): Promise<HubGithubAppIsRepoInstalledResponse>;
1428
2264
  }
2265
+ //#endregion
2266
+ //#region src/audit.d.ts
1429
2267
  declare class HubAuditClient {
1430
2268
  private readonly request;
1431
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
2269
+ constructor(request: HubRequest);
1432
2270
  list(options?: HubAuditListRequest): Promise<HubAuditResponse>;
1433
2271
  }
1434
- declare class HubWorkflowsClient {
1435
- private readonly request;
2272
+ //#endregion
2273
+ //#region src/workflows-kv.d.ts
2274
+ /** The workflow's durable keyspace, shared by all its runs. */
2275
+ declare class WorkflowKvResource {
2276
+ protected readonly request: HubRequest;
2277
+ constructor(request: HubRequest);
2278
+ /**
2279
+ * The workflow's whole keyspace as metadata (key, version, updatedAt — never
2280
+ * values), key-ordered. Bounded by the server's per-workflow key cap.
2281
+ */
2282
+ listKv(id: string): Promise<HubWorkflowKvListResponse>;
2283
+ /** One KV entry (value + version); `HubSdkError(NOT_FOUND)` when absent. */
2284
+ getKv(id: string, key: string): Promise<HubWorkflowKvEntry>;
2285
+ /**
2286
+ * Upsert a key; returns the entry with its NEW version (increments on every
2287
+ * write). Throws `HubSdkError(KV_VALUE_TOO_LARGE)` past the 64KiB value cap
2288
+ * or `KV_KEY_LIMIT` past the per-workflow key cap. `raw` is the caller's
2289
+ * value, stored and read back verbatim, so the client never gives it a shape.
2290
+ */
2291
+ putKv(id: string, key: string, raw: unknown): Promise<HubWorkflowKvEntry>;
2292
+ /**
2293
+ * Compare-and-swap: the write lands only when the stored version still
2294
+ * equals `expectedVersion`; otherwise `HubSdkError(KV_VERSION_CONFLICT)`
2295
+ * (409) — re-read and retry. Creation is {@link putKv}'s job. `raw` is the
2296
+ * caller's value, stored and read back verbatim, so the client never gives it
2297
+ * a shape.
2298
+ */
2299
+ casKv(id: string, key: string, expectedVersion: number, raw: unknown): Promise<HubWorkflowKvEntry>;
2300
+ /** Delete a key; idempotent — `deleted` reports whether a row was removed. */
2301
+ deleteKv(id: string, key: string): Promise<HubWorkflowKvDeleteResponse>;
2302
+ }
2303
+ //#endregion
2304
+ //#region src/workflows.d.ts
2305
+ declare class HubWorkflowsClient extends WorkflowKvResource {
1436
2306
  private readonly stream?;
1437
2307
  private readonly download?;
1438
- constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>, stream?: ((path: string, init: RequestInit) => Promise<ReadableStream<Uint8Array>>) | undefined, download?: ((path: string, init: RequestInit) => Promise<HubWorkflowArtifactDownload>) | undefined);
2308
+ constructor(request: HubRequest, stream?: HubStreamRequest | undefined, download?: HubArtifactRequest | undefined);
1439
2309
  list(): Promise<HubWorkflow[]>;
1440
2310
  /**
1441
2311
  * Owner-wide fleet overview: one row per workflow with its run tallies over
@@ -1483,8 +2353,9 @@ declare class HubWorkflowsClient {
1483
2353
  * `{ "pull_request.number": "123" }`. Omit it for a one-click run of a
1484
2354
  * workflow that reads no trigger fields. Throws `HubSdkError`:
1485
2355
  * `MISSING_RUN_INPUTS` when a required field is absent (`details.missing`
1486
- * names them), `WORKFLOW_DISABLED` when the workflow is paused, `NOT_FOUND`
1487
- * for an unknown/foreign id. Pass `opts.signal` to abort a slow request.
2356
+ * names them), `NOT_FOUND` for an unknown/foreign id. A paused workflow
2357
+ * still runs once; pausing only stops its triggers. Pass `opts.signal` to
2358
+ * abort a slow request.
1488
2359
  */
1489
2360
  run(id: string, inputs?: HubWorkflowRunInputs, opts?: {
1490
2361
  signal?: AbortSignal;
@@ -1519,8 +2390,8 @@ declare class HubWorkflowsClient {
1519
2390
  * follow it with {@link getRun}/{@link watchRun}/{@link waitForRun} like any
1520
2391
  * other run. Throws `HubSdkError`: `RUN_NOT_RETRYABLE` when the run is not
1521
2392
  * terminal-failed/cancelled (queued/running/waiting, or succeeded),
1522
- * `WORKFLOW_DISABLED` when the workflow has since been disabled, `NOT_FOUND`
1523
- * for an unknown/foreign run id. Pass `opts.signal` to abort a slow request.
2393
+ * `NOT_FOUND` for an unknown/foreign run id; a workflow paused since the
2394
+ * failure still retries. Pass `opts.signal` to abort a slow request.
1524
2395
  */
1525
2396
  retryRun(id: string, runId: string, opts?: {
1526
2397
  signal?: AbortSignal;
@@ -1538,10 +2409,18 @@ declare class HubWorkflowsClient {
1538
2409
  * poll) arrive — the persisted record, read via {@link getRun}, stays the
1539
2410
  * source of truth. Pass `signal` to cancel; iterating to `run.done` (or
1540
2411
  * breaking early) releases the connection.
2412
+ *
2413
+ * A stream that ends before `run.done` or `run.waiting` (the Platform is
2414
+ * restarting or handing over) is reopened after a second, as is one refused
2415
+ * with `SERVICE_DRAINING`; the reopened stream starts with a fresh
2416
+ * `snapshot`. After 30 reopens in a row that deliver nothing it throws
2417
+ * `HubSdkError(WORKFLOW_STREAM_INTERRUPTED)`.
1541
2418
  */
1542
2419
  watchRun(id: string, runId: string, opts?: {
1543
2420
  signal?: AbortSignal;
1544
2421
  }): AsyncGenerator<HubWorkflowRunStreamEvent>;
2422
+ /** One connection's events, then how it ended. */
2423
+ private watchRunOnce;
1545
2424
  /**
1546
2425
  * Poll {@link getRun} until the run reaches a terminal state (`succeeded` or
1547
2426
  * `failed`) and return its detail. The scripting primitive behind "run and
@@ -1592,44 +2471,6 @@ declare class HubWorkflowsClient {
1592
2471
  health(id: string, opts?: {
1593
2472
  runs?: number;
1594
2473
  }): Promise<HubWorkflowHealth>;
1595
- /**
1596
- * Propose a definition change — the intelligence path. SERVICE-TOKEN
1597
- * callers only (user principals get `HubSdkError(SERVICE_TOKEN_REQUIRED)`,
1598
- * 403). The YAML is compile-validated server-side (`WORKFLOW_INVALID` on
1599
- * failure) and appended as a `proposed` revision; the head NEVER advances
1600
- * until an owner approves.
1601
- */
1602
- propose(id: string, input: HubWorkflowProposalInput): Promise<HubWorkflowProposal>;
1603
- /**
1604
- * Pending (proposed) and declined (rejected) revisions, newest first, with
1605
- * their evidence — the approval surface's input.
1606
- */
1607
- listProposals(id: string): Promise<HubWorkflowProposal[]>;
1608
- /**
1609
- * Accept a proposal: its YAML lands as a NEW applied head revision through
1610
- * the same compile + advance path as {@link rollback} (re-validated against
1611
- * today's connections/models), and the proposal settles to `applied`.
1612
- * Throws `HubSdkError`: `PROPOSAL_NOT_PENDING` (409) when the rev is not a
1613
- * pending proposal, `WORKFLOW_INVALID` when it no longer compiles,
1614
- * `CONFLICT` on a concurrent modification.
1615
- */
1616
- approveProposal(id: string, rev: number): Promise<HubWorkflow>;
1617
- /**
1618
- * Decline a proposal: the revision settles to `rejected` (head untouched);
1619
- * an optional reason is merged into its evidence as `rejectionReason`.
1620
- * Throws `HubSdkError(PROPOSAL_NOT_PENDING)` (409) when the rev is not a
1621
- * pending proposal.
1622
- */
1623
- rejectProposal(id: string, rev: number, opts?: {
1624
- reason?: string;
1625
- }): Promise<HubWorkflowProposal>;
1626
- /**
1627
- * Mint a fresh webhook hook token, retiring the current one immediately.
1628
- * The plaintext token is returned exactly once (only the hash is stored).
1629
- * Requires an active webhook trigger — otherwise `HubSdkError` with
1630
- * `NO_WEBHOOK_TRIGGER` (409).
1631
- */
1632
- rotateHookToken(id: string): Promise<HubWorkflowHookToken>;
1633
2474
  /**
1634
2475
  * One agent round's execution timeline, paged. `action` is the action's
1635
2476
  * `${steps[N]}` position and `iteration` the round's position in that
@@ -1663,30 +2504,6 @@ declare class HubWorkflowsClient {
1663
2504
  * `downloadUrl` attached to an `$artifact` ref in a run detail points at.
1664
2505
  */
1665
2506
  downloadArtifact(id: string, runId: string, artifactId: string): Promise<HubWorkflowArtifactDownload>;
1666
- /**
1667
- * The workflow's whole keyspace as metadata (key, version, updatedAt — never
1668
- * values), key-ordered. Bounded by the server's per-workflow key cap.
1669
- */
1670
- listKv(id: string): Promise<HubWorkflowKvListResponse>;
1671
- /** One KV entry (value + version); `HubSdkError(NOT_FOUND)` when absent. */
1672
- getKv(id: string, key: string): Promise<HubWorkflowKvEntry>;
1673
- /**
1674
- * Upsert a key; returns the entry with its NEW version (increments on every
1675
- * write). Throws `HubSdkError(KV_VALUE_TOO_LARGE)` past the 64KiB value cap
1676
- * or `KV_KEY_LIMIT` past the per-workflow key cap. `raw` is the caller's
1677
- * value, stored and read back verbatim, so the client never gives it a shape.
1678
- */
1679
- putKv(id: string, key: string, raw: unknown): Promise<HubWorkflowKvEntry>;
1680
- /**
1681
- * Compare-and-swap: the write lands only when the stored version still
1682
- * equals `expectedVersion`; otherwise `HubSdkError(KV_VERSION_CONFLICT)`
1683
- * (409) — re-read and retry. Creation is {@link putKv}'s job. `raw` is the
1684
- * caller's value, stored and read back verbatim, so the client never gives it
1685
- * a shape.
1686
- */
1687
- casKv(id: string, key: string, expectedVersion: number, raw: unknown): Promise<HubWorkflowKvEntry>;
1688
- /** Delete a key; idempotent — `deleted` reports whether a row was removed. */
1689
- deleteKv(id: string, key: string): Promise<HubWorkflowKvDeleteResponse>;
1690
2507
  /** The curated starter gallery runnable on THIS deployment: metadata,
1691
2508
  * parameters, referenced providers, and a concrete `previewYaml` per card. */
1692
2509
  listTemplates(): Promise<HubWorkflowTemplate[]>;
@@ -1740,6 +2557,48 @@ declare class HubWorkflowsClient {
1740
2557
  schema(): Promise<HubWorkflowSchemaResponse>;
1741
2558
  }
1742
2559
  //#endregion
2560
+ //#region src/client.d.ts
2561
+ declare class HubClient extends HubTransport {
2562
+ readonly knowledge: HubKnowledgeClient;
2563
+ readonly allowances: HubAllowancesClient;
2564
+ readonly apps: HubAppsClient;
2565
+ readonly connections: HubConnectionsClient;
2566
+ readonly channels: HubChannelsClient;
2567
+ readonly numbers: HubManagedNumbersClient;
2568
+ readonly eventSubscriptions: HubEventSubscriptionsClient;
2569
+ readonly permissions: HubPermissionsClient;
2570
+ readonly tokens: HubTokensClient;
2571
+ readonly tools: HubToolsClient;
2572
+ readonly approvals: HubApprovalsClient;
2573
+ readonly audit: HubAuditClient;
2574
+ readonly githubApp: HubGithubAppClient;
2575
+ readonly workflows: HubWorkflowsClient;
2576
+ readonly lines: HubLinesClient;
2577
+ constructor(options: HubClientOptions);
2578
+ static fromEnv(options?: HubClientFromEnvOptions): HubClient;
2579
+ status(): Promise<HubStatusResponse>;
2580
+ /**
2581
+ * Open a streaming (Server-Sent Events) response and return its raw body.
2582
+ * Shares auth-header building + `fetch` with {@link request}, but does NOT
2583
+ * buffer or JSON-parse the body — the caller consumes the stream.
2584
+ *
2585
+ * A successful stream comes back as `text/event-stream`. Anything else is an
2586
+ * error envelope (404/429/401 JSON) or a transport failure (gateway/HTML
2587
+ * page); it is surfaced the same way {@link request} surfaces errors — a
2588
+ * typed `HubSdkError` from a `{success:false}` envelope, otherwise an
2589
+ * `HUB_HTTP_<status>` transport error — rather than handed back as bogus SSE.
2590
+ */
2591
+ private stream;
2592
+ /**
2593
+ * Fetch raw (non-envelope) bytes — the artifact download route, whose 200 is
2594
+ * the artifact's own content type, not JSON. Error responses on such routes
2595
+ * are still the standard envelope, so a failure surfaces exactly like
2596
+ * {@link request}: a typed `HubSdkError` from a `{success:false}` body,
2597
+ * otherwise an `HUB_HTTP_<status>` transport error.
2598
+ */
2599
+ private requestBytes;
2600
+ }
2601
+ //#endregion
1743
2602
  //#region src/event-delivery.d.ts
1744
2603
  type HubEventSignatureFailure = "missing" | "malformed" | "stale" | "mismatch";
1745
2604
  type HubEventSignatureResult = {
@@ -1810,8 +2669,174 @@ declare function authenticateHubEventRequest(input: AuthenticateHubEventRequestI
1810
2669
  declare function verifyHubEventSignature(input: VerifyHubEventSignatureInput): Promise<HubEventSignatureResult>;
1811
2670
  declare function parseHubEventDelivery(input: string | unknown): HubEventDelivery;
1812
2671
  //#endregion
2672
+ //#region src/knowledge-approval.d.ts
2673
+ /** Called only after the owner reviews this exact pending effect and clicks
2674
+ * Approve. Re-read first: a stale tab cannot approve a substituted operation. */
2675
+ declare function approveKnowledgeSource(input: {
2676
+ port: Pick<HubKnowledgeManagementClient, "get" | "refresh">;
2677
+ approvals: Pick<HubApprovalsClient, "approve">;
2678
+ source: KnowledgeSourceSummary;
2679
+ }): Promise<KnowledgeSourceSummary>;
2680
+ //#endregion
2681
+ //#region src/line-grants.d.ts
2682
+ type HubOwnerAskSendInput = Pick<HubLineOwnerSendInput, "text" | "image" | "reply" | "idempotencyKey">;
2683
+ interface HubLineGrantBinding {
2684
+ workspaceId: string;
2685
+ workspaceAgentId: string;
2686
+ }
2687
+ interface HubLineGrant {
2688
+ id: string;
2689
+ /** Canonical Hub identity that consented this grant; distinct from the app-local owner. */
2690
+ ownerUserId?: string;
2691
+ purpose?: "agent" | "owner_asks";
2692
+ lineId: string;
2693
+ connectionId: string;
2694
+ workspaceId: string;
2695
+ workspaceAgentId: string;
2696
+ agentProfileVersion: string;
2697
+ backendSha256: string;
2698
+ attachmentId: string | null;
2699
+ intakeMode: "guests" | "owner_only";
2700
+ /** "application" grants select the app's callback for the owner member instead of attaching. */
2701
+ execution: "backend" | "application" | "none";
2702
+ applicationOrigin: string | null;
2703
+ priorAttachmentId: string | null;
2704
+ priorAttachmentActive: boolean;
2705
+ monthlyBudgetUsd: number;
2706
+ monthlySpentUsd: number;
2707
+ }
2708
+ interface HubLineGrantLine {
2709
+ id: string;
2710
+ connectionId: string;
2711
+ transport: "sms" | "imessage" | "whatsapp";
2712
+ status: string;
2713
+ address: string | null;
2714
+ attachment: {
2715
+ id: string;
2716
+ sandboxId: string;
2717
+ status: string;
2718
+ } | null;
2719
+ }
2720
+ interface HubLineGrantAttachInput {
2721
+ workspaceAgentId: string;
2722
+ agentProfileVersion: string;
2723
+ renewalCode?: string;
2724
+ respond: {
2725
+ kind: "agent";
2726
+ backend: Record<string, unknown>;
2727
+ };
2728
+ }
2729
+ interface HubLineGrantAttachment {
2730
+ id: string;
2731
+ sandboxId: string;
2732
+ status: string;
2733
+ members?: Array<{
2734
+ id: string;
2735
+ role: string;
2736
+ }>;
2737
+ }
2738
+ interface HubLineGrantThread {
2739
+ id: string;
2740
+ lineId: string;
2741
+ attachmentId: string;
2742
+ }
2743
+ interface HubLineGrantMessage {
2744
+ id: string;
2745
+ threadId: string;
2746
+ direction: string;
2747
+ text: string | null;
2748
+ }
2749
+ /** The consented owner member on the owner's current attachment. */
2750
+ interface HubLineGrantMemberApplication {
2751
+ lineId: string;
2752
+ attachmentId: string;
2753
+ memberId: string;
2754
+ subjectId: string;
2755
+ /** Pass back unchanged as `expectedMemberRevision`. */
2756
+ memberRevision: string;
2757
+ /** False until the owner has texted the line and Hub recorded consent. */
2758
+ eligible: boolean;
2759
+ /** Hub-derived; every callback for this grant carries it. */
2760
+ binding: string;
2761
+ selection: {
2762
+ id: string; /** True when this grant's callback is the selected application. */
2763
+ own: boolean;
2764
+ /**
2765
+ * Hub's name for the app that answers the owner's texts, shown to the
2766
+ * owner in every app they consented on this line: a registered app's
2767
+ * name, or "Another app" when Hub has none. Absent before Platform named
2768
+ * selection holders.
2769
+ */
2770
+ app?: {
2771
+ name: string;
2772
+ }; /** When the current app started answering. */
2773
+ selectedAt?: string; /** This app's own callback; never returned for another app. */
2774
+ url?: string;
2775
+ createdAt?: string;
2776
+ } | null;
2777
+ }
2778
+ interface HubLineGrantSelectApplicationInput {
2779
+ /** The current selection exactly as read. */
2780
+ expectedSelectionId: string | null;
2781
+ /**
2782
+ * Set only when the owner chose to move their texts here from the app shown
2783
+ * in `selection.app`: that selection's id, also passed as
2784
+ * `expectedSelectionId`. Without it Hub never replaces another app.
2785
+ */
2786
+ replaceSelectionId?: string;
2787
+ expectedMemberRevision: string;
2788
+ /** HTTPS callback on the owner-approved application origin. */
2789
+ url: string;
2790
+ /** Bearer Hub sends to the callback; 32-512 printable ASCII characters. */
2791
+ secret: string;
2792
+ }
2793
+ interface HubLineGrantApplicationSelection {
2794
+ id: string;
2795
+ lineId: string;
2796
+ attachmentId: string;
2797
+ memberId: string;
2798
+ subjectId: string;
2799
+ status: string;
2800
+ application: {
2801
+ url: string;
2802
+ binding: string;
2803
+ };
2804
+ createdAt: string;
2805
+ revokedAt: string | null;
2806
+ }
2807
+ /** Every call uses HubTransport's authHeaders, so one-use app broker tokens can be minted per request. */
2808
+ declare class HubLineGrantsClient extends HubTransport {
2809
+ current(binding: HubLineGrantBinding): Promise<HubLineGrant>;
2810
+ line(binding: HubLineGrantBinding): Promise<HubLineGrantLine>;
2811
+ attach(binding: HubLineGrantBinding, input: HubLineGrantAttachInput): Promise<HubLineGrantAttachment>;
2812
+ detach(binding: HubLineGrantBinding): Promise<{
2813
+ detached: boolean;
2814
+ }>;
2815
+ threads(binding: HubLineGrantBinding): Promise<HubLineGrantThread[]>;
2816
+ messages(binding: HubLineGrantBinding, threadId: string): Promise<HubLineGrantMessage[]>;
2817
+ memberApplication(binding: HubLineGrantBinding): Promise<HubLineGrantMemberApplication>;
2818
+ /**
2819
+ * Route the owner's texts to this app's callback; the incumbent attachment
2820
+ * stays. `replaceSelectionId` moves them from another app on the owner's
2821
+ * explicit choice.
2822
+ */
2823
+ selectApplication(binding: HubLineGrantBinding, input: HubLineGrantSelectApplicationInput): Promise<HubLineGrantApplicationSelection>;
2824
+ /** Return the owner's texts to the incumbent attachment. */
2825
+ clearApplication(binding: HubLineGrantBinding, input: {
2826
+ expectedSelectionId: string;
2827
+ expectedMemberRevision: string;
2828
+ }): Promise<void>;
2829
+ /** Ask only the verified owner member named by this owner_asks grant. */
2830
+ send(binding: HubLineGrantBinding, input: HubOwnerAskSendInput): Promise<HubLineSendReceipt>;
2831
+ /** Only a send created by this same grant is visible. */
2832
+ outbox(binding: HubLineGrantBinding, messageId: string): Promise<HubLineSendReceipt>;
2833
+ revoke(binding: HubLineGrantBinding, expectedGrantId?: string): Promise<{
2834
+ revoked: boolean;
2835
+ }>;
2836
+ }
2837
+ //#endregion
1813
2838
  //#region src/redaction.d.ts
1814
2839
  declare function redactHubValue(value: unknown): unknown;
1815
2840
  //#endregion
1816
- export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubAgentIterationSpan, type HubAgentRunDetail, type HubApiKeyConnectRequest, type HubApiKeyConnectResponse, type HubApproval, type HubApprovalCapabilityToken, type HubApprovalDecisionResponse, type HubApprovalStatus, HubApprovalsClient, HubAuditClient, type HubAuditEvent, type HubAuditListRequest, type HubAuditResponse, type HubAuthHeaders, type HubCapabilityToken, type HubChannel, type HubChannelCreateResponse, type HubChannelDeleteResponse, HubChannelsClient, type HubChannelsResponse, HubClient, type HubClientFromEnvOptions, type HubClientOptions, type HubConnection, type HubConnectionDeleteRequest, type HubConnectionDeleteResponse, type HubConnectionHealthError, type HubConnectionHealthInfo, type HubConnectionHealthRequest, type HubConnectionHealthResponse, type HubConnectionHealthStatus, type HubConnectionStartOptions, HubConnectionsClient, type HubConnectionsResponse, type HubEmailChannel, type HubEmailChannelCreateRequest, type HubEnv, type HubEnvelope, type HubErrorBody, type HubErrorCode, type HubErrorEnvelope, type HubEventCondition, type HubEventConditionScalar, type HubEventDelivery, HubEventDeliveryError, type HubEventRequestFailureCode, type HubEventRequestResult, type HubEventSignatureFailure, type HubEventSignatureResult, type HubEventSubscription, type HubEventSubscriptionCallback, type HubEventSubscriptionCreateRequest, type HubEventSubscriptionCreateResponse, type HubEventSubscriptionDeleteResponse, type HubEventSubscriptionFilter, type HubEventSubscriptionSource, HubEventSubscriptionsClient, type HubEventSubscriptionsResponse, type HubExecRequest, type HubExecResponse, HubGithubAppClient, type HubGithubAppDisconnectResponse, type HubGithubAppInstallation, type HubGithubAppInstallationResponse, type HubGithubAppIsRepoInstalledRequest, type HubGithubAppIsRepoInstalledResponse, type HubGithubAppListInstallationsResponse, type HubGithubAppListReposResponse, type HubGithubAppManagedInstallation, type HubGithubAppMintInstallationTokenRequest, type HubGithubAppMintInstallationTokenResponse, type HubGithubAppSyncResponse, type HubGithubAppSyncedInstallation, type HubManualRunInput, type HubOAuthCallbackErrorQuery, type HubOAuthCallbackQuery, type HubOAuthCallbackResponse, type HubOAuthCallbackSuccessQuery, type HubOAuthConnectionParameter, type HubOAuthStartRequest, type HubOAuthStartResponse, HubPermissionsClient, type HubPolicy, type HubPolicyDecision, type HubPolicyDeleteRequest, type HubPolicyDeleteResponse, type HubPolicyListRequest, type HubPolicyListResponse, type HubPolicyResponse, type HubPolicyUpdateRequest, type HubPrincipal, type HubPrincipalKind, type HubProvider, type HubProviderAuthKind, type HubProviderEvent, type HubProvidersResponse, HubSdkError, type HubStatusConnections, type HubStatusResponse, type HubSuccessEnvelope, type HubTokenListOptions, type HubTokenMintRequest, type HubTokenMintResponse, type HubTokenRevokeResponse, HubTokensClient, type HubTokensListResponse, type HubTool, type HubToolInvokeOptions, type HubToolRisk, type HubToolSearchOptions, type HubToolSource, type HubToolSourcesResponse, HubToolsClient, type HubToolsDescribeRequest, type HubToolsDescribeResponse, type HubToolsSearchRequest, type HubToolsSearchResponse, type HubUnimplementedErrorEnvelope, type HubWhatsappEmbeddedSignupCompleteRequest, type HubWhatsappEmbeddedSignupCompleteResponse, type HubWhatsappEmbeddedSignupStartRequest, type HubWhatsappEmbeddedSignupStartResponse, type HubWorkflow, type HubWorkflowAction, type HubWorkflowActionResult, type HubWorkflowAgentStep, type HubWorkflowArtifact, type HubWorkflowArtifactDownload, type HubWorkflowArtifactRef, type HubWorkflowArtifactsResponse, type HubWorkflowCondition, type HubWorkflowConditionOp, type HubWorkflowConditionScalar, type HubWorkflowConnectionRequirement, type HubWorkflowDecision, type HubWorkflowDecisionOnTimeout, type HubWorkflowDecisionResolveResult, type HubWorkflowDecisionResolvedVia, type HubWorkflowDecisionStatus, type HubWorkflowDistillationCandidate, type HubWorkflowEdgeVerdicts, type HubWorkflowEventFilter, type HubWorkflowFailureCluster, type HubWorkflowFleetEntry, type HubWorkflowFleetInsights, type HubWorkflowFleetWindow, type HubWorkflowGraphEdge, type HubWorkflowGraphJoinRule, type HubWorkflowGraphNode, type HubWorkflowGraphSpec, type HubWorkflowHealth, type HubWorkflowHookEndpoint, type HubWorkflowHookToken, type HubWorkflowKvDeleteResponse, type HubWorkflowKvEntry, type HubWorkflowKvEntryMeta, type HubWorkflowKvListResponse, type HubWorkflowNodeHealth, type HubWorkflowOnErrorOutcome, type HubWorkflowPendingDecision, type HubWorkflowPendingDecisionsResponse, type HubWorkflowProposal, type HubWorkflowProposalInput, type HubWorkflowRevision, type HubWorkflowRevisionMeta, type HubWorkflowRevisionSource, type HubWorkflowRevisionStatus, type HubWorkflowRun, type HubWorkflowRunCancelResult, type HubWorkflowRunDetail, type HubWorkflowRunEnqueued, type HubWorkflowRunInputs, type HubWorkflowRunRetried, type HubWorkflowRunStatus, type HubWorkflowRunStepsPage, type HubWorkflowRunStreamEvent, type HubWorkflowRunSummary, type HubWorkflowRunsPage, type HubWorkflowSchemaResponse, type HubWorkflowTemplate, type HubWorkflowTemplateCategory, type HubWorkflowTemplateInstantiateResult, type HubWorkflowTemplateParameter, type HubWorkflowTrigger, type HubWorkflowValidateResponse, type HubWorkflowValidationError, HubWorkflowsClient, type VerifyHubEventSignatureInput, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
2841
+ export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, HubAgentIterationSpan, HubAgentRunDetail, HubAllowWritesResponse, type HubAllowanceDecision, type HubAllowanceGrant, type HubAllowancePlan, type HubAllowancePlanInput, type HubAllowanceRole, type HubAllowanceSubject, type HubAllowanceSyncInput, type HubAllowanceSyncReceipt, type HubAllowanceTier, type HubAllowanceUsage, HubAllowancesClient, HubApiKeyConnectRequest, HubApiKeyConnectResponse, HubApiKeyConnectionMetadata, type HubApp, HubAppBrokerClient, type HubAppBrokerExchange, type HubAppBrokerOptions, type HubAppBrokerToken, type HubAppComplianceClaim, type HubAppComplianceState, type HubAppCreateInput, type HubAppGrant, type HubAppGrantRevoked, HubApproval, HubApprovalCapabilityToken, HubApprovalDecisionResponse, HubApprovalListResponse, HubApprovalStatus, HubApprovalsClient, HubAppsClient, HubAuditClient, HubAuditEvent, HubAuditListRequest, HubAuditResponse, type HubAuthHeaders, HubCapabilityToken, HubChannel, HubChannelCreateResponse, HubChannelDeleteResponse, HubChannelsClient, HubChannelsResponse, HubClient, type HubClientFromEnvOptions, type HubClientOptions, HubConnection, HubConnectionDeleteResponse, HubConnectionHealthError, HubConnectionHealthInfo, HubConnectionHealthResponse, HubConnectionHealthStatus, type HubConnectionStartOptions, HubConnectionsClient, HubConnectionsResponse, HubEmailChannel, HubEmailChannelCreateRequest, type HubEnv, HubErrorBody, HubErrorCode, HubErrorEnvelope, HubEventCondition, HubEventConditionScalar, HubEventDelivery, HubEventDeliveryError, type HubEventRequestFailureCode, type HubEventRequestResult, type HubEventSignatureFailure, type HubEventSignatureResult, HubEventSubscription, HubEventSubscriptionCallback, HubEventSubscriptionCreateRequest, HubEventSubscriptionCreateResponse, HubEventSubscriptionDeleteResponse, HubEventSubscriptionFilter, HubEventSubscriptionSource, HubEventSubscriptionsClient, HubEventSubscriptionsResponse, HubExecResponse, HubGithubAppClient, HubGithubAppDisconnectResponse, HubGithubAppInstallation, HubGithubAppInstallationResponse, HubGithubAppIsRepoInstalledResponse, HubGithubAppListInstallationsResponse, HubGithubAppListReposResponse, HubGithubAppManagedInstallation, HubGithubAppMintInstallationTokenRequest, HubGithubAppMintInstallationTokenResponse, HubGithubAppSyncResponse, HubGithubAppSyncedInstallation, type HubInboundPhoneNumberScope, type HubInboundWebhookCreateOptions, type HubInboundWebhookCreateResponse, type HubInboundWebhookStatus, HubInboundWebhooksClient, HubKnowledgeClient, HubKnowledgeManagementClient, type HubKnowledgeQueryResult, type HubKnowledgeRetrievalResult, type HubLineApplicationDispatchCurrentInput, type HubLineCheckinOptions, type HubLineContext, type HubLineGrant, type HubLineGrantApplicationSelection, type HubLineGrantAttachInput, type HubLineGrantAttachment, type HubLineGrantBinding, type HubLineGrantLine, type HubLineGrantMemberApplication, type HubLineGrantMessage, type HubLineGrantSelectApplicationInput, type HubLineGrantThread, HubLineGrantsClient, type HubLineImage, type HubLineMember, type HubLineMemberApplication, type HubLineMemberApplicationInput, type HubLineOwnerSendInput, type HubLineProviderDelivery, type HubLineReminderInput, type HubLineReminderReceipt, type HubLineReplyCode, type HubLineReplyCodeInput, type HubLineScheduledSendOptions, type HubLineSendInput, type HubLineSendReceipt, HubLinesClient, HubManagedNumbersClient, HubManualRunInput, type HubNumberListQuery, type HubNumberOrder, type HubNumberOrderPage, type HubNumberQuote, type HubNumberReadiness, type HubNumberResolution, HubOAuthConnectionParameter, HubOAuthStartResponse, type HubOwnerAskSendInput, HubPermissionsClient, HubPolicy, HubPolicyDecision, HubPolicyDeleteRequest, HubPolicyDeleteResponse, HubPolicyListResponse, HubPolicyResponse, HubPolicyUpdateRequest, HubPrincipal, HubPrincipalKind, HubProvider, HubProviderAuthKind, HubProviderEvent, HubProvidersResponse, HubRevertWritesResponse, HubSdkError, HubStatusConnections, HubStatusResponse, HubSuccessEnvelope, type HubTokenListOptions, HubTokenMintResponse, HubTokenRevokeResponse, HubTokensClient, HubTokensListResponse, HubTool, type HubToolInvokeOptions, HubToolRisk, type HubToolSearchOptions, HubToolSource, HubToolSourcesResponse, HubToolsClient, HubToolsDescribeResponse, HubToolsSearchResponse, HubWhatsappEmbeddedSignupCompleteRequest, HubWhatsappEmbeddedSignupCompleteResponse, HubWhatsappEmbeddedSignupStartRequest, HubWhatsappEmbeddedSignupStartResponse, HubWorkflow, HubWorkflowAction, HubWorkflowActionResult, HubWorkflowAgentStep, HubWorkflowArtifact, HubWorkflowArtifactDownload, HubWorkflowArtifactRef, HubWorkflowArtifactsResponse, type HubWorkflowCondition, type HubWorkflowConditionOp, type HubWorkflowConditionScalar, HubWorkflowConnectionRequirement, HubWorkflowDecision, HubWorkflowDecisionOnTimeout, HubWorkflowDecisionResolveResult, HubWorkflowDecisionResolvedVia, HubWorkflowDecisionStatus, HubWorkflowDistillationCandidate, HubWorkflowEdgeVerdicts, HubWorkflowEventFilter, HubWorkflowFailureCluster, HubWorkflowFleetEntry, HubWorkflowFleetInsights, HubWorkflowFleetWindow, type HubWorkflowGraphEdge, type HubWorkflowGraphJoinRule, type HubWorkflowGraphNode, type HubWorkflowGraphSpec, HubWorkflowHealth, HubWorkflowHookEndpoint, HubWorkflowKvDeleteResponse, HubWorkflowKvEntry, HubWorkflowKvEntryMeta, HubWorkflowKvListResponse, HubWorkflowNodeHealth, HubWorkflowOnErrorOutcome, HubWorkflowPendingDecision, HubWorkflowPendingDecisionsResponse, HubWorkflowProposal, HubWorkflowRevision, HubWorkflowRevisionMeta, HubWorkflowRevisionSource, HubWorkflowRevisionStatus, HubWorkflowRun, HubWorkflowRunCancelResult, HubWorkflowRunDetail, HubWorkflowRunEnqueued, HubWorkflowRunInputs, HubWorkflowRunRetried, HubWorkflowRunStatus, HubWorkflowRunStepsPage, HubWorkflowRunStreamEvent, HubWorkflowRunSummary, HubWorkflowRunsPage, HubWorkflowSchemaResponse, HubWorkflowTemplate, HubWorkflowTemplateCategory, HubWorkflowTemplateInstantiateResult, HubWorkflowTemplateParameter, HubWorkflowTrigger, HubWorkflowValidateResponse, HubWorkflowValidationError, HubWorkflowsClient, KnowledgeAttachment, KnowledgeAttachmentAuthorization, KnowledgeAuthorization, KnowledgeCapabilities, KnowledgeCapability, KnowledgeEmbeddingSpace, KnowledgeReference, KnowledgeSourceCreate, KnowledgeSourceInput, KnowledgeSourceSummary, type VerifyHubEventSignatureInput, approveKnowledgeSource, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature, workflowConnectionRequirementKey };
1817
2842
  //# sourceMappingURL=index.d.ts.map