/** * v2 MVP M2 — diff-OUT-of-container ([ref] §7 solution (b), V2-MVP-PLAN.md, findings F1/F3, council#1/#13/#14). * * The Coordinator pulls a worker's commits as a patch series over `execStream` `git format-patch --stdout` — * the diff comes OUT of the worker container, **no push credentials ever go IN** (preserves §5/F3 isolation). * The patch then feeds the ephemeral no-creds integration sandbox (M3) via `git am`/`git apply`. * * Council round-1 folded: * - #14: `--stdout` (else format-patch writes .patch FILES and prints only filenames to stdout). * - #13 + maxOutputBytes: fail-on-truncation — a runaway diff must NOT be silently half-captured. * - exit-code: non-zero `git` → failure (the worker branch / base is bad), surfaced not swallowed. * - ref validation: baseSha/ref are interpolated into a shell command in the container; reject anything that * isn't a safe git rev token so a worker-influenced value can't inject. */ import type { OutputChunk, ExecStreamOptions } from "@sema-agent/core"; /** Only the one method M2 consumes from the remote env (the real RemoteExecutionEnv satisfies it). */ export interface ExecStreamLike { execStream(command: string, options?: ExecStreamOptions): AsyncIterable; } export interface PullDiffOptions { /** Worker branch / rev to diff up to (default HEAD — the worker container's checked-out work). */ ref?: string; /** Repo dir inside the container (execStream cwd). */ cwd?: string; /** Fail-on-truncation cap (bytes). Default 5 MiB. */ maxBytes?: number; signal?: AbortSignal; /** Idle read timeout (E2B #1128 — never hang on an unreachable sandbox). Default 30s. */ readTimeoutMs?: number; } export type PullDiffResult = { ok: true; patch: string; bytes: number; } | { ok: false; error: string; truncated?: boolean; exitCode?: number; }; /** * 一次 diff 的字节帽(pull 腿与 push/上行腿**共用同一个数**)。 * * 🔴 exported 是判据的一部分(2026-08-08,[ref] 二轮扫描 finding):`diffup.ts` 原先另抄了一份同值常量, * 而它**本就已经** `import { safeRev } from "./diffout.js"` —— 依赖边在,共享零成本。两份手抄的后果不是 * 「多写一行」,是**单边改值后上行/pull 两腿对同一个 diff 的过/拒判定分家**:同一份补丁在一条腿上过、 * 另一条腿上被截断,而两处都「按自己的常量」正确工作,没有任何一处会报错。 * (同族先例:`checkpoint-store-sql.ts` 的 `export const TERMINAL_GRACE_MS`。) */ export declare const DEFAULT_MAX_DIFF_BYTES: number; export declare function safeRev(rev: string): boolean; /** * Pull `..` from a worker container as a `git format-patch` series. Never throws — failures * (bad rev, non-zero git, truncation, transport loss, empty diff) are returned as `{ ok: false }`. */ export declare function pullDiff(env: ExecStreamLike, baseSha: string, opts?: PullDiffOptions): Promise; //# sourceMappingURL=diffout.d.ts.map