Skip to content

Commit 6003346

Browse files
Two-pane session browser for /resume with AI-naming hook
Replace the single-list autosave picker with a PROJECTS|sessions browser: sessions grouped by scope_key (legacy scope-less sessions in an '(unscoped)' bucket pinned last), date-bucketed two-line rows with lazy title derivation cached back into the sidecar, global search reachable from anywhere, sort cycling, d-then-y delete, and a message preview overlay. Every composed row obeys a fit contract (left truncates, right chrome drops whole units, never exceeds terminal width) with an invariant test at 60-140 cols. New session_browser_open callback hook fires with the browser's live metadata dicts so plugins (session_namer) can enrich titles/tags in the background and surface them on repaint.
1 parent b19a0bf commit 6003346

6 files changed

Lines changed: 1630 additions & 701 deletions

File tree

code_puppy/callbacks.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"pre_compact",
7272
"session_end",
7373
"post_autosave",
74+
"session_browser_open",
7475
"notification",
7576
"awaiting_user_input",
7677
"git_branch_provider",
@@ -159,6 +160,7 @@ def __repr__(self) -> str:
159160
"pre_compact": [],
160161
"session_end": [],
161162
"post_autosave": [],
163+
"session_browser_open": [],
162164
"notification": [],
163165
"awaiting_user_input": [],
164166
"git_branch_provider": [],
@@ -590,6 +592,18 @@ async def on_post_autosave(*args, **kwargs) -> List[Any]:
590592
return await _trigger_callbacks("post_autosave", *args, **kwargs)
591593

592594

595+
async def on_session_browser_open(*args, **kwargs) -> List[Any]:
596+
"""Fire when the ``/resume`` session browser is about to open.
597+
598+
Receives ``(base_dir: str, entries: list[tuple[str, dict]])`` where
599+
each entry is ``(session_name, metadata_dict)``. The metadata dicts
600+
are the browser's LIVE objects: plugins that enrich them in place
601+
(titles, tags) surface on the browser's next repaint. Handlers must
602+
return fast -- do slow work (model calls) on a background thread.
603+
"""
604+
return await _trigger_callbacks("session_browser_open", *args, **kwargs)
605+
606+
593607
def on_load_prompt():
594608
"""Collect load_prompt fragments from plugins, dropping ``None`` results.
595609

0 commit comments

Comments
 (0)