import type { Clock } from '../infra/clock.js';
import type { FileSystem } from '../infra/filesystem.js';
import type { ProcessSpawner } from '../infra/spawn.js';
import type { DomainEventBus } from '../shared/domainEvents.js';
import { type DomainError } from '../shared/errors.js';
import { type Result } from '../shared/result.js';
export type PipelineStatus = 'idle' | 'running';
export interface PipelineStatusInfo {
    readonly status: PipelineStatus;
    readonly pid: number | null;
}
export interface PipelineSummary {
    readonly active: string | null;
    readonly available: Array<{
        name: string;
        isActive: boolean;
    }>;
}
export interface PipelineFileContent {
    readonly content: string;
    readonly etag: string;
    readonly parsed: unknown;
    readonly parseError: string | null;
    readonly isActive: boolean;
}
export interface CreatePipelineInput {
    name: string;
    template?: 'blank' | 'sample' | 'active';
}
export interface ResetPipelineOpts {
    all?: boolean;
    cards?: number[];
}
/** CLI 命令层注入的钩子（Phase 3） */
export interface PipelineExecutor {
    stop(project: string): Promise<void>;
    reset(project: string, opts: ResetPipelineOpts): Promise<void>;
    recoverOrphans(project: string): Promise<number>;
}
export interface PipelineServiceDeps {
    readonly fs: FileSystem;
    readonly clock: Clock;
    readonly events: DomainEventBus;
    readonly spawner: ProcessSpawner;
    readonly executor?: PipelineExecutor;
}
export declare class PipelineService {
    private readonly deps;
    constructor(deps: PipelineServiceDeps);
    /** 启动 pipeline —— 已在跑直接返当前 pid。 */
    start(project: string): Promise<Result<PipelineStatusInfo, DomainError>>;
    stop(project: string): Promise<Result<void, DomainError>>;
    reset(project: string, opts?: ResetPipelineOpts): Promise<Result<void, DomainError>>;
    status(project: string): Promise<Result<PipelineStatusInfo, DomainError>>;
    listPipelines(project: string): Promise<Result<PipelineSummary>>;
    readPipeline(project: string, filename: string): Promise<Result<PipelineFileContent, DomainError>>;
    writePipeline(project: string, filename: string, content: string, etag: string): Promise<Result<{
        etag: string;
    }, DomainError>>;
    createPipeline(project: string, input: CreatePipelineInput): Promise<Result<{
        name: string;
        content: string;
        etag: string;
    }, DomainError>>;
    deletePipeline(project: string, filename: string): Promise<Result<void, DomainError>>;
    /** 切换 active pipeline —— 复制指定文件到 project.yaml。 */
    switchActive(project: string, filename: string): Promise<Result<{
        activePipeline: string;
    }, DomainError>>;
    private readSupervisorPid;
}
//# sourceMappingURL=PipelineService.d.ts.map