@tangle-network/hub-sdk 0.30.0-develop.20260820004536.f384cca → 0.30.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/dist/index.d.ts CHANGED
@@ -1,3 +1,245 @@
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
1
243
  //#region src/types.d.ts
2
244
  type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
3
245
  interface HubSuccessEnvelope<TData> {
@@ -14,7 +256,7 @@ interface HubErrorBody {
14
256
  message: string;
15
257
  details?: unknown;
16
258
  }
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" | "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}`;
259
+ 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
260
  interface HubStatusResponse {
19
261
  contract: unknown;
20
262
  principal: HubPrincipal;
@@ -36,6 +278,7 @@ interface HubConnection {
36
278
  providerId: string;
37
279
  displayName: string;
38
280
  accountDisplay: string | null;
281
+ providerAccountId: string | null;
39
282
  scopes: string[];
40
283
  status: "active" | "revoked" | "unhealthy" | "reconnect_required";
41
284
  health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
@@ -222,6 +465,7 @@ interface HubOAuthStartRequest {
222
465
  returnUrl?: string;
223
466
  cli?: boolean;
224
467
  connectionParameters?: Record<string, string>;
468
+ requestedScopes?: readonly string[];
225
469
  }
226
470
  interface HubOAuthCallbackSuccessQuery {
227
471
  provider: string;
@@ -252,6 +496,9 @@ interface HubWhatsappEmbeddedSignupStartResponse {
252
496
  appId: string;
253
497
  configId: string;
254
498
  sdkVersion: string;
499
+ /** Embedded Signup flow the login configuration selects. "v4" takes empty
500
+ * extras; "v2" needs featureType and sessionInfoVersion. Absent means "v2". */
501
+ signupVersion?: "v2" | "v4";
255
502
  state: string;
256
503
  expiresAt: string;
257
504
  scopes: string[];
@@ -282,7 +529,18 @@ interface HubOAuthCallbackResponse {
282
529
  interface HubApiKeyConnectRequest {
283
530
  provider: string;
284
531
  apiKey: string;
532
+ /** Connector-owned setup values. Hub validates them before testing the key. */
533
+ metadata?: HubApiKeyConnectionMetadata;
285
534
  }
535
+ type HubApiKeyConnectionMetadata = {
536
+ propertyId: string;
537
+ currency?: string;
538
+ } | {
539
+ listings: Array<{
540
+ id: string;
541
+ pms: string;
542
+ }>;
543
+ };
286
544
  /** Result of an api-key connect: the created (or reconnected) connection.
287
545
  * Synchronous — there is no redirect leg, unlike the OAuth flow. */
288
546
  interface HubApiKeyConnectResponse {
@@ -527,7 +785,7 @@ interface HubGithubAppInstallation {
527
785
  accountType: string | null;
528
786
  /** "all" ⇒ every repo under the account; "selected" ⇒ only repoFullNames. */
529
787
  repositorySelection: "all" | "selected";
530
- /** Lowercased "owner/repo" — empty when repositorySelection = "all". */
788
+ /** Metadata omits names; use githubApp.listRepos(id) for a live caller-safe list. */
531
789
  repoFullNames: string[];
532
790
  suspended: boolean;
533
791
  }
@@ -580,8 +838,10 @@ interface HubGithubAppSyncResponse {
580
838
  }
581
839
  interface HubGithubAppListReposResponse {
582
840
  installationId: number;
583
- /** Lowercased "owner/repo" — covers the full registry view of the install. */
841
+ /** Complete live intersection of App coverage and the caller's GitHub access. */
584
842
  repoFullNames: string[];
843
+ /** True only when both upstream listings completed; failures return an error. */
844
+ complete: true;
585
845
  }
586
846
  interface HubGithubAppIsRepoInstalledRequest {
587
847
  owner: string;
@@ -612,10 +872,14 @@ interface HubWorkflowTrigger {
612
872
  timezone: string | null;
613
873
  nextFireAt: string | null;
614
874
  lastFiredAt: string | null;
875
+ /** Schedule only: the ISO-8601 instant it stops firing; null when unbounded. */
876
+ until: string | null;
615
877
  }
616
878
  interface HubWorkflowValidationError {
617
879
  path: string;
618
880
  message: string;
881
+ /** Machine-readable reason where one is defined, e.g. `schedule_outlives_grant`. */
882
+ code?: string;
619
883
  }
620
884
  type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
621
885
  /** One agent iteration of an `agent.run`, as the single-run detail carries it
@@ -1222,6 +1486,624 @@ interface HubWorkflowRunStepsPage {
1222
1486
  nextCursor: number | null;
1223
1487
  }
1224
1488
  //#endregion
1489
+ //#region src/broker.d.ts
1490
+ interface HubAppBrokerOptions {
1491
+ baseUrl: string;
1492
+ clientId: string;
1493
+ clientSecret: string;
1494
+ fetch?: typeof fetch;
1495
+ }
1496
+ interface HubAppBrokerToken {
1497
+ accessToken: string;
1498
+ expiresIn: number;
1499
+ scopes: string[];
1500
+ }
1501
+ interface HubAppBrokerExchange extends HubAppBrokerToken {
1502
+ grantId: string;
1503
+ connectionId: string;
1504
+ }
1505
+ /** Server-only client. App secrets never become a user's general API key.
1506
+ * Every invocation mints and consumes one short-lived, exact-grant token. */
1507
+ declare class HubAppBrokerClient {
1508
+ private readonly options;
1509
+ private readonly baseUrl;
1510
+ private readonly fetcher;
1511
+ constructor(options: HubAppBrokerOptions);
1512
+ private token;
1513
+ private readToken;
1514
+ exchange(input: {
1515
+ code: string;
1516
+ redirectUri: string;
1517
+ connectionId: string;
1518
+ }): Promise<HubAppBrokerExchange>;
1519
+ mint(grantId: string): Promise<HubAppBrokerToken>;
1520
+ invoke<T = unknown>(grantId: string, connectionId: string, actionPath: string, input: Record<string, unknown>): Promise<HubExecResponse<T>>;
1521
+ }
1522
+ //#endregion
1523
+ //#region src/inbound-webhooks.d.ts
1524
+ /** Provider setup uses the existing authenticated Hub transport and vault. */
1525
+ interface HubInboundWebhookCreateOptions {
1526
+ /** Inkbox identity that owns all selected channels. */
1527
+ identityId?: string;
1528
+ mailboxId?: string;
1529
+ phoneNumberId?: string;
1530
+ imessage?: boolean;
1531
+ /** Linq: explicit owned lines; omitted does not mean every account line. */
1532
+ phoneNumbers?: string[];
1533
+ /** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
1534
+ phoneNumberIds?: string[];
1535
+ /** Contiguity Console secret, or an existing Inkbox identity signing key. */
1536
+ signingSecret?: string;
1537
+ }
1538
+ interface HubInboundWebhookCreateResponse {
1539
+ url: string;
1540
+ /** True only when the provider subscription was created by the server. */
1541
+ provisioned?: boolean;
1542
+ /** Self-configured legacy providers can return a newly minted secret once. */
1543
+ secret?: string;
1544
+ inboundAddress?: string;
1545
+ requiresProviderSetup?: boolean;
1546
+ }
1547
+ interface HubInboundWebhookStatus {
1548
+ configured: boolean;
1549
+ url?: string;
1550
+ /** Configuration is not evidence of a real delivered message. */
1551
+ deliveryVerified: false;
1552
+ requiresProviderSetup?: boolean;
1553
+ }
1554
+ /** Live provider readback for one explicitly selected Linq WhatsApp number. */
1555
+ interface HubInboundPhoneNumberScope {
1556
+ configured: true;
1557
+ provisioned: true;
1558
+ subscribed: true;
1559
+ phoneNumberIds: string[];
1560
+ }
1561
+ declare class HubInboundWebhooksClient {
1562
+ private readonly request;
1563
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1564
+ create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
1565
+ get(connectionId: string): Promise<HubInboundWebhookStatus>;
1566
+ /** Add one owned Linq WhatsApp number without rotating the webhook secret. */
1567
+ ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
1568
+ /** Remove event subscriptions first. This does not silently rotate a live URL. */
1569
+ delete(connectionId: string): Promise<{
1570
+ removed: boolean;
1571
+ }>;
1572
+ private path;
1573
+ }
1574
+ //#endregion
1575
+ //#region src/knowledge-management.d.ts
1576
+ interface KnowledgeReference {
1577
+ sourceId: string;
1578
+ generation: string;
1579
+ }
1580
+ /** Connection references only. Provider credentials never enter this contract. */
1581
+ interface KnowledgeEmbeddingSpace {
1582
+ connectionId: string;
1583
+ model: string;
1584
+ dimensions: number;
1585
+ }
1586
+ type KnowledgeSourceInput = {
1587
+ kind: "file";
1588
+ name: string;
1589
+ base64: string;
1590
+ mediaType: string;
1591
+ } | {
1592
+ kind: "git";
1593
+ connectionId: string;
1594
+ owner: string;
1595
+ repo: string;
1596
+ ref: string;
1597
+ pathPrefix?: string;
1598
+ } | {
1599
+ kind: "url";
1600
+ url: string;
1601
+ } | {
1602
+ kind: "s3";
1603
+ connectionId: string;
1604
+ bucket: string;
1605
+ prefix: string;
1606
+ } | {
1607
+ kind: "vector";
1608
+ connectionId: string;
1609
+ provider: "pinecone" | "qdrant" | "weaviate";
1610
+ indexName: string;
1611
+ namespace?: string;
1612
+ embedding: KnowledgeEmbeddingSpace;
1613
+ textField: string;
1614
+ sourceUriField: string;
1615
+ };
1616
+ interface KnowledgeCapability {
1617
+ supported: boolean;
1618
+ reason?: string;
1619
+ }
1620
+ interface KnowledgeCapabilities {
1621
+ delegation?: KnowledgeCapability & {
1622
+ resource?: string;
1623
+ scopes?: string[];
1624
+ };
1625
+ sources: Record<KnowledgeSourceInput["kind"], KnowledgeCapability>;
1626
+ vectorProviders: Record<"pinecone" | "qdrant" | "weaviate", KnowledgeCapability>;
1627
+ managedVector: KnowledgeCapability;
1628
+ file: {
1629
+ mediaTypes: string[];
1630
+ maxBytes: number;
1631
+ maxObjects: number;
1632
+ };
1633
+ }
1634
+ interface KnowledgeSourceSummary {
1635
+ /** Required query authorization, not proof that an owner policy currently permits it. */
1636
+ retrieval?: {
1637
+ kind: "lexical";
1638
+ } | {
1639
+ kind: "vector";
1640
+ embeddingPolicy: {
1641
+ connectionId: string;
1642
+ actionPath: "openai.embeddings.create";
1643
+ scope: "owner-connection-action";
1644
+ };
1645
+ };
1646
+ id: string;
1647
+ name: string;
1648
+ kind: KnowledgeSourceInput["kind"];
1649
+ status: "ready" | "refreshing" | "failed" | "awaiting-approval";
1650
+ approval?: {
1651
+ id: string;
1652
+ path: string;
1653
+ preview: {
1654
+ provider: string;
1655
+ connectionId: string;
1656
+ collection: string;
1657
+ sourceId: string;
1658
+ requestId: string;
1659
+ embedding: KnowledgeEmbeddingSpace;
1660
+ chunkCount: number;
1661
+ sourceCount: number;
1662
+ dataSharing: string;
1663
+ };
1664
+ };
1665
+ refreshRequestId?: string;
1666
+ generation: string | null;
1667
+ lastError: {
1668
+ code: string;
1669
+ message: string;
1670
+ } | null;
1671
+ updatedAt: string;
1672
+ }
1673
+ type KnowledgeAttachmentAuthorization = {
1674
+ status: "active";
1675
+ } | {
1676
+ status: "unavailable";
1677
+ code: "APP_CONSENT_REVOKED" | "KEY_REVOKED" | "CONNECTION_UNAVAILABLE" | "ATTACHMENT_REVOKED" | "GENERATION_UNAVAILABLE" | "RUNTIME_AUTHORITY_REVOKED";
1678
+ };
1679
+ interface KnowledgeAttachment {
1680
+ /** Snapshot of live grant/key/connection authority, separate from durable pin state. */
1681
+ authorization?: KnowledgeAttachmentAuthorization;
1682
+ id: string;
1683
+ sourceId: string;
1684
+ sandboxId: string;
1685
+ generation: string;
1686
+ status: "active" | "detached";
1687
+ }
1688
+ interface KnowledgeSourceCreate {
1689
+ requestId: string;
1690
+ name: string;
1691
+ source: KnowledgeSourceInput;
1692
+ target?: {
1693
+ kind: "lexical";
1694
+ } | {
1695
+ kind: "managed-vector";
1696
+ provider: "qdrant";
1697
+ connectionId: string;
1698
+ embedding: KnowledgeEmbeddingSpace;
1699
+ };
1700
+ }
1701
+ /** Owner-only management. Runtime tools use HubKnowledgeClient.query instead. */
1702
+ interface KnowledgeAuthorization {
1703
+ userId: string;
1704
+ clientId: string;
1705
+ resource: string;
1706
+ scopes: Array<"knowledge:read" | "knowledge:write">;
1707
+ }
1708
+ declare class HubKnowledgeManagementClient {
1709
+ private readonly request;
1710
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1711
+ materialize(input: {
1712
+ sandboxId: string;
1713
+ references: KnowledgeReference[];
1714
+ }): Promise<KnowledgeAttachment[]>;
1715
+ authorization(): Promise<KnowledgeAuthorization>;
1716
+ disconnectAuthorization(): Promise<{
1717
+ revoked: true;
1718
+ }>;
1719
+ capabilities(): Promise<KnowledgeCapabilities>;
1720
+ list(): Promise<KnowledgeSourceSummary[]>;
1721
+ get(sourceId: string): Promise<KnowledgeSourceSummary>;
1722
+ create(input: KnowledgeSourceCreate): Promise<KnowledgeSourceSummary>;
1723
+ refresh(sourceId: string, input: {
1724
+ requestId: string;
1725
+ approvalToken?: string;
1726
+ }): Promise<KnowledgeSourceSummary>;
1727
+ attach(sourceId: string, input: {
1728
+ sandboxId: string;
1729
+ generation: string;
1730
+ expectedGeneration?: string;
1731
+ }): Promise<KnowledgeAttachment>;
1732
+ attachments(sandboxId?: string): Promise<KnowledgeAttachment[]>;
1733
+ detach(attachmentId: string): Promise<KnowledgeAttachment>;
1734
+ }
1735
+ //#endregion
1736
+ //#region src/knowledge.d.ts
1737
+ interface HubKnowledgeRetrievalResult {
1738
+ attachmentId: string;
1739
+ generation: string;
1740
+ provenance: "ingested" | "record-supplied";
1741
+ hits: Array<{
1742
+ id: string;
1743
+ title: string;
1744
+ snippet: string;
1745
+ score?: number;
1746
+ citations?: Array<{
1747
+ sourceId: string;
1748
+ sourceUri: string;
1749
+ revision?: string;
1750
+ }>;
1751
+ }>;
1752
+ elapsedMs?: number;
1753
+ }
1754
+ interface HubKnowledgeQueryResult {
1755
+ results: HubKnowledgeRetrievalResult[];
1756
+ /** Individual unavailable sources do not hide evidence from healthy sources. */
1757
+ failures: Array<{
1758
+ attachmentId: string;
1759
+ code: string;
1760
+ message: string;
1761
+ }>;
1762
+ partial: boolean;
1763
+ }
1764
+ /** Runtime-only retrieval. The authenticated sandbox credential determines the
1765
+ * scope on the server; neither a caller nor an agent can supply another scope. */
1766
+ declare class HubKnowledgeClient {
1767
+ private readonly request;
1768
+ readonly management: HubKnowledgeManagementClient;
1769
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1770
+ bindings(): Promise<{
1771
+ references: KnowledgeReference[];
1772
+ }>;
1773
+ query(input: {
1774
+ query: string;
1775
+ limit?: number;
1776
+ expectedReferences?: KnowledgeReference[];
1777
+ }, options?: {
1778
+ signal?: AbortSignal;
1779
+ }): Promise<HubKnowledgeQueryResult>;
1780
+ }
1781
+ //#endregion
1782
+ //#region src/lines.d.ts
1783
+ interface HubLineMember {
1784
+ id: string;
1785
+ label: string | null;
1786
+ role: string;
1787
+ self?: boolean;
1788
+ consent?: "enabled" | "required";
1789
+ }
1790
+ interface HubLineContext {
1791
+ self: {
1792
+ id: string;
1793
+ label: string | null;
1794
+ role: string;
1795
+ };
1796
+ line: {
1797
+ id: string;
1798
+ label: string | null;
1799
+ transport: string;
1800
+ };
1801
+ members: HubLineMember[];
1802
+ capabilities: Record<string, {
1803
+ allowed: boolean;
1804
+ reason?: string;
1805
+ }>;
1806
+ pendingReminders: Array<{
1807
+ messageId: string;
1808
+ wakeAt?: string;
1809
+ prompt: string | null;
1810
+ }>;
1811
+ quotas: {
1812
+ selfMessagesToday: number;
1813
+ selfMessagesPerDay: number;
1814
+ selfMessagesPending: number;
1815
+ selfMessagesPendingLimit: number;
1816
+ };
1817
+ }
1818
+ interface HubLineSendInput {
1819
+ toMember: string;
1820
+ text: string;
1821
+ notBefore?: string;
1822
+ onBehalfOf?: string;
1823
+ idempotencyKey?: string;
1824
+ }
1825
+ /** An asset URL safe to share with the recipient and provider. Hub never fetches it.
1826
+ * Meta WhatsApp API-key lines send it with `text` as the caption. Other transports refuse it.
1827
+ * Use public HTTPS without a query, fragment or credentials. */
1828
+ interface HubLineImage {
1829
+ url: string;
1830
+ }
1831
+ interface HubLineOwnerSendInput {
1832
+ memberId: string;
1833
+ text: string;
1834
+ image?: HubLineImage;
1835
+ notBefore?: string;
1836
+ idempotencyKey: string;
1837
+ /** Ask a coded question; the member's reply that starts with `code` returns here. */
1838
+ reply?: HubLineReplyCodeInput;
1839
+ }
1840
+ interface HubLineReplyCodeInput {
1841
+ /** A letter, then up to seven letters or digits, with at least one digit (`F7`). Hub compares it case-insensitively. */
1842
+ code: string;
1843
+ /** 60 to 604800; the window opens when the send first becomes eligible. */
1844
+ ttlSeconds: number;
1845
+ /**
1846
+ * 1 to 20 distinct texted choices, each 1-32 of `a-z 0-9 _ -` after lower-casing.
1847
+ * An answer must then be `<code> <option>[ <note>]`; any other coded text keeps the question open.
1848
+ */
1849
+ options?: string[];
1850
+ }
1851
+ /** The coded question's state on an owner send receipt. */
1852
+ interface HubLineReplyCode {
1853
+ /** Upper case. */
1854
+ code: string;
1855
+ expiresAt: string;
1856
+ /** The first coded answer; `text` is null after content retention ends. */
1857
+ answer: {
1858
+ messageId: string;
1859
+ text: string | null;
1860
+ receivedAt: string; /** The named option, lower case; null when the send listed no options. */
1861
+ option: string | null; /** Words after the option; null when there were none or retention ended. */
1862
+ note: string | null;
1863
+ } | null;
1864
+ }
1865
+ interface HubLineReminderInput {
1866
+ text: string;
1867
+ notBefore: string;
1868
+ idempotencyKey: string;
1869
+ }
1870
+ interface HubLineApplicationDispatchCurrentInput {
1871
+ attachmentId: string;
1872
+ memberId: string;
1873
+ memberRevision: string;
1874
+ senderAddress: string;
1875
+ textSha256: string;
1876
+ binding: string;
1877
+ dispatchFence: string;
1878
+ dispatchDeadline: string;
1879
+ }
1880
+ interface HubLineMemberApplication {
1881
+ id: string;
1882
+ lineId: string;
1883
+ attachmentId: string;
1884
+ memberId: string;
1885
+ subjectId: string;
1886
+ status: "active" | "revoked";
1887
+ application: {
1888
+ url: string;
1889
+ binding: string;
1890
+ };
1891
+ /** Hub's name for the app at this callback; present on reads. */
1892
+ app?: {
1893
+ name: string;
1894
+ };
1895
+ createdAt: string;
1896
+ revokedAt: string | null;
1897
+ }
1898
+ interface HubLineMemberApplicationInput {
1899
+ expectedSelectionId: string | null;
1900
+ expectedMemberRevision: string;
1901
+ subjectId: string;
1902
+ application: {
1903
+ url: string;
1904
+ binding: string;
1905
+ secret: string;
1906
+ };
1907
+ }
1908
+ interface HubLineSendReceipt {
1909
+ message: {
1910
+ id: string;
1911
+ status: string;
1912
+ text: string | null;
1913
+ image?: HubLineImage;
1914
+ };
1915
+ eligibleAt: string | null;
1916
+ expiresAt: string;
1917
+ /** Null when the send asked no coded question; absent from Hub before reply codes. */
1918
+ reply?: HubLineReplyCode | null;
1919
+ }
1920
+ interface HubLineReminderReceipt {
1921
+ state: "queued" | "skipped";
1922
+ lineId: string;
1923
+ messageId?: string;
1924
+ sessionId?: string;
1925
+ completion?: string;
1926
+ reason?: string;
1927
+ }
1928
+ interface HubLineScheduledSendOptions {
1929
+ lineId: string;
1930
+ memberId: string;
1931
+ text: string;
1932
+ timezone: string;
1933
+ name?: string;
1934
+ notBefore?: string;
1935
+ /**
1936
+ * RFC 3339 instant the schedule stops at. Required when the calling key
1937
+ * expires, and no later than that expiry: a schedule never outlives the
1938
+ * key that wrote it.
1939
+ */
1940
+ until?: string;
1941
+ }
1942
+ interface HubLineCheckinOptions {
1943
+ lineId: string;
1944
+ member: string;
1945
+ timezone: string;
1946
+ prompt: string;
1947
+ name?: string;
1948
+ /** RFC 3339 instant the schedule stops at; see {@link HubLineScheduledSendOptions.until}. */
1949
+ until?: string;
1950
+ }
1951
+ /** Line calls share HubClient authentication and envelope handling. */
1952
+ declare class HubLinesClient {
1953
+ private readonly request;
1954
+ private readonly createWorkflow;
1955
+ private readonly requestApplicationDispatchCurrent?;
1956
+ readonly members: {
1957
+ list: (lineId: string) => Promise<HubLineMember[]>;
1958
+ };
1959
+ readonly memberApplications: {
1960
+ get: (lineId: string, memberId: string) => Promise<{
1961
+ memberRevision: string;
1962
+ selection: HubLineMemberApplication | null;
1963
+ }>;
1964
+ select: (lineId: string, memberId: string, input: HubLineMemberApplicationInput) => Promise<HubLineMemberApplication>;
1965
+ clear: (lineId: string, memberId: string, input: {
1966
+ expectedSelectionId: string;
1967
+ expectedMemberRevision: string;
1968
+ }) => Promise<void>;
1969
+ };
1970
+ readonly checkins: {
1971
+ schedule: (cron: string, options: HubLineCheckinOptions) => Promise<HubWorkflow>;
1972
+ };
1973
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>, createWorkflow: (yaml: string) => Promise<HubWorkflow>, requestApplicationDispatchCurrent?: ((path: string, init: RequestInit, callbackBearer: string) => Promise<{
1974
+ current: boolean;
1975
+ }>) | undefined);
1976
+ scheduleSend(cron: string, options: HubLineScheduledSendOptions): Promise<HubWorkflow>;
1977
+ context(): Promise<HubLineContext>;
1978
+ send(lineId: string, input: HubLineSendInput | HubLineOwnerSendInput): Promise<HubLineSendReceipt>;
1979
+ /** Read an owner send's receipt, including its coded answer. Queued is not delivered. */
1980
+ sentMessage(lineId: string, messageId: string): Promise<HubLineSendReceipt>;
1981
+ remind(lineId: string, input: HubLineReminderInput): Promise<HubLineReminderReceipt>;
1982
+ applicationDispatchCurrent(lineId: string, messageId: string, input: HubLineApplicationDispatchCurrentInput, callbackBearer: string): Promise<boolean>;
1983
+ }
1984
+ //#endregion
1985
+ //#region src/managed-numbers.d.ts
1986
+ interface HubNumberReadiness {
1987
+ configured: boolean;
1988
+ provider: "inkbox";
1989
+ transports: Array<"sms" | "imessage">;
1990
+ billing: "prepaid_activation";
1991
+ automaticRentalBilling: false;
1992
+ deliveryVerified: false;
1993
+ }
1994
+ interface HubNumberQuote {
1995
+ transport: "sms" | "imessage";
1996
+ activationCents: number;
1997
+ currency: "usd";
1998
+ termsVersion: string;
1999
+ terms: string;
2000
+ expiresAt: number;
2001
+ /** The binding the quote was issued for. Absent from older servers. */
2002
+ clientReference?: string;
2003
+ /** Opaque. Pass it back to `create`; never decode it. */
2004
+ token: string;
2005
+ }
2006
+ /** One page of the owner's orders, newest first. */
2007
+ interface HubNumberOrderPage {
2008
+ orders: HubNumberOrder[];
2009
+ /** Present while more orders exist. Older servers omit it and return one
2010
+ * bounded page, so an absent cursor never proves an order does not exist. */
2011
+ nextCursor?: string | null;
2012
+ }
2013
+ interface HubNumberListQuery {
2014
+ /** Only orders requested for this binding, including closed ones. */
2015
+ clientReference?: string;
2016
+ cursor?: string;
2017
+ /** 1 to 100; the server default is 100. */
2018
+ limit?: number;
2019
+ }
2020
+ /** An operator's terminal decision on an order stuck in `needs_review`.
2021
+ * Read-only for a creator: the resolution is made through the platform's
2022
+ * admin surface, never through this client. */
2023
+ interface HubNumberResolution {
2024
+ action: "release" | "settle" | "abandon";
2025
+ operator: string;
2026
+ reason: string;
2027
+ at: number;
2028
+ /** Present while the operator's action is still running. The decision is
2029
+ * not final and the order can still return to review. */
2030
+ pending?: true;
2031
+ /** Present when a `settle` handed a live, unfinished order back to
2032
+ * provisioning, so the order is working again rather than closed. */
2033
+ requeued?: true;
2034
+ }
2035
+ interface HubNumberOrder {
2036
+ id: string;
2037
+ clientReference: string;
2038
+ transport: "sms" | "imessage";
2039
+ status: "pending" | "provider_pending" | "needs_review" | "ready_for_setup" | "cancelled";
2040
+ phase: "identity" | "number" | "credential" | "connection" | "complete";
2041
+ address: string | null;
2042
+ connectionId: string | null;
2043
+ identityId: string | null;
2044
+ providerNumberId: string | null;
2045
+ billingStatus: "unreserved" | "reserved" | "settled" | "released";
2046
+ cancellation: "none" | "requested" | "needs_review" | "released" | "abandoned";
2047
+ errorCode: string | null;
2048
+ nextAttemptAt: number | null;
2049
+ resolution: HubNumberResolution | null;
2050
+ deliveryVerified: false;
2051
+ activationCents: number;
2052
+ currency: "usd";
2053
+ terms: string;
2054
+ }
2055
+ /** Administrative number operations through Hub's authenticated transport.
2056
+ * A mutation is one attempt; an uncertain create reuses its quote and reference. */
2057
+ declare class HubManagedNumbersClient {
2058
+ private readonly request;
2059
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
2060
+ readiness(): Promise<HubNumberReadiness>;
2061
+ /** One page of orders. Scope by `clientReference` to ask about one binding,
2062
+ * and follow `nextCursor` for the rest; a page is never ownership evidence. */
2063
+ list(query?: HubNumberListQuery): Promise<HubNumberOrderPage>;
2064
+ get(id: string): Promise<{
2065
+ order: HubNumberOrder;
2066
+ }>;
2067
+ quote(input: {
2068
+ transport: "sms" | "imessage";
2069
+ clientReference: string;
2070
+ }): Promise<{
2071
+ quote: HubNumberQuote;
2072
+ }>;
2073
+ /** `clientReference` and `transport`, when given, must match the signed
2074
+ * quote or Hub refuses the purchase with a conflict. */
2075
+ create(input: {
2076
+ quoteToken: string;
2077
+ consent: true;
2078
+ state?: string;
2079
+ clientReference?: string;
2080
+ transport?: "sms" | "imessage";
2081
+ }): Promise<{
2082
+ order: HubNumberOrder;
2083
+ }>;
2084
+ /** Fences references so no order can take them again. Call it as the last
2085
+ * step before retiring the resource they name: a purchase that races the
2086
+ * retirement is then refused (`409 number_reference_fenced`) instead of
2087
+ * binding a line to a resource that is gone. Refused with
2088
+ * `409 number_reference_held` while a live order holds one of them; cancel
2089
+ * it first. A cancelled order no longer holds its reference, so the fence
2090
+ * succeeds as soon as `cancel` returns, whether or not its release is still
2091
+ * pending. Repeating a fence is harmless. */
2092
+ fence(input: {
2093
+ clientReferences: string[];
2094
+ }): Promise<{
2095
+ clientReferences: string[];
2096
+ }>;
2097
+ advance(id: string): Promise<{
2098
+ order: HubNumberOrder;
2099
+ }>;
2100
+ cancel(id: string): Promise<{
2101
+ order: HubNumberOrder;
2102
+ }>;
2103
+ private path;
2104
+ private post;
2105
+ }
2106
+ //#endregion
1225
2107
  //#region src/client.d.ts
1226
2108
  type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
1227
2109
  interface HubClientOptions {
@@ -1250,13 +2132,25 @@ interface HubClientFromEnvOptions {
1250
2132
  }
1251
2133
  declare function resolveHubBaseUrl(env?: HubEnv): string;
1252
2134
  declare function resolveHubAuth(env?: HubEnv): string;
1253
- declare class HubClient {
2135
+ declare class HubTransport {
1254
2136
  readonly baseUrl: string;
1255
2137
  readonly fetch: typeof fetch;
1256
2138
  readonly apiKey?: string;
1257
2139
  readonly authHeaders?: HubAuthHeaders;
2140
+ constructor(options: HubClientOptions);
2141
+ protected request<TData>(path: string, init: RequestInit, options?: {
2142
+ auth?: "client" | "caller";
2143
+ validateData?: (data: unknown) => data is TData;
2144
+ }): Promise<TData>;
2145
+ protected buildHeaders(headers: HeadersInit | undefined, callerAuth?: boolean): Promise<Headers>;
2146
+ }
2147
+ declare class HubClient extends HubTransport {
2148
+ readonly knowledge: HubKnowledgeClient;
2149
+ readonly allowances: HubAllowancesClient;
2150
+ readonly apps: HubAppsClient;
1258
2151
  readonly connections: HubConnectionsClient;
1259
2152
  readonly channels: HubChannelsClient;
2153
+ readonly numbers: HubManagedNumbersClient;
1260
2154
  readonly eventSubscriptions: HubEventSubscriptionsClient;
1261
2155
  readonly permissions: HubPermissionsClient;
1262
2156
  readonly tokens: HubTokensClient;
@@ -1265,10 +2159,10 @@ declare class HubClient {
1265
2159
  readonly audit: HubAuditClient;
1266
2160
  readonly githubApp: HubGithubAppClient;
1267
2161
  readonly workflows: HubWorkflowsClient;
2162
+ readonly lines: HubLinesClient;
1268
2163
  constructor(options: HubClientOptions);
1269
2164
  static fromEnv(options?: HubClientFromEnvOptions): HubClient;
1270
2165
  status(): Promise<HubStatusResponse>;
1271
- private request;
1272
2166
  /**
1273
2167
  * Open a streaming (Server-Sent Events) response and return its raw body.
1274
2168
  * Shares auth-header building + `fetch` with {@link request}, but does NOT
@@ -1289,7 +2183,6 @@ declare class HubClient {
1289
2183
  * otherwise an `HUB_HTTP_<status>` transport error.
1290
2184
  */
1291
2185
  private requestBytes;
1292
- private buildHeaders;
1293
2186
  }
1294
2187
  interface HubTokenListOptions {
1295
2188
  includeExpired?: boolean;
@@ -1360,6 +2253,8 @@ interface HubConnectionStartOptions {
1360
2253
  returnUrl?: string;
1361
2254
  cli?: boolean;
1362
2255
  connectionParameters?: Record<string, string>;
2256
+ /** GitHub accepts the exact read:user, repo, read:org set. */
2257
+ requestedScopes?: readonly string[];
1363
2258
  }
1364
2259
  declare class HubChannelsClient {
1365
2260
  private readonly request;
@@ -1377,6 +2272,7 @@ declare class HubEventSubscriptionsClient {
1377
2272
  }
1378
2273
  declare class HubConnectionsClient {
1379
2274
  private readonly request;
2275
+ readonly inboundWebhook: HubInboundWebhooksClient;
1380
2276
  constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1381
2277
  list(): Promise<HubConnectionsResponse>;
1382
2278
  /** Connector catalog: every provider the hub can expose, each flagged with
@@ -1389,8 +2285,9 @@ declare class HubConnectionsClient {
1389
2285
  /** Connect a non-OAuth (api-key) connector by submitting the user's key.
1390
2286
  * The server validates the key with a live probe before persisting and
1391
2287
  * returns the created (or reconnected) connection — there is no redirect,
1392
- * unlike `start`. */
1393
- connectApiKey(provider: string, apiKey: string): Promise<HubApiKeyConnectResponse>;
2288
+ * unlike `start`. Cloudbeds requires propertyId metadata and PriceLabs
2289
+ * requires listing ID/PMS pairs; other providers have no metadata. */
2290
+ connectApiKey(provider: string, apiKey: string, metadata?: HubApiKeyConnectRequest["metadata"]): Promise<HubApiKeyConnectResponse>;
1394
2291
  revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
1395
2292
  health(connectionId: string): Promise<HubConnectionHealthResponse>;
1396
2293
  }
@@ -1809,8 +2706,166 @@ declare function authenticateHubEventRequest(input: AuthenticateHubEventRequestI
1809
2706
  declare function verifyHubEventSignature(input: VerifyHubEventSignatureInput): Promise<HubEventSignatureResult>;
1810
2707
  declare function parseHubEventDelivery(input: string | unknown): HubEventDelivery;
1811
2708
  //#endregion
2709
+ //#region src/knowledge-approval.d.ts
2710
+ /** Called only after the owner reviews this exact pending effect and clicks
2711
+ * Approve. Re-read first: a stale tab cannot approve a substituted operation. */
2712
+ declare function approveKnowledgeSource(input: {
2713
+ port: Pick<HubKnowledgeManagementClient, "get" | "refresh">;
2714
+ approvals: Pick<HubApprovalsClient, "approve">;
2715
+ source: KnowledgeSourceSummary;
2716
+ }): Promise<KnowledgeSourceSummary>;
2717
+ //#endregion
2718
+ //#region src/line-grants.d.ts
2719
+ interface HubLineGrantBinding {
2720
+ workspaceId: string;
2721
+ workspaceAgentId: string;
2722
+ }
2723
+ interface HubLineGrant {
2724
+ id: string;
2725
+ lineId: string;
2726
+ connectionId: string;
2727
+ workspaceId: string;
2728
+ workspaceAgentId: string;
2729
+ agentProfileVersion: string;
2730
+ backendSha256: string;
2731
+ attachmentId: string | null;
2732
+ intakeMode: "guests" | "owner_only";
2733
+ /** "application" grants select the app's callback for the owner member instead of attaching. */
2734
+ execution: "backend" | "application";
2735
+ applicationOrigin: string | null;
2736
+ priorAttachmentId: string | null;
2737
+ priorAttachmentActive: boolean;
2738
+ monthlyBudgetUsd: number;
2739
+ monthlySpentUsd: number;
2740
+ }
2741
+ interface HubLineGrantLine {
2742
+ id: string;
2743
+ connectionId: string;
2744
+ transport: "sms" | "imessage";
2745
+ status: string;
2746
+ address: string | null;
2747
+ attachment: {
2748
+ id: string;
2749
+ sandboxId: string;
2750
+ status: string;
2751
+ } | null;
2752
+ }
2753
+ interface HubLineGrantAttachInput {
2754
+ workspaceAgentId: string;
2755
+ agentProfileVersion: string;
2756
+ renewalCode?: string;
2757
+ respond: {
2758
+ kind: "agent";
2759
+ backend: Record<string, unknown>;
2760
+ };
2761
+ }
2762
+ interface HubLineGrantAttachment {
2763
+ id: string;
2764
+ sandboxId: string;
2765
+ status: string;
2766
+ members?: Array<{
2767
+ id: string;
2768
+ role: string;
2769
+ }>;
2770
+ }
2771
+ interface HubLineGrantThread {
2772
+ id: string;
2773
+ lineId: string;
2774
+ attachmentId: string;
2775
+ }
2776
+ interface HubLineGrantMessage {
2777
+ id: string;
2778
+ threadId: string;
2779
+ direction: string;
2780
+ text: string | null;
2781
+ }
2782
+ /** The consented owner member on the owner's current attachment. */
2783
+ interface HubLineGrantMemberApplication {
2784
+ lineId: string;
2785
+ attachmentId: string;
2786
+ memberId: string;
2787
+ subjectId: string;
2788
+ /** Pass back unchanged as `expectedMemberRevision`. */
2789
+ memberRevision: string;
2790
+ /** False until the owner has texted the line and Hub recorded consent. */
2791
+ eligible: boolean;
2792
+ /** Hub-derived; every callback for this grant carries it. */
2793
+ binding: string;
2794
+ selection: {
2795
+ id: string; /** True when this grant's callback is the selected application. */
2796
+ own: boolean;
2797
+ /**
2798
+ * Hub's name for the app that answers the owner's texts, shown to the
2799
+ * owner in every app they consented on this line: a registered app's
2800
+ * name, or "Another app" when Hub has none. Absent before Platform named
2801
+ * selection holders.
2802
+ */
2803
+ app?: {
2804
+ name: string;
2805
+ }; /** When the current app started answering. */
2806
+ selectedAt?: string; /** This app's own callback; never returned for another app. */
2807
+ url?: string;
2808
+ createdAt?: string;
2809
+ } | null;
2810
+ }
2811
+ interface HubLineGrantSelectApplicationInput {
2812
+ /** The current selection exactly as read. */
2813
+ expectedSelectionId: string | null;
2814
+ /**
2815
+ * Set only when the owner chose to move their texts here from the app shown
2816
+ * in `selection.app`: that selection's id, also passed as
2817
+ * `expectedSelectionId`. Without it Hub never replaces another app.
2818
+ */
2819
+ replaceSelectionId?: string;
2820
+ expectedMemberRevision: string;
2821
+ /** HTTPS callback on the owner-approved application origin. */
2822
+ url: string;
2823
+ /** Bearer Hub sends to the callback; 32-512 printable ASCII characters. */
2824
+ secret: string;
2825
+ }
2826
+ interface HubLineGrantApplicationSelection {
2827
+ id: string;
2828
+ lineId: string;
2829
+ attachmentId: string;
2830
+ memberId: string;
2831
+ subjectId: string;
2832
+ status: string;
2833
+ application: {
2834
+ url: string;
2835
+ binding: string;
2836
+ };
2837
+ createdAt: string;
2838
+ revokedAt: string | null;
2839
+ }
2840
+ /** Every call uses HubTransport's authHeaders, so one-use app broker tokens can be minted per request. */
2841
+ declare class HubLineGrantsClient extends HubTransport {
2842
+ current(binding: HubLineGrantBinding): Promise<HubLineGrant>;
2843
+ line(binding: HubLineGrantBinding): Promise<HubLineGrantLine>;
2844
+ attach(binding: HubLineGrantBinding, input: HubLineGrantAttachInput): Promise<HubLineGrantAttachment>;
2845
+ detach(binding: HubLineGrantBinding): Promise<{
2846
+ detached: boolean;
2847
+ }>;
2848
+ threads(binding: HubLineGrantBinding): Promise<HubLineGrantThread[]>;
2849
+ messages(binding: HubLineGrantBinding, threadId: string): Promise<HubLineGrantMessage[]>;
2850
+ memberApplication(binding: HubLineGrantBinding): Promise<HubLineGrantMemberApplication>;
2851
+ /**
2852
+ * Route the owner's texts to this app's callback; the incumbent attachment
2853
+ * stays. `replaceSelectionId` moves them from another app on the owner's
2854
+ * explicit choice.
2855
+ */
2856
+ selectApplication(binding: HubLineGrantBinding, input: HubLineGrantSelectApplicationInput): Promise<HubLineGrantApplicationSelection>;
2857
+ /** Return the owner's texts to the incumbent attachment. */
2858
+ clearApplication(binding: HubLineGrantBinding, input: {
2859
+ expectedSelectionId: string;
2860
+ expectedMemberRevision: string;
2861
+ }): Promise<void>;
2862
+ revoke(binding: HubLineGrantBinding): Promise<{
2863
+ revoked: boolean;
2864
+ }>;
2865
+ }
2866
+ //#endregion
1812
2867
  //#region src/redaction.d.ts
1813
2868
  declare function redactHubValue(value: unknown): unknown;
1814
2869
  //#endregion
1815
- export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubAgentIterationSpan, type HubAgentRunDetail, type HubApiKeyConnectRequest, type HubApiKeyConnectResponse, type HubApproval, type HubApprovalCapabilityToken, type HubApprovalDecisionResponse, type HubApprovalStatus, HubApprovalsClient, HubAuditClient, type HubAuditEvent, type HubAuditListRequest, type HubAuditResponse, type HubAuthHeaders, type HubCapabilityToken, type HubChannel, type HubChannelCreateResponse, type HubChannelDeleteResponse, HubChannelsClient, type HubChannelsResponse, HubClient, type HubClientFromEnvOptions, type HubClientOptions, type HubConnection, type HubConnectionDeleteRequest, type HubConnectionDeleteResponse, type HubConnectionHealthError, type HubConnectionHealthInfo, type HubConnectionHealthRequest, type HubConnectionHealthResponse, type HubConnectionHealthStatus, type HubConnectionStartOptions, HubConnectionsClient, type HubConnectionsResponse, type HubEmailChannel, type HubEmailChannelCreateRequest, type HubEnv, type HubEnvelope, type HubErrorBody, type HubErrorCode, type HubErrorEnvelope, type HubEventCondition, type HubEventConditionScalar, type HubEventDelivery, HubEventDeliveryError, type HubEventRequestFailureCode, type HubEventRequestResult, type HubEventSignatureFailure, type HubEventSignatureResult, type HubEventSubscription, type HubEventSubscriptionCallback, type HubEventSubscriptionCreateRequest, type HubEventSubscriptionCreateResponse, type HubEventSubscriptionDeleteResponse, type HubEventSubscriptionFilter, type HubEventSubscriptionSource, HubEventSubscriptionsClient, type HubEventSubscriptionsResponse, type HubExecRequest, type HubExecResponse, HubGithubAppClient, type HubGithubAppDisconnectResponse, type HubGithubAppInstallation, type HubGithubAppInstallationResponse, type HubGithubAppIsRepoInstalledRequest, type HubGithubAppIsRepoInstalledResponse, type HubGithubAppListInstallationsResponse, type HubGithubAppListReposResponse, type HubGithubAppManagedInstallation, type HubGithubAppMintInstallationTokenRequest, type HubGithubAppMintInstallationTokenResponse, type HubGithubAppSyncResponse, type HubGithubAppSyncedInstallation, type HubManualRunInput, type HubOAuthCallbackErrorQuery, type HubOAuthCallbackQuery, type HubOAuthCallbackResponse, type HubOAuthCallbackSuccessQuery, type HubOAuthConnectionParameter, type HubOAuthStartRequest, type HubOAuthStartResponse, HubPermissionsClient, type HubPolicy, type HubPolicyDecision, type HubPolicyDeleteRequest, type HubPolicyDeleteResponse, type HubPolicyListRequest, type HubPolicyListResponse, type HubPolicyResponse, type HubPolicyUpdateRequest, type HubPrincipal, type HubPrincipalKind, type HubProvider, type HubProviderAuthKind, type HubProviderEvent, type HubProvidersResponse, HubSdkError, type HubStatusConnections, type HubStatusResponse, type HubSuccessEnvelope, type HubTokenListOptions, type HubTokenMintRequest, type HubTokenMintResponse, type HubTokenRevokeResponse, HubTokensClient, type HubTokensListResponse, type HubTool, type HubToolInvokeOptions, type HubToolRisk, type HubToolSearchOptions, type HubToolSource, type HubToolSourcesResponse, HubToolsClient, type HubToolsDescribeRequest, type HubToolsDescribeResponse, type HubToolsSearchRequest, type HubToolsSearchResponse, type HubUnimplementedErrorEnvelope, type HubWhatsappEmbeddedSignupCompleteRequest, type HubWhatsappEmbeddedSignupCompleteResponse, type HubWhatsappEmbeddedSignupStartRequest, type HubWhatsappEmbeddedSignupStartResponse, type HubWorkflow, type HubWorkflowAction, type HubWorkflowActionResult, type HubWorkflowAgentStep, type HubWorkflowArtifact, type HubWorkflowArtifactDownload, type HubWorkflowArtifactRef, type HubWorkflowArtifactsResponse, type HubWorkflowCondition, type HubWorkflowConditionOp, type HubWorkflowConditionScalar, type HubWorkflowConnectionRequirement, type HubWorkflowDecision, type HubWorkflowDecisionOnTimeout, type HubWorkflowDecisionResolveResult, type HubWorkflowDecisionResolvedVia, type HubWorkflowDecisionStatus, type HubWorkflowDistillationCandidate, type HubWorkflowEdgeVerdicts, type HubWorkflowEventFilter, type HubWorkflowFailureCluster, type HubWorkflowFleetEntry, type HubWorkflowFleetInsights, type HubWorkflowFleetWindow, type HubWorkflowGraphEdge, type HubWorkflowGraphJoinRule, type HubWorkflowGraphNode, type HubWorkflowGraphSpec, type HubWorkflowHealth, type HubWorkflowHookEndpoint, type HubWorkflowHookToken, type HubWorkflowKvDeleteResponse, type HubWorkflowKvEntry, type HubWorkflowKvEntryMeta, type HubWorkflowKvListResponse, type HubWorkflowNodeHealth, type HubWorkflowOnErrorOutcome, type HubWorkflowPendingDecision, type HubWorkflowPendingDecisionsResponse, type HubWorkflowProposal, type HubWorkflowProposalInput, type HubWorkflowRevision, type HubWorkflowRevisionMeta, type HubWorkflowRevisionSource, type HubWorkflowRevisionStatus, type HubWorkflowRun, type HubWorkflowRunCancelResult, type HubWorkflowRunDetail, type HubWorkflowRunEnqueued, type HubWorkflowRunInputs, type HubWorkflowRunRetried, type HubWorkflowRunStatus, type HubWorkflowRunStepsPage, type HubWorkflowRunStreamEvent, type HubWorkflowRunSummary, type HubWorkflowRunsPage, type HubWorkflowSchemaResponse, type HubWorkflowTemplate, type HubWorkflowTemplateCategory, type HubWorkflowTemplateInstantiateResult, type HubWorkflowTemplateParameter, type HubWorkflowTrigger, type HubWorkflowValidateResponse, type HubWorkflowValidationError, HubWorkflowsClient, type VerifyHubEventSignatureInput, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
2870
+ export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubAgentIterationSpan, type HubAgentRunDetail, type HubAllowanceDecision, type HubAllowanceGrant, type HubAllowancePlan, type HubAllowancePlanInput, type HubAllowanceRole, type HubAllowanceSubject, type HubAllowanceSyncInput, type HubAllowanceSyncReceipt, type HubAllowanceTier, type HubAllowanceUsage, HubAllowancesClient, type HubApiKeyConnectRequest, type HubApiKeyConnectResponse, type HubApiKeyConnectionMetadata, type HubApp, HubAppBrokerClient, type HubAppBrokerExchange, type HubAppBrokerOptions, type HubAppBrokerToken, type HubAppComplianceClaim, type HubAppComplianceState, 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, 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 HubLineReminderInput, type HubLineReminderReceipt, type HubLineReplyCode, type HubLineReplyCodeInput, type HubLineScheduledSendOptions, type HubLineSendInput, type HubLineSendReceipt, HubLinesClient, HubManagedNumbersClient, type HubManualRunInput, type HubNumberListQuery, type HubNumberOrder, type HubNumberOrderPage, 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, KnowledgeAttachment, KnowledgeAttachmentAuthorization, KnowledgeAuthorization, KnowledgeCapabilities, KnowledgeCapability, KnowledgeEmbeddingSpace, KnowledgeReference, KnowledgeSourceCreate, KnowledgeSourceInput, KnowledgeSourceSummary, type VerifyHubEventSignatureInput, approveKnowledgeSource, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
1816
2871
  //# sourceMappingURL=index.d.ts.map