@dailephd/my-frontend-observer 0.8.1

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 (316) hide show
  1. package/CHANGELOG.md +397 -0
  2. package/LICENSE +21 -0
  3. package/README.md +255 -0
  4. package/dist/application/browserCaptureService.d.ts +11 -0
  5. package/dist/application/browserCaptureService.js +12 -0
  6. package/dist/application/browserCaptureService.js.map +1 -0
  7. package/dist/application/comparisonService.d.ts +56 -0
  8. package/dist/application/comparisonService.js +77 -0
  9. package/dist/application/comparisonService.js.map +1 -0
  10. package/dist/application/externalReferencePersistenceService.d.ts +75 -0
  11. package/dist/application/externalReferencePersistenceService.js +182 -0
  12. package/dist/application/externalReferencePersistenceService.js.map +1 -0
  13. package/dist/application/frontendContractEvaluationService.d.ts +49 -0
  14. package/dist/application/frontendContractEvaluationService.js +112 -0
  15. package/dist/application/frontendContractEvaluationService.js.map +1 -0
  16. package/dist/application/frontendContractPersistenceService.d.ts +56 -0
  17. package/dist/application/frontendContractPersistenceService.js +91 -0
  18. package/dist/application/frontendContractPersistenceService.js.map +1 -0
  19. package/dist/application/observationPersistence.d.ts +59 -0
  20. package/dist/application/observationPersistence.js +79 -0
  21. package/dist/application/observationPersistence.js.map +1 -0
  22. package/dist/application/projectCheckService.d.ts +3 -0
  23. package/dist/application/projectCheckService.js +169 -0
  24. package/dist/application/projectCheckService.js.map +1 -0
  25. package/dist/application/projectWorkflowService.d.ts +46 -0
  26. package/dist/application/projectWorkflowService.js +92 -0
  27. package/dist/application/projectWorkflowService.js.map +1 -0
  28. package/dist/application/referenceFidelityEvaluationService.d.ts +28 -0
  29. package/dist/application/referenceFidelityEvaluationService.js +45 -0
  30. package/dist/application/referenceFidelityEvaluationService.js.map +1 -0
  31. package/dist/artifacts/artifactReader.d.ts +19 -0
  32. package/dist/artifacts/artifactReader.js +36 -0
  33. package/dist/artifacts/artifactReader.js.map +1 -0
  34. package/dist/artifacts/artifactWriter.d.ts +25 -0
  35. package/dist/artifacts/artifactWriter.js +68 -0
  36. package/dist/artifacts/artifactWriter.js.map +1 -0
  37. package/dist/artifacts/comparisonArtifactReader.d.ts +18 -0
  38. package/dist/artifacts/comparisonArtifactReader.js +35 -0
  39. package/dist/artifacts/comparisonArtifactReader.js.map +1 -0
  40. package/dist/artifacts/comparisonArtifactWriter.d.ts +41 -0
  41. package/dist/artifacts/comparisonArtifactWriter.js +67 -0
  42. package/dist/artifacts/comparisonArtifactWriter.js.map +1 -0
  43. package/dist/artifacts/externalReferenceArtifactReader.d.ts +18 -0
  44. package/dist/artifacts/externalReferenceArtifactReader.js +35 -0
  45. package/dist/artifacts/externalReferenceArtifactReader.js.map +1 -0
  46. package/dist/artifacts/externalReferenceArtifactWriter.d.ts +44 -0
  47. package/dist/artifacts/externalReferenceArtifactWriter.js +77 -0
  48. package/dist/artifacts/externalReferenceArtifactWriter.js.map +1 -0
  49. package/dist/artifacts/frontendContractArtifactReader.d.ts +24 -0
  50. package/dist/artifacts/frontendContractArtifactReader.js +47 -0
  51. package/dist/artifacts/frontendContractArtifactReader.js.map +1 -0
  52. package/dist/artifacts/frontendContractArtifactWriter.d.ts +34 -0
  53. package/dist/artifacts/frontendContractArtifactWriter.js +70 -0
  54. package/dist/artifacts/frontendContractArtifactWriter.js.map +1 -0
  55. package/dist/artifacts/frontendContractEvaluationArtifactReader.d.ts +17 -0
  56. package/dist/artifacts/frontendContractEvaluationArtifactReader.js +34 -0
  57. package/dist/artifacts/frontendContractEvaluationArtifactReader.js.map +1 -0
  58. package/dist/artifacts/frontendContractEvaluationArtifactWriter.d.ts +32 -0
  59. package/dist/artifacts/frontendContractEvaluationArtifactWriter.js +58 -0
  60. package/dist/artifacts/frontendContractEvaluationArtifactWriter.js.map +1 -0
  61. package/dist/artifacts/types.d.ts +17 -0
  62. package/dist/artifacts/types.js +2 -0
  63. package/dist/artifacts/types.js.map +1 -0
  64. package/dist/browser/chromiumAdapter.d.ts +21 -0
  65. package/dist/browser/chromiumAdapter.js +204 -0
  66. package/dist/browser/chromiumAdapter.js.map +1 -0
  67. package/dist/browser/evidenceCapture.d.ts +62 -0
  68. package/dist/browser/evidenceCapture.js +500 -0
  69. package/dist/browser/evidenceCapture.js.map +1 -0
  70. package/dist/browser/scrollCapture.d.ts +32 -0
  71. package/dist/browser/scrollCapture.js +163 -0
  72. package/dist/browser/scrollCapture.js.map +1 -0
  73. package/dist/browser/types.d.ts +24 -0
  74. package/dist/browser/types.js +2 -0
  75. package/dist/browser/types.js.map +1 -0
  76. package/dist/cli.d.ts +8 -0
  77. package/dist/cli.js +2411 -0
  78. package/dist/cli.js.map +1 -0
  79. package/dist/domain/boundedAgentContext.d.ts +226 -0
  80. package/dist/domain/boundedAgentContext.js +355 -0
  81. package/dist/domain/boundedAgentContext.js.map +1 -0
  82. package/dist/domain/boundedAgentContextCorrelation.d.ts +74 -0
  83. package/dist/domain/boundedAgentContextCorrelation.js +441 -0
  84. package/dist/domain/boundedAgentContextCorrelation.js.map +1 -0
  85. package/dist/domain/boundedAgentContextIdentity.d.ts +26 -0
  86. package/dist/domain/boundedAgentContextIdentity.js +69 -0
  87. package/dist/domain/boundedAgentContextIdentity.js.map +1 -0
  88. package/dist/domain/boundedAgentContextProjection.d.ts +71 -0
  89. package/dist/domain/boundedAgentContextProjection.js +477 -0
  90. package/dist/domain/boundedAgentContextProjection.js.map +1 -0
  91. package/dist/domain/comparison.d.ts +220 -0
  92. package/dist/domain/comparison.js +350 -0
  93. package/dist/domain/comparison.js.map +1 -0
  94. package/dist/domain/comparisonEngine.d.ts +76 -0
  95. package/dist/domain/comparisonEngine.js +734 -0
  96. package/dist/domain/comparisonEngine.js.map +1 -0
  97. package/dist/domain/comparisonIdentity.d.ts +13 -0
  98. package/dist/domain/comparisonIdentity.js +46 -0
  99. package/dist/domain/comparisonIdentity.js.map +1 -0
  100. package/dist/domain/completion.d.ts +30 -0
  101. package/dist/domain/completion.js +22 -0
  102. package/dist/domain/completion.js.map +1 -0
  103. package/dist/domain/diagnostics.d.ts +17 -0
  104. package/dist/domain/diagnostics.js +77 -0
  105. package/dist/domain/diagnostics.js.map +1 -0
  106. package/dist/domain/evidence.d.ts +29 -0
  107. package/dist/domain/evidence.js +59 -0
  108. package/dist/domain/evidence.js.map +1 -0
  109. package/dist/domain/explicitState.d.ts +40 -0
  110. package/dist/domain/explicitState.js +54 -0
  111. package/dist/domain/explicitState.js.map +1 -0
  112. package/dist/domain/externalReference.d.ts +158 -0
  113. package/dist/domain/externalReference.js +167 -0
  114. package/dist/domain/externalReference.js.map +1 -0
  115. package/dist/domain/externalReferenceApplicability.d.ts +43 -0
  116. package/dist/domain/externalReferenceApplicability.js +52 -0
  117. package/dist/domain/externalReferenceApplicability.js.map +1 -0
  118. package/dist/domain/externalReferenceCompatibility.d.ts +40 -0
  119. package/dist/domain/externalReferenceCompatibility.js +48 -0
  120. package/dist/domain/externalReferenceCompatibility.js.map +1 -0
  121. package/dist/domain/externalReferenceFidelity.d.ts +171 -0
  122. package/dist/domain/externalReferenceFidelity.js +419 -0
  123. package/dist/domain/externalReferenceFidelity.js.map +1 -0
  124. package/dist/domain/externalReferenceIdentity.d.ts +38 -0
  125. package/dist/domain/externalReferenceIdentity.js +70 -0
  126. package/dist/domain/externalReferenceIdentity.js.map +1 -0
  127. package/dist/domain/externalReferenceImage.d.ts +35 -0
  128. package/dist/domain/externalReferenceImage.js +160 -0
  129. package/dist/domain/externalReferenceImage.js.map +1 -0
  130. package/dist/domain/externalReferenceRegionRelationships.d.ts +63 -0
  131. package/dist/domain/externalReferenceRegionRelationships.js +98 -0
  132. package/dist/domain/externalReferenceRegionRelationships.js.map +1 -0
  133. package/dist/domain/externalReferenceRegions.d.ts +65 -0
  134. package/dist/domain/externalReferenceRegions.js +105 -0
  135. package/dist/domain/externalReferenceRegions.js.map +1 -0
  136. package/dist/domain/externalReferenceRequirementIdentity.d.ts +12 -0
  137. package/dist/domain/externalReferenceRequirementIdentity.js +35 -0
  138. package/dist/domain/externalReferenceRequirementIdentity.js.map +1 -0
  139. package/dist/domain/externalReferenceRequirements.d.ts +215 -0
  140. package/dist/domain/externalReferenceRequirements.js +401 -0
  141. package/dist/domain/externalReferenceRequirements.js.map +1 -0
  142. package/dist/domain/externalReferenceRuntimeBinding.d.ts +146 -0
  143. package/dist/domain/externalReferenceRuntimeBinding.js +183 -0
  144. package/dist/domain/externalReferenceRuntimeBinding.js.map +1 -0
  145. package/dist/domain/frontendContractEvaluation.d.ts +57 -0
  146. package/dist/domain/frontendContractEvaluation.js +454 -0
  147. package/dist/domain/frontendContractEvaluation.js.map +1 -0
  148. package/dist/domain/frontendContractEvaluationArtifact.d.ts +65 -0
  149. package/dist/domain/frontendContractEvaluationArtifact.js +108 -0
  150. package/dist/domain/frontendContractEvaluationArtifact.js.map +1 -0
  151. package/dist/domain/frontendContractIdentity.d.ts +39 -0
  152. package/dist/domain/frontendContractIdentity.js +70 -0
  153. package/dist/domain/frontendContractIdentity.js.map +1 -0
  154. package/dist/domain/frontendContracts.d.ts +188 -0
  155. package/dist/domain/frontendContracts.js +260 -0
  156. package/dist/domain/frontendContracts.js.map +1 -0
  157. package/dist/domain/identity.d.ts +21 -0
  158. package/dist/domain/identity.js +47 -0
  159. package/dist/domain/identity.js.map +1 -0
  160. package/dist/domain/referenceCorrectionIdentity.d.ts +40 -0
  161. package/dist/domain/referenceCorrectionIdentity.js +77 -0
  162. package/dist/domain/referenceCorrectionIdentity.js.map +1 -0
  163. package/dist/domain/referenceCorrectionWorkflow.d.ts +160 -0
  164. package/dist/domain/referenceCorrectionWorkflow.js +165 -0
  165. package/dist/domain/referenceCorrectionWorkflow.js.map +1 -0
  166. package/dist/domain/referenceFidelityProjection.d.ts +65 -0
  167. package/dist/domain/referenceFidelityProjection.js +135 -0
  168. package/dist/domain/referenceFidelityProjection.js.map +1 -0
  169. package/dist/domain/relationships.d.ts +210 -0
  170. package/dist/domain/relationships.js +352 -0
  171. package/dist/domain/relationships.js.map +1 -0
  172. package/dist/domain/schema.d.ts +269 -0
  173. package/dist/domain/schema.js +442 -0
  174. package/dist/domain/schema.js.map +1 -0
  175. package/dist/domain/scrollEvidence.d.ts +51 -0
  176. package/dist/domain/scrollEvidence.js +134 -0
  177. package/dist/domain/scrollEvidence.js.map +1 -0
  178. package/dist/index.d.ts +114 -0
  179. package/dist/index.js +64 -0
  180. package/dist/index.js.map +1 -0
  181. package/dist/projectWorkflow/aliasCatalog.d.ts +21 -0
  182. package/dist/projectWorkflow/aliasCatalog.js +67 -0
  183. package/dist/projectWorkflow/aliasCatalog.js.map +1 -0
  184. package/dist/projectWorkflow/checkAcceptance.d.ts +25 -0
  185. package/dist/projectWorkflow/checkAcceptance.js +55 -0
  186. package/dist/projectWorkflow/checkAcceptance.js.map +1 -0
  187. package/dist/projectWorkflow/checkResult.d.ts +85 -0
  188. package/dist/projectWorkflow/checkResult.js +101 -0
  189. package/dist/projectWorkflow/checkResult.js.map +1 -0
  190. package/dist/projectWorkflow/projectConfig.d.ts +43 -0
  191. package/dist/projectWorkflow/projectConfig.js +84 -0
  192. package/dist/projectWorkflow/projectConfig.js.map +1 -0
  193. package/dist/projectWorkflow/projectDiscovery.d.ts +9 -0
  194. package/dist/projectWorkflow/projectDiscovery.js +20 -0
  195. package/dist/projectWorkflow/projectDiscovery.js.map +1 -0
  196. package/dist/projectWorkflow/projectPaths.d.ts +8 -0
  197. package/dist/projectWorkflow/projectPaths.js +23 -0
  198. package/dist/projectWorkflow/projectPaths.js.map +1 -0
  199. package/dist/request/paths.d.ts +14 -0
  200. package/dist/request/paths.js +33 -0
  201. package/dist/request/paths.js.map +1 -0
  202. package/dist/request/request.d.ts +111 -0
  203. package/dist/request/request.js +464 -0
  204. package/dist/request/request.js.map +1 -0
  205. package/dist/safety/policy.d.ts +14 -0
  206. package/dist/safety/policy.js +81 -0
  207. package/dist/safety/policy.js.map +1 -0
  208. package/dist/viewer/assets/index-CN_yb9Uf.css +1 -0
  209. package/dist/viewer/assets/index-D98S1_2d.js +9 -0
  210. package/dist/viewer/icons/icon-192.png +0 -0
  211. package/dist/viewer/icons/icon-512.png +0 -0
  212. package/dist/viewer/index.html +15 -0
  213. package/dist/viewer/manifest.webmanifest +1 -0
  214. package/dist/viewer/registerSW.js +1 -0
  215. package/dist/viewer/sw.js +1 -0
  216. package/dist/viewer/workbox-9c191d2f.js +1 -0
  217. package/dist/viewerServer/context.d.ts +48 -0
  218. package/dist/viewerServer/context.js +60 -0
  219. package/dist/viewerServer/context.js.map +1 -0
  220. package/dist/viewerServer/evidence/classify.d.ts +59 -0
  221. package/dist/viewerServer/evidence/classify.js +124 -0
  222. package/dist/viewerServer/evidence/classify.js.map +1 -0
  223. package/dist/viewerServer/evidence/comparisonView.d.ts +28 -0
  224. package/dist/viewerServer/evidence/comparisonView.js +43 -0
  225. package/dist/viewerServer/evidence/comparisonView.js.map +1 -0
  226. package/dist/viewerServer/evidence/contextSourceView.d.ts +25 -0
  227. package/dist/viewerServer/evidence/contextSourceView.js +20 -0
  228. package/dist/viewerServer/evidence/contextSourceView.js.map +1 -0
  229. package/dist/viewerServer/evidence/discovery.d.ts +31 -0
  230. package/dist/viewerServer/evidence/discovery.js +78 -0
  231. package/dist/viewerServer/evidence/discovery.js.map +1 -0
  232. package/dist/viewerServer/evidence/evaluationView.d.ts +32 -0
  233. package/dist/viewerServer/evidence/evaluationView.js +50 -0
  234. package/dist/viewerServer/evidence/evaluationView.js.map +1 -0
  235. package/dist/viewerServer/evidence/handles.d.ts +21 -0
  236. package/dist/viewerServer/evidence/handles.js +43 -0
  237. package/dist/viewerServer/evidence/handles.js.map +1 -0
  238. package/dist/viewerServer/evidence/index.d.ts +41 -0
  239. package/dist/viewerServer/evidence/index.js +82 -0
  240. package/dist/viewerServer/evidence/index.js.map +1 -0
  241. package/dist/viewerServer/evidence/limits.d.ts +27 -0
  242. package/dist/viewerServer/evidence/limits.js +28 -0
  243. package/dist/viewerServer/evidence/limits.js.map +1 -0
  244. package/dist/viewerServer/evidence/linkedEvidence.d.ts +43 -0
  245. package/dist/viewerServer/evidence/linkedEvidence.js +151 -0
  246. package/dist/viewerServer/evidence/linkedEvidence.js.map +1 -0
  247. package/dist/viewerServer/evidence/mediaResolver.d.ts +16 -0
  248. package/dist/viewerServer/evidence/mediaResolver.js +85 -0
  249. package/dist/viewerServer/evidence/mediaResolver.js.map +1 -0
  250. package/dist/viewerServer/evidence/observationView.d.ts +29 -0
  251. package/dist/viewerServer/evidence/observationView.js +46 -0
  252. package/dist/viewerServer/evidence/observationView.js.map +1 -0
  253. package/dist/viewerServer/evidence/pathSafety.d.ts +11 -0
  254. package/dist/viewerServer/evidence/pathSafety.js +31 -0
  255. package/dist/viewerServer/evidence/pathSafety.js.map +1 -0
  256. package/dist/viewerServer/evidence/projection.d.ts +55 -0
  257. package/dist/viewerServer/evidence/projection.js +152 -0
  258. package/dist/viewerServer/evidence/projection.js.map +1 -0
  259. package/dist/viewerServer/evidence/referenceView.d.ts +133 -0
  260. package/dist/viewerServer/evidence/referenceView.js +169 -0
  261. package/dist/viewerServer/evidence/referenceView.js.map +1 -0
  262. package/dist/viewerServer/httpServer.d.ts +27 -0
  263. package/dist/viewerServer/httpServer.js +381 -0
  264. package/dist/viewerServer/httpServer.js.map +1 -0
  265. package/dist/viewerServer/openBrowser.d.ts +7 -0
  266. package/dist/viewerServer/openBrowser.js +32 -0
  267. package/dist/viewerServer/openBrowser.js.map +1 -0
  268. package/dist/viewerServer/port.d.ts +16 -0
  269. package/dist/viewerServer/port.js +19 -0
  270. package/dist/viewerServer/port.js.map +1 -0
  271. package/dist/viewerServer/viewerService.d.ts +62 -0
  272. package/dist/viewerServer/viewerService.js +88 -0
  273. package/dist/viewerServer/viewerService.js.map +1 -0
  274. package/docs/ARCHITECTURE.md +1286 -0
  275. package/docs/CI_CD.md +250 -0
  276. package/docs/COMMANDS.md +972 -0
  277. package/docs/CONTRACTS.md +1856 -0
  278. package/docs/CURRENT_STATE.md +1049 -0
  279. package/docs/DEVELOPMENT.md +202 -0
  280. package/docs/DOCUMENTATION_PRESERVATION_POLICY.md +50 -0
  281. package/docs/PROJECT_DESCRIPTION.md +2221 -0
  282. package/docs/PROJECT_MILESTONES.md +2526 -0
  283. package/docs/PROJECT_OVERVIEW.md +150 -0
  284. package/docs/QUICKSTART.md +83 -0
  285. package/docs/RELEASE.md +27 -0
  286. package/docs/ROADMAP.md +641 -0
  287. package/docs/SECURITY.md +218 -0
  288. package/docs/WORKFLOWS.md +642 -0
  289. package/docs/plans/v0.8-implementation-plan.md +655 -0
  290. package/docs/plans/v0.8.1-cli-usability-patch-plan.md +505 -0
  291. package/docs/reports/v0.7-bounded-fidelity-context-prompt7.md +243 -0
  292. package/docs/reports/v0.7-implementation-completeness-documentation-reconciliation.md +497 -0
  293. package/docs/reports/v0.7-pre-release-readiness.md +337 -0
  294. package/docs/reports/v0.7-reference-binding-prompt5.md +223 -0
  295. package/docs/reports/v0.7-reference-compatibility-prompt4.md +234 -0
  296. package/docs/reports/v0.7-reference-correction-workflow-prompt8.md +222 -0
  297. package/docs/reports/v0.7-reference-fidelity-prompt6.md +216 -0
  298. package/docs/reports/v0.7-reference-foundation-prompt1.md +151 -0
  299. package/docs/reports/v0.7-reference-regions-prompt2.md +195 -0
  300. package/docs/reports/v0.7-reference-requirements-prompt3.md +217 -0
  301. package/docs/reports/v0.7-release-prep.md +423 -0
  302. package/docs/reports/v0.8-binding-fidelity-interaction-batch6.md +279 -0
  303. package/docs/reports/v0.8-bounded-context-correlation-batch7.md +233 -0
  304. package/docs/reports/v0.8-comparison-contract-inspection-batch4.md +279 -0
  305. package/docs/reports/v0.8-evidence-index-readers-batch2.md +247 -0
  306. package/docs/reports/v0.8-implementation-completeness-documentation-reconciliation.md +741 -0
  307. package/docs/reports/v0.8-integrated-viewer-acceptance-batch8.md +128 -0
  308. package/docs/reports/v0.8-observation-svg-inspection-batch3.md +223 -0
  309. package/docs/reports/v0.8-prerelease-readiness-cross-platform-security-code-rot.md +687 -0
  310. package/docs/reports/v0.8-reference-candidate-inspection-batch5.md +232 -0
  311. package/docs/reports/v0.8-viewer-runtime-pwa-batch1.md +278 -0
  312. package/docs/reports/v0.8.1-check-orchestration-prompt2.md +69 -0
  313. package/docs/reports/v0.8.1-implementation-completeness-documentation-reconciliation.md +114 -0
  314. package/docs/reports/v0.8.1-prerelease-readiness-cross-platform-security-code-rot.md +170 -0
  315. package/docs/reports/v0.8.1-project-workflow-foundation-prompt1.md +66 -0
  316. package/package.json +58 -0
