import { type HarnessName } from './canonTools.js'; export interface CanonStoreOptions { /** Canon store working clone (default: defaultCanonStore() in storePath.ts — CANON_STORE, an existing /tmp/canon-store, else ~/.cache/nexus-canon/store; auto-cloned). */ store?: string; /** Store remote for the auto-clone (or env CANON_REPO). Unconfigured + no store = fail-fast. */ repoUrl?: string; } export interface CanonSession { uuid: string; rel: string; parts: string[]; bytes: number; harness: string; title?: string; /** Set for a session read from the store's archive/ history (not on disk) — see canonArchiveRead.ts. */ archived?: import('./canonArchiveRead.js').ArchivedSessionRef; } export interface CanonPullOptions extends CanonStoreOptions { /** Session uuid (or unique prefix) to materialize. */ session: string; /** Target harness for the tool-compatibility report (default nexus-cortex — where pull lands). */ target?: HarnessName; /** Destination directory (default /.cortex/sessions — the current project's sessions dir). */ to?: string; /** Overwrite an existing local session file (default false — pull is a branch, never a clobber). */ force?: boolean; /** * G1 (signature portability): strip provider thinking signatures from the * MATERIALIZED COPY — thinking blocks become `` text (the * harness's own text-fallback convention), redacted_thinking is dropped. * Use when pulling a session recorded under a DIFFERENT provider account/org * (signatures validate against the originating org; foreign replay fails). * The canonical line in the store is never modified — pull is a branch. */ stripSignatures?: boolean; /** Exact canon rel path (e.g. claude-code//.jsonl) — pins one copy when a uuid is stored under several dirs. */ rel?: string; /** Only consider copies stored under this harness (claude-code, nexus-cortex, …). */ harness?: string; home?: string; } export interface CanonPullResult { /** 0 = materialized; 1 = not found / ambiguous / exists-without-force. */ code: 0 | 1; dest?: string; session?: CanonSession; } /** * ARCHIVED-SESSION PULL (2026-09-26). The local store excludes `archive/` (canonArchive + the clone exclusion), so an * archived session is not on disk and the file-walking discovery below cannot see it. This finds the session in HEAD's * `archive/YYYY-MM/
/…` tree, writes just its files into a temp root with the SAME layout (`/
/…`) * — git fetches the blobs on demand in a partial clone — and returns the root so the unchanged discovery/placement logic * runs against it. Caller deletes the root. Returns null when nothing archived matches. */ export declare function hydrateArchived(store: string, section: 'canon' | 'native', session: string, label: string): string | null; /** Count archived sessions of a section (main .jsonl files) without fetching content. */ export declare function countArchived(store: string, section: 'canon' | 'native'): number; /** Discover canon sessions (part-aware; titles recovered from event sidecars). */ export declare function discoverCanonSessions(store: string): CanonSession[]; /** List canon sessions (prints rows; returns them). `all` includes <4KB sessions. */ export declare function canonList(o?: CanonStoreOptions & { all?: boolean; }): Promise; /** * G1 signature-strip on a materialized session file (pull-side lossy projection, * explicit and counted — never silent). Thinking blocks (signed or not) become * the harness text-fallback shape `…` — same * convention as THINKING_AS_TEXT_FALLBACK — so a foreign-org replay can never * hit signature validation; `redacted_thinking` (opaque, org-bound) is dropped. * Unparseable lines pass through verbatim. */ export declare function stripThinkingSignatures(file: string): { stripped: number; dropped: number; }; export interface CanonPullNativeOptions extends CanonStoreOptions { /** Session uuid (or unique prefix) to materialize from /native. */ session: string; /** Restrict the uuid match to one harness (native tree top-level dir). */ harness?: string; /** Pin the match to one exact store-relative main file (disambiguates * duplicate uuids across project dirs — the bulk loop always passes it). */ rel?: string; /** * Destination PROJECT DIRECTORY — the dir that holds `.jsonl` (+ the * `/` sidecar tree). Default for claude-code sessions: * `~/.claude/projects//` — where `claude --resume` * already looks. Other harnesses have no safe default yet and require --to. */ to?: string; /** * Re-home the session under a DIFFERENT project cwd: the destination slug is * derived from this path (Claude Code derives its per-project dir from the * cwd with every non-alphanumeric char replaced by '-'), so the session shows * up in `claude --resume`'s picker when run from THAT directory. Ignored when * --to is given. */ project?: string; /** Overwrite existing destination files (default false — pull is a branch). */ force?: boolean; home?: string; } export interface CanonPullNativeResult { code: 0 | 1; /** Directory the session landed in. */ destDir?: string; /** Materialized logical files (dest paths). */ files?: string[]; harness?: string; } /** Claude Code's project-dir slug: cwd with each non-alphanumeric char → '-'. */ export declare function claudeProjectSlug(cwd: string): string; /** * Materialize a session's NATIVE files (byte-exact, part-reassembled) from the * store's /native tree into the target harness's own session location — the * reverse leg of canon capture. For claude-code the store layout mirrors * `~/.claude/projects//…`, so a native pull IS a `claude --resume`-able * session: no translation, just placement. The canonical line is untouched — * like canonPull, this is a branch, never a clobber. */ export declare function canonPullNative(o: CanonPullNativeOptions): Promise; /** Last-activity time from the tail of a session's FINAL part (cheap 64KB read). */ export declare function sessionLastActivity(parts: string[]): Date | null; export interface CanonPullNativeAllOptions extends CanonStoreOptions { /** Harness whose native sessions to materialize (default claude-code). */ harness?: string; /** Hydrate only the N most-recently-active sessions (lazy default for the * container startup routines — bulk-everything does not scale). Unset/0 = * every session (the explicit escape hatch). */ recent?: number; /** Size cap for sessions INSIDE the recency window (default 200 MB). The * user's most recent sessions are precisely the ones worth paying for — * a mega-session skipped by the bulk cap is exactly what they came to * resume ("not seeing recent sessions", 2026-08-16). maxMb still governs * outside the window. */ recentMaxMb?: number; /** Re-home every session under this cwd's project slug (claude-code default: required for the resume picker to list them). */ project?: string; /** Explicit destination dir (overrides project-slug derivation). */ to?: string; /** Skip sessions whose total native bytes exceed this (default 25 MB — mega-sessions hydrate slowly and drown the picker). */ maxMb?: number; force?: boolean; home?: string; } export interface CanonPullNativeAllResult { pulled: string[]; skippedLarge: { uuid: string; mb: number; }[]; skippedExisting: string[]; failed: string[]; /** Memory files materialized (continuity layer — see hydrateProjectMemory). */ memoryFiles: number; } /** * Bulk native materialization — hydrate EVERY stored native session of a * harness (default claude-code) for the local resume picker. The container * `claude-hydrate` entry point: sessions are re-homed under the CURRENT * project's slug so `claude --resume` run there lists them all. Existing * files are skipped (pull is a branch, never a clobber); oversized sessions * are skipped loudly with their size. */ export declare function canonPullNativeAll(o?: CanonPullNativeAllOptions): Promise; /** * One session id stored as several copies (a hosted box's hydrate→sync echo lands the same session under its own * project dir): IDENTICAL copies are one session → the first; if every other copy is a byte-PREFIX of one copy (the * session continued elsewhere) → the longest; otherwise undefined (genuinely divergent — the caller asks for --rel). * `normalize` (canon copies only) neutralizes each copy's own provenance stamp before comparing. */ export declare function resolveCopies(cands: T[], partsOf: (c: T) => string[], normalize?: (c: T, text: string) => string): { pick: T; why: 'identical' | 'prefix'; } | undefined; /** Materialize one canon session into a native session directory. */ export declare function canonPull(o: CanonPullOptions): Promise; //# sourceMappingURL=canonPull.d.ts.map