import type { Db } from "@rudderhq/db";
import { type ChatStreamTranscriptEntry } from "@rudderhq/shared";
import { chatContextLinks, chatConversations, chatMessages } from "@rudderhq/db";
type ConversationRow = typeof chatConversations.$inferSelect;
type MessageRow = typeof chatMessages.$inferSelect;
type ContextLinkRow = typeof chatContextLinks.$inferSelect;
export declare const CHAT_TRANSCRIPT_KEY = "__chatTranscript";
declare const ISSUE_PROPOSAL_PRIORITIES: readonly ["critical", "high", "medium", "low"];
type ChatIssueProposalPriority = typeof ISSUE_PROPOSAL_PRIORITIES[number];
export type ChatIssueProposalPayload = {
    title: string;
    description: string;
    priority: ChatIssueProposalPriority;
    projectId: string | null;
    goalId: string | null;
    parentId: string | null;
    assigneeAgentId: string | null;
    assigneeUserId: string | null;
    reviewerAgentId: string | null;
    reviewerUserId: string | null;
    labelIds?: string[];
};
export declare function isIssueProposalPriority(value: unknown): value is ChatIssueProposalPriority;
export declare function contentPath(assetId: string): string;
export declare function safeTrim(value: string | null | undefined): string | null;
export declare function isVisibleIncomingChatMessage(message: Pick<MessageRow, "role" | "kind" | "body" | "approvalId">): boolean;
export declare function visibleIncomingMessageSql(): import("drizzle-orm").SQL<unknown>;
export declare function incomingMessagePreviewSql(): import("drizzle-orm").SQL<unknown>;
export declare function truncatePreview(value: string | null | undefined, max?: number): string | null;
export declare function escapeLikePattern(value: string): string;
export declare function textContains(value: string | null | undefined, query: string): value is string;
export declare function buildSearchSnippet(value: string, query: string, maxLength?: number): string;
export declare function chatTranscriptFromPayload(payload: Record<string, unknown> | null | undefined): ChatStreamTranscriptEntry[];
export declare function stripChatMetadataFromPayload(payload: Record<string, unknown> | null | undefined): Record<string, unknown> | null;
export declare function withPersistedTranscript(payload: Record<string, unknown> | null | undefined, transcript: ChatStreamTranscriptEntry[] | null | undefined): Record<string, unknown> | null;
export declare function issueProposalFromPayload(payload: Record<string, unknown> | null | undefined): ChatIssueProposalPayload | null;
export declare function planDocumentFromPayload(payload: Record<string, unknown> | null | undefined, fallbackBody?: string | null): {
    title: string;
    body: string;
    changeSummary: string;
} | null;
export declare function operationProposalFromPayload(payload: Record<string, unknown> | null | undefined): {
    targetType: string;
    targetId: string;
    summary: string;
    patch: Record<string, unknown>;
} | null;
export declare function operationProposalDecisionStatusFromPayload(payload: Record<string, unknown> | null | undefined): {
    readonly status: string;
    readonly decisionNote: string | null;
    readonly decidedByUserId: string | null;
    readonly decidedAt: string | null;
};
export declare function withOperationProposalDecisionState(payload: Record<string, unknown> | null | undefined, state: {
    status: "pending" | "approved" | "rejected" | "revision_requested";
    decisionNote: string | null;
    decidedByUserId: string | null;
    decidedAt: string | null;
}): {
    operationProposalState: {
        status: "pending" | "approved" | "rejected" | "revision_requested";
        decisionNote: string | null;
        decidedByUserId: string | null;
        decidedAt: string | null;
    };
};
export declare function resolveContextEntities(db: Db, rows: ContextLinkRow[]): Promise<{
    entity: {
        type: "issue" | "project" | "agent";
        id: string;
        label: string;
        subtitle: string | null;
        identifier: string | null;
        status: string | null;
        description?: string | null;
        priority?: string | null;
        href: string;
    } | null;
    createdAt: Date;
    metadata: Record<string, unknown> | null;
    id: string;
    updatedAt: Date;
    orgId: string;
    entityType: string;
    entityId: string;
    conversationId: string;
}[]>;
export declare function listContextLinksForConversationIds(db: Db, conversationIds: string[]): Promise<Map<string, {
    entity: {
        type: "issue" | "project" | "agent";
        id: string;
        label: string;
        subtitle: string | null;
        identifier: string | null;
        status: string | null;
        description?: string | null;
        priority?: string | null;
        href: string;
    } | null;
    createdAt: Date;
    metadata: Record<string, unknown> | null;
    id: string;
    updatedAt: Date;
    orgId: string;
    entityType: string;
    entityId: string;
    conversationId: string;
}[]>>;
export declare function listPrimaryIssues(db: Db, conversationRows: ConversationRow[]): Promise<Map<string, {
    id: string;
    identifier: string | null;
    title: string;
    status: string;
    priority: string;
}>>;
export {};
//# sourceMappingURL=chats.helpers.d.ts.map