web: live run updates over a single app-wide watch (R10)

This commit is contained in:
2026-10-19 14:22:53 +01:00
parent 2fe63012f9
commit 21a6ee3c4d
13 changed files with 1580 additions and 90 deletions
+26
View File
@@ -115,6 +115,32 @@ export class PipelinesRepository {
return response.run_detail;
}
/**
* Asks the server to push this connection the live run state it displays
* (R10). Send-only, mirroring `PipelinesRepository.subscribeRuns`: it returns
* the generated frame id and never waits for a reply, because the server may
* not acknowledge a `subscribe`. The body is exactly `{type:'subscribe',
* workspace}`; `run_ids` rides only when ids are given, so a blank workspace
* with no ids asks for the server-wide "any workspace" scope — the same
* `runIds.ifEmpty { null }` shape the Android client sends. The pushed state
* arrives as unsolicited `run_event` frames (client.js surfaces them as
* `frame` events).
*/
subscribeRuns(workspace = "", runIds = []) {
const request = { type: Protocol.SUBSCRIBE, workspace: String(workspace ?? "") };
if (Array.isArray(runIds) && runIds.length > 0) request.run_ids = runIds;
return this.#client.sendOnly(request);
}
/**
* Drops this connection's run-event watch (R10). Send-only like `subscribe`:
* the server may ack it, but nothing is awaited. It stops the pushes; a later
* `subscribe` re-reads the current state.
*/
unsubscribeRuns() {
return this.#client.sendOnly({ type: Protocol.UNSUBSCRIBE });
}
/**
* Omni-search. Sends exactly `SearchRequest{query, kind, limit}` from
* internal/protocol/search.go: `kind` is the empty string for every kind, and