Files
orca/src/shared
Jinwoo Hong f07bf8544c feat(session-search): sort search results by newest, and break relevance ties by recency (#21863)
* feat(session-search): sort search results by newest, and break relevance ties by recency

Results were ordered by match score alone with the session id as the
tiebreak, so equally good matches came out in an arbitrary order and
nothing ever favoured recent work. The Sort menu now offers Most relevant
and Newest while the box has text; the engine already knew both orders and
the all-computers merge already honoured the newest one, so only the panel
had to ask. Under Most relevant, equal scores now go to the newer session.
The choice persists with the other view options, separately from the
list's own Last updated / Created sort.

* fix(session-search): label results by the order they are in

The header subtitle and the results group said "best matches" whichever
sort was chosen; under Newest they now say so. The panel's scope state and
its two context effects move to use-ai-vault-panel-scope.ts, which keeps
the panel under the line cap and gives that behaviour a name.

* feat(session-search): move search sort onto a results bar above the hits

Search mode gets a bar in the group header's place: the hit count on the
left, a ghost menu button on the right that names the current order and
opens the two-item radio group. The filter menu's Sort section keeps one
meaning again (Last updated / Created), the header subtitle stops
reporting sort, and search rows run flat with no group header.

* style(session-search): drop the icons from the results-bar sort menu and match its text size

* feat(session-search): one sort bar above the list in both modes

Filters stay behind the header filter icon; sort moves onto the bar
directly above the session list, in browse mode as well as search.
The bar is mode-agnostic: it takes a label, the selected value, a typed
option list, and a callback, and the panel configures it twice.

- rename AiVaultSearchResultsBar to AiVaultSessionListBar and generalize it
- add ai-vault-sort-options for the two option lists and their aria labels
- drop the Sort section from the filter menu and stop counting sort in the badge
- header subtitle now reads "Indexed history" in both modes

* feat(session-search): count sessions plainly and offer Show more when the scan fills its depth

* fix(session-search): step history depth 250 at a time and keep Show more visible while the rescan runs

* style(session-search): let the sort menu hug its two options

* fix(session-search): show more reads the depth its rows came from

The row inferred "a deeper rescan is running" from the selected depth minus one
page, which at the default depth is zero, so every foreground scan with at least
one session painted a disabled "Loading more sessions…" footer the scan had room
for.

The scan now publishes the depth it ran at beside its sessions, and the row
compares the two: it survives the rescan because that depth trails the selected
one until the deeper scan lands. Drops the stepping arithmetic and
nextAiVaultSessionLimit, and moves the row out of the menu file it was sharing.

* refactor(session-search): an untitled group is what hides a header

Search mode said "no group headers" twice, in two files, both keyed off the same
flag: an empty label in the filters hook and a hideGroupHeaders prop on the list.
The label is now the only fact. A null label means the group has no header of
its own, the list renders its rows flat, and the prop is gone.

The shared group type keeps its string label so the mobile sections that map it
are untouched; the nullable label is the renderer list's own type.

* refactor(session-search): plain labels, and a browse bar that can report zero

Three small simplifications around the list bar:

- The browse bar is guarded on the loaded history rather than the filtered rows,
  so "0 of 250 sessions" can actually appear when filters hide everything and
  the sort control stays reachable. Search keeps its own guard.
- The two count labels were components whose whole body was a ternary over
  translate; they are functions returning a string, and the bar's label prop is
  a string.
- The persistence guards stop being exported with no caller outside the file,
  and the search-sort guard reads the AI_VAULT_SEARCH_SORTS list instead of
  respelling the union.
2026-09-21 14:11:40 -04:00
..
2026-05-31 05:55:04 -07:00
2026-09-03 17:32:59 -07:00