@mulmoclaude/mulmoscript-plugin 0.1.0 → 0.2.1

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.
@@ -0,0 +1,13 @@
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
+ //#endregion
6
+ Object.defineProperty(exports, "GENERATION_EVENT", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return GENERATION_EVENT;
10
+ }
11
+ });
12
+
13
+ //# sourceMappingURL=contract-DxKVCRQk.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-DxKVCRQk.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 /** 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\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;\n}\n\nexport type MulmoScriptDispatchArgs =\n | ({ kind: \"save\" } & { filePath?: string; script?: unknown; filename?: string })\n | { kind: \"updateBeat\"; filePath: string; beatIndex: number; beat: unknown }\n | { kind: \"updateScript\"; filePath: string; script: unknown }\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\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/** Maps a dispatch `kind` to its success payload so the View's transport\n * can call `dispatch` without casts at every site. */\nexport interface MulmoScriptDispatchResult {\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"],"mappings":";;;AA+BA,IAAa,mBAAmB"}
@@ -0,0 +1,8 @@
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
+ //#endregion
6
+ export { GENERATION_EVENT as t };
7
+
8
+ //# sourceMappingURL=contract-vY0niHkh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-vY0niHkh.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 /** 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\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;\n}\n\nexport type MulmoScriptDispatchArgs =\n | ({ kind: \"save\" } & { filePath?: string; script?: unknown; filename?: string })\n | { kind: \"updateBeat\"; filePath: string; beatIndex: number; beat: unknown }\n | { kind: \"updateScript\"; filePath: string; script: unknown }\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\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/** Maps a dispatch `kind` to its success payload so the View's transport\n * can call `dispatch` without casts at every site. */\nexport interface MulmoScriptDispatchResult {\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"],"mappings":";;;AA+BA,IAAa,mBAAmB"}
@@ -10,12 +10,17 @@ export declare function slugify(title: string | undefined, fallback?: string): s
10
10
  export declare function storyFilePath(slugSource: string, now?: Date): string;
11
11
  /**
12
12
  * Normalize a caller-supplied wire path to the canonical
13
- * `stories/<rel>` form, or null when it can't be trusted. Accepts both the
14
- * canonical `stories/foo.json` convention and bare `foo.json` (the host route
15
- * historically allowed either). Rejects absolute paths, backslashes, and any
16
- * empty / `.` / `..` segment — the lexical guard before every
17
- * `files.artifacts` read/write (FileOps re-checks containment as
18
- * defence-in-depth).
13
+ * `stories/<rel>` form, or null when it can't be trusted. Accepts the
14
+ * canonical `stories/foo.json` convention, bare `foo.json` (the host route
15
+ * historically allowed either), and the workspace-relative spelling
16
+ * `artifacts/stories/foo.json` — the tool description called `filePath`
17
+ * "workspace-relative" for a long time, so agents legitimately send it.
18
+ * A leading `artifacts` segment is dropped only when `stories` follows;
19
+ * a bare `artifacts/foo.json` keeps its historical meaning (a file named
20
+ * `artifacts/foo.json` under the stories dir). Rejects absolute paths,
21
+ * backslashes, and any empty / `.` / `..` segment — the lexical guard
22
+ * before every `files.artifacts` read/write (FileOps re-checks
23
+ * containment as defence-in-depth).
19
24
  */
20
25
  export declare function normalizeStoryPath(filePath: string): string | null;
