Expand description
Identity injection at agent CLI spawn time.
When an agent instance is launched, the launch records an
identity_id on the db_agent_instances row (v7 schema). Right
before the CLI subprocess starts, this module:
- Looks up the active instance for the spawning block.
- Reads its
identity_id(a legacy filter value; credentials come from the links in step 3, not from this). - Reads the direct
db_agent_identity_linksrows for the instance’s definition. - For each link: looks up the Account row, resolves its
SecretRefto a plaintext value, looks up the provider → env-var matrix, and merges those env vars into the spawnenv_varsHashMap.
Failure modes differ by provider class. An api-key-class failure
(missing account, unresolvable secret, unknown provider) is logged and
skipped. An oauth-class provider with no resolvable bound account
blocks the spawn (resolver::inject’s gate_oauth_failure); there is
no fallback to the user’s global CLI login.
Closes Phase 2 of issue #678 (the per-instance injection layer). Phase 1 (Account registry + UI) and the v7 schema reshape (Bundle entity) were prerequisites; Phase 3 (encrypted vault, OAuth flows) is deferred.
Re-exports§
pub use resolver::inject_identity_env;
Modules§
- account_
email - The login email of an OAuth provider account, read from the account’s own
config dir —
SPEC_ACCOUNT_EMAIL_IN_ARMORY_2026_09_23.md§4. - account_
numbering - Numbers for accounts that share a provider and an email
(
docs/specs/SPEC_ACCOUNT_SWITCH_FROM_THE_COMPOSER_NO_BIND_2026_10_26.md§3.3). - accounts_
changed - Tells every open window that an account changed, from the code that changes it.
- auth_
diag - Credential-state diagnostics for login/logout robustness runs.
- auth_
dirs - Filesystem/directory provisioning for the pre-launch OAuth flow.
- auth_
patterns - Per-provider stdout/stderr pattern matchers for the pre-launch
OAuth flow. The
auth loginsubprocess of each CLI provider emits an OAuth URL (or device code) to stdout/stderr in a slightly different shape. This module knows how to extract them. - auth_
session - In-memory manager for pre-launch OAuth sessions.
- aws_
broker - AWS credentials for container agents, brokered per use. Spec: docs/specs/SPEC_CONTAINER_AGENT_AWS_CREDENTIALS_2026_10_31.md.
- browser_
credential_ store - OS-keychain-backed storage for browser-pane HTTP Basic-Auth credentials, scoped per identity so one agent’s saved site credential is never reachable through another identity’s browsing session.
- cleanup
- On-disk / keychain credential cleanup for a deleted identity account.
- credential_
watch - A Claude sign-in that is lost while agents run on it is noticed when it happens, not at the next spawn.
- foreign_
dir - A config dir inside another channel’s
identities/folder. - gh_
agent_ token - A GitHub token from the host’s
gh-agent, for a container agent. - github_
connect - Connect with GitHub, desktop side.
- github_
hooks - The git hooks directory of an agent whose GitHub access goes through AgentMux.
- github_
installs - Connect with GitHub, desktop side: the installations of the AgentMux GitHub App.
- github_
tokens - GitHub tokens for agents.
- github_
trip - The one-trip first connect with GitHub, desktop side: the relay half.
- google_
offered - Which Google services AgentMux’s own client may ask for in this build (SPEC_GOOGLE_PHASE_B_AGENTMUXS_OWN_CLIENT_2026_11_01.md D6, §8).
- key_
validator - Live API-key validation for Connectors → Accounts.
- oauth_
client - Service-account OAuth 2.0 client for Connectors → Accounts.
- oauth_
tokens - What srv does with a service-OAuth account’s tokens once it has them: read the keychain blob, take the account’s email from the ID token, refresh near expiry, revoke on delete, and keep the user’s own OAuth client (BYO) in the keychain. docs/specs/SPEC_GOOGLE_CONNECTORS_GMAIL_CALENDAR_DRIVE_2026_10_14.md G0 (§2.1’s gaps, §3.1, D2, D8).
- resolver
- Identity → env-var resolver.
- secret_
store - srv’s secret storage: account API keys, OAuth accounts, MuxBus credentials, browser-pane logins.
- sign_
in_ hook - What the sign-in code tells the account episodes. A sign-in that completed, or a validate that passed, means
the account’s credentials are good, so the panes stopped on a refused sign-in can go on. The episodes live in
the server layer, which registers its reader here once at startup (
set_after_sign_in), soidentitydoes not nameserver(Area54 #1350). Before that registration there is nothing to tell. - sign_
in_ watch - A sign-in value the CLI has just refreshed is hidden from transcripts within moments of the write, not at the next account tick.
- stable_
account - A signed-in account’s id that is the same on every machine
(
docs/specs/SPEC_AGENTS_OPERATE_OTHER_MACHINES_2026_10_30.md§4.4). - staged_
watch - A sign-in value a container’s CLI refreshes into its own staged copy is hidden from transcripts within moments of
the write, as one in the account’s own file is (
sign_in_watch). - token_
warmup - One refresh at a time per Claude config dir (#6081).