Expand description
Wave base utilities: directory management, lock files, environment, platform detection. Port of Go’s pkg/base/.
Structs§
- Wave
Lock - File-based lock for single-instance enforcement.
Constants§
- CONFIG_
DIR - DOMAIN_
SOCKET_ BASE_ NAME - REMOTE_
DOMAIN_ SOCKET_ BASE_ NAME - REMOTE_
FULL_ DOMAIN_ SOCKET_ PATH - REMOTE_
WAVE_ HOME_ DIR_ NAME - WAVE_
APP_ PATH_ ENV - WAVE_
CONFIG_ HOME_ ENV - WAVE_
DATA_ HOME_ ENV - WAVE_
DB_ DIR - WAVE_
DEV_ ENV - WAVE_
DEV_ VITE_ ENV - WAVE_
JWT_ TOKEN_ ENV - WAVE_
LOCK_ FILE - WAVE_
SWAP_ TOKEN_ ENV
Statics§
Functions§
- client_
arch - Get the client architecture string (“os/arch”).
- copy_
dir_ 🔒all - Recursively copy a directory tree.
- determine_
lang - Determine the system language.
- ensure_
dir - Ensure a directory exists with the given permissions.
- ensure_
wave_ config_ dir - Ensure the Wave config directory exists.
- ensure_
wave_ data_ dir - Ensure the Wave data directory exists.
- ensure_
wave_ db_ dir - Ensure the Wave DB directory exists.
- ensure_
wave_ presets_ dir - Ensure the Wave presets directory exists.
- expand_
home_ dir - Expand
~at the start of a path to the home directory. Rejects~user/and paths containing..components (path traversal). - expand_
home_ dir_ safe - Safe version of expand_home_dir that returns the original on error.
- get_
build_ time - Get the build time.
- get_
domain_ socket_ name - Get the domain socket path.
- get_
home_ dir - Get the user’s home directory.
- get_
system_ summary - Get a system summary string.
- get_
version - Get the application version.
- get_
wave_ app_ bin_ path - Get the Wave app bin path.
- get_
wave_ app_ path - Get the Wave app path from env.
- get_
wave_ config_ dir - Get the Wave config directory.
Uses
AGENTMUX_CONFIG_HOMEenv var, or defaults to~/.agentmux/config. - get_
wave_ data_ dir - Get the Wave data directory.
Uses
AGENTMUX_DATA_HOMEenv var, or defaults to~/.agentmux. - get_
wave_ db_ dir - Get the Wave DB directory (
~/.agentmux/db). - get_
wave_ lock_ file - Get the Wave lock file path.
- has_
drive_ 🔒letter_ prefix - True if
sstarts with<ASCII letter>:— a Windows drive-letter prefix. Both rooted (C:\foo) and drive-relative (C:foo) forms match. Used bysafe_join_within_baseto reject paths that would rebase off the working directory under Windows path semantics. - is_
dev_ mode - Check if Wave is in dev mode.
- migrate_
legacy_ data_ dir - Migrate data from
~/.wavetermto~/.agentmuxif needed. Called once at startup. No-op if~/.agentmuxalready exists. - replace_
home_ dir - Replace the home directory prefix with
~. - safe_
join_ within_ base - Lexically join
relativeontobasewhile guaranteeing the result stays insidebase. No filesystem access — does not require either path to exist, which matters on Windows wherePath::canonicalizeadds the\\?\UNC prefix and breaks naivestarts_withchecks against not-yet-created files. - set_
build_ time - Set the build time (called once at startup).
- set_
version - Set the application version (called once at startup).
- verify_
no_ symlink_ escape - After a lexical join, verify that no symlinked ancestor of the
candidate path escapes
base_canonical. The lexical helper alone can’t catch this: if<base>/.claudeis a symlink to/tmp/outsideand the caller writes<base>/.claude/commands/startup.md, the final write follows the symlink and lands outside the working dir.