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

+5 -3
View File
@@ -54,6 +54,7 @@ interface OrchestrationDependencies {
error: (...args: unknown[]) => void;
};
publishDomainChanged: () => void;
emitEvent: (event: any) => void;
notify: (options: NotificationOptions) => void;
createRunToken: (agentId: string, companyId: string, runId: string) => string;
getApiPort: () => number;
@@ -67,6 +68,7 @@ export function createOrchestrationService({
db,
logger,
publishDomainChanged,
emitEvent,
notify,
createRunToken,
getApiPort,
@@ -138,7 +140,7 @@ export function createOrchestrationService({
navigation: { section: "agents", entityId: agent.id },
batchKey: "agent_paused",
});
publishDomainChanged();
emitEvent({ type: "agent-updated", agentId: agent.id, action: "paused" });
return true;
}
@@ -449,7 +451,7 @@ export function createOrchestrationService({
entityId: agent.id,
detail: `${trigger} heartbeat for ${agent.name}`,
});
publishDomainChanged();
emitEvent({ type: "run-updated", runId: run.id, action: "created" });
return run.id;
}
@@ -560,7 +562,7 @@ export function createOrchestrationService({
entityId: run.id,
detail: task.title,
});
publishDomainChanged();
emitEvent({ type: "run-updated", runId: run.id, action: "created" });
return ok(run.id);
}