/** * Worktree dispatch — unified native backend selector for the sentient loop. * * Provides a stable internal API surface for sentient tick + orchestrate.spawn * to invoke worktree operations. All dispatch routes through `@cleocode/worktree` * (native implementation — zero worktrunk dependency per D030). * * Usage from `cleo sentient tick`: * ```ts * import { pruneWorktreesForProject } from './worktree-dispatch.js'; * await pruneWorktreesForProject(projectRoot, activeTasks); * ``` * * Usage from `orchestrate.spawn`: * ```ts * import { spawnWorktree } from './worktree-dispatch.js'; * const result = await spawnWorktree(projectRoot, { taskId, hooks }); * ``` * * @task T1161 * @adr ADR-055 */ import type { CreateWorktreeOptions, CreateWorktreeResult, DestroyWorktreeOptions, DestroyWorktreeResult, ListWorktreesOptions, PruneWorktreesResult, WorktreeListEntry } from '@cleocode/contracts'; /** * Create a worktree for an agent task via the native backend. * * This is the canonical entry point for `orchestrate.spawn` to request a * worktree. It wraps `@cleocode/worktree.createWorktree` with the * uniform dispatch contract. * * @param projectRoot - Absolute path to the project root. * @param options - Create options including taskId and optional hooks. * @returns Creation result with env vars, preamble, and hook results. * * @task T1161 */ export declare function spawnWorktree(projectRoot: string, options: CreateWorktreeOptions): Promise; /** * Destroy a worktree for a completed task via the native backend. * * @param projectRoot - Absolute path to the project root. * @param options - Destroy options including taskId. * @returns Destruction result with cleanup details. * * @task T1161 */ export declare function teardownWorktree(projectRoot: string, options: DestroyWorktreeOptions): Promise; /** * List worktrees scoped to a project via the native backend. * * @param options - Optional project hash filter. * @returns Array of worktree list entries. * * @task T1161 */ export declare function listProjectWorktrees(options?: ListWorktreesOptions): WorktreeListEntry[]; /** * Prune orphaned worktrees for a project via the native backend. * * Called by `cleo sentient tick` every N ticks. Active task IDs are passed * to preserve worktrees that are still in use. * * @param projectRoot - Absolute path to the project root. * @param activeTaskIds - Set of task IDs whose worktrees should be preserved. * @returns Prune result with removed paths and error list. * * @task T1161 */ export declare function pruneWorktreesForProject(projectRoot: string, activeTaskIds: Set): PruneWorktreesResult; /** * Pre-warm the worktree backend module so synchronous operations are * available for the sentient tick loop. * * Call once during daemon initialization (before the first tick). Safe to * call multiple times — subsequent calls are no-ops. * * @task T1161 */ export declare function warmupWorktreeBackend(): Promise; //# sourceMappingURL=worktree-dispatch.d.ts.map