/** * src/shared/config.ts — pi-subagents configuration: named bounds, defaults, * `/.subagents/config.json` + `SUBAGENTS_*` env overrides. * * Mirror of the pi-mesh `shared/config.ts` pattern (D17, §12): every numeric * bound is a named constant here, config.json is optional (graceful fallback * to defaults), and env overrides win over file values. Pure module: only * `node:fs` for the optional config.json read — no @earendil-works/* imports, * no child_process. */ export declare const HARD_MIN_MAX_PARALLEL = 1; export declare const HARD_MAX_MAX_PARALLEL = 8; export declare const HARD_MIN_MAX_CHAIN = 1; export declare const HARD_MAX_MAX_CHAIN = 16; export declare const HARD_MIN_MAX_TURNS = 1; export declare const HARD_MAX_MAX_TURNS = 200; export declare const HARD_MIN_GRACE_TURNS = 1; export declare const HARD_MAX_GRACE_TURNS = 20; export declare const HARD_MIN_MAX_SUBAGENT_DEPTH = 0; export declare const HARD_MAX_MAX_SUBAGENT_DEPTH = 4; export declare const DEFAULT_MAX_SUBAGENT_DEPTH = 2; /** Default delegation scope. */ export declare const DEFAULT_SCOPE: "both"; /** Default hot-pool parallelism (lanes). */ export declare const DEFAULT_MAX_PARALLEL = 4; /** Default maximum chain length (sequential sub-tasks). */ export declare const DEFAULT_MAX_CHAIN = 8; /** Default hash-only ledger directory, relative to cwd. */ export declare const DEFAULT_LEDGER_DIR = ".pi/logs/runs"; /** Default background-run retention / settle TTL (10 min). */ export declare const DEFAULT_BACKGROUND_TTL_MS: number; /** Default agent discovery directory, relative to cwd. */ export declare const DEFAULT_AGENTS_DIR = ".pi/agents"; /** Whether the hot-lane HUD is enabled (off by default in a pure core). */ export declare const DEFAULT_HUD = false; /** Default class-level model fallback chain (cheap -> balanced -> capable). */ export declare const DEFAULT_MODEL_FALLBACK_CHAIN: readonly string[]; /** B3: grace turns between the soft wrap-up steer and the hard abort. */ export declare const DEFAULT_GRACE_TURNS = 5; /** Clamp a max-subagent-depth value into the hard bounds [0, 4] (default 2). */ export declare function clampMaxSubagentDepth(value: unknown): number; /** The config file path for a given cwd: `/.subagents/config.json`. */ export declare function configFilePath(cwd: string): string; export type Scope = "project" | "user" | "both"; /** Preferred model per routing class (empty string = no explicit model). */ export interface ModelClassMap { cheap: string; balanced: string; capable: string; } export interface SubagentsModelsConfig { /** Preferred model id per class ('' = fall back to parent/session). */ classes: ModelClassMap; /** Ordered class-level fallback chain (A -> B -> ...). */ fallbackChain: readonly string[]; } export interface SubagentsConfig { defaultScope: Scope; maxParallel: number; maxChain: number; ledgerDir: string; backgroundTtlMs: number; defaultAgentsDir: string; hud: boolean; /** * B3 graceful turn-limit default (undefined = UNLIMITED). When set, an * assistant-turn count of `defaultMaxTurns` triggers the soft wrap-up steer; * bounded to [1, 200] when present (0/invalid = unlimited). */ defaultMaxTurns?: number; /** B3 grace turns after the soft steer before the hard abort (1..20, default 5). */ defaultGraceTurns: number; /** * C1 nested subagents: maximum spawn depth, clamped to [0, 4] (default 2). * 0/1 disable nesting entirely (the child `subagent` tool is never * registered: registration requires PI_SUBAGENTS_DEPTH < max). */ maxSubagentDepth: number; models: SubagentsModelsConfig; /** * P2 provider extensions: provider id -> local extension entry path. When * the resolved child model's provider matches, the child spawn argv gains * `-e ` (children otherwise run `--no-extensions` and custom-provider * models crash with 'Model not found'). Entries are existsSync-guarded; * the built-in `ollama-cloud` -> `~/pi-provider-ollama-cloud/src/index.ts` * default applies when the provider is not mapped here. */ providerExtensions?: Record; } export declare const DEFAULT_MODEL_CLASSES: ModelClassMap; export declare const DEFAULT_CONFIG: SubagentsConfig; /** * Load the pi-subagents config: * `defaults < /.subagents/config.json < SUBAGENTS_* env`. * * Env overrides: * SUBAGENTS_SCOPE, SUBAGENTS_MAX_PARALLEL (bounded 1..8), * SUBAGENTS_MAX_CHAIN (bounded 1..16), SUBAGENTS_LEDGER, * SUBAGENTS_BACKGROUND_TTL_MS, SUBAGENTS_AGENTS_DIR, SUBAGENTS_HUD, * SUBAGENTS_MAX_TURNS (bounded 1..200; 0 = unlimited), * SUBAGENTS_GRACE_TURNS (bounded 1..20, default 5), * SUBAGENTS_MODEL_CHEAP / SUBAGENTS_MODEL_BALANCED / SUBAGENTS_MODEL_CAPABLE, * SUBAGENTS_MODEL_FALLBACK (csv). * * A missing or unparseable config.json is treated as defaults (graceful, I10). */ export declare function loadConfig(cwd: string, env?: NodeJS.ProcessEnv): SubagentsConfig;