@mengine/medeo-client 1.3.0 → 1.3.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,4 +2,98 @@
2
2
 
3
3
  Medeo domain client for the `mengine` document path.
4
4
 
5
- This package owns the shared `VideoDocument` contract, semantic editing layer, and runtime-neutral HTTP/SSE client used by medeo-web, agent-harness, and server-side validation code. UI adapters such as `DraftMutationDriver` stay in product repositories.
5
+ This package owns graph-native Medeo editing, its one-way `VideoDocument`
6
+ compatibility projection, and the runtime-neutral HTTP/SSE clients. UI intent
7
+ adapters stay in product repositories; Harness only supplies environment and
8
+ asset facts, not an entity store implementation.
9
+
10
+ For entity-authoritative documents:
11
+
12
+ 1. `EntityGraphHttpClient.fetchState()` obtains the complete graph and revision.
13
+ 2. `ensureEditorFoundation` gets or creates one Timeline and four role Tracks,
14
+ retaining all existing identities and settings. `importMediaAsset` groups and
15
+ deduplicates only by direct media variants carrying the same external asset
16
+ id `(system, key)`. Imports mint exactly one media variant Entity
17
+ (Video/Image/Audio/Voice) that carries the Asset locator itself; no separate
18
+ `asset` Entity and no `physical-asset` Relation are created, and the returned
19
+ identity is that single Entity. Video duration must come from asset
20
+ metadata, never a clip trim window. Dual-entity media graphs (`asset` row
21
+ plus a `physical-asset` binding) are not reused and fail explicitly instead
22
+ of minting a second identity. This policy is local to the MEngine editor, not
23
+ the general-purpose DSL.
24
+ 3. `EntityTimelineEditor` edits Clip/Marker/Track relations and payloads.
25
+ 4. `EntityGraphHttpClient.commit(baseState, nextRows)` performs revision CAS,
26
+ including explicit net deletions. The server writes entities and the derived
27
+ Loro read view in the same transaction.
28
+
29
+ Repeated placement reuses the same single media identity but creates independent
30
+ Clips and SequenceMarkers. Asset generation alone still does not create editor
31
+ Entities. Two commit-level guards protect the single-identity policy:
32
+ `assertCanonicalEditorResources(rows)` checks one complete state — every media
33
+ variant carries its own external locator, one external asset id has exactly one
34
+ claimant, and no media variant is bound through a `physical-asset` Relation.
35
+ The exported `assertMediaAssetWritePolicy(before, after)` checks one CAS
36
+ transition and is reusable by the host tool and the entity stores: it applies
37
+ the same rules to the complete after state, and a self-carried identity cannot
38
+ be rewritten to another asset id. The editor applies it to every transaction
39
+ and `EntityGraphHttpClient.commit` applies it to `(baseState.rows, nextRows)`
40
+ before any request. There is no historical exemption: dual-entity media graphs
41
+ are rejected rather than kept editable — the shared `decodeEntityRelationRows`
42
+ boundary already fails rows whose media variants lack `external` or carry a
43
+ `physical-asset` binding, so editors and commits never observe them — deleting
44
+ media is an explicit caller decision, and no implicit historical merge or
45
+ identity rewriting occurs. The
46
+ compatibility reader reads physical facts directly from the media variant;
47
+ Caption inline text still resolves its inline Asset through
48
+ `physical-asset`.
49
+
50
+ `SequenceMarker` owns source/target ranges, duration, and time remapping. `Clip`
51
+ owns clip properties such as volume; `Track` owns track properties. References
52
+ between entities belong in Relations, not in payload IDs. There is no separate
53
+ timing profile. The compatibility reader supports the existing four lanes:
54
+ one image/video main track, Voice, Caption, and background Audio. It accepts
55
+ explicit millisecond media coordinates and linear visual remapping
56
+ `{ kind: 'linear', rate: 2 }` (including still-image display speed). Nonlinear
57
+ speed and multiple visual overlay tracks are not existing editor capabilities
58
+ and remain outside this adapter; unsupported layouts fail before persistence.
59
+ Effective duration and absolute target coordinates must be whole milliseconds
60
+ for this reader; generic DSL coordinates are not globally restricted to that
61
+ unit or precision. Sequential placement stays `Clip.order` plus no targetRange,
62
+ so later duration edits continue to move following Clips.
63
+
64
+ Entity-authoritative editor consumers use the Loro session only to receive the
65
+ server-authored compatibility view. Configure that session as read-only: even
66
+ cold-start reconciliation must not POST legacy `/updates`. Entity writes use
67
+ the independent graph CAS endpoint.
68
+
69
+ Anchored placement is a `clip-anchor` Relation from child Clip to host Clip
70
+ plus `SequenceMarker.anchorOffset`. Voice and Caption can be independently
71
+ placed or explicitly anchored; generation relations do not choose a host. `resolveEntityTimelineLayout` resolves this graph
72
+ without reparenting or synthesizing content. Move/delete operations must write
73
+ their follow, keep-absolute, cascade, or detach decisions into the same entity
74
+ plan. A speech-overlap shift is explicit placement on the real visual Clips;
75
+ an uncovered time interval does not require an invented empty-media entity.
76
+
77
+ Voice links to its AudioScript through `audio-script-render`; Caption links to
78
+ its source script and optional alignment Voice through separate provenance/alignment relations. External
79
+ speech identity and physical storage key belong to the Voice Entity itself.
80
+ `insertCaptionClip` creates a complete independent Caption placement;
81
+ `upsertVoiceoverTake` accepts explicit `placement` for independent voice.
82
+ AudioScript carries only text. `audio-script-marker` attaches directly assigned
83
+ `segmentRanges` timing; those annotation Markers cannot be Clip display Markers.
84
+ Caption styles belong to Caption; text can have a real inline text Asset rather
85
+ than a fabricated Memota ID. Background Audio's Marker declares
86
+ `durationPolicy: 'timeline'`: its source duration stays factual,
87
+ while the view fills the non-BGM timeline duration.
88
+
89
+ `migrateLegacyTimelineToEntities` is a one-time migration utility, **not** an
90
+ ordinary editing diff adapter. A configured legacy document requires a separate
91
+ CAS commit with `migrationBaseVv` equal to its current canonical base64 Loro
92
+ oplog version. The server calls `assertEntityProjectionPreservesLegacy` to reject
93
+ stale or lossy migrations. Only then can a new edit be committed.
94
+
95
+ The legacy `SemanticEditor` remains available for pre-cutover library consumers.
96
+ It rejects `video-document/entity-projection-v1` documents. Production entity
97
+ tools and editor adapters must not fall back to it or raw `/updates` on failure.
98
+ For an entity projection, `meta.version` is the committed entity revision; the
99
+ Loro version vector remains the transport-sync cursor.