/** * 内容寻址隔离副本 —— eval 把任意源(本地目录-skill / 本地单文件-skill / 本地 git ref / 远端 git) * 在测量前落地成的那一份。executor 的 cwd 锚到 copyRoot,被测 agent 在隔离副本里跑、不碰用户真实 * 目录,references/ 资产成为真实运行时输入。路径按 contentHash 命名 → 同内容同路径 → task.cwd * 稳定 → cache key / runtime fingerprint 稳定。 */ export interface IsolatedCopy { /** 副本根:目录-skill 为目录 `/`、单文件-skill 为 `//.md`。 */ copyRoot: string; /** = hashArtifactSource(copyRoot, isDirectorySkill);与 install 受管记录的 contentHash 同空间。 */ contentHash: string; isDirectorySkill: boolean; } /** 隔离副本根目录 —— 可重生 scratch,收在 state/ 子树下(见 default-dirs)。 * `OMK_TREES_DIR` 可重定位(测试隔离 / 用户迁移)。 */ export declare function treesDir(): string; /** * 内容寻址副本的 LRU 回收:`/` 数超过上限时,按 mtime 从旧到新淘汰,直到回到上限内。 * **绝不删**被活进程占用的副本(`.locks/.` 且 pid 在世)—— 这才是「正在跑的 eval 的 cwd 不被删」 * 的真实保证(不靠 mtime 当 liveness)。grace 窗口是第二道兜底。软上限:被占用/grace 内的大批新副本会暂时 * 超限,待其释放/老化后回收。`.tmp-` 暂存与 `.locks` 不计、不删。 * materializeIsolatedCopy 命中走 utimes 触碰(LRU touch)+ 落锁;未命中落盘后落锁并调本函数;也可独立调用。 */ export declare function pruneTreesDir(opts?: { maxEntries?: number; graceMs?: number; }): void; /** * 把一棵已在盘的本地源树(目录或单 .md)落地成内容寻址隔离副本。 * - 先从**源**算整树 / 单文件指纹(`hashArtifactSource` 与副本同 filter → 同 hash),不必先 copy * - `/` 已存在 → 内容寻址命中,直接复用、**零 copy**(同 hash 内容必然相同) * - 未命中 → 物化到同卷临时目录 `/.tmp-xxx`(目录-skill 用 install 同一 distributable * filter;单文件-skill copyFile 到 `/.md`,使 `` 恒为目录、消歧),再原子 * `rename` 到 ``;rename 撞 EEXIST/ENOTEMPTY(并发已落同 hash)即删临时复用。 * 物化只发生一次/variant(resolveArtifacts 解析期),不随 sample 数放大。 */ export declare function materializeIsolatedCopy(localRoot: string, isDirectorySkill: boolean, name: string): IsolatedCopy;