@oscharko-dev/keiko-evidence 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/aggregate.d.ts +4 -0
  3. package/dist/aggregate.d.ts.map +1 -0
  4. package/dist/aggregate.js +21 -0
  5. package/dist/build.d.ts +3 -0
  6. package/dist/build.d.ts.map +1 -0
  7. package/dist/build.js +227 -0
  8. package/dist/connected-context-evidence.d.ts +47 -0
  9. package/dist/connected-context-evidence.d.ts.map +1 -0
  10. package/dist/connected-context-evidence.js +197 -0
  11. package/dist/errors.d.ts +3 -0
  12. package/dist/errors.d.ts.map +1 -0
  13. package/dist/errors.js +4 -0
  14. package/dist/index-api.d.ts +15 -0
  15. package/dist/index-api.d.ts.map +1 -0
  16. package/dist/index-api.js +136 -0
  17. package/dist/index.d.ts +20 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +34 -0
  20. package/dist/persist.d.ts +9 -0
  21. package/dist/persist.d.ts.map +1 -0
  22. package/dist/persist.js +40 -0
  23. package/dist/promptEnhancement/index.d.ts +7 -0
  24. package/dist/promptEnhancement/index.d.ts.map +1 -0
  25. package/dist/promptEnhancement/index.js +10 -0
  26. package/dist/promptEnhancement/manifestSchema.d.ts +71 -0
  27. package/dist/promptEnhancement/manifestSchema.d.ts.map +1 -0
  28. package/dist/promptEnhancement/manifestSchema.js +307 -0
  29. package/dist/promptEnhancement/redaction.d.ts +17 -0
  30. package/dist/promptEnhancement/redaction.d.ts.map +1 -0
  31. package/dist/promptEnhancement/redaction.js +66 -0
  32. package/dist/promptEnhancement/store.d.ts +64 -0
  33. package/dist/promptEnhancement/store.d.ts.map +1 -0
  34. package/dist/promptEnhancement/store.js +409 -0
  35. package/dist/qualityIntelligence/candidatesArtifact.d.ts +74 -0
  36. package/dist/qualityIntelligence/candidatesArtifact.d.ts.map +1 -0
  37. package/dist/qualityIntelligence/candidatesArtifact.js +258 -0
  38. package/dist/qualityIntelligence/companionStore.d.ts +37 -0
  39. package/dist/qualityIntelligence/companionStore.d.ts.map +1 -0
  40. package/dist/qualityIntelligence/companionStore.js +158 -0
  41. package/dist/qualityIntelligence/figmaSnapshot/schema.d.ts +123 -0
  42. package/dist/qualityIntelligence/figmaSnapshot/schema.d.ts.map +1 -0
  43. package/dist/qualityIntelligence/figmaSnapshot/schema.js +163 -0
  44. package/dist/qualityIntelligence/figmaSnapshot/store.d.ts +144 -0
  45. package/dist/qualityIntelligence/figmaSnapshot/store.d.ts.map +1 -0
  46. package/dist/qualityIntelligence/figmaSnapshot/store.js +898 -0
  47. package/dist/qualityIntelligence/index.d.ts +18 -0
  48. package/dist/qualityIntelligence/index.d.ts.map +1 -0
  49. package/dist/qualityIntelligence/index.js +21 -0
  50. package/dist/qualityIntelligence/manifestSchema.d.ts +154 -0
  51. package/dist/qualityIntelligence/manifestSchema.d.ts.map +1 -0
  52. package/dist/qualityIntelligence/manifestSchema.js +70 -0
  53. package/dist/qualityIntelligence/redaction.d.ts +10 -0
  54. package/dist/qualityIntelligence/redaction.d.ts.map +1 -0
  55. package/dist/qualityIntelligence/redaction.js +103 -0
  56. package/dist/qualityIntelligence/retention.d.ts +71 -0
  57. package/dist/qualityIntelligence/retention.d.ts.map +1 -0
  58. package/dist/qualityIntelligence/retention.js +287 -0
  59. package/dist/qualityIntelligence/retentionPolicy.d.ts +10 -0
  60. package/dist/qualityIntelligence/retentionPolicy.d.ts.map +1 -0
  61. package/dist/qualityIntelligence/retentionPolicy.js +38 -0
  62. package/dist/qualityIntelligence/store.d.ts +95 -0
  63. package/dist/qualityIntelligence/store.d.ts.map +1 -0
  64. package/dist/qualityIntelligence/store.js +483 -0
  65. package/dist/redaction.d.ts +2 -0
  66. package/dist/redaction.d.ts.map +1 -0
  67. package/dist/redaction.js +4 -0
  68. package/dist/report.d.ts +17 -0
  69. package/dist/report.d.ts.map +1 -0
  70. package/dist/report.js +50 -0
  71. package/dist/retention.d.ts +4 -0
  72. package/dist/retention.d.ts.map +1 -0
  73. package/dist/retention.js +95 -0
  74. package/dist/runid.d.ts +2 -0
  75. package/dist/runid.d.ts.map +1 -0
  76. package/dist/runid.js +4 -0
  77. package/dist/side-file.d.ts +9 -0
  78. package/dist/side-file.d.ts.map +1 -0
  79. package/dist/side-file.js +102 -0
  80. package/dist/store.d.ts +8 -0
  81. package/dist/store.d.ts.map +1 -0
  82. package/dist/store.js +332 -0
  83. package/dist/types.d.ts +3 -0
  84. package/dist/types.d.ts.map +1 -0
  85. package/dist/types.js +5 -0
  86. package/dist/version.d.ts +2 -0
  87. package/dist/version.d.ts.map +1 -0
  88. package/dist/version.js +1 -0
  89. package/dist/workflow-evidence.d.ts +36 -0
  90. package/dist/workflow-evidence.d.ts.map +1 -0
  91. package/dist/workflow-evidence.js +158 -0
  92. package/package.json +32 -0
