mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
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
18 lines
721 B
TypeScript
18 lines
721 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { normalizeMessageSearchTarget } from './messageSearchTarget'
|
|
|
|
describe('normalizeMessageSearchTarget', () => {
|
|
it('keeps a complete content-search deep link', () => {
|
|
expect(normalizeMessageSearchTarget(' message-1 ', ' hello ')).toEqual({
|
|
messageId: 'message-1',
|
|
messageQuery: 'hello',
|
|
})
|
|
})
|
|
|
|
it('drops incomplete deep links instead of locking the message window', () => {
|
|
expect(normalizeMessageSearchTarget('message-1', undefined)).toEqual({})
|
|
expect(normalizeMessageSearchTarget(undefined, 'hello')).toEqual({})
|
|
expect(normalizeMessageSearchTarget(' ', 'hello')).toEqual({})
|
|
})
|
|
})
|