@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
package/docs/ROADMAP.md CHANGED
@@ -1,12 +1,17 @@
1
1
  # Roadmap
2
2
 
3
- v0.8.1 status: released as v0.8.1 and published to npm as
4
- `@dailephd/my-frontend-observer@0.8.1`. v0.9 and v0.10 remain future work.
3
+ v0.9 status: released as v0.9.0 and published to npm as
4
+ `@dailephd/my-frontend-observer@0.9.0`. v0.10 remains future work.
5
5
 
6
6
  This is a version-level specification, not an implementation checklist.
7
7
  Concrete steps and sequencing are designed only when a version begins, after
8
8
  the planner reads that version, inspects current repository state, and performs
9
- needed my-dev-kit retrieval and architecture work.
9
+ needed my-dev-kit retrieval and architecture work. Once those version-start
10
+ decisions are frozen, this roadmap records the durable version-level design so
11
+ a later planner can reconstruct the intended implementation without stitching
12
+ critical architecture decisions across reports, chats, or batch prompts. Exact
13
+ files, interfaces, tests, batch gates, and prompt sequencing belong in the
14
+ version implementation plan.
10
15
 
11
16
  ## v0.1 — Runtime Observation Foundation
12
17
 
@@ -478,77 +483,412 @@ existing low-level commands must remain backward compatible.
478
483
 
479
484
  ## v0.9 — Human Visual Annotation and Design-Intent Capture
480
485
 
486
+ Current status: released as `v0.9.0` and published to npm as
487
+ `@dailephd/my-frontend-observer@0.9.0`, after final exact-candidate
488
+ cross-platform readiness on Windows, Linux and macOS. The release includes
489
+ repository-owned deterministic demo and tutorial acceptance infrastructure
490
+ under `examples/v09-demo/`. That infrastructure is release support and
491
+ documentation. It is not a new annotation evidence family or v0.10 behavior,
492
+ and it is not shipped in the npm package. The per-prompt implementation reports and the integrated acceptance
493
+ report live under `docs/reports/v0.9-*.md`. The source-grounding report is
494
+ `docs/reports/v0.9-architecture-retrieval.md`, and the concrete file-level,
495
+ test-level, and seven-prompt implementation plan is
496
+ `docs/plans/v0.9-implementation-plan.md`. The version-level decisions below are
497
+ the durable design authority. A future planner should be able to derive an
498
+ implementation plan from this section plus current repository state without
499
+ recovering critical choices from old chats or implementation reports.
500
+
481
501
  Objective/problem: add structured visual human intent to the already working
