@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,401 @@
1
+ /**
2
+ * v0.7 Prompt 3 selected design requirements, tolerance semantics, and
3
+ * reference-evidence adequacy. Builds only on Prompt 2's `ReferenceRegion`/
4
+ * `ReferenceRegionGeometry`/relationship-derivation - it does not implement
5
+ * runtime-target binding, candidate comparison, or fidelity PASS/FAIL (those
6
+ * remain later v0.7 prompts).
7
+ *
8
+ * Central distinction (see docs/CONTRACTS.md "v0.7 Prompt 3"): a reference
9
+ * region's geometry is REFERENCE EVIDENCE - everything visibly/measurably
10
+ * present in the supplied image. A requirement is SELECTED DESIGN INTENT -
11
+ * only what the user/configuration explicitly authored as mattering for
12
+ * later candidate evaluation. This module never infers a requirement merely
13
+ * because a property or relationship exists.
14
+ *
15
+ * Requirement categories are the exact v0.5 `AuthoredChangeScopeCategory`
16
+ * vocabulary (`requested`/`expected-dependent`/`protected`/`preserved`),
17
+ * imported directly rather than reinvented as a "reference-only" taxonomy -
18
+ * that type carries no runtime-only coupling in its own definition. As in
19
+ * v0.5, `'unexpected'` remains impossible to author here: it is not a member
20
+ * of `AuthoredChangeScopeCategory` at all.
21
+ */
22
+ import { AUTHORED_CHANGE_SCOPE_CATEGORIES, isAuthoredChangeScopeCategory, EXPECTED_DEPENDENT_MODES, isValidExpectedDependentMode } from './frontendContracts.js';
23
+ import { PAIRWISE_RELATIONSHIP_KINDS, HORIZONTAL_ORDER_RELATIONSHIPS, VERTICAL_ORDER_RELATIONSHIPS, AREA_OVERLAP_RELATIONSHIPS, RELATIVE_WIDTH_RELATIONSHIPS, GEOMETRIC_FIT_RELATIONSHIPS, VERTICAL_SEQUENCE_RELATIONSHIPS, } from './relationships.js';
24
+ import { deriveReferenceRegionGeometry } from './externalReferenceRegions.js';
25
+ import { deriveReferenceRegionRelationships } from './externalReferenceRegionRelationships.js';
26
+ import { buildReferenceRequirementIdentity } from './externalReferenceRequirementIdentity.js';
27
+ export { AUTHORED_CHANGE_SCOPE_CATEGORIES, isAuthoredChangeScopeCategory, EXPECTED_DEPENDENT_MODES, isValidExpectedDependentMode };
28
+ function isPlainObject(value) {
29
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
30
+ }
31
+ function isNonEmptyString(value) {
32
+ return typeof value === 'string' && value.length > 0;
33
+ }
34
+ export const MAX_REFERENCE_REQUIREMENTS = 50;
35
+ // --- bounded property/measurement/relationship vocabulary ------------------------
36
+ /** Exactly the fields of ReferenceRegionGeometry - the smallest coherent vocabulary already available from Prompt 2, nothing invented (no separate "left"/"top" aliases - x/y already are the left/top edges of the canonical rectangle). */
37
+ export const REFERENCE_REQUIREMENT_REGION_PROPERTIES = ['x', 'y', 'width', 'height', 'right', 'bottom', 'centerX', 'centerY'];
38
+ export function isReferenceRequirementRegionProperty(value) {
39
+ return typeof value === 'string' && REFERENCE_REQUIREMENT_REGION_PROPERTIES.includes(value);
40
+ }
41
+ /** Smallest useful set of pure two-region derived measurements (request section 18) - not an unrestricted geometry expression language. */
42
+ export const REFERENCE_REQUIREMENT_MEASUREMENTS = ['vertical-gap', 'horizontal-gap', 'center-x-delta', 'center-y-delta', 'left-edge-delta', 'right-edge-delta'];
43
+ export function isReferenceRequirementMeasurement(value) {
44
+ return typeof value === 'string' && REFERENCE_REQUIREMENT_MEASUREMENTS.includes(value);
45
+ }
46
+ /**
47
+ * Pure derived two-region measurements. `vertical-gap`/`horizontal-gap`
48
+ * return `undefined` when the two regions overlap on that axis (the gap is
49
+ * geometrically undefined, never fabricated as 0 or negative) - direction is
50
+ * decided by actual geometry, mirroring relationships.ts's
51
+ * verticalSequenceOf/horizontalOrderOf convention. The delta measurements
52
+ * are always defined (a plain numeric distance, never negative).
53
+ */
54
+ export function deriveReferenceRequirementMeasurement(kind, a, b) {
55
+ switch (kind) {
56
+ case 'vertical-gap':
57
+ if (a.bottom <= b.y)
58
+ return b.y - a.bottom;
59
+ if (b.bottom <= a.y)
60
+ return a.y - b.bottom;
61
+ return undefined;
62
+ case 'horizontal-gap':
63
+ if (a.right <= b.x)
64
+ return b.x - a.right;
65
+ if (b.right <= a.x)
66
+ return a.x - b.right;
67
+ return undefined;
68
+ case 'center-x-delta':
69
+ return Math.abs(a.centerX - b.centerX);
70
+ case 'center-y-delta':
71
+ return Math.abs(a.centerY - b.centerY);
72
+ case 'left-edge-delta':
73
+ return Math.abs(a.x - b.x);
74
+ case 'right-edge-delta':
75
+ return Math.abs(a.right - b.right);
76
+ }
77
+ }
78
+ // --- tolerance (independently owned - never mislabeled as CSS/runtime pixels) ----
79
+ /**
80
+ * Deliberately not a reuse of domain/frontendContracts.ts#ContractTolerance:
81
+ * that type's `'absolute-px'` member is implicitly runtime/CSS pixels
82
+ * (compared against `TargetGeometry` from a live ObservationArtifact).
83
+ * Reference-image pixels are a different, explicitly-labeled unit (see
84
+ * externalReferenceRegions.ts's coordinate-semantics doc comment) - Prompt 6
85
+ * will eventually need an explicit scale/compatibility mapping between the
86
+ * two; nothing here assumes 1 reference pixel = 1 CSS pixel. Numeric bounds
87
+ * intentionally mirror CONTRACT_TOLERANCE_ABSOLUTE_PX_MIN/MAX and
88
+ * CONTRACT_TOLERANCE_PERCENT_MIN/MAX (same values, independently owned
89
+ * constants) rather than importing them, for the same unit-labeling reason.
90
+ */
91
+ export const REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MIN = 0;
92
+ export const REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MAX = 100;
93
+ export const REFERENCE_REQUIREMENT_TOLERANCE_PERCENT_MIN = 0;
94
+ export const REFERENCE_REQUIREMENT_TOLERANCE_PERCENT_MAX = 100;
95
+ export function isValidReferenceRequirementTolerance(value) {
96
+ if (!isPlainObject(value))
97
+ return false;
98
+ if (value.kind === 'exact')
99
+ return Object.keys(value).length === 1;
100
+ if (value.kind === 'absolute-reference-px') {
101
+ return (Object.keys(value).length === 2 &&
102
+ typeof value.amount === 'number' &&
103
+ Number.isFinite(value.amount) &&
104
+ value.amount >= REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MIN &&
105
+ value.amount <= REFERENCE_REQUIREMENT_TOLERANCE_ABSOLUTE_PX_MAX);
106
+ }
107
+ if (value.kind === 'percent') {
108
+ return (Object.keys(value).length === 2 &&
109
+ typeof value.amount === 'number' &&
110
+ Number.isFinite(value.amount) &&
111
+ value.amount >= REFERENCE_REQUIREMENT_TOLERANCE_PERCENT_MIN &&
112
+ value.amount <= REFERENCE_REQUIREMENT_TOLERANCE_PERCENT_MAX);
113
+ }
114
+ return false;
115
+ }
116
+ function isValidRegionPropertySubjectShape(value) {
117
+ return isNonEmptyString(value.region) && isReferenceRequirementRegionProperty(value.property) && Object.keys(value).length === 3;
118
+ }
119
+ function isValidRegionRelationshipSubjectShape(value) {
120
+ return (isNonEmptyString(value.subjectRegion) &&
121
+ isNonEmptyString(value.relatedRegion) &&
122
+ value.subjectRegion !== value.relatedRegion &&
123
+ typeof value.relationship === 'string' &&
124
+ PAIRWISE_RELATIONSHIP_KINDS.includes(value.relationship) &&
125
+ Object.keys(value).length === 4);
126
+ }
127
+ function isValidRegionMeasurementSubjectShape(value) {
128
+ return (isNonEmptyString(value.subjectRegion) &&
129
+ isNonEmptyString(value.relatedRegion) &&
130
+ value.subjectRegion !== value.relatedRegion &&
131
+ isReferenceRequirementMeasurement(value.measurement) &&
132
+ Object.keys(value).length === 4);
133
+ }
134
+ export function isValidReferenceRequirementSubjectShape(value) {
135
+ if (!isPlainObject(value) || typeof value.kind !== 'string')
136
+ return false;
137
+ switch (value.kind) {
138
+ case 'region-property':
139
+ return isValidRegionPropertySubjectShape(value);
140
+ case 'region-relationship':
141
+ return isValidRegionRelationshipSubjectShape(value);
142
+ case 'region-measurement':
143
+ return isValidRegionMeasurementSubjectShape(value);
144
+ default:
145
+ return false;
146
+ }
147
+ }
148
+ /** Mirrors frontendContractEvaluation.ts's RELATIONSHIP_FAMILY_GROUPS shape (independently owned here - no page-level family exists for a static reference image). */
149
+ const RELATIONSHIP_FAMILY_GROUPS = [
150
+ HORIZONTAL_ORDER_RELATIONSHIPS,
151
+ VERTICAL_ORDER_RELATIONSHIPS,
152
+ AREA_OVERLAP_RELATIONSHIPS,
153
+ RELATIVE_WIDTH_RELATIONSHIPS,
154
+ GEOMETRIC_FIT_RELATIONSHIPS,
155
+ VERTICAL_SEQUENCE_RELATIONSHIPS,
156
+ ];
157
+ function subjectRegionIds(subject) {
158
+ if (subject.kind === 'region-property')
159
+ return [subject.region];
160
+ return [subject.subjectRegion, subject.relatedRegion];
161
+ }
162
+ /** Structural equality for the duplicate-subject rule below - deliberately not identity-based (two subjects are "the same" whenever their content matches, regardless of authoring position). */
163
+ function sameSubject(a, b) {
164
+ if (a.kind !== b.kind)
165
+ return false;
166
+ if (a.kind === 'region-property' && b.kind === 'region-property')
167
+ return a.region === b.region && a.property === b.property;
168
+ if (a.kind === 'region-relationship' && b.kind === 'region-relationship') {
169
+ return a.relationship === b.relationship && ((a.subjectRegion === b.subjectRegion && a.relatedRegion === b.relatedRegion) || (a.subjectRegion === b.relatedRegion && a.relatedRegion === b.subjectRegion));
170
+ }
171
+ if (a.kind === 'region-measurement' && b.kind === 'region-measurement') {
172
+ return a.measurement === b.measurement && ((a.subjectRegion === b.subjectRegion && a.relatedRegion === b.relatedRegion) || (a.subjectRegion === b.relatedRegion && a.relatedRegion === b.subjectRegion));
173
+ }
174
+ return false;
175
+ }
176
+ function validateAuthoredRequirementFields(value) {
177
+ if (!isAuthoredChangeScopeCategory(value.category))
178
+ return { valid: false, reason: `requirement.category must be one of ${AUTHORED_CHANGE_SCOPE_CATEGORIES.join(', ')}` };
179
+ const hasMode = 'expectedDependentMode' in value && value.expectedDependentMode !== undefined;
180
+ if (value.category === 'expected-dependent') {
181
+ if (!hasMode || !isValidExpectedDependentMode(value.expectedDependentMode)) {
182
+ return { valid: false, reason: 'requirement.expectedDependentMode is required and must be "required" or "permitted" when category is "expected-dependent"' };
183
+ }
184
+ }
185
+ else if (hasMode) {
186
+ return { valid: false, reason: 'requirement.expectedDependentMode must be absent unless category is "expected-dependent"' };
187
+ }
188
+ if (!isValidReferenceRequirementSubjectShape(value.subject))
189
+ return { valid: false, reason: 'requirement.subject is invalid' };
190
+ const subject = value.subject;
191
+ const hasTolerance = 'tolerance' in value && value.tolerance !== undefined;
192
+ if (subject.kind === 'region-relationship') {
193
+ if (hasTolerance)
194
+ return { valid: false, reason: 'requirement.tolerance must be absent for a "region-relationship" subject (a categorical fact, not a numeric comparison)' };
195
+ }
196
+ else {
197
+ if (!hasTolerance || !isValidReferenceRequirementTolerance(value.tolerance)) {
198
+ return { valid: false, reason: 'requirement.tolerance is required and must be valid for a "region-property"/"region-measurement" subject' };
199
+ }
200
+ }
201
+ return { valid: true };
202
+ }
203
+ /** Validates one raw, not-yet-identified authored requirement - the shape accepted from `--requirements-file`. */
204
+ export function isValidRawReferenceRequirement(value) {
205
+ if (!isPlainObject(value))
206
+ return { valid: false, reason: 'requirement must be an object' };
207
+ if ('requirementId' in value && value.requirementId !== undefined)
208
+ return { valid: false, reason: 'requirement.requirementId must not be authored - it is always computed from content' };
209
+ return validateAuthoredRequirementFields(value);
210
+ }
211
+ /** Computes the deterministic requirementId and returns a complete ExternalReferenceRequirement. Callers must validate via isValidRawReferenceRequirement first. */
212
+ export function buildReferenceRequirement(raw) {
213
+ const requirementId = buildReferenceRequirementIdentity(raw.subject, raw.category, raw.tolerance, raw.expectedDependentMode);
214
+ return {
215
+ requirementId,
216
+ category: raw.category,
217
+ ...(raw.expectedDependentMode === undefined ? {} : { expectedDependentMode: raw.expectedDependentMode }),
218
+ subject: raw.subject,
219
+ ...(raw.tolerance === undefined ? {} : { tolerance: raw.tolerance }),
220
+ };
221
+ }
222
+ /** Validates one already-identified, fully-constructed requirement's own shape (category/mode/subject/tolerance-applicability, plus requirementId presence) - never region existence, which needs the owning reference's `regions` (see isValidReferenceRequirements). Used to defensively re-validate a persisted/about-to-be-persisted ExternalReferenceRequirement, mirroring how every other artifact family's writer re-validates via the same gate it will later read with. */
223
+ export function isValidReferenceRequirementShape(value) {
224
+ if (!isPlainObject(value))
225
+ return { valid: false, reason: 'requirement must be an object' };
226
+ if (!isNonEmptyString(value.requirementId))
227
+ return { valid: false, reason: 'requirement.requirementId must be a non-empty string' };
228
+ return validateAuthoredRequirementFields(value);
229
+ }
230
+ /**
231
+ * Collection-level validation: bounded count, every subject's region id(s)
232
+ * must exist among the owning artifact's own already-validated `regions`
233
+ * (an authored requirement pointing at a nonexistent region is a structural
234
+ * validation failure, never merely "unavailable" evidence - see
235
+ * docs/CONTRACTS.md), and no two requirements may share the same structural
236
+ * subject (the chosen conflict-handling rule - see the same doc section for
237
+ * why v0.5's runtime-evidence conflict detector could not be reused here).
238
+ */
239
+ export function isValidReferenceRequirements(value, regions) {
240
+ if (!Array.isArray(value))
241
+ return { valid: false, reason: 'requirements must be an array' };
242
+ if (value.length > MAX_REFERENCE_REQUIREMENTS)
243
+ return { valid: false, reason: `requirements must contain at most ${MAX_REFERENCE_REQUIREMENTS} entries` };
244
+ const regionIds = new Set(regions.map((r) => r.id.toLowerCase()));
245
+ const seenRequirementIds = new Set();
246
+ const seenSubjects = [];
247
+ for (const entry of value) {
248
+ const shapeValidation = isValidReferenceRequirementShape(entry);
249
+ if (!shapeValidation.valid)
250
+ return shapeValidation;
251
+ const requirement = entry;
252
+ if (seenRequirementIds.has(requirement.requirementId))
253
+ return { valid: false, reason: `duplicate requirement id "${requirement.requirementId}"` };
254
+ seenRequirementIds.add(requirement.requirementId);
255
+ for (const regionId of subjectRegionIds(requirement.subject)) {
256
+ if (!regionIds.has(regionId.toLowerCase()))
257
+ return { valid: false, reason: `requirement "${requirement.requirementId}" refers to unknown region id "${regionId}"` };
258
+ }
259
+ if (seenSubjects.some((s) => sameSubject(s, requirement.subject))) {
260
+ return { valid: false, reason: `requirement "${requirement.requirementId}" duplicates the subject of an earlier requirement in this collection` };
261
+ }
262
+ seenSubjects.push(requirement.subject);
263
+ }
264
+ return { valid: true };
265
+ }
266
+ /**
267
+ * Derives what the reference itself shows for one requirement's subject,
268
+ * purely from the supplied regions - never stored on the requirement or the
269
+ * artifact (avoids the exact drift risk request section 14 warns about: a
270
+ * stored `width: 424` could silently disagree with the region's own
271
+ * rectangle after some future change). `geometryTolerancePx` is passed
272
+ * through to relationship derivation unchanged (Prompt 2's own default
273
+ * applies when omitted).
274
+ */
275
+ export function deriveReferenceRequirementExpectation(subject, regions, options = {}) {
276
+ const byId = new Map(regions.map((r) => [r.id.toLowerCase(), r]));
277
+ if (subject.kind === 'region-property') {
278
+ const region = byId.get(subject.region.toLowerCase());
279
+ if (!region)
280
+ return { available: false, reason: `region "${subject.region}" not found` };
281
+ const geometry = deriveReferenceRegionGeometry(region.rectangle);
282
+ return { available: true, kind: 'numeric', value: geometry[subject.property] };
283
+ }
284
+ const subjectRegion = byId.get(subject.subjectRegion.toLowerCase());
285
+ const relatedRegion = byId.get(subject.relatedRegion.toLowerCase());
286
+ if (!subjectRegion || !relatedRegion)
287
+ return { available: false, reason: 'one or both referenced regions were not found' };
288
+ if (subject.kind === 'region-measurement') {
289
+ const measurement = deriveReferenceRequirementMeasurement(subject.measurement, deriveReferenceRegionGeometry(subjectRegion.rectangle), deriveReferenceRegionGeometry(relatedRegion.rectangle));
290
+ if (measurement === undefined)
291
+ return { available: false, reason: `"${subject.measurement}" is geometrically undefined for these two regions (they overlap on the relevant axis)` };
292
+ return { available: true, kind: 'numeric', value: measurement };
293
+ }
294
+ // subject.kind === 'region-relationship'. Every pairwise call site derives up to one record per
295
+ // family (see externalReferenceRegionRelationships.ts) for the SAME (subjectRegion, relatedRegion)
296
+ // pair - so the lookup must be scoped to the requested relationship's own family, never "the first
297
+ // record for this pair" (which would usually be a different family's record entirely).
298
+ const family = RELATIONSHIP_FAMILY_GROUPS.find((group) => group.includes(subject.relationship));
299
+ const derived = deriveReferenceRegionRelationships('adequacy-check', [subjectRegion, relatedRegion], options);
300
+ if (!derived.ok)
301
+ return { available: false, reason: derived.reason };
302
+ const direct = derived.graph.pairwiseRelationships.find((r) => family.includes(r.kind) && r.subjectRegion === subject.subjectRegion && r.relatedRegion === subject.relatedRegion);
303
+ if (direct)
304
+ return { available: true, kind: 'relationship', matches: direct.kind === subject.relationship };
305
+ const reversed = derived.graph.pairwiseRelationships.find((r) => family.includes(r.kind) && r.subjectRegion === subject.relatedRegion && r.relatedRegion === subject.subjectRegion);
306
+ if (reversed) {
307
+ return {
308
+ available: false,
309
+ reason: `relationship evidence for "${subject.subjectRegion}"/"${subject.relatedRegion}" was only derivable in the opposite region order (found "${reversed.kind}" from "${subject.relatedRegion}"'s perspective) - author this requirement with subjectRegion/relatedRegion matching the derivation order to evaluate it`,
310
+ };
311
+ }
312
+ return { available: false, reason: `no "${subject.relationship}" relationship evidence was derivable between "${subject.subjectRegion}" and "${subject.relatedRegion}"` };
313
+ }
314
+ // --- reference-side adequacy (structured, deterministic, never a numeric score) ---
315
+ export const REFERENCE_REQUIREMENT_ADEQUACY_STATES = ['adequate', 'partial', 'inadequate'];
316
+ /**
317
+ * Deliberately its own small, reference-owned vocabulary - not a reuse of
318
+ * domain/boundedAgentContext.ts#ADEQUACY_REASON_CODES, which describes
319
+ * runtime-target/static-correlation concerns that do not exist yet at this
320
+ * stage (see docs/CONTRACTS.md "v0.7 Prompt 3" for the full precedent
321
+ * review). Only two codes exist because only two conditions can make an
322
+ * already-*structurally-valid* requirement collection reference-inadequate:
323
+ * authoring zero requirements at all, or a validly-shaped relationship/
324
+ * measurement requirement whose evidence cannot actually be derived from the
325
+ * reference geometry. An unknown-region or malformed requirement is a
326
+ * construction-time validation failure (isValidReferenceRequirements) and
327
+ * never reaches adequacy at all.
328
+ */
329
+ export const REFERENCE_REQUIREMENT_ADEQUACY_REASON_CODES = ['no-selected-requirements', 'missing-reference-relationship-evidence'];
330
+ /**
331
+ * REFERENCE-SIDE adequacy only: does the reference definition itself contain
332
+ * enough evidence to understand every selected requirement? This never asks
333
+ * whether a runtime target/candidate exists (that is Prompt 4/5's
334
+ * responsibility). A reference with zero authored requirements is explicitly
335
+ * `inadequate` (request section 24F's documented decision: an
336
+ * externally-valid, region-rich reference is still not usable for a
337
+ * correction task until the user has actually selected what matters).
338
+ * Deterministic: reasons are ordered by authored requirement index, never by
339
+ * object-key iteration order.
340
+ */
341
+ export function deriveReferenceRequirementAdequacy(regions, requirements, options = {}) {
342
+ if (requirements.length === 0) {
343
+ return {
344
+ status: 'inadequate',
345
+ totalRequirements: 0,
346
+ evaluableRequirements: 0,
347
+ unavailableRequirements: 0,
348
+ reasons: [{ code: 'no-selected-requirements', detail: 'no design requirements have been selected for this reference' }],
349
+ };
350
+ }
351
+ const reasons = [];
352
+ let evaluableRequirements = 0;
353
+ for (const requirement of requirements) {
354
+ const expectation = deriveReferenceRequirementExpectation(requirement.subject, regions, options);
355
+ const unavailable = !expectation.available || (expectation.kind === 'relationship' && !expectation.matches);
356
+ if (unavailable) {
357
+ const detail = !expectation.available
358
+ ? expectation.reason
359
+ : `the reference does not exhibit the required "${requirement.subject.relationship}" relationship`;
360
+ reasons.push({ code: 'missing-reference-relationship-evidence', requirementId: requirement.requirementId, detail });
361
+ }
362
+ else {
363
+ evaluableRequirements += 1;
364
+ }
365
+ }
366
+ const unavailableRequirements = requirements.length - evaluableRequirements;
367
+ const status = unavailableRequirements === 0 ? 'adequate' : unavailableRequirements === requirements.length ? 'inadequate' : 'partial';
368
+ return { status, totalRequirements: requirements.length, evaluableRequirements, unavailableRequirements, reasons };
369
+ }
370
+ /**
371
+ * v0.7 Prompt 7 addition (additive, previously no structural validator
372
+ * existed for this already-frozen Prompt 3 shape): a defense-in-depth
373
+ * structural check, reused by `boundedAgentContext.ts` when accepting an
374
+ * already-computed `ReferenceRequirementAdequacy` value as part of a bounded
375
+ * fidelity projection. No change to `deriveReferenceRequirementAdequacy`'s
376
+ * own logic or the `ReferenceRequirementAdequacy` contract itself.
377
+ */
378
+ export function isValidReferenceRequirementAdequacy(value) {
379
+ if (!isPlainObject(value))
380
+ return false;
381
+ if (typeof value.status !== 'string' || !REFERENCE_REQUIREMENT_ADEQUACY_STATES.includes(value.status))
382
+ return false;
383
+ for (const key of ['totalRequirements', 'evaluableRequirements', 'unavailableRequirements']) {
384
+ if (typeof value[key] !== 'number' || !Number.isInteger(value[key]) || value[key] < 0)
385
+ return false;
386
+ }
387
+ if (!Array.isArray(value.reasons))
388
+ return false;
389
+ for (const reason of value.reasons) {
390
+ if (!isPlainObject(reason))
391
+ return false;
392
+ if (typeof reason.code !== 'string' || !REFERENCE_REQUIREMENT_ADEQUACY_REASON_CODES.includes(reason.code))
393
+ return false;
394
+ if (reason.requirementId !== undefined && !isNonEmptyString(reason.requirementId))
395
+ return false;
396
+ if (reason.detail !== undefined && typeof reason.detail !== 'string')
397
+ return false;
398
+ }
399
+ return true;
400
+ }
401
+ //# sourceMappingURL=externalReferenceRequirements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"externalReferenceRequirements.js","sourceRoot":"","sources":["../../src/domain/externalReferenceRequirements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,gCAAgC,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAGjK,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,EAC3B,+BAA+B,GAChC,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,kCAAkC,EAAE,MAAM,2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,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YAAE,OAAO,KAAK,CAAC;QACzC,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAE,2CAAiE,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QAC/I,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,aAAa,CAAC;YAAE,OAAO,KAAK,CAAC;QAChG,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;IACrF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * v0.7 Prompt 5 explicit reference-region <-> runtime-target binding.
3
+ * Answers only "which stable observer runtime target, if any, does this
4
+ * candidate observation resolve for each explicitly declared reference
5
+ * region?" - never automatic image-based matching, never geometry-based
6
+ * matching, never fuzzy name matching, never source-file/component
7
+ * ownership. A binding declaration is explicit user/configuration input: it
8
+ * asserts a conceptual correspondence between a Prompt 2 reference region
9
+ * and a v0.2 stable runtime target `name`, which this module then validates
10
+ * against an actual `ExternalReferenceArtifact` and a specific
11
+ * `ObservationArtifact` - it never discovers that correspondence itself.
12
+ *
13
+ * Two identity domains are deliberately kept separate throughout:
14
+ * `referenceRegion` (a Prompt 2 `ReferenceRegion.id`) and `runtimeTarget` (a
15
+ * v0.2 `NamedTarget.name`, resolved through the existing v0.2
16
+ * resolver/evidence only - this module never launches a browser, queries
17
+ * Chromium, resolves a CSS selector, or inspects a live DOM). Two strings
18
+ * with the same textual value in the two domains (e.g. a region id "header"
19
+ * and a target name "header") never bind to each other merely because they
20
+ * match - only an explicit declaration does that.
21
+ *
22
+ * Reuses, rather than duplicates:
23
+ * - `evaluateReferenceCandidateCompatibility` (v0.7 Prompt 4) as the
24
+ * compatibility gate - this module never re-implements viewport/theme/
25
+ * application-state/authenticated-state comparison.
26
+ * - `targetPresence` (v0.4 `comparisonEngine.ts`, exported additively by
27
+ * this prompt) as the single canonical "how do I read a
28
+ * TargetEvidenceRecord's resolution" rule - the same rule v0.4's own
29
+ * before/after target-presence comparison already uses.
30
+ * - `REFERENCE_REGION_ID_PATTERN` (v0.7 Prompt 2) for the reference-region
31
+ * half of a binding declaration.
32
+ *
33
+ * No new persisted artifact family is introduced. `evaluateReferenceRuntimeBindings`
34
+ * is a pure, synchronous function of an already-persisted
35
+ * `ExternalReferenceArtifact`, an already-persisted `ObservationArtifact`,
36
+ * and an in-memory binding-declaration collection; it mutates none of its
37
+ * inputs and produces no artifact of its own kind (see the Prompt 5 report
38
+ * for the persistence-decision rationale).
39
+ */
40
+ import type { ExternalReferenceArtifact } from './externalReference.js';
41
+ import type { ObservationArtifact, TargetSelectionStatus } from './schema.js';
42
+ import type { ComparabilityResult } from './comparison.js';
43
+ /**
44
+ * Independently-owned duplicate of request/request.ts's private
45
+ * `TARGET_NAME_RE` (`^[A-Za-z0-9_-]{1,64}$`) - same "stable, portable,
46
+ * log-safe identifier" convention already duplicated by
47
+ * `externalReferenceRegions.ts#REFERENCE_REGION_ID_PATTERN` and
48
+ * `explicitState.ts#STATE_LABEL_PATTERN`. Never imported cross-module, per
49
+ * the established per-module pattern-ownership convention.
50
+ */
51
+ export declare const RUNTIME_TARGET_NAME_PATTERN: RegExp;
52
+ /** Mirrors `MAX_REFERENCE_REGIONS` (20) - a binding declaration collection is authoring input over the same region set, so the same bound applies; independently owned, not imported, since the two constants describe different collections that merely happen to share a value. */
53
+ export declare const MAX_REFERENCE_RUNTIME_BINDINGS = 20;
54
+ export declare const REFERENCE_RUNTIME_BINDING_STATUSES: readonly ["bound", "ambiguous", "unavailable"];
55
+ export type ReferenceRuntimeBindingStatus = (typeof REFERENCE_RUNTIME_BINDING_STATUSES)[number];
56
+ /**
57
+ * Closed, bounded reason vocabulary - one code per distinct evidence
58
+ * situation the evaluator can actually observe, mirroring the
59
+ * "one diagnostic code per validation domain" convention already used by
60
+ * `DIAGNOSTIC_CODES`. Never a place for a free-form or source-derived
61
+ * explanation; `detail` (free text) carries the human-readable specifics.
62
+ */
63
+ export declare const REFERENCE_RUNTIME_BINDING_REASON_CODES: readonly ["runtime-target-not-configured", "runtime-target-not-found", "runtime-target-ambiguous", "runtime-target-evidence-unavailable"];
64
+ export type ReferenceRuntimeBindingReasonCode = (typeof REFERENCE_RUNTIME_BINDING_REASON_CODES)[number];
65
+ /** One explicit, user/configuration-authored correspondence declaration. Both fields are always exact-match identifiers - never a selector, never a fuzzy label. */
66
+ export interface ReferenceRuntimeBindingDeclaration {
67
+ referenceRegion: string;
68
+ runtimeTarget: string;
69
+ }
70
+ export type ReferenceRuntimeBindingValidationResult = {
71
+ valid: true;
72
+ } | {
73
+ valid: false;
74
+ reason: string;
75
+ };
76
+ /**
77
+ * Structural, candidate-independent validation: shape, bounds, uniqueness,
78
+ * and reference-region existence against the supplied
79
+ * `ExternalReferenceArtifact` only - this never touches a candidate
80
+ * observation (runtime-target availability is inherently per-candidate; see
81
+ * `evaluateReferenceRuntimeBindings`). A reference with no `regions` at all
82
+ * (Prompt 1/2-era artifact, or one that simply declared none) makes every
83
+ * binding declaration fail closed - there is nothing to bind against.
84
+ *
85
+ * Duplicate/conflicting-subject rule (mirrors Prompt 3's requirement-subject
86
+ * uniqueness rule exactly): no two declarations may name the same
87
+ * `referenceRegion` (case-insensitively), regardless of whether their
88
+ * `runtimeTarget` values agree (an exact duplicate) or disagree (a
89
+ * conflict) - both are rejected identically, fail-closed, never resolved by
90
+ * silently keeping the first. The reverse - several distinct reference
91
+ * regions naming the same `runtimeTarget` - is deliberately allowed: two
92
+ * design sub-regions may legitimately correspond to one runtime container
93
+ * element, whereas one region needing several runtime targets would be
94
+ * inherently ambiguous about which target represents it (the "one region,
95
+ * one explicit primary target" rule).
96
+ */
97
+ export declare function isValidReferenceRuntimeBindingDeclarations(value: unknown, reference: ExternalReferenceArtifact): ReferenceRuntimeBindingValidationResult;
98
+ /** Provenance-rich per-declaration outcome. `reasonCode`/`detail` are always present when `status !== 'bound'`; `targetResolutionStatus`/`targetVisible` are populated only when the underlying v0.2 evidence actually carries them (never fabricated). */
99
+ export interface ReferenceRuntimeBindingResult {
100
+ referenceRegion: string;
101
+ runtimeTarget: string;
102
+ status: ReferenceRuntimeBindingStatus;
103
+ reasonCode?: ReferenceRuntimeBindingReasonCode;
104
+ detail: string;
105
+ targetResolutionStatus?: TargetSelectionStatus;
106
+ /**
107
+ * Provenance only - visibility never changes `status`. A uniquely
108
+ * resolved (`matched`) target that happens to be hidden still has a
109
+ * stable identity and is reported `bound`; whether a hidden target's
110
+ * evidence is *usable for later fidelity evaluation* is a distinct
111
+ * question this prompt does not answer (see the Prompt 5 report's
112
+ * "hidden-target decision").
113
+ */
114
+ targetVisible?: boolean;
115
+ }
116
+ export interface ReferenceRuntimeBindingEvaluation {
117
+ referenceId: string;
118
+ referenceRequestId: string;
119
+ candidateObservationId: string;
120
+ candidateRequestId: string;
121
+ /** Reused verbatim from v0.7 Prompt 4 - never recomputed or duplicated here. */
122
+ compatibility: ComparabilityResult;
123
+ /**
124
+ * Empty exactly when `compatibility.state === 'incomparable'` - Prompt 4's
125
+ * compatibility blocker is represented solely through the `compatibility`
126
+ * field above, never through a binding-local "incompatible" status or a
127
+ * fabricated per-declaration result.
128
+ */
129
+ bindings: ReferenceRuntimeBindingResult[];
130
+ }
131
+ export type EvaluateReferenceRuntimeBindingsResult = {
132
+ ok: true;
133
+ evaluation: ReferenceRuntimeBindingEvaluation;
134
+ } | {
135
+ ok: false;
136
+ reason: string;
137
+ };
138
+ /**
139
+ * Pure and synchronous: no browser, no filesystem, no network, no second
140
+ * target resolver. Validates both artifacts and the declaration collection,
141
+ * runs the Prompt 4 compatibility gate exactly once, and - only when the
142
+ * candidate is not `incomparable` with the reference - evaluates each
143
+ * declaration in authored order against the candidate's own already-
144
+ * captured `requestConfig.targets`/`targetEvidence`. Mutates neither input.
145
+ */
146
+ export declare function evaluateReferenceRuntimeBindings(reference: ExternalReferenceArtifact, candidate: ObservationArtifact, declarations: readonly ReferenceRuntimeBindingDeclaration[]): EvaluateReferenceRuntimeBindingsResult;