BASH_SCRIPT

Constant BASH_SCRIPT 

Source
const BASH_SCRIPT: &str = "# AgentMux shell integration for bash\n# Deployed to: ~/.agentmux/shell/bash/.bashrc\n# Loaded via: bash --rcfile <this-file>\n\n# Source /etc/profile for system-wide settings\nif [ -f /etc/profile ]; then\n    . /etc/profile\nfi\n\n# wsh has been retired \u{2014} AGENTMUX is now a plain \"1\" sentinel.\n# See specs/SPEC_RETIRE_WSH_2026_04_12.md.\n\n# Source the first of ~/.bash_profile, ~/.bash_login, or ~/.profile that exists\nif [ -f ~/.bash_profile ]; then\n    . ~/.bash_profile\nelif [ -f ~/.bash_login ]; then\n    . ~/.bash_login\nelif [ -f ~/.profile ]; then\n    . ~/.profile\nfi\n\n# \u{2500}\u{2500}\u{2500} Shell Integration \u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\n\n_agentmux_si_blocked() {\n    [[ -n \"$TMUX\" || -n \"$STY\" || \"$TERM\" == tmux* || \"$TERM\" == screen* ]]\n}\n\n_agentmux_si_urlencode() {\n    local s=\"$1\"\n    s=\"${s//%/%25}\"\n    s=\"${s// /%20}\"\n    s=\"${s//#/%23}\"\n    s=\"${s//\\?/%3F}\"\n    s=\"${s//&/%26}\"\n    s=\"${s//;/%3B}\"\n    s=\"${s//+/%2B}\"\n    printf \'%s\' \"$s\"\n}\n\n_agentmux_si_osc7() {\n    _agentmux_si_blocked && return\n    local encoded_pwd\n    encoded_pwd=$(_agentmux_si_urlencode \"$PWD\")\n    printf \'\\033]7;file://%s%s\\007\' \"$HOSTNAME\" \"$encoded_pwd\"\n}\n\n_agentmux_si_json_escape() {\n    local s=\"$1\"\n    s=\"${s//\\\\/\\\\\\\\}\"\n    s=\"${s//\\\"/\\\\\\\"}\"\n    printf \'%s\' \"$s\"\n}\n\n_AGENTMUX_SI_LAST_AGENT=\"\"\n\n# Send AGENTMUX_AGENT_ID via OSC 16162;E on every prompt (only when changed)\n_agentmux_si_agent_env() {\n    _agentmux_si_blocked && return\n    local current_agent=\"\"\n    if [[ -n \"$AGENTMUX_AGENT_ID\" ]]; then\n        current_agent=\"AGENTMUX_AGENT_ID:$AGENTMUX_AGENT_ID:COLOR:$AGENTMUX_AGENT_COLOR\"\n    fi\n    if [[ \"$current_agent\" != \"$_AGENTMUX_SI_LAST_AGENT\" ]]; then\n        _AGENTMUX_SI_LAST_AGENT=\"$current_agent\"\n        if [[ -n \"$AGENTMUX_AGENT_ID\" ]]; then\n            local escaped\n            escaped=$(_agentmux_si_json_escape \"$AGENTMUX_AGENT_ID\")\n            local payload=\"{\\\"AGENTMUX_AGENT_ID\\\":\\\"$escaped\\\"\"\n            if [[ -n \"$AGENTMUX_AGENT_COLOR\" ]]; then\n                local color_escaped\n                color_escaped=$(_agentmux_si_json_escape \"$AGENTMUX_AGENT_COLOR\")\n                payload=\"$payload,\\\"AGENTMUX_AGENT_COLOR\\\":\\\"$color_escaped\\\"\"\n            fi\n            payload=\"$payload}\"\n            printf \'\\033]16162;E;%s\\007\' \"$payload\"\n        else\n            printf \'\\033]16162;E;{}\\007\'\n        fi\n    fi\n}\n\n_agentmux_si_prompt_command() {\n    _agentmux_si_osc7\n    _agentmux_si_agent_env\n}\n\n# \u{2500}\u{2500}\u{2500} muxlog \u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\u{2500}\n# Discover, render & follow AgentMux logs across every running instance.\n# Delegates to the shared Node core (muxlog.mjs, deployed next to this rcfile).\n#   muxlog                 tail the most-recently-active host log (follow)\n#   muxlog ls              list every instance\'s logs (newest first)\n#   muxlog srv grep <re>   search the active sidecar log (transcript excluded)\n#   muxlog bridge          startup-handshake trace (debug reconnect loops)\n#   muxlog help            full usage\n# Resolve muxlog.mjs once, at source time (BASH_SOURCE = this rcfile).\n_AGENTMUX_MUXLOG_JS=\"$(cd \"$(dirname \"${BASH_SOURCE[0]:-$0}\")/..\" 2>/dev/null && pwd)/muxlog.mjs\"\nmuxlog() {\n    if command -v node >/dev/null 2>&1 && [ -f \"$_AGENTMUX_MUXLOG_JS\" ]; then\n        node \"$_AGENTMUX_MUXLOG_JS\" \"$@\"\n        return\n    fi\n    # Fallback (no node / core missing): legacy pointer-based tail, so logs are\n    # never wholly inaccessible.\n    local target=\"${1:-host}\" action=\"${2:-tail}\"\n    [ -z \"$AGENTMUX_LOG_DIR\" ] && { echo \"AGENTMUX_LOG_DIR not set \u{2014} run inside an AgentMux terminal\" >&2; return 1; }\n    local ptr=\"$AGENTMUX_LOG_DIR/current-${target}-v${AGENTMUX_VERSION}.path\"\n    [ -f \"$ptr\" ] || { echo \"muxlog: Node core unavailable and no pointer for \'$target\'\" >&2; return 1; }\n    local pc logfile; pc=\"$(cat \"$ptr\")\"\n    case \"$pc\" in /* | ?:[/\\\\]*) logfile=\"$pc\" ;; *) logfile=\"$AGENTMUX_LOG_DIR/$pc\" ;; esac\n    case \"$action\" in tail) tail -f \"$logfile\" ;; cat) cat \"$logfile\" ;; *) grep \"$action\" \"$logfile\" ;; esac\n}\n\n# Append to PROMPT_COMMAND (array-safe)\nif [[ $(declare -p PROMPT_COMMAND 2>/dev/null) == \"declare -a\"* ]]; then\n    PROMPT_COMMAND+=(_agentmux_si_prompt_command)\nelse\n    PROMPT_COMMAND=\"${PROMPT_COMMAND:+$PROMPT_COMMAND$\'\\n\'}_agentmux_si_prompt_command\"\nfi\n";