@mengine/medeo-client 2.1.1-dsl.19 → 2.1.1-dsl.20

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
@@ -44,10 +44,10 @@ Reopening uses the stored Loro history and the server's version vector to derive
44
44
  - Placement: sequential, absolute or anchored. Reordering and replacement require an explicit associated-content policy.
45
45
  - Voiceover: `applyVoiceover` consumes materialized recording/script/caption results in one commit. Upload, ASR and TTS belong to the host.
46
46
  - BGM: `setBgm` requires full resource facts and explicitly fills the Timeline; trim/speed are not enabled.
47
- - AudioScript: segmented text; segments are inserted, moved and deleted by id, each with its own native Text.
47
+ - AudioScript: segmented text; segments are inserted, moved and deleted by id, each with its own native Text. A transcript names the transcription file it was read from, and its segments keep the `startMs`/`endMs` that file gave them (`tx.insertSegment(..., time)`); a segment's time is written when it is added and never edited.
48
48
  - Caption: independent native Text or a selection of one script segment (whole, or a Cursor run inside it); style and source switching.
49
49
 
50
- `resolveDslLayout`, `toVideoDraft`, `fromVideoDraft`, `MedeoDsl` and the model types are exported from the root and `/dsl`. Projection returns diagnostics; unrepresentable legacy output throws `DslProjectionError`. `MengineHttpClient.fetchDraft()` / `fetchDraftAt(seq)` read the server's content, diagnostics and matching version.
50
+ `resolveDslLayout`, `toVideoDraft`, `fromVideoDraft`, `toAudioScriptViews`, `MedeoDsl` and the model types are exported from the root and `/dsl`. `toAudioScriptViews` (on a session, `projectAudioScripts()`) reads the same snapshot as the VideoDraft and lists every AudioScript with its segments — a transcript's with their `startMs`/`endMs` and a `timelineMs`, the position on the earliest Clip playing the transcribed medium whose window holds that moment — its PhoneticScripts with their digests, the speech Clips saying it (with `applied`) and the Caption Clips showing one of its segments. Projection returns diagnostics; unrepresentable legacy output throws `DslProjectionError`. `MengineHttpClient.fetchDraft()` / `fetchDraftAt(seq)` read the server's content, diagnostics and matching version.
51
51
 
52
52
  ## The DSL document
53
53
 
@@ -87,7 +87,7 @@ dsl.dispose();
87
87
  - `getSnapshot()` returns a frozen, read-only `MedeoDslSnapshot`: entity tables, the voice-timbre and derived-from relation tables, effective containment, rich-text runs, resolved Caption text and diagnostics. A relation an entity holds at most one of is a field of its row: a Clip's `source` and `anchor`, a Caption's `selection`, a PhoneticScript's `phoneme`. An unreadable optional field is dropped from the row with a diagnostic; the row stays. A Caption's own text wins over its selection when a merge leaves both. It does not compute layout or VideoDraft. Reads reuse the same snapshot until a DSL content event invalidates it; no-op Actions and repeated imports retain it. Reading never commits changes.
88
88
  - `subscribe(listener)` includes text-only and marks-only changes. The returned function unsubscribes; dispose is idempotent. As with other synchronous document observers, listeners should not throw or initiate nested writes.
89
89
  - `applyMutations(mutations, audit)` is the preferred interface for typed entity, relation, Tree, Text and Caption-selection commands. It opens one `transact`; `tx.applyMutations` inside an existing callback uses the same draft and commit.
90
- - `transact(edit, audit)` exposes a guarded `tx.draft` for ordinary fields and Tree, `tx.editText(scriptId, segmentId, edits, expectedBodyId?)`, `tx.editCaptionText(captionId, edits, expectedBodyId?)`, `tx.insertSegment` / `tx.moveSegment` / `tx.deleteSegment`, `tx.setCaptionContent({captionId, audioScriptId, segmentId, start?, end?})` and `tx.setPhoneme({phoneticScriptId, audioScriptId, segmentId, start?, end?, phonemeScript?})`. The synchronous callback and every draft reference expire on return. Async callbacks, nested writes, identity changes, direct overwrites of existing bodies, and same-transaction entity deletion/recreation are rejected. Catching a guard/command error inside the callback does not allow a partial commit.
90
+ - `transact(edit, audit)` exposes a guarded `tx.draft` for ordinary fields and Tree, `tx.editText(scriptId, segmentId, edits, expectedBodyId?)`, `tx.editCaptionText(captionId, edits, expectedBodyId?)`, `tx.insertSegment(scriptId, segmentId, text, index?, time?)` / `tx.moveSegment` / `tx.deleteSegment`, `tx.setCaptionContent({captionId, audioScriptId, segmentId, start?, end?})` and `tx.setPhoneme({phoneticScriptId, audioScriptId, segmentId, start?, end?, phonemeScript?})`. The synchronous callback and every draft reference expire on return. Async callbacks, nested writes, identity changes, direct overwrites of existing bodies, and same-transaction entity deletion/recreation are rejected. Catching a guard/command error inside the callback does not allow a partial commit.
91
91
  - `editText(scriptId, segmentId, expectedBodyId, edits, audit)` delegates to the same transaction. Text supports insert/delete/mark/unmark/editing Delta; offsets are UTF-16 and cannot split surrogate pairs. `tx.draft` exposes the text preview after preceding edits, while existing body strings are never sent through Mirror's full-text diff. A supplied body identity must match the current Text; Actions editing an existing body retain that stale-view check.
