@tangle-network/hub-sdk 0.15.3-develop.20260731000024.8def6ab → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,9 +30,7 @@ SaaS vs on-prem flips via env only — there is no per-client default URL.
30
30
  | `TANGLE_API_KEY` | One of | Long-lived API key (Bearer). User / API key principal. |
31
31
  | `TANGLE_HUB_CAPABILITY_TOKEN` | One of | Short-lived capability token (Bearer). Sandbox-runtime principal. Auto-minted server-side per action. |
32
32
 
33
- The two auth credentials are mutually exclusive — set exactly one. This
34
- mirrors the platform-api `hubSandboxEnvironmentSchema` rule
35
- (`exactly-one-api-key-or-capability-token`).
33
+ The two auth credentials are mutually exclusive — set exactly one.
36
34
 
37
35
  ### Examples
38
36
 
@@ -229,8 +227,54 @@ before starting product work.
229
227
  - `HubSdkError` — typed `code: HubErrorCode`, redacted `details`, optional
230
228
  HTTP `status`
231
229
  - `HUB_URL_ENV_VAR`, `HUB_API_KEY_ENV_VAR`, `HUB_CAPABILITY_TOKEN_ENV_VAR` —
232
- string constants for the env-var names (mirrored by the platform-api
233
- `hub-sandbox-contract.ts` `z.literal(...)`)
230
+ string constants for the env-var names
234
231
  - `resolveHubBaseUrl(env?)`, `resolveHubAuth(env?)` — standalone resolvers
235
232
  with the same fail-loud contract as `fromEnv`
236
233
  - All request/response types from the `/v1/hub/*` contract
