// engine/host-detection/detect-host.ts — SPEC-708: detect connected MCP host.
// Used by tool responses to emit host-aware interactive-question directives,
// and by init_project to know which host scaffolds to run.
/**
 * Identify the connected MCP host based on environment markers.
 * Order of precedence:
 *   1. Explicit override via PLANU_HOST env var.
 *   2. Host-specific env vars set by each CLI when it spawns the MCP server.
 *   3. Default to 'universal' (generic phrasing) when nothing matches.
 */
export function detectHost(env = process.env) {
    const override = env.PLANU_HOST?.trim().toLowerCase();
    if (override === 'claude-code' ||
        override === 'cursor' ||
        override === 'codex' ||
        override === 'gemini' ||
        override === 'universal') {
        return override;
    }
    if (env.CLAUDECODE === '1' || env.CLAUDE_CODE === '1' || env.CLAUDE_CODE_SESSION) {
        return 'claude-code';
    }
    if (env.CURSOR_SESSION_ID || env.CURSOR_TRACE_ID) {
        return 'cursor';
    }
    if (env.OPENAI_CODEX_SESSION || env.CODEX_WORKSPACE) {
        return 'codex';
    }
    if (env.GEMINI_CLI_SESSION || env.GEMINI_API_KEY_SCOPE === 'cli') {
        return 'gemini';
    }
    return 'universal';
}
//# sourceMappingURL=detect-host.js.map