agentenv

package
v1.28.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 1 Imported by: 0

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

View Source
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

View Source
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

func MCPInject(environ []string) []string

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

func Passthrough(environ []string) []string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL