export declare const CAPTURE_FORMATS: readonly ["claude-code", "codex", "jsonl-generic"]; export type CaptureFormat = (typeof CAPTURE_FORMATS)[number]; export interface CaptureResult { record: Record; format: CaptureFormat; detected: boolean; } export interface AmbientTrustReport { label: string; schema: string; session_id: string; source: string; state: string; runtime: { adapter: string; spawned: boolean | null; status: string; failure_code: string | null; marker_state: string | null; token_total: number | null; token_availability: 'available' | 'unavailable'; }; transcript_observed: { available: boolean; assistant_turns: number | null; user_events: number | null; tool_census: Array<{ name: string; count: number; }>; files_touched: { count: number; samples: string[]; redacted_local_path_count: number; suppressed_count: number; truncated: boolean; }; usage: Record; token_availability: 'available' | 'unavailable'; session_span: { started_at: string | null; ended_at: string | null; available: boolean; }; final_message_digest: string | null; fidelity_notes: string[]; }; warnings: string[]; boundary: { authority: string; source: string; }; } interface ParsedLines { lines: Array>; malformed: number; } export declare class CaptureUsageError extends Error { } export declare function isCaptureFormat(value: string): value is CaptureFormat; /** * Sniff the transcript format from parsed lines. Returns the best-confidence concrete * parser (claude-code | codex). Throws CaptureUsageError on ambiguity so the caller can * tell the user to pass --from; the generic fallback is never auto-selected by detection. */ export declare function detectFormat(parsed: ParsedLines): CaptureFormat; export interface CaptureOptions { transcriptPath: string; format?: CaptureFormat; detect?: boolean; sessionId?: string; rawText?: string; } /** * Pure capture: read + parse + normalize a transcript into a CaptureResult. * Throws CaptureUsageError for usage problems (missing/unreadable transcript, ambiguous * detection, no --from/--detect). Never writes; the CLI layer owns output + exit codes. */ export declare function captureRecord(options: CaptureOptions): CaptureResult; export declare function sanitizeReportString(value: unknown, maxLength?: number): string; export declare function buildAmbientTrustReport(value: unknown, label?: string): AmbientTrustReport; export declare function verifyAmbientRecordText(rawText: string, label?: string): AmbientTrustReport; export declare function renderAmbientTrustReport(report: AmbientTrustReport): string; /** * Default output path for a captured record. Inside an .osc repo it lands under * .osc/state/ambient/.json, which is covered by the scaffolded .osc/.gitignore; * otherwise it lands next to cwd. */ export declare function defaultOutPath(repoRoot: string, runId: string): string; /** * Write a captured record. `out` may be absolute or relative. * - When it resolves inside repoRoot, the repo-safe writer is used (refuses .. escapes * and symlinked components); this covers the default and relative-path cases. * - When `explicit` is true and the path resolves OUTSIDE the repo (e.g. `--out /tmp/x`), * it is the user's deliberate choice and is written with a symlink-safe direct write. * The default path is never `explicit`, so it can never silently escape the repo. * Returns the absolute path written. */ export declare function writeCaptureRecord(repoRoot: string, out: string, record: Record, explicit?: boolean, forbiddenPaths?: string[]): string; export {};