import type { SteeringConfig, SteeringDiagnostic } from "./schema.ts"; /** * Candidate file paths for a given directory's `slot` (default * `.pi/steering`), in priority order. First existing file wins. * * Exported for tests — not part of the library's public API. */ export declare function configCandidates(dir: string, slot?: string): string[]; /** * Resolve the pi agent directory: `$PI_CODING_AGENT_DIR` when set * (tilde-expanded: `"~"` → home, `"~/x"` → `/x`, anything else * as-is), else `/.pi/agent`. Mirrors pi's `getAgentDir()` in * @earendil-works/pi-coding-agent. * * Exported for tests. */ export declare function resolveAgentDir(): string; /** * Find the config file (if any) for a single layer. Returns the * resolved file path and a `layer-form-coexistence` diagnostic when * both `/index.ts` and `.ts` coexist in the same * directory (the directory form wins). * * Exported for tests. */ export declare function findConfigFile(dir: string, slot?: string): { file: string | null; diagnostic: SteeringDiagnostic | null; }; /** * Load the two fixed config layers for `cwd`: the project layer at * `/.pi/steering/` (or `.pi/steering.ts`) and the global layer * at `/steering/` (see {@link resolveAgentDir}). Returns * the layers INNER-FIRST (project first, then global; caller passes * to {@link buildConfig}, which expects inner-first so early entries * take precedence on collisions). * * Issues encountered along the way (per-layer import failure, dual * form coexistence, stray non-`.ts` file under the layer directory) * surface as structured {@link SteeringDiagnostic} entries on the * returned object. The loader does not log to `console.warn` directly * — the bridge runtime owns the policy decision (throw vs. log) once * it has collected diagnostics from every source. * * @throws when Node is older than {@link MIN_NODE_MAJOR}. */ export declare function loadConfigs(cwd: string): Promise<{ layers: SteeringConfig[]; diagnostics: SteeringDiagnostic[]; }>; /** * Inner-wins boolean merge over the inner-first layers. Walks * left-to-right (inner-first); returns the first explicit boolean or * `undefined`. Used by `buildConfig` and the session runtime for the * inner-wins boolean fields. Internal — not in the package's * `exports` surface. */ export declare function mergeBool(layers: readonly SteeringConfig[], key: "defaultNoOverride" | "disableDefaults" | "failOnWarnings"): boolean | undefined; /** * Merge `layers` (inner-first) into a single effective * {@link SteeringConfig}. An optional `defaults` config is treated as * the OUTERMOST layer — its fields apply when no real layer specifies * them, otherwise real layers override. * * Cross-layer plugin name collisions, within-layer rule + observer * name collisions, and cross-layer tracker name collisions surface * as structured {@link SteeringDiagnostic} entries on the returned * object. Predicate-key + tracker-extension collisions are detected * in `resolvePlugins`, not here — buildConfig handles cross-layer and * within-layer name-collision shapes only. */ export declare function buildConfig(layers: readonly SteeringConfig[], defaults?: SteeringConfig): { config: SteeringConfig; diagnostics: SteeringDiagnostic[]; }; /** * Convenience: load all layers for `cwd`, run the loader-side merge * (`buildConfig`), then the plugin merger (`resolvePlugins`) with * user-config rule + observer name validation between the two passes. * Diagnostics from every surface flow into a single returned array, * so an external embedder writing their own bridge or pre-flight * check sees the SAME diagnostic stream the production runtime sees * — no surface is silently skipped. * * Diagnostics return in declaration order; merge-side errors * short-circuit `resolvePlugins` before its diagnostics are added. * * Production-strictness divergence: `loadSteeringConfig` does NOT * apply the strict-mode `failOnWarnings` throw policy that * `buildSessionRuntime` does. The function never throws on * diagnostics; embedders apply their own throw + warning policy. * See `failOnWarnings` on {@link SteeringConfig} for production- * faithful pre-flight semantics. * * @throws when Node < {@link MIN_NODE_MAJOR} (propagated from * `loadConfigs`). */ export declare function loadSteeringConfig(cwd: string, defaults?: SteeringConfig): Promise<{ config: SteeringConfig; diagnostics: SteeringDiagnostic[]; }>; //# sourceMappingURL=loader.d.ts.map