Rework omni search onto a typed search contract and add a TUI artifacts view

Protocol: replace the loose Query/Kind/Matches/Limit search fields with a Search request object and a SearchResults response, and have the server answer search from Store.Search over the shared run projections (runFrom/runStamps).

CLI: add the read-only 'pipelines search QUERY [--type KIND] [--limit N] [--json]' command with usage/help, and document the typed targets, ranking and bounds in docs/cli.md.

TUI: the '/' popup keeps type-to-search, up/down, Enter and Esc, renders one ranked list with kind badges and a bracketed (non-colour) match snippet, and Enter opens the matched pipeline, run, step, artifact or field; footer text updated to match.

TUI: add a dedicated run artifacts view ('A') with open/copy of recorded files, and move artifacts out of the run-detail File changes section (artifactCaptureNotes).

Tests: add Store.OpenReadOnly for read-only inspection of a live database plus pipeline/server/TUI search tests and artifacts tests, including env-gated live checks.
This commit is contained in:
2026-10-16 23:48:38 +01:00
parent fae1005962
commit 865993b200
24 changed files with 1761 additions and 68 deletions
+10 -11
View File
@@ -102,13 +102,11 @@ type PipelineSummary struct {
UpdatedAt string `json:"updated_at"`
}
// Message is the JSON envelope shared by the server and client. It also carries
// the omni-search request/response: a client sends Type "search" with an ID, the
// Query text, an optional Kind type filter and an optional Limit, and the server
// replies with Type "search_results", the echoed ID and ranked Matches. Every
// SearchMatch carries a stable Target plus the label and per-kind evidence; all
// search fields are optional so older peers ignore them. See search.go for the
// kind constants and wire-shape detail.
// Message is the JSON envelope shared by the server and client. It also brokers
// omni search: a client sends Type "search" with an ID and a SearchRequest, and
// the server replies with Type "search_results", the echoed ID and a
// SearchResponse. Both search fields are optional so older peers ignore them.
// See search.go for the per-type payloads and the ranking/kind/bound vocabulary.
type Message struct {
DefaultHarness string `json:"default_harness,omitempty"`
Build *buildinfo.Info `json:"build,omitempty"`
@@ -130,8 +128,6 @@ type Message struct {
Source string `json:"source,omitempty"`
Title string `json:"title,omitempty"`
Version int `json:"version,omitempty"`
Query string `json:"query,omitempty"`
Kind string `json:"kind,omitempty"`
Pipelines []PipelineSummary `json:"pipelines,omitempty"`
PipelineID int64 `json:"pipeline_id,omitempty"`
Detail *PipelineDetail `json:"detail,omitempty"`
@@ -141,7 +137,6 @@ type Message struct {
Stage string `json:"stage,omitempty"`
Option string `json:"option,omitempty"`
Feedback string `json:"feedback,omitempty"`
Matches []SearchMatch `json:"matches,omitempty"`
Input map[string]any `json:"input,omitempty"`
AllowTools bool `json:"allow_tools,omitempty"`
WritePaths []string `json:"write_paths,omitempty"`
@@ -153,7 +148,11 @@ type Message struct {
// them; the same fields are echoed on the run record.
Model string `json:"model,omitempty"`
StageModels map[string]string `json:"stage_models,omitempty"`
Limit int `json:"limit,omitempty"`
// Search is the broad, read-only search traffic over pipelines, versions,
// runs, steps, field text and artifacts. See search.go for the per-type
// payloads and the ranking/kind/bound vocabulary.
Search *SearchRequest `json:"search,omitempty"`
SearchResults *SearchResponse `json:"search_results,omitempty"`
// Chat is the brokered OpenCode chat traffic (route B). See chat.go for the
// per-type payload structs and the wire shapes they mirror.
ChatSessions []ChatSession `json:"chat_sessions,omitempty"`