@dailephd/my-frontend-observer 0.8.1 → 0.9.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 (111) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +109 -7
  3. package/dist/application/projectWorkflowService.d.ts +18 -1
  4. package/dist/application/projectWorkflowService.js +40 -2
  5. package/dist/application/projectWorkflowService.js.map +1 -1
  6. package/dist/application/visualAnnotationContractPromotionService.d.ts +41 -0
  7. package/dist/application/visualAnnotationContractPromotionService.js +143 -0
  8. package/dist/application/visualAnnotationContractPromotionService.js.map +1 -0
  9. package/dist/application/visualAnnotationPersistenceService.d.ts +34 -0
  10. package/dist/application/visualAnnotationPersistenceService.js +68 -0
  11. package/dist/application/visualAnnotationPersistenceService.js.map +1 -0
  12. package/dist/application/visualAnnotationReferenceMaterializationService.d.ts +53 -0
  13. package/dist/application/visualAnnotationReferenceMaterializationService.js +194 -0
  14. package/dist/application/visualAnnotationReferenceMaterializationService.js.map +1 -0
  15. package/dist/artifacts/visualAnnotationArtifactReader.d.ts +19 -0
  16. package/dist/artifacts/visualAnnotationArtifactReader.js +66 -0
  17. package/dist/artifacts/visualAnnotationArtifactReader.js.map +1 -0
  18. package/dist/artifacts/visualAnnotationArtifactWriter.d.ts +42 -0
  19. package/dist/artifacts/visualAnnotationArtifactWriter.js +85 -0
  20. package/dist/artifacts/visualAnnotationArtifactWriter.js.map +1 -0
  21. package/dist/cli.js +464 -454
  22. package/dist/cli.js.map +1 -1
  23. package/dist/domain/visualAnnotation.d.ts +217 -0
  24. package/dist/domain/visualAnnotation.js +584 -0
  25. package/dist/domain/visualAnnotation.js.map +1 -0
  26. package/dist/domain/visualAnnotationIdentity.d.ts +17 -0
  27. package/dist/domain/visualAnnotationIdentity.js +47 -0
  28. package/dist/domain/visualAnnotationIdentity.js.map +1 -0
  29. package/dist/index.d.ts +11 -0
  30. package/dist/index.js +6 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/projectWorkflow/projectPaths.d.ts +9 -0
  33. package/dist/projectWorkflow/projectPaths.js +21 -0
  34. package/dist/projectWorkflow/projectPaths.js.map +1 -1
  35. package/dist/viewer/assets/{index-CN_yb9Uf.css → index-BN41MI7m.css} +1 -1
  36. package/dist/viewer/assets/index-CkKXnlrI.js +9 -0
  37. package/dist/viewer/index.html +2 -2
  38. package/dist/viewer/sw.js +1 -1
  39. package/dist/viewerServer/annotationAuthoring.d.ts +64 -0
  40. package/dist/viewerServer/annotationAuthoring.js +230 -0
  41. package/dist/viewerServer/annotationAuthoring.js.map +1 -0
  42. package/dist/viewerServer/annotationContractPromotion.d.ts +51 -0
  43. package/dist/viewerServer/annotationContractPromotion.js +105 -0
  44. package/dist/viewerServer/annotationContractPromotion.js.map +1 -0
  45. package/dist/viewerServer/annotationReferenceMaterialization.d.ts +40 -0
  46. package/dist/viewerServer/annotationReferenceMaterialization.js +91 -0
  47. package/dist/viewerServer/annotationReferenceMaterialization.js.map +1 -0
  48. package/dist/viewerServer/authoringSecurity.d.ts +59 -0
  49. package/dist/viewerServer/authoringSecurity.js +112 -0
  50. package/dist/viewerServer/authoringSecurity.js.map +1 -0
  51. package/dist/viewerServer/evidence/annotationView.d.ts +28 -0
  52. package/dist/viewerServer/evidence/annotationView.js +43 -0
  53. package/dist/viewerServer/evidence/annotationView.js.map +1 -0
  54. package/dist/viewerServer/evidence/classify.d.ts +3 -1
  55. package/dist/viewerServer/evidence/classify.js +12 -0
  56. package/dist/viewerServer/evidence/classify.js.map +1 -1
  57. package/dist/viewerServer/evidence/discovery.d.ts +2 -0
  58. package/dist/viewerServer/evidence/discovery.js +6 -0
  59. package/dist/viewerServer/evidence/discovery.js.map +1 -1
  60. package/dist/viewerServer/evidence/handles.js +1 -0
  61. package/dist/viewerServer/evidence/handles.js.map +1 -1
  62. package/dist/viewerServer/evidence/index.d.ts +29 -0
  63. package/dist/viewerServer/evidence/index.js +43 -1
  64. package/dist/viewerServer/evidence/index.js.map +1 -1
  65. package/dist/viewerServer/evidence/mediaResolver.d.ts +1 -1
  66. package/dist/viewerServer/evidence/mediaResolver.js +28 -2
  67. package/dist/viewerServer/evidence/mediaResolver.js.map +1 -1
  68. package/dist/viewerServer/evidence/projection.d.ts +5 -1
  69. package/dist/viewerServer/evidence/projection.js +19 -0
  70. package/dist/viewerServer/evidence/projection.js.map +1 -1
  71. package/dist/viewerServer/httpServer.d.ts +13 -2
  72. package/dist/viewerServer/httpServer.js +278 -4
  73. package/dist/viewerServer/httpServer.js.map +1 -1
  74. package/dist/viewerServer/viewerService.d.ts +8 -0
  75. package/dist/viewerServer/viewerService.js +38 -2
  76. package/dist/viewerServer/viewerService.js.map +1 -1
  77. package/docs/ARCHITECTURE.md +108 -21
  78. package/docs/CI_CD.md +78 -1
  79. package/docs/COMMANDS.md +44 -4
  80. package/docs/CONTRACTS.md +78 -8
  81. package/docs/CURRENT_STATE.md +224 -35
  82. package/docs/DEVELOPMENT.md +38 -3
  83. package/docs/PROJECT_DESCRIPTION.md +4 -1
  84. package/docs/PROJECT_MILESTONES.md +32 -0
  85. package/docs/PROJECT_OVERVIEW.md +58 -17
  86. package/docs/QUICKSTART.md +52 -39
  87. package/docs/RELEASE.md +17 -11
  88. package/docs/ROADMAP.md +458 -66
  89. package/docs/SECURITY.md +71 -14
  90. package/docs/WORKFLOWS.md +151 -23
  91. package/docs/plans/v0.9-implementation-plan.md +1529 -0
  92. package/docs/plans/v0.9.1-implementation-plan.md +468 -0
  93. package/docs/reports/v0.9-architecture-retrieval.md +567 -0
  94. package/docs/reports/v0.9-batch1-visual-annotation-foundation.md +351 -0
  95. package/docs/reports/v0.9-batch2-viewer-annotation-authoring-boundary.md +438 -0
  96. package/docs/reports/v0.9-batch3-runtime-screenshot-annotation-authoring.md +412 -0
  97. package/docs/reports/v0.9-batch4-external-reference-annotation-authoring.md +452 -0
  98. package/docs/reports/v0.9-batch5-runtime-intent-contract-promotion.md +535 -0
  99. package/docs/reports/v0.9-batch6-reference-materialization.md +514 -0
  100. package/docs/reports/v0.9-batch7-integrated-acceptance.md +644 -0
  101. package/docs/reports/v0.9-demo-foundation.md +589 -0
  102. package/docs/reports/v0.9-final-pre-release-readiness.md +209 -0
  103. package/docs/reports/v0.9-final-readiness-corrections.md +530 -0
  104. package/docs/reports/v0.9-pre-release-readiness.md +170 -0
  105. package/docs/reports/v0.9-tutorial-end-to-end-acceptance.md +980 -0
  106. package/docs/reports/v0.9-tutorial-integration.md +731 -0
  107. package/docs/reports/v0.9.1-batch1-pwa-hard-gate-isolation.md +359 -0
  108. package/docs/reports/v0.9.1-batch2-hard-gate-validation-integration.md +262 -0
  109. package/docs/reports/v0.9.1-pre-release-readiness.md +206 -0
  110. package/package.json +3 -2
  111. package/dist/viewer/assets/index-D98S1_2d.js +0 -9
