import { describe } from 'vitest';
import { spawnSync, spawn } from 'child_process';
/**
 * Shared fixture for the routines.*.test.ts suite slices (RUSH-2819).
 *
 * routines.test.ts was one 2,249-line file measured at ~194s of test time —
 * one of the slowest files in CI, serializing an entire fork while every
 * other selected file finished. The suite is split into topical slices so
 * vitest's per-file fork parallelism can spread the subprocess-heavy tests
 * across workers; the helpers each slice shares live here.
 *
 * Every test spawns the real CLI (`node --import tsx src/index.ts routines ...`)
 * against an isolated mkdtemp HOME — no live ~/.agents state, no mocks, no
 * imported writeJob/readJob. Modeled on `routines-webhook.test.ts`.
 */
export declare const REPO_ROOT: string;
export declare const TSX_IMPORT: string;
export declare const CLI_ENTRYPOINT: string;
export declare const describeRoutines: typeof describe.skip;
/** Provision an isolated HOME with agents.yaml, .system/.git, and optional routines + device registry. */
export declare function makeHome(opts?: {
    jobs?: Record<string, unknown>[];
    projectJobs?: Record<string, unknown>[];
    registry?: Record<string, unknown>;
    deviceRoutines?: Record<string, string[]>;
    /** Full mkdtemp prefix override — the daemon harness scopes its leak sweep by it. */
    tmpPrefix?: string;
}): string;
/** Run `agents routines <args>` against an isolated HOME. */
export declare function run(home: string, args: string[], extraEnv?: Record<string, string>, cwd?: string): ReturnType<typeof spawnSync>;
export declare function readRoutineYaml(home: string, name: string): Record<string, unknown> | null;
export declare function writeRunMeta(home: string, jobName: string, runId: string, meta: Record<string, unknown>): void;
export declare function isProcessAlive(pid: number): boolean;
/**
 * Per-file isolated-daemon harness (RUSH-2367, RUSH-2819). Each slice that
 * spawns a real `__daemon-run` process against an isolated HOME calls this
 * once at module scope and registers its own leak detector — the tracked pid
 * set MUST be private to the file that spawned it, since vitest's per-file
 * fork isolation means the leak sweep only ever needs to answer for what THIS
 * file started.
 *
 * `fileSlug` MUST be unique per test file: it names the mkdtemp prefix
 * `makeDaemonHome` uses, and the CI leak sweep matches ONLY that prefix.
 * The suite slices run in parallel forks, so a sweep over the shared
 * `agents-routines-test-` prefix would catch a sibling file's still-running
 * daemon and kill it mid-test — exactly what failed the first CI run of the
 * RUSH-2819 split (run 32552954164: add's sweep killed a live daemon whose
 * HOME belonged to a concurrently running slice).
 */
export declare function createDaemonHarness(fileSlug: string): {
    startIsolatedDaemon: (home: string) => {
        child: ReturnType<typeof spawn>;
        pidPromise: Promise<number | null>;
    };
    stopIsolatedDaemon: (child: ReturnType<typeof spawn>) => Promise<void>;
    registerLeakDetector: () => void;
    makeDaemonHome: (opts?: Omit<Parameters<typeof makeHome>[0], 'tmpPrefix'>) => string;
};
export declare const baseJob: {
    name: string;
    schedule: string;
    agent: string;
    prompt: string;
    cwd: string;
    enabled: boolean;
};
export declare const registry: {
    'yosemite-s0': {
        name: string;
        platform: string;
    };
    'mac-mini': {
        name: string;
        platform: string;
    };
    zion: {
        name: string;
        platform: string;
    };
};
export declare function readDeviceRoutines(home: string, device: string): string[];
export declare function writeDeviceRoutines(home: string, device: string, routines: string[]): void;
/** Write a minimal project YAML so listProjectDefs() sees it. */
export declare function writeProject(home: string, name: string): void;
/** Env that points the projects dir at the isolated home. */
export declare function projectsEnv(home: string): Record<string, string>;
