Terminal-based AI coding agent with interactive TUI for autonomous code generation.

Features:
  - Interactive TUI with React/Ink
  - Autonomous agent with tool calls (bash, read, write, edit, glob, grep)
  - Permission system with pattern-based rules
  - Session management with auto-compaction
  - Dual providers: GitHub Copilot and Ollama
  - MCP server integration
  - Todo panel and theme system
  - Streaming responses
  - GitHub-compatible project context
This commit is contained in:
2026-01-27 23:33:06 -05:00
commit 0062e5d9d9
521 changed files with 66418 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
/**
* Agent Options Interface
*/
import type { ProviderName } from "@/types/providers";
import type { ToolCall, ToolResult } from "@tools/index";
export interface AgentOptions {
provider: ProviderName;
model?: string;
maxIterations?: number;
onToolCall?: (call: ToolCall) => void;
onToolResult?: (callId: string, result: ToolResult) => void;
onText?: (text: string) => void;
onThinking?: (text: string) => void;
onError?: (error: string) => void;
onWarning?: (warning: string) => void;
verbose?: boolean;
autoApprove?: boolean;
/** Chat mode - only read-only tools, no file modifications */
chatMode?: boolean;
}

View File

@@ -0,0 +1,12 @@
/**
* Agent Result Interface
*/
import type { ToolCall, ToolResult } from "@tools/index";
export interface AgentResult {
success: boolean;
finalResponse: string;
iterations: number;
toolCalls: { call: ToolCall; result: ToolResult }[];
}

View File

@@ -0,0 +1,34 @@
/**
* App Props Interface
*
* Props for the main TUI Application component
*/
import type { AgentConfig } from "@/types/agent-config";
export interface AppProps {
/** Unique session identifier */
sessionId: string;
/** LLM provider name */
provider: string;
/** Model name */
model: string;
/** Current agent ID */
agent?: string;
/** Application version */
version: string;
/** Called when user submits a message */
onSubmit: (message: string) => Promise<void>;
/** Called when user exits the application */
onExit: () => void;
/** Called when user executes a slash command */
onCommand?: (command: string) => Promise<void>;
/** Called when user selects a model */
onModelSelect?: (model: string) => void | Promise<void>;
/** Called when user selects an agent */
onAgentSelect?: (agentId: string, agent: AgentConfig) => void | Promise<void>;
/** Called when user selects a theme */
onThemeSelect?: (theme: string) => void | Promise<void>;
/** Whether to show the banner on startup */
showBanner?: boolean;
}

View File

@@ -0,0 +1,67 @@
/**
* Auto-Scroll Options Interface
*
* Configuration for auto-scroll behavior
*/
export interface AutoScrollOptions {
/** Function that returns whether content is actively being generated */
isWorking: () => boolean;
/** Total content height in lines */
totalLines: number;
/** Visible viewport height in lines */
visibleHeight: number;
/** Callback when user interrupts auto-scroll by scrolling up */
onUserInteracted?: () => void;
/** Distance from bottom (in lines) to consider "at bottom" */
bottomThreshold?: number;
}
export interface AutoScrollState {
/** Current scroll offset in lines */
scrollOffset: number;
/** Whether auto-scroll to bottom is enabled */
autoScroll: boolean;
/** Whether the user has manually scrolled (pausing auto-scroll) */
userScrolled: boolean;
/** Whether we're in the settling period after operations complete */
isSettling: boolean;
}
export interface AutoScrollActions {
/** Scroll up by specified lines (user-initiated) */
scrollUp: (lines?: number) => void;
/** Scroll down by specified lines (user-initiated) */
scrollDown: (lines?: number) => void;
/** Scroll to the top (user-initiated) */
scrollToTop: () => void;
/** Scroll to the bottom and resume auto-scroll */
scrollToBottom: () => void;
/** Resume auto-scroll mode */
resume: () => void;
/** Pause auto-scroll (called when user scrolls up) */
pause: () => void;
/** Get the effective scroll offset (clamped to valid range) */
getEffectiveOffset: () => number;
/** Check if can scroll up */
canScrollUp: () => boolean;
/** Check if can scroll down */
canScrollDown: () => boolean;
}
export type AutoScrollReturn = AutoScrollState & AutoScrollActions;

View File

