@tangle-network/hub-sdk 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,288 +1,5 @@
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
1
+ import { $ as HubLineScheduledSendOptions, $n as HubEventDelivery, $r as HubTool, $t as HubWorkflowRunDetail, A as HubSdkError, An as HubConnectionDeleteResponse, Ar as HubPrincipal, At as workflowConnectionRequirementKey, B as HubLineApplicationDispatchCurrentInput, Bn as HubProvidersResponse, Br as HubKnowledgeRetrievalResult, Bt as HubWorkflowDistillationCandidate, C as HUB_URL_ENV_VAR, Cn as HubGithubAppMintInstallationTokenResponse, Cr as HubRevertWritesResponse, Ct as HubWorkflowTemplate, D as resolveHubBaseUrl, Dn as HubApiKeyConnectResponse, Dr as HubErrorBody, Dt as HubWorkflowTrigger, E as resolveHubAuth, En as HubApiKeyConnectRequest, Er as HubTokensListResponse, Et as HubWorkflowTemplateParameter, F as HubNumberOrder, Fn as HubConnectionsResponse, Fr as HubAuditEvent, Ft as HubWorkflowDecision, G as HubLineMemberApplication, Gn as HubChannel, Gr as KnowledgeCapabilities, Gt as HubWorkflowFleetWindow, H as HubLineContext, Hn as HubWhatsappEmbeddedSignupCompleteResponse, Hr as KnowledgeAttachment, Ht as HubWorkflowFailureCluster, I as HubNumberOrderPage, In as HubOAuthConnectionParameter, Ir as HubAuditListRequest, It as HubWorkflowDecisionOnTimeout, J as HubLineProviderDelivery, Jn as HubChannelsResponse, Jr as KnowledgeReference, Jt as HubWorkflowOnErrorOutcome, K as HubLineMemberApplicationInput, Kn as HubChannelCreateResponse, Kr as KnowledgeCapability, Kt as HubWorkflowHealth, L as HubNumberQuote, Ln as HubOAuthStartResponse, Lr as HubAuditResponse, Lt as HubWorkflowDecisionResolveResult, M as isHubUnauthenticated, Mn as HubConnectionHealthInfo, Mr as HubStatusConnections, Mt as HubAgentRunDetail, N as HubManagedNumbersClient, Nn as HubConnectionHealthResponse, Nr as HubStatusResponse, Nt as HubWorkflowActionResult, O as HubAuthHeaders, On as HubApiKeyConnectionMetadata, Or as HubErrorCode, Ot as HubWorkflowValidateResponse, P as HubNumberListQuery, Pn as HubConnectionHealthStatus, Pr as HubSuccessEnvelope, Pt as HubWorkflowAgentStep, Q as HubLineReplyCodeInput, Qn as HubEventConditionScalar, Qr as HubExecResponse, Qt as HubWorkflowRunCancelResult, R as HubNumberReadiness, Rn as HubProvider, Rr as HubKnowledgeClient, Rt as HubWorkflowDecisionResolvedVia, S as HUB_CAPABILITY_TOKEN_ENV_VAR, Si as HubAllowancesClient, Sn as HubGithubAppMintInstallationTokenRequest, Sr as HubPolicyUpdateRequest, St as HubWorkflowSchemaResponse, T as HubEnv, Tn as HubGithubAppSyncedInstallation, Tr as HubTokenRevokeResponse, Tt as HubWorkflowTemplateInstantiateResult, U as HubLineImage, Un as HubWhatsappEmbeddedSignupStartRequest, Ur as KnowledgeAttachmentAuthorization, Ut as HubWorkflowFleetEntry, V as HubLineCheckinOptions, Vn as HubWhatsappEmbeddedSignupCompleteRequest, Vr as HubKnowledgeManagementClient, Vt as HubWorkflowEdgeVerdicts, W as HubLineMember, Wn as HubWhatsappEmbeddedSignupStartResponse, Wr as KnowledgeAuthorization, Wt as HubWorkflowFleetInsights, X as HubLineReminderReceipt, Xn as HubEmailChannelCreateRequest, Xr as KnowledgeSourceInput, Xt as HubWorkflowPendingDecisionsResponse, Y as HubLineReminderInput, Yn as HubEmailChannel, Yr as KnowledgeSourceCreate, Yt as HubWorkflowPendingDecision, Z as HubLineReplyCode, Zn as HubEventCondition, Zr as KnowledgeSourceSummary, Zt as HubWorkflowRun, _ as HubApprovalsClient, _i as HubAllowanceSubject, _n as HubGithubAppInstallationResponse, _r as HubPolicyDecision, _t as HubWorkflowProposal, a as HubChannelsClient, ai as HubApp, an as HubWorkflowRunStreamEvent, ar as HubEventSubscriptionFilter, at as HubWorkflowArtifactRef, b as HubTokensClient, bi as HubAllowanceTier, bn as HubGithubAppListReposResponse, br as HubPolicyListResponse, bt as HubWorkflowRevisionSource, c as HubConnectionsClient, ci as HubAppCreateInput, cn as HubWorkflowCondition, cr as HubProviderEvent, ct as HubWorkflowKvEntry, d as HubInboundWebhookCreateResponse, di as HubAppsClient, dn as HubWorkflowGraphEdge, dr as HubApprovalCapabilityToken, dt as HubManualRunInput, ei as HubToolRisk, en as HubWorkflowRunEnqueued, er as HubEventSubscription, et as HubLineSendInput, f as HubInboundWebhookStatus, fi as HubAllowanceDecision, fn as HubWorkflowGraphJoinRule, fr as HubApprovalDecisionResponse, ft as HubWorkflow, g as HubToolsClient, gi as HubAllowanceRole, gn as HubGithubAppInstallation, gr as HubPolicy, gt as HubWorkflowHookEndpoint, h as HubToolSearchOptions, hi as HubAllowancePlanInput, hn as HubGithubAppDisconnectResponse, hr as HubCapabilityToken, ht as HubWorkflowEventFilter, i as HubGithubAppClient, ii as HubToolsSearchResponse, in as HubWorkflowRunStepsPage, ir as HubEventSubscriptionDeleteResponse, it as HubWorkflowArtifactDownload, j as HubTransport, jn as HubConnectionHealthError, jr as HubPrincipalKind, jt as HubAgentIterationSpan, k as HubClientOptions, kn as HubConnection, kr as HubErrorEnvelope, kt as HubWorkflowValidationError, l as HubInboundPhoneNumberScope, li as HubAppGrant, ln as HubWorkflowConditionOp, lr as HubAllowWritesResponse, lt as HubWorkflowKvEntryMeta, m as HubToolInvokeOptions, mi as HubAllowancePlan, mn as HubWorkflowGraphSpec, mr as HubApprovalStatus, mt as HubWorkflowConnectionRequirement, n as HubWorkflowsClient, ni as HubToolSourcesResponse, nn as HubWorkflowRunRetried, nr as HubEventSubscriptionCreateRequest, nt as HubLinesClient, o as HubEventSubscriptionsClient, oi as HubAppComplianceClaim, on as HubWorkflowRunSummary, or as HubEventSubscriptionSource, ot as HubWorkflowArtifactsResponse, p as HubInboundWebhooksClient, pi as HubAllowanceGrant, pn as HubWorkflowGraphNode, pr as HubApprovalListResponse, pt as HubWorkflowAction, q as HubLineOwnerSendInput, qn as HubChannelDeleteResponse, qr as KnowledgeEmbeddingSpace, qt as HubWorkflowNodeHealth, r as HubAuditClient, ri as HubToolsDescribeResponse, rn as HubWorkflowRunStatus, rr as HubEventSubscriptionCreateResponse, rt as HubWorkflowArtifact, s as HubConnectionStartOptions, si as HubAppComplianceState, sn as HubWorkflowRunsPage, sr as HubEventSubscriptionsResponse, st as HubWorkflowKvDeleteResponse, t as HubClient, ti as HubToolSource, tn as HubWorkflowRunInputs, tr as HubEventSubscriptionCallback, tt as HubLineSendReceipt, u as HubInboundWebhookCreateOptions, ui as HubAppGrantRevoked, un as HubWorkflowConditionScalar, ur as HubApproval, ut as HubWorkflowKvListResponse, v as HubPermissionsClient, vi as HubAllowanceSyncInput, vn as HubGithubAppIsRepoInstalledResponse, vr as HubPolicyDeleteRequest, vt as HubWorkflowRevision, w as HubClientFromEnvOptions, wn as HubGithubAppSyncResponse, wr as HubTokenMintResponse, wt as HubWorkflowTemplateCategory, x as HUB_API_KEY_ENV_VAR, xi as HubAllowanceUsage, xn as HubGithubAppManagedInstallation, xr as HubPolicyResponse, xt as HubWorkflowRevisionStatus, y as HubTokenListOptions, yi as HubAllowanceSyncReceipt, yn as HubGithubAppListInstallationsResponse, yr as HubPolicyDeleteResponse, yt as HubWorkflowRevisionMeta, z as HubNumberResolution, zn as HubProviderAuthKind, zr as HubKnowledgeQueryResult, zt as HubWorkflowDecisionStatus } from "./client-BH3gTLjN.js";
2
+
286
3
  //#region src/broker.d.ts
