@oscharko-dev/keiko-contracts 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 (227) hide show
  1. package/dist/.tsbuildinfo +1 -0
  2. package/dist/bff-wire.d.ts +661 -0
  3. package/dist/bff-wire.d.ts.map +1 -0
  4. package/dist/bff-wire.js +102 -0
  5. package/dist/bug-investigation-events.d.ts +92 -0
  6. package/dist/bug-investigation-events.d.ts.map +1 -0
  7. package/dist/bug-investigation-events.js +18 -0
  8. package/dist/coding-context.d.ts +76 -0
  9. package/dist/coding-context.d.ts.map +1 -0
  10. package/dist/coding-context.js +158 -0
  11. package/dist/connected-context.d.ts +174 -0
  12. package/dist/connected-context.d.ts.map +1 -0
  13. package/dist/connected-context.js +636 -0
  14. package/dist/conversation-budget.d.ts +37 -0
  15. package/dist/conversation-budget.d.ts.map +1 -0
  16. package/dist/conversation-budget.js +97 -0
  17. package/dist/editor-agent.d.ts +131 -0
  18. package/dist/editor-agent.d.ts.map +1 -0
  19. package/dist/editor-agent.js +197 -0
  20. package/dist/editor-completion.d.ts +62 -0
  21. package/dist/editor-completion.d.ts.map +1 -0
  22. package/dist/editor-completion.js +147 -0
  23. package/dist/editor-dirty-close.d.ts +17 -0
  24. package/dist/editor-dirty-close.d.ts.map +1 -0
  25. package/dist/editor-dirty-close.js +8 -0
  26. package/dist/editor-hot-exit.d.ts +18 -0
  27. package/dist/editor-hot-exit.d.ts.map +1 -0
  28. package/dist/editor-hot-exit.js +42 -0
  29. package/dist/editor-inline-completion.d.ts +70 -0
  30. package/dist/editor-inline-completion.d.ts.map +1 -0
  31. package/dist/editor-inline-completion.js +215 -0
  32. package/dist/editor-layout.d.ts +105 -0
  33. package/dist/editor-layout.d.ts.map +1 -0
  34. package/dist/editor-layout.js +479 -0
  35. package/dist/editor-patch-apply.d.ts +77 -0
  36. package/dist/editor-patch-apply.d.ts.map +1 -0
  37. package/dist/editor-patch-apply.js +122 -0
  38. package/dist/editor-session.d.ts +31 -0
  39. package/dist/editor-session.d.ts.map +1 -0
  40. package/dist/editor-session.js +75 -0
  41. package/dist/editor-test-generation.d.ts +104 -0
  42. package/dist/editor-test-generation.d.ts.map +1 -0
  43. package/dist/editor-test-generation.js +211 -0
  44. package/dist/evaluations.d.ts +75 -0
  45. package/dist/evaluations.d.ts.map +1 -0
  46. package/dist/evaluations.js +16 -0
  47. package/dist/evidence.d.ts +297 -0
  48. package/dist/evidence.d.ts.map +1 -0
  49. package/dist/evidence.js +9 -0
  50. package/dist/gateway.d.ts +129 -0
  51. package/dist/gateway.d.ts.map +1 -0
  52. package/dist/gateway.js +66 -0
  53. package/dist/harness.d.ts +274 -0
  54. package/dist/harness.d.ts.map +1 -0
  55. package/dist/harness.js +38 -0
  56. package/dist/index.d.ts +101 -0
  57. package/dist/index.d.ts.map +1 -0
  58. package/dist/index.js +83 -0
  59. package/dist/language-service.d.ts +145 -0
  60. package/dist/language-service.d.ts.map +1 -0
  61. package/dist/language-service.js +161 -0
  62. package/dist/local-knowledge-large-document-validation.d.ts +7 -0
  63. package/dist/local-knowledge-large-document-validation.d.ts.map +1 -0
  64. package/dist/local-knowledge-large-document-validation.js +161 -0
  65. package/dist/local-knowledge-large-document.d.ts +113 -0
  66. package/dist/local-knowledge-large-document.d.ts.map +1 -0
  67. package/dist/local-knowledge-large-document.js +142 -0
  68. package/dist/local-knowledge-paths.d.ts +3 -0
  69. package/dist/local-knowledge-paths.d.ts.map +1 -0
  70. package/dist/local-knowledge-paths.js +65 -0
  71. package/dist/local-knowledge-records.d.ts +190 -0
  72. package/dist/local-knowledge-records.d.ts.map +1 -0
  73. package/dist/local-knowledge-records.js +36 -0
  74. package/dist/local-knowledge-schema-validation.d.ts +19 -0
  75. package/dist/local-knowledge-schema-validation.d.ts.map +1 -0
  76. package/dist/local-knowledge-schema-validation.js +115 -0
  77. package/dist/local-knowledge-schema.d.ts +14 -0
  78. package/dist/local-knowledge-schema.d.ts.map +1 -0
  79. package/dist/local-knowledge-schema.js +715 -0
  80. package/dist/local-knowledge-validation.d.ts +20 -0
  81. package/dist/local-knowledge-validation.d.ts.map +1 -0
  82. package/dist/local-knowledge-validation.js +487 -0
  83. package/dist/local-knowledge.d.ts +158 -0
  84. package/dist/local-knowledge.d.ts.map +1 -0
  85. package/dist/local-knowledge.js +63 -0
  86. package/dist/memory-audit-events.d.ts +73 -0
  87. package/dist/memory-audit-events.d.ts.map +1 -0
  88. package/dist/memory-audit-events.js +44 -0
  89. package/dist/memory-audit-validation.d.ts +4 -0
  90. package/dist/memory-audit-validation.d.ts.map +1 -0
  91. package/dist/memory-audit-validation.js +151 -0
  92. package/dist/memory-barrel.d.ts +15 -0
  93. package/dist/memory-barrel.d.ts.map +1 -0
  94. package/dist/memory-barrel.js +20 -0
  95. package/dist/memory-internal.d.ts +26 -0
  96. package/dist/memory-internal.d.ts.map +1 -0
  97. package/dist/memory-internal.js +104 -0
  98. package/dist/memory-operations-validation.d.ts +12 -0
  99. package/dist/memory-operations-validation.d.ts.map +1 -0
  100. package/dist/memory-operations-validation.js +267 -0
  101. package/dist/memory-operations.d.ts +156 -0
  102. package/dist/memory-operations.d.ts.map +1 -0
  103. package/dist/memory-operations.js +29 -0
  104. package/dist/memory-record-validation.d.ts +10 -0
  105. package/dist/memory-record-validation.d.ts.map +1 -0
  106. package/dist/memory-record-validation.js +101 -0
  107. package/dist/memory-records.d.ts +66 -0
  108. package/dist/memory-records.d.ts.map +1 -0
  109. package/dist/memory-records.js +22 -0
  110. package/dist/memory-retrieval-validation.d.ts +6 -0
  111. package/dist/memory-retrieval-validation.d.ts.map +1 -0
  112. package/dist/memory-retrieval-validation.js +108 -0
  113. package/dist/memory-validation.d.ts +31 -0
  114. package/dist/memory-validation.d.ts.map +1 -0
  115. package/dist/memory-validation.js +318 -0
  116. package/dist/memory-workflow-port.d.ts +26 -0
  117. package/dist/memory-workflow-port.d.ts.map +1 -0
  118. package/dist/memory-workflow-port.js +13 -0
  119. package/dist/memory.d.ts +81 -0
  120. package/dist/memory.d.ts.map +1 -0
  121. package/dist/memory.js +104 -0
  122. package/dist/prompt-enhancer-analyzer.d.ts +7 -0
  123. package/dist/prompt-enhancer-analyzer.d.ts.map +1 -0
  124. package/dist/prompt-enhancer-analyzer.js +745 -0
  125. package/dist/prompt-enhancer-bff.d.ts +67 -0
  126. package/dist/prompt-enhancer-bff.d.ts.map +1 -0
  127. package/dist/prompt-enhancer-bff.js +156 -0
  128. package/dist/prompt-enhancer-critic.d.ts +46 -0
  129. package/dist/prompt-enhancer-critic.d.ts.map +1 -0
  130. package/dist/prompt-enhancer-critic.js +35 -0
  131. package/dist/prompt-enhancer-grounding.d.ts +19 -0
  132. package/dist/prompt-enhancer-grounding.d.ts.map +1 -0
  133. package/dist/prompt-enhancer-grounding.js +235 -0
  134. package/dist/prompt-enhancer-safety.d.ts +66 -0
  135. package/dist/prompt-enhancer-safety.d.ts.map +1 -0
  136. package/dist/prompt-enhancer-safety.js +446 -0
  137. package/dist/prompt-enhancer-validation.d.ts +28 -0
  138. package/dist/prompt-enhancer-validation.d.ts.map +1 -0
  139. package/dist/prompt-enhancer-validation.js +931 -0
  140. package/dist/prompt-enhancer.d.ts +184 -0
  141. package/dist/prompt-enhancer.d.ts.map +1 -0
  142. package/dist/prompt-enhancer.js +350 -0
  143. package/dist/qualityIntelligence/assertNever.d.ts +2 -0
  144. package/dist/qualityIntelligence/assertNever.d.ts.map +1 -0
  145. package/dist/qualityIntelligence/assertNever.js +7 -0
  146. package/dist/qualityIntelligence/auditSummary.d.ts +25 -0
  147. package/dist/qualityIntelligence/auditSummary.d.ts.map +1 -0
  148. package/dist/qualityIntelligence/auditSummary.js +7 -0
  149. package/dist/qualityIntelligence/bffWire.d.ts +356 -0
  150. package/dist/qualityIntelligence/bffWire.d.ts.map +1 -0
  151. package/dist/qualityIntelligence/bffWire.js +22 -0
  152. package/dist/qualityIntelligence/coverageMap.d.ts +21 -0
  153. package/dist/qualityIntelligence/coverageMap.d.ts.map +1 -0
  154. package/dist/qualityIntelligence/coverageMap.js +29 -0
  155. package/dist/qualityIntelligence/editableRevision.d.ts +21 -0
  156. package/dist/qualityIntelligence/editableRevision.d.ts.map +1 -0
  157. package/dist/qualityIntelligence/editableRevision.js +8 -0
  158. package/dist/qualityIntelligence/evidenceAtom.d.ts +35 -0
  159. package/dist/qualityIntelligence/evidenceAtom.d.ts.map +1 -0
  160. package/dist/qualityIntelligence/evidenceAtom.js +29 -0
  161. package/dist/qualityIntelligence/exportBundle.d.ts +28 -0
  162. package/dist/qualityIntelligence/exportBundle.d.ts.map +1 -0
  163. package/dist/qualityIntelligence/exportBundle.js +46 -0
  164. package/dist/qualityIntelligence/handoffEnvelope.d.ts +23 -0
  165. package/dist/qualityIntelligence/handoffEnvelope.d.ts.map +1 -0
  166. package/dist/qualityIntelligence/handoffEnvelope.js +8 -0
  167. package/dist/qualityIntelligence/ids.d.ts +58 -0
  168. package/dist/qualityIntelligence/ids.d.ts.map +1 -0
  169. package/dist/qualityIntelligence/ids.js +93 -0
  170. package/dist/qualityIntelligence/index.d.ts +29 -0
  171. package/dist/qualityIntelligence/index.d.ts.map +1 -0
  172. package/dist/qualityIntelligence/index.js +20 -0
  173. package/dist/qualityIntelligence/reviewRecord.d.ts +19 -0
  174. package/dist/qualityIntelligence/reviewRecord.d.ts.map +1 -0
  175. package/dist/qualityIntelligence/reviewRecord.js +20 -0
  176. package/dist/qualityIntelligence/runPlanAndEvents.d.ts +84 -0
  177. package/dist/qualityIntelligence/runPlanAndEvents.d.ts.map +1 -0
  178. package/dist/qualityIntelligence/runPlanAndEvents.js +51 -0
  179. package/dist/qualityIntelligence/sourceEnvelope.d.ts +77 -0
  180. package/dist/qualityIntelligence/sourceEnvelope.d.ts.map +1 -0
  181. package/dist/qualityIntelligence/sourceEnvelope.js +118 -0
  182. package/dist/qualityIntelligence/testCaseCandidate.d.ts +21 -0
  183. package/dist/qualityIntelligence/testCaseCandidate.d.ts.map +1 -0
  184. package/dist/qualityIntelligence/testCaseCandidate.js +21 -0
  185. package/dist/qualityIntelligence/testQualityRubric.d.ts +17 -0
  186. package/dist/qualityIntelligence/testQualityRubric.d.ts.map +1 -0
  187. package/dist/qualityIntelligence/testQualityRubric.js +32 -0
  188. package/dist/qualityIntelligence/validationFinding.d.ts +48 -0
  189. package/dist/qualityIntelligence/validationFinding.d.ts.map +1 -0
  190. package/dist/qualityIntelligence/validationFinding.js +36 -0
  191. package/dist/relationships-validation.d.ts +13 -0
  192. package/dist/relationships-validation.d.ts.map +1 -0
  193. package/dist/relationships-validation.js +422 -0
  194. package/dist/relationships.d.ts +79 -0
  195. package/dist/relationships.d.ts.map +1 -0
  196. package/dist/relationships.js +307 -0
  197. package/dist/text-safety.d.ts +7 -0
  198. package/dist/text-safety.d.ts.map +1 -0
  199. package/dist/text-safety.js +58 -0
  200. package/dist/tools.d.ts +153 -0
  201. package/dist/tools.d.ts.map +1 -0
  202. package/dist/tools.js +118 -0
  203. package/dist/unit-test-events.d.ts +87 -0
  204. package/dist/unit-test-events.d.ts.map +1 -0
  205. package/dist/unit-test-events.js +14 -0
  206. package/dist/verification-summary.d.ts +38 -0
  207. package/dist/verification-summary.d.ts.map +1 -0
  208. package/dist/verification-summary.js +5 -0
  209. package/dist/verification.d.ts +64 -0
  210. package/dist/verification.d.ts.map +1 -0
  211. package/dist/verification.js +13 -0
  212. package/dist/workflow-descriptor.d.ts +21 -0
  213. package/dist/workflow-descriptor.d.ts.map +1 -0
  214. package/dist/workflow-descriptor.js +8 -0
  215. package/dist/workflow-handoff.d.ts +69 -0
  216. package/dist/workflow-handoff.d.ts.map +1 -0
  217. package/dist/workflow-handoff.js +381 -0
  218. package/dist/workspace-descriptors.d.ts +21 -0
  219. package/dist/workspace-descriptors.d.ts.map +1 -0
  220. package/dist/workspace-descriptors.js +180 -0
  221. package/dist/workspace-ui.d.ts +119 -0
  222. package/dist/workspace-ui.d.ts.map +1 -0
  223. package/dist/workspace-ui.js +105 -0
  224. package/dist/workspace.d.ts +104 -0
  225. package/dist/workspace.d.ts.map +1 -0
  226. package/dist/workspace.js +27 -0
  227. package/package.json +71 -0
