@mengine/medeo-tool 2.0.1-alpha.2 → 2.0.1-alpha.6
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/dist/{entity-sandbox-TaUVT3on.mjs → entity-sandbox-DSFbfybl.mjs} +13 -4
- package/dist/entity-sandbox-DSFbfybl.mjs.map +1 -0
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +9 -5
- package/dist/index.mjs.map +1 -1
- package/dist/worker-entry.mjs +46 -7
- package/dist/worker-entry.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/entity-sandbox-TaUVT3on.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as isMediaAssetVariantKind, i as businessState, o as createEntityId, s as createRelationId, t as EntitySandbox } from "./entity-sandbox-
|
|
1
|
+
import { c as isMediaAssetVariantKind, i as businessState, o as createEntityId, s as createRelationId, t as EntitySandbox } from "./entity-sandbox-DSFbfybl.mjs";
|
|
2
2
|
import { LoroEntityDocument, ManualSyncDoc, MengineHttpClient, MengineHttpRequestError, ValidationError, base64ToBytes, bytesToBase64, compileEntityRows, createMirrorVideoDocument, createPlainMemoryAdapter, decodeDocVersionMark, effectiveVideoClipDurationMs, encodeDocVersionMark, ensureEditorFoundation, replayJournal, solveVideoDocument, speedOf, toVideoDocument } from "@mengine/medeo-client";
|
|
3
3
|
import { Worker } from "node:worker_threads";
|
|
4
4
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -214,11 +214,14 @@ function runEditScript(options) {
|
|
|
214
214
|
armTimeout();
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
|
-
if (message.t === "entity-asset") {
|
|
217
|
+
if (message.t === "entity-asset" || message.t === "write-entity-asset") {
|
|
218
218
|
(async () => {
|
|
219
219
|
try {
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
const result = message.t === "write-entity-asset" ? await (options.writeEntityAsset ?? (() => {
|
|
221
|
+
throw new Error("Entity Asset writer is unavailable");
|
|
222
|
+
}))(message.entity, message.content) : await (options.loadEntityAsset ?? (() => {
|
|
223
|
+
throw new Error("Entity Asset loader is unavailable");
|
|
224
|
+
}))(message.entity);
|
|
222
225
|
if (!settled) worker.postMessage({
|
|
223
226
|
t: "entity-asset-result",
|
|
224
227
|
requestId: message.requestId,
|
|
@@ -1050,7 +1053,7 @@ Project initialization creates one current Timeline, the four standard Tracks an
|
|
|
1050
1053
|
|
|
1051
1054
|
For Speech resources, create a Voice with external:{system:'memota-speech',key:speechId}, then await rgetAssetFromEntity(voiceId) before linking its placement. The host supplies full extent and optional voice-library identity, and assembles physical storage facts internally. Read the visible fields through entities.get; never invent them or use a Speech ID as a Memota media ID. TTS Voice still requires its real PhoneticScript relation; resource loading does not invent script content.
|
|
1052
1055
|
|
|
1053
|
-
AudioScript has no intrinsic time and cannot be Clip content. ASR input Audio/Video/Voice associates via audio-script-source(script,source). Its external annotation SequenceMarker associates via audio-script-marker(script,marker) and receives assigned segmentRanges, not references to another marker. Caption intrinsic timing and its Clip's display SequenceMarker are distinct. Move/stretch display by editing only the placement marker.
|
|
1056
|
+
Direct AudioScript creation saves its segments as a resource before publication. Its assembled segments remain readable and editable; committed text changes preserve native Loro operations and save a new immutable resource, automatically advancing the external reference. AudioScripts initialized through Caption resources keep inline segments without an additional script resource. Do not manage these resources yourself. AudioScript has no intrinsic time and cannot be Clip content. ASR input Audio/Video/Voice associates via audio-script-source(script,source). Its external annotation SequenceMarker associates via audio-script-marker(script,marker) and receives assigned segmentRanges, not references to another marker. Caption intrinsic timing and its Clip's display SequenceMarker are distinct. Move/stretch display by editing only the placement marker.
|
|
1054
1057
|
|
|
1055
1058
|
To place content, create a Clip and a SequenceMarker, then link track-clip(track,clip), clip-marker(clip,marker) and marker-content(marker,content). Existing track membership uses timeline-track(timeline,track). The editor has one track of each role: video_clip for Image/Video, speech for Voice, caption for Caption, bgm for Audio. Inspect factual media extents; never invent duration. Each placement is exactly one of Clip.order (sequential), Marker.targetRange (absolute) or clip-anchor(childClip,hostClip) plus Marker.anchorOffset. Marker.sourceRange selects source, duration describes playback/display. Whole milliseconds are required by this editor projection. Clip.volume is decibels (-60..20, 0 original). Image is unbounded/constant. Linear timeRemapping is {kind:'linear',rate:2,mode:'constant'}, with duration matching the rounded source span/rate. BGM can use durationPolicy:'timeline'. Nonlinear speed and multiple overlay tracks are unsupported. Caption visibility is the caption Track's hidden field. Caption style is its style map. Handle structural links explicitly when moving/deleting; there is no implicit cascade.
|
|
1056
1059
|
|
|
@@ -1658,6 +1661,7 @@ function createMedeoTool(options) {
|
|
|
1658
1661
|
baseVersion,
|
|
1659
1662
|
entityState,
|
|
1660
1663
|
loadEntityAsset: options.loadEntityAsset ? (entity) => options.loadEntityAsset(input.doc_id, entity) : void 0,
|
|
1664
|
+
writeEntityAsset: options.writeEntityAsset ? (entity, content) => options.writeEntityAsset(input.doc_id, entity, content) : void 0,
|
|
1661
1665
|
script: input.script,
|
|
1662
1666
|
...input.inputs !== void 0 ? { inputs: input.inputs } : {},
|
|
1663
1667
|
timeoutMs: input.timeout_ms ?? options.sandbox?.timeoutMs ?? 3e4,
|