import type { Workflow } from "./workflow-store.js";
export type GoalState = "todo" | "in-progress" | "complete" | "shelved";
export interface PersistedGoal {
    id: string;
    title: string;
    cwd: string;
    state: GoalState;
    /** Markdown spec content (inline) */
    spec: string;
    createdAt: number;
    updatedAt: number;
    /** Git worktree path (if goal has its own worktree) */
    worktreePath?: string;
    /** Git branch name for this goal's worktree */
    branch?: string;
    /** The original repo path (for worktree cleanup) */
    repoPath?: string;
    /** Which project this goal belongs to */
    projectId?: string;
    /** Whether this is a team goal with Team Lead orchestration */
    team?: boolean;
    /** Session ID of the Team Lead agent (for team goals) */
    teamLeadSessionId?: string;
    /** Gate types to skip requirement enforcement for */
    skipGateRequirements?: string[];
    /** ID of the workflow template this goal was created from */
    workflowId?: string;
    /** Frozen snapshot of the workflow at goal creation time */
    workflow?: Workflow;
    /** Worktree setup status: ready (done/not needed), preparing (in progress), error (failed) */
    setupStatus?: "ready" | "preparing" | "error";
    /** Error message when setupStatus === "error" */
    setupError?: string;
    /** If this goal is a re-attempt of another goal, the original goal's ID */
    reattemptOf?: string;
    /** Whether this goal has been archived (soft-deleted) */
    archived?: boolean;
    /** Epoch ms when the goal was archived */
    archivedAt?: number;
    /** Whether team agents should run in Docker sandbox */
    sandboxed?: boolean;
    /** Whether to automatically start the team after worktree setup (defaults to true) */
    autoStartTeam?: boolean;
    /** Names of optional verification steps enabled for this goal */
    enabledOptionalSteps?: string[];
    /** Per-repo worktree paths (multi-repo only). Single-repo uses flat worktreePath. */
    repoWorktrees?: Record<string, string>;
}
/**
 * Simple JSON file store for goals.
 * Goals persist across server restarts.
 */
export declare class GoalStore {
    private readonly storeDir;
    private readonly storeFile;
    private goals;
    /** Monotonically increasing counter — bumped on every mutation. Resets to 0 on server restart. */
    private generation;
    constructor(stateDir: string);
    private load;
    private save;
    /** Current generation counter — bumped on every mutation. */
    getGeneration(): number;
    /** Optional callback invoked after any goal mutation (put/update/archive). */
    onIndexUpdate?: (goal: PersistedGoal) => void;
    /**
     * Called once when a goal id appears in the store for the first time.
     * Wired by `ProjectContext.setGoalTriggerDispatcher` from `server.ts`.
     * MUST be assigned independently of `onIndexUpdate` — the search index
     * relies on the latter and must not be stomped.
     */
    onGoalCreated?: (goal: PersistedGoal) => void;
    /**
     * Called once per archive transition (false → true). Idempotent —
     * a second `archive` call on an already-archived goal does NOT fire.
     */
    onGoalArchived?: (goal: PersistedGoal) => void;
    /** Bump generation without mutating goal data (e.g. when gate status changes). */
    bumpGeneration(): void;
    put(goal: PersistedGoal): void;
    get(id: string): PersistedGoal | undefined;
    remove(id: string): void;
    getAll(): PersistedGoal[];
    archive(id: string): boolean;
    getLive(): PersistedGoal[];
    getArchived(): PersistedGoal[];
    update(id: string, updates: Partial<Omit<PersistedGoal, "id" | "createdAt">>): boolean;
    /**
     * Paginated listing of archived goals, sorted by archivedAt DESC.
     * @param limit Max items per page
     * @param afterCursor archivedAt timestamp — return items with archivedAt < cursor
     */
    listArchivedGoalsPaginated(limit: number, afterCursor?: number): {
        goals: PersistedGoal[];
        total: number;
        hasMore: boolean;
        nextCursor?: number;
    };
}
//# sourceMappingURL=goal-store.d.ts.map