/** * The ONE landing path for decisions (DES-decision-capture §4.5, DC-S4a): `remember()` and its * siblings `undo` / `dismiss` / `widen` / `same`, plus the act-on-route step `ingest` hands over. * * Every landing — auto, the chip, Needs You, and `POST /proposals/:id/approve` of a proposal this * ledger filed — goes through `remember()`, and the human check lives INSIDE it (actor kind * `human` ∧ trust ≥ operator), so no route branch can skip it. Words, actor and ORIGIN come from * the ledger, never from a proposal payload (which carries only the decision id). */ import type { CoreAdapter } from '../core/adapter.js'; import type { Actor, DecisionChangedFrame, SteeringType } from '../core/types.js'; import { type AuthMode } from '../api/auth.js'; import type { AuditLog } from '../api/audit.js'; import type { InForceRule } from './derive.js'; import { type DecisionBusEmit } from './events.js'; import type { DecisionLedger } from './ledger.js'; import type { DecisionDismissReason, DecisionRecord, DecisionsMode } from './types.js'; /** A refusal with its HTTP status (403 human check, 404 unknown, 409 wrong state, 502 upstream). */ export declare class DecisionError extends Error { readonly status: 400 | 403 | 404 | 409 | 501 | 502; constructor(status: 400 | 403 | 404 | 409 | 501 | 502, message: string); } export interface DecisionDeps { ledger: DecisionLedger; mode: DecisionsMode; authMode: AuthMode; estateTool: (tool: string, args: Record) => Promise; adapter: Pick & Partial>; audit: AuditLog; emit?: DecisionBusEmit | null; broadcast?: (frame: DecisionChangedFrame) => void; log?: (msg: string) => void; now?: () => number; } export interface RememberEdits { statement?: string; scope?: 'project' | 'everywhere'; steering_type?: SteeringType; } /** `dec_` + a uuid v7-shaped id: a 48-bit ms timestamp prefix so ids sort by time. */ export declare function newDecisionId(now?: number): string; export declare class DecisionService { readonly deps: DecisionDeps; constructor(deps: DecisionDeps); get mode(): DecisionsMode; private readonly inFlight; /** Per-decision serialization: two concurrent writes on one decision never both land (codex). */ private readonly locks; private locked; /** Run host-side work off the request path (`void`), tracked so tests and shutdown can await it. */ track(work: Promise): void; /** Resolves once every tracked host recording has settled. */ idle(): Promise; private now; private log; private requireHuman; private requireRecord; private viewOf; private fact; private changed; private outcome; /** Other projects' live rules (an operator-wide rule lands in them too). Fail-soft: `[]` + a log. */ elsewhere(projectId: string | null): Promise; /** The names a project goes by besides its id (its display name). Fail-soft: `[]`. */ projectNames(projectId: string | null): Promise; /** The in-force rules for a project (this project's and the global ones). Fail-soft: `[]` + a log. */ inForce(projectId: string | null): Promise; /** Act on a record's route. Never throws: a failure is a `landing_failed` outcome + a log. */ act(record: DecisionRecord): Promise; /** Re-drive records whose route asks for an action but which have no outcome (a restart mid-landing). */ redrive(): Promise; /** The review-queue proposal already filed for a decision (idempotent re-drive), or `null`. */ private proposalFor; private submitProposal; /** File the decision into the review queue (the chip + its Needs You row are the same object). */ offer(record: DecisionRecord): Promise; private offerLocked; remember(id: string, actor: Actor, opts: { how: 'auto' | 'chip' | 'needs-you'; edits?: RememberEdits; }): Promise<{ rule_id: string; proposal_id: string; project?: string; }>; private rememberLocked; private isApproved; /** Approve a proposal; one already approved (a re-drive after a crash) is not an error. */ private approve; undo(id: string, actor: Actor): Promise; private undoLocked; dismiss(id: string, actor: Actor, reason: DecisionDismissReason): Promise; private dismissLocked; /** B7 "Same as your rule '…'? · Same · New rule" — resolves a `maybe-restated` decision. */ same(id: string, actor: Actor, same: boolean): Promise<{ rule_id?: string; }>; private sameLocked; /** B8: one project-less successor that supersedes the same rule in every project. */ widen(id: string, actor: Actor): Promise<{ rule_id: string; }>; } //# sourceMappingURL=land.d.ts.map