import type { ExtensionContext, ExecResult as PiExecResult } from "@earendil-works/pi-coding-agent"; import type { EvaluatorHost } from "./evaluator-internals/context.ts"; /** * Per-test scratch `$HOME` fixture. Registers `beforeEach` / * `afterEach` that: * * - `mkdtempSync` a fresh temp dir using `prefix`, * - save `process.env["HOME"]`, point it at the temp dir, * - restore `process.env["HOME"]` and recursively remove the temp * dir on teardown. * * Used by every test surface that exercises the loader's two-layer * discovery (`index.test.ts`, `loader.test.ts`, * `internal/session-runtime.test.ts`) so the per-file scratch-HOME * boilerplate stays in one place. * * The temp dir path is exposed via the optional `onReady` callback, * fired inside `beforeEach`; tests typically stash it in a * describe-scoped `let` for terser reads. */ export declare function useIsolatedHome(prefix: string, onReady?: (tmp: string) => void): void; /** * Like {@link useIsolatedHome} but also chdirs into the scratch dir, so factory-time tests find the per-test config via the loader's project layer. macOS tmpdir is a symlink; canonicalized via `realpathSync` so cwd-mismatch tests don't see false-divergence. */ export declare function useScratchHome(prefix: string, onReady?: (tmp: string) => void): void; /** * Write a single-file steering config to `/.pi/steering.ts`. * `body` is the full module source (must include `export default`). * Used by suites whose fixtures embed regex literals or other * non-JSON-friendly module shapes inline. */ export declare function writeSteeringSingleFileConfig(dir: string, body: string): void; /** * Write a directory-form steering config to * `/.pi/steering/index.ts`. `body` is the full module source * (must include `export default`). Mirrors the layout the bin tests * use for their isolated `@cad0p/pi-steering` invocations. */ export declare function writeSteeringDirConfig(dir: string, body: string): void; /** * Exact shape pi's `sessionManager.getEntries()` returns for entries * produced by `appendEntry`. The evaluator filters to `type: "custom"`, * matches by `customType`, and reads `{ data, timestamp }` — other * fields (`id`, `parentId`) exist on real entries so we mirror them * here to avoid silent type drift. */ export interface CustomEntry { readonly type: "custom"; readonly customType: string; readonly data: unknown; readonly timestamp: string; readonly id: string; readonly parentId: string | null; } /** * Minimal stub for pi's `ExtensionContext`. Only the fields the * evaluator + observer-dispatcher read are populated; everything else * throws if touched so accidental reliance on unsupported surface * breaks loudly. * * The `entries` array mimics `sessionManager.getEntries()` output — * tests that want cross-handler `findEntries` visibility pass * `host.entries` (from {@link makeTrackedHost}) here so the host's * `appendEntry` writes show up on subsequent reads. */ export declare function makeCtx(cwd: string, entries?: ReadonlyArray): ExtensionContext; /** * Tracked {@link EvaluatorHost} recording every exec / appendEntry * call so tests can assert memoization + audit logging. * * `entries` is the backing array `makeCtx` wraps when tests want the * host's `appendEntry` writes visible to a later `findEntries` read. * Timestamps are monotonically-incrementing second-level ISO strings * so ordering asserts stay stable inside the same millisecond. */ export interface TrackedHost extends EvaluatorHost { readonly execCalls: Array<{ cmd: string; args: string[]; cwd: string; }>; readonly appended: Array<{ type: string; data: unknown; }>; readonly entries: CustomEntry[]; } /** * Build a {@link TrackedHost}. Optional `exec` override lets evaluator * tests count real invocations against the cache (the default exec * returns `{ stdout: "", stderr: "", code: 0, killed: false }`). */ export declare function makeTrackedHost(options?: { exec?: (cmd: string, args: string[], cwd: string) => Promise; }): TrackedHost; //# sourceMappingURL=__test-helpers__.d.ts.map