@dailephd/my-frontend-observer 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +107 -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 +57 -1
  79. package/docs/COMMANDS.md +44 -4
  80. package/docs/CONTRACTS.md +78 -8
  81. package/docs/CURRENT_STATE.md +157 -35
  82. package/docs/DEVELOPMENT.md +8 -3
  83. package/docs/PROJECT_DESCRIPTION.md +4 -1
  84. package/docs/PROJECT_MILESTONES.md +4 -0
  85. package/docs/PROJECT_OVERVIEW.md +41 -17
  86. package/docs/QUICKSTART.md +52 -39
  87. package/docs/RELEASE.md +16 -11
  88. package/docs/ROADMAP.md +406 -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/reports/v0.9-architecture-retrieval.md +567 -0
  93. package/docs/reports/v0.9-batch1-visual-annotation-foundation.md +351 -0
  94. package/docs/reports/v0.9-batch2-viewer-annotation-authoring-boundary.md +438 -0
  95. package/docs/reports/v0.9-batch3-runtime-screenshot-annotation-authoring.md +412 -0
  96. package/docs/reports/v0.9-batch4-external-reference-annotation-authoring.md +452 -0
  97. package/docs/reports/v0.9-batch5-runtime-intent-contract-promotion.md +535 -0
  98. package/docs/reports/v0.9-batch6-reference-materialization.md +514 -0
  99. package/docs/reports/v0.9-batch7-integrated-acceptance.md +644 -0
  100. package/docs/reports/v0.9-demo-foundation.md +589 -0
  101. package/docs/reports/v0.9-final-pre-release-readiness.md +209 -0
  102. package/docs/reports/v0.9-final-readiness-corrections.md +530 -0
  103. package/docs/reports/v0.9-pre-release-readiness.md +170 -0
  104. package/docs/reports/v0.9-tutorial-end-to-end-acceptance.md +980 -0
  105. package/docs/reports/v0.9-tutorial-integration.md +731 -0
  106. package/package.json +2 -2
  107. package/dist/viewer/assets/index-D98S1_2d.js +0 -9
@@ -21,17 +21,20 @@ the workflow result remain in memory/presentation.
21
21
  ## Current package architecture
22
22
 
23
23
  The current repository is one published TypeScript ESM package
24
- (`@dailephd/my-frontend-observer@0.8.1`). The CLI remains
24
+ (`@dailephd/my-frontend-observer@0.9.0`). The CLI remains
25
25
  `my-frontend-observer`; the npm scope does not rename the product or artifact
26
26
  identities.
27
27
 
28
28
  - `src/cli.ts` is the real, thin public CLI parsing/dispatch/presentation
29
29
  boundary for the current command surface (`observe`, `compare`,
30
30
  `approve-baseline`, `save-change-contract`, `evaluate-contract`,
31
- `import-reference`, `approve-reference`, `evaluate-reference-fidelity`);
32
- argument parsing and output formatting only, per command - the commands do
33
- not share domain semantics in the CLI. v0.6 added no new CLI command; v0.7
34
- added the three external-reference commands.
31
+ `import-reference`, `approve-reference`, `evaluate-reference-fidelity`,
32
+ `view`, `init`, `capture`, `check`); argument parsing and output formatting
33
+ only, per command - domain semantics remain owned by application/domain
34
+ services rather than the CLI. v0.6 added no new CLI command; v0.7 added the
35
+ three external-reference commands; v0.8 added `view`; v0.8.1 added `init`,
36
+ `capture`, and `check` and made `view` project-aware while preserving its
37
+ standalone `--root` behavior.
35
38
  - `src/index.ts` is the library entry point re-exporting the observer-owned
36
39
  contracts/functions from every layer below, including the v0.6 bounded-agent-
37
40
  context projection and runtime/static correlation surface, and the v0.7
@@ -374,8 +377,10 @@ actual architecture, and `docs/CURRENT_STATE.md` for release state. It
374
377
  extends the existing v0.1-v0.6 evidence architecture rather than becoming a
