import { type DecisionArtifactRecord, type OwnerDecisionFactStore } from './owner-review.js'; import { type OwnerResolutionAction } from './pitask-metadata.js'; import { type FormationDiagnosisProjection } from './formation-context.js'; export type DeterministicCheckStatus = 'passed' | 'failed' | 'not_run' | 'unavailable'; export type ReviewEvidenceCompleteness = 'complete' | 'partial' | 'insufficient'; export type EvidenceClass = 'deterministic_check' | 'runtime_observation' | 'automated_review' | 'declared_case' | 'provenance'; export interface OwnerDecisionReviewStore extends OwnerDecisionFactStore { getArtifactById(artifactId: string): Promise; } export interface OwnerEvidenceItem { readonly evidenceClass: EvidenceClass; readonly label: string; readonly value: string; } export interface BoundEvidenceManifestV1 { readonly schemaVersion: 'owner-review-evidence-v1'; readonly digestAlgorithm: 'sha256'; readonly sources: readonly { readonly role: 'decision' | 'scribe' | 'artificer' | 'evaluator' | 'rollout'; readonly stableId: string; readonly contentHash: string; }[]; readonly semanticFacts: { readonly completeness: ReviewEvidenceCompleteness; readonly deterministicStatuses: readonly { readonly check: string; readonly status: DeterministicCheckStatus; }[]; readonly offeredActions: readonly OwnerResolutionAction[]; readonly acceptRequirement: string; readonly briefSemanticHash: string; }; } export interface EvaluatorDecisionBrief { readonly kind: 'evaluator'; readonly principle: { readonly title?: string; readonly statement?: string; readonly rationale?: string; readonly scope: readonly string[]; }; readonly implementation: { readonly summary?: string; readonly affectedTools: readonly string[]; readonly risks: readonly string[]; }; readonly strengths: readonly string[]; readonly concerns: readonly string[]; readonly requiredChanges: readonly string[]; readonly score?: number; /** * PRI-704 / PRI-703 Phase 4 (Owner decision 2026-09-07): 5-item Principle * Quality Checklist — a DETERMINISTIC review aid derived from durable facts * (no LLM scoring, no second evaluation pass). Each item answers one Owner * question with pass/fail + evidence-based notes; a missing supporting * fact = fail with an explicit note (never silently omitted — the Owner * sees exactly which quality dimension lacks support). Older snapshots * lack the key (forward-compatible read). */ readonly qualityChecklist?: PrincipleQualityChecklist; /** * PRI-858: bounded formation evidence (pain provenance + source diagnosis). * Display-only; never feeds completeness/capability. Absent when the lineage * id is missing (legacy) — present-but-degraded when resolution failed * (see `OwnerFormationEvidence`). */ readonly formationEvidence?: OwnerFormationEvidence; } /** * The five Owner-facing quality questions (PRI-704): * understandability — can the Owner understand it from the brief alone? * evidence — does it come from a real pain/diagnosis? * actionability — would an agent know what to do differently next time? * generalization — does it avoid over-fitting to a single file/task? * boundary — is the applicability scope explicit? */ export interface PrincipleQualityChecklist { readonly schemaVersion: 1; readonly items: readonly PrincipleQualityChecklistItem[]; } export interface PrincipleQualityChecklistItem { readonly id: 'understandability' | 'evidence' | 'actionability' | 'generalization' | 'boundary'; readonly pass: boolean; /** Bounded evidence-based explanation (why pass / what is missing). */ readonly note: string; } /** * PRI-858 (CIL-002): bounded formation evidence — the pain/diagnosis that * PRODUCED this principle — projected onto the Owner decision snapshot via the * existing `resolveFormationContext` contract. OBSERVATION EVIDENCE ONLY: * nothing here feeds `completeness`, `allowedActions` or `acceptRequirement` * (those stay owned by deriveOwnerDecisionCapability + the deterministic * gates). Absent on legacy snapshots and when the scribe artifact carries no * authoritative dreamer lineage id (forward-compatible read, same discipline * as `qualityChecklist`). When the id exists but resolution fails, the field * is present WITHOUT `diagnosis` and the reason is observable in `notes` * (rc-9: degradation is never silent). */ export interface OwnerFormationEvidence { readonly version: string; readonly sourcePainId: string | null; readonly diagnosis?: FormationDiagnosisProjection; readonly provenance: { readonly sourceDreamerArtifactId: string; readonly sourceDiagnosisArtifactId: string | null; readonly sourceDiagnosisTaskId: string | null; }; /** Truncation + resolver degradation notes, bounded (rc-9). */ readonly notes: readonly string[]; } export interface RolloutDecisionBrief { readonly kind: 'rollout'; readonly summary?: string; readonly requiredChanges: readonly string[]; readonly risks: readonly string[]; } export type OwnerDecisionBrief = EvaluatorDecisionBrief | RolloutDecisionBrief; export interface OwnerDecisionReviewSnapshot { readonly schemaVersion: 'owner-decision-review-v1'; readonly reviewKey: string; readonly taskId: string; readonly kind: 'evaluator' | 'rollout'; readonly brief: OwnerDecisionBrief; readonly evidence: { readonly completeness: ReviewEvidenceCompleteness; readonly deterministicChecks: readonly { readonly check: string; readonly status: DeterministicCheckStatus; }[]; readonly items: readonly OwnerEvidenceItem[]; readonly manifest: BoundEvidenceManifestV1; readonly digest: string; }; readonly capability: { readonly baseAllowedActions: readonly OwnerResolutionAction[]; readonly finalOfferedActions: readonly OwnerResolutionAction[]; readonly acceptRequirement: { readonly kind: 'none'; } | { readonly kind: 'acknowledge_partial_evidence'; } | { readonly kind: 'forbidden'; readonly reasonCode: string; }; }; readonly staleBinding: { readonly expectedRevisionEpoch: number; readonly expectedSourceRunId: string; readonly expectedSourceArtifactId: string; readonly expectedSourceArtifactHash: string; readonly expectedEvidenceDigest: string; }; readonly reasonCode: string; readonly legacy: boolean; readonly createdAt: string; } export declare function buildOwnerDecisionReview(store: OwnerDecisionReviewStore, taskId: string): Promise; //# sourceMappingURL=owner-decision-review.d.ts.map