@tangle-network/hub-sdk 0.29.0-develop.20260819122040.176c418 → 0.29.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,3 +1,212 @@
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
+ /** App identity and customer permissions over the existing Platform transport.
138
+ * These operations do not authorize spending or expose upstream credentials. */
139
+ interface HubApp {
140
+ id: string;
141
+ clientId: string;
142
+ oauthClientId: string | null;
143
+ name: string;
144
+ redirectUris: string[];
145
+ allowedScopes: string[];
146
+ homepageUrl: string | null;
147
+ accessPayer?: "user" | "app-owner";
148
+ status: "active" | "revoked";
149
+ createdAt: string;
150
+ updatedAt: string;
151
+ }
152
+ interface HubAppCreateInput {
153
+ name: string;
154
+ redirectUris: string[];
155
+ allowedScopes: string[];
156
+ homepageUrl?: string;
157
+ /** The registered app owner funds eligibility; customer permissions remain separate. */
158
+ accessPayer?: "user" | "app-owner";
159
+ /** Associate an existing owned login client in the same transaction as creation. */
160
+ oauthClientId?: string;
161
+ }
162
+ interface HubAppGrant {
163
+ id: string;
164
+ appId: string;
165
+ userId: string;
166
+ connectionId: string;
167
+ scopes: string[];
168
+ status: "active" | "revoked";
169
+ createdAt: string;
170
+ updatedAt: string;
171
+ revokedAt: string | null;
172
+ /** Display metadata is additive; older deployments may omit it. */
173
+ appName?: string | null;
174
+ oauthClientId?: string | null;
175
+ providerId?: string | null;
176
+ accountDisplay?: string | null;
177
+ connectionDisplayName?: string | null;
178
+ }
179
+ interface HubAppGrantRevoked {
180
+ grantId: string;
181
+ status: "revoked";
182
+ revokedAt: string | null;
183
+ tokensRevoked: number;
184
+ }
185
+ declare class HubAppsClient {
186
+ private readonly request;
187
+ readonly grants: {
188
+ list: () => Promise<HubAppGrant[]>;
189
+ revoke: (grantId: string) => Promise<HubAppGrantRevoked>;
190
+ };
191
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
192
+ list(): Promise<HubApp[]>;
193
+ /** The secret is returned only by creation; keep it in your server vault. */
194
+ create(input: HubAppCreateInput): Promise<{
195
+ app: HubApp;
196
+ clientSecret: string;
197
+ }>;
198
+ /** Immutable association of two existing records with the same owner. */
199
+ linkOAuthClient(appId: string, clientId: string): Promise<{
200
+ appId: string;
201
+ oauthClientId: string;
202
+ }>;
203
+ revoke(appId: string): Promise<{
204
+ appId: string;
205
+ grantsRevoked: number;
206
+ tokensRevoked: number;
207
+ }>;
208
+ }
209
+ //#endregion
1
210
  //#region src/types.d.ts
2
211
  type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