375
378
  UI-only feature or a parallel visual-comparison stack. v0.8 (interactive
376
379
  viewer) is released as package version `0.8.0`. v0.9 (structured visual
377
- annotation) and v0.10 (full graphical human-LLM workflow) remain future and
378
- unimplemented; the constraints below apply to that still-future work.
380
+ annotation) is released as package version `0.9.0` - see "v0.9 visual
381
+ annotation architecture" below. v0.10 (full graphical human-LLM
382
+ workflow) remains future and unimplemented. The constraints below applied to
383
+ v0.9 and still apply to v0.10.
379
384
 
380
385
  The evidence domains remain distinct:
381
386
 
@@ -442,8 +447,9 @@ described in "v0.7 Prompt 1" through "v0.7 Prompt 8" below: explicit
442
447
  identity/provenance, applicability/compatibility, region-to-target bindings,
443
448
  requested/expected-dependent/protected/preserved reuse, and the non-mutating
444
449
  Chromium/correlation boundaries all remain as constrained here. v0.8 (see
445
- "v0.8 Batch 1" through "v0.8 Batch 8" below) applied them unchanged; they
446
- continue to apply unchanged to the still-future v0.9-v0.10 work.
450
+ "v0.8 Batch 1" through "v0.8 Batch 8" below) applied them unchanged, and so
451
+ does the implemented v0.9 annotation layer. They continue to apply unchanged
452
+ to the still-future v0.10 work.
447
453
 
448
454
  The exact public artifact names, schema versions, persistence layout, supported
449
455
  image formats, coordinate model, requirement/tolerance primitives, and fidelity
@@ -1076,6 +1082,86 @@ record.
1076
1082
  re-running the exact `grep -rn` audit from earlier batches - unchanged
1077
1083
  findings, no duplicate evidence engine exists.
1078
1084
 
