@mulmoclaude/mulmoscript-plugin 4.3.0 → 4.5.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/dist/contract-BHqxMUWm.cjs +82 -0
- package/dist/contract-BHqxMUWm.cjs.map +1 -0
- package/dist/contract-BnIl6w_f.js +53 -0
- package/dist/contract-BnIl6w_f.js.map +1 -0
- package/dist/core/contract.d.ts +80 -6
- package/dist/core/contract.d.ts.map +1 -1
- package/dist/core/definition.d.ts.map +1 -1
- package/dist/core/paths.d.ts +41 -0
- package/dist/core/paths.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/lang/de.d.ts.map +1 -1
- package/dist/lang/en.d.ts.map +1 -1
- package/dist/lang/es.d.ts.map +1 -1
- package/dist/lang/fr.d.ts.map +1 -1
- package/dist/lang/ja.d.ts.map +1 -1
- package/dist/lang/ko.d.ts.map +1 -1
- package/dist/lang/messages.d.ts +4 -0
- package/dist/lang/messages.d.ts.map +1 -1
- package/dist/lang/ptBR.d.ts.map +1 -1
- package/dist/lang/zh.d.ts.map +1 -1
- package/dist/{plugin-BOq5YkTl.cjs → plugin-C5JC2lNR.cjs} +51 -1
- package/dist/plugin-C5JC2lNR.cjs.map +1 -0
- package/dist/{plugin-CAhxJ5WM.js → plugin-Jo8iGv4K.js} +40 -2
- package/dist/plugin-Jo8iGv4K.js.map +1 -0
- package/dist/server/dispatch.d.ts +0 -6
- package/dist/server/dispatch.d.ts.map +1 -1
- package/dist/server/ops.d.ts +29 -18
- package/dist/server/ops.d.ts.map +1 -1
- package/dist/server/types.d.ts +64 -2
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server.cjs +423 -110
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +423 -110
- package/dist/server.js.map +1 -1
- package/dist/style.css +46 -18
- package/dist/vue/View.vue.d.ts.map +1 -1
- package/dist/vue/composables/useDeckEditor.d.ts +1 -1
- package/dist/vue/composables/useDeckEditor.d.ts.map +1 -1
- package/dist/vue/helpers.d.ts +11 -8
- package/dist/vue/helpers.d.ts.map +1 -1
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/subscription.d.ts +16 -0
- package/dist/vue/subscription.d.ts.map +1 -0
- package/dist/vue/transport.d.ts +16 -5
- package/dist/vue/transport.d.ts.map +1 -1
- package/dist/vue.cjs +244 -110
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.js +244 -110
- package/dist/vue.js.map +1 -1
- package/package.json +11 -11
- package/dist/contract-BhN3yKJC.cjs +0 -36
- package/dist/contract-BhN3yKJC.cjs.map +0 -1
- package/dist/contract-CIt1ZAtt.js +0 -19
- package/dist/contract-CIt1ZAtt.js.map +0 -1
- package/dist/plugin-BOq5YkTl.cjs.map +0 -1
- package/dist/plugin-CAhxJ5WM.js.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/core/contract.ts
|
|
2
|
+
/** Plugin pubsub event name the host publishes generation events on
|
|
3
|
+
* (full channel: `plugin:<scope>:generation`). */
|
|
4
|
+
var GENERATION_EVENT = "generation";
|
|
5
|
+
/** Plugin pubsub event name for "this script changed on disk"
|
|
6
|
+
* (full channel: `plugin:<scope>:scriptChanged`). */
|
|
7
|
+
var SCRIPT_CHANGED_EVENT = "scriptChanged";
|
|
8
|
+
/**
|
|
9
|
+
* Whether a View watching `watching` should reload because of `event`.
|
|
10
|
+
*
|
|
11
|
+
* A pure rule rather than a condition inside the subscriber, because the case that matters is
|
|
12
|
+
* the one that is invisible when it is wrong: a View acting on the echo of its own write
|
|
13
|
+
* rebuilds the element the caret is in, on every keystroke.
|
|
14
|
+
*/
|
|
15
|
+
var shouldReloadForScriptChange = (event, watching, ownOrigin, watchingRoot) => watching !== "" && event.filePath === watching && sameRoot(event.root, watchingRoot) && event.origin !== ownOrigin;
|
|
16
|
+
/**
|
|
17
|
+
* The one spelling of a root that every comparison and every key must use.
|
|
18
|
+
*
|
|
19
|
+
* It lives HERE, in the module both the server and the View import, because
|
|
20
|
+
* the server had its own copy and the browser side compared raw strings — so
|
|
21
|
+
* `publishGeneration` emitted `"repoA"` while a View watching `" repoA "`
|
|
22
|
+
* dropped every event of its own generation (CodeRabbit on #3015). A rule
|
|
23
|
+
* that two sides must agree on cannot live on one of the two sides.
|
|
24
|
+
*
|
|
25
|
+
* Trimmed, because the codebase's other opaque "which project root" reader —
|
|
26
|
+
* `readCommandScope` in `@mulmoclaude/core/remote-host` — trims its value and
|
|
27
|
+
* shares the "absent = the host's own root" convention. Without this,
|
|
28
|
+
* `" repoA "` is one root there and a different one here.
|
|
29
|
+
*
|
|
30
|
+
* A non-string reads as the default root rather than throwing. The type says
|
|
31
|
+
* that cannot happen, but this package is published and its callers include
|
|
32
|
+
* untyped JavaScript: a subscription whose `root()` returns `42` reached
|
|
33
|
+
* `.trim()` and threw from INSIDE a pubsub callback, where nothing catches it
|
|
34
|
+
* and the View simply stops updating (Codex P2 on #3015). The guard belongs
|
|
35
|
+
* here rather than at the three call sites, because a rule enforced by
|
|
36
|
+
* enumerating its callers is what this PR got wrong repeatedly.
|
|
37
|
+
*/
|
|
38
|
+
var normalizeRoot = (root) => typeof root === "string" ? root.trim() : "";
|
|
39
|
+
/**
|
|
40
|
+
* Two roots are the same when they name the same one, with absent meaning the
|
|
41
|
+
* host's default (#3014).
|
|
42
|
+
*
|
|
43
|
+
* The identity of a script is the PAIR, not the path: `stories/deck.json` in
|
|
44
|
+
* two repositories is two files, and comparing paths alone would reload the
|
|
45
|
+
* View watching one because the other was saved. Absent normalises to the
|
|
46
|
+
* default so a pre-`root` event and a default-root watcher still match — that
|
|
47
|
+
* equivalence is what keeps every existing card working untouched.
|
|
48
|
+
*/
|
|
49
|
+
var sameRoot = (a, b) => normalizeRoot(a) === normalizeRoot(b);
|
|
50
|
+
//#endregion
|
|
51
|
+
Object.defineProperty(exports, "GENERATION_EVENT", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function() {
|
|
54
|
+
return GENERATION_EVENT;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, "SCRIPT_CHANGED_EVENT", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function() {
|
|
60
|
+
return SCRIPT_CHANGED_EVENT;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "normalizeRoot", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function() {
|
|
66
|
+
return normalizeRoot;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(exports, "sameRoot", {
|
|
70
|
+
enumerable: true,
|
|
71
|
+
get: function() {
|
|
72
|
+
return sameRoot;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
Object.defineProperty(exports, "shouldReloadForScriptChange", {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function() {
|
|
78
|
+
return shouldReloadForScriptChange;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=contract-BHqxMUWm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-BHqxMUWm.cjs","names":[],"sources":["../src/core/contract.ts"],"sourcesContent":["// Host-agnostic dispatch envelope for the presentMulmoScript View. The Vue\n// View is decoupled from any one host's REST surface: it calls\n// `useRuntime().dispatch({ kind, … })`, the host routes that to its\n// mulmoScript dispatch handler, and every response is an `{ ok: … }`\n// envelope so failures travel as data (no HTTP-status coupling, no\n// \"dispatch failed (500)\" prefixes in user-facing errors).\n//\n// Long-running generation (movie / PDF) is a single long-held dispatch that\n// resolves when the pipeline finishes; per-beat progress arrives on the\n// plugin pubsub channel (`GENERATION_EVENT`) instead of an SSE stream, which\n// also covers generations started elsewhere (background autoGenerateMovie,\n// another tab, the agent).\n\n/** One in-flight or per-beat generation notice, published on the plugin\n * pubsub `generation` channel and returned by the `pendingGenerations`\n * snapshot. Value strings mirror @mulmobridge/protocol's GENERATION_KINDS\n * so MulmoClaude's host bridge maps 1:1 without a lookup table. */\nexport interface MulmoScriptGenerationEvent {\n kind: \"beatImage\" | \"beatAudio\" | \"characterImage\" | \"movie\" | \"pdf\";\n /** Wire `stories/…` path of the script the generation belongs to. */\n filePath: string;\n /** Which stories root `filePath` is relative to (#3014). Absent = the\n * host's default root, which is every event this package emitted before\n * roots existed. */\n root?: string;\n /** beatIndex (as string) for beat*, character key for characterImage, \"\" for movie/pdf. */\n key: string;\n /** false = started, true = finished (reload the asset off disk). */\n done: boolean;\n /** Only set on done=true when the work failed. */\n error?: string;\n}\n\n/** Plugin pubsub event name the host publishes generation events on\n * (full channel: `plugin:<scope>:generation`). */\nexport const GENERATION_EVENT = \"generation\";\n\n/** Plugin pubsub event name for \"this script changed on disk\"\n * (full channel: `plugin:<scope>:scriptChanged`). */\nexport const SCRIPT_CHANGED_EVENT = \"scriptChanged\";\n\n/**\n * A script was written — by the agent, or by another View.\n *\n * `origin` is who wrote it. A View passes its own id on every write and ignores the echo of\n * its own: without that, a keystroke would round-trip through the server and reload the very\n * element the caret is in. An agent write carries no origin, so every View reloads.\n */\nexport interface MulmoScriptChangedEvent {\n filePath: string;\n /** Which stories root `filePath` is relative to (#3014). Absent = default. */\n root?: string;\n origin?: string;\n}\n\n/**\n * Whether a View watching `watching` should reload because of `event`.\n *\n * A pure rule rather than a condition inside the subscriber, because the case that matters is\n * the one that is invisible when it is wrong: a View acting on the echo of its own write\n * rebuilds the element the caret is in, on every keystroke.\n */\nexport const shouldReloadForScriptChange = (event: MulmoScriptChangedEvent, watching: string, ownOrigin: string, watchingRoot?: string): boolean =>\n watching !== \"\" && event.filePath === watching && sameRoot(event.root, watchingRoot) && event.origin !== ownOrigin;\n\n/** The default root: what a caller that names no root is asking for. */\nexport const DEFAULT_ROOT = \"\";\n\n/**\n * The one spelling of a root that every comparison and every key must use.\n *\n * It lives HERE, in the module both the server and the View import, because\n * the server had its own copy and the browser side compared raw strings — so\n * `publishGeneration` emitted `\"repoA\"` while a View watching `\" repoA \"`\n * dropped every event of its own generation (CodeRabbit on #3015). A rule\n * that two sides must agree on cannot live on one of the two sides.\n *\n * Trimmed, because the codebase's other opaque \"which project root\" reader —\n * `readCommandScope` in `@mulmoclaude/core/remote-host` — trims its value and\n * shares the \"absent = the host's own root\" convention. Without this,\n * `\" repoA \"` is one root there and a different one here.\n *\n * A non-string reads as the default root rather than throwing. The type says\n * that cannot happen, but this package is published and its callers include\n * untyped JavaScript: a subscription whose `root()` returns `42` reached\n * `.trim()` and threw from INSIDE a pubsub callback, where nothing catches it\n * and the View simply stops updating (Codex P2 on #3015). The guard belongs\n * here rather than at the three call sites, because a rule enforced by\n * enumerating its callers is what this PR got wrong repeatedly.\n */\nexport const normalizeRoot = (root: string | undefined): string => (typeof root === \"string\" ? root.trim() : DEFAULT_ROOT);\n\n/**\n * Two roots are the same when they name the same one, with absent meaning the\n * host's default (#3014).\n *\n * The identity of a script is the PAIR, not the path: `stories/deck.json` in\n * two repositories is two files, and comparing paths alone would reload the\n * View watching one because the other was saved. Absent normalises to the\n * default so a pre-`root` event and a default-root watcher still match — that\n * equivalence is what keeps every existing card working untouched.\n */\nexport const sameRoot = (a: string | undefined, b: string | undefined): boolean => normalizeRoot(a) === normalizeRoot(b);\n\ninterface BeatRef {\n filePath: string;\n beatIndex: number;\n}\n\ninterface CharacterRef {\n filePath: string;\n key: string;\n}\n\n/** Session tag for hosts that surface per-session generation indicators\n * (MulmoClaude's sidebar). Optional everywhere; hosts without sessions\n * ignore it. */\ninterface SessionTag {\n chatSessionId?: string | undefined;\n}\n\n/**\n * Which registered stories root the named script lives in (#3014).\n *\n * Intersected into the whole union below, so every dispatch that names a\n * `filePath` can name its root — a union member that could not would make\n * root-aware calls untypeable while the handler happily read `args.root`\n * off an untyped record (Codex P1 on #3015).\n */\ninterface RootTag {\n root?: string | undefined;\n}\n\nexport type MulmoScriptDispatchArgs = RootTag &\n (\n | ({ kind: \"save\" } & { filePath?: string; script?: unknown; filename?: string })\n | { kind: \"updateBeat\"; filePath: string; beatIndex: number; beat: unknown; origin?: string }\n | { kind: \"updateScript\"; filePath: string; script: unknown; origin?: string }\n | ({ kind: \"beatImage\" } & BeatRef)\n | ({ kind: \"beatAudio\" } & BeatRef)\n | ({ kind: \"beatMovie\" } & BeatRef)\n | ({ kind: \"renderBeat\" } & BeatRef & SessionTag & { force?: boolean })\n | ({ kind: \"generateBeatAudio\" } & BeatRef & SessionTag & { force?: boolean })\n | ({ kind: \"uploadBeatImage\" } & BeatRef & { imageData: string })\n | ({ kind: \"characterImage\" } & CharacterRef)\n | ({ kind: \"renderCharacter\" } & CharacterRef & SessionTag & { force?: boolean })\n | ({ kind: \"uploadCharacterImage\" } & CharacterRef & { imageData: string })\n | ({ kind: \"movieStatus\" } & { filePath: string })\n | ({ kind: \"pdfStatus\" } & { filePath: string })\n | ({ kind: \"generateMovie\" } & { filePath: string } & SessionTag)\n | ({ kind: \"generatePdf\" } & { filePath: string } & SessionTag)\n | { kind: \"pendingGenerations\"; filePath: string }\n );\n\nexport type MulmoScriptDispatchKind = MulmoScriptDispatchArgs[\"kind\"];\n\n/** Failure half of every dispatch response. `code` mirrors the phase-1\n * outcome codes so a host can log/telemetry on it; the View only reads\n * `error`. */\nexport interface DispatchFailure {\n ok: false;\n code?: \"bad_request\" | \"not_found\" | \"server_error\";\n error: string;\n}\n\nexport type DispatchEnvelope<T> = ({ ok: true } & T) | DispatchFailure;\n\n/** The success payload of each dispatch `kind`, BEFORE the root tag below is\n * applied. Not exported: `MulmoScriptDispatchResult` is the type callers use. */\ninterface DispatchResultPayloads {\n save: { script: Record<string, unknown>; filePath: string; message: string };\n updateBeat: Record<string, never>;\n updateScript: Record<string, never>;\n beatImage: { image: string | null };\n beatAudio: { audio: string | null };\n beatMovie: { moviePath: string | null };\n renderBeat: { image: string };\n generateBeatAudio: { audio: string };\n uploadBeatImage: { image: string };\n characterImage: { image: string | null };\n renderCharacter: { image: string };\n uploadCharacterImage: { image: string };\n movieStatus: { moviePath: string | null };\n pdfStatus: { pdfPath: string | null };\n generateMovie: { moviePath: string };\n generatePdf: { pdfPath: string };\n pendingGenerations: { pending: MulmoScriptGenerationEvent[] };\n}\n\n/**\n * Maps a dispatch `kind` to its success payload, every one of them carrying\n * the root it acted in.\n *\n * A host builds its cards from these results, and a card's identity is the\n * PAIR `(root, filePath)` — `stories/deck.json` exists in every registered\n * root. Without the root here, two repositories' identically-named decks\n * collapse onto one card, which is #3014's third collision point, and no\n * amount of fixing the host's identity function helps because the value never\n * arrives.\n *\n * `root` was threaded through the ARGS and the EVENTS in #3015 and not through\n * the results — the same shape that PR got wrong repeatedly: the comparison\n * widened while the path carrying the data to it did not. Applied as a mapped\n * type rather than field by field so a kind added later cannot be forgotten.\n *\n * Absent means the default root, so every pre-`root` card is unchanged.\n */\nexport type MulmoScriptDispatchResult = {\n [K in keyof DispatchResultPayloads]: DispatchResultPayloads[K] & RootTag;\n};\n"],"mappings":";;;AAmCA,IAAa,mBAAmB;;;AAIhC,IAAa,uBAAuB;;;;;;;;AAuBpC,IAAa,+BAA+B,OAAgC,UAAkB,WAAmB,iBAC/G,aAAa,MAAM,MAAM,aAAa,YAAY,SAAS,MAAM,MAAM,YAAY,KAAK,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;AA2B3G,IAAa,iBAAiB,SAAsC,OAAO,SAAS,WAAW,KAAK,KAAK,IAAA;;;;;;;;;;;AAYzG,IAAa,YAAY,GAAuB,MAAmC,cAAc,CAAC,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/core/contract.ts
|
|
2
|
+
/** Plugin pubsub event name the host publishes generation events on
|
|
3
|
+
* (full channel: `plugin:<scope>:generation`). */
|
|
4
|
+
var GENERATION_EVENT = "generation";
|
|
5
|
+
/** Plugin pubsub event name for "this script changed on disk"
|
|
6
|
+
* (full channel: `plugin:<scope>:scriptChanged`). */
|
|
7
|
+
var SCRIPT_CHANGED_EVENT = "scriptChanged";
|
|
8
|
+
/**
|
|
9
|
+
* Whether a View watching `watching` should reload because of `event`.
|
|
10
|
+
*
|
|
11
|
+
* A pure rule rather than a condition inside the subscriber, because the case that matters is
|
|
12
|
+
* the one that is invisible when it is wrong: a View acting on the echo of its own write
|
|
13
|
+
* rebuilds the element the caret is in, on every keystroke.
|
|
14
|
+
*/
|
|
15
|
+
var shouldReloadForScriptChange = (event, watching, ownOrigin, watchingRoot) => watching !== "" && event.filePath === watching && sameRoot(event.root, watchingRoot) && event.origin !== ownOrigin;
|
|
16
|
+
/**
|
|
17
|
+
* The one spelling of a root that every comparison and every key must use.
|
|
18
|
+
*
|
|
19
|
+
* It lives HERE, in the module both the server and the View import, because
|
|
20
|
+
* the server had its own copy and the browser side compared raw strings — so
|
|
21
|
+
* `publishGeneration` emitted `"repoA"` while a View watching `" repoA "`
|
|
22
|
+
* dropped every event of its own generation (CodeRabbit on #3015). A rule
|
|
23
|
+
* that two sides must agree on cannot live on one of the two sides.
|
|
24
|
+
*
|
|
25
|
+
* Trimmed, because the codebase's other opaque "which project root" reader —
|
|
26
|
+
* `readCommandScope` in `@mulmoclaude/core/remote-host` — trims its value and
|
|
27
|
+
* shares the "absent = the host's own root" convention. Without this,
|
|
28
|
+
* `" repoA "` is one root there and a different one here.
|
|
29
|
+
*
|
|
30
|
+
* A non-string reads as the default root rather than throwing. The type says
|
|
31
|
+
* that cannot happen, but this package is published and its callers include
|
|
32
|
+
* untyped JavaScript: a subscription whose `root()` returns `42` reached
|
|
33
|
+
* `.trim()` and threw from INSIDE a pubsub callback, where nothing catches it
|
|
34
|
+
* and the View simply stops updating (Codex P2 on #3015). The guard belongs
|
|
35
|
+
* here rather than at the three call sites, because a rule enforced by
|
|
36
|
+
* enumerating its callers is what this PR got wrong repeatedly.
|
|
37
|
+
*/
|
|
38
|
+
var normalizeRoot = (root) => typeof root === "string" ? root.trim() : "";
|
|
39
|
+
/**
|
|
40
|
+
* Two roots are the same when they name the same one, with absent meaning the
|
|
41
|
+
* host's default (#3014).
|
|
42
|
+
*
|
|
43
|
+
* The identity of a script is the PAIR, not the path: `stories/deck.json` in
|
|
44
|
+
* two repositories is two files, and comparing paths alone would reload the
|
|
45
|
+
* View watching one because the other was saved. Absent normalises to the
|
|
46
|
+
* default so a pre-`root` event and a default-root watcher still match — that
|
|
47
|
+
* equivalence is what keeps every existing card working untouched.
|
|
48
|
+
*/
|
|
49
|
+
var sameRoot = (a, b) => normalizeRoot(a) === normalizeRoot(b);
|
|
50
|
+
//#endregion
|
|
51
|
+
export { shouldReloadForScriptChange as a, sameRoot as i, SCRIPT_CHANGED_EVENT as n, normalizeRoot as r, GENERATION_EVENT as t };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=contract-BnIl6w_f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-BnIl6w_f.js","names":[],"sources":["../src/core/contract.ts"],"sourcesContent":["// Host-agnostic dispatch envelope for the presentMulmoScript View. The Vue\n// View is decoupled from any one host's REST surface: it calls\n// `useRuntime().dispatch({ kind, … })`, the host routes that to its\n// mulmoScript dispatch handler, and every response is an `{ ok: … }`\n// envelope so failures travel as data (no HTTP-status coupling, no\n// \"dispatch failed (500)\" prefixes in user-facing errors).\n//\n// Long-running generation (movie / PDF) is a single long-held dispatch that\n// resolves when the pipeline finishes; per-beat progress arrives on the\n// plugin pubsub channel (`GENERATION_EVENT`) instead of an SSE stream, which\n// also covers generations started elsewhere (background autoGenerateMovie,\n// another tab, the agent).\n\n/** One in-flight or per-beat generation notice, published on the plugin\n * pubsub `generation` channel and returned by the `pendingGenerations`\n * snapshot. Value strings mirror @mulmobridge/protocol's GENERATION_KINDS\n * so MulmoClaude's host bridge maps 1:1 without a lookup table. */\nexport interface MulmoScriptGenerationEvent {\n kind: \"beatImage\" | \"beatAudio\" | \"characterImage\" | \"movie\" | \"pdf\";\n /** Wire `stories/…` path of the script the generation belongs to. */\n filePath: string;\n /** Which stories root `filePath` is relative to (#3014). Absent = the\n * host's default root, which is every event this package emitted before\n * roots existed. */\n root?: string;\n /** beatIndex (as string) for beat*, character key for characterImage, \"\" for movie/pdf. */\n key: string;\n /** false = started, true = finished (reload the asset off disk). */\n done: boolean;\n /** Only set on done=true when the work failed. */\n error?: string;\n}\n\n/** Plugin pubsub event name the host publishes generation events on\n * (full channel: `plugin:<scope>:generation`). */\nexport const GENERATION_EVENT = \"generation\";\n\n/** Plugin pubsub event name for \"this script changed on disk\"\n * (full channel: `plugin:<scope>:scriptChanged`). */\nexport const SCRIPT_CHANGED_EVENT = \"scriptChanged\";\n\n/**\n * A script was written — by the agent, or by another View.\n *\n * `origin` is who wrote it. A View passes its own id on every write and ignores the echo of\n * its own: without that, a keystroke would round-trip through the server and reload the very\n * element the caret is in. An agent write carries no origin, so every View reloads.\n */\nexport interface MulmoScriptChangedEvent {\n filePath: string;\n /** Which stories root `filePath` is relative to (#3014). Absent = default. */\n root?: string;\n origin?: string;\n}\n\n/**\n * Whether a View watching `watching` should reload because of `event`.\n *\n * A pure rule rather than a condition inside the subscriber, because the case that matters is\n * the one that is invisible when it is wrong: a View acting on the echo of its own write\n * rebuilds the element the caret is in, on every keystroke.\n */\nexport const shouldReloadForScriptChange = (event: MulmoScriptChangedEvent, watching: string, ownOrigin: string, watchingRoot?: string): boolean =>\n watching !== \"\" && event.filePath === watching && sameRoot(event.root, watchingRoot) && event.origin !== ownOrigin;\n\n/** The default root: what a caller that names no root is asking for. */\nexport const DEFAULT_ROOT = \"\";\n\n/**\n * The one spelling of a root that every comparison and every key must use.\n *\n * It lives HERE, in the module both the server and the View import, because\n * the server had its own copy and the browser side compared raw strings — so\n * `publishGeneration` emitted `\"repoA\"` while a View watching `\" repoA \"`\n * dropped every event of its own generation (CodeRabbit on #3015). A rule\n * that two sides must agree on cannot live on one of the two sides.\n *\n * Trimmed, because the codebase's other opaque \"which project root\" reader —\n * `readCommandScope` in `@mulmoclaude/core/remote-host` — trims its value and\n * shares the \"absent = the host's own root\" convention. Without this,\n * `\" repoA \"` is one root there and a different one here.\n *\n * A non-string reads as the default root rather than throwing. The type says\n * that cannot happen, but this package is published and its callers include\n * untyped JavaScript: a subscription whose `root()` returns `42` reached\n * `.trim()` and threw from INSIDE a pubsub callback, where nothing catches it\n * and the View simply stops updating (Codex P2 on #3015). The guard belongs\n * here rather than at the three call sites, because a rule enforced by\n * enumerating its callers is what this PR got wrong repeatedly.\n */\nexport const normalizeRoot = (root: string | undefined): string => (typeof root === \"string\" ? root.trim() : DEFAULT_ROOT);\n\n/**\n * Two roots are the same when they name the same one, with absent meaning the\n * host's default (#3014).\n *\n * The identity of a script is the PAIR, not the path: `stories/deck.json` in\n * two repositories is two files, and comparing paths alone would reload the\n * View watching one because the other was saved. Absent normalises to the\n * default so a pre-`root` event and a default-root watcher still match — that\n * equivalence is what keeps every existing card working untouched.\n */\nexport const sameRoot = (a: string | undefined, b: string | undefined): boolean => normalizeRoot(a) === normalizeRoot(b);\n\ninterface BeatRef {\n filePath: string;\n beatIndex: number;\n}\n\ninterface CharacterRef {\n filePath: string;\n key: string;\n}\n\n/** Session tag for hosts that surface per-session generation indicators\n * (MulmoClaude's sidebar). Optional everywhere; hosts without sessions\n * ignore it. */\ninterface SessionTag {\n chatSessionId?: string | undefined;\n}\n\n/**\n * Which registered stories root the named script lives in (#3014).\n *\n * Intersected into the whole union below, so every dispatch that names a\n * `filePath` can name its root — a union member that could not would make\n * root-aware calls untypeable while the handler happily read `args.root`\n * off an untyped record (Codex P1 on #3015).\n */\ninterface RootTag {\n root?: string | undefined;\n}\n\nexport type MulmoScriptDispatchArgs = RootTag &\n (\n | ({ kind: \"save\" } & { filePath?: string; script?: unknown; filename?: string })\n | { kind: \"updateBeat\"; filePath: string; beatIndex: number; beat: unknown; origin?: string }\n | { kind: \"updateScript\"; filePath: string; script: unknown; origin?: string }\n | ({ kind: \"beatImage\" } & BeatRef)\n | ({ kind: \"beatAudio\" } & BeatRef)\n | ({ kind: \"beatMovie\" } & BeatRef)\n | ({ kind: \"renderBeat\" } & BeatRef & SessionTag & { force?: boolean })\n | ({ kind: \"generateBeatAudio\" } & BeatRef & SessionTag & { force?: boolean })\n | ({ kind: \"uploadBeatImage\" } & BeatRef & { imageData: string })\n | ({ kind: \"characterImage\" } & CharacterRef)\n | ({ kind: \"renderCharacter\" } & CharacterRef & SessionTag & { force?: boolean })\n | ({ kind: \"uploadCharacterImage\" } & CharacterRef & { imageData: string })\n | ({ kind: \"movieStatus\" } & { filePath: string })\n | ({ kind: \"pdfStatus\" } & { filePath: string })\n | ({ kind: \"generateMovie\" } & { filePath: string } & SessionTag)\n | ({ kind: \"generatePdf\" } & { filePath: string } & SessionTag)\n | { kind: \"pendingGenerations\"; filePath: string }\n );\n\nexport type MulmoScriptDispatchKind = MulmoScriptDispatchArgs[\"kind\"];\n\n/** Failure half of every dispatch response. `code` mirrors the phase-1\n * outcome codes so a host can log/telemetry on it; the View only reads\n * `error`. */\nexport interface DispatchFailure {\n ok: false;\n code?: \"bad_request\" | \"not_found\" | \"server_error\";\n error: string;\n}\n\nexport type DispatchEnvelope<T> = ({ ok: true } & T) | DispatchFailure;\n\n/** The success payload of each dispatch `kind`, BEFORE the root tag below is\n * applied. Not exported: `MulmoScriptDispatchResult` is the type callers use. */\ninterface DispatchResultPayloads {\n save: { script: Record<string, unknown>; filePath: string; message: string };\n updateBeat: Record<string, never>;\n updateScript: Record<string, never>;\n beatImage: { image: string | null };\n beatAudio: { audio: string | null };\n beatMovie: { moviePath: string | null };\n renderBeat: { image: string };\n generateBeatAudio: { audio: string };\n uploadBeatImage: { image: string };\n characterImage: { image: string | null };\n renderCharacter: { image: string };\n uploadCharacterImage: { image: string };\n movieStatus: { moviePath: string | null };\n pdfStatus: { pdfPath: string | null };\n generateMovie: { moviePath: string };\n generatePdf: { pdfPath: string };\n pendingGenerations: { pending: MulmoScriptGenerationEvent[] };\n}\n\n/**\n * Maps a dispatch `kind` to its success payload, every one of them carrying\n * the root it acted in.\n *\n * A host builds its cards from these results, and a card's identity is the\n * PAIR `(root, filePath)` — `stories/deck.json` exists in every registered\n * root. Without the root here, two repositories' identically-named decks\n * collapse onto one card, which is #3014's third collision point, and no\n * amount of fixing the host's identity function helps because the value never\n * arrives.\n *\n * `root` was threaded through the ARGS and the EVENTS in #3015 and not through\n * the results — the same shape that PR got wrong repeatedly: the comparison\n * widened while the path carrying the data to it did not. Applied as a mapped\n * type rather than field by field so a kind added later cannot be forgotten.\n *\n * Absent means the default root, so every pre-`root` card is unchanged.\n */\nexport type MulmoScriptDispatchResult = {\n [K in keyof DispatchResultPayloads]: DispatchResultPayloads[K] & RootTag;\n};\n"],"mappings":";;;AAmCA,IAAa,mBAAmB;;;AAIhC,IAAa,uBAAuB;;;;;;;;AAuBpC,IAAa,+BAA+B,OAAgC,UAAkB,WAAmB,iBAC/G,aAAa,MAAM,MAAM,aAAa,YAAY,SAAS,MAAM,MAAM,YAAY,KAAK,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;AA2B3G,IAAa,iBAAiB,SAAsC,OAAO,SAAS,WAAW,KAAK,KAAK,IAAA;;;;;;;;;;;AAYzG,IAAa,YAAY,GAAuB,MAAmC,cAAc,CAAC,MAAM,cAAc,CAAC"}
|
package/dist/core/contract.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export interface MulmoScriptGenerationEvent {
|
|
|
6
6
|
kind: "beatImage" | "beatAudio" | "characterImage" | "movie" | "pdf";
|
|
7
7
|
/** Wire `stories/…` path of the script the generation belongs to. */
|
|
8
8
|
filePath: string;
|
|
9
|
+
/** Which stories root `filePath` is relative to (#3014). Absent = the
|
|
10
|
+
* host's default root, which is every event this package emitted before
|
|
11
|
+
* roots existed. */
|
|
12
|
+
root?: string;
|
|
9
13
|
/** beatIndex (as string) for beat*, character key for characterImage, "" for movie/pdf. */
|
|
10
14
|
key: string;
|
|
11
15
|
/** false = started, true = finished (reload the asset off disk). */
|
|
@@ -28,6 +32,8 @@ export declare const SCRIPT_CHANGED_EVENT = "scriptChanged";
|
|
|
28
32
|
*/
|
|
29
33
|
export interface MulmoScriptChangedEvent {
|
|
30
34
|
filePath: string;
|
|
35
|
+
/** Which stories root `filePath` is relative to (#3014). Absent = default. */
|
|
36
|
+
root?: string;
|
|
31
37
|
origin?: string;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
@@ -37,7 +43,43 @@ export interface MulmoScriptChangedEvent {
|
|
|
37
43
|
* the one that is invisible when it is wrong: a View acting on the echo of its own write
|
|
38
44
|
* rebuilds the element the caret is in, on every keystroke.
|
|
39
45
|
*/
|
|
40
|
-
export declare const shouldReloadForScriptChange: (event: MulmoScriptChangedEvent, watching: string, ownOrigin: string) => boolean;
|
|
46
|
+
export declare const shouldReloadForScriptChange: (event: MulmoScriptChangedEvent, watching: string, ownOrigin: string, watchingRoot?: string) => boolean;
|
|
47
|
+
/** The default root: what a caller that names no root is asking for. */
|
|
48
|
+
export declare const DEFAULT_ROOT = "";
|
|
49
|
+
/**
|
|
50
|
+
* The one spelling of a root that every comparison and every key must use.
|
|
51
|
+
*
|
|
52
|
+
* It lives HERE, in the module both the server and the View import, because
|
|
53
|
+
* the server had its own copy and the browser side compared raw strings — so
|
|
54
|
+
* `publishGeneration` emitted `"repoA"` while a View watching `" repoA "`
|
|
55
|
+
* dropped every event of its own generation (CodeRabbit on #3015). A rule
|
|
56
|
+
* that two sides must agree on cannot live on one of the two sides.
|
|
57
|
+
*
|
|
58
|
+
* Trimmed, because the codebase's other opaque "which project root" reader —
|
|
59
|
+
* `readCommandScope` in `@mulmoclaude/core/remote-host` — trims its value and
|
|
60
|
+
* shares the "absent = the host's own root" convention. Without this,
|
|
61
|
+
* `" repoA "` is one root there and a different one here.
|
|
62
|
+
*
|
|
63
|
+
* A non-string reads as the default root rather than throwing. The type says
|
|
64
|
+
* that cannot happen, but this package is published and its callers include
|
|
65
|
+
* untyped JavaScript: a subscription whose `root()` returns `42` reached
|
|
66
|
+
* `.trim()` and threw from INSIDE a pubsub callback, where nothing catches it
|
|
67
|
+
* and the View simply stops updating (Codex P2 on #3015). The guard belongs
|
|
68
|
+
* here rather than at the three call sites, because a rule enforced by
|
|
69
|
+
* enumerating its callers is what this PR got wrong repeatedly.
|
|
70
|
+
*/
|
|
71
|
+
export declare const normalizeRoot: (root: string | undefined) => string;
|
|
72
|
+
/**
|
|
73
|
+
* Two roots are the same when they name the same one, with absent meaning the
|
|
74
|
+
* host's default (#3014).
|
|
75
|
+
*
|
|
76
|
+
* The identity of a script is the PAIR, not the path: `stories/deck.json` in
|
|
77
|
+
* two repositories is two files, and comparing paths alone would reload the
|
|
78
|
+
* View watching one because the other was saved. Absent normalises to the
|
|
79
|
+
* default so a pre-`root` event and a default-root watcher still match — that
|
|
80
|
+
* equivalence is what keeps every existing card working untouched.
|
|
81
|
+
*/
|
|
82
|
+
export declare const sameRoot: (a: string | undefined, b: string | undefined) => boolean;
|
|
41
83
|
interface BeatRef {
|
|
42
84
|
filePath: string;
|
|
43
85
|
beatIndex: number;
|
|
@@ -52,7 +94,18 @@ interface CharacterRef {
|
|
|
52
94
|
interface SessionTag {
|
|
53
95
|
chatSessionId?: string | undefined;
|
|
54
96
|
}
|
|
55
|
-
|
|
97
|
+
/**
|
|
98
|
+
* Which registered stories root the named script lives in (#3014).
|
|
99
|
+
*
|
|
100
|
+
* Intersected into the whole union below, so every dispatch that names a
|
|
101
|
+
* `filePath` can name its root — a union member that could not would make
|
|
102
|
+
* root-aware calls untypeable while the handler happily read `args.root`
|
|
103
|
+
* off an untyped record (Codex P1 on #3015).
|
|
104
|
+
*/
|
|
105
|
+
interface RootTag {
|
|
106
|
+
root?: string | undefined;
|
|
107
|
+
}
|
|
108
|
+
export type MulmoScriptDispatchArgs = RootTag & (({
|
|
56
109
|
kind: "save";
|
|
57
110
|
} & {
|
|
58
111
|
filePath?: string;
|
|
@@ -116,7 +169,7 @@ export type MulmoScriptDispatchArgs = ({
|
|
|
116
169
|
} & SessionTag) | {
|
|
117
170
|
kind: "pendingGenerations";
|
|
118
171
|
filePath: string;
|
|
119
|
-
};
|
|
172
|
+
});
|
|
120
173
|
export type MulmoScriptDispatchKind = MulmoScriptDispatchArgs["kind"];
|
|
121
174
|
/** Failure half of every dispatch response. `code` mirrors the phase-1
|
|
122
175
|
* outcome codes so a host can log/telemetry on it; the View only reads
|
|
@@ -129,9 +182,9 @@ export interface DispatchFailure {
|
|
|
129
182
|
export type DispatchEnvelope<T> = ({
|
|
130
183
|
ok: true;
|
|
131
184
|
} & T) | DispatchFailure;
|
|
132
|
-
/**
|
|
133
|
-
*
|
|
134
|
-
|
|
185
|
+
/** The success payload of each dispatch `kind`, BEFORE the root tag below is
|
|
186
|
+
* applied. Not exported: `MulmoScriptDispatchResult` is the type callers use. */
|
|
187
|
+
interface DispatchResultPayloads {
|
|
135
188
|
save: {
|
|
136
189
|
script: Record<string, unknown>;
|
|
137
190
|
filePath: string;
|
|
@@ -182,5 +235,26 @@ export interface MulmoScriptDispatchResult {
|
|
|
182
235
|
pending: MulmoScriptGenerationEvent[];
|
|
183
236
|
};
|
|
184
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Maps a dispatch `kind` to its success payload, every one of them carrying
|
|
240
|
+
* the root it acted in.
|
|
241
|
+
*
|
|
242
|
+
* A host builds its cards from these results, and a card's identity is the
|
|
243
|
+
* PAIR `(root, filePath)` — `stories/deck.json` exists in every registered
|
|
244
|
+
* root. Without the root here, two repositories' identically-named decks
|
|
245
|
+
* collapse onto one card, which is #3014's third collision point, and no
|
|
246
|
+
* amount of fixing the host's identity function helps because the value never
|
|
247
|
+
* arrives.
|
|
248
|
+
*
|
|
249
|
+
* `root` was threaded through the ARGS and the EVENTS in #3015 and not through
|
|
250
|
+
* the results — the same shape that PR got wrong repeatedly: the comparison
|
|
251
|
+
* widened while the path carrying the data to it did not. Applied as a mapped
|
|
252
|
+
* type rather than field by field so a kind added later cannot be forgotten.
|
|
253
|
+
*
|
|
254
|
+
* Absent means the default root, so every pre-`root` card is unchanged.
|
|
255
|
+
*/
|
|
256
|
+
export type MulmoScriptDispatchResult = {
|
|
257
|
+
[K in keyof DispatchResultPayloads]: DispatchResultPayloads[K] & RootTag;
|
|
258
|
+
};
|
|
185
259
|
export {};
|
|
186
260
|
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/core/contract.ts"],"names":[],"mappings":"AAaA;;;oEAGoE;AACpE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,gBAAgB,GAAG,OAAO,GAAG,KAAK,CAAC;IACrE,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,GAAG,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,IAAI,EAAE,OAAO,CAAC;IACd,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;mDACmD;AACnD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C;sDACsD;AACtD,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,uBAAuB,EAAE,UAAU,MAAM,EAAE,WAAW,MAAM,KAAG,
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../src/core/contract.ts"],"names":[],"mappings":"AAaA;;;oEAGoE;AACpE,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,GAAG,WAAW,GAAG,gBAAgB,GAAG,OAAO,GAAG,KAAK,CAAC;IACrE,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB;;yBAEqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2FAA2F;IAC3F,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ings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAM9C,eAAO,MAAM,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/core/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAO,MAAM,SAAS,uBAAuB,CAAC;AAM9C,eAAO,MAAM,eAAe,EAAE,cA0H7B,CAAC"}
|
package/dist/core/paths.d.ts
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The slice of `node:path` this rule needs.
|
|
3
|
+
*
|
|
4
|
+
* Injected with no default, and this module imports no `node:*` builtin: it is
|
|
5
|
+
* reached from the browser entry through `core/plugin`, so a `node:path`
|
|
6
|
+
* import here lands in the Vue bundle (Codex on #3017). The server passes its
|
|
7
|
+
* own `path`; tests pass `path.win32` to reach the case below.
|
|
8
|
+
*/
|
|
9
|
+
export interface PathRules {
|
|
10
|
+
relative: (from: string, to: string) => string;
|
|
11
|
+
isAbsolute: (p: string) => boolean;
|
|
12
|
+
sep: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The wire ref for an absolute path inside a stories root, or `null` when it
|
|
16
|
+
* is not inside one.
|
|
17
|
+
*
|
|
18
|
+
* Pure, and taking its path rules as an argument, because the case that
|
|
19
|
+
* matters is unreachable on the machine this is written on. `path.relative`
|
|
20
|
+
* says "not under the base" in TWO ways and only one looks like an escape:
|
|
21
|
+
* `../…` is the familiar one, and across Windows DRIVES there is no relative
|
|
22
|
+
* path at all, so `relative("C:\\base", "D:\\x")` answers `"D:\\x"` —
|
|
23
|
+
* absolute, with no `..` for the escape check to catch. That minted
|
|
24
|
+
* `stories/D:/anything`, a wire ref that reads back as a DIFFERENT file, which
|
|
25
|
+
* is the substitution this function exists to refuse. Only Windows CI caught
|
|
26
|
+
* it; here there is one root and always a relative route (#3015 post-merge).
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The path INSIDE a stories root that a wire path names, or null when it does
|
|
30
|
+
* not name one.
|
|
31
|
+
*
|
|
32
|
+
* The default root's FileOps is rooted one level up, at `<workspace>/artifacts`,
|
|
33
|
+
* so there the wire path and the FileOps path are the SAME string and nothing
|
|
34
|
+
* is stripped. A named root's FileOps is rooted at the stories directory
|
|
35
|
+
* itself — which is what a host naturally writes, having registered exactly
|
|
36
|
+
* that directory in `extraRoots` — so the `stories/` prefix has to come off,
|
|
37
|
+
* or the write lands in `<root>/stories/<rel>` while the read looks in
|
|
38
|
+
* `<root>/<rel>` and the two are different files (#3020 review H1).
|
|
39
|
+
*/
|
|
40
|
+
export declare function storiesRelativePath(wirePath: string): string | null;
|
|
41
|
+
export declare function storyRefWithin(base: string, absolutePath: string, rules: PathRules): string | null;
|
|
1
42
|
/** Lowercase-hyphen slug, capped, leading/trailing hyphens stripped; falls back
|
|
2
43
|
* to `fallback` for empty/undefined/non-ASCII input. */
|
|
3
44
|
export declare function slugify(title: string | undefined, fallback?: string): string;
|
package/dist/core/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAInE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,GAAG,IAAI,CAMlG;AAKD;yDACyD;AACzD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,SAAsB,GAAG,MAAM,CAEzF;AAED;;0CAE0C;AAC1C,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,CAEhF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUlE"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_plugin = require("./plugin-
|
|
2
|
+
const require_plugin = require("./plugin-C5JC2lNR.cjs");
|
|
3
3
|
exports.TOOL_DEFINITION = require_plugin.TOOL_DEFINITION;
|
|
4
4
|
exports.TOOL_NAME = require_plugin.TOOL_NAME;
|
|
5
5
|
exports.executeMulmoScript = require_plugin.executeMulmoScript;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as pluginCore, c as normalizeStoryPath,
|
|
1
|
+
import { a as pluginCore, c as normalizeStoryPath, d as storyFilePath, h as TOOL_NAME, i as executeUpdateScript, l as slugify, m as TOOL_DEFINITION, n as executeMulmoScriptSave, o as validateUpdateBeatBody, r as executeUpdateBeat, s as validateUpdateScriptBody, t as executeMulmoScript } from "./plugin-Jo8iGv4K.js";
|
|
2
2
|
export { TOOL_DEFINITION, TOOL_NAME, executeMulmoScript, executeMulmoScriptSave, executeUpdateBeat, executeUpdateScript, normalizeStoryPath, pluginCore, slugify, storyFilePath, validateUpdateBeatBody, validateUpdateScriptBody };
|
package/dist/lang/de.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/lang/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"de.d.ts","sourceRoot":"","sources":["../../src/lang/de.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/en.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/lang/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/es.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/lang/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"es.d.ts","sourceRoot":"","sources":["../../src/lang/es.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/fr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/lang/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"fr.d.ts","sourceRoot":"","sources":["../../src/lang/fr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/ja.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ja.d.ts","sourceRoot":"","sources":["../../src/lang/ja.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ja.d.ts","sourceRoot":"","sources":["../../src/lang/ja.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/ko.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ko.d.ts","sourceRoot":"","sources":["../../src/lang/ko.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"ko.d.ts","sourceRoot":"","sources":["../../src/lang/ko.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
package/dist/lang/messages.d.ts
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* `common.cancel`); interpolated / pluralized keys become functions. */
|
|
4
4
|
export interface Messages {
|
|
5
5
|
beatCount(count: number): string;
|
|
6
|
+
/** Tab: edit every beat in place. */
|
|
7
|
+
editTab: string;
|
|
8
|
+
/** Tab: the per-beat list, where audio / image / movie generation lives. */
|
|
9
|
+
mediaTab: string;
|
|
6
10
|
movie: string;
|
|
7
11
|
generating: string;
|
|
8
12
|
rendering: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/lang/messages.ts"],"names":[],"mappings":"AAAA;;yEAEyE;AACzE,MAAM,WAAW,QAAQ;IACvB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM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AAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5C,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
package/dist/lang/ptBR.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ptBR.d.ts","sourceRoot":"","sources":["../../src/lang/ptBR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"ptBR.d.ts","sourceRoot":"","sources":["../../src/lang/ptBR.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,IAAI,EAAE,QAiCX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/dist/lang/zh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../src/lang/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"zh.d.ts","sourceRoot":"","sources":["../../src/lang/zh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,QAAA,MAAM,EAAE,EAAE,QAiCT,CAAC;AAEF,eAAe,EAAE,CAAC"}
|
|
@@ -151,6 +151,44 @@ function errorMessage(err, fallback) {
|
|
|
151
151
|
}
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/core/paths.ts
|
|
154
|
+
/**
|
|
155
|
+
* The wire ref for an absolute path inside a stories root, or `null` when it
|
|
156
|
+
* is not inside one.
|
|
157
|
+
*
|
|
158
|
+
* Pure, and taking its path rules as an argument, because the case that
|
|
159
|
+
* matters is unreachable on the machine this is written on. `path.relative`
|
|
160
|
+
* says "not under the base" in TWO ways and only one looks like an escape:
|
|
161
|
+
* `../…` is the familiar one, and across Windows DRIVES there is no relative
|
|
162
|
+
* path at all, so `relative("C:\\base", "D:\\x")` answers `"D:\\x"` —
|
|
163
|
+
* absolute, with no `..` for the escape check to catch. That minted
|
|
164
|
+
* `stories/D:/anything`, a wire ref that reads back as a DIFFERENT file, which
|
|
165
|
+
* is the substitution this function exists to refuse. Only Windows CI caught
|
|
166
|
+
* it; here there is one root and always a relative route (#3015 post-merge).
|
|
167
|
+
*/
|
|
168
|
+
/**
|
|
169
|
+
* The path INSIDE a stories root that a wire path names, or null when it does
|
|
170
|
+
* not name one.
|
|
171
|
+
*
|
|
172
|
+
* The default root's FileOps is rooted one level up, at `<workspace>/artifacts`,
|
|
173
|
+
* so there the wire path and the FileOps path are the SAME string and nothing
|
|
174
|
+
* is stripped. A named root's FileOps is rooted at the stories directory
|
|
175
|
+
* itself — which is what a host naturally writes, having registered exactly
|
|
176
|
+
* that directory in `extraRoots` — so the `stories/` prefix has to come off,
|
|
177
|
+
* or the write lands in `<root>/stories/<rel>` while the read looks in
|
|
178
|
+
* `<root>/<rel>` and the two are different files (#3020 review H1).
|
|
179
|
+
*/
|
|
180
|
+
function storiesRelativePath(wirePath) {
|
|
181
|
+
const normalized = normalizeStoryPath(wirePath);
|
|
182
|
+
if (normalized === null) return null;
|
|
183
|
+
return normalized.slice(`${STORIES_DIR}/`.length);
|
|
184
|
+
}
|
|
185
|
+
function storyRefWithin(base, absolutePath, rules) {
|
|
186
|
+
const relative = rules.relative(base, absolutePath);
|
|
187
|
+
if (rules.isAbsolute(relative)) return null;
|
|
188
|
+
const rel = relative.split(rules.sep).join("/");
|
|
189
|
+
if (rel === ".." || rel.startsWith("../")) return null;
|
|
190
|
+
return rel ? `${STORIES_DIR}/${rel}` : STORIES_DIR;
|
|
191
|
+
}
|
|
154
192
|
var STORIES_DIR = "stories";
|
|
155
193
|
var STORY_FALLBACK_SLUG = "story";
|
|
156
194
|
/** Lowercase-hyphen slug, capped, leading/trailing hyphens stripped; falls back
|
|
@@ -496,12 +534,24 @@ Object.defineProperty(exports, "slugify", {
|
|
|
496
534
|
return slugify;
|
|
497
535
|
}
|
|
498
536
|
});
|
|
537
|
+
Object.defineProperty(exports, "storiesRelativePath", {
|
|
538
|
+
enumerable: true,
|
|
539
|
+
get: function() {
|
|
540
|
+
return storiesRelativePath;
|
|
541
|
+
}
|
|
542
|
+
});
|
|
499
543
|
Object.defineProperty(exports, "storyFilePath", {
|
|
500
544
|
enumerable: true,
|
|
501
545
|
get: function() {
|
|
502
546
|
return storyFilePath;
|
|
503
547
|
}
|
|
504
548
|
});
|
|
549
|
+
Object.defineProperty(exports, "storyRefWithin", {
|
|
550
|
+
enumerable: true,
|
|
551
|
+
get: function() {
|
|
552
|
+
return storyRefWithin;
|
|
553
|
+
}
|
|
554
|
+
});
|
|
505
555
|
Object.defineProperty(exports, "validateUpdateBeatBody", {
|
|
506
556
|
enumerable: true,
|
|
507
557
|
get: function() {
|
|
@@ -515,4 +565,4 @@ Object.defineProperty(exports, "validateUpdateScriptBody", {
|
|
|
515
565
|
}
|
|
516
566
|
});
|
|
517
567
|
|
|
518
|
-
//# sourceMappingURL=plugin-
|
|
568
|
+
//# sourceMappingURL=plugin-C5JC2lNR.cjs.map
|