package/CHANGELOG.md CHANGED
@@ -2,6 +2,80 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ Future development.
6
+
7
+ ## 0.9.1 - 2026-09-21
8
+
9
+ Hardened PWA security-acceptance reproducibility as a maintenance release.
10
+
11
+ - Hardened the PWA server-down HARD GATE from fresh test-owned state, removing
12
+ hidden dependence on prior test order and persistent Chromium profile state.
13
+ - Corrected the false-ready service-worker predicate and separately proved
14
+ active registration and current-client control.
15
+ - Proved shell-cache readiness, `/api/` exclusion from Cache Storage,
16
+ origin-server unavailability, offline shell reload, and stale-evidence
17
+ absence.
18
+ - Added permanent `npm run test:pwa-hard-gate` and integrated it into
19
+ `npm run test:security`.
20
+ - No production PWA behavior, schema, or dependency changed.
21
+
22
+ ## 0.9.0 - 2026-09-21
23
+
24
+ v0.9, Human Visual Annotation and Design-Intent Capture. Structured visual
25
+ annotation through the existing viewer. Drawing is evidence, not meaning:
26
+ association, confirmation, promotion, materialization, activation and approval
27
+ each remain separate, explicit steps.
28
+
29
+ - Added the `VisualAnnotationArtifact` evidence family (schema `1.0.0`) with
30
+ deterministic identity, an atomic writer, a canonical reader, a persistence
31
+ service, and a derived annotation overlay SVG. Every save is an immutable
32
+ revision with stale-parent conflict detection.
33
+ - Added runtime observation annotation in runtime CSS pixels and external
34
+ reference annotation in reference-image pixels, with five mark kinds (point,
35
+ rectangle, line, arrow and note), Select and Pan modes, zoom, and keyboard
36
+ selection.
37
+ - Added explicit associations in each source domain: a runtime target, a
38
+ runtime relationship, or a reference region. Where a mark is drawn never
39
+ decides what it is about.
40
+ - Added candidate and confirmed interpretation. Changing a confirmed meaning
41
+ withdraws its confirmation.
42
+ - Added runtime operations `inspect`, `move`, `resize`, `remove` and
43
+ `preserve`, and authored categories `requested`, `expected-dependent`,
44
+ `protected` and `preserved`. `unexpected` is concluded by comparison, never
45
+ authored.
46
+ - Added promotion of selected confirmed runtime `move`, `resize` and
47
+ `preserve` intent into a canonical per-change frontend contract. Promotion
48
+ does not activate the contract; project activation is a separate, optional,
49
+ explicit choice. Confirmed `remove` intent stays non-promotable because the
50
+ contract vocabulary has no target-absent primitive, and `inspect` is never a
51
+ clause.
52
+ - Added reference-region create and refine intent, and property, relationship
53
+ and measurement reference requirements.
54
+ - Added materialization of selected confirmed reference intent into a new
55
+ imported external-reference revision that supersedes its source. The source
56
+ reference is never modified, and the new revision is not approved
57
+ automatically.
58
+ - Added a project-aware local authoring boundary: a 32-byte in-memory session
59
+ capability, strict Host and Origin checks, JSON-only bounded request bodies,
60
+ and one serialized write queue. `view --root` stays read-only.
61
+ - Added three authoring routes: `POST /api/annotations`,
62
+ `POST /api/annotations/:handle/promote-contract`, and
63
+ `POST /api/annotations/:handle/materialize-reference`. The viewer protocol
64
+ is now `1.3.0`.
65
+ - Added viewer discovery of visual annotations, a source-resolving annotation
66
+ view route, and a verified, script-blocking overlay media role.
67
+ - Evidence discovery now skips writer temporary `.tmp-*` directories.
68
+ - Fixed viewer shutdown stalling while a browser or service worker held a
69
+ connection open. Closing the viewer now also ends active connections.
70
+ - Added an integrated real-Chromium acceptance suite and a packed installed
71
+ v0.9 annotation smoke to the cross-platform pre-release readiness workflow.
72
+ - The repository gained a deterministic demo and four tutorials under
73
+ `examples/v09-demo/`, proved end to end with the external tool
74
+ `@dailephd/my-dev-kit-lab@0.4.9`. The demo is repository material only: it is
75
+ not in the npm package, and my-dev-kit-lab is not an Observer dependency.
76
+ - Final pre-release readiness passed on Windows, Linux and macOS against one
77
+ exact candidate package, including all four tutorials.
78
+
5
79
  ## 0.8.1 - 2026-09-15
