// engine/llm-runtime/client-detector.ts — SPEC-460: Detect connected LLM client
// Uses MCP SDK getClientVersion() for real data. Never invents.
// Transport-agnostic: uses ConnectedClientInfo (domain type), not SDK's Implementation.
/** Singleton: populated after MCP initialize handshake completes */
let connectedClient = null;
/** Called once from server.oninitialized to capture real client info */
export function setConnectedClient(client) {
    connectedClient = client;
}
/** Returns the real connected client info, or null if not yet initialized */
export function getConnectedClient() {
    return connectedClient;
}
/** Detect model hint from environment variables — only real, never guessed */
export function detectModelFromEnv() {
    // Claude Code sets this in some contexts
    const claudeModel = process.env.CLAUDE_CODE_MODEL ?? process.env.ANTHROPIC_MODEL ?? process.env.CLAUDE_MODEL;
    if (claudeModel) {
        return claudeModel;
    }
    // OpenAI-compatible
    const openaiModel = process.env.OPENAI_MODEL ?? process.env.MODEL_ID;
    if (openaiModel) {
        return openaiModel;
    }
    return null;
}
/** Build a summary string of what we actually know (no guessing) */
export function getRuntimeSummary() {
    const parts = [];
    if (connectedClient) {
        parts.push(`Client: ${connectedClient.name} v${connectedClient.version}`);
    }
    const model = detectModelFromEnv();
    if (model) {
        parts.push(`Model: ${model}`);
    }
    if (parts.length === 0) {
        return 'Runtime: unknown (no client connected yet)';
    }
    return parts.join(' | ');
}
//# sourceMappingURL=client-detector.js.map