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: the update's Restart in the top bar, beside the projects button (#18)

riverisbuilding10709aeec857
diff --git a/.changeset/update-in-top-bar.md b/.changeset/update-in-top-bar.md
new file mode 100644
index 0000000..1c74d01
--- /dev/null
+++ b/.changeset/update-in-top-bar.md
@@ -0,0 +1,6 @@
+---
+"@openfilm/desktop": patch
+"openfilm": patch
+---
+
+Desktop: a new version, once downloaded, is offered in the top bar beside the projects button (Restart to update) instead of in the chat, where a closed chat hid it. A restart that has to wait (an agent working, an export running) says why beside it.
diff --git a/apps/desktop/chat/src/App.tsx b/apps/desktop/chat/src/App.tsx
index 246e68b..20b9fca 100644
--- a/apps/desktop/chat/src/App.tsx
+++ b/apps/desktop/chat/src/App.tsx
@@ -52,7 +52,7 @@ import { useLiveActivityFromStore } from '@/lib/live-activity';
import { loadLastSession, loadSessions, newSession, saveLastSession, saveSessions } from '@/lib/local-sessions';
import type { ProjectSessionItem } from '@/lib/project-sessions';
import type { TranscriptItem } from '@/lib/agent-transcript';
-import { app, type FfmpegState, type Project, type StudioRef, type StudioSelection, type UpdateState } from './app-bridge';
+import { app, type FfmpegState, type Project, type StudioRef, type StudioSelection } from './app-bridge';
import { Divider } from './components/Divider';
import { draftRefs, pillCard, refFromPill, refPill, sameStudioThing, selectionMoment, selectionRange, selectionRefs, studioReferencesText } from './studio-refs';
import { inChat } from './lib/chat-layer';
@@ -62,9 +62,6 @@ import { ChatProjectContext, WaitingContext } from './lib/developer';
const NO_ITEMS: TranscriptItem[] = [];
const EMPTY_STORE: LocalTranscriptStore = { get: () => NO_ITEMS, subscribe: () => () => {} };
-/** why Restart had to wait (the update stays ready) */
-const UPDATE_WAIT: Record<string, string> = { 'agent-busy': 'banner.updateAgentBusy', exporting: 'banner.updateExporting', 'install-failed': 'banner.updateInstallFailed' };
-
const isActive = (turn: Turn | undefined) => turn?.status === 'generating' || turn?.status === 'failing' || turn?.status === 'canceling';
/** On a video's thumbnail: it plays, it is not a picture. */
@@ -76,15 +73,13 @@ function PlayMark() {
);
}
-export function App({ initialProject, initialSelection, initialUpdate, initialFfmpeg }: {
+export function App({ initialProject, initialSelection, initialFfmpeg }: {
initialProject: Project | null;
initialSelection: StudioSelection | null;
- initialUpdate: UpdateState | null;
initialFfmpeg: FfmpegState;
}) {
const t = useT();
const [project, setProject] = React.useState<Project | null>(initialProject);
- const [update, setUpdate] = React.useState<UpdateState | null>(initialUpdate);
const [ffmpeg, setFfmpeg] = React.useState<FfmpegState>(initialFfmpeg);
const [browser, setBrowser] = React.useState<{ state: string; message?: string } | null>(null);
const [studioFailed, setStudioFailed] = React.useState<string | null>(null);
@@ -96,7 +91,6 @@ export function App({ initialProject, initialSelection, initialUpdate, initialFf
app.onAssets(setAssetsOpen),
app.onProject(setProject),
app.onSelection(setSelection),
- app.onUpdate(setUpdate),
app.onFfmpeg(setFfmpeg),
app.onStudioBrowser(setBrowser),
app.onStudioFailed(setStudioFailed),
@@ -109,9 +103,6 @@ export function App({ initialProject, initialSelection, initialUpdate, initialFf
const ffState = typeof ffmpeg === 'object' && ffmpeg ? ffmpeg : null;
const banners = (
<>
- {update?.status === 'ready' ? (
- <Banner action={{ label: t('banner.restart'), onClick: () => void app.restartToUpdate() }}>{t(UPDATE_WAIT[update.error ?? ''] ?? 'banner.updateReady').replace('{version}', update.availableVersion ?? '')}</Banner>
- ) : update?.status === 'installing' ? <Banner>{t('banner.updateInstalling')}</Banner> : null}
{studioFailed ? <Banner tone="error">{t('banner.studioFailed').replace('{error}', studioFailed)}</Banner> : null}
{ffmpeg === false ? <Banner>{t('banner.ffmpegMissing')} <code className="font-mono">{navigator.platform.startsWith('Win') ? 'winget install ffmpeg' : 'brew install ffmpeg'}</code></Banner> : null}
{ffState?.state === 'downloading' ? <Banner>{t('banner.ffmpegDownloading').replace('{n}', String(Math.round((ffState.progress ?? 0) * 100)))}</Banner> : null}
diff --git a/apps/desktop/chat/src/app-bridge.ts b/apps/desktop/chat/src/app-bridge.ts
index 13972eb..f39916b 100644
--- a/apps/desktop/chat/src/app-bridge.ts
+++ b/apps/desktop/chat/src/app-bridge.ts
@@ -15,18 +15,8 @@ export type FfmpegState = boolean | null | { state: 'downloading'; progress?: nu
* Where an update is (src/update-controller.mjs). The chat shows only a ready one, and why Restart had to wait
* (`error`: 'agent-busy' | 'exporting' | 'install-failed'); a failed check is the menu's to say.
*/
-export interface UpdateState {
- status: 'idle' | 'checking' | 'current' | 'available' | 'downloading' | 'staging' | 'ready' | 'installing' | 'error';
- version: string;
- channel: 'stable' | 'beta';
- availableVersion: string | null;
- progress: number;
- checkedAt: number | null;
- error: string | null;
-}
-
interface AppBridge {
- hello(): Promise<{ platform: string; flavor: string; theme: Theme; language: string; chatOpen: boolean; project: Project | null; selection: StudioSelection | null; ffmpeg: FfmpegState; update: UpdateState | null; version: string; chatMin: number }>;
+ hello(): Promise<{ platform: string; flavor: string; theme: Theme; language: string; chatOpen: boolean; project: Project | null; selection: StudioSelection | null; ffmpeg: FfmpegState; version: string; chatMin: number }>;
onTheme(listener: (theme: Theme) => void): () => void;
/** Studio's language (its <html lang>) */
onLanguage(listener: (language: string) => void): () => void;
@@ -36,7 +26,6 @@ interface AppBridge {
onStudioFailed(listener: (message: string) => void): () => void;
onRefer(listener: (ref: StudioRef) => void): () => void;
onFfmpeg(listener: (state: FfmpegState) => void): () => void;
- onUpdate(listener: (state: UpdateState) => void): () => void;
/** take the person to a reference in Studio */
showInStudio(ref: StudioRef): void;
/** the reference with its picture: the viewer as it is now, for one that shows it (lib/host.ts StudioRefImage) */
@@ -54,8 +43,6 @@ interface AppBridge {
onSelection(listener: (selection: StudioSelection) => void): () => void;
setChatWidth(width: number, done?: boolean): void;
setChatOpen(open: boolean): void;
- /** install a ready update: refused (the update stays ready) while an agent works or Studio exports */
- restartToUpdate(): Promise<{ ok: boolean; error?: string }>;
/** the project's assets, drawn by Studio over this column while open (main.mjs `assets`) */
assetsOpen(): boolean;
setAssetsOpen(open: boolean): void;
diff --git a/apps/desktop/chat/src/i18n/locales/en-US.ts b/apps/desktop/chat/src/i18n/locales/en-US.ts
index 79fa2eb..c716a52 100644
--- a/apps/desktop/chat/src/i18n/locales/en-US.ts
+++ b/apps/desktop/chat/src/i18n/locales/en-US.ts
@@ -7,12 +7,6 @@ export const enUS = {
manage: 'Manage',
},
banner: {
- restart: 'Restart to update',
- updateReady: 'OpenFilm {version} is ready.',
- updateInstalling: 'Restarting to update…',
- updateAgentBusy: 'OpenFilm {version} is ready. An agent is still working: restart when it has finished.',
- updateExporting: 'OpenFilm {version} is ready. An export is running: restart when it has finished.',
- updateInstallFailed: 'OpenFilm {version} could not be installed now. Quit OpenFilm and open it again to install it.',
studioFailed: 'Studio did not start: {error}',
ffmpegMissing: 'Studio needs ffmpeg for video pictures, sound waves and exports. Install it, then reopen OpenFilm:',
ffmpegDownloading: 'Getting ffmpeg for video pictures, sound and exports (about 50 MB, once)… {n}%',
diff --git a/apps/desktop/chat/src/i18n/locales/es.ts b/apps/desktop/chat/src/i18n/locales/es.ts
index e04403e..f9aec97 100644
--- a/apps/desktop/chat/src/i18n/locales/es.ts
+++ b/apps/desktop/chat/src/i18n/locales/es.ts
@@ -8,12 +8,6 @@ export const es: Words = {
manage: 'Gestionar',
},
banner: {
- restart: 'Reiniciar para actualizar',
- updateReady: 'OpenFilm {version} está listo.',
- updateInstalling: 'Reiniciando para actualizar…',
- updateAgentBusy: 'OpenFilm {version} está listo. Un agente sigue trabajando: reinicia cuando termine.',
- updateExporting: 'OpenFilm {version} está listo. Hay una exportación en curso: reinicia cuando termine.',
- updateInstallFailed: 'OpenFilm {version} no se pudo instalar ahora. Cierra OpenFilm y vuelve a abrirlo para instalarlo.',
studioFailed: 'Studio no se inició: {error}',
ffmpegMissing: 'Studio necesita ffmpeg para las imágenes de video, las ondas de sonido y las exportaciones. Instálalo y vuelve a abrir OpenFilm:',
ffmpegDownloading: 'Obteniendo ffmpeg para imágenes de video, sonido y exportaciones (unos 50 MB, una sola vez)… {n} %',
diff --git a/apps/desktop/chat/src/i18n/locales/ja.ts b/apps/desktop/chat/src/i18n/locales/ja.ts
index 86fb12e..29db0da 100644
--- a/apps/desktop/chat/src/i18n/locales/ja.ts
+++ b/apps/desktop/chat/src/i18n/locales/ja.ts
@@ -8,12 +8,6 @@ export const ja: Words = {
manage: '管理',
},
banner: {
- restart: '再起動してアップデート',
- updateReady: 'OpenFilm {version} の準備ができました。',
- updateInstalling: '再起動してアップデートしています…',
- updateAgentBusy: 'OpenFilm {version} の準備ができました。エージェントが作業中です。終わってから再起動してください。',
- updateExporting: 'OpenFilm {version} の準備ができました。書き出し中です。終わってから再起動してください。',
- updateInstallFailed: 'OpenFilm {version} を今はインストールできませんでした。OpenFilm を終了して開き直すとインストールされます。',
studioFailed: 'Studio を起動できませんでした:{error}',
ffmpegMissing: '動画の表示、波形、書き出しには ffmpeg が必要です。インストールしてから OpenFilm を開き直してください:',
ffmpegDownloading: '動画の表示、音声、書き出し用の ffmpeg を取得中(約 50 MB、初回のみ)… {n}%',
diff --git a/apps/desktop/chat/src/i18n/locales/ko.ts b/apps/desktop/chat/src/i18n/locales/ko.ts
index 653f272..84a70c7 100644
--- a/apps/desktop/chat/src/i18n/locales/ko.ts
+++ b/apps/desktop/chat/src/i18n/locales/ko.ts
@@ -8,12 +8,6 @@ export const ko: Words = {
manage: '관리',
},
banner: {
- restart: '다시 시작하여 업데이트',
- updateReady: 'OpenFilm {version}이(가) 준비되었습니다.',
- updateInstalling: '업데이트를 위해 다시 시작하는 중…',
- updateAgentBusy: 'OpenFilm {version}이(가) 준비되었습니다. 에이전트가 아직 작업 중입니다. 끝난 뒤 다시 시작하세요.',
- updateExporting: 'OpenFilm {version}이(가) 준비되었습니다. 내보내는 중입니다. 끝난 뒤 다시 시작하세요.',
- updateInstallFailed: '지금은 OpenFilm {version}을(를) 설치하지 못했습니다. OpenFilm을 종료했다가 다시 열면 설치됩니다.',
studioFailed: 'Studio를 시작하지 못했습니다: {error}',
ffmpegMissing: '영상 화면, 음파, 내보내기에는 ffmpeg가 필요합니다. 설치한 뒤 OpenFilm을 다시 여세요:',
ffmpegDownloading: '영상 화면, 소리, 내보내기용 ffmpeg를 받는 중(약 50MB, 한 번만)… {n}%',
diff --git a/apps/desktop/chat/src/i18n/locales/zh-CN.ts b/apps/desktop/chat/src/i18n/locales/zh-CN.ts
index 66f19ef..9cc366e 100644
--- a/apps/desktop/chat/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/chat/src/i18n/locales/zh-CN.ts
@@ -8,12 +8,6 @@ export const zhCN: Words = {
manage: '管理',
},
banner: {
- restart: '重启以更新',
- updateReady: 'OpenFilm {version} 已准备好。',
- updateInstalling: '正在重启以更新…',
- updateAgentBusy: 'OpenFilm {version} 已准备好。智能体还在工作,等它完成后再重启。',
- updateExporting: 'OpenFilm {version} 已准备好。正在导出,导出完成后再重启。',
- updateInstallFailed: 'OpenFilm {version} 暂时无法安装。退出 OpenFilm 后重新打开即可安装。',
studioFailed: 'Studio 没有启动:{error}',
ffmpegMissing: 'Studio 需要 ffmpeg 来显示视频画面、声音波形和导出。安装后重新打开 OpenFilm:',
ffmpegDownloading: '正在获取 ffmpeg,用于视频画面、声音和导出(约 50 MB,仅一次)… {n}%',
diff --git a/apps/desktop/chat/src/mount.tsx b/apps/desktop/chat/src/mount.tsx
index cdc61fa..e70768b 100644
--- a/apps/desktop/chat/src/mount.tsx
+++ b/apps/desktop/chat/src/mount.tsx
@@ -14,6 +14,6 @@ export async function mountChat(root: HTMLElement) {
setLanguage(hello.language);
app.onLanguage(setLanguage);
createRoot(root).render(
- <StrictMode><App initialProject={hello.project} initialSelection={hello.selection} initialUpdate={hello.update} initialFfmpeg={hello.ffmpeg} /></StrictMode>,
+ <StrictMode><App initialProject={hello.project} initialSelection={hello.selection} initialFfmpeg={hello.ffmpeg} /></StrictMode>,
);
}
diff --git a/apps/desktop/shell/bridge.ts b/apps/desktop/shell/bridge.ts
index 332e983..16e98b2 100644
--- a/apps/desktop/shell/bridge.ts
+++ b/apps/desktop/shell/bridge.ts
@@ -10,7 +10,7 @@
* (src/preload.cjs). Imported before Studio's modules and the chat's: Studio reads its host as it loads.
*/
import { flushSync } from 'react-dom';
-import type { HostAgent, HostAsk, StudioCommand, StudioHost, StudioRef, StudioSelection } from 'openfilm/studio-ui/lib/host.ts';
+import type { HostAgent, HostAsk, HostUpdate, StudioCommand, StudioHost, StudioRef, StudioSelection } from 'openfilm/studio-ui/lib/host.ts';
type Listener<T> = (value: T) => void;
type Stop = () => void;
@@ -202,6 +202,24 @@ const developer = {
onChange: (listener: Listener<boolean>) => native.prefs.onChange((prefs) => listener(prefs.developer)),
};
+/* ── the app's update, for Studio's top bar: a version downloaded and ready (src/updates.mjs), Restart to install it ── */
+const WAITING = ['agent-busy', 'exporting', 'install-failed'] as const;
+function shownUpdate(state: unknown): HostUpdate | null {
+ const s = state as { status?: string; availableVersion?: string | null; error?: string | null } | null;
+ if (!s || (s.status !== 'ready' && s.status !== 'installing')) return null;
+ const waiting = WAITING.find((w) => w === s.error) ?? null;
+ return { status: s.status, version: s.availableVersion ?? '', waiting };
+}
+const update: NonNullable<StudioHost['update']> = {
+ onChange(listener) {
+ /* the state the app started with, unless a newer one came first */
+ let told = false;
+ void hello.then((h) => { if (!told) listener(shownUpdate(h.update)); });
+ return native.onUpdate((state) => { told = true; listener(shownUpdate(state)); });
+ },
+ restart: native.restartToUpdate,
+};
+
/* ── Studio's host ── */
const mac = native.platform === 'darwin';
const windows = native.platform === 'win32';
@@ -237,6 +255,7 @@ const host: StudioHost = {
agents: native.agents,
asks: { show: (list, answer) => { answerAsk = answer; asks.set(list); } },
developer,
+ update,
folders: { pick: native.pickFolder, pathOf: native.pathForFile },
};
(window as unknown as { openfilmHost: StudioHost }).openfilmHost = host;
@@ -290,7 +309,7 @@ const uploadName = (name: string) => name.split(/[\\/]/).pop()!.replace(/[\u0000
await projectReady;
return {
platform: native.platform, flavor: h.flavor, theme: theme.get(), language: language.get(), chatOpen: layout.open,
- project: project.get(), selection: selection.get(), ffmpeg: h.ffmpeg, update: h.update, version: h.version, chatMin: layout.min,
+ project: project.get(), selection: selection.get(), ffmpeg: h.ffmpeg, version: h.version, chatMin: layout.min,
};
},
onTheme: theme.on,
@@ -303,7 +322,6 @@ const uploadName = (name: string) => name.split(/[\\/]/).pop()!.replace(/[\u0000
onRefer: refer.on,
onSelection: (listener: Listener<StudioSelection>) => selection.on((s) => { if (s) listener(s); }),
onFfmpeg: native.onFfmpeg,
- onUpdate: native.onUpdate,
showInStudio: (ref: StudioRef) => command?.(commandFor(ref)),
/* a reference made in the chat (⌘L there, the @ menu) gets its picture as Studio's own do */
withPicture: (ref: StudioRef) => { const done = pictured.then(() => withPicture(ref)); pictured = done.then(() => {}); return done; },
@@ -344,7 +362,6 @@ const uploadName = (name: string) => name.split(/[\\/]/).pop()!.replace(/[\u0000
},
/* a menu of the chat's floats in its own layer over everything: nothing to make room for */
setMenuOpen() {},
- restartToUpdate: native.restartToUpdate,
/* the chat's record of each project, in its .film/chat and .film/logs */
chat: native.chat,
asks: { get: asks.get, onChange: asks.on, answer: (id: string, allow: boolean) => answerAsk(id, allow) },
diff --git a/apps/desktop/src/update-controller.mjs b/apps/desktop/src/update-controller.mjs
index 48625c1..56fc8be 100644
--- a/apps/desktop/src/update-controller.mjs
+++ b/apps/desktop/src/update-controller.mjs
@@ -10,7 +10,7 @@
* agent-busy | exporting | install-failed Restart was refused or did not work (the update stays ready)
*/
-/** What the menu's dialogs say for each code; the chat has its own words (chat/src/i18n). */
+/** What the menu's dialogs say for each code; Studio's top bar has its own words (its i18n, `update`). */
export const UPDATE_ERRORS = {
offline: 'Could not reach the update service. Check your connection and try again.',
unavailable: 'Updates are unavailable right now. Please try again later.',
diff --git a/apps/desktop/src/update-menu.mjs b/apps/desktop/src/update-menu.mjs
index 360dcc8..44f596c 100644
--- a/apps/desktop/src/update-menu.mjs
+++ b/apps/desktop/src/update-menu.mjs
@@ -35,7 +35,7 @@ export function createManualUpdateCheck({ controller, showMessage, focusWindow,
const progress = state.status === 'downloading' && state.progress ? ` (${Math.round(state.progress)}%)` : '';
await say({
type: 'info', message: `${['Downloading', productName, next].filter(Boolean).join(' ')}${progress}`,
- detail: 'It downloads in the background: keep working. A Restart button appears in the chat when it is ready.',
+ detail: 'It downloads in the background: keep working. A Restart button appears at the top left when it is ready.',
});
} else {
await say({
diff --git a/apps/desktop/src/updates.mjs b/apps/desktop/src/updates.mjs
index f704279..849225d 100644
--- a/apps/desktop/src/updates.mjs
+++ b/apps/desktop/src/updates.mjs
@@ -2,7 +2,7 @@
* Updates, for the packaged app only. electron-updater reads the feed written into the app when it was built
* (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). The chat offers Restart once it is ready, and the menu's "Check for Updates…" answers with a dialog
+ * 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.
*
* logs/updates.log has what happened, state and versions only: no URLs, no messages from the feed's host.
diff --git a/packages/openfilm/studio/ui/src/components/ProjectView.tsx b/packages/openfilm/studio/ui/src/components/ProjectView.tsx
index 4fbf231..a61c351 100644
--- a/packages/openfilm/studio/ui/src/components/ProjectView.tsx
+++ b/packages/openfilm/studio/ui/src/components/ProjectView.tsx
@@ -59,6 +59,7 @@ import { cueAt, filmSubtitleStyleFor, sameFilmSubtitleLanguage } from '@/lib/sub
import { DEFAULT_INSPECTOR, DOCK_GAP, DockPaneDivider, MIN_DOCK_H, MIN_INSPECTOR, MIN_STAGE_H, MIN_VIEWER, PaneDivider, usePaneSize } from './PaneDivider';
import { PANE_BAR, PANE_BTN_ON, PANE_TOGGLE, PANE_TOGGLE_ICON } from './dock-pane-bar';
import { Tooltip } from './Tooltip';
+import { UpdateButton } from './UpdateButton';
import { MediaPool } from './MediaPool';
import type { SubtitleRowSpec } from './SubtitleRow';
import { LayersPanel } from './LayersPanel';
@@ -2040,6 +2041,7 @@ export function ProjectView({ projectId, onProject, onLeave }: {
<GalleryVerticalEnd size={15} />
</button>
</Tooltip>
+ <UpdateButton />
{!studioHost && <Tooltip label={t('desktop.title')} side="bottom">
<button type="button" aria-haspopup="dialog" onClick={() => setDesktopOpen(true)}
className={`flex h-[26px] shrink-0 items-center gap-1.5 rounded-md px-2 text-[12px] text-[var(--text-dim)] transition hover:bg-[var(--bg-hover)] hover:text-[var(--text)] ${desktopOpen ? 'bg-[var(--bg-hover)] text-[var(--text)]' : ''}`}>
diff --git a/packages/openfilm/studio/ui/src/components/UpdateButton.tsx b/packages/openfilm/studio/ui/src/components/UpdateButton.tsx
new file mode 100644
index 0000000..d894772
--- /dev/null
+++ b/packages/openfilm/studio/ui/src/components/UpdateButton.tsx
@@ -0,0 +1,41 @@
+/**
+ * The app's update in Studio's top bar, beside the projects button (an app with updates: lib/host.ts `update`): once a
+ * new version is downloaded, Restart to install it. Refused while an agent works or Studio exports, it says why beside
+ * it and stays, ready; quitting installs it too.
+ */
+import { CircleArrowDown, Loader2 } from 'lucide-react';
+
+import { useT } from '@/i18n';
+import { useHostUpdate } from '../lib/host';
+import { Tooltip } from './Tooltip';
+
+const WAITING = { 'agent-busy': 'update.agentBusy', exporting: 'update.exporting', 'install-failed': 'update.installFailed' } as const;
+
+export function UpdateButton() {
+ const t = useT();
+ const host = useHostUpdate();
+ if (!host) return null;
+ const { update, restart } = host;
+ const words = (key: string) => t(key).replace('{version}', update.version);
+ if (update.status === 'installing') {
+ return (
+ <span role="status" className="flex h-[26px] shrink-0 items-center gap-1.5 rounded-md px-2 text-[12px] text-[var(--text-dim)]">
+ <Loader2 size={13} className="animate-spin" />
+ {t('update.installing')}
+ </span>
+ );
+ }
+ const waiting = update.waiting ? words(WAITING[update.waiting]) : null;
+ return (
+ <>
+ <Tooltip label={waiting ?? words('update.ready')} side="bottom">
+ <button type="button" onClick={() => void restart()}
+ className="flex h-[26px] shrink-0 items-center gap-1.5 rounded-md bg-[var(--accent-soft)] px-2 text-[12px] font-medium text-[var(--accent)] transition hover:brightness-110">
+ <CircleArrowDown size={14} />
+ {t('update.restart')}
+ </button>
+ </Tooltip>
+ {waiting ? <span role="status" className="min-w-0 truncate text-[12px] text-[var(--text-dim)]">{waiting}</span> : null}
+ </>
+ );
+}
diff --git a/packages/openfilm/studio/ui/src/i18n/en.ts b/packages/openfilm/studio/ui/src/i18n/en.ts
index d5a82c4..f34583a 100644
--- a/packages/openfilm/studio/ui/src/i18n/en.ts
+++ b/packages/openfilm/studio/ui/src/i18n/en.ts
@@ -10,6 +10,15 @@ export const en = {
projects: 'Projects',
desktop: 'Desktop',
},
+ /* 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.',
+ 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.',
+ installing: 'Restarting…',
+ },
host: {
refer: 'Reference in chat',
regionHint: 'Drag a box to reference it in chat',
diff --git a/packages/openfilm/studio/ui/src/i18n/es.ts b/packages/openfilm/studio/ui/src/i18n/es.ts
index fec42a4..74b1f83 100644
--- a/packages/openfilm/studio/ui/src/i18n/es.ts
+++ b/packages/openfilm/studio/ui/src/i18n/es.ts
@@ -9,6 +9,15 @@ export const es: Words = {
projects: 'Proyectos',
desktop: 'Escritorio',
},
+ /* 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.',
+ 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.',
+ installing: 'Reiniciando…',
+ },
host: {
refer: 'Mencionar en el chat',
regionHint: 'Arrastra un recuadro para mencionarlo en el chat',
diff --git a/packages/openfilm/studio/ui/src/i18n/ja.ts b/packages/openfilm/studio/ui/src/i18n/ja.ts
index 4b977a8..dc6f6c9 100644
--- a/packages/openfilm/studio/ui/src/i18n/ja.ts
+++ b/packages/openfilm/studio/ui/src/i18n/ja.ts
@@ -9,6 +9,15 @@ export const ja: Words = {
projects: 'プロジェクト',
desktop: 'デスクトップ版',
},
+ /* 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} の準備ができました。今すぐ再起動してインストールするか、次に終了するときに自動でインストールされます。',
+ agentBusy: 'エージェントがまだ作業中です。終わってから再起動してください。',
+ exporting: '書き出し中です。終わってから再起動してください。',
+ installFailed: 'OpenFilm {version} をインストールできませんでした。OpenFilm を終了してもう一度開くとインストールされます。',
+ installing: '再起動しています…',
+ },
host: {
refer: 'チャットで参照',
regionHint: '枠をドラッグしてチャットで参照',
diff --git a/packages/openfilm/studio/ui/src/i18n/ko.ts b/packages/openfilm/studio/ui/src/i18n/ko.ts
index 557208a..6270493 100644
--- a/packages/openfilm/studio/ui/src/i18n/ko.ts
+++ b/packages/openfilm/studio/ui/src/i18n/ko.ts
@@ -9,6 +9,15 @@ export const ko: Words = {
projects: '프로젝트',
desktop: '데스크톱',
},
+ /* 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} 준비가 끝났습니다. 지금 재시작하면 설치되고, 아니면 다음에 종료할 때 설치됩니다.',
+ agentBusy: '에이전트가 아직 작업 중입니다. 끝난 뒤 재시작하세요.',
+ exporting: '내보내는 중입니다. 끝난 뒤 재시작하세요.',
+ installFailed: 'OpenFilm {version}을(를) 설치하지 못했습니다. OpenFilm을 종료했다가 다시 열면 설치됩니다.',
+ installing: '재시작하는 중…',
+ },
host: {
refer: '채팅에서 참조',
regionHint: '상자를 드래그해 채팅에서 참조',
diff --git a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
index 43f3f52..60a5b3c 100644
--- a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
+++ b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts
@@ -10,6 +10,15 @@ export const zhCN: Words = {
projects: '项目',
desktop: '桌面版',
},
+ /* 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} 已准备好。现在重启即可安装,或在下次退出时自动安装。',
+ agentBusy: '智能体还在工作,等它完成后再重启。',
+ exporting: '正在导出,导出完成后再重启。',
+ installFailed: 'OpenFilm {version} 暂时无法安装。退出 OpenFilm 后重新打开即可安装。',
+ installing: '正在重启…',
+ },
host: {
refer: '在对话中引用',
regionHint: '拖出一个框,在对话中引用',
diff --git a/packages/openfilm/studio/ui/src/lib/host.ts b/packages/openfilm/studio/ui/src/lib/host.ts
index dbe5c18..b7d49a8 100644
--- a/packages/openfilm/studio/ui/src/lib/host.ts
+++ b/packages/openfilm/studio/ui/src/lib/host.ts
@@ -78,6 +78,16 @@ export interface StudioHost {
* empty list when none is left), worded in the language shown; `answer` gives the person's answer.
*/
asks?: { show: (asks: HostAsk[], answer: (id: string, allow: boolean) => void) => void };
+ /**
+ * The app's own updates, shown in Studio's top bar beside the projects button: a new version downloaded and ready,
+ * and Restart to install it. `onChange` gives the state now and on every change (null: nothing to show), and returns
+ * a way to stop listening. `restart` is refused while an agent works or Studio exports; the update then stays ready,
+ * with the reason (`waiting`).
+ */
+ update?: {
+ onChange: (listener: (update: HostUpdate | null) => void) => () => void;
+ restart: () => Promise<{ ok: boolean; error?: string }>;
+ };
/**
* The app's developer mode, for Settings → Developer: on, its chat shows each turn's full log (everything the agent
* sent and was answered, as it happened). `onChange` tells of a change from anywhere and returns a way to stop.
@@ -98,6 +108,9 @@ export interface StudioHost {
/** A question about spending, worded for the person (see `asks`). */
export interface HostAsk { id: string; title: string; body: string | null; allowLabel: string; denyLabel: string }
+/** An update of the app, ready to install or installing; `waiting`: why the last Restart did not go ahead. */
+export type HostUpdate = { status: 'ready' | 'installing'; version: string; waiting?: 'agent-busy' | 'exporting' | 'install-failed' | null };
+
export type HostAgentId = 'codex' | 'claude' | 'gemini' | 'copilot' | 'cursor' | 'opencode' | 'codebuddy' | 'qwen' | 'kimi' | 'byok';
/** The API a person's own key is for: OpenAI's Responses or Chat Completions, or Anthropic's Messages. */
export type HostByokFormat = 'responses' | 'chat' | 'anthropic';
@@ -253,3 +266,11 @@ export function useHostPanel(): HostPanel | null {
assets: setAssetsOpen ? { open: state.open && state.assetsOpen, bottom: state.bottom, setOpen: (open) => setAssetsOpen(open) } : null,
};
}
+
+/** The app's update to show in the top bar (see `update`), kept current. Null without one. */
+export function useHostUpdate(): { update: HostUpdate; restart: () => Promise<{ ok: boolean; error?: string }> } | null {
+ const host = studioHost?.update;
+ const [update, setUpdate] = React.useState<HostUpdate | null>(null);
+ React.useEffect(() => host?.onChange(setUpdate), [host]);
+ return host && update ? { update, restart: host.restart } : null;
+}