feat(history): add elapsed time tracking for USER history entries

Add elapsed time calculation when creating USER history entries via
the saveToHistory/synopsis feature. Time is calculated from lastSynopsisTime
(if a previous synopsis exists) or tabCreatedAt (for first synopsis).
This complements the existing elapsed time tracking for AUTO entries.
This commit is contained in:
Pedram Amini
2026-02-01 22:24:04 -06:00
parent 2968a36e11
commit d9d4a44894

View File

@@ -1993,6 +1993,7 @@ function MaestroConsoleInner() {
tabName?: string;
tabId?: string;
lastSynopsisTime?: number;
tabCreatedAt?: number;
toolType?: ToolType;
sessionConfig?: {
customPath?: string;
@@ -2136,6 +2137,7 @@ function MaestroConsoleInner() {
tabName,
tabId: completedTab?.id,
lastSynopsisTime: completedTab?.lastSynopsisTime, // Track when last synopsis was generated
tabCreatedAt: completedTab?.createdAt, // Track tab creation for elapsed time calculation
toolType: currentSession.toolType, // Pass tool type for multi-provider support
sessionConfig: {
customPath: currentSession.customPath,
@@ -2519,6 +2521,13 @@ function MaestroConsoleInner() {
// IMPORTANT: Pass explicit sessionId and projectPath to prevent cross-agent bleed
// when user switches agents while synopsis is running in background
// Calculate elapsed time since last synopsis (or tab creation if no previous synopsis)
const elapsedTimeMs = synopsisData!.lastSynopsisTime
? synopsisTime - synopsisData!.lastSynopsisTime
: synopsisData!.tabCreatedAt
? synopsisTime - synopsisData!.tabCreatedAt
: undefined;
addHistoryEntryRef.current({
type: 'USER',
summary: parsed.shortSummary,
@@ -2528,6 +2537,7 @@ function MaestroConsoleInner() {
sessionId: synopsisData!.sessionId,
projectPath: synopsisData!.cwd,
sessionName: synopsisData!.tabName,
elapsedTimeMs,
});
// Update lastSynopsisTime on the tab so future synopses know the time window