6
80
 
7
81
  Project workflow release for `my-frontend-observer`.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # my-frontend-observer
2
2
 
3
- ## Common project workflow (v0.8.1)
3
+ ## Common project workflow (v0.9.1)
4
4
 
5
5
  ```powershell
6
6
  my-frontend-observer init --url http://127.0.0.1:3000 --target app=#app
@@ -17,16 +17,22 @@ my-frontend-observer view
17
17
  `1`, `2`, or `3` for `PASS`, `FAIL`, `REVIEW_REQUIRED`, or `BLOCKED`.
18
18
  Canonical hashes remain available in viewer details and persisted provenance,
19
19
  but are not normal workflow command inputs. The existing low-level commands
20
- remain supported. v0.8.1 is the current published release.
20
+ remain supported. v0.9.1 is the current published release.
21
+
22
+ v0.9.1 is a maintenance release that hardens independent PWA security-gate
23
+ validation without changing production PWA behavior.
21
24
 
22
25
  `my-frontend-observer` is the local-first rendered browser/runtime evidence
23
26
  producer in the my-dev-kit ecosystem. Its durable product purpose is defined
24
- in [docs/PROJECT_DESCRIPTION.md](docs/PROJECT_DESCRIPTION.md).
27
+ in [docs/PROJECT_DESCRIPTION.md](docs/PROJECT_DESCRIPTION.md). Whole-ecosystem
28
+ composition is documented in the [my-dev-kit ecosystem guide](https://github.com/dailephd/my-dev-kit/blob/main/docs/ECOSYSTEM_DEVELOPMENT_WORKFLOWS.md), including the [command-surface compatibility map](https://github.com/dailephd/my-dev-kit/blob/main/docs/ECOSYSTEM_DEVELOPMENT_WORKFLOWS.md#915-command-surface-compatibility-map).
25
29
 
26
30
  ## Current status
27
31
 
28
- `v0.8.1`, Project Workflow CLI and Human-Readable Evidence Aliases, is the
29
- current published release. It builds on `v0.8.0`, Interactive Local Observation
32
+ `v0.9.1`, PWA Hard-Gate Isolation and Reproducible Security Acceptance, is the
33
+ current published release. It preserves the `v0.9.0` Human Visual Annotation
34
+ and Design-Intent Capture release and builds on `v0.8.1`, Project Workflow CLI and
35
+ Human-Readable Evidence Aliases, `v0.8.0`, Interactive Local Observation
30
36
  Viewer, and `v0.7.0`, End-to-End Coding-Agent Frontend Change
31
37
  Review, `v0.6.0`, Bounded Agent Context and Native my-dev-kit Ecosystem
32
38
  Integration, and `v0.5.0`, Executable Frontend Contracts and Explicit Change
@@ -210,6 +216,102 @@ my-frontend-observer view --root observations --port 4319 --no-open
210
216
 
211
217
  (From a source checkout, use `node dist/cli.js view ...` instead.)
212
218
 
219
+ ### Visual annotation (v0.9.0)
220
+
221
+ v0.9.0 adds structured visual annotation to the project-aware viewer. The
222
+ model rests on a few deliberate separations:
223
+
224
+ - Drawing is evidence, not meaning. A mark on its own says nothing about what
225
+ should change.
226
+ - Association is explicit. You choose what a mark is about.
227
+ - Confirmation is explicit. A candidate meaning is only a proposal until you
228
+ confirm it.
229
+ - Promotion and materialization are selected actions. Nothing is promoted or
230
+ materialized just because it was confirmed.
231
+ - Promotion does not activate a contract, and materialization does not approve
232
+ a reference. Those remain separate, explicit decisions.
233
+
234
+ The capabilities:
235
+
236
+ - **Runtime screenshot annotation**: draw points, rectangles, lines, arrows,
237
+ and notes on an observation screenshot. Geometry is stored in runtime CSS
238
+ pixels.
239
+ - **External-reference annotation**: draw the same marks on an imported or
240
+ approved design reference. Geometry is stored in reference-image pixels.
241
+ - **Explicit association**: a mark is linked to a runtime target, a runtime
242
+ relationship, a reference region, or a reference relationship only when you
243
+ choose it. Drawing over something never creates an association.
244
+ - **Candidate and confirmed intent**: you choose a structured intent (for
245
+ example "move header right" or "create region hero"), review the exact
246
+ candidate structure, and confirm it explicitly. Editing a confirmed item
247
+ withdraws the confirmation.
248
+ - **Immutable saves**: each save writes a new `VisualAnnotationArtifact`
249
+ (schema `1.0.0`). A revision supersedes its parent and never rewrites it.
250
+ - **Runtime contract promotion**: selected confirmed runtime intent can be
251
+ promoted into a normal per-change frontend contract. Activating that
252
+ contract for `check` is a separate explicit choice.
253
+ - **Reference materialization**: selected confirmed reference regions and
254
+ requirements can be materialized into a new imported external-reference
255
+ revision that supersedes the source. The source reference is never changed,
256
+ and the new revision is not approved automatically.
257
+
258
+ Authoring is available only in the project-aware viewer:
259
+
260
+ ```powershell
261
+ # Project-aware: annotation authoring enabled for this project.
262
+ my-frontend-observer view
263
+
264
+ # Standalone: always read-only, even for annotation evidence.
265
+ my-frontend-observer view --root .frontend-observer/evidence
266
+ ```
267
+
268
+ There is no separate annotation command. Observer still never edits target
269
+ source, never approves a baseline or reference on its own, and never adds a
270
+ new PASS/FAIL rule for annotations. The existing contract and reference
271
+ evaluators remain the only source of verdicts. See
272
+ [docs/WORKFLOWS.md](docs/WORKFLOWS.md) and
273
+ [docs/SECURITY.md](docs/SECURITY.md) for the full workflow and the local write
274
+ boundary.
275
+
276
+ ## Demo and tutorials
277
+
278
+ Explaining annotation, contracts, and references against a real application is
279
+ hard, because a real application changes for reasons unrelated to the lesson.
280
+ The repository therefore keeps a small deterministic demo application in
281
+ [examples/v09-demo/](examples/v09-demo/README.md). Every region is named and
282
+ every state difference is deliberate, so the same state always renders the
283
+ same geometry at the canonical 1440x900 viewport.
284
+
285
+ Four v0.9 tutorial scenarios live in `examples/v09-demo/tutorials/`. They are
286
+ recorded by the external tool `@dailephd/my-dev-kit-lab@0.4.9`, which drives
287
+ the real Observer viewer in Chromium against a disposable project built from
288
+ the demo. Observer itself has no tutorial command and does not depend on the
289
+ lab.
290
+
291
+ A contributor builds Observer, generates a per-run target contract, then
292
+ validates and runs a scenario:
293
+
294
+ ```powershell
295
+ npm run build
296
+ node examples/v09-demo/scripts/generate-tutorial-target.mjs `
297
+ --scenario observer-v09-annotation-basics `
298
+ --out .my-dev-kit-workflow/adhoc/target-contract.json
299
+ npx --yes @dailephd/my-dev-kit-lab@0.4.9 tutorial validate `
300
+ --scenario examples/v09-demo/tutorials/01-annotation-basics.json `
301
+ --target-contract .my-dev-kit-workflow/adhoc/target-contract.json --json
302
+ npx --yes @dailephd/my-dev-kit-lab@0.4.9 tutorial run `
303
+ --scenario examples/v09-demo/tutorials/01-annotation-basics.json `
304
+ --target-contract .my-dev-kit-workflow/adhoc/target-contract.json `
305
+ --out <an output directory you choose outside the repository> --json
306
+ ```
307
+
308
+ A run writes a WebM video, screenshots, SRT and VTT subtitles, a Markdown
309
+ tutorial, and a manifest into the output directory you choose. None of that is
310
+ committed. The demo and tutorial sources are repository examples only. They
311
+ are not included in the npm package. See
312
+ [examples/v09-demo/README.md](examples/v09-demo/README.md) for the full
313
+ contributor workflow.
314
+
213
315
  ## License