482
- v0.7 coding-agent workflow through the v0.8 viewer without inventing a separate
483
- change-semantics system, and allow that intent to be authored against either a
484
- runtime observation or an external visual reference. The v0.8.1 project
485
- workflow/alias layer should be reused for ordinary project discovery and
486
- human-readable selection rather than replaced by annotation-specific command
487
- plumbing.
502
+ v0.7 coding-agent/reference workflow through the v0.8 viewer without inventing
503
+ a separate change-semantics system. Intent may be authored against either an
504
+ existing runtime observation screenshot or an existing external visual
505
+ reference. The v0.8.1 project workflow and alias layer remain the normal project
506
+ discovery and human-selection surface. v0.9 extends `view`; it does not create a
507
+ new top-level annotation workflow architecture.
508
+
509
+ ### Frozen annotation evidence model
510
+
511
+ v0.9 introduces one distinct persisted observer-owned annotation evidence
512
+ family, `VisualAnnotationArtifact`, with initial schema version `1.0.0`.
513
+ Annotations are not mutable fields added to observations, external references,
514
+ comparisons, contracts, or evaluation artifacts. Original runtime observations,
515
+ screenshots, imported/approved external references, and reference images remain
516
+ immutable source evidence.
517
+
518
+ Every explicit annotation save creates a new immutable annotation artifact
519
+ instance. A later edit creates another artifact and may explicitly point
520
+ forward to the previous instance through `supersedesAnnotationId`; the old
521
+ artifact is never rewritten or deleted. Annotation logical/request identity is
522
+ deterministic from canonical semantic content, while annotation instance
523
+ identity is fresh for each persisted instance, following the repository's
524
+ existing request-identity versus instance-identity pattern.
525
+
526
+ Persisted annotation provenance must use canonical source identity. Human aliases
527
+ such as `baseline` and `current`, viewer handles, viewer URLs, ports, absolute
528
+ paths, and other session-local selectors must never become annotation identity.
529
+ Aliases remain conveniences for selecting canonical artifacts before authoring.
530
+
531
+ ### Frozen source contexts and coordinate domains
532
+
533
+ Each annotation has exactly one source context:
534
+
535
+ ```text
536
+ runtime-observation
537
+ external-reference
538
+ ```
539
+
540
+ Runtime annotations are tied to one canonical observation/screenshot identity
541
+ and use the existing runtime screenshot coordinate domain: viewport CSS pixels.
542
+ They do not multiply geometry by device pixel ratio, round to screenshot-device
543
+ pixels, or invent a second transform.
544
+
545
+ External-reference annotations are tied to one canonical reference/image
546
+ identity and use reference-image pixels. Reference-image pixels are never
547
+ silently treated as runtime CSS pixels.
548
+
549
+ The existing runtime and reference SVG workspaces remain separate coordinate
550
+ and identity domains. The same zoom/pan interaction machinery may be reused,
551
+ but each workspace supplies its own frame. Annotation rendering should be a
552
+ layer inside the existing source SVG coordinate frame rather than an
553
+ independently transformed canvas.
554
+
555
+ A reference-region ID is not a runtime-target identity. Runtime-target,
556
+ reference-region, annotation-item, artifact, filesystem, source-symbol, and
557
+ project-alias identities remain distinct even when explicit relationships link
558
+ them.
559
+
560
+ ### Frozen first annotation set
561
+
562
+ The first persisted visual mark vocabulary is deliberately bounded to:
563
+
564
+ ```text
565
+ point
566
+ rectangle
567
+ line
568
+ arrow
569
+ note
570
+ ```
571
+
572
+ `select` and `pan` are viewer interaction modes, not persisted annotation
573
+ marks. v0.9 does not add freehand drawing, polygons, Bezier paths, paint
574
+ strokes, masks, arbitrary SVG input, OCR-driven regions, or computer-vision
575
+ segmentation.
576
+
577
+ The first human-facing intent operations are:
578
+
579
+ ```text
580
+ inspect
581
+ move
582
+ resize
583
+ remove
584
+ preserve
585
+ ```
586
+
587
+ External-reference annotation additionally supports candidate intent for:
588
+
589
+ ```text
590
+ reference-region
591
+ reference-requirement
592
+ asset-sensitive
593
+ ```
594
+
595
+ `asset-sensitive` and `inspect` may remain informational. Their existence must
596
+ not silently add an acceptance rule.
597
+
598
+ ### Explicit association, interpretation, and confirmation
599
+
600
+ Drawing geometry alone does not establish semantic ownership or executable
601
+ intent. Runtime annotation may associate with an existing runtime target or
602
+ existing runtime relationship only through explicit structured selection.
603
+ Reference annotation may associate with an existing reference region or
604
+ existing reference relationship only through explicit structured selection.
605
+
606
+ The following must never silently create association or binding:
607
+
608
+ ```text
609
+ name similarity
610
+ rectangle overlap
611
+ nearest element
612
+ visual proximity
613
+ drawing containment
614
+ same textual identifier across runtime/reference domains
615
+ ```
616
+
617
+ An unbound drawing remains valid visual/narrative evidence but cannot be
618
+ promoted into a canonical requirement that needs a structured target or region.
619
+
620
+ Each annotation interpretation has an explicit state:
621
+
622
+ ```text
623
+ uninterpreted
624
+ candidate
625
+ confirmed
626
+ ```
627
+
628
+ The viewer may suggest a bounded candidate interpretation from explicit user
629
+ choices and known canonical evidence, but ambiguous geometry never silently
630
+ becomes a strong requirement. Only a `confirmed` interpretation may be selected
631
+ for canonical promotion. Before confirmation, the viewer must show the exact
632
+ candidate structured meaning that would be persisted/promoted.
633
+
634
+ ### Canonical change-scope and contract reuse
635
+
636
+ v0.9 reuses exactly the existing authored change-scope categories:
637
+
638
+ ```text
639
+ requested
640
+ expected-dependent
641
+ protected
642
+ preserved
643
+ ```
644
+
645
+ For `expected-dependent`, the existing `required`/`permitted` mode remains
646
+ mandatory. `unexpected` remains evaluator output and is never authorable through
647
+ annotation.
648
+
649
+ Runtime annotation does not introduce a second contract language. Confirmed
650
+ runtime visual intent may promote only into the existing bounded
651
+ `ContractPrimitive` vocabulary. High-value mappings include move/resize intent
652
+ through existing `x`, `y`, `width`, and `height` property increase/decrease
653
+ primitives and preserve intent through existing property-with-tolerance or
654
+ relationship-unchanged primitives. Existing visibility, clipping, width-bound,
655
+ overlap, relative-width, vertical-sequence, containment, page-width, and
656
+ scroll-owner primitives remain available when they accurately represent the
657
+ confirmed intent.
658
+
659
+ The drawing is not itself the contract. Promotion produces an ordinary
660
+ canonical `PerChangeContract`, using the existing contract identity,
661
+ persistence, validation, conflict, evaluation, and PASS/FAIL semantics.
662
+ Annotation does not evaluate contracts.
663
+
664
+ The first version must preserve unsupported human intent honestly. In
665
+ particular, `remove` can be represented and explicitly confirmed as annotation
666
+ intent, but the current canonical contract vocabulary has no target-absent
667
+ primitive. v0.9 therefore must not fabricate an approximate clause or expand the
668
+ contract language merely to make `remove` executable. It remains confirmed but
669
+ not canonically promotable until a future version deliberately extends the
670
+ contract model.
671
+
672
+ ### External-reference region and requirement authoring
673
+
674
+ External-reference annotation may explicitly create or refine meaningful
675
+ reference regions and may promote selected design requirements, but a drawn
676
+ rectangle never turns every enclosed pixel into a requirement.
677
+
678
+ A confirmed new region uses its annotation rectangle directly in the existing
679
+ reference-image pixel domain. A confirmed refinement explicitly selects an
680
+ existing region ID; the resulting new reference revision may retain that region
681
+ identity while changing its rectangle. Relationship choices must come from the
682
+ existing canonical reference-region relationship derivation rather than a
683
+ viewer-only relationship engine.
684
+
685
+ Confirmed reference requirements reuse the existing
686
+ `RawReferenceRequirement` / `ReferenceRequirementSubject` model and the same
687
+ authored change-scope categories. Supported subjects remain the existing
688
+ bounded region-property, region-relationship, and region-measurement forms with
689
+ existing reference tolerance semantics (`exact`, `absolute-reference-px`, or
690
+ `percent` where applicable). Visible geometry that the user did not explicitly
691
+ promote remains informational reference evidence.
692
+
693
+ Materializing confirmed reference annotation creates a new immutable imported
694
+ `ExternalReferenceArtifact` revision through the existing canonical reference
695
+ persistence model. The new artifact carries forward unchanged image content,
696
+ applicability, regions, and requirements except where selected confirmed intent
697
+ explicitly adds or refines them; it explicitly supersedes the selected source
698
+ reference. The prior reference remains unchanged. The new revision is not
699
+ automatically approved and does not automatically replace the project's active
700
+ approved reference. Approval and project reference selection remain separate,
701
+ explicit governance actions.
702
+
703
+ ### Annotation persistence and annotated rendering
704
+
705
+ The structured annotation manifest is authoritative. v0.9 also derives one
706
+ bounded system-generated annotation overlay, `annotation-overlay.svg`, for each
707
+ saved annotation artifact. The overlay uses the same source-native coordinate
708
+ frame recorded by the artifact, contains only validated system-generated SVG,
709
+ and has an integrity digest. It does not embed arbitrary user SVG/HTML and does
710
+ not copy the underlying screenshot or external-reference image.
711
+
712
+ The annotated visual is reconstructed as:
713
+
714
+ ```text
715
+ canonical source image
716
+ +
717
+ structured annotation overlay
718
+ ```
719
+
720
+ The derived overlay is not a second evidence or interpretation model. If any
721
+ presentation bug causes disagreement, structured annotation data remains the
722
+ authority.
723
+
724
+ ### Viewer authoring and security boundary
725
+
726
+ Normal annotation authoring is available through project-aware:
727
+
728
+ ```text
729
+ my-frontend-observer view
730
+ ```
731
+
732
+ inside a valid initialized project. Existing advanced
733
+ `my-frontend-observer view --root <evidence-root>` remains a supported
734
+ inspection surface and stays read-only when it is not operating with the normal
735
+ initialized-project authoring context.
736
+
737
+ Because v0.8 intentionally exposed only GET/HEAD inspection routes, v0.9 may add
738
+ POST only for the narrow annotation-authoring and confirmed-promotion operations
739
+ required by this version. It must not add arbitrary filesystem writes, target
740
+ source writes, PUT/PATCH/DELETE mutation APIs, permissive CORS, or a generic
741
+ local RPC endpoint.
742
+
743
+ The project-aware viewer authoring session must use a short-lived in-memory
744
+ capability token plus strict loopback same-origin/Host enforcement, bounded JSON
745
+ bodies, and canonical server-side resolution of evidence handles to source
746
+ artifacts. The browser must never supply arbitrary output paths. The token is
747
+ session-only, is not persisted as project/evidence identity, and must not become
748
+ service-worker cached authority.
749
+
750
+ Annotation persistence follows the repository's established immutable artifact
751
+ pattern: structural validation before write, fresh final instance directory,
752
+ sibling temporary directory, deterministic owned-media generation, manifest
753
+ write, atomic rename, no overwrite, and cleanup on failure.
754
+
755
+ Project-managed annotation evidence belongs under the managed Observer evidence
756
+ root using canonical IDs. v0.9 does not introduce an annotation alias catalog.
757
+
758
+ ### Conflict and revision rules
759
+
760
+ Annotation revision conflict is handled by explicit lineage, not last-write-wins.
761
+ A revision save identifies the canonical parent annotation. A stale edit must be
762
+ rejected rather than silently overwrite newer evidence. If malformed/historical
763
+ evidence presents multiple lineage heads, the viewer must expose that ambiguity
764
+ and require an explicit choice rather than select a winner by timestamp.
765
+
766
+ Semantic contract conflicts remain owned by the existing contract validators and
767
+ evaluator. Reference requirement validity/adequacy remains owned by the existing
768
+ reference model. Annotation must not add a second conflict-resolution engine.
769
+ Unsupported confirmed intent is reported as unsupported for canonical promotion,
770
+ not silently converted to PASS, FAIL, or another requirement.
771
+
772
+ ### Canonical intent flow
773
+
774
+ The version-level flow is:
775
+
776
+ ```text
777
+ runtime screenshot annotation OR external-reference annotation
778
+ → explicit source-domain association where reliable
779
+ → candidate requested/dependent/protected/preserved or informational intent
780
+ → explicit interpretation/confirmation
781
+ → save immutable structured annotation evidence
782
+ → selected confirmed runtime intent may become a canonical per-change contract
783
+ OR
784
+ selected confirmed reference intent may become a new imported reference revision
785
+ → existing contract/reference approval and evaluation workflows remain authoritative
786
+ ```
787
+
788
+ This version stops before the full post-edit human/LLM correction loop. v0.10
789
+ owns automatic workflow coordination around external coding-agent source edits,
790
+ rerendering, repeated `check <baseline> --json`, final human approval, and
791
+ baseline/reference governance across correction iterations.
792
+
793
+ ### Dependencies/ecosystem/compatibility
794
+
795
+ v0.9 depends on:
796
+
797
+ - stable runtime observation and target identity;
798
+ - existing relationship and comparison evidence;
799
+ - existing baseline/per-change contract vocabulary and evaluator;
800
+ - v0.7 external-reference identity, region, requirement, applicability,
801
+ binding, compatibility, fidelity, and bounded-context integration;
802
+ - v0.8 viewer server, runtime/reference SVG workspaces, source-domain coordinate
803
+ rendering, zoom/pan, metadata-first discovery, safe media resolution, and
804
+ explicit binding cross-selection;
805
+ - v0.8.1 project discovery, managed evidence root, human-readable aliases,
806
+ project-aware viewer startup, and canonical identity resolution beneath
807
+ aliases.
808
+
809
+ Existing observation, comparison, frontend-contract, evaluation,
810
+ bounded-agent-context, and external-reference schema semantics remain
811
+ independently authoritative. Annotation may reference and promote into them but
812
+ must not redefine them.
488
813
 