287
4
  interface HubAppBrokerOptions {
288
5
  baseUrl: string;
@@ -317,2288 +34,6 @@ declare class HubAppBrokerClient {
317
34
  invoke<T = unknown>(grantId: string, connectionId: string, actionPath: string, input: Record<string, unknown>): Promise<HubExecResponse<T>>;
318
35
  }
319
36
  //#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
551
- type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
552
- interface HubSuccessEnvelope<TData> {
553
- success: true;
554
- data: TData;
555
- }
556
- interface HubErrorEnvelope {
557
- success: false;
558
- error: HubErrorBody;
559
- }
560
- interface HubErrorBody {
561
- code: HubErrorCode;
562
- message: string;
563
- details?: unknown;
564
- }
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}`;
566
- interface HubStatusResponse {
567
- contract: unknown;
568
- principal: HubPrincipal;
569
- connections: HubStatusConnections;
570
- }
571
- interface HubPrincipal {
572
- kind: HubPrincipalKind;
573
- userId: string;
574
- apiKeyId?: string;
575
- sandboxId?: string;
576
- requestId?: string;
577
- }
578
- interface HubStatusConnections {
579
- connectedProviderCount: number;
580
- unhealthyProviderCount: number;
581
- }
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 {
590
- id: string;
591
- providerId: string;
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;
629
- createdAt: string;
630
- updatedAt: string;
631
- }
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[];
676
- }
677
- //#endregion
678
- //#region src/channel-types.d.ts
679
- interface HubEmailChannel {
680
- id: string;
681
- kind: "email";
682
- providerId: "email";
683
- connectionId: string;
684
- clientReference: string | null;
685
- label: string | null;
686
- address: string;
687
- status: "active";
688
- createdAt: string;
689
- updatedAt: string;
690
- }
691
- type HubChannel = HubEmailChannel;
692
- interface HubChannelsResponse {
693
- channels: HubChannel[];
694
- }
695
- interface HubEmailChannelCreateRequest {
696
- /**
697
- * Product-owned idempotency key. Retrying the same request returns the
698
- * original mailbox instead of provisioning another address.
699
- */
700
- clientReference?: string;
701
- label?: string;
702
- }
703
- interface HubChannelCreateResponse {
704
- channel: HubChannel;
705
- /** True only when this request created the channel. */
706
- created: boolean;
707
- }
708
- interface HubChannelDeleteResponse {
709
- removed: true;
710
- }
711
- type HubEventConditionScalar = string | number | boolean | null;
712
- type HubEventCondition = {
713
- path: string;
714
- op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
715
- value?: HubEventConditionScalar | HubEventConditionScalar[];
716
- } | {
717
- all: HubEventCondition[];
718
- } | {
719
- any: HubEventCondition[];
720
- } | {
721
- not: HubEventCondition;
722
- };
723
- interface HubEventSubscriptionFilter {
724
- action?: string;
725
- repo?: string;
726
- when?: HubEventCondition;
727
- }
728
- type HubEventSubscriptionSource = {
729
- type: "channel";
730
- channelId: string;
731
- } | {
732
- type: "connection";
733
- connectionId: string;
734
- };
735
- interface HubEventSubscriptionCallback {
736
- url: string;
737
- secret: string;
738
- }
739
- interface HubEventSubscriptionCreateRequest {
740
- /**
741
- * Product-owned idempotency key. Reusing it with the same source and filter
742
- * returns the existing subscription; reusing it for different input fails.
743
- */
744
- clientReference: string;
745
- label?: string;
746
- source: HubEventSubscriptionSource;
747
- event: string;
748
- filter?: HubEventSubscriptionFilter;
749
- callback: HubEventSubscriptionCallback;
750
- }
751
- interface HubEventSubscription {
752
- id: string;
753
- clientReference: string;
754
- label: string | null;
755
- source: HubEventSubscriptionSource;
756
- providerId: string;
757
- connectionId: string;
758
- event: string;
759
- filter: HubEventSubscriptionFilter;
760
- workflowId: string;
761
- status: "active" | "error";
762
- lastError: string | null;
763
- createdAt: string;
764
- updatedAt: string;
765
- }
766
- interface HubEventSubscriptionsResponse {
767
- subscriptions: HubEventSubscription[];
768
- }
769
- interface HubEventSubscriptionCreateResponse {
770
- subscription: HubEventSubscription;
771
- /** True only when this request created the subscription; false on idempotent reuse. */
772
- created: boolean;
773
- }
774
- interface HubEventSubscriptionDeleteResponse {
775
- removed: true;
776
- }
777
- interface HubProviderEvent {
778
- provider: string;
779
- connectionId: string;
780
- type: string;
781
- action?: string;
782
- repo?: string;
783
- deliveryId?: string;
784
- payload: unknown;
785
- }
786
- interface HubEventDelivery {
787
- subscriptionId: string;
788
- workflowId: string;
789
- runId: string;
790
- source: {
791
- kind: "channel" | "connection";
792
- id: string;
793
- provider: string;
794
- event: string;
795
- };
796
- providerEvent: HubProviderEvent;
797
- firedAt: string;
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
- }
817
- /** A connector's auth model. */
818
- type HubProviderAuthKind = "oauth2" | "api_key" | "none" | "custom";
819
- /** One non-secret value needed before an OAuth redirect can be built. Tenant-
820
- * scoped providers use this for the account label in their OAuth hostname. */
821
- interface HubOAuthConnectionParameter {
822
- key: string;
823
- label: string;
824
- description: string;
825
- placeholder: string;
826
- required: true;
827
- }
828
- interface HubProvider {
829
- providerId: string;
830
- title: string;
831
- /** The connector's auth model. */
832
- authKind: HubProviderAuthKind;
833
- /** For api-key connectors, the manifest's free-text hint shown when
834
- * collecting the key (e.g. "Paste your Airtable personal access token");
835
- * null for OAuth/native providers that don't collect a key inline. */
836
- authHint: string | null;
837
- category: string;
838
- scopes: string[];
839
- /** Actions + trigger events combined (legacy census; prefer the split
840
- * counts below when present). */
841
- capabilityCount: number;
842
- /** Actions callable via `integration.invoke`. Absent on older servers, and
843
- * for native GitHub when the executor catalog is unavailable. */
844
- actionCount?: number;
845
- /** Trigger events the connector delivers (not invokable). Absent on older
846
- * servers. */
847
- triggerCount?: number;
848
- /** True for the native GitHub path; false for substrate-bundled connectors. */
849
- native: boolean;
850
- /** True when the provider's OAuth app credentials are wired, i.e. a connect
851
- * flow can actually start. UIs offer Connect only for configured providers. */
852
- configured: boolean;
853
- /** Values the user must supply before OAuth starts. Empty or absent means the
854
- * provider can redirect immediately. */
855
- connectionParameters?: HubOAuthConnectionParameter[];
856
- /**
857
- * True when this deployment can receive this provider's inbound events.
858
- * This is separate from `configured`: OAuth can be ready while the shared
859
- * webhook secret or bot identity is still absent.
860
- */
861
- eventIngressConfigured?: boolean;
862
- }
863
- interface HubProvidersResponse {
864
- providers: HubProvider[];
865
- /** Count of substrate-bundled connector manifests behind this catalog. */
866
- substrateBundled: number;
867
- }
868
- interface HubOAuthStartResponse {
869
- provider: string;
870
- redirectUrl: string;
871
- state: string;
872
- expiresAt: string;
873
- scopes: string[];
874
- cli: boolean;
875
- }
876
- interface HubWhatsappEmbeddedSignupStartRequest {
877
- returnUrl?: string;
878
- }
879
- interface HubWhatsappEmbeddedSignupStartResponse {
880
- provider: "whatsapp-business";
881
- appId: string;
882
- configId: string;
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";
887
- state: string;
888
- expiresAt: string;
889
- scopes: string[];
890
- }
891
- interface HubWhatsappEmbeddedSignupCompleteRequest {
892
- code: string;
893
- state: string;
894
- wabaId: string;
895
- phoneNumberId: string;
896
- businessId?: string;
897
- flowEvent?: string;
898
- }
899
- interface HubWhatsappEmbeddedSignupCompleteResponse {
900
- connectionId: string;
901
- provider: "whatsapp-business";
902
- reconnected: boolean;
903
- connection: HubConnection | null;
904
- }
905
- /** Connect a non-OAuth (api-key) connector by submitting the user's key. The
906
- * server validates the key with a live probe before persisting; `provider` is
907
- * carried in the path, `apiKey` in the body. */
908
- interface HubApiKeyConnectRequest {
909
- provider: string;
910
- apiKey: string;
911
- /** Connector-owned setup values. Hub validates them before testing the key. */
912
- metadata?: HubApiKeyConnectionMetadata;
913
- }
914
- type HubApiKeyConnectionMetadata = {
915
- propertyId: string;
916
- currency?: string;
917
- } | {
918
- listings: Array<{
919
- id: string;
920
- pms: string;
921
- }>;
922
- };
923
- /** Result of an api-key connect: the created (or reconnected) connection.
924
- * Synchronous — there is no redirect leg, unlike the OAuth flow. */
925
- interface HubApiKeyConnectResponse {
926
- connection: HubConnection;
927
- reconnected: boolean;
928
- }
929
- interface HubConnectionDeleteResponse {
930
- connection: HubConnection;
931
- }
932
- type HubConnectionHealthStatus = "healthy" | "reconnect_required" | "unhealthy" | "rate_limited" | "unsupported";
933
- interface HubConnectionHealthError {
934
- code: string;
935
- message: string;
936
- }
937
- interface HubConnectionHealthInfo {
938
- status: HubConnectionHealthStatus;
939
- checkedAt: string;
940
- error?: HubConnectionHealthError;
941
- }
942
- interface HubConnectionHealthResponse {
943
- connection: HubConnection;
944
- health: HubConnectionHealthInfo;
945
- }
946
- //#endregion
947
- //#region src/github-app-types.d.ts
948
- interface HubGithubAppMintInstallationTokenRequest {
949
- /** HTTPS or SSH GitHub URL — alternative to installationId. */
950
- repoUrl?: string;
951
- /** Explicit installation id — alternative to repoUrl. */
952
- installationId?: number;
953
- /**
954
- * Permission narrowing. The hub MAY refuse a permission broader than the
955
- * grant authorized; absent, defaults to `{ contents: "read" }` (the
956
- * conservative clone-only floor the autonomous-improvement loop needs).
957
- */
958
- permissions?: Record<string, "read" | "write" | "admin">;
959
- /** Hint passed to GitHub. Server caps at the configured maximum. */
960
- ttlSeconds?: number;
961
- }
962
- interface HubGithubAppMintInstallationTokenResponse {
963
- token: string;
964
- expiresAt: string;
965
- installationId: number;
966
- owner: string;
967
- repo: string;
968
- }
969
- interface HubGithubAppInstallation {
970
- installationId: number;
971
- /** Org/user login the App is installed on (lowercased). */
972
- accountLogin: string;
973
- accountType: string | null;
974
- /** "all" ⇒ every repo under the account; "selected" ⇒ only repoFullNames. */
975
- repositorySelection: "all" | "selected";
976
- /** Metadata omits names; use githubApp.listRepos(id) for a live caller-safe list. */
977
- repoFullNames: string[];
978
- suspended: boolean;
979
- }
980
- interface HubGithubAppInstallationResponse {
981
- installation: HubGithubAppInstallation;
982
- }
983
- /** An installation as the management surface renders it: the registry record
984
- * plus where to manage it on GitHub (org and personal accounts have different
985
- * settings paths, and the id is not discoverable in GitHub's own UI). */
986
- interface HubGithubAppManagedInstallation extends HubGithubAppInstallation {
987
- manageUrl: string;
988
- }
989
- interface HubGithubAppListInstallationsResponse {
990
- installations: HubGithubAppManagedInstallation[];
991
- /** GitHub's install URL for this deployment, or null when the App slug is
992
- * unconfigured — in which case there is no way to add another account and
993
- * the UI must say so rather than link nowhere. */
994
- installUrl: string | null;
995
- /** Whether this deployment can ask GitHub for installations it never
996
- * witnessed. Rests on the App CREDENTIAL, not the slug behind `installUrl` —
997
- * a deployment can have one without the other. */
998
- syncAvailable?: boolean;
999
- }
1000
- interface HubGithubAppDisconnectResponse {
1001
- installationId: number;
1002
- disconnected: boolean;
1003
- }
1004
- interface HubGithubAppSyncedInstallation {
1005
- installationId: number;
1006
- accountLogin: string;
1007
- accountType: string | null;
1008
- repositorySelection: "all" | "selected";
1009
- /** False when this run is what linked it — the newly reachable access. */
1010
- alreadyLinked: boolean;
1011
- }
1012
- /** Result of reconciling the caller's installations from GitHub. */
1013
- interface HubGithubAppSyncResponse {
1014
- /** How many of the caller's GitHub accounts were examined. */
1015
- accountsChecked: number;
1016
- /** Installations the caller may act through once this returns. */
1017
- linked: HubGithubAppSyncedInstallation[];
1018
- /** An installation was found but not linked, and why. An account with no
1019
- * installation is absent — that is the ordinary case, not a problem. */
1020
- skipped: Array<{
1021
- accountLogin: string;
1022
- reason: string;
1023
- }>;
1024
- /** Why the examined set is not everything, when it isn't. */
1025
- incomplete?: string;
1026
- }
1027
- interface HubGithubAppListReposResponse {
1028
- installationId: number;
1029
- /** Complete live intersection of App coverage and the caller's GitHub access. */
1030
- repoFullNames: string[];
1031
- /** True only when both upstream listings completed; failures return an error. */
1032
- complete: true;
1033
- }
1034
- interface HubGithubAppIsRepoInstalledResponse {
1035
- installed: boolean;
1036
- installationId: number | null;
1037
- }
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 {
1059
- id: string;
1060
- index: number;
1061
- join?: HubWorkflowGraphJoinRule;
1062
- }
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;
1075
- }
1076
- //#endregion
1077
- //#region src/workflow-run-types.d.ts
1078
- type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
1079
- /** One agent iteration of an `agent.run`, as the single-run detail carries it
1080
- * (JSON-clean ISO timestamps) — including the round's own output `text`. */
1081
- interface HubAgentIterationSpan {
1082
- index: number;
1083
- name: string;
1084
- status: "succeeded" | "failed";
1085
- startedAt: string;
1086
- completedAt: string;
1087
- model?: string;
1088
- inputTokens?: number;
1089
- outputTokens?: number;
1090
- costUsd?: number;
1091
- error?: string;
1092
- text?: string;
1093
- }
1094
- /** An `agent.run`'s execution detail (single-run detail endpoint): per-iteration
1095
- * spans plus aggregate usage, present on success AND failure. `partialText` is
1096
- * failure-only — on success the final text is the action's `output`. */
1097
- interface HubAgentRunDetail {
1098
- model?: string;
1099
- inputTokens?: number;
1100
- outputTokens?: number;
1101
- costUsd?: number;
1102
- partialText?: string;
1103
- iterations?: HubAgentIterationSpan[];
1104
- }
1105
- /** Per-action result inside a run. `output` on success, `error` on failure. */
1106
- interface HubWorkflowActionResult {
1107
- index: number;
1108
- kind: string;
1109
- /** `running` is the provisional in-flight status the run-history list and
1110
- * single-run detail endpoints return for an action of a run that is still
1111
- * executing (reconciled to `failed` only once the run itself reaches a
1112
- * terminal state); a consumer polling either endpoint can observe it.
1113
- * `skipped` is an action whose `if` guard resolved false, so it never ran —
1114
- * terminal and distinct from `failed` (it has no `output`, `error`, or cost). */
1115
- status: "succeeded" | "failed" | "running" | "skipped";
1116
- /**
1117
- * Action output on success. Present on the single-run detail endpoint;
1118
- * intentionally omitted from the paginated run-history list response (an
1119
- * output can be an arbitrarily large response body, and the list would
1120
- * otherwise carry unbounded payloads), so it is absent there.
1121
- */
1122
- output?: unknown;
1123
- error?: string;
1124
- costUsd?: number;
1125
- /** Graph-run identity: the topology node this action row belongs to. Present
1126
- * when the id says something the row's position does not — an author's DAG
1127
- * node id, and every cycle re-entry row (a node visited more than once
1128
- * produces one row per visit). Absent on a linear run's rows, whose node id
1129
- * IS their position: read it as `step-${index + 1}`. */
1130
- nodeId?: string;
1131
- /** Which visit of `nodeId` this row is (1-based). Present on cycle re-entry
1132
- * rows only; a single-visit row omits it. */
1133
- visit?: number;
1134
- /** `script.run` only (single-run detail): the script's captured stdout
1135
- * (size-capped), or an artifact ref carrying the full log by reference. */
1136
- logs?: unknown;
1137
- /** How an `onError` policy handled this action's failure so the run
1138
- * continued (the action still reads `failed`). */
1139
- onError?: HubWorkflowOnErrorOutcome;
1140
- /** `agent.run` only (single-run detail): the agent's execution detail —
1141
- * per-iteration spans (each with text), aggregate usage, partial text. */
1142
- agentRun?: HubAgentRunDetail;
1143
- }
1144
- /** A single workflow run, as returned by the run-history endpoint. */
1145
- interface HubWorkflowRun {
1146
- id: string;
1147
- status: HubWorkflowRunStatus;
1148
- actionResults: HubWorkflowActionResult[];
1149
- /** Terminal run error (credit-exhausted, connection revoked, …); null on a clean run. */
1150
- error: string | null;
1151
- attempts: number;
1152
- /** Single-run detail only: the definition YAML captured at enqueue (null for
1153
- * runs from before snapshots, or a workflow with no stored definition). */
1154
- definitionSnapshot?: string | null;
1155
- /** Single-run detail only: the trigger payload/context the run executed
1156
- * against (capped server-side). Absent on the paginated list. */
1157
- triggerContext?: unknown;
1158
- createdAt: string;
1159
- startedAt: string | null;
1160
- completedAt: string | null;
1161
- }
1162
- /**
1163
- * A single run as returned by the single-run detail endpoint
1164
- * (`GET /v1/workflows/:id/runs/:runId`) and carried in the `snapshot` stream
1165
- * event. Unlike a run-history list item it always carries `workflowId` and the
1166
- * per-action `output` / `agentRun` detail (all size-capped server-side).
1167
- */
1168
- interface HubWorkflowRunDetail extends HubWorkflowRun {
1169
- workflowId: string;
1170
- /** The detail endpoint always returns these (unlike the run-history list,
1171
- * where they're absent) — narrowed to required here so a consumer of
1172
- * `getRun` / a `snapshot` event reads them without re-checking presence. */
1173
- triggerContext: unknown;
1174
- definitionSnapshot: string | null;
1175
- /** The terminal failed/cancelled run this one retries (enqueued via
1176
- * {@link HubWorkflowsClient.retryRun}); null on runs that are not retries. */
1177
- retriedFromRunId: string | null;
1178
- /** The compiled graph topology the run executed (resolved from the run's
1179
- * definition snapshot, so a post-run edit can't mislabel it) — null for a
1180
- * linear run. Present on the HTTP run-detail response. */
1181
- graph?: HubWorkflowGraphSpec | null;
1182
- /** Per-completion guard verdicts (keyed `"from->to"`), present only when the
1183
- * run carries a graph journal — i.e. a parked (`waiting`) graph run. */
1184
- edgeVerdicts?: HubWorkflowEdgeVerdicts[];
1185
- }
1186
- /**
1187
- * The trigger fields a manual "Run now" supplies, as a flat `{ path: value }`
1188
- * map (e.g. `{ "pull_request.number": "123" }`). Keys are the `path`s of the
1189
- * workflow's {@link HubManualRunInput}s; the server nests them into a trigger
1190
- * context so the run resolves exactly as a real trigger delivery would.
1191
- */
1192
- type HubWorkflowRunInputs = Record<string, string>;
1193
- /** Response of a manual run enqueue (`POST /v1/workflows/:id/run`). */
1194
- interface HubWorkflowRunEnqueued {
1195
- runId: string;
1196
- }
1197
- /**
1198
- * Result of cancelling a run (`POST /v1/workflows/:id/runs/:runId/cancel`).
1199
- *
1200
- * `cancelled` — a `queued` run was stopped synchronously in the store; it is
1201
- * already terminal. `cancelling` — a `running` run was signalled to abort; it
1202
- * settles `cancelled` a moment later as its in-flight action tears down. Observe
1203
- * the true terminal state via {@link HubWorkflowRunDetail} (`getRun`) or the run
1204
- * event stream (`watchRun`). A finished run throws `HubSdkError` with code
1205
- * `RUN_NOT_CANCELLABLE`; an unknown/foreign run throws `NOT_FOUND`.
1206
- */
1207
- interface HubWorkflowRunCancelResult {
1208
- runId: string;
1209
- status: "cancelled" | "cancelling";
1210
- /** Only on a `cancelling` result: whether the abort reached a worker running
1211
- * this run on the API instance that served the request. `false` → the run
1212
- * just finished, or executes on another instance and will stop on its own;
1213
- * watch/poll the run to confirm it settled `cancelled`. */
1214
- signalled?: boolean;
1215
- }
1216
- /**
1217
- * Response of a run retry (`POST /v1/workflows/:id/runs/:runId/retry`): the
1218
- * NEWLY enqueued run's id — a fresh run of the same workflow with the same
1219
- * trigger context — plus the terminal run it was retried from. A finished
1220
- * run in any other state throws `HubSdkError` with code `RUN_NOT_RETRYABLE`;
1221
- * an unknown/foreign run throws `NOT_FOUND`.
1222
- */
1223
- interface HubWorkflowRunRetried {
1224
- runId: string;
1225
- retriedFromRunId: string;
1226
- }
1227
- /**
1228
- * A live event from a run's SSE stream (`GET /v1/workflows/:id/runs/:runId/events`),
1229
- * as surfaced by {@link HubWorkflowsClient.watchRun}. `snapshot` is the current
1230
- * persisted run detail sent first; the lifecycle/token events mirror the run as
1231
- * it executes; `ping` is a keepalive; `run.done` is terminal and closes the
1232
- * stream. Unknown server event types are dropped rather than surfaced, so new
1233
- * event kinds don't break older clients.
1234
- */
1235
- type HubWorkflowRunStreamEvent = {
1236
- type: "snapshot";
1237
- run: HubWorkflowRunDetail;
1238
- } | {
1239
- type: "action.started";
1240
- index: number;
1241
- kind: string;
1242
- at: string;
1243
- } | {
1244
- type: "action.finished";
1245
- index: number;
1246
- kind: string;
1247
- status: "succeeded" | "failed" | "skipped";
1248
- costUsd?: number;
1249
- error?: string;
1250
- at: string;
1251
- } | {
1252
- type: "iteration.started";
1253
- actionIndex: number;
1254
- iterationIndex: number;
1255
- model?: string;
1256
- at: string;
1257
- } | {
1258
- type: "iteration.ended";
1259
- actionIndex: number;
1260
- iterationIndex: number;
1261
- status: "succeeded" | "failed";
1262
- outputPreview?: string;
1263
- inputTokens?: number;
1264
- outputTokens?: number;
1265
- costUsd?: number;
1266
- at: string;
1267
- } | {
1268
- type: "token";
1269
- actionIndex: number;
1270
- delta: string;
1271
- at: string;
1272
- } | {
1273
- type: "ping";
1274
- } | {
1275
- type: "run.done";
1276
- status: "succeeded" | "failed" | "cancelled";
1277
- error?: string | null;
1278
- at?: string;
1279
- } | {
1280
- type: "run.waiting";
1281
- decisionId: string;
1282
- at?: string;
1283
- };
1284
- /** Latest-run snapshot attached to each workflow on the list response. */
1285
- interface HubWorkflowRunSummary {
1286
- id: string;
1287
- status: HubWorkflowRunStatus;
1288
- error: string | null;
1289
- createdAt: string;
1290
- completedAt: string | null;
1291
- /** Execution start; null while queued, absent from older responses. */
1292
- startedAt?: string | null;
1293
- }
1294
- /** One page of run history; `nextCursor` is null on the last page. */
1295
- interface HubWorkflowRunsPage {
1296
- runs: HubWorkflowRun[];
1297
- nextCursor: string | null;
1298
- }
1299
- /** Trailing windows the fleet-insights endpoint accepts. */
1300
- type HubWorkflowFleetWindow = "24h" | "7d" | "30d";
1301
- /**
1302
- * One workflow's row in the fleet overview: its run tallies over the window.
1303
- * `lastRunStatus`/`lastRunAt` describe the newest run INSIDE the window (null
1304
- * when the workflow didn't run in it), and `successRate` is
1305
- * `succeeded / runsInWindow` — null, never a fabricated 0 or 1, when there is
1306
- * no denominator.
1307
- */
1308
- interface HubWorkflowFleetEntry {
1309
- id: string;
1310
- name: string;
1311
- enabled: boolean;
1312
- runsInWindow: number;
1313
- succeeded: number;
1314
- failed: number;
1315
- /** Runs parked on a human `decision` step (status `waiting`). */
1316
- waiting: number;
1317
- successRate: number | null;
1318
- lastRunStatus: HubWorkflowRunStatus | null;
1319
- lastRunAt: string | null;
1320
- }
1321
- /** `GET /v1/workflows/insights/fleet` — the whole fleet, sorted failing-first. */
1322
- interface HubWorkflowFleetInsights {
1323
- window: HubWorkflowFleetWindow;
1324
- /** ISO instant the window starts at (now minus the window length). */
1325
- windowStart: string;
1326
- workflows: HubWorkflowFleetEntry[];
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
- }
1482
- interface HubWorkflow {
1483
- id: string;
1484
- name: string;
1485
- description: string | null;
1486
- enabled: boolean;
1487
- /** Compiled engine actions (connection refs resolved to ids). */
1488
- actions: HubWorkflowAction[];
1489
- /** The durable YAML this workflow compiled from. */
1490
- definitionYaml: string | null;
1491
- validationErrors: HubWorkflowValidationError[];
1492
- /** Current head revision; null on pre-versioning rows until their next
1493
- * update (they have no revision history to point at yet). */
1494
- headRev?: number | null;
1495
- /** Present on get/create/update detail responses; omitted on list. */
1496
- triggers?: HubWorkflowTrigger[];
1497
- /** Present on the detail response: the trigger fields a manual run must supply,
1498
- * derived from the definition's `${trigger.*}` references (empty when none). */
1499
- manualRunInputs?: HubManualRunInput[];
1500
- /** Present on the get-detail response: the compiled graph topology (null
1501
- * when the definition has no graph topology, or is chain-equivalent —
1502
- * the legacy linear semantics). Omitted on the list projection. */
1503
- graph?: HubWorkflowGraphSpec | null;
1504
- /** Create response only, when the definition has a webhook trigger: the
1505
- * hook delivery URL, plus the plaintext bearer token exactly once at mint
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;
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>;
1531
- type HubWorkflowRevisionSource = "user" | "copilot" | "intelligence";
1532
- /** Lifecycle state of a revision. The head rev only ever points at an
1533
- * `applied` revision; `proposed` is a service-token-authored suggestion
1534
- * awaiting an owner decision; `rejected` is a declined proposal (kept for
1535
- * audit). */
1536
- type HubWorkflowRevisionStatus = "applied" | "proposed" | "rejected";
1537
- /** Revision list projection — attribution + note + status, WITHOUT the YAML body. */
1538
- interface HubWorkflowRevisionMeta {
1539
- rev: number;
1540
- createdAt: string;
1541
- createdBy: string;
1542
- source: HubWorkflowRevisionSource;
1543
- note: string | null;
1544
- status: HubWorkflowRevisionStatus;
1545
- }
1546
- /** One revision WITH its YAML (and the actions compiled alongside it). */
1547
- interface HubWorkflowRevision extends HubWorkflowRevisionMeta {
1548
- yaml: string;
1549
- actions: HubWorkflowAction[];
1550
- }
1551
- /** A proposal (proposed or rejected revision) WITH its evidence — what the
1552
- * proposer derived the suggestion from (e.g. health stats), plus
1553
- * `rejectionReason` once declined. */
1554
- interface HubWorkflowProposal extends HubWorkflowRevisionMeta {
1555
- evidence: unknown;
1556
- }
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;
1571
- }
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[];
1585
- }
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;
1602
- }
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;
1623
- }
1624
- //#endregion
1625
- //#region src/workflow-storage-types.d.ts
1626
- /** One KV entry with its metadata — the get/put/cas response shape. */
1627
- interface HubWorkflowKvEntry {
1628
- key: string;
1629
- value: unknown;
1630
- version: number;
1631
- updatedAt: string;
1632
- }
1633
- /** Keyspace metadata row (never the value) — the list response's entry. */
1634
- interface HubWorkflowKvEntryMeta {
1635
- key: string;
1636
- version: number;
1637
- updatedAt: string;
1638
- }
1639
- interface HubWorkflowKvListResponse {
1640
- entries: HubWorkflowKvEntryMeta[];
1641
- }
1642
- interface HubWorkflowKvDeleteResponse {
1643
- deleted: boolean;
1644
- }
1645
- /** The opaque ref a stored artifact is referred to by — the value a
1646
- * script.run node returns as its step output. */
1647
- interface HubWorkflowArtifactRef {
1648
- $artifact: string;
1649
- name: string;
1650
- contentType: string;
1651
- byteSize: number;
1652
- preview: string | null;
1653
- }
1654
- /** Artifact metadata (never the bytes), oldest first on the list response. */
1655
- interface HubWorkflowArtifact {
1656
- id: string;
1657
- runId: string;
1658
- workflowId: string;
1659
- /** The graph node (or `step-N` positional id on linear runs) whose action
1660
- * emitted the artifact. */
1661
- nodeId: string;
1662
- name: string;
1663
- contentType: string;
1664
- byteSize: number;
1665
- /** First 2KiB of textual content; null for binary content types. */
1666
- preview: string | null;
1667
- createdAt: string;
1668
- }
1669
- interface HubWorkflowArtifactsResponse {
1670
- artifacts: HubWorkflowArtifact[];
1671
- }
1672
- /** Raw artifact bytes from the download route, with their stored content type. */
1673
- interface HubWorkflowArtifactDownload {
1674
- bytes: Uint8Array;
1675
- contentType: string;
1676
- }
1677
- //#endregion
1678
- //#region src/lines.d.ts
1679
- interface HubLineMember {
1680
- id: string;
1681
- label: string | null;
1682
- role: string;
1683
- self?: boolean;
1684
- consent?: "enabled" | "required";
1685
- }
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;
1761
- } | null;
1762
- }
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 {
1779
- id: string;
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
- };
1805
- }
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;
1851
- }
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;
1860
- }
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>;
1893
- }
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. */
1914
- token: string;
1915
- }
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;
2015
- }
2016
- //#endregion
2017
- //#region src/transport.d.ts
2018
- type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
2019
- interface HubClientOptions {
2020
- baseUrl: string;
2021
- apiKey?: string;
2022
- authHeaders?: HubAuthHeaders;
2023
- fetch?: typeof fetch;
2024
- }
2025
- declare class HubSdkError extends Error {
2026
- readonly code: HubErrorBody["code"];
2027
- readonly details?: unknown;
2028
- readonly status?: number;
2029
- constructor(error: HubErrorBody, options?: {
2030
- status?: number;
2031
- });
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
2053
- declare const HUB_URL_ENV_VAR: "TANGLE_HUB_URL";
2054
- declare const HUB_API_KEY_ENV_VAR: "TANGLE_API_KEY";
2055
- declare const HUB_CAPABILITY_TOKEN_ENV_VAR: "TANGLE_HUB_CAPABILITY_TOKEN";
2056
- type HubEnv = Record<string, string | undefined>;
2057
- interface HubClientFromEnvOptions {
2058
- env?: HubEnv;
2059
- apiKey?: string;
2060
- authHeaders?: HubAuthHeaders;
2061
- fetch?: typeof fetch;
2062
- }
2063
- declare function resolveHubBaseUrl(env?: HubEnv): string;
2064
- declare function resolveHubAuth(env?: HubEnv): string;
2065
- //#endregion
2066
- //#region src/authorization.d.ts
2067
- interface HubTokenListOptions {
2068
- includeExpired?: boolean;
2069
- }
2070
- declare class HubTokensClient {
2071
- private readonly request;
2072
- constructor(request: HubRequest);
2073
- mint(options: {
2074
- actionPath: string;
2075
- connectionId?: string;
2076
- provider?: string;
2077
- ttlSeconds?: number;
2078
- }): Promise<HubTokenMintResponse>;
2079
- list(options?: HubTokenListOptions): Promise<HubTokensListResponse>;
2080
- revoke(tokenId: string): Promise<HubTokenRevokeResponse>;
2081
- }
2082
- declare class HubPermissionsClient {
2083
- private readonly request;
2084
- constructor(request: HubRequest);
2085
- list(connectionId: string): Promise<HubPolicyListResponse>;
2086
- set(input: HubPolicyUpdateRequest): Promise<HubPolicyResponse>;
2087
- /** Reset an action to its default by deleting any stored override. */
2088
- delete(input: HubPolicyDeleteRequest): Promise<HubPolicyDeleteResponse>;
2089
- /** Bulk-allow every write action of a connection's provider. Reads are
2090
- * already allowed for sandbox agents; destructive actions stay `ask`.
2091
- * Idempotent: actions with an existing policy are left untouched. */
2092
- allowWrites(connectionId: string): Promise<HubAllowWritesResponse>;
2093
- /** Inverse of `allowWrites`: delete only the rows it created for this
2094
- * connection. Manual per-action decisions are left intact. */
2095
- revertWrites(connectionId: string): Promise<HubRevertWritesResponse>;
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
2106
- interface HubToolSearchOptions {
2107
- provider?: string;
2108
- /** Max tools to return. The server defaults to a relevance-ranked shortlist
2109
- * (20); pass a higher value (bounded server-side) to enumerate a provider's
2110
- * full action list, e.g. for a catalog/browse UI. The cap bounds the MERGED
2111
- * response across sources — with no `provider` set, a low limit can exclude
2112
- * some providers' tools, so scope by `provider` when you need one connector's
2113
- * complete list. */
2114
- limit?: number;
2115
- }
2116
- interface HubToolInvokeOptions {
2117
- connectionId?: string;
2118
- approve?: boolean;
2119
- /** Caller-minted key for this invoke. On the direct exec arm the platform
2120
- * ledger replays the first call's result for a retry that carries the same
2121
- * key, and refuses a key bound to a different request. The approval and
2122
- * capability-token retries re-send the key, and the connector receives it
2123
- * for provider-native dedupe. Capability-token execution stays at-most-once
2124
- * per token: it refuses a replay instead of replaying a stored result. */
2125
- idempotencyKey?: string;
2126
- }
2127
- declare class HubToolsClient {
2128
- private readonly request;
2129
- constructor(request: HubRequest);
2130
- search(query: string, options?: HubToolSearchOptions): Promise<HubToolsSearchResponse>;
2131
- sources(): Promise<HubToolSourcesResponse>;
2132
- describe(path: string): Promise<HubToolsDescribeResponse>;
2133
- /**
2134
- * Run one hub tool. `raw` is the tool input: the SDK forwards it verbatim as
2135
- * the request body's `input`, and the server validates it against the tool's
2136
- * own schema, so the client never gives it a shape.
2137
- */
2138
- invoke<TResult = unknown>(path: string, raw: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
2139
- private buildExecInit;
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
2195
- interface HubConnectionStartOptions {
2196
- returnUrl?: string;
2197
- cli?: boolean;
2198
- connectionParameters?: Record<string, string>;
2199
- /** GitHub accepts the exact read:user, repo, read:org set. */
2200
- requestedScopes?: readonly string[];
2201
- }
2202
- declare class HubConnectionsClient {
2203
- private readonly request;
2204
- readonly inboundWebhook: HubInboundWebhooksClient;
2205
- constructor(request: HubRequest);
2206
- list(): Promise<HubConnectionsResponse>;
2207
- /** Connector catalog: every provider the hub can expose, each flagged with
2208
- * `configured` (whether its OAuth app credentials are wired). Callers render
2209
- * this alongside `list()` to offer Connect for not-yet-connected providers. */
2210
- providers(): Promise<HubProvidersResponse>;
2211
- start(provider: string, options?: HubConnectionStartOptions): Promise<HubOAuthStartResponse>;
2212
- startWhatsappEmbeddedSignup(options?: HubWhatsappEmbeddedSignupStartRequest): Promise<HubWhatsappEmbeddedSignupStartResponse>;
2213
- completeWhatsappEmbeddedSignup(input: HubWhatsappEmbeddedSignupCompleteRequest): Promise<HubWhatsappEmbeddedSignupCompleteResponse>;
2214
- /** Connect a non-OAuth (api-key) connector by submitting the user's key.
2215
- * The server validates the key with a live probe before persisting and
2216
- * returns the created (or reconnected) connection — there is no redirect,
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>;
2220
- revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
2221
- health(connectionId: string): Promise<HubConnectionHealthResponse>;
2222
- }
2223
- //#endregion
2224
- //#region src/channels.d.ts
2225
- declare class HubChannelsClient {
2226
- private readonly request;
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>;
2238
- }
2239
- //#endregion
2240
- //#region src/github-app.d.ts
2241
- declare class HubGithubAppClient {
2242
- private readonly request;
2243
- constructor(request: HubRequest);
2244
- mintInstallationToken(input: HubGithubAppMintInstallationTokenRequest): Promise<HubGithubAppMintInstallationTokenResponse>;
2245
- /** Every installation the caller may act through — their own and any org's
2246
- * they were verified against. The management surface's read. */
2247
- listInstallations(): Promise<HubGithubAppListInstallationsResponse>;
2248
- /**
2249
- * Find installations `listInstallations` cannot show: the hub only registers
2250
- * what the setup redirect witnessed, so an org install approved out of band —
2251
- * or created by another member — is invisible until this asks GitHub for it.
2252
- * Links whatever the caller can prove access to; never uninstalls anything.
2253
- */
2254
- syncInstallations(): Promise<HubGithubAppSyncResponse>;
2255
- /** Give up THIS caller's access. Not an uninstall — the installation is
2256
- * account-level and other members may still be using it. */
2257
- disconnectInstallation(installationId: number): Promise<HubGithubAppDisconnectResponse>;
2258
- getInstallation(installationId: number): Promise<HubGithubAppInstallationResponse>;
2259
- listRepos(installationId: number): Promise<HubGithubAppListReposResponse>;
2260
- isRepoInstalled(input: {
2261
- owner: string;
2262
- repo: string;
2263
- }): Promise<HubGithubAppIsRepoInstalledResponse>;
2264
- }
2265
- //#endregion
2266
- //#region src/audit.d.ts
2267
- declare class HubAuditClient {
2268
- private readonly request;
2269
- constructor(request: HubRequest);
2270
- list(options?: HubAuditListRequest): Promise<HubAuditResponse>;
2271
- }
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 {
2306
- private readonly stream?;
2307
- private readonly download?;
2308
- constructor(request: HubRequest, stream?: HubStreamRequest | undefined, download?: HubArtifactRequest | undefined);
2309
- list(): Promise<HubWorkflow[]>;
2310
- /**
2311
- * Owner-wide fleet overview: one row per workflow with its run tallies over
2312
- * a trailing window (default 7d), sorted failing-first. Answers "how are ALL
2313
- * my workflows doing" in one call — the per-workflow insights endpoint is
2314
- * the drill-down, not a way to build this row set client-side.
2315
- */
2316
- fleetInsights(opts?: {
2317
- window?: HubWorkflowFleetWindow;
2318
- }): Promise<HubWorkflowFleetInsights>;
2319
- get(id: string): Promise<HubWorkflow>;
2320
- create(yaml: string): Promise<HubWorkflow>;
2321
- /**
2322
- * Replace the workflow's definition from YAML (recompiled server-side,
2323
- * triggers reconciled). Every landed update appends a revision;
2324
- * `opts.note` rides onto that revision row (e.g. "why this change"), visible
2325
- * in {@link listRevisions}. Throws `HubSdkError`: `WORKFLOW_INVALID` when the
2326
- * YAML doesn't compile or its connections aren't met, `CONFLICT` on a
2327
- * concurrent modification, `NOT_FOUND` for an unknown/foreign id.
2328
- */
2329
- update(id: string, yaml: string, opts?: {
2330
- note?: string;
2331
- }): Promise<HubWorkflow>;
2332
- delete(id: string): Promise<void>;
2333
- /**
2334
- * Enable or disable a workflow without editing its YAML. Works even when the
2335
- * workflow's connection was revoked (a disabled workflow can't be recompiled
2336
- * via `update`, but it can still be paused/resumed here).
2337
- */
2338
- setEnabled(id: string, enabled: boolean): Promise<HubWorkflow>;
2339
- /**
2340
- * One page of run history, newest first. Pass the previous page's
2341
- * `nextCursor` to fetch the next; a null `nextCursor` means the last page.
2342
- */
2343
- listRuns(id: string, opts?: {
2344
- limit?: number;
2345
- cursor?: string;
2346
- }): Promise<HubWorkflowRunsPage>;
2347
- /**
2348
- * Enqueue an immediate ("Run now") run and return its `runId`. The run goes
2349
- * through the identical execution path a trigger delivery uses.
2350
- *
2351
- * `inputs` supplies the trigger fields the workflow reads (its
2352
- * {@link HubWorkflow.manualRunInputs}), as a flat `{ path: value }` map — e.g.
2353
- * `{ "pull_request.number": "123" }`. Omit it for a one-click run of a
2354
- * workflow that reads no trigger fields. Throws `HubSdkError`:
2355
- * `MISSING_RUN_INPUTS` when a required field is absent (`details.missing`
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.
2359
- */
2360
- run(id: string, inputs?: HubWorkflowRunInputs, opts?: {
2361
- signal?: AbortSignal;
2362
- }): Promise<HubWorkflowRunEnqueued>;
2363
- /**
2364
- * A single run's full detail: per-action `output` + `agentRun` execution
2365
- * detail (size-capped server-side) and the trigger context — the deep "why
2366
- * did this run do what it did" view. `NOT_FOUND` when the run is unknown or
2367
- * does not belong to both the caller and this workflow.
2368
- */
2369
- getRun(id: string, runId: string, opts?: {
2370
- signal?: AbortSignal;
2371
- }): Promise<HubWorkflowRunDetail>;
2372
- /**
2373
- * Stop a queued or in-flight run. A `queued` run is cancelled synchronously
2374
- * and comes back `{ status: "cancelled" }` (already terminal); a `running` run
2375
- * is signalled to abort and comes back `{ status: "cancelling", signalled }` —
2376
- * it settles `cancelled` a moment later as its current action tears down, which
2377
- * a {@link watchRun}/{@link getRun} observes. Throws `HubSdkError`:
2378
- * `RUN_NOT_CANCELLABLE` when the run already finished, `NOT_FOUND` for an
2379
- * unknown/foreign run id. Pass `opts.signal` to abort a slow request.
2380
- */
2381
- cancel(id: string, runId: string, opts?: {
2382
- signal?: AbortSignal;
2383
- }): Promise<HubWorkflowRunCancelResult>;
2384
- /**
2385
- * Re-run a terminal failed/cancelled run: enqueues a FRESH run of the same
2386
- * workflow with the SAME trigger context the original ran against, linked
2387
- * back to it via `retriedFromRunId`. The original row is never mutated —
2388
- * execution is at-most-once, so a retry is always a new run, never a
2389
- * requeue. The response carries the NEW run id (and the run it retried);
2390
- * follow it with {@link getRun}/{@link watchRun}/{@link waitForRun} like any
2391
- * other run. Throws `HubSdkError`: `RUN_NOT_RETRYABLE` when the run is not
2392
- * terminal-failed/cancelled (queued/running/waiting, or succeeded),
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.
2395
- */
2396
- retryRun(id: string, runId: string, opts?: {
2397
- signal?: AbortSignal;
2398
- }): Promise<HubWorkflowRunRetried>;
2399
- /**
2400
- * Stream a run's live progress as an async iterable of typed events. The
2401
- * first event is always a `snapshot` of the current persisted state; then
2402
- * `action.*` / `iteration.*` / `token` ticks arrive as the run executes;
2403
- * `ping` is a keepalive; a terminal `run.done` ends the iteration. If the run
2404
- * is already finished when the stream opens, it yields the snapshot then
2405
- * `run.done` and completes.
2406
- *
2407
- * Live ticks require the worker executing the run to share the API process;
2408
- * across instances only `snapshot` + `run.done` (from the server's terminal
2409
- * poll) arrive — the persisted record, read via {@link getRun}, stays the
2410
- * source of truth. Pass `signal` to cancel; iterating to `run.done` (or
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)`.
2418
- */
2419
- watchRun(id: string, runId: string, opts?: {
2420
- signal?: AbortSignal;
2421
- }): AsyncGenerator<HubWorkflowRunStreamEvent>;
2422
- /** One connection's events, then how it ended. */
2423
- private watchRunOnce;
2424
- /**
2425
- * Poll {@link getRun} until the run reaches a terminal state (`succeeded` or
2426
- * `failed`) and return its detail. The scripting primitive behind "run and
2427
- * print the result": pairs with {@link run} for a one-call trigger-and-wait.
2428
- *
2429
- * Returns as soon as the run leaves the active set (`queued` / `running`) —
2430
- * i.e. on `succeeded`, `failed`, or any future non-active status — so a new
2431
- * terminal state can never hang the wait. Polls every `pollIntervalMs`
2432
- * (default 2000). With `timeoutMs` set, throws
2433
- * `HubSdkError(WORKFLOW_RUN_TIMEOUT)` — carrying the last observed status on
2434
- * `details.status` — only once the deadline has actually passed; the last
2435
- * wait is clamped to the remaining time so a `timeoutMs` shorter than the
2436
- * poll interval still waits the full requested window rather than giving up a
2437
- * poll early. Pass `signal` to cancel the wait between polls.
2438
- */
2439
- waitForRun(id: string, runId: string, opts?: {
2440
- pollIntervalMs?: number;
2441
- timeoutMs?: number;
2442
- signal?: AbortSignal;
2443
- }): Promise<HubWorkflowRunDetail>;
2444
- /**
2445
- * The workflow's definition history, newest rev first — metadata only (rev,
2446
- * attribution, note); fetch the YAML per-rev with {@link getRevision}. Empty
2447
- * for a pre-versioning workflow until its next update.
2448
- */
2449
- listRevisions(id: string): Promise<HubWorkflowRevisionMeta[]>;
2450
- /**
2451
- * One revision WITH its YAML (and the actions compiled alongside it), for
2452
- * diff/inspect views. Throws `HubSdkError(REVISION_NOT_FOUND)` for an
2453
- * unknown rev, `NOT_FOUND` for an unknown/foreign workflow.
2454
- */
2455
- getRevision(id: string, rev: number): Promise<HubWorkflowRevision>;
2456
- /**
2457
- * Restore a prior rev's YAML as a NEW head revision (history is append-only)
2458
- * through the same compile path as {@link update}, so the restored definition
2459
- * is re-validated against today's connections/models. Throws `HubSdkError`:
2460
- * `REVISION_NOT_FOUND` for an unknown rev, `WORKFLOW_INVALID` when the old
2461
- * YAML no longer compiles, `CONFLICT` on a concurrent modification.
2462
- */
2463
- rollback(id: string, rev: number): Promise<HubWorkflow>;
2464
- /**
2465
- * Deterministic health stats over the workflow's last N terminal runs
2466
- * (default 20, max 100): per-node visits/failures/cost/duration, failure
2467
- * clusters by normalized error signature, and distillation CANDIDATES
2468
- * (agent.run nodes with near-static outputs — labeled with their
2469
- * measurements, never as verdicts). No model in this path.
2470
- */
2471
- health(id: string, opts?: {
2472
- runs?: number;
2473
- }): Promise<HubWorkflowHealth>;
2474
- /**
2475
- * One agent round's execution timeline, paged. `action` is the action's
2476
- * `${steps[N]}` position and `iteration` the round's position in that
2477
- * action's `iterations` — both exactly as the run detail serializes them.
2478
- * Pass the previous page's `nextCursor` as `after` for the next page; a null
2479
- * `nextCursor` means the round is fully read.
2480
- */
2481
- listRunSteps(id: string, runId: string, input: {
2482
- action: number;
2483
- iteration: number;
2484
- after?: number;
2485
- limit?: number;
2486
- }): Promise<HubWorkflowRunStepsPage>;
2487
- /**
2488
- * Store one artifact for a run (raw bytes) and return the opaque ref — the
2489
- * value a script.run node returns as its step output. `contentType` defaults
2490
- * to `application/octet-stream`; `nodeId` attributes the write to a graph
2491
- * node (owner credential only — a run-scoped token binds its own node).
2492
- * Throws `HubSdkError(ARTIFACT_TOO_LARGE)` past the server cap.
2493
- */
2494
- uploadArtifact(id: string, runId: string, input: {
2495
- name: string;
2496
- bytes: Uint8Array;
2497
- contentType?: string;
2498
- nodeId?: string;
2499
- }): Promise<HubWorkflowArtifactRef>;
2500
- /** Metadata for every artifact of the run (never the bytes), oldest first. */
2501
- listArtifacts(id: string, runId: string): Promise<HubWorkflowArtifactsResponse>;
2502
- /**
2503
- * The artifact's raw bytes with their stored content type — the route every
2504
- * `downloadUrl` attached to an `$artifact` ref in a run detail points at.
2505
- */
2506
- downloadArtifact(id: string, runId: string, artifactId: string): Promise<HubWorkflowArtifactDownload>;
2507
- /** The curated starter gallery runnable on THIS deployment: metadata,
2508
- * parameters, referenced providers, and a concrete `previewYaml` per card. */
2509
- listTemplates(): Promise<HubWorkflowTemplate[]>;
2510
- /**
2511
- * One-click create from a gallery template: substitutes `parameters` into
2512
- * the template server-side, then runs the SAME create path as
2513
- * {@link create}. A `{ created: false }` result is NOT an error — an
2514
- * actionable continuation listing the connections to satisfy before
2515
- * retrying. Invalid parameters or a compile failure throw `HubSdkError`
2516
- * (400); an unknown template id throws `NOT_FOUND`.
2517
- */
2518
- instantiateTemplate(templateId: string, parameters?: Record<string, string>): Promise<HubWorkflowTemplateInstantiateResult>;
2519
- /**
2520
- * The caller's open decisions across all workflows — the always-available
2521
- * "pending approvals" surface. Each entry carries its workflow's name (null
2522
- * when the workflow was deleted while the run was parked).
2523
- */
2524
- listPendingDecisions(): Promise<HubWorkflowPendingDecisionsResponse>;
2525
- /**
2526
- * The pending decision a run is parked on. Throws `HubSdkError(NOT_FOUND)`
2527
- * when the run is unknown/foreign or holds no pending decision.
2528
- */
2529
- getRunDecision(id: string, runId: string): Promise<HubWorkflowDecision>;
2530
- /**
2531
- * Answer the decision a run is parked on and resume it from the next action.
2532
- * `decisionId` is REQUIRED: a run can resolve one decision and re-park on the
2533
- * next, so an answer addressed only by run could silently land on a question
2534
- * the caller never saw — a mismatch throws `HubSdkError(DECISION_SUPERSEDED)`.
2535
- * Other typed failures: `INVALID_CHOICE` (400), `DECISION_ALREADY_RESOLVED` /
2536
- * `DECISION_EXPIRED` (409), `DECISION_NOT_FOUND` (404), `RUN_NOT_WAITING`
2537
- * (409 — answered, timed out, or cancelled first).
2538
- */
2539
- resolveRunDecision(id: string, runId: string, input: {
2540
- decisionId: string;
2541
- choice: string;
2542
- note?: string;
2543
- }): Promise<HubWorkflowDecisionResolveResult>;
2544
- /**
2545
- * Dry-run a YAML definition against the platform compiler without saving it.
2546
- *
2547
- * `opts.structural` selects the CI mode: the platform skips its owner-scoped
2548
- * connection/skill/profile resolution, so the verdict depends only on the
2549
- * definition and the deployment's capabilities — identical no matter which
2550
- * providers the calling account has connected. Use it in pipelines that
2551
- * assert "this YAML is well-formed"; leave it off in an editor, where naming
2552
- * the unconnected providers is the point.
2553
- */
2554
- validate(yaml: string, opts?: {
2555
- structural?: boolean;
2556
- }): Promise<HubWorkflowValidateResponse>;
2557
- schema(): Promise<HubWorkflowSchemaResponse>;
2558
- }
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
2602
37
  //#region src/event-delivery.d.ts
2603
38
  type HubEventSignatureFailure = "missing" | "malformed" | "stale" | "mismatch";
2604
39
  type HubEventSignatureResult = {
@@ -2838,5 +273,5 @@ declare class HubLineGrantsClient extends HubTransport {
2838
273
  //#region src/redaction.d.ts
2839
274
  declare function redactHubValue(value: unknown): unknown;
2840
275
  //#endregion
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 };
276
+ 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, HubWorkflowCondition, HubWorkflowConditionOp, HubWorkflowConditionScalar, HubWorkflowConnectionRequirement, HubWorkflowDecision, HubWorkflowDecisionOnTimeout, HubWorkflowDecisionResolveResult, HubWorkflowDecisionResolvedVia, HubWorkflowDecisionStatus, HubWorkflowDistillationCandidate, HubWorkflowEdgeVerdicts, HubWorkflowEventFilter, HubWorkflowFailureCluster, HubWorkflowFleetEntry, HubWorkflowFleetInsights, HubWorkflowFleetWindow, HubWorkflowGraphEdge, HubWorkflowGraphJoinRule, HubWorkflowGraphNode, 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, isHubUnauthenticated, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature, workflowConnectionRequirementKey };
2842
277
  //# sourceMappingURL=index.d.ts.map