3
212
  interface HubSuccessEnvelope<TData> {
@@ -14,7 +223,7 @@ interface HubErrorBody {
14
223
  message: string;
15
224
  details?: unknown;
16
225
  }
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}`;
226
+ 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
227
  interface HubStatusResponse {
19
228
  contract: unknown;
20
229
  principal: HubPrincipal;
@@ -36,6 +245,7 @@ interface HubConnection {
36
245
  providerId: string;
37
246
  displayName: string;
38
247
  accountDisplay: string | null;
248
+ providerAccountId: string | null;
39
249
  scopes: string[];
40
250
  status: "active" | "revoked" | "unhealthy" | "reconnect_required";
41
251
  health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
@@ -222,6 +432,7 @@ interface HubOAuthStartRequest {
222
432
  returnUrl?: string;
223
433
  cli?: boolean;
224
434
  connectionParameters?: Record<string, string>;
435
+ requestedScopes?: readonly string[];
225
436
  }
226
437
  interface HubOAuthCallbackSuccessQuery {
227
438
  provider: string;
@@ -252,6 +463,9 @@ interface HubWhatsappEmbeddedSignupStartResponse {
252
463
  appId: string;
253
464
  configId: string;
254
465
  sdkVersion: string;
466
+ /** Embedded Signup flow the login configuration selects. "v4" takes empty
467
+ * extras; "v2" needs featureType and sessionInfoVersion. Absent means "v2". */
468
+ signupVersion?: "v2" | "v4";
255
469
  state: string;
256
470
  expiresAt: string;
257
471
  scopes: string[];
@@ -282,7 +496,18 @@ interface HubOAuthCallbackResponse {
282
496
  interface HubApiKeyConnectRequest {
283
497
  provider: string;
284
498
  apiKey: string;
499
+ /** Connector-owned setup values. Hub validates them before testing the key. */
500
+ metadata?: HubApiKeyConnectionMetadata;
285
501
  }
502
+ type HubApiKeyConnectionMetadata = {
503
+ propertyId: string;
504
+ currency?: string;
505
+ } | {
506
+ listings: Array<{
507
+ id: string;
508
+ pms: string;
509
+ }>;
510
+ };
286
511
  /** Result of an api-key connect: the created (or reconnected) connection.
287
512
  * Synchronous — there is no redirect leg, unlike the OAuth flow. */
288
513
  interface HubApiKeyConnectResponse {
@@ -527,7 +752,7 @@ interface HubGithubAppInstallation {
527
752
  accountType: string | null;
528
753
  /** "all" ⇒ every repo under the account; "selected" ⇒ only repoFullNames. */
529
754
  repositorySelection: "all" | "selected";
530
- /** Lowercased "owner/repo" — empty when repositorySelection = "all". */
755
+ /** Metadata omits names; use githubApp.listRepos(id) for a live caller-safe list. */
531
756
  repoFullNames: string[];
532
757
  suspended: boolean;
533
758
  }
@@ -580,8 +805,10 @@ interface HubGithubAppSyncResponse {
580
805
  }
581
806
  interface HubGithubAppListReposResponse {
582
807
  installationId: number;
583
- /** Lowercased "owner/repo" — covers the full registry view of the install. */
808
+ /** Complete live intersection of App coverage and the caller's GitHub access. */
584
809
  repoFullNames: string[];
810
+ /** True only when both upstream listings completed; failures return an error. */
811
+ complete: true;
585
812
  }
586
813
  interface HubGithubAppIsRepoInstalledRequest {
587
814
  owner: string;
@@ -612,10 +839,14 @@ interface HubWorkflowTrigger {
612
839
  timezone: string | null;
613
840
  nextFireAt: string | null;
614
841
  lastFiredAt: string | null;
842
+ /** Schedule only: the ISO-8601 instant it stops firing; null when unbounded. */
843
+ until: string | null;
615
844
  }
616
845
  interface HubWorkflowValidationError {
617
846
  path: string;
618
847
  message: string;
848
+ /** Machine-readable reason where one is defined, e.g. `schedule_outlives_grant`. */
849
+ code?: string;
619
850
  }
620
851
  type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
621
852
  /** One agent iteration of an `agent.run`, as the single-run detail carries it
@@ -1222,6 +1453,616 @@ interface HubWorkflowRunStepsPage {
1222
1453
  nextCursor: number | null;
1223
1454
  }
1224
1455
  //#endregion
1456
+ //#region src/broker.d.ts
1457
+ interface HubAppBrokerOptions {
1458
+ baseUrl: string;
1459
+ clientId: string;
1460
+ clientSecret: string;
1461
+ fetch?: typeof fetch;
1462
+ }
1463
+ interface HubAppBrokerToken {
1464
+ accessToken: string;
1465
+ expiresIn: number;
1466
+ scopes: string[];
1467
+ }
1468
+ interface HubAppBrokerExchange extends HubAppBrokerToken {
1469
+ grantId: string;
1470
+ connectionId: string;
1471
+ }
1472
+ /** Server-only client. App secrets never become a user's general API key.
1473
+ * Every invocation mints and consumes one short-lived, exact-grant token. */
1474
+ declare class HubAppBrokerClient {
1475
+ private readonly options;
1476
+ private readonly baseUrl;
1477
+ private readonly fetcher;
1478
+ constructor(options: HubAppBrokerOptions);
1479
+ private token;
1480
+ private readToken;
1481
+ exchange(input: {
1482
+ code: string;
1483
+ redirectUri: string;
1484
+ connectionId: string;
1485
+ }): Promise<HubAppBrokerExchange>;
1486
+ mint(grantId: string): Promise<HubAppBrokerToken>;
1487
+ invoke<T = unknown>(grantId: string, connectionId: string, actionPath: string, input: Record<string, unknown>): Promise<HubExecResponse<T>>;
1488
+ }
1489
+ //#endregion
1490
+ //#region src/inbound-webhooks.d.ts
1491
+ /** Provider setup uses the existing authenticated Hub transport and vault. */
1492
+ interface HubInboundWebhookCreateOptions {
1493
+ /** Inkbox identity that owns all selected channels. */
1494
+ identityId?: string;
1495
+ mailboxId?: string;
1496
+ phoneNumberId?: string;
1497
+ imessage?: boolean;
1498
+ /** Linq: explicit owned lines; omitted does not mean every account line. */
1499
+ phoneNumbers?: string[];
1500
+ /** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
1501
+ phoneNumberIds?: string[];
1502
+ /** Contiguity Console secret, or an existing Inkbox identity signing key. */
1503
+ signingSecret?: string;
1504
+ }
1505
+ interface HubInboundWebhookCreateResponse {
1506
+ url: string;
1507
+ /** True only when the provider subscription was created by the server. */
1508
+ provisioned?: boolean;
1509
+ /** Self-configured legacy providers can return a newly minted secret once. */
1510
+ secret?: string;
1511
+ inboundAddress?: string;
1512
+ requiresProviderSetup?: boolean;
1513
+ }
1514
+ interface HubInboundWebhookStatus {
1515
+ configured: boolean;
1516
+ url?: string;
1517
+ /** Configuration is not evidence of a real delivered message. */
1518
+ deliveryVerified: false;
1519
+ requiresProviderSetup?: boolean;
1520
+ }
1521
+ /** Live provider readback for one explicitly selected Linq WhatsApp number. */
1522
+ interface HubInboundPhoneNumberScope {
1523
+ configured: true;
1524
+ provisioned: true;
1525
+ subscribed: true;
1526
+ phoneNumberIds: string[];
1527
+ }
1528
+ declare class HubInboundWebhooksClient {
1529
+ private readonly request;
1530
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1531
+ create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
1532
+ get(connectionId: string): Promise<HubInboundWebhookStatus>;
1533
+ /** Add one owned Linq WhatsApp number without rotating the webhook secret. */
1534
+ ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
1535
+ /** Remove event subscriptions first. This does not silently rotate a live URL. */
1536
+ delete(connectionId: string): Promise<{
1537
+ removed: boolean;
1538
+ }>;
1539
+ private path;
1540
+ }
1541
+ //#endregion
1542
+ //#region src/knowledge-management.d.ts
1543
+ interface KnowledgeReference {
1544
+ sourceId: string;
1545
+ generation: string;
1546
+ }
1547
+ /** Connection references only. Provider credentials never enter this contract. */
1548
+ interface KnowledgeEmbeddingSpace {
1549
+ connectionId: string;
1550
+ model: string;
1551
+ dimensions: number;
1552
+ }
1553
+ type KnowledgeSourceInput = {
1554
+ kind: "file";
1555
+ name: string;
1556
+ base64: string;
1557
+ mediaType: string;
1558
+ } | {
1559
+ kind: "git";
1560
+ connectionId: string;
1561
+ owner: string;
1562
+ repo: string;
1563
+ ref: string;
1564
+ pathPrefix?: string;
1565
+ } | {
1566
+ kind: "url";
1567
+ url: string;
1568
+ } | {
1569
+ kind: "s3";
1570
+ connectionId: string;
1571
+ bucket: string;
1572
+ prefix: string;
1573
+ } | {
1574
+ kind: "vector";
1575
+ connectionId: string;
1576
+ provider: "pinecone" | "qdrant" | "weaviate";
1577
+ indexName: string;
1578
+ namespace?: string;
1579
+ embedding: KnowledgeEmbeddingSpace;
1580
+ textField: string;
1581
+ sourceUriField: string;
1582
+ };
1583
+ interface KnowledgeCapability {
1584
+ supported: boolean;
1585
+ reason?: string;
1586
+ }
1587
+ interface KnowledgeCapabilities {
1588
+ delegation?: KnowledgeCapability & {
1589
+ resource?: string;
1590
+ scopes?: string[];
1591
+ };
1592
+ sources: Record<KnowledgeSourceInput["kind"], KnowledgeCapability>;
1593
+ vectorProviders: Record<"pinecone" | "qdrant" | "weaviate", KnowledgeCapability>;
1594
+ managedVector: KnowledgeCapability;
1595
+ file: {
1596
+ mediaTypes: string[];
1597
+ maxBytes: number;
1598
+ maxObjects: number;
1599
+ };
1600
+ }
1601
+ interface KnowledgeSourceSummary {
1602
+ /** Required query authorization, not proof that an owner policy currently permits it. */
1603
+ retrieval?: {
1604
+ kind: "lexical";
1605
+ } | {
1606
+ kind: "vector";
1607
+ embeddingPolicy: {
1608
+ connectionId: string;
1609
+ actionPath: "openai.embeddings.create";
1610
+ scope: "owner-connection-action";
1611
+ };
1612
+ };
1613
+ id: string;
1614
+ name: string;
1615
+ kind: KnowledgeSourceInput["kind"];
1616
+ status: "ready" | "refreshing" | "failed" | "awaiting-approval";
1617
+ approval?: {
1618
+ id: string;
1619
+ path: string;
1620
+ preview: {
1621
+ provider: string;
1622
+ connectionId: string;
1623
+ collection: string;
1624
+ sourceId: string;
1625
+ requestId: string;
1626
+ embedding: KnowledgeEmbeddingSpace;
1627
+ chunkCount: number;
1628
+ sourceCount: number;
1629
+ dataSharing: string;
1630
+ };
1631
+ };
1632
+ refreshRequestId?: string;
1633
+ generation: string | null;
1634
+ lastError: {
1635
+ code: string;
1636
+ message: string;
1637
+ } | null;
1638
+ updatedAt: string;
1639
+ }
1640
+ type KnowledgeAttachmentAuthorization = {
1641
+ status: "active";
1642
+ } | {
1643
+ status: "unavailable";
1644
+ code: "APP_CONSENT_REVOKED" | "KEY_REVOKED" | "CONNECTION_UNAVAILABLE" | "ATTACHMENT_REVOKED" | "GENERATION_UNAVAILABLE" | "RUNTIME_AUTHORITY_REVOKED";
1645
+ };
1646
+ interface KnowledgeAttachment {
1647
+ /** Snapshot of live grant/key/connection authority, separate from durable pin state. */
1648
+ authorization?: KnowledgeAttachmentAuthorization;
1649
+ id: string;
1650
+ sourceId: string;
1651
+ sandboxId: string;
1652
+ generation: string;
1653
+ status: "active" | "detached";
1654
+ }
1655
+ interface KnowledgeSourceCreate {
1656
+ requestId: string;
1657
+ name: string;
1658
+ source: KnowledgeSourceInput;
1659
+ target?: {
1660
+ kind: "lexical";
1661
+ } | {
1662
+ kind: "managed-vector";
1663
+ provider: "qdrant";
1664
+ connectionId: string;
1665
+ embedding: KnowledgeEmbeddingSpace;
1666
+ };
1667
+ }
1668
+ /** Owner-only management. Runtime tools use HubKnowledgeClient.query instead. */
1669
+ interface KnowledgeAuthorization {
1670
+ userId: string;
1671
+ clientId: string;
1672
+ resource: string;
1673
+ scopes: Array<"knowledge:read" | "knowledge:write">;
1674
+ }
1675
+ declare class HubKnowledgeManagementClient {
1676
+ private readonly request;
1677
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1678
+ materialize(input: {
1679
+ sandboxId: string;
1680
+ references: KnowledgeReference[];
1681
+ }): Promise<KnowledgeAttachment[]>;
1682
+ authorization(): Promise<KnowledgeAuthorization>;
1683
+ disconnectAuthorization(): Promise<{
1684
+ revoked: true;
1685
+ }>;
1686
+ capabilities(): Promise<KnowledgeCapabilities>;
1687
+ list(): Promise<KnowledgeSourceSummary[]>;
1688
+ get(sourceId: string): Promise<KnowledgeSourceSummary>;
1689
+ create(input: KnowledgeSourceCreate): Promise<KnowledgeSourceSummary>;
1690
+ refresh(sourceId: string, input: {
1691
+ requestId: string;
1692
+ approvalToken?: string;
1693
+ }): Promise<KnowledgeSourceSummary>;
1694
+ attach(sourceId: string, input: {
1695
+ sandboxId: string;
1696
+ generation: string;
1697
+ expectedGeneration?: string;
1698
+ }): Promise<KnowledgeAttachment>;
1699
+ attachments(sandboxId?: string): Promise<KnowledgeAttachment[]>;
1700
+ detach(attachmentId: string): Promise<KnowledgeAttachment>;
1701
+ }
1702
+ //#endregion
1703
+ //#region src/knowledge.d.ts
1704
+ interface HubKnowledgeRetrievalResult {
1705
+ attachmentId: string;
1706
+ generation: string;
1707
+ provenance: "ingested" | "record-supplied";
1708
+ hits: Array<{
1709
+ id: string;
1710
+ title: string;
1711
+ snippet: string;
1712
+ score?: number;
1713
+ citations?: Array<{
1714
+ sourceId: string;
1715
+ sourceUri: string;
1716
+ revision?: string;
1717
+ }>;
1718
+ }>;
1719
+ elapsedMs?: number;
1720
+ }
1721
+ interface HubKnowledgeQueryResult {
1722
+ results: HubKnowledgeRetrievalResult[];
1723
+ /** Individual unavailable sources do not hide evidence from healthy sources. */
1724
+ failures: Array<{
1725
+ attachmentId: string;
1726
+ code: string;
1727
+ message: string;
1728
+ }>;
1729
+ partial: boolean;
1730
+ }
1731
+ /** Runtime-only retrieval. The authenticated sandbox credential determines the
1732
+ * scope on the server; neither a caller nor an agent can supply another scope. */
1733
+ declare class HubKnowledgeClient {
1734
+ private readonly request;
1735
+ readonly management: HubKnowledgeManagementClient;
1736
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
1737
+ bindings(): Promise<{
1738
+ references: KnowledgeReference[];
1739
+ }>;
1740
+ query(input: {
1741
+ query: string;
1742
+ limit?: number;
1743
+ expectedReferences?: KnowledgeReference[];
1744
+ }, options?: {
1745
+ signal?: AbortSignal;
1746
+ }): Promise<HubKnowledgeQueryResult>;
1747
+ }
1748
+ //#endregion
1749
+ //#region src/lines.d.ts
1750
+ interface HubLineMember {
1751
+ id: string;
1752
+ label: string | null;
1753
+ role: string;
1754
+ self?: boolean;
1755
+ consent?: "enabled" | "required";
1756
+ }
1757
+ interface HubLineContext {
1758
+ self: {
1759
+ id: string;
1760
+ label: string | null;
1761
+ role: string;
1762
+ };
1763
+ line: {
1764
+ id: string;
1765
+ label: string | null;
1766
+ transport: string;
1767
+ };
1768
+ members: HubLineMember[];
1769
+ capabilities: Record<string, {
1770
+ allowed: boolean;
1771
+ reason?: string;
1772
+ }>;
1773
+ pendingReminders: Array<{
1774
+ messageId: string;
1775
+ wakeAt?: string;
1776
+ prompt: string | null;
1777
+ }>;
1778
+ quotas: {
1779
+ selfMessagesToday: number;
1780
+ selfMessagesPerDay: number;
1781
+ selfMessagesPending: number;
1782
+ selfMessagesPendingLimit: number;
1783
+ };
1784
+ }
1785
+ interface HubLineSendInput {
1786
+ toMember: string;
1787
+ text: string;
1788
+ notBefore?: string;
1789
+ onBehalfOf?: string;
1790
+ idempotencyKey?: string;
1791
+ }
1792
+ interface HubLineOwnerSendInput {
1793
+ memberId: string;
1794
+ text: string;
1795
+ notBefore?: string;
1796
+ idempotencyKey: string;
1797
+ /** Ask a coded question; the member's reply that starts with `code` returns here. */
1798
+ reply?: HubLineReplyCodeInput;
1799
+ }
1800
+ interface HubLineReplyCodeInput {
1801
+ /** A letter, then up to seven letters or digits, with at least one digit (`F7`). Hub compares it case-insensitively. */
1802
+ code: string;
1803
+ /** 60 to 604800; the window opens when the send first becomes eligible. */
1804
+ ttlSeconds: number;
1805
+ /**
1806
+ * 1 to 20 distinct texted choices, each 1-32 of `a-z 0-9 _ -` after lower-casing.
1807
+ * An answer must then be `<code> <option>[ <note>]`; any other coded text keeps the question open.
1808
+ */
1809
+ options?: string[];
1810
+ }
1811
+ /** The coded question's state on an owner send receipt. */
1812
+ interface HubLineReplyCode {
1813
+ /** Upper case. */
1814
+ code: string;
1815
+ expiresAt: string;
1816
+ /** The first coded answer; `text` is null after content retention ends. */
1817
+ answer: {
1818
+ messageId: string;
1819
+ text: string | null;
1820
+ receivedAt: string; /** The named option, lower case; null when the send listed no options. */
1821
+ option: string | null; /** Words after the option; null when there were none or retention ended. */
1822
+ note: string | null;
1823
+ } | null;
1824
+ }
1825
+ interface HubLineReminderInput {
1826
+ text: string;
1827
+ notBefore: string;
1828
+ idempotencyKey: string;
1829
+ }
1830
+ interface HubLineApplicationDispatchCurrentInput {
1831
+ attachmentId: string;
1832
+ memberId: string;
1833
+ memberRevision: string;
1834
+ senderAddress: string;
1835
+ textSha256: string;
1836
+ binding: string;
1837
+ dispatchFence: string;
1838
+ dispatchDeadline: string;
1839
+ }
1840
+ interface HubLineMemberApplication {
1841
+ id: string;
1842
+ lineId: string;
1843
+ attachmentId: string;
1844
+ memberId: string;
1845
+ subjectId: string;
1846
+ status: "active" | "revoked";
1847
+ application: {
1848
+ url: string;
1849
+ binding: string;
1850
+ };
1851
+ /** Hub's name for the app at this callback; present on reads. */
1852
+ app?: {
1853
+ name: string;
1854
+ };
1855
+ createdAt: string;
1856
+ revokedAt: string | null;
1857
+ }
1858
+ interface HubLineMemberApplicationInput {
1859
+ expectedSelectionId: string | null;
1860
+ expectedMemberRevision: string;
1861
+ subjectId: string;
1862
+ application: {
1863
+ url: string;
1864
+ binding: string;
1865
+ secret: string;
1866
+ };
1867
+ }
1868
+ interface HubLineSendReceipt {
1869
+ message: {
1870
+ id: string;
1871
+ status: string;
1872
+ text: string | null;
1873
+ };
1874
+ eligibleAt: string | null;
1875
+ expiresAt: string;
1876
+ /** Null when the send asked no coded question; absent from Hub before reply codes. */
1877
+ reply?: HubLineReplyCode | null;
1878
+ }
1879
+ interface HubLineReminderReceipt {
1880
+ state: "queued" | "skipped";
1881
+ lineId: string;
1882
+ messageId?: string;
1883
+ sessionId?: string;
1884
+ completion?: string;
1885
+ reason?: string;
1886
+ }
1887
+ interface HubLineScheduledSendOptions {
1888
+ lineId: string;
1889
+ memberId: string;
1890
+ text: string;
1891
+ timezone: string;
1892
+ name?: string;
1893
+ notBefore?: string;
1894
+ /**
1895
+ * RFC 3339 instant the schedule stops at. Required when the calling key
1896
+ * expires, and no later than that expiry: a schedule never outlives the
1897
+ * key that wrote it.
1898
+ */
1899
+ until?: string;
1900
+ }
1901
+ interface HubLineCheckinOptions {
1902
+ lineId: string;
1903
+ member: string;
1904
+ timezone: string;
1905
+ prompt: string;
1906
+ name?: string;
1907
+ /** RFC 3339 instant the schedule stops at; see {@link HubLineScheduledSendOptions.until}. */
1908
+ until?: string;
1909
+ }
1910
+ /** Line calls share HubClient authentication and envelope handling. */
1911
+ declare class HubLinesClient {
1912
+ private readonly request;
1913
+ private readonly createWorkflow;
1914
+ private readonly requestApplicationDispatchCurrent?;
1915
+ readonly members: {
1916
+ list: (lineId: string) => Promise<HubLineMember[]>;
1917
+ };
1918
+ readonly memberApplications: {
1919
+ get: (lineId: string, memberId: string) => Promise<{
1920
+ memberRevision: string;
1921
+ selection: HubLineMemberApplication | null;
1922
+ }>;
1923
+ select: (lineId: string, memberId: string, input: HubLineMemberApplicationInput) => Promise<HubLineMemberApplication>;
1924
+ clear: (lineId: string, memberId: string, input: {
1925
+ expectedSelectionId: string;
1926
+ expectedMemberRevision: string;
1927
+ }) => Promise<void>;
1928
+ };
1929
+ readonly checkins: {
1930
+ schedule: (cron: string, options: HubLineCheckinOptions) => Promise<HubWorkflow>;
1931
+ };
1932
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>, createWorkflow: (yaml: string) => Promise<HubWorkflow>, requestApplicationDispatchCurrent?: ((path: string, init: RequestInit, callbackBearer: string) => Promise<{
1933
+ current: boolean;
1934
+ }>) | undefined);
1935
+ scheduleSend(cron: string, options: HubLineScheduledSendOptions): Promise<HubWorkflow>;
1936
+ context(): Promise<HubLineContext>;
1937
+ send(lineId: string, input: HubLineSendInput | HubLineOwnerSendInput): Promise<HubLineSendReceipt>;
1938
+ /** Read an owner send's receipt, including its coded answer. Queued is not delivered. */
1939
+ sentMessage(lineId: string, messageId: string): Promise<HubLineSendReceipt>;
1940
+ remind(lineId: string, input: HubLineReminderInput): Promise<HubLineReminderReceipt>;
1941
+ applicationDispatchCurrent(lineId: string, messageId: string, input: HubLineApplicationDispatchCurrentInput, callbackBearer: string): Promise<boolean>;
1942
+ }
1943
+ //#endregion
1944
+ //#region src/managed-numbers.d.ts
1945
+ interface HubNumberReadiness {
1946
+ configured: boolean;
1947
+ provider: "inkbox";
1948
+ transports: Array<"sms" | "imessage">;
1949
+ billing: "prepaid_activation";
1950
+ automaticRentalBilling: false;
1951
+ deliveryVerified: false;
1952
+ }
1953
+ interface HubNumberQuote {
1954
+ transport: "sms" | "imessage";
1955
+ activationCents: number;
1956
+ currency: "usd";
1957
+ termsVersion: string;
1958
+ terms: string;
1959
+ expiresAt: number;
1960
+ /** The binding the quote was issued for. Absent from older servers. */
1961
+ clientReference?: string;
1962
+ /** Opaque. Pass it back to `create`; never decode it. */
1963
+ token: string;
1964
+ }
1965
+ /** One page of the owner's orders, newest first. */
1966
+ interface HubNumberOrderPage {
1967
+ orders: HubNumberOrder[];
1968
+ /** Present while more orders exist. Older servers omit it and return one
1969
+ * bounded page, so an absent cursor never proves an order does not exist. */
1970
+ nextCursor?: string | null;
1971
+ }
1972
+ interface HubNumberListQuery {
1973
+ /** Only orders requested for this binding, including closed ones. */
1974
+ clientReference?: string;
1975
+ cursor?: string;
1976
+ /** 1 to 100; the server default is 100. */
1977
+ limit?: number;
1978
+ }
1979
+ /** An operator's terminal decision on an order stuck in `needs_review`.
1980
+ * Read-only for a creator: the resolution is made through the platform's
1981
+ * admin surface, never through this client. */
1982
+ interface HubNumberResolution {
1983
+ action: "release" | "settle" | "abandon";
1984
+ operator: string;
1985
+ reason: string;
1986
+ at: number;
1987
+ /** Present while the operator's action is still running. The decision is
1988
+ * not final and the order can still return to review. */
1989
+ pending?: true;
1990
+ /** Present when a `settle` handed a live, unfinished order back to
1991
+ * provisioning, so the order is working again rather than closed. */
1992
+ requeued?: true;
1993
+ }
1994
+ interface HubNumberOrder {
1995
+ id: string;
1996
+ clientReference: string;
1997
+ transport: "sms" | "imessage";
1998
+ status: "pending" | "provider_pending" | "needs_review" | "ready_for_setup" | "cancelled";
1999
+ phase: "identity" | "number" | "credential" | "connection" | "complete";
2000
+ address: string | null;
2001
+ connectionId: string | null;
2002
+ identityId: string | null;
2003
+ providerNumberId: string | null;
2004
+ billingStatus: "unreserved" | "reserved" | "settled" | "released";
2005
+ cancellation: "none" | "requested" | "needs_review" | "released" | "abandoned";
2006
+ errorCode: string | null;
2007
+ nextAttemptAt: number | null;
2008
+ resolution: HubNumberResolution | null;
2009
+ deliveryVerified: false;
2010
+ activationCents: number;
2011
+ currency: "usd";
2012
+ terms: string;
2013
+ }
2014
+ /** Administrative number operations through Hub's authenticated transport.
2015
+ * A mutation is one attempt; an uncertain create reuses its quote and reference. */
2016
+ declare class HubManagedNumbersClient {
2017
+ private readonly request;
2018
+ constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
2019
+ readiness(): Promise<HubNumberReadiness>;
2020
+ /** One page of orders. Scope by `clientReference` to ask about one binding,
2021
+ * and follow `nextCursor` for the rest; a page is never ownership evidence. */
2022
+ list(query?: HubNumberListQuery): Promise<HubNumberOrderPage>;
2023
+ get(id: string): Promise<{
2024
+ order: HubNumberOrder;
2025
+ }>;
2026
+ quote(input: {
2027
+ transport: "sms" | "imessage";
2028
+ clientReference: string;
2029
+ }): Promise<{
2030
+ quote: HubNumberQuote;
2031
+ }>;
2032
+ /** `clientReference` and `transport`, when given, must match the signed
2033
+ * quote or Hub refuses the purchase with a conflict. */
2034
+ create(input: {
2035
+ quoteToken: string;
2036
+ consent: true;
2037
+ state?: string;
2038
+ clientReference?: string;
2039
+ transport?: "sms" | "imessage";
2040
+ }): Promise<{
2041
+ order: HubNumberOrder;
2042
+ }>;
2043
+ /** Fences references so no order can take them again. Call it as the last
2044
+ * step before retiring the resource they name: a purchase that races the
2045
+ * retirement is then refused (`409 number_reference_fenced`) instead of
2046
+ * binding a line to a resource that is gone. Refused with
2047
+ * `409 number_reference_held` while a live order holds one of them; cancel
2048
+ * it first. A cancelled order no longer holds its reference, so the fence
2049
+ * succeeds as soon as `cancel` returns, whether or not its release is still
2050
+ * pending. Repeating a fence is harmless. */
2051
+ fence(input: {
2052
+ clientReferences: string[];
2053
+ }): Promise<{
2054
+ clientReferences: string[];
2055
+ }>;
2056
+ advance(id: string): Promise<{
2057
+ order: HubNumberOrder;
2058
+ }>;
2059
+ cancel(id: string): Promise<{
2060
+ order: HubNumberOrder;
2061
+ }>;
2062
+ private path;
2063
+ private post;
2064
+ }
2065
+ //#endregion
1225
2066
  //#region src/client.d.ts
1226
2067
  type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
1227
2068
  interface HubClientOptions {
@@ -1250,13 +2091,25 @@ interface HubClientFromEnvOptions {
1250
2091
  }
1251
2092
  declare function resolveHubBaseUrl(env?: HubEnv): string;
1252
2093
  declare function resolveHubAuth(env?: HubEnv): string;
1253
- declare class HubClient {
2094
+ declare class HubTransport {
1254
2095
  readonly baseUrl: string;
1255
2096
  readonly fetch: typeof fetch;
1256
2097
  readonly apiKey?: string;
1257
2098
  readonly authHeaders?: HubAuthHeaders;
2099
+ constructor(options: HubClientOptions);
2100
+ protected request<TData>(path: string, init: RequestInit, options?: {
2101
+ auth?: "client" | "caller";
2102
+ validateData?: (data: unknown) => data is TData;
2103
+ }): Promise<TData>;
2104
+ protected buildHeaders(headers: HeadersInit | undefined, callerAuth?: boolean): Promise<Headers>;
2105
+ }
2106
+ declare class HubClient extends HubTransport {
2107
+ readonly knowledge: HubKnowledgeClient;
2108
+ readonly allowances: HubAllowancesClient;
2109
+ readonly apps: HubAppsClient;
1258
2110
  readonly connections: HubConnectionsClient;
1259
2111
  readonly channels: HubChannelsClient;
2112
+ readonly numbers: HubManagedNumbersClient;
1260
2113
  readonly eventSubscriptions: HubEventSubscriptionsClient;
1261
2114
  readonly permissions: HubPermissionsClient;
1262
2115
  readonly tokens: HubTokensClient;
@@ -1265,10 +2118,10 @@ declare class HubClient {
1265
2118
  readonly audit: HubAuditClient;
1266
2119
  readonly githubApp: HubGithubAppClient;
1267
2120
  readonly workflows: HubWorkflowsClient;
2121
+ readonly lines: HubLinesClient;
1268
2122
  constructor(options: HubClientOptions);
1269
2123
  static fromEnv(options?: HubClientFromEnvOptions): HubClient;
1270
2124
  status(): Promise<HubStatusResponse>;
1271
- private request;
1272
2125
  /**
1273
2126
  * Open a streaming (Server-Sent Events) response and return its raw body.
1274
2127
  * Shares auth-header building + `fetch` with {@link request}, but does NOT
@@ -1289,7 +2142,6 @@ declare class HubClient {
1289
2142
  * otherwise an `HUB_HTTP_<status>` transport error.
1290
2143
  */
1291
2144
  private requestBytes;
1292
- private buildHeaders;
1293
2145
  }
1294
2146
  interface HubTokenListOptions {
1295
2147
  includeExpired?: boolean;
@@ -1360,6 +2212,8 @@ interface HubConnectionStartOptions {
1360
2212
  returnUrl?: string;
1361
2213
  cli?: boolean;
1362
2214
  connectionParameters?: Record<string, string>;
2215
+ /** GitHub accepts the exact read:user, repo, read:org set. */
2216
+ requestedScopes?: readonly string[];
1363
2217
  }
1364
2218
  declare class HubChannelsClient {
1365
2219
  private readonly request;
@@ -1377,6 +2231,7 @@ declare class HubEventSubscriptionsClient {
1377
2231
  }
1378
2232
  declare class HubConnectionsClient {
1379
2233
  private readonly request;
2234
+ readonly inboundWebhook: HubInboundWebhooksClient;
1380
2235
  constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
1381
2236
  list(): Promise<HubConnectionsResponse>;
1382
2237
  /** Connector catalog: every provider the hub can expose, each flagged with
@@ -1389,8 +2244,9 @@ declare class HubConnectionsClient {
1389
2244
  /** Connect a non-OAuth (api-key) connector by submitting the user's key.
1390
2245
  * The server validates the key with a live probe before persisting and
1391
2246
  * returns the created (or reconnected) connection — there is no redirect,
1392
- * unlike `start`. */
1393
- connectApiKey(provider: string, apiKey: string): Promise<HubApiKeyConnectResponse>;
2247
+ * unlike `start`. Cloudbeds requires propertyId metadata and PriceLabs
2248
+ * requires listing ID/PMS pairs; other providers have no metadata. */
2249
+ connectApiKey(provider: string, apiKey: string, metadata?: HubApiKeyConnectRequest["metadata"]): Promise<HubApiKeyConnectResponse>;
1394
2250
  revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
1395
2251
  health(connectionId: string): Promise<HubConnectionHealthResponse>;
1396
2252
  }
@@ -1809,8 +2665,166 @@ declare function authenticateHubEventRequest(input: AuthenticateHubEventRequestI
1809
2665
  declare function verifyHubEventSignature(input: VerifyHubEventSignatureInput): Promise<HubEventSignatureResult>;
1810
2666
  declare function parseHubEventDelivery(input: string | unknown): HubEventDelivery;
1811
2667
  //#endregion
2668
+ //#region src/knowledge-approval.d.ts
2669
+ /** Called only after the owner reviews this exact pending effect and clicks
2670
+ * Approve. Re-read first: a stale tab cannot approve a substituted operation. */
2671
+ declare function approveKnowledgeSource(input: {
2672
+ port: Pick<HubKnowledgeManagementClient, "get" | "refresh">;
2673
+ approvals: Pick<HubApprovalsClient, "approve">;
2674
+ source: KnowledgeSourceSummary;
2675
+ }): Promise<KnowledgeSourceSummary>;
2676
+ //#endregion
2677
+ //#region src/line-grants.d.ts
2678
+ interface HubLineGrantBinding {
2679
+ workspaceId: string;
2680
+ workspaceAgentId: string;
2681
+ }
2682
+ interface HubLineGrant {
2683
+ id: string;
2684
+ lineId: string;
2685
+ connectionId: string;
2686
+ workspaceId: string;
2687
+ workspaceAgentId: string;
2688
+ agentProfileVersion: string;
2689
+ backendSha256: string;
2690
+ attachmentId: string | null;
2691
+ intakeMode: "guests" | "owner_only";
2692
+ /** "application" grants select the app's callback for the owner member instead of attaching. */
2693
+ execution: "backend" | "application";
2694
+ applicationOrigin: string | null;
2695
+ priorAttachmentId: string | null;
2696
+ priorAttachmentActive: boolean;
2697
+ monthlyBudgetUsd: number;
2698
+ monthlySpentUsd: number;
2699
+ }
2700
+ interface HubLineGrantLine {
2701
+ id: string;
2702
+ connectionId: string;
2703
+ transport: "sms" | "imessage";
2704
+ status: string;
2705
+ address: string | null;
2706
+ attachment: {
2707
+ id: string;
2708
+ sandboxId: string;
2709
+ status: string;
2710
+ } | null;
2711
+ }
2712
+ interface HubLineGrantAttachInput {
2713
+ workspaceAgentId: string;
2714
+ agentProfileVersion: string;
2715
+ renewalCode?: string;
2716
+ respond: {
2717
+ kind: "agent";
2718
+ backend: Record<string, unknown>;
2719
+ };
2720
+ }
2721
+ interface HubLineGrantAttachment {
2722
+ id: string;
2723
+ sandboxId: string;
2724
+ status: string;
2725
+ members?: Array<{
2726
+ id: string;
2727
+ role: string;
2728
+ }>;
2729
+ }
2730
+ interface HubLineGrantThread {
2731
+ id: string;
2732
+ lineId: string;
2733
+ attachmentId: string;
2734
+ }
2735
+ interface HubLineGrantMessage {
2736
+ id: string;
2737
+ threadId: string;
2738
+ direction: string;
2739
+ text: string | null;
2740
+ }
2741
+ /** The consented owner member on the owner's current attachment. */
2742
+ interface HubLineGrantMemberApplication {
2743
+ lineId: string;
2744
+ attachmentId: string;
2745
+ memberId: string;
2746
+ subjectId: string;
2747
+ /** Pass back unchanged as `expectedMemberRevision`. */
2748
+ memberRevision: string;
2749
+ /** False until the owner has texted the line and Hub recorded consent. */
2750
+ eligible: boolean;
2751
+ /** Hub-derived; every callback for this grant carries it. */
2752
+ binding: string;
2753
+ selection: {
2754
+ id: string; /** True when this grant's callback is the selected application. */
2755
+ own: boolean;
2756
+ /**
2757
+ * Hub's name for the app that answers the owner's texts, shown to the
2758
+ * owner in every app they consented on this line: a registered app's
2759
+ * name, or "Another app" when Hub has none. Absent before Platform named
2760
+ * selection holders.
2761
+ */
2762
+ app?: {
2763
+ name: string;
2764
+ }; /** When the current app started answering. */
2765
+ selectedAt?: string; /** This app's own callback; never returned for another app. */
2766
+ url?: string;
2767
+ createdAt?: string;
2768
+ } | null;
2769
+ }
2770
+ interface HubLineGrantSelectApplicationInput {
2771
+ /** The current selection exactly as read. */
2772
+ expectedSelectionId: string | null;
2773
+ /**
2774
+ * Set only when the owner chose to move their texts here from the app shown
2775
+ * in `selection.app`: that selection's id, also passed as
2776
+ * `expectedSelectionId`. Without it Hub never replaces another app.
2777
+ */
2778
+ replaceSelectionId?: string;
2779
+ expectedMemberRevision: string;
2780
+ /** HTTPS callback on the owner-approved application origin. */
2781
+ url: string;
2782
+ /** Bearer Hub sends to the callback; 32-512 printable ASCII characters. */
2783
+ secret: string;
2784
+ }
2785
+ interface HubLineGrantApplicationSelection {
2786
+ id: string;
2787
+ lineId: string;
2788
+ attachmentId: string;
2789
+ memberId: string;
2790
+ subjectId: string;
2791
+ status: string;
2792
+ application: {
2793
+ url: string;
2794
+ binding: string;
2795
+ };
2796
+ createdAt: string;
2797
+ revokedAt: string | null;
2798
+ }
2799
+ /** Every call uses HubTransport's authHeaders, so one-use app broker tokens can be minted per request. */
2800
+ declare class HubLineGrantsClient extends HubTransport {
2801
+ current(binding: HubLineGrantBinding): Promise<HubLineGrant>;
2802
+ line(binding: HubLineGrantBinding): Promise<HubLineGrantLine>;
2803
+ attach(binding: HubLineGrantBinding, input: HubLineGrantAttachInput): Promise<HubLineGrantAttachment>;
2804
+ detach(binding: HubLineGrantBinding): Promise<{
2805
+ detached: boolean;
2806
+ }>;
2807
+ threads(binding: HubLineGrantBinding): Promise<HubLineGrantThread[]>;
2808
+ messages(binding: HubLineGrantBinding, threadId: string): Promise<HubLineGrantMessage[]>;
2809
+ memberApplication(binding: HubLineGrantBinding): Promise<HubLineGrantMemberApplication>;
2810
+ /**
2811
+ * Route the owner's texts to this app's callback; the incumbent attachment
2812
+ * stays. `replaceSelectionId` moves them from another app on the owner's
2813
+ * explicit choice.
2814
+ */
2815
+ selectApplication(binding: HubLineGrantBinding, input: HubLineGrantSelectApplicationInput): Promise<HubLineGrantApplicationSelection>;
2816
+ /** Return the owner's texts to the incumbent attachment. */
2817
+ clearApplication(binding: HubLineGrantBinding, input: {
2818
+ expectedSelectionId: string;
2819
+ expectedMemberRevision: string;
2820
+ }): Promise<void>;
2821
+ revoke(binding: HubLineGrantBinding): Promise<{
2822
+ revoked: boolean;
2823
+ }>;
2824
+ }
2825
+ //#endregion
1812
2826
  //#region src/redaction.d.ts
1813
2827
  declare function redactHubValue(value: unknown): unknown;
1814
2828
  //#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 };
2829
+ 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 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 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
2830
  //# sourceMappingURL=index.d.ts.map