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

+5 -6
View File
@@ -129,7 +129,7 @@ def _make_full_loop(tmp_path: Path) -> AgentLoop:
bus=loop.bus,
sessions=loop.sessions,
schedule_background=lambda coro: loop.schedule_background(coro),
).subscribe(loop.runtime_events)
).subscribe()
return loop
@@ -1452,7 +1452,7 @@ async def test_internal_continuation_preserves_streaming_route_metadata(
calls = 0
async def fake_run_agent_loop(transcript_input, *, on_stream=None, on_stream_end=None, **_kwargs):
async def fake_run_agent_loop(transcript_input, *, events, streaming, **_kwargs):
nonlocal calls
initial_messages = _assembled_messages(loop.context, transcript_input)
calls += 1
@@ -1462,10 +1462,9 @@ async def test_internal_continuation_preserves_streaming_route_metadata(
[*initial_messages, {"role": "assistant", "content": "paused"}],
stop_reason="max_iterations",
)
assert on_stream is not None
assert on_stream_end is not None
await on_stream("done")
await on_stream_end(resuming=False)
assert streaming
await events.emit(StreamDeltaEvent(content="done"))
await events.emit(StreamEndEvent())
return _agent_run_result(
"done",
[*initial_messages, {"role": "assistant", "content": "done"}],