1/** 2 * apps/worker — integration adapter registry (TASK-0112 §2, Phase-13 hook). 3 * 4 * The CALL_INTEGRATION executor looks up the adapter for the integration's 5 * `provider` here. Phase 11 ships the registry EMPTY: every provider 6 * resolves to `undefined` → the executor fails with the FATAL 7 * INTEGRATION_NOT_AVAILABLE (Phase 13). Phase 13 fills the map with real 8 * adapters (GitHub/Slack/…) without touching the executor. 9 * 10 * An adapter is a thin, provider-specific implementation of the executor 11 * surface: it validates `params` against the provider's operation contract 12 * and performs the side effect, returning the standard ActionResult. 13 */ 14import type { ActionExecutor, ActionResult, AutomationRunContext, ExecutorDeps } from "./types.js"; 15 16export interface IntegrationAdapter { 17 /** The provider name this adapter handles (the Integration.provider value). */ 18 provider: string; 19 execute(cfg: Record<string, unknown>, ctx: AutomationRunContext, deps: ExecutorDeps): Promise<ActionResult>; 20} 21 22/** Provider → adapter. Empty until Phase 13. */ 23const adapters = new Map<string, IntegrationAdapter>(); 24 25/** Register an adapter (Phase 13). */ 26export function registerAdapter(adapter: IntegrationAdapter): void { 27 adapters.set(adapter.provider, adapter); 28} 29 30/** Look up an adapter by provider name (undefined → not available). */ 31export function adapterFor(provider: string): IntegrationAdapter | undefined { 32 return adapters.get(provider); 33} 34 35export type { ActionExecutor }; 36