Files
pipelines/web/src/repository.js
T
alan bd09c55c47 Merge lane-go: titles, verdicts, human stage, line result format, stale-client guard
Integrates nine commits of reviewed work from the lane-go branch after the
automated resolver failed on this merge five times (each attempt dying on the
malformed-result defect whose fix is contained in this same merge).

Integration decisions:
- Search: kept main's shipped design (Store.Search + SearchResponse.Results) and
  dropped lane-go's parallel, older attempt (an unused Message.Matches field, an
  absent runs.search, and two partial TUI plumbing blocks). lane-go itself did not
  compile: protocol.SearchMatch was undefined and model.go referenced searchNav,
  requestSearch and applyRunNav, which exist nowhere. Those partial TUI blocks are
  removed; the queued TUI omni-search item will implement the surface properly on
  main's design.
- Both sides' additions are kept where they are independent: run titles and
  provenance, the human decision stage and its CLI/TUI surface, the derived stage
  verdict, the stale-client guard, the line-oriented result format, and main's
  search command.
- The search key's help label is now "/ omni search"; the two tests asserting the
  old label are updated rather than the label reverted.
- docs/cli.md and the packaged operations reference carry both sides' text.

Verified: go build ./... , go vet ./... and the full go test ./... suite pass.
2026-10-16 22:21:43 +01:00

62 lines
1.5 KiB
JavaScript

// Typed access to the existing WebSocket protocol. Request builders and id
// matching live here so the app never constructs frames by hand or invents
// divergent field names. Mirrors android/.../data/PipelinesRepository.kt.
import { Protocol } from "./protocol.js";
import { ProtocolError } from "./client.js";
export class PipelinesRepository {
#client;
constructor(client) {
this.#client = client;
}
get connectionState() {
return this.#client.state;
}
connect(validated) {
this.#client.connect(validated);
}
disconnect() {
this.#client.disconnect();
}
ping() {
return this.#client.call({ type: Protocol.PING });
}
async listPipelines() {
return (await this.#client.call({ type: Protocol.LIST })).pipelines ?? [];
}
async getPipeline(id, version) {
const response = await this.#client.call({
type: Protocol.GET_PIPELINE,
pipeline_id: id,
version,
});
if (!response.detail) {
throw new ProtocolError("The server returned no pipeline detail.");
}
return response.detail;
}
async listRuns() {
const response = await this.#client.call({ type: Protocol.LIST_RUNS });
return { runs: response.runs ?? [], usage: response.usage ?? null };
}
async getRun(id) {
const response = await this.#client.call({
type: Protocol.GET_RUN,
run_id: id,
});
if (!response.run_detail) {
throw new ProtocolError("The server returned no run detail.");
}
return response.run_detail;
}
}