import { PrismaService } from "../../../core/database/prisma/prisma.service";
import type { AgentMessage, AgentMessageType } from '@prisma/client';
import { ProviderRegistry } from '../providers/provider-registry.service';
import { ModelRouter } from '../router/model-router.service';
import type { RoutingRequest } from '../router/routing.types';
import { TrajectoryService } from '../trajectory/trajectory.service';
import { QuotaService } from '../quota/quota.service';
import { QueryEngine } from '../engine/query-engine.service';
import { ToolRegistry } from '../tools/tool-registry.service';
import { AgentArtifactService } from '../artifact/artifact.service';
import { AgentMemoriesService } from './memories.service';
import { HooksRegistry } from '../hooks/hooks.registry';
export type StreamEvent = {
    type: 'message';
    message: AgentMessage;
} | {
    type: 'text_delta';
    text: string;
    iter: number;
} | {
    type: 'routing';
    decision: unknown;
    decisionId: string;
} | {
    type: 'ask_user';
    turnId: string;
    question: string;
    options?: string[];
} | {
    type: 'done';
    turnId: string;
    totalLatencyMs: number;
    iterations: number;
} | {
    type: 'error';
    message: string;
};
export interface AppendMessageInput {
    sessionId: string;
    organizationId: string;
    turnId: string;
    type: AgentMessageType;
    content?: string;
    payload?: unknown;
    model?: string;
}
export declare class AgentMessagesService {
    private readonly prisma;
    private readonly providerRegistry;
    private readonly modelRouter;
    private readonly trajectory;
    private readonly quota;
    private readonly queryEngine;
    private readonly toolRegistry;
    private readonly artifactService;
    private readonly memoriesService;
    private readonly hooks;
    constructor(prisma: PrismaService, providerRegistry: ProviderRegistry, modelRouter: ModelRouter, trajectory: TrajectoryService, quota: QuotaService, queryEngine: QueryEngine, toolRegistry: ToolRegistry, artifactService: AgentArtifactService, memoriesService: AgentMemoriesService, hooks: HooksRegistry);
    private maybeCreateArtifact;
    appendMessage(input: AppendMessageInput): Promise<AgentMessage>;
    private readonly activeTurns;
    cancelTurn(turnId: string, orgId: string): {
        cancelled: boolean;
    };
    private assertSessionOwnership;
    runTurn(args: {
        sessionId: string;
        organizationId: string;
        userId: string;
        prompt: string;
        projectId?: string;
        surface?: RoutingRequest['surface'];
    }): Promise<{
        turnId: string;
        messages: AgentMessage[];
    }>;
    runTurnStream(args: {
        sessionId: string;
        organizationId: string;
        userId: string;
        prompt: string;
        projectId?: string;
        surface?: RoutingRequest['surface'];
    }): AsyncGenerator<StreamEvent, void, void>;
    private buildSystemContent;
    runMockTurn(args: {
        sessionId: string;
        organizationId: string;
        prompt: string;
    }): Promise<{
        turnId: string;
        messages: AgentMessage[];
    }>;
}
