// MulmoClaude's thin built-in adapter for the shared mulmoscript plugin // (plans/done/feat-mulmoscript-plugin.md phase 2). View / Preview / // TOOL_DEFINITION come from @mulmoclaude/mulmoscript-plugin; the View // reaches host backends via useRuntime().dispatch → the built-in // "mulmoScript" dispatch handler (server/plugins/mulmoscript-server.ts) // and hears generation progress on the plugin pubsub channel. This adapter // keeps MulmoClaude's existing tool-call create path (POST // /api/mulmoScript/save) and injects the two host-transport capabilities // the generic runtime can't carry: the active chat session id (sidebar // generation indicator) and the bearer-authenticated media download. import { computed, defineComponent, h, markRaw, provide, type Component } from "vue"; import type { PluginRegistration, ToolPlugin } from "../../tools/types"; import { View, Preview, MULMOSCRIPT_HOST_ADAPTER_KEY, type MulmoScriptData, type MulmoScriptHostAdapter } from "@mulmoclaude/mulmoscript-plugin/vue"; // Lib mode doesn't auto-inject the package's compiled styles; the consumer // must import them — same as @mulmoclaude/{markdown,form,chart,html}-plugin. import "@mulmoclaude/mulmoscript-plugin/style.css"; import toolDefinition, { TOOL_NAME, type MulmoScriptEndpoints } from "./definition"; import { pluginEndpoints } from "../api"; import { makeRouteExecute } from "../execute"; import { wrapWithScope } from "../scope"; import { apiFetchRaw } from "../../utils/api"; import { useActiveSession } from "../../composables/useActiveSession"; // Re-exported from the shared package so anything importing the result-data // shape from "./index" keeps working while the type stays single-sourced. export type { MulmoScriptData }; // Bearer-authenticated media download over the host's existing // download routes. A plain