92
92
  - Caption selections are interpreted at their position in the command sequence. Their Cursors are created after earlier native edits, and follow later edits. New selections are deferred commands, not synthetic Cursor values in `tx.draft`; do not read a Caption's `selection` from the draft to retrieve a pending one. Explicit Cursor values written to `selection`, and its removal, also replay in sequence with Text edits.
93
93
  - `textRange(scriptId, segmentId, start, end)` returns native Cursors for a nonempty run inside one segment. A Caption's `selection` stores their native bytes through the central codec. The permanent first-boundary limitation remains deferred.
@@ -5193,8 +5193,9 @@ function placeTranscript(snapshot, layout, view) {
5193
5193
  }
5194
5194
  /**
5195
5195
  * Whether a recording still matches what it was synthesized from: the digest its derived-from
5196
- * records against the source's file digest now. An AudioScript has no file, so a recording
5197
- * derived from a script directly is not judged.
5196
+ * records against the source's file digest now. A recording derived from a script directly is
5197
+ * not judged: a written script has no file, and a transcript's file is what it was read from,
5198
+ * not what a take was synthesized from (D190).
5198
5199
  */
5199
5200
  function appliedSpeech(snapshot, recordingId, spoken) {
5200
5201
  const sourceId = spoken.phoneticScriptId ?? spoken.audioScriptId;
package/dist/dsl.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { _t as resourceId, a as documentFormat, c as isInvalidAtomic, gt as relationId, ht as defaultIdFactory, i as assertDslDocument, o as medeoDslLoroShape, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS, u as timeAnchorCodec, vt as tupleHash } from "./video-draft-types-DKo53mZ8.js";
2
- import { a as toAudioScriptViews, c as DslProjectionError, i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-Dw59o1t0.js";
2
+ import { a as toAudioScriptViews, c as DslProjectionError, i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-wdel0lX7.js";
3
3
  export { DEFAULT_UNIT_TIME_MS, DslEditor, DslProjectionError, MedeoDsl, UnsupportedDocumentFormatError, assertDslDocument, captionContentCodec, createInitialMedeoDsl, defaultIdFactory, documentFormat, fromVideoDraft, isInvalidAtomic, medeoDslLoroShape, relationId, resolveDslLayout, resourceId, timeAnchorCodec, toAudioScriptViews, toVideoDraft, tupleHash };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
2
2
  import { a as covers, c as readMengineEventStream, d as MenginePushRejectedError, i as openManualDocument, l as MengineHttpClient, n as MedeoHttpDocStorage, o as decodeDocVersionMark, r as ManualSyncTransport, s as encodeDocVersionMark, t as MemoryDocStorage, u as MengineHttpRequestError } from "./storage-BW3tI_ER.js";
3
3
  import { _t as resourceId, a as documentFormat, c as isInvalidAtomic, gt as relationId, ht as defaultIdFactory, i as assertDslDocument, o as medeoDslLoroShape, r as UnsupportedDocumentFormatError, s as captionContentCodec, t as DEFAULT_UNIT_TIME_MS, u as timeAnchorCodec, vt as tupleHash } from "./video-draft-types-DKo53mZ8.js";
4
- import { a as toAudioScriptViews, c as DslProjectionError, i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-Dw59o1t0.js";
4
+ import { a as toAudioScriptViews, c as DslProjectionError, i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl, s as resolveDslLayout, t as fromVideoDraft } from "./dsl-wdel0lX7.js";
5
5
  import { UndoManager, VersionVector, decodeImportBlobMeta } from "loro-crdt";
6
6
  import { ClientServerSynchronizer, DocManager } from "@mengine/sync";
7
7
  import { DisposableSet, EventBus } from "@mengine/utils";
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as bytesToBase64, t as base64ToBytes } from "./base64-D-jd-dr5.js";
2
2
  import { a as documentFormat, i as assertDslDocument } from "./video-draft-types-DKo53mZ8.js";
3
- import { i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl } from "./dsl-Dw59o1t0.js";
3
+ import { i as DslEditor, n as toVideoDraft, o as MedeoDsl, r as createInitialMedeoDsl } from "./dsl-wdel0lX7.js";
4
4
  import { t as classifyUpdate } from "./loro-relay-doc-Bi6JKqtQ.js";
5
5
  import { LoroDoc, VersionVector, encodeFrontiers } from "loro-crdt";
6
6
  //#region src/testing/in-memory-mengine-server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mengine/medeo-client",
3
- "version": "2.1.1-dsl.19",
3
+ "version": "2.1.1-dsl.20",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "@noble/hashes": "^2.4.0",
30
30
  "immer": "^10.2.0",
31
31
  "zod": "^4.4.3",
32
- "@mengine/storage": "2.1.1-dsl.19",
33
- "@mengine/sync": "2.1.1-dsl.19",
34
- "@mengine/utils": "2.1.1-dsl.19"
32
+ "@mengine/storage": "2.1.1-dsl.20",
33
+ "@mengine/sync": "2.1.1-dsl.20",
34
+ "@mengine/utils": "2.1.1-dsl.20"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^25.9.1",