import { z } from "zod"; import { type Delegation, type SidekickResult } from "./protocol.js"; /** Paths are host-private. The adapter must realpath and prove ownership/isolation before launch. */ export declare const worktreeBindingSchema: z.ZodObject<{ delegationId: z.ZodUUID; baseCommitSha: z.ZodString; leadRealPath: z.ZodString; workerRealPath: z.ZodString; worktreeId: z.ZodUUID; }, z.core.$strict>; export type WorktreeBinding = z.infer; export declare const resumeCursorSchema: z.ZodObject<{ version: z.ZodNumber; kind: z.ZodEnum<{ codex: "codex"; claude_code: "claude_code"; }>; data: z.ZodType>; }, z.core.$strict>; export type SidekickResumeCursor = z.infer; /** Malformed or foreign driver cursors mean no native resume, never a fresh inference admission. */ export declare function readResumeCursor(input: unknown, kind: "codex" | "claude_code"): SidekickResumeCursor | undefined; export declare const localWorkerBindingSchema: z.ZodObject<{ protocolVersion: z.ZodLiteral<1>; delegationId: z.ZodUUID; attemptId: z.ZodUUID; generation: z.ZodString; worktree: z.ZodObject<{ delegationId: z.ZodUUID; baseCommitSha: z.ZodString; leadRealPath: z.ZodString; workerRealPath: z.ZodString; worktreeId: z.ZodUUID; }, z.core.$strict>; resume: z.ZodNullable; data: z.ZodType>; }, z.core.$strict>>; }, z.core.$strict>; export type LocalWorkerBinding = z.infer; export declare const patchFileSchema: z.ZodObject<{ path: z.ZodString; status: z.ZodEnum<{ added: "added"; modified: "modified"; deleted: "deleted"; }>; beforeSha256: z.ZodNullable; afterSha256: z.ZodNullable; }, z.core.$strict>; export declare const patchResultSchema: z.ZodObject<{ result: z.ZodObject<{ protocolVersion: z.ZodLiteral<1>; delegationId: z.ZodUUID; attemptId: z.ZodUUID; generation: z.ZodString; baseCommitSha: z.ZodString; summary: z.ZodString; patch: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"no_change">; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"patch">; sha256: z.ZodString; bytes: z.ZodNumber; }, z.core.$strict>], "kind">; changedFiles: z.ZodArray; beforeSha256: z.ZodNullable; afterSha256: z.ZodNullable; }, z.core.$strict>>; tests: z.ZodArray; exitCode: z.ZodNullable; }, z.core.$strict>>; warnings: z.ZodArray; complete: z.ZodBoolean; digest: z.ZodString; }, z.core.$strict>; patchText: z.ZodString; }, z.core.$strict>; export type PatchResult = z.infer; export declare const reviewDecisionSchema: z.ZodEnum<{ apply: "apply"; take_over: "take_over"; discard: "discard"; }>; /** Review is intent, not host approval. Every action is generation/result fenced and replayable. */ export declare const applyReviewSchema: z.ZodObject<{ protocolVersion: z.ZodLiteral<1>; operationId: z.ZodUUID; delegationId: z.ZodUUID; generation: z.ZodString; resultDigest: z.ZodString; expectedBaseCommitSha: z.ZodString; expectedWorkingTreeDigest: z.ZodString; decision: z.ZodEnum<{ apply: "apply"; take_over: "take_over"; discard: "discard"; }>; }, z.core.$strict>; export type ApplyReview = z.infer; export declare const applyOutcomeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ status: z.ZodEnum<{ taken_over: "taken_over"; discarded: "discarded"; applied: "applied"; already_applied: "already_applied"; }>; resultDigest: z.ZodString; }, z.core.$strict>, z.ZodObject<{ status: z.ZodLiteral<"conflict">; resultDigest: z.ZodString; conflictPaths: z.ZodArray; }, z.core.$strict>], "status">; export type ApplyOutcome = z.infer; export declare const reviewReceiptSchema: z.ZodObject<{ operationId: z.ZodUUID; delegationId: z.ZodUUID; requestDigest: z.ZodString; resultDigest: z.ZodString; decision: z.ZodEnum<{ apply: "apply"; take_over: "take_over"; discard: "discard"; }>; }, z.core.$strict>; export type ReviewReceipt = z.infer; export type ReviewHostContext = { nowMs: number; hostApproved: boolean; actualBaseCommitSha: string; actualWorkingTreeDigest: string; /** Verified under the checkout lock using exact patch bytes and canonical file manifest. */ patchCheck: "passed" | "conflict"; }; /** * Reference preconditions only. The production adapter must hold an exclusive * checkout lock, verify object/path ownership, and reconcile a failed mutation. * The checkout and receipt are separate writes: a process crash can interrupt * them, so stale locks or ambiguous partial writes must fail closed for * operator recovery. This function is NOT an atomic filesystem implementation. */ export declare function checkReview(rawRequest: ApplyReview, delegation: Delegation, context: ReviewHostContext, existing?: ReviewReceipt): "accepted" | "duplicate"; export interface LocalReviewAdapter { /** Validate patch bytes and manifest at storage ingress, before returning public evidence. */ result(delegationId: string): Promise; /** Explicit host approval is obtained outside model-supplied arguments. */ review(request: ApplyReview): Promise; }