@sema-agent/core
Version:
Stateless, task-oriented AI agent core
27 lines (26 loc) • 1.93 kB
TypeScript
/** The file-history REQUEST door and its bad-value doors — the pre-acquire half of the file-history phase (`prepare-file-history.ts`). */
import type { FileHistoryStore } from "../file-history-store.js";
import type { RunnerDeps, TaskSpec } from "../types.js";
/**
* The file-history REQUEST door: every refusal the request (`TaskSpec`) and the deployment's own seats decide
* without the session, the env or the store's contents — the three bad-value doors (`RunnerDeps.onTrackFailure`,
* `RunnerDeps.fileHistoryStore` / `fileHistoryCapture`, `TaskSpec.fileHistory`), the retired `rewindFiles` restore
* sense, the restoreFiles / resumeAt / rewindFilesTo contradictions, and a restore asked of a run that holds no
* history (`rewind.capture_disabled` / `rewind.store_unconfigured`). SYNCHRONOUS and side-effect free; the driver
* calls it BEFORE the session is acquired, so a request refused here leaves the session — its leaf included —
* exactly as it was. What it resolves rides into the file-history phase (`prepareFileHistory`) unchanged.
*/
export declare function resolveFileHistoryRequest(spec: Pick<TaskSpec, "resumeAt" | "resumeAtMode" | "restoreFiles" | "rewindFilesTo" | "fileHistory">, deps: Pick<RunnerDeps, "onTrackFailure" | "fileHistoryStore" | "fileHistoryCapture">): FileHistoryRequest;
/** What {@link resolveFileHistoryRequest} resolved: the validated seats and words, the run's store (after every off
* switch) and its capture store, and the restore target (`undefined` = no restore asked). */
export interface FileHistoryRequest {
onTrackFailure: "refuse" | "proceed-unprotected";
wiredSeat: FileHistoryStore | "disabled" | undefined;
runDeclaredOff: boolean;
captureOff: boolean;
declaredOff: boolean;
fileHistoryStore: FileHistoryStore | undefined;
captureStore: FileHistoryStore | undefined;
rewindTarget: string | undefined;
rewindBefore: boolean;
}