agentcreds

package
v0.9.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package agentcreds locates Claude Code credentials on a host so the daemon can seed islands with them (and the CLI can push them to a remote daemon).

Claude Code stores its OAuth blob in two places depending on OS:

  • macOS: the login Keychain, generic password "Claude Code-credentials"
  • Linux: ~/.claude/.credentials.json

The bind-mount seeding in the daemon only ever saw the file, which is why islands hosted on macOS started unauthenticated even when the host itself was logged in.

Index

Constants

View Source
const CodexAuthFile = "auth.json"

CodexAuthFile is the credential file's name, in the host dir and in the seed dir alike. The name matters: the island shim copies it BY NAME, so a seed written under any other name is invisible to every island already built.

View Source
const MuseAuthFile = "auth.json"

MuseAuthFile is the credential filename the muse launcher reads.

The name matters less here than it does for Codex, and that is the whole design. Codex's island shim copies /opt/host/codex/auth.json BY NAME, so the filename is a contract with a script baked into the island image. Muse reads MUSE_AUTH_PATH — a full path, set on the launch line — so the daemon points it straight at the mounted seed and no shim exists to disagree with. Keeping the same filename anyway costs nothing and keeps the two seeds legible side by side in ~/.dejima/secrets.

Variables

View Source
var ErrCodexNotFound = errors.New(
	"no Codex credentials found (run `codex` and log in on this machine first)")

ErrCodexNotFound means this machine has no Codex login to push.

View Source
var ErrMuseNotFound = errors.New(
	"no Muse credentials found (run `muse` and log in on this machine first)")

ErrMuseNotFound means this machine has no Muse login to push.

View Source
var ErrNotFound = errors.New("no Claude Code credentials found (run `claude` and log in, or `dejima auth push` from a logged-in machine)")

ErrNotFound means no credential source is available on this host.

Functions

func ValidateClaude

func ValidateClaude(blob []byte) error

ValidateClaude checks that blob looks like a Claude Code credentials file: a JSON object with a claudeAiOauth key. Guards against pushing or seeding garbage that would wedge every new island's login.

func ValidateCodex added in v0.9.8

func ValidateCodex(blob []byte) error

ValidateCodex rejects a blob that is not the credential file, so a push cannot store a truncated read or an unrelated file and have every island silently inherit it.

func ValidateMuse added in v0.9.16

func ValidateMuse(blob []byte) error

ValidateMuse rejects a blob that is not the credential file, so a push cannot store a truncated read or an unrelated file and have every island silently inherit it.

func WriteCodexSeed added in v0.9.8

func WriteCodexSeed(dir string, blob []byte) (string, error)

WriteCodexSeed stores a pushed Codex blob in the daemon's seed dir, as auth.json, atomically — an island starting mid-write must never read half a credential through the bind mount.

func WriteMuseSeed added in v0.9.16

func WriteMuseSeed(dir string, blob []byte) (string, error)

WriteMuseSeed stores a pushed Muse blob in the daemon's seed dir, atomically — an island starting mid-write must never read half a credential through the bind mount.

func WriteSeed

func WriteSeed(dir string, blob []byte) (string, error)

WriteSeed persists blob as the seed credentials file (0600) inside dir, creating dir (0700) if needed. Returns the file path.

Types

type Source

type Source string

Source identifies where credentials were found.

const (
	SourceKeychain Source = "keychain"
	SourceFile     Source = "file"
)

func LoadClaude

func LoadClaude() ([]byte, Source, error)

LoadClaude returns the Claude Code credentials JSON from the freshest local source: the macOS Keychain on darwin, falling back to ~/.claude/.credentials.json.

func LoadCodex added in v0.9.8

func LoadCodex() ([]byte, Source, error)

LoadCodex returns this host's Codex auth blob.

func LoadMuse added in v0.9.16

func LoadMuse() ([]byte, Source, error)

LoadMuse returns this host's Muse auth blob.

Resolves the credential the way the launcher does — $XDG_CONFIG_HOME/muse before ~/.config/muse — so a push from a host that sets XDG_CONFIG_HOME finds the login the operator can plainly see, instead of reporting none.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL