feat(coding-agent): add threaded sort mode to /resume with tree display

Adds 'Threaded' as a new sort mode (now default) that displays sessions
in a tree structure based on parent-child relationships. The tree is
sorted by root session's modified date. Other sort modes (Recent, Fuzzy)
continue to show flat lists.

Sort mode cycles: Threaded -> Recent -> Fuzzy -> Threaded
This commit is contained in:
Petr Baudis 2026-01-31 01:46:06 +01:00
parent 6f2d066342
commit 42d54e0d1c
3 changed files with 134 additions and 20 deletions

View file

@ -168,6 +168,8 @@ export interface SessionInfo {
cwd: string;
/** User-defined display name from session_info entries. */
name?: string;
/** Path to the parent session (if this session was forked). */
parentSessionPath?: string;
created: Date;
modified: Date;
messageCount: number;
@ -587,6 +589,7 @@ async function buildSessionInfo(filePath: string): Promise<SessionInfo | null> {
}
const cwd = typeof (header as SessionHeader).cwd === "string" ? (header as SessionHeader).cwd : "";
const parentSessionPath = (header as SessionHeader).parentSession;
const modified = getSessionModifiedDate(entries, header as SessionHeader, stats.mtime);
@ -595,6 +598,7 @@ async function buildSessionInfo(filePath: string): Promise<SessionInfo | null> {
id: (header as SessionHeader).id,
cwd,
name,
parentSessionPath,
created: new Date((header as SessionHeader).timestamp),
modified,
messageCount,