refactor(events): unify scoped runtime notifications across clients (#5670)

* refactor(events): unify scoped runtime notifications across clients

* style(tests): sort auto-compaction event imports

* refactor(events): scope connections and remove retry callback plumbing

* docs: remove runtime notification design write-up

* refactor(bus): route operation events through the message bus

* fix(channels): isolate outbound sends by destination

* style(events): group shared notification imports

* refactor(events): converge runtime and hook delivery on MessageBus

* test(events): migrate fixtures to unified message bus
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-06 02:11:19 +08:00
1 parent 3495281282
commit 192e2e90dc
78 files changed
+1620 -1194

No files matched your search

+13
View File
@@ -245,6 +245,19 @@ describe("useNanobotStream", () => {
});
});
it("keeps a hydrated terminal compaction when a queued start arrives", () => {
const fake = fakeClient();
const initial = [{ id: "compaction-c1", role: "assistant" as const, content: "",
kind: "compaction" as const, createdAt: 123,
compaction: { id: "c1", phase: "succeeded" as const } }];
const { result } = renderHook(() => useNanobotStream("chat", initial), {
wrapper: wrap(fake.client),
});
act(() => fake.emit("chat", { event: "context_compaction", chat_id: "chat",
compaction_id: "c1", phase: "started" }));
expect(result.current.messages).toEqual(initial);
});
it("batches answer deltas into one animation-frame update", async () => {
const fake = fakeClient();
const requestFrame = vi.spyOn(window, "requestAnimationFrame");