refactor: centralize thread filter value domains

Consolidate filter value definitions in agents-view-thread-filters
and use them in Zod schema validation to ensure consistent,
persistent serialization of filter state.
This commit is contained in:
Jinjing
2026-09-02 14:55:02 -07:00
parent a1843e77b0
commit 9b7ccae82d
2 changed files with 9 additions and 4 deletions
@@ -3,6 +3,10 @@ import {
isFeatureInteractionId,
type FeatureInteractionId
} from '../../../../shared/feature-interactions'
import {
ACTIVITY_GROUP_BY_VALUES,
THREAD_READ_FILTER_VALUES
} from '../../../../shared/agents-view-thread-filters'
import { isFeatureTipId } from '../../../../shared/feature-tips'
import { isReleaseChannel, type ReleaseChannel } from '../../../../shared/release-channel'
import {
@@ -126,8 +130,8 @@ const UiUpdateFields = z
agentsFilterRepoIds: StringArray.optional(),
agentsShowChildAgents: z.boolean().optional(),
agentsCompactMode: z.boolean().optional(),
agentsReadFilter: z.enum(['all', 'unread']).optional(),
agentsGroupBy: z.enum(['none', 'status', 'project', 'worktree', 'agent']).optional(),
agentsReadFilter: z.enum(THREAD_READ_FILTER_VALUES).optional(),
agentsGroupBy: z.enum(ACTIVITY_GROUP_BY_VALUES).optional(),
workspaceHostOrder: z.array(z.string()).optional(),
automationHostFilter: z
.union([
+3 -2
View File
@@ -49,8 +49,9 @@ export type WorktreeCardMode = 'Default' | 'Compact'
export type AgentActivityDisplayMode = 'compact' | 'full'
export type ThreadReadFilter = 'all' | 'unread'
export type ActivityGroupBy = 'none' | 'status' | 'project' | 'worktree' | 'agent'
// Re-exported so existing importers keep one home for UI chrome types; the
// value domain lives with the normalizers that police it.
export type { ActivityGroupBy, ThreadReadFilter } from './agents-view-thread-filters'
export type StatusBarItem =
| 'claude'