Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
# Daemon attachment and local startup
Albedo's API connection and its local process launcher have separate jobs. A
client can attach to a supplied endpoint without reading local installation
files, starting a process, or replacing one.
The [localdaemon package](../cli/internal/localdaemon/lifecycle.go) owns
discovery and launch. The [API adapter](../cli/internal/daemon/server.go) owns
attachment and compatibility checks. [HTTP API behavior](http-api-design.md)
defines the public operations.
## Connection flow
1. `Discover` reads the local record and probes its authenticated `/server`
resource. It reports absence, a proven stale record, or a running daemon.
Invalid records, authentication failures, unreachable endpoints, and
unhealthy daemons return actionable errors. A failed health check does not
authorize another launch.
2. `Attach` validates the protocol and required capabilities, then returns an
API connection. Build identity is update information. A different build with
the required API remains usable.
3. The ordinary interactive CLI offers to restart a running daemon when the
candidate build may differ from the running one: the content digests decide
when both sides hashed their code trees, the build labels otherwise, and an
unprovable comparison keeps the offer. Proven sameness attaches without
asking. Keeping the daemon is the default. The prompt warns that restarting
interrupts active work across sessions. Scripts keep a compatible daemon and
report incompatibility instead of replacing it.
4. `Launch` starts a local daemon only under the application's policy.
Concurrent launchers coordinate through a persistent advisory
`launcher.lock`. The daemon's storage lock remains the authority for home
ownership.
5. `Upgrade` requires the exact snapshot approved by the caller. It validates
the replacement executable before stopping anything, rechecks the approved
target, drains the supported daemon, and launches its replacement. If the
target changed, the c…