Expand description
Pinned sessions come back after the daemon restarts.
The pin book (<config dir>/daemon-pins.json) is the set of pinned
journals for this profile. It is written through, never by a timer: the
actor calls PinBook (as the host’s PinSink) when the pin changes,
when a pinned session moves to a new journal, and when a pinned session
is ended on purpose. A daemon stop, reload or crash leaves it alone, and
the next cold start continues every entry that is not live and pins it
(restore_all). SYNAPS_DAEMON_RESTORE_PINS=0 starts without that.
The file lives in the config dir, not the run dir: older binaries unlink run-dir json they cannot parse, and the run dir may be tmpfs. Entries are parsed one at a time, so one bad (or newer) entry never loses the rest; an entry this build can’t read is written back untouched, and a file from a newer schema version is read-only here.
Structs§
- PinBook
- The pin book of one config dir. Every change is a locked
read-modify-write (
<file>.lock), so the daemon and a CLI clearing an entry never lose each other’s writes. - PinEntry
- One pinned journal. Never carries
SessionConfigor settings.
Enums§
- Restored
- Outcome of one restore, for logs and
daemon pin.
Constants§
- FILE_
VERSION - HELD_
RECHECK - A journal held by an exiting process gets this long, once.
- MAX_
ATTEMPTS - Restore attempts the daemon did not live through before an entry is given up as a crash loop (marked failed, not retried).
- PINS_
FILE - RESTORE_
CREATE_ TIMEOUT - One restore’s
createbudget (MCP servers, extensions). - RESTORE_
ENV 0/false/off/no: start the daemon without restoring pins.- STATE_
FAILED - STATE_
WAITING
Functions§
- live_
for - The live session for a journal, if this daemon holds it (a lock placeholder does not count).
- offline
- Entries that are not live in this daemon: what listings show as waiting / failed / not restored yet.
- pin_
offline daemon pinfor a journal that is not live here:--offdrops its entry, on restores it now (a fresh try: the crash marker is reset).Nonewhen the book has no such entry.- resolve_
entry daemon pin <ID|NAME>against the book: exact journal id, a unique name, or a unique journal-id prefix of at leastsuper::close::MIN_PREFIX_LENcharacters.- restore_
all - Cold start: restore every entry not already live, one at a time (so the crash marker names the one entry in flight), after the daemon is ready. Holds the idle exit while it runs.
- restore_
enabled SYNAPS_DAEMON_RESTORE_PINSis not off.- restore_
one - Continue one entry into this daemon, pinned (
synaps --attach --continue <id>’s create). Never steals a held journal; the attempt marker is on disk beforecreate, so a daemon that dies inside it does not try again forever.