/** * The tool call's own directory, read from a hook payload. * * A relative target path belongs to the directory the tool call RUNS in: the * file a call writes is the one that directory names, not the one the project * root would name. The gate needs that directory to say which file a payload * really points at, and the payload is where a harness states it. * * The read is deliberately narrow — one key, at the top level, holding a * string. A `cwd` nested inside the tool's own arguments is an ARGUMENT the * tool was handed, not the directory the call runs in, so only the top-level * key counts. * * The absence of the key is not an error: the caller then uses the process's * own working directory, which is the same directory whenever the harness runs * the hook where the tool call runs. */ export declare function readToolCallCwd(payload: Readonly>): string | null; /** * The directory a relative target path is read against. * * The payload's own `cwd` is the base only when it is a USABLE one: an * absolute path naming an existing directory inside the project the caller * named. A `cwd` that is missing, relative, names a file, names a directory * that is not there, or names a directory outside the project is not a * directory this project can judge the file against — and a base that is not * the call's own directory resolves the path against the wrong tree, which is * how an edit into a hard-blocked family slipped through. * * The rule ASSUMES the tool call runs inside the named project, which is * where the gate is installed. When it does not, the payload `cwd` is * rejected and the path is read against the gate's own working directory * instead — a different tree. * * While the base the path is read against IS the call's own directory, the * error stays one-directional: a file that lies outside every family can be * denied, and never the other way round — a wrongly allowed edit is a hole, * a wrongly refused one is an inconvenience. That direction is NOT a general * property of the fallback: when the base is the gate's own working * directory and the call runs somewhere else, the call's relative path is * read against a tree that is not the call's, and a file that really is * inside a hard-blocked family can be ALLOWED. * Measured 2026-10-23; backlog §19.3. * * The fallback is the gate process's own working directory: that is where the * hook runs, and in the normal invocation it IS the tool call's directory. * The gate does not fail closed here — it uses the best base it has, and a * file that lands outside the project is judged by its spelling, which never * widens the gate. */ export declare function resolveToolCallBaseDir(payload: Readonly>, projectRoot: string, fallback: string): string;