deleting index.ts files

This commit is contained in:
2026-02-04 21:02:01 -05:00
parent f0609e423e
commit 74b0a0dbab
92 changed files with 385 additions and 2082 deletions

View File

@@ -1,6 +0,0 @@
/**
* Copilot API Auth - Token and Authentication
*/
export * from "./token";
export * from "./auth";

View File

@@ -1,6 +0,0 @@
/**
* Copilot API Core - Chat and Models API
*/
export * from "./chat";
export * from "./models";

View File

@@ -1,22 +0,0 @@
/**
* Copilot API exports
*/
export {
fetchCopilotToken,
buildCopilotHeaders,
} from "@api/copilot/auth/token";
export {
requestDeviceCode,
requestAccessToken,
} from "@api/copilot/auth/auth";
export { fetchModels } from "@api/copilot/core/models";
export {
getEndpoint,
buildRequestBody,
executeChatRequest,
executeStreamRequest,
} from "@api/copilot/core/chat";

View File

@@ -1,10 +0,0 @@
/**
* API Layer
*
* Low-level HTTP API calls for external services.
* Business logic should remain in providers/services.
*/
export * as copilotApi from "@api/copilot";
export * as ollamaApi from "@api/ollama";
export * as brainApi from "@api/brain";

View File

@@ -1,6 +0,0 @@
/**
* Ollama API Core - Chat and Models API
*/
export * from "./chat";
export * from "./models";

View File

@@ -1,13 +0,0 @@
/**
* Ollama API exports
*/
export {
executeChatRequest,
executeStreamRequest,
} from "@api/ollama/core/chat";
export {
fetchModels,
checkHealth,
} from "@api/ollama/core/models";

View File

