/** * startup-runtime-lease — protect dynamic Tool discovery before Commander has * mounted enough of the command surface to run the normal pre-action planner. * * Startup reads both project-local and user-global Tool roots. One composite * reader therefore protects bootstrap until the selected CommandSpec is known. * Project-scoped commands hand it into command teardown; scope-none host * commands release it after their exact declared resource lease is acquired. */ import { acquireRuntimeAccessLease, type FileLockEvent, type ProjectContext, type RuntimeAccessLease, type RuntimeLeaseEvent } from '@opensip-cli/core'; export interface StartupProjectSelection { readonly cwd: string; readonly cwdExplicit: boolean; readonly explicitConfigPath?: string; readonly project: ProjectContext; } /** * Read only the two project-selection options needed before dynamic discovery. * Required-option values are consumed exactly once and `--` terminates option * scanning. Commander remains the authority for the complete option grammar. */ export declare function resolveStartupProjectSelection(argv: readonly string[], defaultCwd: string): StartupProjectSelection; export interface StartupRuntimeLeaseHandoff { readonly lease: RuntimeAccessLease; readonly selection: StartupProjectSelection; readonly state: () => 'startup' | 'command' | 'released'; /** Fail closed if dynamic discovery is reached without the composite reader. */ readonly assertDiscoveryProtected: (projectRoot: string) => void; /** * Transfer ownership after authoritative planning proves the same stable * project key. A mismatch makes the discovery snapshot unusable. */ readonly claimForCommand: (projectRoot: string) => RuntimeAccessLease; /** Release only while startup still owns the discovery handle. */ readonly releaseStartupOwned: () => void; } export interface AcquireStartupRuntimeLeaseInput { readonly argv: readonly string[]; readonly defaultCwd: string; readonly command?: string; readonly onEvent?: (event: RuntimeLeaseEvent | FileLockEvent) => void; } export interface AcquireStartupRuntimeLeaseDeps { readonly acquire?: typeof acquireRuntimeAccessLease; } export declare function acquireStartupRuntimeLease(input: AcquireStartupRuntimeLeaseInput, deps?: AcquireStartupRuntimeLeaseDeps): Promise; //# sourceMappingURL=startup-runtime-lease.d.ts.map