489
- Required capabilities: a bounded annotation set chosen during planning, such as
490
- point/select, rectangle/area, arrow, line/boundary, textual note, preserve,
491
- resize, move, remove, and inspect; structured annotation artifacts preserving
492
- their annotation context (runtime observation or external reference), source
493
- observation/screenshot or reference identity, geometry, type, text, provenance,
494
- and reliable target/relationship/reference-region association; save/reload;
495
- annotated image references; and explicit interpretation/confirmation state.
814
+ The existing bounded agent-context system may later include relevant annotation
815
+ references/structured annotation evidence as part of the proven coding-agent
816
+ workflow, but heavy source images or unrelated annotation history should not be
817
+ embedded by default. v0.9 does not require changes to my-dev-kit,
818
+ orchestrator, or lab unless an actual compatibility need is demonstrated during
819
+ implementation.
496
820
 
497
- Runtime-screenshot annotations and external-reference annotations are separate
498
- coordinate/identity domains. The annotation model must never assume that a
499
- reference-region identity is a runtime-target identity. Coordinate transforms,
500
- selection, overlays, persistence, and provenance must preserve which source
501
- image the annotation belongs to.
821
+ ### Exclusions
502
822
 
503
- Canonical intent flow:
823
+ v0.9 explicitly excludes:
504
824
 
