@@ -73,6 +73,16 @@ export interface BackendFacadeDeps {
7373 modelUsage : ModelUsage ;
7474 timestamp : number ;
7575 } > ;
76+ // Crush session handling (per-project crush.db virtual paths)
77+ isCrushSession ?: ( sessionFile : string ) => boolean ;
78+ getCrushSessionData ?: ( sessionFile : string ) => Promise < {
79+ tokens : number ;
80+ interactions : number ;
81+ modelUsage : ModelUsage ;
82+ timestamp : number ;
83+ } > ;
84+ // Visual Studio session detection (binary MessagePack — cannot be parsed as JSON)
85+ isVSSessionFile ?: ( sessionFile : string ) => boolean ;
7686}
7787
7888export class BackendFacade {
@@ -126,6 +136,9 @@ export class BackendFacade {
126136 statSessionFile : deps . statSessionFile ,
127137 isOpenCodeSession : deps . isOpenCodeSession ,
128138 getOpenCodeSessionData : deps . getOpenCodeSessionData ,
139+ isCrushSession : deps . isCrushSession ,
140+ getCrushSessionData : deps . getCrushSessionData ,
141+ isVSSessionFile : deps . isVSSessionFile ,
129142 } ,
130143 this . credentialService ,
131144 this . dataPlaneService ,
@@ -441,6 +454,18 @@ export class BackendFacade {
441454 return result ;
442455 }
443456
457+ /**
458+ * Backfill historical data to Azure Table Storage.
459+ * Scans ALL local session files (ignoring the mtime-based age filter) and upserts daily
460+ * rollups for every day within the given lookback window (default 365 days).
461+ * Use this when the normal sync has missed data due to the mtime filter.
462+ */
463+ public async backfillHistoricalData ( maxLookbackDays = 365 , onProgress ?: ( processed : number , total : number , daysFound : number ) => void ) : Promise < void > {
464+ const settings = this . getSettings ( ) ;
465+ await this . syncService . backfillSync ( settings , this . isConfigured ( settings ) , maxLookbackDays , onProgress ) ;
466+ this . clearQueryCache ( ) ;
467+ }
468+
444469 public async tryGetBackendDetailedStatsForStatusBar (
445470 settings : BackendSettings ,
446471 ) : Promise < any | undefined > {
0 commit comments