mirror of
https://github.com/jlengrand/Maestro.git
synced 2026-03-10 08:31:19 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user