@@ -0,0 +1,118 @@
1
+ // Quality Intelligence source envelope (Epic #270, Issue #277).
2
+ //
3
+ // A source envelope carries refer-by-ref metadata about a single input scope used to
4
+ // derive evidence atoms. ENVELOPES NEVER CARRY RAW CONTENT — they carry an opaque
5
+ // `localRef` string the runtime resolves against the workspace, local-knowledge
6
+ // capsule store, or other adapter. No URLs, no credentials, no large content blobs.
7
+ //
8
+ // Discriminated union over `kind`:
9
+ // * repository-context — refer to a repo workspace path or scope id.
10
+ // * local-knowledge-capsule — refer to a KnowledgeCapsuleId or sub-scope.
11
+ // * figma-evidence — refer to a local Figma evidence cache id.
12
+ // * human-context — refer to a human-authored note id (Conversation Center).
13
+ // * connector-document — refer to an opaque connector document id.
14
+ //
15
+ // Provenance + integrity hash give the audit ledger (#274) a stable footprint without
16
+ // embedding any payload.
17
+ export const QUALITY_INTELLIGENCE_SOURCE_KINDS = [
18
+ "repository-context",
19
+ "local-knowledge-capsule",
20
+ "figma-evidence",
21
+ "human-context",
22
+ "connector-document",
23
+ ];
24
+ // True for a bidi-override/isolate, zero-width, BOM, LRM/RLM, or Arabic-letter-mark code point — the
25
+ // invisible / text-reordering characters that can spoof a display surface's reading order. A numeric
26
+ // scan (rather than a regex) keeps the set auditable and avoids embedding invisible literals in the
27
+ // source. All targets are ≥ U+061C, so no control-range regex / `no-control-regex` concern arises.
28
+ // Mirrors keiko-quality-intelligence `isUnsafeHigh`; kept inline because keiko-contracts is the base
29
+ // layer and must not depend on the QI domain package.
30
+ const isBidiOrZeroWidthCodePoint = (cp) => cp === 0x061c ||
31
+ (cp >= 0x200b && cp <= 0x200f) ||
32
+ (cp >= 0x202a && cp <= 0x202e) ||
33
+ (cp >= 0x2066 && cp <= 0x2069) ||
34
+ cp === 0xfeff;
35
+ const containsBidiOrZeroWidth = (value) => {
36
+ for (const ch of value) {
37
+ if (isBidiOrZeroWidthCodePoint(ch.codePointAt(0) ?? 0))
38
+ return true;
39
+ }
40
+ return false;
41
+ };
42
+ /**
43
+ * Returns `true` if a field value looks safe to surface in a browser context.
44
+ * Rejects when the value contains:
45
+ * (a) any URL authority — `scheme://` for ANY scheme (http, ftp, s3, file, …)
46
+ * (b) well-known credential token prefixes (AWS AKIA, GitHub ghp_/gho_/github_pat_,
47
+ * Slack xox[baprs]-, OpenAI sk-, Bearer token, PEM PRIVATE KEY header)
48
+ * (c) an absolute filesystem path (POSIX `/`, Windows drive `C:\`, UNC `\\`)
49
+ * (d) a bidi-override/isolate, zero-width, BOM, LRM/RLM, or Arabic-letter-mark code point —
50
+ * invisible or text-reordering characters that can spoof the reading order of a browser
51
+ * display surface. The runtime that builds envelopes strips these at ingestion; this is the
52
+ * defence-in-depth mirror (Epic #729 — symmetric with the candidate-text scrubber).
53
+ */
54
+ const fieldLooksUnsafe = (value) => {
55
+ // (a) any scheme://
56
+ if (/[a-z][a-z0-9+.-]*:\/\//iu.test(value))
57
+ return true;
58
+ // (b) credential shapes
59
+ if (/AKIA[0-9A-Z]{12,}/u.test(value))
60
+ return true;
61
+ if (/(?:ghp_|gho_|github_pat_)[A-Za-z0-9_]{20,}/u.test(value))
62
+ return true;
63
+ if (/xox[baprs]-[A-Za-z0-9-]{10,}/u.test(value))
64
+ return true;
65
+ if (/sk-[A-Za-z0-9]{16,}/u.test(value))
66
+ return true;
67
+ if (/\bBearer\s+\S/u.test(value))
68
+ return true;
69
+ if (/-----BEGIN [A-Z ]*PRIVATE KEY-----/u.test(value))
70
+ return true;
71
+ // (c) absolute filesystem paths
72
+ if (/^(?:\/|[A-Za-z]:[\\/]|\\\\)/u.test(value))
73
+ return true;
74
+ // (d) bidi-override / isolate, zero-width, BOM, LRM/RLM, Arabic letter mark
75
+ if (containsBidiOrZeroWidth(value))
76
+ return true;
77
+ return false;
78
+ };
79
+ /**
80
+ * Cheap structural guard: rejects envelopes that look like they may carry credentials,
81
+ * URLs, or oversized labels in their display surface. Pure, no IO.
82
+ *
83
+ * Scanned fields: `displayLabel`, `localRef`, `provenance.origin`, and (for
84
+ * `connector-document` envelopes) `adapterId`.
85
+ *
86
+ * Rejected when ANY scanned field contains:
87
+ * - a URL with an authority (`scheme://` for any scheme)
88
+ * - a well-known credential shape (AWS AKIA*, GitHub ghp_/gho_/github_pat_*,
89
+ * Slack xox[baprs]-, OpenAI sk-*, Bearer token, PEM PRIVATE KEY header)
90
+ * - an absolute filesystem path (POSIX `/`, Windows drive, or UNC `\\`)
91
+ * - a bidi-override/isolate, zero-width, BOM, LRM/RLM, or Arabic-letter-mark code point
92
+ *
93
+ * Additionally rejects when:
94
+ * - `displayLabel` is empty or exceeds 256 characters
95
+ * - `displayLabel` looks base64-ish (≥40 chars of the base64 alphabet)
96
+ * - `provenance.integrityHashSha256Hex` is not a 64-char lowercase hex string
97
+ *
98
+ * The runtime that builds envelopes is responsible for ALL redaction; this helper is
99
+ * a defence-in-depth check the audit ledger can use before persisting.
100
+ */
101
+ export const looksLikeBrowserSafeSourceEnvelope = (envelope) => {
102
+ const { displayLabel, provenance, localRef } = envelope;
103
+ if (displayLabel.length === 0 || displayLabel.length > 256)
104
+ return false;
105
+ if (/^[A-Za-z0-9+/]{40,}={0,2}$/u.test(displayLabel))
106
+ return false; // base64-ish (displayLabel only)
107
+ if (!/^[0-9a-f]{64}$/u.test(provenance.integrityHashSha256Hex))
108
+ return false;
109
+ if (fieldLooksUnsafe(displayLabel))
110
+ return false;
111
+ if (fieldLooksUnsafe(localRef))
112
+ return false;
113
+ if (fieldLooksUnsafe(provenance.origin))
114
+ return false;
115
+ if (envelope.kind === "connector-document" && fieldLooksUnsafe(envelope.adapterId))
116
+ return false;
117
+ return true;
118
+ };
@@ -0,0 +1,21 @@
1
+ import type { QualityIntelligenceEvidenceAtomId, QualityIntelligenceRunId, QualityIntelligenceTestCaseId } from "./ids.js";
2
+ export type QualityIntelligencePriority = "P0" | "P1" | "P2" | "P3";
3
+ export declare const QUALITY_INTELLIGENCE_PRIORITIES: readonly QualityIntelligencePriority[];
4
+ export type QualityIntelligenceRiskClass = "safety" | "compliance" | "regression" | "functional" | "visual";
5
+ export declare const QUALITY_INTELLIGENCE_RISK_CLASSES: readonly QualityIntelligenceRiskClass[];
6
+ export type QualityIntelligenceTestCaseStatus = "proposed" | "accepted" | "rejected" | "needs-review";
7
+ export declare const QUALITY_INTELLIGENCE_TEST_CASE_STATUSES: readonly QualityIntelligenceTestCaseStatus[];
8
+ export interface QualityIntelligenceTestCaseCandidate {
9
+ readonly id: QualityIntelligenceTestCaseId;
10
+ readonly runId: QualityIntelligenceRunId;
11
+ readonly derivedFromAtomIds: readonly QualityIntelligenceEvidenceAtomId[];
12
+ readonly title: string;
13
+ readonly preconditions: readonly string[];
14
+ readonly steps: readonly string[];
15
+ readonly expectedResults: readonly string[];
16
+ readonly priority: QualityIntelligencePriority;
17
+ readonly riskClass: QualityIntelligenceRiskClass;
18
+ readonly tags: readonly string[];
19
+ readonly status: QualityIntelligenceTestCaseStatus;
20
+ }
21
+ //# sourceMappingURL=testCaseCandidate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testCaseCandidate.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/testCaseCandidate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,iCAAiC,EACjC,wBAAwB,EACxB,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,2BAA2B,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpE,eAAO,MAAM,+BAA+B,EAAE,SAAS,2BAA2B,EAKxE,CAAC;AAEX,MAAM,MAAM,4BAA4B,GACpC,QAAQ,GACR,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,QAAQ,CAAC;AAEb,eAAO,MAAM,iCAAiC,EAAE,SAAS,4BAA4B,EAM3E,CAAC;AAEX,MAAM,MAAM,iCAAiC,GACzC,UAAU,GACV,UAAU,GACV,UAAU,GACV,cAAc,CAAC;AAEnB,eAAO,MAAM,uCAAuC,EAAE,SAAS,iCAAiC,EACjC,CAAC;AAEhE,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,EAAE,EAAE,6BAA6B,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,iCAAiC,EAAE,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;IAC/C,QAAQ,CAAC,SAAS,EAAE,4BAA4B,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAC;CACpD"}
@@ -0,0 +1,21 @@
1
+ // Quality Intelligence test-case candidate (Epic #270, Issue #277).
2
+ //
3
+ // A candidate is a generated, reviewable, executable-shaped test case. It carries the
4
+ // authored shape (title/preconditions/steps/expected results) and the provenance
5
+ // references to the evidence atoms it was derived from. The candidate is the
6
+ // review surface used by #282 (review governance) and the export surface used by
7
+ // #283 (export adapters).
8
+ export const QUALITY_INTELLIGENCE_PRIORITIES = [
9
+ "P0",
10
+ "P1",
11
+ "P2",
12
+ "P3",
13
+ ];
14
+ export const QUALITY_INTELLIGENCE_RISK_CLASSES = [
15
+ "safety",
16
+ "compliance",
17
+ "regression",
18
+ "functional",
19
+ "visual",
20
+ ];
21
+ export const QUALITY_INTELLIGENCE_TEST_CASE_STATUSES = ["proposed", "accepted", "rejected", "needs-review"];
@@ -0,0 +1,17 @@
1
+ export declare const TEST_QUALITY_RUBRIC_DIMENSIONS: readonly ["verifiability", "atomicity", "determinism", "ac-fidelity"];
2
+ export type TestQualityDimensionName = (typeof TEST_QUALITY_RUBRIC_DIMENSIONS)[number];
3
+ export declare const TEST_QUALITY_JUDGE_RESPONSE_SCHEMA: Readonly<Record<string, unknown>>;
4
+ export interface TestQualityRubricDimension {
5
+ readonly name: TestQualityDimensionName;
6
+ /** Integer in [0, 100]. 0 = worst; 100 = best. */
7
+ readonly score: number;
8
+ /** Human-readable rationale for the score; redact before persistence or browser projection. */
9
+ readonly rationale: string;
10
+ }
11
+ export interface TestQualityJudgeVerdict {
12
+ readonly verdict: "weak" | "strong";
13
+ readonly dimensions: readonly TestQualityRubricDimension[];
14
+ /** Aggregated explanation; redact before persistence or browser projection. */
15
+ readonly overallRationale: string;
16
+ }
17
+ //# sourceMappingURL=testQualityRubric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testQualityRubric.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/testQualityRubric.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,8BAA8B,uEAKjC,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,8BAA8B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvF,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoB/E,CAAC;AAEH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,kDAAkD;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAC3D,+EAA+E;IAC/E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC"}
@@ -0,0 +1,32 @@
1
+ // Quality Intelligence test-quality rubric contract (Epic #736, Issue #746).
2
+ //
3
+ // Defines the four dimensions that a model-judge evaluates for every generated test-case
4
+ // candidate, the per-dimension score shape, the aggregated judge verdict, and the JSON schema
5
+ // that constrains gateway structured output. Pure data contracts — no logic, no IO, no model calls.
6
+ export const TEST_QUALITY_RUBRIC_DIMENSIONS = [
7
+ "verifiability",
8
+ "atomicity",
9
+ "determinism",
10
+ "ac-fidelity",
11
+ ];
12
+ export const TEST_QUALITY_JUDGE_RESPONSE_SCHEMA = Object.freeze({
13
+ type: "object",
14
+ additionalProperties: false,
15
+ required: ["dimensions", "overallRationale"],
16
+ properties: {
17
+ dimensions: {
18
+ type: "array",
19
+ items: {
20
+ type: "object",
21
+ additionalProperties: false,
22
+ required: ["name", "score", "rationale"],
23
+ properties: {
24
+ name: { type: "string", enum: [...TEST_QUALITY_RUBRIC_DIMENSIONS] },
25
+ score: { type: "integer", minimum: 0, maximum: 100 },
26
+ rationale: { type: "string" },
27
+ },
28
+ },
29
+ },
30
+ overallRationale: { type: "string" },
31
+ },
32
+ });
@@ -0,0 +1,48 @@
1
+ import type { QualityIntelligenceEvidenceAtomId, QualityIntelligenceRunId, QualityIntelligenceTestCaseId, QualityIntelligenceValidationFindingId } from "./ids.js";
2
+ export type QualityIntelligenceValidationFindingKind = "logic-defect" | "faithfulness-defect" | "semantic-defect" | "mutation-defect" | "policy-violation" | "manual-rejection" | "coverage-gap" | "test-quality";
3
+ export declare const QUALITY_INTELLIGENCE_VALIDATION_FINDING_KINDS: readonly QualityIntelligenceValidationFindingKind[];
4
+ export type QualityIntelligenceSeverity = "critical" | "high" | "medium" | "low";
5
+ export declare const QUALITY_INTELLIGENCE_SEVERITIES: readonly QualityIntelligenceSeverity[];
6
+ /**
7
+ * Total ordering on severity, highest-first. `critical` < `high` < `medium` < `low`
8
+ * in this ordering (lower number = more severe). Pure; used by callers that need to
9
+ * sort or threshold findings.
10
+ */
11
+ export declare const QUALITY_INTELLIGENCE_SEVERITY_RANK: Readonly<Record<QualityIntelligenceSeverity, number>>;
12
+ interface QualityIntelligenceValidationFindingCommon {
13
+ readonly id: QualityIntelligenceValidationFindingId;
14
+ readonly runId: QualityIntelligenceRunId;
15
+ /** Absent for run-scoped findings (e.g. a policy violation against the whole run). */
16
+ readonly candidateId?: QualityIntelligenceTestCaseId;
17
+ readonly severity: QualityIntelligenceSeverity;
18
+ /** Non-secret single-sentence summary; assumed already redacted by the producer. */
19
+ readonly summary: string;
20
+ readonly evidenceAtomIds: readonly QualityIntelligenceEvidenceAtomId[];
21
+ }
22
+ export interface QualityIntelligenceLogicDefectFinding extends QualityIntelligenceValidationFindingCommon {
23
+ readonly kind: "logic-defect";
24
+ }
25
+ export interface QualityIntelligenceFaithfulnessDefectFinding extends QualityIntelligenceValidationFindingCommon {
26
+ readonly kind: "faithfulness-defect";
27
+ }
28
+ export interface QualityIntelligenceSemanticDefectFinding extends QualityIntelligenceValidationFindingCommon {
29
+ readonly kind: "semantic-defect";
30
+ }
31
+ export interface QualityIntelligenceMutationDefectFinding extends QualityIntelligenceValidationFindingCommon {
32
+ readonly kind: "mutation-defect";
33
+ }
34
+ export interface QualityIntelligencePolicyViolationFinding extends QualityIntelligenceValidationFindingCommon {
35
+ readonly kind: "policy-violation";
36
+ }
37
+ export interface QualityIntelligenceManualRejectionFinding extends QualityIntelligenceValidationFindingCommon {
38
+ readonly kind: "manual-rejection";
39
+ }
40
+ export interface QualityIntelligenceCoverageGapFinding extends QualityIntelligenceValidationFindingCommon {
41
+ readonly kind: "coverage-gap";
42
+ }
43
+ export interface QualityIntelligenceTestQualityFinding extends QualityIntelligenceValidationFindingCommon {
44
+ readonly kind: "test-quality";
45
+ }
46
+ export type QualityIntelligenceValidationFinding = QualityIntelligenceLogicDefectFinding | QualityIntelligenceFaithfulnessDefectFinding | QualityIntelligenceSemanticDefectFinding | QualityIntelligenceMutationDefectFinding | QualityIntelligencePolicyViolationFinding | QualityIntelligenceManualRejectionFinding | QualityIntelligenceCoverageGapFinding | QualityIntelligenceTestQualityFinding;
47
+ export {};
48
+ //# sourceMappingURL=validationFinding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validationFinding.d.ts","sourceRoot":"","sources":["../../src/qualityIntelligence/validationFinding.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,iCAAiC,EACjC,wBAAwB,EACxB,6BAA6B,EAC7B,sCAAsC,EACvC,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,wCAAwC,GAChD,cAAc,GACd,qBAAqB,GACrB,iBAAiB,GACjB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,cAAc,CAAC;AAEnB,eAAO,MAAM,6CAA6C,EAAE,SAAS,wCAAwC,EAUjG,CAAC;AAEb,MAAM,MAAM,2BAA2B,GAAG,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEjF,eAAO,MAAM,+BAA+B,EAAE,SAAS,2BAA2B,EAKxE,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CACvD,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAM3C,CAAC;AAEH,UAAU,0CAA0C;IAClD,QAAQ,CAAC,EAAE,EAAE,sCAAsC,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,sFAAsF;IACtF,QAAQ,CAAC,WAAW,CAAC,EAAE,6BAA6B,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;IAC/C,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,SAAS,iCAAiC,EAAE,CAAC;CACxE;AAED,MAAM,WAAW,qCAAsC,SAAQ,0CAA0C;IACvG,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED,MAAM,WAAW,4CAA6C,SAAQ,0CAA0C;IAC9G,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;CACtC;AAED,MAAM,WAAW,wCAAyC,SAAQ,0CAA0C;IAC1G,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,MAAM,WAAW,wCAAyC,SAAQ,0CAA0C;IAC1G,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;CAClC;AAED,MAAM,WAAW,yCAA0C,SAAQ,0CAA0C;IAC3G,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,WAAW,yCAA0C,SAAQ,0CAA0C;IAC3G,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,WAAW,qCAAsC,SAAQ,0CAA0C;IACvG,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED,MAAM,WAAW,qCAAsC,SAAQ,0CAA0C;IACvG,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;CAC/B;AAED,MAAM,MAAM,oCAAoC,GAC5C,qCAAqC,GACrC,4CAA4C,GAC5C,wCAAwC,GACxC,wCAAwC,GACxC,yCAAyC,GACzC,yCAAyC,GACzC,qCAAqC,GACrC,qCAAqC,CAAC"}
@@ -0,0 +1,36 @@
1
+ // Quality Intelligence validation finding (Epic #270, Issue #277).
2
+ //
3
+ // A validation finding is the output of any QI validator stage: deterministic logic
4
+ // checks, faithfulness vs source atoms, semantic equivalence, mutation testing, policy
5
+ // gates, or a human reviewer rejection. Findings are the inputs to review governance
6
+ // (#282) and to the audit summary (this package).
7
+ //
8
+ // `summary` is a non-secret single-sentence description. Validators MUST redact before
9
+ // constructing the summary; the contract surface assumes redaction has already happened.
10
+ export const QUALITY_INTELLIGENCE_VALIDATION_FINDING_KINDS = [
11
+ "logic-defect",
12
+ "faithfulness-defect",
13
+ "semantic-defect",
14
+ "mutation-defect",
15
+ "policy-violation",
16
+ "manual-rejection",
17
+ "coverage-gap",
18
+ "test-quality",
19
+ ];
20
+ export const QUALITY_INTELLIGENCE_SEVERITIES = [
21
+ "critical",
22
+ "high",
23
+ "medium",
24
+ "low",
25
+ ];
26
+ /**
27
+ * Total ordering on severity, highest-first. `critical` < `high` < `medium` < `low`
28
+ * in this ordering (lower number = more severe). Pure; used by callers that need to
29
+ * sort or threshold findings.
30
+ */
31
+ export const QUALITY_INTELLIGENCE_SEVERITY_RANK = Object.freeze({
32
+ critical: 0,
33
+ high: 1,
34
+ medium: 2,
35
+ low: 3,
36
+ });
@@ -0,0 +1,13 @@
1
+ import type { Relationship, RelationshipDenialCode, RelationshipObjectKind, RelationshipType, RelationshipValidationContext, RelationshipValidationError } from "./relationships.js";
2
+ export interface ValidationOk<T> {
3
+ readonly ok: true;
4
+ readonly value: T;
5
+ }
6
+ export interface ValidationFail {
7
+ readonly ok: false;
8
+ readonly errors: readonly RelationshipValidationError[];
9
+ }
10
+ export type RelationshipValidation = ValidationOk<Relationship> | ValidationFail;
11
+ export declare function assertRelationshipTypeAllowsKinds(type: RelationshipType, sourceKind: RelationshipObjectKind, targetKind: RelationshipObjectKind): RelationshipDenialCode | null;
12
+ export declare function validateRelationship(input: unknown, ctx?: RelationshipValidationContext): RelationshipValidation;
13
+ //# sourceMappingURL=relationships-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationships-validation.d.ts","sourceRoot":"","sources":["../src/relationships-validation.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAEV,YAAY,EACZ,sBAAsB,EAGtB,sBAAsB,EACtB,gBAAgB,EAEhB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,oBAAoB,CAAC;AAY5B,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,SAAS,2BAA2B,EAAE,CAAC;CACzD;AAED,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,cAAc,CAAC;AAoRjF,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,sBAAsB,EAClC,UAAU,EAAE,sBAAsB,GACjC,sBAAsB,GAAG,IAAI,CAW/B;AA+SD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,GAAG,CAAC,EAAE,6BAA6B,GAClC,sBAAsB,CAwBxB"}