@tangle-network/agent-integrations 0.25.1 → 0.25.3

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