214
316
 
215
317
  MIT. See [LICENSE](LICENSE).
@@ -247,8 +349,8 @@ Planning authorities:
247
349
  intent and responsibility boundaries.
248
350
  - [Project Milestones](docs/PROJECT_MILESTONES.md): complete ordered capability
249
351
  design and cross-milestone rules.
250
- - [ROADMAP](docs/ROADMAP.md): version-level requirements; v0.1-v0.8 are
251
- released; v0.9+ remain future.
352
+ - [ROADMAP](docs/ROADMAP.md): version-level requirements; v0.1-v0.9.1 are
353
+ released; v0.10 remains future.
252
354
  - [Current State](docs/CURRENT_STATE.md): retained scaffold and release state.
253
355
 
254
356
  No sibling ecosystem repository is a runtime dependency of the retained
@@ -38,9 +38,26 @@ export type CaptureNamedObservationResult = {
38
38
  } | WorkflowFailure;
39
39
  export declare function captureNamedObservation(input: CaptureNamedObservationInput): Promise<CaptureNamedObservationResult>;
40
40
  export declare function captureCurrentObservation(projectRoot: string): Promise<CaptureNamedObservationResult>;
41
- export declare function loadProjectViewerState(projectRoot: string): Promise<{
41
+ export declare function loadProjectViewerState(projectRootInput: string): Promise<{
42
42
  ok: true;
43
+ projectRoot: string;
43
44
  root: string;
44
45
  aliases: Readonly<Record<string, string>>;
45
46
  } | WorkflowFailure>;
47
+ export type ActivateProjectChangeContractResult = {
48
+ ok: true;
49
+ } | {
50
+ ok: false;
51
+ code: 'not-configured' | 'project-config-invalid' | 'project-state-write-failure';
52
+ reason: string;
53
+ };
54
+ /**
55
+ * v0.9 Batch 5: explicitly activates an already-persisted change contract for
56
+ * project `check` by updating exactly `acceptance.contract.changeArtifact`.
57
+ * Allowed only when the project already configures `acceptance.contract`:
58
+ * the block is never created, the baseline artifact and every other field are
59
+ * carried over verbatim from the on-disk configuration, the full updated
60
+ * configuration is validated before writing, and the write is atomic.
61
+ */
62
+ export declare function activateProjectChangeContract(projectRootInput: string, changeArtifactPath: string): Promise<ActivateProjectChangeContractResult>;
46
63
  export {};
@@ -77,7 +77,8 @@ async function captureObservation(input, allowReserved) {
77
77
  }
78
78
  export async function captureNamedObservation(input) { return captureObservation(input, false); }
79
79
  export async function captureCurrentObservation(projectRoot) { return captureObservation({ projectRoot, alias: 'current', replace: true }, true); }
80
- export async function loadProjectViewerState(projectRoot) {
80
+ export async function loadProjectViewerState(projectRootInput) {
81
+ const projectRoot = path.resolve(projectRootInput);
81
82
  const config = await readProjectConfig(projectConfigPath(projectRoot));
82
83
  if (!config.ok)
83
84
  return { ok: false, code: 'project-config-invalid', message: config.reason };
@@ -87,6 +88,43 @@ export async function loadProjectViewerState(projectRoot) {
87
88
  const aliases = {};
88
89
  for (const [alias, record] of Object.entries(catalog.catalog.observations))
89
90
  aliases[record.relativeArtifactDir] = alias;
90
- return { ok: true, root: projectEvidenceRoot(projectRoot), aliases };
91
+ return { ok: true, projectRoot, root: projectEvidenceRoot(projectRoot), aliases };
92
+ }
93
+ /**
94
+ * v0.9 Batch 5: explicitly activates an already-persisted change contract for
95
+ * project `check` by updating exactly `acceptance.contract.changeArtifact`.
96
+ * Allowed only when the project already configures `acceptance.contract`:
97
+ * the block is never created, the baseline artifact and every other field are
98
+ * carried over verbatim from the on-disk configuration, the full updated
99
+ * configuration is validated before writing, and the write is atomic.
100
+ */
101
+ export async function activateProjectChangeContract(projectRootInput, changeArtifactPath) {
102
+ const projectRoot = path.resolve(projectRootInput);
103
+ const configPath = projectConfigPath(projectRoot);
104
+ let raw;
105
+ try {
106
+ raw = JSON.parse(await readFile(configPath, 'utf8'));
107
+ }
108
+ catch (error) {
109
+ return { ok: false, code: 'project-config-invalid', reason: `project configuration could not be read: ${error instanceof Error ? error.message : String(error)}` };
110
+ }
111
+ const current = validateProjectConfig(raw);
112
+ if (!current.ok)
113
+ return { ok: false, code: 'project-config-invalid', reason: current.reason };
114
+ if (current.config.acceptance?.contract === undefined) {
115
+ return { ok: false, code: 'not-configured', reason: 'Project contract acceptance is not configured; the new contract was persisted but is not active for check.' };
116
+ }
117
+ const rawConfig = raw;
118
+ const updated = { ...rawConfig, acceptance: { ...rawConfig.acceptance, contract: { ...rawConfig.acceptance.contract, changeArtifact: changeArtifactPath } } };
119
+ const validated = validateProjectConfig(updated);
120
+ if (!validated.ok)
121
+ return { ok: false, code: 'project-config-invalid', reason: `updated project configuration would be invalid: ${validated.reason}` };
122
+ try {
123
+ await atomicTextWrite(configPath, `${JSON.stringify(updated, null, 2)}\n`);
124
+ }
125
+ catch (error) {
126
+ return { ok: false, code: 'project-state-write-failure', reason: `project configuration could not be written: ${error instanceof Error ? error.message : String(error)}` };
127
+ }
128
+ return { ok: true };
91
129
  }
92
130
  //# sourceMappingURL=projectWorkflowService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projectWorkflowService.js","sourceRoot":"","sources":["../../src/application/projectWorkflowService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,6B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O,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,MAAM,EAAE,+CAA+C,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC7K,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ObservationArtifact } from '../domain/schema.js';
2
+ import type { VisualAnnotationArtifact, VisualAnnotationItem } from '../domain/visualAnnotation.js';
3
+ export interface PromoteVisualAnnotationContractOptions {
4
+ annotation: VisualAnnotationArtifact;
5
+ sourceObservation: ObservationArtifact;
6
+ selectedItemIds: readonly string[];
7
+ activeBaselineIds: readonly string[];
8
+ outputLocation: string;
9
+ cwd?: string;
10
+ }
11
+ export type PromoteVisualAnnotationContractFailureCode = 'invalid-annotation' | 'unsupported-source' | 'source-mismatch' | 'invalid-selection' | 'persistence-failed';
12
+ export type PromoteVisualAnnotationContractResult = {
13
+ ok: true;
14
+ contractId: string;
15
+ contractRequestId: string;
16
+ artifactRoot: string;
17
+ manifestPath: string;
18
+ clauseCount: number;
19
+ } | {
20
+ ok: false;
21
+ code: PromoteVisualAnnotationContractFailureCode;
22
+ reason: string;
23
+ };
24
+ /** Maximum number of selected items accepted in one promotion (the annotation itself is bounded to 100 items). */
25
+ export declare const MAX_PROMOTION_ITEM_IDS = 100;
26
+ /** Why one selected item cannot become a canonical contract clause, or undefined when it can. */
27
+ export declare function contractPromotionBlockReason(item: VisualAnnotationItem): string | undefined;
28
+ /**
29
+ * v0.9 Batch 5: the one canonical annotation-to-contract use case. It turns
30
+ * explicitly selected, confirmed, canonically promotable runtime change items
31
+ * of one saved visual annotation into one ordinary `PerChangeContract`,
32
+ * built only with the existing contract identity builders and persisted
33
+ * exactly once through `persistPerChangeContract`.
34
+ *
35
+ * The whole promotion is refused if any selected item is not promotable
36
+ * (never a partial contract). Clause order follows `selectedItemIds`.
37
+ * `activeBaselineIds` are supplied by the caller from explicitly configured
38
+ * baseline-contract evidence only. The annotation is never evaluated here -
39
+ * the existing contract evaluator remains the only PASS/FAIL authority.
40
+ */
41
+ export declare function promoteVisualAnnotationContract(options: PromoteVisualAnnotationContractOptions): Promise<PromoteVisualAnnotationContractResult>;
@@ -0,0 +1,143 @@
1
+ import { isValidVisualAnnotationArtifact } from '../domain/visualAnnotation.js';
2
+ import { CONTRACT_ARTIFACT_KIND, CONTRACT_SCHEMA_VERSION, isValidContractPrimitive } from '../domain/frontendContracts.js';
3
+ import { buildClauseIdentity, buildFrontendContractInstanceIdentity, buildFrontendContractRequestIdentity } from '../domain/frontendContractIdentity.js';
4
+ import { persistPerChangeContract } from './frontendContractPersistenceService.js';
5
+ /** Maximum number of selected items accepted in one promotion (the annotation itself is bounded to 100 items). */
6
+ export const MAX_PROMOTION_ITEM_IDS = 100;
7
+ function fail(code, reason) {
8
+ return { ok: false, code, reason };
9
+ }
10
+ const MOVE_PROPERTIES = new Set(['x', 'y']);
11
+ const RESIZE_PROPERTIES = new Set(['width', 'height']);
12
+ const PRESERVE_PROPERTIES = new Set(['x', 'y', 'width', 'height']);
13
+ /**
14
+ * The bounded v0.9 promotion mapping check: a confirmed change primitive must
15
+ * be one of the first annotation mappings AND its subject must equal the
16
+ * item's explicit association. Anything else is refused, never coerced.
17
+ */
18
+ function primitiveMatchesAssociation(operation, primitive, association) {
19
+ switch (operation) {
20
+ case 'move':
21
+ case 'resize': {
22
+ if (association.kind !== 'runtime-target')
23
+ return false;
24
+ if (primitive.kind !== 'property-increases' && primitive.kind !== 'property-decreases')
25
+ return false;
26
+ if (primitive.minimumDeltaPx !== undefined)
27
+ return false;
28
+ const allowed = operation === 'move' ? MOVE_PROPERTIES : RESIZE_PROPERTIES;
29
+ return primitive.target === association.target && allowed.has(primitive.property);
30
+ }
31
+ case 'preserve':
32
+ if (association.kind === 'runtime-target') {
33
+ return primitive.kind === 'property-unchanged-within-tolerance' && primitive.target === association.target && PRESERVE_PROPERTIES.has(primitive.property);
34
+ }
35
+ return (primitive.kind === 'relationship-unchanged' &&
36
+ primitive.relationshipKind === association.relationshipKind &&
37
+ primitive.subjectTarget === association.subjectTarget &&
38
+ primitive.relatedTarget === association.relatedTarget);
39
+ default:
40
+ return false;
41
+ }
42
+ }
43
+ /** Why one selected item cannot become a canonical contract clause, or undefined when it can. */
44
+ export function contractPromotionBlockReason(item) {
45
+ const { interpretation } = item;
46
+ if (interpretation.state === 'uninterpreted')
47
+ return 'the item has no interpretation';
48
+ if (interpretation.state === 'candidate')
49
+ return 'the item interpretation is a candidate, not confirmed';
50
+ const intent = interpretation.intent;
51
+ if (intent.kind === 'inspect')
52
+ return 'inspect intent is informational and never a contract clause';
53
+ if (intent.kind !== 'change')
54
+ return `"${intent.kind}" intent is not runtime change intent`;
55
+ if (intent.operation === 'remove')
56
+ return 'remove is not canonically promotable: the current frontend-contract vocabulary has no target-absent primitive';
57
+ if (intent.contractPrimitive === undefined || !isValidContractPrimitive(intent.contractPrimitive))
58
+ return 'the confirmed change intent has no valid contract primitive';
59
+ if (item.association === undefined)
60
+ return 'the item has no explicit structured association';
61
+ if (item.association.kind !== 'runtime-target' && item.association.kind !== 'runtime-relationship')
62
+ return 'the item association is not runtime evidence';
63
+ if (!primitiveMatchesAssociation(intent.operation, intent.contractPrimitive, item.association))
64
+ return 'the contract primitive does not match the explicit association and operation';
65
+ return undefined;
66
+ }
67
+ function observationMatchesSource(annotation, observation) {
68
+ const source = annotation.source;
69
+ if (source.kind !== 'runtime-observation')
70
+ return false;
71
+ const screenshot = observation.screenshot;
72
+ return (observation.observationId === source.observationId &&
73
+ observation.requestId === source.requestId &&
74
+ observation.schemaVersion === source.observationSchemaVersion &&
75
+ (screenshot.state === 'available' || screenshot.state === 'partial') &&
76
+ screenshot.value.path === source.screenshot.path &&
77
+ observation.requestConfig.viewport.width === source.coordinateSpace.width &&
78
+ observation.requestConfig.viewport.height === source.coordinateSpace.height);
79
+ }
80
+ /**
81
+ * v0.9 Batch 5: the one canonical annotation-to-contract use case. It turns
82
+ * explicitly selected, confirmed, canonically promotable runtime change items
83
+ * of one saved visual annotation into one ordinary `PerChangeContract`,
84
+ * built only with the existing contract identity builders and persisted
85
+ * exactly once through `persistPerChangeContract`.
86
+ *
87
+ * The whole promotion is refused if any selected item is not promotable
88
+ * (never a partial contract). Clause order follows `selectedItemIds`.
89
+ * `activeBaselineIds` are supplied by the caller from explicitly configured
90
+ * baseline-contract evidence only. The annotation is never evaluated here -
91
+ * the existing contract evaluator remains the only PASS/FAIL authority.
92
+ */
93
+ export async function promoteVisualAnnotationContract(options) {
94
+ const { annotation, sourceObservation, selectedItemIds, activeBaselineIds } = options;
95
+ const validation = isValidVisualAnnotationArtifact(annotation);
96
+ if (!validation.valid)
97
+ return fail('invalid-annotation', `visual annotation is invalid: ${validation.reason}`);
98
+ if (annotation.source.kind !== 'runtime-observation')
99
+ return fail('unsupported-source', 'only runtime-observation annotations can be promoted into a frontend change contract');
100
+ if (!observationMatchesSource(annotation, sourceObservation))
101
+ return fail('source-mismatch', 'the supplied observation is not the exact canonical source of this annotation');
102
+ if (selectedItemIds.length === 0)
103
+ return fail('invalid-selection', 'select at least one confirmed annotation item to promote');
104
+ if (selectedItemIds.length > MAX_PROMOTION_ITEM_IDS)
105
+ return fail('invalid-selection', `at most ${MAX_PROMOTION_ITEM_IDS} items can be promoted at once`);
106
+ if (new Set(selectedItemIds).size !== selectedItemIds.length)
107
+ return fail('invalid-selection', 'selected annotation item ids must be unique');
108
+ const itemsById = new Map(annotation.items.map((item) => [item.annotationItemId, item]));
109
+ const clauses = [];
110
+ for (const itemId of selectedItemIds) {
111
+ const item = itemsById.get(itemId);
112
+ if (item === undefined)
113
+ return fail('invalid-selection', `selected annotation item "${itemId}" does not exist in this annotation`);
114
+ const blocked = contractPromotionBlockReason(item);
115
+ if (blocked !== undefined)
116
+ return fail('invalid-selection', `annotation item "${itemId}" cannot be promoted: ${blocked}`);
117
+ const intent = item.interpretation.intent;
118
+ const primitive = intent.contractPrimitive;
119
+ clauses.push({
120
+ clauseId: buildClauseIdentity(primitive),
121
+ category: intent.category,
122
+ ...(intent.expectedDependentMode === undefined ? {} : { expectedDependentMode: intent.expectedDependentMode }),
123
+ primitive,
124
+ supportingEvidence: [{ path: `visualAnnotation.${annotation.annotationId}.source` }, { path: `visualAnnotation.${annotation.annotationId}.items.${item.annotationItemId}` }],
125
+ });
126
+ }
127
+ const contractRequestId = buildFrontendContractRequestIdentity(annotation.source.observationId, clauses.map((clause) => ({ primitive: clause.primitive })), []);
128
+ const contractId = buildFrontendContractInstanceIdentity(contractRequestId);
129
+ const contract = {
130
+ artifactKind: CONTRACT_ARTIFACT_KIND,
131
+ schemaVersion: CONTRACT_SCHEMA_VERSION,
132
+ contractClass: 'change',
133
+ contractId,
134
+ contractRequestId,
135
+ activeBaselineIds: [...activeBaselineIds],
136
+ clauses,
137
+ };
138
+ const persisted = await persistPerChangeContract(contract, { outputLocation: options.outputLocation, ...(options.cwd === undefined ? {} : { cwd: options.cwd }) });
139
+ if (!persisted.ok)
140
+ return fail('persistence-failed', persisted.diagnostics.map((d) => d.message).join('; '));
141
+ return { ok: true, contractId, contractRequestId, artifactRoot: persisted.artifactRoot, manifestPath: persisted.manifestPath, clauseCount: clauses.length };
142
+ }
143
+ //# sourceMappingURL=visualAnnotationContractPromotionService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visualAnnotationContractPromotionService.js","sourceRoot":"","sources":["../../src/application/visualAnnotationContractPromotionService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAEhF,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;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C,QAAQ,EAAE,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IACnK,IAAI,CAAC,SAAS,CAAC,EAAE;QAAE,OAAO,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAE7G,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;AAC9J,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { Diagnostic } from '../domain/diagnostics.js';
2
+ import type { VisualAnnotationItem, VisualAnnotationSource } from '../domain/visualAnnotation.js';
3
+ import type { WriteVisualAnnotationArtifactOptions } from '../artifacts/visualAnnotationArtifactWriter.js';
4
+ export interface PersistVisualAnnotationOptions {
5
+ source: VisualAnnotationSource;
6
+ items: VisualAnnotationItem[];
7
+ outputLocation: string;
8
+ cwd?: WriteVisualAnnotationArtifactOptions['cwd'];
9
+ /** Canonical annotationId of the previous artifact this save explicitly revises. Carried forward verbatim; lineage is not resolved here. */
10
+ supersedesAnnotationId?: string;
11
+ }
12
+ export type ApplicationPersistVisualAnnotationResult = {
13
+ ok: true;
14
+ annotationId: string;
15
+ annotationRequestId: string;
16
+ artifactRoot: string;
17
+ manifestPath: string;
18
+ overlayPath: string;
19
+ } | {
20
+ ok: false;
21
+ diagnostics: Diagnostic[];
22
+ };
23
+ /**
24
+ * The one canonical Batch 1 application use case for saving a visual
25
+ * annotation: validates source/items through the canonical annotation domain,
26
+ * normalizes the portable output location, derives the deterministic request
27
+ * identity and a fresh instance identity, renders the deterministic overlay
28
+ * and its SHA-256, and persists exactly once through the canonical writer.
29
+ *
30
+ * It never reads a viewer alias, resolves another artifact, checks revision
31
+ * lineage, checks whether an associated target/region exists, promotes a
32
+ * contract, materializes a reference, or modifies project configuration.
33
+ */
34
+ export declare function persistVisualAnnotation(options: PersistVisualAnnotationOptions): Promise<ApplicationPersistVisualAnnotationResult>;