fix(bridge): forward Pi agent_end so the spinner stops at workflow completion
The FE derived 'working' purely as activeSession && !pendingWidget, so the
final workflow turn — the only one that ends without a follow-up gate —
left the spinner on forever (observed live: 21592s after F8 approve).
- SessionBridge maps Pi's agent_end -> SSE system_event {event: agent_end}
- PiProcessManager notifies the client (info error + synthetic agent_end)
when the child dies unexpectedly; expected teardowns stay silent
- sessionStore tracks agentActive (on: user entry/text_delta/ui_request,
off: agent_end); AppShell working now requires it; resume sets it
optimistically
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,11 @@ export class SessionBridge {
|
||||
this.fan({ type: "text_delta", text: m.text ?? "" });
|
||||
} else if (m.type === "system_event") {
|
||||
this.fan(m as ClientEvent);
|
||||
} else if (m.type === "agent_end") {
|
||||
// Fine turno di Pi (pi-agent-core agent-loop): e' l'unico segnale che il turno e'
|
||||
// concluso. Senza inoltrarlo, il FE resta "working" per sempre quando il turno
|
||||
// finisce senza un gate successivo (ultimo step del workflow).
|
||||
this.fan({ type: "system_event", event: "agent_end" });
|
||||
}
|
||||
// altri method nativi (setStatus/setWidget) e altri eventi Pi ignorati in MVP
|
||||
});
|
||||
@@ -43,6 +48,9 @@ export class SessionBridge {
|
||||
|
||||
onClientEvent(cb: (e: ClientEvent) => void): void { this.cbs.add(cb); }
|
||||
|
||||
/** Eventi generati dal backend stesso (es. exit inatteso del child Pi), non da Pi. */
|
||||
emitClientEvent(e: ClientEvent): void { this.fan(e); }
|
||||
|
||||
respond(uiResponse: object & { id: string }): void {
|
||||
// Correla sull'id RPC di Pi; `value` porta l'uiResponse (con l'id del descriptor) cosi'
|
||||
// il check interno del gate (resp.id === descriptor.id) regge.
|
||||
|
||||
Reference in New Issue
Block a user