234
+
235
+
236
+ ## Link application login to explicit Hub permissions
237
+
238
+ Use the same `HubClient` for application management; do not add a product-local
239
+ HTTP client. These operations require the authenticated developer account, not
240
+ an app's OIDC access token. Customer grants are created only by the existing
241
+ session-authenticated `/cross-site/app-consent` flow.
242
+
243
+ ```ts
244
+ import { HubClient } from "@tangle-network/hub-sdk";
245
+
246
+ const hub = HubClient.fromEnv(); // developer account for app administration
247
+ const { app, clientSecret } = await hub.apps.create({
248
+ name: "Support assistant",
249
+ redirectUris: ["https://assistant.example/hub/callback"],
250
+ allowedScopes: ["github.issues.create"],
251
+ });
252
+ // Save clientSecret once in the application's server-side secret store.
253
+ await hub.apps.linkOAuthClient(app.id, oidcClientId);
254
+ const apps = await hub.apps.list(); // includes oauthClientId; never the secret
255
+ ```
256
+
257
+ `oidcClientId` is the application's already-registered Sign in with Tangle client.
258
+ Linking requires the same owner on both records and is immutable and one-to-one.
259
+ It does not reuse the two clients' secrets, change their IDs, create a user grant,
260
+ or authorize spending. Use separate app/client pairs for separate deployments.
261
+ Existing unlinked broker apps remain compatible. There is no automatic link by
262
+ name, callback domain, email, or ownership alone.
263
+
264
+ With a customer's authenticated Hub client, `hub.apps.grants.list()` returns only
265
+ that customer's active resource grants and `hub.apps.grants.revoke(grantId)`
266
+ revokes one idempotently. App administrators use `hub.apps.revoke(appId)` to
267
+ suspend the app, revoke all its customer grants, and disable its owned linked
268
+ OIDC client. An app's broker credential cannot call these management methods.
269
+
270
+ Broker execution keeps the one approved connection even when the invocation
271
+ omits `connectionId`; it never substitutes another account. Each one-shot broker
272
+ token is checked against current app policy and the exact active grant when
273
+ minted and consumed. Changing consent revokes the old binding, tokens and codes;
274
+ the fresh consent response supplies a new grant ID. Login disconnect revokes the
275
+ linked app's existing grants for that customer, not other customers or apps.
276
+ An operation already admitted to a provider may finish; revocation blocks new
277
+ admissions and minting, not external side effects already underway.
278
+
279
+ This is identity and resource delegation, **not** generalized spending delegation.
280
+ Existing product billing checks and action approvals continue to apply.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,214 @@
1
+ //#region src/apps.d.ts
2
+ /** App identity and customer permissions over the existing Platform transport.
3
+ * These operations do not authorize spending or expose upstream credentials. */
4
+ interface HubApp {
5
+ id: string;
6
+ clientId: string;
7
+ oauthClientId: string | null;
8
+ name: string;
9
+ redirectUris: string[];
10
+ allowedScopes: string[];
11
+ homepageUrl: string | null;
12
+ status: "active" | "revoked";
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ }
16
+ interface HubAppCreateInput {
17
+ name: string;
18
+ redirectUris: string[];
19
+ allowedScopes: string[];
20
+ homepageUrl?: string;
21
+ /** Associate an existing owned login client in the same transaction as creation. */
22
+ oauthClientId?: string;
23
+ }
24
+ interface HubAppGrant {
25
+ id: string;
26
+ appId: string;
27
+ userId: string;
28
+ connectionId: string;
29
+ scopes: string[];
30
+ status: "active" | "revoked";
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ revokedAt: string | null;
34
+ /** Display metadata is additive; older deployments may omit it. */
35
+ appName?: string | null;
36
+ oauthClientId?: string | null;
37
+ providerId?: string | null;
38
+ accountDisplay?: string | null;
39
+ connectionDisplayName?: string | null;
40
+ }
41
+ interface HubAppGrantRevoked {
42
+ grantId: string;
43
+ status: "revoked";
44
+ revokedAt: string | null;
45
+ tokensRevoked: number;
46
+ }
47
+ declare class HubAppsClient {
48
+ private readonly request;
49
+ readonly grants: {
50
+ list: () => Promise<HubAppGrant[]>;
51
+ revoke: (grantId: string) => Promise<HubAppGrantRevoked>;
52
+ };
53
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
54
+ list(): Promise<HubApp[]>;
55
+ /** The secret is returned only by creation; keep it in your server vault. */
56
+ create(input: HubAppCreateInput): Promise<{
57
+ app: HubApp;
58
+ clientSecret: string;
59
+ }>;
60
+ /** Immutable association of two existing records with the same owner. */
61
+ linkOAuthClient(appId: string, clientId: string): Promise<{
62
+ appId: string;
63
+ oauthClientId: string;
64
+ }>;
65
+ revoke(appId: string): Promise<{
66
+ appId: string;
67
+ grantsRevoked: number;
68
+ tokensRevoked: number;
69
+ }>;
70
+ }
71
+ //#endregion
72
+ //#region src/inbound-webhooks.d.ts
73
+ /** Provider setup uses the existing authenticated Hub transport and vault. */
74
+ interface HubInboundWebhookCreateOptions {
75
+ /** Inkbox identity that owns all selected channels. */
76
+ identityId?: string;
77
+ mailboxId?: string;
78
+ phoneNumberId?: string;
79
+ imessage?: boolean;
80
+ /** Linq: explicit owned lines; omitted does not mean every account line. */
81
+ phoneNumbers?: string[];
82
+ /** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
83
+ phoneNumberIds?: string[];
84
+ /** Contiguity Console secret, or an existing Inkbox identity signing key. */
85
+ signingSecret?: string;
86
+ }
87
+ interface HubInboundWebhookCreateResponse {
88
+ url: string;
89
+ /** True only when the provider subscription was created by the server. */
90
+ provisioned?: boolean;
91
+ /** Self-configured legacy providers can return a newly minted secret once. */
92
+ secret?: string;
93
+ inboundAddress?: string;
94
+ requiresProviderSetup?: boolean;
95
+ }
96
+ interface HubInboundWebhookStatus {
97
+ configured: boolean;
98
+ url?: string;
99
+ /** Configuration is not evidence of a real delivered message. */
100
+ deliveryVerified: false;
101
+ requiresProviderSetup?: boolean;
102
+ }
103
+ /** Live provider readback for one explicitly selected Linq WhatsApp number. */
104
+ interface HubInboundPhoneNumberScope {
105
+ configured: true;
106
+ provisioned: true;
107
+ subscribed: true;
108
+ phoneNumberIds: string[];
109
+ }
110
+ declare class HubInboundWebhooksClient {
111
+ private readonly request;
112
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
113
+ create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
114
+ get(connectionId: string): Promise<HubInboundWebhookStatus>;
115
+ /** Add one owned Linq WhatsApp number without rotating the webhook secret. */
116
+ ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
117
+ /** Remove event subscriptions first. This does not silently rotate a live URL. */
118
+ delete(connectionId: string): Promise<{
119
+ removed: boolean;
120
+ }>;
121
+ private path;
122
+ }
123
+ //#endregion
124
+ //#region src/managed-numbers.d.ts
125
+ interface HubNumberReadiness {
126
+ configured: boolean;
127
+ provider: "inkbox";
128
+ transports: Array<"sms" | "imessage">;
129
+ billing: "prepaid_activation";
130
+ automaticRentalBilling: false;
131
+ deliveryVerified: false;
132
+ }
133
+ interface HubNumberQuote {
134
+ transport: "sms" | "imessage";
135
+ activationCents: number;
136
+ currency: "usd";
137
+ termsVersion: string;
138
+ terms: string;
139
+ expiresAt: number;
140
+ token: string;
141
+ }
142
+ /** An operator's terminal decision on an order stuck in `needs_review`.
143
+ * Read-only for a creator: the resolution is made through the platform's
144
+ * admin surface, never through this client. */
145
+ interface HubNumberResolution {
146
+ action: "release" | "settle" | "abandon";
147
+ operator: string;
148
+ reason: string;
149
+ at: number;
150
+ /** Present while the operator's action is still running. The decision is
151
+ * not final and the order can still return to review. */
152
+ pending?: true;
153
+ /** Present when a `settle` handed a live, unfinished order back to
154
+ * provisioning, so the order is working again rather than closed. */
155
+ requeued?: true;
156
+ }
157
+ interface HubNumberOrder {
158
+ id: string;
159
+ clientReference: string;
160
+ transport: "sms" | "imessage";
161
+ status: "pending" | "provider_pending" | "needs_review" | "ready_for_setup" | "cancelled";
162
+ phase: "identity" | "number" | "credential" | "connection" | "complete";
163
+ address: string | null;
164
+ connectionId: string | null;
165
+ identityId: string | null;
166
+ providerNumberId: string | null;
167
+ billingStatus: "unreserved" | "reserved" | "settled" | "released";
168
+ cancellation: "none" | "requested" | "needs_review" | "released" | "abandoned";
169
+ errorCode: string | null;
170
+ nextAttemptAt: number | null;
171
+ resolution: HubNumberResolution | null;
172
+ deliveryVerified: false;
173
+ activationCents: number;
174
+ currency: "usd";
175
+ terms: string;
176
+ }
177
+ /** Administrative number operations through Hub's authenticated transport.
178
+ * A mutation is one attempt; an uncertain create reuses its quote and reference. */
179
+ declare class HubManagedNumbersClient {
180
+ private readonly request;
181
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
182
+ readiness(): Promise<HubNumberReadiness>;
183
+ list(): Promise<{
184
+ orders: HubNumberOrder[];
185
+ }>;
186
+ get(id: string): Promise<{
187
+ order: HubNumberOrder;
188
+ }>;
189
+ quote(input: {
190
+ transport: "sms" | "imessage";
191
+ clientReference: string;
192
+ }): Promise<{
193
+ quote: HubNumberQuote;
194
+ }>;
195
+ create(input: {
196
+ quoteToken: string;
197
+ consent: true;
198
+ state?: string;
199
+ }): Promise<{
200
+ order: HubNumberOrder;
201
+ }>;
202
+ advance(id: string): Promise<{
203
+ order: HubNumberOrder;
204
+ }>;
205
+ cancel(id: string): Promise<{
206
+ order: HubNumberOrder;
207
+ }>;
208
+ private path;
209
+ private post;
210
+ }
211
+ //#endregion
1
212
  //#region src/types.d.ts
