/** * The per-project owner override cap setting (T13787, owner decision * 2026-10-16): `evidence.overrideCapPerSession` replaces the fixed cap of 10 * per session, and ONLY the owner may change it. * * ## Threat model * * An agent running as the same OS user can rewrite any local file, so no * local check is tamper-proof. The goal is narrower and achievable: an agent * cannot raise the cap through the supported path, and cannot raise it * silently. Tampering is detectable, not preventable. * * ## Enrollment (explicit, owner-only, anchored twice) * * `cleo config owner-enroll` (never a side effect of a set) derives an Ed25519 * key from the owner-auth password (scrypt over a fresh per-project salt) and * records its public key in two places a single file edit cannot reset: * - `.cleo/owner-settings.json`, which is tracked in git like * `.cleo/project.json` (ADR-094), so a delete or forge shows in * `git status` and PR diffs; * - the global store (`/owner-enrollments.json`), keyed by project * id, with when, which session and which terminal enrolled it. * Re-enrolling over an existing record needs `--reset`, which is audited. * `cleo doctor` reports the enrollment and any mismatch. * * ## Who may enroll or set * * T1118 L4 as built: not a restricted agent role, stdin and stderr a TTY, and * the password typed now matching the bound session's owner-auth verifier * (`cleo session start --scope global --name owner --owner-auth`). A pty * (`script`) passes the TTY check, so an agent CAN enroll in a project that has * no enrollment yet — which is why enrollment is explicit, recorded with its * terminal, and shown by `cleo doctor` and git. * * ## Reading * * The cap is the sealed value only when the project file and the global record * agree on the key and the seal verifies. A missing or unreadable file with a * global record, a file with no global record, a key mismatch or a bad seal * each fall back to {@link DEFAULT_OVERRIDE_CAP_PER_SESSION}, with a warning and * an audit line in `.cleo/audit/force-bypass.jsonl`. Every set and every * refused attempt is audited there with the old and new value. Who may use * `CLEO_OWNER_OVERRIDE=1` at all is decided by `owner-override-authority.ts` * (T13790). * * @task T13787 */ /** The explicit owner enrollment command, named in every refusal. */ export declare const OWNER_ENROLL_COMMAND = "cleo config owner-enroll"; /** What the override cap resolves to for a project. */ export interface OverrideCapResolution { /** The cap in force. */ cap: number; /** Where it came from. */ source: 'default' | 'owner-setting'; /** Set when stored owner state was ignored (missing, unanchored, mismatched or unsealed). */ warning?: string; } /** Outcome of an owner set. */ export type OverrideCapSetResult = { ok: true; /** The cap now in force. */ value: number; /** The cap before the set. */ previous: number; /** True when the requested value exceeded {@link MAX_OVERRIDE_CAP_PER_SESSION}. */ clamped: boolean; } | { ok: false; code: string; message: string; }; /** Outcome of an owner enrollment. */ export type OwnerEnrollResult = { ok: true; fingerprint: string; reset: boolean; } | { ok: false; code: string; message: string; }; /** The owner caller: the password typed now and the bound session. */ export interface OwnerCaller { password: string; session: { id: string; name: string | null; token: string | null; } | null; } /** The enrollment state `cleo doctor` reports. */ export interface OwnerEnrollmentStatus { status: 'none' | 'enrolled' | 'unconfirmed' | 'tampered'; message: string; fingerprint?: string; enrolledAt?: string; sessionId?: string | null; tty?: string | null; parent?: string | null; cap: number; /** * Why the owner should look (review-2253 round 2): a recent enrollment, a * pty-wrapper parent, or a project file git ignores or has not committed. */ warnings: string[]; } /** * The per-session override cap in force for a project: the owner's sealed * `evidence.overrideCapPerSession`, or {@link DEFAULT_OVERRIDE_CAP_PER_SESSION}. * Stored state that is missing, unanchored, mismatched or unsealed is ignored, * warned about and audited (see the module doc). * * @param projectRoot - Project root. * @returns The cap, its source, and a warning when stored state was ignored. * @task T13787 */ export declare function resolveOverrideCap(projectRoot: string): Promise; /** * The project's owner enrollment for `cleo doctor`: none, enrolled (with * fingerprint, when, which session and terminal), or tampered (why). * * @param projectRoot - Project root. * @returns The status, with the cap in force. * @task T13787 */ export declare function ownerEnrollmentStatus(projectRoot: string): Promise; /** * Refuse, and audit, a write of `evidence.overrideCapPerSession` that did not * come through {@link setOwnerOverrideCap} — a plain config write (T13787). * * @param projectRoot - Project root. * @param value - The value the write asked for. * @returns The refusal message, naming the owner command. * @task T13787 */ export declare function refuseOverrideCapWrite(projectRoot: string, value: unknown): Promise; /** * Enroll the owner key for this project — explicitly, never as a side effect * of a set (T13787 review). Refused, and audited, unless the caller passes * T1118 L4; refused over an existing enrollment (project file or global * record) unless `reset`, which is audited loudly and drops the old seals. * * @param projectRoot - Project root. * @param caller - The password typed at the TTY and the bound session. * @param opts - `reset`: replace an existing enrollment. * @returns The new key's fingerprint, or why enrollment was refused. * @task T13787 */ export declare function enrollOwner(projectRoot: string, caller: OwnerCaller, opts?: { reset?: boolean; }): Promise; /** * Confirm an enrollment that replaced another without proof of the previous * owner (review-2253 round 3): the owner proves the CURRENT key's password and * the `resetFrom` mark that makes `cleo doctor` FAIL is cleared, audited. An * agent that did the reset could confirm it too — visibility, not prevention. * * @param projectRoot - Project root. * @param caller - The password typed at the TTY and the bound session. * @returns The confirmed key's fingerprint, or why it was refused. * @task T13787 */ export declare function confirmOwnerEnrollment(projectRoot: string, caller: OwnerCaller): Promise; /** * Set `evidence.overrideCapPerSession` through the owner path: refused, and * audited, unless the caller passes T1118 L4, the project is enrolled with its * file and global record agreeing, and `password` derives the enrolled key. * Never enrolls. Values above {@link MAX_OVERRIDE_CAP_PER_SESSION} are clamped. * * @param projectRoot - Project root. * @param input - The requested value, the password typed at the TTY, and the * bound session with its owner-auth verifier (null when it has none). * @returns The new and previous cap, or why the set was refused. * @task T13787 */ export declare function setOwnerOverrideCap(projectRoot: string, input: OwnerCaller & { value: number; }): Promise; //# sourceMappingURL=override-cap-setting.d.ts.map