/**
 * Session rendering: summary, markdown conversation, and JSON output.
 *
 * Provides the display layer for `agents sessions <id>`. The summary renderer
 * produces a chalk-formatted activity overview (modified files, commands,
 * errors, final message). The markdown renderer emits a full conversation
 * transcript. Filtering by role and turn slicing is handled here as well.
 */
import type { SessionEvent, SessionMeta } from './types.js';
import { unwrapCommand, bucketKey } from './bash-command.js';
/**
 * Return absPath relative to cwd; fall back to ~/… then absolute.
 */
export declare function relativeToCwd(absPath: string, cwd?: string): string;
/**
 * Display form for a touched path: cwd-relative first; then collapse any
 * `.agents/worktrees/<slug>` segment (in-cwd OR outside) to `⧉ <slug>/…` so
 * group labels stay on one line instead of `~/src/…/.agents/worktrees/<slug>/…`;
 * else home-collapse.
 */
export declare function displayPath(absPath: string, cwd?: string): string;
/**
 * Wrap a filesystem path label in an OSC 8 `file://` hyperlink when the terminal
 * supports it. Degrades to the plain label otherwise.
 */
export declare function linkPath(absPath: string, label: string): string;
/**
 * Wrap a label in an OSC 8 hyperlink to an arbitrary URL (a PR on GitHub, a Linear
 * issue, …) when the terminal supports it. Degrades to the plain label otherwise.
 */
export declare function linkUrl(url: string, label: string): string;
/**
 * Normalize a command so trivial flag/pipe variations collapse to the same key.
 */
export declare function normalizeForDedup(cmd: string): string;
export { unwrapCommand, bucketKey };
interface CmdRun {
    normalized: string;
    raw: string;
    firstTs: number;
    lastTs: number;
    count: number;
}
/**
 * Collapse consecutive same-normalized commands within a 60-second window
 * when they appear 3+ times. Fewer than 3 stay as separate entries.
 */
export declare function collapseRetries(commands: Array<{
    cmd: string;
    ts: number;
}>): CmdRun[];
/** Aggregated statistics computed from a session's parsed events. */
export interface SessionStats {
    models: string[];
    userTurns: number;
    assistantTurns: number;
    toolCount: number;
    /** Per-tool call counts (histogram), highest first when rendered. */
    toolCounts: Record<string, number>;
    errorCount: number;
    outputTokens: number;
    cacheReadTokens: number;
    firstTs: number;
    lastTs: number;
}
/** Compute aggregate statistics (turns, tools, tokens, duration) from session events. */
export declare function computeSummaryStats(events: SessionEvent[]): SessionStats;
/** Strip the 'claude-' prefix and date suffix from a model identifier. */
export declare function shortenModel(model: string): string;
/** Format a token count as a human-readable string (e.g. 67.5K, 1.2M). */
export declare function formatTokenCount(n: number): string;
/** Format a duration in milliseconds as a human-readable string (e.g. '12 min', '2h 30min'). */
export declare function formatDuration(ms: number): string;
/**
 * Return the stats line for a session summary header.
 * e.g. "221 turns · 198 tools (10 errors) · 67.5M cached / 361K out · 12 min"
 */
export declare function renderSummaryHeader(stats: SessionStats): string;
/**
 * Render session as an activity summary.
 * Returns a chalk-formatted string (not markdown) for direct terminal output.
 */
export declare function renderSummary(events: SessionEvent[], cwd?: string): string;
/** Allowed values for --include/--exclude role filters. */
export declare const VALID_ROLE_VALUES: readonly ["user", "assistant", "thinking", "tools"];
/** A single role filter value derived from VALID_ROLE_VALUES. */
export type RoleFilter = typeof VALID_ROLE_VALUES[number];
/** Options for filtering session events by role and turn range. */
export interface FilterOptions {
    include?: RoleFilter[];
    exclude?: RoleFilter[];
    first?: number;
    last?: number;
}
/**
 * Parse a comma-separated role list (e.g. "user,assistant") into typed values.
 * Throws with a clear message listing valid values on any unknown entry.
 */
export declare function parseRoleList(raw: string, flag: string): RoleFilter[];
/**
 * Apply include/exclude/first/last. Turn slicing runs first so role filters
 * operate on the sliced window (natural semantics: "last 3 turns, user only").
 */
export declare function filterEvents(events: SessionEvent[], opts: FilterOptions): SessionEvent[];
/**
 * Build the conversation as a single markdown string: user / assistant
 * messages, inline thinking blocks, tool calls, and errors. Emitted in event
 * order so reasoning sits where it actually occurred relative to the assistant
 * reply.
 */
export interface RenderConversationMarkdownOptions {
    redact?: boolean;
    knownSecrets?: readonly string[];
    reasoning?: 'omit' | 'fold' | 'include';
    maxToolOutputChars?: number;
}
export declare function renderConversationMarkdown(events: SessionEvent[], opts?: RenderConversationMarkdownOptions): string;
/**
 * Render one session's JSON output — the shape `agents sessions <id> --json`
 * emits. When `meta` is provided (the standard path), returns a
 * `{ session, events }` wrapper so top-level fields (`plan`, `prUrl`, …) that
 * live on `SessionMeta` are visible without re-parsing events. Legacy
 * callers that pass no meta still get a bare `SessionEvent[]` array.
 *
 * Secrets are redacted by default (`opts.redact !== false`), matching
 * `renderConversationMarkdown` — the JSON path must not be the one output
 * format that leaks credentials. Redaction covers both events AND the session
 * meta (e.g. `topic`, a verbatim first-message excerpt). Pass `{ redact: false }`
 * for `--no-redact`.
 */
export declare function renderJson(events: SessionEvent[], meta?: SessionMeta, opts?: {
    redact?: boolean;
}): string;
