export declare const AUTORESEARCH_BRANCH_PREFIX = "autoresearch/"; export interface EnsureAutoresearchBranchFailure { error: string; ok: false; } export interface EnsureAutoresearchBranchSuccess { branchName: string | null; created: boolean; ok: true; warning?: string; } export type EnsureAutoresearchBranchResult = EnsureAutoresearchBranchFailure | EnsureAutoresearchBranchSuccess; export declare function getCurrentAutoresearchBranch(workDir: string): Promise; /** * True when `rawPath` is one of the mission's own research artifacts: the * `autoresearch.sh` harness at the working-directory root. This is the complete * agent-writable surface for an active mission — product code, manifests, * dependencies, and every other path stay blocked by the research-only * mutation guard regardless of branch name. * * Mission state under `.gjc/**` is intentionally NOT listed here: it is * runtime-owned and only the sanctioned `gjc autoresearch` CLI writes it. */ export declare function isAutoresearchAuthorizedResearchPath(_cwd: string, rawPath: string): boolean; /** * Ensure the working tree is on an `autoresearch/*` branch when possible. * * When the worktree is dirty and we are not already on an autoresearch branch, * this returns `{ ok: true, branchName: null, warning }` rather than failing: * the caller surfaces the warning and continues on the current branch — `keep` * will skip auto-commits and `discard` will revert only run-modified paths * instead of resetting to baseline. */ export declare function ensureAutoresearchBranch(workDir: string, goal: string | null): Promise; export declare function parseWorkDirDirtyPaths(statusOutput: string, workDirPrefix: string): string[]; export declare function relativizeGitPathToWorkDir(repoRelativePath: string, workDirPrefix: string): string | null; export declare function parseDirtyPaths(statusOutput: string): string[]; export declare function normalizeStatusPath(rawPath: string): string; export declare function slugifyGoal(goal: string | null): string; export interface DirtyPathEntry { path: string; untracked: boolean; } export declare function parseDirtyPathsWithStatus(statusOutput: string): DirtyPathEntry[]; export declare function parseWorkDirDirtyPathsWithStatus(statusOutput: string, workDirPrefix: string): DirtyPathEntry[]; export declare function computeRunModifiedPaths(preRunDirtyPaths: string[], currentStatusOutput: string, workDirPrefix: string): { tracked: string[]; untracked: string[]; }; export interface KeepAutoresearchRunInput { cwd: string; description: string; status: string; metric: number; metrics: { [key: string]: number; }; /** Paths modified by this run (workdir-relative). */ files: string[]; /** True when on a dedicated `autoresearch/*` branch. */ onAutoresearchBranch: boolean; primaryMetric: string; } export interface KeepAutoresearchRunResult { /** Error text when the commit failed; `ok` is false. */ error?: string; /** Human note for the caller (e.g. "nothing to commit", "committed", "skipped"). */ note?: string; /** Commit SHA after the keep (null when nothing was committed). */ commitHash?: string | null; } /** * Keep an iteration: commit the modified files on a dedicated autoresearch * branch. Off-branch (degraded mode) auto-commit is skipped and the files stay * in the worktree, matching the extension contract. */ export declare function keepAutoresearchRun(input: KeepAutoresearchRunInput): Promise; export interface DiscardAutoresearchRunInput { cwd: string; /** Paths that were already dirty before the run started (workdir-relative). */ preRunDirtyPaths: string[]; /** True when on a dedicated `autoresearch/*` branch. */ onAutoresearchBranch: boolean; } export interface DiscardAutoresearchRunResult { error?: string; note?: string; } /** * Discard a failed/crashed iteration. On a dedicated autoresearch branch the * worktree resets to HEAD (never rewinding prior `keep` commits); off-branch * only run-modified paths are reverted so pre-existing user dirt survives. */ export declare function discardAutoresearchRun(input: DiscardAutoresearchRunInput): Promise;