feat(web,hub): add opt-in search for session message content (#1598)

Adds an opt-in content search over session messages, alongside the
existing metadata search. An FTS5 index covers visible user and assistant
prose; the sidebar gains a scope toggle, and selecting a result opens the
matching message rather than the session tail.

Search scope is a two-state toggle rather than a dropdown: a 48x48 target
matching the clear endcap, distinct glyphs for session details vs message
text, tooltips naming the real scopes, and the active mode kept on the
collapsed chip (tiann/hapi#2081).

Dogfooded on a live 1178-session fleet. The scope toggle and reading
forward from a search result were both click-tested on that install —
the latter walking six bounded pages through a 1,507-message session and
stopping correctly at the session head.

The per-commit history does not survive this squash; the review trail —
including which commit closed which finding — is on the PR threads.

Fixes #1554
Fixes #2081
This commit is contained in:
Ananovo
2026-11-02 15:20:45 +00:00
committed by GitHub
parent 1f4518df20
commit 82c5c00a38
87 changed files with 9501 additions and 412 deletions
+36
View File
@@ -130,6 +130,28 @@ export type AuthResponse = {
}
export type SessionsResponse = { sessions: SessionSummary[] }
export type SessionContentMatch = {
messageId: string
role: 'user' | 'assistant'
seq: number
createdAt: number
snippet: string
truncated: boolean
}
export type SessionContentSearchResponse = {
results: Array<{
session: SessionSummary
match: SessionContentMatch
}>
/** True when this query may miss content omitted by an indexing optimization. */
hasPotentiallyIncompleteResults: boolean
}
export type SessionContentMatchesResponse = {
matches: SessionContentMatch[]
total: number
/** True when this query may miss content omitted by an indexing optimization. */
hasPotentiallyIncompleteResults: boolean
}
export type SessionResponse = { session: Session }
export type MessagesResponse = {
messages: DecryptedMessage[]
@@ -150,6 +172,20 @@ export type MessagesResponse = {
}
}
/** A bounded history window centered on a message selected from search results. */
export type MessageContextResponse = {
messages: DecryptedMessage[]
targetMessageId: string
page: {
epoch: number
nextBeforeSeq: number | null
nextBeforeAt: number | null
snapshotHeadSeq: number | null
snapshotHeadAt: number | null
hasMore: boolean
}
}
export type MachinesResponse = { machines: Machine[] }
export type SpawnResponse =