505
825
  ```text
506
- runtime screenshot annotation OR external reference annotation
507
- → target/relationship/reference-region binding
508
- → candidate requested/dependent/protected/preserved intent
509
- → explicit confirmation/interpretation where necessary
510
- → canonical change contract
826
+ application source editing
827
+ automatic coding-agent execution
828
+ full correction-loop orchestration
829
+ image-to-code or raster-to-HTML/CSS/SVG generation
830
+ automatic target discovery
831
+ automatic reference/runtime binding
832
+ automatic reference-region detection
833
+ OCR-driven requirements
834
+ computer-vision segmentation
835
+ freehand drawing or arbitrary SVG authoring
836
+ a second contract/change-scope taxonomy
837
+ a second reference-requirement taxonomy
838
+ a second PASS/FAIL evaluator
839
+ automatic reference approval
840
+ automatic baseline approval or replacement
841
+ automatic approved-reference replacement
842
+ cloud synchronization
843
+ accounts/authentication/collaboration/comment threads
844
+ database storage
845
+ making annotation mandatory for ordinary capture/check/coding-agent workflows
511
846
  ```
512
847
 
513
- For external references, annotation may also define or refine meaningful
514
- reference regions and relationships, mark an asset-sensitive region, identify
515
- which visual details are informational, and promote selected geometry/style/
516
- relationship requirements into the canonical contract. A visible pixel never
517
- becomes a hard requirement merely because it exists in the image.
518
-
519
- Architectural/evidence constraints: annotation feeds the existing canonical
520
- reference, change-scope, contract, bounded-context, and coding-agent workflow. It
521
- must not create annotation-only or reference-only requested/protected semantics
522
- or different PASS/FAIL rules. Ambiguous drawings never silently become strong
523
- requirements. Original raw observations and imported reference images remain
524
- immutable evidence; annotation and approval/supersession state are separate.
525
-
526
- Dependencies/ecosystem/compatibility: depends on stable runtime identity,
527
- reference identity, contracts, v0.7 coding-agent review/reference evaluation,
528
- v0.8 viewer/coordinate mapping, and v0.8.1 project discovery, human-readable
529
- aliases, project-aware viewer behavior, and canonical identity resolution
530
- beneath aliases. Aliases are selection conveniences only. Persisted annotation
531
- identity must reference the exact canonical observation/reference identity,
532
- never mutable aliases such as `baseline` or `current`. Structured annotation/context/reference
533
- versions must be explicit and remain traceable to supported observation,
534
- screenshot, and external-reference identities.
535
-
536
- Exclusions: flattening intent into pixels only, bypassing confirmation,
537
- replacing text/config requests, image-to-code generation, source editing, or
538
- making annotation mandatory for ordinary coding-agent changes.
539
-
540
- Acceptance: a user can annotate either an existing observation or an external
541
- reference in the viewer; annotations survive save/reload; their source context
542
- remains explicit; target/relationship/reference-region associations remain
543
- available where reliable; preserve/resize/move/remove/inspect intent can be
544
- represented where supported; reference regions and selected design requirements
545
- can be authored without turning every pixel into a contract; ambiguous intent
546
- requires explicit interpretation or confirmation; and annotations can drive the
547
- existing coding-agent change-review workflow through the canonical contract and
548
- reference models. Version-start planning must select the first annotation set,
549
- coordinate transforms for both source contexts, persistence/versioning,
550
- interpretation/confirmation workflow, conflicts, region-authoring behavior, and
551
- annotated-image derivation.
848
+ ### Acceptance
849
+
850
+ v0.9 is complete only when all of the following are true:
851
+
852
+ - a user can annotate an existing runtime observation in the project-aware
853
+ viewer and save/reload it without coordinate drift;
854
+ - a user can annotate an imported or approved external reference and save/reload
855
+ it in reference-image coordinates;
856
+ - saved annotations remain tied to exact canonical source identities even when a
857
+ human alias later points somewhere else;
858
+ - runtime-target, runtime-relationship, reference-region, and
859
+ reference-relationship associations occur only when explicitly and reliably
860
+ selected;
861
+ - zoomed/panned drawing maps back to the same source-native coordinates used by
862
+ the existing SVG workspace;
863
+ - point/rectangle/line/arrow/note marks persist as structured evidence, not only
864
+ flattened pixels;
865
+ - preserve/resize/move/remove/inspect intent can be represented, with unsupported
866
+ executable mappings reported honestly;
867
+ - ambiguous or unbound drawings cannot silently become strong requirements;
868
+ - a supported confirmed runtime move/resize/preserve intent can produce a normal
869
+ canonical per-change contract without a second contract evaluator;
870
+ - selected confirmed external-reference region/requirement intent can produce a
871
+ new immutable imported reference revision without modifying or approving the
872
+ source reference;
873
+ - informational notes/asset-sensitive regions remain informational unless
874
+ explicitly promoted through a supported canonical model;
875
+ - annotation revision conflicts fail explicitly instead of overwriting history;
876
+ - original observation artifacts, screenshots, external-reference artifacts,
877
+ and reference images remain unchanged;
878
+ - the bounded local write surface rejects unauthorized origins, missing/invalid
879
+ session capability, unsafe paths, unsupported methods, and malformed/oversized
880
+ requests;
881
+ - existing v0.8 viewer inspection and v0.8.1 `init`/`capture`/`check`/`view`
882
+ workflows remain backward compatible;
883
+ - a clean packed npm candidate proves annotation save/reload and canonical
884
+ promotion behavior, with the existing cross-platform/security validation
885
+ expectations preserved.
886
+
887
+ The frozen concrete module contracts, validation rules, test responsibilities,
888
+ seven implementation prompts, and batch gates live in
889
+ `docs/plans/v0.9-implementation-plan.md`. That plan must be derivable from the
890
+ version-level decisions above plus current repository inspection; this roadmap
891
+ intentionally does not duplicate batch-by-batch instructions.
552
892
 
