From b73021c357d95db1b81e5144d30bc142d374be34 Mon Sep 17 00:00:00 2001 From: Sumeyaaaa Date: Wed, 18 Feb 2026 15:40:47 +0300 Subject: [PATCH] refactor: move hook system files to src/hooks/ to match submission requirements - Move HookEngine.ts from src/core/hooks/ to src/hooks/ - Move OrchestrationDataModel.ts from src/core/orchestration/ to src/hooks/ - Move SelectActiveIntentTool.ts from src/core/tools/ to src/hooks/ - Update all import paths in presentAssistantMessage.ts and test files - Consolidate all hook-related files in clean src/hooks/ directory as required --- src/core/assistant-message/presentAssistantMessage.ts | 5 ++--- .../tools/__tests__/selectActiveIntentTool.spec.ts | 4 ++-- src/{core => }/hooks/HookEngine.ts | 7 ++++--- .../orchestration => hooks}/OrchestrationDataModel.ts | 1 + src/{core/tools => hooks}/SelectActiveIntentTool.ts | 11 ++++++----- 5 files changed, 15 insertions(+), 13 deletions(-) rename src/{core => }/hooks/HookEngine.ts (98%) rename src/{core/orchestration => hooks}/OrchestrationDataModel.ts (99%) rename src/{core/tools => hooks}/SelectActiveIntentTool.ts (93%) diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index 708cae5f29..712218af55 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -37,11 +37,10 @@ import { generateImageTool } from "../tools/GenerateImageTool" import { applyDiffTool as applyDiffToolClass } from "../tools/ApplyDiffTool" import { isValidToolName, validateToolUse } from "../tools/validateToolUse" import { codebaseSearchTool } from "../tools/CodebaseSearchTool" -import { selectActiveIntentTool } from "../tools/SelectActiveIntentTool" - import { formatResponse } from "../prompts/responses" import { sanitizeToolUseId } from "../../utils/tool-id" -import { HookEngine } from "../hooks/HookEngine" +import { HookEngine } from "../../hooks/HookEngine" +import { selectActiveIntentTool } from "../../hooks/SelectActiveIntentTool" /** * Processes and presents assistant message content to the user interface. diff --git a/src/core/tools/__tests__/selectActiveIntentTool.spec.ts b/src/core/tools/__tests__/selectActiveIntentTool.spec.ts index 25afd3262e..46837de4da 100644 --- a/src/core/tools/__tests__/selectActiveIntentTool.spec.ts +++ b/src/core/tools/__tests__/selectActiveIntentTool.spec.ts @@ -4,9 +4,9 @@ import * as fs from "fs/promises" import * as path from "path" import * as os from "os" -import { selectActiveIntentTool } from "../SelectActiveIntentTool" +import { selectActiveIntentTool } from "../../../hooks/SelectActiveIntentTool" import type { ToolUse } from "../../../shared/tools" -import type { AgentTraceEntry } from "../../orchestration/OrchestrationDataModel" +import type { AgentTraceEntry } from "../../../hooks/OrchestrationDataModel" describe("SelectActiveIntentTool - Phase 1 End-to-End Test", () => { let testWorkspaceDir: string diff --git a/src/core/hooks/HookEngine.ts b/src/hooks/HookEngine.ts similarity index 98% rename from src/core/hooks/HookEngine.ts rename to src/hooks/HookEngine.ts index 9285c67ff8..e3c2d6bf1b 100644 --- a/src/core/hooks/HookEngine.ts +++ b/src/hooks/HookEngine.ts @@ -1,7 +1,7 @@ -import { Task } from "../task/Task" -import type { ToolUse } from "../../shared/tools" +import { Task } from "../core/task/Task" +import type { ToolUse } from "../shared/tools" import type { ToolName } from "@roo-code/types" -import { OrchestrationDataModel, type ActiveIntent } from "../orchestration/OrchestrationDataModel" +import { OrchestrationDataModel, type ActiveIntent } from "./OrchestrationDataModel" import * as vscode from "vscode" import * as path from "path" import * as fs from "fs/promises" @@ -339,3 +339,4 @@ export class HookEngine { } } } + diff --git a/src/core/orchestration/OrchestrationDataModel.ts b/src/hooks/OrchestrationDataModel.ts similarity index 99% rename from src/core/orchestration/OrchestrationDataModel.ts rename to src/hooks/OrchestrationDataModel.ts index f6ab3053b8..5b13550914 100644 --- a/src/core/orchestration/OrchestrationDataModel.ts +++ b/src/hooks/OrchestrationDataModel.ts @@ -257,3 +257,4 @@ This file contains persistent knowledge shared across parallel sessions (Archite return this.orchestrationDir } } + diff --git a/src/core/tools/SelectActiveIntentTool.ts b/src/hooks/SelectActiveIntentTool.ts similarity index 93% rename from src/core/tools/SelectActiveIntentTool.ts rename to src/hooks/SelectActiveIntentTool.ts index 59105fd682..fedb736468 100644 --- a/src/core/tools/SelectActiveIntentTool.ts +++ b/src/hooks/SelectActiveIntentTool.ts @@ -1,8 +1,8 @@ -import { Task } from "../task/Task" -import { formatResponse } from "../prompts/responses" -import { BaseTool, ToolCallbacks } from "./BaseTool" -import type { ToolUse } from "../../shared/tools" -import { OrchestrationDataModel } from "../orchestration/OrchestrationDataModel" +import { Task } from "../core/task/Task" +import { formatResponse } from "../core/prompts/responses" +import { BaseTool, ToolCallbacks } from "../core/tools/BaseTool" +import type { ToolUse } from "../shared/tools" +import { OrchestrationDataModel } from "./OrchestrationDataModel" interface SelectActiveIntentParams { intent_id: string @@ -126,3 +126,4 @@ ${recentHistorySection} } export const selectActiveIntentTool = new SelectActiveIntentTool() +