import type { ControlProjectListingProblem, Project, RunEvent, Thread, ThreadTurn } from "@claudexor/schema"; import type { CommandStore } from "./command-store.js"; import type { JournalManager, JournalProjectionSlot } from "./journal-manager.js"; import type { JournalManagerOptions } from "./journal-manager-lifecycle.js"; import type { InteractionStore } from "./interactions.js"; import { type OperatorDecisionRecord, type OperatorDecisionStore, type RecordedOperatorDecision } from "./operator-decisions.js"; import type { RunEventStore } from "./run-events.js"; import type { ProjectStore } from "./projects.js"; import { type CreateThreadInput, type CreateTurnInput, type ThreadHeadPingSink, type ThreadStore, type UpdateThreadInput } from "./threads.js"; import type { CommandAuthority } from "./command-authority.js"; import { type ProjectPartitionsPreparation } from "./project-partition-preparation.js"; import { type ProfileContinuityResult } from "./partition-accounts.js"; export type { ProjectPartitionsPreparation } from "./project-partition-preparation.js"; export declare class ProjectPartitions implements CommandAuthority { private readonly rootDir; private readonly projects; private readonly globalCommands; private readonly globalInteractions; private readonly globalDecisions; private readonly globalRunEvents; private readonly globalThreads; /** Global-partition `thread.head.updated` sink, threaded into every project ThreadStore. */ private readonly headPing?; private readonly requestMaintenance?; private readonly partitions; private preparationResult; constructor(rootDir: string, projects: JournalProjectionSlot, globalCommands: JournalProjectionSlot, globalInteractions: JournalProjectionSlot, globalDecisions: JournalProjectionSlot, globalRunEvents: JournalProjectionSlot, globalThreads: JournalProjectionSlot, /** Global-partition `thread.head.updated` sink, threaded into every project ThreadStore. */ headPing?: ThreadHeadPingSink | undefined, requestMaintenance?: JournalManagerOptions["requestMaintenance"]); prepare(): ProjectPartitionsPreparation; revalidatePreparation(): void; /** Live stage-2 re-verdict for the in-process reopen (C6): quarantined * partitions reopened by their manager count ready, and a registry that * became readable after a global reopen restores coverage. Refreshes the * cached receipt the activation gate checks. */ refreshPreparation(): ProjectPartitionsPreparation; activatePrepared(): void; recoverAfterStartup(): void; all(): CommandStore[]; interactionStores(): InteractionStore[]; interactionsForRequest(params: unknown): InteractionStore; operatorDecision(params: unknown, runId: string): OperatorDecisionRecord | null; findOperatorDecisionByIdempotency(params: unknown, runId: string, idempotency: { key: string; client: string; request: unknown; }): OperatorDecisionRecord | null; recordOperatorDecision(params: unknown, decision: OperatorDecisionRecord, idempotency?: { key: string; client: string; request: unknown; }): RecordedOperatorDecision; /** * Durable sink for run events. Only the lifecycle-significant subset is * journaled (`JOURNALED_RUN_EVENT_TYPES`); a filtered event is returned * untouched and can never fail its producer. The journaled `run.created` * carries the prompt digest, never the prompt text. */ recordRunEvent(params: unknown, event: RunEvent): RunEvent; forRequest(params: unknown): CommandStore; findById(id: string): CommandStore | undefined; beginDelivery(params: unknown, input: { key: string; client: string; operation: string; request: unknown; }): { id: string; state: import("./job-record.js").JobState; params: unknown; result?: unknown; error?: string; errorCode?: string; errorStatus?: number; errorRetryable?: boolean; errorRequiredActions?: string[]; errorContext?: Record; createdAt: string; runId?: string; taskId?: string; runDir?: string; startedAt?: string; finishedAt?: string; reused: boolean; }; completeDelivery(id: string, result: unknown): void; failDelivery(id: string, error: unknown): void; registerProject(input: Parameters[0]): Project; /** * F2 ghost-cleanup sweep: unregister every project that can never * be a legitimate user project — its root is INSIDE the Claudexor runtime * tree (an envelope worktree that was auto-registered as a ghost) or its root * is permanently GONE from disk. Closes and drops each ghost's partition so * it stops polluting listings/retention. Idempotent and best-effort; returns * the retired projects for disclosure/logging. */ quarantineGhostProjects(): Array<{ projectId: string; root: string; reason: string; }>; relinkProject(id: string, root: string): Project; /** * QA-049 minimal project remove: retire a registered project. Fails CLOSED * with a typed 409 while any NON-PURGED thread or any live/queued run still * references it (the caller supplies the roots with active runs, since the job * list lives in the daemon composition). On success, ARCHIVE the journal * partition (rename out of the active tree — never delete) FIRST — that fallible * rename+fsync must throw with the registry still intact rather than strand an * unregistered project whose partition never moved — THEN unregister the durable * registry entry and drop the in-memory partition. Artifact trees are left for * GC/retention. Unknown id -> 404. Recovery-pending partition -> 409. */ removeProject(id: string, activeRunRoots: ReadonlySet): import("@claudexor/schema").ControlProjectRemoveReceipt; journal(partition: string): JournalManager; /** `ephemeral`: the caller declared this root ONE-SHOT (INV-035) — never registered, so the * thread takes the global no-project partition, exactly as its commands and run events do. */ createThread(input: CreateThreadInput & { ephemeral?: boolean; }): Thread; listThreads(): Thread[]; /** Dead-project-resilient listing in one global recency order (F2); * the mechanics live in project-thread-listing.ts. */ listThreadsResilient(): { threads: Thread[]; problems: ControlProjectListingProblem[]; }; getThread(id: string): Thread | undefined; turnsFor(id: string): ThreadTurn[]; sessionsForThread(id: string): { id: string; thread_id: string; harness_id: string; native_session_id: string | null; resume_kind: "none" | "resume_by_id"; profile_id: string | null; last_observed_model: string | null; state: "live" | "rebound" | "stale"; created_at: string; updated_at: string; }[]; createTurn(id: string, prompt: string, input?: CreateTurnInput): ThreadTurn; findTurnByIdempotency(id: string, input: NonNullable): ThreadTurn | undefined; updateThread(id: string, patch: UpdateThreadInput): Thread; /** Unified-accounts continuity steps (contract: partition-accounts.ts). */ migrateNullProfileContinuity(harnessId: string, rowId: string): ProfileContinuityResult; rollbackProfileContinuity(harnessId: string, rowId: string): ProfileContinuityResult; private continuityHosts; invalidateCredentialProfile(harnessId: string, profileId: string): { clearedThreads: number; invalidatedSessions: number; }; assertCredentialProfileInvalidationReady(): void; trashThread(id: string): Thread; restoreThread(id: string): Thread; purgeThread(id: string): Thread; setThreadWorktree(id: string, path: string, baseSha: string, deliveredThroughRunId?: string): void; assertKnownIds(threadId: unknown, turnId: unknown): { threadId?: string; turnId?: string; }; getTurn(id: string): ThreadTurn | undefined; bindTurnRun(id: string, runId: string): void; setTurnEnqueueError(id: string, problem: import("@claudexor/schema").TurnEnqueueProblem): void; resumeMap(id: string, profileId?: string | null): Record; resumeMapAuto(id: string): Record; accountBindings(id: string): Record; recordSession(id: string, harnessId: string, nativeSessionId: string, observedModel?: string | null, profileId?: string | null): void; recordLaneCheckpoint(id: string, harnessId: string, profileId: string | null, turnId: string): void; laneCheckpoint(id: string, harnessId: string, profileId: string | null): string | null; laneCheckpointsForThread(id: string): import("@claudexor/schema").LaneCheckpoint[]; setTurnContinuity(turnId: string, disclosure: import("@claudexor/schema").ContinuityDisclosure): void; /** * Run-terminal invalidation (the W12 path with no store mutation to ride): * a terminal changes the thread's presented state (needs-me, outcome), so * the daemon pings the owning store's head directly. */ pingThreadHead(id: string): void; close(): void; /** * Canonical roots whose partition journal is READY — the set whose thread * lineage / job records are trustworthy. Retention (W3.6) fails CLOSED on a * quarantined partition: its runs are protected, never GC'd against an empty * reference set (a non-ready partition contributes nothing to listThreads, * so its referenced runs would otherwise look unreferenced). */ healthyProjectRoots(): string[]; private partitionForRoot; private threadStores; private threadStoreForRoot; private threadStoreForThread; private threadStoreForTurn; private requireThreadStore; private requireTurnStore; private commandStoreForThreadStore; private decisionStoreForRequest; private runEventStoreForRequest; } //# sourceMappingURL=project-partitions.d.ts.map