@@ -0,0 +1,216 @@
1
+ # v0.7 Prompt 6 — Structured Reference-vs-Candidate Fidelity Evaluation
2
+
3
+ **VERDICT: PASS_V0_7_REFERENCE_FIDELITY_PROMPT6**
4
+
5
+ ## Repository / branch / heads
6
+
7
+ - Repository: `my-frontend-observer` (path: `Z:\Users\newuser\Projects\my-frontend-observer`)
8
+ - Branch: `implementation/v0.7-reference-fidelity`, branched from the exact completed Prompt 5 HEAD
9
+ - Starting HEAD (branch point, Prompt 5 report commit): `74c710daa62cd5a56f1b1b2eac3a43d24dfe69fb`
10
+ - Prompt 5 base HEAD confirmed to contain both required commits: `74cc148` (implementation) and `74c710d` (report), and the full completed Prompt 1–4 lineage — verified via `git log --oneline` before branching.
11
+ - Implementation commit (this prompt): `91f5e736a1a8472984b0c8c7a7e179e307f1a5ce` — "Add v0.7 Prompt 6 structured reference-vs-candidate fidelity evaluation"
12
+ - Ending HEAD: the report commit that follows this file's commit.
13
+
14
+ ## Git status
15
+
16
+ Preflight (`git status --short`) showed a clean working tree at the exact Prompt 5 report HEAD; `git stash list` showed exactly the one preserved Prompt 1 stray-fork-writes entry. The branch was created with `git checkout -b implementation/v0.7-reference-fidelity` and ancestry verified with `git merge-base --is-ancestor 74c710d HEAD`. No reset/clean/discard operation was used; the Prompt 1 stash was neither applied nor dropped. Post-implementation `git status --short` is clean except for this report file (staged and committed separately, per convention).
17
+
18
+ ## Tooling
19
+
20
+ - Resolved latest published `@dailephd/my-dev-kit`: `1.12.3`, pinned exactly via `npx -y @dailephd/my-dev-kit@1.12.3`.
21
+ - Fresh Prompt 6 repository index built under a repository-local, gitignored root: `.my-dev-kit-context/index-prompt6/` (57 files, 868 symbols indexed) — not reused from Prompt 1–5's indexes.
22
+
23
+ ## Prompt 1–5 contracts verified
24
+
25
+ Read directly (source, not memory) before writing any code:
26
+
27
+ - `src/domain/externalReferenceRequirements.ts` — the full Prompt 3 requirement/tolerance/expectation/adequacy model, including the exact `RELATIONSHIP_FAMILY_GROUPS`-scoped lookup fix and `deriveReferenceRequirementAdequacy`'s "100% unavailable requirements ⇒ inadequate" rule.
28
+ - `src/domain/externalReferenceRegions.ts` — `ReferenceRegionGeometry`'s exact field set (`x`/`y`/`width`/`height`/`right`/`bottom`/`centerX`/`centerY`), reused as the shared shape for both reference and (converted) candidate geometry.
29
+ - `src/domain/externalReference.ts` — `isImportedExternalReferenceArtifact`/`isApprovedExternalReferenceArtifact` type guards, reused to read image dimensions uniformly across both lifecycle variants without duplicating validation logic.
30
+ - `src/domain/externalReferenceCompatibility.ts` (Prompt 4) — `evaluateReferenceCandidateCompatibility`'s exact signature and result shape, reused verbatim as the compatibility gate.
31
+ - `src/domain/externalReferenceRuntimeBinding.ts` (Prompt 5) — `evaluateReferenceRuntimeBindings`'s exact signature/result shape and its own case-insensitive target-name-resolution convention (mirrored, not imported, per the established per-module small-helper convention).
32
+ - `src/domain/schema.ts` (v0.2) — `TargetGeometry`, `TargetVisibility`, `TargetResolution`/`TargetSelectionStatus`, and `ObservationArtifact.targetEvidence`'s exact-configured-name keying.
33
+ - `src/domain/comparisonEngine.ts` (v0.4) — `targetPresence` (already additively exported by Prompt 5), reused rather than re-derived.
34
+ - `src/domain/relationships.ts` (v0.4) — `deriveLayoutRelationships`, `PairwiseLayoutRelationship`'s `subjectTarget`/`relatedTarget` fields, `UnresolvedRelationshipTarget`/`UNRESOLVED_TARGET_REASONS` (confirming hidden targets are already excluded from relationship derivation by v0.4 itself), and every pairwise relationship-family constant.
35
+ - `src/domain/frontendContracts.ts`/`frontendContractEvaluation.ts` (v0.5) — `CLAUSE_RESULT_STATUSES`/`ClauseEvaluationResult` (the `pass`/`fail`/`unavailable`/`conflict` precedent), `evaluateFrontendContract`'s overall-verdict aggregation rule (`every clause pass && no unexpected changes ⇒ PASS`), `clauseMode`'s `required`/`permitted` handling (confirming it is a v0.5-only, directional-primitive-specific concept never mirrored in Prompt 3's own expectation/adequacy derivation), and `toleranceToPx`'s percent-denominator convention (`(amount/100) * abs(beforeValue)`), reused independently for reference-image-pixel units.
36
+ - `src/application/comparisonService.ts` — the exact `compareAndPersistFromArtifactRoots` application-layer shape (read-both-artifacts-then-delegate-to-the-pure-function), mirrored for `evaluateReferenceCandidateFidelityFromArtifactRoots`.
37
+ - `src/cli.ts` — the full `evaluate-contract` command (help text, argument parser, `--enforce` exit-code handling) as the direct precedent for `evaluate-reference-fidelity`, and every existing `--*-file` loader (`loadRegionsFile`/`loadRequirementsFile`/`loadApplicabilityFile`) as the precedent for `loadBindingsFile`.
38
+
39
+ No architecture blocker was hit; no `BLOCKED_ESCALATE_TO_FULL_STAGE_CONTEXT` condition applied at any point.
40
+
41
+ ## Precedent review outcomes
42
+
43
+ - **A. Result vocabulary** — `pass`/`fail`/`unavailable` reused as the same honest three-state shape v0.5's `CLAUSE_RESULT_STATUSES` already established, but as an independently-owned constant (`REFERENCE_REQUIREMENT_FIDELITY_STATUSES`) deliberately excluding `'conflict'` — Prompt 6 has no cross-requirement authoring-conflict concept (each requirement is evaluated independently against its own subject).
44
+ - **B. Overall fidelity** — a compatible/evaluable pair reaches `state: 'pass'` only when every requirement result is `'pass'`; any `'fail'`/`'unavailable'` forces `'fail'`. An incompatible or reference-inadequate pair never reaches that computation at all — a distinct `not-evaluated` state, with `blockedBy: 'reference-inadequate' | 'incompatible'`, is returned instead.
45
+ - **C. Relationship evaluation** — reuses Prompt 2's `deriveReferenceRequirementExpectation` (reference side) and v0.4's `deriveLayoutRelationships` (candidate side) exactly; no duplicated geometry predicate exists anywhere in the new module.
46
+ - **D. Value derivation** — reference expected values always come from `deriveReferenceRequirementExpectation`/`deriveReferenceRequirementMeasurement` (Prompt 3), never recomputed by hand; candidate values always come from `ObservationArtifact.targetEvidence`'s existing `TargetGeometry`/`TargetVisibility` evidence, never a second derivation.
47
+ - **E. Persistence** — no new persisted artifact family; documented decision below.
48
+
49
+ ## Fidelity evaluator type/function names
50
+
51
+ - `domain/externalReferenceFidelity.ts`: `evaluateReferenceCandidateFidelity(reference, candidate, bindingDeclarations, options?)` → `{ ok: true; evaluation: ReferenceCandidateFidelityEvaluation } | { ok: false; reason: string }`.
52
+ - `application/referenceFidelityEvaluationService.ts`: `evaluateReferenceCandidateFidelityFromArtifactRoots(referenceRoot, candidateRoot, bindingDeclarations, options?)` — the CLI-facing, artifact-root-reading counterpart.
53
+ - CLI: `evaluate-reference-fidelity`.
54
+
55
+ ## Evaluation ordering / gates
56
+
57
+ Frozen order, exactly as specified and never reordered: reference structural validation (`isValidExternalReferenceArtifact`) → candidate structural validation (`isValidObservationArtifact`) → binding-declaration structural validation (`isValidReferenceRuntimeBindingDeclarations`, invoked inside the Prompt 5 evaluator) → Prompt 3 reference adequacy (`deriveReferenceRequirementAdequacy`) → Prompt 4 compatibility (`evaluateReferenceCandidateCompatibility`) → Prompt 5 binding evaluation (`evaluateReferenceRuntimeBindings`) → per-requirement candidate-evidence/coordinate-mapping checks → per-requirement tolerance/relationship comparison → overall result.
58
+
59
+ The first three (structural) failures return `{ ok: false, reason }` — a caller/config error, never a fidelity outcome. `adequacy.status === 'inadequate'` and `compatibility.state === 'incomparable'` each short-circuit to `state: 'not-evaluated'` with `requirementResults: []` — verified by dedicated tests (behaviors G/H). `adequacy.status === 'partial'` does **not** block evaluation; it proceeds normally, and the specific reference-side-unavailable requirements independently re-derive their own `unavailable` result at the per-requirement stage (not looked up from the adequacy result — verified by the "reference itself does not exhibit" test, which requires a second, evaluable requirement to keep adequacy at `partial` rather than `inadequate`, confirming the two computations are genuinely independent).
60
+
61
+ ## Coordinate-mapping model
62
+
63
+ One explicit, deterministic full-frame scale: `scaleX = referenceImageWidth / applicableViewportWidth`, `scaleY = referenceImageHeight / applicableViewportHeight`, derived once per evaluation call from `reference.applicability.viewport` (Prompt 4) and the reference image's own pixel dimensions (Prompt 1, read uniformly across both lifecycle variants via the existing `isImportedExternalReferenceArtifact`/`isApprovedExternalReferenceArtifact` type guards). Candidate `TargetGeometry` (CSS pixels) is reshaped into a `ReferenceRegionGeometry`-shaped value (adding `centerX`/`centerY`, computed identically to `deriveReferenceRegionGeometry`) both raw and scaled; horizontal fields (`x`/`width`/`right`/`centerX`) always scale by `scaleX`, vertical fields (`y`/`height`/`bottom`/`centerY`) always scale by `scaleY` — this falls out automatically from the per-field conversion, never a hand-picked per-property axis table. `region-measurement` subjects reuse Prompt 3's exact `deriveReferenceRequirementMeasurement` on the converted geometries directly, rather than a parallel "runtime version" of the same gap/delta formulas.
64
+
65
+ ## Image/viewport scale rule and aspect-ratio rule
66
+
67
+ `ASPECT_RATIO_MAPPING_TOLERANCE = 0.01` (1% relative difference between `scaleX` and `scaleY`) is an independently-owned, tiny coordinate-mapping-validity constant — never a user-authored Prompt 3 design tolerance. If `scaleX`/`scaleY` disagree beyond this bound, or `reference.applicability.viewport` is absent entirely, `deriveCoordinateScale` returns `{ ok: false, reason }` and every numeric (`region-property`/`region-measurement`) requirement in that evaluation becomes `unavailable`/`coordinate-mapping-unavailable` — verified by dedicated tests (behaviors E and F). No cropping, offset, rotation, or perspective registration is implemented anywhere; only this single bounded full-frame check. Categorical `region-relationship` requirements are unaffected by an unavailable scale (they never call `deriveCoordinateScale` at all).
68
+
69
+ ## Numeric precision rule
70
+
71
+ No intermediate rounding anywhere in the arithmetic path (`referenceValue`, `candidateRawValue`, `candidateValue`, `delta` are all plain JS `number`s carried through at full floating-point precision). Tolerance comparison is a single `Math.abs(delta) <= allowed` check with no added epsilon — verified by the exact-boundary test (a delta equal to the tolerance passes; a delta a tiny fraction over it fails), matching the task's own worked boundary example (428 passes, 428.0001 fails against a reference of 424 ± 4).
72
+
73
+ ## Requirement result vocabulary
74
+
75
+ `REFERENCE_REQUIREMENT_FIDELITY_STATUSES = ['pass', 'fail', 'unavailable']`. `reasonCode` (one of `reference-evidence-unavailable`, `reference-relationship-not-exhibited`, `binding-unavailable`, `candidate-evidence-unavailable`, `coordinate-mapping-unavailable`) and `detail` are present only when `status === 'unavailable'` — a `fail` is already fully explained by its numeric (`referenceValue`/`candidateRawValue`/`candidateValue`/`delta`/`tolerance`) or relationship (`expectedRelationship`/`actualRelationship`) fields, so no reason code is needed there.
76
+
77
+ ## Overall fidelity vocabulary
78
+
79
+ `REFERENCE_FIDELITY_STATES = ['not-evaluated', 'pass', 'fail']`, with `REFERENCE_FIDELITY_BLOCK_REASONS = ['reference-inadequate', 'incompatible']` populated only when `state === 'not-evaluated'`. There is no separate "partial pass" bucket once evaluation has actually run: any `unavailable` requirement result forces `state: 'fail'`, satisfying "any required fail or unavailable must prevent overall PASS" (section 34) without inventing a fourth top-level state — an `unavailable`-only result set is honestly reported as `'fail'` (i.e. "not confirmed to satisfy every selected requirement"), which the report's per-requirement breakdown (`pass`/`fail`/`unavailable` counts) then disambiguates for a human/caller.
80
+
81
+ ## Region-property evaluation
82
+
83
+ Reads the bound target's `TargetGeometry` from `targetEvidence`, requires `TargetVisibility.visible === true` (a `bound`-but-hidden target's geometry is treated as unusable, never fabricated as meaningful — see "hidden target" below), converts to both raw and reference-space geometry, and reads `[subject.property]` off each. Exactly Prompt 3's supported vocabulary (`x`/`y`/`width`/`height`/`right`/`bottom`/`centerX`/`centerY`) — no new property was added.
84
+
85
+ ## Relationship evaluation
86
+
87
+ Confirms the reference itself exhibits its own selected relationship first (`deriveReferenceRequirementExpectation`'s `matches` field) — if not, `unavailable`/`reference-relationship-not-exhibited` (a reference-authoring problem, never a candidate `fail`). Then resolves both bound targets, calls `deriveLayoutRelationships` once over the whole candidate observation, and looks up the pairwise record for the bound-target pair **scoped to the exact requested relationship family** via an independently-owned, third duplicate of the `RELATIONSHIP_FAMILY_GROUPS` shape (already duplicated by `frontendContractEvaluation.ts` and `externalReferenceRequirements.ts`) — never "the first record for this pair regardless of family," the exact bug class Prompt 3 fixed. A record only derivable in the reversed target order is `unavailable`, never auto-flipped, mirroring Prompt 3's identical reference-side handling. Verified by dedicated tests for pass (M), fail (N), and family-scoping (O, using two regions/targets that simultaneously satisfy multiple relationship families to prove the lookup picks the correct family's record).
88
+
89
+ ## Spacing/alignment (measurement) evaluation
90
+
91
+ Supported: exactly Prompt 3's `REFERENCE_REQUIREMENT_MEASUREMENTS` (`vertical-gap`/`horizontal-gap`/`center-x-delta`/`center-y-delta`/`left-edge-delta`/`right-edge-delta`), evaluated via `deriveReferenceRequirementMeasurement` on converted (both raw and reference-space) geometries — no generic geometry expression language was introduced. A geometrically-undefined gap (targets overlapping on the relevant axis) is `unavailable`, mirroring Prompt 3's reference-side treatment of the identical situation. Verified by a dedicated horizontal-gap pass/fail test (behavior P).
92
+
93
+ ## Tolerance behavior
94
+
95
+ Reused exactly, never redefined. A single rule, `Math.abs(delta) <= allowed`, covers all three Prompt 3 kinds: `exact` ⇒ `allowed = 0`; `absolute-reference-px` ⇒ `allowed = tolerance.amount` (already in reference-image pixels); `percent` ⇒ `allowed = (tolerance.amount / 100) * Math.abs(referenceValue)`, mirroring v0.5's own `toleranceToPx` "may vary by up to N%" convention exactly, independently reimplemented in reference-image-pixel units (never imported — v0.5's `ContractTolerance` is a different, CSS-pixel-implicit unit). Verified by dedicated tests for `exact`, `absolute-reference-px`, `percent`, and the exact tolerance boundary (behavior C, plus the task's own worked example reproduced verbatim in both the domain and CLI test suites).
96
+
97
+ ## Unavailable-evidence behavior
98
+
99
+ Unavailable evidence never becomes a fabricated zero/false/pass/fail anywhere in this module: an unbound/ambiguous/unavailable Prompt 5 binding, an invisible or evidence-less bound target, an unestablishable coordinate scale, and an undervied/not-exhibited reference relationship are each their own explicit `unavailable` result with a distinguishing `reasonCode` — never silently defaulted, never a `fail`.
100
+
101
+ ## Compatibility-blocker behavior
102
+
103
+ `evaluateReferenceCandidateCompatibility` is called once; `state === 'incomparable'` short-circuits the whole evaluation to `state: 'not-evaluated'`, `blockedBy: 'incompatible'`, `requirementResults: []`, with the full `ComparabilityResult` embedded verbatim in the `compatibility` field for the caller to inspect the reason. No geometry delta, spacing delta, relationship comparison, or requirement PASS/FAIL is ever computed in this case. Verified by a dedicated test (behavior G, an incompatible candidate viewport).
104
+
105
+ ## Binding-blocker behavior
106
+
107
+ `evaluateReferenceRuntimeBindings` is called once (after the compatibility gate has already confirmed a non-incomparable pair, so it is guaranteed not to re-trigger its own internal compatibility short-circuit); its `ok: false` result (a structural declaration/artifact problem) propagates as this function's own `ok: false`. For each requirement, every dependent reference region's binding must be `bound` — `ambiguous`, `unavailable`, or simply absent from the supplied declarations all produce `unavailable`/`binding-unavailable` for that requirement, never a guessed target and never an auto-bind based on geometry or names. Verified by dedicated tests for ambiguous (J), unavailable/not-found (K), and undeclared bindings.
108
+
109
+ ## Hidden-target decision
110
+
111
+ A `bound` target (Prompt 5's question: does a stable correspondence exist) whose `TargetVisibility.visible !== true` — including when visibility evidence itself is unavailable — is treated as having no usable geometry: `unavailable`/`candidate-evidence-unavailable`, never a fabricated zero-geometry comparison. This preserves the documented distinction between binding success and fidelity evaluability. Verified by a dedicated test (behavior L).
112
+
113
+ ## Persistence decision
114
+
115
+ **No new persisted artifact family.** `evaluateReferenceCandidateFidelity` (and its CLI-facing wrapper) is a pure, on-demand function over already-persisted/in-memory evidence — no `ExternalReferenceFidelityEvaluationArtifact` or equivalent was introduced. Rationale, identical to Prompt 4/5's own precedent: the result is cheap to recompute deterministically from its inputs, and persisting it would invite drift (a re-imported reference, re-observed candidate, or edited binding declaration could silently disagree with a stale persisted record) with no corresponding benefit at this stage. `--enforce`'s exit-code-only effect (mirroring `evaluate-contract` exactly) was judged sufficient CLI-side signal without persistence. This may be revisited only if Prompt 7's architecture (bounded visual-fidelity mismatch projection, v0.6 bounded-agent-context integration) proves persistence necessary — not assumed here, and no `BLOCKED_ESCALATE_TO_FULL_STAGE_CONTEXT` condition was triggered by this decision since the existing CLI could return a fully structured result without it.
116
+
117
+ ## Programmatic interface
118
+
119
+ Exported from `src/index.ts` (additive): types `ReferenceRequirementFidelityStatus`, `ReferenceRequirementFidelityReasonCode`, `ReferenceRequirementFidelityResult`, `ReferenceFidelityState`, `ReferenceFidelityBlockReason`, `ReferenceCandidateFidelityEvaluation`, `EvaluateReferenceCandidateFidelityResult`, `EvaluateReferenceCandidateFidelityOptions`, `EvaluateReferenceFidelityOptions`, `ApplicationReferenceFidelityResult`; values `REFERENCE_REQUIREMENT_FIDELITY_STATUSES`, `REFERENCE_REQUIREMENT_FIDELITY_REASON_CODES`, `REFERENCE_FIDELITY_STATES`, `REFERENCE_FIDELITY_BLOCK_REASONS`, `evaluateReferenceCandidateFidelity`, `evaluateReferenceCandidateFidelityFromArtifactRoots`. No internal helper (`evaluateOneRequirement`, `deriveCoordinateScale`, `resolveConfiguredTargetName`, etc.) is exported.
120
+
121
+ ## CLI surface
122
+
123
+ New command: `evaluate-reference-fidelity --reference <root> --candidate <root> [--bindings-file <json-file>] [--enforce]`. `--bindings-file` follows the exact `--requirements-file`/`--regions-file` wrapped-object convention (`{ "bindings": [...] }`, root-field allowlist enforced, unwrapped content handed straight to the domain validator). CLI code (`parseEvaluateReferenceFidelityArgs`, `loadBindingsFile`, `runEvaluateReferenceFidelityCommand`) owns only flag syntax, duplicate/missing-flag detection, file reading, JSON parsing, root-shape validation, output presentation, and exit-code selection — every semantic rule (adequacy, compatibility, binding, coordinate mapping, tolerance, relationship) stays owned by the domain module, and `evaluateReferenceCandidateFidelityFromArtifactRoots` owns artifact-root reading/orchestration. `TOP_LEVEL_HELP` and `runCli`'s dispatch table were updated; `cli.ts`'s existing "no browser/persistence implementation of its own" regression test (`B5-TST-008,009`) continues to pass unchanged, confirming the new command imports neither `artifacts/` nor a filesystem-write function.
124
+
125
+ ## CLI exit behavior
126
+
127
+ Mirrors `evaluate-contract`'s exact precedent: `--enforce` is applied only after the fidelity evaluation has already been computed, and affects only the process exit status for an already-final `state: 'fail'` result (never its printed content). `state: 'not-evaluated'` always exits `0` regardless of `--enforce` — a reference-adequacy or compatibility blocker is a successful, honest non-evaluation, never treated as a design mismatch or an execution error. An actual operational failure (invalid syntax, unreadable/malformed `--reference`/`--candidate`, malformed `--bindings-file`, or an invalid binding declaration) always exits nonzero regardless of `--enforce`. Verified end-to-end by three CLI tests reproducing pass/fail/not-evaluated with and without `--enforce`.
128
+
129
+ ## Boundedness
130
+
131
+ Reuses existing bounds without introducing new ones: `reference.requirements` is already bounded to ≤50 (`MAX_REFERENCE_REQUIREMENTS`, Prompt 3) at construction time, so `requirementResults` is bounded identically (1:1 with requirements); `bindingDeclarations` is already bounded to ≤20 (`MAX_REFERENCE_RUNTIME_BINDINGS`, Prompt 5); `deriveLayoutRelationships`'s own `MAX_CONFIGURED_TARGETS_FOR_RELATIONSHIPS`/`MAX_PAIRWISE_RELATIONSHIP_RECORDS` bounds (v0.4) apply unchanged, since it is called exactly once per relationship requirement over the same candidate. No unbounded diff/diagnostic collection is ever produced — Prompt 6 evaluates only explicitly authored Prompt 3 requirements, never "all visible differences."
132
+
133
+ ## Provenance
134
+
135
+ Each `ReferenceRequirementFidelityResult` carries `requirementId`, `category`, `expectedDependentMode` (when present), `subject` (which itself names the reference region(s)/property/relationship/measurement), `boundRuntimeTargets`, and either the numeric (`referenceValue`/`candidateRawValue`/`candidateValue`/`delta`/`tolerance`) or relationship (`expectedRelationship`/`actualRelationship`) evidence that produced its status. The top-level `ReferenceCandidateFidelityEvaluation` additionally carries `referenceId`/`referenceRequestId`/`candidateObservationId`/`candidateRequestId`, the full Prompt 3 `adequacy`, the full Prompt 4 `compatibility` (when computed), and the full Prompt 5 `bindings` evaluation (when computed) — nothing is an unexplained delta.
136
+
137
+ ## Files changed
138
+
139
+ New:
140
+ - `src/domain/externalReferenceFidelity.ts`
141
+ - `src/application/referenceFidelityEvaluationService.ts`
142
+ - `tests/unit/externalReferenceFidelity.test.ts`
143
+ - `tests/unit/cliEvaluateReferenceFidelity.test.ts`
144
+
145
+ Modified:
146
+ - `src/cli.ts` (`evaluate-reference-fidelity` command: help text, argument parser, `loadBindingsFile`, run function, `TOP_LEVEL_HELP`, dispatch table)
147
+ - `src/index.ts` (public export surface for the above)
148
+ - `docs/ARCHITECTURE.md`, `docs/CONTRACTS.md`, `docs/WORKFLOWS.md`, `docs/COMMANDS.md`
149
+
150
+ ## Tests
151
+
152
+ 927 unit tests total (889 pre-existing + 38 new), all pure domain/application/CLI-level tests — zero Chromium launches for fidelity evaluation itself (the one CLI end-to-end test constructs its candidate `ObservationArtifact` by writing a `manifest.json` directly to disk, exactly as `tests/unit/artifactWriter.test.ts` already does for writer-focused tests, never via `observe()`/a real browser).
153
+
154
+ - `tests/unit/externalReferenceFidelity.test.ts` (29 tests): behaviors A–W from the task's own behavior model, including the exact worked example (424 reference px, 223→446 candidate px, delta 22, tolerance ±4, FAIL), the exact tolerance boundary (428 passes, 428.0001 fails), `exact`/`absolute-reference-px`/`percent` tolerance kinds, 2x coordinate scale, aspect-ratio-mismatch and missing-viewport coordinate-mapping unavailability, compatibility/adequacy blockers, bound/ambiguous/unavailable/undeclared bindings, hidden-target unavailability, relationship pass/fail/family-scoping and not-exhibited-by-reference, a supported numeric measurement (horizontal-gap), deterministic ordering and pure-function repeatability, all-pass/one-fail/one-unavailable overall results, zero-requirements inadequacy, full three-input immutability, fail-closed structural validation, absence of source-ownership fields, and a source-scan confirming no browser/filesystem import.
155
+ - `tests/unit/cliEvaluateReferenceFidelity.test.ts` (9 tests): help text, top-level help listing, required-flag errors, missing `--reference`/`--candidate` errors, malformed `--bindings-file` (bad JSON/wrong root shape/unknown field), and three full end-to-end runs (pass, fail, not-evaluated) each checked with and without `--enforce`, reproducing the task's exact worked example through the real CLI/application/domain stack.
156
+
157
+ ## Validation results
158
+
159
+ All commands run from the repository root, after the implementation commit:
160
+
161
+ - `npm run typecheck` — pass, zero errors.
162
+ - `npm run lint` — pass, zero errors/warnings.
163
+ - `npm test` — 48 test files, 927 tests, all pass.
164
+ - `npm run build` — pass, clean `tsc` compile.
165
+ - `npm run check:docs` — pass (17 required files present, `ROADMAP.md` format intact — no implementation batches added).
166
+ - `git diff --check` — exit 0, no whitespace errors.
167
+ - `npm pack --dry-run` — pass; `dist/domain/externalReferenceFidelity.{js,d.ts,js.map}` and `dist/application/referenceFidelityEvaluationService.{js,d.ts,js.map}` confirmed present in the tarball listing.
168
+ - `npm run test:security` — pass (5 + 63 = 68 tests), run because a new CLI/config-file input surface (`--bindings-file`) was added.
169
+ - `npm run test:browser` — pass on re-run (9 files, 120 tests). One transient failure (`v0.2: an ambiguous locator stops immediately...`) occurred on the first full-suite run; re-running that single test in isolation passed immediately, and a full second `test:browser` run passed 120/120 — confirmed environmental flakiness in a real-Chromium timing-sensitive test unrelated to any file this prompt touched (Prompt 6 never imports or modifies `chromiumAdapter.ts`/`evidenceCapture.ts`), not a regression.
170
+
171
+ ## Regression results
172
+
173
+ - Prompt 1 external-reference foundation: unaffected — `externalReference.ts` untouched (only its already-exported type guards were imported).
174
+ - Prompt 2 regions/shared relationships: unaffected — `externalReferenceRegions.ts`/`externalReferenceRegionRelationships.ts` untouched.
175
+ - Prompt 3 requirements/tolerances/adequacy: unaffected — `externalReferenceRequirements.ts` untouched; its exported functions were called, never modified.
176
+ - Prompt 4 compatibility: unaffected — `externalReferenceCompatibility.ts`/`explicitState.ts`/`externalReferenceApplicability.ts` untouched.
177
+ - Prompt 5 binding: unaffected — `externalReferenceRuntimeBinding.ts` untouched.
178
+ - v0.4 comparison/relationship behavior: unaffected — `comparisonEngine.ts`/`relationships.ts` untouched (only already-exported functions were called).
179
+ - v0.5 contracts/evaluation: unaffected — no file in `frontendContracts*.ts` touched.
180
+ - v0.6 bounded context/correlation: unaffected — `boundedAgentContext*.ts` untouched; read for precedent only in an earlier prompt, not this one.
181
+ - Full unit (927/927), browser (120/120 on the confirming re-run), and security (68/68) suites all pass with zero regressions.
182
+
183
+ ## Security impact
184
+
185
+ - No new external input surface beyond a local, caller-controlled JSON file (`--bindings-file`) — the same trust boundary as every existing `--*-file` flag.
186
+ - `evaluateReferenceCandidateFidelity` performs no filesystem access, no network access, and no browser/Chromium invocation of any kind; `evaluateReferenceCandidateFidelityFromArtifactRoots` performs only read-only artifact-manifest reads through the existing readers.
187
+ - `test:security` (policy + real-Chromium adapter tests) re-run and passing, confirming no regression to the existing safety/navigation policy surface (untouched by this prompt).
188
+
189
+ ## Documentation changes
190
+
191
+ - `docs/CONTRACTS.md` — new "v0.7 Prompt 6 structured reference-vs-candidate fidelity evaluation" section (full type shapes, evaluation order, coordinate-mapping/aspect-ratio rules, tolerance reuse, region-property/measurement/relationship evaluation, binding gate, category preservation, overall-result rule, persistence decision, CLI summary).
192
+ - `docs/ARCHITECTURE.md` — new paragraph in the "Planned v0.7–v0.10" section describing the Prompt 6 module additions and their reuse of Prompts 3/4/5 and v0.4.
193
+ - `docs/WORKFLOWS.md` — "Current external-reference foundation workflow" retitled to "Prompts 1-6" and extended with the `evaluate-reference-fidelity` command flow and test-coverage summary.
194
+ - `docs/COMMANDS.md` — new `## `evaluate-reference-fidelity`` section, mirroring the existing `## `evaluate-contract`` section's structure exactly.
195
+
196
+ ## Tooling incidents
197
+
198
+ None. No orchestrator was invoked (direct-implementation mode used throughout, consistent with Prompts 2–6); no background/speculative subagent writes occurred; the Prompt 1 stray-fork-writes stash remains untouched, unapplied, and unmined as precedent. The one transient real-Chromium test failure encountered during validation is documented under Validation/Regression results above as confirmed flakiness, not a tooling or implementation defect.
199
+
200
+ ## Out-of-scope confirmation
201
+
202
+ This prompt implements no bounded coding-agent correction packet, no v0.6 bounded-agent-context change, no source/static correlation change, no coding-agent invocation, no source editing, no rerender/retry loop, no baseline/per-change overall workflow composition, no viewer, no annotation, no automatic target matching, no pixel/image similarity (no SSIM/perceptual hash/OCR/computer vision of any kind), and no new style-fidelity family (background color, text color, font size/weight, line height, border radius, shadow, gradient, opacity, icons) beyond Prompt 3's already-frozen requirement vocabulary. `evaluateReferenceCandidateFidelity` never attaches `sourceOwner`/`sourceFile`/`component`/`symbol`/`causedBy` to any result (verified by a dedicated test scanning the serialized evaluation for those exact terms).
203
+
204
+ ## Known limitations
205
+
206
+ - The coordinate-mapping model supports only a single, deliberately bounded full-frame scale per evaluation — no per-region cropping, offset, rotation, or perspective mapping exists or was attempted, per the task's own explicit prohibition.
207
+ - `expectedDependentMode` (`required`/`permitted`) is carried through as provenance only and never changes the pass/fail rule, since Prompt 3 itself never implemented a directional evaluation difference for its own expectation/adequacy derivation (unlike v0.5's runtime-directional contract clauses) — documented explicitly rather than silently ignored.
208
+ - No `--output`/persistence flag exists for `evaluate-reference-fidelity`; a caller needing to save a fidelity result must do so itself (e.g. redirecting stdout, or consuming the programmatic API directly) until/unless a later prompt's architecture proves in-repository persistence necessary.
209
+
210
+ ## Remaining risks
211
+
212
+ - None identified that block this prompt's own scope. The primary forward consideration for Prompt 7 (bounded visual-fidelity mismatch projection and v0.6 bounded-agent-context integration) is how it will attach `ReferenceRequirementFidelityResult`/`ReferenceCandidateFidelityEvaluation` evidence to `RuntimeStaticCorrelationRecord`-shaped context without conflating the two identity domains this prompt was careful to keep separate (reference-region/runtime-target vs. runtime-target/static-source) — flagged for that prompt's own precedent review, not preempted here.
213
+
214
+ ## Exact next action
215
+
216
+ v0.7 Prompt 7 — bounded visual-fidelity mismatch projection and v0.6 bounded-agent-context integration.
@@ -0,0 +1,151 @@
1
+ # v0.7 Prompt 1 — External Visual Reference Foundation
2
+
3
+ ## 1. Verdict
4
+
5
+ **PASS_V0_7_REFERENCE_FOUNDATION_PROMPT1**
6
+
7
+ ## 2. Repository
8
+
9
+ `Z:\Users\newuser\Projects\my-frontend-observer` (`https://github.com/dailephd/my-frontend-observer.git`)
10
+
11
+ ## 3. Branch
12
+
13
+ `implementation/v0.7-reference-foundation`
14
+
15
+ ## 4. Starting head
16
+
17
+ `be3e440e5f3570becde75717f9538c856e61cd97` (the tip of `docs/external-visual-reference-roadmap` / PR #7 at the time this stage began — the authoritative checkout containing the v0.7 external-reference roadmap)
18
+
19
+ ## 5. Ending head
20
+
21
+ `4a15baf732cb1e545185b7242f0af6d575ec7e0a`
22
+
23
+ ## 6. Git status
24
+
25
+ Clean at the ending head. `git diff --stat` against `package.json`/`package-lock.json` is empty — no dependency graph change. Only the 20 files listed in section 14 changed.
26
+
27
+ ## 7. Resolved my-dev-kit version
28
+
29
+ `@dailephd/my-dev-kit@1.12.3` (the unscoped `my-dev-kit` package on the public registry is a deprecated alias pointing at this scoped package)
30
+
31
+ ## 8. Resolved orchestrator version
32
+
33
+ `@dailephd/my-dev-kit-orchestrator@1.4.1` (the unscoped `my-dev-kit-orchestrator` package is likewise a deprecated alias)
34
+
35
+ ## 9. FULL_STAGE_CONTEXT run ID / location
36
+
37
+ `20260906T053538-v0-7-reference-foundation-prompt1`, at `.my-dev-kit-orchestrator/runs/20260906T053538-v0-7-reference-foundation-prompt1/` (gitignored, repository-local, not committed — matches this repository's existing `.gitignore` convention for `.my-dev-kit-orchestrator/`). All ten stage artifacts (RequestBrief, ArchitectureContextPacket, BehaviorModel, PseudocodePacket, TestStrategyPacket, ImplementationReport, TestImplementationReport, VerificationReport, JudgeReport, FinalReport) were produced there.
38
+
39
+ ## 10. Architecture decision
40
+
41
+ - **Chosen reference contract/artifact model**: a new, standalone **persisted** artifact family (not programmatic-only, unlike the v0.6 bounded-agent-context precedent). Persistence is justified by the request's own explicit forward-looking requirement (section 12A): later v0.7/v0.8/v0.9 stages need a stable, reloadable, approvable, supersedable reference identity across many separate invocations — unlike bounded-agent-context, which is a per-invocation projection over already-persisted upstream evidence and is consumed once, in-process.
42
+ - **Chosen name**: `ExternalReferenceArtifact` — matching this repository's existing naming convention (`ObservationArtifact`, `ComparisonArtifact`) and the exact vocabulary already used throughout `docs/ROADMAP.md`/`docs/WORKFLOWS.md`/`docs/PROJECT_DESCRIPTION.md` ("external reference"), not the prompt's conceptual placeholder `ReferenceVisualArtifact`.
43
+ - **Persistence decision**: `<outputLocation>/<referenceId>/manifest.json` (+ `reference.<ext>` only for an `'imported'` artifact), via the same atomic temp-dir-then-rename discipline as `writeObservationArtifact`/`writeComparisonArtifact`.
44
+ - **Identity model**: `referenceRequestId` — deterministic sha256 over a canonicalized `{imageSha256, format, width, height, supersedesReferenceId}` view (never a path, label, or timestamp) — plus `referenceId`, a fresh nonce-suffixed instance identity per persisted write, exactly mirroring `identity.ts`/`comparisonIdentity.ts`/`frontendContractIdentity.ts`'s pattern (each module owning its own duplicated `canonicalize()`).
45
+ - **Lifecycle model**: exactly two persisted states, `{state:'imported'}` and `{state:'approved'; approvedAt}`. There is **no literal `'superseded'` state** — supersession is represented only as a forward pointer (`supersedesReferenceId` on the newer artifact), so an existing persisted artifact's own manifest is never rewritten. This is a deliberate interpretation of the request's four-state conceptual model (section 12G), trading a literal reading for an unconditional immutability guarantee; it is flagged explicitly in the design artifacts and re-confirmed by the judge stage.
46
+ - **Provenance model**: `producer` (name/version, via the existing `getProducerInfo()`), `provenance.importedAt` + optional `provenance.label` (pure metadata, never identity-bearing), and — for an approved artifact — a `sourceReference` back to the imported artifact's `{referenceId, referenceRequestId, producer, schemaVersion, image}`, mirroring `ComparisonSourceObservationReference`'s exact shape.
47
+ - **Public export decision**: yes, this is a supported v0.7 contract — the complete type/constant/validator/identity/writer/reader/application-service surface is exported from `src/index.ts` in the same grouping order as every existing family.
48
+
49
+ ## 11. Canonical precedents
50
+
51
+ | Existing owner | What was reused |
52
+ |---|---|
53
+ | `src/domain/identity.ts` / `comparisonIdentity.ts` / `frontendContractIdentity.ts` | canonicalize-then-sha256 request identity + nonce-based fresh instance identity pattern, including the "each module owns its own duplicated `canonicalize()`" convention |
54
+ | `src/artifacts/artifactWriter.ts` | atomic temp-dir-then-rename persistence, media-before-manifest, collision-is-rejection |
55
+ | `src/artifacts/comparisonArtifactWriter.ts` | manifest-only (no media copy) persistence pattern, reused for the `'approved'` lifecycle variant |
56
+ | `src/artifacts/artifactReader.ts` | reader re-validates through the exact same structural gate the writer uses |
57
+ | `src/domain/frontendContracts.ts` (`PersistentBaselineContract.supersedesBaselineId`) | explicit, append-only, forward-declared supersession |
58
+ | `src/application/frontendContractPersistenceService.ts` (`approveAndPersistBaseline`) | single explicit approval action, separate from any other workflow step, refusing an already-approved/invalid target |
59
+ | `src/domain/completion.ts` (`deriveCompletion`) | reused unchanged, not reimplemented |
60
+ | `src/domain/schema.ts` (`getProducerInfo`, `PRODUCER_NAME`) | reused unchanged |
61
+ | `src/domain/diagnostics.ts` (`DIAGNOSTIC_CODES`/`DIAGNOSTIC_SEVERITY`) | extended additively (5 new codes), never duplicated |
62
+ | `src/domain/comparison.ts` (`ComparisonSourceObservationReference`) | direct shape precedent for `ExternalReferenceSourceReference` |
63
+ | `src/request/paths.ts` (`normalizeOutputLocation`) | reused unchanged for path-traversal prevention |
64
+ | `src/cli.ts` (`approve-baseline`/`save-change-contract` help/arg-parsing/dispatch) | direct template for `import-reference`/`approve-reference` |
65
+
66
+ ## 12. New owners introduced
67
+
68
+ - `src/domain/externalReferenceImage.ts` — pure, dependency-free PNG/JPEG/WebP header-byte format detection and dimension parsing; bounded format/size/dimension constants.
69
+ - `src/domain/externalReference.ts` — `ExternalReferenceArtifact` (discriminated union of `ImportedExternalReferenceArtifact`/`ApprovedExternalReferenceArtifact`), its lifecycle/provenance/image-reference/source-reference sub-types, and `isValidExternalReferenceArtifact` (+ sub-validators, + `isImportedExternalReferenceArtifact`/`isApprovedExternalReferenceArtifact` type guards).
70
+ - `src/domain/externalReferenceIdentity.ts` — `buildExternalReferenceRequestIdentity`, `buildExternalReferenceInstanceIdentity`.
71
+ - `src/artifacts/externalReferenceArtifactWriter.ts` / `externalReferenceArtifactReader.ts` — persistence and read-back.
72
+ - `src/application/externalReferencePersistenceService.ts` — `importExternalReference`, `approveExternalReference`, the two canonical application-level use cases.
73
+ - CLI: `import-reference`, `approve-reference` (in `src/cli.ts`, additive).
74
+
75
+ ## 13. Existing owners extended
76
+
77
+ - `src/domain/diagnostics.ts` — 5 additive `DIAGNOSTIC_CODES` entries (`unsupported-image-format`, `invalid-image-dimensions`, `image-too-large`, `unsupported-schema-version`, `reference-not-found`), all severity `error`; no existing code/severity changed.
78
+ - `src/index.ts` — one additive export block, same grouping order as every existing family.
79
+ - `src/cli.ts` — additive help text, argument parsers, command runners, and dispatch entries for the two new commands; no existing command's help text, parsing, or behavior changed.
80
+
81
+ ## 14. Files changed
82
+
83
+ Modified: `docs/ARCHITECTURE.md`, `docs/CONTRACTS.md`, `docs/CURRENT_STATE.md`, `docs/WORKFLOWS.md`, `src/domain/diagnostics.ts`, `src/index.ts`, `src/cli.ts`.
84
+ New: `src/domain/externalReference.ts`, `externalReferenceIdentity.ts`, `externalReferenceImage.ts`; `src/artifacts/externalReferenceArtifactReader.ts`, `externalReferenceArtifactWriter.ts`; `src/application/externalReferencePersistenceService.ts`; `tests/unit/externalReference.test.ts`, `externalReferenceIdentity.test.ts`, `externalReferenceImage.test.ts`, `externalReferenceArtifactWriter.test.ts`, `externalReferencePersistenceService.test.ts`, `cliExternalReference.test.ts`, `externalReferenceImageFixtures.ts`.
85
+
86
+ ## 15. Tests added/changed
87
+
88
+ Six new test files (38 total files, 668 total tests, up from 32/627) — zero existing test file modified. See the "Responsibility-to-test trace" in the run's `test-implementation-report.txt` for the full TST-NNN-to-test mapping; summary:
89
+
90
+ - `externalReferenceImage.test.ts` — format detection, dimension parsing (valid + truncated/unrecognized), dimension bounds.
91
+ - `externalReferenceIdentity.test.ts` — deterministic request identity, identity-bearing-change sensitivity, fresh instance identity.
92
+ - `externalReference.test.ts` — the structural validator: valid imported/approved shapes, schema/kind mismatch, mixed lifecycle-variant fields, out-of-bound dimensions, nested image path, producer/diagnostics/supersedesReferenceId edge cases.
93
+ - `externalReferenceArtifactWriter.test.ts` — atomic persistence, no-media-copy on approval, collision rejection, no leftover temp directory, reader/writer round-trip symmetry, reader fail-closed on corrupt/invalid content.
94
+ - `externalReferencePersistenceService.test.ts` — the full import/approve behavior model: valid import, every failure mode (unsupported format, over-limit size, invalid dimensions, unresolvable supersession target), import-never-approves, approval producing a new non-media-copying instance without mutating the imported artifact, re-approval rejection, and forward-pointer-only supersession (with a direct byte-for-byte immutability assertion on the superseded artifact's manifest).
95
+ - `cliExternalReference.test.ts` — end-to-end `import-reference`/`approve-reference` through `runCli()`, help text, and error paths — no Chromium.
96
+
97
+ ## 16. Validation results
98
+
99
+ All commands run against commit `4a15baf` on `implementation/v0.7-reference-foundation`:
100
+
101
+ | Command | Result |
102
+ |---|---|
103
+ | `npm run typecheck` | PASS |
104
+ | `npm run lint` | PASS |
105
+ | `npm test` | PASS — 38 files, 668 tests |
106
+ | `npm run build` | PASS (all 6 new modules compiled into `dist/`) |
107
+ | `npm run check:docs` | PASS (17 required files) |
108
+ | `git diff --check` | PASS |
109
+ | `npm pack --dry-run` | PASS (159 files, 284.3 kB / 1.3 MB unpacked) |
110
+ | `npm run test:browser` | PASS — 9 files, 120 tests (unchanged count — no new browser test needed) |
111
+ | `npm run test:security` | PASS — 68 tests |
112
+
113
+ ## 17. Public contract / schema changes
114
+
115
+ New, independent `EXTERNAL_REFERENCE_SCHEMA_VERSION = '1.0.0'`. No existing schema version (`SCHEMA_VERSION '1.2.0'`, `COMPARISON_SCHEMA_VERSION`, `CONTRACT_SCHEMA_VERSION`, `EVALUATION_SCHEMA_VERSION`, `BOUNDED_AGENT_CONTEXT_SCHEMA_VERSION`) changed.
116
+
117
+ ## 18. Package/API impact
118
+
119
+ `src/index.ts`'s public export surface grew additively (new types/constants/functions listed in section 12); nothing existing was renamed, removed, or changed in signature. `npm pack --dry-run` confirms the package still builds and packs cleanly. No new runtime dependency (`package.json`/`package-lock.json` unchanged).
120
+
121
+ ## 19. Security/privacy impact
122
+
123
+ No network calls, no vision/AI API calls, no OCR, no automatic navigation to URLs in image metadata, no execution of image content — the entire image-handling boundary (`externalReferenceImage.ts`) only reads bounded header bytes via pure functions. Persisted manifests store only a bare relative image filename (never an absolute host path) — enforced by `isValidExternalReferenceImageReference` rejecting any path containing a separator. The target frontend is never touched by import/approval. Bounded input: max 20,000,000 bytes, dimensions `[1, 8192]` px per side, exactly three supported formats — all fail-closed on violation.
124
+
125
+ ## 20. Documentation changes
126
+
127
+ Additive sections only, in `docs/ARCHITECTURE.md` (relationship of the new foundation to the existing engine boundaries), `docs/CONTRACTS.md` (the full `ExternalReferenceArtifact` shape and key rules — the primary contract reference), `docs/CURRENT_STATE.md` ("v0.7 Prompt 1 status" section, plus updated "Not implemented"/"Next target"), and `docs/WORKFLOWS.md` (the new import/approve workflow, and a correction to the "Planned v0.7 reference-driven correction flow" first line marking identity/provenance as now implemented). `docs/ROADMAP.md` was **not** rewritten into implementation batches, per the explicit instruction.
128
+
129
+ ## 21. Out-of-scope confirmation
130
+
131
+ This stage did **not** implement: reference regions, requirements, tolerances, adequacy evaluation, compatibility/theme/viewport evaluation, reference-region↔runtime-target binding, reference-vs-candidate fidelity evaluation, bounded visual-correction packets, the coding-agent correction loop, the viewer, or annotation. Confirmed by direct grep of the new source files for that vocabulary (none found outside explicit "not implemented here" documentation comments) and by the judge stage's independent review (`judge-report.txt`, question 8).
132
+
133
+ ## 22. Known limitations
134
+
135
+ 1. No fuzz-testing of adversarial/malformed image files beyond the specific truncation/unsupported-chunk-layout cases already covered — a deliberate, documented scope boundary for a foundation stage (the parsing functions are defensively bounded by construction: no unbounded loops, no reads past a declared segment length without a check).
136
+ 2. `scripts/ci/runPackedObservationSmoke.mjs` was not extended to exercise `import-reference`/`approve-reference` from an installed tarball — `npm pack --dry-run` was run and passed, but the deeper packed-CLI smoke convention used by `observe`/`compare`/`approve-baseline` was deliberately not extended in this stage, to avoid scope creep beyond "the smallest complete foundation."
137
+ 3. A background research subagent tasked with pure read-only precedent retrieval instead wrote 5 speculative source files despite an explicit no-write instruction; it was stopped, and its uncommitted output was moved into `git stash` (preserved, not deleted, not treated as authoritative) before any design decision was made. Feedback on this was filed separately.
138
+ 4. The `my-dev-kit-orchestrator`'s automated `context` readiness gate for the test-implementation stage reports 21 of 26 test responsibilities as "partially-mapped" rather than "mapped," because its graph-based heuristic does not treat a comment-tagged vitest `it()` block as first-class "testFiles" evidence for this repository's plain-vitest test-authoring convention. This was investigated directly (see `test-implementation-report.txt`) and confirmed to be a tool heuristic gap, not an actual coverage gap — every `TST-NNN` responsibility was independently confirmed present by name in exactly one test.
139
+
140
+ ## 23. Remaining risks
141
+
142
+ - The forward-pointer-only supersession design (no literal `'superseded'` state) means a consumer must query *all* references to determine whether a given one has been superseded, rather than reading a single field on that reference itself. This is an accepted tradeoff for immutability (see section 10), but Prompt 2+ should be aware of it when designing any "list active references" capability.
143
+ - The two-instance (imported + approved) persistence model means every approval doubles the on-disk artifact count for a given logical reference. This is bounded and intentional (mirrors how baseline approval already works) but should inform any future retention/cleanup policy discussion — none exists yet, by design, per section 12G's "do not build a large content-management/history system."
144
+
145
+ ## 24. Exact next action
146
+
147
+ **v0.7 Prompt 2** — explicit reference regions, geometry, and reusable reference relationships, built on top of the `referenceRequestId`/`referenceId` identity established here.
148
+
149
+ ## 25. Report path
150
+
151
+ `docs/reports/v0.7-reference-foundation-prompt1.md` (this file)