import { z } from 'zod'; /** * The Deliverable Contract: the declared set of facts a caller and MMA agree on for one * solution — `kind`, `audience`, `artifacts`, `acceptance`, and `disposition` — and the * canonical digest that binds a human approval to that exact content. * * A contract EMERGES through three states, so its shape widens with its state: * - `DraftContract` (exploration) — only `audience` is required. * - `ProposedContract` (spec / plan) — `kind`, `artifacts`, `acceptance`, and * `disposition` are required; every acceptance criterion carries an explicit * verification `method`. * - `ApprovedContract` (execution onward) — adds a digest-matched `contractApproval`. * Only `ApprovedContract` crosses the REST/MCP wire. * * The contract classifies nothing: there is no `subtype`, no per-task verification-strictness * field, no kind-confirmation field, and no kind registry anywhere in this module. `kind` is a * free-form, shape-checked label proposed by the agent and confirmed by the human. (A caller-facing * strictness default may still exist outside this module, at the user interface, but never as * contract validation state.) * * `canonicalContractDigest` is the one named, filesystem-free serialisation algorithm * every component (this package and Forge) computes identically. Workspace-aware checks * that need real filesystem access — realpath containment, disposition/git feasibility — * are deliberately NOT part of this module; they live at the server boundary, which has * a filesystem to check against. */ /** Timeout (milliseconds) applied to a `CommandCheck` when it declares none. */ export declare const DEFAULT_COMMAND_TIMEOUT_MS = 600000; /** Highest timeout (milliseconds) a `CommandCheck` may declare. */ export declare const MAX_COMMAND_TIMEOUT_MS = 1800000; /** Highest combined stdout+stderr byte count captured from one `CommandCheck` run. */ export declare const MAX_CAPTURED_OUTPUT_BYTES: number; /** * How an acceptance criterion is checked. `agent-review` is the review-by-worker method; * this contract API never uses the name `judge` for it. */ export declare const VERIFICATION_METHODS: readonly ["command", "agent-review", "human"]; export type VerificationMethod = typeof VERIFICATION_METHODS[number]; /** How the finished solution reaches the caller. Drives `mma-flow` LOCATE, not this module. */ export declare const DISPOSITIONS: readonly ["pr", "commit-in-place", "deliver-file"]; export type Disposition = typeof DISPOSITIONS[number]; /** Collapses `.` segments and repeated separators, and unifies separators to `/`. * Lexical only: no filesystem access, no symlink resolution. Used both to detect * duplicate artifacts after normalisation and inside `canonicalContractDigest`. */ export declare function normalizeArtifactPath(rawPath: string): string; export declare const declaredArtifactSchema: z.ZodObject<{ path: z.ZodString; root: z.ZodString; }, z.core.$strict>; export type DeclaredArtifact = z.infer; /** What a claim must be checked against, as stated in the approved contract. */ export declare const declaredReferenceSchema: z.ZodObject<{ kind: z.ZodString; locator: z.ZodOptional; version: z.ZodOptional; digest: z.ZodOptional; reason: z.ZodOptional; }, z.core.$strict>; export type DeclaredReference = z.infer; /** What was actually observed at check time, as recorded in evidence. Never part of the * declared contract — a declared reference must not carry an observation timestamp. */ export declare const resolvedReferenceSchema: z.ZodObject<{ locator: z.ZodOptional; version: z.ZodOptional; digest: z.ZodOptional; observedAt: z.ZodString; }, z.core.$strict>; export type ResolvedReference = z.infer; export declare const commandCheckSchema: z.ZodObject<{ program: z.ZodString; args: z.ZodArray; cwd: z.ZodOptional; timeoutMs: z.ZodOptional; }, z.core.$strict>; export type CommandCheck = z.infer; export declare const deliverableAcceptanceSchema: z.ZodObject<{ id: z.ZodString; criterion: z.ZodString; method: z.ZodEnum<{ command: "command"; "agent-review": "agent-review"; human: "human"; }>; references: z.ZodArray; version: z.ZodOptional; digest: z.ZodOptional; reason: z.ZodOptional; }, z.core.$strict>>; command: z.ZodOptional; cwd: z.ZodOptional; timeoutMs: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>; export type DeliverableAcceptance = z.infer; export declare const contractApprovalSchema: z.ZodObject<{ contractDigest: z.ZodString; approvedBy: z.ZodString; approvedAt: z.ZodString; }, z.core.$strict>; export type ContractApproval = z.infer; export declare const draftContractSchema: z.ZodObject<{ state: z.ZodLiteral<"draft">; audience: z.ZodString; kind: z.ZodOptional; }, z.core.$strict>; export type DraftContract = z.infer; export declare const proposedContractSchema: z.ZodObject<{ audience: z.ZodString; kind: z.ZodString; artifacts: z.ZodArray>; acceptance: z.ZodArray; references: z.ZodArray; version: z.ZodOptional; digest: z.ZodOptional; reason: z.ZodOptional; }, z.core.$strict>>; command: z.ZodOptional; cwd: z.ZodOptional; timeoutMs: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>; disposition: z.ZodEnum<{ pr: "pr"; "commit-in-place": "commit-in-place"; "deliver-file": "deliver-file"; }>; state: z.ZodLiteral<"proposed">; }, z.core.$strict>; export type ProposedContract = z.infer; export declare const approvedContractSchema: z.ZodObject<{ contractApproval: z.ZodObject<{ contractDigest: z.ZodString; approvedBy: z.ZodString; approvedAt: z.ZodString; }, z.core.$strict>; audience: z.ZodString; kind: z.ZodString; artifacts: z.ZodArray>; acceptance: z.ZodArray; references: z.ZodArray; version: z.ZodOptional; digest: z.ZodOptional; reason: z.ZodOptional; }, z.core.$strict>>; command: z.ZodOptional; cwd: z.ZodOptional; timeoutMs: z.ZodOptional; }, z.core.$strict>>; }, z.core.$strict>>; disposition: z.ZodEnum<{ pr: "pr"; "commit-in-place": "commit-in-place"; "deliver-file": "deliver-file"; }>; state: z.ZodLiteral<"approved">; }, z.core.$strict>; export type ApprovedContract = z.infer; /** The digest content: every field an approval is over, and nothing else. `state` and * `contractApproval` are deliberately excluded from this type — passing a full * `ProposedContract` or `ApprovedContract` is fine, since both are structural * supersets and the extra fields are simply not read. */ type ContractDigestContent = Pick; export declare function canonicalContractDigest(contract: ContractDigestContent): string; export {}; //# sourceMappingURL=deliverable-contract.d.ts.map