fix(bridge): forward tool/lifecycle events so user sees agent progress

The SessionBridge only forwarded text_delta and system_event types.
All tool_execution_*, agent_start, and turn_end events from the Pi
process were silently dropped, so the user saw a blank session even
though the agent was actively running (calling tools, querying the DB).

Forward:
- tool_execution_start/end as info events (visible in stepMessages)
- agent_start, turn_end as system_event (lifecycle tracking)

Also: log Pi stderr instead of draining silently, for debugging.
This commit is contained in:
User
2026-07-13 00:22:54 +02:00
parent ac333f99ac
commit 34f1fa271f
2 changed files with 15 additions and 12 deletions
+3 -2
View File
@@ -59,8 +59,8 @@ export class PiProcessManager {
cwd: this.cfg.harnessDir,
env,
});
// Drain stderr so the child's stderr buffer never blocks the process.
child.stderr.resume?.();
// Log stderr for debugging (was silently drained)
child.stderr.on("data", (d: Buffer) => console.error(`[pi:${sessionId}] stderr:`, d.toString().trim()));
return child;
}
@@ -95,6 +95,7 @@ export class PiProcessManager {
// exit event fires, so reaching this branch with `rt` still mapped means the child
// died on its own: tell the client, or the UI spins forever waiting for a turn end.
child.on("exit", (code) => {
console.error(`[pi:${sessionId}] exited code=${code ?? "?"} mapped=${this.runtimes.get(sessionId) === rt}`);
if (this.runtimes.get(sessionId) === rt) {
this.runtimes.delete(sessionId);
rt.bridge.emitClientEvent({