21
26
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAaA;;;;sEAIsE;AACtE,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,SAAU,GAAG,MAAM,CAW7E;AAED;;0CAE0C;AAC1C,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,MAAM,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASlE"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/core/paths.ts"],"names":[],"mappings":"AAcA;;;;sEAIsE;AACtE,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,SAAU,GAAG,MAAM,CAW7E;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-CtKUt8DX.cjs");
2
+ const require_plugin = require("./plugin-Bi986Wga.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, d as TOOL_DEFINITION, f as TOOL_NAME, i as executeUpdateScript, l as slugify, n as executeMulmoScriptSave, o as validateUpdateBeatBody, r as executeUpdateBeat, s as validateUpdateScriptBody, t as executeMulmoScript, u as storyFilePath } from "./plugin-W1ppnyhR.js";
1
+ import { a as pluginCore, c as normalizeStoryPath, d as TOOL_DEFINITION, f as TOOL_NAME, i as executeUpdateScript, l as slugify, n as executeMulmoScriptSave, o as validateUpdateBeatBody, r as executeUpdateBeat, s as validateUpdateScriptBody, t as executeMulmoScript, u as storyFilePath } from "./plugin-BQyzxkui.js";
2
2
  export { TOOL_DEFINITION, TOOL_NAME, executeMulmoScript, executeMulmoScriptSave, executeUpdateBeat, executeUpdateScript, normalizeStoryPath, pluginCore, slugify, storyFilePath, validateUpdateBeatBody, validateUpdateScriptBody };
@@ -9,7 +9,7 @@ var TOOL_DEFINITION = {
9
9
  Two modes — provide EXACTLY ONE of \`script\` or \`filePath\`:
10
10
 
11
11
  1. **Create new** — pass \`script\` (full MulmoScript JSON). Server saves it to disk and presents it.
12
- 2. **Re-display existing** — pass \`filePath\` (workspace-relative path returned by a previous call, e.g. "stories/my-story-1700000000000.json"). Much cheaper than re-sending the full script. Use whenever the user wants to revisit a presentation that was already created in this workspace.
12
+ 2. **Re-display existing** — pass \`filePath\` (the \`filePath\` returned by a previous call, e.g. "stories/my-story-1700000000000.json"; it is resolved against the workspace's \`artifacts/\` directory, NOT the workspace root). Much cheaper than re-sending the full script. Use whenever the user wants to revisit a presentation that was already created in this workspace.
13
13
 
14
14
  Optional \`autoGenerateMovie: true\` kicks off movie generation in the background, so the final video is ready by the time the user opens the canvas. Movie generation is expensive (multiple image + audio API calls + video encoding) — only set this when the user has explicitly asked for the movie. Default \`false\`.
15
15
 
@@ -100,7 +100,7 @@ IMPORTANT: "imagePrompt" and "moviePrompt" are plain string fields on the beat,
100
100
  },
101
101
  filePath: {
102
102
  type: "string",
103
- description: "Workspace-relative path to an EXISTING MulmoScript JSON file (e.g. 'stories/my-story-1700000000000.json'). Use this to re-display a script previously saved in this workspace, instead of resending the full JSON. Do NOT pass alongside `script`."
103
+ description: "Path of an EXISTING MulmoScript JSON file, as returned by a previous call (e.g. 'stories/my-story-1700000000000.json'). Resolved against the workspace's `artifacts/` directory, not the workspace root ('artifacts/stories/…' is also accepted). Use this to re-display a script previously saved in this workspace, instead of resending the full JSON. Do NOT pass alongside `script`."
104
104
  },
105
105
  autoGenerateMovie: {
106
106
  type: "boolean",
@@ -113,6 +113,7 @@ IMPORTANT: "imagePrompt" and "moviePrompt" are plain string fields on the beat,
113
113
  //#endregion
114
114
  //#region src/core/paths.ts
115
115
  var STORIES_DIR = "stories";
116
+ var ARTIFACTS_DIR = "artifacts";
116
117
  var MAX_SLUG_LEN = 120;
117
118
  /** Lowercase-hyphen slug, capped at MAX_SLUG_LEN, with leading/trailing
118
119
  * hyphens stripped. Falls back to `fallback` for empty/undefined/non-ASCII
@@ -136,19 +137,25 @@ function storyFilePath(slugSource, now = /* @__PURE__ */ new Date()) {
136
137
  }
137
138
  /**
138
139
  * Normalize a caller-supplied wire path to the canonical
139
- * `stories/<rel>` form, or null when it can't be trusted. Accepts both the
140
- * canonical `stories/foo.json` convention and bare `foo.json` (the host route
141
- * historically allowed either). Rejects absolute paths, backslashes, and any
142
- * empty / `.` / `..` segment — the lexical guard before every
143
- * `files.artifacts` read/write (FileOps re-checks containment as
144
- * defence-in-depth).
140
+ * `stories/<rel>` form, or null when it can't be trusted. Accepts the
141
+ * canonical `stories/foo.json` convention, bare `foo.json` (the host route
142
+ * historically allowed either), and the workspace-relative spelling
143
+ * `artifacts/stories/foo.json` — the tool description called `filePath`
144
+ * "workspace-relative" for a long time, so agents legitimately send it.
145
+ * A leading `artifacts` segment is dropped only when `stories` follows;
146
+ * a bare `artifacts/foo.json` keeps its historical meaning (a file named
147
+ * `artifacts/foo.json` under the stories dir). Rejects absolute paths,
148
+ * backslashes, and any empty / `.` / `..` segment — the lexical guard
149
+ * before every `files.artifacts` read/write (FileOps re-checks
150
+ * containment as defence-in-depth).
145
151
  */
146
152
  function normalizeStoryPath(filePath) {
147
153
  if (filePath.length === 0 || filePath.includes("\\")) return null;
148
154
  if (filePath.startsWith("/") || /^[A-Za-z]:/.test(filePath)) return null;
149
155
  const segments = filePath.split("/");
150
156
  if (segments.some((seg) => seg === "" || seg === "." || seg === "..")) return null;
151
- const rest = segments[0] === STORIES_DIR ? segments.slice(1) : segments;
157
+ const trimmed = segments[0] === ARTIFACTS_DIR && segments[1] === STORIES_DIR ? segments.slice(1) : segments;
158
+ const rest = trimmed[0] === STORIES_DIR ? trimmed.slice(1) : trimmed;
152
159
  if (rest.length === 0) return null;
153
160
  return [STORIES_DIR, ...rest].join("/");
154
161
  }
@@ -377,4 +384,4 @@ var pluginCore = {
377
384
  //#endregion
378
385
  export { pluginCore as a, normalizeStoryPath as c, TOOL_DEFINITION as d, TOOL_NAME as f, executeUpdateScript as i, slugify as l, executeMulmoScriptSave as n, validateUpdateBeatBody as o, executeUpdateBeat as r, validateUpdateScriptBody as s, executeMulmoScript as t, storyFilePath as u };
379
386
 
380
- //# sourceMappingURL=plugin-W1ppnyhR.js.map
387
+ //# sourceMappingURL=plugin-BQyzxkui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-BQyzxkui.js","names":[],"sources":["../src/core/definition.ts","../src/core/paths.ts","../src/core/validate.ts","../src/core/plugin.ts"],"sourcesContent":["import type { ToolDefinition } from \"gui-chat-protocol\";\n\nexport const TOOL_NAME = \"presentMulmoScript\";\n\n// Single source of truth for the presentMulmoScript tool schema, shared by\n// MulmoClaude (host built-in shim re-exports this) and MulmoTerminal.\n// (Extracted byte-identical from the host definition; evolves here with the\n// package version.)\nexport const TOOL_DEFINITION: ToolDefinition = {\n type: \"function\",\n name: TOOL_NAME,\n description: `Save and present a MulmoScript story or presentation as a visual storyboard in the canvas.\n\nTwo modes — provide EXACTLY ONE of \\`script\\` or \\`filePath\\`:\n\n1. **Create new** — pass \\`script\\` (full MulmoScript JSON). Server saves it to disk and presents it.\n2. **Re-display existing** — pass \\`filePath\\` (the \\`filePath\\` returned by a previous call, e.g. \"stories/my-story-1700000000000.json\"; it is resolved against the workspace's \\`artifacts/\\` directory, NOT the workspace root). Much cheaper than re-sending the full script. Use whenever the user wants to revisit a presentation that was already created in this workspace.\n\nOptional \\`autoGenerateMovie: true\\` kicks off movie generation in the background, so the final video is ready by the time the user opens the canvas. Movie generation is expensive (multiple image + audio API calls + video encoding) — only set this when the user has explicitly asked for the movie. Default \\`false\\`.\n\nProvider rules for new scripts:\n- \\`speechParams.speakers.<name>.provider\\`: \\`\"gemini\"\\` — pairs with Gemini voices like \\`\"Kore\"\\`, \\`\"Aoede\"\\`, \\`\"Puck\"\\`. Do NOT use \\`\"google\"\\` here — that routes to Google Cloud TTS, where Gemini-class voices fail with \"This voice requires a model name to be specified.\" unless an explicit \\`model\\` is set.\n- \\`imageParams.provider\\`: \\`\"google\"\\`\n- \\`movieParams.provider\\`: \\`\"google\"\\`\n- Do NOT add a top-level \\`provider\\` field to \\`speechParams\\` — provider belongs per-speaker only.\n\nRequired structure:\n\n{\n \"$mulmocast\": { \"version\": \"1.1\" },\n \"title\": \"The Life of a Star\",\n \"description\": \"A short educational explainer about stellar evolution\",\n \"lang\": \"en\",\n \"speechParams\": {\n \"speakers\": {\n \"Presenter\": {\n \"provider\": \"gemini\",\n \"voiceId\": \"Kore\",\n \"displayName\": { \"en\": \"Presenter\" }\n }\n }\n },\n \"imageParams\": { \"provider\": \"google\", \"model\": \"gemini-3.1-flash-image-preview\" },\n \"movieParams\": { \"provider\": \"google\", \"model\": \"veo-3.1-generate\" },\n \"beats\": [\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Narration spoken aloud for this beat.\",\n \"imagePrompt\": \"Detailed description — AI generates the image\"\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Bullet point beat.\",\n \"image\": { \"type\": \"textSlide\", \"slide\": { \"title\": \"Slide Title\", \"bullets\": [\"Point one\", \"Point two\"] } }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Markdown beat.\",\n \"image\": { \"type\": \"markdown\", \"markdown\": \"## Heading\\\\n\\\\nBody text here.\" }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Chart beat — use for data, comparisons, trends.\",\n \"image\": { \"type\": \"chart\", \"title\": \"Chart Title\", \"chartData\": { \"type\": \"bar\", \"data\": { \"labels\": [\"A\", \"B\", \"C\"], \"datasets\": [{ \"label\": \"Series\", \"data\": [10, 20, 30] }] } } }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Diagram beat — use for flows, architectures, relationships.\",\n \"image\": { \"type\": \"mermaid\", \"title\": \"Diagram Title\", \"code\": { \"kind\": \"text\", \"text\": \"graph TD\\\\n A[Start] --> B[Process] --> C[End]\" } }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Rich interactive beat — use for custom layouts, animations, or anything that benefits from HTML/CSS.\",\n \"image\": { \"type\": \"html_tailwind\", \"html\": \"<div class=\\\\\"flex items-center justify-center h-full text-4xl font-bold text-blue-600\\\\\">Hello World</div>\" }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"AI video beat.\",\n \"moviePrompt\": \"Detailed description — AI generates the video clip\"\n }\n ]\n}\n\nBeat visual options (choose one per beat):\n- \"imagePrompt\": \"...\" → top-level string field — AI generates an image from the prompt\n- \"moviePrompt\": \"...\" → top-level string field — AI generates a video clip from the prompt\n- \"image\": { \"type\": \"textSlide\", \"slide\": { \"title\", \"subtitle\"?, \"bullets\"? } }\n- \"image\": { \"type\": \"markdown\", \"markdown\": \"...\" }\n- \"image\": { \"type\": \"chart\", \"title\": \"...\", \"chartData\": { \"type\": \"bar\"|\"line\"|\"pie\"|..., \"data\": { \"labels\": [...], \"datasets\": [...] } } } ← PREFER for data/numbers/comparisons. chartData is a full Chart.js config: labels/datasets go under \"data\", not at the top level.\n- \"image\": { \"type\": \"mermaid\", \"title\": \"...\", \"code\": { \"kind\": \"text\", \"text\": \"...\" } } ← PREFER for flows/diagrams/relationships\n- \"image\": { \"type\": \"html_tailwind\", \"html\": \"...\", \"script\"?: \"...\" } ← PREFER for rich layouts, animations, custom visuals\n\nIMPORTANT: \"imagePrompt\" and \"moviePrompt\" are plain string fields on the beat, NOT nested under \"image\".`,\n parameters: {\n type: \"object\",\n properties: {\n script: {\n type: \"object\",\n description:\n \"Complete MulmoScript JSON for a NEW presentation. Must include $mulmocast, speechParams, imageParams, movieParams, and beats array. Always populate the top-level 'description' field with a concise 1–2 sentence summary of the presentation. Do NOT pass alongside `filePath`.\",\n additionalProperties: true,\n },\n filename: {\n type: \"string\",\n description:\n \"Optional filename without extension. Defaults to a slug of the script title. Only meaningful with `script`; ignored when `filePath` is given.\",\n },\n filePath: {\n type: \"string\",\n description:\n \"Path of an EXISTING MulmoScript JSON file, as returned by a previous call (e.g. 'stories/my-story-1700000000000.json'). Resolved against the workspace's `artifacts/` directory, not the workspace root ('artifacts/stories/…' is also accepted). Use this to re-display a script previously saved in this workspace, instead of resending the full JSON. Do NOT pass alongside `script`.\",\n },\n autoGenerateMovie: {\n type: \"boolean\",\n description:\n \"When true, the server starts movie generation in the background after save/load. The user does NOT need to open the canvas — progress streams via the existing session channel. Default false. Only set true when the user has explicitly asked for the movie; generation is expensive.\",\n },\n },\n required: [],\n },\n};\n","// Pure path helpers for MulmoScript story artifacts. No Node built-ins so the\n// package stays bundler-agnostic (chart/html precedent); all filesystem access\n// happens through the host's generic `files.artifacts` FileOps.\n//\n// Path model: the stories directory lives at `<workspace>/artifacts/stories`\n// and the FileOps scope root is `<workspace>/artifacts`, so the\n// FileOps-relative path and the historical `stories/<name>.json` wire form\n// (which every mulmoScript endpoint keys on) are the SAME string. Helpers\n// below therefore return one path used for both purposes.\n\nconst STORIES_DIR = \"stories\";\nconst ARTIFACTS_DIR = \"artifacts\";\nconst MAX_SLUG_LEN = 120;\n\n/** Lowercase-hyphen slug, capped at MAX_SLUG_LEN, with leading/trailing\n * hyphens stripped. Falls back to `fallback` for empty/undefined/non-ASCII\n * input. Mirrors html-plugin's in-package slugify — deliberately simpler\n * than the host's hash-fallback variant; the timestamp suffix appended by\n * `storyFilePath` keeps these throwaway filenames collision-free. */\nexport function slugify(title: string | undefined, fallback = \"story\"): string {\n if (!title) return fallback;\n const collapsed = title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .slice(0, MAX_SLUG_LEN);\n let start = 0;\n let end = collapsed.length;\n while (start < end && collapsed[start] === \"-\") start += 1;\n while (end > start && collapsed[end - 1] === \"-\") end -= 1;\n return collapsed.slice(start, end) || fallback;\n}\n\n/** Build a fresh, collision-safe story path for a new script —\n * `stories/<slug>-<epoch-ms>.json`, valid as both the FileOps-relative\n * write path and the wire `filePath`. */\nexport function storyFilePath(slugSource: string, now: Date = new Date()): string {\n return `${STORIES_DIR}/${slugify(slugSource)}-${now.getTime()}.json`;\n}\n\n/**\n * Normalize a caller-supplied wire path to the canonical\n * `stories/<rel>` form, or null when it can't be trusted. Accepts the\n * canonical `stories/foo.json` convention, bare `foo.json` (the host route\n * historically allowed either), and the workspace-relative spelling\n * `artifacts/stories/foo.json` — the tool description called `filePath`\n * \"workspace-relative\" for a long time, so agents legitimately send it.\n * A leading `artifacts` segment is dropped only when `stories` follows;\n * a bare `artifacts/foo.json` keeps its historical meaning (a file named\n * `artifacts/foo.json` under the stories dir). Rejects absolute paths,\n * backslashes, and any empty / `.` / `..` segment — the lexical guard\n * before every `files.artifacts` read/write (FileOps re-checks\n * containment as defence-in-depth).\n */\nexport function normalizeStoryPath(filePath: string): string | null {\n if (filePath.length === 0 || filePath.includes(\"\\\\\")) return null;\n // Absolute POSIX path or Windows drive prefix.\n if (filePath.startsWith(\"/\") || /^[A-Za-z]:/.test(filePath)) return null;\n const segments = filePath.split(\"/\");\n if (segments.some((seg) => seg === \"\" || seg === \".\" || seg === \"..\")) return null;\n const trimmed = segments[0] === ARTIFACTS_DIR && segments[1] === STORIES_DIR ? segments.slice(1) : segments;\n const rest = trimmed[0] === STORIES_DIR ? trimmed.slice(1) : trimmed;\n if (rest.length === 0) return null;\n return [STORIES_DIR, ...rest].join(\"/\");\n}\n","// Body validators for the mulmoScript update endpoints, moved verbatim from\n// the host's `server/api/routes/mulmoScriptValidate.ts` so MulmoClaude and\n// MulmoTerminal share one definition of a \"valid script\" / \"valid beat\".\n//\n// The `@mulmocast/types` package exports zod schemas that mirror the\n// canonical MulmoScript / MulmoBeat shapes. The same schemas back client-side\n// edit-time validation in the presentMulmoScript View.\n\nimport { mulmoBeatSchema, mulmoScriptSchema } from \"@mulmocast/types\";\n\nexport type ValidationResult<T> = { ok: true; value: T } | { ok: false; error: string };\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction formatZodIssues(\n // Zod's `$ZodIssue.path` is `PropertyKey[]` (includes `symbol`).\n // Accept the wider type so callers can pass `safeParse().error.issues`\n // directly; stringify any non-string/number segments at format time.\n issues: readonly { message: string; path: readonly PropertyKey[] }[],\n): string {\n if (issues.length === 0) return \"invalid shape\";\n const head = issues\n .slice(0, 3)\n .map((i) => {\n const pathStr = i.path.length > 0 ? i.path.map((seg) => String(seg)).join(\".\") : \"<root>\";\n return `${pathStr}: ${i.message}`;\n })\n .join(\"; \");\n return issues.length > 3 ? `${head} (+${issues.length - 3} more)` : head;\n}\n\n/**\n * Validate the `update-script` request body. Returns the parsed,\n * schema-conformant script on success, or a human-readable error\n * suitable for sending back as a 400 response.\n */\nexport function validateUpdateScriptBody(body: unknown): ValidationResult<{\n filePath: string;\n script: unknown;\n}> {\n if (!isRecord(body)) {\n return { ok: false, error: \"body must be an object\" };\n }\n if (typeof body.filePath !== \"string\" || body.filePath === \"\") {\n return { ok: false, error: \"filePath must be a non-empty string\" };\n }\n if (body.script === undefined) {\n return { ok: false, error: \"script is required\" };\n }\n const parsed = mulmoScriptSchema.safeParse(body.script);\n if (!parsed.success) {\n return {\n ok: false,\n error: `invalid script: ${formatZodIssues(parsed.error.issues)}`,\n };\n }\n return {\n ok: true,\n value: { filePath: body.filePath as string, script: parsed.data },\n };\n}\n\n/**\n * Validate the `update-beat` request body. `beatIndex` is allowed\n * to be any non-negative integer; the handler still bounds-checks\n * against the actual script length after reading the file.\n */\nexport function validateUpdateBeatBody(body: unknown): ValidationResult<{\n filePath: string;\n beatIndex: number;\n beat: unknown;\n}> {\n if (!isRecord(body)) {\n return { ok: false, error: \"body must be an object\" };\n }\n if (typeof body.filePath !== \"string\" || body.filePath === \"\") {\n return { ok: false, error: \"filePath must be a non-empty string\" };\n }\n if (typeof body.beatIndex !== \"number\" || !Number.isInteger(body.beatIndex) || body.beatIndex < 0) {\n return { ok: false, error: \"beatIndex must be a non-negative integer\" };\n }\n if (body.beat === undefined) {\n return { ok: false, error: \"beat is required\" };\n }\n const parsed = mulmoBeatSchema.safeParse(body.beat);\n if (!parsed.success) {\n return {\n ok: false,\n error: `invalid beat: ${formatZodIssues(parsed.error.issues)}`,\n };\n }\n return {\n ok: true,\n value: {\n filePath: body.filePath as string,\n beatIndex: body.beatIndex as number,\n beat: parsed.data,\n },\n };\n}\n","import type { ToolPluginCore, ToolResult } from \"gui-chat-protocol\";\nimport { mulmoScriptSchema } from \"@mulmocast/types\";\nimport { TOOL_DEFINITION } from \"./definition\";\nimport { normalizeStoryPath, storyFilePath } from \"./paths\";\nimport { validateUpdateBeatBody, validateUpdateScriptBody } from \"./validate\";\nimport type { MulmoScriptData, MulmoScriptExecuteContext, SaveMulmoScriptArgs } from \"./types\";\n\n/** Failure half of every outcome below. `code` preserves the hosts'\n * HTTP contract (bad_request → 400, not_found → 404) without the package\n * knowing anything about HTTP. */\nexport interface MulmoScriptFailure {\n ok: false;\n code: \"bad_request\" | \"not_found\";\n error: string;\n}\n\nexport type SaveMulmoScriptOutcome = ({ ok: true; message: string } & MulmoScriptData) | MulmoScriptFailure;\n\nexport type UpdateMulmoScriptOutcome = { ok: true } | MulmoScriptFailure;\n\nfunction badRequest(error: string): MulmoScriptFailure {\n return { ok: false, code: \"bad_request\", error };\n}\n\nfunction notFound(error: string): MulmoScriptFailure {\n return { ok: false, code: \"not_found\", error };\n}\n\nfunction errorText(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\nfunction stringifyScript(script: unknown): string {\n // 2-space indent matches the hosts' writeJsonAtomic convention so a\n // package-written script diffs cleanly against host-written ones.\n return JSON.stringify(script, null, 2);\n}\n\n/** Persist a new, schema-validated script under a fresh `stories/…` path. */\nasync function saveNewScript(context: MulmoScriptExecuteContext, script: unknown, filename: string | undefined, now: Date): Promise<SaveMulmoScriptOutcome> {\n const validation = mulmoScriptSchema.safeParse(script);\n if (!validation.success) {\n return badRequest(\"script is not a valid MulmoScript\");\n }\n const validatedScript = validation.data;\n // slugify drops `/`, `\\`, and `..`, so a hostile `filename` like\n // \"../../etc/passwd\" can never escape the stories dir — defense in\n // depth on top of FileOps' own containment check.\n const slugSource = filename ? filename.replace(/\\.json$/i, \"\") : validatedScript.title || \"untitled\";\n const filePath = storyFilePath(slugSource, now);\n await context.files.artifacts.write(filePath, stringifyScript(validatedScript));\n return { ok: true, script: validatedScript, filePath, message: `Saved MulmoScript to ${filePath}` };\n}\n\n/** Re-open an existing script: containment guard, existence, JSON parse,\n * schema validation — same acceptance rules as the save path so a script\n * this package saved can never be one it later refuses to load. */\nasync function loadExistingScript(context: MulmoScriptExecuteContext, filePath: string): Promise<SaveMulmoScriptOutcome> {\n if (!filePath.toLowerCase().endsWith(\".json\")) {\n return badRequest(\"filePath must point to a .json file\");\n }\n const storyPath = normalizeStoryPath(filePath);\n if (!storyPath) {\n return badRequest(\"Invalid filePath\");\n }\n if (!(await context.files.artifacts.exists(storyPath))) {\n return notFound(`File not found: ${filePath}`);\n }\n const raw = await context.files.artifacts.read(storyPath);\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err) {\n return badRequest(`Invalid JSON: ${errorText(err)}`);\n }\n const validation = mulmoScriptSchema.safeParse(parsed);\n if (!validation.success) {\n return badRequest(\"File is not a valid MulmoScript\");\n }\n return { ok: true, script: validation.data, filePath: storyPath, message: `Loaded MulmoScript from ${storyPath}` };\n}\n\n/**\n * Unified save-or-reopen for the presentMulmoScript tool call. `script`\n * (create new) and `filePath` (existing) are mutually exclusive. Never\n * throws on bad input — validation failures come back as discriminated\n * failures so host routes stay thin adapters. `autoGenerateMovie` is NOT\n * handled here: movie generation needs host backends (mulmocast/ffmpeg),\n * so hosts that support it trigger it from the returned `filePath`.\n */\nexport async function executeMulmoScriptSave(\n context: MulmoScriptExecuteContext,\n args: SaveMulmoScriptArgs,\n now: Date = new Date(),\n): Promise<SaveMulmoScriptOutcome> {\n const { script, filename, filePath } = args ?? {};\n const hasScript = script !== undefined && script !== null;\n const hasFilePath = typeof filePath === \"string\" && filePath !== \"\";\n if (hasScript === hasFilePath) {\n return badRequest(\n hasScript ? \"Provide either `script` or `filePath`, not both.\" : \"Provide either `script` (new presentation) or `filePath` (existing presentation).\",\n );\n }\n return hasFilePath\n ? loadExistingScript(context, filePath as string)\n : saveNewScript(context, script, typeof filename === \"string\" ? filename : undefined, now);\n}\n\n/** Resolve + guard a wire path for the update endpoints. */\nasync function resolveExistingStory(context: MulmoScriptExecuteContext, filePath: string): Promise<{ storyPath: string } | MulmoScriptFailure> {\n const storyPath = normalizeStoryPath(filePath);\n if (!storyPath) return badRequest(\"Invalid filePath\");\n if (!(await context.files.artifacts.exists(storyPath))) {\n return notFound(`File not found: ${filePath}`);\n }\n return { storyPath };\n}\n\n/** Overwrite one beat of an existing script (the View's per-beat source\n * editor). Validates the body shape + beat schema, bounds-checks the index\n * against the script on disk, and writes the whole file back. */\nexport async function executeUpdateBeat(context: MulmoScriptExecuteContext, body: unknown): Promise<UpdateMulmoScriptOutcome> {\n const validation = validateUpdateBeatBody(body);\n if (!validation.ok) return badRequest(validation.error);\n const { filePath, beatIndex, beat } = validation.value;\n\n const resolved = await resolveExistingStory(context, filePath);\n if (\"ok\" in resolved) return resolved;\n\n let script: { beats?: unknown[] };\n try {\n script = JSON.parse(await context.files.artifacts.read(resolved.storyPath));\n } catch (err) {\n return badRequest(`Invalid JSON: ${errorText(err)}`);\n }\n if (!Array.isArray(script.beats) || beatIndex >= script.beats.length) {\n return badRequest(\"Invalid beatIndex\");\n }\n script.beats[beatIndex] = beat;\n await context.files.artifacts.write(resolved.storyPath, stringifyScript(script));\n return { ok: true };\n}\n\n/** Overwrite the whole script (the View's full-source editor / deck-editor\n * auto-save). The body's `script` is schema-validated by\n * `validateUpdateScriptBody` before the write. */\nexport async function executeUpdateScript(context: MulmoScriptExecuteContext, body: unknown): Promise<UpdateMulmoScriptOutcome> {\n const validation = validateUpdateScriptBody(body);\n if (!validation.ok) return badRequest(validation.error);\n const { filePath, script } = validation.value;\n\n const resolved = await resolveExistingStory(context, filePath);\n if (\"ok\" in resolved) return resolved;\n\n await context.files.artifacts.write(resolved.storyPath, stringifyScript(script));\n return { ok: true };\n}\n\n/** ToolResult-shaped wrapper over `executeMulmoScriptSave` for runtime hosts\n * (e.g. MulmoTerminal's package loader), where the tool call resolves to a\n * ToolResult rather than an HTTP response. Failures are narrate-only\n * (message, no data) so the agent can self-correct. */\nexport async function executeMulmoScript(context: MulmoScriptExecuteContext, args: SaveMulmoScriptArgs): Promise<ToolResult<MulmoScriptData>> {\n const outcome = await executeMulmoScriptSave(context, args);\n if (!outcome.ok) {\n return {\n message: outcome.error,\n instructions: \"Acknowledge the error and retry with a valid `script` (new) or an existing `filePath`.\",\n };\n }\n // The tool schema advertises `autoGenerateMovie`, but movie generation\n // needs host backends (mulmocast/ffmpeg) this generic execute path\n // doesn't have — MulmoClaude honours the flag in its own save route.\n // Say so in the result rather than silently dropping the option, so the\n // agent doesn't tell the user a movie is on its way.\n const ignoredMovieNote = args.autoGenerateMovie === true ? \" (autoGenerateMovie is not supported by this host and was ignored)\" : \"\";\n return {\n message: `${outcome.message}${ignoredMovieNote}`,\n data: { script: outcome.script, filePath: outcome.filePath },\n instructions: \"Display the storyboard to the user.\",\n };\n}\n\n/** Non-Vue plugin core for runtime hosts that register the package directly.\n * MulmoClaude consumes only TOOL_DEFINITION + the execute functions in its\n * own routes, so it doesn't use this. */\nexport const pluginCore: ToolPluginCore<MulmoScriptData, MulmoScriptData, SaveMulmoScriptArgs> = {\n toolDefinition: TOOL_DEFINITION,\n execute: executeMulmoScript as unknown as ToolPluginCore<MulmoScriptData, MulmoScriptData, SaveMulmoScriptArgs>[\"execute\"],\n generatingMessage: \"Generating MulmoScript storyboard…\",\n isEnabled: () => true,\n};\n"],"mappings":";;AAEA,IAAa,YAAY;AAMzB,IAAa,kBAAkC;CAC7C,MAAM;CACN,MAAM;CACN,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFb,YAAY;EACV,MAAM;EACN,YAAY;GACV,QAAQ;IACN,MAAM;IACN,aACE;IACF,sBAAsB;GACxB;GACA,UAAU;IACR,MAAM;IACN,aACE;GACJ;GACA,UAAU;IACR,MAAM;IACN,aACE;GACJ;GACA,mBAAmB;IACjB,MAAM;IACN,aACE;GACJ;EACF;EACA,UAAU,CAAC;CACb;AACF;;;AC9GA,IAAM,cAAc;AACpB,IAAM,gBAAgB;AACtB,IAAM,eAAe;;;;;;AAOrB,SAAgB,QAAQ,OAA2B,WAAW,SAAiB;CAC7E,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,YAAY,MACf,YAAY,CAAC,CACb,QAAQ,eAAe,GAAG,CAAC,CAC3B,MAAM,GAAG,YAAY;CACxB,IAAI,QAA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Aa,OAAO,MAAM,QAC5D,OAAO,WAAW,mBAAmB;CAEvC,OAAO,MAAM,aAAa;CAC1B,MAAM,QAAQ,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB,MAAM,CAAC;CAC/E,OAAO,EAAE,IAAI,KAAK;AACpB;;;;AAKA,eAAsB,oBAAoB,SAAoC,MAAkD;CAC9H,MAAM,aAAa,yBAAyB,IAAI;CAChD,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,WAAW,KAAK;CACtD,MAAM,EAAE,UAAU,WAAW,WAAW;CAExC,MAAM,WAAW,MAAM,qBAAqB,SAAS,QAAQ;CAC7D,IAAI,QAAQ,UAAU,OAAO;CAE7B,MAAM,QAAQ,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB,MAAM,CAAC;CAC/E,OAAO,EAAE,IAAI,KAAK;AACpB;;;;;AAMA,eAAsB,mBAAmB,SAAoC,MAAiE;CAC5I,MAAM,UAAU,MAAM,uBAAuB,SAAS,IAAI;CAC1D,IAAI,CAAC,QAAQ,IACX,OAAO;EACL,SAAS,QAAQ;EACjB,cAAc;CAChB;CAOF,MAAM,mBAAmB,KAAK,sBAAsB,OAAO,uEAAuE;CAClI,OAAO;EACL,SAAS,GAAG,QAAQ,UAAU;EAC9B,MAAM;GAAE,QAAQ,QAAQ;GAAQ,UAAU,QAAQ;EAAS;EAC3D,cAAc;CAChB;AACF;;;;AAKA,IAAa,aAAoF;CAC/F,gBAAgB;CAChB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;AACnB"}
@@ -9,7 +9,7 @@ var TOOL_DEFINITION = {
9
9
  Two modes — provide EXACTLY ONE of \`script\` or \`filePath\`:
10
10
 
11
11
  1. **Create new** — pass \`script\` (full MulmoScript JSON). Server saves it to disk and presents it.
12
- 2. **Re-display existing** — pass \`filePath\` (workspace-relative path returned by a previous call, e.g. "stories/my-story-1700000000000.json"). Much cheaper than re-sending the full script. Use whenever the user wants to revisit a presentation that was already created in this workspace.
12
+ 2. **Re-display existing** — pass \`filePath\` (the \`filePath\` returned by a previous call, e.g. "stories/my-story-1700000000000.json"; it is resolved against the workspace's \`artifacts/\` directory, NOT the workspace root). Much cheaper than re-sending the full script. Use whenever the user wants to revisit a presentation that was already created in this workspace.
13
13
 
14
14
  Optional \`autoGenerateMovie: true\` kicks off movie generation in the background, so the final video is ready by the time the user opens the canvas. Movie generation is expensive (multiple image + audio API calls + video encoding) — only set this when the user has explicitly asked for the movie. Default \`false\`.
15
15
 
@@ -100,7 +100,7 @@ IMPORTANT: "imagePrompt" and "moviePrompt" are plain string fields on the beat,
100
100
  },
101
101
  filePath: {
102
102
  type: "string",
103
- description: "Workspace-relative path to an EXISTING MulmoScript JSON file (e.g. 'stories/my-story-1700000000000.json'). Use this to re-display a script previously saved in this workspace, instead of resending the full JSON. Do NOT pass alongside `script`."
103
+ description: "Path of an EXISTING MulmoScript JSON file, as returned by a previous call (e.g. 'stories/my-story-1700000000000.json'). Resolved against the workspace's `artifacts/` directory, not the workspace root ('artifacts/stories/…' is also accepted). Use this to re-display a script previously saved in this workspace, instead of resending the full JSON. Do NOT pass alongside `script`."
104
104
  },
105
105
  autoGenerateMovie: {
106
106
  type: "boolean",
@@ -113,6 +113,7 @@ IMPORTANT: "imagePrompt" and "moviePrompt" are plain string fields on the beat,
113
113
  //#endregion
114
114
  //#region src/core/paths.ts
115
115
  var STORIES_DIR = "stories";
116
+ var ARTIFACTS_DIR = "artifacts";
116
117
  var MAX_SLUG_LEN = 120;
117
118
  /** Lowercase-hyphen slug, capped at MAX_SLUG_LEN, with leading/trailing
118
119
  * hyphens stripped. Falls back to `fallback` for empty/undefined/non-ASCII
@@ -136,19 +137,25 @@ function storyFilePath(slugSource, now = /* @__PURE__ */ new Date()) {
136
137
  }
137
138
  /**
138
139
  * Normalize a caller-supplied wire path to the canonical
139
- * `stories/<rel>` form, or null when it can't be trusted. Accepts both the
140
- * canonical `stories/foo.json` convention and bare `foo.json` (the host route
141
- * historically allowed either). Rejects absolute paths, backslashes, and any
142
- * empty / `.` / `..` segment — the lexical guard before every
143
- * `files.artifacts` read/write (FileOps re-checks containment as
144
- * defence-in-depth).
140
+ * `stories/<rel>` form, or null when it can't be trusted. Accepts the
141
+ * canonical `stories/foo.json` convention, bare `foo.json` (the host route
142
+ * historically allowed either), and the workspace-relative spelling
143
+ * `artifacts/stories/foo.json` — the tool description called `filePath`
144
+ * "workspace-relative" for a long time, so agents legitimately send it.
145
+ * A leading `artifacts` segment is dropped only when `stories` follows;
146
+ * a bare `artifacts/foo.json` keeps its historical meaning (a file named
147
+ * `artifacts/foo.json` under the stories dir). Rejects absolute paths,
148
+ * backslashes, and any empty / `.` / `..` segment — the lexical guard
149
+ * before every `files.artifacts` read/write (FileOps re-checks
150
+ * containment as defence-in-depth).
145
151
  */
146
152
  function normalizeStoryPath(filePath) {
147
153
  if (filePath.length === 0 || filePath.includes("\\")) return null;
148
154
  if (filePath.startsWith("/") || /^[A-Za-z]:/.test(filePath)) return null;
149
155
  const segments = filePath.split("/");
150
156
  if (segments.some((seg) => seg === "" || seg === "." || seg === "..")) return null;
151
- const rest = segments[0] === STORIES_DIR ? segments.slice(1) : segments;
157
+ const trimmed = segments[0] === ARTIFACTS_DIR && segments[1] === STORIES_DIR ? segments.slice(1) : segments;
158
+ const rest = trimmed[0] === STORIES_DIR ? trimmed.slice(1) : trimmed;
152
159
  if (rest.length === 0) return null;
153
160
  return [STORIES_DIR, ...rest].join("/");
154
161
  }
@@ -448,4 +455,4 @@ Object.defineProperty(exports, "validateUpdateScriptBody", {
448
455
  }
449
456
  });
450
457
 
451
- //# sourceMappingURL=plugin-CtKUt8DX.cjs.map
458
+ //# sourceMappingURL=plugin-Bi986Wga.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-Bi986Wga.cjs","names":[],"sources":["../src/core/definition.ts","../src/core/paths.ts","../src/core/validate.ts","../src/core/plugin.ts"],"sourcesContent":["import type { ToolDefinition } from \"gui-chat-protocol\";\n\nexport const TOOL_NAME = \"presentMulmoScript\";\n\n// Single source of truth for the presentMulmoScript tool schema, shared by\n// MulmoClaude (host built-in shim re-exports this) and MulmoTerminal.\n// (Extracted byte-identical from the host definition; evolves here with the\n// package version.)\nexport const TOOL_DEFINITION: ToolDefinition = {\n type: \"function\",\n name: TOOL_NAME,\n description: `Save and present a MulmoScript story or presentation as a visual storyboard in the canvas.\n\nTwo modes — provide EXACTLY ONE of \\`script\\` or \\`filePath\\`:\n\n1. **Create new** — pass \\`script\\` (full MulmoScript JSON). Server saves it to disk and presents it.\n2. **Re-display existing** — pass \\`filePath\\` (the \\`filePath\\` returned by a previous call, e.g. \"stories/my-story-1700000000000.json\"; it is resolved against the workspace's \\`artifacts/\\` directory, NOT the workspace root). Much cheaper than re-sending the full script. Use whenever the user wants to revisit a presentation that was already created in this workspace.\n\nOptional \\`autoGenerateMovie: true\\` kicks off movie generation in the background, so the final video is ready by the time the user opens the canvas. Movie generation is expensive (multiple image + audio API calls + video encoding) — only set this when the user has explicitly asked for the movie. Default \\`false\\`.\n\nProvider rules for new scripts:\n- \\`speechParams.speakers.<name>.provider\\`: \\`\"gemini\"\\` — pairs with Gemini voices like \\`\"Kore\"\\`, \\`\"Aoede\"\\`, \\`\"Puck\"\\`. Do NOT use \\`\"google\"\\` here — that routes to Google Cloud TTS, where Gemini-class voices fail with \"This voice requires a model name to be specified.\" unless an explicit \\`model\\` is set.\n- \\`imageParams.provider\\`: \\`\"google\"\\`\n- \\`movieParams.provider\\`: \\`\"google\"\\`\n- Do NOT add a top-level \\`provider\\` field to \\`speechParams\\` — provider belongs per-speaker only.\n\nRequired structure:\n\n{\n \"$mulmocast\": { \"version\": \"1.1\" },\n \"title\": \"The Life of a Star\",\n \"description\": \"A short educational explainer about stellar evolution\",\n \"lang\": \"en\",\n \"speechParams\": {\n \"speakers\": {\n \"Presenter\": {\n \"provider\": \"gemini\",\n \"voiceId\": \"Kore\",\n \"displayName\": { \"en\": \"Presenter\" }\n }\n }\n },\n \"imageParams\": { \"provider\": \"google\", \"model\": \"gemini-3.1-flash-image-preview\" },\n \"movieParams\": { \"provider\": \"google\", \"model\": \"veo-3.1-generate\" },\n \"beats\": [\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Narration spoken aloud for this beat.\",\n \"imagePrompt\": \"Detailed description — AI generates the image\"\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Bullet point beat.\",\n \"image\": { \"type\": \"textSlide\", \"slide\": { \"title\": \"Slide Title\", \"bullets\": [\"Point one\", \"Point two\"] } }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Markdown beat.\",\n \"image\": { \"type\": \"markdown\", \"markdown\": \"## Heading\\\\n\\\\nBody text here.\" }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Chart beat — use for data, comparisons, trends.\",\n \"image\": { \"type\": \"chart\", \"title\": \"Chart Title\", \"chartData\": { \"type\": \"bar\", \"data\": { \"labels\": [\"A\", \"B\", \"C\"], \"datasets\": [{ \"label\": \"Series\", \"data\": [10, 20, 30] }] } } }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Diagram beat — use for flows, architectures, relationships.\",\n \"image\": { \"type\": \"mermaid\", \"title\": \"Diagram Title\", \"code\": { \"kind\": \"text\", \"text\": \"graph TD\\\\n A[Start] --> B[Process] --> C[End]\" } }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"Rich interactive beat — use for custom layouts, animations, or anything that benefits from HTML/CSS.\",\n \"image\": { \"type\": \"html_tailwind\", \"html\": \"<div class=\\\\\"flex items-center justify-center h-full text-4xl font-bold text-blue-600\\\\\">Hello World</div>\" }\n },\n {\n \"speaker\": \"Presenter\",\n \"text\": \"AI video beat.\",\n \"moviePrompt\": \"Detailed description — AI generates the video clip\"\n }\n ]\n}\n\nBeat visual options (choose one per beat):\n- \"imagePrompt\": \"...\" → top-level string field — AI generates an image from the prompt\n- \"moviePrompt\": \"...\" → top-level string field — AI generates a video clip from the prompt\n- \"image\": { \"type\": \"textSlide\", \"slide\": { \"title\", \"subtitle\"?, \"bullets\"? } }\n- \"image\": { \"type\": \"markdown\", \"markdown\": \"...\" }\n- \"image\": { \"type\": \"chart\", \"title\": \"...\", \"chartData\": { \"type\": \"bar\"|\"line\"|\"pie\"|..., \"data\": { \"labels\": [...], \"datasets\": [...] } } } ← PREFER for data/numbers/comparisons. chartData is a full Chart.js config: labels/datasets go under \"data\", not at the top level.\n- \"image\": { \"type\": \"mermaid\", \"title\": \"...\", \"code\": { \"kind\": \"text\", \"text\": \"...\" } } ← PREFER for flows/diagrams/relationships\n- \"image\": { \"type\": \"html_tailwind\", \"html\": \"...\", \"script\"?: \"...\" } ← PREFER for rich layouts, animations, custom visuals\n\nIMPORTANT: \"imagePrompt\" and \"moviePrompt\" are plain string fields on the beat, NOT nested under \"image\".`,\n parameters: {\n type: \"object\",\n properties: {\n script: {\n type: \"object\",\n description:\n \"Complete MulmoScript JSON for a NEW presentation. Must include $mulmocast, speechParams, imageParams, movieParams, and beats array. Always populate the top-level 'description' field with a concise 1–2 sentence summary of the presentation. Do NOT pass alongside `filePath`.\",\n additionalProperties: true,\n },\n filename: {\n type: \"string\",\n description:\n \"Optional filename without extension. Defaults to a slug of the script title. Only meaningful with `script`; ignored when `filePath` is given.\",\n },\n filePath: {\n type: \"string\",\n description:\n \"Path of an EXISTING MulmoScript JSON file, as returned by a previous call (e.g. 'stories/my-story-1700000000000.json'). Resolved against the workspace's `artifacts/` directory, not the workspace root ('artifacts/stories/…' is also accepted). Use this to re-display a script previously saved in this workspace, instead of resending the full JSON. Do NOT pass alongside `script`.\",\n },\n autoGenerateMovie: {\n type: \"boolean\",\n description:\n \"When true, the server starts movie generation in the background after save/load. The user does NOT need to open the canvas — progress streams via the existing session channel. Default false. Only set true when the user has explicitly asked for the movie; generation is expensive.\",\n },\n },\n required: [],\n },\n};\n","// Pure path helpers for MulmoScript story artifacts. No Node built-ins so the\n// package stays bundler-agnostic (chart/html precedent); all filesystem access\n// happens through the host's generic `files.artifacts` FileOps.\n//\n// Path model: the stories directory lives at `<workspace>/artifacts/stories`\n// and the FileOps scope root is `<workspace>/artifacts`, so the\n// FileOps-relative path and the historical `stories/<name>.json` wire form\n// (which every mulmoScript endpoint keys on) are the SAME string. Helpers\n// below therefore return one path used for both purposes.\n\nconst STORIES_DIR = \"stories\";\nconst ARTIFACTS_DIR = \"artifacts\";\nconst MAX_SLUG_LEN = 120;\n\n/** Lowercase-hyphen slug, capped at MAX_SLUG_LEN, with leading/trailing\n * hyphens stripped. Falls back to `fallback` for empty/undefined/non-ASCII\n * input. Mirrors html-plugin's in-package slugify — deliberately simpler\n * than the host's hash-fallback variant; the timestamp suffix appended by\n * `storyFilePath` keeps these throwaway filenames collision-free. */\nexport function slugify(title: string | undefined, fallback = \"story\"): string {\n if (!title) return fallback;\n const collapsed = title\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .slice(0, MAX_SLUG_LEN);\n let start = 0;\n let end = collapsed.length;\n while (start < end && collapsed[start] === \"-\") start += 1;\n while (end > start && collapsed[end - 1] === \"-\") end -= 1;\n return collapsed.slice(start, end) || fallback;\n}\n\n/** Build a fresh, collision-safe story path for a new script —\n * `stories/<slug>-<epoch-ms>.json`, valid as both the FileOps-relative\n * write path and the wire `filePath`. */\nexport function storyFilePath(slugSource: string, now: Date = new Date()): string {\n return `${STORIES_DIR}/${slugify(slugSource)}-${now.getTime()}.json`;\n}\n\n/**\n * Normalize a caller-supplied wire path to the canonical\n * `stories/<rel>` form, or null when it can't be trusted. Accepts the\n * canonical `stories/foo.json` convention, bare `foo.json` (the host route\n * historically allowed either), and the workspace-relative spelling\n * `artifacts/stories/foo.json` — the tool description called `filePath`\n * \"workspace-relative\" for a long time, so agents legitimately send it.\n * A leading `artifacts` segment is dropped only when `stories` follows;\n * a bare `artifacts/foo.json` keeps its historical meaning (a file named\n * `artifacts/foo.json` under the stories dir). Rejects absolute paths,\n * backslashes, and any empty / `.` / `..` segment — the lexical guard\n * before every `files.artifacts` read/write (FileOps re-checks\n * containment as defence-in-depth).\n */\nexport function normalizeStoryPath(filePath: string): string | null {\n if (filePath.length === 0 || filePath.includes(\"\\\\\")) return null;\n // Absolute POSIX path or Windows drive prefix.\n if (filePath.startsWith(\"/\") || /^[A-Za-z]:/.test(filePath)) return null;\n const segments = filePath.split(\"/\");\n if (segments.some((seg) => seg === \"\" || seg === \".\" || seg === \"..\")) return null;\n const trimmed = segments[0] === ARTIFACTS_DIR && segments[1] === STORIES_DIR ? segments.slice(1) : segments;\n const rest = trimmed[0] === STORIES_DIR ? trimmed.slice(1) : trimmed;\n if (rest.length === 0) return null;\n return [STORIES_DIR, ...rest].join(\"/\");\n}\n","// Body validators for the mulmoScript update endpoints, moved verbatim from\n// the host's `server/api/routes/mulmoScriptValidate.ts` so MulmoClaude and\n// MulmoTerminal share one definition of a \"valid script\" / \"valid beat\".\n//\n// The `@mulmocast/types` package exports zod schemas that mirror the\n// canonical MulmoScript / MulmoBeat shapes. The same schemas back client-side\n// edit-time validation in the presentMulmoScript View.\n\nimport { mulmoBeatSchema, mulmoScriptSchema } from \"@mulmocast/types\";\n\nexport type ValidationResult<T> = { ok: true; value: T } | { ok: false; error: string };\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction formatZodIssues(\n // Zod's `$ZodIssue.path` is `PropertyKey[]` (includes `symbol`).\n // Accept the wider type so callers can pass `safeParse().error.issues`\n // directly; stringify any non-string/number segments at format time.\n issues: readonly { message: string; path: readonly PropertyKey[] }[],\n): string {\n if (issues.length === 0) return \"invalid shape\";\n const head = issues\n .slice(0, 3)\n .map((i) => {\n const pathStr = i.path.length > 0 ? i.path.map((seg) => String(seg)).join(\".\") : \"<root>\";\n return `${pathStr}: ${i.message}`;\n })\n .join(\"; \");\n return issues.length > 3 ? `${head} (+${issues.length - 3} more)` : head;\n}\n\n/**\n * Validate the `update-script` request body. Returns the parsed,\n * schema-conformant script on success, or a human-readable error\n * suitable for sending back as a 400 response.\n */\nexport function validateUpdateScriptBody(body: unknown): ValidationResult<{\n filePath: string;\n script: unknown;\n}> {\n if (!isRecord(body)) {\n return { ok: false, error: \"body must be an object\" };\n }\n if (typeof body.filePath !== \"string\" || body.filePath === \"\") {\n return { ok: false, error: \"filePath must be a non-empty string\" };\n }\n if (body.script === undefined) {\n return { ok: false, error: \"script is required\" };\n }\n const parsed = mulmoScriptSchema.safeParse(body.script);\n if (!parsed.success) {\n return {\n ok: false,\n error: `invalid script: ${formatZodIssues(parsed.error.issues)}`,\n };\n }\n return {\n ok: true,\n value: { filePath: body.filePath as string, script: parsed.data },\n };\n}\n\n/**\n * Validate the `update-beat` request body. `beatIndex` is allowed\n * to be any non-negative integer; the handler still bounds-checks\n * against the actual script length after reading the file.\n */\nexport function validateUpdateBeatBody(body: unknown): ValidationResult<{\n filePath: string;\n beatIndex: number;\n beat: unknown;\n}> {\n if (!isRecord(body)) {\n return { ok: false, error: \"body must be an object\" };\n }\n if (typeof body.filePath !== \"string\" || body.filePath === \"\") {\n return { ok: false, error: \"filePath must be a non-empty string\" };\n }\n if (typeof body.beatIndex !== \"number\" || !Number.isInteger(body.beatIndex) || body.beatIndex < 0) {\n return { ok: false, error: \"beatIndex must be a non-negative integer\" };\n }\n if (body.beat === undefined) {\n return { ok: false, error: \"beat is required\" };\n }\n const parsed = mulmoBeatSchema.safeParse(body.beat);\n if (!parsed.success) {\n return {\n ok: false,\n error: `invalid beat: ${formatZodIssues(parsed.error.issues)}`,\n };\n }\n return {\n ok: true,\n value: {\n filePath: body.filePath as string,\n beatIndex: body.beatIndex as number,\n beat: parsed.data,\n },\n };\n}\n","import type { ToolPluginCore, ToolResult } from \"gui-chat-protocol\";\nimport { mulmoScriptSchema } from \"@mulmocast/types\";\nimport { TOOL_DEFINITION } from \"./definition\";\nimport { normalizeStoryPath, storyFilePath } from \"./paths\";\nimport { validateUpdateBeatBody, validateUpdateScriptBody } from \"./validate\";\nimport type { MulmoScriptData, MulmoScriptExecuteContext, SaveMulmoScriptArgs } from \"./types\";\n\n/** Failure half of every outcome below. `code` preserves the hosts'\n * HTTP contract (bad_request → 400, not_found → 404) without the package\n * knowing anything about HTTP. */\nexport interface MulmoScriptFailure {\n ok: false;\n code: \"bad_request\" | \"not_found\";\n error: string;\n}\n\nexport type SaveMulmoScriptOutcome = ({ ok: true; message: string } & MulmoScriptData) | MulmoScriptFailure;\n\nexport type UpdateMulmoScriptOutcome = { ok: true } | MulmoScriptFailure;\n\nfunction badRequest(error: string): MulmoScriptFailure {\n return { ok: false, code: \"bad_request\", error };\n}\n\nfunction notFound(error: string): MulmoScriptFailure {\n return { ok: false, code: \"not_found\", error };\n}\n\nfunction errorText(err: unknown): string {\n return err instanceof Error ? err.message : String(err);\n}\n\nfunction stringifyScript(script: unknown): string {\n // 2-space indent matches the hosts' writeJsonAtomic convention so a\n // package-written script diffs cleanly against host-written ones.\n return JSON.stringify(script, null, 2);\n}\n\n/** Persist a new, schema-validated script under a fresh `stories/…` path. */\nasync function saveNewScript(context: MulmoScriptExecuteContext, script: unknown, filename: string | undefined, now: Date): Promise<SaveMulmoScriptOutcome> {\n const validation = mulmoScriptSchema.safeParse(script);\n if (!validation.success) {\n return badRequest(\"script is not a valid MulmoScript\");\n }\n const validatedScript = validation.data;\n // slugify drops `/`, `\\`, and `..`, so a hostile `filename` like\n // \"../../etc/passwd\" can never escape the stories dir — defense in\n // depth on top of FileOps' own containment check.\n const slugSource = filename ? filename.replace(/\\.json$/i, \"\") : validatedScript.title || \"untitled\";\n const filePath = storyFilePath(slugSource, now);\n await context.files.artifacts.write(filePath, stringifyScript(validatedScript));\n return { ok: true, script: validatedScript, filePath, message: `Saved MulmoScript to ${filePath}` };\n}\n\n/** Re-open an existing script: containment guard, existence, JSON parse,\n * schema validation — same acceptance rules as the save path so a script\n * this package saved can never be one it later refuses to load. */\nasync function loadExistingScript(context: MulmoScriptExecuteContext, filePath: string): Promise<SaveMulmoScriptOutcome> {\n if (!filePath.toLowerCase().endsWith(\".json\")) {\n return badRequest(\"filePath must point to a .json file\");\n }\n const storyPath = normalizeStoryPath(filePath);\n if (!storyPath) {\n return badRequest(\"Invalid filePath\");\n }\n if (!(await context.files.artifacts.exists(storyPath))) {\n return notFound(`File not found: ${filePath}`);\n }\n const raw = await context.files.artifacts.read(storyPath);\n let parsed: unknown;\n try {\n parsed = JSON.parse(raw);\n } catch (err) {\n return badRequest(`Invalid JSON: ${errorText(err)}`);\n }\n const validation = mulmoScriptSchema.safeParse(parsed);\n if (!validation.success) {\n return badRequest(\"File is not a valid MulmoScript\");\n }\n return { ok: true, script: validation.data, filePath: storyPath, message: `Loaded MulmoScript from ${storyPath}` };\n}\n\n/**\n * Unified save-or-reopen for the presentMulmoScript tool call. `script`\n * (create new) and `filePath` (existing) are mutually exclusive. Never\n * throws on bad input — validation failures come back as discriminated\n * failures so host routes stay thin adapters. `autoGenerateMovie` is NOT\n * handled here: movie generation needs host backends (mulmocast/ffmpeg),\n * so hosts that support it trigger it from the returned `filePath`.\n */\nexport async function executeMulmoScriptSave(\n context: MulmoScriptExecuteContext,\n args: SaveMulmoScriptArgs,\n now: Date = new Date(),\n): Promise<SaveMulmoScriptOutcome> {\n const { script, filename, filePath } = args ?? {};\n const hasScript = script !== undefined && script !== null;\n const hasFilePath = typeof filePath === \"string\" && filePath !== \"\";\n if (hasScript === hasFilePath) {\n return badRequest(\n hasScript ? \"Provide either `script` or `filePath`, not both.\" : \"Provide either `script` (new presentation) or `filePath` (existing presentation).\",\n );\n }\n return hasFilePath\n ? loadExistingScript(context, filePath as string)\n : saveNewScript(context, script, typeof filename === \"string\" ? filename : undefined, now);\n}\n\n/** Resolve + guard a wire path for the update endpoints. */\nasync function resolveExistingStory(context: MulmoScriptExecuteContext, filePath: string): Promise<{ storyPath: string } | MulmoScriptFailure> {\n const storyPath = normalizeStoryPath(filePath);\n if (!storyPath) return badRequest(\"Invalid filePath\");\n if (!(await context.files.artifacts.exists(storyPath))) {\n return notFound(`File not found: ${filePath}`);\n }\n return { storyPath };\n}\n\n/** Overwrite one beat of an existing script (the View's per-beat source\n * editor). Validates the body shape + beat schema, bounds-checks the index\n * against the script on disk, and writes the whole file back. */\nexport async function executeUpdateBeat(context: MulmoScriptExecuteContext, body: unknown): Promise<UpdateMulmoScriptOutcome> {\n const validation = validateUpdateBeatBody(body);\n if (!validation.ok) return badRequest(validation.error);\n const { filePath, beatIndex, beat } = validation.value;\n\n const resolved = await resolveExistingStory(context, filePath);\n if (\"ok\" in resolved) return resolved;\n\n let script: { beats?: unknown[] };\n try {\n script = JSON.parse(await context.files.artifacts.read(resolved.storyPath));\n } catch (err) {\n return badRequest(`Invalid JSON: ${errorText(err)}`);\n }\n if (!Array.isArray(script.beats) || beatIndex >= script.beats.length) {\n return badRequest(\"Invalid beatIndex\");\n }\n script.beats[beatIndex] = beat;\n await context.files.artifacts.write(resolved.storyPath, stringifyScript(script));\n return { ok: true };\n}\n\n/** Overwrite the whole script (the View's full-source editor / deck-editor\n * auto-save). The body's `script` is schema-validated by\n * `validateUpdateScriptBody` before the write. */\nexport async function executeUpdateScript(context: MulmoScriptExecuteContext, body: unknown): Promise<UpdateMulmoScriptOutcome> {\n const validation = validateUpdateScriptBody(body);\n if (!validation.ok) return badRequest(validation.error);\n const { filePath, script } = validation.value;\n\n const resolved = await resolveExistingStory(context, filePath);\n if (\"ok\" in resolved) return resolved;\n\n await context.files.artifacts.write(resolved.storyPath, stringifyScript(script));\n return { ok: true };\n}\n\n/** ToolResult-shaped wrapper over `executeMulmoScriptSave` for runtime hosts\n * (e.g. MulmoTerminal's package loader), where the tool call resolves to a\n * ToolResult rather than an HTTP response. Failures are narrate-only\n * (message, no data) so the agent can self-correct. */\nexport async function executeMulmoScript(context: MulmoScriptExecuteContext, args: SaveMulmoScriptArgs): Promise<ToolResult<MulmoScriptData>> {\n const outcome = await executeMulmoScriptSave(context, args);\n if (!outcome.ok) {\n return {\n message: outcome.error,\n instructions: \"Acknowledge the error and retry with a valid `script` (new) or an existing `filePath`.\",\n };\n }\n // The tool schema advertises `autoGenerateMovie`, but movie generation\n // needs host backends (mulmocast/ffmpeg) this generic execute path\n // doesn't have — MulmoClaude honours the flag in its own save route.\n // Say so in the result rather than silently dropping the option, so the\n // agent doesn't tell the user a movie is on its way.\n const ignoredMovieNote = args.autoGenerateMovie === true ? \" (autoGenerateMovie is not supported by this host and was ignored)\" : \"\";\n return {\n message: `${outcome.message}${ignoredMovieNote}`,\n data: { script: outcome.script, filePath: outcome.filePath },\n instructions: \"Display the storyboard to the user.\",\n };\n}\n\n/** Non-Vue plugin core for runtime hosts that register the package directly.\n * MulmoClaude consumes only TOOL_DEFINITION + the execute functions in its\n * own routes, so it doesn't use this. */\nexport const pluginCore: ToolPluginCore<MulmoScriptData, MulmoScriptData, SaveMulmoScriptArgs> = {\n toolDefinition: TOOL_DEFINITION,\n execute: executeMulmoScript as unknown as ToolPluginCore<MulmoScriptData, MulmoScriptData, SaveMulmoScriptArgs>[\"execute\"],\n generatingMessage: \"Generating MulmoScript storyboard…\",\n isEnabled: () => true,\n};\n"],"mappings":";;AAEA,IAAa,YAAY;AAMzB,IAAa,kBAAkC;CAC7C,MAAM;CACN,MAAM;CACN,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFb,YAAY;EACV,MAAM;EACN,YAAY;GACV,QAAQ;IACN,MAAM;IACN,aACE;IACF,sBAAsB;GACxB;GACA,UAAU;IACR,MAAM;IACN,aACE;GACJ;GACA,UAAU;IACR,MAAM;IACN,aACE;GACJ;GACA,mBAAmB;IACjB,MAAM;IACN,aACE;GACJ;EACF;EACA,UAAU,CAAC;CACb;AACF;;;AC9GA,IAAM,cAAc;AACpB,IAAM,gBAAgB;AACtB,IAAM,eAAe;;;;;;AAOrB,SAAgB,QAAQ,OAA2B,WAAW,SAAiB;CAC7E,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,YAAY,MACf,Y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AS,KAAK;EACZ,OAAO,WAAW,iBAAiB,UAAU,GAAG,GAAG;CACrD;CACA,IAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,KAAK,aAAa,OAAO,MAAM,QAC5D,OAAO,WAAW,mBAAmB;CAEvC,OAAO,MAAM,aAAa;CAC1B,MAAM,QAAQ,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB,MAAM,CAAC;CAC/E,OAAO,EAAE,IAAI,KAAK;AACpB;;;;AAKA,eAAsB,oBAAoB,SAAoC,MAAkD;CAC9H,MAAM,aAAa,yBAAyB,IAAI;CAChD,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,WAAW,KAAK;CACtD,MAAM,EAAE,UAAU,WAAW,WAAW;CAExC,MAAM,WAAW,MAAM,qBAAqB,SAAS,QAAQ;CAC7D,IAAI,QAAQ,UAAU,OAAO;CAE7B,MAAM,QAAQ,MAAM,UAAU,MAAM,SAAS,WAAW,gBAAgB,MAAM,CAAC;CAC/E,OAAO,EAAE,IAAI,KAAK;AACpB;;;;;AAMA,eAAsB,mBAAmB,SAAoC,MAAiE;CAC5I,MAAM,UAAU,MAAM,uBAAuB,SAAS,IAAI;CAC1D,IAAI,CAAC,QAAQ,IACX,OAAO;EACL,SAAS,QAAQ;EACjB,cAAc;CAChB;CAOF,MAAM,mBAAmB,KAAK,sBAAsB,OAAO,uEAAuE;CAClI,OAAO;EACL,SAAS,GAAG,QAAQ,UAAU;EAC9B,MAAM;GAAE,QAAQ,QAAQ;GAAQ,UAAU,QAAQ;EAAS;EAC3D,cAAc;CAChB;AACF;;;;AAKA,IAAa,aAAoF;CAC/F,gBAAgB;CAChB,SAAS;CACT,mBAAmB;CACnB,iBAAiB;AACnB"}
@@ -0,0 +1,10 @@
1
+ import type { MulmoScriptServerOps } from "./ops";
2
+ export type MulmoScriptDispatchHandler = (args: Record<string, unknown>) => Promise<unknown>;
3
+ /**
4
+ * Build the kind router over an ops instance. The save / reopen / update
5
+ * kinds run the phase-1 core executes against the backend's artifacts
6
+ * FileOps, guarded by the instance's realpath containment
7
+ * (`guardStoryWirePath`) — the core's own guard is lexical.
8
+ */
9
+ export declare function createMulmoScriptDispatchHandler(ops: MulmoScriptServerOps): MulmoScriptDispatchHandler;
10
+ //# sourceMappingURL=dispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/server/dispatch.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAqElD,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,oBAAoB,GAAG,0BAA0B,CAuFtG"}
@@ -0,0 +1,7 @@
1
+ export type { GenerateOpArgs, MovieGenerationResult, MovieProgressEvent, MulmoScriptServerBackend, MulmoScriptServerLog, OpFailure, OpResult, PdfGenerationResult, } from "./types";
2
+ export { buildContext, buildBeatIdIndex, createMulmoScriptServerOps, PDF_MODE, PDF_SIZE, type MulmoScriptServerOps, type RunStoryOpDeps, type RunStoryOpOptions, type StoryContext, } from "./ops";
3
+ export { createMulmoScriptDispatchHandler, type MulmoScriptDispatchHandler } from "./dispatch";
4
+ export { withMulmoErrorCapture, enableGraphAIErrorCapture, composeMulmoErrorMessage, describeMulmoCause } from "./mulmoErrorCapture";
5
+ export { GENERATION_EVENT, type MulmoScriptGenerationEvent } from "../core/contract";
6
+ export { executeMulmoScriptSave, executeUpdateBeat, executeUpdateScript, type MulmoScriptFailure } from "../core/plugin";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAMA,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,0BAA0B,EAC1B,QAAQ,EACR,QAAQ,EACR,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,gCAAgC,EAAE,KAAK,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACrI,OAAO,EAAE,gBAAgB,EAAE,KAAK,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { MulmoScriptServerLog } from "./types";
2
+ /** Route captured GraphAI errors into the host logger. Set once by
3
+ * `createMulmoScriptServerOps`; the GraphAILogger sink is global, so the
4
+ * last-configured host logger wins (one ops instance per process). */
5
+ export declare function setMulmoErrorCaptureLogger(log: MulmoScriptServerLog | null): void;
6
+ /**
7
+ * Re-enable GraphAI's error level (everything else stays silenced) and
8
+ * route it into the host logger + the per-operation capture store.
9
+ * Call after every `setGraphAILogger(false)` — that helper disables all
10
+ * levels including error. Idempotent.
11
+ */
12
+ export declare function enableGraphAIErrorCapture(): void;
13
+ /** Render mulmocast's structured error `cause` as "field=value" pairs. */
14
+ export declare function describeMulmoCause(err: unknown): string | null;
15
+ /**
16
+ * Compose the enriched message for a failed mulmocast operation:
17
+ * mulmocast's own message, then its structured cause, then the
18
+ * captured underlying provider error(s). Deduped — GraphAI retries
19
+ * log the same error more than once.
20
+ */
21
+ export declare function composeMulmoErrorMessage(err: unknown, captured: readonly string[]): string;
22
+ /**
23
+ * Run a mulmocast operation, capturing GraphAI error logs emitted while
24
+ * it executes. On failure, rethrows with the captured provider error(s)
25
+ * appended to the message (original error kept as `cause`). Uses
26
+ * AsyncLocalStorage so concurrent operations don't cross-attribute.
27
+ */
28
+ export declare function withMulmoErrorCapture<T>(operation: () => Promise<T>): Promise<T>;
29
+ //# sourceMappingURL=mulmoErrorCapture.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mulmoErrorCapture.d.ts","sourceRoot":"","sources":["../../src/server/mulmoErrorCapture.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAMpD;;uEAEuE;AACvE,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAEjF;AAYD;;;;;GAKG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAUhD;AAOD,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAQ9D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAI1F;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAQtF"}
@@ -0,0 +1,101 @@
1
+ import type { MulmoBeat, MulmoStudioContext } from "@mulmocast/types";
2
+ import type { MulmoScriptGenerationEvent } from "../core/contract";
3
+ import type { GenerateOpArgs, MovieGenerationResult, MovieProgressEvent, MulmoScriptServerBackend, OpFailure, OpResult, PdfGenerationResult } from "./types";
4
+ type GenerationKind = MulmoScriptGenerationEvent["kind"];
5
+ export declare const PDF_MODE: "slide";
6
+ export declare const PDF_SIZE: "a4";
7
+ export declare function buildContext(absoluteFilePath: string, force?: boolean): Promise<MulmoStudioContext | null | undefined>;
8
+ export type StoryContext = NonNullable<Awaited<ReturnType<typeof buildContext>>>;
9
+ export interface RunStoryOpDeps {
10
+ resolveStory?: (filePath: string) => {
11
+ ok: true;
12
+ absolutePath: string;
13
+ } | OpFailure;
14
+ buildContext?: (absoluteFilePath: string, force?: boolean) => Promise<StoryContext | undefined>;
15
+ }
16
+ export interface RunStoryOpOptions<T> {
17
+ force?: boolean;
18
+ /**
19
+ * Op-specific tag included in the failure log so dashboards can
20
+ * distinguish which op is failing (e.g. `"generate-beat-audio"`).
21
+ * Falls back to a generic `"op failed"` entry when omitted.
22
+ */
23
+ operation?: string;
24
+ /**
25
+ * Soft-fail override for `buildContext` returning undefined. Some
26
+ * ops (e.g. `beatAudio`) historically returned a 200 `{ audio: null }`
27
+ * in that case so the frontend can silently retry. If provided, this
28
+ * callback returns the fallback result instead of the default
29
+ * server_error "Failed to initialize mulmo context".
30
+ */
31
+ onContextMissing?: () => OpResult<T>;
32
+ }
33
+ export declare function buildBeatIdIndex(beats: MulmoBeat[]): Map<string, number>;
34
+ /**
35
+ * Build the per-host mulmoScript server ops instance. One instance per
36
+ * process — it owns the in-flight movie/PDF dedup sets and the
37
+ * generation-state tracker, and binds the injected host backend.
38
+ */
39
+ export declare function createMulmoScriptServerOps(backend: MulmoScriptServerBackend): {
40
+ backend: MulmoScriptServerBackend;
41
+ toStoryRef: (absolutePath: string) => string;
42
+ resolveStory: (filePath: string) => {
43
+ ok: true;
44
+ absolutePath: string;
45
+ } | OpFailure;
46
+ guardStoryWirePath: (filePath: unknown) => OpFailure | null;
47
+ ffmpegGuard: () => OpFailure | null;
48
+ runStoryOp: <T>(filePath: string, options: RunStoryOpOptions<T>, handler: (ctx: {
49
+ absoluteFilePath: string;
50
+ context: StoryContext;
51
+ }) => Promise<OpResult<T>>, deps?: RunStoryOpDeps) => Promise<OpResult<T>>;
52
+ publishGeneration: (chatSessionId: string | undefined, kind: GenerationKind, filePath: string, key: string, finished: boolean, error?: string) => void;
53
+ pendingGenerations: (filePath: string) => MulmoScriptGenerationEvent[];
54
+ beatImageOp: (filePath: string, beatIndex: number) => Promise<OpResult<{
55
+ image: string | null;
56
+ }>>;
57
+ beatAudioOp: (filePath: string, beatIndex: number) => Promise<OpResult<{
58
+ audio: string | null;
59
+ }>>;
60
+ beatMovieOp: (filePath: string, beatIndex: number) => Promise<OpResult<{
61
+ moviePath: string | null;
62
+ }>>;
63
+ characterImageOp: (filePath: string, key: string) => Promise<OpResult<{
64
+ image: string | null;
65
+ }>>;
66
+ movieStatusOp: (filePath: string) => Promise<OpResult<{
67
+ moviePath: string | null;
68
+ }>>;
69
+ pdfStatusOp: (filePath: string) => Promise<OpResult<{
70
+ pdfPath: string | null;
71
+ }>>;
72
+ renderBeatOp: (args: Required<Pick<GenerateOpArgs, "filePath" | "beatIndex">> & GenerateOpArgs) => Promise<OpResult<{
73
+ image: string;
74
+ }>>;
75
+ generateBeatAudioOp: (args: Required<Pick<GenerateOpArgs, "filePath" | "beatIndex">> & GenerateOpArgs) => Promise<OpResult<{
76
+ audio: string;
77
+ }>>;
78
+ renderCharacterOp: (args: Required<Pick<GenerateOpArgs, "filePath" | "key">> & GenerateOpArgs) => Promise<OpResult<{
79
+ image: string;
80
+ }>>;
81
+ uploadBeatImageOp: (filePath: string, beatIndex: number, imageData: string) => Promise<OpResult<{
82
+ image: string;
83
+ }>>;
84
+ uploadCharacterImageOp: (filePath: string, key: string, imageData: string) => Promise<OpResult<{
85
+ image: string;
86
+ }>>;
87
+ inFlightMovies: Set<string>;
88
+ inFlightPdfs: Set<string>;
89
+ runMovieGeneration: (absoluteFilePath: string, onProgressEvent: (event: MovieProgressEvent) => void) => Promise<MovieGenerationResult>;
90
+ runPdfGeneration: (context: StoryContext, onImageBeatDone: (beatIndex: number) => void) => Promise<PdfGenerationResult>;
91
+ generateMovieOp: (filePath: string, chatSessionId: string | undefined) => Promise<OpResult<{
92
+ moviePath: string;
93
+ }>>;
94
+ generatePdfOp: (filePath: string, chatSessionId: string | undefined) => Promise<OpResult<{
95
+ pdfPath: string;
96
+ }>>;
97
+ triggerAutoBackgroundMovie: (absoluteFilePath: string, wireFilePath: string, chatSessionId: string | undefined) => void;
98
+ };
99
+ export type MulmoScriptServerOps = ReturnType<typeof createMulmoScriptServerOps>;
100
+ export {};
101
+ //# sourceMappingURL=ops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../src/server/ops.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,SAAS,EAAyB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC7F,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAInE,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EAExB,SAAS,EACT,QAAQ,EACR,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,KAAK,cAAc,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;AAKzD,eAAO,MAAM,QAAQ,EAAG,OAAgB,CAAC;AACzC,eAAO,MAAM,QAAQ,EAAG,IAAa,CAAC;AAmBtC,wBAAsB,YAAY,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,UAAQ,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC,CAa1H;AAGD,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;AAEjF,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK;QAAE,EAAE,EAAE,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACpF,YAAY,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,YA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,EAAE,kBAAkB,KAAK,IAAI,KAAG,OAAO,CAAC,qBAAqB,CAAC;gCA0KxG,YAAY,mBAAmB,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAG,OAAO,CAAC,mBAAmB,CAAC;gCAnHzF,MAAM,iBAAiB,MAAM,GAAG,SAAS,KAAG,OAAO,CAAC,QAAQ,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;8BA8ItF,MAAM,iBAAiB,MAAM,GAAG,SAAS,KAAG,OAAO,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;mDA7GnE,MAAM,gBAAgB,MAAM,iBAAiB,MAAM,GAAG,SAAS,KAAG,IAAI;EA8K7H;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare function errorText(err: unknown): string;
2
+ export declare function isRecord(value: unknown): value is Record<string, unknown>;
3
+ export declare function stripDataUri(dataUri: string): string;
4
+ /** Realpath-based containment: resolve `relPath` against the ROOT's
5
+ * realpath and require the target's realpath to stay inside it. Returns
6
+ * null on ENOENT or traversal (symlink escapes included). */
7
+ export declare function resolveWithinRoot(rootReal: string, relPath: string): string | null;
8
+ export declare function fileToDataUri(filePath: string, mimeType: string): Promise<string>;
9
+ //# sourceMappingURL=support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../../src/server/support.ts"],"names":[],"mappings":"AAUA,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAQ9C;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;8DAE8D;AAC9D,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAalF;AAID,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGvF"}