553
893
  ## v0.10 — Full Visual Human–LLM Frontend Change Workflow
554
894
 
package/docs/SECURITY.md CHANGED
@@ -165,14 +165,18 @@ rejects any non-regular-file entry, closing that escape.
165
165
  - **No arbitrary filesystem browsing, no static-candidate path
166
166
  interpretation**: the viewer offers no directory-listing or free-path
167
167
  endpoint; every route addresses one specific, already-discovered handle.
168
- - **Read-only API**: every `/api/*` route rejects non-`GET`/`HEAD` methods
169
- with `405` at a single top-of-handler check
170
- (`src/viewerServer/httpServer.ts`), covering every route uniformly,
171
- including ones added in later batches.
172
- - **No target-source or evidence mutation**: the viewer server has no
173
- filesystem-write call anywhere in its own code path; it never edits
174
- target source and never modifies, supersedes, or persists a new instance
175
- of any existing Observer evidence artifact.
168
+ - **Read-only API (v0.8)**: in v0.8 every `/api/*` route rejected
169
+ non-`GET`/`HEAD` methods with `405` at a single top-of-handler check
170
+ (`src/viewerServer/httpServer.ts`). v0.9 keeps that check for every
171
+ inspection route and adds exactly three project-aware authoring `POST`
172
+ routes, described in "v0.9 local annotation write boundary" below.
173
+ - **No target-source or evidence mutation**: the viewer never edits target
174
+ source and never modifies an existing Observer evidence artifact. In v0.8
175
+ the viewer server had no filesystem-write path at all. In v0.9 a
176
+ project-aware session may create new immutable annotation, change-contract,
177
+ and imported external-reference artifacts through the canonical writers,
178
+ only on an explicit authoring request. A standalone `view --root` session
179
+ still never writes.
176
180
  - **Binding/context files are explicit local session input, not persisted
