web: live chat transcript over chat_event (C5)

This commit is contained in:
2026-10-19 07:01:00 +01:00
parent 7df4891f14
commit 7b578498ae
12 changed files with 1252 additions and 23 deletions
+10 -4
View File
@@ -1,7 +1,9 @@
// A single, reused WebSocket connection to /connect, mirroring
// android/.../data/transport/PipelinesClient.kt: requests are serialized, each
// carries a client-generated stable id, replies are matched by id, and
// unsolicited envelopes are dropped. There is no authentication of any kind.
// carries a client-generated stable id, replies are matched by id, and an
// unsolicited envelope is surfaced as a DOM-free `frame` event (the app folds the
// frames it cares about) rather than misattributed to a request. There is no
// authentication of any kind.
//
// DOM-free on purpose: the browser app and the Node smoke test share this exact
// module, so the smoke test exercises the real client, not a re-implementation.
@@ -184,9 +186,13 @@ export class PipelinesClient extends EventTarget {
this.#pending.delete(message.id);
clearTimeout(entry.timer);
entry.resolve(message);
return;
}
// Unsolicited envelopes (for example the connection's initial pipeline_list)
// have no matching id and are intentionally dropped.
// No pending request matches: the envelope is unsolicited (the connection's
// initial pipeline_list, or a server-pushed frame such as `chat_event`) and is
// surfaced as a DOM-free `frame` event so the app can fold the frames it cares
// about. It is never misattributed to a request, which is still matched by id.
this.dispatchEvent(new CustomEvent("frame", { detail: message }));
}
#failPending(reason) {