my-frontend-observer 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +130 -0
- package/README.md +75 -5
- package/dist/application/externalReferencePersistenceService.d.ts +75 -0
- package/dist/application/externalReferencePersistenceService.js +182 -0
- package/dist/application/externalReferencePersistenceService.js.map +1 -0
- package/dist/application/referenceFidelityEvaluationService.d.ts +28 -0
- package/dist/application/referenceFidelityEvaluationService.js +45 -0
- package/dist/application/referenceFidelityEvaluationService.js.map +1 -0
- package/dist/artifacts/externalReferenceArtifactReader.d.ts +18 -0
- package/dist/artifacts/externalReferenceArtifactReader.js +35 -0
- package/dist/artifacts/externalReferenceArtifactReader.js.map +1 -0
- package/dist/artifacts/externalReferenceArtifactWriter.d.ts +44 -0
- package/dist/artifacts/externalReferenceArtifactWriter.js +77 -0
- package/dist/artifacts/externalReferenceArtifactWriter.js.map +1 -0
- package/dist/cli.js +1141 -1
- package/dist/cli.js.map +1 -1
- package/dist/domain/boundedAgentContext.d.ts +52 -0
- package/dist/domain/boundedAgentContext.js +44 -1
- package/dist/domain/boundedAgentContext.js.map +1 -1
- package/dist/domain/boundedAgentContextIdentity.d.ts +16 -6
- package/dist/domain/boundedAgentContextIdentity.js +22 -6
- package/dist/domain/boundedAgentContextIdentity.js.map +1 -1
- package/dist/domain/boundedAgentContextProjection.d.ts +11 -0
- package/dist/domain/boundedAgentContextProjection.js +32 -4
- package/dist/domain/boundedAgentContextProjection.js.map +1 -1
- package/dist/domain/comparison.d.ts +23 -1
- package/dist/domain/comparison.js +27 -1
- package/dist/domain/comparison.js.map +1 -1
- package/dist/domain/comparisonEngine.d.ts +34 -6
- package/dist/domain/comparisonEngine.js +48 -8
- package/dist/domain/comparisonEngine.js.map +1 -1
- package/dist/domain/diagnostics.d.ts +1 -1
- package/dist/domain/diagnostics.js +20 -0
- package/dist/domain/diagnostics.js.map +1 -1
- package/dist/domain/explicitState.d.ts +40 -0
- package/dist/domain/explicitState.js +54 -0
- package/dist/domain/explicitState.js.map +1 -0
- package/dist/domain/externalReference.d.ts +158 -0
- package/dist/domain/externalReference.js +167 -0
- package/dist/domain/externalReference.js.map +1 -0
- package/dist/domain/externalReferenceApplicability.d.ts +43 -0
- package/dist/domain/externalReferenceApplicability.js +52 -0
- package/dist/domain/externalReferenceApplicability.js.map +1 -0
- package/dist/domain/externalReferenceCompatibility.d.ts +40 -0
- package/dist/domain/externalReferenceCompatibility.js +48 -0
- package/dist/domain/externalReferenceCompatibility.js.map +1 -0
- package/dist/domain/externalReferenceFidelity.d.ts +171 -0
- package/dist/domain/externalReferenceFidelity.js +419 -0
- package/dist/domain/externalReferenceFidelity.js.map +1 -0
- package/dist/domain/externalReferenceIdentity.d.ts +38 -0
- package/dist/domain/externalReferenceIdentity.js +70 -0
- package/dist/domain/externalReferenceIdentity.js.map +1 -0
- package/dist/domain/externalReferenceImage.d.ts +35 -0
- package/dist/domain/externalReferenceImage.js +160 -0
- package/dist/domain/externalReferenceImage.js.map +1 -0
- package/dist/domain/externalReferenceRegionRelationships.d.ts +63 -0
- package/dist/domain/externalReferenceRegionRelationships.js +98 -0
- package/dist/domain/externalReferenceRegionRelationships.js.map +1 -0
- package/dist/domain/externalReferenceRegions.d.ts +65 -0
- package/dist/domain/externalReferenceRegions.js +105 -0
- package/dist/domain/externalReferenceRegions.js.map +1 -0
- package/dist/domain/externalReferenceRequirementIdentity.d.ts +12 -0
- package/dist/domain/externalReferenceRequirementIdentity.js +35 -0
- package/dist/domain/externalReferenceRequirementIdentity.js.map +1 -0
- package/dist/domain/externalReferenceRequirements.d.ts +215 -0
- package/dist/domain/externalReferenceRequirements.js +401 -0
- package/dist/domain/externalReferenceRequirements.js.map +1 -0
- package/dist/domain/externalReferenceRuntimeBinding.d.ts +146 -0
- package/dist/domain/externalReferenceRuntimeBinding.js +183 -0
- package/dist/domain/externalReferenceRuntimeBinding.js.map +1 -0
- package/dist/domain/identity.d.ts +11 -8
- package/dist/domain/identity.js +12 -8
- package/dist/domain/identity.js.map +1 -1
- package/dist/domain/referenceCorrectionIdentity.d.ts +40 -0
- package/dist/domain/referenceCorrectionIdentity.js +77 -0
- package/dist/domain/referenceCorrectionIdentity.js.map +1 -0
- package/dist/domain/referenceCorrectionWorkflow.d.ts +160 -0
- package/dist/domain/referenceCorrectionWorkflow.js +165 -0
- package/dist/domain/referenceCorrectionWorkflow.js.map +1 -0
- package/dist/domain/referenceFidelityProjection.d.ts +65 -0
- package/dist/domain/referenceFidelityProjection.js +135 -0
- package/dist/domain/referenceFidelityProjection.js.map +1 -0
- package/dist/domain/relationships.d.ts +43 -1
- package/dist/domain/relationships.js +15 -6
- package/dist/domain/relationships.js.map +1 -1
- package/dist/domain/schema.js +6 -0
- package/dist/domain/schema.js.map +1 -1
- package/dist/index.d.ts +43 -4
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/request/request.d.ts +12 -0
- package/dist/request/request.js +12 -0
- package/dist/request/request.js.map +1 -1
- package/dist/viewer/assets/index-CN_yb9Uf.css +1 -0
- package/dist/viewer/assets/index-D0pn5vP_.js +9 -0
- package/dist/viewer/icons/icon-192.png +0 -0
- package/dist/viewer/icons/icon-512.png +0 -0
- package/dist/viewer/index.html +15 -0
- package/dist/viewer/manifest.webmanifest +1 -0
- package/dist/viewer/registerSW.js +1 -0
- package/dist/viewer/sw.js +1 -0
- package/dist/viewer/workbox-9c191d2f.js +1 -0
- package/dist/viewerServer/context.d.ts +48 -0
- package/dist/viewerServer/context.js +60 -0
- package/dist/viewerServer/context.js.map +1 -0
- package/dist/viewerServer/evidence/classify.d.ts +59 -0
- package/dist/viewerServer/evidence/classify.js +124 -0
- package/dist/viewerServer/evidence/classify.js.map +1 -0
- package/dist/viewerServer/evidence/comparisonView.d.ts +28 -0
- package/dist/viewerServer/evidence/comparisonView.js +43 -0
- package/dist/viewerServer/evidence/comparisonView.js.map +1 -0
- package/dist/viewerServer/evidence/contextSourceView.d.ts +25 -0
- package/dist/viewerServer/evidence/contextSourceView.js +20 -0
- package/dist/viewerServer/evidence/contextSourceView.js.map +1 -0
- package/dist/viewerServer/evidence/discovery.d.ts +31 -0
- package/dist/viewerServer/evidence/discovery.js +78 -0
- package/dist/viewerServer/evidence/discovery.js.map +1 -0
- package/dist/viewerServer/evidence/evaluationView.d.ts +32 -0
- package/dist/viewerServer/evidence/evaluationView.js +50 -0
- package/dist/viewerServer/evidence/evaluationView.js.map +1 -0
- package/dist/viewerServer/evidence/handles.d.ts +21 -0
- package/dist/viewerServer/evidence/handles.js +43 -0
- package/dist/viewerServer/evidence/handles.js.map +1 -0
- package/dist/viewerServer/evidence/index.d.ts +41 -0
- package/dist/viewerServer/evidence/index.js +80 -0
- package/dist/viewerServer/evidence/index.js.map +1 -0
- package/dist/viewerServer/evidence/limits.d.ts +27 -0
- package/dist/viewerServer/evidence/limits.js +28 -0
- package/dist/viewerServer/evidence/limits.js.map +1 -0
- package/dist/viewerServer/evidence/linkedEvidence.d.ts +43 -0
- package/dist/viewerServer/evidence/linkedEvidence.js +151 -0
- package/dist/viewerServer/evidence/linkedEvidence.js.map +1 -0
- package/dist/viewerServer/evidence/mediaResolver.d.ts +16 -0
- package/dist/viewerServer/evidence/mediaResolver.js +85 -0
- package/dist/viewerServer/evidence/mediaResolver.js.map +1 -0
- package/dist/viewerServer/evidence/observationView.d.ts +29 -0
- package/dist/viewerServer/evidence/observationView.js +46 -0
- package/dist/viewerServer/evidence/observationView.js.map +1 -0
- package/dist/viewerServer/evidence/pathSafety.d.ts +11 -0
- package/dist/viewerServer/evidence/pathSafety.js +31 -0
- package/dist/viewerServer/evidence/pathSafety.js.map +1 -0
- package/dist/viewerServer/evidence/projection.d.ts +54 -0
- package/dist/viewerServer/evidence/projection.js +152 -0
- package/dist/viewerServer/evidence/projection.js.map +1 -0
- package/dist/viewerServer/evidence/referenceView.d.ts +133 -0
- package/dist/viewerServer/evidence/referenceView.js +169 -0
- package/dist/viewerServer/evidence/referenceView.js.map +1 -0
- package/dist/viewerServer/httpServer.d.ts +25 -0
- package/dist/viewerServer/httpServer.js +381 -0
- package/dist/viewerServer/httpServer.js.map +1 -0
- package/dist/viewerServer/openBrowser.d.ts +7 -0
- package/dist/viewerServer/openBrowser.js +32 -0
- package/dist/viewerServer/openBrowser.js.map +1 -0
- package/dist/viewerServer/port.d.ts +16 -0
- package/dist/viewerServer/port.js +19 -0
- package/dist/viewerServer/port.js.map +1 -0
- package/dist/viewerServer/viewerService.d.ts +57 -0
- package/dist/viewerServer/viewerService.js +83 -0
- package/dist/viewerServer/viewerService.js.map +1 -0
- package/docs/ARCHITECTURE.md +899 -11
- package/docs/CI_CD.md +82 -0
- package/docs/COMMANDS.md +369 -2
- package/docs/CONTRACTS.md +1353 -12
- package/docs/CURRENT_STATE.md +593 -15
- package/docs/DEVELOPMENT.md +29 -8
- package/docs/DOCUMENTATION_PRESERVATION_POLICY.md +21 -4
- package/docs/PROJECT_DESCRIPTION.md +564 -113
- package/docs/PROJECT_MILESTONES.md +550 -97
- package/docs/PROJECT_OVERVIEW.md +71 -14
- package/docs/QUICKSTART.md +13 -0
- package/docs/RELEASE.md +28 -21
- package/docs/ROADMAP.md +262 -99
- package/docs/SECURITY.md +142 -5
- package/docs/WORKFLOWS.md +423 -23
- package/docs/plans/v0.8-implementation-plan.md +655 -0
- package/docs/reports/v0.7-bounded-fidelity-context-prompt7.md +243 -0
- package/docs/reports/v0.7-implementation-completeness-documentation-reconciliation.md +497 -0
- package/docs/reports/v0.7-pre-release-readiness.md +337 -0
- package/docs/reports/v0.7-reference-binding-prompt5.md +223 -0
- package/docs/reports/v0.7-reference-compatibility-prompt4.md +234 -0
- package/docs/reports/v0.7-reference-correction-workflow-prompt8.md +222 -0
- package/docs/reports/v0.7-reference-fidelity-prompt6.md +216 -0
- package/docs/reports/v0.7-reference-foundation-prompt1.md +151 -0
- package/docs/reports/v0.7-reference-regions-prompt2.md +195 -0
- package/docs/reports/v0.7-reference-requirements-prompt3.md +217 -0
- package/docs/reports/v0.7-release-prep.md +423 -0
- package/docs/reports/v0.8-binding-fidelity-interaction-batch6.md +279 -0
- package/docs/reports/v0.8-bounded-context-correlation-batch7.md +233 -0
- package/docs/reports/v0.8-comparison-contract-inspection-batch4.md +279 -0
- package/docs/reports/v0.8-evidence-index-readers-batch2.md +247 -0
- package/docs/reports/v0.8-implementation-completeness-documentation-reconciliation.md +741 -0
- package/docs/reports/v0.8-integrated-viewer-acceptance-batch8.md +128 -0
- package/docs/reports/v0.8-observation-svg-inspection-batch3.md +223 -0
- package/docs/reports/v0.8-prerelease-readiness-cross-platform-security-code-rot.md +687 -0
- package/docs/reports/v0.8-reference-candidate-inspection-batch5.md +232 -0
- package/docs/reports/v0.8-viewer-runtime-pwa-batch1.md +278 -0
- package/package.json +12 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,135 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
## 0.8.0 - 2026-09-10
|
|
6
|
+
|
|
7
|
+
Interactive Local Observation Viewer.
|
|
8
|
+
|
|
9
|
+
- New `view` command: starts a loopback-only (`127.0.0.1`) Node server
|
|
10
|
+
serving a React + TypeScript + Vite viewer application, usable in a normal
|
|
11
|
+
browser or as an installed Progressive Web App, over an existing evidence
|
|
12
|
+
root (`--root`). Metadata-first evidence discovery and on-demand
|
|
13
|
+
artifact/media loading; never mutates target source or any Observer
|
|
14
|
+
evidence artifact.
|
|
15
|
+
- Observation inspection: screenshot plus SVG target overlays, geometry,
|
|
16
|
+
semantics, visibility/overflow/scroll evidence, and on-demand layout
|
|
17
|
+
relationships.
|
|
18
|
+
- Comparison/contract inspection: before/after side-by-side views and
|
|
19
|
+
contract/change-scope evaluation results, including the required
|
|
20
|
+
protected/preserved-failure safety case (a locally successful requested
|
|
21
|
+
change alongside a genuine protected/preserved regression, shown as
|
|
22
|
+
overall `FAIL`).
|
|
23
|
+
- External reference/candidate inspection: reference image and region
|
|
24
|
+
overlays, explicit (never auto-selected) candidate selection,
|
|
25
|
+
reference/candidate compatibility and applicability.
|
|
26
|
+
- Explicit reference-region/runtime-target binding cross-selection
|
|
27
|
+
(`--bindings-file`), independent bounded zoom/pan, conditional view lock,
|
|
28
|
+
and on-demand reference-fidelity evaluation shown independently alongside
|
|
29
|
+
any selected contract evaluation.
|
|
30
|
+
- Bounded agent context inspection (`--context-file`): session-only display
|
|
31
|
+
of context identity, adequacy, omissions/truncations, and runtime/static
|
|
32
|
+
correlation, plus safe raw-evidence navigation. The viewer never rebuilds
|
|
33
|
+
a bounded context or its correlation and never runs `@dailephd/my-dev-kit`.
|
|
34
|
+
- PWA hardening: real service-worker registration, an application-shell
|
|
35
|
+
precache that excludes `/api/` routes, and a proven server-down behavior
|
|
36
|
+
that never presents stale evidence as current.
|
|
37
|
+
- No second evidence engine: every canonical result the viewer displays is
|
|
38
|
+
produced by the same single engine the CLI uses, called from at most one
|
|
39
|
+
designated server-side call site.
|
|
40
|
+
- Security hardening found during pre-release readiness: the viewer's media
|
|
41
|
+
route now rejects any evidence filename that is itself a symlink/junction
|
|
42
|
+
pointing outside the evidence root, instead of following it.
|
|
43
|
+
- Cross-platform packed-candidate validation: the pre-version-bump
|
|
44
|
+
implementation candidate tarball `my-frontend-observer-0.7.0.tgz`
|
|
45
|
+
(SHA-256 `b80729bc64b3b01378effd2b8aa3b7743ccedc46b3148ba0b1ff1ae5a4b68c55`)
|
|
46
|
+
was hash-verified and proven on Windows, Linux, and macOS, including an
|
|
47
|
+
installed-package smoke of the new `view` command (loopback binding,
|
|
48
|
+
read-only API, path containment, SVG overlay/media, service-worker
|
|
49
|
+
registration, the PWA no-authoritative-cache boundary, and the
|
|
50
|
+
server-down stale-evidence hard gate) alongside every pre-existing
|
|
51
|
+
v0.1-v0.7 packed behavior, before this release's version bump - see
|
|
52
|
+
`docs/reports/v0.8-prerelease-readiness-cross-platform-security-code-rot.md`.
|
|
53
|
+
|
|
54
|
+
## 0.7.0 - 2026-09-06
|
|
55
|
+
|
|
56
|
+
End-to-End Coding-Agent Frontend Change Review.
|
|
57
|
+
|
|
58
|
+
- External-reference artifact and lifecycle: `import-reference`/
|
|
59
|
+
`approve-reference` persist an externally supplied PNG/JPEG/WebP
|
|
60
|
+
design-reference image (header-only format/dimension detection - no
|
|
61
|
+
decode, no OCR, no computer vision) through an explicit two-state
|
|
62
|
+
(`imported`/`approved`) lifecycle. Supersession is represented only as a
|
|
63
|
+
forward pointer to a newer artifact - an existing persisted artifact's own
|
|
64
|
+
manifest is never rewritten.
|
|
65
|
+
- Explicit reference regions and geometry relationships: user/configuration-
|
|
66
|
+
authored rectangles over the reference image, related to each other
|
|
67
|
+
through the same six geometry-only relationship families (horizontal
|
|
68
|
+
order, vertical order, area overlap, relative width, geometric fit,
|
|
69
|
+
vertical sequencing) already used for runtime targets - derived on demand,
|
|
70
|
+
never persisted.
|
|
71
|
+
- Selected design requirements and tolerance semantics: explicit,
|
|
72
|
+
never-inferred requirements over region properties, region-to-region
|
|
73
|
+
relationships, and derived two-region measurements, reusing v0.5's
|
|
74
|
+
requested/expected-dependent/protected/preserved categories directly.
|
|
75
|
+
Three reference-owned tolerance kinds (`exact`/`absolute-reference-px`/
|
|
76
|
+
`percent`) stay distinct from runtime CSS-pixel comparison tolerances.
|
|
77
|
+
- Reference-evidence adequacy: `adequate`/`partial`/`inadequate` reporting on
|
|
78
|
+
whether a reference's own definition actually supports its selected
|
|
79
|
+
requirements, independent of any runtime target or candidate.
|
|
80
|
+
- Explicit applicability and candidate-state compatibility: a shared, closed
|
|
81
|
+
state model (`theme`/`applicationState`/`authenticatedState`, plus an
|
|
82
|
+
applicable CSS-pixel `viewport`) declares which runtime frontend state a
|
|
83
|
+
reference represents. `evaluateReferenceCandidateCompatibility` and
|
|
84
|
+
`observe`'s new `--state-file` reuse v0.4's comparability vocabulary to
|
|
85
|
+
determine whether a reference and a candidate describe the same state -
|
|
86
|
+
an undeclared dimension is never fabricated as a match or a mismatch.
|
|
87
|
+
- Explicit reference-region-to-runtime-target binding: fidelity evaluation
|
|
88
|
+
requires an explicit `{referenceRegion, runtimeTarget}` declaration for
|
|
89
|
+
every region a requirement depends on - never inferred from geometry,
|
|
90
|
+
matching names, or source code.
|
|
91
|
+
- Structured reference-vs-candidate fidelity evaluation: `evaluate-
|
|
92
|
+
reference-fidelity --reference --candidate [--bindings-file] [--enforce]`
|
|
93
|
+
evaluates every selected requirement against live candidate evidence
|
|
94
|
+
through one explicit reference-image-pixel-to-CSS-pixel coordinate scale,
|
|
95
|
+
producing an honest `not-evaluated`/`pass`/`fail` result that never
|
|
96
|
+
fabricates a verdict past a blocked reference-adequacy or
|
|
97
|
+
reference/candidate-compatibility gate.
|
|
98
|
+
- Bounded fidelity integration with v0.6 agent context: `projectBoundedAgentContext`
|
|
99
|
+
gained an optional `fidelity` input so fidelity mismatches compete for the
|
|
100
|
+
same bounded required/permitted-target allocation and adequacy machinery
|
|
101
|
+
v0.5 contract clauses already use - a `not-evaluated` fidelity always
|
|
102
|
+
degrades adequacy rather than being silently reported as "no problems".
|
|
103
|
+
- End-to-end external-reference correction workflow: the programmatic,
|
|
104
|
+
library-only `prepareReferenceCorrection`/`reviewReferenceCorrectionAttempt`
|
|
105
|
+
compose reference fidelity, v0.4 comparison, and v0.5 contract evaluation
|
|
106
|
+
into one overall result - matching the reference is necessary but never
|
|
107
|
+
sufficient, so a candidate that visually satisfies the reference while
|
|
108
|
+
regressing an active protected/preserved contract clause still resolves to
|
|
109
|
+
overall `FAIL`. Neither function edits target source, launches a browser,
|
|
110
|
+
or calls a remote AI provider; an external implementation actor (a human
|
|
111
|
+
or a coding agent) makes the actual change between review attempts.
|
|
112
|
+
- Real-browser regression protection: a dedicated Chromium-driven test
|
|
113
|
+
proves a full success correction, a protected-regression case, a
|
|
114
|
+
two-attempt correction iteration against the same baseline, and an
|
|
115
|
+
incompatible-viewport blocking case, all against a disposable,
|
|
116
|
+
repository-local fixture copy the observer itself never edits.
|
|
117
|
+
- Three new public CLI commands (`import-reference`, `approve-reference`,
|
|
118
|
+
`evaluate-reference-fidelity`) and a complete new programmatic export
|
|
119
|
+
surface (`src/index.ts`) for the reference/region/requirement/
|
|
120
|
+
applicability/compatibility/binding/fidelity/correction-workflow types and
|
|
121
|
+
functions. External-reference schema is `1.0.0`, independent of the
|
|
122
|
+
observation, comparison, frontend-contract, evaluation, and
|
|
123
|
+
bounded-agent-context schema versions, none of which changed.
|
|
124
|
+
- Cross-platform packed-candidate validation: the pre-version-bump
|
|
125
|
+
implementation candidate tarball `my-frontend-observer-0.6.0.tgz`
|
|
126
|
+
(SHA-256 `0347b1f3cfd5d311e13b405c0c2fbc2f507e250cb63223d58b4d2d31df029414`)
|
|
127
|
+
was hash-verified and proven on Windows, Linux, and macOS, including an
|
|
128
|
+
installed-package smoke of every new v0.7 CLI command and programmatic
|
|
129
|
+
export alongside every pre-existing v0.1-v0.6 packed behavior, before this
|
|
130
|
+
release's version bump - see
|
|
131
|
+
`docs/reports/v0.7-pre-release-readiness.md`.
|
|
132
|
+
|
|
3
133
|
## 0.6.0 - 2026-08-19
|
|
4
134
|
|
|
5
135
|
Bounded Agent Context and Native my-dev-kit Ecosystem Integration.
|
package/README.md
CHANGED
|
@@ -6,9 +6,11 @@ in [docs/PROJECT_DESCRIPTION.md](docs/PROJECT_DESCRIPTION.md).
|
|
|
6
6
|
|
|
7
7
|
## Current status
|
|
8
8
|
|
|
9
|
-
`v0.
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
`v0.8.0`, Interactive Local Observation Viewer, is the current published
|
|
10
|
+
release. It builds on `v0.7.0`, End-to-End Coding-Agent Frontend Change
|
|
11
|
+
Review, `v0.6.0`, Bounded Agent Context and Native my-dev-kit Ecosystem
|
|
12
|
+
Integration, and `v0.5.0`, Executable Frontend Contracts and Explicit Change
|
|
13
|
+
Scope: `my-frontend-observer observe` launches a real,
|
|
12
14
|
sandboxed Chromium browser, enforces a loopback-only safety policy, captures
|
|
13
15
|
a viewport screenshot plus bounded page/target evidence, and persists it as
|
|
14
16
|
one portable `manifest.json` + `screenshot.png` artifact (observation schema
|
|
@@ -132,6 +134,73 @@ exported from `src/index.ts` (bounded-agent-context schema `1.0.0`). See
|
|
|
132
134
|
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for how it fits the existing
|
|
133
135
|
pipeline.
|
|
134
136
|
|
|
137
|
+
### External-reference correction workflow (v0.7.0)
|
|
138
|
+
|
|
139
|
+
`import-reference` and
|
|
140
|
+
`approve-reference` persist an externally supplied design-reference image
|
|
141
|
+
(with optional regions, selected requirements/tolerances, and applicability
|
|
142
|
+
state); `evaluate-reference-fidelity --reference --candidate
|
|
143
|
+
[--bindings-file] [--enforce]` compares an already-persisted candidate
|
|
144
|
+
observation against it, gated by reference adequacy, reference/candidate
|
|
145
|
+
compatibility, and explicit region-to-target bindings:
|
|
146
|
+
|
|
147
|
+
```powershell
|
|
148
|
+
my-frontend-observer import-reference design.png --output references --regions-file regions.json --requirements-file requirements.json --applicability-file applicability.json
|
|
149
|
+
my-frontend-observer approve-reference --reference references/<id> --output references
|
|
150
|
+
my-frontend-observer evaluate-reference-fidelity --reference references/<approved-id> --candidate observations/<id> --bindings-file bindings.json
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
(From a source checkout, use `node dist/cli.js import-reference ...` etc.
|
|
154
|
+
instead.)
|
|
155
|
+
|
|
156
|
+
`import-reference`/`approve-reference`/`evaluate-reference-fidelity` never
|
|
157
|
+
launch a browser or edit any file outside their own declared output
|
|
158
|
+
location; `evaluate-reference-fidelity` persists nothing. A programmatic,
|
|
159
|
+
library-only correction-workflow coordinator
|
|
160
|
+
(`prepareReferenceCorrection`/`reviewReferenceCorrectionAttempt`, exported
|
|
161
|
+
from `src/index.ts`, no CLI command) composes the full cycle - reference
|
|
162
|
+
fidelity (reused unchanged) plus canonical v0.4 comparison and v0.5 contract
|
|
163
|
+
evaluation - into one overall result: matching the reference is necessary
|
|
164
|
+
but never sufficient, so a candidate that visually satisfies the reference
|
|
165
|
+
while regressing an active protected/preserved contract clause still
|
|
166
|
+
resolves to overall `FAIL`. my-frontend-observer never edits target source
|
|
167
|
+
itself; an external implementation actor (a human or a coding agent, never
|
|
168
|
+
this package) makes the actual source change between review attempts. See
|
|
169
|
+
[docs/CONTRACTS.md](docs/CONTRACTS.md) and
|
|
170
|
+
[docs/WORKFLOWS.md](docs/WORKFLOWS.md) for the exact contract and workflow,
|
|
171
|
+
and [docs/CURRENT_STATE.md](docs/CURRENT_STATE.md) for the full
|
|
172
|
+
implementation record.
|
|
173
|
+
|
|
174
|
+
### Interactive local viewer (v0.8.0)
|
|
175
|
+
|
|
176
|
+
`my-frontend-observer view --root <evidence-root> [--bindings-file <json-file>] [--context-file <json-file>] [--port <n>] [--no-open]`
|
|
177
|
+
starts a loopback-only (`127.0.0.1`) Node server that serves a React +
|
|
178
|
+
TypeScript + Vite viewer application - usable in a normal browser or as an
|
|
179
|
+
installed Progressive Web App - over the same evidence root used by every
|
|
180
|
+
other command above. It never edits target source, never mutates any
|
|
181
|
+
evidence artifact, and never runs `@dailephd/my-dev-kit`:
|
|
182
|
+
|
|
183
|
+
```powershell
|
|
184
|
+
my-frontend-observer view --root observations --port 4319 --no-open
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
(From a source checkout, use `node dist/cli.js view ...` instead.)
|
|
188
|
+
|
|
189
|
+
The viewer shows observation screenshots and SVG target overlays,
|
|
190
|
+
before/after comparisons and contract/change-scope results, approved
|
|
191
|
+
external references beside candidate observations with explicit binding
|
|
192
|
+
cross-selection and on-demand fidelity evaluation, and - when
|
|
193
|
+
`--context-file` supplies one - a read-only inspection of a bounded agent
|
|
194
|
+
context's adequacy, omissions/truncations, and runtime/static correlation.
|
|
195
|
+
Both `--bindings-file` and `--context-file` are explicit, session-only
|
|
196
|
+
input: read once at startup, held only in server memory, never persisted,
|
|
197
|
+
and never exposed as a filesystem path to the browser. See
|
|
198
|
+
[docs/COMMANDS.md](docs/COMMANDS.md#view) for the full flag reference and
|
|
199
|
+
[docs/WORKFLOWS.md](docs/WORKFLOWS.md) for the viewer workflow.
|
|
200
|
+
|
|
201
|
+
See [docs/CURRENT_STATE.md](docs/CURRENT_STATE.md) for the exact current
|
|
202
|
+
implementation and release state.
|
|
203
|
+
|
|
135
204
|
Validation:
|
|
136
205
|
|
|
137
206
|
```powershell
|
|
@@ -139,6 +208,7 @@ npm run typecheck
|
|
|
139
208
|
npm run lint
|
|
140
209
|
npm test
|
|
141
210
|
npm run test:browser
|
|
211
|
+
npm run test:security
|
|
142
212
|
npm run build
|
|
143
213
|
npm run check:docs
|
|
144
214
|
```
|
|
@@ -149,8 +219,8 @@ Planning authorities:
|
|
|
149
219
|
intent and responsibility boundaries.
|
|
150
220
|
- [Project Milestones](docs/PROJECT_MILESTONES.md): complete ordered capability
|
|
151
221
|
design and cross-milestone rules.
|
|
152
|
-
- [ROADMAP](docs/ROADMAP.md): version-level requirements; v0.1-v0.
|
|
153
|
-
released
|
|
222
|
+
- [ROADMAP](docs/ROADMAP.md): version-level requirements; v0.1-v0.8 are
|
|
223
|
+
released; v0.9+ remain future.
|
|
154
224
|
- [Current State](docs/CURRENT_STATE.md): retained scaffold and release state.
|
|
155
225
|
|
|
156
226
|
No sibling ecosystem repository is a runtime dependency of the retained
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Diagnostic } from '../domain/diagnostics.js';
|
|
2
|
+
import type { ReferenceRegion } from '../domain/externalReferenceRegions.js';
|
|
3
|
+
import type { RawReferenceRequirement, ReferenceRequirementAdequacy } from '../domain/externalReferenceRequirements.js';
|
|
4
|
+
import type { ExternalReferenceApplicability } from '../domain/externalReferenceApplicability.js';
|
|
5
|
+
import type { WriteExternalReferenceArtifactOptions } from '../artifacts/externalReferenceArtifactWriter.js';
|
|
6
|
+
export interface ImportExternalReferenceOptions {
|
|
7
|
+
outputLocation: string;
|
|
8
|
+
cwd?: WriteExternalReferenceArtifactOptions['cwd'];
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Root directory of a prior external-reference artifact this import explicitly supersedes. */
|
|
11
|
+
supersedesReferenceRoot?: string;
|
|
12
|
+
/** v0.7 Prompt 2: explicit, user/configuration-authored reference-image regions. Identity-bearing when present - see externalReferenceIdentity.ts. */
|
|
13
|
+
regions?: ReferenceRegion[];
|
|
14
|
+
/** v0.7 Prompt 3: explicit, user/configuration-selected design requirements over `regions` above. Raw (not yet identified) authored input - see domain/externalReferenceRequirements.ts#RawReferenceRequirement. Identity-bearing when present. */
|
|
15
|
+
requirements?: RawReferenceRequirement[];
|
|
16
|
+
/** v0.7 Prompt 4: the runtime frontend state (applicable viewport/theme/application-state/authenticated-state) this reference is intended to represent. Identity-bearing when present. */
|
|
17
|
+
applicability?: ExternalReferenceApplicability;
|
|
18
|
+
}
|
|
19
|
+
export interface ApproveExternalReferenceOptions {
|
|
20
|
+
outputLocation: string;
|
|
21
|
+
cwd?: WriteExternalReferenceArtifactOptions['cwd'];
|
|
22
|
+
/** Root directory of a prior external-reference artifact this approval explicitly supersedes. */
|
|
23
|
+
supersedesReferenceRoot?: string;
|
|
24
|
+
}
|
|
25
|
+
export type ApplicationImportExternalReferenceResult = {
|
|
26
|
+
ok: true;
|
|
27
|
+
referenceId: string;
|
|
28
|
+
referenceRequestId: string;
|
|
29
|
+
artifactRoot: string;
|
|
30
|
+
manifestPath: string;
|
|
31
|
+
imagePath: string;
|
|
32
|
+
regionCount: number;
|
|
33
|
+
requirementCount: number;
|
|
34
|
+
adequacy: ReferenceRequirementAdequacy;
|
|
35
|
+
hasApplicability: boolean;
|
|
36
|
+
} | {
|
|
37
|
+
ok: false;
|
|
38
|
+
diagnostics: Diagnostic[];
|
|
39
|
+
};
|
|
40
|
+
export type ApplicationApproveExternalReferenceResult = {
|
|
41
|
+
ok: true;
|
|
42
|
+
referenceId: string;
|
|
43
|
+
referenceRequestId: string;
|
|
44
|
+
artifactRoot: string;
|
|
45
|
+
manifestPath: string;
|
|
46
|
+
regionCount: number;
|
|
47
|
+
requirementCount: number;
|
|
48
|
+
adequacy: ReferenceRequirementAdequacy;
|
|
49
|
+
hasApplicability: boolean;
|
|
50
|
+
} | {
|
|
51
|
+
ok: false;
|
|
52
|
+
diagnostics: Diagnostic[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The one canonical application-level "import" use case: validates the raw
|
|
56
|
+
* image bytes through the existing pure image-format/dimension boundary
|
|
57
|
+
* (`domain/externalReferenceImage.ts`), resolves an optional explicit
|
|
58
|
+
* supersession target through the existing reader, computes identity through
|
|
59
|
+
* the existing identity module, and persists exactly once through the
|
|
60
|
+
* existing writer. Never approves the result - the persisted artifact's
|
|
61
|
+
* `lifecycle.state` is always `'imported'`, regardless of a supplied label or
|
|
62
|
+
* supersession target (see behavior-model.txt INV-007).
|
|
63
|
+
*/
|
|
64
|
+
export declare function importExternalReference(imageBytes: Uint8Array, options: ImportExternalReferenceOptions): Promise<ApplicationImportExternalReferenceResult>;
|
|
65
|
+
/**
|
|
66
|
+
* The one canonical application-level "approval" use case, mirroring
|
|
67
|
+
* `application/frontendContractPersistenceService.ts#approveAndPersistBaseline`'s
|
|
68
|
+
* shape: reads the target through the existing reader, refuses to approve
|
|
69
|
+
* anything not currently in the `'imported'` lifecycle state, resolves an
|
|
70
|
+
* optional explicit supersession target through the same reader, and
|
|
71
|
+
* persists a brand-new artifact instance - never mutating the imported
|
|
72
|
+
* artifact's own manifest - carrying a `sourceReference` back to it instead
|
|
73
|
+
* of a second copy of the image bytes.
|
|
74
|
+
*/
|
|
75
|
+
export declare function approveExternalReference(importedArtifactRoot: string, options: ApproveExternalReferenceOptions): Promise<ApplicationApproveExternalReferenceResult>;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { DIAGNOSTIC_SEVERITY } from '../domain/diagnostics.js';
|
|
4
|
+
import { deriveCompletion } from '../domain/completion.js';
|
|
5
|
+
import { getProducerInfo } from '../domain/schema.js';
|
|
6
|
+
import { detectExternalReferenceImageFormat, readExternalReferenceImageDimensions, isValidExternalReferenceImageDimensions, fileExtensionForFormat, EXTERNAL_REFERENCE_MAX_IMAGE_BYTES, } from '../domain/externalReferenceImage.js';
|
|
7
|
+
import { EXTERNAL_REFERENCE_ARTIFACT_KIND, EXTERNAL_REFERENCE_SCHEMA_VERSION, isImportedExternalReferenceArtifact } from '../domain/externalReference.js';
|
|
8
|
+
import { buildExternalReferenceRequestIdentity, buildExternalReferenceInstanceIdentity } from '../domain/externalReferenceIdentity.js';
|
|
9
|
+
import { isValidReferenceRegions } from '../domain/externalReferenceRegions.js';
|
|
10
|
+
import { isValidRawReferenceRequirement, buildReferenceRequirement, isValidReferenceRequirements, deriveReferenceRequirementAdequacy } from '../domain/externalReferenceRequirements.js';
|
|
11
|
+
import { isValidExternalReferenceApplicability } from '../domain/externalReferenceApplicability.js';
|
|
12
|
+
import { normalizeOutputLocation } from '../request/paths.js';
|
|
13
|
+
import { writeExternalReferenceArtifact } from '../artifacts/externalReferenceArtifactWriter.js';
|
|
14
|
+
import { EXTERNAL_REFERENCE_MANIFEST_FILENAME } from '../artifacts/externalReferenceArtifactWriter.js';
|
|
15
|
+
import { readExternalReferenceArtifact } from '../artifacts/externalReferenceArtifactReader.js';
|
|
16
|
+
function failure(code, message) {
|
|
17
|
+
return { ok: false, diagnostics: [{ code, severity: DIAGNOSTIC_SEVERITY[code], message }] };
|
|
18
|
+
}
|
|
19
|
+
async function resolveSupersedesReferenceId(supersedesReferenceRoot) {
|
|
20
|
+
if (supersedesReferenceRoot === undefined)
|
|
21
|
+
return { ok: true };
|
|
22
|
+
const read = await readExternalReferenceArtifact(path.join(supersedesReferenceRoot, EXTERNAL_REFERENCE_MANIFEST_FILENAME));
|
|
23
|
+
if (!read.ok)
|
|
24
|
+
return failure('reference-not-found', `supersedesReferenceRoot: ${read.reason}`);
|
|
25
|
+
return { ok: true, referenceId: read.artifact.referenceId };
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The one canonical application-level "import" use case: validates the raw
|
|
29
|
+
* image bytes through the existing pure image-format/dimension boundary
|
|
30
|
+
* (`domain/externalReferenceImage.ts`), resolves an optional explicit
|
|
31
|
+
* supersession target through the existing reader, computes identity through
|
|
32
|
+
* the existing identity module, and persists exactly once through the
|
|
33
|
+
* existing writer. Never approves the result - the persisted artifact's
|
|
34
|
+
* `lifecycle.state` is always `'imported'`, regardless of a supplied label or
|
|
35
|
+
* supersession target (see behavior-model.txt INV-007).
|
|
36
|
+
*/
|
|
37
|
+
export async function importExternalReference(imageBytes, options) {
|
|
38
|
+
const format = detectExternalReferenceImageFormat(imageBytes);
|
|
39
|
+
if (format === undefined)
|
|
40
|
+
return failure('unsupported-image-format', 'the supplied bytes do not match any supported reference image format (png, jpeg, webp)');
|
|
41
|
+
if (imageBytes.length > EXTERNAL_REFERENCE_MAX_IMAGE_BYTES) {
|
|
42
|
+
return failure('image-too-large', `reference image is ${imageBytes.length} bytes, exceeding the maximum of ${EXTERNAL_REFERENCE_MAX_IMAGE_BYTES} bytes`);
|
|
43
|
+
}
|
|
44
|
+
const dimensions = readExternalReferenceImageDimensions(imageBytes, format);
|
|
45
|
+
if (dimensions === undefined || !isValidExternalReferenceImageDimensions(dimensions)) {
|
|
46
|
+
return failure('invalid-image-dimensions', 'the supplied reference image header does not contain valid, bounded dimensions');
|
|
47
|
+
}
|
|
48
|
+
if (options.regions !== undefined) {
|
|
49
|
+
const regionsValidation = isValidReferenceRegions(options.regions, dimensions.width, dimensions.height);
|
|
50
|
+
if (!regionsValidation.valid)
|
|
51
|
+
return failure('invalid-reference-region', regionsValidation.reason);
|
|
52
|
+
}
|
|
53
|
+
let requirements;
|
|
54
|
+
if (options.requirements !== undefined) {
|
|
55
|
+
const built = [];
|
|
56
|
+
for (const raw of options.requirements) {
|
|
57
|
+
const rawValidation = isValidRawReferenceRequirement(raw);
|
|
58
|
+
if (!rawValidation.valid)
|
|
59
|
+
return failure('invalid-reference-requirement', rawValidation.reason);
|
|
60
|
+
built.push(buildReferenceRequirement(raw));
|
|
61
|
+
}
|
|
62
|
+
const collectionValidation = isValidReferenceRequirements(built, options.regions ?? []);
|
|
63
|
+
if (!collectionValidation.valid)
|
|
64
|
+
return failure('invalid-reference-requirement', collectionValidation.reason);
|
|
65
|
+
requirements = built;
|
|
66
|
+
}
|
|
67
|
+
if (options.applicability !== undefined) {
|
|
68
|
+
const applicabilityValidation = isValidExternalReferenceApplicability(options.applicability);
|
|
69
|
+
if (!applicabilityValidation.valid)
|
|
70
|
+
return failure('invalid-reference-applicability', applicabilityValidation.reason);
|
|
71
|
+
}
|
|
72
|
+
const supersedes = await resolveSupersedesReferenceId(options.supersedesReferenceRoot);
|
|
73
|
+
if (!supersedes.ok)
|
|
74
|
+
return supersedes;
|
|
75
|
+
const normalizedOutput = normalizeOutputLocation(options.outputLocation);
|
|
76
|
+
if (!normalizedOutput.ok)
|
|
77
|
+
return { ok: false, diagnostics: [normalizedOutput.diagnostic] };
|
|
78
|
+
const imageSha256 = createHash('sha256').update(imageBytes).digest('hex');
|
|
79
|
+
const referenceRequestId = buildExternalReferenceRequestIdentity(imageSha256, format, dimensions.width, dimensions.height, supersedes.referenceId, options.regions, requirements, options.applicability);
|
|
80
|
+
const referenceId = buildExternalReferenceInstanceIdentity(referenceRequestId);
|
|
81
|
+
const artifact = {
|
|
82
|
+
artifactKind: EXTERNAL_REFERENCE_ARTIFACT_KIND,
|
|
83
|
+
schemaVersion: EXTERNAL_REFERENCE_SCHEMA_VERSION,
|
|
84
|
+
referenceRequestId,
|
|
85
|
+
referenceId,
|
|
86
|
+
producer: getProducerInfo(),
|
|
87
|
+
provenance: { importedAt: new Date().toISOString(), ...(options.label === undefined ? {} : { label: options.label }) },
|
|
88
|
+
image: {
|
|
89
|
+
path: `reference.${fileExtensionForFormat(format)}`,
|
|
90
|
+
format,
|
|
91
|
+
width: dimensions.width,
|
|
92
|
+
height: dimensions.height,
|
|
93
|
+
byteLength: imageBytes.length,
|
|
94
|
+
sha256: imageSha256,
|
|
95
|
+
},
|
|
96
|
+
lifecycle: { state: 'imported' },
|
|
97
|
+
...(supersedes.referenceId === undefined ? {} : { supersedesReferenceId: supersedes.referenceId }),
|
|
98
|
+
...(options.regions === undefined ? {} : { regions: options.regions }),
|
|
99
|
+
...(requirements === undefined ? {} : { requirements }),
|
|
100
|
+
...(options.applicability === undefined ? {} : { applicability: options.applicability }),
|
|
101
|
+
diagnostics: [],
|
|
102
|
+
completion: deriveCompletion([], 'post-capture'),
|
|
103
|
+
};
|
|
104
|
+
const persisted = await writeExternalReferenceArtifact(artifact, imageBytes, normalizedOutput.value, options.cwd === undefined ? {} : { cwd: options.cwd });
|
|
105
|
+
if (!persisted.ok)
|
|
106
|
+
return { ok: false, diagnostics: persisted.diagnostics };
|
|
107
|
+
return {
|
|
108
|
+
ok: true,
|
|
109
|
+
referenceId: artifact.referenceId,
|
|
110
|
+
referenceRequestId: artifact.referenceRequestId,
|
|
111
|
+
artifactRoot: persisted.artifactRoot,
|
|
112
|
+
manifestPath: persisted.manifestPath,
|
|
113
|
+
imagePath: persisted.imagePath,
|
|
114
|
+
regionCount: artifact.regions?.length ?? 0,
|
|
115
|
+
requirementCount: artifact.requirements?.length ?? 0,
|
|
116
|
+
adequacy: deriveReferenceRequirementAdequacy(artifact.regions ?? [], artifact.requirements ?? []),
|
|
117
|
+
hasApplicability: artifact.applicability !== undefined,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The one canonical application-level "approval" use case, mirroring
|
|
122
|
+
* `application/frontendContractPersistenceService.ts#approveAndPersistBaseline`'s
|
|
123
|
+
* shape: reads the target through the existing reader, refuses to approve
|
|
124
|
+
* anything not currently in the `'imported'` lifecycle state, resolves an
|
|
125
|
+
* optional explicit supersession target through the same reader, and
|
|
126
|
+
* persists a brand-new artifact instance - never mutating the imported
|
|
127
|
+
* artifact's own manifest - carrying a `sourceReference` back to it instead
|
|
128
|
+
* of a second copy of the image bytes.
|
|
129
|
+
*/
|
|
130
|
+
export async function approveExternalReference(importedArtifactRoot, options) {
|
|
131
|
+
const read = await readExternalReferenceArtifact(path.join(importedArtifactRoot, EXTERNAL_REFERENCE_MANIFEST_FILENAME));
|
|
132
|
+
if (!read.ok)
|
|
133
|
+
return failure('reference-not-found', read.reason);
|
|
134
|
+
if (!isImportedExternalReferenceArtifact(read.artifact)) {
|
|
135
|
+
return failure('invalid-request', `external-reference artifact "${read.artifact.referenceId}" is not in the "imported" lifecycle state; only a freshly imported reference can be approved`);
|
|
136
|
+
}
|
|
137
|
+
const imported = read.artifact;
|
|
138
|
+
const supersedes = await resolveSupersedesReferenceId(options.supersedesReferenceRoot);
|
|
139
|
+
if (!supersedes.ok)
|
|
140
|
+
return supersedes;
|
|
141
|
+
const normalizedOutput = normalizeOutputLocation(options.outputLocation);
|
|
142
|
+
if (!normalizedOutput.ok)
|
|
143
|
+
return { ok: false, diagnostics: [normalizedOutput.diagnostic] };
|
|
144
|
+
const referenceId = buildExternalReferenceInstanceIdentity(imported.referenceRequestId);
|
|
145
|
+
const artifact = {
|
|
146
|
+
artifactKind: EXTERNAL_REFERENCE_ARTIFACT_KIND,
|
|
147
|
+
schemaVersion: EXTERNAL_REFERENCE_SCHEMA_VERSION,
|
|
148
|
+
referenceRequestId: imported.referenceRequestId,
|
|
149
|
+
referenceId,
|
|
150
|
+
producer: getProducerInfo(),
|
|
151
|
+
provenance: { importedAt: imported.provenance.importedAt, ...(imported.provenance.label === undefined ? {} : { label: imported.provenance.label }) },
|
|
152
|
+
sourceReference: {
|
|
153
|
+
referenceId: imported.referenceId,
|
|
154
|
+
referenceRequestId: imported.referenceRequestId,
|
|
155
|
+
producer: imported.producer,
|
|
156
|
+
schemaVersion: imported.schemaVersion,
|
|
157
|
+
image: imported.image,
|
|
158
|
+
},
|
|
159
|
+
lifecycle: { state: 'approved', approvedAt: new Date().toISOString() },
|
|
160
|
+
...(supersedes.referenceId === undefined ? {} : { supersedesReferenceId: supersedes.referenceId }),
|
|
161
|
+
...(imported.regions === undefined ? {} : { regions: imported.regions }),
|
|
162
|
+
...(imported.requirements === undefined ? {} : { requirements: imported.requirements }),
|
|
163
|
+
...(imported.applicability === undefined ? {} : { applicability: imported.applicability }),
|
|
164
|
+
diagnostics: [],
|
|
165
|
+
completion: deriveCompletion([], 'post-capture'),
|
|
166
|
+
};
|
|
167
|
+
const persisted = await writeExternalReferenceArtifact(artifact, undefined, normalizedOutput.value, options.cwd === undefined ? {} : { cwd: options.cwd });
|
|
168
|
+
if (!persisted.ok)
|
|
169
|
+
return { ok: false, diagnostics: persisted.diagnostics };
|
|
170
|
+
return {
|
|
171
|
+
ok: true,
|
|
172
|
+
referenceId: artifact.referenceId,
|
|
173
|
+
referenceRequestId: artifact.referenceRequestId,
|
|
174
|
+
artifactRoot: persisted.artifactRoot,
|
|
175
|
+
manifestPath: persisted.manifestPath,
|
|
176
|
+
regionCount: artifact.regions?.length ?? 0,
|
|
177
|
+
requirementCount: artifact.requirements?.length ?? 0,
|
|
178
|
+
adequacy: deriveReferenceRequirementAdequacy(artifact.regions ?? [], artifact.requirements ?? []),
|
|
179
|
+
hasApplicability: artifact.applicability !== undefined,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=externalReferencePersistenceService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"externalReferencePersistenceService.js","sourceRoot":"","sources":["../../src/application/externalReferencePersistenceService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACL,kCAAkC,EAClC,oCAA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EAAE,WAAW,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC;IAE5E,OAAO;QACL,EAAE,EAAE,IAAI;QACR,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,YAAY,EAAE,SAAS,CAAC,YAAY;QACpC,WAAW,EAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;QAC1C,gBAAgB,EAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;QACpD,QAAQ,EAAE,kCAAkC,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE,QAAQ,CAAC,YAAY,IAAI,EAAE,CAAC;QACjG,gBAAgB,EAAE,QAAQ,CAAC,aAAa,KAAK,SAAS;KACvD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { EvaluateReferenceCandidateFidelityOptions, ReferenceCandidateFidelityEvaluation } from '../domain/externalReferenceFidelity.js';
|
|
2
|
+
import type { ReferenceRuntimeBindingDeclaration } from '../domain/externalReferenceRuntimeBinding.js';
|
|
3
|
+
import type { Diagnostic } from '../domain/diagnostics.js';
|
|
4
|
+
export type EvaluateReferenceFidelityOptions = EvaluateReferenceCandidateFidelityOptions;
|
|
5
|
+
export type ApplicationReferenceFidelityResult = {
|
|
6
|
+
ok: true;
|
|
7
|
+
evaluation: ReferenceCandidateFidelityEvaluation;
|
|
8
|
+
} | {
|
|
9
|
+
ok: false;
|
|
10
|
+
diagnostics: Diagnostic[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The canonical CLI-facing orchestration for Prompt 6, mirroring
|
|
14
|
+
* `comparisonService.ts#compareAndPersistFromArtifactRoots`'s exact shape:
|
|
15
|
+
* reads one already-persisted `ExternalReferenceArtifact` and one already-
|
|
16
|
+
* persisted `ObservationArtifact` by their root directories through the
|
|
17
|
+
* existing readers, then delegates to the pure
|
|
18
|
+
* `evaluateReferenceCandidateFidelity` exactly once. A thin wrapper only -
|
|
19
|
+
* artifact reading stays owned by `artifacts/`, evaluation semantics stay
|
|
20
|
+
* owned by `domain/externalReferenceFidelity.ts`. Kept in `application/`
|
|
21
|
+
* (not `artifacts/`) so `src/cli.ts` can depend on it without importing the
|
|
22
|
+
* artifacts layer directly, matching every other command's import-boundary
|
|
23
|
+
* convention. Never launches a browser, never re-resolves targets, and -
|
|
24
|
+
* deliberately, per this prompt's persistence decision - never persists
|
|
25
|
+
* anything: the caller receives the structured in-memory evaluation result
|
|
26
|
+
* directly.
|
|
27
|
+
*/
|
|
28
|
+
export declare function evaluateReferenceCandidateFidelityFromArtifactRoots(referenceRoot: string, candidateRoot: string, bindingDeclarations: readonly ReferenceRuntimeBindingDeclaration[], options?: EvaluateReferenceFidelityOptions): Promise<ApplicationReferenceFidelityResult>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { readExternalReferenceArtifact } from '../artifacts/externalReferenceArtifactReader.js';
|
|
3
|
+
import { EXTERNAL_REFERENCE_MANIFEST_FILENAME } from '../artifacts/externalReferenceArtifactWriter.js';
|
|
4
|
+
import { readObservationArtifact } from '../artifacts/artifactReader.js';
|
|
5
|
+
import { MANIFEST_FILENAME as OBSERVATION_MANIFEST_FILENAME } from '../artifacts/artifactWriter.js';
|
|
6
|
+
import { evaluateReferenceCandidateFidelity } from '../domain/externalReferenceFidelity.js';
|
|
7
|
+
import { DIAGNOSTIC_SEVERITY } from '../domain/diagnostics.js';
|
|
8
|
+
/**
|
|
9
|
+
* The canonical CLI-facing orchestration for Prompt 6, mirroring
|
|
10
|
+
* `comparisonService.ts#compareAndPersistFromArtifactRoots`'s exact shape:
|
|
11
|
+
* reads one already-persisted `ExternalReferenceArtifact` and one already-
|
|
12
|
+
* persisted `ObservationArtifact` by their root directories through the
|
|
13
|
+
* existing readers, then delegates to the pure
|
|
14
|
+
* `evaluateReferenceCandidateFidelity` exactly once. A thin wrapper only -
|
|
15
|
+
* artifact reading stays owned by `artifacts/`, evaluation semantics stay
|
|
16
|
+
* owned by `domain/externalReferenceFidelity.ts`. Kept in `application/`
|
|
17
|
+
* (not `artifacts/`) so `src/cli.ts` can depend on it without importing the
|
|
18
|
+
* artifacts layer directly, matching every other command's import-boundary
|
|
19
|
+
* convention. Never launches a browser, never re-resolves targets, and -
|
|
20
|
+
* deliberately, per this prompt's persistence decision - never persists
|
|
21
|
+
* anything: the caller receives the structured in-memory evaluation result
|
|
22
|
+
* directly.
|
|
23
|
+
*/
|
|
24
|
+
export async function evaluateReferenceCandidateFidelityFromArtifactRoots(referenceRoot, candidateRoot, bindingDeclarations, options = {}) {
|
|
25
|
+
const referenceRead = await readExternalReferenceArtifact(path.join(referenceRoot, EXTERNAL_REFERENCE_MANIFEST_FILENAME));
|
|
26
|
+
if (!referenceRead.ok) {
|
|
27
|
+
return {
|
|
28
|
+
ok: false,
|
|
29
|
+
diagnostics: [{ code: 'invalid-request', severity: DIAGNOSTIC_SEVERITY['invalid-request'], message: `--reference external-reference artifact: ${referenceRead.reason}` }],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const candidateRead = await readObservationArtifact(path.join(candidateRoot, OBSERVATION_MANIFEST_FILENAME));
|
|
33
|
+
if (!candidateRead.ok) {
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
diagnostics: [{ code: 'invalid-request', severity: DIAGNOSTIC_SEVERITY['invalid-request'], message: `--candidate observation artifact: ${candidateRead.reason}` }],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const result = evaluateReferenceCandidateFidelity(referenceRead.artifact, candidateRead.artifact, bindingDeclarations, options);
|
|
40
|
+
if (!result.ok) {
|
|
41
|
+
return { ok: false, diagnostics: [{ code: 'invalid-request', severity: DIAGNOSTIC_SEVERITY['invalid-request'], message: result.reason }] };
|
|
42
|
+
}
|
|
43
|
+
return { ok: true, evaluation: result.evaluation };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=referenceFidelityEvaluationService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceFidelityEvaluationService.js","sourceRoot":"","sources":["../../src/application/referenceFidelityEvaluationService.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAC;AAChG,OAAO,EAAE,oCAAoC,EAAE,MAAM,iDAAiD,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,IAAI,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,EAAE,kCAAkC,EAAE,MAAM,wCAAwC,CAAC;AAI5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAM/D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,mDAAmD,CACvE,aAAqB,EACrB,aAAqB,EACrB,mBAAkE,EAClE,UAA4C,EAAE;IAE9C,MAAM,aAAa,GAAG,MAAM,6BAA6B,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,oCAAoC,CAAC,CAAC,CAAC;IAC1H,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;QACtB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,4CAA4C,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;SAC1K,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,6BAA6B,CAAC,CAAC,CAAC;IAC7G,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;QACtB,OAAO;YACL,EAAE,EAAE,KAAK;YACT,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,qCAAqC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;SACnK,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,kCAAkC,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,CAAC,CAAC;IAChI,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IAC7I,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExternalReferenceArtifact } from '../domain/externalReference.js';
|
|
2
|
+
export type ReadExternalReferenceArtifactResult = {
|
|
3
|
+
ok: true;
|
|
4
|
+
artifact: ExternalReferenceArtifact;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
reason: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Narrow canonical reader counterpart to
|
|
11
|
+
* `externalReferenceArtifactWriter.ts#writeExternalReferenceArtifact`: reads
|
|
12
|
+
* one `manifest.json`, parses it, and validates it through the same
|
|
13
|
+
* `isValidExternalReferenceArtifact` structural gate the writer itself uses -
|
|
14
|
+
* never a second validator. Read-only: never mutates the file, never resolves
|
|
15
|
+
* the sibling image file's bytes (an 'imported' manifest's `image.path` field
|
|
16
|
+
* is returned as-is for the caller to resolve if it needs the bytes).
|
|
17
|
+
*/
|
|
18
|
+
export declare function readExternalReferenceArtifact(manifestPath: string): Promise<ReadExternalReferenceArtifactResult>;
|