Documentation
¶
Overview ¶
Package agentenv forwards AI coding-agent detection variables across the container boundary so tools like laravel/pao (via laravel/agent-detector) still switch to JSON output when run through `lerd php`, tinker, or MCP.
Index ¶
Constants ¶
const MCPMarker = "lerd-mcp"
MCPMarker is the AI_AGENT value injected for MCP-originated commands when no real agent var is present on the host. An MCP call proves an agent is driving the command, and agent-detector treats any AI_AGENT value as one.
Variables ¶
var Vars = []string{
"AI_AGENT",
"CLAUDECODE", "CLAUDE_CODE", "CLAUDE_CODE_IS_COWORK",
"CURSOR_AGENT",
"GEMINI_CLI",
"CODEX_SANDBOX", "CODEX_CI", "CODEX_THREAD_ID",
"AUGMENT_AGENT",
"AMP_CURRENT_THREAD_ID",
"OPENCODE_CLIENT", "OPENCODE",
"COPILOT_MODEL", "COPILOT_ALLOW_ALL", "COPILOT_GITHUB_TOKEN", "COPILOT_CLI",
"REPL_ID",
"ANTIGRAVITY_AGENT",
"PI_CODING_AGENT",
"KIRO_AGENT_PATH",
}
Vars are the environment variables laravel/agent-detector inspects to decide an AI agent is driving the process. Kept in sync with that library's AGENT_ENV_VARS set so detection survives `lerd php`, tinker, and MCP exec.
Functions ¶
func MCPInject ¶
MCPInject is Passthrough for commands lerd runs on behalf of an MCP client. It forwards any real host agent vars, and when none are present injects a neutral marker so detection succeeds without depending on host env leaking.
func Passthrough ¶
Passthrough returns the KEY=VALUE entries from environ for any agent detection variable that is set, ready to hand to `--env`. Values are kept verbatim (agent-detector pattern-matches some) except for presenceOnly vars.
Types ¶
This section is empty.