export class RuntimeStatusService {
    static build(snapshot) {
        const context = snapshot.runtimeContext;
        if (!context) {
            return snapshot.workspaceId ? 'runtime context loading...' : 'workspace loading...';
        }
        return [
            `model=${context.model}`,
            `reasoning=${RuntimeStatusService.formatReasoning(context)}`,
            `permissions=${context.permissionMode}`,
            RuntimeStatusService.formatAuth(context),
            RuntimeStatusService.formatContextWindow(context),
            `drift=${context.driftEnabled ? context.driftLevel ?? 'unknown' : 'off'}`,
            `session=${context.sessionId} (${context.sessionName})`,
            snapshot.running ? 'status=running' : undefined,
        ].filter((item) => Boolean(item)).join(' • ');
    }
    static formatReasoning(context) {
        if (!context.reasoningSupported) {
            return 'unsupported';
        }
        return context.effectiveReasoningEffort ?? 'default';
    }
    static formatAuth(context) {
        const source = context.credentialSource;
        switch (source.type) {
            case 'explicit-api-key':
                return 'auth=explicit-key';
            case 'env-api-key':
                return `auth=${source.provider}-key`;
            case 'oauth':
                return `auth=${source.provider}-oauth`;
            case 'missing':
                return `auth=missing-${source.provider}`;
        }
    }
    static formatContextWindow(context) {
        if (!context.contextWindow) {
            return context.estimatedInputTokens
                ? `estimated input tokens ${context.estimatedInputTokens.toLocaleString()}`
                : 'context window unknown';
        }
        if (!context.estimatedInputTokens) {
            return `context window ~${context.contextWindow.toLocaleString()} tokens`;
        }
        const percent = Math.round(Math.min(1, context.estimatedInputTokens / context.contextWindow) * 100);
        return `estimated input ${context.estimatedInputTokens.toLocaleString()} / ${context.contextWindow.toLocaleString()} tokens (${percent}%)`;
    }
}
//# sourceMappingURL=runtime-status-service.js.map