Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: tell the user on the Eidoverse page when Eidoverse is out of date

[._.]/ Adam Eivy48cac45249ed
diff --git a/client/src/components/apps/tabs/RepositorySourcePanel.jsx b/client/src/components/apps/tabs/RepositorySourcePanel.jsx
index c6d61e5ffe..598bffb6f3 100644
--- a/client/src/components/apps/tabs/RepositorySourcePanel.jsx
+++ b/client/src/components/apps/tabs/RepositorySourcePanel.jsx
@@ -9,6 +9,12 @@ import {
Server,
} from 'lucide-react';
import * as api from '../../../services/api';
+import {
+ countText,
+ primaryRepositorySource,
+ repositoryForkDiverged,
+ repositoryForkNeedsSync,
+} from '../../../lib/managedAppSources';
import BrailleSpinner from '../../BrailleSpinner';
import Modal from '../../ui/Modal';
import toast from '../../ui/Toast';
@@ -57,8 +63,6 @@ function sourceStatus(source) {
return { tone: 'current', label: 'Current' };
}
-const countText = (count, noun) => `${count} ${noun}${count === 1 ? '' : 's'}`;
-
function RepositoryCard({ source }) {
const status = sourceStatus(source);
const isPrimary = source.id === 'primary';
@@ -198,12 +202,10 @@ export default function RepositorySourcePanel({ appId, appName, onUpdated, refre
}, [load, refreshKey]);
const sources = status?.sources || [];
- const primary = sources.find((source) => source.id === 'primary') || sources[0] || null;
+ const primary = primaryRepositorySource(sources);
const companions = sources.filter((source) => source !== primary);
- const forkDiverged = primary?.forkVsUpstream?.state === 'diverged';
- const forkNeedsSync = primary?.origin?.isFork
- && (primary.forkVsUpstream?.behind || 0) > 0
- && !forkDiverged;
+ const forkDiverged = repositoryForkDiverged(primary);
+ const forkNeedsSync = repositoryForkNeedsSync(primary);
const remoteUnknown = sources.some((source) => (
!source.remoteFresh
|| (source.origin?.hasOrigin && source.origin.isUpstream == null)
diff --git a/client/src/components/eidoverse/EidoverseUpdateBanner.jsx b/client/src/components/eidoverse/EidoverseUpdateBanner.jsx
new file mode 100644
index 0000000000..507ca42358
--- /dev/null
+++ b/client/src/components/eidoverse/EidoverseUpdateBanner.jsx
@@ -0,0 +1,139 @@
+import { useCallback, useEffect, useState } from 'react';
+import { Download, RefreshCw } from 'lucide-react';
+import { Link } from 'react-router';
+import Banner from '../ui/Banner';
+import AppOperationBanner from '../apps/AppOperationBanner';
+import { useAppOperation } from '../../hooks/useAppOperation';
+import { safeReadStorage, safeWriteStorage } from '../../lib/safeStorage';
+import {
+ describeRepositorySourcesBehind,
+ primaryRepositorySource,
+ repositoryForkNeedsSync,
+} from '../../lib/managedAppSources';
+import { getAppRepositorySources } from '../../services/api';
+
+// Keyed by app id so a reinstall — which mints a new managed-app record —
+// drops a dismissal that was about the old checkout.
+const dismissKey = (appId) => `portos:eidoverse:updateDismissedRevision:${appId}`;
+
+const WRAPPER_CLS = 'shrink-0 px-3 pt-2 print:hidden';
+
+/**
+ * Which upstream state the advisory was raised for. Dismissing silences THIS
+ * revision — the same shape `useUpdateChecker` uses for the PortOS out-of-sync
+ * banner — so a later Eidoverse release raises it again rather than being
+ * swallowed by an old dismissal.
+ */
+const revisionSignature = (sources = []) => sources
+ .map((source) => `${source.id}@${source.origin?.head || 'unknown'}+${source.forkVsUpstream?.behind || 0}`)
+ .join('|');
+
+/**
+ * Out-of-date advisory for the Eidoverse checkouts, shown on the Eidoverse page.
+ *
+ * The managed app's Git tab already reports the full Worlds/Video topology, but
+ * a user living in the world never goes there — so the freshness check runs
+ * when they open Eidoverse, and the update is one click from here. It reuses
+ * the same `repository-sources` read and the same managed-update dispatch as
+ * that tab, so there is one definition of "behind" and one update path.
+ *
+ * The check is deliberately scoped to this page rather than added to the global
+ * `UpdateBanners`: it costs a `git fetch` on two checkouts plus GitHub fork
+ * metadata, which is not something every screen should pay for. The server
+ * skips the fetch for refs it refreshed inside its freshness window
+ * (`inspectCheckout` in `server/services/managedAppRepositories.js`), so a
+ * StrictMode double-mount or a quick navigate-away-and-back is free.
+ */
+export default function EidoverseUpdateBanner({ appId, appName = 'Eidoverse Worlds', onUpdated }) {
+ const [status, setStatus] = useState(null);
+ const [dismissedRevision, setDismissedRevision] = useState(() => safeReadStorage(dismissKey(appId)));
+
+ const check = useCallback(() => {
+ if (!appId) return;
+ // A failed check reports nothing: an unreachable remote means "unknown",
+ // and nagging about an update PortOS could not confirm is worse than
+ // staying quiet until the next visit.
+ getAppRepositorySources(appId, { silent: true }).then(setStatus, () => setStatus(null));
+ }, [appId]);
+
+ useEffect(() => {
+ check();
+ }, [check]);
+
+ const handleOperationComplete = useCallback(() => {
+ check();
+ onUpdated?.();
+ }, [check, onUpdated]);
+
+ const {
+ steps,
+ isOperating,
+ error: operationError,
+ completed,
+ startUpdate,
+ } = useAppOperation({ appId, onComplete: handleOperationComplete });
+
+ if (isOperating || operationError || completed) {
+ return (
+ <div className={WRAPPER_CLS}>
+ <AppOperationBanner
+ appName={appName}
+ type="update"
+ steps={steps}
+ error={operationError}
+ completed={completed}
+ completedMessage="Eidoverse restarted with the new code."
+ />
+ </div>
+ );
+ }
+
+ if (!status?.updateAvailable) return null;
+ const sources = status.sources || [];
+ const revision = revisionSignature(sources);
+ if (dismissedRevision === revision) return null;
+
+ const behind = describeRepositorySourcesBehind(sources);
+ const syncFork = repositoryForkNeedsSync(primaryRepositorySource(sources));
+
+ const dismiss = () => {
+ safeWriteStorage(dismissKey(appId), revision);
+ setDismissedRevision(revision);
+ };
+
+ return (
+ <div className={WRAPPER_CLS}>
+ <Banner
+ tone="info"
+ icon={RefreshCw}
+ role="status"
+ actions={
+ <div className="flex gap-2">
+ {/* A short visible label keeps both actions on one row at 360px;
+ the accessible name still says what is being updated. */}
+ <button
+ type="button"
+ aria-label={`Update ${appName}`}
+ onClick={() => startUpdate(appId, appName, { syncFork })}
+ className="inline-flex min-h-[44px] items-center gap-1.5 rounded bg-port-accent px-2 py-2 text-xs text-white hover:bg-port-accent/80 lg:min-h-0 lg:py-1"
+ >
+ <Download size={13} aria-hidden="true" />
+ Update
+ </button>
+ <button
+ type="button"
+ onClick={dismiss}
+ className="min-h-[44px] rounded bg-gray-600 px-2 py-2 text-xs text-white hover:bg-gray-500 lg:min-h-0 lg:py-1"
+ >
+ Dismiss
+ </button>
+ </div>
+ }
+ >
+ Eidoverse update available — {behind.length ? `${behind.join('; ')}.` : 'new commits are waiting upstream.'}{' '}
+ Updating pulls the Worlds and Video checkouts and restarts Eidoverse.{' '}
+ <Link to={`/apps/${appId}/git`} className="underline">Repository details</Link>
+ </Banner>
+ </div>
+ );
+}
diff --git a/client/src/components/eidoverse/EidoverseUpdateBanner.test.jsx b/client/src/components/eidoverse/EidoverseUpdateBanner.test.jsx
new file mode 100644
index 0000000000..9d490136a2
--- /dev/null
+++ b/client/src/components/eidoverse/EidoverseUpdateBanner.test.jsx
@@ -0,0 +1,146 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+vi.mock('../../services/api', () => ({
+ getAppRepositorySources: vi.fn(),
+}));
+vi.mock('../../hooks/useAppOperation', () => ({
+ useAppOperation: vi.fn(),
+}));
+
+import * as api from '../../services/api';
+import { useAppOperation } from '../../hooks/useAppOperation';
+import EidoverseUpdateBanner from './EidoverseUpdateBanner';
+
+const source = ({ id, label, origin = {}, localVsOrigin = { ahead: 0, behind: 0, state: 'current' }, forkVsUpstream = null }) => ({
+ id,
+ label,
+ present: true,
+ branch: 'main',
+ head: `${id}-head`,
+ clean: true,
+ origin: { hasOrigin: true, isUpstream: true, isFork: false, head: `${id}-origin-head`, ...origin },
+ upstream: { fullName: 'anima-research/eidoverse-worlds', branch: 'main' },
+ localVsOrigin,
+ forkVsUpstream,
+ remoteFresh: true,
+ remoteError: null,
+});
+
+const behindStatus = () => ({
+ kind: 'managed-app',
+ updateAvailable: true,
+ updatePullsAll: true,
+ updateRestartsApp: true,
+ sources: [
+ source({
+ id: 'primary',
+ label: 'Eidoverse Worlds',
+ localVsOrigin: { ahead: 0, behind: 3, state: 'behind' },
+ }),
+ source({ id: 'companion-1', label: 'eidoverse-video' }),
+ ],
+});
+
+const startUpdate = vi.fn();
+
+const renderBanner = (props = {}) => render(
+ <MemoryRouter>
+ <EidoverseUpdateBanner appId="app-eidoverse" {...props} />
+ </MemoryRouter>,
+);
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ localStorage.clear();
+ useAppOperation.mockReturnValue({
+ steps: [], isOperating: false, error: null, completed: false, startUpdate,
+ });
+ api.getAppRepositorySources.mockResolvedValue(behindStatus());
+});
+
+afterEach(() => cleanup());
+
+describe('Eidoverse out-of-date advisory', () => {
+ it('stays silent when every checkout is current', async () => {
+ api.getAppRepositorySources.mockResolvedValue({ ...behindStatus(), updateAvailable: false });
+ renderBanner();
+
+ await waitFor(() => expect(api.getAppRepositorySources).toHaveBeenCalled());
+ expect(screen.queryByRole('status')).toBeNull();
+ });
+
+ it('stays silent when the freshness check fails, rather than guessing', async () => {
+ api.getAppRepositorySources.mockRejectedValue(new Error('origin unreachable'));
+ renderBanner();
+
+ await waitFor(() => expect(api.getAppRepositorySources).toHaveBeenCalled());
+ expect(screen.queryByRole('status')).toBeNull();
+ });
+
+ it('dispatches the managed update, fast-forwarding a behind fork but never a diverged one', async () => {
+ const status = behindStatus();
+ status.sources[0] = source({
+ id: 'primary',
+ label: 'Eidoverse Worlds',
+ origin: { fullName: 'example-owner/eidoverse-worlds', isUpstream: false, isFork: true },
+ forkVsUpstream: { available: true, ahead: 0, behind: 2, state: 'behind', error: null },
+ });
+ api.getAppRepositorySources.mockResolvedValue(status);
+ renderBanner();
+
+ const banner = await screen.findByRole('status');
+ expect(banner).toHaveTextContent('the Eidoverse Worlds fork is 2 commits behind upstream');
+ expect(banner).toHaveTextContent('restarts Eidoverse');
+ fireEvent.click(screen.getByRole('button', { name: /Update Eidoverse/ }));
+ expect(startUpdate).toHaveBeenCalledWith('app-eidoverse', 'Eidoverse Worlds', { syncFork: true });
+
+ cleanup();
+ startUpdate.mockClear();
+ localStorage.clear();
+ status.sources[0].forkVsUpstream = { available: true, ahead: 1, behind: 2, state: 'diverged', error: null };
+ renderBanner();
+
+ await screen.findByRole('status');
+ fireEvent.click(screen.getByRole('button', { name: /Update Eidoverse/ }));
+ expect(startUpdate).toHaveBeenCalledWith('app-eidoverse', 'Eidoverse Worlds', { syncFork: false });
+ });
+
+ it('keeps a dismissal until the upstream revision changes', async () => {
+ renderBanner();
+ fireEvent.click(await screen.findByRole('button', { name: 'Dismiss' }));
+ expect(screen.queryByRole('status')).toBeNull();
+
+ cleanup();
+ renderBanner();
+ await waitFor(() => expect(api.getAppRepositorySources).toHaveBeenCalledTimes(2));
+ expect(screen.queryByRole('status')).toBeNull();
+
+ cleanup();
+ const newer = behindStatus();
+ newer.sources[0].origin.head = 'primary-origin-head-2';
+ api.getAppRepositorySources.mockResolvedValue(newer);
+ renderBanner();
+ expect(await screen.findByRole('status')).toHaveTextContent('Eidoverse update available');
+ });
+
+ it('reports the running update instead of the advisory, and rechecks when it finishes', async () => {
+ useAppOperation.mockReturnValue({
+ steps: [{ step: 'git-pull', status: 'running', message: 'Pulling Eidoverse Worlds...' }],
+ isOperating: true,
+ error: null,
+ completed: false,
+ startUpdate,
+ });
+ const onUpdated = vi.fn();
+ renderBanner({ onUpdated });
+
+ expect(await screen.findByRole('status', { name: 'App operation status' })).toHaveTextContent('Pulling Eidoverse Worlds...');
+ expect(screen.queryByRole('button', { name: /Update Eidoverse/ })).toBeNull();
+
+ await act(async () => { useAppOperation.mock.calls.at(-1)[0].onComplete(); });
+ await waitFor(() => expect(api.getAppRepositorySources).toHaveBeenCalledTimes(2));
+ expect(onUpdated).toHaveBeenCalled();
+ });
+});
diff --git a/client/src/lib/README.md b/client/src/lib/README.md
index 4c105b65bc..bd0af0843f 100644
--- a/client/src/lib/README.md
+++ b/client/src/lib/README.md
@@ -179,6 +179,7 @@ grep -i "what you want to do" client/src/lib/README.md
| `drumPlayback.js` | Synthesized drum-kit play-along for the SongBook `drum` format (#3115) — the third consumer of `lookaheadTransport.js` alongside `scorePlayback`/`midiPlayback`. `buildDrumSchedule(chart, { bpm, loop, countInBars })` is the PURE chart→`[{ bar, step, piece, sound, velocity, startSec, durSec, countIn }]` mapping (one notated beat = `60/bpm`, one grid step = beat/`subdivision`; per-glyph velocity; a looped bar range is sliced and rebased while keeping the CHART's bar numbers for the playhead) — unit-tested with no Web Audio; `resolveLoopRange(barCount, loop)` clamps/normalizes a 1-based inclusive bar range; the count-in is scheduled as real `countIn: true` events on the same clock so there is no second timer. `createDrumPlayer(chart, { bpm, countInBars, loopBars, clickEnabled, clickVolume, kit, onStep, onEnded })` sounds it on the shared `AudioContext` from a SYNTHESIZED kit (no shipped samples — recipes in `drumKits.js`, realized here as per-layer oscillator/noise + optional tanh drive + optional filter into a soft-clipped master bus; open-hat tail, flam grace note) with an optional layered metronome click, loops the range scheduler-exactly (count-in only on the first pass), and reports `onStep({ bar, step, countIn })` for the `<DrumSheetView>` playhead. The metronome — the through-music click AND the count-in, which both sound `CLICK_VOICE`, never a kit piece — rides its OWN gain bus into the master, so `setClickVolume(0–1)` moves clicks already queued in the lookahead window instead of only the next ones (a level of 0 additionally schedules no click voice at all — the level persists, so a silenced click must not keep building a voice per beat forever) (`clampClickVolume` returns null for an unset/garbled level so a caller can tell "never chosen" from a stored `DEFAULT_CLICK_VOLUME`-vs-silence). `setKit(id)`, `setClick(enabled)` and `setClickVolume(level)` apply LIVE (they touch no timing, unlike `setBpm`/`setLoop`/`setCountIn`, which only rebuild while idle). Pure (no React) — `SongBookViewer` owns the transport UI. |
| `lookaheadTransport.js` | Shared lookahead-transport state machine for the synth players (#2493) — `createLookaheadTransport({ getTotalSec, scheduleWindow, prepare?, seekCursors?, onStop?, onEnded?, onTeardown? })` owns the Web Audio clock + live-node lifecycle (playing / interval / startTime / offsetSec / nodes / playToken, the `resumeAudioContext()` call with the teardown-race guard, the optional `audioSession` claim held for exactly as long as the transport sounds, `track()` node pruning, and the play / pause / stop / seek / position transitions); each player supplies only the scheduling + notify callbacks and stays a thin scheduler over it, so a fix to the token-guard race or teardown lands in one place. Also the single source of the `SYNTH_TIMING` lookahead constants (`LEAD`/`LOOKAHEAD_MS`/`SCHEDULE_AHEAD`) `scorePlayback`/`midiPlayback` share. No React, no score/MIDI concepts — imports only the shared `AudioContext`. |
| `lossSparkline.js` | `lossSparklineGeometry(series, box)` — projects an unbounded training-loss series (`{step,loss}[]`) into SVG polyline coords, normalized to its own min/max (unlike `editorialHealth.sparklineGeometry`'s fixed 0–100 axis). Returns `{ points, coords, last, min, max }`. Drives the Render Queue's training-row loss curve (#1408). No React. |
+| `managedAppSources.js` | Readers for the managed-app repository-source payload (`GET /api/apps/:id/repository-sources`). `primaryRepositorySource` picks the application checkout out of the source list; `repositoryForkDiverged` / `repositoryForkNeedsSync` answer whether a managed update may ask the server to fast-forward the origin fork (a DIVERGED fork never can, so this is a correctness rule, not a label); `describeRepositorySourcesBehind` renders one clause per checkout that is behind, over the shared `countText` pluralizer both surfaces phrase counts with. Shared by the app Git tab's Repository sources panel and the Eidoverse page's out-of-date advisory. |
| `metronome.js` | Sample-accurate Web Audio metronome — the shared timing grid for the song system and first consumer of the song `tempo` field. `createMetronome({ bpm, beatsPerBar, countInBars, onBeat, onCountInComplete })` lookahead-schedules accented click tones on the shared `AudioContext` clock (same pattern as `songPlayback.js`), emits `{ beat, bar, accent, countIn, whenAudioTime }` per beat (the beat-clock callback color-match/sing-to-score subscribe to), and tears down all timers on `stop()`. Plus `clampBpm` (20–320), `secondsPerBeat`, `timeSignatureFromScore`, `beatDescriptor`, and `normalizeBeatsPerBar` — the ONE reading of a time-signature numerator (garbled/zero/negative → 4), shared by the scheduler and the visual `<BeatPulse>` so the dots can't disagree with the clicks. |
| `mindThinkingPresets.js` | Presentation helpers for the Persistent Mind's temporary thinking sessions (#6285). `classifyMindRouteBilling(provider)` answers the question the composer must settle without contacting anything: does borrowing this route run on THIS machine (`local`), stand behind a credential/subscription (`account`), or can PortOS not tell (`unknown`)? Unknown is treated as billable — guessing "free" is the one direction that costs money. Plus `formatMindRoute` (the one "provider / model · effort" phrasing), `sameMindRoute` (client mirror of the server's route-only equality, so a label rename does not read as a changed route), `findMindThinkingPreset` / `mintMindPresetId` (a server-legal id minted from a label), and the receipt readers `formatMindCallUsage` / `formatMindCallOutcome` / `formatMindElapsed` / `mindTurnOutcome` / `mindTurnElapsedMs` / `temporaryMindTurns` — all of which keep "the provider reported nothing" rendering as unknown rather than as a free, instant, successful call. Pure; no fetches, so previewing a preset can never start an inference. |
| `midiChords.js` | Chord detection for the MIDI visualization UI (#2477). `detectChordWindows(notes, { minWindowSec })` sweeps the normalized note list for maximal spans where ≥2 distinct pitch classes sound simultaneously → `[{ startSec, endSec, label, midis }]` (adjacent same-label windows merged); `nameChord(pcs, bassPc)` maps a pitch-class set to a compact symbol (maj/min/dim/aug triads, maj7/7/m7/m7b5/dim7, sus2/sus4/add9, slash-chord inversions) and falls back to sorted pitch-class names (`C E G#`) rather than guessing wrong; `chordNoteNames(midis)` for tooltips. Pure — no canvas/React. |
diff --git a/client/src/lib/index.js b/client/src/lib/index.js
index 33c80e0375..2367de3c91 100644
--- a/client/src/lib/index.js
+++ b/client/src/lib/index.js
@@ -143,6 +143,7 @@ export * from './editorialHealth.js';
export * from './episodeSceneImport.js';
export * from './lookaheadTransport.js';
export * from './lossSparkline.js';
+export * from './managedAppSources.js';
export * from './metronome.js';
export * from './mindThinkingPresets.js';
export * from './navFeatures.js';
diff --git a/client/src/lib/managedAppSources.js b/client/src/lib/managedAppSources.js
new file mode 100644
index 0000000000..3e72951494
--- /dev/null
+++ b/client/src/lib/managedAppSources.js
@@ -0,0 +1,40 @@
+/**
+ * Readers for the managed-app repository-source payload that
+ * `GET /api/apps/:id/repository-sources` returns
+ * (`server/services/managedAppRepositories.js`).
+ *
+ * The fork rule is a correctness rule rather than a formatting one — a
+ * DIVERGED fork can never be fast-forwarded, so an update must not ask the
+ * server to sync it — and two surfaces now read it: the app's Git tab and the
+ * Eidoverse page's out-of-date advisory. One definition, so they cannot drift.
+ */
+
+/** The application checkout itself, as opposed to its companion checkouts. */
+export const primaryRepositorySource = (sources = []) =>
+ sources.find((source) => source.id === 'primary') || sources[0] || null;
+
+export const repositoryForkDiverged = (source) => source?.forkVsUpstream?.state === 'diverged';
+
+/** Can this checkout's origin fork be fast-forwarded from canonical upstream? */
+export const repositoryForkNeedsSync = (source) => Boolean(source?.origin?.isFork)
+ && (source?.forkVsUpstream?.behind || 0) > 0
+ && !repositoryForkDiverged(source);
+
+/** `countText(2, 'commit')` → "2 commits". One phrasing for both update surfaces. */
+export const countText = (count, noun) => `${count} ${noun}${count === 1 ? '' : 's'}`;
+
+/**
+ * One human clause per checkout that is behind something an update would pull
+ * it forward from. Empty when the whole source stack is current.
+ */
+export function describeRepositorySourcesBehind(sources = []) {
+ const clauses = [];
+ for (const source of sources) {
+ const label = source?.label || 'checkout';
+ const localBehind = source?.localVsOrigin?.behind || 0;
+ const forkBehind = source?.forkVsUpstream?.behind || 0;
+ if (localBehind > 0) clauses.push(`${label} is ${countText(localBehind, 'commit')} behind its origin`);
+ if (forkBehind > 0) clauses.push(`the ${label} fork is ${countText(forkBehind, 'commit')} behind upstream`);
+ }
+ return clauses;
+}
diff --git a/client/src/pages/Eidoverse.jsx b/client/src/pages/Eidoverse.jsx
index 4384f8df04..e5ee1ae76a 100644
--- a/client/src/pages/Eidoverse.jsx
+++ b/client/src/pages/Eidoverse.jsx
@@ -12,6 +12,7 @@ import PageHeader from '../components/PageHeader';
import BrailleSpinner from '../components/BrailleSpinner';
import useEidoverseFrame from '../hooks/useEidoverseFrame';
import EidoverseWorldDrawer from '../components/eidoverse/EidoverseWorldDrawer';
+import EidoverseUpdateBanner from '../components/eidoverse/EidoverseUpdateBanner';
import {
EIDOVERSE_SOURCE_KIND as SOURCE_KIND,
eidoverseResetAssetSlotsForDistrict,
@@ -203,6 +204,9 @@ export default function Eidoverse() {
const isCurrent = () => requestGeneration.current === generation;
const updatePhase = (next) => { if (isCurrent()) setPhase(next); };
+ // `appId` deliberately survives this reset: an update dispatched from
+ // <EidoverseUpdateBanner> re-prepares the page on completion, and clearing
+ // the id here would unmount that banner mid-report and drop its re-check.
setPhase('loading');
setError('');
setHostUrl('');
@@ -524,6 +528,10 @@ export default function Eidoverse() {
className="bg-port-bg"
/>
+ {appId && phase !== 'setup' && (
+ <EidoverseUpdateBanner appId={appId} onUpdated={prepare} />
+ )}
+
{phase === 'ready' && (
<main className="relative min-h-0 flex-1 overflow-hidden bg-port-bg">
<iframe
diff --git a/client/src/pages/Eidoverse.test.jsx b/client/src/pages/Eidoverse.test.jsx
index 35ccee0648..b7961b510c 100644
--- a/client/src/pages/Eidoverse.test.jsx
+++ b/client/src/pages/Eidoverse.test.jsx
@@ -6,6 +6,7 @@ import { MemoryRouter } from 'react-router';
vi.mock('../services/api', () => ({
getApp: vi.fn(),
+ getAppRepositorySources: vi.fn(),
getEidoverseWorldProjectionStatus: vi.fn(),
getEidoverseWorldStatus: vi.fn(),
getInstanceFeatures: vi.fn(),
@@ -119,6 +120,7 @@ describe('Eidoverse hosted page', () => {
vi.clearAllMocks();
api.getInstanceFeatures.mockResolvedValue(featureResponse());
api.getApp.mockResolvedValue({ id: setup.appId, overallStatus: 'online' });
+ api.getAppRepositorySources.mockResolvedValue({ updateAvailable: false, sources: [] });
api.startApp.mockResolvedValue({ success: true, results: {} });
api.startEidoverseHost.mockResolvedValue({ running: true, protocol: 'http', port: 5563 });
api.getEidoverseWorldStatus.mockResolvedValue(worldResponse);
@@ -302,6 +304,32 @@ describe('Eidoverse hosted page', () => {
expect(api.startEidoverseHost).toHaveBeenCalledAfter(api.startApp);
});
+ it('raises the out-of-date advisory here, where a user living in the world will see it', async () => {
+ api.getAppRepositorySources.mockResolvedValue({
+ updateAvailable: true,
+ sources: [{
+ id: 'primary',
+ label: 'Eidoverse Worlds',
+ origin: { hasOrigin: true, isFork: false, isUpstream: true, head: 'a'.repeat(40) },
+ localVsOrigin: { ahead: 0, behind: 2, state: 'behind' },
+ }],
+ });
+ renderPage();
+
+ await screen.findByTitle('Eidoverse Worlds');
+ expect(api.getAppRepositorySources).toHaveBeenCalledWith('app-eidoverse', { silent: true });
+ expect(await screen.findByText(/Eidoverse Worlds is 2 commits behind its origin/)).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /Update Eidoverse/ })).toBeInTheDocument();
+ });
+
+ it('never checks freshness for an install that has no Eidoverse yet', async () => {
+ api.getInstanceFeatures.mockResolvedValue(featureResponse({ installed: false, appId: 'app-eidoverse' }));
+ renderPage();
+
+ await screen.findByRole('link', { name: 'Open Features' });
+ expect(api.getAppRepositorySources).not.toHaveBeenCalled();
+ });
+
it('sends an uninstalled user to Features', async () => {
api.getInstanceFeatures.mockResolvedValue(featureResponse({ installed: false, appId: null }));
renderPage();
diff --git a/docs/features/eidoverse.md b/docs/features/eidoverse.md
index 573847b28e..fab40d9da8 100644
--- a/docs/features/eidoverse.md
+++ b/docs/features/eidoverse.md
@@ -46,6 +46,16 @@ pulls the independent Video checkout from its own origin and branch, installs
Worlds' frozen Bun dependencies, and restarts only Eidoverse. Video is therefore
managed as a version-visible sidecar, not pinned as a PortOS submodule.
+That topology is only visible to someone who goes looking for it, so freshness
+is also reported where a user actually lives. Opening **Eidoverse** runs the
+same repository-source check once per visit and, when a checkout or its fork is
+behind, raises an advisory above the world naming what is behind and offering
+the same one-click managed update. Dismissing it silences that revision only —
+the next Eidoverse release raises it again. The check is scoped to this page
+rather than added to the global PortOS update banner because it costs a
+`git fetch` on both checkouts plus GitHub fork metadata, which is not a price
+every screen should pay.
+
## Runtime and data ownership
The managed app uses port `8940` and starts with the Bun executable found or
diff --git a/server/services/managedAppRepositories.js b/server/services/managedAppRepositories.js
index db377cf9a6..5dcdeedb5e 100644
--- a/server/services/managedAppRepositories.js
+++ b/server/services/managedAppRepositories.js
@@ -3,7 +3,7 @@ import { ServerError } from '../lib/errorHandler.js';
import { pathExists, safeJSONParse } from '../lib/fileUtils.js';
import { getOriginInfo, parseGitRemoteUrl, readRemoteUrl } from '../lib/gitRemote.js';
import { githubApiHost, hostToWorkTracker, isGithubHost } from '../lib/workTracker.js';
-import { execGitSafe, fetchOrigin, resolveForgeForRepo } from './git.js';
+import { execGitSafe, fetchOrigin, isFetchFresh, resolveForgeForRepo } from './git.js';
import { execGh } from './github.js';
const GH_TIMEOUT_MS = 60_000;
@@ -156,12 +156,20 @@ async function inspectCheckout({ id, label, repoPath }) {
const branch = branchName && branchName !== 'HEAD' ? branchName : null;
const head = headResult.exitCode === 0 ? headResult.stdout.trim() : null;
const clean = worktreeResult.exitCode === 0 ? worktreeResult.stdout.trim().length === 0 : null;
- const fetchResult = topology.origin.hasOrigin
- ? await fetchOrigin(repoPath).then(
- () => ({ fresh: true, error: topology.error }),
- () => ({ fresh: false, error: 'Could not refresh the origin repository' }),
- )
- : { fresh: false, error: topology.error };
+ // Skip the network hop when this checkout's remote refs were already
+ // refreshed inside the freshness window — the refs really are current, so
+ // `fresh: true` stays truthful. This read used to be reachable only from the
+ // app's Git tab; the Eidoverse page now runs it on every visit, where an
+ // ungated fetch would cost two `git fetch`es per mount (twice that under
+ // React StrictMode) for an answer that cannot have changed.
+ const fetchResult = !topology.origin.hasOrigin
+ ? { fresh: false, error: topology.error }
+ : isFetchFresh(repoPath)
+ ? { fresh: true, error: topology.error }
+ : await fetchOrigin(repoPath).then(
+ () => ({ fresh: true, error: topology.error }),
+ () => ({ fresh: false, error: 'Could not refresh the origin repository' }),
+ );
const originRef = branch ? `refs/remotes/origin/${branch}` : null;
const [originHeadResult, countsResult] = originRef
diff --git a/server/services/managedAppRepositories.test.js b/server/services/managedAppRepositories.test.js
index 79805c0219..f553df2569 100644
--- a/server/services/managedAppRepositories.test.js
+++ b/server/services/managedAppRepositories.test.js
@@ -6,6 +6,7 @@ const mock = vi.hoisted(() => ({
readRemoteUrl: vi.fn(),
execGit: vi.fn(),
fetchOrigin: vi.fn(),
+ isFetchFresh: vi.fn(),
resolveForgeForRepo: vi.fn(),
execGh: vi.fn(),
}));
@@ -22,6 +23,7 @@ vi.mock('../lib/gitRemote.js', async (importOriginal) => ({
vi.mock('./git.js', () => ({
execGitSafe: mock.execGit,
fetchOrigin: mock.fetchOrigin,
+ isFetchFresh: mock.isFetchFresh,
resolveForgeForRepo: mock.resolveForgeForRepo,
}));
vi.mock('./github.js', () => ({ execGh: mock.execGh }));
@@ -54,6 +56,7 @@ describe('managed app repository topology', () => {
mock.getOriginInfo.mockResolvedValue(forkOrigin);
mock.readRemoteUrl.mockResolvedValue(null);
mock.fetchOrigin.mockResolvedValue(true);
+ mock.isFetchFresh.mockReturnValue(false);
mock.resolveForgeForRepo.mockResolvedValue({ env: { GH_TOKEN: 'test-token' } });
mock.execGh.mockImplementation(async (args) => {
if (args[1] === 'repos/example-owner/example-app') {
@@ -128,6 +131,19 @@ describe('managed app repository topology', () => {
expect.objectContaining({ cwd: REPO }),
);
expect(JSON.stringify(result)).not.toContain(REPO);
+ expect(mock.fetchOrigin).toHaveBeenCalledWith(REPO);
+ });
+
+ // The Eidoverse page runs this read on every visit, so an ungated fetch would
+ // be a network hop per mount for refs that were just refreshed.
+ it('skips the network fetch for refs already refreshed inside the freshness window', async () => {
+ mock.isFetchFresh.mockReturnValue(true);
+
+ const result = await getManagedAppRepositorySources(app);
+
+ expect(mock.fetchOrigin).not.toHaveBeenCalled();
+ expect(result.sources[0]).toMatchObject({ remoteFresh: true, remoteError: null });
+ expect(result.updateAvailable).toBe(true);
});
it('resolves upstream by default while honoring an explicit origin choice', async () => {