/** * Declared seat lifecycle — the per-seat `lifecycle.json` marker behind * `totem seat add | suspend | remove | list` (mmnto-ai/totem#2511). * * Seat EXISTENCE stays dir-derived (`readSeatDirs`, the mmnto-ai/totem#2141 * dirs-union invariant): a seat's first write registers it, and this file adds * no second registration surface. An ABSENT marker means `active`, so a * markerless tree behaves bit-identically to a pre-#2511 one. Lifecycle * filters downstream consumers (broadcast denominators, annotations); it never * decides who exists — `resolveSelfAgents` stays lifecycle-blind. * * Reads FAIL OPEN and LOUD: an unreadable or invalid marker degrades to * `active` with a warning that names the marker file, because a corrupt marker * must never shrink a broadcast denominator (wrongly closing an obligation) * nor hide held mail. Writes fail HARD: the atomic helper leaves the old * marker or the new one, never a torn transition. * * The whole tree is gitignored, so markers are machine-local by design — * the same scope ECL coordination already has. */ import { z } from 'zod'; /** Marker filename inside `/.totem/orchestration//`. */ export declare const SEAT_LIFECYCLE_FILENAME = "lifecycle.json"; /** The on-disk compatibility contract for a lifecycle marker. */ export declare const SEAT_LIFECYCLE_SCHEMA_VERSION = 1; /** * The closed lifecycle set. DECLARED state only — operator-driven and durable. * Session state (`LIVE`/`IDLE`/`FAULTED`) is a different axis entirely: it is * DERIVED by the totem-status#127 projection, which CONSUMES lifecycle. */ export declare const SeatLifecycleStateSchema: z.ZodEnum<["active", "suspended", "retired"]>; export type SeatLifecycleState = z.infer; /** * The `lifecycle.json` payload. * * `.strict()` plus the closed enum is what makes the totem-status#127 axis * ruling STRUCTURAL rather than advisory: session-state vocabulary * (`LIVE`/`IDLE`/`FAULTED`) is unrepresentable here — not as a `state` value * (the enum rejects it) and not as a smuggled sibling key (strict rejects it). * A marker can only ever say what was declared. * * `by` is resolved from the environment BY CALLERS (the `TOTEM_SELF_AGENT` * seat) or honestly absent — a stamped absence, never a fabricated attribution * (the mmnto-ai/totem#2625 MB-2 rule). */ export declare const SeatLifecycleMarkerSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; state: z.ZodEnum<["active", "suspended", "retired"]>; /** ISO-8601 instant of the transition, stamped at the write site. */ since: z.ZodString; by: z.ZodOptional; /** Operator's recorded ruling — the §6.6 audit trail when present. */ reason: z.ZodOptional; }, "strict", z.ZodTypeAny, { schemaVersion: 1; since: string; state: "active" | "suspended" | "retired"; reason?: string | undefined; by?: string | undefined; }, { schemaVersion: 1; since: string; state: "active" | "suspended" | "retired"; reason?: string | undefined; by?: string | undefined; }>; export type SeatLifecycleMarker = z.infer; /** * A seat's lifecycle as read from disk. * * - `source: 'marker'` ⟹ a valid marker answered; `marker` carries it. * - `source: 'default-active'` ⟹ no usable marker (absent, unreadable, or * invalid). `warning` is present for every case EXCEPT a plainly absent * marker, which is the expected steady state of every legacy seat. */ export interface SeatLifecycleRead { state: SeatLifecycleState; source: 'marker' | 'default-active'; marker?: SeatLifecycleMarker; warning?: string; } /** One row of `deriveSeatStatuses` — a seat plus its read-time lifecycle. */ export interface SeatStatus extends SeatLifecycleRead { seat: string; since?: string; } /** * Read one seat's declared lifecycle. NEVER throws — every failure direction * lands on `active` with a warning, because refusing to answer would take a * poll, a `seat list`, or a doctor check down with one bad file. * * An unsafe `agentId` degrades the same way rather than throwing: this is a * read path, and the caller may be enumerating ids it did not choose. */ export declare function readSeatLifecycle(repoRoot: string, agentId: string): SeatLifecycleRead; /** * Write (or replace) one seat's marker atomically and return the marker path. * * Overwriting an existing marker — including a corrupt one — is deliberate: * the verbs ARE the recovery path for the degraded read above. Callers surface * the pre-write warning from `readSeatLifecycle`; they do not refuse the write. * * Throws on an unsafe seat id or a schema-invalid marker (both are caller * errors that must not reach disk) and on any I/O failure — the atomic helper * guarantees the old marker survives a failed write. */ export declare function writeSeatLifecycle(repoRoot: string, agentId: string, marker: SeatLifecycleMarker): string; /** * Every registered seat in a repo with its declared lifecycle, sorted by seat * (`readSeatDirs` order). * * DERIVED at read time and never cached or persisted (Tenet 20): the dirs are * the roster and the markers are the state, so a transition is visible to the * very next read with no invalidation step — which is what lets `pollMail` * consume per-invocation markers without a staleness seam. */ export declare function deriveSeatStatuses(repoRoot: string): SeatStatus[]; //# sourceMappingURL=seat-lifecycle.d.ts.map