@tangle-network/hub-sdk 0.24.0-develop.20260814141200.dd5e0f0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +175 -6
- package/dist/index.d.ts +752 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +530 -254
- package/dist/index.js.map +1 -1
- package/package.json +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,261 @@
|
|
|
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
|
+
status: "active" | "revoked";
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
}
|
|
151
|
+
interface HubAppCreateInput {
|
|
152
|
+
name: string;
|
|
153
|
+
redirectUris: string[];
|
|
154
|
+
allowedScopes: string[];
|
|
155
|
+
homepageUrl?: string;
|
|
156
|
+
/** Associate an existing owned login client in the same transaction as creation. */
|
|
157
|
+
oauthClientId?: string;
|
|
158
|
+
}
|
|
159
|
+
interface HubAppGrant {
|
|
160
|
+
id: string;
|
|
161
|
+
appId: string;
|
|
162
|
+
userId: string;
|
|
163
|
+
connectionId: string;
|
|
164
|
+
scopes: string[];
|
|
165
|
+
status: "active" | "revoked";
|
|
166
|
+
createdAt: string;
|
|
167
|
+
updatedAt: string;
|
|
168
|
+
revokedAt: string | null;
|
|
169
|
+
/** Display metadata is additive; older deployments may omit it. */
|
|
170
|
+
appName?: string | null;
|
|
171
|
+
oauthClientId?: string | null;
|
|
172
|
+
providerId?: string | null;
|
|
173
|
+
accountDisplay?: string | null;
|
|
174
|
+
connectionDisplayName?: string | null;
|
|
175
|
+
}
|
|
176
|
+
interface HubAppGrantRevoked {
|
|
177
|
+
grantId: string;
|
|
178
|
+
status: "revoked";
|
|
179
|
+
revokedAt: string | null;
|
|
180
|
+
tokensRevoked: number;
|
|
181
|
+
}
|
|
182
|
+
declare class HubAppsClient {
|
|
183
|
+
private readonly request;
|
|
184
|
+
readonly grants: {
|
|
185
|
+
list: () => Promise<HubAppGrant[]>;
|
|
186
|
+
revoke: (grantId: string) => Promise<HubAppGrantRevoked>;
|
|
187
|
+
};
|
|
188
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
|
|
189
|
+
list(): Promise<HubApp[]>;
|
|
190
|
+
/** The secret is returned only by creation; keep it in your server vault. */
|
|
191
|
+
create(input: HubAppCreateInput): Promise<{
|
|
192
|
+
app: HubApp;
|
|
193
|
+
clientSecret: string;
|
|
194
|
+
}>;
|
|
195
|
+
/** Immutable association of two existing records with the same owner. */
|
|
196
|
+
linkOAuthClient(appId: string, clientId: string): Promise<{
|
|
197
|
+
appId: string;
|
|
198
|
+
oauthClientId: string;
|
|
199
|
+
}>;
|
|
200
|
+
revoke(appId: string): Promise<{
|
|
201
|
+
appId: string;
|
|
202
|
+
grantsRevoked: number;
|
|
203
|
+
tokensRevoked: number;
|
|
204
|
+
}>;
|
|
205
|
+
}
|
|
206
|
+
//#endregion
|
|
207
|
+
//#region src/inbound-webhooks.d.ts
|
|
208
|
+
/** Provider setup uses the existing authenticated Hub transport and vault. */
|
|
209
|
+
interface HubInboundWebhookCreateOptions {
|
|
210
|
+
/** Inkbox identity that owns all selected channels. */
|
|
211
|
+
identityId?: string;
|
|
212
|
+
mailboxId?: string;
|
|
213
|
+
phoneNumberId?: string;
|
|
214
|
+
imessage?: boolean;
|
|
215
|
+
/** Linq: explicit owned lines; omitted does not mean every account line. */
|
|
216
|
+
phoneNumbers?: string[];
|
|
217
|
+
/** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
|
|
218
|
+
phoneNumberIds?: string[];
|
|
219
|
+
/** Contiguity Console secret, or an existing Inkbox identity signing key. */
|
|
220
|
+
signingSecret?: string;
|
|
221
|
+
}
|
|
222
|
+
interface HubInboundWebhookCreateResponse {
|
|
223
|
+
url: string;
|
|
224
|
+
/** True only when the provider subscription was created by the server. */
|
|
225
|
+
provisioned?: boolean;
|
|
226
|
+
/** Self-configured legacy providers can return a newly minted secret once. */
|
|
227
|
+
secret?: string;
|
|
228
|
+
inboundAddress?: string;
|
|
229
|
+
requiresProviderSetup?: boolean;
|
|
230
|
+
}
|
|
231
|
+
interface HubInboundWebhookStatus {
|
|
232
|
+
configured: boolean;
|
|
233
|
+
url?: string;
|
|
234
|
+
/** Configuration is not evidence of a real delivered message. */
|
|
235
|
+
deliveryVerified: false;
|
|
236
|
+
requiresProviderSetup?: boolean;
|
|
237
|
+
}
|
|
238
|
+
/** Live provider readback for one explicitly selected Linq WhatsApp number. */
|
|
239
|
+
interface HubInboundPhoneNumberScope {
|
|
240
|
+
configured: true;
|
|
241
|
+
provisioned: true;
|
|
242
|
+
subscribed: true;
|
|
243
|
+
phoneNumberIds: string[];
|
|
244
|
+
}
|
|
245
|
+
declare class HubInboundWebhooksClient {
|
|
246
|
+
private readonly request;
|
|
247
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
|
|
248
|
+
create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
|
|
249
|
+
get(connectionId: string): Promise<HubInboundWebhookStatus>;
|
|
250
|
+
/** Add one owned Linq WhatsApp number without rotating the webhook secret. */
|
|
251
|
+
ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
|
|
252
|
+
/** Remove event subscriptions first. This does not silently rotate a live URL. */
|
|
253
|
+
delete(connectionId: string): Promise<{
|
|
254
|
+
removed: boolean;
|
|
255
|
+
}>;
|
|
256
|
+
private path;
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
1
259
|
//#region src/types.d.ts
|
|
2
260
|
type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
|
|
3
261
|
interface HubSuccessEnvelope<TData> {
|
|
@@ -14,7 +272,7 @@ interface HubErrorBody {
|
|
|
14
272
|
message: string;
|
|
15
273
|
details?: unknown;
|
|
16
274
|
}
|
|
17
|
-
type HubErrorCode = "HUB_UNAUTHENTICATED" | "HUB_FORBIDDEN" | "HUB_INVALID_INPUT" | "HUB_INVALID_STATE" | "HUB_PROVIDER_MISSING" | "HUB_CONNECTION_MISSING" | "HUB_CONNECTION_REVOKED" | "HUB_TOKEN_EXPIRED" | "HUB_TOKEN_REPLAYED" | "HUB_TOKEN_REVOKED" | "HUB_TOKEN_ACTION_MISMATCH" | "HUB_POLICY_DENIED" | "HUB_APPROVAL_REQUIRED" | "HUB_EXECUTOR_FAILURE" | "HUB_PROVIDER_FAILURE" | "HUB_CONFIG_MISSING" | "HUB_CONFIG_INVALID" | "HUB_NOT_FOUND" | "HUB_NOT_IMPLEMENTED" | "HUB_CONFLICT" | "VALIDATION_ERROR" | "WORKFLOW_INVALID" | "NOT_FOUND" | "UNAUTHORIZED" | "CONFLICT" | "MISSING_RUN_INPUTS" | "WORKFLOW_DISABLED" | "PAYLOAD_TOO_LARGE" | "WORKFLOW_RUN_TIMEOUT" | `HUB_HTTP_${number}`;
|
|
275
|
+
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
276
|
interface HubStatusResponse {
|
|
19
277
|
contract: unknown;
|
|
20
278
|
principal: HubPrincipal;
|
|
@@ -36,6 +294,7 @@ interface HubConnection {
|
|
|
36
294
|
providerId: string;
|
|
37
295
|
displayName: string;
|
|
38
296
|
accountDisplay: string | null;
|
|
297
|
+
providerAccountId: string | null;
|
|
39
298
|
scopes: string[];
|
|
40
299
|
status: "active" | "revoked" | "unhealthy" | "reconnect_required";
|
|
41
300
|
health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
|
|
@@ -222,6 +481,7 @@ interface HubOAuthStartRequest {
|
|
|
222
481
|
returnUrl?: string;
|
|
223
482
|
cli?: boolean;
|
|
224
483
|
connectionParameters?: Record<string, string>;
|
|
484
|
+
requestedScopes?: readonly string[];
|
|
225
485
|
}
|
|
226
486
|
interface HubOAuthCallbackSuccessQuery {
|
|
227
487
|
provider: string;
|
|
@@ -282,7 +542,18 @@ interface HubOAuthCallbackResponse {
|
|
|
282
542
|
interface HubApiKeyConnectRequest {
|
|
283
543
|
provider: string;
|
|
284
544
|
apiKey: string;
|
|
545
|
+
/** Connector-owned setup values. Hub validates them before testing the key. */
|
|
546
|
+
metadata?: HubApiKeyConnectionMetadata;
|
|
285
547
|
}
|
|
548
|
+
type HubApiKeyConnectionMetadata = {
|
|
549
|
+
propertyId: string;
|
|
550
|
+
currency?: string;
|
|
551
|
+
} | {
|
|
552
|
+
listings: Array<{
|
|
553
|
+
id: string;
|
|
554
|
+
pms: string;
|
|
555
|
+
}>;
|
|
556
|
+
};
|
|
286
557
|
/** Result of an api-key connect: the created (or reconnected) connection.
|
|
287
558
|
* Synchronous — there is no redirect leg, unlike the OAuth flow. */
|
|
288
559
|
interface HubApiKeyConnectResponse {
|
|
@@ -358,9 +629,18 @@ interface HubExecRequest {
|
|
|
358
629
|
path: string;
|
|
359
630
|
input?: unknown;
|
|
360
631
|
connectionId?: string;
|
|
632
|
+
/** Caller-minted key for this exec. The platform ledger replays the first
|
|
633
|
+
* call's result for a retry that carries the same key, and rejects a key
|
|
634
|
+
* reused for a different request. On the capability-token arm the key only
|
|
635
|
+
* reaches the connector for provider-native dedupe: that arm is at-most-once
|
|
636
|
+
* per token and replays no stored result. */
|
|
637
|
+
idempotencyKey?: string;
|
|
361
638
|
}
|
|
362
639
|
interface HubExecResponse<TResult = unknown> {
|
|
363
640
|
result: TResult;
|
|
641
|
+
/** True when the result was replayed from a previous call with the same
|
|
642
|
+
* idempotency key, so the action did not run again. */
|
|
643
|
+
replayed?: boolean;
|
|
364
644
|
}
|
|
365
645
|
interface HubTokenMintRequest {
|
|
366
646
|
connectionId?: string;
|
|
@@ -518,7 +798,7 @@ interface HubGithubAppInstallation {
|
|
|
518
798
|
accountType: string | null;
|
|
519
799
|
/** "all" ⇒ every repo under the account; "selected" ⇒ only repoFullNames. */
|
|
520
800
|
repositorySelection: "all" | "selected";
|
|
521
|
-
/**
|
|
801
|
+
/** Metadata omits names; use githubApp.listRepos(id) for a live caller-safe list. */
|
|
522
802
|
repoFullNames: string[];
|
|
523
803
|
suspended: boolean;
|
|
524
804
|
}
|
|
@@ -571,8 +851,10 @@ interface HubGithubAppSyncResponse {
|
|
|
571
851
|
}
|
|
572
852
|
interface HubGithubAppListReposResponse {
|
|
573
853
|
installationId: number;
|
|
574
|
-
/**
|
|
854
|
+
/** Complete live intersection of App coverage and the caller's GitHub access. */
|
|
575
855
|
repoFullNames: string[];
|
|
856
|
+
/** True only when both upstream listings completed; failures return an error. */
|
|
857
|
+
complete: true;
|
|
576
858
|
}
|
|
577
859
|
interface HubGithubAppIsRepoInstalledRequest {
|
|
578
860
|
owner: string;
|
|
@@ -1213,6 +1495,284 @@ interface HubWorkflowRunStepsPage {
|
|
|
1213
1495
|
nextCursor: number | null;
|
|
1214
1496
|
}
|
|
1215
1497
|
//#endregion
|
|
1498
|
+
//#region src/lines.d.ts
|
|
1499
|
+
interface HubLineMember {
|
|
1500
|
+
id: string;
|
|
1501
|
+
label: string | null;
|
|
1502
|
+
role: string;
|
|
1503
|
+
self?: boolean;
|
|
1504
|
+
consent?: "enabled" | "required";
|
|
1505
|
+
}
|
|
1506
|
+
interface HubLineContext {
|
|
1507
|
+
self: {
|
|
1508
|
+
id: string;
|
|
1509
|
+
label: string | null;
|
|
1510
|
+
role: string;
|
|
1511
|
+
};
|
|
1512
|
+
line: {
|
|
1513
|
+
id: string;
|
|
1514
|
+
label: string | null;
|
|
1515
|
+
transport: string;
|
|
1516
|
+
};
|
|
1517
|
+
members: HubLineMember[];
|
|
1518
|
+
capabilities: Record<string, {
|
|
1519
|
+
allowed: boolean;
|
|
1520
|
+
reason?: string;
|
|
1521
|
+
}>;
|
|
1522
|
+
pendingReminders: Array<{
|
|
1523
|
+
messageId: string;
|
|
1524
|
+
wakeAt?: string;
|
|
1525
|
+
prompt: string | null;
|
|
1526
|
+
}>;
|
|
1527
|
+
quotas: {
|
|
1528
|
+
selfMessagesToday: number;
|
|
1529
|
+
selfMessagesPerDay: number;
|
|
1530
|
+
selfMessagesPending: number;
|
|
1531
|
+
selfMessagesPendingLimit: number;
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
interface HubLineSendInput {
|
|
1535
|
+
toMember: string;
|
|
1536
|
+
text: string;
|
|
1537
|
+
notBefore?: string;
|
|
1538
|
+
onBehalfOf?: string;
|
|
1539
|
+
idempotencyKey?: string;
|
|
1540
|
+
}
|
|
1541
|
+
interface HubLineOwnerSendInput {
|
|
1542
|
+
memberId: string;
|
|
1543
|
+
text: string;
|
|
1544
|
+
notBefore?: string;
|
|
1545
|
+
idempotencyKey: string;
|
|
1546
|
+
}
|
|
1547
|
+
interface HubLineReminderInput {
|
|
1548
|
+
text: string;
|
|
1549
|
+
notBefore: string;
|
|
1550
|
+
idempotencyKey: string;
|
|
1551
|
+
}
|
|
1552
|
+
interface HubLineApplicationDispatchCurrentInput {
|
|
1553
|
+
attachmentId: string;
|
|
1554
|
+
memberId: string;
|
|
1555
|
+
memberRevision: string;
|
|
1556
|
+
senderAddress: string;
|
|
1557
|
+
textSha256: string;
|
|
1558
|
+
binding: string;
|
|
1559
|
+
dispatchFence: string;
|
|
1560
|
+
dispatchDeadline: string;
|
|
1561
|
+
}
|
|
1562
|
+
interface HubLineMemberApplication {
|
|
1563
|
+
id: string;
|
|
1564
|
+
lineId: string;
|
|
1565
|
+
attachmentId: string;
|
|
1566
|
+
memberId: string;
|
|
1567
|
+
subjectId: string;
|
|
1568
|
+
status: "active" | "revoked";
|
|
1569
|
+
application: {
|
|
1570
|
+
url: string;
|
|
1571
|
+
binding: string;
|
|
1572
|
+
};
|
|
1573
|
+
/** Hub's name for the app at this callback; present on reads. */
|
|
1574
|
+
app?: {
|
|
1575
|
+
name: string;
|
|
1576
|
+
};
|
|
1577
|
+
createdAt: string;
|
|
1578
|
+
revokedAt: string | null;
|
|
1579
|
+
}
|
|
1580
|
+
interface HubLineMemberApplicationInput {
|
|
1581
|
+
expectedSelectionId: string | null;
|
|
1582
|
+
expectedMemberRevision: string;
|
|
1583
|
+
subjectId: string;
|
|
1584
|
+
application: {
|
|
1585
|
+
url: string;
|
|
1586
|
+
binding: string;
|
|
1587
|
+
secret: string;
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
interface HubLineSendReceipt {
|
|
1591
|
+
message: {
|
|
1592
|
+
id: string;
|
|
1593
|
+
status: string;
|
|
1594
|
+
text: string | null;
|
|
1595
|
+
};
|
|
1596
|
+
eligibleAt: string | null;
|
|
1597
|
+
expiresAt: string;
|
|
1598
|
+
}
|
|
1599
|
+
interface HubLineReminderReceipt {
|
|
1600
|
+
state: "queued" | "skipped";
|
|
1601
|
+
lineId: string;
|
|
1602
|
+
messageId?: string;
|
|
1603
|
+
sessionId?: string;
|
|
1604
|
+
completion?: string;
|
|
1605
|
+
reason?: string;
|
|
1606
|
+
}
|
|
1607
|
+
interface HubLineScheduledSendOptions {
|
|
1608
|
+
lineId: string;
|
|
1609
|
+
memberId: string;
|
|
1610
|
+
text: string;
|
|
1611
|
+
timezone: string;
|
|
1612
|
+
name?: string;
|
|
1613
|
+
notBefore?: string;
|
|
1614
|
+
}
|
|
1615
|
+
interface HubLineCheckinOptions {
|
|
1616
|
+
lineId: string;
|
|
1617
|
+
member: string;
|
|
1618
|
+
timezone: string;
|
|
1619
|
+
prompt: string;
|
|
1620
|
+
name?: string;
|
|
1621
|
+
}
|
|
1622
|
+
/** Line calls share HubClient authentication and envelope handling. */
|
|
1623
|
+
declare class HubLinesClient {
|
|
1624
|
+
private readonly request;
|
|
1625
|
+
private readonly createWorkflow;
|
|
1626
|
+
private readonly requestApplicationDispatchCurrent?;
|
|
1627
|
+
readonly members: {
|
|
1628
|
+
list: (lineId: string) => Promise<HubLineMember[]>;
|
|
1629
|
+
};
|
|
1630
|
+
readonly memberApplications: {
|
|
1631
|
+
get: (lineId: string, memberId: string) => Promise<{
|
|
1632
|
+
memberRevision: string;
|
|
1633
|
+
selection: HubLineMemberApplication | null;
|
|
1634
|
+
}>;
|
|
1635
|
+
select: (lineId: string, memberId: string, input: HubLineMemberApplicationInput) => Promise<HubLineMemberApplication>;
|
|
1636
|
+
clear: (lineId: string, memberId: string, input: {
|
|
1637
|
+
expectedSelectionId: string;
|
|
1638
|
+
expectedMemberRevision: string;
|
|
1639
|
+
}) => Promise<void>;
|
|
1640
|
+
};
|
|
1641
|
+
readonly checkins: {
|
|
1642
|
+
schedule: (cron: string, options: HubLineCheckinOptions) => Promise<HubWorkflow>;
|
|
1643
|
+
};
|
|
1644
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>, createWorkflow: (yaml: string) => Promise<HubWorkflow>, requestApplicationDispatchCurrent?: ((path: string, init: RequestInit, callbackBearer: string) => Promise<{
|
|
1645
|
+
current: boolean;
|
|
1646
|
+
}>) | undefined);
|
|
1647
|
+
scheduleSend(cron: string, options: HubLineScheduledSendOptions): Promise<HubWorkflow>;
|
|
1648
|
+
context(): Promise<HubLineContext>;
|
|
1649
|
+
send(lineId: string, input: HubLineSendInput | HubLineOwnerSendInput): Promise<HubLineSendReceipt>;
|
|
1650
|
+
remind(lineId: string, input: HubLineReminderInput): Promise<HubLineReminderReceipt>;
|
|
1651
|
+
applicationDispatchCurrent(lineId: string, messageId: string, input: HubLineApplicationDispatchCurrentInput, callbackBearer: string): Promise<boolean>;
|
|
1652
|
+
}
|
|
1653
|
+
//#endregion
|
|
1654
|
+
//#region src/managed-numbers.d.ts
|
|
1655
|
+
interface HubNumberReadiness {
|
|
1656
|
+
configured: boolean;
|
|
1657
|
+
provider: "inkbox";
|
|
1658
|
+
transports: Array<"sms" | "imessage">;
|
|
1659
|
+
billing: "prepaid_activation";
|
|
1660
|
+
automaticRentalBilling: false;
|
|
1661
|
+
deliveryVerified: false;
|
|
1662
|
+
}
|
|
1663
|
+
interface HubNumberQuote {
|
|
1664
|
+
transport: "sms" | "imessage";
|
|
1665
|
+
activationCents: number;
|
|
1666
|
+
currency: "usd";
|
|
1667
|
+
termsVersion: string;
|
|
1668
|
+
terms: string;
|
|
1669
|
+
expiresAt: number;
|
|
1670
|
+
/** The binding the quote was issued for. Absent from older servers. */
|
|
1671
|
+
clientReference?: string;
|
|
1672
|
+
/** Opaque. Pass it back to `create`; never decode it. */
|
|
1673
|
+
token: string;
|
|
1674
|
+
}
|
|
1675
|
+
/** One page of the owner's orders, newest first. */
|
|
1676
|
+
interface HubNumberOrderPage {
|
|
1677
|
+
orders: HubNumberOrder[];
|
|
1678
|
+
/** Present while more orders exist. Older servers omit it and return one
|
|
1679
|
+
* bounded page, so an absent cursor never proves an order does not exist. */
|
|
1680
|
+
nextCursor?: string | null;
|
|
1681
|
+
}
|
|
1682
|
+
interface HubNumberListQuery {
|
|
1683
|
+
/** Only orders requested for this binding, including closed ones. */
|
|
1684
|
+
clientReference?: string;
|
|
1685
|
+
cursor?: string;
|
|
1686
|
+
/** 1 to 100; the server default is 100. */
|
|
1687
|
+
limit?: number;
|
|
1688
|
+
}
|
|
1689
|
+
/** An operator's terminal decision on an order stuck in `needs_review`.
|
|
1690
|
+
* Read-only for a creator: the resolution is made through the platform's
|
|
1691
|
+
* admin surface, never through this client. */
|
|
1692
|
+
interface HubNumberResolution {
|
|
1693
|
+
action: "release" | "settle" | "abandon";
|
|
1694
|
+
operator: string;
|
|
1695
|
+
reason: string;
|
|
1696
|
+
at: number;
|
|
1697
|
+
/** Present while the operator's action is still running. The decision is
|
|
1698
|
+
* not final and the order can still return to review. */
|
|
1699
|
+
pending?: true;
|
|
1700
|
+
/** Present when a `settle` handed a live, unfinished order back to
|
|
1701
|
+
* provisioning, so the order is working again rather than closed. */
|
|
1702
|
+
requeued?: true;
|
|
1703
|
+
}
|
|
1704
|
+
interface HubNumberOrder {
|
|
1705
|
+
id: string;
|
|
1706
|
+
clientReference: string;
|
|
1707
|
+
transport: "sms" | "imessage";
|
|
1708
|
+
status: "pending" | "provider_pending" | "needs_review" | "ready_for_setup" | "cancelled";
|
|
1709
|
+
phase: "identity" | "number" | "credential" | "connection" | "complete";
|
|
1710
|
+
address: string | null;
|
|
1711
|
+
connectionId: string | null;
|
|
1712
|
+
identityId: string | null;
|
|
1713
|
+
providerNumberId: string | null;
|
|
1714
|
+
billingStatus: "unreserved" | "reserved" | "settled" | "released";
|
|
1715
|
+
cancellation: "none" | "requested" | "needs_review" | "released" | "abandoned";
|
|
1716
|
+
errorCode: string | null;
|
|
1717
|
+
nextAttemptAt: number | null;
|
|
1718
|
+
resolution: HubNumberResolution | null;
|
|
1719
|
+
deliveryVerified: false;
|
|
1720
|
+
activationCents: number;
|
|
1721
|
+
currency: "usd";
|
|
1722
|
+
terms: string;
|
|
1723
|
+
}
|
|
1724
|
+
/** Administrative number operations through Hub's authenticated transport.
|
|
1725
|
+
* A mutation is one attempt; an uncertain create reuses its quote and reference. */
|
|
1726
|
+
declare class HubManagedNumbersClient {
|
|
1727
|
+
private readonly request;
|
|
1728
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
|
|
1729
|
+
readiness(): Promise<HubNumberReadiness>;
|
|
1730
|
+
/** One page of orders. Scope by `clientReference` to ask about one binding,
|
|
1731
|
+
* and follow `nextCursor` for the rest; a page is never ownership evidence. */
|
|
1732
|
+
list(query?: HubNumberListQuery): Promise<HubNumberOrderPage>;
|
|
1733
|
+
get(id: string): Promise<{
|
|
1734
|
+
order: HubNumberOrder;
|
|
1735
|
+
}>;
|
|
1736
|
+
quote(input: {
|
|
1737
|
+
transport: "sms" | "imessage";
|
|
1738
|
+
clientReference: string;
|
|
1739
|
+
}): Promise<{
|
|
1740
|
+
quote: HubNumberQuote;
|
|
1741
|
+
}>;
|
|
1742
|
+
/** `clientReference` and `transport`, when given, must match the signed
|
|
1743
|
+
* quote or Hub refuses the purchase with a conflict. */
|
|
1744
|
+
create(input: {
|
|
1745
|
+
quoteToken: string;
|
|
1746
|
+
consent: true;
|
|
1747
|
+
state?: string;
|
|
1748
|
+
clientReference?: string;
|
|
1749
|
+
transport?: "sms" | "imessage";
|
|
1750
|
+
}): Promise<{
|
|
1751
|
+
order: HubNumberOrder;
|
|
1752
|
+
}>;
|
|
1753
|
+
/** Fences references so no order can take them again. Call it as the last
|
|
1754
|
+
* step before retiring the resource they name: a purchase that races the
|
|
1755
|
+
* retirement is then refused (`409 number_reference_fenced`) instead of
|
|
1756
|
+
* binding a line to a resource that is gone. Refused with
|
|
1757
|
+
* `409 number_reference_held` while a live order holds one of them; cancel
|
|
1758
|
+
* it first. A cancelled order no longer holds its reference, so the fence
|
|
1759
|
+
* succeeds as soon as `cancel` returns, whether or not its release is still
|
|
1760
|
+
* pending. Repeating a fence is harmless. */
|
|
1761
|
+
fence(input: {
|
|
1762
|
+
clientReferences: string[];
|
|
1763
|
+
}): Promise<{
|
|
1764
|
+
clientReferences: string[];
|
|
1765
|
+
}>;
|
|
1766
|
+
advance(id: string): Promise<{
|
|
1767
|
+
order: HubNumberOrder;
|
|
1768
|
+
}>;
|
|
1769
|
+
cancel(id: string): Promise<{
|
|
1770
|
+
order: HubNumberOrder;
|
|
1771
|
+
}>;
|
|
1772
|
+
private path;
|
|
1773
|
+
private post;
|
|
1774
|
+
}
|
|
1775
|
+
//#endregion
|
|
1216
1776
|
//#region src/client.d.ts
|
|
1217
1777
|
type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
|
|
1218
1778
|
interface HubClientOptions {
|
|
@@ -1241,13 +1801,24 @@ interface HubClientFromEnvOptions {
|
|
|
1241
1801
|
}
|
|
1242
1802
|
declare function resolveHubBaseUrl(env?: HubEnv): string;
|
|
1243
1803
|
declare function resolveHubAuth(env?: HubEnv): string;
|
|
1244
|
-
declare class
|
|
1804
|
+
declare class HubTransport {
|
|
1245
1805
|
readonly baseUrl: string;
|
|
1246
1806
|
readonly fetch: typeof fetch;
|
|
1247
1807
|
readonly apiKey?: string;
|
|
1248
1808
|
readonly authHeaders?: HubAuthHeaders;
|
|
1809
|
+
constructor(options: HubClientOptions);
|
|
1810
|
+
protected request<TData>(path: string, init: RequestInit, options?: {
|
|
1811
|
+
auth?: "client" | "caller";
|
|
1812
|
+
validateData?: (data: unknown) => data is TData;
|
|
1813
|
+
}): Promise<TData>;
|
|
1814
|
+
protected buildHeaders(headers: HeadersInit | undefined, callerAuth?: boolean): Promise<Headers>;
|
|
1815
|
+
}
|
|
1816
|
+
declare class HubClient extends HubTransport {
|
|
1817
|
+
readonly allowances: HubAllowancesClient;
|
|
1818
|
+
readonly apps: HubAppsClient;
|
|
1249
1819
|
readonly connections: HubConnectionsClient;
|
|
1250
1820
|
readonly channels: HubChannelsClient;
|
|
1821
|
+
readonly numbers: HubManagedNumbersClient;
|
|
1251
1822
|
readonly eventSubscriptions: HubEventSubscriptionsClient;
|
|
1252
1823
|
readonly permissions: HubPermissionsClient;
|
|
1253
1824
|
readonly tokens: HubTokensClient;
|
|
@@ -1256,10 +1827,10 @@ declare class HubClient {
|
|
|
1256
1827
|
readonly audit: HubAuditClient;
|
|
1257
1828
|
readonly githubApp: HubGithubAppClient;
|
|
1258
1829
|
readonly workflows: HubWorkflowsClient;
|
|
1830
|
+
readonly lines: HubLinesClient;
|
|
1259
1831
|
constructor(options: HubClientOptions);
|
|
1260
1832
|
static fromEnv(options?: HubClientFromEnvOptions): HubClient;
|
|
1261
1833
|
status(): Promise<HubStatusResponse>;
|
|
1262
|
-
private request;
|
|
1263
1834
|
/**
|
|
1264
1835
|
* Open a streaming (Server-Sent Events) response and return its raw body.
|
|
1265
1836
|
* Shares auth-header building + `fetch` with {@link request}, but does NOT
|
|
@@ -1280,7 +1851,6 @@ declare class HubClient {
|
|
|
1280
1851
|
* otherwise an `HUB_HTTP_<status>` transport error.
|
|
1281
1852
|
*/
|
|
1282
1853
|
private requestBytes;
|
|
1283
|
-
private buildHeaders;
|
|
1284
1854
|
}
|
|
1285
1855
|
interface HubTokenListOptions {
|
|
1286
1856
|
includeExpired?: boolean;
|
|
@@ -1325,6 +1895,13 @@ interface HubToolSearchOptions {
|
|
|
1325
1895
|
interface HubToolInvokeOptions {
|
|
1326
1896
|
connectionId?: string;
|
|
1327
1897
|
approve?: boolean;
|
|
1898
|
+
/** Caller-minted key for this invoke. On the direct exec arm the platform
|
|
1899
|
+
* ledger replays the first call's result for a retry that carries the same
|
|
1900
|
+
* key, and refuses a key bound to a different request. The approval and
|
|
1901
|
+
* capability-token retries re-send the key, and the connector receives it
|
|
1902
|
+
* for provider-native dedupe. Capability-token execution stays at-most-once
|
|
1903
|
+
* per token: it refuses a replay instead of replaying a stored result. */
|
|
1904
|
+
idempotencyKey?: string;
|
|
1328
1905
|
}
|
|
1329
1906
|
declare class HubToolsClient {
|
|
1330
1907
|
private readonly request;
|
|
@@ -1332,13 +1909,20 @@ declare class HubToolsClient {
|
|
|
1332
1909
|
search(query: string, options?: HubToolSearchOptions): Promise<HubToolsSearchResponse>;
|
|
1333
1910
|
sources(): Promise<HubToolSourcesResponse>;
|
|
1334
1911
|
describe(path: string): Promise<HubToolsDescribeResponse>;
|
|
1335
|
-
|
|
1912
|
+
/**
|
|
1913
|
+
* Run one hub tool. `raw` is the tool input: the SDK forwards it verbatim as
|
|
1914
|
+
* the request body's `input`, and the server validates it against the tool's
|
|
1915
|
+
* own schema, so the client never gives it a shape.
|
|
1916
|
+
*/
|
|
1917
|
+
invoke<TResult = unknown>(path: string, raw: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
|
|
1336
1918
|
private buildExecInit;
|
|
1337
1919
|
}
|
|
1338
1920
|
interface HubConnectionStartOptions {
|
|
1339
1921
|
returnUrl?: string;
|
|
1340
1922
|
cli?: boolean;
|
|
1341
1923
|
connectionParameters?: Record<string, string>;
|
|
1924
|
+
/** GitHub accepts the exact read:user, repo, read:org set. */
|
|
1925
|
+
requestedScopes?: readonly string[];
|
|
1342
1926
|
}
|
|
1343
1927
|
declare class HubChannelsClient {
|
|
1344
1928
|
private readonly request;
|
|
@@ -1356,6 +1940,7 @@ declare class HubEventSubscriptionsClient {
|
|
|
1356
1940
|
}
|
|
1357
1941
|
declare class HubConnectionsClient {
|
|
1358
1942
|
private readonly request;
|
|
1943
|
+
readonly inboundWebhook: HubInboundWebhooksClient;
|
|
1359
1944
|
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
1360
1945
|
list(): Promise<HubConnectionsResponse>;
|
|
1361
1946
|
/** Connector catalog: every provider the hub can expose, each flagged with
|
|
@@ -1368,8 +1953,9 @@ declare class HubConnectionsClient {
|
|
|
1368
1953
|
/** Connect a non-OAuth (api-key) connector by submitting the user's key.
|
|
1369
1954
|
* The server validates the key with a live probe before persisting and
|
|
1370
1955
|
* returns the created (or reconnected) connection — there is no redirect,
|
|
1371
|
-
* unlike `start`.
|
|
1372
|
-
|
|
1956
|
+
* unlike `start`. Cloudbeds requires propertyId metadata and PriceLabs
|
|
1957
|
+
* requires listing ID/PMS pairs; other providers have no metadata. */
|
|
1958
|
+
connectApiKey(provider: string, apiKey: string, metadata?: HubApiKeyConnectRequest["metadata"]): Promise<HubApiKeyConnectResponse>;
|
|
1373
1959
|
revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
|
|
1374
1960
|
health(connectionId: string): Promise<HubConnectionHealthResponse>;
|
|
1375
1961
|
}
|
|
@@ -1651,15 +2237,18 @@ declare class HubWorkflowsClient {
|
|
|
1651
2237
|
/**
|
|
1652
2238
|
* Upsert a key; returns the entry with its NEW version (increments on every
|
|
1653
2239
|
* write). Throws `HubSdkError(KV_VALUE_TOO_LARGE)` past the 64KiB value cap
|
|
1654
|
-
* or `KV_KEY_LIMIT` past the per-workflow key cap.
|
|
2240
|
+
* or `KV_KEY_LIMIT` past the per-workflow key cap. `raw` is the caller's
|
|
2241
|
+
* value, stored and read back verbatim, so the client never gives it a shape.
|
|
1655
2242
|
*/
|
|
1656
|
-
putKv(id: string, key: string,
|
|
2243
|
+
putKv(id: string, key: string, raw: unknown): Promise<HubWorkflowKvEntry>;
|
|
1657
2244
|
/**
|
|
1658
2245
|
* Compare-and-swap: the write lands only when the stored version still
|
|
1659
2246
|
* equals `expectedVersion`; otherwise `HubSdkError(KV_VERSION_CONFLICT)`
|
|
1660
|
-
* (409) — re-read and retry. Creation is {@link putKv}'s job.
|
|
2247
|
+
* (409) — re-read and retry. Creation is {@link putKv}'s job. `raw` is the
|
|
2248
|
+
* caller's value, stored and read back verbatim, so the client never gives it
|
|
2249
|
+
* a shape.
|
|
1661
2250
|
*/
|
|
1662
|
-
casKv(id: string, key: string, expectedVersion: number,
|
|
2251
|
+
casKv(id: string, key: string, expectedVersion: number, raw: unknown): Promise<HubWorkflowKvEntry>;
|
|
1663
2252
|
/** Delete a key; idempotent — `deleted` reports whether a row was removed. */
|
|
1664
2253
|
deleteKv(id: string, key: string): Promise<HubWorkflowKvDeleteResponse>;
|
|
1665
2254
|
/** The curated starter gallery runnable on THIS deployment: metadata,
|
|
@@ -1785,8 +2374,157 @@ declare function authenticateHubEventRequest(input: AuthenticateHubEventRequestI
|
|
|
1785
2374
|
declare function verifyHubEventSignature(input: VerifyHubEventSignatureInput): Promise<HubEventSignatureResult>;
|
|
1786
2375
|
declare function parseHubEventDelivery(input: string | unknown): HubEventDelivery;
|
|
1787
2376
|
//#endregion
|
|
2377
|
+
//#region src/line-grants.d.ts
|
|
2378
|
+
interface HubLineGrantBinding {
|
|
2379
|
+
workspaceId: string;
|
|
2380
|
+
workspaceAgentId: string;
|
|
2381
|
+
}
|
|
2382
|
+
interface HubLineGrant {
|
|
2383
|
+
id: string;
|
|
2384
|
+
lineId: string;
|
|
2385
|
+
connectionId: string;
|
|
2386
|
+
workspaceId: string;
|
|
2387
|
+
workspaceAgentId: string;
|
|
2388
|
+
agentProfileVersion: string;
|
|
2389
|
+
backendSha256: string;
|
|
2390
|
+
attachmentId: string | null;
|
|
2391
|
+
intakeMode: "guests" | "owner_only";
|
|
2392
|
+
/** "application" grants select the app's callback for the owner member instead of attaching. */
|
|
2393
|
+
execution: "backend" | "application";
|
|
2394
|
+
applicationOrigin: string | null;
|
|
2395
|
+
priorAttachmentId: string | null;
|
|
2396
|
+
priorAttachmentActive: boolean;
|
|
2397
|
+
monthlyBudgetUsd: number;
|
|
2398
|
+
monthlySpentUsd: number;
|
|
2399
|
+
}
|
|
2400
|
+
interface HubLineGrantLine {
|
|
2401
|
+
id: string;
|
|
2402
|
+
connectionId: string;
|
|
2403
|
+
transport: "sms" | "imessage";
|
|
2404
|
+
status: string;
|
|
2405
|
+
address: string | null;
|
|
2406
|
+
attachment: {
|
|
2407
|
+
id: string;
|
|
2408
|
+
sandboxId: string;
|
|
2409
|
+
status: string;
|
|
2410
|
+
} | null;
|
|
2411
|
+
}
|
|
2412
|
+
interface HubLineGrantAttachInput {
|
|
2413
|
+
workspaceAgentId: string;
|
|
2414
|
+
agentProfileVersion: string;
|
|
2415
|
+
renewalCode?: string;
|
|
2416
|
+
respond: {
|
|
2417
|
+
kind: "agent";
|
|
2418
|
+
backend: Record<string, unknown>;
|
|
2419
|
+
};
|
|
2420
|
+
}
|
|
2421
|
+
interface HubLineGrantAttachment {
|
|
2422
|
+
id: string;
|
|
2423
|
+
sandboxId: string;
|
|
2424
|
+
status: string;
|
|
2425
|
+
members?: Array<{
|
|
2426
|
+
id: string;
|
|
2427
|
+
role: string;
|
|
2428
|
+
}>;
|
|
2429
|
+
}
|
|
2430
|
+
interface HubLineGrantThread {
|
|
2431
|
+
id: string;
|
|
2432
|
+
lineId: string;
|
|
2433
|
+
attachmentId: string;
|
|
2434
|
+
}
|
|
2435
|
+
interface HubLineGrantMessage {
|
|
2436
|
+
id: string;
|
|
2437
|
+
threadId: string;
|
|
2438
|
+
direction: string;
|
|
2439
|
+
text: string | null;
|
|
2440
|
+
}
|
|
2441
|
+
/** The consented owner member on the owner's current attachment. */
|
|
2442
|
+
interface HubLineGrantMemberApplication {
|
|
2443
|
+
lineId: string;
|
|
2444
|
+
attachmentId: string;
|
|
2445
|
+
memberId: string;
|
|
2446
|
+
subjectId: string;
|
|
2447
|
+
/** Pass back unchanged as `expectedMemberRevision`. */
|
|
2448
|
+
memberRevision: string;
|
|
2449
|
+
/** False until the owner has texted the line and Hub recorded consent. */
|
|
2450
|
+
eligible: boolean;
|
|
2451
|
+
/** Hub-derived; every callback for this grant carries it. */
|
|
2452
|
+
binding: string;
|
|
2453
|
+
selection: {
|
|
2454
|
+
id: string; /** True when this grant's callback is the selected application. */
|
|
2455
|
+
own: boolean;
|
|
2456
|
+
/**
|
|
2457
|
+
* Hub's name for the app that answers the owner's texts, shown to the
|
|
2458
|
+
* owner in every app they consented on this line: a registered app's
|
|
2459
|
+
* name, or "Another app" when Hub has none. Absent before Platform named
|
|
2460
|
+
* selection holders.
|
|
2461
|
+
*/
|
|
2462
|
+
app?: {
|
|
2463
|
+
name: string;
|
|
2464
|
+
}; /** When the current app started answering. */
|
|
2465
|
+
selectedAt?: string; /** This app's own callback; never returned for another app. */
|
|
2466
|
+
url?: string;
|
|
2467
|
+
createdAt?: string;
|
|
2468
|
+
} | null;
|
|
2469
|
+
}
|
|
2470
|
+
interface HubLineGrantSelectApplicationInput {
|
|
2471
|
+
/** The current selection exactly as read. */
|
|
2472
|
+
expectedSelectionId: string | null;
|
|
2473
|
+
/**
|
|
2474
|
+
* Set only when the owner chose to move their texts here from the app shown
|
|
2475
|
+
* in `selection.app`: that selection's id, also passed as
|
|
2476
|
+
* `expectedSelectionId`. Without it Hub never replaces another app.
|
|
2477
|
+
*/
|
|
2478
|
+
replaceSelectionId?: string;
|
|
2479
|
+
expectedMemberRevision: string;
|
|
2480
|
+
/** HTTPS callback on the owner-approved application origin. */
|
|
2481
|
+
url: string;
|
|
2482
|
+
/** Bearer Hub sends to the callback; 32-512 printable ASCII characters. */
|
|
2483
|
+
secret: string;
|
|
2484
|
+
}
|
|
2485
|
+
interface HubLineGrantApplicationSelection {
|
|
2486
|
+
id: string;
|
|
2487
|
+
lineId: string;
|
|
2488
|
+
attachmentId: string;
|
|
2489
|
+
memberId: string;
|
|
2490
|
+
subjectId: string;
|
|
2491
|
+
status: string;
|
|
2492
|
+
application: {
|
|
2493
|
+
url: string;
|
|
2494
|
+
binding: string;
|
|
2495
|
+
};
|
|
2496
|
+
createdAt: string;
|
|
2497
|
+
revokedAt: string | null;
|
|
2498
|
+
}
|
|
2499
|
+
/** Every call uses HubTransport's authHeaders, so one-use app broker tokens can be minted per request. */
|
|
2500
|
+
declare class HubLineGrantsClient extends HubTransport {
|
|
2501
|
+
current(binding: HubLineGrantBinding): Promise<HubLineGrant>;
|
|
2502
|
+
line(binding: HubLineGrantBinding): Promise<HubLineGrantLine>;
|
|
2503
|
+
attach(binding: HubLineGrantBinding, input: HubLineGrantAttachInput): Promise<HubLineGrantAttachment>;
|
|
2504
|
+
detach(binding: HubLineGrantBinding): Promise<{
|
|
2505
|
+
detached: boolean;
|
|
2506
|
+
}>;
|
|
2507
|
+
threads(binding: HubLineGrantBinding): Promise<HubLineGrantThread[]>;
|
|
2508
|
+
messages(binding: HubLineGrantBinding, threadId: string): Promise<HubLineGrantMessage[]>;
|
|
2509
|
+
memberApplication(binding: HubLineGrantBinding): Promise<HubLineGrantMemberApplication>;
|
|
2510
|
+
/**
|
|
2511
|
+
* Route the owner's texts to this app's callback; the incumbent attachment
|
|
2512
|
+
* stays. `replaceSelectionId` moves them from another app on the owner's
|
|
2513
|
+
* explicit choice.
|
|
2514
|
+
*/
|
|
2515
|
+
selectApplication(binding: HubLineGrantBinding, input: HubLineGrantSelectApplicationInput): Promise<HubLineGrantApplicationSelection>;
|
|
2516
|
+
/** Return the owner's texts to the incumbent attachment. */
|
|
2517
|
+
clearApplication(binding: HubLineGrantBinding, input: {
|
|
2518
|
+
expectedSelectionId: string;
|
|
2519
|
+
expectedMemberRevision: string;
|
|
2520
|
+
}): Promise<void>;
|
|
2521
|
+
revoke(binding: HubLineGrantBinding): Promise<{
|
|
2522
|
+
revoked: boolean;
|
|
2523
|
+
}>;
|
|
2524
|
+
}
|
|
2525
|
+
//#endregion
|
|
1788
2526
|
//#region src/redaction.d.ts
|
|
1789
2527
|
declare function redactHubValue(value: unknown): unknown;
|
|
1790
2528
|
//#endregion
|
|
1791
|
-
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 };
|
|
2529
|
+
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, 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, 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 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, type VerifyHubEventSignatureInput, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
|
|
1792
2530
|
//# sourceMappingURL=index.d.ts.map
|