import type { TranscriptEntry } from "@rudderhq/agent-runtime-utils";
import type { Db } from "@rudderhq/db";
import { heartbeatRuns } from "@rudderhq/db";
import type { ChatConversation, HeartbeatRun } from "@rudderhq/shared";
import type { AgentRuntimeInvocationMeta } from "../agent-runtimes/index.js";
type RuntimeSkillSummary = Array<{
    key: string;
    runtimeName?: string | null;
    name?: string | null;
    description?: string | null;
}>;
export declare function chatAgentRunService(db: Db): {
    appendAdapterInvoke: (run: Pick<typeof heartbeatRuns.$inferSelect, "id" | "orgId" | "agentId">, meta: AgentRuntimeInvocationMeta, runtimeSkills: RuntimeSkillSummary) => Promise<void>;
    appendEvent: (run: Pick<typeof heartbeatRuns.$inferSelect, "id" | "orgId" | "agentId">, event: {
        eventType: string;
        stream?: "system" | "stdout" | "stderr";
        level?: "info" | "warn" | "error";
        message?: string;
        payload?: Record<string, unknown>;
    }) => Promise<void>;
    appendTranscriptEntry: (run: Pick<typeof heartbeatRuns.$inferSelect, "id" | "orgId" | "agentId">, entry: TranscriptEntry) => Promise<void>;
    createRun: (input: {
        conversation: Pick<ChatConversation, "id" | "orgId" | "primaryIssueId" | "planMode">;
        agentId: string;
        triggerDetail: "chat_assistant_reply" | "chat_assistant_reply_stream";
        userMessageId?: string | null;
        chatTurnId?: string | null;
        turnVariant?: number | null;
        linkedIssueIds: string[];
        linkedProjectId: string | null;
        runContext?: Record<string, unknown> | null;
        sourceMetadata?: Record<string, unknown> | null;
    }) => Promise<HeartbeatRun>;
    finalizeRun: (runId: string, input: {
        status: "succeeded" | "failed" | "cancelled" | "timed_out";
        error?: string | null;
        errorCode?: string | null;
        resultJson?: Record<string, unknown> | null;
        usageJson?: Record<string, unknown> | null;
    }) => Promise<HeartbeatRun | null>;
    finalizeStaleRuns: (input?: {
        conversationId?: string | null;
        olderThanMs?: number;
        error?: string;
        errorCode?: string;
    }) => Promise<number>;
    linkAssistantMessage: (runId: string, conversationId: string, messageId: string) => Promise<{
        id: string;
        orgId: string;
        conversationId: string;
        role: string;
        kind: string;
        status: string;
        body: string;
        structuredPayload: Record<string, unknown> | null;
        approvalId: string | null;
        runId: string | null;
        replyingAgentId: string | null;
        chatTurnId: string | null;
        turnVariant: number;
        supersededAt: Date | null;
        createdAt: Date;
        updatedAt: Date;
    } | null>;
};
export {};
//# sourceMappingURL=chat-agent-runs.d.ts.map