/**
 * agent-runtime.mjs — pure env-var sniff used by `init` to label which
 * agent CLI is at the prompt. Spec R4 calls this out as messaging-only:
 * the result NEVER changes which codepath runs, only what gets surfaced
 * in the `requires_input` envelope's `agent_runtime` field and in the
 * `why` strings.
 *
 * Deterministic precedence (claude-code > cursor > aider > unknown) so
 * concurrent envs (e.g. CLAUDECODE + CURSOR_TRACE_ID both set) resolve
 * to a single stable label.
 */
/** @typedef {'claude-code'|'cursor'|'aider'|'unknown'} AgentRuntimeId */
/**
 * Inspect `env` (defaults to process.env) and return the detected agent.
 *
 * @param {NodeJS.ProcessEnv} [env]
 * @returns {AgentRuntimeId}
 */
export function detectAgentRuntime(env = process.env) {
    if (env.CLAUDECODE)
        return 'claude-code';
    for (const k of Object.keys(env)) {
        if (k.startsWith('CURSOR_'))
            return 'cursor';
        if (k.startsWith('AIDER_'))
            return 'aider';
    }
    return 'unknown';
}
//# sourceMappingURL=agent-runtime.mjs.map