export declare const CODING_POLICY_VERSION = 1; /** The coding engines a runner may run (coding.md §4). */ export type CodingEngine = "native" | "claude_code" | "codex" | "copilot"; export declare const CODING_ENGINES: readonly CodingEngine[]; /** The runner model providers (the native loop runs on one of these). */ export declare const RUNNER_PROVIDERS: ReadonlySet; export interface Verdict { ok: boolean; reason?: string; } /** Is this file name (or path) a secret? (.env*, keys, certificates, tokens) */ export declare function isSecretPath(p: string): boolean; /** * May the session touch `p`? Relative paths resolve against the worktree. * Outside the worktree, a secret, or (for a write) inside `.git` or a * `node_modules` link to the member's own tree: refused. */ export declare function checkPath(p: string, worktree: string, opts?: { write?: boolean; }): Verdict; /** Split a command line into argv (single / double quotes, backslash). A * shell operator outside quotes (; | & > < ` $( ${ newline) is refused: the * session runs one program per call, never a shell. */ export declare function parseCommand(cmd: string): { argv: string[]; } | { error: string; }; /** May the session run this command line (cwd defaults to the worktree)? */ export declare function checkCommand(cmd: string, worktree: string, cwd?: string): Verdict & { argv?: string[]; }; /** `dir: command` → its parts (no prefix: the worktree root, dir ""). */ export declare function splitCheck(check: string): { dir: string; command: string; }; /** Why a check folder is refused, or null: relative, forward slashes, no * `.` / `..` / hidden segment, at most 8 levels. */ export declare function checkDirError(dir: string): string | null; /** May this check run, and where? The folder must be a directory of the * worktree, also after symlinks (within(worktree) on the real paths), and * the command passes checkCommand from there. */ export declare function resolveCheck(check: string, worktree: string): { ok: true; cwd: string; command: string; argv: string[]; } | { ok: false; reason: string; }; /** The TypeScript compiler installed for `cwd` (node_modules/typescript of * that folder or a parent, up to the worktree root), or null. A check never * lets npx download a package: `npx tsc` runs this file or does not run. */ export declare function localTsc(cwd: string, worktree: string, exists?: (p: string) => boolean): string | null; /** The environment of every session process: npm / npx never install a * missing package (npx refuses instead of downloading one). */ export declare const NO_INSTALL_ENV: Readonly>; /** Split a shell line on && || ; | (outside quotes) into simple commands. */ export declare function splitShell(line: string): string[]; /** Unwrap `bash -lc '…'` / `sh -c "…"` / `zsh -lc …` (how Codex reports commands). */ export declare function unwrapShell(cmd: string | string[]): string; /** * Why a command that RAN is a policy violation, or null. Lenient on reading * utilities (an engine's own sandbox may read with cat / rg / sed); strict on * what the session may never do: push, network, sudo, rm -rf, a secret file or * a path outside the worktree. */ export declare function dangerReason(cmd: string | string[], worktree: string): string | null; /** One engine tool call (Claude Code names): allowed under the policy? */ export declare function checkToolCall(tool: string, input: Record, worktree: string): Verdict; /** Command prefixes the engines are told they may run (Claude / Copilot rules). */ export declare const ALLOWED_COMMAND_PREFIXES: readonly string[]; /** Command prefixes always refused. */ export declare const DENIED_COMMAND_PREFIXES: readonly string[]; /** Secret path globs refused for every file tool. */ export declare const SECRET_GLOBS: readonly string[]; export interface ClaudeSettingsInput { guardCommand: string; } /** The generated Claude Code settings (--settings): the allowlist, the denies * (deny wins over any allow the member's own settings carry) and the * PreToolUse guard hook, which applies checkToolCall to every call. */ export declare function claudeSettings(i: ClaudeSettingsInput): Record; /** The restrictions every engine is told (the policy enforces them anyway). */ export declare const ENGINE_RULES: string; export interface EngineCommand { command: string; args: string[]; stdin: string | null; } /** `claude -p` headless with the generated settings. `flags` = the options * the installed CLI supports (parsed from `claude --help`); an option it does * not know is left out rather than failing the run. */ export declare function claudeCommand(i: { prompt: string; settingsPath: string; model?: string | null; maxTurns: number; flags?: ReadonlySet | null; }): EngineCommand; /** `codex exec` in its workspace-write sandbox, network off, never asking. */ export declare function codexCommand(i: { worktree: string; model?: string | null; lastMessagePath?: string | null; }): EngineCommand; /** GitHub Copilot CLI (`copilot -p`) with explicit allow / deny tools. */ export declare function copilotCommand(i: { prompt: string; model?: string | null; }): EngineCommand; export interface EnginePick { engine: CodingEngine; provider: string | null; model: string | null; } /** * The engine of a session. `requested` is the grant's choice ("auto" or an * engine), `provider` / `model` the executive's model (any provider), the * detected engines the runner's, `runnerModels` its local models. Automatic: * the executive's runner model's own CLI when detected, else the native loop * on that model; a cloud model: Claude Code, Codex, Copilot CLI, then the * native loop on the first runner model. Nothing usable: an error. */ export declare function pickEngine(i: { requested?: string | null; provider?: string | null; model?: string | null; detected: readonly string[]; runnerModels?: ReadonlyArray<{ provider: string; name: string; }>; }): EnginePick | { error: string; }; export interface AuditState { commands: number; violations: string[]; /** Claude tool_use ids waiting for their result: id → the violation if it ran. */ pending: Map; /** The engine's final text (summary). */ finalText: string; } export declare function newAudit(): AuditState; /** * Feed one stdout line of an engine. Returns a human progress line (or null). * Claude stream-json: a tool_use is checked when its tool_result arrives * without an error (a refused call never ran). Codex --json: a finished * command or file change. Native: `MELCODE {kind: "command"|"progress"|"done"}`. */ export declare function auditEngineLine(engine: CodingEngine, line: string, worktree: string, a: AuditState): string | null; /** A progress line with secret-shaped text masked, one line, ≤ 400 chars. */ export declare function maskLine(line: string): string;