/**
 * Builds the single TUI prompt activity line from cli-v2 session state.
 */
export class PromptActivityService {
    static build(snapshot) {
        const status = snapshot.error ?? snapshot.liveStatus;
        const latestUpdateText = PromptActivityService.formatLatestUpdate(snapshot.latestUpdate);
        if (snapshot.error) {
            return { text: `Error: ${snapshot.error}`, color: 'red' };
        }
        if (latestUpdateText) {
            return { text: latestUpdateText, color: PromptActivityService.getLatestUpdateColor(snapshot.latestUpdate) };
        }
        return status ? { text: `Status: ${status}`, color: 'yellow' } : undefined;
    }
    static formatLatestUpdate(update) {
        if (!update) {
            return undefined;
        }
        return update.detail ? `Latest: ${update.label} · ${update.detail}` : `Latest: ${update.label}`;
    }
    static getLatestUpdateColor(update) {
        const colors = {
            info: 'blue',
            success: 'green',
            warning: 'yellow',
            error: 'red',
        };
        return colors[update?.tone ?? 'info'];
    }
}
//# sourceMappingURL=prompt-activity-service.js.map