@tangle-network/agent-integrations 0.58.0 → 0.59.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/dist/{adapters-ediOgE75.js → adapters-DQ0JJ-aG.js} +6 -283
- package/dist/{adapters-ediOgE75.js.map → adapters-DQ0JJ-aG.js.map} +1 -1
- package/dist/catalog-CFvKzwVj.js +201 -0
- package/dist/catalog-CFvKzwVj.js.map +1 -0
- package/dist/catalog.js +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connectors/adapters/index.js +1 -1
- package/dist/connectors/index.d.ts +2 -1
- package/dist/connectors/index.js +2 -1
- package/dist/connectors/oauth.d.ts +2 -0
- package/dist/connectors/oauth.js +282 -0
- package/dist/connectors/oauth.js.map +1 -0
- package/dist/{consumer-BC6pCUzI.d.ts → consumer-zHtoJixe.d.ts} +5 -37
- package/dist/{consumer-BC6pCUzI.d.ts.map → consumer-zHtoJixe.d.ts.map} +1 -1
- package/dist/consumer.d.ts +1 -1
- package/dist/hub-0Od2lgun.d.ts +38 -0
- package/dist/hub-0Od2lgun.d.ts.map +1 -0
- package/dist/hub-D13zPQGr.js +1004 -0
- package/dist/hub-D13zPQGr.js.map +1 -0
- package/dist/hub.d.ts +2 -0
- package/dist/hub.js +2 -0
- package/dist/index-BQXENE9p.d.ts +130 -0
- package/dist/index-BQXENE9p.d.ts.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +15 -11
- package/dist/internal/bundled-manifest-runtime.js +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +2 -1
- package/dist/mcp.js.map +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/oauth-C5pa5j3O.d.ts +136 -0
- package/dist/oauth-C5pa5j3O.d.ts.map +1 -0
- package/dist/registry-core-BZo69C37.js +186 -0
- package/dist/registry-core-BZo69C37.js.map +1 -0
- package/dist/registry.js +2 -2
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +1 -1
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.js +114 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/{src-Bd4KMI-J.js → src-wcW1OCA7.js} +84922 -86026
- package/dist/src-wcW1OCA7.js.map +1 -0
- package/dist/stripe/index.js +1 -1
- package/dist/tangle-search/index.d.ts +37 -1
- package/dist/tangle-search/index.d.ts.map +1 -1
- package/dist/tangle-search/index.js +81 -1
- package/dist/tangle-search/index.js.map +1 -1
- package/dist/webhooks/index.js +1 -1
- package/docs/host-search-and-phone.md +28 -1
- package/package.json +17 -2
- package/dist/catalog-CBd0zbdD.js +0 -383
- package/dist/catalog-CBd0zbdD.js.map +0 -1
- package/dist/index-j2QziJA5.d.ts +0 -263
- package/dist/index-j2QziJA5.d.ts.map +0 -1
- package/dist/src-Bd4KMI-J.js.map +0 -1
package/dist/src-Bd4KMI-J.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-Bd4KMI-J.js","names":["catalogData","toTrigger","base64UrlEncode","unique","unique","titleFromId","unique","unique"],"sources":["../src/activepieces-overrides.ts","../data/activepieces-catalog.json","../src/activepieces-catalog.ts","../src/catalog-executor.ts","../src/activepieces-provider.ts","../src/catalog-freshness.ts","../src/tangle-catalog.ts","../src/registry.ts","../src/core-error.ts","../src/adapter-provider.ts","../src/credentials.ts","../src/approval.ts","../src/actions.ts","../src/bridge.ts","../src/apps.ts","../src/client.ts","../src/consent.ts","../src/discovery.ts","../src/events.ts","../src/healthcheck.ts","../src/manifest.ts","../src/passthrough.ts","../src/presets.ts","../src/sandbox.ts","../src/importers.ts","../src/gateway-catalog.ts","../src/workflow.ts","../src/index.ts"],"sourcesContent":["import type {\n IntegrationActionRisk,\n IntegrationConnectorCategory,\n} from './index.js'\n\nexport interface ActivepiecesPieceOverride {\n category?: IntegrationConnectorCategory\n actionRisks?: Record<string, IntegrationActionRisk>\n approvalRequired?: Record<string, boolean>\n}\n\nexport const ACTIVEPIECES_OVERRIDES: Record<string, ActivepiecesPieceOverride> = {\n slack: {\n category: 'chat',\n actionRisks: {\n 'slack.send.message': 'write',\n 'slack.send.direct.message': 'write',\n 'request.action.message': 'write',\n 'request.action.direct.message': 'write',\n 'request.approval.direct.message': 'write',\n 'request.send.approval.message': 'write',\n 'upload.file': 'write',\n 'search.messages': 'read',\n },\n },\n discord: { category: 'chat' },\n 'microsoft-teams': { category: 'chat' },\n whatsapp: { category: 'chat' },\n telegram: { category: 'chat' },\n\n gmail: {\n category: 'email',\n actionRisks: {\n 'gmail.send.email': 'write',\n 'gmail.reply.to.email': 'write',\n 'gmail.create.draft.reply': 'write',\n 'gmail.search.mail': 'read',\n 'gmail.get.email': 'read',\n 'request.approval.in.email': 'write',\n },\n },\n 'microsoft-outlook': { category: 'email' },\n sendgrid: { category: 'email' },\n postmark: { category: 'email' },\n mailchimp: { category: 'email' },\n resend: { category: 'email' },\n\n 'google-calendar': { category: 'calendar' },\n 'microsoft-outlook-calendar': { category: 'calendar' },\n cal: { category: 'calendar' },\n calendly: { category: 'calendar' },\n zoom: { category: 'calendar' },\n\n 'google-drive': { category: 'storage' },\n dropbox: { category: 'storage' },\n onedrive: { category: 'storage' },\n\n 'google-sheets': { category: 'database' },\n 'google-docs': { category: 'docs' },\n airtable: { category: 'database' },\n notion: { category: 'docs' },\n\n hubspot: { category: 'crm' },\n salesforce: { category: 'crm' },\n pipedrive: { category: 'crm' },\n intercom: { category: 'crm' },\n zendesk: { category: 'crm' },\n neverbounce: { category: 'crm' },\n\n stripe: {\n category: 'crm',\n actionRisks: {\n 'stripe.create.customer': 'write',\n 'stripe.update.customer': 'write',\n 'stripe.retrieve.customer': 'read',\n 'stripe.search.customer': 'read',\n 'stripe.search.subscriptions': 'read',\n 'stripe.create.invoice': 'write',\n 'stripe.retrieve.invoice': 'read',\n 'stripe.find.invoice': 'read',\n 'stripe.create.subscription': 'write',\n 'stripe.cancel.subscription': 'destructive',\n 'stripe.create.payment.intent': 'write',\n 'stripe.retrieve.payment.intent': 'read',\n 'stripe.create.refund': 'destructive',\n 'stripe.create.product': 'write',\n 'stripe.create.price': 'write',\n 'stripe.create.payment.link': 'write',\n 'stripe.deactivate.payment.link': 'destructive',\n 'stripe.retrieve.payout': 'read',\n },\n approvalRequired: {\n 'stripe.create.refund': true,\n 'stripe.cancel.subscription': true,\n 'stripe.deactivate.payment.link': true,\n },\n },\n\n twilio: {\n category: 'chat',\n actionRisks: {\n 'send.sms': 'write',\n 'send.whatsapp.message': 'write',\n 'make.phone.call': 'write',\n },\n },\n\n shopify: { category: 'crm' },\n square: { category: 'crm' },\n}\n\nexport function getActivepiecesOverride(id: string): ActivepiecesPieceOverride | undefined {\n return ACTIVEPIECES_OVERRIDES[id]\n}\n","","import type {\n IntegrationActionRisk,\n IntegrationConnector,\n IntegrationConnectorAction,\n IntegrationConnectorCategory,\n IntegrationConnectorTrigger,\n IntegrationDataClass,\n} from './core-types.js'\nimport { getActivepiecesOverride } from './activepieces-overrides.js'\nimport { catalogData } from './activepieces-catalog-data.mjs'\n\nexport interface ActivepiecesCatalogEntry {\n id: string\n title: string\n description: string\n npmPackage?: string\n version?: string\n category: IntegrationConnectorCategory\n auth: IntegrationConnector['auth']\n authFields?: ActivepiecesCatalogAuthField[]\n domains: string[]\n actions: Array<{\n id: string\n title: string\n risk: IntegrationActionRisk\n upstreamName?: string\n }>\n triggers: Array<{\n id: string\n title: string\n upstreamName?: string\n }>\n source: {\n repository: string\n path: string\n license: 'MIT'\n }\n}\n\nexport interface ActivepiecesCatalogAuthField {\n key: string\n label: string\n required: boolean\n secret: boolean\n kind: 'text' | 'number' | 'boolean' | 'select' | 'object' | 'unknown'\n description?: string\n}\n\nconst CACHED_CATALOG = catalogData as unknown as ReadonlyArray<ActivepiecesCatalogEntry>\n\nfunction loadCatalog(): ReadonlyArray<ActivepiecesCatalogEntry> {\n return CACHED_CATALOG\n}\n\nexport function listActivepiecesCatalogEntries(): ActivepiecesCatalogEntry[] {\n return loadCatalog().map((entry) => ({\n ...entry,\n actions: [...entry.actions],\n triggers: [...entry.triggers],\n domains: [...entry.domains],\n source: { ...entry.source },\n }))\n}\n\nexport function buildActivepiecesConnectors(options: {\n providerId?: string\n includeCatalogActions?: boolean\n executable?: boolean\n} = {}): IntegrationConnector[] {\n const providerId = options.providerId ?? 'activepieces'\n const executable = options.executable === true\n return listActivepiecesCatalogEntries().map((entry) => {\n const override = getActivepiecesOverride(entry.id)\n const category = override?.category ?? entry.category\n const scopes = [`${entry.id}.read`, `${entry.id}.write`]\n const catalogActions = entry.actions.map((action) =>\n toAction(applyActionOverride(action, override), scopes, dataClassFor(category)))\n const catalogTriggers = entry.triggers.map((trigger) => toTrigger(trigger, scopes, dataClassFor(category)))\n // An entry with no runnable catalog actions cannot be executed regardless\n // of the requested executable flag — there is nothing to bind to a runtime\n // action. Such entries are catalog-only (discoverable, not invokable).\n const entryExecutable = executable && catalogActions.length > 0\n return {\n id: entry.id,\n providerId,\n title: entry.title,\n category,\n auth: entry.auth,\n scopes: options.includeCatalogActions ? scopes : [],\n actions: options.includeCatalogActions ? catalogActions : [],\n triggers: options.includeCatalogActions ? catalogTriggers : undefined,\n metadata: {\n source: 'activepieces-community',\n executable: entryExecutable,\n runtime: 'activepieces-piece',\n catalogOnly: !entryExecutable,\n supportTier: entryExecutable ? 'gatewayExecutable' : 'catalogOnly',\n catalogActionCount: catalogActions.length,\n catalogTriggerCount: catalogTriggers.length,\n npmPackage: entry.npmPackage,\n version: entry.version,\n license: entry.source.license,\n sourcePath: entry.source.path,\n domains: entry.domains,\n authFields: entry.authFields,\n ...(override ? { overridden: true } : {}),\n },\n }\n })\n}\n\nfunction applyActionOverride(\n action: ActivepiecesCatalogEntry['actions'][number],\n override: ReturnType<typeof getActivepiecesOverride>,\n): ActivepiecesCatalogEntry['actions'][number] {\n if (!override) return action\n const risk = override.actionRisks?.[action.id] ?? action.risk\n return { ...action, risk }\n}\n\nfunction toAction(\n action: ActivepiecesCatalogEntry['actions'][number],\n scopes: string[],\n dataClass: IntegrationDataClass,\n): IntegrationConnectorAction {\n return {\n id: action.id,\n title: action.title,\n risk: action.risk,\n requiredScopes: action.risk === 'read' ? [scopes[0]!] : [scopes[1]!],\n dataClass,\n approvalRequired: action.risk !== 'read',\n inputSchema: { type: 'object', additionalProperties: true, properties: {} },\n }\n}\n\nfunction toTrigger(\n trigger: ActivepiecesCatalogEntry['triggers'][number],\n scopes: string[],\n dataClass: IntegrationDataClass,\n): IntegrationConnectorTrigger {\n return {\n id: trigger.id,\n title: trigger.title,\n requiredScopes: [scopes[0]!],\n dataClass,\n payloadSchema: { type: 'object', additionalProperties: true, properties: {} },\n }\n}\n\nfunction dataClassFor(category: IntegrationConnectorCategory): IntegrationDataClass {\n if (category === 'database' || category === 'storage' || category === 'email') return 'private'\n if (category === 'crm' || category === 'chat' || category === 'docs') return 'private'\n if (category === 'internal') return 'sensitive'\n return 'internal'\n}\n","import type {\n CompleteAuthRequest,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationConnection,\n IntegrationConnector,\n IntegrationProvider,\n IntegrationProviderKind,\n IntegrationTriggerEvent,\n IntegrationTriggerSubscription,\n StartAuthRequest,\n StartAuthResult,\n} from './index.js'\nimport { IntegrationError } from './index.js'\n\nexport interface CatalogExecutorInvocation {\n connection: IntegrationConnection\n request: IntegrationActionRequest\n connector: IntegrationConnector\n action: IntegrationConnector['actions'][number]\n}\n\nexport interface CatalogExecutorProviderOptions {\n id: string\n kind: IntegrationProviderKind\n connectors: IntegrationConnector[]\n startAuth?: (request: StartAuthRequest) => Promise<StartAuthResult> | StartAuthResult\n completeAuth?: (request: CompleteAuthRequest) => Promise<IntegrationConnection> | IntegrationConnection\n executeAction: (invocation: CatalogExecutorInvocation) => Promise<IntegrationActionResult> | IntegrationActionResult\n subscribeTrigger?: (\n connection: IntegrationConnection,\n trigger: NonNullable<IntegrationConnector['triggers']>[number],\n targetUrl?: string,\n ) => Promise<IntegrationTriggerSubscription> | IntegrationTriggerSubscription\n unsubscribeTrigger?: (subscriptionId: string) => Promise<void> | void\n normalizeTriggerEvent?: (raw: unknown) => Promise<IntegrationTriggerEvent> | IntegrationTriggerEvent\n}\n\nexport function createCatalogExecutorProvider(options: CatalogExecutorProviderOptions): IntegrationProvider {\n const byConnector = new Map(options.connectors.map((connector) => [connector.id, connector]))\n return {\n id: options.id,\n kind: options.kind,\n listConnectors: () => options.connectors,\n startAuth: options.startAuth,\n completeAuth: options.completeAuth,\n async invokeAction(connection, request) {\n const connector = byConnector.get(connection.connectorId)\n if (!connector) {\n throw new IntegrationError(`Connector ${connection.connectorId} not found.`, 'connector_not_found')\n }\n const action = connector.actions.find((candidate) => candidate.id === request.action)\n if (!action) {\n throw new IntegrationError(`Action ${request.action} is not defined by connector ${connector.id}.`, 'action_not_found')\n }\n return options.executeAction({ connection, request, connector, action })\n },\n async subscribeTrigger(connection, triggerId, targetUrl) {\n if (!options.subscribeTrigger) {\n throw new IntegrationError(`Provider ${options.id} does not support trigger subscriptions.`, 'trigger_not_found')\n }\n const connector = byConnector.get(connection.connectorId)\n if (!connector) {\n throw new IntegrationError(`Connector ${connection.connectorId} not found.`, 'connector_not_found')\n }\n const trigger = connector.triggers?.find((candidate) => candidate.id === triggerId)\n if (!trigger) {\n throw new IntegrationError(`Trigger ${triggerId} is not defined by connector ${connector.id}.`, 'trigger_not_found')\n }\n return options.subscribeTrigger(connection, trigger, targetUrl)\n },\n unsubscribeTrigger: options.unsubscribeTrigger,\n normalizeTriggerEvent: options.normalizeTriggerEvent,\n }\n}\n","import {\n buildActivepiecesConnectors,\n listActivepiecesCatalogEntries,\n type ActivepiecesCatalogEntry,\n} from './activepieces-catalog.js'\nimport { createCatalogExecutorProvider } from './catalog-executor.js'\nimport type {\n CompleteAuthRequest,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationConnection,\n IntegrationConnector,\n IntegrationProvider,\n StartAuthRequest,\n StartAuthResult,\n} from './index.js'\nimport { IntegrationError } from './index.js'\n\nexport interface ActivepiecesExecutorInvocation {\n connection: IntegrationConnection\n request: IntegrationActionRequest\n connector: IntegrationConnector\n catalogEntry: ActivepiecesCatalogEntry\n piece: {\n id: string\n npmPackage?: string\n version?: string\n actionId: string\n upstreamActionName?: string\n }\n}\n\nexport interface ActivepiecesExecutorProviderOptions {\n id?: string\n connectors?: IntegrationConnector[]\n startAuth?: (request: StartAuthRequest) => Promise<StartAuthResult> | StartAuthResult\n completeAuth?: (request: CompleteAuthRequest) => Promise<IntegrationConnection> | IntegrationConnection\n executeAction: (invocation: ActivepiecesExecutorInvocation) => Promise<IntegrationActionResult> | IntegrationActionResult\n}\n\nexport function createActivepiecesExecutorProvider(options: ActivepiecesExecutorProviderOptions): IntegrationProvider {\n const providerId = options.id ?? 'activepieces'\n const connectors = options.connectors ?? buildActivepiecesConnectors({\n providerId,\n includeCatalogActions: true,\n executable: true,\n })\n const byEntry = new Map(listActivepiecesCatalogEntries().map((entry) => [entry.id, entry]))\n\n return createCatalogExecutorProvider({\n id: providerId,\n kind: 'activepieces',\n connectors,\n startAuth: options.startAuth,\n completeAuth: options.completeAuth,\n executeAction: async ({ connection, request, connector, action }) => {\n const catalogEntry = byEntry.get(connector.id)\n if (!catalogEntry) {\n throw new IntegrationError(`Activepieces catalog entry ${connector.id} not found.`, 'connector_not_found')\n }\n const catalogAction = catalogEntry.actions.find((candidate) => candidate.id === action.id)\n return options.executeAction({\n connection,\n request,\n connector,\n catalogEntry,\n piece: {\n id: catalogEntry.id,\n npmPackage: catalogEntry.npmPackage,\n version: catalogEntry.version,\n actionId: action.id,\n upstreamActionName: catalogAction?.upstreamName,\n },\n })\n },\n })\n}\n","import {\n buildActivepiecesConnectors,\n listActivepiecesCatalogEntries,\n} from './activepieces-catalog.js'\nimport { createActivepiecesExecutorProvider } from './activepieces-provider.js'\nimport { buildIntegrationToolCatalog } from './catalog.js'\nimport {\n buildDefaultIntegrationRegistry,\n composeIntegrationRegistry,\n type IntegrationRegistryConflict,\n type IntegrationRegistrySummary,\n summarizeIntegrationRegistry,\n} from './registry.js'\n\nexport interface IntegrationCatalogFreshnessOptions {\n liveActivepieces?: boolean\n minActivepiecesConnectors?: number\n staleConnectorDelta?: number\n fetchImpl?: typeof fetch\n}\n\nexport interface IntegrationCatalogFreshnessResult {\n ok: boolean\n generatedAt: string\n local: {\n activepiecesEntries: number\n activepiecesConnectors: number\n activepiecesActions: number\n activepiecesTriggers: number\n executableActivepiecesConnectors: number\n executableActivepiecesActions: number\n executableActivepiecesTriggers: number\n executableToolDefinitions: number\n unsupportedExecutableConnectorIds: string[]\n registryEntries: number\n registrySummary: IntegrationRegistrySummary\n conflictSamples: IntegrationRegistryConflict[]\n }\n upstream?: {\n activepiecesPieces?: number\n activepiecesDelta?: number\n checkedUrl: string\n warning?: string\n }\n warnings: string[]\n}\n\nexport const ACTIVEPIECES_PUBLIC_CATALOG_URL = 'https://www.activepieces.com/pieces'\n\nfunction parseCount(value: string | undefined): number | undefined {\n if (!value) return undefined\n const parsed = Number.parseInt(value.replace(/,/g, ''), 10)\n return Number.isFinite(parsed) ? parsed : undefined\n}\n\nexport function extractActivepiecesPublicPieceCount(html: string): number | undefined {\n const showingMatch = html.match(/Showing\\s+([0-9,]+)\\s+pieces/i)\n const integrationMatch = html.match(/([0-9,]+)\\+?\\s+Integrations/i)\n return parseCount(showingMatch?.[1]) ?? parseCount(integrationMatch?.[1])\n}\n\nexport async function auditIntegrationCatalogFreshness(\n options: IntegrationCatalogFreshnessOptions = {},\n): Promise<IntegrationCatalogFreshnessResult> {\n const minActivepiecesConnectors = options.minActivepiecesConnectors ?? 600\n const staleConnectorDelta = options.staleConnectorDelta ?? 25\n const activepiecesEntries = listActivepiecesCatalogEntries()\n const activepiecesConnectors = buildActivepiecesConnectors({\n includeCatalogActions: true,\n })\n const executableActivepiecesProvider = createActivepiecesExecutorProvider({\n executeAction: () => ({ ok: true, action: 'audit.noop' }),\n })\n const executableActivepiecesConnectors = await executableActivepiecesProvider.listConnectors()\n const executableRegistry = composeIntegrationRegistry([\n {\n id: executableActivepiecesProvider.id,\n connectors: executableActivepiecesConnectors,\n },\n ])\n const executableTools = buildIntegrationToolCatalog(executableRegistry.connectors)\n const unsupportedExecutableConnectorIds = executableActivepiecesConnectors\n .filter((connector) => connector.actions.length === 0)\n .map((connector) => connector.id)\n const registry = buildDefaultIntegrationRegistry({\n includeSpecs: true,\n includeActivepieces: true,\n })\n const warnings: string[] = []\n\n if (activepiecesConnectors.length < minActivepiecesConnectors) {\n warnings.push(\n `Activepieces catalog has ${activepiecesConnectors.length} connectors, below floor ${minActivepiecesConnectors}.`,\n )\n }\n // Entries without runnable actions (trigger-only or framework-internal\n // pieces) are an intrinsic property of the upstream catalog, not a freshness\n // defect. Their count is reported via unsupportedExecutableConnectorIds and\n // tool-definition totals; it does not gate the freshness check.\n\n let upstream: IntegrationCatalogFreshnessResult['upstream']\n if (options.liveActivepieces) {\n upstream = await checkActivepiecesPublicCatalog({\n localConnectorCount: activepiecesConnectors.length,\n staleConnectorDelta,\n fetchImpl: options.fetchImpl,\n warnings,\n })\n }\n\n return {\n ok: warnings.length === 0,\n generatedAt: new Date().toISOString(),\n local: {\n activepiecesEntries: activepiecesEntries.length,\n activepiecesConnectors: activepiecesConnectors.length,\n activepiecesActions: activepiecesConnectors.reduce(\n (sum, connector) => sum + connector.actions.length,\n 0,\n ),\n activepiecesTriggers: activepiecesConnectors.reduce(\n (sum, connector) => sum + (connector.triggers?.length ?? 0),\n 0,\n ),\n executableActivepiecesConnectors: executableActivepiecesConnectors.length,\n executableActivepiecesActions: executableActivepiecesConnectors.reduce(\n (sum, connector) => sum + connector.actions.length,\n 0,\n ),\n executableActivepiecesTriggers: executableActivepiecesConnectors.reduce(\n (sum, connector) => sum + (connector.triggers?.length ?? 0),\n 0,\n ),\n executableToolDefinitions: executableTools.length,\n unsupportedExecutableConnectorIds,\n registryEntries: registry.entries.length,\n registrySummary: summarizeIntegrationRegistry(registry),\n conflictSamples: registry.entries\n .flatMap((entry) => entry.conflicts)\n .slice(0, 10),\n },\n upstream,\n warnings,\n }\n}\n\nasync function checkActivepiecesPublicCatalog(input: {\n localConnectorCount: number\n staleConnectorDelta: number\n fetchImpl?: typeof fetch\n warnings: string[]\n}): Promise<IntegrationCatalogFreshnessResult['upstream']> {\n try {\n const res = await (input.fetchImpl ?? fetch)(ACTIVEPIECES_PUBLIC_CATALOG_URL, {\n headers: { accept: 'text/html' },\n signal: AbortSignal.timeout(15_000),\n })\n if (!res.ok) {\n const warning = `Activepieces freshness request failed with HTTP ${res.status}.`\n input.warnings.push(warning)\n return {\n checkedUrl: ACTIVEPIECES_PUBLIC_CATALOG_URL,\n warning,\n }\n }\n const activepiecesPieces = extractActivepiecesPublicPieceCount(await res.text())\n const activepiecesDelta =\n activepiecesPieces === undefined\n ? undefined\n : activepiecesPieces - input.localConnectorCount\n if (\n activepiecesDelta !== undefined &&\n activepiecesDelta > input.staleConnectorDelta\n ) {\n input.warnings.push(\n `Activepieces upstream appears ${activepiecesDelta} connectors ahead of the vendored package catalog.`,\n )\n }\n return {\n activepiecesPieces,\n activepiecesDelta,\n checkedUrl: ACTIVEPIECES_PUBLIC_CATALOG_URL,\n warning:\n activepiecesPieces === undefined\n ? 'Could not parse upstream piece count.'\n : undefined,\n }\n } catch (error) {\n const warning =\n error instanceof Error\n ? error.message\n : 'Activepieces freshness request failed.'\n input.warnings.push(warning)\n return {\n checkedUrl: ACTIVEPIECES_PUBLIC_CATALOG_URL,\n warning,\n }\n }\n}\n","import {\n buildActivepiecesConnectors,\n listActivepiecesCatalogEntries,\n type ActivepiecesCatalogEntry,\n} from './activepieces-catalog.js'\nimport { createCatalogExecutorProvider } from './catalog-executor.js'\nimport {\n auditIntegrationCatalogFreshness,\n extractActivepiecesPublicPieceCount,\n type IntegrationCatalogFreshnessOptions,\n} from './catalog-freshness.js'\nimport {\n IntegrationError,\n type CompleteAuthRequest,\n type IntegrationActionRequest,\n type IntegrationActionResult,\n type IntegrationConnection,\n type IntegrationConnector,\n type IntegrationTriggerEvent,\n type IntegrationTriggerSubscription,\n type StartAuthRequest,\n type StartAuthResult,\n} from './index.js'\nimport {\n CONNECTOR_ADAPTER_FACTORIES,\n listBundledConnectorAdapters,\n} from './connectors/index.js'\nimport { canonicalIntegrationKind } from './integration-kind-aliases.js'\n\nexport {\n type ActivepiecesCatalogEntry,\n} from './activepieces-catalog.js'\n\nexport const TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID = 'tangle-catalog'\nexport const TANGLE_INTEGRATIONS_CATALOG_SOURCE = 'tangle-integrations-catalog'\n\nexport type TangleIntegrationImplementationKind = 'native_adapter' | 'package_runtime'\nexport type TangleIntegrationContractStatus = 'contract_ready' | 'runtime_backed' | 'native_backed'\n\nexport interface TangleIntegrationCatalogEntry {\n id: string\n title: string\n description: string\n category: IntegrationConnector['category']\n auth: IntegrationConnector['auth']\n authFields?: ActivepiecesCatalogEntry['authFields']\n domains: string[]\n actions: Array<{\n id: string\n title: string\n risk: IntegrationConnector['actions'][number]['risk']\n upstreamName?: string\n }>\n triggers: Array<{\n id: string\n title: string\n upstreamName?: string\n }>\n}\n\nexport interface TangleIntegrationContract {\n id: string\n title: string\n description: string\n category: IntegrationConnector['category']\n auth: IntegrationConnector['auth']\n authFields: NonNullable<ActivepiecesCatalogEntry['authFields']>\n actions: Array<{\n id: string\n title: string\n risk: IntegrationConnector['actions'][number]['risk']\n upstreamName: string\n }>\n triggers: Array<{\n id: string\n title: string\n upstreamName: string\n }>\n implementation: {\n kind: TangleIntegrationImplementationKind\n runtimePackage?: string\n version?: string\n }\n status: TangleIntegrationContractStatus\n quality: {\n tangleContract: true\n authFieldsMapped: boolean\n actionNamesMapped: boolean\n triggerNamesMapped: boolean\n runtimePackageMapped: boolean\n nativeAdapter: boolean\n }\n}\n\nexport interface TangleCatalogRuntimePackageManifestOptions {\n name?: string\n includeAgentIntegrationsPackage?: boolean\n agentIntegrationsVersion?: string\n additionalDependencies?: Record<string, string>\n}\n\nexport interface TangleCatalogRuntimePackageManifest {\n name: string\n private: true\n type: 'module'\n dependencies: Record<string, string>\n tangle: {\n integrationContracts: number\n packageRuntimeBackends: number\n generatedFrom: typeof TANGLE_INTEGRATIONS_CATALOG_SOURCE\n }\n}\n\nexport interface TangleCatalogExecutorInvocation {\n connection: IntegrationConnection\n request: IntegrationActionRequest\n connector: IntegrationConnector\n catalogEntry: TangleIntegrationCatalogEntry\n piece: {\n id: string\n packageName?: string\n version?: string\n actionId: string\n upstreamActionName?: string\n }\n}\n\nexport interface TangleCatalogTriggerInvocation {\n connection: IntegrationConnection\n connector: IntegrationConnector\n catalogEntry: TangleIntegrationCatalogEntry\n trigger: NonNullable<IntegrationConnector['triggers']>[number]\n targetUrl?: string\n piece: {\n id: string\n packageName?: string\n version?: string\n triggerId: string\n upstreamTriggerName?: string\n }\n}\n\nexport interface TangleCatalogExecutorProviderOptions {\n id?: string\n connectors?: IntegrationConnector[]\n startAuth?: (request: StartAuthRequest) => Promise<StartAuthResult> | StartAuthResult\n completeAuth?: (request: CompleteAuthRequest) => Promise<IntegrationConnection> | IntegrationConnection\n executeAction: (invocation: TangleCatalogExecutorInvocation) => Promise<IntegrationActionResult> | IntegrationActionResult\n subscribeTrigger?: (invocation: TangleCatalogTriggerInvocation) => Promise<IntegrationTriggerSubscription> | IntegrationTriggerSubscription\n unsubscribeTrigger?: (subscriptionId: string) => Promise<void> | void\n normalizeTriggerEvent?: (raw: unknown) => Promise<IntegrationTriggerEvent> | IntegrationTriggerEvent\n}\n\nexport type TangleIntegrationCatalogFreshnessOptions = IntegrationCatalogFreshnessOptions\n\nexport interface TangleIntegrationCatalogFreshnessResult {\n ok: boolean\n generatedAt: string\n local: {\n catalogEntries: number\n catalogConnectors: number\n catalogActions: number\n catalogTriggers: number\n executableCatalogConnectors: number\n executableCatalogActions: number\n executableCatalogTriggers: number\n executableToolDefinitions: number\n unsupportedExecutableConnectorIds: string[]\n registryEntries: number\n registrySummary: Awaited<ReturnType<typeof auditIntegrationCatalogFreshness>>['local']['registrySummary']\n conflictSamples: Awaited<ReturnType<typeof auditIntegrationCatalogFreshness>>['local']['conflictSamples']\n }\n upstream?: {\n externalEntries?: number\n externalDelta?: number\n checkedUrl: string\n warning?: string\n }\n warnings: string[]\n}\n\nexport function listTangleNativeAdapterIds(): string[] {\n const ids = new Set<string>(\n CONNECTOR_ADAPTER_FACTORIES.map(\n (definition) => definition.kind,\n ),\n )\n for (const adapter of listBundledConnectorAdapters()) {\n ids.add(adapter.manifest.kind)\n }\n return [...ids].sort()\n}\n\nexport function listTangleIntegrationCatalogEntries(): TangleIntegrationCatalogEntry[] {\n return listActivepiecesCatalogEntries().map((entry) => sanitizeEntry(entry))\n}\n\nexport function listTangleIntegrationContracts(): TangleIntegrationContract[] {\n const nativeAdapterIds = new Set(listTangleNativeAdapterIds().map(canonicalIntegrationKind))\n return listActivepiecesCatalogEntries().map((entry) => {\n const nativeAdapter = nativeAdapterIds.has(canonicalIntegrationKind(entry.id))\n return {\n id: entry.id,\n title: entry.title,\n description: entry.description,\n category: entry.category,\n auth: entry.auth,\n authFields: entry.authFields ?? [],\n actions: entry.actions.map((action) => ({\n id: action.id,\n title: action.title,\n risk: action.risk,\n upstreamName: action.upstreamName ?? action.id,\n })),\n triggers: entry.triggers.map((trigger) => ({\n id: trigger.id,\n title: trigger.title,\n upstreamName: trigger.upstreamName ?? trigger.id,\n })),\n implementation: {\n kind: nativeAdapter ? 'native_adapter' : 'package_runtime',\n runtimePackage: entry.npmPackage,\n version: entry.version,\n },\n status: nativeAdapter ? 'native_backed' : entry.npmPackage ? 'runtime_backed' : 'contract_ready',\n quality: {\n tangleContract: true,\n authFieldsMapped: entry.auth === 'none' || Boolean(entry.authFields?.length),\n actionNamesMapped: entry.actions.every((action) => Boolean(action.upstreamName)),\n triggerNamesMapped: entry.triggers.every((trigger) => Boolean(trigger.upstreamName)),\n runtimePackageMapped: Boolean(entry.npmPackage),\n nativeAdapter,\n },\n }\n })\n}\n\nexport function listTangleIntegrationCatalogRuntimePackages(): Array<{\n connectorId: string\n packageName: string\n version?: string\n}> {\n const nativeAdapterIds = new Set(listTangleNativeAdapterIds())\n return listActivepiecesCatalogEntries()\n .filter((entry): entry is ActivepiecesCatalogEntry & { npmPackage: string } =>\n Boolean(entry.npmPackage) && !nativeAdapterIds.has(entry.id))\n .map((entry) => ({\n connectorId: entry.id,\n packageName: entry.npmPackage,\n version: entry.version,\n }))\n}\n\nexport function buildTangleCatalogRuntimePackageManifest(\n options: TangleCatalogRuntimePackageManifestOptions = {},\n): TangleCatalogRuntimePackageManifest {\n const dependencies: Record<string, string> = {}\n if (options.includeAgentIntegrationsPackage ?? true) {\n dependencies['@tangle-network/agent-integrations'] = options.agentIntegrationsVersion ?? 'latest'\n }\n for (const pkg of listTangleIntegrationCatalogRuntimePackages()) {\n dependencies[pkg.packageName] = pkg.version ?? 'latest'\n }\n Object.assign(dependencies, options.additionalDependencies)\n return {\n name: options.name ?? '@tangle-network/agent-integrations-runtime-bundle',\n private: true,\n type: 'module',\n dependencies: Object.fromEntries(Object.entries(dependencies).sort(([a], [b]) => a.localeCompare(b))),\n tangle: {\n integrationContracts: listTangleIntegrationContracts().length,\n packageRuntimeBackends: listTangleIntegrationContracts()\n .filter((contract) => contract.implementation.kind === 'package_runtime').length,\n generatedFrom: TANGLE_INTEGRATIONS_CATALOG_SOURCE,\n },\n }\n}\n\nexport function renderTangleCatalogRuntimePnpmAddCommand(options: {\n includeAgentIntegrationsPackage?: boolean\n agentIntegrationsVersion?: string\n} = {}): string {\n const manifest = buildTangleCatalogRuntimePackageManifest({\n includeAgentIntegrationsPackage: options.includeAgentIntegrationsPackage,\n agentIntegrationsVersion: options.agentIntegrationsVersion,\n })\n return [\n 'pnpm',\n 'add',\n ...Object.entries(manifest.dependencies).map(([name, version]) => `${name}@${version}`),\n ].join(' ')\n}\n\nexport function buildTangleIntegrationCatalogConnectors(options: {\n providerId?: string\n includeCatalogActions?: boolean\n executable?: boolean\n} = {}): IntegrationConnector[] {\n const providerId = options.providerId ?? TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID\n return buildActivepiecesConnectors({\n ...options,\n providerId,\n }).map((connector) => sanitizeConnector(connector, providerId))\n}\n\nexport function createTangleCatalogExecutorProvider(options: TangleCatalogExecutorProviderOptions) {\n const providerId = options.id ?? TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID\n const connectors = options.connectors ?? buildTangleIntegrationCatalogConnectors({\n providerId,\n includeCatalogActions: true,\n executable: true,\n })\n const byEntry = new Map(listActivepiecesCatalogEntries().map((entry) => [entry.id, entry]))\n\n return createCatalogExecutorProvider({\n id: providerId,\n kind: 'tangle_catalog',\n connectors,\n startAuth: options.startAuth,\n completeAuth: options.completeAuth,\n executeAction: async ({ connection, request, connector, action }) => {\n const importedEntry = byEntry.get(connector.id)\n if (!importedEntry) {\n throw new IntegrationError(`Tangle catalog entry ${connector.id} not found.`, 'connector_not_found')\n }\n const catalogAction = importedEntry.actions.find((candidate) => candidate.id === action.id)\n return options.executeAction({\n connection,\n request,\n connector,\n catalogEntry: sanitizeEntry(importedEntry),\n piece: {\n id: importedEntry.id,\n packageName: importedEntry.npmPackage,\n version: importedEntry.version,\n actionId: action.id,\n upstreamActionName: catalogAction?.upstreamName,\n },\n })\n },\n subscribeTrigger: options.subscribeTrigger\n ? async (connection, trigger, targetUrl) => {\n const connector = connectors.find((candidate) => candidate.id === connection.connectorId)\n const importedEntry = byEntry.get(connection.connectorId)\n if (!connector || !importedEntry) {\n throw new IntegrationError(`Tangle catalog entry ${connection.connectorId} not found.`, 'connector_not_found')\n }\n const catalogTrigger = importedEntry.triggers.find((candidate) => candidate.id === trigger.id)\n return options.subscribeTrigger!({\n connection,\n connector,\n catalogEntry: sanitizeEntry(importedEntry),\n trigger,\n targetUrl,\n piece: {\n id: importedEntry.id,\n packageName: importedEntry.npmPackage,\n version: importedEntry.version,\n triggerId: trigger.id,\n upstreamTriggerName: catalogTrigger?.upstreamName,\n },\n })\n }\n : undefined,\n unsubscribeTrigger: options.unsubscribeTrigger,\n normalizeTriggerEvent: options.normalizeTriggerEvent,\n })\n}\n\nexport const extractExternalCatalogPublicCount = extractActivepiecesPublicPieceCount\n\nexport async function auditTangleIntegrationCatalogFreshness(\n options: TangleIntegrationCatalogFreshnessOptions = {},\n): Promise<TangleIntegrationCatalogFreshnessResult> {\n const result = await auditIntegrationCatalogFreshness(options)\n return {\n ok: result.ok,\n generatedAt: result.generatedAt,\n local: {\n catalogEntries: result.local.activepiecesEntries,\n catalogConnectors: result.local.activepiecesConnectors,\n catalogActions: result.local.activepiecesActions,\n catalogTriggers: result.local.activepiecesTriggers,\n executableCatalogConnectors: result.local.executableActivepiecesConnectors,\n executableCatalogActions: result.local.executableActivepiecesActions,\n executableCatalogTriggers: result.local.executableActivepiecesTriggers,\n executableToolDefinitions: result.local.executableToolDefinitions,\n unsupportedExecutableConnectorIds: result.local.unsupportedExecutableConnectorIds,\n registryEntries: result.local.registryEntries,\n registrySummary: result.local.registrySummary,\n conflictSamples: result.local.conflictSamples,\n },\n upstream: result.upstream\n ? {\n externalEntries: result.upstream.activepiecesPieces,\n externalDelta: result.upstream.activepiecesDelta,\n checkedUrl: result.upstream.checkedUrl,\n warning: result.upstream.warning,\n }\n : undefined,\n warnings: result.warnings.map((warning) => warning.replaceAll('Activepieces', 'Tangle Integrations Catalog')),\n }\n}\n\nfunction sanitizeEntry(entry: ActivepiecesCatalogEntry): TangleIntegrationCatalogEntry {\n return {\n id: entry.id,\n title: entry.title,\n description: entry.description,\n category: entry.category,\n auth: entry.auth,\n authFields: entry.authFields,\n domains: entry.domains.filter((domain) => !domain.toLowerCase().includes('activepieces')),\n actions: entry.actions.map((action) => ({\n id: action.id,\n title: action.title,\n risk: action.risk,\n upstreamName: action.upstreamName,\n })),\n triggers: entry.triggers.map((trigger) => ({\n id: trigger.id,\n title: trigger.title,\n upstreamName: trigger.upstreamName,\n })),\n }\n}\n\nfunction sanitizeConnector(connector: IntegrationConnector, providerId: string): IntegrationConnector {\n const metadata = connector.metadata ?? {}\n return {\n ...connector,\n providerId,\n metadata: {\n source: TANGLE_INTEGRATIONS_CATALOG_SOURCE,\n providerId,\n executable: metadata.executable,\n runtime: 'native-adapter-backlog',\n catalogOnly: metadata.catalogOnly,\n supportTier: metadata.supportTier,\n catalogActionCount: metadata.catalogActionCount,\n catalogTriggerCount: metadata.catalogTriggerCount,\n license: metadata.license,\n version: metadata.version,\n domains: Array.isArray(metadata.domains)\n ? metadata.domains.filter((domain) => typeof domain === 'string' && !domain.toLowerCase().includes('activepieces'))\n : undefined,\n ...(metadata.overridden ? { overridden: true } : {}),\n },\n }\n}\n","import { buildActivepiecesConnectors, listActivepiecesCatalogEntries } from './activepieces-catalog.js'\nimport { buildTangleIntegrationCatalogConnectors } from './tangle-catalog.js'\nimport type {\n IntegrationCatalogSource,\n IntegrationConnector,\n} from './core-types.js'\nimport {\n composeIntegrationRegistry,\n type IntegrationRegistry,\n type IntegrationSupportTier,\n} from './registry-core.js'\nimport { integrationSpecToConnector, listIntegrationSpecs } from './specs/registry.js'\n\nexport {\n canonicalConnectorId,\n composeIntegrationRegistry,\n inferIntegrationSupportTier,\n summarizeIntegrationRegistry,\n} from './registry-core.js'\nexport type {\n ComposeIntegrationRegistryOptions,\n IntegrationRegistry,\n IntegrationRegistryConflict,\n IntegrationRegistryEntry,\n IntegrationRegistrySourceRef,\n IntegrationRegistrySummary,\n IntegrationSupportTier,\n} from './registry-core.js'\n\nexport function buildDefaultIntegrationRegistry(options: {\n includeSpecs?: boolean\n includeTangleCatalog?: boolean\n tangleCatalogRuntimeExecutable?: boolean\n /** @deprecated Use includeTangleCatalog. */\n includeActivepieces?: boolean\n} = {}): IntegrationRegistry {\n const includeSpecs = options.includeSpecs ?? true\n const includeTangleCatalog = options.includeTangleCatalog ?? options.includeActivepieces ?? true\n const sources: IntegrationCatalogSource[] = []\n if (includeSpecs) {\n sources.push({\n id: 'spec',\n connectors: listIntegrationSpecs().map((spec) => integrationSpecToConnector(spec, 'spec')),\n })\n }\n if (includeTangleCatalog) {\n const tangleConnectors = options.tangleCatalogRuntimeExecutable\n ? buildTangleIntegrationCatalogConnectors({\n providerId: 'tangle-catalog',\n includeCatalogActions: true,\n executable: true,\n })\n : buildActivepiecesConnectors({ providerId: 'tangle-catalog' }).map((connector) => ({\n ...connector,\n providerId: 'tangle-catalog',\n metadata: {\n source: 'tangle-integrations-catalog',\n providerId: 'tangle-catalog',\n executable: connector.metadata?.executable,\n runtime: 'native-adapter-backlog',\n catalogOnly: connector.metadata?.catalogOnly,\n supportTier: connector.metadata?.supportTier,\n catalogActionCount: connector.metadata?.catalogActionCount,\n catalogTriggerCount: connector.metadata?.catalogTriggerCount,\n license: connector.metadata?.license,\n version: connector.metadata?.version,\n domains: Array.isArray(connector.metadata?.domains)\n ? connector.metadata.domains.filter((domain) => typeof domain === 'string' && !domain.toLowerCase().includes('activepieces'))\n : undefined,\n ...(connector.metadata?.overridden ? { overridden: true } : {}),\n },\n }))\n sources.push({\n id: 'tangle-catalog',\n connectors: tangleConnectors,\n })\n }\n return composeIntegrationRegistry(sources)\n}\n\n/** Per-entry executability classification. Pure metadata — never loads or\n * runs a runtime module. The coverage report consumes this to separate\n * \"we can execute this today\" from \"catalog-only / setup-only\". */\nexport interface IntegrationCatalogExecutability {\n canonicalId: string\n /** True when the entry resolves to a runnable action: a first-party /\n * sandbox / gateway-executable support tier, or a tangle-catalog entry\n * with a resolvable npm runtime package. */\n executable: boolean\n supportTier: IntegrationSupportTier\n authKind: IntegrationConnector['auth']\n /** Resolvable npm runtime package name when one is registered for this\n * connector in the vendored catalog; undefined for first-party adapters\n * (which execute in-process) and catalog-only entries. */\n runtimePackage?: string\n actionCount: number\n triggerCount: number\n}\n\n/** Classify every entry in a composed registry by executability + auth kind\n * WITHOUT executing anything. Defaults to {@link buildDefaultIntegrationRegistry}. */\nexport function classifyIntegrationCatalogExecutability(\n registry: IntegrationRegistry = buildDefaultIntegrationRegistry(),\n): IntegrationCatalogExecutability[] {\n const packageByConnector = new Map(\n listActivepiecesCatalogEntries()\n .filter((entry) => entry.npmPackage)\n .map((entry) => [entry.id, entry.npmPackage!]),\n )\n return registry.entries.map((entry) => {\n const runtimePackage = packageByConnector.get(entry.connector.id)\n const tierExecutable =\n entry.supportTier === 'firstPartyExecutable' ||\n entry.supportTier === 'sandboxExecutable' ||\n entry.supportTier === 'gatewayExecutable'\n return {\n canonicalId: entry.canonicalId,\n executable: tierExecutable && entry.connector.actions.length > 0,\n supportTier: entry.supportTier,\n authKind: entry.connector.auth,\n runtimePackage,\n actionCount: entry.connector.actions.length,\n triggerCount: entry.connector.triggers?.length ?? 0,\n }\n })\n}\n","/**\n * IntegrationError — the runtime error class thrown by the hub, providers,\n * adapters, and runtime helpers. Lives in its own module so any source\n * file can import it without pulling the package barrel (`./index.ts`)\n * and forming a cycle.\n *\n * The richer {@link IntegrationRuntimeError} (in `./errors.ts`) is a\n * separate, structured error type used by consumers wiring custom\n * error → HTTP-status mappings. `IntegrationError` is the legacy/canonical\n * throw shape kept for back-compat with everything that already catches it.\n */\n\nexport type IntegrationErrorRuntimeCode =\n | 'provider_not_found'\n | 'connector_not_found'\n | 'connection_not_found'\n | 'connection_not_active'\n | 'auth_not_supported'\n | 'capability_invalid'\n | 'capability_expired'\n | 'scope_denied'\n | 'action_denied'\n | 'action_not_found'\n | 'trigger_not_found'\n | 'approval_required'\n | 'policy_denied'\n | 'config_missing'\n | 'provider_failure'\n\nexport class IntegrationError extends Error {\n constructor(\n message: string,\n readonly code: IntegrationErrorRuntimeCode,\n ) {\n super(message)\n this.name = 'IntegrationError'\n }\n}\n","import type {\n CapabilityMutationResult,\n CapabilityReadResult,\n ConnectorAdapter,\n ConnectorCredentials,\n ConnectorInvocation,\n OAuth2TokenClientAuthMethod,\n OAuth2UrlTemplateMetadataSpec,\n ResolvedDataSource,\n TokenMetadataSource,\n} from './connectors/types.js'\nimport type {\n CompleteAuthRequest,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationCatalogSource,\n IntegrationConnection,\n IntegrationConnector,\n IntegrationProvider,\n IntegrationProviderKind,\n StartAuthRequest,\n StartAuthResult,\n} from './core-types.js'\nimport { IntegrationError } from './core-error.js'\nimport {\n createOAuthBasicAuthorizationHeader,\n createOAuthTokenRequestHeaders,\n oauthClientCredentialRedactionValues,\n redactOAuthSensitiveText,\n} from './connectors/oauth.js'\n\n/** OAuth client credentials the host resolves at start/exchange time.\n * The lib never reads env or any vault — kept edge-runtime-safe. */\nexport interface OAuthClientCredentials {\n clientId: string\n /** Omit for public clients whose manifest uses tokenClientAuthMethod=none. */\n clientSecret?: string\n}\n\nexport interface ConnectorAdapterProviderOptions {\n id?: string\n kind?: IntegrationProviderKind\n adapters: ConnectorAdapter[]\n resolveDataSource: (connection: IntegrationConnection) => Promise<ResolvedDataSource> | ResolvedDataSource\n /** Invoked when an adapter rotates credentials during executeRead /\n * executeMutation (e.g. an OAuth access token refreshed on expiry). The\n * host re-encrypts + persists the rotated envelope so the next expiry\n * does not force a reconnect. Carries the connection so the host can\n * resolve the secretRef. */\n onCredentialsRotated?: (event: {\n connection: IntegrationConnection\n credentials: ConnectorCredentials\n }) => Promise<void> | void\n /** Resolve OAuth client_id and, for confidential clients, client_secret at\n * start- and exchange-time. Host owns env, vault, and per-tenant\n * overrides. Return null to refuse the flow (lib will throw\n * `config_missing`). The lib never logs the secret nor includes it\n * in thrown error messages. */\n resolveOAuthClient?: (input: { connectorId: string }) =>\n | Promise<OAuthClientCredentials | null>\n | OAuthClientCredentials\n | null\n /** Fetch implementation forwarded to the OAuth token exchange. Default\n * is `globalThis.fetch`. Tests inject a mock. */\n fetchImpl?: typeof fetch\n now?: () => Date\n}\n\nexport function createConnectorAdapterProvider(options: ConnectorAdapterProviderOptions): IntegrationProvider {\n const providerId = options.id ?? 'first-party'\n const now = options.now ?? (() => new Date())\n const fetchImpl = options.fetchImpl ?? (globalThis.fetch?.bind(globalThis) as typeof fetch | undefined)\n const adapters = new Map<string, ConnectorAdapter>()\n for (const adapter of options.adapters) {\n adapters.set(adapter.manifest.kind, adapter)\n }\n return {\n id: providerId,\n kind: options.kind ?? 'first_party',\n listConnectors: () => [...adapters.values()].map((adapter) => manifestToConnector(providerId, adapter)),\n async startAuth(request: StartAuthRequest): Promise<StartAuthResult> {\n const adapter = adapters.get(request.connectorId)\n if (!adapter) {\n throw new IntegrationError(\n `Connector adapter ${request.connectorId} not found.`,\n 'connector_not_found',\n )\n }\n const auth = oauthManifestAuth(adapter.manifest.auth)\n if (!auth) {\n throw new IntegrationError(\n `Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${adapter.manifest.auth.kind}).`,\n 'auth_not_supported',\n )\n }\n if ((auth.grantType ?? 'authorization_code') !== 'authorization_code') {\n throw new IntegrationError(\n `Connector ${request.connectorId} uses client_credentials and requires a machine connection path.`,\n 'auth_not_supported',\n )\n }\n const pkce = resolveOAuthPkceMode(auth.pkce, request.connectorId)\n const tokenClientAuthMethod = resolveTokenClientAuthMethod(\n auth.tokenClientAuthMethod,\n request.connectorId,\n )\n if (!options.resolveOAuthClient) {\n throw new IntegrationError(\n `OAuth client resolver missing on adapter provider; cannot start auth for ${request.connectorId}.`,\n 'config_missing',\n )\n }\n const client = await options.resolveOAuthClient({ connectorId: request.connectorId })\n if (\n !client ||\n !client.clientId ||\n (tokenClientAuthMethod !== 'none' && !client.clientSecret)\n ) {\n throw new IntegrationError(\n `OAuth client credentials unavailable for ${request.connectorId}.`,\n 'config_missing',\n )\n }\n if (!auth.authorizationUrl) {\n throw new IntegrationError(\n `Connector ${request.connectorId} uses the ${auth.grantType ?? 'authorization_code'} grant and has no authorization URL to redirect to.`,\n 'auth_not_supported',\n )\n }\n const scopes =\n request.requestedScopes && request.requestedScopes.length > 0\n ? request.requestedScopes\n : auth.scopes\n const url = new URL(resolveOAuthUrlTemplate(\n auth.authorizationUrl,\n request.metadata,\n request.connectorId,\n auth.urlTemplateMetadata,\n ))\n url.searchParams.set('response_type', 'code')\n url.searchParams.set(\n resolveOAuthParameterName(\n auth.authorizationClientIdParam,\n 'client_id',\n request.connectorId,\n ),\n client.clientId,\n )\n url.searchParams.set('redirect_uri', request.redirectUri)\n if (auth.sendScopeParam !== false && scopes.length > 0) {\n url.searchParams.set('scope', scopes.join(auth.scopeSeparator ?? ' '))\n }\n const state = request.state ?? randomState()\n url.searchParams.set('state', state)\n if (auth.extraAuthParams) {\n for (const [key, value] of Object.entries(auth.extraAuthParams)) {\n url.searchParams.set(key, value)\n }\n }\n if (pkce === 'unsupported') {\n url.searchParams.delete('code_challenge')\n url.searchParams.delete('code_challenge_method')\n } else {\n url.searchParams.set(\n 'code_challenge',\n requirePkceChallenge(request.codeChallenge, request.connectorId),\n )\n url.searchParams.set('code_challenge_method', 'S256')\n }\n return {\n providerId,\n connectorId: request.connectorId,\n authUrl: url.toString(),\n state,\n metadata: request.metadata,\n }\n },\n async completeAuth(request: CompleteAuthRequest): Promise<IntegrationConnection> {\n const adapter = adapters.get(request.connectorId)\n if (!adapter) {\n throw new IntegrationError(\n `Connector adapter ${request.connectorId} not found.`,\n 'connector_not_found',\n )\n }\n const auth = oauthManifestAuth(adapter.manifest.auth)\n if (!auth) {\n throw new IntegrationError(\n `Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${adapter.manifest.auth.kind}).`,\n 'auth_not_supported',\n )\n }\n if ((auth.grantType ?? 'authorization_code') !== 'authorization_code') {\n throw new IntegrationError(\n `Connector ${request.connectorId} uses client_credentials and requires a machine connection path.`,\n 'auth_not_supported',\n )\n }\n const tokenClientAuthMethod = resolveTokenClientAuthMethod(\n auth.tokenClientAuthMethod,\n request.connectorId,\n )\n const pkce = resolveOAuthPkceMode(auth.pkce, request.connectorId)\n if (!request.code) {\n throw new IntegrationError(\n `Authorization code missing on completeAuth for ${request.connectorId}.`,\n 'config_missing',\n )\n }\n if (!options.resolveOAuthClient) {\n throw new IntegrationError(\n `OAuth client resolver missing on adapter provider; cannot complete auth for ${request.connectorId}.`,\n 'config_missing',\n )\n }\n const client = await options.resolveOAuthClient({ connectorId: request.connectorId })\n if (\n !client ||\n !client.clientId ||\n (tokenClientAuthMethod !== 'none' && !client.clientSecret)\n ) {\n throw new IntegrationError(\n `OAuth client credentials unavailable for ${request.connectorId}.`,\n 'config_missing',\n )\n }\n if (!fetchImpl) {\n throw new IntegrationError(\n 'No fetch implementation available; inject fetchImpl into createConnectorAdapterProvider.',\n 'config_missing',\n )\n }\n const body = new URLSearchParams({\n grant_type: 'authorization_code',\n code: request.code,\n redirect_uri: request.redirectUri,\n })\n const codeVerifier = pkce === 'unsupported'\n ? undefined\n : requirePkceVerifier(request.codeVerifier, request.connectorId)\n if (codeVerifier) body.set('code_verifier', codeVerifier)\n const headers = createOAuthTokenRequestHeaders(auth.tokenRequestHeaders)\n if (tokenClientAuthMethod === 'none') {\n body.set(\n resolveOAuthParameterName(\n auth.tokenClientIdParam,\n 'client_id',\n request.connectorId,\n ),\n client.clientId,\n )\n } else if (tokenClientAuthMethod === 'client_secret_post') {\n body.set(\n resolveOAuthParameterName(\n auth.tokenClientIdParam,\n 'client_id',\n request.connectorId,\n ),\n client.clientId,\n )\n body.set(\n resolveOAuthParameterName(\n auth.tokenClientSecretParam,\n 'client_secret',\n request.connectorId,\n ),\n client.clientSecret!,\n )\n } else {\n const authorization = createOAuthBasicAuthorizationHeader(\n client.clientId,\n client.clientSecret!,\n base64Encode,\n )\n headers.authorization = authorization\n }\n const redactionValues = [\n request.code,\n ...(codeVerifier ? [codeVerifier] : []),\n ...oauthClientCredentialRedactionValues(\n client.clientId,\n client.clientSecret,\n headers.authorization,\n ),\n ]\n const tokenUrl = resolveOAuthUrlTemplate(\n auth.tokenUrl,\n request.metadata,\n request.connectorId,\n auth.urlTemplateMetadata,\n )\n let res: Response\n try {\n res = await fetchImpl(tokenUrl, {\n method: 'POST',\n headers,\n body,\n })\n } catch (cause) {\n const detail = redactOAuthSensitiveText(\n (cause as Error)?.message ?? 'unknown',\n redactionValues,\n )\n throw new IntegrationError(\n `OAuth token exchange transport error for ${request.connectorId}: ${detail}`,\n 'provider_failure',\n )\n }\n if (!res.ok) {\n const text = await res.text().catch(() => '')\n const statusText = redactOAuthSensitiveText(res.statusText, redactionValues)\n const redactedText = redactOAuthSensitiveText(text, redactionValues)\n const detail = `${res.status} ${statusText} — ${redactedText.slice(0, 200)}`\n throw new IntegrationError(\n `OAuth token exchange failed for ${request.connectorId}: ${detail}`,\n 'provider_failure',\n )\n }\n let json: {\n access_token?: string\n refresh_token?: string\n expires_in?: number\n scope?: string\n token_type?: string\n } & Record<string, unknown>\n try {\n json = await res.json()\n } catch {\n throw new IntegrationError(\n `OAuth token exchange returned non-JSON body for ${request.connectorId}.`,\n 'provider_failure',\n )\n }\n if (!json.access_token) {\n throw new IntegrationError(\n `OAuth token exchange returned no access_token for ${request.connectorId}.`,\n 'provider_failure',\n )\n }\n const grantedScopes = typeof json.scope === 'string' && json.scope.length > 0\n ? json.scope.split(/[\\s,]+/).filter(Boolean)\n : []\n const issued = now()\n const issuedIso = issued.toISOString()\n const expiresAt = typeof json.expires_in === 'number' && json.expires_in > 0\n ? new Date(issued.getTime() + json.expires_in * 1000).toISOString()\n : undefined\n // Persist provider-specific token-response fields the connector declared\n // via `auth.tokenMetadata` into the connection metadata (e.g. Gong's\n // per-customer `api_base_url_for_customer`). The captured values win over\n // any same-key request.metadata — the token exchange is authoritative.\n const capturedMetadata = captureTokenMetadata(auth.tokenMetadata, json, request.connectorId)\n return {\n id: randomConnectionId(),\n owner: request.owner,\n providerId,\n connectorId: request.connectorId,\n status: 'active',\n grantedScopes,\n createdAt: issuedIso,\n updatedAt: issuedIso,\n expiresAt,\n metadata: { ...request.metadata, ...capturedMetadata },\n }\n },\n async invokeAction(connection, request) {\n const adapter = adapters.get(connection.connectorId)\n if (!adapter) {\n throw new IntegrationError(`Connector adapter ${connection.connectorId} not found.`, 'connector_not_found')\n }\n const capability = adapter.manifest.capabilities.find((candidate) => candidate.name === request.action)\n if (!capability) {\n throw new IntegrationError(`Capability ${request.action} is not defined by ${connection.connectorId}.`, 'action_not_found')\n }\n const source = await options.resolveDataSource(connection)\n let rotationPersistence = Promise.resolve()\n const persistRotation = (credentials: ConnectorCredentials): Promise<void> => {\n if (!options.onCredentialsRotated) return Promise.resolve()\n rotationPersistence = rotationPersistence.then(() =>\n options.onCredentialsRotated!({ connection, credentials }),\n )\n // Some third-party adapters do not await this callback. Attach a\n // rejection observer immediately, then let the original promise keep\n // its rejection for the adapter or the provider's finally block.\n void rotationPersistence.catch(() => {})\n return rotationPersistence\n }\n const invocation: ConnectorInvocation = {\n source,\n capabilityName: request.action,\n args: toRecord(request.input),\n idempotencyKey: request.idempotencyKey ?? `idem_${connection.id}_${request.action}_${now().getTime()}`,\n expectedEtag: typeof request.metadata?.expectedEtag === 'string' ? request.metadata.expectedEtag : undefined,\n callSessionId: typeof request.metadata?.callSessionId === 'string' ? request.metadata.callSessionId : undefined,\n onCredentialsRotated: options.onCredentialsRotated\n ? persistRotation\n : undefined,\n }\n try {\n if (capability.class === 'read') {\n if (!adapter.executeRead) {\n throw new IntegrationError(`Connector ${connection.connectorId} does not implement reads.`, 'action_not_found')\n }\n const result = await adapter.executeRead(invocation)\n return readResultToAction(request, result)\n }\n if (capability.class === 'mutation') {\n if (!adapter.executeMutation) {\n throw new IntegrationError(`Connector ${connection.connectorId} does not implement mutations.`, 'action_not_found')\n }\n const result = await adapter.executeMutation(invocation)\n return mutationResultToAction(request, result)\n }\n throw new IntegrationError(`Capability ${request.action} is not invokable as an action.`, 'action_not_found')\n } finally {\n // A provider can rotate a refresh token before the requested action\n // fails. Persist that full envelope regardless of the action outcome.\n await rotationPersistence\n }\n },\n }\n}\n\nexport function adapterManifestsToConnectors(\n adapters: ConnectorAdapter[],\n providerId = 'first-party',\n): IntegrationConnector[] {\n return adapters.map((adapter) => manifestToConnector(providerId, adapter))\n}\n\nexport function createConnectorAdapterCatalogSource(options: {\n id?: string\n providerId?: string\n adapters: ConnectorAdapter[]\n precedence?: number\n}): IntegrationCatalogSource {\n const sourceId = options.id ?? 'first-party'\n return {\n id: sourceId,\n precedence: options.precedence,\n connectors: adapterManifestsToConnectors(options.adapters, options.providerId ?? sourceId),\n }\n}\n\nexport function manifestToConnector(providerId: string, adapter: ConnectorAdapter): IntegrationConnector {\n const manifest = adapter.manifest\n const primaryAuth = primaryManifestAuth(manifest.auth)\n const oauthAuth = oauthManifestAuth(manifest.auth)\n return {\n id: manifest.kind,\n providerId,\n title: manifest.displayName,\n category: mapCategory(manifest.category),\n auth: mapAuth(primaryAuth.kind),\n scopes: primaryAuth.kind === 'oauth2' ? primaryAuth.scopes : [],\n actions: manifest.capabilities\n .filter((capability) => capability.class === 'read' || capability.class === 'mutation')\n .map((capability) => ({\n id: capability.name,\n title: titleFromName(capability.name),\n risk: capability.class === 'read' ? 'read' : capability.externalEffect ? 'destructive' : 'write',\n requiredScopes: capability.requiredScopes ?? [],\n dataClass: inferDataClass(manifest.category),\n ...(capability.consistencyModel ? { consistencyModel: capability.consistencyModel } : {}),\n description: capability.description,\n approvalRequired: capability.class === 'mutation',\n inputSchema: capability.parameters,\n })),\n metadata: {\n source: 'first-party-adapter',\n supportTier: 'firstPartyExecutable',\n executable: true,\n oauthPkce: oauthAuth\n ? resolveOAuthPkceMode(oauthAuth.pkce, manifest.kind)\n : undefined,\n authOptions: manifest.auth.kind === 'one_of' ? manifest.auth.options.map((auth) => auth.kind) : [manifest.auth.kind],\n preferredAuth: manifest.auth.kind === 'one_of' ? manifest.auth.preferred : manifest.auth.kind,\n },\n }\n}\n\nfunction readResultToAction(request: IntegrationActionRequest, result: CapabilityReadResult): IntegrationActionResult {\n return {\n ok: true,\n action: request.action,\n output: result.data,\n metadata: {\n etag: result.etag,\n fetchedAt: result.fetchedAt,\n },\n }\n}\n\nfunction mutationResultToAction(request: IntegrationActionRequest, result: CapabilityMutationResult): IntegrationActionResult {\n if (result.status === 'committed') {\n return {\n ok: true,\n action: request.action,\n output: result.data,\n metadata: {\n etagAfter: result.etagAfter,\n committedAt: result.committedAt,\n idempotentReplay: result.idempotentReplay,\n },\n }\n }\n if (result.status === 'conflict') {\n return {\n ok: false,\n action: request.action,\n output: {\n conflict: true,\n message: result.message,\n alternatives: result.alternatives,\n currentState: result.currentState,\n },\n }\n }\n return {\n ok: false,\n action: request.action,\n output: {\n rateLimited: true,\n retryAfterMs: result.retryAfterMs,\n message: result.message,\n },\n }\n}\n\nfunction mapAuth(kind: ConnectorAdapter['manifest']['auth']['kind']): IntegrationConnector['auth'] {\n if (kind === 'one_of') return 'custom'\n if (kind === 'oauth2') return 'oauth2'\n if (kind === 'api-key') return 'api_key'\n if (kind === 'none') return 'none'\n return 'custom'\n}\n\nfunction primaryManifestAuth(auth: ConnectorAdapter['manifest']['auth']): Exclude<ConnectorAdapter['manifest']['auth'], { kind: 'one_of' }> {\n if (auth.kind !== 'one_of') return auth\n return auth.options.find((option) => option.kind === auth.preferred) ?? auth.options[0]\n}\n\nfunction oauthManifestAuth(auth: ConnectorAdapter['manifest']['auth']): Extract<Exclude<ConnectorAdapter['manifest']['auth'], { kind: 'one_of' }>, { kind: 'oauth2' }> | undefined {\n if (auth.kind === 'oauth2') return auth\n if (auth.kind !== 'one_of') return undefined\n return auth.options.find((option): option is Extract<typeof option, { kind: 'oauth2' }> => option.kind === 'oauth2')\n}\n\n/** Resolve the manifest value at the last possible point before an OAuth\n * request. The runtime check matters because adapters can enter through JS or\n * an `any` cast without first passing the static manifest validator. */\nfunction resolveTokenClientAuthMethod(\n value: unknown,\n connectorId: string,\n): OAuth2TokenClientAuthMethod {\n if (value === undefined || value === 'client_secret_post') {\n return 'client_secret_post'\n }\n if (value === 'none' || value === 'client_secret_basic') return value\n throw new IntegrationError(\n `Connector ${connectorId} has an unsupported OAuth token client authentication method.`,\n 'config_missing',\n )\n}\n\nfunction resolveOAuthPkceMode(\n value: unknown,\n connectorId: string,\n): 'required' | 'supported' | 'unsupported' {\n if (value === undefined || value === 'required') return 'required'\n if (value === 'supported' || value === 'unsupported') return value\n throw new IntegrationError(\n `Connector ${connectorId} has an invalid OAuth PKCE posture.`,\n 'config_missing',\n )\n}\n\nfunction requirePkceChallenge(value: string | undefined, connectorId: string): string {\n if (!value || !/^[A-Za-z0-9_-]{43}$/.test(value)) {\n throw new IntegrationError(\n `OAuth PKCE S256 challenge missing or invalid for ${connectorId}.`,\n 'config_missing',\n )\n }\n return value\n}\n\nfunction requirePkceVerifier(value: string | undefined, connectorId: string): string {\n if (!value || !/^[A-Za-z0-9._~-]{43,128}$/.test(value)) {\n throw new IntegrationError(\n `OAuth PKCE verifier missing or invalid for ${connectorId}.`,\n 'config_missing',\n )\n }\n return value\n}\n\nfunction resolveOAuthParameterName(\n value: string | undefined,\n fallback: string,\n connectorId: string,\n): string {\n const name = value ?? fallback\n if (!/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(name)) {\n throw new IntegrationError(\n `Connector ${connectorId} declares an invalid OAuth parameter name.`,\n 'config_missing',\n )\n }\n return name\n}\n\n/** Encodes UTF-8 credentials without importing Node's Buffer, so the adapter\n * provider remains usable in browser and edge runtimes. */\nfunction base64Encode(value: string): string {\n const btoa = globalThis.btoa\n if (typeof btoa !== 'function') {\n throw new IntegrationError(\n 'OAuth client_secret_basic requires a base64 encoder in this runtime.',\n 'config_missing',\n )\n }\n const bytes = new TextEncoder().encode(value)\n let binary = ''\n for (const byte of bytes) binary += String.fromCharCode(byte)\n return btoa(binary)\n}\n\n/** Resolve provider-owned tenant labels embedded in OAuth URLs.\n *\n * Shopify and Gorgias put the merchant name in the hostname. Only one DNS\n * label is accepted for each placeholder, so connection metadata cannot turn\n * a provider URL into an arbitrary credential destination.\n */\nfunction resolveOAuthUrlTemplate(\n template: string,\n metadata: Record<string, unknown> | undefined,\n connectorId: string,\n metadataSpecs?: Readonly<Record<string, OAuth2UrlTemplateMetadataSpec>>,\n): string {\n const placeholders = [...template.matchAll(/\\{([A-Za-z][A-Za-z0-9_]*)\\}/g)]\n let resolved = template\n for (const match of placeholders) {\n const key = match[1]\n const raw = metadata?.[key]\n const metadataSpec = metadataSpecs?.[key]\n if (metadataSpec?.kind === 'base-url') {\n if (typeof raw !== 'string') {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${key} as a provider base URL.`,\n 'config_missing',\n )\n }\n resolved = resolved.replaceAll(\n match[0],\n resolveOAuthMetadataBaseUrl(raw, metadataSpec, connectorId, key),\n )\n continue\n }\n if (metadataSpec?.kind === 'path-segment') {\n if (!isOAuthPathSegmentPlaceholder(template, match.index ?? -1, match[0])) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} declares metadata.${key} outside a complete path segment.`,\n 'config_missing',\n )\n }\n if (typeof raw !== 'string' || !isOAuthPathSegment(raw.trim())) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${key} as a valid path segment.`,\n 'config_missing',\n )\n }\n resolved = resolved.replaceAll(match[0], encodeURIComponent(raw.trim()))\n continue\n }\n if (typeof raw !== 'string' || !isDnsLabel(raw.trim())) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${key} as a valid tenant label.`,\n 'config_missing',\n )\n }\n resolved = resolved.replaceAll(match[0], raw.trim().toLowerCase())\n }\n\n let url: URL\n try {\n url = new URL(resolved)\n } catch {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} is invalid.`,\n 'config_missing',\n )\n }\n if (url.protocol !== 'https:' || url.username || url.password) {\n throw new IntegrationError(\n `OAuth URL for ${connectorId} must be HTTPS without embedded credentials.`,\n 'config_missing',\n )\n }\n return url.toString()\n}\n\nfunction isOAuthPathSegment(value: string): boolean {\n return (\n value !== '.' &&\n value !== '..' &&\n /^[A-Za-z0-9._~-]{1,128}$/.test(value)\n )\n}\n\nfunction isOAuthPathSegmentPlaceholder(\n template: string,\n index: number,\n placeholder: string,\n): boolean {\n if (index < 0) return false\n const schemeIndex = template.indexOf('://')\n const rootEnd = schemeIndex >= 0\n ? schemeIndex + 3\n : template.startsWith('{')\n ? template.indexOf('}') + 1\n : 0\n const pathStart = template.indexOf('/', rootEnd)\n const end = index + placeholder.length\n const queryStart = template.search(/[?#]/)\n return (\n pathStart >= 0 &&\n index >= pathStart &&\n (queryStart < 0 || index < queryStart) &&\n template[index - 1] === '/' &&\n (end === template.length || template[end] === '/' || template[end] === '?' || template[end] === '#')\n )\n}\n\nfunction resolveOAuthMetadataBaseUrl(\n value: string,\n spec: Extract<OAuth2UrlTemplateMetadataSpec, { kind: 'base-url' }>,\n connectorId: string,\n metadataKey: string,\n): string {\n let url: URL\n try {\n url = new URL(value.trim())\n } catch {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n url.pathname !== '/' ||\n url.search ||\n url.hash\n ) {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n const exactAllowed = spec.allowedBaseUrls?.some((candidate) => sameOrigin(candidate, url)) ?? false\n const suffixAllowed = spec.allowedBaseUrlSuffixes?.some((suffix) =>\n !url.port &&\n suffix.startsWith('.') &&\n url.hostname.toLowerCase().endsWith(suffix.toLowerCase())\n ) ?? false\n const hasExplicitAllowlist = Boolean(\n spec.allowedBaseUrls?.length || spec.allowedBaseUrlSuffixes?.length,\n )\n if (hasExplicitAllowlist && !exactAllowed && !suffixAllowed) {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n if (spec.requirePublicHttps && !isPublicDnsHostname(url.hostname)) {\n throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey)\n }\n return url.origin\n}\n\nfunction invalidOAuthMetadataBaseUrl(connectorId: string, metadataKey: string): IntegrationError {\n return new IntegrationError(\n `OAuth URL for ${connectorId} requires metadata.${metadataKey} as an allowed HTTPS provider root.`,\n 'config_missing',\n )\n}\n\nfunction sameOrigin(candidate: string, actual: URL): boolean {\n try {\n const allowed = new URL(candidate)\n return (\n allowed.protocol === 'https:' &&\n !allowed.username &&\n !allowed.password &&\n allowed.pathname === '/' &&\n !allowed.search &&\n !allowed.hash &&\n allowed.origin === actual.origin\n )\n } catch {\n return false\n }\n}\n\nfunction isPublicDnsHostname(hostname: string): boolean {\n const normalized = hostname.toLowerCase().replace(/^\\[|\\]$/g, '')\n if (\n normalized === 'localhost' ||\n normalized.endsWith('.localhost') ||\n normalized.endsWith('.local') ||\n normalized.endsWith('.internal') ||\n normalized.endsWith('.home.arpa')\n ) {\n return false\n }\n // OAuth redirects to self-hosted instances require a DNS name. Reject\n // literal IP addresses because fetch cannot pin DNS against rebinding.\n if (/^[0-9.]+$/.test(normalized) || normalized.includes(':')) return false\n return normalized.includes('.') && normalized.split('.').every(isDnsLabel)\n}\n\nfunction isDnsLabel(value: string): boolean {\n return value.length > 0 && value.length <= 63 && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(value)\n}\n\n/** Project the declared `auth.tokenMetadata` mappings out of an OAuth\n * token-response body into connection metadata. Each entry maps a\n * connection-metadata key → the token-response field to read (string\n * shorthand) or `{ field, required }`. Required fields that are absent/empty\n * throw `provider_failure` so the break surfaces at connect; non-required\n * fields are captured if present and otherwise skipped. */\nfunction captureTokenMetadata(\n tokenMetadata: Record<string, TokenMetadataSource> | undefined,\n json: Record<string, unknown>,\n connectorId: string,\n): Record<string, string> {\n if (!tokenMetadata) return {}\n const captured: Record<string, string> = {}\n for (const [metaKey, source] of Object.entries(tokenMetadata)) {\n const field = typeof source === 'string' ? source : source.field\n const required = typeof source === 'string' ? false : source.required === true\n const raw = json[field]\n // Trim string values so capture-side emptiness matches the consumer's\n // emptiness check (e.g. resolveBaseUrl's `.trim()` guard). A whitespace-only\n // value must fail loud here at connect for a required field, not defer the\n // break to first call where the host already looks active.\n const value = typeof raw === 'string' ? raw.trim() : raw\n if (value === undefined || value === null || value === '') {\n if (required) {\n throw new IntegrationError(\n `OAuth token exchange for ${connectorId} did not return required field \"${field}\" for metadata.${metaKey}.`,\n 'provider_failure',\n )\n }\n continue\n }\n captured[metaKey] = String(value)\n }\n return captured\n}\n\nfunction mapCategory(category: ConnectorAdapter['manifest']['category']): IntegrationConnector['category'] {\n if (category === 'comms') return 'chat'\n if (category === 'spreadsheet') return 'database'\n if (category === 'doc') return 'docs'\n if (category === 'commerce') return 'workflow'\n // The manifest taxonomy is richer than the hub-facade taxonomy. Sales/market\n // intelligence and HR/payroll connectors collapse to the nearest hub bucket:\n // contact/company intelligence reads like CRM; the rest have no closer fit.\n if (category === 'sales-intelligence') return 'crm'\n if (category === 'market-intelligence' || category === 'hr') return 'other'\n return category === 'other' ? 'other' : category\n}\n\nfunction inferDataClass(category: ConnectorAdapter['manifest']['category']): 'public' | 'internal' | 'private' | 'sensitive' {\n if (category === 'commerce') return 'sensitive'\n if (category === 'webhook') return 'internal'\n return 'private'\n}\n\nfunction titleFromName(name: string): string {\n return name\n .split(/[._-]/g)\n .filter(Boolean)\n .map((part) => part.slice(0, 1).toUpperCase() + part.slice(1))\n .join(' ')\n}\n\nfunction toRecord(input: unknown): Record<string, unknown> {\n if (input && typeof input === 'object' && !Array.isArray(input)) return input as Record<string, unknown>\n return {}\n}\n\nfunction randomState(): string {\n // 192 bits of entropy — comfortable CSRF margin and stays URL-safe.\n const bytes = new Uint8Array(24)\n globalThis.crypto.getRandomValues(bytes)\n return base64UrlEncode(bytes)\n}\n\nfunction randomConnectionId(): string {\n if (typeof globalThis.crypto?.randomUUID === 'function') {\n return `conn_${globalThis.crypto.randomUUID().replace(/-/g, '')}`\n }\n const bytes = new Uint8Array(16)\n globalThis.crypto.getRandomValues(bytes)\n return `conn_${base64UrlEncode(bytes)}`\n}\n\nfunction base64UrlEncode(bytes: Uint8Array): string {\n let bin = ''\n for (const b of bytes) bin += String.fromCharCode(b)\n // btoa is defined in browsers, workers, and Node ≥ 16.\n const b64 = typeof btoa === 'function' ? btoa(bin) : Buffer.from(bin, 'binary').toString('base64')\n return b64.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '')\n}\n","import { createConnectorAdapterProvider, type ConnectorAdapterProviderOptions } from './adapter-provider.js'\nimport type {\n ConnectorAdapter,\n ConnectorCredentials,\n ResolvedDataSource,\n} from './connectors/types.js'\nimport type {\n IntegrationConnection,\n IntegrationConnectionStore,\n IntegrationCredentialsRotatedEvent,\n IntegrationOAuthState,\n IntegrationOAuthStateOutcome,\n IntegrationOAuthStateStore,\n IntegrationProvider,\n IntegrationSecretStore,\n SecretRef,\n} from './core-types.js'\n\nexport type {\n IntegrationOAuthState,\n IntegrationOAuthStateOutcome,\n IntegrationOAuthStateStore,\n IntegrationSecretStore,\n}\n\nexport interface ConnectionCredentialResolverOptions {\n secrets: IntegrationSecretStore\n connections?: IntegrationConnectionStore\n adapters?: ConnectorAdapter[]\n now?: () => Date\n markConnectionError?: (connection: IntegrationConnection, error: Error) => Promise<void> | void\n}\n\ninterface CredentialRefreshFlight {\n promise: Promise<ConnectorCredentials>\n cancelled: boolean\n settled: boolean\n waiters: number\n}\n\ninterface CredentialPersistenceLease {\n cancelled: boolean\n}\n\nclass CredentialRefreshRevokedError extends Error {\n constructor() {\n super('Connection was revoked during credential refresh.')\n this.name = 'CredentialRefreshRevokedError'\n }\n}\n\nconst credentialRefreshes = new WeakMap<\n IntegrationSecretStore,\n Map<string, CredentialRefreshFlight>\n>()\nconst credentialPersistences = new WeakMap<\n IntegrationSecretStore,\n Map<string, Set<CredentialPersistenceLease>>\n>()\nconst credentialRevocations = new WeakMap<IntegrationSecretStore, Map<string, number>>()\n\nexport class InMemoryIntegrationSecretStore implements IntegrationSecretStore {\n private readonly secrets = new Map<string, ConnectorCredentials>()\n\n get(ref: SecretRef): ConnectorCredentials | undefined {\n return this.secrets.get(secretKey(ref))\n }\n\n put(ref: SecretRef, credentials: ConnectorCredentials): void {\n this.secrets.set(secretKey(ref), credentials)\n }\n\n delete(ref: SecretRef): void {\n this.secrets.delete(secretKey(ref))\n }\n}\n\n/** Test/dev double for {@link IntegrationOAuthStateStore}. Production hubs\n * inject a durable implementation; this one keeps records in a Map and\n * enforces the single-use + expiry contract. */\nexport class InMemoryIntegrationOAuthStateStore implements IntegrationOAuthStateStore {\n private readonly states = new Map<string, IntegrationOAuthState>()\n\n put(state: IntegrationOAuthState): void {\n this.states.set(state.state, state)\n }\n\n consume(state: string): IntegrationOAuthStateOutcome {\n const record = this.states.get(state)\n this.states.delete(state)\n if (!record) return { ok: false, reason: 'unknown' }\n if (record.expiresAt <= Date.now()) return { ok: false, reason: 'expired' }\n return { ok: true, state: record }\n }\n\n sweep(now: number): void {\n for (const [key, record] of this.states) {\n if (record.expiresAt <= now) this.states.delete(key)\n }\n }\n}\n\nexport function createConnectionCredentialResolver(options: ConnectionCredentialResolverOptions) {\n const now = options.now ?? (() => new Date())\n return async function resolveDataSource(connection: IntegrationConnection): Promise<ResolvedDataSource> {\n const credentials = await resolveConnectionCredentials(connection, {\n secrets: options.secrets,\n connections: options.connections,\n adapters: options.adapters,\n now,\n markConnectionError: options.markConnectionError,\n })\n return {\n id: connection.id,\n projectId: String(connection.metadata?.projectId ?? connection.owner.id),\n publishedAgentId: typeof connection.metadata?.publishedAgentId === 'string' ? connection.metadata.publishedAgentId : null,\n kind: connection.connectorId,\n label: connection.account?.displayName ?? connection.account?.email ?? connection.connectorId,\n consistencyModel: typeof connection.metadata?.consistencyModel === 'string' ? connection.metadata.consistencyModel as never : 'authoritative',\n scopes: connection.grantedScopes,\n metadata: connection.metadata ?? {},\n credentials,\n status: connection.status === 'active' ? 'active' : connection.status === 'revoked' ? 'revoked' : 'error',\n }\n }\n}\n\nexport async function resolveConnectionCredentials(input: IntegrationConnection, options: ConnectionCredentialResolverOptions): Promise<ConnectorCredentials> {\n if (input.status !== 'active') throw new Error(`Connection ${input.id} is ${input.status}.`)\n if (!input.secretRef) return { kind: 'none' }\n const now = options.now ?? (() => new Date())\n const current = await options.secrets.get(input.secretRef)\n if (!current) throw new Error(`Secret ${input.secretRef.provider}/${input.secretRef.id} not found.`)\n if (!isExpiredOauth(current, now)) return current\n\n const adapter = options.adapters?.find((candidate) => candidate.manifest.kind === input.connectorId)\n if (!adapter?.refreshToken) return current\n let refresh: CredentialRefreshFlight | undefined\n try {\n await assertCredentialRefreshActive(input, options, now)\n refresh = acquireCredentialRefresh({\n connectorId: input.connectorId,\n secretRef: input.secretRef,\n secrets: options.secrets,\n now,\n refreshToken: adapter.refreshToken.bind(adapter),\n })\n const refreshed = await refresh.promise\n await assertCredentialRefreshActive(input, options, now, refresh)\n if (options.connections) {\n await options.connections.put({\n ...input,\n status: 'active',\n updatedAt: now().toISOString(),\n expiresAt: refreshed.kind === 'oauth2' && refreshed.expiresAt ? new Date(refreshed.expiresAt).toISOString() : input.expiresAt,\n })\n await assertCredentialRefreshActive(input, options, now, refresh)\n }\n return refreshed\n } catch (error) {\n const err = error instanceof Error ? error : new Error('Credential refresh failed.')\n if (err instanceof CredentialRefreshRevokedError) throw err\n await options.markConnectionError?.(input, err)\n if (options.connections) {\n await options.connections.put({\n ...input,\n status: 'expired',\n updatedAt: now().toISOString(),\n })\n }\n throw err\n } finally {\n if (refresh) {\n releaseCredentialRefresh(\n options.secrets,\n input.connectorId,\n input.secretRef,\n refresh,\n )\n }\n }\n}\n\nfunction acquireCredentialRefresh(input: {\n connectorId: string\n secretRef: SecretRef\n secrets: IntegrationSecretStore\n now: () => Date\n refreshToken: (credentials: ConnectorCredentials) => Promise<ConnectorCredentials>\n}): CredentialRefreshFlight {\n let refreshes = credentialRefreshes.get(input.secrets)\n if (!refreshes) {\n refreshes = new Map()\n credentialRefreshes.set(input.secrets, refreshes)\n }\n const key = credentialRefreshKey(input.connectorId, input.secretRef)\n if (credentialRevocations.get(input.secrets)?.has(key)) {\n throw new CredentialRefreshRevokedError()\n }\n const existing = refreshes.get(key)\n if (existing) {\n existing.waiters += 1\n return existing\n }\n\n let flight: CredentialRefreshFlight\n const promise = Promise.resolve().then(async () => {\n // A prior refresh can settle between the caller's first read and this\n // flight. Re-read before redeeming a provider's rotating refresh token.\n const latest = await input.secrets.get(input.secretRef)\n if (!latest) {\n throw new Error(\n `Secret ${input.secretRef.provider}/${input.secretRef.id} not found.`,\n )\n }\n if (!isExpiredOauth(latest, input.now)) return latest\n const refreshed = await input.refreshToken(latest)\n if (flight.cancelled) throw new CredentialRefreshRevokedError()\n await input.secrets.put(input.secretRef, refreshed)\n if (flight.cancelled) {\n await input.secrets.delete?.(input.secretRef)\n throw new CredentialRefreshRevokedError()\n }\n return refreshed\n })\n flight = {\n promise,\n cancelled: false,\n settled: false,\n waiters: 1,\n }\n refreshes.set(key, flight)\n\n const settle = () => {\n flight.settled = true\n clearCredentialRefresh(input.secrets, key, flight)\n }\n // Observe rejection immediately. Every caller still receives the original\n // rejected promise and applies its connection-specific error transition.\n void promise.then(settle, settle)\n return flight\n}\n\nfunction releaseCredentialRefresh(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n flight: CredentialRefreshFlight,\n): void {\n flight.waiters -= 1\n clearCredentialRefresh(\n secrets,\n credentialRefreshKey(connectorId, secretRef),\n flight,\n )\n}\n\nfunction clearCredentialRefresh(\n secrets: IntegrationSecretStore,\n key: string,\n flight: CredentialRefreshFlight,\n): void {\n if (!flight.settled || flight.waiters !== 0) return\n const refreshes = credentialRefreshes.get(secrets)\n if (refreshes?.get(key) !== flight) return\n refreshes.delete(key)\n if (refreshes.size === 0) credentialRefreshes.delete(secrets)\n}\n\nasync function assertCredentialRefreshActive(\n input: IntegrationConnection,\n options: ConnectionCredentialResolverOptions,\n now: () => Date,\n operation?: CredentialPersistenceLease,\n): Promise<void> {\n const key = input.secretRef\n ? credentialRefreshKey(input.connectorId, input.secretRef)\n : undefined\n let revoked = operation?.cancelled === true\n || (key !== undefined\n && credentialRevocations.get(options.secrets)?.has(key) === true)\n let stored: IntegrationConnection | undefined\n if (options.connections) {\n stored = await options.connections.get(input.id)\n revoked ||= stored?.status === 'revoked'\n }\n if (!revoked && input.secretRef) {\n revoked = await options.secrets.get(input.secretRef) === undefined\n }\n if (!revoked) return\n\n if (operation) operation.cancelled = true\n if (input.secretRef) await options.secrets.delete?.(input.secretRef)\n if (options.connections && stored?.status !== 'revoked') {\n await options.connections.put({\n ...(stored ?? input),\n status: 'revoked',\n updatedAt: now().toISOString(),\n })\n }\n throw new CredentialRefreshRevokedError()\n}\n\nexport type CredentialBackedAdapterProviderOptions =\n Omit<ConnectorAdapterProviderOptions, 'resolveDataSource' | 'onCredentialsRotated'>\n & ConnectionCredentialResolverOptions\n & {\n /** Fired after the provider re-persists rotated credentials to the\n * secret + connection stores. Receives the hub-shaped event including\n * the resolved secretRef so the host can drive external re-encryption\n * or telemetry. */\n onCredentialsRotated?: (event: IntegrationCredentialsRotatedEvent) => Promise<void> | void\n }\n\nexport function createCredentialBackedAdapterProvider(options: CredentialBackedAdapterProviderOptions): IntegrationProvider {\n const now = options.now ?? (() => new Date())\n return createConnectorAdapterProvider({\n ...options,\n resolveDataSource: createConnectionCredentialResolver(options),\n onCredentialsRotated: async ({ connection, credentials }) => {\n const persistence = connection.secretRef\n ? acquireCredentialPersistence(\n options.secrets,\n connection.connectorId,\n connection.secretRef,\n )\n : undefined\n try {\n await assertCredentialRefreshActive(connection, options, now, persistence)\n if (connection.secretRef) {\n await options.secrets.put(connection.secretRef, credentials)\n }\n await assertCredentialRefreshActive(connection, options, now, persistence)\n if (options.connections) {\n await options.connections.put({\n ...connection,\n status: 'active',\n updatedAt: now().toISOString(),\n expiresAt: credentials.kind === 'oauth2' && credentials.expiresAt\n ? new Date(credentials.expiresAt).toISOString()\n : connection.expiresAt,\n })\n await assertCredentialRefreshActive(connection, options, now, persistence)\n }\n await options.onCredentialsRotated?.({ connection, secretRef: connection.secretRef, credentials })\n await assertCredentialRefreshActive(connection, options, now, persistence)\n } finally {\n if (persistence && connection.secretRef) {\n releaseCredentialPersistence(\n options.secrets,\n connection.connectorId,\n connection.secretRef,\n persistence,\n )\n }\n }\n },\n })\n}\n\nfunction acquireCredentialPersistence(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n): CredentialPersistenceLease {\n let persistences = credentialPersistences.get(secrets)\n if (!persistences) {\n persistences = new Map()\n credentialPersistences.set(secrets, persistences)\n }\n const key = credentialRefreshKey(connectorId, secretRef)\n let leases = persistences.get(key)\n if (!leases) {\n leases = new Set()\n persistences.set(key, leases)\n }\n const lease = {\n cancelled: credentialRevocations.get(secrets)?.has(key) === true,\n }\n leases.add(lease)\n return lease\n}\n\nfunction releaseCredentialPersistence(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n lease: CredentialPersistenceLease,\n): void {\n const persistences = credentialPersistences.get(secrets)\n if (!persistences) return\n const key = credentialRefreshKey(connectorId, secretRef)\n const leases = persistences.get(key)\n leases?.delete(lease)\n if (leases?.size === 0) persistences.delete(key)\n if (persistences.size === 0) credentialPersistences.delete(secrets)\n}\n\nexport async function revokeConnection(input: {\n connection: IntegrationConnection\n connections?: IntegrationConnectionStore\n secrets?: IntegrationSecretStore\n now?: () => Date\n}): Promise<IntegrationConnection> {\n const finishRevocation = input.connection.secretRef && input.secrets\n ? beginCredentialRevocation(\n input.secrets,\n input.connection.connectorId,\n input.connection.secretRef,\n )\n : undefined\n try {\n if (input.connection.secretRef) await input.secrets?.delete?.(input.connection.secretRef)\n const revoked: IntegrationConnection = {\n ...input.connection,\n status: 'revoked',\n updatedAt: (input.now?.() ?? new Date()).toISOString(),\n }\n await input.connections?.put(revoked)\n return revoked\n } finally {\n finishRevocation?.()\n }\n}\n\nfunction beginCredentialRevocation(\n secrets: IntegrationSecretStore,\n connectorId: string,\n secretRef: SecretRef,\n): () => void {\n const key = credentialRefreshKey(connectorId, secretRef)\n let revocations = credentialRevocations.get(secrets)\n if (!revocations) {\n revocations = new Map()\n credentialRevocations.set(secrets, revocations)\n }\n revocations.set(key, (revocations.get(key) ?? 0) + 1)\n const flight = credentialRefreshes.get(secrets)?.get(key)\n if (flight) flight.cancelled = true\n for (const persistence of credentialPersistences.get(secrets)?.get(key) ?? []) {\n persistence.cancelled = true\n }\n\n return () => {\n const remaining = (revocations?.get(key) ?? 1) - 1\n if (remaining > 0) revocations?.set(key, remaining)\n else revocations?.delete(key)\n if (revocations?.size === 0) credentialRevocations.delete(secrets)\n }\n}\n\nfunction isExpiredOauth(credentials: ConnectorCredentials, now: () => Date): boolean {\n return credentials.kind === 'oauth2'\n && typeof credentials.expiresAt === 'number'\n && credentials.expiresAt <= now().getTime()\n && Boolean(credentials.refreshToken)\n}\n\nfunction secretKey(ref: SecretRef): string {\n return `${ref.provider}:${ref.id}`\n}\n\nfunction credentialRefreshKey(connectorId: string, ref: SecretRef): string {\n return JSON.stringify([connectorId, ref.provider, ref.id])\n}\n","import { createHash } from 'node:crypto'\nimport type {\n IntegrationActor,\n IntegrationApprovalRequest,\n IntegrationGuardContext,\n IntegrationPolicyDecision,\n IntegrationPolicyEngine,\n} from './index.js'\nimport type { IntegrationAuditSink } from './audit.js'\nimport { createIntegrationAuditEvent } from './audit.js'\n\nexport type IntegrationApprovalStatus = 'pending' | 'approved' | 'denied' | 'expired'\n\nexport interface IntegrationApprovalRecord {\n id: string\n request: IntegrationApprovalRequest\n status: IntegrationApprovalStatus\n requestedAt: string\n resolvedAt?: string\n resolvedBy?: IntegrationActor\n reason?: string\n expiresAt?: string\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationApprovalStore {\n get(approvalId: string): Promise<IntegrationApprovalRecord | undefined> | IntegrationApprovalRecord | undefined\n put(record: IntegrationApprovalRecord): Promise<void> | void\n list(filter?: IntegrationApprovalFilter): Promise<IntegrationApprovalRecord[]> | IntegrationApprovalRecord[]\n}\n\nexport interface IntegrationApprovalFilter {\n status?: IntegrationApprovalStatus\n connectionId?: string\n connectorId?: string\n action?: string\n actor?: IntegrationActor\n}\n\nexport interface ApprovalBackedPolicyOptions {\n base: IntegrationPolicyEngine\n store: IntegrationApprovalStore\n audit?: IntegrationAuditSink\n now?: () => Date\n approvalTtlMs?: number\n}\n\nexport class InMemoryIntegrationApprovalStore implements IntegrationApprovalStore {\n private readonly records = new Map<string, IntegrationApprovalRecord>()\n\n get(approvalId: string): IntegrationApprovalRecord | undefined {\n return this.records.get(approvalId)\n }\n\n put(record: IntegrationApprovalRecord): void {\n this.records.set(record.id, record)\n }\n\n list(filter: IntegrationApprovalFilter = {}): IntegrationApprovalRecord[] {\n return [...this.records.values()].filter((record) => matchesFilter(record, filter))\n }\n}\n\nexport class ApprovalBackedPolicyEngine implements IntegrationPolicyEngine {\n private readonly base: IntegrationPolicyEngine\n private readonly store: IntegrationApprovalStore\n private readonly audit: IntegrationAuditSink | undefined\n private readonly now: () => Date\n private readonly approvalTtlMs: number | undefined\n\n constructor(options: ApprovalBackedPolicyOptions) {\n this.base = options.base\n this.store = options.store\n this.audit = options.audit\n this.now = options.now ?? (() => new Date())\n this.approvalTtlMs = options.approvalTtlMs\n }\n\n async decide(ctx: IntegrationGuardContext & { subject: IntegrationActor }): Promise<IntegrationPolicyDecision> {\n const approved = await this.findApprovedRecord(ctx)\n if (approved) return { decision: 'allow', reason: `Approved by ${approved.resolvedBy?.type ?? 'actor'} ${approved.resolvedBy?.id ?? 'unknown'}.`, metadata: { approvalId: approved.id } }\n\n const decision = await this.base.decide(ctx)\n if (decision.decision !== 'require_approval') return decision\n\n const requestedAt = decision.approval.requestedAt\n const expiresAt = this.approvalTtlMs ? new Date(Date.parse(requestedAt) + this.approvalTtlMs).toISOString() : undefined\n const record: IntegrationApprovalRecord = {\n id: decision.approval.id,\n request: decision.approval,\n status: 'pending',\n requestedAt,\n expiresAt,\n metadata: { ...(decision.metadata ?? {}), inputHash: approvalInputHash(ctx.request.input) },\n }\n await this.store.put(record)\n await this.audit?.record(createIntegrationAuditEvent({\n type: 'approval.requested',\n actor: ctx.subject,\n connectionId: ctx.connection.id,\n providerId: ctx.connection.providerId,\n connectorId: ctx.connection.connectorId,\n action: ctx.request.action,\n risk: ctx.action?.risk,\n dataClass: ctx.action?.dataClass,\n message: decision.reason,\n metadata: { approvalId: record.id },\n now: this.now,\n }))\n return decision\n }\n\n private async findApprovedRecord(ctx: IntegrationGuardContext & { subject: IntegrationActor }): Promise<IntegrationApprovalRecord | undefined> {\n const approvalId = typeof ctx.request.metadata?.approvalId === 'string' ? ctx.request.metadata.approvalId : undefined\n if (!approvalId) return undefined\n const record = await this.store.get(approvalId)\n if (!record || record.status !== 'approved') return undefined\n if (record.expiresAt && Date.parse(record.expiresAt) <= this.now().getTime()) {\n await this.store.put({ ...record, status: 'expired' })\n return undefined\n }\n if (!approvalMatches(record, ctx)) return undefined\n return record\n }\n}\n\nexport function createApprovalBackedPolicyEngine(options: ApprovalBackedPolicyOptions): ApprovalBackedPolicyEngine {\n return new ApprovalBackedPolicyEngine(options)\n}\n\nexport async function resolveIntegrationApproval(input: {\n store: IntegrationApprovalStore\n approvalId: string\n approved: boolean\n resolvedBy: IntegrationActor\n reason?: string\n metadata?: Record<string, unknown>\n audit?: IntegrationAuditSink\n now?: () => Date\n}): Promise<IntegrationApprovalRecord> {\n const record = await input.store.get(input.approvalId)\n if (!record) throw new Error(`Approval ${input.approvalId} not found.`)\n const now = input.now ?? (() => new Date())\n const next: IntegrationApprovalRecord = {\n ...record,\n status: input.approved ? 'approved' : 'denied',\n resolvedAt: now().toISOString(),\n resolvedBy: input.resolvedBy,\n reason: input.reason,\n metadata: { ...(record.metadata ?? {}), ...(input.metadata ?? {}) },\n }\n await input.store.put(next)\n await input.audit?.record(createIntegrationAuditEvent({\n type: 'approval.resolved',\n actor: input.resolvedBy,\n connectionId: record.request.connectionId,\n providerId: record.request.providerId,\n connectorId: record.request.connectorId,\n action: record.request.action,\n risk: record.request.risk,\n dataClass: record.request.dataClass,\n ok: input.approved,\n message: input.reason,\n metadata: { approvalId: record.id, status: next.status },\n now,\n }))\n return next\n}\n\nfunction approvalMatches(record: IntegrationApprovalRecord, ctx: IntegrationGuardContext & { subject: IntegrationActor }): boolean {\n return record.request.connectionId === ctx.connection.id\n && record.request.providerId === ctx.connection.providerId\n && record.request.connectorId === ctx.connection.connectorId\n && record.request.action === ctx.request.action\n && record.request.actor.type === ctx.subject.type\n && record.request.actor.id === ctx.subject.id\n && record.metadata?.inputHash === approvalInputHash(ctx.request.input)\n}\n\nfunction matchesFilter(record: IntegrationApprovalRecord, filter: IntegrationApprovalFilter): boolean {\n if (filter.status && record.status !== filter.status) return false\n if (filter.connectionId && record.request.connectionId !== filter.connectionId) return false\n if (filter.connectorId && record.request.connectorId !== filter.connectorId) return false\n if (filter.action && record.request.action !== filter.action) return false\n if (filter.actor && (record.request.actor.type !== filter.actor.type || record.request.actor.id !== filter.actor.id)) return false\n return true\n}\n\nfunction approvalInputHash(input: unknown): string {\n return createHash('sha256').update(JSON.stringify(input ?? null)).digest('base64url')\n}\n","import type {\n IntegrationConnector,\n IntegrationConnectorAction,\n IntegrationConnectorTrigger,\n} from './index.js'\n\nexport const CANONICAL_INTEGRATION_ACTIONS = {\n googleCalendarEventsList: 'google-calendar.events.list',\n googleCalendarEventsCreate: 'google-calendar.events.create',\n gmailMessagesSearch: 'gmail.messages.search',\n gmailMessagesSend: 'gmail.messages.send',\n googleDriveFilesSearch: 'google-drive.files.search',\n googleDriveFilesRead: 'google-drive.files.read',\n githubRepositoriesGet: 'github.repositories.get',\n githubIssuesSearch: 'github.issues.search',\n githubIssuesCreate: 'github.issues.create',\n githubPullRequestsComment: 'github.pull-requests.comment',\n slackChannelsList: 'slack.channels.list',\n slackMessagesSearch: 'slack.messages.search',\n slackMessagesPost: 'slack.messages.post',\n providerHttpRequest: 'provider.http.request',\n} as const\n\nexport type CanonicalIntegrationActionId =\n typeof CANONICAL_INTEGRATION_ACTIONS[keyof typeof CANONICAL_INTEGRATION_ACTIONS]\n\nexport interface CanonicalLaunchConnectorOptions {\n providerId?: string\n includeProviderPassthrough?: boolean\n}\n\nexport function buildCanonicalLaunchConnectors(options: CanonicalLaunchConnectorOptions = {}): IntegrationConnector[] {\n const providerId = options.providerId ?? 'tangle-platform'\n const connectors = [\n googleCalendarConnector(providerId),\n gmailConnector(providerId),\n googleDriveConnector(providerId),\n githubConnector(providerId),\n slackConnector(providerId),\n ]\n if (!options.includeProviderPassthrough) return connectors\n return connectors.map((connector) => ({\n ...connector,\n actions: [...connector.actions, providerPassthroughAction(connector.id)],\n }))\n}\n\nexport function canonicalActionConnectorId(actionId: string): string | undefined {\n if (actionId.startsWith('google-calendar.')) return 'google-calendar'\n if (actionId.startsWith('gmail.')) return 'gmail'\n if (actionId.startsWith('google-drive.')) return 'google-drive'\n if (actionId.startsWith('github.')) return 'github'\n if (actionId.startsWith('slack.')) return 'slack'\n if (actionId === CANONICAL_INTEGRATION_ACTIONS.providerHttpRequest) return undefined\n return actionId.split('.')[0]\n}\n\nfunction googleCalendarConnector(providerId: string): IntegrationConnector {\n return {\n id: 'google-calendar',\n providerId,\n title: 'Google Calendar',\n category: 'calendar',\n auth: 'oauth2',\n scopes: ['https://www.googleapis.com/auth/calendar.readonly', 'https://www.googleapis.com/auth/calendar.events'],\n actions: [\n {\n id: CANONICAL_INTEGRATION_ACTIONS.googleCalendarEventsList,\n title: 'List calendar events',\n risk: 'read',\n requiredScopes: ['https://www.googleapis.com/auth/calendar.readonly'],\n dataClass: 'private',\n description: 'Read events from a Google Calendar over a bounded time range.',\n inputSchema: objectSchema({\n calendarId: { type: 'string', default: 'primary' },\n timeMin: { type: 'string', description: 'RFC3339 lower bound.' },\n timeMax: { type: 'string', description: 'RFC3339 upper bound.' },\n }, ['timeMin', 'timeMax']),\n },\n {\n id: CANONICAL_INTEGRATION_ACTIONS.googleCalendarEventsCreate,\n title: 'Create calendar event',\n risk: 'write',\n requiredScopes: ['https://www.googleapis.com/auth/calendar.events'],\n dataClass: 'private',\n approvalRequired: true,\n description: 'Create an event on a Google Calendar after user approval.',\n inputSchema: objectSchema({\n calendarId: { type: 'string', default: 'primary' },\n start: { type: 'string', description: 'RFC3339 start time.' },\n end: { type: 'string', description: 'RFC3339 end time.' },\n summary: { type: 'string' },\n description: { type: 'string' },\n attendees: { type: 'array', items: { type: 'string' } },\n }, ['start', 'end', 'summary']),\n },\n ],\n metadata: { source: 'canonical-launch', supportTier: 'setupReady' },\n }\n}\n\nfunction gmailConnector(providerId: string): IntegrationConnector {\n return {\n id: 'gmail',\n providerId,\n title: 'Gmail',\n category: 'email',\n auth: 'oauth2',\n scopes: ['https://www.googleapis.com/auth/gmail.readonly', 'https://www.googleapis.com/auth/gmail.send'],\n actions: [\n {\n id: CANONICAL_INTEGRATION_ACTIONS.gmailMessagesSearch,\n title: 'Search Gmail messages',\n risk: 'read',\n requiredScopes: ['https://www.googleapis.com/auth/gmail.readonly'],\n dataClass: 'private',\n description: 'Search user Gmail messages and return bounded message metadata/snippets.',\n inputSchema: objectSchema({ query: { type: 'string' }, maxResults: { type: 'integer', minimum: 1, maximum: 50 } }, ['query']),\n },\n {\n id: CANONICAL_INTEGRATION_ACTIONS.gmailMessagesSend,\n title: 'Send Gmail message',\n risk: 'write',\n requiredScopes: ['https://www.googleapis.com/auth/gmail.send'],\n dataClass: 'private',\n approvalRequired: true,\n description: 'Send an email from the user account after approval.',\n inputSchema: objectSchema({\n to: { type: 'array', items: { type: 'string' } },\n subject: { type: 'string' },\n body: { type: 'string' },\n }, ['to', 'subject', 'body']),\n },\n ],\n triggers: [{\n id: 'gmail.messages.received',\n title: 'Gmail message received',\n requiredScopes: ['https://www.googleapis.com/auth/gmail.readonly'],\n dataClass: 'private',\n description: 'Triggered when a new matching Gmail message is received.',\n }],\n metadata: { source: 'canonical-launch', supportTier: 'setupReady' },\n }\n}\n\nfunction googleDriveConnector(providerId: string): IntegrationConnector {\n return {\n id: 'google-drive',\n providerId,\n title: 'Google Drive',\n category: 'storage',\n auth: 'oauth2',\n scopes: ['https://www.googleapis.com/auth/drive.readonly', 'https://www.googleapis.com/auth/drive.file'],\n actions: [\n {\n id: CANONICAL_INTEGRATION_ACTIONS.googleDriveFilesSearch,\n title: 'Search Drive files',\n risk: 'read',\n requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],\n dataClass: 'private',\n description: 'Search user-visible Google Drive files.',\n inputSchema: objectSchema({ query: { type: 'string' }, maxResults: { type: 'integer', minimum: 1, maximum: 50 } }, ['query']),\n },\n {\n id: CANONICAL_INTEGRATION_ACTIONS.googleDriveFilesRead,\n title: 'Read Drive file',\n risk: 'read',\n requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],\n dataClass: 'private',\n description: 'Read metadata and content for an authorized Drive file.',\n inputSchema: objectSchema({ fileId: { type: 'string' } }, ['fileId']),\n },\n ],\n metadata: { source: 'canonical-launch', supportTier: 'setupReady' },\n }\n}\n\nfunction githubConnector(providerId: string): IntegrationConnector {\n return {\n id: 'github',\n providerId,\n title: 'GitHub',\n category: 'workflow',\n auth: 'oauth2',\n scopes: ['repo', 'read:user'],\n actions: [\n readAction(CANONICAL_INTEGRATION_ACTIONS.githubRepositoriesGet, 'Read repository metadata', ['repo'], objectSchema({ owner: { type: 'string' }, repo: { type: 'string' } }, ['owner', 'repo'])),\n readAction(CANONICAL_INTEGRATION_ACTIONS.githubIssuesSearch, 'Search issues and pull requests', ['repo'], objectSchema({ query: { type: 'string' }, limit: { type: 'integer', minimum: 1, maximum: 50 } }, ['query'])),\n writeAction(CANONICAL_INTEGRATION_ACTIONS.githubIssuesCreate, 'Create issue', ['repo'], objectSchema({ owner: { type: 'string' }, repo: { type: 'string' }, title: { type: 'string' }, body: { type: 'string' } }, ['owner', 'repo', 'title'])),\n writeAction(CANONICAL_INTEGRATION_ACTIONS.githubPullRequestsComment, 'Comment on pull request', ['repo'], objectSchema({ owner: { type: 'string' }, repo: { type: 'string' }, pullNumber: { type: 'integer' }, body: { type: 'string' } }, ['owner', 'repo', 'pullNumber', 'body'])),\n ],\n metadata: { source: 'canonical-launch', supportTier: 'setupReady' },\n }\n}\n\nfunction slackConnector(providerId: string): IntegrationConnector {\n return {\n id: 'slack',\n providerId,\n title: 'Slack',\n category: 'chat',\n auth: 'oauth2',\n scopes: ['channels:read', 'search:read', 'chat:write'],\n actions: [\n readAction(CANONICAL_INTEGRATION_ACTIONS.slackChannelsList, 'List Slack channels', ['channels:read'], objectSchema({ limit: { type: 'integer', minimum: 1, maximum: 200 } })),\n readAction(CANONICAL_INTEGRATION_ACTIONS.slackMessagesSearch, 'Search Slack messages', ['search:read'], objectSchema({ query: { type: 'string' }, count: { type: 'integer', minimum: 1, maximum: 50 } }, ['query'])),\n writeAction(CANONICAL_INTEGRATION_ACTIONS.slackMessagesPost, 'Post Slack message', ['chat:write'], objectSchema({ channel: { type: 'string' }, text: { type: 'string' }, blocks: { type: 'array' } }, ['channel', 'text'])),\n ],\n triggers: [trigger('slack.message.posted', 'Slack message posted', ['channels:read'])],\n metadata: { source: 'canonical-launch', supportTier: 'setupReady' },\n }\n}\n\nfunction readAction(id: string, title: string, scopes: string[], inputSchema: unknown): IntegrationConnectorAction {\n return { id, title, risk: 'read', requiredScopes: scopes, dataClass: 'private', inputSchema }\n}\n\nfunction writeAction(id: string, title: string, scopes: string[], inputSchema: unknown): IntegrationConnectorAction {\n return { id, title, risk: 'write', requiredScopes: scopes, dataClass: 'private', approvalRequired: true, inputSchema }\n}\n\nfunction trigger(id: string, title: string, scopes: string[]): IntegrationConnectorTrigger {\n return { id, title, requiredScopes: scopes, dataClass: 'private' }\n}\n\nfunction providerPassthroughAction(connectorId: string): IntegrationConnectorAction {\n return {\n id: CANONICAL_INTEGRATION_ACTIONS.providerHttpRequest,\n title: 'Provider HTTP request',\n risk: 'write',\n requiredScopes: [],\n dataClass: 'sensitive',\n approvalRequired: true,\n description: `Controlled provider-native passthrough for ${connectorId}. Disabled by default by platform policy.`,\n inputSchema: objectSchema({\n method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'] },\n path: { type: 'string' },\n query: { type: 'object' },\n body: { type: 'object' },\n }, ['method', 'path']),\n }\n}\n\nfunction objectSchema(properties: Record<string, unknown>, required: string[] = []): Record<string, unknown> {\n return { type: 'object', additionalProperties: false, properties, required }\n}\n","import type { IntegrationSandboxBundle } from './runtime.js'\n\nexport const DEFAULT_INTEGRATION_BRIDGE_ENV = 'TANGLE_INTEGRATION_BUNDLE'\n\nexport interface IntegrationBridgePayload {\n version: 1\n manifestId: string\n subject: IntegrationSandboxBundle['subject']\n expiresAt: string\n tools: IntegrationBridgeToolBinding[]\n}\n\nexport interface IntegrationBridgeToolBinding {\n name: string\n title: string\n connectorId: string\n connectionId: string\n action: string\n risk: string\n dataClass: string\n requiredScopes: string[]\n capabilityToken: string\n}\n\nexport function buildIntegrationBridgePayload(bundle: IntegrationSandboxBundle): IntegrationBridgePayload {\n return {\n version: 1,\n manifestId: bundle.manifestId,\n subject: bundle.subject,\n expiresAt: bundle.expiresAt,\n tools: bundle.tools.flatMap((tool) => {\n const binding = bundle.capabilities.find((candidate) =>\n candidate.connectorId === tool.connectorId\n && candidate.connectionId\n && candidate.allowedActions.includes(tool.action.id)\n )\n if (!binding) return []\n return [{\n name: tool.name,\n title: tool.title,\n connectorId: tool.connectorId,\n connectionId: binding.connectionId,\n action: tool.action.id,\n risk: tool.risk,\n dataClass: tool.dataClass,\n requiredScopes: tool.requiredScopes,\n capabilityToken: binding.capability.token,\n }]\n }),\n }\n}\n\nexport function encodeIntegrationBridgePayload(payload: IntegrationBridgePayload): string {\n return Buffer.from(JSON.stringify(payload), 'utf8').toString('base64url')\n}\n\nexport function decodeIntegrationBridgePayload(encoded: string): IntegrationBridgePayload {\n const parsed = JSON.parse(Buffer.from(encoded, 'base64url').toString('utf8')) as unknown\n assertBridgePayload(parsed)\n return parsed\n}\n\nexport function buildIntegrationBridgeEnvironment(\n bundle: IntegrationSandboxBundle,\n options: { envVar?: string } = {},\n): Record<string, string> {\n const envVar = options.envVar ?? DEFAULT_INTEGRATION_BRIDGE_ENV\n return {\n [envVar]: encodeIntegrationBridgePayload(buildIntegrationBridgePayload(bundle)),\n }\n}\n\nexport function parseIntegrationBridgeEnvironment(\n env: Record<string, string | undefined>,\n options: { envVar?: string } = {},\n): IntegrationBridgePayload {\n const envVar = options.envVar ?? DEFAULT_INTEGRATION_BRIDGE_ENV\n const encoded = env[envVar]\n if (!encoded) throw new Error(`Missing ${envVar}.`)\n return decodeIntegrationBridgePayload(encoded)\n}\n\nexport function redactIntegrationBridgePayload(payload: IntegrationBridgePayload): IntegrationBridgePayload {\n return {\n ...payload,\n tools: payload.tools.map((tool) => ({\n ...tool,\n capabilityToken: '[REDACTED]',\n })),\n }\n}\n\nfunction assertBridgePayload(value: unknown): asserts value is IntegrationBridgePayload {\n if (!value || typeof value !== 'object') throw new Error('Invalid integration bridge payload.')\n const payload = value as Partial<IntegrationBridgePayload>\n if (payload.version !== 1) throw new Error('Unsupported integration bridge payload version.')\n if (typeof payload.manifestId !== 'string') throw new Error('Invalid integration bridge manifestId.')\n if (typeof payload.expiresAt !== 'string') throw new Error('Invalid integration bridge expiresAt.')\n if (!Array.isArray(payload.tools)) throw new Error('Invalid integration bridge tools.')\n}\n","import { IntegrationRuntimeError, normalizeIntegrationError } from './errors.js'\nimport { TANGLE_API_KEY_PREFIX, TANGLE_BROKER_TOKEN_PREFIX } from './connectors/adapters/tangle-id.js'\n\n/**\n * Self-service external-apps client — the brokered hub-exec path.\n *\n * The operator-allowlist-free way to integrate the Tangle hub (no `TRUSTED_APPS`\n * entry): a product registers itself ONCE (`registerApp` → client_id/secret),\n * the end user consents ONCE per connection from their Tangle session (a browser\n * step — not done here), and the product then mints short-lived\n * `sk-tan-broker-…` tokens unattended (`mintBrokerToken`) for each\n * `/v1/hub/exec` call. The durable grant means only the first consent needs a\n * user; everything after is app-credential-only.\n *\n * Sits alongside {@link TangleIntegrationsClient} in the integrations/hub SDK —\n * same `endpoint` + `fetchImpl` shape and the same `IntegrationRuntimeError`\n * surface. Endpoints (platform API, e.g. https://id.tangle.tools):\n * POST /v1/apps register (owner bearer)\n * GET /v1/apps list (owner bearer)\n * POST /v1/apps/:appId/revoke revoke (owner bearer)\n * POST /v1/apps/grants/:grantId/mint-broker-token durable re-mint (app creds)\n * POST /v1/apps/oauth/token authorization_code → token\n */\n\nexport interface TangleAppsClientOptions {\n /** Platform base URL (e.g. https://id.tangle.tools). */\n endpoint: string\n /** Test seam. Defaults to global `fetch`. */\n fetchImpl?: typeof fetch\n /** Platform-backed owner check for optional user claims on app operations. */\n ownerPolicy?: AppsOwnerPolicy\n}\n\nexport interface AppsOwnerPolicy {\n authorize(input: {\n operation: 'mint_broker_token' | 'exchange_auth_code'\n ownerUserId: string\n grantId?: string\n clientId?: string\n }): Promise<boolean> | boolean\n}\n\nexport interface RegisterAppInput {\n name: string\n redirectUris: string[]\n allowedScopes: string[]\n homepageUrl?: string\n}\n\nexport interface AppSummary {\n id: string\n clientId: string\n name: string\n redirectUris: string[]\n allowedScopes: string[]\n homepageUrl?: string\n createdAt?: string\n}\n\nexport interface RegisteredApp extends AppSummary {\n /** Shown ONCE at registration — persist it as a secret immediately. */\n clientSecret: string\n}\n\nexport interface BrokerToken {\n /** The `sk-tan-broker-…` bearer for a single `/v1/hub/exec` call. */\n accessToken: string\n expiresIn: number\n scope: string\n connectionId?: string\n /** Durable, consented grant identity. Older hosts omit these receipt fields. */\n grantId?: string\n ownerUserId?: string\n clientId?: string\n /** Absolute expiry derived from the broker response. */\n expiresAt: number\n}\n\ninterface PlatformEnvelope<T> {\n success?: boolean\n data?: T\n error?: { code?: string; message?: string } | string\n}\n\ninterface TokenResponse {\n access_token?: unknown\n expires_in?: unknown\n scope?: unknown\n connection_id?: string\n grant_id?: unknown\n user_id?: unknown\n client_id?: unknown\n}\n\nconst MAX_BROKER_TOKEN_TTL_SECONDS = 3_600\n\nexport class TangleAppsClient {\n private readonly endpoint: string\n private readonly fetchImpl: typeof fetch\n private readonly ownerPolicy?: AppsOwnerPolicy\n\n constructor(options: TangleAppsClientOptions) {\n this.endpoint = options.endpoint.replace(/\\/$/, '')\n this.fetchImpl = options.fetchImpl ?? fetch\n this.ownerPolicy = options.ownerPolicy\n }\n\n /**\n * Register a product as an app (ONE-TIME, with the owner's bearer — a Tangle\n * session or `sk-tan-*` key). Returns the client_id + the once-shown\n * client_secret; persist the secret immediately (never retrievable again).\n */\n async registerApp(input: RegisterAppInput, ownerBearer: string): Promise<RegisteredApp> {\n assertOwnerBearer(ownerBearer)\n const data = await this.request<{ app: AppSummary; clientSecret: string }>(\n 'POST',\n '/v1/apps',\n input,\n ownerBearer,\n )\n return { ...data.app, clientSecret: data.clientSecret }\n }\n\n /** List the caller's registered apps (no secrets). */\n async listApps(ownerBearer: string): Promise<AppSummary[]> {\n assertOwnerBearer(ownerBearer)\n const data = await this.request<{ apps: AppSummary[] }>('GET', '/v1/apps', undefined, ownerBearer)\n return data.apps ?? []\n }\n\n /** Revoke an app and cascade-kill its grants + tokens. */\n revokeApp(appId: string, ownerBearer: string): Promise<{ revoked: boolean }> {\n assertNonEmpty(appId, 'appId')\n assertOwnerBearer(ownerBearer)\n return this.request('POST', `/v1/apps/${encodeURIComponent(appId)}/revoke`, {}, ownerBearer)\n }\n\n /**\n * Durable re-mint: mint a fresh single-use `sk-tan-broker-` token against an\n * existing consented grant using ONLY the app credentials — no user session,\n * no `agc_` code. The runtime path: one call per `/v1/hub/exec`.\n */\n async mintBrokerToken(input: {\n clientId: string\n clientSecret: string\n grantId: string\n ttlSeconds?: number\n ownerUserId?: string\n }): Promise<BrokerToken> {\n assertNonEmpty(input.clientId, 'clientId')\n assertNonEmpty(input.clientSecret, 'clientSecret')\n assertNonEmpty(input.grantId, 'grantId')\n await this.authorizeOwner({\n operation: 'mint_broker_token',\n ownerUserId: input.ownerUserId,\n grantId: input.grantId,\n clientId: input.clientId,\n })\n const data = await this.request<TokenResponse>(\n 'POST',\n `/v1/apps/grants/${encodeURIComponent(input.grantId)}/mint-broker-token`,\n {\n client_id: input.clientId,\n client_secret: input.clientSecret,\n grant_id: input.grantId,\n ...(input.ttlSeconds !== undefined ? { ttl_seconds: input.ttlSeconds } : {}),\n },\n )\n return toBrokerToken(data)\n }\n\n /**\n * Exchange an `agc_` authorization code (from the user's one-time consent)\n * for the first broker token + the durable grant. Use on the consent\n * callback; afterward `mintBrokerToken` is enough.\n */\n async exchangeAuthCode(input: {\n clientId: string\n clientSecret: string\n code: string\n redirectUri: string\n connectionId?: string\n ownerUserId?: string\n }): Promise<BrokerToken> {\n assertNonEmpty(input.clientId, 'clientId')\n assertNonEmpty(input.clientSecret, 'clientSecret')\n assertNonEmpty(input.code, 'code')\n assertNonEmpty(input.redirectUri, 'redirectUri')\n await this.authorizeOwner({\n operation: 'exchange_auth_code',\n ownerUserId: input.ownerUserId,\n clientId: input.clientId,\n })\n const data = await this.request<TokenResponse>('POST', '/v1/apps/oauth/token', {\n grant_type: 'authorization_code',\n client_id: input.clientId,\n client_secret: input.clientSecret,\n code: input.code,\n redirect_uri: input.redirectUri,\n ...(input.connectionId ? { connection_id: input.connectionId } : {}),\n })\n return toBrokerToken(data)\n }\n\n private async authorizeOwner(input: {\n operation: 'mint_broker_token' | 'exchange_auth_code'\n ownerUserId?: string\n grantId?: string\n clientId?: string\n }): Promise<void> {\n if (input.ownerUserId === undefined) return\n assertNonEmpty(input.ownerUserId, 'ownerUserId')\n if (!this.ownerPolicy) {\n throw new IntegrationRuntimeError({\n code: 'input_invalid',\n status: 403,\n message: 'Tangle apps ownerUserId requires a Platform-backed ownerPolicy',\n })\n }\n const allowed = await this.ownerPolicy.authorize({\n operation: input.operation,\n ownerUserId: input.ownerUserId.trim(),\n ...(input.grantId ? { grantId: input.grantId } : {}),\n ...(input.clientId ? { clientId: input.clientId } : {}),\n })\n if (!allowed) {\n throw new IntegrationRuntimeError({\n code: 'provider_auth_failed',\n status: 403,\n message: 'Tangle apps owner policy rejected the requested owner',\n })\n }\n }\n\n private async request<T>(\n method: 'GET' | 'POST' | 'DELETE',\n path: string,\n body?: unknown,\n bearer?: string,\n ): Promise<T> {\n try {\n const headers: Record<string, string> = { accept: 'application/json' }\n if (bearer) headers.authorization = `Bearer ${bearer}`\n if (body !== undefined) headers['content-type'] = 'application/json'\n\n const response = await this.fetchImpl(`${this.endpoint}${path}`, {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n })\n const json = (await response.json().catch(() => undefined)) as PlatformEnvelope<T> | undefined\n\n if (!response.ok || (json && json.success === false)) {\n const platformCode = json?.error && typeof json.error === 'object' ? json.error.code : undefined\n const message =\n (json?.error && typeof json.error === 'object' && json.error.message) ||\n (typeof json?.error === 'string' ? json.error : `Tangle apps request failed (HTTP ${response.status})`)\n throw new IntegrationRuntimeError({\n code: platformCode === 'BROKER_DISABLED' ? 'passthrough_disabled' : 'unknown',\n message,\n status: response.status,\n metadata: { platformCode, path },\n })\n }\n // The /v1/apps surface wraps in { success, data }; /v1/apps/oauth/token is flat.\n return ((json && 'data' in json ? json.data : json) ?? ({} as T)) as T\n } catch (error) {\n if (error instanceof IntegrationRuntimeError) throw error\n const normalized = normalizeIntegrationError(error)\n throw new IntegrationRuntimeError({\n code: normalized.code,\n message: normalized.message,\n metadata: { path, userAction: normalized.userAction },\n })\n }\n }\n}\n\nexport function createTangleAppsClient(options: TangleAppsClientOptions): TangleAppsClient {\n return new TangleAppsClient(options)\n}\n\nfunction toBrokerToken(data: TokenResponse): BrokerToken {\n if (\n typeof data.access_token !== 'string' ||\n !/^sk-tan-broker-[A-Za-z0-9][A-Za-z0-9._-]*$/.test(data.access_token) ||\n typeof data.expires_in !== 'number' ||\n !Number.isSafeInteger(data.expires_in) ||\n data.expires_in <= 0 ||\n data.expires_in > MAX_BROKER_TOKEN_TTL_SECONDS ||\n typeof data.scope !== 'string' ||\n data.scope.trim().length === 0 ||\n (data.connection_id !== undefined && (typeof data.connection_id !== 'string' || data.connection_id.trim().length === 0)) ||\n [data.grant_id, data.user_id, data.client_id].some(value => value !== undefined && (typeof value !== 'string' || !value.trim() || value.length > 256))\n ) {\n throw new IntegrationRuntimeError({\n code: 'input_invalid',\n status: 502,\n message: 'Tangle broker returned an invalid token, expiry, or scope',\n })\n }\n const accessToken = data.access_token\n const expiresIn = data.expires_in\n const scope = data.scope.trim().split(/\\s+/).join(' ')\n const expiresAt = Date.now() + expiresIn * 1000\n if (!Number.isFinite(expiresAt)) {\n throw new IntegrationRuntimeError({\n code: 'input_invalid',\n status: 502,\n message: 'Tangle broker returned an invalid expiry',\n })\n }\n return {\n accessToken,\n expiresIn,\n scope,\n expiresAt,\n connectionId: data.connection_id,\n ...(typeof data.grant_id === 'string' ? { grantId: data.grant_id } : {}),\n ...(typeof data.user_id === 'string' ? { ownerUserId: data.user_id } : {}),\n ...(typeof data.client_id === 'string' ? { clientId: data.client_id } : {}),\n }\n}\n\nfunction assertNonEmpty(value: unknown, name: string): asserts value is string {\n if (typeof value !== 'string' || !value.trim()) {\n throw new IntegrationRuntimeError({\n code: 'input_invalid',\n status: 400,\n message: `Tangle apps ${name} is required`,\n })\n }\n}\n\nfunction assertOwnerBearer(value: unknown): asserts value is string {\n assertNonEmpty(value, 'owner bearer')\n if (\n value.startsWith('sk-') &&\n (!value.startsWith(TANGLE_API_KEY_PREFIX) ||\n value.startsWith(TANGLE_BROKER_TOKEN_PREFIX) ||\n value.length <= TANGLE_API_KEY_PREFIX.length)\n ) {\n throw new IntegrationRuntimeError({\n code: 'input_invalid',\n status: 400,\n message: 'Tangle apps owner bearer must be a Platform key or session bearer',\n })\n }\n}\n\n/** Require the authenticated host receipt before retaining a grant for unattended\n * use. The browser's state and connection id are expectations, not evidence. */\nexport function requireBrokerGrantReceipt(token: BrokerToken, expected: {\n ownerUserId: string; clientId: string; connectionId: string; scopes: readonly string[]; grantId?: string\n}): { grantId: string; connectionId: string; ownerUserId: string; clientId: string; scopes: string[] } {\n const scopes = [...new Set(token.scope.split(/\\s+/).filter(Boolean))].sort()\n const expectedScopes = [...new Set(expected.scopes)].sort()\n if (!token.grantId || token.ownerUserId !== expected.ownerUserId || token.clientId !== expected.clientId ||\n token.connectionId !== expected.connectionId || (expected.grantId && token.grantId !== expected.grantId) ||\n JSON.stringify(scopes) !== JSON.stringify(expectedScopes)) {\n throw new IntegrationRuntimeError({ code: 'provider_auth_failed', status: 403,\n message: 'The broker grant receipt does not match the authenticated owner, app, connection and requested scopes' })\n }\n return { grantId: token.grantId, connectionId: expected.connectionId, ownerUserId: expected.ownerUserId, clientId: expected.clientId, scopes }\n}\n","import {\n DEFAULT_INTEGRATION_BRIDGE_ENV,\n parseIntegrationBridgeEnvironment,\n type IntegrationBridgePayload,\n type IntegrationBridgeToolBinding,\n} from './bridge.js'\nimport { IntegrationRuntimeError, normalizeIntegrationError } from './errors.js'\n\nexport interface TangleIntegrationsClientOptions {\n endpoint: string\n bridge?: IntegrationBridgePayload\n env?: Record<string, string | undefined>\n envVar?: string\n fetchImpl?: typeof fetch\n getCapabilityToken?: (tool: IntegrationBridgeToolBinding) => string | Promise<string>\n}\n\nexport interface TangleIntegrationInvokeInput<TInput = unknown> {\n tool: string\n input?: TInput\n idempotencyKey?: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n}\n\nexport interface TangleIntegrationInvokeResult<TOutput = unknown> {\n status: 'ok' | 'approval_required' | 'failed'\n action: string\n output?: TOutput\n approval?: unknown\n error?: string\n metadata?: Record<string, unknown>\n}\n\nexport class TangleIntegrationsClient {\n private readonly endpoint: string\n private readonly bridge: IntegrationBridgePayload\n private readonly fetchImpl: typeof fetch\n private readonly getCapabilityToken: (tool: IntegrationBridgeToolBinding) => string | Promise<string>\n\n constructor(options: TangleIntegrationsClientOptions) {\n this.endpoint = options.endpoint.replace(/\\/$/, '')\n this.bridge = options.bridge ?? parseIntegrationBridgeEnvironment(\n options.env ?? readProcessEnv(),\n { envVar: options.envVar ?? DEFAULT_INTEGRATION_BRIDGE_ENV },\n )\n this.fetchImpl = options.fetchImpl ?? fetch\n this.getCapabilityToken = options.getCapabilityToken ?? ((tool) => tool.capabilityToken)\n }\n\n tools(): IntegrationBridgeToolBinding[] {\n return [...this.bridge.tools]\n }\n\n findTool(toolOrAction: string): IntegrationBridgeToolBinding {\n const found = this.bridge.tools.find((tool) =>\n tool.name === toolOrAction ||\n tool.action === toolOrAction ||\n `${tool.connectorId}.${tool.action}` === toolOrAction\n )\n if (!found) {\n throw new IntegrationRuntimeError({\n code: 'action_not_found',\n message: `Integration tool ${toolOrAction} is not available in this runtime.`,\n metadata: { available: this.bridge.tools.map((tool) => ({ name: tool.name, action: tool.action, connectorId: tool.connectorId })) },\n })\n }\n return found\n }\n\n async invoke<TOutput = unknown, TInput = unknown>(input: TangleIntegrationInvokeInput<TInput>): Promise<TangleIntegrationInvokeResult<TOutput>> {\n try {\n const tool = this.findTool(input.tool)\n const token = await this.getCapabilityToken(tool)\n const response = await this.fetchImpl(`${this.endpoint}/v1/integrations/invoke`, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n action: tool.action,\n input: input.input,\n idempotencyKey: input.idempotencyKey ?? defaultIdempotencyKey(tool.action),\n dryRun: input.dryRun,\n metadata: input.metadata,\n }),\n })\n const json = await response.json().catch(() => undefined) as TangleIntegrationInvokeResult<TOutput> | undefined\n if (!response.ok && !json) {\n return { status: 'failed', action: tool.action, error: `Integration invoke failed with HTTP ${response.status}` }\n }\n return json ?? { status: 'failed', action: tool.action, error: 'Integration invoke returned an empty response.' }\n } catch (error) {\n const normalized = normalizeIntegrationError(error)\n return { status: 'failed', action: input.tool, error: normalized.message, metadata: { code: normalized.code, userAction: normalized.userAction } }\n }\n }\n}\n\nexport function createTangleIntegrationsClient(options: TangleIntegrationsClientOptions): TangleIntegrationsClient {\n return new TangleIntegrationsClient(options)\n}\n\nfunction defaultIdempotencyKey(action: string): string {\n return `${action}:${Date.now()}:${Math.random().toString(36).slice(2)}`\n}\n\nfunction readProcessEnv(): Record<string, string | undefined> {\n if (typeof process !== 'undefined' && process.env) return process.env\n return {}\n}\n","import type {\n IntegrationConnector,\n IntegrationConnectorAction,\n} from './index.js'\nimport type {\n IntegrationManifest,\n IntegrationManifestResolution,\n IntegrationRequirement,\n} from './runtime.js'\n\nexport interface ConsentSummary {\n title: string\n body: string\n bullets: string[]\n primaryAction: string\n risk: 'read' | 'write' | 'destructive'\n connectorIds: string[]\n}\n\nexport interface RenderConsentOptions {\n appName?: string\n connectors?: IntegrationConnector[]\n}\n\nexport function renderConsentSummary(\n manifestOrResolution: IntegrationManifest | IntegrationManifestResolution,\n options: RenderConsentOptions = {},\n): ConsentSummary {\n const manifest = 'manifest' in manifestOrResolution ? manifestOrResolution.manifest : manifestOrResolution\n const appName = options.appName ?? manifest.title ?? manifest.id\n const requirements = manifest.requirements\n const risk = aggregateRisk(requirements, options.connectors)\n const connectorIds = unique(requirements.map((requirement) => requirement.connectorId))\n const first = requirements[0]\n const body = first ? sentenceForRequirement(appName, first) : `${appName} does not request integrations.`\n return {\n title: `${appName} wants to use ${humanList(connectorIds.map(titleize))}`,\n body,\n bullets: requirements.map((requirement) => bulletForRequirement(requirement, options.connectors)),\n primaryAction: risk === 'read' ? 'Allow access' : risk === 'write' ? 'Review and allow' : 'Review destructive access',\n risk,\n connectorIds,\n }\n}\n\nexport function renderApprovalCopy(input: {\n appName: string\n connectorTitle: string\n action: IntegrationConnectorAction\n approvalId?: string\n}): ConsentSummary {\n return {\n title: `${input.appName} wants to ${input.action.title.toLowerCase()}`,\n body: `${input.appName} is requesting permission to run \"${input.action.title}\" on ${input.connectorTitle}.`,\n bullets: [\n `Risk: ${input.action.risk}`,\n `Data: ${input.action.dataClass}`,\n ...(input.approvalId ? [`Approval id: ${input.approvalId}`] : []),\n ],\n primaryAction: input.action.risk === 'read' ? 'Allow' : 'Approve action',\n risk: input.action.risk,\n connectorIds: [],\n }\n}\n\nfunction sentenceForRequirement(appName: string, requirement: IntegrationRequirement): string {\n if (requirement.connectorId === 'google-calendar' && requirement.mode === 'read') {\n return `${appName} wants to read your Google Calendar to find schedule-aware recommendations.`\n }\n if (requirement.connectorId === 'google-calendar' && requirement.mode === 'write') {\n return `${appName} wants to create or update Google Calendar events after your approval.`\n }\n if (requirement.mode === 'read') return `${appName} wants to read ${titleize(requirement.connectorId)} data.`\n if (requirement.mode === 'write') return `${appName} wants to write ${titleize(requirement.connectorId)} data after approval.`\n return `${appName} wants to subscribe to ${titleize(requirement.connectorId)} events.`\n}\n\nfunction bulletForRequirement(requirement: IntegrationRequirement, connectors: IntegrationConnector[] = []): string {\n const connector = connectors.find((candidate) => candidate.id === requirement.connectorId)\n const actions = requirement.requiredActions?.length\n ? requirement.requiredActions.map((id) => connector?.actions.find((action) => action.id === id)?.title ?? id)\n : requirement.requiredTriggers ?? []\n return `${titleize(requirement.connectorId)}: ${requirement.reason}${actions.length ? ` (${actions.join(', ')})` : ''}`\n}\n\nfunction aggregateRisk(requirements: IntegrationRequirement[], connectors: IntegrationConnector[] = []): 'read' | 'write' | 'destructive' {\n let rank = 0\n for (const requirement of requirements) {\n if (requirement.mode === 'write') rank = Math.max(rank, 1)\n const connector = connectors.find((candidate) => candidate.id === requirement.connectorId)\n for (const actionId of requirement.requiredActions ?? []) {\n const risk = connector?.actions.find((action) => action.id === actionId)?.risk\n if (risk === 'write') rank = Math.max(rank, 1)\n if (risk === 'destructive') rank = Math.max(rank, 2)\n }\n }\n return rank === 2 ? 'destructive' : rank === 1 ? 'write' : 'read'\n}\n\nfunction humanList(values: string[]): string {\n if (values.length <= 1) return values[0] ?? 'integrations'\n if (values.length === 2) return `${values[0]} and ${values[1]}`\n return `${values.slice(0, -1).join(', ')}, and ${values.at(-1)}`\n}\n\nfunction titleize(value: string): string {\n return value.split(/[-_.]/g).filter(Boolean).map((part) => part[0]!.toUpperCase() + part.slice(1)).join(' ')\n}\n\nfunction unique<T>(values: T[]): T[] {\n return [...new Set(values)]\n}\n","/**\n * Workspace capability discovery — answers \"what can this workspace do?\"\n * with a typed list of MCP-shape tool descriptors that the agent runtime\n * can flatten into a planner's tool registry.\n *\n * The agent runtime's gating question is one level above the existing\n * connector catalog (\"which integrations exist?\") and one level below\n * the issued capability-token surface (\"temporarily delegate scope X\n * via this signed token\"). This module bridges the two:\n *\n * discoverWorkspaceCapabilities({ owner, connectors, connections, scopes })\n * → WorkspaceCapability[]\n *\n * A `WorkspaceCapability` is hand-shaped to be cheap to emit alongside a\n * connector manifest and trivial to render into:\n * - an LLM tool-choice JSON array\n * - an MCP `tools/list` response\n * - a UI surface (\"Connect Gmail to enable: send_reply, list_messages…\")\n *\n * What this is NOT:\n * - A capability-token issuer. That stays in IntegrationHub.issueCapability.\n * - A connector registry. That stays in IntegrationRegistry / catalog.\n *\n * Scopes are the load-bearing input: a connector advertises N actions,\n * but only the subset whose `requiredScopes` are a subset of the\n * connection's `grantedScopes` is reachable. The discovery function\n * filters on that automatically.\n *\n * Stability: `@stable` — additions to WorkspaceCapability must be\n * additive and non-breaking.\n */\n\nimport type {\n IntegrationActor,\n IntegrationConnection,\n IntegrationConnector,\n IntegrationConnectorAction,\n IntegrationConnectorCategory,\n IntegrationConnectorTrigger,\n IntegrationDataClass,\n IntegrationActionRisk,\n IntegrationConnectionStore,\n IntegrationProvider,\n} from './index.js'\n\n/** MCP-shape tool descriptor. Mirrors the\n * [Model Context Protocol tool schema](https://modelcontextprotocol.io/specification)\n * closely enough that consumers can pipe a WorkspaceCapability straight\n * into a `tools/list` response. */\nexport interface WorkspaceToolSchema {\n name: string\n description?: string\n /** JSON-schema describing the action's input. */\n inputSchema?: unknown\n /** Optional JSON-schema describing the action's output. */\n outputSchema?: unknown\n}\n\n/** One discoverable capability — an action a connector exposes that the\n * workspace has the connection + scopes to invoke. */\nexport interface WorkspaceCapability {\n /** Stable, fully-qualified id. Format `<connector-id>.<action-id>`. */\n id: string\n /** Human label safe for UI. */\n title: string\n /** Optional one-line description. */\n description?: string\n /** Connector category for grouping. */\n category: IntegrationConnectorCategory\n /** Connector that hosts this capability. */\n connectorId: string\n /** Provider that hosts this connector (first-party, gateway, …). */\n providerId: string\n /** Underlying action id on the connector. */\n actionId: string\n /** Scopes required to invoke. The discovery function only returns\n * capabilities whose required scopes are a subset of the connection's\n * grantedScopes. */\n scopes: string[]\n /** Risk class — useful for UI (\"write\" / \"destructive\" lights). */\n risk: IntegrationActionRisk\n /** Data class of the action's output, when known. */\n dataClass: IntegrationDataClass\n /** MCP-shape tool schema the agent runtime can register directly. */\n toolSchema: WorkspaceToolSchema\n /** True iff the workspace has an active connection backing this\n * capability. False capabilities (advertised by the connector but\n * not yet connected) are included when `includeUnconnected: true`\n * is passed — useful for \"connect to unlock\" UI affordances. */\n connected: boolean\n /** Connection id backing this capability. Undefined when\n * `connected: false`. */\n connectionId?: string\n /** Whether the action requires explicit approval before invocation. */\n approvalRequired?: boolean\n}\n\n/** Optional inbound trigger surface. Same shape as a capability so the\n * consumer can render both with one component. */\nexport interface WorkspaceTrigger {\n id: string\n title: string\n description?: string\n category: IntegrationConnectorCategory\n connectorId: string\n providerId: string\n triggerId: string\n scopes: string[]\n dataClass: IntegrationDataClass\n connected: boolean\n connectionId?: string\n}\n\nexport interface DiscoverWorkspaceCapabilitiesInput {\n /** Workspace owner. Used to scope the connection lookup when `store`\n * is supplied (the canonical production path). */\n owner: IntegrationActor\n /** Either an explicit connection list (test/fixture path) or a store\n * the function should query for connections by owner. Exactly one\n * of `connections` / `store` MUST be provided. */\n connections?: IntegrationConnection[]\n store?: IntegrationConnectionStore\n /** Either an explicit connector list (test/fixture path) or a set of\n * providers the function should query via `listConnectors()`. */\n connectors?: IntegrationConnector[]\n providers?: IntegrationProvider[]\n /** Include capabilities whose connector is in the catalog but the\n * workspace has no active connection for. Useful to render\n * \"connect to unlock\" affordances. Default: false. */\n includeUnconnected?: boolean\n /** When true, include capabilities even if some required scopes are\n * missing from the connection grant. The default `false` hides such\n * capabilities — the agent runtime never sees them. */\n includeMissingScopes?: boolean\n}\n\nexport interface WorkspaceCapabilityDiscovery {\n capabilities: WorkspaceCapability[]\n triggers: WorkspaceTrigger[]\n /** Counts grouped by connector for telemetry / UI badges. */\n countsByConnector: Record<string, number>\n /** Connectors the workspace is connected to but the planner cannot\n * reach any actions on (e.g., zero scopes granted, or all actions\n * require an additional scope). */\n unreachableConnectors: Array<{ connectorId: string; reason: string }>\n}\n\n/** Resolve workspace-visible capabilities + triggers. Pure with respect\n * to the inputs — caller decides whether to back `connections` and\n * `connectors` with persistent state or static fixtures. */\nexport async function discoverWorkspaceCapabilities(\n input: DiscoverWorkspaceCapabilitiesInput,\n): Promise<WorkspaceCapabilityDiscovery> {\n const connections = await resolveConnections(input)\n const connectors = await resolveConnectors(input)\n const activeConnectionsByConnector = new Map<string, IntegrationConnection>()\n for (const conn of connections) {\n if (conn.status !== 'active') continue\n if (!activeConnectionsByConnector.has(conn.connectorId)) {\n activeConnectionsByConnector.set(conn.connectorId, conn)\n }\n }\n\n const capabilities: WorkspaceCapability[] = []\n const triggers: WorkspaceTrigger[] = []\n const countsByConnector: Record<string, number> = {}\n const unreachableConnectors: Array<{ connectorId: string; reason: string }> = []\n\n for (const connector of connectors) {\n const connection = activeConnectionsByConnector.get(connector.id)\n const connected = Boolean(connection)\n if (!connected && !input.includeUnconnected) continue\n\n const grantedScopes = new Set(connection?.grantedScopes ?? [])\n let actionsAdded = 0\n\n for (const action of connector.actions) {\n const missing = action.requiredScopes.filter((scope) => !grantedScopes.has(scope))\n if (connected && missing.length > 0 && !input.includeMissingScopes) continue\n capabilities.push(toCapability(connector, action, connection))\n actionsAdded += 1\n }\n for (const trigger of connector.triggers ?? []) {\n const missing = trigger.requiredScopes.filter((scope) => !grantedScopes.has(scope))\n if (connected && missing.length > 0 && !input.includeMissingScopes) continue\n triggers.push(toTrigger(connector, trigger, connection))\n }\n\n countsByConnector[connector.id] = actionsAdded\n if (connected && actionsAdded === 0 && connector.actions.length > 0) {\n unreachableConnectors.push({\n connectorId: connector.id,\n reason: 'all_actions_missing_scope',\n })\n }\n }\n\n return { capabilities, triggers, countsByConnector, unreachableConnectors }\n}\n\nasync function resolveConnections(input: DiscoverWorkspaceCapabilitiesInput): Promise<IntegrationConnection[]> {\n if (input.connections) return input.connections\n if (input.store) return await input.store.listByOwner(input.owner)\n throw new Error('discoverWorkspaceCapabilities: provide either connections or store')\n}\n\nasync function resolveConnectors(input: DiscoverWorkspaceCapabilitiesInput): Promise<IntegrationConnector[]> {\n if (input.connectors) return input.connectors\n if (input.providers) {\n const lists = await Promise.all(input.providers.map((p) => Promise.resolve(p.listConnectors())))\n return lists.flat()\n }\n throw new Error('discoverWorkspaceCapabilities: provide either connectors or providers')\n}\n\nfunction toCapability(\n connector: IntegrationConnector,\n action: IntegrationConnectorAction,\n connection: IntegrationConnection | undefined,\n): WorkspaceCapability {\n return {\n id: `${connector.id}.${action.id}`,\n title: action.title,\n description: action.description,\n category: connector.category,\n connectorId: connector.id,\n providerId: connector.providerId,\n actionId: action.id,\n scopes: action.requiredScopes,\n risk: action.risk,\n dataClass: action.dataClass,\n toolSchema: {\n name: `${connector.id}.${action.id}`,\n description: action.description,\n inputSchema: action.inputSchema,\n outputSchema: action.outputSchema,\n },\n connected: Boolean(connection),\n connectionId: connection?.id,\n approvalRequired: action.approvalRequired,\n }\n}\n\nfunction toTrigger(\n connector: IntegrationConnector,\n trigger: IntegrationConnectorTrigger,\n connection: IntegrationConnection | undefined,\n): WorkspaceTrigger {\n return {\n id: `${connector.id}.${trigger.id}`,\n title: trigger.title,\n description: trigger.description,\n category: connector.category,\n connectorId: connector.id,\n providerId: connector.providerId,\n triggerId: trigger.id,\n scopes: trigger.requiredScopes,\n dataClass: trigger.dataClass,\n connected: Boolean(connection),\n connectionId: connection?.id,\n }\n}\n\n/**\n * Filter a {@link WorkspaceCapabilityDiscovery} result by the calling\n * user's effective id.tangle.tools workspace scopes. Pair with the\n * `tangleIdentity()` adapter's `list_workspaces` / `switch_workspace`\n * output to keep what the agent runtime sees aligned with what the\n * workspace's plan actually permits.\n *\n * Semantics:\n * - Every workspace scope is matched against every capability's\n * `scopes` list. Wildcard scopes (`tangle:*`, `<connectorId>:*`) are\n * respected — a workspace with `tangle:*` sees everything; a\n * workspace with `gmail:*` sees every gmail capability regardless of\n * the upstream OAuth scope.\n * - When `workspaceScopes` is empty, returns the discovery as-is (no\n * workspace gate). Pass an explicit `denyByDefault: true` to flip\n * that to \"empty workspace sees nothing\" — matches the platform's\n * fail-closed posture for production tenants.\n *\n * Pure with respect to the inputs — no side effects.\n */\nexport function filterDiscoveryByWorkspaceScopes(\n discovery: WorkspaceCapabilityDiscovery,\n workspaceScopes: string[],\n opts: { denyByDefault?: boolean } = {},\n): WorkspaceCapabilityDiscovery {\n if (workspaceScopes.length === 0 && !opts.denyByDefault) return discovery\n const granted = new Set(workspaceScopes)\n const hasWildcard = granted.has('tangle:*')\n\n function allowed(connectorId: string, scopes: string[]): boolean {\n if (hasWildcard) return true\n if (granted.has(`${connectorId}:*`)) return true\n // A workspace scope satisfies the capability iff every required\n // upstream scope is also present, OR the workspace explicitly\n // grants the connector. We deliberately do NOT loosen this to\n // \"any granted scope intersects\" — that would let a tenant with\n // a read-only Gmail grant invoke send_reply by accident.\n for (const scope of scopes) {\n if (!granted.has(scope)) return false\n }\n return true\n }\n\n const capabilities = discovery.capabilities.filter((cap) => allowed(cap.connectorId, cap.scopes))\n const triggers = discovery.triggers.filter((t) => allowed(t.connectorId, t.scopes))\n const countsByConnector: Record<string, number> = {}\n for (const cap of capabilities) {\n countsByConnector[cap.connectorId] = (countsByConnector[cap.connectorId] ?? 0) + 1\n }\n return {\n capabilities,\n triggers,\n countsByConnector,\n unreachableConnectors: discovery.unreachableConnectors,\n }\n}\n","import type {\n ConnectorAdapter,\n InboundEvent,\n ResolvedDataSource,\n} from './connectors/types.js'\nimport type {\n IntegrationTriggerEvent,\n} from './index.js'\nimport type { IntegrationWorkflowRuntime } from './workflow.js'\n\nexport interface StoredIntegrationEvent {\n id: string\n sourceId: string\n connectorId: string\n eventType: string\n providerEventId?: string\n receivedAt: string\n payload: Record<string, unknown>\n dispatchedAt?: string\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationEventStore {\n put(event: StoredIntegrationEvent): Promise<void> | void\n hasProviderEvent(sourceId: string, providerEventId: string): Promise<boolean> | boolean\n list(): Promise<StoredIntegrationEvent[]> | StoredIntegrationEvent[]\n}\n\nexport interface IntegrationWebhookReceiverResult {\n status: number\n body: unknown\n headers?: Record<string, string>\n received: StoredIntegrationEvent[]\n duplicates: StoredIntegrationEvent[]\n}\n\nexport class InMemoryIntegrationEventStore implements IntegrationEventStore {\n private readonly events = new Map<string, StoredIntegrationEvent>()\n private readonly providerIds = new Set<string>()\n\n put(event: StoredIntegrationEvent): void {\n this.events.set(event.id, event)\n if (event.providerEventId) this.providerIds.add(providerKey(event.sourceId, event.providerEventId))\n }\n\n hasProviderEvent(sourceId: string, providerEventId: string): boolean {\n return this.providerIds.has(providerKey(sourceId, providerEventId))\n }\n\n list(): StoredIntegrationEvent[] {\n return [...this.events.values()]\n }\n}\n\nexport async function receiveIntegrationWebhook(input: {\n adapter: ConnectorAdapter\n source: ResolvedDataSource\n rawBody: string\n headers: Record<string, string | string[] | undefined>\n store: IntegrationEventStore\n workflowRuntime?: IntegrationWorkflowRuntime\n allowUnsignedWebhook?: boolean\n now?: () => Date\n}): Promise<IntegrationWebhookReceiverResult> {\n if (!input.adapter.handleInboundEvent) {\n return { status: 405, body: { ok: false, error: 'Connector does not support inbound webhooks.' }, received: [], duplicates: [] }\n }\n if (!input.adapter.verifySignature && !input.allowUnsignedWebhook) {\n return { status: 401, body: { ok: false, error: 'Webhook signature verification is required.' }, received: [], duplicates: [] }\n }\n const signature = input.adapter.verifySignature?.({\n rawBody: input.rawBody,\n headers: input.headers,\n source: input.source,\n })\n if (signature && !signature.valid) {\n return { status: 401, body: { ok: false, error: signature.reason ?? 'Invalid webhook signature.' }, received: [], duplicates: [] }\n }\n\n const handled = await input.adapter.handleInboundEvent({\n source: input.source,\n rawBody: input.rawBody,\n headers: input.headers,\n })\n const received: StoredIntegrationEvent[] = []\n const duplicates: StoredIntegrationEvent[] = []\n for (const inbound of handled.events) {\n const event = storedEvent(input.source, inbound, input.now ?? (() => new Date()))\n if (event.providerEventId && await input.store.hasProviderEvent(event.sourceId, event.providerEventId)) {\n duplicates.push(event)\n continue\n }\n await input.store.put(event)\n received.push(event)\n await dispatchStoredEvent(event, input.source, input.workflowRuntime)\n }\n\n return {\n status: handled.response?.status ?? 200,\n body: handled.response?.body ?? { received: true, count: received.length, duplicateCount: duplicates.length },\n headers: handled.response?.headers,\n received,\n duplicates,\n }\n}\n\nexport function storedEventToTriggerEvent(event: StoredIntegrationEvent, source: ResolvedDataSource): IntegrationTriggerEvent {\n return {\n id: event.id,\n providerId: String(source.metadata.providerId ?? 'first-party'),\n connectorId: event.connectorId,\n connectionId: source.id,\n trigger: event.eventType,\n occurredAt: event.receivedAt,\n payload: event.payload,\n metadata: {\n providerEventId: event.providerEventId,\n sourceId: event.sourceId,\n ...event.metadata,\n },\n }\n}\n\nasync function dispatchStoredEvent(\n event: StoredIntegrationEvent,\n source: ResolvedDataSource,\n workflowRuntime?: IntegrationWorkflowRuntime,\n): Promise<void> {\n if (!workflowRuntime) return\n await workflowRuntime.dispatchEvent(storedEventToTriggerEvent(event, source), () => undefined)\n}\n\nfunction storedEvent(source: ResolvedDataSource, event: InboundEvent, now: () => Date): StoredIntegrationEvent {\n return {\n id: `evt_${source.id}_${event.providerEventId ?? `${event.eventType}_${now().getTime()}`}`,\n sourceId: source.id,\n connectorId: source.kind,\n eventType: event.eventType,\n providerEventId: event.providerEventId,\n receivedAt: now().toISOString(),\n payload: event.payload,\n }\n}\n\nfunction providerKey(sourceId: string, providerEventId: string): string {\n return `${sourceId}:${providerEventId}`\n}\n","import type {\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationConnection,\n IntegrationConnector,\n} from './index.js'\nimport type { IntegrationAuditSink } from './audit.js'\nimport { createIntegrationAuditEvent } from './audit.js'\nimport type { IntegrationRegistry } from './registry.js'\n\nexport type IntegrationHealthcheckStatus = 'healthy' | 'degraded' | 'unhealthy' | 'unknown'\n\nexport interface IntegrationHealthcheckCheck {\n id: string\n status: IntegrationHealthcheckStatus\n message: string\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationHealthcheckResult {\n connectionId: string\n providerId: string\n connectorId: string\n status: IntegrationHealthcheckStatus\n checkedAt: string\n checks: IntegrationHealthcheckCheck[]\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationHealthcheckStore {\n put(result: IntegrationHealthcheckResult): Promise<void> | void\n get(connectionId: string): Promise<IntegrationHealthcheckResult | undefined> | IntegrationHealthcheckResult | undefined\n list(): Promise<IntegrationHealthcheckResult[]> | IntegrationHealthcheckResult[]\n}\n\nexport class InMemoryIntegrationHealthcheckStore implements IntegrationHealthcheckStore {\n private readonly results = new Map<string, IntegrationHealthcheckResult>()\n\n put(result: IntegrationHealthcheckResult): void {\n this.results.set(result.connectionId, result)\n }\n\n get(connectionId: string): IntegrationHealthcheckResult | undefined {\n return this.results.get(connectionId)\n }\n\n list(): IntegrationHealthcheckResult[] {\n return [...this.results.values()]\n }\n}\n\nexport async function runIntegrationHealthcheck(input: {\n connection: IntegrationConnection\n connector?: IntegrationConnector\n registry?: IntegrationRegistry\n test?: (connection: IntegrationConnection, connector: IntegrationConnector) => Promise<IntegrationActionResult | boolean> | IntegrationActionResult | boolean\n audit?: IntegrationAuditSink\n now?: () => Date\n}): Promise<IntegrationHealthcheckResult> {\n const now = input.now ?? (() => new Date())\n const checkedAt = now().toISOString()\n const connector = input.connector ?? input.registry?.byId.get(input.connection.connectorId)?.connector\n const checks: IntegrationHealthcheckCheck[] = []\n\n checks.push(connectionStatusCheck(input.connection, now))\n if (!connector) {\n checks.push({ id: 'connector-known', status: 'unknown', message: `Connector ${input.connection.connectorId} is not in the registry.` })\n } else {\n checks.push(connectorExecutableCheck(connector))\n checks.push(scopeShapeCheck(input.connection, connector))\n if (input.test && input.connection.status === 'active') {\n checks.push(await liveHealthcheck(input.connection, connector, input.test))\n }\n }\n\n const result: IntegrationHealthcheckResult = {\n connectionId: input.connection.id,\n providerId: input.connection.providerId,\n connectorId: input.connection.connectorId,\n status: rollupHealthStatus(checks),\n checkedAt,\n checks,\n }\n await input.audit?.record(createIntegrationAuditEvent({\n type: 'healthcheck.completed',\n actor: input.connection.owner,\n connectionId: input.connection.id,\n providerId: input.connection.providerId,\n connectorId: input.connection.connectorId,\n ok: result.status === 'healthy',\n message: result.status,\n metadata: { checks: checks.map((check) => ({ id: check.id, status: check.status, message: check.message })) },\n occurredAt: checkedAt,\n }))\n return result\n}\n\nexport async function runIntegrationHealthchecks(input: {\n connections: IntegrationConnection[]\n registry?: IntegrationRegistry\n store?: IntegrationHealthcheckStore\n audit?: IntegrationAuditSink\n now?: () => Date\n test?: (connection: IntegrationConnection, connector: IntegrationConnector) => Promise<IntegrationActionResult | boolean> | IntegrationActionResult | boolean\n}): Promise<IntegrationHealthcheckResult[]> {\n const results: IntegrationHealthcheckResult[] = []\n for (const connection of input.connections) {\n const result = await runIntegrationHealthcheck({\n connection,\n registry: input.registry,\n test: input.test,\n audit: input.audit,\n now: input.now,\n })\n await input.store?.put(result)\n results.push(result)\n }\n return results\n}\n\nexport function healthcheckRequest(action = 'healthcheck'): IntegrationActionRequest {\n return {\n connectionId: '__healthcheck__',\n action,\n input: {},\n dryRun: true,\n metadata: { healthcheck: true },\n }\n}\n\nfunction connectionStatusCheck(connection: IntegrationConnection, now: () => Date): IntegrationHealthcheckCheck {\n if (connection.status !== 'active') {\n return { id: 'connection-active', status: 'unhealthy', message: `Connection is ${connection.status}.` }\n }\n if (connection.expiresAt && Date.parse(connection.expiresAt) <= now().getTime()) {\n return { id: 'connection-active', status: 'unhealthy', message: 'Connection credentials are expired.' }\n }\n return { id: 'connection-active', status: 'healthy', message: 'Connection is active.' }\n}\n\nfunction connectorExecutableCheck(connector: IntegrationConnector): IntegrationHealthcheckCheck {\n const executable = connector.actions.length > 0 || (connector.triggers?.length ?? 0) > 0\n if (!executable) {\n return { id: 'connector-executable', status: 'degraded', message: `${connector.title} is catalog-only.` }\n }\n return { id: 'connector-executable', status: 'healthy', message: `${connector.title} has executable actions or triggers.` }\n}\n\nfunction scopeShapeCheck(connection: IntegrationConnection, connector: IntegrationConnector): IntegrationHealthcheckCheck {\n const declaredScopes = new Set(connector.scopes)\n const undeclared = connection.grantedScopes.filter((scope) => !declaredScopes.has(scope))\n if (connector.scopes.length === 0 && connection.grantedScopes.length > 0) {\n return { id: 'scope-shape', status: 'unknown', message: 'Connector does not declare a scope catalog.', metadata: { grantedScopes: connection.grantedScopes } }\n }\n if (undeclared.length > 0) {\n return { id: 'scope-shape', status: 'degraded', message: 'Connection has scopes not declared by the connector.', metadata: { undeclared } }\n }\n return { id: 'scope-shape', status: 'healthy', message: 'Granted scopes match the connector shape.' }\n}\n\nasync function liveHealthcheck(\n connection: IntegrationConnection,\n connector: IntegrationConnector,\n test: (connection: IntegrationConnection, connector: IntegrationConnector) => Promise<IntegrationActionResult | boolean> | IntegrationActionResult | boolean,\n): Promise<IntegrationHealthcheckCheck> {\n try {\n const result = await test(connection, connector)\n const ok = typeof result === 'boolean' ? result : result.ok\n return {\n id: 'provider-live-test',\n status: ok ? 'healthy' : 'unhealthy',\n message: ok ? 'Provider live test passed.' : 'Provider live test failed.',\n metadata: typeof result === 'boolean' ? undefined : { action: result.action, warnings: result.warnings },\n }\n } catch (error) {\n return {\n id: 'provider-live-test',\n status: 'unhealthy',\n message: error instanceof Error ? error.message : 'Provider live test failed.',\n }\n }\n}\n\nfunction rollupHealthStatus(checks: IntegrationHealthcheckCheck[]): IntegrationHealthcheckStatus {\n if (checks.some((check) => check.status === 'unhealthy')) return 'unhealthy'\n if (checks.some((check) => check.status === 'degraded')) return 'degraded'\n if (checks.some((check) => check.status === 'unknown')) return 'unknown'\n return 'healthy'\n}\n","import { CANONICAL_INTEGRATION_ACTIONS, canonicalActionConnectorId } from './actions.js'\nimport type {\n IntegrationManifest,\n IntegrationManifestResolution,\n IntegrationRequirement,\n IntegrationRequirementMode,\n} from './runtime.js'\n\nexport interface ManifestValidationIssue {\n path: string\n message: string\n}\n\nexport interface ManifestValidationResult {\n ok: boolean\n issues: ManifestValidationIssue[]\n}\n\nexport interface InferIntegrationRequirementsOptions {\n manifestId: string\n title?: string\n tools: Array<string | { action: string; reason?: string; mode?: IntegrationRequirementMode; connectorId?: string; scopes?: string[] }>\n metadata?: Record<string, unknown>\n}\n\nexport interface MissingRequirementExplanation {\n requirementId: string\n connectorId: string\n status: string\n message: string\n userAction: 'connect' | 'enable' | 'ignore_optional'\n}\n\nexport function validateIntegrationManifest(manifest: IntegrationManifest): ManifestValidationResult {\n const issues: ManifestValidationIssue[] = []\n if (!manifest.id?.trim()) issues.push({ path: 'id', message: 'Manifest id is required.' })\n if (!Array.isArray(manifest.requirements)) issues.push({ path: 'requirements', message: 'Requirements must be an array.' })\n const ids = new Set<string>()\n for (const [index, requirement] of (manifest.requirements ?? []).entries()) {\n const path = `requirements[${index}]`\n if (!requirement.id?.trim()) issues.push({ path: `${path}.id`, message: 'Requirement id is required.' })\n if (ids.has(requirement.id)) issues.push({ path: `${path}.id`, message: `Duplicate requirement id ${requirement.id}.` })\n ids.add(requirement.id)\n if (!requirement.connectorId?.trim()) issues.push({ path: `${path}.connectorId`, message: 'Connector id is required.' })\n if (!['read', 'write', 'trigger'].includes(requirement.mode)) issues.push({ path: `${path}.mode`, message: 'Mode must be read, write, or trigger.' })\n if (!requirement.reason?.trim()) issues.push({ path: `${path}.reason`, message: 'Human-readable reason is required.' })\n if (requirement.mode !== 'trigger' && !requirement.requiredActions?.length) {\n issues.push({ path: `${path}.requiredActions`, message: 'Non-trigger requirements should list required actions.' })\n }\n if (requirement.mode === 'trigger' && !requirement.requiredTriggers?.length) {\n issues.push({ path: `${path}.requiredTriggers`, message: 'Trigger requirements should list required triggers.' })\n }\n }\n return { ok: issues.length === 0, issues }\n}\n\nexport function assertValidIntegrationManifest(manifest: IntegrationManifest): void {\n const result = validateIntegrationManifest(manifest)\n if (!result.ok) {\n throw new Error(`Invalid integration manifest: ${result.issues.map((issue) => `${issue.path}: ${issue.message}`).join('; ')}`)\n }\n}\n\nexport function inferIntegrationManifestFromTools(options: InferIntegrationRequirementsOptions): IntegrationManifest {\n const byConnector = new Map<string, IntegrationRequirement>()\n for (const item of options.tools) {\n const action = typeof item === 'string' ? item : item.action\n const connectorId = typeof item === 'string' ? canonicalActionConnectorId(action) : item.connectorId ?? canonicalActionConnectorId(action)\n if (!connectorId) continue\n const mode = typeof item === 'string' ? inferMode(action) : item.mode ?? inferMode(action)\n const id = `${connectorId}-${mode}`\n const existing = byConnector.get(id)\n const reason = typeof item === 'string' ? defaultReason(connectorId, mode) : item.reason ?? defaultReason(connectorId, mode)\n if (existing) {\n byConnector.set(id, {\n ...existing,\n requiredActions: unique([...(existing.requiredActions ?? []), action]),\n requiredScopes: unique([...(existing.requiredScopes ?? []), ...(typeof item === 'string' ? [] : item.scopes ?? [])]),\n })\n } else {\n byConnector.set(id, {\n id,\n connectorId,\n mode,\n reason,\n requiredActions: mode === 'trigger' ? undefined : [action],\n requiredScopes: typeof item === 'string' ? undefined : item.scopes,\n })\n }\n }\n const manifest: IntegrationManifest = {\n id: options.manifestId,\n title: options.title,\n requirements: [...byConnector.values()],\n metadata: options.metadata,\n }\n assertValidIntegrationManifest(manifest)\n return manifest\n}\n\nexport function explainMissingRequirements(resolution: IntegrationManifestResolution): MissingRequirementExplanation[] {\n return [...resolution.missing, ...resolution.optionalMissing].map((item) => ({\n requirementId: item.requirement.id,\n connectorId: item.requirement.connectorId,\n status: item.status,\n message: item.message,\n userAction: item.requirement.optional ? 'ignore_optional' : item.status === 'not_executable' ? 'enable' : 'connect',\n }))\n}\n\nexport function calendarExercisePlannerManifest(id = 'exercise-calendar-planner'): IntegrationManifest {\n return {\n id,\n title: 'Exercise Calendar Planner',\n requirements: [{\n id: 'calendar-read',\n connectorId: 'google-calendar',\n mode: 'read',\n reason: 'Read busy and free calendar windows to recommend exercise sessions.',\n requiredActions: [CANONICAL_INTEGRATION_ACTIONS.googleCalendarEventsList],\n requiredScopes: ['https://www.googleapis.com/auth/calendar.readonly'],\n }],\n }\n}\n\nfunction inferMode(action: string): IntegrationRequirementMode {\n if (/(create|send|post|update|delete|write|comment|request)$/i.test(action)) return 'write'\n return 'read'\n}\n\nfunction defaultReason(connectorId: string, mode: IntegrationRequirementMode): string {\n if (connectorId === 'google-calendar' && mode === 'read') return 'Read calendar availability for the generated app.'\n if (connectorId === 'google-calendar' && mode === 'write') return 'Create or update calendar events after user approval.'\n return `${mode === 'read' ? 'Read from' : mode === 'write' ? 'Write to' : 'Subscribe to'} ${connectorId} for this app.`\n}\n\nfunction unique<T>(values: T[]): T[] {\n return [...new Set(values)]\n}\n","import { CANONICAL_INTEGRATION_ACTIONS } from './actions.js'\nimport { IntegrationRuntimeError } from './errors.js'\n\nexport interface ProviderHttpRequestInput {\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n path: string\n query?: Record<string, string | number | boolean | undefined>\n headers?: Record<string, string>\n body?: unknown\n}\n\nexport interface ProviderPassthroughPolicy {\n enabled: boolean\n allowedMethods?: ProviderHttpRequestInput['method'][]\n allowedPathPrefixes?: string[]\n maxBodyBytes?: number\n}\n\nexport const PROVIDER_PASSTHROUGH_ACTION = CANONICAL_INTEGRATION_ACTIONS.providerHttpRequest\n\nexport function validateProviderPassthroughRequest(\n input: ProviderHttpRequestInput,\n policy: ProviderPassthroughPolicy,\n): void {\n if (!policy.enabled) {\n throw new IntegrationRuntimeError({\n code: 'passthrough_disabled',\n message: 'Provider-native passthrough is disabled for this connector.',\n })\n }\n if (!input.path.startsWith('/')) {\n throw new IntegrationRuntimeError({ code: 'input_invalid', message: 'Provider passthrough path must start with /.' })\n }\n if (policy.allowedMethods?.length && !policy.allowedMethods.includes(input.method)) {\n throw new IntegrationRuntimeError({ code: 'action_denied', message: `Provider passthrough method ${input.method} is not allowed.` })\n }\n if (policy.allowedPathPrefixes?.length && !policy.allowedPathPrefixes.some((prefix) => input.path.startsWith(prefix))) {\n throw new IntegrationRuntimeError({ code: 'action_denied', message: `Provider passthrough path ${input.path} is not allowed.` })\n }\n const maxBodyBytes = policy.maxBodyBytes ?? 64 * 1024\n const bodyBytes = Buffer.byteLength(JSON.stringify(input.body ?? null), 'utf8')\n if (bodyBytes > maxBodyBytes) {\n throw new IntegrationRuntimeError({ code: 'input_invalid', message: `Provider passthrough body exceeds ${maxBodyBytes} bytes.` })\n }\n for (const key of Object.keys(input.headers ?? {})) {\n if (/authorization|cookie|token|secret|api[_-]?key/i.test(key)) {\n throw new IntegrationRuntimeError({ code: 'input_invalid', message: `Provider passthrough header ${key} is not caller-settable.` })\n }\n }\n}\n","import { StaticIntegrationPolicyEngine, type StaticIntegrationPolicyOptions } from './policy.js'\n\nexport interface PlatformIntegrationPolicyPresetOptions extends Omit<StaticIntegrationPolicyOptions, 'defaultReadEffect' | 'defaultWriteEffect' | 'defaultDestructiveEffect'> {\n allowWritesWithoutApproval?: boolean\n allowDestructiveActions?: boolean\n allowProviderPassthrough?: boolean\n}\n\nexport function createPlatformIntegrationPolicyPreset(options: PlatformIntegrationPolicyPresetOptions = {}): StaticIntegrationPolicyEngine {\n return new StaticIntegrationPolicyEngine({\n ...options,\n defaultReadEffect: 'allow',\n defaultWriteEffect: options.allowWritesWithoutApproval ? 'allow' : 'require_approval',\n defaultDestructiveEffect: options.allowDestructiveActions ? 'require_approval' : 'deny',\n rules: [\n ...(options.allowProviderPassthrough ? [] : [{\n id: 'deny-provider-native-passthrough',\n action: 'provider.http.request',\n effect: 'deny' as const,\n reason: 'Provider-native passthrough is disabled by default. Promote the connector action or enable passthrough explicitly.',\n }]),\n ...(options.rules ?? []),\n ],\n })\n}\n","import type {\n IntegrationActionResult,\n IntegrationApprovalRequest,\n IntegrationCapability,\n IntegrationConnector,\n InvokeWithCapabilityRequest,\n} from './index.js'\nimport { parseIntegrationToolName } from './catalog.js'\nimport { redactUnknown } from './redaction.js'\n\nexport interface IntegrationInvocationEnvelope {\n kind: 'integration.invocation'\n capabilityToken: string\n toolName: string\n action: string\n input?: unknown\n idempotencyKey: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationInvocationEnvelopeValidationOptions {\n connectors?: IntegrationConnector[]\n maxInputBytes?: number\n requireKnownTool?: boolean\n}\n\nexport type NormalizedIntegrationResult =\n | { status: 'ok'; action: string; output?: unknown; metadata?: Record<string, unknown> }\n | { status: 'approval_required'; action: string; approval: IntegrationApprovalRequest; metadata?: Record<string, unknown> }\n | { status: 'failed'; action: string; error: string; metadata?: Record<string, unknown> }\n\nexport interface IntegrationSandboxHostHub {\n invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult> | IntegrationActionResult\n}\n\nexport interface IntegrationSandboxHostOptions extends IntegrationInvocationEnvelopeValidationOptions {\n hub: IntegrationSandboxHostHub\n}\n\nexport function buildIntegrationInvocationEnvelope(input: {\n capabilityToken: string\n toolName: string\n args?: unknown\n idempotencyKey: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n maxInputBytes?: number\n}): IntegrationInvocationEnvelope {\n const parsed = parseIntegrationToolName(input.toolName)\n const envelope: IntegrationInvocationEnvelope = {\n kind: 'integration.invocation',\n capabilityToken: input.capabilityToken,\n toolName: input.toolName,\n action: parsed.actionId,\n input: input.args,\n idempotencyKey: input.idempotencyKey,\n dryRun: input.dryRun,\n metadata: input.metadata,\n }\n validateIntegrationInvocationEnvelope(envelope, { maxInputBytes: input.maxInputBytes })\n return envelope\n}\n\nexport function invocationRequestFromEnvelope(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationInvocationEnvelopeValidationOptions = {},\n): InvokeWithCapabilityRequest {\n validateIntegrationInvocationEnvelope(envelope, options)\n return {\n action: envelope.action,\n input: envelope.input,\n idempotencyKey: envelope.idempotencyKey,\n dryRun: envelope.dryRun,\n metadata: envelope.metadata,\n }\n}\n\nexport function validateIntegrationInvocationEnvelope(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationInvocationEnvelopeValidationOptions = {},\n): void {\n if (!envelope || typeof envelope !== 'object') throw new Error('Integration invocation envelope is required.')\n if (envelope.kind !== 'integration.invocation') throw new Error('Invalid integration invocation envelope kind.')\n if (!isNonEmptyString(envelope.capabilityToken)) throw new Error('Integration invocation envelope is missing capabilityToken.')\n if (!isNonEmptyString(envelope.toolName)) throw new Error('Integration invocation envelope is missing toolName.')\n if (!isNonEmptyString(envelope.action)) throw new Error('Integration invocation envelope is missing action.')\n if (!isNonEmptyString(envelope.idempotencyKey)) throw new Error('Integration invocation envelope is missing idempotencyKey.')\n if (envelope.metadata !== undefined && !isPlainRecord(envelope.metadata)) {\n throw new Error('Integration invocation envelope metadata must be an object.')\n }\n const parsed = parseIntegrationToolName(envelope.toolName)\n if (parsed.actionId !== envelope.action) {\n throw new Error(`Integration invocation action ${envelope.action} does not match tool ${parsed.actionId}.`)\n }\n const inputBytes = Buffer.byteLength(JSON.stringify(envelope.input ?? null), 'utf8')\n const maxInputBytes = options.maxInputBytes ?? 256 * 1024\n if (inputBytes > maxInputBytes) {\n throw new Error(`Integration invocation input exceeds ${maxInputBytes} bytes.`)\n }\n if (options.requireKnownTool || options.connectors) {\n if (!options.connectors) throw new Error('connectors are required when requireKnownTool is true.')\n const connector = options.connectors.find((candidate) =>\n candidate.providerId === parsed.providerId && candidate.id === parsed.connectorId\n )\n const action = connector?.actions.find((candidate) => candidate.id === parsed.actionId)\n if (!connector || !action) throw new Error(`Unknown integration tool ${envelope.toolName}.`)\n }\n}\n\nexport function redactInvocationEnvelope(envelope: IntegrationInvocationEnvelope): Omit<IntegrationInvocationEnvelope, 'capabilityToken'> & { capabilityToken: '[REDACTED]' } {\n return {\n ...envelope,\n capabilityToken: '[REDACTED]',\n input: redactUnknown(envelope.input),\n metadata: redactUnknown(envelope.metadata) as Record<string, unknown> | undefined,\n }\n}\n\nexport function redactCapability(capability: IntegrationCapability): IntegrationCapability {\n return {\n ...capability,\n metadata: redactUnknown(capability.metadata) as Record<string, unknown> | undefined,\n }\n}\n\nexport function normalizeIntegrationResult(result: IntegrationActionResult): NormalizedIntegrationResult {\n const output = result.output as { approvalRequired?: unknown; approval?: IntegrationApprovalRequest } | undefined\n if (!result.ok && output?.approvalRequired === true && output.approval) {\n return {\n status: 'approval_required',\n action: result.action,\n approval: output.approval,\n metadata: result.metadata,\n }\n }\n if (!result.ok) {\n return {\n status: 'failed',\n action: result.action,\n error: String(result.output ?? result.warnings?.[0] ?? 'integration action failed'),\n metadata: result.metadata,\n }\n }\n return {\n status: 'ok',\n action: result.action,\n output: result.output,\n metadata: result.metadata,\n }\n}\n\nexport async function dispatchIntegrationInvocation(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationSandboxHostOptions,\n): Promise<NormalizedIntegrationResult> {\n try {\n validateIntegrationInvocationEnvelope(envelope, options)\n const result = await options.hub.invokeWithCapability(\n envelope.capabilityToken,\n invocationRequestFromEnvelope(envelope, options),\n )\n return normalizeIntegrationResult(result)\n } catch (error) {\n return {\n status: 'failed',\n action: typeof envelope?.action === 'string' ? envelope.action : 'unknown',\n error: error instanceof Error ? error.message : 'Integration invocation failed.',\n }\n }\n}\n\nexport class IntegrationSandboxHost {\n private readonly options: IntegrationSandboxHostOptions\n\n constructor(options: IntegrationSandboxHostOptions) {\n this.options = options\n }\n\n dispatch(envelope: IntegrationInvocationEnvelope): Promise<NormalizedIntegrationResult> {\n return dispatchIntegrationInvocation(envelope, this.options)\n }\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.trim().length > 0\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value)\n}\n","import type {\n IntegrationActionRisk,\n IntegrationConnector,\n IntegrationConnectorAction,\n IntegrationConnectorCategory,\n IntegrationDataClass,\n} from './index.js'\n\nexport interface ImportCatalogOptions {\n providerId: string\n connectorId: string\n connectorTitle: string\n category?: IntegrationConnectorCategory\n auth?: IntegrationConnector['auth']\n scopes?: string[]\n dataClass?: IntegrationDataClass\n defaultRisk?: IntegrationActionRisk\n}\n\nexport interface OpenApiDocument {\n openapi?: string\n swagger?: string\n info?: { title?: string }\n paths?: Record<string, Record<string, OpenApiOperation | unknown>>\n}\n\nexport interface OpenApiOperation {\n operationId?: string\n summary?: string\n description?: string\n parameters?: unknown[]\n requestBody?: unknown\n responses?: unknown\n security?: Array<Record<string, string[]>>\n tags?: string[]\n}\n\nexport interface GraphqlOperationSpec {\n name: string\n kind: 'query' | 'mutation'\n description?: string\n inputSchema?: unknown\n outputSchema?: unknown\n requiredScopes?: string[]\n}\n\nexport interface McpCatalogTool {\n name: string\n description?: string\n inputSchema?: unknown\n annotations?: {\n readOnlyHint?: boolean\n destructiveHint?: boolean\n openWorldHint?: boolean\n title?: string\n }\n}\n\nexport interface McpCatalog {\n tools: McpCatalogTool[]\n}\n\nconst HTTP_METHODS = new Set(['get', 'post', 'put', 'patch', 'delete'])\n\nexport function importOpenApiConnector(document: OpenApiDocument, options: ImportCatalogOptions): IntegrationConnector {\n const actions: IntegrationConnectorAction[] = []\n for (const [path, methods] of Object.entries(document.paths ?? {})) {\n for (const [method, rawOperation] of Object.entries(methods)) {\n const normalizedMethod = method.toLowerCase()\n if (!HTTP_METHODS.has(normalizedMethod) || !isObject(rawOperation)) continue\n const operation = rawOperation as OpenApiOperation\n const operationId = operation.operationId ?? `${normalizedMethod}_${path.replace(/[^a-zA-Z0-9]+/g, '_').replace(/^_+|_+$/g, '')}`\n actions.push({\n id: operationId,\n title: operation.summary ?? titleFromId(operationId),\n risk: riskFromHttpMethod(normalizedMethod, operation, options.defaultRisk),\n requiredScopes: scopesFromOpenApiOperation(operation, options.scopes ?? []),\n dataClass: options.dataClass ?? 'private',\n description: operation.description ?? operation.summary ?? `${normalizedMethod.toUpperCase()} ${path}`,\n approvalRequired: riskFromHttpMethod(normalizedMethod, operation, options.defaultRisk) !== 'read',\n inputSchema: openApiInputSchema(path, normalizedMethod, operation),\n outputSchema: operation.responses,\n })\n }\n }\n return connectorFromActions(options, actions)\n}\n\nexport function importGraphqlConnector(operations: GraphqlOperationSpec[], options: ImportCatalogOptions): IntegrationConnector {\n return connectorFromActions(options, operations.map((operation) => ({\n id: operation.name,\n title: titleFromId(operation.name),\n risk: operation.kind === 'query' ? 'read' : options.defaultRisk ?? 'write',\n requiredScopes: operation.requiredScopes ?? options.scopes ?? [],\n dataClass: options.dataClass ?? 'private',\n description: operation.description,\n approvalRequired: operation.kind === 'mutation',\n inputSchema: operation.inputSchema,\n outputSchema: operation.outputSchema,\n })))\n}\n\nexport function importMcpConnector(catalog: McpCatalog, options: ImportCatalogOptions): IntegrationConnector {\n return connectorFromActions(options, catalog.tools.map((tool) => {\n const risk = riskFromMcpTool(tool, options.defaultRisk)\n return {\n id: tool.name,\n title: tool.annotations?.title ?? titleFromId(tool.name),\n risk,\n requiredScopes: options.scopes ?? [],\n dataClass: options.dataClass ?? 'private',\n description: tool.description,\n approvalRequired: risk !== 'read',\n inputSchema: tool.inputSchema,\n }\n }))\n}\n\nfunction connectorFromActions(options: ImportCatalogOptions, actions: IntegrationConnectorAction[]): IntegrationConnector {\n const scopes = unique([\n ...(options.scopes ?? []),\n ...actions.flatMap((action) => action.requiredScopes),\n ])\n return {\n id: options.connectorId,\n providerId: options.providerId,\n title: options.connectorTitle,\n category: options.category ?? 'other',\n auth: options.auth ?? 'custom',\n scopes,\n actions,\n metadata: { source: 'catalog-importer' },\n }\n}\n\nfunction riskFromHttpMethod(method: string, operation: OpenApiOperation, fallback?: IntegrationActionRisk): IntegrationActionRisk {\n if (method === 'get') return 'read'\n if (method === 'delete') return 'destructive'\n const text = `${operation.operationId ?? ''} ${operation.summary ?? ''} ${operation.description ?? ''}`.toLowerCase()\n if (/\\b(delete|remove|destroy|cancel|void|revoke|drop)\\b/.test(text)) return 'destructive'\n return fallback && fallback !== 'read' ? fallback : 'write'\n}\n\nfunction riskFromMcpTool(tool: McpCatalogTool, fallback?: IntegrationActionRisk): IntegrationActionRisk {\n if (tool.annotations?.destructiveHint) return 'destructive'\n if (tool.annotations?.readOnlyHint) return 'read'\n const text = `${tool.name} ${tool.description ?? ''}`.toLowerCase()\n if (/\\b(delete|remove|destroy|cancel|void|revoke|drop)\\b/.test(text)) return 'destructive'\n if (/\\b(get|list|read|search|find|fetch|query)\\b/.test(text)) return 'read'\n return fallback ?? 'write'\n}\n\nfunction scopesFromOpenApiOperation(operation: OpenApiOperation, fallback: string[]): string[] {\n const scopes = (operation.security ?? []).flatMap((entry) => Object.values(entry).flat())\n return unique(scopes.length > 0 ? scopes : fallback)\n}\n\nfunction openApiInputSchema(path: string, method: string, operation: OpenApiOperation): unknown {\n return {\n type: 'object',\n additionalProperties: true,\n properties: {\n path: { const: path },\n method: { const: method.toUpperCase() },\n parameters: { type: 'object', additionalProperties: true },\n body: operation.requestBody ?? { type: 'object', additionalProperties: true },\n },\n }\n}\n\nfunction titleFromId(id: string): string {\n return id\n .replace(/([a-z])([A-Z])/g, '$1 $2')\n .split(/[^a-zA-Z0-9]+/g)\n .filter(Boolean)\n .map((part) => part.slice(0, 1).toUpperCase() + part.slice(1))\n .join(' ')\n}\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value)\n}\n\nfunction unique<T>(values: T[]): T[] {\n return [...new Set(values)]\n}\n","import type {\n CompleteAuthRequest,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationConnection,\n IntegrationConnector,\n IntegrationConnectorAction,\n IntegrationConnectorCategory,\n IntegrationConnectorTrigger,\n IntegrationDataClass,\n IntegrationProvider,\n IntegrationProviderKind,\n StartAuthRequest,\n StartAuthResult,\n} from './index.js'\nimport { IntegrationError } from './index.js'\n\nexport interface GatewayCatalogProviderOptions {\n id: string\n kind: Extract<IntegrationProviderKind, 'nango' | 'pipedream' | 'activepieces' | 'tangle_catalog' | 'zapier' | 'executor' | 'custom'>\n fetchCatalog: () => Promise<GatewayCatalogEntry[]> | GatewayCatalogEntry[]\n startAuth?: (request: StartAuthRequest) => Promise<StartAuthResult> | StartAuthResult\n completeAuth?: (request: CompleteAuthRequest) => Promise<IntegrationConnection> | IntegrationConnection\n invokeAction?: (connection: IntegrationConnection, request: IntegrationActionRequest) => Promise<IntegrationActionResult> | IntegrationActionResult\n cacheTtlMs?: number\n now?: () => Date\n}\n\nexport interface GatewayCatalogEntry {\n id?: string\n key?: string\n name?: string\n title?: string\n category?: string\n auth?: 'oauth2' | 'api_key' | 'none' | 'custom' | string\n scopes?: string[]\n actions?: GatewayCatalogAction[]\n triggers?: GatewayCatalogTrigger[]\n metadata?: Record<string, unknown>\n}\n\nexport interface GatewayCatalogAction {\n id?: string\n key?: string\n name?: string\n title?: string\n description?: string\n risk?: 'read' | 'write' | 'destructive' | string\n scopes?: string[]\n requiredScopes?: string[]\n dataClass?: IntegrationDataClass | string\n approvalRequired?: boolean\n inputSchema?: unknown\n outputSchema?: unknown\n}\n\nexport interface GatewayCatalogTrigger {\n id?: string\n key?: string\n name?: string\n title?: string\n description?: string\n scopes?: string[]\n requiredScopes?: string[]\n dataClass?: IntegrationDataClass | string\n payloadSchema?: unknown\n}\n\nexport function createGatewayCatalogProvider(options: GatewayCatalogProviderOptions): IntegrationProvider {\n const now = options.now ?? (() => new Date())\n let cachedAt = 0\n let cached: IntegrationConnector[] | undefined\n\n async function listConnectors(): Promise<IntegrationConnector[]> {\n const ttl = options.cacheTtlMs ?? 60_000\n const current = now().getTime()\n if (cached && current - cachedAt < ttl) return cached\n const entries = await options.fetchCatalog()\n cached = normalizeGatewayCatalog(entries, {\n providerId: options.id,\n providerKind: options.kind,\n })\n cachedAt = current\n return cached\n }\n\n return {\n id: options.id,\n kind: options.kind,\n listConnectors,\n startAuth: options.startAuth,\n completeAuth: options.completeAuth,\n async invokeAction(connection, request) {\n if (!options.invokeAction) {\n throw new IntegrationError(`Gateway provider ${options.id} does not implement action invocation.`, 'action_not_found')\n }\n await assertKnownGatewayAction(await listConnectors(), connection.connectorId, request.action)\n return options.invokeAction(connection, request)\n },\n }\n}\n\nexport function normalizeGatewayCatalog(\n entries: GatewayCatalogEntry[],\n options: { providerId: string; providerKind: IntegrationProviderKind },\n): IntegrationConnector[] {\n const out: IntegrationConnector[] = []\n const seen = new Set<string>()\n for (const entry of entries) {\n const id = slug(entry.id ?? entry.key ?? entry.name ?? entry.title ?? '')\n if (!id || seen.has(id)) continue\n seen.add(id)\n const title = entry.title ?? entry.name ?? titleFromId(id)\n const actions = normalizeActions(entry.actions ?? [], entry.scopes ?? [])\n out.push({\n id,\n providerId: options.providerId,\n title,\n category: normalizeCategory(entry.category),\n auth: normalizeAuth(entry.auth),\n scopes: unique([\n ...(entry.scopes ?? []),\n ...actions.flatMap((action) => action.requiredScopes),\n ]),\n actions: actions.length > 0 ? actions : defaultActionsFor(entry.category, entry.scopes ?? []),\n triggers: normalizeTriggers(entry.triggers ?? [], entry.scopes ?? []),\n metadata: {\n ...(entry.metadata ?? {}),\n source: 'gateway-catalog',\n providerKind: options.providerKind,\n executable: true,\n },\n })\n }\n return out\n}\n\nasync function assertKnownGatewayAction(connectors: IntegrationConnector[], connectorId: string, actionId: string): Promise<void> {\n const connector = connectors.find((candidate) => candidate.id === connectorId)\n if (!connector) throw new IntegrationError(`Connector ${connectorId} not found.`, 'connector_not_found')\n if (!connector.actions.some((action) => action.id === actionId)) {\n throw new IntegrationError(`Action ${actionId} is not defined by connector ${connectorId}.`, 'action_not_found')\n }\n}\n\nfunction normalizeActions(actions: GatewayCatalogAction[], fallbackScopes: string[]): IntegrationConnectorAction[] {\n return actions.map((action) => {\n const id = slug(action.id ?? action.key ?? action.name ?? action.title ?? '')\n return {\n id,\n title: action.title ?? action.name ?? titleFromId(id),\n risk: normalizeRisk(action.risk),\n requiredScopes: unique([\n ...(action.requiredScopes ?? []),\n ...(action.scopes ?? []),\n ...((action.requiredScopes?.length || action.scopes?.length) ? [] : fallbackScopes),\n ]),\n dataClass: normalizeDataClass(action.dataClass),\n description: action.description,\n approvalRequired: action.approvalRequired ?? normalizeRisk(action.risk) !== 'read',\n inputSchema: action.inputSchema,\n outputSchema: action.outputSchema,\n }\n }).filter((action) => action.id)\n}\n\nfunction normalizeTriggers(triggers: GatewayCatalogTrigger[], fallbackScopes: string[]): IntegrationConnectorTrigger[] | undefined {\n const normalized = triggers.map((trigger) => {\n const id = slug(trigger.id ?? trigger.key ?? trigger.name ?? trigger.title ?? '')\n return {\n id,\n title: trigger.title ?? trigger.name ?? titleFromId(id),\n requiredScopes: unique([\n ...(trigger.requiredScopes ?? []),\n ...(trigger.scopes ?? []),\n ...((trigger.requiredScopes?.length || trigger.scopes?.length) ? [] : fallbackScopes),\n ]),\n dataClass: normalizeDataClass(trigger.dataClass),\n description: trigger.description,\n payloadSchema: trigger.payloadSchema,\n }\n }).filter((trigger) => trigger.id)\n return normalized.length > 0 ? normalized : undefined\n}\n\nfunction defaultActionsFor(category: string | undefined, scopes: string[]): IntegrationConnectorAction[] {\n const readScope = scopes.find((scope) => scope.endsWith('.read')) ?? scopes[0]\n const writeScope = scopes.find((scope) => scope.endsWith('.write')) ?? scopes[1] ?? readScope\n const requiredRead = readScope ? [readScope] : []\n const requiredWrite = writeScope ? [writeScope] : []\n const dataClass = normalizeDataClass(category === 'finance' || category === 'commerce' || category === 'hr' ? 'sensitive' : 'private')\n return [\n {\n id: 'records.search',\n title: 'Search records',\n risk: 'read',\n requiredScopes: requiredRead,\n dataClass,\n description: 'Search provider records.',\n },\n {\n id: 'records.read',\n title: 'Read record',\n risk: 'read',\n requiredScopes: requiredRead,\n dataClass,\n description: 'Read a provider record.',\n },\n {\n id: 'records.upsert',\n title: 'Upsert record',\n risk: 'write',\n requiredScopes: requiredWrite,\n dataClass,\n approvalRequired: true,\n description: 'Create or update a provider record.',\n },\n ]\n}\n\nfunction normalizeCategory(category: string | undefined): IntegrationConnectorCategory {\n const value = slug(category ?? '')\n if (value === 'mail') return 'email'\n if (value === 'messaging' || value === 'communication' || value === 'communications') return 'chat'\n if (value === 'file' || value === 'files') return 'storage'\n if (value === 'project-management' || value === 'automation') return 'workflow'\n if (value === 'developer' || value === 'devops') return 'workflow'\n if (value === 'support') return 'crm'\n if ([\n 'email',\n 'calendar',\n 'chat',\n 'crm',\n 'storage',\n 'docs',\n 'database',\n 'webhook',\n 'workflow',\n 'internal',\n 'other',\n ].includes(value)) return value as IntegrationConnectorCategory\n return 'other'\n}\n\nfunction normalizeAuth(auth: GatewayCatalogEntry['auth']): IntegrationConnector['auth'] {\n if (auth === 'oauth2') return 'oauth2'\n if (auth === 'api_key' || auth === 'api-key' || auth === 'apikey') return 'api_key'\n if (auth === 'none') return 'none'\n return 'custom'\n}\n\nfunction normalizeRisk(risk: GatewayCatalogAction['risk']): IntegrationConnectorAction['risk'] {\n if (risk === 'read' || risk === 'write' || risk === 'destructive') return risk\n return 'write'\n}\n\nfunction normalizeDataClass(dataClass: GatewayCatalogAction['dataClass']): IntegrationDataClass {\n if (dataClass === 'public' || dataClass === 'internal' || dataClass === 'private' || dataClass === 'sensitive' || dataClass === 'secret') return dataClass\n return 'private'\n}\n\nfunction slug(value: string): string {\n return value.trim().toLowerCase()\n .replace(/&/g, 'and')\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n}\n\nfunction titleFromId(id: string): string {\n return id.split('-').filter(Boolean).map((part) => part.slice(0, 1).toUpperCase() + part.slice(1)).join(' ')\n}\n\nfunction unique<T>(values: T[]): T[] {\n return [...new Set(values)]\n}\n","import type {\n IntegrationActor,\n IntegrationTriggerEvent,\n IntegrationTriggerSubscription,\n} from './index.js'\nimport {\n type IntegrationGrant,\n type IntegrationGrantStore,\n type IntegrationManifest,\n type IntegrationRuntime,\n} from './runtime.js'\n\nexport interface IntegrationWorkflowDefinition {\n id: string\n title?: string\n manifest: IntegrationManifest\n trigger: {\n requirementId: string\n triggerId: string\n targetUrl?: string\n }\n metadata?: Record<string, unknown>\n}\n\nexport interface InstalledIntegrationWorkflow {\n id: string\n workflowId: string\n manifestId: string\n owner: IntegrationActor\n grantee: IntegrationActor\n triggerGrantId: string\n subscription: IntegrationTriggerSubscription\n status: 'active' | 'paused' | 'error'\n createdAt: string\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationWorkflowStore {\n put(workflow: InstalledIntegrationWorkflow): Promise<void> | void\n get(id: string): Promise<InstalledIntegrationWorkflow | undefined> | InstalledIntegrationWorkflow | undefined\n list(): Promise<InstalledIntegrationWorkflow[]> | InstalledIntegrationWorkflow[]\n listByWorkflow(workflowId: string): Promise<InstalledIntegrationWorkflow[]> | InstalledIntegrationWorkflow[]\n listByOwner(owner: IntegrationActor): Promise<InstalledIntegrationWorkflow[]> | InstalledIntegrationWorkflow[]\n}\n\nexport interface IntegrationWorkflowRuntimeHub {\n subscribeTrigger(connectionId: string, trigger: string, targetUrl?: string): Promise<IntegrationTriggerSubscription> | IntegrationTriggerSubscription\n}\n\nexport interface IntegrationWorkflowRuntimeOptions {\n runtime: IntegrationRuntime\n hub: IntegrationWorkflowRuntimeHub\n grants: IntegrationGrantStore\n store?: IntegrationWorkflowStore\n now?: () => Date\n}\n\nexport class InMemoryIntegrationWorkflowStore implements IntegrationWorkflowStore {\n private readonly workflows = new Map<string, InstalledIntegrationWorkflow>()\n\n put(workflow: InstalledIntegrationWorkflow): void {\n this.workflows.set(workflow.id, workflow)\n }\n\n get(id: string): InstalledIntegrationWorkflow | undefined {\n return this.workflows.get(id)\n }\n\n list(): InstalledIntegrationWorkflow[] {\n return [...this.workflows.values()]\n }\n\n listByWorkflow(workflowId: string): InstalledIntegrationWorkflow[] {\n return [...this.workflows.values()].filter((workflow) => workflow.workflowId === workflowId)\n }\n\n listByOwner(owner: IntegrationActor): InstalledIntegrationWorkflow[] {\n return [...this.workflows.values()].filter((workflow) => sameActor(workflow.owner, owner))\n }\n}\n\nexport class IntegrationWorkflowRuntime {\n private readonly runtime: IntegrationRuntime\n private readonly hub: IntegrationWorkflowRuntimeHub\n private readonly grants: IntegrationGrantStore\n private readonly store: IntegrationWorkflowStore\n private readonly now: () => Date\n\n constructor(options: IntegrationWorkflowRuntimeOptions) {\n this.runtime = options.runtime\n this.hub = options.hub\n this.grants = options.grants\n this.store = options.store ?? new InMemoryIntegrationWorkflowStore()\n this.now = options.now ?? (() => new Date())\n }\n\n async install(input: {\n workflow: IntegrationWorkflowDefinition\n owner: IntegrationActor\n grantee: IntegrationActor\n }): Promise<InstalledIntegrationWorkflow> {\n const grants = await this.runtime.createGrants({\n manifest: input.workflow.manifest,\n owner: input.owner,\n grantee: input.grantee,\n metadata: { workflowId: input.workflow.id },\n })\n const triggerGrant = findTriggerGrant(grants, input.workflow.trigger.requirementId, input.workflow.trigger.triggerId)\n const subscription = await this.hub.subscribeTrigger(\n triggerGrant.connectionId,\n input.workflow.trigger.triggerId,\n input.workflow.trigger.targetUrl,\n )\n const installed: InstalledIntegrationWorkflow = {\n id: `workflow_${input.workflow.id}_${triggerGrant.id}`,\n workflowId: input.workflow.id,\n manifestId: input.workflow.manifest.id,\n owner: input.owner,\n grantee: input.grantee,\n triggerGrantId: triggerGrant.id,\n subscription,\n status: 'active',\n createdAt: this.now().toISOString(),\n metadata: input.workflow.metadata,\n }\n await this.store.put(installed)\n return installed\n }\n\n async dispatchEvent<T = unknown>(\n event: IntegrationTriggerEvent<T>,\n handler: (input: { event: IntegrationTriggerEvent<T>; workflows: InstalledIntegrationWorkflow[] }) => Promise<void> | void,\n ): Promise<{ matched: InstalledIntegrationWorkflow[] }> {\n // A workflow outlives its installation-time grant. Recheck the current\n // grant before routing a new event; an active subscription is not authority.\n // This assumes verified ingress. Deferred effects must recheck authority\n // again at execution time rather than treating this snapshot as a lease.\n const candidates = (await this.store.list()).filter((workflow) =>\n workflow.status === 'active'\n && workflow.subscription.status === 'active'\n && workflow.subscription.connectionId === event.connectionId\n && workflow.subscription.trigger === event.trigger\n )\n // One batched read keeps webhook latency flat as a trigger fans out to\n // many workflows backed by a remote grant store.\n const grantIds = [...new Set(candidates.map((workflow) => workflow.triggerGrantId))]\n const grants = grantIds.length === 0\n ? []\n : this.grants.listByIds\n ? await this.grants.listByIds(grantIds)\n : await Promise.all(grantIds.map((grantId) => this.grants.get(grantId)))\n const grantsById = new Map(\n grants\n .filter((grant): grant is IntegrationGrant => Boolean(grant))\n .map((grant) => [grant.id, grant]),\n )\n const workflows = candidates.filter((workflow) => {\n const grant = grantsById.get(workflow.triggerGrantId)\n if (!grant) return false\n return grant.status === 'active'\n && grant.manifestId === workflow.manifestId\n && sameActor(grant.owner, workflow.owner)\n && sameActor(grant.grantee, workflow.grantee)\n && grant.connectionId === event.connectionId\n && grant.connectorId === event.connectorId\n && grant.allowedTriggers.includes(event.trigger)\n })\n await handler({ event, workflows })\n return { matched: workflows }\n }\n}\n\nexport function createIntegrationWorkflowRuntime(options: IntegrationWorkflowRuntimeOptions): IntegrationWorkflowRuntime {\n return new IntegrationWorkflowRuntime(options)\n}\n\nfunction findTriggerGrant(grants: IntegrationGrant[], requirementId: string, triggerId: string): IntegrationGrant {\n const grant = grants.find((candidate) =>\n candidate.requirementId === requirementId && candidate.allowedTriggers.includes(triggerId)\n )\n if (!grant) throw new Error(`Missing trigger grant ${requirementId}/${triggerId}.`)\n return grant\n}\n\nfunction sameActor(a: IntegrationActor, b: IntegrationActor): boolean {\n return a.type === b.type && a.id === b.id\n}\n","import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto'\nimport {\n composeIntegrationRegistry,\n type ComposeIntegrationRegistryOptions,\n type IntegrationRegistry,\n} from './registry.js'\nimport {\n InMemoryIntegrationOAuthStateStore,\n InMemoryIntegrationSecretStore,\n type IntegrationOAuthState,\n} from './credentials.js'\nimport { IntegrationError } from './core-error.js'\nimport type {\n CompleteAuthRequest,\n HttpIntegrationProviderOptions,\n IntegrationActionGuard,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationActor,\n IntegrationCapability,\n IntegrationConnection,\n IntegrationConnectionStore,\n IntegrationConnector,\n IntegrationHubOptions,\n IntegrationPolicyEngine,\n IntegrationProvider,\n IntegrationTriggerEvent,\n IntegrationTriggerSubscription,\n InvokeWithCapabilityRequest,\n IssueCapabilityRequest,\n IssuedIntegrationCapability,\n StartAuthRequest,\n StartAuthResult,\n} from './core-types.js'\n\nexport * from './core-types.js'\nexport * from './core-error.js'\nexport * from './audit.js'\nexport * from './approval.js'\nexport * from './actions.js'\nexport * from './bridge.js'\nexport * from './billing-access-policy.js'\nexport * from './idempotency.js'\nexport * from './apps.js'\nexport * from './client.js'\nexport * from './consumer.js'\nexport * from './consent.js'\nexport * from './credentials.js'\nexport * from './discovery.js'\nexport * from './errors.js'\nexport * from './events.js'\nexport * from './guard.js'\nexport * from './healthcheck.js'\nexport * from './manifest.js'\nexport * from './passthrough.js'\nexport * from './presets.js'\nexport * from './connect/index.js'\nexport * from './middleware/index.js'\n\nexport class InMemoryConnectionStore implements IntegrationConnectionStore {\n private readonly connections = new Map<string, IntegrationConnection>()\n\n get(connectionId: string): IntegrationConnection | undefined {\n return this.connections.get(connectionId)\n }\n\n put(connection: IntegrationConnection): void {\n this.connections.set(connection.id, connection)\n }\n\n listByOwner(owner: IntegrationActor): IntegrationConnection[] {\n return [...this.connections.values()].filter((connection) =>\n connection.owner.type === owner.type && connection.owner.id === owner.id,\n )\n }\n\n delete(connectionId: string): void {\n this.connections.delete(connectionId)\n }\n}\n\nexport class IntegrationHub {\n private readonly providers = new Map<string, IntegrationProvider>()\n private readonly store: IntegrationConnectionStore\n private readonly capabilitySecret: string\n private readonly guard: IntegrationActionGuard | undefined\n private readonly policy: IntegrationPolicyEngine | undefined\n /** Host-injected (or in-memory default) secret store. The hub re-persists\n * rotated credentials here when a connection carries a secretRef. */\n readonly secretStore: IntegrationHubOptions['secretStore']\n private readonly oauthStateStore: NonNullable<IntegrationHubOptions['oauthStateStore']>\n private readonly oauthStateTtlMs: number\n private readonly credentialsRotated: IntegrationHubOptions['credentialsRotated']\n private readonly now: () => Date\n\n constructor(options: IntegrationHubOptions) {\n if (!options.capabilitySecret) {\n throw new IntegrationError('capabilitySecret is required.', 'capability_invalid')\n }\n for (const provider of options.providers) this.providers.set(provider.id, provider)\n this.store = options.store\n this.capabilitySecret = options.capabilitySecret\n this.guard = options.guard\n this.policy = options.policy\n this.secretStore = options.secretStore ?? new InMemoryIntegrationSecretStore()\n this.oauthStateStore = options.oauthStateStore ?? new InMemoryIntegrationOAuthStateStore()\n this.oauthStateTtlMs = options.oauthStateTtlMs ?? 10 * 60 * 1000\n this.credentialsRotated = options.credentialsRotated\n this.now = options.now ?? (() => new Date())\n }\n\n async listConnectors(): Promise<IntegrationConnector[]> {\n const catalogs = await Promise.all([...this.providers.values()].map((provider) => provider.listConnectors()))\n return catalogs.flat()\n }\n\n async listRegistry(options: ComposeIntegrationRegistryOptions = {}): Promise<IntegrationRegistry> {\n const sources = await Promise.all([...this.providers.values()].map(async (provider) => ({\n id: provider.id,\n connectors: await provider.listConnectors(),\n })))\n return composeIntegrationRegistry(sources, options)\n }\n\n async startAuth(providerId: string, request: StartAuthRequest): Promise<StartAuthResult> {\n const provider = this.requireProvider(providerId)\n if (!provider.startAuth) throw new IntegrationError(`Provider ${providerId} does not support auth start.`, 'auth_not_supported')\n const connector = await this.requireConnector(provider, request.connectorId)\n const pkce = connectorOAuthPkceMode(connector)\n const pkcePair = pkce === 'unsupported' ? undefined : createPkcePair()\n const result = await provider.startAuth({\n ...request,\n codeChallenge: pkcePair?.challenge,\n })\n const record: IntegrationOAuthState = {\n state: result.state,\n providerId,\n connectorId: request.connectorId,\n owner: request.owner,\n requestedScopes: request.requestedScopes,\n redirectUri: request.redirectUri,\n codeVerifier: pkcePair?.verifier,\n expiresAt: this.now().getTime() + this.oauthStateTtlMs,\n metadata: request.metadata,\n }\n await this.oauthStateStore.put(record)\n return result\n }\n\n async completeAuth(providerId: string, request: CompleteAuthRequest): Promise<IntegrationConnection> {\n const provider = this.requireProvider(providerId)\n if (!provider.completeAuth) throw new IntegrationError(`Provider ${providerId} does not support auth completion.`, 'auth_not_supported')\n const outcome = await this.oauthStateStore.consume(request.state)\n if (!outcome.ok) {\n throw new IntegrationError(`Integration OAuth state ${outcome.reason}: possible CSRF, replay, or stale flow.`, 'capability_invalid')\n }\n if (outcome.state.providerId !== providerId || outcome.state.connectorId !== request.connectorId) {\n throw new IntegrationError('Integration OAuth state does not match completion request.', 'capability_invalid')\n }\n if (outcome.state.redirectUri !== request.redirectUri) {\n throw new IntegrationError('Integration OAuth redirect URI does not match the start request.', 'capability_invalid')\n }\n const pinnedMetadata = request.metadata || outcome.state.metadata\n ? { ...request.metadata, ...outcome.state.metadata }\n : undefined\n const connection = await provider.completeAuth({\n ...request,\n connectorId: outcome.state.connectorId,\n owner: outcome.state.owner,\n state: outcome.state.state,\n redirectUri: outcome.state.redirectUri,\n codeVerifier: outcome.state.codeVerifier,\n metadata: pinnedMetadata,\n })\n await this.store.put(connection)\n return connection\n }\n\n async upsertConnection(connection: IntegrationConnection): Promise<IntegrationConnection> {\n await this.store.put(connection)\n return connection\n }\n\n async listConnections(owner: IntegrationActor): Promise<IntegrationConnection[]> {\n return this.store.listByOwner(owner)\n }\n\n async getConnection(connectionId: string): Promise<IntegrationConnection | undefined> {\n return this.store.get(connectionId)\n }\n\n async issueCapability(request: IssueCapabilityRequest): Promise<IssuedIntegrationCapability> {\n const connection = await this.requireConnection(request.connectionId)\n this.assertConnectionActive(connection)\n assertScopes(connection, request.scopes)\n const now = this.now()\n const capability: IntegrationCapability = {\n id: `cap_${randomUUID()}`,\n subject: request.subject,\n connectionId: request.connectionId,\n scopes: unique(request.scopes),\n allowedActions: unique(request.allowedActions),\n issuedAt: now.toISOString(),\n expiresAt: new Date(now.getTime() + request.ttlMs).toISOString(),\n metadata: request.metadata,\n }\n return { capability, token: signCapability(capability, this.capabilitySecret) }\n }\n\n verifyCapability(token: string): IntegrationCapability {\n const capability = verifyCapabilityToken(token, this.capabilitySecret)\n if (Date.parse(capability.expiresAt) <= this.now().getTime()) {\n throw new IntegrationError('Integration capability expired.', 'capability_expired')\n }\n return capability\n }\n\n async invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult> {\n const capability = this.verifyCapability(token)\n if (!capability.allowedActions.includes(request.action)) {\n throw new IntegrationError(`Capability does not allow action ${request.action}.`, 'action_denied')\n }\n const connection = await this.requireConnection(capability.connectionId)\n this.assertConnectionActive(connection)\n const provider = this.requireProvider(connection.providerId)\n const connector = await this.requireConnector(provider, connection.connectorId)\n const action = connector.actions.find((candidate) => candidate.id === request.action)\n if (!action) throw new IntegrationError(`Action ${request.action} is not defined by connector ${connector.id}.`, 'action_not_found')\n assertScopes(connection, action.requiredScopes)\n assertScopes({ ...connection, grantedScopes: capability.scopes }, action.requiredScopes)\n const fullRequest: IntegrationActionRequest = { ...request, connectionId: connection.id }\n const proceed = async () => {\n if (!this.policy) return provider.invokeAction(connection, fullRequest)\n const decision = await this.policy.decide({\n connection,\n request: fullRequest,\n action,\n subject: capability.subject,\n })\n if (decision.decision === 'deny') {\n throw new IntegrationError(decision.reason, 'policy_denied')\n }\n if (decision.decision === 'require_approval') {\n return {\n ok: false,\n action: request.action,\n output: { approvalRequired: true, approval: decision.approval },\n metadata: { policyDecision: decision.decision, reason: decision.reason, ...decision.metadata },\n }\n }\n return provider.invokeAction(connection, fullRequest)\n }\n if (this.guard) {\n return this.guard.invokeAction({ connection, request: fullRequest, action }, proceed)\n }\n return proceed()\n }\n\n async subscribeTrigger(connectionId: string, trigger: string, targetUrl?: string): Promise<IntegrationTriggerSubscription> {\n const connection = await this.requireConnection(connectionId)\n this.assertConnectionActive(connection)\n const provider = this.requireProvider(connection.providerId)\n const connector = await this.requireConnector(provider, connection.connectorId)\n const spec = connector.triggers?.find((candidate) => candidate.id === trigger)\n if (!spec) throw new IntegrationError(`Trigger ${trigger} is not defined by connector ${connector.id}.`, 'trigger_not_found')\n assertScopes(connection, spec.requiredScopes)\n if (!provider.subscribeTrigger) {\n throw new IntegrationError(`Provider ${provider.id} does not support triggers.`, 'auth_not_supported')\n }\n return provider.subscribeTrigger(connection, trigger, targetUrl)\n }\n\n private requireProvider(providerId: string): IntegrationProvider {\n const provider = this.providers.get(providerId)\n if (!provider) throw new IntegrationError(`Provider ${providerId} not found.`, 'provider_not_found')\n return provider\n }\n\n private async requireConnector(provider: IntegrationProvider, connectorId: string): Promise<IntegrationConnector> {\n const connector = (await provider.listConnectors()).find((candidate) => candidate.id === connectorId)\n if (!connector) throw new IntegrationError(`Connector ${connectorId} not found.`, 'connector_not_found')\n return connector\n }\n\n private async requireConnection(connectionId: string): Promise<IntegrationConnection> {\n const connection = await this.store.get(connectionId)\n if (!connection) throw new IntegrationError(`Connection ${connectionId} not found.`, 'connection_not_found')\n return connection\n }\n\n private assertConnectionActive(connection: IntegrationConnection): void {\n if (connection.status !== 'active') {\n throw new IntegrationError(`Connection ${connection.id} is ${connection.status}.`, 'connection_not_active')\n }\n if (connection.expiresAt && Date.parse(connection.expiresAt) <= this.now().getTime()) {\n throw new IntegrationError(`Connection ${connection.id} is expired.`, 'connection_not_active')\n }\n }\n}\n\nexport function sanitizeConnection(connection: IntegrationConnection): Record<string, unknown> {\n return {\n id: connection.id,\n owner: connection.owner,\n providerId: connection.providerId,\n connectorId: connection.connectorId,\n status: connection.status,\n grantedScopes: connection.grantedScopes,\n account: connection.account,\n hasSecretRef: Boolean(connection.secretRef),\n createdAt: connection.createdAt,\n updatedAt: connection.updatedAt,\n expiresAt: connection.expiresAt,\n lastUsedAt: connection.lastUsedAt,\n }\n}\n\nexport function createMockIntegrationProvider(options: {\n id?: string\n connectors?: IntegrationConnector[]\n onInvoke?: (connection: IntegrationConnection, request: IntegrationActionRequest) => IntegrationActionResult | Promise<IntegrationActionResult>\n} = {}): IntegrationProvider {\n const providerId = options.id ?? 'mock'\n const connectors = options.connectors ?? [{\n id: 'gmail',\n providerId,\n title: 'Gmail',\n category: 'email',\n auth: 'oauth2',\n scopes: ['email.read', 'email.write'],\n actions: [\n { id: 'messages.search', title: 'Search messages', risk: 'read', requiredScopes: ['email.read'], dataClass: 'private' },\n { id: 'drafts.create', title: 'Create draft', risk: 'write', requiredScopes: ['email.write'], dataClass: 'private', approvalRequired: true },\n ],\n triggers: [\n { id: 'message.received', title: 'Message received', requiredScopes: ['email.read'], dataClass: 'private' },\n ],\n }]\n return {\n id: providerId,\n kind: 'custom',\n listConnectors: () => connectors,\n startAuth: (request) => ({\n providerId,\n connectorId: request.connectorId,\n authUrl: `https://auth.example.test/${request.connectorId}?state=${encodeURIComponent(request.state ?? 'state')}`,\n state: request.state ?? 'state',\n }),\n completeAuth: (request) => ({\n id: `conn_${request.connectorId}_${request.owner.id}`,\n owner: request.owner,\n providerId,\n connectorId: request.connectorId,\n status: 'active',\n grantedScopes: connectors.find((connector) => connector.id === request.connectorId)?.scopes ?? [],\n secretRef: { provider: providerId, id: `secret_${request.owner.id}` },\n createdAt: new Date(0).toISOString(),\n updatedAt: new Date(0).toISOString(),\n }),\n invokeAction: async (connection, request) => options.onInvoke?.(connection, request) ?? ({\n ok: true,\n action: request.action,\n output: { echo: request.input ?? null },\n }),\n subscribeTrigger: (connection, trigger, targetUrl) => ({\n id: `sub_${connection.id}_${trigger}`,\n connectionId: connection.id,\n trigger,\n targetUrl,\n status: 'active',\n createdAt: new Date(0).toISOString(),\n }),\n }\n}\n\nexport function createHttpIntegrationProvider(options: HttpIntegrationProviderOptions): IntegrationProvider {\n const fetcher = options.fetchImpl ?? fetch\n const baseUrl = options.baseUrl.replace(/\\/$/, '')\n return {\n id: options.id,\n kind: options.kind ?? 'custom',\n listConnectors: () => options.connectors,\n async startAuth(request) {\n const response = await postJson<StartAuthResult>(fetcher, `${baseUrl}/auth/start`, request, options.bearer)\n return response\n },\n async completeAuth(request) {\n const response = await postJson<IntegrationConnection>(fetcher, `${baseUrl}/auth/complete`, request, options.bearer)\n return response\n },\n async invokeAction(connection, request) {\n return postJson<IntegrationActionResult>(fetcher, `${baseUrl}/actions/invoke`, {\n connection,\n request,\n }, options.bearer)\n },\n async subscribeTrigger(connection, trigger, targetUrl) {\n return postJson<IntegrationTriggerSubscription>(fetcher, `${baseUrl}/triggers/subscribe`, {\n connection,\n trigger,\n targetUrl,\n }, options.bearer)\n },\n async unsubscribeTrigger(subscriptionId) {\n await postJson(fetcher, `${baseUrl}/triggers/unsubscribe`, { subscriptionId }, options.bearer)\n },\n async normalizeTriggerEvent(raw) {\n return postJson<IntegrationTriggerEvent>(fetcher, `${baseUrl}/triggers/normalize`, { raw }, options.bearer)\n },\n }\n}\n\nexport function signCapability(capability: IntegrationCapability, secret: string): string {\n const payload = base64UrlEncode(JSON.stringify(capability))\n const signature = hmac(payload, secret)\n return `${payload}.${signature}`\n}\n\nexport function verifyCapabilityToken(token: string, secret: string): IntegrationCapability {\n const [payload, signature] = token.split('.')\n if (!payload || !signature) throw new IntegrationError('Malformed integration capability.', 'capability_invalid')\n const expected = hmac(payload, secret)\n if (!constantTimeEqual(signature, expected)) throw new IntegrationError('Invalid integration capability signature.', 'capability_invalid')\n let parsed: IntegrationCapability\n try {\n parsed = JSON.parse(base64UrlDecode(payload)) as IntegrationCapability\n } catch {\n throw new IntegrationError('Invalid integration capability payload.', 'capability_invalid')\n }\n if (!parsed.id || !parsed.connectionId || !Array.isArray(parsed.scopes) || !Array.isArray(parsed.allowedActions)) {\n throw new IntegrationError('Invalid integration capability payload.', 'capability_invalid')\n }\n return parsed\n}\n\nasync function postJson<T = unknown>(\n fetcher: typeof fetch,\n url: string,\n body: unknown,\n bearer?: string,\n): Promise<T> {\n const response = await fetcher(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(bearer ? { Authorization: `Bearer ${bearer}` } : {}),\n },\n body: JSON.stringify(body),\n })\n if (!response.ok) throw new IntegrationError(`Integration provider returned HTTP ${response.status}.`, 'provider_not_found')\n return response.json() as Promise<T>\n}\n\nfunction assertScopes(connection: Pick<IntegrationConnection, 'grantedScopes'>, requiredScopes: string[]): void {\n const missing = requiredScopes.filter((scope) => !connection.grantedScopes.includes(scope))\n if (missing.length > 0) throw new IntegrationError(`Missing integration scopes: ${missing.join(', ')}`, 'scope_denied')\n}\n\ntype IntegrationOAuthPkceMode = 'required' | 'supported' | 'unsupported'\n\nfunction connectorOAuthPkceMode(connector: IntegrationConnector): IntegrationOAuthPkceMode {\n const value = connector.metadata?.oauthPkce\n if (value === undefined) return 'required'\n if (value === 'required' || value === 'supported' || value === 'unsupported') return value\n throw new IntegrationError(\n `Connector ${connector.id} declares an invalid OAuth PKCE posture.`,\n 'config_missing',\n )\n}\n\nfunction createPkcePair(): { verifier: string; challenge: string } {\n const verifier = randomBytes(48).toString('base64url')\n const challenge = createHash('sha256').update(verifier).digest('base64url')\n return { verifier, challenge }\n}\n\nfunction hmac(payload: string, secret: string): string {\n return createHmac('sha256', secret).update(payload).digest('base64url')\n}\n\nfunction constantTimeEqual(a: string, b: string): boolean {\n const left = Buffer.from(a)\n const right = Buffer.from(b)\n return left.length === right.length && timingSafeEqual(left, right)\n}\n\nfunction base64UrlEncode(value: string): string {\n return Buffer.from(value, 'utf8').toString('base64url')\n}\n\nfunction base64UrlDecode(value: string): string {\n return Buffer.from(value, 'base64url').toString('utf8')\n}\n\nfunction unique<T>(values: T[]): T[] {\n return [...new Set(values)]\n}\n\n// ─── Connectors namespace ───────────────────────────────────────────────\n//\n// Lower-level adapter primitives — the contract a concrete first-party\n// integration (Google Calendar, HubSpot, Stripe, ...) implements. The\n// hub-side `IntegrationProvider` interface is the *catalog* facade above\n// these; one provider can wrap many connectors. See `src/connectors/types.ts`\n// for the layering details.\nexport * from './connectors/index.js'\nexport * from './catalog.js'\nexport * from './catalog-executor.js'\nexport * from './policy.js'\nexport * from './sandbox.js'\nexport * from './adapter-provider.js'\nexport * from './importers.js'\nexport * from './gateway-catalog.js'\nexport * from './activepieces-catalog.js'\nexport * from './activepieces-overrides.js'\nexport * from './activepieces-provider.js'\nexport * from './tangle-catalog.js'\nexport * from './catalog-freshness.js'\nexport * from './registry.js'\nexport * from './runtime.js'\nexport * from './workflow.js'\nexport * from './coverage-catalog.js'\nexport * from './integration-kind-aliases.js'\nexport * from './specs/index.js'\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,MAAa,yBAAoE;CAC/E,OAAO;EACL,UAAU;EACV,aAAa;GACX,sBAAsB;GACtB,6BAA6B;GAC7B,0BAA0B;GAC1B,iCAAiC;G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