feat: Implement association tree for LSP-based code relationship discovery

- Add `association_tree` module with components for building and processing call association trees using LSP call hierarchy capabilities.
- Introduce `AssociationTreeBuilder` for constructing call trees from seed locations with depth-first expansion.
- Create data structures: `TreeNode`, `CallTree`, and `UniqueNode` for representing nodes and relationships in the call tree.
- Implement `ResultDeduplicator` to extract unique nodes from call trees and assign relevance scores based on depth, frequency, and kind.
- Add unit tests for `AssociationTreeBuilder` and `ResultDeduplicator` to ensure functionality and correctness.
This commit is contained in:
catlog22
2026-01-20 22:09:04 +08:00
parent b85d9b9eb1
commit 261c98549d
21 changed files with 2826 additions and 94 deletions

View File

@@ -266,6 +266,37 @@ export async function handleHooksRoutes(ctx: HooksRouteContext): Promise<boolean
}
}
// Update active executions state for CLI streaming events (terminal execution)
if (type === 'CLI_EXECUTION_STARTED' || type === 'CLI_OUTPUT' || type === 'CLI_EXECUTION_COMPLETED') {
try {
const { updateActiveExecution } = await import('./cli-routes.js');
if (type === 'CLI_EXECUTION_STARTED') {
updateActiveExecution({
type: 'started',
executionId: String(extraData.executionId || ''),
tool: String(extraData.tool || 'unknown'),
mode: String(extraData.mode || 'analysis'),
prompt: String(extraData.prompt_preview || '')
});
} else if (type === 'CLI_OUTPUT') {
updateActiveExecution({
type: 'output',
executionId: String(extraData.executionId || ''),
output: String(extraData.data || '')
});
} else if (type === 'CLI_EXECUTION_COMPLETED') {
updateActiveExecution({
type: 'completed',
executionId: String(extraData.executionId || ''),
success: Boolean(extraData.success)
});
}
} catch (err) {
console.error('[Hooks] Failed to update active execution:', err);
}
}
// Broadcast to all connected WebSocket clients
const notification = {
type: typeof type === 'string' && type.trim().length > 0 ? type : 'session_updated',