@@ -0,0 +1,30 @@
/**
* Box options interface
*/
import type { BoxStyle, BoxAlign } from "@/types/components";
export interface BoxOptions {
title?: string;
style?: BoxStyle;
padding?: number;
color?: string;
width?: number;
align?: BoxAlign;
}
export interface KeyValueOptions {
separator?: string;
labelColor?: string;
valueColor?: string;
}
export interface ListOptions {
bullet?: string;
indent?: number;
color?: string;
}
export interface MessageOptions {
showRole?: boolean;
}

View File

@@ -0,0 +1,15 @@
import type { ProviderName } from "@/types/providers";
export interface ChatOptions {
provider?: ProviderName;
model?: string;
files?: string[];
initialPrompt?: string;
continueSession?: boolean;
resumeSession?: string;
systemPrompt?: string;
appendSystemPrompt?: string;
printMode?: boolean;
verbose?: boolean;
autoApprove?: boolean;
}

View File

@@ -0,0 +1,15 @@
import type { ProviderName } from "@/types/providers";
export interface ChatTUIOptions {
provider?: ProviderName;
model?: string;
files?: string[];
initialPrompt?: string;
continueSession?: boolean;
resumeSession?: string;
systemPrompt?: string;
appendSystemPrompt?: string;
printMode?: boolean;
verbose?: boolean;
autoApprove?: boolean;
}

View File

@@ -0,0 +1,11 @@
/**
* Execution Result Interface
*/
export interface ExecutionResult {
success: boolean;
stdout?: string;
stderr?: string;
error?: string;
exitCode?: number;
}

View File

@@ -0,0 +1,10 @@
/**
* File Operation Interface
*/
export interface FileOperation {
type: "read" | "write" | "edit" | "delete" | "create";
path: string;
content?: string;
description?: string;
}

View File

@@ -0,0 +1,8 @@
/**
* Input editor options interface
*/
export interface InputEditorOptions {
prompt?: string;
continuationPrompt?: string;
}

View File

@@ -0,0 +1,12 @@
/**
* Mouse Handler Callbacks Interface
*
* Callbacks for handling mouse scroll events
*/
export interface MouseHandlerCallbacks {
/** Called when scroll wheel moves up */
onScrollUp: (lines: number) => void;
/** Called when scroll wheel moves down */
onScrollDown: (lines: number) => void;
}

View File

@@ -0,0 +1,14 @@
/**
* Mouse Scroll Options Interface
*
* Configuration options for the useMouseScroll hook
*/
export interface MouseScrollOptions {
/** Callback fired when scrolling up */
onScrollUp: () => void;
/** Callback fired when scrolling down */
onScrollDown: () => void;
/** Whether mouse scroll is enabled (default: true) */
enabled?: boolean;
}

View File

@@ -0,0 +1,30 @@
/**
* Interface for tracking pasted content with virtual text
*/
export interface PastedContent {
/** Unique identifier for the pasted block */
id: string;
/** The actual pasted content */
content: string;
/** Number of lines in the pasted content */
lineCount: number;
/** The placeholder text displayed in the input */
placeholder: string;
/** Start position in the input buffer */
startPos: number;
/** End position in the input buffer (exclusive) */
endPos: number;
}
export interface PasteState {
/** Map of pasted blocks by their ID */
pastedBlocks: Map<string, PastedContent>;
/** Counter for generating unique IDs */
pasteCounter: number;
}
export const createInitialPasteState = (): PasteState => ({
pastedBlocks: new Map(),
pasteCounter: 0,
});

View File

@@ -0,0 +1,26 @@
/**
* Spinner options interface
*/
import type { SpinnerType } from "@/types/spinner";
export interface SpinnerOptions {
type?: SpinnerType;
color?: string;
text?: string;
interval?: number;
}
export interface ScannerOptions {
width?: number;
text?: string;
char?: string;
}
export interface ProgressBarOptions {
width?: number;
chars?: {
filled: string;
empty: string;
};
}

View File

@@ -0,0 +1,6 @@
export interface ToolCallParams {
id: string;
name: string;
description: string;
args?: Record<string, unknown>;
}

View File

@@ -0,0 +1,7 @@
import type { ChatState } from "@commands/components/chat/state";
export interface CommandContext {
state: ChatState;
args: string[];
cleanup: () => void;
}

6
src/interfaces/memory.ts Normal file
View File

@@ -0,0 +1,6 @@
import type { MemoryItem } from "@/types/reasoning";
export interface MemoryStore {
items: MemoryItem[];
maxItems: number;
}