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

+8 -2
View File
@@ -18,6 +18,7 @@ export function registerCoreWorkGraphHandlers({
ensureCompanyExists,
findInvalidReference,
publishDomainChanged,
emitEvent,
wakeAgentIfPossible,
handleApprovalResolved,
handleTaskCreated,
@@ -29,6 +30,7 @@ export function registerCoreWorkGraphHandlers({
| "ensureCompanyExists"
| "findInvalidReference"
| "publishDomainChanged"
| "emitEvent"
| "wakeAgentIfPossible"
| "handleApprovalResolved"
| "handleTaskCreated"
@@ -355,7 +357,7 @@ export function registerCoreWorkGraphHandlers({
wakeAgentIfPossible(parsed.assigneeAgentId, parsed.companyId, "assignment");
}
}
publishDomainChanged();
emitEvent({ type: "task-updated", taskId: id, action: isNew ? "created" : "updated" });
return ok(id);
});
@@ -437,7 +439,11 @@ export function registerCoreWorkGraphHandlers({
entityId: parsed.id,
detail: "",
});
publishDomainChanged();
if (entity === "task") {
emitEvent({ type: "task-updated", taskId: parsed.id, action: "deleted" });
} else {
publishDomainChanged();
}
return ok(true);
});
}