@tangle-network/agent-integrations 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,2333 +1 @@
1
- type IntegrationSupportTier = 'catalogOnly' | 'setupReady' | 'gatewayExecutable' | 'firstPartyExecutable' | 'sandboxExecutable';
2
- interface IntegrationCatalogSource {
3
- id: string;
4
- connectors: IntegrationConnector[];
5
- precedence?: number;
6
- }
7
- interface IntegrationRegistrySourceRef {
8
- sourceId: string;
9
- providerId: string;
10
- connectorId: string;
11
- supportTier: IntegrationSupportTier;
12
- actionCount: number;
13
- triggerCount: number;
14
- }
15
- interface IntegrationRegistryConflict {
16
- field: 'auth' | 'category';
17
- values: Array<{
18
- value: string;
19
- sourceId: string;
20
- connectorId: string;
21
- }>;
22
- }
23
- interface IntegrationRegistryEntry {
24
- canonicalId: string;
25
- connector: IntegrationConnector;
26
- aliases: string[];
27
- supportTier: IntegrationSupportTier;
28
- sources: IntegrationRegistrySourceRef[];
29
- conflicts: IntegrationRegistryConflict[];
30
- }
31
- interface IntegrationRegistry {
32
- entries: IntegrationRegistryEntry[];
33
- connectors: IntegrationConnector[];
34
- byId: Map<string, IntegrationRegistryEntry>;
35
- }
36
- interface IntegrationRegistrySummary {
37
- totalEntries: number;
38
- totalSources: number;
39
- toolBindableEntries: number;
40
- conflictEntries: number;
41
- bySupportTier: Record<IntegrationSupportTier, number>;
42
- }
43
- interface ComposeIntegrationRegistryOptions {
44
- aliases?: Record<string, string>;
45
- sourcePrecedence?: Record<string, number>;
46
- }
47
- declare function buildDefaultIntegrationRegistry(options?: {
48
- includeSpecs?: boolean;
49
- includeActivepieces?: boolean;
50
- }): IntegrationRegistry;
51
- declare function composeIntegrationRegistry(sources: IntegrationCatalogSource[], options?: ComposeIntegrationRegistryOptions): IntegrationRegistry;
52
- declare function summarizeIntegrationRegistry(registry: IntegrationRegistry): IntegrationRegistrySummary;
53
- declare function canonicalConnectorId(id: string, aliases?: Record<string, string>): string;
54
- declare function inferIntegrationSupportTier(connector: IntegrationConnector): IntegrationSupportTier;
55
-
56
- type IntegrationAuditEventType = 'connection.created' | 'connection.updated' | 'connection.revoked' | 'grant.created' | 'grant.revoked' | 'capability.issued' | 'action.invoked' | 'action.failed' | 'trigger.subscribed' | 'trigger.received' | 'workflow.installed' | 'approval.requested' | 'approval.resolved' | 'healthcheck.completed';
57
- interface IntegrationAuditEvent {
58
- id: string;
59
- type: IntegrationAuditEventType;
60
- occurredAt: string;
61
- actor?: IntegrationActor;
62
- connectionId?: string;
63
- providerId?: string;
64
- connectorId?: string;
65
- action?: string;
66
- risk?: IntegrationConnectorAction['risk'];
67
- dataClass?: IntegrationDataClass;
68
- ok?: boolean;
69
- message?: string;
70
- metadata?: Record<string, unknown>;
71
- }
72
- interface IntegrationAuditSink {
73
- record(event: IntegrationAuditEvent): Promise<void> | void;
74
- }
75
- interface IntegrationAuditStore extends IntegrationAuditSink {
76
- list(filter?: IntegrationAuditFilter): Promise<IntegrationAuditEvent[]> | IntegrationAuditEvent[];
77
- }
78
- interface IntegrationAuditFilter {
79
- type?: IntegrationAuditEventType;
80
- actor?: IntegrationActor;
81
- connectionId?: string;
82
- providerId?: string;
83
- connectorId?: string;
84
- action?: string;
85
- }
86
- declare class InMemoryIntegrationAuditStore implements IntegrationAuditStore {
87
- private readonly events;
88
- record(event: IntegrationAuditEvent): void;
89
- list(filter?: IntegrationAuditFilter): IntegrationAuditEvent[];
90
- }
91
- declare function createIntegrationAuditEvent(input: Omit<IntegrationAuditEvent, 'id' | 'occurredAt'> & {
92
- id?: string;
93
- occurredAt?: string | Date;
94
- now?: () => Date;
95
- }): IntegrationAuditEvent;
96
- declare function createAuditingActionGuard(options: {
97
- sink: IntegrationAuditSink;
98
- subject?: IntegrationActor;
99
- now?: () => Date;
100
- includeInputPreview?: boolean;
101
- }): IntegrationActionGuard;
102
- declare function sanitizeAuditConnection(connection: IntegrationConnection): Record<string, unknown>;
103
-
104
- type IntegrationApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired';
105
- interface IntegrationApprovalRecord {
106
- id: string;
107
- request: IntegrationApprovalRequest;
108
- status: IntegrationApprovalStatus;
109
- requestedAt: string;
110
- resolvedAt?: string;
111
- resolvedBy?: IntegrationActor;
112
- reason?: string;
113
- expiresAt?: string;
114
- metadata?: Record<string, unknown>;
115
- }
116
- interface IntegrationApprovalStore {
117
- get(approvalId: string): Promise<IntegrationApprovalRecord | undefined> | IntegrationApprovalRecord | undefined;
118
- put(record: IntegrationApprovalRecord): Promise<void> | void;
119
- list(filter?: IntegrationApprovalFilter): Promise<IntegrationApprovalRecord[]> | IntegrationApprovalRecord[];
120
- }
121
- interface IntegrationApprovalFilter {
122
- status?: IntegrationApprovalStatus;
123
- connectionId?: string;
124
- connectorId?: string;
125
- action?: string;
126
- actor?: IntegrationActor;
127
- }
128
- interface ApprovalBackedPolicyOptions {
129
- base: IntegrationPolicyEngine;
130
- store: IntegrationApprovalStore;
131
- audit?: IntegrationAuditSink;
132
- now?: () => Date;
133
- approvalTtlMs?: number;
134
- }
135
- declare class InMemoryIntegrationApprovalStore implements IntegrationApprovalStore {
136
- private readonly records;
137
- get(approvalId: string): IntegrationApprovalRecord | undefined;
138
- put(record: IntegrationApprovalRecord): void;
139
- list(filter?: IntegrationApprovalFilter): IntegrationApprovalRecord[];
140
- }
141
- declare class ApprovalBackedPolicyEngine implements IntegrationPolicyEngine {
142
- private readonly base;
143
- private readonly store;
144
- private readonly audit;
145
- private readonly now;
146
- private readonly approvalTtlMs;
147
- constructor(options: ApprovalBackedPolicyOptions);
148
- decide(ctx: IntegrationGuardContext & {
149
- subject: IntegrationActor;
150
- }): Promise<IntegrationPolicyDecision>;
151
- private findApprovedRecord;
152
- }
153
- declare function createApprovalBackedPolicyEngine(options: ApprovalBackedPolicyOptions): ApprovalBackedPolicyEngine;
154
- declare function resolveIntegrationApproval(input: {
155
- store: IntegrationApprovalStore;
156
- approvalId: string;
157
- approved: boolean;
158
- resolvedBy: IntegrationActor;
159
- reason?: string;
160
- metadata?: Record<string, unknown>;
161
- audit?: IntegrationAuditSink;
162
- now?: () => Date;
163
- }): Promise<IntegrationApprovalRecord>;
164
-
165
- interface IntegrationToolDefinition {
166
- name: string;
167
- title: string;
168
- description: string;
169
- providerId: string;
170
- connectorId: string;
171
- connectorTitle: string;
172
- category: IntegrationConnectorCategory;
173
- action: IntegrationConnectorAction;
174
- risk: IntegrationActionRisk;
175
- dataClass: IntegrationDataClass;
176
- requiredScopes: string[];
177
- inputSchema?: unknown;
178
- outputSchema?: unknown;
179
- tags: string[];
180
- }
181
- interface IntegrationToolSearchFilters {
182
- providerId?: string;
183
- connectorId?: string;
184
- category?: IntegrationConnectorCategory;
185
- maxRisk?: IntegrationActionRisk;
186
- dataClass?: IntegrationDataClass;
187
- limit?: number;
188
- }
189
- interface IntegrationToolSearchResult {
190
- tool: IntegrationToolDefinition;
191
- score: number;
192
- matched: string[];
193
- }
194
- interface McpToolDefinition {
195
- name: string;
196
- description: string;
197
- inputSchema: unknown;
198
- }
199
- declare function integrationToolName(providerId: string, connectorId: string, actionId: string): string;
200
- declare function parseIntegrationToolName(name: string): {
201
- providerId: string;
202
- connectorId: string;
203
- actionId: string;
204
- };
205
- declare function buildIntegrationToolCatalog(connectors: IntegrationConnector[]): IntegrationToolDefinition[];
206
- declare function searchIntegrationTools(catalog: IntegrationToolDefinition[], query: string, filters?: IntegrationToolSearchFilters): IntegrationToolSearchResult[];
207
- declare function toMcpTools(tools: IntegrationToolDefinition[]): McpToolDefinition[];
208
-
209
- type IntegrationRequirementMode = 'read' | 'write' | 'trigger';
210
- type IntegrationRequirementStatus = 'ready' | 'missing_connection' | 'not_executable' | 'unknown_connector';
211
- interface IntegrationRequirement {
212
- id: string;
213
- connectorId: string;
214
- reason: string;
215
- mode: IntegrationRequirementMode;
216
- requiredActions?: string[];
217
- requiredTriggers?: string[];
218
- requiredScopes?: string[];
219
- optional?: boolean;
220
- }
221
- interface IntegrationManifest {
222
- id: string;
223
- title?: string;
224
- owner?: IntegrationActor;
225
- requirements: IntegrationRequirement[];
226
- metadata?: Record<string, unknown>;
227
- }
228
- interface IntegrationRequirementResolution {
229
- requirement: IntegrationRequirement;
230
- status: IntegrationRequirementStatus;
231
- connector?: IntegrationConnector;
232
- registryEntry?: IntegrationRegistryEntry;
233
- connection?: IntegrationConnection;
234
- missingScopes: string[];
235
- missingActions: string[];
236
- missingTriggers: string[];
237
- message: string;
238
- }
239
- interface IntegrationManifestResolution {
240
- manifest: IntegrationManifest;
241
- owner: IntegrationActor;
242
- ready: IntegrationRequirementResolution[];
243
- missing: IntegrationRequirementResolution[];
244
- optionalMissing: IntegrationRequirementResolution[];
245
- }
246
- interface IntegrationGrant {
247
- id: string;
248
- manifestId: string;
249
- requirementId: string;
250
- owner: IntegrationActor;
251
- grantee: IntegrationActor;
252
- connectionId: string;
253
- connectorId: string;
254
- scopes: string[];
255
- allowedActions: string[];
256
- allowedTriggers: string[];
257
- status: 'active' | 'revoked';
258
- createdAt: string;
259
- updatedAt: string;
260
- metadata?: Record<string, unknown>;
261
- }
262
- interface IntegrationGrantStore {
263
- get(grantId: string): Promise<IntegrationGrant | undefined> | IntegrationGrant | undefined;
264
- put(grant: IntegrationGrant): Promise<void> | void;
265
- listByManifest(manifestId: string, grantee?: IntegrationActor): Promise<IntegrationGrant[]> | IntegrationGrant[];
266
- listByGrantee(grantee: IntegrationActor): Promise<IntegrationGrant[]> | IntegrationGrant[];
267
- delete?(grantId: string): Promise<void> | void;
268
- }
269
- interface IntegrationCapabilityBinding {
270
- requirementId: string;
271
- connectorId: string;
272
- connectionId: string;
273
- grantId: string;
274
- scopes: string[];
275
- allowedActions: string[];
276
- allowedTriggers: string[];
277
- capability: IssuedIntegrationCapability;
278
- }
279
- interface IntegrationSandboxBundle {
280
- manifestId: string;
281
- subject: IntegrationActor;
282
- capabilities: IntegrationCapabilityBinding[];
283
- connectors: IntegrationConnector[];
284
- tools: IntegrationToolDefinition[];
285
- expiresAt: string;
286
- }
287
- interface IntegrationRuntimeHub {
288
- listRegistry(): Promise<IntegrationRegistry> | IntegrationRegistry;
289
- listConnections(owner: IntegrationActor): Promise<IntegrationConnection[]> | IntegrationConnection[];
290
- issueCapability(input: {
291
- subject: IntegrationActor;
292
- connectionId: string;
293
- scopes: string[];
294
- allowedActions: string[];
295
- ttlMs: number;
296
- metadata?: Record<string, unknown>;
297
- }): Promise<IssuedIntegrationCapability> | IssuedIntegrationCapability;
298
- }
299
- interface IntegrationRuntimeOptions {
300
- hub: IntegrationRuntimeHub;
301
- grants?: IntegrationGrantStore;
302
- now?: () => Date;
303
- }
304
- declare class InMemoryIntegrationGrantStore implements IntegrationGrantStore {
305
- private readonly grants;
306
- get(grantId: string): IntegrationGrant | undefined;
307
- put(grant: IntegrationGrant): void;
308
- listByManifest(manifestId: string, grantee?: IntegrationActor): IntegrationGrant[];
309
- listByGrantee(grantee: IntegrationActor): IntegrationGrant[];
310
- delete(grantId: string): void;
311
- }
312
- declare class IntegrationRuntime {
313
- private readonly hub;
314
- private readonly grants;
315
- private readonly now;
316
- constructor(options: IntegrationRuntimeOptions);
317
- registry(): Promise<IntegrationRegistry>;
318
- resolveManifest(manifest: IntegrationManifest, owner: IntegrationActor): Promise<IntegrationManifestResolution>;
319
- createGrants(input: {
320
- manifest: IntegrationManifest;
321
- owner: IntegrationActor;
322
- grantee: IntegrationActor;
323
- metadata?: Record<string, unknown>;
324
- }): Promise<IntegrationGrant[]>;
325
- buildSandboxBundle(input: {
326
- manifestId: string;
327
- subject: IntegrationActor;
328
- ttlMs: number;
329
- grantee?: IntegrationActor;
330
- }): Promise<IntegrationSandboxBundle>;
331
- }
332
- declare function createIntegrationRuntime(options: IntegrationRuntimeOptions): IntegrationRuntime;
333
-
334
- declare const DEFAULT_INTEGRATION_BRIDGE_ENV = "TANGLE_INTEGRATION_BUNDLE";
335
- interface IntegrationBridgePayload {
336
- version: 1;
337
- manifestId: string;
338
- subject: IntegrationSandboxBundle['subject'];
339
- expiresAt: string;
340
- tools: IntegrationBridgeToolBinding[];
341
- }
342
- interface IntegrationBridgeToolBinding {
343
- name: string;
344
- title: string;
345
- connectorId: string;
346
- connectionId: string;
347
- action: string;
348
- risk: string;
349
- dataClass: string;
350
- requiredScopes: string[];
351
- capabilityToken: string;
352
- }
353
- declare function buildIntegrationBridgePayload(bundle: IntegrationSandboxBundle): IntegrationBridgePayload;
354
- declare function encodeIntegrationBridgePayload(payload: IntegrationBridgePayload): string;
355
- declare function decodeIntegrationBridgePayload(encoded: string): IntegrationBridgePayload;
356
- declare function buildIntegrationBridgeEnvironment(bundle: IntegrationSandboxBundle, options?: {
357
- envVar?: string;
358
- }): Record<string, string>;
359
- declare function parseIntegrationBridgeEnvironment(env: Record<string, string | undefined>, options?: {
360
- envVar?: string;
361
- }): IntegrationBridgePayload;
362
- declare function redactIntegrationBridgePayload(payload: IntegrationBridgePayload): IntegrationBridgePayload;
363
-
364
- /**
365
- * Connector primitives — the contract a concrete first-party integration
366
- * (Google Calendar, HubSpot, Stripe, ...) implements. Lower level than the
367
- * hub-side `IntegrationProvider` interface from `../index.ts`: a single
368
- * `IntegrationProvider` typically wraps several connectors (e.g., a
369
- * "first-party" provider that lists all your shipped connectors as a
370
- * single catalog).
371
- *
372
- * Layering:
373
- *
374
- * IntegrationHub — vendor-neutral facade (../index.ts)
375
- * ↓
376
- * IntegrationProvider — one per vendor (Nango/Composio/first-party)
377
- * ↓
378
- * ConnectorAdapter (this file) — one per integration (Google Calendar, ...)
379
- * ↓
380
- * upstream HTTP API — vendor SDK / fetch / OAuth
381
- *
382
- * Three load-bearing decisions encoded here:
383
- *
384
- * 1. Capabilities are typed (`read` vs `mutation`). Every mutation MUST
385
- * declare a CAS strategy. Conflict resolution is the SDK's job, not the
386
- * connector's. `validateConnectorManifest()` rejects unsafe manifests
387
- * before a connector is registered.
388
- *
389
- * 2. ConsistencyModel pins what the rest of the system can assume:
390
- * authoritative → the source IS the truth (Calendar, payments)
391
- * cache → we mirror with TTL and may serve stale (price list)
392
- * advisory → informational only (FAQ doc)
393
- * Agent planners can (and should) refuse to promise outcomes based on
394
- * `cache`/`advisory` data without a live `authoritative` confirmation.
395
- *
396
- * 3. Capabilities surface to the calling agent's tool registry by
397
- * transformation, not by hand-wiring. Adding a connector automatically
398
- * expands the agent's toolbelt for that specific user without touching
399
- * the prompt or runner.
400
- */
401
- /** Minimal JSON-schema shape used for capability arg validation. We
402
- * intentionally don't pull `@types/json-schema` — most consumers already
403
- * declare parameters as `Record<string, unknown>` and the
404
- * shape is whatever the LLM SDK's structured-output expects. Keep the
405
- * contract loose at the boundary; tighten via runtime zod where needed. */
406
- type CapabilityParameterSchema = Record<string, unknown>;
407
- /** What the rest of the system is allowed to assume about freshness. */
408
- type ConsistencyModel = 'authoritative' | 'cache' | 'advisory';
409
- /** Capability classes. `read` is safe to retry; `mutation` must go through
410
- * MutationGuard (CAS + idempotency). `subscribe` is reserved for future
411
- * push-driven sources (webhook callbacks) and is not yet wired. */
412
- type CapabilityClass = 'read' | 'mutation' | 'subscribe';
413
- /** Compare-and-swap strategy a mutation uses to detect conflicts. */
414
- type CASStrategy =
415
- /** Upstream returns an etag/sequence on read, accepts If-Match on write
416
- * (Google Calendar, GitHub, GDocs revision_id). The connector returns
417
- * 412 / Precondition Failed on conflict; the SDK maps to ResourceContention. */
418
- 'etag-if-match'
419
- /** Upstream guarantees exactly-once-per-key (Stripe, idempotent webhooks).
420
- * The SDK passes the idempotency key through; no etag check. */
421
- | 'native-idempotency'
422
- /** No upstream concurrency control. Connector MUST do read-then-write
423
- * and verify nothing changed in-between (best-effort). Suitable only
424
- * for low-contention single-user resources; rejected for any
425
- * consistencyModel='authoritative' write that may race. */
426
- | 'optimistic-read-verify'
427
- /** Source is not contended (e.g. logging, telemetry). Mutations are
428
- * fire-and-forget. Marks the capability as not eligible for
429
- * authoritative writes. */
430
- | 'none';
431
- interface CapabilityRead {
432
- name: string;
433
- class: 'read';
434
- description: string;
435
- /** JSON-schema for the tool args the agent passes when invoking. */
436
- parameters: CapabilityParameterSchema;
437
- /** Optional: declare which scopes (per the connector manifest) this
438
- * capability requires. The capability is hidden from the agent's
439
- * tool registry if the user's grant didn't include them. */
440
- requiredScopes?: string[];
441
- }
442
- interface CapabilityMutation {
443
- name: string;
444
- class: 'mutation';
445
- description: string;
446
- parameters: CapabilityParameterSchema;
447
- /** Mandatory: how does the connector guarantee at-most-once + conflict-detect? */
448
- cas: CASStrategy;
449
- /** True for capabilities that affect resources outside the calling user
450
- * (e.g. booking against a shared calendar, charging a card). The agent's
451
- * planner treats these specially: requires explicit caller confirmation
452
- * before the call. */
453
- externalEffect: boolean;
454
- requiredScopes?: string[];
455
- }
456
- type Capability = CapabilityRead | CapabilityMutation;
457
- /** OAuth2 scope catalog the user has granted us, plus arbitrary metadata
458
- * the connector pinned at connect-time (calendar id, sheet id, webhook
459
- * url, …). `metadata` MUST NOT contain secrets — those go in the
460
- * encrypted credentials envelope. */
461
- interface DataSourceMetadata {
462
- scopes: string[];
463
- [key: string]: unknown;
464
- }
465
- /** A connected, authenticated, ready-to-call data source for a project.
466
- * Persistence shape mirrors the product's connection/source row but normalized — the
467
- * encrypted credentials envelope is decrypted at hand-out time and held
468
- * in memory only for the duration of the call. */
469
- interface ResolvedDataSource {
470
- id: string;
471
- projectId: string;
472
- publishedAgentId: string | null;
473
- kind: string;
474
- label: string;
475
- consistencyModel: ConsistencyModel;
476
- scopes: string[];
477
- metadata: Record<string, unknown>;
478
- /** Unwrapped credentials handed to the connector at call-time. Never
479
- * persisted in this shape; never logged. */
480
- credentials: ConnectorCredentials;
481
- status: 'active' | 'revoked' | 'error';
482
- }
483
- /** Discriminated union of credential shapes. Connectors that need new
484
- * shapes extend this union — `kind` is sealed via the tagged pattern so
485
- * TypeScript catches an exhaustiveness gap at compile time. */
486
- type ConnectorCredentials = {
487
- kind: 'oauth2';
488
- accessToken: string;
489
- refreshToken?: string;
490
- expiresAt?: number;
491
- } | {
492
- kind: 'api-key';
493
- apiKey: string;
494
- } | {
495
- kind: 'hmac';
496
- secret: string;
497
- } | {
498
- kind: 'none';
499
- };
500
- /** Result of a read capability invocation. */
501
- interface CapabilityReadResult {
502
- /** Free-form payload — the connector's data shape. The agent receives
503
- * this as the tool result; planners consume it via JSON-shape contract
504
- * declared in the capability's `parameters` (output schema). */
505
- data: unknown;
506
- /** Optional etag/sequence the caller can reuse for a subsequent CAS
507
- * mutation. */
508
- etag?: string;
509
- /** When this read happened (UTC ms since epoch). */
510
- fetchedAt: number;
511
- }
512
- /** Result of a mutation capability invocation. Either committed (with the
513
- * resulting etag/sequence so the caller can chain mutations), or
514
- * contended (the upstream rejected with a state mismatch — the agent
515
- * should re-read and retry, or surface alternatives to the caller). */
516
- type CapabilityMutationResult = {
517
- status: 'committed';
518
- data: unknown;
519
- etagAfter?: string;
520
- committedAt: number;
521
- /** True iff this commit was returned from the idempotency store
522
- * rather than executed against upstream. The caller can use this
523
- * to suppress confirmation messages on retry. */
524
- idempotentReplay: boolean;
525
- } | {
526
- status: 'conflict';
527
- /** Best-effort alternative options the upstream surfaced (e.g.,
528
- * next-available calendar slots after a booking conflict). */
529
- alternatives: unknown[];
530
- /** The current authoritative state, if the connector could re-read
531
- * cheaply. */
532
- currentState?: unknown;
533
- message: string;
534
- } | {
535
- status: 'rate-limited';
536
- /** Wall-clock ms the caller should wait before retrying. The SDK
537
- * computes this from the bucket's refill schedule so the agent
538
- * doesn't have to guess. */
539
- retryAfterMs: number;
540
- message: string;
541
- };
542
- /** Inputs the SDK passes into the connector's executeRead / executeMutation. */
543
- interface ConnectorInvocation {
544
- source: ResolvedDataSource;
545
- capabilityName: string;
546
- args: Record<string, unknown>;
547
- /** Idempotency key the caller (or the SDK's defaulting policy) supplied.
548
- * Always present at the connector boundary — the SDK manufactures one
549
- * if the agent didn't pass one. */
550
- idempotencyKey: string;
551
- /** Optional caller-supplied etag the connector should send as If-Match. */
552
- expectedEtag?: string;
553
- /** Product/session id (if any) for forensic logging. */
554
- callSessionId?: string;
555
- }
556
- /** A single inbound event extracted from a push payload. The webhook
557
- * receiver persists one `InboundEvent` row per entry the connector returns. */
558
- interface InboundEvent {
559
- eventType: string;
560
- providerEventId?: string;
561
- payload: Record<string, unknown>;
562
- }
563
- /** Adapter response from an inbound-webhook dispatch. The receiver persists
564
- * every `events[]` entry, then either honors the connector's `response`
565
- * override (Slack `url_verification` echo, provider-specific 2xx body) or
566
- * defaults to `{status: 200, body: {received: true, count: events.length}}`. */
567
- interface EventHandlerResult {
568
- events: InboundEvent[];
569
- /** Optional: how to respond to the provider. Stripe wants 200 within
570
- * 30s; Slack wants the challenge param echoed. */
571
- response?: {
572
- status: number;
573
- body: unknown;
574
- headers?: Record<string, string>;
575
- };
576
- }
577
- /**
578
- * Connector adapter — one per integration kind. Stateless. The SDK holds
579
- * the persistence + crypto + mutation-guard concerns; the adapter only
580
- * knows how to talk to its upstream.
581
- */
582
- interface ConnectorAdapter {
583
- /** Manifest entry the registry uses to render UI + validate args. */
584
- manifest: ConnectorManifest;
585
- /** Read invocation. Required when manifest.capabilities contains reads.
586
- * Should return whatever shape the capability declared
587
- * in its parameters output schema. */
588
- executeRead?(inv: ConnectorInvocation): Promise<CapabilityReadResult>;
589
- /** Mutation invocation. Required when manifest.capabilities contains mutations.
590
- * Throws ResourceContention on a CAS miss; throws
591
- * any other Error for upstream failures. The MutationGuard wraps this
592
- * with idempotency-key short-circuit + audit logging — adapters do
593
- * NOT manage their own dedup. */
594
- executeMutation?(inv: ConnectorInvocation): Promise<CapabilityMutationResult>;
595
- /** Inbound webhook signature verifier. Called BEFORE handleInboundEvent.
596
- * MUST use constant-time comparison (`crypto.timingSafeEqual`) for any
597
- * HMAC check. The receiver returns 401 on `valid=false` without invoking
598
- * handleInboundEvent. Optional: connectors that don't accept push events
599
- * omit this method and the receiver returns 405 for the kind. */
600
- verifySignature?(input: {
601
- rawBody: string;
602
- headers: Record<string, string | string[] | undefined>;
603
- source: ResolvedDataSource;
604
- }): {
605
- valid: boolean;
606
- reason?: string;
607
- };
608
- /** Inbound webhook dispatch. Called AFTER verifySignature passes. The
609
- * adapter parses the provider payload and emits zero-or-more
610
- * `InboundEvent` rows; the receiver persists them as one row each (modulo
611
- * the (dataSourceId, providerEventId) dedup unique). The optional
612
- * `response` overrides the receiver's default 200 (Slack `url_verification`
613
- * needs to echo the challenge in the body to pass Slack's app-config check). */
614
- handleInboundEvent?(input: {
615
- source: ResolvedDataSource;
616
- rawBody: string;
617
- headers: Record<string, string | string[] | undefined>;
618
- }): Promise<EventHandlerResult>;
619
- /** OAuth callback handler — exchanges the auth code for tokens, returns
620
- * the credentials envelope + scopes + metadata. Only present for
621
- * oauth2-style adapters. */
622
- exchangeOAuth?(input: {
623
- code: string;
624
- state: string;
625
- codeVerifier: string;
626
- redirectUri: string;
627
- }): Promise<{
628
- credentials: ConnectorCredentials;
629
- scopes: string[];
630
- metadata: Record<string, unknown>;
631
- }>;
632
- /** Refresh access token. Only required for oauth2 adapters with
633
- * short-lived access tokens. */
634
- refreshToken?(input: ConnectorCredentials): Promise<ConnectorCredentials>;
635
- /** Health check — invoked when the user clicks "Test connection" in the
636
- * UI. Should perform the cheapest possible read that proves the grant
637
- * is still valid. Returns `{ok: false, reason}` rather than throwing
638
- * for the common case (token expired, scope missing). */
639
- test(source: ResolvedDataSource): Promise<{
640
- ok: true;
641
- } | {
642
- ok: false;
643
- reason: string;
644
- }>;
645
- }
646
- /** Static manifest a connector module exports. Drives the UI catalog,
647
- * scope display, capability discovery for the agent's tool registry. */
648
- interface ConnectorManifest {
649
- /** Stable kind id used as the foreign key in DataSource.kind. */
650
- kind: string;
651
- /** Human label shown in the UI catalog. */
652
- displayName: string;
653
- /** One-paragraph description shown next to the connect button. */
654
- description: string;
655
- /** Auth shape this connector requires. */
656
- auth: AuthSpec;
657
- /** Capability catalog — the agent's tool registry derives ToolDefinition
658
- * entries from this list at request time. */
659
- capabilities: Capability[];
660
- /** ConsistencyModel default for this kind — overridable per DataSource
661
- * if a particular instance is special (e.g., a user marks a sheet as
662
- * `cache` because they refresh it nightly). */
663
- defaultConsistencyModel: ConsistencyModel;
664
- /** Connector category for UI grouping. */
665
- category: 'calendar' | 'spreadsheet' | 'crm' | 'doc' | 'webhook' | 'storage' | 'comms' | 'commerce' | 'other';
666
- /** Optional icon URL or named icon. */
667
- icon?: string;
668
- /** Optional per-kind rate-limit budget. The SDK enforces it inside
669
- * `executeGuardedMutation` and the read path of `/invoke`. Omit to
670
- * leave the connector unrestricted. */
671
- rateLimit?: RateLimitSpec;
672
- }
673
- /** Token-bucket budget the SDK enforces against the connector's upstream.
674
- * We meter on OUR side rather than letting the upstream reject so a
675
- * chatty agent can't burn quota that's shared across customers (almost
676
- * every OAuth client is). */
677
- interface RateLimitSpec {
678
- /** Max requests per window. */
679
- requests: number;
680
- /** Window in ms. */
681
- windowMs: number;
682
- /** Whether to apply across all DataSources sharing the same OAuth
683
- * client (true; default), or per-DataSource (false). The former
684
- * matches how upstreams meter (per-app), so almost always pick true. */
685
- scope?: 'oauth-client' | 'data-source';
686
- }
687
- type AuthSpec = {
688
- kind: 'oauth2';
689
- /** Authorization endpoint URL. */
690
- authorizationUrl: string;
691
- /** Token endpoint URL. */
692
- tokenUrl: string;
693
- /** Scopes requested in the authorization grant. The user UI shows
694
- * these so the customer knows what's being shared. */
695
- scopes: string[];
696
- /** Whether the connector supports incremental authorization (Google
697
- * does; many don't). */
698
- incremental?: boolean;
699
- /** Env-var name holding the OAuth client_id. */
700
- clientIdEnv: string;
701
- /** Env-var name holding the OAuth client_secret. */
702
- clientSecretEnv: string;
703
- /** Optional extra params attached to the authorization URL (e.g.,
704
- * Google's `access_type=offline&prompt=consent` to obtain refresh
705
- * tokens). */
706
- extraAuthParams?: Record<string, string>;
707
- } | {
708
- kind: 'api-key';
709
- /** UI hint shown when collecting the key. */
710
- hint: string;
711
- } | {
712
- kind: 'hmac';
713
- } | {
714
- kind: 'none';
715
- };
716
- /** Thrown by `executeMutation` when upstream rejects on CAS — caught and
717
- * rewrapped by MutationGuard. */
718
- declare class ResourceContention extends Error {
719
- readonly alternatives: unknown[];
720
- readonly currentState?: unknown | undefined;
721
- readonly name = "ResourceContention";
722
- constructor(message: string, alternatives?: unknown[], currentState?: unknown | undefined);
723
- }
724
- /** Thrown when the connector finds the user's grant has been revoked or
725
- * the access token is no longer valid AND refresh failed. Surfaces to
726
- * the UI as "Reconnect required". */
727
- declare class CredentialsExpired extends Error {
728
- readonly dataSourceId: string;
729
- readonly name = "CredentialsExpired";
730
- constructor(message: string, dataSourceId: string);
731
- }
732
- interface ConnectorManifestValidationIssue {
733
- path: string;
734
- message: string;
735
- }
736
- interface ConnectorManifestValidationResult {
737
- ok: boolean;
738
- issues: ConnectorManifestValidationIssue[];
739
- }
740
- /** Validate the static connector manifest before a provider registers it.
741
- * This catches the expensive mistakes early: duplicate capability names,
742
- * mutation capabilities without CAS, authoritative fire-and-forget writes,
743
- * and invalid rate-limit specs. */
744
- declare function validateConnectorManifest(manifest: ConnectorManifest): ConnectorManifestValidationResult;
745
- declare function assertValidConnectorManifest(manifest: ConnectorManifest): void;
746
-
747
- interface ConnectorAdapterProviderOptions {
748
- id?: string;
749
- kind?: IntegrationProviderKind;
750
- adapters: ConnectorAdapter[];
751
- resolveDataSource: (connection: IntegrationConnection) => Promise<ResolvedDataSource> | ResolvedDataSource;
752
- now?: () => Date;
753
- }
754
- declare function createConnectorAdapterProvider(options: ConnectorAdapterProviderOptions): IntegrationProvider;
755
- declare function manifestToConnector(providerId: string, adapter: ConnectorAdapter): IntegrationConnector;
756
-
757
- interface IntegrationSecretStore {
758
- get(ref: SecretRef): Promise<ConnectorCredentials | undefined> | ConnectorCredentials | undefined;
759
- put(ref: SecretRef, credentials: ConnectorCredentials): Promise<void> | void;
760
- delete?(ref: SecretRef): Promise<void> | void;
761
- }
762
- interface ConnectionCredentialResolverOptions {
763
- secrets: IntegrationSecretStore;
764
- connections?: IntegrationConnectionStore;
765
- adapters?: ConnectorAdapter[];
766
- now?: () => Date;
767
- markConnectionError?: (connection: IntegrationConnection, error: Error) => Promise<void> | void;
768
- }
769
- declare class InMemoryIntegrationSecretStore implements IntegrationSecretStore {
770
- private readonly secrets;
771
- get(ref: SecretRef): ConnectorCredentials | undefined;
772
- put(ref: SecretRef, credentials: ConnectorCredentials): void;
773
- delete(ref: SecretRef): void;
774
- }
775
- declare function createConnectionCredentialResolver(options: ConnectionCredentialResolverOptions): (connection: IntegrationConnection) => Promise<ResolvedDataSource>;
776
- declare function resolveConnectionCredentials(input: IntegrationConnection, options: ConnectionCredentialResolverOptions): Promise<ConnectorCredentials>;
777
- declare function createCredentialBackedAdapterProvider(options: Omit<ConnectorAdapterProviderOptions, 'resolveDataSource'> & ConnectionCredentialResolverOptions): IntegrationProvider;
778
- declare function revokeConnection(input: {
779
- connection: IntegrationConnection;
780
- connections?: IntegrationConnectionStore;
781
- secrets?: IntegrationSecretStore;
782
- now?: () => Date;
783
- }): Promise<IntegrationConnection>;
784
-
785
- interface IntegrationWorkflowDefinition {
786
- id: string;
787
- title?: string;
788
- manifest: IntegrationManifest;
789
- trigger: {
790
- requirementId: string;
791
- triggerId: string;
792
- targetUrl?: string;
793
- };
794
- metadata?: Record<string, unknown>;
795
- }
796
- interface InstalledIntegrationWorkflow {
797
- id: string;
798
- workflowId: string;
799
- manifestId: string;
800
- owner: IntegrationActor;
801
- grantee: IntegrationActor;
802
- triggerGrantId: string;
803
- subscription: IntegrationTriggerSubscription;
804
- status: 'active' | 'paused' | 'error';
805
- createdAt: string;
806
- metadata?: Record<string, unknown>;
807
- }
808
- interface IntegrationWorkflowStore {
809
- put(workflow: InstalledIntegrationWorkflow): Promise<void> | void;
810
- get(id: string): Promise<InstalledIntegrationWorkflow | undefined> | InstalledIntegrationWorkflow | undefined;
811
- list(): Promise<InstalledIntegrationWorkflow[]> | InstalledIntegrationWorkflow[];
812
- listByWorkflow(workflowId: string): Promise<InstalledIntegrationWorkflow[]> | InstalledIntegrationWorkflow[];
813
- listByOwner(owner: IntegrationActor): Promise<InstalledIntegrationWorkflow[]> | InstalledIntegrationWorkflow[];
814
- }
815
- interface IntegrationWorkflowRuntimeHub {
816
- subscribeTrigger(connectionId: string, trigger: string, targetUrl?: string): Promise<IntegrationTriggerSubscription> | IntegrationTriggerSubscription;
817
- }
818
- interface IntegrationWorkflowRuntimeOptions {
819
- runtime: IntegrationRuntime;
820
- hub: IntegrationWorkflowRuntimeHub;
821
- grants: IntegrationGrantStore;
822
- store?: IntegrationWorkflowStore;
823
- now?: () => Date;
824
- }
825
- declare class InMemoryIntegrationWorkflowStore implements IntegrationWorkflowStore {
826
- private readonly workflows;
827
- put(workflow: InstalledIntegrationWorkflow): void;
828
- get(id: string): InstalledIntegrationWorkflow | undefined;
829
- list(): InstalledIntegrationWorkflow[];
830
- listByWorkflow(workflowId: string): InstalledIntegrationWorkflow[];
831
- listByOwner(owner: IntegrationActor): InstalledIntegrationWorkflow[];
832
- }
833
- declare class IntegrationWorkflowRuntime {
834
- private readonly runtime;
835
- private readonly hub;
836
- private readonly grants;
837
- private readonly store;
838
- private readonly now;
839
- constructor(options: IntegrationWorkflowRuntimeOptions);
840
- install(input: {
841
- workflow: IntegrationWorkflowDefinition;
842
- owner: IntegrationActor;
843
- grantee: IntegrationActor;
844
- }): Promise<InstalledIntegrationWorkflow>;
845
- dispatchEvent<T = unknown>(event: IntegrationTriggerEvent<T>, handler: (input: {
846
- event: IntegrationTriggerEvent<T>;
847
- workflows: InstalledIntegrationWorkflow[];
848
- }) => Promise<void> | void): Promise<{
849
- matched: InstalledIntegrationWorkflow[];
850
- }>;
851
- }
852
- declare function createIntegrationWorkflowRuntime(options: IntegrationWorkflowRuntimeOptions): IntegrationWorkflowRuntime;
853
-
854
- interface StoredIntegrationEvent {
855
- id: string;
856
- sourceId: string;
857
- connectorId: string;
858
- eventType: string;
859
- providerEventId?: string;
860
- receivedAt: string;
861
- payload: Record<string, unknown>;
862
- dispatchedAt?: string;
863
- metadata?: Record<string, unknown>;
864
- }
865
- interface IntegrationEventStore {
866
- put(event: StoredIntegrationEvent): Promise<void> | void;
867
- hasProviderEvent(sourceId: string, providerEventId: string): Promise<boolean> | boolean;
868
- list(): Promise<StoredIntegrationEvent[]> | StoredIntegrationEvent[];
869
- }
870
- interface IntegrationWebhookReceiverResult {
871
- status: number;
872
- body: unknown;
873
- headers?: Record<string, string>;
874
- received: StoredIntegrationEvent[];
875
- duplicates: StoredIntegrationEvent[];
876
- }
877
- declare class InMemoryIntegrationEventStore implements IntegrationEventStore {
878
- private readonly events;
879
- private readonly providerIds;
880
- put(event: StoredIntegrationEvent): void;
881
- hasProviderEvent(sourceId: string, providerEventId: string): boolean;
882
- list(): StoredIntegrationEvent[];
883
- }
884
- declare function receiveIntegrationWebhook(input: {
885
- adapter: ConnectorAdapter;
886
- source: ResolvedDataSource;
887
- rawBody: string;
888
- headers: Record<string, string | string[] | undefined>;
889
- store: IntegrationEventStore;
890
- workflowRuntime?: IntegrationWorkflowRuntime;
891
- now?: () => Date;
892
- }): Promise<IntegrationWebhookReceiverResult>;
893
- declare function storedEventToTriggerEvent(event: StoredIntegrationEvent, source: ResolvedDataSource): IntegrationTriggerEvent;
894
-
895
- interface IntegrationIdempotencyRecord {
896
- key: string;
897
- requestHash: string;
898
- result: IntegrationActionResult;
899
- createdAt: string;
900
- }
901
- interface IntegrationIdempotencyStore {
902
- get(key: string): Promise<IntegrationIdempotencyRecord | undefined> | IntegrationIdempotencyRecord | undefined;
903
- put(record: IntegrationIdempotencyRecord): Promise<void> | void;
904
- }
905
- interface IntegrationRateLimitDecision {
906
- allowed: boolean;
907
- retryAfterMs?: number;
908
- reason?: string;
909
- }
910
- interface IntegrationRateLimiter {
911
- check(ctx: IntegrationGuardContext): Promise<IntegrationRateLimitDecision> | IntegrationRateLimitDecision;
912
- }
913
- declare class InMemoryIntegrationIdempotencyStore implements IntegrationIdempotencyStore {
914
- private readonly records;
915
- get(key: string): IntegrationIdempotencyRecord | undefined;
916
- put(record: IntegrationIdempotencyRecord): void;
917
- }
918
- declare class DefaultIntegrationActionGuard implements IntegrationActionGuard {
919
- private readonly idempotency;
920
- private readonly audit;
921
- private readonly rateLimiter;
922
- private readonly now;
923
- constructor(options?: {
924
- idempotency?: IntegrationIdempotencyStore;
925
- audit?: IntegrationAuditSink;
926
- rateLimiter?: IntegrationRateLimiter;
927
- now?: () => Date;
928
- });
929
- invokeAction(ctx: IntegrationGuardContext, proceed: () => Promise<IntegrationActionResult>): Promise<IntegrationActionResult>;
930
- private writeIdempotency;
931
- }
932
- declare function createDefaultIntegrationActionGuard(options?: ConstructorParameters<typeof DefaultIntegrationActionGuard>[0]): DefaultIntegrationActionGuard;
933
-
934
- type IntegrationHealthcheckStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
935
- interface IntegrationHealthcheckCheck {
936
- id: string;
937
- status: IntegrationHealthcheckStatus;
938
- message: string;
939
- metadata?: Record<string, unknown>;
940
- }
941
- interface IntegrationHealthcheckResult {
942
- connectionId: string;
943
- providerId: string;
944
- connectorId: string;
945
- status: IntegrationHealthcheckStatus;
946
- checkedAt: string;
947
- checks: IntegrationHealthcheckCheck[];
948
- metadata?: Record<string, unknown>;
949
- }
950
- interface IntegrationHealthcheckStore {
951
- put(result: IntegrationHealthcheckResult): Promise<void> | void;
952
- get(connectionId: string): Promise<IntegrationHealthcheckResult | undefined> | IntegrationHealthcheckResult | undefined;
953
- list(): Promise<IntegrationHealthcheckResult[]> | IntegrationHealthcheckResult[];
954
- }
955
- declare class InMemoryIntegrationHealthcheckStore implements IntegrationHealthcheckStore {
956
- private readonly results;
957
- put(result: IntegrationHealthcheckResult): void;
958
- get(connectionId: string): IntegrationHealthcheckResult | undefined;
959
- list(): IntegrationHealthcheckResult[];
960
- }
961
- declare function runIntegrationHealthcheck(input: {
962
- connection: IntegrationConnection;
963
- connector?: IntegrationConnector;
964
- registry?: IntegrationRegistry;
965
- test?: (connection: IntegrationConnection, connector: IntegrationConnector) => Promise<IntegrationActionResult | boolean> | IntegrationActionResult | boolean;
966
- audit?: IntegrationAuditSink;
967
- now?: () => Date;
968
- }): Promise<IntegrationHealthcheckResult>;
969
- declare function runIntegrationHealthchecks(input: {
970
- connections: IntegrationConnection[];
971
- registry?: IntegrationRegistry;
972
- store?: IntegrationHealthcheckStore;
973
- audit?: IntegrationAuditSink;
974
- now?: () => Date;
975
- test?: (connection: IntegrationConnection, connector: IntegrationConnector) => Promise<IntegrationActionResult | boolean> | IntegrationActionResult | boolean;
976
- }): Promise<IntegrationHealthcheckResult[]>;
977
- declare function healthcheckRequest(action?: string): IntegrationActionRequest;
978
-
979
- /**
980
- * Generic OAuth2 helper used by every oauth-shaped connector (Google
981
- * Calendar, Sheets, Drive, HubSpot, Salesforce, Zoom, ...).
982
- *
983
- * Everything PKCE-aware. Opaque-state CSRF guard. Refresh-token aware.
984
- * No connector-specific logic lives here — adapters hand a `clientId`,
985
- * `clientSecret`, `tokenUrl`, optional `extraAuthParams` and the rest is
986
- * mechanical.
987
- *
988
- * State and code_verifier are kept in a short-TTL flow store keyed by the
989
- * opaque `state` we round-trip through the provider. The default store is
990
- * in-memory for local/dev and tests. Production deployments should inject a
991
- * durable store backed by KV/Redis/D1/etc. so callbacks can land on any worker.
992
- */
993
- interface PendingOAuthFlow {
994
- /** code_verifier for PKCE. */
995
- codeVerifier: string;
996
- /** Opaque-state value also returned in the OAuth redirect. */
997
- state: string;
998
- /** Project the user is connecting under. */
999
- projectId: string;
1000
- /** Connector kind (e.g. 'google-calendar'). */
1001
- kind: string;
1002
- /** Operator-supplied label that becomes DataSource.label. */
1003
- label: string;
1004
- /** When we drop the entry. */
1005
- expiresAt: number;
1006
- /** The redirectUri we used in the start step — must match exactly on
1007
- * the callback exchange. */
1008
- redirectUri: string;
1009
- }
1010
- interface OAuthFlowStore {
1011
- put(state: string, flow: PendingOAuthFlow): Promise<void> | void;
1012
- consume(state: string): Promise<PendingOAuthFlow | undefined> | PendingOAuthFlow | undefined;
1013
- sweep?(now: number): Promise<void> | void;
1014
- clear?(): Promise<void> | void;
1015
- }
1016
- declare class InMemoryOAuthFlowStore implements OAuthFlowStore {
1017
- private readonly pendingFlows;
1018
- put(state: string, flow: PendingOAuthFlow): void;
1019
- consume(state: string): PendingOAuthFlow | undefined;
1020
- sweep(now: number): void;
1021
- clear(): void;
1022
- }
1023
- interface StartOAuthInput {
1024
- projectId: string;
1025
- kind: string;
1026
- label: string;
1027
- authorizationUrl: string;
1028
- scopes: string[];
1029
- clientId: string;
1030
- redirectUri: string;
1031
- /** Optional extra query params; Google needs `access_type=offline` and
1032
- * `prompt=consent` to issue refresh tokens reliably. */
1033
- extraAuthParams?: Record<string, string>;
1034
- /** Optional flow store. Use a durable store in distributed production
1035
- * runtimes; omitted means local in-memory storage. */
1036
- store?: OAuthFlowStore;
1037
- /** Override clock for tests. */
1038
- now?: number;
1039
- }
1040
- interface StartOAuthOutput {
1041
- /** URL the SPA should redirect the user to. */
1042
- authorizationUrl: string;
1043
- /** State token — caller stashes this in localStorage to verify on
1044
- * callback. */
1045
- state: string;
1046
- }
1047
- /** Build the authorization URL + state. SPA navigates the user there;
1048
- * user consents; provider redirects back to redirectUri with `code` +
1049
- * `state`. The caller's callback then invokes `consumePendingFlow`. */
1050
- declare function startOAuthFlow(input: StartOAuthInput): StartOAuthOutput;
1051
- /** Look up + remove the pending flow record. Throws if state is unknown
1052
- * or expired (CSRF guard / replay protection). */
1053
- declare function consumePendingFlow(state: string, store?: OAuthFlowStore): Promise<PendingOAuthFlow>;
1054
- interface ExchangeCodeInput {
1055
- tokenUrl: string;
1056
- clientId: string;
1057
- clientSecret: string;
1058
- code: string;
1059
- codeVerifier: string;
1060
- redirectUri: string;
1061
- }
1062
- interface OAuthTokens {
1063
- accessToken: string;
1064
- refreshToken?: string;
1065
- expiresIn?: number;
1066
- scope?: string;
1067
- tokenType?: string;
1068
- }
1069
- /** POST authorization code → token endpoint. Provider-agnostic; if a
1070
- * provider returns a non-standard JSON shape, the adapter wraps this
1071
- * call rather than reaching into the helper. */
1072
- declare function exchangeAuthorizationCode(input: ExchangeCodeInput): Promise<OAuthTokens>;
1073
- interface RefreshInput {
1074
- tokenUrl: string;
1075
- clientId: string;
1076
- clientSecret: string;
1077
- refreshToken: string;
1078
- }
1079
- /** Refresh an access token. Returns the new tokens — the connector layer
1080
- * is responsible for re-encrypting + persisting the envelope. */
1081
- declare function refreshAccessToken(input: RefreshInput): Promise<OAuthTokens>;
1082
- /** Test-only — drop pending flows between unit-test runs. */
1083
- declare function _resetPendingFlowsForTests(): void;
1084
-
1085
- /**
1086
- * Inbound webhook signature verifiers — provider-specific HMAC schemes.
1087
- *
1088
- * Each signature scheme is a pure function:
1089
- * (rawBody: string, headers, secret, now?) → boolean
1090
- *
1091
- * Constant-time comparison via `crypto.timingSafeEqual`. Timestamps are
1092
- * checked against a configurable tolerance to bound replay risk; the default
1093
- * mirrors the upstream provider's documented window (Stripe: 5 min, Slack: 5 min).
1094
- *
1095
- * These verifiers are the building blocks for any inbound-webhook receiver
1096
- * (a route + a `verify` call + a per-event handler). They live in this
1097
- * package so every consumer of the integration substrate gets correct
1098
- * verification — not just one product reimplementing it.
1099
- */
1100
- /** Default replay-protection window. Providers commonly use 5 minutes. */
1101
- declare const DEFAULT_SIGNATURE_TOLERANCE_SECONDS: number;
1102
- interface ParsedStripeSignatureHeader {
1103
- t: number;
1104
- sigs: string[];
1105
- }
1106
- declare function parseStripeSignatureHeader(header: string): ParsedStripeSignatureHeader | null;
1107
- interface StripeVerifyOptions {
1108
- /** Replay-protection window in seconds. Default 300. */
1109
- toleranceSeconds?: number;
1110
- /** Override `now()` for tests. UTC seconds. */
1111
- now?: number;
1112
- }
1113
- /** Verify a Stripe webhook signature against the raw request body. */
1114
- declare function verifyStripeSignature(rawBody: string, signatureHeader: string, secret: string, options?: StripeVerifyOptions): boolean;
1115
- interface SlackVerifyOptions {
1116
- toleranceSeconds?: number;
1117
- now?: number;
1118
- }
1119
- declare function verifySlackSignature(rawBody: string, signatureHeader: string, timestampHeader: string, secret: string, options?: SlackVerifyOptions): boolean;
1120
- interface GenericHmacVerifyOptions {
1121
- /** sha256 (default) | sha1 | sha512 — matches the algorithm the receiver
1122
- * computed at sign time. */
1123
- algorithm?: 'sha256' | 'sha1' | 'sha512';
1124
- /** Optional prefix the receiver prepends to the signature in the header
1125
- * (e.g., `'sha256='`). Stripped before constant-time comparison. */
1126
- signaturePrefix?: string;
1127
- /** Lowercase comparison (most providers emit hex-lowercase). Default true. */
1128
- lowercaseHex?: boolean;
1129
- }
1130
- declare function verifyHmacSignature(rawBody: string, signatureHeader: string, secret: string, options?: GenericHmacVerifyOptions): boolean;
1131
- interface TwilioVerifyOptions {
1132
- /** Skip verification when the auth token isn't configured. Useful in
1133
- * dev where the receiver wants to accept any payload. Default `false`
1134
- * — production should always require a configured token. */
1135
- skipWhenAuthTokenMissing?: boolean;
1136
- /** When true, sign the raw body instead of the URL-encoded sorted-params
1137
- * reduction. Twilio uses raw-body signing for `application/json`
1138
- * webhook bodies. Default `false`. */
1139
- bodyAsRaw?: boolean;
1140
- /** When `bodyAsRaw` is true, the raw body to sign. Ignored otherwise. */
1141
- rawBody?: string;
1142
- }
1143
- /** Verify a Twilio webhook signature. */
1144
- declare function verifyTwilioSignature(input: {
1145
- authToken: string | null | undefined;
1146
- signatureHeader: string | string[] | undefined;
1147
- fullUrl: string | null | undefined;
1148
- params: Record<string, string> | undefined;
1149
- }, options?: TwilioVerifyOptions): boolean;
1150
- declare function firstHeader(headers: Record<string, string | string[] | undefined>, name: string): string | undefined;
1151
-
1152
- /**
1153
- * Google Calendar connector — CAS reference implementation.
1154
- *
1155
- * Scopes: `https://www.googleapis.com/auth/calendar` covers list/insert/
1156
- * patch on the user's calendars. We could split read/write but for v1 the
1157
- * single scope keeps the consent screen simple; an operator who wants
1158
- * read-only-Calendar can pick a different `kind` later (`google-calendar-readonly`).
1159
- *
1160
- * The two capabilities the agent actually needs:
1161
- *
1162
- * list_availability(calendarId, timeMin, timeMax)
1163
- * → {busy: [{start, end}], events: [{id, etag, start, end, summary}]}
1164
- * Read; no CAS. Cheap (events.list).
1165
- *
1166
- * book_slot(calendarId, start, end, summary, attendees?)
1167
- * → {eventId, etag}
1168
- * Mutation. CAS by Calendar's own conflict-detection: we re-list
1169
- * events for the requested window inside the same call, and if any
1170
- * OVERLAP exists we return `conflict` with the next-3 free slots
1171
- * mined from the user's freebusy, instead of inserting.
1172
- *
1173
- * Why pre-flight read-then-insert rather than relying on If-Match:
1174
- * `events.insert` doesn't take If-Match (you can't precondition an
1175
- * insert against a non-existent resource). Calendar's own
1176
- * `freebusy.query` is the canonical conflict signal. The whole flow is:
1177
- *
1178
- * 1. freebusy.query for [start, end] on this calendarId
1179
- * 2. if busy → emit ResourceContention with next-3 free slots
1180
- * (computed by walking forward in 30-min steps until 3 free
1181
- * windows of (end-start) duration found)
1182
- * 3. else events.insert with idempotency-key as `requestId` (a Calendar
1183
- * API feature that gives us per-key dedup at upstream)
1184
- *
1185
- * Step 3's `requestId` parameter means a retry of the same idempotency
1186
- * key on the same calendar will return the original event rather than
1187
- * creating a duplicate, which composes correctly with our MutationGuard's
1188
- * idempotency record (which short-circuits before ever hitting upstream
1189
- * on the second call). Defense-in-depth.
1190
- */
1191
-
1192
- /** OAuth client config the factory closes over. Caller resolves these
1193
- * at construction time (env, DB, secret manager — package doesn't care). */
1194
- interface GoogleCalendarOptions {
1195
- clientId: string;
1196
- clientSecret: string;
1197
- }
1198
- declare function googleCalendar(opts: GoogleCalendarOptions): ConnectorAdapter;
1199
-
1200
- /**
1201
- * Google Sheets connector — live KB source + writable rows.
1202
- *
1203
- * The flagship for the "agent reads from a live spreadsheet" UX. The
1204
- * customer points the connection at a Sheet (spreadsheetId + sheetName +
1205
- * headerRow). We expose:
1206
- *
1207
- * list_rows(filter?, limit?)
1208
- * → {rows: [{...header→cell}], nextCursor?}
1209
- * Cheap; just spreadsheets.values.get with the configured range.
1210
- *
1211
- * query_rows(predicate)
1212
- * → same shape as list_rows but with a structured filter (k=v pairs
1213
- * ANDed together). Simple and explainable; no SQL.
1214
- *
1215
- * update_row(rowKey, patch)
1216
- * → {row: {...header→cell}, updatedRange}
1217
- * Mutation. CAS via Sheets' spreadsheets.values.update + a
1218
- * pre-flight read of the row's revisionId-equivalent hash. Sheets
1219
- * doesn't expose a per-row etag, so we synthesize one — see
1220
- * `rowFingerprint`. If the fingerprint doesn't match what the agent
1221
- * last read, we surface ResourceContention with the current row in
1222
- * `currentState`.
1223
- *
1224
- * KB binding: when a Sheet is `consistencyModel: 'cache'` (the default
1225
- * for spreadsheets — they're slow-moving), the system also indexes the
1226
- * rows as KB chunks. The KB build pipeline calls `list_rows` and emits
1227
- * one markdown page per row; on a connector-level "refresh" event the
1228
- * agent's KB rebuilds.
1229
- */
1230
-
1231
- /** OAuth client config the factory closes over. Caller resolves these
1232
- * at construction time (env, DB, secret manager — package doesn't care). */
1233
- interface GoogleSheetsOptions {
1234
- clientId: string;
1235
- clientSecret: string;
1236
- }
1237
- declare function googleSheets(opts: GoogleSheetsOptions): ConnectorAdapter;
1238
-
1239
- /**
1240
- * Microsoft Graph Calendar connector — the Outlook half of the
1241
- * voice-agent's "book me a slot" surface.
1242
- *
1243
- * Mirrors the Google Calendar pattern almost line-for-line, with two
1244
- * upstream-specific quirks worth calling out:
1245
- *
1246
- * 1. Graph exposes `@odata.etag` on every event resource AND honors
1247
- * `If-Match` on `events.patch` / `events.delete`. So unlike Calendar
1248
- * (insert can't be preconditioned against a non-existent resource),
1249
- * we DO get real etag CAS for updates after the booking. We still
1250
- * use the freebusy pre-flight for the create path, because the
1251
- * "two callers grab the same slot" race happens before any event
1252
- * exists.
1253
- *
1254
- * 2. `getSchedule` is the Graph equivalent of `freeBusy.query`. Same
1255
- * shape: send `[start, end]` plus the calendar's email/UPN, get
1256
- * back a `scheduleItems` list of busy windows.
1257
- *
1258
- * Why the same flow ports cleanly: the conflict mode is identical
1259
- * ("did someone else grab this slot between read and write?"). The
1260
- * mechanism — pre-flight read + idempotent insert — composes regardless
1261
- * of whether upstream gives us a request-id dedup feature. Graph does
1262
- * not have a `requestId` analogue on `events.create`, so we rely
1263
- * exclusively on MutationGuard's idempotency-key short-circuit ABOVE
1264
- * the connector. That layer prevents duplicate inserts on retry.
1265
- */
1266
-
1267
- /** OAuth client config the factory closes over. Caller resolves these
1268
- * at construction time (env, DB, secret manager — package doesn't care). */
1269
- interface MicrosoftCalendarOptions {
1270
- clientId: string;
1271
- clientSecret: string;
1272
- }
1273
- declare function microsoftCalendar(opts: MicrosoftCalendarOptions): ConnectorAdapter;
1274
-
1275
- /**
1276
- * HubSpot CRM connector — three load-bearing capabilities, picked to
1277
- * cover the voice-agent's CRM hot path without trying to swallow all of
1278
- * HubSpot's surface in v1.
1279
- *
1280
- * find_contact(email)
1281
- * → {contact: {id, properties}} | {found: false}
1282
- * POST /crm/v3/objects/contacts/search with an email-equality filter.
1283
- * Cheap, idempotent, no CAS needed (read).
1284
- *
1285
- * upsert_contact(email, properties)
1286
- * → {contactId, created}
1287
- * Mutation. CAS strategy = native-idempotency, BUT: HubSpot's
1288
- * `idempotencyKey` query param is ONLY available on the v3 *batch*
1289
- * endpoints (`/crm/v3/objects/contacts/batch/upsert`). The
1290
- * single-record endpoints don't honor it. We use the batch endpoint
1291
- * with a single-element array to get native idempotency on retry.
1292
- *
1293
- * create_note(contactId, body)
1294
- * → {noteId}
1295
- * Mutation that logs a note engagement on a contact and associates
1296
- * it. Notes are append-only — there's no conflict to detect — so we
1297
- * use native-idempotency via the same batch trick on
1298
- * `/crm/v3/objects/notes/batch/create`.
1299
- *
1300
- * Why three and not thirty: the agent's leverage on HubSpot is
1301
- * "remember who I just spoke to". `find_contact` lets the agent address
1302
- * a returning caller by name; `upsert_contact` captures a new one
1303
- * without duplicates; `create_note` writes the call's outcome as a CRM
1304
- * activity. Anything beyond these (deals, tickets, lists) lives in
1305
- * Tier-2 specific kinds — keeping the manifest tight keeps the agent's
1306
- * tool registry comprehensible.
1307
- */
1308
-
1309
- /** OAuth client config the factory closes over. Caller resolves these
1310
- * at construction time (env, DB, secret manager — package doesn't care). */
1311
- interface HubSpotOptions {
1312
- clientId: string;
1313
- clientSecret: string;
1314
- }
1315
- declare function hubspot(opts: HubSpotOptions): ConnectorAdapter;
1316
-
1317
- /**
1318
- * Slack connector — bot-token OAuth, three messaging-oriented capabilities.
1319
- *
1320
- * post_message(channel, text|blocks) → mutation; cas: 'none'
1321
- * lookup_user(email) → read
1322
- * list_channels(types?, limit?) → read
1323
- *
1324
- * Why `cas: 'none'` is acceptable here (and only here in this batch):
1325
- * Slack messages are advisory — we set
1326
- * `defaultConsistencyModel: 'advisory'`. The registry validator allows
1327
- * `cas: 'none'` only on non-authoritative connectors precisely so that
1328
- * append-only messaging surfaces don't have to invent fake CAS theatre.
1329
- * The agent's planner already treats `advisory` data as informational
1330
- * and does not promise outcomes based on its post results without
1331
- * a separate authoritative confirm. MutationGuard's idempotency-key
1332
- * dedup remains in force above the connector — a retry of the same
1333
- * post_message call will short-circuit before reaching Slack.
1334
- *
1335
- * Auth: standard OAuth2. Slack's `/oauth.v2.access` returns a bot
1336
- * `access_token` (`xoxb-…`) but does NOT return a refresh_token unless
1337
- * the app has rotated tokens enabled. Bot tokens are long-lived by
1338
- * default; we surface refreshToken handling but treat its absence as
1339
- * normal rather than an error.
1340
- */
1341
-
1342
- /** OAuth client config the factory closes over. Caller resolves these
1343
- * at construction time (env, DB, secret manager — package doesn't care). */
1344
- interface SlackOptions {
1345
- clientId: string;
1346
- clientSecret: string;
1347
- }
1348
- declare function slack(opts: SlackOptions): ConnectorAdapter;
1349
-
1350
- /**
1351
- * Notion database connector — query + page-level CRUD against a single
1352
- * connected database.
1353
- *
1354
- * query_database(filter?, pageSize?) → read
1355
- * create_page(properties) → mutation; cas: 'native-idempotency'
1356
- * update_page(pageId, properties) → mutation; cas: 'etag-if-match'
1357
- *
1358
- * CAS quirks worth flagging:
1359
- *
1360
- * 1. Notion added support for the `Idempotency-Key` HTTP header on
1361
- * mutating requests. We forward our SDK's idempotency key on
1362
- * create_page, which gives at-most-once semantics under the same
1363
- * key for ~24h. MutationGuard's record short-circuits above us;
1364
- * Notion's dedup is the second line of defense.
1365
- *
1366
- * 2. Notion does NOT expose a per-page etag the way Graph does. The
1367
- * canonical drift signal is `last_edited_time` (RFC3339). Our
1368
- * `update_page` capability accepts an `expectedLastEditedTime` arg;
1369
- * if supplied, we GET the page first and compare. Mismatch →
1370
- * ResourceContention with the current page state. Conflict-free
1371
- * callers can omit the field (last-write-wins, the Notion default).
1372
- *
1373
- * Auth: standard OAuth2. Notion's token endpoint follows RFC 6749 with
1374
- * one twist — the workspace_id and bot_id come back in the response and
1375
- * we stash them in `metadata` so the agent can address resources by
1376
- * workspace where useful.
1377
- */
1378
-
1379
- /** OAuth client config the factory closes over. Caller resolves these
1380
- * at construction time (env, DB, secret manager — package doesn't care). */
1381
- interface NotionDatabaseOptions {
1382
- clientId: string;
1383
- clientSecret: string;
1384
- }
1385
- declare function notionDatabase(opts: NotionDatabaseOptions): ConnectorAdapter;
1386
-
1387
- type RestCredentialPlacement = {
1388
- kind: 'bearer';
1389
- } | {
1390
- kind: 'header';
1391
- header: string;
1392
- prefix?: string;
1393
- } | {
1394
- kind: 'query';
1395
- parameter: string;
1396
- };
1397
- interface RestConnectorSpec {
1398
- kind: string;
1399
- displayName: string;
1400
- description: string;
1401
- auth: ConnectorAdapter['manifest']['auth'];
1402
- category: ConnectorAdapter['manifest']['category'];
1403
- defaultConsistencyModel: ConnectorAdapter['manifest']['defaultConsistencyModel'];
1404
- baseUrl: string | {
1405
- metadataKey: string;
1406
- fallback?: string;
1407
- };
1408
- credentialPlacement?: RestCredentialPlacement;
1409
- defaultHeaders?: Record<string, string>;
1410
- capabilities: RestOperationSpec[];
1411
- test?: RestRequestSpec;
1412
- }
1413
- interface RestOperationSpec {
1414
- name: string;
1415
- class: 'read' | 'mutation';
1416
- description: string;
1417
- parameters: Record<string, unknown>;
1418
- requiredScopes?: string[];
1419
- request: RestRequestSpec;
1420
- cas?: 'etag-if-match' | 'native-idempotency' | 'optimistic-read-verify' | 'none';
1421
- externalEffect?: boolean;
1422
- }
1423
- interface RestRequestSpec {
1424
- method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1425
- path: string;
1426
- query?: Record<string, string | number | boolean | undefined>;
1427
- headers?: Record<string, string>;
1428
- body?: 'args' | string | Record<string, unknown>;
1429
- }
1430
- declare function declarativeRestConnector(spec: RestConnectorSpec): ConnectorAdapter;
1431
-
1432
- /**
1433
- * Twilio SMS connector — outbound texts + recent-message lookup. The
1434
- * agent's "send the caller a confirmation link" surface.
1435
- *
1436
- * Auth: HTTP Basic (Account SID + Auth Token). Twilio's API key auth
1437
- * also supports SID/Secret pairs; we accept either by treating the
1438
- * stored apiKey envelope as `accountSid:authToken` (or
1439
- * `accountSid:keySid:secret`) — the connector parses it at call time.
1440
- *
1441
- * send_sms(to, body)
1442
- * Mutation. CAS = native-idempotency. Twilio added the
1443
- * `Idempotency-Key` HTTP header to POST /Messages in 2024 — same
1444
- * key + same args within 24h returns the original Message resource
1445
- * instead of sending a second SMS. MutationGuard's record short-
1446
- * circuits before us; Twilio's own dedup is defense-in-depth.
1447
- *
1448
- * lookup_number(phoneNumber)
1449
- * Read. Hits /v1/PhoneNumbers/{e164} on Lookup API. Confirms the
1450
- * number is real, returns carrier info if the caller has Lookup
1451
- * enabled on their account.
1452
- *
1453
- * find_recent_messages(toOrFrom?, limit?)
1454
- * Read. Returns the most recent Messages on the account, optionally
1455
- * filtered by To/From. Useful for "did the confirmation actually
1456
- * send?" introspection inside an agent run.
1457
- */
1458
-
1459
- declare const twilioSmsConnector: ConnectorAdapter;
1460
-
1461
- /**
1462
- * Stripe pack connector — single connector kind packing 3 capabilities,
1463
- * validating the "connector pack" concept (one auth handshake, multiple
1464
- * related capabilities) without exploding the registry into
1465
- * `stripe-customers`, `stripe-checkout`, `stripe-invoices` triplets.
1466
- *
1467
- * find_customer(email) → read; CAS n/a
1468
- * create_invoice(customerId, items) → mutation; cas: 'native-idempotency'
1469
- * create_checkout_session(...) → mutation; cas: 'native-idempotency'
1470
- *
1471
- * Auth: API key (Stripe restricted key). Operator pastes the key into
1472
- * the Connections UI. We never see their account password / OAuth flow;
1473
- * Stripe restricted keys are the customer's responsibility (they pick
1474
- * which permissions the key carries). The kind exposes a webhook URL
1475
- * post-connect for the operator to paste into the Stripe dashboard —
1476
- * we'll wire the receiver to P-3's inbound webhook surface in a later
1477
- * commit. That URL is returned in `metadata.webhookUrl` so the UI can
1478
- * render it.
1479
- *
1480
- * Why this is the textbook example of `cas: 'native-idempotency'`:
1481
- * Stripe's `Idempotency-Key` HTTP header is THE reference implementation
1482
- * of native idempotency. Same key + same args within 24h returns the
1483
- * stored response (Stripe's words, not ours). Same key + different args
1484
- * → 400 with `idempotency_error`. We forward the SDK's idempotency key
1485
- * directly. MutationGuard short-circuits before us on retry; Stripe's
1486
- * own dedup is the second line of defense.
1487
- */
1488
-
1489
- declare const stripePackConnector: ConnectorAdapter;
1490
-
1491
- /**
1492
- * Universal webhook connector — the long-tail escape hatch.
1493
- *
1494
- * The user declares a target URL + a JSON-schema for the request body
1495
- * the agent should send, plus an optional shared secret. We sign every
1496
- * outbound POST with HMAC-SHA256 over `timestamp.body` and forward the
1497
- * agent's idempotency key as a header. The receiving system enforces
1498
- * its own idempotency.
1499
- *
1500
- * One adapter, two capabilities. Both arity-1 — `body` is whatever JSON
1501
- * the agent's planner constructs from the operator-defined schema (which
1502
- * lives in DataSource.metadata.requestSchema). The agent's planner reads
1503
- * that schema at request time and constructs valid args.
1504
- *
1505
- * Why one connector covers 50 systems badly and 1 system well: the agent
1506
- * gets a generic "send_event" tool that doesn't *know* what the upstream
1507
- * does with the payload. That's fine for fire-and-forget event posting
1508
- * (Zapier-style); it's wrong for booking against a calendar where you
1509
- * need conflict-resolution. So webhook's `post_event` capability is
1510
- * marked `cas: 'native-idempotency'` (we forward the key — the receiver
1511
- * MUST honor it) and `defaultConsistencyModel: 'advisory'`. Anyone
1512
- * needing real CAS uses a kind-specific connector (Calendar, Sheets, ...).
1513
- */
1514
-
1515
- declare const webhookConnector: ConnectorAdapter;
1516
-
1517
- /**
1518
- * Stripe inbound-webhook receiver — push-only side of a Stripe connector.
1519
- *
1520
- * The full Stripe connector (charges/customers/invoices read+mutation) is
1521
- * tracked in INTEGRATIONS.md as separate `stripe-customers` / `stripe-invoices`
1522
- * rows. This adapter only ships the inbound surface today: receive a push,
1523
- * verify the signature, persist one `InboundEvent` per Stripe event so the
1524
- * agent's runtime can react (e.g. payment_failed → outbound dunning call).
1525
- *
1526
- * Why a dedicated `kind: 'stripe'` rather than reusing the billing webhook
1527
- * at /api/billing/stripe-webhook: that route is hard-coded for OUR Stripe
1528
- * account (Builder subscription state). This connector is for the customer's
1529
- * OWN Stripe account — they paste their `whsec_*` and we listen on a
1530
- * per-DataSource URL, /api/webhooks/inbound/stripe/:dataSourceId.
1531
- *
1532
- * Signature scheme: Stripe's `t=<unix>,v1=<hmac>` header. HMAC is
1533
- * sha256(`${t}.${rawBody}`) keyed by the customer's webhook secret. We use
1534
- * `timingSafeEqual` to defeat timing oracles and bound timestamp skew at
1535
- * 5 minutes (Stripe's recommendation) to thwart replay against captured
1536
- * signatures.
1537
- */
1538
-
1539
- declare const stripeWebhookReceiverConnector: ConnectorAdapter;
1540
-
1541
- /**
1542
- * Slack Events API inbound receiver.
1543
- *
1544
- * Slack sends two distinct request shapes to the same webhook URL:
1545
- *
1546
- * 1. `url_verification` — a one-off handshake during app-config. The body
1547
- * contains a `challenge` string we MUST echo back as the response body
1548
- * (Slack's app-config UI fails the URL otherwise). No InboundEvent is
1549
- * persisted for this — it's an infrastructure ping, not a user event.
1550
- *
1551
- * 2. `event_callback` — every actual workspace event (message posted,
1552
- * reaction added, channel created, …). We persist one InboundEvent
1553
- * keyed by `event_id` so a Slack retry (Slack retries 3 times on any
1554
- * non-2xx) is deduped at the unique constraint, not after we've
1555
- * double-processed.
1556
- *
1557
- * Signature scheme: `v0=<hmac(sha256, "v0:<timestamp>:<rawBody>")>` keyed by
1558
- * the app's signing secret. Header `X-Slack-Request-Timestamp` carries the
1559
- * timestamp; we reject anything older than 5 minutes (Slack's recommendation)
1560
- * to bound replay risk.
1561
- */
1562
-
1563
- declare const slackEventsConnector: ConnectorAdapter;
1564
-
1565
- declare const githubConnector: ConnectorAdapter;
1566
-
1567
- declare const gitlabConnector: ConnectorAdapter;
1568
-
1569
- declare const airtableConnector: ConnectorAdapter;
1570
-
1571
- declare const asanaConnector: ConnectorAdapter;
1572
-
1573
- declare const salesforceConnector: ConnectorAdapter;
1574
-
1575
- type IntegrationPolicyEffect = 'allow' | 'require_approval' | 'deny';
1576
- interface IntegrationPolicyRule {
1577
- id: string;
1578
- effect: IntegrationPolicyEffect;
1579
- reason: string;
1580
- providerId?: string;
1581
- connectorId?: string;
1582
- action?: string;
1583
- maxRisk?: IntegrationActionRisk;
1584
- risk?: IntegrationActionRisk;
1585
- dataClass?: IntegrationDataClass;
1586
- }
1587
- interface StaticIntegrationPolicyOptions {
1588
- rules?: IntegrationPolicyRule[];
1589
- defaultReadEffect?: IntegrationPolicyEffect;
1590
- defaultWriteEffect?: IntegrationPolicyEffect;
1591
- defaultDestructiveEffect?: IntegrationPolicyEffect;
1592
- now?: () => Date;
1593
- }
1594
- interface IntegrationApprovalResolution {
1595
- approvalId: string;
1596
- approved: boolean;
1597
- resolvedBy: string;
1598
- resolvedAt: string;
1599
- reason?: string;
1600
- metadata?: Record<string, unknown>;
1601
- }
1602
- declare class StaticIntegrationPolicyEngine implements IntegrationPolicyEngine {
1603
- private readonly rules;
1604
- private readonly defaultReadEffect;
1605
- private readonly defaultWriteEffect;
1606
- private readonly defaultDestructiveEffect;
1607
- private readonly now;
1608
- constructor(options?: StaticIntegrationPolicyOptions);
1609
- decide(ctx: IntegrationGuardContext & {
1610
- subject: {
1611
- type: string;
1612
- id: string;
1613
- };
1614
- }): IntegrationPolicyDecision;
1615
- private defaultEffect;
1616
- }
1617
- declare function createDefaultIntegrationPolicyEngine(options?: Omit<StaticIntegrationPolicyOptions, 'rules'>): StaticIntegrationPolicyEngine;
1618
- declare function buildApprovalRequest(ctx: IntegrationGuardContext & {
1619
- subject: {
1620
- type: string;
1621
- id: string;
1622
- };
1623
- }, reason: string, requestedAt: Date): IntegrationApprovalRequest;
1624
- declare function redactApprovalRequest(request: IntegrationApprovalRequest): IntegrationApprovalRequest;
1625
-
1626
- interface IntegrationInvocationEnvelope {
1627
- kind: 'integration.invocation';
1628
- capabilityToken: string;
1629
- toolName: string;
1630
- action: string;
1631
- input?: unknown;
1632
- idempotencyKey: string;
1633
- dryRun?: boolean;
1634
- metadata?: Record<string, unknown>;
1635
- }
1636
- interface IntegrationInvocationEnvelopeValidationOptions {
1637
- connectors?: IntegrationConnector[];
1638
- maxInputBytes?: number;
1639
- requireKnownTool?: boolean;
1640
- }
1641
- type NormalizedIntegrationResult = {
1642
- status: 'ok';
1643
- action: string;
1644
- output?: unknown;
1645
- metadata?: Record<string, unknown>;
1646
- } | {
1647
- status: 'approval_required';
1648
- action: string;
1649
- approval: IntegrationApprovalRequest;
1650
- metadata?: Record<string, unknown>;
1651
- } | {
1652
- status: 'failed';
1653
- action: string;
1654
- error: string;
1655
- metadata?: Record<string, unknown>;
1656
- };
1657
- interface IntegrationSandboxHostHub {
1658
- invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult> | IntegrationActionResult;
1659
- }
1660
- interface IntegrationSandboxHostOptions extends IntegrationInvocationEnvelopeValidationOptions {
1661
- hub: IntegrationSandboxHostHub;
1662
- }
1663
- declare function buildIntegrationInvocationEnvelope(input: {
1664
- capabilityToken: string;
1665
- toolName: string;
1666
- args?: unknown;
1667
- idempotencyKey: string;
1668
- dryRun?: boolean;
1669
- metadata?: Record<string, unknown>;
1670
- }): IntegrationInvocationEnvelope;
1671
- declare function invocationRequestFromEnvelope(envelope: IntegrationInvocationEnvelope): InvokeWithCapabilityRequest;
1672
- declare function validateIntegrationInvocationEnvelope(envelope: IntegrationInvocationEnvelope, options?: IntegrationInvocationEnvelopeValidationOptions): void;
1673
- declare function redactInvocationEnvelope(envelope: IntegrationInvocationEnvelope): Omit<IntegrationInvocationEnvelope, 'capabilityToken'> & {
1674
- capabilityToken: '[REDACTED]';
1675
- };
1676
- declare function redactCapability(capability: IntegrationCapability): IntegrationCapability;
1677
- declare function normalizeIntegrationResult(result: IntegrationActionResult): NormalizedIntegrationResult;
1678
- declare function dispatchIntegrationInvocation(envelope: IntegrationInvocationEnvelope, options: IntegrationSandboxHostOptions): Promise<NormalizedIntegrationResult>;
1679
- declare class IntegrationSandboxHost {
1680
- private readonly options;
1681
- constructor(options: IntegrationSandboxHostOptions);
1682
- dispatch(envelope: IntegrationInvocationEnvelope): Promise<NormalizedIntegrationResult>;
1683
- }
1684
-
1685
- interface ImportCatalogOptions {
1686
- providerId: string;
1687
- connectorId: string;
1688
- connectorTitle: string;
1689
- category?: IntegrationConnectorCategory;
1690
- auth?: IntegrationConnector['auth'];
1691
- scopes?: string[];
1692
- dataClass?: IntegrationDataClass;
1693
- defaultRisk?: IntegrationActionRisk;
1694
- }
1695
- interface OpenApiDocument {
1696
- openapi?: string;
1697
- swagger?: string;
1698
- info?: {
1699
- title?: string;
1700
- };
1701
- paths?: Record<string, Record<string, OpenApiOperation | unknown>>;
1702
- }
1703
- interface OpenApiOperation {
1704
- operationId?: string;
1705
- summary?: string;
1706
- description?: string;
1707
- parameters?: unknown[];
1708
- requestBody?: unknown;
1709
- responses?: unknown;
1710
- security?: Array<Record<string, string[]>>;
1711
- tags?: string[];
1712
- }
1713
- interface GraphqlOperationSpec {
1714
- name: string;
1715
- kind: 'query' | 'mutation';
1716
- description?: string;
1717
- inputSchema?: unknown;
1718
- outputSchema?: unknown;
1719
- requiredScopes?: string[];
1720
- }
1721
- interface McpCatalogTool {
1722
- name: string;
1723
- description?: string;
1724
- inputSchema?: unknown;
1725
- annotations?: {
1726
- readOnlyHint?: boolean;
1727
- destructiveHint?: boolean;
1728
- openWorldHint?: boolean;
1729
- title?: string;
1730
- };
1731
- }
1732
- interface McpCatalog {
1733
- tools: McpCatalogTool[];
1734
- }
1735
- declare function importOpenApiConnector(document: OpenApiDocument, options: ImportCatalogOptions): IntegrationConnector;
1736
- declare function importGraphqlConnector(operations: GraphqlOperationSpec[], options: ImportCatalogOptions): IntegrationConnector;
1737
- declare function importMcpConnector(catalog: McpCatalog, options: ImportCatalogOptions): IntegrationConnector;
1738
-
1739
- interface GatewayCatalogProviderOptions {
1740
- id: string;
1741
- kind: Extract<IntegrationProviderKind, 'nango' | 'pipedream' | 'activepieces' | 'zapier' | 'executor' | 'custom'>;
1742
- fetchCatalog: () => Promise<GatewayCatalogEntry[]> | GatewayCatalogEntry[];
1743
- startAuth?: (request: StartAuthRequest) => Promise<StartAuthResult> | StartAuthResult;
1744
- completeAuth?: (request: CompleteAuthRequest) => Promise<IntegrationConnection> | IntegrationConnection;
1745
- invokeAction?: (connection: IntegrationConnection, request: IntegrationActionRequest) => Promise<IntegrationActionResult> | IntegrationActionResult;
1746
- cacheTtlMs?: number;
1747
- now?: () => Date;
1748
- }
1749
- interface GatewayCatalogEntry {
1750
- id?: string;
1751
- key?: string;
1752
- name?: string;
1753
- title?: string;
1754
- category?: string;
1755
- auth?: 'oauth2' | 'api_key' | 'none' | 'custom' | string;
1756
- scopes?: string[];
1757
- actions?: GatewayCatalogAction[];
1758
- triggers?: GatewayCatalogTrigger[];
1759
- metadata?: Record<string, unknown>;
1760
- }
1761
- interface GatewayCatalogAction {
1762
- id?: string;
1763
- key?: string;
1764
- name?: string;
1765
- title?: string;
1766
- description?: string;
1767
- risk?: 'read' | 'write' | 'destructive' | string;
1768
- scopes?: string[];
1769
- requiredScopes?: string[];
1770
- dataClass?: IntegrationDataClass | string;
1771
- approvalRequired?: boolean;
1772
- inputSchema?: unknown;
1773
- outputSchema?: unknown;
1774
- }
1775
- interface GatewayCatalogTrigger {
1776
- id?: string;
1777
- key?: string;
1778
- name?: string;
1779
- title?: string;
1780
- description?: string;
1781
- scopes?: string[];
1782
- requiredScopes?: string[];
1783
- dataClass?: IntegrationDataClass | string;
1784
- payloadSchema?: unknown;
1785
- }
1786
- declare function createGatewayCatalogProvider(options: GatewayCatalogProviderOptions): IntegrationProvider;
1787
- declare function normalizeGatewayCatalog(entries: GatewayCatalogEntry[], options: {
1788
- providerId: string;
1789
- providerKind: IntegrationProviderKind;
1790
- }): IntegrationConnector[];
1791
-
1792
- interface ActivepiecesCatalogEntry {
1793
- id: string;
1794
- title: string;
1795
- description: string;
1796
- npmPackage?: string;
1797
- version?: string;
1798
- category: IntegrationConnectorCategory;
1799
- auth: IntegrationConnector['auth'];
1800
- domains: string[];
1801
- actions: Array<{
1802
- id: string;
1803
- title: string;
1804
- risk: IntegrationActionRisk;
1805
- }>;
1806
- triggers: Array<{
1807
- id: string;
1808
- title: string;
1809
- }>;
1810
- source: {
1811
- repository: string;
1812
- path: string;
1813
- license: 'MIT';
1814
- };
1815
- }
1816
- declare function listActivepiecesCatalogEntries(): ActivepiecesCatalogEntry[];
1817
- declare function buildActivepiecesConnectors(options?: {
1818
- providerId?: string;
1819
- includeCatalogActions?: boolean;
1820
- }): IntegrationConnector[];
1821
-
1822
- interface ActivepiecesPieceOverride {
1823
- category?: IntegrationConnectorCategory;
1824
- actionRisks?: Record<string, IntegrationActionRisk>;
1825
- approvalRequired?: Record<string, boolean>;
1826
- }
1827
- declare const ACTIVEPIECES_OVERRIDES: Record<string, ActivepiecesPieceOverride>;
1828
- declare function getActivepiecesOverride(id: string): ActivepiecesPieceOverride | undefined;
1829
-
1830
- type IntegrationCoveragePriority = 'tier_0' | 'tier_1' | 'tier_2' | 'long_tail';
1831
- interface IntegrationCoverageSpec {
1832
- id: string;
1833
- title: string;
1834
- category: IntegrationConnectorCategory;
1835
- auth: IntegrationConnector['auth'];
1836
- priority: IntegrationCoveragePriority;
1837
- providerKinds: IntegrationProviderKind[];
1838
- domains: string[];
1839
- actionPack: IntegrationActionPack;
1840
- scopes?: string[];
1841
- }
1842
- type IntegrationActionPack = 'email' | 'calendar' | 'chat' | 'crm' | 'storage' | 'docs' | 'database' | 'project' | 'support' | 'marketing' | 'sales' | 'commerce' | 'finance' | 'hr' | 'dev' | 'ai' | 'analytics' | 'workflow' | 'webhook';
1843
- declare function listIntegrationCoverageSpecs(): IntegrationCoverageSpec[];
1844
- declare function buildIntegrationCoverageConnectors(options?: {
1845
- providerId?: string;
1846
- priorities?: IntegrationCoveragePriority[];
1847
- categories?: IntegrationConnectorCategory[];
1848
- actionPacks?: IntegrationActionPack[];
1849
- }): IntegrationConnector[];
1850
- declare function integrationCoverageChecklistMarkdown(): string;
1851
-
1852
- type IntegrationAuthMode = 'oauth2' | 'api_key' | 'hmac' | 'none' | 'custom';
1853
- type IntegrationSpecStatus = 'catalog' | 'executable' | 'deprecated';
1854
- type IntegrationFamilyId = 'google' | 'microsoft-graph' | 'atlassian' | 'salesforce' | 'hubspot' | 'slack' | 'notion' | 'standard-oauth2' | 'api-key' | 'hmac' | 'none';
1855
- type NormalizedPermission = `${string}.read` | `${string}.write` | `${string}.delete` | `${string}.admin`;
1856
- interface IntegrationSpec {
1857
- kind: string;
1858
- title: string;
1859
- category: IntegrationConnectorCategory;
1860
- status: IntegrationSpecStatus;
1861
- family: IntegrationFamilyId;
1862
- auth: IntegrationAuthSpec;
1863
- permissions: PermissionDescriptor[];
1864
- actions: IntegrationConnectorAction[];
1865
- triggers?: IntegrationConnectorTrigger[];
1866
- setup: IntegrationSetupSpec;
1867
- lifecycle?: IntegrationLifecycleSpec;
1868
- plannerHints?: IntegrationPlannerHints;
1869
- metadata?: Record<string, unknown>;
1870
- }
1871
- type IntegrationAuthSpec = OAuth2AuthSpec | ApiKeyAuthSpec | HmacAuthSpec | NoneAuthSpec | CustomAuthSpec;
1872
- interface OAuth2AuthSpec {
1873
- mode: 'oauth2';
1874
- authorizationUrl: string;
1875
- tokenUrl: string;
1876
- clientIdEnv?: string;
1877
- clientSecretEnv?: string;
1878
- scopes: ScopeDescriptor[];
1879
- extraAuthParams?: Record<string, string>;
1880
- redirectUriTemplate: string;
1881
- pkce?: 'required' | 'supported' | 'unsupported';
1882
- }
1883
- interface ApiKeyAuthSpec {
1884
- mode: 'api_key';
1885
- credential: CredentialFieldSpec;
1886
- placement?: 'bearer' | 'header' | 'query' | 'basic';
1887
- }
1888
- interface HmacAuthSpec {
1889
- mode: 'hmac';
1890
- credential: CredentialFieldSpec;
1891
- signatureHeader?: string;
1892
- }
1893
- interface NoneAuthSpec {
1894
- mode: 'none';
1895
- }
1896
- interface CustomAuthSpec {
1897
- mode: 'custom';
1898
- description: string;
1899
- }
1900
- interface ScopeDescriptor {
1901
- normalized: NormalizedPermission;
1902
- providerScope: string;
1903
- title: string;
1904
- reason: string;
1905
- risk: IntegrationActionRisk;
1906
- dataClass: IntegrationDataClass;
1907
- }
1908
- interface PermissionDescriptor {
1909
- normalized: NormalizedPermission;
1910
- providerScopes: string[];
1911
- title: string;
1912
- risk: IntegrationActionRisk;
1913
- dataClass: IntegrationDataClass;
1914
- reason: string;
1915
- }
1916
- interface CredentialFieldSpec {
1917
- label: string;
1918
- description: string;
1919
- env?: string;
1920
- example?: string;
1921
- regex?: string;
1922
- secret: boolean;
1923
- }
1924
- interface ConsoleStep {
1925
- id: string;
1926
- title: string;
1927
- detail: string;
1928
- copyValue?: string;
1929
- }
1930
- interface Quirk {
1931
- id: string;
1932
- severity: 'info' | 'warning' | 'critical';
1933
- message: string;
1934
- }
1935
- interface PostSetupCheck {
1936
- id: string;
1937
- title: string;
1938
- detail: string;
1939
- }
1940
- interface HealthcheckSpec {
1941
- id: string;
1942
- level: 'client_config' | 'connection' | 'webhook' | 'static';
1943
- method?: 'GET' | 'POST';
1944
- url?: string;
1945
- expectedStatus?: number[];
1946
- description: string;
1947
- }
1948
- interface IntegrationSetupSpec {
1949
- consoleUrl?: string;
1950
- consoleSteps: ConsoleStep[];
1951
- credentialFields: CredentialFieldSpec[];
1952
- redirectUriTemplate?: string;
1953
- knownQuirks?: Quirk[];
1954
- postSetup?: PostSetupCheck[];
1955
- healthcheck?: HealthcheckSpec;
1956
- }
1957
- interface IntegrationLifecycleSpec {
1958
- supportsRefresh: boolean;
1959
- supportsRevoke: boolean;
1960
- supportsIncrementalAuth: boolean;
1961
- recommendedHealthcheckIntervalHours?: number;
1962
- freshnessSloMinutes?: number;
1963
- }
1964
- interface IntegrationPlannerHints {
1965
- useFor: string[];
1966
- avoidFor?: string[];
1967
- dataFreshness: 'realtime' | 'near_realtime' | 'eventual' | 'manual';
1968
- writeRisk: 'low' | 'medium' | 'high';
1969
- }
1970
- interface IntegrationFamilySpec {
1971
- id: IntegrationFamilyId;
1972
- title: string;
1973
- authMode: IntegrationAuthMode;
1974
- consoleUrl?: string;
1975
- authorizationUrl?: string;
1976
- tokenUrl?: string;
1977
- redirectUriTemplate?: string;
1978
- credentialFields: CredentialFieldSpec[];
1979
- consoleSteps: ConsoleStep[];
1980
- knownQuirks?: Quirk[];
1981
- lifecycle: IntegrationLifecycleSpec;
1982
- }
1983
- interface IntegrationSpecValidationIssue {
1984
- path: string;
1985
- message: string;
1986
- }
1987
- interface IntegrationSpecValidationResult {
1988
- ok: boolean;
1989
- issues: IntegrationSpecValidationIssue[];
1990
- }
1991
- interface RenderSpecOptions {
1992
- host: string;
1993
- callbackPath?: string;
1994
- }
1995
- interface RenderedConsoleStep extends ConsoleStep {
1996
- detail: string;
1997
- copyValue?: string;
1998
- }
1999
- interface CredentialValidationInput {
2000
- field: CredentialFieldSpec;
2001
- value: string;
2002
- }
2003
- interface CredentialValidationResult {
2004
- ok: boolean;
2005
- field: string;
2006
- message?: string;
2007
- }
2008
- interface HealthcheckPlan {
2009
- kind: string;
2010
- healthcheck: HealthcheckSpec;
2011
- requires: Array<'client_id' | 'client_secret' | 'api_key' | 'hmac_secret' | 'connection_credentials'>;
2012
- message: string;
2013
- }
2014
- declare function specAuthToConnectorAuth(auth: IntegrationAuthSpec): IntegrationConnector['auth'];
2015
-
2016
- declare const INTEGRATION_FAMILIES: Record<IntegrationFamilyId, IntegrationFamilySpec>;
2017
- declare function getIntegrationFamily(id: IntegrationFamilyId): IntegrationFamilySpec;
2018
-
2019
- declare function listIntegrationSpecs(): IntegrationSpec[];
2020
- declare function getIntegrationSpec(kind: string): IntegrationSpec | undefined;
2021
- declare function listExecutableIntegrationSpecs(): IntegrationSpec[];
2022
- declare function integrationSpecToConnector(spec: IntegrationSpec, providerId?: string): IntegrationConnector;
2023
-
2024
- declare function renderConsoleSteps(spec: IntegrationSpec, options: RenderSpecOptions): RenderedConsoleStep[];
2025
- declare function renderRunbookMarkdown(spec: IntegrationSpec, options: RenderSpecOptions): string;
2026
- declare function renderAgentToolDescription(spec: IntegrationSpec): string;
2027
- declare function buildHealthcheckPlan(spec: IntegrationSpec): HealthcheckPlan;
2028
- declare function consoleStepsToText(steps: ConsoleStep[]): string;
2029
-
2030
- declare function validateIntegrationSpec(spec: IntegrationSpec): IntegrationSpecValidationResult;
2031
- declare function assertValidIntegrationSpec(spec: IntegrationSpec): void;
2032
- declare function validateCredentialFormat(field: CredentialFieldSpec, value: string): CredentialValidationResult;
2033
- declare function validateCredentialSet(spec: IntegrationSpec, values: Record<string, string>): CredentialValidationResult[];
2034
-
2035
- type IntegrationProviderKind = 'first_party' | 'nango' | 'pipedream' | 'zapier' | 'activepieces' | 'executor' | 'custom';
2036
- type IntegrationConnectorCategory = 'email' | 'calendar' | 'chat' | 'crm' | 'storage' | 'docs' | 'database' | 'webhook' | 'workflow' | 'internal' | 'other';
2037
- type IntegrationActionRisk = 'read' | 'write' | 'destructive';
2038
- type IntegrationDataClass = 'public' | 'internal' | 'private' | 'sensitive' | 'secret';
2039
- interface IntegrationActor {
2040
- type: 'user' | 'team' | 'app' | 'agent' | 'sandbox' | 'system';
2041
- id: string;
2042
- }
2043
- interface IntegrationConnectorAction {
2044
- id: string;
2045
- title: string;
2046
- risk: IntegrationActionRisk;
2047
- requiredScopes: string[];
2048
- dataClass: IntegrationDataClass;
2049
- description?: string;
2050
- approvalRequired?: boolean;
2051
- inputSchema?: unknown;
2052
- outputSchema?: unknown;
2053
- }
2054
- interface IntegrationConnectorTrigger {
2055
- id: string;
2056
- title: string;
2057
- requiredScopes: string[];
2058
- dataClass: IntegrationDataClass;
2059
- description?: string;
2060
- payloadSchema?: unknown;
2061
- }
2062
- interface IntegrationConnector {
2063
- id: string;
2064
- providerId: string;
2065
- title: string;
2066
- category: IntegrationConnectorCategory;
2067
- auth: 'oauth2' | 'api_key' | 'none' | 'custom';
2068
- scopes: string[];
2069
- actions: IntegrationConnectorAction[];
2070
- triggers?: IntegrationConnectorTrigger[];
2071
- metadata?: Record<string, unknown>;
2072
- }
2073
- interface SecretRef {
2074
- provider: string;
2075
- id: string;
2076
- label?: string;
2077
- }
2078
- interface IntegrationConnection {
2079
- id: string;
2080
- owner: IntegrationActor;
2081
- providerId: string;
2082
- connectorId: string;
2083
- status: 'pending' | 'active' | 'expired' | 'revoked' | 'error';
2084
- grantedScopes: string[];
2085
- account?: {
2086
- id?: string;
2087
- email?: string;
2088
- displayName?: string;
2089
- };
2090
- secretRef?: SecretRef;
2091
- createdAt: string;
2092
- updatedAt: string;
2093
- expiresAt?: string;
2094
- lastUsedAt?: string;
2095
- metadata?: Record<string, unknown>;
2096
- }
2097
- interface StartAuthRequest {
2098
- connectorId: string;
2099
- owner: IntegrationActor;
2100
- requestedScopes: string[];
2101
- redirectUri: string;
2102
- state?: string;
2103
- metadata?: Record<string, unknown>;
2104
- }
2105
- interface StartAuthResult {
2106
- providerId: string;
2107
- connectorId: string;
2108
- authUrl: string;
2109
- state: string;
2110
- expiresAt?: string;
2111
- metadata?: Record<string, unknown>;
2112
- }
2113
- interface CompleteAuthRequest {
2114
- connectorId: string;
2115
- owner: IntegrationActor;
2116
- code?: string;
2117
- state: string;
2118
- redirectUri: string;
2119
- metadata?: Record<string, unknown>;
2120
- }
2121
- interface IntegrationActionRequest {
2122
- connectionId: string;
2123
- action: string;
2124
- input?: unknown;
2125
- idempotencyKey?: string;
2126
- dryRun?: boolean;
2127
- metadata?: Record<string, unknown>;
2128
- }
2129
- interface IntegrationActionResult<T = unknown> {
2130
- ok: boolean;
2131
- action: string;
2132
- output?: T;
2133
- externalId?: string;
2134
- warnings?: string[];
2135
- metadata?: Record<string, unknown>;
2136
- }
2137
- interface IntegrationTriggerSubscription {
2138
- id: string;
2139
- connectionId: string;
2140
- trigger: string;
2141
- targetUrl?: string;
2142
- status: 'active' | 'paused' | 'error';
2143
- createdAt: string;
2144
- metadata?: Record<string, unknown>;
2145
- }
2146
- interface IntegrationTriggerEvent<T = unknown> {
2147
- id: string;
2148
- providerId: string;
2149
- connectorId: string;
2150
- connectionId: string;
2151
- trigger: string;
2152
- occurredAt: string;
2153
- payload: T;
2154
- metadata?: Record<string, unknown>;
2155
- }
2156
- interface IntegrationProvider {
2157
- id: string;
2158
- kind: IntegrationProviderKind;
2159
- listConnectors(): Promise<IntegrationConnector[]> | IntegrationConnector[];
2160
- startAuth?(request: StartAuthRequest): Promise<StartAuthResult> | StartAuthResult;
2161
- completeAuth?(request: CompleteAuthRequest): Promise<IntegrationConnection> | IntegrationConnection;
2162
- invokeAction(connection: IntegrationConnection, request: IntegrationActionRequest): Promise<IntegrationActionResult> | IntegrationActionResult;
2163
- subscribeTrigger?(connection: IntegrationConnection, trigger: string, targetUrl?: string): Promise<IntegrationTriggerSubscription> | IntegrationTriggerSubscription;
2164
- unsubscribeTrigger?(subscriptionId: string): Promise<void> | void;
2165
- normalizeTriggerEvent?(raw: unknown): Promise<IntegrationTriggerEvent> | IntegrationTriggerEvent;
2166
- }
2167
- interface IntegrationConnectionStore {
2168
- get(connectionId: string): Promise<IntegrationConnection | undefined> | IntegrationConnection | undefined;
2169
- put(connection: IntegrationConnection): Promise<void> | void;
2170
- listByOwner(owner: IntegrationActor): Promise<IntegrationConnection[]> | IntegrationConnection[];
2171
- delete?(connectionId: string): Promise<void> | void;
2172
- }
2173
- interface IssueCapabilityRequest {
2174
- subject: IntegrationActor;
2175
- connectionId: string;
2176
- scopes: string[];
2177
- allowedActions: string[];
2178
- ttlMs: number;
2179
- metadata?: Record<string, unknown>;
2180
- }
2181
- interface IntegrationCapability {
2182
- id: string;
2183
- subject: IntegrationActor;
2184
- connectionId: string;
2185
- scopes: string[];
2186
- allowedActions: string[];
2187
- issuedAt: string;
2188
- expiresAt: string;
2189
- metadata?: Record<string, unknown>;
2190
- }
2191
- interface IssuedIntegrationCapability {
2192
- capability: IntegrationCapability;
2193
- token: string;
2194
- }
2195
- /**
2196
- * Wraps every action invocation with cross-cutting discipline (idempotency,
2197
- * conflict detection, rate-limiting, audit logging). Optional. When set on
2198
- * the hub, runs BEFORE provider.invokeAction; can short-circuit (return a
2199
- * result directly) or pass through (call `proceed()` to invoke the provider).
2200
- *
2201
- * Why this hook exists: production deployments need conflict-resolution
2202
- * guarantees that span every provider — first-party, Nango, Composio,
2203
- * webhook receivers — and providers shouldn't re-implement them. The
2204
- * canonical implementation is a "MutationGuard" that:
2205
- * 1. Short-circuits on a known idempotency key (returns recorded response).
2206
- * 2. Refuses same-key-different-args (drift detection).
2207
- * 3. Wraps `proceed()` and audit-logs the outcome.
2208
- * 4. Translates upstream conflict signals into a structured result with
2209
- * alternatives the agent can act on.
2210
- *
2211
- * Implementations live in consumers (every product has different
2212
- * persistence + telemetry needs); this interface is the contract.
2213
- */
2214
- interface IntegrationActionGuard {
2215
- /** Wrap an invokeAction call. Implementations MUST call `proceed()` to
2216
- * invoke the underlying provider unless they're returning a cached or
2217
- * short-circuited result.
2218
- *
2219
- * @param ctx connection + request the hub is about to dispatch
2220
- * @param proceed call to invoke the wrapped provider; returns the
2221
- * underlying IntegrationActionResult
2222
- * @returns the result the hub should return to the caller
2223
- */
2224
- invokeAction(ctx: IntegrationGuardContext, proceed: () => Promise<IntegrationActionResult>): Promise<IntegrationActionResult>;
2225
- }
2226
- interface IntegrationGuardContext {
2227
- connection: IntegrationConnection;
2228
- request: IntegrationActionRequest;
2229
- /** The action descriptor from the connector manifest, if discovered. */
2230
- action?: IntegrationConnectorAction;
2231
- }
2232
- type IntegrationPolicyDecision = {
2233
- decision: 'allow';
2234
- reason: string;
2235
- metadata?: Record<string, unknown>;
2236
- } | {
2237
- decision: 'require_approval';
2238
- reason: string;
2239
- approval: IntegrationApprovalRequest;
2240
- metadata?: Record<string, unknown>;
2241
- } | {
2242
- decision: 'deny';
2243
- reason: string;
2244
- metadata?: Record<string, unknown>;
2245
- };
2246
- interface IntegrationApprovalRequest {
2247
- id: string;
2248
- connectionId: string;
2249
- providerId: string;
2250
- connectorId: string;
2251
- action: string;
2252
- actor: IntegrationActor;
2253
- risk: IntegrationActionRisk;
2254
- dataClass: IntegrationDataClass;
2255
- reason: string;
2256
- requestedAt: string;
2257
- inputPreview?: unknown;
2258
- metadata?: Record<string, unknown>;
2259
- }
2260
- interface IntegrationPolicyEngine {
2261
- decide(ctx: IntegrationGuardContext & {
2262
- subject: IntegrationActor;
2263
- }): Promise<IntegrationPolicyDecision> | IntegrationPolicyDecision;
2264
- }
2265
- interface IntegrationHubOptions {
2266
- providers: IntegrationProvider[];
2267
- store: IntegrationConnectionStore;
2268
- capabilitySecret: string;
2269
- /** Optional cross-cutting guard. If provided, every invokeAction call
2270
- * passes through it before reaching the provider. See {@link IntegrationActionGuard}. */
2271
- guard?: IntegrationActionGuard;
2272
- /** Optional policy engine. Runs after capability/scope checks and before
2273
- * provider invocation. Use it to pause writes, deny destructive actions,
2274
- * or apply tenant-specific allow rules. */
2275
- policy?: IntegrationPolicyEngine;
2276
- now?: () => Date;
2277
- }
2278
- interface HttpIntegrationProviderOptions {
2279
- id: string;
2280
- kind?: IntegrationProviderKind;
2281
- connectors: IntegrationConnector[];
2282
- baseUrl: string;
2283
- bearer?: string;
2284
- fetchImpl?: typeof fetch;
2285
- }
2286
- interface InvokeWithCapabilityRequest extends Omit<IntegrationActionRequest, 'connectionId'> {
2287
- connectionId?: never;
2288
- }
2289
- declare class IntegrationError extends Error {
2290
- readonly code: 'provider_not_found' | 'connector_not_found' | 'connection_not_found' | 'connection_not_active' | 'auth_not_supported' | 'capability_invalid' | 'capability_expired' | 'scope_denied' | 'action_denied' | 'action_not_found' | 'approval_required' | 'policy_denied';
2291
- constructor(message: string, code: 'provider_not_found' | 'connector_not_found' | 'connection_not_found' | 'connection_not_active' | 'auth_not_supported' | 'capability_invalid' | 'capability_expired' | 'scope_denied' | 'action_denied' | 'action_not_found' | 'approval_required' | 'policy_denied');
2292
- }
2293
- declare class InMemoryConnectionStore implements IntegrationConnectionStore {
2294
- private readonly connections;
2295
- get(connectionId: string): IntegrationConnection | undefined;
2296
- put(connection: IntegrationConnection): void;
2297
- listByOwner(owner: IntegrationActor): IntegrationConnection[];
2298
- delete(connectionId: string): void;
2299
- }
2300
- declare class IntegrationHub {
2301
- private readonly providers;
2302
- private readonly store;
2303
- private readonly capabilitySecret;
2304
- private readonly guard;
2305
- private readonly policy;
2306
- private readonly now;
2307
- constructor(options: IntegrationHubOptions);
2308
- listConnectors(): Promise<IntegrationConnector[]>;
2309
- listRegistry(options?: ComposeIntegrationRegistryOptions): Promise<IntegrationRegistry>;
2310
- startAuth(providerId: string, request: StartAuthRequest): Promise<StartAuthResult>;
2311
- completeAuth(providerId: string, request: CompleteAuthRequest): Promise<IntegrationConnection>;
2312
- upsertConnection(connection: IntegrationConnection): Promise<IntegrationConnection>;
2313
- listConnections(owner: IntegrationActor): Promise<IntegrationConnection[]>;
2314
- issueCapability(request: IssueCapabilityRequest): Promise<IssuedIntegrationCapability>;
2315
- verifyCapability(token: string): IntegrationCapability;
2316
- invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult>;
2317
- subscribeTrigger(connectionId: string, trigger: string, targetUrl?: string): Promise<IntegrationTriggerSubscription>;
2318
- private requireProvider;
2319
- private requireConnector;
2320
- private requireConnection;
2321
- private assertConnectionActive;
2322
- }
2323
- declare function sanitizeConnection(connection: IntegrationConnection): Record<string, unknown>;
2324
- declare function createMockIntegrationProvider(options?: {
2325
- id?: string;
2326
- connectors?: IntegrationConnector[];
2327
- onInvoke?: (connection: IntegrationConnection, request: IntegrationActionRequest) => IntegrationActionResult | Promise<IntegrationActionResult>;
2328
- }): IntegrationProvider;
2329
- declare function createHttpIntegrationProvider(options: HttpIntegrationProviderOptions): IntegrationProvider;
2330
- declare function signCapability(capability: IntegrationCapability, secret: string): string;
2331
- declare function verifyCapabilityToken(token: string, secret: string): IntegrationCapability;
2332
-
2333
- export { ACTIVEPIECES_OVERRIDES, type ActivepiecesCatalogEntry, type ActivepiecesPieceOverride, type ApiKeyAuthSpec, ApprovalBackedPolicyEngine, type ApprovalBackedPolicyOptions, type AuthSpec, type CASStrategy, type Capability, type CapabilityClass, type CapabilityMutation, type CapabilityMutationResult, type CapabilityParameterSchema, type CapabilityRead, type CapabilityReadResult, type CompleteAuthRequest, type ComposeIntegrationRegistryOptions, type ConnectionCredentialResolverOptions, type ConnectorAdapter, type ConnectorAdapterProviderOptions, type ConnectorCredentials, type ConnectorInvocation, type ConnectorManifest, type ConnectorManifestValidationIssue, type ConnectorManifestValidationResult, type ConsistencyModel, type ConsoleStep, type CredentialFieldSpec, type CredentialValidationInput, type CredentialValidationResult, CredentialsExpired, type CustomAuthSpec, DEFAULT_INTEGRATION_BRIDGE_ENV, DEFAULT_SIGNATURE_TOLERANCE_SECONDS, type DataSourceMetadata, DefaultIntegrationActionGuard, type EventHandlerResult, type ExchangeCodeInput, type GatewayCatalogAction, type GatewayCatalogEntry, type GatewayCatalogProviderOptions, type GatewayCatalogTrigger, type GenericHmacVerifyOptions, type GoogleCalendarOptions, type GoogleSheetsOptions, type GraphqlOperationSpec, type HealthcheckPlan, type HealthcheckSpec, type HmacAuthSpec, type HttpIntegrationProviderOptions, type HubSpotOptions, INTEGRATION_FAMILIES, type ImportCatalogOptions, InMemoryConnectionStore, InMemoryIntegrationApprovalStore, InMemoryIntegrationAuditStore, InMemoryIntegrationEventStore, InMemoryIntegrationGrantStore, InMemoryIntegrationHealthcheckStore, InMemoryIntegrationIdempotencyStore, InMemoryIntegrationSecretStore, InMemoryIntegrationWorkflowStore, InMemoryOAuthFlowStore, type InboundEvent, type InstalledIntegrationWorkflow, type IntegrationActionGuard, type IntegrationActionPack, type IntegrationActionRequest, type IntegrationActionResult, type IntegrationActionRisk, type IntegrationActor, type IntegrationApprovalFilter, type IntegrationApprovalRecord, type IntegrationApprovalRequest, type IntegrationApprovalResolution, type IntegrationApprovalStatus, type IntegrationApprovalStore, type IntegrationAuditEvent, type IntegrationAuditEventType, type IntegrationAuditFilter, type IntegrationAuditSink, type IntegrationAuditStore, type IntegrationAuthMode, type IntegrationAuthSpec, type IntegrationBridgePayload, type IntegrationBridgeToolBinding, type IntegrationCapability, type IntegrationCapabilityBinding, type IntegrationCatalogSource, type IntegrationConnection, type IntegrationConnectionStore, type IntegrationConnector, type IntegrationConnectorAction, type IntegrationConnectorCategory, type IntegrationConnectorTrigger, type IntegrationCoveragePriority, type IntegrationCoverageSpec, type IntegrationDataClass, IntegrationError, type IntegrationEventStore, type IntegrationFamilyId, type IntegrationFamilySpec, type IntegrationGrant, type IntegrationGrantStore, type IntegrationGuardContext, type IntegrationHealthcheckCheck, type IntegrationHealthcheckResult, type IntegrationHealthcheckStatus, type IntegrationHealthcheckStore, IntegrationHub, type IntegrationHubOptions, type IntegrationIdempotencyRecord, type IntegrationIdempotencyStore, type IntegrationInvocationEnvelope, type IntegrationInvocationEnvelopeValidationOptions, type IntegrationLifecycleSpec, type IntegrationManifest, type IntegrationManifestResolution, type IntegrationPlannerHints, type IntegrationPolicyDecision, type IntegrationPolicyEffect, type IntegrationPolicyEngine, type IntegrationPolicyRule, type IntegrationProvider, type IntegrationProviderKind, type IntegrationRateLimitDecision, type IntegrationRateLimiter, type IntegrationRegistry, type IntegrationRegistryConflict, type IntegrationRegistryEntry, type IntegrationRegistrySourceRef, type IntegrationRegistrySummary, type IntegrationRequirement, type IntegrationRequirementMode, type IntegrationRequirementResolution, type IntegrationRequirementStatus, IntegrationRuntime, type IntegrationRuntimeHub, type IntegrationRuntimeOptions, type IntegrationSandboxBundle, IntegrationSandboxHost, type IntegrationSandboxHostHub, type IntegrationSandboxHostOptions, type IntegrationSecretStore, type IntegrationSetupSpec, type IntegrationSpec, type IntegrationSpecStatus, type IntegrationSpecValidationIssue, type IntegrationSpecValidationResult, type IntegrationSupportTier, type IntegrationToolDefinition, type IntegrationToolSearchFilters, type IntegrationToolSearchResult, type IntegrationTriggerEvent, type IntegrationTriggerSubscription, type IntegrationWebhookReceiverResult, type IntegrationWorkflowDefinition, IntegrationWorkflowRuntime, type IntegrationWorkflowRuntimeHub, type IntegrationWorkflowRuntimeOptions, type IntegrationWorkflowStore, type InvokeWithCapabilityRequest, type IssueCapabilityRequest, type IssuedIntegrationCapability, type McpCatalog, type McpCatalogTool, type McpToolDefinition, type MicrosoftCalendarOptions, type NoneAuthSpec, type NormalizedIntegrationResult, type NormalizedPermission, type NotionDatabaseOptions, type OAuth2AuthSpec, type OAuthFlowStore, type OAuthTokens, type OpenApiDocument, type OpenApiOperation, type ParsedStripeSignatureHeader, type PendingOAuthFlow, type PermissionDescriptor, type PostSetupCheck, type Quirk, type RateLimitSpec, type RefreshInput, type RenderSpecOptions, type RenderedConsoleStep, type ResolvedDataSource, ResourceContention, type RestConnectorSpec, type RestCredentialPlacement, type RestOperationSpec, type RestRequestSpec, type ScopeDescriptor, type SecretRef, type SlackOptions, type SlackVerifyOptions, type StartAuthRequest, type StartAuthResult, type StartOAuthInput, type StartOAuthOutput, StaticIntegrationPolicyEngine, type StaticIntegrationPolicyOptions, type StoredIntegrationEvent, type StripeVerifyOptions, type TwilioVerifyOptions, _resetPendingFlowsForTests, airtableConnector, asanaConnector, assertValidConnectorManifest, assertValidIntegrationSpec, buildActivepiecesConnectors, buildApprovalRequest, buildDefaultIntegrationRegistry, buildHealthcheckPlan, buildIntegrationBridgeEnvironment, buildIntegrationBridgePayload, buildIntegrationCoverageConnectors, buildIntegrationInvocationEnvelope, buildIntegrationToolCatalog, canonicalConnectorId, composeIntegrationRegistry, consoleStepsToText, consumePendingFlow, createApprovalBackedPolicyEngine, createAuditingActionGuard, createConnectionCredentialResolver, createConnectorAdapterProvider, createCredentialBackedAdapterProvider, createDefaultIntegrationActionGuard, createDefaultIntegrationPolicyEngine, createGatewayCatalogProvider, createHttpIntegrationProvider, createIntegrationAuditEvent, createIntegrationRuntime, createIntegrationWorkflowRuntime, createMockIntegrationProvider, declarativeRestConnector, decodeIntegrationBridgePayload, dispatchIntegrationInvocation, encodeIntegrationBridgePayload, exchangeAuthorizationCode, firstHeader, getActivepiecesOverride, getIntegrationFamily, getIntegrationSpec, githubConnector, gitlabConnector, googleCalendar, googleSheets, healthcheckRequest, hubspot, importGraphqlConnector, importMcpConnector, importOpenApiConnector, inferIntegrationSupportTier, integrationCoverageChecklistMarkdown, integrationSpecToConnector, integrationToolName, invocationRequestFromEnvelope, listActivepiecesCatalogEntries, listExecutableIntegrationSpecs, listIntegrationCoverageSpecs, listIntegrationSpecs, manifestToConnector, microsoftCalendar, normalizeGatewayCatalog, normalizeIntegrationResult, notionDatabase, parseIntegrationBridgeEnvironment, parseIntegrationToolName, parseStripeSignatureHeader, receiveIntegrationWebhook, redactApprovalRequest, redactCapability, redactIntegrationBridgePayload, redactInvocationEnvelope, refreshAccessToken, renderAgentToolDescription, renderConsoleSteps, renderRunbookMarkdown, resolveConnectionCredentials, resolveIntegrationApproval, revokeConnection, runIntegrationHealthcheck, runIntegrationHealthchecks, salesforceConnector, sanitizeAuditConnection, sanitizeConnection, searchIntegrationTools, signCapability, slack, slackEventsConnector, specAuthToConnectorAuth, startOAuthFlow, storedEventToTriggerEvent, stripePackConnector, stripeWebhookReceiverConnector, summarizeIntegrationRegistry, toMcpTools, twilioSmsConnector, validateConnectorManifest, validateCredentialFormat, validateCredentialSet, validateIntegrationInvocationEnvelope, validateIntegrationSpec, verifyCapabilityToken, verifyHmacSignature, verifySlackSignature, verifyStripeSignature, verifyTwilioSignature, webhookConnector };
1
+ export { A as ACTIVEPIECES_OVERRIDES, a as ActivepiecesCatalogEntry, b as ActivepiecesPieceOverride, ApiKeyAuthSpec, c as ApprovalBackedPolicyEngine, d as ApprovalBackedPolicyOptions, e as AuthSpec, C as CANONICAL_INTEGRATION_ACTIONS, f as CASStrategy, g as CanonicalIntegrationActionId, h as CanonicalLaunchConnectorOptions, i as Capability, j as CapabilityClass, k as CapabilityMutation, l as CapabilityMutationResult, m as CapabilityParameterSchema, n as CapabilityRead, o as CapabilityReadResult, p as CompleteAuthRequest, q as ComposeIntegrationRegistryOptions, r as ConnectionCredentialResolverOptions, s as ConnectorAdapter, t as ConnectorAdapterProviderOptions, u as ConnectorCredentials, v as ConnectorInvocation, w as ConnectorManifest, x as ConnectorManifestValidationIssue, y as ConnectorManifestValidationResult, z as ConsentSummary, B as ConsistencyModel, ConsoleStep, CredentialFieldSpec, CredentialValidationInput, CredentialValidationResult, D as CredentialsExpired, CustomAuthSpec, E as DEFAULT_INTEGRATION_BRIDGE_ENV, F as DEFAULT_SIGNATURE_TOLERANCE_SECONDS, G as DataSourceMetadata, H as DefaultIntegrationActionGuard, I as EventHandlerResult, J as ExchangeCodeInput, K as GatewayCatalogAction, L as GatewayCatalogEntry, M as GatewayCatalogProviderOptions, N as GatewayCatalogTrigger, O as GenericHmacVerifyOptions, P as GoogleCalendarOptions, Q as GoogleSheetsOptions, R as GraphqlOperationSpec, HealthcheckPlan, HealthcheckSpec, HmacAuthSpec, S as HttpIntegrationProviderOptions, T as HubSpotOptions, INTEGRATION_FAMILIES, U as ImportCatalogOptions, V as InMemoryConnectionStore, W as InMemoryIntegrationApprovalStore, X as InMemoryIntegrationAuditStore, Y as InMemoryIntegrationEventStore, Z as InMemoryIntegrationGrantStore, _ as InMemoryIntegrationHealthcheckStore, $ as InMemoryIntegrationIdempotencyStore, a0 as InMemoryIntegrationSecretStore, a1 as InMemoryIntegrationWorkflowStore, a2 as InMemoryOAuthFlowStore, a3 as InboundEvent, a4 as InferIntegrationRequirementsOptions, a5 as InstalledIntegrationWorkflow, a6 as IntegrationActionGuard, a7 as IntegrationActionPack, a8 as IntegrationActionRequest, a9 as IntegrationActionResult, aa as IntegrationActionRisk, ab as IntegrationActor, ac as IntegrationApprovalFilter, ad as IntegrationApprovalRecord, ae as IntegrationApprovalRequest, af as IntegrationApprovalResolution, ag as IntegrationApprovalStatus, ah as IntegrationApprovalStore, ai as IntegrationAuditEvent, aj as IntegrationAuditEventType, ak as IntegrationAuditFilter, al as IntegrationAuditSink, am as IntegrationAuditStore, IntegrationAuthMode, IntegrationAuthSpec, an as IntegrationBridgePayload, ao as IntegrationBridgeToolBinding, ap as IntegrationCapability, aq as IntegrationCapabilityBinding, ar as IntegrationCatalogSource, as as IntegrationConnection, at as IntegrationConnectionStore, au as IntegrationConnector, av as IntegrationConnectorAction, aw as IntegrationConnectorCategory, ax as IntegrationConnectorTrigger, ay as IntegrationCoveragePriority, az as IntegrationCoverageSpec, aA as IntegrationDataClass, aB as IntegrationError, aC as IntegrationErrorCode, aD as IntegrationEventStore, IntegrationFamilyId, IntegrationFamilySpec, aE as IntegrationGrant, aF as IntegrationGrantStore, aG as IntegrationGuardContext, aH as IntegrationHealthcheckCheck, aI as IntegrationHealthcheckResult, aJ as IntegrationHealthcheckStatus, aK as IntegrationHealthcheckStore, aL as IntegrationHub, aM as IntegrationHubOptions, aN as IntegrationIdempotencyRecord, aO as IntegrationIdempotencyStore, aP as IntegrationInvocationEnvelope, aQ as IntegrationInvocationEnvelopeValidationOptions, IntegrationLifecycleSpec, aR as IntegrationManifest, aS as IntegrationManifestResolution, IntegrationPlannerHints, aT as IntegrationPolicyDecision, aU as IntegrationPolicyEffect, aV as IntegrationPolicyEngine, aW as IntegrationPolicyRule, aX as IntegrationProvider, aY as IntegrationProviderKind, aZ as IntegrationRateLimitDecision, a_ as IntegrationRateLimiter, a$ as IntegrationRegistry, b0 as IntegrationRegistryConflict, b1 as IntegrationRegistryEntry, b2 as IntegrationRegistrySourceRef, b3 as IntegrationRegistrySummary, b4 as IntegrationRequirement, b5 as IntegrationRequirementMode, b6 as IntegrationRequirementResolution, b7 as IntegrationRequirementStatus, b8 as IntegrationRuntime, b9 as IntegrationRuntimeError, ba as IntegrationRuntimeHub, bb as IntegrationRuntimeOptions, bc as IntegrationSandboxBundle, bd as IntegrationSandboxHost, be as IntegrationSandboxHostHub, bf as IntegrationSandboxHostOptions, bg as IntegrationSecretStore, IntegrationSetupSpec, IntegrationSpec, IntegrationSpecStatus, IntegrationSpecValidationIssue, IntegrationSpecValidationResult, bh as IntegrationSupportTier, bi as IntegrationToolDefinition, bj as IntegrationToolSearchFilters, bk as IntegrationToolSearchResult, bl as IntegrationTriggerEvent, bm as IntegrationTriggerSubscription, bn as IntegrationUserAction, bo as IntegrationWebhookReceiverResult, bp as IntegrationWorkflowDefinition, bq as IntegrationWorkflowRuntime, br as IntegrationWorkflowRuntimeHub, bs as IntegrationWorkflowRuntimeOptions, bt as IntegrationWorkflowStore, bu as InvokeWithCapabilityRequest, bv as IssueCapabilityRequest, bw as IssuedIntegrationCapability, bx as ManifestValidationIssue, by as ManifestValidationResult, bz as McpCatalog, bA as McpCatalogTool, bB as McpToolDefinition, bC as MicrosoftCalendarOptions, bD as MissingRequirementExplanation, NoneAuthSpec, bE as NormalizedIntegrationError, bF as NormalizedIntegrationResult, NormalizedPermission, bG as NotionDatabaseOptions, OAuth2AuthSpec, bH as OAuthFlowStore, bI as OAuthTokens, bJ as OpenApiDocument, bK as OpenApiOperation, bL as PROVIDER_PASSTHROUGH_ACTION, bM as ParsedStripeSignatureHeader, bN as PendingOAuthFlow, PermissionDescriptor, bO as PlatformIntegrationPolicyPresetOptions, PostSetupCheck, bP as ProviderHttpRequestInput, bQ as ProviderPassthroughPolicy, Quirk, bR as RateLimitSpec, bS as RefreshInput, bT as RenderConsentOptions, RenderSpecOptions, RenderedConsoleStep, bU as ResolvedDataSource, bV as ResourceContention, bW as RestConnectorSpec, bX as RestCredentialPlacement, bY as RestOperationSpec, bZ as RestRequestSpec, ScopeDescriptor, b_ as SecretRef, b$ as SlackOptions, c0 as SlackVerifyOptions, c1 as StartAuthRequest, c2 as StartAuthResult, c3 as StartOAuthInput, c4 as StartOAuthOutput, c5 as StaticIntegrationPolicyEngine, c6 as StaticIntegrationPolicyOptions, c7 as StoredIntegrationEvent, c8 as StripeVerifyOptions, c9 as TangleIntegrationInvokeInput, ca as TangleIntegrationInvokeResult, cb as TangleIntegrationsClient, cc as TangleIntegrationsClientOptions, cd as TwilioVerifyOptions, ce as _resetPendingFlowsForTests, cf as airtableConnector, cg as asanaConnector, ch as assertValidConnectorManifest, ci as assertValidIntegrationManifest, assertValidIntegrationSpec, cj as buildActivepiecesConnectors, ck as buildApprovalRequest, cl as buildCanonicalLaunchConnectors, cm as buildDefaultIntegrationRegistry, buildHealthcheckPlan, cn as buildIntegrationBridgeEnvironment, co as buildIntegrationBridgePayload, cp as buildIntegrationCoverageConnectors, cq as buildIntegrationInvocationEnvelope, cr as buildIntegrationToolCatalog, cs as calendarExercisePlannerManifest, ct as canonicalActionConnectorId, cu as canonicalConnectorId, cv as composeIntegrationRegistry, consoleStepsToText, cw as consumePendingFlow, cx as createApprovalBackedPolicyEngine, cy as createAuditingActionGuard, cz as createConnectionCredentialResolver, cA as createConnectorAdapterProvider, cB as createCredentialBackedAdapterProvider, cC as createDefaultIntegrationActionGuard, cD as createDefaultIntegrationPolicyEngine, cE as createGatewayCatalogProvider, cF as createHttpIntegrationProvider, cG as createIntegrationAuditEvent, cH as createIntegrationRuntime, cI as createIntegrationWorkflowRuntime, cJ as createMockIntegrationProvider, cK as createPlatformIntegrationPolicyPreset, cL as createTangleIntegrationsClient, cM as declarativeRestConnector, cN as decodeIntegrationBridgePayload, cO as dispatchIntegrationInvocation, cP as encodeIntegrationBridgePayload, cQ as exchangeAuthorizationCode, cR as explainMissingRequirements, cS as firstHeader, cT as getActivepiecesOverride, getIntegrationFamily, getIntegrationSpec, cU as githubConnector, cV as gitlabConnector, cW as googleCalendar, cX as googleSheets, cY as healthcheckRequest, cZ as hubspot, c_ as importGraphqlConnector, c$ as importMcpConnector, d0 as importOpenApiConnector, d1 as inferIntegrationManifestFromTools, d2 as inferIntegrationSupportTier, d3 as integrationCoverageChecklistMarkdown, integrationSpecToConnector, d4 as integrationToolName, d5 as invocationRequestFromEnvelope, d6 as listActivepiecesCatalogEntries, listExecutableIntegrationSpecs, d7 as listIntegrationCoverageSpecs, listIntegrationSpecs, d8 as manifestToConnector, d9 as microsoftCalendar, da as normalizeGatewayCatalog, db as normalizeIntegrationError, dc as normalizeIntegrationResult, dd as notionDatabase, de as parseIntegrationBridgeEnvironment, df as parseIntegrationToolName, dg as parseStripeSignatureHeader, dh as receiveIntegrationWebhook, di as redactApprovalRequest, dj as redactCapability, dk as redactIntegrationBridgePayload, dl as redactInvocationEnvelope, dm as refreshAccessToken, renderAgentToolDescription, dn as renderApprovalCopy, dp as renderConsentSummary, renderConsoleSteps, renderRunbookMarkdown, dq as resolveConnectionCredentials, dr as resolveIntegrationApproval, ds as revokeConnection, dt as runIntegrationHealthcheck, du as runIntegrationHealthchecks, dv as salesforceConnector, dw as sanitizeAuditConnection, dx as sanitizeConnection, dy as searchIntegrationTools, dz as signCapability, dA as slack, dB as slackEventsConnector, specAuthToConnectorAuth, dC as startOAuthFlow, dD as statusForCode, dE as storedEventToTriggerEvent, dF as stripePackConnector, dG as stripeWebhookReceiverConnector, dH as summarizeIntegrationRegistry, dI as toMcpTools, dJ as twilioSmsConnector, dK as validateConnectorManifest, validateCredentialFormat, validateCredentialSet, dL as validateIntegrationInvocationEnvelope, dM as validateIntegrationManifest, validateIntegrationSpec, dN as validateProviderPassthroughRequest, dO as verifyCapabilityToken, dP as verifyHmacSignature, dQ as verifySlackSignature, dR as verifyStripeSignature, dS as verifyTwilioSignature, dT as webhookConnector } from './specs.js';