import { SyncState } from "../../composition/syncState/index.mjs"; import { HarnessState } from "../../composition/harnessState/index.mjs"; import { findSyncedRoot } from "./bootstrapLocator/index.mjs"; import { COMPOSED_ENV, EXTERNAL_EXTENSIONS_ENV, MUTE_ENV } from "./compositionState.mjs"; import { MajorModesConfig } from "@agimon-ai/doompi-config/majorModes"; import { ExtensionAPI } from "@earendil-works/pi-coding-agent"; import { alreadyComposed as alreadyComposed$1 } from "@agimon-ai/doompi-core/child-process"; //#region src/builders/cli/composition.d.ts export declare const DOOM_FLAGS: { readonly majorMode: 'major-mode'; readonly domains: 'domains'; readonly profile: 'profile'; readonly mute: 'mute'; }; /** Removed flag, reported rather than ignored when a synced session passes it. */ export declare const REMOVED_LAYER_FLAG = "layer"; export interface StartupFlags { majorMode?: string; domains?: string[]; profile?: string; mute: boolean; /** True when the caller passed the removed `--layer` flag. */ removedLayer: boolean; } export interface ComposeOutcome { /** Everything that went wrong, reported once the session can show messages. */ problems: string[]; /** Config changed since the last sync, which is a prompt to re-sync. */ stale: boolean; loaded: string[]; } /** * True when this process was handed the doom extension set on the command line. * * The launcher and detached Doom Team children both pass the composed list as * `--extension` arguments, and Pi merges those with whatever project settings * declare. Composing again here would load every extension twice, which Pi * reports as each tool and flag conflicting with itself. * * Matching against the synced paths rather than the mere presence of * `--extension` keeps an unrelated one-off, `pi -e ./debug.ts`, from silently * costing the user their whole setup. */ export declare function extensionsProvidedExternally(argv: string[], resolved: Record): boolean; /** * Opens this process's session from what sync pinned. * * The synced record is decoded underneath the live environment, so an inherited * value still wins: a launcher run, a nested session, or a CI override is more * specific than anything sync wrote. The result becomes the session's state * file, which is the authority from here on; the environment it publishes is * for the bash hooks and the packages that can only read one. */ export declare function startSyncedSession(state: SyncState, repoRoot: string, environment?: NodeJS.ProcessEnv): Promise; /** * Reads the doom flags off the command line. * * Pi collects unrecognized flags for extensions but hands their values back * only after every extension has loaded, which is too late to decide what to * load. Parsing argv with Pi's own parser keeps the value rules identical. */ export declare function readStartupFlags(argv: string[]): StartupFlags; /** Registers the flags so Pi accepts them and lists them in `pi --help`. */ export declare function registerDoomFlags(pi: Pick): void; /** * Applies the startup flags through the same switchers the slash commands use. * * A bad value is collected rather than thrown: a factory that throws takes the * whole doom setup down with it, which is far worse than one unapplied flag. */ export declare function applyStartupFlags(flags: StartupFlags, majorModesConfig: MajorModesConfig, repoRoot: string, problems: string[]): Promise; /** * Points harness state at a per-process directory before anything writes there. * * The synced directory is a baseline that every session reads; live switches * materialize into this one instead, so a second session in the same repository * cannot overwrite what the first is using. */ export declare function prepareRunDirectory(repoRoot: string, environment?: NodeJS.ProcessEnv): Promise; /** Removes this session's scratch directory. */ export declare function cleanupRunDirectory(repoRoot: string, environment?: NodeJS.ProcessEnv): Promise; /** * Builds the ordered list of extensions to load for the current state. * * Returns entries in actual Pi factory activation order. CLI argument adaptation * remains a launcher concern and synchronized bundles preserve this same order. */ export interface ComposedRuntimeLoadPlan { readonly entries: string[]; readonly fingerprint: string; } /** Builds the canonical synchronized activation plan. */ export declare function composeRuntimeLoadPlan(state: SyncState, harness?: HarnessState, environment?: NodeJS.ProcessEnv): Promise; /** Compatibility view for callers that only need Pi extension entries. */ export declare function composeLoadOrder(state: SyncState, harness?: HarnessState, environment?: NodeJS.ProcessEnv): Promise; /** * Imports each extension and hands it a source-aware view of the Pi API. * * Every Pi extension entry is a factory of the same shape, so one extension can * activate the rest. The view delegates to the same host API while retaining the * entry path for tools registered through a composed loader. Failures are per * entry: one unloadable module must not cost the session everything after it. */ export declare function loadComposedExtensions(pi: ExtensionAPI, entries: string[], problems: string[]): Promise; export interface ComposeOptions { cwd?: string; argv?: string[]; environment?: NodeJS.ProcessEnv; } /** * Runs the whole synced startup for one Pi session. * * Never throws: whatever fails is reported through the outcome so the session * still starts and can say what is wrong. */ export declare function composeDoomSession(pi: ExtensionAPI, options?: ComposeOptions): Promise; //#endregion export { COMPOSED_ENV, EXTERNAL_EXTENSIONS_ENV, MUTE_ENV, alreadyComposed$1 as alreadyComposed, findSyncedRoot }; //# sourceMappingURL=composition.d.mts.map