177
181
  evidence**: `--bindings-file`/`--context-file` are read once at startup,
178
182
  validated through the existing canonical validators, held only in server
@@ -192,12 +196,65 @@ rejects any non-regular-file entry, closing that escape.
192
196
  explicit unavailable state, never previously-fetched evidence presented
193
197
  as current.
194
198
 
199
+ ## v0.9 local annotation write boundary (released in 0.9.0)
200
+
201
+ v0.9 adds a narrow local write surface to the viewer. It is released in
202
+ `0.9.0`. It is a same-machine capability boundary for
203
+ one local viewer session. It is not remote account authentication and does not
204
+ protect against other software already running as the same user.
205
+
206
+ - **Loopback only**: the viewer still binds only to `127.0.0.1`.
207
+ - **Project-aware authoring only**: authoring is enabled only when `view` runs
208
+ without `--root` inside an initialized project. The standalone arbitrary-root
209
+ viewer (`view --root <root>`) stays read-only. Its
210
+ `GET /api/authoring/session` reports `enabled: false`, and every authoring
211
+ `POST` returns `403`.
212
+ - **Session capability**: each project-aware server creates a random 32-byte
213
+ token (64 hex characters) in memory. It is handed out by
214
+ `GET /api/authoring/session` only on the exact expected loopback `Host`, as a
215
+ defense against DNS rebinding. The viewer keeps it only in React memory. It
216
+ is never persisted, never written into evidence, and never cached.
217
+ - **Request checks, in order**: exact `Host`, exact same-origin `Origin`, the
218
+ `x-frontend-observer-authoring-token` header compared in constant time,
219
+ `content-type: application/json`, identity `content-encoding` only, a
220
+ 256 KiB (`262144` byte) body limit, valid JSON, and a closed request shape
221
+ with unknown fields rejected.
222
+ - **Exactly three `POST` routes**: `POST /api/annotations`,
223
+ `POST /api/annotations/:handle/promote-contract`, and
224
+ `POST /api/annotations/:handle/materialize-reference`. `PUT`, `PATCH`, and
225
+ `DELETE` stay unsupported everywhere. Any other `POST` returns `405`.
226
+ - **No permissive CORS**: no `Access-Control-Allow-*` headers are sent, so a
227
+ page from any other origin cannot read the capability or send a JSON
228
+ authoring request. A real-Chromium test proves this for all three routes.
229
+ - **Server-side resolution only**: the browser sends evidence handles and item
230
+ ids, never output paths. The server resolves handles through canonical
231
+ discovery with path containment and writes only under the project's managed
232
+ evidence root (`annotations`, `contracts`, and `references`) through the
233
+ canonical writers.
234
+ - **Serialized writes**: all three routes share one write queue per session.
235
+ Annotation revisions use stale-parent conflict detection instead of
236
+ last-write-wins.
237
+ - **No automatic approval**: promotion never approves a baseline, and
238
+ materialization never approves a reference or changes project reference
239
+ acceptance. Contract activation for `check` happens only on explicit
240
+ request.
241
+ - **No caching of authority**: authoring and evidence API responses use
242
+ `cache-control: no-store`, and the service worker never caches `/api/`
243
+ routes, including the new `POST` routes.
244
+ - **Safe media**: annotation overlay media is served only after the stored
245
+ SVG is re-rendered from the canonical artifact and verified. It uses a
246
+ script-blocking `content-security-policy` with `sandbox` and `nosniff`.
247
+ Existing media containment and symlink checks apply unchanged.
248
+ - **Temporary directories**: evidence discovery skips writer temporary
249
+ `.tmp-*` directories, so a partially written artifact is never presented as
250
+ evidence.
251
+
195
252
  ## Not yet addressed
