/** * ADR 0009 D4 — new persistence models (agent_* + im_transcripts). */ import type { AgentMessage } from '../llm/types/agent-message.js'; import { type AgentMessageExtra } from './sender-extra.js'; export declare const IM_TRANSCRIPT_MODEL: { message_id: { type: "text"; default: string; }; platform: { type: "text"; nullable: boolean; }; endpoint_id: { type: "text"; nullable: boolean; }; scene_id: { type: "text"; nullable: boolean; }; scene_type: { type: "text"; nullable: boolean; }; sender_id: { type: "text"; nullable: boolean; }; sender_name: { type: "text"; default: string; }; sender_role: { type: "text"; default: string; }; direction: { type: "text"; nullable: boolean; }; body: { type: "text"; default: string; }; media_json: { type: "text"; default: string; }; time: { type: "integer"; nullable: boolean; }; }; export type ImTranscriptDirection = 'inbound' | 'outbound'; export interface ImTranscriptRecord { id?: number; message_id?: string; platform: string; endpoint_id: string; scene_id: string; scene_type: string; sender_id: string; sender_name: string; sender_role: string; direction: ImTranscriptDirection; body: string; media_json: string; time: number; } export interface ImTranscriptWriteInput { message_id?: string; platform: string; endpoint_id: string; scene_id: string; scene_type: string; sender_id: string; sender_name?: string; sender_role?: string; direction: ImTranscriptDirection; body: string; media_json?: string; time?: number; } export type AgentSessionStatus = 'active' | 'archived'; export declare const AGENT_SESSION_MODEL: { session_id: { type: "text"; nullable: boolean; }; session_key: { type: "text"; nullable: boolean; }; platform: { type: "text"; nullable: boolean; }; endpoint_id: { type: "text"; nullable: boolean; }; scene_id: { type: "text"; nullable: boolean; }; scene_type: { type: "text"; nullable: boolean; }; model: { type: "text"; default: string; }; status: { type: "text"; default: string; }; active_leaf_message_id: { type: "integer"; nullable: boolean; }; created_at: { type: "integer"; default: number; }; updated_at: { type: "integer"; default: number; }; }; export interface AgentSessionRecord { id?: number; session_id: string; session_key: string; platform: string; endpoint_id: string; scene_id: string; scene_type: string; model: string; status: AgentSessionStatus; active_leaf_message_id?: number | null; created_at: number; updated_at: number; } export interface CreateAgentSessionInput { session_key: string; platform: string; endpoint_id: string; scene_id: string; scene_type: string; model?: string; } export declare const AGENT_MESSAGE_MODEL: { id: { type: "integer"; primary: boolean; autoIncrement: boolean; }; session_id: { type: "text"; nullable: boolean; }; role: { type: "text"; nullable: boolean; }; payload: { type: "text"; nullable: boolean; }; parent_id: { type: "integer"; nullable: boolean; }; /** JSON:群/频道 user 消息的 sender 元数据(id/name/roles/scope),payload 仅存用户正文 */ extra: { type: "text"; default: string; }; timestamp: { type: "integer"; nullable: boolean; }; }; export interface AgentMessageRow { id?: number; session_id: string; role: string; /** DB 读出时可能已被方言解析为对象(SQLite JSON 字段) */ payload: string | AgentMessage; parent_id?: number | null; extra?: string | AgentMessageExtra | null; timestamp: number; } export type { AgentMessageExtra, AgentMessageSenderExtra, SenderScope } from './sender-extra.js'; export declare function serializeAgentMessage(message: AgentMessage, extra?: AgentMessageExtra): AgentMessageRow; /** 读出 DB 行:payload 为用户可见正文(不含 sender 前缀) */ export declare function parseAgentMessageRow(row: AgentMessageRow): AgentMessage | null; /** 加载 LLM 上下文:按需从 `extra` 拼接 sender 前缀 */ export declare function agentMessageRowToLlm(row: AgentMessageRow): AgentMessage | null; export declare const AGENT_SUMMARY_MODEL: { session_id: { type: "text"; nullable: boolean; }; summary: { type: "text"; nullable: boolean; }; anchor_message_id: { type: "integer"; nullable: boolean; }; branch_anchor_message_id: { type: "integer"; nullable: boolean; }; created_at: { type: "integer"; default: number; }; }; export interface AgentSummaryRecord { id?: number; session_id: string; summary: string; anchor_message_id?: number | null; branch_anchor_message_id?: number | null; created_at: number; } //# sourceMappingURL=agent-db-models.d.ts.map