Add chat recording toggle (CLI + settings) and disable recording in tests

This commit is contained in:
tanzhenxin
2025-12-15 13:48:38 +08:00
parent 4cbb57a793
commit b9a2cc7bdf
13 changed files with 128 additions and 59 deletions

View File

@@ -8,6 +8,7 @@ import type React from 'react';
import { Box, Text } from 'ink';
import { StatsDisplay } from './StatsDisplay.js';
import { useSessionStats } from '../contexts/SessionContext.js';
import { useConfig } from '../contexts/ConfigContext.js';
import { theme } from '../semantic-colors.js';
import { t } from '../../i18n/index.js';
@@ -18,10 +19,13 @@ interface SessionSummaryDisplayProps {
export const SessionSummaryDisplay: React.FC<SessionSummaryDisplayProps> = ({
duration,
}) => {
const config = useConfig();
const { stats } = useSessionStats();
// Only show the resume message if there were messages in the session
// Only show the resume message if there were messages in the session AND
// chat recording is enabled (otherwise there is nothing to resume).
const hasMessages = stats.promptCount > 0;
const canResume = !!config.getChatRecordingService();
return (
<>
@@ -29,7 +33,7 @@ export const SessionSummaryDisplay: React.FC<SessionSummaryDisplayProps> = ({
title={t('Agent powering down. Goodbye!')}
duration={duration}
/>
{hasMessages && (
{hasMessages && canResume && (
<Box marginTop={1}>
<Text color={theme.text.secondary}>
{t('To continue this session, run')}{' '}