web: add omni-search results and routing (S1/S2)

This commit is contained in:
2026-10-19 04:27:59 +01:00
parent 9555bfe58f
commit 26eaec2531
9 changed files with 2003 additions and 10 deletions
+21
View File
@@ -72,4 +72,25 @@ export class PipelinesRepository {
}
return response.run_detail;
}
/**
* Omni-search. Sends exactly `SearchRequest{query, kind, limit}` from
* internal/protocol/search.go: `kind` is the empty string for every kind, and
* `limit` is fixed at `0` so the server applies its own default cap
* (`SearchDefaultLimit`, 50) and never the client's — `SearchMaxLimit` (200) is
* therefore never approached, let alone exceeded.
*
* Returns `reply.search_results`, the ranked `SearchResponse`, or **null** when
* an older server answered without that payload (its default `pong`), which the
* caller reports as "this server does not support search" rather than dropping.
* An explicit server error is already surfaced by `client.call` as a
* `ProtocolError` carrying the server's own text.
*/
async search(query, kind = "") {
const response = await this.#client.call({
type: Protocol.SEARCH,
search: { query, kind, limit: 0 },
});
return response.search_results ?? null;
}
}