Skip to content

The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.

Desktop: agents start on Windows again, and an update installs on quit even when reopened at once (#109)

riverisbuilding5f8b70f8a453
diff --git a/.changeset/update-installs-on-quit.md b/.changeset/update-installs-on-quit.md
new file mode 100644
index 0000000..02206d9
--- /dev/null
+++ b/.changeset/update-installs-on-quit.md
@@ -0,0 +1,6 @@
+---
+"@openfilm/desktop": patch
+"openfilm": patch
+---
+
+On macOS, an update that is ready now installs when you quit even if you open OpenFilm again right away. Opened while the update is still being installed, OpenFilm waits for the install to finish and then opens as the new version. If an install did not happen, the next launch installs it in a small window that says so, then opens as the new version. The update notice says what happens when you quit.
diff --git a/.changeset/windows-registry-expanded.md b/.changeset/windows-registry-expanded.md
new file mode 100644
index 0000000..aa0394b
--- /dev/null
+++ b/.changeset/windows-registry-expanded.md
@@ -0,0 +1,5 @@
+---
+"@openfilm/desktop": patch
+---
+
+Desktop on Windows: agents start again. The variables read from the registry are expanded as Windows does (REG_EXPAND_SZ ones only) before they are handed on, so Codex finds `cmd.exe` through `ComSpec`.
diff --git a/apps/desktop/shell/bridge.ts b/apps/desktop/shell/bridge.ts
index 5568c04..330597d 100644
--- a/apps/desktop/shell/bridge.ts
+++ b/apps/desktop/shell/bridge.ts
@@ -34,6 +34,7 @@ interface Native {
prefs: { get(): Promise<AppPrefs>; set(next: Partial<AppPrefs>): Promise<unknown>; onChange(listener: Listener<AppPrefs>): Stop };
saveLayout(layout: { chatOpen: boolean; chatWidth: number }): void;
setTheme(theme: Theme): void;
+ setLanguage(language: string): void;
onFullScreen(listener: Listener<boolean>): Stop;
onToggleChat(listener: Listener<void>): Stop;
onOpenSettings(listener: Listener<void>): Stop;
@@ -127,6 +128,9 @@ new MutationObserver(() => {
/* the window behind the page, and the system's menus and dialogs, take the same theme */
native.setTheme(theme.get());
theme.on((next) => native.setTheme(next));
+/* and the app keeps the language, for the window it shows before the page (an update installed at launch) */
+native.setLanguage(language.get());
+language.on((next) => native.setLanguage(next));
/* ── the project Studio shows (its address, /projects/<id>) ── */
const project = signal<Project | null>(null);
diff --git a/apps/desktop/src/environment.mjs b/apps/desktop/src/environment.mjs
index 7b3d1a8..5187de8 100644
--- a/apps/desktop/src/environment.mjs
+++ b/apps/desktop/src/environment.mjs
@@ -135,12 +135,18 @@ function captureLoginShell(shell, env, timeoutMs) {
});
}
-/** `reg query <key>` output, read: each value's name and its text (REG_SZ and REG_EXPAND_SZ only). */
-export function parseRegQuery(text) {
+/**
+ * `reg query <key>` output, read: each value's name and its text (REG_SZ and REG_EXPAND_SZ only). `expandable`, when
+ * given, gets the names of the REG_EXPAND_SZ ones: Windows expands those, never a REG_SZ.
+ * @param {string} text @param {Set<string>} [expandable]
+ */
+export function parseRegQuery(text, expandable) {
const values = {};
for (const line of String(text ?? '').split(/\r?\n/)) {
const m = /^\s{2,}(\S(?:.*?\S)?)\s{2,}(REG_SZ|REG_EXPAND_SZ)\s{2,}(.*)$/.exec(line);
- if (m) values[m[1]] = m[3].trim();
+ if (!m) continue;
+ values[m[1]] = m[3].trim();
+ if (m[2] === 'REG_EXPAND_SZ') expandable?.add(m[1]);
}
return values;
}
@@ -151,16 +157,27 @@ export function expandWindowsVars(text, vars) {
return String(text ?? '').replace(/%([^%;]+)%/g, (all, name) => (typeof lower.get(name.toLowerCase()) === 'string' ? lower.get(name.toLowerCase()) : all));
}
-const valueOf = (vars, name) => Object.entries(vars ?? {}).find(([k]) => k.toLowerCase() === name.toLowerCase())?.[1];
+/**
+ * Whether Windows expands a registry value: only a REG_EXPAND_SZ one, which `expandable` (from parseRegQuery) lists.
+ * Without a list, every value is taken as one.
+ * @param {Set<string> | undefined} expandable @param {string} name
+ */
+const expands = (expandable, name) => !expandable || expandable.has(name);
/**
* The PATH Windows gives a program started now: the system's, then the person's (as the registry has them, their
- * variables expanded), then whatever else the app's own PATH has. Each folder once, whatever its case.
+ * variables expanded when they are REG_EXPAND_SZ), then whatever else the app's own PATH has. Each folder once,
+ * whatever its case. `expand`: the REG_EXPAND_SZ names of each part (parseRegQuery).
*/
-export function windowsFreshPath({ machine = {}, user = {}, source = process.env } = {}) {
+export function windowsFreshPath({ machine = {}, user = {}, source = process.env, expand = undefined } = {}) {
const vars = { ...source, ...machine, ...user };
- const dirs = [valueOf(machine, 'Path'), valueOf(user, 'Path'), pathOf(source)]
- .flatMap((p) => expandWindowsVars(p ?? '', vars).split(';'))
+ const pathIn = (values, expandable) => {
+ const name = Object.keys(values ?? {}).find((k) => k.toLowerCase() === 'path');
+ if (name === undefined) return '';
+ return expands(expandable, name) ? expandWindowsVars(values[name], vars) : values[name];
+ };
+ const dirs = [pathIn(machine, expand?.machine), pathIn(user, expand?.user), expandWindowsVars(pathOf(source), vars)]
+ .flatMap((p) => p.split(';'))
.map((d) => d.trim().replace(/^"(.*)"$/, '$1'))
.filter(Boolean);
const seen = new Map();
@@ -174,7 +191,11 @@ const REG_USER = 'HKCU\\Environment';
function regQuery(key, timeoutMs) {
return new Promise((resolve) => {
const reg = join(process.env.SystemRoot ?? 'C:\\Windows', 'System32', 'reg.exe');
- execFile(reg, ['query', key], { timeout: timeoutMs, encoding: 'utf8', windowsHide: true }, (error, stdout) => resolve(error ? null : parseRegQuery(stdout)));
+ execFile(reg, ['query', key], { timeout: timeoutMs, encoding: 'utf8', windowsHide: true }, (error, stdout) => {
+ if (error) return resolve(null);
+ const expandable = new Set();
+ resolve({ values: parseRegQuery(stdout, expandable), expandable });
+ });
});
}
@@ -206,13 +227,31 @@ export function environmentCache(read, { forMs, fallback, now = Date.now }) {
};
}
+/**
+ * The registry's variables as a program started now has them: the person's over the system's, each REG_EXPAND_SZ
+ * one's `%NAME%` expanded (ComSpec is stored as %SystemRoot%\system32\cmd.exe) and a REG_SZ one as it is, and PATH
+ * from windowsFreshPath in place of either Path. `expand`: the REG_EXPAND_SZ names of each part (parseRegQuery).
+ */
+export function registryVariables({ machine = {}, user = {}, source = process.env, expand = undefined } = {}) {
+ const raw = { ...machine, ...user };
+ const vars = { ...source, ...raw };
+ const env = {};
+ for (const [key, value] of Object.entries(raw)) {
+ if (key.toLowerCase() === 'path') continue;
+ const expandable = Object.hasOwn(user, key) ? expand?.user : expand?.machine;
+ env[key] = expands(expandable, key) ? expandWindowsVars(expandWindowsVars(value, vars), vars) : value;
+ }
+ env.PATH = windowsFreshPath({ machine, user, source, expand });
+ return env;
+}
+
/** The registry's environment (Windows): null when neither part of it could be read. */
async function readRegistry(source, timeoutMs) {
const [machine, user] = await Promise.all([regQuery(REG_MACHINE, timeoutMs), regQuery(REG_USER, timeoutMs)]);
if (!machine && !user) return null;
pathSource = 'registry';
- /* the person's own variables as they are now, over the system's */
- return shellVariables({ ...machine, ...user, PATH: windowsFreshPath({ machine: machine ?? {}, user: user ?? {}, source }) }, homedir());
+ const expand = { machine: machine?.expandable ?? new Set(), user: user?.expandable ?? new Set() };
+ return shellVariables(registryVariables({ machine: machine?.values ?? {}, user: user?.values ?? {}, source, expand }), homedir());
}
/** The login shell's variables (shellVariables): null when it gave no PATH (it failed, or took too long). */
diff --git a/apps/desktop/src/environment.test.mjs b/apps/desktop/src/environment.test.mjs
index 383f5ea..c23eeec 100644
--- a/apps/desktop/src/environment.test.mjs
+++ b/apps/desktop/src/environment.test.mjs
@@ -1,6 +1,11 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
-import { environmentCache, expandWindowsVars, parseRegQuery, shellSubset, shellVariables, windowsFreshPath } from './environment.mjs';
+import { spawnSync } from 'node:child_process';
+import { existsSync } from 'node:fs';
+import {
+ childEnvironment, environmentCache, expandWindowsVars, lastPathSource, loginShellVariables, parseRegQuery, registryVariables, shellSubset,
+ shellVariables, windowsFreshPath,
+} from './environment.mjs';
const PROFILE = ['C:', 'Users', 'someone'].join('\\');
@@ -38,6 +43,50 @@ test("the PATH a program started now gets: the system's, the person's (with thei
].join(';'));
});
+test("the registry's variables are handed on expanded, so an agent finds cmd.exe through ComSpec", () => {
+ const machine = { ComSpec: '%SystemRoot%\\system32\\cmd.exe', SystemRoot: 'C:\\Windows', Path: '%SystemRoot%\\system32' };
+ const user = parseRegQuery(USER);
+ const env = registryVariables({ machine, user, source: { USERPROFILE: PROFILE } });
+ assert.equal(env.ComSpec, 'C:\\Windows\\system32\\cmd.exe');
+ assert.equal(env.TEMP, `${PROFILE}\\AppData\\Local\\Temp`);
+ assert.equal(env.Path, undefined, 'one PATH only');
+ assert.match(env.PATH, /^C:\\Windows\\system32;/);
+});
+
+test('only REG_EXPAND_SZ values are expanded, as Windows does: a REG_SZ one keeps its %VARIABLE% as it is', () => {
+ const machine = new Set();
+ const user = new Set();
+ const env = registryVariables({
+ machine: parseRegQuery([
+ ' ComSpec REG_EXPAND_SZ %SystemRoot%\\system32\\cmd.exe',
+ ' Literal REG_SZ %SystemRoot%\\kept',
+ ' Path REG_SZ %SystemRoot%\\system32;C:\\Tools',
+ ' SystemRoot REG_SZ C:\\Windows',
+ ].join('\r\n'), machine),
+ user: parseRegQuery(USER, user),
+ source: { USERPROFILE: PROFILE },
+ expand: { machine, user },
+ });
+ assert.deepEqual([...machine], ['ComSpec']);
+ assert.equal(env.ComSpec, 'C:\\Windows\\system32\\cmd.exe');
+ assert.equal(env.Literal, '%SystemRoot%\\kept');
+ assert.equal(env.TEMP, `${PROFILE}\\AppData\\Local\\Temp`);
+ assert.match(env.PATH, /^%SystemRoot%\\system32;C:\\Tools;C:\\Users\\someone\\AppData\\Local\\Microsoft\\WindowsApps;/);
+});
+
+test("on Windows, an agent given this machine's registry environment starts cmd.exe through ComSpec", { skip: process.platform !== 'win32' }, async () => {
+ const env = childEnvironment({ shell: await loginShellVariables({ maxAgeMs: 0 }) });
+ assert.equal(lastPathSource(), 'registry');
+ const comspec = Object.entries(env).filter(([k]) => k.toLowerCase() === 'comspec');
+ assert.equal(comspec.length, 1, 'one ComSpec');
+ assert.doesNotMatch(comspec[0][1], /%/);
+ assert.ok(existsSync(comspec[0][1]), comspec[0][1]);
+ /* what an agent does with it: Node runs a shell command through its own ComSpec */
+ const r = spawnSync(process.execPath, ['-e', "process.stdout.write(require('node:child_process').execSync('echo ok', { encoding: 'utf8' }))"], { env, encoding: 'utf8' });
+ assert.equal(r.status, 0, r.stderr);
+ assert.equal(r.stdout.trim(), 'ok');
+});
+
test('the environment is read again once it is old, sooner when asked; a failed read keeps the last good one', async () => {
let clock = 0;
const reads = [];
diff --git a/apps/desktop/src/i18n/install-window.mjs b/apps/desktop/src/i18n/install-window.mjs
new file mode 100644
index 0000000..aaab2b6
--- /dev/null
+++ b/apps/desktop/src/i18n/install-window.mjs
@@ -0,0 +1,8 @@
+/** What the window of an update installed at launch says (update-launch.mjs), in each of Studio's languages. */
+export const INSTALL_WORDS = {
+ en: { title: 'Installing {name} {version}…', detail: '{name} opens again when it is done.' },
+ 'zh-CN': { title: '正在安装 {name} {version}…', detail: '安装完成后 {name} 会自动打开。' },
+ ja: { title: '{name} {version} をインストールしています…', detail: '完了すると {name} が自動的に開きます。' },
+ ko: { title: '{name} {version} 설치 중…', detail: '설치가 끝나면 {name}이(가) 자동으로 열립니다.' },
+ es: { title: 'Instalando {name} {version}…', detail: '{name} se abrirá de nuevo cuando termine.' },
+};
diff --git a/apps/desktop/src/installing.html b/apps/desktop/src/installing.html
new file mode 100644
index 0000000..e0bf4a1
--- /dev/null
+++ b/apps/desktop/src/installing.html
@@ -0,0 +1,36 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'">
+<title>OpenFilm</title>
+<style>
+ :root { color-scheme: light dark; }
+ html, body { height: 100%; margin: 0; }
+ body { display: grid; place-items: center; background: #f2f2f2; color: #1f1f1f; font: 13px/1.5 -apple-system, system-ui, sans-serif; -webkit-app-region: drag; user-select: none; cursor: default; }
+ @media (prefers-color-scheme: dark) { body { background: #111; color: #dadada; } }
+ main { width: 100%; padding: 0 28px; box-sizing: border-box; }
+ h1 { font-size: 14px; font-weight: 600; margin: 0 0 4px; }
+ p { margin: 0 0 14px; opacity: .65; }
+ .bar { position: relative; height: 4px; border-radius: 2px; overflow: hidden; background: color-mix(in srgb, currentColor 12%, transparent); }
+ .bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 35%; border-radius: 2px; background: #1a93fe; animation: slide 1.2s ease-in-out infinite; }
+ @keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
+ @media (prefers-reduced-motion: reduce) { .bar::after { animation-duration: 3.6s; } }
+</style>
+</head>
+<body>
+<!-- A launch that installs the update quitting did not (update-launch.mjs): what it is doing, until the app restarts -->
+<main>
+ <h1 id="title"></h1>
+ <p id="detail"></p>
+ <div class="bar" role="progressbar" aria-busy="true"></div>
+</main>
+<script>
+ const words = new URLSearchParams(location.search);
+ document.documentElement.lang = words.get('lang') || 'en';
+ document.getElementById('title').textContent = words.get('title') || '';
+ document.getElementById('detail').textContent = words.get('detail') || '';
+ document.querySelector('.bar').setAttribute('aria-label', words.get('title') || '');
+</script>
+</body>
+</html>
diff --git a/apps/desktop/src/main.mjs b/apps/desktop/src/main.mjs
index 7b818c5..9ac6f87 100644
--- a/apps/desktop/src/main.mjs
+++ b/apps/desktop/src/main.mjs
@@ -30,6 +30,7 @@ import { checkAgentProgram, closeEverySession, diagnoseAgent, listAgents, localA
import { agentUsage, forgetAgentUsage } from './agent-usage.mjs';
import { installOpenfilmCommand } from './openfilm-command.mjs';
import { startUpdates } from './updates.mjs';
+import { stepAside } from './update-launch.mjs';
import { ensureFfmpeg, ffmpegDir, ffmpegDownloadable, ffmpegIn, ffmpegOnPath } from './ffmpeg-runtime.mjs';
import { PATH_SEP } from './environment.mjs';
import { createTabs } from './tabs.mjs';
@@ -53,6 +54,10 @@ const log = (line) => { try { appendFileSync(join(LOGS, 'studio.log'), line); }
if (!app.requestSingleInstanceLock()) {
app.quit();
+} else if (mac && app.isPackaged && stepAside({ dir: DATA, version: app.getVersion(), bundleId: IDENTITY.bundleId, execPath: process.execPath, argv: process.argv })) {
+ /* opened while the update quitting started is being installed: running now would stop it, so the new version opens
+ when it is done (update-launch.mjs) */
+ app.exit(0);
} else {
app.on('second-instance', () => focusWindow());
app.whenReady().then(start).catch((error) => {
@@ -380,6 +385,36 @@ async function runStudio(env) {
}
async function start() {
+ /* updates (updates.mjs): Restart waits while an agent's turn runs or Studio exports, either would be lost */
+ updates = startUpdates({
+ dataDir: DATA,
+ productName: PRODUCT_NAME,
+ getWindow: () => win,
+ onState: (next) => broadcast('desktop:update', next),
+ prepareRestart: async () => {
+ if (localAgents?.isBusy()) return { ok: false, error: 'agent-busy' };
+ /* Studio's quit-when-idle answers 409 while it exports; otherwise the window's Studio stays (studio-process.mjs
+ `stays`, 423), and is stopped in beforeInstall. No answer: no Studio, no export to lose. */
+ const res = studio && await fetch(`${studio.origin}/api/quit`, {
+ method: 'POST', headers: { 'x-studio-key': studio.key, 'content-type': 'application/json' },
+ body: JSON.stringify({ whenIdle: true }), signal: AbortSignal.timeout(3000),
+ }).catch(() => null);
+ return res?.status === 409 ? { ok: false, error: 'exporting' } : { ok: true };
+ },
+ /* what before-quit would do, done first (`quitting`), so the quit Squirrel starts is not held up or cancelled */
+ beforeInstall: async () => {
+ quitting = true;
+ localAgents?.closeAll();
+ closeEverySession();
+ for (const v of views.values()) v.webContents.on('will-prevent-unload', (event) => event.preventDefault());
+ await studio?.quit();
+ updates?.close();
+ },
+ });
+ /* an update quitting did not install is installed now, before anything else opens (update-launch.mjs) */
+ const launch = await updates.installAtLaunch({ language: state.language });
+ if (launch.installing) return;
+
const shellEnv = await loginShellEnvironment();
const env = childEnvironment({
shell: shellEnv,
@@ -427,6 +462,7 @@ async function start() {
...(windows ? { titleBarStyle: 'hidden', titleBarOverlay: overlayColours(theme), autoHideMenuBar: true, icon: here('../build/icon.png') } : {}),
});
if (state.maximized) win.maximize();
+ launch.dismiss();
win.on('resize', layout);
win.on('resized', saveState);
@@ -437,6 +473,12 @@ async function start() {
win.on('closed', () => { win = null; views.clear(); pagePresentation = null; app.quit(); });
ipcMain.on('desktop:theme', (event, next) => { if (fromPage(event)) setTheme(next); });
+ /* the page's language, kept for what the app shows before a page is up (the update installed at launch) */
+ ipcMain.on('desktop:language', (event, next) => {
+ if (!fromPage(event) || typeof next !== 'string' || next === state.language) return;
+ state = { ...state, language: next.slice(0, 20) };
+ try { writeWindowState(DATA, state); } catch { /* kept until next time */ }
+ });
ipcMain.handle('desktop:hello', (event) => {
if (!fromPage(event)) throw new Error('not the window\'s page');
return { flavor: FLAVOR, version: app.getVersion(), ffmpeg: ffmpegFound, update: updates?.snapshot() ?? null, chatOpen: state.chatOpen, chatWidth: state.chatWidth, chatMin: CHAT_MIN, studioMin: STUDIO_MIN, fullScreen: Boolean(win?.isFullScreen()) };
@@ -587,32 +629,6 @@ async function start() {
return image && !image.isEmpty() ? image.toJPEG(88).toString('base64') : null;
});
- /* updates (updates.mjs): Restart waits while an agent's turn runs or Studio exports, either would be lost */
- updates = startUpdates({
- dataDir: DATA,
- productName: PRODUCT_NAME,
- getWindow: () => win,
- onState: (next) => broadcast('desktop:update', next),
- prepareRestart: async () => {
- if (localAgents?.isBusy()) return { ok: false, error: 'agent-busy' };
- /* Studio's quit-when-idle answers 409 while it exports; otherwise the window's Studio stays (studio-process.mjs
- `stays`, 423), and is stopped in beforeInstall. No answer: no Studio, no export to lose. */
- const res = studio && await fetch(`${studio.origin}/api/quit`, {
- method: 'POST', headers: { 'x-studio-key': studio.key, 'content-type': 'application/json' },
- body: JSON.stringify({ whenIdle: true }), signal: AbortSignal.timeout(3000),
- }).catch(() => null);
- return res?.status === 409 ? { ok: false, error: 'exporting' } : { ok: true };
- },
- /* what before-quit would do, done first (`quitting`), so the quit Squirrel starts is not held up or cancelled */
- beforeInstall: async () => {
- quitting = true;
- localAgents?.closeAll();
- closeEverySession();
- for (const v of views.values()) v.webContents.on('will-prevent-unload', (event) => event.preventDefault());
- await studio?.quit();
- updates?.close();
- },
- });
ipcMain.handle('desktop:update-restart', (event) => (fromPage(event) ? updates?.restart() : { ok: false }));
/* Settings → About: the state now, and a check that answers with the state it ends in (no dialog) */
ipcMain.handle('desktop:update-state', (event) => (fromPage(event) ? updates?.snapshot() ?? null : null));
diff --git a/apps/desktop/src/preload.cjs b/apps/desktop/src/preload.cjs
index 29bcf08..e5ced4b 100644
--- a/apps/desktop/src/preload.cjs
+++ b/apps/desktop/src/preload.cjs
@@ -119,6 +119,8 @@ contextBridge.exposeInMainWorld('openfilmNative', {
saveLayout: (layout) => ipcRenderer.send('desktop:layout', { chatOpen: layout?.chatOpen === true, chatWidth: Number(layout?.chatWidth) }),
/* the page's theme, for the window behind it and the system's menus and dialogs */
setTheme: (theme) => ipcRenderer.send('desktop:theme', theme === 'dark' ? 'dark' : 'light'),
+ /* the page's language, for what the app shows before a page is up */
+ setLanguage: (language) => ipcRenderer.send('desktop:language', String(language)),
onFullScreen: on('desktop:full-screen'),
/* View → Chat in the app's menu */
onToggleChat: on('desktop:toggle-chat'),
diff --git a/apps/desktop/src/update-launch.mjs b/apps/desktop/src/update-launch.mjs
new file mode 100644
index 0000000..f432051
--- /dev/null
+++ b/apps/desktop/src/update-launch.mjs
@@ -0,0 +1,129 @@
+/**
+ * An update that is ready, as the app's next launch sees it (macOS). Quitting installs it: Squirrel.Mac's ShipIt waits
+ * for the app to close, then swaps the app's files, which takes several seconds for an app this size. An app opened
+ * in those seconds stops the install (ShipIt gives up while the app runs), so a launch:
+ *
+ * · while ShipIt installs: steps aside. It exits at once, and a small script opens the app again when ShipIt is done,
+ * as the new version (stepAside).
+ * · after an install that did not happen: installs it now, in a small window that says so, and opens as the new
+ * version (updates.mjs `installAtLaunch`, readyToInstall).
+ *
+ * Which update is waiting is `update-pending.json` in the app's data folder, written when one is ready and removed
+ * once the app runs that version or newer. Reads no Electron module, so `node --test` can use it.
+ */
+import { execFileSync, spawn } from 'node:child_process';
+import { mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { join, posix } from 'node:path';
+import { INSTALL_WORDS as WORDS } from './i18n/install-window.mjs';
+import { isNewer } from './update-controller.mjs';
+
+const PENDING = 'update-pending.json';
+/** what the script that opens the app again passes, so that launch never steps aside a second time */
+export const AFTER_INSTALL = '--after-install';
+/** how long the script waits for ShipIt before it opens the app anyway */
+export const HAND_OFF_SECONDS = 60;
+/** how long a launch that installs waits for the update to be ready again, before it opens as it is */
+export const LAUNCH_INSTALL_MS = 45_000;
+
+/** Remember the update that is ready, for the next launch. */
+export function writePendingUpdate(dir, version) {
+ try {
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(join(dir, PENDING), `${JSON.stringify({ version })}\n`);
+ } catch { /* the next launch opens as it is */ }
+}
+
+export function clearPendingUpdate(dir) {
+ rmSync(join(dir, PENDING), { force: true });
+}
+
+/** The version waiting to be installed, if it is newer than this one; an older note is removed. */
+export function pendingUpdate(dir, current) {
+ let version = null;
+ try { version = JSON.parse(readFileSync(join(dir, PENDING), 'utf8')).version; } catch { return null; }
+ if (isNewer(version, current)) return version;
+ try { clearPendingUpdate(dir); } catch { /* read again next time */ }
+ return null;
+}
+
+/** ShipIt's process for this app, while it runs (launchd's job `<bundle id>.ShipIt`), or null. */
+export function installerPid(bundleId, run = (file, args) => execFileSync(file, args, { encoding: 'utf8', timeout: 2000, stdio: ['ignore', 'pipe', 'ignore'] })) {
+ try {
+ const pid = Number(/"PID" = (\d+);/.exec(run('/bin/launchctl', ['list', `${bundleId}.ShipIt`]))?.[1]);
+ return pid > 0 ? pid : null;
+ } catch { return null; }
+}
+
+/** The .app the running executable is in (…/OpenFilm.app/Contents/MacOS/OpenFilm). */
+export const appBundle = (execPath) => posix.resolve(posix.dirname(execPath), '..', '..');
+
+/* waits for ShipIt ($1) to finish, at most HAND_OFF_SECONDS, then opens the app ($2) */
+export const HAND_OFF_SCRIPT = [
+ 'i=0',
+ `while ps -p "$1" >/dev/null 2>&1 && [ "$i" -lt ${HAND_OFF_SECONDS * 2} ]; do sleep 0.5; i=$((i+1)); done`,
+ `exec open "$2" --args ${AFTER_INSTALL}`,
+].join('\n');
+
+/**
+ * Step aside for an install under way: true when this launch should exit now (the script it started opens the app
+ * once ShipIt is done). Only a launch with an update waiting, while ShipIt runs, and not the one the script opened.
+ */
+export function stepAside({ dir, version, bundleId, execPath, argv, pidOf = installerPid, start = spawn }) {
+ if (argv.includes(AFTER_INSTALL) || !pendingUpdate(dir, version)) return false;
+ const pid = pidOf(bundleId);
+ if (!pid) return false;
+ try {
+ start('/bin/sh', ['-c', HAND_OFF_SCRIPT, 'openfilm-update', String(pid), appBundle(execPath)], { detached: true, stdio: 'ignore' }).unref();
+ return true;
+ } catch { return false; }
+}
+
+/**
+ * Get the waiting update ready again (a check finds it downloaded; Squirrel takes it), for a launch that installs it:
+ * true once it is ready, false when the check finds nothing newer, fails, or takes longer than `ms`.
+ * @param {{ controller: { check: () => Promise<any>, snapshot: () => { status: string } },
+ * subscribe: (listener: (state: { status: string }) => void) => () => void, ms?: number }} options
+ */
+export function readyToInstall({ controller, subscribe, ms = LAUNCH_INSTALL_MS }) {
+ return new Promise((done) => {
+ let stop = () => {};
+ const timer = setTimeout(() => finish(false), ms);
+ function finish(ready) {
+ clearTimeout(timer);
+ stop();
+ done(ready);
+ }
+ const look = ({ status }) => {
+ if (status === 'ready') finish(true);
+ else if (status === 'current' || status === 'error') finish(false);
+ };
+ stop = subscribe(look);
+ look(controller.snapshot());
+ void controller.check().then(look, () => finish(false));
+ });
+}
+
+
+/**
+ * The install window's language: the one Studio was last shown in, else the system's as Studio picks it (its i18n
+ * `languageFor`): `zh-Hans-CN` and `zh` are Simplified Chinese, `es-MX` is Spanish.
+ */
+export function installLanguage(saved, system = []) {
+ if (saved && saved in WORDS) return saved;
+ for (const tag of system) {
+ const lower = String(tag).toLowerCase();
+ if (lower.startsWith('zh')) {
+ if (/^zh-(hant|tw|hk|mo)\b/.test(lower)) continue;
+ return 'zh-CN';
+ }
+ const base = lower.split('-')[0];
+ if (base in WORDS) return base;
+ }
+ return 'en';
+}
+
+export function installWords(language, { name, version }) {
+ const fill = (text) => text.replaceAll('{name}', name).replaceAll('{version}', version);
+ const words = WORDS[language] ?? WORDS.en;
+ return { lang: language in WORDS ? language : 'en', title: fill(words.title), detail: fill(words.detail) };
+}
diff --git a/apps/desktop/src/update-launch.test.mjs b/apps/desktop/src/update-launch.test.mjs
new file mode 100644
index 0000000..7cceb97
--- /dev/null
+++ b/apps/desktop/src/update-launch.test.mjs
@@ -0,0 +1,132 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { spawn } from 'node:child_process';
+import { EventEmitter } from 'node:events';
+import { chmodSync, existsSync, mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { createUpdateController } from './update-controller.mjs';
+import {
+ AFTER_INSTALL, HAND_OFF_SCRIPT, appBundle, installLanguage, installWords, installerPid, pendingUpdate, readyToInstall,
+ stepAside, writePendingUpdate,
+} from './update-launch.mjs';
+
+const folder = () => mkdtempSync(join(tmpdir(), 'of-update-launch-'));
+
+test('the update noted as ready waits until the app runs it; then the note goes', () => {
+ const dir = folder();
+ assert.equal(pendingUpdate(dir, '0.2.0'), null);
+ writePendingUpdate(dir, '0.2.1');
+ assert.equal(pendingUpdate(dir, '0.2.0'), '0.2.1');
+ assert.equal(pendingUpdate(dir, '0.2.0'), '0.2.1');
+ assert.equal(pendingUpdate(dir, '0.2.1'), null);
+ assert.equal(existsSync(join(dir, 'update-pending.json')), false);
+ writeFileSync(join(dir, 'update-pending.json'), 'not json');
+ assert.equal(pendingUpdate(dir, '0.2.0'), null);
+});
+
+test('ShipIt runs while launchd lists a process for the app\'s job', () => {
+ const asked = [];
+ const listed = (out) => (file, args) => { asked.push([file, ...args]); return out; };
+ assert.equal(installerPid('dev.openfilm.desktop', listed('{\n\t"Label" = "dev.openfilm.desktop.ShipIt";\n\t"PID" = 4242;\n};\n')), 4242);
+ assert.deepEqual(asked[0], ['/bin/launchctl', 'list', 'dev.openfilm.desktop.ShipIt']);
+ assert.equal(installerPid('dev.openfilm.desktop', listed('{\n\t"LastExitStatus" = 0;\n};\n')), null);
+ assert.equal(installerPid('dev.openfilm.desktop', () => { throw new Error('no such job'); }), null);
+});
+
+test('a launch steps aside only while ShipIt installs the update it was quit for, and never twice', () => {
+ const dir = folder();
+ const started = [];
+ const start = (file, args, options) => { started.push({ file, args, options }); return { unref() {} }; };
+ const base = { dir, version: '0.2.0', bundleId: 'dev.openfilm.desktop', execPath: '/Applications/OpenFilm.app/Contents/MacOS/OpenFilm', argv: ['OpenFilm'], start };
+ /* nothing waiting */
+ assert.equal(stepAside({ ...base, pidOf: () => 4242 }), false);
+ writePendingUpdate(dir, '0.2.1');
+ /* waiting, and ShipIt not running: the launch installs it itself (readyToInstall) */
+ assert.equal(stepAside({ ...base, pidOf: () => null }), false);
+ /* the script's own launch, or the new version (ShipIt still finishing): it opens */
+ assert.equal(stepAside({ ...base, argv: ['OpenFilm', AFTER_INSTALL], pidOf: () => 4242 }), false);
+ assert.equal(stepAside({ ...base, version: '0.2.1', pidOf: () => 4242 }), false);
+ assert.equal(started.length, 0);
+ writePendingUpdate(dir, '0.2.1');
+ assert.equal(stepAside({ ...base, pidOf: () => 4242 }), true);
+ assert.equal(started.length, 1);
+ assert.equal(started[0].file, '/bin/sh');
+ assert.deepEqual(started[0].args.slice(3), ['4242', '/Applications/OpenFilm.app']);
+ assert.equal(started[0].options.detached, true);
+ assert.equal(appBundle('/Applications/OpenFilm Preview.app/Contents/MacOS/OpenFilm Preview'), '/Applications/OpenFilm Preview.app');
+});
+
+test('the script opens the app once ShipIt is gone, saying the install is over', { skip: process.platform === 'win32' }, async () => {
+ const dir = folder();
+ const said = join(dir, 'opened');
+ writeFileSync(join(dir, 'open'), `#!/bin/sh\necho "$@" > "${said}"\n`);
+ chmodSync(join(dir, 'open'), 0o755);
+ const installer = spawn('sleep', ['1']);
+ const env = { ...process.env, PATH: `${dir}:${process.env.PATH}` };
+ const script = spawn('/bin/sh', ['-c', HAND_OFF_SCRIPT, 'openfilm-update', String(installer.pid), '/Applications/OpenFilm.app'], { env });
+ await new Promise((resolve) => setTimeout(resolve, 300));
+ assert.equal(existsSync(said), false, 'not while ShipIt runs');
+ await new Promise((resolve) => script.on('exit', resolve));
+ assert.equal(readFileSync(said, 'utf8').trim(), `/Applications/OpenFilm.app --args ${AFTER_INSTALL}`);
+});
+
+function controllerFixture() {
+ const updater = new EventEmitter();
+ const nativeUpdater = new EventEmitter();
+ const listeners = new Set();
+ let checks = 0;
+ updater.checkForUpdates = async () => { checks++; updater.emit('checking-for-update'); };
+ const controller = createUpdateController({
+ updater, nativeUpdater, version: '0.2.0', onChange: (state) => { for (const l of listeners) l(state); },
+ prepareRestart: async () => ({ ok: true }), install: () => {},
+ });
+ const subscribe = (listener) => { listeners.add(listener); return () => listeners.delete(listener); };
+ return { controller, updater, nativeUpdater, subscribe, checks: () => checks, listeners };
+}
+
+test('a launch installs once the check finds the update downloaded and Squirrel has it again', async () => {
+ const f = controllerFixture();
+ const ready = readyToInstall({ controller: f.controller, subscribe: f.subscribe, ms: 2000 });
+ assert.equal(f.checks(), 1);
+ f.updater.emit('update-available', { version: '0.2.1' });
+ f.updater.emit('update-downloaded', { version: '0.2.1' });
+ f.nativeUpdater.emit('update-downloaded');
+ assert.equal(await ready, true);
+ assert.equal(f.listeners.size, 0);
+});
+
+test('a launch opens as it is when nothing newer is found, the check fails, or it takes too long', async () => {
+ const current = controllerFixture();
+ const none = readyToInstall({ controller: current.controller, subscribe: current.subscribe, ms: 2000 });
+ current.updater.emit('update-not-available');
+ assert.equal(await none, false);
+
+ const failing = controllerFixture();
+ const failed = readyToInstall({ controller: failing.controller, subscribe: failing.subscribe, ms: 2000 });
+ failing.updater.emit('error', Object.assign(new Error('offline'), { code: 'ENOTFOUND' }));
+ assert.equal(await failed, false);
+
+ const slow = controllerFixture();
+ const late = readyToInstall({ controller: slow.controller, subscribe: slow.subscribe, ms: 50 });
+ slow.updater.emit('update-available', { version: '0.2.2' });
+ slow.updater.emit('download-progress', { percent: 3 });
+ assert.equal(await late, false);
+ assert.equal(slow.listeners.size, 0);
+});
+
+test('the install window speaks the language Studio was last in, else the system\'s', () => {
+ assert.equal(installLanguage('ja', ['zh-Hans-CN']), 'ja');
+ assert.equal(installLanguage(null, ['zh-Hans-CN', 'en-US']), 'zh-CN');
+ assert.equal(installLanguage('fr', ['zh-TW', 'es-MX']), 'es');
+ assert.equal(installLanguage(null, ['de-DE']), 'en');
+ assert.deepEqual(installWords('zh-CN', { name: 'OpenFilm', version: '0.2.1' }), {
+ lang: 'zh-CN', title: '正在安装 OpenFilm 0.2.1…', detail: '安装完成后 OpenFilm 会自动打开。',
+ });
+ for (const language of ['en', 'zh-CN', 'ja', 'ko', 'es']) {
+ const words = installWords(language, { name: 'OpenFilm', version: '9.9.9' });
+ assert.match(words.title, /OpenFilm/);
+ assert.match(words.title, /9\.9\.9/);
+ assert.match(words.detail, /OpenFilm/);
+ }
+});
diff --git a/apps/desktop/src/update-menu.mjs b/apps/desktop/src/update-menu.mjs
index 44f596c..f1f7031 100644
--- a/apps/desktop/src/update-menu.mjs
+++ b/apps/desktop/src/update-menu.mjs
@@ -25,7 +25,7 @@ export function createManualUpdateCheck({ controller, showMessage, focusWindow,
focusWindow();
const { response } = await say({
type: 'info', message: `${productName} ${next} is ready`,
- detail: 'Restart now to install it, or it installs the next time you quit.',
+ detail: 'Restart now to update, or it installs when you quit and opens as the new version next time.',
buttons: ['Restart', 'Later'], defaultId: 0, cancelId: 1,
});
if (response !== 0) return;
diff --git a/apps/desktop/src/updates.mjs b/apps/desktop/src/updates.mjs
index 5f86232..441ec43 100644
--- a/apps/desktop/src/updates.mjs
+++ b/apps/desktop/src/updates.mjs
@@ -3,16 +3,19 @@
* (scripts/release.mjs: the product's `desktop.updates`; a build with none never looks for updates), on the channel
* chosen here (update-channel.mjs), and downloads a new version in the background (update-controller.mjs says where
* it is; update-schedule.mjs when to look). Studio's top bar offers Restart once it is ready (shell/bridge.ts `update`), and the menu's "Check for Updates…" answers with a dialog
- * (update-menu.mjs). Quitting installs it too: nothing is lost by not restarting now.
+ * (update-menu.mjs). Quitting installs it too: nothing is lost by not restarting now. On macOS the next launch makes
+ * sure of it (update-launch.mjs): it waits for an install under way, and installs one that did not happen.
*
* logs/updates.log has what happened, state and versions only: no URLs, no messages from the feed's host.
*/
-import { app, autoUpdater as nativeUpdater, dialog, powerMonitor } from 'electron';
+import { BrowserWindow, app, autoUpdater as nativeUpdater, dialog, nativeTheme, powerMonitor } from 'electron';
import electronUpdater from 'electron-updater';
import { existsSync } from 'node:fs';
import { appendFile } from 'node:fs/promises';
import { join } from 'node:path';
+import { fileURLToPath } from 'node:url';
import { createUpdateController } from './update-controller.mjs';
+import { clearPendingUpdate, installLanguage, installWords, pendingUpdate, readyToInstall, writePendingUpdate } from './update-launch.mjs';
import { UPDATE_CHANNELS, readUpdateChannel, useUpdateChannel, writeUpdateChannel } from './update-channel.mjs';
import { createManualUpdateCheck } from './update-menu.mjs';
import { scheduleUpdateChecks } from './update-schedule.mjs';
@@ -34,6 +37,7 @@ export function startUpdates({ dataDir, productName, getWindow, onState, prepare
const off = { status: 'off', version: app.getVersion(), channel: 'stable', availableVersion: null, progress: 0, checkedAt: null, error: null };
return {
packaged: false, snapshot: () => off, check: async () => off, restart: async () => ({ ok: false, error: 'not-ready' }), manualCheck: null,
+ installAtLaunch: async () => ({ installing: false, dismiss: () => {} }),
channel: () => 'stable', setChannel: () => {}, close: () => {},
};
}
@@ -43,6 +47,8 @@ export function startUpdates({ dataDir, productName, getWindow, onState, prepare
const logFile = join(dataDir, 'logs', 'updates.log');
let logged = '';
+ /** who else is told of each change (a launch that installs waits on it) */
+ const listeners = new Set();
const controller = createUpdateController({
updater: autoUpdater,
/* Squirrel.Mac's second step: only macOS has one */
@@ -51,6 +57,9 @@ export function startUpdates({ dataDir, productName, getWindow, onState, prepare
channel,
onChange: (state) => {
onState(state);
+ for (const listener of listeners) listener(state);
+ /* the next launch on macOS checks that quitting installed it (update-launch.mjs) */
+ if (state.status === 'ready' && state.availableVersion && process.platform === 'darwin') writePendingUpdate(dataDir, state.availableVersion);
/* a line when something changes, not one per percent downloaded */
const entry = { status: state.status, version: state.version, target: state.availableVersion, channel: state.channel, error: state.error };
const line = JSON.stringify(entry);
@@ -94,6 +103,32 @@ export function startUpdates({ dataDir, productName, getWindow, onState, prepare
restart: controller.restart,
manualCheck: createManualUpdateCheck({ controller, productName, showMessage, focusWindow: focus }),
channel: () => channel,
+ /**
+ * At launch, before the window (macOS): an update quitting should have installed and did not is installed now, in
+ * a small window that says so, and the app opens again as the new version (`installing`). Not ready again soon
+ * enough, the launch goes on as it is (its update downloads as usual): `dismiss` closes the window once the app's
+ * own is up, so the app never has no window and quits.
+ * @param {{ language?: string | null }} [options] the language Studio was last shown in
+ */
+ async installAtLaunch({ language = null } = {}) {
+ const nothing = { installing: false, dismiss: () => {} };
+ const version = process.platform === 'darwin' ? pendingUpdate(dataDir, app.getVersion()) : null;
+ if (!version) return nothing;
+ const words = installWords(installLanguage(language, app.getPreferredSystemLanguages()), { name: productName, version });
+ const shown = new BrowserWindow({
+ width: 380, height: 120, show: false, frame: false, resizable: false, maximizable: false, minimizable: false, fullscreenable: false,
+ title: productName, backgroundColor: nativeTheme.shouldUseDarkColors ? '#111111' : '#f2f2f2',
+ webPreferences: { sandbox: true, contextIsolation: true, nodeIntegration: false },
+ });
+ shown.once('ready-to-show', () => shown.show());
+ void shown.loadFile(fileURLToPath(new URL('./installing.html', import.meta.url)), { query: words });
+ const ready = await readyToInstall({ controller, subscribe: (listener) => { listeners.add(listener); return () => listeners.delete(listener); } });
+ if (ready && (await controller.restart()).ok) return { installing: true, dismiss: () => {} };
+ /* tried once: from here it is the usual update, and the next ready one is noted again */
+ try { clearPendingUpdate(dataDir); } catch { /* tried again next launch */ }
+ shown.hide();
+ return { installing: false, dismiss: () => { if (!shown.isDestroyed()) shown.destroy(); } };
+ },
/**
* Move to another channel and look there at once. Moving to stable never downgrades: a beta build stays until
* stable passes it, and one already downloaded still installs.
diff --git a/apps/desktop/src/window-state.mjs b/apps/desktop/src/window-state.mjs
index d36417d..c9e62fd 100644
--- a/apps/desktop/src/window-state.mjs
+++ b/apps/desktop/src/window-state.mjs
@@ -1,6 +1,6 @@
/**
* What the window looked like when it was last closed: where it was, how wide the chat was, whether it was shown,
- * which tabs were open.
+ * which tabs were open, which language its page was in.
* Kept in the app's data folder. Reads no Electron module, so `node --test` can use it.
*/
import { mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
@@ -28,6 +28,8 @@ export function readWindowState(dir) {
chatOpen: raw.chatOpen !== false,
/* the tabs as left (tabs.mjs reads them with care) */
tabs: raw.tabs && typeof raw.tabs === 'object' && Array.isArray(raw.tabs.tabs) ? { tabs: raw.tabs.tabs.slice(0, 50), active: Number(raw.tabs.active) || 0 } : null,
+ /* the language Studio was last shown in, for what the app shows before a page is up */
+ language: typeof raw.language === 'string' && raw.language.length <= 20 ? raw.language : null,
};
}
diff --git a/apps/desktop/src/window-state.test.mjs b/apps/desktop/src/window-state.test.mjs
index 8b7e6ea..06081f8 100644
--- a/apps/desktop/src/window-state.test.mjs
+++ b/apps/desktop/src/window-state.test.mjs
@@ -7,12 +7,12 @@ import { CHAT_DEFAULT, CHAT_MIN, placeOnDisplays, readWindowState, writeWindowSt
test('a first launch has the defaults; a saved state comes back; odd values are made sensible', () => {
const dir = mkdtempSync(join(tmpdir(), 'of-window-'));
- assert.deepEqual(readWindowState(dir), { bounds: null, maximized: false, chatWidth: CHAT_DEFAULT, chatOpen: true, tabs: null });
+ assert.deepEqual(readWindowState(dir), { bounds: null, maximized: false, chatWidth: CHAT_DEFAULT, chatOpen: true, tabs: null, language: null });
const tabs = { tabs: [{ projectId: 'a', title: 'Launch' }, { projectId: null, title: '' }], active: 1 };
- writeWindowState(dir, { bounds: { x: 10, y: 20, width: 1400, height: 900 }, maximized: false, chatWidth: 500, chatOpen: false, tabs });
- assert.deepEqual(readWindowState(dir), { bounds: { x: 10, y: 20, width: 1400, height: 900 }, maximized: false, chatWidth: 500, chatOpen: false, tabs });
- writeFileSync(join(dir, 'window.json'), JSON.stringify({ bounds: { x: 0, y: 0, width: 10, height: 'tall' }, chatWidth: 12, tabs: 'many' }));
- assert.deepEqual(readWindowState(dir), { bounds: null, maximized: false, chatWidth: CHAT_MIN, chatOpen: true, tabs: null });
+ writeWindowState(dir, { bounds: { x: 10, y: 20, width: 1400, height: 900 }, maximized: false, chatWidth: 500, chatOpen: false, tabs, language: 'zh-CN' });
+ assert.deepEqual(readWindowState(dir), { bounds: { x: 10, y: 20, width: 1400, height: 900 }, maximized: false, chatWidth: 500, chatOpen: false, tabs, language: 'zh-CN' });
+ writeFileSync(join(dir, 'window.json'), JSON.stringify({ bounds: { x: 0, y: 0, width: 10, height: 'tall' }, chatWidth: 12, tabs: 'many', language: 7 }));
+ assert.deepEqual(readWindowState(dir), { bounds: null, maximized: false, chatWidth: CHAT_MIN, chatOpen: true, tabs: null, language: null });
});
test('a window off every display comes back centered, keeping its size', () => {
diff --git a/packages/openfilm/studio/ui/src/i18n/en.ts b/packages/openfilm/studio/ui/src/i18n/en.ts
index d8c933b..4b796a1 100644
--- a/packages/openfilm/studio/ui/src/i18n/en.ts
+++ b/packages/openfilm/studio/ui/src/i18n/en.ts
@@ -51,7 +51,7 @@ export const en = {
/* the app's update, ready to install (Studio's top bar, in an app that has updates: lib/host.ts `update`) */
update: {
restart: 'Restart to update',
- ready: 'OpenFilm {version} is ready. Restart to install it, or it installs the next time you quit.',
+ ready: 'OpenFilm {version} is ready. Restart to update now, or it installs when you quit and opens as the new version next time.',
agentBusy: 'An agent is still working. Restart when it has finished.',
exporting: 'An export is running. Restart when it has finished.',
installFailed: 'OpenFilm {version} could not install. Quit OpenFilm and open it again to install it.',
diff --git a/packages/openfilm/studio/ui/src/i18n/es.ts b/packages/openfilm/studio/ui/src/i18n/es.ts
index d06347a..4d4ed6c 100644
--- a/packages/openfilm/studio/ui/src/i18n/es.ts
+++ b/packages/openfilm/studio/ui/src/i18n/es.ts
@@ -50,7 +50,7 @@ export const es: Words = {
/* the app's update, ready to install (Studio's top bar, in an app that has updates: lib/host.ts `update`) */
update: {
restart: 'Reiniciar para actualizar',
- ready: 'OpenFilm {version} está listo. Reinicia para instalarlo, o se instalará la próxima vez que salgas.',
+ ready: 'OpenFilm {version} está listo. Reinicia para actualizar ahora, o se instalará al salir y la próxima vez se abrirá la nueva versión.',
agentBusy: 'Un agente sigue trabajando. Reinicia cuando termine.',
exporting: 'Hay una exportación en curso. Reinicia cuando termine.',
installFailed: 'No se pudo instalar OpenFilm {version}. Sal de OpenFilm y vuelve a abrirlo para instalarlo.',
diff --git a/packages/openfilm/studio/ui/src/i18n/ja.ts b/packages/openfilm/studio/ui/src/i18n/ja.ts
index 9bca42d..b7e5f60 100644
--- a/packages/openfilm/studio/ui/src/i18n/ja.ts
+++ b/packages/openfilm/studio/ui/src/i18n/ja.ts
@@ -50,7 +50,7 @@ export const ja: Words = {
/* the app's update, ready to install (Studio's top bar, in an app that has updates: lib/host.ts `update`) */
update: {
restart: '再起動してアップデート',
- ready: 'OpenFilm {version} の準備ができました。今すぐ再起動してインストールするか、次に終了するときに自動でインストールされます。',
+ ready: 'OpenFilm {version} の準備ができました。今すぐ再起動して更新するか、終了時に自動でインストールされ、次に開くと新しいバージョンになります。',
agentBusy: 'エージェントがまだ作業中です。終わってから再起動してください。',
exporting: '書き出し中です。終わってから再起動してください。',
installFailed: 'OpenFilm {version} をインストールできませんでした。OpenFilm を終了してもう一度開くとインストールされます。',
diff --git a/packages/openfilm/studio/ui/src/i18n/ko.ts b/packages/openfilm/studio/ui/src/i18n/ko.ts
index 5a86947..6057bf3 100644
--- a/packages/openfilm/studio/ui/src/i18n/ko.ts
+++ b/packages/openfilm/studio/ui/src/i18n/ko.ts
@@ -50,7 +50,7 @@ export const ko: Words = {
/* the app's update, ready to install (Studio's top bar, in an app that has updates: lib/host.ts `update`) */
update: {
restart: '재시작하여 업데이트',
- ready: 'OpenFilm {version} 준비가 끝났습니다. 지금 재시작하면 설치되고, 아니면 다음에 종료할 때 설치됩니다.',
+ ready: 'OpenFilm {version} 준비가 끝났습니다. 지금 재시작해 업데이트하거나, 종료할 때 자동으로 설치되어 다음에 열면 새 버전이 됩니다.',
agentBusy: '에이전트가 아직 작업 중입니다. 끝난 뒤 재시작하세요.',
exporting: '내보내는 중입니다. 끝난 뒤 재시작하세요.',
installFailed: 'OpenFilm {version}을(를) 설치하지 못했습니다. OpenFilm을 종료했다가 다시 열면 설치됩니다.',
diff --git a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
index 2ef3269..9cab804 100644
--- a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
+++ b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
@@ -51,7 +51,7 @@ export const zhCN: Words = {
/* the app's update, ready to install (Studio's top bar, in an app that has updates: lib/host.ts `update`) */
update: {
restart: '重启以更新',
- ready: 'OpenFilm {version} 已准备好。现在重启即可安装,或在下次退出时自动安装。',
+ ready: 'OpenFilm {version} 已准备好。现在重启即可更新;或者退出时自动安装,下次打开就是新版本。',
agentBusy: '智能体还在工作,等它完成后再重启。',
exporting: '正在导出,导出完成后再重启。',
installFailed: 'OpenFilm {version} 暂时无法安装。退出 OpenFilm 后重新打开即可安装。',