Skip to main content

Module shellintegration

Module shellintegration 

Source
Expand description

Shell integration script deployment and shell startup configuration.

Embeds shell integration scripts (bash, zsh, pwsh, fish) and deploys them to ~/.agentmux/shell/<type>/ on first use or when the version changes. The shell controller uses these scripts to install prompt hooks that send OSC 16162;E commands carrying AGENTMUX_AGENT_ID, enabling per-pane title and color to work.

Structs§

ShellStartup
Shell startup configuration: extra args and env vars to inject.

Enums§

ShellType

Constants§

BASH_SCRIPT 🔒
FISH_SCRIPT 🔒
MUXCLIENT_JS 🔒
Shared auth-env-read + authenticated-fetch plumbing every core above (except muxlog, which does no REST calls) imports via a relative ./lib/muxclient.mjs — so it must be deployed at <shell>/lib/, not flat beside its callers. See docs/specs/SPEC_MUXSH_FULL_COLLECTION_2026_09_16.md §2.8.
MUXLOG_JS 🔒
Shared muxlog core (Node). Deployed once at <shell>/muxlog.mjs; every shell’s muxlog function delegates to it. One tested implementation does log discovery + NDJSON rendering + filtering for all shells.
MUXOPEN_JS 🔒
muxopen — launch an agent into a pane from a terminal (the constructive sibling of the stop verbs; REPORT_AGENT_OPEN_API_GAP_2026_09_06.md). Deployed beside muxlog.mjs/muxspect.mjs; shell muxopen functions delegate here.
MUXSH_JS 🔒
muxsh — open editor/browser panes from a terminal (REPORT_WSH_STYLE_CLI_FOR_AGENT_APP_API_2026_09_16.md, SPEC_MUXSH_CLI_2026_09_16.md). Deployed beside its three siblings; shell muxsh functions delegate here.
MUXSPECT_JS 🔒
Shared muxspect core (Node) — muxlog’s live-state sibling. Deployed once at <shell>/muxspect.mjs; every shell’s muxspect function delegates to it. See docs/specs/SPEC_MUXSPECT_LIVE_INTROSPECTION_TOOL_2026_08_01.md.
PWSH_SCRIPT 🔒
ZSH_SCRIPT 🔒

Functions§

deploy_scripts
detect_shell_type
Detect shell type from the shell binary path.
documented_shell_root
The stable, user-facing script root: ~/.agentmux/shell.
get_shell_startup
Get the startup configuration for launching an interactive shell with AgentMux integration. Returns None for unknown shell types.
integration_base
integration_base_for bound to this process’s real data dir and home.
integration_base_for
Deploy shell integration scripts into <shell_root>/<type>/. Skips deployment if the version marker is already current. Errors are logged but not fatal — a missing script just means no integration. Root under which this instance’s shell-integration scripts are deployed.
version_marker 🔒
Deployment marker: <package version>-<content hash>, NOT the bare package version alone (codex P2 on PR #2380). Local/dev builds routinely iterate on these embedded scripts WITHOUT a version bump (this repo’s own convention — see CLAUDE.md’s “Build versioning — local builds are labeled, not versioned”), so a version-only marker left .version already matching on every same-version rebuild/restart, silently skipping deployment of a newly-added or newly-edited script (muxspect.mjs specifically, added in the same PR that added the startup call site — the marker never invalidated to pick it up). Hashing the actual embedded content means ANY change to ANY script forces a redeploy regardless of whether the package version moved, while an unchanged rebuild still skips the (cheap, but not free) disk writes.