/** * Agent runtime environment utilities. * * Provides functions to compute environment variables for running agents * with custom config directories. Delegates to axshared for path info. */ import type { AgentCli } from "axshared"; /** Result type for getAgentConfigEnvironment */ type GetAgentConfigEnvironmentResult = { ok: true; env: Record; warning: string | undefined; } | { ok: false; error: string; }; /** * Get agent-specific environment variables for custom directories. * * Computes the environment variables needed to run an agent with specific * config and data directories. This handles agents that require env vars to * point to parent directories (e.g., HOME for gemini, XDG paths for opencode). * * **Agents without separation** (Claude, Codex, Gemini, Copilot): * - `configDirectory` and `dataDirectory` are interchangeable * - Either can be provided alone to set both locations * * **Agents with separation** (OpenCode): * - Directories are independent * - If only `configDirectory` provided, data uses default location * - If only `dataDirectory` provided, config uses default location * * @param agent - The agent CLI identifier * @param configDirectory - Custom config directory (optional) * @param dataDirectory - Custom data directory (optional) * @returns Result with agent-specific env vars, warning, or error * * @example * // Claude: env var points directly to config dir * getAgentConfigEnvironment("claude", "/tmp/test/.claude") * // Returns: { ok: true, env: { CLAUDE_CONFIG_DIR: "/tmp/test/.claude" }, warning: undefined } * * // OpenCode with only configDir: data uses default * getAgentConfigEnvironment("opencode", "/tmp/config/opencode") * // Returns: { ok: true, env: { XDG_CONFIG_HOME: "/tmp/config", XDG_DATA_HOME: "/home/user/.local/share" }, warning: "..." } */ declare function getAgentConfigEnvironment(agent: AgentCli, configDirectory?: string, dataDirectory?: string): GetAgentConfigEnvironmentResult; export { getAgentConfigEnvironment, type GetAgentConfigEnvironmentResult };