import { type ArtifactPin, type DecisionDefinition, type DecisionRuleset, type JsonValue } from './types.js'; import type { CreateReviewInput } from './review/types.js'; import { type QualificationIntegrityMetadata } from './qualification/release.js'; import { type PairedDifferenceInterval, type QualificationSplit } from './qualification/quality.js'; import { type DecisionSensitivity, type DecisionTrust } from './projection.js'; import { CalibrationRegistry } from './calibration/registry.js'; import type { CompatibilityPolicy, CompatibilityRequest } from './calibration/types.js'; export declare const SDLC_SCREENING_SCHEMA_VERSION: "decision-sdlc-evidence-screening/v1"; export declare const SDLC_SCREENING_PREREGISTRATION_VERSION: "decision-sdlc-screening-preregistration/v1"; export declare const SDLC_SCREENING_PREREGISTRATION_VERSION_V2: "decision-sdlc-screening-preregistration/v2"; export declare const SDLC_SCREENING_RELEASE_VERSION: "decision-sdlc-screening-release/v1"; /** Release reports over a v2 preregistration (nullable NI); v1 stays bound to v1 preregistrations. */ export declare const SDLC_SCREENING_RELEASE_VERSION_V2: "decision-sdlc-screening-release/v2"; export declare const SDLC_SCREENING_HELDOUT_RECORDS_VERSION: "decision-sdlc-screening-heldout-records/v1"; export declare const SDLC_SCREENING_HELDOUT_REPORT_VERSION: "decision-sdlc-screening-heldout-report/v1"; export declare const SDLC_GATE_EVIDENCE_POLICY_KIND: "SdlcGateEvidencePolicy"; export type SdlcScreeningMode = 'disabled' | 'shadow' | 'advisory'; export type SdlcScreeningSubjectKind = 'citation' | 'phase-criterion'; export type SdlcDeterministicStatus = 'pass' | 'review' | 'fail'; export type SdlcScreeningRoute = 'ADVISORY_READY' | 'REVIEW' | 'FAIL' | 'INSUFFICIENT_EVIDENCE'; export type SdlcSupportLabel = 'supports' | 'does-not-support' | 'contradicts' | 'unclear'; export type SdlcPreflightReason = 'subject-isolation-violated' | 'unknown-id' | 'source-not-found' | 'locator-not-found' | 'source-not-retrieved' | 'source-provenance-unverified' | 'publication-not-authorized' | 'artifact-missing' | 'test-failed' | 'approval-absent' | 'signature-invalid' | 'schema-invalid' | 'evidence-expired' | 'criterion-missing' | 'required-evidence-missing' | 'evidence-untrusted' | 'evidence-restricted' | 'content-digest-mismatch' | 'invalid-observation' | 'calibration-incompatible' | 'duplicate-evidence-id' | 'foreign-evidence' | 'invalid-evidence' | 'content-unverified' | 'evidence-trust-mismatch' | 'gate-policy-untrusted' | 'gate-policy-mismatch' | 'gate-policy-invalid' | 'invalid-request'; export interface SdlcScreeningPin { id: string; version: string; digest: `sha256:${string}`; } /** * Evidence facts in a subject (`present`, `passed`, `retrieved`, `provenanceVerified`, ...) * are caller-asserted. This module fails closed on what it is told plus the trusted * gate policy; hosts must source these facts from the deterministic validators. */ export interface SdlcSourceEvidence extends SdlcScreeningPin { locator: string; locatorExists: boolean; retrieved: boolean; contentDigest: `sha256:${string}`; /** Omitted content cannot be digest-verified, so the source stays non-ready. */ content?: string; provenanceVerified: boolean; publicationAuthorized: boolean; trust: DecisionTrust; sensitivity: DecisionSensitivity; } export interface SdlcGateEvidenceItem extends SdlcScreeningPin { type: 'artifact' | 'test-result' | 'approval' | 'signature' | 'schema'; /** Informational only; the trusted gate policy decides what is required. */ required: boolean; present: boolean; passed: boolean; expiresAtEpochMs?: number; } export interface SdlcCitationSubject { kind: 'citation'; subjectId: string; claimId: string; requirementIds: string[]; sourceId: string; locator: string; evidence: [SdlcSourceEvidence]; } export interface SdlcPhaseCriterionSubject { kind: 'phase-criterion'; subjectId: string; criterionId: string; requirementIds: string[]; evidence: SdlcGateEvidenceItem[]; } export type SdlcScreeningSubject = SdlcCitationSubject | SdlcPhaseCriterionSubject; export interface SdlcScreeningInventory { claimIds: string[]; requirementIds: string[]; sourceIds: string[]; locators: string[]; criterionIds: string[]; evidenceIds: string[]; } export type SdlcEvidenceOwner = { kind: 'phase-criterion'; criterionId: string; } | { kind: 'citation'; claimId: string; sourceId: string; locator: string; trust: DecisionTrust; sensitivity: DecisionSensitivity; }; /** Trusted gate policy artifact, resolved only by a host-pinned digest (see `SdlcScreeningTrustContext`). */ export interface SdlcGateEvidencePolicy { kind: typeof SDLC_GATE_EVIDENCE_POLICY_KIND; metadata: { id: string; version: string; }; spec: { requiredEvidenceByCriterion: Record; evidenceSubjects: Record; }; } /** Host-owned trust inputs. They never come from the screening request. */ export interface SdlcScreeningTrustContext { /** Pin of the gate policy from trusted host configuration. */ gatePolicyPin: ArtifactPin; /** Registry of gate policy artifacts; the pinned one is verified with `assertArtifactPin`. */ gatePolicies: readonly SdlcGateEvidencePolicy[]; /** D09 compatibility resolved through the calibration registry; null routes to review. */ calibration: { registry: CalibrationRegistry; request: CompatibilityRequest; policy: CompatibilityPolicy; } | null; } /** Native per-question distributions over the closed option sets. Absent distributions route to review. */ export interface SdlcCitationObservation { kind: 'citation'; claimId: string; sourceId: string; locator: string; support: SdlcSupportLabel; supportDistribution?: Record; supportStrengthBps: number; injection: 'yes' | 'no' | 'unclear'; confidenceBps: number; model: string; attempts: number; } export interface SdlcPhaseCriterionObservation { kind: 'phase-criterion'; criterionId: string; evidenceIds: string[]; relevance: 'relevant' | 'irrelevant' | 'unclear'; completeness: 'complete' | 'incomplete' | 'unclear'; contradiction: 'none' | 'present' | 'unclear'; ambiguity: 'low' | 'high' | 'unclear'; reviewerAttention: 'needed' | 'not-needed'; distributions?: Partial>>; confidenceBps: number; model: string; attempts: number; } export type SdlcScreeningObservation = SdlcCitationObservation | SdlcPhaseCriterionObservation; export interface SdlcPreflightFinding { reason: SdlcPreflightReason; id: string; status: Exclude; } export interface SdlcScreeningReceipt { schemaVersion: typeof SDLC_SCREENING_SCHEMA_VERSION; mode: Exclude; subject: { kind: SdlcScreeningSubjectKind | 'unknown'; subjectId: string; claimId?: string; sourceId?: string; locator?: string; criterionId?: string; evidenceIds: string[]; requirementIds: string[]; }; deterministic: { status: SdlcDeterministicStatus; findings: SdlcPreflightFinding[]; }; semantic: { observed: boolean; accepted: boolean; reason: string; model: string | null; attempts: number; confidenceBps: number | null; }; route: SdlcScreeningRoute; reviewRequired: boolean; reviewReasons: string[]; gatePolicy: SdlcScreeningPin | null; pins: SdlcScreeningPin[]; trace: { redaction: 'metadata-only'; subjectDigest: `sha256:${string}` | null; observationDigest: `sha256:${string}` | null; }; action: { status: 'unexecuted'; }; } export interface SdlcScreeningRequest { schemaVersion: typeof SDLC_SCREENING_SCHEMA_VERSION; mode: SdlcScreeningMode; inventory: SdlcScreeningInventory; /** Must equal the host-pinned gate policy; any other policy reference is rejected. */ gatePolicyPin: SdlcScreeningPin; subject: SdlcScreeningSubject; observation?: SdlcScreeningObservation; nowEpochMs: number; } export interface SdlcScreeningOutcomeApplication { outcome: T; publication: 'unchanged'; auditReceipts: SdlcScreeningPin[]; alternateScreening?: SdlcScreeningReceipt; } export interface SdlcScreeningPreregistration { schemaVersion: typeof SDLC_SCREENING_PREREGISTRATION_VERSION; planId: string; frozenAt: string; /** Digest of the frozen held-out test split (`QualificationSplit.digest`). */ heldoutSplitDigest: `sha256:${string}`; /** Every preregistered slice must be present with `minimumSliceSupport`. */ slices: string[]; gateBlockingSlices: string[]; maximumFalseSupportRateBps: number; maximumFalseReadyRateBps: number; minimumTotalSupport: number; minimumSliceSupport: number; minimumGateBlockingSliceSupport: number; confidenceInterval: { method: 'wilson' | 'exact-binomial'; levelBps: number; }; /** Paired non-inferiority margin against the baseline screening path. */ qualityNonInferiorityBps: number; efficiencyClaim: { enabled: boolean; minimumPositiveTotalEconomicsUsd: number | null; }; } /** * v2 preregistration: paired non-inferiority is optional. A null margin skips * the NI gate entirely (no NI reasons); passage baselines stay reported * diagnostics and never gate. Every other field is v1-identical. */ export interface SdlcScreeningPreregistrationV2 extends Omit { schemaVersion: typeof SDLC_SCREENING_PREREGISTRATION_VERSION_V2; qualityNonInferiorityBps: number | null; } /** One adjudicated held-out item with the paired baseline outcome on the same item. */ export interface SdlcScreeningHeldoutSample { id: string; kind: SdlcScreeningSubjectKind; slice: string; gold: { ready: boolean; support: SdlcSupportLabel | null; }; candidate: { route: SdlcScreeningRoute; support: SdlcSupportLabel | null; readyProbability: number; latencyMs: number; inputTokens: number | null; outputTokens: number | null; costUsd: number | null; calls: number; retries: number; fallbacks: number; }; /** Baseline screening on the same item; `correct` uses the same definition as the candidate * (readiness route matches gold and, for citations, the support label matches gold). */ baseline: { correct: boolean; costUsd: number | null; }; reviewer: { agreed: boolean; overridden: boolean; } | null; } export interface SdlcScreeningHeldoutRecords { schemaVersion: typeof SDLC_SCREENING_HELDOUT_RECORDS_VERSION; evaluatedAt: string; splits: QualificationSplit[]; samples: SdlcScreeningHeldoutSample[]; } export interface SdlcRateEvidence { events: number; n: number; rateBps: number | null; /** Upper bound of the preregistered interval, rounded up; null when not computable. */ upperBps: number | null; } export interface SdlcClassMetrics { n: number; precisionBps: number | null; recallBps: number | null; } /** Computed only from per-sample records; never caller-asserted. */ export interface SdlcScreeningHeldoutReport { schemaVersion: typeof SDLC_SCREENING_HELDOUT_REPORT_VERSION; evaluatedAt: string; heldoutSplitDigest: `sha256:${string}`; recordsDigest: `sha256:${string}`; totalSupport: number; gateBlockingSliceSupport: number; classes: { support: SdlcClassMetrics; contradiction: SdlcClassMetrics; unclear: SdlcClassMetrics; }; falseSupport: SdlcRateEvidence; falseReady: SdlcRateEvidence; reviewer: { n: number; agreementRateBps: number | null; overrideRateBps: number | null; }; /** Per-item correctness (readiness and citation label), candidate versus the paired baseline outcome. */ paired: { n: number; both: number; candidateOnly: number; baselineOnly: number; neither: number; /** Candidate minus baseline at the preregistered level; null when no supported level was given. */ interval: PairedDifferenceInterval | null; }; calibrationRiskCoverage: { brier: number; expectedCalibrationError: number; coverage: number; selectiveRisk: number | null; }; slices: Record; latencyMs: { p50: number; p95: number; p99: number; }; tokens: { input: number | null; output: number | null; }; costUsd: { candidate: number | null; baseline: number | null; netSavings: number | null; }; reviewLoad: { reviewRate: number; }; } export interface SdlcScreeningPreregistrationResult { decision: 'pass' | 'fail' | 'insufficient-evidence'; reasons: string[]; heldout: SdlcScreeningHeldoutReport | null; } export interface SdlcScreeningReleaseReport { schemaVersion: typeof SDLC_SCREENING_RELEASE_VERSION | typeof SDLC_SCREENING_RELEASE_VERSION_V2; preregistration: SdlcScreeningPreregistration | SdlcScreeningPreregistrationV2; preregistrationDigest: `sha256:${string}`; trustedPreregistrationDigest: `sha256:${string}`; heldout: SdlcScreeningHeldoutReport | null; integrity: QualificationIntegrityMetadata; preregisteredDecision: SdlcScreeningPreregistrationResult['decision']; decision: 'PROMOTE' | 'HOLD' | 'ROLLBACK'; reasons: string[]; digest: `sha256:${string}`; } export declare class SdlcScreeningValidationError extends Error { readonly reason: SdlcPreflightReason; readonly status: Exclude; readonly id: string; constructor(message: string, reason?: SdlcPreflightReason, status?: Exclude, id?: string); } /** Closed portable definitions/rulesets for the D29 screening pack. They are data, not authority. */ export declare function sdlcScreeningDecisionArtifacts(): { definitions: DecisionDefinition[]; rulesets: DecisionRuleset[]; }; /** * Deterministic preflight over one validated subject and the trusted gate policy. * Every bundle item is inspected, not only policy-required ones. */ export declare function sdlcScreeningPreflight(subject: SdlcScreeningSubject, nowEpochMs: number, gatePolicy: SdlcGateEvidencePolicy): SdlcPreflightFinding[]; /** * Advisory screening for one subject. `disabled` returns null without reading anything else; * an invalid `mode` throws. In shadow/advisory mode every other malformed input produces a * non-ready receipt instead of an exception. */ export declare function evaluateSdlcEvidenceScreening(request: SdlcScreeningRequest, trust?: SdlcScreeningTrustContext): SdlcScreeningReceipt | null; /** * Pass-through over a host-owned gate outcome. AIWG has no programmatic SDLC phase-gate * evaluator (flow-gate-check is an agent-executed skill), so this adapter only guarantees * that screening never alters the outcome value or publication state a host passes in. */ export declare function applySdlcScreeningToGateOutcome(currentOutcome: T, mode: SdlcScreeningMode, auditReceipts?: SdlcScreeningPin[], receipt?: SdlcScreeningReceipt | null): SdlcScreeningOutcomeApplication; export declare function sdlcScreeningReviewInputFromReceipt(receipt: SdlcScreeningReceipt, options: { enabled: boolean; reviewId: string; continuationId: string; resumeToken: string; expiresAtEpochMs: number; riskTier: string; rationale: string; requesterPresentation?: Record; }): CreateReviewInput | null; /** Canonical digest a host anchors separately before held-out access. */ export declare function sdlcScreeningPreregistrationDigest(preregistration: SdlcScreeningPreregistration | SdlcScreeningPreregistrationV2): `sha256:${string}`; /** * Computes every held-out metric from per-sample records with the #1585 quality helpers. * With a two-sided `levelBps`, false-rate upper bounds use the Wilson score interval and the * paired candidate-minus-baseline interval uses Newcombe method 10 at that level; without one * (or for an unsupported level) those bounds are null. */ export declare function computeSdlcScreeningHeldoutReport(records: SdlcScreeningHeldoutRecords, levelBps?: number | null): SdlcScreeningHeldoutReport; /** * Evaluates held-out records against a preregistration anchored by a separately trusted digest. * Structurally invalid preregistrations throw; every evidence problem is a reason code. */ export declare function evaluateSdlcScreeningPreregistration(preregistration: SdlcScreeningPreregistration | SdlcScreeningPreregistrationV2, trustedPreregistrationDigest: `sha256:${string}`, records: SdlcScreeningHeldoutRecords | null, nowEpochMs: number): SdlcScreeningPreregistrationResult; export declare function buildSdlcScreeningReleaseReport(input: { preregistration: SdlcScreeningPreregistration | SdlcScreeningPreregistrationV2; trustedPreregistrationDigest: `sha256:${string}`; heldout: SdlcScreeningHeldoutRecords | null; integrity: QualificationIntegrityMetadata; nowEpochMs: number; }): SdlcScreeningReleaseReport; //# sourceMappingURL=sdlc-screening.d.ts.map