Repository navigation
feat(search): /api/sessions/messages/search for full-text message search - #329
RoyaLemonade wants to merge 6 commits into
Conversation
A native client needs to know which server-side features exist before it offers them. GET /api/app-info rides the normal /api auth gate and returns the package name, version and API level, never credentials or settings.
A native client keeps its radio asleep for the whole idle heartbeat, so a per-connection interval is a battery win without touching the shared browser stream. GET /api/events?heartbeat=<seconds> accepts 15-110 s and falls back to the 30 s default for anything else; capabilities advertise it as heartbeatParam.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review Roast 🔥Verdict: No Issues Found | Recommendation: Merge Oh wait, this PR is actually clean. I need to sit down. I had my flamethrower warmed up and everything. 📊 Overall: Like finding a unicorn in production — I didn't think clean PRs existed anymore, but here we are. Files Reviewed (9 files)
Reviewed by free · Input: 67.6K · Output: 1.5K · Cached: 193.7K |
The handshake answers `name: "ompweb"`, which is not the npm package name; the changelog now says so. Two coverage gaps from review: the proxy test asserts `/api/app-info` sits behind the password gate, and a route-level test sends `?heartbeat=60` and proves the keep-alive is not the fixed 30 s default.
# Conflicts: # CHANGELOG.md
|
The Bun server/daemon architecture has landed on |
|
Superseded by #410, which carries the same change as a Bun-server PR against current The new PR keeps the scope of this one, with its own tests and a description of what changed. Closing this in favour of it. |
GET /api/sessions/searchis already taken in v0.6.0 by the sidebar's relevance search, which streamsNDJSON
{ scores }batches for the session list - so this endpoint lives under a different path andreturns message hits, not scores.
lib/session-search.ts(the ranking) is untouched.Native clients can only filter the session list they already hold; finding a message that scrolled
out of view means opening sessions one by one. This adds a read-only endpoint and leaves the web UI
unchanged (a follow-up can consume it).
GET /api/sessions/messages/search?q=&limit=&cursor=..jsonlfiles newest-first (newest session, newest line), so the most recent matches winwhen the budget runs out.
cannot eat the scan budget), 64 MiB total / 16 MiB per file, 100 results max, 1 MiB max line; files
above 64 MiB are skipped. At most two scans run per process; further requests get
429+Retry-After.partialplus an opaque, query-boundcursorresume the scan; the cursor points at a line start(only a single >1 MiB line is skipped), so it stays small and a rewritten file cannot make it skip
or duplicate lines.
transcript), case-insensitive substring, and returns a one-line snippet with UTF-16
matchStart/matchEndplus session title/cwd/entryId/role/timestamp. Offsets are computed on theoriginal text, so case mappings that change length cannot shift the highlight.
query_required,query_too_long,invalid_limit,invalid_cursor,cursor_query_mismatch),Cache-Control: no-store, and500responses carry a generic message(details stay in the server log).
/api/*password gate.GET /api/app-infoadvertisescapabilities.messageSearch: true, so native clients hide theirmessage-search mode on a server without this route (it answers
404) instead of asking and failing.Tests:
lib/session-message-search.test.mjs(ordering, offsets, no tool results, pagination acrosstiny chunk boundaries and line-aligned chunk edges, lines spanning several chunks, time/byte budget
resume, large-file skip, cursor binding, equal-mtime fallback, malformed lines, production listing,
route errors, 429 while both scan slots are taken).
Note: stacked on #324 - that PR adds
GET /api/app-infoand the capability object thisextends. Merge that one first; GitHub drops the parent commit from this diff afterwards.
Context: message search is used by the native Android client (separate PR to follow); the web UI can
adopt it later.