Skip to content

The agent that grows with you

feat(desktop): give the in-app browser an address bar and history controls

Brooklyn Nicholson5117eb7c93cc
diff --git a/apps/desktop/src/app/chat/pane-mirror.ts b/apps/desktop/src/app/chat/pane-mirror.ts
index 05800c110bd..916b64500ca 100644
--- a/apps/desktop/src/app/chat/pane-mirror.ts
+++ b/apps/desktop/src/app/chat/pane-mirror.ts
@@ -11,7 +11,6 @@ import type { ReactElement, ReactNode, PointerEvent as ReactPointerEvent } from
import type { DoubleTapContext } from '@/components/pane-shell/tree/renderer/drag-session'
import { registerPaneCloser, removeTreePane, treePanesWithPrefix } from '@/components/pane-shell/tree/store'
-import type { PaneStripTool } from '@/components/ui/pane-tab'
import { registry } from '@/contrib/registry'
import type { TileDock } from '@/store/session-states'
@@ -40,11 +39,6 @@ export interface PaneMirror<T> {
* as `tabLead` — a name that moves faster than re-registration (see
* PaneChrome.tabTitle). Falls back to `title`. */
tabTitle?: (key: string) => ReactNode
- /** Glyph buttons the tile contributes to the strip, after the last tab (where
- * "+" sits), while it is the ACTIVE pane — e.g. a preview's console /
- * DevTools toggles. DATA, not markup: the strip's `PaneStripGlyph` owns the
- * styling so every glyph on every strip matches. */
- stripTools?: (key: string) => readonly PaneStripTool[]
render: (key: string) => ReactNode
/** Wrap the tile's TAB (domain context menu — session verbs). */
tabWrap?: (key: string, tab: ReactElement) => ReactNode
@@ -87,7 +81,6 @@ export function paneMirror<T>(cfg: PaneMirror<T>): () => void {
data: {
tabLead: cfg.tabLead ? () => cfg.tabLead!(key) : undefined,
tabTitle: cfg.tabTitle ? () => cfg.tabTitle!(key) : undefined,
- stripTools: cfg.stripTools ? () => cfg.stripTools!(key) : undefined,
dock: {
before: cfg.before?.(tile),
pane: cfg.anchor?.(tile) ?? 'workspace',
diff --git a/apps/desktop/src/app/chat/preview-tile.tsx b/apps/desktop/src/app/chat/preview-tile.tsx
index dc59a6f6025..7051fbe80f6 100644
--- a/apps/desktop/src/app/chat/preview-tile.tsx
+++ b/apps/desktop/src/app/chat/preview-tile.tsx
@@ -19,7 +19,7 @@ import { $previewTabs, closeRightRailTab, type PreviewTarget } from '@/store/pre
import { paneMirror } from './pane-mirror'
import { PreviewTilePane } from './right-rail/preview'
-import { forgetPreviewStripTools, previewStripTools } from './right-rail/preview-strip-tools'
+import { forgetPreviewConsole } from './right-rail/preview-console-store'
/** The target behind a tile id, or null once its tab is gone. */
function targetFor(tabId: string): PreviewTarget | null {
@@ -132,12 +132,9 @@ const watchPreviewTileMirror = paneMirror<{ id: string }>({
minWidth: '22rem',
title: previewTitle,
tabLead: tabId => <PreviewTabLead tabId={tabId} />,
- // Console + DevTools as bare strip glyphs after the last tab, where "+" sits.
- // Only a URL preview has a webview behind it, so a file/artifact tab gets none.
- stripTools: tabId => (targetFor(tabId)?.kind === 'url' ? previewStripTools(tabId) : []),
render: tabId => <PreviewTilePane tabId={tabId} />,
close: tabId => {
- forgetPreviewStripTools(tabId)
+ forgetPreviewConsole(tabId)
closeRightRailTab(tabId)
}
})
diff --git a/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx b/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx
new file mode 100644
index 00000000000..9f3da954896
--- /dev/null
+++ b/apps/desktop/src/app/chat/right-rail/preview-browser-bar.test.tsx
@@ -0,0 +1,229 @@
+import { cleanup, fireEvent, render } from '@testing-library/react'
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+import { normalizePreviewAddress, PreviewBrowserBar } from './preview-browser-bar'
+
+const baseProps = {
+ canGoBack: false,
+ canGoForward: false,
+ consoleOpen: false,
+ devToolsOpen: false,
+ loading: false,
+ onBack: vi.fn(),
+ onForward: vi.fn(),
+ onNavigate: vi.fn(),
+ onReload: vi.fn(),
+ onToggleConsole: vi.fn(),
+ onToggleDevTools: vi.fn(),
+ url: 'https://example.com'
+}
+
+function address(rendered: ReturnType<typeof render>) {
+ return rendered.getByRole('textbox', { name: 'Address' }) as HTMLInputElement
+}
+
+afterEach(() => {
+ cleanup()
+ vi.clearAllMocks()
+})
+
+describe('normalizePreviewAddress', () => {
+ it('passes through http and https URLs', () => {
+ expect(normalizePreviewAddress('https://example.com/path')).toBe('https://example.com/path')
+ expect(normalizePreviewAddress('http://localhost:3000/')).toBe('http://localhost:3000/')
+ })
+
+ it('gives a bare host https and a loopback host http', () => {
+ expect(normalizePreviewAddress('example.com')).toBe('https://example.com')
+ expect(normalizePreviewAddress('localhost:5173')).toBe('http://localhost:5173')
+ expect(normalizePreviewAddress('127.0.0.1:8080/app')).toBe('http://127.0.0.1:8080/app')
+ })
+
+ it('rejects empty input', () => {
+ expect(normalizePreviewAddress('')).toBeNull()
+ expect(normalizePreviewAddress(' ')).toBeNull()
+ })
+
+ // This is a browser: the schemes a browser navigates to all work, and the
+ // user already owns the machine, so `file://` is theirs to open.
+ it('passes through the other schemes a browser can navigate', () => {
+ expect(normalizePreviewAddress('about:blank')).toBe('about:blank')
+ expect(normalizePreviewAddress('file:///etc/hosts')).toBe('file:///etc/hosts')
+ expect(normalizePreviewAddress('view-source:https://example.com')).toBe('view-source:https://example.com')
+ })
+
+ // These EXECUTE in the guest partition instead of navigating it — an address
+ // bar is not an eval box, and no shipping browser honors them here either.
+ it('rejects script-bearing schemes', () => {
+ expect(normalizePreviewAddress('javascript:alert(1)')).toBeNull()
+ expect(normalizePreviewAddress('data:text/html,evil')).toBeNull()
+ expect(normalizePreviewAddress('JavaScript:alert(1)')).toBeNull()
+ })
+
+ it('rejects strings that are not addresses at all', () => {
+ expect(normalizePreviewAddress('://broken')).toBeNull()
+ expect(normalizePreviewAddress('http://')).toBeNull()
+ })
+
+ it('trims whitespace before validating', () => {
+ expect(normalizePreviewAddress(' https://example.com ')).toBe('https://example.com')
+ })
+})
+
+describe('PreviewBrowserBar', () => {
+ it('renders the navigation controls and the page toggles', () => {
+ const rendered = render(<PreviewBrowserBar {...baseProps} />)
+
+ expect(rendered.getByRole('button', { name: 'Back' })).toBeTruthy()
+ expect(rendered.getByRole('button', { name: 'Forward' })).toBeTruthy()
+ expect(rendered.getByRole('button', { name: 'Reload page' })).toBeTruthy()
+ expect(rendered.getByRole('button', { name: 'Show preview console' })).toBeTruthy()
+ expect(rendered.getByRole('button', { name: 'Open preview DevTools' })).toBeTruthy()
+ expect(address(rendered)).toBeTruthy()
+ })
+
+ it('disables back and forward when there is no history', () => {
+ const rendered = render(<PreviewBrowserBar {...baseProps} />)
+
+ expect((rendered.getByRole('button', { name: 'Back' }) as HTMLButtonElement).disabled).toBe(true)
+ expect((rendered.getByRole('button', { name: 'Forward' }) as HTMLButtonElement).disabled).toBe(true)
+ })
+
+ it('enables back and forward when there is history', () => {
+ const rendered = render(<PreviewBrowserBar {...baseProps} canGoBack canGoForward />)
+
+ expect((rendered.getByRole('button', { name: 'Back' }) as HTMLButtonElement).disabled).toBe(false)
+ expect((rendered.getByRole('button', { name: 'Forward' }) as HTMLButtonElement).disabled).toBe(false)
+ })
+
+ it.each([
+ ['Back', 'onBack'],
+ ['Forward', 'onForward'],
+ ['Reload page', 'onReload']
+ ] as const)('fires %s', (label, handler) => {
+ const spy = vi.fn()
+ const rendered = render(<PreviewBrowserBar {...baseProps} canGoBack canGoForward {...{ [handler]: spy }} />)
+
+ fireEvent.click(rendered.getByRole('button', { name: label }))
+
+ expect(spy).toHaveBeenCalledOnce()
+ })
+
+ it('toggles the console and DevTools, and labels them by current state', () => {
+ const onToggleConsole = vi.fn()
+ const onToggleDevTools = vi.fn()
+ const rendered = render(
+ <PreviewBrowserBar {...baseProps} onToggleConsole={onToggleConsole} onToggleDevTools={onToggleDevTools} />
+ )
+
+ fireEvent.click(rendered.getByRole('button', { name: 'Show preview console' }))
+ fireEvent.click(rendered.getByRole('button', { name: 'Open preview DevTools' }))
+
+ expect(onToggleConsole).toHaveBeenCalledOnce()
+ expect(onToggleDevTools).toHaveBeenCalledOnce()
+
+ rendered.rerender(<PreviewBrowserBar {...baseProps} consoleOpen devToolsOpen />)
+
+ expect(rendered.getByRole('button', { name: 'Hide preview console' }).getAttribute('aria-pressed')).toBe('true')
+ expect(rendered.getByRole('button', { name: 'Hide preview DevTools' }).getAttribute('aria-pressed')).toBe('true')
+ })
+
+ it('shows the live url while idle and follows it as the page navigates', () => {
+ const rendered = render(<PreviewBrowserBar {...baseProps} />)
+
+ expect(address(rendered).value).toBe('https://example.com')
+
+ rendered.rerender(<PreviewBrowserBar {...baseProps} url="https://example.com/next" />)
+
+ expect(address(rendered).value).toBe('https://example.com/next')
+ })
+
+ // The page can navigate itself (redirect, pushState) while the user is
+ // mid-address; their keystrokes must survive it.
+ it('does not clobber the draft while the user is typing', () => {
+ const rendered = render(<PreviewBrowserBar {...baseProps} />)
+ const input = address(rendered)
+
+ fireEvent.focus(input)
+ fireEvent.change(input, { target: { value: 'example.org/docs' } })
+ rendered.rerender(<PreviewBrowserBar {...baseProps} url="https://example.com/redirected" />)
+
+ expect(address(rendered).value).toBe('example.org/docs')
+ })
+
+ it('normalizes and navigates on Enter, then releases the field back to the page', () => {
+ const onNavigate = vi.fn()
+ const rendered = render(<PreviewBrowserBar {...baseProps} onNavigate={onNavigate} />)
+ const input = address(rendered)
+
+ fireEvent.focus(input)
+ fireEvent.change(input, { target: { value: 'localhost:5173' } })
+ fireEvent.keyDown(input, { key: 'Enter' })
+
+ expect(onNavigate).toHaveBeenCalledWith('http://localhost:5173')
+ expect(address(rendered).value).toBe('https://example.com')
+ })
+
+ it('refuses to navigate to a script-bearing scheme and marks the field invalid', () => {
+ const onNavigate = vi.fn()
+ const rendered = render(<PreviewBrowserBar {...baseProps} onNavigate={onNavigate} />)
+ const input = address(rendered)
+
+ fireEvent.focus(input)
+ fireEvent.change(input, { target: { value: 'javascript:alert(1)' } })
+
+ expect(address(rendered).getAttribute('aria-invalid')).toBe('true')
+
+ fireEvent.keyDown(input, { key: 'Enter' })
+
+ expect(onNavigate).not.toHaveBeenCalled()
+ })
+
+ it('navigates to about:blank like any other address', () => {
+ const onNavigate = vi.fn()
+ const rendered = render(<PreviewBrowserBar {...baseProps} onNavigate={onNavigate} />)
+ const input = address(rendered)
+
+ fireEvent.focus(input)
+ fireEvent.change(input, { target: { value: 'about:blank' } })
+
+ expect(address(rendered).getAttribute('aria-invalid')).toBeNull()
+
+ fireEvent.keyDown(input, { key: 'Enter' })
+
+ expect(onNavigate).toHaveBeenCalledWith('about:blank')
+ })
+
+ it('leaves an empty field unflagged', () => {
+ const rendered = render(<PreviewBrowserBar {...baseProps} />)
+ const input = address(rendered)
+
+ fireEvent.focus(input)
+ fireEvent.change(input, { target: { value: '' } })
+
+ expect(address(rendered).getAttribute('aria-invalid')).toBeNull()
+ })
+
+ it('reverts the draft on Escape', () => {
+ const onNavigate = vi.fn()
+ const rendered = render(<PreviewBrowserBar {...baseProps} onNavigate={onNavigate} />)
+ const input = address(rendered)
+
+ fireEvent.focus(input)
+ fireEvent.change(input, { target: { value: 'example.org' } })
+ fireEvent.keyDown(input, { key: 'Escape' })
+
+ expect(onNavigate).not.toHaveBeenCalled()
+ expect(address(rendered).value).toBe('https://example.com')
+ })
+
+ it('spins the reload glyph only while loading', () => {
+ const { container, rerender } = render(<PreviewBrowserBar {...baseProps} loading />)
+
+ expect(container.querySelector('.codicon-refresh')?.className).toContain('codicon-modifier-spin')
+
+ rerender(<PreviewBrowserBar {...baseProps} />)
+
+ expect(container.querySelector('.codicon-refresh')?.className).not.toContain('codicon-modifier-spin')
+ })
+})
diff --git a/apps/desktop/src/app/chat/right-rail/preview-browser-bar.tsx b/apps/desktop/src/app/chat/right-rail/preview-browser-bar.tsx
new file mode 100644
index 00000000000..da833717191
--- /dev/null
+++ b/apps/desktop/src/app/chat/right-rail/preview-browser-bar.tsx
@@ -0,0 +1,178 @@
+/**
+ * BROWSER BAR — back / forward / reload / address for a URL preview.
+ *
+ * The Browser tab had no way to move: no history, and the only address on
+ * screen was a read-only label. Every other embedded browser (VS Code's Simple
+ * Browser included) puts those four controls in one row above the page, so this
+ * does too — and it sits with the page it drives rather than on the zone strip,
+ * which is shared with every other tab.
+ *
+ * The console / DevTools toggles moved here for the same reason: they act on
+ * THIS page, so they belong beside its address, not on the strip where they
+ * were ambiguous the moment a second tab opened. They stay `PaneStripGlyph`
+ * buttons, so a glyph here and a glyph on the strip are still the same button.
+ */
+
+import { useState } from 'react'
+
+import { Codicon } from '@/components/ui/codicon'
+import { Input } from '@/components/ui/input'
+import { PaneStripGlyph } from '@/components/ui/pane-tab'
+import { useI18n } from '@/i18n'
+
+interface PreviewBrowserBarProps {
+ canGoBack: boolean
+ canGoForward: boolean
+ consoleOpen: boolean
+ devToolsOpen: boolean
+ loading: boolean
+ onBack: () => void
+ onForward: () => void
+ onNavigate: (url: string) => void
+ onReload: () => void
+ onToggleConsole: () => void
+ onToggleDevTools: () => void
+ /** The page's CURRENT address (it moves as the user navigates), not the
+ * target the tab was opened with. */
+ url: string
+}
+
+/**
+ * What the user typed, as something a webview can load — or `null` if it isn't
+ * loadable. A bare host is the common case in an address bar, and here it is
+ * usually a dev server, so loopback gets `http` (nothing is listening on 443
+ * and there's no certificate) and anything else gets `https`.
+ *
+ * The blocklist is deliberately narrow: `javascript:` and `data:` execute in
+ * the guest partition rather than navigating it, so an address bar is not the
+ * place to reach them. Everything a browser normally loads — including
+ * `about:blank` and `file://` — goes through, because this IS a browser and
+ * the person typing already owns the machine it runs on.
+ */
+export function normalizePreviewAddress(value: string): null | string {
+ const address = value.trim()
+
+ if (!address) {
+ return null
+ }
+
+ // `://`, not a leading-scheme regex: `localhost:5173` and `example.com:8080`
+ // both match `scheme:` and would be read as an unknown protocol instead of a
+ // host and a port. `about:blank` has no `://` either, hence the explicit
+ // scheme test before the host guess.
+ const scheme = /^(about|blob|chrome|data|devtools|file|ftp|https?|javascript|view-source):/i.exec(address)?.[1]
+ const loopback = /^(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::\d+)?(?:[/?#]|$)/i.test(address)
+ const candidate = scheme ? address : `${loopback ? 'http' : 'https'}://${address}`
+
+ // Script-bearing schemes run INSIDE the page the user is looking at (or mint
+ // a document with an attacker-chosen body) — that's injection wearing a
+ // navigation's clothes, and no browser's address bar honors it either.
+ if (scheme && /^(data|javascript)$/i.test(scheme)) {
+ return null
+ }
+
+ try {
+ // A parse failure is the real filter for junk: `://broken`, `htp:/x`, and
+ // half-typed nonsense all land here.
+ new URL(candidate)
+
+ return candidate
+ } catch {
+ return null
+ }
+}
+
+export function PreviewBrowserBar({
+ canGoBack,
+ canGoForward,
+ consoleOpen,
+ devToolsOpen,
+ loading,
+ onBack,
+ onForward,
+ onNavigate,
+ onReload,
+ onToggleConsole,
+ onToggleDevTools,
+ url
+}: PreviewBrowserBarProps) {
+ const { t } = useI18n()
+ const copy = t.preview.web
+ // Null while the field is idle, so the address tracks navigation on its own;
+ // a string once the user takes it over, so typing survives a page load.
+ const [draft, setDraft] = useState<null | string>(null)
+ // Only while the user is typing: a page that navigates itself is never the
+ // user's mistake to flag.
+ const invalid = draft !== null && draft.trim().length > 0 && !normalizePreviewAddress(draft)
+
+ const commit = (value: string) => {
+ const address = normalizePreviewAddress(value)
+
+ if (!address) {
+ return
+ }
+
+ setDraft(null)
+ onNavigate(address)
+ }
+
+ return (
+ <div className="flex min-h-(--titlebar-height) shrink-0 items-center gap-1 border-b border-border/60 bg-background px-1.5 py-1">
+ <PaneStripGlyph
+ disabled={!canGoBack}
+ icon={<Codicon name="arrow-left" size="0.8125rem" />}
+ label={copy.goBack}
+ onSelect={onBack}
+ />
+ <PaneStripGlyph
+ disabled={!canGoForward}
+ icon={<Codicon name="arrow-right" size="0.8125rem" />}
+ label={copy.goForward}
+ onSelect={onForward}
+ />
+ <PaneStripGlyph
+ icon={<Codicon name="refresh" size="0.8125rem" spinning={loading} />}
+ label={copy.reload}
+ onSelect={onReload}
+ />
+ <Input
+ aria-invalid={invalid || undefined}
+ aria-label={copy.address}
+ inputMode="url"
+ onBlur={() => setDraft(null)}
+ onChange={event => setDraft(event.target.value)}
+ onFocus={event => {
+ setDraft(url)
+ event.currentTarget.select()
+ }}
+ onKeyDown={event => {
+ if (event.key === 'Enter') {
+ commit(event.currentTarget.value)
+ event.currentTarget.blur()
+ }
+
+ if (event.key === 'Escape') {
+ setDraft(null)
+ event.currentTarget.blur()
+ }
+ }}
+ placeholder={copy.addressPlaceholder}
+ size="xs"
+ spellCheck={false}
+ value={draft ?? url}
+ />
+ <PaneStripGlyph
+ active={consoleOpen}
+ icon={<Codicon name="terminal" size="0.8125rem" />}
+ label={consoleOpen ? copy.hideConsole : copy.showConsole}
+ onSelect={onToggleConsole}
+ />
+ <PaneStripGlyph
+ active={devToolsOpen}
+ icon={<Codicon name="bug" size="0.8125rem" />}
+ label={devToolsOpen ? copy.hideDevTools : copy.openDevTools}
+ onSelect={onToggleDevTools}
+ />
+ </div>
+ )
+}
diff --git a/apps/desktop/src/app/chat/right-rail/preview-console-store.ts b/apps/desktop/src/app/chat/right-rail/preview-console-store.ts
new file mode 100644
index 00000000000..c67940c9986
--- /dev/null
+++ b/apps/desktop/src/app/chat/right-rail/preview-console-store.ts
@@ -0,0 +1,33 @@
+/**
+ * Per-tab preview console stores.
+ *
+ * The console panel lives in the pane and its toggle lives in the pane's
+ * browser bar, but the store has to outlive any one render and be addressable
+ * by tab id — a tab can be parked and remounted, and its logs come back with
+ * it. Created lazily per tab and cached here.
+ */
+
+import { createPreviewConsoleState, type PreviewConsoleState } from './preview-console-state'
+
+const consoleStates = new Map<string, PreviewConsoleState>()
+
+/** The console store for a tab, created on first use. */
+export function previewConsoleState(tabId: string): PreviewConsoleState {
+ const existing = consoleStates.get(tabId)
+
+ if (existing) {
+ return existing
+ }
+
+ const created = createPreviewConsoleState()
+
+ consoleStates.set(tabId, created)
+
+ return created
+}
+
+/** Drop a closed tab's console so a long-lived window doesn't pin every preview
+ * it ever opened. */
+export function forgetPreviewConsole(tabId: string) {
+ consoleStates.delete(tabId)
+}
diff --git a/apps/desktop/src/app/chat/right-rail/preview-pane.test.tsx b/apps/desktop/src/app/chat/right-rail/preview-pane.test.tsx
index 3118861d143..a35f4e4ae77 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-pane.test.tsx
+++ b/apps/desktop/src/app/chat/right-rail/preview-pane.test.tsx
@@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { $connection } from '@/store/session'
import { PreviewPane } from './preview-pane'
-import { forgetPreviewStripTools, previewConsoleState } from './preview-strip-tools'
+import { forgetPreviewConsole, previewConsoleState } from './preview-console-store'
function stubPdfObjectUrls() {
const NativeUrl = URL
@@ -74,7 +74,7 @@ describe('PreviewPane console state', () => {
it('streams console logs into the tab-keyed console store', async () => {
const tabId = 'url:http://localhost:5174'
- forgetPreviewStripTools(tabId)
+ forgetPreviewConsole(tabId)
let rendered!: ReturnType<typeof render>
await act(async () => {
@@ -107,7 +107,138 @@ describe('PreviewPane console state', () => {
expect(previewConsoleState(tabId).$logs.get().at(-1)?.message).toBe('streamed log line')
- forgetPreviewStripTools(tabId)
+ forgetPreviewConsole(tabId)
+ })
+
+ // The bar is chrome for a LIVE page. A file peek, an artifact, and remote
+ // HTML in a sandboxed iframe have no webview to navigate.
+ it('shows the browser bar only for a live webview preview', async () => {
+ let rendered!: ReturnType<typeof render>
+ await act(async () => {
+ rendered = render(
+ <PreviewPane
+ target={{ kind: 'url', label: 'Preview', source: 'http://localhost:5174', url: 'http://localhost:5174' }}
+ />
+ )
+ })
+
+ expect(rendered.queryByRole('textbox', { name: 'Address' })).not.toBeNull()
+
+ await act(async () => {
+ rendered.rerender(
+ <PreviewPane
+ target={{
+ kind: 'file',
+ label: 'notes.txt',
+ path: '/tmp/notes.txt',
+ previewKind: 'text',
+ source: '/tmp/notes.txt',
+ url: 'file:///tmp/notes.txt'
+ }}
+ />
+ )
+ })
+
+ expect(rendered.queryByRole('textbox', { name: 'Address' })).toBeNull()
+ })
+
+ it('drives the webview from the bar and tracks its history', async () => {
+ let rendered!: ReturnType<typeof render>
+ await act(async () => {
+ rendered = render(
+ <PreviewPane
+ target={{ kind: 'url', label: 'Preview', source: 'http://localhost:5174', url: 'http://localhost:5174' }}
+ />
+ )
+ })
+
+ const webview = rendered.container.querySelector('webview') as HTMLElement & Record<string, unknown>
+ const loadURL = vi.fn(async () => undefined)
+
+ Object.assign(webview, {
+ canGoBack: () => true,
+ canGoForward: () => false,
+ goBack: vi.fn(),
+ loadURL
+ })
+
+ // Back is disabled until the webview reports history, and a navigation is
+ // what makes it ask.
+ expect((rendered.getByRole('button', { name: 'Back' }) as HTMLButtonElement).disabled).toBe(true)
+
+ act(() => {
+ webview.dispatchEvent(Object.assign(new Event('did-navigate'), { url: 'http://localhost:5174/two' }))
+ })
+
+ const back = rendered.getByRole('button', { name: 'Back' }) as HTMLButtonElement
+
+ expect(back.disabled).toBe(false)
+ fireEvent.click(back)
+ expect(webview.goBack).toHaveBeenCalledOnce()
+
+ const address = rendered.getByRole('textbox', { name: 'Address' }) as HTMLInputElement
+
+ expect(address.value).toBe('http://localhost:5174/two')
+
+ fireEvent.focus(address)
+ fireEvent.change(address, { target: { value: 'localhost:4000/app' } })
+ fireEvent.keyDown(address, { key: 'Enter' })
+
+ // loadURL, not a `src` swap — re-entering the current address must reload.
+ expect(loadURL).toHaveBeenCalledWith('http://localhost:4000/app')
+ expect(webview.getAttribute('src')).toBe('http://localhost:5174')
+ })
+
+ it('surfaces a rejected navigation as a load error', async () => {
+ let rendered!: ReturnType<typeof render>
+ await act(async () => {
+ rendered = render(
+ <PreviewPane
+ target={{ kind: 'url', label: 'Preview', source: 'http://localhost:5174', url: 'http://localhost:5174' }}
+ />
+ )
+ })
+
+ const webview = rendered.container.querySelector('webview') as HTMLElement & Record<string, unknown>
+
+ Object.assign(webview, { loadURL: vi.fn(async () => Promise.reject(new Error('ERR_CONNECTION_REFUSED'))) })
+
+ const address = rendered.getByRole('textbox', { name: 'Address' }) as HTMLInputElement
+
+ await act(async () => {
+ fireEvent.focus(address)
+ fireEvent.change(address, { target: { value: 'http://localhost:4000' } })
+ fireEvent.keyDown(address, { key: 'Enter' })
+ })
+
+ await waitFor(() => expect(rendered.container.textContent).toContain('ERR_CONNECTION_REFUSED'), {
+ container: rendered.container
+ })
+ })
+
+ // `about:blank` in a webview is a white void that reads as broken against
+ // the app's chrome — the pane should say it's empty on purpose.
+ it('shows the blank-page empty state instead of a white void', async () => {
+ let rendered!: ReturnType<typeof render>
+ await act(async () => {
+ rendered = render(
+ <PreviewPane
+ target={{ kind: 'url', label: 'Browser', source: 'about:blank', url: 'about:blank' }}
+ />
+ )
+ })
+
+ expect(rendered.container.textContent).toContain('Type an address above')
+
+ const webview = rendered.container.querySelector('webview') as HTMLElement
+
+ // Navigating away dismisses it; the bar and the webview stay put.
+ act(() => {
+ webview.dispatchEvent(Object.assign(new Event('did-navigate'), { url: 'https://example.com' }))
+ })
+
+ expect(rendered.container.textContent).not.toContain('Type an address above')
+ expect(rendered.queryByRole('textbox', { name: 'Address' })).not.toBeNull()
})
it('renders authenticated remote HTML safely and honors source mode', async () => {
diff --git a/apps/desktop/src/app/chat/right-rail/preview-pane.tsx b/apps/desktop/src/app/chat/right-rail/preview-pane.tsx
index 681b1463b72..b614b266eec 100644
--- a/apps/desktop/src/app/chat/right-rail/preview-pane.tsx
+++ b/apps/desktop/src/app/chat/right-rail/preview-pane.tsx
@@ -2,6 +2,7 @@ import { useStore } from '@nanostores/react'
import type { PointerEvent as ReactPointerEvent } from 'react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import { PanelEmpty } from '@/app/overlays/panel'
import { Tip } from '@/components/ui/tooltip'
import { type Translations, useI18n } from '@/i18n'
import { isDesktopFsRemoteMode } from '@/lib/desktop-fs'
@@ -13,6 +14,7 @@ import { notify, notifyError } from '@/store/notifications'
import { $previewServerRestart, failPreviewServerRestart, type PreviewTarget } from '@/store/preview'
import { ArtifactPreview } from './preview-artifact'
+import { PreviewBrowserBar } from './preview-browser-bar'
import {
clampConsoleHeight,
compactUrl,
@@ -21,16 +23,22 @@ import {
PreviewConsolePanel
} from './preview-console'
import { type ConsoleEntry } from './preview-console-state'
+import { previewConsoleState } from './preview-console-store'
import { LocalFilePreview, PreviewEmptyState } from './preview-file'
import { registerPreviewPageReader } from './preview-reader'
-import { previewConsoleState, registerPreviewDevTools } from './preview-strip-tools'
+import { PREVIEW_BROWSER_ATTR, registerPreviewNav } from './preview-nav'
type PreviewWebview = HTMLElement & {
+ canGoBack?: () => boolean
+ canGoForward?: () => boolean
closeDevTools?: () => void
executeJavaScript?: (code: string) => Promise<unknown>
getTitle?: () => string
getURL?: () => string
+ goBack?: () => void
+ goForward?: () => void
isDevToolsOpened?: () => boolean
+ loadURL?: (url: string) => Promise<void>
openDevTools?: () => void
reload?: () => void
reloadIgnoringCache?: () => void
@@ -40,8 +48,8 @@ interface PreviewPaneProps {
embedded?: boolean
onRestartServer?: (url: string, context?: string) => Promise<string>
reloadRequest?: number
- /** The preview tab this pane renders. Keys the per-tab console store and the
- * DevTools handle the STRIP glyphs read (see preview-strip-tools). */
+ /** The preview tab this pane renders. Keys the per-tab console store the
+ * browser bar's console toggle and the console panel both read. */
tabId?: string
target: PreviewTarget
}
@@ -143,6 +151,7 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
const consoleOpen = useStore(consoleState.$open)
const [currentUrl, setCurrentUrl] = useState(target.url)
const [devtoolsOpen, setDevtoolsOpen] = useState(false)
+ const [history, setHistory] = useState({ back: false, forward: false })
const [loading, setLoading] = useState(true)
const [loadError, setLoadError] = useState<PreviewLoadErrorState | null>(null)
const [localReloadKey, setLocalReloadKey] = useState(0)
@@ -165,6 +174,11 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
const currentLabel = compactUrl(currentUrl)
+ // Nothing loaded: no address yet, or the blank page itself. A webview on
+ // `about:blank` paints a white void that reads as broken next to the app's
+ // dark chrome, so the pane says what it is instead.
+ const isBlankPage = isWebPreview && !isRemoteHtml && (!currentUrl || /^about:blank\/?$/i.test(currentUrl))
+
const previewLabel =
target.label && target.label.replace(/\/$/, '') !== currentLabel.replace(/\/$/, '') ? target.label : currentLabel
@@ -305,24 +319,47 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
webview.openDevTools()
}, [])
- // Publish the DevTools handle for THIS tab so the tab's own toggle can drive
- // the webview (which only exists in here). Registered on every open/close
- // change so the button's active state stays truthful.
- useEffect(() => {
- if (!isWebPreview || !tabId) {
- return
+ const navigateTo = useCallback((url: string) => {
+ setLoadError(null)
+ // loadURL, not a `src` swap: `src` only reloads when the value CHANGES, so
+ // re-entering the address you're already on would do nothing. A rejected
+ // load is a real navigation failure the user has to see — `did-fail-load`
+ // doesn't fire for every rejection (a bad scheme rejects outright).
+ void Promise.resolve(webviewRef.current?.loadURL?.(url)).catch((error: unknown) => {
+ setLoadError({
+ description: error instanceof Error ? error.message : copy.unreachableDescription,
+ url
+ })
+ setLoading(false)
+ })
+ }, [copy.unreachableDescription])
+
+ const goBack = useCallback(() => {
+ const webview = webviewRef.current
+
+ if (webview?.canGoBack?.()) {
+ webview.goBack?.()
}
+ }, [])
- // Remote HTML renders in a sandboxed iframe, not a webview — there is no
- // console and no DevTools to offer (same guard the titlebar tools had).
- if (isRemoteHtml) {
- return
+ const goForward = useCallback(() => {
+ const webview = webviewRef.current
+
+ if (webview?.canGoForward?.()) {
+ webview.goForward?.()
}
+ }, [])
- registerPreviewDevTools(tabId, { open: devtoolsOpen, toggle: toggleDevTools })
+ // Gestures that land on the app's chrome (⌘R from the address bar, a mouse
+ // button over the frame). A gesture made INSIDE the page is answered by main
+ // against the focused guest — this renderer can't see into a webview.
+ useEffect(() => {
+ if (!isWebPreview || isRemoteHtml || !tabId) {
+ return
+ }
- return () => registerPreviewDevTools(tabId, null)
- }, [devtoolsOpen, isRemoteHtml, isWebPreview, tabId, toggleDevTools])
+ return registerPreviewNav(tabId, { back: goBack, forward: goForward, reload: reloadPreview })
+ }, [goBack, goForward, isRemoteHtml, isWebPreview, reloadPreview, tabId])
// Publish the PAGE reader for this tab (the read_preview tool): extract the
// rendered page's title + visible text from the webview. innerText (not
@@ -544,6 +581,7 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
webviewRef.current = null
setCurrentUrl(target.url)
setDevtoolsOpen(false)
+ setHistory({ back: false, forward: false })
setLoadError(null)
consoleState.reset()
setLoading(true)
@@ -586,6 +624,9 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
}
}
+ const syncHistory = () =>
+ setHistory({ back: webview.canGoBack?.() ?? false, forward: webview.canGoForward?.() ?? false })
+
const onNavigate = (event: Event) => {
const detail = event as Event & { url?: string }
@@ -593,6 +634,12 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
setLoadError(null)
setCurrentUrl(detail.url)
}
+
+ // Ask the webview rather than counting navigations: the guest page can
+ // move itself (redirects, history.pushState, a link into a new document),
+ // so it is the only thing that knows what its history holds. Wired to
+ // `did-navigate-in-page` too, or SPA route changes never update it.
+ syncHistory()
}
const onFail = (event: Event) => {
@@ -621,7 +668,14 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
}
const onStart = () => setLoading(true)
- const onStop = () => setLoading(false)
+
+ const onStop = () => {
+ setLoading(false)
+ // A load that ends without a `did-navigate` (an in-place reload, a
+ // cancelled navigation) still settles the history — resync so the
+ // buttons can't be left stale.
+ syncHistory()
+ }
// The WEBVIEW is the source of truth for DevTools, not our click handler:
// closing the DevTools window itself fires devtools-closed with no click,
// and the glyph was left stuck "on" when we tracked it locally.
@@ -653,7 +707,27 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
}, [appendConsoleEntry, consoleState, copy, isRemoteHtml, isWebPreview, target.url])
return (
- <aside className="relative flex h-full w-full min-w-0 flex-col overflow-hidden bg-transparent text-muted-foreground">
+ <aside
+ className="relative flex h-full w-full min-w-0 flex-col overflow-hidden bg-transparent text-muted-foreground"
+ // Buttons 3/4 are a mouse's back/forward. Chromium delivers them to the
+ // renderer as a normal mouse event inside the app's own chrome (the
+ // guest page gets its own via `app-command` in main), and unhandled they
+ // walk the HOST document's history.
+ onMouseDown={event => {
+ if (event.button !== 3 && event.button !== 4) {
+ return
+ }
+
+ event.preventDefault()
+
+ if (event.button === 3) {
+ goBack()
+ } else {
+ goForward()
+ }
+ }}
+ {...(isWebPreview && !isRemoteHtml && tabId ? { [PREVIEW_BROWSER_ATTR]: tabId } : {})}
+ >
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
{!embedded && (
<div className="pointer-events-none flex min-h-(--titlebar-height) items-center gap-1.5 border-b border-border/60 bg-background px-2 py-1">
@@ -678,6 +752,23 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
</div>
)}
+ {isWebPreview && !isRemoteHtml && (
+ <PreviewBrowserBar
+ canGoBack={history.back}
+ canGoForward={history.forward}
+ consoleOpen={consoleOpen}
+ devToolsOpen={devtoolsOpen}
+ loading={loading}
+ onBack={goBack}
+ onForward={goForward}
+ onNavigate={navigateTo}
+ onReload={reloadPreview}
+ onToggleConsole={() => consoleState.setOpen(open => !open)}
+ onToggleDevTools={toggleDevTools}
+ url={currentUrl}
+ />
+ )}
+
<div
className="pointer-events-auto relative min-h-0 flex-1 overflow-hidden bg-transparent"
ref={previewContentRef}
@@ -704,6 +795,11 @@ export function PreviewPane({ embedded = false, onRestartServer, reloadRequest =
) : (
<LocalFilePreview reloadKey={localReloadKey} target={target} />
))}
+ {isBlankPage && (
+ <div className="absolute inset-0 grid bg-background">
+ <PanelEmpty description={copy.blankPageBody} icon="globe" />
+ </div>
+ )}
{loadError && (
<PreviewLoadError
consoleHeight={consoleOpen ? consoleHeight : 0}
diff --git a/apps/desktop/src/app/chat/right-rail/preview-strip-tools.tsx b/apps/desktop/src/app/chat/right-rail/preview-strip-tools.tsx
deleted file mode 100644
index ddbd92ba4f7..00000000000
--- a/apps/desktop/src/app/chat/right-rail/preview-strip-tools.tsx
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Per-preview strip tools — the console toggle and the DevTools toggle.
- *
- * These were titlebar tools (`setTitlebarToolGroup`): one global pair, far from
- * the thing they act on and ambiguous the moment two previews were open. They're
- * strip glyphs now, contributed as `PaneStripTool` DATA — the strip renders them
- * with `PaneStripGlyph`, the same button the "+" is, so there is no preview-owned
- * styling to drift.
- *
- * The state has to outlive any one pane render and be addressable by tab id: the
- * console store is created lazily per tab and cached here, and `PreviewPane`
- * registers its DevTools handle for the tab it renders. Both invalidate the
- * strip so `active` / `disabled` stay truthful.
- */
-
-import { invalidateStripTools } from '@/components/pane-shell/tree/store'
-import { Codicon } from '@/components/ui/codicon'
-import type { PaneStripTool } from '@/components/ui/pane-tab'
-import { translateNow } from '@/i18n'
-
-import { createPreviewConsoleState, type PreviewConsoleState } from './preview-console-state'
-
-interface DevToolsHandle {
- open: boolean
- toggle: () => void
-}
-
-const consoleStates = new Map<string, PreviewConsoleState>()
-
-/** The console store for a tab, created on first use. Cached so the strip glyph
- * and the panel in the pane read the SAME store. */
-export function previewConsoleState(tabId: string): PreviewConsoleState {
- const existing = consoleStates.get(tabId)
-
- if (existing) {
- return existing
- }
-
- const created = createPreviewConsoleState()
-
- // Opening/closing the console flips the glyph's `active`, and the strip reads
- // its tools during render — so tell it to re-read.
- created.$open.listen(() => invalidateStripTools())
- consoleStates.set(tabId, created)
-
- return created
-}
-
-/** DevTools handles by tab id. The pane registers on mount (the webview only
- * exists in there); until it lands the glyph renders disabled. */
-const devToolsHandles = new Map<string, DevToolsHandle>()
-
-export function registerPreviewDevTools(tabId: string, handle: DevToolsHandle | null) {
- if (handle) {
- devToolsHandles.set(tabId, handle)
- } else if (!devToolsHandles.delete(tabId)) {
- return
- }
-
- invalidateStripTools()
-}
-
-/** Drop a closed tab's state so a long-lived window doesn't pin every preview it
- * ever opened. */
-export function forgetPreviewStripTools(tabId: string) {
- consoleStates.delete(tabId)
- registerPreviewDevTools(tabId, null)
-}
-
-/**
- * The console + DevTools glyphs for a preview, as strip-tool DATA. Only wired for
- * `url` previews — a file/artifact peek has no webview, hence no console and no
- * DevTools.
- */
-export function previewStripTools(tabId: string): readonly PaneStripTool[] {
- const consoleState = previewConsoleState(tabId)
- const consoleOpen = consoleState.$open.get()
- const devTools = devToolsHandles.get(tabId)
-
- return [
- {
- active: consoleOpen,
- icon: <Codicon name="terminal" size="0.8125rem" />,
- id: 'preview-console',
- label: translateNow(consoleOpen ? 'preview.web.hideConsole' : 'preview.web.showConsole'),
- onSelect: () => consoleState.setOpen(open => !open)
- },
- {
- active: devTools?.open,
- disabled: !devTools,
- icon: <Codicon name="bug" size="0.8125rem" />,
- id: 'preview-devtools',
- label: translateNow(devTools?.open ? 'preview.web.hideDevTools' : 'preview.web.openDevTools'),
- onSelect: () => devTools?.toggle()
- }
- ]
-}
diff --git a/apps/desktop/src/app/chat/right-rail/preview.tsx b/apps/desktop/src/app/chat/right-rail/preview.tsx
index 48ebdce6ac4..625bae8ea4b 100644
--- a/apps/desktop/src/app/chat/right-rail/preview.tsx
+++ b/apps/desktop/src/app/chat/right-rail/preview.tsx
@@ -15,9 +15,10 @@ interface PreviewTilePaneProps {
* drag/stack/split and ⌘W — belongs to the ZONE (see `preview-tile.tsx`), so
* this renders only the body and a preview tab behaves like every other tab.
*
- * The console / DevTools glyphs live in the zone STRIP (`preview-strip-tools`),
- * keyed by `tabId`; the restart handler arrives through the atom bridge the old
- * rail wrapper used, since the mirror renders this pane with no props to thread.
+ * The console / DevTools toggles live in the pane's own browser bar beside the
+ * address (`preview-browser-bar`); the restart handler arrives through the atom
+ * bridge the old rail wrapper used, since the mirror renders this pane with no
+ * props to thread.
*/
export function PreviewTilePane({ tabId }: PreviewTilePaneProps) {
const previewReloadRequest = useStore($previewReloadRequest)
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts b/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts
index f1d27741e25..57652df418f 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/track-model.ts
@@ -9,7 +9,6 @@
import type * as React from 'react'
-import type { PaneStripTool } from '@/components/ui/pane-tab'
import type { Contribution } from '@/contrib/types'
import type { GroupNode, LayoutNode } from '../model'
@@ -91,12 +90,6 @@ interface PaneChrome extends PaneSizing {
* whole panes area, so the label subscribes for itself instead. Absent, or
* returning nothing, falls back to `title`. */
tabTitle?: () => React.ReactNode
- /** Glyph buttons this pane contributes to the strip, rendered after the last
- * tab (where "+" sits) while the pane is ACTIVE — controls that act on the
- * pane, not on any one tab: a preview's console / DevTools toggles. DATA, not
- * markup: `PaneStripGlyph` owns the styling so every glyph on every strip
- * matches. Read on each render, so a live store drives `active`/`disabled`. */
- stripTools?: () => readonly PaneStripTool[]
}
export const paneChrome = (c: Contribution | undefined) => (c?.data ?? {}) as PaneChrome
diff --git a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx
index cdf9081dd3a..638cad093b9 100644
--- a/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx
+++ b/apps/desktop/src/components/pane-shell/tree/renderer/tree-group.tsx
@@ -41,7 +41,6 @@ import {
$narrowViewport,
$newSessionTabAction,
$panesWithCloser,
- $stripToolsRevision,
$treeDragging,
$treePaneEpochs,
activateTreePane,
@@ -196,9 +195,6 @@ export function TreeGroup({
// Reload epochs: only an explicit tab-menu Reload writes here, so this
// subscription costs nothing on a normal render.
const paneEpochs = useStore($treePaneEpochs)
- // Re-read the active pane's contributed strip glyphs when their state changes
- // (a toggle flipped, a DevTools handle registered).
- useStore($stripToolsRevision)
const paneFor = (id: string) => panes.find(p => p.id === id)
@@ -557,15 +553,6 @@ export function TreeGroup({
return <Fragment key={paneId}>{chrome.tabWrap ? chrome.tabWrap(tab) : tab}</Fragment>
})}
- {/* Bare glyphs after the last tab: whatever the ACTIVE pane
- contributes (a preview's console / DevTools), then the "+".
- All of them are PaneStripGlyph — same size, colour and hover,
- because they're the same button. */}
- {!node.minimized &&
- paneChrome(active)
- .stripTools?.()
- .map(tool => <PaneStripGlyph key={tool.id} {...tool} />)}
-
{/* Plain "+" after the last tab of a CHAT strip (the workspace
zone, or any zone holding session tabs) — always shown. Creates
a new session tab (mirrors ⌘T) via the app-registered action;
diff --git a/apps/desktop/src/components/pane-shell/tree/store.ts b/apps/desktop/src/components/pane-shell/tree/store.ts
index 6937a92b5c5..622323d10f6 100644
--- a/apps/desktop/src/components/pane-shell/tree/store.ts
+++ b/apps/desktop/src/components/pane-shell/tree/store.ts
@@ -315,16 +315,6 @@ export function registerLayoutResetHandler(fn: () => void): () => void {
* click lands on a non-focusable surface). Tracked by trackActiveTreeGroup. */
export const $activeTreeGroup = atom<null | string>(null)
-/** Bumped whenever a pane's contributed STRIP TOOLS change shape (a toggle
- * flipped, a handle registered). The strip reads `stripTools()` during render,
- * so it needs one signal to re-read — generic on purpose: the tree knows
- * nothing about what any pane's tools mean. */
-export const $stripToolsRevision = atom(0)
-
-export function invalidateStripTools() {
- $stripToolsRevision.set($stripToolsRevision.get() + 1)
-}
-
/** Record the interacted zone (pointerdown / focusin). Idempotent. */
export function noteActiveTreeGroup(groupId: null | string) {
if (groupId !== $activeTreeGroup.get()) {
diff --git a/apps/desktop/src/i18n/ar.ts b/apps/desktop/src/i18n/ar.ts
index 30132b7be20..63c027b9425 100644
--- a/apps/desktop/src/i18n/ar.ts
+++ b/apps/desktop/src/i18n/ar.ts
@@ -1133,6 +1133,7 @@ export const ar = defineLocale({
restartGateway: 'إعادة تشغيل البوابة',
gatewayRestartFailed: 'فشل إعادة تشغيل البوابة.',
updateHermes: 'تحديث Hermes',
+ reloadWindow: 'إعادة تحميل النافذة',
actionRunning: 'الإجراء قيد التشغيل',
actionDone: 'اكتمل الإجراء',
actionFailed: 'فشل الإجراء',
@@ -2292,6 +2293,12 @@ export const ar = defineLocale({
showConsole: 'إظهار كونسول المعاينة',
hideDevTools: 'إخفاء DevTools المعاينة',
openDevTools: 'فتح DevTools المعاينة',
+ goBack: 'رجوع',
+ goForward: 'تقدم',
+ reload: 'إعادة تحميل الصفحة',
+ address: 'العنوان',
+ addressPlaceholder: 'أدخل العنوان',
+ blankPageBody: 'اكتب عنوانًا في الأعلى للتصفح، أو اطلب من Hermes فتح صفحة.',
finishedRestarting: message => `أنهى Hermes إعادة تشغيل خادم المعاينة${message ? `: ${message}` : ''}`,
failedRestarting: message => `فشلت إعادة تشغيل الخادم: ${message}`,
unknownError: 'خطأ غير معروف',
diff --git a/apps/desktop/src/i18n/en.ts b/apps/desktop/src/i18n/en.ts
index 32567ffd682..bb751260f48 100644
--- a/apps/desktop/src/i18n/en.ts
+++ b/apps/desktop/src/i18n/en.ts
@@ -1415,6 +1415,7 @@ export const en: Translations = {
restartGateway: 'Restart gateway',
gatewayRestartFailed: 'Gateway restart failed.',
updateHermes: 'Update Hermes',
+ reloadWindow: 'Reload window',
actionRunning: 'running',
actionDone: 'done',
actionFailed: 'failed',
@@ -2885,6 +2886,12 @@ export const en: Translations = {
showConsole: 'Show preview console',
hideDevTools: 'Hide preview DevTools',
openDevTools: 'Open preview DevTools',
+ goBack: 'Back',
+ goForward: 'Forward',
+ reload: 'Reload page',
+ address: 'Address',
+ addressPlaceholder: 'Enter address',
+ blankPageBody: 'Type an address above to browse, or ask Hermes to open a page.',
finishedRestarting: message => `Hermes finished restarting the preview server${message ? `: ${message}` : ''}`,
failedRestarting: message => `Server restart failed: ${message}`,
unknownError: 'unknown error',
diff --git a/apps/desktop/src/i18n/ja.ts b/apps/desktop/src/i18n/ja.ts
index 148df8523bf..18b165d8036 100644
--- a/apps/desktop/src/i18n/ja.ts
+++ b/apps/desktop/src/i18n/ja.ts
@@ -1290,6 +1290,7 @@ export const ja = defineLocale({
restartGateway: 'ゲートウェイを再起動',
gatewayRestartFailed: 'ゲートウェイの再起動に失敗しました。',
updateHermes: 'Hermes を更新',
+ reloadWindow: 'ウィンドウを再読み込み',
actionRunning: '実行中',
actionDone: '完了',
actionFailed: '失敗',
@@ -2578,6 +2579,12 @@ export const ja = defineLocale({
showConsole: 'プレビューコンソールを表示',
hideDevTools: 'プレビュー DevTools を非表示',
openDevTools: 'プレビュー DevTools を開く',
+ goBack: '戻る',
+ goForward: '進む',
+ reload: 'ページを再読み込み',
+ address: 'アドレス',
+ addressPlaceholder: 'アドレスを入力',
+ blankPageBody: '上のアドレス欄に入力するか、Hermes にページを開くよう頼んでください。',
finishedRestarting: message =>
`Hermes がプレビューサーバーの再起動を完了しました${message ? `: ${message}` : ''}`,
failedRestarting: message => `サーバーの再起動に失敗しました: ${message}`,
diff --git a/apps/desktop/src/i18n/types.ts b/apps/desktop/src/i18n/types.ts
index 48d57b6cc16..1a660f0dbb8 100644
--- a/apps/desktop/src/i18n/types.ts
+++ b/apps/desktop/src/i18n/types.ts
@@ -1241,6 +1241,7 @@ export interface Translations {
restartGateway: string
gatewayRestartFailed: string
updateHermes: string
+ reloadWindow: string
actionRunning: string
actionDone: string
actionFailed: string
@@ -2462,6 +2463,12 @@ export interface Translations {
showConsole: string
hideDevTools: string
openDevTools: string
+ goBack: string
+ goForward: string
+ reload: string
+ address: string
+ addressPlaceholder: string
+ blankPageBody: string
finishedRestarting: (message?: string) => string
failedRestarting: (message: string) => string
unknownError: string
diff --git a/apps/desktop/src/i18n/zh-hant.ts b/apps/desktop/src/i18n/zh-hant.ts
index 092bbf4e996..e669365a63d 100644
--- a/apps/desktop/src/i18n/zh-hant.ts
+++ b/apps/desktop/src/i18n/zh-hant.ts
@@ -1252,6 +1252,7 @@ export const zhHant = defineLocale({
restartGateway: '重新啟動閘道',
gatewayRestartFailed: '閘道重新啟動失敗。',
updateHermes: '更新 Hermes',
+ reloadWindow: '重新載入視窗',
actionRunning: '執行中',
actionDone: '完成',
actionFailed: '失敗',
@@ -2494,6 +2495,12 @@ export const zhHant = defineLocale({
showConsole: '顯示預覽主控台',
hideDevTools: '隱藏預覽 DevTools',
openDevTools: '開啟預覽 DevTools',
+ goBack: '上一頁',
+ goForward: '下一頁',
+ reload: '重新載入頁面',
+ address: '網址',
+ addressPlaceholder: '輸入網址',
+ blankPageBody: '在上方輸入網址開始瀏覽,或請 Hermes 開啟頁面。',
finishedRestarting: message => `Hermes 已完成預覽伺服器重新啟動${message ? `:${message}` : ''}`,
failedRestarting: message => `伺服器重新啟動失敗:${message}`,
unknownError: '未知錯誤',
diff --git a/apps/desktop/src/i18n/zh.ts b/apps/desktop/src/i18n/zh.ts
index 9b977df4946..8c812bea286 100644
--- a/apps/desktop/src/i18n/zh.ts
+++ b/apps/desktop/src/i18n/zh.ts
@@ -1604,6 +1604,7 @@ export const zh: Translations = {
restartGateway: '重启网关',
gatewayRestartFailed: '网关重启失败。',
updateHermes: '更新 Hermes',
+ reloadWindow: '重新载入窗口',
actionRunning: '运行中',
actionDone: '完成',
actionFailed: '失败',
@@ -3053,6 +3054,12 @@ export const zh: Translations = {
showConsole: '显示预览控制台',
hideDevTools: '隐藏预览 DevTools',
openDevTools: '打开预览 DevTools',
+ goBack: '后退',
+ goForward: '前进',
+ reload: '重新加载页面',
+ address: '地址',
+ addressPlaceholder: '输入地址',
+ blankPageBody: '在上方输入地址开始浏览,或让 Hermes 打开一个页面。',
finishedRestarting: message => `Hermes 已完成预览服务器重启${message ? `: ${message}` : ''}`,
failedRestarting: message => `服务器重启失败:${message}`,
unknownError: '未知错误',