feat(09-01): define granular event types, IPC channels, entity getters, and Zustand patch methods

- Add 5 granular event interfaces (TaskUpdated, RunUpdated, ApprovalUpdated, AgentUpdated, BudgetChanged) to DesktopEvent union
- Add 4 entity getter IPC channels (getTask, getAgent, getRun, getApproval) with Zod validation and company ownership checks
- Add getRun method to AppDatabase following existing getTask pattern
- Add 4 preload bridge methods for entity getters
- Add 8 patch/remove methods and refreshBadges to CompanySlice
- Add selective-ipc.test.ts with exhaustive union type tests
- Extend store.test.ts with 14 patch method tests

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:33:33 -04:00
1 parent c1de05a7f1
commit 920a764856
8 files changed
+631 -5

No files matched your search

+35 -1
View File
@@ -385,6 +385,35 @@ export interface NotificationClickEvent {
entityId?: string;
}
export interface TaskUpdatedEvent {
type: "task-updated";
taskId: string;
action: "created" | "updated" | "deleted";
}
export interface RunUpdatedEvent {
type: "run-updated";
runId: string;
action: "created" | "status_changed" | "completed";
}
export interface ApprovalUpdatedEvent {
type: "approval-updated";
approvalId: string;
action: "created" | "decided" | "deleted";
}
export interface AgentUpdatedEvent {
type: "agent-updated";
agentId: string;
action: "updated" | "paused";
}
export interface BudgetChangedEvent {
type: "budget-changed";
companyId: string;
}
export type DesktopEvent =
| LogChunkEvent
| DomainChangedEvent
@@ -394,7 +423,12 @@ export type DesktopEvent =
| AgentMessageEvent
| AutomationFiredEvent
| NewMessageEvent
| NotificationClickEvent;
| NotificationClickEvent
| TaskUpdatedEvent
| RunUpdatedEvent
| ApprovalUpdatedEvent
| AgentUpdatedEvent
| BudgetChangedEvent;
export type InboxItemType = "pending_approval" | "failed_run" | "budget_warning" | "blocked_task" | "review_needed" | "agent_message";