Merge branch 'main' into web-chat-composer

# Conflicts:
#	web/src/app.js
#	web/src/client.js
#	web/src/protocol.js
#	web/test/chat.test.mjs
#	web/test/repository.test.mjs
#	web/test/ui-smoke.mjs
This commit is contained in:
2026-10-19 07:33:49 +01:00
14 changed files with 1840 additions and 39 deletions
+43
View File
@@ -60,6 +60,29 @@ export class PipelinesRepository {
return response.graph;
}
/**
* Creates a new pipeline from a definition `source` (the `submit` command),
* create-only, mirroring `PipelinesRepository.createPipeline`: the name must
* not already exist, so this can only ever add a draft and never overwrite a
* retained pipeline. A blank name is refused before anything is sent, exactly
* like the Android client; the sent name is trimmed. No run is started.
*/
async submit(name, source) {
if (!String(name ?? "").trim()) {
throw new ProtocolError("Enter a pipeline name.");
}
const response = await this.#client.call({
type: Protocol.SUBMIT,
name: String(name).trim(),
source,
create_only: true,
});
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 };
@@ -197,6 +220,26 @@ export class PipelinesRepository {
return { messages: response[ChatKeys.MESSAGES] ?? [], nextCursor: "", hasMore: false };
}
/**
* Attaches this connection to one session's shared live stream (C5). The body
* is exactly `{type:'chat_subscribe', chat_subscribe:{session_id}}` — the
* `chat_subscribe` field, not `chat_query` (internal/protocol/message.go); the
* server replies with an id-matched echo once the subscription is attached and
* then pushes `chat_event` frames without an id, which `client.js` surfaces as a
* `frame` event. Any number of clients may watch one session; the session is
* never read-only. There is no `chat_unsubscribe`: the server drops a
* subscription when the connection closes.
*/
async subscribeChat(sessionId) {
if (!String(sessionId ?? "").trim()) {
throw new ProtocolError("Select a chat session first.");
}
return this.#client.call({
type: Protocol.CHAT_SUBSCRIBE,
[ChatKeys.SUBSCRIBE]: { session_id: sessionId },
});
}
/**
* Finishes a session and records it closed on the server (nothing is
* deleted). The reply echoes the updated session (`chat_session`) and the