From 83a6c269697460cb33abf3f78a3800fd4ab8b14a Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 9 Dec 2025 00:51:33 +0100 Subject: [PATCH] Reorganize file structure: core/, utils/, modes/interactive/components/, modes/interactive/theme/ --- .../coding-agent/src/core/agent-session.ts | 16 ++--- .../coding-agent/src/core/bash-executor.ts | 4 +- .../coding-agent/src/{ => core}/compaction.ts | 0 .../src/{ => core}/export-html.ts | 2 +- .../coding-agent/src/{ => core}/messages.ts | 0 .../src/{ => core}/model-config.ts | 2 +- .../src/{ => core}/oauth/anthropic.ts | 0 .../src/{ => core}/oauth/index.ts | 0 .../src/{ => core}/oauth/storage.ts | 2 +- .../src/{ => core}/session-manager.ts | 2 +- .../src/{ => core}/settings-manager.ts | 2 +- .../src/{ => core}/slash-commands.ts | 2 +- .../coding-agent/src/{ => core}/tools/bash.ts | 2 +- .../coding-agent/src/{ => core}/tools/edit.ts | 0 .../coding-agent/src/{ => core}/tools/find.ts | 2 +- .../coding-agent/src/{ => core}/tools/grep.ts | 2 +- .../src/{ => core}/tools/index.ts | 0 .../coding-agent/src/{ => core}/tools/ls.ts | 0 .../coding-agent/src/{ => core}/tools/read.ts | 0 .../src/{ => core}/tools/truncate.ts | 0 .../src/{ => core}/tools/write.ts | 0 packages/coding-agent/src/index.ts | 4 +- packages/coding-agent/src/main-new.ts | 28 ++++----- packages/coding-agent/src/main.ts | 32 +++++----- .../components}/assistant-message.ts | 0 .../interactive/components}/bash-execution.ts | 7 ++- .../interactive/components}/compaction.ts | 0 .../interactive/components}/custom-editor.ts | 0 .../interactive/components}/dynamic-border.ts | 0 .../interactive/components}/footer.ts | 2 +- .../interactive/components}/model-selector.ts | 6 +- .../interactive/components}/oauth-selector.ts | 4 +- .../components}/queue-mode-selector.ts | 0 .../components}/session-selector.ts | 4 +- .../interactive/components}/theme-selector.ts | 0 .../components}/thinking-selector.ts | 0 .../interactive/components}/tool-execution.ts | 0 .../components}/user-message-selector.ts | 0 .../interactive/components}/user-message.ts | 0 .../src/modes/interactive/interactive-mode.ts | 48 +++++++-------- .../{ => modes/interactive}/theme/dark.json | 0 .../{ => modes/interactive}/theme/light.json | 0 .../interactive}/theme/theme-schema.json | 0 .../{ => modes/interactive}/theme/theme.ts | 2 +- packages/coding-agent/src/tui/tui-renderer.ts | 58 +++++++++---------- .../coding-agent/src/{ => utils}/changelog.ts | 0 .../coding-agent/src/{ => utils}/clipboard.ts | 0 .../coding-agent/src/{ => utils}/config.ts | 0 .../coding-agent/src/{ => utils}/fuzzy.ts | 0 .../coding-agent/src/{ => utils}/shell.ts | 2 +- .../src/{ => utils}/tools-manager.ts | 0 packages/coding-agent/test/compaction.test.ts | 4 +- packages/coding-agent/test/fuzzy.test.ts | 2 +- packages/coding-agent/test/rpc.test.ts | 4 +- .../coding-agent/test/test-theme-colors.ts | 2 +- packages/coding-agent/test/tools.test.ts | 14 ++--- 56 files changed, 133 insertions(+), 128 deletions(-) rename packages/coding-agent/src/{ => core}/compaction.ts (100%) rename packages/coding-agent/src/{ => core}/export-html.ts (99%) rename packages/coding-agent/src/{ => core}/messages.ts (100%) rename packages/coding-agent/src/{ => core}/model-config.ts (99%) rename packages/coding-agent/src/{ => core}/oauth/anthropic.ts (100%) rename packages/coding-agent/src/{ => core}/oauth/index.ts (100%) rename packages/coding-agent/src/{ => core}/oauth/storage.ts (96%) rename packages/coding-agent/src/{ => core}/session-manager.ts (99%) rename packages/coding-agent/src/{ => core}/settings-manager.ts (98%) rename packages/coding-agent/src/{ => core}/slash-commands.ts (98%) rename packages/coding-agent/src/{ => core}/tools/bash.ts (98%) rename packages/coding-agent/src/{ => core}/tools/edit.ts (100%) rename packages/coding-agent/src/{ => core}/tools/find.ts (99%) rename packages/coding-agent/src/{ => core}/tools/grep.ts (99%) rename packages/coding-agent/src/{ => core}/tools/index.ts (100%) rename packages/coding-agent/src/{ => core}/tools/ls.ts (100%) rename packages/coding-agent/src/{ => core}/tools/read.ts (100%) rename packages/coding-agent/src/{ => core}/tools/truncate.ts (100%) rename packages/coding-agent/src/{ => core}/tools/write.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/assistant-message.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/bash-execution.ts (97%) rename packages/coding-agent/src/{tui => modes/interactive/components}/compaction.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/custom-editor.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/dynamic-border.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/footer.ts (99%) rename packages/coding-agent/src/{tui => modes/interactive/components}/model-selector.ts (97%) rename packages/coding-agent/src/{tui => modes/interactive/components}/oauth-selector.ts (95%) rename packages/coding-agent/src/{tui => modes/interactive/components}/queue-mode-selector.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/session-selector.ts (97%) rename packages/coding-agent/src/{tui => modes/interactive/components}/theme-selector.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/thinking-selector.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/tool-execution.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/user-message-selector.ts (100%) rename packages/coding-agent/src/{tui => modes/interactive/components}/user-message.ts (100%) rename packages/coding-agent/src/{ => modes/interactive}/theme/dark.json (100%) rename packages/coding-agent/src/{ => modes/interactive}/theme/light.json (100%) rename packages/coding-agent/src/{ => modes/interactive}/theme/theme-schema.json (100%) rename packages/coding-agent/src/{ => modes/interactive}/theme/theme.ts (99%) rename packages/coding-agent/src/{ => utils}/changelog.ts (100%) rename packages/coding-agent/src/{ => utils}/clipboard.ts (100%) rename packages/coding-agent/src/{ => utils}/config.ts (100%) rename packages/coding-agent/src/{ => utils}/fuzzy.ts (100%) rename packages/coding-agent/src/{ => utils}/shell.ts (98%) rename packages/coding-agent/src/{ => utils}/tools-manager.ts (100%) diff --git a/packages/coding-agent/src/core/agent-session.ts b/packages/coding-agent/src/core/agent-session.ts index b4b0b9f6..6159cb26 100644 --- a/packages/coding-agent/src/core/agent-session.ts +++ b/packages/coding-agent/src/core/agent-session.ts @@ -15,15 +15,15 @@ import type { Agent, AgentEvent, AgentState, AppMessage, Attachment, ThinkingLevel } from "@mariozechner/pi-agent-core"; import type { AssistantMessage, Model } from "@mariozechner/pi-ai"; -import { calculateContextTokens, compact, shouldCompact } from "../compaction.js"; -import { getModelsPath } from "../config.js"; -import { exportSessionToHtml } from "../export-html.js"; -import type { BashExecutionMessage } from "../messages.js"; -import { getApiKeyForModel, getAvailableModels } from "../model-config.js"; -import { loadSessionFromEntries, type SessionManager } from "../session-manager.js"; -import type { SettingsManager } from "../settings-manager.js"; -import { expandSlashCommand, type FileSlashCommand } from "../slash-commands.js"; +import { getModelsPath } from "../utils/config.js"; import { type BashResult, executeBash as executeBashCommand } from "./bash-executor.js"; +import { calculateContextTokens, compact, shouldCompact } from "./compaction.js"; +import { exportSessionToHtml } from "./export-html.js"; +import type { BashExecutionMessage } from "./messages.js"; +import { getApiKeyForModel, getAvailableModels } from "./model-config.js"; +import { loadSessionFromEntries, type SessionManager } from "./session-manager.js"; +import type { SettingsManager } from "./settings-manager.js"; +import { expandSlashCommand, type FileSlashCommand } from "./slash-commands.js"; /** Listener function for agent events */ export type AgentEventListener = (event: AgentEvent) => void; diff --git a/packages/coding-agent/src/core/bash-executor.ts b/packages/coding-agent/src/core/bash-executor.ts index 9aef7a6e..d83f63b5 100644 --- a/packages/coding-agent/src/core/bash-executor.ts +++ b/packages/coding-agent/src/core/bash-executor.ts @@ -12,8 +12,8 @@ import { tmpdir } from "node:os"; import { join } from "node:path"; import { type ChildProcess, spawn } from "child_process"; import stripAnsi from "strip-ansi"; -import { getShellConfig, killProcessTree, sanitizeBinaryOutput } from "../shell.js"; -import { DEFAULT_MAX_BYTES, truncateTail } from "../tools/truncate.js"; +import { getShellConfig, killProcessTree, sanitizeBinaryOutput } from "../utils/shell.js"; +import { DEFAULT_MAX_BYTES, truncateTail } from "./tools/truncate.js"; // ============================================================================ // Types diff --git a/packages/coding-agent/src/compaction.ts b/packages/coding-agent/src/core/compaction.ts similarity index 100% rename from packages/coding-agent/src/compaction.ts rename to packages/coding-agent/src/core/compaction.ts diff --git a/packages/coding-agent/src/export-html.ts b/packages/coding-agent/src/core/export-html.ts similarity index 99% rename from packages/coding-agent/src/export-html.ts rename to packages/coding-agent/src/core/export-html.ts index 1ac8f2a4..31450281 100644 --- a/packages/coding-agent/src/export-html.ts +++ b/packages/coding-agent/src/core/export-html.ts @@ -3,7 +3,7 @@ import type { AssistantMessage, Message, ToolResultMessage, UserMessage } from " import { existsSync, readFileSync, writeFileSync } from "fs"; import { homedir } from "os"; import { basename } from "path"; -import { APP_NAME, VERSION } from "./config.js"; +import { APP_NAME, VERSION } from "../utils/config.js"; import { type BashExecutionMessage, isBashExecutionMessage } from "./messages.js"; import type { SessionManager } from "./session-manager.js"; diff --git a/packages/coding-agent/src/messages.ts b/packages/coding-agent/src/core/messages.ts similarity index 100% rename from packages/coding-agent/src/messages.ts rename to packages/coding-agent/src/core/messages.ts diff --git a/packages/coding-agent/src/model-config.ts b/packages/coding-agent/src/core/model-config.ts similarity index 99% rename from packages/coding-agent/src/model-config.ts rename to packages/coding-agent/src/core/model-config.ts index 820fab33..f8f6f8e1 100644 --- a/packages/coding-agent/src/model-config.ts +++ b/packages/coding-agent/src/core/model-config.ts @@ -2,7 +2,7 @@ import { type Api, getApiKey, getModels, getProviders, type KnownProvider, type import { type Static, Type } from "@sinclair/typebox"; import AjvModule from "ajv"; import { existsSync, readFileSync } from "fs"; -import { getModelsPath } from "./config.js"; +import { getModelsPath } from "../utils/config.js"; import { getOAuthToken, type SupportedOAuthProvider } from "./oauth/index.js"; import { loadOAuthCredentials } from "./oauth/storage.js"; diff --git a/packages/coding-agent/src/oauth/anthropic.ts b/packages/coding-agent/src/core/oauth/anthropic.ts similarity index 100% rename from packages/coding-agent/src/oauth/anthropic.ts rename to packages/coding-agent/src/core/oauth/anthropic.ts diff --git a/packages/coding-agent/src/oauth/index.ts b/packages/coding-agent/src/core/oauth/index.ts similarity index 100% rename from packages/coding-agent/src/oauth/index.ts rename to packages/coding-agent/src/core/oauth/index.ts diff --git a/packages/coding-agent/src/oauth/storage.ts b/packages/coding-agent/src/core/oauth/storage.ts similarity index 96% rename from packages/coding-agent/src/oauth/storage.ts rename to packages/coding-agent/src/core/oauth/storage.ts index f994949f..b442169a 100644 --- a/packages/coding-agent/src/oauth/storage.ts +++ b/packages/coding-agent/src/core/oauth/storage.ts @@ -1,5 +1,5 @@ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs"; -import { getAgentDir, getOAuthPath } from "../config.js"; +import { getAgentDir, getOAuthPath } from "../../utils/config.js"; export interface OAuthCredentials { type: "oauth"; diff --git a/packages/coding-agent/src/session-manager.ts b/packages/coding-agent/src/core/session-manager.ts similarity index 99% rename from packages/coding-agent/src/session-manager.ts rename to packages/coding-agent/src/core/session-manager.ts index e40374fb..0fc5aa21 100644 --- a/packages/coding-agent/src/session-manager.ts +++ b/packages/coding-agent/src/core/session-manager.ts @@ -2,7 +2,7 @@ import type { AgentState, AppMessage } from "@mariozechner/pi-agent-core"; import { randomBytes } from "crypto"; import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync } from "fs"; import { join, resolve } from "path"; -import { getAgentDir } from "./config.js"; +import { getAgentDir } from "../utils/config.js"; function uuidv4(): string { const bytes = randomBytes(16); diff --git a/packages/coding-agent/src/settings-manager.ts b/packages/coding-agent/src/core/settings-manager.ts similarity index 98% rename from packages/coding-agent/src/settings-manager.ts rename to packages/coding-agent/src/core/settings-manager.ts index dc8c7b6e..8311b99e 100644 --- a/packages/coding-agent/src/settings-manager.ts +++ b/packages/coding-agent/src/core/settings-manager.ts @@ -1,6 +1,6 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs"; import { dirname, join } from "path"; -import { getAgentDir } from "./config.js"; +import { getAgentDir } from "../utils/config.js"; export interface CompactionSettings { enabled?: boolean; // default: true diff --git a/packages/coding-agent/src/slash-commands.ts b/packages/coding-agent/src/core/slash-commands.ts similarity index 98% rename from packages/coding-agent/src/slash-commands.ts rename to packages/coding-agent/src/core/slash-commands.ts index 552d0f17..a399887b 100644 --- a/packages/coding-agent/src/slash-commands.ts +++ b/packages/coding-agent/src/core/slash-commands.ts @@ -1,6 +1,6 @@ import { existsSync, readdirSync, readFileSync } from "fs"; import { join, resolve } from "path"; -import { CONFIG_DIR_NAME, getCommandsDir } from "./config.js"; +import { CONFIG_DIR_NAME, getCommandsDir } from "../utils/config.js"; /** * Represents a custom slash command loaded from a file diff --git a/packages/coding-agent/src/tools/bash.ts b/packages/coding-agent/src/core/tools/bash.ts similarity index 98% rename from packages/coding-agent/src/tools/bash.ts rename to packages/coding-agent/src/core/tools/bash.ts index 6faa4c31..36524a2b 100644 --- a/packages/coding-agent/src/tools/bash.ts +++ b/packages/coding-agent/src/core/tools/bash.ts @@ -5,7 +5,7 @@ import { join } from "node:path"; import type { AgentTool } from "@mariozechner/pi-ai"; import { Type } from "@sinclair/typebox"; import { spawn } from "child_process"; -import { getShellConfig, killProcessTree } from "../shell.js"; +import { getShellConfig, killProcessTree } from "../../utils/shell.js"; import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, type TruncationResult, truncateTail } from "./truncate.js"; /** diff --git a/packages/coding-agent/src/tools/edit.ts b/packages/coding-agent/src/core/tools/edit.ts similarity index 100% rename from packages/coding-agent/src/tools/edit.ts rename to packages/coding-agent/src/core/tools/edit.ts diff --git a/packages/coding-agent/src/tools/find.ts b/packages/coding-agent/src/core/tools/find.ts similarity index 99% rename from packages/coding-agent/src/tools/find.ts rename to packages/coding-agent/src/core/tools/find.ts index 6cc4b0c0..6b81dada 100644 --- a/packages/coding-agent/src/tools/find.ts +++ b/packages/coding-agent/src/core/tools/find.ts @@ -5,7 +5,7 @@ import { existsSync } from "fs"; import { globSync } from "glob"; import { homedir } from "os"; import path from "path"; -import { ensureTool } from "../tools-manager.js"; +import { ensureTool } from "../../utils/tools-manager.js"; import { DEFAULT_MAX_BYTES, formatSize, type TruncationResult, truncateHead } from "./truncate.js"; /** diff --git a/packages/coding-agent/src/tools/grep.ts b/packages/coding-agent/src/core/tools/grep.ts similarity index 99% rename from packages/coding-agent/src/tools/grep.ts rename to packages/coding-agent/src/core/tools/grep.ts index d984a6df..4560d6f3 100644 --- a/packages/coding-agent/src/tools/grep.ts +++ b/packages/coding-agent/src/core/tools/grep.ts @@ -5,7 +5,7 @@ import { spawn } from "child_process"; import { readFileSync, type Stats, statSync } from "fs"; import { homedir } from "os"; import path from "path"; -import { ensureTool } from "../tools-manager.js"; +import { ensureTool } from "../../utils/tools-manager.js"; import { DEFAULT_MAX_BYTES, formatSize, diff --git a/packages/coding-agent/src/tools/index.ts b/packages/coding-agent/src/core/tools/index.ts similarity index 100% rename from packages/coding-agent/src/tools/index.ts rename to packages/coding-agent/src/core/tools/index.ts diff --git a/packages/coding-agent/src/tools/ls.ts b/packages/coding-agent/src/core/tools/ls.ts similarity index 100% rename from packages/coding-agent/src/tools/ls.ts rename to packages/coding-agent/src/core/tools/ls.ts diff --git a/packages/coding-agent/src/tools/read.ts b/packages/coding-agent/src/core/tools/read.ts similarity index 100% rename from packages/coding-agent/src/tools/read.ts rename to packages/coding-agent/src/core/tools/read.ts diff --git a/packages/coding-agent/src/tools/truncate.ts b/packages/coding-agent/src/core/tools/truncate.ts similarity index 100% rename from packages/coding-agent/src/tools/truncate.ts rename to packages/coding-agent/src/core/tools/truncate.ts diff --git a/packages/coding-agent/src/tools/write.ts b/packages/coding-agent/src/core/tools/write.ts similarity index 100% rename from packages/coding-agent/src/tools/write.ts rename to packages/coding-agent/src/core/tools/write.ts diff --git a/packages/coding-agent/src/index.ts b/packages/coding-agent/src/index.ts index 45b648bd..3f6d7700 100644 --- a/packages/coding-agent/src/index.ts +++ b/packages/coding-agent/src/index.ts @@ -1,3 +1,3 @@ +export { SessionManager } from "./core/session-manager.js"; +export { bashTool, codingTools, editTool, readTool, writeTool } from "./core/tools/index.js"; export { main } from "./main.js"; -export { SessionManager } from "./session-manager.js"; -export { bashTool, codingTools, editTool, readTool, writeTool } from "./tools/index.js"; diff --git a/packages/coding-agent/src/main-new.ts b/packages/coding-agent/src/main-new.ts index a079b942..dc5d4cd2 100644 --- a/packages/coding-agent/src/main-new.ts +++ b/packages/coding-agent/src/main-new.ts @@ -5,7 +5,18 @@ import chalk from "chalk"; import { existsSync, readFileSync, statSync } from "fs"; import { homedir } from "os"; import { extname, join, resolve } from "path"; -import { getChangelogPath, getNewEntries, parseChangelog } from "./changelog.js"; +import { AgentSession } from "./core/agent-session.js"; +import { exportFromFile } from "./core/export-html.js"; +import { messageTransformer } from "./core/messages.js"; +import { findModel, getApiKeyForModel, getAvailableModels } from "./core/model-config.js"; +import { SessionManager } from "./core/session-manager.js"; +import { SettingsManager } from "./core/settings-manager.js"; +import { loadSlashCommands } from "./core/slash-commands.js"; +import { allTools, codingTools, type ToolName } from "./core/tools/index.js"; +import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index.js"; +import { SessionSelectorComponent } from "./modes/interactive/components/session-selector.js"; +import { initTheme } from "./modes/interactive/theme/theme.js"; +import { getChangelogPath, getNewEntries, parseChangelog } from "./utils/changelog.js"; import { APP_NAME, CONFIG_DIR_NAME, @@ -14,19 +25,8 @@ import { getModelsPath, getReadmePath, VERSION, -} from "./config.js"; -import { AgentSession } from "./core/agent-session.js"; -import { exportFromFile } from "./export-html.js"; -import { messageTransformer } from "./messages.js"; -import { findModel, getApiKeyForModel, getAvailableModels } from "./model-config.js"; -import { InteractiveMode, runPrintMode, runRpcMode } from "./modes/index.js"; -import { SessionManager } from "./session-manager.js"; -import { SettingsManager } from "./settings-manager.js"; -import { loadSlashCommands } from "./slash-commands.js"; -import { initTheme } from "./theme/theme.js"; -import { allTools, codingTools, type ToolName } from "./tools/index.js"; -import { ensureTool } from "./tools-manager.js"; -import { SessionSelectorComponent } from "./tui/session-selector.js"; +} from "./utils/config.js"; +import { ensureTool } from "./utils/tools-manager.js"; const defaultModelPerProvider: Record = { anthropic: "claude-sonnet-4-5", diff --git a/packages/coding-agent/src/main.ts b/packages/coding-agent/src/main.ts index 853ee74e..b1c3654a 100644 --- a/packages/coding-agent/src/main.ts +++ b/packages/coding-agent/src/main.ts @@ -8,8 +8,19 @@ import { createWriteStream, existsSync, readFileSync, statSync } from "fs"; import { homedir, tmpdir } from "os"; import { extname, join, resolve } from "path"; import stripAnsi from "strip-ansi"; -import { getChangelogPath, getNewEntries, parseChangelog } from "./changelog.js"; -import { calculateContextTokens, compact, shouldCompact } from "./compaction.js"; +import { calculateContextTokens, compact, shouldCompact } from "./core/compaction.js"; +import { exportFromFile } from "./core/export-html.js"; +import { type BashExecutionMessage, messageTransformer } from "./core/messages.js"; +import { findModel, getApiKeyForModel, getAvailableModels } from "./core/model-config.js"; +import { loadSessionFromEntries, SessionManager } from "./core/session-manager.js"; +import { SettingsManager } from "./core/settings-manager.js"; +import { expandSlashCommand, loadSlashCommands } from "./core/slash-commands.js"; +import { allTools, codingTools, type ToolName } from "./core/tools/index.js"; +import { DEFAULT_MAX_BYTES, truncateTail } from "./core/tools/truncate.js"; +import { SessionSelectorComponent } from "./modes/interactive/components/session-selector.js"; +import { initTheme } from "./modes/interactive/theme/theme.js"; +import { TuiRenderer } from "./tui/tui-renderer.js"; +import { getChangelogPath, getNewEntries, parseChangelog } from "./utils/changelog.js"; import { APP_NAME, CONFIG_DIR_NAME, @@ -18,20 +29,9 @@ import { getModelsPath, getReadmePath, VERSION, -} from "./config.js"; -import { exportFromFile } from "./export-html.js"; -import { type BashExecutionMessage, messageTransformer } from "./messages.js"; -import { findModel, getApiKeyForModel, getAvailableModels } from "./model-config.js"; -import { loadSessionFromEntries, SessionManager } from "./session-manager.js"; -import { SettingsManager } from "./settings-manager.js"; -import { getShellConfig } from "./shell.js"; -import { expandSlashCommand, loadSlashCommands } from "./slash-commands.js"; -import { initTheme } from "./theme/theme.js"; -import { allTools, codingTools, type ToolName } from "./tools/index.js"; -import { DEFAULT_MAX_BYTES, truncateTail } from "./tools/truncate.js"; -import { ensureTool } from "./tools-manager.js"; -import { SessionSelectorComponent } from "./tui/session-selector.js"; -import { TuiRenderer } from "./tui/tui-renderer.js"; +} from "./utils/config.js"; +import { getShellConfig } from "./utils/shell.js"; +import { ensureTool } from "./utils/tools-manager.js"; const defaultModelPerProvider: Record = { anthropic: "claude-sonnet-4-5", diff --git a/packages/coding-agent/src/tui/assistant-message.ts b/packages/coding-agent/src/modes/interactive/components/assistant-message.ts similarity index 100% rename from packages/coding-agent/src/tui/assistant-message.ts rename to packages/coding-agent/src/modes/interactive/components/assistant-message.ts diff --git a/packages/coding-agent/src/tui/bash-execution.ts b/packages/coding-agent/src/modes/interactive/components/bash-execution.ts similarity index 97% rename from packages/coding-agent/src/tui/bash-execution.ts rename to packages/coding-agent/src/modes/interactive/components/bash-execution.ts index dd25bce5..df8f6070 100644 --- a/packages/coding-agent/src/tui/bash-execution.ts +++ b/packages/coding-agent/src/modes/interactive/components/bash-execution.ts @@ -4,8 +4,13 @@ import { Container, Loader, Spacer, Text, type TUI } from "@mariozechner/pi-tui"; import stripAnsi from "strip-ansi"; +import { + DEFAULT_MAX_BYTES, + DEFAULT_MAX_LINES, + type TruncationResult, + truncateTail, +} from "../../../core/tools/truncate.js"; import { theme } from "../theme/theme.js"; -import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type TruncationResult, truncateTail } from "../tools/truncate.js"; import { DynamicBorder } from "./dynamic-border.js"; // Preview line limit when not expanded (matches tool execution behavior) diff --git a/packages/coding-agent/src/tui/compaction.ts b/packages/coding-agent/src/modes/interactive/components/compaction.ts similarity index 100% rename from packages/coding-agent/src/tui/compaction.ts rename to packages/coding-agent/src/modes/interactive/components/compaction.ts diff --git a/packages/coding-agent/src/tui/custom-editor.ts b/packages/coding-agent/src/modes/interactive/components/custom-editor.ts similarity index 100% rename from packages/coding-agent/src/tui/custom-editor.ts rename to packages/coding-agent/src/modes/interactive/components/custom-editor.ts diff --git a/packages/coding-agent/src/tui/dynamic-border.ts b/packages/coding-agent/src/modes/interactive/components/dynamic-border.ts similarity index 100% rename from packages/coding-agent/src/tui/dynamic-border.ts rename to packages/coding-agent/src/modes/interactive/components/dynamic-border.ts diff --git a/packages/coding-agent/src/tui/footer.ts b/packages/coding-agent/src/modes/interactive/components/footer.ts similarity index 99% rename from packages/coding-agent/src/tui/footer.ts rename to packages/coding-agent/src/modes/interactive/components/footer.ts index cbd08656..932e071f 100644 --- a/packages/coding-agent/src/tui/footer.ts +++ b/packages/coding-agent/src/modes/interactive/components/footer.ts @@ -3,7 +3,7 @@ import type { AssistantMessage } from "@mariozechner/pi-ai"; import { type Component, visibleWidth } from "@mariozechner/pi-tui"; import { existsSync, type FSWatcher, readFileSync, watch } from "fs"; import { join } from "path"; -import { isModelUsingOAuth } from "../model-config.js"; +import { isModelUsingOAuth } from "../../../core/model-config.js"; import { theme } from "../theme/theme.js"; /** diff --git a/packages/coding-agent/src/tui/model-selector.ts b/packages/coding-agent/src/modes/interactive/components/model-selector.ts similarity index 97% rename from packages/coding-agent/src/tui/model-selector.ts rename to packages/coding-agent/src/modes/interactive/components/model-selector.ts index 8b0fd961..c4b5e0cc 100644 --- a/packages/coding-agent/src/tui/model-selector.ts +++ b/packages/coding-agent/src/modes/interactive/components/model-selector.ts @@ -1,8 +1,8 @@ import type { Model } from "@mariozechner/pi-ai"; import { Container, Input, Spacer, Text, type TUI } from "@mariozechner/pi-tui"; -import { fuzzyFilter } from "../fuzzy.js"; -import { getAvailableModels } from "../model-config.js"; -import type { SettingsManager } from "../settings-manager.js"; +import { getAvailableModels } from "../../../core/model-config.js"; +import type { SettingsManager } from "../../../core/settings-manager.js"; +import { fuzzyFilter } from "../../../utils/fuzzy.js"; import { theme } from "../theme/theme.js"; import { DynamicBorder } from "./dynamic-border.js"; diff --git a/packages/coding-agent/src/tui/oauth-selector.ts b/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts similarity index 95% rename from packages/coding-agent/src/tui/oauth-selector.ts rename to packages/coding-agent/src/modes/interactive/components/oauth-selector.ts index 76db4ed5..2d062e6f 100644 --- a/packages/coding-agent/src/tui/oauth-selector.ts +++ b/packages/coding-agent/src/modes/interactive/components/oauth-selector.ts @@ -1,6 +1,6 @@ import { Container, Spacer, TruncatedText } from "@mariozechner/pi-tui"; -import { getOAuthProviders, type OAuthProviderInfo } from "../oauth/index.js"; -import { loadOAuthCredentials } from "../oauth/storage.js"; +import { getOAuthProviders, type OAuthProviderInfo } from "../../../core/oauth/index.js"; +import { loadOAuthCredentials } from "../../../core/oauth/storage.js"; import { theme } from "../theme/theme.js"; import { DynamicBorder } from "./dynamic-border.js"; diff --git a/packages/coding-agent/src/tui/queue-mode-selector.ts b/packages/coding-agent/src/modes/interactive/components/queue-mode-selector.ts similarity index 100% rename from packages/coding-agent/src/tui/queue-mode-selector.ts rename to packages/coding-agent/src/modes/interactive/components/queue-mode-selector.ts diff --git a/packages/coding-agent/src/tui/session-selector.ts b/packages/coding-agent/src/modes/interactive/components/session-selector.ts similarity index 97% rename from packages/coding-agent/src/tui/session-selector.ts rename to packages/coding-agent/src/modes/interactive/components/session-selector.ts index fbb47568..3db54b8a 100644 --- a/packages/coding-agent/src/tui/session-selector.ts +++ b/packages/coding-agent/src/modes/interactive/components/session-selector.ts @@ -1,6 +1,6 @@ import { type Component, Container, Input, Spacer, Text, truncateToWidth } from "@mariozechner/pi-tui"; -import { fuzzyFilter } from "../fuzzy.js"; -import type { SessionManager } from "../session-manager.js"; +import type { SessionManager } from "../../../core/session-manager.js"; +import { fuzzyFilter } from "../../../utils/fuzzy.js"; import { theme } from "../theme/theme.js"; import { DynamicBorder } from "./dynamic-border.js"; diff --git a/packages/coding-agent/src/tui/theme-selector.ts b/packages/coding-agent/src/modes/interactive/components/theme-selector.ts similarity index 100% rename from packages/coding-agent/src/tui/theme-selector.ts rename to packages/coding-agent/src/modes/interactive/components/theme-selector.ts diff --git a/packages/coding-agent/src/tui/thinking-selector.ts b/packages/coding-agent/src/modes/interactive/components/thinking-selector.ts similarity index 100% rename from packages/coding-agent/src/tui/thinking-selector.ts rename to packages/coding-agent/src/modes/interactive/components/thinking-selector.ts diff --git a/packages/coding-agent/src/tui/tool-execution.ts b/packages/coding-agent/src/modes/interactive/components/tool-execution.ts similarity index 100% rename from packages/coding-agent/src/tui/tool-execution.ts rename to packages/coding-agent/src/modes/interactive/components/tool-execution.ts diff --git a/packages/coding-agent/src/tui/user-message-selector.ts b/packages/coding-agent/src/modes/interactive/components/user-message-selector.ts similarity index 100% rename from packages/coding-agent/src/tui/user-message-selector.ts rename to packages/coding-agent/src/modes/interactive/components/user-message-selector.ts diff --git a/packages/coding-agent/src/tui/user-message.ts b/packages/coding-agent/src/modes/interactive/components/user-message.ts similarity index 100% rename from packages/coding-agent/src/tui/user-message.ts rename to packages/coding-agent/src/modes/interactive/components/user-message.ts diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts index 7bc59bfc..91079e65 100644 --- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts +++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts @@ -22,31 +22,31 @@ import { visibleWidth, } from "@mariozechner/pi-tui"; import { exec } from "child_process"; -import { getChangelogPath, parseChangelog } from "../../changelog.js"; -import { copyToClipboard } from "../../clipboard.js"; -import { APP_NAME, getDebugLogPath, getOAuthPath } from "../../config.js"; import type { AgentSession } from "../../core/agent-session.js"; -import { type BashExecutionMessage, isBashExecutionMessage } from "../../messages.js"; -import { invalidateOAuthCache } from "../../model-config.js"; -import { listOAuthProviders, login, logout, type SupportedOAuthProvider } from "../../oauth/index.js"; -import { getLatestCompactionEntry, SUMMARY_PREFIX, SUMMARY_SUFFIX } from "../../session-manager.js"; -import { getEditorTheme, getMarkdownTheme, onThemeChange, setTheme, theme } from "../../theme/theme.js"; -import type { TruncationResult } from "../../tools/truncate.js"; -import { AssistantMessageComponent } from "../../tui/assistant-message.js"; -import { BashExecutionComponent } from "../../tui/bash-execution.js"; -import { CompactionComponent } from "../../tui/compaction.js"; -import { CustomEditor } from "../../tui/custom-editor.js"; -import { DynamicBorder } from "../../tui/dynamic-border.js"; -import { FooterComponent } from "../../tui/footer.js"; -import { ModelSelectorComponent } from "../../tui/model-selector.js"; -import { OAuthSelectorComponent } from "../../tui/oauth-selector.js"; -import { QueueModeSelectorComponent } from "../../tui/queue-mode-selector.js"; -import { SessionSelectorComponent } from "../../tui/session-selector.js"; -import { ThemeSelectorComponent } from "../../tui/theme-selector.js"; -import { ThinkingSelectorComponent } from "../../tui/thinking-selector.js"; -import { ToolExecutionComponent } from "../../tui/tool-execution.js"; -import { UserMessageComponent } from "../../tui/user-message.js"; -import { UserMessageSelectorComponent } from "../../tui/user-message-selector.js"; +import { type BashExecutionMessage, isBashExecutionMessage } from "../../core/messages.js"; +import { invalidateOAuthCache } from "../../core/model-config.js"; +import { listOAuthProviders, login, logout, type SupportedOAuthProvider } from "../../core/oauth/index.js"; +import { getLatestCompactionEntry, SUMMARY_PREFIX, SUMMARY_SUFFIX } from "../../core/session-manager.js"; +import type { TruncationResult } from "../../core/tools/truncate.js"; +import { getChangelogPath, parseChangelog } from "../../utils/changelog.js"; +import { copyToClipboard } from "../../utils/clipboard.js"; +import { APP_NAME, getDebugLogPath, getOAuthPath } from "../../utils/config.js"; +import { AssistantMessageComponent } from "./components/assistant-message.js"; +import { BashExecutionComponent } from "./components/bash-execution.js"; +import { CompactionComponent } from "./components/compaction.js"; +import { CustomEditor } from "./components/custom-editor.js"; +import { DynamicBorder } from "./components/dynamic-border.js"; +import { FooterComponent } from "./components/footer.js"; +import { ModelSelectorComponent } from "./components/model-selector.js"; +import { OAuthSelectorComponent } from "./components/oauth-selector.js"; +import { QueueModeSelectorComponent } from "./components/queue-mode-selector.js"; +import { SessionSelectorComponent } from "./components/session-selector.js"; +import { ThemeSelectorComponent } from "./components/theme-selector.js"; +import { ThinkingSelectorComponent } from "./components/thinking-selector.js"; +import { ToolExecutionComponent } from "./components/tool-execution.js"; +import { UserMessageComponent } from "./components/user-message.js"; +import { UserMessageSelectorComponent } from "./components/user-message-selector.js"; +import { getEditorTheme, getMarkdownTheme, onThemeChange, setTheme, theme } from "./theme/theme.js"; export class InteractiveMode { private session: AgentSession; diff --git a/packages/coding-agent/src/theme/dark.json b/packages/coding-agent/src/modes/interactive/theme/dark.json similarity index 100% rename from packages/coding-agent/src/theme/dark.json rename to packages/coding-agent/src/modes/interactive/theme/dark.json diff --git a/packages/coding-agent/src/theme/light.json b/packages/coding-agent/src/modes/interactive/theme/light.json similarity index 100% rename from packages/coding-agent/src/theme/light.json rename to packages/coding-agent/src/modes/interactive/theme/light.json diff --git a/packages/coding-agent/src/theme/theme-schema.json b/packages/coding-agent/src/modes/interactive/theme/theme-schema.json similarity index 100% rename from packages/coding-agent/src/theme/theme-schema.json rename to packages/coding-agent/src/modes/interactive/theme/theme-schema.json diff --git a/packages/coding-agent/src/theme/theme.ts b/packages/coding-agent/src/modes/interactive/theme/theme.ts similarity index 99% rename from packages/coding-agent/src/theme/theme.ts rename to packages/coding-agent/src/modes/interactive/theme/theme.ts index 8f191da7..d8d477fc 100644 --- a/packages/coding-agent/src/theme/theme.ts +++ b/packages/coding-agent/src/modes/interactive/theme/theme.ts @@ -4,7 +4,7 @@ import type { EditorTheme, MarkdownTheme, SelectListTheme } from "@mariozechner/ import { type Static, Type } from "@sinclair/typebox"; import { TypeCompiler } from "@sinclair/typebox/compiler"; import chalk from "chalk"; -import { getCustomThemesDir, getThemesDir } from "../config.js"; +import { getCustomThemesDir, getThemesDir } from "../../../utils/config.js"; // ============================================================================ // Types & Schema diff --git a/packages/coding-agent/src/tui/tui-renderer.ts b/packages/coding-agent/src/tui/tui-renderer.ts index 6a850680..d21f78f1 100644 --- a/packages/coding-agent/src/tui/tui-renderer.ts +++ b/packages/coding-agent/src/tui/tui-renderer.ts @@ -22,41 +22,41 @@ import { } from "@mariozechner/pi-tui"; import { exec, spawn } from "child_process"; import stripAnsi from "strip-ansi"; -import { getChangelogPath, parseChangelog } from "../changelog.js"; -import { copyToClipboard } from "../clipboard.js"; -import { calculateContextTokens, compact, shouldCompact } from "../compaction.js"; -import { APP_NAME, getDebugLogPath, getModelsPath, getOAuthPath } from "../config.js"; -import { exportSessionToHtml } from "../export-html.js"; -import { type BashExecutionMessage, isBashExecutionMessage } from "../messages.js"; -import { getApiKeyForModel, getAvailableModels, invalidateOAuthCache } from "../model-config.js"; -import { listOAuthProviders, login, logout, type SupportedOAuthProvider } from "../oauth/index.js"; +import { calculateContextTokens, compact, shouldCompact } from "../core/compaction.js"; +import { exportSessionToHtml } from "../core/export-html.js"; +import { type BashExecutionMessage, isBashExecutionMessage } from "../core/messages.js"; +import { getApiKeyForModel, getAvailableModels, invalidateOAuthCache } from "../core/model-config.js"; +import { listOAuthProviders, login, logout, type SupportedOAuthProvider } from "../core/oauth/index.js"; import { getLatestCompactionEntry, loadSessionFromEntries, type SessionManager, SUMMARY_PREFIX, SUMMARY_SUFFIX, -} from "../session-manager.js"; -import type { SettingsManager } from "../settings-manager.js"; -import { getShellConfig, killProcessTree, sanitizeBinaryOutput } from "../shell.js"; -import { expandSlashCommand, type FileSlashCommand, loadSlashCommands } from "../slash-commands.js"; -import { getEditorTheme, getMarkdownTheme, onThemeChange, setTheme, theme } from "../theme/theme.js"; -import { DEFAULT_MAX_BYTES, type TruncationResult, truncateTail } from "../tools/truncate.js"; -import { AssistantMessageComponent } from "./assistant-message.js"; -import { BashExecutionComponent } from "./bash-execution.js"; -import { CompactionComponent } from "./compaction.js"; -import { CustomEditor } from "./custom-editor.js"; -import { DynamicBorder } from "./dynamic-border.js"; -import { FooterComponent } from "./footer.js"; -import { ModelSelectorComponent } from "./model-selector.js"; -import { OAuthSelectorComponent } from "./oauth-selector.js"; -import { QueueModeSelectorComponent } from "./queue-mode-selector.js"; -import { SessionSelectorComponent } from "./session-selector.js"; -import { ThemeSelectorComponent } from "./theme-selector.js"; -import { ThinkingSelectorComponent } from "./thinking-selector.js"; -import { ToolExecutionComponent } from "./tool-execution.js"; -import { UserMessageComponent } from "./user-message.js"; -import { UserMessageSelectorComponent } from "./user-message-selector.js"; +} from "../core/session-manager.js"; +import type { SettingsManager } from "../core/settings-manager.js"; +import { expandSlashCommand, type FileSlashCommand, loadSlashCommands } from "../core/slash-commands.js"; +import { DEFAULT_MAX_BYTES, type TruncationResult, truncateTail } from "../core/tools/truncate.js"; +import { AssistantMessageComponent } from "../modes/interactive/components/assistant-message.js"; +import { BashExecutionComponent } from "../modes/interactive/components/bash-execution.js"; +import { CompactionComponent } from "../modes/interactive/components/compaction.js"; +import { CustomEditor } from "../modes/interactive/components/custom-editor.js"; +import { DynamicBorder } from "../modes/interactive/components/dynamic-border.js"; +import { FooterComponent } from "../modes/interactive/components/footer.js"; +import { ModelSelectorComponent } from "../modes/interactive/components/model-selector.js"; +import { OAuthSelectorComponent } from "../modes/interactive/components/oauth-selector.js"; +import { QueueModeSelectorComponent } from "../modes/interactive/components/queue-mode-selector.js"; +import { SessionSelectorComponent } from "../modes/interactive/components/session-selector.js"; +import { ThemeSelectorComponent } from "../modes/interactive/components/theme-selector.js"; +import { ThinkingSelectorComponent } from "../modes/interactive/components/thinking-selector.js"; +import { ToolExecutionComponent } from "../modes/interactive/components/tool-execution.js"; +import { UserMessageComponent } from "../modes/interactive/components/user-message.js"; +import { UserMessageSelectorComponent } from "../modes/interactive/components/user-message-selector.js"; +import { getEditorTheme, getMarkdownTheme, onThemeChange, setTheme, theme } from "../modes/interactive/theme/theme.js"; +import { getChangelogPath, parseChangelog } from "../utils/changelog.js"; +import { copyToClipboard } from "../utils/clipboard.js"; +import { APP_NAME, getDebugLogPath, getModelsPath, getOAuthPath } from "../utils/config.js"; +import { getShellConfig, killProcessTree, sanitizeBinaryOutput } from "../utils/shell.js"; /** * TUI renderer for the coding agent diff --git a/packages/coding-agent/src/changelog.ts b/packages/coding-agent/src/utils/changelog.ts similarity index 100% rename from packages/coding-agent/src/changelog.ts rename to packages/coding-agent/src/utils/changelog.ts diff --git a/packages/coding-agent/src/clipboard.ts b/packages/coding-agent/src/utils/clipboard.ts similarity index 100% rename from packages/coding-agent/src/clipboard.ts rename to packages/coding-agent/src/utils/clipboard.ts diff --git a/packages/coding-agent/src/config.ts b/packages/coding-agent/src/utils/config.ts similarity index 100% rename from packages/coding-agent/src/config.ts rename to packages/coding-agent/src/utils/config.ts diff --git a/packages/coding-agent/src/fuzzy.ts b/packages/coding-agent/src/utils/fuzzy.ts similarity index 100% rename from packages/coding-agent/src/fuzzy.ts rename to packages/coding-agent/src/utils/fuzzy.ts diff --git a/packages/coding-agent/src/shell.ts b/packages/coding-agent/src/utils/shell.ts similarity index 98% rename from packages/coding-agent/src/shell.ts rename to packages/coding-agent/src/utils/shell.ts index 92ca6d17..85de9c12 100644 --- a/packages/coding-agent/src/shell.ts +++ b/packages/coding-agent/src/utils/shell.ts @@ -1,6 +1,6 @@ import { existsSync } from "node:fs"; import { spawn, spawnSync } from "child_process"; -import { SettingsManager } from "./settings-manager.js"; +import { SettingsManager } from "../core/settings-manager.js"; let cachedShellConfig: { shell: string; args: string[] } | null = null; diff --git a/packages/coding-agent/src/tools-manager.ts b/packages/coding-agent/src/utils/tools-manager.ts similarity index 100% rename from packages/coding-agent/src/tools-manager.ts rename to packages/coding-agent/src/utils/tools-manager.ts diff --git a/packages/coding-agent/test/compaction.test.ts b/packages/coding-agent/test/compaction.test.ts index 2af878db..afde511a 100644 --- a/packages/coding-agent/test/compaction.test.ts +++ b/packages/coding-agent/test/compaction.test.ts @@ -12,7 +12,7 @@ import { findCutPoint, getLastAssistantUsage, shouldCompact, -} from "../src/compaction.js"; +} from "../src/core/compaction.js"; import { type CompactionEntry, createSummaryMessage, @@ -20,7 +20,7 @@ import { parseSessionEntries, type SessionEntry, type SessionMessageEntry, -} from "../src/session-manager.js"; +} from "../src/core/session-manager.js"; // ============================================================================ // Test fixtures diff --git a/packages/coding-agent/test/fuzzy.test.ts b/packages/coding-agent/test/fuzzy.test.ts index 7975bf1c..c41ff3c4 100644 --- a/packages/coding-agent/test/fuzzy.test.ts +++ b/packages/coding-agent/test/fuzzy.test.ts @@ -1,5 +1,5 @@ import { describe, expect, test } from "vitest"; -import { fuzzyFilter, fuzzyMatch } from "../src/fuzzy.js"; +import { fuzzyFilter, fuzzyMatch } from "../src/utils/fuzzy.js"; describe("fuzzyMatch", () => { test("empty query matches everything with score 0", () => { diff --git a/packages/coding-agent/test/rpc.test.ts b/packages/coding-agent/test/rpc.test.ts index f3acdc99..d585a57a 100644 --- a/packages/coding-agent/test/rpc.test.ts +++ b/packages/coding-agent/test/rpc.test.ts @@ -6,8 +6,8 @@ import * as readline from "node:readline"; import { fileURLToPath } from "node:url"; import type { AgentEvent } from "@mariozechner/pi-agent-core"; import { afterEach, beforeEach, describe, expect, test } from "vitest"; -import type { BashExecutionMessage } from "../src/messages.js"; -import type { CompactionEntry } from "../src/session-manager.js"; +import type { BashExecutionMessage } from "../src/core/messages.js"; +import type { CompactionEntry } from "../src/core/session-manager.js"; const __dirname = dirname(fileURLToPath(import.meta.url)); diff --git a/packages/coding-agent/test/test-theme-colors.ts b/packages/coding-agent/test/test-theme-colors.ts index 12beb253..39aa3b8b 100644 --- a/packages/coding-agent/test/test-theme-colors.ts +++ b/packages/coding-agent/test/test-theme-colors.ts @@ -1,4 +1,4 @@ -import { initTheme, theme } from "../src/theme/theme.js"; +import { initTheme, theme } from "../src/modes/interactive/theme/theme.js"; // Initialize with dark theme explicitly process.env.COLORTERM = "truecolor"; diff --git a/packages/coding-agent/test/tools.test.ts b/packages/coding-agent/test/tools.test.ts index 9eeebd1e..91213774 100644 --- a/packages/coding-agent/test/tools.test.ts +++ b/packages/coding-agent/test/tools.test.ts @@ -2,13 +2,13 @@ import { mkdirSync, rmSync, writeFileSync } from "fs"; import { tmpdir } from "os"; import { join } from "path"; import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import { bashTool } from "../src/tools/bash.js"; -import { editTool } from "../src/tools/edit.js"; -import { findTool } from "../src/tools/find.js"; -import { grepTool } from "../src/tools/grep.js"; -import { lsTool } from "../src/tools/ls.js"; -import { readTool } from "../src/tools/read.js"; -import { writeTool } from "../src/tools/write.js"; +import { bashTool } from "../src/core/tools/bash.js"; +import { editTool } from "../src/core/tools/edit.js"; +import { findTool } from "../src/core/tools/find.js"; +import { grepTool } from "../src/core/tools/grep.js"; +import { lsTool } from "../src/core/tools/ls.js"; +import { readTool } from "../src/core/tools/read.js"; +import { writeTool } from "../src/core/tools/write.js"; // Helper to extract text from content blocks function getTextOutput(result: any): string {