import { type CadenceState } from '@manehorizons/cadence-types'; import type { StateBackend } from './backend.js'; export declare class SimpleStateBackend implements StateBackend { private readonly repoRoot; constructor(repoRoot: string); resolveStateDir(): Promise; readState(): Promise; /** * Write `state.json` AND the derived `STATE.md` together (Phase 41.1). The * single public write path — callers can no longer write one without the * other, killing the stale-STATE.md class. * * Optimistic concurrency (Phase 173): before writing, compares the * on-disk `revision` to `state.revision`. A mismatch means another writer * committed in between — refuse rather than silently clobber. On success * `state.revision` is bumped in place (mutating the caller's object), so a * caller that issues multiple sequential commits on the same in-memory * state (e.g. a hook handler with two independent write branches) stays in * sync automatically. No on-disk file yet (first-ever write for this * checkout) skips the check entirely — there is nothing to conflict with. */ commit(state: CadenceState, opts?: { force?: boolean; }): Promise; /** * Telemetry-exempt write path (Phase 194 / issue #234). See the * `StateBackend` interface doc for the full rationale — this deliberately * skips the `revision` compare-and-swap `commit()` performs so a * telemetry-only counter bump can never throw `StateConflictError` or * invalidate another writer's in-flight snapshot. * * Re-reads `state.json` fresh (never trusts a caller-held in-memory * copy), bumps the named field on that snapshot, and writes the whole * snapshot back — unconditionally, with no compare-and-swap. This * narrows (versus the bug this exists to fix) but does not fully close * one race: if a `commit()` elsewhere reads, checks, and writes in the * gap between this method's own read and write, this write will still * land and silently overwrite that commit's structural change with this * method's stale copy plus the bumped counter — no error either side. * That window is a single read→write round trip (this repo has no lock * file), versus the multi-minute `host-cli` gate window that produced * issue #234, so the residual risk is accepted as deliberately, vastly * narrower than the bug being fixed — a trade-off made on purpose for a * telemetry field nothing structural depends on, not an accidental side * effect of skipping `commit()`'s guard. */ bumpSessionCounter(field: 'subagentSpawns', amount: number): Promise; /** Internal `state.json` primitive (Phase 41.1: private — use `commit`). */ private writeState; archive(milestone: string): Promise; } //# sourceMappingURL=simple.d.ts.map