-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: add ActivityEventType literal union for type-safe event matching #877
Copy link
Copy link
Closed
Labels
spec:human-interactionDESIGN_SPEC Section 13 - Human Interaction LayerDESIGN_SPEC Section 13 - Human Interaction Layertype:refactorCode restructuring, cleanupCode restructuring, cleanupv0.5Minor version v0.5Minor version v0.5
Description
Problem
AgentActivityEvent.event_type is typed as string, but the codebase uses a finite, known set of event type values in ACTIVITY_ICON_MAP (utils/agents.ts). This means key typos are invisible to the compiler.
In contrast, CareerEvent.event_type correctly uses the CareerEventType literal union -- the inconsistency reduces type safety.
Proposed fix
- Define
ActivityEventTypeliteral union inweb/src/api/types.tswith the known values:hired,fired,promoted,demoted,onboarded,task_completed,task_started,cost_incurred,tool_used,delegation_sent,delegation_received - Use it in
AgentActivityEvent.event_type(with| (string & {})fallback for unknown future types) - Update
ACTIVITY_ICON_MAPto useRecord<ActivityEventType, LucideIcon>
Found during PR #874 review (type-design-analyzer agent).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
spec:human-interactionDESIGN_SPEC Section 13 - Human Interaction LayerDESIGN_SPEC Section 13 - Human Interaction Layertype:refactorCode restructuring, cleanupCode restructuring, cleanupv0.5Minor version v0.5Minor version v0.5