/**
 * OwlCoda Slash Command Handlers
 *
 * Extracted from repl.ts for maintainability. Contains the handleSlashCommand
 * dispatch function and its direct helpers (safeRender, rebuildSystemPrompt).
 *
 * All slash commands (/help, /model, /save, /search, etc.) are handled here.
 */
import * as readline from "node:readline";
import { ToolDispatcher } from "./dispatch.js";
import { MCPManager } from "./mcp/manager.js";
import type { Conversation } from "./protocol/types.js";
import { PersistentStatusBar, ToolResultCollector } from "./tui/index.js";
import { UsageTracker } from "./usage.js";
import { type OperatingMode } from "./modes.js";
export interface ReplOptions {
    apiBaseUrl: string;
    apiKey: string;
    model: string;
    mode?: OperatingMode;
    maxTokens?: number;
    systemPrompt?: string;
    resumeSession?: string;
    liveReplClientId?: string;
    liveReplRuntime?: {
        host: string;
        port: number;
        routerUrl: string;
        runtimeToken: string;
    };
}
export type SlashCommandSideEffect = {
    kind: 'force_resubmit_failed_turn';
    text: string;
};
export interface SlashCommandHooks {
    onSideEffect?: (effect: SlashCommandSideEffect) => void;
}
export interface ApproveState {
    autoApprove: boolean;
    /**
     * When true, every prompt that would normally fire is auto-resolved
     * to "deny" instead of awaiting user input. Mutually exclusive with
     * `autoApprove` (autoApprove wins on conflict). Mostly a QA aid:
     * autonomous flows can use this to verify the safety gate is firing
     * (the tool call will return "Tool execution denied by user." instead
     * of running silently). Set via `Config({setting:'autoDeny', value:true})`.
     */
    autoDeny?: boolean;
}
export interface ThinkingState {
    mode: "collapsed" | "verbose";
    lastThinking: string;
}
export interface SlashCommandOutput {
    write?: (text: string, options?: {
        transient?: boolean;
    }) => void;
    clearTransient?: () => void;
}
/**
 * Error boundary for TUI rendering — prevents crashes from bad ANSI/markdown.
 * Falls back to raw text on error.
 */
export declare function safeRender(fn: () => string, fallback?: string): string;
/** All known slash commands — shared with repl.ts for tab completion. */
export declare const SLASH_COMMANDS: string[];
/**
 * Parse raw API error strings into user-friendly messages.
 * Handles JSON error bodies, HTTP status codes, SSL errors,
 * and other common patterns.
 */
export declare function parseApiError(raw: string): string;
/** Handle slash commands. Returns true if handled. */
export declare function handleSlashCommand(input: string, conversation: Conversation, usage: UsageTracker, opts?: ReplOptions, approveState?: ApproveState, dispatcher?: ToolDispatcher, statusBar?: PersistentStatusBar, toolCollector?: ToolResultCollector, rl?: readline.Interface, mcpManager?: MCPManager, thinkingState?: ThinkingState, output?: SlashCommandOutput, hooks?: SlashCommandHooks): Promise<boolean>;
