xa.hosts¶
Host abstraction — local, SSH, HTTP backends.
A Host is anything that can enumerate Claude Code sessions and
perform lifecycle actions on them (spawn / resume / kill). All transports
return the same xa.sessions.Session shape so higher layers
don’t care whether sessions live on this machine, on another machine
over SSH, or behind another xa server over HTTPS.
The protocol is duck-typed (runtime_checkable), so user extensions
only need to implement the methods they actually use — unused methods
can raise NotImplementedError.
Functions
The out-of-the-box registry: one local host, nothing else. |
Classes
|
Duck-typed interface every transport satisfies. |
|
The machine |
|
Transcripts via rsync; actions via ssh exec. |
|
Client for a remote |
- class xa.hosts.HTTPHost(name, *, base_url, auth=None, username=None, password=None, token=None, timeout=30.0)[source]¶
Bases:
objectClient for a remote
xa serveinstance.
- class xa.hosts.Host(*args, **kwargs)[source]¶
Bases:
ProtocolDuck-typed interface every transport satisfies.
- class xa.hosts.LocalHost(name='local', *, claude_home=PosixPath('/home/runner/.claude'), claude_bin='claude', tmux_bin='tmux', alive_predicate=None)[source]¶
Bases:
objectThe machine
xais running on.
- class xa.hosts.SSHHost(name, *, host, user=None, remote_claude_home='~/.claude', cache_dir=PosixPath('/home/runner/.cache/xa/remotes'), stale_threshold_sec=3600, claude_bin='claude', tmux_bin='tmux', ssh_bin='ssh', rsync_bin='rsync')[source]¶
Bases:
objectTranscripts via rsync; actions via ssh exec.
- Parameters:
name (
str) – Logical name used inSession.hostand elsewhere.host (
str) – SSH hostname / alias. Matches cc-sessions: either an~/.ssh/configalias (devbox) or a raw host (1.2.3.4).remote_claude_home (
str) – Remote path to~/.claude/. Defaults to~/.claudewhich resolves relative to the SSH user’s home on the remote side.cache_dir (
Path) – Where to stage the rsync’d tree locally.stale_threshold_sec (
int) – Re-sync when the cached copy is older than this.0means always sync.
Modules