Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(update): address review on the update button and the MCP notice
EtienneLescot520a5f0911a2
diff --git a/electron/main.ts b/electron/main.tsindex 2f8965c65..b0a7d38c2 100644--- a/electron/main.ts+++ b/electron/main.ts@@ -785,7 +785,12 @@ async function runBackgroundUpdateCheck() {}return;}- if (outcome.kind !== "downloaded") return;+ if (outcome.kind !== "downloaded") {+ // The release it advertised was pulled, or this copy got there another way. A ready+ // badge stays: its installer is on disk and still installs.+ if (outcome.kind === "current" && updateBadge?.state === "available") setUpdateBadge(null);+ return;+ }const { version } = outcome;if (updateBadge?.state === "ready" && updateBadge.version === version) return;// A translocated Mac cannot install, so there is no point fetching: it gets the button@@ -818,13 +823,14 @@ async function applyUpdate() {try {if (updateReleasePage) {await shell.openExternal(updateReleasePage);- } else if (badge.state === "available") {- await downloadAndInstall(badge.version);- } else {- const blocked = installBlock();- if (blocked) await showBlockedInstall(blocked);- else await installSelfUpdate();+ return;}+ // Asked before any download: one started mid-take would compete with the encoder, and+ // only be refused once it had finished.+ const blocked = installBlock();+ if (blocked) await showBlockedInstall(blocked);+ else if (badge.state === "available") await downloadAndInstall(badge.version);+ else await installSelfUpdate();} finally {applyUpdateInFlight = false;}diff --git a/electron/mcp/update-notice.test.ts b/electron/mcp/update-notice.test.tsindex b4ce6947b..9ccbb2c94 100644--- a/electron/mcp/update-notice.test.ts+++ b/electron/mcp/update-notice.test.ts@@ -1,8 +1,14 @@import { mkdtempSync, rmSync, writeFileSync } from "node:fs";import os from "node:os";import path from "node:path";+import { Client } from "@modelcontextprotocol/sdk/client/index.js";+import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";import { afterEach, describe, expect, it, vi } from "vitest";-import { mcpInstructions } from "./openscreen-mcp-server";+import {+ createOpenScreenMcpServer,+ type McpToolDeps,+ mcpInstructions,+} from "./openscreen-mcp-server";import {RELEASE_LOOKUP_INTERVAL_MS,readReleaseLookup,@@ -49,10 +55,32 @@ describe("updateNotice", () => {it("names both versions and leaves the update to the user", () => {const notice = updateNotice("2.1.2", { latestVersion: "2.2.0", checkedAt: 0 });expect(notice).toContain("OpenScreen 2.2.0 is available; this is 2.1.2.");- expect(notice).toContain("opening the OpenScreen app");+ expect(notice).toContain("the OpenScreen app shows an update button");expect(notice).toContain("Never update OpenScreen yourself.");});+ // Through the server itself, as a client receives it in the initialize answer: a dropped+ // `updateNotice` between the deps and the instructions would pass the test below.+ it("reaches the client in the server's instructions", async () => {+ // Only what building the server reads; no tool is called.+ const deps = {+ transport: "stdio",+ editsAllowed: () => true,+ version: "2.1.2",+ updateNotice: "OpenScreen 2.2.0 is available.",+ } as McpToolDeps;+ const server = createOpenScreenMcpServer(deps, vi.fn());+ const [clientSide, serverSide] = InMemoryTransport.createLinkedPair();+ await server.connect(serverSide);+ const client = new Client({ name: "test", version: "1" });+ await client.connect(clientSide);+ try {+ expect(client.getInstructions()?.startsWith("OpenScreen 2.2.0 is available.\n")).toBe(true);+ } finally {+ await client.close();+ }+ });+it("opens the stdio instructions, ahead of the editing guidance", () => {const instructions = mcpInstructions({transport: "stdio",@@ -98,6 +126,18 @@ describe("refreshReleaseLookup", () => {expect(fetchLatest).toHaveBeenCalledTimes(2);});+ it("looks again when the cached lookup is dated in the future", async () => {+ const dir = userData();+ writeFileSync(+ path.join(dir, "mcp-update-check.json"),+ JSON.stringify({ latestVersion: "2.1.2", checkedAt: 10_000 }),+ );+ const fetchLatest = release("v2.2.0");+ await refreshReleaseLookup({ userData: dir, currentVersion: "2.1.2", fetchLatest, now: 1000 });+ expect(fetchLatest).toHaveBeenCalledTimes(1);+ expect(readReleaseLookup(dir)).toEqual({ latestVersion: "2.2.0", checkedAt: 1000 });+ });+it("reads a corrupt cache as no lookup at all", () => {const dir = userData();writeFileSync(path.join(dir, "mcp-update-check.json"), "{not json");diff --git a/electron/mcp/update-notice.ts b/electron/mcp/update-notice.tsindex 2d4d3c5a9..d3d724790 100644--- a/electron/mcp/update-notice.ts+++ b/electron/mcp/update-notice.ts@@ -40,7 +40,7 @@ export function updateNotice(currentVersion: string, lookup: ReleaseLookup | nul} catch {return null;}- return `OpenScreen ${lookup.latestVersion} is available; this is ${currentVersion}. Tell the user once, when it fits, that they can install it by opening the OpenScreen app. Never update OpenScreen yourself.`;+ return `OpenScreen ${lookup.latestVersion} is available; this is ${currentVersion}. Tell the user once, when it fits, that the OpenScreen app shows an update button for it once they open it. Never update OpenScreen yourself.`;}/** Looks the latest release up if the cached answer is older than the interval. Throws on a@@ -53,7 +53,10 @@ export async function refreshReleaseLookup(options: {}): Promise<void> {const now = options.now ?? Date.now();const cached = readReleaseLookup(options.userData);- if (cached && now - cached.checkedAt < RELEASE_LOOKUP_INTERVAL_MS) return;+ // A lookup dated in the future (a clock set back since) is not fresh: it would otherwise hold+ // every lookup off until the clock caught up.+ const age = cached ? now - cached.checkedAt : Number.POSITIVE_INFINITY;+ if (age >= 0 && age < RELEASE_LOOKUP_INTERVAL_MS) return;const result = await checkLatestRelease({currentVersion: options.currentVersion,fetchLatest: options.fetchLatest,diff --git a/technical-documentation/architecture/mcp-server.md b/technical-documentation/architecture/mcp-server.mdindex 7264d7734..b9b9f2286 100644--- a/technical-documentation/architecture/mcp-server.md+++ b/technical-documentation/architecture/mcp-server.md@@ -64,7 +64,7 @@ The server's one resource, `openscreen://effects/contract` ([`effects-contract.tEvery text a client reads must be true on the server that serves it, so the texts are composed rather than shared verbatim. `McpToolDeps.transport` (`"http"` or `"stdio"`) selects them:- **Instructions** (`mcpInstructions`): the media tools' capability block (`mediaPreamble`), then the projects-and-checkpoints rules of the transport, then how long checkpoints live there, then `buildSystemPrompt`. The checkpoint rule is in both. Over HTTP the media block says a take goes through the app's recording bar and opens in the editor, and the rules speak of the editor and its undo stack; while **MCP edits** is off, a line says `startRecording`, `exportVideo` and `createProject` are refused too. Over stdio the media block says the takes land in the app's project list, and the rules say that calls go through the app while it runs (the open project live, with `Ctrl/Cmd+Z`), and to the files when it does not.-- **A newer OpenScreen** (`update-notice.ts`), stdio only, and only on an install that updates itself (a Store, Flathub, Snap or Nix copy is kept current by its package manager). A user who reaches OpenScreen only through an agent never sees the app's update button, so `openscreen mcp` looks the latest release up on GitHub, at most every six hours, in the background and cached in `mcp-update-check.json`. When the cache names a newer version, a line opens the instructions: tell the user once that they can install it by opening the app, and never update OpenScreen yourself. The process itself updates nothing: its stdout is the protocol, its lifetime is the client's, and the NSIS installer would end it. The lookup never holds the handshake back, so the session that finds a release says nothing and the next one does.+- **A newer OpenScreen** (`update-notice.ts`), stdio only, and only on an install that updates itself (a Store, Flathub, Snap or Nix copy is kept current by its package manager). A user who reaches OpenScreen only through an agent never sees the app's update button, so `openscreen mcp` looks the latest release up on GitHub, at most every six hours, in the background and cached in `mcp-update-check.json`. When the cache names a newer version, a line opens the instructions: tell the user once that the app shows an update button for it once they open it, and never update OpenScreen yourself. The process itself updates nothing: its stdout is the protocol, its lifetime is the client's, and the NSIS installer would end it. The lookup never holds the handshake back, so the session that finds a release says nothing and the next one does.- **`buildSystemPrompt`** takes the transport's facts as options: `editsSetting` names the switch its consent block points to (the MCP server's **MCP edits**, not the in-app agent's **Agent edits**), and `canExport` drops "exporting" from its examples of a request with no tool, since both serve `exportVideo`.- **Tool descriptions**: `projectId` is "omit it for the open project" over HTTP and "omit it only for the open project, while the app runs" over stdio. `startRecording` and `stopRecording` say how each server makes a take ([below](#the-media-tools)), and the paths of `exportVideo` and `getFrames` must be absolute over HTTP: the app has no working directory of the client's.- **Messages**: no project to fall back on, a checkpoint required, an unknown checkpoint, edits turned off. Each has a version per transport, or exists only on the one that can produce it. The stdio versions are only met with no app answering, and say so.