import type { DiagnosticRecommendation, InsightConversationMessage, InsightPhase, InsightSeverity, SafeInsightAggregate, SafeInsightOverview, SafeInsightOverviewSession, SafeInsightOverviewSuggestion, SafeInsightReport, SafeInsightSuggestion, SafeSpanIntent, SafeSpanTag, TurnPromptPreview, TurnTimelineTurn } from '../../services/insight/types.js'; export type InsightFilter = 'all' | 'review' | 'failed' | 'slow'; export type InsightRecord = { session: Record; report: SafeInsightReport | null; error?: string; }; export type ScopeOpts = { project?: string; sinceMs?: number; analyzableOnly?: boolean; }; export type InsightTab = 'overview' | 'sessions' | 'flow' | 'dist' | 'hot'; export type SessSort = 'recent' | 'review' | 'spans' | 'fails' | 'slow' | 'agent'; export type DetailTab = 'spans' | 'ledger' | 'convo'; export type LedgerSender = 'all' | 'user' | 'a2a_agent' | 'system'; export type ConvoState = { messages: InsightConversationMessage[]; total: number; hasMore: boolean; nextOffset: number; loading: boolean; q: string; role: string; tag: string; openOps: Set; }; export type DetailView = { activeId: string | null; tab: DetailTab; spanFilter: string; openSpans: Set; openTurns: Set; ledgerSort: 'normal' | 'grouped'; openPrompts: Set; rawPrompts: Set; ledgerSender: LedgerSender; convo: ConvoState; }; export type DerivedOverview = { totalCount: number; analyzedCount: number; agg: SafeInsightAggregate; topFailedTools: Array<{ tool: string; count: number; }>; suggestions: SafeInsightOverviewSuggestion[]; }; export type HotAgg = { key: string; label: string; sessions: Array<{ id: string; title: string; }>; reads: number; edits: number; runs: number; fails: number; count: number; }; export type ConvoUnit = { kind: 'prompt'; msg: InsightConversationMessage; } | { kind: 'ops'; turnIndex: number; msgs: InsightConversationMessage[]; }; export declare const SEVERITY_RANK: Record; export declare const INSIGHT_PHASES: InsightPhase[]; export declare const FLOW_PHASES: readonly ["research", "edit", "run", "delegate", "discuss"]; export declare const INSIGHT_TABS: Array<{ key: InsightTab; label: string; }>; export declare const TIME_WINDOWS: Array<{ key: string; label: string; days: number; }>; export declare const INSIGHT_FILTERS: InsightFilter[]; export declare const INSIGHT_TAB_KEYS: InsightTab[]; export declare const SESS_SORTS: Array<{ key: SessSort; label: string; }>; export declare const SESS_SORT_KEYS: SessSort[]; export declare const SPAN_TAGS: SafeSpanTag[]; export declare const CONVO_ROLES: Array<{ key: string; label: string; }>; export declare const CONVO_TAGS: Array<{ key: string; label: string; }>; export declare const BAD_RESULTS: Set; export declare function newConvoState(): ConvoState; export declare function fmtInt(n: number): string; export declare function fmtMs(ms?: number): string; export declare function statusIcon(status?: string): string; export declare function safeStatus(report: SafeInsightReport | null, error?: string): string; export declare function sessionTitle(s: Record): string; export declare function severityLabel(sev: InsightSeverity): string; export declare function translatedOrFallback(key: string, fallback: string): string; export declare function suggestionTitle(s: Pick | Pick): string; export declare function suggestionAction(s: Pick | Pick): string; export declare function localizeEvidence(text: string): string; export declare function localizeReason(reason: string): string; export declare function phaseLabel(phase: string): string; export declare function phaseSlug(phase: string): string; export declare function phaseClass(phase: string): string; export declare function reportNeedsReview(report: SafeInsightReport | null): boolean; export declare function toRecord(s: SafeInsightOverviewSession): InsightRecord; export declare function cliIdOf(rec: InsightRecord): string; export declare function cliCounts(records: InsightRecord[]): Array<{ id: string; count: number; }>; export declare function projectOf(rec: InsightRecord): string; export declare function projectOptions(records: InsightRecord[]): Array<{ id: string; count: number; }>; export declare function filterRecords(records: InsightRecord[], filter: InsightFilter, q: string, cliSel?: Set, scope?: ScopeOpts): InsightRecord[]; export declare function aggregateRecords(records: InsightRecord[]): DerivedOverview; export declare function agentMsOf(r: SafeInsightReport): number; export declare function okReports(records: InsightRecord[]): SafeInsightReport[]; export declare function median(values: number[]): number; export declare function reviewScore(r: SafeInsightReport | null): number; export declare function sortRecordsBy(records: InsightRecord[], key: SessSort): InsightRecord[]; export declare function intentLabel(kind: string): string; export declare function resultLabel(category: string): string; export declare function tagLabel(tag: string): string; export declare function idText(ns: string, h: { id: string; params: Record; }): string; export declare function turnHeadline(h: { id: string; params: Record; }): string; export declare function structLabel(v?: string): string; export declare function spanFailed(s: { status: string; result?: { category: string; }; }): boolean; export declare function intentTextOf(intent: SafeSpanIntent | undefined, fallback: string): string; export declare function intentText(s: { tool: string; intent?: SafeSpanIntent; }): string; export declare function intentPhrase(intent?: SafeSpanIntent): string; export declare function turnAdvice(tags: SafeSpanTag[]): string; export declare function focusSets(report: SafeInsightReport, activeId: string | null): { rec: DiagnosticRecommendation | null; spanIdx: Set; turnIdx: Set; }; export declare function cleanPromptText(raw: string): string; export declare function promptMarkdownHtml(text: string): string; export declare function turnSenderKind(tn: TurnTimelineTurn): Exclude; export declare function groupConvo(messages: InsightConversationMessage[]): ConvoUnit[]; export declare function turnMainPhase(tn: TurnTimelineTurn): string; export declare function buildInsightScope(timeWin: string, project: string, showNoise: boolean): ScopeOpts; export declare function parseInsightsHash(): Record; export declare function buildInsightsHash(p: Record): string; export declare function initialInsightTab(): InsightTab; export declare function fetchInsightsSummary(): Promise; export declare function fetchInsightDetail(sessionId: string): Promise; export declare function fetchInsightConversation(sessionId: string, opts: { offset: number; limit: number; q?: string; role?: string; tag?: string; }): Promise<{ messages: InsightConversationMessage[]; total: number; hasMore: boolean; nextOffset: number; }>; export declare function fetchTurnPrompt(sessionId: string, turnIndex: number): Promise; export declare function sessionMetaLine(rec: InsightRecord): string; //# sourceMappingURL=insights.d.ts.map