@@ -0,0 +1,18 @@
1
+ export { QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION, validateQualityIntelligenceEvidenceManifest, } from "./manifestSchema.js";
2
+ export type { QualityIntelligenceBinaryExportMode, QualityIntelligenceTraceabilityExportMode, QualityIntelligenceEvidenceManifest, QualityIntelligenceEvidenceRefRow, QualityIntelligenceExportRow, QualityIntelligenceExportTarget, QualityIntelligenceFindingRow, QualityIntelligenceIntegrityHashes, QualityIntelligenceManifestTotals, QualityIntelligenceProvenanceRefs, QualityIntelligenceRedactionSummary, QualityIntelligenceSchemaValidationResult, QualityIntelligenceCoverageMatrixRow, QualityIntelligenceAtomFingerprintRow, QualityIntelligenceSourceFingerprintRow, } from "./manifestSchema.js";
3
+ export { redactQualityIntelligenceEvidence } from "./redaction.js";
4
+ export type { QualityIntelligenceRedactionOptions, QualityIntelligenceRedactionResult, } from "./redaction.js";
5
+ export { QUALITY_INTELLIGENCE_DEFAULT_RETENTION_PROFILE_ID, QUALITY_INTELLIGENCE_RETENTION_PROFILES, getQualityIntelligenceRetentionProfile, } from "./retentionPolicy.js";
6
+ export type { QualityIntelligenceRetentionProfile } from "./retentionPolicy.js";
7
+ export { appendQualityIntelligenceExportRow, createInMemoryQualityIntelligenceLocalStore, createNodeQualityIntelligenceLocalStore, listQualityIntelligenceRuns, loadQualityIntelligenceRun, recordQualityIntelligenceRun, QI_SUBDIR, } from "./store.js";
8
+ export type { QualityIntelligenceExportEvidenceInput, QualityIntelligenceLoadOptions, QualityIntelligenceLocalStore, QualityIntelligenceNodeStoreOptions, QualityIntelligenceRecordInput, QualityIntelligenceRecordOptions, QualityIntelligenceRecordResult, } from "./store.js";
9
+ export { QUALITY_INTELLIGENCE_CANDIDATES_SCHEMA_VERSION, recordQualityIntelligenceCandidates, loadQualityIntelligenceCandidates, deleteQualityIntelligenceCandidates, applyQualityIntelligenceCandidateEdit, } from "./candidatesArtifact.js";
10
+ export type { QualityIntelligenceCandidateRow, QualityIntelligenceCandidatesArtifact, QualityIntelligenceCandidatesStoreOptions, RecordQualityIntelligenceCandidatesInput, ApplyQualityIntelligenceCandidateEditInput, ApplyQualityIntelligenceCandidateEditResult, QualityIntelligenceCandidateEditErrorReason, } from "./candidatesArtifact.js";
11
+ export { createNodeContainedJsonArtifactStore, type ContainedJsonArtifactStore, type ContainedJsonArtifactStoreOptions, } from "./companionStore.js";
12
+ export { FIGMA_SNAPSHOT_SCHEMA_VERSION, validateFigmaSnapshotRecord, } from "./figmaSnapshot/schema.js";
13
+ export type { FigmaSnapshotImageRef, FigmaSnapshotLinkRow, FigmaSnapshotProvenanceRow, FigmaSnapshotRecord, FigmaSnapshotRedactionSummary, FigmaSnapshotScreenRow, FigmaSnapshotSkipReason, FigmaSnapshotSkippedScreenRow, FigmaSnapshotStructuralScreenRow, FigmaSnapshotValidationResult, } from "./figmaSnapshot/schema.js";
14
+ export { createNodeFigmaSnapshotStore, enforceFigmaSnapshotRetention, DEFAULT_FIGMA_SNAPSHOT_MAX_RECORDS, } from "./figmaSnapshot/store.js";
15
+ export type { DeleteFigmaSnapshotResult, FigmaSnapshotImageBytes, FigmaSnapshotRetentionProfile, FigmaSnapshotStore, FigmaSnapshotStoreOptions, FigmaSnapshotUserMetadata, RecordFigmaSnapshotInput, RecordFigmaSnapshotResult, RecordFigmaSnapshotScreenInput, RecordFigmaSnapshotStructuralScreenInput, UpdateFigmaSnapshotUserMetadataInput, } from "./figmaSnapshot/store.js";
16
+ export { applyQualityIntelligenceRetention, deleteQualityIntelligenceRun, enforceQualityIntelligenceRetentionPolicy, quarantineCorruptQualityIntelligenceManifest, snapshotQualityIntelligenceRunsForRecovery, } from "./retention.js";
17
+ export type { QualityIntelligenceDeleteOptions, QualityIntelligenceDeletionReceipt, QualityIntelligenceDeletionStatus, QualityIntelligenceQuarantineOptions, QualityIntelligenceQuarantineReceipt, QualityIntelligenceRecoverySnapshot, QualityIntelligenceRetentionDecision, QualityIntelligenceRetentionDecisionInput, QualityIntelligenceRetentionDeletionFailure, QualityIntelligenceRetentionEnforcementOptions, QualityIntelligenceRetentionEnforcementResult, QualityIntelligenceRetentionResult, QualityIntelligenceRunDeletedEvent, QualityIntelligenceRunSnapshotEntry, } from "./retention.js";
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,4CAA4C,EAC5C,2CAA2C,GAC5C,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,mCAAmC,EACnC,yCAAyC,EACzC,mCAAmC,EACnC,iCAAiC,EACjC,4BAA4B,EAC5B,+BAA+B,EAC/B,6BAA6B,EAC7B,kCAAkC,EAClC,iCAAiC,EACjC,iCAAiC,EACjC,mCAAmC,EACnC,yCAAyC,EACzC,oCAAoC,EACpC,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AACnE,YAAY,EACV,mCAAmC,EACnC,kCAAkC,GACnC,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wB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,wCAAwC,EACxC,oCAAoC,GACrC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,iCAAiC,EACjC,4BAA4B,EAC5B,yCAAyC,EACzC,4CAA4C,EAC5C,0CAA0C,GAC3C,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gCAAgC,EAChC,kCAAkC,EAClC,iCAAiC,EACjC,oCAAoC,EACpC,oCAAoC,EACpC,mCAAmC,EACnC,oCAAoC,EACpC,yCAAyC,EACzC,2CAA2C,EAC3C,8CAA8C,EAC9C,6CAA6C,EAC7C,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,GACpC,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,21 @@
1
+ // Public barrel for the QualityIntelligence sub-module of `@oscharko-dev/keiko-evidence`
2
+ // (Issue #274, Epic #270, ADR-0023 D8). Re-exports the manifest schema, redactor, retention
3
+ // profiles, and (Milestone 2+) the local-store + retention + deletion API. The package barrel
4
+ // re-exports this directory under the `QualityIntelligence` namespace, matching the contracts
5
+ // layout.
6
+ // ─── Manifest schema (M1) ──────────────────────────────────────────────────────────
7
+ export { QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION, validateQualityIntelligenceEvidenceManifest, } from "./manifestSchema.js";
8
+ // ─── Redaction (M1) ────────────────────────────────────────────────────────────────
9
+ export { redactQualityIntelligenceEvidence } from "./redaction.js";
10
+ // ─── Retention profiles (M1) ───────────────────────────────────────────────────────
11
+ export { QUALITY_INTELLIGENCE_DEFAULT_RETENTION_PROFILE_ID, QUALITY_INTELLIGENCE_RETENTION_PROFILES, getQualityIntelligenceRetentionProfile, } from "./retentionPolicy.js";
12
+ // ─── Local-state store + CRUD (M2) ─────────────────────────────────────────────────
13
+ export { appendQualityIntelligenceExportRow, createInMemoryQualityIntelligenceLocalStore, createNodeQualityIntelligenceLocalStore, listQualityIntelligenceRuns, loadQualityIntelligenceRun, recordQualityIntelligenceRun, QI_SUBDIR, } from "./store.js";
14
+ // ─── Generated-candidate companion artifact (Issue #280) ────────────────────────────
15
+ export { QUALITY_INTELLIGENCE_CANDIDATES_SCHEMA_VERSION, recordQualityIntelligenceCandidates, loadQualityIntelligenceCandidates, deleteQualityIntelligenceCandidates, applyQualityIntelligenceCandidateEdit, } from "./candidatesArtifact.js";
16
+ export { createNodeContainedJsonArtifactStore, } from "./companionStore.js";
17
+ // ─── Figma Snapshot evidence artifact (Epic #750, Issue #753) ───────────────────────
18
+ export { FIGMA_SNAPSHOT_SCHEMA_VERSION, validateFigmaSnapshotRecord, } from "./figmaSnapshot/schema.js";
19
+ export { createNodeFigmaSnapshotStore, enforceFigmaSnapshotRetention, DEFAULT_FIGMA_SNAPSHOT_MAX_RECORDS, } from "./figmaSnapshot/store.js";
20
+ // ─── Retention, deletion, recovery (M3) ────────────────────────────────────────────
21
+ export { applyQualityIntelligenceRetention, deleteQualityIntelligenceRun, enforceQualityIntelligenceRetentionPolicy, quarantineCorruptQualityIntelligenceManifest, snapshotQualityIntelligenceRunsForRecovery, } from "./retention.js";
@@ -0,0 +1,154 @@
1
+ import type { QualityIntelligence } from "@oscharko-dev/keiko-contracts";
2
+ type QualityIntelligenceExportAdapter = QualityIntelligence.QualityIntelligenceExportAdapter;
3
+ /**
4
+ * Binary export modes assembled at the runtime/route level (Issue #283 + #711) rather than by a pure
5
+ * domain adapter — a paginated text PDF and a STORE ZIP bundle. They are not part of the contract
6
+ * `QualityIntelligenceExportAdapter` union (which drives the serialise dispatch + TMS classification),
7
+ * but an export-evidence row must be able to record them faithfully as the produced target type.
8
+ */
9
+ export type QualityIntelligenceBinaryExportMode = "pdf" | "zip-bundle";
10
+ /**
11
+ * Traceability matrix export modes produced by the dedicated traceability route (Epic #734,
12
+ * Issue #740). Like binary modes, these are assembled at the route level — the matrix serializers
13
+ * are separate from the candidate-export adapters — so they extend the evidence target union here
14
+ * rather than the contract `QualityIntelligenceExportAdapter`.
15
+ */
16
+ export type QualityIntelligenceTraceabilityExportMode = "traceability-csv" | "traceability-markdown";
17
+ /** Any target an export-evidence row may record: a domain adapter, a binary bundle mode, or a traceability matrix mode. */
18
+ export type QualityIntelligenceExportTarget = QualityIntelligenceExportAdapter | QualityIntelligenceBinaryExportMode | QualityIntelligenceTraceabilityExportMode;
19
+ type QualityIntelligenceLifecycleStatus = QualityIntelligence.QualityIntelligenceLifecycleStatus;
20
+ type QualityIntelligenceRunId = QualityIntelligence.QualityIntelligenceRunId;
21
+ type QualityIntelligenceValidationFindingKind = QualityIntelligence.QualityIntelligenceValidationFindingKind;
22
+ type QualityIntelligenceSeverity = QualityIntelligence.QualityIntelligenceSeverity;
23
+ type QualityIntelligenceAuditSummaryId = QualityIntelligence.QualityIntelligenceAuditSummaryId;
24
+ export declare const QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION: 1;
25
+ export interface QualityIntelligenceIntegrityHashes {
26
+ readonly findings: string;
27
+ readonly exports: string;
28
+ readonly evidenceRefs: string;
29
+ readonly atomFingerprints?: string;
30
+ /**
31
+ * Hash of the persisted per-envelope source fingerprints (Epic #735). Drift detection falls back
32
+ * to these when atom-level fingerprints are absent, so a tampered set could mis-report staleness;
33
+ * hashing them makes that tampering detectable. Optional for backward-compat with manifests
34
+ * written before it was hashed (enforced on read only when present).
35
+ */
36
+ readonly sourceFingerprints?: string;
37
+ /** Hash of the persisted coverage matrix (Epic #734) so a tampered matrix is detectable. */
38
+ readonly coverageMatrix?: string;
39
+ }
40
+ export interface QualityIntelligenceRedactionSummary {
41
+ readonly totalStringsScanned: number;
42
+ readonly stringsRedacted: number;
43
+ readonly patternsMatched: Readonly<Record<string, number>>;
44
+ }
45
+ export interface QualityIntelligenceManifestTotals {
46
+ readonly candidates: number;
47
+ readonly findings: number;
48
+ readonly exports: number;
49
+ }
50
+ /**
51
+ * Per-atom coverage status row persisted in the run manifest. Carries refs plus an optional short
52
+ * REDACTED requirement excerpt (#790) so coverage/traceability surfaces are auditor-readable —
53
+ * mirroring the `summaryRedacted` precedent on findings. Never raw source content: the excerpt is
54
+ * redacted+truncated at build time and every string leaf is redacted again at persist time. Absent
55
+ * on rows written before #790 (read paths must tolerate it).
56
+ */
57
+ export interface QualityIntelligenceCoverageMatrixRow {
58
+ readonly atomId: string;
59
+ readonly status: "covered" | "weakly-covered" | "uncovered";
60
+ readonly confidence: number;
61
+ readonly coveringCandidateIds: readonly string[];
62
+ readonly requirementExcerptRedacted?: string;
63
+ }
64
+ export interface QualityIntelligenceFindingRow {
65
+ readonly id: string;
66
+ readonly kind: QualityIntelligenceValidationFindingKind;
67
+ readonly severity: QualityIntelligenceSeverity;
68
+ readonly summaryRedacted: string;
69
+ /**
70
+ * Optional candidate this finding is scoped to (Epic #736). Present on candidate-scoped findings
71
+ * (e.g. test-quality, logic-defect) so the UI can associate a finding with a single test case;
72
+ * absent on run-scoped findings (e.g. policy-violation).
73
+ */
74
+ readonly candidateId?: string;
75
+ }
76
+ export interface QualityIntelligenceExportRow {
77
+ readonly id: string;
78
+ readonly targetAdapter: QualityIntelligenceExportTarget;
79
+ readonly integrityHash: string;
80
+ readonly redactionAttested: boolean;
81
+ /**
82
+ * Whether this row records a dry-run preview rather than a materialised export (Issue #283, AC4).
83
+ * Absent/`false` means the export produced a downloadable artifact (local serialisation or a
84
+ * binary PDF/ZIP bundle); `true` means only a preview was rendered. Additive and optional:
85
+ * manifests written before #283 carry no export rows at all, and the strict-schema gate validates
86
+ * only top-level keys, so no schema-version bump is required.
87
+ */
88
+ readonly dryRun?: boolean;
89
+ }
90
+ export interface QualityIntelligenceEvidenceRefRow {
91
+ readonly envelopeId: string;
92
+ readonly atomId: string;
93
+ readonly lifecycleStatus: QualityIntelligenceLifecycleStatus;
94
+ }
95
+ /** Per-envelope content fingerprint row persisted in the manifest (Epic #735, Issue #742). */
96
+ export interface QualityIntelligenceSourceFingerprintRow {
97
+ readonly envelopeId: string;
98
+ readonly integrityHashSha256Hex: string;
99
+ }
100
+ /** Per-atom content fingerprint row persisted in the manifest (Epic #735, Issues #798/#799). */
101
+ export interface QualityIntelligenceAtomFingerprintRow {
102
+ readonly atomId: string;
103
+ readonly envelopeId: string;
104
+ readonly canonicalHashSha256Hex: string;
105
+ /**
106
+ * Optional opaque key for finding the current replacement atom during targeted regeneration. This is
107
+ * a hash-derived metadata key, not raw source text or a local filesystem path.
108
+ */
109
+ readonly replacementGroupId?: string;
110
+ /** Stable ordinal within replacementGroupId for same-document requirement replacements. */
111
+ readonly replacementOrdinal?: number;
112
+ }
113
+ export interface QualityIntelligenceProvenanceRefs {
114
+ readonly envelopeIds: readonly string[];
115
+ readonly auditSummaryId: QualityIntelligenceAuditSummaryId;
116
+ }
117
+ export interface QualityIntelligenceEvidenceManifest {
118
+ readonly qiEvidenceSchemaVersion: typeof QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION;
119
+ readonly runId: QualityIntelligenceRunId;
120
+ readonly planAt: string;
121
+ readonly completedAt: string | undefined;
122
+ readonly status: "running" | "succeeded" | "failed" | "cancelled";
123
+ readonly policyProfileIds: readonly string[];
124
+ readonly retentionPolicyId: string;
125
+ readonly modelGatewayCallCount: number;
126
+ readonly totals: QualityIntelligenceManifestTotals;
127
+ readonly findings: readonly QualityIntelligenceFindingRow[];
128
+ readonly exports: readonly QualityIntelligenceExportRow[];
129
+ readonly evidenceRefs: readonly QualityIntelligenceEvidenceRefRow[];
130
+ readonly provenanceRefs: QualityIntelligenceProvenanceRefs;
131
+ readonly redactionSummary: QualityIntelligenceRedactionSummary;
132
+ readonly integrityHashes: QualityIntelligenceIntegrityHashes;
133
+ /** Optional: per-atom coverage classification (refs + status, no raw text). Added in #738. */
134
+ readonly coverageMatrix?: readonly QualityIntelligenceCoverageMatrixRow[];
135
+ /** Optional: run quality score — percent of candidates with a strong judge outcome [0-100]; null when the judge stage was skipped. Added in #736. */
136
+ readonly qualityScore?: number | null;
137
+ /** Optional: per-envelope content fingerprints for drift detection (Epic #735, Issue #742). */
138
+ readonly sourceFingerprints?: readonly QualityIntelligenceSourceFingerprintRow[];
139
+ /** Optional: per-atom content fingerprints for atom-aware drift detection (#798/#799). */
140
+ readonly atomFingerprints?: readonly QualityIntelligenceAtomFingerprintRow[];
141
+ /** Optional: model id that generated the candidates (Epic #761, Issue #763). */
142
+ readonly modelId?: string;
143
+ /** Optional: redaction-safe request parameter scalars (e.g. responseFormat, seed) (Epic #761). */
144
+ readonly modelParameters?: Record<string, unknown>;
145
+ /** Optional: seed used for deterministic sampling; null when model does not support seeding. */
146
+ readonly seedUsed?: number | null;
147
+ }
148
+ export interface QualityIntelligenceSchemaValidationResult {
149
+ readonly ok: boolean;
150
+ readonly reason: string | undefined;
151
+ }
152
+ export declare function validateQualityIntelligenceEvidenceManifest(value: unknown): QualityIntelligenceSchemaValidationResult;
153
+ export {};
154
+ //# sourceMappingURL=manifestSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifestSchema.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/manifestSchema.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,KAAK,gCAAgC,GAAG,mBAAmB,CAAC,gCAAgC,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,MAAM,mCAAmC,GAAG,KAAK,GAAG,YAAY,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,yCAAyC,GACjD,kBAAkB,GAClB,uBAAuB,CAAC;AAE5B,2HAA2H;AAC3H,MAAM,MAAM,+BAA+B,GACvC,gCAAgC,GAChC,mCAAmC,GACnC,yCAAyC,CAAC;AAC9C,KAAK,kCAAkC,GAAG,mBAAmB,CAAC,kCAAkC,CAAC;AACjG,KAAK,wBAAwB,GAAG,mBAAmB,CAAC,wBAAwB,CAAC;AAC7E,KAAK,wCAAwC,GAC3C,mBAAmB,CAAC,wCAAwC,CAAC;AAC/D,KAAK,2BAA2B,GAAG,mBAAmB,CAAC,2BAA2B,CAAC;AACnF,KAAK,iCAAiC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AE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD,gGAAgG;IAChG,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAuCD,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAKD,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,OAAO,GACb,yCAAyC,CAqB3C"}
@@ -0,0 +1,70 @@
1
+ // Quality Intelligence evidence manifest shape (Issue #274, Epic #270, ADR-0023 D8).
2
+ //
3
+ // Versioned, persistable record the QI workflow writes through `keiko-evidence` after each run.
4
+ // Carries ONLY references and counts — never raw prompts, never raw source content, never
5
+ // credentials. The shape mirrors the Keiko `EvidenceManifest` evolution rule: a breaking change
6
+ // introduces a new `qiEvidenceSchemaVersion` literal member rather than mutating the existing one.
7
+ //
8
+ // Schema-version `1`: aligned with `QUALITY_INTELLIGENCE_AUDIT_MANIFEST_SCHEMA_VERSION` in
9
+ // `@oscharko-dev/keiko-contracts`. The audit summary is the cross-referenced run aggregate;
10
+ // this manifest is the persistable evidence wrapper around it.
11
+ export const QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION = 1;
12
+ // ─── Validation ────────────────────────────────────────────────────────────────────
13
+ // The set of allowed top-level keys. A persisted record carrying any extra key fails the
14
+ // strict-schema gate on read, matching the existing EvidenceManifest discipline. Update this set
15
+ // in lock-step with the interface above.
16
+ const ALLOWED_TOP_LEVEL_KEYS = new Set([
17
+ "qiEvidenceSchemaVersion",
18
+ "runId",
19
+ "planAt",
20
+ "completedAt",
21
+ "status",
22
+ "policyProfileIds",
23
+ "retentionPolicyId",
24
+ "modelGatewayCallCount",
25
+ "totals",
26
+ "findings",
27
+ "exports",
28
+ "evidenceRefs",
29
+ "provenanceRefs",
30
+ "redactionSummary",
31
+ "integrityHashes",
32
+ "coverageMatrix",
33
+ "qualityScore",
34
+ "sourceFingerprints",
35
+ "atomFingerprints",
36
+ "modelId",
37
+ "modelParameters",
38
+ "seedUsed",
39
+ ]);
40
+ const ALLOWED_STATUSES = new Set([
41
+ "running",
42
+ "succeeded",
43
+ "failed",
44
+ "cancelled",
45
+ ]);
46
+ // Strict-schema gate for a deserialised QI evidence record. Validates the schema-version literal,
47
+ // the closed set of top-level keys, and the status enum. Counts/integrity correctness is
48
+ // orthogonally enforced by the builder before persist.
49
+ export function validateQualityIntelligenceEvidenceManifest(value) {
50
+ if (typeof value !== "object" || value === null) {
51
+ return { ok: false, reason: "manifest is not an object" };
52
+ }
53
+ const record = value;
54
+ if (record.qiEvidenceSchemaVersion !== QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION) {
55
+ return {
56
+ ok: false,
57
+ reason: `unexpected qiEvidenceSchemaVersion (expected ${String(QUALITY_INTELLIGENCE_EVIDENCE_SCHEMA_VERSION)})`,
58
+ };
59
+ }
60
+ for (const key of Object.keys(record)) {
61
+ if (!ALLOWED_TOP_LEVEL_KEYS.has(key)) {
62
+ return { ok: false, reason: `unknown manifest key: ${key}` };
63
+ }
64
+ }
65
+ const status = record.status;
66
+ if (typeof status !== "string" || !ALLOWED_STATUSES.has(status)) {
67
+ return { ok: false, reason: "invalid status" };
68
+ }
69
+ return { ok: true, reason: undefined };
70
+ }
@@ -0,0 +1,10 @@
1
+ import type { QualityIntelligenceRedactionSummary } from "./manifestSchema.js";
2
+ export interface QualityIntelligenceRedactionOptions {
3
+ readonly additionalSecrets?: readonly string[] | undefined;
4
+ }
5
+ export interface QualityIntelligenceRedactionResult<TValue> {
6
+ readonly redacted: TValue;
7
+ readonly summary: QualityIntelligenceRedactionSummary;
8
+ }
9
+ export declare function redactQualityIntelligenceEvidence<TValue>(value: TValue, options?: QualityIntelligenceRedactionOptions): QualityIntelligenceRedactionResult<TValue>;
10
+ //# sourceMappingURL=redaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/redaction.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qBAAqB,CAAC;AA4G/E,MAAM,WAAW,mCAAmC;IAIlD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAC;CAC5D;AAED,MAAM,WAAW,kCAAkC,CAAC,MAAM;IACxD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,mCAAmC,CAAC;CACvD;AASD,wBAAgB,iCAAiC,CAAC,MAAM,EACtD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,mCAAwC,GAChD,kCAAkC,CAAC,MAAM,CAAC,CAU5C"}
@@ -0,0 +1,103 @@
1
+ // QI-specific redaction wrapper (Issue #274, ADR-0023 D8).
2
+ //
3
+ // Runs the standard `redact` from `@oscharko-dev/keiko-security` over every string leaf of a
4
+ // candidate QI evidence record, augmented with a small fixed deny-list of QI-specific patterns.
5
+ // Caller-supplied literal secrets (apiKey/baseUrl/env values the gateway already holds) are passed
6
+ // through as `additionalSecrets` so the underlying linear escape-then-replace stays ReDoS-safe.
7
+ //
8
+ // Returns a redacted manifest plus a counts-only `redactionSummary` (matched-string count, not the
9
+ // matched text). The summary is what the audit cross-references; redaction is irreversible.
10
+ import { redact } from "@oscharko-dev/keiko-security";
11
+ const QI_REDACTED = "[REDACTED]";
12
+ // JWT shape: header.payload.signature, base64url segments only. Lower bound 8 per segment to avoid
13
+ // matching ordinary words; conservative on purpose — the security-package patterns catch the
14
+ // concrete OAuth/Bearer cases this pattern would otherwise duplicate.
15
+ const JWT_PATTERN = /\b[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g;
16
+ const PASSWORD_ASSIGNMENT_PATTERN = /\b(password\s*[=:]\s*)[^\s"'`,;&]+/gi;
17
+ const TOKEN_ASSIGNMENT_PATTERN = /\b(token\s*[=:]\s*)[^\s"'`,;&]+/gi;
18
+ const QI_DENY_PATTERNS = [
19
+ { id: "jwt", pattern: JWT_PATTERN },
20
+ { id: "password-assignment", pattern: PASSWORD_ASSIGNMENT_PATTERN },
21
+ { id: "token-assignment", pattern: TOKEN_ASSIGNMENT_PATTERN },
22
+ ];
23
+ function createCounter() {
24
+ return {
25
+ totalStringsScanned: 0,
26
+ stringsRedacted: 0,
27
+ patternsMatched: {
28
+ "security-package": 0,
29
+ jwt: 0,
30
+ "password-assignment": 0,
31
+ "token-assignment": 0,
32
+ },
33
+ };
34
+ }
35
+ function applyQiDenyList(input, counter) {
36
+ let output = input;
37
+ for (const { id, pattern } of QI_DENY_PATTERNS) {
38
+ // Reset lastIndex defensively in case a global regex was matched against a prior input.
39
+ pattern.lastIndex = 0;
40
+ const matches = output.match(pattern);
41
+ if (matches !== null && matches.length > 0) {
42
+ counter.patternsMatched[id] = (counter.patternsMatched[id] ?? 0) + matches.length;
43
+ output = output.replace(pattern, (match) => {
44
+ // For assignment patterns we preserve the captured prefix; redact() does the same.
45
+ if (id === "password-assignment" || id === "token-assignment") {
46
+ const eqIndex = match.search(/[=:]/);
47
+ if (eqIndex >= 0) {
48
+ return `${match.slice(0, eqIndex + 1)}${QI_REDACTED}`;
49
+ }
50
+ }
51
+ return QI_REDACTED;
52
+ });
53
+ }
54
+ }
55
+ return output;
56
+ }
57
+ function redactString(input, additionalSecrets, counter) {
58
+ counter.totalStringsScanned += 1;
59
+ const securityRedacted = redact(input, additionalSecrets);
60
+ if (securityRedacted !== input) {
61
+ counter.patternsMatched["security-package"] =
62
+ (counter.patternsMatched["security-package"] ?? 0) + 1;
63
+ }
64
+ const qiRedacted = applyQiDenyList(securityRedacted, counter);
65
+ if (qiRedacted !== input) {
66
+ counter.stringsRedacted += 1;
67
+ }
68
+ return qiRedacted;
69
+ }
70
+ function deepRedact(value, additionalSecrets, counter) {
71
+ if (typeof value === "string") {
72
+ return redactString(value, additionalSecrets, counter);
73
+ }
74
+ if (Array.isArray(value)) {
75
+ return value.map((item) => deepRedact(item, additionalSecrets, counter));
76
+ }
77
+ if (typeof value === "object" && value !== null) {
78
+ const out = {};
79
+ for (const [key, child] of Object.entries(value)) {
80
+ out[key] = deepRedact(child, additionalSecrets, counter);
81
+ }
82
+ return out;
83
+ }
84
+ return value;
85
+ }
86
+ // Redacts every string leaf of a plain-JSON QI evidence record. Idempotent: scanning already-
87
+ // redacted text matches no pattern (each pattern's REDACTED marker contains no credential shape),
88
+ // so re-running this function over its own output is a no-op modulo the counters.
89
+ //
90
+ // The generic `TValue` is preserved as a phantom — callers pass an object shape, get the same
91
+ // shape back. We do NOT promise the runtime value is now an instance of TValue (it cannot — JSON
92
+ // has no class identity), only that the structure is preserved.
93
+ export function redactQualityIntelligenceEvidence(value, options = {}) {
94
+ const additionalSecrets = options.additionalSecrets ?? [];
95
+ const counter = createCounter();
96
+ const redacted = deepRedact(value, additionalSecrets, counter);
97
+ const summary = {
98
+ totalStringsScanned: counter.totalStringsScanned,
99
+ stringsRedacted: counter.stringsRedacted,
100
+ patternsMatched: { ...counter.patternsMatched },
101
+ };
102
+ return { redacted, summary };
103
+ }
@@ -0,0 +1,71 @@
1
+ import { type QualityIntelligenceLoadOptions, type QualityIntelligenceLocalStore } from "./store.js";
2
+ export interface QualityIntelligenceRunSnapshotEntry {
3
+ readonly runId: string;
4
+ readonly recordedAt: number;
5
+ readonly retentionPolicyId: string;
6
+ }
7
+ export interface QualityIntelligenceRetentionDecisionInput {
8
+ readonly snapshot: readonly QualityIntelligenceRunSnapshotEntry[];
9
+ readonly now: number;
10
+ }
11
+ export interface QualityIntelligenceRetentionDecision {
12
+ readonly runId: string;
13
+ readonly reason: "age-exceeded" | "count-exceeded";
14
+ }
15
+ export interface QualityIntelligenceRetentionResult {
16
+ readonly expiredRunIds: readonly string[];
17
+ readonly retainedRunIds: readonly string[];
18
+ readonly decisions: readonly QualityIntelligenceRetentionDecision[];
19
+ }
20
+ export declare function applyQualityIntelligenceRetention(input: QualityIntelligenceRetentionDecisionInput): QualityIntelligenceRetentionResult;
21
+ export type QualityIntelligenceDeletionStatus = "deleted" | "absent";
22
+ export interface QualityIntelligenceDeletionReceipt {
23
+ readonly runId: string;
24
+ readonly status: QualityIntelligenceDeletionStatus;
25
+ readonly removedCompanionSuffixes: readonly string[];
26
+ readonly auditEvent: QualityIntelligenceRunDeletedEvent;
27
+ }
28
+ export interface QualityIntelligenceRunDeletedEvent {
29
+ readonly type: "qi:run:deleted";
30
+ readonly runId: string;
31
+ readonly status: QualityIntelligenceDeletionStatus;
32
+ readonly removedCompanionSuffixes: readonly string[];
33
+ readonly at: string;
34
+ }
35
+ export interface QualityIntelligenceDeleteOptions extends QualityIntelligenceLoadOptions {
36
+ readonly now?: (() => number) | undefined;
37
+ readonly sideFileRoot?: string | undefined;
38
+ readonly companionSuffixes?: readonly string[] | undefined;
39
+ }
40
+ export declare function deleteQualityIntelligenceRun(runId: string, options?: QualityIntelligenceDeleteOptions): QualityIntelligenceDeletionReceipt;
41
+ export interface QualityIntelligenceRetentionEnforcementOptions {
42
+ readonly evidenceDir: string;
43
+ readonly now?: (() => number) | undefined;
44
+ readonly companionSuffixes?: readonly string[] | undefined;
45
+ readonly sideFileRoot?: string | undefined;
46
+ }
47
+ export interface QualityIntelligenceRetentionEnforcementResult {
48
+ readonly receipts: readonly QualityIntelligenceDeletionReceipt[];
49
+ readonly failures: readonly QualityIntelligenceRetentionDeletionFailure[];
50
+ readonly result: QualityIntelligenceRetentionResult;
51
+ }
52
+ export interface QualityIntelligenceRetentionDeletionFailure {
53
+ readonly runId: string;
54
+ readonly message: string;
55
+ }
56
+ export declare function enforceQualityIntelligenceRetentionPolicy(options: QualityIntelligenceRetentionEnforcementOptions): QualityIntelligenceRetentionEnforcementResult;
57
+ export interface QualityIntelligenceQuarantineOptions {
58
+ readonly now?: (() => number) | undefined;
59
+ }
60
+ export interface QualityIntelligenceQuarantineReceipt {
61
+ readonly originalPath: string;
62
+ readonly quarantinedPath: string;
63
+ readonly status: "quarantined" | "absent";
64
+ }
65
+ export declare function quarantineCorruptQualityIntelligenceManifest(evidenceDir: string, runId: string, options?: QualityIntelligenceQuarantineOptions): QualityIntelligenceQuarantineReceipt;
66
+ export interface QualityIntelligenceRecoverySnapshot {
67
+ readonly loadedRunIds: readonly string[];
68
+ readonly skippedRunIds: readonly string[];
69
+ }
70
+ export declare function snapshotQualityIntelligenceRunsForRecovery(store: QualityIntelligenceLocalStore): QualityIntelligenceRecoverySnapshot;
71
+ //# sourceMappingURL=retention.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/retention.ts"],"names":[],"mappings":"AAwBA,OAAO,EAGL,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EACnC,MAAM,YAAY,CAAC;AAcpB,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAGvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,QAAQ,EAAE,SAAS,mCAAmC,EAAE,CAAC;IAElE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAAC;CACpD;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,SAAS,oCAAoC,EAAE,CAAC;CACrE;AAoED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,yC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