import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js"; import { MessageContent, MessageMetadata, MessageVisibility, PaginationConfig } from "../../types/utility.js"; import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js"; import "../../types/index.js"; import "../../index.js"; import { MessageInsert, MessageUpdate } from "../../types/entities.js"; //#region src/data-access/runtime/messages.d.ts declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; messageId: string; }) => Promise<{ id: string; createdAt: string; updatedAt: string; metadata: MessageMetadata | null; role: string; content: MessageContent; projectId: string; tenantId: string; properties: Record | null; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; taskId: string | null; a2aTaskId: string | null; conversationId: string; userProperties: Record | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; visibility: string; messageType: string; parentMessageId: string | null; a2aSessionId: string | null; } | undefined>; declare const listMessages: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; pagination: PaginationConfig; }) => Promise<{ createdAt: string; updatedAt: string; conversationId: string; role: string; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; content: MessageContent; visibility: string; messageType: string; taskId: string | null; parentMessageId: string | null; a2aTaskId: string | null; a2aSessionId: string | null; metadata: MessageMetadata | null; userProperties: Record | null; properties: Record | null; projectId: string; tenantId: string; id: string; }[]>; declare const getMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; conversationId: string; pagination: PaginationConfig; }) => Promise<{ createdAt: string; updatedAt: string; conversationId: string; role: string; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; content: MessageContent; visibility: string; messageType: string; taskId: string | null; parentMessageId: string | null; a2aTaskId: string | null; a2aSessionId: string | null; metadata: MessageMetadata | null; userProperties: Record | null; properties: Record | null; projectId: string; tenantId: string; id: string; }[]>; /** * Batch-fetch the earliest `user` message for each of the given conversations in a single * query (Postgres `DISTINCT ON`), returning one row per conversation. * * Set-based alternative to calling {@link getMessagesByConversation} once per conversation * and reducing in JS, which fanned out two connection acquisitions per conversation and * exhausted the runtime DB pool when enriching large evaluation-result sets. */ declare const getFirstUserMessageByConversations: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; conversationIds: string[]; }) => Promise<{ conversationId: string; content: MessageContent; }[]>; /** * Batch-fetch the latest assistant/agent message for each of the given conversations in a * single query (Postgres `DISTINCT ON`), returning one row per conversation. * * Set-based alternative to the per-conversation lookup used when enriching dataset-run items * with their agent output. */ declare const getLastAssistantMessageByConversations: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; conversationIds: string[]; }) => Promise<{ conversationId: string; content: MessageContent; }[]>; declare const getMessagesByTask: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; taskId: string; pagination: PaginationConfig; }) => Promise<{ createdAt: string; updatedAt: string; conversationId: string; role: string; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; content: MessageContent; visibility: string; messageType: string; taskId: string | null; parentMessageId: string | null; a2aTaskId: string | null; a2aSessionId: string | null; metadata: MessageMetadata | null; userProperties: Record | null; properties: Record | null; projectId: string; tenantId: string; id: string; }[]>; declare const getVisibleMessages: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; conversationId: string; visibility?: MessageVisibility[]; pagination: PaginationConfig; }) => Promise<{ createdAt: string; updatedAt: string; conversationId: string; role: string; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; content: MessageContent; visibility: string; messageType: string; taskId: string | null; parentMessageId: string | null; a2aTaskId: string | null; a2aSessionId: string | null; metadata: MessageMetadata | null; userProperties: Record | null; properties: Record | null; projectId: string; tenantId: string; id: string; }[]>; declare const createMessage: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; data: Omit; }) => Promise<{ id: string; createdAt: string; updatedAt: string; metadata: MessageMetadata | null; role: string; content: MessageContent; projectId: string; tenantId: string; properties: Record | null; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; taskId: string | null; a2aTaskId: string | null; conversationId: string; userProperties: Record | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; visibility: string; messageType: string; parentMessageId: string | null; a2aSessionId: string | null; }>; declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; messageId: string; data: MessageUpdate; }) => Promise<{ createdAt: string; updatedAt: string; conversationId: string; role: string; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; content: MessageContent; visibility: string; messageType: string; taskId: string | null; parentMessageId: string | null; a2aTaskId: string | null; a2aSessionId: string | null; metadata: MessageMetadata | null; userProperties: Record | null; properties: Record | null; projectId: string; tenantId: string; id: string; }>; declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; messageId: string; }) => Promise<{ id: string; createdAt: string; updatedAt: string; metadata: MessageMetadata | null; role: string; content: MessageContent; projectId: string; tenantId: string; properties: Record | null; fromSubAgentId: string | null; toSubAgentId: string | null; fromExternalAgentId: string | null; toExternalAgentId: string | null; taskId: string | null; a2aTaskId: string | null; conversationId: string; userProperties: Record | null; fromTeamAgentId: string | null; toTeamAgentId: string | null; visibility: string; messageType: string; parentMessageId: string | null; a2aSessionId: string | null; }>; declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; conversationId: string; }) => Promise; declare const countVisibleMessages: (db: AgentsRunDatabaseClient) => (params: { scopes: ProjectScopeConfig; conversationId: string; visibility?: MessageVisibility[]; }) => Promise; //#endregion export { countMessagesByConversation, countVisibleMessages, createMessage, deleteMessage, getFirstUserMessageByConversations, getLastAssistantMessageByConversations, getMessageById, getMessagesByConversation, getMessagesByTask, getVisibleMessages, listMessages, updateMessage };