Files
multi-agent-mux/.mam.env.example
T
GodopuandClaude Opus 5.5 0eec795cd1 fix(issue-26): review - an unreadable env file is an error, NUL lines are skipped, integers are ASCII in every locale, empty flags are refused
Merge-workspace review of PR #43 (codex R1-R4, claude R1/R2).

- R1: envfile.parse raises EnvFileError when the file exists but cannot be
  read or decoded as a whole; `--shell` prints the cause and exits 1, so the
  wrapper stops (rc 1, as before #26) instead of running on defaults, and
  mqtt_common's entry points stop on the same error. A bad single line is
  still a warning. The wrapper's message no longer claims a read failure
  when the cause is elsewhere ("cannot load ... see the line above").
- R2: lib.sh mam_int spells out the ASCII blanks and digits instead of
  [[:space:]]/[0-9], which follow the locale: U+2003 30 U+2003 was 30 in the
  wrapper and invalid in the runner under en_US.UTF-8. The test oracle
  _expected uses the same ASCII rule.
- R3: an integer flag given explicitly with an empty value is refused like
  any other invalid value; only an absent flag keeps its default.
- R4: a line holding a NUL byte is skipped with a warning by both loaders;
  before, the wrapper read "leftright" and the Python loader died.
- .mam.env.example states the format: no expansion, `export` and bash's own
  variables skipped, a trailing `# ...` is part of the value, the environment
  wins, an unreadable file is an error.

Tests: unreadable (0000) and invalid-UTF-8 files stop the wrapper and the
Python loader; a NUL line is skipped by both; Unicode blanks/digits are
invalid for mam_int, _positive_int, the wrapper and the runner under C and
en_US.UTF-8; explicit empty values for the five integer flags are refused.
All of them fail on b58edac.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
2026-10-01 22:59:57 +09:00

221 lines
8.9 KiB
Bash

# ---------------------------------------------------------------------------
# .mam.env.example — committable template for the multi-agent-mux-* skills
#
# This file is tracked in git and contains NO secrets. To get a working local
# config, copy it to `.mam.env` (which is git-ignored) and edit as needed:
#
# scripts/generate-env.sh # creates .mam.env from this template if absent
# # or manually: cp .mam.env.example .mam.env
#
# Every variable below is OPTIONAL. The skills already resolve sane defaults
# (shown after each `#default:` line), so an unset/commented variable just keeps
# the built-in behaviour. Uncomment + edit only the ones you want to override.
#
# FORMAT (Issue #26 - one parser, lib_py/delegation/envfile.py, for the
# delegate-job wrapper and the Python tools alike; the file is never `source`d):
# - one KEY=VALUE per line; blank lines and lines starting with `#` are skipped;
# - spaces around the key and the value are removed, and one pair of matching
# quotes around the value is removed ("a b" -> a b);
# - nothing is expanded: `$HOME`, `${X}`, `$(cmd)` and backticks stay literal,
# so write absolute paths; a trailing `# ...` is part of the value;
# - `export KEY=...`, a key that is not [A-Za-z_][A-Za-z0-9_]*, a line
# without `=`, a line with a NUL byte, and bash's own variables (IFS, PS4,
# RANDOM, BASH_*, ...) are skipped with a warning naming the line number;
# - a variable already set in the environment wins over this file;
# - a file that exists but cannot be read is an error (the wrapper exits 1).
#
# SECURITY: never put real secrets in this template. Secret-bearing vars use a
# `replace_me` placeholder — fill them in only in your local `.mam.env`.
# SECURITY NOTE:
# The default MQTT broker (broker.hivemq.com) is public and unencrypted. Job event
# payloads (including task details) sent to the default broker can be read by anyone.
# For production or private workloads, configure a private broker with TLS and Auth below.
# ---------------------------------------------------------------------------
# ===========================================================================
# Workspace / runtime paths
# ===========================================================================
# Single source of truth for the agent session registry YAML.
#default: <workspace>/.mam/agent-sessions.yaml
# AGENT_SESSIONS_YAML=/path/to/workspace/.mam/agent-sessions.yaml
# Root directory that holds Claude Code per-project conversation logs (*.jsonl).
#default: $HOME/.claude/projects
# CLAUDE_PROJECT_DIR=/home/you/.claude/projects
# Directory scanned for per-session launcher wrappers (~/.local/bin/<session>).
#default: $HOME/.local/bin
# LOCAL_BIN=/home/you/.local/bin
# Isolated Herdr session socket name (`herdr --session <name>`).
#default: mam-<workspace-slug>
# HERDR_SESSION_NAME=mam-multi-agent-mux
# Legacy Herdr server identifier (DEPRECATED: use HERDR_SESSION_NAME instead).
# Written into .mam.env by install.sh as an active default.
#default: multi-agent-mux
# HERDR_SERVER_NAME=multi-agent-mux
# Path to the Herdr Unix domain socket.
#default: $HOME/.config/herdr/herdr.sock
# HERDR_SOCKET_PATH=/home/you/.config/herdr/herdr.sock
# Explicit Herdr workspace scope identifier (`herdr pane list --workspace <id>`).
# Hard filters pane/agent resolution to this workspace. When unset, falls back
# to $WORKSPACE_ROOT/.mam/herdr_workspace_id or server-global resolution.
#default: <unset> (uses persisted .mam/herdr_workspace_id or global)
# HERDR_WORKSPACE_ID=w1
# ===========================================================================
# delegate-job / MQTT broker
# ===========================================================================
# MQTT broker host the delegate-job publisher/subscriber connects to.
#default: broker.hivemq.com
# MQTT_BROKER=broker.hivemq.com
# MQTT broker port. Written into .mam.env by install.sh as an active default.
#default: 1883
# MQTT_PORT=1883
# MQTT reconnect retry interval (seconds).
#default: 2
# MQTT_RETRY_INTERVAL=2
# MQTT maximum reconnect retries.
#default: 5
# MQTT_MAX_RETRIES=5
# Broker auth username. Leave unset for anonymous brokers.
#default: (unset → anonymous)
# MQTT_USERNAME=replace_me
# Broker auth password. SECRET — fill in only in your local .mam.env, never commit.
#default: (unset → anonymous)
# MQTT_PASSWORD=replace_me
# Prefix for generated MQTT client ids (publisher/subscriber/monitor).
#default: hermes
# MQTT_CLIENT_ID_PREFIX=hermes
# MQTT keepalive interval (seconds). Used by paho-mqtt client connections.
#default: 60
# MQTT_KEEPALIVE=60
# Log level for MAM runtime components (DEBUG, INFO, WARN, ERROR).
#default: INFO
# MAM_LOG_LEVEL=INFO
# Optional xAI API Key for Grok Build CLI (if ~/.grok/auth.json is not present).
#default: (unset → reads ~/.grok/auth.json)
# XAI_API_KEY=replace_me
# Optional multi-provider API keys for OpenCode CLI and OpenAI API key for Codex CLI.
#default: (unset → reads ~/.local/share/opencode/auth.json or ~/.codex/auth.json)
# ANTHROPIC_API_KEY=replace_me
# OPENAI_API_KEY=replace_me
# GEMINI_API_KEY=replace_me
# GROQ_API_KEY=replace_me
# Optional override for Codex CLI state / session directory.
#default: $HOME/.codex
# CODEX_HOME=/home/you/.codex
# Optional inline JSON permissions configuration for OpenCode.
#default: (unset → defaults to --auto CLI bypass)
# OPENCODE_PERMISSION='{"*":"allow"}'
# Retention period (days) for delegate-job event logs.
#default: 7
# MAM_EVENT_RETENTION_DAYS=7
# Garbage collection threshold (minutes) for old message buffer logs.
#default: 60
# MAM_BUFFER_GC_MINUTES=60
# Marker string used by loop delegation guard (O-3).
#default: (built-in guard marker)
# MAM_LOOP_GUARD_MARKER=mam_loop_active
# Path to a CA bundle for TLS broker verification (set MQTT_TLS=1 to use TLS).
#default: (unset → no custom CA)
# MQTT_CA_CERTS=/path/to/ca.crt
# Client certificate for mutual-TLS brokers.
#default: (unset → no client cert)
# MQTT_CERTFILE=/path/to/client.crt
# Client private key for mutual-TLS brokers. SECRET — keep the key file private.
#default: (unset → no client key)
# MQTT_KEYFILE=/path/to/client.key
# Directory for delegate-job audit logs (sits beside .mam/jobs/).
#default: <cwd>/.mam/delegate_job_logs
# DELEGATE_JOB_LOGS_DIR=/path/to/workspace/.mam/delegate_job_logs
# Max attempts to poll for pane renderer quiescence in send_keys_safe.
#default: 20
# SKS_QUIESCENT_TRIES=20
# Interval (seconds) between pane quiescence capture polls.
#default: 0.5
# SKS_QUIESCENT_INTERVAL=0.5
# Consecutive empty captures to conclude unobservable/headless mode early.
#default: 3
# SKS_EMPTY_GIVEUP=3
# Minimum columns a pane must retain after a horizontal/column split (2xK layout engine).
#default: 15
# MAM_MIN_PANE_COLS=15
# Minimum rows a pane must retain after a vertical split (2xK layout engine).
# Set to 0 to disable vertical row constraints (terminal scrollback handles height).
#default: 0
# MAM_MIN_PANE_ROWS=0
# Maximum number of columns a workspace may grow to before the engine reports
# 'overflow' (which makes lib.sh create a fresh workspace instead of splitting).
# Applies to both measured (GUI) and headless 0x0 layouts.
#default: 2
# MAM_MAX_PANE_COLS=2
# Maximum number of rows per column before overflow. Default 2 guarantees an
# even 2x2 grid; do not raise this until a resize-normalisation pass exists.
#default: 2
# MAM_MAX_PANE_ROWS=2
# Kill the session instead of preserving it when TUI readiness times out.
#default: 0
# MAM_KILL_ON_READY_TIMEOUT=0
# Number of trailing non-blank pane lines scanned for blocking modal signatures.
#default: 8
# MAM_DIALOG_TAIL_LINES=8
# Consecutive empty captures before wait_for_tui_ready declares the pane unobservable.
# NOTE: distinct from SKS_EMPTY_GIVEUP, which governs send_keys_safe quiescence (default 3).
#default: 5
# MAM_READY_EMPTY_GIVEUP=5
# ==============================================================================
# deploy / distribution source (for forks/mirrors)
# ==============================================================================
# Note: These variables are read from the execution environment by deployment scripts.
# Since deploy/install.sh runs before .mam.env exists, you must pass them via export
# or prepended variables (e.g. MAM_REPO_URL=... bash deploy/install.sh).
# If you run a private mirror, we strongly recommend configuring all three variables.
# Distribution repository URL (cloned during recovery steps).
#default: https://git.godopu.com/tmpl/multi-agent-mux.git
# MAM_REPO_URL=https://git.godopu.com/tmpl/multi-agent-mux.git
# Distribution archive download URL (used for bootstrap extraction).
#default: https://git.godopu.com/tmpl/multi-agent-mux/archive/main.tar.gz
# MAM_ARCHIVE_URL=https://git.godopu.com/tmpl/multi-agent-mux/archive/main.tar.gz
# Distribution update/installer script URL.
#default: https://git.godopu.com/tmpl/multi-agent-mux/raw/branch/main/deploy/install.sh
# MAM_INSTALLER_URL=https://git.godopu.com/tmpl/multi-agent-mux/raw/branch/main/deploy/install.sh