import type { CortexStore } from '../db/store.js'; import { knownUnchangedFiles } from './read-ledger.js'; export interface SessionBriefOptions { /** Estimated-token cap for the whole brief (default 150). */ budget?: number; /** * Off switch for the FR-7 read-ledger line. Exists so the eval harness can * measure the brief deterministically: the line's content depends on files * existing on disk with matching hashes, which a seeded in-memory scenario * has no way to stage. */ includeReadLedger?: boolean; } export declare const DEFAULT_SESSION_BRIEF_BUDGET = 150; /** * The one seam this module needs, and it exists for a specific failed test. * * AD-12's guarantee — a throw from the ledger path costs the line, never the * brief — cannot be exercised from outside: a Proxy broad enough to break the * ledger also breaks `resolveWorkingScopeKeys`, so the brief dies before the * `try` is reached and the `catch` is never entered. The first version of that * test built such a Proxy, asserted it broke the helper, then called the real * store — so deleting the entire `try`/`catch` was invisible to the suite. */ export interface SessionBriefDeps { knownUnchangedFiles: typeof knownUnchangedFiles; } /** Test-only entry point carrying the seam; production calls `buildSessionBrief`. */ export declare function buildSessionBriefForTest(store: CortexStore, options: SessionBriefOptions, deps: Partial): string; /** * Make one path safe to place in a comma-joined brief line. * * **This was the only line in the brief that was neither collapsed nor * truncated**, and both omissions are reachable: * * - **A newline forges a whole line.** Digest paths keep whatever the agent * read, and `toScopeRelativeKey` preserves control characters, so on Linux, * macOS and WSL — the platforms `hooks/` ships for — a file named * `a.ts\n- resume: …` rendered a `- resume:` line the store never produced, * in the unprompted SessionStart channel. A lone CR overwrites the line on a * terminal. This is the class already bound in `digest-index` ("a raw newline * forges a whole record"), in `inspect-memory` ("a newline in `subject` * forges a second listing row") and by `renderReadLedgerLine`'s own * `collapse()` — the rule existed and this line skipped it. * - **A comma forges an entry**, on every platform, with an ordinary filename: * two real files `a,b.ts` and `z.ts` render as three names. Quoted rather * than escaped, so the path stays readable and greppable. * - **An unbounded path can eat the whole brief.** Reads outside the scope root * keep absolute keys by design, and this repo's live store already holds * agent task outputs under `AppData`. Measured: five 78-character paths cost * 108 tokens, 72% of the 150-token budget, and the line then drops * all-or-nothing — so a deep-path repo silently got *no* line rather than a * shorter one. `renderReadLedgerLine` caps each file for the same reason. */ export declare function formatLedgerPath(filePath: string): string; /** * The pull channel: a tiny, validated, branch-scoped memory brief injected at * SessionStart. Lead with proof of value, never with a demand. Emits an empty * string when nothing qualifies so cold starts cost zero tokens. */ export declare function buildSessionBrief(store: CortexStore, options?: SessionBriefOptions): string; //# sourceMappingURL=session-brief.d.ts.map