refactor(session-reference): label discovery from projections alone

A title now comes from an attached session's live projection cut or a cold
one's durable checkpoint, and from nothing else. Attachment is decided by the
session store at read time, so a session that attached after the listing is no
longer answered from a checkpoint its log has moved past — the stale-title case
`api-session.list` already handles this way.

The log fold and its per-log memo are gone. Folding one title costs a whole
log, and this call sits under every keystroke; a session no projection answers
for is labeled by its id and regains its title the first time it is opened.

`lib` leaves the default exclusions: Ruby gems and many npm packages keep
sources there, and the miss would be silent and total. A traversal whose root
is unreadable now rejects instead of publishing an empty index over entries
that are still good, which is what the stale-while-revalidate path claimed but
could not do while every readdir error was swallowed. A drill marks the menu
drilled only when its edit actually reached the draft.

Refs #3154
Refs #3180
This commit is contained in:
Yichen Jiang
2026-08-27 15:21:08 +08:00
parent db14361372
commit 8e9da9debf
22 changed files with 248 additions and 380 deletions
+3 -5
View File
@@ -145,11 +145,9 @@ Exact-read consumer that prepares immutable cross-session message context.
/**
* List reference candidates, ranked by working-directory affinity.
*
* A title comes from the projection cache when that cache holds a
* checkpoint for the session; otherwise it is folded from the session's log
* once and remembered for as long as the log stays cold. Without the cache
* composed, only the cwd-ranked head of an unfiltered listing is folded, so
* its tail cannot match a title substring.
* Discovery runs at keystroke rate, so a title only ever comes from a
* projection read: see {@link SessionReferenceResolver.projectedTitle} for
* which sessions can answer one and which fall back to their id.
* @param agent - target agent; self is excluded and its cwd drives ranking.
* @param query - optional case-insensitive session-id/cwd/title substring.
* @param limit - optional positive result cap.