Push live updates to the UI while agent runs execute

Engine-side writes - hires, delegated tasks, chat messages, run state -
only reached the renderer after a run finished: the queue worker sent
one snapshot-changed at the end, and nothing fired at claim time, so
the window sat frozen for the minutes a CEO run takes unless the user
reloaded by hand. The execution service now takes a notifyDataChanged
callback, the agent loop fires it after every tool-bearing iteration,
and the worker announces the claim itself, so the UI follows the
company working in real time.
This commit is contained in:
ZacharyZhang-NY committed 2026-06-09 21:51:29 -04:00
1 parent 921c5b4456
commit de9e6a9fa3
5 files changed
+33 -10

No files matched your search

@@ -23,6 +23,8 @@ export interface AgentRunLoopResult {
export interface AgentRunLoopDeps {
providers: Pick<ProviderService, "runToolTurn">;
tools: AgentToolDeps;
/** Called after each iteration's tool calls have written their effects. */
onToolResults?: () => void;
}
/**
@@ -63,6 +65,7 @@ export async function runAgentLoop(deps: AgentRunLoopDeps, input: AgentRunLoopIn
return { toolCallId: call.id, toolName: call.name, output: dispatchAgentTool(deps.tools, input.toolContext, call) };
});
messages.push({ role: "tool", results });
deps.onToolResults?.();
}
throw new Error(`Agent run did not converge within ${MAX_ITERATIONS} iterations.`);