feat(09-02): convert high-frequency callsites to granular emitEvent

- Replace publishDomainChanged() with granular events at 9 high-frequency callsites
- saveTask/deleteTask emit task-updated events in ipc-core-work-graph-handlers
- decideApproval emits approval-updated, addComment emits task-updated
- worker-service emits run-updated for status changes and completion
- worker-service emits agent-updated for budget hard-stop pause
- orchestration-service emits agent-updated for auto-pause, run-updated for dispatch
- Wire emitEvent dependency to orchestration-service via service-graph
- Keep publishDomainChanged for low-frequency and multi-entity paths

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 4.6 committed 2026-03-27 19:45:30 -04:00
1 parent c1de05a7f1
commit 5124209ddb
5 files changed
+20 -11

No files matched your search

+4 -4
View File
@@ -46,7 +46,7 @@ interface WorkerServiceDependencies {
workerPath: string;
isQuitting: () => boolean;
publishDomainChanged: () => void;
emitEvent: (event: WorkerUiEvent) => void;
emitEvent: (event: any) => void;
wakeAgentIfPossible: (agentId: string | null | undefined, companyId: string, trigger: string) => string | null;
dispatchRunToWorker: (params: {
runId: string;
@@ -239,7 +239,7 @@ export function createWorkerService({
}
}
emitEvent(event);
publishDomainChanged();
emitEvent({ type: "run-updated", runId: event.runId, action: "status_changed" });
return;
}
@@ -280,7 +280,7 @@ export function createWorkerService({
entityId: run.id,
detail: event.summary ?? event.errorMessage ?? "",
});
publishDomainChanged();
emitEvent({ type: "run-updated", runId: run.id, action: "completed" });
emitEvent({
type: "run-status",
runId: run.id,
@@ -320,7 +320,7 @@ export function createWorkerService({
navigation: { section: "agents", entityId: updatedAgent.id },
batchKey: "agent_paused",
});
publishDomainChanged();
emitEvent({ type: "agent-updated", agentId: updatedAgent.id, action: "paused" });
}
if ((event.status === "failed" || event.status === "timed_out") && !isQuitting() && !destroyed) {