deleting index.ts files
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { appStore } from "@tui/index.ts";
|
||||
import { appStore } from "@tui/index";
|
||||
import type { LogType } from "@/types/log";
|
||||
|
||||
export const onLog = (
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Commands Core - Main command handling
|
||||
*/
|
||||
|
||||
export * from "./runner";
|
||||
export * from "./handlers";
|
||||
Reference in New Issue
Block a user