2
213
  type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
3
214
  interface HubSuccessEnvelope<TData> {
@@ -14,7 +225,7 @@ interface HubErrorBody {
14
225
  message: string;
15
226
  details?: unknown;
16
227
  }
17
- type HubErrorCode = "HUB_UNAUTHENTICATED" | "HUB_FORBIDDEN" | "HUB_INVALID_INPUT" | "HUB_INVALID_STATE" | "HUB_PROVIDER_MISSING" | "HUB_CONNECTION_MISSING" | "HUB_CONNECTION_REVOKED" | "HUB_TOKEN_EXPIRED" | "HUB_TOKEN_REPLAYED" | "HUB_TOKEN_REVOKED" | "HUB_TOKEN_ACTION_MISMATCH" | "HUB_POLICY_DENIED" | "HUB_APPROVAL_REQUIRED" | "HUB_EXECUTOR_FAILURE" | "HUB_PROVIDER_FAILURE" | "HUB_CONFIG_MISSING" | "HUB_CONFIG_INVALID" | "HUB_NOT_FOUND" | "HUB_NOT_IMPLEMENTED" | "HUB_CONFLICT" | "VALIDATION_ERROR" | "WORKFLOW_INVALID" | "NOT_FOUND" | "UNAUTHORIZED" | "CONFLICT" | "MISSING_RUN_INPUTS" | "WORKFLOW_DISABLED" | "PAYLOAD_TOO_LARGE" | "WORKFLOW_RUN_TIMEOUT" | `HUB_HTTP_${number}`;
228
+ type HubErrorCode = "HUB_UNAUTHENTICATED" | "HUB_FORBIDDEN" | "HUB_INVALID_INPUT" | "HUB_INVALID_STATE" | "HUB_PROVIDER_MISSING" | "HUB_CONNECTION_MISSING" | "HUB_CONNECTION_REVOKED" | "HUB_TOKEN_EXPIRED" | "HUB_TOKEN_REPLAYED" | "HUB_TOKEN_REVOKED" | "HUB_TOKEN_ACTION_MISMATCH" | "HUB_POLICY_DENIED" | "HUB_APPROVAL_REQUIRED" | "HUB_EXECUTOR_FAILURE" | "HUB_PROVIDER_FAILURE" | "HUB_PROVIDER_REJECTED" | "HUB_CONFIG_MISSING" | "HUB_CONFIG_INVALID" | "HUB_NOT_FOUND" | "HUB_NOT_IMPLEMENTED" | "HUB_CONFLICT" | "HUB_IDEMPOTENCY_CONFLICT" | "HUB_IDEMPOTENCY_IN_FLIGHT" | "VALIDATION_ERROR" | "WORKFLOW_INVALID" | "NOT_FOUND" | "UNAUTHORIZED" | "CONFLICT" | "MISSING_RUN_INPUTS" | "WORKFLOW_DISABLED" | "PAYLOAD_TOO_LARGE" | "WORKFLOW_RUN_TIMEOUT" | `HUB_HTTP_${number}`;
18
229
  interface HubStatusResponse {
19
230
  contract: unknown;
20
231
  principal: HubPrincipal;
@@ -36,6 +247,7 @@ interface HubConnection {
36
247
  providerId: string;
37
248
  displayName: string;
38
249
  accountDisplay: string | null;
250
+ providerAccountId: string | null;
39
251
  scopes: string[];
40
252
  status: "active" | "revoked" | "unhealthy" | "reconnect_required";
41
253
  health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
@@ -168,6 +380,15 @@ interface HubEventDelivery {
168
380
  }
169
381
  /** A connector's auth model. */
170
382
  type HubProviderAuthKind = "oauth2" | "api_key" | "none" | "custom";
383
+ /** One non-secret value needed before an OAuth redirect can be built. Tenant-
384
+ * scoped providers use this for the account label in their OAuth hostname. */
385
+ interface HubOAuthConnectionParameter {
386
+ key: string;
387
+ label: string;
388
+ description: string;
389
+ placeholder: string;
390
+ required: true;
391
+ }
171
392
  interface HubProvider {
172
393
  providerId: string;
173
394
  title: string;
@@ -193,6 +414,9 @@ interface HubProvider {
193
414
  /** True when the provider's OAuth app credentials are wired, i.e. a connect
194
415
  * flow can actually start. UIs offer Connect only for configured providers. */
195
416
  configured: boolean;
417
+ /** Values the user must supply before OAuth starts. Empty or absent means the
418
+ * provider can redirect immediately. */
419
+ connectionParameters?: HubOAuthConnectionParameter[];
196
420
  /**
197
421
  * True when this deployment can receive this provider's inbound events.
198
422
  * This is separate from `configured`: OAuth can be ready while the shared
@@ -209,6 +433,7 @@ interface HubOAuthStartRequest {
209
433
  provider: string;
210
434
  returnUrl?: string;
211
435
  cli?: boolean;
436
+ connectionParameters?: Record<string, string>;
212
437
  }
213
438
  interface HubOAuthCallbackSuccessQuery {
214
439
  provider: string;
@@ -269,7 +494,18 @@ interface HubOAuthCallbackResponse {
269
494
  interface HubApiKeyConnectRequest {
270
495
  provider: string;
271
496
  apiKey: string;
497
+ /** Connector-owned setup values. Hub validates them before testing the key. */
498
+ metadata?: HubApiKeyConnectionMetadata;
272
499
  }
500
+ type HubApiKeyConnectionMetadata = {
501
+ propertyId: string;
502
+ currency?: string;
503
+ } | {
504
+ listings: Array<{
505
+ id: string;
506
+ pms: string;
507
+ }>;
508
+ };
273
509
  /** Result of an api-key connect: the created (or reconnected) connection.
274
510
  * Synchronous — there is no redirect leg, unlike the OAuth flow. */
275
511
  interface HubApiKeyConnectResponse {
@@ -285,7 +521,7 @@ interface HubConnectionDeleteResponse {
285
521
  interface HubConnectionHealthRequest {
286
522
  connectionId: string;
287
523
  }
288
- type HubConnectionHealthStatus = "healthy" | "reconnect_required" | "unhealthy" | "rate_limited";
524
+ type HubConnectionHealthStatus = "healthy" | "reconnect_required" | "unhealthy" | "rate_limited" | "unsupported";
289
525
  interface HubConnectionHealthError {
290
526
  code: string;
291
527
  message: string;
@@ -345,9 +581,18 @@ interface HubExecRequest {
345
581
  path: string;
346
582
  input?: unknown;
347
583
  connectionId?: string;
584
+ /** Caller-minted key for this exec. The platform ledger replays the first
585
+ * call's result for a retry that carries the same key, and rejects a key
586
+ * reused for a different request. On the capability-token arm the key only
587
+ * reaches the connector for provider-native dedupe: that arm is at-most-once
588
+ * per token and replays no stored result. */
589
+ idempotencyKey?: string;
348
590
  }
349
591
  interface HubExecResponse<TResult = unknown> {
350
592
  result: TResult;
593
+ /** True when the result was replayed from a previous call with the same
594
+ * idempotency key, so the action did not run again. */
595
+ replayed?: boolean;
351
596
  }
352
597
  interface HubTokenMintRequest {
353
598
  connectionId?: string;
@@ -512,6 +757,50 @@ interface HubGithubAppInstallation {
512
757
  interface HubGithubAppInstallationResponse {
513
758
  installation: HubGithubAppInstallation;
514
759
  }
760
+ /** An installation as the management surface renders it: the registry record
761
+ * plus where to manage it on GitHub (org and personal accounts have different
762
+ * settings paths, and the id is not discoverable in GitHub's own UI). */
763
+ interface HubGithubAppManagedInstallation extends HubGithubAppInstallation {
764
+ manageUrl: string;
765
+ }
766
+ interface HubGithubAppListInstallationsResponse {
767
+ installations: HubGithubAppManagedInstallation[];
768
+ /** GitHub's install URL for this deployment, or null when the App slug is
769
+ * unconfigured — in which case there is no way to add another account and
770
+ * the UI must say so rather than link nowhere. */
771
+ installUrl: string | null;
772
+ /** Whether this deployment can ask GitHub for installations it never
773
+ * witnessed. Rests on the App CREDENTIAL, not the slug behind `installUrl` —
774
+ * a deployment can have one without the other. */
775
+ syncAvailable?: boolean;
776
+ }
777
+ interface HubGithubAppDisconnectResponse {
778
+ installationId: number;
779
+ disconnected: boolean;
780
+ }
781
+ interface HubGithubAppSyncedInstallation {
782
+ installationId: number;
783
+ accountLogin: string;
784
+ accountType: string | null;
785
+ repositorySelection: "all" | "selected";
786
+ /** False when this run is what linked it — the newly reachable access. */
787
+ alreadyLinked: boolean;
788
+ }
789
+ /** Result of reconciling the caller's installations from GitHub. */
790
+ interface HubGithubAppSyncResponse {
791
+ /** How many of the caller's GitHub accounts were examined. */
792
+ accountsChecked: number;
793
+ /** Installations the caller may act through once this returns. */
794
+ linked: HubGithubAppSyncedInstallation[];
795
+ /** An installation was found but not linked, and why. An account with no
796
+ * installation is absent — that is the ordinary case, not a problem. */
797
+ skipped: Array<{
798
+ accountLogin: string;
799
+ reason: string;
800
+ }>;
801
+ /** Why the examined set is not everything, when it isn't. */
802
+ incomplete?: string;
803
+ }
515
804
  interface HubGithubAppListReposResponse {
516
805
  installationId: number;
517
806
  /** Lowercased "owner/repo" — covers the full registry view of the install. */
@@ -599,10 +888,13 @@ interface HubWorkflowActionResult {
599
888
  error?: string;
600
889
  costUsd?: number;
601
890
  /** Graph-run identity: the topology node this action row belongs to. Present
602
- * only on cycle re-entry rows (a node visited more than once produces one
603
- * row per visit); absent on a linear run's rows. */
891
+ * when the id says something the row's position does not — an author's DAG
892
+ * node id, and every cycle re-entry row (a node visited more than once
893
+ * produces one row per visit). Absent on a linear run's rows, whose node id
894
+ * IS their position: read it as `step-${index + 1}`. */
604
895
  nodeId?: string;
605
- /** Which visit of `nodeId` this row is (1-based), paired with `nodeId`. */
896
+ /** Which visit of `nodeId` this row is (1-based). Present on cycle re-entry
897
+ * rows only; a single-visit row omits it. */
606
898
  visit?: number;
607
899
  /** `script.run` only (single-run detail): the script's captured stdout
608
900
  * (size-capped), or an artifact ref carrying the full log by reference. */
@@ -937,6 +1229,8 @@ interface HubWorkflowProposalInput {
937
1229
  }
938
1230
  /** One node's aggregate across the analyzed runs. */
939
1231
  interface HubWorkflowNodeHealth {
1232
+ /** The author's graph node id, or `step-N` for a linear run's nodes (and for
1233
+ * a node whose run cannot be mapped back to a definition). */
940
1234
  nodeId: string;
941
1235
  visits: number;
942
1236
  failures: number;
@@ -1053,6 +1347,14 @@ interface HubWorkflowConnectionRequirement {
1053
1347
  /** Where to satisfy the requirement (App install flow for `github_app`,
1054
1348
  * integrations page otherwise); null when no target exists. */
1055
1349
  connectUrl: string | null;
1350
+ /** Another requirement in the same list that must be satisfied first — a
1351
+ * `github_app` install is claimed through the `github` connection, so it is
1352
+ * refused while that connection is missing. Null when nothing blocks this
1353
+ * requirement. The list is ordered prerequisite-first. */
1354
+ prerequisite: {
1355
+ provider: string;
1356
+ kind: "integration" | "github_app";
1357
+ } | null;
1056
1358
  }
1057
1359
  /**
1058
1360
  * Result of instantiating a template. `created: false` is NOT an error — an
@@ -1176,8 +1478,10 @@ declare class HubClient {
1176
1478
  readonly fetch: typeof fetch;
1177
1479
  readonly apiKey?: string;
1178
1480
  readonly authHeaders?: HubAuthHeaders;
1481
+ readonly apps: HubAppsClient;
1179
1482
  readonly connections: HubConnectionsClient;
1180
1483
  readonly channels: HubChannelsClient;
1484
+ readonly numbers: HubManagedNumbersClient;
1181
1485
  readonly eventSubscriptions: HubEventSubscriptionsClient;
1182
1486
  readonly permissions: HubPermissionsClient;
1183
1487
  readonly tokens: HubTokensClient;
@@ -1255,6 +1559,13 @@ interface HubToolSearchOptions {
1255
1559
  interface HubToolInvokeOptions {
1256
1560
  connectionId?: string;
1257
1561
  approve?: boolean;
1562
+ /** Caller-minted key for this invoke. On the direct exec arm the platform
1563
+ * ledger replays the first call's result for a retry that carries the same
1564
+ * key, and refuses a key bound to a different request. The approval and
1565
+ * capability-token retries re-send the key, and the connector receives it
1566
+ * for provider-native dedupe. Capability-token execution stays at-most-once
1567
+ * per token: it refuses a replay instead of replaying a stored result. */
1568
+ idempotencyKey?: string;
1258
1569
  }
1259
1570
  declare class HubToolsClient {
1260
1571
  private readonly request;
@@ -1262,12 +1573,18 @@ declare class HubToolsClient {
1262
1573
  search(query: string, options?: HubToolSearchOptions): Promise<HubToolsSearchResponse>;
1263
1574
  sources(): Promise<HubToolSourcesResponse>;
1264
1575
  describe(path: string): Promise<HubToolsDescribeResponse>;
1265
- invoke<TResult = unknown>(path: string, input: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
1576
+ /**
1577
+ * Run one hub tool. `raw` is the tool input: the SDK forwards it verbatim as
1578
+ * the request body's `input`, and the server validates it against the tool's
1579
+ * own schema, so the client never gives it a shape.
1580
+ */
1581
+ invoke<TResult = unknown>(path: string, raw: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
1266
1582
  private buildExecInit;
1267
1583
  }
1268
1584
  interface HubConnectionStartOptions {
1269
1585
  returnUrl?: string;
1270
1586
  cli?: boolean;
1587
+ connectionParameters?: Record<string, string>;
1271
1588
  }
1272
1589
  declare class HubChannelsClient {
1273
1590
  private readonly request;
@@ -1285,6 +1602,7 @@ declare class HubEventSubscriptionsClient {
1285
1602
  }
1286
1603
  declare class HubConnectionsClient {
1287
1604
  private readonly request;
1605
+ readonly inboundWebhook: HubInboundWebhooksClient;
1288
1606
  constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1289
1607
  list(): Promise<HubConnectionsResponse>;
1290
1608
  /** Connector catalog: every provider the hub can expose, each flagged with
@@ -1297,8 +1615,9 @@ declare class HubConnectionsClient {
1297
1615
  /** Connect a non-OAuth (api-key) connector by submitting the user's key.
1298
1616
  * The server validates the key with a live probe before persisting and
1299
1617
  * returns the created (or reconnected) connection — there is no redirect,
1300
- * unlike `start`. */
1301
- connectApiKey(provider: string, apiKey: string): Promise<HubApiKeyConnectResponse>;
1618
+ * unlike `start`. Cloudbeds requires propertyId metadata and PriceLabs
1619
+ * requires listing ID/PMS pairs; other providers have no metadata. */
1620
+ connectApiKey(provider: string, apiKey: string, metadata?: HubApiKeyConnectRequest["metadata"]): Promise<HubApiKeyConnectResponse>;
1302
1621
  revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
1303
1622
  health(connectionId: string): Promise<HubConnectionHealthResponse>;
1304
1623
  }
@@ -1313,6 +1632,19 @@ declare class HubGithubAppClient {
1313
1632
  private readonly request;
1314
1633
  constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1315
1634
  mintInstallationToken(input: HubGithubAppMintInstallationTokenRequest): Promise<HubGithubAppMintInstallationTokenResponse>;
1635
+ /** Every installation the caller may act through — their own and any org's
1636
+ * they were verified against. The management surface's read. */
1637
+ listInstallations(): Promise<HubGithubAppListInstallationsResponse>;
1638
+ /**
1639
+ * Find installations `listInstallations` cannot show: the hub only registers
1640
+ * what the setup redirect witnessed, so an org install approved out of band —
1641
+ * or created by another member — is invisible until this asks GitHub for it.
1642
+ * Links whatever the caller can prove access to; never uninstalls anything.
1643
+ */
1644
+ syncInstallations(): Promise<HubGithubAppSyncResponse>;
1645
+ /** Give up THIS caller's access. Not an uninstall — the installation is
1646
+ * account-level and other members may still be using it. */
1647
+ disconnectInstallation(installationId: number): Promise<HubGithubAppDisconnectResponse>;
1316
1648
  getInstallation(installationId: number): Promise<HubGithubAppInstallationResponse>;
1317
1649
  listRepos(installationId: number): Promise<HubGithubAppListReposResponse>;
1318
1650
  isRepoInstalled(input: {
@@ -1567,15 +1899,18 @@ declare class HubWorkflowsClient {
1567
1899
  /**
1568
1900
  * Upsert a key; returns the entry with its NEW version (increments on every
1569
1901
  * write). Throws `HubSdkError(KV_VALUE_TOO_LARGE)` past the 64KiB value cap
1570
- * or `KV_KEY_LIMIT` past the per-workflow key cap.
1902
+ * or `KV_KEY_LIMIT` past the per-workflow key cap. `raw` is the caller's
1903
+ * value, stored and read back verbatim, so the client never gives it a shape.
1571
1904
  */
1572
- putKv(id: string, key: string, value: unknown): Promise<HubWorkflowKvEntry>;
1905
+ putKv(id: string, key: string, raw: unknown): Promise<HubWorkflowKvEntry>;
1573
1906
  /**
1574
1907
  * Compare-and-swap: the write lands only when the stored version still
1575
1908
  * equals `expectedVersion`; otherwise `HubSdkError(KV_VERSION_CONFLICT)`
1576
- * (409) — re-read and retry. Creation is {@link putKv}'s job.
1909
+ * (409) — re-read and retry. Creation is {@link putKv}'s job. `raw` is the
1910
+ * caller's value, stored and read back verbatim, so the client never gives it
1911
+ * a shape.
1577
1912
  */
1578
- casKv(id: string, key: string, expectedVersion: number, value: unknown): Promise<HubWorkflowKvEntry>;
1913
+ casKv(id: string, key: string, expectedVersion: number, raw: unknown): Promise<HubWorkflowKvEntry>;
1579
1914
  /** Delete a key; idempotent — `deleted` reports whether a row was removed. */
1580
1915
  deleteKv(id: string, key: string): Promise<HubWorkflowKvDeleteResponse>;
1581
1916
  /** The curated starter gallery runnable on THIS deployment: metadata,
@@ -1704,5 +2039,5 @@ declare function parseHubEventDelivery(input: string | unknown): HubEventDeliver
1704
2039
  //#region src/redaction.d.ts
1705
2040
  declare function redactHubValue(value: unknown): unknown;
1706
2041
  //#endregion
1707
- export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubAgentIterationSpan, type HubAgentRunDetail, type HubApiKeyConnectRequest, type HubApiKeyConnectResponse, type HubApproval, type HubApprovalCapabilityToken, type HubApprovalDecisionResponse, type HubApprovalStatus, HubApprovalsClient, HubAuditClient, type HubAuditEvent, type HubAuditListRequest, type HubAuditResponse, type HubAuthHeaders, type HubCapabilityToken, type HubChannel, type HubChannelCreateResponse, type HubChannelDeleteResponse, HubChannelsClient, type HubChannelsResponse, HubClient, type HubClientFromEnvOptions, type HubClientOptions, type HubConnection, type HubConnectionDeleteRequest, type HubConnectionDeleteResponse, type HubConnectionHealthError, type HubConnectionHealthInfo, type HubConnectionHealthRequest, type HubConnectionHealthResponse, type HubConnectionHealthStatus, type HubConnectionStartOptions, HubConnectionsClient, type HubConnectionsResponse, type HubEmailChannel, type HubEmailChannelCreateRequest, type HubEnv, type HubEnvelope, type HubErrorBody, type HubErrorCode, type HubErrorEnvelope, type HubEventCondition, type HubEventConditionScalar, type HubEventDelivery, HubEventDeliveryError, type HubEventRequestFailureCode, type HubEventRequestResult, type HubEventSignatureFailure, type HubEventSignatureResult, type HubEventSubscription, type HubEventSubscriptionCallback, type HubEventSubscriptionCreateRequest, type HubEventSubscriptionCreateResponse, type HubEventSubscriptionDeleteResponse, type HubEventSubscriptionFilter, type HubEventSubscriptionSource, HubEventSubscriptionsClient, type HubEventSubscriptionsResponse, type HubExecRequest, type HubExecResponse, HubGithubAppClient, type HubGithubAppInstallation, type HubGithubAppInstallationResponse, type HubGithubAppIsRepoInstalledRequest, type HubGithubAppIsRepoInstalledResponse, type HubGithubAppListReposResponse, type HubGithubAppMintInstallationTokenRequest, type HubGithubAppMintInstallationTokenResponse, type HubManualRunInput, type HubOAuthCallbackErrorQuery, type HubOAuthCallbackQuery, type HubOAuthCallbackResponse, type HubOAuthCallbackSuccessQuery, type HubOAuthStartRequest, type HubOAuthStartResponse, HubPermissionsClient, type HubPolicy, type HubPolicyDecision, type HubPolicyDeleteRequest, type HubPolicyDeleteResponse, type HubPolicyListRequest, type HubPolicyListResponse, type HubPolicyResponse, type HubPolicyUpdateRequest, type HubPrincipal, type HubPrincipalKind, type HubProvider, type HubProviderAuthKind, type HubProviderEvent, type HubProvidersResponse, HubSdkError, type HubStatusConnections, type HubStatusResponse, type HubSuccessEnvelope, type HubTokenListOptions, type HubTokenMintRequest, type HubTokenMintResponse, type HubTokenRevokeResponse, HubTokensClient, type HubTokensListResponse, type HubTool, type HubToolInvokeOptions, type HubToolRisk, type HubToolSearchOptions, type HubToolSource, type HubToolSourcesResponse, HubToolsClient, type HubToolsDescribeRequest, type HubToolsDescribeResponse, type HubToolsSearchRequest, type HubToolsSearchResponse, type HubUnimplementedErrorEnvelope, type HubWhatsappEmbeddedSignupCompleteRequest, type HubWhatsappEmbeddedSignupCompleteResponse, type HubWhatsappEmbeddedSignupStartRequest, type HubWhatsappEmbeddedSignupStartResponse, type HubWorkflow, type HubWorkflowAction, type HubWorkflowActionResult, type HubWorkflowAgentStep, type HubWorkflowArtifact, type HubWorkflowArtifactDownload, type HubWorkflowArtifactRef, type HubWorkflowArtifactsResponse, type HubWorkflowCondition, type HubWorkflowConditionOp, type HubWorkflowConditionScalar, type HubWorkflowConnectionRequirement, type HubWorkflowDecision, type HubWorkflowDecisionOnTimeout, type HubWorkflowDecisionResolveResult, type HubWorkflowDecisionResolvedVia, type HubWorkflowDecisionStatus, type HubWorkflowDistillationCandidate, type HubWorkflowEdgeVerdicts, type HubWorkflowEventFilter, type HubWorkflowFailureCluster, type HubWorkflowFleetEntry, type HubWorkflowFleetInsights, type HubWorkflowFleetWindow, type HubWorkflowGraphEdge, type HubWorkflowGraphJoinRule, type HubWorkflowGraphNode, type HubWorkflowGraphSpec, type HubWorkflowHealth, type HubWorkflowHookEndpoint, type HubWorkflowHookToken, type HubWorkflowKvDeleteResponse, type HubWorkflowKvEntry, type HubWorkflowKvEntryMeta, type HubWorkflowKvListResponse, type HubWorkflowNodeHealth, type HubWorkflowOnErrorOutcome, type HubWorkflowPendingDecision, type HubWorkflowPendingDecisionsResponse, type HubWorkflowProposal, type HubWorkflowProposalInput, type HubWorkflowRevision, type HubWorkflowRevisionMeta, type HubWorkflowRevisionSource, type HubWorkflowRevisionStatus, type HubWorkflowRun, type HubWorkflowRunCancelResult, type HubWorkflowRunDetail, type HubWorkflowRunEnqueued, type HubWorkflowRunInputs, type HubWorkflowRunRetried, type HubWorkflowRunStatus, type HubWorkflowRunStepsPage, type HubWorkflowRunStreamEvent, type HubWorkflowRunSummary, type HubWorkflowRunsPage, type HubWorkflowSchemaResponse, type HubWorkflowTemplate, type HubWorkflowTemplateCategory, type HubWorkflowTemplateInstantiateResult, type HubWorkflowTemplateParameter, type HubWorkflowTrigger, type HubWorkflowValidateResponse, type HubWorkflowValidationError, HubWorkflowsClient, type VerifyHubEventSignatureInput, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
2042
+ export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubAgentIterationSpan, type HubAgentRunDetail, type HubApiKeyConnectRequest, type HubApiKeyConnectResponse, type HubApiKeyConnectionMetadata, type HubApp, type HubAppCreateInput, type HubAppGrant, type HubAppGrantRevoked, type HubApproval, type HubApprovalCapabilityToken, type HubApprovalDecisionResponse, type HubApprovalStatus, HubApprovalsClient, HubAppsClient, HubAuditClient, type HubAuditEvent, type HubAuditListRequest, type HubAuditResponse, type HubAuthHeaders, type HubCapabilityToken, type HubChannel, type HubChannelCreateResponse, type HubChannelDeleteResponse, HubChannelsClient, type HubChannelsResponse, HubClient, type HubClientFromEnvOptions, type HubClientOptions, type HubConnection, type HubConnectionDeleteRequest, type HubConnectionDeleteResponse, type HubConnectionHealthError, type HubConnectionHealthInfo, type HubConnectionHealthRequest, type HubConnectionHealthResponse, type HubConnectionHealthStatus, type HubConnectionStartOptions, HubConnectionsClient, type HubConnectionsResponse, type HubEmailChannel, type HubEmailChannelCreateRequest, type HubEnv, type HubEnvelope, type HubErrorBody, type HubErrorCode, type HubErrorEnvelope, type HubEventCondition, type HubEventConditionScalar, type HubEventDelivery, HubEventDeliveryError, type HubEventRequestFailureCode, type HubEventRequestResult, type HubEventSignatureFailure, type HubEventSignatureResult, type HubEventSubscription, type HubEventSubscriptionCallback, type HubEventSubscriptionCreateRequest, type HubEventSubscriptionCreateResponse, type HubEventSubscriptionDeleteResponse, type HubEventSubscriptionFilter, type HubEventSubscriptionSource, HubEventSubscriptionsClient, type HubEventSubscriptionsResponse, type HubExecRequest, type HubExecResponse, HubGithubAppClient, type HubGithubAppDisconnectResponse, type HubGithubAppInstallation, type HubGithubAppInstallationResponse, type HubGithubAppIsRepoInstalledRequest, type HubGithubAppIsRepoInstalledResponse, type HubGithubAppListInstallationsResponse, type HubGithubAppListReposResponse, type HubGithubAppManagedInstallation, type HubGithubAppMintInstallationTokenRequest, type HubGithubAppMintInstallationTokenResponse, type HubGithubAppSyncResponse, type HubGithubAppSyncedInstallation, type HubInboundPhoneNumberScope, type HubInboundWebhookCreateOptions, type HubInboundWebhookCreateResponse, type HubInboundWebhookStatus, HubInboundWebhooksClient, HubManagedNumbersClient, type HubManualRunInput, type HubNumberOrder, type HubNumberQuote, type HubNumberReadiness, type HubNumberResolution, type HubOAuthCallbackErrorQuery, type HubOAuthCallbackQuery, type HubOAuthCallbackResponse, type HubOAuthCallbackSuccessQuery, type HubOAuthConnectionParameter, type HubOAuthStartRequest, type HubOAuthStartResponse, HubPermissionsClient, type HubPolicy, type HubPolicyDecision, type HubPolicyDeleteRequest, type HubPolicyDeleteResponse, type HubPolicyListRequest, type HubPolicyListResponse, type HubPolicyResponse, type HubPolicyUpdateRequest, type HubPrincipal, type HubPrincipalKind, type HubProvider, type HubProviderAuthKind, type HubProviderEvent, type HubProvidersResponse, HubSdkError, type HubStatusConnections, type HubStatusResponse, type HubSuccessEnvelope, type HubTokenListOptions, type HubTokenMintRequest, type HubTokenMintResponse, type HubTokenRevokeResponse, HubTokensClient, type HubTokensListResponse, type HubTool, type HubToolInvokeOptions, type HubToolRisk, type HubToolSearchOptions, type HubToolSource, type HubToolSourcesResponse, HubToolsClient, type HubToolsDescribeRequest, type HubToolsDescribeResponse, type HubToolsSearchRequest, type HubToolsSearchResponse, type HubUnimplementedErrorEnvelope, type HubWhatsappEmbeddedSignupCompleteRequest, type HubWhatsappEmbeddedSignupCompleteResponse, type HubWhatsappEmbeddedSignupStartRequest, type HubWhatsappEmbeddedSignupStartResponse, type HubWorkflow, type HubWorkflowAction, type HubWorkflowActionResult, type HubWorkflowAgentStep, type HubWorkflowArtifact, type HubWorkflowArtifactDownload, type HubWorkflowArtifactRef, type HubWorkflowArtifactsResponse, type HubWorkflowCondition, type HubWorkflowConditionOp, type HubWorkflowConditionScalar, type HubWorkflowConnectionRequirement, type HubWorkflowDecision, type HubWorkflowDecisionOnTimeout, type HubWorkflowDecisionResolveResult, type HubWorkflowDecisionResolvedVia, type HubWorkflowDecisionStatus, type HubWorkflowDistillationCandidate, type HubWorkflowEdgeVerdicts, type HubWorkflowEventFilter, type HubWorkflowFailureCluster, type HubWorkflowFleetEntry, type HubWorkflowFleetInsights, type HubWorkflowFleetWindow, type HubWorkflowGraphEdge, type HubWorkflowGraphJoinRule, type HubWorkflowGraphNode, type HubWorkflowGraphSpec, type HubWorkflowHealth, type HubWorkflowHookEndpoint, type HubWorkflowHookToken, type HubWorkflowKvDeleteResponse, type HubWorkflowKvEntry, type HubWorkflowKvEntryMeta, type HubWorkflowKvListResponse, type HubWorkflowNodeHealth, type HubWorkflowOnErrorOutcome, type HubWorkflowPendingDecision, type HubWorkflowPendingDecisionsResponse, type HubWorkflowProposal, type HubWorkflowProposalInput, type HubWorkflowRevision, type HubWorkflowRevisionMeta, type HubWorkflowRevisionSource, type HubWorkflowRevisionStatus, type HubWorkflowRun, type HubWorkflowRunCancelResult, type HubWorkflowRunDetail, type HubWorkflowRunEnqueued, type HubWorkflowRunInputs, type HubWorkflowRunRetried, type HubWorkflowRunStatus, type HubWorkflowRunStepsPage, type HubWorkflowRunStreamEvent, type HubWorkflowRunSummary, type HubWorkflowRunsPage, type HubWorkflowSchemaResponse, type HubWorkflowTemplate, type HubWorkflowTemplateCategory, type HubWorkflowTemplateInstantiateResult, type HubWorkflowTemplateParameter, type HubWorkflowTrigger, type HubWorkflowValidateResponse, type HubWorkflowValidationError, HubWorkflowsClient, type VerifyHubEventSignatureInput, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
1708
2043
  //# sourceMappingURL=index.d.ts.map