@tangle-network/hub-sdk 0.30.7 → 0.30.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +985 -943
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +371 -361
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -240,141 +240,561 @@ declare class HubAppsClient {
|
|
|
240
240
|
}): Promise<HubAppComplianceState>;
|
|
241
241
|
}
|
|
242
242
|
//#endregion
|
|
243
|
-
//#region src/types.d.ts
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
243
|
+
//#region src/tool-types.d.ts
|
|
244
|
+
interface HubToolSource {
|
|
245
|
+
sourceId: string;
|
|
246
|
+
providerId: string;
|
|
247
|
+
displayName: string;
|
|
248
|
+
toolCount: number;
|
|
249
|
+
connectionStatus: "connected" | "missing" | "unknown";
|
|
250
|
+
health: "healthy" | "unhealthy" | "rate_limited" | "unknown";
|
|
251
|
+
configured: boolean;
|
|
248
252
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
253
|
+
/** Per-tool catalog risk class. The first three mirror the platform's
|
|
254
|
+
* `HubActionRisk`; `unknown` is surfaced honestly for tools the catalog can't
|
|
255
|
+
* classify (substrate connectors). */
|
|
256
|
+
type HubToolRisk = "read" | "write" | "destructive" | "unknown";
|
|
257
|
+
interface HubTool {
|
|
258
|
+
path: string;
|
|
259
|
+
providerId?: string;
|
|
260
|
+
title?: string;
|
|
261
|
+
description?: string;
|
|
262
|
+
inputSchema?: unknown;
|
|
263
|
+
outputSchema?: unknown;
|
|
264
|
+
connectionRequired?: boolean;
|
|
265
|
+
connectionStatus?: "connected" | "missing" | "unknown";
|
|
266
|
+
requiredConnectionProviderId?: string;
|
|
267
|
+
policyState?: "allow" | "ask" | "deny" | "unknown";
|
|
268
|
+
risk?: HubToolRisk;
|
|
252
269
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
code: HubErrorCode;
|
|
256
|
-
message: string;
|
|
257
|
-
details?: unknown;
|
|
270
|
+
interface HubToolSourcesResponse {
|
|
271
|
+
sources: HubToolSource[];
|
|
258
272
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
principal: HubPrincipal;
|
|
263
|
-
connections: HubStatusConnections;
|
|
273
|
+
interface HubToolsSearchRequest {
|
|
274
|
+
query: string;
|
|
275
|
+
provider?: string;
|
|
264
276
|
}
|
|
265
|
-
interface
|
|
266
|
-
|
|
267
|
-
userId: string;
|
|
268
|
-
apiKeyId?: string;
|
|
269
|
-
sandboxId?: string;
|
|
270
|
-
requestId?: string;
|
|
277
|
+
interface HubToolsSearchResponse {
|
|
278
|
+
tools: HubTool[];
|
|
271
279
|
}
|
|
272
|
-
interface
|
|
273
|
-
|
|
274
|
-
unhealthyProviderCount: number;
|
|
280
|
+
interface HubToolsDescribeRequest {
|
|
281
|
+
path: string;
|
|
275
282
|
}
|
|
276
|
-
interface
|
|
277
|
-
|
|
278
|
-
providerId: string;
|
|
279
|
-
displayName: string;
|
|
280
|
-
accountDisplay: string | null;
|
|
281
|
-
providerAccountId: string | null;
|
|
282
|
-
scopes: string[];
|
|
283
|
-
status: "active" | "revoked" | "unhealthy" | "reconnect_required";
|
|
284
|
-
health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
|
|
285
|
-
createdAt: string;
|
|
286
|
-
updatedAt: string;
|
|
287
|
-
lastUsedAt: string | null;
|
|
283
|
+
interface HubToolsDescribeResponse {
|
|
284
|
+
tool: HubTool;
|
|
288
285
|
}
|
|
289
|
-
interface
|
|
290
|
-
|
|
286
|
+
interface HubExecRequest {
|
|
287
|
+
path: string;
|
|
288
|
+
input?: unknown;
|
|
289
|
+
connectionId?: string;
|
|
290
|
+
/** Caller-minted key for this exec. The platform ledger replays the first
|
|
291
|
+
* call's result for a retry that carries the same key, and rejects a key
|
|
292
|
+
* reused for a different request. On the capability-token arm the key only
|
|
293
|
+
* reaches the connector for provider-native dedupe: that arm is at-most-once
|
|
294
|
+
* per token and replays no stored result. */
|
|
295
|
+
idempotencyKey?: string;
|
|
291
296
|
}
|
|
292
|
-
interface
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
clientReference: string | null;
|
|
298
|
-
label: string | null;
|
|
299
|
-
address: string;
|
|
300
|
-
status: "active";
|
|
301
|
-
createdAt: string;
|
|
302
|
-
updatedAt: string;
|
|
297
|
+
interface HubExecResponse<TResult = unknown> {
|
|
298
|
+
result: TResult;
|
|
299
|
+
/** True when the result was replayed from a previous call with the same
|
|
300
|
+
* idempotency key, so the action did not run again. */
|
|
301
|
+
replayed?: boolean;
|
|
303
302
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
303
|
+
//#endregion
|
|
304
|
+
//#region src/broker.d.ts
|
|
305
|
+
interface HubAppBrokerOptions {
|
|
306
|
+
baseUrl: string;
|
|
307
|
+
clientId: string;
|
|
308
|
+
clientSecret: string;
|
|
309
|
+
fetch?: typeof fetch;
|
|
307
310
|
}
|
|
308
|
-
interface
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
*/
|
|
313
|
-
clientReference?: string;
|
|
314
|
-
label?: string;
|
|
311
|
+
interface HubAppBrokerToken {
|
|
312
|
+
accessToken: string;
|
|
313
|
+
expiresIn: number;
|
|
314
|
+
scopes: string[];
|
|
315
315
|
}
|
|
316
|
-
interface
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
created: boolean;
|
|
316
|
+
interface HubAppBrokerExchange extends HubAppBrokerToken {
|
|
317
|
+
grantId: string;
|
|
318
|
+
connectionId: string;
|
|
320
319
|
}
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
/** Server-only client. App secrets never become a user's general API key.
|
|
321
|
+
* Every invocation mints and consumes one short-lived, exact-grant token. */
|
|
322
|
+
declare class HubAppBrokerClient {
|
|
323
|
+
private readonly options;
|
|
324
|
+
private readonly baseUrl;
|
|
325
|
+
private readonly fetcher;
|
|
326
|
+
constructor(options: HubAppBrokerOptions);
|
|
327
|
+
private token;
|
|
328
|
+
private readToken;
|
|
329
|
+
exchange(input: {
|
|
330
|
+
code: string;
|
|
331
|
+
redirectUri: string;
|
|
332
|
+
connectionId?: string;
|
|
333
|
+
}): Promise<HubAppBrokerExchange>;
|
|
334
|
+
mint(grantId: string): Promise<HubAppBrokerToken>;
|
|
335
|
+
invoke<T = unknown>(grantId: string, connectionId: string, actionPath: string, input: Record<string, unknown>): Promise<HubExecResponse<T>>;
|
|
323
336
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
337
|
+
//#endregion
|
|
338
|
+
//#region src/knowledge-management.d.ts
|
|
339
|
+
interface KnowledgeReference {
|
|
340
|
+
sourceId: string;
|
|
341
|
+
generation: string;
|
|
342
|
+
}
|
|
343
|
+
/** Connection references only. Provider credentials never enter this contract. */
|
|
344
|
+
interface KnowledgeEmbeddingSpace {
|
|
345
|
+
connectionId: string;
|
|
346
|
+
model: string;
|
|
347
|
+
dimensions: number;
|
|
348
|
+
}
|
|
349
|
+
type KnowledgeSourceInput = {
|
|
350
|
+
kind: "file";
|
|
351
|
+
name: string;
|
|
352
|
+
base64: string;
|
|
353
|
+
mediaType: string;
|
|
329
354
|
} | {
|
|
330
|
-
|
|
355
|
+
kind: "git";
|
|
356
|
+
connectionId: string;
|
|
357
|
+
owner: string;
|
|
358
|
+
repo: string;
|
|
359
|
+
ref: string;
|
|
360
|
+
pathPrefix?: string;
|
|
331
361
|
} | {
|
|
332
|
-
|
|
362
|
+
kind: "url";
|
|
363
|
+
url: string;
|
|
333
364
|
} | {
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
repo?: string;
|
|
339
|
-
when?: HubEventCondition;
|
|
340
|
-
}
|
|
341
|
-
type HubEventSubscriptionSource = {
|
|
342
|
-
type: "channel";
|
|
343
|
-
channelId: string;
|
|
365
|
+
kind: "s3";
|
|
366
|
+
connectionId: string;
|
|
367
|
+
bucket: string;
|
|
368
|
+
prefix: string;
|
|
344
369
|
} | {
|
|
345
|
-
|
|
370
|
+
kind: "vector";
|
|
346
371
|
connectionId: string;
|
|
372
|
+
provider: "pinecone" | "qdrant" | "weaviate";
|
|
373
|
+
indexName: string;
|
|
374
|
+
namespace?: string;
|
|
375
|
+
embedding: KnowledgeEmbeddingSpace;
|
|
376
|
+
textField: string;
|
|
377
|
+
sourceUriField: string;
|
|
347
378
|
};
|
|
348
|
-
interface
|
|
349
|
-
|
|
350
|
-
|
|
379
|
+
interface KnowledgeCapability {
|
|
380
|
+
supported: boolean;
|
|
381
|
+
reason?: string;
|
|
351
382
|
}
|
|
352
|
-
interface
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
383
|
+
interface KnowledgeCapabilities {
|
|
384
|
+
delegation?: KnowledgeCapability & {
|
|
385
|
+
resource?: string;
|
|
386
|
+
scopes?: string[];
|
|
387
|
+
};
|
|
388
|
+
sources: Record<KnowledgeSourceInput["kind"], KnowledgeCapability>;
|
|
389
|
+
vectorProviders: Record<"pinecone" | "qdrant" | "weaviate", KnowledgeCapability>;
|
|
390
|
+
managedVector: KnowledgeCapability;
|
|
391
|
+
file: {
|
|
392
|
+
mediaTypes: string[];
|
|
393
|
+
maxBytes: number;
|
|
394
|
+
maxObjects: number;
|
|
395
|
+
};
|
|
363
396
|
}
|
|
364
|
-
interface
|
|
397
|
+
interface KnowledgeSourceSummary {
|
|
398
|
+
/** Required query authorization, not proof that an owner policy currently permits it. */
|
|
399
|
+
retrieval?: {
|
|
400
|
+
kind: "lexical";
|
|
401
|
+
} | {
|
|
402
|
+
kind: "vector";
|
|
403
|
+
embeddingPolicy: {
|
|
404
|
+
connectionId: string;
|
|
405
|
+
actionPath: "openai.embeddings.create";
|
|
406
|
+
scope: "owner-connection-action";
|
|
407
|
+
};
|
|
408
|
+
};
|
|
365
409
|
id: string;
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
410
|
+
name: string;
|
|
411
|
+
kind: KnowledgeSourceInput["kind"];
|
|
412
|
+
status: "ready" | "refreshing" | "failed" | "awaiting-approval";
|
|
413
|
+
approval?: {
|
|
414
|
+
id: string;
|
|
415
|
+
path: string;
|
|
416
|
+
preview: {
|
|
417
|
+
provider: string;
|
|
418
|
+
connectionId: string;
|
|
419
|
+
collection: string;
|
|
420
|
+
sourceId: string;
|
|
421
|
+
requestId: string;
|
|
422
|
+
embedding: KnowledgeEmbeddingSpace;
|
|
423
|
+
chunkCount: number;
|
|
424
|
+
sourceCount: number;
|
|
425
|
+
dataSharing: string;
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
refreshRequestId?: string;
|
|
429
|
+
generation: string | null;
|
|
430
|
+
lastError: {
|
|
431
|
+
code: string;
|
|
432
|
+
message: string;
|
|
433
|
+
} | null;
|
|
434
|
+
updatedAt: string;
|
|
435
|
+
}
|
|
436
|
+
type KnowledgeAttachmentAuthorization = {
|
|
437
|
+
status: "active";
|
|
438
|
+
} | {
|
|
439
|
+
status: "unavailable";
|
|
440
|
+
code: "APP_CONSENT_REVOKED" | "KEY_REVOKED" | "CONNECTION_UNAVAILABLE" | "ATTACHMENT_REVOKED" | "GENERATION_UNAVAILABLE" | "RUNTIME_AUTHORITY_REVOKED";
|
|
441
|
+
};
|
|
442
|
+
interface KnowledgeAttachment {
|
|
443
|
+
/** Snapshot of live grant/key/connection authority, separate from durable pin state. */
|
|
444
|
+
authorization?: KnowledgeAttachmentAuthorization;
|
|
445
|
+
id: string;
|
|
446
|
+
sourceId: string;
|
|
447
|
+
sandboxId: string;
|
|
448
|
+
generation: string;
|
|
449
|
+
status: "active" | "detached";
|
|
450
|
+
}
|
|
451
|
+
interface KnowledgeSourceCreate {
|
|
452
|
+
requestId: string;
|
|
453
|
+
name: string;
|
|
454
|
+
source: KnowledgeSourceInput;
|
|
455
|
+
target?: {
|
|
456
|
+
kind: "lexical";
|
|
457
|
+
} | {
|
|
458
|
+
kind: "managed-vector";
|
|
459
|
+
provider: "qdrant";
|
|
460
|
+
connectionId: string;
|
|
461
|
+
embedding: KnowledgeEmbeddingSpace;
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
/** Owner-only management. Runtime tools use HubKnowledgeClient.query instead. */
|
|
465
|
+
interface KnowledgeAuthorization {
|
|
466
|
+
userId: string;
|
|
467
|
+
clientId: string;
|
|
468
|
+
resource: string;
|
|
469
|
+
scopes: Array<"knowledge:read" | "knowledge:write">;
|
|
470
|
+
}
|
|
471
|
+
declare class HubKnowledgeManagementClient {
|
|
472
|
+
private readonly request;
|
|
473
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
|
|
474
|
+
materialize(input: {
|
|
475
|
+
sandboxId: string;
|
|
476
|
+
references: KnowledgeReference[];
|
|
477
|
+
}): Promise<KnowledgeAttachment[]>;
|
|
478
|
+
authorization(): Promise<KnowledgeAuthorization>;
|
|
479
|
+
disconnectAuthorization(): Promise<{
|
|
480
|
+
revoked: true;
|
|
481
|
+
}>;
|
|
482
|
+
capabilities(): Promise<KnowledgeCapabilities>;
|
|
483
|
+
list(): Promise<KnowledgeSourceSummary[]>;
|
|
484
|
+
get(sourceId: string): Promise<KnowledgeSourceSummary>;
|
|
485
|
+
create(input: KnowledgeSourceCreate): Promise<KnowledgeSourceSummary>;
|
|
486
|
+
refresh(sourceId: string, input: {
|
|
487
|
+
requestId: string;
|
|
488
|
+
approvalToken?: string;
|
|
489
|
+
}): Promise<KnowledgeSourceSummary>;
|
|
490
|
+
attach(sourceId: string, input: {
|
|
491
|
+
sandboxId: string;
|
|
492
|
+
generation: string;
|
|
493
|
+
expectedGeneration?: string;
|
|
494
|
+
}): Promise<KnowledgeAttachment>;
|
|
495
|
+
attachments(sandboxId?: string): Promise<KnowledgeAttachment[]>;
|
|
496
|
+
detach(attachmentId: string): Promise<KnowledgeAttachment>;
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/knowledge.d.ts
|
|
500
|
+
interface HubKnowledgeRetrievalResult {
|
|
501
|
+
attachmentId: string;
|
|
502
|
+
generation: string;
|
|
503
|
+
provenance: "ingested" | "record-supplied";
|
|
504
|
+
hits: Array<{
|
|
505
|
+
id: string;
|
|
506
|
+
title: string;
|
|
507
|
+
snippet: string;
|
|
508
|
+
score?: number;
|
|
509
|
+
citations?: Array<{
|
|
510
|
+
sourceId: string;
|
|
511
|
+
sourceUri: string;
|
|
512
|
+
revision?: string;
|
|
513
|
+
}>;
|
|
514
|
+
}>;
|
|
515
|
+
elapsedMs?: number;
|
|
516
|
+
}
|
|
517
|
+
interface HubKnowledgeQueryResult {
|
|
518
|
+
results: HubKnowledgeRetrievalResult[];
|
|
519
|
+
/** Individual unavailable sources do not hide evidence from healthy sources. */
|
|
520
|
+
failures: Array<{
|
|
521
|
+
attachmentId: string;
|
|
522
|
+
code: string;
|
|
523
|
+
message: string;
|
|
524
|
+
}>;
|
|
525
|
+
partial: boolean;
|
|
526
|
+
}
|
|
527
|
+
/** Runtime-only retrieval. The authenticated sandbox credential determines the
|
|
528
|
+
* scope on the server; neither a caller nor an agent can supply another scope. */
|
|
529
|
+
declare class HubKnowledgeClient {
|
|
530
|
+
private readonly request;
|
|
531
|
+
readonly management: HubKnowledgeManagementClient;
|
|
532
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
|
|
533
|
+
bindings(): Promise<{
|
|
534
|
+
references: KnowledgeReference[];
|
|
535
|
+
}>;
|
|
536
|
+
query(input: {
|
|
537
|
+
query: string;
|
|
538
|
+
limit?: number;
|
|
539
|
+
expectedReferences?: KnowledgeReference[];
|
|
540
|
+
}, options?: {
|
|
541
|
+
signal?: AbortSignal;
|
|
542
|
+
}): Promise<HubKnowledgeQueryResult>;
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region src/audit-types.d.ts
|
|
546
|
+
interface HubAuditEvent {
|
|
547
|
+
id: string;
|
|
548
|
+
action: string;
|
|
549
|
+
targetUserId: string | null;
|
|
550
|
+
targetKeyId: string | null;
|
|
551
|
+
metadata: unknown;
|
|
552
|
+
createdAt: string;
|
|
553
|
+
}
|
|
554
|
+
interface HubAuditListRequest {
|
|
555
|
+
provider?: string;
|
|
556
|
+
action?: string;
|
|
557
|
+
status?: string;
|
|
558
|
+
since?: string;
|
|
559
|
+
until?: string;
|
|
560
|
+
cursor?: string;
|
|
561
|
+
limit?: number;
|
|
562
|
+
}
|
|
563
|
+
interface HubAuditResponse {
|
|
564
|
+
events: HubAuditEvent[];
|
|
565
|
+
nextCursor: string | null;
|
|
566
|
+
}
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/transport-types.d.ts
|
|
569
|
+
type HubPrincipalKind = "user_session" | "api_key" | "sandbox_runtime";
|
|
570
|
+
interface HubSuccessEnvelope<TData> {
|
|
571
|
+
success: true;
|
|
572
|
+
data: TData;
|
|
573
|
+
}
|
|
574
|
+
interface HubErrorEnvelope {
|
|
575
|
+
success: false;
|
|
576
|
+
error: HubErrorBody;
|
|
577
|
+
}
|
|
578
|
+
type HubEnvelope<TData> = HubSuccessEnvelope<TData> | HubErrorEnvelope;
|
|
579
|
+
interface HubErrorBody {
|
|
580
|
+
code: HubErrorCode;
|
|
581
|
+
message: string;
|
|
582
|
+
details?: unknown;
|
|
583
|
+
}
|
|
584
|
+
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}`;
|
|
585
|
+
interface HubStatusResponse {
|
|
586
|
+
contract: unknown;
|
|
587
|
+
principal: HubPrincipal;
|
|
588
|
+
connections: HubStatusConnections;
|
|
589
|
+
}
|
|
590
|
+
interface HubPrincipal {
|
|
591
|
+
kind: HubPrincipalKind;
|
|
592
|
+
userId: string;
|
|
593
|
+
apiKeyId?: string;
|
|
594
|
+
sandboxId?: string;
|
|
595
|
+
requestId?: string;
|
|
596
|
+
}
|
|
597
|
+
interface HubStatusConnections {
|
|
598
|
+
connectedProviderCount: number;
|
|
599
|
+
unhealthyProviderCount: number;
|
|
600
|
+
}
|
|
601
|
+
interface HubUnimplementedErrorEnvelope extends HubErrorEnvelope {
|
|
602
|
+
error: HubErrorEnvelope["error"] & {
|
|
603
|
+
code: "HUB_NOT_IMPLEMENTED";
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region src/authorization-types.d.ts
|
|
608
|
+
interface HubTokenMintRequest {
|
|
609
|
+
connectionId?: string;
|
|
610
|
+
provider?: string;
|
|
611
|
+
actionPath: string;
|
|
612
|
+
ttlSeconds?: number;
|
|
613
|
+
}
|
|
614
|
+
interface HubTokenMintResponse {
|
|
615
|
+
token: string;
|
|
616
|
+
tokenId: string;
|
|
617
|
+
expiresAt: string;
|
|
618
|
+
}
|
|
619
|
+
interface HubCapabilityToken {
|
|
620
|
+
id: string;
|
|
621
|
+
providerId: string;
|
|
622
|
+
connectionId: string;
|
|
623
|
+
connectionDisplay: string | null;
|
|
624
|
+
actionPath: string;
|
|
625
|
+
expiresAt: string;
|
|
626
|
+
status: "active" | "consumed" | "expired" | "revoked";
|
|
627
|
+
principalKind: HubPrincipalKind;
|
|
628
|
+
createdAt: string;
|
|
629
|
+
}
|
|
630
|
+
interface HubTokensListResponse {
|
|
631
|
+
tokens: HubCapabilityToken[];
|
|
632
|
+
}
|
|
633
|
+
interface HubTokenRevokeResponse {
|
|
634
|
+
tokenId: string;
|
|
635
|
+
status: HubCapabilityToken["status"];
|
|
636
|
+
}
|
|
637
|
+
type HubPolicyDecision = "allow" | "ask" | "deny";
|
|
638
|
+
interface HubPolicyUpdateRequest {
|
|
639
|
+
connectionId: string;
|
|
640
|
+
actionPath: string;
|
|
641
|
+
decision: HubPolicyDecision;
|
|
642
|
+
}
|
|
643
|
+
interface HubPolicyListRequest {
|
|
644
|
+
connectionId: string;
|
|
645
|
+
}
|
|
646
|
+
interface HubPolicyDeleteRequest {
|
|
647
|
+
connectionId: string;
|
|
648
|
+
actionPath: string;
|
|
649
|
+
}
|
|
650
|
+
interface HubPolicyDeleteResponse {
|
|
651
|
+
connectionId: string;
|
|
652
|
+
actionPath: string;
|
|
653
|
+
/** Whether a stored override existed and was removed (false = already default). */
|
|
654
|
+
deleted: boolean;
|
|
655
|
+
}
|
|
656
|
+
interface HubPolicy {
|
|
657
|
+
id: string;
|
|
658
|
+
connectionId: string;
|
|
659
|
+
providerId: string;
|
|
660
|
+
actionPath: string;
|
|
661
|
+
decision: HubPolicyDecision;
|
|
662
|
+
createdAt: string;
|
|
663
|
+
updatedAt: string;
|
|
664
|
+
}
|
|
665
|
+
interface HubPolicyResponse {
|
|
666
|
+
policy: HubPolicy;
|
|
667
|
+
}
|
|
668
|
+
interface HubPolicyListResponse {
|
|
669
|
+
policies: HubPolicy[];
|
|
670
|
+
}
|
|
671
|
+
interface HubAllowWritesResponse {
|
|
672
|
+
connectionId: string;
|
|
673
|
+
providerId: string;
|
|
674
|
+
/** Write actions the connection's provider exposes. */
|
|
675
|
+
writeActions: number;
|
|
676
|
+
/** Rows newly created (excludes actions that already had a policy). */
|
|
677
|
+
granted: number;
|
|
678
|
+
actionPaths: string[];
|
|
679
|
+
}
|
|
680
|
+
interface HubRevertWritesResponse {
|
|
681
|
+
connectionId: string;
|
|
682
|
+
/** `allow_writes` rows deleted. */
|
|
683
|
+
reverted: number;
|
|
684
|
+
}
|
|
685
|
+
type HubApprovalStatus = "pending" | "approved" | "denied" | "expired" | "consumed";
|
|
686
|
+
interface HubApproval {
|
|
687
|
+
id: string;
|
|
688
|
+
connectionId: string;
|
|
689
|
+
providerId: string;
|
|
690
|
+
actionPath: string;
|
|
691
|
+
inputHash: string;
|
|
692
|
+
requesterPrincipal: Record<string, unknown>;
|
|
693
|
+
status: HubApprovalStatus;
|
|
694
|
+
requestedAt: string;
|
|
695
|
+
expiresAt: string;
|
|
696
|
+
resolvedAt: string | null;
|
|
697
|
+
}
|
|
698
|
+
interface HubApprovalCapabilityToken {
|
|
699
|
+
tokenId: string;
|
|
700
|
+
token: string;
|
|
701
|
+
expiresAt: string;
|
|
702
|
+
}
|
|
703
|
+
interface HubApprovalDecisionResponse {
|
|
704
|
+
approval: HubApproval;
|
|
705
|
+
capabilityToken?: HubApprovalCapabilityToken;
|
|
706
|
+
}
|
|
707
|
+
interface HubApprovalListResponse {
|
|
708
|
+
approvals: HubApproval[];
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region src/channel-types.d.ts
|
|
712
|
+
interface HubEmailChannel {
|
|
713
|
+
id: string;
|
|
714
|
+
kind: "email";
|
|
715
|
+
providerId: "email";
|
|
716
|
+
connectionId: string;
|
|
717
|
+
clientReference: string | null;
|
|
718
|
+
label: string | null;
|
|
719
|
+
address: string;
|
|
720
|
+
status: "active";
|
|
721
|
+
createdAt: string;
|
|
722
|
+
updatedAt: string;
|
|
723
|
+
}
|
|
724
|
+
type HubChannel = HubEmailChannel;
|
|
725
|
+
interface HubChannelsResponse {
|
|
726
|
+
channels: HubChannel[];
|
|
727
|
+
}
|
|
728
|
+
interface HubEmailChannelCreateRequest {
|
|
729
|
+
/**
|
|
730
|
+
* Product-owned idempotency key. Retrying the same request returns the
|
|
731
|
+
* original mailbox instead of provisioning another address.
|
|
732
|
+
*/
|
|
733
|
+
clientReference?: string;
|
|
734
|
+
label?: string;
|
|
735
|
+
}
|
|
736
|
+
interface HubChannelCreateResponse {
|
|
737
|
+
channel: HubChannel;
|
|
738
|
+
/** True only when this request created the channel. */
|
|
739
|
+
created: boolean;
|
|
740
|
+
}
|
|
741
|
+
interface HubChannelDeleteResponse {
|
|
742
|
+
removed: true;
|
|
743
|
+
}
|
|
744
|
+
type HubEventConditionScalar = string | number | boolean | null;
|
|
745
|
+
type HubEventCondition = {
|
|
746
|
+
path: string;
|
|
747
|
+
op: "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
|
|
748
|
+
value?: HubEventConditionScalar | HubEventConditionScalar[];
|
|
749
|
+
} | {
|
|
750
|
+
all: HubEventCondition[];
|
|
751
|
+
} | {
|
|
752
|
+
any: HubEventCondition[];
|
|
753
|
+
} | {
|
|
754
|
+
not: HubEventCondition;
|
|
755
|
+
};
|
|
756
|
+
interface HubEventSubscriptionFilter {
|
|
757
|
+
action?: string;
|
|
758
|
+
repo?: string;
|
|
759
|
+
when?: HubEventCondition;
|
|
760
|
+
}
|
|
761
|
+
type HubEventSubscriptionSource = {
|
|
762
|
+
type: "channel";
|
|
763
|
+
channelId: string;
|
|
764
|
+
} | {
|
|
765
|
+
type: "connection";
|
|
766
|
+
connectionId: string;
|
|
767
|
+
};
|
|
768
|
+
interface HubEventSubscriptionCallback {
|
|
769
|
+
url: string;
|
|
770
|
+
secret: string;
|
|
771
|
+
}
|
|
772
|
+
interface HubEventSubscriptionCreateRequest {
|
|
773
|
+
/**
|
|
774
|
+
* Product-owned idempotency key. Reusing it with the same source and filter
|
|
775
|
+
* returns the existing subscription; reusing it for different input fails.
|
|
776
|
+
*/
|
|
777
|
+
clientReference: string;
|
|
778
|
+
label?: string;
|
|
779
|
+
source: HubEventSubscriptionSource;
|
|
780
|
+
event: string;
|
|
781
|
+
filter?: HubEventSubscriptionFilter;
|
|
782
|
+
callback: HubEventSubscriptionCallback;
|
|
783
|
+
}
|
|
784
|
+
interface HubEventSubscription {
|
|
785
|
+
id: string;
|
|
786
|
+
clientReference: string;
|
|
787
|
+
label: string | null;
|
|
788
|
+
source: HubEventSubscriptionSource;
|
|
789
|
+
providerId: string;
|
|
790
|
+
connectionId: string;
|
|
791
|
+
event: string;
|
|
792
|
+
filter: HubEventSubscriptionFilter;
|
|
793
|
+
workflowId: string;
|
|
794
|
+
status: "active" | "error";
|
|
795
|
+
lastError: string | null;
|
|
796
|
+
createdAt: string;
|
|
797
|
+
updatedAt: string;
|
|
378
798
|
}
|
|
379
799
|
interface HubEventSubscriptionsResponse {
|
|
380
800
|
subscriptions: HubEventSubscription[];
|
|
@@ -409,6 +829,24 @@ interface HubEventDelivery {
|
|
|
409
829
|
providerEvent: HubProviderEvent;
|
|
410
830
|
firedAt: string;
|
|
411
831
|
}
|
|
832
|
+
//#endregion
|
|
833
|
+
//#region src/connection-types.d.ts
|
|
834
|
+
interface HubConnection {
|
|
835
|
+
id: string;
|
|
836
|
+
providerId: string;
|
|
837
|
+
displayName: string;
|
|
838
|
+
accountDisplay: string | null;
|
|
839
|
+
providerAccountId: string | null;
|
|
840
|
+
scopes: string[];
|
|
841
|
+
status: "active" | "revoked" | "unhealthy" | "reconnect_required";
|
|
842
|
+
health: "unknown" | "healthy" | "unhealthy" | "rate_limited";
|
|
843
|
+
createdAt: string;
|
|
844
|
+
updatedAt: string;
|
|
845
|
+
lastUsedAt: string | null;
|
|
846
|
+
}
|
|
847
|
+
interface HubConnectionsResponse {
|
|
848
|
+
connections: HubConnection[];
|
|
849
|
+
}
|
|
412
850
|
/** A connector's auth model. */
|
|
413
851
|
type HubProviderAuthKind = "oauth2" | "api_key" | "none" | "custom";
|
|
414
852
|
/** One non-secret value needed before an OAuth redirect can be built. Tenant-
|
|
@@ -570,193 +1008,8 @@ interface HubConnectionHealthResponse {
|
|
|
570
1008
|
connection: HubConnection;
|
|
571
1009
|
health: HubConnectionHealthInfo;
|
|
572
1010
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
providerId: string;
|
|
576
|
-
displayName: string;
|
|
577
|
-
toolCount: number;
|
|
578
|
-
connectionStatus: "connected" | "missing" | "unknown";
|
|
579
|
-
health: "healthy" | "unhealthy" | "rate_limited" | "unknown";
|
|
580
|
-
configured: boolean;
|
|
581
|
-
}
|
|
582
|
-
/** Per-tool catalog risk class. The first three mirror the platform's
|
|
583
|
-
* `HubActionRisk`; `unknown` is surfaced honestly for tools the catalog can't
|
|
584
|
-
* classify (substrate connectors). */
|
|
585
|
-
type HubToolRisk = "read" | "write" | "destructive" | "unknown";
|
|
586
|
-
interface HubTool {
|
|
587
|
-
path: string;
|
|
588
|
-
providerId?: string;
|
|
589
|
-
title?: string;
|
|
590
|
-
description?: string;
|
|
591
|
-
inputSchema?: unknown;
|
|
592
|
-
outputSchema?: unknown;
|
|
593
|
-
connectionRequired?: boolean;
|
|
594
|
-
connectionStatus?: "connected" | "missing" | "unknown";
|
|
595
|
-
requiredConnectionProviderId?: string;
|
|
596
|
-
policyState?: "allow" | "ask" | "deny" | "unknown";
|
|
597
|
-
risk?: HubToolRisk;
|
|
598
|
-
}
|
|
599
|
-
interface HubToolSourcesResponse {
|
|
600
|
-
sources: HubToolSource[];
|
|
601
|
-
}
|
|
602
|
-
interface HubToolsSearchRequest {
|
|
603
|
-
query: string;
|
|
604
|
-
provider?: string;
|
|
605
|
-
}
|
|
606
|
-
interface HubToolsSearchResponse {
|
|
607
|
-
tools: HubTool[];
|
|
608
|
-
}
|
|
609
|
-
interface HubToolsDescribeRequest {
|
|
610
|
-
path: string;
|
|
611
|
-
}
|
|
612
|
-
interface HubToolsDescribeResponse {
|
|
613
|
-
tool: HubTool;
|
|
614
|
-
}
|
|
615
|
-
interface HubExecRequest {
|
|
616
|
-
path: string;
|
|
617
|
-
input?: unknown;
|
|
618
|
-
connectionId?: string;
|
|
619
|
-
/** Caller-minted key for this exec. The platform ledger replays the first
|
|
620
|
-
* call's result for a retry that carries the same key, and rejects a key
|
|
621
|
-
* reused for a different request. On the capability-token arm the key only
|
|
622
|
-
* reaches the connector for provider-native dedupe: that arm is at-most-once
|
|
623
|
-
* per token and replays no stored result. */
|
|
624
|
-
idempotencyKey?: string;
|
|
625
|
-
}
|
|
626
|
-
interface HubExecResponse<TResult = unknown> {
|
|
627
|
-
result: TResult;
|
|
628
|
-
/** True when the result was replayed from a previous call with the same
|
|
629
|
-
* idempotency key, so the action did not run again. */
|
|
630
|
-
replayed?: boolean;
|
|
631
|
-
}
|
|
632
|
-
interface HubTokenMintRequest {
|
|
633
|
-
connectionId?: string;
|
|
634
|
-
provider?: string;
|
|
635
|
-
actionPath: string;
|
|
636
|
-
ttlSeconds?: number;
|
|
637
|
-
}
|
|
638
|
-
interface HubTokenMintResponse {
|
|
639
|
-
token: string;
|
|
640
|
-
tokenId: string;
|
|
641
|
-
expiresAt: string;
|
|
642
|
-
}
|
|
643
|
-
interface HubCapabilityToken {
|
|
644
|
-
id: string;
|
|
645
|
-
providerId: string;
|
|
646
|
-
connectionId: string;
|
|
647
|
-
connectionDisplay: string | null;
|
|
648
|
-
actionPath: string;
|
|
649
|
-
expiresAt: string;
|
|
650
|
-
status: "active" | "consumed" | "expired" | "revoked";
|
|
651
|
-
principalKind: HubPrincipalKind;
|
|
652
|
-
createdAt: string;
|
|
653
|
-
}
|
|
654
|
-
interface HubTokensListResponse {
|
|
655
|
-
tokens: HubCapabilityToken[];
|
|
656
|
-
}
|
|
657
|
-
interface HubTokenRevokeResponse {
|
|
658
|
-
tokenId: string;
|
|
659
|
-
status: HubCapabilityToken["status"];
|
|
660
|
-
}
|
|
661
|
-
type HubPolicyDecision = "allow" | "ask" | "deny";
|
|
662
|
-
interface HubPolicyUpdateRequest {
|
|
663
|
-
connectionId: string;
|
|
664
|
-
actionPath: string;
|
|
665
|
-
decision: HubPolicyDecision;
|
|
666
|
-
}
|
|
667
|
-
interface HubPolicyListRequest {
|
|
668
|
-
connectionId: string;
|
|
669
|
-
}
|
|
670
|
-
interface HubPolicyDeleteRequest {
|
|
671
|
-
connectionId: string;
|
|
672
|
-
actionPath: string;
|
|
673
|
-
}
|
|
674
|
-
interface HubPolicyDeleteResponse {
|
|
675
|
-
connectionId: string;
|
|
676
|
-
actionPath: string;
|
|
677
|
-
/** Whether a stored override existed and was removed (false = already default). */
|
|
678
|
-
deleted: boolean;
|
|
679
|
-
}
|
|
680
|
-
interface HubPolicy {
|
|
681
|
-
id: string;
|
|
682
|
-
connectionId: string;
|
|
683
|
-
providerId: string;
|
|
684
|
-
actionPath: string;
|
|
685
|
-
decision: HubPolicyDecision;
|
|
686
|
-
createdAt: string;
|
|
687
|
-
updatedAt: string;
|
|
688
|
-
}
|
|
689
|
-
interface HubPolicyResponse {
|
|
690
|
-
policy: HubPolicy;
|
|
691
|
-
}
|
|
692
|
-
interface HubPolicyListResponse {
|
|
693
|
-
policies: HubPolicy[];
|
|
694
|
-
}
|
|
695
|
-
interface HubAllowWritesResponse {
|
|
696
|
-
connectionId: string;
|
|
697
|
-
providerId: string;
|
|
698
|
-
/** Write actions the connection's provider exposes. */
|
|
699
|
-
writeActions: number;
|
|
700
|
-
/** Rows newly created (excludes actions that already had a policy). */
|
|
701
|
-
granted: number;
|
|
702
|
-
actionPaths: string[];
|
|
703
|
-
}
|
|
704
|
-
interface HubRevertWritesResponse {
|
|
705
|
-
connectionId: string;
|
|
706
|
-
/** `allow_writes` rows deleted. */
|
|
707
|
-
reverted: number;
|
|
708
|
-
}
|
|
709
|
-
type HubApprovalStatus = "pending" | "approved" | "denied" | "expired" | "consumed";
|
|
710
|
-
interface HubApproval {
|
|
711
|
-
id: string;
|
|
712
|
-
connectionId: string;
|
|
713
|
-
providerId: string;
|
|
714
|
-
actionPath: string;
|
|
715
|
-
inputHash: string;
|
|
716
|
-
requesterPrincipal: Record<string, unknown>;
|
|
717
|
-
status: HubApprovalStatus;
|
|
718
|
-
requestedAt: string;
|
|
719
|
-
expiresAt: string;
|
|
720
|
-
resolvedAt: string | null;
|
|
721
|
-
}
|
|
722
|
-
interface HubApprovalCapabilityToken {
|
|
723
|
-
tokenId: string;
|
|
724
|
-
token: string;
|
|
725
|
-
expiresAt: string;
|
|
726
|
-
}
|
|
727
|
-
interface HubApprovalDecisionResponse {
|
|
728
|
-
approval: HubApproval;
|
|
729
|
-
capabilityToken?: HubApprovalCapabilityToken;
|
|
730
|
-
}
|
|
731
|
-
interface HubApprovalListResponse {
|
|
732
|
-
approvals: HubApproval[];
|
|
733
|
-
}
|
|
734
|
-
interface HubAuditEvent {
|
|
735
|
-
id: string;
|
|
736
|
-
action: string;
|
|
737
|
-
targetUserId: string | null;
|
|
738
|
-
targetKeyId: string | null;
|
|
739
|
-
metadata: unknown;
|
|
740
|
-
createdAt: string;
|
|
741
|
-
}
|
|
742
|
-
interface HubAuditListRequest {
|
|
743
|
-
provider?: string;
|
|
744
|
-
action?: string;
|
|
745
|
-
status?: string;
|
|
746
|
-
since?: string;
|
|
747
|
-
until?: string;
|
|
748
|
-
cursor?: string;
|
|
749
|
-
limit?: number;
|
|
750
|
-
}
|
|
751
|
-
interface HubAuditResponse {
|
|
752
|
-
events: HubAuditEvent[];
|
|
753
|
-
nextCursor: string | null;
|
|
754
|
-
}
|
|
755
|
-
interface HubUnimplementedErrorEnvelope extends HubErrorEnvelope {
|
|
756
|
-
error: HubErrorEnvelope["error"] & {
|
|
757
|
-
code: "HUB_NOT_IMPLEMENTED";
|
|
758
|
-
};
|
|
759
|
-
}
|
|
1011
|
+
//#endregion
|
|
1012
|
+
//#region src/github-app-types.d.ts
|
|
760
1013
|
interface HubGithubAppMintInstallationTokenRequest {
|
|
761
1014
|
/** HTTPS or SSH GitHub URL — alternative to installationId. */
|
|
762
1015
|
repoUrl?: string;
|
|
@@ -847,40 +1100,50 @@ interface HubGithubAppIsRepoInstalledRequest {
|
|
|
847
1100
|
owner: string;
|
|
848
1101
|
repo: string;
|
|
849
1102
|
}
|
|
850
|
-
interface HubGithubAppIsRepoInstalledResponse {
|
|
851
|
-
installed: boolean;
|
|
852
|
-
installationId: number | null;
|
|
853
|
-
}
|
|
854
|
-
interface HubWorkflowAction {
|
|
855
|
-
kind: string;
|
|
856
|
-
config: Record<string, unknown>;
|
|
857
|
-
}
|
|
858
|
-
/** Inbound-event matcher for a `provider_event` trigger. */
|
|
859
|
-
interface HubWorkflowEventFilter {
|
|
860
|
-
event: string;
|
|
861
|
-
action?: string;
|
|
862
|
-
repo?: string;
|
|
863
|
-
}
|
|
864
|
-
interface HubWorkflowTrigger {
|
|
865
|
-
id: string;
|
|
866
|
-
kind: "provider_event" | "schedule" | "webhook";
|
|
867
|
-
enabled: boolean;
|
|
868
|
-
provider: string | null;
|
|
869
|
-
connectionId: string | null;
|
|
870
|
-
eventFilter: HubWorkflowEventFilter | null;
|
|
871
|
-
cron: string | null;
|
|
872
|
-
timezone: string | null;
|
|
873
|
-
nextFireAt: string | null;
|
|
874
|
-
lastFiredAt: string | null;
|
|
875
|
-
/** Schedule only: the ISO-8601 instant it stops firing; null when unbounded. */
|
|
876
|
-
until: string | null;
|
|
1103
|
+
interface HubGithubAppIsRepoInstalledResponse {
|
|
1104
|
+
installed: boolean;
|
|
1105
|
+
installationId: number | null;
|
|
877
1106
|
}
|
|
878
|
-
|
|
1107
|
+
//#endregion
|
|
1108
|
+
//#region src/workflow-graph-types.d.ts
|
|
1109
|
+
/** How a node's incoming edges release it (default `"all"` — omitted on the
|
|
1110
|
+
* wire for it, so specs compiled before join rules existed round-trip). */
|
|
1111
|
+
type HubWorkflowGraphJoinRule = "all" | "any" | "any_failed" | "all_done";
|
|
1112
|
+
type HubWorkflowConditionOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
|
|
1113
|
+
type HubWorkflowConditionScalar = string | number | boolean | null;
|
|
1114
|
+
/** The predicate on a guarded edge (`needs: [{ id, when }]`), evaluated by the
|
|
1115
|
+
* runner against the steps context on the source node's completion. */
|
|
1116
|
+
type HubWorkflowCondition = {
|
|
879
1117
|
path: string;
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
1118
|
+
op: HubWorkflowConditionOp;
|
|
1119
|
+
value?: HubWorkflowConditionScalar | HubWorkflowConditionScalar[];
|
|
1120
|
+
} | {
|
|
1121
|
+
all: HubWorkflowCondition[];
|
|
1122
|
+
} | {
|
|
1123
|
+
any: HubWorkflowCondition[];
|
|
1124
|
+
} | {
|
|
1125
|
+
not: HubWorkflowCondition;
|
|
1126
|
+
};
|
|
1127
|
+
interface HubWorkflowGraphNode {
|
|
1128
|
+
id: string;
|
|
1129
|
+
index: number;
|
|
1130
|
+
join?: HubWorkflowGraphJoinRule;
|
|
1131
|
+
}
|
|
1132
|
+
interface HubWorkflowGraphEdge {
|
|
1133
|
+
from: string;
|
|
1134
|
+
to: string;
|
|
1135
|
+
/** Guard the runner evaluates on the source's completion; unguarded edges
|
|
1136
|
+
* carry no `when`. */
|
|
1137
|
+
when?: HubWorkflowCondition;
|
|
1138
|
+
}
|
|
1139
|
+
/** JSON-serializable form of a validated graph (as stored on run/workflow rows). */
|
|
1140
|
+
interface HubWorkflowGraphSpec {
|
|
1141
|
+
nodes: HubWorkflowGraphNode[];
|
|
1142
|
+
edges: HubWorkflowGraphEdge[];
|
|
1143
|
+
maxNodeVisits: number;
|
|
883
1144
|
}
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region src/workflow-run-types.d.ts
|
|
884
1147
|
type HubWorkflowRunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
|
|
885
1148
|
/** One agent iteration of an `agent.run`, as the single-run detail carries it
|
|
886
1149
|
* (JSON-clean ISO timestamps) — including the round's own output `text`. */
|
|
@@ -1129,91 +1392,6 @@ interface HubWorkflowFleetInsights {
|
|
|
1129
1392
|
windowStart: string;
|
|
1130
1393
|
workflows: HubWorkflowFleetEntry[];
|
|
1131
1394
|
}
|
|
1132
|
-
interface HubWorkflow {
|
|
1133
|
-
id: string;
|
|
1134
|
-
name: string;
|
|
1135
|
-
description: string | null;
|
|
1136
|
-
enabled: boolean;
|
|
1137
|
-
/** Compiled engine actions (connection refs resolved to ids). */
|
|
1138
|
-
actions: HubWorkflowAction[];
|
|
1139
|
-
/** The durable YAML this workflow compiled from. */
|
|
1140
|
-
definitionYaml: string | null;
|
|
1141
|
-
validationErrors: HubWorkflowValidationError[];
|
|
1142
|
-
/** Current head revision; null on pre-versioning rows until their next
|
|
1143
|
-
* update (they have no revision history to point at yet). */
|
|
1144
|
-
headRev?: number | null;
|
|
1145
|
-
/** Present on get/create/update detail responses; omitted on list. */
|
|
1146
|
-
triggers?: HubWorkflowTrigger[];
|
|
1147
|
-
/** Present on the detail response: the trigger fields a manual run must supply,
|
|
1148
|
-
* derived from the definition's `${trigger.*}` references (empty when none). */
|
|
1149
|
-
manualRunInputs?: HubManualRunInput[];
|
|
1150
|
-
/** Present on the get-detail response: the compiled graph topology (null
|
|
1151
|
-
* when the definition has no graph topology, or is chain-equivalent —
|
|
1152
|
-
* the legacy linear semantics). Omitted on the list projection. */
|
|
1153
|
-
graph?: HubWorkflowGraphSpec | null;
|
|
1154
|
-
/** Create response only, when the definition has a webhook trigger: the
|
|
1155
|
-
* hook delivery URL, plus the plaintext bearer token exactly once at mint
|
|
1156
|
-
* (absent when an active token already exists — rotate to re-reveal). */
|
|
1157
|
-
hook?: HubWorkflowHookEndpoint;
|
|
1158
|
-
/** Present on the list response (latest run, or null if never run); omitted on detail. */
|
|
1159
|
-
lastRun?: HubWorkflowRunSummary | null;
|
|
1160
|
-
createdAt: string;
|
|
1161
|
-
updatedAt: string;
|
|
1162
|
-
}
|
|
1163
|
-
/** A trigger field a manual "Run now" must supply (derived from the
|
|
1164
|
-
* definition's `${trigger.*}` references). `required` is false only when every
|
|
1165
|
-
* read is wrapped in a `default(...)`. */
|
|
1166
|
-
interface HubManualRunInput {
|
|
1167
|
-
path: string;
|
|
1168
|
-
required: boolean;
|
|
1169
|
-
}
|
|
1170
|
-
type HubWorkflowValidateResponse = {
|
|
1171
|
-
valid: true;
|
|
1172
|
-
name: string;
|
|
1173
|
-
actionCount: number;
|
|
1174
|
-
triggerCount: number;
|
|
1175
|
-
} | {
|
|
1176
|
-
valid: false;
|
|
1177
|
-
errors: HubWorkflowValidationError[];
|
|
1178
|
-
};
|
|
1179
|
-
/** JSON Schema for the YAML workflow definition. */
|
|
1180
|
-
type HubWorkflowSchemaResponse = Record<string, unknown>;
|
|
1181
|
-
/** How a node's incoming edges release it (default `"all"` — omitted on the
|
|
1182
|
-
* wire for it, so specs compiled before join rules existed round-trip). */
|
|
1183
|
-
type HubWorkflowGraphJoinRule = "all" | "any" | "any_failed" | "all_done";
|
|
1184
|
-
type HubWorkflowConditionOp = "eq" | "neq" | "gt" | "gte" | "lt" | "lte" | "in" | "contains" | "exists" | "truthy";
|
|
1185
|
-
type HubWorkflowConditionScalar = string | number | boolean | null;
|
|
1186
|
-
/** The predicate on a guarded edge (`needs: [{ id, when }]`), evaluated by the
|
|
1187
|
-
* runner against the steps context on the source node's completion. */
|
|
1188
|
-
type HubWorkflowCondition = {
|
|
1189
|
-
path: string;
|
|
1190
|
-
op: HubWorkflowConditionOp;
|
|
1191
|
-
value?: HubWorkflowConditionScalar | HubWorkflowConditionScalar[];
|
|
1192
|
-
} | {
|
|
1193
|
-
all: HubWorkflowCondition[];
|
|
1194
|
-
} | {
|
|
1195
|
-
any: HubWorkflowCondition[];
|
|
1196
|
-
} | {
|
|
1197
|
-
not: HubWorkflowCondition;
|
|
1198
|
-
};
|
|
1199
|
-
interface HubWorkflowGraphNode {
|
|
1200
|
-
id: string;
|
|
1201
|
-
index: number;
|
|
1202
|
-
join?: HubWorkflowGraphJoinRule;
|
|
1203
|
-
}
|
|
1204
|
-
interface HubWorkflowGraphEdge {
|
|
1205
|
-
from: string;
|
|
1206
|
-
to: string;
|
|
1207
|
-
/** Guard the runner evaluates on the source's completion; unguarded edges
|
|
1208
|
-
* carry no `when`. */
|
|
1209
|
-
when?: HubWorkflowCondition;
|
|
1210
|
-
}
|
|
1211
|
-
/** JSON-serializable form of a validated graph (as stored on run/workflow rows). */
|
|
1212
|
-
interface HubWorkflowGraphSpec {
|
|
1213
|
-
nodes: HubWorkflowGraphNode[];
|
|
1214
|
-
edges: HubWorkflowGraphEdge[];
|
|
1215
|
-
maxNodeVisits: number;
|
|
1216
|
-
}
|
|
1217
1395
|
/** One journal completion on the wire: the node that completed and the guard
|
|
1218
1396
|
* verdict evaluated for each of its guarded outgoing edges, keyed by edgeKey
|
|
1219
1397
|
* (`"from->to"`). Only GUARDED edges ever appear. */
|
|
@@ -1234,187 +1412,43 @@ interface HubWorkflowOnErrorOutcome {
|
|
|
1234
1412
|
costUsd?: number;
|
|
1235
1413
|
};
|
|
1236
1414
|
}
|
|
1237
|
-
type HubWorkflowRevisionSource = "user" | "copilot" | "intelligence";
|
|
1238
|
-
/** Lifecycle state of a revision. The head rev only ever points at an
|
|
1239
|
-
* `applied` revision; `proposed` is a service-token-authored suggestion
|
|
1240
|
-
* awaiting an owner decision; `rejected` is a declined proposal (kept for
|
|
1241
|
-
* audit). */
|
|
1242
|
-
type HubWorkflowRevisionStatus = "applied" | "proposed" | "rejected";
|
|
1243
|
-
/** Revision list projection — attribution + note + status, WITHOUT the YAML body. */
|
|
1244
|
-
interface HubWorkflowRevisionMeta {
|
|
1245
|
-
rev: number;
|
|
1246
|
-
createdAt: string;
|
|
1247
|
-
createdBy: string;
|
|
1248
|
-
source: HubWorkflowRevisionSource;
|
|
1249
|
-
note: string | null;
|
|
1250
|
-
status: HubWorkflowRevisionStatus;
|
|
1251
|
-
}
|
|
1252
|
-
/** One revision WITH its YAML (and the actions compiled alongside it). */
|
|
1253
|
-
interface HubWorkflowRevision extends HubWorkflowRevisionMeta {
|
|
1254
|
-
yaml: string;
|
|
1255
|
-
actions: HubWorkflowAction[];
|
|
1256
|
-
}
|
|
1257
|
-
/** A proposal (proposed or rejected revision) WITH its evidence — what the
|
|
1258
|
-
* proposer derived the suggestion from (e.g. health stats), plus
|
|
1259
|
-
* `rejectionReason` once declined. */
|
|
1260
|
-
interface HubWorkflowProposal extends HubWorkflowRevisionMeta {
|
|
1261
|
-
evidence: unknown;
|
|
1262
|
-
}
|
|
1263
|
-
/** Input to {@link HubWorkflowsClient.propose}. Service-token callers only. */
|
|
1264
|
-
interface HubWorkflowProposalInput {
|
|
1265
|
-
yaml: string;
|
|
1266
|
-
note?: string;
|
|
1267
|
-
/** Proposer-supplied justification (any JSON value) — carried verbatim onto
|
|
1268
|
-
* the revision and shown on the approval surface. */
|
|
1269
|
-
evidence?: unknown;
|
|
1270
|
-
}
|
|
1271
1415
|
/** One node's aggregate across the analyzed runs. */
|
|
1272
1416
|
interface HubWorkflowNodeHealth {
|
|
1273
1417
|
/** The author's graph node id, or `step-N` for a linear run's nodes (and for
|
|
1274
1418
|
* a node whose run cannot be mapped back to a definition). */
|
|
1275
1419
|
nodeId: string;
|
|
1276
1420
|
visits: number;
|
|
1277
|
-
failures: number;
|
|
1278
|
-
/** Null when no visit carried a cost row (never a fabricated 0). */
|
|
1279
|
-
totalCostUsd: number | null;
|
|
1280
|
-
/** Null when no visit recorded duration spans. */
|
|
1281
|
-
avgDurationMs: number | null;
|
|
1282
|
-
}
|
|
1283
|
-
/** Failures grouped by a normalized error signature (ids/numbers/whitespace
|
|
1284
|
-
* stripped), most frequent first (top 5). */
|
|
1285
|
-
interface HubWorkflowFailureCluster {
|
|
1286
|
-
signature: string;
|
|
1287
|
-
count: number;
|
|
1288
|
-
sampleRunIds: string[];
|
|
1289
|
-
}
|
|
1290
|
-
/** An agent.run node whose outputs are near-static across runs — a
|
|
1291
|
-
* CANDIDATE for distillation, reported with its measurements, never a
|
|
1292
|
-
* verdict. */
|
|
1293
|
-
interface HubWorkflowDistillationCandidate {
|
|
1294
|
-
nodeId: string;
|
|
1295
|
-
matchRatio: number;
|
|
1296
|
-
samples: number;
|
|
1297
|
-
avgCostUsd: number | null;
|
|
1298
|
-
}
|
|
1299
|
-
interface HubWorkflowHealth {
|
|
1300
|
-
/** The requested window (the `runs` parameter). */
|
|
1301
|
-
runsWindow: number;
|
|
1302
|
-
/** Terminal runs that actually went into the stats. */
|
|
1303
|
-
runsAnalyzed: number;
|
|
1304
|
-
nodes: HubWorkflowNodeHealth[];
|
|
1305
|
-
failureClusters: HubWorkflowFailureCluster[];
|
|
1306
|
-
distillationCandidates: HubWorkflowDistillationCandidate[];
|
|
1307
|
-
}
|
|
1308
|
-
/** One KV entry with its metadata — the get/put/cas response shape. */
|
|
1309
|
-
interface HubWorkflowKvEntry {
|
|
1310
|
-
key: string;
|
|
1311
|
-
value: unknown;
|
|
1312
|
-
version: number;
|
|
1313
|
-
updatedAt: string;
|
|
1314
|
-
}
|
|
1315
|
-
/** Keyspace metadata row (never the value) — the list response's entry. */
|
|
1316
|
-
interface HubWorkflowKvEntryMeta {
|
|
1317
|
-
key: string;
|
|
1318
|
-
version: number;
|
|
1319
|
-
updatedAt: string;
|
|
1320
|
-
}
|
|
1321
|
-
interface HubWorkflowKvListResponse {
|
|
1322
|
-
entries: HubWorkflowKvEntryMeta[];
|
|
1323
|
-
}
|
|
1324
|
-
interface HubWorkflowKvDeleteResponse {
|
|
1325
|
-
deleted: boolean;
|
|
1326
|
-
}
|
|
1327
|
-
/** The opaque ref a stored artifact is referred to by — the value a
|
|
1328
|
-
* script.run node returns as its step output. */
|
|
1329
|
-
interface HubWorkflowArtifactRef {
|
|
1330
|
-
$artifact: string;
|
|
1331
|
-
name: string;
|
|
1332
|
-
contentType: string;
|
|
1333
|
-
byteSize: number;
|
|
1334
|
-
preview: string | null;
|
|
1335
|
-
}
|
|
1336
|
-
/** Artifact metadata (never the bytes), oldest first on the list response. */
|
|
1337
|
-
interface HubWorkflowArtifact {
|
|
1338
|
-
id: string;
|
|
1339
|
-
runId: string;
|
|
1340
|
-
workflowId: string;
|
|
1341
|
-
/** The graph node (or `step-N` positional id on linear runs) whose action
|
|
1342
|
-
* emitted the artifact. */
|
|
1343
|
-
nodeId: string;
|
|
1344
|
-
name: string;
|
|
1345
|
-
contentType: string;
|
|
1346
|
-
byteSize: number;
|
|
1347
|
-
/** First 2KiB of textual content; null for binary content types. */
|
|
1348
|
-
preview: string | null;
|
|
1349
|
-
createdAt: string;
|
|
1350
|
-
}
|
|
1351
|
-
interface HubWorkflowArtifactsResponse {
|
|
1352
|
-
artifacts: HubWorkflowArtifact[];
|
|
1353
|
-
}
|
|
1354
|
-
/** Raw artifact bytes from the download route, with their stored content type. */
|
|
1355
|
-
interface HubWorkflowArtifactDownload {
|
|
1356
|
-
bytes: Uint8Array;
|
|
1357
|
-
contentType: string;
|
|
1421
|
+
failures: number;
|
|
1422
|
+
/** Null when no visit carried a cost row (never a fabricated 0). */
|
|
1423
|
+
totalCostUsd: number | null;
|
|
1424
|
+
/** Null when no visit recorded duration spans. */
|
|
1425
|
+
avgDurationMs: number | null;
|
|
1358
1426
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
label: string;
|
|
1366
|
-
type: "string" | "integer";
|
|
1367
|
-
help?: string;
|
|
1368
|
-
example: string;
|
|
1369
|
-
default?: string;
|
|
1370
|
-
defaultFrom?: "native_evaluation";
|
|
1371
|
-
required?: boolean;
|
|
1372
|
-
advanced?: boolean;
|
|
1427
|
+
/** Failures grouped by a normalized error signature (ids/numbers/whitespace
|
|
1428
|
+
* stripped), most frequent first (top 5). */
|
|
1429
|
+
interface HubWorkflowFailureCluster {
|
|
1430
|
+
signature: string;
|
|
1431
|
+
count: number;
|
|
1432
|
+
sampleRunIds: string[];
|
|
1373
1433
|
}
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
providers: string[];
|
|
1383
|
-
parameters: HubWorkflowTemplateParameter[];
|
|
1384
|
-
/** The template with parameter tokens rendered to their example values. */
|
|
1385
|
-
previewYaml: string;
|
|
1386
|
-
setupNotes?: string[];
|
|
1434
|
+
/** An agent.run node whose outputs are near-static across runs — a
|
|
1435
|
+
* CANDIDATE for distillation, reported with its measurements, never a
|
|
1436
|
+
* verdict. */
|
|
1437
|
+
interface HubWorkflowDistillationCandidate {
|
|
1438
|
+
nodeId: string;
|
|
1439
|
+
matchRatio: number;
|
|
1440
|
+
samples: number;
|
|
1441
|
+
avgCostUsd: number | null;
|
|
1387
1442
|
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
/** Another requirement in the same list that must be satisfied first — a
|
|
1397
|
-
* `github_app` install is claimed through the `github` connection, so it is
|
|
1398
|
-
* refused while that connection is missing. Null when nothing blocks this
|
|
1399
|
-
* requirement. The list is ordered prerequisite-first. */
|
|
1400
|
-
prerequisite: {
|
|
1401
|
-
provider: string;
|
|
1402
|
-
kind: "integration" | "github_app";
|
|
1403
|
-
} | null;
|
|
1443
|
+
interface HubWorkflowHealth {
|
|
1444
|
+
/** The requested window (the `runs` parameter). */
|
|
1445
|
+
runsWindow: number;
|
|
1446
|
+
/** Terminal runs that actually went into the stats. */
|
|
1447
|
+
runsAnalyzed: number;
|
|
1448
|
+
nodes: HubWorkflowNodeHealth[];
|
|
1449
|
+
failureClusters: HubWorkflowFailureCluster[];
|
|
1450
|
+
distillationCandidates: HubWorkflowDistillationCandidate[];
|
|
1404
1451
|
}
|
|
1405
|
-
/**
|
|
1406
|
-
* Result of instantiating a template. `created: false` is NOT an error — an
|
|
1407
|
-
* actionable continuation listing the connections to satisfy before retrying
|
|
1408
|
-
* the same call. Invalid parameters or a compile failure throw `HubSdkError`
|
|
1409
|
-
* (400) instead, matching the create route's contract.
|
|
1410
|
-
*/
|
|
1411
|
-
type HubWorkflowTemplateInstantiateResult = {
|
|
1412
|
-
created: true;
|
|
1413
|
-
workflow: HubWorkflow;
|
|
1414
|
-
} | {
|
|
1415
|
-
created: false;
|
|
1416
|
-
connectionRequirements: HubWorkflowConnectionRequirement[];
|
|
1417
|
-
};
|
|
1418
1452
|
type HubWorkflowDecisionStatus = "pending" | "resolved" | "expired" | "cancelled";
|
|
1419
1453
|
type HubWorkflowDecisionOnTimeout = "wait" | "fail" | "default";
|
|
1420
1454
|
/** How the answer arrived: a UI click, a provider-channel event (e.g. a Slack
|
|
@@ -1461,16 +1495,6 @@ interface HubWorkflowDecisionResolveResult {
|
|
|
1461
1495
|
choice: string;
|
|
1462
1496
|
resumed: boolean;
|
|
1463
1497
|
}
|
|
1464
|
-
/** A workflow's webhook delivery endpoint. `token` is the plaintext bearer —
|
|
1465
|
-
* revealed only at mint/rotate time (only the hash is stored). */
|
|
1466
|
-
interface HubWorkflowHookEndpoint {
|
|
1467
|
-
url: string;
|
|
1468
|
-
token?: string;
|
|
1469
|
-
}
|
|
1470
|
-
interface HubWorkflowHookToken {
|
|
1471
|
-
url: string;
|
|
1472
|
-
token: string;
|
|
1473
|
-
}
|
|
1474
1498
|
/** One step of an agent round's execution timeline (reasoning, or a tool call
|
|
1475
1499
|
* with args + result), as the step-page endpoint serves it. */
|
|
1476
1500
|
type HubWorkflowAgentStep = {
|
|
@@ -1491,297 +1515,241 @@ interface HubWorkflowRunStepsPage {
|
|
|
1491
1515
|
nextCursor: number | null;
|
|
1492
1516
|
}
|
|
1493
1517
|
//#endregion
|
|
1494
|
-
//#region src/
|
|
1495
|
-
interface
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
clientSecret: string;
|
|
1499
|
-
fetch?: typeof fetch;
|
|
1500
|
-
}
|
|
1501
|
-
interface HubAppBrokerToken {
|
|
1502
|
-
accessToken: string;
|
|
1503
|
-
expiresIn: number;
|
|
1504
|
-
scopes: string[];
|
|
1505
|
-
}
|
|
1506
|
-
interface HubAppBrokerExchange extends HubAppBrokerToken {
|
|
1507
|
-
grantId: string;
|
|
1508
|
-
connectionId: string;
|
|
1518
|
+
//#region src/workflow-definition-types.d.ts
|
|
1519
|
+
interface HubWorkflowAction {
|
|
1520
|
+
kind: string;
|
|
1521
|
+
config: Record<string, unknown>;
|
|
1509
1522
|
}
|
|
1510
|
-
/**
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
private readonly fetcher;
|
|
1516
|
-
constructor(options: HubAppBrokerOptions);
|
|
1517
|
-
private token;
|
|
1518
|
-
private readToken;
|
|
1519
|
-
exchange(input: {
|
|
1520
|
-
code: string;
|
|
1521
|
-
redirectUri: string;
|
|
1522
|
-
connectionId?: string;
|
|
1523
|
-
}): Promise<HubAppBrokerExchange>;
|
|
1524
|
-
mint(grantId: string): Promise<HubAppBrokerToken>;
|
|
1525
|
-
invoke<T = unknown>(grantId: string, connectionId: string, actionPath: string, input: Record<string, unknown>): Promise<HubExecResponse<T>>;
|
|
1523
|
+
/** Inbound-event matcher for a `provider_event` trigger. */
|
|
1524
|
+
interface HubWorkflowEventFilter {
|
|
1525
|
+
event: string;
|
|
1526
|
+
action?: string;
|
|
1527
|
+
repo?: string;
|
|
1526
1528
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
/**
|
|
1539
|
-
|
|
1540
|
-
/** Contiguity Console secret, or an existing Inkbox identity signing key. */
|
|
1541
|
-
signingSecret?: string;
|
|
1529
|
+
interface HubWorkflowTrigger {
|
|
1530
|
+
id: string;
|
|
1531
|
+
kind: "provider_event" | "schedule" | "webhook";
|
|
1532
|
+
enabled: boolean;
|
|
1533
|
+
provider: string | null;
|
|
1534
|
+
connectionId: string | null;
|
|
1535
|
+
eventFilter: HubWorkflowEventFilter | null;
|
|
1536
|
+
cron: string | null;
|
|
1537
|
+
timezone: string | null;
|
|
1538
|
+
nextFireAt: string | null;
|
|
1539
|
+
lastFiredAt: string | null;
|
|
1540
|
+
/** Schedule only: the ISO-8601 instant it stops firing; null when unbounded. */
|
|
1541
|
+
until: string | null;
|
|
1542
1542
|
}
|
|
1543
|
-
interface
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
secret?: string;
|
|
1549
|
-
inboundAddress?: string;
|
|
1550
|
-
requiresProviderSetup?: boolean;
|
|
1543
|
+
interface HubWorkflowValidationError {
|
|
1544
|
+
path: string;
|
|
1545
|
+
message: string;
|
|
1546
|
+
/** Machine-readable reason where one is defined, e.g. `schedule_outlives_grant`. */
|
|
1547
|
+
code?: string;
|
|
1551
1548
|
}
|
|
1552
|
-
interface
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1549
|
+
interface HubWorkflow {
|
|
1550
|
+
id: string;
|
|
1551
|
+
name: string;
|
|
1552
|
+
description: string | null;
|
|
1553
|
+
enabled: boolean;
|
|
1554
|
+
/** Compiled engine actions (connection refs resolved to ids). */
|
|
1555
|
+
actions: HubWorkflowAction[];
|
|
1556
|
+
/** The durable YAML this workflow compiled from. */
|
|
1557
|
+
definitionYaml: string | null;
|
|
1558
|
+
validationErrors: HubWorkflowValidationError[];
|
|
1559
|
+
/** Current head revision; null on pre-versioning rows until their next
|
|
1560
|
+
* update (they have no revision history to point at yet). */
|
|
1561
|
+
headRev?: number | null;
|
|
1562
|
+
/** Present on get/create/update detail responses; omitted on list. */
|
|
1563
|
+
triggers?: HubWorkflowTrigger[];
|
|
1564
|
+
/** Present on the detail response: the trigger fields a manual run must supply,
|
|
1565
|
+
* derived from the definition's `${trigger.*}` references (empty when none). */
|
|
1566
|
+
manualRunInputs?: HubManualRunInput[];
|
|
1567
|
+
/** Present on the get-detail response: the compiled graph topology (null
|
|
1568
|
+
* when the definition has no graph topology, or is chain-equivalent —
|
|
1569
|
+
* the legacy linear semantics). Omitted on the list projection. */
|
|
1570
|
+
graph?: HubWorkflowGraphSpec | null;
|
|
1571
|
+
/** Create response only, when the definition has a webhook trigger: the
|
|
1572
|
+
* hook delivery URL, plus the plaintext bearer token exactly once at mint
|
|
1573
|
+
* (absent when an active token already exists — rotate to re-reveal). */
|
|
1574
|
+
hook?: HubWorkflowHookEndpoint;
|
|
1575
|
+
/** Present on the list response (latest run, or null if never run); omitted on detail. */
|
|
1576
|
+
lastRun?: HubWorkflowRunSummary | null;
|
|
1577
|
+
createdAt: string;
|
|
1578
|
+
updatedAt: string;
|
|
1558
1579
|
}
|
|
1559
|
-
/**
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1580
|
+
/** A trigger field a manual "Run now" must supply (derived from the
|
|
1581
|
+
* definition's `${trigger.*}` references). `required` is false only when every
|
|
1582
|
+
* read is wrapped in a `default(...)`. */
|
|
1583
|
+
interface HubManualRunInput {
|
|
1584
|
+
path: string;
|
|
1585
|
+
required: boolean;
|
|
1565
1586
|
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1587
|
+
type HubWorkflowValidateResponse = {
|
|
1588
|
+
valid: true;
|
|
1589
|
+
name: string;
|
|
1590
|
+
actionCount: number;
|
|
1591
|
+
triggerCount: number;
|
|
1592
|
+
} | {
|
|
1593
|
+
valid: false;
|
|
1594
|
+
errors: HubWorkflowValidationError[];
|
|
1595
|
+
};
|
|
1596
|
+
/** JSON Schema for the YAML workflow definition. */
|
|
1597
|
+
type HubWorkflowSchemaResponse = Record<string, unknown>;
|
|
1598
|
+
type HubWorkflowRevisionSource = "user" | "copilot" | "intelligence";
|
|
1599
|
+
/** Lifecycle state of a revision. The head rev only ever points at an
|
|
1600
|
+
* `applied` revision; `proposed` is a service-token-authored suggestion
|
|
1601
|
+
* awaiting an owner decision; `rejected` is a declined proposal (kept for
|
|
1602
|
+
* audit). */
|
|
1603
|
+
type HubWorkflowRevisionStatus = "applied" | "proposed" | "rejected";
|
|
1604
|
+
/** Revision list projection — attribution + note + status, WITHOUT the YAML body. */
|
|
1605
|
+
interface HubWorkflowRevisionMeta {
|
|
1606
|
+
rev: number;
|
|
1607
|
+
createdAt: string;
|
|
1608
|
+
createdBy: string;
|
|
1609
|
+
source: HubWorkflowRevisionSource;
|
|
1610
|
+
note: string | null;
|
|
1611
|
+
status: HubWorkflowRevisionStatus;
|
|
1578
1612
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
generation: string;
|
|
1613
|
+
/** One revision WITH its YAML (and the actions compiled alongside it). */
|
|
1614
|
+
interface HubWorkflowRevision extends HubWorkflowRevisionMeta {
|
|
1615
|
+
yaml: string;
|
|
1616
|
+
actions: HubWorkflowAction[];
|
|
1584
1617
|
}
|
|
1585
|
-
/**
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1618
|
+
/** A proposal (proposed or rejected revision) WITH its evidence — what the
|
|
1619
|
+
* proposer derived the suggestion from (e.g. health stats), plus
|
|
1620
|
+
* `rejectionReason` once declined. */
|
|
1621
|
+
interface HubWorkflowProposal extends HubWorkflowRevisionMeta {
|
|
1622
|
+
evidence: unknown;
|
|
1590
1623
|
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
connectionId: string;
|
|
1599
|
-
owner: string;
|
|
1600
|
-
repo: string;
|
|
1601
|
-
ref: string;
|
|
1602
|
-
pathPrefix?: string;
|
|
1603
|
-
} | {
|
|
1604
|
-
kind: "url";
|
|
1605
|
-
url: string;
|
|
1606
|
-
} | {
|
|
1607
|
-
kind: "s3";
|
|
1608
|
-
connectionId: string;
|
|
1609
|
-
bucket: string;
|
|
1610
|
-
prefix: string;
|
|
1611
|
-
} | {
|
|
1612
|
-
kind: "vector";
|
|
1613
|
-
connectionId: string;
|
|
1614
|
-
provider: "pinecone" | "qdrant" | "weaviate";
|
|
1615
|
-
indexName: string;
|
|
1616
|
-
namespace?: string;
|
|
1617
|
-
embedding: KnowledgeEmbeddingSpace;
|
|
1618
|
-
textField: string;
|
|
1619
|
-
sourceUriField: string;
|
|
1620
|
-
};
|
|
1621
|
-
interface KnowledgeCapability {
|
|
1622
|
-
supported: boolean;
|
|
1623
|
-
reason?: string;
|
|
1624
|
+
/** Input to {@link HubWorkflowsClient.propose}. Service-token callers only. */
|
|
1625
|
+
interface HubWorkflowProposalInput {
|
|
1626
|
+
yaml: string;
|
|
1627
|
+
note?: string;
|
|
1628
|
+
/** Proposer-supplied justification (any JSON value) — carried verbatim onto
|
|
1629
|
+
* the revision and shown on the approval surface. */
|
|
1630
|
+
evidence?: unknown;
|
|
1624
1631
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1632
|
+
type HubWorkflowTemplateCategory = "Code Review" | "Triage" | "Reports" | "Multi-agent";
|
|
1633
|
+
/** One author-time literal a gallery starter needs the user to supply. Every
|
|
1634
|
+
* declared parameter is required; `example` is a valid value that seeds the
|
|
1635
|
+
* form placeholder. */
|
|
1636
|
+
interface HubWorkflowTemplateParameter {
|
|
1637
|
+
key: string;
|
|
1638
|
+
label: string;
|
|
1639
|
+
type: "string" | "integer";
|
|
1640
|
+
help?: string;
|
|
1641
|
+
example: string;
|
|
1642
|
+
default?: string;
|
|
1643
|
+
defaultFrom?: "native_evaluation";
|
|
1644
|
+
required?: boolean;
|
|
1645
|
+
advanced?: boolean;
|
|
1638
1646
|
}
|
|
1639
|
-
interface
|
|
1640
|
-
/** Required query authorization, not proof that an owner policy currently permits it. */
|
|
1641
|
-
retrieval?: {
|
|
1642
|
-
kind: "lexical";
|
|
1643
|
-
} | {
|
|
1644
|
-
kind: "vector";
|
|
1645
|
-
embeddingPolicy: {
|
|
1646
|
-
connectionId: string;
|
|
1647
|
-
actionPath: "openai.embeddings.create";
|
|
1648
|
-
scope: "owner-connection-action";
|
|
1649
|
-
};
|
|
1650
|
-
};
|
|
1647
|
+
interface HubWorkflowTemplate {
|
|
1651
1648
|
id: string;
|
|
1652
1649
|
name: string;
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1650
|
+
summary: string;
|
|
1651
|
+
category: HubWorkflowTemplateCategory;
|
|
1652
|
+
icon: string;
|
|
1653
|
+
requiresSandbox: boolean;
|
|
1654
|
+
/** Providers the template references (a "uses GitHub" hint), sorted. */
|
|
1655
|
+
providers: string[];
|
|
1656
|
+
parameters: HubWorkflowTemplateParameter[];
|
|
1657
|
+
/** The template with parameter tokens rendered to their example values. */
|
|
1658
|
+
previewYaml: string;
|
|
1659
|
+
setupNotes?: string[];
|
|
1660
|
+
}
|
|
1661
|
+
/** A connection a definition needs, with where to connect it. */
|
|
1662
|
+
interface HubWorkflowConnectionRequirement {
|
|
1663
|
+
provider: string;
|
|
1664
|
+
connected: boolean;
|
|
1665
|
+
kind: "integration" | "github_app";
|
|
1666
|
+
/** Where to satisfy the requirement (App install flow for `github_app`,
|
|
1667
|
+
* integrations page otherwise); null when no target exists. */
|
|
1668
|
+
connectUrl: string | null;
|
|
1669
|
+
/** Another requirement in the same list that must be satisfied first — a
|
|
1670
|
+
* `github_app` install is claimed through the `github` connection, so it is
|
|
1671
|
+
* refused while that connection is missing. Null when nothing blocks this
|
|
1672
|
+
* requirement. The list is ordered prerequisite-first. */
|
|
1673
|
+
prerequisite: {
|
|
1674
|
+
provider: string;
|
|
1675
|
+
kind: "integration" | "github_app";
|
|
1675
1676
|
} | null;
|
|
1676
|
-
updatedAt: string;
|
|
1677
1677
|
}
|
|
1678
|
-
|
|
1679
|
-
|
|
1678
|
+
/**
|
|
1679
|
+
* Result of instantiating a template. `created: false` is NOT an error — an
|
|
1680
|
+
* actionable continuation listing the connections to satisfy before retrying
|
|
1681
|
+
* the same call. Invalid parameters or a compile failure throw `HubSdkError`
|
|
1682
|
+
* (400) instead, matching the create route's contract.
|
|
1683
|
+
*/
|
|
1684
|
+
type HubWorkflowTemplateInstantiateResult = {
|
|
1685
|
+
created: true;
|
|
1686
|
+
workflow: HubWorkflow;
|
|
1680
1687
|
} | {
|
|
1681
|
-
|
|
1682
|
-
|
|
1688
|
+
created: false;
|
|
1689
|
+
connectionRequirements: HubWorkflowConnectionRequirement[];
|
|
1683
1690
|
};
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
sandboxId: string;
|
|
1690
|
-
generation: string;
|
|
1691
|
-
status: "active" | "detached";
|
|
1691
|
+
/** A workflow's webhook delivery endpoint. `token` is the plaintext bearer —
|
|
1692
|
+
* revealed only at mint/rotate time (only the hash is stored). */
|
|
1693
|
+
interface HubWorkflowHookEndpoint {
|
|
1694
|
+
url: string;
|
|
1695
|
+
token?: string;
|
|
1692
1696
|
}
|
|
1693
|
-
interface
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
source: KnowledgeSourceInput;
|
|
1697
|
-
target?: {
|
|
1698
|
-
kind: "lexical";
|
|
1699
|
-
} | {
|
|
1700
|
-
kind: "managed-vector";
|
|
1701
|
-
provider: "qdrant";
|
|
1702
|
-
connectionId: string;
|
|
1703
|
-
embedding: KnowledgeEmbeddingSpace;
|
|
1704
|
-
};
|
|
1697
|
+
interface HubWorkflowHookToken {
|
|
1698
|
+
url: string;
|
|
1699
|
+
token: string;
|
|
1705
1700
|
}
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1701
|
+
//#endregion
|
|
1702
|
+
//#region src/workflow-storage-types.d.ts
|
|
1703
|
+
/** One KV entry with its metadata — the get/put/cas response shape. */
|
|
1704
|
+
interface HubWorkflowKvEntry {
|
|
1705
|
+
key: string;
|
|
1706
|
+
value: unknown;
|
|
1707
|
+
version: number;
|
|
1708
|
+
updatedAt: string;
|
|
1712
1709
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
references: KnowledgeReference[];
|
|
1719
|
-
}): Promise<KnowledgeAttachment[]>;
|
|
1720
|
-
authorization(): Promise<KnowledgeAuthorization>;
|
|
1721
|
-
disconnectAuthorization(): Promise<{
|
|
1722
|
-
revoked: true;
|
|
1723
|
-
}>;
|
|
1724
|
-
capabilities(): Promise<KnowledgeCapabilities>;
|
|
1725
|
-
list(): Promise<KnowledgeSourceSummary[]>;
|
|
1726
|
-
get(sourceId: string): Promise<KnowledgeSourceSummary>;
|
|
1727
|
-
create(input: KnowledgeSourceCreate): Promise<KnowledgeSourceSummary>;
|
|
1728
|
-
refresh(sourceId: string, input: {
|
|
1729
|
-
requestId: string;
|
|
1730
|
-
approvalToken?: string;
|
|
1731
|
-
}): Promise<KnowledgeSourceSummary>;
|
|
1732
|
-
attach(sourceId: string, input: {
|
|
1733
|
-
sandboxId: string;
|
|
1734
|
-
generation: string;
|
|
1735
|
-
expectedGeneration?: string;
|
|
1736
|
-
}): Promise<KnowledgeAttachment>;
|
|
1737
|
-
attachments(sandboxId?: string): Promise<KnowledgeAttachment[]>;
|
|
1738
|
-
detach(attachmentId: string): Promise<KnowledgeAttachment>;
|
|
1710
|
+
/** Keyspace metadata row (never the value) — the list response's entry. */
|
|
1711
|
+
interface HubWorkflowKvEntryMeta {
|
|
1712
|
+
key: string;
|
|
1713
|
+
version: number;
|
|
1714
|
+
updatedAt: string;
|
|
1739
1715
|
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
interface HubKnowledgeRetrievalResult {
|
|
1743
|
-
attachmentId: string;
|
|
1744
|
-
generation: string;
|
|
1745
|
-
provenance: "ingested" | "record-supplied";
|
|
1746
|
-
hits: Array<{
|
|
1747
|
-
id: string;
|
|
1748
|
-
title: string;
|
|
1749
|
-
snippet: string;
|
|
1750
|
-
score?: number;
|
|
1751
|
-
citations?: Array<{
|
|
1752
|
-
sourceId: string;
|
|
1753
|
-
sourceUri: string;
|
|
1754
|
-
revision?: string;
|
|
1755
|
-
}>;
|
|
1756
|
-
}>;
|
|
1757
|
-
elapsedMs?: number;
|
|
1716
|
+
interface HubWorkflowKvListResponse {
|
|
1717
|
+
entries: HubWorkflowKvEntryMeta[];
|
|
1758
1718
|
}
|
|
1759
|
-
interface
|
|
1760
|
-
|
|
1761
|
-
/** Individual unavailable sources do not hide evidence from healthy sources. */
|
|
1762
|
-
failures: Array<{
|
|
1763
|
-
attachmentId: string;
|
|
1764
|
-
code: string;
|
|
1765
|
-
message: string;
|
|
1766
|
-
}>;
|
|
1767
|
-
partial: boolean;
|
|
1719
|
+
interface HubWorkflowKvDeleteResponse {
|
|
1720
|
+
deleted: boolean;
|
|
1768
1721
|
}
|
|
1769
|
-
/**
|
|
1770
|
-
*
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1722
|
+
/** The opaque ref a stored artifact is referred to by — the value a
|
|
1723
|
+
* script.run node returns as its step output. */
|
|
1724
|
+
interface HubWorkflowArtifactRef {
|
|
1725
|
+
$artifact: string;
|
|
1726
|
+
name: string;
|
|
1727
|
+
contentType: string;
|
|
1728
|
+
byteSize: number;
|
|
1729
|
+
preview: string | null;
|
|
1730
|
+
}
|
|
1731
|
+
/** Artifact metadata (never the bytes), oldest first on the list response. */
|
|
1732
|
+
interface HubWorkflowArtifact {
|
|
1733
|
+
id: string;
|
|
1734
|
+
runId: string;
|
|
1735
|
+
workflowId: string;
|
|
1736
|
+
/** The graph node (or `step-N` positional id on linear runs) whose action
|
|
1737
|
+
* emitted the artifact. */
|
|
1738
|
+
nodeId: string;
|
|
1739
|
+
name: string;
|
|
1740
|
+
contentType: string;
|
|
1741
|
+
byteSize: number;
|
|
1742
|
+
/** First 2KiB of textual content; null for binary content types. */
|
|
1743
|
+
preview: string | null;
|
|
1744
|
+
createdAt: string;
|
|
1745
|
+
}
|
|
1746
|
+
interface HubWorkflowArtifactsResponse {
|
|
1747
|
+
artifacts: HubWorkflowArtifact[];
|
|
1748
|
+
}
|
|
1749
|
+
/** Raw artifact bytes from the download route, with their stored content type. */
|
|
1750
|
+
interface HubWorkflowArtifactDownload {
|
|
1751
|
+
bytes: Uint8Array;
|
|
1752
|
+
contentType: string;
|
|
1785
1753
|
}
|
|
1786
1754
|
//#endregion
|
|
1787
1755
|
//#region src/lines.d.ts
|
|
@@ -2123,7 +2091,7 @@ declare class HubManagedNumbersClient {
|
|
|
2123
2091
|
private post;
|
|
2124
2092
|
}
|
|
2125
2093
|
//#endregion
|
|
2126
|
-
//#region src/
|
|
2094
|
+
//#region src/transport.d.ts
|
|
2127
2095
|
type HubAuthHeaders = () => HeadersInit | Promise<HeadersInit>;
|
|
2128
2096
|
interface HubClientOptions {
|
|
2129
2097
|
baseUrl: string;
|
|
@@ -2139,18 +2107,6 @@ declare class HubSdkError extends Error {
|
|
|
2139
2107
|
status?: number;
|
|
2140
2108
|
});
|
|
2141
2109
|
}
|
|
2142
|
-
declare const HUB_URL_ENV_VAR: "TANGLE_HUB_URL";
|
|
2143
|
-
declare const HUB_API_KEY_ENV_VAR: "TANGLE_API_KEY";
|
|
2144
|
-
declare const HUB_CAPABILITY_TOKEN_ENV_VAR: "TANGLE_HUB_CAPABILITY_TOKEN";
|
|
2145
|
-
type HubEnv = Record<string, string | undefined>;
|
|
2146
|
-
interface HubClientFromEnvOptions {
|
|
2147
|
-
env?: HubEnv;
|
|
2148
|
-
apiKey?: string;
|
|
2149
|
-
authHeaders?: HubAuthHeaders;
|
|
2150
|
-
fetch?: typeof fetch;
|
|
2151
|
-
}
|
|
2152
|
-
declare function resolveHubBaseUrl(env?: HubEnv): string;
|
|
2153
|
-
declare function resolveHubAuth(env?: HubEnv): string;
|
|
2154
2110
|
declare class HubTransport {
|
|
2155
2111
|
#private;
|
|
2156
2112
|
readonly baseUrl: string;
|
|
@@ -2165,52 +2121,32 @@ declare class HubTransport {
|
|
|
2165
2121
|
}): Promise<TData>;
|
|
2166
2122
|
protected buildHeaders(headers: HeadersInit | undefined, callerAuth?: boolean): Promise<Headers>;
|
|
2167
2123
|
}
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
readonly lines: HubLinesClient;
|
|
2184
|
-
constructor(options: HubClientOptions);
|
|
2185
|
-
static fromEnv(options?: HubClientFromEnvOptions): HubClient;
|
|
2186
|
-
status(): Promise<HubStatusResponse>;
|
|
2187
|
-
/**
|
|
2188
|
-
* Open a streaming (Server-Sent Events) response and return its raw body.
|
|
2189
|
-
* Shares auth-header building + `fetch` with {@link request}, but does NOT
|
|
2190
|
-
* buffer or JSON-parse the body — the caller consumes the stream.
|
|
2191
|
-
*
|
|
2192
|
-
* A successful stream comes back as `text/event-stream`. Anything else is an
|
|
2193
|
-
* error envelope (404/429/401 JSON) or a transport failure (gateway/HTML
|
|
2194
|
-
* page); it is surfaced the same way {@link request} surfaces errors — a
|
|
2195
|
-
* typed `HubSdkError` from a `{success:false}` envelope, otherwise an
|
|
2196
|
-
* `HUB_HTTP_<status>` transport error — rather than handed back as bogus SSE.
|
|
2197
|
-
*/
|
|
2198
|
-
private stream;
|
|
2199
|
-
/**
|
|
2200
|
-
* Fetch raw (non-envelope) bytes — the artifact download route, whose 200 is
|
|
2201
|
-
* the artifact's own content type, not JSON. Error responses on such routes
|
|
2202
|
-
* are still the standard envelope, so a failure surfaces exactly like
|
|
2203
|
-
* {@link request}: a typed `HubSdkError` from a `{success:false}` body,
|
|
2204
|
-
* otherwise an `HUB_HTTP_<status>` transport error.
|
|
2205
|
-
*/
|
|
2206
|
-
private requestBytes;
|
|
2124
|
+
/** Domain clients receive the existing envelope transport as one request function. */
|
|
2125
|
+
type HubRequest = <TData>(path: string, init: RequestInit) => Promise<TData>;
|
|
2126
|
+
type HubStreamRequest = (path: string, init: RequestInit) => Promise<ReadableStream<Uint8Array>>;
|
|
2127
|
+
type HubArtifactRequest = (path: string, init: RequestInit) => Promise<HubWorkflowArtifactDownload>;
|
|
2128
|
+
//#endregion
|
|
2129
|
+
//#region src/environment.d.ts
|
|
2130
|
+
declare const HUB_URL_ENV_VAR: "TANGLE_HUB_URL";
|
|
2131
|
+
declare const HUB_API_KEY_ENV_VAR: "TANGLE_API_KEY";
|
|
2132
|
+
declare const HUB_CAPABILITY_TOKEN_ENV_VAR: "TANGLE_HUB_CAPABILITY_TOKEN";
|
|
2133
|
+
type HubEnv = Record<string, string | undefined>;
|
|
2134
|
+
interface HubClientFromEnvOptions {
|
|
2135
|
+
env?: HubEnv;
|
|
2136
|
+
apiKey?: string;
|
|
2137
|
+
authHeaders?: HubAuthHeaders;
|
|
2138
|
+
fetch?: typeof fetch;
|
|
2207
2139
|
}
|
|
2140
|
+
declare function resolveHubBaseUrl(env?: HubEnv): string;
|
|
2141
|
+
declare function resolveHubAuth(env?: HubEnv): string;
|
|
2142
|
+
//#endregion
|
|
2143
|
+
//#region src/authorization.d.ts
|
|
2208
2144
|
interface HubTokenListOptions {
|
|
2209
2145
|
includeExpired?: boolean;
|
|
2210
2146
|
}
|
|
2211
2147
|
declare class HubTokensClient {
|
|
2212
2148
|
private readonly request;
|
|
2213
|
-
constructor(request:
|
|
2149
|
+
constructor(request: HubRequest);
|
|
2214
2150
|
mint(options: {
|
|
2215
2151
|
actionPath: string;
|
|
2216
2152
|
connectionId?: string;
|
|
@@ -2222,7 +2158,7 @@ declare class HubTokensClient {
|
|
|
2222
2158
|
}
|
|
2223
2159
|
declare class HubPermissionsClient {
|
|
2224
2160
|
private readonly request;
|
|
2225
|
-
constructor(request:
|
|
2161
|
+
constructor(request: HubRequest);
|
|
2226
2162
|
list(connectionId: string): Promise<HubPolicyListResponse>;
|
|
2227
2163
|
set(input: HubPolicyUpdateRequest): Promise<HubPolicyResponse>;
|
|
2228
2164
|
/** Reset an action to its default by deleting any stored override. */
|
|
@@ -2235,6 +2171,15 @@ declare class HubPermissionsClient {
|
|
|
2235
2171
|
* connection. Manual per-action decisions are left intact. */
|
|
2236
2172
|
revertWrites(connectionId: string): Promise<HubRevertWritesResponse>;
|
|
2237
2173
|
}
|
|
2174
|
+
declare class HubApprovalsClient {
|
|
2175
|
+
private readonly request;
|
|
2176
|
+
constructor(request: HubRequest);
|
|
2177
|
+
list(): Promise<HubApprovalListResponse>;
|
|
2178
|
+
approve(approvalId: string): Promise<HubApprovalDecisionResponse>;
|
|
2179
|
+
deny(approvalId: string): Promise<HubApprovalDecisionResponse>;
|
|
2180
|
+
}
|
|
2181
|
+
//#endregion
|
|
2182
|
+
//#region src/tools.d.ts
|
|
2238
2183
|
interface HubToolSearchOptions {
|
|
2239
2184
|
provider?: string;
|
|
2240
2185
|
/** Max tools to return. The server defaults to a relevance-ranked shortlist
|
|
@@ -2258,7 +2203,7 @@ interface HubToolInvokeOptions {
|
|
|
2258
2203
|
}
|
|
2259
2204
|
declare class HubToolsClient {
|
|
2260
2205
|
private readonly request;
|
|
2261
|
-
constructor(request:
|
|
2206
|
+
constructor(request: HubRequest);
|
|
2262
2207
|
search(query: string, options?: HubToolSearchOptions): Promise<HubToolsSearchResponse>;
|
|
2263
2208
|
sources(): Promise<HubToolSourcesResponse>;
|
|
2264
2209
|
describe(path: string): Promise<HubToolsDescribeResponse>;
|
|
@@ -2270,6 +2215,60 @@ declare class HubToolsClient {
|
|
|
2270
2215
|
invoke<TResult = unknown>(path: string, raw: unknown, options?: HubToolInvokeOptions): Promise<HubExecResponse<TResult>>;
|
|
2271
2216
|
private buildExecInit;
|
|
2272
2217
|
}
|
|
2218
|
+
//#endregion
|
|
2219
|
+
//#region src/inbound-webhooks.d.ts
|
|
2220
|
+
/** Provider setup uses the existing authenticated Hub transport and vault. */
|
|
2221
|
+
interface HubInboundWebhookCreateOptions {
|
|
2222
|
+
/** Inkbox identity that owns all selected channels. */
|
|
2223
|
+
identityId?: string;
|
|
2224
|
+
mailboxId?: string;
|
|
2225
|
+
phoneNumberId?: string;
|
|
2226
|
+
imessage?: boolean;
|
|
2227
|
+
/** Linq: explicit owned lines; omitted does not mean every account line. */
|
|
2228
|
+
phoneNumbers?: string[];
|
|
2229
|
+
/** Linq WhatsApp: explicit opaque IDs from numbers.list, not E.164 phone strings. */
|
|
2230
|
+
phoneNumberIds?: string[];
|
|
2231
|
+
/** Contiguity Console secret, or an existing Inkbox identity signing key. */
|
|
2232
|
+
signingSecret?: string;
|
|
2233
|
+
}
|
|
2234
|
+
interface HubInboundWebhookCreateResponse {
|
|
2235
|
+
url: string;
|
|
2236
|
+
/** True only when the provider subscription was created by the server. */
|
|
2237
|
+
provisioned?: boolean;
|
|
2238
|
+
/** Self-configured legacy providers can return a newly minted secret once. */
|
|
2239
|
+
secret?: string;
|
|
2240
|
+
inboundAddress?: string;
|
|
2241
|
+
requiresProviderSetup?: boolean;
|
|
2242
|
+
}
|
|
2243
|
+
interface HubInboundWebhookStatus {
|
|
2244
|
+
configured: boolean;
|
|
2245
|
+
url?: string;
|
|
2246
|
+
/** Configuration is not evidence of a real delivered message. */
|
|
2247
|
+
deliveryVerified: false;
|
|
2248
|
+
requiresProviderSetup?: boolean;
|
|
2249
|
+
}
|
|
2250
|
+
/** Live provider readback for one explicitly selected Linq WhatsApp number. */
|
|
2251
|
+
interface HubInboundPhoneNumberScope {
|
|
2252
|
+
configured: true;
|
|
2253
|
+
provisioned: true;
|
|
2254
|
+
subscribed: true;
|
|
2255
|
+
phoneNumberIds: string[];
|
|
2256
|
+
}
|
|
2257
|
+
declare class HubInboundWebhooksClient {
|
|
2258
|
+
private readonly request;
|
|
2259
|
+
constructor(request: <T>(path: string, init: RequestInit) => Promise<T>);
|
|
2260
|
+
create(connectionId: string, options?: HubInboundWebhookCreateOptions): Promise<HubInboundWebhookCreateResponse>;
|
|
2261
|
+
get(connectionId: string): Promise<HubInboundWebhookStatus>;
|
|
2262
|
+
/** Add one owned Linq WhatsApp number without rotating the webhook secret. */
|
|
2263
|
+
ensurePhoneNumber(connectionId: string, phoneNumberId: string): Promise<HubInboundPhoneNumberScope>;
|
|
2264
|
+
/** Remove event subscriptions first. This does not silently rotate a live URL. */
|
|
2265
|
+
delete(connectionId: string): Promise<{
|
|
2266
|
+
removed: boolean;
|
|
2267
|
+
}>;
|
|
2268
|
+
private path;
|
|
2269
|
+
}
|
|
2270
|
+
//#endregion
|
|
2271
|
+
//#region src/connections.d.ts
|
|
2273
2272
|
interface HubConnectionStartOptions {
|
|
2274
2273
|
returnUrl?: string;
|
|
2275
2274
|
cli?: boolean;
|
|
@@ -2277,24 +2276,10 @@ interface HubConnectionStartOptions {
|
|
|
2277
2276
|
/** GitHub accepts the exact read:user, repo, read:org set. */
|
|
2278
2277
|
requestedScopes?: readonly string[];
|
|
2279
2278
|
}
|
|
2280
|
-
declare class HubChannelsClient {
|
|
2281
|
-
private readonly request;
|
|
2282
|
-
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
2283
|
-
list(): Promise<HubChannelsResponse>;
|
|
2284
|
-
createEmail(input?: HubEmailChannelCreateRequest): Promise<HubChannelCreateResponse>;
|
|
2285
|
-
delete(channelId: string): Promise<HubChannelDeleteResponse>;
|
|
2286
|
-
}
|
|
2287
|
-
declare class HubEventSubscriptionsClient {
|
|
2288
|
-
private readonly request;
|
|
2289
|
-
constructor(request: <TData>(path: string, init: RequestInit) => Promise<TData>);
|
|
2290
|
-
list(): Promise<HubEventSubscriptionsResponse>;
|
|
2291
|
-
create(input: HubEventSubscriptionCreateRequest): Promise<HubEventSubscriptionCreateResponse>;
|
|
2292
|
-
delete(subscriptionId: string): Promise<HubEventSubscriptionDeleteResponse>;
|
|
2293
|
-
}
|
|
2294
2279
|
declare class HubConnectionsClient {
|
|
2295
2280
|
private readonly request;
|
|
2296
2281
|
readonly inboundWebhook: HubInboundWebhooksClient;
|
|
2297
|
-
constructor(request:
|
|
2282
|
+
constructor(request: HubRequest);
|
|
2298
2283
|
list(): Promise<HubConnectionsResponse>;
|
|
2299
2284
|
/** Connector catalog: every provider the hub can expose, each flagged with
|
|
2300
2285
|
* `configured` (whether its OAuth app credentials are wired). Callers render
|
|
@@ -2312,16 +2297,27 @@ declare class HubConnectionsClient {
|
|
|
2312
2297
|
revoke(connectionId: string): Promise<HubConnectionDeleteResponse>;
|
|
2313
2298
|
health(connectionId: string): Promise<HubConnectionHealthResponse>;
|
|
2314
2299
|
}
|
|
2315
|
-
|
|
2300
|
+
//#endregion
|
|
2301
|
+
//#region src/channels.d.ts
|
|
2302
|
+
declare class HubChannelsClient {
|
|
2316
2303
|
private readonly request;
|
|
2317
|
-
constructor(request:
|
|
2318
|
-
list(): Promise<
|
|
2319
|
-
|
|
2320
|
-
|
|
2304
|
+
constructor(request: HubRequest);
|
|
2305
|
+
list(): Promise<HubChannelsResponse>;
|
|
2306
|
+
createEmail(input?: HubEmailChannelCreateRequest): Promise<HubChannelCreateResponse>;
|
|
2307
|
+
delete(channelId: string): Promise<HubChannelDeleteResponse>;
|
|
2308
|
+
}
|
|
2309
|
+
declare class HubEventSubscriptionsClient {
|
|
2310
|
+
private readonly request;
|
|
2311
|
+
constructor(request: HubRequest);
|
|
2312
|
+
list(): Promise<HubEventSubscriptionsResponse>;
|
|
2313
|
+
create(input: HubEventSubscriptionCreateRequest): Promise<HubEventSubscriptionCreateResponse>;
|
|
2314
|
+
delete(subscriptionId: string): Promise<HubEventSubscriptionDeleteResponse>;
|
|
2321
2315
|
}
|
|
2316
|
+
//#endregion
|
|
2317
|
+
//#region src/github-app.d.ts
|
|
2322
2318
|
declare class HubGithubAppClient {
|
|
2323
2319
|
private readonly request;
|
|
2324
|
-
constructor(request:
|
|
2320
|
+
constructor(request: HubRequest);
|
|
2325
2321
|
mintInstallationToken(input: HubGithubAppMintInstallationTokenRequest): Promise<HubGithubAppMintInstallationTokenResponse>;
|
|
2326
2322
|
/** Every installation the caller may act through — their own and any org's
|
|
2327
2323
|
* they were verified against. The management surface's read. */
|
|
@@ -2343,16 +2339,20 @@ declare class HubGithubAppClient {
|
|
|
2343
2339
|
repo: string;
|
|
2344
2340
|
}): Promise<HubGithubAppIsRepoInstalledResponse>;
|
|
2345
2341
|
}
|
|
2342
|
+
//#endregion
|
|
2343
|
+
//#region src/audit.d.ts
|
|
2346
2344
|
declare class HubAuditClient {
|
|
2347
2345
|
private readonly request;
|
|
2348
|
-
constructor(request:
|
|
2346
|
+
constructor(request: HubRequest);
|
|
2349
2347
|
list(options?: HubAuditListRequest): Promise<HubAuditResponse>;
|
|
2350
2348
|
}
|
|
2349
|
+
//#endregion
|
|
2350
|
+
//#region src/workflows.d.ts
|
|
2351
2351
|
declare class HubWorkflowsClient {
|
|
2352
2352
|
private readonly request;
|
|
2353
2353
|
private readonly stream?;
|
|
2354
2354
|
private readonly download?;
|
|
2355
|
-
constructor(request:
|
|
2355
|
+
constructor(request: HubRequest, stream?: HubStreamRequest | undefined, download?: HubArtifactRequest | undefined);
|
|
2356
2356
|
list(): Promise<HubWorkflow[]>;
|
|
2357
2357
|
/**
|
|
2358
2358
|
* Owner-wide fleet overview: one row per workflow with its run tallies over
|
|
@@ -2658,6 +2658,48 @@ declare class HubWorkflowsClient {
|
|
|
2658
2658
|
schema(): Promise<HubWorkflowSchemaResponse>;
|
|
2659
2659
|
}
|
|
2660
2660
|
//#endregion
|
|
2661
|
+
//#region src/client.d.ts
|
|
2662
|
+
declare class HubClient extends HubTransport {
|
|
2663
|
+
readonly knowledge: HubKnowledgeClient;
|
|
2664
|
+
readonly allowances: HubAllowancesClient;
|
|
2665
|
+
readonly apps: HubAppsClient;
|
|
2666
|
+
readonly connections: HubConnectionsClient;
|
|
2667
|
+
readonly channels: HubChannelsClient;
|
|
2668
|
+
readonly numbers: HubManagedNumbersClient;
|
|
2669
|
+
readonly eventSubscriptions: HubEventSubscriptionsClient;
|
|
2670
|
+
readonly permissions: HubPermissionsClient;
|
|
2671
|
+
readonly tokens: HubTokensClient;
|
|
2672
|
+
readonly tools: HubToolsClient;
|
|
2673
|
+
readonly approvals: HubApprovalsClient;
|
|
2674
|
+
readonly audit: HubAuditClient;
|
|
2675
|
+
readonly githubApp: HubGithubAppClient;
|
|
2676
|
+
readonly workflows: HubWorkflowsClient;
|
|
2677
|
+
readonly lines: HubLinesClient;
|
|
2678
|
+
constructor(options: HubClientOptions);
|
|
2679
|
+
static fromEnv(options?: HubClientFromEnvOptions): HubClient;
|
|
2680
|
+
status(): Promise<HubStatusResponse>;
|
|
2681
|
+
/**
|
|
2682
|
+
* Open a streaming (Server-Sent Events) response and return its raw body.
|
|
2683
|
+
* Shares auth-header building + `fetch` with {@link request}, but does NOT
|
|
2684
|
+
* buffer or JSON-parse the body — the caller consumes the stream.
|
|
2685
|
+
*
|
|
2686
|
+
* A successful stream comes back as `text/event-stream`. Anything else is an
|
|
2687
|
+
* error envelope (404/429/401 JSON) or a transport failure (gateway/HTML
|
|
2688
|
+
* page); it is surfaced the same way {@link request} surfaces errors — a
|
|
2689
|
+
* typed `HubSdkError` from a `{success:false}` envelope, otherwise an
|
|
2690
|
+
* `HUB_HTTP_<status>` transport error — rather than handed back as bogus SSE.
|
|
2691
|
+
*/
|
|
2692
|
+
private stream;
|
|
2693
|
+
/**
|
|
2694
|
+
* Fetch raw (non-envelope) bytes — the artifact download route, whose 200 is
|
|
2695
|
+
* the artifact's own content type, not JSON. Error responses on such routes
|
|
2696
|
+
* are still the standard envelope, so a failure surfaces exactly like
|
|
2697
|
+
* {@link request}: a typed `HubSdkError` from a `{success:false}` body,
|
|
2698
|
+
* otherwise an `HUB_HTTP_<status>` transport error.
|
|
2699
|
+
*/
|
|
2700
|
+
private requestBytes;
|
|
2701
|
+
}
|
|
2702
|
+
//#endregion
|
|
2661
2703
|
//#region src/event-delivery.d.ts
|
|
2662
2704
|
type HubEventSignatureFailure = "missing" | "malformed" | "stale" | "mismatch";
|
|
2663
2705
|
type HubEventSignatureResult = {
|