/** * Brain tier assembly — turns `Config.brain` into the concrete LLM tiers * (single-LLM pool + optional multi-LLM council) that * `createTieredBrainArbiter` composes. Shared by every host that wires a * Brain (CLI/TUI in `wiring/brain-and-orchestration.ts`, the standalone * WebUI server in `backend-services.ts`) so the config surface behaves * identically everywhere. * * Hosts differ only in HOW a provider id becomes a `Provider` instance, so * that is the one injected dependency (`resolveProvider`). Unresolvable * pool/council entries are skipped — one bad ref never takes the Brain down. * * @module brain-chain */ import type { BrainArbiter, BrainDecisionRequest } from '../coordination/brain.js'; import type { EventBus } from '../kernel/events.js'; import type { BrainConfig } from '../types/config.js'; import type { Provider } from '../types/provider.js'; import type { BrainCircuitBreaker } from './brain-circuit.js'; export interface BrainTierAssemblyOptions { /** `config.brain` — undefined assembles the legacy session-model single tier. */ brainConfig: BrainConfig | undefined; /** The session's provider id (`config.provider`). */ defaultProviderId: string; /** Live session provider — read per decision so `/setmodel` switches apply. */ sessionProvider: () => Provider; /** Live session model id — read per decision. */ sessionModel: () => string; /** * Resolve a NON-default provider id to a Provider instance. May throw or * return null; the entry is then skipped. */ resolveProvider: (providerId: string, model: string) => Provider | null; /** * Decision-history digest (typically `BrainDecisionLedger.digestFor`) — * injected into both the single-LLM and council prompts so the Brain * learns from the outcomes of its past similar decisions. */ getDecisionDigest?: ((request: BrainDecisionRequest) => string | undefined) | undefined; /** Bus for `brain.llm_call` / `brain.council_*` trace events. */ events?: EventBus | undefined; /** Include free text in trace events. Mirrors `brain.trace.content === 'full'`. */ traceContent?: boolean | undefined; /** Failure memory shared by every decision the single-LLM tier makes. */ circuit?: BrainCircuitBreaker | undefined; } export interface BrainTierAssembly { /** Single-LLM tier for `TieredBrainArbiterOptions.autonomous`. */ autonomous: BrainArbiter; /** Council tier for `TieredBrainArbiterOptions.council` (undefined = disabled). */ council: BrainArbiter | undefined; /** Live council risk floor for `TieredBrainArbiterOptions.getCouncilMinRisk`. */ getCouncilMinRisk: () => 'medium' | 'high' | 'critical'; /** Human-readable pool labels for status surfaces; empty = session model. */ poolLabels: string[]; /** Human-readable council seat labels; empty = council disabled. */ councilLabels: string[]; /** * EFFECTIVE judge label — undefined when no council is wired. * * Distinct from the CONFIGURED judge (`council.judge`), which is usually * absent: the judge is then derived, and whether the derived one is * independent of the seated voters is not something any surface could * previously observe. */ judgeLabel: string | undefined; } /** Assemble the LLM tiers of the Brain chain from `Config.brain`. */ export declare function assembleBrainTiers(opts: BrainTierAssemblyOptions): BrainTierAssembly; //# sourceMappingURL=brain-chain.d.ts.map