/** * Built-in adapter registry — enumerates `src/lib/adapters/*` at startup and * builds a `Record` plus the Zod discriminated union * for `SourceConfig`. * * `buildRegistry` is the pure logic (takes a directory-name list + a loader); * `adapterRegistry` is the production IIFE that points at the on-disk * `src/lib/adapters/` tree via `import.meta.dirname` + dynamic `import()`. * Path resolution lets the same code work in dev (tsx → `src/lib/adapters/*.ts`) * and prod (built → `dist/lib/adapters/*.js`). */ import { z } from "zod"; import type { AdapterDefinition } from "../adapterDefinition.ts"; import { type DiscoveredManifest } from "./shell/discovery.ts"; export type AdapterLoader = (directoryName: string) => Promise; /** * Pure logic: given a list of subdirectory names and an async loader, build a * `kind → AdapterDefinition` registry. Enforces directory-name === kind and * rejects duplicate kinds. No filesystem or import side effects of its own. */ export declare function buildRegistry(directoryNames: readonly string[], loader: AdapterLoader): Promise>; /** * Build the Zod schema for `SourceConfig` from a registry. * - 0 adapters → `z.never()` so any config is rejected (defensive — should * not occur in practice because the built-in linear and shell adapters * are always present). * - 1 adapter → that adapter's schema directly. * - 2+ adapters → `z.union(...)` over each adapter's schema. We use `z.union` * rather than `z.discriminatedUnion` so we don't have to convince the type * system that every adapter's configSchema is a discriminable type — * semantically equivalent here because each kind has a unique literal. */ export declare function buildSourceConfigSchema(registry: Record): z.ZodType; /** * Fold discovered manifest sources into a code-adapter registry. Each becomes * an adapter keyed by its manifest name. A manifest may not shadow a built-in * code-adapter kind (`linear`, `shell`, `todo-txt`) - those are reserved, so a * collision is a hard error. Manifest-vs-manifest precedence (user over * package) is already resolved by discovery, so `discovered` has no duplicates. */ export declare function mergeManifestAdapters(codeRegistry: Record, discovered: readonly DiscoveredManifest[]): Record; export declare function listAdapterDirectories(baseDir: string): string[]; /** * Production registry. Scans `src/lib/adapters/` for code adapters, then folds * in the manifest sources discovered under the package + user task-sources roots. */ export declare const adapterRegistry: Promise>; //# sourceMappingURL=registry.d.ts.map