Files
Claude-Code-Workflow/ccw/frontend/src/lib/queryKeys.ts
catlog22 4344e79e68 Add benchmark results for fast3 and fast4, implement KeepAliveLspBridge, and add tests for staged strategies
- Added new benchmark result files: compare_2026-02-09_score_fast3.json and compare_2026-02-09_score_fast4.json.
- Implemented KeepAliveLspBridge to maintain a persistent LSP connection across multiple queries, improving performance.
- Created unit tests for staged clustering strategies in test_staged_stage3_fast_strategies.py, ensuring correct behavior of score and dir_rr strategies.
2026-02-09 20:45:29 +08:00

134 lines
7.6 KiB
TypeScript

// ========================================
// Workspace-Aware Query Keys Factory
// ========================================
// TanStack Query key factory with projectPath prefix for cache isolation
/**
* Workspace-aware query keys factory
* All keys include projectPath for cache isolation between workspaces
*/
export const workspaceQueryKeys = {
// Base key that includes projectPath
all: (projectPath: string) => ['workspace', projectPath] as const,
// ========== Sessions ==========
sessions: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'sessions'] as const,
sessionsList: (projectPath: string) => [...workspaceQueryKeys.sessions(projectPath), 'list'] as const,
sessionDetail: (projectPath: string, sessionId: string) =>
[...workspaceQueryKeys.sessions(projectPath), 'detail', sessionId] as const,
// ========== Tasks ==========
tasks: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'tasks'] as const,
tasksList: (projectPath: string, sessionId: string) =>
[...workspaceQueryKeys.tasks(projectPath), 'list', sessionId] as const,
taskDetail: (projectPath: string, taskId: string) =>
[...workspaceQueryKeys.tasks(projectPath), 'detail', taskId] as const,
// ========== Loops ==========
loops: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'loops'] as const,
loopsList: (projectPath: string) => [...workspaceQueryKeys.loops(projectPath), 'list'] as const,
loopDetail: (projectPath: string, loopId: string) =>
[...workspaceQueryKeys.loops(projectPath), 'detail', loopId] as const,
// ========== Issues ==========
issues: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'issues'] as const,
issuesList: (projectPath: string) => [...workspaceQueryKeys.issues(projectPath), 'list'] as const,
issuesHistory: (projectPath: string) => [...workspaceQueryKeys.issues(projectPath), 'history'] as const,
issueQueue: (projectPath: string) => [...workspaceQueryKeys.issues(projectPath), 'queue'] as const,
issueQueueHistory: (projectPath: string) => [...workspaceQueryKeys.issues(projectPath), 'queueHistory'] as const,
// ========== Discoveries ==========
discoveries: (projectPath: string) => ['workspace', projectPath, 'discoveries'] as const,
// ========== Memory ==========
memory: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'memory'] as const,
memoryList: (projectPath: string) => [...workspaceQueryKeys.memory(projectPath), 'list'] as const,
memoryDetail: (projectPath: string, memoryId: string) =>
[...workspaceQueryKeys.memory(projectPath), 'detail', memoryId] as const,
// ========== Skills ==========
skills: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'skills'] as const,
skillsList: (projectPath: string) => [...workspaceQueryKeys.skills(projectPath), 'list'] as const,
codexSkills: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'codexSkills'] as const,
codexSkillsList: (projectPath: string) => [...workspaceQueryKeys.codexSkills(projectPath), 'list'] as const,
// ========== Commands ==========
commands: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'commands'] as const,
commandsList: (projectPath: string) => [...workspaceQueryKeys.commands(projectPath), 'list'] as const,
// ========== Hooks ==========
hooks: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'hooks'] as const,
hooksList: (projectPath: string) => [...workspaceQueryKeys.hooks(projectPath), 'list'] as const,
// ========== MCP Servers ==========
mcpServers: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'mcpServers'] as const,
mcpServersList: (projectPath: string) => [...workspaceQueryKeys.mcpServers(projectPath), 'list'] as const,
// ========== Project Overview ==========
projectOverview: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'projectOverview'] as const,
projectOverviewDetail: (projectPath: string) =>
[...workspaceQueryKeys.projectOverview(projectPath), 'detail'] as const,
// ========== Lite Tasks ==========
liteTasks: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'liteTasks'] as const,
liteTasksList: (projectPath: string, type?: 'lite-plan' | 'lite-fix' | 'multi-cli-plan') =>
[...workspaceQueryKeys.liteTasks(projectPath), 'list', type] as const,
liteTaskDetail: (projectPath: string, sessionId: string) =>
[...workspaceQueryKeys.liteTasks(projectPath), 'detail', sessionId] as const,
// ========== Review Sessions ==========
reviewSessions: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'reviewSessions'] as const,
reviewSessionsList: (projectPath: string) => [...workspaceQueryKeys.reviewSessions(projectPath), 'list'] as const,
reviewSessionDetail: (projectPath: string, sessionId: string) =>
[...workspaceQueryKeys.reviewSessions(projectPath), 'detail', sessionId] as const,
// ========== Rules ==========
rules: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'rules'] as const,
rulesList: (projectPath: string) => [...workspaceQueryKeys.rules(projectPath), 'list'] as const,
// ========== Prompts ==========
prompts: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'prompts'] as const,
promptsList: (projectPath: string) => [...workspaceQueryKeys.prompts(projectPath), 'list'] as const,
promptsInsights: (projectPath: string) => [...workspaceQueryKeys.prompts(projectPath), 'insights'] as const,
// ========== Index ==========
index: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'index'] as const,
indexStatus: (projectPath: string) => [...workspaceQueryKeys.index(projectPath), 'status'] as const,
// ========== File Explorer ==========
explorer: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'explorer'] as const,
explorerTree: (projectPath: string, rootPath?: string) =>
[...workspaceQueryKeys.explorer(projectPath), 'tree', rootPath] as const,
explorerFile: (projectPath: string, filePath?: string) =>
[...workspaceQueryKeys.explorer(projectPath), 'file', filePath] as const,
// ========== Graph Explorer ==========
graph: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'graph'] as const,
graphDependencies: (projectPath: string, options?: { maxDepth?: number }) =>
[...workspaceQueryKeys.graph(projectPath), 'dependencies', options] as const,
graphImpact: (projectPath: string, nodeId: string) =>
[...workspaceQueryKeys.graph(projectPath), 'impact', nodeId] as const,
// ========== CLI History ==========
cliHistory: (projectPath: string) => [...workspaceQueryKeys.all(projectPath), 'cliHistory'] as const,
cliHistoryList: (projectPath: string) => [...workspaceQueryKeys.cliHistory(projectPath), 'list'] as const,
cliExecutionDetail: (projectPath: string, executionId: string) =>
[...workspaceQueryKeys.cliHistory(projectPath), 'detail', executionId] as const,
};
// ========== API Settings Keys ==========
/**
* API Settings query keys (global, not workspace-specific)
*/
export const apiSettingsKeys = {
all: ['apiSettings'] as const,
providers: () => [...apiSettingsKeys.all, 'providers'] as const,
provider: (id: string) => [...apiSettingsKeys.providers(), id] as const,
endpoints: () => [...apiSettingsKeys.all, 'endpoints'] as const,
endpoint: (id: string) => [...apiSettingsKeys.endpoints(), id] as const,
cache: () => [...apiSettingsKeys.all, 'cache'] as const,
modelPools: () => [...apiSettingsKeys.all, 'modelPools'] as const,
modelPool: (id: string) => [...apiSettingsKeys.modelPools(), id] as const,
ccwLitellm: () => [...apiSettingsKeys.all, 'ccwLitellm'] as const,
};