196
253
 
197
254
  Certificate-failure-specific handling, permission-prompt-specific handling
198
255
  (Chromium's default deny-all applies; no permission is ever explicitly
199
256
  granted), and any non-loopback/remote browsing mode remain unimplemented and
200
- out of scope. `@dailephd/my-frontend-observer@0.8.1` is published to npm, and a
257
+ out of scope. `@dailephd/my-frontend-observer@0.9.0` is published to npm, and a
201
258
  pre-release readiness CI workflow (Windows/Linux/macOS packed-candidate
202
259
  validation, now covering the v0.8 viewer alongside every earlier version's
203
260
  packed behavior) exists (see `docs/CI_CD.md`). The v0.7 external-reference/
@@ -211,8 +268,8 @@ security validation stage (see
211
268
  Symlink/junction filesystem-escape handling for the viewer's raw-evidence
212
269
  routes is now exercised by a dedicated regression test
213
270
  (`tests/unit/viewerEvidenceServer.test.ts`), which caught and led to the fix
214
- described above. Annotation (v0.9) remains a future, unimplemented concern
215
- with its own security review still to come. None of this expands the
216
- security scope above: remote browsing, certificate handling,
217
- permission-prompt handling, and future annotation-specific file handling
218
- remain separate, unimplemented concerns.
271
+ described above. The v0.9 annotation write boundary described above is
272
+ implemented and covered by local security tests, but its formal
273
+ cross-platform pre-release security validation has not run yet. None of this
274
+ expands the security scope above: remote browsing, certificate handling, and
275
+ permission-prompt handling remain separate, unimplemented concerns.