type GuardrailResult = {
    blocked: boolean;
    response: string;
    reason: string;
};
type AttachmentInput = {
    id?: string;
    name?: string;
    type?: string;
    size?: number;
    local_path?: string;
};
type AiCodexRunInput = {
    id_conversation?: string;
    id_client?: string;
    id_app?: string;
    message: string;
    request_id?: string;
    guardrails?: boolean;
    config?: {
        mode?: string;
        model?: string;
        fallback_model?: string;
        fallback_models?: string[] | string;
        fallbackModel?: string;
        fallbackModels?: string[] | string;
        guardrails?: boolean;
        planner_enabled?: boolean;
        plannerEnabled?: boolean;
        fast_mode?: boolean;
        fastMode?: boolean;
        always_allow_probe?: boolean;
        alwaysAllowProbe?: boolean;
        run_budget_ms?: number;
        runBudgetMs?: number;
        mongo_max_time_ms?: number;
        mongoMaxTimeMs?: number;
        qa_repair_enabled?: boolean;
        qaRepairEnabled?: boolean;
        qa_evidence_required?: boolean;
        qaEvidenceRequired?: boolean;
        qa_distinct_screenshot_required?: boolean;
        qaDistinctScreenshotRequired?: boolean;
        qa_fail_fast_compile?: boolean;
        qaFailFastCompile?: boolean;
        qa_live_data_required?: boolean;
        qaLiveDataRequired?: boolean;
        qa_self_repair_max_waves?: number;
        qaSelfRepairMaxWaves?: number;
        qa_policy_instructions?: string[];
        qaPolicyInstructions?: string[];
        system_prompt?: string;
        system_prompt_additions?: string[] | string;
        systemPrompt?: string;
        systemPromptAdditions?: string[] | string;
        data_request_classifier_enabled?: boolean;
        dataRequestClassifierEnabled?: boolean;
        data_request_classifier_model?: string;
        dataRequestClassifierModel?: string;
        data_request_classifier_timeout_ms?: number;
        dataRequestClassifierTimeoutMs?: number;
        app_instructions?: string[] | string;
        appInstructions?: string[] | string;
        assistant_instructions?: string[] | string;
        assistantInstructions?: string[] | string;
        user_prompt_template?: string;
        userPromptTemplate?: string;
    };
    context?: {
        mode?: string;
        route?: string;
    };
    mongo?: {
        database?: string;
        databases?: string[];
        access?: string;
        readonly?: boolean;
    };
    attachments?: AttachmentInput[];
    delete_files_after_run?: boolean;
    max_history?: number;
};
type AiAssistantCollectionRetryState = {
    triedCollections?: string[];
    disableCrossCollectionRetry?: boolean;
    rootCollection?: string;
};
type AiAssistantRuntimeControl = {
    fastMode?: boolean;
    deadlineMs?: number;
    maxTimeMS?: number;
};
type AiAssistantDirectiveHints = {
    collectionHints?: string[];
    rankedCollections?: string[];
    fieldHints?: string[];
    schemaHints?: string[];
};
type AiAssistantAppDataDimension = {
    id: string;
    type?: 'entity' | 'time';
    granularity?: string;
    requestedText?: string;
    terms: string[];
    groupId: any;
    project?: Record<string, any>;
    sort?: Record<string, any>;
    preGroupStages?: Record<string, any>[];
};
type AiAssistantAppDataFilterField = {
    id: string;
    terms: string[];
    fields: string[];
    type?: 'string' | 'number' | 'boolean' | 'date';
    operators: string[];
};
type AiAssistantDataRequestBreakdownContract = {
    type: 'entity' | 'time' | 'unknown';
    requested_text: string;
    dimension?: string;
    granularity?: string;
    field_hint?: string;
    field_hints?: string[];
};
type AiAssistantDataRequestContract = {
    intent_type: 'data_summary';
    intent_id?: string;
    domain: string;
    collection?: string;
    operation: 'aggregate';
    requested_breakdowns: AiAssistantDataRequestBreakdownContract[];
    date_range: {
        start?: string;
        end?: string;
        year?: number;
    } | null;
    measures: string[];
    filters: Array<Record<string, any>>;
    output_format: 'collapse_table';
    user_progress?: string[];
    ambiguities: string[];
    confidence: number;
    source: string;
};
type AiAssistantDataRequestUnderstanding = {
    dimensions: AiAssistantAppDataDimension[];
    contract: AiAssistantDataRequestContract;
};
type AiAssistantAppDataIntentCandidate = {
    intent: AiAssistantAppDataIntent;
    score: number;
};
type AiAssistantHeuristicDirectiveOptions = {
    appDataIntent?: AiAssistantAppDataIntent | null;
    appDataRequestContract?: AiAssistantDataRequestContract | null;
    appDataRequestUnderstanding?: AiAssistantDataRequestUnderstanding | null;
    appDataRequestClassifier?: Record<string, any> | null;
};
type AiAssistantAppDataIntent = {
    id: string;
    terms: string[];
    excludeTerms: string[];
    collection: string;
    domain?: string;
    name?: string;
    description?: string;
    sourceFamily?: string;
    workflowKind?: string;
    semanticOnly?: boolean;
    semanticOverlay?: boolean;
    semanticExamples: string[];
    semanticMeasures: string[];
    entityTypes: string[];
    permissionView?: string;
    dateField?: string;
    quantityField?: string;
    metricField?: string;
    fallbackCollections: string[];
    progress: string[];
    acknowledgement?: string;
    assumptions: string[];
    dimensions: AiAssistantAppDataDimension[];
    filterFields: AiAssistantAppDataFilterField[];
    pipeline?: Record<string, any>[];
    options?: Record<string, any>;
};
export type AiAssistantAppCollectionPreserveRule = {
    id?: string;
    routePreferredCollections: string[];
    routePatterns: string[];
    requestedCollections: string[];
    contextTerms: string[];
    terms: string[];
};
export type AiAssistantMongoReadInput = {
    database?: string;
    collection?: string;
    query?: Record<string, any>;
    options?: {
        projection?: Record<string, number | boolean>;
        sort?: Record<string, any>;
        limit?: number;
        skip?: number;
        includeTotal?: boolean;
        includeIds?: boolean;
        export?: boolean;
    };
    permissionView?: string;
    id_client?: string;
    id_app?: string;
    mongo?: {
        database?: string;
        databases?: string[];
        access?: string;
        readonly?: boolean;
    };
    __assistantRetryState?: AiAssistantCollectionRetryState;
    __assistantRuntime?: AiAssistantRuntimeControl;
    __assistantHints?: AiAssistantDirectiveHints;
};
export type AiAssistantMongoAggregateInput = {
    database?: string;
    collection?: string;
    query?: Record<string, any>;
    pipeline?: Array<Record<string, any>>;
    options?: {
        allowDiskUse?: boolean;
        maxTimeMS?: number;
        limit?: number;
        includeIds?: boolean;
        export?: boolean;
        disableNoDataFallbacks?: boolean;
    };
    permissionView?: string;
    id_client?: string;
    id_app?: string;
    mongo?: {
        database?: string;
        databases?: string[];
        access?: string;
        readonly?: boolean;
    };
    __assistantMessage?: string;
    __assistantRetryState?: AiAssistantCollectionRetryState;
    __assistantRuntime?: AiAssistantRuntimeControl;
    __assistantHints?: AiAssistantDirectiveHints;
};
type AiAssistantDisplayTable = {
    columns: string[];
    rows: Array<Record<string, any>>;
    rowCount: number;
    total?: number | null;
    truncated?: boolean;
    includeIds?: boolean;
};
type AssistantMongoDirective = {
    type: 'read' | 'aggregate';
    payload: Record<string, any> | null;
    cleaned: string;
    rawLine: string;
    metadata?: Record<string, any>;
};
type AssistantRequestType = 'data' | 'navigation' | 'feature_info' | 'bug_issue' | 'mixed' | 'unknown';
type AssistantRequestTypeSource = 'heuristic' | 'planner' | 'merged';
type AssistantRequestClassification = {
    type: AssistantRequestType;
    dataQuestion: boolean;
    source: AssistantRequestTypeSource;
    plannerIntentType?: string;
};
type AssistantNavigationFastPathResult = {
    response: string;
    routes: string[];
    reason: 'explicit' | 'ranked' | 'permission_denied' | 'no_access' | 'app_route_intent';
};
type AssistantChangeModule = 'invoice' | 'work_order' | 'delivery' | 'blend' | 'job' | 'customer' | 'chemical' | 'portal' | 'general' | 'internal';
type AssistantChangeHistoryCommit = {
    date: string;
    subject: string;
    files: string[];
    modules: AssistantChangeModule[];
};
type AssistantChangeHistoryFastPathResult = {
    response: string;
    reason: 'detailed' | 'generic' | 'no_repo' | 'error';
    commitCount: number;
    generic: boolean;
    branch?: string;
};
export declare function loadAiTerminalMethods(methodManager: any): void;
export declare function executeAiAssistantMongoRead(payload: AiAssistantMongoReadInput, context: any): Promise<any>;
export declare function executeAiAssistantMongoAggregate(payload: AiAssistantMongoAggregateInput, context: any): Promise<any>;
export declare function extractAssistantMongoDirective(content: string): AssistantMongoDirective | null;
export declare function buildAssistantToolRequest(directive: AssistantMongoDirective, payload: AiCodexRunInput, hints?: AiAssistantDirectiveHints): Record<string, any>;
export declare function shouldPreserveAssistantProbeCollectionForTesting(directive: any, resolvedCollection: string, probeResponse?: any): boolean;
export declare function buildAssistantAnswerQualityFromExecution(input?: Record<string, any>): Record<string, any>;
export declare function buildAssistantInvoiceCustomerLabelExpr(): Record<string, any>;
export declare function adjustAssistantClassifiedAppDataIntentForTesting(intent: AiAssistantAppDataIntent | null, candidates: AiAssistantAppDataIntentCandidate[], raw: any, message: string): AiAssistantAppDataIntent | null;
export declare function resolveAssistantHeuristicDirectiveForTesting(message: string, collectionHints: string[], collectionNames?: string[], appId?: string, options?: AiAssistantHeuristicDirectiveOptions): any;
export declare function buildAssistantDataRequestClassifierMessagesForTesting(params: {
    message: string;
    appId?: string;
    collectionNames?: string[];
}): any;
export declare function buildAssistantDatedPivotDisplay(display: AiAssistantDisplayTable, expectedMonths?: string[]): AiAssistantDisplayTable | null;
export declare function buildAssistantToolFallbackResponseForTesting(result: any): string;
export declare function deriveAssistantCommandExecutionStatus(commandValue: any): string;
export declare function expandAssistantFieldTokensForTesting(tokens: string[], appId?: string): string[];
export declare function normalizeIdsForTargetField(ids: any[], targetDocs: any[], targetFieldPath: string, targetFieldTypeOverride?: 'objectId' | 'string' | 'unknown'): any[];
export declare function serializeMongoValue(value: any, maxLength?: number): string | number | boolean | null;
export declare function flattenForTable(doc: any, options?: {
    includeGroupFromId?: boolean;
    includeIds?: boolean;
}): Record<string, any>;
export declare function buildDisplayTable(docs: any[], options?: {
    maxColumns?: number;
    maxRows?: number;
    includeIds?: boolean;
    priorityFields?: string[];
    includeGroupFromId?: boolean;
}): AiAssistantDisplayTable;
export declare function formatDisplayTableMarkdown(display: AiAssistantDisplayTable): string;
export declare function applyAssistantDisplayTableToResponseForTesting(value: string, display: AiAssistantDisplayTable | null | undefined): string;
export declare function resolveAssistantReadDisplayMaxRows(limit: number | undefined, rowCount: number): number;
export declare function normalizeAssistantNowExprPlaceholders(value: any): any;
export declare function repairAssistantPositionalPathSegmentsInPipeline(pipeline: Array<Record<string, any>>): {
    pipeline: Array<Record<string, any>>;
    changed: boolean;
};
export declare function repairAssistantFieldPathReferenceInPipeline(pipeline: Array<Record<string, any>>, fieldPath: string): {
    pipeline: Array<Record<string, any>>;
    changed: boolean;
};
export declare function rewriteMatchExpressionsToExpr(match: any): any;
export declare function normalizeAssistantMonthlyCalendarWindowPipeline(pipeline: Array<Record<string, any>>): Array<Record<string, any>>;
export declare function normalizeAssistantAggregatePipeline(pipeline?: Array<Record<string, any>>, collection?: string, originalMessage?: string): Array<Record<string, any>>;
export declare function resolveReadMultiTermJobRegexFallbackForTesting(query: Record<string, any>, probeDocs?: any[], schemaFields?: string[]): {
    query: Record<string, any>;
    fields: string[];
    sourceFields: string[];
    terms: string[];
} | null;
export declare function stripQueryFieldPathsDeep(query: any, fieldsToStrip: string[]): any;
export declare function stripScopedFieldsFromPipeline(pipeline: any[], fieldsToStrip: string[]): any[];
export declare function rewriteEmbeddedMatchObjects(query: any): any;
export declare function resolveAssistantAppCollectionHintCandidates(message: string, appId?: string): string[];
export declare function isAssistantDeterministicHeuristicEnabledForApp(heuristicId: string, appId?: string): boolean;
export declare function resolveCollectionOverrideWithContextForTesting(params: {
    message: string;
    collectionRanking: Record<string, any> | null;
    requestedCollection: string;
    permissionView?: string;
    collectionNames: string[];
    collectionHints?: string[];
    appId?: string;
    collectionPreserveRules?: AiAssistantAppCollectionPreserveRule[];
    directiveType?: string;
}): {
    from: string;
    to: string;
    fromScore: number;
    toScore: number;
    reason: string;
} | null;
export declare function resolveAssistantCollectionOverride(collectionRanking: Record<string, any> | null, currentCollection: string): {
    from: string;
    to: string;
    fromScore: number;
    toScore: number;
    reason: string;
} | null;
export declare function resolveAssistantCollectionNameForTesting(db: any, dbName: string, requested: string, appId?: string): Promise<{
    name: string;
    matched: boolean;
    candidates: string[];
    score: number;
}>;
export declare function shouldLockAssistantRequestedCollectionForExecutionForTesting(requestedCollection: string, permissionView?: string, requestHints?: any): boolean;
export declare function resolveAssistantCrossCollectionFallbackCandidates(collection: string): string[];
export declare function resolveAssistantAvailableCrossCollectionFallbacksFromNames(collection: string, triedCollections: Set<string>, collectionNames: string[], options?: {
    fieldHints?: string[];
}): string[];
type AssistantFallbackAcceptanceOptions = {
    requireDimensionFields?: boolean;
    minDimensionFillRate?: number;
    preferredDimensionFields?: string[];
};
export declare function evaluateAssistantFallbackDocumentsQuality(documents: any[], options?: AssistantFallbackAcceptanceOptions): {
    accepted: boolean;
    rowCount: number;
    dimensionFields: string[];
    bestField?: string;
    bestFillRate: number;
    averageFillRate: number;
};
export declare function shouldAcceptAssistantFallbackDocuments(documents: any[], options?: AssistantFallbackAcceptanceOptions): boolean;
export declare function resolveAssistantReportBuilderBridgeCollection(collection: string, db?: any, dbName?: string, options?: {
    requestHints?: AiAssistantDirectiveHints;
    appId?: string;
}): Promise<{
    collection: string;
    fallbackFrom?: string;
    mode: 'report-builder' | 'direct-mongo';
    resolutionPath: string[];
}>;
export declare function expandAggregateDateMatchFallbackForTesting(pipeline: Array<Record<string, any>>, schemaFields?: string[]): {
    pipeline: Array<Record<string, any>>;
    fields: string[];
} | null;
export declare function collectUserViewPermissions(user: any): string[];
export declare function userHasInvoiceAccess(user: any): boolean;
export declare function resolveAssistantUserAccessTier(user: any): 'super_admin' | 'customer_portal' | 'client_user';
export declare function resolveCodexThoughtLevel(params?: {
    message?: string;
    attachmentText?: string;
    requestType?: AssistantRequestType;
}): 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
export declare function buildAssistantWorkspaceRootCandidates(params?: {
    serverConfig?: Record<string, any>;
    env?: Record<string, any>;
    cwd?: string;
    dirname?: string;
}): string[];
export declare function classifyAssistantRequestType(message: string, plannerOutput?: any): AssistantRequestClassification;
export declare function shouldRunAssistantPlanner(params: {
    plannerEnabled: boolean;
    requestClassification: AssistantRequestClassification;
    hasDeterministicHeuristicFastPath: boolean;
}): boolean;
export declare function shouldEnforceAssistantDatedDirective(message: string, plannerOutput: any, requestClassification: AssistantRequestClassification): boolean;
export declare function buildAssistantSchemaHints(collectionNames: string[], options?: {
    maxCollections?: number;
    maxFields?: number;
    maxLookups?: number;
}): string[];
export declare function collectAssistantAllowedRoutesForUser(user: any, allRoutes: string[], isSuperAdmin: boolean): string[];
export declare function rankAssistantNavigationRoutes(message: string, routes: string[], limit?: number): string[];
export declare function shouldUseAssistantNavigationFastPath(message: string, hasAttachments?: boolean): boolean;
export declare function evaluateAssistantNavigationFastPathWithRoutes(params: {
    message: string;
    hasAttachments: boolean;
    allowedRoutes: string[];
    contextRoute?: string;
    appId?: string;
}): AssistantNavigationFastPathResult | null;
export declare function shouldUseAssistantChangeHistoryFastPath(message: string, hasAttachments?: boolean): boolean;
export declare function buildAssistantChangeHistorySummaryFromCommits(params: {
    message: string;
    user: any;
    isSuperAdmin: boolean;
    commits: AssistantChangeHistoryCommit[];
    branch?: string;
    repositoryName?: string;
    now?: Date;
}): AssistantChangeHistoryFastPathResult;
export declare function evaluateAssistantGuardrailsForTesting(message: string): GuardrailResult | null;
export declare function buildAssistantSystemPromptForTesting(): string;
export {};
