import { Config } from '../utils/config.js';
import { Logger } from '../utils/logger.js';
import { ChatMessage } from '../utils/api.js';
interface ChatOptions {
    model?: string;
    project?: string;
    projectProvided?: boolean;
    newProject?: string | boolean;
    agent?: boolean;
    operator?: boolean;
    workflow?: string;
    savePlan?: boolean;
    autoApprove?: boolean;
    resume?: boolean;
    stream?: boolean;
    prompt?: string;
    json?: boolean;
    bridge?: string;
    grant?: boolean;
    retry?: boolean;
    continue?: boolean;
}
export declare class ChatCommand {
    private config;
    private logger;
    private api;
    private messages;
    private tools;
    private sessionManager;
    private projectMemory;
    private workspaceBrain;
    private currentSession;
    private agentMode;
    private currentProjectPath;
    private lastActionableUserInput;
    private directPromptMode;
    private directToolContinuationCount;
    private currentModel;
    private modelExplicitlySelected;
    private autoApprove;
    private personaOverride;
    private agentToolEvidence;
    private operatorMode;
    private workflowTarget;
    private savePlanToVigFlow;
    private jsonOutput;
    private modelGovernanceFallback;
    private retryPromptSignature;
    private retryPromptStreak;
    private v3SuppressThinkingStream;
    private v3StreamedAnswerBuffer;
    private v3StreamedAnswerDisplayed;
    private v3SeenToolCalls;
    private v3SeenToolResults;
    private v3StartSeen;
    private lastAgentRoute;
    private lastAgentRunOutcome;
    private isJwtExpirationError;
    private isNetworkError;
    private isTimeoutError;
    private toUserFacingApiError;
    private handleApiError;
    private callApi;
    private callSyncApi;
    private applyNoAgentGovernance;
    private syncInteractiveModeModel;
    private hasOperatorAccess;
    private operatorAccessMessage;
    private getDefaultChatModel;
    private resolveInitialModel;
    private isLegacyAgentFallbackAllowed;
    private shouldRescueFailedAnalysis;
    private isDeepAnalysisPrompt;
    private tryAnalysisLocalRescue;
    private resolveAgentExecutionPolicy;
    private getMessagesForModel;
    private getActivePersonaMode;
    private buildActivePersonaOverlay;
    private isDiagnosticPrompt;
    /**
     * Returns true when the prompt is a simple lookup / analysis / read-only
     * question — these should use analysis_only workflow, not full_autonomy.
     */
    private isAnalysisLookupPrompt;
    private extractExplicitLocalPath;
    private isUnscopedPromptPathOverrideAllowed;
    private isPathWithinRoot;
    private getPromptPathAllowedRoots;
    private resolvePromptWorkspacePath;
    private isBrowserTaskPrompt;
    /**
     * Returns true when a prompt can be answered directly without the full
     * BMAD operator workflow.  Matches analysis/lookup questions as well as
     * short echo/smoke-test prompts that don't require code generation,
     * file scanning, or infrastructure changes.
     */
    private isOperatorDirectAnswerable;
    /**
     * Returns true when the prompt references code artefacts, file paths,
     * or analysis verbs that require tool-backed file reading to answer
     * correctly.  Used to route operator prompts through the agent loop
     * instead of the toolless BMAD/direct-answer path.
     */
    private isRepoGroundedPrompt;
    private inferAgentTaskType;
    private buildTaskShapingInstructions;
    private buildExecutionPrompt;
    private isProjectBrainRuntimeDisabled;
    private getWorkspaceBrainService;
    private canPromptForWorkspaceIndex;
    private promptWorkspaceIndex;
    private buildProjectBrainRuntimeContext;
    private buildWorkspaceBrainRuntimeContext;
    private rememberBrainEvent;
    private getPromptRuntimeContext;
    private v3IterationCount;
    private v3ToolCallCount;
    private v3LastActivity;
    private v3StreamingStarted;
    /**
     * Strip server-internal path prefixes from tool output strings.
     * Prevents exposing paths like /var/www/V3-Code-Agent/... to end users.
     */
    private sanitizeServerPath;
    private stripHiddenThoughtBlocks;
    private describeV3AgentTool;
    private terminalColumns;
    private fitTerminalText;
    private normalizeToolOutputForDisplay;
    private toolEventKey;
    private isRawV3StreamPayload;
    private consumeV3StreamPayload;
    private writeV3StreamText;
    private displayV3StreamedAnswer;
    private renderAgentAnswerForTerminal;
    private getTerminalContentWidth;
    private sanitizeV3VisibleStreamText;
    private writeAgentActivityLine;
    private updateV3AgentSpinner;
    private updateOperatorSpinner;
    constructor(config: Config, logger: Logger);
    run(options: ChatOptions): Promise<void>;
    /** Handle an inbound admin command from the Commando Bridge. */
    private handleAdminCommand;
    private ensureProjectWorkspace;
    private shouldStartWorkspaceWatcher;
    private resolveProjectPath;
    private shouldUseManagedWorkspace;
    private getManagedWorkspaceRoot;
    private resolveManagedWorkspaceName;
    private slugifyWorkspaceName;
    private allocateManagedWorkspacePath;
    private initializeSession;
    /**
     * Determine whether a direct --prompt call is simple enough to skip the
     * full V3 Agent planner and answer directly via the simple chat pipeline.
     * This prevents trivial prompts like "Reply with OK" from triggering a
     * multi-step planning workflow with quality_profile: premium-visual-build.
     */
    private isSimpleDirectPrompt;
    private handleDirectPrompt;
    private formatWorkflowTargetResult;
    private runWorkflowTargetPrompt;
    private runOperatorTurn;
    /**
     * Fast-path for operator prompts that don't need the full BMAD workflow.
     * Uses the regular chat API with a strong operator system message so
     * the user gets an instant, grounded answer instead of waiting for the
     * BMAD orchestrator to scan the workspace.
     */
    private runOperatorDirectAnswer;
    private runSimplePrompt;
    private runAgentTurn;
    private buildLocalLoopLiveOutcome;
    private persistLocalLoopOutcome;
    private runLocalAgentLoop;
    private primeBypassedTargetFileContext;
    /**
     * Sub-second path for trivial HTML/hello-world: Template Service → index.html (no V3 planner).
     */
    private tryTemplateInstantPath;
    private tryDirectSingleFileFlow;
    private isConfirmationFollowUp;
    private taskRequiresWorkspaceChanges;
    private getPreviousActionablePrompt;
    private buildContextualAgentPrompt;
    private tryV3AgentWorkflow;
    private tryRecoverV3ServiceAndRetry;
    private startInteractiveChat;
    private showHelp;
    /**
     * Print a clear, opinionated end-of-run summary after every agent workflow.
     *
     * Goals:
     *   - User can answer "Did it succeed?" in one glance.
     *   - User can answer "What do I type next?" without reading 200 scrollback lines.
     *   - Never leave the spinners (`⟳`, `–`) ambiguous when the prompt returns.
     */
    private printAgentRunSummary;
    /**
     * Build the prompt sent to the agent when the user types `/retry`.
     * Resumes only the failed/unfinished tasks from the previous run.
     */
    private buildRetryPrompt;
    private computeRetryPromptSignature;
    private buildContinuePrompt;
    /**
     * Re-print the last agent run summary, or guide the user when there isn't one.
     */
    private showAgentRunStatus;
    private showContext;
    private showProjectMemory;
    private compactCurrentSession;
    private ensureAgentSystemPrompt;
    private buildAgentSystemPrompt;
    private buildScopedUserPrompt;
    private inferTargetFilesFromPrompt;
    private inferTargetFileFromPrompt;
    private workspaceContainsHtmlEntry;
    private shouldBypassDirectSingleFileFlow;
    private shouldPreferLocalAgentLoop;
    private getRuntimeEnvironmentContext;
    private shouldRequireV3AgentWorkflow;
    private isServerBindableWorkspace;
    private isProtectedFileReferenceSafe;
    private isProtectedFileReference;
    private buildContinuationPrompt;
    /**
     * Extract Key* / event-handler identifiers from tool results grouped by
     * file, then compute which identifiers actually overlap across files.
     * Returns a formatted hint string, or empty string if not applicable.
     */
    private computeCrossFileKeyEvidence;
    private extractToolCalls;
    private normalizeCliToolName;
    private parseLegacyFunctionToolCalls;
    private parseToolPayload;
    private stripToolPayloads;
    private extractFinalFileContent;
    /**
     * Synthesize a best-effort answer from tool evidence already collected
     * in the message history.  Used as a fallback when the model API fails
     * on a continuation turn after evidence was gathered.
     */
    private synthesizeEvidenceFromHistory;
    private resolveDirectModeCompletion;
    /**
     * Strip system-prompt echoes, tool execution headers, grounding-rule
     * parroting, recovery banners, and multi-line tool output blocks from
     * the model's final answer so that --json output contains only the
     * substantive answer.
     */
    private sanitizeDirectModeOutput;
    private isDirectModeFollowUpQuestion;
    private buildLocalAnalysisFallback;
    private tryDeterministicSingleFileRewrite;
    private extractExactTextRequirement;
    private executeToolCalls;
    private formatToolResult;
    private truncateText;
    private getLastUserPrompt;
    private saveSession;
    private requestPermission;
    getCurrentSessionInfo(): string;
    getChatHistory(): ChatMessage[];
}
export {};
