import { type ConversationRunRequest } from './run.js'; import { type ConversationProtocolVersion } from './version.js'; /** 当前可查询的会话历史数据版本。旧数据不会被历史接口自动纳入。 */ export declare const CONVERSATION_HISTORY_VERSION: 1; export declare const DEFAULT_CONVERSATION_LIST_LIMIT = 20; export declare const DEFAULT_CONVERSATION_RUN_LIST_LIMIT = 10; export declare const DEFAULT_CONVERSATION_SEARCH_LIMIT = 20; export declare const MAX_CONVERSATION_HISTORY_LIMIT = 50; export declare const MAX_CONVERSATION_SEARCH_KEYWORD_LENGTH = 64; export type ConversationRunDirection = 'newer' | 'older'; export type ConversationHistoryOperation = 'activateConversation' | 'bootstrap' | 'createSession' /** @deprecated Use createSession. Kept for the first history beta. */ | 'createConversation' | 'getConversationRunWindow' | 'getConversationRuns' | 'listConversations' | 'searchConversationMessages'; type ConversationHistoryRequestBase = { protocolVersion: ConversationProtocolVersion; historyVersion: typeof CONVERSATION_HISTORY_VERSION; operation: ConversationHistoryOperation; agentId: string; }; export type ConversationHistoryRequest = (ConversationHistoryRequestBase & { operation: 'bootstrap'; limit?: number; }) | (ConversationHistoryRequestBase & { operation: 'listConversations'; cursor?: string; limit?: number; }) | (ConversationHistoryRequestBase & { operation: 'getConversationRuns'; threadId: string; cursor?: string; direction?: ConversationRunDirection; limit?: number; }) | (ConversationHistoryRequestBase & { operation: 'getConversationRunWindow'; threadId: string; runId: string; beforeLimit?: number; afterLimit?: number; }) | (ConversationHistoryRequestBase & { operation: 'searchConversationMessages'; keyword: string; cursor?: string; limit?: number; }) | (ConversationHistoryRequestBase & { operation: 'createSession'; }) | (ConversationHistoryRequestBase & { operation: 'createConversation'; }) | (ConversationHistoryRequestBase & { operation: 'activateConversation'; threadId: string; }); export type CreateConversationHistoryRequestInput = { operation: 'bootstrap'; agentId: string; limit?: number; } | { operation: 'listConversations'; agentId: string; cursor?: string; limit?: number; } | { operation: 'getConversationRuns'; agentId: string; threadId: string; cursor?: string; direction?: ConversationRunDirection; limit?: number; } | { operation: 'getConversationRunWindow'; agentId: string; threadId: string; runId: string; beforeLimit?: number; afterLimit?: number; } | { operation: 'searchConversationMessages'; agentId: string; keyword: string; cursor?: string; limit?: number; } | { operation: 'createSession'; agentId: string; } | { operation: 'createConversation'; agentId: string; } | { operation: 'activateConversation'; agentId: string; threadId: string; }; export type ConversationSummary = { threadId: string; title: string; preview: string; runCount: number; createdAt: number; updatedAt: number; lastRunStatus: ConversationHistoryRunStatus; }; export type ConversationHistoryRunStatus = 'done' | 'error' | 'running'; export type ConversationHistoryRun = { runId: string; threadId: string; request: ConversationRunRequest; lines: string[]; status: ConversationHistoryRunStatus; startedAt: number; completedAt?: number; }; export type ConversationSearchHighlightRange = { start: number; length: number; }; export type ConversationSearchHit = { threadId: string; runId: string; itemId: string; role: 'user' | 'assistant'; snippet: string; highlightRanges: ConversationSearchHighlightRange[]; createdAt: number; }; export type ConversationHistoryResponse = { operation: 'bootstrap'; activeThreadId: string; activeConversationExists: boolean; conversations: ConversationSummary[]; nextCursor?: string; } | { operation: 'listConversations'; conversations: ConversationSummary[]; nextCursor?: string; } | { operation: 'getConversationRuns'; threadId: string; runs: ConversationHistoryRun[]; nextCursor?: string; } | { operation: 'getConversationRunWindow'; threadId: string; anchorRunId: string; runs: ConversationHistoryRun[]; olderCursor?: string; newerCursor?: string; } | { operation: 'searchConversationMessages'; keyword: string; results: ConversationSearchHit[]; nextCursor?: string; } | { operation: 'createConversation' | 'createSession' | 'activateConversation'; threadId: string; }; export declare class ConversationHistoryValidationError extends Error { readonly issues: string[]; readonly code = "CONVERSATION_HISTORY_INVALID"; constructor(issues: string[]); } export declare function createConversationHistoryRequest(input: CreateConversationHistoryRequestInput): ConversationHistoryRequest; export declare function parseConversationHistoryRequest(value: unknown): ConversationHistoryRequest; export declare function parseConversationHistoryResponse(value: unknown): ConversationHistoryResponse; export declare function getConversationHistoryRequestIssues(value: unknown): string[]; export declare function getConversationHistoryResponseIssues(value: unknown): string[]; export {};