@@ -6,14 +6,14 @@
* All business logic is delegated to chat-tui-service.ts
*/
import type { ChatServiceCallbacks } from "@services/chat-tui-service.ts";
import { onModeChange } from "@commands/components/callbacks/on-mode-change.ts";
import { onLog } from "@commands/components/callbacks/on-log.ts";
import { onToolCall } from "@commands/components/callbacks/on-tool-call.ts";
import { onToolResult } from "@commands/components/callbacks/on-tool-result.ts";
import { onPermissionRequest } from "@commands/components/callbacks/on-permission-request.ts";
import { onLearningDetected } from "@commands/components/callbacks/on-learning-detected.ts";
import executeCommand from "@commands/components/execute/index.ts";
import type { ChatServiceCallbacks } from "@services/chat-tui-service";
import { onModeChange } from "@commands/components/callbacks/on-mode-change";
import { onLog } from "@commands/components/callbacks/on-log";
import { onToolCall } from "@commands/components/callbacks/on-tool-call";
import { onToolResult } from "@commands/components/callbacks/on-tool-result";
import { onPermissionRequest } from "@commands/components/callbacks/on-permission-request";
import { onLearningDetected } from "@commands/components/callbacks/on-learning-detected";
import executeCommand from "@commands/components/execute/index";
export const createCallbacks = (): ChatServiceCallbacks => ({
onModeChange,

View File

@@ -1,7 +1,7 @@
import { v4 as uuidv4 } from "uuid";
import { appStore } from "@tui/index";
import type { LearningResponse } from "@/types/tui";
import type { LearningCandidate } from "@services/learning-service.ts";
import type { LearningCandidate } from "@services/learning-service";
export const onLearningDetected = async (
candidate: LearningCandidate,

View File

@@ -1,4 +1,4 @@
import { appStore } from "@tui/index.ts";
import { appStore } from "@tui/index";
import type { LogType } from "@/types/log";
export const onLog = (

View File

@@ -1,4 +1,4 @@
import { appStore } from "@tui/index.ts";
import { appStore } from "@tui/index";
export const onModeChange = (mode: string): void => {
appStore.setMode(mode as Parameters<typeof appStore.setMode>[0]);

View File

@@ -1,6 +1,6 @@
import { appStore } from "@tui/index.ts";
import { appStore } from "@tui/index";
import { isQuietTool } from "@utils/core/tools";
import type { ToolCallParams } from "@interfaces/ToolCallParams.ts";
import type { ToolCallParams } from "@interfaces/ToolCallParams";
export const onToolCall = (call: ToolCallParams): void => {
appStore.setCurrentToolCall({

View File

@@ -1,9 +1,6 @@
import { appStore } from "@tui/index.ts";
import {
truncateOutput,
detectDiffContent,
} from "@services/chat-tui-service.ts";
import { getThinkingMessage } from "@constants/status-messages.ts";
import { appStore } from "@tui/index";
import { truncateOutput, detectDiffContent } from "@services/chat-tui-service";
import { getThinkingMessage } from "@constants/status-messages";
export const onToolResult = (
success: boolean,

View File

@@ -1,5 +1,5 @@
import chalk from "chalk";
import type { ChatState } from "./state.ts";
import type { ChatState } from "./state";
export const createCleanup = (state: ChatState) => (): void => {
state.isRunning = false;

View File

@@ -1,5 +1,5 @@
import chalk from "chalk";
import { HELP_COMMANDS } from "@constants/help-commands.ts";
import { HELP_COMMANDS } from "@constants/help-commands";
export const showHelp = (): void => {
console.log("\n" + chalk.bold.underline("Commands") + "\n");

View File

@@ -1,5 +1,9 @@
import chalk from "chalk";
import { infoMessage, errorMessage, warningMessage } from "@utils/core/terminal";
import {
infoMessage,
errorMessage,
warningMessage,
} from "@utils/core/terminal";
import {
createSession,
loadSession,
@@ -9,7 +13,7 @@ import {
} from "@services/core/session";
import { getConfig } from "@services/core/config";
import type { Provider as ProviderName, ChatSession } from "@/types/index";
import { getProvider, getProviderStatus } from "@providers/index.ts";
import { getProvider, getProviderStatus } from "@providers/index";
import {
printWelcome,
formatTipLine,
@@ -20,16 +24,16 @@ import {
import {
DEFAULT_SYSTEM_PROMPT,
buildSystemPromptWithRules,
} from "@prompts/index.ts";
import type { ChatOptions } from "@interfaces/ChatOptions.ts";
} from "@prompts/index";
import type { ChatOptions } from "@interfaces/ChatOptions";
import { createInitialState, type ChatState } from "./state.ts";
import { restoreMessagesFromSession } from "./session/restore-messages.ts";
import { addContextFile } from "./context/add-context-file.ts";
import { handleCommand } from "./commands/handle-command.ts";
import { handleInput } from "./messages/handle-input.ts";
import { executePrintMode } from "./print-mode.ts";
import { createCleanup } from "./cleanup.ts";
import { createInitialState, type ChatState } from "./state";
import { restoreMessagesFromSession } from "./session/restore-messages";
import { addContextFile } from "./context/add-context-file";
import { handleCommand } from "./commands/handle-command";
import { handleInput } from "./messages/handle-input";
import { executePrintMode } from "./print-mode";
import { createCleanup } from "./cleanup";
export const execute = async (options: ChatOptions): Promise<void> => {
const config = await getConfig();
@@ -221,4 +225,4 @@ export const execute = async (options: ChatOptions): Promise<void> => {
}
};
export { createInitialState, type ChatState } from "./state.ts";
export { createInitialState, type ChatState } from "./state";

View File

@@ -1,6 +0,0 @@
/**
* MCP chat commands
*/
export { showMCPStatus } from "@commands/components/chat/mcp/show-mcp-status";
export { handleMCP } from "@commands/components/chat/mcp/handle-mcp";

View File

@@ -1,6 +1,6 @@
import chalk from "chalk";
import type { Provider as ProviderName } from "@/types/index";
import { getProvider } from "@providers/index.ts";
import { getProvider } from "@providers/index";
export const showModels = async (
currentProvider: ProviderName,

View File

@@ -1,5 +1,5 @@
import { getConfig } from "@services/core/config";
import { displayProvidersStatus } from "@providers/index.ts";
import { displayProvidersStatus } from "@providers/index";
export const showProviders = async (): Promise<void> => {
const config = await getConfig();

View File

@@ -5,9 +5,9 @@ import {
errorMessage,
} from "@utils/core/terminal";
import { getConfig } from "@services/core/config";
import { getProvider } from "@providers/index.ts";
import { showModels } from "./show-models.ts";
import type { ChatState } from "../state.ts";
import { getProvider } from "@providers/index";
import { showModels } from "./show-models";
import type { ChatState } from "../state";
export const switchModel = async (
modelName: string,

View File

@@ -10,8 +10,8 @@ import {
getProvider,
getProviderStatus,
getDefaultModel,
} from "@providers/index.ts";
import type { ChatState } from "../state.ts";
} from "@providers/index";
import type { ChatState } from "../state";
export const switchProvider = async (
providerName: string,

View File

@@ -1,5 +1,5 @@
import type { ChatSession } from "@/types/index";
import type { Message } from "@providers/index.ts";
import type { Message } from "@providers/index";
export const restoreMessagesFromSession = (
session: ChatSession,

View File

@@ -1,4 +1,6 @@
import { tui, appStore } from "@tui/index";
import { tui, appStore } from "@tui/app";
import { appStore } from "@tui-solid/context/app";
import { getProviderInfo } from "@services/chat-tui-service";
import { addServer, connectServer } from "@services/mcp/index";
import * as brainService from "@services/brain";
@@ -121,7 +123,9 @@ const defaultHandleMCPAdd = async (data: MCPAddFormData): Promise<void> => {
}
};
const defaultHandleBrainSetJwtToken = async (jwtToken: string): Promise<void> => {
const defaultHandleBrainSetJwtToken = async (
jwtToken: string,
): Promise<void> => {
await brainService.setJwtToken(jwtToken);
const connected = await brainService.connect();
if (connected) {
@@ -187,7 +191,8 @@ export const renderApp = async (props: RenderAppProps): Promise<void> => {
onMCPAdd: props.handleMCPAdd ?? defaultHandleMCPAdd,
onPermissionResponse: props.handlePermissionResponse ?? (() => {}),
onLearningResponse: props.handleLearningResponse ?? (() => {}),
onBrainSetJwtToken: props.handleBrainSetJwtToken ?? defaultHandleBrainSetJwtToken,
onBrainSetJwtToken:
props.handleBrainSetJwtToken ?? defaultHandleBrainSetJwtToken,
onBrainSetApiKey: props.handleBrainSetApiKey ?? defaultHandleBrainSetApiKey,
onBrainLogout: props.handleBrainLogout ?? defaultHandleBrainLogout,
plan: props.plan,

View File

@@ -1,6 +0,0 @@
/**
* Commands Core - Main command handling
*/
export * from "./runner";
export * from "./handlers";

View File

@@ -2,6 +2,28 @@
* Background task constants
*/
import { BackgroundTaskPriority } from "@/types/background-task";
import { BackgroundTaskConfig } from "@interfaces/BackgroundTask";
export const DEFAULT_BACKGROUND_TASK_CONFIG: BackgroundTaskConfig = {
maxConcurrent: 3,
defaultTimeout: 300000, // 5 minutes
retryOnFailure: false,
maxRetries: 1,
notifyOnComplete: true,
persistTasks: true,
};
export const BACKGROUND_TASK_PRIORITIES: Record<
BackgroundTaskPriority,
number
> = {
low: 1,
normal: 5,
high: 10,
};
export const BACKGROUND_TASK = {
MAX_CONCURRENT: 3,
DEFAULT_TIMEOUT: 300000, // 5 minutes

View File

@@ -0,0 +1,87 @@
import {
BackgroundTaskPriority,
BackgroundTaskStatus,
} from "@/types/background-task";
export interface BackgroundTask {
readonly id: string;
readonly name: string;
readonly description: string;
readonly status: BackgroundTaskStatus;
readonly priority: BackgroundTaskPriority;
readonly createdAt: number;
readonly startedAt?: number;
readonly completedAt?: number;
readonly progress: TaskProgress;
readonly result?: TaskResult;
readonly error?: TaskError;
readonly metadata: TaskMetadata;
}
export interface TaskProgress {
readonly current: number;
readonly total: number;
readonly percentage: number;
readonly message: string;
readonly steps: ReadonlyArray<TaskStep>;
}
export interface TaskStep {
readonly name: string;
readonly status: BackgroundTaskStatus;
readonly startedAt?: number;
readonly completedAt?: number;
readonly output?: string;
}
export interface TaskResult {
readonly success: boolean;
readonly output: string;
readonly artifacts: ReadonlyArray<TaskArtifact>;
readonly summary: string;
}
export interface TaskArtifact {
readonly type: "file" | "diff" | "report" | "data";
readonly name: string;
readonly path?: string;
readonly content?: string;
}
export interface TaskError {
readonly code: string;
readonly message: string;
readonly stack?: string;
readonly recoverable: boolean;
}
export interface TaskMetadata {
readonly sessionId: string;
readonly agentId?: string;
readonly prompt?: string;
readonly tools: ReadonlyArray<string>;
readonly startedByUser: boolean;
}
export interface BackgroundTaskConfig {
readonly maxConcurrent: number;
readonly defaultTimeout: number;
readonly retryOnFailure: boolean;
readonly maxRetries: number;
readonly notifyOnComplete: boolean;
readonly persistTasks: boolean;
}
export interface TaskNotification {
readonly taskId: string;
readonly type: "started" | "progress" | "completed" | "failed";
readonly message: string;
readonly timestamp: number;
}
export interface BackgroundTaskStore {
readonly tasks: ReadonlyMap<string, BackgroundTask>;
readonly queue: ReadonlyArray<string>;
readonly running: ReadonlyArray<string>;
readonly completed: ReadonlyArray<string>;
}

120
src/interfaces/index.ts Normal file
View File

@@ -0,0 +1,120 @@
import { AgentType, IntentType, Provider } from "@/types/index";
export interface TuiInput {
sessionId?: string;
initialPrompt?: string;
provider?: string;
model?: string;
theme?: string;
workingDirectory?: string;
availableModels?: ProviderModel[];
cascadeEnabled?: boolean;
}
export interface TuiOutput {
exitCode: number;
sessionId?: string;
}
export interface Config {
provider: Provider;
model?: string;
theme?: string;
maxIterations: number;
timeout: number;
protectedPaths: string[];
systemPrompt?: string;
cascadeEnabled?: boolean;
}
export interface IntentRequest {
prompt: string;
context?: string;
files?: string[];
}
export interface IntentResponse {
intent: IntentType;
confidence: number;
reasoning: string;
needsClarification: boolean;
clarificationQuestions?: string[];
}
export interface PlanStep {
id: string;
type: "read" | "edit" | "create" | "delete" | "execute";
description: string;
file?: string;
dependencies?: string[];
tool?: string;
args?: Record<string, unknown>;
}
export interface ExecutionPlan {
steps: PlanStep[];
intent: IntentType;
summary: string;
estimatedTime?: number;
}
export interface ValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
protectedPaths: string[];
}
export interface ChatMessage {
role: "user" | "assistant" | "system";
content: string;
timestamp: number;
}
export interface ChatSession {
id: string;
agent: AgentType;
messages: ChatMessage[];
contextFiles: string[];
createdAt: number;
updatedAt: number;
}
export interface CommandOptions {
agent?: AgentType;
model?: string;
files?: string[];
dryRun?: boolean;
maxIterations?: number;
autoApprove?: boolean;
task?: string;
prompt?: string;
context?: string;
intent?: IntentType;
output?: string;
planFile?: string;
action?: string;
key?: string;
value?: string;
}
export interface ToolResult {
success: boolean;
output?: string;
error?: string;
files?: string[];
}
export interface FileEdit {
file: string;
search: string;
replace: string;
description?: string;
}
export interface TerminalSpinner {
start(text: string): void;
succeed(text: string): void;
fail(text: string): void;
stop(): void;
}

View File

@@ -1,124 +0,0 @@
/**
* Prompts Index
*
* Centralized exports for all system prompts.
*/
// System prompts
export { DEFAULT_SYSTEM_PROMPT } from "@prompts/system/default";
export { AGENTIC_SYSTEM_PROMPT, buildAgenticPrompt } from "@prompts/system/agent";
export { ASK_SYSTEM_PROMPT, buildAskPrompt } from "@prompts/system/ask";
export { PLAN_SYSTEM_PROMPT } from "@prompts/system/planner";
export {
DEBUGGING_SYSTEM_PROMPT,
DEBUGGING_CONTEXT_TEMPLATE,
} from "@prompts/system/debugging";
export {
CODE_REVIEW_SYSTEM_PROMPT,
CODE_REVIEW_CONTEXT_TEMPLATE,
buildCodeReviewPrompt,
} from "@prompts/system/code-review";
export {
REFACTORING_SYSTEM_PROMPT,
REFACTORING_CONTEXT_TEMPLATE,
} from "@prompts/system/refactoring";
export {
MEMORY_SYSTEM_PROMPT,
MEMORY_CONTEXT_TEMPLATE,
MEMORY_RETRIEVAL_PROMPT,
} from "@prompts/system/memory";
// Environment template
export { ENVIRONMENT_PROMPT_TEMPLATE } from "@prompts/system/environment";
// Environment service (logic moved to services)
export {
buildEnvironmentPrompt,
getEnvironmentContext,
type EnvironmentContext,
} from "@services/environment-service";
// Debugging service
export {
detectDebuggingRequest,
buildDebuggingContext,
getDebuggingPrompt,
enhancePromptForDebugging,
type DebugContext,
type DebugType,
} from "@services/debugging-service";
// Code review service
export {
detectCodeReviewRequest,
buildCodeReviewContext,
getCodeReviewPrompt,
enhancePromptForCodeReview,
type CodeReviewContext,
type ReviewType,
type ReviewFocusArea,
} from "@services/code-review-service";
// Refactoring service
export {
detectRefactoringRequest,
buildRefactoringContext,
getRefactoringPrompt,
enhancePromptForRefactoring,
type RefactoringContext,
type RefactoringType,
type RefactoringGoal,
} from "@services/refactoring-service";
// Memory service
export {
detectMemoryCommand,
storeMemory,
getMemories,
findMemories,
getRelevantMemories,
buildMemoryContext,
buildRelevantMemoryPrompt,
getMemoryPrompt,
processMemoryCommand,
type MemoryContext,
type MemoryCommandType,
type MemoryCategory,
} from "@services/memory-service";
// Tool instructions
export {
BASH_TOOL_INSTRUCTIONS,
READ_TOOL_INSTRUCTIONS,
WRITE_TOOL_INSTRUCTIONS,
EDIT_TOOL_INSTRUCTIONS,
GLOB_TOOL_INSTRUCTIONS,
GREP_TOOL_INSTRUCTIONS,
ALL_TOOL_INSTRUCTIONS,
} from "@prompts/system/tools";
// Git instructions
export {
GIT_COMMIT_INSTRUCTIONS,
GIT_PR_INSTRUCTIONS,
} from "@prompts/system/git";
// UI prompts
export { HELP_TEXT, COMMAND_DESCRIPTIONS } from "@prompts/ui/help";
// Re-export rules utilities for backwards compatibility
export {
loadProjectRules,
buildSystemPromptWithRules,
getRulesForCategory,
} from "@services/rules-service";
export { MCP_CATEGORIES, TOOL_CATEGORIES } from "@constants/rules";
export type {
ProjectRules,
RuleFile,
RuleCategory,
MCPCategory,
ToolCategory,
} from "@/types/rules";

View File

@@ -1,7 +0,0 @@
/**
* Copilot Provider Auth - Authentication and Credentials
*/
export * from "./auth";
export * from "./token";
export * from "./credentials";

View File

@@ -1,6 +0,0 @@
/**
* Copilot Provider Core - Chat and Models
*/
export * from "./chat";
export * from "./models";

View File

@@ -1,8 +0,0 @@
/**
* Providers Core - Common provider functionality
*/
export * from "./registry";
export * from "./chat";
export * from "./credentials";
export * from "./status";

View File

@@ -1,46 +0,0 @@
/**
* Provider manager for CodeTyper CLI
* Handles provider selection, authentication, and credential management
*/
// Re-export types
export * from "@/types/providers";
// Re-export registry functions
export {
getProvider,
getAllProviders,
getProviderNames,
isValidProvider,
} from "@providers/core/registry";
// Re-export status functions
export { getProviderStatus, displayProvidersStatus } from "@providers/core/status";
// Re-export login functions
export {
loginProvider,
logoutProvider,
initializeProviders,
completeCopilotLogin,
} from "@providers/login";
// Re-export chat functions
export { chat, chatStream, getDefaultModel, getModels } from "@providers/core/chat";
// Re-export copilot-specific functions
export {
initiateDeviceFlow,
pollForAccessToken,
getCopilotUserInfo as getCopilotUserInfoFn,
} from "@providers/copilot";
// Re-export getCopilotUserInfo with consistent naming
export const getCopilotUserInfo = async (): Promise<{
login: string;
name?: string;
email?: string;
} | null> => {
const { getCopilotUserInfo: fn } = await import("@providers/copilot");
return fn();
};

View File

@@ -1,5 +0,0 @@
/**
* Login Core - Initialization
*/
export * from "./initialize";

View File

@@ -1,6 +0,0 @@
/**
* Ollama Provider Core - Chat and Models
*/
export * from "./chat";
export * from "./models";

View File

@@ -10,24 +10,35 @@ import { existsSync } from "node:fs";
import { homedir } from "node:os";
import type {
BackgroundTask,
BackgroundTaskStatus,
BackgroundTaskPriority,
} from "@/types/background-task";
import {
BackgroundTask,
BackgroundTaskConfig,
TaskProgress,
TaskResult,
TaskError,
TaskMetadata,
TaskNotification,
} from "@/types/background-task";
import { DEFAULT_BACKGROUND_TASK_CONFIG, BACKGROUND_TASK_PRIORITIES } from "@/types/background-task";
} from "@interfaces/BackgroundTask";
import {
DEFAULT_BACKGROUND_TASK_CONFIG,
BACKGROUND_TASK_PRIORITIES,
} from "@constants/background-task";
import {
BACKGROUND_TASK_STORAGE,
BACKGROUND_TASK_MESSAGES,
BACKGROUND_TASK_STATUS_ICONS,
} from "@constants/background-task";
type TaskHandler = (task: BackgroundTask, updateProgress: (progress: Partial<TaskProgress>) => void) => Promise<TaskResult>;
type TaskHandler = (
task: BackgroundTask,
updateProgress: (progress: Partial<TaskProgress>) => void,
) => Promise<TaskResult>;
type NotificationHandler = (notification: TaskNotification) => void;
interface BackgroundTaskState {
@@ -64,12 +75,18 @@ const persistTask = async (task: BackgroundTask): Promise<void> => {
if (!state.config.persistTasks) return;
await ensureStorageDirectory();
const filePath = join(getStoragePath(), `${task.id}${BACKGROUND_TASK_STORAGE.FILE_EXTENSION}`);
const filePath = join(
getStoragePath(),
`${task.id}${BACKGROUND_TASK_STORAGE.FILE_EXTENSION}`,
);
await writeFile(filePath, JSON.stringify(task, null, 2));
};
const removePersistedTask = async (taskId: string): Promise<void> => {
const filePath = join(getStoragePath(), `${taskId}${BACKGROUND_TASK_STORAGE.FILE_EXTENSION}`);
const filePath = join(
getStoragePath(),
`${taskId}${BACKGROUND_TASK_STORAGE.FILE_EXTENSION}`,
);
if (existsSync(filePath)) {
await unlink(filePath);
}
@@ -80,7 +97,9 @@ const loadPersistedTasks = async (): Promise<void> => {
if (!existsSync(storagePath)) return;
const files = await readdir(storagePath);
const taskFiles = files.filter((f) => f.endsWith(BACKGROUND_TASK_STORAGE.FILE_EXTENSION));
const taskFiles = files.filter((f) =>
f.endsWith(BACKGROUND_TASK_STORAGE.FILE_EXTENSION),
);
for (const file of taskFiles) {
try {
@@ -104,7 +123,11 @@ const loadPersistedTasks = async (): Promise<void> => {
}
};
const notify = (taskId: string, type: TaskNotification["type"], message: string): void => {
const notify = (
taskId: string,
type: TaskNotification["type"],
message: string,
): void => {
const notification: TaskNotification = {
taskId,
type,
@@ -133,7 +156,10 @@ const processQueue = async (): Promise<void> => {
const taskA = state.tasks.get(a);
const taskB = state.tasks.get(b);
if (!taskA || !taskB) return 0;
return BACKGROUND_TASK_PRIORITIES[taskB.priority] - BACKGROUND_TASK_PRIORITIES[taskA.priority];
return (
BACKGROUND_TASK_PRIORITIES[taskB.priority] -
BACKGROUND_TASK_PRIORITIES[taskA.priority]
);
});
const taskId = state.queue.shift();
@@ -176,9 +202,10 @@ const executeTask = async (task: BackgroundTask): Promise<void> => {
const newProgress: TaskProgress = {
...currentTask.progress,
...partial,
percentage: partial.current !== undefined && partial.total !== undefined
? Math.round((partial.current / partial.total) * 100)
: currentTask.progress.percentage,
percentage:
partial.current !== undefined && partial.total !== undefined
? Math.round((partial.current / partial.total) * 100)
: currentTask.progress.percentage,
};
const progressTask: BackgroundTask = {
@@ -194,7 +221,10 @@ const executeTask = async (task: BackgroundTask): Promise<void> => {
const result = await Promise.race([
handler(updatedTask, updateProgress),
new Promise<never>((_, reject) =>
setTimeout(() => reject(new Error("Task timeout")), state.config.defaultTimeout)
setTimeout(
() => reject(new Error("Task timeout")),
state.config.defaultTimeout,
),
),
]);
@@ -214,7 +244,10 @@ const executeTask = async (task: BackgroundTask): Promise<void> => {
}
};
const completeTask = async (taskId: string, result: TaskResult): Promise<void> => {
const completeTask = async (
taskId: string,
result: TaskResult,
): Promise<void> => {
const task = state.tasks.get(taskId);
if (!task) return;
@@ -240,7 +273,7 @@ const completeTask = async (taskId: string, result: TaskResult): Promise<void> =
const updateTaskStatus = async (
taskId: string,
status: BackgroundTaskStatus,
error?: TaskError
error?: TaskError,
): Promise<void> => {
const task = state.tasks.get(taskId);
if (!task) return;
@@ -249,7 +282,9 @@ const updateTaskStatus = async (
...task,
status,
error,
completedAt: ["completed", "failed", "cancelled"].includes(status) ? Date.now() : undefined,
completedAt: ["completed", "failed", "cancelled"].includes(status)
? Date.now()
: undefined,
};
state.tasks.set(taskId, updatedTask);
@@ -262,7 +297,9 @@ const updateTaskStatus = async (
// Public API
export const initialize = async (config?: Partial<BackgroundTaskConfig>): Promise<void> => {
export const initialize = async (
config?: Partial<BackgroundTaskConfig>,
): Promise<void> => {
state.config = { ...DEFAULT_BACKGROUND_TASK_CONFIG, ...config };
await loadPersistedTasks();
processQueue();
@@ -272,10 +309,12 @@ export const registerHandler = (name: string, handler: TaskHandler): void => {
state.handlers.set(name, handler);
};
export const onNotification = (handler: NotificationHandler): () => void => {
export const onNotification = (handler: NotificationHandler): (() => void) => {
state.notificationHandlers.push(handler);
return () => {
state.notificationHandlers = state.notificationHandlers.filter((h) => h !== handler);
state.notificationHandlers = state.notificationHandlers.filter(
(h) => h !== handler,
);
};
};
@@ -283,7 +322,7 @@ export const createTask = async (
name: string,
description: string,
metadata: TaskMetadata,
priority: BackgroundTaskPriority = "normal"
priority: BackgroundTaskPriority = "normal",
): Promise<BackgroundTask> => {
const task: BackgroundTask = {
id: randomUUID(),
@@ -349,7 +388,9 @@ export const resumeTask = async (taskId: string): Promise<boolean> => {
export const getTask = (taskId: string): BackgroundTask | undefined =>
state.tasks.get(taskId);
export const listTasks = (filter?: { status?: BackgroundTaskStatus }): ReadonlyArray<BackgroundTask> => {
export const listTasks = (filter?: {
status?: BackgroundTaskStatus;
}): ReadonlyArray<BackgroundTask> => {
let tasks = Array.from(state.tasks.values());
if (filter?.status) {
@@ -361,7 +402,10 @@ export const listTasks = (filter?: { status?: BackgroundTaskStatus }): ReadonlyA
export const clearCompletedTasks = async (): Promise<number> => {
const completed = Array.from(state.tasks.values()).filter(
(t) => t.status === "completed" || t.status === "failed" || t.status === "cancelled"
(t) =>
t.status === "completed" ||
t.status === "failed" ||
t.status === "cancelled",
);
for (const task of completed) {
@@ -377,7 +421,8 @@ export const getTaskStatusIcon = (status: BackgroundTaskStatus): string =>
export const formatTaskSummary = (task: BackgroundTask): string => {
const icon = getTaskStatusIcon(task.status);
const progress = task.status === "running" ? ` (${task.progress.percentage}%)` : "";
const progress =
task.status === "running" ? ` (${task.progress.percentage}%)` : "";
return `${icon} ${task.name}${progress} - ${task.description}`;
};

View File

@@ -1,22 +0,0 @@
/**
* Cascading Provider Service
*
* Orchestrates multi-provider cascading with quality learning
*/
export {
checkOllamaAvailability,
checkCopilotAvailability,
getProviderStatuses,
clearProviderCache,
invalidateProvider,
type ProviderStatus,
} from "./availability";
export {
executeCascade,
recordUserFeedback,
type CascadeCallbacks,
type CascadeOptions,
type ProviderCallFn,
} from "./orchestrator";

View File

@@ -1,91 +0,0 @@
/**
* Services Core - Core service exports
*/
// Agent
export {
runAgentLoop,
runAgent,
createAgent,
type AgentOptions,
type AgentResult,
} from "./agent";
// Permissions
export {
setWorkingDir as setPermissionsWorkingDir,
setPermissionHandler,
initializePermissions,
parsePattern,
matchesBashPattern,
matchesPathPattern,
isBashAllowed,
isBashDenied,
isFileOpAllowed,
generateBashPattern,
addSessionPattern,
addGlobalPattern,
addLocalPattern,
listPatterns,
clearSessionPatterns,
promptBashPermission,
promptFilePermission,
promptPermission,
getPermissionLevel,
type ToolType,
type PermissionPattern,
type PermissionsConfig,
type PermissionHandler,
} from "./permissions";
// Session
export {
createSession,
loadSession,
saveSession,
addMessage,
addContextFile,
removeContextFile,
getCurrentSession,
listSessions,
deleteSession,
clearMessages,
getMostRecentSession,
getSessionSummaries,
findSession,
setWorkingDirectory,
type SessionInfo,
} from "./session";
// Executor
export {
setWorkingDir as setExecutorWorkingDir,
getWorkingDir,
executeCommand,
executeStreamingCommand,
readFile,
writeFile,
editFile,
deleteFile,
createDirectory,
listDirectory,
pathExists,
getStats,
type ExecutionResult,
type FileOperation,
} from "./executor";
// Config
export {
loadConfig,
saveConfig,
getConfigValue,
setConfigValue,
getAllConfig,
getApiKey,
getModel,
getConfigPath,
isProtectedPath,
resetConfig,
getConfig,
} from "./config";

View File

@@ -1,10 +1,7 @@
/**
* Session management for persisting chat history
*/
import fs from "fs/promises";
import path from "path";
import type { ChatSession, ChatMessage, AgentType } from "@/types/index";
import type { AgentType } from "@/types/common";
import { ChatSession, ChatMessage, AgentType } from "@interafaces/index";
import type { SessionInfo } from "@/types/session";
import { DIRS } from "@constants/paths";

View File

@@ -4,12 +4,19 @@
* Main orchestrator for the 7-phase feature development workflow.
*/
import { PHASE_ORDER, FEATURE_DEV_CONFIG, FEATURE_DEV_ERRORS } from "@constants/feature-dev";
import {
PHASE_ORDER,
FEATURE_DEV_CONFIG,
FEATURE_DEV_ERRORS,
} from "@constants/feature-dev";
import {
executePhase,
validateTransition,
} from "@services/feature-dev/phase-executor";
import { buildWorkflowSummary, extractKeyInfo } from "@services/feature-dev/context-builder";
import {
buildWorkflowSummary,
extractKeyInfo,
} from "@services/feature-dev/context-builder";
import type {
FeatureDevPhase,
FeatureDevState,
@@ -18,11 +25,6 @@ import type {
CheckpointDecision,
} from "@/types/feature-dev";
// Re-export sub-modules
export * from "@services/feature-dev/phase-executor";
export * from "@services/feature-dev/checkpoint-handler";
export * from "@services/feature-dev/context-builder";
// Active workflows storage
const activeWorkflows = new Map<string, FeatureDevState>();
@@ -179,10 +181,11 @@ export const runWorkflow = async (
};
}
state = updateWorkflow(workflowId, {
phase: result.nextPhase,
phaseStatus: "pending",
}) ?? state;
state =
updateWorkflow(workflowId, {
phase: result.nextPhase,
phaseStatus: "pending",
}) ?? state;
ctx.state = state;
} else {
// No next phase, workflow complete
@@ -201,7 +204,9 @@ export const runWorkflow = async (
*/
export const getWorkflowProgress = (
workflowId: string,
): { summary: string; keyInfo: Record<string, string | number> } | undefined => {
):
| { summary: string; keyInfo: Record<string, string | number> }
| undefined => {
const workflow = getWorkflow(workflowId);
if (!workflow) return undefined;

View File

@@ -1,43 +0,0 @@
/**
* GitHub PR Service
*
* Service for interacting with GitHub Pull Requests using the gh CLI.
*/
export { checkGitHubCLI, clearCLIStatusCache, executeGHCommand } from "@services/github-pr/cli";
export {
parsePRUrl,
containsPRUrl,
extractPRUrls,
buildPRUrl,
} from "@services/github-pr/url";
export {
fetchPR,
fetchPRComments,
fetchPRReviews,
fetchPRDiff,
getDefaultBranch,
getCurrentBranch,
getBranchDiff,
} from "@services/github-pr/fetch";
export {
formatPRContext,
formatPRComments,
formatPRReviews,
formatPRDiffSummary,
formatCommentForSolving,
formatPendingComments,
} from "@services/github-pr/format";
export type {
GitHubPR,
GitHubPRComment,
GitHubPRReview,
GitHubPRDiff,
GitHubPRFile,
GitHubCLIStatus,
PRUrlParts,
} from "@/types/github-pr";

View File

@@ -1,15 +0,0 @@
/**
* Services Module - Business logic extracted from UI components
*/
// Feature services
export * from "@services/file-picker-service";
export * from "@services/chat-tui-service";
export * from "@services/github-issue-service";
export * from "@services/command-suggestion-service";
export * from "@services/learning-service";
export * from "@services/rules-service";
export * as brainService from "@services/brain";
// Note: Core services (agent, permissions, session, executor, config) are imported
// directly from @services/core/* to avoid naming conflicts with chat-tui-service

View File

@@ -1,67 +0,0 @@
/**
* Learning Service Exports
*
* Central export point for all learning-related functionality
*/
// Core persistence
export {
saveLearning,
getLearnings,
learningExists,
} from "@services/learning/persistence";
// Embedding service
export {
initializeEmbeddingService,
embed,
embedBatch,
isEmbeddingAvailable,
getEmbeddingModel,
getEmbeddingError,
getServiceState,
resetEmbeddingService,
} from "@services/learning/embeddings";
// Vector store
export {
cosineSimilarity,
euclideanDistance,
loadIndex,
saveIndex,
upsertEmbedding,
removeEmbedding,
hasEmbedding,
getEmbedding,
findSimilar,
findAboveThreshold,
getIndexStats,
} from "@services/learning/vector-store";
// Semantic search
export {
indexLearning,
unindexLearning,
isLearningIndexed,
searchLearnings,
rebuildIndex,
clearIndexCache,
getIndexStatistics,
} from "@services/learning/semantic-search";
// Re-export types
export type {
StoredLearning,
LearningCandidate,
LearningCategory,
} from "@/types/learning";
export type {
EmbeddingVector,
EmbeddingResult,
EmbeddingIndex,
StoredEmbedding,
SimilarityResult,
SemanticSearchResult,
SemanticSearchOptions,
} from "@/types/embeddings";

View File

@@ -1,62 +0,0 @@
/**
* MCP Service - Model Context Protocol integration
*
* Provides connectivity to MCP servers for extensible tool integration.
*/
export { MCPClient } from "@services/mcp/client";
export {
initializeMCP,
loadMCPConfig,
saveMCPConfig,
connectServer,
disconnectServer,
connectAllServers,
disconnectAllServers,
getServerInstances,
getAllTools,
callTool,
addServer,
removeServer,
getMCPConfig,
isMCPAvailable,
} from "@services/mcp/manager";
export type {
MCPConfig,
MCPServerConfig,
MCPServerInstance,
MCPToolDefinition,
MCPResourceDefinition,
MCPToolCallRequest,
MCPToolCallResult,
MCPConnectionState,
MCPTransportType,
MCPManagerState,
} from "@/types/mcp";
// Registry exports
export {
getAllServers,
getCuratedServers,
searchServers,
getServerById,
getServersByCategory,
isServerInstalled,
installServer,
installServerById,
getPopularServers,
getVerifiedServers,
getCategoriesWithCounts,
refreshRegistry,
clearRegistryCache,
} from "@services/mcp/registry";
export type {
MCPRegistryServer,
MCPSearchResult,
MCPSearchOptions,
MCPInstallResult,
MCPServerCategory,
} from "@/types/mcp-registry";

View File

@@ -1,75 +0,0 @@
/**
* Permission System Index
*
* Provides optimized permission checking with cached patterns and indexed lookups.
* Maintains backward compatibility with existing API.
*/
// Re-export optimized implementation
export {
initializePermissions,
resetPermissions,
setWorkingDir,
setPermissionHandler,
isBashAllowed,
isBashDenied,
isFileOpAllowed,
addSessionPattern,
addGlobalPattern,
addLocalPattern,
listPatterns,
clearSessionPatterns,
getPermissionStats,
generateBashPattern,
generateFilePattern,
parsePattern,
matchesBashPattern,
matchesPathPattern,
promptBashPermission,
promptFilePermission,
promptPermission,
getPermissionLevel,
} from "@services/permissions/optimized";
// Re-export pattern cache utilities
export {
clearPatternCache,
getCacheStats,
warmCache,
} from "@services/permissions/pattern-cache";
// Re-export pattern index utilities
export {
buildPatternIndex,
addToIndex,
removeFromIndex,
getPatternsForTool,
hasPattern,
getRawPatterns,
mergeIndexes,
getIndexStats,
type PatternIndex,
type PatternEntry,
type IndexStats,
} from "@services/permissions/pattern-index";
// Re-export matchers
export {
isBashAllowedByIndex,
findMatchingBashPatterns,
extractCommandPrefix,
isFileOpAllowedByIndex,
findMatchingFilePatterns,
normalizePath,
isPathInDirectory,
} from "@services/permissions/matchers";
// Re-export types
export type {
ToolType,
PermissionPattern,
PermissionsConfig,
PermissionPromptRequest,
PermissionPromptResponse,
PermissionHandler,
} from "@/types/permissions";

View File

@@ -1,23 +0,0 @@
/**
* Permission Matchers Index
*
* Re-exports all matchers for convenient access
*/
export {
matchesBashPattern,
isBashAllowedByIndex,
findMatchingBashPatterns,
generateBashPattern,
extractCommandPrefix,
} from "@services/permissions/matchers/bash";
export {
matchesPathPattern,
matchesFilePattern,
isFileOpAllowedByIndex,
findMatchingFilePatterns,
generateFilePattern,
normalizePath,
isPathInDirectory,
} from "@services/permissions/matchers/path";

View File

@@ -1,38 +0,0 @@
/**
* Provider Quality Service
*
* Manages provider quality scores, routing, and learning
*/
export { detectTaskType, getTaskTypeConfidence } from "./task-detector";
export {
detectFeedback,
isCorrection,
isApproval,
type FeedbackType,
type FeedbackResult,
} from "./feedback-detector";
export {
loadQualityData,
saveQualityData,
getProviderQuality,
updateProviderQuality,
calculateOverallScore,
} from "./persistence";
export {
updateQualityScore,
getTaskScore,
getOverallScore,
recordApproval,
recordCorrection,
recordRejection,
recordAuditResult,
type Outcome,
type ScoreUpdate,
} from "./score-manager";
export {
determineRoute,
shouldAudit,
getRoutingExplanation,
type RoutingContext,
} from "./router";

View File

@@ -1,234 +0,0 @@
/**
* Reasoning Control Layer - Public API
*
* This module provides cognitive control layers that create intelligence
* through control flow, not prompt engineering.
*
* Five cognitive functions:
* 1. Quality Evaluation - Assess response acceptability
* 2. Retry Policy - Control retry behavior through state machine
* 3. Context Compression - Reduce context while preserving information
* 4. Memory Selection - Select relevant memories for context
* 5. Termination Detection - Detect task completion through validation
*/
// =============================================================================
// QUALITY EVALUATION
// =============================================================================
export {
evaluateQuality,
computeQualityMetrics,
computeStructuralScore,
computeRelevanceScore,
computeCompletenessScore,
computeCoherenceScore,
computeVerdict,
detectDeficiencies,
hasHallucinationMarkers,
hasContradiction,
} from "@services/reasoning/quality-evaluation";
// =============================================================================
// RETRY POLICY
// =============================================================================
export {
createInitialRetryState,
createRetryBudget,
computeRetryTransition,
splitTaskDescription,
isRetryable,
getCurrentTier,
getRemainingAttempts,
getElapsedTime,
getRemainingTime,
} from "@services/reasoning/retry-policy";
// =============================================================================
// CONTEXT COMPRESSION
// =============================================================================
export {
compressContext,
determineCompressionLevel,
shouldCompress,
compressIncrementally,
calculateMessageAge,
markMessagesWithAge,
getPreservationCandidates,
} from "@services/reasoning/context-compression";
// =============================================================================
// MEMORY SELECTION
// =============================================================================
export {
selectRelevantMemories,
computeRelevance,
computeMandatoryItems,
createMemoryItem,
createQueryContext,
createMemoryStore,
addMemory,
findMemoriesByType,
findMemoriesByPath,
pruneOldMemories,
} from "@services/reasoning/memory-selection";
export { MemoryStore } from "@interfaces/memory";
// =============================================================================
// TERMINATION DETECTION
// =============================================================================
export {
createInitialTerminationState,
processTerminationTrigger,
computeTerminationConfidence,
runValidationCheck,
extractValidationFailures,
isComplete,
isFailed,
isTerminal,
requiresValidation,
getConfidencePercentage,
} from "@services/reasoning/termination-detection";
export type { ValidationContext } from "@services/reasoning/termination-detection";
// =============================================================================
// ORCHESTRATOR
// =============================================================================
export {
createOrchestratorConfig,
createInitialState,
prepareContext,
evaluateResponseQuality,
decideRetry,
checkTermination,
executeReasoningCycle,
} from "@services/reasoning/orchestrator";
export type {
OrchestratorConfig,
ContextPreparationInput,
ContextPreparationOutput,
QualityEvaluationInput,
RetryDecisionInput,
RetryDecisionOutput,
TerminationCheckInput,
TerminationCheckOutput,
ExecutionCycleInput,
ExecutionCycleOutput,
} from "@services/reasoning/orchestrator";
// =============================================================================
// UTILITIES
// =============================================================================
export {
estimateTokens,
estimateTokensForObject,
tokenize,
jaccardSimilarity,
weightedSum,
extractEntities,
createEntityTable,
mergeEntityTables,
truncateMiddle,
foldCode,
extractCodeBlocks,
recencyDecay,
createTimestamp,
generateId,
isValidJson,
hasBalancedBraces,
countMatches,
sum,
unique,
groupBy,
} from "@services/reasoning/utils";
// =============================================================================
// RE-EXPORT TYPES
// =============================================================================
export type {
// Common
MessageId,
ToolId,
MemoryId,
TaskId,
Entity,
EntityType,
EntityTable,
// Quality Evaluation
QualityVerdict,
DeficiencyTag,
QualityMetrics,
QualityEvalInput,
QualityEvalOutput,
ResponseType,
ToolCallInfo,
TaskConstraints,
AttemptRecord,
// Retry Policy
RetryStateKind,
ExhaustionReason,
RetryState,
RetryBudget,
RetryPolicyState,
ContextDelta,
SubTask,
RetryTrigger,
ToolExecutionError,
RetryTransform,
RetryAction,
EscalationContext,
RetryPolicyInput,
RetryPolicyOutput,
// Context Compression
CompressionLevel,
CompressibleMessage,
MessageMetadata,
CompressibleToolResult,
CodeBlock,
CompressionTrigger,
CompressionInput,
CompressionOutput,
// Memory Selection
MemoryItemType,
MemoryItem,
QueryContext,
RelevanceScore,
RelevanceBreakdown,
SelectionInput,
ExclusionReason,
SelectionOutput,
// Termination Detection
TerminationStatus,
CompletionSignalSource,
CompletionSignal,
ValidationCheckType,
ValidationCheck,
ValidationResult,
ValidationFailure,
TerminationState,
TerminationTrigger,
TerminationDecision,
TerminationOutput,
TerminationEvidence,
// Orchestrator
ReasoningControlState,
ExecutionPhase,
ExecutionMetrics,
ReasoningTaskResult,
} from "@/types/reasoning";

View File

@@ -1,9 +0,0 @@
/**
* Store Core - Re-exports all stores
*/
export * from "./vim-store";
export * from "./theme-store";
export * from "./usage-store";
export * from "./todo-store";
export * from "./multi-agent-store";

View File

@@ -1,7 +0,0 @@
/**
* Stores Module - Zustand state management
*
* Re-exports all stores from core/
*/
export * from "./core";

View File

@@ -1,6 +0,0 @@
/**
* Tools Core - Registry and Types
*/
export * from "./registry";
export * from "./types";

View File

@@ -1,22 +1,3 @@
/**
* Tool registry - exports all available tools
*/
export * from "@tools/core/types";
export { bashTool } from "@tools/bash";
export { readTool } from "@tools/read";
export { writeTool } from "@tools/write";
export { editTool } from "@tools/edit";
export { todoWriteTool } from "@tools/todo-write";
export { todoReadTool } from "@tools/todo-read";
export { globToolDefinition } from "@tools/glob/definition";
export { grepToolDefinition } from "@tools/grep/definition";
export { webSearchTool } from "@tools/web-search";
export { webFetchTool } from "@tools/web-fetch";
export { multiEditTool } from "@tools/multi-edit";
export { lspTool } from "@tools/lsp";
export { applyPatchTool } from "@tools/apply-patch";
import type { ToolDefinition, FunctionDefinition } from "@tools/core/types";
import { toolToFunction } from "@tools/core/types";
import { bashTool } from "@tools/bash";
@@ -141,9 +122,7 @@ const filterToolsForMode = (
* This includes both built-in tools and MCP tools
* @param chatMode - If true, only return read-only tools (no file modifications)
*/
export async function getToolsForApiAsync(
chatMode = false,
): Promise<
export async function getToolsForApiAsync(chatMode = false): Promise<
{
type: "function";
function: FunctionDefinition;
@@ -176,9 +155,7 @@ export async function getToolsForApiAsync(
* Get tools synchronously (uses cached MCP tools if available)
* @param chatMode - If true, only return read-only tools (no file modifications)
*/
export function getToolsForApi(
chatMode = false,
): {
export function getToolsForApi(chatMode = false): {
type: "function";
function: FunctionDefinition;
}[] {

View File

@@ -1,13 +0,0 @@
/**
* MultiEdit Tool
*
* Batch file editing with atomic transactions
*/
export { multiEditTool, executeMultiEdit } from "@tools/multi-edit/execute";
export {
multiEditParams,
editItemSchema,
type EditItem,
type MultiEditParams,
} from "@tools/multi-edit/params";

View File

@@ -1,8 +0,0 @@
/**
* WebFetch Tool
*
* Fetch and convert web content to markdown
*/
export { webFetchTool, executeWebFetch } from "@tools/web-fetch/execute";
export { webFetchParams, type WebFetchParams } from "@tools/web-fetch/params";

View File

@@ -458,5 +458,3 @@ export function tui(options: TuiRenderOptions): Promise<TuiOutput> {
});
});
}
export { appStore } from "@tui-solid/context/app";

View File

@@ -1,6 +0,0 @@
/**
* Feedback Components
*/
export * from "./thinking-indicator";
export * from "./bouncing-loader";

View File

@@ -1,47 +0,0 @@
// Layout components
export { StatusBar } from "./layout/status-bar";
export { Logo } from "./layout/logo";
export { StreamingMessage } from "./layout/streaming-message";
export { Header } from "./layout/header";
// Feedback components
export { ThinkingIndicator } from "./feedback/thinking-indicator";
export { BouncingLoader } from "./feedback/bouncing-loader";
// Log components
export { LogPanel } from "./logs/log-panel";
export { LogEntryDisplay } from "./logs/log-entry";
export { addDebugLog, DebugLogPanel } from "./logs/debug-log-panel";
// Input components
export { InputArea } from "./inputs/input-area";
export { FilePicker } from "./inputs/file-picker";
export { MCPAddForm } from "./inputs/mcp-add-form";
// Menu components
export { CommandMenu, SLASH_COMMANDS } from "./menu/command-menu";
export { SelectMenu } from "./menu/select-menu";
export type { SelectOption } from "./menu/select-menu";
export { HelpMenu } from "./menu/help-menu";
export { BrainMenu } from "./menu/brain-menu";
// Submenu components
export { ModelSelect } from "./submenu/model-select";
export { AgentSelect } from "./submenu/agent-select";
export { ThemeSelect } from "./submenu/theme-select";
export { MCPSelect } from "./submenu/mcp-select";
export { ModeSelect } from "./submenu/mode-select";
export { ProviderSelect } from "./submenu/provider-select";
// Modal components
export { PermissionModal } from "./modals/permission-modal";
export { LearningModal } from "./modals/learning-modal";
export { CenteredModal } from "./modals/centered-modal";
export { ConflictResolver, ConflictIndicator } from "./modals/conflict-resolver";
// Panel components
export { HelpDetail } from "./panels/help-detail";
export { TodoPanel } from "./panels/todo-panel";
export type { TodoItem, Plan } from "./panels/todo-panel";
export { DiffView, parseDiffOutput, isDiffContent } from "./panels/diff-view";
export { MultiAgentPanel } from "./panels/multi-agent-panel";

View File

@@ -1,7 +0,0 @@
/**
* Input Components
*/
export * from "./input-area";
export * from "./file-picker";
export * from "./mcp-add-form";

View File

@@ -1,8 +0,0 @@
/**
* Layout Components
*/
export * from "./header";
export * from "./status-bar";
export * from "./logo";
export * from "./streaming-message";

View File

@@ -1,8 +0,0 @@
/**
* Menu Components
*/
export * from "./select-menu";
export * from "./command-menu";
export * from "./help-menu";
export * from "./brain-menu";

View File

@@ -1,8 +0,0 @@
/**
* Modal Components
*/
export * from "./centered-modal";
export * from "./permission-modal";
export * from "./learning-modal";
export * from "./conflict-resolver";

View File

@@ -1,8 +0,0 @@
/**
* Panel Components
*/
export * from "./todo-panel";
export * from "./diff-view";
export * from "./multi-agent-panel";
export * from "./help-detail";

View File

@@ -1,10 +0,0 @@
/**
* Submenu Components
*/
export * from "./agent-select";
export * from "./model-select";
export * from "./provider-select";
export * from "./theme-select";
export * from "./mode-select";
export * from "./mcp-select";

View File

@@ -1,7 +0,0 @@
export { createSimpleContext } from "./helper";
export { AppStoreProvider, useAppStore, appStore, setAppStoreRef } from "./app";
export { ThemeProvider, useTheme } from "./theme";
export { RouteProvider, useRoute } from "./route";
export { KeybindProvider, useKeybind } from "./keybind";
export { DialogProvider, useDialog } from "./dialog";
export { ExitProvider, useExit } from "./exit";

View File

@@ -1,3 +0,0 @@
export { tui, appStore } from "./app";
export type { TuiRenderOptions } from "./app";
export type { TuiInput, TuiOutput } from "./types";

View File

@@ -1,2 +0,0 @@
export { Home } from "./home";
export { Session } from "./session";

View File

@@ -4,22 +4,6 @@ import type { ProviderModel } from "@/types/providers";
export type { ProviderModel };
export interface TuiInput {
sessionId?: string;
initialPrompt?: string;
provider?: string;
model?: string;
theme?: string;
workingDirectory?: string;
availableModels?: ProviderModel[];
cascadeEnabled?: boolean;
}
export interface TuiOutput {
exitCode: number;
sessionId?: string;
}
export type Route = { type: "home" } | { type: "session"; sessionId: string };
export type AppMode =

View File

@@ -1,4 +0,0 @@
export { Dialog, DialogActions, ConfirmDialog, AlertDialog } from "./dialog";
export { Toast, ToastContainer, ToastProvider, useToast } from "./toast";
export type { ToastOptions, ToastVariant } from "./toast";
export { Spinner } from "./spinner";

View File

@@ -1,51 +0,0 @@
/**
* TUI Module - Terminal User Interface for CodeTyper
* Re-exports from @opentui/solid implementation
*/
export type {
AppMode,
CommandCategory,
SlashCommand,
CommandMenuState,
SelectOption,
DiffData,
DiffLineType,
DiffLineData,
DiffViewProps,
DiffLineProps,
LogEntryType,
ToolStatus,
LogEntryMetadata,
LogEntry,
LogEntryProps,
ThinkingIndicatorProps,
ToolCall,
PermissionType,
PermissionScope,
PermissionRequest,
PermissionResponse,
LearningScope,
LearningPrompt,
LearningResponse,
SessionStats,
HeaderProps,
CommandMenuProps,
AppState,
} from "@/types/tui";
export { tui, appStore } from "@tui-solid/index";
export type { TuiRenderOptions } from "@tui-solid/app";
export {
useAppStore,
AppStoreProvider,
useTheme,
ThemeProvider,
useRoute,
RouteProvider,
useKeybind,
KeybindProvider,
useDialog,
DialogProvider,
useExit,
ExitProvider,
} from "@tui-solid/context";

View File

@@ -1,7 +1,3 @@
/**
* Agent configuration types
*/
export interface AgentFrontmatter {
name?: string;
description?: string;

View File

@@ -1,9 +1,3 @@
/**
* Agent markdown definition types
* Agents are defined in markdown files with YAML frontmatter
* Location: .codetyper/agents/*.md
*/
export type AgentTier = "fast" | "balanced" | "thorough";
export type AgentColor =
@@ -87,5 +81,13 @@ export const AGENT_TIER_MODELS: Record<AgentTier, string> = {
export const AGENT_DEFINITION_SCHEMA = {
required: ["name", "description", "tools"],
optional: ["tier", "color", "maxTurns", "triggerPhrases", "capabilities", "allowedPaths", "deniedPaths"],
optional: [
"tier",
"color",
"maxTurns",
"triggerPhrases",
"capabilities",
"allowedPaths",
"deniedPaths",
],
};

View File

@@ -1,7 +1,3 @@
/**
* Agent Types
*/
import type { Message } from "@/types/providers";
export interface ToolCallMessage {

View File

@@ -1,22 +1,9 @@
/**
* Apply Patch Types
*
* Types for unified diff parsing and application.
* Supports fuzzy matching and rollback on failure.
*/
/**
* Patch line type
*/
export type PatchLineType =
| "context" // Unchanged line (starts with space)
| "addition" // Added line (starts with +)
| "deletion" // Removed line (starts with -)
| "header"; // Hunk header
| "context" // Unchanged line (starts with space)
| "addition" // Added line (starts with +)
| "deletion" // Removed line (starts with -)
| "header"; // Hunk header
/**
* Single line in a patch
*/
export interface PatchLine {
type: PatchLineType;
content: string;
@@ -24,9 +11,6 @@ export interface PatchLine {
newLineNumber?: number;
}
/**
* Patch hunk (a contiguous block of changes)
*/
export interface PatchHunk {
oldStart: number;
oldLines: number;
@@ -36,9 +20,6 @@ export interface PatchHunk {
header: string;
}
/**
* Parsed patch file for a single file
*/
export interface ParsedFilePatch {
oldPath: string;
newPath: string;
@@ -49,17 +30,11 @@ export interface ParsedFilePatch {
isRenamed: boolean;
}
/**
* Complete parsed patch (may contain multiple files)
*/
export interface ParsedPatch {
files: ParsedFilePatch[];
rawPatch: string;
}
/**
* Fuzzy match result
*/
export interface FuzzyMatchResult {
found: boolean;
lineNumber: number;
@@ -67,9 +42,6 @@ export interface FuzzyMatchResult {
confidence: number;
}
/**
* Hunk application result
*/
export interface HunkApplicationResult {
success: boolean;
hunkIndex: number;
@@ -78,9 +50,6 @@ export interface HunkApplicationResult {
fuzzyOffset?: number;
}
/**
* File patch result
*/
export interface FilePatchResult {
success: boolean;
filePath: string;
@@ -91,9 +60,6 @@ export interface FilePatchResult {
error?: string;
}
/**
* Overall patch application result
*/
export interface ApplyPatchResult {
success: boolean;
filesPatched: number;
@@ -103,9 +69,6 @@ export interface ApplyPatchResult {
error?: string;
}
/**
* Apply patch parameters
*/
export interface ApplyPatchParams {
patch: string;
targetFile?: string;
@@ -114,9 +77,6 @@ export interface ApplyPatchParams {
reverse?: boolean;
}
/**
* Rollback information
*/
export interface PatchRollback {
filePath: string;
originalContent: string;
@@ -124,9 +84,6 @@ export interface PatchRollback {
timestamp: number;
}
/**
* Patch validation result
*/
export interface PatchValidationResult {
valid: boolean;
errors: string[];
@@ -135,9 +92,6 @@ export interface PatchValidationResult {
hunkCount: number;
}
/**
* Context line match options
*/
export interface ContextMatchOptions {
fuzz: number;
ignoreWhitespace: boolean;

View File

@@ -1,9 +1,3 @@
/**
* Background task types for async operations
* Allows tasks to run in background while user continues working
* Triggered with Ctrl+B or /background command
*/
export type BackgroundTaskStatus =
| "pending"
| "running"
@@ -13,101 +7,3 @@ export type BackgroundTaskStatus =
| "cancelled";
export type BackgroundTaskPriority = "low" | "normal" | "high";
export interface BackgroundTask {
readonly id: string;
readonly name: string;
readonly description: string;
readonly status: BackgroundTaskStatus;
readonly priority: BackgroundTaskPriority;
readonly createdAt: number;
readonly startedAt?: number;
readonly completedAt?: number;
readonly progress: TaskProgress;
readonly result?: TaskResult;
readonly error?: TaskError;
readonly metadata: TaskMetadata;
}
export interface TaskProgress {
readonly current: number;
readonly total: number;
readonly percentage: number;
readonly message: string;
readonly steps: ReadonlyArray<TaskStep>;
}
export interface TaskStep {
readonly name: string;
readonly status: BackgroundTaskStatus;
readonly startedAt?: number;
readonly completedAt?: number;
readonly output?: string;
}
export interface TaskResult {
readonly success: boolean;
readonly output: string;
readonly artifacts: ReadonlyArray<TaskArtifact>;
readonly summary: string;
}
export interface TaskArtifact {
readonly type: "file" | "diff" | "report" | "data";
readonly name: string;
readonly path?: string;
readonly content?: string;
}
export interface TaskError {
readonly code: string;
readonly message: string;
readonly stack?: string;
readonly recoverable: boolean;
}
export interface TaskMetadata {
readonly sessionId: string;
readonly agentId?: string;
readonly prompt?: string;
readonly tools: ReadonlyArray<string>;
readonly startedByUser: boolean;
}
export interface BackgroundTaskConfig {
readonly maxConcurrent: number;
readonly defaultTimeout: number;
readonly retryOnFailure: boolean;
readonly maxRetries: number;
readonly notifyOnComplete: boolean;
readonly persistTasks: boolean;
}
export interface TaskNotification {
readonly taskId: string;
readonly type: "started" | "progress" | "completed" | "failed";
readonly message: string;
readonly timestamp: number;
}
export interface BackgroundTaskStore {
readonly tasks: ReadonlyMap<string, BackgroundTask>;
readonly queue: ReadonlyArray<string>;
readonly running: ReadonlyArray<string>;
readonly completed: ReadonlyArray<string>;
}
export const DEFAULT_BACKGROUND_TASK_CONFIG: BackgroundTaskConfig = {
maxConcurrent: 3,
defaultTimeout: 300000, // 5 minutes
retryOnFailure: false,
maxRetries: 1,
notifyOnComplete: true,
persistTasks: true,
};
export const BACKGROUND_TASK_PRIORITIES: Record<BackgroundTaskPriority, number> = {
low: 1,
normal: 5,
high: 10,
};

View File

@@ -1,17 +1,5 @@
/**
* Common types for CodeTyper CLI
*
* Basic domain types that don't belong to a specific feature module.
*/
/**
* Agent type for different coding tasks
*/
export type AgentType = "coder" | "tester" | "refactorer" | "documenter";
/**
* Intent classification for user requests
*/
export type IntentType =
| "ask"
| "code"

View File

@@ -1,8 +1,4 @@
/**
* Handler types for command routing
*/
import type { CommandOptions } from "@/types/index";
import type { CommandOptions } from "@/types/common";
export type CommandName =
| "chat"

View File

@@ -1,369 +0,0 @@
/**
* TypeScript type definitions for CodeTyper CLI
*/
export type AgentType = "coder" | "tester" | "refactorer" | "documenter";
// Re-export image types
export type {
ImageMediaType,
ImageContent,
TextContent,
MessageContent,
MultimodalMessage,
PastedImage,
} from "@/types/image";
export {
isImageContent,
isTextContent,
createTextContent,
createImageContent,
} from "@/types/image";
// Re-export brain types
export type {
BrainUser,
BrainCredentials,
BrainConnectionStatus,
BrainState,
BrainConcept,
BrainMemory,
BrainMemoryType,
BrainRelationType,
BrainRecallResponse,
BrainExtractResponse,
BrainKnowledgeStats,
BrainMemoryStats,
} from "@/types/brain";
// Re-export brain cloud sync types
export type {
BrainSyncStatus,
ConflictStrategy,
SyncDirection,
SyncOperationType,
BrainSyncState,
CloudBrainConfig,
SyncItem,
SyncConflict,
SyncResult,
PushRequest,
PushResponse,
PullRequest,
PullResponse,
OfflineQueueItem,
OfflineQueueState,
SyncProgressEvent,
SyncOptions,
} from "@/types/brain-cloud";
// Re-export skills types
export type {
SkillLoadLevel,
SkillTriggerType,
SkillExample,
SkillMetadata,
SkillBody,
SkillDefinition,
SkillMatch,
SkillContext,
SkillExecutionResult,
SkillRegistryState,
SkillFrontmatter,
ParsedSkillFile,
} from "@/types/skills";
// Re-export parallel execution types
export type {
ParallelTaskType,
TaskPriority,
ParallelTaskStatus,
ParallelAgentConfig,
ParallelTask,
ParallelExecutionResult,
ConflictCheckResult,
ConflictResolution,
ResourceLimits,
ResourceState,
AggregatedResults,
ParallelExecutorOptions,
BatchExecutionRequest,
SemaphoreState,
DeduplicationKey,
DeduplicationResult,
} from "@/types/parallel";
// Re-export apply-patch types
export type {
PatchLineType,
PatchLine,
PatchHunk,
ParsedFilePatch,
ParsedPatch,
FuzzyMatchResult,
HunkApplicationResult,
FilePatchResult,
ApplyPatchResult,
ApplyPatchParams,
PatchRollback,
PatchValidationResult,
ContextMatchOptions,
} from "@/types/apply-patch";
// Re-export feature-dev types
export type {
FeatureDevPhase,
PhaseStatus,
CheckpointDecision,
ExplorationResult,
ExplorationFinding,
ImplementationPlan,
ImplementationStep,
FileChange,
TestResult,
TestFailure,
ReviewFinding,
Checkpoint,
FeatureDevState,
PhaseTransitionRequest,
PhaseExecutionContext,
PhaseExecutionResult,
FeatureDevConfig,
} from "@/types/feature-dev";
// Re-export pr-review types
export type {
ReviewFindingType,
ReviewSeverity,
ConfidenceLevel,
PRReviewFinding,
DiffHunk,
ParsedFileDiff,
ParsedDiff,
ReviewerConfig,
SecurityReviewCriteria,
PerformanceReviewCriteria,
StyleReviewCriteria,
LogicReviewCriteria,
PRReviewConfig,
ReviewerResult,
ReviewRating,
ReviewRecommendation,
PRReviewReport,
PRReviewRequest,
ReviewFileContext,
} from "@/types/pr-review";
export type IntentType =
| "ask"
| "code"
| "refactor"
| "fix"
| "document"
| "test"
| "explain";
export type Provider = "copilot" | "ollama";
export interface Config {
provider: Provider;
model?: string;
theme?: string;
maxIterations: number;
timeout: number;
protectedPaths: string[];
systemPrompt?: string;
cascadeEnabled?: boolean;
}
export interface IntentRequest {
prompt: string;
context?: string;
files?: string[];
}
export interface IntentResponse {
intent: IntentType;
confidence: number;
reasoning: string;
needsClarification: boolean;
clarificationQuestions?: string[];
}
export interface PlanStep {
id: string;
type: "read" | "edit" | "create" | "delete" | "execute";
description: string;
file?: string;
dependencies?: string[];
tool?: string;
args?: Record<string, unknown>;
}
export interface ExecutionPlan {
steps: PlanStep[];
intent: IntentType;
summary: string;
estimatedTime?: number;
}
export interface ValidationResult {
valid: boolean;
errors: string[];
warnings: string[];
protectedPaths: string[];
}
export interface ChatMessage {
role: "user" | "assistant" | "system";
content: string;
timestamp: number;
}
export interface ChatSession {
id: string;
agent: AgentType;
messages: ChatMessage[];
contextFiles: string[];
createdAt: number;
updatedAt: number;
}
export interface CommandOptions {
agent?: AgentType;
model?: string;
files?: string[];
dryRun?: boolean;
maxIterations?: number;
autoApprove?: boolean;
task?: string;
prompt?: string;
context?: string;
intent?: IntentType;
output?: string;
planFile?: string;
action?: string;
key?: string;
value?: string;
}
export interface ToolResult {
success: boolean;
output?: string;
error?: string;
files?: string[];
}
export interface FileEdit {
file: string;
search: string;
replace: string;
description?: string;
}
export interface TerminalSpinner {
start(text: string): void;
succeed(text: string): void;
fail(text: string): void;
stop(): void;
}
// Re-export confidence filter types
export type {
ConfidenceLevel as ConfidenceFilterLevel,
ConfidenceScore,
ConfidenceFactor,
ConfidenceFilterConfig,
FilteredResult,
ValidationResult as ConfidenceValidationResult,
ConfidenceFilterStats,
} from "@/types/confidence-filter";
export {
CONFIDENCE_LEVELS,
DEFAULT_CONFIDENCE_FILTER_CONFIG,
} from "@/types/confidence-filter";
// Re-export agent definition types
export type {
AgentTier,
AgentColor,
AgentDefinition,
AgentPermissions,
AgentDefinitionFile,
AgentFrontmatter,
AgentRegistry,
AgentLoadResult,
} from "@/types/agent-definition";
export {
DEFAULT_AGENT_DEFINITION,
AGENT_TIER_MODELS,
AGENT_DEFINITION_SCHEMA,
} from "@/types/agent-definition";
// Re-export background task types
export type {
BackgroundTaskStatus,
BackgroundTaskPriority,
BackgroundTask,
TaskProgress,
TaskResult,
TaskError,
TaskMetadata,
TaskNotification,
TaskStep,
TaskArtifact,
BackgroundTaskConfig,
BackgroundTaskStore,
} from "@/types/background-task";
export {
DEFAULT_BACKGROUND_TASK_CONFIG,
BACKGROUND_TASK_PRIORITIES,
} from "@/types/background-task";
// Re-export brain project types
export type {
BrainProject,
BrainProjectStats,
BrainProjectSettings,
BrainProjectCreateInput,
BrainProjectUpdateInput,
BrainProjectSwitchResult,
BrainProjectListResult,
BrainProjectExport,
BrainProjectImportResult,
ExportedConcept,
ExportedMemory,
ExportedRelationship,
} from "@/types/brain-project";
export {
DEFAULT_BRAIN_PROJECT_SETTINGS,
BRAIN_PROJECT_EXPORT_VERSION,
} from "@/types/brain-project";
// Re-export brain MCP types
export type {
BrainMcpToolName,
BrainMcpServerConfig,
RateLimitConfig,
LoggingConfig,
BrainMcpTool,
McpInputSchema,
McpPropertySchema,
BrainMcpRequest,
BrainMcpResponse,
McpContent,
McpResource,
McpError,
BrainMcpServerStatus,
} from "@/types/brain-mcp";
export {
DEFAULT_BRAIN_MCP_SERVER_CONFIG,
BRAIN_MCP_TOOLS,
MCP_ERROR_CODES,
} from "@/types/brain-mcp";

View File

@@ -1,7 +1,3 @@
/**
* Input editor types
*/
import type readline from "readline";
export type KeypressHandler = (
@@ -9,9 +5,6 @@ export type KeypressHandler = (
key: readline.Key,
) => void;
/**
* Represents a pasted text block
*/
export interface PastedBlock {
id: number;
content: string;
@@ -27,19 +20,12 @@ export type InputEditorState = {
prompt: string;
continuationPrompt: string;
keypressHandler: KeypressHandler | null;
/** Stores pasted blocks with their full content */
pastedBlocks: Map<string, PastedBlock>;
/** Counter for pasted block IDs */
pasteCounter: number;
/** Buffer for collecting paste input */
pasteBuffer: string;
/** Timestamp of last paste input */
lastPasteTime: number;
/** Timer for paste flush */
pasteFlushTimer: ReturnType<typeof setTimeout> | null;
/** Whether currently in bracketed paste mode */
isBracketedPaste: boolean;
/** Buffer for bracketed paste content */
bracketedPasteBuffer: string;
};

View File

@@ -1,7 +1,3 @@
/**
* Learning Service types
*/
export type LearningCategory =
| "preference"
| "convention"

View File

@@ -1,12 +1,3 @@
/**
* MCP Registry Types
*
* Types for MCP server discovery and search
*/
/**
* MCP server category
*/
export type MCPServerCategory =
| "database"
| "filesystem"
@@ -19,121 +10,61 @@ export type MCPServerCategory =
| "security"
| "other";
/**
* MCP server transport type for registry
*/
export type MCPRegistryTransport = "stdio" | "sse" | "http";
/**
* MCP server entry from registry
*/
export interface MCPRegistryServer {
/** Unique identifier */
id: string;
/** Display name */
name: string;
/** Short description */
description: string;
/** Author/maintainer */
author: string;
/** Repository URL */
repository: string;
/** NPM package or command */
package: string;
/** Default command to run */
command: string;
/** Default arguments */
args: string[];
/** Category */
category: MCPServerCategory;
/** Tags for search */
tags: string[];
/** Transport type */
transport: MCPRegistryTransport;
/** Version */
version: string;
/** Downloads/popularity score */
popularity: number;
/** Whether verified by maintainers */
verified: boolean;
/** Installation instructions */
installHint?: string;
/** Environment variables needed */
envVars?: string[];
/** Last updated timestamp */
updatedAt: string;
}
/**
* Search result from registry
*/
export interface MCPSearchResult {
/** Matching servers */
servers: MCPRegistryServer[];
/** Total count */
total: number;
/** Search query */
query: string;
/** Category filter applied */
category?: MCPServerCategory;
}
/**
* Registry source configuration
*/
export interface MCPRegistrySource {
/** Source name */
name: string;
/** API URL or file path */
url: string;
/** Whether enabled */
enabled: boolean;
/** Last fetched timestamp */
lastFetched?: number;
}
/**
* Cached registry data
*/
export interface MCPRegistryCache {
/** All servers from registry */
servers: MCPRegistryServer[];
/** Last updated timestamp */
updatedAt: number;
/** Source URL */
source: string;
}
/**
* Search options
*/
export interface MCPSearchOptions {
/** Search query */
query?: string;
/** Filter by category */
category?: MCPServerCategory;
/** Filter by tags */
tags?: string[];
/** Only verified servers */
verifiedOnly?: boolean;
/** Sort by */
sortBy?: "popularity" | "name" | "updated";
/** Limit results */
limit?: number;
/** Offset for pagination */
offset?: number;
}
/**
* Installation result
*/
export interface MCPInstallResult {
/** Whether successful */
success: boolean;
/** Server name */
serverName: string;
/** Error message if failed */
error?: string;
/** Whether connected after install */
connected: boolean;
}

View File

@@ -1,49 +1,22 @@
/**
* MCP (Model Context Protocol) Types
*/
/**
* MCP Server Configuration
*/
export interface MCPServerConfig {
/** Server identifier */
name: string;
/** Command to start the server */
command: string;
/** Arguments for the command */
args?: string[];
/** Environment variables */
env?: Record<string, string>;
/** Transport type */
transport?: MCPTransportType;
/** Server URL (for SSE/HTTP transport) */
url?: string;
/** Whether server is enabled */
enabled?: boolean;
}
/**
* Transport types supported by MCP
*/
export type MCPTransportType = "stdio" | "sse" | "http";
/**
* MCP Configuration
*/
export interface MCPConfig {
/** MCP servers configuration */
servers: Record<string, MCPServerConfig>;
}
/**
* MCP Tool Definition (from server)
*/
export interface MCPToolDefinition {
/** Tool name */
name: string;
/** Tool description */
description?: string;
/** JSON Schema for parameters */
inputSchema: {
type: "object";
properties?: Record<string, unknown>;
@@ -51,91 +24,48 @@ export interface MCPToolDefinition {
};
}
/**
* MCP Resource Definition
*/
export interface MCPResourceDefinition {
/** Resource URI */
uri: string;
/** Resource name */
name: string;
/** Resource description */
description?: string;
/** MIME type */
mimeType?: string;
}
/**
* MCP Server Connection State
*/
export type MCPConnectionState =
| "disconnected"
| "connecting"
| "connected"
| "error";
/**
* MCP Server Instance (runtime)
*/
export interface MCPServerInstance {
/** Server configuration */
config: MCPServerConfig;
/** Connection state */
state: MCPConnectionState;
/** Available tools */
tools: MCPToolDefinition[];
/** Available resources */
resources: MCPResourceDefinition[];
/** Error message if any */
error?: string;
/** Process ID if running via stdio */
pid?: number;
}
/**
* MCP Tool Call Request
*/
export interface MCPToolCallRequest {
/** Server name */
server: string;
/** Tool name */
tool: string;
/** Tool arguments */
arguments: Record<string, unknown>;
}
/**
* MCP Tool Call Result
*/
export interface MCPToolCallResult {
/** Whether the call succeeded */
success: boolean;
/** Result content */
content?: unknown;
/** Error message */
error?: string;
}
/**
* MCP Manager State
*/
export interface MCPManagerState {
/** Configured servers */
servers: Map<string, MCPServerInstance>;
/** Whether manager is initialized */
initialized: boolean;
}
/**
* MCP Add Form Data (for TUI form submission)
*/
export interface MCPAddFormData {
/** Server name */
name: string;
/** Command to run */
command: string;
/** Arguments (space-separated string) */
args: string;
/** Whether to save to global config */
isGlobal: boolean;
}

View File

@@ -1,8 +1,5 @@
/**
* Runner types for task execution
*/
import type { AgentType, ExecutionPlan, PlanStep } from "@/types/index";
import type { AgentType } from "@/types/common";
import { ExecutionPlan, PlanStep } from "@interfaces/index";
export interface RunnerOptions {
task: string;

View File

@@ -1,8 +1,4 @@
/**
* Session Types
*/
import type { AgentType } from "@/types/index";
import type { AgentType } from "@/types/common";
export interface SessionInfo {
id: string;

View File

@@ -1,6 +0,0 @@
/**
* Banner Core - Rendering and Logo
*/
export * from "./render";
export * from "./logo";

View File

@@ -1,5 +0,0 @@
/**
* Banner Menu - Print functions
*/
export * from "./print";

View File

@@ -1,5 +0,0 @@
/**
* Components Core - Box component
*/
export * from "./box";

View File

@@ -1,8 +0,0 @@
/**
* Components Menu - Status, Message, Header, List
*/
export * from "./status";
export * from "./message";
export * from "./header";
export * from "./list";

View File

@@ -1,6 +0,0 @@
/**
* UI Core - Core UI utilities
*/
export * from "./styles";
export * from "./components";

View File

@@ -1,9 +0,0 @@
/**
* Terminal UI components for CodeTyper CLI
*/
export * from "@ui/core";
export * from "@ui/banner";
export * from "@ui/spinner";
export * from "@ui/tips";
export * from "@ui/input-editor";

View File

@@ -1,5 +0,0 @@
/**
* Input Editor Core - Main editor functionality
*/
export * from "./editor";

View File

@@ -1,5 +0,0 @@
/**
* Spinner Core - Main spinner functionality
*/
export * from "./spinner";

View File

@@ -1,8 +0,0 @@
/**
* Utils Core - Core utility functions
*/
export * from "./terminal";
export * from "./string-helpers";
export * from "./tools";
export * from "./ensure-directories";

View File

@@ -1,12 +0,0 @@
/**
* Utils Module - Utility functions
*/
export * from "./core";
export * from "./menu";
export * from "./diff";
export * from "./syntax-highlight/detect";
export * from "./syntax-highlight/highlight";
export * from "./tui-app/input-utils";
export * from "./tui-app/mode-utils";
export * from "./tui-app/paste-utils";

View File

@@ -1,5 +0,0 @@
/**
* Utils Menu - Menu-related utilities
*/
export * from "./progress-bar";