/** * The construction order, as code (Internal Design, steps 1 to 5). * * 1. Configuration, once. Everything downstream reads the result, and a rejected configuration * stops the command before an adapter exists or a home is read (FR-56). * 2. The platform services: the estimator factory, the repository reader, the committer. * 3. The adapters of the list. `capabilities()` is cheap and pure, so it may be read at once. * 4. The target profile, built by the caller from the agent the entry point is running in. * 5. The pipeline, wired with the services and the adapters. * * Every step is injectable, because a composition root whose parts cannot be replaced cannot be * tested — and because the deps are thunks, not values, "nothing is built before the * configuration is loaded" is a property a test can observe rather than a promise. */ import { type AgentEntry } from "./agents.js"; import type { AgentRegistry, ConfigLoader, EstimatorFactory, FileCommitter, HostWiring, ImportConfig, ImportPipeline, RepoReader, TargetProfile, TargetProfileBuilder } from "./contract.js"; /** Everything the composition root builds, and what a test may replace. */ export interface HostDeps { /** The agent list. Defaults to the one list of the tree (FR-57). */ agents?: readonly AgentEntry[]; configLoader?: ConfigLoader; createEstimators?: () => EstimatorFactory; createRepo?: () => RepoReader; createCommitter?: () => FileCommitter; /** The directory the command runs in. The repository reader reads git state from it (FR-13). */ cwd?: string; /** The import time written into the marker (FR-47). Injected so a preview and a commit agree. */ now?: () => string; } /** * The wiring, plus the two things an entry point needs to reach step 4: the configuration that * was loaded once, and the builder that turns an agent and a home into a profile. */ export interface Host extends HostWiring { registry(): AgentRegistry; profiles(): TargetProfileBuilder; /** The one configuration of this process (Constraints: loaded once per process). */ config(): ImportConfig; pipelineFor(target: TargetProfile): Promise; } export declare function createHost(deps?: HostDeps): Promise;