( worktreePaths: string[], limit?: number, initialEnrichCount: number = INITIAL_ENRICH_COUNT, )
| 4085 | } |
| 4086 | |
| 4087 | export async function loadSameRepoMessageLogsProgressive( |
| 4088 | worktreePaths: string[], |
| 4089 | limit?: number, |
| 4090 | initialEnrichCount: number = INITIAL_ENRICH_COUNT, |
| 4091 | ): Promise<SessionLogResult> { |
| 4092 | logForDebugging( |
| 4093 | `/resume: loading sessions for cwd=${getOriginalCwd()}, worktrees=[${worktreePaths.join(', ')}]`, |
| 4094 | ) |
| 4095 | const allStatLogs = await getStatOnlyLogsForWorktrees(worktreePaths, limit) |
| 4096 | logForDebugging(`/resume: found ${allStatLogs.length} session files on disk`) |
| 4097 | |
| 4098 | const { logs, nextIndex } = await enrichLogs( |
| 4099 | allStatLogs, |
| 4100 | 0, |
| 4101 | initialEnrichCount, |
| 4102 | ) |
| 4103 | |
| 4104 | // enrichLogs returns fresh unshared objects — safe to mutate in place |
| 4105 | logs.forEach((log, i) => { |
| 4106 | log.value = i |
| 4107 | }) |
| 4108 | return { logs, allStatLogs, nextIndex } |
| 4109 | } |
| 4110 | |
| 4111 | /** |
| 4112 | * Gets stat-only logs for worktree paths (no file reads). |
no test coverage detected