Expand description
The endpoint-credential cache: access + refresh tokens with their expiry,
keyed by a hash of the login target (e.g. mcp:github, intelligence).
Two backings share one record shape. The file cache is the path the
daemon uses: an interactive login writes a per-user 0600 file, the daemon
reads it at startup to seed a provider, refreshes in memory during a run,
and re-reads it (re-refreshing from the refresh token) after a restart. The
durable helpers (load / store / evict) hold the same record
in the durable store under Kind::Cred — the store-backed equivalent for
an embedder that keeps credentials alongside the rest of its state.
Redaction: a cred record holds live tokens, so it is excluded from all
logs, audit records, and the agent:// read surface. Kind::Cred is also
deliberately non-indexed — it never appears in the manifest, so nothing that
walks the manifest to enumerate or replicate state can reach a credential.
Structs§
- Cached
Cred - A cached credential for one endpoint. Never logged.
Functions§
- cred_id
- The stable, filesystem-safe record id for a login
target. - default_
dir - The default per-user credential directory, in precedence order:
$AGENTD_CRED_DIR, else$XDG_STATE_HOME/agentd/creds, else$HOME/.local/state/agentd/creds, else the OS temp dir. The temp-dir fallback only applies to an environment with noHOMEat all; the files written there are still0600. - evict
- Evict the credential for
target(agentd logout). - evict_
file - Evict a credential from the file cache (
agentd logout). Absent = success. - load
- Load the cached credential for
target, if present and parseable. - load_
file - Load a credential from the file cache, if present and parseable.
- now_ms
- Milliseconds since the Unix epoch (for
expires_at_ms). - store
- Store (or replace) the credential for
target. - store_
file - Write a credential to the file cache (creating the dir; the file is
0600).