/** * Release Confidence Aggregator — Zod schemas (single source of truth). * * P3 — qulib Confidence Layer v1. * Pure schema definitions; no I/O. Scorer lives in tools/scoring/confidence.ts. * * Architecture note (§1d of spec): * - EvidenceItem is the universal adapter envelope — any signal feeds the same scorer. * - EvidenceSourceKind enum reserves external sources (ci-results, deploy-metadata, …) * for P4 wiring; qulib-native sources are wired in P3. * - tenantId on every record (CLAUDE.md rule 17 — multi-tenant from day one). */ import { z } from 'zod'; export declare const EvidenceSourceKindSchema: z.ZodEnum<["live-app-quality", "accessibility", "crawl-coverage", "test-automation", "api-coverage", "ci-results", "deploy-metadata", "error-telemetry", "feature-flags", "doc-health", "human-approval", "agent-evidence", "decision-quality"]>; export type EvidenceSourceKind = z.infer; export declare const ConfidencePolicySchema: z.ZodObject<{ /** * Confidence score at or above this is required for verdict='ship'. Default 80. * Mirrors AgentSummaryPolicy.passConfidenceThreshold. */ passThreshold: z.ZodDefault; /** * Confidence score below this produces verdict='hold'. Default 30. * Mirrors AgentSummaryPolicy.failConfidenceThreshold. */ failThreshold: z.ZodDefault; /** Max items in topRisks / recommendedNextChecks / honestyNotes lists. Default 5. */ maxListLength: z.ZodDefault; /** * Sources listed here produce verdict='caution' when their applicability is 'unknown'. * Empty by default — callers can require specific sources for stricter gates. */ requiredSources: z.ZodDefault, "many">>; /** * Per-source weight overrides. When provided, these replace the scorer's default weights * for the named sources; unmentioned sources keep their defaults. */ weights: z.ZodOptional, z.ZodNumber>>; }, "strip", z.ZodTypeAny, { passThreshold: number; failThreshold: number; maxListLength: number; requiredSources: ("accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality")[]; weights?: Partial> | undefined; }, { passThreshold?: number | undefined; failThreshold?: number | undefined; maxListLength?: number | undefined; requiredSources?: ("accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality")[] | undefined; weights?: Partial> | undefined; }>; export type ConfidencePolicy = z.infer; export declare const EvidenceItemSchema: z.ZodObject<{ source: z.ZodEnum<["live-app-quality", "accessibility", "crawl-coverage", "test-automation", "api-coverage", "ci-results", "deploy-metadata", "error-telemetry", "feature-flags", "doc-health", "human-approval", "agent-evidence", "decision-quality"]>; /** * 0–100 normalized score, or null when the source ran but could not produce * an honest score (e.g. auth-blocked crawl). null → excluded from denominator * AND contributes to honesty notes. */ score: z.ZodNullable; weight: z.ZodNumber; /** * - applicable — qulib has signal and produced a real score. * - not_applicable — the capability does not apply (e.g. api-coverage with 0 endpoints). * Score is reported but excluded from the denominator. * - unknown — qulib could not collect enough signal to score honestly. * Excluded from denominator; narrated in honestyNotes. */ applicability: z.ZodDefault>; /** * When true, forces verdict='block' regardless of score. * Use for hard gates: auth wall, critical gap, failed deploy. */ blocking: z.ZodDefault; /** Human-readable "why this score" bullet points. */ evidence: z.ZodArray; recommendations: z.ZodDefault>; /** Required when applicability !== 'applicable'. Explains why the source was excluded. */ reason: z.ZodOptional; /** ISO-8601 datetime when this evidence was collected. */ collectedAt: z.ZodString; /** * Provenance for Replay/Audit views — how this item was produced. */ collector: z.ZodObject<{ tool: z.ZodString; inputRef: z.ZodOptional; durationMs: z.ZodOptional; cost: z.ZodOptional>; }, "strip", z.ZodTypeAny, { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }, { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }>; }, "strip", z.ZodTypeAny, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; recommendations: string[]; score: number | null; weight: number; evidence: string[]; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; collectedAt: string; collector: { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }; reason?: string | undefined; }, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; evidence: string[]; collectedAt: string; collector: { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }; reason?: string | undefined; recommendations?: string[] | undefined; applicability?: "unknown" | "applicable" | "not_applicable" | undefined; blocking?: boolean | undefined; }>; export type EvidenceItem = z.infer; export declare const ConfidenceSubjectSchema: z.ZodObject<{ kind: z.ZodEnum<["release", "pr", "deploy", "app", "repo"]>; ref: z.ZodString; /** Multi-tenant stamp (CLAUDE.md rule 17). Default 'default' while single-tenant. */ tenantId: z.ZodDefault; }, "strip", z.ZodTypeAny, { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId: string; }, { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId?: string | undefined; }>; export type ConfidenceSubject = z.infer; export declare const ConfidenceInputSchema: z.ZodObject<{ subject: z.ZodObject<{ kind: z.ZodEnum<["release", "pr", "deploy", "app", "repo"]>; ref: z.ZodString; /** Multi-tenant stamp (CLAUDE.md rule 17). Default 'default' while single-tenant. */ tenantId: z.ZodDefault; }, "strip", z.ZodTypeAny, { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId: string; }, { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId?: string | undefined; }>; evidence: z.ZodArray; /** * 0–100 normalized score, or null when the source ran but could not produce * an honest score (e.g. auth-blocked crawl). null → excluded from denominator * AND contributes to honesty notes. */ score: z.ZodNullable; weight: z.ZodNumber; /** * - applicable — qulib has signal and produced a real score. * - not_applicable — the capability does not apply (e.g. api-coverage with 0 endpoints). * Score is reported but excluded from the denominator. * - unknown — qulib could not collect enough signal to score honestly. * Excluded from denominator; narrated in honestyNotes. */ applicability: z.ZodDefault>; /** * When true, forces verdict='block' regardless of score. * Use for hard gates: auth wall, critical gap, failed deploy. */ blocking: z.ZodDefault; /** Human-readable "why this score" bullet points. */ evidence: z.ZodArray; recommendations: z.ZodDefault>; /** Required when applicability !== 'applicable'. Explains why the source was excluded. */ reason: z.ZodOptional; /** ISO-8601 datetime when this evidence was collected. */ collectedAt: z.ZodString; /** * Provenance for Replay/Audit views — how this item was produced. */ collector: z.ZodObject<{ tool: z.ZodString; inputRef: z.ZodOptional; durationMs: z.ZodOptional; cost: z.ZodOptional>; }, "strip", z.ZodTypeAny, { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }, { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }>; }, "strip", z.ZodTypeAny, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; recommendations: string[]; score: number | null; weight: number; evidence: string[]; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; collectedAt: string; collector: { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }; reason?: string | undefined; }, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; evidence: string[]; collectedAt: string; collector: { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }; reason?: string | undefined; recommendations?: string[] | undefined; applicability?: "unknown" | "applicable" | "not_applicable" | undefined; blocking?: boolean | undefined; }>, "many">; policy: z.ZodOptional; /** * Confidence score below this produces verdict='hold'. Default 30. * Mirrors AgentSummaryPolicy.failConfidenceThreshold. */ failThreshold: z.ZodDefault; /** Max items in topRisks / recommendedNextChecks / honestyNotes lists. Default 5. */ maxListLength: z.ZodDefault; /** * Sources listed here produce verdict='caution' when their applicability is 'unknown'. * Empty by default — callers can require specific sources for stricter gates. */ requiredSources: z.ZodDefault, "many">>; /** * Per-source weight overrides. When provided, these replace the scorer's default weights * for the named sources; unmentioned sources keep their defaults. */ weights: z.ZodOptional, z.ZodNumber>>; }, "strip", z.ZodTypeAny, { passThreshold: number; failThreshold: number; maxListLength: number; requiredSources: ("accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality")[]; weights?: Partial> | undefined; }, { passThreshold?: number | undefined; failThreshold?: number | undefined; maxListLength?: number | undefined; requiredSources?: ("accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality")[] | undefined; weights?: Partial> | undefined; }>>; }, "strip", z.ZodTypeAny, { evidence: { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; recommendations: string[]; score: number | null; weight: number; evidence: string[]; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; collectedAt: string; collector: { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }; reason?: string | undefined; }[]; subject: { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId: string; }; policy?: { passThreshold: number; failThreshold: number; maxListLength: number; requiredSources: ("accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality")[]; weights?: Partial> | undefined; } | undefined; }, { evidence: { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; evidence: string[]; collectedAt: string; collector: { tool: string; durationMs?: number | undefined; inputRef?: string | undefined; cost?: { inputTokens: number; outputTokens: number; } | undefined; }; reason?: string | undefined; recommendations?: string[] | undefined; applicability?: "unknown" | "applicable" | "not_applicable" | undefined; blocking?: boolean | undefined; }[]; subject: { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId?: string | undefined; }; policy?: { passThreshold?: number | undefined; failThreshold?: number | undefined; maxListLength?: number | undefined; requiredSources?: ("accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality")[] | undefined; weights?: Partial> | undefined; } | undefined; }>; export type ConfidenceInput = z.infer; export declare const ConfidenceVerdictSchema: z.ZodEnum<["ship", "caution", "hold", "block"]>; export type ConfidenceVerdict = z.infer; export declare const ConfidenceContributionSchema: z.ZodObject<{ source: z.ZodEnum<["live-app-quality", "accessibility", "crawl-coverage", "test-automation", "api-coverage", "ci-results", "deploy-metadata", "error-telemetry", "feature-flags", "doc-health", "human-approval", "agent-evidence", "decision-quality"]>; score: z.ZodNullable; weight: z.ZodNumber; /** Renormalized weight over the applicable set (sums to 1.0 across applicable items). */ effectiveWeight: z.ZodNumber; applicability: z.ZodEnum<["applicable", "not_applicable", "unknown"]>; blocking: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; effectiveWeight: number; }, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; effectiveWeight: number; }>; export type ConfidenceContribution = z.infer; export declare const ReleaseConfidenceSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; computedAt: z.ZodString; subject: z.ZodObject<{ kind: z.ZodEnum<["release", "pr", "deploy", "app", "repo"]>; ref: z.ZodString; /** Multi-tenant stamp (CLAUDE.md rule 17). Default 'default' while single-tenant. */ tenantId: z.ZodDefault; }, "strip", z.ZodTypeAny, { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId: string; }, { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId?: string | undefined; }>; /** * Fused confidence score (0–100) over applicable, non-null evidence only. * null when no applicable evidence exists (honesty floor → verdict = 'block'). */ confidenceScore: z.ZodNullable; verdict: z.ZodEnum<["ship", "caution", "hold", "block"]>; level: z.ZodNumber; label: z.ZodString; /** Per-source breakdown including excluded (not_applicable / unknown) items. */ contributions: z.ZodArray; score: z.ZodNullable; weight: z.ZodNumber; /** Renormalized weight over the applicable set (sums to 1.0 across applicable items). */ effectiveWeight: z.ZodNumber; applicability: z.ZodEnum<["applicable", "not_applicable", "unknown"]>; blocking: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; effectiveWeight: number; }, { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; effectiveWeight: number; }>, "many">; topRisks: z.ZodArray; recommendedNextChecks: z.ZodArray; /** One note per degraded/excluded/partial source — the honesty layer. */ honestyNotes: z.ZodArray; /** Non-empty only when verdict='block'; explains what caused the block. */ blockers: z.ZodArray; scoreFormula: z.ZodString; }, "strip", z.ZodTypeAny, { label: string; level: number; computedAt: string; scoreFormula: string; verdict: "ship" | "caution" | "hold" | "block"; schemaVersion: 1; subject: { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId: string; }; confidenceScore: number | null; contributions: { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; effectiveWeight: number; }[]; topRisks: string[]; recommendedNextChecks: string[]; honestyNotes: string[]; blockers: string[]; }, { label: string; level: number; computedAt: string; scoreFormula: string; verdict: "ship" | "caution" | "hold" | "block"; schemaVersion: 1; subject: { kind: "app" | "repo" | "release" | "pr" | "deploy"; ref: string; tenantId?: string | undefined; }; confidenceScore: number | null; contributions: { source: "accessibility" | "live-app-quality" | "crawl-coverage" | "test-automation" | "api-coverage" | "ci-results" | "deploy-metadata" | "error-telemetry" | "feature-flags" | "doc-health" | "human-approval" | "agent-evidence" | "decision-quality"; score: number | null; weight: number; applicability: "unknown" | "applicable" | "not_applicable"; blocking: boolean; effectiveWeight: number; }[]; topRisks: string[]; recommendedNextChecks: string[]; honestyNotes: string[]; blockers: string[]; }>; export type ReleaseConfidence = z.infer; //# sourceMappingURL=confidence.schema.d.ts.map