Skip to main content

Daemon

Struct Daemon 

Source
pub struct Daemon { /* private fields */ }
Expand description

The resident decision loop: owns the event log, the warm scorer, classifies, records.

Implementations§

Source§

impl Daemon

Source

pub fn open(db_path: impl Into<PathBuf>) -> Result<Self>

Open the daemon backed by the event log at db_path, creating parent dirs.

Source

pub fn should_shutdown(&self) -> bool

Whether an authenticated shutdown has been accepted (serve loop should exit).

Source

pub fn kill_switch_engaged(&self) -> bool

Whether the panic kill-switch is currently engaged.

Source

pub fn snapshot_dir(&self) -> &Path

The directory snapshots are stored under.

Source

pub fn with_scorer(self, scorer: Box<dyn Scorer>) -> Self

Swap in a specific scorer (used by tests).

Source

pub fn scorer_name(&self) -> &str

The name of the active Tier-2 scorer backend.

Source

pub fn open_default() -> Result<Self>

Open the daemon at the default database path.

Source

pub fn with_mode(self, mode: Mode) -> Self

Set the operating mode (attended / unattended / notify).

Source

pub fn mode(&self) -> Mode

The current operating mode.

Source

pub fn decide(&self, cmd: &ProposedCommand) -> Verdict

Decide what to do with a proposed command.

Order: (1) load the effective policy (global ← repo) which may set the mode and risk threshold; (2) classify with the Tier-1 rule engine; (3) Tier-2 model — for the ambiguous band only, fill summary+risk and, in unattended mode, apply the graduated threshold (below → allow, at/above → deny); the model summarizes a catastrophic command for the hold card but never changes its decision; (4) apply policy allow/deny (never a catastrophic downgrade); (5) apply decision memory.

Security spine: rules classify; the model only explains and scores the ambiguous band, and its influence is escalation-only. Safe stays on the model-free fast path.

Source

pub fn handle(&self, cmd: ProposedCommand) -> Verdict

Handle one proposal: decide, snapshot if destructive+allowed, record, and — if held — enqueue it for approval. Returns the verdict.

Source

pub fn resolve_pending(&self, id: &str, decision: Decision) -> Result<bool>

Approve or deny a queued command by id: record the human decision (and, on allow, snapshot), then mark the queue entry resolved. The originating caller (MCP poll / shim) executes; this never runs the command itself.

A human may approve any class here — including catastrophic — which is the deliberate human override (the model never can). Returns whether the id was found in the queue.

Source

pub fn resolve(&self, resolution: &Resolution) -> Result<()>

Handle a human’s resolution of a held command: record the final decision and, if requested, remember it for this exact command in this repo.

Source

pub fn observe(&self, obs: &Observation) -> Result<()>

Record an observed filesystem change from the backstop watcher. Logged as agent = "fs-watch", decision Allow (it already happened) — its purpose is to keep the timeline and undo complete for actions that bypassed interception.

Source

pub fn record_shell(&self, cmd: &ProposedCommand) -> Result<()>

Record a shell command from a human shell session (passive recording, no AI-agent hook). Logged as agent = "shell", decision Allow — it is never blocked (the recorder is an audit/undo trail, not a gate). We classify it with the Tier-1 rules so the event carries the real class (a destructive command a DBA ran is flagged in the timeline and kintsugi report), and we snapshot destructive commands so kintsugi undo can recover a human’s mistake. The model never runs on this path.

The hard floor stays honest: this is an audit record of the past, not a gate. The “nothing un-warned” guarantee never applied to commands a human ran outside Kintsugi; the “tamper-evident record of everything” one does, which is exactly what this preserves.

Source

pub fn handle_request(&self, req: Request) -> Response

Dispatch an IPC request to its handler.

Source

pub fn log(&self) -> &EventLog

Borrow the underlying event log (read-only queries).

Auto Trait Implementations§

§

impl !Freeze for Daemon

§

impl !RefUnwindSafe for Daemon

§

impl !Sync for Daemon

§

impl !UnwindSafe for Daemon

§

impl Send for Daemon

§

impl Unpin for Daemon

§

impl UnsafeUnpin for Daemon

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more