Skip to content

The VS Code of video editing, built for agents.

TypeScript

Remove McpSetupBanner component and related functionality

konstantin-paulus2ca853ff700d
diff --git a/apps/web/src/components/canvas/canvas.tsx b/apps/web/src/components/canvas/canvas.tsx
index 628b5fb1..bdb2754b 100644
--- a/apps/web/src/components/canvas/canvas.tsx
+++ b/apps/web/src/components/canvas/canvas.tsx
@@ -10,7 +10,6 @@ import { droppedFiles, importFiles } from "@/engine/asset-actions";
import { Toolbar } from "./toolbar";
import { DrawOverlay } from "./draw-overlay";
import { DesktopAppBanner } from "./desktop-app-banner";
-import { McpSetupBanner } from "./mcp-setup-banner";
import { toast } from "somoto"
import { SceneInitOverlay } from "./scene-init-overlay";
import { ASSET_DRAG_TYPE } from "@/components/sidebar-left/folder-item";
@@ -78,7 +77,6 @@ export function Canvas() {
>
<Toolbar />
<DesktopAppBanner />
- <McpSetupBanner />
<DrawOverlay />
<SceneInitOverlay />
<EngineCanvas />
diff --git a/apps/web/src/components/canvas/mcp-setup-banner.tsx b/apps/web/src/components/canvas/mcp-setup-banner.tsx
deleted file mode 100644
index 90dfa859..00000000
--- a/apps/web/src/components/canvas/mcp-setup-banner.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-import { Show, createResource, createSignal, onCleanup } from "solid-js";
-import { toast } from "somoto";
-
-import { Button } from "@/components/ui/button";
-import { Icon } from "@/components/ui/icon";
-import { useEditorApi } from "@/dapi";
-import { agentSetupStatus, connectAgents, setupPending } from "@/lib/agents";
-import { track } from "@/lib/analytics";
-import { createStoredSignal } from "@/lib/store";
-import { store } from "@/init";
-
-import type { SetupResult } from "@/lib/agents";
-
-// The same artwork the download promo uses — one card, two steps of the
-// same story, so the second one is recognisably the first one's sequel.
-const BANNER_IMAGE = new URL("@/assets/images/desktop-app-banner.png", import.meta.url).href;
-
-/**
- * The desktop counterpart of {@link DesktopAppBanner}: same card, same
- * corner, but for the step after installing the app — pointing the coding
- * agents on this machine at its MCP server. It appears only while there is
- * something left to do (`setup:status` checks the agent configs and the
- * `dapi` symlink both, without writing either), and goes away the moment
- * setup completes, whether from this button or the app menu.
- */
-export function McpSetupBanner() {
- const { isDesktop } = useEditorApi();
- const [dismissed, setDismissed] = createStoredSignal(
- store.define("canvas.mcp-setup-banner-dismissed", false),
- );
- const [status, { refetch }] = createResource(agentSetupStatus);
- const [busy, setBusy] = createSignal(false);
-
- // Connecting can also happen from the app menu, and the admin prompt takes
- // the window's focus with it — coming back is the moment to look again.
- const handleFocus = () => void refetch();
- window.addEventListener("focus", handleFocus);
- onCleanup(() => window.removeEventListener("focus", handleFocus));
-
- const handleDismiss = () => {
- track("mcp_setup_banner_dismissed", { source: "canvas_banner" });
- setDismissed(true);
- };
-
- const handleConnect = async () => {
- if (busy()) return;
- setBusy(true);
-
- try {
- const result = await connectAgents();
- track("mcp_setup_connected", { source: "canvas_banner", cli: result.cli.status });
- toast("Your agents are connected", { description: describe(result) });
- } catch (e) {
- toast.error("Could not connect your agents", {
- description: (e as Error).message,
- });
- } finally {
- setBusy(false);
- // The card hides itself once nothing is left to do.
- await refetch();
- }
- };
-
- return (
- <Show when={isDesktop && !dismissed() && setupPending(status())}>
- <div class="absolute bottom-4 left-4 z-10 flex w-[220px] flex-col gap-1 rounded-md border border-border bg-background pb-3 shadow-[0px_0px_1px_2px_rgba(0,0,0,0.12),0px_4px_12px_8px_rgba(0,0,0,0.12)]">
- <div class="relative aspect-[220/122] w-full overflow-hidden rounded-t-md">
- <img src={BANNER_IMAGE} alt="" class="pointer-events-none size-full object-cover" />
- <button
- type="button"
- aria-label="Dismiss"
- class="absolute right-1 top-1 text-muted-foreground transition-colors hover:text-foreground"
- onClick={handleDismiss}
- >
- <Icon name="close-remove" />
- </button>
- </div>
- <div class="flex flex-col gap-3 px-3">
- <div class="flex flex-col gap-0.5">
- <div class="flex h-7 items-center">
- <span class="truncate text-xs font-450 leading-4 text-foreground">
- Connect your coding agents
- </span>
- </div>
- <p class="text-xs leading-4 text-muted-foreground">
- Point Claude Code, Codex, or another coding agent at this app so it can analyze
- footage and edit your project.
- </p>
- </div>
- <Button
- variant="secondary"
- class="w-full gap-1"
- disabled={busy()}
- onClick={handleConnect}
- >
- <Show when={busy()} fallback="Connect agents">
- <Icon name="spinner-loader" class="animate-spin" />
- Connecting…
- </Show>
- </Button>
- </div>
- </div>
- </Show>
- );
-}
-
-/** What the toast says about a finished setup, one line per step that did something. */
-function describe({ mcp, cli }: SetupResult): string {
- const lines: string[] = [];
-
- if (mcp.status === "registered") {
- lines.push(`${mcp.agents.join(", ")} can now reach this app — restart the agent to pick it up.`);
- }
- if (cli.status === "installed") lines.push('The "dapi" command is now on your PATH.');
- if (cli.status === "cancelled") lines.push('Skipped linking the "dapi" command line tool.');
- if (cli.status === "error") lines.push(`The "dapi" command could not be linked: ${cli.error}`);
-
- return lines.join(" ");
-}
diff --git a/apps/web/src/components/dashboard/home-view.tsx b/apps/web/src/components/dashboard/home-view.tsx
index 029c1b37..84415394 100644
--- a/apps/web/src/components/dashboard/home-view.tsx
+++ b/apps/web/src/components/dashboard/home-view.tsx
@@ -91,24 +91,18 @@ const RECENT_COLUMNS = 5;
/** Recent projects the target menu offers before it gets unwieldy. */
const MENU_PROJECTS = 8;
-/** The half of the placeholder that stays put; the rest is typed after it. */
-const PROMPT_PREFIX = "Ask Diffusion Studio to";
-/** The edits the placeholder types its way through, one line at a time. */
+/** The edits the placeholder cycles through, one whole line at a time. */
const PROMPT_EXAMPLES = [
- "cut this interview down to 90 seconds",
- "add subtitles to every clip",
- "remove the silences from this recording",
- "grade the beach footage warmer",
- "animate a lower third for each speaker",
- "reframe the edit to 9:16 for social",
- "drop b-roll over the voiceover",
+ "Turn this footage into a polished YouTube video. Add readable captions and an attention-grabbing graphic in the opening to give viewers a strong visual hook.",
+ "Can you pull the best 30-second moment from https://youtu.be/MtQ0qxyf-Ds and make a vertical version for social?",
+ "In three bullets, explain what starts the conflict. Include timestamps. https://youtu.be/aqz-KE-bpKQ",
+ "Name three recurring locations and give one visual cue that distinguishes each. https://youtu.be/dQw4w9WgXcQ",
];
-/** Milliseconds a typed character, an erased one, and a finished line take. */
-const TYPE_MS = 42;
-const ERASE_MS = 22;
-const HOLD_MS = 2200;
+/** Milliseconds a line takes to fade in or out, and how long it stays readable. */
+const FADE_MS = 500;
+const HOLD_MS = 2400;
export function DashboardHomeView() {
const navigate = useNavigate();
@@ -128,7 +122,7 @@ export function DashboardHomeView() {
// Only worth animating while the field is empty — the placeholder is not on
// screen behind text the user has typed.
- const placeholder = createTypedPlaceholder(() => prompt().length === 0);
+ const placeholder = createFadingPlaceholder(() => prompt().length === 0);
const [projects, { refetch: refetchProjects }] = createResource(
projectsRoot,
@@ -426,16 +420,29 @@ export function DashboardHomeView() {
</div>
</Show>
- <textarea
- value={prompt()}
- onInput={(event) => setPrompt(event.currentTarget.value)}
- onKeyDown={handleKeyDown}
- onKeyUp={(event) => event.stopPropagation()}
- placeholder={placeholder()}
- aria-label="Describe the edit you want"
- rows={2}
- class="max-h-60 min-h-12 w-full resize-none overflow-auto bg-transparent p-1 text-[12px] leading-5 text-foreground outline-none placeholder:text-muted-foreground selection:bg-selection selection:text-selection-foreground"
- />
+ <div class="grid">
+ <Show when={prompt().length === 0}>
+ <span
+ aria-hidden="true"
+ class="pointer-events-none [grid-area:1/1] whitespace-pre-wrap break-words p-1 text-[12px] leading-5 text-muted-foreground transition-opacity ease-in-out"
+ style={{ "transition-duration": `${FADE_MS}ms` }}
+ classList={{ "opacity-0": !placeholder.visible() }}
+ >
+ {placeholder.line()}
+ </span>
+ </Show>
+
+ <textarea
+ value={prompt()}
+ onInput={(event) => setPrompt(event.currentTarget.value)}
+ onKeyDown={handleKeyDown}
+ onKeyUp={(event) => event.stopPropagation()}
+ aria-label="Describe the edit you want"
+ aria-placeholder={placeholder.line()}
+ rows={2}
+ class="[grid-area:1/1] max-h-60 min-h-12 w-full resize-none overflow-auto bg-transparent p-1 text-[12px] leading-5 text-foreground outline-none selection:bg-selection selection:text-selection-foreground"
+ />
+ </div>
<div class="flex min-h-4 items-center justify-between">
<AgentPicker
@@ -612,63 +619,52 @@ function AgentLogo(props: { id?: string }) {
);
}
-/** An example with the trailing dots the typing works its way through too. */
-function fullLine(index: number): string {
- return `${PROMPT_EXAMPLES[index]}...`;
-}
-
-/** `Ask Diffusion Studio to cut this`, however far the typing has got. */
-function composePlaceholder(typed: string): string {
- return typed ? `${PROMPT_PREFIX} ${typed}` : PROMPT_PREFIX;
-}
-
/**
- * The composer's placeholder: {@link PROMPT_PREFIX} stands still while the
- * rest types itself through {@link PROMPT_EXAMPLES} — a line arrives a
- * character at a time, trailing dots and all, holds long enough to be read,
- * erases, and the next one follows. It stops whenever `active` goes false, and for anyone who asked the
- * system for less motion it settles on the first line and stays there.
+ * The composer's placeholder, cycling through {@link PROMPT_EXAMPLES}: each
+ * prompt fades in whole, however many lines it wraps to, holds long enough
+ * to be read, fades out, and the next one follows. It pauses whenever `active` goes false, and for anyone who asked
+ * the system for less motion it settles on the first line and stays there.
*/
-function createTypedPlaceholder(active: () => boolean) {
+function createFadingPlaceholder(active: () => boolean) {
+ const [index, setIndex] = createSignal(0);
+ const line = () => PROMPT_EXAMPLES[index()];
+
if (
isServer ||
window.matchMedia("(prefers-reduced-motion: reduce)").matches
) {
- return () => composePlaceholder(fullLine(0));
+ return { line, visible: () => true };
}
- const [text, setText] = createSignal("");
- let line = 0;
- let erasing = false;
+ const [visible, setVisible] = createSignal(false);
let timer: ReturnType<typeof setTimeout> | undefined;
const step = () => {
- const shown = text();
- const full = fullLine(line);
-
- if (!erasing && shown.length < full.length) {
- setText(full.slice(0, shown.length + 1));
- timer = setTimeout(step, TYPE_MS);
- } else if (!erasing) {
- erasing = true;
- timer = setTimeout(step, HOLD_MS);
- } else if (shown.length > 0) {
- setText(shown.slice(0, -1));
- timer = setTimeout(step, ERASE_MS);
+ if (visible()) {
+ setVisible(false);
+ timer = setTimeout(step, FADE_MS);
} else {
- erasing = false;
- line = (line + 1) % PROMPT_EXAMPLES.length;
- timer = setTimeout(step, TYPE_MS);
+ setIndex((current) => (current + 1) % PROMPT_EXAMPLES.length);
+ setVisible(true);
+ timer = setTimeout(step, FADE_MS + HOLD_MS);
}
};
createEffect(() => {
clearTimeout(timer);
- if (active()) timer = setTimeout(step, TYPE_MS);
+ setVisible(false);
+ if (!active()) return;
+
+ // The span mounts at opacity 0 first, so its first line fades in like
+ // the rest instead of appearing in one go.
+ timer = setTimeout(() => {
+ setVisible(true);
+ timer = setTimeout(step, FADE_MS + HOLD_MS);
+ }, 50);
});
onCleanup(() => clearTimeout(timer));
- return () => composePlaceholder(text());
+ return { line, visible };
}
type AttachmentTileProps = {
diff --git a/apps/web/src/lib/agents.ts b/apps/web/src/lib/agents.ts
index 175c9e3e..5dc336a0 100644
--- a/apps/web/src/lib/agents.ts
+++ b/apps/web/src/lib/agents.ts
@@ -12,9 +12,9 @@
import { MAIN_CHANNELS } from "@desktop/main-channels";
import { mainBridge } from "@/lib/ipc";
-import type { AgentInfo, SetupResult, SetupStatus } from "@desktop/main-channels";
+import type { AgentInfo } from "@desktop/main-channels";
-export type { AgentInfo, SetupResult, SetupStatus };
+export type { AgentInfo };
/**
* The icon file for each agent, by the id `agent-links.ts` gives it. Kept on
@@ -74,33 +74,3 @@ export async function ensureAgentSetup(): Promise<void> {
const { mcp } = await mainBridge.call(MAIN_CHANNELS.SETUP_ENSURE, {});
if (mcp.status === "error") throw new Error(mcp.error);
}
-
-/**
- * The same steps as {@link ensureAgentSetup}, for a user who asked for them
- * by name rather than by sending a prompt: the CLI symlink is offered again
- * even after an earlier refusal, and the whole result comes back so the
- * caller can say what was done.
- */
-export async function connectAgents(): Promise<SetupResult> {
- if (!window.desktop) throw new Error("Connecting agents needs the desktop app");
-
- const result = await mainBridge.call(MAIN_CHANNELS.SETUP_ENSURE, { cli: "force" });
- if (result.mcp.status === "error") throw new Error(result.mcp.error);
- return result;
-}
-
-/**
- * What setup would find on this machine, without doing any of it.
- */
-export async function agentSetupStatus(): Promise<SetupStatus | null> {
- if (!window.desktop) return null;
- return mainBridge.call(MAIN_CHANNELS.SETUP_STATUS, undefined);
-}
-
-/**
- * Whether `status` leaves anything worth offering to do.
- */
-export function setupPending(status: SetupStatus | null | undefined): boolean {
- if (!status) return false;
- return !status.mcp || status.cli === "missing";
-}