@tangle-network/hub-sdk 0.2.2 → 0.4.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 +98 -2
- package/dist/index.d.ts +701 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +780 -7
- package/dist/index.js.map +1 -1
- package/package.json +11 -3
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ interface HubErrorBody {
|
|
|
14
14
|
message: string;
|
|
15
15
|
details?: unknown;
|
|
16
16
|
}
|
|
17
|
-
type HubErrorCode = "HUB_UNAUTHENTICATED" | "HUB_FORBIDDEN" | "HUB_INVALID_INPUT" | "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"
|
|
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}`;
|
|
18
18
|
interface HubStatusResponse {
|
|
19
19
|
contract: unknown;
|
|
20
20
|
principal: HubPrincipal;
|
|
@@ -46,6 +46,165 @@ interface HubConnection {
|
|
|
46
46
|
interface HubConnectionsResponse {
|
|
47
47
|
connections: HubConnection[];
|
|
48
48
|
}
|
|
49
|
+
interface HubEmailChannel {
|
|
50
|
+
id: string;
|
|
51
|
+
kind: "email";
|
|
52
|
+
providerId: "email";
|
|
53
|
+
connectionId: string;
|
|
54
|
+
clientReference: string | null;
|
|
55
|
+
label: string | null;
|
|
56
|
+
address: string;
|
|
57
|
+
status: "active";
|
|
58
|
+
createdAt: string;
|
|
59
|
+
updatedAt: string;
|
|
60
|
+
}
|
|
61
|
+
type HubChannel = HubEmailChannel;
|
|
62
|
+
interface HubChannelsResponse {
|
|
63
|
+
channels: HubChannel[];
|
|
64
|
+
}
|
|
65
|
+
interface HubEmailChannelCreateRequest {
|
|
66
|
+
/**
|
|
67
|
+
* Product-owned idempotency key. Retrying the same request returns the
|
|
68
|
+
* original mailbox instead of provisioning another address.
|
|
69
|
+
*/
|
|
70
|
+
clientReference?: string;
|
|
71
|
+
label?: string;
|
|
72
|
+
}
|
|
73
|
+
interface HubChannelCreateResponse {
|
|
74
|
+
channel: HubChannel;
|
|
75
|
+
/** True only when this request created the channel. */
|
|
76
|
+
created: boolean;
|
|
77
|
+
}
|
|
78
|
+
interface HubChannelDeleteResponse {
|
|
79
|
+
removed: true;
|
|
80
|
+
}
|
|
81
|
+
type HubEventConditionScalar = string | number | boolean | null;
|
|
82
|
+
type HubEventCondition = {
|
|
83
|
+
path: string;
|
|
84
|
+
op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
|
|
85
|
+
value?: HubEventConditionScalar | HubEventConditionScalar[];
|
|
86
|
+
} | {
|
|
87
|
+
all: HubEventCondition[];
|
|
88
|
+
} | {
|
|
89
|
+
any: HubEventCondition[];
|
|
90
|
+
} | {
|
|
91
|
+
not: HubEventCondition;
|
|
92
|
+
};
|
|
93
|
+
interface HubEventSubscriptionFilter {
|
|
94
|
+
action?: string;
|
|
95
|
+
repo?: string;
|
|
96
|
+
when?: HubEventCondition;
|
|
97
|
+
}
|
|
98
|
+
type HubEventSubscriptionSource = {
|
|
99
|
+
type: "channel";
|
|
100
|
+
channelId: string;
|
|
101
|
+
} | {
|
|
102
|
+
type: "connection";
|
|
103
|
+
connectionId: string;
|
|
104
|
+
};
|
|
105
|
+
interface HubEventSubscriptionCallback {
|
|
106
|
+
url: string;
|
|
107
|
+
secret: string;
|
|
108
|
+
}
|
|
109
|
+
interface HubEventSubscriptionCreateRequest {
|
|
110
|
+
/**
|
|
111
|
+
* Product-owned idempotency key. Reusing it with the same source and filter
|
|
112
|
+
* returns the existing subscription; reusing it for different input fails.
|
|
113
|
+
*/
|
|
114
|
+
clientReference: string;
|
|
115
|
+
label?: string;
|
|
116
|
+
source: HubEventSubscriptionSource;
|
|
117
|
+
event: string;
|
|
118
|
+
filter?: HubEventSubscriptionFilter;
|
|
119
|
+
callback: HubEventSubscriptionCallback;
|
|
120
|
+
}
|
|
121
|
+
interface HubEventSubscription {
|
|
122
|
+
id: string;
|
|
123
|
+
clientReference: string;
|
|
124
|
+
label: string | null;
|
|
125
|
+
source: HubEventSubscriptionSource;
|
|
126
|
+
providerId: string;
|
|
127
|
+
connectionId: string;
|
|
128
|
+
event: string;
|
|
129
|
+
filter: HubEventSubscriptionFilter;
|
|
130
|
+
workflowId: string;
|
|
131
|
+
status: "active" | "error";
|
|
132
|
+
lastError: string | null;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
updatedAt: string;
|
|
135
|
+
}
|
|
136
|
+
interface HubEventSubscriptionsResponse {
|
|
137
|
+
subscriptions: HubEventSubscription[];
|
|
138
|
+
}
|
|
139
|
+
interface HubEventSubscriptionCreateResponse {
|
|
140
|
+
subscription: HubEventSubscription;
|
|
141
|
+
/** True only when this request created the subscription; false on idempotent reuse. */
|
|
142
|
+
created: boolean;
|
|
143
|
+
}
|
|
144
|
+
interface HubEventSubscriptionDeleteResponse {
|
|
145
|
+
removed: true;
|
|
146
|
+
}
|
|
147
|
+
interface HubProviderEvent {
|
|
148
|
+
provider: string;
|
|
149
|
+
connectionId: string;
|
|
150
|
+
type: string;
|
|
151
|
+
action?: string;
|
|
152
|
+
repo?: string;
|
|
153
|
+
deliveryId?: string;
|
|
154
|
+
payload: unknown;
|
|
155
|
+
}
|
|
156
|
+
interface HubEventDelivery {
|
|
157
|
+
subscriptionId: string;
|
|
158
|
+
workflowId: string;
|
|
159
|
+
runId: string;
|
|
160
|
+
source: {
|
|
161
|
+
kind: "channel" | "connection";
|
|
162
|
+
id: string;
|
|
163
|
+
provider: string;
|
|
164
|
+
event: string;
|
|
165
|
+
};
|
|
166
|
+
providerEvent: HubProviderEvent;
|
|
167
|
+
firedAt: string;
|
|
168
|
+
}
|
|
169
|
+
/** A connector's auth model. */
|
|
170
|
+
type HubProviderAuthKind = "oauth2" | "api_key" | "none" | "custom";
|
|
171
|
+
interface HubProvider {
|
|
172
|
+
providerId: string;
|
|
173
|
+
title: string;
|
|
174
|
+
/** The connector's auth model. */
|
|
175
|
+
authKind: HubProviderAuthKind;
|
|
176
|
+
/** For api-key connectors, the manifest's free-text hint shown when
|
|
177
|
+
* collecting the key (e.g. "Paste your Airtable personal access token");
|
|
178
|
+
* null for OAuth/native providers that don't collect a key inline. */
|
|
179
|
+
authHint: string | null;
|
|
180
|
+
category: string;
|
|
181
|
+
scopes: string[];
|
|
182
|
+
/** Actions + trigger events combined (legacy census; prefer the split
|
|
183
|
+
* counts below when present). */
|
|
184
|
+
capabilityCount: number;
|
|
185
|
+
/** Actions callable via `integration.invoke`. Absent on older servers, and
|
|
186
|
+
* for native GitHub when the executor catalog is unavailable. */
|
|
187
|
+
actionCount?: number;
|
|
188
|
+
/** Trigger events the connector delivers (not invokable). Absent on older
|
|
189
|
+
* servers. */
|
|
190
|
+
triggerCount?: number;
|
|
191
|
+
/** True for the native GitHub path; false for substrate-bundled connectors. */
|
|
192
|
+
native: boolean;
|
|
193
|
+
/** True when the provider's OAuth app credentials are wired, i.e. a connect
|
|
194
|
+
* flow can actually start. UIs offer Connect only for configured providers. */
|
|
195
|
+
configured: boolean;
|
|
196
|
+
/**
|
|
197
|
+
* True when this deployment can receive this provider's inbound events.
|
|
198
|
+
* This is separate from `configured`: OAuth can be ready while the shared
|
|
199
|
+
* webhook secret or bot identity is still absent.
|
|
200
|
+
*/
|
|
201
|
+
eventIngressConfigured?: boolean;
|
|
202
|
+
}
|
|
203
|
+
interface HubProvidersResponse {
|
|
204
|
+
providers: HubProvider[];
|
|
205
|
+
/** Count of substrate-bundled connector manifests behind this catalog. */
|
|
206
|
+
substrateBundled: number;
|
|
207
|
+
}
|
|
49
208
|
interface HubOAuthStartRequest {
|
|
50
209
|
provider: string;
|
|
51
210
|
returnUrl?: string;
|
|
@@ -72,12 +231,51 @@ interface HubOAuthStartResponse {
|
|
|
72
231
|
scopes: string[];
|
|
73
232
|
cli: boolean;
|
|
74
233
|
}
|
|
234
|
+
interface HubWhatsappEmbeddedSignupStartRequest {
|
|
235
|
+
returnUrl?: string;
|
|
236
|
+
}
|
|
237
|
+
interface HubWhatsappEmbeddedSignupStartResponse {
|
|
238
|
+
provider: "whatsapp-business";
|
|
239
|
+
appId: string;
|
|
240
|
+
configId: string;
|
|
241
|
+
sdkVersion: string;
|
|
242
|
+
state: string;
|
|
243
|
+
expiresAt: string;
|
|
244
|
+
scopes: string[];
|
|
245
|
+
}
|
|
246
|
+
interface HubWhatsappEmbeddedSignupCompleteRequest {
|
|
247
|
+
code: string;
|
|
248
|
+
state: string;
|
|
249
|
+
wabaId: string;
|
|
250
|
+
phoneNumberId: string;
|
|
251
|
+
businessId?: string;
|
|
252
|
+
flowEvent?: string;
|
|
253
|
+
}
|
|
254
|
+
interface HubWhatsappEmbeddedSignupCompleteResponse {
|
|
255
|
+
connectionId: string;
|
|
256
|
+
provider: "whatsapp-business";
|
|
257
|
+
reconnected: boolean;
|
|
258
|
+
connection: HubConnection | null;
|
|
259
|
+
}
|
|
75
260
|
interface HubOAuthCallbackResponse {
|
|
76
261
|
connectionId: string;
|
|
77
262
|
provider: string;
|
|
78
263
|
cli: boolean;
|
|
79
264
|
reconnected: boolean;
|
|
80
265
|
}
|
|
266
|
+
/** Connect a non-OAuth (api-key) connector by submitting the user's key. The
|
|
267
|
+
* server validates the key with a live probe before persisting; `provider` is
|
|
268
|
+
* carried in the path, `apiKey` in the body. */
|
|
269
|
+
interface HubApiKeyConnectRequest {
|
|
270
|
+
provider: string;
|
|
271
|
+
apiKey: string;
|
|
272
|
+
}
|
|
273
|
+
/** Result of an api-key connect: the created (or reconnected) connection.
|
|
274
|
+
* Synchronous — there is no redirect leg, unlike the OAuth flow. */
|
|
275
|
+
interface HubApiKeyConnectResponse {
|
|
276
|
+
connection: HubConnection;
|
|
277
|
+
reconnected: boolean;
|
|
278
|
+
}
|
|
81
279
|
interface HubConnectionDeleteRequest {
|
|
82
280
|
connectionId: string;
|
|
83
281
|
}
|
|
@@ -110,6 +308,10 @@ interface HubToolSource {
|
|
|
110
308
|
health: "healthy" | "unhealthy" | "rate_limited" | "unknown";
|
|
111
309
|
configured: boolean;
|
|
112
310
|
}
|
|
311
|
+
/** Per-tool catalog risk class. The first three mirror the platform's
|
|
312
|
+
* `HubActionRisk`; `unknown` is surfaced honestly for tools the catalog can't
|
|
313
|
+
* classify (substrate connectors). */
|
|
314
|
+
type HubToolRisk = "read" | "write" | "destructive" | "unknown";
|
|
113
315
|
interface HubTool {
|
|
114
316
|
path: string;
|
|
115
317
|
providerId?: string;
|
|
@@ -121,6 +323,7 @@ interface HubTool {
|
|
|
121
323
|
connectionStatus?: "connected" | "missing" | "unknown";
|
|
122
324
|
requiredConnectionProviderId?: string;
|
|
123
325
|
policyState?: "allow" | "ask" | "deny" | "unknown";
|
|
326
|
+
risk?: HubToolRisk;
|
|
124
327
|
}
|
|
125
328
|
interface HubToolSourcesResponse {
|
|
126
329
|
sources: HubToolSource[];
|
|
@@ -184,6 +387,16 @@ interface HubPolicyUpdateRequest {
|
|
|
184
387
|
interface HubPolicyListRequest {
|
|
185
388
|
connectionId: string;
|
|
186
389
|
}
|
|
390
|
+
interface HubPolicyDeleteRequest {
|
|
391
|
+
connectionId: string;
|
|
392
|
+
actionPath: string;
|
|
393
|
+
}
|
|
394
|
+
interface HubPolicyDeleteResponse {
|
|
395
|
+
connectionId: string;
|
|
396
|
+
actionPath: string;
|
|
397
|
+
/** Whether a stored override existed and was removed (false = already default). */
|
|
398
|
+
deleted: boolean;
|
|
399
|
+
}
|
|
187
400
|
interface HubPolicy {
|
|
188
401
|
id: string;
|
|
189
402
|
connectionId: string;
|
|
@@ -199,6 +412,20 @@ interface HubPolicyResponse {
|
|
|
199
412
|
interface HubPolicyListResponse {
|
|
200
413
|
policies: HubPolicy[];
|
|
201
414
|
}
|
|
415
|
+
interface HubAllowWritesResponse {
|
|
416
|
+
connectionId: string;
|
|
417
|
+
providerId: string;
|
|
418
|
+
/** Write actions the connection's provider exposes. */
|
|
419
|
+
writeActions: number;
|
|
420
|
+
/** Rows newly created (excludes actions that already had a policy). */
|
|
421
|
+
granted: number;
|
|
422
|
+
actionPaths: string[];
|
|
423
|
+
}
|
|
424
|
+
interface HubRevertWritesResponse {
|
|
425
|
+
connectionId: string;
|
|
426
|
+
/** `allow_writes` rows deleted. */
|
|
427
|
+
reverted: number;
|
|
428
|
+
}
|
|
202
429
|
type HubApprovalStatus = "pending" | "approved" | "denied" | "expired" | "consumed";
|
|
203
430
|
interface HubApproval {
|
|
204
431
|
id: string;
|
|
@@ -298,6 +525,253 @@ interface HubGithubAppIsRepoInstalledResponse {
|
|
|
298
525
|
installed: boolean;
|
|
299
526
|
installationId: number | null;
|
|
300
527
|
}
|
|
528
|
+
interface HubWorkflowAction {
|
|
529
|
+
kind: string;
|
|
530
|
+
config: Record<string, unknown>;
|
|
531
|
+
}
|
|
532
|
+
/** Inbound-event matcher for a `provider_event` trigger. */
|
|
533
|
+
interface HubWorkflowEventFilter {
|
|
534
|
+
event: string;
|
|
535
|
+
action?: string;
|
|
536
|
+
repo?: string;
|
|
537
|
+
}
|
|
538
|
+
interface HubWorkflowTrigger {
|
|
539
|
+
id: string;
|
|
540
|
+
kind: "provider_event" | "schedule";
|
|
541
|
+
enabled: boolean;
|
|
542
|
+
provider: string | null;
|
|
543
|
+
connectionId: string | null;
|
|
544
|
+
eventFilter: HubWorkflowEventFilter | null;
|
|
545
|
+
cron: string | null;
|
|
546
|
+
timezone: string | null;
|
|
547
|
+
nextFireAt: string | null;
|
|
548
|
+
lastFiredAt: string | null;
|
|
549
|
+
}
|
|
550
|
+
interface HubWorkflowValidationError {
|
|
551
|
+
path: string;
|
|
552
|
+
message: string;
|
|
553
|
+
}
|
|
554
|
+
type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
|
|
555
|
+
/** One agent iteration of an `agent.run`, as the single-run detail carries it
|
|
556
|
+
* (JSON-clean ISO timestamps) — including the round's own output `text`. */
|
|
557
|
+
interface HubAgentIterationSpan {
|
|
558
|
+
index: number;
|
|
559
|
+
name: string;
|
|
560
|
+
status: "succeeded" | "failed";
|
|
561
|
+
startedAt: string;
|
|
562
|
+
completedAt: string;
|
|
563
|
+
model?: string;
|
|
564
|
+
inputTokens?: number;
|
|
565
|
+
outputTokens?: number;
|
|
566
|
+
costUsd?: number;
|
|
567
|
+
error?: string;
|
|
568
|
+
text?: string;
|
|
569
|
+
}
|
|
570
|
+
/** An `agent.run`'s execution detail (single-run detail endpoint): per-iteration
|
|
571
|
+
* spans plus aggregate usage, present on success AND failure. `partialText` is
|
|
572
|
+
* failure-only — on success the final text is the action's `output`. */
|
|
573
|
+
interface HubAgentRunDetail {
|
|
574
|
+
model?: string;
|
|
575
|
+
inputTokens?: number;
|
|
576
|
+
outputTokens?: number;
|
|
577
|
+
costUsd?: number;
|
|
578
|
+
partialText?: string;
|
|
579
|
+
iterations?: HubAgentIterationSpan[];
|
|
580
|
+
}
|
|
581
|
+
/** Per-action result inside a run. `output` on success, `error` on failure. */
|
|
582
|
+
interface HubWorkflowActionResult {
|
|
583
|
+
index: number;
|
|
584
|
+
kind: string;
|
|
585
|
+
/** `running` is the provisional in-flight status the run-history list and
|
|
586
|
+
* single-run detail endpoints return for an action of a run that is still
|
|
587
|
+
* executing (reconciled to `failed` only once the run itself reaches a
|
|
588
|
+
* terminal state); a consumer polling either endpoint can observe it.
|
|
589
|
+
* `skipped` is an action whose `if` guard resolved false, so it never ran —
|
|
590
|
+
* terminal and distinct from `failed` (it has no `output`, `error`, or cost). */
|
|
591
|
+
status: "succeeded" | "failed" | "running" | "skipped";
|
|
592
|
+
/**
|
|
593
|
+
* Action output on success. Present on the single-run detail endpoint;
|
|
594
|
+
* intentionally omitted from the paginated run-history list response (an
|
|
595
|
+
* output can be an arbitrarily large response body, and the list would
|
|
596
|
+
* otherwise carry unbounded payloads), so it is absent there.
|
|
597
|
+
*/
|
|
598
|
+
output?: unknown;
|
|
599
|
+
error?: string;
|
|
600
|
+
costUsd?: number;
|
|
601
|
+
/** `agent.run` only (single-run detail): the agent's execution detail —
|
|
602
|
+
* per-iteration spans (each with text), aggregate usage, partial text. */
|
|
603
|
+
agentRun?: HubAgentRunDetail;
|
|
604
|
+
}
|
|
605
|
+
/** A single workflow run, as returned by the run-history endpoint. */
|
|
606
|
+
interface HubWorkflowRun {
|
|
607
|
+
id: string;
|
|
608
|
+
status: HubWorkflowRunStatus;
|
|
609
|
+
actionResults: HubWorkflowActionResult[];
|
|
610
|
+
/** Terminal run error (credit-exhausted, connection revoked, …); null on a clean run. */
|
|
611
|
+
error: string | null;
|
|
612
|
+
attempts: number;
|
|
613
|
+
/** Single-run detail only: the definition YAML captured at enqueue (null for
|
|
614
|
+
* runs from before snapshots, or a workflow with no stored definition). */
|
|
615
|
+
definitionSnapshot?: string | null;
|
|
616
|
+
/** Single-run detail only: the trigger payload/context the run executed
|
|
617
|
+
* against (capped server-side). Absent on the paginated list. */
|
|
618
|
+
triggerContext?: unknown;
|
|
619
|
+
createdAt: string;
|
|
620
|
+
startedAt: string | null;
|
|
621
|
+
completedAt: string | null;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* A single run as returned by the single-run detail endpoint
|
|
625
|
+
* (`GET /v1/workflows/:id/runs/:runId`) and carried in the `snapshot` stream
|
|
626
|
+
* event. Unlike a run-history list item it always carries `workflowId` and the
|
|
627
|
+
* per-action `output` / `agentRun` detail (all size-capped server-side).
|
|
628
|
+
*/
|
|
629
|
+
interface HubWorkflowRunDetail extends HubWorkflowRun {
|
|
630
|
+
workflowId: string;
|
|
631
|
+
/** The detail endpoint always returns these (unlike the run-history list,
|
|
632
|
+
* where they're absent) — narrowed to required here so a consumer of
|
|
633
|
+
* `getRun` / a `snapshot` event reads them without re-checking presence. */
|
|
634
|
+
triggerContext: unknown;
|
|
635
|
+
definitionSnapshot: string | null;
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* The trigger fields a manual "Run now" supplies, as a flat `{ path: value }`
|
|
639
|
+
* map (e.g. `{ "pull_request.number": "123" }`). Keys are the `path`s of the
|
|
640
|
+
* workflow's {@link HubManualRunInput}s; the server nests them into a trigger
|
|
641
|
+
* context so the run resolves exactly as a real trigger delivery would.
|
|
642
|
+
*/
|
|
643
|
+
type HubWorkflowRunInputs = Record<string, string>;
|
|
644
|
+
/** Response of a manual run enqueue (`POST /v1/workflows/:id/run`). */
|
|
645
|
+
interface HubWorkflowRunEnqueued {
|
|
646
|
+
runId: string;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Result of cancelling a run (`POST /v1/workflows/:id/runs/:runId/cancel`).
|
|
650
|
+
*
|
|
651
|
+
* `cancelled` — a `queued` run was stopped synchronously in the store; it is
|
|
652
|
+
* already terminal. `cancelling` — a `running` run was signalled to abort; it
|
|
653
|
+
* settles `cancelled` a moment later as its in-flight action tears down. Observe
|
|
654
|
+
* the true terminal state via {@link HubWorkflowRunDetail} (`getRun`) or the run
|
|
655
|
+
* event stream (`watchRun`). A finished run throws `HubSdkError` with code
|
|
656
|
+
* `RUN_NOT_CANCELLABLE`; an unknown/foreign run throws `NOT_FOUND`.
|
|
657
|
+
*/
|
|
658
|
+
interface HubWorkflowRunCancelResult {
|
|
659
|
+
runId: string;
|
|
660
|
+
status: "cancelled" | "cancelling";
|
|
661
|
+
/** Only on a `cancelling` result: whether the abort reached a worker running
|
|
662
|
+
* this run on the API instance that served the request. `false` → the run
|
|
663
|
+
* just finished, or executes on another instance and will stop on its own;
|
|
664
|
+
* watch/poll the run to confirm it settled `cancelled`. */
|
|
665
|
+
signalled?: boolean;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* A live event from a run's SSE stream (`GET /v1/workflows/:id/runs/:runId/events`),
|
|
669
|
+
* as surfaced by {@link HubWorkflowsClient.watchRun}. `snapshot` is the current
|
|
670
|
+
* persisted run detail sent first; the lifecycle/token events mirror the run as
|
|
671
|
+
* it executes; `ping` is a keepalive; `run.done` is terminal and closes the
|
|
672
|
+
* stream. Unknown server event types are dropped rather than surfaced, so new
|
|
673
|
+
* event kinds don't break older clients.
|
|
674
|
+
*/
|
|
675
|
+
type HubWorkflowRunStreamEvent = {
|
|
676
|
+
type: "snapshot";
|
|
677
|
+
run: HubWorkflowRunDetail;
|
|
678
|
+
} | {
|
|
679
|
+
type: "action.started";
|
|
680
|
+
index: number;
|
|
681
|
+
kind: string;
|
|
682
|
+
at: string;
|
|
683
|
+
} | {
|
|
684
|
+
type: "action.finished";
|
|
685
|
+
index: number;
|
|
686
|
+
kind: string;
|
|
687
|
+
status: "succeeded" | "failed" | "skipped";
|
|
688
|
+
costUsd?: number;
|
|
689
|
+
error?: string;
|
|
690
|
+
at: string;
|
|
691
|
+
} | {
|
|
692
|
+
type: "iteration.started";
|
|
693
|
+
actionIndex: number;
|
|
694
|
+
iterationIndex: number;
|
|
695
|
+
model?: string;
|
|
696
|
+
at: string;
|
|
697
|
+
} | {
|
|
698
|
+
type: "iteration.ended";
|
|
699
|
+
actionIndex: number;
|
|
700
|
+
iterationIndex: number;
|
|
701
|
+
status: "succeeded" | "failed";
|
|
702
|
+
outputPreview?: string;
|
|
703
|
+
inputTokens?: number;
|
|
704
|
+
outputTokens?: number;
|
|
705
|
+
costUsd?: number;
|
|
706
|
+
at: string;
|
|
707
|
+
} | {
|
|
708
|
+
type: "token";
|
|
709
|
+
actionIndex: number;
|
|
710
|
+
delta: string;
|
|
711
|
+
at: string;
|
|
712
|
+
} | {
|
|
713
|
+
type: "ping";
|
|
714
|
+
} | {
|
|
715
|
+
type: "run.done";
|
|
716
|
+
status: "succeeded" | "failed" | "cancelled";
|
|
717
|
+
error?: string | null;
|
|
718
|
+
at?: string;
|
|
719
|
+
} | {
|
|
720
|
+
type: "run.waiting";
|
|
721
|
+
decisionId: string;
|
|
722
|
+
at?: string;
|
|
723
|
+
};
|
|
724
|
+
/** Latest-run snapshot attached to each workflow on the list response. */
|
|
725
|
+
interface HubWorkflowRunSummary {
|
|
726
|
+
id: string;
|
|
727
|
+
status: HubWorkflowRunStatus;
|
|
728
|
+
error: string | null;
|
|
729
|
+
createdAt: string;
|
|
730
|
+
completedAt: string | null;
|
|
731
|
+
}
|
|
732
|
+
/** One page of run history; `nextCursor` is null on the last page. */
|
|
733
|
+
interface HubWorkflowRunsPage {
|
|
734
|
+
runs: HubWorkflowRun[];
|
|
735
|
+
nextCursor: string | null;
|
|
736
|
+
}
|
|
737
|
+
interface HubWorkflow {
|
|
738
|
+
id: string;
|
|
739
|
+
name: string;
|
|
740
|
+
description: string | null;
|
|
741
|
+
enabled: boolean;
|
|
742
|
+
/** Compiled engine actions (connection refs resolved to ids). */
|
|
743
|
+
actions: HubWorkflowAction[];
|
|
744
|
+
/** The durable YAML this workflow compiled from. */
|
|
745
|
+
definitionYaml: string | null;
|
|
746
|
+
validationErrors: HubWorkflowValidationError[];
|
|
747
|
+
/** Present on get/create/update detail responses; omitted on list. */
|
|
748
|
+
triggers?: HubWorkflowTrigger[];
|
|
749
|
+
/** Present on the detail response: the trigger fields a manual run must supply,
|
|
750
|
+
* derived from the definition's `${trigger.*}` references (empty when none). */
|
|
751
|
+
manualRunInputs?: HubManualRunInput[];
|
|
752
|
+
/** Present on the list response (latest run, or null if never run); omitted on detail. */
|
|
753
|
+
lastRun?: HubWorkflowRunSummary | null;
|
|
754
|
+
createdAt: string;
|
|
755
|
+
updatedAt: string;
|
|
756
|
+
}
|
|
757
|
+
/** A trigger field a manual "Run now" must supply (derived from the
|
|
758
|
+
* definition's `${trigger.*}` references). `required` is false only when every
|
|
759
|
+
* read is wrapped in a `default(...)`. */
|
|
760
|
+
interface HubManualRunInput {
|
|
761
|
+
path: string;
|
|
762
|
+
required: boolean;
|
|
763
|
+
}
|
|
764
|
+
type HubWorkflowValidateResponse = {
|
|
765
|
+
valid: true;
|
|
766
|
+
name: string;
|
|
767
|
+
actionCount: number;
|
|
768
|
+
triggerCount: number;
|
|
769
|
+
} | {
|
|
770
|
+
valid: false;
|
|
771
|
+
errors: HubWorkflowValidationError[];
|
|
772
|
+
};
|
|
773
|
+
/** JSON Schema for the YAML workflow definition. */
|
|
774
|
+
type HubWorkflowSchemaResponse = Record<string, unknown>;
|
|
301
775
|
//#endregion
|
|
302
776
|
//#region src/client.d.ts
|
|
303
777
|
type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
|
|
@@ -333,16 +807,31 @@ declare class HubClient {
|
|
|
333
807
|
readonly apiKey?: string;
|
|
334
808
|
readonly authHeaders?: HubAuthHeaders;
|
|
335
809
|
readonly connections: HubConnectionsClient;
|
|
810
|
+
readonly channels: HubChannelsClient;
|
|
811
|
+
readonly eventSubscriptions: HubEventSubscriptionsClient;
|
|
336
812
|
readonly permissions: HubPermissionsClient;
|
|
337
813
|
readonly tokens: HubTokensClient;
|
|
338
814
|
readonly tools: HubToolsClient;
|
|
339
815
|
readonly approvals: HubApprovalsClient;
|
|
340
816
|
readonly audit: HubAuditClient;
|
|
341
817
|
readonly githubApp: HubGithubAppClient;
|
|
818
|
+
readonly workflows: HubWorkflowsClient;
|
|
342
819
|
constructor(options: HubClientOptions);
|
|
343
820
|
static fromEnv(options?: HubClientFromEnvOptions): HubClient;
|
|
344
821
|
status(): Promise<HubStatusResponse>;
|
|
345
822
|
private request;
|
|
823
|
+
/**
|
|
824
|
+
* Open a streaming (Server-Sent Events) response and return its raw body.
|
|
825
|
+
* Shares auth-header building + `fetch` with {@link request}, but does NOT
|
|
826
|
+
* buffer or JSON-parse the body — the caller consumes the stream.
|
|
827
|
+
*
|
|
828
|
+
* A successful stream comes back as `text/event-stream`. Anything else is an
|
|
829
|
+
* error envelope (404/429/401 JSON) or a transport failure (gateway/HTML
|
|
830
|
+
* page); it is surfaced the same way {@link request} surfaces errors — a
|
|
831
|
+
* typed `HubSdkError` from a `{success:false}` envelope, otherwise an
|
|
832
|
+
* `HUB_HTTP_<status>` transport error — rather than handed back as bogus SSE.
|
|
833
|
+
*/
|
|
834
|
+
private stream;
|
|
346
835
|
private buildHeaders;
|
|
347
836
|
}
|
|
348
837
|
interface HubTokenListOptions {
|
|
@@ -365,9 +854,25 @@ declare class HubPermissionsClient {
|
|
|
365
854
|
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
366
855
|
list(connectionId: string): Promise<HubPolicyListResponse>;
|
|
367
856
|
set(input: HubPolicyUpdateRequest): Promise<HubPolicyResponse>;
|
|
857
|
+
/** Reset an action to its default by deleting any stored override. */
|
|
858
|
+
delete(input: HubPolicyDeleteRequest): Promise<HubPolicyDeleteResponse>;
|
|
859
|
+
/** Bulk-allow every write action of a connection's provider. Reads are
|
|
860
|
+
* already allowed for sandbox agents; destructive actions stay `ask`.
|
|
861
|
+
* Idempotent: actions with an existing policy are left untouched. */
|
|
862
|
+
allowWrites(connectionId: string): Promise<HubAllowWritesResponse>;
|
|
863
|
+
/** Inverse of `allowWrites`: delete only the rows it created for this
|
|
864
|
+
* connection. Manual per-action decisions are left intact. */
|
|
865
|
+
revertWrites(connectionId: string): Promise<HubRevertWritesResponse>;
|
|
368
866
|
}
|
|
369
867
|
interface HubToolSearchOptions {
|
|
370
868
|
provider?: string;
|
|
869
|
+
/** Max tools to return. The server defaults to a relevance-ranked shortlist
|
|
870
|
+
* (20); pass a higher value (bounded server-side) to enumerate a provider's
|
|
871
|
+
* full action list, e.g. for a catalog/browse UI. The cap bounds the MERGED
|
|
872
|
+
* response across sources — with no `provider` set, a low limit can exclude
|
|
873
|
+
* some providers' tools, so scope by `provider` when you need one connector's
|
|
874
|
+
* complete list. */
|
|
875
|
+
limit?: number;
|
|
371
876
|
}
|
|
372
877
|
interface HubToolInvokeOptions {
|
|
373
878
|
connectionId?: string;
|
|
@@ -386,11 +891,36 @@ interface HubConnectionStartOptions {
|
|
|
386
891
|
returnUrl?: string;
|
|
387
892
|
cli?: boolean;
|
|
388
893
|
}
|
|
894
|
+
declare class HubChannelsClient {
|
|
895
|
+
private readonly request;
|
|
896
|
+
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
897
|
+
list(): Promise<HubChannelsResponse>;
|
|
898
|
+
createEmail(input?: HubEmailChannelCreateRequest): Promise<HubChannelCreateResponse>;
|
|
899
|
+
delete(channelId: string): Promise<HubChannelDeleteResponse>;
|
|
900
|
+
}
|
|
901
|
+
declare class HubEventSubscriptionsClient {
|
|
902
|
+
private readonly request;
|
|
903
|
+
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
904
|
+
list(): Promise<HubEventSubscriptionsResponse>;
|
|
905
|
+
create(input: HubEventSubscriptionCreateRequest): Promise<HubEventSubscriptionCreateResponse>;
|
|
906
|
+
delete(subscriptionId: string): Promise<HubEventSubscriptionDeleteResponse>;
|
|
907
|
+
}
|
|
389
908
|
declare class HubConnectionsClient {
|
|
390
909
|
private readonly request;
|
|
391
910
|
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
392
911
|
list(): Promise<HubConnectionsResponse>;
|
|
912
|
+
/** Connector catalog: every provider the hub can expose, each flagged with
|
|
913
|
+
* `configured` (whether its OAuth app credentials are wired). Callers render
|
|
914
|
+
* this alongside `list()` to offer Connect for not-yet-connected providers. */
|
|
915
|
+
providers(): Promise<HubProvidersResponse>;
|
|
393
916
|
start(provider: string, options?: HubConnectionStartOptions): Promise<HubOAuthStartResponse>;
|
|
917
|
+
startWhatsappEmbeddedSignup(options?: HubWhatsappEmbeddedSignupStartRequest): Promise<HubWhatsappEmbeddedSignupStartResponse>;
|
|
918
|
+
completeWhatsappEmbeddedSignup(input: HubWhatsappEmbeddedSignupCompleteRequest): Promise<HubWhatsappEmbeddedSignupCompleteResponse>;
|
|
919
|
+
/** Connect a non-OAuth (api-key) connector by submitting the user's key.
|
|
920
|
+
* The server validates the key with a live probe before persisting and
|
|
921
|
+
* returns the created (or reconnected) connection — there is no redirect,
|
|
922
|
+
* unlike `start`. */
|
|
923
|
+
connectApiKey(provider: string, apiKey: string): Promise<HubApiKeyConnectResponse>;
|
|
394
924
|
revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
|
|
395
925
|
health(connectionId: string): Promise<HubConnectionHealthResponse>;
|
|
396
926
|
}
|
|
@@ -417,9 +947,178 @@ declare class HubAuditClient {
|
|
|
417
947
|
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
418
948
|
list(options?: HubAuditListRequest): Promise<HubAuditResponse>;
|
|
419
949
|
}
|
|
950
|
+
declare class HubWorkflowsClient {
|
|
951
|
+
private readonly request;
|
|
952
|
+
private readonly stream?;
|
|
953
|
+
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>, stream?: ((path: string, init: RequestInit) => Promise<ReadableStream<Uint8Array>>) | undefined);
|
|
954
|
+
list(): Promise<HubWorkflow[]>;
|
|
955
|
+
get(id: string): Promise<HubWorkflow>;
|
|
956
|
+
create(yaml: string): Promise<HubWorkflow>;
|
|
957
|
+
update(id: string, yaml: string): Promise<HubWorkflow>;
|
|
958
|
+
delete(id: string): Promise<void>;
|
|
959
|
+
/**
|
|
960
|
+
* Enable or disable a workflow without editing its YAML. Works even when the
|
|
961
|
+
* workflow's connection was revoked (a disabled workflow can't be recompiled
|
|
962
|
+
* via `update`, but it can still be paused/resumed here).
|
|
963
|
+
*/
|
|
964
|
+
setEnabled(id: string, enabled: boolean): Promise<HubWorkflow>;
|
|
965
|
+
/**
|
|
966
|
+
* One page of run history, newest first. Pass the previous page's
|
|
967
|
+
* `nextCursor` to fetch the next; a null `nextCursor` means the last page.
|
|
968
|
+
*/
|
|
969
|
+
listRuns(id: string, opts?: {
|
|
970
|
+
limit?: number;
|
|
971
|
+
cursor?: string;
|
|
972
|
+
}): Promise<HubWorkflowRunsPage>;
|
|
973
|
+
/**
|
|
974
|
+
* Enqueue an immediate ("Run now") run and return its `runId`. The run goes
|
|
975
|
+
* through the identical execution path a trigger delivery uses.
|
|
976
|
+
*
|
|
977
|
+
* `inputs` supplies the trigger fields the workflow reads (its
|
|
978
|
+
* {@link HubWorkflow.manualRunInputs}), as a flat `{ path: value }` map — e.g.
|
|
979
|
+
* `{ "pull_request.number": "123" }`. Omit it for a one-click run of a
|
|
980
|
+
* workflow that reads no trigger fields. Throws `HubSdkError`:
|
|
981
|
+
* `MISSING_RUN_INPUTS` when a required field is absent (`details.missing`
|
|
982
|
+
* names them), `WORKFLOW_DISABLED` when the workflow is paused, `NOT_FOUND`
|
|
983
|
+
* for an unknown/foreign id. Pass `opts.signal` to abort a slow request.
|
|
984
|
+
*/
|
|
985
|
+
run(id: string, inputs?: HubWorkflowRunInputs, opts?: {
|
|
986
|
+
signal?: AbortSignal;
|
|
987
|
+
}): Promise<HubWorkflowRunEnqueued>;
|
|
988
|
+
/**
|
|
989
|
+
* A single run's full detail: per-action `output` + `agentRun` execution
|
|
990
|
+
* detail (size-capped server-side) and the trigger context — the deep "why
|
|
991
|
+
* did this run do what it did" view. `NOT_FOUND` when the run is unknown or
|
|
992
|
+
* does not belong to both the caller and this workflow.
|
|
993
|
+
*/
|
|
994
|
+
getRun(id: string, runId: string, opts?: {
|
|
995
|
+
signal?: AbortSignal;
|
|
996
|
+
}): Promise<HubWorkflowRunDetail>;
|
|
997
|
+
/**
|
|
998
|
+
* Stop a queued or in-flight run. A `queued` run is cancelled synchronously
|
|
999
|
+
* and comes back `{ status: "cancelled" }` (already terminal); a `running` run
|
|
1000
|
+
* is signalled to abort and comes back `{ status: "cancelling", signalled }` —
|
|
1001
|
+
* it settles `cancelled` a moment later as its current action tears down, which
|
|
1002
|
+
* a {@link watchRun}/{@link getRun} observes. Throws `HubSdkError`:
|
|
1003
|
+
* `RUN_NOT_CANCELLABLE` when the run already finished, `NOT_FOUND` for an
|
|
1004
|
+
* unknown/foreign run id. Pass `opts.signal` to abort a slow request.
|
|
1005
|
+
*/
|
|
1006
|
+
cancel(id: string, runId: string, opts?: {
|
|
1007
|
+
signal?: AbortSignal;
|
|
1008
|
+
}): Promise<HubWorkflowRunCancelResult>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Stream a run's live progress as an async iterable of typed events. The
|
|
1011
|
+
* first event is always a `snapshot` of the current persisted state; then
|
|
1012
|
+
* `action.*` / `iteration.*` / `token` ticks arrive as the run executes;
|
|
1013
|
+
* `ping` is a keepalive; a terminal `run.done` ends the iteration. If the run
|
|
1014
|
+
* is already finished when the stream opens, it yields the snapshot then
|
|
1015
|
+
* `run.done` and completes.
|
|
1016
|
+
*
|
|
1017
|
+
* Live ticks require the worker executing the run to share the API process;
|
|
1018
|
+
* across instances only `snapshot` + `run.done` (from the server's terminal
|
|
1019
|
+
* poll) arrive — the persisted record, read via {@link getRun}, stays the
|
|
1020
|
+
* source of truth. Pass `signal` to cancel; iterating to `run.done` (or
|
|
1021
|
+
* breaking early) releases the connection.
|
|
1022
|
+
*/
|
|
1023
|
+
watchRun(id: string, runId: string, opts?: {
|
|
1024
|
+
signal?: AbortSignal;
|
|
1025
|
+
}): AsyncGenerator<HubWorkflowRunStreamEvent>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Poll {@link getRun} until the run reaches a terminal state (`succeeded` or
|
|
1028
|
+
* `failed`) and return its detail. The scripting primitive behind "run and
|
|
1029
|
+
* print the result": pairs with {@link run} for a one-call trigger-and-wait.
|
|
1030
|
+
*
|
|
1031
|
+
* Returns as soon as the run leaves the active set (`queued` / `running`) —
|
|
1032
|
+
* i.e. on `succeeded`, `failed`, or any future non-active status — so a new
|
|
1033
|
+
* terminal state can never hang the wait. Polls every `pollIntervalMs`
|
|
1034
|
+
* (default 2000). With `timeoutMs` set, throws
|
|
1035
|
+
* `HubSdkError(WORKFLOW_RUN_TIMEOUT)` — carrying the last observed status on
|
|
1036
|
+
* `details.status` — only once the deadline has actually passed; the last
|
|
1037
|
+
* wait is clamped to the remaining time so a `timeoutMs` shorter than the
|
|
1038
|
+
* poll interval still waits the full requested window rather than giving up a
|
|
1039
|
+
* poll early. Pass `signal` to cancel the wait between polls.
|
|
1040
|
+
*/
|
|
1041
|
+
waitForRun(id: string, runId: string, opts?: {
|
|
1042
|
+
pollIntervalMs?: number;
|
|
1043
|
+
timeoutMs?: number;
|
|
1044
|
+
signal?: AbortSignal;
|
|
1045
|
+
}): Promise<HubWorkflowRunDetail>;
|
|
1046
|
+
validate(yaml: string): Promise<HubWorkflowValidateResponse>;
|
|
1047
|
+
schema(): Promise<HubWorkflowSchemaResponse>;
|
|
1048
|
+
}
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src/event-delivery.d.ts
|
|
1051
|
+
type HubEventSignatureFailure = "missing" | "malformed" | "stale" | "mismatch";
|
|
1052
|
+
type HubEventSignatureResult = {
|
|
1053
|
+
valid: true;
|
|
1054
|
+
timestamp: number;
|
|
1055
|
+
} | {
|
|
1056
|
+
valid: false;
|
|
1057
|
+
reason: HubEventSignatureFailure;
|
|
1058
|
+
};
|
|
1059
|
+
interface VerifyHubEventSignatureInput {
|
|
1060
|
+
body: string;
|
|
1061
|
+
signature: string | null | undefined;
|
|
1062
|
+
secret: string;
|
|
1063
|
+
toleranceSeconds?: number;
|
|
1064
|
+
now?: number | Date;
|
|
1065
|
+
}
|
|
1066
|
+
interface DeriveHubEventCallbackSecretInput {
|
|
1067
|
+
/** App-level secret stored only in the product's server environment. */
|
|
1068
|
+
rootSecret: string;
|
|
1069
|
+
/** Stable product slug, such as `relationships`. */
|
|
1070
|
+
productId: string;
|
|
1071
|
+
/** Stable Tangle owner id; user and team ids are both valid. */
|
|
1072
|
+
ownerId: string;
|
|
1073
|
+
/** Stable product-local binding id used in the callback route. */
|
|
1074
|
+
bindingId: string;
|
|
1075
|
+
}
|
|
1076
|
+
type HubEventRequestFailureCode = "METHOD_NOT_ALLOWED" | "UNEXPECTED_EVENT" | "UNSUPPORTED_MEDIA_TYPE" | "PAYLOAD_TOO_LARGE" | "INVALID_SIGNATURE" | "INVALID_DELIVERY" | "DELIVERY_ID_MISMATCH";
|
|
1077
|
+
type HubEventRequestResult = {
|
|
1078
|
+
ok: true;
|
|
1079
|
+
delivery: HubEventDelivery;
|
|
1080
|
+
} | {
|
|
1081
|
+
ok: false;
|
|
1082
|
+
code: HubEventRequestFailureCode;
|
|
1083
|
+
response: Response;
|
|
1084
|
+
};
|
|
1085
|
+
interface AuthenticateHubEventRequestInput {
|
|
1086
|
+
request: Request;
|
|
1087
|
+
/** The per-binding secret supplied when the subscription was created. */
|
|
1088
|
+
secret: string;
|
|
1089
|
+
/** Defaults to 5 MiB plus envelope overhead; hard-capped at 10 MiB. */
|
|
1090
|
+
maxBodyBytes?: number;
|
|
1091
|
+
toleranceSeconds?: number;
|
|
1092
|
+
now?: number | Date;
|
|
1093
|
+
}
|
|
1094
|
+
declare class HubEventDeliveryError extends Error {
|
|
1095
|
+
readonly code: "INVALID_JSON" | "INVALID_PAYLOAD" | "CRYPTO_UNAVAILABLE" | "INVALID_TOLERANCE" | "INVALID_CALLBACK_SECRET" | "INVALID_SECRET_SCOPE" | "INVALID_BODY_LIMIT";
|
|
1096
|
+
constructor(code: HubEventDeliveryError["code"], message: string);
|
|
1097
|
+
}
|
|
1098
|
+
/**
|
|
1099
|
+
* Derive one callback secret per product binding from a single server-held root
|
|
1100
|
+
* secret. Products persist only the binding id; the derived secret can be
|
|
1101
|
+
* reproduced for callback authentication without another secret table.
|
|
1102
|
+
*/
|
|
1103
|
+
declare function deriveHubEventCallbackSecret(input: DeriveHubEventCallbackSecretInput): Promise<string>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Authenticate and parse the platform's callback as one operation. The exact
|
|
1106
|
+
* raw body is read once with a size limit before its signature is checked.
|
|
1107
|
+
*
|
|
1108
|
+
* A successful callback can be retried. Use `delivery.runId` as the durable
|
|
1109
|
+
* idempotency key before starting product work.
|
|
1110
|
+
*/
|
|
1111
|
+
declare function authenticateHubEventRequest(input: AuthenticateHubEventRequestInput): Promise<HubEventRequestResult>;
|
|
1112
|
+
/**
|
|
1113
|
+
* Authenticate a Hub event callback against its exact raw request body.
|
|
1114
|
+
* The timestamp window rejects captured-request replay, and byte-wise
|
|
1115
|
+
* comparison avoids secret-dependent string comparison behavior.
|
|
1116
|
+
*/
|
|
1117
|
+
declare function verifyHubEventSignature(input: VerifyHubEventSignatureInput): Promise<HubEventSignatureResult>;
|
|
1118
|
+
declare function parseHubEventDelivery(input: string | unknown): HubEventDelivery;
|
|
420
1119
|
//#endregion
|
|
421
1120
|
//#region src/redaction.d.ts
|
|
422
1121
|
declare function redactHubValue(value: unknown): unknown;
|
|
423
1122
|
//#endregion
|
|
424
|
-
export { HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubApproval, type HubApprovalCapabilityToken, type HubApprovalDecisionResponse, type HubApprovalStatus, HubApprovalsClient, HubAuditClient, type HubAuditEvent, type HubAuditListRequest, type HubAuditResponse, type HubAuthHeaders, type HubCapabilityToken, 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 HubEnv, type HubEnvelope, type HubErrorBody, type HubErrorCode, type HubErrorEnvelope, type HubExecRequest, type HubExecResponse, HubGithubAppClient, type HubGithubAppInstallation, type HubGithubAppInstallationResponse, type HubGithubAppIsRepoInstalledRequest, type HubGithubAppIsRepoInstalledResponse, type HubGithubAppListReposResponse, type HubGithubAppMintInstallationTokenRequest, type HubGithubAppMintInstallationTokenResponse, type HubOAuthCallbackErrorQuery, type HubOAuthCallbackQuery, type HubOAuthCallbackResponse, type HubOAuthCallbackSuccessQuery, type HubOAuthStartRequest, type HubOAuthStartResponse, HubPermissionsClient, type HubPolicy, type HubPolicyDecision, type HubPolicyListRequest, type HubPolicyListResponse, type HubPolicyResponse, type HubPolicyUpdateRequest, type HubPrincipal, type HubPrincipalKind, HubSdkError, type HubStatusConnections, type HubStatusResponse, type HubSuccessEnvelope, type HubTokenListOptions, type HubTokenMintRequest, type HubTokenMintResponse, type HubTokenRevokeResponse, HubTokensClient, type HubTokensListResponse, type HubTool, type HubToolInvokeOptions, type HubToolSearchOptions, type HubToolSource, type HubToolSourcesResponse, HubToolsClient, type HubToolsDescribeRequest, type HubToolsDescribeResponse, type HubToolsSearchRequest, type HubToolsSearchResponse, type HubUnimplementedErrorEnvelope, redactHubValue, resolveHubAuth, resolveHubBaseUrl };
|
|
1123
|
+
export { type AuthenticateHubEventRequestInput, type DeriveHubEventCallbackSecretInput, HUB_API_KEY_ENV_VAR, HUB_CAPABILITY_TOKEN_ENV_VAR, HUB_URL_ENV_VAR, type HubAgentIterationSpan, type HubAgentRunDetail, type HubApiKeyConnectRequest, type HubApiKeyConnectResponse, type HubApproval, type HubApprovalCapabilityToken, type HubApprovalDecisionResponse, type HubApprovalStatus, HubApprovalsClient, HubAuditClient, type HubAuditEvent, type HubAuditListRequest, type HubAuditResponse, type HubAuthHeaders, type HubCapabilityToken, type HubChannel, type HubChannelCreateResponse, type HubChannelDeleteResponse, HubChannelsClient, type HubChannelsResponse, HubClient, type HubClientFromEnvOptions, type HubClientOptions, type HubConnection, type HubConnectionDeleteRequest, type HubConnectionDeleteResponse, type HubConnectionHealthError, type HubConnectionHealthInfo, type HubConnectionHealthRequest, type HubConnectionHealthResponse, type HubConnectionHealthStatus, type HubConnectionStartOptions, HubConnectionsClient, type HubConnectionsResponse, type HubEmailChannel, type HubEmailChannelCreateRequest, type HubEnv, type HubEnvelope, type HubErrorBody, type HubErrorCode, type HubErrorEnvelope, type HubEventCondition, type HubEventConditionScalar, type HubEventDelivery, HubEventDeliveryError, type HubEventRequestFailureCode, type HubEventRequestResult, type HubEventSignatureFailure, type HubEventSignatureResult, type HubEventSubscription, type HubEventSubscriptionCallback, type HubEventSubscriptionCreateRequest, type HubEventSubscriptionCreateResponse, type HubEventSubscriptionDeleteResponse, type HubEventSubscriptionFilter, type HubEventSubscriptionSource, HubEventSubscriptionsClient, type HubEventSubscriptionsResponse, type HubExecRequest, type HubExecResponse, HubGithubAppClient, type HubGithubAppInstallation, type HubGithubAppInstallationResponse, type HubGithubAppIsRepoInstalledRequest, type HubGithubAppIsRepoInstalledResponse, type HubGithubAppListReposResponse, type HubGithubAppMintInstallationTokenRequest, type HubGithubAppMintInstallationTokenResponse, type HubManualRunInput, type HubOAuthCallbackErrorQuery, type HubOAuthCallbackQuery, type HubOAuthCallbackResponse, type HubOAuthCallbackSuccessQuery, type HubOAuthStartRequest, type HubOAuthStartResponse, HubPermissionsClient, type HubPolicy, type HubPolicyDecision, type HubPolicyDeleteRequest, type HubPolicyDeleteResponse, type HubPolicyListRequest, type HubPolicyListResponse, type HubPolicyResponse, type HubPolicyUpdateRequest, type HubPrincipal, type HubPrincipalKind, type HubProvider, type HubProviderAuthKind, type HubProviderEvent, type HubProvidersResponse, HubSdkError, type HubStatusConnections, type HubStatusResponse, type HubSuccessEnvelope, type HubTokenListOptions, type HubTokenMintRequest, type HubTokenMintResponse, type HubTokenRevokeResponse, HubTokensClient, type HubTokensListResponse, type HubTool, type HubToolInvokeOptions, type HubToolRisk, type HubToolSearchOptions, type HubToolSource, type HubToolSourcesResponse, HubToolsClient, type HubToolsDescribeRequest, type HubToolsDescribeResponse, type HubToolsSearchRequest, type HubToolsSearchResponse, type HubUnimplementedErrorEnvelope, type HubWhatsappEmbeddedSignupCompleteRequest, type HubWhatsappEmbeddedSignupCompleteResponse, type HubWhatsappEmbeddedSignupStartRequest, type HubWhatsappEmbeddedSignupStartResponse, type HubWorkflow, type HubWorkflowAction, type HubWorkflowActionResult, type HubWorkflowEventFilter, type HubWorkflowRun, type HubWorkflowRunCancelResult, type HubWorkflowRunDetail, type HubWorkflowRunEnqueued, type HubWorkflowRunInputs, type HubWorkflowRunStatus, type HubWorkflowRunStreamEvent, type HubWorkflowRunSummary, type HubWorkflowRunsPage, type HubWorkflowSchemaResponse, type HubWorkflowTrigger, type HubWorkflowValidateResponse, type HubWorkflowValidationError, HubWorkflowsClient, type VerifyHubEventSignatureInput, authenticateHubEventRequest, deriveHubEventCallbackSecret, parseHubEventDelivery, redactHubValue, resolveHubAuth, resolveHubBaseUrl, verifyHubEventSignature };
|
|
425
1124
|
//# sourceMappingURL=index.d.ts.map
|