1085
+ ## v0.9 visual annotation architecture (released in 0.9.0)
1086
+
1087
+ v0.9 is released as package version `0.9.0`. It adds one new
1088
+ evidence family and a narrow local authoring path to the existing viewer. It
1089
+ adds no new evaluator, no second contract or reference model, and no new
1090
+ PASS/FAIL semantics.
1091
+
1092
+ **Evidence ownership**:
1093
+
1094
+ - `src/domain/visualAnnotation.ts` owns `VisualAnnotationArtifact` (artifact
1095
+ kind `my-frontend-observer/visual-annotation`, schema `1.0.0`): the source
1096
+ union, structured marks, explicit associations, candidate/confirmed
1097
+ interpretation, validation, and the pure overlay SVG renderer.
1098
+ - `src/domain/visualAnnotationIdentity.ts` owns deterministic request identity
1099
+ and fresh instance identity.
1100
+ - `src/artifacts/visualAnnotationArtifactWriter.ts` and
1101
+ `visualAnnotationArtifactReader.ts` own atomic persistence (temporary
1102
+ `.tmp-<id>` directory, then rename) and canonical reading, including the
1103
+ derived `annotation-overlay.svg` and its digest.
1104
+ - `src/application/visualAnnotationPersistenceService.ts` owns saving one
1105
+ annotation or one superseding revision.
1106
+
1107
+ **Coordinate domains**: runtime annotations use the observation's runtime CSS
1108
+ pixel space. Reference annotations use the reference image's own pixel space
1109
+ (for an approved reference, the owning imported image). The two domains are
1110
+ never mixed. Zoomed or panned drawing is mapped back through the SVG's own
1111
+ transform (`viewer/src/svg/sourceCoordinates.ts`).
1112
+
1113
+ **Viewer discovery and media** (`src/viewerServer/evidence/`): the index
1114
+ classifies `visual-annotation` evidence and skips writer `.tmp-*`
1115
+ directories. `annotationView.ts` resolves an annotation's exact canonical
1116
+ source and reports `unavailable` instead of guessing a replacement. The media
1117
+ resolver serves the `annotation-overlay` role only after re-rendering the SVG
1118
+ from the artifact and verifying it, with a script-blocking sandbox policy.
1119
+
1120
+ **Project-aware authoring security**: `src/viewerServer/authoringSecurity.ts`
1121
+ owns the in-memory 32-byte session capability and the Host, Origin, token,
1122
+ content-type, and content-encoding checks. `httpServer.ts` owns the shared
1123
+ bounded JSON gate and routes exactly three `POST` responsibilities.
1124
+ `view --root` never creates an authoring session, so the standalone
1125
+ arbitrary-root viewer stays read-only.
1126
+
1127
+ 1. `POST /api/annotations` (`src/viewerServer/annotationAuthoring.ts`) saves
1128
+ a new annotation or a revision through the canonical persistence service,
1129
+ with stale-parent conflict detection. This module also owns the single
1130
+ per-session write queue used by all three routes.
1131
+ 2. `POST /api/annotations/:handle/promote-contract`
1132
+ (`src/viewerServer/annotationContractPromotion.ts`) calls
1133
+ `src/application/visualAnnotationContractPromotionService.ts`. Selected
1134
+ confirmed runtime intent becomes one canonical `PerChangeContract` through
1135
+ the existing contract persistence service. Optional activation goes only
1136
+ through `activateProjectChangeContract` in
1137
+ `src/application/projectWorkflowService.ts`.
1138
+ 3. `POST /api/annotations/:handle/materialize-reference`
1139
+ (`src/viewerServer/annotationReferenceMaterialization.ts`) calls
1140
+ `src/application/visualAnnotationReferenceMaterializationService.ts`.
1141
+ Selected confirmed reference intent becomes a new imported
1142
+ `ExternalReferenceArtifact` through the existing `importExternalReference`,
1143
+ superseding the source. The image bytes come only from the safe media
1144
+ resolver.
1145
+
1146
+ Output locations come from `src/projectWorkflow/projectPaths.ts`
1147
+ (`annotations`, `contracts`, and `references` under
1148
+ `.frontend-observer/evidence`). The browser never supplies a path.
1149
+
1150
+ **Viewer UI** (`viewer/src/`): `annotation/` holds pure presentation models
1151
+ (`annotationGeometry.ts`, `runtimeIntent.ts`, `referenceIntent.ts`,
1152
+ `confirmation.ts`). `components/AnnotationLayer.tsx`,
1153
+ `AnnotationToolbar.tsx`, `RuntimeAnnotationPanel.tsx`,
1154
+ `ReferenceAnnotationPanel.tsx`, `CandidateRegionPreviewLayer.tsx`, and
1155
+ `AnnotationPanelSections.tsx` render marks, tools, intent, promotion, and
1156
+ materialization. Hooks under `hooks/` hold draft, saved-list, session,
1157
+ pointer, promotion, and materialization state. The authoring token lives only
1158
+ in React memory.
1159
+
1160
+ **Existing evaluators remain authoritative**: the canonical contract
1161
+ evaluator, reference relationship derivation, requirement adequacy, reference
1162
+ fidelity, and project `check` are unchanged. Annotation evidence feeds them
1163
+ only through promoted contracts and materialized references.
1164
+
1079
1165
  ## Retained v0.1 architecture constraints
1080
1166
 
1081
1167
  v0.1 planning preserved these approved boundaries without treating module
@@ -1241,18 +1327,19 @@ itself, not a new parallel context system, gains one new optional input (an
1241
1327
  already-computed Prompt 6 fidelity evaluation): fidelity-relevant runtime
1242
1328
  targets fold into the exact same required/permitted-target-allocation,
1243
1329
  evidence-tiering, omission/truncation, and adequacy machinery v0.5 contract
