/** * Initiative Record — the frozen typed error union (SPEC-001, "Interfaces / contracts"). * * TRANSCRIPTION, not design: these five variants, and exactly these fields per variant, * are pinned by the specification's `TypedError` union. No domain failure is represented * as an untyped string or a partially successful result — every repository and service * failure documented in SPEC-001 throws one of these. */ export type InitiativeErrorCode = 'revision_conflict' | 'cross_product_workspace_link' | 'not_found' | 'invalid_request' | 'migration_backup_failed' | 'cross_initiative_evidence_link' | 'cross_initiative_verification' | 'task_not_claimable' | 'task_claim_conflict' | 'invalid_task_transition' | 'invalid_phase_transition' | 'unknown_lifecycle_contract' | 'unknown_method' | 'unknown_delivery_contract' | 'duplicate_target_adapter' | 'target_adapter_validation_failed' | 'verification_method_not_runnable' | 'initiative_already_exists'; /** A mutation's `expected_revision` did not match the stored revision (FR-7, AC-1.4). */ export declare class RevisionConflictError extends Error { readonly code: "revision_conflict"; readonly entity_type: string; readonly entity_id: string; readonly expected_revision: number; readonly actual_revision: number; constructor(params: { entity_type: string; entity_id: string; expected_revision: number; actual_revision: number; message?: string; }); } /** `initiative_link_workspace` targeted a Workspace outside the Initiative's Product (FR-11, AC-1.7). */ export declare class CrossProductWorkspaceLinkError extends Error { readonly code: "cross_product_workspace_link"; readonly initiative_id: string; readonly workspace_id: string; constructor(params: { initiative_id: string; workspace_id: string; message?: string; }); } /** A `get`, `status`, `relate`, or link lookup did not resolve to a stored record. */ export declare class NotFoundError extends Error { readonly code: "not_found"; readonly entity_type: string; readonly lookup: string; constructor(params: { entity_type: string; lookup: string; message?: string; }); } /** * A request failed boundary validation (malformed Zod input, an idempotency-key reuse * with different business input, or a status/outcome pairing rejection) before any write. */ export declare class InvalidRequestError extends Error { readonly code: "invalid_request"; readonly field_errors: Record; constructor(params: { field_errors: Record; message?: string; }); } /** A versioned migration's backup-before-upgrade step failed or could not be verified (FR-12). */ export declare class MigrationBackupFailedError extends Error { readonly code: "migration_backup_failed"; readonly database_path: string; readonly backup_path: string; constructor(params: { database_path: string; backup_path: string; message?: string; }); } /** `evidence_link` targeted a record outside the Evidence's own Initiative (SPEC-002 FR-8). */ export declare class CrossInitiativeEvidenceLinkError extends Error { readonly code: "cross_initiative_evidence_link"; readonly evidence_id: string; readonly target_type: string; readonly target_id: string; constructor(params: { evidence_id: string; target_type: string; target_id: string; message?: string; }); } /** `verification_record`'s `acceptance_criterion_id` resolves (via its Requirement) to a different Initiative (SPEC-002 "Interfaces / contracts"). */ export declare class CrossInitiativeVerificationError extends Error { readonly code: "cross_initiative_verification"; readonly initiative_id: string; readonly acceptance_criterion_id: string; constructor(params: { initiative_id: string; acceptance_criterion_id: string; message?: string; }); } /** A claim was attempted on a Task whose status is not `open` (SPEC-003 FR-9, AC-1.7). */ export declare class TaskNotClaimableError extends Error { readonly code: "task_not_claimable"; readonly task_id: string; readonly status: string; constructor(params: { task_id: string; status: string; message?: string; }); } /** * A `initiative_task_release`, `initiative_task_complete`, or ownership-gated * `initiative_task_execution` transition was attempted by a caller other than * the Task's claimant (SPEC-003 FR-9, AC-1.10). Release additionally exempts * `provenance.actor_type: 'human'` — the store applies that override before * throwing this error, never after. */ export declare class TaskClaimConflictError extends Error { readonly code: "task_claim_conflict"; readonly task_id: string; readonly claimed_by: string | null; readonly authorized_by: string; constructor(params: { task_id: string; claimed_by: string | null; authorized_by: string; message?: string; }); } /** An unlisted Task status transition, or a `completed` transition missing a non-null outcome (SPEC-003 FR-9). */ export declare class InvalidTaskTransitionError extends Error { readonly code: "invalid_task_transition"; readonly task_id: string; readonly from_status: string; readonly to_status: string; constructor(params: { task_id: string; from_status: string; to_status: string; message?: string; }); } /** * An `initiative_phase_enter` / `_satisfy` / `_reopen` / `_skip` mutation named a source * Phase Record state outside that operation's legal transition set (SPEC-004 FR-2, "Data * model" transition table). */ export declare class InvalidPhaseTransitionError extends Error { readonly code: "invalid_phase_transition"; readonly initiative_id: string; readonly phase: string; readonly source_state: string; readonly target_state: string; constructor(params: { initiative_id: string; phase: string; source_state: string; target_state: string; message?: string; }); } /** * `initiative_create` or `initiative_set_lifecycle_contract` named a non-null `lifecycle_contract` * id with no matching row in `lifecycle_contracts` (SPEC-004 FR-7). */ export declare class UnknownLifecycleContractError extends Error { readonly code: "unknown_lifecycle_contract"; readonly lifecycle_contract: string; constructor(params: { lifecycle_contract: string; message?: string; }); } /** * A syntactically valid but unregistered Method identifier — a request `method`, a Task * `initiative_task_create.method`, or `initiative_task_set_method.method` names no row in * `methods` (SPEC-005 FR-2, FR-3). */ export declare class UnknownMethodError extends Error { readonly code: "unknown_method"; readonly method: string; constructor(params: { method: string; message?: string; }); } /** * A syntactically valid but unregistered Delivery Contract identifier — a `delivery_contract_get` * lookup or a Deliverable operation's `delivery_contract` names no row in `delivery_contracts` * (SPEC-007 FR-1, FR-3). */ export declare class UnknownDeliveryContractError extends Error { readonly code: "unknown_delivery_contract"; readonly delivery_contract: string; constructor(params: { delivery_contract: string; message?: string; }); } /** * `registerTargetAdapter` was called with a `target_type` that already has a registered * adapter (SPEC-007 FR-8, "Interfaces / contracts" — "The registry must reject duplicate * registrations for the same `target_type` as a conflict-shaped typed error."). Conflict-shaped, * like `RevisionConflictError` and `TaskClaimConflictError` — Task I-8 maps it to HTTP 409. */ export declare class DuplicateTargetAdapterError extends Error { readonly code: "duplicate_target_adapter"; readonly target_type: string; constructor(params: { target_type: string; message?: string; }); } /** * A registered `TargetAdapter.validate` call threw, or returned a value that fails the * `{ valid: boolean, detail: string }` shape, during `deliverable_validate` (SPEC-007 FR-8, * FR-9, "Interfaces / contracts"). The store must leave the Deliverable's stored * `validation_state`/`validation_detail`, revision, and Events unchanged — this error is * detected and thrown before any write for the mutation. */ export declare class TargetAdapterValidationFailedError extends Error { readonly code: "target_adapter_validation_failed"; readonly target_type: string; constructor(params: { target_type: string; message?: string; }); } /** * `verification_run`'s `method` names `'agent-review'` or `'human'` — neither can be * machine-run; only `'command'` may be executed by this operation (those two methods stay * reachable exclusively through `verification_record`). */ export declare class VerificationMethodNotRunnableError extends Error { readonly code: "verification_method_not_runnable"; readonly method: string; constructor(params: { method: string; message?: string; }); } /** * `initiative_import` named a snapshot `initiative.uuid` or `initiative.human_key` that already * exists in the target store. Conflict-shaped, like `RevisionConflictError` and * `DuplicateTargetAdapterError` — the HTTP/MCP adapters map it to 409. Import never silently * merges into an existing Initiative. */ export declare class InitiativeAlreadyExistsError extends Error { readonly code: "initiative_already_exists"; readonly uuid: string; readonly human_key: string; constructor(params: { uuid: string; human_key: string; message?: string; }); } /** The frozen typed error union — the exact runtime counterpart of SPEC-001's `TypedError`, extended by SPEC-002, SPEC-003, SPEC-004, SPEC-005, SPEC-007, and the MMA Next gap-closure additions (verification execution, Initiative portability). */ export type InitiativeError = RevisionConflictError | CrossProductWorkspaceLinkError | NotFoundError | InvalidRequestError | MigrationBackupFailedError | CrossInitiativeEvidenceLinkError | CrossInitiativeVerificationError | TaskNotClaimableError | TaskClaimConflictError | InvalidTaskTransitionError | InvalidPhaseTransitionError | UnknownLifecycleContractError | UnknownMethodError | UnknownDeliveryContractError | DuplicateTargetAdapterError | TargetAdapterValidationFailedError | VerificationMethodNotRunnableError | InitiativeAlreadyExistsError; export declare function isInitiativeError(err: unknown): err is InitiativeError; /** Flattens a `ZodError`-shaped issue list into the `field_errors` shape `InvalidRequestError` carries. */ export declare function fieldErrorsFromIssues(issues: ReadonlyArray<{ path: ReadonlyArray; message: string; }>): Record; //# sourceMappingURL=errors.d.ts.map