Expand description
retire — decommission a wire identity you’re done with, reversibly.
The daemon supervisor keeps a daemon alive for every real identity (one
with a private.key) so it can still receive mail — so an idle throwaway
identity’s daemon can’t just be killed: the supervisor respawns it within
one poll. “Retiring” writes a durable .retired marker that makes the
supervisor treat the home as ineligible (it kills the child and never
respawns — see daemon_supervisor::supervisor_eligible), then stops the
running daemon directly.
Reversible by construction: the marker is the ONLY state change. The home,
identity keypair, relay slot, and pull cursor are all kept, so revive
(remove the marker) brings the identity back intact and it drains any mail
that arrived while retired (relay slots never expire; mail is retained).
is_retired is a pure existence check so a torn write can never flip an
identity back to “not retired”. CLI-only: an agent must not retire another
identity’s daemon unsupervised (mirrors wire nuke).
Structs§
Constants§
Functions§
- current_
home - The session home THIS process resolves for itself (honoring WIRE_HOME /
session-key). Used to guarantee we never retire the current identity —
compared by canonical home path, since
resolve_session_key()isNoneon a bare terminal.Noneif it can’t be resolved (caller must fail closed). - has_
pending_ inbound - True iff the home has any pending inbound pair request awaiting
wire accept(state/wire/pending-inbound-pairs/*.json). Such a home has 0 pinned peers but is NOT idle — a peer is actively trying to reach it — so the bulk sweep must never retire it. - identity_
age_ s - Seconds since this identity was created — the mtime of
config/wire/private.key, written exactly once at keygen and never rewritten. This is the honest “how old is this throwaway” signal: unlikedaemon.pid(which resets to now on every supervisor respawn) orlast_sync.json(which a running daemon refreshes every heartbeat), the key’s mtime tracks the identity’s actual age, so a freshly-created sibling session is never swept.Noneif no key (not a real identity). - is_
current - True iff
homeis the current process’s own identity home. - is_
retired - Pure existence check — never parses the body, so a partial write can’t read as “not retired”. The supervisor eligibility filter keys on this.
- marker_
path <home>/state/wire/retired.json.- read_
marker - Best-effort read of the marker body for display. A parse error is treated as retired-with-unknown-details (fail closed), never as not-retired.
- resolve_
target - Resolve
<handle|fingerprint|key>to exactly one local session, box-wide overlist_sessions(). Many idle homes never claimed a handle, so the key (by-key dir name) and fingerprint are also accepted. Errors on zero or multiple matches — never guesses. - retire_
session - Retire a session home: write the marker FIRST (so the supervisor won’t
respawn), then stop its daemon via the injected
stopfn. Returns the pid that was stopped, if any. Idempotent — re-retiring just rewrites the marker. - revive_
session - Bring a retired identity back: remove the marker; the supervisor respawns its daemon on the next poll. No-op if not retired.
- stop_
daemon_ graceful_ then_ force - Stop a daemon by pid, graceful then force. Mirrors the
wire upgradefix: a bare SIGTERM /taskkill /PID(no/F) is a no-op for a headless daemon on Windows, so escalate to SIGKILL //Fif it’s still alive after a grace.