1244
- clauses already compete in, and a new `fidelity?` field on
1245
- `BoundedAgentContextArtifact` (mirroring `correlations?`'s own additive,
1246
- non-version-bumping precedent from v0.6 Batch 3) carries a bounded,
1247
- priority-ordered selection of Prompt 6's non-passing requirement results
1248
- plus passing protected/preserved context. No second bounded-context
1249
- architecture, no recomputation of Prompt 2-6/v0.4/v0.5 logic, and no change
1250
- to v0.6's own runtime/static correlation (`deriveRuntimeStaticCorrelations`/
1251
- `attachRuntimeStaticCorrelations` are untouched and reused exactly as
1252
- before) - a caller joins fidelity, target, and correlation evidence by the
1253
- one stable v0.2 runtime target id all three already share. Every new field
1254
- is optional and additive; a pre-Prompt-7 caller supplying no fidelity
1255
- evidence receives byte-identical output, including logical identity.
1330
+ clauses already compete in, and a new `fidelity?:
1331
+ BoundedReferenceFidelityProjection` field on `BoundedAgentContextArtifact`
1332
+ (mirroring `correlations?`'s own additive, non-version-bumping precedent
1333
+ from v0.6 Batch 3) carries a bounded, priority-ordered selection of Prompt
1334
+ 6's non-passing requirement results plus passing protected/preserved
1335
+ context. No second bounded-context architecture, no recomputation of Prompt
1336
+ 2-6/v0.4/v0.5 logic, and no change to v0.6's own runtime/static correlation
1337
+ (`deriveRuntimeStaticCorrelations`/`attachRuntimeStaticCorrelations` are
1338
+ untouched and reused exactly as before) - a caller joins fidelity, target,
1339
+ and correlation evidence by the one stable v0.2 runtime target id all three
1340
+ already share. Every new field is optional and additive; a pre-Prompt-7
1341
+ caller supplying no fidelity evidence receives byte-identical output,
1342
+ including logical identity.
1256
1343
 
1257
1344
  v0.7 Prompt 8 adds the first complete, controlled end-to-end external-
