import type { ChorusProgress, ChorusResult, VoiceResult } from "./types.js"; import { type StorePaths } from "./store.js"; import type { ReviewArtifact, ReviewDefinition, ReviewRequest } from "./review/index.js"; import type { ReviewRoleExecutionProgress, ReviewWorkflowResult } from "./workflows/contracts.js"; export type ChorusJobKind = "ask" | "agent" | "review"; export type ChorusJobStatus = "running" | "success" | "degraded" | "error" | "aborted" | "stale"; export interface ChorusJobVoice { index: number; roleId?: string; stage?: ReviewRoleExecutionProgress["stage"]; label: string; status: VoiceResult["status"] | "pending" | "skipped" | "empty"; partialOutput?: string; activityLog?: string; output?: string; outputPath?: string; activityPath?: string; errorMessage?: string; durationMs?: number; costUsd?: number | null; } export interface ChorusJob { id: string; kind: ChorusJobKind; title: string; presetName: string; prompt: string; optimizedPrompt?: string; command: string; status: ChorusJobStatus; startedAt: number; finishedAt?: number; voices: ChorusJobVoice[]; abortController: AbortController; result?: ChorusResult; reviewRequest?: ReviewRequest; reviewDefinition?: ReviewDefinition; reviewResult?: ReviewWorkflowResult; reviewArtifacts?: ReviewArtifact[]; reviewStage?: { id: string; status: string; }; renderedText?: string; errorMessage?: string; conductor?: { status: VoiceResult["status"] | "pending" | "skipped"; partialOutput?: string; activityLog?: string; errorMessage?: string; durationMs?: number; }; } type Listener = (job: ChorusJob) => void; export interface CreateChorusJobArgs { kind: ChorusJobKind; title: string; presetName: string; prompt: string; optimizedPrompt?: string; command: string; voices: Array<{ model: { provider: string; modelId: string; }; }>; actorLabels?: string[]; actorIds?: string[]; reviewRequest?: ReviewRequest; reviewDefinition?: ReviewDefinition; } export declare class ChorusJobStore { private readonly jobs; private readonly listeners; private paths; private loadedJobsPath; private persistTimer; private pendingPersist; private persistDirty; private readonly persistenceErrorListeners; constructor(paths?: StorePaths); configure(paths?: StorePaths): void; initialize(paths?: StorePaths): Promise; create(args: CreateChorusJobArgs): ChorusJob; updateProgress(jobId: string, updates: ChorusProgress[]): void; finish(jobId: string, result: ChorusResult, renderedText: string, status?: "success" | "aborted"): void; finishReview(jobId: string, result: ReviewWorkflowResult, renderedText: string, artifacts: ReviewArtifact[], status?: "success" | "degraded" | "aborted"): void; updateReviewStage(jobId: string, stage: string, status: string): void; updateReviewExecution(jobId: string, update: ReviewRoleExecutionProgress): void; fail(jobId: string, error: unknown): void; cancel(jobId: string): boolean; get(jobId: string): ChorusJob | undefined; list(): ChorusJob[]; subscribe(jobId: string, listener: Listener): () => void; persist(): Promise; flush(): Promise; onPersistenceError(listener: (error: string) => void): () => void; reset(): void; private emit; private schedulePersist; private reportPersistenceError; private prune; } export declare function configureChorusJobStore(paths?: StorePaths): void; export declare function initializeChorusJobs(paths?: StorePaths): Promise; export declare function createChorusJob(args: CreateChorusJobArgs): ChorusJob; export declare function updateChorusJobProgress(jobId: string, updates: ChorusProgress[]): void; export declare function finishChorusJob(jobId: string, result: ChorusResult, renderedText: string, status?: "success" | "aborted"): void; export declare function failChorusJob(jobId: string, error: unknown): void; export declare function cancelChorusJob(jobId: string): boolean; export declare function getChorusJob(jobId: string): ChorusJob | undefined; export declare function listChorusJobs(): ChorusJob[]; export declare function subscribeChorusJob(jobId: string, listener: Listener): () => void; export declare function persistChorusJobs(): Promise; export declare function resetChorusJobsForTest(): void; export {};