1258
1345
  reference correction workflow (`domain/referenceCorrectionWorkflow.ts`,
package/docs/CI_CD.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CI/CD
2
2
 
3
- CI interprets `check` as PASS `0`, FAIL `1`, REVIEW_REQUIRED `2`, or BLOCKED `3`. The released package is `@dailephd/my-frontend-observer@0.8.1`; its CLI remains `my-frontend-observer`. Packed readiness installs one exact tarball and runs `runPackedViewerSmoke.mjs` as the single project/viewer smoke owner for `init`, `capture`, bounded `check --json` REVIEW_REQUIRED and unchanged-contract FAIL-to-PASS, alias-aware project `view`, and viewer security. `runPackedObservationSmoke.mjs` remains the lower-level legacy observation smoke.
3
+ CI interprets `check` as PASS `0`, FAIL `1`, REVIEW_REQUIRED `2`, or BLOCKED `3`. The released package is `@dailephd/my-frontend-observer@0.9.0`; its CLI remains `my-frontend-observer`. Packed readiness installs one exact tarball and runs `runPackedViewerSmoke.mjs` as the single project/viewer smoke owner for `init`, `capture`, bounded `check --json` REVIEW_REQUIRED and unchanged-contract FAIL-to-PASS, alias-aware project `view`, and viewer security. `runPackedObservationSmoke.mjs` remains the lower-level legacy observation smoke.
4
4
 
5
5
  A GitHub Actions pre-release readiness workflow exists at
6
6
  `.github/workflows/pre-release-readiness.yml` (triggered manually via
@@ -248,3 +248,59 @@ evidence-root escape in the viewer's media route) both passed before this
248
248
  release - see
249
249
  `docs/reports/v0.8-prerelease-readiness-cross-platform-security-code-rot.md`
250
250
  for the complete readiness report.
251
+
252
+ ## v0.9 packaging implications (released in 0.9.0; final cross-platform readiness passed)
253
+
254
+ v0.9 visual annotation is released as `@dailephd/my-frontend-observer@0.9.0`.
255
+ Final exact-candidate readiness passed on Windows, Linux and macOS - see
256
+ `docs/reports/v0.9-final-pre-release-readiness.md`.
257
+ `.github/workflows/pre-release-readiness.yml` keeps the same exact-candidate
258
+ structure:
259
+
260
+ 1. The `candidate` job runs once on Linux with Node 24. It runs every local
261
+ validation command, builds the package, creates one tarball with
262
+ `npm pack --json`, freezes its SHA-256, and uploads both.
263
+ 2. The `matrix-smoke` job runs on `windows-latest`, `ubuntu-latest`, and
264
+ `macos-latest` with Node 24. Each lane downloads that same tarball and
265
+ fails if its SHA-256 differs.
266
+ 3. Each lane installs the tarball into a clean consumer and runs three packed
267
+ smokes in real Chromium:
268
+ 1. `scripts/ci/runPackedObservationSmoke.mjs` (observation and low-level
269
+ command behavior), writing `smoke-summary.json`;
270
+ 2. `scripts/ci/runPackedViewerSmoke.mjs` (project workflow and
271
+ project-aware viewer inspection), writing `viewer-smoke-summary.json`;
272
+ 3. `scripts/ci/runPackedV09AnnotationSmoke.mjs` (v0.9 annotation), writing
273
+ `v09-annotation-smoke-summary.json`.
274
+ 4. All three summaries are uploaded as the `smoke-summary-<os>` artifact.
275
+
276
+ The v0.9 annotation smoke uses only the installed package. It checks that the
277
+ compiled v0.9 owners and the built viewer are in the tarball, that the bare
278
+ package specifier and Playwright resolve inside the consumer's own
279
+ `node_modules`, and that the public v0.9 exports resolve. It then runs
280
+ `init`, `capture baseline`, and `check baseline --json`, and starts the
281
+ project-aware `view` (viewer protocol `1.3.0`, authoring enabled). In real
282
+ Chromium it saves and reloads a runtime annotation, promotes confirmed move
283
+ intent into a canonical change contract, imports a reference with the
284
+ installed `import-reference`, annotates it, and materializes a confirmed
285
+ region into a new imported revision. That revision must supersede the source,
286
+ reuse its exact image bytes, and not be approved. Finally it starts a
287
+ standalone `view --root` session and proves it is read-only. The summary never
288
+ contains the authoring token, absolute project paths, or note text.
289
+
290
+ The standalone read-only proof for v0.9 authoring lives in the v0.9
291
+ annotation smoke. The project-aware inspection and project workflow proof
292
+ lives in the packed viewer smoke.
293
+
294
+ A separate `tutorial-readiness` job runs on the same three operating systems.
295
+ It builds Observer from the repository source and runs
296
+ `scripts/run-v09-tutorial-readiness.mjs`, which validates and runs the four
297
+ `examples/v09-demo/tutorials/` scenarios through the external tool
298
+ `@dailephd/my-dev-kit-lab@0.4.9`, then reads the evidence each run wrote back
299
+ through the canonical Observer readers. It fails unless every scenario passes
300
+ with empty `cleanupErrors`, the tracked demo source is unchanged, and the
301
+ repository status is unchanged. The demo and the lab are repository release
302
+ support only. Neither is in the npm package or an Observer dependency.
303
+
304
+ The v0.9 matrix wiring has not yet run in GitHub Actions for this candidate.
305
+ The local Windows run of all three smokes against one exact tarball is
306
+ recorded in `docs/reports/v0.9-batch7-integrated-acceptance.md`.
package/docs/COMMANDS.md CHANGED
@@ -757,8 +757,33 @@ and exits nonzero.
757
757
 
758
758
  ## `view`
759
759
 
760
- **Current status: v0.8.1 viewer behavior is released as package
761
- `@dailephd/my-frontend-observer@0.8.1`.** Starts one
760
+ **v0.9 visual annotation (released in `0.9.0`).**
761
+ There is no separate annotation command. `view` is the annotation entry point:
762
+
763
+ - `my-frontend-observer view` (inside an initialized project, without
764
+ `--root`) is the normal project-aware viewer. It enables local annotation
765
+ authoring for that project. In the browser you can draw on observations and
766
+ external references, explicitly associate and confirm structured intent,
767
+ save immutable annotations, promote selected confirmed runtime intent into a
768
+ change contract, and materialize selected confirmed reference intent into a
769
+ new imported reference revision. New artifacts are written only under the
770
+ project's managed evidence root (`.frontend-observer/evidence`). Nothing is
771
+ approved automatically.
772
+ - `my-frontend-observer view --root <root>` is the advanced standalone form
773
+ for arbitrary evidence roots. It is always read-only. Saved annotations can
774
+ be inspected but not edited, and every authoring request is refused.
775
+
776
+ In a project-aware session the viewer protocol is `1.3.0` and the API adds
777
+ `GET /api/authoring/session`, `GET /api/annotations/<handle>/view`, the
778
+ `annotation-overlay` media role, and exactly three authoring routes:
779
+ `POST /api/annotations`, `POST /api/annotations/<handle>/promote-contract`,
780
+ and `POST /api/annotations/<handle>/materialize-reference`. See
781
+ `docs/SECURITY.md` for the local write boundary and `docs/WORKFLOWS.md` for
782
+ the annotation workflow. The rest of this section describes the inspection
783
+ surface, which is unchanged.
784
+
785
+ **Current status: viewer behavior is released as package
786
+ `@dailephd/my-frontend-observer@0.9.0`.** Starts one
762
787
  loopback-only Node viewer server and serves the same React + TypeScript +
763
788
  Vite application to a normal browser or an installed Progressive Web App.
764
789
  `--root` is used as a bounded, read-only evidence-discovery root: the server
@@ -925,8 +950,10 @@ Options:
925
950
  The server binds only to `127.0.0.1` (never `0.0.0.0`), serves only the
926
951
  built viewer application assets plus the bounded, read-only `/api/*`
927
952
  endpoints described above, and never exposes the supplied evidence root as a
928
- generic static directory or arbitrary filesystem path. It accepts no write
929
- methods and mutates nothing. On success,
953
+ generic static directory or arbitrary filesystem path. With `--root` it
954
+ accepts no write methods and writes nothing. Without `--root`, the only
955
+ writes are the three v0.9 authoring routes above, which create new immutable
956
+ artifacts and never modify existing ones. On success,
930
957
  prints the viewer URL and keeps running (serving the viewer) until
931
958
  interrupted. On invalid syntax, a missing/non-directory `--root`, an
932
959
  invalid `--port`, an invalid `--bindings-file`, an invalid `--context-file`
@@ -934,6 +961,19 @@ invalid `--port`, an invalid `--bindings-file`, an invalid `--context-file`
934
961
  normally), or a port already in use, prints structured diagnostics to
935
962
  stderr and exits nonzero without starting a server.
936
963
 
964
+ ## Cross-tool compatibility handoffs
965
+
966
+ The canonical command-by-command composition map is [my-dev-kit ecosystem workflow section 9.15](https://github.com/dailephd/my-dev-kit/blob/main/docs/ECOSYSTEM_DEVELOPMENT_WORKFLOWS.md#915-command-surface-compatibility-map).
967
+
968
+ Current supported boundaries:
969
+
970
+ - my-dev-kit file/symbol evidence can be mapped by a small **programmatic adapter** into the plain caller-supplied static-candidate records accepted by `deriveRuntimeStaticCorrelations(...)` / `attachRuntimeStaticCorrelations(...)`. Raw my-dev-kit search, lookup, slice, or context JSON is not a direct Observer CLI input.
971
+ - A produced Observer `BoundedAgentContextArtifact` can be inspected directly with `view --context-file <file>`. That option accepts only the Observer bounded-context schema, not a my-dev-kit context capsule.
972
+ - Orchestrator has a direct programmatic consumer for the released Observer bounded-agent-context wire contract. Orchestrator does not launch Observer.
973
+ - A selected Lab tutorial screenshot PNG can be passed to `import-reference`, then explicitly approved and bound like any other external image reference. The Lab tutorial manifest and behavioral assertions are not imported.
974
+ - Lab report/gallery commands do not generically consume Observer evidence roots, and Observer commands do not consume Lab security/audit/experiment reports.
975
+ - `check [baseline] --json` is the preferred compact final-candidate runtime result for an external coding-agent or Orchestrator report, but the downstream consumer must preserve `PASS`, `FAIL`, `REVIEW_REQUIRED`, and `BLOCKED` rather than collapse them to process success/failure.
976
+
937
977
  ## Foundation commands
938
978
 
939
979
  - `npm install` — install dependencies (includes the `playwright` runtime
package/docs/CONTRACTS.md CHANGED
@@ -490,7 +490,7 @@ blockers; on the canonical worktree, `npm run typecheck`, `npm run lint`,
490
490
  `npm test` (627 tests), `npm run test:browser` (120 tests), `npm run
491
491
  test:security`, `npm run build`, and `npm run check:docs` all pass.
492
492
 
493
- ## v0.7 external visual-reference contract direction (released as `0.7.0`; v0.8 viewer released as `0.8.0`; v0.9-v0.10 still future)
493
+ ## v0.7 external visual-reference contract direction (released as `0.7.0`; v0.8 viewer released as `0.8.0`; v0.9 released as `0.9.0`; v0.10 still future)
494
494
 
495
495
  External visual-reference support is released as package version `0.7.0`
496
496
  (see "v0.7 Prompt 1" through "v0.7 Prompt 8" below for the exact contract).
@@ -498,8 +498,9 @@ The exact public type names, artifact kinds, schema versions, persistence
498
498
  layout, and command/programmatic entry points were designed during v0.7
499
499
  implementation from current repository precedent, following the constraints
500
500
  below. v0.8 (released as package version `0.8.0` - see
501
- `docs/CURRENT_STATE.md`) has preserved them; v0.9-v0.10 remain future and
502
- must continue to preserve them.
501
+ `docs/CURRENT_STATE.md`) has preserved them. v0.9 (implemented, not yet
502
+ released) preserves them too. v0.10 remains future and must continue to
503
+ preserve them.
503
504
 
504
505
  **Distinct evidence domain**: an external reference is desired-design evidence,
505
506
  not an `ObservationArtifact` and not the "before" side of a v0.4
@@ -569,11 +570,80 @@ The v0.8 viewer, released as package version `0.8.0`, consumes this v0.7
569
570
  reference/evaluation contract exactly as required - it creates no UI-only
570
571
  reference model (see `docs/ARCHITECTURE.md` "v0.8 Batch 5"/"v0.8 Batch 6"
571
572
  and `docs/reports/v0.8-reference-candidate-inspection-batch5.md`). v0.9
572
- annotations may originate
573
- from runtime screenshots or external references but must preserve which source
574
- identity/coordinate system they belong to and feed the same canonical contract
575
- semantics. v0.10 combines both entry modes into the full correction/approval
576
- workflow.
573
+ annotations (released in `0.9.0`) originate from runtime
574
+ screenshots or external references, preserve which source identity and
575
+ coordinate system they belong to, and feed the same canonical contract and
576
+ reference semantics - see "v0.9 visual annotation contract" below. v0.10
577
+ combines both entry modes into the full correction/approval workflow.
578
+
579
+ ## v0.9 visual annotation contract (released in 0.9.0)
580
+
581
+ v0.9 is released as `@dailephd/my-frontend-observer@0.9.0`.
582
+
583
+ **Artifact**: `VisualAnnotationArtifact`, artifact kind
584
+ `my-frontend-observer/visual-annotation`, schema version `1.0.0`. It stores one
585
+ exact canonical source (a runtime observation, or an imported or approved
586
+ external reference), the source coordinate space (runtime CSS pixels or
587
+ reference-image pixels), and bounded structured items. Each item has a stable
588
+ `annotationItemId`, one mark (point, rectangle, line, arrow, or note), an
589
+ optional explicit association, and an interpretation. A revision sets
590
+ `supersedesAnnotationId` and never rewrites its parent. The overlay SVG is
591
+ derived from the artifact and verified before it is served.
592
+
593
+ **An annotation is not a contract.** Saving an annotation never creates a
594
+ contract clause, a reference requirement, or a PASS/FAIL rule. Marks and
595
+ visible pixels are evidence. Overlap between a mark and a target or region is
596
+ not ownership and never creates an association.
597
+
598
+ **Interpretation states**: `uninterpreted`, `candidate`, and `confirmed`.
599
+ Confirmation is explicit and records `confirmedAt`. Editing the mark,
600
+ association, or intent of a confirmed item withdraws the confirmation.
601
+
602
+ **Runtime intent to contract**:
603
+
604
+ - Only selected, confirmed, supported runtime intent is promoted. Promotion
605
+ creates one normal canonical `PerChangeContract` through the existing
606
+ contract persistence service.
607
+ - Supported mappings use the existing `ContractPrimitive` vocabulary only.
608
+ `move` maps to `property-increases`/`property-decreases` on `x` or `y`.
609
+ `resize` maps to `property-increases`/`property-decreases` on `width` or
610
+ `height`. `preserve` maps to `property-unchanged-within-tolerance` for a
611
+ target property, or to `relationship-unchanged` for an explicitly associated
612
+ canonical relationship.
613
+ - Categories are the canonical `requested`, `expected-dependent` (with a
614
+ required `required` or `permitted` mode), `protected`, and `preserved`.
615
+ `unexpected` is never authored; it stays evaluator-derived.
616
+ - `remove` can be confirmed and saved, but it is not promotable in v0.9. The
617
+ contract vocabulary has no target-absent primitive, and no approximate
618
+ clause is fabricated.
619
+ - `inspect` intent and notes are informational and never promoted.
620
+ - Each clause's `supportingEvidence` records the annotation source and item
621
+ paths. Promotion never activates the contract unless explicitly requested,
622
+ and it never approves a baseline.
623
+
624
+ **Reference intent to a new reference revision**:
625
+
626
+ - Only selected, confirmed `reference-region` (`create` or `refine`) and
627
+ `reference-requirement` items are materialized. `inspect` and
628
+ `asset-sensitive` intent stay informational.
629
+ - The result is a new imported `ExternalReferenceArtifact`, created through the
630
+ existing canonical import service. It supersedes the selected source
631
+ reference (the approved reference id when the source is approved) and has
632
+ lifecycle `imported`. It is never approved automatically.
633
+ - Source regions keep their order. A refine replaces the rectangle of an
634
+ existing source region and keeps its id. Creates are appended in selection
635
+ order. Duplicate creates, duplicate refines, and create-then-refine in one
636
+ request are rejected.
637
+ - Source requirements stay first with identical recomputed ids. Selected
638
+ requirements are appended in selection order and validated against the final
639
+ regions. A selected relationship requirement must still hold for the final
640
+ geometry. Measurement requirements store only the subject and tolerance.
641
+ - Applicability, label, and the exact source image bytes are preserved. The
642
+ source reference is never modified, and project reference acceptance is not
643
+ changed.
644
+
645
+ Existing contract, reference relationship, adequacy, and fidelity evaluators
646
+ remain the only source of verdicts. v0.9 adds no annotation evaluator.
577
647
 
578
648
  ## Approved v0.1 design inputs
579
649