@@ -474,6 +682,31 @@ function EmbedView(props: EmbedProps & { input: Input; bridge: Bridge }) {
)
}
+// The child of `root` that contains `node`.
+function ancestorBelow(root: Element, node: Element) {
+ for (let current: Element | null = node; current; current = current.parentElement) {
+ if (current.parentElement === root) return current
+ }
+}
+
+// Whether a visible, positioned surface that takes input, `depth` levels into a portal at most, overlaps the box. A
+// wrapper that lets input through is transparent: a full-window portal container never counts, only what it holds.
+function floats(node: Element, rect: DOMRect, depth: number): boolean {
+ // Marked surfaces were measured with their dialog layer.
+ if (node.matches(overlay)) return false
+ const style = getComputedStyle(node)
+
+ if (style.display === "none" || style.visibility === "hidden" || style.opacity === "0") return false
+
+ if ((style.position === "fixed" || style.position === "absolute") && style.pointerEvents !== "none") {
+ const box = node.getBoundingClientRect()
+
+ if (box.width > 1 && box.height > 1 && overlaps(rect, box)) return true
+ }
+
+ return depth > 0 && Array.from(node.children).some((child) => floats(child, rect, depth - 1))
+}
+
// Decodes a JPEG still, so it paints in the frame it enters the DOM. Undefined when there is none or it cannot decode.
async function decode(data: Uint8Array | undefined) {
if (!data?.length) return undefined
diff --git a/packages/app/src/runtime/plugin/host-apis.tsx b/packages/app/src/runtime/plugin/host-apis.tsx
index bda8e4152bbf..3975dd08d3f2 100644
--- a/packages/app/src/runtime/plugin/host-apis.tsx
+++ b/packages/app/src/runtime/plugin/host-apis.tsx
@@ -53,6 +53,7 @@ import { useCurrentRoute, useLayout } from "@/shell/state/layout"
import { sessionPaneTab, sessionTabPane, type SessionPane } from "@/shell/state/session-tabs"
import { terminalFontFamily, useSettings } from "@/settings/model"
import { useSettingsSurface } from "@/settings/surface"
+import { fitsSidePane } from "@/session/session-panel-width"
import { formatKeybindParts, useCommand } from "@/shell/commands/command"
import { createMediaQuery } from "@solid-primitives/media"
import { useIsRouting, useLocation } from "@solidjs/router"
@@ -312,9 +313,7 @@ export function createHostApis() {
return true
},
openExternal(url) {
- if (platform.openLocalFile && URL.canParse(url) && new URL(url).protocol === "file:")
- return platform.openLocalFile(url)
- platform.openExternal(url)
+ if (/^(?:https?:\/\/|mailto:)/i.test(url) && URL.canParse(url)) platform.openExternal(url)
},
}),
desktop: () =>
@@ -460,6 +459,7 @@ export function createHostApis() {
// Before the interface mounts, reads return what an empty layout holds and writes wait for it.
layout: (plugin) => ({
narrow,
+ fitsSide: () => fitsSidePane(document.querySelector("[data-pane-row]")?.getBoundingClientRect().width ?? 0),
ready: () => current()?.layout.ready() ?? false,
open: (key, session, options) => write((value) => value.layout.open(key, session, options)),
close: (key, session) => write((value) => value.layout.close(key, session)),
diff --git a/packages/app/src/runtime/plugin/host.tsx b/packages/app/src/runtime/plugin/host.tsx
index 4f126a5fadb9..6735d34e9a0d 100644
--- a/packages/app/src/runtime/plugin/host.tsx
+++ b/packages/app/src/runtime/plugin/host.tsx
@@ -103,7 +103,7 @@ type Instance = {
export type PluginInput = { readonly options: PluginOptions; readonly client: () => OpenCodeClient | undefined }
/** The APIs a window context exposes as properties. */
-type HostApis = Omit
+type HostApis = Omit
/**
* Creates one HostApi for a plugin instance, on the instance's first read of it. `register` withdraws what it is
@@ -186,7 +186,7 @@ export function PluginHostProvider(props: ParentProps) {
function createHost(input: HostInput) {
const language = useLanguage()
const owner = getOwner()
- const provided = new Map & { readonly status: "active" } }>()
+ const provided = new Map Live>()
const generations = new Map()
// Entries are indexed by registry and contracts versioned by token, so a change wakes only its own readers.
@@ -266,10 +266,10 @@ function createHost(input: HostInput) {
return pending
}
- const contractLive = (token: Contract): Live => {
+ const contractLive = (token: Contract, consumer: string, signal: AbortSignal): Live => {
void state.contracts[token.id]
- return provided.get(token.id)?.live ?? absent(token.id, false)
+ return provided.get(token.id)?.(consumer, signal) ?? absent(token.id, false)
}
// Reuses each item object while its value is unchanged so keyed renders do not remount.
@@ -687,7 +687,7 @@ function createHost(input: HostInput) {
if (existing) return existing
- const read = liveAccessor(token.kind === "contract" ? () => contractLive(token) : () => ipcLive(token))
+ const read = liveAccessor(token.kind === "contract" ? () => contractLive(token, plugin, controller.signal) : () => ipcLive(token))
lives.set(token.id, read)
@@ -837,6 +837,9 @@ function createHost(input: HostInput) {
provide(token: Contract | Ipc, impl: T) {
if (token.kind === "ipc") throw new Error("Ipcs are provided by a plugin's main entry")
+ return context.provideFor(token, () => impl)
+ },
+ provideFor(token: Contract, bind: (consumer: string, signal: AbortSignal) => T) {
if (!owns(plugin, token.id)) throw new Error(`${plugin} provides only its own contracts, not "${token.id}"`)
if (late()) return () => {}
@@ -845,7 +848,17 @@ function createHost(input: HostInput) {
generations.set(token.id, generation)
- const entry = { live: { status: "active", value: impl, generation } as const }
+ const clients = new WeakMap>()
+
+ const entry = (consumer: string, signal: AbortSignal) => {
+ const previous = clients.get(signal)
+
+ if (previous) return previous
+ const live = { status: "active", value: untrack(() => bind(consumer, signal)), generation } as const
+ clients.set(signal, live)
+
+ return live
+ }
provided.set(token.id, entry)
setState("contracts", token.id, (version = 0) => version + 1)
diff --git a/packages/app/src/runtime/plugin/pane-drag.tsx b/packages/app/src/runtime/plugin/pane-drag.tsx
index 3e870972f7ac..8cf7f7198a09 100644
--- a/packages/app/src/runtime/plugin/pane-drag.tsx
+++ b/packages/app/src/runtime/plugin/pane-drag.tsx
@@ -228,6 +228,7 @@ export function createPaneDrag(input: {
{(target) => (
{current().title}
diff --git a/packages/app/src/runtime/plugin/render.tsx b/packages/app/src/runtime/plugin/render.tsx
index 90be86625e8d..e24a7bead6a5 100644
--- a/packages/app/src/runtime/plugin/render.tsx
+++ b/packages/app/src/runtime/plugin/render.tsx
@@ -14,6 +14,7 @@ import {
type ParentProps,
} from "solid-js"
import { Portal, render } from "solid-js/web"
+import { makeEventListener } from "@solid-primitives/event-listener"
import {
MarkdownProvider,
useMarkdown,
@@ -33,10 +34,15 @@ import {
type CodeBlockProps,
type MountedSession,
} from "@opencode/plugin/gui"
-import { BuiltinSlot, type BuiltinSlotMap } from "@opencode/plugin/gui/builtin"
+import { BuiltinAppLink, BuiltinSlot, type BuiltinSlotMap } from "@opencode/plugin/gui/builtin"
+import { usePlatform } from "@/runtime/platform/platform"
+import { useLanguage } from "@/runtime/i18n/language"
+import { showToast } from "@/shell/notifications/toast"
+import { createAppLinks } from "./app-links"
import { PluginContext } from "@opencode/plugin/gui/host"
import { usePluginHost, type Item } from "./host"
import { createLinkCheck } from "./link-check"
+import { webHref } from "./web-href"
/**
* Renders one plugin contribution with its context and error isolation: a contribution that throws records the
@@ -154,6 +160,7 @@ export function PluginThemes(props: { loaded: () => boolean }) {
export function PluginLinks(props: ParentProps<{ session: MountedSession; active?: boolean }>) {
const host = usePluginHost()
const markdown = useMarkdown()
+ const desktop = usePlatform().platform === "desktop"
// Checks untracked: markdown calls this inside its render effect, which must not follow the routed session.
const localFileExists = createLinkCheck(
@@ -163,6 +170,7 @@ export function PluginLinks(props: ParentProps<{ session: MountedSession; active
const Links = (inner: ParentProps<{ codeBlocks: MarkdownCodeBlocks | false }>) => (
void host.links.open({ href, session: props.session })}
localFileExists={localFileExists}
@@ -187,6 +195,41 @@ export function PluginLinks(props: ParentProps<{ session: MountedSession; active
)
}
+/**
+ * Offers a plain click on a web link in the session screen (its conversation and side panels) to the LinkHandler
+ * contributions first, as `Links.open({ href, session })`. A click with a modifier key, or one no handler takes, keeps
+ * the link's own behavior: the system browser.
+ */
+export function createWebLinks(session: () => MountedSession) {
+ const host = usePluginHost()
+ const language = useLanguage()
+
+ if (usePlatform().platform === "desktop") createAppLinks((href) => {
+ const handler = host.items(BuiltinAppLink)[0]
+
+ if (handler) return handler.value.review(href)
+ showToast({ title: language.t("common.requestFailed") })
+ })
+
+ makeEventListener(document, "click", (event) => {
+ const href = webLink(event, session)
+
+ if (href && host.links.open({ href, session: session() })) event.preventDefault()
+ })
+}
+
+function webLink(event: MouseEvent, session: () => MountedSession) {
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
+ return
+ const anchor = event.target instanceof Element ? event.target.closest("a[href]") : null
+
+ // `data-pane-row` holds the conversation and the side panels; dialogs and menus render outside it.
+ if (!(anchor instanceof HTMLAnchorElement) || !anchor.closest("[data-pane-row]") || anchor.hasAttribute("download"))
+ return
+
+ return webHref(anchor.getAttribute("href") ?? "", session().server.url)
+}
+
/**
* The `CodeBlock` renderers and `CodeBlockAction` buttons for the session's Markdown, by language. Markdown asks only
* for complete blocks of a listed language. Content renders inside `Provider` with code block content off, under the
diff --git a/packages/app/src/runtime/plugin/web-href.test.ts b/packages/app/src/runtime/plugin/web-href.test.ts
new file mode 100644
index 000000000000..593c328f1a50
--- /dev/null
+++ b/packages/app/src/runtime/plugin/web-href.test.ts
@@ -0,0 +1,11 @@
+import { expect, test } from "bun:test"
+import { webHref } from "./web-href"
+
+test("network-path and explicit web links enter the same session link policy", () => {
+ const base = "https://session.test/base/"
+ expect(webHref("//other.test/path", base)).toBe("https://other.test/path")
+ expect(webHref("http://other.test/path", base)).toBe("http://other.test/path")
+
+ for (const path of ["/api/file", "report.html", "#part", "///etc/x", "//\\host/file", "file:///x"])
+ expect(webHref(path, base)).toBeUndefined()
+})
diff --git a/packages/app/src/runtime/plugin/web-href.ts b/packages/app/src/runtime/plugin/web-href.ts
new file mode 100644
index 000000000000..03fddb6c2eae
--- /dev/null
+++ b/packages/app/src/runtime/plugin/web-href.ts
@@ -0,0 +1,10 @@
+/** A web address written in a session, never a relative file, fragment, or UNC path. Desktop renderer origins
+ * need not be HTTP, so use the session server's web scheme for a network-path reference. */
+export function webHref(written: string, server: string) {
+ const value = written.trim()
+
+ if (!/^(?:https?:\/\/|\/\/)(?![\/\\])/i.test(value) || !URL.canParse(value, server)) return
+ const url = new URL(value, server)
+
+ return /^https?:$/.test(url.protocol) ? url.href : undefined
+}
diff --git a/packages/app/src/runtime/server/loopback.test.ts b/packages/app/src/runtime/server/loopback.test.ts
new file mode 100644
index 000000000000..94c53fd18e93
--- /dev/null
+++ b/packages/app/src/runtime/server/loopback.test.ts
@@ -0,0 +1,17 @@
+import { expect, test } from "bun:test"
+import { sameLoopbackServer } from "./loopback"
+
+// The window's "local server" and main's "pages share the browser profile" both read this, so they cannot disagree.
+test.each([
+ { url: "http://127.0.0.1:4096", own: "http://127.0.0.1:4096", expected: true },
+ { url: "http://localhost:4096", own: "http://127.0.0.1:4096", expected: true },
+ { url: "http://[::1]:4096/", own: "http://127.0.0.1:4096", expected: true },
+ // Another loopback port may be a WSL server, a tunnel or a container with its own disk.
+ { url: "http://localhost:4097", own: "http://127.0.0.1:4096", expected: false },
+ { url: "https://127.0.0.1:4096", own: "http://127.0.0.1:4096", expected: false },
+ { url: "http://192.168.1.2:4096", own: "http://127.0.0.1:4096", expected: false },
+ { url: "http://localhost:4096", own: undefined, expected: false },
+ { url: "not a url", own: "http://127.0.0.1:4096", expected: false },
+])("$url is the app's own server at $own: $expected", (row) => {
+ expect(sameLoopbackServer(row.url, row.own)).toBe(row.expected)
+})
diff --git a/packages/app/src/runtime/server/loopback.ts b/packages/app/src/runtime/server/loopback.ts
new file mode 100644
index 000000000000..87bc4104b08f
--- /dev/null
+++ b/packages/app/src/runtime/server/loopback.ts
@@ -0,0 +1,22 @@
+/**
+ * A loopback http(s) URL's origin with `localhost`, `127.0.0.1` and `[::1]` read as one host, so two names for the
+ * same port compare equal; undefined for any other URL.
+ */
+export function loopbackOrigin(url: string) {
+ if (!URL.canParse(url)) return
+ const parsed = new URL(url)
+
+ if (parsed.hostname !== "localhost" && parsed.hostname !== "127.0.0.1" && parsed.hostname !== "[::1]") return
+
+ return `${parsed.protocol}//127.0.0.1:${parsed.port || (parsed.protocol === "https:" ? "443" : "80")}`
+}
+
+/**
+ * Whether a server URL is the app's own server under any loopback name: the one rule the window (whether a server is
+ * local) and the desktop's main process (whether its pages share the browser profile) both use.
+ */
+export function sameLoopbackServer(url: string, own: string | undefined) {
+ const origin = loopbackOrigin(url)
+
+ return !!origin && !!own && origin === loopbackOrigin(own)
+}
diff --git a/packages/app/src/runtime/server/registry.tsx b/packages/app/src/runtime/server/registry.tsx
index 4efb1078c993..ea6907f18924 100644
--- a/packages/app/src/runtime/server/registry.tsx
+++ b/packages/app/src/runtime/server/registry.tsx
@@ -4,6 +4,7 @@ import { batch, createMemo } from "solid-js"
import { reconcile, type SetStoreFunction, type Store } from "solid-js/store"
import { Persist, persisted } from "@/runtime/persistence/storage"
import { ServerScope } from "@/runtime/server/scope"
+import { sameLoopbackServer } from "./loopback"
import type { PluginServerStatus } from "./plugin-machine"
import { ServerHttp, ServerHttpBase, ServerKey, ServerState } from "./persistence"
@@ -38,15 +39,6 @@ export function serverLabel(conn: ServerConnection.Any, current?: { hostname?: s
return serverName(conn)
}
-function loopbackOrigin(url: string) {
- if (!URL.canParse(url)) return
- const parsed = new URL(url)
-
- if (parsed.hostname !== "localhost" && parsed.hostname !== "127.0.0.1" && parsed.hostname !== "[::1]") return
-
- return `${parsed.protocol}//127.0.0.1:${parsed.port || (parsed.protocol === "https:" ? "443" : "80")}`
-}
-
// Project data comes from the server; this keeps which projects this client has used and the last one.
export function createServerProjects(input: {
scope: () => ServerScope
@@ -220,10 +212,7 @@ export namespace ServerConnection {
if (builtin(conn)) return true
- if (conn.type !== "http" || !ownUrl) return false
- const origin = loopbackOrigin(conn.http.url)
-
- return !!origin && origin === loopbackOrigin(ownUrl)
+ return conn.type === "http" && sameLoopbackServer(conn.http.url, ownUrl)
}
}
diff --git a/packages/app/src/session/screen.tsx b/packages/app/src/session/screen.tsx
index 814ed52302fc..6f283d377c07 100644
--- a/packages/app/src/session/screen.tsx
+++ b/packages/app/src/session/screen.tsx
@@ -23,7 +23,7 @@ import type { SessionModel } from "@/session/model"
import { SESSION_PANEL_WIDTH_MIN } from "@/session/session-panel-width"
import { useLayout } from "@/shell/state/layout"
import { SessionPanelFrame } from "@/session/session-frame"
-import { PluginLinks } from "@/runtime/plugin/render"
+import { createWebLinks, PluginLinks } from "@/runtime/plugin/render"
import { createPanelSidebar, createRegion, MobilePanel } from "@/runtime/plugin/panels"
import { createMobileViews, MobileViewTabs } from "@/runtime/plugin/mobile"
import { usePluginAttachment } from "@/runtime/plugin/host-apis"
@@ -54,6 +54,7 @@ import { createPanelMotion, holdLandingWidth, panelOpacity, setPanelResizing } f
export function SessionScreenView(props: { session: SessionModel }) {
// Link handling for the rest of the screen; each cached timeline provides its own for its session.
const mounted = createMountedSession(props.session)
+ createWebLinks(mounted.view)
return (
diff --git a/packages/app/src/session/session-panel-width.test.ts b/packages/app/src/session/session-panel-width.test.ts
index 938a9064651b..15af22204665 100644
--- a/packages/app/src/session/session-panel-width.test.ts
+++ b/packages/app/src/session/session-panel-width.test.ts
@@ -1,5 +1,11 @@
import { expect, test } from "bun:test"
-import { clampSessionPanelWidth } from "./session-panel-width"
+import { clampSessionPanelWidth, fitsSidePane } from "./session-panel-width"
+
+test("an automatic side pane needs room in the row, excluding the sidebar", () => {
+ expect(fitsSidePane(820 - 240)).toBe(false)
+ expect(fitsSidePane(777)).toBe(false)
+ expect(fitsSidePane(778)).toBe(true)
+})
test.each([
["keeps widths already within the limit", 800, 1700, false, false, 800],
diff --git a/packages/app/src/session/session-panel-width.ts b/packages/app/src/session/session-panel-width.ts
index 172cef4209cb..6ed74af4efea 100644
--- a/packages/app/src/session/session-panel-width.ts
+++ b/packages/app/src/session/session-panel-width.ts
@@ -12,6 +12,10 @@ export const SIDE_PANE_WIDTH_MIN = 320
const SESSION_PANEL_WIDTH_FIT = 450
+export function fitsSidePane(rowWidth: number) {
+ return rowWidth >= SESSION_PANEL_WIDTH_FIT + SIDE_PANE_WIDTH_MIN + 8
+}
+
const REVIEW_PANE_WIDTH_FIT = 480
const REVIEW_PANE_WIDTH_FIT_SPLIT = 800
diff --git a/packages/app/src/session/timeline/quote.tsx b/packages/app/src/session/timeline/quote.tsx
index 5e9d144c25ae..faf85fec5bd6 100644
--- a/packages/app/src/session/timeline/quote.tsx
+++ b/packages/app/src/session/timeline/quote.tsx
@@ -427,6 +427,7 @@ export function TimelineQuote(props: { controller: TimelineQuoteController }) {
onCleanup(() => quote.setElement(undefined))
}}
data-component="timeline-quote"
+ data-floating-overlay
data-prevent-autofocus
role="toolbar"
aria-label={language.t("session.quote.actions")}
diff --git a/packages/app/src/shell/commands/command.tsx b/packages/app/src/shell/commands/command.tsx
index 7c916ee63a0e..105f55b16ee6 100644
--- a/packages/app/src/shell/commands/command.tsx
+++ b/packages/app/src/shell/commands/command.tsx
@@ -1,5 +1,6 @@
import { createSimpleContext } from "@opencode/ui/context"
import { useDialog } from "@opencode/ui/context/dialog"
+import { keyboardOwned } from "@opencode/ui/hooks"
import { type Accessor, batch, createEffect, createMemo, createSignal, onCleanup, onMount, untrack } from "solid-js"
import { createStore, produce, reconcile } from "solid-js/store"
import { Predicate, Schema } from "effect"
@@ -514,7 +515,8 @@ export const { use: useCommand, provider: CommandProvider } = createSimpleContex
}
const handleKeyDown = (event: KeyboardEvent) => {
- if (suspended() || dialog.active) return
+ // A surface that owns the keyboard, such as a page's prompt in the browser pane, is modal for less than the window.
+ if (suspended() || dialog.active || keyboardOwned(event.target)) return
const sig = signatureFromEvent(event)
const isPalette = palette().has(sig)
diff --git a/packages/app/src/shell/shell.tsx b/packages/app/src/shell/shell.tsx
index bc223771e5d6..76a99b55d5d2 100644
--- a/packages/app/src/shell/shell.tsx
+++ b/packages/app/src/shell/shell.tsx
@@ -261,6 +261,7 @@ export default function Layout(props: ParentProps) {
setState("tabsPanel", element)}
data-slot="vertical-tabs-panel"
+ data-floating-overlay={peek.shown() ? "" : undefined}
class="absolute inset-0 overflow-clip [contain:layout_style_paint] [overflow-clip-margin:var(--sidebar-divider-bleed,0px)]"
classList={{
"z-20": organizedSidebar(),
diff --git a/packages/app/test-browser/browser-pane-model.test.ts b/packages/app/test-browser/browser-pane-model.test.ts
index ddf31f50b21f..4d94ab09a38e 100644
--- a/packages/app/test-browser/browser-pane-model.test.ts
+++ b/packages/app/test-browser/browser-pane-model.test.ts
@@ -1,4 +1,4 @@
-import { expect, test } from "bun:test"
+import { expect, spyOn, test } from "bun:test"
import { createRoot, createSignal } from "solid-js"
import type { IpcClient, SessionRef, SetupContext } from "@opencode/plugin/gui"
import { liveAccessor } from "@opencode/plugin/gui/host"
@@ -23,7 +23,9 @@ const tab = (digit: string, url = `https://${digit}.example/`): Browser.Tab => (
function fixture() {
const bindings = new Map
()
const listeners = new Set<(value: { binding: string; event: PaneEvent }) => void>()
- const server = { id: "browser-test", compatible: true, builtin: true, data: { on: () => () => undefined } }
+ // What main rejects the next commands with, first in, first out.
+ const rejections: string[] = []
+ const server = { id: "browser-test", compatible: true, builtin: true, data: { on: () => () => undefined, session: { status: () => "idle" } } }
const refs = ["ses_alpha", "ses_beta"].map((id) => ({
key: `${server.id}\n${id}`,
@@ -41,12 +43,17 @@ function fixture() {
bindings.set(input.session, input.binding)
},
load: async () => undefined,
- command: async () => undefined,
+ command: async () => {
+ const message = rejections.shift()
+
+ if (message !== undefined) throw new Error(message)
+ },
inspect: async () => undefined,
highlight: async () => undefined,
zoom: async () => undefined,
site: async () => ({ cookies: 0 }),
clearSite: async () => undefined,
+ reveal: async () => undefined,
close: async () => undefined,
state: () => undefined,
on: (_name, listener) => {
@@ -63,12 +70,12 @@ function fixture() {
const fake = {
id: "browser",
- t: (key: string) => key,
+ t: (key: string, params?: Record) => (params ? `${key} ${JSON.stringify(params)}` : key),
use: () => live,
sessions: { current, list: () => refs },
screen: { current: () => undefined },
links: { open: () => undefined },
- layout: { narrow: () => false, stored: () => [], state: () => "closed", open() {}, close() {} },
+ layout: { narrow: () => false, stored: () => [], state: () => "closed", open() {}, close() {}, side: { opened: () => false } },
stores: { history },
}
@@ -77,17 +84,19 @@ function fixture() {
const ctx = fake as unknown as SetupContext
const owned = createRoot((dispose) => ({ model: createModel(ctx), dispose }))
- const emit = (session: string, state: Browser.State) => {
+ const send = (session: string, event: PaneEvent) => {
const binding = bindings.get(session)
- if (binding) listeners.forEach((listener) => listener({ binding, event: { type: "state", state } }))
+ if (binding) listeners.forEach((listener) => listener({ binding, event }))
}
+ const emit = (session: string, state: Browser.State) => send(session, { type: "state", state })
+
// SAFETY: the model reads only the listed fields of a session ref.
// oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
const sessions = refs.map((ref) => ref as unknown as SessionRef)
- return { ...owned, sessions, route: setCurrent, refs, emit }
+ return { ...owned, sessions, route: setCurrent, refs, emit, send, rejections }
}
test("one session's transitions leave another session's attachment as it was", async () => {
@@ -116,3 +125,132 @@ test("one session's transitions leave another session's attachment as it was", a
app.dispose()
}
})
+
+test("the app menu's hard reload runs once, on the pane the window shows", async () => {
+ const app = fixture()
+ const reloads: (boolean | undefined)[] = []
+ const pane = { visible: true }
+ const nothing = () => undefined
+
+ const unmount = app.model.mount({
+ visible: () => pane.visible,
+ address: () => "",
+ reload: (ignoreCache) => void reloads.push(ignoreCache),
+ close: nothing,
+ inspectable: () => false,
+ inspect: nothing,
+ focusAddress: nothing,
+ find: nothing,
+ findMatch: nothing,
+ press: nothing,
+ focused: nothing,
+ })
+
+ try {
+ app.route(app.refs[1])
+ await Bun.sleep(0)
+ // Main sends it to every binding of the window with a tab in front. Only the routed session's pane answers.
+ app.send("ses_alpha", { type: "hardReload" })
+ expect(reloads).toEqual([])
+ app.send("ses_beta", { type: "hardReload" })
+ expect(reloads).toEqual([true])
+ // A pane that is mounted but not on screen, such as behind Review, is not what the person sees.
+ pane.visible = false
+ app.send("ses_beta", { type: "hardReload" })
+ expect(reloads).toEqual([true])
+ } finally {
+ unmount()
+ app.dispose()
+ }
+})
+
+test("a passkey notice names the tab's origin and offers the import for the page's registrable site", async () => {
+ const app = fixture()
+ const [alpha] = app.sessions
+ const page = tab("a", "https://login.github.com/session")
+
+ try {
+ await Bun.sleep(0)
+ app.emit("ses_alpha", { tabs: [page], focusedTabID: page.id })
+ // Main sends both: the notice's own site, which the import searches for, and the origin the tab was on.
+ app.send("ses_alpha", {
+ type: "refusal",
+ tabID: page.id,
+ notice: { reason: "browser.passkey", site: "github.com" },
+ token: "token",
+ site: "https://login.github.com",
+ })
+ expect(app.model.notice(alpha, page.id)).toEqual({
+ token: "token",
+ origin: 'notice.site {"site":"https://login.github.com"}',
+ text: "refused.passkey",
+ label: "refused.passkey.import",
+ passkey: { site: "github.com", choose: true },
+ })
+ // Where the agent's tab refuses, the new tab opens the origin main reported with the notice and the button names
+ // it: not the tab's path, which the page can change without replacing the notice.
+ app.emit("ses_alpha", { tabs: [{ ...page, url: "https://login.github.com/changed?since=notice" }], focusedTabID: page.id })
+ app.send("ses_alpha", { type: "refusal", tabID: page.id, notice: { reason: "browser.passkey.off", site: "github.com" }, token: "off", site: "https://login.github.com" })
+ expect(app.model.notice(alpha, page.id)).toEqual({
+ token: "off",
+ origin: 'notice.site {"site":"https://login.github.com"}',
+ text: "refused.passkey.off",
+ label: "refused.passkey.newTab",
+ title: "https://login.github.com",
+ passkey: { newTab: "https://login.github.com" },
+ })
+ // A page with no web origin has nowhere to reopen.
+ app.send("ses_alpha", { type: "refusal", tabID: page.id, notice: { reason: "browser.passkey.off" }, token: "none" })
+ expect(app.model.notice(alpha, page.id)).toEqual({ token: "none", origin: "notice.page", text: "refused.passkey.off" })
+ } finally {
+ app.dispose()
+ }
+})
+
+test("a command main rejects says what the person tried, never the app's generic failure text", async () => {
+ const app = fixture()
+ const [alpha] = app.sessions
+ const page = tab("a")
+ const warned = spyOn(console, "warn").mockImplementation(() => undefined)
+
+ try {
+ await Bun.sleep(0)
+ app.emit("ses_alpha", { tabs: [page], focusedTabID: page.id })
+
+ // A message main never sent before: the notice names the reload, offers it again, and the code is logged.
+ app.rejections.push("something new in main")
+ app.model.command(alpha, { type: "reload", tabID: page.id })
+ await Bun.sleep(0)
+ expect(app.model.failure(alpha, page.id)).toMatchObject({ text: "failed.command.reload", lasting: false })
+ expect(app.model.failure(alpha, page.id)?.retry).toBeFunction()
+ expect(warned).toHaveBeenCalledWith("[browser] unmapped failure", { code: "something new in main", action: "reload" })
+ // It belongs to the tab the command was for.
+ expect(app.model.failure(alpha, tab("b").id)).toBeUndefined()
+
+ // A refused address keeps main's reason and stays to be read; nothing is logged for a code the table knows.
+ warned.mockClear()
+ app.rejections.push("browser.address.web")
+ app.model.command(alpha, { type: "navigate", tabID: page.id, url: "ftp://files.example/" })
+ await Bun.sleep(0)
+ expect(app.model.failure(alpha, page.id)).toMatchObject({ text: "refused.web", lasting: true, retry: undefined })
+ expect(warned).not.toHaveBeenCalled()
+
+ // A load that failed is the page area's to explain, from the tab's own state: no notice above it as well.
+ app.rejections.push("ERR_NAME_NOT_RESOLVED (-105) loading 'https://nowhere.example/'")
+ app.model.command(alpha, { type: "navigate", tabID: page.id, url: "https://nowhere.example/" })
+ await Bun.sleep(0)
+ expect(app.model.failure(alpha, page.id)).toBeUndefined()
+
+ // The person closes a notice by its identity.
+ app.rejections.push("something new in main")
+ app.model.command(alpha, { type: "back", tabID: page.id })
+ await Bun.sleep(0)
+ const shown = app.model.failure(alpha, page.id)
+ expect(shown?.text).toBe("failed.command.back")
+ app.model.dismissFailure(alpha, shown?.id ?? -1)
+ expect(app.model.failure(alpha, page.id)).toBeUndefined()
+ } finally {
+ warned.mockRestore()
+ app.dispose()
+ }
+})
diff --git a/packages/cli/script/build.ts b/packages/cli/script/build.ts
index a9ae9e606975..d7145d2fede3 100755
--- a/packages/cli/script/build.ts
+++ b/packages/cli/script/build.ts
@@ -165,6 +165,23 @@ export default { path: file, version: ${JSON.stringify(opencodePty.version)}, sh
}))
},
}
+ // ffi-rs probes every optional binding at runtime. A standalone executable needs exactly the target's binding,
+ // even when the build host has installed several (Windows x64 also installs the ia32 package).
+ const ffiBinding = `@yuuang/ffi-rs-${item.os}-${item.arch}${item.os === "linux" ? `-${item.abi ?? "gnu"}` : item.os === "win32" ? "-msvc" : ""}`
+ const ffiPlugin: BunPlugin = {
+ name: "ffi-rs-binding",
+ setup(build) {
+ build.onLoad({ filter: /[/\\]ffi-rs[/\\]index\.js$/ }, async (args) => {
+ const code = await Bun.file(args.path).text()
+ const start = code.indexOf("if (!nativeBinding) {")
+ if (start === -1) throw new Error("Failed to rewrite ffi-rs native binding loader")
+ return {
+ contents: `const nativeBinding = require(${JSON.stringify(ffiBinding)}); const loadError = undefined;\n${code.slice(start)}`,
+ loader: "js",
+ }
+ })
+ },
+ }
const target = targetName(item)
const name = target.replace(binary, "cli")
const executablePath = await compileExecutable(item)
@@ -176,6 +193,7 @@ export default { path: file, version: ${JSON.stringify(opencodePty.version)}, sh
appAssetsPlugin,
solidPlugin,
parcelWatcherPlugin,
+ ffiPlugin,
opencodePtyPlugin,
pluginRuntimePlugin,
wsReexportPlugin,
diff --git a/packages/client/src/promise/generated/client.ts b/packages/client/src/promise/generated/client.ts
index f63890960b6d..5c5943933a01 100644
--- a/packages/client/src/promise/generated/client.ts
+++ b/packages/client/src/promise/generated/client.ts
@@ -247,6 +247,8 @@ import type {
ExperimentalPersistentPtyConnectTokenOutput,
ExperimentalMediaGetInput,
ExperimentalMediaGetOutput,
+ ExperimentalPreviewReadInput,
+ ExperimentalPreviewReadOutput,
ExperimentalBlobGetInput,
ExperimentalBlobGetOutput,
ExperimentalAutomationCreateInput,
@@ -1546,6 +1548,28 @@ export function make(options: ClientOptions) {
requestOptions,
),
},
+ preview: {
+ read: (input: ExperimentalPreviewReadInput, requestOptions?: RequestOptions) =>
+ request(
+ {
+ method: "GET",
+ path: `/api/experimental/preview/read`,
+ query: {
+ location: input["location"],
+ sessionID: input["sessionID"],
+ path: input["path"],
+ document: input["document"],
+ root: input["root"],
+ entry: input["entry"],
+ },
+ successStatus: 200,
+ declaredStatuses: [400, 401, 404],
+ empty: false,
+ binary: true,
+ },
+ requestOptions,
+ ),
+ },
blob: {
get: (input: ExperimentalBlobGetInput, requestOptions?: RequestOptions) =>
request(
diff --git a/packages/client/src/promise/generated/types.ts b/packages/client/src/promise/generated/types.ts
index 17578146c2bd..75b74d87b535 100644
--- a/packages/client/src/promise/generated/types.ts
+++ b/packages/client/src/promise/generated/types.ts
@@ -4663,6 +4663,17 @@ export type ExperimentalMediaGetInput = { readonly hash: string }
export type ExperimentalMediaGetOutput = globalThis.Uint8Array
+export type ExperimentalPreviewReadInput = {
+ readonly location?: { readonly directory?: string | undefined } | undefined
+ readonly sessionID: string
+ readonly path: string
+ readonly document: string
+ readonly root: string
+ readonly entry?: "1" | undefined
+}
+
+export type ExperimentalPreviewReadOutput = globalThis.Uint8Array
+
export type ExperimentalBlobGetInput = { readonly id: string }
export type ExperimentalBlobGetOutput = globalThis.Uint8Array
diff --git a/packages/client/test/promise.test.ts b/packages/client/test/promise.test.ts
index dfc549920438..84bf544add8f 100644
--- a/packages/client/test/promise.test.ts
+++ b/packages/client/test/promise.test.ts
@@ -61,6 +61,7 @@ test("exposes every standard HTTP API group", () => {
"file",
"persistentPty",
"media",
+ "preview",
"blob",
"automation",
"artifacts",
diff --git a/packages/codemode/src/namespace.ts b/packages/codemode/src/namespace.ts
index 1446540ef24a..321d6a29e2dd 100644
--- a/packages/codemode/src/namespace.ts
+++ b/packages/codemode/src/namespace.ts
@@ -4,12 +4,18 @@ import type { Tools } from "./tools.js"
export type Namespace = {
readonly _tag: "CodeModeNamespace"
readonly description?: string
+ readonly removed?: Readonly>
readonly tools: Tools
}
/** Options for declaring one CodeMode namespace. */
export type Options = {
readonly description?: string
+ /**
+ * Tools this namespace no longer has, by the dotted name they had under it. A call to one fails with its sentence,
+ * which says what to call instead, where an unknown tool would get a guessed suggestion.
+ */
+ readonly removed?: Readonly>
readonly tools: Tools
}
@@ -20,5 +26,6 @@ export const isNamespace = (value: Namespace | Tools): value is
export const make = (options: Options): Namespace => ({
_tag: "CodeModeNamespace",
...(options.description === undefined ? {} : { description: options.description }),
+ ...(options.removed === undefined ? {} : { removed: options.removed }),
tools: options.tools,
})
diff --git a/packages/codemode/src/tool-runtime.ts b/packages/codemode/src/tool-runtime.ts
index d01bc9a8165e..e2e4c2921f76 100644
--- a/packages/codemode/src/tool-runtime.ts
+++ b/packages/codemode/src/tool-runtime.ts
@@ -525,10 +525,22 @@ const namespaceKeys = (root: ToolNode, path: ReadonlyArray): Reado
return Array.from(node.children.keys())
}
+// What the deepest namespace on the way to a missing tool says about it, when that namespace once had the tool.
+const removedTool = (root: ToolNode, segments: ReadonlyArray): string | undefined =>
+ segments
+ .map((_, depth) => {
+ const removed = lookup(root, segments.slice(0, depth))?.namespace?.removed
+ const name = segments.slice(depth).join(".")
+ return removed !== undefined && Object.hasOwn(removed, name) ? removed[name] : undefined
+ })
+ .findLast((sentence) => sentence !== undefined)
+
const resolve = (root: ToolNode, path: ReadonlyArray, index: ReadonlyArray): Tool => {
const segments = canonicalSegments(path)
const node = lookup(root, segments)
if (node === undefined) {
+ const removed = removedTool(root, segments)
+ if (removed !== undefined) throw new ToolRuntimeError("UnknownTool", removed)
const name = segments.join(".")
const ns = segments.length > 1 && root.children.has(segments[0]) ? segments[0] : undefined
const closest = rank(
diff --git a/packages/codemode/test/tool-paths.test.ts b/packages/codemode/test/tool-paths.test.ts
index ed80e31e3756..5d3e609347d5 100644
--- a/packages/codemode/test/tool-paths.test.ts
+++ b/packages/codemode/test/tool-paths.test.ts
@@ -114,6 +114,30 @@ describe("callable namespaces", () => {
expect(diagnostic.message).toBe("Unknown tool 'issues.get-list'. Did you mean tools.issues.list?")
})
+ test("a tool its namespace says was removed fails with that namespace's sentence, not a guessed tool", async () => {
+ const shown = "pages.show was removed: call pages.open({ path }) to show a file."
+ const focused = "pages.tabs.focus was removed: pages.tabs.list returns the focused tab."
+ const pages = CodeMode.make({
+ tools: {
+ pages: Namespace.make({
+ removed: { show: shown, "tabs.focus": focused },
+ tools: { open: echo("Open a page", "opened"), "tabs.list": echo("List tabs", "listed") },
+ }),
+ },
+ })
+ const diagnostic = await failure(pages, `return await tools.pages.show({ path: "a.html" })`)
+ expect(diagnostic.kind).toBe("UnknownTool")
+ expect(diagnostic.message).toBe(shown)
+ expect(diagnostic.suggestions).toBeUndefined()
+ expect((await failure(pages, `return await tools.pages.tabs.focus({})`)).message).toBe(focused)
+ // Only the names it lists: any other unknown tool still gets the closest match.
+ expect((await failure(pages, `return await tools.pages.opens({})`)).message).toBe(
+ "Unknown tool 'pages.opens'. Did you mean tools.pages.open?",
+ )
+ expect(await value(pages, `return await tools.pages.open({})`)).toBe("opened")
+ expect(pages.catalog.map((tool) => tool.path)).toEqual(["pages.open", "pages.tabs.list"])
+ })
+
test("a namespace without its own tool stays non-callable", async () => {
const nested = CodeMode.make({ tools: { "issues.list": echo("List issues", "list") } })
const diagnostic = await failure(nested, `return await tools.issues({})`)
diff --git a/packages/core/src/artifact.ts b/packages/core/src/artifact.ts
index bb43d3cfca05..5c4fb59d7959 100644
--- a/packages/core/src/artifact.ts
+++ b/packages/core/src/artifact.ts
@@ -17,6 +17,8 @@ import {
} from "@opencode/schema/artifact"
import type { SessionID } from "@opencode/schema/session-id"
import { Global } from "@opencode/util/global"
+import { openContained } from "@opencode/util/contained-file"
+import { FileVerificationError } from "@opencode/util/file-verification"
import { makeLocationNode } from "@opencode/util/effect/app-node"
import { Clock, Context, Effect, Layer, Option, Schema } from "effect"
import { Bus } from "./bus.js"
@@ -174,7 +176,7 @@ export interface Interface extends State.Transformable {
readonly readLocalFile: (
id: ID,
subpath?: string,
- ) => Effect.Effect
+ ) => Effect.Effect
}
export class Service extends Context.Service()("@opencode/Artifact") {}
@@ -434,15 +436,19 @@ const layer = Layer.effect(
})
}
const requested = subpath?.trim() ? yield* normalizePath(subpath) : existing.info.entry
- const target = path.join(itemDir(id), ...requested.split("/"))
- const exists = yield* Effect.promise(() =>
- fs
- .stat(target)
- .then((stat) => stat.isFile())
- .catch(() => false),
- )
- if (!exists) return yield* new FileMissingError({ artifactID: id, path: requested })
- const bytes = yield* Effect.promise(() => fs.readFile(target).then((buf) => new Uint8Array(buf)))
+ const bytes = yield* Effect.tryPromise({
+ try: async () => {
+ const root = path.join(await fs.realpath(rootDir), id)
+ const opened = await openContained(root, requested)
+ if (!opened) throw new Error("Unavailable artifact file")
+ try {
+ return new Uint8Array(await opened.file.readFile())
+ } finally {
+ await opened.file.close()
+ }
+ },
+ catch: (error) => error instanceof FileVerificationError ? error : new FileMissingError({ artifactID: id, path: requested }),
+ })
return { bytes, mime: detectFileMime(requested, bytes) }
}),
})
diff --git a/packages/core/src/automation/code.ts b/packages/core/src/automation/code.ts
index a8fab6789f16..bd417a4252c2 100644
--- a/packages/core/src/automation/code.ts
+++ b/packages/core/src/automation/code.ts
@@ -7,6 +7,7 @@ import { Agent } from "../agent.js"
import { CodeModeTool } from "../codemode/tool.js"
import { Permission } from "../permission.js"
import { Plugin } from "../plugin.js"
+import { PluginHooks } from "../plugin/hooks.js"
import type { SessionMessage } from "../session/message.js"
import type { SessionSchema } from "../session/schema.js"
import { Tool } from "../tool.js"
@@ -94,6 +95,8 @@ export const authorize = Effect.fnUntraced(function* (
if (invocation && !matchesAuthor(session, agent.info, invocation))
return yield* Effect.fail("Create the automation with the session's current agent")
const actions = (yield* resolveTools(paths)).actions
+ // Configured rules only, on purpose: they choose which scoped asks to prompt for. A hook can only deny, and every
+ // check below goes through the service, which applies hook denies.
const rules = Permission.merge(agent.info?.permissions ?? [], session.permissions ?? [])
// A rule scoped to some resources (`vault:*: ask`) must prompt too, not only the catch-all `*`.
const request = (item: string) => ({
@@ -160,7 +163,9 @@ export const run = Effect.fnUntraced(
if (Result.isFailure(resolved)) return { ok: false as const, error: resolved.failure, invalid: true }
const actions = ["execute", ...resolved.success.actions]
- const rules = Permission.merge(agent.info.permissions, session.permissions ?? [])
+ // The rules a step of this session's agent runs under, `experimental.rules` denies included.
+ const hooks = yield* PluginHooks.Service
+ const rules = yield* Permission.rules(hooks, { session, agent })
// Unattended rules come after the configured ones and the last match wins, so restate every scoped rule after the
// grant: the approval stands in for the catch-all `*` only, and a scoped `ask` still needs a person.
const unattended: Permission.Ruleset = actions.flatMap((item) => [
diff --git a/packages/core/src/codemode/tool.ts b/packages/core/src/codemode/tool.ts
index 8c757a7c3601..ccc41074c92a 100644
--- a/packages/core/src/codemode/tool.ts
+++ b/packages/core/src/codemode/tool.ts
@@ -31,8 +31,12 @@ const ExecuteCall = Schema.Struct({
tool: Schema.String,
status: Schema.Literals(["running", "completed", "error"]),
input: Schema.optionalKey(Schema.Record(Schema.String, Schema.Json)),
+ /** The failure message, bounded; kept even when the program catches the error. */
+ error: Schema.optionalKey(Schema.String),
})
+const MAX_ERROR_CHARS = 2_000
+
type ExecuteCall = typeof ExecuteCall.Type
const ExecuteOutput = Schema.Struct({
@@ -206,7 +210,11 @@ function progressHooks(record: (update: (items: Array) => Array {
const next = [...items]
- next[index] = { ...items[index], status: result.status === "success" ? "completed" : "error" }
+ next[index] = {
+ ...items[index],
+ status: result.status === "success" ? "completed" : "error",
+ ...(result.status === "failure" ? { error: failureMessage(result.error) } : {}),
+ }
return next
})
}
@@ -229,6 +237,12 @@ function progressHooks(record: (update: (items: Array) => Array MAX_ERROR_CHARS ? `${message.slice(0, MAX_ERROR_CHARS)}…` : message
+}
+
export const catalog = (inventory: Inventory) => {
const pinned = new Set(
Array.from(inventory.tools.values())
@@ -397,6 +411,7 @@ function renderEntry(
if (node.namespace !== undefined)
return Namespace.make({
description: node.namespace.description,
+ ...(node.namespace.removed === undefined ? {} : { removed: node.namespace.removed }),
tools,
})
if (node.tool === undefined) return tools
diff --git a/packages/core/src/permission.ts b/packages/core/src/permission.ts
index 319a8b2075d7..53176171e353 100644
--- a/packages/core/src/permission.ts
+++ b/packages/core/src/permission.ts
@@ -16,7 +16,7 @@ import { PluginHooks } from "./plugin/hooks.js"
const PermissionEffect = Permission.Effect
export { PermissionEffect as Effect }
-export { Rule, Ruleset } from "@opencode/schema/permission"
+export { Rule, Ruleset, deniesAll } from "@opencode/schema/permission"
const missingAgentPermissions: Permission.Ruleset = [{ action: "*", resource: "*", effect: "deny" }]
export const ID = Permission.ID
@@ -107,6 +107,44 @@ export function merge(...rulesets: Permission.Ruleset[]): Permission.Ruleset {
return rulesets.flat()
}
+const Denies = Schema.Array(Schema.Struct({ action: Schema.String, resource: Schema.String }))
+
+/**
+ * The rules for `agent` in `session`: the agent's, then the Session's, then a deny for each entry `experimental.rules`
+ * hooks add. Requests are evaluated against them and steps list tools, skills and MCP servers by them, so what an
+ * agent is offered and what it may call come from one ruleset. Hooks see copies and can only add denies, so a
+ * configured deny stays final and no hook can allow, remove or reorder a rule.
+ */
+export const rules = Effect.fn("Permission.rules")(function* (
+ hooks: PluginHooks.Interface,
+ input: { readonly session: SessionSchema.Info; readonly agent: Agent.Selection },
+) {
+ const base = [...(input.agent.info?.permissions ?? missingAgentPermissions), ...(input.session.permissions ?? [])]
+ // Core owns the list and the event is frozen, so a hook can add a deny but cannot remove or replace another's.
+ const added: unknown[] = []
+ yield* hooks.trigger(
+ "permission",
+ "experimental.rules",
+ Object.freeze({
+ sessionID: input.session.id,
+ agent: input.agent.id,
+ rules: base.map((rule) => ({ ...rule })),
+ session: (input.session.permissions ?? []).map((rule) => ({ ...rule })),
+ deny: (rule: unknown) => {
+ added.push(rule)
+ },
+ }),
+ )
+ // A hook that cannot say what it denies must not leave the request decided without it.
+ const denies = yield* Schema.decodeUnknownEffect(Denies)(added).pipe(
+ Effect.mapError(
+ (error) => new Error(`A permission "experimental.rules" hook added an invalid deny: ${error.message}`),
+ ),
+ Effect.orDie,
+ )
+ return [...base, ...denies.map((rule) => ({ action: rule.action, resource: rule.resource, effect: "deny" as const }))]
+})
+
export interface Interface {
readonly close: Effect.Effect
readonly ask: (input: AssertInput) => Effect.Effect
@@ -114,7 +152,7 @@ export interface Interface {
/** Fails only when the rules deny the request; never asks the user. */
readonly assertNotDenied: (input: AssertInput) => Effect.Effect
/** True only when the rules already allow the request; never asks the user. */
- readonly allows: (input: AssertInput) => Effect.Effect
+ readonly allows: (input: AssertInput, options?: { requireConfiguredAllow: boolean }) => Effect.Effect
readonly reply: (input: ReplyInput) => Effect.Effect
readonly get: (id: ID) => Effect.Effect
readonly forSession: (sessionID: SessionSchema.ID) => Effect.Effect>
@@ -175,8 +213,7 @@ const layer = Layer.effect(
const configured = Effect.fnUntraced(function* (sessionID: SessionSchema.ID, agentID?: Agent.ID) {
const session = yield* sessions.get(sessionID)
if (!session) return yield* new SessionErrors.NotFoundError({ sessionID })
- const agent = yield* agents.resolve(agentID ?? session.agent)
- return merge(agent?.permissions ?? missingAgentPermissions, session.permissions ?? [])
+ return yield* rules(hooks, { session, agent: yield* agents.select(agentID ?? session.agent) })
})
function denied(input: Pick, rules: Permission.Ruleset) {
@@ -198,10 +235,14 @@ const layer = Layer.effect(
return parent ? { ...source, id: parent } : source
}
- const evaluateInput = Effect.fnUntraced(function* (input: AssertInput) {
+ const evaluateInput = Effect.fnUntraced(function* (input: AssertInput, requireConfiguredAllow = false) {
const rules = yield* configured(input.sessionID, input.agent)
if (denied(input, rules)) return { effect: "deny" as const, rules }
- const all = [...rules, ...(yield* savedRules())]
+ // Passive reads on an agent-driven page must not consume an interactive tool's saved approval for an ask.
+ if (requireConfiguredAllow && input.resources.some(resource => evaluate(input.action, resource, rules).effect !== "allow"))
+ return { effect: "ask" as const, rules }
+ const saved = yield* savedRules()
+ const all = [...rules, ...saved]
const effects = input.resources.map((resource) => evaluate(input.action, resource, all).effect)
const effect: Permission.Effect = effects.includes("ask") ? "ask" : "allow"
const event = yield* hooks.trigger("permission", "evaluate", {
@@ -212,6 +253,10 @@ const layer = Layer.effect(
metadata: input.metadata,
source: row(input.source),
effect,
+ experimental: {
+ approved: input.resources.every((resource) => evaluate(input.action, resource, saved).effect === "allow"),
+ approvedSave: !!input.save?.length && input.save.every((key) => saved.some((rule) => rule.action === input.action && rule.resource === key)),
+ },
})
const unattended = yield* Unattended
if (event.effect !== "ask" || unattended === undefined)
@@ -315,9 +360,9 @@ const layer = Layer.effect(
})
})
- const allows = Effect.fn("Permission.allows")(function* (input: AssertInput) {
+ const allows = Effect.fn("Permission.allows")(function* (input: AssertInput, options?: { requireConfiguredAllow: boolean }) {
if (closed) return false
- return (yield* evaluateInput(input)).effect === "allow"
+ return (yield* evaluateInput(input, options?.requireConfiguredAllow)).effect === "allow"
})
const reply = Effect.fn("Permission.reply")((input: ReplyInput) =>
diff --git a/packages/core/src/session/context.ts b/packages/core/src/session/context.ts
index eea20c76fb22..8f87859ac469 100644
--- a/packages/core/src/session/context.ts
+++ b/packages/core/src/session/context.ts
@@ -14,6 +14,7 @@ import { InstructionBuiltIns } from "../instructions/builtins.js"
import { Location } from "../location.js"
import { McpInstructions } from "../mcp/instructions.js"
import { McpTool } from "../tool/mcp.js"
+import { PluginHooks } from "../plugin/hooks.js"
import { ReferenceInstructions } from "../reference/instructions.js"
import { SkillInstructions } from "../skill/instructions.js"
import { Tool } from "../tool.js"
@@ -81,6 +82,7 @@ const layer = Layer.effect(
const db = (yield* Database.Service).db
const discovery = yield* InstructionDiscovery.Service
const entries = yield* InstructionEntry.Service
+ const hooks = yield* PluginHooks.Service
const location = yield* Location.Service
const mcpInstructions = yield* McpInstructions.Service
const mcpTools = yield* McpTool.Service
@@ -142,8 +144,8 @@ const layer = Layer.effect(
yield* mcpTools.flush
const agent = yield* agents.select(session.agent)
if (!agent.info) return yield* new AgentNotFoundError({ sessionID: session.id, agent: session.agent ?? agent.id })
- // Session permissions narrow discovery the same way they narrow the tool snapshot.
- const permissions = Permission.merge(agent.info.permissions, session.permissions ?? [])
+ // The rules this agent's calls are evaluated against also decide which tools, skills and MCP servers it lists.
+ const permissions = yield* Permission.rules(hooks, { session, agent })
const loaded = yield* Effect.all(
{
tools: registry.snapshot(permissions),
@@ -225,6 +227,7 @@ export const node = makeLocationNode({
Location.node,
McpInstructions.node,
McpTool.node,
+ PluginHooks.node,
ReferenceInstructions.node,
SessionRunnerModel.node,
SessionModelRequest.node,
diff --git a/packages/core/src/tool.ts b/packages/core/src/tool.ts
index 9238cb81bf5a..4f4327dba1e3 100644
--- a/packages/core/src/tool.ts
+++ b/packages/core/src/tool.ts
@@ -17,7 +17,6 @@ import { SessionMessage } from "./session/message.js"
import { SessionSchema } from "./session/schema.js"
import { State } from "./state.js"
import { definition, effectiveName, execute, normalizedName, normalizeContent } from "./tool/runtime.js"
-import { Wildcard } from "./util/wildcard.js"
export class RegistrationError extends Schema.TaggedError()("Tool.RegistrationError", {
name: Schema.String,
@@ -195,15 +194,17 @@ const layer = Layer.effect(
return yield* executeTool(selected, event.tool, event.input, context)
})
- let catalog:
- | {
- data: Data
- names: string
- inventory: CodeModeTool.Inventory
- value: CodeModeCatalog.Inventory
- definition: ToolDefinition
- }
- | undefined
+ // Keyed by the visible tool names. Sessions whose agents see different tool sets, such as one denied the browser
+ // and one not, alternate steps; with one entry each step rebuilt a large catalog (about 90 ms for 3,000 tools).
+ const catalogs = new Map<
+ string,
+ {
+ data: Data
+ inventory: CodeModeTool.Inventory
+ value: CodeModeCatalog.Inventory
+ definition: ToolDefinition
+ }
+ >()
const state = State.create({
name: "tool",
initial: () => ({
@@ -244,7 +245,7 @@ const layer = Layer.effect(
},
}),
notify: (value) => {
- catalog = undefined
+ catalogs.clear()
return Effect.forEach(
value.errors,
({ kind, name, namespace, error }) =>
@@ -281,7 +282,8 @@ const layer = Layer.effect(
// Discovery is immutable for a registry revision and visible tool set. Keep executors
// fresh, but share the inventory, whose prepared runtime and much larger rendered catalog
// are cached by identity, and the execute tool's definition across steps.
- const cached = catalog?.data === data && catalog.names === names ? catalog : undefined
+ const entry = catalogs.get(names)
+ const cached = entry?.data === data ? entry : undefined
const codeModeInventory = cached?.inventory ?? { tools: codeModeTools, namespaces: data.namespaces }
const codeModeTool = codeModeEnabled
? CodeModeTool.create(
@@ -294,14 +296,17 @@ const layer = Layer.effect(
? undefined
: (cached?.value ?? CodeModeTool.catalog(codeModeInventory))
const codeModeDefinition = codeModeTool && (cached?.definition ?? definition(codeModeTool))
- if (codeModeCatalog && codeModeDefinition)
- catalog = {
+ if (codeModeCatalog && codeModeDefinition) {
+ // Least recently used goes first: a hit moves its entry to the end.
+ catalogs.delete(names)
+ catalogs.set(names, {
data,
- names,
inventory: codeModeInventory,
value: codeModeCatalog,
definition: codeModeDefinition,
- }
+ })
+ if (catalogs.size > CATALOG_CACHE_SIZE) catalogs.delete(catalogs.keys().next().value!)
+ }
return {
...(codeModeCatalog === undefined ? {} : { codeModeCatalog }),
definitions: [
@@ -393,10 +398,11 @@ function commit(editor: Data, id: string, input: Tool.Info & { readonly id: stri
editor.definitions.set(id, registered.success)
}
-const whollyDisabled = (action: string, rules: Permission.Ruleset) => {
- const rule = rules.findLast((rule) => Wildcard.match(action, rule.action))
- return rule?.resource === "*" && rule.effect === "deny"
-}
+/** Visible tool sets whose Code Mode catalog stays prepared. */
+const CATALOG_CACHE_SIZE = 8
+
+const whollyDisabled = (action: string, rules: Permission.Ruleset) =>
+ Permission.deniesAll(action, rules, process.platform === "win32")
const formatSchemaIssue = SchemaIssue.makeFormatterDefault()
diff --git a/packages/core/src/util/wildcard.ts b/packages/core/src/util/wildcard.ts
index 65608026f9b4..4f2d284db314 100644
--- a/packages/core/src/util/wildcard.ts
+++ b/packages/core/src/util/wildcard.ts
@@ -1,14 +1,7 @@
export * as Wildcard from "./wildcard.js"
-export function match(input: string, pattern: string) {
- const normalized = input.replaceAll("\\", "/")
- let escaped = pattern
- .replaceAll("\\", "/")
- .replace(/[.+^${}()|[\]\\]/g, "\\$&")
- .replace(/\*/g, ".*")
- .replace(/\?/g, ".")
-
- if (escaped.endsWith(" .*")) escaped = escaped.slice(0, -3) + "( .*)?"
+import { Wildcard } from "@opencode/schema/wildcard"
- return new RegExp("^" + escaped + "$", process.platform === "win32" ? "si" : "s").test(normalized)
+export function match(input: string, pattern: string) {
+ return Wildcard.match(input, pattern, process.platform === "win32")
}
diff --git a/packages/core/test/browser-attach.test.ts b/packages/core/test/browser-attach.test.ts
index f7685ec86842..a7381dee0d8b 100644
--- a/packages/core/test/browser-attach.test.ts
+++ b/packages/core/test/browser-attach.test.ts
@@ -73,10 +73,8 @@ const it = testEffect(
)
const user = { action: "bash", resource: "*", effect: "ask" } as const
-const allows = [
- { action: "browser", resource: "*", effect: "allow" },
- { action: "skill", resource: "browser", effect: "allow" },
-] as const
+const allows = [{ action: "browser", resource: "*", effect: "allow" }] as const
+
const setup = Effect.gen(function* () {
writes.race = undefined
diff --git a/packages/core/test/browser-permission.test.ts b/packages/core/test/browser-permission.test.ts
new file mode 100644
index 000000000000..2efd7d0edf4c
--- /dev/null
+++ b/packages/core/test/browser-permission.test.ts
@@ -0,0 +1,998 @@
+import { expect } from "bun:test"
+import { hostname } from "os"
+import path from "path"
+import { Context, Deferred, Effect, Exit, Fiber, Schedule, Schema, Stream } from "effect"
+import { Browser } from "@opencode/plugin-browser/rpc"
+import { SessionMessage } from "@opencode/schema/session-message"
+import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
+import { LayerNode } from "@opencode/util/effect/layer-node"
+import { Global } from "@opencode/util/global"
+import { Agent } from "@opencode/core/agent"
+import { Bus } from "@opencode/core/bus"
+import { Database } from "@opencode/core/database/database"
+import { Watcher } from "@opencode/core/filesystem/watcher"
+import { KV } from "@opencode/core/kv"
+import { Location } from "@opencode/core/location"
+import { LocationServiceMap } from "@opencode/core/location-services"
+import { Permission } from "@opencode/core/permission"
+import { PermissionSaved } from "@opencode/core/permission/saved"
+import { Plugin } from "@opencode/core/plugin"
+import { PluginHooks } from "@opencode/core/plugin/hooks"
+import { PluginHost } from "@opencode/core/plugin/host"
+import { Rpc } from "@opencode/core/rpc"
+import { AbsolutePath } from "@opencode/core/schema"
+import { Session } from "@opencode/core/session"
+import { SessionContext } from "@opencode/core/session/context"
+import { AutomationCode } from "@opencode/core/automation/code"
+import { Tool } from "@opencode/core/tool"
+import { Config } from "@opencode/core/config"
+import { ConfigIntegration } from "@opencode/core/config/integration"
+import { Info } from "@opencode/schema/config"
+import { Integration } from "@opencode/schema/integration"
+import { isRecord } from "@opencode/util/record"
+import { BrowserConnection } from "../../plugin-browser/src/connection"
+import { BrowserFiles } from "../../plugin-browser/src/files"
+import { tempGlobalLayer } from "./fixture/global"
+import { offlineModels } from "./fixture/models"
+import { tmpdirScoped } from "./fixture/tmpdir"
+import { testEffect } from "./lib/effect"
+import { codeModeListings } from "./lib/tool"
+
+const it = testEffect(
+ AppNodeBuilder.build(
+ LayerNode.group([Database.node, Bus.node, KV.node, PermissionSaved.node, Session.node, LocationServiceMap.node]),
+ [
+ Global.node.replace(tempGlobalLayer),
+ offlineModels,
+ // The browser never reads the watcher; a live one subscribes to the OS for every Location these tests boot.
+ Watcher.node.replace(Watcher.configured({ enabled: false })),
+ ],
+ ),
+)
+
+const grant = [{ action: "browser", resource: "*", effect: "allow" }] as const
+// What versions before this one granted; a revoke or the startup sweep must still remove it.
+const legacyGrant = [...grant, { action: "skill", resource: "browser", effect: "allow" }] as const
+
+const tab = {
+ id: Browser.TabID.make(`tab_${crypto.randomUUID()}`),
+ url: "https://example.com/",
+ title: "Example",
+ loading: false,
+ canGoBack: false,
+ canGoForward: false,
+ generation: 1,
+}
+
+// A location with `config` as its opencode.json, `files` beside it and one session, plus a stand-in desktop that attaches to that
+// session and answers every browser command with an empty tab list.
+const setup = (config: object, files: Record = {}) =>
+ Effect.gen(function* () {
+ const dir = yield* tmpdirScoped()
+ for (const [name, text] of Object.entries(files))
+ yield* Effect.promise(() => Bun.write(path.join(dir.path, name), text))
+ yield* Effect.promise(() => Bun.write(path.join(dir.path, "opencode.json"), JSON.stringify(config)))
+ const ref = Location.Ref.make({ directory: AbsolutePath.make(dir.path) })
+ const locations = yield* LocationServiceMap.Service
+ const context = yield* locations.contextEffect(ref).pipe(Effect.scoped)
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(context))
+ const sessions = yield* Session.Service
+ const session = yield* sessions.create({ location: ref })
+ const rpc = Context.get(context, Rpc.Service).client(Browser.Definition)
+ const attachments = new Map }>()
+ const commands = { count: 0 }
+ yield* rpc.events.subscribe("control").pipe(
+ Stream.runForEach((event) => {
+ const attachment = attachments.get(event.data.connectionID)
+ if (!attachment) return Effect.void
+ if (event.data.type === "attached") return Deferred.succeed(attachment.attached, undefined)
+ if (event.data.type !== "command") return Effect.void
+ commands.count++
+ return rpc.result({
+ sessionID: attachment.sessionID,
+ connectionID: event.data.connectionID,
+ requestID: event.data.requestID,
+ outcome: { type: "success", result: { value: { tabs: [], focusedTabID: null }, files: [] } },
+ })
+ }),
+ Effect.forkScoped({ startImmediately: true }),
+ )
+ const attach = Effect.fnUntraced(function* (sessionID: Session.ID) {
+ const connectionID = crypto.randomUUID()
+ const attached = Deferred.makeUnsafe()
+ attachments.set(connectionID, { sessionID, attached })
+ const call = yield* rpc.attach({ sessionID, connectionID, version: 4 }).pipe(Effect.forkScoped)
+ yield* Deferred.await(attached).pipe(Effect.timeout("10 seconds"))
+ // One open tab, so operations that target a tab get past tab selection to the permission check.
+ yield* rpc.state({ sessionID, connectionID, state: { tabs: [tab], focusedTabID: tab.id } })
+ return call
+ })
+ const attachment = yield* attach(session.id)
+ const tools = yield* Context.get(context, Tool.Service).list()
+ // Runs browser. as `agent` would, through the plugin's executor and the real permission service.
+ const run = (operation: string, input: object, agent = "build", sessionID = session.id) => {
+ const separator = operation.lastIndexOf(".")
+ const namespace = separator < 0 ? "browser" : `browser.${operation.slice(0, separator)}`
+ const tool = tools.find(
+ (tool) => tool.name === operation.slice(separator + 1) && tool.options?.namespace === namespace,
+ )
+ if (!tool) return Effect.die(new Error(`browser.${operation} is not registered`))
+ return tool.execute(input, {
+ sessionID,
+ agent: Agent.ID.make(agent),
+ messageID: SessionMessage.ID.create(),
+ id: Tool.CallID.make(`call_${crypto.randomUUID()}`),
+ progress: () => Effect.void,
+ })
+ }
+ return {
+ context,
+ ref,
+ session,
+ commands,
+ attach,
+ navigate: (url: string) => rpc.state({ sessionID: session.id, connectionID: attachments.keys().next().value!, state: { tabs: [{ ...tab, url, generation: tab.generation + 1 }], focusedTabID: tab.id } }),
+ // The desktop closes the session's first attachment.
+ detach: Fiber.interrupt(attachment),
+ run,
+ permissions: (sessionID = session.id) => Effect.map(sessions.get(sessionID), (info) => info.permissions ?? []),
+ call: (agent = "build", sessionID = session.id) => run("tabs.list", {}, agent, sessionID),
+ // What the session's next step offers its agent: the selection every step builds its tools and instructions from.
+ listing: (sessionID = session.id) => listing(Context.get(context, SessionContext.Service), sessionID),
+ }
+ })
+
+const listing = Effect.fnUntraced(function* (contexts: SessionContext.Interface, sessionID: Session.ID) {
+ const selection = yield* contexts.select(sessionID)
+ const browser = (name: string) => name === "browser" || name.startsWith("browser.") || name.startsWith("browser_")
+ const skills = selection.instructions.find((source) => source.key === "core/skill-guidance")
+ const guidance = skills ? yield* skills.read : undefined
+ const catalog = selection.tools.codeModeCatalog
+ return {
+ selection,
+ catalog: (catalog ? codeModeListings(catalog).map((item) => item.path) : []).filter(browser),
+ direct: selection.tools.definitions.map((tool) => tool.name).filter(browser),
+ skill: Array.isArray(guidance) && guidance.some((skill) => isRecord(skill) && skill.id === "browser"),
+ }
+})
+
+// Runs `code` through the selection's Code Mode tool, as the model's `execute` call would.
+const codeMode = (selection: SessionContext.Selection, code: string) =>
+ selection.tools
+ .execute({
+ sessionID: selection.session.id,
+ agent: selection.agent.id,
+ messageID: SessionMessage.ID.create(),
+ call: { type: "tool-call", id: `call_${crypto.randomUUID()}`, name: "execute", input: { code } },
+ })
+ .pipe(Effect.map((result) => result.output))
+
+it.live("without a deny, an attached session's browser calls run with no prompt", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({})
+ expect(yield* browser.permissions()).toEqual([...grant])
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ expect(browser.commands.count).toBe(1)
+ }),
+)
+
+it.live("a browser deny in config refuses browser calls after the desktop attaches", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [{ action: "browser", resource: "*", effect: "deny" }] })
+ // The attachment still writes its grant; the configured deny must win over it.
+ expect(yield* browser.permissions()).toEqual([...grant])
+ expect((yield* browser.call().pipe(Effect.flip)).message).toStartWith("[browser.denied]")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+it.live("an agent that denies every tool stays denied after attach, while other agents keep the browser", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({
+ agents: {
+ reviewer: {
+ mode: "subagent",
+ permissions: [
+ { action: "*", resource: "*", effect: "deny" },
+ { action: "read", resource: "*", effect: "allow" },
+ ],
+ },
+ },
+ })
+ expect((yield* browser.call("reviewer").pipe(Effect.flip)).message).toStartWith("[browser.denied]")
+ expect((yield* browser.call("build")).output).toEqual({ tabs: [], focusedTabID: null })
+ expect(browser.commands.count).toBe(1)
+ }),
+)
+
+it.live("a tool.use policy refuses browser calls after the desktop attaches", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ policies: [{ action: "tool.use", resource: "browser:*", effect: "deny" }] })
+ expect((yield* browser.call().pipe(Effect.flip)).message).toBe("Blocked by configuration policy")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+it.live("a subagent's session loses the inherited grant before its first prompt is admitted", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({})
+ const sessions = yield* Session.Service
+ const child = yield* sessions.create({ parentID: browser.session.id, agent: Agent.ID.make("general") })
+ expect(yield* browser.permissions(child.id)).toEqual([...grant])
+
+ yield* sessions.prompt({ sessionID: child.id, text: "Take a screenshot", resume: false })
+ expect(yield* browser.permissions(child.id)).toEqual([])
+ expect(yield* browser.permissions()).toEqual([...grant])
+ expect((yield* browser.call("general", child.id)).output).toMatchObject({ connected: false })
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ }),
+)
+
+it.live("a subagent whose agent denies the browser stays denied, even with a browser attached to it", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({
+ agents: { reviewer: { mode: "subagent", permissions: [{ action: "browser", resource: "*", effect: "deny" }] } },
+ })
+ const sessions = yield* Session.Service
+ const child = yield* sessions.create({ parentID: browser.session.id, agent: Agent.ID.make("reviewer") })
+ yield* sessions.prompt({ sessionID: child.id, text: "Review the page", resume: false })
+ // Viewing the child in the desktop attaches it, which grants it the browser again.
+ yield* browser.attach(child.id)
+ // The child's own attachment owns that grant, so a later prompt keeps it.
+ yield* sessions.prompt({ sessionID: child.id, text: "Check again", resume: false })
+ expect(yield* browser.permissions(child.id)).toEqual([...grant])
+ expect((yield* browser.call("reviewer", child.id).pipe(Effect.flip)).message).toStartWith("[browser.denied]")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+// No process has this ID: it is odd, so not a Windows process ID, and above Linux's and macOS's limits.
+const exited = 4_194_305
+const owner = (directory: string, pid: number, host = hostname()) => ({ host, pid, location: { directory } })
+
+it.live("startup revokes a grant whose server no longer runs", () =>
+ Effect.gen(function* () {
+ const dir = yield* tmpdirScoped()
+ const ref = Location.Ref.make({ directory: AbsolutePath.make(dir.path) })
+ const storage = PluginHost.storage(yield* KV.Service, "opencode.browser")
+ const sessionID = Session.ID.create()
+ // What a server killed while attached leaves behind: the grant and the record of the process that wrote it.
+ yield* storage.set(`grant:${sessionID}`, owner(ref.directory, exited))
+ const sessions = yield* Session.Service
+ yield* sessions.create({ id: sessionID, location: ref, permissions: [...legacyGrant] })
+ const locations = yield* LocationServiceMap.Service
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(yield* locations.contextEffect(ref).pipe(Effect.scoped)))
+
+ expect((yield* sessions.get(sessionID)).permissions).toEqual([])
+ expect(yield* storage.get(`grant:${sessionID}`)).toBeUndefined()
+ }),
+)
+
+it.live("another server's startup leaves a live attachment's grant in place", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({})
+ const sessions = yield* Session.Service
+ const storage = PluginHost.storage(yield* KV.Service, "opencode.browser")
+ const stale = yield* sessions.create({ location: browser.ref, permissions: [...grant] })
+ yield* storage.set(`grant:${stale.id}`, owner(browser.ref.directory, exited))
+ const remote = yield* sessions.create({ location: browser.ref, permissions: [...grant] })
+ yield* storage.set(`grant:${remote.id}`, owner(browser.ref.directory, exited, "other-host"))
+
+ // A second server for this location, sharing the database, starts and sweeps.
+ yield* BrowserConnection.reconcileStaleGrants({
+ session: {
+ get: (input) => sessions.get(input.sessionID),
+ update: (input) =>
+ sessions.setPermissions({ sessionID: input.sessionID, permissions: input.permissions ?? [] }),
+ },
+ storage,
+ location: browser.ref,
+ })
+
+ // The live grant is recorded with this process, which still runs.
+ expect(yield* storage.get(`grant:${browser.session.id}`)).toEqual(owner(browser.ref.directory, process.pid))
+ expect(yield* browser.permissions()).toEqual([...grant])
+ expect(yield* browser.permissions(stale.id)).toEqual([])
+ expect(yield* browser.permissions(remote.id)).toEqual([...grant])
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ }),
+)
+
+it.live("deleting an attached session forgets the record of who granted it the browser", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({})
+ const storage = PluginHost.storage(yield* KV.Service, "opencode.browser")
+ const sessions = yield* Session.Service
+ expect(yield* storage.get(`grant:${browser.session.id}`)).toBeDefined()
+ const file = { id: Browser.FileID.make(`file_${crypto.randomUUID()}`), name: "report.txt", mime: "text/plain", data: new TextEncoder().encode("report") }
+ const [saved] = yield* BrowserFiles.save([file], BrowserFiles.exportPaths([file], BrowserFiles.exportRoot(browser.session.id)))
+ expect(yield* Effect.promise(() => Bun.file(saved!.path).exists())).toBe(true)
+ yield* sessions.remove(browser.session.id)
+ yield* storage.get(`grant:${browser.session.id}`).pipe(
+ Effect.flatMap((owner) => (owner === undefined ? Effect.void : Effect.fail("record still there"))),
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.timeout("5 seconds"),
+ )
+ yield* Effect.promise(() => Bun.file(saved!.path).exists()).pipe(
+ Effect.flatMap((exists) => exists ? Effect.fail("session export still there") : Effect.void),
+ Effect.retry(Schedule.spaced("10 millis")), Effect.timeout("5 seconds"),
+ )
+ }),
+)
+
+const rule = (resource: string, effect: "allow" | "deny" | "ask", action = "browser") => ({ action, resource, effect })
+
+it.live("a deny on one browser operation refuses that operation and still allows the others", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("tabs.open", "deny")] })
+ expect((yield* browser.run("tabs.open", {}).pipe(Effect.flip)).message).toStartWith(
+ "[browser.denied] browser.tabs.open",
+ )
+ expect(browser.commands.count).toBe(0)
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ }),
+)
+
+it.live("a deny on wait refuses it before it probes the page", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("wait", "deny")] })
+ expect(
+ (yield* browser.run("wait", { tabID: tab.id, selector: "#done", timeoutMs: 200 }).pipe(Effect.flip)).message,
+ ).toStartWith("[browser.denied] browser.wait")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+const missingTab = Browser.TabID.make(`tab_${crypto.randomUUID()}`)
+// The two calls that show a workspace file.
+const files = (input: object): [string, object][] => [["tabs.open", input], ["navigate", { tabID: tab.id, ...input }]]
+
+it.live("browser file reads require the file's own permission before reading or sending it", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("blocked.txt", "deny", "read"), rule("*", "deny", "external_directory")] })
+ // A non-existent file distinguishes a permission refusal from an attempted open, without transferring any data.
+ for (const operation of ["files.upload", "files.drop"]) {
+ for (const [path, action] of [["blocked.txt", "read"], [pathForExternalTest(browser.ref.directory), "external_directory"]]) {
+ const error = yield* refusal(browser, operation, { tabID: tab.id, ref: "e1", paths: [path] })
+ expect(error).toContain(`Permission denied: ${action}`)
+ }
+ }
+ for (const [operation, input] of files({ path: "./blocked.txt#L1" })) expect(yield* refusal(browser, operation, input)).toBe("Permission denied: read")
+ yield* Effect.promise(() => Bun.write(path.join(browser.ref.directory, "blocked.txt"), "fixture"))
+ for (const [operation, input] of files({ path: "./blocked.txt#L1" })) expect(yield* refusal(browser, operation, input)).toBe("Permission denied: read")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+// Outside both the Location and its worktree, even when the runner's temp directory is itself in a checkout.
+function pathForExternalTest(directory: string) {
+ return path.join(path.parse(directory).root, "browser-permission-test", "absent.txt")
+}
+
+// What `operation` fails with in `sessionID`.
+const refusal = (
+ browser: Effect.Success>,
+ operation: string,
+ input: object,
+ sessionID = browser.session.id,
+ agent = "build",
+) =>
+ browser.run(operation, input, agent, sessionID).pipe(
+ Effect.flip,
+ Effect.map((error) => error.message),
+ )
+
+// A browser denied by config, a session beside the attached one with no desktop, a file in the workspace and a tab that
+// does not exist: whichever of them a call meets, it must hear only the denial.
+it.live("a denied call reveals neither its files, its tab nor the connection", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("*", "deny")] })
+ const sessions = yield* Session.Service
+ const detached = yield* sessions.create({ location: browser.ref })
+ yield* Effect.promise(() => Bun.write(path.join(browser.ref.directory, "page.html"), "page
"))
+ const fileID = `file_${crypto.randomUUID()}`
+ const calls: [string, object, Session.ID][] = [
+ ...[
+ [{ path: "page.html" }, detached.id] as const,
+ [{ path: "missing.html" }, browser.session.id] as const,
+ [{ path: "missing.html" }, detached.id] as const,
+ [{ path: "." }, browser.session.id] as const,
+ ].flatMap(([input, sessionID]) => files(input).map(([operation, call]): [string, object, Session.ID] => [operation, call, sessionID])),
+ ...["files.upload", "files.drop"].flatMap((operation): [string, object, Session.ID][] => [
+ [operation, { tabID: tab.id, ref: "e1", paths: ["page.html"] }, detached.id],
+ [operation, { tabID: tab.id, ref: "e1", paths: ["missing.html"] }, detached.id],
+ [operation, { tabID: missingTab, ref: "e1", paths: ["page.html"] }, browser.session.id],
+ ]),
+ ["files.get", { tabID: missingTab, fileID }, browser.session.id],
+ ["files.get", { tabID: tab.id, fileID }, detached.id],
+ ["tabs.list", {}, detached.id],
+ ["snapshot", { tabID: missingTab }, browser.session.id],
+ ["snapshot", { tabID: tab.id }, detached.id],
+ ["wait", { tabID: missingTab, selector: "#done" }, browser.session.id],
+ ["wait", { tabID: tab.id, selector: "#done" }, detached.id],
+ ]
+ for (const [operation, input, sessionID] of calls)
+ expect(yield* refusal(browser, operation, input, sessionID)).toStartWith("[browser.denied]")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+it.live("a call a tool.use policy blocks hears the same answer whatever tab or file it names", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ policies: [{ action: "tool.use", resource: "browser:*", effect: "deny" }] })
+ yield* Effect.promise(() => Bun.write(path.join(browser.ref.directory, "page.html"), "page
"))
+ for (const [operation, input] of [
+ ...files({ path: "page.html" }),
+ ...files({ path: "missing.html" }),
+ ...files({ path: "." }),
+ ["snapshot", { tabID: missingTab }],
+ ["wait", { tabID: missingTab, selector: "#done" }],
+ ] as const)
+ expect(yield* refusal(browser, operation, input)).toBe("Blocked by configuration policy")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+it.live("a call that must ask names no tab before the prompt is answered", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("*", "ask")] })
+ const permissions = Context.get(browser.context, Permission.Service)
+ const call = yield* browser.run("snapshot", { tabID: missingTab }).pipe(Effect.forkScoped)
+ // Before, the call failed at once listing the open tabs and URLs; now it waits on the user before reading them.
+ const request = yield* asked(permissions, "snapshot")
+ expect(request.resources).toEqual(["snapshot"])
+ yield* permissions.reply({ requestID: request.id, reply: "reject" })
+ expect(Exit.isFailure(yield* Fiber.await(call))).toBe(true)
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+it.live("an agent core cannot resolve, such as a disabled one, is denied the browser despite the grant", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ agents: { reviewer: { disabled: true } } })
+ expect(yield* refusal(browser, "tabs.list", {}, browser.session.id, "reviewer")).toStartWith("[browser.denied]")
+ expect(yield* refusal(browser, "tabs.list", {}, browser.session.id, "ghost")).toStartWith("[browser.denied]")
+ expect(browser.commands.count).toBe(0)
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ }),
+)
+
+it.live("without a deny, a session with no desktop hears that it is disconnected", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({})
+ const sessions = yield* Session.Service
+ const detached = yield* sessions.create({ location: browser.ref })
+ yield* Effect.promise(() => Bun.write(path.join(browser.ref.directory, "page.html"), "page
"))
+ // Whether the file exists is not said: without a desktop no permission check, policies included, can run.
+ const status = (yield* browser.call("build", detached.id)).output
+ expect(status).toMatchObject({ connected: false, message: expect.stringContaining("retry only after it attaches") })
+ for (const [op, input] of [...files({ path: "page.html" }), ...files({ path: "missing.html" }), ["wait", { tabID: tab.id, selector: "#done" }], ["snapshot", { tabID: missingTab }]] as const)
+ expect((yield* browser.run(op, input, "build", detached.id).pipe(Effect.flip)).message).toStartWith("[browser.not_attached]")
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+
+it.live("a wildcard resource pattern in a browser deny is honoured", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("files.*", "deny")] })
+ expect((yield* browser.run("files.list", { tabID: tab.id }).pipe(Effect.flip)).message).toStartWith(
+ "[browser.denied] browser.files.list",
+ )
+ expect(browser.commands.count).toBe(0)
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ }),
+)
+
+// browser.preview was the tool that showed a workspace file. tabs.open and navigate show one now, when they get a path,
+// and every way there was to deny the old name must still refuse them.
+it.live("a deny of preview, the name the path forms had, still refuses them, and so does a deny of their own operation", () =>
+ Effect.gen(function* () {
+ const page = { "page.html": "page
" }
+ const forms = files({ path: "page.html" })
+ // A person's rule in config.
+ const configured = yield* setup({ permissions: [rule("preview", "deny")] }, page)
+ for (const [operation, input] of forms)
+ expect(yield* refusal(configured, operation, input)).toBe(
+ "[browser.denied] Showing a workspace file in the browser (permission browser.preview) is denied for this agent by configuration; no action ran. Do not retry it.",
+ )
+ // An agent's own rule.
+ const agent = yield* setup({ agents: { reviewer: { mode: "subagent", permissions: [rule("preview", "deny")] } } }, page)
+ for (const [operation, input] of forms)
+ expect(yield* refusal(agent, operation, input, agent.session.id, "reviewer")).toStartWith("[browser.denied] Showing a workspace file")
+ // A managed policy.
+ const policy = yield* setup({ policies: [{ action: "tool.use", resource: "browser:preview", effect: "deny" }] }, page)
+ for (const [operation, input] of forms) expect(yield* refusal(policy, operation, input)).toBe("Blocked by configuration policy")
+ // A deny that another plugin's experimental.rules hook adds.
+ const hooked = yield* setup({}, page)
+ yield* Context.get(hooked.context, PluginHooks.Service).register("permission", "experimental.rules", (event) =>
+ Effect.sync(() => event.deny({ action: "browser", resource: "preview" })),
+ )
+ for (const [operation, input] of forms) expect(yield* refusal(hooked, operation, input)).toBe("Permission denied: browser")
+ // None of them reached the desktop, and none of them stops a web address.
+ for (const browser of [configured, policy, hooked]) {
+ expect(browser.commands.count).toBe(0)
+ // The stand-in desktop answers with a tab list rather than a tab; reaching it is the assertion.
+ yield* browser.run("tabs.open", { url: "https://example.com" }).pipe(Effect.exit)
+ expect(browser.commands.count).toBe(1)
+ }
+ expect(agent.commands.count).toBe(0)
+
+ // The operation's own name refuses its path form as it refuses its web form.
+ const own = yield* setup({ permissions: [rule("tabs.open", "deny"), rule("navigate", "deny")] }, page)
+ expect(yield* refusal(own, "tabs.open", { path: "page.html" })).toStartWith("[browser.denied] browser.tabs.open")
+ expect(yield* refusal(own, "navigate", { tabID: tab.id, path: "page.html" })).toStartWith("[browser.denied] browser.navigate")
+ expect(own.commands.count).toBe(0)
+
+ // An ask on the old name prompts for the path form, and the request names both operations.
+ const asking = yield* setup({ permissions: [rule("preview", "ask")] }, page)
+ const prompt = yield* answer(asking, "tabs.open", { path: "page.html" }, "reject")
+ expect(prompt.request.resources).toEqual(["tabs.open", "preview"])
+ expect(prompt.request.metadata?.input).toEqual({ paths: ["page.html"] })
+ expect(asking.commands.count).toBe(0)
+ }),
+)
+
+it.live("an allow for one operation after a whole-browser deny wins, as the last matching rule", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("*", "deny"), rule("tabs.list", "allow")] })
+ expect((yield* browser.call()).output).toEqual({ tabs: [], focusedTabID: null })
+ expect((yield* browser.run("tabs.open", {}).pipe(Effect.flip)).message).toStartWith("[browser.denied]")
+ expect(browser.commands.count).toBe(1)
+ }),
+)
+
+it.live("a configured browser ask prompts for the call instead of being answered by the grant", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("tabs.list", "ask")] })
+ const permissions = Context.get(browser.context, Permission.Service)
+ const call = yield* browser.call().pipe(Effect.forkScoped)
+ const request = yield* permissions.list().pipe(
+ Effect.flatMap((requests) => (requests[0] ? Effect.succeed(requests[0]) : Effect.fail("not asked yet"))),
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.timeout("5 seconds"),
+ )
+ expect(request).toMatchObject({ sessionID: browser.session.id, action: "browser", resources: ["tabs.list"] })
+ expect(browser.commands.count).toBe(0)
+
+ yield* permissions.reply({ requestID: request.id, reply: "once" })
+ expect((yield* Fiber.join(call)).output).toEqual({ tabs: [], focusedTabID: null })
+ expect(browser.commands.count).toBe(1)
+ }),
+)
+
+// The pending permission request for `operation`, once the call has asked.
+const asked = (permissions: Permission.Interface, operation: string) =>
+ permissions.list().pipe(
+ Effect.flatMap((requests) => {
+ const request = requests.find((item) => item.resources.includes(operation))
+ return request ? Effect.succeed(request) : Effect.fail("not asked yet")
+ }),
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.timeout("5 seconds"),
+ )
+
+// Answers the prompt the call of `operation` raises with `reply` and returns the call's result.
+const answer = Effect.fnUntraced(function* (
+ browser: Effect.Success>,
+ operation: string,
+ input: object,
+ reply: Permission.Reply,
+) {
+ const permissions = Context.get(browser.context, Permission.Service)
+ const call = yield* browser.run(operation, input).pipe(Effect.forkScoped)
+ const request = yield* asked(permissions, operation)
+ yield* permissions.reply({ requestID: request.id, reply })
+ // A plain rejection ends the step, so it surfaces as a defect.
+ return { request, exit: yield* Fiber.await(call) }
+})
+
+it.live("always for one browser operation stops its prompts, while other operations still prompt", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("*", "ask")] })
+ const permissions = Context.get(browser.context, Permission.Service)
+ const approved = yield* answer(browser, "tabs.list", {}, "always")
+ expect(approved.request.save).toEqual(["tabs.list"])
+ expect(browser.commands.count).toBe(1)
+
+ expect((yield* browser.call().pipe(Effect.timeout("5 seconds"))).output).toEqual({ tabs: [], focusedTabID: null })
+ expect(yield* permissions.list()).toEqual([])
+ expect(browser.commands.count).toBe(2)
+ const other = yield* answer(browser, "tabs.open", {}, "reject")
+ expect(other.request.resources).toEqual(["tabs.open"])
+ expect(browser.commands.count).toBe(2)
+ }),
+)
+
+it.live("browser approvals retain legacy operation policy and bind always to the site and complete script", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("evaluate", "ask")] })
+ const input = { tabID: tab.id, script: "document.title" }
+ const first = yield* answer(browser, "evaluate", input, "always")
+ expect(first.request.resources).toEqual(["evaluate"])
+ expect(first.request.metadata?.input).toEqual({ site: "https://example.com", script: input.script })
+ expect(first.request.save?.[0]).toMatch(/^evaluate https:\/\/example\.com [a-f0-9]{64}$/)
+ // The stand-in desktop answers with a tab list rather than an evaluation result; reaching it is the assertion.
+ yield* browser.run("evaluate", input).pipe(Effect.flip, Effect.timeout("5 seconds"))
+ expect(browser.commands.count).toBe(2)
+ const next = yield* answer(browser, "evaluate", { ...input, script: "location.href" }, "reject")
+ expect(next.request.save).not.toEqual(first.request.save)
+ expect(browser.commands.count).toBe(2)
+ yield* browser.navigate("https://elsewhere.test/")
+ const other = yield* answer(browser, "evaluate", input, "reject")
+ expect(other.request.metadata?.input).toEqual({ site: "https://elsewhere.test", script: input.script })
+ expect(other.request.save).not.toEqual(first.request.save)
+ }),
+)
+
+it.live("a saved browser approval outlives detach and re-attach, and only covers its operation", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("*", "ask")] })
+ const permissions = Context.get(browser.context, Permission.Service)
+ yield* answer(browser, "tabs.list", {}, "always")
+
+ yield* browser.detach
+ yield* browser.permissions().pipe(
+ Effect.flatMap((rules) => (rules.length ? Effect.fail("grant not revoked yet") : Effect.void)),
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.timeout("5 seconds"),
+ )
+ yield* browser.attach(browser.session.id)
+ expect(yield* browser.permissions()).toEqual([...grant])
+
+ expect((yield* browser.call().pipe(Effect.timeout("5 seconds"))).output).toEqual({ tabs: [], focusedTabID: null })
+ expect(yield* permissions.list()).toEqual([])
+ const other = yield* answer(browser, "tabs.open", {}, "reject")
+ expect(other.request.resources).toEqual(["tabs.open"])
+ }),
+)
+
+it.live("a configured deny that matches last refuses the call despite a saved approval", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ permissions: [rule("*", "ask"), rule("tabs.open", "deny")] })
+ yield* answer(browser, "tabs.list", {}, "always")
+ const saved = yield* PermissionSaved.Service
+ const projectID = Context.get(browser.context, Location.Service).project.id
+ expect((yield* saved.list({ projectID })).map((item) => [item.action, item.resource])).toEqual([
+ ["browser", "tabs.list"],
+ ])
+ yield* saved.add({ projectID, action: "browser", resources: ["tabs.open"] })
+
+ expect((yield* browser.run("tabs.open", {}).pipe(Effect.flip)).message).toStartWith(
+ "[browser.denied] browser.tabs.open",
+ )
+ expect(browser.commands.count).toBe(1)
+ }),
+)
+
+// Listing and calling, decided by the same rules. `listed` is whether the agent's next step offers the browser tools and
+// skill; each operation either reaches the desktop, prompts, or is refused as denied or disconnected.
+type Outcome = "allow" | "ask" | "deny" | "disconnected"
+const truth: ReadonlyArray<{
+ readonly name: string
+ readonly global?: ReadonlyArray>
+ readonly agent?: ReadonlyArray>
+ readonly attached: boolean
+ readonly listed: boolean
+ readonly list: Outcome
+ readonly open: Outcome
+}> = [
+ { name: "no rules", attached: true, listed: true, list: "allow", open: "allow" },
+ { name: "no rules, no desktop", attached: false, listed: false, list: "disconnected", open: "disconnected" },
+ { name: "global deny", global: [rule("*", "deny")], attached: true, listed: false, list: "deny", open: "deny" },
+ { name: "global deny, no desktop", global: [rule("*", "deny")], attached: false, listed: false, list: "deny", open: "deny" },
+ { name: "agent deny", agent: [rule("*", "deny")], attached: true, listed: false, list: "deny", open: "deny" },
+ { name: "global allow, agent deny", global: [rule("*", "allow")], agent: [rule("*", "deny")], attached: true, listed: false, list: "deny", open: "deny" },
+ { name: "global deny, agent allow", global: [rule("*", "deny")], agent: [rule("*", "allow")], attached: true, listed: true, list: "allow", open: "allow" },
+ { name: "agent denies every tool", agent: [rule("*", "deny", "*"), rule("*", "allow", "read")], attached: true, listed: false, list: "deny", open: "deny" },
+ { name: "global ask", global: [rule("*", "ask")], attached: true, listed: true, list: "ask", open: "ask" },
+ { name: "global deny, agent ask", global: [rule("*", "deny")], agent: [rule("*", "ask")], attached: true, listed: true, list: "ask", open: "ask" },
+ { name: "one operation denied", global: [rule("tabs.open", "deny")], attached: true, listed: true, list: "allow", open: "deny" },
+ { name: "operation pattern denied", global: [rule("tabs.*", "deny")], attached: true, listed: true, list: "deny", open: "deny" },
+ { name: "whole browser denied, one operation allowed after", global: [rule("*", "deny"), rule("tabs.list", "allow")], attached: true, listed: true, list: "allow", open: "deny" },
+]
+
+const unattached = Schema.is(Schema.Struct({ output: Schema.Struct({ connected: Schema.Literal(false) }) }))
+
+// What `operation` comes to for `agent` in `sessionID`.
+const outcome = (
+ browser: Effect.Success>,
+ operation: string,
+ agent: string,
+ sessionID: Session.ID,
+) => settle(browser, sessionID, browser.run(operation, {}, agent, sessionID))
+
+// What `call` comes to: it reaches its end or the desktop, prompts, or is refused as denied or disconnected. A call
+// that prompts is interrupted, which withdraws the prompt. Any other failure is returned as its message, so the
+// comparison shows it.
+const settle = Effect.fnUntraced(function* (
+ browser: Effect.Success>,
+ sessionID: Session.ID,
+ call: Effect.Effect,
+) {
+ const permissions = Context.get(browser.context, Permission.Service)
+ const before = browser.commands.count
+ const reached = () => browser.commands.count > before
+ const settled = call.pipe(
+ // Without a desktop, tabs.list answers that the browser is not attached instead of failing.
+ Effect.map((result): Outcome | string => (unattached(result) ? "disconnected" : "allow")),
+ Effect.catch((error) =>
+ Effect.succeed(
+ error.message.startsWith("[browser.denied]") || error.message.startsWith("Permission denied") || error.error instanceof Permission.BlockedError
+ ? "deny"
+ : error.message.startsWith("[browser.disconnected]") || error.message.startsWith("[browser.not_attached]")
+ ? "disconnected"
+ : reached()
+ ? "allow"
+ : error.message,
+ ),
+ ),
+ )
+ const prompted = permissions.forSession(sessionID).pipe(
+ Effect.flatMap((requests) => (requests[0] ? Effect.succeed(requests[0]) : Effect.fail("not asked yet"))),
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.as("ask"),
+ )
+ return yield* Effect.raceFirst(settled, prompted).pipe(Effect.timeout("5 seconds"))
+})
+for (const row of truth)
+ it.live(`listing agrees with calling: ${row.name}`, () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({
+ ...(row.global && { permissions: row.global }),
+ ...(row.agent && { agents: { build: { permissions: row.agent } } }),
+ })
+ const sessions = yield* Session.Service
+ const sessionID = row.attached ? browser.session.id : (yield* sessions.create({ location: browser.ref })).id
+ const listed = yield* browser.listing(sessionID)
+ expect(listed.catalog.length > 0).toBe(row.listed)
+ expect(listed.skill).toBe(row.listed)
+ expect(listed.direct).toEqual([])
+ expect(yield* outcome(browser, "tabs.list", "build", sessionID)).toBe(row.list)
+ expect(yield* outcome(browser, "tabs.open", "build", sessionID)).toBe(row.open)
+ }),
+ )
+
+it.live("an agent denied the browser finds no browser tools through Code Mode's catalog, search or tools", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ agents: { reviewer: { mode: "primary", permissions: [rule("*", "deny")] } } })
+ const allowed = yield* browser.listing()
+ expect(allowed.catalog).toContain("browser.tabs.list")
+ expect(yield* codeMode(allowed.selection, 'return search({ namespace: "browser" }).items.length > 0')).toMatchObject({ output: "true" })
+ expect(yield* codeMode(allowed.selection, "return (await tools.browser.tabs.list({})).tabs.length")).toMatchObject({ output: "0" })
+
+ const sessions = yield* Session.Service
+ yield* sessions.switchAgent({ sessionID: browser.session.id, agent: Agent.ID.make("reviewer") })
+ const denied = yield* browser.listing()
+ expect(denied.catalog).toEqual([])
+ expect(denied.direct).toEqual([])
+ expect(denied.skill).toBe(false)
+ expect(yield* codeMode(denied.selection, 'return search({ namespace: "browser" }).items.length')).toMatchObject({ output: "0" })
+ expect(yield* codeMode(denied.selection, 'return search({ query: "browser tabs screenshot" }).items.filter((item) => item.path.startsWith("tools.browser")).length')).toMatchObject({ output: "0" })
+ expect(
+ yield* codeMode(
+ denied.selection,
+ 'try { await tools.browser.tabs.list({}); return "called" } catch (error) { return String(error?.message ?? error) }',
+ ),
+ ).toMatchObject({ output: "Unknown tool 'browser.tabs.list'.", toolCalls: [] })
+ expect(browser.commands.count).toBe(1)
+ }),
+)
+
+it.live("the next step's listing follows an agent switch, a session rule, a config reload and the attachment", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ agents: { reviewer: { mode: "primary", permissions: [rule("*", "deny")] } } })
+ const sessions = yield* Session.Service
+ const listed = Effect.map(browser.listing(), (listing) => listing.catalog.length > 0)
+ expect(yield* listed).toBe(true)
+
+ yield* sessions.switchAgent({ sessionID: browser.session.id, agent: Agent.ID.make("reviewer") })
+ expect(yield* listed).toBe(false)
+ yield* sessions.switchAgent({ sessionID: browser.session.id, agent: Agent.ID.make("build") })
+ expect(yield* listed).toBe(true)
+
+ yield* sessions.setPermissions({ sessionID: browser.session.id, permissions: [...grant, rule("*", "deny")] })
+ expect(yield* listed).toBe(false)
+ expect((yield* browser.call().pipe(Effect.flip)).message).toStartWith("[browser.denied]")
+ yield* sessions.setPermissions({ sessionID: browser.session.id, permissions: [...grant] })
+ expect(yield* listed).toBe(true)
+
+ // A config source that changes while the server runs reloads the agents, and with them the rules the grant yields to.
+ const config = Context.get(browser.context, Config.Service)
+ const integrationID = Integration.ID.make("browser-permission-test")
+ yield* config.integration!(
+ integrationID,
+ new ConfigIntegration.Document({
+ type: "document",
+ integrationID,
+ connection: { type: "env", name: "BROWSER_PERMISSION_TEST_KEY" },
+ info: Schema.decodeUnknownSync(Info)({ permissions: [rule("*", "deny")] }),
+ }),
+ )
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(browser.context))
+ expect(yield* listed).toBe(false)
+ expect((yield* browser.call().pipe(Effect.flip)).message).toStartWith("[browser.denied]")
+ yield* config.integration!(integrationID, undefined)
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(browser.context))
+ expect(yield* listed).toBe(true)
+
+ yield* browser.detach
+ yield* browser.permissions().pipe(
+ Effect.flatMap((rules) => (rules.length ? Effect.fail("grant not revoked yet") : Effect.void)),
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.timeout("5 seconds"),
+ )
+ expect(yield* listed).toBe(false)
+ yield* browser.attach(browser.session.id)
+ expect(yield* listed).toBe(true)
+ }),
+)
+
+it.live("a subagent lists no browser tools, whether it lost the inherited grant or its agent denies an attached browser", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({
+ agents: { reviewer: { mode: "subagent", permissions: [rule("*", "deny")] } },
+ })
+ const sessions = yield* Session.Service
+ const general = yield* sessions.create({ parentID: browser.session.id, agent: Agent.ID.make("general") })
+ yield* sessions.prompt({ sessionID: general.id, text: "Take a screenshot", resume: false })
+ expect((yield* browser.listing(general.id)).catalog).toEqual([])
+ expect((yield* browser.listing()).catalog).toContain("browser.tabs.list")
+
+ const reviewer = yield* sessions.create({ parentID: browser.session.id, agent: Agent.ID.make("reviewer") })
+ yield* sessions.prompt({ sessionID: reviewer.id, text: "Review the page", resume: false })
+ yield* browser.attach(reviewer.id)
+ expect(yield* browser.permissions(reviewer.id)).toEqual([...grant])
+ const denied = yield* browser.listing(reviewer.id)
+ expect(denied.catalog).toEqual([])
+ expect(denied.skill).toBe(false)
+
+ // Explore denies every tool, Code Mode included, so a browser it were offered would be listed as direct tools.
+ const explore = yield* sessions.create({ parentID: browser.session.id, agent: Agent.ID.make("explore") })
+ yield* sessions.prompt({ sessionID: explore.id, text: "Find the page", resume: false })
+ yield* browser.attach(explore.id)
+ const listing = yield* browser.listing(explore.id)
+ expect(listing.direct).toEqual([])
+ expect(listing.skill).toBe(false)
+ expect(browser.commands.count).toBe(0)
+ }),
+)
+it.live("a tool.use policy on the browser refuses its calls but still lists its tools, as today", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ policies: [{ action: "tool.use", resource: "browser:*", effect: "deny" }] })
+ // Listing does not ask policies yet; closing that changes this test on purpose.
+ expect((yield* browser.listing()).catalog).toContain("browser.tabs.list")
+ expect((yield* browser.call().pipe(Effect.flip)).message).toBe("Blocked by configuration policy")
+ }),
+)
+
+it.live("with the browser plugin removed, a grant left in a session lists and registers nothing", () =>
+ Effect.gen(function* () {
+ const dir = yield* tmpdirScoped()
+ yield* Effect.promise(() => Bun.write(path.join(dir.path, "opencode.json"), JSON.stringify({ plugins: ["-opencode.browser"] })))
+ const ref = Location.Ref.make({ directory: AbsolutePath.make(dir.path) })
+ const locations = yield* LocationServiceMap.Service
+ const context = yield* locations.contextEffect(ref).pipe(Effect.scoped)
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(context))
+ const sessions = yield* Session.Service
+ const session = yield* sessions.create({ location: ref, permissions: [...grant] })
+ const tools = yield* Context.get(context, Tool.Service).list()
+ expect(tools.filter((tool) => tool.options?.namespace?.startsWith("browser"))).toEqual([])
+ const listed = yield* listing(Context.get(context, SessionContext.Service), session.id)
+ expect(listed.catalog).toEqual([])
+ expect(listed.skill).toBe(false)
+ }),
+)
+
+it.live("with the browser plugin removed, a person's deny on their own browser skill outranks a grant left behind", () =>
+ Effect.gen(function* () {
+ const dir = yield* tmpdirScoped()
+ yield* Effect.promise(() =>
+ Bun.write(
+ path.join(dir.path, ".opencode/skills/browser/SKILL.md"),
+ "---\nname: browser\ndescription: Drive Playwright against the staging site.\n---\n# Playwright\n",
+ ),
+ )
+ yield* Effect.promise(() =>
+ Bun.write(
+ path.join(dir.path, "opencode.json"),
+ JSON.stringify({ plugins: ["-opencode.browser"], permissions: [rule("browser", "deny", "skill")] }),
+ ),
+ )
+ const ref = Location.Ref.make({ directory: AbsolutePath.make(dir.path) })
+ const locations = yield* LocationServiceMap.Service
+ const context = yield* locations.contextEffect(ref).pipe(Effect.scoped)
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(context))
+ const sessions = yield* Session.Service
+ const contexts = Context.get(context, SessionContext.Service)
+ // A grant allows no skill, so the person's deny decides.
+ const current = yield* sessions.create({ location: ref, permissions: [...grant] })
+ expect((yield* listing(contexts, current.id)).skill).toBe(false)
+ // An earlier version's grant also allowed the skill. Nothing sweeps it once the plugin is removed, so it still
+ // outranks the deny; with the plugin loaded, a revoke or the startup sweep removes it.
+ const legacy = yield* sessions.create({ location: ref, permissions: [...legacyGrant] })
+ expect((yield* listing(contexts, legacy.id)).skill).toBe(true)
+ }),
+)
+// Loads the browser skill as the model would, through the read tool.
+const readSkill = (browser: Effect.Success>, agent: string, sessionID = browser.session.id) =>
+ Effect.gen(function* () {
+ const read = (yield* Context.get(browser.context, Tool.Service).list()).find((tool) => tool.name === "read")
+ if (!read) return yield* Effect.die(new Error("read is not registered"))
+ return yield* settle(
+ browser,
+ sessionID,
+ read.execute(
+ { path: "skill://browser/SKILL.md" },
+ {
+ sessionID,
+ agent: Agent.ID.make(agent),
+ messageID: SessionMessage.ID.create(),
+ id: Tool.CallID.make(`call_${crypto.randomUUID()}`),
+ progress: () => Effect.void,
+ },
+ ),
+ )
+ })
+
+const reads = rule("*", "allow", "read")
+
+it.live("the attachment's grant does not override a configured skill deny or ask for the browser skill", () =>
+ Effect.gen(function* () {
+ const denied = yield* setup({ permissions: [reads, rule("*", "deny", "skill")] })
+ const listed = yield* denied.listing()
+ expect(listed.catalog).toContain("browser.tabs.list")
+ expect(listed.skill).toBe(false)
+ expect(yield* readSkill(denied, "build")).toBe("deny")
+
+ const asked = yield* setup({ permissions: [reads, rule("browser", "ask", "skill")] })
+ expect((yield* asked.listing()).skill).toBe(true)
+ expect(yield* readSkill(asked, "build")).toBe("ask")
+
+ const allowed = yield* setup({
+ permissions: [reads],
+ agents: { reviewer: { mode: "primary", permissions: [rule("*", "deny")] } },
+ })
+ expect(yield* readSkill(allowed, "build")).toBe("allow")
+ // The skill tool refuses an agent denied the browser, as its listing does.
+ expect(yield* readSkill(allowed, "reviewer")).toBe("deny")
+ }),
+)
+
+it.live("a person's own skill named browser follows their rules, not the built-in's", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup(
+ { permissions: [reads, rule("*", "deny"), rule("browser", "allow", "skill")] },
+ {
+ ".opencode/skills/browser/SKILL.md":
+ "---\nname: browser\ndescription: Drive Playwright against the staging site.\n---\n# Playwright\n",
+ },
+ )
+ const sessions = yield* Session.Service
+ const detached = yield* sessions.create({ location: browser.ref })
+ for (const sessionID of [browser.session.id, detached.id]) {
+ const listed = yield* browser.listing(sessionID)
+ expect(listed.catalog).toEqual([])
+ expect(listed.skill).toBe(true)
+ }
+ }),
+)
+
+it.live("an automation's code runs the browser for an allowed agent and refuses one denied the browser", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup({ agents: { reviewer: { mode: "primary", permissions: [rule("*", "deny")] } } })
+ const sessions = yield* Session.Service
+ const action = { type: "code" as const, code: "return { state: (await tools.browser.tabs.list({})).tabs.length }" }
+ const run = () =>
+ sessions.get(browser.session.id).pipe(
+ Effect.flatMap((session) =>
+ AutomationCode.run(session, action, { messageID: SessionMessage.ID.create(), state: null, now: 0, runs: 0 }),
+ ),
+ Effect.provideContext(browser.context),
+ )
+ expect(yield* run()).toMatchObject({ ok: true, state: 0 })
+ expect(browser.commands.count).toBe(1)
+ yield* sessions.switchAgent({ sessionID: browser.session.id, agent: Agent.ID.make("reviewer") })
+ expect(yield* run()).toMatchObject({ ok: false, error: "Permission denied: browser" })
+ expect(browser.commands.count).toBe(1)
+ }),
+)
\ No newline at end of file
diff --git a/packages/core/test/browser-tools.test.ts b/packages/core/test/browser-tools.test.ts
new file mode 100644
index 000000000000..eaf25d5b8afa
--- /dev/null
+++ b/packages/core/test/browser-tools.test.ts
@@ -0,0 +1,385 @@
+import { expect } from "bun:test"
+import { join } from "node:path"
+import { mkdir, rm, stat, symlink } from "node:fs/promises"
+import { pathToFileURL } from "node:url"
+import { Context, Deferred, Effect, Schedule, Schema, Stream } from "effect"
+import { Browser } from "@opencode/plugin-browser/rpc"
+import { Agent } from "@opencode/schema/agent"
+import { SessionMessage } from "@opencode/schema/session-message"
+import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
+import { LayerNode } from "@opencode/util/effect/layer-node"
+import { Global } from "@opencode/util/global"
+import { Bus } from "@opencode/core/bus"
+import { Database } from "@opencode/core/database/database"
+import { Watcher } from "@opencode/core/filesystem/watcher"
+import { Location } from "@opencode/core/location"
+import { LocationServiceMap } from "@opencode/core/location-services"
+import { Plugin } from "@opencode/core/plugin"
+import { Rpc } from "@opencode/core/rpc"
+import { AbsolutePath } from "@opencode/core/schema"
+import { Session } from "@opencode/core/session"
+import { Tool } from "@opencode/core/tool"
+import { tempGlobalLayer } from "./fixture/global"
+import { offlineModels } from "./fixture/models"
+import { tmpdirScoped } from "./fixture/tmpdir"
+import { testEffect } from "./lib/effect"
+
+const it = testEffect(
+ AppNodeBuilder.build(LayerNode.group([Database.node, Bus.node, Session.node, LocationServiceMap.node]), [
+ Global.node.replace(tempGlobalLayer),
+ offlineModels,
+ // The browser never reads the watcher; a live one subscribes to the OS for every Location these tests boot.
+ Watcher.node.replace(Watcher.configured({ enabled: false })),
+ ]),
+)
+
+const tabID = Browser.TabID.make(`tab_${crypto.randomUUID()}`)
+const tab = {
+ id: tabID,
+ url: "https://example.test/",
+ title: "Example",
+ loading: false,
+ canGoBack: false,
+ canGoForward: false,
+ generation: 1,
+}
+
+// Undefined leaves the command unanswered, as a page stuck in a long task does.
+type Respond = (action: Browser.Action) => typeof Browser.Outcome.Encoded | undefined
+
+const success = (value: typeof Schema.Json.Type): typeof Browser.Outcome.Encoded => ({
+ type: "success",
+ result: { value, files: [] },
+})
+
+/**
+ * The browser plugin as the server runs it, driven through Code Mode with input repair and validation. `respond` plays
+ * the desktop; `attach: false` leaves the session without one.
+ */
+const setup = (respond: Respond, options: { readonly attach?: boolean; readonly linked?: boolean } = {}) =>
+ Effect.gen(function* () {
+ const dir = yield* tmpdirScoped()
+ const directory = options.linked ? yield* Effect.promise(async () => {
+ await mkdir(join(dir.path, "physical", "Project"), {recursive:true})
+ await symlink(join(dir.path, "physical"), join(dir.path, "alias"), process.platform === "win32" ? "junction" : "dir")
+ const alternate = join(dir.path, "ALIAS", "pRoJeCt")
+ return await stat(alternate).then(() => alternate, () => join(dir.path, "alias", "Project"))
+ }) : dir.path
+ const ref = Location.Ref.make({ directory: AbsolutePath.make(directory) })
+ const locations = yield* LocationServiceMap.Service
+ const context = yield* locations.contextEffect(ref).pipe(Effect.scoped)
+ yield* Plugin.awaitActivation.pipe(Effect.provideContext(context))
+ const sessions = yield* Session.Service
+ const session = yield* sessions.create({ location: ref })
+ const rpc = Context.get(context, Rpc.Service).client(Browser.Definition)
+ const tools = Context.get(context, Tool.Service)
+ const attachment = { sessionID: session.id, connectionID: `conn_${crypto.randomUUID()}` }
+ const ready = yield* Deferred.make()
+ const commands: Browser.Action[] = []
+ const cancelled: string[] = []
+ yield* rpc.events.subscribe("control").pipe(
+ Stream.runForEach((event) =>
+ Effect.gen(function* () {
+ if (event.data.connectionID !== attachment.connectionID) return
+ if (event.data.type === "attached") {
+ yield* rpc.state({ ...attachment, state: { tabs: [tab], focusedTabID: tabID } })
+ yield* Deferred.succeed(ready, undefined)
+ return
+ }
+ if (event.data.type === "cancel") {
+ cancelled.push(event.data.requestID)
+ return
+ }
+ const request = { ...attachment, requestID: event.data.requestID }
+ const command = yield* rpc.command(request)
+ commands.push(command.action)
+ const outcome = respond(command.action)
+ if (outcome) yield* rpc.result({ ...request, outcome })
+ }),
+ ),
+ Effect.forkScoped({ startImmediately: true }),
+ )
+ if (options.attach !== false) {
+ yield* rpc.attach({ ...attachment, version: 4 }).pipe(Effect.forkScoped)
+ yield* Deferred.await(ready).pipe(Effect.timeout("10 seconds"))
+ }
+ const run = Effect.fn("browser-tools.run")(function* (code: string) {
+ const snapshot = yield* tools.snapshot()
+ const result = yield* snapshot.execute({
+ sessionID: session.id,
+ agent: Agent.ID.make("build"),
+ messageID: SessionMessage.ID.make("msg_browser_tools"),
+ call: { type: "tool-call", id: "call_browser_tools", name: "execute", input: { code } },
+ })
+ return (result.output as { readonly output: string }).output
+ })
+ return { directory, session, commands, cancelled, run }
+ })
+
+const evaluated = (value: typeof Schema.Json.Type) => success({ tab, value })
+
+it.live("an unknown parameter fails with the valid ones; evaluate takes expression or code, return and await", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup(() => evaluated("ran"))
+ const output = yield* browser.run(
+ `return await tools.browser.evaluate({ tabID: "${tabID}", script: "1", query: "x" }).catch((error) => error.message)`,
+ )
+ expect(output).toContain(
+ "query: Not a parameter of browser.evaluate. Valid parameters: tabID, frameID, ref, script, expression, code.",
+ )
+ expect(
+ yield* browser.run(`return await tools.browser.tabs.list({ tabID: "${tabID}" }).catch((error) => error.message)`),
+ ).toContain("tabID: Not a parameter of browser.tabs.list. Valid parameters: none.")
+ expect(browser.commands).toEqual([])
+ expect(yield* browser.run(`return (await tools.browser.evaluate({ tabID: "${tabID}", script: "1" })).value`)).toBe(
+ "ran",
+ )
+ browser.commands.length = 0
+
+ // The parameter shapes models wrote that failed with "script: Missing key".
+ yield* browser.run(`return await tools.browser.evaluate({ tabID: "${tabID}", expression: "document.title" })`)
+ yield* browser.run(`return await tools.browser.evaluate({ tabID: "${tabID}", code: "document.title" })`)
+ yield* browser.run(`return await tools.browser.evaluate({ tabID: "${tabID}", script: "return document.title" })`)
+ yield* browser.run(`return await tools.browser.evaluate({ tabID: "${tabID}", script: "await fetch('/x')" })`)
+ expect(browser.commands).toEqual([
+ { type: "evaluate", tabID, script: "document.title" },
+ { type: "evaluate", tabID, script: "document.title" },
+ { type: "evaluate", tabID, script: "(async () => {\nreturn document.title\n})()" },
+ { type: "evaluate", tabID, script: "(async () => (\nawait fetch('/x')\n))()" },
+ ])
+ }),
+)
+
+const failure = (message: string, code = "operation_failed"): typeof Browser.Outcome.Encoded => ({
+ type: "failure",
+ code,
+ message,
+})
+const waited = (code: string) => `return await tools.browser.wait({ tabID: "${tabID}", ${code} })`
+
+it.live("wait infers its condition and reports an unmet one as met: false", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup((action) =>
+ action.type === "wait" && action.text === "Never"
+ ? // What the desktop sends when its wait times out: the server reads the code, not the words.
+ failure("browser.wait failed. The text never appeared.", Browser.FailureCode.unmet)
+ : action.type === "wait" && action.text === "Broken"
+ ? // Before, the server read "Condition was not met within N ms" in any message as a timeout.
+ failure(
+ "browser.wait failed. Frame context is unavailable. Details: Condition was not met within 10000 ms.",
+ )
+ : success(tab),
+ )
+ // The most common failing shape: text with timeout, no condition.
+ expect(JSON.parse(yield* browser.run(waited(`text: "Done", timeout: 1000`)))).toMatchObject({
+ ...tab,
+ met: true,
+ waited: "text",
+ })
+ expect(JSON.parse(yield* browser.run(waited(`text: "Never", timeout: 60000`)))).toMatchObject({
+ ...tab,
+ met: false,
+ waited: "text",
+ observed: 'Text "Never" did not appear within 30000 ms.',
+ })
+ expect(JSON.parse(yield* browser.run(waited(`text: "Spinner", state: "hidden"`)))).toMatchObject({
+ met: true,
+ waited: "textGone",
+ })
+ expect(JSON.parse(yield* browser.run(waited(`state: "load"`)))).toMatchObject({ met: true, waited: "load" })
+ expect(browser.commands).toEqual([
+ { type: "wait", tabID, condition: "text", text: "Done", timeoutMs: 1000 },
+ { type: "wait", tabID, condition: "text", text: "Never", timeoutMs: 30000 },
+ { type: "wait", tabID, condition: "textGone", text: "Spinner", timeoutMs: 10000 },
+ { type: "wait", tabID, condition: "load", timeoutMs: 10000 },
+ ])
+ // Other failures still fail.
+ expect(
+ yield* browser.run(
+ `return await tools.browser.wait({ tabID: "${tabID}", text: "Broken" }).then(() => "resolved", (error) => error.message)`,
+ ),
+ ).toContain("Frame context is unavailable")
+ // Keys no condition maps to fail with the valid ones.
+ expect(
+ yield* browser.run(
+ `return await tools.browser.wait({ tabID: "${tabID}", loading: true }).catch((error) => error.message)`,
+ ),
+ ).toContain(
+ "loading: Not a parameter of browser.wait. Valid parameters: tabID, frameID, condition, text, textGone, selector, ref, state, url, delayMs, time, ms, timeoutMs, timeout.",
+ )
+ }),
+)
+
+it.live("wait pauses, and polls for an element or an address", () =>
+ Effect.gen(function* () {
+ const seen = { checks: 0 }
+ const browser = yield* setup((action) => {
+ if (action.type === "wait" && action.condition === "url" && action.url === "**/done")
+ return failure("Unmet URL wait", Browser.FailureCode.unmet)
+ if (action.type !== "evaluate") return success(tab)
+ seen.checks++
+ return evaluated(seen.checks < 2 ? { count: 0, visible: 0 } : { count: 1, visible: 1 })
+ })
+ expect(JSON.parse(yield* browser.run(waited(`delayMs: 20`)))).toMatchObject({ ...tab, met: true, waited: "delay" })
+ expect(JSON.parse(yield* browser.run(waited(`time: 0.02`)))).toMatchObject({ met: true, waited: "delay" })
+ // A lone timeout is a pause for that long, not a load wait that returns at once on a loaded page.
+ expect(JSON.parse(yield* browser.run(waited(`timeout: 50`)))).toMatchObject({ met: true, waited: "delay" })
+ expect(browser.commands).toEqual([20,20,50].map(timeoutMs => ({type:"wait",tabID,condition:"delay",timeoutMs})))
+ browser.commands.length = 0
+ expect(JSON.parse(yield* browser.run(`return await tools.browser.wait({ tabID: "${tabID}" })`))).toMatchObject({
+ met: true,
+ waited: "load",
+ })
+ expect(browser.commands).toEqual([{ type: "wait", tabID, condition: "load", timeoutMs: 10000 }])
+ browser.commands.length = 0
+
+ expect(JSON.parse(yield* browser.run(waited(`selector: "#ready", timeout: 5000`)))).toMatchObject({
+ met: true,
+ waited: "element",
+ })
+ expect(browser.commands).toHaveLength(2)
+ expect(browser.commands[0]).toMatchObject({ type: "evaluate", tabID })
+ expect(JSON.parse(yield* browser.run(waited(`selector: "#ready", state: "hidden", timeout: 150`)))).toMatchObject({
+ met: false,
+ observed: '1 element(s) matched "#ready", 1 visible, after 150 ms.',
+ })
+
+ expect(JSON.parse(yield* browser.run(waited(`url: "example.test"`)))).toMatchObject({ met: true })
+ expect(JSON.parse(yield* browser.run(waited(`url: "**/done", timeout: 150`)))).toMatchObject({
+ met: false,
+ observed: "The address was https://example.test/ after 150 ms.",
+ })
+ }),
+)
+
+it.live("an element wait reads the desktop's codes, and ends on time when the page does not answer", () =>
+ Effect.gen(function* () {
+ const seen = { checks: 0 }
+ const browser = yield* setup((action) => {
+ if (action.type !== "evaluate") return success(tab)
+ if (action.ref) return failure("Element ref is stale.", Browser.FailureCode.staleRef)
+ if (action.script.includes("#busy")) return undefined
+ seen.checks++
+ return seen.checks === 1
+ ? failure("The document changed before this operation ran.", Browser.FailureCode.documentChanged)
+ : evaluated({ count: 1, visible: 1 })
+ })
+ // A navigation between checks is not an answer: the wait checks again.
+ expect(JSON.parse(yield* browser.run(waited(`selector: "#ready", timeout: 5000`)))).toMatchObject({ met: true })
+ expect(seen.checks).toBe(2)
+ // A ref whose element left the page is gone.
+ expect(JSON.parse(yield* browser.run(waited(`ref: "e1", state: "hidden"`)))).toMatchObject({
+ met: true,
+ waited: "elementGone",
+ })
+ // A page stuck in a long task answers no probe; the wait ends at its timeout instead of the request's 60 s.
+ expect(JSON.parse(yield* browser.run(waited(`selector: "#busy", timeout: 300`)))).toMatchObject({
+ met: false,
+ observed: "The page was still navigating, or too busy to answer, after 300 ms.",
+ })
+ // The unanswered probe is cancelled on the desktop.
+ yield* Effect.suspend(() => (browser.cancelled.length ? Effect.void : Effect.fail("not cancelled yet"))).pipe(
+ Effect.retry(Schedule.spaced("10 millis")),
+ Effect.timeout("5 seconds"),
+ )
+ }),
+)
+
+it.live("a workspace file opens through tabs.open and navigate, by path or by the address tabs.list shows", () =>
+ Effect.gen(function* () {
+ const url = "workspace://ses_fixture/page.html"
+ const shown = { ...tab, url }
+ const browser = yield* setup((action) => {
+ if (action.type === "preview" && action.path === "page.html") return success({ path: action.path, tabID, url, tab: shown })
+ // A desktop from before the path forms returns the tab's ID and address only, or no tab at all.
+ if (action.type === "preview" && action.path === "state.html") return success({ path: action.path, tabID, url })
+ if (action.type === "preview" && action.path === "gone.html") return failure("browser.preview failed. The workspace file could not be loaded.", "preview_unavailable")
+ if (action.type === "preview") return success({ path: action.path })
+ if (action.type === "navigate.path" && action.path === "second.html") return success({ path: action.path, tabID: action.tabID, url, tab: shown })
+ // What a desktop answers to an action it cannot decode.
+ if (action.type === "navigate.path") return failure("This desktop cannot decode the requested browser operation. Check the desktop and server versions.", "unsupported")
+ return success(tab)
+ }, { linked: true })
+ yield* Effect.promise(() => Promise.all(["page.html", "state.html", "gone.html", "older.html", "second.html", "old.html"].map(path => Bun.write(join(browser.directory, path), ""))))
+ yield* Effect.promise(() => Bun.write(join(browser.directory, "chart.svg"), ""))
+ const open = (input: object) => browser.run(`return await tools.browser.tabs.open(${JSON.stringify(input)}).catch(error => error.message)`)
+ const move = (input: object) => browser.run(`return await tools.browser.navigate(${JSON.stringify({ tabID, ...input })}).catch(error => error.message)`)
+
+ // The result is the tab, as for a web address, with the file it shows. The path is the entry that was checked.
+ expect(JSON.parse(yield* open({ path: "page.html#L2" }))).toEqual({ ...shown, path: "page.html" })
+ for (const address of [pathToFileURL(join(browser.directory, "page.html")).href, `workspace://${browser.session.id.toLowerCase()}/page.html`]) {
+ expect(JSON.parse(yield* open({ url: address }))).toEqual({ ...shown, path: "page.html" })
+ expect(JSON.parse(yield* open({ path: address }))).toEqual({ ...shown, path: "page.html" })
+ }
+ expect(JSON.parse(yield* open({ path: "state.html" }))).toEqual({ ...tab, path: "state.html" })
+ expect(yield* open({ path: "older.html" })).toContain("did not return its tab")
+ // The desktop names the action it received; the agent reads the name of the tool it called.
+ expect(yield* open({ path: "gone.html" })).toContain("[browser.preview_unavailable] browser.tabs.open failed. The workspace file could not be loaded.")
+ expect(browser.commands.map((command) => ("path" in command ? `${command.type} ${command.path}` : command.type))).toEqual([...Array.from({ length: 5 }, () => "preview page.html"), "preview state.html", "preview older.html", "preview gone.html"])
+ browser.commands.length = 0
+
+ expect(JSON.parse(yield* move({ path: "second.html" }))).toEqual({ ...shown, path: "second.html" })
+ expect(JSON.parse(yield* move({ url: pathToFileURL(join(browser.directory, "second.html")).href }))).toEqual({ ...shown, path: "second.html" })
+ expect(yield* move({ path: "old.html" })).toBe("[browser.unsupported] This desktop is older than the server and cannot move a tab to a workspace file. Update the desktop app, or call browser.tabs.open({ path }) to open the file in its own tab.")
+ expect(browser.commands).toEqual([{ type: "navigate.path", tabID, path: "second.html" }, { type: "navigate.path", tabID, path: "second.html" }, { type: "navigate.path", tabID, path: "old.html" }])
+ browser.commands.length = 0
+
+ // A file that is not HTML has no tab: tabs.open sends it to the file panel, and navigate has no tab to move to it.
+ expect(JSON.parse(yield* open({ path: "chart.svg" }))).toEqual({ path: "chart.svg", shown: "file" })
+ expect(yield* move({ path: "chart.svg" })).toBe("browser.navigate moves a tab to an HTML file, and chart.svg is not one. Call browser.tabs.open({ path }) to show it in the file panel.")
+ expect(browser.commands).toEqual([{ type: "preview", path: "chart.svg" }])
+
+ // No tool has the old name. The call fails with what to call instead, not with a guessed tool.
+ expect(yield* browser.run(`return await tools.browser.preview({ path: "page.html" }).catch(error => error.message)`)).toBe(
+ "browser.preview was removed: call browser.tabs.open({ path }) to show a workspace file, or browser.navigate({ tabID, path }) to move a tab to one.",
+ )
+ expect(yield* browser.run(`return search({ query: "preview", namespace: "browser" }).items.map(item => item.path)`)).not.toContain("tools.browser.preview")
+ }),
+)
+
+it.live("both path forms refuse what is not a file inside the workspace, before the desktop hears of it", () =>
+ Effect.gen(function* () {
+ const browser = yield* setup(() => success(tab))
+ const outside = join(browser.directory, "..", `outside-${crypto.randomUUID()}`)
+ yield* Effect.promise(async () => {
+ await mkdir(join(browser.directory, "site"), { recursive: true })
+ await mkdir(outside, { recursive: true })
+ await Bun.write(join(outside, "secret.html"), "")
+ await symlink(outside, join(browser.directory, "escape"), process.platform === "win32" ? "junction" : "dir")
+ })
+ yield* Effect.addFinalizer(() => Effect.promise(() => rm(outside, { recursive: true, force: true })))
+ const beyond = "cannot show a file outside this session's workspace. Choose a file inside the workspace."
+ const refusals: ReadonlyArray string]> = [
+ ["a missing file", { path: "missing.html" }, (call) => `${call} found no file at ${join(browser.directory, "missing.html")}.`],
+ ["a folder", { path: "site" }, (call) => `${join(browser.directory, "site")} is a folder. ${call} shows one file`],
+ ["a parent folder", { path: "../secret.html" }, (call) => `${call} ${beyond}`],
+ ["an absolute path elsewhere", { path: join(outside, "secret.html") }, (call) => `${call} ${beyond}`],
+ ["a link that leaves the workspace", { path: "escape/secret.html" }, (call) => `${call} ${beyond}`],
+ ["a file: address elsewhere, as path", { path: pathToFileURL(join(outside, "secret.html")).href }, (call) => `${call} ${beyond}`],
+ ["a file: address elsewhere, as url", { url: pathToFileURL(join(outside, "secret.html")).href }, (call) => `${call} ${beyond}`],
+ ["a file: address on another host", { url: "file://fileserver/share/page.html" }, (call) => `${call} ${beyond}`],
+ ["another session's workspace address", { url: "workspace://ses_another/page.html" }, (call) => `${call} ${beyond}`],
+ ["a workspace address with an encoded separator", { path: `workspace://${browser.session.id.toLowerCase()}/site%2f..%2f..%2fsecret.html` }, (call) => `${call} ${beyond}`],
+ ["a name the server cannot hold", { path: "site/\u0001.html" }, () => "This path is not a valid workspace filename on the server."],
+ ["the internal address of a file's tab", { url: "oc-preview://grant/page.html" }, () => "This is an internal address of a workspace file, which no call can open."],
+ ["a web address as path", { path: "https://example.com/page.html" }, (call) => `${call} needs path to name a workspace file`],
+ ["both parameters", { url: "https://example.com", path: "page.html" }, (call) => `${call} takes url or path, not both.`],
+ ]
+ for (const [name, input, refusal] of refusals) {
+ const opened = yield* browser.run(`return await tools.browser.tabs.open(${JSON.stringify(input)}).then(() => "opened", error => error.message)`)
+ const moved = yield* browser.run(`return await tools.browser.navigate(${JSON.stringify({ tabID, ...input })}).then(() => "moved", error => error.message)`)
+ expect(`${name}: ${opened}`).toContain(`${name}: ${refusal("browser.tabs.open")}`)
+ expect(`${name}: ${moved}`).toContain(`${name}: ${refusal("browser.navigate")}`)
+ }
+ expect(browser.commands).toEqual([])
+ }),
+)
+
+it.live("an unattached inventory stays iterable and actions do not report success", () =>
+ Effect.gen(function* () {
+ const detached = yield* setup(() => success(tab), { attach: false })
+ yield* Effect.promise(() => Bun.write(join(detached.directory, "chart.svg"), ""))
+ expect(JSON.parse(yield* detached.run(`const s = await tools.browser.tabs.list({}); return { ...s, tabs: s.tabs.map(t => t.id) }`))).toMatchObject({ connected: false, tabs: [], focusedTabID: null })
+ expect(yield* detached.run(`try { await tools.browser.click({ tabID: "${tabID}", ref: "e1" }); return "Done" } catch (error) { return error.message }`)).toStartWith("[browser.not_attached]")
+ }),
+)
diff --git a/packages/core/test/mcp.test.ts b/packages/core/test/mcp.test.ts
index 6aee3e77fb98..a92da76daa68 100644
--- a/packages/core/test/mcp.test.ts
+++ b/packages/core/test/mcp.test.ts
@@ -3112,7 +3112,7 @@ it.effect("does not call MCP when permission is blocked", () =>
})
expect(execution.content).toEqual([{ type: "text", text: "Search is disabled in this workspace" }])
expect(execution.metadata).toEqual({
- toolCalls: [{ tool: "demo.search", status: "error" }],
+ toolCalls: [{ tool: "demo.search", status: "error", error: "Search is disabled in this workspace" }],
error: true,
})
expect(
diff --git a/packages/core/test/permission.test.ts b/packages/core/test/permission.test.ts
index 49db52d59172..9cfa86b0382f 100644
--- a/packages/core/test/permission.test.ts
+++ b/packages/core/test/permission.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
-import { Cause, Deferred, Effect, Fiber, Layer, Schema } from "effect"
+import { Cause, Deferred, Effect, Exit, Fiber, Layer, Schema } from "effect"
import { Agent } from "@opencode/core/agent"
import { Database } from "@opencode/core/database/database"
import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder"
@@ -9,6 +9,7 @@ import { Location } from "@opencode/core/location"
import { Permission } from "@opencode/core/permission"
import { PermissionTable } from "@opencode/core/permission/sql"
import { PermissionSaved } from "@opencode/core/permission/saved"
+import { PluginHooks } from "@opencode/core/plugin/hooks"
import { Project } from "@opencode/core/project"
import { ProjectTable } from "@opencode/core/project/sql"
import { AbsolutePath } from "@opencode/core/schema"
@@ -27,7 +28,15 @@ const current = Layer.succeed(
)
const it = testEffect(
AppNodeBuilder.build(
- LayerNode.group([Database.node, Bus.node, SessionStore.node, PermissionSaved.node, Agent.node, Permission.node]),
+ LayerNode.group([
+ Database.node,
+ Bus.node,
+ SessionStore.node,
+ PermissionSaved.node,
+ Agent.node,
+ PluginHooks.node,
+ Permission.node,
+ ]),
[Location.node.replace(current)],
),
)
@@ -166,6 +175,10 @@ describe("Permission", () => {
const service = yield* Permission.Service
expect(yield* service.allows(assertion())).toBe(false)
expect(yield* service.list()).toEqual([])
+ const saved = yield* PermissionSaved.Service
+ yield* saved.add({ projectID: Project.ID.global, action: "read", resources: ["*"] })
+ expect(yield* service.allows(assertion())).toBe(true)
+ expect(yield* service.allows(assertion(), { requireConfiguredAllow: true })).toBe(false)
yield* setRules([{ action: "read", resource: "*", effect: "allow" }])
expect(yield* service.allows(assertion())).toBe(true)
yield* setRules([{ action: "read", resource: "*", effect: "deny" }])
@@ -306,6 +319,33 @@ describe("Permission", () => {
}),
)
+ it.effect("a hook's ask prompts even when a saved approval covers the request, and sees that approval", () =>
+ Effect.gen(function* () {
+ yield* setup()
+ const saved = yield* PermissionSaved.Service
+ yield* saved.add({ projectID: Project.ID.global, action: "bash", resources: ["git push --force"] })
+ const hooks = yield* PluginHooks.Service
+ const approved: (boolean | undefined)[] = []
+ yield* hooks.register("permission", "evaluate", (event) =>
+ Effect.sync(() => {
+ approved.push(event.experimental?.approved)
+ if (event.resources.includes("git push --force")) {
+ event.effect = "ask"
+ event.message = "Force-pushing rewrites shared history."
+ }
+ }),
+ )
+ const { service, request } = yield* waitForRequest({ action: "bash", resources: ["git push --force"] })
+ expect(request.message).toBe("Force-pushing rewrites shared history.")
+ expect(approved).toEqual([true])
+ yield* service.reply({ requestID: request.id, reply: "once" })
+ expect(
+ yield* service.ask(assertion({ id: Permission.ID.create("per_other"), action: "bash", resources: ["pwd"] })),
+ ).toMatchObject({ effect: "ask" })
+ expect(approved).toEqual([true, false])
+ }),
+ )
+
it.effect("resolves an asked permission once", () =>
Effect.gen(function* () {
yield* setup()
@@ -857,3 +897,118 @@ describe("shell scanner permission impact", () => {
)
}
})
+
+describe("Permission experimental.rules", () => {
+ // Writes `value` into `target` and says whether that failed, as a write to a frozen object does.
+ const assign = (target: object, value: object) => Effect.exit(Effect.try(() => Object.assign(target, value)))
+ const rulesFor = Effect.gen(function* () {
+ const store = yield* SessionStore.Service
+ const agents = yield* Agent.Service
+ const session = yield* store.get(Session.ID.make("ses_test"))
+ if (!session) return yield* Effect.die(new Error("no session"))
+ return yield* Permission.rules(yield* PluginHooks.Service, { session, agent: yield* agents.select(session.agent) })
+ })
+
+ it.effect("appends each hook's denies in order, and nothing a hook writes elsewhere", () =>
+ Effect.gen(function* () {
+ const configured: Permission.Ruleset = [
+ { action: "shell", resource: "*", effect: "deny" },
+ { action: "read", resource: "*.env", effect: "ask" },
+ ]
+ yield* setup(configured)
+ const hooks = yield* PluginHooks.Service
+ yield* hooks.register("permission", "experimental.rules", (event) =>
+ Effect.gen(function* () {
+ // Every way a hook could try to allow: push to the rules, edit them in place, swap the arrays, allow in deny.
+ ;(event.rules as Permission.Rule[]).push({ action: "*", resource: "*", effect: "allow" })
+ ;(event.rules as Permission.Rule[]).forEach((rule) => Object.assign(rule, { effect: "allow" }))
+ ;(event.session as Permission.Rule[]).push({ action: "*", resource: "*", effect: "allow" })
+ expect(Exit.isFailure(yield* assign(event, { rules: [], session: [] }))).toBe(true)
+ event.deny({ action: "edit", resource: "*" })
+ event.deny(Object.assign({ action: "webfetch", resource: "*" }, { effect: "allow" }))
+ }),
+ )
+ yield* hooks.register("permission", "experimental.rules", (event) =>
+ Effect.sync(() => event.deny({ action: "shell", resource: "git *" })),
+ )
+ expect(yield* rulesFor).toEqual([
+ ...configured,
+ { action: "edit", resource: "*", effect: "deny" },
+ { action: "webfetch", resource: "*", effect: "deny" },
+ { action: "shell", resource: "git *", effect: "deny" },
+ ])
+ const agents = yield* Agent.Service
+ expect((yield* agents.get(Agent.ID.make("test")))?.permissions).toEqual(configured)
+
+ const service = yield* Permission.Service
+ expect(yield* service.ask(assertion({ action: "shell", resources: ["ls"] }))).toMatchObject({ effect: "deny" })
+ expect(yield* service.ask(assertion({ action: "edit", resources: ["a.ts"] }))).toMatchObject({ effect: "deny" })
+ expect(
+ yield* service.ask(assertion({ id: Permission.ID.create("per_env"), action: "read", resources: [".env"] })),
+ ).toMatchObject({ effect: "ask" })
+ }),
+ )
+
+ it.effect("a later hook cannot remove or replace an earlier hook's deny", () =>
+ Effect.gen(function* () {
+ yield* setup([{ action: "*", resource: "*", effect: "allow" }])
+ const hooks = yield* PluginHooks.Service
+ yield* hooks.register("permission", "experimental.rules", (event) =>
+ Effect.sync(() => event.deny({ action: "edit", resource: "*" })),
+ )
+ const attempts: boolean[] = []
+ yield* hooks.register("permission", "experimental.rules", (event) =>
+ Effect.gen(function* () {
+ // The event is frozen, so the swap fails; the list behind `deny` is core's, so there is nothing to clear.
+ attempts.push(Exit.isFailure(yield* assign(event, { deny: () => {} })))
+ event.deny({ action: "shell", resource: "*" })
+ }),
+ )
+ expect(yield* rulesFor).toEqual([
+ { action: "*", resource: "*", effect: "allow" },
+ { action: "edit", resource: "*", effect: "deny" },
+ { action: "shell", resource: "*", effect: "deny" },
+ ])
+ expect(attempts).toEqual([true])
+ const service = yield* Permission.Service
+ expect(yield* service.ask(assertion({ action: "edit", resources: ["a.ts"] }))).toMatchObject({ effect: "deny" })
+ }),
+ )
+
+ it.effect("a hook's deny refuses the request before any evaluate hook runs", () =>
+ Effect.gen(function* () {
+ yield* setup([{ action: "*", resource: "*", effect: "allow" }])
+ const hooks = yield* PluginHooks.Service
+ const evaluated: string[] = []
+ yield* hooks.register("permission", "evaluate", (event) =>
+ Effect.sync(() => {
+ evaluated.push(event.action)
+ event.effect = "allow"
+ }),
+ )
+ yield* hooks.register("permission", "experimental.rules", (event) =>
+ Effect.sync(() => event.deny({ action: "shell", resource: "*" })),
+ )
+ const service = yield* Permission.Service
+ const error = yield* service.assert(assertion({ action: "shell", resources: ["ls"] })).pipe(Effect.flip)
+ expect(error).toBeInstanceOf(Permission.BlockedError)
+ expect(yield* service.ask(assertion({ action: "read" }))).toMatchObject({ effect: "allow" })
+ expect(evaluated).toEqual(["read"])
+ }),
+ )
+
+ it.effect("a deny that is not two strings fails the check closed and names the hook", () =>
+ Effect.gen(function* () {
+ yield* setup([{ action: "*", resource: "*", effect: "allow" }])
+ const hooks = yield* PluginHooks.Service
+ yield* hooks.register("permission", "experimental.rules", (event) =>
+ Effect.sync(() => event.deny({ action: 1, resource: "*" } as unknown as Parameters[0])),
+ )
+ const service = yield* Permission.Service
+ const exit = yield* service.ask(assertion()).pipe(Effect.exit)
+ expect(exit._tag).toBe("Failure")
+ if (exit._tag === "Failure")
+ expect(Cause.pretty(exit.cause)).toContain('A permission "experimental.rules" hook added an invalid deny')
+ }),
+ )
+})
\ No newline at end of file
diff --git a/packages/core/test/tool-execute.test.ts b/packages/core/test/tool-execute.test.ts
index 05023200b082..6ef33822bc7f 100644
--- a/packages/core/test/tool-execute.test.ts
+++ b/packages/core/test/tool-execute.test.ts
@@ -595,3 +595,29 @@ it.effect("interrupted execute sends its latest progress rows before it settles"
])
}),
)
+
+test("execute records an inner call's error message, also when the program catches it", async () => {
+ const fail = {
+ name: "fail",
+ description: "Fail",
+ input: Schema.Struct({ size: Schema.Number }),
+ output: Schema.String,
+ execute: ({ size }) => Effect.fail(new Tool.Error({ message: `failed: ${"x".repeat(size)}` })),
+ } satisfies Info, typeof Schema.String>
+ const result = await Effect.runPromise(
+ createCodeMode(new Map([["fail", fail]])).execute(
+ {
+ code: 'try { await tools.fail({ size: 3 }) } catch {} ; await tools.fail({ size: 5000 }).catch(() => {}); return "done"',
+ },
+ context,
+ ),
+ )
+ expect(result.output.output).toBe("done")
+ const calls = result.output.toolCalls
+ expect(calls.map((call) => call.status)).toEqual(["error", "error"])
+ expect(calls[0]?.error).toBe("failed: xxx")
+ // Bounded: a long message keeps its start.
+ expect(calls[1]?.error).toStartWith("failed: xxxx")
+ expect(calls[1]?.error?.length).toBe(2_001)
+ expect(result.metadata?.toolCalls).toEqual(calls)
+})
diff --git a/packages/core/test/tool-registry.test.ts b/packages/core/test/tool-registry.test.ts
index 755ad4e7872a..0bf65e67681a 100644
--- a/packages/core/test/tool-registry.test.ts
+++ b/packages/core/test/tool-registry.test.ts
@@ -529,6 +529,28 @@ describe("Tool", () => {
}),
)
+ it.effect("keeps the catalog of each visible tool set while sessions alternate, until the registry changes", () =>
+ Effect.gen(function* () {
+ const service = yield* Tool.Service
+ yield* service.transform((editor) => {
+ editor.add({ ...make(), options: { namespace: "acme" } })
+ editor.add({ ...constant("page"), options: { namespace: "web", permission: "web" } })
+ })
+ const denied: Permission.Ruleset = [{ action: "web", resource: "*", effect: "deny" }]
+ const all = yield* service.snapshot()
+ const narrowed = yield* service.snapshot(denied)
+ expect(codeModeListings(narrowed.codeModeCatalog!).map((tool) => tool.path)).toEqual(["acme.echo"])
+ // Each set's prepared catalog is reused, not rebuilt, when the other set's session ran in between.
+ expect((yield* service.snapshot()).codeModeCatalog).toBe(all.codeModeCatalog!)
+ expect((yield* service.snapshot(denied)).codeModeCatalog).toBe(narrowed.codeModeCatalog!)
+
+ yield* service.transform((editor) => editor.add({ ...constant("other"), options: { namespace: "acme" } }))
+ const changed = yield* service.snapshot()
+ expect(changed.codeModeCatalog).not.toBe(all.codeModeCatalog)
+ expect(codeModeListings(changed.codeModeCatalog!).map((tool) => tool.path)).toContain("acme.constant")
+ }),
+ )
+
it.effect("retains namespace descriptions in executable snapshots after appended transforms", () =>
Effect.gen(function* () {
const service = yield* Tool.Service
diff --git a/packages/desktop/electron-builder.config.test.ts b/packages/desktop/electron-builder.config.test.ts
index 3e29318dcacb..b4e8c3d3a00a 100644
--- a/packages/desktop/electron-builder.config.test.ts
+++ b/packages/desktop/electron-builder.config.test.ts
@@ -1,6 +1,6 @@
import { expect, test } from "bun:test"
import { statSync } from "node:fs"
-import { cp, mkdtemp, rm } from "node:fs/promises"
+import { cp, mkdtemp, realpath, rm } from "node:fs/promises"
import { createRequire } from "node:module"
import os from "node:os"
import path from "node:path"
@@ -8,6 +8,7 @@ import { fileURLToPath, pathToFileURL } from "node:url"
import type { Configuration } from "electron-builder"
import { getConfig } from "./electron-builder.config"
import { CLI_BINARIES, nodePtyPackage } from "./script/utils"
+import { verifyPreviewBinding } from "./script/preview-binding"
// Use electron-builder's matcher so the tests also cover its glob and directory traversal semantics.
const { FileMatcher } = createRequire(import.meta.resolve("electron-builder"))("app-builder-lib/out/fileMatcher")
@@ -80,6 +81,20 @@ test.each(channels)("channel identity for $channel", ({ channel, appId, feed })
expect(config.deb?.fpm).not.toContain("--rpm-rpmbuild-define=_build_id_links none")
})
+test.each([
+ { channel: "dev", inspect: false },
+ { channel: "beta", inspect: true },
+ { channel: "prod", inspect: false },
+])("Electron fuses for $channel", ({ channel, inspect }) => {
+ // Absent keys keep Electron's defaults: NODE_OPTIONS stays on, the asar and file: fuses stay as they are.
+ expect(load(channel).electronFuses).toEqual({
+ enableCookieEncryption: true,
+ runAsNode: false,
+ enableNodeCliInspectArguments: inspect,
+ resetAdHocDarwinSignature: true,
+ })
+})
+
test("legacy Linux launcher stays hidden", async () => {
const desktop = await Bun.file(path.join(import.meta.dirname, "resources/linux/opencode-desktop.desktop")).text()
expect(desktop).toContain("Exec=/opt/OpenCode/ai.opencode %U")
@@ -97,6 +112,7 @@ test.each(channels)("macOS bundle for $channel", ({ channel }) => {
for (const key of [
"NSMicrophoneUsageDescription",
+ "NSCameraUsageDescription",
"NSDocumentsFolderUsageDescription",
"NSDesktopFolderUsageDescription",
"NSDownloadsFolderUsageDescription",
@@ -197,6 +213,36 @@ test("trims external dependencies without excluding runtime files", () => {
}
})
+test.each([
+ ["darwin", "arm64", "darwin-arm64"], ["darwin", "x64", "darwin-x64"],
+ ["win32", "arm64", "win32-arm64-msvc"], ["win32", "x64", "win32-x64-msvc"],
+ ["linux", "arm64", "linux-arm64-gnu"], ["linux", "x64", "linux-x64-gnu"],
+] as const)("packaging %s/%s requires its unpacked preview addon", async (platform, arch, binding) => {
+ const resources = await realpath(await mkdtemp(path.join(os.tmpdir(), "preview-pack-")))
+ const modules = path.join(resources, "app.asar.unpacked/node_modules")
+ const pkg = path.join(modules, `@yuuang/ffi-rs-${binding}`)
+ const addon = `ffi-rs.${binding}.node`
+
+ try {
+ await Bun.write(path.join(modules, "ffi-rs/package.json"), JSON.stringify({ main: "index.js" }))
+ await Bun.write(path.join(modules, "ffi-rs/index.js"), "module.exports = {}")
+ await Bun.write(path.join(pkg, "package.json"), JSON.stringify({ main: addon }))
+
+ if (platform === process.platform && arch === process.arch) {
+ const source = createRequire(import.meta.resolve("ffi-rs")).resolve(`@yuuang/ffi-rs-${binding}`)
+ await cp(source, path.join(pkg, addon))
+ await verifyPreviewBinding(resources, platform, arch)
+ await rm(path.join(pkg, addon))
+ }
+
+ await expect(verifyPreviewBinding(resources, platform, arch)).rejects.toThrow(addon)
+ await Bun.write(path.join(pkg, addon), "not a native library")
+ await expect(verifyPreviewBinding(resources, platform, arch)).rejects.toThrow(addon)
+ } finally {
+ await rm(resources, { recursive: true, force: true })
+ }
+})
+
test("the trimmed Zip.js package can still export compressed logs", async () => {
const config = load("dev")
const dir = await mkdtemp(path.join(os.tmpdir(), "opencode-zip-package-"))
diff --git a/packages/desktop/electron-builder.config.ts b/packages/desktop/electron-builder.config.ts
index d147662ffd34..d4697d917dcd 100644
--- a/packages/desktop/electron-builder.config.ts
+++ b/packages/desktop/electron-builder.config.ts
@@ -6,6 +6,7 @@ import { Arch, type Configuration } from "electron-builder"
import { NativeArch } from "../../script/native-arch"
import { DESKTOP_NATIVE_ENGLISH } from "@opencode/app/i18n/desktop-native"
import { CLI_BINARIES, getCurrentCli, nodePtyPackage } from "./script/utils"
+import { previewBinding, verifyPreviewBinding } from "./script/preview-binding"
const packageDir = path.dirname(fileURLToPath(import.meta.url))
@@ -61,6 +62,7 @@ function linuxExecutableName(appId: string): string {
const getBase = (appId: string): Configuration => {
const target = getCurrentCli()
+ const binding = previewBinding(target.os, target.cpu)
const desktopName = `${appId}.desktop`
return {
@@ -82,6 +84,7 @@ const getBase = (appId: string): Configuration => {
"out/**/*",
"resources/**/*",
"!resources/opencode-cli*",
+ `!**/node_modules/@yuuang/ffi-rs-!(${binding}){,/**/*}`,
// Keep only the target platform's node-pty prebuild when cross-packaging with --cpu=*.
...CLI_BINARIES.filter((item) => item.os !== target.os || item.cpu !== target.cpu).map(
(item) => `!**/node_modules/@lydell/node-pty-${item.os}-${item.cpu}{,/**/*}`,
@@ -101,6 +104,7 @@ const getBase = (appId: string): Configuration => {
"!**/node_modules/js-yaml/dist/{js-yaml.js,js-yaml.min.js,*.map}",
"!**/node_modules/js-yaml/bin{,/**/*}",
],
+ asarUnpack: ["**/node_modules/ffi-rs/**/*", `**/node_modules/@yuuang/ffi-rs-${binding}/**/*`],
extraResources: [
{
from: "resources/",
@@ -108,6 +112,23 @@ const getBase = (appId: string): Configuration => {
filter: ["opencode-cli", "opencode-cli.exe", "opencode-cli.version"],
},
],
+ // Electron stores cookies in plain text by default. The browser pane keeps sign-ins, so encrypt them with the OS
+ // key store (Keychain, DPAPI, libsecret or kwallet). This is one-way: turning it off again loses every cookie.
+ // https://www.electronjs.org/docs/latest/tutorial/fuses#cookieencryption
+ // Flipping a fuse breaks the macOS signature. A build without a signing identity is not signed again, so re-sign it
+ // ad hoc or Apple Silicon refuses to launch it. A signed build is signed again after the fuses anyway.
+ electronFuses: {
+ enableCookieEncryption: true,
+ // Started as plain Node (ELECTRON_RUN_AS_NODE) or with an inspector, the signed binary would run any code under
+ // the app's identity, which macOS lets read the app's Keychain key and so every cookie. Nothing runs the app as
+ // Node: the CLI is its own executable. Beta keeps --inspect, as it keeps its on-request debugging port, for the
+ // startup benchmark's Node timings (perf/startup.bench.ts).
+ runAsNode: false,
+ enableNodeCliInspectArguments: resolveChannel() === "beta",
+ // NODE_OPTIONS stays: a packaged app already ignores every option but --http-parser and --max-http-header-size,
+ // and turning the fuse off would also strip NODE_EXTRA_CA_CERTS from the environment the CLI and its terminals get.
+ resetAdHocDarwinSignature: true,
+ },
afterPack: async (context) => {
const arch = Arch[context.arch]
@@ -116,6 +137,7 @@ const getBase = (appId: string): Configuration => {
if (arch !== target.cpu) throw new Error(`Packaging ${arch} Electron with the ${target.target} CLI`)
const resources = context.packager.getResourcesDir(context.appOutDir)
+ await verifyPreviewBinding(resources, context.electronPlatformName, arch)
const cli = path.join(resources, context.electronPlatformName === "win32" ? "opencode-cli.exe" : "opencode-cli")
const file = await stat(cli)
@@ -161,6 +183,8 @@ const getBase = (appId: string): Configuration => {
icon: `resources/icons/icon.icns`,
extendInfo: {
NSMicrophoneUsageDescription: DESKTOP_NATIVE_ENGLISH["desktop.microphoneUsage"],
+ // Sites in the browser pane may ask for the camera; without this key macOS ends the app when it asks.
+ NSCameraUsageDescription: DESKTOP_NATIVE_ENGLISH["desktop.cameraUsage"],
// The CLI server and its terminals run as children of the app, so macOS asks for their access to
// these protected locations in the app's name. The prompt shows the description (#56479).
NSDocumentsFolderUsageDescription: DESKTOP_NATIVE_ENGLISH["desktop.documentsFolderUsage"],
diff --git a/packages/desktop/package.json b/packages/desktop/package.json
index 57c342590155..d7b059a57778 100644
--- a/packages/desktop/package.json
+++ b/packages/desktop/package.json
@@ -25,6 +25,7 @@
"electron-context-menu": "5.0.0",
"electron-log": "^5",
"electron-updater": "6.8.9",
+ "ffi-rs": "1.3.7",
"lighthouse": "13.4.1"
},
"devDependencies": {
diff --git a/packages/desktop/script/preview-binding.ts b/packages/desktop/script/preview-binding.ts
new file mode 100644
index 000000000000..939fb8d69f4c
--- /dev/null
+++ b/packages/desktop/script/preview-binding.ts
@@ -0,0 +1,32 @@
+import { realpath } from "node:fs/promises"
+import { createRequire } from "node:module"
+import path from "node:path"
+import { NativeArch } from "../../../script/native-arch"
+
+export function previewBinding(platform: string, arch: string) {
+ if (platform === "win32") return `win32-${arch}-msvc`
+
+ if (platform === "linux") return `linux-${arch}-gnu`
+
+ return `${platform}-${arch}`
+}
+
+/** Resolve without executing: a pack host may be building for another OS or CPU. */
+export async function verifyPreviewBinding(resources: string, platform: string, arch: "arm64" | "x64") {
+ const target = previewBinding(platform, arch)
+ const unpacked = path.join(await realpath(resources), "app.asar.unpacked")
+ const modules = path.join(unpacked, "node_modules")
+ const pkg = `@yuuang/ffi-rs-${target}`
+ const expected = path.join(modules, pkg, `ffi-rs.${target}.node`)
+
+ try {
+ const main = createRequire(path.join(unpacked, "out/main/index.js"))
+ const wrapper = main.resolve("ffi-rs")
+
+ if (wrapper !== path.join(modules, "ffi-rs/index.js") || createRequire(wrapper).resolve(pkg) !== expected)
+ throw new Error(`Expected the packaged ffi-rs loader to resolve ${expected}`)
+ await NativeArch.verify(expected, arch)
+ } catch (cause) {
+ throw new Error(`Invalid unpacked preview binding for ${target}: ${expected} (${cause instanceof Error ? cause.message : cause})`, { cause })
+ }
+}
diff --git a/packages/desktop/src/main/diagnostics/options.test.ts b/packages/desktop/src/main/diagnostics/options.test.ts
index fc4205b0c81f..74dafd9c0d43 100644
--- a/packages/desktop/src/main/diagnostics/options.test.ts
+++ b/packages/desktop/src/main/diagnostics/options.test.ts
@@ -1,5 +1,5 @@
import { expect, test } from "bun:test"
-import { remoteDebuggingPort } from "./options"
+import { debuggingSwitches, remoteDebuggingPort } from "./options"
const builds = {
dev: { packaged: false, channel: "dev" },
@@ -8,6 +8,12 @@ const builds = {
packagedDev: { packaged: true, channel: "dev" },
}
+test.each([
+ ["dev", "9222", true], ["beta", "0", true], ["packagedDev", undefined, false], ["stable", undefined, false],
+] as const)("%s applies its policy to explicit Chromium launch switches too", (build, port, pipe) => {
+ expect(debuggingSwitches(builds[build], undefined, "0", true)).toEqual({ port, pipe })
+})
+
test.each([
["dev", undefined, "9222"],
["dev", "9333", "9333"],
diff --git a/packages/desktop/src/main/diagnostics/options.ts b/packages/desktop/src/main/diagnostics/options.ts
index 053242bc578b..c6fe85f4a694 100644
--- a/packages/desktop/src/main/diagnostics/options.ts
+++ b/packages/desktop/src/main/diagnostics/options.ts
@@ -1,5 +1,11 @@
import { debugBuild } from "@opencode/gui-plugins/debug/options"
+export function debuggingSwitches(build: { packaged: boolean; channel: string }, env: string | undefined, port: string | undefined, pipe: boolean) {
+ if (!debugBuild(build)) return { port: undefined, pipe: false }
+
+ return { port: remoteDebuggingPort(build, env) ?? port, pipe }
+}
+
/**
* The remote debugging port, only in debug builds. The dev server opens 9222 unless told otherwise; Beta opens one only
* when `OPENCODE_DESKTOP_REMOTE_DEBUGGING_PORT` names it. `0` lets Chromium pick a free port.
diff --git a/packages/desktop/src/main/files/external-url.test.ts b/packages/desktop/src/main/files/external-url.test.ts
index 2a488d977d36..1b515ee4875e 100644
--- a/packages/desktop/src/main/files/external-url.test.ts
+++ b/packages/desktop/src/main/files/external-url.test.ts
@@ -1,7 +1,5 @@
import { describe, expect, test } from "bun:test"
-import { resolve } from "node:path"
-import { pathToFileURL } from "node:url"
-import { resolveExternalURL, resolveLocalFilePath } from "./external-url"
+import { resolveExternalURL } from "./external-url"
describe("external URLs", () => {
test("opens only web and mail URLs externally", () => {
@@ -13,10 +11,4 @@ describe("external URLs", () => {
expect(resolveExternalURL(url)).toBeUndefined()
})
- test("resolves only local file URLs", () => {
- const path = resolve("example.html")
- expect(resolveLocalFilePath(pathToFileURL(path).href)).toBe(path)
- expect(resolveLocalFilePath("file://example.com/share/index.html")).toBeUndefined()
- expect(resolveLocalFilePath("https://example.com/index.html")).toBeUndefined()
- })
})
diff --git a/packages/desktop/src/main/files/external-url.ts b/packages/desktop/src/main/files/external-url.ts
index f94c7e5af665..b5b6fb63172c 100644
--- a/packages/desktop/src/main/files/external-url.ts
+++ b/packages/desktop/src/main/files/external-url.ts
@@ -1,5 +1,3 @@
-import { fileURLToPath } from "node:url"
-
export function resolveExternalURL(value: string) {
if (!URL.canParse(value)) return undefined
const url = new URL(value)
@@ -8,16 +6,3 @@ export function resolveExternalURL(value: string) {
return undefined
}
-
-export function resolveLocalFilePath(value: string) {
- if (!URL.canParse(value)) return undefined
- const url = new URL(value)
-
- if (url.protocol !== "file:" || url.hostname) return undefined
-
- try {
- return fileURLToPath(url)
- } catch {
- return undefined
- }
-}
diff --git a/packages/desktop/src/main/files/index.ts b/packages/desktop/src/main/files/index.ts
index 8e07c6278869..108e71a530f0 100644
--- a/packages/desktop/src/main/files/index.ts
+++ b/packages/desktop/src/main/files/index.ts
@@ -1,13 +1,14 @@
export * as DesktopFiles from "./index"
import { execFile, spawn } from "node:child_process"
-import { clipboard, dialog, nativeImage, shell, webContents } from "electron"
+import { app, clipboard, dialog, nativeImage, shell, webContents } from "electron"
import { Context, Effect, FileSystem, Layer, Path } from "effect"
import type { DirectoryPickerOptions, FilePickerOptions, SaveFilePickerOptions } from "../../shared/ipc-contract"
import { scoped } from "../native/logging"
import { nativeT } from "../native/translations"
import { assertAttachmentBudget, createPickedFileAuthorizations, readAttachment } from "./attachment-picker"
-import { resolveExternalURL, resolveLocalFilePath } from "./external-url"
+import { resolveExternalURL } from "./external-url"
+import { pickerStarts } from "./picker-start"
export type Interface = ReturnType
@@ -59,13 +60,24 @@ function make(
path: Path.Path,
pickedFiles: ReturnType,
) {
+ // The first start that exists; none when even home is gone, which leaves the system to choose.
+ const start = Effect.fnUntraced(function* (requested: string | undefined, save = false) {
+ for (const candidate of pickerStarts(requested, app.getPath("home"), save)) {
+ if (yield* fs.exists(candidate.check).pipe(Effect.orElseSucceed(() => false))) return candidate.use
+ }
+
+ return undefined
+ })
+
return {
openDirectoryPicker: Effect.fn("DesktopFiles.openDirectoryPicker")(function* (options?: DirectoryPickerOptions) {
+ const defaultPath = yield* start(options?.defaultPath)
+
const result = yield* Effect.promise(() =>
dialog.showOpenDialog({
properties: ["openDirectory", ...(options?.multiple ? ["multiSelections" as const] : []), "createDirectory"],
title: options?.title ?? nativeT("desktop.dialog.chooseFolder"),
- defaultPath: options?.defaultPath,
+ defaultPath,
}),
)
@@ -79,11 +91,13 @@ function make(
if (picker === undefined) return null
return yield* Effect.gen(function* () {
+ const defaultPath = yield* start(options?.defaultPath)
+
const result = yield* Effect.promise(() =>
dialog.showOpenDialog({
properties: ["openFile", ...(options?.multiple ? ["multiSelections" as const] : [])],
title: options?.title ?? nativeT("desktop.dialog.chooseFile"),
- defaultPath: options?.defaultPath,
+ defaultPath,
filters: pickerFilters(options?.extensions),
}),
)
@@ -109,10 +123,12 @@ function make(
readPickedFile: pickedFiles.read,
releasePickedFiles: pickedFiles.release,
saveFile: Effect.fn("DesktopFiles.saveFile")(function* (options: SaveFilePickerOptions, content: string) {
+ const defaultPath = yield* start(options?.defaultPath, true)
+
const result = yield* Effect.promise(() =>
dialog.showSaveDialog({
title: options?.title ?? nativeT("desktop.dialog.saveFile"),
- defaultPath: options?.defaultPath,
+ defaultPath,
}),
)
@@ -217,20 +233,6 @@ export const openExternalURL = Effect.fn("DesktopFiles.openExternalURL")(functio
)
})
-export const openLocalFileURL = Effect.fn("DesktopFiles.openLocalFileURL")(function* (value: string) {
- const path = resolveLocalFilePath(value)
-
- if (!path) {
- yield* scoped("window", Effect.logWarning("blocked local file target", { url: value }))
-
- return
- }
-
- const error = yield* Effect.promise(() => shell.openPath(path))
-
- if (error) yield* scoped("window", Effect.logError("failed to open local file", { path, error }))
-})
-
function pickerFilters(extensions?: string[]) {
if (!extensions?.length) return undefined
diff --git a/packages/desktop/src/main/files/picker-start.test.ts b/packages/desktop/src/main/files/picker-start.test.ts
new file mode 100644
index 000000000000..2872f073e7ef
--- /dev/null
+++ b/packages/desktop/src/main/files/picker-start.test.ts
@@ -0,0 +1,48 @@
+import { expect, test } from "bun:test"
+import path from "node:path"
+import { pickerStarts } from "./picker-start"
+
+const home = path.resolve("home", "me")
+
+const project = path.resolve("work", "project")
+
+test.each([
+ {
+ name: "no request opens at home, never the system's default",
+ requested: undefined,
+ save: false,
+ starts: [{ check: home, use: home }],
+ },
+ {
+ name: "a blank request is no folder",
+ requested: " ",
+ save: false,
+ starts: [{ check: home, use: home }],
+ },
+ {
+ name: "a relative request is no folder",
+ requested: path.join("relative", "folder"),
+ save: false,
+ starts: [{ check: home, use: home }],
+ },
+ {
+ name: "an explicit folder is tried first, then home",
+ requested: project,
+ save: false,
+ starts: [
+ { check: project, use: project },
+ { check: home, use: home },
+ ],
+ },
+ {
+ name: "a save picker checks the suggested file's folder and keeps its name at home",
+ requested: path.join(project, "notes.txt"),
+ save: true,
+ starts: [
+ { check: project, use: path.join(project, "notes.txt") },
+ { check: home, use: path.join(home, "notes.txt") },
+ ],
+ },
+])("$name", ({ requested, save, starts }) => {
+ expect(pickerStarts(requested, home, save)).toEqual(starts)
+})
diff --git a/packages/desktop/src/main/files/picker-start.ts b/packages/desktop/src/main/files/picker-start.ts
new file mode 100644
index 000000000000..fb3e8364f434
--- /dev/null
+++ b/packages/desktop/src/main/files/picker-start.ts
@@ -0,0 +1,16 @@
+import path from "node:path"
+
+/**
+ * Where a native picker may open, best first: `check` must exist for `use` to be passed as its default path. Without
+ * one, Windows opens at the Desktop, and shows "Location is not available" before the picker when that folder is
+ * missing or redirected away; a folder that exists always opens cleanly. A save picker keeps the suggested file name
+ * in whichever folder it opens. A relative request names no folder and is ignored.
+ */
+export function pickerStarts(requested: string | undefined, home: string, save: boolean) {
+ const named = requested?.trim() && path.isAbsolute(requested) ? requested : undefined
+
+ return [
+ ...(named ? [{ check: save ? path.dirname(named) : named, use: named }] : []),
+ { check: home, use: save && named ? path.join(home, path.basename(named)) : home },
+ ]
+}
diff --git a/packages/desktop/src/main/ipc-handlers/files.ts b/packages/desktop/src/main/ipc-handlers/files.ts
index b576c5b70414..7b0840b324bd 100644
--- a/packages/desktop/src/main/ipc-handlers/files.ts
+++ b/packages/desktop/src/main/ipc-handlers/files.ts
@@ -1,6 +1,6 @@
import { Effect } from "effect"
import { FileRpcs } from "../../shared/ipc-rpc"
-import { DesktopFiles, openExternalURL, openLocalFileURL } from "../files"
+import { DesktopFiles, openExternalURL } from "../files"
import { IpcPortHandoff } from "../ipc-transport"
import { sender } from "./context"
@@ -27,7 +27,6 @@ export const fileHandlers = FileRpcs.toLayer(
FilesSaveFile: ({ options, content }) => files.saveFile(options, content).pipe(Effect.orDie),
FilesOpenExternal: ({ url }) => openExternalURL(url).pipe(Effect.asVoid),
FilesOpenBrowser: ({ url }) => (/^https?:/i.test(url) ? openExternalURL(url) : Effect.succeed(false)),
- FilesOpenLocalFile: ({ url }) => openLocalFileURL(url),
FilesOpenPath: ({ path, application }) =>
files.openPath(path, application).pipe(
Effect.map((result) => result ?? null),
diff --git a/packages/desktop/src/main/ipc-transport.test.ts b/packages/desktop/src/main/ipc-transport.test.ts
index 8854a9475a90..4874d055c54b 100644
--- a/packages/desktop/src/main/ipc-transport.test.ts
+++ b/packages/desktop/src/main/ipc-transport.test.ts
@@ -125,15 +125,15 @@ describe("desktop RPC transport", () => {
const handoff = await runtime.runPromise(IpcPortHandoff)
const win = sender(1)
// A window that has not asked for its snapshot has no document to hold events for.
- expect(emitIpcEvent(win, new MenuCommandTriggered({ id: "early" }))).toBe(false)
+ expect(emitIpcEvent(win, new MenuCommandTriggered({ id: "early", accelerator: false }))).toBe(false)
handoff.prepare(win)
// On dev these were dropped: the window had no event queue until its port bound.
- expect(emitIpcEvent(win, new MenuCommandTriggered({ id: "a" }))).toBe(true)
- expect(emitIpcEvent(win, new MenuCommandTriggered({ id: "b" }))).toBe(true)
+ expect(emitIpcEvent(win, new MenuCommandTriggered({ id: "a", accelerator: false }))).toBe(true)
+ expect(emitIpcEvent(win, new MenuCommandTriggered({ id: "b", accelerator: false }))).toBe(true)
const channel = new MessageChannel()
handoff.bind(win, serverPort(channel.port1))
- emitIpcEvent(win, new MenuCommandTriggered({ id: "c" }))
+ emitIpcEvent(win, new MenuCommandTriggered({ id: "c", accelerator: false }))
expect(await chunks(channel.port2, 0, "DesktopEvents", 3)).toEqual(["a", "b", "c"].map(menuCommand))
@@ -156,7 +156,7 @@ describe("desktop RPC transport", () => {
// The new document's snapshot: the old one stops receiving events but still answers its RPCs.
handoff.prepare(win)
expect((await firstEvents).chunks).toEqual([])
- emitIpcEvent(win, new MenuCommandTriggered({ id: "during reload" }))
+ emitIpcEvent(win, new MenuCommandTriggered({ id: "during reload", accelerator: false }))
Effect.runSync(Deferred.succeed(flushGate, undefined))
expect((await flush).exit).toEqual(success("flushed"))
@@ -187,7 +187,7 @@ const eventsLive = RpcServer.layer(EventRpcs.merge(FlushRpcs)).pipe(
)
function menuCommand(id: string) {
- return Schema.encodeSync(MenuCommandTriggered)(new MenuCommandTriggered({ id }))
+ return Schema.encodeSync(MenuCommandTriggered)(new MenuCommandTriggered({ id, accelerator: false }))
}
class TestEvent extends Schema.TaggedClass()("TestEvent", { value: Schema.String }) {}
diff --git a/packages/desktop/src/main/ipc.ts b/packages/desktop/src/main/ipc.ts
index 167755b3d38d..9e140bb25fcb 100644
--- a/packages/desktop/src/main/ipc.ts
+++ b/packages/desktop/src/main/ipc.ts
@@ -23,6 +23,7 @@ import { DesktopCli } from "./service/desktop-cli"
import { setStorageSnapshotObserver } from "./storage/snapshot"
import { getLastFocusedWindow } from "./windows"
import { isRendererUrl } from "./windows/scheme"
+import { receivesPluginPort } from "./windows/security"
const services = Layer.mergeAll(DesktopFiles.layer, Plugins.layer)
@@ -68,8 +69,9 @@ export const registerIpcHandlers = Effect.gen(function* () {
win.webContents.send(DragCancelEvent)
})
+ // The check on each call (`caller` in ipc-handlers/plugins.ts) then names the window this document belongs to.
const post = () => {
- if (win.isDestroyed() || win.webContents.isDestroyed()) return
+ if (!receivesPluginPort(win)) return
const channel = new MessageChannelMain()
handoff.bind(win.webContents, channel.port1)
win.webContents.postMessage(IpcTransportPort, null, [channel.port2])
diff --git a/packages/desktop/src/main/lifecycle/configure.ts b/packages/desktop/src/main/lifecycle/configure.ts
index e085780b89c1..23652d243849 100644
--- a/packages/desktop/src/main/lifecycle/configure.ts
+++ b/packages/desktop/src/main/lifecycle/configure.ts
@@ -6,7 +6,7 @@ import path from "node:path"
import { app } from "electron"
import { debugBuild, memoryLogInterval } from "@opencode/gui-plugins/debug/options"
import { APP_ID, APP_NAME, CHANNEL } from "../constants"
-import { remoteDebuggingPort } from "../diagnostics/options"
+import { debuggingSwitches } from "../diagnostics/options"
const testOnboarding = process.env.OPENCODE_TEST_ONBOARDING === "1"
@@ -32,12 +32,19 @@ export function configureApplication() {
if (process.platform === "linux") app.commandLine.appendSwitch("disable-smooth-scrolling")
const build = { packaged: app.isPackaged, channel: CHANNEL }
- const debugPort = remoteDebuggingPort(build, process.env.OPENCODE_DESKTOP_REMOTE_DEBUGGING_PORT)
- if (debugPort) app.commandLine.appendSwitch("remote-debugging-port", debugPort)
+ const debug = debuggingSwitches(build, process.env.OPENCODE_DESKTOP_REMOTE_DEBUGGING_PORT,
+ app.commandLine.hasSwitch("remote-debugging-port") ? app.commandLine.getSwitchValue("remote-debugging-port") : undefined,
+ app.commandLine.hasSwitch("remote-debugging-pipe"))
- if (app.commandLine.hasSwitch("remote-debugging-port"))
+ for (const name of ["remote-debugging-port", "remote-debugging-pipe", "remote-debugging-address"]) app.commandLine.removeSwitch(name)
+
+ if (debug.pipe) app.commandLine.appendSwitch("remote-debugging-pipe")
+
+ if (debug.port !== undefined) {
+ app.commandLine.appendSwitch("remote-debugging-port", debug.port)
app.commandLine.appendSwitch("remote-debugging-address", "127.0.0.1")
+ }
// Precise heap sizes need a launch switch. The debug bar's toggle starts the log without one.
if (debugBuild(build) && memoryLogInterval(process.env.OPENCODE_DESKTOP_MEMORY_LOG) !== undefined)
diff --git a/packages/desktop/src/main/native/menu.ts b/packages/desktop/src/main/native/menu.ts
index 36feb4eaa496..dbd41f799202 100644
--- a/packages/desktop/src/main/native/menu.ts
+++ b/packages/desktop/src/main/native/menu.ts
@@ -96,8 +96,8 @@ function build(deps: Deps, provider: MenubarProvider) {
Menu.setApplicationMenu(built)
}
-export function sendMenuCommand(win: BrowserWindow, id: string) {
- emitIpcEvent(win.webContents, new MenuCommandTriggered({ id }))
+export function sendMenuCommand(win: BrowserWindow, id: string, accelerator: boolean) {
+ emitIpcEvent(win.webContents, new MenuCommandTriggered({ id, accelerator }))
}
function nativeMenu(menu: DesktopMenu, extra: readonly MenubarEntry[], deps: Deps): MenuItemConstructorOptions {
@@ -145,10 +145,10 @@ function nativeItem(entry: DesktopMenuEntry, deps: Deps): MenuItemConstructorOpt
if (entry.command) {
const command = entry.command
- item.click = () => {
+ item.click = (_item, _window, event) => {
const win = deps.commandWindow()
- if (win) sendMenuCommand(win, command)
+ if (win) sendMenuCommand(win, command, !!event.triggeredByAccelerator)
}
}
diff --git a/packages/desktop/src/main/plugin/host.ts b/packages/desktop/src/main/plugin/host.ts
index 3ceaa2a13586..d3ebd5ed7372 100644
--- a/packages/desktop/src/main/plugin/host.ts
+++ b/packages/desktop/src/main/plugin/host.ts
@@ -1,4 +1,5 @@
import { app, BrowserWindow } from "electron"
+import { sameLoopbackServer } from "@opencode/app/loopback"
import { builtins } from "@opencode/gui-plugins/main"
import {
pluginIdAvailable,
@@ -330,7 +331,8 @@ export function createHost(input: {
id,
url: endpoint.url,
headers: authorization ? { authorization } : {},
- sameMachine: !!sidecar && URL.canParse(endpoint.url) && new URL(endpoint.url).origin === sidecar.url,
+ // The window's rule for a local server, so the pane offers extensions exactly where pages share the profile.
+ sameMachine: sameLoopbackServer(endpoint.url, sidecar?.url),
password: endpoint.password,
}
}
diff --git a/packages/desktop/src/main/windows/scheme.ts b/packages/desktop/src/main/windows/scheme.ts
index 37e7dd2402ec..9b2d3913d111 100644
--- a/packages/desktop/src/main/windows/scheme.ts
+++ b/packages/desktop/src/main/windows/scheme.ts
@@ -1,4 +1,5 @@
import electron, { type BrowserWindow } from "electron"
+import { schemes } from "@opencode/gui-plugins/schemes"
export const rendererProtocol = "oc"
@@ -34,6 +35,7 @@ export function isRendererUrl(value?: string, html = false) {
// before it loads anything else.
export function registerRendererScheme() {
electron.protocol.registerSchemesAsPrivileged([
+ ...schemes,
{
scheme: rendererProtocol,
privileges: {
diff --git a/packages/desktop/src/main/windows/security.test.ts b/packages/desktop/src/main/windows/security.test.ts
index 4fe3c8d20542..201d8664a008 100644
--- a/packages/desktop/src/main/windows/security.test.ts
+++ b/packages/desktop/src/main/windows/security.test.ts
@@ -1,7 +1,7 @@
import { expect, test } from "bun:test"
import { EventEmitter } from "node:events"
import type { BrowserWindow, Session, WebContents } from "electron"
-import { allowRendererPermissions } from "./security"
+import { allowRendererPermissions, receivesPluginPort } from "./security"
type RequestHandler = NonNullable[0]>
@@ -121,3 +121,20 @@ test("retains permissions across all live windows on a shared session and revoke
expect(await shared.ask(1, "notifications")).toBe(false)
expect(shared.check(null, "notifications", { isMainFrame: false })).toBe(false)
})
+
+test("hands the plugin port only to the app's own document, never to a page the window went to", () => {
+ const window = (url: string, destroyed = false) => ({
+ isDestroyed: () => destroyed,
+ webContents: { isDestroyed: () => false, mainFrame: { url } },
+ })
+
+ expect(receivesPluginPort(window(url))).toBe(true)
+ expect(receivesPluginPort(window("oc://renderer/settings.html#/browser"))).toBe(true)
+ // A web page, a preview, another host on the app's scheme and an address that only looks like the app's.
+ expect(receivesPluginPort(window("https://evil.test/"))).toBe(false)
+ expect(receivesPluginPort(window("oc-preview://file/index.html"))).toBe(false)
+ expect(receivesPluginPort(window("oc://evil/index.html"))).toBe(false)
+ expect(receivesPluginPort(window("https://renderer.evil.test/oc://renderer/index.html"))).toBe(false)
+ expect(receivesPluginPort(window(""))).toBe(false)
+ expect(receivesPluginPort(window(url, true))).toBe(false)
+})
\ No newline at end of file
diff --git a/packages/desktop/src/main/windows/security.ts b/packages/desktop/src/main/windows/security.ts
index 328164afc513..e27bcc9b9ec6 100644
--- a/packages/desktop/src/main/windows/security.ts
+++ b/packages/desktop/src/main/windows/security.ts
@@ -71,6 +71,14 @@ function registerPermissionHandlers(session: Session) {
return allowed
}
+/**
+ * Whether the window's document may receive the plugin port. A port carries no sender frame, so only the app's own
+ * document may: a page the window was navigated to, or a document of another origin, gets none.
+ */
+export function receivesPluginPort(win: { isDestroyed(): boolean; webContents: { isDestroyed(): boolean; mainFrame: { url: string } } }) {
+ return !win.isDestroyed() && !win.webContents.isDestroyed() && isRendererUrl(win.webContents.mainFrame.url)
+}
+
export function wireNavigationPolicy(win: BrowserWindow, openExternalURL: (url: string) => void) {
win.webContents.setWindowOpenHandler(({ url }) => {
if (!isRendererUrl(url)) openExternalURL(url)
diff --git a/packages/desktop/src/renderer/api-types.ts b/packages/desktop/src/renderer/api-types.ts
index 2317c0729f4b..b2903de8e2b2 100644
--- a/packages/desktop/src/renderer/api-types.ts
+++ b/packages/desktop/src/renderer/api-types.ts
@@ -39,7 +39,7 @@ export type ElectronAPI = {
getWindowID(): string
getWindowBootstrap(): WindowBootstrap
themeReady(): Promise
- onMenuCommand(cb: (id: string) => void): () => void
+ onMenuCommand(cb: (id: string, accelerator: boolean) => void): () => void
onDeepLink(cb: (delivery: { attempt: number; urls: string[] }) => void): () => void
openDirectoryPicker(opts?: DirectoryPickerOptions): Promise
openFilePicker(opts?: FilePickerOptions): Promise
@@ -49,7 +49,6 @@ export type ElectronAPI = {
saveFile(opts: SaveFilePickerOptions, content: string): Promise
openExternal(url: string): void
openBrowser(url: string): Promise
- openLocalFile(url: string): void
openPath(path: string, app?: string): Promise
revealPath(path: string): Promise
readClipboardImage(): Promise
diff --git a/packages/desktop/src/renderer/api.ts b/packages/desktop/src/renderer/api.ts
index 156b361bb508..ff1598fd1bb3 100644
--- a/packages/desktop/src/renderer/api.ts
+++ b/packages/desktop/src/renderer/api.ts
@@ -43,7 +43,7 @@ export const api: ElectronAPI = {
getWindowID: () => window.electron.windowID,
getWindowBootstrap: () => window.electron.bootstrap,
themeReady: () => invoke("WindowThemeReady"),
- onMenuCommand: (cb) => listen("MenuCommandTriggered", (event) => cb(event.id)),
+ onMenuCommand: (cb) => listen("MenuCommandTriggered", (event) => cb(event.id, event.accelerator)),
onDeepLink: (cb) => listen("DeepLinksOpened", (event) => cb({ attempt: event.attempt, urls: mutable(event.urls) })),
openDirectoryPicker: (opts) => invoke("FilesOpenDirectoryPicker", { options: opts }).then(mutable),
@@ -54,7 +54,6 @@ export const api: ElectronAPI = {
saveFile: (opts, content) => invoke("FilesSaveFile", { options: opts, content }),
openExternal: (url) => send("FilesOpenExternal", { url }),
openBrowser: (url) => invoke("FilesOpenBrowser", { url }),
- openLocalFile: (url) => send("FilesOpenLocalFile", { url }),
openPath: (path, app) => invoke("FilesOpenPath", { path, application: app }).then((value) => value ?? undefined),
revealPath: (path) => invoke("FilesRevealPath", { path }),
readClipboardImage: () =>
diff --git a/packages/desktop/src/renderer/platform/files.test.ts b/packages/desktop/src/renderer/platform/files.test.ts
index cf916e3380f7..386a5f188bc5 100644
--- a/packages/desktop/src/renderer/platform/files.test.ts
+++ b/packages/desktop/src/renderer/platform/files.test.ts
@@ -23,7 +23,6 @@ function fileApi(events: string[]): Parameters[0] {
saveFile: async () => false,
openExternal: () => {},
openBrowser: async () => true,
- openLocalFile: () => {},
resolveAppPath: async () => null,
openPath: async () => undefined,
revealPath: async () => false,
diff --git a/packages/desktop/src/renderer/platform/files.ts b/packages/desktop/src/renderer/platform/files.ts
index 7a58dc6e5eed..36635a7da7e2 100644
--- a/packages/desktop/src/renderer/platform/files.ts
+++ b/packages/desktop/src/renderer/platform/files.ts
@@ -13,7 +13,6 @@ type DesktopFileAPI = Pick<
| "saveFile"
| "openExternal"
| "openBrowser"
- | "openLocalFile"
| "resolveAppPath"
| "openPath"
| "revealPath"
@@ -77,7 +76,6 @@ export function createDesktopFiles(api: DesktopFileAPI, os: DesktopOS) {
api.saveFile({ title: options.title, defaultPath: options.defaultPath }, content),
openExternal: (url: string) => api.openExternal(url),
openBrowser: (url: string) => api.openBrowser(url),
- openLocalFile: (url: string) => api.openLocalFile(url),
async openPath(path: string, app?: string) {
if (os !== "windows") {
await api.openPath(path, app)
diff --git a/packages/desktop/src/renderer/platform/menu.ts b/packages/desktop/src/renderer/platform/menu.ts
index b7bff2a97591..2b64a2af199c 100644
--- a/packages/desktop/src/renderer/platform/menu.ts
+++ b/packages/desktop/src/renderer/platform/menu.ts
@@ -1,4 +1,5 @@
import type { Platform } from "@opencode/app/desktop"
+import { keyboardOwned } from "@opencode/ui/hooks"
import type { ElectronAPI } from "../api-types"
import { resetZoom, zoomIn, zoomOut } from "../window/zoom"
import {
@@ -23,9 +24,17 @@ function dispatch(event: MenuRouterEvent) {
)
}
-/** Commands that arrive before the app interface binds run once it does. */
+/**
+ * Commands that arrive before the app interface binds run once it does. A key equivalent the page left unhandled runs
+ * nothing while the keyboard is in a surface that owns it, such as a page's prompt: macOS offers the menu every key
+ * the focused element does not consume, as Control+` or Option+Down on a prompt's button.
+ */
export function startDesktopMenu(api: ElectronAPI) {
- api.onMenuCommand((id) => dispatch({ type: "command.received", id }))
+ api.onMenuCommand((id, accelerator) => {
+ // A minimized or unfocused window keeps its active element: only a window with the keyboard drops the command.
+ if (accelerator && document.hasFocus() && keyboardOwned(document.activeElement)) return
+ dispatch({ type: "command.received", id })
+ })
}
/** Routes menu commands to `handler` until the returned function unbinds it. */
diff --git a/packages/desktop/src/shared/ipc-rpc/events.ts b/packages/desktop/src/shared/ipc-rpc/events.ts
index 3c436842ffbd..f10451fa6e0b 100644
--- a/packages/desktop/src/shared/ipc-rpc/events.ts
+++ b/packages/desktop/src/shared/ipc-rpc/events.ts
@@ -10,6 +10,8 @@ export class DeepLinksOpened extends Schema.TaggedClass()("Deep
export class MenuCommandTriggered extends Schema.TaggedClass()("MenuCommandTriggered", {
id: Schema.String,
+ /** A key equivalent chose the item, rather than a click on the menu. */
+ accelerator: Schema.Boolean,
}) {}
export class WindowFullscreenChanged extends Schema.TaggedClass()("WindowFullscreenChanged", {
diff --git a/packages/desktop/src/shared/ipc-rpc/files.ts b/packages/desktop/src/shared/ipc-rpc/files.ts
index 5d934b1ac24d..ea535d6a3aa5 100644
--- a/packages/desktop/src/shared/ipc-rpc/files.ts
+++ b/packages/desktop/src/shared/ipc-rpc/files.ts
@@ -59,10 +59,6 @@ export const FilesOpenBrowser = Rpc.make("FilesOpenBrowser", {
success: Schema.Boolean,
})
-export const FilesOpenLocalFile = Rpc.make("FilesOpenLocalFile", {
- payload: { url: Schema.String },
-})
-
export const FilesOpenPath = Rpc.make("FilesOpenPath", {
payload: { path: Schema.String, application: Schema.optional(Schema.String) },
success: Schema.NullOr(Schema.String),
@@ -89,7 +85,6 @@ export const FileRpcs = RpcGroup.make(
FilesSaveFile,
FilesOpenExternal,
FilesOpenBrowser,
- FilesOpenLocalFile,
FilesOpenPath,
FilesRevealPath,
FilesReadClipboardImage,
diff --git a/packages/gui-plugins/AGENTS.md b/packages/gui-plugins/AGENTS.md
index 7230a69b7787..f56cf226e68b 100644
--- a/packages/gui-plugins/AGENTS.md
+++ b/packages/gui-plugins/AGENTS.md
@@ -5,11 +5,12 @@ Built-in features of the desktop and web app, each behind the GUI plugin SDK, `@
## Structure
- The SDK and the contracts `file`, `review`, `browser` and `updater` live in `packages/plugin/src/gui/`; all but `updater` publish with `@opencode/plugin` as `@opencode/plugin/gui*`. Built-ins, hosts and third-party plugin bundles all import them by that name; this package holds only the built-ins. Three subpaths are workspace-only and never published: `gui/host` (the hosts' protocol), `gui/builtin` (what only built-ins use) and `gui/updater` (the app's own updater contract).
-- Keep the public SDK for third-party plugins. API only built-ins use goes in `@opencode/plugin/gui/builtin` (`packages/plugin/src/gui/builtin.ts`), which no public SDK module imports: import `onIdle`, `BuiltinStore`, `BuiltinPanel`, `BuiltinPanelTab`, `BuiltinCommand`, `BuiltinSlot`, `builtinContext`, `builtinMainContext` and `builtinCatalog` from there. Each built-in registry token has the public token's id; the hosts read every item through it.
+- Keep the public SDK for third-party plugins. API only built-ins use goes in `@opencode/plugin/gui/builtin` (`packages/plugin/src/gui/builtin.ts`), which no public SDK module imports: import `onIdle`, `BuiltinStore`, `BuiltinPanel`, `BuiltinPanelTab`, `BuiltinCommand`, `BuiltinAppLink`, `BuiltinSlot`, `builtinContext`, `builtinMainContext` and `builtinCatalog` from there. Each built-in registry token has the public token's id; the hosts read every item through it.
- Built-ins declare with `Plugin.define` like any plugin, as TUI built-ins do; "built-in" is only the host's flag for what `src/renderer.ts` and `src/main.ts` load. A third-party `./gui-experimental` bundle default-exports one `Plugin.define({ setup?, main?, ...declarations })`. No definition declares an id: the host gives a built-in its key in `compose` and a bundle the server plugin's id, as `ctx.id`. Main alone lists the plugins on the app's own server and sends windows their bundles; both hosts evaluate bundles only through `evaluatePluginBundle` in `@opencode/plugin/gui/host`, which owns the shape checks.
- Every declaration field is declared once, in `Plugin.Declarations` (`packages/plugin/src/gui/declarations.ts`). `Plugin.Definition` adds the setups; the host's `Entry` (`@opencode/plugin/gui/host`) adds the lazy `windowEntry` and `mainEntry`. Every OS check goes through `runsOn`. A plugin from the config whose `os` leaves out this system never runs, and Extensions › Plugins keeps its row with "Not available on this system."
- One folder per built-in: `index.ts` (`Plugin.define({ os?, stores?, i18n })`), `contract.ts`, `renderer.tsx`, an optional `main.ts`, and `i18n/.ts`.
- `src/renderer.ts` and `src/main.ts` are the only files that list the built-ins, each through `compose` from `@opencode/plugin/gui/host`, which attaches the lazy `windowEntry` and `mainEntry`. Main never imports window code.
+- `src/schemes.ts` collects built-in URL scheme declarations for registration before Electron is ready. Keep it free of runtime Electron and plugin setup imports; the owning plugin installs its handler only in its own partition.
- Every plugin here ships. Do not add a plugin, fixture or wrapper only to document or demonstrate the SDK; the guide shows shipping code.
- Another plugin may import only your `contract.ts` (tokens and schemas, no runtime code). Contracts are not declared: provide your own with `ctx.provide` (contracts from the window, Ipcs from main, each with an id under your plugin's id), call your own main entry with `ctx.main(Ipc)`, and follow another plugin's token with `ctx.use(token)`. Every built-in keeps working while any other is not active. To avoid loading an Ipc's schemas at startup, import its token only in the chunk that calls it.
- A contract that returns components binds each with `bindPlugin` in the provider's setup, so `usePlugin` inside reads the provider's context, not the consumer's. Annotate the bound component's props (`bindPlugin((props: FileTreeProps) => ...)`): TypeScript cannot infer them inside `ctx.provide`. Do not wrap data methods such as `Changes.diffs`.
diff --git a/packages/gui-plugins/README.md b/packages/gui-plugins/README.md
index d3a685c55afb..c437f86b583d 100644
--- a/packages/gui-plugins/README.md
+++ b/packages/gui-plugins/README.md
@@ -324,6 +324,17 @@ to the displayed repository or worktree instead of adding a second menu item.
| `ctx.embeds` (main) | `Embeds` | `create(view, window)` places a web page |
| `ctx.cli` (main) | `Cli` | The opencode CLI the app runs |
+### Contracts
+
+The contracts `file`, `review` and `browser` publish with the SDK as `@opencode/plugin/gui/`. Read one with `ctx.use`.
+
+The desktop `Browser` contract (`@opencode/plugin/gui/browser`) can return a handle to a new tab in the session on screen:
+`const id = await browser.experimental.open(session, url)`, then `await browser.experimental.close(id)` from the same
+plugin instance. Experimental: may change without compatibility guarantees. The branded handle survives a session rebind.
+It ends with the plugin instance or the window, when the person clicks or types in the tab or runs a command on it, and
+when the agent uses the tab. `close` returns true only for a tab closed now; a page that asks "Leave site?" stays open.
+`open(session, url)` stays fire-and-forget.
+
### Built-in only
`@opencode/plugin/gui/builtin` holds what only the built-ins use. It is never published and is not in the modules a plugin bundle may require; a public SDK module never imports it.
@@ -333,8 +344,9 @@ to the displayed repository or worktree instead of adding a second menu item.
| `onIdle(fn)` | Runs work while the main thread is idle, e.g. a lazy chunk's preload |
| `BuiltinPanel`, `BuiltinPanelTab` | `legacy` stored keys of a panel; `first` and stable `dom` ids of a tab |
| `BuiltinCommand` | `follows`: share another command's shortcut inside `scope` |
+| `BuiltinAppLink` | Review a person's activation of an application link in the desktop conversation |
| `BuiltinStore`, `BuiltinStoreFrom` | Window stores imported from parts of the app's own keys |
-| `builtinContext(ctx)` | `ctx.desktop.forceFocus`, `ctx.locale.setDirection` |
+| `builtinContext(ctx)` | `ctx.desktop.forceFocus`, `ctx.locale.setDirection`, `ctx.provideFor` for per-consumer contracts |
| `builtinMainContext(ctx)`, `MainStoreFrom`, `Lifecycle` | Main stores imported from settings files or other namespaces, and `lifecycle.restart(handoff)` |
| `builtinCatalog(catalog)`, `BuiltinCatalog` | Locales other than English as loaders, loaded when the user picks the locale |
diff --git a/packages/gui-plugins/package.json b/packages/gui-plugins/package.json
index ec7002e7b8f5..0c033de6453e 100644
--- a/packages/gui-plugins/package.json
+++ b/packages/gui-plugins/package.json
@@ -8,6 +8,7 @@
"exports": {
"./renderer": "./src/renderer.ts",
"./main": "./src/main.ts",
+ "./schemes": "./src/schemes.ts",
"./terminal": "./src/terminal/index.ts",
"./debug/options": "./src/debug/options.ts"
},
@@ -41,7 +42,8 @@
"fuzzysort": "catalog:",
"ghostty-web": "github:anomalyco/ghostty-web#e91e38a9ceb13c566ddfa15185a9393849f712a9",
"knobs": "npm:@kitlangton/knobs@0.4.0-next.22",
- "solid-js": "catalog:"
+ "solid-js": "catalog:",
+ "tldts": "7.5.1"
},
"devDependencies": {
"@happy-dom/global-registrator": "20.0.11",
diff --git a/packages/gui-plugins/src/browser/activation-delay.test.ts b/packages/gui-plugins/src/browser/activation-delay.test.ts
new file mode 100644
index 000000000000..3abd22ed5e8b
--- /dev/null
+++ b/packages/gui-plugins/src/browser/activation-delay.test.ts
@@ -0,0 +1,79 @@
+import { expect, test } from "bun:test"
+import { ACTIVATION_DELAY_MS, actionGuard, activationAllowed, guardActivation } from "./activation-delay"
+
+test("a prompt that shows again, as for a repeated request, starts its delay over", () => {
+ const root = document.createElement("section")
+ const allow = document.createElement("button")
+ allow.dataset.activationGuard = ""
+ root.append(allow)
+ document.body.append(root)
+ const answered: number[] = []
+ allow.addEventListener("click", (event) => answered.push(event.timeStamp))
+ const guard = guardActivation(root)
+
+ // Times are event timestamps from the moment the prompt shows, as the browser stamps them.
+ const press = (at: number) => {
+ for (const type of ["pointerdown", "click"]) {
+ const event = new MouseEvent(type, { bubbles: true, cancelable: true })
+ Object.defineProperty(event, "timeStamp", { value: at })
+ Object.defineProperty(event, "isTrusted", { value: true })
+ allow.dispatchEvent(event)
+ }
+ }
+
+ guard.changed()
+ const shown = performance.now()
+ press(shown + ACTIVATION_DELAY_MS + 100)
+ expect(answered).toHaveLength(1)
+
+ // The page asks again: the same prompt shows anew, and a click 263 ms later does nothing.
+ guard.changed()
+ const again = performance.now()
+ press(again + 263)
+ expect(answered).toHaveLength(1)
+ press(again + ACTIVATION_DELAY_MS + 1)
+ expect(answered).toHaveLength(2)
+
+ guard.dispose()
+ root.remove()
+})
+
+test("a press that began before the prompt appeared, or elsewhere, never activates it", () => {
+ expect(activationAllowed({ shownAt: 1_000, at: 5_000 })).toBe(false)
+ expect(activationAllowed({ shownAt: 1_000, pressedAt: 950, at: 5_000 })).toBe(false)
+})
+
+test("a press on the prompt activates it only once the prompt has been there long enough to read", () => {
+ // A page's double-click target: the second click lands on the new bar 100 ms after it appears.
+ expect(activationAllowed({ shownAt: 1_000, pressedAt: 1_100, at: 1_100 })).toBe(false)
+ expect(
+ activationAllowed({
+ shownAt: 1_000,
+ pressedAt: 1_000 + ACTIVATION_DELAY_MS - 50,
+ at: 1_000 + ACTIVATION_DELAY_MS - 1,
+ }),
+ ).toBe(false)
+ // A press that began inside the delay does not count even when it ends after it; one that began after it does.
+ expect(activationAllowed({ shownAt: 1_000, pressedAt: 1_400, at: 1_000 + ACTIVATION_DELAY_MS })).toBe(false)
+ expect(activationAllowed({ shownAt: 1_000, pressedAt: 1_000 + ACTIVATION_DELAY_MS, at: 1_600 })).toBe(true)
+ expect(ACTIVATION_DELAY_MS).toBe(500)
+})
+
+test("a new bar requires a fresh press on the answered control after its delay", () => {
+ const guard = actionGuard(20)
+ const target = new EventTarget()
+ const event = (timeStamp: number) => ({ isTrusted: true, currentTarget: target, timeStamp })
+ guard.press(event(519))
+ expect(guard.accept(event(530))).toBe(false)
+ guard.press(event(600), true)
+ expect(guard.accept(event(610))).toBe(false)
+ guard.press(event(620))
+ expect(actionGuard(621).accept(event(1300))).toBe(false)
+ expect(guard.accept({ ...event(630), currentTarget: new EventTarget() })).toBe(false)
+ guard.press(event(640))
+ expect(guard.accept(event(650))).toBe(true)
+ expect(guard.accept(event(660))).toBe(false)
+ // A synthetic click never answers, even after a real press.
+ guard.press(event(700))
+ expect(guard.accept({ ...event(710), isTrusted: false })).toBe(false)
+})
diff --git a/packages/gui-plugins/src/browser/activation-delay.ts b/packages/gui-plugins/src/browser/activation-delay.ts
new file mode 100644
index 000000000000..3faefde62f13
--- /dev/null
+++ b/packages/gui-plugins/src/browser/activation-delay.ts
@@ -0,0 +1,112 @@
+// Input protection for what a page can make appear under the user's pointer or keys: refusal and pop-up notices,
+// permission bars and page dialogs. A page that shows one under a click or key press the user is already making must
+// not get that press on its controls, as browsers protect their own prompts.
+
+/** How long a guarded control ignores presses after it appears or changes; Chromium uses about 500 ms. */
+export const ACTIVATION_DELAY_MS = 500
+
+/**
+ * Whether a press may activate a guarded control: it began (`pressedAt`) on that control at least `ACTIVATION_DELAY_MS`
+ * after the control last appeared or changed (`shownAt`), and the activation (`at`) ends that press. A press that began
+ * earlier, or elsewhere (no `pressedAt`), never activates it. All times are event timestamps on one clock.
+ */
+export function activationAllowed(input: {
+ readonly shownAt: number
+ readonly pressedAt?: number
+ readonly at: number
+}) {
+ return (
+ input.pressedAt !== undefined &&
+ input.pressedAt >= input.shownAt + ACTIVATION_DELAY_MS &&
+ input.at >= input.pressedAt
+ )
+}
+
+type Press = Pick
+
+/**
+ * One guard for the controls of one presentation, such as a notice's token: make a new one when it changes, not on
+ * each render. A click activates only when a trusted, unrepeated press began on the same control (`activationAllowed`).
+ */
+export function actionGuard(shownAt: number) {
+ let pressed: { target: EventTarget | null; at: number } | undefined
+
+ return {
+ press(event: Press, repeat = false) {
+ pressed = event.isTrusted && !repeat ? { target: event.currentTarget, at: event.timeStamp } : undefined
+ },
+ cancel() {
+ pressed = undefined
+ },
+ accept(event: Press) {
+ const press = pressed
+ pressed = undefined
+
+ return (
+ !!press &&
+ event.isTrusted &&
+ press.target === event.currentTarget &&
+ activationAllowed({ shownAt, pressedAt: press.at, at: event.timeStamp })
+ )
+ },
+ }
+}
+
+/**
+ * Guards the controls inside `root` marked `data-activation-guard`, and the submission of its forms, with the same
+ * rule: a click on one, or a submit, that `activationAllowed` refuses for the press that led to it is stopped before any
+ * handler sees it. Call `changed` when the prompt shows something new in the same place.
+ */
+export function guardActivation(root: HTMLElement) {
+ let shownAt = performance.now()
+ let pressed: { target: Element; at: number } | undefined
+
+ // A key held down since before the prompt repeats on it; only a fresh, trusted press on the prompt counts.
+ const press = (event: PointerEvent | KeyboardEvent) => {
+ const repeat = event instanceof KeyboardEvent && event.repeat
+
+ pressed =
+ event.isTrusted && !repeat && event.target instanceof Element
+ ? { target: event.target, at: event.timeStamp }
+ : undefined
+ }
+
+ const activated = (event: Event) => {
+ const control =
+ event.type === "submit"
+ ? event.target instanceof Element
+ ? event.target
+ : null
+ : event.target instanceof Element
+ ? event.target.closest("[data-activation-guard]")
+ : null
+
+ if (!control) return
+
+ // A click needs its press on the same control; a submit, a press on the prompt, such as Enter in its field.
+ const same = !!pressed && (event.type === "submit" || pressed.target.closest("[data-activation-guard]") === control)
+ const trusted = event.type === "submit" || event.isTrusted
+
+ if (same && trusted && activationAllowed({ shownAt, pressedAt: pressed?.at, at: event.timeStamp })) return
+ event.preventDefault()
+ event.stopImmediatePropagation()
+ }
+
+ root.addEventListener("pointerdown", press, true)
+ root.addEventListener("keydown", press, true)
+ root.addEventListener("click", activated, true)
+ root.addEventListener("submit", activated, true)
+
+ return {
+ changed() {
+ shownAt = performance.now()
+ pressed = undefined
+ },
+ dispose() {
+ root.removeEventListener("pointerdown", press, true)
+ root.removeEventListener("keydown", press, true)
+ root.removeEventListener("click", activated, true)
+ root.removeEventListener("submit", activated, true)
+ },
+ }
+}
diff --git a/packages/gui-plugins/src/browser/address.test.ts b/packages/gui-plugins/src/browser/address.test.ts
index 777e1c240409..d74d9dc16ae3 100644
--- a/packages/gui-plugins/src/browser/address.test.ts
+++ b/packages/gui-plugins/src/browser/address.test.ts
@@ -1,6 +1,20 @@
import { expect, test } from "bun:test"
-import { addressParts, resolveAddress } from "./address"
+import { addressParts, externalAction, externalPage, pageHandoff, resolveAddress } from "./address"
import { remember, suggest } from "./history"
+import { normalizeURL, refusal } from "./policy"
+
+test("typed file paths never become a host or a search query, regardless of the desktop OS", () => {
+ const policy = { fileRoots: ["/work/repo"], home: "/work" }
+
+ for (const input of ["C:\\Users\\fixture\\x", "C:/Users/fixture/x", "\\\\server\\share\\x", "/other/x", "~/other/x", "../other/x", "file:/other/x"])
+ expect(refusal(resolveAddress(input), policy)).toBe("browser.address.workspace")
+
+ for (const input of ["./index.html", "~/repo/index.html", "/work/repo/index.html", "file:/work/repo/index.html"])
+ expect(normalizeURL(resolveAddress(input), policy)).toBe("file:///work/repo/index.html")
+
+ for (const [input, destination] of [["localhost:3000", "http://localhost:3000"], ["example.com/path", "https://example.com/path"], ["c.com", "https://c.com"], ["//example.com", "https://example.com"], ["find cats/dogs", "https://www.google.com/search?q=find%20cats%2Fdogs"]])
+ expect(normalizeURL(resolveAddress(input), policy)).toBe(destination)
+})
test("the address field navigates to what reads as an address and searches for anything else", () => {
const search = (query: string) => `https://www.google.com/search?q=${encodeURIComponent(query)}`
@@ -104,3 +118,45 @@ test("history keeps one newest-first visit per URL and suggests addresses that c
),
).toHaveLength(30)
})
+
+test("a local preview may be revealed by tab ID but never launched by URL", () => {
+ for (const suffix of ["html", "exe", "bat", "cmd", "lnk", "ps1", "app"]) {
+ expect(externalAction(`file:///repo/test.${suffix}`, true)).toBe("reveal")
+ expect(externalAction(`file:///repo/test.${suffix}`, false)).toBeUndefined()
+ }
+
+ expect(externalAction("https://example.org", false)).toBe("browser")
+ expect(externalAction("oc-preview://other/repo/x", true)).toBeUndefined()
+})
+
+test("only a main-reported HTTP(S) failure can be handed off without a matching committed document", () => {
+ const web = "https://localhost:4000/"
+ const file = "file:///work/report.html"
+ const preview = "oc-preview://grant/work/report.html"
+ expect(pageHandoff("chrome-error://chromewebdata/", "about:blank", web, true, true)).toEqual({ kind: "web", url: web })
+ expect(pageHandoff(web, web, "https://other.invalid/", false, true)).toBeUndefined()
+ expect(pageHandoff(preview, file, file, true, true)).toBeUndefined()
+ expect(pageHandoff(preview, file, file, false, true)).toEqual({ kind: "preview", url: file })
+ expect(pageHandoff(file, file, file, false, true)).toBeUndefined()
+})
+
+test.each([
+ ["https://example.org/page", false, true],
+ ["http://localhost:4000", true, true],
+ ["http://localhost:4000", false, false],
+ ["http://localhost.:4000", false, false],
+ ["http://foo.localhost.:4000", false, false],
+ ["http://0.0.0.0:4000", false, false],
+ ["http://[::]:4000", false, false],
+ ["http://[::ffff:127.0.0.1]:4000", false, false],
+ ["http://[::ffff:126.0.0.1]:4000", false, true],
+ ["file:///work/report.HTM#view", true, true],
+ ["file:///work/report.html.exe", true, false],
+ ["file:///work/report.html", false, false],
+ ["workspace://session/report.html", true, false],
+ ["artifact://item/report.html", true, false],
+ ["oc-preview://unknown/report.html", true, false],
+ ["mailto:hello@example.org", true, false],
+] as const)("the current page %s on this machine %s offers a hand-off: %s", (url, local, open) => {
+ expect(externalPage(url, local)).toBe(open)
+})
diff --git a/packages/gui-plugins/src/browser/address.ts b/packages/gui-plugins/src/browser/address.ts
index 0a8ac351a5dc..caf5a9d97b6b 100644
--- a/packages/gui-plugins/src/browser/address.ts
+++ b/packages/gui-plugins/src/browser/address.ts
@@ -1,4 +1,4 @@
-import { destinationOrigin } from "./policy"
+import { destinationOrigin, localAddress } from "./policy"
/** Where text that is not an address goes. Shared with the system browser's default so results look familiar. */
const SEARCH = "https://www.google.com/search?q="
@@ -25,6 +25,8 @@ export function searches(input: string) {
if (!value || /^about:\S*$/i.test(value)) return false
+ if (localAddress(value) || value.startsWith("//")) return false
+
if (/^[a-z][a-z\d+.-]*:\/\//i.test(value)) return !URL.canParse(value)
if (/\s/.test(value)) return true
@@ -53,6 +55,7 @@ export function addressParts(url: string) {
* - `local`: HTTP on a loopback host, which resolves on the machine running the server.
* - `insecure`: HTTP elsewhere.
* - `file`: a workspace file.
+ * - `workspace`: a file read by the session's server, not from the desktop's disk.
*/
export function connection(url: string) {
if (!URL.canParse(url)) return
@@ -62,6 +65,8 @@ export function connection(url: string) {
if (parsed.protocol === "file:") return "file"
+ if (parsed.protocol === "workspace:") return "workspace"
+
if (parsed.protocol !== "http:") return
return loopback(parsed.hostname) ? "local" : "insecure"
@@ -69,5 +74,33 @@ export function connection(url: string) {
/** Whether a host names this machine; for a remote server that is the server's machine, not the user's. */
export function loopback(hostname: string) {
- return /^(?:localhost|127(?:\.\d{1,3}){3}|\[::1\]|::1)$/i.test(hostname) || hostname.endsWith(".localhost")
+ const host = hostname.toLowerCase().replace(/\.$/, "")
+
+ // URL.hostname canonicalizes IPv4-mapped IPv6 into hex groups, including mapped 0.0.0.0.
+ return /^(?:localhost|127(?:\.\d{1,3}){3}|0\.0\.0\.0|\[::1?\]|::1|\[::ffff:(?:7f[\da-f]{2}:[\da-f]{1,4}|0:0)\])$/.test(host) || host.endsWith(".localhost")
+}
+
+/** A file never goes to the default application. Main resolves the tab's workspace again before revealing it. */
+export function externalAction(url: string, local: boolean) {
+ if (!URL.canParse(url)) return
+ const parsed = new URL(url)
+
+ if (parsed.protocol === "file:") return local && !parsed.hostname ? "reveal" : undefined
+
+ if (destinationOrigin(url) && (local || !loopback(parsed.hostname))) return "browser"
+}
+
+/** Eligibility of the displayed page; only main can turn a preview grant into a launchable file. */
+export function externalPage(url: string, local: boolean) {
+ const action = externalAction(url, local)
+
+ return action === "browser" || (action === "reveal" && /\.html?$/i.test(new URL(url).pathname))
+}
+
+/** `shown` is main's committed address or the URL Chromium reported failing, never a renderer-supplied target. */
+export function pageHandoff(actual: string, display: string, shown: string, failed: boolean, local: boolean) {
+ if (externalAction(shown, local) === "browser" && (failed || actual === shown)) return { kind: "web" as const, url: shown }
+
+ if (!failed && actual.startsWith("oc-preview://") && display === shown && shown.startsWith("file:") && externalPage(shown, local))
+ return { kind: "preview" as const, url: shown }
}
diff --git a/packages/gui-plugins/src/browser/agent-rendering.test.ts b/packages/gui-plugins/src/browser/agent-rendering.test.ts
new file mode 100644
index 000000000000..91128026b31a
--- /dev/null
+++ b/packages/gui-plugins/src/browser/agent-rendering.test.ts
@@ -0,0 +1,116 @@
+import { afterEach, expect, jest, test } from "bun:test"
+import { agentRendering, needsWakeFrame } from "./agent-rendering"
+
+afterEach(() => {
+ jest.useRealTimers()
+})
+
+test("only the last command starts the idle clock; wake before the next command and cancel at disposal", () => {
+ jest.useFakeTimers()
+ const lifetime = new AbortController()
+ const throttles: boolean[] = []
+ const render = agentRendering(lifetime.signal, value => throttles.push(value))
+
+ const wait = render.hold()
+ render.hold()[Symbol.dispose]()
+ jest.advanceTimersByTime(30_000)
+ expect(throttles).toEqual([false])
+ wait[Symbol.dispose]()
+ jest.advanceTimersByTime(29_999)
+ const followup = render.hold()
+ jest.advanceTimersByTime(30_000)
+ expect(throttles).toEqual([false])
+ followup[Symbol.dispose]()
+ jest.advanceTimersByTime(29_999)
+ expect(throttles).toEqual([false])
+ jest.advanceTimersByTime(1)
+ render.committed()
+ expect(throttles).toEqual([false, true])
+ render.hold()[Symbol.dispose]()
+ expect(throttles).toEqual([false, true, false])
+ lifetime.abort()
+ jest.advanceTimersByTime(30_000)
+ expect(throttles).toEqual([false, true, false])
+})
+
+test("overlapping commands await the same first frame", async () => {
+ const render = agentRendering(new AbortController().signal, () => {})
+ const frame = Promise.withResolvers()
+ const first = render.hold(() => frame.promise)
+ const second = render.hold(() => { throw new Error("duplicate wake") })
+ expect(second.painted).toBe(first.painted)
+ frame.resolve()
+ await first.painted
+ first[Symbol.dispose]()
+ second[Symbol.dispose]()
+})
+
+test("a command that needs no frame wakes the page without one; the next one that needs a frame still waits", async () => {
+ jest.useFakeTimers()
+ const throttles: boolean[] = []
+ const frames: ReturnType>[] = []
+ const render = agentRendering(new AbortController().signal, value => throttles.push(value))
+
+ const wake = () => {
+ const frame = Promise.withResolvers()
+ frames.push(frame)
+
+ return frame.promise
+ }
+
+ for (const method of ["frames", "dialog"] as const) {
+ const passive = render.hold(needsWakeFrame(method, true, false) ? wake : undefined)
+ expect(passive.painted).toBeUndefined()
+ passive[Symbol.dispose]()
+ }
+
+ expect(throttles).toEqual([false])
+ expect(frames).toHaveLength(0)
+ // The page is awake but has painted nothing since: an immediate snapshot waits for its first frame.
+ const snapshot = render.hold(needsWakeFrame("snapshot", true, false) ? wake : undefined)
+ expect(snapshot.painted).toBeDefined()
+ expect(frames).toHaveLength(1)
+ frames[0]?.resolve()
+ await snapshot.painted
+ const click = render.hold(needsWakeFrame("click", true, false) ? wake : undefined)
+ expect(click.painted).toBeUndefined()
+ expect(frames).toHaveLength(1)
+ snapshot[Symbol.dispose]()
+ click[Symbol.dispose]()
+ // Throttled again after the idle time, the page owes the next painting command a fresh frame.
+ jest.advanceTimersByTime(30_000)
+ expect(throttles).toEqual([false, true])
+ expect(render.hold(wake).painted).toBeDefined()
+ expect(frames).toHaveLength(2)
+})
+
+test("idle past the deadline with a dialog open, the dialog command un-throttles without waiting for a frame", () => {
+ jest.useFakeTimers()
+ const throttles: boolean[] = []
+ const render = agentRendering(new AbortController().signal, value => throttles.push(value))
+
+ render.hold()[Symbol.dispose]()
+ jest.advanceTimersByTime(30_000)
+ expect(throttles).toEqual([false, true])
+
+ // An open alert pauses the page's animation frames, so no command waits for one, including the one that answers it.
+ for (const method of ["dialog", "snapshot", "click", "navigate"] as const) expect(needsWakeFrame(method, true, true)).toBe(false)
+
+ const answer = render.hold(needsWakeFrame("dialog", true, true) ? () => new Promise(() => {}) : undefined)
+ expect(answer.painted).toBeUndefined()
+ expect(throttles).toEqual([false, true, false])
+})
+
+test("a renderer that never paints neither blocks navigation nor fails the command that waited for it", async () => {
+ const render = agentRendering(new AbortController().signal, () => {})
+ const frame = Promise.withResolvers()
+ const snapshot = render.hold(needsWakeFrame("snapshot", true, false) ? () => frame.promise : undefined)
+ expect(snapshot.painted).toBeDefined()
+
+ for (const method of ["navigate", "reload", "stop", "back", "dialog", "tabs.close"] as const) expect(needsWakeFrame(method, true, false)).toBe(false)
+ expect(needsWakeFrame("snapshot", false, false)).toBe(false)
+ expect(render.hold(needsWakeFrame("navigate", true, false) ? () => frame.promise : undefined).painted).toBeUndefined()
+ // The capture deadline rejects the wake; the snapshot then proceeds as it would without one.
+ frame.reject(new Error("no frame"))
+ await expect(snapshot.painted).resolves.toBeUndefined()
+})
diff --git a/packages/gui-plugins/src/browser/agent-rendering.ts b/packages/gui-plugins/src/browser/agent-rendering.ts
new file mode 100644
index 000000000000..bc778ae14e4e
--- /dev/null
+++ b/packages/gui-plugins/src/browser/agent-rendering.ts
@@ -0,0 +1,61 @@
+import type { Browser } from "@opencode/plugin-browser/rpc"
+
+/** A paused page cannot paint the frame that its dialog or a recovery navigation would unblock. */
+export function needsWakeFrame(method: Browser.Method, loaded: boolean, dialog: boolean) {
+ const painting: Browser.Method[] = ["snapshot", "find", "wait", "evaluate", "click", "check", "fill", "fill_form", "select", "press", "hover", "drag", "scroll", "screenshot"]
+
+ return loaded && !dialog && painting.includes(method)
+}
+
+// Long enough to cover thinking between a snapshot and its follow-up; a forgotten tab doesn't animate indefinitely.
+const idleMs = 30_000
+
+export function agentRendering(signal: AbortSignal, throttle: (enabled: boolean) => void) {
+ let holds = 0
+ let awake = false
+ // Whether a frame was waited for since the page woke. A command that needs no frame (`frames`, `console`, `dialog`)
+ // wakes the page without one, and the next command that needs one must still wait for it.
+ let painted = false
+ let paint: Promise | undefined
+ let idle: ReturnType | undefined
+ signal.addEventListener("abort", () => clearTimeout(idle), { once: true })
+
+ return {
+ hold(onWake?: () => Promise) {
+ signal.throwIfAborted()
+ clearTimeout(idle)
+
+ if (!awake) throttle(false)
+ awake = true
+ holds++
+
+ if (onWake && !painted && !paint) {
+ const frame = onWake().catch(() => undefined)
+ paint = frame
+ // A renderer that never paints is not asked again: the command proceeds as it would without a frame.
+ void frame.then(() => {
+ painted = true
+
+ if (paint === frame) paint = undefined
+ })
+ }
+
+ return {
+ painted: onWake ? paint : undefined,
+ [Symbol.dispose]() {
+ if (--holds || signal.aborted) return
+ idle = setTimeout(() => {
+ awake = false
+ painted = false
+ paint = undefined
+ throttle(true)
+ }, idleMs)
+ },
+ }
+ },
+ // A cross-site commit can replace the renderer while a command or its grace period is active.
+ committed() {
+ if (awake && !signal.aborted) throttle(false)
+ },
+ }
+}
diff --git a/packages/gui-plugins/src/browser/artifact-link.test.ts b/packages/gui-plugins/src/browser/artifact-link.test.ts
new file mode 100644
index 000000000000..71f12c4abdf2
--- /dev/null
+++ b/packages/gui-plugins/src/browser/artifact-link.test.ts
@@ -0,0 +1,71 @@
+import { expect, test } from "bun:test"
+import { artifactAddress, artifactLink, artifactResource, artifactWebURL } from "./artifact-link"
+import { resolvePreviewRequest, type PreviewSource } from "./workspace-file"
+
+const base = "https://example.test:444/mounted"
+
+const view = "/api/experimental/artifacts/art_aBc123/view"
+
+const display = "artifact://art_aBc123/"
+
+test("only this server's artifact view is a pane link, including behind a base path", () => {
+ for (const root of [view, `${base}${view}`]) {
+ expect(artifactLink(root, base)).toBe(display)
+ expect(artifactLink(`${root}/`, base)).toBe(display)
+ expect(artifactLink(`${root}/assets/50%25.svg`, base)).toBe(`${display}assets/50%25.svg`)
+ }
+
+ expect(artifactLink(`https://EXAMPLE.test:443${view}`, "https://example.test")).toBe(display)
+
+ for (const other of [
+ "https://provider.test/report",
+ `https://example.test${view}`,
+ `${base}.other${view}`,
+ `${view}er/`,
+ view.replace("/view", "/update"),
+ view.replace("art_aBc123", "art_"),
+ `${view}?location=other`,
+ `${view}/../x`,
+ `${view}/%2e%2e/x`,
+ `${view}/a%2fb`,
+ `${view}/a%5cb`,
+ `${view}//host`,
+ `${view}/a\\b`,
+ ])
+ expect(artifactLink(other, base)).toBeUndefined()
+})
+
+test("an artifact address round trips without the server URL; web uses its ordinary view URL", () => {
+ const path = "assets/50%25.svg"
+ expect(artifactAddress(display + path)).toEqual({ id: "art_aBc123", path })
+ expect(artifactWebURL(display + path, base)).toBe(`${base}${view}/${path}`)
+ expect(artifactWebURL(display, "https://name:pass@example.test")).toBeUndefined()
+ expect(artifactResource(`oc-preview://grant/${path}?ignored=yes#fragment`, "grant", "art_aBc123")).toEqual({
+ display: display + path,
+ route: `${view}/${path}`,
+ })
+})
+
+test("no foreign origin, path or method can choose where the grant sends credentials", async () => {
+ const grants = new Map([
+ ["first", { type: "artifact", id: "art_aBc123", read: () => Promise.reject(new Error("not a byte read")) }],
+ ])
+
+ const request = (path: string, method = "GET", origin: string | undefined = "oc-preview://first") =>
+ resolvePreviewRequest(`oc-preview://first/${path}`, method, origin, grants, AbortSignal.timeout(1000))
+
+ expect(await request("")).toMatchObject({ route: `${view}/` })
+ expect(await request("assets/app.js?location[directory]=other", "HEAD")).toMatchObject({
+ route: `${view}/assets/app.js`,
+ })
+ expect(await request("api/session")).toMatchObject({ route: `${view}/api/session` })
+
+ for (const path of ["../x", "%2e%2e/x", "c:/x", "/other", "x%2fy", "x%5cy", "x\\y"])
+ expect(await request(path)).toBeUndefined()
+
+ for (const origin of ["https://web.test", "null", "oc-preview://second"])
+ expect(await request("", "GET", origin)).toBeUndefined()
+ expect(await request("index.html", "POST")).toBeUndefined()
+ grants.clear()
+ expect(await request("")).toBeUndefined()
+})
diff --git a/packages/gui-plugins/src/browser/artifact-link.ts b/packages/gui-plugins/src/browser/artifact-link.ts
new file mode 100644
index 000000000000..604b0c8bc0db
--- /dev/null
+++ b/packages/gui-plugins/src/browser/artifact-link.ts
@@ -0,0 +1,69 @@
+import { remotePath } from "./remote-address"
+
+const route = "/api/experimental/artifacts/"
+
+export function artifactViewPath(item: { id: string; path: string }) {
+ return `${route}${item.id}/view/${item.path}`
+}
+
+/** Parse the path as written, before URL normalization could erase a traversal or repair an authority. */
+function parts(value: string) {
+ const match = /^(art_[a-zA-Z0-9]+)\/(.*)$/u.exec(value)
+
+ if (!match || /[?#\s\x00-\x1f]/u.test(value)) return
+ const path = match[2] ? remotePath(match[2], "", true) : ""
+
+ if (path === undefined) return
+
+ return { id: match[1], path: path.split("/").map(encodeURIComponent).join("/") }
+}
+
+/** Only the view route on this exact server (never its metadata, or a look-alike origin). */
+export function artifactLink(href: string, server: string) {
+ const authority = /^(https?:\/\/[^/?#\\\s@]+)(\/.*)$/iu.exec(href)
+ // Compare origins as URLs, but compare paths as written: a URL parser would erase dot segments.
+ const base = authority && URL.canParse(server) && URL.canParse(authority[1]) ? new URL(server) : undefined
+ const prefix = `${base?.pathname.replace(/\/+$/, "") ?? ""}${route}`
+
+ const rest = href.startsWith(route)
+ ? href.slice(route.length)
+ : base &&
+ authority &&
+ !base.username &&
+ !base.password &&
+ new URL(authority[1]).origin === base.origin &&
+ authority[2].startsWith(prefix)
+ ? authority[2].slice(prefix.length)
+ : undefined
+
+ const match = rest && /^(art_[a-zA-Z0-9]+)\/view(?:\/(.*))?$/u.exec(rest)
+ const item = match && parts(`${match[1]}/${match[2] ?? ""}`)
+
+ return item ? `artifact://${item.id}/${item.path}` : undefined
+}
+
+export function artifactAddress(address: string) {
+ return address.startsWith("artifact://") ? parts(address.slice(11)) : undefined
+}
+
+/** A grant translates only its own origin. No page-supplied query, fragment or path becomes an API selector. */
+export function artifactResource(url: string, host: string, id: string) {
+ const prefix = `oc-preview://${host}/`
+
+ if (!url.startsWith(prefix)) return
+ const item = parts(`${id}/${url.slice(prefix.length).split(/[?#]/, 1)[0]}`)
+
+ return item && { display: `artifact://${id}/${item.path}`, route: artifactViewPath(item) }
+}
+
+/** The public link the web app opens in a separate browser tab, without supplying server credentials. */
+export function artifactWebURL(address: string, server: string) {
+ const item = artifactAddress(address)
+
+ if (!item || !URL.canParse(server)) return
+ const base = new URL(server)
+
+ if (!/^https?:$/.test(base.protocol) || base.username || base.password || base.search || base.hash) return
+
+ return `${base.href.replace(/\/+$/, "")}${artifactViewPath(item)}`
+}
diff --git a/packages/gui-plugins/src/browser/artifact-links.ts b/packages/gui-plugins/src/browser/artifact-links.ts
new file mode 100644
index 000000000000..9ff3e52b9cf9
--- /dev/null
+++ b/packages/gui-plugins/src/browser/artifact-links.ts
@@ -0,0 +1,55 @@
+import type { Cdp } from "./cdp"
+import { destinationOrigin } from "./policy"
+
+/** UX only: the native navigation fence and the document's network allowlist do not depend on this script. */
+export function artifactLinks(cdp: Cdp, current: () => string | undefined, offer: (url: string) => void) {
+ const world = "opencode-artifact-links"
+ const binding = "openCodeArtifactLink"
+ const installed = new Map>()
+ let ready: Promise | undefined
+
+ cdp.on("Runtime.bindingCalled", (event, sessionID) => {
+ if (
+ !sessionID &&
+ current() &&
+ event.name === binding &&
+ event.payload.length <= 16384 &&
+ destinationOrigin(event.payload)
+ )
+ offer(event.payload)
+ })
+
+ return (host: string) => {
+ const prior = installed.get(host)
+
+ if (prior) return prior
+ ready ??= cdp.send("Runtime.addBinding", { name: binding, executionContextName: world }).then(() => undefined)
+
+ const install = ready
+ .then(() =>
+ cdp.send("Page.addScriptToEvaluateOnNewDocument", {
+ worldName: world,
+ runImmediately: true,
+ source: `
+ if (location.protocol === 'oc-preview:' && location.host === ${JSON.stringify(host)}) {
+ const external = value => { try { return /^https?:$/.test(new URL(value).protocol) } catch { return false } };
+ addEventListener('click', event => {
+ const url = event.composedPath().find(node => node instanceof HTMLAnchorElement)?.href;
+ if (!url || !external(url)) return;
+ event.preventDefault();
+ if (event.isTrusted) ${binding}(url);
+ }, true);
+ navigation.addEventListener('navigate', event => {
+ if (event.cancelable && external(event.destination.url)) event.preventDefault();
+ });
+ }
+ `,
+ }),
+ )
+ .then(() => undefined)
+
+ installed.set(host, install)
+
+ return install
+ }
+}
diff --git a/packages/gui-plugins/src/browser/artifact-preview.test.ts b/packages/gui-plugins/src/browser/artifact-preview.test.ts
new file mode 100644
index 000000000000..cf13a51f0927
--- /dev/null
+++ b/packages/gui-plugins/src/browser/artifact-preview.test.ts
@@ -0,0 +1,46 @@
+import { afterAll, beforeAll, expect, test } from "bun:test"
+import { GlobalRegistrator } from "@happy-dom/global-registrator"
+import { artifactPages } from "./artifact-preview"
+import { FileVerificationError } from "@opencode/util/file-verification"
+
+beforeAll(() => GlobalRegistrator.unregister())
+
+afterAll(() => GlobalRegistrator.register())
+
+test("preflight asks this server for the entry before allocating a tab or granting bytes", async () => {
+ const server = Bun.serve({
+ hostname: "127.0.0.1",
+ port: 0,
+ fetch(request) {
+ const url = new URL(request.url)
+ expect(request.method).toBe("HEAD")
+ expect(url.searchParams.get("location[directory]")).toBe("/project")
+
+ if (url.pathname === "/api/experimental/artifacts/art_unverified/view/")
+ return new Response(null, { status: 503, headers: { "x-opencode-file-error": "file_verification_unavailable" } })
+
+ return new Response(null, { status: url.pathname === "/api/experimental/artifacts/art_here/view/" ? 200 : 404 })
+ },
+ })
+
+ try {
+ const artifacts = artifactPages(
+ {
+ failure: () => undefined,
+ grant: () => {
+ throw new Error("unexpected grant")
+ },
+ dispose() {},
+ },
+ { id: "server", url: server.url.href, headers: {}, sameMachine: false },
+ "/project",
+ new AbortController().signal,
+ )
+
+ expect(await artifacts.exists("artifact://art_here/")).toBe(true)
+ expect(await artifacts.exists("artifact://art_elsewhere/")).toBe(false)
+ await expect(artifacts.exists("artifact://art_unverified/")).rejects.toBeInstanceOf(FileVerificationError)
+ } finally {
+ await server.stop(true)
+ }
+})
diff --git a/packages/gui-plugins/src/browser/artifact-preview.ts b/packages/gui-plugins/src/browser/artifact-preview.ts
new file mode 100644
index 000000000000..b307a8628a62
--- /dev/null
+++ b/packages/gui-plugins/src/browser/artifact-preview.ts
@@ -0,0 +1,62 @@
+import type { ServerEndpoint } from "@opencode/plugin/gui/main"
+import { artifactAddress, artifactResource, artifactViewPath } from "./artifact-link"
+import type { createPreviews } from "./profile/previews"
+import { FileVerificationError } from "@opencode/util/file-verification"
+
+/** One tab's grants, allocated only by a deliberate load/restore, never by an incoming protocol request. */
+export function artifactPages(
+ previews: ReturnType,
+ server: ServerEndpoint,
+ directory: string,
+ lifetime: AbortSignal,
+) {
+ const grants = new Map>()
+
+ const read = (route: string, method: string, signal: AbortSignal) => {
+ const url = new URL(`${server.url.replace(/\/+$/, "")}${route}`)
+ url.searchParams.set("location[directory]", directory)
+
+ return fetch(url, {
+ headers: server.headers,
+ redirect: "error",
+ method,
+ signal: AbortSignal.any([signal, lifetime]),
+ }).then((response) => FileVerificationError.check(response))
+ }
+
+ return {
+ load(address: string) {
+ const item = artifactAddress(address)
+
+ if (!item) return
+ const grant = grants.get(item.id) ?? previews.grant({ type: "artifact", id: item.id, read }, lifetime)
+ grants.set(item.id, grant)
+
+ return `oc-preview://${grant.host}/${item.path}`
+ },
+ display(url: string) {
+ if (!url.startsWith("oc-preview:")) return
+
+ for (const [id, grant] of grants) {
+ const resource = artifactResource(url, grant.host, id)
+
+ if (resource) return resource.display
+ }
+ },
+ async exists(url: string) {
+ const item = artifactAddress(url)
+
+ // Before opening a tab this also checks a link received in chat, without issuing a grant.
+ if (!item) return false
+
+ return read(artifactViewPath(item), "HEAD", AbortSignal.timeout(15_000)).then(
+ (r) => r.status === 200,
+ (error) => FileVerificationError.orMissing(error) ?? false,
+ )
+ },
+ dispose() {
+ grants.forEach((grant) => grant.release())
+ grants.clear()
+ },
+ }
+}
diff --git a/packages/gui-plugins/src/browser/bar.css b/packages/gui-plugins/src/browser/bar.css
index d6245d388754..9f31c3e4c738 100644
--- a/packages/gui-plugins/src/browser/bar.css
+++ b/packages/gui-plugins/src/browser/bar.css
@@ -112,6 +112,16 @@
color: var(--v2-text-text-base);
}
+ /* Drop path text first. If the authority itself is too long, keep its right edge, not the page-chosen prefix. */
+ [data-slot="browser-address-url"][data-web] {
+ display: flex;
+ width: 100%;
+ [data-slot="browser-address-authority"] { display: flex; flex: none; max-width: 100%; }
+ [data-slot="browser-address-muted"] { flex: none; }
+ [data-slot="browser-address-host"] { direction: rtl; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
+ [data-slot="browser-address-rest"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
+ }
+
/* The page's zoom when it is not 100%, drawn like the zoom badge in the browser options. */
[data-slot="browser-address-zoom"] {
flex: none;
@@ -274,11 +284,34 @@
border-radius: 4px;
}
- /* Centers the icon on the first line of the row's text. */
+ /* The row that leads to "Site settings": a button drawn as a row. */
+ button[data-slot="browser-site-row"] {
+ width: 100%;
+ border: 0;
+ background: none;
+ color: inherit;
+ font: inherit;
+ letter-spacing: inherit;
+ cursor: default;
+
+ &:hover {
+ background: var(--v2-overlay-simple-overlay-hover);
+ }
+
+ &:focus-visible {
+ outline: 1px solid var(--v2-border-border-focus);
+ outline-offset: -1px;
+ }
+ }
+
+ /* The icon column: centers the icon on the first line of the row's text. A control wider than the column, such as
+ the back button, is centered on it too, so its glyph stays in the column. */
[data-slot="browser-site-icon"] {
display: flex;
flex: none;
align-items: center;
+ justify-content: center;
+ width: 16px;
height: 20px;
color: var(--v2-icon-icon-muted);
}
diff --git a/packages/gui-plugins/src/browser/capture.test.ts b/packages/gui-plugins/src/browser/capture.test.ts
new file mode 100644
index 000000000000..22ff0eeba03d
--- /dev/null
+++ b/packages/gui-plugins/src/browser/capture.test.ts
@@ -0,0 +1,160 @@
+import { expect, test } from "bun:test"
+import { CAPTURE_DEADLINE_MS, captureCoordinator, captureScale, cropPixels, FULL_PAGE_DEADLINE_MS, jpegFits, pngFits, undrawable, undrawableMessage } from "./capture"
+
+const shown = { minimized: false, visible: true, appHidden: false }
+
+test("full capture limits include zoom and DPI, after scaling to maxWidth", () => {
+ expect(captureScale({ width: 1000, height: 4000 }, 2, 1000)).toBe(0.5)
+ expect(() => captureScale({ width: 1000, height: 4001 }, 2, 2000)).toThrow("16 megapixels")
+ expect(() => captureScale({ width: 100, height: 16385 }, 1, 1000)).toThrow("16384 pixels")
+})
+
+test("crop uses the returned pixels, including fractional edge overlaps at non-default zoom", () => {
+ // A 200 DIP view rendered at 150% DPI, at page zoom 2: one CSS pixel covers three bitmap pixels.
+ const crop = (x: number, y: number, width: number, height: number) => cropPixels({ x, y, width, height }, { width: 300, height: 240 }, 200, 2)
+ expect(crop(10, 20, 4, 5)).toEqual({ x: 30, y: 60, width: 12, height: 15 })
+ expect(crop(99.95, 79.95, 2, 2)).toEqual({ x: 299, y: 239, width: 1, height: 1 })
+ expect(crop(-2, -2, 2.05, 2.05)).toEqual({ x: 0, y: 0, width: 1, height: 1 })
+ expect(crop(100, 0, 1, 1)).toBeUndefined()
+ expect(crop(0, 80, 1, 1)).toBeUndefined()
+})
+
+function coordinator() {
+ let now = 0
+ const jobs = new Set<{ at: number; run: () => void }>()
+ const events: string[] = []
+
+ const capture = captureCoordinator(() => events.push("begin"), () => events.push("end"), (ms, run) => {
+ const task = { at: now + ms, run }
+ jobs.add(task)
+
+ return () => jobs.delete(task)
+ })
+
+ const advance = (ms: number) => {
+ now += ms
+
+ for (const job of [...jobs].sort((a, b) => a.at - b.at)) {
+ if (job.at > now || !jobs.delete(job)) continue
+ job.run()
+ }
+ }
+
+ return { capture, advance, events, jobs }
+}
+
+test("a full-page redraw keeps its subscription beyond the viewport deadline", async () => {
+ const c = coordinator()
+ const shot = c.capture(false, new AbortController().signal, () => new Promise(() => {}), FULL_PAGE_DEADLINE_MS)
+ c.advance(CAPTURE_DEADLINE_MS)
+ expect(c.events).toEqual(["begin"])
+ // A never-shown tab on macOS took 5.6 s for about 15.6 MP: the deadline leaves it room, inside the tool's 60 s.
+ c.advance(6_000 - CAPTURE_DEADLINE_MS)
+ expect(c.events).toEqual(["begin"])
+ c.advance(FULL_PAGE_DEADLINE_MS - 6_000)
+ await expect(shot).rejects.toThrow("15 seconds")
+ expect(c.events).toEqual(["begin", "end"])
+})
+
+test("overlapping hidden and stalled visible captures share a subscription until the last release", async () => {
+ const c = coordinator()
+ const one = Promise.withResolvers()
+ const two = Promise.withResolvers()
+ const signal = new AbortController().signal
+ const visible = c.capture(true, signal, () => one.promise)
+ c.advance(99)
+ expect(c.events).toEqual([])
+ c.advance(1)
+ expect(c.events).toEqual(["begin"])
+ const hidden = c.capture(false, signal, () => two.promise)
+ one.reject(new Error("navigation"))
+ await expect(visible).rejects.toThrow("navigation")
+ expect(c.events).toEqual(["begin"])
+ two.resolve()
+ await hidden
+ expect(c.events).toEqual(["begin", "end"])
+ expect(c.jobs.size).toBe(0)
+})
+
+test("timeout aborts the redraw and releases once; successful or cancelled visible calls leave no fallback", async () => {
+ const c = coordinator()
+ const controller = new AbortController()
+ const later = Promise.withResolvers()
+ const stopped: boolean[] = []
+
+ const hidden = c.capture(false, controller.signal, stop => {
+ stop.addEventListener("abort", () => stopped.push(true))
+
+ return later.promise
+ })
+
+ expect(c.events).toEqual(["begin"])
+ c.advance(2500)
+ await expect(hidden).rejects.toThrow("No fresh frame")
+ expect(stopped).toEqual([true])
+ later.resolve()
+ await c.capture(true, controller.signal, () => Promise.resolve())
+ const cancelled = c.capture(true, controller.signal, () => new Promise(() => {}))
+ controller.abort()
+ await expect(cancelled).rejects.toThrow("cancelled")
+ c.advance(3000)
+ expect(c.events).toEqual(["begin", "end"])
+ expect(c.jobs.size).toBe(0)
+})
+
+test("reuse the redraw's PNG only when its actual dimensions and transfer size fit", () => {
+ const png = Buffer.alloc(32)
+ png.writeUInt32BE(800, 16)
+ png.writeUInt32BE(600, 20)
+ expect(pngFits(png, 800, 32)).toBe(true)
+ expect(pngFits(png, 799, 32)).toBe(false)
+ expect(pngFits(png, 800, 31)).toBe(false)
+ expect(pngFits(png.subarray(0, 23), 800, 32)).toBe(false)
+ png.writeUInt32BE(0, 20)
+ expect(pngFits(png, 800, 32)).toBe(false)
+})
+
+test("reuse the redraw's JPEG only when its frame header dimensions and transfer size fit", () => {
+ const segment = (marker: number, body: number[]) => [0xff, marker, (body.length + 2) >> 8, (body.length + 2) & 0xff, ...body]
+
+ const frame = (marker: number, width: number, height: number) =>
+ segment(marker, [8, height >> 8, height & 0xff, width >> 8, width & 0xff, 3, 1, 0x22, 0, 2, 0x11, 1, 3, 0x11, 1])
+
+ const jpeg = (...segments: number[][]) => Buffer.from([0xff, 0xd8, ...segments.flat(), 0xff, 0xd9])
+ // JFIF and a Huffman table (0xc4, in the frame-marker range) precede the frame header; the scan follows it.
+ const app = segment(0xe0, [0x4a, 0x46, 0x49, 0x46, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0])
+ const table = segment(0xc4, Array(20).fill(0))
+ const scan = segment(0xda, [1, 1, 0, 0, 0x3f, 0])
+ const image = jpeg(app, table, frame(0xc0, 800, 600), scan)
+ expect(jpegFits(image, 800, image.length)).toBe(true)
+ expect(jpegFits(image, 799, image.length)).toBe(false)
+ expect(jpegFits(image, 800, image.length - 1)).toBe(false)
+ expect(jpegFits(jpeg(app, frame(0xc2, 800, 600), scan), 800, 1_000)).toBe(true)
+ expect(jpegFits(jpeg(app, frame(0xc0, 800, 0), scan), 800, 1_000)).toBe(false)
+ expect(jpegFits(jpeg(app, scan, frame(0xc0, 800, 600)), 800, 1_000)).toBe(false)
+ expect(jpegFits(image.subarray(0, 30), 800, 1_000)).toBe(false)
+ expect(jpegFits(Buffer.from([0x89, 0x50, 0x4e, 0x47]), 800, 1_000)).toBe(false)
+})
+
+test.each([
+ { platform: "darwin", window: shown, expected: undefined },
+ { platform: "darwin", window: { ...shown, minimized: true, visible: false }, expected: "minimized" },
+ { platform: "darwin", window: { ...shown, appHidden: true }, expected: "hidden" },
+ { platform: "darwin", window: { ...shown, visible: false }, expected: "hidden" },
+ // Windows keeps drawing a minimized window, so its screenshot still works.
+ { platform: "win32", window: { ...shown, minimized: true, visible: false }, expected: undefined },
+ { platform: "linux", window: { ...shown, minimized: true }, expected: undefined },
+] as const)("a $platform window $window cannot draw: $expected", ({ platform, window, expected }) => {
+ expect(undrawable({ platform, ...window })).toBe(expected)
+})
+
+test.each(["minimized", "hidden"] as const)("the %s message asks for the window, not the connection", (reason) => {
+ const message = undrawableMessage(reason)
+
+ expect(message).toContain("restore the OpenCode window")
+ expect(message).not.toMatch(/connection|reload|crash/i)
+})
+
+test("a redraw timeout never presents a cached image as a successful capture", () => {
+ expect(undrawableMessage("stalled")).toContain("No cached screenshot was returned")
+})
diff --git a/packages/gui-plugins/src/browser/capture.ts b/packages/gui-plugins/src/browser/capture.ts
new file mode 100644
index 000000000000..f5bb942b428d
--- /dev/null
+++ b/packages/gui-plugins/src/browser/capture.ts
@@ -0,0 +1,158 @@
+/** Why the window cannot draw the tab's next frame, so a screenshot would never finish. */
+export type Undrawable = "minimized" | "hidden" | "stalled"
+
+/** How long a viewport or element capture may wait for the tab's frame before it gives up. */
+export const CAPTURE_DEADLINE_MS = 2_500
+
+/**
+ * A full document may rasterize and encode up to 16 MP before a fresh frame is delivered, and a tab that was never
+ * shown first wakes and paints. About 15.6 MP took up to 1 s on Windows and 5.6 s on macOS, which left a 6 s deadline
+ * no margin. Still well inside the tool's 60 s.
+ */
+export const FULL_PAGE_DEADLINE_MS = 15_000
+
+type Size = { width: number; height: number }
+
+type Rect = Size & { x: number; y: number }
+
+/** Bound both the decoded bitmap (64 MB of RGBA) and the compositor's longest surface edge. */
+export function captureScale(bounds: Size, pixelRatio: number, maxWidth: number) {
+ if (bounds.width <= 0 || bounds.height <= 0) throw new Error("Element or page has no visible screenshot area.")
+ const scale = Math.min(1, maxWidth / (bounds.width * pixelRatio))
+ const width = Math.ceil(bounds.width * pixelRatio * scale)
+ const height = Math.ceil(bounds.height * pixelRatio * scale)
+
+ if (width * height > 16_000_000 || Math.max(width, height) > 16_384)
+ throw new Error("Screenshot exceeds 16 megapixels or 16384 pixels on one edge. Reduce maxWidth or capture the viewport or an element.")
+
+ return scale
+}
+
+/** Intersect in actual bitmap pixels. Round outward so a fractional overlap includes the pixel it touches. */
+export function cropPixels(clip: Rect, image: Size, viewWidth: number, zoom: number) {
+ if (viewWidth <= 0 || clip.width <= 0 || clip.height <= 0) return
+ const ratio = image.width / viewWidth * zoom
+ const x = Math.max(0, Math.floor(clip.x * ratio))
+ const y = Math.max(0, Math.floor(clip.y * ratio))
+ const right = Math.min(image.width, Math.ceil((clip.x + clip.width) * ratio))
+ const bottom = Math.min(image.height, Math.ceil((clip.y + clip.height) * ratio))
+
+ if (right > x && bottom > y) return { x, y, width: right - x, height: bottom - y }
+}
+
+type Schedule = (ms: number, run: () => void) => () => void
+
+const schedule: Schedule = (ms, run) => {
+ const timer = setTimeout(run, ms)
+
+ return () => clearTimeout(timer)
+}
+
+/** One native frame consumer per tab, held only by outstanding captures that need it. */
+export function captureCoordinator(begin: () => void, end: () => void, after: Schedule = schedule) {
+ let holders = 0
+
+ return async (presented: boolean, signal: AbortSignal, redraw: (stop: AbortSignal) => Promise, deadline = CAPTURE_DEADLINE_MS) => {
+ const cancel = () => new Error("Browser capture was cancelled.")
+
+ if (signal.aborted) throw cancel()
+ const stop = new AbortController()
+ const interrupted = Promise.withResolvers()
+
+ const interrupt = (error: Error) => {
+ interrupted.reject(error)
+ stop.abort()
+ }
+
+ const aborted = () => interrupt(cancel())
+ let held = false
+
+ const acquire = () => {
+ if (!holders) begin()
+ holders++
+ held = true
+ }
+
+ // A visible surface may become occluded after the redraw starts.
+ const fallback = presented ? after(100, () => {
+ try {
+ acquire()
+ } catch (error) {
+ interrupt(error instanceof Error ? error : new Error(String(error)))
+ }
+ }) : undefined
+
+ const timeout = after(deadline, () => interrupt(new Error(undrawableMessage("stalled", deadline))))
+ signal.addEventListener("abort", aborted, { once: true })
+
+ try {
+ if (!presented) acquire()
+
+ return await Promise.race([redraw(stop.signal), interrupted.promise])
+ } finally {
+ signal.removeEventListener("abort", aborted)
+ timeout()
+ fallback?.()
+
+ if (held && --holders === 0) end()
+ }
+ }
+}
+
+/** CDP produced a PNG. Read its IHDR dimensions before deciding whether decoding and resizing are necessary. */
+export function pngFits(png: Buffer, maxWidth: number, maxBytes: number) {
+ if (png.length < 24 || png.length > maxBytes) return false
+ const width = png.readUInt32BE(16)
+
+ return width > 0 && width <= maxWidth && png.readUInt32BE(20) > 0
+}
+
+/** CDP produced a JPEG. Read its frame header dimensions, as for a PNG, so the final encoding needs no decode. */
+export function jpegFits(jpeg: Buffer, maxWidth: number, maxBytes: number) {
+ if (jpeg.length < 4 || jpeg.length > maxBytes || jpeg.readUInt16BE(0) !== 0xffd8) return false
+
+ for (let at = 2; at + 9 <= jpeg.length; at += 2 + jpeg.readUInt16BE(at + 2)) {
+ const marker = jpeg[at + 1]
+
+ if (jpeg[at] !== 0xff || marker === 0xd9 || marker === 0xda) return false
+
+ // Start-of-frame markers; 0xc4, 0xc8 and 0xcc share the range but are not frames.
+ if (marker >= 0xc0 && marker <= 0xcf && marker !== 0xc4 && marker !== 0xc8 && marker !== 0xcc) {
+ const width = jpeg.readUInt16BE(at + 7)
+
+ return width > 0 && width <= maxWidth && jpeg.readUInt16BE(at + 5) > 0
+ }
+ }
+
+ return false
+}
+
+/**
+ * macOS stops drawing a minimized window and every window of a hidden app, and a copy of the tab's frame then never
+ * answers. Windows keeps drawing a minimized window, and Linux is left to the capture deadline.
+ */
+export function undrawable(window: {
+ platform: NodeJS.Platform
+ minimized: boolean
+ visible: boolean
+ appHidden: boolean
+}): Undrawable | undefined {
+ if (window.platform !== "darwin") return undefined
+
+ if (window.minimized) return "minimized"
+
+ if (window.appHidden || !window.visible) return "hidden"
+
+ return undefined
+}
+
+const causes: Record, string> = {
+ minimized: "The OpenCode window is minimized, so the system does not draw this tab.",
+ hidden: "OpenCode is hidden, so the system does not draw this tab.",
+}
+
+export function undrawableMessage(reason: Undrawable, deadline = CAPTURE_DEADLINE_MS) {
+ if (reason === "stalled") return `No fresh frame of this tab arrived within ${deadline / 1000} seconds. No cached screenshot was returned. Check that the page has finished navigating and is responsive before retrying.`
+
+ return `${causes[reason]} A screenshot needs the window restored. Ask the user to restore the OpenCode window, then take the screenshot again; do not repeat it before then. Clicks, typing and other browser actions still work.`
+}
diff --git a/packages/gui-plugins/src/browser/child-targets.ts b/packages/gui-plugins/src/browser/child-targets.ts
new file mode 100644
index 000000000000..7997d64063df
--- /dev/null
+++ b/packages/gui-plugins/src/browser/child-targets.ts
@@ -0,0 +1,30 @@
+import type { Cdp } from "./cdp"
+
+/**
+ * Child targets of a tab's page, each paused at start so the tab can guard it (file choosers, media) before it runs.
+ * A dedicated worker is attached too: with `waitForDebuggerOnStart`, Chromium pauses every child worker of the page
+ * whether or not the filter attaches it, and one nobody attaches never starts. Other targets stay unattached.
+ */
+export function attachChildren(cdp: Cdp, sessionID?: string) {
+ return cdp.send(
+ "Target.setAutoAttach",
+ {
+ autoAttach: true,
+ waitForDebuggerOnStart: true,
+ flatten: true,
+ filter: [{ type: "iframe", exclude: false }, { type: "worker", exclude: false }, { exclude: true }],
+ },
+ sessionID,
+ )
+}
+
+/** A worker opens no file chooser and asks for no device: let it run and leave its session. */
+export function releaseWorker(cdp: Cdp, sessionID: string) {
+ return cdp
+ .send("Runtime.runIfWaitingForDebugger", {}, sessionID)
+ .then(() => cdp.send("Target.detachFromTarget", { sessionId: sessionID }))
+ .then(
+ () => undefined,
+ () => undefined,
+ )
+}
diff --git a/packages/gui-plugins/src/browser/choices.tsx b/packages/gui-plugins/src/browser/choices.tsx
new file mode 100644
index 000000000000..54623c48132c
--- /dev/null
+++ b/packages/gui-plugins/src/browser/choices.tsx
@@ -0,0 +1,42 @@
+import { Show } from "solid-js"
+import { usePlugin, type IconName } from "@opencode/plugin/gui"
+import type { ProfileSource } from "./profile/ipc"
+
+/** One profile of an installed browser, as a row or a choice. */
+export type Choice = { readonly source: ProfileSource; readonly profile: ProfileSource["profiles"][number] }
+
+/** One choice per profile with cookies, the browser used last first. */
+export function profileChoices(sources: readonly ProfileSource[]): Choice[] {
+ return sources.flatMap((source) => source.profiles.map((profile) => ({ source, profile })))
+}
+
+/** The browser's name, with the profile's only for a browser that has several. */
+export function choiceLabel(choice: Choice) {
+ return choice.source.profiles.length > 1 ? `${choice.source.name} · ${choice.profile.name}` : choice.source.name
+}
+
+/** Encoded: a select finds its options by value in a CSS selector. */
+export function choiceValue(choice: Choice) {
+ return `${encodeURIComponent(choice.source.id)}:${encodeURIComponent(choice.profile.id)}`
+}
+
+/** A browser's or an extension's own icon, or a muted glyph where it has none. */
+export function Glyph(props: { image?: string; fallback: IconName; class?: string }) {
+ const ctx = usePlugin()
+
+ return (
+
+
+
+ }
+ >
+ {(image) =>
}
+
+ )
+}
diff --git a/packages/gui-plugins/src/browser/chromium.ts b/packages/gui-plugins/src/browser/chromium.ts
index 58db743ef775..d3fde81b14ee 100644
--- a/packages/gui-plugins/src/browser/chromium.ts
+++ b/packages/gui-plugins/src/browser/chromium.ts
@@ -1,19 +1,39 @@
+import { homedir } from "node:os"
+import { scheduler } from "node:timers/promises"
+import { navigationTurn, replacementNavigation } from "./navigation-turn"
+import { accessibilitySnapshot } from "./snapshot"
+import { documentRefs } from "./refs"
+import { describeField, Field, readableField } from "./field-value"
+import { agentRendering, needsWakeFrame } from "./agent-rendering"
+import { extensionResource } from "./profile/extension-api/resource"
import { Browser } from "@opencode/plugin-browser/rpc"
import electron, { type BrowserWindow, type WebContents } from "electron"
import type { Protocol } from "devtools-protocol"
import { Schema } from "effect"
import type { Embeds } from "@opencode/plugin/gui/main"
+import { captureCoordinator, captureScale, cropPixels, FULL_PAGE_DEADLINE_MS, jpegFits, pngFits, undrawable, undrawableMessage } from "./capture"
import { createCdp, abortError, waitFor } from "./cdp"
+import { navigationDeadline } from "./navigation-deadline"
+import { attachChildren, releaseWorker } from "./child-targets"
+import { CodedError, missingArtifact, pageReports } from "./errors"
import { createBrowserFiles } from "./files"
+import { guardFileChoosers } from "./file-choosers"
+import { guardMediaRequests } from "./media-gate"
+import { afterRefusal, agentPasskeyRefusal, guardWebAuthn } from "./webauthn-gate"
+import { cookieSite } from "./profile/sites"
import { createDiagnostics } from "./diagnostics"
import { loadIcon } from "./icon"
-import { pageLetter, pageReload, pageShortcut, type PageShortcut } from "./keys"
+import { agentKeyRefusal, hardwareInput, pageLetter, pageReload, pageShortcut, type PageShortcut } from "./keys"
import {
createDocumentState,
documentGeneration,
documentIcon,
documentTab,
+ frameStillCurrent,
isDocumentClosed,
+ isNavigationPending,
+ leftApprovedSite,
+ retryOnly,
transitionDocument,
type DocumentEvent,
} from "./page-machine"
@@ -33,31 +53,70 @@ import {
selectDialog,
selectDialogTarget,
selectOpenDialog,
+ selectSuppressed,
+ selectUserDialog,
transitionDialogGate,
type DialogGateEvent,
type RunStopReason,
} from "./dialog-machine"
import type { BrowserNetwork } from "./network"
import {
+ agentFrame,
+ agentFrames,
+ agentDriven,
+ childActivity,
+ agentRefusal,
+ activityOwner,
+ recordPageInput,
allowedDestination,
committedLoad,
destinationOrigin,
- fileURLWithin,
+ downloadOwner,
+ excludedFrames,
+ inputDocument,
localFileURL,
normalizeURL,
- refusal,
type Policy,
+ type TabActivity,
} from "./policy"
-import type { PaneElement } from "./ipc"
+import type { PaneElement, PromptView, RefusalNotice } from "./ipc"
+import { navigationNotice, popupActivated } from "./refusal-notice"
+import { noticeActions } from "./notice-actions"
+import { attachPageMenu, type PageMenuHost } from "./native-page-menu"
+import { reloadAddress } from "./preview"
+import { pageHandoff } from "./address"
+import { defaultBrowser } from "./default-browser"
+import { FileVerificationError } from "@opencode/util/file-verification"
+import type { workspacePages } from "./workspace-pages"
+import { artifactLinks } from "./artifact-links"
+import { createPagePrompts, RESTORE_PROMPT, takeDialogs } from "./page-prompts"
+import type { SitePermissions } from "./site-permissions"
+import type { SystemMedia } from "./system-media"
+import { previewScheme } from "./scheme"
+import type { WorkspaceSource } from "./workspace-file"
+import type { artifactPages } from "./artifact-preview"
type Element = { backendID: number; frameID: string; sessionID?: string }
+// A page can retain a removed node. Check in the same renderer call that reads or acts on the ref.
+function connectedFunction(fn: string) {
+ return `function(...args) { if (!this.isConnected) throw new Error('browser.detached_ref'); return (${fn}\n).apply(this,args) }`
+}
+
+function detachedRef() {
+ return new CodedError(Browser.FailureCode.staleRef, "Element is no longer connected. Take a fresh snapshot and choose a current ref.")
+}
+
+const noVisibleArea = "Element has no visible screenshot area. Take a fresh snapshot and choose a visible element, or omit ref to capture the viewport."
+
/** State every page of the pane shares: the element ref allocator and the owner of the app-wide trace. */
export type Shared = { ref: () => string; trace?: SharedTrace }
-// Captures and downloads belong to the tab, not whichever document it now shows; navigate replaces it anyway.
+// Captures and downloads belong to the tab, not whichever document it now shows; navigate replaces it anyway. A wait
+// reads whichever document is current, often the one a click just navigated to.
const retainedOperations: readonly Browser.Method[] = [
"navigate",
+ "wait",
"files.list",
"files.get",
"trace.stop",
@@ -70,6 +129,9 @@ const retainedOperations: readonly Browser.Method[] = [
"heap.compare",
]
+// The user's commands that leave the document, which a page's beforeunload may hold back for "Leave site?".
+const leavable: readonly Browser.Method[] = ["navigate", "back", "forward", "reload"]
+
// Input the page receives while the element picker is on would pick an element instead.
const pointerOperations: readonly Browser.Method[] = [
"click",
@@ -79,7 +141,6 @@ const pointerOperations: readonly Browser.Method[] = [
"fill_form",
"select",
"check",
- "press",
"scroll",
"files.drop",
]
@@ -118,7 +179,7 @@ const inspectOff = { mode: "none", highlightConfig: inspectHighlight }
const zoomSteps = [0.25, 0.33, 0.5, 0.67, 0.75, 0.8, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]
/** A page's icon as a data URL, and its zoom factor, 1 at 100%. */
-export type PageDetail = { icon?: string; zoom: number }
+export type PageDetail = { icon?: string; zoom: number; retryOnly?: boolean }
/** The zoom a key press asks for: the system browser's zoom keys, with the platform's modifier already checked. */
function zoomKey(input: Electron.Input) {
@@ -183,6 +244,7 @@ export function createBrowserPage(
partition: string
network: BrowserNetwork | null
publish: (error?: string) => void
+ refused: (notice: RefusalNotice, token: string, site?: string) => void
/** Reports the element picker starting, stopping, or picking an element. */
inspect?: (event: { active: boolean; element?: PaneElement }) => void
/** Reports the page's icon or zoom changing. */
@@ -193,48 +255,144 @@ export function createBrowserPage(
shortcut?: (shortcut: PageShortcut) => void
/** The page took keyboard focus. */
focused?: () => void
+ /** The page left the screen: another tab or a preview took its place, or the pane closed. */
+ hidden?: () => void
fail: () => void
/** Adopts a page the document opened; a background one leaves the current tab selected. */
- popup: (options: Electron.BrowserWindowConstructorOptions, background: boolean) => WebContents
+ popup: (options: Electron.BrowserWindowConstructorOptions, background: boolean, activity: TabActivity) => WebContents
+ activity: TabActivity
+ userInput: () => void
initialize?: boolean
restore?: Browser.Tab
popupOptions?: Electron.BrowserWindowConstructorOptions
/** Directories whose files may load as file:// documents; empty when the server is remote. */
fileRoots?: () => ReadonlyArray
+ /** This binding's isolated origin for workspace previews. */
+ workspace?: ReturnType
+ /** Failure retained by the protocol handler; Chromium only reports ERR_FAILED for a rejected request. */
+ previewFailure?: (url: string) => typeof FileVerificationError.code | undefined
+ artifacts?: ReturnType
+ remote?: Extract
+ /**
+ * The tab's pop-up group must refuse passkeys too: the agent drives this tab, and a page of the group can script
+ * another through `window.opener` or the window it opened. Windows only.
+ */
+ restrictPasskeys?: () => void
+ /** The tab's pop-up group refuses passkeys already, so this tab does from its first document. */
+ passkeysRestricted?: () => boolean
+ /** The server runs on this machine, so its loopback addresses are this machine's and the system browser reaches them. */
+ local: boolean
+ signal: AbortSignal
+ /** Extensions whose `chrome-extension://` pages may open, such as their popups and options. */
+ extensions?: () => ReadonlyArray
shared: Shared
+ menu: PageMenuHost
embeds: Embeds
+ /** The permission decisions the user kept for sites. */
+ sites: SitePermissions
+ /** The page browses in a remote server's partition, not the profile. */
+ serverPartition?: boolean
+ waitForFilters?: (url: string, signal: AbortSignal) => Promise | undefined
+ /** Reports what the tab waits on the user for, to the window only. */
+ prompt?: (view: PromptView | null) => void
+ /** Closes the tab, after the user chose to leave a page that asked to stay. */
+ closeTab?: () => void
+ /** Gives the page keyboard focus back after a prompt, when its tab is in front. */
+ focusPage?: () => void
+ /** The tab is the one in front of its pane and the app window has the keyboard. */
+ front?: () => boolean
+ /** The system's camera and microphone setting, and its prompt (system-media.ts). */
+ system: SystemMedia
+ /** Logs that an Electron internal is not what the page expects; the pane logs each message once. */
+ warn?: (message: string) => void
},
) {
const policy: Policy = {
+ home: homedir(),
+ remote: options.remote?.prefix,
+ artifacts: !!options.artifacts,
get fileRoots() {
return options.fileRoots?.() ?? []
},
+ get extensions() {
+ return options.extensions?.() ?? []
+ },
}
+ const initial = options.initialize === false ? undefined : normalizeURL(options.restore?.url || "about:blank", policy)
+ // Until this constructor hands back a BrowserPage there is no tab which could dispose these resources.
+ using constructing = new DisposableStack()
+
const view = new electron.WebContentsView({
...options.popupOptions,
webPreferences: {
partition: options.partition,
nodeIntegration: false,
+ // Deliver the profile's CSS receiver to child frames. It runs in the isolated sandbox, not the web world.
+ nodeIntegrationInSubFrames: options.local === true,
contextIsolation: true,
sandbox: true,
webSecurity: true,
webviewTag: false,
devTools: false,
- backgroundThrottling: false,
// Agent navigation, including in hidden tabs, must not take the user's keyboard focus.
focusOnNavigation: false,
},
})
const contents = view.webContents
+ const pageLifetime = new AbortController()
+ contents.once("destroyed", () => pageLifetime.abort())
+ constructing.defer(() => pageLifetime.abort())
+ constructing.defer(() => { if (!contents.isDestroyed()) contents.close({ waitForBeforeUnload: false }) })
+
+ const rendering = agentRendering(pageLifetime.signal, enabled => contents.setBackgroundThrottling(enabled))
+ const opening = agentDriven(options.activity) ? rendering.hold() : undefined
+ constructing.defer(() => options.workspace?.dispose())
+ constructing.defer(() => options.artifacts?.dispose())
+ const preview = (url: string) => options.artifacts?.display(url) ?? options.workspace?.display(url)
+ // Keep the fence across transient blank/error documents. Page JS cannot clear it by navigating itself.
+ let artifactHost: string | undefined
+ const displayURL = (url: string) => preview(url) ?? (/^(?:oc-preview|file):/i.test(url) ? "about:blank" : url)
const detachNetwork = options.network?.attach(contents)
+
+ if (detachNetwork) constructing.defer(detachNetwork)
+ let nativeMenu = true
+ // Tab focus and browser chrome commands also reclaim the tab for the person. Neither is input to this document.
+ let documentInput = false
+ // Presses the agent sent through the debugger that the page has not reported yet.
+ let agentPresses = 0
+ contents.on("before-mouse-event", (_event, mouse) => {
+ if (mouse.type !== "mouseDown") return
+
+ // Unlike keyboard events, Electron 44 does not expose the Blink modifiers on mouse events, so a press carries no
+ // debugger provenance. Each press the agent sent is counted out here, even one reported after its command ended;
+ // any other press while the agent acts stays the agent's. A press during the agent's `wait`, which sends no
+ // input and is not counted as acting, is the person's.
+ if (agentPresses > 0) return void agentPresses--
+
+ if (activity.agentRuns > 0) return
+ documentInput = true
+ nativeMenu = true
+ recordPageInput(activity, "user")
+ options.userInput()
+ void choosers.update().catch(() => undefined)
+ })
contents.on("before-input-event", (event, input) => {
- if (input.type !== "keyDown") return
+ const hardware = hardwareInput(input)
+ contents.setIgnoreMenuShortcuts(!hardware)
+
+ if (!hardware || input.type !== "keyDown") return
+
+ documentInput = true
+ nativeMenu = true
+ recordPageInput(activity, "user")
+ options.userInput()
+ void choosers.update().catch(() => undefined)
if (pageReload(input, process.platform === "darwin")) {
event.preventDefault()
- contents.reload()
+ void options.menu.navigate("reload").catch((error: Error) => { if (!pageReports(error)) publish(error.message) })
return
}
@@ -250,6 +408,7 @@ export function createBrowserPage(
if (shortcut) {
event.preventDefault()
+
options.shortcut?.(shortcut)
return
@@ -285,6 +444,12 @@ export function createBrowserPage(
let documentState = createDocumentState(options.restore)
const closed = () => isDocumentClosed(documentState)
+
+ const withFrames = captureCoordinator(
+ () => contents.beginFrameSubscription(true, () => {}),
+ () => { if (!contents.isDestroyed()) contents.endFrameSubscription() },
+ )
+
let reported = ""
const detail = () => {
@@ -294,7 +459,9 @@ export function createBrowserPage(
const icon = documentIcon(documentState)
if (icon) next.icon = icon
- const key = `${next.zoom}:${next.icon ?? ""}`
+
+ if (retryOnly(documentState)) next.retryOnly = true
+ const key = `${next.zoom}:${next.icon ?? ""}:${!!next.retryOnly}`
if (key === reported) return
reported = key
@@ -303,11 +470,15 @@ export function createBrowserPage(
const cdp = createCdp(contents)
const documents = new Map()
- const sourceURLs = () => [...new Set([contents.getURL(), ...documents.values()])].sort()
+ const sourceURLs = () => [...new Set([state().url, ...documents.values()])].sort()
const files = createBrowserFiles(sourceURLs)
- const diagnostics = createDiagnostics(cdp)
+ constructing.defer(() => void files.dispose().catch(() => undefined))
+
+ const diagnostics = createDiagnostics(cdp, displayURL, (id, sessionID) =>
+ Array.from(contexts.values()).some((context) => context.id === id && context.sessionID === sessionID))
+
const profiling = createProfiling(contents, cdp, files, sourceURLs, options.shared)
- const refs = new Map()
+ const refs = documentRefs()
// Elements the user picked. Their refs outlive later snapshots, so a comment keeps pointing at
// the element until the document changes.
const picked = new Map()
@@ -316,32 +487,84 @@ export function createBrowserPage(
const sessions = new Map()
const parents = new Map()
const contexts = new Map()
+ // Frames that show an extension's document, which no agent frameID may reach: an extension's out-of-process frame by
+ // the session it attached with (a web frame's own session may detach after its replacement attached), and a frame
+ // whose document has an extension's origin.
+ const extensionTargets = new Map()
+ const extensionContexts = new Set()
+ const extensionFrames = () => new Set([...extensionTargets.values(), ...extensionContexts])
+
+ const attachFrames = (sessionID?: string) => attachChildren(cdp, sessionID)
+
+ const activity = options.activity
+
+ const notices = noticeActions((notice, token) => options.refused(notice, token, destinationOrigin(contents.getURL())), {
+ tab: options.menu.open,
+ app: (url) => electron.shell.openExternal(url),
+ copy: (url) => electron.clipboard.writeText(url),
+ })
+
+ constructing.defer(notices.clear)
+ const registerArtifactLinks = artifactLinks(cdp, () => artifactHost, target => notices.show({reason:"popup",target,action:"tab"}))
+ const refused = (url: string) => notices.show(navigationNotice(url, policy, activityOwner(activity), documentInput))
+ let popupReport: Protocol.Page.WindowOpenEvent | undefined
+ cdp.on("Page.windowOpen", (event) => { popupReport = event })
let dialogGate = createDialogGateState()
// Running commands by run id: the controller that stops their remaining steps, and the wait an interruption ends.
- const runs = new Map()
+ const runs = new Map()
+
+ const choosers = guardFileChoosers(cdp, activity, message => {
+ for (const run of runs.values()) {
+ if (run.origin !== "agent") continue
+ run.interrupted.reject(new Error(message))
+ run.controller.abort()
+ }
+ })
+
+ // Set the nested auto-attach policy before the new renderer can create its own children.
+ const prepareFrame = async (sessionID: string) => {
+ try {
+ await Promise.all([attachFrames(sessionID), choosers.attach(sessionID), media.attach(sessionID), passkeys.attach(sessionID)])
+ await cdp.send("Runtime.runIfWaitingForDebugger", {}, sessionID)
+ } catch {
+ // A detached target needs no resumption. A live one must not run unguarded or remain invisibly paused.
+ if (!closed() && (extensionTargets.has(sessionID) || Array.from(sessions.values()).includes(sessionID))) options.fail()
+ }
+ }
+
let revision = 0
cdp.on("Page.frameNavigated", ({ frame }) => {
- documents.set(frame.id, frame.url)
+ documents.set(frame.id, displayURL(frame.url))
revision++
})
- cdp.on("Page.frameDetached", ({ frameId }) => {
+ cdp.on("Page.frameDetached", ({ frameId, reason }) => {
documents.delete(frameId)
revision++
+
+ // A swap moves the frame to another process, where it may now show an extension's document; keep what is known.
+ if (reason === "remove") extensionContexts.delete(frameId)
})
- const state = () =>
+ const state = (display = false) =>
documentTab(documentState, {
id: options.id,
canGoBack: contents.navigationHistory.canGoBack(),
canGoForward: contents.navigationHistory.canGoForward(),
- })
+ }, display)
// Every state report goes through here, so a page that was disposed publishes nothing.
+ // While a user's close asks the page's beforeunload on a blank load, the tab reports nothing: the blank page is not
+ // where it is, and a close or a window that goes meanwhile keeps its real address for restore.
+ let quiet = false
+
const publish = (error?: string) => {
- if (!closed()) options.publish(error)
+ if (!closed() && !quiet) options.publish(error)
}
+ let startingBlank = false
+
const dispatch = (event: DocumentEvent) => {
+ if (startingBlank && event.type !== "disposed") return
const next = transitionDocument(documentState, event)
documentState = next.state
next.effects.forEach((effect) => {
@@ -368,7 +591,8 @@ export function createBrowserPage(
break
case "load-icon":
// Never rejects: an icon that does not load is none.
- void loadIcon(effect.favicons, options.network).then((icon) =>
+ // Main's icon fetch is outside the page's network policy. Never proxy an artifact's candidates for it.
+ void loadIcon(effect.favicons, artifactHost ? null : options.network).then((icon) =>
dispatch({ type: "icon.loaded", attempt: effect.attempt, icon }),
)
}
@@ -379,7 +603,14 @@ export function createBrowserPage(
const next = transitionDialogGate(dialogGate, event)
dialogGate = next.state
next.effects.forEach((effect) => {
- if (effect.type === "publish") return publish()
+ if (effect.type === "publish") {
+ prompts.publish()
+
+ return publish()
+ }
+
+ if (effect.type === "dismiss")
+ return void cdp.send("Page.handleJavaScriptDialog", { accept: false }).catch(() => undefined)
const run = runs.get(effect.runID)
if (!run) return
@@ -389,30 +620,173 @@ export function createBrowserPage(
run.interrupted.reject(runStopError(effect.reason))
})
- return next.reply
+ return next
+ }
+
+ // The user's answer to a page dialog, unless the agent answers it first.
+ const answerDialog = async (revision: number, accept: boolean, text: string, stop: boolean) => {
+ if (dispatchDialog({ type: "dialog.answering", revision, by: "user" }).answer !== "accepted") return
+
+ if (stop) dispatchDialog({ type: "dialog.suppressed" })
+ await cdp.send("Page.handleJavaScriptDialog", { accept, promptText: text }).then(
+ () => void dispatchDialog({ type: "dialog.handled", revision, at: Date.now() }),
+ () => void dispatchDialog({ type: "dialog.answer-failed", revision }),
+ )
+ }
+
+ // Page dialogs, permission requests, sign-ins and "Leave site?" wait for the user in the pane; see page-prompts.ts.
+ const dialogs = takeDialogs(contents, {
+ suppressed: () => selectSuppressed(dialogGate),
+ opened: () => !!selectOpenDialog(dialogGate),
+ // The dialog shows at once; its frame's origin names it once Electron reports it.
+ framed: () => prompts.publish(),
+ warn: (message) => options.warn?.(message),
+ })
+
+ // Set while a prompt hides the page's view and the page should get the keyboard back once the view shows.
+ let refocus = false
+
+ const prompts = createPagePrompts({
+ contents,
+ scope: options.serverPartition ? { kind: "server", partition: options.partition } : { kind: "profile" },
+ sites: options.sites,
+ // Sticky: site permissions, clipboard writes and where a prompt puts focus.
+ agentDriven: () => agentDriven(activity),
+ top: () => state().url,
+ dialog: () => selectUserDialog(dialogGate),
+ dialogFrame: () => dialogs.frame(),
+ answerDialog: (revision, answer) => answerDialog(revision, answer.accept, answer.text, answer.stop),
+ redo: (action) => execute(action, [], new AbortController().signal, "user").then(() => undefined, () => undefined),
+ close: () => options.closeTab?.(),
+ // A page that held the keyboard before a prompt gets it back once its view shows again: a dialog's still hides the
+ // view until the page draws, and a hidden view cannot take focus.
+ focusPage: () => {
+ refocus = !view.getVisible()
+
+ if (!refocus) options.focusPage?.()
+ },
+ front: () => !!options.front?.(),
+ returning: () => refocus,
+ system: options.system,
+ quiet: (value) => {
+ quiet = value
+
+ if (!value) publish()
+ },
+ report: (view) => {
+ if (!closed()) options.prompt?.(view)
+ },
+ })
+
+ // A page's getUserMedia waits for the pane before Blink opens a device, so macOS asks only after the user's Allow.
+ const media = guardMediaRequests(cdp, (ask) => prompts.gate(ask))
+ // A site's passkey or security-key request fails where nothing here could answer it: always on macOS and Linux, and on
+ // Windows, whose own dialog would answer, in tabs the agent drives or could script. Once per page, the notice says
+ // why and a running agent command stops with the reason.
+ const native = process.platform === "win32"
+ const passkeyPage = { noticed: false, interrupted: false }
+
+ const passkeys = guardWebAuthn(cdp, {
+ native,
+ refused: (asker) => {
+ // Another site's frame does not speak for the page: its request is refused without a word.
+ if (!asker.mainFrame && (!asker.origin || asker.origin !== contents.mainFrame.origin)) return
+ const address = URL.parse(displayURL(contents.getURL()))
+
+ // Any agent command in flight stops, a `wait` included, which `agentRuns` leaves out.
+ if (!passkeyPage.interrupted && Array.from(runs.values()).some((run) => run.origin === "agent")) {
+ passkeyPage.interrupted = true
+ prompts.interruptAgent(new CodedError(Browser.FailureCode.signInRequired, agentPasskeyRefusal(address?.host)))
+ }
+
+ if (passkeyPage.noticed) return
+ passkeyPage.noticed = true
+ const site = address?.hostname ? cookieSite(address.hostname) : undefined
+ // On Windows only an enforced tab refuses, and a new tab of the person's would reach the system's dialog.
+ const reason = native ? "browser.passkey.off" : agentDriven(activity) ? "browser.passkey.agent" : "browser.passkey"
+ notices.show(site && site.length <= 255 ? { reason, site } : { reason })
+ },
+ })
+
+ // A page that can never reach the system's dialog, or one the agent drove or could script, refuses in the browser
+ // process before its first document loads. On Windows a failure to do so, whenever it happens, leaves it with the
+ // system's dialog, so the tab fails.
+ const restrictPasskeys = () => {
+ if (native) options.restrictPasskeys?.()
+
+ const enforcing = passkeys.enforce()
+
+ if (native) void enforcing.catch(() => options.fail())
+
+ return enforcing
+ }
+
+ if (!native || agentDriven(options.activity) || options.passkeysRestricted?.())
+ void restrictPasskeys().catch(() => undefined)
+
+ constructing.defer(() => prompts.dispose())
+ constructing.defer(() => dialogs.dispose())
+
+ // Chromium uses the document URL as the title of untitled files; don't persist its internal origin as a title.
+ const pageTitle = (address = state().url) => {
+ const title = contents.getTitle()
+
+ if (documentState.status !== "closed" && documentState.retry && (!title || title === "about:blank"))
+ return documentState.title || documentState.retry
+
+ return /^oc-preview:/i.test(title) ? address : title
}
contents.on("did-start-loading", () => dispatch({ type: "loading.started" }))
- contents.on("did-stop-loading", () => dispatch({ type: "loading.stopped", title: contents.getTitle() }))
- contents.on("did-start-navigation", (event) =>
+ contents.on("did-stop-loading", () => dispatch({ type: "loading.stopped", title: pageTitle() }))
+ contents.on("did-start-navigation", (event) => {
+ // A load no frame started (the address bar, a link from the conversation, history) may redirect before it commits.
+ // Input in the page it leaves is not input in the page that redirects.
+ if (event.isMainFrame && !event.isSameDocument && !event.initiator) documentInput = false
+ navigation.nativeStart(event)
dispatch({
type: "navigation.started",
- url: event.url,
+ url: displayURL(event.url),
isMainFrame: event.isMainFrame,
isSameDocument: event.isSameDocument,
- }),
- )
+ })
+ })
contents.on("did-navigate", (_event, url, status, statusText) =>
- dispatch({ type: "navigation.committed", url, status, statusText, title: contents.getTitle() }),
+ dispatch({ type: "navigation.committed", url: displayURL(url), status, statusText, title: pageTitle(displayURL(url)) }),
)
+ contents.on("did-navigate", () => {
+ documentInput = false
+ const url = contents.getURL()
+
+ if (options.artifacts?.display(url)) artifactHost = new URL(url).host
+ notices.clear()
+ passkeyPage.noticed = false
+ passkeyPage.interrupted = false
+ popupReport = undefined
+
+ rendering.committed()
+ })
contents.on("did-fail-load", (_event, code, description, url, isMainFrame) =>
- dispatch({ type: "navigation.failed", code, description, url, isMainFrame }),
- )
- contents.on("did-navigate-in-page", (_event, url, isMainFrame) =>
- dispatch({ type: "navigation.in-page", url, title: contents.getTitle(), isMainFrame }),
+ dispatch({ type: "navigation.failed", code, description: options.previewFailure?.(url) ?? (options.artifacts?.display(url) ? "browser.artifact.missing" : options.remote?.needsUpdate?.() && preview(url)?.startsWith("workspace:") ? "browser.preview.unsupported" : description), url, preview: preview(url), isMainFrame }),
)
+ contents.on("did-navigate-in-page", (_event, url, isMainFrame) => {
+ if (!isMainFrame) return
+ documentInput = false
+ const report = (address: string) => dispatch({ type: "navigation.in-page", url: address, title: pageTitle(address), isMainFrame })
+
+ if (!/^(?:oc-preview|file):/i.test(url)) return report(url)
+ const file = preview(url)
+
+ if (!file) return
+ // History API routes never pass the protocol handler. Keep the last validated address for virtual routes.
+ const exists = file.startsWith("artifact:") ? options.artifacts?.exists(file) : options.workspace?.exists(url, options.signal)
+
+ void Promise.resolve(exists).catch(() => false).then((target) => {
+ if (target && !closed() && !contents.isDestroyed() && contents.getURL() === url) report(file)
+ })
+ })
contents.on("dom-ready", () => dispatch({ type: "document.ready" }))
- contents.on("page-title-updated", () => dispatch({ type: "title.updated", title: contents.getTitle() }))
+ contents.on("page-title-updated", () => dispatch({ type: "title.updated", title: pageTitle() }))
contents.on("page-favicon-updated", (_event, favicons) => dispatch({ type: "icon.updated", favicons }))
contents.on("focus", () => {
if (!closed()) options.focused?.()
@@ -423,53 +797,107 @@ export function createBrowserPage(
contents.debugger.on("detach", () => {
if (!closed()) options.fail()
})
- contents.session.setPermissionRequestHandler((_contents, _permission, callback) => callback(false))
- contents.session.setPermissionCheckHandler(() => false)
- contents.session.setDevicePermissionHandler(() => false)
- contents.session.setDisplayMediaRequestHandler((_request, callback) => callback({}))
contents.on("content-bounds-updated", (event) => event.preventDefault())
// Sub-frames keep Chromium's own rules so blob:/data: viewers and sandboxed previews still load,
// except file: documents, which must stay inside the allowed roots at every depth.
- const guard = (event: Electron.Event<{ url: string; isMainFrame: boolean }>) => {
+ const resource = (url: string, origin: string) => extensionResource(url, origin, (id) => contents.session.extensions.getExtension(id))
+
+ const guard = (event: Electron.Event) => {
+ if (artifactHost && !event.url.startsWith(`oc-preview://${artifactHost}/`)) {
+ event.preventDefault()
+
+ if (event.isMainFrame && destinationOrigin(event.url)) notices.show({reason:"popup", target:event.url.slice(0,16384), action:event.url.length <= 16384 ? "tab" : undefined})
+
+ return
+ }
+
+ if (URL.parse(event.url)?.protocol === "chrome-extension:" && !resource(event.url, event.initiator?.origin ?? "")) {
+ event.preventDefault()
+
+ return refused(event.url)
+ }
+
if (event.url === "about:blank") return
- if (event.isMainFrame ? allowedDestination(event.url, policy) : !localFileURL(event.url)) return
+ const local = /^file:/i.test(event.url) || event.url.toLowerCase().startsWith(`${previewScheme}:`)
+
+ if (local && preview(event.url)) return
- if (!event.isMainFrame && fileURLWithin(event.url, policy.fileRoots ?? [])) return
+ if (!local && (allowedDestination(event.url, policy) || (!event.isMainFrame && /^(?:blob:|data:|about:srcdoc$)/i.test(event.url)))) return
event.preventDefault()
// The same reason a typed address gets, so a blocked link and a blocked address read alike.
- publish(refusal(event.url, policy) ?? "ERR_BLOCKED_BY_CLIENT")
+ refused(event.url)
}
contents.on("will-frame-navigate", guard)
contents.on("will-redirect", guard)
// Links opened with Cmd or Ctrl arrive as background tabs, and stay behind the current one as in the system browser.
- contents.setWindowOpenHandler(({ url, disposition }) =>
- url === "about:blank" || destinationOrigin(url)
- ? {
- action: "allow",
- outlivesOpener: true,
- overrideBrowserWindowOptions: {
- webPreferences: {
- nodeIntegration: false,
- contextIsolation: true,
- sandbox: true,
- webSecurity: true,
- webviewTag: false,
- devTools: false,
- // Electron applies these preferences before the popup is adopted by our view.
- focusOnNavigation: false,
- partition: options.partition,
- },
- },
- createWindow: (popupOptions) => options.popup(popupOptions, disposition === "background-tab"),
- }
- : { action: "deny" },
- )
+ contents.setWindowOpenHandler(({ url, disposition, postBody, referrer }) => {
+ const activated = popupActivated(popupReport, url)
+ popupReport = undefined
- const download = (_event: Electron.Event, item: Electron.DownloadItem, source: WebContents) => {
- if (source !== contents) return
+ if (artifactHost) {
+ if (!postBody && destinationOrigin(url) && url.length <= 16384) notices.show({reason:"popup",target:url,action:"tab"})
+
+ return { action: "deny" }
+ }
+
+ if (url !== "about:blank" && !destinationOrigin(url) && !resource(url, referrer.url) && !preview(url)) {
+ refused(url)
+
+ return { action: "deny" }
+ }
+
+ if (!activated) {
+ const target = displayURL(url)
+ const replay = !postBody && target.length <= 16384 && (!!destinationOrigin(target) || !!preview(url))
+ notices.show(replay ? { reason: "popup", target, action: "tab" } : { reason: "popup", target: target.slice(0, 16384) })
+
+ return { action: "deny" }
+ }
+
+ const workspace = options.workspace?.display(url)
+
+ if (workspace && !postBody) {
+ void options.menu.open(workspace).catch(() => publish("browser.menu.failed"))
+
+ return { action: "deny" }
+ }
+
+ return {
+ action: "allow",
+ outlivesOpener: true,
+ overrideBrowserWindowOptions: {
+ webPreferences: {
+ nodeIntegration: false,
+ nodeIntegrationInSubFrames: options.local === true,
+ contextIsolation: true,
+ sandbox: true,
+ webSecurity: true,
+ webviewTag: false,
+ devTools: false,
+ // Electron applies these preferences before the popup is adopted by our view.
+ focusOnNavigation: false,
+ partition: options.partition,
+ },
+ },
+ createWindow: (popupOptions) => options.popup(popupOptions, disposition === "background-tab", childActivity(activity)),
+ }
+ })
+
+ // Called from the session's one download listener (`guardSession`) for a download this page started. One the user
+ // started is left to the system's save flow, so it goes where they save it and the agent never reads it.
+ const download = (item: Electron.DownloadItem) => {
+ const owner = downloadOwner({
+ ...activity,
+ page: [contents.mainFrame.url, contents.mainFrame.origin],
+ chain: item.getURLChain(),
+ })
+
+ if (owner === "user") return
+
+ if (owner === "block") return item.cancel()
try {
const file = files.add(item.getFilename(), item.getMimeType() || "application/octet-stream", [
@@ -493,20 +921,59 @@ export function createBrowserPage(
}
}
- contents.session.on("will-download", download)
cdp.on("Runtime.executionContextCreated", ({ context }, sessionID) => {
// SAFETY: CDP documents a page execution context's auxData as `{ frameId, isDefault, type }`.
const aux = context.auxData as { frameId?: string; isDefault?: boolean } | undefined
- if (aux?.frameId && aux.isDefault) contexts.set(aux.frameId, { id: context.id, sessionID })
+ if (!aux?.frameId || !aux.isDefault) return
+
+ // A frame that becomes an extension's document, as about:blank opened by one does, is no target for the agent.
+ if (Browser.extensionOrigin(context.origin)) {
+ contexts.delete(aux.frameId)
+ extensionContexts.add(aux.frameId)
+ const own = sessions.get(aux.frameId)
+
+ // An out-of-process web frame that turned into one in place leaves the frame list and stops reporting its console
+ // and network. It stays refused until the page removes it, even if it shows a web page again.
+ if (own) {
+ sessions.delete(aux.frameId)
+ parents.delete(aux.frameId)
+ void cdp.send("Target.detachFromTarget", { sessionId: own }).catch(() => undefined)
+ }
+
+ return
+ }
+
+ contexts.set(aux.frameId, { id: context.id, sessionID })
+ extensionContexts.delete(aux.frameId)
})
cdp.on("Runtime.executionContextDestroyed", ({ executionContextId }, sessionID) => {
contexts.forEach((context, key) => {
if (context.id === executionContextId && context.sessionID === sessionID) contexts.delete(key)
})
})
+ cdp.on("Runtime.executionContextsCleared", (_event, sessionID) => {
+ contexts.forEach((context, key) => { if (context.sessionID === sessionID) contexts.delete(key) })
+ })
cdp.on("Target.attachedToTarget", ({ sessionId, targetInfo }, parentSessionID) => {
+ // Paused at start by the auto-attach above; it must run, as it did before the tab guarded its children.
+ if (targetInfo.type === "worker") return void releaseWorker(cdp, sessionId)
+
if (targetInfo.type !== "iframe") return
+
+ // An extension's frame, such as an autofill overlay, stays out of `sessions`: no frame list, snapshot, picker or
+ // diagnostics reaches it. Site isolation gives it a process, and so a target, of its own. The context its first
+ // document had in the embedding page's process is dropped, so its frameID cannot reach that page instead.
+ if (Browser.extensionOrigin(targetInfo.url) || (parentSessionID && extensionTargets.has(parentSessionID)) ||
+ (targetInfo.parentFrameId && extensionContexts.has(targetInfo.parentFrameId))) {
+ extensionTargets.set(sessionId, targetInfo.targetId)
+ contexts.delete(targetInfo.targetId)
+ // Descendant iframe targets are excluded even if their own document is a web page. Do not enable diagnostics.
+ void prepareFrame(sessionId)
+
+ return
+ }
+
const parentID = targetInfo.parentFrameId ?? Array.from(sessions).find(([, id]) => id === parentSessionID)?.[0]
if (parentID) parents.set(targetInfo.targetId, parentID)
@@ -514,16 +981,7 @@ export function createBrowserPage(
void Promise.all([
diagnostics.enable(sessionId),
cdp.send("Page.enable", {}, sessionId),
- cdp.send(
- "Target.setAutoAttach",
- {
- autoAttach: true,
- waitForDebuggerOnStart: false,
- flatten: true,
- filter: [{ type: "iframe", exclude: false }, { exclude: true }],
- },
- sessionId,
- ),
+ prepareFrame(sessionId),
]).catch(() => undefined)
void dispatchPicker({ type: "frame.attached", sessionID: sessionId })
})
@@ -533,6 +991,10 @@ export function createBrowserPage(
({ backendNodeId }, sessionID) => void dispatchPicker({ type: "node.picked", backendID: backendNodeId, sessionID }),
)
cdp.on("Target.detachedFromTarget", ({ sessionId }) => {
+ choosers.detach(sessionId)
+ // Only the session that showed the extension's document clears it: the frame keeps its target ID across a swap, and
+ // the web session it replaced may detach after the extension's attached.
+ extensionTargets.delete(sessionId)
sessions.forEach((id, frameID) => {
if (id === sessionId) {
sessions.delete(frameID)
@@ -543,65 +1005,231 @@ export function createBrowserPage(
cdp.on("Page.javascriptDialogOpening", (event) =>
dispatchDialog({
type: "dialog.opened",
- url: event.url,
+ url: displayURL(event.url),
dialogType: event.type,
message: event.message.slice(0, Browser.MAX_TEXT),
defaultPrompt: event.defaultPrompt ?? "",
+ at: Date.now(),
}),
)
- cdp.on("Page.javascriptDialogClosed", () => dispatchDialog({ type: "dialog.closed" }))
+ cdp.on("Page.javascriptDialogClosed", () => {
+ dialogs.closed()
+ dispatchDialog({ type: "dialog.closed", at: Date.now() })
+ })
+ contents.on("did-navigate", () => dispatchDialog({ type: "document.committed" }))
// Hidden tabs keep a desktop-sized viewport until the renderer lays the embed out.
view.setBounds({ x: 0, y: 0, width: 1000, height: 700 })
const embed = options.embeds.create(view, win)
+ constructing.defer(() => embed.dispose())
+
+ const handoff = () => {
+ if (closed() || contents.isDestroyed()) return
+ const tab = state()
+ const actual = contents.getURL()
+
+ return pageHandoff(actual, displayURL(actual), tab.url, !!tab.loadError, options.local)
+ }
+
+ const openPage = async (expected: string) => {
+ const target = handoff()
+
+ if (!target || target.url !== expected) throw new Error("browser.menu.failed")
+
+ if (target.kind === "web") return electron.shell.openExternal(target.url)
+
+ const actual = contents.getURL()
+ const launch = await defaultBrowser()
+
+ const opened = await options.workspace?.external(actual, async (file) => {
+ if (handoff()?.url !== expected || contents.getURL() !== actual) throw new Error("browser.menu.failed")
+ await launch(file)
+ })
+
+ if (!opened) throw new Error("browser.menu.failed")
+ }
+
+ const personCommand = () => {
+ recordPageInput(activity, "user")
+ options.userInput()
+ void choosers.update().catch(() => undefined)
+ }
+
+ const menu = attachPageMenu(win, contents, {
+ ...options.menu,
+ personCommand,
+ canOpenPage: () => !!handoff(),
+ openPage: () => openPage(state().url),
+ open: (url) => {
+ const current = contents.getURL()
+
+ if (options.workspace?.host(current) && /^(?:file|workspace):/.test(url) && !options.workspace.permits(current, url)) {
+ notices.show({reason:"browser.preview.restricted"})
+
+ return Promise.resolve()
+ }
+
+ return options.menu.open(url)
+ },
+ policy: {
+ get fileRoots() { return policy.fileRoots },
+ get extensions() { return policy.extensions },
+ remote: policy.remote,
+ get previewHost() { return options.workspace?.host(contents.getURL()) },
+ local: options.local,
+ },
+ cdp,
+ sessions: () => sessions.values(),
+ available: () => nativeMenu && !closed() && view.getVisible() && activity.agentRuns === 0,
+ failed: () => publish("browser.menu.failed"),
+ })
+
+ constructing.defer(() => menu.dispose())
+
// A hidden page cannot be picked from, and a comment's frozen still already shows the
// picked element, so hiding ends the picker, any pick in progress, and the highlight.
embed.on("visible", (visible) => {
- if (!visible) void dispatchPicker({ type: "embed.hidden" })
+ if (visible) {
+ // Not while a prompt still shows: the view shows between two dialogs, and the next one takes the keyboard.
+ if (refocus && !prompts.showing()) {
+ refocus = false
+ options.focusPage?.()
+ }
+
+ return
+ }
+
+ menu.close()
+ void dispatchPicker({ type: "embed.hidden" })
+
+ if (!closed()) options.hidden?.()
+ })
+
+ const navigation = navigationTurn(options.waitForFilters, url => {
+ dispatch({ type: "navigation.started", url, isMainFrame: true, isSameDocument: false })
+ dispatch({ type: "loading.started" })
+ }, () => { if (!closed()) dispatch({ type: "loading.stopped", title: pageTitle() }) }, address => {
+ dispatch({ type: "navigation.held-stopped", address })
})
- const load = (url: string) => {
+ const begin = (signal = options.signal, keepAddress = false) => navigation.begin(AbortSignal.any([pageLifetime.signal, signal, options.signal]), keepAddress)
+
+ const load = async (url: string, retry = false, commandSignal = options.signal, keepAddress = true) => {
+ const visit = begin(commandSignal, keepAddress)
+ const destination = url.startsWith("artifact:") ? options.artifacts?.load(url) : localFileURL(url) || url.startsWith("workspace:") ? await options.workspace?.load(url, (guarded) => notices.show({reason: guarded ? "browser.preview.agentRestricted" : "browser.preview.restricted"}), retry ? contents.getURL() : undefined) : url
+
+ if (!destination) return Promise.reject(new Error("Workspace preview is unavailable."))
+
+ return visit(destination, () => loadDestination(destination, url))
+ }
+
+ const loadDestination = (destination: string, url: string) => {
+ if (options.artifacts?.display(destination)) {
+ artifactHost = new URL(destination).host
+ contents.setWebRTCIPHandlingPolicy("disable_non_proxied_udp")
+ // On first restore Chromium has no renderer yet. Its binding cannot answer until loadURL starts it.
+ // The script only offers links; the native navigation and network fences above apply before the load.
+ void registerArtifactLinks(artifactHost).catch(() => options.warn?.("Artifact link offers are unavailable"))
+ }
+
let committed = false
const commit = () => {
committed = true
+
+ // Only a successful navigation directed by browser chrome (this loadURL), not a renderer callback, may leave.
+ if (!options.artifacts?.display(destination)) artifactHost = undefined
}
contents.once("did-navigate", commit)
+ const next = replacementNavigation()
+ contents.on("did-start-navigation", next.start)
+ contents.on("did-navigate", next.commit)
+ contents.on("did-stop-loading", next.stop)
+ contents.once("destroyed", next.stop)
+
+ return navigationDeadline(contents.loadURL(destination).catch(async (error: Error) => {
+ if (committedLoad(error, committed)) return
+
+ if (destinationOrigin(destination) && await next.after(error)) return
+
+ if (options.previewFailure?.(destination)) throw new FileVerificationError()
+
+ if (destination.startsWith(`${previewScheme}://`))
+ throw new CodedError(Browser.FailureCode.previewUnavailable, `The preview could not be loaded: ${url}`)
+
+ if (!committed && "errno" in error && (error.errno === -2 || error.errno === -3))
+ throw new CodedError("navigation_failed", "No page committed. The navigation was cancelled, failed, or became a download. Check the tab and its downloads before navigating again.")
+ throw error
+ })).finally(() => {
+ next.stop()
+ contents.off("destroyed", next.stop)
+ contents.off("did-stop-loading", next.stop)
+ contents.off("did-navigate", next.commit)
+ contents.off("did-start-navigation", next.start)
+ contents.off("did-navigate", commit)
+ })
+ }
- return contents
- .loadURL(url)
- .catch((error: Error) => {
- if (!committedLoad(error, committed)) throw error
- })
- .finally(() => contents.off("did-navigate", commit))
+ const reload = async (signal = options.signal, ignoreCache = false) => {
+ const tab = state()
+
+ if (documentState.status !== "closed" && documentState.retry) return load(documentState.retry, true, signal)
+
+ if (tab.loadError && /^(?:file|workspace|artifact):/.test(tab.url)) return void await load(tab.url, true, signal)
+ const actual = contents.getURL()
+
+ if (options.workspace?.host(actual) && options.workspace.display(actual) === tab.url) return void await load(tab.url, true, signal)
+ const address = reloadAddress(actual, tab.url, options.workspace?.host(actual), policy.fileRoots ?? [], policy.remote)
+
+ if (address) return void await load(address, true, signal)
+
+ return begin(signal)(actual, () => ignoreCache ? contents.reloadIgnoringCache() : contents.reload())
}
- const ready = Promise.all([
+ const ready = navigationDeadline(Promise.all([
files.ready,
- ...(options.initialize === false
+ ...(initial === undefined
? []
: [
- load(normalizeURL(options.restore?.url || "about:blank", policy)).catch((error: Error) => {
+ load(initial).then(async () => {
+ // Stop before the first load leaves no renderer to finish CDP setup. Start only the inert document;
+ // its native events are not a navigation of the saved tab.
+ if (documentState.status !== "restoring" || !documentState.retry || contents.getURL() || closed()) return
+ startingBlank = true
+ await contents.loadURL("about:blank").finally(() => { startingBlank = false })
+ }).catch((error: Error) => {
if (!options.restore) throw error
- // A dev server may have stopped while this page was unloaded. Keep its tab available to retry.
- publish(error.message)
+ // A dev server may have stopped while this page was unloaded. Keep its tab available to retry. The tab
+ // itself reports a load that failed or is still under way; anything else is said beside it.
+ publish(pageReports(error) ? undefined : error.message)
}),
]),
diagnostics.enable(),
+ choosers.attach(),
+ media.attach(),
+ passkeys.attach(),
cdp.send("Page.enable"),
+ cdp.send("Page.addScriptToEvaluateOnNewDocument", { source: RESTORE_PROMPT, runImmediately: true }),
cdp.send("DOM.enable"),
- cdp.send("Target.setAutoAttach", {
- autoAttach: true,
- waitForDebuggerOnStart: false,
- flatten: true,
- filter: [{ type: "iframe", exclude: false }, { exclude: true }],
- }),
- ]).then(() => undefined)
+ attachFrames(),
+ ])).then(() => undefined).finally(() => opening?.[Symbol.dispose]())
+
+ constructing.move()
return {
view,
contents,
- state,
+ nativeID: contents.id,
+ state: () => state(true),
+ childActivity: () => childActivity(activity),
+ previewUsed: () => !!options.popupOptions || !!options.workspace?.used(),
+ previewIdentity: () => options.workspace?.identity(),
+ answerNotice: notices.answer,
+ personCommand,
+ openPage,
+ reviewLink: (url: string) => notices.show(navigationNotice(url, policy, "conversation")),
+ /** Refuses passkeys in the browser process from now on, for a tab the agent drives or a tab that can script one. */
+ restrictPasskeys,
ready,
/** The host embed the renderer lays this page out with. */
embed: embed.id,
@@ -618,9 +1246,10 @@ export function createBrowserPage(
if (!closed()) zoom(direction)
},
async site() {
+ if (closed() || retryOnly(documentState)) return { cookies: 0 }
const url = contents.getURL()
- if (closed() || !destinationOrigin(url)) return { cookies: 0 }
+ if (!destinationOrigin(url)) return { cookies: 0 }
return { cookies: (await contents.session.cookies.get({ url })).length }
},
@@ -629,19 +1258,22 @@ export function createBrowserPage(
* the page reloaded without them, so a count read next includes what the reload set again.
*/
async clearSite() {
+ if (closed() || retryOnly(documentState)) return
const url = contents.getURL()
const origin = destinationOrigin(url)
- if (closed() || !origin) return
+ if (!origin) return
const cookies = await contents.session.cookies.get({ url })
await Promise.all(cookies.map((cookie) => contents.session.cookies.remove(cookieURL(cookie), cookie.name)))
await contents.session.clearStorageData({
origin,
storages: ["localstorage", "indexdb", "serviceworkers", "cachestorage", "filesystem", "shadercache"],
})
+ // The site's HTTP sign-in too. Chromium clears its auth cache only whole, so other sites ask again as well.
+ await contents.session.clearAuthCache()
if (closed()) return
- contents.reload()
+ await options.menu.navigate("reload")
// A slow page still cleared; the count then reads what it set so far.
await waitFor(() => closed() || !contents.isLoading(), new AbortController().signal, 30_000).catch(
() => undefined,
@@ -649,49 +1281,172 @@ export function createBrowserPage(
},
/** Reports the page's icon and zoom when either changed since the last report. */
detail,
- async execute(command: Browser.Command, signal: AbortSignal): Promise {
- await ready
+ /** Takes a download this page started; see `guardSession`. */
+ download,
+ /** Answers this page's permission requests and checks; see `guardSession`. */
+ permissions: prompts.permissions,
+ /** The user's answer to what the tab waits for; only the window calls it. */
+ answer: prompts.answer,
+ /** Whether the user's close may go ahead, or the page asked "Leave site?". */
+ leave: prompts.leave,
+ /**
+ * Runs one command, the agent's or the user's. The agent's never opens, reads or acts on an extension page, which
+ * would run with that extension's privileges; every agent operation reaches the page through here.
+ */
+ async execute(command: Browser.Command, signal: AbortSignal, origin: "agent" | "user"): Promise {
+ using active = new DisposableStack()
+
+ const hidden = !view.getVisible() && win.isVisible() && !win.isMinimized() && !(process.platform === "darwin" && electron.app.isHidden())
+ const shouldPaint = () => needsWakeFrame(command.action.type, documentState.status === "loaded" && !documentState.busy && !documentState.pending, !!selectOpenDialog(dialogGate))
+
+ const hold = origin === "agent" ? active.use(rendering.hold(hidden && shouldPaint() ? async () => {
+ await ready
+
+ if (!shouldPaint() || agentRefusal({ type: "snapshot" }, mainDocument())) return
+ await withFrames(false, pageLifetime.signal, async stop => {
+ const frame = (await cdp.send("Page.getFrameTree")).frameTree.frame.id
+ const world = await cdp.send("Page.createIsolatedWorld", { frameId: frame, worldName: "opencode-browser-paint" })
+ abortError(stop)
+ await cdp.send("Runtime.evaluate", { contextId: world.executionContextId, expression: "new Promise(done => requestAnimationFrame(() => requestAnimationFrame(() => done())))", awaitPromise: true })
+ })
+ } : undefined)) : undefined
+
+ const saved = navigation.interrupt(command.action.type, documentState.status === "restoring" ? documentState.url : undefined, origin)
+ await Promise.all([ready, hold?.painted])
+ const open = origin === "user" && leavable.includes(command.action.type) ? selectOpenDialog(dialogGate) : undefined
+
+ // The user leaving the page dismisses its dialog, as a browser's address bar does.
+ if (open) await answerDialog(open.revision, false, "", false)
+
// Registers the run before any further await, and listens for its abort in the same turn, so a dialog or a
// cancellation that arrives while it still inspects its target interrupts it.
- const reply = dispatchDialog({ type: "run.started", actionType: command.action.type, aborted: signal.aborted })
+ const reply = dispatchDialog({ type: "run.started", actionType: command.action.type, aborted: signal.aborted }).reply
if (reply?.status !== "accepted") throw runStopError(reply?.reason ?? "closed")
const runID = reply.runID
// The action underneath the race keeps running after an interruption wins it; it checks this
// signal before each further step.
- const run = { controller: new AbortController(), interrupted: Promise.withResolvers() }
+ const run = { controller: new AbortController(), interrupted: Promise.withResolvers(), origin }
runs.set(runID, run)
const cancel = () => dispatchDialog({ type: "run.cancelled", runID })
signal.addEventListener("abort", cancel, { once: true })
+ // A `wait` is the agent's command but only observes: the page gets no input from it, for up to 30 s. It is not
+ // counted as the agent acting, so the person's own press, download or app link during it stays theirs.
+ const acting = origin === "agent" && command.action.type !== "wait"
+
+ if (origin === "agent") recordPageInput(activity, origin)
+
+ if (acting) activity.agentRuns++
+
+ // The user's navigation may stop for "Leave site?"; the agent's stops when the site asks the user to sign in.
+ if (origin === "user" && leavable.includes(command.action.type)) prompts.intend(command.action)
+
+ if (origin === "agent") prompts.agentStarted()
+ const signIn = origin === "agent" ? prompts.agentWait(leavable.includes(command.action.type)) : undefined
+
try {
- return await Promise.race([perform(command, run.controller.signal), run.interrupted.promise])
+ const intercepting = choosers.update()
+
+ // Updating the file chooser intercept is a renderer call, which an open dialog blocks until it is answered.
+ if (command.action.type === "dialog") void intercepting.catch(() => undefined)
+
+ return await Promise.race([
+ // The agent drives the tab from here on: refuse passkeys in the browser process before its action runs. The
+ // refusal is the browser process's own command, which an open dialog does not block.
+ afterRefusal(origin === "agent" ? restrictPasskeys : undefined, command.action.type === "dialog" ? Promise.resolve() : intercepting, () => {
+ abortError(run.controller.signal)
+
+ return perform(command, run.controller.signal, origin, saved)
+ }),
+ run.interrupted.promise,
+ ...(signIn ? [signIn.promise] : []),
+ ])
} finally {
+ signIn?.stop()
signal.removeEventListener("abort", cancel)
runs.delete(runID)
dispatchDialog({ type: "run.finished", runID })
+
+ if (acting) activity.agentRuns--
+
+ if (origin === "agent") void choosers.update().catch(() => undefined)
}
},
async dispose() {
if (closed()) return
+ pageLifetime.abort()
+ notices.clear()
+ // Even a failed cleanup of an embed, recorder or already detached debugger must not orphan its native page.
+ using closing = new DisposableStack()
+ closing.defer(() => { if (!contents.isDestroyed()) contents.close({ waitForBeforeUnload: false }) })
dispatch({ type: "disposed" })
+ menu.dispose()
+ choosers.dispose()
+ media.dispose()
+ passkeys.dispose()
+ options.artifacts?.dispose()
+ options.workspace?.dispose()
dispatchDialog({ type: "disposed" })
+ prompts.dispose()
+ dialogs.dispose()
void dispatchPicker({ type: "disposed" })
clearTimeout(pickerTimer)
detachNetwork?.()
- contents.session.off("will-download", download)
await profiling.dispose()
cdp.dispose()
refs.clear()
picked.clear()
embed.dispose()
- if (!contents.isDestroyed()) contents.close({ waitForBeforeUnload: false })
await files.dispose()
},
}
- async function perform(command: Browser.Command, signal: AbortSignal): Promise {
+ async function perform(command: Browser.Command, signal: AbortSignal, origin: "agent" | "user", saved?: string) {
+ if (origin === "user") return attempt(command, signal, origin, saved)
+
+ // An error document has no inspectable frame. Report the artifact failure before querying Chromium.
+ if (state().loadError === FileVerificationError.code && !leavable.includes(command.action.type)) throw new FileVerificationError()
+
+ if (state().loadError === "browser.artifact.missing" && !leavable.includes(command.action.type)) throw missingArtifact()
+ const refused = agentRefusal(command.action, mainDocument())
+
+ if (refused) throw new Error(refused)
+ const used = actionFrames(command.action)
+ const framed = await extensionFrameRefusal(used)
+
+ if (framed) throw new Error(framed)
+ const result = await attempt(command, signal, origin, saved)
+ // A redirect, or a navigation while it ran, may have brought an extension page in, in the tab or in a frame the
+ // action used; its result stays here.
+ const moved = agentRefusal({ type: "snapshot" }, mainDocument()) ?? (await extensionFrameRefusal(used))
+
+ if (moved) throw new Error(moved)
+
+ return result
+ }
+
+ function mainDocument() {
+ return { url: contents.mainFrame.url, origin: contents.mainFrame.origin }
+ }
+
+ async function mainContext() {
+ const context = contexts.get((await cdp.send("Page.getFrameTree")).frameTree.frame.id)
+
+ if (!context)
+ throw new CodedError(
+ Browser.FailureCode.documentChanged,
+ "The page's JavaScript context is unavailable; it may be loading. Wait for it with browser.wait({tabID}), then retry.",
+ )
+
+ return context
+ }
+
+ async function attempt(command: Browser.Command, signal: AbortSignal, origin: "agent" | "user", saved?: string): Promise {
+ if (leftApprovedSite(documentState, command.action.type, command.expectedSite, contents.mainFrame.url))
+ throw new Error("The tab is no longer at the approved site; request the action again.")
+
if (isPickerActive(pickerState) && pointerOperations.includes(command.action.type))
await dispatchPicker({ type: "pointer.command" })
@@ -707,22 +1462,26 @@ export function createBrowserPage(
command.generation !== documentGeneration(documentState) &&
!retainedOperations.includes(command.action.type)
)
- throw new Error(
+ throw new CodedError(
+ Browser.FailureCode.documentChanged,
"The document changed before this operation ran. Call browser.tabs.list({}) to check its current URL, then browser.snapshot({tabID}) for fresh refs. Reconsider the action before retrying on the new page.",
)
abortError(signal)
- return execute(command.action, command.files, signal, command.target)
+ return execute(command.action, command.files, signal, origin, command.target, saved)
}
async function execute(
action: Browser.Action,
transfers: readonly Browser.File[],
signal: AbortSignal,
+ origin: "agent" | "user",
approved?: Browser.Target,
+ saved?: string,
): Promise {
const captureSources = sourceURLs()
const transfer = (id: Browser.FileID) => files.transfer(id, approved?.resources)
+ const input = dispatchInput(origin, signal)
const result = (value: T, attached: Browser.File[] = []): Browser.Result => {
const json = Schema.decodeUnknownSync(Schema.Json)(value)
@@ -742,12 +1501,14 @@ export function createBrowserPage(
signal.addEventListener("abort", cancel, { once: true })
try {
- await load(url)
+ await load(url, false, signal, origin === "user")
} finally {
signal.removeEventListener("abort", cancel)
}
- abortError(signal)
+ // The load event comes just before Chromium says the tab stopped loading; report the tab after that. A frame that
+ // still loads after a moment is reported as loading, which it is.
+ await waitFor(() => !contents.isLoading(), signal, 2_000).catch(() => abortError(signal))
return result(state())
}
@@ -756,36 +1517,41 @@ export function createBrowserPage(
case "forward":
case "reload":
case "stop": {
- if (action.type === "back" && contents.navigationHistory.canGoBack()) contents.navigationHistory.goBack()
+ if (action.type === "back" || action.type === "forward") {
+ const history = contents.navigationHistory
+ const index = history.getActiveIndex() + (action.type === "back" ? -1 : 1)
+ const entry = index >= 0 && index < history.length() && history.getEntryAtIndex(index)
- if (action.type === "forward" && contents.navigationHistory.canGoForward())
- contents.navigationHistory.goForward()
+ if (entry) await begin(signal)(entry.url, () => history.goToIndex(index), () => !closed() && contents.isLoading())
+ }
- if (action.type === "reload") contents.reload()
+ if (action.type === "reload" && (!saved || action.ignoreCache)) await reload(signal, action.ignoreCache)
- if (action.type === "stop") contents.stop()
+ if (action.type === "stop") {
+ navigation.cancel()
+ contents.stop()
+ }
if (action.type !== "stop") await waitFor(() => !contents.isLoading(), signal, 30_000)
- return result(state())
+ // As the inventory reports the tab: an address kept for a load that was never issued stays its address.
+ return result(state(true))
}
case "frames":
return result({ tab: state(), frames: await frames() })
case "snapshot":
case "find":
- return result({ tab: state(), ...(await snapshot(action)) })
+ return result({ tab: state(), ...(await snapshot(action, signal)) })
case "evaluate": {
if (action.ref && action.frameID)
throw new Error(
"Pass either ref or frameID to browser.evaluate, not both. A ref already runs in its element's frame.",
)
- const context = action.frameID ? contexts.get(action.frameID) : undefined
-
- if (action.frameID && !context)
- throw new Error(
- "Frame context is unavailable. Call browser.frames({tabID}) and use a current frameID from this tab, or omit frameID to target the main frame.",
- )
+ const context = action.frameID ? await frameContext(action.frameID) : undefined
+ // Pinned to the main frame's current document, so a navigation to an extension page meanwhile fails the call
+ // instead of running the script there.
+ const main = action.frameID || action.ref ? undefined : await mainContext()
const element = action.ref ? target(action.ref) : undefined
const objectId = element ? await resolve(element) : undefined
@@ -796,11 +1562,10 @@ export function createBrowserPage(
"Runtime.callFunctionOn",
{
objectId,
- functionDeclaration: action.script,
+ functionDeclaration: connectedFunction(action.script),
arguments: [{ objectId }],
awaitPromise: true,
returnByValue: true,
- userGesture: true,
},
element.sessionID,
)
@@ -809,14 +1574,15 @@ export function createBrowserPage(
"Runtime.evaluate",
{
expression: action.script,
- contextId: context?.id,
+ contextId: (context ?? main)?.id,
awaitPromise: true,
returnByValue: true,
- userGesture: true,
},
context?.sessionID,
))
+ if (element && value.exceptionDetails?.exception?.description?.startsWith("Error: browser.detached_ref\n")) throw detachedRef()
+
if (value.exceptionDetails)
throw new Error(
`Page JavaScript threw an exception. Check the script and ${action.ref ? "ref" : "frameID"}; inspect the page before repeating code with side effects. Details: ${(value.exceptionDetails.exception?.description ?? value.exceptionDetails.text).slice(0, 800)}`,
@@ -827,10 +1593,10 @@ export function createBrowserPage(
}
case "click":
- await click(target(action.ref), action.button ?? "left", action.count ?? 1, action.modifiers)
+ await click(input, target(action.ref), action.button ?? "left", action.count ?? 1, action.modifiers)
break
case "hover":
- await cdp.send("Input.dispatchMouseEvent", { type: "mouseMoved", ...(await point(target(action.ref))) })
+ await input("Input.dispatchMouseEvent", { type: "mouseMoved", ...(await point(target(action.ref))) })
break
case "drag": {
const source = target(action.from)
@@ -847,19 +1613,20 @@ export function createBrowserPage(
})
await cdp.send("Input.setInterceptDrags", { enabled: true })
- await cdp.send("Input.dispatchMouseEvent", { type: "mouseMoved", ...from })
- await cdp.send("Input.dispatchMouseEvent", {
- type: "mousePressed",
- ...from,
- button: "left",
- buttons: 1,
- clickCount: 1,
- })
try {
+ await input("Input.dispatchMouseEvent", { type: "mouseMoved", ...from })
+ await input("Input.dispatchMouseEvent", {
+ type: "mousePressed",
+ ...from,
+ button: "left",
+ buttons: 1,
+ clickCount: 1,
+ })
+
for (let i = 1; i <= 10; i++) {
abortError(signal)
- await cdp.send("Input.dispatchMouseEvent", {
+ await input("Input.dispatchMouseEvent", {
type: "mouseMoved",
x: from.x + ((to.x - from.x) * i) / 10,
y: from.y + ((to.y - from.y) * i) / 10,
@@ -871,30 +1638,30 @@ export function createBrowserPage(
if (html5) await waitFor(() => data !== undefined, signal, 2_000)
if (data) {
- for (const type of ["dragEnter", "dragOver", "drop"])
- await cdp.send("Input.dispatchDragEvent", { type, ...to, data })
+ for (const type of ["dragEnter", "dragOver", "drop"] as const)
+ await input("Input.dispatchDragEvent", { type, ...to, data })
}
} finally {
off()
await cdp.send("Input.setInterceptDrags", { enabled: false })
- await cdp.send("Input.dispatchMouseEvent", { type: "mouseReleased", ...to, button: "left", clickCount: 1 })
+ await input("Input.dispatchMouseEvent", { type: "mouseReleased", ...to, button: "left", clickCount: 1 })
}
break
}
case "fill":
- await fill(target(action.ref), action.text, signal)
+ await fill(input, target(action.ref), action.text, signal)
break
case "fill_form":
for (const field of action.fields) {
abortError(signal)
- if (field.type === "text") await fill(target(field.ref), field.value, signal)
+ if (field.type === "text") await fill(input, target(field.ref), field.value, signal)
if (field.type === "select") await select(target(field.ref), field.values)
- if (field.type === "check") await check(target(field.ref), field.checked)
+ if (field.type === "check") await check(input, target(field.ref), field.checked)
}
break
@@ -902,14 +1669,14 @@ export function createBrowserPage(
await select(target(action.ref), action.values)
break
case "check":
- await check(target(action.ref), action.checked)
+ await check(input, target(action.ref), action.checked)
break
case "press":
- await key(action.key)
+ await key(input, action.key)
break
case "scroll": {
const bounds = view.getBounds()
- await cdp.send("Input.dispatchMouseEvent", {
+ await input("Input.dispatchMouseEvent", {
type: "mouseWheel",
x: bounds.width / 2,
y: bounds.height / 2,
@@ -920,39 +1687,69 @@ export function createBrowserPage(
}
case "wait": {
- if (action.condition !== "load" && !action.text)
+ if (action.condition === "delay") {
+ await scheduler.wait(action.timeoutMs ?? 0, { signal })
+ break
+ }
+
+ if (action.condition === "url" && action.url === undefined) throw new Error("A URL wait requires a URL pattern.")
+
+ if ((action.condition === "text" || action.condition === "textGone") && !action.text)
throw new Error(
'browser.wait requires non-empty text for condition "text" or "textGone". Use condition "load" without text to wait for loading.',
)
- await waitFor(
- async () => {
- if (action.condition === "load") return !contents.isLoading()
- const context = action.frameID ? contexts.get(action.frameID) : undefined
+ const frameID = action.frameID
- if (action.frameID && !context)
- throw new Error(
- "Frame context is unavailable. Call browser.frames({tabID}) and use a frameID from this tab.",
- )
+ // The frame is checked once; its context is read on each poll, so one that turns into an extension's
+ // document while this waits fails the wait.
+ if (frameID) await agentFrameOf(frameID)
+ // Whether a check failed; otherwise the wait ran out of time, which the server reports as met: false.
+ const checks = { failed: false }
- const value = await cdp.send(
- "Runtime.evaluate",
- {
- expression: `document.body?.innerText.includes(${JSON.stringify(action.text)}) ?? false`,
- returnByValue: true,
- contextId: context?.id,
- },
- context?.sessionID,
+ const holds = async () => {
+ if (action.condition === "load") return !contents.isLoading()
+ // A navigation to an extension page while this waits ends it: the text would be that page's.
+ const page = agentRefusal({ type: "wait" }, mainDocument())
+
+ if (page) throw new Error(page)
+
+ if (action.condition === "url") return Browser.matchesURL(state().url, action.url ?? "")
+ const context = frameID ? contexts.get(frameID) : undefined
+
+ if (frameID && (!context || extensionFrames().has(frameID))) {
+ // Names an extension's document by what it is, when that is why the context went.
+ await agentFrameOf(frameID)
+ throw new Error(
+ "Frame context is unavailable. Call browser.frames({tabID}) and use a frameID from this tab.",
)
+ }
- return Boolean(value.result.value) === (action.condition === "text")
- },
+ const value = await cdp.send(
+ "Runtime.evaluate",
+ {
+ expression: `document.body?.innerText.includes(${JSON.stringify(action.text)}) ?? false`,
+ returnByValue: true,
+ contextId: context?.id,
+ },
+ context?.sessionID,
+ )
+
+ return Boolean(value.result.value) === (action.condition === "text")
+ }
+
+ await waitFor(
+ () =>
+ holds().catch((error: Error) => {
+ checks.failed = true
+ throw error
+ }),
signal,
action.timeoutMs,
- ).catch((error) => {
- if (signal.aborted) throw error
- throw new Error(
- `browser.wait failed for condition ${JSON.stringify(action.condition)} (timeoutMs: ${action.timeoutMs ?? 10_000}). Inspect browser.snapshot({tabID}) and check text/frameID before retrying; timeoutMs can be increased up to 30000 for a genuinely slow page. Details: ${error instanceof Error ? error.message : String(error)}`,
- )
+ ).catch((cause: Error) => {
+ if (signal.aborted) throw cause
+ const text = `browser.wait failed for condition ${JSON.stringify(action.condition)} (timeoutMs: ${action.timeoutMs ?? 10_000}). Inspect browser.snapshot({tabID}) and check text/frameID before retrying; timeoutMs can be increased up to 30000 for a genuinely slow page. Details: ${cause.message}`
+
+ throw checks.failed ? new Error(text, { cause }) : new CodedError(Browser.FailureCode.unmet, text, { cause })
})
break
}
@@ -962,52 +1759,18 @@ export function createBrowserPage(
throw new Error(
"Choose either ref for an element screenshot or fullPage:true for the whole page. Remove the other argument before retrying.",
)
- await waitFor(() => view.getVisible() && win.isVisible() && !win.isMinimized(), signal, 3_000).catch(
- (error) => {
- if (signal.aborted) throw error
- throw new Error(
- "Screenshot needs a visible tab. Call browser.tabs.focus and keep its desktop window visible.",
- )
- },
- )
- const element = action.ref ? await rect(target(action.ref), true) : undefined
- const metrics = await cdp.send("Page.getLayoutMetrics")
-
- const bounds = element
- ? {
- ...element,
- x: element.x + metrics.cssVisualViewport.pageX,
- y: element.y + metrics.cssVisualViewport.pageY,
- }
- : action.fullPage
- ? metrics.cssContentSize
- : {
- x: metrics.cssVisualViewport.pageX,
- y: metrics.cssVisualViewport.pageY,
- width: metrics.cssVisualViewport.clientWidth,
- height: metrics.cssVisualViewport.clientHeight,
- }
-
- const pixelRatio = contents.getZoomFactor() * electron.screen.getDisplayMatching(win.getBounds()).scaleFactor
- const scale = Math.min(1, (action.maxWidth ?? 2000) / (bounds.width * pixelRatio))
-
- if (bounds.width <= 0 || bounds.height <= 0)
- throw new Error(
- "Element or page has no visible screenshot area. Take a fresh snapshot and choose a visible element, or omit ref to capture the viewport.",
- )
- if (bounds.width * bounds.height * (scale * pixelRatio) ** 2 > 16_000_000)
- throw new Error("Screenshot exceeds 16 megapixels; capture an element or use a smaller maxWidth.")
- const format = action.format ?? "jpeg"
-
- const capture = await cdp.send("Page.captureScreenshot", {
- format,
- quality: format === "png" ? undefined : (action.quality ?? 80),
- captureBeyondViewport: true,
- clip: { ...bounds, scale },
+ const blocked = undrawable({
+ platform: process.platform,
+ minimized: win.isMinimized(),
+ visible: win.isVisible(),
+ appHidden: process.platform === "darwin" && electron.app.isHidden(),
})
- const id = await files.save(`screenshot.${format}`, `image/${format}`, Buffer.from(capture.data, "base64"), [
+ if (blocked) throw new Error(undrawableMessage(blocked))
+ const capture = await captureFrame(action, signal)
+
+ const id = await files.save(`screenshot.${capture.format}`, `image/${capture.format}`, capture.data, [
...captureSources,
...sourceURLs(),
])
@@ -1019,15 +1782,18 @@ export function createBrowserPage(
if (action.action !== "get") {
const open = selectOpenDialog(dialogGate)
- if (!open)
+ // The user may answer it in the pane first; then it is closed for the agent too.
+ if (!open || dispatchDialog({ type: "dialog.answering", revision: open.revision, by: "agent" }).answer !== "accepted")
throw new Error(
'This tab has no JavaScript dialog to handle. browser.dialog({tabID,action:"get"}) returns null when none is open; continue without accepting or dismissing one.',
)
- await cdp.send("Page.handleJavaScriptDialog", {
- accept: action.action === "accept",
- promptText: action.promptText,
- })
- dispatchDialog({ type: "dialog.handled", revision: open.revision })
+ await cdp
+ .send("Page.handleJavaScriptDialog", { accept: action.action === "accept", promptText: action.promptText })
+ .catch((error: Error) => {
+ dispatchDialog({ type: "dialog.answer-failed", revision: open.revision })
+ throw error
+ })
+ dispatchDialog({ type: "dialog.handled", revision: open.revision, at: Date.now() })
}
return result({ tab: state(), dialog: selectDialog(dialogGate) })
@@ -1052,8 +1818,8 @@ export function createBrowserPage(
if (action.type === "files.drop") {
const position = await point(element)
- for (const type of ["dragEnter", "dragOver", "drop"])
- await cdp.send("Input.dispatchDragEvent", {
+ for (const type of ["dragEnter", "dragOver", "drop"] as const)
+ await input("Input.dispatchDragEvent", {
type,
...position,
data: { items: [], files: local, dragOperationsMask: 1 },
@@ -1128,7 +1894,7 @@ export function createBrowserPage(
async function inspect(action: Browser.Action): Promise {
// Most CDP queries cannot run while a JavaScript dialog blocks the renderer.
if (action.type === "dialog")
- return selectDialogTarget(dialogGate, documentGeneration(documentState), contents.getURL())
+ return selectDialogTarget(dialogGate, documentGeneration(documentState), state().url)
const fileIDs =
action.type === "heap.compare" ? [action.before, action.after] : "fileID" in action ? [action.fileID] : []
@@ -1145,17 +1911,7 @@ export function createBrowserPage(
return profiling.target(action.type === "trace.stop" ? "trace" : "cpu")
const tree = await frames()
tree.forEach((frame) => documents.set(frame.id, frame.url))
-
- const refs =
- action.type === "drag"
- ? [action.from, action.to]
- : action.type === "fill_form"
- ? action.fields.map((field) => field.ref)
- : "ref" in action && action.ref
- ? [action.ref]
- : []
-
- const selected = refs.map(target)
+ const selected = actionRefs(action).map(target)
const frameIDs = selected.length
? selected.map((element) => element.frameID)
@@ -1163,13 +1919,7 @@ export function createBrowserPage(
? [action.frameID]
: []
- const urls = frameIDs.map((id) => {
- const frame = tree.find((frame) => frame.id === id)
-
- if (!frame) throw new Error("Frame is unavailable. Call browser.frames({tabID}) and use a current frameID.")
-
- return frame.url
- })
+ const urls = await Promise.all(frameIDs.map(async (id) => (await agentFrameOf(id)).url))
const capture = ["screenshot", "lighthouse", "trace.start", "cpu.start", "heap.snapshot"].includes(action.type)
@@ -1182,58 +1932,98 @@ export function createBrowserPage(
? sourceURLs()
: urls.length
? urls
- : [contents.getURL()],
+ : [state().url],
),
].sort(),
key: JSON.stringify([documentGeneration(documentState), revision, selected]),
}
}
- function target(ref: Browser.Ref): Element {
+ function actionRefs(action: Browser.Action) {
+ if (action.type === "drag") return [action.from, action.to]
+
+ if (action.type === "fill_form") return action.fields.map((field) => field.ref)
+
+ return "ref" in action && action.ref ? [action.ref] : []
+ }
+
+ /** The element a ref names: one from this tab's newest snapshot, or one the user picked. */
+ function lookup(ref: Browser.Ref) {
const key = ref.replace(/^@/, "")
- const value = refs.get(key) ?? picked.get(key)
+
+ return refs.get(key) ?? picked.get(key)
+ }
+
+ function target(ref: Browser.Ref): Element {
+ const value = lookup(ref)
if (!value)
- throw new Error(
- "Element ref is stale or belongs to another tab. Call browser.snapshot({tabID}) and use a ref from that tab's newest snapshot. Do not reuse refs after navigation or a newer snapshot.",
+ throw new CodedError(
+ Browser.FailureCode.staleRef,
+ "Element ref is stale or belongs to another tab. Call browser.snapshot({tabID}) and use a ref from the current document.",
)
return value
}
async function frames() {
- const root = await cdp.send("Page.getFrameTree")
- const result: { id: string; parentID?: string; url: string; name: string }[] = []
-
- const walk = (tree: Protocol.Page.FrameTree, parentID?: string) => {
- if (!result.some((frame) => frame.id === tree.frame.id))
- result.push(
- tree.frame.parentId || parentID
- ? {
- id: tree.frame.id,
- parentID: tree.frame.parentId ?? parentID,
- url: tree.frame.url,
- name: tree.frame.name ?? "",
- }
- : { id: tree.frame.id, url: tree.frame.url, name: tree.frame.name ?? "" },
- )
- tree.childFrames?.forEach((child) => walk(child, tree.frame.id))
- }
+ return agentFrames(await frameTrees()).map((frame) => ({ ...frame, url: frame.parentID ? displayURL(frame.url) : state().url }))
+ }
- walk(root.frameTree)
+ async function frameTrees() {
+ const root = await cdp.send("Page.getFrameTree")
const children = await Promise.all(
- Array.from(sessions, async ([id, sessionID]) => ({
- id,
- tree: await cdp.send("Page.getFrameTree", {}, sessionID).catch(() => undefined),
- })),
+ Array.from(sessions, async ([id, sessionID]) => {
+ const tree = await cdp.send("Page.getFrameTree", {}, sessionID).catch(() => undefined)
+
+ return tree ? [{ parentID: parents.get(id) ?? root.frameTree.frame.id, tree: tree.frameTree }] : []
+ }),
)
- children.forEach(({ id, tree }) => {
- if (tree) walk(tree.frameTree, parents.get(id) ?? root.frameTree.frame.id)
- })
+ const excluded = await Promise.all(Array.from(extensionTargets.keys(), async (sessionID) => {
+ const tree = await cdp.send("Page.getFrameTree", {}, sessionID).catch(() => undefined)
- return result
+ return tree ? [tree.frameTree] : []
+ }))
+
+ return { root: root.frameTree, children: children.flat(), extensions: excludedFrames(extensionFrames(), excluded.flat()) }
+ }
+
+ /** The frame an agent's frameID names; every operation that takes one resolves it here. */
+ async function agentFrameOf(frameID: string) {
+ const access = agentFrame(await frameTrees(), frameID)
+
+ if (access.type !== "frame") throw new Error(access.message)
+
+ return { ...access.frame, url: access.frame.parentID ? displayURL(access.frame.url) : state().url }
+ }
+
+ async function frameContext(frameID: string) {
+ await agentFrameOf(frameID)
+ const context = contexts.get(frameID)
+
+ if (!context)
+ throw new Error(
+ "Frame context is unavailable. Call browser.frames({tabID}) and use a current frameID from this tab, or omit frameID to target the main frame.",
+ )
+
+ return context
+ }
+
+ /** Why the agent may not use these frames: one shows an extension's document, perhaps since the call began. */
+ async function extensionFrameRefusal(frameIDs: readonly string[]) {
+ if (!frameIDs.length) return undefined
+ const trees = await frameTrees()
+
+ return frameIDs.map((frameID) => agentFrame(trees, frameID)).find((access) => access.type !== "frame")?.message
+ }
+
+ /** The frames an action reaches: its frameID, or the frames of the element refs it names. */
+ function actionFrames(action: Browser.Action) {
+ const elements = actionRefs(action).flatMap((ref) => lookup(ref)?.frameID ?? [])
+
+ return "frameID" in action && action.frameID ? [action.frameID, ...elements] : elements
}
async function call(element: Element, functionDeclaration: string, args: unknown[] = []) {
@@ -1244,15 +2034,16 @@ export function createBrowserPage(
"Runtime.callFunctionOn",
{
objectId,
- functionDeclaration,
+ functionDeclaration: connectedFunction(functionDeclaration),
arguments: args.map((value) => ({ value })),
returnByValue: true,
awaitPromise: true,
- userGesture: true,
},
element.sessionID,
)
+ if (result.exceptionDetails?.exception?.description?.startsWith("Error: browser.detached_ref\n")) throw detachedRef()
+
if (result.exceptionDetails)
throw new Error(result.exceptionDetails.exception?.description ?? result.exceptionDetails.text)
@@ -1266,20 +2057,16 @@ export function createBrowserPage(
async function resolve(element: Element) {
const object = await cdp.send("DOM.resolveNode", { backendNodeId: element.backendID }, element.sessionID)
- if (!object.object.objectId)
- throw new Error(
- "Element is no longer available. Call browser.snapshot({tabID}) and use a fresh ref; the page may have replaced the element.",
- )
+ if (!object.object.objectId) throw detachedRef()
return object.object.objectId
}
- async function rect(element: Element, scroll = false) {
+ async function rect(element: Element, scroll = false, knownTree?: Awaited>) {
if (scroll) {
await cdp.send("DOM.scrollIntoViewIfNeeded", { backendNodeId: element.backendID }, element.sessionID)
- // Force a compositor update after scrolling. requestAnimationFrame can
- // stall in a hidden WebContentsView, even with background throttling off.
- await contents.capturePage(undefined, { stayHidden: false, stayAwake: true })
+ // Input is routed by the last rendered frame, so let one render at the new scroll position.
+ await painted(element.sessionID)
}
const bounds = Schema.Struct({ x: Schema.Finite, y: Schema.Finite, width: Schema.Finite, height: Schema.Finite })
@@ -1293,7 +2080,7 @@ export function createBrowserPage(
),
}
- const tree = await frames()
+ const tree = knownTree ?? await frames()
let frame = tree.find((frame) => frame.id === element.frameID)
while (frame?.parentID) {
@@ -1329,26 +2116,203 @@ export function createBrowserPage(
return id ? sessions.get(id) : undefined
}
+ async function captureFrame(action: Extract, signal: AbortSignal) {
+ return withFrames(view.getVisible() && win.isVisible() && !win.isMinimized(), signal, async stop => {
+ if (isNavigationPending(documentState)) await waitFor(() => !isNavigationPending(documentState), stop)
+ abortError(stop)
+
+ // The restored address never opened (its preview failed, or its load was cancelled before it was issued): the
+ // tab shows no document, so a redraw would pass a blank surface off as the page.
+ if (documentState.status === "restoring")
+ throw new Error("This restored tab has not opened its page. Reload or navigate the tab, then take the screenshot again.")
+ const before = documentState
+ const frame = await screenshot(action, stop)
+ abortError(stop)
+
+ if (!frameStillCurrent(before, documentState)) throw new CodedError(Browser.FailureCode.documentChanged, "The document changed during capture. Check the tab and take a new screenshot.")
+
+ return frame
+ }, action.fullPage ? FULL_PAGE_DEADLINE_MS : undefined)
+ }
+
+ async function screenshot(action: Extract, signal: AbortSignal) {
+ if (!action.fullPage && !action.ref) return captureViewport(action, signal)
+
+ const element = action.ref ? await rect(target(action.ref), true) : undefined
+ const metrics = await cdp.send("Page.getLayoutMetrics")
+ abortError(signal)
+ const viewport = metrics.cssVisualViewport
+ const onscreen = view.getVisible() && win.isVisible() && !win.isMinimized()
+
+ if (action.fullPage) return beyondViewport(action, metrics.cssContentSize)
+
+ if (
+ element &&
+ onscreen &&
+ (element.x < 0 ||
+ element.y < 0 ||
+ element.x + element.width > viewport.clientWidth ||
+ element.y + element.height > viewport.clientHeight)
+ )
+ return beyondViewport(action, { ...element, x: element.x + viewport.pageX, y: element.y + viewport.pageY })
+
+ // Crop the requested redraw to the element's visible part without changing the page's viewport.
+ const clip = element && {
+ x: Math.max(0, element.x),
+ y: Math.max(0, element.y),
+ width: Math.min(viewport.clientWidth, element.x + element.width) - Math.max(0, element.x),
+ height: Math.min(viewport.clientHeight, element.y + element.height) - Math.max(0, element.y),
+ }
+
+ if (clip && (clip.width <= 0 || clip.height <= 0)) throw new Error(noVisibleArea)
+
+ return captureViewport(action, signal, clip)
+ }
+
+ async function captureViewport(action: Extract, signal: AbortSignal, clip?: Electron.Rectangle) {
+ const viewWidth = view.getBounds().width
+ const zoom = contents.getZoomFactor()
+ const maxWidth = action.maxWidth ?? 2000
+ const format = action.format === "png" ? "png" : "jpeg"
+ // Request the final encoding when the viewport fits. Use a lossless intermediate for cropping or resizing.
+ const encoding = !clip && viewWidth * electron.screen.getDisplayMatching(win.getNormalBounds()).scaleFactor <= maxWidth ? format : "png"
+
+ const shot = await cdp.send("Page.captureScreenshot", {
+ format: encoding,
+ quality: encoding === "jpeg" ? action.quality ?? 80 : undefined,
+ fromSurface: true,
+ captureBeyondViewport: false,
+ optimizeForSpeed: true,
+ })
+
+ abortError(signal)
+ const bytes = Buffer.from(shot.data, "base64")
+
+ if (!clip && encoding === format && (format === "png" ? pngFits : jpegFits)(bytes, maxWidth, Browser.MAX_FILE_BYTES))
+ return { format, data: bytes }
+
+ const viewportImage = electron.nativeImage.createFromBuffer(bytes)
+
+ if (viewportImage.isEmpty()) throw new Error(undrawableMessage("stalled"))
+ const area = clip && cropPixels(clip, viewportImage.getSize(), viewWidth, zoom)
+
+ if (clip && !area) throw new Error(noVisibleArea)
+ const image = area ? viewportImage.crop(area) : viewportImage
+
+ if (image.isEmpty()) throw new Error(noVisibleArea)
+
+ if (!clip && encoding === format && image.getSize().width <= maxWidth && bytes.length <= Browser.MAX_FILE_BYTES)
+ return { format, data: bytes }
+
+ const scaled = image.getSize().width > maxWidth ? image.resize({ width: maxWidth, quality: "good" }) : image
+
+ // A rendered frame encodes only as PNG or JPEG, so WebP comes back as JPEG.
+ return action.format === "png"
+ ? { format: "png", data: scaled.toPNG() }
+ : { format: "jpeg", data: scaled.toJPEG(action.quality ?? 80) }
+ }
+
+ async function beyondViewport(
+ action: Extract,
+ bounds: { x: number; y: number; width: number; height: number },
+ ) {
+ const pixelRatio = contents.getZoomFactor() * electron.screen.getDisplayMatching(win.getNormalBounds()).scaleFactor
+ const scale = captureScale(bounds, pixelRatio, action.maxWidth ?? 2000)
+ const format = action.format ?? "jpeg"
+
+ const capture = await cdp.send("Page.captureScreenshot", {
+ format,
+ quality: format === "png" ? undefined : (action.quality ?? 80),
+ fromSurface: true,
+ captureBeyondViewport: true,
+ clip: { ...bounds, scale },
+ })
+
+ return { format, data: Buffer.from(capture.data, "base64") }
+ }
+
async function point(element: Element) {
const box = await rect(element, true)
return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
}
- async function click(element: Element, button = "left", count = 1, modifiers: readonly string[] = []) {
+ // CDP can't condition a native input event on a hit test. Check the compositor's actual hit after scrolling,
+ // and check again after resolving the node. Do not dispatch into a frame owner whose inner hit is unknown.
+ function dispatchInput(origin: "agent" | "user", signal: AbortSignal) {
+ return async (
+ method: "Input.dispatchMouseEvent" | "Input.dispatchDragEvent" | "Input.dispatchKeyEvent" | "Input.insertText",
+ params: Protocol.Input.DispatchMouseEventRequest | Protocol.Input.DispatchDragEventRequest | Protocol.Input.DispatchKeyEventRequest | Protocol.Input.InsertTextRequest,
+ ) => {
+ if (origin === "user") return cdp.send(method, params)
+ // Context-menu delivery can follow the CDP reply. A later user input, not the end of the command, re-arms it.
+ nativeMenu = false
+
+ if (process.platform === "linux" && "button" in params && params.button === "middle")
+ throw new Error("Middle-click can paste the system selection. Use fill/type to enter text and evaluate to read page text.")
+ const changed = "Input target changed or could not be verified. Take a fresh snapshot and use the page outside extension UI."
+
+ // The user sees a still of the page under "Leave site?" or a sign-in, not the page the input would reach.
+ if (prompts.covered())
+ throw new Error("The user is answering a prompt over this page. Wait for them, or use another tab; no input was sent.")
+
+ if ("x" in params) {
+ const version = revision
+ const trees = await frameTrees()
+ const position = { x: Math.round(params.x), y: Math.round(params.y) }
+ const hitTest = () => cdp.send("DOM.getNodeForLocation", { ...position, ignorePointerEventsNone: false })
+ const hit = await hitTest()
+ const access = agentFrame(trees, hit.frameId)
+
+ if (access.type !== "frame") throw new Error(access.message)
+ const sessionID = sessionFor(hit.frameId, agentFrames(trees))
+ const { node } = await cdp.send("DOM.describeNode", { backendNodeId: hit.backendNodeId }, sessionID)
+
+ if (/^(?:iframe|frame|object|embed)$/i.test(node.nodeName)) throw new Error(changed)
+ const last = await hitTest()
+
+ if (version !== revision || last.backendNodeId !== hit.backendNodeId || last.frameId !== hit.frameId || extensionFrames().has(hit.frameId)) throw new Error(changed)
+
+ if (!inputDocument(contents.mainFrame.url, contents.mainFrame.origin)) throw new Error(changed)
+ abortError(signal)
+
+ // Counted before it is sent and never taken back: a press that fails to arrive costs the person one press
+ // read as the agent's, never the reverse.
+ if ("type" in params && params.type === "mousePressed") agentPresses++
+
+ return cdp.send(method, { ...params, ...position })
+ }
+
+ const focused = contents.focusedFrame
+
+ if (!focused) throw new Error(changed)
+
+ for (let frame: Electron.WebFrameMain | null = focused; frame; frame = frame.parent) {
+ if (frame.detached || !inputDocument(frame.url, frame.origin)) throw new Error(changed)
+
+ if (!frame.parent && frame.frameTreeNodeId !== contents.mainFrame.frameTreeNodeId) throw new Error(changed)
+ }
+
+ abortError(signal)
+
+ return cdp.send(method, params)
+ }
+ }
+
+ async function click(input: ReturnType, element: Element, button: Protocol.Input.MouseButton = "left", count = 1, modifiers: readonly string[] = []) {
const position = await point(element)
const flags = modifiers.reduce((mask, key) => mask | ({ Alt: 1, Control: 2, Meta: 4, Shift: 8 }[key] ?? 0), 0)
- await cdp.send("Input.dispatchMouseEvent", { type: "mouseMoved", ...position, modifiers: flags })
+ await input("Input.dispatchMouseEvent", { type: "mouseMoved", ...position, modifiers: flags })
for (let clickCount = 1; clickCount <= count; clickCount++) {
- await cdp.send("Input.dispatchMouseEvent", {
+ await input("Input.dispatchMouseEvent", {
type: "mousePressed",
...position,
button,
clickCount,
modifiers: flags,
})
- await cdp.send("Input.dispatchMouseEvent", {
+ await input("Input.dispatchMouseEvent", {
type: "mouseReleased",
...position,
button,
@@ -1358,7 +2322,7 @@ export function createBrowserPage(
}
}
- async function fill(element: Element, value: string, signal: AbortSignal) {
+ async function fill(input: ReturnType, element: Element, value: string, signal: AbortSignal) {
const kind = await call(
element,
"function() { if (this.disabled || this.readOnly) return; if (this instanceof HTMLTextAreaElement || this.isContentEditable) return 'text'; if (!(this instanceof HTMLInputElement)) return; if (['date','time','datetime-local','month','week'].includes(this.type)) return 'structured'; if (!['file','checkbox','radio','button','submit','reset','image','hidden','range','color'].includes(this.type)) return 'text'; }",
@@ -1383,10 +2347,10 @@ export function createBrowserPage(
await cdp.send("DOM.focus", { backendNodeId: element.backendID }, element.sessionID)
// Focusing this field blurs the previous one; a validation dialog from that blur must stop here.
abortError(signal)
- await key(process.platform === "darwin" ? "Meta+A" : "Control+A")
- await key("Backspace")
+ await key(input, process.platform === "darwin" ? "Meta+A" : "Control+A")
+ await key(input, "Backspace")
abortError(signal)
- await cdp.send("Input.insertText", { text: value })
+ await input("Input.insertText", { text: value })
}
async function select(element: Element, values: readonly string[]) {
@@ -1397,14 +2361,14 @@ export function createBrowserPage(
)
}
- async function check(element: Element, checked: boolean) {
+ async function check(input: ReturnType, element: Element, checked: boolean) {
const current = await call(
element,
"function(checked) { if (!(this instanceof HTMLInputElement) || !['checkbox','radio'].includes(this.type) || this.disabled) throw new Error('Target is not an enabled checkbox or radio. Take a fresh snapshot and choose the correct ref.'); if (this.type === 'radio' && this.checked && !checked) throw new Error('A selected radio cannot be cleared by clicking it. Select a different radio in its group instead.'); return this.checked; }",
[checked],
)
- if (current !== checked) await click(element)
+ if (current !== checked) await click(input, element)
if ((await call(element, "function() { return this.checked; }")) !== checked)
throw new Error(
@@ -1412,7 +2376,7 @@ export function createBrowserPage(
)
}
- async function key(chord: string) {
+ async function key(input: ReturnType, chord: string) {
if (!chord)
throw new Error(
"A key is required. Use a named key such as Enter or ArrowDown, a single character, or a chord such as Control+A.",
@@ -1456,6 +2420,10 @@ export function createBrowserPage(
? 111 + Number(key.slice(1))
: undefined)
+ const refusal = agentKeyRefusal(key, modifiers, code)
+
+ if (refusal) throw new Error(refusal)
+
if (code === undefined)
throw new Error(
`Unknown key ${JSON.stringify(key)}. Use Enter, Tab, Escape, Backspace, Delete, ArrowUp/Down/Left/Right, PageUp/Down, Home, End, Space, F1–F12, or one character. Use browser.fill for text.`,
@@ -1466,93 +2434,61 @@ export function createBrowserPage(
const event = { key: key === "Space" ? " " : key, windowsVirtualKeyCode: code, modifiers }
const params = text !== undefined && !(modifiers & 6) ? { ...event, text } : event
- await cdp.send("Input.dispatchKeyEvent", { type: "keyDown", ...params })
- await cdp.send("Input.dispatchKeyEvent", { type: "keyUp", ...params })
+ await input("Input.dispatchKeyEvent", { type: "keyDown", ...params })
+ await input("Input.dispatchKeyEvent", { type: "keyUp", ...params })
}
- async function snapshot(action: Extract) {
+ async function snapshot(action: Extract, signal: AbortSignal) {
+ const generation = documentGeneration(documentState)
const tree = await frames()
const selected = action.type === "snapshot" && action.ref ? target(action.ref) : undefined
- const frameID = selected?.frameID ?? action.frameID ?? tree[0]?.id
+ const named = selected?.frameID ?? action.frameID
+ const frameID = named ? (await agentFrameOf(named)).id : tree[0]?.id
- if (!frameID || !tree.some((frame) => frame.id === frameID))
+ if (!frameID)
throw new Error(
"Frame is unavailable. Call browser.frames({tabID}) and use a current frameID from this tab; omit frameID for the main frame.",
)
const sessionID = sessionFor(frameID, tree)
- const depth = action.type === "snapshot" ? (action.depth ?? 8) : 8
- const ax = await cdp.send("Accessibility.getFullAXTree", { frameId: frameID, depth }, sessionID)
- const nodes = new Map(ax.nodes.map((node) => [node.nodeId, node]))
- const root = selected ? ax.nodes.find((node) => node.backendDOMNodeId === selected.backendID) : ax.nodes[0]
-
- if (!root)
- throw new Error(
- "Element is absent from this frame's accessibility snapshot. Retry browser.snapshot with the same tabID and no ref to refresh the frame, then choose a returned ref.",
- )
- refs.clear()
- const pinned = new Map(Array.from(picked, ([ref, element]) => [`${element.frameID}:${element.backendID}`, ref]))
- const lines: string[] = []
- let truncated = false
-
- const walk = async (node: Protocol.Accessibility.AXNode, level: number): Promise => {
- if (level > depth || lines.length >= 500) {
- truncated = true
-
- return
- }
-
- const role = String(node.role?.value ?? "node")
- .replace(/[^a-zA-Z0-9_-]/g, "")
- .slice(0, 40)
-
- const properties = new Map(node.properties?.map((property) => [property.name, property.value.value]) ?? [])
-
- if (!node.ignored) {
- const actionable =
- role !== "RootWebArea" &&
- (properties.get("focusable") || /^(button|link|textbox|combobox|checkbox|radio|option)$/.test(role))
-
- // A picked element keeps the ref its comment names, even when it is not otherwise actionable.
- const known = node.backendDOMNodeId ? pinned.get(`${frameID}:${node.backendDOMNodeId}`) : undefined
- const ref = known ?? (actionable && node.backendDOMNodeId ? options.shared.ref() : "")
- const element = node.backendDOMNodeId ? { backendID: node.backendDOMNodeId, frameID, sessionID } : undefined
-
- if (ref && element && !known) refs.set(ref, element)
-
- const flags = (["checked", "disabled", "expanded", "selected"] as const).flatMap((name) =>
- properties.has(name) ? [`${name}=${properties.get(name)}`] : [],
- )
-
- const box =
- action.type === "snapshot" && action.boxes && ref && element
- ? await rect(element).catch(() => undefined)
- : undefined
-
- lines.push(
- `${" ".repeat(level)}${ref ? `@${ref} ` : ""}[${role}] ${JSON.stringify(
- String(node.name?.value ?? "")
- .replace(/\s+/g, " ")
- .slice(0, 300),
- )} ${flags.join(" ")}${box ? ` box=${JSON.stringify(box)}` : ""}`,
- )
- }
+ const ax = await cdp.send("Accessibility.getFullAXTree", { frameId: frameID }, sessionID)
+ abortError(signal)
- if (["textbox", "searchbox"].includes(role) || properties.get("editable")) return
+ const byNode = (source: Map) => new Map(Array.from(source)
+ .filter(([, element]) => element.frameID === frameID && element.sessionID === sessionID)
+ .map(([ref, element]) => [element.backendID, ref]))
+
+ const snapshot = await accessibilitySnapshot(ax.nodes, {
+ root: selected?.backendID,
+ depth: action.type === "snapshot" ? action.depth : undefined,
+ text: action.type === "find" ? action.text : undefined,
+ interactive: action.interactive,
+ maxLines: action.maxLines,
+ maxChars: action.maxChars,
+ signal,
+ previous: refs.previous(frameID, sessionID),
+ picked: byNode(picked),
+ ref: options.shared.ref,
+ // AX does not distinguish password textboxes. Fail closed if the backing field is gone or sensitive.
+ readableValue: async (backendID, name) => {
+ abortError(signal)
+ const field = await call({ backendID, frameID, sessionID }, describeField).catch(() => undefined)
- for (const childID of node.childIds ?? []) {
- const child = nodes.get(childID)
+ return Schema.is(Field)(field) && readableField(field, name)
+ },
+ box: action.type === "snapshot" && action.boxes ? async (backendID) => {
+ abortError(signal)
+ const box = await rect({ backendID, frameID, sessionID }, false, tree).catch(() => undefined)
- if (child) await walk(child, level + 1)
- }
- }
+ return box ? ` box=${JSON.stringify(box)}` : ""
+ } : undefined,
+ })
- await walk(root, 0)
+ abortError(signal)
- const content = (
- action.type === "find" ? lines.filter((line) => line.toLowerCase().includes(action.text.toLowerCase())) : lines
- ).join("\n")
+ if (documentGeneration(documentState) !== generation) throw new CodedError(Browser.FailureCode.documentChanged, "Document changed during snapshot; request a fresh snapshot.")
+ refs.add(frameID, sessionID, snapshot.refs)
- return { content: content.slice(0, Browser.MAX_TEXT), truncated: truncated || content.length > Browser.MAX_TEXT }
+ return { content: snapshot.content, truncated: snapshot.truncated }
}
/** Moves the picker and runs its effects; resolves once they ran, so input waits for the picker to disarm. */
@@ -1789,8 +2725,8 @@ export function createBrowserPage(
return name ? { ...labeled, name } : labeled
}
- // Wait until the compositor shows the picked highlight without the hover tooltip, so the
- // renderer's still of the page includes it. A stalled page must not hold the comment back.
+ // Give the picker or scrolled input target a chance to lay out. This is not a compositor acknowledgement;
+ // screenshots wait for their own redraw instead.
async function painted(sessionID?: string) {
await Promise.race([
cdp
diff --git a/packages/gui-plugins/src/browser/connection.test.ts b/packages/gui-plugins/src/browser/connection.test.ts
index 50db61ddfe99..b7535c1e7db2 100644
--- a/packages/gui-plugins/src/browser/connection.test.ts
+++ b/packages/gui-plugins/src/browser/connection.test.ts
@@ -2,6 +2,7 @@ import { expect, test } from "bun:test"
import { Browser } from "@opencode/plugin-browser/rpc"
import type { IpcClient } from "@opencode/plugin/gui"
import { openBinding } from "./connection"
+import { PluginTabHandle } from "./ipc"
import type { BrowserPane, PaneEvent } from "./ipc"
type Client = IpcClient<(typeof BrowserPane)["spec"]>
@@ -20,6 +21,7 @@ function fixture(reject?: Error) {
const events: PaneEvent[] = []
const client: Client = {
+ forget: async () => undefined,
register: async (input) => {
registered.push(input)
@@ -27,6 +29,10 @@ function fixture(reject?: Error) {
},
load: async () => undefined,
command: async () => undefined,
+ find: async () => undefined,
+ notice: async () => undefined,
+ reviewLink: async () => tabID,
+ answer: async () => undefined,
inspect: async () => undefined,
highlight: async (input) => {
highlights.push(input)
@@ -34,6 +40,11 @@ function fixture(reject?: Error) {
zoom: async () => undefined,
site: async () => ({ cookies: 0 }),
clearSite: async () => undefined,
+ clearCache: async () => undefined,
+ reveal: async () => undefined,
+ openPage: async () => undefined,
+ createTab: async () => PluginTabHandle.make("handle"),
+ closeTab: async () => true,
close: async (input) => {
closed.push(input.binding)
},
@@ -91,3 +102,14 @@ test("main's answer to the register reaches the owner", async () => {
expect(accepted.outcomes).toEqual(["accepted"])
expect(rejected.outcomes).toEqual(["browser.pane.registration.invalid"])
})
+
+test("a plugin open requires its session on screen, including after registration", async () => {
+ const app = fixture()
+ const url = "https://example.invalid"
+ await expect(app.registration.createTab("owner", url, () => false)).rejects.toThrow("notOnScreen")
+ const route = { current: true }
+ const opening = app.registration.createTab("owner", url, () => route.current)
+ route.current = false
+ await expect(opening).rejects.toThrow("notOnScreen")
+ expect(await app.registration.createTab("owner", url, () => true)).toBe(PluginTabHandle.make("handle"))
+})
diff --git a/packages/gui-plugins/src/browser/connection.ts b/packages/gui-plugins/src/browser/connection.ts
index f763af397fa2..65fa01cca8f0 100644
--- a/packages/gui-plugins/src/browser/connection.ts
+++ b/packages/gui-plugins/src/browser/connection.ts
@@ -1,7 +1,8 @@
import type { Browser } from "@opencode/plugin-browser/rpc"
import type { IpcClient } from "@opencode/plugin/gui"
+import type { ExperimentalBrowserTab } from "@opencode/plugin/gui/browser"
import { uuid } from "@opencode/util/uuid"
-import type { BrowserPane, PaneEvent } from "./ipc"
+import type { BrowserPane, FindAction, PaneEvent, PromptAnswer } from "./ipc"
type Client = IpcClient<(typeof BrowserPane)["spec"]>
@@ -14,14 +15,24 @@ export type ShortcutEvent = Extract
export type Zoom = "in" | "out" | "reset"
export type Registration = {
+ readonly binding: string
/** Creates a restored tab's page, which then reports its embed. */
load(tabID: Browser.TabID): void
command(command: Browser.Action): Promise
+ createTab(owner: string, url: string, onScreen: () => boolean): Promise
+ closeTab(owner: string, id: ExperimentalBrowserTab): Promise
inspect(tabID: Browser.TabID, enabled: boolean): void
highlight(tabID: Browser.TabID, ref?: Browser.Ref): void
zoom(tabID: Browser.TabID, zoom: Zoom): void
+ find(tabID: Browser.TabID, action: FindAction): Promise
+ notice(tabID: Browser.TabID, token: string, dismiss: boolean, copy?: boolean): Promise
+ reviewLink(url: string): Promise
+ answer(tabID: Browser.TabID, id: number, answer: PromptAnswer): Promise
site(tabID: Browser.TabID): Promise<{ cookies: number }>
clearSite(tabID: Browser.TabID): Promise
+ clearCache(tabID: Browser.TabID, address: string): Promise
+ reveal(tabID: Browser.TabID): Promise
+ openPage(tabID: Browser.TabID, expected: string): Promise
close(): void
}
@@ -56,11 +67,25 @@ export function openBinding(input: {
)
return {
+ binding,
load(tabID) {
if (status.closed) return
void ready.then(() => client.load({ binding, tabID })).catch(() => undefined)
},
command: (command) => ready.then(() => client.command({ binding, command })),
+ closeTab: (owner, id) => ready.then(() => client.closeTab({ binding, owner, id })),
+ async createTab(owner, url, onScreen) {
+ if (!onScreen()) throw new Error("browser.pane.notOnScreen")
+ await ready
+
+ if (status.closed || !onScreen()) throw new Error("browser.pane.notOnScreen")
+
+ return client.createTab({ binding, owner, url })
+ },
+ find: (tabID, action) => ready.then(() => client.find({ binding, tabID, action })),
+ notice: (tabID, token, dismiss, copy) => ready.then(() => client.notice({ binding, tabID, token, dismiss, copy })),
+ reviewLink: (url) => ready.then(() => client.reviewLink({ binding, url })),
+ answer: (tabID, id, answer) => ready.then(() => client.answer({ binding, tabID, id, answer })),
inspect(tabID, enabled) {
if (status.closed) return
void ready.then(() => client.inspect({ binding, tabID, enabled })).catch(() => undefined)
@@ -77,6 +102,9 @@ export function openBinding(input: {
},
site: (tabID) => ready.then(() => client.site({ binding, tabID })),
clearSite: (tabID) => ready.then(() => client.clearSite({ binding, tabID })),
+ clearCache: (tabID, address) => ready.then(() => client.clearCache({ binding, tabID, address })),
+ reveal: (tabID) => ready.then(() => client.reveal({ binding, tabID })),
+ openPage: (tabID, expected) => ready.then(() => client.openPage({ binding, tabID, expected })),
close() {
if (status.closed) return
status.closed = true
diff --git a/packages/gui-plugins/src/browser/default-browser.test.ts b/packages/gui-plugins/src/browser/default-browser.test.ts
new file mode 100644
index 000000000000..f7661e39b1fe
--- /dev/null
+++ b/packages/gui-plugins/src/browser/default-browser.test.ts
@@ -0,0 +1,14 @@
+import { expect, test } from "bun:test"
+import { browserCommand } from "./default-browser"
+
+test("a verified document is a single URL argument to the HTTPS application, never the executable", () => {
+ const url = "file:///work/report%20%231.html"
+ const exe = "C:\\Program Files\\Browser\\browser.exe"
+ expect(browserCommand("win32", exe, url)).toEqual({ file: exe, args: [url] })
+ expect(browserCommand("darwin", "/Applications/Browser.app", url)).toEqual({ file: "/usr/bin/open", args: ["-a", "/Applications/Browser.app", url] })
+ expect(browserCommand("linux", "/usr/share/applications/browser.desktop", url)).toEqual({ file: "/usr/bin/gio", args: ["launch", "/usr/share/applications/browser.desktop", url] })
+ expect(browserCommand("win32", "browser.exe", url)).toBeUndefined()
+ expect(browserCommand("win32", "C:\\work\\entry.cmd", url)).toBeUndefined()
+ expect(browserCommand("darwin", "", url)).toBeUndefined()
+ expect(browserCommand("linux", "browser.desktop", url)).toBeUndefined()
+})
diff --git a/packages/gui-plugins/src/browser/default-browser.ts b/packages/gui-plugins/src/browser/default-browser.ts
new file mode 100644
index 000000000000..3325123b1b6a
--- /dev/null
+++ b/packages/gui-plugins/src/browser/default-browser.ts
@@ -0,0 +1,59 @@
+import { execFile, spawn } from "node:child_process"
+import { stat } from "node:fs/promises"
+import { homedir } from "node:os"
+import path from "node:path"
+import { pathToFileURL } from "node:url"
+import { promisify } from "node:util"
+import electron from "electron"
+
+/** Resolve the HTTPS application before checking the preview file. Never invoke the file's association. */
+export async function defaultBrowser() {
+ const platform = process.platform
+
+ const app = platform === "linux" ? await desktopEntry() :
+ (await electron.app.getApplicationInfoForProtocol("https://example.invalid")).path
+
+ return async (file: string) => {
+ const command = browserCommand(platform, app, pathToFileURL(file).href)
+
+ if (!command) throw new Error("browser.menu.failed")
+
+ if (platform !== "win32") {
+ await promisify(execFile)(command.file, command.args, { timeout: 10_000 })
+
+ return
+ }
+
+ // A newly started browser may live for hours. Completion is process creation, not its eventual exit.
+ await new Promise((resolve, reject) => {
+ const child = spawn(command.file, command.args, { shell: false, detached: true, stdio: "ignore" })
+ child.once("error", reject)
+ child.once("spawn", () => { child.unref(); resolve() })
+ })
+ }
+}
+
+export function browserCommand(platform: NodeJS.Platform, app: string, url: string) {
+ if (platform === "win32" && /^[a-z]:[\\/]/i.test(app) && /\.exe$/i.test(app)) return { file: app, args: [url] }
+
+ if (platform === "darwin" && path.posix.isAbsolute(app) && app.endsWith(".app")) return { file: "/usr/bin/open", args: ["-a", app, url] }
+
+ if (platform === "linux" && path.posix.isAbsolute(app) && app.endsWith(".desktop")) return { file: "/usr/bin/gio", args: ["launch", app, url] }
+}
+
+async function desktopEntry() {
+ const result = await promisify(execFile)("/usr/bin/xdg-mime", ["query", "default", "x-scheme-handler/https"], { timeout: 5_000, maxBuffer: 4096 })
+ const id = result.stdout.trim()
+
+ if (!/^[a-z0-9_][a-z0-9._-]*\.desktop$/i.test(id)) throw new Error("browser.menu.failed")
+ const home = process.env.XDG_DATA_HOME || path.join(homedir(), ".local/share")
+ const dirs = (process.env.XDG_DATA_DIRS || "/usr/local/share:/usr/share").split(":")
+
+ for (const root of [home, ...dirs].filter(dir => path.posix.isAbsolute(dir))) {
+ const file = path.join(root, "applications", id)
+
+ if (await stat(file).then(info => info.isFile(), () => false)) return file
+ }
+
+ throw new Error("browser.menu.failed")
+}
diff --git a/packages/gui-plugins/src/browser/diagnostics-machine.test.ts b/packages/gui-plugins/src/browser/diagnostics-machine.test.ts
index 57da6bb9cb11..ebd48b82293c 100644
--- a/packages/gui-plugins/src/browser/diagnostics-machine.test.ts
+++ b/packages/gui-plugins/src/browser/diagnostics-machine.test.ts
@@ -1,4 +1,5 @@
import { describe, expect, test } from "bun:test"
+import { Schema } from "effect"
import type { Protocol } from "devtools-protocol"
import {
evictHop,
@@ -81,6 +82,23 @@ const upgraded: ChainEvent = {
const hops = (chain: Chain | undefined) => chain?.hops.map(networkRequest) ?? []
+test("a redirect keeps extension provenance even when the next URL is an ordinary site", () => {
+ const first = sent("one", "https://site.test/start", 1)
+
+ if (first.type !== "request") throw new Error("Expected request")
+
+ const next = sent("two", "https://site.test/end", 2, { response: response(302), hasExtraInfo: false })
+ expect(replay([first, next])?.hops.map((hop) => hop.extension)).toEqual([false, false])
+ const extension = { ...first, event: { ...first.event, initiator: { type: "script" as const, url: "chrome-extension://example/index.js" } } }
+ expect(replay([extension, next])?.hops.map((hop) => hop.extension)).toEqual([true, true])
+})
+
+test("a failed request with no HTTP response is valid tool-result JSON", () => {
+ const requests = hops(replay([sent("h1", "workspace://session/file.html", 1), {type:"failed", timestamp:2, errorText:"net::ERR_FAILED"}]))
+ expect(Schema.decodeUnknownSync(Schema.Json)(requests)).toMatchObject([{state:"failed",failure:"net::ERR_FAILED"}])
+ expect(requests[0]).not.toHaveProperty("statusCode")
+})
+
describe("redirect chains", () => {
test("give each hop its own ExtraInfo when the network service runs ahead of the renderer", () => {
// Both hops' ExtraInfo arrived before either requestWillBeSent; the single stash slot used to keep only hop 2's.
diff --git a/packages/gui-plugins/src/browser/diagnostics-machine.ts b/packages/gui-plugins/src/browser/diagnostics-machine.ts
index ae0d79846ef5..617843c1b161 100644
--- a/packages/gui-plugins/src/browser/diagnostics-machine.ts
+++ b/packages/gui-plugins/src/browser/diagnostics-machine.ts
@@ -1,4 +1,4 @@
-import type { Browser } from "@opencode/plugin-browser/rpc"
+import { Browser } from "@opencode/plugin-browser/rpc"
import type { Protocol } from "devtools-protocol"
// One CDP request ID's hops. Chromium reuses a request ID across a redirect chain, and the network
@@ -26,6 +26,7 @@ export type HopPhase =
export type HopWire = "both" | "request" | "response" | "none"
export type Hop = {
+ readonly extension: boolean
readonly id: string
readonly nativeID: string
readonly sessionID: string | undefined
@@ -98,6 +99,7 @@ export function transitionChain(chain: Chain | undefined, event: ChainEvent): Ch
: supersede(current.hops, event.event.timestamp)
return append({ ...current, hops }, {
+ extension: (!!redirect && !!latest?.extension) || Browser.extensionOrigin(event.event.documentURL) || extensionSource(event.event.initiator.url, event.event.initiator.stack) || Browser.extensionOrigin(event.event.request.url),
id: event.id,
nativeID: event.event.requestId,
sessionID: event.sessionID,
@@ -116,6 +118,7 @@ export function transitionChain(chain: Chain | undefined, event: ChainEvent): Ch
case "ws.created":
return append({ ...current, hops: supersede(current.hops, undefined) }, {
+ extension: extensionSource(event.event.initiator?.url, event.event.initiator?.stack) || Browser.extensionOrigin(event.event.url),
id: event.id,
nativeID: event.event.requestId,
sessionID: event.sessionID,
@@ -259,24 +262,26 @@ export function evictHop(chain: Chain, id: string): Chain | undefined {
/** The hop as the browser tools report it. */
export function networkRequest(hop: Hop): Browser.NetworkRequest {
- const base = {
+ const base: Omit = {
id: hop.id,
url: hop.url,
method: hop.method,
resourceType: hop.resourceType,
timestampMs: hop.timestampMs,
- statusCode: hop.statusCode,
}
+ // A network failure need not have an HTTP response. An absent field is JSON; an own undefined value is not.
+ const request = hop.statusCode === undefined ? base : { ...base, statusCode: hop.statusCode }
+
switch (hop.phase.status) {
case "connecting":
case "pending":
- return { ...base, state: "pending" }
+ return { ...request, state: "pending" }
case "redirected":
case "completed":
- return { ...base, state: "completed", durationMs: hop.phase.durationMs }
+ return { ...request, state: "completed", durationMs: hop.phase.durationMs }
case "failed":
- return { ...base, state: "failed", durationMs: hop.phase.durationMs, failure: hop.phase.failure }
+ return { ...request, state: "failed", durationMs: hop.phase.durationMs, failure: hop.phase.failure }
}
}
@@ -335,15 +340,27 @@ function responseExtra(chain: Chain | undefined, current: Chain, wire: WireRespo
return { ...current, hops: replaceAt(current.hops, index, responseWire(current.hops[index], wire)) }
}
+/** Direct script URL or any synchronous/asynchronous caller attributed to an extension by Chromium. */
+export function extensionSource(url?: string, stack?: Protocol.Runtime.StackTrace) {
+ if (url && Browser.extensionOrigin(url)) return true
+
+ for (let trace = stack; trace; trace = trace.parent) {
+ if (trace.callFrames.some((frame) => Browser.extensionOrigin(frame.url))) return true
+ }
+
+ return false
+}
+
function append(
chain: Chain,
- input: Pick & {
+ input: Pick & {
started: number | undefined
},
): Chain {
const headers = trimHeaders(input.request.headers)
const created: Hop = {
+ extension: input.extension,
id: input.id,
nativeID: input.nativeID,
sessionID: input.sessionID,
diff --git a/packages/gui-plugins/src/browser/diagnostics.ts b/packages/gui-plugins/src/browser/diagnostics.ts
index a835cf26d576..9ff1fc024ed3 100644
--- a/packages/gui-plugins/src/browser/diagnostics.ts
+++ b/packages/gui-plugins/src/browser/diagnostics.ts
@@ -3,6 +3,7 @@ import type { Protocol } from "devtools-protocol"
import type { Cdp } from "./cdp"
import {
evictHop,
+ extensionSource,
MAX_RETAINED_REQUESTS,
MAX_STASHED_CHAINS,
networkRequest,
@@ -16,7 +17,7 @@ import {
const levels = ["debug", "info", "warning", "error"] as const
-export function createDiagnostics(cdp: Cdp) {
+export function createDiagnostics(cdp: Cdp, displayURL: (url: string) => string, pageContext: (id: number, sessionID?: string) => boolean) {
const messages: Browser.ConsoleEntry[] = []
// Every hop by its public id, oldest first.
const requests = new Map()
@@ -39,11 +40,11 @@ export function createDiagnostics(cdp: Cdp) {
id: `${scope}:${++sequence}`,
timestampMs,
level,
- text: text.slice(0, 2_000),
+ text: text.slice(0, 2_000).replace(/oc-preview:\/\/[^\s"'<>()[\]]+/gi, displayURL).slice(0, 2_000),
textTruncated: text.length > 2_000,
}
- messages.push(source ? { ...entry, source } : entry)
+ messages.push(source ? { ...entry, source: { ...source, url: displayURL(source.url) } } : entry)
if (messages.length > 500) {
messages.shift()
@@ -99,7 +100,8 @@ export function createDiagnostics(cdp: Cdp) {
}
}
- cdp.on("Runtime.consoleAPICalled", (event) => {
+ cdp.on("Runtime.consoleAPICalled", (event, sessionID) => {
+ if (!pageContext(event.executionContextId, sessionID) || extensionSource(undefined, event.stackTrace)) return
const source = event.stackTrace?.callFrames[0]
add(
event.type === "error" || event.type === "assert"
@@ -128,6 +130,8 @@ export function createDiagnostics(cdp: Cdp) {
// are Log entries, not Runtime console calls.
cdp.on("Log.entryAdded", (event) => {
const entry = event.entry
+
+ if (extensionSource(entry.url, entry.stackTrace)) return
add(
entry.level === "verbose" ? "debug" : entry.level,
entry.text,
@@ -137,8 +141,10 @@ export function createDiagnostics(cdp: Cdp) {
: undefined,
)
})
- cdp.on("Runtime.exceptionThrown", (event) => {
+ cdp.on("Runtime.exceptionThrown", (event, sessionID) => {
const error = event.exceptionDetails
+
+ if ((error.executionContextId !== undefined && !pageContext(error.executionContextId, sessionID)) || extensionSource(error.url, error.stackTrace)) return
add(
"error",
error.exception?.description ?? error.text,
@@ -148,7 +154,7 @@ export function createDiagnostics(cdp: Cdp) {
})
cdp.on("Network.requestWillBeSent", (event, sessionID) =>
- apply(`${sessionID ?? ""}:${event.requestId}`, { type: "request", id: `${scope}:${++sequence}`, sessionID, event }),
+ apply(`${sessionID ?? ""}:${event.requestId}`, { type: "request", id: `${scope}:${++sequence}`, sessionID, event: { ...event, request: { ...event.request, url: displayURL(event.request.url) } } }),
)
cdp.on("Network.requestWillBeSentExtraInfo", (event, sessionID) =>
apply(`${sessionID ?? ""}:${event.requestId}`, { type: "request.extra", headers: event.headers }),
@@ -208,7 +214,7 @@ export function createDiagnostics(cdp: Cdp) {
const retained = (id: string, message: string) => {
const hop = requests.get(id)
- if (!hop) throw new Error(message)
+ if (!hop || hop.extension) throw new Error(message)
return hop
}
@@ -241,6 +247,7 @@ export function createDiagnostics(cdp: Cdp) {
const matching = Array.from(requests.values())
.filter(
(hop) =>
+ !hop.extension &&
(!input.urlContains || hop.url.includes(input.urlContains)) &&
(!input.resourceType || input.resourceType === hop.resourceType),
)
@@ -277,7 +284,7 @@ export function createDiagnostics(cdp: Cdp) {
return value.length ? { state: "text", text: value.slice(0, max), truncated: value.length > max } : { state: "empty" }
}
- const known = responseBody(hop, input.includeBody)
+ const known = responseBody(hop, input.includeResponseBody ?? input.includeBody)
return {
request: networkRequest(hop),
diff --git a/packages/gui-plugins/src/browser/dialog-machine.test.ts b/packages/gui-plugins/src/browser/dialog-machine.test.ts
index 5c19092fa905..1416d6de3fa0 100644
--- a/packages/gui-plugins/src/browser/dialog-machine.test.ts
+++ b/packages/gui-plugins/src/browser/dialog-machine.test.ts
@@ -1,9 +1,12 @@
import { describe, expect, test } from "bun:test"
import {
createDialogGateState,
+ REPEAT_DIALOG_MS,
selectDialog,
selectDialogTarget,
selectOpenDialog,
+ selectSuppressed,
+ selectUserDialog,
transitionDialogGate,
type DialogGateEvent,
type DialogGateState,
@@ -12,12 +15,13 @@ import {
const replay = (events: readonly DialogGateEvent[], state: DialogGateState = createDialogGateState()) =>
events.reduce((current, event) => transitionDialogGate(current, event).state, state)
-const alert = (message: string): DialogGateEvent => ({
+const alert = (message: string, at?: number): DialogGateEvent => ({
type: "dialog.opened",
url: "https://alpha.example/form",
dialogType: "alert",
message,
defaultPrompt: "",
+ at,
})
describe("handling a dialog", () => {
@@ -56,6 +60,82 @@ describe("handling a dialog", () => {
})
})
+describe("the user and the agent answering", () => {
+ test("lets the first answer through and finds the dialog closed for the second", () => {
+ const open = replay([alert("first")])
+ const revision = selectOpenDialog(open)!.revision
+ const user = transitionDialogGate(open, { type: "dialog.answering", revision, by: "user" })
+
+ expect(user.answer).toBe("accepted")
+ expect(transitionDialogGate(user.state, { type: "dialog.answering", revision, by: "agent" }).answer).toBe("closed")
+ // The agent's answer after Chromium closed it finds no dialog either.
+ const handled = transitionDialogGate(user.state, { type: "dialog.handled", revision }).state
+ expect(transitionDialogGate(handled, { type: "dialog.answering", revision, by: "agent" }).answer).toBe("closed")
+ })
+
+ test("lets the dialog be answered again when the first answer failed to reach Chromium", () => {
+ const open = replay([alert("first")])
+ const revision = selectOpenDialog(open)!.revision
+
+ const failed = replay(
+ [
+ { type: "dialog.answering", revision, by: "agent" },
+ { type: "dialog.answer-failed", revision },
+ ],
+ open,
+ )
+
+ expect(transitionDialogGate(failed, { type: "dialog.answering", revision, by: "user" }).answer).toBe("accepted")
+ })
+
+ test("never answers a newer dialog with an older one's answer", () => {
+ const first = replay([alert("first")])
+ const revision = selectOpenDialog(first)!.revision
+ const second = replay([{ type: "dialog.closed" }, alert("second")], first)
+
+ expect(transitionDialogGate(second, { type: "dialog.answering", revision, by: "user" }).answer).toBe("closed")
+ })
+
+ test("shows the user scripted dialogs only, not a beforeunload", () => {
+ expect(selectUserDialog(replay([alert("first")]))?.dialog.message).toBe("first")
+ expect(
+ selectUserDialog(
+ replay([{ type: "dialog.opened", url: "https://a.example/", dialogType: "beforeunload", message: "", defaultPrompt: "" }]),
+ ),
+ ).toBeNull()
+ })
+})
+
+describe("repeated dialogs", () => {
+ test("offers to stop them on a dialog that opens soon after the last one closed", () => {
+ const first = replay([alert("one", 0)])
+ expect(selectUserDialog(first)?.repeat).toBe(false)
+
+ const soon = replay([{ type: "dialog.closed", at: 500 }, alert("two", 500 + REPEAT_DIALOG_MS)], first)
+ expect(selectUserDialog(soon)?.repeat).toBe(true)
+
+ const late = replay([{ type: "dialog.closed", at: 500 }, alert("two", 501 + REPEAT_DIALOG_MS)], first)
+ expect(selectUserDialog(late)?.repeat).toBe(false)
+ })
+
+ test("dismisses every dialog once stopped, without interrupting commands, until the next document", () => {
+ const stopped = replay([
+ { type: "run.started", actionType: "click", aborted: false },
+ { type: "dialog.suppressed" },
+ ])
+
+ const opened = transitionDialogGate(stopped, alert("again"))
+
+ expect(selectSuppressed(stopped)).toBe(true)
+ expect(opened.effects).toEqual([{ type: "dismiss" }])
+ expect(selectDialog(opened.state)).toBeNull()
+
+ const next = replay([{ type: "document.committed" }, alert("new page")], stopped)
+ expect(selectSuppressed(next)).toBe(false)
+ expect(selectDialog(next)?.message).toBe("new page")
+ })
+})
+
describe("starting a command", () => {
test("refuses a command whose caller already aborted", () => {
expect(
diff --git a/packages/gui-plugins/src/browser/dialog-machine.ts b/packages/gui-plugins/src/browser/dialog-machine.ts
index c0e55e0fd499..7ae8aa417347 100644
--- a/packages/gui-plugins/src/browser/dialog-machine.ts
+++ b/packages/gui-plugins/src/browser/dialog-machine.ts
@@ -2,14 +2,30 @@
// every running command but a dialog command, and refuses new ones until it is handled. Commands register here before
// their first await, so a dialog or a cancellation that arrives while one still inspects its target interrupts it too.
// Each dialog event moves `revision`, and handling a dialog closes only the revision it answered: a dialog the page
-// opens right after stays open.
+// opens right after stays open. The user (in the pane) and the agent (browser.dialog) answer the same dialog: the
+// first to start answering a revision does, and the other finds it closed.
import type { Browser } from "@opencode/plugin-browser/rpc"
export type DialogInfo = { readonly type: string; readonly message: string; readonly defaultValue: string }
export type ModalDialog =
| { readonly open: false; readonly revision: number }
- | { readonly open: true; readonly revision: number; readonly url: string; readonly dialog: DialogInfo }
+ | {
+ readonly open: true
+ readonly revision: number
+ readonly url: string
+ readonly dialog: DialogInfo
+ /** It opened within `REPEAT_DIALOG_MS` of the last one closing, so the user may stop the page's dialogs. */
+ readonly repeat?: boolean
+ /** Who is answering it; the other one finds it closed. */
+ readonly answering?: "user" | "agent"
+ }
+
+/** Chrome offers to stop a page's dialogs when one opens this soon after the last closed. */
+export const REPEAT_DIALOG_MS = 1_000
+
+/** Dialog types the page's script opens; a `beforeunload` dialog is the pane's "Leave site?" instead. */
+const scripted = ["alert", "confirm", "prompt"]
/**
* Why a command stopped or never started.
@@ -28,6 +44,10 @@ export type DialogGateState =
readonly modal: ModalDialog
/** Running commands by run id, with their action type. */
readonly runs: ReadonlyMap
+ /** The user stopped this document's dialogs: each one is dismissed at once until the next document. */
+ readonly suppressed?: boolean
+ /** When the last scripted dialog closed, for `repeat`. */
+ readonly lastClosedAt?: number
}
| { readonly status: "disposed" }
@@ -38,10 +58,19 @@ export type DialogGateEvent =
readonly dialogType: string
readonly message: string
readonly defaultPrompt: string
+ readonly at?: number
}
- | { readonly type: "dialog.closed" }
+ | { readonly type: "dialog.closed"; readonly at?: number }
/** `Page.handleJavaScriptDialog` answered the dialog of `revision`. */
- | { readonly type: "dialog.handled"; readonly revision: number }
+ | { readonly type: "dialog.handled"; readonly revision: number; readonly at?: number }
+ /** The user or the agent starts answering the dialog of `revision`; only the first one does. */
+ | { readonly type: "dialog.answering"; readonly revision: number; readonly by: "user" | "agent" }
+ /** The answer of `revision` did not reach Chromium; the dialog may be answered again. */
+ | { readonly type: "dialog.answer-failed"; readonly revision: number }
+ /** The user chose to stop this document's dialogs. */
+ | { readonly type: "dialog.suppressed" }
+ /** The main frame committed another document, which may show dialogs again. */
+ | { readonly type: "document.committed" }
| { readonly type: "run.started"; readonly actionType: Browser.Method; readonly aborted: boolean }
| { readonly type: "run.cancelled"; readonly runID: number }
| { readonly type: "run.finished"; readonly runID: number }
@@ -56,6 +85,8 @@ export type DialogGateEffect =
readonly reason: Exclude
readonly abort: boolean
}
+ /** Dismisses a dialog of a document whose dialogs the user stopped. */
+ | { readonly type: "dismiss" }
/** The answer to `run.started`. */
export type RunReply =
@@ -67,6 +98,8 @@ export type DialogGateTransition = {
readonly effects: readonly DialogGateEffect[]
/** Set for `run.started`. */
readonly reply?: RunReply
+ /** Set for `dialog.answering`: whether this answer may go to Chromium, or another one came first. */
+ readonly answer?: "accepted" | "closed"
}
const PUBLISH: DialogGateEffect = { type: "publish" }
@@ -87,6 +120,8 @@ export function transitionDialogGate(state: DialogGateState, event: DialogGateEv
switch (event.type) {
case "dialog.opened": {
+ // The page already got its answer, or gets it now: nothing waits on it, so no command stops.
+ if (state.suppressed && scripted.includes(event.dialogType)) return { state, effects: [{ type: "dismiss" }] }
// A navigation is left alone: its beforeunload dialog is answered through browser.dialog, and the pending load
// then proceeds or not. Every other action stops before its next step, so a validation alert on one field stops
// the rest.
@@ -100,6 +135,11 @@ export function transitionDialogGate(state: DialogGateState, event: DialogGateEv
revision: state.modal.revision + 1,
url: event.url,
dialog: { type: event.dialogType, message: event.message, defaultValue: event.defaultPrompt },
+ repeat:
+ scripted.includes(event.dialogType) &&
+ state.lastClosedAt !== undefined &&
+ event.at !== undefined &&
+ event.at - state.lastClosedAt <= REPEAT_DIALOG_MS,
},
runs: interrupted.length
? new Map([...state.runs].filter(([, actionType]) => actionType === "dialog"))
@@ -122,11 +162,27 @@ export function transitionDialogGate(state: DialogGateState, event: DialogGateEv
case "dialog.closed":
if (!state.modal.open) return { state, effects: [] }
- return { state: { ...state, modal: { open: false, revision: state.modal.revision + 1 } }, effects: [PUBLISH] }
+ return { state: close(state, event.at), effects: [PUBLISH] }
case "dialog.handled":
if (!state.modal.open || state.modal.revision !== event.revision) return { state, effects: [] }
- return { state: { ...state, modal: { open: false, revision: state.modal.revision + 1 } }, effects: [PUBLISH] }
+ return { state: close(state, event.at), effects: [PUBLISH] }
+ case "dialog.answering":
+ if (!state.modal.open || state.modal.revision !== event.revision || state.modal.answering)
+ return { state, effects: [], answer: "closed" }
+
+ return { state: { ...state, modal: { ...state.modal, answering: event.by } }, effects: [], answer: "accepted" }
+ case "dialog.answer-failed":
+ if (!state.modal.open || state.modal.revision !== event.revision || !state.modal.answering)
+ return { state, effects: [] }
+
+ return { state: { ...state, modal: { ...state.modal, answering: undefined } }, effects: [] }
+ case "dialog.suppressed":
+ return { state: { ...state, suppressed: true }, effects: [] }
+ case "document.committed":
+ if (!state.suppressed && state.lastClosedAt === undefined) return { state, effects: [] }
+
+ return { state: { ...state, suppressed: false, lastClosedAt: undefined }, effects: [] }
case "run.started": {
if (event.aborted) return { state, effects: [], reply: { status: "refused", reason: "cancelled" } }
@@ -185,6 +241,28 @@ export function selectDialogTarget(state: DialogGateState, generation: number, p
}
}
+/** A scripted dialog the user answers in the pane, with its revision; null while none is open or it is a beforeunload. */
+export function selectUserDialog(state: DialogGateState) {
+ if (state.status !== "active" || !state.modal.open || !scripted.includes(state.modal.dialog.type)) return null
+
+ return state.modal
+}
+
+/** Whether the user stopped this document's dialogs, so a new one is dismissed before anyone sees it. */
+export function selectSuppressed(state: DialogGateState) {
+ return state.status === "active" && !!state.suppressed
+}
+
+function close(state: Extract, at: number | undefined) {
+ const scriptedDialog = state.modal.open && scripted.includes(state.modal.dialog.type)
+
+ return {
+ ...state,
+ modal: { open: false as const, revision: state.modal.revision + 1 },
+ lastClosedAt: scriptedDialog && at !== undefined ? at : state.lastClosedAt,
+ }
+}
+
function without(runs: ReadonlyMap, runID: number) {
return new Map([...runs].filter(([id]) => id !== runID))
}
diff --git a/packages/gui-plugins/src/browser/electron-address.fixture.ts b/packages/gui-plugins/src/browser/electron-address.fixture.ts
new file mode 100644
index 000000000000..1c960f70c826
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-address.fixture.ts
@@ -0,0 +1,140 @@
+import { createServer } from "node:http"
+import path from "node:path"
+import { pathToFileURL } from "node:url"
+import electron from "electron"
+import type { BuiltinMainStorage } from "@opencode/plugin/gui/builtin"
+import type { Embeds } from "@opencode/plugin/gui/main"
+
+// The Electron main process of `electron-address.test.ts`, bundled and run by the pinned Electron. It opens one pane
+// page with a workspace, as the pane does for the built-in local server, and submits addresses to it as the address
+// bar does: a file inside the workspace, one outside, a web page, and a web page while the extension startup gate
+// holds navigations, followed by Stop. It prints what the tab showed after each as one JSON line.
+
+const requests: string[] = []
+
+const server = createServer((request, response) => {
+ requests.push(request.url ?? "")
+ response.writeHead(200, { "content-type": "text/html" })
+ response.end("Webweb
")
+})
+
+void electron.app.whenReady().then(async () => {
+ const { Browser } = await import("@opencode/plugin-browser/rpc")
+ const { createBrowserPage } = await import("./chromium")
+ const { refusal } = await import("./policy")
+ const { createPreviews } = await import("./profile/previews")
+ const { guardSession } = await import("./session-guard")
+ const { createSitePermissions } = await import("./site-permissions")
+ const { createSystemMedia } = await import("./system-media")
+ const { workspacePages } = await import("./workspace-pages")
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve))
+ const address = server.address()
+ const origin = `http://127.0.0.1:${address instanceof Object ? address.port : 0}`
+ const root = process.env.ELECTRON_ADDRESS_ROOT ?? ""
+ const outside = pathToFileURL(process.env.ELECTRON_ADDRESS_OUTSIDE ?? "").href
+ const inside = pathToFileURL(path.join(root, "inside.html")).href
+ const win = new electron.BrowserWindow({ show: false, width: 800, height: 600 })
+ const values = new Map()
+
+ // SAFETY: the site permissions read only `store` and its `value` and `set`.
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
+ const storage = {
+ store: (key: string, options: { initial: unknown }) => ({
+ get value() {
+ return values.has(key) ? values.get(key) : options.initial
+ },
+ // oxlint-disable-next-line anti-slop/no-unknown-parameters -- see SAFETY above
+ set: (next: unknown) => values.set(key, next),
+ }),
+ } as unknown as BuiltinMainStorage
+
+ // The window host owns bounds and occlusion; here the view fills the window and shows when the page says so.
+ const embeds: Embeds = {
+ create(view, window) {
+ window.contentView.addChildView(view)
+ view.setBounds({ x: 0, y: 0, width: 800, height: 600 })
+
+ return {
+ id: "embed",
+ show: (visible) => view.setVisible(visible),
+ on: () => () => undefined,
+ capture: async () => undefined,
+ dispose: () => window.contentView.removeChildView(view),
+ }
+ },
+ }
+
+ const tabID = Browser.TabID.make("tab_11111111-1111-1111-1111-111111111111")
+ const signal = new AbortController().signal
+ const refs = { next: 0 }
+ const partition = "address-fixture"
+ const session = electron.session.fromPartition(partition)
+ const previews = createPreviews(session, signal)
+ guardSession(session, new Map())
+ // The extension startup gate, closed on demand: it holds web navigations until its extensions answer.
+ const gate = { held: false }
+
+ const page = createBrowserPage(win, {
+ id: tabID,
+ partition,
+ network: null,
+ publish: () => undefined,
+ refused: () => undefined,
+ fail: () => undefined,
+ popup: () => {
+ throw new Error("The fixture page opens no window.")
+ },
+ activity: { agentRuns: 0 },
+ userInput: () => undefined,
+ local: true,
+ signal,
+ fileRoots: () => [root],
+ workspace: workspacePages(previews, root, { type: "local", roots: () => [root] }, signal, () => undefined),
+ previewFailure: previews.failure,
+ waitForFilters: (url, stop) =>
+ gate.held && /^https?:/.test(url)
+ ? new Promise((_resolve, reject) => stop.addEventListener("abort", () => reject(stop.reason), { once: true }))
+ : undefined,
+ shared: { ref: () => `e${++refs.next}` },
+ menu: { t: (key) => key, extensions: () => [], navigate: async () => undefined, open: async () => undefined },
+ embeds,
+ sites: createSitePermissions(storage, () => undefined),
+ system: createSystemMedia(),
+ })
+
+ await page.ready
+
+ const command = (action: { type: "navigate"; url: string } | { type: "stop" }) =>
+ page.execute({ action: { ...action, tabID }, files: [] }, signal, "user").then(
+ () => "done",
+ (error: Error) => error.message,
+ )
+
+ // What the address bar and the strip show, and whether the document on screen is a scoped preview.
+ const shown = () => {
+ const tab = page.state()
+
+ return { url: tab.url, title: tab.title, error: tab.loadError, preview: page.contents.getURL().startsWith("oc-preview://") }
+ }
+
+ const typed = async (url: string) => ({ outcome: await command({ type: "navigate", url }), ...shown() })
+ const file = await typed(inside)
+ // The window explains this code as its refusal notice before the address reaches the page (`command` in pane.ts).
+ const notice = refusal(outside, { fileRoots: [root] })
+ const refused = await typed(outside)
+ const web = await typed(`${origin}/web`)
+ await typed(inside)
+ gate.held = true
+ const before = requests.length
+ const held = command({ type: "navigate", url: `${origin}/held` })
+
+ const spinning = (): Promise =>
+ page.state().loading ? Promise.resolve() : new Promise((resolve) => setImmediate(resolve)).then(spinning)
+
+ await spinning()
+ const stopped = { outcome: await command({ type: "stop" }), held: await held, ...shown(), requests: requests.length - before }
+ process.stdout.write(`${JSON.stringify({ inside, origin, file, notice, refused, web, stopped })}\n`)
+ await page.dispose()
+ server.close()
+ electron.app.quit()
+})
diff --git a/packages/gui-plugins/src/browser/electron-address.test.ts b/packages/gui-plugins/src/browser/electron-address.test.ts
new file mode 100644
index 000000000000..12cf1c4d2fb6
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-address.test.ts
@@ -0,0 +1,49 @@
+import { expect, test } from "bun:test"
+import { realpathSync } from "node:fs"
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises"
+import { tmpdir } from "node:os"
+import path from "node:path"
+import { schemes } from "../schemes"
+import { runElectronFixture } from "./electron-run"
+
+// An address typed in the pane reaches the page as a user's `navigate` (`createBrowserPage` in chromium.ts). A file
+// inside the session's workspace opens as a scoped preview through the real protocol handler and file checks, which no
+// pure test reaches. This runs that path in the pinned Electron.
+test(
+ "a typed workspace file opens as a preview, one outside is refused in place, a web address loads, and Stop during the startup gate keeps the committed page",
+ async () => {
+ // The canonical name: the preview's file checks compare physical paths, and Windows temp paths can be 8.3 names.
+ const base = realpathSync.native(await mkdtemp(path.join(tmpdir(), "electron-address-")))
+
+ try {
+ const root = path.join(base, "workspace")
+ await mkdir(root)
+ await writeFile(path.join(root, "inside.html"), 'Inside')
+ await writeFile(path.join(root, "frame.html"), "Frame")
+ await writeFile(path.join(base, "outside.html"), "Outside")
+
+ const result = JSON.parse(
+ await runElectronFixture({
+ fixture: path.join(import.meta.dir, "electron-address.fixture.ts"),
+ schemes,
+ env: { ELECTRON_ADDRESS_ROOT: root, ELECTRON_ADDRESS_OUTSIDE: path.join(base, "outside.html") },
+ }),
+ )
+
+ const preview = { url: result.inside, title: "Inside", preview: true }
+ // The bar shows the file's own address; the document on screen is the scoped preview, never a native file origin.
+ expect(result.file).toEqual({ outcome: "done", ...preview })
+ // Outside the workspace: the window's refusal notice, and the previous page stays with its address.
+ expect(result.notice).toBe("browser.address.workspace")
+ expect(result.refused).toEqual({ outcome: "Only HTTP, HTTPS, about:blank, and file URLs inside the workspace are supported.", ...preview })
+ expect(result.web).toEqual({ outcome: "done", url: `${result.origin}/web`, title: "Web", preview: false })
+ // Typed while the gate holds web navigations, then Stop: nothing was requested and the bar shows the committed
+ // document, not the address that never loaded.
+ expect(result.stopped).toEqual({ outcome: "done", held: "done", ...preview, requests: 0 })
+ } finally {
+ await rm(base, { recursive: true, force: true })
+ }
+ },
+ // Starting Electron takes seconds on a loaded runner.
+ 60_000,
+)
diff --git a/packages/gui-plugins/src/browser/electron-dialogs.fixture.ts b/packages/gui-plugins/src/browser/electron-dialogs.fixture.ts
new file mode 100644
index 000000000000..9284e7021abe
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-dialogs.fixture.ts
@@ -0,0 +1,114 @@
+import { createServer } from "node:http"
+import electron from "electron"
+import { createCdp } from "./cdp"
+import { guardFileChoosers } from "./file-choosers"
+import { recordPageInput, type TabActivity } from "./policy"
+import { RESTORE_PROMPT, takeDialogs } from "./page-prompts"
+
+// The Electron main process of `electron-dialogs.test.ts`, bundled and run by the pinned Electron. It opens a sandboxed
+// page as the pane does, takes its dialogs, answers each through CDP, and prints what happened as one JSON line.
+
+const page = `dialogs`
+
+const server = createServer((_request, response) => {
+ // The pane's strictest case: the page may load nothing, frames included, and run no script of its own.
+ response.writeHead(200, { "content-type": "text/html", "content-security-policy": "default-src 'none'; frame-src 'none'" })
+ response.end(page)
+})
+
+void electron.app.whenReady().then(async () => {
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve))
+ const address = server.address()
+ const origin = `http://127.0.0.1:${address instanceof Object ? address.port : 0}`
+ const win = new electron.BrowserWindow({ show: false })
+ const view = new electron.WebContentsView({ webPreferences: { sandbox: true, contextIsolation: true } })
+ win.contentView.addChildView(view)
+ const contents = view.webContents
+ // SAFETY: Electron's own internal events on a WebContents, read here only to count them.
+ const events: NodeJS.EventEmitter = contents
+ const before = events.listenerCount("-run-dialog")
+ const warnings: string[] = []
+ const opened: { type: string; message: string; origin?: string }[] = []
+ let open = false
+
+ const dialogs = takeDialogs(contents, {
+ suppressed: () => false,
+ opened: () => open,
+ framed: () => {},
+ warn: (message) => warnings.push(message),
+ })
+
+ // CDP's Page domain answers only once the page has a renderer.
+ await contents.loadURL("about:blank")
+ contents.debugger.attach("1.3")
+ contents.debugger.on("message", (_event, method, params) => {
+ if (method === "Page.javascriptDialogClosed") {
+ open = false
+ dialogs.closed()
+ }
+
+ if (method !== "Page.javascriptDialogOpening") return
+ open = true
+ // Answer once Electron reported the dialog too, as the user reads it in the pane.
+ setTimeout(() => {
+ opened.push({ type: params.type, message: params.message, origin: dialogs.frame()?.origin })
+ void contents.debugger.sendCommand("Page.handleJavaScriptDialog", { accept: true, promptText: "typed" })
+ }, 100)
+ })
+ await contents.debugger.sendCommand("Page.enable")
+ await contents.debugger.sendCommand("Page.addScriptToEvaluateOnNewDocument", { source: RESTORE_PROMPT, runImmediately: true })
+ await contents.loadURL(`${origin}/`)
+
+ const answers = await contents.executeJavaScript(`[alert("a"), confirm("c"), prompt("p", "d")]`)
+ const cdp = createCdp(contents)
+ const backup = await cdp.send("Target.attachToTarget", { targetId: contents.getOrCreateDevToolsTargetId(), flatten: true })
+ // Independent inspector: the user controls, and even a broken product guard, must NEVER show system UI in CI.
+ await cdp.send("Page.enable", {}, backup.sessionId)
+ await cdp.send("Page.setInterceptFileChooserDialog", { enabled: true, cancel: true }, backup.sessionId)
+ const intercepts = { backup: 0, product: 0 }
+ contents.debugger.on("message", (_event, method, _params, sessionID) => {
+ if (method === "Page.fileChooserOpened") intercepts[sessionID === backup.sessionId ? "backup" : "product"]++
+ })
+ const activity: TabActivity = { agentRuns: 0 }
+ const refusals: string[] = []
+ const guard = guardFileChoosers(cdp, activity, message => refusals.push(message))
+ await guard.attach()
+
+ const choose = async (expression: string) => {
+ const before = refusals.length
+ await cdp.send("Runtime.evaluate", { expression, userGesture: true, awaitPromise: true })
+ // Flush Page events even if the DOM call itself was synchronous.
+ await cdp.send("Page.getFrameTree")
+
+ return refusals.length - before
+ }
+
+ const file = `Object.assign(document.createElement('input'), {type:'file'}).click()`
+ const user = await choose(file)
+ activity.agentRuns++
+ await guard.update()
+ const picks = []
+
+ for (const expression of [file, ...["OpenFile", "SaveFile", "Directory"].map(type => `show${type}Picker().catch(e => e.name)`)])
+ picks.push(await choose(expression))
+
+ activity.agentRuns--
+ recordPageInput(activity, "agent")
+ await guard.update()
+ const delayed = await choose(file)
+ recordPageInput(activity, "user")
+ await guard.update()
+ const returned = await choose(file)
+ guard.dispose()
+ cdp.dispose()
+ // A dialog nobody answers through CDP still lets the page go: the takeover dismisses it.
+ contents.debugger.detach()
+ const unanswered = await contents.executeJavaScript(`confirm("nobody")`)
+ process.stdout.write(`${JSON.stringify({ before, after: events.listenerCount("-run-dialog"), warnings, opened, answers, unanswered, origin, choosers: { user, picks, delayed, returned, intercepts } })}\n`)
+ dialogs.dispose()
+ server.close()
+ electron.app.quit()
+}).catch(error => {
+ console.error(error)
+ electron.app.exit(1)
+})
diff --git a/packages/gui-plugins/src/browser/electron-dialogs.test.ts b/packages/gui-plugins/src/browser/electron-dialogs.test.ts
new file mode 100644
index 000000000000..d39e29113f3a
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-dialogs.test.ts
@@ -0,0 +1,28 @@
+import { expect, test } from "bun:test"
+import path from "node:path"
+import { runElectronFixture } from "./electron-run"
+
+// The pane takes a page's dialogs through Electron internals (`takeDialogs` in page-prompts.ts). This runs it in the
+// pinned Electron, so an upgrade that changes them fails here rather than in a user's page.
+test(
+ "the pinned Electron hands the pane every dialog of a sandboxed page, which never hangs or shows a native box",
+ async () => {
+ const result = JSON.parse(await runElectronFixture({ fixture: path.join(import.meta.dir, "electron-dialogs.fixture.ts") }))
+
+ // Electron's own listener draws the native box; the pane's replaces it, and Electron's contract matched.
+ expect(result.before).toBe(1)
+ expect(result.after).toBe(1)
+ expect(result.warnings).toEqual([])
+ expect(result.opened).toEqual([
+ { type: "alert", message: "a", origin: result.origin },
+ { type: "confirm", message: "c", origin: result.origin },
+ { type: "prompt", message: "p", origin: result.origin },
+ ])
+ // prompt() answers as Chromium's own does, under a CSP that allows no frame.
+ expect(result.answers).toEqual([null, true, "typed"])
+ expect(result.unanswered).toBe(false)
+ expect(result.choosers).toEqual({ user: 0, picks: [1, 1, 1, 1], delayed: 1, returned: 0, intercepts: { backup: 7, product: 5 } })
+ },
+ // Starting Electron takes seconds on a loaded runner; the takeover's own fallback waits 2 seconds.
+ 60_000,
+)
diff --git a/packages/gui-plugins/src/browser/electron-media.fixture.ts b/packages/gui-plugins/src/browser/electron-media.fixture.ts
new file mode 100644
index 000000000000..1d787e6a4602
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-media.fixture.ts
@@ -0,0 +1,66 @@
+import { createServer } from "node:http"
+import electron from "electron"
+import { createCdp } from "./cdp"
+import { guardMediaRequests } from "./media-gate"
+
+// The Electron main process of `electron-media.test.ts`, bundled and run by the pinned Electron with fake capture
+// devices. It holds a page's getUserMedia with the media gate and prints, as one JSON line, the order in which the gate
+// and the session's permission handler were reached. The handler refuses everything: nothing is ever granted.
+
+electron.app.commandLine.appendSwitch("use-fake-device-for-media-stream")
+
+const server = createServer((_request, response) => {
+ response.writeHead(200, { "content-type": "text/html" })
+ response.end("media")
+})
+
+void electron.app.whenReady().then(async () => {
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve))
+ const address = server.address()
+ const origin = `http://127.0.0.1:${address instanceof Object ? address.port : 0}`
+ const win = new electron.BrowserWindow({ show: false })
+ const view = new electron.WebContentsView({ webPreferences: { sandbox: true, contextIsolation: true, partition: "media-gate" } })
+ win.contentView.addChildView(view)
+ const contents = view.webContents
+ const events: string[] = []
+ const answers: boolean[] = []
+
+ view.webContents.session.setPermissionRequestHandler((_contents, permission, callback) => {
+ events.push(`handler ${permission}`)
+ callback(false)
+ })
+ await contents.loadURL("about:blank")
+ const cdp = createCdp(contents)
+
+ const media = guardMediaRequests(cdp, async (ask) => {
+ events.push(`gate ${ask.origin} ${ask.mainFrame} ${ask.kinds.join(",")}`)
+ // The user takes a moment; nothing may reach Chromium's media stack meanwhile.
+ await new Promise((resolve) => setTimeout(resolve, 300))
+ const allowed = answers.shift() ?? false
+ events.push(`answered ${allowed}`)
+
+ return allowed
+ })
+
+ await cdp.send("Runtime.enable")
+ await cdp.send("Page.enable")
+ await media.attach()
+ await contents.loadURL(`${origin}/`)
+
+ const call = `navigator.mediaDevices.getUserMedia({ audio: true }).then(() => "granted", (error) => error.name)`
+ answers.push(false)
+ const blocked = await contents.executeJavaScript(call)
+ const afterBlock = [...events]
+ events.length = 0
+ answers.push(true)
+ const released = await contents.executeJavaScript(call)
+
+ const legacy = await contents.executeJavaScript(
+ `new Promise((resolve) => navigator.webkitGetUserMedia ? navigator.webkitGetUserMedia({ video: true }, () => resolve("granted"), (error) => resolve(error.name)) : resolve("none"))`,
+ )
+
+ process.stdout.write(`${JSON.stringify({ origin, blocked, afterBlock, released, afterRelease: events, legacy })}\n`)
+ media.dispose()
+ server.close()
+ electron.app.quit()
+})
diff --git a/packages/gui-plugins/src/browser/electron-media.test.ts b/packages/gui-plugins/src/browser/electron-media.test.ts
new file mode 100644
index 000000000000..171ca92ca8fe
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-media.test.ts
@@ -0,0 +1,25 @@
+import { expect, test } from "bun:test"
+import path from "node:path"
+import { runElectronFixture } from "./electron-run"
+
+// The media gate (media-gate.ts) must hold a page's getUserMedia before Chromium's media stack runs, as that stack opens
+// microphones to read their capabilities and makes macOS ask for them. This runs it in the pinned Electron with fake
+// devices: the permission handler, the first step Chromium takes after that stack, is never reached before the gate's
+// answer, and not at all after a refusal.
+test(
+ "the pinned Electron reaches nothing of the media stack before the pane answers a page's getUserMedia",
+ async () => {
+ const result = JSON.parse(await runElectronFixture({ fixture: path.join(import.meta.dir, "electron-media.fixture.ts") }))
+
+ // Refused by the pane: the page is told no and Chromium never sees the request.
+ expect(result.blocked).toBe("NotAllowedError")
+ expect(result.afterBlock).toEqual([`gate ${result.origin} true microphone`, "answered false"])
+ // Let through: only then does Chromium ask the session (which refuses here, so nothing is ever granted).
+ expect(result.released).toBe("NotAllowedError")
+ expect(result.afterRelease.slice(0, 3)).toEqual([`gate ${result.origin} true microphone`, "answered true", "handler media"])
+ // The legacy callback form goes through the same gate.
+ expect(result.legacy).toBe("NotAllowedError")
+ },
+ // Starting Electron takes seconds on a loaded runner; each held call waits 300 ms for its answer.
+ 60_000,
+)
diff --git a/packages/gui-plugins/src/browser/electron-page.fixture.ts b/packages/gui-plugins/src/browser/electron-page.fixture.ts
new file mode 100644
index 000000000000..141e15d55650
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-page.fixture.ts
@@ -0,0 +1,247 @@
+import { createServer } from "node:http"
+import electron from "electron"
+import type { BuiltinMainStorage } from "@opencode/plugin/gui/builtin"
+import type { Embeds } from "@opencode/plugin/gui/main"
+import type { TabActivity } from "./policy"
+import type { Profile } from "./profile"
+
+// The Electron main process of `electron-page.test.ts`, bundled and run by the pinned Electron. It opens one pane page
+// as the pane does, loads a page that navigates by itself while it boots, right-clicks it as the agent and as the
+// person, then registers a pane binding for one window and calls it as another. It prints what happened as one JSON
+// line.
+
+const frame = `frameframe
`
+
+// Everything a real site does while it boots: History API writes, a client redirect and a frame load.
+const boot = `boot`
+
+const landed = `landed
+
+`
+
+const server = createServer((request, response) => {
+ response.writeHead(200, { "content-type": "text/html" })
+ response.end(request.url?.startsWith("/boot") ? boot : request.url?.startsWith("/landed") ? landed : frame)
+})
+
+const counts = { popups: 0, menus: 0, inputs: 0 }
+
+// The product's guard decides whether a menu opens; this only keeps a native menu off the screen and counts it.
+electron.Menu.prototype.popup = () => {
+ counts.popups++
+}
+
+void electron.app.whenReady().then(async () => {
+ const { Schema } = await import("effect")
+ const { Browser } = await import("@opencode/plugin-browser/rpc")
+ const { createBrowserPage } = await import("./chromium")
+ const { createBrowserPane } = await import("./pane")
+ const { RefsStore } = await import("./refs")
+ const { activityOwner } = await import("./policy")
+ const { createSitePermissions } = await import("./site-permissions")
+ const { createSystemMedia } = await import("./system-media")
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve))
+ const address = server.address()
+ const origin = `http://127.0.0.1:${address instanceof Object ? address.port : 0}`
+ const win = new electron.BrowserWindow({ show: false, width: 800, height: 600 })
+ const values = new Map()
+
+ // SAFETY: the site permissions, the saved tabs and the reserved refs read only `store` and its `value` and `set`.
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
+ const storage = {
+ store: (key: string, options: { initial: unknown }) => ({
+ get value() {
+ return values.has(key) ? values.get(key) : options.initial
+ },
+ // oxlint-disable-next-line anti-slop/no-unknown-parameters -- see SAFETY above
+ set: (next: unknown) => values.set(key, next),
+ }),
+ } as unknown as BuiltinMainStorage
+
+ // The window host owns bounds and occlusion; here the view fills the window and shows when the page says so.
+ const embeds: Embeds = {
+ create(view, window) {
+ window.contentView.addChildView(view)
+ view.setBounds({ x: 0, y: 0, width: 800, height: 600 })
+
+ return {
+ id: "embed",
+ show: (visible) => view.setVisible(visible),
+ on: () => () => undefined,
+ capture: async () => undefined,
+ dispose: () => window.contentView.removeChildView(view),
+ }
+ },
+ }
+
+ const tabID = Browser.TabID.make("tab_11111111-1111-1111-1111-111111111111")
+ const activity: TabActivity = { agentRuns: 0 }
+ const signal = new AbortController().signal
+ const refs = { next: 0 }
+ const sites = createSitePermissions(storage, () => undefined)
+ const system = createSystemMedia()
+
+ const page = createBrowserPage(win, {
+ id: tabID,
+ partition: "page-fixture",
+ network: null,
+ publish: () => undefined,
+ refused: () => undefined,
+ fail: () => undefined,
+ popup: () => {
+ throw new Error("The fixture page opens no window.")
+ },
+ activity,
+ userInput: () => {
+ counts.inputs++
+ },
+ local: true,
+ signal,
+ shared: { ref: () => `e${++refs.next}` },
+ menu: { t: (key) => key, extensions: () => [], navigate: async () => undefined, open: async () => undefined },
+ embeds,
+ sites,
+ system,
+ })
+
+ page.contents.on("context-menu", () => {
+ counts.menus++
+ })
+ await page.ready
+ // A plugin's tab opens with the person's authority, as `createTab` does. The redirect may abort this first load.
+ await page
+ .execute({ action: { type: "navigate", tabID, url: `${origin}/boot` }, files: [] }, signal, "user")
+ .catch(() => undefined)
+ await new Promise((resolve) => {
+ const settled = () => {
+ if (page.contents.getURL() !== `${origin}/landed?ready` || page.contents.isLoading()) return
+ page.contents.off("did-stop-loading", settled)
+ page.contents.off("did-navigate-in-page", settled)
+ resolve()
+ }
+
+ page.contents.on("did-stop-loading", settled)
+ page.contents.on("did-navigate-in-page", settled)
+ settled()
+ })
+ const report = () => ({ ...counts, owner: activityOwner(activity) })
+ const booted = report()
+
+ // The page's report of a right-click, which arrives after the click's own events. The product's listener was added
+ // first, so it has decided by then. Bounded, so a platform that raises no report fails the test's comparison.
+ const menu = () =>
+ Promise.race([
+ new Promise((resolve) => page.contents.once("context-menu", () => resolve())),
+ new Promise((resolve) => setTimeout(resolve, 10_000)),
+ ])
+
+ const rightClick = async () => {
+ const snapshot = await page.execute({ action: { type: "snapshot", tabID }, files: [], agent: "build" }, signal, "agent")
+ const content = Schema.decodeUnknownSync(Schema.Struct({ content: Schema.String }))(snapshot.value).content
+ const ref = /@(e\d+) \[button\] "Target"/.exec(content)?.[1]
+
+ if (!ref) throw new Error(`The snapshot names no Target button:\n${content}`)
+ const reported = menu()
+ await page.execute(
+ { action: { type: "click", tabID, ref: Browser.Ref.make(ref), button: "right" }, files: [], agent: "build" },
+ signal,
+ "agent",
+ )
+ await reported
+
+ return report()
+ }
+
+ const personClick = async () => {
+ const reported = menu()
+ page.contents.sendInputEvent({ type: "mouseDown", x: 100, y: 100, button: "right", clickCount: 1 })
+ page.contents.sendInputEvent({ type: "mouseUp", x: 100, y: 100, button: "right", clickCount: 1 })
+ await reported
+
+ return report()
+ }
+
+ const agent = await rightClick()
+ const person = await personClick()
+ const after = await rightClick()
+ // The agent's `wait` sends the page nothing. The person takes the tab back first, so the wait starting shows as the
+ // tab becoming the agent's again; their right-click while it is still held is then their own.
+ await personClick()
+ const waited = { done: false }
+
+ const wait = page
+ .execute({ action: { type: "wait", tabID, condition: "delay", timeoutMs: 3_000 }, files: [], agent: "build" }, signal, "agent")
+ .finally(() => {
+ waited.done = true
+ })
+
+ const started = (): Promise =>
+ activityOwner(activity) === "agent" || waited.done ? Promise.resolve() : new Promise((resolve) => setImmediate(resolve)).then(started)
+
+ await started()
+ const waiting = { ...(await personClick()), during: !waited.done }
+ await wait
+ await page.dispose()
+
+ // The session's server never answers, so the binding stays registered to its window with no tab and no network.
+ const held = createServer(() => undefined)
+ await new Promise((resolve) => held.listen(0, "127.0.0.1", resolve))
+ const heldAddress = held.address()
+
+ // SAFETY: a binding of the app's own server that never attaches reads only the profile's partition, previews,
+ // downloads and extension IDs.
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- see SAFETY above
+ const profile = {
+ partition: "page-fixture",
+ previews: { failure: () => undefined },
+ extensionIDs: () => [],
+ downloads: new Map(),
+ permissions: new Map(),
+ } as unknown as Profile
+
+ const pane = createBrowserPane({
+ windows: { get: (id) => (id === win.id ? win : undefined), list: () => [win], focused: () => win, on: () => () => undefined },
+ t: (key) => key,
+ serverEndpoints: {
+ get: () => ({ id: "fixture", url: `http://127.0.0.1:${heldAddress instanceof Object ? heldAddress.port : 0}`, headers: {}, sameMachine: true }),
+ },
+ storage,
+ refs: storage.store("refs", RefsStore),
+ embeds,
+ profile,
+ sites,
+ system,
+ emit: () => undefined,
+ })
+
+ void pane.register(win.id, "binding", { server: "fixture", session: "ses_fixture" }).catch(() => undefined)
+
+ const outcome = (call: () => Promise | void) =>
+ Promise.resolve()
+ .then(call)
+ .then(
+ (value) => `returned ${JSON.stringify(value)}`,
+ (error: Error) => error.message,
+ )
+
+ const calls = (window: number) =>
+ Promise.all([
+ outcome(() => pane.createTab(window, "binding", "plugin", "https://example.com/")),
+ outcome(() => pane.closeTab(window, "binding", "plugin", "handle")),
+ outcome(() => pane.command(window, "binding", { type: "tabs.open" })),
+ outcome(() => pane.openPage(window, "binding", tabID, "https://example.com/")),
+ outcome(() => pane.load(window, "binding", tabID)),
+ ])
+
+ const windows = { owner: await calls(win.id), other: await calls(win.id + 1) }
+ process.stdout.write(`${JSON.stringify({ booted, agent, person, after, waiting, windows })}\n`)
+ await pane.dispose()
+ held.closeAllConnections()
+ held.close()
+ server.close()
+ electron.app.quit()
+})
diff --git a/packages/gui-plugins/src/browser/electron-page.test.ts b/packages/gui-plugins/src/browser/electron-page.test.ts
new file mode 100644
index 000000000000..c2113357d6f9
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-page.test.ts
@@ -0,0 +1,32 @@
+import { expect, test } from "bun:test"
+import path from "node:path"
+import { runElectronFixture } from "./electron-run"
+
+// Who a page's activity belongs to rests on Chromium's own input events (`createBrowserPage` in chromium.ts). This runs
+// one pane page in the pinned Electron, so an upgrade that changes which events a page or the agent raises fails here.
+test(
+ "page navigations are not the person's input, an agent's right-click opens no native menu, the person's click during an agent wait is theirs, and another window's calls are refused",
+ async () => {
+ const result = JSON.parse(await runElectronFixture({ fixture: path.join(import.meta.dir, "electron-page.fixture.ts") }))
+
+ // History API writes, a client redirect and a frame load while the page boots are nobody's input, so a plugin's
+ // right to close the tab it opened survives them.
+ expect(result.booted).toEqual({ popups: 0, menus: 0, inputs: 0, owner: "user" })
+ // The page saw the agent's right-click, the tab became the agent's, and no native menu opened.
+ expect(result.agent).toEqual({ popups: 0, menus: 1, inputs: 0, owner: "agent" })
+ // The person's own right-click opens the menu and takes the tab back.
+ expect(result.person).toEqual({ popups: 1, menus: 2, inputs: 1, owner: "user" })
+ // With the menu armed by the person, the agent's next right-click still opens none.
+ expect(result.after).toEqual({ popups: 1, menus: 3, inputs: 1, owner: "agent" })
+ // The agent's `wait` holds a command on the tab but sends the page nothing: the person's right-click during it
+ // is their input, opens their menu and takes the tab back. Two of the person's clicks came since `after`.
+ expect(result.waiting).toEqual({ popups: 3, menus: 5, inputs: 3, owner: "user", during: true })
+ // createTab, closeTab, command, openPage and load: the window that registered the binding gets each call's own
+ // answer, and any other window is refused before the call does anything.
+ const unready = "Browser network is not ready; no tab was opened."
+ expect(result.windows.owner).toEqual([unready, "returned false", unready, "browser.pane.unavailable", "returned undefined"])
+ expect(result.windows.other).toEqual(Array(5).fill("browser.pane.unavailable"))
+ },
+ // Starting Electron takes seconds on a loaded runner.
+ 60_000,
+)
diff --git a/packages/gui-plugins/src/browser/electron-run.ts b/packages/gui-plugins/src/browser/electron-run.ts
new file mode 100644
index 000000000000..0c437068d209
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-run.ts
@@ -0,0 +1,166 @@
+import { mkdir, mkdtemp, readdir, readFile, rm, stat, writeFile } from "node:fs/promises"
+import { createRequire } from "node:module"
+import { tmpdir } from "node:os"
+import path from "node:path"
+import type { CustomScheme } from "electron"
+
+// Runs an Electron main-process fixture of a real-Electron test (`*.fixture.ts`) in the pinned Electron, for every such
+// test in this package. The binary is installed on first use, by whichever process asks first: other suites that run
+// alongside (desktop's) may be extracting it while a test here starts, which Linux reports as ETXTBSY at spawn.
+
+// Electron's main script. It is plain CommonJS that cannot fail to load, so it holds every failure of the fixture's
+// bundle, including one that does not parse: each ends the process with its reason in the log, and Electron never
+// opens its error box on the desktop.
+const loader = `"use strict"
+const { appendFileSync } = require("node:fs")
+const { app, dialog, protocol } = require("electron")
+const fail = (reason) => {
+ try {
+ appendFileSync(process.env.ELECTRON_FIXTURE_LOG, String((reason && reason.stack) || reason) + "\\n")
+ } catch {}
+ app.exit(1)
+}
+dialog.showErrorBox = () => {}
+process.on("uncaughtException", fail)
+process.on("unhandledRejection", fail)
+try {
+ // Scheme privileges exist only when granted before the app is ready, which a fixture loaded here may miss.
+ if (process.env.ELECTRON_FIXTURE_SCHEMES) protocol.registerSchemesAsPrivileged(JSON.parse(process.env.ELECTRON_FIXTURE_SCHEMES))
+ import("file:///" + process.env.ELECTRON_FIXTURE_ENTRY.replace(/\\\\/g, "/").replace(/^\\//, "")).catch(fail)
+} catch (error) {
+ fail(error)
+}
+`
+
+/** The fixture's one JSON line; otherwise a failure with its exit code, its log and its stderr. */
+export async function runElectronFixture(input: {
+ /** Absolute path to the fixture's source. */
+ readonly fixture: string
+ readonly env?: Readonly>
+ /** Schemes the product registers as privileged before the app is ready (`src/schemes.ts`). */
+ readonly schemes?: readonly CustomScheme[]
+}) {
+ const out = await mkdtemp(path.join(tmpdir(), `${path.basename(input.fixture, ".fixture.ts")}-`))
+
+ try {
+ const log = path.join(out, "fixture.log")
+ await writeFile(path.join(out, "loader.cjs"), loader)
+
+ // ES modules in chunks: dependencies of the pane use `import.meta`.
+ const built = await Bun.build({
+ entrypoints: [input.fixture],
+ outdir: out,
+ target: "node",
+ format: "esm",
+ splitting: true,
+ naming: { entry: "fixture.mjs", chunk: "[name]-[hash].mjs" },
+ external: ["electron"],
+ })
+
+ if (!built.success) throw new AggregateError(built.logs, "The Electron fixture did not build.")
+
+ const binary = await electronBinary()
+
+ const launch = async (attempt: number): Promise => {
+ await settled()
+
+ const child = await spawn(
+ [
+ binary,
+ `--user-data-dir=${path.join(out, `profile-${attempt}`)}`,
+ // CI's Linux runners have no display, and node_modules' chrome-sandbox is not set up as root.
+ ...(process.platform === "linux" ? ["--ozone-platform=headless", "--no-sandbox", "--disable-gpu"] : []),
+ path.join(out, "loader.cjs"),
+ ],
+ {
+ ...process.env,
+ ...input.env,
+ ELECTRON_RUN_AS_NODE: undefined,
+ ELECTRON_ENABLE_LOGGING: undefined,
+ ELECTRON_FIXTURE_LOG: log,
+ ELECTRON_FIXTURE_ENTRY: path.join(out, "fixture.mjs"),
+ ELECTRON_FIXTURE_SCHEMES: input.schemes ? JSON.stringify(input.schemes) : undefined,
+ },
+ )
+
+ const [stdout, stderr, code] = await Promise.all([new Response(child.stdout).text(), new Response(child.stderr).text(), child.exited])
+ const line = stdout.split("\n").find((text) => text.startsWith("{"))
+
+ if (line) return line
+ const failure = await readFile(log, "utf8").catch(() => "")
+
+ // Killed by a signal before the loader ran, as Chromium is when another suite's install rewrites its files under
+ // it. Launch once more once the files have settled; a fixture's own failure is logged and never retried.
+ if (attempt === 0 && !failure && code > 128) return launch(1)
+
+ throw new Error(`Electron printed no result (exit ${code}).\n${failure}\n${stderr}`)
+ }
+
+ return await launch(0)
+ } finally {
+ await rm(out, { recursive: true, force: true })
+ }
+}
+
+/**
+ * The pinned Electron's executable. Electron's package downloads and extracts it on first import, so one process at a
+ * time imports it, behind a lock directory next to the package. A lock left by a crashed run expires.
+ */
+async function electronBinary() {
+ const lock = path.join(path.dirname(createRequire(import.meta.url).resolve("electron/package.json")), ".opencode-install.lock")
+ const deadline = Date.now() + 180_000
+
+ while (!(await mkdir(lock).then(() => true, () => false))) {
+ const age = await stat(lock).then((info) => Date.now() - info.mtimeMs, () => 0)
+
+ if (age > 600_000) await rm(lock, { recursive: true, force: true })
+
+ if (Date.now() > deadline) throw new Error(`Another process held ${lock} for 3 minutes.`)
+ await Bun.sleep(200)
+ }
+
+ try {
+ const { default: binary } = await import("electron")
+
+ return String(binary)
+ } finally {
+ await rm(lock, { recursive: true, force: true })
+ }
+}
+
+/**
+ * Waits until no file of the Electron distribution changed for 2 seconds: another suite may still be extracting it
+ * after this one found the executable in place.
+ */
+async function settled() {
+ const directory = path.join(path.dirname(createRequire(import.meta.url).resolve("electron/package.json")), "dist")
+ const deadline = Date.now() + 60_000
+
+ for (;;) {
+ const entries = await readdir(directory, { recursive: true, withFileTypes: true })
+
+ const times = await Promise.all(
+ entries.filter((entry) => entry.isFile()).map((entry) => stat(path.join(entry.parentPath, entry.name)).then((info) => info.mtimeMs, () => Date.now())),
+ )
+
+ const quiet = Date.now() - Math.max(0, ...times)
+
+ if (quiet >= 2_000 || Date.now() > deadline) return
+ await Bun.sleep(2_000 - quiet)
+ }
+}
+
+/** Another suite's install may hold the binary open for writing for a moment after this one found it in place. */
+async function spawn(command: string[], env: Readonly>) {
+ const deadline = Date.now() + 10_000
+
+ for (let wait = 50; ; wait = Math.min(wait * 2, 1_000)) {
+ try {
+ // Ended before the test's own 60 s timeout, so no Electron outlives its test.
+ return Bun.spawn(command, { env, stdout: "pipe", stderr: "pipe", timeout: 55_000 })
+ } catch (error) {
+ if (!(error instanceof Error && error.message.includes("ETXTBSY")) || Date.now() + wait > deadline) throw error
+ await Bun.sleep(wait)
+ }
+ }
+}
diff --git a/packages/gui-plugins/src/browser/electron-webauthn.fixture.ts b/packages/gui-plugins/src/browser/electron-webauthn.fixture.ts
new file mode 100644
index 000000000000..f3bcfc44214a
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-webauthn.fixture.ts
@@ -0,0 +1,229 @@
+import { createServer } from "node:http"
+import electron from "electron"
+import { createCdp } from "./cdp"
+import { guardWebAuthn } from "./webauthn-gate"
+
+// The Electron main process of `electron-webauthn.test.ts`, bundled and run by the pinned Electron. It prints one JSON
+// line. Pages on localhost, a valid relying party, ask for passkeys in tabs whose refusal is enforced in the browser
+// process (CDP's virtual authenticator environment, with no authenticator unless a step adds one), so no request can
+// reach the system's WebAuthn API and no system dialog can open.
+//
+// Every request runs only after a harmless check proved the environment covers the page: where this machine has a
+// platform authenticator, Chromium reports one in a page without the environment and none in a page with it, and a
+// virtual authenticator receives the credential a request creates. If a check fails, the run stops before any further
+// request and says why.
+
+electron.app.commandLine.appendSwitch("host-resolver-rules", "MAP localhost 127.0.0.1")
+
+/** What a page answers `executeJavaScript` with here: JSON values. */
+type Json = string | number | boolean | null | undefined | Json[] | { [key: string]: Json }
+
+// `?frame=` embeds that address, which on another site runs in a renderer process of its own.
+const server = createServer((request, response) => {
+ const frame = new URL(request.url ?? "/", "http://localhost").searchParams.get("frame")
+ response.writeHead(200, { "content-type": "text/html" })
+ response.end(`passkeys${frame ? `` : ""}`)
+})
+
+const get = (extra = "") =>
+ `{ challenge: crypto.getRandomValues(new Uint8Array(32)), rpId: "localhost", timeout: 1000, userVerification: "discouraged"${extra} }`
+
+const create = `{ challenge: crypto.getRandomValues(new Uint8Array(32)), rp: { id: "localhost", name: "Test" }, user: { id: crypto.getRandomValues(new Uint8Array(16)), name: "a", displayName: "A" }, pubKeyCredParams: [{ type: "public-key", alg: -7 }], authenticatorSelection: { residentKey: "required", userVerification: "discouraged" }, timeout: 1000 }`
+
+const authenticator = { protocol: "ctap2", transport: "internal", hasResidentKey: true, hasUserVerification: true, isUserVerified: true, automaticPresenceSimulation: true } as const
+
+const outcome = (call: string) => `Promise.resolve().then(() => ${call}).then((value) => value === null ? "null" : "credential", (error) => error.name)`
+
+const uvpaa = "PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()"
+
+void electron.app.whenReady().then(async () => {
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve))
+ const address = server.address()
+ const origin = `http://localhost:${address instanceof Object ? address.port : 0}`
+ const win = new electron.BrowserWindow({ show: false })
+ const result: { [key: string]: Json } = {}
+
+ const print = (stopped?: string) => {
+ process.stdout.write(`${JSON.stringify({ ...result, stopped })}\n`)
+ server.close()
+ electron.app.quit()
+ }
+
+ // A tab as the pane makes one: the environment, if any, is turned on before the first document loads.
+ const tab = async (name: string, input: { native: boolean; wrapper: boolean; enforce: boolean; path?: string }) => {
+ const view = new electron.WebContentsView({ webPreferences: { sandbox: true, contextIsolation: true, partition: `webauthn-${name}` } })
+ win.contentView.addChildView(view)
+ const contents = view.webContents
+ const cdp = createCdp(contents)
+ const refusals = { count: 0 }
+ const gate = guardWebAuthn(cdp, { native: input.native, refused: () => refusals.count++ })
+
+ // As the pane does: everything is sent before the first document, which the renderer answers once it exists.
+ const ready = Promise.all([
+ input.enforce ? gate.enforce() : undefined,
+ cdp.send("Runtime.enable"),
+ cdp.send("Page.enable"),
+ input.wrapper ? gate.attach() : undefined,
+ ])
+
+ await contents.loadURL(`${origin}${input.path ?? "/"}`)
+ await ready
+ const run = (code: string): Promise => contents.executeJavaScript(code)
+
+ return { contents, cdp, gate, refusals, run }
+ }
+
+ // Whether the page answers from the environment: it reports no platform authenticator, then the virtual one a step
+ // adds, then none again. A page outside it reports the system's answer each time.
+ const covered = async (item: Awaited>) => {
+ const before = await item.run(uvpaa)
+ const { authenticatorId } = await item.cdp.send("WebAuthn.addVirtualAuthenticator", { options: authenticator })
+ const during = await item.run(uvpaa)
+ await item.cdp.send("WebAuthn.removeVirtualAuthenticator", { authenticatorId })
+ const after = await item.run(uvpaa)
+
+ return before === false && during === true && after === false
+ }
+
+ const plain = await tab("plain", { native: true, wrapper: false, enforce: false })
+ result.plainUVPAA = await plain.run(uvpaa)
+
+ // 1. The browser process alone: no wrapper, only the environment.
+ const bare = await tab("bare", { native: true, wrapper: false, enforce: true })
+ result.bareCovered = await covered(bare)
+
+ if (!result.bareCovered) return print("the environment does not cover the page")
+ const { authenticatorId } = await bare.cdp.send("WebAuthn.addVirtualAuthenticator", { options: authenticator })
+ result.routedCreate = await bare.run(outcome(`navigator.credentials.create({ publicKey: ${create} })`))
+ result.routedCredentials = (await bare.cdp.send("WebAuthn.getCredentials", { authenticatorId })).credentials.length
+
+ if (result.routedCredentials !== 1) return print("a request did not reach the virtual environment")
+ await bare.cdp.send("WebAuthn.removeVirtualAuthenticator", { authenticatorId })
+ // With no authenticator, a request that got around every page-side check ends at its own timeout.
+ result.bareGet = await bare.run(outcome(`navigator.credentials.get({ publicKey: ${get()} })`))
+
+ // 2. A Windows tab the agent drives: the wrapper asks the pane, which refuses, over the environment.
+ const agent = await tab("agent", { native: true, wrapper: true, enforce: true })
+ result.agentCovered = await covered(agent)
+
+ if (!result.agentCovered) return print("the environment does not cover the agent's tab")
+ // A function object as the options, which the first wrapper sent on unchecked.
+ result.functionOptions = await agent.run(outcome(`navigator.credentials.get(Object.assign(() => {}, { publicKey: ${get()} }))`))
+ // A `publicKey` getter that answers the wrapper's read with nothing and a later read with the request.
+ result.twoFacedGetter = await agent.run(
+ outcome(`(() => { let reads = 0; const publicKey = ${get()}; return navigator.credentials.get({ get publicKey() { return reads++ ? publicKey : undefined } }) })()`),
+ )
+ // Inherited options, which a copy of own properties would miss.
+ result.inheritedOptions = await agent.run(outcome(`navigator.credentials.get(Object.create({ publicKey: ${get()} }))`))
+ // Nothing of the gate is on the page: no globals beyond what a page without it has, and native-looking functions.
+ const names = (run: (code: string) => Promise) => run("Object.getOwnPropertyNames(globalThis)")
+ const [withGate, without] = await Promise.all([names(agent.run), names(plain.run)])
+ result.addedGlobals = Array.isArray(withGate) && Array.isArray(without) ? withGate.filter((name) => !without.includes(name)) : "unreadable"
+ result.nativeLooking = await agent.run(
+ `[navigator.credentials.get, navigator.credentials.create, PublicKeyCredential.isConditionalMediationAvailable].map((fn) => Function.prototype.toString.call(fn).includes("[native code]"))`,
+ )
+
+ // A new frame's realm, read before any script of the page's could have wrapped it.
+ result.frameRealm = await agent.run(
+ outcome(`(() => { const frame = document.createElement("iframe"); document.body.append(frame); return frame.contentWindow.navigator.credentials.get({ publicKey: ${get()} }) })()`),
+ )
+ result.agentRefusals = agent.refusals.count
+ // 3. A pop-up the agent's tab opens and scripts at once: enforced while Electron creates it.
+ agent.contents.setWindowOpenHandler(() => ({
+ action: "allow",
+ createWindow: (options) => {
+ const view = new electron.WebContentsView({ ...options })
+ win.contentView.addChildView(view)
+ void guardWebAuthn(createCdp(view.webContents), { native: true, refused: () => undefined }).enforce()
+
+ return view.webContents
+ },
+ }))
+ result.popupUVPAA = await agent.run(`window.open("about:blank", "_blank", "popup").PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()`)
+
+ // 4. macOS and Linux: the wrapper refuses on its own, over the environment.
+ const mac = await tab("mac", { native: false, wrapper: true, enforce: true })
+
+ result.capabilities = await mac.run(`Promise.all([
+ PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable(),
+ PublicKeyCredential.isConditionalMediationAvailable(),
+ PublicKeyCredential.getClientCapabilities?.(),
+ ])`)
+
+ // The request's own timeout is far past the test's, so only a refusal that comes at once lets the test finish.
+ result.macGet = await mac.run(outcome(`navigator.credentials.get({ publicKey: { ...${get()}, timeout: 600000 } })`))
+ result.macCreate = await mac.run(outcome(`navigator.credentials.create({ publicKey: { ...${create}, timeout: 600000 } })`))
+ result.afterExplicit = mac.refusals.count
+
+ // Autofill waits, without a refusal, for a passkey the person never picks; a refused request that came after it
+ // returns first, and only the page's abort ends it.
+ result.conditional = await mac.run(`(async () => {
+ const controller = new AbortController()
+ let settled = "pending"
+ navigator.credentials.get({ publicKey: ${get()}, mediation: "conditional", signal: controller.signal }).then(() => (settled = "resolved"), (error) => (settled = error.name))
+ await navigator.credentials.get({ publicKey: ${get()} }).catch(() => undefined)
+ const before = settled
+ controller.abort()
+ await Promise.resolve()
+ return { before, after: settled }
+ })()`)
+
+ result.immediate = await mac.run(outcome(`navigator.credentials.get({ publicKey: ${get()}, mediation: "immediate" })`))
+ result.preAborted = await mac.run(outcome(`navigator.credentials.get({ publicKey: ${get()}, signal: AbortSignal.abort() })`))
+ result.afterConditional = mac.refusals.count
+
+ // A password manager that wraps the API after the gate, as extensions do, answers its own passkeys; what it hands
+ // back goes to the gate.
+ result.manager = await mac.run(`(() => {
+ const previous = navigator.credentials.get.bind(navigator.credentials)
+ navigator.credentials.get = (request) => request && request.publicKey && window.vault ? Promise.resolve("from-manager") : previous(request)
+ window.vault = true
+ return navigator.credentials.get({ publicKey: ${get()} }).then((value) => {
+ window.vault = false
+ return navigator.credentials.get({ publicKey: ${get()} }).then(() => [value, "resolved"], (error) => [value, error.name])
+ })
+ })()`)
+
+ result.refusals = mac.refusals.count
+
+ // 5. Out-of-process frames: the environment covers another site's frame, after the page goes to another site, and
+ // after its renderer crashed and the page loaded again. Only the platform-authenticator check runs here.
+ const other = `http://127.0.0.1:${address instanceof Object ? address.port : 0}`
+ const frames = await tab("frames", { native: true, wrapper: false, enforce: true, path: `/?frame=${other}/` })
+
+ const frameCovered = async () => {
+ const frame = frames.contents.mainFrame.frames[0]
+
+ if (!frame) return "no frame"
+ const separate = frame.osProcessId !== frames.contents.mainFrame.osProcessId
+ // A frame answers `unknown`; this one answers a boolean, or the check failed.
+ const ask = () => frame.executeJavaScript(uvpaa).then((value): Json => (value === true || value === false ? value : "unreadable"))
+ const before = await ask()
+ const { authenticatorId } = await frames.cdp.send("WebAuthn.addVirtualAuthenticator", { options: authenticator })
+ const during = await ask()
+ await frames.cdp.send("WebAuthn.removeVirtualAuthenticator", { authenticatorId })
+ const after = await ask()
+
+ return [separate, before, during, after]
+ }
+
+ const loaded = () => new Promise((resolve) => frames.contents.once("did-finish-load", () => resolve()))
+ const gone = () => new Promise((resolve) => frames.contents.once("render-process-gone", () => resolve()))
+
+ result.frameOutOfProcess = await frameCovered()
+ await frames.contents.loadURL(`${other}/?frame=${origin}/`)
+ result.frameAfterNavigation = await frameCovered()
+ const crashed = gone()
+ frames.contents.forcefullyCrashRenderer()
+ await crashed
+ const reloaded = loaded()
+ frames.contents.reload()
+ await reloaded
+ result.frameAfterCrash = await frameCovered()
+ result.pageAfterCrash = await frames.run(uvpaa)
+ ;[plain, bare, agent, mac, frames].forEach((item) => item.gate.dispose())
+ print()
+}).catch((error: Error) => {
+ process.stdout.write(`${JSON.stringify({ stopped: String(error) })}\n`)
+ electron.app.quit()
+})
diff --git a/packages/gui-plugins/src/browser/electron-webauthn.test.ts b/packages/gui-plugins/src/browser/electron-webauthn.test.ts
new file mode 100644
index 000000000000..4fde2e5971ec
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-webauthn.test.ts
@@ -0,0 +1,63 @@
+import { expect, test } from "bun:test"
+import path from "node:path"
+import { runElectronFixture } from "./electron-run"
+import { PASSKEY_REFUSAL } from "./webauthn-gate"
+
+// Electron draws no WebAuthn request UI, and on Windows Chromium hands requests to the system's dialog. This runs the
+// WebAuthn gate (webauthn-gate.ts) in the pinned Electron. Where the pane refuses, the browser process refuses too: the
+// tab answers from CDP's empty virtual authenticator environment, which a virtual authenticator proves by receiving
+// the one credential a step creates, so a request that gets around the page-side wrapper never reaches the system.
+// The wrapper refuses explicit requests at once, also against options built to slip past it, leaves no trace on the
+// page, keeps autofill waiting silently, and lets a password manager's own wrapper answer first. The fixture checks
+// that the environment covers each page before any request there, and stops otherwise.
+test(
+ "the pinned Electron refuses a page's passkey requests in the browser process and at once on the page",
+ async () => {
+ const result = JSON.parse(await runElectronFixture({ fixture: path.join(import.meta.dir, "electron-webauthn.fixture.ts") }))
+
+ expect(result.stopped).toBeUndefined()
+ // The browser process: a request reaches only the virtual environment, and fails there without an authenticator.
+ expect(result).toMatchObject({ bareCovered: true, routedCreate: "credential", routedCredentials: 1, bareGet: "NotAllowedError" })
+ // A Windows tab the agent drives: every shape of request is refused, by the wrapper or by the environment.
+ expect(result.agentCovered).toBe(true)
+ expect(result.functionOptions).toBe("NotAllowedError")
+ expect(result.inheritedOptions).toBe("NotAllowedError")
+ // The getter's first answer is the one Chromium gets: a request without `publicKey`, so no passkey is asked for.
+ expect(result.twoFacedGetter).not.toBe("credential")
+ expect(result.frameRealm).toBe("NotAllowedError")
+ expect(result.addedGlobals).toEqual([])
+ expect(result.nativeLooking).toEqual([true, true, true])
+ // A pop-up enforced while Electron creates it is covered before its opener's script runs again.
+ expect(result.popupUVPAA).toBe(false)
+ // macOS and Linux: pages hear that no passkey path is available, and explicit requests fail at once.
+ expect(result.capabilities.slice(0, 2)).toEqual([false, false])
+ expect(result.capabilities[2]).toMatchObject({
+ conditionalGet: false,
+ conditionalCreate: false,
+ immediateGet: false,
+ hybridTransport: false,
+ passkeyPlatformAuthenticator: false,
+ userVerifyingPlatformAuthenticator: false,
+ })
+ expect([result.macGet, result.macCreate]).toEqual(["NotAllowedError", "NotAllowedError"])
+ expect(result.afterExplicit).toBe(2)
+ // Autofill, immediate and aborted requests end without a refusal, so the pane shows no notice for them.
+ expect(result.conditional).toEqual({ before: "pending", after: "AbortError" })
+ expect(result.immediate).toBe("NotAllowedError")
+ expect(result.preAborted).toBe("AbortError")
+ // The conditional case's own explicit request is the one refusal it adds.
+ expect(result.afterConditional).toBe(3)
+ // The password manager answered its own passkey; the request it handed on was refused.
+ expect(result.manager).toEqual(["from-manager", "NotAllowedError"])
+ expect(result.refusals).toBe(4)
+ // Another site's frame, in a process of its own, answers from the environment: no platform authenticator, then
+ // the virtual one, then none; so after the page went to another site, and after its renderer crashed.
+ expect(result.frameOutOfProcess).toEqual([true, false, true, false])
+ expect(result.frameAfterNavigation).toEqual([true, false, true, false])
+ expect(result.frameAfterCrash).toEqual([true, false, true, false])
+ expect(result.pageAfterCrash).toBe(false)
+ expect(PASSKEY_REFUSAL).toContain("not supported in this browser")
+ },
+ // Starting Electron takes seconds on a loaded runner, and the environment's refusals wait for their 1 s timeouts.
+ 60_000,
+)
diff --git a/packages/gui-plugins/src/browser/electron-workers.fixture.ts b/packages/gui-plugins/src/browser/electron-workers.fixture.ts
new file mode 100644
index 000000000000..7d87b17f09a0
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-workers.fixture.ts
@@ -0,0 +1,54 @@
+import { createServer } from "node:http"
+import electron from "electron"
+import { createCdp } from "./cdp"
+import { attachChildren, releaseWorker } from "./child-targets"
+
+// The Electron main process of `electron-workers.test.ts`, bundled and run by the pinned Electron. It guards a page's
+// child targets as a pane tab does and prints, as one JSON line, which of the page's workers started.
+
+const scripts = [
+ ["/worker.js", `postMessage("worker")`],
+ ["/outer.js", `const inner = new Worker("/inner.js"); inner.onmessage = (event) => postMessage(event.data)`],
+ ["/inner.js", `postMessage("nested")`],
+] as const
+
+const page = `workers`
+
+const server = createServer((request, response) => {
+ const script = scripts.find(([path]) => path === request.url)?.[1]
+ response.writeHead(200, {
+ "content-type": script ? "text/javascript" : "text/html",
+ "x-content-type-options": "nosniff",
+ })
+ response.end(script ?? page)
+})
+
+void electron.app.whenReady().then(async () => {
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve))
+ const address = server.address()
+ const win = new electron.BrowserWindow({ show: false })
+ const view = new electron.WebContentsView({ webPreferences: { sandbox: true, contextIsolation: true } })
+ win.contentView.addChildView(view)
+ const contents = view.webContents
+ const cdp = createCdp(contents)
+
+ cdp.on("Target.attachedToTarget", ({ sessionId, targetInfo }) => {
+ if (targetInfo.type === "worker") void releaseWorker(cdp, sessionId)
+ })
+ await attachChildren(cdp)
+ await contents.loadURL(`http://127.0.0.1:${address instanceof Object ? address.port : 0}/`)
+
+ const deadline = Date.now() + 10_000
+
+ while (contents.getTitle() !== "nested,worker" && Date.now() < deadline)
+ await new Promise((resolve) => setTimeout(resolve, 50))
+
+ console.log(JSON.stringify({ started: contents.getTitle() }))
+ server.close()
+ electron.app.exit(0)
+})
diff --git a/packages/gui-plugins/src/browser/electron-workers.test.ts b/packages/gui-plugins/src/browser/electron-workers.test.ts
new file mode 100644
index 000000000000..1312fb3a3f6a
--- /dev/null
+++ b/packages/gui-plugins/src/browser/electron-workers.test.ts
@@ -0,0 +1,15 @@
+import { expect, test } from "bun:test"
+import path from "node:path"
+import { runElectronFixture } from "./electron-run"
+
+// A tab pauses its page's children at start to guard them (`attachChildren` in child-targets.ts). Chromium pauses the
+// page's workers too, so this runs the policy in the pinned Electron: a worker the tab does not release never starts.
+test.each([
+ { fixture: "electron-workers", expected: { started: "nested,worker" } },
+ { fixture: "profile/filter-startup", expected: { worker: true, emptyRules: true } },
+])("the pinned Electron honors $fixture", async ({ fixture, expected }) => {
+ const line = await runElectronFixture({ fixture: path.join(import.meta.dir, `${fixture}.fixture.ts`) })
+
+ expect(JSON.parse(line)).toEqual(expected)
+}, // Starting Electron takes seconds on a loaded runner.
+60_000)
diff --git a/packages/gui-plugins/src/browser/errors.test.ts b/packages/gui-plugins/src/browser/errors.test.ts
index 13ea69d67511..03a50b8c72ba 100644
--- a/packages/gui-plugins/src/browser/errors.test.ts
+++ b/packages/gui-plugins/src/browser/errors.test.ts
@@ -1,9 +1,28 @@
import { expect, test } from "bun:test"
import { Browser } from "@opencode/plugin-browser/rpc"
-import { browserFailure, protocolError } from "./errors"
+import { FileVerificationError } from "@opencode/util/file-verification"
+import { undrawableMessage } from "./capture"
+import { browserFailure, CodedError, missingArtifact, pageReports, protocolError } from "./errors"
+import { NavigationDeadlineError } from "./navigation-deadline"
const tabID = Browser.TabID.make(`tab_${crypto.randomUUID()}`)
+test("an unavailable artifact reports a preview failure, not a stale frame", () => {
+ const failure = browserFailure({ type: "snapshot", tabID }, missingArtifact())
+ expect(failure.code).toBe("preview_unavailable")
+ expect(failure.message).toContain("artifact is no longer available")
+ const verifier = browserFailure({ type: "snapshot", tabID }, new FileVerificationError())
+ expect(verifier.code).toBe("file_verification_unavailable")
+ expect(verifier.message).toContain("file verification could not be loaded")
+})
+
+test("native preview failures never export the private loader address", () => {
+ const failure = browserFailure({ type: "preview", path: "report.html" }, new Error("ERR_FAILED loading 'oc-preview://grant/C:/repo/report.html'"))
+ expect(failure.code).toBe("preview_unavailable")
+ expect(failure.message).not.toContain("grant")
+ expect(failure.message).not.toContain("C:/repo")
+})
+
test("navigation failures explain the server network and never recommend disabling TLS", () => {
const action: Browser.Action = { type: "navigate", tabID, url: "https://example.com" }
const refused = browserFailure(action, new Error("net::ERR_CONNECTION_REFUSED"))
@@ -16,6 +35,26 @@ test("navigation failures explain the server network and never recommend disabli
expect(aborted.message).toContain("browser.files.list({tabID})")
})
+test("the person's command does not fail for a load the tab reports itself, and the agent still gets the failure", () => {
+ // Electron rejects a load with Chromium's name and number.
+ const load = (code: string, errno: number) => Object.assign(new Error(`${code} (${errno}) loading 'https://example.com/'`), { code, errno })
+ const stopped = new CodedError("navigation_failed", "No page committed. The navigation was cancelled, failed, or became a download.")
+
+ expect(pageReports(load("ERR_NAME_NOT_RESOLVED", -105))).toBe(true)
+ expect(pageReports(load("ERR_ABORTED", -3))).toBe(true)
+ // Stop, or a link that became a download, commits no page; a slow page outlives the command's deadline.
+ expect(pageReports(stopped)).toBe(true)
+ expect(pageReports(new NavigationDeadlineError())).toBe(true)
+ // Anything else is a command that did not work, which the window says.
+ expect(pageReports(new Error("Browser network is not ready; no tab was opened."))).toBe(false)
+ expect(pageReports(new CodedError(Browser.FailureCode.previewUnavailable, "The preview could not be loaded"))).toBe(false)
+ expect(pageReports(Object.assign(new TypeError("Invalid URL"), { code: "ERR_INVALID_URL" }))).toBe(false)
+
+ const action: Browser.Action = { type: "navigate", tabID, url: "https://example.com" }
+ expect(browserFailure(action, stopped).code).toBe("navigation_failed")
+ expect(browserFailure(action, load("ERR_NAME_NOT_RESOLVED", -105)).code).toBe("navigation_failed")
+})
+
test("native protocol errors keep the cause and give a valid recovery operation", () => {
expect(protocolError("DOM.resolveNode", new Error("Could not find node with given id")).message).toContain(
"browser.snapshot({tabID})",
@@ -30,9 +69,31 @@ test("native protocol errors keep the cause and give a valid recovery operation"
expect(unsupported.message).toContain("does not support or allow")
expect(unsupported.message).toContain("do not retry unchanged")
expect(unsupported.cause).toBeInstanceOf(Error)
- const failure = browserFailure({ type: "screenshot", tabID }, new Error("UnknownVizError"))
- expect(failure.message).toContain("browser.tabs.focus({tabID})")
+ const failure = browserFailure({ type: "screenshot", tabID }, new Error("Capture failed: UnknownVizError"))
+ expect(failure.message).not.toContain("browser.tabs.focus")
+ expect(failure.message).toContain("browser.reload({tabID})")
expect(failure.message).toContain("report the capture failure")
+ const minimized = browserFailure({ type: "screenshot", tabID }, new Error(undrawableMessage("minimized")))
+ expect(minimized.message).not.toContain("stuck")
+})
+
+test("a changed document, a stale ref and an unmet wait reach the server as codes, not words", () => {
+ const evaluate: Browser.Action = { type: "evaluate", tabID, script: "1" }
+ const code = (cause: Error) => browserFailure(evaluate, cause).code
+
+ expect(code(protocolError("Runtime.evaluate", new Error("Cannot find context with specified id")))).toBe(
+ Browser.FailureCode.documentChanged,
+ )
+ expect(code(protocolError("DOM.resolveNode", new Error("Could not find node with given id")))).toBe(
+ Browser.FailureCode.staleRef,
+ )
+ expect(code(new CodedError(Browser.FailureCode.unmet, "Condition was not met within 10 ms."))).toBe(
+ Browser.FailureCode.unmet,
+ )
+ // The same words in any other error carry no code.
+ expect(code(new Error("The document changed before this operation ran. Condition was not met within 10 ms."))).toBe(
+ "operation_failed",
+ )
})
test("long page errors retain the operation context without classifying script text as a navigation error", () => {
diff --git a/packages/gui-plugins/src/browser/errors.ts b/packages/gui-plugins/src/browser/errors.ts
index 5169bc701852..d8b25e09d235 100644
--- a/packages/gui-plugins/src/browser/errors.ts
+++ b/packages/gui-plugins/src/browser/errors.ts
@@ -1,26 +1,83 @@
-import type { Browser } from "@opencode/plugin-browser/rpc"
+import { Browser } from "@opencode/plugin-browser/rpc"
+import { CAPTURE_DEADLINE_MS, FULL_PAGE_DEADLINE_MS } from "./capture"
+import { FileVerificationError } from "@opencode/util/file-verification"
+import { NavigationDeadlineError } from "./navigation-deadline"
-export function protocolError(method: string, error: unknown) {
- const detail = message(error)
+/** A failure the server acts on by its code, such as a wait whose condition never held. */
+export class CodedError extends Error {
+ constructor(
+ readonly code: (typeof Browser.FailureCode)[keyof typeof Browser.FailureCode] | "navigation_failed",
+ message: string,
+ options?: ErrorOptions,
+ ) {
+ super(message, options)
+ }
+}
+
+/**
+ * Whether the tab itself reports how a rejected load ended, so the person's command did not fail: Chromium's own load
+ * error, which the page area explains; a navigation that was stopped, replaced or became a download; or one still
+ * under way when the command's deadline passed. The agent's commands still get every one of these as a failure.
+ */
+export function pageReports(error: Error) {
+ if (error instanceof NavigationDeadlineError) return true
+
+ if (error instanceof CodedError) return error.code === "navigation_failed"
+
+ // Chromium's load errors carry its negative number beside the name; Node's own `ERR_` errors have no `errno`.
+ return "errno" in error && "code" in error && String(error.code).startsWith("ERR_")
+}
+
+export function missingArtifact() {
+ return new CodedError(Browser.FailureCode.previewUnavailable, "This artifact is no longer available on this session’s server.")
+}
+
+export function protocolError(method: string, cause: unknown) {
+ const detail = message(cause)
- const recovery =
+ const kind =
method === "DOM.setFileInputFiles" && /not.*file input/i.test(detail)
- ? "Target is not a file input. Call browser.snapshot({tabID}) and choose an input[type=file] ref for browser.files.upload, or use browser.files.drop for a drop area."
+ ? "file-input"
: method === "Runtime.callFunctionOn" && /not evaluate to a function/i.test(detail)
- ? "With ref, browser.evaluate needs a function that receives the element, for example (element) => element.textContent."
+ ? "function"
: /(?:node|object).*(?:not found|not exist)|(?:find|resolve).*(?:node|object)|detached/i.test(detail)
- ? "The element may have detached. Call browser.snapshot({tabID}) and use a fresh ref from that tab."
+ ? "detached"
: /context.*(?:destroyed|not found)|find.*context|session.*not found/i.test(detail)
- ? "The document or frame changed. Call browser.frames({tabID}) and browser.snapshot({tabID}); use current frame IDs and refs."
+ ? "changed"
: /wasn't found|method not found|not implemented|not allowed/i.test(detail)
- ? "This Chromium target does not support or allow the operation. Check desktop/plugin compatibility and report it; do not retry unchanged or disable browser security."
- : "Inspect browser.tabs.list({}) and the target tab before deciding to retry; a partially completed action is not automatically safe to repeat."
+ ? "unsupported"
+ : "other"
+
+ const recovery = {
+ "file-input":
+ "Target is not a file input. Call browser.snapshot({tabID}) and choose an input[type=file] ref for browser.files.upload, or use browser.files.drop for a drop area.",
+ function:
+ "With ref, browser.evaluate needs a function that receives the element, for example (element) => element.textContent.",
+ detached: "The element may have detached. Call browser.snapshot({tabID}) and use a fresh ref from that tab.",
+ changed:
+ "The document or frame changed. Call browser.frames({tabID}) and browser.snapshot({tabID}); use current frame IDs and refs.",
+ unsupported:
+ "This Chromium target does not support or allow the operation. Check desktop/plugin compatibility and report it; do not retry unchanged or disable browser security.",
+ other:
+ "Inspect browser.tabs.list({}) and the target tab before deciding to retry; a partially completed action is not automatically safe to repeat.",
+ }[kind]
+
+ const text = `${recovery} Chromium command ${method} failed: ${detail}`
- return new Error(`${recovery} Chromium command ${method} failed: ${detail}`, { cause: error })
+ if (kind === "detached") return new CodedError(Browser.FailureCode.staleRef, text, { cause })
+
+ if (kind === "changed") return new CodedError(Browser.FailureCode.documentChanged, text, { cause })
+
+ return new Error(text, { cause })
}
-export function browserFailure(action: Browser.Action, error: unknown): Extract {
- const detail = message(error, 1_700)
+export function browserFailure(action: Browser.Action, cause: unknown): Extract {
+ if (cause instanceof FileVerificationError) return { type: "failure", code: cause._tag, message: cause.message }
+ const detail = message(cause, 1_700)
+
+ // Native and CDP errors may quote more than one internal URL. Never relay the raw error as recovery detail.
+ if (/oc-preview:/i.test(detail))
+ return { type: "failure", code: Browser.FailureCode.previewUnavailable, message: `browser.${action.type} failed. The workspace file could not be loaded.` }
const navigation = ["tabs.open", "navigate", "back", "forward", "reload"].includes(action.type)
const network = navigation ? detail.match(/\bERR_[A-Z_]+\b/)?.[0] : undefined
@@ -36,12 +93,12 @@ export function browserFailure(action: Browser.Action, error: unknown): Extract<
: network
? "The site failed to load through the connected server. Check its URL/network and the OC2 connection before retrying; inspect the current tab first."
: action.type === "screenshot" && /UnknownVizError|capture.*(?:failed|unavailable)/i.test(detail)
- ? "Chromium could not capture a rendered frame. Call browser.tabs.focus({tabID}) and keep the desktop window visible. If it is already visible, report the capture failure instead of repeating it unchanged."
+ ? `Chromium could not provide a rendered frame (capture deadline ${(action.fullPage ? FULL_PAGE_DEADLINE_MS : CAPTURE_DEADLINE_MS) / 1000} seconds); the page may be stuck in a long task or crashed. Check it with browser.evaluate({tabID}) or browser.reload({tabID}), then capture again. If it keeps failing, report the capture failure instead of repeating it unchanged.`
: undefined
return {
type: "failure",
- code: network ? "navigation_failed" : "operation_failed",
+ code: cause instanceof CodedError ? cause.code : network ? "navigation_failed" : "operation_failed",
message: `browser.${action.type} failed. ${hint ? `${hint} Details: ${detail.slice(0, 400)}` : detail}`.slice(
0,
2_048,
@@ -49,6 +106,6 @@ export function browserFailure(action: Browser.Action, error: unknown): Extract<
}
}
-function message(error: unknown, limit = 400) {
- return (error instanceof Error ? error.message : String(error)).slice(0, limit)
+function message(cause: unknown, limit = 400) {
+ return (cause instanceof Error ? cause.message : String(cause)).slice(0, limit)
}
diff --git a/packages/gui-plugins/src/browser/failure-view.tsx b/packages/gui-plugins/src/browser/failure-view.tsx
new file mode 100644
index 000000000000..3e835cd66f23
--- /dev/null
+++ b/packages/gui-plugins/src/browser/failure-view.tsx
@@ -0,0 +1,92 @@
+import { usePlugin } from "@opencode/plugin/gui"
+import { Button } from "@opencode/ui/button"
+import { Icon } from "@opencode/ui/icon"
+import { IconButton } from "@opencode/ui/icon-button"
+import { For, Show } from "solid-js"
+import type definition from "./index"
+
+/**
+ * Where the page would be when it did not load, or when a command failed with no page to keep: what happened in
+ * plain words, one sentence of what to do, the actions that can help, and Chromium's code, small, for developers.
+ */
+export function FailurePage(props: {
+ title: string
+ description: string
+ warning?: boolean
+ actions: readonly { label: string; run: () => void }[]
+ code?: string
+}) {
+ return (
+ // Add the 40px toolbar to the file empty state's 160px bottom padding to align their centers.
+
+
+
{props.title}
+
+ {props.description}
+
+
0}>
+
+
+ {(action, index) => (
+
+ )}
+
+
+
+
+ {(code) => (
+
+ {code()}
+
+ )}
+
+
+ )
+}
+
+/**
+ * A line above the page for a command that did not work or an address the pane will not open. The page stays: the
+ * person reads it, tries again where that can help, or closes it.
+ */
+export function FailureBar(props: { text: string; retry?: () => void; dismiss: () => void }) {
+ const ctx = usePlugin()
+
+ return (
+
+
+ {props.text}
+
+
+ {(retry) => (
+
+ )}
+
+ }
+ onClick={() => props.dismiss()}
+ />
+
+ )
+}
diff --git a/packages/gui-plugins/src/browser/failure.test.ts b/packages/gui-plugins/src/browser/failure.test.ts
new file mode 100644
index 000000000000..4bdf66edb27c
--- /dev/null
+++ b/packages/gui-plugins/src/browser/failure.test.ts
@@ -0,0 +1,94 @@
+import { describe, expect, test } from "bun:test"
+import { FileVerificationError } from "@opencode/util/file-verification"
+import { commandFailure, loadFailure } from "./failure"
+import en from "./i18n/en"
+
+// The plugin's English copy, by key.
+const message = (key: string) => Object.entries(en).find((entry) => entry[0] === key)?.[1]
+
+// Every command the window sends for the person, and a failure main reports with no command.
+const attempts = ["navigate", "tabs.open", "reload", "back", "forward", "stop", "tabs.close", "tabs.focus", undefined] as const
+
+describe("a page that did not load", () => {
+ test.each([
+ ["ERR_NAME_NOT_RESOLVED", "unreachable"],
+ ["ERR_CONNECTION_REFUSED", "unreachable"],
+ ["ERR_ADDRESS_UNREACHABLE", "unreachable"],
+ ["502 Bad Gateway", "unreachable"],
+ ["ERR_INTERNET_DISCONNECTED", "offline"],
+ ["ERR_TIMED_OUT", "slow"],
+ ["ERR_CONNECTION_TIMED_OUT", "slow"],
+ ["ERR_CERT_AUTHORITY_INVALID", "insecure"],
+ ["ERR_SSL_PROTOCOL_ERROR", "insecure"],
+ ["ERR_TOO_MANY_REDIRECTS", "redirects"],
+ ["ERR_BLOCKED_BY_CLIENT", "blocked"],
+ ["ERR_EMPTY_RESPONSE", "generic"],
+ ["ERR_FAILED", "generic"],
+ ["page_crashed", "crashed"],
+ ["browser.restore.refused", "unavailable"],
+ [FileVerificationError.code, "unavailable"],
+ ["something main never said before", "generic"],
+ ] as const)("%s reads as %s, in plain words", (error, kind) => {
+ const view = loadFailure(error)
+ expect(view.kind).toBe(kind)
+ // The headline and the sentence are the plugin's own copy; Chromium's code is only the small line under them.
+ expect(message(view.title)).toBeTruthy()
+ expect(message(view.description)).toBeTruthy()
+ expect(message(view.title)).not.toContain("ERR_")
+ expect(view.code).toBe(error.startsWith("ERR_") || error.startsWith("502") ? error : undefined)
+ })
+
+ test("Chromium's code is read out of a longer message", () => {
+ expect(loadFailure("ERR_CONNECTION_REFUSED (-102) loading 'http://localhost:3000/'")).toMatchObject({
+ kind: "unreachable",
+ code: "ERR_CONNECTION_REFUSED",
+ })
+ })
+})
+
+describe("a command that failed", () => {
+ test.each([
+ "browser.address.web",
+ "browser.address.credentials",
+ "browser.address.workspace",
+ "browser.preview.restricted",
+ "browser.preview.agentRestricted",
+ "browser.pane.replaced",
+ "browser.pane.unavailable",
+ "browser.menu.failed",
+ "browser.command.failed",
+ "download_failed",
+ "The browser page did not finish starting or navigating. Reload the tab and inspect it before retrying.",
+ "Browser tab is unavailable. Call browser.tabs.list({}) and use an existing tabID.",
+ "a code nobody has seen yet",
+ "",
+ ])("%p never reaches the person as the app's generic failure text", (code) => {
+ attempts.forEach((action) => {
+ const view = commandFailure(code, action)
+
+ if (view.surface === "none") return
+ // A sentence of the browser's own, which says what was tried or why not: never `common.requestFailed`.
+ expect(view.text.startsWith("common.")).toBe(false)
+ expect(message(view.text)).toBeTruthy()
+ expect(message(view.text)).not.toBe("Request failed")
+ })
+ })
+
+ test("an unknown code gets its sentence from what the person tried, and is reported as unknown", () => {
+ expect(commandFailure("a code nobody has seen yet", "reload")).toEqual({
+ surface: "notice",
+ text: "failed.command.reload",
+ lasting: false,
+ retry: true,
+ known: false,
+ })
+ expect(commandFailure("a code nobody has seen yet", "stop")).toMatchObject({ text: "failed.command.stop", retry: false })
+ expect(commandFailure("a code nobody has seen yet", undefined)).toMatchObject({ text: "failed.command.other", known: false })
+ })
+
+ test("a refusal stays to be read; a load the page area explains raises no notice beside it", () => {
+ expect(commandFailure("browser.address.web", "navigate")).toMatchObject({ text: "refused.web", lasting: true, retry: false })
+ expect(commandFailure("ERR_NAME_NOT_RESOLVED (-105) loading 'https://nowhere.example/'", "navigate").surface).toBe("none")
+ expect(commandFailure("page_crashed", undefined).surface).toBe("none")
+ })
+})
diff --git a/packages/gui-plugins/src/browser/failure.ts b/packages/gui-plugins/src/browser/failure.ts
new file mode 100644
index 000000000000..6acecb52eab9
--- /dev/null
+++ b/packages/gui-plugins/src/browser/failure.ts
@@ -0,0 +1,166 @@
+// What the person sees when something in the pane fails. A page that did not load is explained where the page would
+// be, as a browser does. A command that failed says what the person tried. Nothing here returns the app's generic
+// "Request failed": a code this file does not know gets a sentence from what was being attempted, and is reported
+// as unknown so the model logs it.
+import type { Browser } from "@opencode/plugin-browser/rpc"
+import { FileVerificationError } from "@opencode/util/file-verification"
+import type { RefusalNotice } from "./ipc"
+
+/**
+ * Why a page did not load, as far as a person can act on it.
+ * - `unreachable`: the address is wrong or the site is down.
+ * - `offline`: this computer has no connection.
+ * - `slow`: the site took too long.
+ * - `insecure`: the site's certificate or encryption did not check out.
+ * - `redirects`: the site kept redirecting.
+ * - `blocked`: the app's rules or an extension stopped the load.
+ * - `crashed`: the page's process ended.
+ * - `unavailable`: a file, preview or saved address the session can no longer show.
+ * - `generic`: anything else.
+ */
+export type LoadKind =
+ | "unreachable"
+ | "offline"
+ | "slow"
+ | "insecure"
+ | "redirects"
+ | "blocked"
+ | "crashed"
+ | "unavailable"
+ | "generic"
+
+const CHROMIUM_CODE = /\bERR_[A-Z\d_]+\b/
+
+const LOAD_COPY = {
+ unreachable: { title: "failed.unreachable.title", description: "failed.unreachable.description" },
+ offline: { title: "failed.offline.title", description: "failed.offline.description" },
+ slow: { title: "failed.slow.title", description: "failed.slow.description" },
+ insecure: { title: "failed.insecure.title", description: "failed.insecure.description" },
+ redirects: { title: "failed.redirects.title", description: "failed.redirects.description" },
+ blocked: { title: "failed.blocked.title", description: "failed.blocked.description" },
+ crashed: { title: "failed.crashed.title", description: "failed.crashed.description" },
+ generic: { title: "failed.generic.title", description: "failed.generic.description" },
+} as const
+
+// The first rule that matches Chromium's code decides, so the narrow timeouts come before the connection family.
+const CHROMIUM_KINDS: readonly (readonly [RegExp, keyof typeof LOAD_COPY])[] = [
+ [/^ERR_(?:CERT_|SSL_|INSECURE_RESPONSE|BAD_SSL_)/, "insecure"],
+ [/^ERR_(?:TIMED_OUT|CONNECTION_TIMED_OUT|DNS_TIMED_OUT)$/, "slow"],
+ [/^ERR_(?:INTERNET_DISCONNECTED|NETWORK_CHANGED|NETWORK_ACCESS_DENIED|PROXY_CONNECTION_FAILED)$/, "offline"],
+ [/^ERR_TOO_MANY_REDIRECTS$/, "redirects"],
+ [/^ERR_(?:BLOCKED_BY_|UNSAFE_|DISALLOWED_URL_SCHEME|UNKNOWN_URL_SCHEME|ACCESS_DENIED)/, "blocked"],
+ [/^ERR_(?:NAME_NOT_RESOLVED|NAME_RESOLUTION_FAILED|CONNECTION_|ADDRESS_|TUNNEL_CONNECTION_FAILED|SOCKS_CONNECTION_|INVALID_URL)/, "unreachable"],
+]
+
+/**
+ * The error page for a tab's `loadError`: a plain title, one sentence of what to do, whether loading again can help,
+ * and Chromium's own code for developers, which is never the headline.
+ */
+export function loadFailure(error: string) {
+ if (error === "browser.restore.outside")
+ return { kind: "unavailable", title: "failed.unavailable.title", description: "restore.outside", reload: false, code: undefined } as const
+
+ if (error === "browser.restore.refused")
+ return { kind: "unavailable", title: "failed.unavailable.title", description: "restore.refused", reload: false, code: undefined } as const
+
+ if (error === "browser.artifact.missing")
+ return { kind: "unavailable", title: "failed.unavailable.title", description: "artifact.missing", reload: true, code: undefined } as const
+
+ if (error === FileVerificationError.code)
+ return { kind: "unavailable", title: "failed.unavailable.title", description: "preview.verificationUnavailable", reload: true, code: undefined } as const
+
+ if (error === "browser.preview.unsupported")
+ return { kind: "unavailable", title: "failed.unavailable.title", description: "preview.upgrade", reload: true, code: undefined } as const
+
+ if (error === "page_crashed") return { kind: "crashed", ...LOAD_COPY.crashed, reload: true, code: undefined } as const
+ const code = CHROMIUM_CODE.exec(error)?.[0]
+ // The server-network proxy answers an unreachable target with an empty 502.
+ const kind = code ? (CHROMIUM_KINDS.find((rule) => rule[0].test(code))?.[1] ?? "generic") : /^502\b/.test(error) ? "unreachable" : "generic"
+
+ return { kind, ...LOAD_COPY[kind], reload: true, code: code ?? (/^\d{3}\b/.test(error) ? error.slice(0, 64) : undefined) }
+}
+
+export type LoadFailure = ReturnType
+
+/** The sentence for an address or file the pane refused to open. */
+export function refusalText(
+ reason: Exclude,
+) {
+ if (reason === "browser.address.credentials") return "refused.credentials"
+
+ if (reason === "browser.address.workspace") return "refused.workspace"
+
+ if (reason === "browser.preview.restricted") return "preview.restricted"
+
+ if (reason === "browser.preview.agentRestricted") return "preview.agentRestricted"
+
+ return "refused.web"
+}
+
+/**
+ * What a failed command or an error main reported tells the person.
+ * - `none`: nothing in the notice bar. The page area already explains it (a load that failed, a page that crashed),
+ * or the model shows it elsewhere.
+ * - `notice`: a line above the page. `lasting` is a refusal with a reason, which stays until the person dismisses it
+ * or does something else; anything else goes by itself. `retry` offers the same command again. `known` is false for
+ * a code this table has no sentence for, which gets one from the attempted action.
+ */
+export function commandFailure(code: string, action: Browser.Action["type"] | undefined) {
+ if (code === "browser.address.web") return notice("refused.web", { lasting: true })
+
+ if (code === "browser.address.credentials") return notice("refused.credentials", { lasting: true })
+
+ if (code === "browser.address.workspace") return notice("refused.workspace", { lasting: true })
+
+ if (code === "browser.preview.restricted") return notice("preview.restricted", { lasting: true })
+
+ if (code === "browser.preview.agentRestricted") return notice("preview.agentRestricted", { lasting: true })
+
+ if (code === "browser.pane.replaced") return notice("replaced", { lasting: true })
+
+ if (code === "browser.menu.failed") return notice("menu.actionFailed", {})
+
+ if (code === "download_failed") return notice("download.failed", {})
+
+ // The model shows these two as a toast, which is in sight even when the pane is not.
+ if (code === "browser.artifact.missing" || code === FileVerificationError.code) return { surface: "none", known: true } as const
+
+ // The tab carries these as its `loadError`, which the page area explains.
+ if (code === "page_crashed" || CHROMIUM_CODE.test(code)) return { surface: "none", known: true } as const
+
+ if (code === "browser.pane.unavailable") return notice(attempted(action), { retry: retriable(action) })
+
+ return notice(attempted(action), { retry: retriable(action), known: false })
+}
+
+export type CommandFailure = ReturnType
+
+function notice(text: Text, options: { lasting?: boolean; retry?: boolean; known?: boolean }) {
+ return { surface: "notice", text, lasting: options.lasting ?? false, retry: options.retry ?? false, known: options.known ?? true } as const
+}
+
+/** The sentence for a command that did not work, by what the person tried. */
+function attempted(action: Browser.Action["type"] | undefined) {
+ if (action === "navigate") return "failed.command.open"
+
+ if (action === "tabs.open") return "failed.command.newTab"
+
+ if (action === "reload") return "failed.command.reload"
+
+ if (action === "back") return "failed.command.back"
+
+ if (action === "forward") return "failed.command.forward"
+
+ if (action === "stop") return "failed.command.stop"
+
+ if (action === "tabs.close") return "failed.command.close"
+
+ if (action === "tabs.focus") return "failed.command.focus"
+
+ return "failed.command.other"
+}
+
+// Stopping, closing and switching are not worth a button: the person presses the same control again.
+function retriable(action: Browser.Action["type"] | undefined) {
+ return action === "navigate" || action === "tabs.open" || action === "reload" || action === "back" || action === "forward"
+}
diff --git a/packages/gui-plugins/src/browser/field-value.test.ts b/packages/gui-plugins/src/browser/field-value.test.ts
new file mode 100644
index 000000000000..cbf4ece4c9b2
--- /dev/null
+++ b/packages/gui-plugins/src/browser/field-value.test.ts
@@ -0,0 +1,65 @@
+import { expect, test } from "bun:test"
+import type { Protocol } from "devtools-protocol"
+import { readableField } from "./field-value"
+import { accessibilitySnapshot } from "./snapshot"
+
+const plain = { type: "text", autocomplete: "", labels: [], masked: false, maxLength: -1, toggles: [] }
+
+const fields = [
+ ["email address", "shown", { ...plain, type: "email" }, "Email", "ada@example.com"],
+ ["max tokens", "shown", { ...plain, type: "number", labels: ["maxTokens"] }, "Max tokens", "4096"],
+ ["username in a form whose Show password button is not its own", "shown", { ...plain, labels: ["username"] }, "Username", "ada"],
+ ["API key", "hidden", plain, "API key", "sk-1"],
+ ["API key by an acronym id", "hidden", { ...plain, labels: ["APIKey"] }, "", "sk-1"],
+ ["private key", "hidden", plain, "Private key", "-----BEGIN"],
+ ["access key named api_key", "hidden", { ...plain, labels: ["api_key"] }, "Access key", "AKIA1"],
+ ["access token", "hidden", { ...plain, labels: ["accessToken"] }, "", "t1"],
+ ["verification code", "hidden", plain, "Verification code", "123456"],
+ ["security code", "hidden", plain, "Security code", "123"],
+ ["recovery code", "hidden", plain, "Recovery code", "abcd-efgh"],
+ ["backup code", "hidden", plain, "Backup code", "abcd-efgh"],
+ ["2FA", "hidden", plain, "2FA", "123456"],
+ ["TOTP", "hidden", { ...plain, labels: ["totp"] }, "", "123456"],
+ ["MFA", "hidden", plain, "MFA code", "123456"],
+ ["split one-time code, text box", "hidden", { ...plain, maxLength: 1 }, "Digit 1", "4"],
+ ["split one-time code, tel box", "hidden", { ...plain, type: "tel", maxLength: 1 }, "", "4"],
+ ["split one-time code, number box", "hidden", { ...plain, type: "number", maxLength: 1 }, "", "4"],
+ ["revealed password beside Hide password", "hidden", { ...plain, labels: ["field_2"], toggles: ["Hide password"] }, "", "hunter2"],
+ ["search box", "shown", { ...plain, type: "search", labels: ["q", "Search pinned items"] }, "Search", "kittens"],
+ ["rich text editor", "shown", { ...plain, type: "" }, "Message body", "Dear Ada"],
+ ["empty field", "omitted", plain, "Notes", ""],
+ ["empty password", "omitted", { ...plain, type: "password" }, "Password", ""],
+ ["password", "hidden", { ...plain, type: "password" }, "Password", "hunter2"],
+ ["revealed current password", "hidden", { ...plain, autocomplete: "current-password" }, "Show it", "hunter2"],
+ ["revealed new password", "hidden", { ...plain, autocomplete: "section-a new-password" }, "Choose", "hunter2"],
+ ["revealed password named by its id", "hidden", { ...plain, labels: ["userPassword"] }, "", "hunter2"],
+ ["one-time code", "hidden", { ...plain, autocomplete: "one-time-code" }, "Code", "123456"],
+ ["card number by autocomplete", "hidden", { ...plain, autocomplete: "billing cc-number" }, "Number", "4111111111111111"],
+ ["card number by label", "hidden", plain, "Card number", "4111111111111111"],
+ ["CVV placeholder", "hidden", { ...plain, labels: ["CVV"] }, "", "987"],
+ ["PIN", "hidden", { ...plain, labels: ["pin_code"] }, "", "1234"],
+ ["OTP name", "hidden", { ...plain, labels: ["otp"] }, "", "1234"],
+ ["passcode", "hidden", plain, "Passcode", "1234"],
+ ["API token", "hidden", { ...plain, labels: ["api_token"] }, "", "sk-1"],
+ ["client secret", "hidden", plain, "Client secret", "abc"],
+ ["SSN", "hidden", plain, "SSN", "123-45-6789"],
+ ["masked text", "hidden", { ...plain, masked: true }, "Answer", "blue"],
+ ["file input", "hidden", { ...plain, type: "file" }, "Upload", "C:\\fakepath\\a.txt"],
+ ["field gone or unreadable", "hidden", undefined, "Name", "Ada"],
+] as const
+
+test.each(fields)("%s: value %s", async (_, expected, field, name, value) => {
+ const textbox: Protocol.Accessibility.AXNode = {
+ nodeId: "1",
+ backendDOMNodeId: 1,
+ ignored: false,
+ role: { type: "role", value: "textbox" },
+ name: { type: "string", value: name },
+ value: { type: "string", value },
+ }
+
+ const readableValue = async (_: number, label: string) => !!field && readableField(field, label)
+ const content = (await accessibilitySnapshot([textbox], { previous: new Map(), picked: new Map(), ref: () => "e1", readableValue })).content
+ const printed = content.match(/ value=(.*)$/)?.[1]
+ expect(printed === undefined ? "omitted" : printed === "" ? "hidden" : printed === JSON.stringify(value) ? "shown" : printed).toBe(expected)
+})
diff --git a/packages/gui-plugins/src/browser/field-value.ts b/packages/gui-plugins/src/browser/field-value.ts
new file mode 100644
index 000000000000..d28ff0ae831e
--- /dev/null
+++ b/packages/gui-plugins/src/browser/field-value.ts
@@ -0,0 +1,60 @@
+import { Schema } from "effect"
+
+/** What the page says about a field whose value a snapshot would print. */
+export const Field = Schema.Struct({
+ type: Schema.String,
+ autocomplete: Schema.String,
+ /** Its id, name, placeholder, `aria-label` and label texts. */
+ labels: Schema.Array(Schema.String),
+ /** Whether the page masks its characters, as `-webkit-text-security` does. */
+ masked: Schema.Boolean,
+ /** An input's `maxLength`, -1 when it has none. */
+ maxLength: Schema.Number,
+ /** The `aria-label` or text of buttons beside the field, such as "Show password". */
+ toggles: Schema.Array(Schema.String),
+})
+
+/**
+ * Reads `Field` from the element a CDP function runs on. Buttons count as the field's own only when it is the only
+ * field in its parent, so a login form's "Show password" does not hide its username.
+ */
+export const describeField = `function() {
+ const parent = this.parentElement
+ const own = parent && parent.querySelectorAll("input, textarea, [contenteditable]").length === 1
+ return {
+ type: this instanceof HTMLInputElement ? this.type : "",
+ autocomplete: this.getAttribute("autocomplete") ?? "",
+ labels: [this.id, this.getAttribute("name"), this.getAttribute("placeholder"), this.getAttribute("aria-label"), ...Array.from(this.labels ?? [], (label) => label.textContent)].filter(Boolean),
+ masked: getComputedStyle(this).webkitTextSecurity !== "none",
+ maxLength: this instanceof HTMLInputElement ? this.maxLength : -1,
+ toggles: own ? Array.from(parent.querySelectorAll('button, [role="button"]'), (button) => button.getAttribute("aria-label") || button.textContent).filter(Boolean) : [],
+ }
+}`
+
+const secretTokens = /^(current-password|new-password|one-time-code|cc-.+)$/
+
+const secretWords =
+ /passw|passcode|secret|\btoken\b|\b(api|private|access|signing|auth|ssh|webhook|encryption) ?key\b|\b(security|verification|recovery|backup) ?code\b|card ?(number|num|no)\b|\b(pwd|otp|totp|2fa|mfa|pin|cvv|cvc|ssn)\b/
+
+/**
+ * Whether a snapshot may print a field's value; `name` is its accessible name. When unsure, it hides. Chromium keeps
+ * no type history, so a password that a "show password" toggle turned into `type="text"` is recognised by its
+ * autocomplete, name, label or that toggle; a split one-time code by its one-character boxes.
+ */
+export function readableField(field: typeof Field.Type, name: string) {
+ if (field.masked || /^(password|file)$/.test(field.type)) return false
+
+ if (field.maxLength === 1 && /^(text|tel|number)$/.test(field.type)) return false
+
+ if (field.autocomplete.toLowerCase().split(/\s+/).some((token) => secretTokens.test(token))) return false
+
+ return ![name, ...field.labels, ...field.toggles].some((label) =>
+ secretWords.test(
+ label
+ .replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2")
+ .replace(/([a-z])([A-Z])/g, "$1 $2")
+ .replace(/[\W_]+/g, " ")
+ .toLowerCase(),
+ ),
+ )
+}
diff --git a/packages/gui-plugins/src/browser/file-choosers.ts b/packages/gui-plugins/src/browser/file-choosers.ts
new file mode 100644
index 000000000000..0e70be111b62
--- /dev/null
+++ b/packages/gui-plugins/src/browser/file-choosers.ts
@@ -0,0 +1,42 @@
+import type { Cdp } from "./cdp"
+import { activityOwner, type TabActivity } from "./policy"
+
+// Blink routes both HTML file inputs and the File System Access pickers through this Page-domain gate.
+// Suppressing in the renderer matters: receiving fileChooserOpened alone does not stop a native dialog.
+export function guardFileChoosers(cdp: Cdp, activity: TabActivity, refuse: (message: string) => void) {
+ const targets = new Map }>()
+
+ const off = cdp.on("Page.fileChooserOpened", () => {
+ if (activityOwner(activity) === "agent") refuse("Agent actions cannot open a native file picker. Use browser.files.upload({ tabID, ref, paths }) for a file input.")
+ })
+
+ function set(sessionID: string | undefined, enabled: boolean) {
+ const current = targets.get(sessionID)
+
+ if (current?.enabled === enabled) return current.ready
+ const ready = cdp.send("Page.setInterceptFileChooserDialog", { enabled, cancel: enabled }, sessionID)
+ targets.set(sessionID, { enabled, ready })
+
+ return ready
+ }
+
+ function update() {
+ const enabled = activityOwner(activity) === "agent"
+
+ return Promise.all(Array.from(targets.keys(), id => set(id, enabled)))
+ }
+
+ return {
+ attach: (sessionID?: string) => {
+ targets.set(sessionID, { enabled: false, ready: Promise.resolve() })
+
+ return update()
+ },
+ detach: (sessionID: string) => targets.delete(sessionID),
+ update,
+ dispose() {
+ targets.clear()
+ off()
+ },
+ }
+}
diff --git a/packages/gui-plugins/src/browser/find-bar.tsx b/packages/gui-plugins/src/browser/find-bar.tsx
new file mode 100644
index 000000000000..4efa549f8ba4
--- /dev/null
+++ b/packages/gui-plugins/src/browser/find-bar.tsx
@@ -0,0 +1,80 @@
+import { Icon } from "@opencode/ui/icon"
+import { IconButton } from "@opencode/ui/icon-button"
+import { Show, onMount, untrack } from "solid-js"
+import { usePlugin } from "@opencode/plugin/gui"
+import type definition from "./index"
+import type { FindAction, FindView } from "./ipc"
+
+export function FindBar(props: {
+ view: FindView
+ run: (action: FindAction) => void
+ input: (el: HTMLInputElement) => void
+}) {
+ const ctx = usePlugin()
+ let input: HTMLInputElement | undefined
+ onMount(() => {
+ input?.focus()
+ input?.select()
+ })
+
+ return (
+
+
+ {
+ input = el
+ props.input(el)
+ }}
+ dir="auto"
+ type="text"
+ role="searchbox"
+ maxLength={4096}
+ spellcheck={false}
+ autocomplete="off"
+ class="ms-1 min-w-0 flex-1 bg-transparent text-13-regular text-v2-text-text-base outline-none"
+ aria-label={ctx.t("find.open")}
+ placeholder={ctx.t("find.open")}
+ value={untrack(() => props.view.query)}
+ onInput={(event) => props.run({ type: "query", query: event.currentTarget.value })}
+ onKeyDown={(event) => {
+ if (event.isComposing || event.keyCode === 229 || (event.key !== "Escape" && event.key !== "Enter")) return
+ event.preventDefault()
+ event.stopPropagation()
+ props.run({ type: event.key === "Escape" ? "close" : event.shiftKey ? "previous" : "next" })
+ }}
+ />
+
+
+ {(result) => <>{ctx.plural("find.matches", result().total, { active: result().active })}>}
+
+
+ }
+ onClick={() => props.run({ type: "previous" })}
+ />
+ }
+ onClick={() => props.run({ type: "next" })}
+ />
+ }
+ onClick={() => props.run({ type: "close" })}
+ />
+
+ )
+}
diff --git a/packages/gui-plugins/src/browser/find-machine.test.ts b/packages/gui-plugins/src/browser/find-machine.test.ts
new file mode 100644
index 000000000000..e64f0bdf2235
--- /dev/null
+++ b/packages/gui-plugins/src/browser/find-machine.test.ts
@@ -0,0 +1,29 @@
+import { expect, test } from "bun:test"
+import { findView, initialFind, transitionFind } from "./find-machine"
+
+test("late matches cannot replace the new query's count or reopen a dismissed search", () => {
+ const opened = transitionFind(initialFind, { type: "open" })
+ const edited = transitionFind(opened, { type: "query", query: "first" })
+ const first = transitionFind(edited, { type: "issued", id: 8 })
+ const next = transitionFind(first, { type: "query", query: "other" })
+ const search = transitionFind(next, { type: "issued", id: 9 })
+
+ const result = {
+ requestId: 8,
+ finalUpdate: true,
+ matches: 4,
+ activeMatchOrdinal: 2,
+ selectionArea: { x: 0, y: 0, width: 1, height: 1 },
+ }
+
+ expect(transitionFind(next, { type: "found", result })).toBe(next)
+ expect(transitionFind(search, { type: "found", result })).toBe(search)
+ expect(transitionFind(search, { type: "found", result: { ...result, requestId: 9, finalUpdate: false } })).toBe(
+ search,
+ )
+ const found = transitionFind(search, { type: "found", result: { ...result, requestId: 9 } })
+ expect(findView(found)).toEqual({ query: "other", result: { active: 2, total: 4 } })
+ const closed = transitionFind(found, { type: "close" })
+ expect(transitionFind(closed, { type: "found", result })).toBe(closed)
+ expect(findView(transitionFind(closed, { type: "open" }))).toEqual({ query: "other", result: null })
+})
diff --git a/packages/gui-plugins/src/browser/find-machine.ts b/packages/gui-plugins/src/browser/find-machine.ts
new file mode 100644
index 000000000000..9ab2481022fa
--- /dev/null
+++ b/packages/gui-plugins/src/browser/find-machine.ts
@@ -0,0 +1,43 @@
+import type { FindAction, FindView } from "./ipc"
+
+type State =
+ | { status: "closed" | "editing"; query: string }
+ | { status: "searching"; query: string; id: number }
+ | { status: "found"; query: string; active: number; total: number }
+
+type Event = FindAction | { type: "issued"; id: number } | { type: "found"; result: Electron.Result }
+
+export const initialFind: State = { status: "closed", query: "" }
+
+/** Changing or closing the query invalidates even a final result that beats the next debounced search. */
+export function transitionFind(state: State, event: Event): State {
+ if (event.type === "open") return state.status === "closed" ? { status: "editing", query: state.query } : state
+
+ if (state.status === "closed") return state
+
+ switch (event.type) {
+ case "close":
+ return { status: "closed", query: state.query }
+ case "query":
+ return { status: "editing", query: event.query }
+ case "issued":
+ return { status: "searching", query: state.query, id: event.id }
+ case "found":
+ if (state.status !== "searching" || event.result.requestId !== state.id || !event.result.finalUpdate) return state
+
+ return {
+ status: "found",
+ query: state.query,
+ active: event.result.activeMatchOrdinal,
+ total: event.result.matches,
+ }
+ default:
+ return state
+ }
+}
+
+export function findView(state: State): FindView | null {
+ if (state.status === "closed") return null
+
+ return { query: state.query, result: state.status === "found" ? { active: state.active, total: state.total } : null }
+}
diff --git a/packages/gui-plugins/src/browser/history.ts b/packages/gui-plugins/src/browser/history.ts
index 9a418df9a7f3..f067402a8483 100644
--- a/packages/gui-plugins/src/browser/history.ts
+++ b/packages/gui-plugins/src/browser/history.ts
@@ -4,6 +4,8 @@ import { Schema } from "effect"
export const Visit = Schema.Struct({
url: Schema.String,
title: Schema.String,
+ /** Artifact addresses resolve only in the session in which the user opened them. */
+ session: Schema.optionalKey(Schema.String),
/** The page's icon as a data URL, when it was small enough to keep. */
icon: Schema.optionalKey(Schema.String),
})
@@ -22,22 +24,22 @@ const MAX_STORED_ICON = 6_000
/** The pages the history records: web pages and workspace files, not blank or internal ones. */
export function recordable(url: string) {
- return /^(?:https?|file):\/\//i.test(url)
+ return /^(?:https?|file|workspace|artifact):\/\//i.test(url)
}
/**
* Puts a visit first, replacing an earlier visit of the same URL, and drops the oldest past the limit. A visit without
* a title or icon yet keeps the earlier visit's.
*/
-export function remember(visits: readonly Visit[], visit: Pick, icon?: string): Visit[] {
- const earlier = visits.find((item) => item.url === visit.url)
+export function remember(visits: readonly Visit[], visit: Visit, icon?: string): Visit[] {
+ const earlier = visits.find((item) => item.url === visit.url && item.session === visit.session)
const kept = storable(icon) ?? earlier?.icon
const title = visit.title || earlier?.title || ""
- const next: Visit = kept ? { url: visit.url, title, icon: kept } : { url: visit.url, title }
+ const next: Visit = kept ? { ...visit, title, icon: kept } : { ...visit, title }
// Copies, so a store that reconciles the new list in place never sees its own records at moved positions.
- return [next, ...visits.flatMap((item) => (item.url === visit.url ? [] : [{ ...item }]))].slice(0, MAX_VISITS)
+ return [next, ...visits.flatMap((item) => (item.url === visit.url && item.session === visit.session ? [] : [{ ...item }]))].slice(0, MAX_VISITS)
}
/** The visits with a newly loaded icon on the visit of `url`, or undefined when nothing would change. */
diff --git a/packages/gui-plugins/src/browser/host-display.test.ts b/packages/gui-plugins/src/browser/host-display.test.ts
new file mode 100644
index 000000000000..5359035fe8b6
--- /dev/null
+++ b/packages/gui-plugins/src/browser/host-display.test.ts
@@ -0,0 +1,28 @@
+import { expect, test } from "bun:test"
+import { displayHost, hostDisplay } from "./host-display"
+
+test("draws the real web authority independently of the path and in ASCII", () => {
+ expect(hostDisplay("https://accounts.example.com.long.tenant.example.co.uk/docs?x#y")).toEqual({
+ scheme: "https://",
+ host: "accounts.example.com.long.tenant.example.co.uk",
+ rest: "/docs?x#y",
+ })
+ expect(hostDisplay("https://bücher.de/")?.host).toBe("xn--bcher-kva.de")
+ expect(hostDisplay("http://[::1]:1234/path")?.host).toBe("[::1]:1234")
+ expect(hostDisplay("https://label@example.test/")).toBeUndefined()
+ expect(hostDisplay("workspace://session/path")).toBeUndefined()
+ // The address bar keeps the whole host and elides it from the left itself.
+ expect(hostDisplay(`https://${"a".repeat(80)}.example.com/`)?.host).toBe(`${"a".repeat(80)}.example.com`)
+})
+
+test("shows the end of every host it names, where the registrable domain is, in one formatter", () => {
+ const phish = "https://sso.corp.example.com.auth-portal-session-verify.account-security-check.evil.test:8443/auth"
+ const host = displayHost(phish)
+
+ expect(host.length).toBeLessThanOrEqual(64)
+ expect(host.endsWith(".evil.test:8443")).toBe(true)
+ expect(host.startsWith("…")).toBe(true)
+ expect(displayHost("https://bücher.example/")).toBe("xn--bcher-kva.example")
+ expect(displayHost("http://127.0.0.1:7821")).toBe("127.0.0.1:7821")
+ expect(displayHost("not a url")).toBe("")
+})
diff --git a/packages/gui-plugins/src/browser/host-display.ts b/packages/gui-plugins/src/browser/host-display.ts
new file mode 100644
index 000000000000..1bbef7ec9af0
--- /dev/null
+++ b/packages/gui-plugins/src/browser/host-display.ts
@@ -0,0 +1,32 @@
+/** The longest host a prompt, bar or list names as text; the address bar elides its own from the left instead. */
+export const HOST_MAX = 64
+
+/**
+ * The host of a URL or origin as the pane names it everywhere, one rule: the canonical ASCII authority (punycode for
+ * an international name, the port kept), and when it is longer than `max`, its end, where the registrable domain is,
+ * behind a leading "…". Show it in one LTR run, whole and wrapping; never cut it off at the end. Empty for no URL.
+ */
+export function displayHost(url: string, max = HOST_MAX) {
+ if (!URL.canParse(url)) return ""
+ const host = new URL(url).host
+
+ return host.length > max ? `…${host.slice(1 - max)}` : host
+}
+
+/**
+ * The address bar's parts of a web address. It keeps the entire canonical ASCII authority in one LTR run, which the
+ * chrome elides from the left, so private or unknown public suffixes, IPv6 literals and ports need no last-two-label
+ * heuristic. Undefined for anything but an HTTP(S) address without credentials.
+ */
+export function hostDisplay(address: string) {
+ if (!/^https?:\/\//i.test(address) || !URL.canParse(address)) return
+ const url = new URL(address)
+
+ if (url.username || url.password) return
+
+ return {
+ scheme: `${url.protocol}//`,
+ host: displayHost(address, Infinity),
+ rest: `${url.pathname}${url.search}${url.hash}`,
+ }
+}
diff --git a/packages/gui-plugins/src/browser/i18n/am.ts b/packages/gui-plugins/src/browser/i18n/am.ts
index b0c340e1041c..8d15b6566407 100644
--- a/packages/gui-plugins/src/browser/i18n/am.ts
+++ b/packages/gui-plugins/src/browser/i18n/am.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "አሳሽ",
"address.label": "የአሳሽ አድራሻ",
"action.stop": "አቁም",
- replaced: "የአሳሽ መቆጣጠሪያ ወደ ሌላ የዴስክቶፕ መስኮት ተንቀሳቅሷል።",
unsupported: "ይህ የዴስክቶፕ መተግበሪያ የአሳሽ ፓነሉን አይደግፍም።",
- suspended: "አሳሽ ታግዷል። እንደገና ለመገናኘት ከዚህ ክፍለ ጊዜ ጋር ይገናኙ።",
- "failed.title": "URL ላይ መድረስ አልተቻለም",
- "failed.description": "URL-ውን እና ግንኙነትዎን ይፈትሹ፣ ከዚያ እንደገና ይሞክሩ።",
"action.reload": "ዳግም ጫን",
"model.timedOut": "አሳሹ ለመጫን በጣም ዘገየ",
- "command.inspect": "በአሳሽ ገጹ ውስጥ አንድ አካል ይምረጡ",
- "command.address": "በአሳሽ አድራሻ ላይ አተኩር",
"command.close": "የአሳሽ ትርን ዝጋ",
"command.newTab": "አዲስ የአሳሽ ትር",
"tab.new": "አዲስ ትር",
- "address.search": "ይፈልጉ ወይም URL ያስገቡ",
"address.suggestions": "ጥቆማዎች",
"refused.web": "እዚህ ሊከፈቱ የሚችሉት የድር ገጾች ብቻ ናቸው።",
"refused.workspace": "እዚህ ሊከፈቱ የሚችሉት የድር ገጾች እና በዚህ ክፍለ ጊዜ workspace ውስጥ ያሉ ፋይሎች ብቻ ናቸው።",
"refused.credentials": "የተጠቃሚ ስም ወይም የይለፍ ቃል ያላቸው አድራሻዎች እዚህ ሊከፈቱ አይችሉም።",
- inspect: "አስተያየት የሚሰጡበትን አካል ይምረጡ",
- "inspect.active": "አስተያየት ለመስጠት በገጹ ውስጥ አንድ አካል ጠቅ ያድርጉ። ለመሰረዝ Escape ይጫኑ።",
- "comment.label": "በዚህ አካል ላይ አስተያየት ስጥ",
"comment.placeholder": "አማራጭ አስተያየት ያክሉ...",
- "comment.cancel": "የአካል አስተያየትን ሰርዝ",
- "comment.submit": "የአካል አስተያየት አክል",
- "comment.attach": "አካል አክል",
"comment.annotation": "የአሳሽ ማብራሪያ",
"home.title": "ገጽ ክፈት",
"home.description": "መተግበሪያዎን ቅድመ እይታ ያድርጉ፣ ሰነዶችን ያንብቡ ወይም ድሩን ያስሱ።",
@@ -36,24 +23,15 @@ export default {
"site.secure": "ግንኙነቱ ደህንነቱ የተጠበቀ ነው",
"site.insecure": "ግንኙነቱ ደህንነቱ የተጠበቀ አይደለም",
"site.insecure.description": "በዚህ ገጽ ላይ የይለፍ ቃሎችን ወይም ሌላ የግል መረጃ አያስገቡ።",
- "site.local": "አካባቢያዊ አገልጋይ",
- "site.local.description": "አካባቢያዊ አድራሻዎች የOpenCode አገልጋዩን በሚያሄደው ማሽን ላይ ይከፈታሉ።",
"site.file": "የworkspace ፋይል",
"site.file.description": "እዚህ ሊከፈቱ የሚችሉት በዚህ ክፍለ ጊዜ workspace ውስጥ ያሉ ፋይሎች ብቻ ናቸው።",
- "site.network": "ገጾች በ{{server}} አውታረ መረብ በኩል ይጫናሉ።",
"site.cookies": "ኩኪዎች እና የጣቢያ ውሂብ",
"site.cookies.count.one": "{{count}} ኩኪ ጥቅም ላይ ነው",
"site.cookies.count.other": "{{count}} ኩኪዎች ጥቅም ላይ ናቸው",
"site.cookies.clear": "አጽዳ",
"site.permissions": "ፍቃዶች ታግደዋል",
"site.permissions.description": "ካሜራ፣ ማይክሮፎን፣ አካባቢ እና ማሳወቂያዎች በዚህ አሳሽ ውስጥ አይሰሩም።",
- "site.agent": "ወኪሉ ይህን ገጽ መጠቀም ይችላል",
- "site.agent.description": "ገጹን ማንበብ፣ ስክሪፕቶችን ማሄድ እና ቅጾችን መሙላት ይችላል።",
"page.add": "ገጹን ወደ ክፍለ ጊዜ አክል",
- "page.placeholder": "ስለዚህ ገጽ አውድ ያክሉ",
- "external.open": "በስርዓቱ አሳሽ ውስጥ ክፈት",
- "external.menu": "በአሳሽ ውስጥ ክፈት",
- "external.unavailable": "ይህ አድራሻ የሚሰራው በአገልጋዩ ማሽን ላይ ብቻ ነው።",
options: "የአሳሽ አማራጮች",
"zoom.in": "አጉላ",
"zoom.out": "አሳንስ",
diff --git a/packages/gui-plugins/src/browser/i18n/ar.ts b/packages/gui-plugins/src/browser/i18n/ar.ts
index f1c4e822859a..630dc56da4d4 100644
--- a/packages/gui-plugins/src/browser/i18n/ar.ts
+++ b/packages/gui-plugins/src/browser/i18n/ar.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "المتصفح",
"address.label": "عنوان المتصفح",
"action.stop": "إيقاف",
- replaced: "انتقل التحكم بالمتصفح إلى نافذة سطح مكتب أخرى.",
unsupported: "لا يدعم تطبيق سطح المكتب هذا لوحة المتصفح.",
- suspended: "عُلّق المتصفح. تفاعل مع هذه الجلسة لإعادة الاتصال.",
- "failed.title": "يتعذر الوصول إلى عنوان URL",
- "failed.description": "تحقق من عنوان URL واتصالك، ثم حاول مرة أخرى.",
"action.reload": "إعادة التحميل",
"model.timedOut": "استغرق المتصفح وقتًا طويلًا للتحميل",
- "command.inspect": "تحديد عنصر في صفحة المتصفح",
- "command.address": "التركيز على عنوان المتصفح",
"command.close": "إغلاق علامة تبويب المتصفح",
"command.newTab": "علامة تبويب متصفح جديدة",
"tab.new": "علامة تبويب جديدة",
- "address.search": "ابحث أو أدخل عنوان URL",
"address.suggestions": "الاقتراحات",
"refused.web": "يمكن فتح صفحات الويب فقط هنا.",
"refused.workspace": "يمكن فتح صفحات الويب والملفات الموجودة داخل مساحة عمل هذه الجلسة فقط هنا.",
"refused.credentials": "لا يمكن فتح العناوين التي تتضمن اسم مستخدم أو كلمة مرور هنا.",
- inspect: "حدد عنصرًا للتعليق عليه",
- "inspect.active": "انقر على عنصر في الصفحة للتعليق عليه. اضغط Escape للإلغاء.",
- "comment.label": "التعليق على هذا العنصر",
"comment.placeholder": "أضف تعليقًا اختياريًا...",
- "comment.cancel": "إلغاء التعليق على العنصر",
- "comment.submit": "إضافة تعليق على العنصر",
- "comment.attach": "إضافة العنصر",
"comment.annotation": "تعليق توضيحي من المتصفح",
"home.title": "فتح صفحة",
"home.description": "عاين تطبيقك أو اقرأ الوثائق أو تصفح الويب.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "الاتصال آمن",
"site.insecure": "الاتصال غير آمن",
"site.insecure.description": "لا تُدخل كلمات المرور أو غيرها من المعلومات الخاصة في هذه الصفحة.",
- "site.local": "خادم محلي",
- "site.local.description": "تُفتح العناوين المحلية على الجهاز الذي يشغّل خادم OpenCode.",
"site.file": "ملف من مساحة العمل",
"site.file.description": "يمكن فتح الملفات الموجودة داخل مساحة عمل هذه الجلسة فقط هنا.",
- "site.network": "تُحمَّل الصفحات عبر شبكة {{server}}.",
"site.cookies": "ملفات تعريف الارتباط وبيانات الموقع",
"site.cookies.count.zero": "ملفات تعريف الارتباط قيد الاستخدام: {{count}}",
"site.cookies.count.one": "ملفات تعريف الارتباط قيد الاستخدام: {{count}}",
@@ -51,13 +35,7 @@ export default {
"site.cookies.clear": "مسح",
"site.permissions": "الأذونات محظورة",
"site.permissions.description": "لا تعمل الكاميرا والميكروفون والموقع والإشعارات في هذا المتصفح.",
- "site.agent": "يمكن للوكيل استخدام هذه الصفحة",
- "site.agent.description": "يمكنه قراءة الصفحة وتشغيل البرامج النصية وملء النماذج.",
"page.add": "إضافة الصفحة إلى الجلسة",
- "page.placeholder": "أضف سياقًا عن هذه الصفحة",
- "external.open": "فتح في متصفح النظام",
- "external.menu": "فتح في المتصفح",
- "external.unavailable": "يعمل هذا العنوان على جهاز الخادم فقط.",
options: "خيارات المتصفح",
"zoom.in": "تكبير",
"zoom.out": "تصغير",
diff --git a/packages/gui-plugins/src/browser/i18n/az.ts b/packages/gui-plugins/src/browser/i18n/az.ts
index a07ac3964a45..90ceec58dc37 100644
--- a/packages/gui-plugins/src/browser/i18n/az.ts
+++ b/packages/gui-plugins/src/browser/i18n/az.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Brauzer",
"address.label": "Brauzer ünvanı",
"action.stop": "Dayandır",
- replaced: "Brauzer idarəsi başqa masaüstü pəncərəsinə köçürüldü.",
unsupported: "Bu masaüstü tətbiq brauzer panelini dəstəkləmir.",
- suspended: "Brauzer dayandırıldı. Təkrar qoşulmaq üçün bu sessiya ilə qarşılıqlı əlaqə qurun.",
- "failed.title": "URL əlçatan deyil",
- "failed.description": "URL-i və bağlantınızı yoxlayın, sonra yenidən cəhd edin.",
"action.reload": "Yenidən yüklə",
"model.timedOut": "Brauzerin yüklənməsi çox uzun çəkdi",
- "command.inspect": "Brauzer səhifəsində element seç",
- "command.address": "Brauzer ünvan sətrinə fokusla",
"command.close": "Brauzer tabını bağla",
"command.newTab": "Yeni brauzer tabı",
"tab.new": "Yeni tab",
- "address.search": "Axtarın və ya URL daxil edin",
"address.suggestions": "Təkliflər",
"refused.web": "Burada yalnız veb səhifələr açıla bilər.",
"refused.workspace": "Burada yalnız veb səhifələr və bu sessiyanın iş sahəsindəki fayllar açıla bilər.",
"refused.credentials": "İstifadəçi adı və ya şifrə olan ünvanlar burada açıla bilməz.",
- inspect: "Şərh yazmaq üçün element seçin",
- "inspect.active": "Şərh yazmaq üçün səhifədə elementə klikləyin. Ləğv etmək üçün Escape basın.",
- "comment.label": "Bu elementə şərh yaz",
"comment.placeholder": "İstəyə bağlı şərh əlavə edin...",
- "comment.cancel": "Element şərhini ləğv et",
- "comment.submit": "Element şərhi əlavə et",
- "comment.attach": "Element əlavə et",
"comment.annotation": "Brauzer qeydi",
"home.title": "Səhifə açın",
"home.description": "Tətbiqinizə önizləmə edin, sənədləri oxuyun və ya vebdə gəzin.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Bağlantı təhlükəsizdir",
"site.insecure": "Bağlantı təhlükəsiz deyil",
"site.insecure.description": "Bu səhifədə şifrə və ya digər şəxsi məlumatları daxil etməyin.",
- "site.local": "Lokal server",
- "site.local.description": "Lokal ünvanlar OpenCode serverinin işlədiyi maşında açılır.",
"site.file": "İş sahəsi faylı",
"site.file.description": "Burada yalnız bu sessiyanın iş sahəsindəki fayllar açıla bilər.",
- "site.network": "Səhifələr {{server}} şəbəkəsi vasitəsilə yüklənir.",
"site.cookies": "Kukilər və sayt məlumatları",
"site.cookies.count.one": "{{count}} kuki istifadə olunur",
"site.cookies.count.other": "{{count}} kuki istifadə olunur",
"site.cookies.clear": "Təmizlə",
"site.permissions": "İcazələr bloklanıb",
"site.permissions.description": "Kamera, mikrofon, məkan və bildirişlər bu brauzerdə işləmir.",
- "site.agent": "Agent bu səhifədən istifadə edə bilər",
- "site.agent.description": "O, səhifəni oxuya, skriptlər işlədə və formaları doldura bilər.",
"page.add": "Səhifəni sessiyaya əlavə et",
- "page.placeholder": "Bu səhifə haqqında kontekst əlavə edin",
- "external.open": "Sistem brauzerində aç",
- "external.menu": "Brauzerdə aç",
- "external.unavailable": "Bu ünvan yalnız serverin maşınında işləyir.",
options: "Brauzer seçimləri",
"zoom.in": "Böyüt",
"zoom.out": "Kiçilt",
diff --git a/packages/gui-plugins/src/browser/i18n/bg.ts b/packages/gui-plugins/src/browser/i18n/bg.ts
index 5e3643fe6199..48e3ec34d8fc 100644
--- a/packages/gui-plugins/src/browser/i18n/bg.ts
+++ b/packages/gui-plugins/src/browser/i18n/bg.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Браузър",
"address.label": "Адрес на браузъра",
"action.stop": "Спрете",
- replaced: "Управлението на браузъра е преместено в друг прозорец на настолното приложение.",
unsupported: "Това настолно приложение не поддържа панела на браузъра.",
- suspended: "Браузърът е спрян временно. Взаимодействайте с тази сесия, за да се свържете отново.",
- "failed.title": "URL адресът не е достъпен",
- "failed.description": "Проверете URL адреса и връзката си, след което опитайте отново.",
"action.reload": "Презареждане",
"model.timedOut": "Браузърът се зарежда твърде бавно",
- "command.inspect": "Избор на елемент от страницата в браузъра",
- "command.address": "Фокус върху адреса в браузъра",
"command.close": "Затваряне на раздела на браузъра",
"command.newTab": "Нов раздел в браузъра",
"tab.new": "Нов раздел",
- "address.search": "Търсете или въведете URL адрес",
"address.suggestions": "Предложения",
"refused.web": "Тук могат да се отварят само уеб страници.",
"refused.workspace": "Тук могат да се отварят само уеб страници и файлове от работното пространство на тази сесия.",
"refused.credentials": "Адреси с потребителско име или парола не могат да се отварят тук.",
- inspect: "Изберете елемент, който да коментирате",
- "inspect.active": "Щракнете върху елемент в страницата, за да го коментирате. Натиснете Escape за отказ.",
- "comment.label": "Коментар към този елемент",
"comment.placeholder": "Добавете коментар (по избор)...",
- "comment.cancel": "Отказ от коментара към елемента",
- "comment.submit": "Добавяне на коментар към елемента",
- "comment.attach": "Добавяне на елемент",
"comment.annotation": "Анотация от браузъра",
"home.title": "Отваряне на страница",
"home.description": "Прегледайте приложението си, четете документация или разглеждайте уеб страници.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Връзката е защитена",
"site.insecure": "Връзката не е защитена",
"site.insecure.description": "Не въвеждайте пароли или друга лична информация на тази страница.",
- "site.local": "Локален сървър",
- "site.local.description": "Локалните адреси се отварят на машината, на която работи сървърът на OpenCode.",
"site.file": "Файл от работното пространство",
"site.file.description": "Тук могат да се отварят само файлове от работното пространство на тази сесия.",
- "site.network": "Страниците се зареждат през мрежата на {{server}}.",
"site.cookies": "Бисквитки и данни на сайта",
"site.cookies.count.one": "{{count}} бисквитка в употреба",
"site.cookies.count.other": "{{count}} бисквитки в употреба",
"site.cookies.clear": "Изчистване",
"site.permissions": "Разрешенията са блокирани",
"site.permissions.description": "Камерата, микрофонът, местоположението и известията не работят в този браузър.",
- "site.agent": "Агентът може да използва тази страница",
- "site.agent.description": "Може да чете страницата, да изпълнява скриптове и да попълва формуляри.",
"page.add": "Добавяне на страницата към сесията",
- "page.placeholder": "Добавете контекст за тази страница",
- "external.open": "Отваряне в системния браузър",
- "external.menu": "Отваряне в браузър",
- "external.unavailable": "Този адрес работи само на машината на сървъра.",
options: "Опции на браузъра",
"zoom.in": "Увеличаване",
"zoom.out": "Намаляване",
diff --git a/packages/gui-plugins/src/browser/i18n/bn.ts b/packages/gui-plugins/src/browser/i18n/bn.ts
index d940c633186c..c5283368d16c 100644
--- a/packages/gui-plugins/src/browser/i18n/bn.ts
+++ b/packages/gui-plugins/src/browser/i18n/bn.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ব্রাউজার",
"address.label": "ব্রাউজার ঠিকানা",
"action.stop": "থামো",
- replaced: "ব্রাউজার নিয়ন্ত্রণ অন্য ডেস্কটপ উইন্ডোতে সরানো হয়েছে।",
unsupported: "এই ডেস্কটপ অ্যাপ্লিকেশন ব্রাউজার ফলক সমর্থন করে না.",
- suspended: "ব্রাউজার সাসপেন্ড করা হয়েছে। পুনরায় সংযোগ করতে এই সেশনের সাথে ইন্টারঅ্যাক্ট করুন।",
- "failed.title": "URL-এ পৌঁছানো যাচ্ছে না",
- "failed.description": "URL এবং আপনার সংযোগ পরীক্ষা করে আবার চেষ্টা করুন।",
"action.reload": "পুনরায় লোড করুন",
"model.timedOut": "ব্রাউজার লোড হতে অনেক বেশি সময় নিয়েছে",
- "command.inspect": "ব্রাউজার পৃষ্ঠায় একটি এলিমেন্ট নির্বাচন করুন",
- "command.address": "ব্রাউজারের ঠিকানায় ফোকাস করুন",
"command.close": "ব্রাউজার ট্যাব বন্ধ করুন",
"command.newTab": "নতুন ব্রাউজার ট্যাব",
"tab.new": "নতুন ট্যাব",
- "address.search": "অনুসন্ধান করুন বা একটি URL লিখুন",
"address.suggestions": "পরামর্শ",
"refused.web": "এখানে শুধুমাত্র ওয়েব পৃষ্ঠা খোলা যায়।",
"refused.workspace": "এখানে শুধুমাত্র ওয়েব পৃষ্ঠা এবং এই সেশনের ওয়ার্কস্পেসের ভেতরের ফাইল খোলা যায়।",
"refused.credentials": "ইউজার নেম বা পাসওয়ার্ডসহ ঠিকানা এখানে খোলা যায় না।",
- inspect: "মন্তব্য করার জন্য একটি এলিমেন্ট নির্বাচন করুন",
- "inspect.active": "মন্তব্য করতে পৃষ্ঠার একটি এলিমেন্টে ক্লিক করুন। বাতিল করতে Escape চাপুন।",
- "comment.label": "এই এলিমেন্টে মন্তব্য করুন",
"comment.placeholder": "ঐচ্ছিক মন্তব্য যোগ করুন...",
- "comment.cancel": "এলিমেন্ট মন্তব্য বাতিল করুন",
- "comment.submit": "এলিমেন্ট মন্তব্য যোগ করুন",
- "comment.attach": "এলিমেন্ট যোগ করুন",
"comment.annotation": "ব্রাউজার টীকা",
"home.title": "একটি পৃষ্ঠা খুলুন",
"home.description": "আপনার অ্যাপের পূর্বরূপ দেখুন, ডকুমেন্টেশন পড়ুন, বা ওয়েব ব্রাউজ করুন।",
@@ -36,24 +23,15 @@ export default {
"site.secure": "সংযোগ নিরাপদ",
"site.insecure": "সংযোগ নিরাপদ নয়",
"site.insecure.description": "এই পৃষ্ঠায় পাসওয়ার্ড বা অন্য কোনো ব্যক্তিগত তথ্য লিখবেন না।",
- "site.local": "স্থানীয় সার্ভার",
- "site.local.description": "স্থানীয় ঠিকানাগুলো OpenCode সার্ভার চালানো মেশিনে খোলে।",
"site.file": "ওয়ার্কস্পেস ফাইল",
"site.file.description": "এখানে শুধুমাত্র এই সেশনের ওয়ার্কস্পেসের ভেতরের ফাইল খোলা যায়।",
- "site.network": "পৃষ্ঠাগুলো {{server}}-এর নেটওয়ার্কের মাধ্যমে লোড হয়।",
"site.cookies": "কুকি ও সাইট ডেটা",
"site.cookies.count.one": "{{count}}টি কুকি ব্যবহৃত হচ্ছে",
"site.cookies.count.other": "{{count}}টি কুকি ব্যবহৃত হচ্ছে",
"site.cookies.clear": "পরিষ্কার করুন",
"site.permissions": "অনুমতিগুলো ব্লক করা আছে",
"site.permissions.description": "এই ব্রাউজারে ক্যামেরা, মাইক্রোফোন, অবস্থান এবং বিজ্ঞপ্তি কাজ করে না।",
- "site.agent": "এজেন্ট এই পৃষ্ঠা ব্যবহার করতে পারে",
- "site.agent.description": "এটি পৃষ্ঠা পড়তে, স্ক্রিপ্ট চালাতে এবং ফর্ম পূরণ করতে পারে।",
"page.add": "সেশনে পৃষ্ঠা যোগ করুন",
- "page.placeholder": "এই পৃষ্ঠা সম্পর্কে প্রসঙ্গ যোগ করুন",
- "external.open": "সিস্টেম ব্রাউজারে খুলুন",
- "external.menu": "ব্রাউজারে খুলুন",
- "external.unavailable": "এই ঠিকানাটি শুধুমাত্র সার্ভারের মেশিনে কাজ করে।",
options: "ব্রাউজারের বিকল্প",
"zoom.in": "জুম ইন করুন",
"zoom.out": "জুম আউট করুন",
diff --git a/packages/gui-plugins/src/browser/i18n/br.ts b/packages/gui-plugins/src/browser/i18n/br.ts
index 746224d3414d..4241775fe8e7 100644
--- a/packages/gui-plugins/src/browser/i18n/br.ts
+++ b/packages/gui-plugins/src/browser/i18n/br.ts
@@ -4,31 +4,18 @@ export default {
"tab.title": "Navegador",
"address.label": "Endereço do navegador",
"action.stop": "Parar",
- replaced: "O controle do navegador foi movido para outra janela da área de trabalho.",
unsupported: "Este aplicativo para desktop não oferece suporte ao painel do navegador.",
- suspended: "Navegador suspenso. Interaja com esta sessão para se reconectar.",
- "failed.title": "Não foi possível acessar a URL",
- "failed.description": "Verifique a URL e sua conexão e tente novamente.",
"action.reload": "Recarregar",
"model.timedOut": "O navegador demorou demais para carregar",
- "command.inspect": "Selecionar um elemento na página do navegador",
- "command.address": "Focar endereço do navegador",
"command.close": "Fechar aba do navegador",
"command.newTab": "Nova aba do navegador",
"tab.new": "Nova aba",
- "address.search": "Pesquise ou digite uma URL",
"address.suggestions": "Sugestões",
"refused.web": "Somente páginas da web podem ser abertas aqui.",
"refused.workspace":
"Somente páginas da web e arquivos dentro do espaço de trabalho desta sessão podem ser abertos aqui.",
"refused.credentials": "Endereços com nome de usuário ou senha não podem ser abertos aqui.",
- inspect: "Selecione um elemento para comentar",
- "inspect.active": "Clique em um elemento da página para comentar sobre ele. Pressione Escape para cancelar.",
- "comment.label": "Comentar sobre este elemento",
"comment.placeholder": "Adicione um comentário opcional...",
- "comment.cancel": "Cancelar comentário do elemento",
- "comment.submit": "Adicionar comentário do elemento",
- "comment.attach": "Adicionar elemento",
"comment.annotation": "Anotação do navegador",
"home.title": "Abrir uma página",
"home.description": "Visualize seu app, leia a documentação ou navegue na web.",
@@ -37,11 +24,8 @@ export default {
"site.secure": "A conexão é segura",
"site.insecure": "A conexão não é segura",
"site.insecure.description": "Não digite senhas nem outras informações privadas nesta página.",
- "site.local": "Servidor local",
- "site.local.description": "Endereços locais são abertos na máquina que executa o servidor do OpenCode.",
"site.file": "Arquivo do espaço de trabalho",
"site.file.description": "Somente arquivos dentro do espaço de trabalho desta sessão podem ser abertos aqui.",
- "site.network": "As páginas são carregadas pela rede de {{server}}.",
"site.cookies": "Cookies e dados do site",
"site.cookies.count.one": "{{count}} cookie em uso",
"site.cookies.count.many": "{{count}} cookies em uso",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Limpar",
"site.permissions": "As permissões estão bloqueadas",
"site.permissions.description": "Câmera, microfone, localização e notificações não funcionam neste navegador.",
- "site.agent": "O agente pode usar esta página",
- "site.agent.description": "Ele pode ler a página, executar scripts e preencher formulários.",
"page.add": "Adicionar página à sessão",
- "page.placeholder": "Adicione contexto sobre esta página",
- "external.open": "Abrir no navegador do sistema",
- "external.menu": "Abrir no navegador",
- "external.unavailable": "Este endereço só funciona na máquina do servidor.",
options: "Opções do navegador",
"zoom.in": "Ampliar",
"zoom.out": "Reduzir",
diff --git a/packages/gui-plugins/src/browser/i18n/bs.ts b/packages/gui-plugins/src/browser/i18n/bs.ts
index 0ff3721f49bf..e614a07afaed 100644
--- a/packages/gui-plugins/src/browser/i18n/bs.ts
+++ b/packages/gui-plugins/src/browser/i18n/bs.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Preglednik",
"address.label": "Adresa preglednika",
"action.stop": "Zaustavi",
- replaced: "Upravljanje preglednikom premješteno je u drugi prozor Desktopa.",
unsupported: "Ova aplikacija za računar ne podržava okno preglednika.",
- suspended: "Preglednik je obustavljen. Stupite u interakciju s ovom sesijom da biste se ponovo povezali.",
- "failed.title": "URL nije dostupan",
- "failed.description": "Provjerite URL i vezu, a zatim pokušajte ponovo.",
"action.reload": "Ponovo učitaj",
"model.timedOut": "Preglednik se predugo učitavao",
- "command.inspect": "Odaberi element na stranici preglednika",
- "command.address": "Fokusiraj adresu preglednika",
"command.close": "Zatvori karticu preglednika",
"command.newTab": "Nova kartica preglednika",
"tab.new": "Nova kartica",
- "address.search": "Pretražite ili unesite URL",
"address.suggestions": "Prijedlozi",
"refused.web": "Ovdje se mogu otvoriti samo web stranice.",
"refused.workspace": "Ovdje se mogu otvoriti samo web stranice i datoteke unutar radnog prostora ove sesije.",
"refused.credentials": "Adrese s korisničkim imenom ili lozinkom ne mogu se ovdje otvoriti.",
- inspect: "Odaberi element za komentar",
- "inspect.active": "Kliknite element na stranici da ga komentarišete. Pritisnite Escape za otkazivanje.",
- "comment.label": "Komentariši ovaj element",
"comment.placeholder": "Dodajte neobavezan komentar...",
- "comment.cancel": "Otkaži komentar na element",
- "comment.submit": "Dodaj komentar na element",
- "comment.attach": "Dodaj element",
"comment.annotation": "Bilješka preglednika",
"home.title": "Otvori stranicu",
"home.description": "Pregledajte svoju aplikaciju, čitajte dokumentaciju ili pretražujte web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Veza je sigurna",
"site.insecure": "Veza nije sigurna",
"site.insecure.description": "Ne unosite lozinke ni druge privatne podatke na ovoj stranici.",
- "site.local": "Lokalni server",
- "site.local.description": "Lokalne adrese otvaraju se na računaru na kojem radi OpenCode server.",
"site.file": "Datoteka radnog prostora",
"site.file.description": "Ovdje se mogu otvoriti samo datoteke unutar radnog prostora ove sesije.",
- "site.network": "Stranice se učitavaju preko mreže servera {{server}}.",
"site.cookies": "Kolačići i podaci stranice",
"site.cookies.count.one": "{{count}} kolačić u upotrebi",
"site.cookies.count.few": "{{count}} kolačića u upotrebi",
@@ -48,13 +32,7 @@ export default {
"site.cookies.clear": "Obriši",
"site.permissions": "Dozvole su blokirane",
"site.permissions.description": "Kamera, mikrofon, lokacija i obavještenja ne rade u ovom pregledniku.",
- "site.agent": "Agent može koristiti ovu stranicu",
- "site.agent.description": "Može čitati stranicu, pokretati skripte i popunjavati obrasce.",
"page.add": "Dodaj stranicu u sesiju",
- "page.placeholder": "Dodajte kontekst o ovoj stranici",
- "external.open": "Otvori u sistemskom pregledniku",
- "external.menu": "Otvori u pregledniku",
- "external.unavailable": "Ova adresa radi samo na računaru servera.",
options: "Opcije preglednika",
"zoom.in": "Uvećaj",
"zoom.out": "Umanji",
diff --git a/packages/gui-plugins/src/browser/i18n/ca.ts b/packages/gui-plugins/src/browser/i18n/ca.ts
index cfb0ddc548b6..d0ca0538e2ea 100644
--- a/packages/gui-plugins/src/browser/i18n/ca.ts
+++ b/packages/gui-plugins/src/browser/i18n/ca.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Navegador",
"address.label": "Adreça del navegador",
"action.stop": "Atureu-vos",
- replaced: "El control del navegador s'ha mogut a una altra finestra d'escriptori.",
unsupported: "Aquesta aplicació d'escriptori no admet el panell del navegador.",
- suspended: "Navegador suspès. Interacciona amb aquesta sessió per tornar a connectar.",
- "failed.title": "No es pot accedir a l’URL",
- "failed.description": "Comproveu l’URL i la connexió i torneu-ho a provar.",
"action.reload": "Torna a carregar",
"model.timedOut": "El navegador ha trigat massa a carregar-se",
- "command.inspect": "Selecciona un element de la pàgina del navegador",
- "command.address": "Enfoca l'adreça del navegador",
"command.close": "Tanca la pestanya del navegador",
"command.newTab": "Pestanya nova del navegador",
"tab.new": "Pestanya nova",
- "address.search": "Cerca o introdueix un URL",
"address.suggestions": "Suggeriments",
"refused.web": "Aquí només es poden obrir pàgines web.",
"refused.workspace": "Aquí només es poden obrir pàgines web i fitxers de l'espai de treball d'aquesta sessió.",
"refused.credentials": "Les adreces amb nom d'usuari o contrasenya no es poden obrir aquí.",
- inspect: "Selecciona un element per comentar-lo",
- "inspect.active": "Feu clic en un element de la pàgina per comentar-lo. Premeu Escape per cancel·lar.",
- "comment.label": "Comenta aquest element",
"comment.placeholder": "Afegeix un comentari opcional...",
- "comment.cancel": "Cancel·la el comentari de l'element",
- "comment.submit": "Afegeix el comentari de l'element",
- "comment.attach": "Afegeix l'element",
"comment.annotation": "Anotació del navegador",
"home.title": "Obre una pàgina",
"home.description": "Previsualitzeu la vostra aplicació, llegiu documentació o navegueu pel web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "La connexió és segura",
"site.insecure": "La connexió no és segura",
"site.insecure.description": "No introduïu contrasenyes ni altra informació privada en aquesta pàgina.",
- "site.local": "Servidor local",
- "site.local.description": "Les adreces locals s'obren a la màquina on s'executa el servidor d'OpenCode.",
"site.file": "Fitxer de l'espai de treball",
"site.file.description": "Aquí només es poden obrir fitxers de l'espai de treball d'aquesta sessió.",
- "site.network": "Les pàgines es carreguen a través de la xarxa de {{server}}.",
"site.cookies": "Galetes i dades dels llocs",
"site.cookies.count.one": "{{count}} galeta en ús",
"site.cookies.count.other": "{{count}} galetes en ús",
@@ -48,13 +32,7 @@ export default {
"site.permissions": "Els permisos estan bloquejats",
"site.permissions.description":
"La càmera, el micròfon, la ubicació i les notificacions no funcionen en aquest navegador.",
- "site.agent": "L'agent pot utilitzar aquesta pàgina",
- "site.agent.description": "Pot llegir la pàgina, executar scripts i emplenar formularis.",
"page.add": "Afegeix la pàgina a la sessió",
- "page.placeholder": "Afegeix context sobre aquesta pàgina",
- "external.open": "Obre al navegador del sistema",
- "external.menu": "Obre al navegador",
- "external.unavailable": "Aquesta adreça només funciona a la màquina del servidor.",
options: "Opcions del navegador",
"zoom.in": "Amplia",
"zoom.out": "Redueix",
diff --git a/packages/gui-plugins/src/browser/i18n/cs.ts b/packages/gui-plugins/src/browser/i18n/cs.ts
index db709922ea5c..fb8bfacfe66b 100644
--- a/packages/gui-plugins/src/browser/i18n/cs.ts
+++ b/packages/gui-plugins/src/browser/i18n/cs.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Prohlížeč",
"address.label": "Adresa prohlížeče",
"action.stop": "Přestaň",
- replaced: "Ovládání prohlížeče bylo přesunuto do jiného okna aplikace Desktop.",
unsupported: "Tato desktopová aplikace nepodporuje panel prohlížeče.",
- suspended: "Prohlížeč je pozastaven. Interakcí s touto relací se znovu připojíte.",
- "failed.title": "URL není dostupná",
- "failed.description": "Zkontrolujte URL a připojení a zkuste to znovu.",
"action.reload": "Načíst znovu",
"model.timedOut": "Načítání prohlížeče trvalo příliš dlouho",
- "command.inspect": "Vybrat prvek na stránce v prohlížeči",
- "command.address": "Přejít na adresní řádek prohlížeče",
"command.close": "Zavřít kartu prohlížeče",
"command.newTab": "Nová karta prohlížeče",
"tab.new": "Nová karta",
- "address.search": "Hledejte nebo zadejte URL",
"address.suggestions": "Návrhy",
"refused.web": "Zde lze otevřít pouze webové stránky.",
"refused.workspace": "Zde lze otevřít pouze webové stránky a soubory v pracovním prostoru této relace.",
"refused.credentials": "Adresy s uživatelským jménem nebo heslem zde nelze otevřít.",
- inspect: "Vyberte prvek, který chcete okomentovat",
- "inspect.active": "Klikněte na prvek na stránce a okomentujte ho. Stisknutím Escape akci zrušíte.",
- "comment.label": "Okomentovat tento prvek",
"comment.placeholder": "Přidejte volitelný komentář...",
- "comment.cancel": "Zrušit komentář k prvku",
- "comment.submit": "Přidat komentář k prvku",
- "comment.attach": "Přidat prvek",
"comment.annotation": "Anotace z prohlížeče",
"home.title": "Otevřete stránku",
"home.description": "Zobrazte náhled své aplikace, čtěte dokumentaci nebo procházejte web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Připojení je zabezpečené",
"site.insecure": "Připojení není zabezpečené",
"site.insecure.description": "Nezadávejte na této stránce hesla ani jiné soukromé údaje.",
- "site.local": "Místní server",
- "site.local.description": "Místní adresy se otevírají na stroji, na kterém běží server OpenCode.",
"site.file": "Soubor pracovního prostoru",
"site.file.description": "Zde lze otevřít pouze soubory v pracovním prostoru této relace.",
- "site.network": "Stránky se načítají přes síť serveru {{server}}.",
"site.cookies": "Soubory cookie a data webu",
"site.cookies.count.one": "Používá se {{count}} soubor cookie",
"site.cookies.count.few": "Používají se {{count}} soubory cookie",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Vymazat",
"site.permissions": "Oprávnění jsou blokována",
"site.permissions.description": "Kamera, mikrofon, poloha a oznámení v tomto prohlížeči nefungují.",
- "site.agent": "Agent může tuto stránku používat",
- "site.agent.description": "Může číst stránku, spouštět skripty a vyplňovat formuláře.",
"page.add": "Přidat stránku do relace",
- "page.placeholder": "Přidejte kontext k této stránce",
- "external.open": "Otevřít v systémovém prohlížeči",
- "external.menu": "Otevřít v prohlížeči",
- "external.unavailable": "Tato adresa funguje pouze na stroji serveru.",
options: "Možnosti prohlížeče",
"zoom.in": "Přiblížit",
"zoom.out": "Oddálit",
diff --git a/packages/gui-plugins/src/browser/i18n/da.ts b/packages/gui-plugins/src/browser/i18n/da.ts
index 3129c196f805..85358e1c8b59 100644
--- a/packages/gui-plugins/src/browser/i18n/da.ts
+++ b/packages/gui-plugins/src/browser/i18n/da.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Browser",
"address.label": "Browser adresse",
"action.stop": "Stop",
- replaced: "Browserkontrol flyttet til et andet skrivebordsvindue.",
unsupported: "Denne desktopapp understøtter ikke browserpanelet.",
- suspended: "Browser suspenderet. Interager med denne session for at genoprette forbindelsen.",
- "failed.title": "URL-adressen kan ikke nås",
- "failed.description": "Kontrollér URL-adressen og din forbindelse, og prøv igen.",
"action.reload": "Genindlæs",
"model.timedOut": "Browseren var for længe om at indlæse",
- "command.inspect": "Vælg et element på browsersiden",
- "command.address": "Fokuser browserens adresselinje",
"command.close": "Luk browserfane",
"command.newTab": "Ny browserfane",
"tab.new": "Ny fane",
- "address.search": "Søg, eller indtast en URL",
"address.suggestions": "Forslag",
"refused.web": "Kun websider kan åbnes her.",
"refused.workspace": "Kun websider og filer i denne sessions arbejdsområde kan åbnes her.",
"refused.credentials": "Adresser med brugernavn eller adgangskode kan ikke åbnes her.",
- inspect: "Vælg et element at kommentere",
- "inspect.active": "Klik på et element på siden for at kommentere det. Tryk på Escape for at annullere.",
- "comment.label": "Kommentér dette element",
"comment.placeholder": "Tilføj en valgfri kommentar...",
- "comment.cancel": "Annuller elementkommentar",
- "comment.submit": "Tilføj elementkommentar",
- "comment.attach": "Tilføj element",
"comment.annotation": "Browserannotering",
"home.title": "Åbn en side",
"home.description": "Forhåndsvis din app, læs dokumentation, eller surf på nettet.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Forbindelsen er sikker",
"site.insecure": "Forbindelsen er ikke sikker",
"site.insecure.description": "Indtast ikke adgangskoder eller andre private oplysninger på denne side.",
- "site.local": "Lokal server",
- "site.local.description": "Lokale adresser åbnes på den maskine, der kører OpenCode-serveren.",
"site.file": "Fil i arbejdsområdet",
"site.file.description": "Kun filer i denne sessions arbejdsområde kan åbnes her.",
- "site.network": "Sider indlæses via netværket på {{server}}.",
"site.cookies": "Cookies og webstedsdata",
"site.cookies.count.one": "{{count}} cookie i brug",
"site.cookies.count.other": "{{count}} cookies i brug",
"site.cookies.clear": "Ryd",
"site.permissions": "Tilladelser er blokeret",
"site.permissions.description": "Kamera, mikrofon, placering og notifikationer virker ikke i denne browser.",
- "site.agent": "Agenten kan bruge denne side",
- "site.agent.description": "Den kan læse siden, køre scripts og udfylde formularer.",
"page.add": "Føj side til session",
- "page.placeholder": "Tilføj kontekst om denne side",
- "external.open": "Åbn i systembrowser",
- "external.menu": "Åbn i browser",
- "external.unavailable": "Denne adresse virker kun på serverens maskine.",
options: "Browserindstillinger",
"zoom.in": "Zoom ind",
"zoom.out": "Zoom ud",
diff --git a/packages/gui-plugins/src/browser/i18n/de.ts b/packages/gui-plugins/src/browser/i18n/de.ts
index c46a220726b8..6cb207921565 100644
--- a/packages/gui-plugins/src/browser/i18n/de.ts
+++ b/packages/gui-plugins/src/browser/i18n/de.ts
@@ -4,31 +4,17 @@ export default {
"tab.title": "Browser",
"address.label": "Browseradresse",
"action.stop": "Stoppen",
- replaced: "Die Browsersteuerung wurde in ein anderes Desktop-Fenster verschoben.",
unsupported: "Diese Desktop-App unterstützt den Browserbereich nicht.",
- suspended: "Browser angehalten. Interagieren Sie mit dieser Sitzung, um die Verbindung wiederherzustellen.",
- "failed.title": "URL ist nicht erreichbar",
- "failed.description": "Überprüfen Sie die URL und Ihre Verbindung und versuchen Sie es erneut.",
"action.reload": "Neu laden",
"model.timedOut": "Der Browser hat zu lange zum Laden gebraucht",
- "command.inspect": "Element auf der Browserseite auswählen",
- "command.address": "Browseradresse fokussieren",
"command.close": "Browser-Tab schließen",
"command.newTab": "Neuer Browser-Tab",
"tab.new": "Neuer Tab",
- "address.search": "Suchbegriff oder URL eingeben",
"address.suggestions": "Vorschläge",
"refused.web": "Hier können nur Webseiten geöffnet werden.",
"refused.workspace": "Hier können nur Webseiten und Dateien im Arbeitsbereich dieser Sitzung geöffnet werden.",
"refused.credentials": "Adressen mit Benutzername oder Passwort können hier nicht geöffnet werden.",
- inspect: "Element zum Kommentieren auswählen",
- "inspect.active":
- "Klicken Sie auf ein Element auf der Seite, um es zu kommentieren. Drücken Sie Escape zum Abbrechen.",
- "comment.label": "Dieses Element kommentieren",
"comment.placeholder": "Optionalen Kommentar hinzufügen...",
- "comment.cancel": "Elementkommentar abbrechen",
- "comment.submit": "Elementkommentar hinzufügen",
- "comment.attach": "Element hinzufügen",
"comment.annotation": "Browser-Anmerkung",
"home.title": "Seite öffnen",
"home.description": "Ihre App ansehen, Dokumentation lesen oder im Web surfen.",
@@ -37,11 +23,8 @@ export default {
"site.secure": "Verbindung ist sicher",
"site.insecure": "Verbindung ist nicht sicher",
"site.insecure.description": "Geben Sie auf dieser Seite keine Passwörter oder andere private Daten ein.",
- "site.local": "Lokaler Server",
- "site.local.description": "Lokale Adressen werden auf dem Rechner geöffnet, auf dem der OpenCode-Server läuft.",
"site.file": "Arbeitsbereichsdatei",
"site.file.description": "Hier können nur Dateien im Arbeitsbereich dieser Sitzung geöffnet werden.",
- "site.network": "Seiten werden über das Netzwerk von {{server}} geladen.",
"site.cookies": "Cookies und Websitedaten",
"site.cookies.count.one": "{{count}} Cookie verwendet",
"site.cookies.count.other": "{{count}} Cookies verwendet",
@@ -49,13 +32,7 @@ export default {
"site.permissions": "Berechtigungen sind blockiert",
"site.permissions.description":
"Kamera, Mikrofon, Standort und Benachrichtigungen funktionieren in diesem Browser nicht.",
- "site.agent": "Agent kann diese Seite verwenden",
- "site.agent.description": "Er kann die Seite lesen, Skripte ausführen und Formulare ausfüllen.",
"page.add": "Seite zur Sitzung hinzufügen",
- "page.placeholder": "Kontext zu dieser Seite hinzufügen",
- "external.open": "Im Systembrowser öffnen",
- "external.menu": "Im Browser öffnen",
- "external.unavailable": "Diese Adresse funktioniert nur auf dem Rechner des Servers.",
options: "Browseroptionen",
"zoom.in": "Vergrößern",
"zoom.out": "Verkleinern",
diff --git a/packages/gui-plugins/src/browser/i18n/dv.ts b/packages/gui-plugins/src/browser/i18n/dv.ts
index 59330f801180..cac42c7d8b5d 100644
--- a/packages/gui-plugins/src/browser/i18n/dv.ts
+++ b/packages/gui-plugins/src/browser/i18n/dv.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ބްރައުޒާ އެވެ",
"address.label": "ބްރައުޒާ އެޑްރެސް އެވެ",
"action.stop": "ހުއްޓުން",
- replaced: "ބްރައުޒާ ކޮންޓްރޯލް އެހެން ޑެސްކްޓޮޕް ވިންޑޯއަކަށް ބަދަލުވިއެވެ.",
unsupported: "މި ޑެސްކްޓޮޕް އެޕް އިން ބްރައުޒާ ޕޭން އަށް ސަޕޯޓް ނުކުރެއެވެ.",
- suspended: "ބްރައުޒާ ސަސްޕެންޑް ކޮށްފިއެވެ. އަލުން ގުޅެން މި ސެޝަނާ މުއާމަލާތް ކުރުން.",
- "failed.title": "URL އަށް ނުފޯރާ",
- "failed.description": "URL އާއި ތިޔަ ކަނެކްޝަން ޗެކްކޮށް، އަލުން މަސައްކަތް ކުރައްވާ۔",
"action.reload": "އަލުން ލޯޑްކުރުން",
"model.timedOut": "ބްރައުޒަރ ލޯޑްވުމަށް ވަރަށް ގިނަ ވަގުތު ނެގިއްޖެ",
- "command.inspect": "ބްރައުޒަރ ޕޭޖުގައި އެލިމެންޓެއް ހޮވާ",
- "command.address": "ބްރައުޒަރ އެޑްރެހަށް ފޯކަސް ކުރާ",
"command.close": "ބްރައުޒަރ ޓެބް ބަންދުކުރާ",
"command.newTab": "އާ ބްރައުޒަރ ޓެބް",
"tab.new": "އާ ޓެބް",
- "address.search": "ހޯދާ ނުވަތަ URL އެއް ލިޔޭ",
"address.suggestions": "ހުށަހެޅުންތައް",
"refused.web": "މިތަނުގައި ހުޅުވޭނީ ވެބް ޕޭޖްތައް އެކަނިއެވެ.",
"refused.workspace": "މިތަނުގައި ހުޅުވޭނީ ވެބް ޕޭޖްތަކާއި މި ސެޝަންގެ ވޯކްސްޕޭސްގެ ތެރޭގައިވާ ފައިލްތައް އެކަނިއެވެ.",
"refused.credentials": "ޔޫޒަރ ނަމެއް ނުވަތަ ޕާސްވޯޑެއް ހިމެނޭ އެޑްރެސްތައް މިތަނުގައި ނުހުޅުވޭނެއެވެ.",
- inspect: "ކޮމެންޓް ކުރާނެ އެލިމެންޓެއް ހޮވާ",
- "inspect.active": "ކޮމެންޓް ކުރުމަށް ޕޭޖުގައިވާ އެލިމެންޓަކަށް ކްލިކް ކުރާށެވެ. ކެންސަލް ކުރުމަށް Escape ފިއްތާށެވެ.",
- "comment.label": "މި އެލިމެންޓަށް ކޮމެންޓް ކުރާ",
"comment.placeholder": "ކޮމެންޓެއް އިތުރުކުރާ (އިޚްތިޔާރީ)...",
- "comment.cancel": "އެލިމެންޓް ކޮމެންޓް ކެންސަލް ކުރާ",
- "comment.submit": "އެލިމެންޓް ކޮމެންޓް އިތުރުކުރާ",
- "comment.attach": "އެލިމެންޓް އިތުރުކުރާ",
"comment.annotation": "ބްރައުޒަރ ނޯޓު",
"home.title": "ޕޭޖެއް ހުޅުވާ",
"home.description": "ތިބާގެ އެޕް ޕްރިވިއު ކުރާ، ޑޮކްސް ކިޔާ، ނުވަތަ ވެބް ބްރައުޒް ކުރާ.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "ކަނެކްޝަން ސަލާމަތެވެ",
"site.insecure": "ކަނެކްޝަން ސަލާމަތެއް ނޫނެވެ",
"site.insecure.description": "މި ޕޭޖުގައި ޕާސްވޯޑް ނުވަތަ އެހެން ޕްރައިވެޓް މަޢުލޫމާތު ނުލިޔުއްވާށެވެ.",
- "site.local": "ލޯކަލް ސަރވަރ",
- "site.local.description": "ލޯކަލް އެޑްރެސްތައް ހުޅުވޭނީ OpenCode ސަރވަރ ހިނގާ މެޝިނުގައެވެ.",
"site.file": "ވޯކްސްޕޭސް ފައިލް",
"site.file.description": "މިތަނުގައި ހުޅުވޭނީ މި ސެޝަންގެ ވޯކްސްޕޭސްގެ ތެރޭގައިވާ ފައިލްތައް އެކަނިއެވެ.",
- "site.network": "ޕޭޖްތައް ލޯޑްވަނީ {{server}} ގެ ނެޓްވޯކް މެދުވެރިކޮށެވެ.",
"site.cookies": "ކުކީޒް އަދި ސައިޓް ޑޭޓާ",
"site.cookies.count.one": "{{count}} ކުކީ ބޭނުންކުރަމުން",
"site.cookies.count.other": "{{count}} ކުކީ ބޭނުންކުރަމުން",
@@ -48,13 +32,7 @@ export default {
"site.permissions": "ހުއްދަތައް ބްލޮކްކޮށްފައި",
"site.permissions.description":
"މި ބްރައުޒަރުގައި ކެމެރާ، މައިކްރޮފޯން، ލޮކޭޝަން އަދި ނޮޓިފިކޭޝަންތައް މަސައްކަތެއް ނުކުރެއެވެ.",
- "site.agent": "އޭޖެންޓަށް މި ޕޭޖް ބޭނުންކުރެވޭނެ",
- "site.agent.description": "އެއަށް ޕޭޖް ކިޔުމާއި، ސްކްރިޕްޓް ހިންގުމާއި، ފޯމު ފުރުން ކުރެވޭނެއެވެ.",
"page.add": "ޕޭޖް ސެޝަނަށް އިތުރުކުރާ",
- "page.placeholder": "މި ޕޭޖާ ބެހޭ ކޮންޓެކްސްޓް އިތުރުކުރާ",
- "external.open": "ސިސްޓަމް ބްރައުޒަރުގައި ހުޅުވާ",
- "external.menu": "ބްރައުޒަރުގައި ހުޅުވާ",
- "external.unavailable": "މި އެޑްރެސް މަސައްކަތްކުރަނީ ސަރވަރގެ މެޝިނުގައި އެކަނިއެވެ.",
options: "ބްރައުޒަރ އޮޕްޝަންތައް",
"zoom.in": "ޒޫމް އިން",
"zoom.out": "ޒޫމް އައުޓް",
diff --git a/packages/gui-plugins/src/browser/i18n/dz.ts b/packages/gui-plugins/src/browser/i18n/dz.ts
index 32284417055f..e96571acf2e7 100644
--- a/packages/gui-plugins/src/browser/i18n/dz.ts
+++ b/packages/gui-plugins/src/browser/i18n/dz.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "བརའུ་ཟར་",
"address.label": "བརྡ་འཚོལ་ཁ་བྱང་",
"action.stop": "བཀག་པ",
- replaced: "བརའུ་ཟར་ཚད་འཛིན་འདི་ ཌེཀསི་ཊོཔ་སྒོ་སྒྲིག་གཞན་མི་ཅིག་ནང་ སྤོ་བཤུད་འབད་ཡི།",
unsupported: "ཌེཀསི་ཊོཔ་གློག་རིམ་འདི་གིས་ བརའུ་ཟར་པེན་ལུ་རྒྱབ་སྐྱོར་མི་འབད།",
- suspended: "བརའུ་ཟར་བཀག་བཞག་ཡོདཔ། ལོག་སྟེ་མཐུད་ནིའི་དོན་ལུ་ ལཱ་ཡུན་འདི་དང་གཅིག་ཁར་ འབྲེལ་བ་འཐབ།",
- "failed.title": "URL ལུ་ལྷོད་མི་ཚུགས།",
- "failed.description": "URL དང་ཁྱོད་ཀྱི་མཐུད་ལམ་ཞིབ་དཔྱད་འབད་དེ་ལོག་སྟེ་འབད།",
"action.reload": "ཡང་བསྐྱར་མངོན་གསལ།",
"model.timedOut": "བརའུ་ཟར་མངོན་གསལ་འབད་ནི་ལུ་ དུས་ཚོད་ཧ་ཅང་གིས་ཕུགས་སོང་།",
- "command.inspect": "བརའུ་ཟར་ཤོག་ལེབ་ནང་ ཆ་ཤས་ཅིག་སེལ་འཐུ་འབད།",
- "command.address": "བརའུ་ཟར་ཁ་བྱང་ལུ་ཆེད་དམིགས།",
"command.close": "བརའུ་ཟར་མཆོང་ལྡེ་ཁ་བསྡམས།",
"command.newTab": "བརའུ་ཟར་མཆོང་ལྡེ་གསརཔ།",
"tab.new": "མཆོང་ལྡེ་གསརཔ།",
- "address.search": "འཚོལ་ ཡང་ན་ URL ཅིག་བཙུགས།",
"address.suggestions": "བསམ་འཆར་ཚུ།",
"refused.web": "ནཱ་ལུ་ ཝེབ་ཤོག་ལེབ་རྐྱངམ་ཅིག་ ཁ་ཕྱེ་ཚུགས།",
"refused.workspace": "ནཱ་ལུ་ ཝེབ་ཤོག་ལེབ་དང་ ལཱ་ཡུན་འདི་གི་ལཱ་གི་ས་སྒོ་ནང་གི་ཡིག་སྣོད་རྐྱངམ་ཅིག་ ཁ་ཕྱེ་ཚུགས།",
"refused.credentials": "ལག་ལེན་པའི་མིང་ ཡང་ན་ ཆོག་ཡིག་ཡོད་པའི་ཁ་བྱང་ཚུ་ ནཱ་ལུ་ཁ་ཕྱེ་མི་ཚུགས།",
- inspect: "བསམ་འཆར་བཀོད་ནིའི་དོན་ལུ་ ཆ་ཤས་ཅིག་སེལ་འཐུ་འབད།",
- "inspect.active": "བསམ་འཆར་བཀོད་ནིའི་དོན་ལུ་ ཤོག་ལེབ་ནང་གི་ཆ་ཤས་ཅིག་ཨེབ་གཏང་། ཆ་མེད་གཏང་ནིའི་དོན་ལུ་ Escape ཨེབ།",
- "comment.label": "ཆ་ཤས་འདི་ལུ་ བསམ་འཆར་བཀོད།",
"comment.placeholder": "གདམ་ཁའི་བསམ་འཆར་ཅིག་ཁ་སྐོང་རྐྱབས...",
- "comment.cancel": "ཆ་ཤས་ཀྱི་བསམ་འཆར་ཆ་མེད་གཏང་།",
- "comment.submit": "ཆ་ཤས་ཀྱི་བསམ་འཆར་ཁ་སྐོང་།",
- "comment.attach": "ཆ་ཤས་ཁ་སྐོང་།",
"comment.annotation": "བརའུ་ཟར་མཆན་འགྲེལ།",
"home.title": "ཤོག་ལེབ་ཅིག་ཁ་ཕྱེ།",
"home.description": "ཁྱོད་ཀྱི་གློག་རིམ་སྔོན་ལྟ་འབད་ ཡིག་ཆ་ལྷག་ ཡང་ན་ ཝེབ་བལྟ།",
@@ -36,24 +23,15 @@ export default {
"site.secure": "མཐུད་ལམ་ཉེན་སྲུང་ཅན་ཨིན།",
"site.insecure": "མཐུད་ལམ་ཉེན་སྲུང་ཅན་མེན།",
"site.insecure.description": "ཤོག་ལེབ་འདི་གུ་ ཆོག་ཡིག་ ཡང་ན་ སྒེར་གྱི་བརྡ་དོན་གཞན་ཚུ་ མ་བཙུགས།",
- "site.local": "ཉེ་གནས་སར་བར།",
- "site.local.description": "ཉེ་གནས་ཁ་བྱང་ཚུ་ OpenCode སར་བར་གཡོག་བཀོལ་མི་འཕྲུལ་ཆས་གུ་ ཁ་ཕྱེཝ་ཨིན།",
"site.file": "ལཱ་གི་ས་སྒོའི་ཡིག་སྣོད།",
"site.file.description": "ནཱ་ལུ་ ལཱ་ཡུན་འདི་གི་ལཱ་གི་ས་སྒོ་ནང་གི་ཡིག་སྣོད་རྐྱངམ་ཅིག་ ཁ་ཕྱེ་ཚུགས།",
- "site.network": "ཤོག་ལེབ་ཚུ་ {{server}} གི་ཡོངས་འབྲེལ་བརྒྱུད་དེ་ མངོན་གསལ་འབདཝ་ཨིན།",
"site.cookies": "ཀུ་ཀི་དང་ ཝེབ་ས་ཁོངས་ཀྱི་གནད་སྡུད།",
"site.cookies.count.one": "ཀུ་ཀི་ {{count}} ལག་ལེན་འཐབ་དོ།",
"site.cookies.count.other": "ཀུ་ཀི་ {{count}} ལག་ལེན་འཐབ་དོ།",
"site.cookies.clear": "བསལ།",
"site.permissions": "གནང་བ་ཚུ་ བཀག་ཡོདཔ།",
"site.permissions.description": "པར་ཆས་དང་ སྒྲ་དུང་ ས་གནས་ བརྡ་བསྐུལ་ཚུ་ བརའུ་ཟར་འདི་ནང་ ལཱ་མི་འབད།",
- "site.agent": "ལས་ཚབ་ཀྱིས་ ཤོག་ལེབ་འདི་ལག་ལེན་འཐབ་ཚུགས།",
- "site.agent.description": "དེ་གིས་ ཤོག་ལེབ་ལྷག་ནི་དང་ ཡིག་ཚུགས་གཡོག་བཀོལ་ནི་ འབྲི་ཤོག་བཀང་ནི་ཚུ་ འབད་ཚུགས།",
"page.add": "ཤོག་ལེབ་འདི་ ལཱ་ཡུན་ལུ་ཁ་སྐོང་།",
- "page.placeholder": "ཤོག་ལེབ་འདི་གི་སྐོར་ལས་ སྐབས་དོན་ཁ་སྐོང་རྐྱབས།",
- "external.open": "རིམ་ལུགས་བརའུ་ཟར་ནང་ཁ་ཕྱེ།",
- "external.menu": "བརའུ་ཟར་ནང་ཁ་ཕྱེ།",
- "external.unavailable": "ཁ་བྱང་འདི་ སར་བར་གྱི་འཕྲུལ་ཆས་གུ་རྐྱངམ་ཅིག་ ལཱ་འབདཝ་ཨིན།",
options: "བརའུ་ཟར་གདམ་ཁ་ཚུ།",
"zoom.in": "ཕྱིར་རྒྱས།",
"zoom.out": "ནང་ན་ཟུམ།",
diff --git a/packages/gui-plugins/src/browser/i18n/el.ts b/packages/gui-plugins/src/browser/i18n/el.ts
index 2b571c0e981d..68d49aef0966 100644
--- a/packages/gui-plugins/src/browser/i18n/el.ts
+++ b/packages/gui-plugins/src/browser/i18n/el.ts
@@ -4,31 +4,18 @@ export default {
"tab.title": "Πρόγραμμα περιήγησης",
"address.label": "Διεύθυνση προγράμματος περιήγησης",
"action.stop": "Διακοπή",
- replaced: "Ο έλεγχος του προγράμματος περιήγησης μετακινήθηκε σε άλλο παράθυρο επιφάνειας εργασίας.",
unsupported: "Αυτή η εφαρμογή επιφάνειας εργασίας δεν υποστηρίζει το παράθυρο του προγράμματος περιήγησης.",
- suspended: "Το πρόγραμμα περιήγησης σε αναστολή. Αλληλεπιδράστε με αυτήν την περίοδο σύνδεσης για επανασύνδεση.",
- "failed.title": "Δεν είναι δυνατή η πρόσβαση στο URL",
- "failed.description": "Ελέγξτε το URL και τη σύνδεσή σας και δοκιμάστε ξανά.",
"action.reload": "Επαναφόρτωση",
"model.timedOut": "Το πρόγραμμα περιήγησης άργησε πολύ να φορτώσει",
- "command.inspect": "Επιλογή στοιχείου στη σελίδα του προγράμματος περιήγησης",
- "command.address": "Εστίαση στη διεύθυνση του προγράμματος περιήγησης",
"command.close": "Κλείσιμο καρτέλας προγράμματος περιήγησης",
"command.newTab": "Νέα καρτέλα προγράμματος περιήγησης",
"tab.new": "Νέα καρτέλα",
- "address.search": "Αναζήτηση ή εισαγωγή URL",
"address.suggestions": "Προτάσεις",
"refused.web": "Μόνο ιστοσελίδες μπορούν να ανοίξουν εδώ.",
"refused.workspace":
"Μόνο ιστοσελίδες και αρχεία μέσα στον χώρο εργασίας αυτής της συνεδρίας μπορούν να ανοίξουν εδώ.",
"refused.credentials": "Διευθύνσεις με όνομα χρήστη ή κωδικό πρόσβασης δεν μπορούν να ανοίξουν εδώ.",
- inspect: "Επιλέξτε στοιχείο για σχολιασμό",
- "inspect.active": "Κάντε κλικ σε ένα στοιχείο της σελίδας για να το σχολιάσετε. Πατήστε Escape για ακύρωση.",
- "comment.label": "Σχολιασμός αυτού του στοιχείου",
"comment.placeholder": "Προσθέστε προαιρετικό σχόλιο...",
- "comment.cancel": "Ακύρωση σχολίου στοιχείου",
- "comment.submit": "Προσθήκη σχολίου στοιχείου",
- "comment.attach": "Προσθήκη στοιχείου",
"comment.annotation": "Σημείωση προγράμματος περιήγησης",
"home.title": "Άνοιγμα σελίδας",
"home.description": "Προεπισκόπηση της εφαρμογής σας, ανάγνωση τεκμηρίωσης ή περιήγηση στον ιστό.",
@@ -37,11 +24,8 @@ export default {
"site.secure": "Η σύνδεση είναι ασφαλής",
"site.insecure": "Η σύνδεση δεν είναι ασφαλής",
"site.insecure.description": "Μην εισάγετε κωδικούς πρόσβασης ή άλλα προσωπικά στοιχεία σε αυτήν τη σελίδα.",
- "site.local": "Τοπικός διακομιστής",
- "site.local.description": "Οι τοπικές διευθύνσεις ανοίγουν στο μηχάνημα που εκτελεί τον διακομιστή OpenCode.",
"site.file": "Αρχείο χώρου εργασίας",
"site.file.description": "Μόνο αρχεία μέσα στον χώρο εργασίας αυτής της συνεδρίας μπορούν να ανοίξουν εδώ.",
- "site.network": "Οι σελίδες φορτώνονται μέσω του δικτύου του {{server}}.",
"site.cookies": "Cookie και δεδομένα ιστοτόπου",
"site.cookies.count.one": "{{count}} cookie σε χρήση",
"site.cookies.count.other": "{{count}} cookie σε χρήση",
@@ -49,13 +33,7 @@ export default {
"site.permissions": "Τα δικαιώματα είναι αποκλεισμένα",
"site.permissions.description":
"Η κάμερα, το μικρόφωνο, η τοποθεσία και οι ειδοποιήσεις δεν λειτουργούν σε αυτό το πρόγραμμα περιήγησης.",
- "site.agent": "Ο πράκτορας μπορεί να χρησιμοποιήσει αυτήν τη σελίδα",
- "site.agent.description": "Μπορεί να διαβάσει τη σελίδα, να εκτελέσει σενάρια και να συμπληρώσει φόρμες.",
"page.add": "Προσθήκη σελίδας στη συνεδρία",
- "page.placeholder": "Προσθέστε περιβάλλον για αυτήν τη σελίδα",
- "external.open": "Άνοιγμα στο πρόγραμμα περιήγησης του συστήματος",
- "external.menu": "Άνοιγμα στο πρόγραμμα περιήγησης",
- "external.unavailable": "Αυτή η διεύθυνση λειτουργεί μόνο στο μηχάνημα του διακομιστή.",
options: "Επιλογές προγράμματος περιήγησης",
"zoom.in": "Μεγέθυνση",
"zoom.out": "Σμίκρυνση",
diff --git a/packages/gui-plugins/src/browser/i18n/en.ts b/packages/gui-plugins/src/browser/i18n/en.ts
index b33085d6a271..8f4706531a8e 100644
--- a/packages/gui-plugins/src/browser/i18n/en.ts
+++ b/packages/gui-plugins/src/browser/i18n/en.ts
@@ -1,59 +1,72 @@
+import { FileVerificationError } from "@opencode/util/file-verification"
+
export default {
+ "external.reveal": "Show file in folder",
"model.timedOut": "The browser took too long to load",
"command.open": "Open browser",
"command.reload": "Reload browser page",
- "command.inspect": "Select an element in the browser page",
- "command.address": "Focus browser address",
+ "command.inspect": "Comment on part of the browser page",
+ "command.address": "Go to the browser's address bar",
"command.close": "Close browser tab",
"command.newTab": "New browser tab",
+ "find.open": "Find in page",
+ "find.previous": "Previous match",
+ "find.next": "Next match",
+ "find.close": "Close find bar",
+ "find.matches.one": "{{active}} of {{count}}",
+ "find.matches.other": "{{active}} of {{count}}",
"tab.title": "Browser",
"tab.new": "New tab",
"address.label": "Browser address",
- "address.search": "Search or enter a URL",
+ "address.search": "Search or enter address",
"address.suggestions": "Suggestions",
"refused.web": "Only web pages can open here.",
+ "refused.scheme": "This link opens another app:",
+ "notice.conversation": "From the conversation",
+ "notice.page": "From this page",
+ "notice.site": "From the tab at {{site}}",
+ "link.unavailable": "The browser isn't available right now. This link was not opened.",
+ "refused.dismiss": "Dismiss notice",
"refused.workspace": "Only web pages and files inside this session's workspace can open here.",
"refused.credentials": "Addresses with a user name or password can't open here.",
- inspect: "Select an element to comment on",
- "inspect.active": "Click an element in the page to comment on it. Press Escape to cancel.",
- "comment.label": "Comment on this element",
+ inspect: "Comment on part of the page",
+ "inspect.active": "Click part of the page to comment on it. Press Escape to cancel.",
+ "comment.label": "Comment on this part of the page",
"comment.placeholder": "Add an optional comment...",
- "comment.cancel": "Cancel element comment",
- "comment.submit": "Add element comment",
- "comment.attach": "Add element",
+ "comment.cancel": "Cancel comment",
+ "comment.submit": "Add comment",
+ "comment.attach": "Add to session",
"comment.annotation": "Browser annotation",
"action.stop": "Stop",
- replaced: "Browser control moved to another desktop window.",
+ replaced: "This browser is now open in another OpenCode window.",
unsupported: "This desktop app does not support the browser pane.",
- suspended: "Browser suspended. Interact with this session to reconnect.",
+ suspended: "The browser is paused. Click anywhere to bring it back.",
"home.title": "Open a page",
"home.description": "Preview your app, read docs, or browse the web.",
"home.recent": "Recent",
- "failed.title": "URL can't be reached",
- "failed.description": "Check the URL and your connection, then try again.",
"action.reload": "Reload",
"site.info": "Site information",
"site.secure": "Connection is secure",
"site.insecure": "Connection is not secure",
"site.insecure.description": "Don't enter passwords or other private information on this page.",
- "site.local": "Local server",
- "site.local.description": "Local addresses open on the machine that runs the OpenCode server.",
+ "site.local": "Local address",
+ "site.local.description": "This page comes from the computer that runs the OpenCode server, not from the internet.",
"site.file": "Workspace file",
"site.file.description": "Only files inside this session's workspace can open here.",
- "site.network": "Pages load through the network of {{server}}.",
+ "site.network": "Pages load over the internet connection of {{server}}.",
"site.cookies": "Cookies and site data",
"site.cookies.count.one": "{{count}} cookie in use",
"site.cookies.count.other": "{{count}} cookies in use",
"site.cookies.clear": "Clear",
- "site.permissions": "Permissions are blocked",
- "site.permissions.description": "Camera, microphone, location, and notifications don't work in this browser.",
- "site.agent": "Agent can use this page",
- "site.agent.description": "It can read the page, run scripts, and fill in forms.",
+ "site.permissions": "Permissions",
+ "site.permissions.description":
+ "Sites ask before they use your camera, microphone, location, notifications, or clipboard. Change saved answers in Browser settings.",
+ "site.agent": "Agents you allow can use this page",
+ "site.agent.description":
+ "They can read the page, fill in forms, and run code on it. The browser permission decides which agents can.",
"page.add": "Add page to session",
- "page.placeholder": "Add context about this page",
- "external.open": "Open in system browser",
- "external.menu": "Open in browser",
- "external.unavailable": "This address only works on the server's machine.",
+ "page.placeholder": "Add a note about this page",
+ "external.open": "Open in default browser",
options: "Browser options",
"zoom.in": "Zoom in",
"zoom.out": "Zoom out",
@@ -61,4 +74,346 @@ export default {
"zoom.percent": "{{percent}}%",
"link.copy": "Copy link",
"history.clear": "Clear history",
+ "extensions.menu": "Extensions",
+ "extensions.manage": "Manage extensions",
+ "extensions.added": "Added {{name}}.",
+ "extensions.added.partial": "Added {{name}}. Some of its features don't work here.",
+ "extensions.added.unsupported": "Added {{name}}. It probably won't work here.",
+ "extensions.unsupported": "{{name}} probably won't work here.",
+ "extensions.review": "{{name}} can do the following. Add it only if you trust it.",
+ "extensions.access.title": "It can:",
+ "extensions.access.allSites": "Read and change every page you visit",
+ "extensions.access.someSites": "Read and change pages on some sites",
+ "extensions.access.cookies": "See and change your sign-ins",
+ "extensions.access.activity": "See which pages you visit",
+ "extensions.access.clipboard": "Read what you copy",
+ "extensions.compat.partial": "Some features don't work here",
+ "extensions.compat.unsupported": "Probably won't work here",
+ "extensions.compat.cause.startup": "It needs browser features that are missing here, so it likely stops as soon as it starts.",
+ "extensions.compat.missing": "Doesn't work here:",
+ "extensions.compat.feature.network": "Watching what pages load",
+ "extensions.compat.feature.shortcuts": "Keyboard shortcuts",
+ "extensions.compat.feature.native": "Connecting to an app on your computer",
+ "extensions.compat.feature.pageSync": "Its features in web pages, which read synced settings",
+ "extensions.compat.feature.signin": "Signing in with a browser account",
+ "extensions.compat.feature.sidePanel": "Side panel",
+ "extensions.compat.feature.browserData": "History, bookmarks, and downloads",
+ "extensions.compat.feature.settings": "Changing browser settings",
+ "extensions.compat.feature.addressBar": "Shortcuts in the address bar",
+ "extensions.compat.feature.newTab": "Replacing the new tab page",
+ "extensions.compat.feature.devtools": "Developer tools panel",
+ "extensions.compat.feature.access": "Asking for more access",
+ "extensions.compat.feature.userScripts": "Running your own scripts",
+ "extensions.compat.feature.other": "Other browser features",
+ "extensions.failed.manifest": "This is not a supported extension.",
+ "extensions.failed.download": "The store did not provide this extension. Check the link.",
+ "extensions.failed.load": "The extension could not load: {{message}}",
+ "signins.title": "Bring your sign-ins",
+ "signins.description": "Copy your sign-ins from a browser on this computer, so sites such as GitHub open already signed in.",
+ "signins.bar": "Already signed in somewhere else? Bring your sign-ins here.",
+ "signins.import": "Import from {{browser}}",
+ "signins.action": "Import",
+ "signins.other": "Import from another browser",
+ "signins.more": "More import options",
+ "signins.choose": "Choose sites to import",
+ "signins.dismiss": "Not now",
+ "signins.imported.one": "Imported {{count}} cookie.",
+ "signins.imported.other": "Imported {{count}} cookies.",
+ "signins.imported.incomplete.one": "Imported {{count}} cookie. Not imported: {{omitted}}.",
+ "signins.imported.incomplete.other": "Imported {{count}} cookies. Not imported: {{omitted}}.",
+ "signins.imported.from.one": "Imported {{count}} cookie from {{browser}}",
+ "signins.imported.from.other": "Imported {{count}} cookies from {{browser}}",
+ "signins.imported.partial.one":
+ "Imported {{count}} cookie. This browser keeps {{protected}} more locked so that only it can read them. Sign in to those sites here.",
+ "signins.imported.partial.other":
+ "Imported {{count}} cookies. This browser keeps {{protected}} more locked so that only it can read them. Sign in to those sites here.",
+ "signins.imported.partial.named.one":
+ "Imported {{count}} cookie. {{browser}} keeps {{protected}} more locked so that only it can read them. Sign in to those sites here.",
+ "signins.imported.partial.named.other":
+ "Imported {{count}} cookies. {{browser}} keeps {{protected}} more locked so that only it can read them. Sign in to those sites here.",
+ "signins.protected":
+ "This browser keeps its sign-ins locked so that only it can read them. Sign in to your sites here.",
+ "signins.protected.named":
+ "{{browser}} keeps its sign-ins locked so that only it can read them. Sign in to your sites here.",
+ "signins.failed.key": "Your system did not unlock this browser's sign-ins. Allow access when your system asks, then try again.",
+ "signins.failed.access": "Your system denied access. On macOS, give OpenCode Full Disk Access to import from Safari.",
+ "signins.failed.locked": "This browser keeps its cookies locked while it runs. Quit it, then import again.",
+ "signins.failed.locked.named":
+ "{{browser}} keeps its cookies locked while it runs. Quit {{browser}}, then import again.",
+ "signins.failed.read": "This browser's data could not be read. Close the browser and try again.",
+ "signins.failed.format": "This file is not a cookie export.",
+ "signins.failed.storage": "OpenCode cannot save sign-ins on this computer, so nothing was imported.",
+ "signins.keychain":
+ 'macOS asks for your password so OpenCode can read the key to {{browser}}\'s cookies. The request names "security", a macOS tool OpenCode uses for this. Choose Allow. Do not choose Always Allow: it lets any app on this Mac read the key without asking.',
+ "signins.failed.keychain":
+ "macOS did not give OpenCode the key to {{browser}}'s cookies. Import again and choose Allow when macOS asks. Do not choose Always Allow.",
+ "signins.unsaved":
+ "OpenCode cannot save sign-ins: the system did not give it the key that protects them. Sign-ins made here end when OpenCode quits, so importing is off.",
+ "signins.unsaved.mac":
+ "OpenCode cannot save sign-ins: macOS did not give it its Keychain key. Sign-ins made here end when OpenCode quits, so importing is off. Quit OpenCode, open it again, and choose Allow when macOS asks.",
+ "settings.title": "Browser",
+ "settings.open": "Browser settings",
+ "settings.unavailable": "The browser is available in the desktop app.",
+ "settings.links.title": "Open links in OpenCode's browser",
+ "settings.links.description":
+ "Web links in a session open next to the conversation. To use your default browser, hold Shift while you click.",
+ "settings.remote.title": "Share sign-ins with remote servers",
+ "settings.remote.description":
+ "Remote servers can use your sign-ins: their pages open signed in to your sites, and those sites can change your sign-ins on this device. Turn this on only for servers you trust.",
+ "settings.import.title": "Import sign-ins",
+ "settings.import.note": "Copies cookies only. The other browser keeps its own.",
+ "settings.import.none": "No other browser found on this computer",
+ "settings.import.choose": "Choose sites",
+ "sites.description": "Brings the sign-ins of only the sites you select.",
+ "sites.profile": "Browser profile",
+ "sites.search": "Search sites",
+ "sites.list": "Sites",
+ "sites.selected": "{{selected}} of {{total}} selected",
+ "sites.selected.shown": "{{shown}} shown, {{selected}} selected",
+ "sites.order.recent": "The sites used most recently come first.",
+ "sites.order.name": "The sites are in alphabetical order.",
+ "sites.missing": "No sign-in for {{site}} was found in {{browser}}.",
+ "sites.all": "Select all",
+ "sites.none": "Select none",
+ "sites.all.shown": "Select {{count}} shown",
+ "sites.none.shown": "Deselect {{count}} shown",
+ "sites.cookies.one": "{{number}} cookie",
+ "sites.cookies.other": "{{number}} cookies",
+ "sites.loading": "Reading the sites in {{browser}}…",
+ "sites.empty": "This profile has no sites to import.",
+ "sites.unmatched": "No site matches your search.",
+ "settings.import.file.title": "Import a cookie file",
+ "settings.import.file.description": "A cookies.txt file, or a JSON export from a cookie extension or Playwright.",
+ "settings.import.file.action": "Choose file",
+ "settings.import.file.pick": "Choose a cookie file",
+ "settings.extensions.title": "Extensions",
+ "settings.extensions.note": "Some extensions may not work here yet.",
+ "settings.extensions.add.title": "Add an extension",
+ "settings.extensions.add.description": "From the Chrome Web Store or Edge Add-ons, or one your other browsers already have.",
+ "settings.extensions.add.action": "Add extension",
+ "settings.extensions.dialog.description": "Extensions run in every page of this browser.",
+ "settings.extensions.store.label": "Link to the extension",
+ "settings.extensions.store.placeholder": "Paste a link from the Chrome Web Store or Edge Add-ons",
+ "settings.extensions.add": "Add",
+ "settings.extensions.anyway": "Add anyway",
+ "settings.extensions.added": "Added",
+ "settings.extensions.browser.title": "From your browsers",
+ "settings.extensions.browser.select": "Browser profile",
+ "settings.extensions.browser.empty": "This browser has no extensions",
+ "settings.extensions.folder.action": "Add from a folder",
+ "settings.extensions.folder.pick": "Choose an extension folder",
+ "settings.extensions.done": "Done",
+ "settings.extensions.remove": "Remove {{name}}",
+ "settings.extensions.enable": "Turn on {{name}}",
+ "settings.data.title": "Site data",
+ "settings.cookies.title": "Cookies and site data",
+ "settings.cookies.count.one": "{{count}} cookie. Every session uses the same sign-ins.",
+ "settings.cookies.count.other": "{{count}} cookies. Every session uses the same sign-ins.",
+ "settings.cookies.clear": "Sign out everywhere",
+ "settings.cleared": "Signed out everywhere.",
+ "menu.back": "Back",
+ "menu.forward": "Forward",
+ "menu.reload": "Reload",
+ "menu.hardReload": "Reload without saved files",
+ "site.clearCache": "Clear saved files for this site",
+ "menu.openLink": "Open link in new tab",
+ "menu.external": "Open link in default browser",
+ "menu.openPage": "Open in default browser",
+ "menu.pageUnavailable": "This page can't open in your default browser",
+ "menu.privateAddress": "This address only works in OpenCode's browser.",
+ "settings.agentPages.title": "Open the browser when the agent shows a page",
+ "settings.agentPages.description": "When the agent wants to show you a page or a file, the browser opens if it is closed. A file it shows you comes to the front. A web page never switches you away from the tab you are on.",
+ "tab.activity": "The agent used this tab",
+ "menu.failed": "Couldn't open this page in your default browser.",
+ "menu.copyLink": "Copy link address",
+ "menu.openImage": "Open image in new tab",
+ "menu.saveImage": "Save image as…",
+ "menu.copyImage": "Copy image",
+ "menu.copyImageAddress": "Copy image address",
+ "menu.cut": "Cut",
+ "menu.copy": "Copy",
+ "menu.paste": "Paste",
+ "menu.pastePlain": "Paste as plain text",
+ "menu.selectAll": "Select all",
+ "menu.addWord": "Add to dictionary",
+ "menu.spellcheck": "Check spelling",
+ "menu.languages": "Spellcheck languages",
+ "refused.popup": "Pop-up blocked",
+ "refused.open": "Open",
+ "refused.passkey": "Passkeys and security keys don't work here yet. Sign in another way, or bring your sign-in from another browser.",
+ "refused.passkey.off": "Passkeys are off in this tab because the agent used it. They work in a new tab.",
+ "refused.passkey.import": "Import sign-in",
+ "refused.passkey.newTab": "Open in new tab",
+ "preview.source": "Show the file's code",
+ "preview.verificationUnavailable": FileVerificationError.description,
+ "preview.workspace": "File on the server",
+ "preview.offline": "The server is disconnected. Reconnect to see this preview.",
+ "artifact.unavailable": "The artifact cannot be opened right now. Check the server connection and try again.",
+ "preview.upgrade": "Update this session's server to open workspace previews, then reload this tab.",
+ "preview.restricted": "This page tried to load files it is not allowed to read.",
+ "preview.agentRestricted": "The agent is using this preview, so it can only load files that are already allowed. Other files are blocked without asking you.",
+ "prompt.waiting.one": "{{count}} more waiting",
+ "prompt.waiting.other": "{{count}} more waiting",
+ "prompt.tab": "Waiting for you",
+ "prompt.ok": "OK",
+ "prompt.cancel": "Cancel",
+ "prompt.dismiss": "Not now",
+ "prompt.value": "Your answer",
+ "prompt.site.web": "{{host}} says",
+ "prompt.site.embedded": "An embedded page at {{host}} says",
+ "prompt.site.file": "This file says",
+ "prompt.site.page": "This page says",
+ "prompt.site.embedded.page": "An embedded page says",
+ "prompt.stop": "Stop this page from showing more messages",
+ "prompt.leave.title": "Leave site?",
+ "prompt.leave.description": "Changes you made may not be saved.",
+ "prompt.leave.leave": "Leave",
+ "prompt.leave.stay": "Stay",
+ "prompt.auth.title": "Sign in to {{host}}",
+ "prompt.auth.realm": "The site says: “{{realm}}”",
+ "prompt.auth.failed": "The site did not accept that user name and password.",
+ "prompt.auth.username": "User name",
+ "prompt.auth.password": "Password",
+ "prompt.auth.submit": "Sign in",
+ "prompt.permission.label": "Site permission request",
+ "prompt.permission.web.camera": "{{host}} wants to use your camera.",
+ "prompt.permission.web.microphone": "{{host}} wants to use your microphone.",
+ "prompt.permission.web.camera-microphone": "{{host}} wants to use your camera and microphone.",
+ "prompt.permission.web.location": "{{host}} wants to know your location.",
+ "prompt.permission.web.notifications": "{{host}} wants to show notifications.",
+ "prompt.permission.web.clipboard-read": "{{host}} wants to see text and images you copy.",
+ "prompt.permission.file.camera": "This file wants to use your camera.",
+ "prompt.permission.file.microphone": "This file wants to use your microphone.",
+ "prompt.permission.file.camera-microphone": "This file wants to use your camera and microphone.",
+ "prompt.permission.file.location": "This file wants to know your location.",
+ "prompt.permission.file.notifications": "This file wants to show notifications.",
+ "prompt.permission.file.clipboard-read": "This file wants to see text and images you copy.",
+ "prompt.permission.never": "Never allow",
+ "prompt.permission.block": "Block",
+ "prompt.permission.once": "Allow this time",
+ "prompt.permission.always": "Always allow",
+ "prompt.permission.session": "Allow until you quit OpenCode",
+ "prompt.permission.agent": "The agent is working in this tab. Your answer applies this one time.",
+ "prompt.permission.system": "If you allow this, macOS then asks whether OpenCode may use it.",
+ "prompt.system.camera.win32":
+ "Windows blocks the camera for apps. Turn on camera access in Settings > Privacy & security > Camera.",
+ "prompt.system.microphone.win32":
+ "Windows blocks the microphone for apps. Turn on microphone access in Settings > Privacy & security > Microphone.",
+ "prompt.system.camera.darwin":
+ "macOS blocks the camera for OpenCode. Turn it on in System Settings > Privacy & Security > Camera.",
+ "prompt.system.microphone.darwin":
+ "macOS blocks the microphone for OpenCode. Turn it on in System Settings > Privacy & Security > Microphone.",
+ "prompt.system.camera.other": "The system did not let OpenCode use the camera.",
+ "prompt.system.microphone.other": "The system did not let OpenCode use the microphone.",
+ "settings.sites.title": "Site permissions",
+ "settings.sites.note": "Your saved answers apply in the tabs you use yourself. Sites ask again in tabs the agent works in and in tabs of remote servers. Signing out everywhere keeps these answers.",
+ "settings.sites.none": "No saved site permissions",
+ "settings.sites.allow": "Allowed",
+ "settings.sites.block": "Blocked",
+ "settings.sites.setting": "{{permission}} on {{site}}",
+ "settings.sites.remove": "Forget {{permission}} on {{site}}",
+ "settings.sites.permission.camera": "Camera",
+ "settings.sites.permission.microphone": "Microphone",
+ "settings.sites.permission.location": "Location",
+ "settings.sites.permission.notifications": "Notifications",
+ "settings.sites.permission.clipboard-read": "Clipboard",
+ "extensions.failed.collision": "This extension clashes with one you already added. Nothing was replaced.",
+ "settings.extensions.changed": "This extension changed since you reviewed it. Add it again to review it before it runs.",
+ "settings.extensions.replaces": "Replaces the installed copy of {{name}} and keeps its data.",
+ "extensions.failed.expired": "This review is no longer current. Add the extension again to review it.",
+ "extensions.notification.title": "Extension: {{name}}",
+ "review.source.chrome": "From the Chrome Web Store, exactly as the store published it.",
+ "review.source.edge": "From Edge Add-ons, exactly as the store published it.",
+ "review.source.browser": "Copied from another browser. No store checked this copy.",
+ "review.source.folder": "From a folder on this computer. No store checked this copy.",
+ "review.profile": "{{source}} ({{profile}})",
+ "review.sites": "On these sites:",
+ "review.allSites": "On all websites",
+ "review.changeSites": "Read and change the pages you visit",
+ "review.new": "It now also wants to:",
+ "review.moreSites": "Read and change more pages",
+ "review.morePermissions": "Use more browser features",
+ "review.more.one": "and {{count}} more",
+ "review.more.other": "and {{count}} more",
+ "review.less": "Show fewer",
+ "review.details": "Details",
+ "review.id": "Extension ID",
+ "review.origin": "Source",
+ "review.patterns": "Site patterns",
+ "review.permissions": "Browser permissions",
+ "review.partial": "May not fully work here",
+ "review.noSites": "Doesn't ask to read any website",
+ "review.otherSites": "See the list of sites below",
+ "artifact.missing": "This artifact is not available on this session’s server.",
+ "restore.outside": "This file is now outside the session’s workspace. Open a file in the current workspace instead.",
+ "restore.refused": "This saved address is no longer allowed in this session.",
+ "failed.unreachable.title": "This site can't be reached",
+ "failed.unreachable.description": "Check the address for typing mistakes. If it is right, the site may be down.",
+ "failed.offline.title": "You're offline",
+ "failed.offline.description": "Check your internet connection, then reload.",
+ "failed.slow.title": "This site took too long to respond",
+ "failed.slow.description": "It may be busy. Wait a moment, then reload.",
+ "failed.insecure.title": "This connection isn't secure",
+ "failed.insecure.description": "The site's security certificate could not be checked, so the page was not opened. This keeps your information safe.",
+ "failed.redirects.title": "This site redirected too many times",
+ "failed.redirects.description": "The site kept sending you somewhere else. Try again later.",
+ "failed.blocked.title": "This page was blocked",
+ "failed.blocked.description": "OpenCode or one of your extensions stopped this page from loading.",
+ "failed.crashed.title": "This page stopped working",
+ "failed.crashed.description": "Reload to open it again.",
+ "failed.generic.title": "This page couldn't load",
+ "failed.generic.description": "Reload to try again.",
+ "failed.unavailable.title": "This page can't be shown",
+ "failed.command.open": "Couldn't open that page.",
+ "failed.command.newTab": "Couldn't open a new tab.",
+ "failed.command.reload": "Couldn't reload this page.",
+ "failed.command.back": "Couldn't go back.",
+ "failed.command.forward": "Couldn't go forward.",
+ "failed.command.stop": "Couldn't stop this page. Try again.",
+ "failed.command.close": "Couldn't close this tab. Try again.",
+ "failed.command.focus": "Couldn't switch to that tab. Try again.",
+ "failed.command.other": "Something went wrong in the browser. Try again.",
+ "failed.command.description": "The problem is in OpenCode, not on the site.",
+ "menu.actionFailed": "Couldn't do that. Try again.",
+ "download.failed": "Couldn't save this download. Try again.",
+ "find.failed": "Couldn't search this page. Try again.",
+ "prompt.failed": "Couldn't send your answer. Try again.",
+ "link.copyFailed": "Couldn't copy the link.",
+ "link.failed": "Couldn't open this link. Try again.",
+ "site.clearFailed": "Couldn't clear this site's data. Try again.",
+ "site.cookies.failed": "Couldn't read this site's cookies.",
+ "site.clearCache.description": "You stay signed in.",
+ "refused.failed": "Couldn't do that. Try again.",
+ "model.failed": "The browser couldn't open",
+ "settings.sites.failed": "Couldn't save this change. Try again.",
+ "settings.failed.import": "Couldn't import. Try again.",
+ "settings.failed.install": "Couldn't add this extension. Try again.",
+ "settings.failed.extension": "Couldn't change this extension. Try again.",
+ "settings.failed.clear": "Couldn't sign out. Try again.",
+ "sites.failed": "Couldn't read the sites in this browser.",
+ "settings.developers": "For developers",
+ "site.settings": "Site settings",
+ "site.back": "Back",
+ "import.all": "Import all",
+ "import.some.one": "Import {{number}} site",
+ "import.some.other": "Import {{number}} sites",
+ "import.description.one": "Brings your sign-in for {{number}} site. Copies cookies only. The other browser keeps its own.",
+ "import.description.other": "Brings your sign-ins for all {{number}} sites. Copies cookies only. The other browser keeps its own.",
+ "import.description.loading": "Brings all your sign-ins. Copies cookies only. The other browser keeps its own.",
+ "settings.import.open": "Import…",
+ "settings.advanced": "Advanced",
+ "settings.advanced.summary": "Remote servers, site permissions, sign out, cookie file",
+ "review.works": "Works here",
+ "review.summary.allSites": "Can read and change the pages you visit.",
+ "review.summary.someSites": "Can read and change pages on some sites.",
+ "review.summary.cookies": "Can see and change your sign-ins.",
+ "review.summary.activity": "Can see which pages you visit.",
+ "review.summary.clipboard": "Can read what you copy.",
+ "review.summary.none": "Doesn't ask to read your pages.",
+ "review.summary.more": "It can do more: see Details.",
+ "menu.more": "More tools",
+ "zoom.label": "Zoom",
+ "site.secure.description": "Information you send to this site stays private.",
+ "site.cache": "Saved files",
+ "settings.extensions.folder.description": "Load an extension you are building from its folder.",
}
diff --git a/packages/gui-plugins/src/browser/i18n/es.ts b/packages/gui-plugins/src/browser/i18n/es.ts
index 543ca9cabfcf..7c85b4564c51 100644
--- a/packages/gui-plugins/src/browser/i18n/es.ts
+++ b/packages/gui-plugins/src/browser/i18n/es.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Navegador",
"address.label": "dirección del navegador",
"action.stop": "Detener",
- replaced: "El control del navegador se movió a otra ventana del escritorio.",
unsupported: "Esta aplicación de escritorio no admite el panel del navegador.",
- suspended: "Navegador suspendido. Interactúa con esta sesión para volver a conectarte.",
- "failed.title": "No se puede acceder a la URL",
- "failed.description": "Comprueba la URL y la conexión e inténtalo de nuevo.",
"action.reload": "Volver a cargar",
"model.timedOut": "El navegador tardó demasiado en cargar",
- "command.inspect": "Seleccionar un elemento en la página del navegador",
- "command.address": "Enfocar la dirección del navegador",
"command.close": "Cerrar pestaña del navegador",
"command.newTab": "Nueva pestaña del navegador",
"tab.new": "Nueva pestaña",
- "address.search": "Busca o introduce una URL",
"address.suggestions": "Sugerencias",
"refused.web": "Aquí solo se pueden abrir páginas web.",
"refused.workspace": "Aquí solo se pueden abrir páginas web y archivos del espacio de trabajo de esta sesión.",
"refused.credentials": "Aquí no se pueden abrir direcciones con nombre de usuario o contraseña.",
- inspect: "Selecciona un elemento para comentarlo",
- "inspect.active": "Haz clic en un elemento de la página para comentarlo. Pulsa Escape para cancelar.",
- "comment.label": "Comentar este elemento",
"comment.placeholder": "Añade un comentario opcional...",
- "comment.cancel": "Cancelar comentario del elemento",
- "comment.submit": "Añadir comentario del elemento",
- "comment.attach": "Añadir elemento",
"comment.annotation": "Anotación del navegador",
"home.title": "Abrir una página",
"home.description": "Previsualiza tu aplicación, lee documentación o navega por la web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "La conexión es segura",
"site.insecure": "La conexión no es segura",
"site.insecure.description": "No introduzcas contraseñas ni otra información privada en esta página.",
- "site.local": "Servidor local",
- "site.local.description": "Las direcciones locales se abren en el equipo que ejecuta el servidor de OpenCode.",
"site.file": "Archivo del espacio de trabajo",
"site.file.description": "Aquí solo se pueden abrir archivos del espacio de trabajo de esta sesión.",
- "site.network": "Las páginas se cargan a través de la red de {{server}}.",
"site.cookies": "Cookies y datos del sitio",
"site.cookies.count.one": "{{count}} cookie en uso",
"site.cookies.count.other": "{{count}} cookies en uso",
@@ -48,13 +32,7 @@ export default {
"site.permissions": "Los permisos están bloqueados",
"site.permissions.description":
"La cámara, el micrófono, la ubicación y las notificaciones no funcionan en este navegador.",
- "site.agent": "El agente puede usar esta página",
- "site.agent.description": "Puede leer la página, ejecutar scripts y rellenar formularios.",
"page.add": "Añadir página a la sesión",
- "page.placeholder": "Añade contexto sobre esta página",
- "external.open": "Abrir en el navegador del sistema",
- "external.menu": "Abrir en el navegador",
- "external.unavailable": "Esta dirección solo funciona en el equipo del servidor.",
options: "Opciones del navegador",
"zoom.in": "Ampliar",
"zoom.out": "Reducir",
diff --git a/packages/gui-plugins/src/browser/i18n/et.ts b/packages/gui-plugins/src/browser/i18n/et.ts
index ee367d060666..306e614655ba 100644
--- a/packages/gui-plugins/src/browser/i18n/et.ts
+++ b/packages/gui-plugins/src/browser/i18n/et.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Brauser",
"address.label": "Brauseri aadress",
"action.stop": "Peatus",
- replaced: "Brauseri juhtimine teisaldati teise töölauaaknasse.",
unsupported: "See töölauarakendus ei toeta brauseri paani.",
- suspended: "Brauser peatatud. Ühendage uuesti ühenduse loomiseks selle seansiga.",
- "failed.title": "URL-ile ei pääse juurde",
- "failed.description": "Kontrolli URL-i ja ühendust ning proovi uuesti.",
"action.reload": "Laadi uuesti",
"model.timedOut": "Brauseri laadimine võttis liiga kaua aega",
- "command.inspect": "Vali brauseri lehel element",
- "command.address": "Fokusseeri brauseri aadressiriba",
"command.close": "Sule brauseri vahekaart",
"command.newTab": "Uus brauseri vahekaart",
"tab.new": "Uus vahekaart",
- "address.search": "Otsi või sisesta URL",
"address.suggestions": "Soovitused",
"refused.web": "Siin saab avada ainult veebilehti.",
"refused.workspace": "Siin saab avada ainult veebilehti ja selle seansi tööruumi faile.",
"refused.credentials": "Kasutajanime või parooliga aadresse ei saa siin avada.",
- inspect: "Vali kommenteeritav element",
- "inspect.active": "Kommenteerimiseks klõpsa lehel elemendil. Tühistamiseks vajuta Escape.",
- "comment.label": "Kommenteeri seda elementi",
"comment.placeholder": "Lisa valikuline kommentaar...",
- "comment.cancel": "Tühista elemendi kommentaar",
- "comment.submit": "Lisa elemendi kommentaar",
- "comment.attach": "Lisa element",
"comment.annotation": "Brauseri märkus",
"home.title": "Ava leht",
"home.description": "Vaata oma rakenduse eelvaadet, loe dokumentatsiooni või sirvi veebi.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Ühendus on turvaline",
"site.insecure": "Ühendus pole turvaline",
"site.insecure.description": "Ära sisesta sellel lehel paroole ega muud privaatset teavet.",
- "site.local": "Kohalik server",
- "site.local.description": "Kohalikud aadressid avanevad masinas, mis käitab OpenCode'i serverit.",
"site.file": "Tööruumi fail",
"site.file.description": "Siin saab avada ainult selle seansi tööruumi faile.",
- "site.network": "Lehed laaditakse serveri {{server}} võrgu kaudu.",
"site.cookies": "Küpsised ja saidi andmed",
"site.cookies.count.one": "{{count}} küpsis kasutusel",
"site.cookies.count.other": "{{count}} küpsist kasutusel",
"site.cookies.clear": "Tühjenda",
"site.permissions": "Load on blokeeritud",
"site.permissions.description": "Kaamera, mikrofon, asukoht ja teavitused selles brauseris ei tööta.",
- "site.agent": "Agent saab seda lehte kasutada",
- "site.agent.description": "See saab lehte lugeda, skripte käivitada ja vorme täita.",
"page.add": "Lisa leht seansile",
- "page.placeholder": "Lisa selle lehe kohta konteksti",
- "external.open": "Ava süsteemi brauseris",
- "external.menu": "Ava brauseris",
- "external.unavailable": "See aadress töötab ainult serveri masinas.",
options: "Brauseri valikud",
"zoom.in": "Suumi sisse",
"zoom.out": "Suumi välja",
diff --git a/packages/gui-plugins/src/browser/i18n/fa.ts b/packages/gui-plugins/src/browser/i18n/fa.ts
index 7272eaab10e6..69f785ee0972 100644
--- a/packages/gui-plugins/src/browser/i18n/fa.ts
+++ b/packages/gui-plugins/src/browser/i18n/fa.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "مرورگر",
"address.label": "نشانی مرورگر",
"action.stop": "توقف کنید",
- replaced: "کنترل مرورگر به پنجرهٔ دسکتاپ دیگری منتقل شد.",
unsupported: "این برنامهٔ دسکتاپ از پنل مرورگر پشتیبانی نمیکند.",
- suspended: "مرورگر تعلیق شد. برای اتصال دوباره با این نشست تعامل کنید.",
- "failed.title": "دسترسی به URL ممکن نیست",
- "failed.description": "URL و اتصال خود را بررسی کنید و دوباره تلاش کنید.",
"action.reload": "بارگیری مجدد",
"model.timedOut": "بارگیری مرورگر بیش از حد طول کشید",
- "command.inspect": "انتخاب یک عنصر در صفحه مرورگر",
- "command.address": "تمرکز روی نوار نشانی مرورگر",
"command.close": "بستن برگه مرورگر",
"command.newTab": "برگه جدید مرورگر",
"tab.new": "برگه جدید",
- "address.search": "جستوجو یا وارد کردن نشانی",
"address.suggestions": "پیشنهادها",
"refused.web": "فقط صفحههای وب میتوانند اینجا باز شوند.",
"refused.workspace": "فقط صفحههای وب و فایلهای داخل فضای کاری این جلسه میتوانند اینجا باز شوند.",
"refused.credentials": "نشانیهای دارای نام کاربری یا گذرواژه نمیتوانند اینجا باز شوند.",
- inspect: "عنصری را برای نظر دادن انتخاب کنید",
- "inspect.active": "برای نظر دادن روی یک عنصر، روی آن در صفحه کلیک کنید. برای لغو Escape را بزنید.",
- "comment.label": "نظر درباره این عنصر",
"comment.placeholder": "افزودن نظر اختیاری...",
- "comment.cancel": "لغو نظر عنصر",
- "comment.submit": "افزودن نظر عنصر",
- "comment.attach": "افزودن عنصر",
"comment.annotation": "یادداشت مرورگر",
"home.title": "باز کردن یک صفحه",
"home.description": "برنامه خود را پیشنمایش کنید، مستندات بخوانید یا در وب بگردید.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "اتصال امن است",
"site.insecure": "اتصال امن نیست",
"site.insecure.description": "در این صفحه گذرواژه یا اطلاعات خصوصی دیگر وارد نکنید.",
- "site.local": "سرور محلی",
- "site.local.description": "نشانیهای محلی روی دستگاهی باز میشوند که سرور OpenCode را اجرا میکند.",
"site.file": "فایل فضای کاری",
"site.file.description": "فقط فایلهای داخل فضای کاری این جلسه میتوانند اینجا باز شوند.",
- "site.network": "صفحهها از طریق شبکه {{server}} بارگیری میشوند.",
"site.cookies": "کوکیها و دادههای سایت",
"site.cookies.count.one": "{{count}} کوکی در حال استفاده",
"site.cookies.count.other": "{{count}} کوکی در حال استفاده",
"site.cookies.clear": "پاک کردن",
"site.permissions": "مجوزها مسدود هستند",
"site.permissions.description": "دوربین، میکروفون، موقعیت مکانی و اعلانها در این مرورگر کار نمیکنند.",
- "site.agent": "عامل میتواند از این صفحه استفاده کند",
- "site.agent.description": "میتواند صفحه را بخواند، اسکریپت اجرا کند و فرمها را پر کند.",
"page.add": "افزودن صفحه به جلسه",
- "page.placeholder": "زمینهای درباره این صفحه اضافه کنید",
- "external.open": "باز کردن در مرورگر سیستم",
- "external.menu": "باز کردن در مرورگر",
- "external.unavailable": "این نشانی فقط روی دستگاه سرور کار میکند.",
options: "گزینههای مرورگر",
"zoom.in": "بزرگنمایی",
"zoom.out": "کوچکنمایی",
diff --git a/packages/gui-plugins/src/browser/i18n/fi.ts b/packages/gui-plugins/src/browser/i18n/fi.ts
index 7518e459c8f7..056d7be8d6c5 100644
--- a/packages/gui-plugins/src/browser/i18n/fi.ts
+++ b/packages/gui-plugins/src/browser/i18n/fi.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Selain",
"address.label": "Selaimen osoite",
"action.stop": "Pysäytä",
- replaced: "Selaimen ohjaus siirrettiin toiseen työpöytäikkunaan.",
unsupported: "Tämä työpöytäsovellus ei tue selainpaneelia.",
- suspended: "Selain jäädytetty. Ole vuorovaikutuksessa tämän istunnon kanssa yhdistääksesi uudelleen.",
- "failed.title": "URL-osoitetta ei tavoiteta",
- "failed.description": "Tarkista URL-osoite ja yhteys ja yritä uudelleen.",
"action.reload": "Lataa uudelleen",
"model.timedOut": "Selaimen lataaminen kesti liian kauan",
- "command.inspect": "Valitse elementti selainsivulta",
- "command.address": "Kohdista selaimen osoiteriville",
"command.close": "Sulje selainvälilehti",
"command.newTab": "Uusi selainvälilehti",
"tab.new": "Uusi välilehti",
- "address.search": "Hae tai anna URL-osoite",
"address.suggestions": "Ehdotukset",
"refused.web": "Täällä voi avata vain verkkosivuja.",
"refused.workspace": "Täällä voi avata vain verkkosivuja ja tämän istunnon työtilan tiedostoja.",
"refused.credentials": "Osoitteita, joissa on käyttäjänimi tai salasana, ei voi avata täällä.",
- inspect: "Valitse kommentoitava elementti",
- "inspect.active": "Kommentoi elementtiä napsauttamalla sitä sivulla. Peruuta painamalla Escape.",
- "comment.label": "Kommentoi tätä elementtiä",
"comment.placeholder": "Lisää valinnainen kommentti...",
- "comment.cancel": "Peruuta elementtikommentti",
- "comment.submit": "Lisää elementtikommentti",
- "comment.attach": "Lisää elementti",
"comment.annotation": "Selainmerkintä",
"home.title": "Avaa sivu",
"home.description": "Esikatsele sovellustasi, lue dokumentaatiota tai selaa verkkoa.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Yhteys on suojattu",
"site.insecure": "Yhteys ei ole suojattu",
"site.insecure.description": "Älä anna salasanoja tai muita yksityisiä tietoja tällä sivulla.",
- "site.local": "Paikallinen palvelin",
- "site.local.description": "Paikalliset osoitteet avautuvat koneella, jolla OpenCode-palvelin on käynnissä.",
"site.file": "Työtilan tiedosto",
"site.file.description": "Täällä voi avata vain tämän istunnon työtilan tiedostoja.",
- "site.network": "Sivut ladataan palvelimen {{server}} verkon kautta.",
"site.cookies": "Evästeet ja sivustotiedot",
"site.cookies.count.one": "{{count}} eväste käytössä",
"site.cookies.count.other": "{{count}} evästettä käytössä",
"site.cookies.clear": "Tyhjennä",
"site.permissions": "Käyttöoikeudet on estetty",
"site.permissions.description": "Kamera, mikrofoni, sijainti ja ilmoitukset eivät toimi tässä selaimessa.",
- "site.agent": "Agentti voi käyttää tätä sivua",
- "site.agent.description": "Se voi lukea sivua, suorittaa skriptejä ja täyttää lomakkeita.",
"page.add": "Lisää sivu istuntoon",
- "page.placeholder": "Lisää kontekstia tästä sivusta",
- "external.open": "Avaa järjestelmän selaimessa",
- "external.menu": "Avaa selaimessa",
- "external.unavailable": "Tämä osoite toimii vain palvelimen koneella.",
options: "Selaimen asetukset",
"zoom.in": "Lähennä",
"zoom.out": "Loitonna",
diff --git a/packages/gui-plugins/src/browser/i18n/fo.ts b/packages/gui-plugins/src/browser/i18n/fo.ts
index caebdbec6274..8e6fb4d985fa 100644
--- a/packages/gui-plugins/src/browser/i18n/fo.ts
+++ b/packages/gui-plugins/src/browser/i18n/fo.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Kaga",
"address.label": "Kagaadressa",
"action.stop": "Steðga",
- replaced: "Kagastýring flutt til eitt annað skriviborðsvindeyga.",
unsupported: "Hendan skriviborðsappin stuðlar ikki kagarútinum.",
- suspended: "Kagari steðgaður. Samskifta við hesa setuna fyri at fáa samband aftur.",
- "failed.title": "URL-adressan kann ikki røkkast",
- "failed.description": "Kanna URL-adressuna og sambandið og royn aftur.",
"action.reload": "Les inn aftur",
"model.timedOut": "Kagin var ov leingi um at heinta",
- "command.inspect": "Vel eitt element á kagasíðuni",
- "command.address": "Fokusera á kagaadressuna",
"command.close": "Lat kagaflipan aftur",
"command.newTab": "Nýggjur kagaflipi",
"tab.new": "Nýggjur flipi",
- "address.search": "Leita ella skriva ein URL",
"address.suggestions": "Uppskot",
"refused.web": "Bert vevsíður kunnu latast upp her.",
"refused.workspace": "Bert vevsíður og fílur í workspace hjá hesi setuni kunnu latast upp her.",
"refused.credentials": "Adressur við brúkaranavni ella loyniorði kunnu ikki latast upp her.",
- inspect: "Vel eitt element at viðmerkja",
- "inspect.active": "Trýst á eitt element á síðuni fyri at viðmerkja tað. Trýst á Escape fyri at avlýsa.",
- "comment.label": "Viðmerk hetta elementið",
"comment.placeholder": "Legg eina valfría viðmerking afturat...",
- "comment.cancel": "Avlýs viðmerking til element",
- "comment.submit": "Legg viðmerking til element afturat",
- "comment.attach": "Legg element afturat",
"comment.annotation": "Kagaviðmerking",
"home.title": "Lat eina síðu upp",
"home.description": "Forskoða forritið hjá tær, les skjøl ella kaga á netinum.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Sambandið er trygt",
"site.insecure": "Sambandið er ikki trygt",
"site.insecure.description": "Skriva ikki loyniorð ella aðrar privatar upplýsingar á hesi síðuni.",
- "site.local": "Lokalur ambætari",
- "site.local.description": "Lokalar adressur verða latnar upp á teldu, sum koyrir OpenCode ambætaran.",
"site.file": "Workspace-fíla",
"site.file.description": "Bert fílur í workspace hjá hesi setuni kunnu latast upp her.",
- "site.network": "Síður verða heintaðar gjøgnum netið hjá {{server}}.",
"site.cookies": "Cookies og síðudátur",
"site.cookies.count.one": "{{count}} cookie í nýtslu",
"site.cookies.count.other": "{{count}} cookies í nýtslu",
"site.cookies.clear": "Rudda",
"site.permissions": "Loyvi eru forðað",
"site.permissions.description": "Myndatól, mikrofon, staðseting og fráboðanir virka ikki í hesum kaganum.",
- "site.agent": "Agenturin kann brúka hesa síðuna",
- "site.agent.description": "Hann kann lesa síðuna, koyra skript og fylla út formularar.",
"page.add": "Legg síðu afturat setuni",
- "page.placeholder": "Legg samanhang um hesa síðuna afturat",
- "external.open": "Lat upp í skipanarkaganum",
- "external.menu": "Lat upp í kaga",
- "external.unavailable": "Henda adressan virkar bert á teldu ambætarans.",
options: "Kagamøguleikar",
"zoom.in": "Zooma inn",
"zoom.out": "Zooma út",
diff --git a/packages/gui-plugins/src/browser/i18n/fr.ts b/packages/gui-plugins/src/browser/i18n/fr.ts
index 2dd51d2c62ca..f6cc034de3e9 100644
--- a/packages/gui-plugins/src/browser/i18n/fr.ts
+++ b/packages/gui-plugins/src/browser/i18n/fr.ts
@@ -4,31 +4,18 @@ export default {
"tab.title": "Navigateur",
"address.label": "Adresse du navigateur",
"action.stop": "Arrêter",
- replaced: "Le contrôle du navigateur a été déplacé vers une autre fenêtre du bureau.",
unsupported: "Cette application de bureau ne prend pas en charge le volet du navigateur.",
- suspended: "Navigateur suspendu. Interagissez avec cette session pour vous reconnecter.",
- "failed.title": "L’URL est inaccessible",
- "failed.description": "Vérifiez l’URL et votre connexion, puis réessayez.",
"action.reload": "Recharger",
"model.timedOut": "Le navigateur a mis trop de temps à se charger",
- "command.inspect": "Sélectionner un élément dans la page du navigateur",
- "command.address": "Placer le focus sur la barre d’adresse du navigateur",
"command.close": "Fermer l’onglet du navigateur",
"command.newTab": "Nouvel onglet de navigateur",
"tab.new": "Nouvel onglet",
- "address.search": "Rechercher ou saisir une URL",
"address.suggestions": "Suggestions",
"refused.web": "Seules les pages Web peuvent s’ouvrir ici.",
"refused.workspace":
"Seules les pages Web et les fichiers de l’espace de travail de cette session peuvent s’ouvrir ici.",
"refused.credentials": "Les adresses contenant un nom d’utilisateur ou un mot de passe ne peuvent pas s’ouvrir ici.",
- inspect: "Sélectionner un élément à commenter",
- "inspect.active": "Cliquez sur un élément de la page pour le commenter. Appuyez sur Échap pour annuler.",
- "comment.label": "Commenter cet élément",
"comment.placeholder": "Ajouter un commentaire facultatif...",
- "comment.cancel": "Annuler le commentaire sur l’élément",
- "comment.submit": "Ajouter le commentaire sur l’élément",
- "comment.attach": "Ajouter l’élément",
"comment.annotation": "Annotation du navigateur",
"home.title": "Ouvrir une page",
"home.description": "Prévisualisez votre application, lisez la documentation ou naviguez sur le Web.",
@@ -37,11 +24,8 @@ export default {
"site.secure": "La connexion est sécurisée",
"site.insecure": "La connexion n’est pas sécurisée",
"site.insecure.description": "Ne saisissez pas de mots de passe ni d’autres informations privées sur cette page.",
- "site.local": "Serveur local",
- "site.local.description": "Les adresses locales s’ouvrent sur la machine qui exécute le serveur OpenCode.",
"site.file": "Fichier de l’espace de travail",
"site.file.description": "Seuls les fichiers de l’espace de travail de cette session peuvent s’ouvrir ici.",
- "site.network": "Les pages se chargent via le réseau de {{server}}.",
"site.cookies": "Cookies et données de site",
"site.cookies.count.one": "{{count}} cookie utilisé",
"site.cookies.count.many": "{{count}} cookies utilisés",
@@ -50,13 +34,7 @@ export default {
"site.permissions": "Les permissions sont bloquées",
"site.permissions.description":
"La caméra, le microphone, la localisation et les notifications ne fonctionnent pas dans ce navigateur.",
- "site.agent": "L’agent peut utiliser cette page",
- "site.agent.description": "Il peut lire la page, exécuter des scripts et remplir des formulaires.",
"page.add": "Ajouter la page à la session",
- "page.placeholder": "Ajouter du contexte sur cette page",
- "external.open": "Ouvrir dans le navigateur du système",
- "external.menu": "Ouvrir dans le navigateur",
- "external.unavailable": "Cette adresse ne fonctionne que sur la machine du serveur.",
options: "Options du navigateur",
"zoom.in": "Zoom avant",
"zoom.out": "Zoom arrière",
diff --git a/packages/gui-plugins/src/browser/i18n/he.ts b/packages/gui-plugins/src/browser/i18n/he.ts
index ece8f13649bf..ce25aa5766d8 100644
--- a/packages/gui-plugins/src/browser/i18n/he.ts
+++ b/packages/gui-plugins/src/browser/i18n/he.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "דפדפן",
"address.label": "כתובת הדפדפן",
"action.stop": "עצור",
- replaced: "השליטה בדפדפן הועברה לחלון שולחן עבודה אחר.",
unsupported: "יישום שולחן העבודה הזה אינו תומך בחלונית הדפדפן.",
- suspended: "הדפדפן הושהה. יש לקיים אינטראקציה עם הפעלה זו כדי להתחבר מחדש.",
- "failed.title": "לא ניתן להגיע לכתובת ה-URL",
- "failed.description": "יש לבדוק את כתובת ה-URL ואת החיבור ולנסות שוב.",
"action.reload": "טען מחדש",
"model.timedOut": "טעינת הדפדפן ארכה זמן רב מדי",
- "command.inspect": "בחר רכיב בדף הדפדפן",
- "command.address": "מיקוד בשורת הכתובת של הדפדפן",
"command.close": "סגור כרטיסיית דפדפן",
"command.newTab": "כרטיסיית דפדפן חדשה",
"tab.new": "כרטיסייה חדשה",
- "address.search": "חפש או הזן כתובת URL",
"address.suggestions": "הצעות",
"refused.web": "רק דפי אינטרנט יכולים להיפתח כאן.",
"refused.workspace": "רק דפי אינטרנט וקבצים בתוך סביבת העבודה של הפעלה זו יכולים להיפתח כאן.",
"refused.credentials": "כתובות עם שם משתמש או סיסמה לא יכולות להיפתח כאן.",
- inspect: "בחר רכיב כדי להגיב עליו",
- "inspect.active": "לחץ על רכיב בדף כדי להגיב עליו. הקש Escape כדי לבטל.",
- "comment.label": "הגב על רכיב זה",
"comment.placeholder": "הוסף תגובה (אופציונלי)...",
- "comment.cancel": "בטל תגובה על רכיב",
- "comment.submit": "הוסף תגובה על רכיב",
- "comment.attach": "הוסף רכיב",
"comment.annotation": "הערת דפדפן",
"home.title": "פתח דף",
"home.description": "צפה בתצוגה מקדימה של האפליקציה, קרא תיעוד או גלוש באינטרנט.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "החיבור מאובטח",
"site.insecure": "החיבור אינו מאובטח",
"site.insecure.description": "אל תזין סיסמאות או מידע פרטי אחר בדף זה.",
- "site.local": "שרת מקומי",
- "site.local.description": "כתובות מקומיות נפתחות במחשב שמריץ את שרת OpenCode.",
"site.file": "קובץ בסביבת העבודה",
"site.file.description": "רק קבצים בתוך סביבת העבודה של הפעלה זו יכולים להיפתח כאן.",
- "site.network": "הדפים נטענים דרך הרשת של {{server}}.",
"site.cookies": "קובצי Cookie ונתוני אתר",
"site.cookies.count.one": "{{count}} קובץ Cookie בשימוש",
"site.cookies.count.two": "{{count}} קובצי Cookie בשימוש",
@@ -48,13 +32,7 @@ export default {
"site.cookies.clear": "נקה",
"site.permissions": "ההרשאות חסומות",
"site.permissions.description": "מצלמה, מיקרופון, מיקום והתראות אינם פועלים בדפדפן זה.",
- "site.agent": "הסוכן יכול להשתמש בדף זה",
- "site.agent.description": "הוא יכול לקרוא את הדף, להריץ סקריפטים ולמלא טפסים.",
"page.add": "הוסף דף להפעלה",
- "page.placeholder": "הוסף הקשר על דף זה",
- "external.open": "פתח בדפדפן המערכת",
- "external.menu": "פתח בדפדפן",
- "external.unavailable": "כתובת זו פועלת רק במחשב של השרת.",
options: "אפשרויות דפדפן",
"zoom.in": "הגדלה",
"zoom.out": "הקטנה",
diff --git a/packages/gui-plugins/src/browser/i18n/hi.ts b/packages/gui-plugins/src/browser/i18n/hi.ts
index b0293dab4300..32872ae9daff 100644
--- a/packages/gui-plugins/src/browser/i18n/hi.ts
+++ b/packages/gui-plugins/src/browser/i18n/hi.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ब्राउज़र",
"address.label": "ब्राउज़र पता",
"action.stop": "रोकें",
- replaced: "ब्राउज़र नियंत्रण किसी अन्य डेस्कटॉप विंडो पर ले जाया गया।",
unsupported: "यह डेस्कटॉप ऐप ब्राउज़र फलक का समर्थन नहीं करता है.",
- suspended: "ब्राउज़र निलंबित. पुन: कनेक्ट करने के लिए इस सत्र से इंटरैक्ट करें.",
- "failed.title": "URL तक नहीं पहुँचा जा सका",
- "failed.description": "URL और अपना कनेक्शन जाँचें, फिर दोबारा कोशिश करें।",
"action.reload": "पुनः लोड करें",
"model.timedOut": "ब्राउज़र को लोड होने में बहुत समय लगा",
- "command.inspect": "ब्राउज़र पेज में एक तत्व चुनें",
- "command.address": "ब्राउज़र के एड्रेस पर फ़ोकस करें",
"command.close": "ब्राउज़र टैब बंद करें",
"command.newTab": "नया ब्राउज़र टैब",
"tab.new": "नया टैब",
- "address.search": "खोजें या URL दर्ज करें",
"address.suggestions": "सुझाव",
"refused.web": "यहाँ केवल वेब पेज खुल सकते हैं।",
"refused.workspace": "यहाँ केवल वेब पेज और इस सेशन के वर्कस्पेस की फ़ाइलें खुल सकती हैं।",
"refused.credentials": "उपयोगकर्ता नाम या पासवर्ड वाले पते यहाँ नहीं खुल सकते।",
- inspect: "टिप्पणी करने के लिए एक तत्व चुनें",
- "inspect.active": "टिप्पणी करने के लिए पेज में किसी तत्व पर क्लिक करें। रद्द करने के लिए Escape दबाएँ।",
- "comment.label": "इस तत्व पर टिप्पणी करें",
"comment.placeholder": "वैकल्पिक टिप्पणी जोड़ें...",
- "comment.cancel": "तत्व पर टिप्पणी रद्द करें",
- "comment.submit": "तत्व पर टिप्पणी जोड़ें",
- "comment.attach": "तत्व जोड़ें",
"comment.annotation": "ब्राउज़र एनोटेशन",
"home.title": "एक पेज खोलें",
"home.description": "अपने ऐप का पूर्वावलोकन करें, दस्तावेज़ पढ़ें या वेब ब्राउज़ करें।",
@@ -36,24 +23,15 @@ export default {
"site.secure": "कनेक्शन सुरक्षित है",
"site.insecure": "कनेक्शन सुरक्षित नहीं है",
"site.insecure.description": "इस पेज पर पासवर्ड या अन्य निजी जानकारी दर्ज न करें।",
- "site.local": "स्थानीय सर्वर",
- "site.local.description": "स्थानीय पते उस मशीन पर खुलते हैं जो OpenCode सर्वर चलाती है।",
"site.file": "वर्कस्पेस फ़ाइल",
"site.file.description": "यहाँ केवल इस सेशन के वर्कस्पेस की फ़ाइलें खुल सकती हैं।",
- "site.network": "पेज {{server}} के नेटवर्क के माध्यम से लोड होते हैं।",
"site.cookies": "कुकीज़ और साइट डेटा",
"site.cookies.count.one": "{{count}} कुकी उपयोग में",
"site.cookies.count.other": "{{count}} कुकीज़ उपयोग में",
"site.cookies.clear": "साफ़ करें",
"site.permissions": "अनुमतियाँ अवरुद्ध हैं",
"site.permissions.description": "इस ब्राउज़र में कैमरा, माइक्रोफ़ोन, लोकेशन और सूचनाएँ काम नहीं करतीं।",
- "site.agent": "एजेंट इस पेज का उपयोग कर सकता है",
- "site.agent.description": "यह पेज पढ़ सकता है, स्क्रिप्ट चला सकता है और फ़ॉर्म भर सकता है।",
"page.add": "पेज को सेशन में जोड़ें",
- "page.placeholder": "इस पेज के बारे में कॉन्टेक्स्ट जोड़ें",
- "external.open": "सिस्टम ब्राउज़र में खोलें",
- "external.menu": "ब्राउज़र में खोलें",
- "external.unavailable": "यह पता केवल सर्वर की मशीन पर काम करता है।",
options: "ब्राउज़र विकल्प",
"zoom.in": "ज़ूम इन करें",
"zoom.out": "ज़ूम आउट करें",
diff --git a/packages/gui-plugins/src/browser/i18n/hr.ts b/packages/gui-plugins/src/browser/i18n/hr.ts
index 28fba4311f1b..12f9c8d87c5c 100644
--- a/packages/gui-plugins/src/browser/i18n/hr.ts
+++ b/packages/gui-plugins/src/browser/i18n/hr.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Preglednik",
"address.label": "Adresa preglednika",
"action.stop": "Zaustavi",
- replaced: "Upravljanje preglednikom premješteno je u drugi prozor Desktopa.",
unsupported: "Ova aplikacija za računalo ne podržava okno preglednika.",
- suspended: "Preglednik je obustavljen. Stupite u interakciju s ovom sesijom da biste se ponovno povezali.",
- "failed.title": "URL nije dostupan",
- "failed.description": "Provjerite URL i vezu, a zatim pokušajte ponovno.",
"action.reload": "Ponovno učitaj",
"model.timedOut": "Preglednik se predugo učitavao",
- "command.inspect": "Odaberi element na stranici preglednika",
- "command.address": "Fokusiraj adresnu traku preglednika",
"command.close": "Zatvori karticu preglednika",
"command.newTab": "Nova kartica preglednika",
"tab.new": "Nova kartica",
- "address.search": "Pretražite ili unesite URL",
"address.suggestions": "Prijedlozi",
"refused.web": "Ovdje se mogu otvoriti samo web stranice.",
"refused.workspace": "Ovdje se mogu otvoriti samo web stranice i datoteke unutar radnog prostora ove sesije.",
"refused.credentials": "Adrese s korisničkim imenom ili lozinkom ne mogu se ovdje otvoriti.",
- inspect: "Odaberite element za komentiranje",
- "inspect.active": "Kliknite element na stranici da biste ga komentirali. Pritisnite Escape za odustajanje.",
- "comment.label": "Komentiraj ovaj element",
"comment.placeholder": "Dodajte neobavezni komentar...",
- "comment.cancel": "Odustani od komentara elementa",
- "comment.submit": "Dodaj komentar elementa",
- "comment.attach": "Dodaj element",
"comment.annotation": "Napomena iz preglednika",
"home.title": "Otvorite stranicu",
"home.description": "Pregledajte svoju aplikaciju, čitajte dokumentaciju ili pretražujte web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Veza je sigurna",
"site.insecure": "Veza nije sigurna",
"site.insecure.description": "Ne unosite lozinke ni druge privatne podatke na ovoj stranici.",
- "site.local": "Lokalni poslužitelj",
- "site.local.description": "Lokalne adrese otvaraju se na računalu na kojem radi OpenCode poslužitelj.",
"site.file": "Datoteka radnog prostora",
"site.file.description": "Ovdje se mogu otvoriti samo datoteke unutar radnog prostora ove sesije.",
- "site.network": "Stranice se učitavaju preko mreže poslužitelja {{server}}.",
"site.cookies": "Kolačići i podaci web-mjesta",
"site.cookies.count.one": "{{count}} kolačić u upotrebi",
"site.cookies.count.few": "{{count}} kolačića u upotrebi",
@@ -48,13 +32,7 @@ export default {
"site.cookies.clear": "Očisti",
"site.permissions": "Dopuštenja su blokirana",
"site.permissions.description": "Kamera, mikrofon, lokacija i obavijesti ne rade u ovom pregledniku.",
- "site.agent": "Agent može koristiti ovu stranicu",
- "site.agent.description": "Može čitati stranicu, pokretati skripte i ispunjavati obrasce.",
"page.add": "Dodaj stranicu u sesiju",
- "page.placeholder": "Dodajte kontekst o ovoj stranici",
- "external.open": "Otvori u pregledniku sustava",
- "external.menu": "Otvori u pregledniku",
- "external.unavailable": "Ova adresa radi samo na računalu poslužitelja.",
options: "Opcije preglednika",
"zoom.in": "Povećaj",
"zoom.out": "Smanji",
diff --git a/packages/gui-plugins/src/browser/i18n/hu.ts b/packages/gui-plugins/src/browser/i18n/hu.ts
index d5a3cf457520..22527b61de49 100644
--- a/packages/gui-plugins/src/browser/i18n/hu.ts
+++ b/packages/gui-plugins/src/browser/i18n/hu.ts
@@ -4,31 +4,17 @@ export default {
"tab.title": "Böngésző",
"address.label": "Böngésző címe",
"action.stop": "Leállítás",
- replaced: "A böngésző vezérlése átkerült egy másik asztali ablakba.",
unsupported: "Ez az asztali alkalmazás nem támogatja a böngésző ablaktáblát.",
- suspended: "A böngésző felfüggesztve. Lépjen kapcsolatba ezzel a munkamenettel az újracsatlakozáshoz.",
- "failed.title": "Az URL-cím nem érhető el",
- "failed.description": "Ellenőrizze az URL-címet és a kapcsolatot, majd próbálja újra.",
"action.reload": "Újratöltés",
"model.timedOut": "A böngésző betöltése túl sokáig tartott",
- "command.inspect": "Elem kijelölése a böngészőoldalon",
- "command.address": "Fókusz a böngésző címsorára",
"command.close": "Böngészőlap bezárása",
"command.newTab": "Új böngészőlap",
"tab.new": "Új lap",
- "address.search": "Keressen vagy adjon meg egy URL-t",
"address.suggestions": "Javaslatok",
"refused.web": "Itt csak weboldalak nyithatók meg.",
"refused.workspace": "Itt csak weboldalak és a munkamenet munkaterületén belüli fájlok nyithatók meg.",
"refused.credentials": "Felhasználónevet vagy jelszót tartalmazó címek itt nem nyithatók meg.",
- inspect: "Válasszon ki egy elemet a megjegyzéshez",
- "inspect.active":
- "Kattintson egy elemre az oldalon a megjegyzéshez. A megszakításhoz nyomja meg az Escape billentyűt.",
- "comment.label": "Megjegyzés ehhez az elemhez",
"comment.placeholder": "Megjegyzés hozzáadása (nem kötelező)...",
- "comment.cancel": "Elemmegjegyzés elvetése",
- "comment.submit": "Elemmegjegyzés hozzáadása",
- "comment.attach": "Elem hozzáadása",
"comment.annotation": "Böngészőjegyzet",
"home.title": "Oldal megnyitása",
"home.description": "Tekintse meg az alkalmazása előnézetét, olvasson dokumentációt vagy böngésszen a weben.",
@@ -37,11 +23,8 @@ export default {
"site.secure": "A kapcsolat biztonságos",
"site.insecure": "A kapcsolat nem biztonságos",
"site.insecure.description": "Ne adjon meg jelszót vagy más személyes adatot ezen az oldalon.",
- "site.local": "Helyi szerver",
- "site.local.description": "A helyi címek az OpenCode szervert futtató gépen nyílnak meg.",
"site.file": "Munkaterületi fájl",
"site.file.description": "Itt csak a munkamenet munkaterületén belüli fájlok nyithatók meg.",
- "site.network": "Az oldalak a(z) {{server}} hálózatán keresztül töltődnek be.",
"site.cookies": "Cookie-k és webhelyadatok",
"site.cookies.count.one": "{{count}} cookie használatban",
"site.cookies.count.other": "{{count}} cookie használatban",
@@ -49,13 +32,7 @@ export default {
"site.permissions": "Az engedélyek le vannak tiltva",
"site.permissions.description":
"A kamera, a mikrofon, a helymeghatározás és az értesítések nem működnek ebben a böngészőben.",
- "site.agent": "Az ügynök használhatja ezt az oldalt",
- "site.agent.description": "Elolvashatja az oldalt, szkripteket futtathat és kitölthet űrlapokat.",
"page.add": "Oldal hozzáadása a munkamenethez",
- "page.placeholder": "Kontextus hozzáadása ehhez az oldalhoz",
- "external.open": "Megnyitás a rendszer böngészőjében",
- "external.menu": "Megnyitás böngészőben",
- "external.unavailable": "Ez a cím csak a szerver gépén működik.",
options: "Böngésző beállításai",
"zoom.in": "Nagyítás",
"zoom.out": "Kicsinyítés",
diff --git a/packages/gui-plugins/src/browser/i18n/hy.ts b/packages/gui-plugins/src/browser/i18n/hy.ts
index 8527fa0ebdde..806891447bae 100644
--- a/packages/gui-plugins/src/browser/i18n/hy.ts
+++ b/packages/gui-plugins/src/browser/i18n/hy.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Դիտարկիչ",
"address.label": "Դիտարկչի հասցե",
"action.stop": "Կանգնեցնել",
- replaced: "Դիտարկիչների կառավարումը տեղափոխվել է այլ աշխատասեղանի պատուհան։",
unsupported: "Այս աշխատասեղանի հավելվածը չի աջակցում դիտարկիչի վահանակը։",
- suspended: "Բրաուզերը ժամանակավորապես կանգնեցվել է։ Հետադարձ կապ հաստատեք այս նստաշրջանի հետ՝ նորից միանալու համար։",
- "failed.title": "URL-ը հասանելի չէ",
- "failed.description": "Ստուգեք URL-ը և կապը, ապա կրկին փորձեք։",
"action.reload": "Վերբեռնել կրկին",
"model.timedOut": "Դիտարկիչը չափազանց երկար էր բեռնվում",
- "command.inspect": "Ընտրել տարր դիտարկչի էջում",
- "command.address": "Կենտրոնանալ դիտարկչի հասցեի վրա",
"command.close": "Փակել դիտարկչի ներդիրը",
"command.newTab": "Դիտարկչի նոր ներդիր",
"tab.new": "Նոր ներդիր",
- "address.search": "Որոնեք կամ մուտքագրեք URL",
"address.suggestions": "Առաջարկներ",
"refused.web": "Այստեղ կարող են բացվել միայն վեբ էջեր։",
"refused.workspace": "Այստեղ կարող են բացվել միայն վեբ էջեր և այս նիստի աշխատանքային տարածքի ֆայլեր։",
"refused.credentials": "Օգտանուն կամ գաղտնաբառ պարունակող հասցեները չեն կարող բացվել այստեղ։",
- inspect: "Ընտրեք տարր՝ մեկնաբանելու համար",
- "inspect.active": "Սեղմեք էջի տարրի վրա՝ այն մեկնաբանելու համար։ Սեղմեք Escape՝ չեղարկելու համար։",
- "comment.label": "Մեկնաբանել այս տարրը",
"comment.placeholder": "Ավելացրեք մեկնաբանություն (ըստ ցանկության)...",
- "comment.cancel": "Չեղարկել տարրի մեկնաբանությունը",
- "comment.submit": "Ավելացնել տարրի մեկնաբանությունը",
- "comment.attach": "Ավելացնել տարրը",
"comment.annotation": "Դիտարկչի նշում",
"home.title": "Բացել էջ",
"home.description": "Նախադիտեք ձեր հավելվածը, կարդացեք փաստաթղթերը կամ դիտարկեք համացանցը։",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Կապն անվտանգ է",
"site.insecure": "Կապն անվտանգ չէ",
"site.insecure.description": "Մի մուտքագրեք գաղտնաբառեր կամ այլ անձնական տեղեկություններ այս էջում։",
- "site.local": "Տեղական սերվեր",
- "site.local.description": "Տեղական հասցեները բացվում են այն մեքենայի վրա, որտեղ աշխատում է OpenCode սերվերը։",
"site.file": "Աշխատանքային տարածքի ֆայլ",
"site.file.description": "Այստեղ կարող են բացվել միայն այս նիստի աշխատանքային տարածքի ֆայլերը։",
- "site.network": "Էջերը բեռնվում են {{server}}-ի ցանցի միջոցով։",
"site.cookies": "Քուքիներ և կայքի տվյալներ",
"site.cookies.count.one": "Օգտագործվում է {{count}} քուքի",
"site.cookies.count.other": "Օգտագործվում է {{count}} քուքի",
"site.cookies.clear": "Մաքրել",
"site.permissions": "Թույլտվություններն արգելափակված են",
"site.permissions.description": "Տեսախցիկը, խոսափողը, տեղադրությունը և ծանուցումներն այս դիտարկչում չեն աշխատում։",
- "site.agent": "Գործակալը կարող է օգտագործել այս էջը",
- "site.agent.description": "Այն կարող է կարդալ էջը, գործարկել սկրիպտներ և լրացնել ձևեր։",
"page.add": "Ավելացնել էջը նիստին",
- "page.placeholder": "Ավելացրեք համատեքստ այս էջի մասին",
- "external.open": "Բացել համակարգի դիտարկչում",
- "external.menu": "Բացել դիտարկչում",
- "external.unavailable": "Այս հասցեն աշխատում է միայն սերվերի մեքենայի վրա։",
options: "Դիտարկչի ընտրանքներ",
"zoom.in": "Խոշորացնել",
"zoom.out": "Փոքրացնել",
diff --git a/packages/gui-plugins/src/browser/i18n/id.ts b/packages/gui-plugins/src/browser/i18n/id.ts
index d79ca87d4223..e9424894aac2 100644
--- a/packages/gui-plugins/src/browser/i18n/id.ts
+++ b/packages/gui-plugins/src/browser/i18n/id.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Peramban",
"address.label": "Alamat peramban",
"action.stop": "Hentikan",
- replaced: "Kontrol peramban dipindahkan ke jendela desktop lain.",
unsupported: "Aplikasi desktop ini tidak mendukung panel peramban.",
- suspended: "Peramban dijeda. Berinteraksilah dengan sesi ini untuk terhubung kembali.",
- "failed.title": "URL tidak dapat dijangkau",
- "failed.description": "Periksa URL dan koneksi Anda, lalu coba lagi.",
"action.reload": "Muat ulang",
"model.timedOut": "Peramban terlalu lama dimuat",
- "command.inspect": "Pilih elemen di halaman peramban",
- "command.address": "Fokus ke alamat peramban",
"command.close": "Tutup tab peramban",
"command.newTab": "Tab peramban baru",
"tab.new": "Tab baru",
- "address.search": "Cari atau masukkan URL",
"address.suggestions": "Saran",
"refused.web": "Hanya halaman web yang dapat dibuka di sini.",
"refused.workspace": "Hanya halaman web dan berkas di dalam ruang kerja sesi ini yang dapat dibuka di sini.",
"refused.credentials": "Alamat dengan nama pengguna atau kata sandi tidak dapat dibuka di sini.",
- inspect: "Pilih elemen untuk dikomentari",
- "inspect.active": "Klik elemen di halaman untuk mengomentarinya. Tekan Escape untuk membatalkan.",
- "comment.label": "Komentari elemen ini",
"comment.placeholder": "Tambahkan komentar opsional...",
- "comment.cancel": "Batalkan komentar elemen",
- "comment.submit": "Tambah komentar elemen",
- "comment.attach": "Tambah elemen",
"comment.annotation": "Anotasi peramban",
"home.title": "Buka halaman",
"home.description": "Pratinjau aplikasi Anda, baca dokumentasi, atau jelajahi web.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Koneksi aman",
"site.insecure": "Koneksi tidak aman",
"site.insecure.description": "Jangan masukkan kata sandi atau informasi pribadi lainnya di halaman ini.",
- "site.local": "Server lokal",
- "site.local.description": "Alamat lokal dibuka di mesin yang menjalankan server OpenCode.",
"site.file": "Berkas ruang kerja",
"site.file.description": "Hanya berkas di dalam ruang kerja sesi ini yang dapat dibuka di sini.",
- "site.network": "Halaman dimuat melalui jaringan {{server}}.",
"site.cookies": "Cookie dan data situs",
"site.cookies.count.one": "{{count}} cookie digunakan",
"site.cookies.count.other": "{{count}} cookie digunakan",
"site.cookies.clear": "Hapus",
"site.permissions": "Izin diblokir",
"site.permissions.description": "Kamera, mikrofon, lokasi, dan notifikasi tidak berfungsi di peramban ini.",
- "site.agent": "Agen dapat menggunakan halaman ini",
- "site.agent.description": "Agen dapat membaca halaman, menjalankan skrip, dan mengisi formulir.",
"page.add": "Tambahkan halaman ke sesi",
- "page.placeholder": "Tambahkan konteks tentang halaman ini",
- "external.open": "Buka di peramban sistem",
- "external.menu": "Buka di peramban",
- "external.unavailable": "Alamat ini hanya berfungsi di mesin server.",
options: "Opsi peramban",
"zoom.in": "Perbesar",
"zoom.out": "Perkecil",
diff --git a/packages/gui-plugins/src/browser/i18n/is.ts b/packages/gui-plugins/src/browser/i18n/is.ts
index de3d285ba662..60968d19c4b3 100644
--- a/packages/gui-plugins/src/browser/i18n/is.ts
+++ b/packages/gui-plugins/src/browser/i18n/is.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Vafri",
"address.label": "Heimilisfang vafra",
"action.stop": "Stöðva",
- replaced: "Vafrastýring færð í annan skjáborðsglugga.",
unsupported: "Þetta skrifborðsforrit styður ekki vafrarúðuna.",
- suspended: "Vafra lokað. Vertu í samskiptum við þessa lotu til að tengjast aftur.",
- "failed.title": "Ekki næst í vefslóðina",
- "failed.description": "Athugaðu vefslóðina og tenginguna og reyndu aftur.",
"action.reload": "Endurhlaða",
"model.timedOut": "Vafrinn var of lengi að hlaðast",
- "command.inspect": "Velja einingu á vafrasíðunni",
- "command.address": "Færa fókus á veffangastiku vafra",
"command.close": "Loka vafraflipa",
"command.newTab": "Nýr vafraflipi",
"tab.new": "Nýr flipi",
- "address.search": "Leitaðu eða sláðu inn slóð",
"address.suggestions": "Tillögur",
"refused.web": "Aðeins vefsíður geta opnast hér.",
"refused.workspace": "Aðeins vefsíður og skrár innan vinnusvæðis þessarar setu geta opnast hér.",
"refused.credentials": "Vefföng með notandanafni eða lykilorði geta ekki opnast hér.",
- inspect: "Veldu einingu til að gera athugasemd við",
- "inspect.active": "Smelltu á einingu á síðunni til að gera athugasemd við hana. Ýttu á Escape til að hætta við.",
- "comment.label": "Gera athugasemd við þessa einingu",
"comment.placeholder": "Bættu við valfrjálsri athugasemd...",
- "comment.cancel": "Hætta við athugasemd við einingu",
- "comment.submit": "Bæta við athugasemd við einingu",
- "comment.attach": "Bæta við einingu",
"comment.annotation": "Vafraathugasemd",
"home.title": "Opna síðu",
"home.description": "Forskoðaðu forritið þitt, lestu skjölun eða vafraðu á vefnum.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Tengingin er örugg",
"site.insecure": "Tengingin er ekki örugg",
"site.insecure.description": "Ekki slá inn lykilorð eða aðrar persónulegar upplýsingar á þessari síðu.",
- "site.local": "Staðbundinn netþjónn",
- "site.local.description": "Staðbundin vefföng opnast á vélinni sem keyrir OpenCode-netþjóninn.",
"site.file": "Skrá á vinnusvæði",
"site.file.description": "Aðeins skrár innan vinnusvæðis þessarar setu geta opnast hér.",
- "site.network": "Síður hlaðast í gegnum net {{server}}.",
"site.cookies": "Vafrakökur og vefsvæðisgögn",
"site.cookies.count.one": "{{count}} vafrakaka í notkun",
"site.cookies.count.other": "{{count}} vafrakökur í notkun",
"site.cookies.clear": "Hreinsa",
"site.permissions": "Heimildir eru lokaðar",
"site.permissions.description": "Myndavél, hljóðnemi, staðsetning og tilkynningar virka ekki í þessum vafra.",
- "site.agent": "Fulltrúinn getur notað þessa síðu",
- "site.agent.description": "Hann getur lesið síðuna, keyrt skriftur og fyllt út eyðublöð.",
"page.add": "Bæta síðu við setu",
- "page.placeholder": "Bættu við samhengi um þessa síðu",
- "external.open": "Opna í kerfisvafra",
- "external.menu": "Opna í vafra",
- "external.unavailable": "Þetta veffang virkar aðeins á vél netþjónsins.",
options: "Valkostir vafra",
"zoom.in": "Auka aðdrátt",
"zoom.out": "Minnka aðdrátt",
diff --git a/packages/gui-plugins/src/browser/i18n/it.ts b/packages/gui-plugins/src/browser/i18n/it.ts
index cef21ecbbe53..db1258420973 100644
--- a/packages/gui-plugins/src/browser/i18n/it.ts
+++ b/packages/gui-plugins/src/browser/i18n/it.ts
@@ -4,31 +4,18 @@ export default {
"tab.title": "Navigatore",
"address.label": "Indirizzo del browser",
"action.stop": "Interrompi",
- replaced: "Il controllo del browser è stato spostato su un'altra finestra del desktop.",
unsupported: "Questa app desktop non supporta il pannello del browser.",
- suspended: "Browser sospeso. Interagisci con questa sessione per riconnetterti.",
- "failed.title": "Impossibile raggiungere l’URL",
- "failed.description": "Controlla l’URL e la connessione, quindi riprova.",
"action.reload": "Ricarica",
"model.timedOut": "Il browser ha impiegato troppo tempo a caricarsi",
- "command.inspect": "Seleziona un elemento nella pagina del browser",
- "command.address": "Attiva la barra degli indirizzi del browser",
"command.close": "Chiudi scheda del browser",
"command.newTab": "Nuova scheda del browser",
"tab.new": "Nuova scheda",
- "address.search": "Cerca o inserisci un URL",
"address.suggestions": "Suggerimenti",
"refused.web": "Qui si possono aprire solo pagine web.",
"refused.workspace":
"Qui si possono aprire solo pagine web e file all'interno dell'area di lavoro di questa sessione.",
"refused.credentials": "Gli indirizzi con nome utente o password non possono essere aperti qui.",
- inspect: "Seleziona un elemento da commentare",
- "inspect.active": "Fai clic su un elemento della pagina per commentarlo. Premi Esc per annullare.",
- "comment.label": "Commenta questo elemento",
"comment.placeholder": "Aggiungi un commento facoltativo...",
- "comment.cancel": "Annulla commento all'elemento",
- "comment.submit": "Aggiungi commento all'elemento",
- "comment.attach": "Aggiungi elemento",
"comment.annotation": "Annotazione del browser",
"home.title": "Apri una pagina",
"home.description": "Visualizza in anteprima la tua app, leggi la documentazione o naviga sul web.",
@@ -37,24 +24,15 @@ export default {
"site.secure": "La connessione è sicura",
"site.insecure": "La connessione non è sicura",
"site.insecure.description": "Non inserire password o altre informazioni private in questa pagina.",
- "site.local": "Server locale",
- "site.local.description": "Gli indirizzi locali si aprono sulla macchina che esegue il server OpenCode.",
"site.file": "File dell'area di lavoro",
"site.file.description": "Qui si possono aprire solo i file all'interno dell'area di lavoro di questa sessione.",
- "site.network": "Le pagine vengono caricate tramite la rete di {{server}}.",
"site.cookies": "Cookie e dati dei siti",
"site.cookies.count.one": "{{count}} cookie in uso",
"site.cookies.count.other": "{{count}} cookie in uso",
"site.cookies.clear": "Cancella",
"site.permissions": "Le autorizzazioni sono bloccate",
"site.permissions.description": "Fotocamera, microfono, posizione e notifiche non funzionano in questo browser.",
- "site.agent": "L'agente può usare questa pagina",
- "site.agent.description": "Può leggere la pagina, eseguire script e compilare moduli.",
"page.add": "Aggiungi pagina alla sessione",
- "page.placeholder": "Aggiungi contesto su questa pagina",
- "external.open": "Apri nel browser di sistema",
- "external.menu": "Apri nel browser",
- "external.unavailable": "Questo indirizzo funziona solo sulla macchina del server.",
options: "Opzioni del browser",
"zoom.in": "Ingrandisci",
"zoom.out": "Riduci",
diff --git a/packages/gui-plugins/src/browser/i18n/ja.ts b/packages/gui-plugins/src/browser/i18n/ja.ts
index f742031a9f3f..8ff7999ab4bc 100644
--- a/packages/gui-plugins/src/browser/i18n/ja.ts
+++ b/packages/gui-plugins/src/browser/i18n/ja.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ブラウザー",
"address.label": "ブラウザーのアドレス",
"action.stop": "停止",
- replaced: "ブラウザー制御が別のデスクトップウィンドウに移動しました。",
unsupported: "このデスクトップアプリはブラウザペインをサポートしていません。",
- suspended: "ブラウザーが一時停止しました。このセッションと対話して再接続してください。",
- "failed.title": "URLにアクセスできません",
- "failed.description": "URLと接続を確認して、もう一度お試しください。",
"action.reload": "再読み込み",
"model.timedOut": "ブラウザーの読み込みに時間がかかりすぎました",
- "command.inspect": "ブラウザーのページで要素を選択",
- "command.address": "ブラウザーのアドレスバーにフォーカス",
"command.close": "ブラウザータブを閉じる",
"command.newTab": "新しいブラウザータブ",
"tab.new": "新しいタブ",
- "address.search": "検索またはURLを入力",
"address.suggestions": "候補",
"refused.web": "ここで開けるのはWebページのみです。",
"refused.workspace": "ここで開けるのは、Webページとこのセッションのワークスペース内のファイルのみです。",
"refused.credentials": "ユーザー名またはパスワードを含むアドレスはここでは開けません。",
- inspect: "コメントする要素を選択",
- "inspect.active": "ページ内の要素をクリックしてコメントします。キャンセルするにはEscapeキーを押してください。",
- "comment.label": "この要素にコメント",
"comment.placeholder": "コメントを追加(任意)…",
- "comment.cancel": "要素へのコメントをキャンセル",
- "comment.submit": "要素へのコメントを追加",
- "comment.attach": "要素を追加",
"comment.annotation": "ブラウザーの注釈",
"home.title": "ページを開く",
"home.description": "アプリをプレビューしたり、ドキュメントを読んだり、Webを閲覧したりできます。",
@@ -36,24 +23,15 @@ export default {
"site.secure": "接続は保護されています",
"site.insecure": "接続は保護されていません",
"site.insecure.description": "このページではパスワードなどの個人情報を入力しないでください。",
- "site.local": "ローカルサーバー",
- "site.local.description": "ローカルアドレスは、OpenCodeサーバーを実行しているマシン上で開かれます。",
"site.file": "ワークスペースのファイル",
"site.file.description": "ここで開けるのは、このセッションのワークスペース内のファイルのみです。",
- "site.network": "ページは{{server}}のネットワーク経由で読み込まれます。",
"site.cookies": "Cookieとサイトデータ",
"site.cookies.count.one": "{{count}}個のCookieを使用中",
"site.cookies.count.other": "{{count}}個のCookieを使用中",
"site.cookies.clear": "消去",
"site.permissions": "権限はブロックされています",
"site.permissions.description": "このブラウザーでは、カメラ、マイク、位置情報、通知は機能しません。",
- "site.agent": "エージェントはこのページを使用できます",
- "site.agent.description": "ページの読み取り、スクリプトの実行、フォームへの入力ができます。",
"page.add": "ページをセッションに追加",
- "page.placeholder": "このページに関するコンテキストを追加",
- "external.open": "システムのブラウザーで開く",
- "external.menu": "ブラウザーで開く",
- "external.unavailable": "このアドレスはサーバーのマシン上でのみ機能します。",
options: "ブラウザーのオプション",
"zoom.in": "拡大",
"zoom.out": "縮小",
diff --git a/packages/gui-plugins/src/browser/i18n/ka.ts b/packages/gui-plugins/src/browser/i18n/ka.ts
index a3290083b706..23b645287f28 100644
--- a/packages/gui-plugins/src/browser/i18n/ka.ts
+++ b/packages/gui-plugins/src/browser/i18n/ka.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ბრაუზერი",
"address.label": "ბრაუზერის მისამართი",
"action.stop": "შეჩერება",
- replaced: "ბრაუზერის კონტროლი გადანაცვლდა სხვა დესკტოპის ფანჯარაში.",
unsupported: "დესკტოპის ეს აპი ბრაუზერის პანელს არ უჭერს მხარს.",
- suspended: "ბრაუზერი შეჩერებულია. გამართეთ ინტერაქცია ამ სესიასთან, რათა კვლავ დაუკავშირდეთ.",
- "failed.title": "URL მიუწვდომელია",
- "failed.description": "შეამოწმეთ URL და კავშირი, შემდეგ ხელახლა სცადეთ.",
"action.reload": "ხელახლა ჩატვირთვა",
"model.timedOut": "ბრაუზერის ჩატვირთვას ძალიან დიდი დრო დასჭირდა",
- "command.inspect": "ელემენტის არჩევა ბრაუზერის გვერდზე",
- "command.address": "ბრაუზერის მისამართის ზოლზე ფოკუსი",
"command.close": "ბრაუზერის ჩანართის დახურვა",
"command.newTab": "ბრაუზერის ახალი ჩანართი",
"tab.new": "ახალი ჩანართი",
- "address.search": "მოძებნეთ ან შეიყვანეთ URL",
"address.suggestions": "შეთავაზებები",
"refused.web": "აქ მხოლოდ ვებგვერდების გახსნაა შესაძლებელი.",
"refused.workspace": "აქ მხოლოდ ვებგვერდებისა და ამ სესიის სამუშაო სივრცის ფაილების გახსნაა შესაძლებელი.",
"refused.credentials": "მომხმარებლის სახელის ან პაროლის შემცველი მისამართები აქ ვერ გაიხსნება.",
- inspect: "აირჩიეთ ელემენტი კომენტარისთვის",
- "inspect.active": "კომენტარისთვის დააწკაპუნეთ ელემენტზე გვერდზე. გასაუქმებლად დააჭირეთ Escape-ს.",
- "comment.label": "ამ ელემენტზე კომენტარი",
"comment.placeholder": "დაამატეთ კომენტარი (არასავალდებულო)...",
- "comment.cancel": "ელემენტის კომენტარის გაუქმება",
- "comment.submit": "ელემენტის კომენტარის დამატება",
- "comment.attach": "ელემენტის დამატება",
"comment.annotation": "ბრაუზერის ანოტაცია",
"home.title": "გახსენით გვერდი",
"home.description": "გადახედეთ თქვენს აპს, წაიკითხეთ დოკუმენტაცია ან დაათვალიერეთ ვები.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "კავშირი დაცულია",
"site.insecure": "კავშირი დაცული არ არის",
"site.insecure.description": "ამ გვერდზე არ შეიყვანოთ პაროლები ან სხვა პირადი ინფორმაცია.",
- "site.local": "ლოკალური სერვერი",
- "site.local.description": "ლოკალური მისამართები იხსნება იმ კომპიუტერზე, სადაც OpenCode-ის სერვერი მუშაობს.",
"site.file": "სამუშაო სივრცის ფაილი",
"site.file.description": "აქ მხოლოდ ამ სესიის სამუშაო სივრცის ფაილების გახსნაა შესაძლებელი.",
- "site.network": "გვერდები იტვირთება {{server}}-ის ქსელის მეშვეობით.",
"site.cookies": "ქუქი-ფაილები და საიტის მონაცემები",
"site.cookies.count.one": "გამოიყენება {{count}} ქუქი-ფაილი",
"site.cookies.count.other": "გამოიყენება {{count}} ქუქი-ფაილი",
"site.cookies.clear": "გასუფთავება",
"site.permissions": "ნებართვები დაბლოკილია",
"site.permissions.description": "კამერა, მიკროფონი, მდებარეობა და შეტყობინებები ამ ბრაუზერში არ მუშაობს.",
- "site.agent": "აგენტს შეუძლია ამ გვერდის გამოყენება",
- "site.agent.description": "მას შეუძლია გვერდის წაკითხვა, სკრიპტების გაშვება და ფორმების შევსება.",
"page.add": "გვერდის სესიაში დამატება",
- "page.placeholder": "დაამატეთ კონტექსტი ამ გვერდის შესახებ",
- "external.open": "სისტემის ბრაუზერში გახსნა",
- "external.menu": "ბრაუზერში გახსნა",
- "external.unavailable": "ეს მისამართი მხოლოდ სერვერის კომპიუტერზე მუშაობს.",
options: "ბრაუზერის პარამეტრები",
"zoom.in": "გადიდება",
"zoom.out": "შემცირება",
diff --git a/packages/gui-plugins/src/browser/i18n/km.ts b/packages/gui-plugins/src/browser/i18n/km.ts
index e75028d38296..48defcbbc0fe 100644
--- a/packages/gui-plugins/src/browser/i18n/km.ts
+++ b/packages/gui-plugins/src/browser/i18n/km.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "កម្មវិធីរុករក",
"address.label": "អាសយដ្ឋានកម្មវិធីរុករក",
"action.stop": "ឈប់",
- replaced: "ការត្រួតពិនិត្យរុករកបានផ្លាស់ទៅវីនដូតែមួយផ្សេងទៀតលើឌេស្គ្ទុប។",
unsupported: "កម្មវិធីដេស្គ្ទុបនេះមិនគាំទ្របានផ្ទាំងរុករកទេ។",
- suspended: "កម្មវិធីរុករកបានផ្អាក។ សូមអន្តរកម្មជាមួយសម័យនេះដើម្បីភ្ជាប់ឡើងវិញ។",
- "failed.title": "មិនអាចចូលដល់ URL បានទេ",
- "failed.description": "ពិនិត្យ URL និងការតភ្ជាប់របស់អ្នក រួចសាកល្បងម្តងទៀត។",
"action.reload": "ផ្ទុកឡើងវិញ",
"model.timedOut": "កម្មវិធីរុករកចំណាយពេលយូរពេកក្នុងការផ្ទុក",
- "command.inspect": "ជ្រើសធាតុមួយក្នុងទំព័រកម្មវិធីរុករក",
- "command.address": "ផ្តោតលើអាសយដ្ឋានកម្មវិធីរុករក",
"command.close": "បិទផ្ទាំងកម្មវិធីរុករក",
"command.newTab": "ផ្ទាំងកម្មវិធីរុករកថ្មី",
"tab.new": "ផ្ទាំងថ្មី",
- "address.search": "ស្វែងរក ឬបញ្ចូល URL",
"address.suggestions": "ការណែនាំ",
"refused.web": "មានតែទំព័របណ្ដាញប៉ុណ្ណោះដែលអាចបើកនៅទីនេះ។",
"refused.workspace": "មានតែទំព័របណ្ដាញ និងឯកសារក្នុងកន្លែងធ្វើការរបស់សម័យនេះប៉ុណ្ណោះដែលអាចបើកនៅទីនេះ។",
"refused.credentials": "អាសយដ្ឋានដែលមានឈ្មោះអ្នកប្រើ ឬពាក្យសម្ងាត់មិនអាចបើកនៅទីនេះបានទេ។",
- inspect: "ជ្រើសធាតុមួយដើម្បីបញ្ចេញមតិ",
- "inspect.active": "ចុចលើធាតុមួយក្នុងទំព័រដើម្បីបញ្ចេញមតិលើវា។ ចុច Escape ដើម្បីបោះបង់។",
- "comment.label": "បញ្ចេញមតិលើធាតុនេះ",
"comment.placeholder": "បន្ថែមមតិ (ជាជម្រើស)...",
- "comment.cancel": "បោះបង់មតិលើធាតុ",
- "comment.submit": "បន្ថែមមតិលើធាតុ",
- "comment.attach": "បន្ថែមធាតុ",
"comment.annotation": "ចំណារពន្យល់កម្មវិធីរុករក",
"home.title": "បើកទំព័រ",
"home.description": "មើលកម្មវិធីរបស់អ្នកជាមុន អានឯកសារ ឬរុករកបណ្ដាញ។",
@@ -36,24 +23,15 @@ export default {
"site.secure": "ការតភ្ជាប់មានសុវត្ថិភាព",
"site.insecure": "ការតភ្ជាប់មិនមានសុវត្ថិភាព",
"site.insecure.description": "កុំបញ្ចូលពាក្យសម្ងាត់ ឬព័ត៌មានឯកជនផ្សេងទៀតនៅលើទំព័រនេះ។",
- "site.local": "ម៉ាស៊ីនមេមូលដ្ឋាន",
- "site.local.description": "អាសយដ្ឋានមូលដ្ឋានបើកនៅលើម៉ាស៊ីនដែលដំណើរការម៉ាស៊ីនមេ OpenCode។",
"site.file": "ឯកសារកន្លែងធ្វើការ",
"site.file.description": "មានតែឯកសារក្នុងកន្លែងធ្វើការរបស់សម័យនេះប៉ុណ្ណោះដែលអាចបើកនៅទីនេះ។",
- "site.network": "ទំព័រផ្ទុកតាមរយៈបណ្ដាញរបស់ {{server}}។",
"site.cookies": "ខូគី និងទិន្នន័យគេហទំព័រ",
"site.cookies.count.one": "កំពុងប្រើខូគី {{count}}",
"site.cookies.count.other": "កំពុងប្រើខូគី {{count}}",
"site.cookies.clear": "សម្អាត",
"site.permissions": "ការអនុញ្ញាតត្រូវបានរារាំង",
"site.permissions.description": "កាមេរ៉ា មីក្រូហ្វូន ទីតាំង និងការជូនដំណឹង មិនដំណើរការក្នុងកម្មវិធីរុករកនេះទេ។",
- "site.agent": "ភ្នាក់ងារអាចប្រើទំព័រនេះ",
- "site.agent.description": "វាអាចអានទំព័រ ដំណើរការស្គ្រីប និងបំពេញទម្រង់។",
"page.add": "បន្ថែមទំព័រទៅសម័យ",
- "page.placeholder": "បន្ថែមបរិបទអំពីទំព័រនេះ",
- "external.open": "បើកក្នុងកម្មវិធីរុករកប្រព័ន្ធ",
- "external.menu": "បើកក្នុងកម្មវិធីរុករក",
- "external.unavailable": "អាសយដ្ឋាននេះដំណើរការតែនៅលើម៉ាស៊ីនរបស់ម៉ាស៊ីនមេប៉ុណ្ណោះ។",
options: "ជម្រើសកម្មវិធីរុករក",
"zoom.in": "ពង្រីក",
"zoom.out": "បង្រួម",
diff --git a/packages/gui-plugins/src/browser/i18n/ko.ts b/packages/gui-plugins/src/browser/i18n/ko.ts
index 46334a8e732b..87311d81b814 100644
--- a/packages/gui-plugins/src/browser/i18n/ko.ts
+++ b/packages/gui-plugins/src/browser/i18n/ko.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "브라우저",
"address.label": "브라우저 주소",
"action.stop": "중지",
- replaced: "브라우저 제어가 다른 데스크톱 창으로 이동되었습니다.",
unsupported: "이 데스크톱 앱은 브라우저 창을 지원하지 않습니다.",
- suspended: "브라우저가 일시 중지되었습니다. 다시 연결하려면 이 세션과 상호작용하세요.",
- "failed.title": "URL에 연결할 수 없음",
- "failed.description": "URL과 연결을 확인한 후 다시 시도하세요.",
"action.reload": "다시 로드",
"model.timedOut": "브라우저를 불러오는 데 시간이 너무 오래 걸렸습니다",
- "command.inspect": "브라우저 페이지에서 요소 선택",
- "command.address": "브라우저 주소창에 포커스",
"command.close": "브라우저 탭 닫기",
"command.newTab": "새 브라우저 탭",
"tab.new": "새 탭",
- "address.search": "검색어 또는 URL 입력",
"address.suggestions": "추천",
"refused.web": "여기서는 웹 페이지만 열 수 있습니다.",
"refused.workspace": "여기서는 웹 페이지와 이 세션의 작업 공간 내 파일만 열 수 있습니다.",
"refused.credentials": "사용자 이름이나 비밀번호가 포함된 주소는 여기서 열 수 없습니다.",
- inspect: "댓글을 달 요소 선택",
- "inspect.active": "댓글을 달 요소를 페이지에서 클릭하세요. 취소하려면 Escape 키를 누르세요.",
- "comment.label": "이 요소에 댓글 달기",
"comment.placeholder": "댓글 추가 (선택 사항)...",
- "comment.cancel": "요소 댓글 취소",
- "comment.submit": "요소 댓글 추가",
- "comment.attach": "요소 추가",
"comment.annotation": "브라우저 주석",
"home.title": "페이지 열기",
"home.description": "앱을 미리 보거나, 문서를 읽거나, 웹을 탐색하세요.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "안전한 연결입니다",
"site.insecure": "안전하지 않은 연결입니다",
"site.insecure.description": "이 페이지에 비밀번호나 기타 개인 정보를 입력하지 마세요.",
- "site.local": "로컬 서버",
- "site.local.description": "로컬 주소는 OpenCode 서버를 실행하는 컴퓨터에서 열립니다.",
"site.file": "작업 공간 파일",
"site.file.description": "여기서는 이 세션의 작업 공간 내 파일만 열 수 있습니다.",
- "site.network": "페이지는 {{server}}의 네트워크를 통해 로드됩니다.",
"site.cookies": "쿠키 및 사이트 데이터",
"site.cookies.count.one": "쿠키 {{count}}개 사용 중",
"site.cookies.count.other": "쿠키 {{count}}개 사용 중",
"site.cookies.clear": "지우기",
"site.permissions": "권한이 차단됨",
"site.permissions.description": "이 브라우저에서는 카메라, 마이크, 위치, 알림이 작동하지 않습니다.",
- "site.agent": "에이전트가 이 페이지를 사용할 수 있음",
- "site.agent.description": "페이지를 읽고, 스크립트를 실행하고, 양식을 작성할 수 있습니다.",
"page.add": "세션에 페이지 추가",
- "page.placeholder": "이 페이지에 대한 컨텍스트 추가",
- "external.open": "시스템 브라우저에서 열기",
- "external.menu": "브라우저에서 열기",
- "external.unavailable": "이 주소는 서버 컴퓨터에서만 작동합니다.",
options: "브라우저 옵션",
"zoom.in": "확대",
"zoom.out": "축소",
diff --git a/packages/gui-plugins/src/browser/i18n/lo.ts b/packages/gui-plugins/src/browser/i18n/lo.ts
index 706bd0cf2fab..88221a9369e0 100644
--- a/packages/gui-plugins/src/browser/i18n/lo.ts
+++ b/packages/gui-plugins/src/browser/i18n/lo.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ເບຣາວເຊີ",
"address.label": "ທີ່ຢູ່ເບຣາວເຊີ",
"action.stop": "ຢຸດ",
- replaced: "ການຄວບຄຸມເບຣາວເຊີໄດ້ຍ້າຍໄປຢູ່ຫນ້າຕ່າງເດສທັອບອື່ນ.",
unsupported: "ແອັບເດສທັອບນີ້ບໍ່ຮອງຮັບແຖບບຣາວເຊີ.",
- suspended: "ເບຣາວເຊີຖືກລະງັບ.ປະຕິບັດກັບ session ນີ້ເພື່ອເຊື່ອມຕໍ່ອີກຄັ້ງ.",
- "failed.title": "ເຂົ້າເຖິງ URL ບໍ່ໄດ້",
- "failed.description": "ກວດສອບ URL ແລະການເຊື່ອມຕໍ່ ແລ້ວລອງໃໝ່.",
"action.reload": "ໂຫຼດຄືນໃໝ່",
"model.timedOut": "ເບຣາວເຊີໃຊ້ເວລາໂຫຼດດົນເກີນໄປ",
- "command.inspect": "ເລືອກອົງປະກອບໃນໜ້າເບຣາວເຊີ",
- "command.address": "ໂຟກັສທີ່ຢູ່ເບຣາວເຊີ",
"command.close": "ປິດແຖບເບຣາວເຊີ",
"command.newTab": "ແຖບເບຣາວເຊີໃໝ່",
"tab.new": "ແຖບໃໝ່",
- "address.search": "ຄົ້ນຫາ ຫຼືໃສ່ URL",
"address.suggestions": "ຄຳແນະນຳ",
"refused.web": "ເປີດໄດ້ສະເພາະໜ້າເວັບຢູ່ທີ່ນີ້.",
"refused.workspace": "ເປີດໄດ້ສະເພາະໜ້າເວັບ ແລະໄຟລ໌ພາຍໃນພື້ນທີ່ເຮັດວຽກຂອງເຊດຊັນນີ້ຢູ່ທີ່ນີ້.",
"refused.credentials": "ທີ່ຢູ່ທີ່ມີຊື່ຜູ້ໃຊ້ ຫຼືລະຫັດຜ່ານບໍ່ສາມາດເປີດຢູ່ທີ່ນີ້ໄດ້.",
- inspect: "ເລືອກອົງປະກອບເພື່ອໃສ່ຄຳເຫັນ",
- "inspect.active": "ຄລິກອົງປະກອບໃນໜ້າເພື່ອໃສ່ຄຳເຫັນ. ກົດ Escape ເພື່ອຍົກເລີກ.",
- "comment.label": "ໃສ່ຄຳເຫັນກ່ຽວກັບອົງປະກອບນີ້",
"comment.placeholder": "ເພີ່ມຄຳເຫັນ (ທາງເລືອກ)...",
- "comment.cancel": "ຍົກເລີກຄຳເຫັນອົງປະກອບ",
- "comment.submit": "ເພີ່ມຄຳເຫັນອົງປະກອບ",
- "comment.attach": "ເພີ່ມອົງປະກອບ",
"comment.annotation": "ໝາຍເຫດເບຣາວເຊີ",
"home.title": "ເປີດໜ້າ",
"home.description": "ເບິ່ງຕົວຢ່າງແອັບຂອງທ່ານ, ອ່ານເອກະສານ ຫຼືທ່ອງເວັບ.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "ການເຊື່ອມຕໍ່ປອດໄພ",
"site.insecure": "ການເຊື່ອມຕໍ່ບໍ່ປອດໄພ",
"site.insecure.description": "ຢ່າໃສ່ລະຫັດຜ່ານ ຫຼືຂໍ້ມູນສ່ວນຕົວອື່ນໃນໜ້ານີ້.",
- "site.local": "ເຊີບເວີທ້ອງຖິ່ນ",
- "site.local.description": "ທີ່ຢູ່ທ້ອງຖິ່ນຈະເປີດໃນເຄື່ອງທີ່ແລ່ນເຊີບເວີ OpenCode.",
"site.file": "ໄຟລ໌ໃນພື້ນທີ່ເຮັດວຽກ",
"site.file.description": "ເປີດໄດ້ສະເພາະໄຟລ໌ພາຍໃນພື້ນທີ່ເຮັດວຽກຂອງເຊດຊັນນີ້ຢູ່ທີ່ນີ້.",
- "site.network": "ໜ້າເວັບໂຫຼດຜ່ານເຄືອຂ່າຍຂອງ {{server}}.",
"site.cookies": "ຄຸກກີ້ ແລະຂໍ້ມູນເວັບໄຊ",
"site.cookies.count.one": "ກຳລັງໃຊ້ຄຸກກີ້ {{count}} ລາຍການ",
"site.cookies.count.other": "ກຳລັງໃຊ້ຄຸກກີ້ {{count}} ລາຍການ",
"site.cookies.clear": "ລ້າງ",
"site.permissions": "ການອະນຸຍາດຖືກບລັອກ",
"site.permissions.description": "ກ້ອງ, ໄມໂຄຣໂຟນ, ຕຳແໜ່ງ ແລະການແຈ້ງເຕືອນບໍ່ເຮັດວຽກໃນເບຣາວເຊີນີ້.",
- "site.agent": "ຕົວແທນສາມາດໃຊ້ໜ້ານີ້ໄດ້",
- "site.agent.description": "ມັນສາມາດອ່ານໜ້າ, ແລ່ນສະຄຣິບ ແລະກອກແບບຟອມໄດ້.",
"page.add": "ເພີ່ມໜ້າໃສ່ເຊດຊັນ",
- "page.placeholder": "ເພີ່ມບໍລິບົດກ່ຽວກັບໜ້ານີ້",
- "external.open": "ເປີດໃນເບຣາວເຊີຂອງລະບົບ",
- "external.menu": "ເປີດໃນເບຣາວເຊີ",
- "external.unavailable": "ທີ່ຢູ່ນີ້ໃຊ້ໄດ້ສະເພາະໃນເຄື່ອງຂອງເຊີບເວີເທົ່ານັ້ນ.",
options: "ຕົວເລືອກເບຣາວເຊີ",
"zoom.in": "ຊູມເຂົ້າ",
"zoom.out": "ຊູມອອກ",
diff --git a/packages/gui-plugins/src/browser/i18n/lt.ts b/packages/gui-plugins/src/browser/i18n/lt.ts
index de30a5932cd3..3ac36a717360 100644
--- a/packages/gui-plugins/src/browser/i18n/lt.ts
+++ b/packages/gui-plugins/src/browser/i18n/lt.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Naršyklė",
"address.label": "Naršyklės adresas",
"action.stop": "Stabdyti",
- replaced: "Naršyklės valdymas perkeltas į kitą darbalaukio langą.",
unsupported: "Ši darbalaukio programa nepalaiko naršyklės srities.",
- suspended: "Naršyklė sustabdyta. Norėdami vėl prisijungti, sąveikaukite su šia sesija.",
- "failed.title": "URL nepasiekiamas",
- "failed.description": "Patikrinkite URL bei ryšį ir bandykite dar kartą.",
"action.reload": "Įkelti iš naujo",
"model.timedOut": "Naršyklė per ilgai įsikėlė",
- "command.inspect": "Pasirinkti elementą naršyklės puslapyje",
- "command.address": "Fokusuoti naršyklės adreso juostą",
"command.close": "Uždaryti naršyklės skirtuką",
"command.newTab": "Naujas naršyklės skirtukas",
"tab.new": "Naujas skirtukas",
- "address.search": "Ieškokite arba įveskite URL",
"address.suggestions": "Pasiūlymai",
"refused.web": "Čia galima atverti tik tinklalapius.",
"refused.workspace": "Čia galima atverti tik tinklalapius ir failus iš šio seanso darbo srities.",
"refused.credentials": "Adresų su naudotojo vardu ar slaptažodžiu čia atverti negalima.",
- inspect: "Pasirinkite elementą, kurį norite komentuoti",
- "inspect.active": "Spustelėkite puslapio elementą, kad jį pakomentuotumėte. Paspauskite Escape, kad atšauktumėte.",
- "comment.label": "Komentuoti šį elementą",
"comment.placeholder": "Pridėkite komentarą (neprivaloma)...",
- "comment.cancel": "Atšaukti elemento komentarą",
- "comment.submit": "Pridėti elemento komentarą",
- "comment.attach": "Pridėti elementą",
"comment.annotation": "Naršyklės anotacija",
"home.title": "Atverkite puslapį",
"home.description": "Peržiūrėkite savo programą, skaitykite dokumentaciją arba naršykite internete.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Ryšys saugus",
"site.insecure": "Ryšys nesaugus",
"site.insecure.description": "Šiame puslapyje neįveskite slaptažodžių ar kitos privačios informacijos.",
- "site.local": "Vietinis serveris",
- "site.local.description": "Vietiniai adresai atveriami kompiuteryje, kuriame veikia OpenCode serveris.",
"site.file": "Darbo srities failas",
"site.file.description": "Čia galima atverti tik failus iš šio seanso darbo srities.",
- "site.network": "Puslapiai įkeliami per {{server}} tinklą.",
"site.cookies": "Slapukai ir svetainės duomenys",
"site.cookies.count.one": "Naudojamas {{count}} slapukas",
"site.cookies.count.few": "Naudojami {{count}} slapukai",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Išvalyti",
"site.permissions": "Leidimai užblokuoti",
"site.permissions.description": "Kamera, mikrofonas, vietovė ir pranešimai šioje naršyklėje neveikia.",
- "site.agent": "Agentas gali naudoti šį puslapį",
- "site.agent.description": "Jis gali skaityti puslapį, vykdyti scenarijus ir pildyti formas.",
"page.add": "Pridėti puslapį prie seanso",
- "page.placeholder": "Pridėkite kontekstą apie šį puslapį",
- "external.open": "Atverti sistemos naršyklėje",
- "external.menu": "Atverti naršyklėje",
- "external.unavailable": "Šis adresas veikia tik serverio kompiuteryje.",
options: "Naršyklės parinktys",
"zoom.in": "Priartinti",
"zoom.out": "Nutolinti",
diff --git a/packages/gui-plugins/src/browser/i18n/lv.ts b/packages/gui-plugins/src/browser/i18n/lv.ts
index e8fdc25bbece..0bf96a38d120 100644
--- a/packages/gui-plugins/src/browser/i18n/lv.ts
+++ b/packages/gui-plugins/src/browser/i18n/lv.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Pārlūkprogramma",
"address.label": "Pārlūkprogrammas adrese",
"action.stop": "Apturēt",
- replaced: "Pārlūka vadība ir pārvietota uz citu darbvirsmas logu.",
unsupported: "Šī darbvirsmas lietotne neatbalsta pārlūkprogrammas rūti.",
- suspended: "Pārlūka darbība ir apturēta. Mijiedarbojieties ar šo sesiju, lai atjaunotu savienojumu.",
- "failed.title": "URL nav sasniedzams",
- "failed.description": "Pārbaudiet URL un savienojumu un mēģiniet vēlreiz.",
"action.reload": "Ielādēt atkārtoti",
"model.timedOut": "Pārlūkprogramma ielādējās pārāk ilgi",
- "command.inspect": "Atlasīt elementu pārlūkprogrammas lapā",
- "command.address": "Fokusēt pārlūkprogrammas adresi",
"command.close": "Aizvērt pārlūkprogrammas cilni",
"command.newTab": "Jauna pārlūkprogrammas cilne",
"tab.new": "Jauna cilne",
- "address.search": "Meklējiet vai ievadiet URL",
"address.suggestions": "Ieteikumi",
"refused.web": "Šeit var atvērt tikai tīmekļa lapas.",
"refused.workspace": "Šeit var atvērt tikai tīmekļa lapas un failus no šīs sesijas darbvietas.",
"refused.credentials": "Adreses ar lietotājvārdu vai paroli šeit nevar atvērt.",
- inspect: "Atlasiet elementu, ko komentēt",
- "inspect.active": "Noklikšķiniet uz elementa lapā, lai to komentētu. Nospiediet Escape, lai atceltu.",
- "comment.label": "Komentēt šo elementu",
"comment.placeholder": "Pievienojiet komentāru (nav obligāti)...",
- "comment.cancel": "Atcelt elementa komentāru",
- "comment.submit": "Pievienot elementa komentāru",
- "comment.attach": "Pievienot elementu",
"comment.annotation": "Pārlūkprogrammas anotācija",
"home.title": "Atvērt lapu",
"home.description": "Priekšskatiet savu lietotni, lasiet dokumentāciju vai pārlūkojiet tīmekli.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Savienojums ir drošs",
"site.insecure": "Savienojums nav drošs",
"site.insecure.description": "Neievadiet paroles vai citu privātu informāciju šajā lapā.",
- "site.local": "Lokālais serveris",
- "site.local.description": "Lokālās adreses tiek atvērtas datorā, kurā darbojas OpenCode serveris.",
"site.file": "Darbvietas fails",
"site.file.description": "Šeit var atvērt tikai failus no šīs sesijas darbvietas.",
- "site.network": "Lapas tiek ielādētas caur {{server}} tīklu.",
"site.cookies": "Sīkfaili un vietnes dati",
"site.cookies.count.zero": "Tiek izmantoti {{count}} sīkfaili",
"site.cookies.count.one": "Tiek izmantots {{count}} sīkfails",
@@ -48,13 +32,7 @@ export default {
"site.cookies.clear": "Notīrīt",
"site.permissions": "Atļaujas ir bloķētas",
"site.permissions.description": "Kamera, mikrofons, atrašanās vieta un paziņojumi šajā pārlūkprogrammā nedarbojas.",
- "site.agent": "Aģents var izmantot šo lapu",
- "site.agent.description": "Tas var lasīt lapu, izpildīt skriptus un aizpildīt veidlapas.",
"page.add": "Pievienot lapu sesijai",
- "page.placeholder": "Pievienojiet kontekstu par šo lapu",
- "external.open": "Atvērt sistēmas pārlūkprogrammā",
- "external.menu": "Atvērt pārlūkprogrammā",
- "external.unavailable": "Šī adrese darbojas tikai servera datorā.",
options: "Pārlūkprogrammas opcijas",
"zoom.in": "Tuvināt",
"zoom.out": "Tālināt",
diff --git a/packages/gui-plugins/src/browser/i18n/mk.ts b/packages/gui-plugins/src/browser/i18n/mk.ts
index ce006f16ccde..91c574cf4522 100644
--- a/packages/gui-plugins/src/browser/i18n/mk.ts
+++ b/packages/gui-plugins/src/browser/i18n/mk.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Прелистувач",
"address.label": "Адреса на прелистувач",
"action.stop": "Стоп",
- replaced: "Контролата на прелистувачот е преместена во друг прозорец на десктопот.",
unsupported: "Оваа десктоп апликација не поддржува панел за прелистувач.",
- suspended: "Прелистувачот е суспендиран. Интеракцијата со оваа сесија ќе овозможи повторно поврзување.",
- "failed.title": "URL-адресата не е достапна",
- "failed.description": "Проверете ги URL-адресата и врската, па обидете се повторно.",
"action.reload": "Превчитај",
"model.timedOut": "Прелистувачот се вчитува предолго",
- "command.inspect": "Избери елемент на страницата во прелистувачот",
- "command.address": "Фокусирај ја адресата на прелистувачот",
"command.close": "Затвори ја картичката на прелистувачот",
"command.newTab": "Нова картичка на прелистувачот",
"tab.new": "Нова картичка",
- "address.search": "Пребарајте или внесете URL",
"address.suggestions": "Предлози",
"refused.web": "Тука можат да се отвораат само веб-страници.",
"refused.workspace": "Тука можат да се отвораат само веб-страници и датотеки од работниот простор на оваа сесија.",
"refused.credentials": "Адреси со корисничко име или лозинка не можат да се отвораат тука.",
- inspect: "Изберете елемент за коментирање",
- "inspect.active": "Кликнете на елемент на страницата за да го коментирате. Притиснете Escape за откажување.",
- "comment.label": "Коментирај го овој елемент",
"comment.placeholder": "Додајте коментар по избор...",
- "comment.cancel": "Откажи го коментарот на елементот",
- "comment.submit": "Додај коментар на елементот",
- "comment.attach": "Додај елемент",
"comment.annotation": "Белешка од прелистувачот",
"home.title": "Отворете страница",
"home.description": "Прегледајте ја апликацијата, читајте документација или прелистувајте го вебот.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Врската е безбедна",
"site.insecure": "Врската не е безбедна",
"site.insecure.description": "Не внесувајте лозинки или други приватни информации на оваа страница.",
- "site.local": "Локален сервер",
- "site.local.description": "Локалните адреси се отвораат на машината на која работи OpenCode серверот.",
"site.file": "Датотека од работниот простор",
"site.file.description": "Тука можат да се отвораат само датотеки од работниот простор на оваа сесија.",
- "site.network": "Страниците се вчитуваат преку мрежата на {{server}}.",
"site.cookies": "Колачиња и податоци на страницата",
"site.cookies.count.one": "{{count}} колаче во употреба",
"site.cookies.count.other": "{{count}} колачиња во употреба",
"site.cookies.clear": "Избриши",
"site.permissions": "Дозволите се блокирани",
"site.permissions.description": "Камерата, микрофонот, локацијата и известувањата не работат во овој прелистувач.",
- "site.agent": "Агентот може да ја користи оваа страница",
- "site.agent.description": "Може да ја чита страницата, да извршува скрипти и да пополнува формулари.",
"page.add": "Додај ја страницата во сесијата",
- "page.placeholder": "Додајте контекст за оваа страница",
- "external.open": "Отвори во системскиот прелистувач",
- "external.menu": "Отвори во прелистувач",
- "external.unavailable": "Оваа адреса работи само на машината на серверот.",
options: "Опции на прелистувачот",
"zoom.in": "Зголеми",
"zoom.out": "Намали",
diff --git a/packages/gui-plugins/src/browser/i18n/mn.ts b/packages/gui-plugins/src/browser/i18n/mn.ts
index 23e851708ca6..b4fdfef203ac 100644
--- a/packages/gui-plugins/src/browser/i18n/mn.ts
+++ b/packages/gui-plugins/src/browser/i18n/mn.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Хөтөч",
"address.label": "Хөтчийн хаяг",
"action.stop": "Зогс",
- replaced: "Хөтчийн хяналт өөр ширээний цонхны руу шилжсэн.",
unsupported: "Энэ десктоп апп хөтчийн самбарыг дэмждэггүй.",
- suspended: "Браузер түр зогсоогдлоо. Дахин холбогдохын тулд энэ сесситэй харьцана уу.",
- "failed.title": "URL-д хандах боломжгүй",
- "failed.description": "URL болон холболтоо шалгаад дахин оролдоно уу.",
"action.reload": "Дахин ачаалах",
"model.timedOut": "Хөтөч ачаалахад хэт удлаа",
- "command.inspect": "Хөтчийн хуудаснаас элемент сонгох",
- "command.address": "Хөтчийн хаягийн мөрөнд фокуслах",
"command.close": "Хөтчийн табыг хаах",
"command.newTab": "Хөтчийн шинэ таб",
"tab.new": "Шинэ таб",
- "address.search": "Хайх эсвэл URL оруулах",
"address.suggestions": "Санал болголтууд",
"refused.web": "Энд зөвхөн вэб хуудас нээгдэнэ.",
"refused.workspace": "Энд зөвхөн вэб хуудас болон энэ сессийн ажлын талбар доторх файлууд нээгдэнэ.",
"refused.credentials": "Хэрэглэгчийн нэр эсвэл нууц үгтэй хаягууд энд нээгдэхгүй.",
- inspect: "Сэтгэгдэл бичих элемент сонгох",
- "inspect.active": "Сэтгэгдэл бичихийн тулд хуудсан дээрх элемент дээр дарна уу. Цуцлахын тулд Escape дарна уу.",
- "comment.label": "Энэ элементэд сэтгэгдэл бичих",
"comment.placeholder": "Сэтгэгдэл нэмэх (заавал биш)...",
- "comment.cancel": "Элементийн сэтгэгдлийг цуцлах",
- "comment.submit": "Элементийн сэтгэгдэл нэмэх",
- "comment.attach": "Элемент нэмэх",
"comment.annotation": "Хөтчийн тэмдэглэгээ",
"home.title": "Хуудас нээх",
"home.description": "Аппаа урьдчилан харах, баримт бичиг унших эсвэл вэбээр аялах.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Холболт аюулгүй",
"site.insecure": "Холболт аюулгүй биш",
"site.insecure.description": "Энэ хуудсанд нууц үг эсвэл бусад хувийн мэдээлэл бүү оруулаарай.",
- "site.local": "Дотоод сервер",
- "site.local.description": "Дотоод хаягууд OpenCode сервер ажиллаж буй машин дээр нээгдэнэ.",
"site.file": "Ажлын талбарын файл",
"site.file.description": "Энд зөвхөн энэ сессийн ажлын талбар доторх файлууд нээгдэнэ.",
- "site.network": "Хуудсууд {{server}}-ийн сүлжээгээр ачаалагдана.",
"site.cookies": "Күүки болон сайтын өгөгдөл",
"site.cookies.count.one": "{{count}} күүки ашиглагдаж байна",
"site.cookies.count.other": "{{count}} күүки ашиглагдаж байна",
"site.cookies.clear": "Цэвэрлэх",
"site.permissions": "Зөвшөөрлүүд хаагдсан",
"site.permissions.description": "Камер, микрофон, байршил болон мэдэгдлүүд энэ хөтөч дээр ажиллахгүй.",
- "site.agent": "Агент энэ хуудсыг ашиглаж болно",
- "site.agent.description": "Хуудсыг уншиж, скрипт ажиллуулж, маягт бөглөж чадна.",
"page.add": "Хуудсыг сесст нэмэх",
- "page.placeholder": "Энэ хуудасны талаар контекст нэмэх",
- "external.open": "Системийн хөтөч дээр нээх",
- "external.menu": "Хөтөч дээр нээх",
- "external.unavailable": "Энэ хаяг зөвхөн серверийн машин дээр ажиллана.",
options: "Хөтчийн сонголтууд",
"zoom.in": "Томруулах",
"zoom.out": "Жижигрүүлэх",
diff --git a/packages/gui-plugins/src/browser/i18n/ms.ts b/packages/gui-plugins/src/browser/i18n/ms.ts
index 6aed84da0751..3ca768f33449 100644
--- a/packages/gui-plugins/src/browser/i18n/ms.ts
+++ b/packages/gui-plugins/src/browser/i18n/ms.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Pelayar",
"address.label": "Alamat pelayar",
"action.stop": "Henti",
- replaced: "Kawalan pelayar dipindahkan ke tetingkap desktop lain.",
unsupported: "Aplikasi desktop ini tidak menyokong panel pelayar.",
- suspended: "Pelayar digantung. Berinteraksi dengan sesi ini untuk menyambung semula.",
- "failed.title": "URL tidak dapat dicapai",
- "failed.description": "Semak URL dan sambungan anda, kemudian cuba lagi.",
"action.reload": "Muat semula",
"model.timedOut": "Pelayar mengambil masa terlalu lama untuk dimuatkan",
- "command.inspect": "Pilih elemen dalam halaman pelayar",
- "command.address": "Fokus pada alamat pelayar",
"command.close": "Tutup tab pelayar",
"command.newTab": "Tab pelayar baharu",
"tab.new": "Tab baharu",
- "address.search": "Cari atau masukkan URL",
"address.suggestions": "Cadangan",
"refused.web": "Hanya halaman web boleh dibuka di sini.",
"refused.workspace": "Hanya halaman web dan fail dalam ruang kerja sesi ini boleh dibuka di sini.",
"refused.credentials": "Alamat yang mengandungi nama pengguna atau kata laluan tidak boleh dibuka di sini.",
- inspect: "Pilih elemen untuk diulas",
- "inspect.active": "Klik elemen dalam halaman untuk mengulasnya. Tekan Escape untuk membatalkan.",
- "comment.label": "Ulas elemen ini",
"comment.placeholder": "Tambah ulasan pilihan...",
- "comment.cancel": "Batalkan ulasan elemen",
- "comment.submit": "Tambah ulasan elemen",
- "comment.attach": "Tambah elemen",
"comment.annotation": "Anotasi pelayar",
"home.title": "Buka halaman",
"home.description": "Pratonton aplikasi anda, baca dokumentasi atau layari web.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Sambungan selamat",
"site.insecure": "Sambungan tidak selamat",
"site.insecure.description": "Jangan masukkan kata laluan atau maklumat peribadi lain pada halaman ini.",
- "site.local": "Pelayan setempat",
- "site.local.description": "Alamat setempat dibuka pada mesin yang menjalankan pelayan OpenCode.",
"site.file": "Fail ruang kerja",
"site.file.description": "Hanya fail dalam ruang kerja sesi ini boleh dibuka di sini.",
- "site.network": "Halaman dimuatkan melalui rangkaian {{server}}.",
"site.cookies": "Kuki dan data laman",
"site.cookies.count.one": "{{count}} kuki digunakan",
"site.cookies.count.other": "{{count}} kuki digunakan",
"site.cookies.clear": "Kosongkan",
"site.permissions": "Kebenaran disekat",
"site.permissions.description": "Kamera, mikrofon, lokasi dan pemberitahuan tidak berfungsi dalam pelayar ini.",
- "site.agent": "Ejen boleh menggunakan halaman ini",
- "site.agent.description": "Ia boleh membaca halaman, menjalankan skrip dan mengisi borang.",
"page.add": "Tambah halaman ke sesi",
- "page.placeholder": "Tambah konteks tentang halaman ini",
- "external.open": "Buka dalam pelayar sistem",
- "external.menu": "Buka dalam pelayar",
- "external.unavailable": "Alamat ini hanya berfungsi pada mesin pelayan.",
options: "Pilihan pelayar",
"zoom.in": "Zum masuk",
"zoom.out": "Zum keluar",
diff --git a/packages/gui-plugins/src/browser/i18n/my.ts b/packages/gui-plugins/src/browser/i18n/my.ts
index 17b4d52b1174..00ef8e2fe6f1 100644
--- a/packages/gui-plugins/src/browser/i18n/my.ts
+++ b/packages/gui-plugins/src/browser/i18n/my.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ဘရောက်ဇာ",
"address.label": "ဘရောက်ဇာလိပ်စာ",
"action.stop": "ရပ်ပါ။",
- replaced: "ဘရောက်ဇာ ထိန်းချုပ်မှုကို အခြားဒက်စ်ကတော့ပြင်ပ ပြတင်းပေါက်သို့ ရွှေ့လိုက်သည်။",
unsupported: "ဒီ desktop အက်ပ်သည် ဘရောက်ဇာပန်းကို မထောက်ပံ့ပါ။",
- suspended: "ဘရောက်ဇာ ရပ်ဆိုင်းထားပါသည်။ ထပ်မံချိတ်ဆက်ရန် ဒီအစည်းအဝေးနှင့် အပြန်အလှန် အပြုအမူ ပြုလုပ်ပါ။",
- "failed.title": "URL ကို ချိတ်ဆက်၍မရပါ",
- "failed.description": "URL နှင့် ချိတ်ဆက်မှုကို စစ်ဆေးပြီး ထပ်မံကြိုးစားပါ။",
"action.reload": "ပြန်လည်ဖွင့်ပါ",
"model.timedOut": "ဘရောက်ဇာ ဖွင့်ရန် အချိန်ကြာလွန်းသည်",
- "command.inspect": "ဘရောက်ဇာစာမျက်နှာရှိ element တစ်ခုကို ရွေးရန်",
- "command.address": "ဘရောက်ဇာလိပ်စာသို့ focus ထားရန်",
"command.close": "ဘရောက်ဇာတက်ဘ်ကို ပိတ်ရန်",
"command.newTab": "ဘရောက်ဇာတက်ဘ်အသစ်",
"tab.new": "တက်ဘ်အသစ်",
- "address.search": "ရှာပါ သို့မဟုတ် URL ထည့်ပါ",
"address.suggestions": "အကြံပြုချက်များ",
"refused.web": "ဝဘ်စာမျက်နှာများကိုသာ ဤနေရာတွင် ဖွင့်နိုင်သည်။",
"refused.workspace": "ဝဘ်စာမျက်နှာများနှင့် ဤစက်ရှင်၏ အလုပ်နေရာအတွင်းရှိ ဖိုင်များကိုသာ ဤနေရာတွင် ဖွင့်နိုင်သည်။",
"refused.credentials": "အသုံးပြုသူအမည် သို့မဟုတ် စကားဝှက်ပါသော လိပ်စာများကို ဤနေရာတွင် ဖွင့်၍ မရပါ။",
- inspect: "မှတ်ချက်ပေးရန် element တစ်ခုကို ရွေးပါ",
- "inspect.active": "မှတ်ချက်ပေးရန် စာမျက်နှာရှိ element တစ်ခုကို နှိပ်ပါ။ ပယ်ဖျက်ရန် Escape ကို နှိပ်ပါ။",
- "comment.label": "ဤ element အကြောင်း မှတ်ချက်ပေးရန်",
"comment.placeholder": "မှတ်ချက် ထည့်နိုင်သည် (ချန်လှပ်ထားနိုင်သည်)...",
- "comment.cancel": "Element မှတ်ချက်ကို ပယ်ဖျက်ရန်",
- "comment.submit": "Element မှတ်ချက် ထည့်ရန်",
- "comment.attach": "Element ထည့်ရန်",
"comment.annotation": "ဘရောက်ဇာ မှတ်စု",
"home.title": "စာမျက်နှာတစ်ခု ဖွင့်ပါ",
"home.description": "သင့်အက်ပ်ကို အစမ်းကြည့်ပါ၊ စာရွက်စာတမ်းများ ဖတ်ပါ သို့မဟုတ် ဝဘ်ကို ကြည့်ရှုပါ။",
@@ -36,11 +23,8 @@ export default {
"site.secure": "ချိတ်ဆက်မှု လုံခြုံသည်",
"site.insecure": "ချိတ်ဆက်မှု မလုံခြုံပါ",
"site.insecure.description": "ဤစာမျက်နှာတွင် စကားဝှက်များ သို့မဟုတ် အခြားကိုယ်ရေးအချက်အလက်များကို မထည့်ပါနှင့်။",
- "site.local": "စက်တွင်း ဆာဗာ",
- "site.local.description": "စက်တွင်းလိပ်စာများသည် OpenCode ဆာဗာ လုပ်ဆောင်နေသော စက်ပေါ်တွင် ပွင့်သည်။",
"site.file": "အလုပ်နေရာ ဖိုင်",
"site.file.description": "ဤစက်ရှင်၏ အလုပ်နေရာအတွင်းရှိ ဖိုင်များကိုသာ ဤနေရာတွင် ဖွင့်နိုင်သည်။",
- "site.network": "စာမျက်နှာများကို {{server}} ၏ ကွန်ရက်မှတစ်ဆင့် ဖွင့်သည်။",
"site.cookies": "ကွတ်ကီးနှင့် ဆိုက်ဒေတာ",
"site.cookies.count.one": "ကွတ်ကီး {{count}} ခု အသုံးပြုနေသည်",
"site.cookies.count.other": "ကွတ်ကီး {{count}} ခု အသုံးပြုနေသည်",
@@ -48,14 +32,7 @@ export default {
"site.permissions": "ခွင့်ပြုချက်များကို ပိတ်ထားသည်",
"site.permissions.description":
"ဤဘရောက်ဇာတွင် ကင်မရာ၊ မိုက်ခရိုဖုန်း၊ တည်နေရာနှင့် အကြောင်းကြားချက်များ အလုပ်မလုပ်ပါ။",
- "site.agent": "အေးဂျင့်သည် ဤစာမျက်နှာကို အသုံးပြုနိုင်သည်",
- "site.agent.description":
- "၎င်းသည် စာမျက်နှာကို ဖတ်ခြင်း၊ script များ လုပ်ဆောင်ခြင်းနှင့် ဖောင်များ ဖြည့်ခြင်းတို့ ပြုလုပ်နိုင်သည်။",
"page.add": "စာမျက်နှာကို စက်ရှင်သို့ ထည့်ရန်",
- "page.placeholder": "ဤစာမျက်နှာအကြောင်း ဆက်စပ်အချက်အလက် ထည့်ပါ",
- "external.open": "စနစ်ဘရောက်ဇာတွင် ဖွင့်ရန်",
- "external.menu": "ဘရောက်ဇာတွင် ဖွင့်ရန်",
- "external.unavailable": "ဤလိပ်စာသည် ဆာဗာစက်ပေါ်တွင်သာ အလုပ်လုပ်သည်။",
options: "ဘရောက်ဇာ ရွေးချယ်စရာများ",
"zoom.in": "ဇူးမ်ချဲ့ရန်",
"zoom.out": "ဇူးမ်ချုံ့ရန်",
diff --git a/packages/gui-plugins/src/browser/i18n/ne.ts b/packages/gui-plugins/src/browser/i18n/ne.ts
index bb2d784024d5..b4e87902503f 100644
--- a/packages/gui-plugins/src/browser/i18n/ne.ts
+++ b/packages/gui-plugins/src/browser/i18n/ne.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "ब्राउजर",
"address.label": "ब्राउजर ठेगाना",
"action.stop": "रोक्नुहोस्",
- replaced: "ब्राउजर नियन्त्रण अर्को डेस्कटप विन्डोमा सारियो।",
unsupported: "यो डेस्कटप एपले ब्राउजर फलकलाई समर्थन गर्दैन।",
- suspended: "ब्राउजर निलम्बित। पुन: जडान गर्न यो सत्रसँग अन्तर्क्रिया गर्नुहोस्।",
- "failed.title": "URL मा पुग्न सकिएन",
- "failed.description": "URL र आफ्नो जडान जाँचेर फेरि प्रयास गर्नुहोस्।",
"action.reload": "पुनः लोड गर्नुहोस्",
"model.timedOut": "ब्राउजर लोड हुन धेरै समय लाग्यो",
- "command.inspect": "ब्राउजर पृष्ठमा एउटा तत्व चयन गर्नुहोस्",
- "command.address": "ब्राउजर ठेगानामा फोकस गर्नुहोस्",
"command.close": "ब्राउजर ट्याब बन्द गर्नुहोस्",
"command.newTab": "नयाँ ब्राउजर ट्याब",
"tab.new": "नयाँ ट्याब",
- "address.search": "खोज्नुहोस् वा URL प्रविष्ट गर्नुहोस्",
"address.suggestions": "सुझावहरू",
"refused.web": "यहाँ वेब पृष्ठहरू मात्र खुल्न सक्छन्।",
"refused.workspace": "यहाँ वेब पृष्ठहरू र यस सत्रको कार्यस्थानभित्रका फाइलहरू मात्र खुल्न सक्छन्।",
"refused.credentials": "प्रयोगकर्ता नाम वा पासवर्ड भएका ठेगानाहरू यहाँ खुल्न सक्दैनन्।",
- inspect: "टिप्पणी गर्न एउटा तत्व चयन गर्नुहोस्",
- "inspect.active": "टिप्पणी गर्न पृष्ठमा कुनै तत्वमा क्लिक गर्नुहोस्। रद्द गर्न Escape थिच्नुहोस्।",
- "comment.label": "यो तत्वमा टिप्पणी गर्नुहोस्",
"comment.placeholder": "वैकल्पिक टिप्पणी थप्नुहोस्...",
- "comment.cancel": "तत्व टिप्पणी रद्द गर्नुहोस्",
- "comment.submit": "तत्व टिप्पणी थप्नुहोस्",
- "comment.attach": "तत्व थप्नुहोस्",
"comment.annotation": "ब्राउजर एनोटेसन",
"home.title": "पृष्ठ खोल्नुहोस्",
"home.description": "आफ्नो एपको पूर्वावलोकन गर्नुहोस्, कागजात पढ्नुहोस्, वा वेब ब्राउज गर्नुहोस्।",
@@ -36,24 +23,15 @@ export default {
"site.secure": "जडान सुरक्षित छ",
"site.insecure": "जडान सुरक्षित छैन",
"site.insecure.description": "यो पृष्ठमा पासवर्ड वा अन्य निजी जानकारी प्रविष्ट नगर्नुहोस्।",
- "site.local": "स्थानीय सर्भर",
- "site.local.description": "स्थानीय ठेगानाहरू OpenCode सर्भर चलाउने मेसिनमा खुल्छन्।",
"site.file": "कार्यस्थान फाइल",
"site.file.description": "यहाँ यस सत्रको कार्यस्थानभित्रका फाइलहरू मात्र खुल्न सक्छन्।",
- "site.network": "पृष्ठहरू {{server}} को नेटवर्कमार्फत लोड हुन्छन्।",
"site.cookies": "कुकी र साइट डेटा",
"site.cookies.count.one": "{{count}} कुकी प्रयोगमा",
"site.cookies.count.other": "{{count}} कुकीहरू प्रयोगमा",
"site.cookies.clear": "खाली गर्नुहोस्",
"site.permissions": "अनुमतिहरू अवरुद्ध छन्",
"site.permissions.description": "यो ब्राउजरमा क्यामेरा, माइक्रोफोन, स्थान र सूचनाहरू काम गर्दैनन्।",
- "site.agent": "एजेन्टले यो पृष्ठ प्रयोग गर्न सक्छ",
- "site.agent.description": "यसले पृष्ठ पढ्न, स्क्रिप्ट चलाउन र फारम भर्न सक्छ।",
"page.add": "पृष्ठलाई सत्रमा थप्नुहोस्",
- "page.placeholder": "यो पृष्ठबारे सन्दर्भ थप्नुहोस्",
- "external.open": "प्रणाली ब्राउजरमा खोल्नुहोस्",
- "external.menu": "ब्राउजरमा खोल्नुहोस्",
- "external.unavailable": "यो ठेगाना सर्भरको मेसिनमा मात्र काम गर्छ।",
options: "ब्राउजर विकल्पहरू",
"zoom.in": "जुम इन गर्नुहोस्",
"zoom.out": "जुम आउट गर्नुहोस्",
diff --git a/packages/gui-plugins/src/browser/i18n/nl.ts b/packages/gui-plugins/src/browser/i18n/nl.ts
index fc82dfda0605..282363e8e732 100644
--- a/packages/gui-plugins/src/browser/i18n/nl.ts
+++ b/packages/gui-plugins/src/browser/i18n/nl.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Browser",
"address.label": "Browseradres",
"action.stop": "Stop",
- replaced: "Browserbediening verplaatst naar een ander bureaubladvenster.",
unsupported: "Deze desktopapp ondersteunt het browserpaneel niet.",
- suspended: "Browser opgeschort. Interactie met deze sessie om opnieuw verbinding te maken.",
- "failed.title": "URL is niet bereikbaar",
- "failed.description": "Controleer de URL en je verbinding en probeer het opnieuw.",
"action.reload": "Opnieuw laden",
"model.timedOut": "De browser deed er te lang over om te laden",
- "command.inspect": "Selecteer een element op de browserpagina",
- "command.address": "Browseradresbalk activeren",
"command.close": "Browsertabblad sluiten",
"command.newTab": "Nieuw browsertabblad",
"tab.new": "Nieuw tabblad",
- "address.search": "Zoek of voer een URL in",
"address.suggestions": "Suggesties",
"refused.web": "Alleen webpagina's kunnen hier worden geopend.",
"refused.workspace": "Alleen webpagina's en bestanden in de werkruimte van deze sessie kunnen hier worden geopend.",
"refused.credentials": "Adressen met een gebruikersnaam of wachtwoord kunnen hier niet worden geopend.",
- inspect: "Selecteer een element om op te reageren",
- "inspect.active": "Klik op een element op de pagina om erop te reageren. Druk op Escape om te annuleren.",
- "comment.label": "Reageren op dit element",
"comment.placeholder": "Voeg een optionele opmerking toe...",
- "comment.cancel": "Elementopmerking annuleren",
- "comment.submit": "Elementopmerking toevoegen",
- "comment.attach": "Element toevoegen",
"comment.annotation": "Browseraantekening",
"home.title": "Open een pagina",
"home.description": "Bekijk een voorbeeld van je app, lees documentatie of surf op het web.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Verbinding is beveiligd",
"site.insecure": "Verbinding is niet beveiligd",
"site.insecure.description": "Voer op deze pagina geen wachtwoorden of andere privégegevens in.",
- "site.local": "Lokale server",
- "site.local.description": "Lokale adressen worden geopend op de machine waarop de OpenCode-server draait.",
"site.file": "Werkruimtebestand",
"site.file.description": "Alleen bestanden in de werkruimte van deze sessie kunnen hier worden geopend.",
- "site.network": "Pagina's laden via het netwerk van {{server}}.",
"site.cookies": "Cookies en sitegegevens",
"site.cookies.count.one": "{{count}} cookie in gebruik",
"site.cookies.count.other": "{{count}} cookies in gebruik",
"site.cookies.clear": "Wissen",
"site.permissions": "Machtigingen zijn geblokkeerd",
"site.permissions.description": "Camera, microfoon, locatie en meldingen werken niet in deze browser.",
- "site.agent": "Agent kan deze pagina gebruiken",
- "site.agent.description": "De agent kan de pagina lezen, scripts uitvoeren en formulieren invullen.",
"page.add": "Pagina aan sessie toevoegen",
- "page.placeholder": "Voeg context over deze pagina toe",
- "external.open": "Openen in systeembrowser",
- "external.menu": "Openen in browser",
- "external.unavailable": "Dit adres werkt alleen op de machine van de server.",
options: "Browseropties",
"zoom.in": "Inzoomen",
"zoom.out": "Uitzoomen",
diff --git a/packages/gui-plugins/src/browser/i18n/no.ts b/packages/gui-plugins/src/browser/i18n/no.ts
index f3d9cab821e2..c99c7a647aa7 100644
--- a/packages/gui-plugins/src/browser/i18n/no.ts
+++ b/packages/gui-plugins/src/browser/i18n/no.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Nettleser",
"address.label": "Nettleseradresse",
"action.stop": "Stopp",
- replaced: "Nettleserkontrollen flyttet til et annet skrivebordsvindu.",
unsupported: "Denne skrivebordsappen støtter ikke nettleserpanelet.",
- suspended: "Nettleseren er suspendert. Samhandle med denne økten for å koble til på nytt.",
- "failed.title": "URL-en kan ikke nås",
- "failed.description": "Kontroller URL-en og tilkoblingen, og prøv på nytt.",
"action.reload": "Last inn på nytt",
"model.timedOut": "Nettleseren brukte for lang tid på å laste inn",
- "command.inspect": "Velg et element på nettsiden",
- "command.address": "Fokuser nettleserens adressefelt",
"command.close": "Lukk nettleserfane",
"command.newTab": "Ny nettleserfane",
"tab.new": "Ny fane",
- "address.search": "Søk eller skriv inn en URL",
"address.suggestions": "Forslag",
"refused.web": "Bare nettsider kan åpnes her.",
"refused.workspace": "Bare nettsider og filer i denne øktens arbeidsområde kan åpnes her.",
"refused.credentials": "Adresser med brukernavn eller passord kan ikke åpnes her.",
- inspect: "Velg et element å kommentere",
- "inspect.active": "Klikk på et element på siden for å kommentere det. Trykk Escape for å avbryte.",
- "comment.label": "Kommenter dette elementet",
"comment.placeholder": "Legg til en valgfri kommentar …",
- "comment.cancel": "Avbryt elementkommentar",
- "comment.submit": "Legg til elementkommentar",
- "comment.attach": "Legg til element",
"comment.annotation": "Nettleserkommentar",
"home.title": "Åpne en side",
"home.description": "Forhåndsvis appen din, les dokumentasjon eller surf på nettet.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Tilkoblingen er sikker",
"site.insecure": "Tilkoblingen er ikke sikker",
"site.insecure.description": "Ikke skriv inn passord eller annen privat informasjon på denne siden.",
- "site.local": "Lokal server",
- "site.local.description": "Lokale adresser åpnes på maskinen som kjører OpenCode-serveren.",
"site.file": "Fil i arbeidsområdet",
"site.file.description": "Bare filer i denne øktens arbeidsområde kan åpnes her.",
- "site.network": "Sider lastes inn via nettverket til {{server}}.",
"site.cookies": "Informasjonskapsler og nettstedsdata",
"site.cookies.count.one": "{{count}} informasjonskapsel i bruk",
"site.cookies.count.other": "{{count}} informasjonskapsler i bruk",
"site.cookies.clear": "Fjern",
"site.permissions": "Tillatelser er blokkert",
"site.permissions.description": "Kamera, mikrofon, posisjon og varsler fungerer ikke i denne nettleseren.",
- "site.agent": "Agenten kan bruke denne siden",
- "site.agent.description": "Den kan lese siden, kjøre skript og fylle ut skjemaer.",
"page.add": "Legg til side i økten",
- "page.placeholder": "Legg til kontekst om denne siden",
- "external.open": "Åpne i systemets nettleser",
- "external.menu": "Åpne i nettleser",
- "external.unavailable": "Denne adressen fungerer bare på serverens maskin.",
options: "Nettleseralternativer",
"zoom.in": "Zoom inn",
"zoom.out": "Zoom ut",
diff --git a/packages/gui-plugins/src/browser/i18n/pa.ts b/packages/gui-plugins/src/browser/i18n/pa.ts
index e6bd0a7924a5..443a595aeb70 100644
--- a/packages/gui-plugins/src/browser/i18n/pa.ts
+++ b/packages/gui-plugins/src/browser/i18n/pa.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "براؤزر",
"address.label": "براؤزر دا پتہ",
"action.stop": "روکو",
- replaced: "براؤزر کنٹرول کو دوسری ڈیسک ٹاپ ونڈو میں منتقل کر دیا گیا۔",
unsupported: "یہ ڈیسک ٹاپ ایپ براؤزر پین کو سپورٹ نئیں کرتی اے۔",
- suspended: "براؤزر معطل۔ دوبارہ منسلک ہونے لئی اس سیشن دے ساتھ تعامل کرو۔",
- "failed.title": "URL تک نہیں پہنچیا جا سکیا",
- "failed.description": "URL تے اپنا کنکشن چیک کرو، فیر کوشش کرو۔",
"action.reload": "دوبارہ لوڈ کرو",
"model.timedOut": "براؤزر نے لوڈ ہون وچ بہت ویلا لا دتا",
- "command.inspect": "براؤزر صفحے وچ اک عنصر چنو",
- "command.address": "براؤزر دے پتے تے فوکس کرو",
"command.close": "براؤزر ٹیب بند کرو",
"command.newTab": "نویں براؤزر ٹیب",
"tab.new": "نویں ٹیب",
- "address.search": "لبھو یا URL درج کرو",
"address.suggestions": "تجویزاں",
"refused.web": "ایتھے صرف ویب صفحے کھل سکدے نیں۔",
"refused.workspace": "ایتھے صرف ویب صفحے تے ایس سیشن دی ورک سپیس دے اندر دیاں فائلاں کھل سکدیاں نیں۔",
"refused.credentials": "یوزر ناں یا پاس ورڈ آلے پتے ایتھے نئیں کھل سکدے۔",
- inspect: "تبصرے لئی اک عنصر چنو",
- "inspect.active": "تبصرہ کرن لئی صفحے وچ کسے عنصر تے کلک کرو۔ منسوخ کرن لئی Escape دباؤ۔",
- "comment.label": "ایس عنصر تے تبصرہ کرو",
"comment.placeholder": "اختیاری تبصرہ شامل کرو...",
- "comment.cancel": "عنصر تے تبصرہ منسوخ کرو",
- "comment.submit": "عنصر تے تبصرہ شامل کرو",
- "comment.attach": "عنصر شامل کرو",
"comment.annotation": "براؤزر نوٹ",
"home.title": "صفحہ کھولو",
"home.description": "اپنی ایپ دا پیش نظارہ ویکھو، دستاویزاں پڑھو، یا ویب براؤز کرو۔",
@@ -36,24 +23,15 @@ export default {
"site.secure": "کنکشن محفوظ اے",
"site.insecure": "کنکشن محفوظ نئیں",
"site.insecure.description": "ایس صفحے تے پاس ورڈ یا ہور نجی معلومات نہ پاؤ۔",
- "site.local": "مقامی سرور",
- "site.local.description": "مقامی پتے اوس مشین تے کھلدے نیں جیہڑی OpenCode سرور چلاندی اے۔",
"site.file": "ورک سپیس فائل",
"site.file.description": "ایتھے صرف ایس سیشن دی ورک سپیس دے اندر دیاں فائلاں کھل سکدیاں نیں۔",
- "site.network": "صفحے {{server}} دے نیٹ ورک راہیں لوڈ ہوندے نیں۔",
"site.cookies": "کوکیاں تے سائٹ ڈیٹا",
"site.cookies.count.one": "{{count}} کوکی ورتوں وچ",
"site.cookies.count.other": "{{count}} کوکیاں ورتوں وچ",
"site.cookies.clear": "صاف کرو",
"site.permissions": "اجازتاں بلاک نیں",
"site.permissions.description": "ایس براؤزر وچ کیمرہ، مائیکروفون، مقام تے نوٹیفکیشن کم نئیں کردے۔",
- "site.agent": "ایجنٹ ایہہ صفحہ ورت سکدا اے",
- "site.agent.description": "ایہہ صفحہ پڑھ سکدا اے، سکرپٹ چلا سکدا اے تے فارم بھر سکدا اے۔",
"page.add": "صفحہ سیشن وچ شامل کرو",
- "page.placeholder": "ایس صفحے بارے تناظر شامل کرو",
- "external.open": "سسٹم براؤزر وچ کھولو",
- "external.menu": "براؤزر وچ کھولو",
- "external.unavailable": "ایہہ پتہ صرف سرور دی مشین تے کم کردا اے۔",
options: "براؤزر دے اختیارات",
"zoom.in": "وڈا کرو",
"zoom.out": "چھوٹا کرو",
diff --git a/packages/gui-plugins/src/browser/i18n/pl.ts b/packages/gui-plugins/src/browser/i18n/pl.ts
index 47ce85dce424..249b5e083cd0 100644
--- a/packages/gui-plugins/src/browser/i18n/pl.ts
+++ b/packages/gui-plugins/src/browser/i18n/pl.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Przeglądarka",
"address.label": "Adres przeglądarki",
"action.stop": "Zatrzymaj",
- replaced: "Kontrola przeglądarki została przeniesiona do innego okna pulpitu.",
unsupported: "Ta aplikacja na pulpit nie obsługuje panelu przeglądarki.",
- suspended: "Przeglądarka zawieszona. Wejdź w interakcję z tą sesją, aby ponownie połączyć.",
- "failed.title": "Nie można otworzyć adresu URL",
- "failed.description": "Sprawdź adres URL i połączenie, a następnie spróbuj ponownie.",
"action.reload": "Wczytaj ponownie",
"model.timedOut": "Przeglądarka wczytywała się zbyt długo",
- "command.inspect": "Wybierz element na stronie w przeglądarce",
- "command.address": "Przejdź do paska adresu przeglądarki",
"command.close": "Zamknij kartę przeglądarki",
"command.newTab": "Nowa karta przeglądarki",
"tab.new": "Nowa karta",
- "address.search": "Wyszukaj lub wpisz adres URL",
"address.suggestions": "Sugestie",
"refused.web": "Tutaj można otwierać tylko strony internetowe.",
"refused.workspace": "Tutaj można otwierać tylko strony internetowe i pliki z obszaru roboczego tej sesji.",
"refused.credentials": "Adresów zawierających nazwę użytkownika lub hasło nie można tu otworzyć.",
- inspect: "Wybierz element do skomentowania",
- "inspect.active": "Kliknij element na stronie, aby go skomentować. Naciśnij Escape, aby anulować.",
- "comment.label": "Skomentuj ten element",
"comment.placeholder": "Dodaj opcjonalny komentarz...",
- "comment.cancel": "Anuluj komentarz do elementu",
- "comment.submit": "Dodaj komentarz do elementu",
- "comment.attach": "Dodaj element",
"comment.annotation": "Adnotacja przeglądarki",
"home.title": "Otwórz stronę",
"home.description": "Podejrzyj swoją aplikację, czytaj dokumentację lub przeglądaj sieć.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Połączenie jest bezpieczne",
"site.insecure": "Połączenie nie jest bezpieczne",
"site.insecure.description": "Nie wpisuj na tej stronie haseł ani innych prywatnych informacji.",
- "site.local": "Serwer lokalny",
- "site.local.description": "Adresy lokalne otwierają się na maszynie, na której działa serwer OpenCode.",
"site.file": "Plik obszaru roboczego",
"site.file.description": "Tutaj można otwierać tylko pliki z obszaru roboczego tej sesji.",
- "site.network": "Strony są wczytywane przez sieć serwera {{server}}.",
"site.cookies": "Pliki cookie i dane witryn",
"site.cookies.count.one": "{{count}} plik cookie w użyciu",
"site.cookies.count.few": "{{count}} pliki cookie w użyciu",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Wyczyść",
"site.permissions": "Uprawnienia są zablokowane",
"site.permissions.description": "Kamera, mikrofon, lokalizacja i powiadomienia nie działają w tej przeglądarce.",
- "site.agent": "Agent może używać tej strony",
- "site.agent.description": "Może czytać stronę, uruchamiać skrypty i wypełniać formularze.",
"page.add": "Dodaj stronę do sesji",
- "page.placeholder": "Dodaj kontekst dotyczący tej strony",
- "external.open": "Otwórz w przeglądarce systemowej",
- "external.menu": "Otwórz w przeglądarce",
- "external.unavailable": "Ten adres działa tylko na maszynie serwera.",
options: "Opcje przeglądarki",
"zoom.in": "Powiększ",
"zoom.out": "Pomniejsz",
diff --git a/packages/gui-plugins/src/browser/i18n/ro.ts b/packages/gui-plugins/src/browser/i18n/ro.ts
index 2e6d3a4e7d92..d10e7b8d5e63 100644
--- a/packages/gui-plugins/src/browser/i18n/ro.ts
+++ b/packages/gui-plugins/src/browser/i18n/ro.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Browser",
"address.label": "Adresa browserului",
"action.stop": "Oprește",
- replaced: "Controlul browserului a fost mutat într-o altă fereastră de desktop.",
unsupported: "Această aplicație desktop nu acceptă panoul browserului.",
- suspended: "Browser suspendat. Interacționați cu această sesiune pentru a vă reconecta.",
- "failed.title": "Adresa URL nu poate fi accesată",
- "failed.description": "Verifică adresa URL și conexiunea, apoi încearcă din nou.",
"action.reload": "Reîncarcă",
"model.timedOut": "Browserul nu s-a încărcat suficient de rapid",
- "command.inspect": "Selectează un element din pagina browserului",
- "command.address": "Focalizează adresa browserului",
"command.close": "Închide fila browserului",
"command.newTab": "Filă nouă în browser",
"tab.new": "Filă nouă",
- "address.search": "Caută sau introdu un URL",
"address.suggestions": "Sugestii",
"refused.web": "Aici se pot deschide doar pagini web.",
"refused.workspace": "Aici se pot deschide doar pagini web și fișiere din spațiul de lucru al acestei sesiuni.",
"refused.credentials": "Adresele care conțin un nume de utilizator sau o parolă nu se pot deschide aici.",
- inspect: "Selectează un element pe care să-l comentezi",
- "inspect.active": "Fă clic pe un element din pagină pentru a-l comenta. Apasă Escape pentru a anula.",
- "comment.label": "Comentează acest element",
"comment.placeholder": "Adaugă un comentariu opțional...",
- "comment.cancel": "Anulează comentariul pe element",
- "comment.submit": "Adaugă comentariul pe element",
- "comment.attach": "Adaugă elementul",
"comment.annotation": "Adnotare din browser",
"home.title": "Deschide o pagină",
"home.description": "Previzualizează aplicația, citește documentația sau navighează pe web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Conexiunea este securizată",
"site.insecure": "Conexiunea nu este securizată",
"site.insecure.description": "Nu introduce parole sau alte informații private pe această pagină.",
- "site.local": "Server local",
- "site.local.description": "Adresele locale se deschid pe mașina care rulează serverul OpenCode.",
"site.file": "Fișier din spațiul de lucru",
"site.file.description": "Aici se pot deschide doar fișiere din spațiul de lucru al acestei sesiuni.",
- "site.network": "Paginile se încarcă prin rețeaua {{server}}.",
"site.cookies": "Cookie-uri și date ale site-ului",
"site.cookies.count.one": "{{count}} cookie în uz",
"site.cookies.count.few": "{{count}} cookie-uri în uz",
@@ -48,13 +32,7 @@ export default {
"site.cookies.clear": "Șterge",
"site.permissions": "Permisiunile sunt blocate",
"site.permissions.description": "Camera, microfonul, locația și notificările nu funcționează în acest browser.",
- "site.agent": "Agentul poate folosi această pagină",
- "site.agent.description": "Poate citi pagina, rula scripturi și completa formulare.",
"page.add": "Adaugă pagina în sesiune",
- "page.placeholder": "Adaugă context despre această pagină",
- "external.open": "Deschide în browserul sistemului",
- "external.menu": "Deschide în browser",
- "external.unavailable": "Această adresă funcționează doar pe mașina serverului.",
options: "Opțiuni browser",
"zoom.in": "Mărește",
"zoom.out": "Micșorează",
diff --git a/packages/gui-plugins/src/browser/i18n/ru.ts b/packages/gui-plugins/src/browser/i18n/ru.ts
index 08dababe376e..3f13afee8f0c 100644
--- a/packages/gui-plugins/src/browser/i18n/ru.ts
+++ b/packages/gui-plugins/src/browser/i18n/ru.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Браузер",
"address.label": "Адрес браузера",
"action.stop": "Остановить",
- replaced: "Управление браузером перемещено в другое окно рабочего стола.",
unsupported: "Это настольное приложение не поддерживает панель браузера.",
- suspended: "Браузер приостановлен. Взаимодействуйте с этой сессией, чтобы переподключиться.",
- "failed.title": "Не удаётся открыть URL",
- "failed.description": "Проверьте URL и подключение, затем повторите попытку.",
"action.reload": "Перезагрузить",
"model.timedOut": "Браузер слишком долго загружался",
- "command.inspect": "Выбрать элемент на странице браузера",
- "command.address": "Перейти к адресной строке браузера",
"command.close": "Закрыть вкладку браузера",
"command.newTab": "Новая вкладка браузера",
"tab.new": "Новая вкладка",
- "address.search": "Введите запрос или URL",
"address.suggestions": "Подсказки",
"refused.web": "Здесь можно открывать только веб-страницы.",
"refused.workspace": "Здесь можно открывать только веб-страницы и файлы из рабочего пространства этой сессии.",
"refused.credentials": "Адреса с именем пользователя или паролем здесь открыть нельзя.",
- inspect: "Выберите элемент, чтобы прокомментировать",
- "inspect.active": "Нажмите на элемент на странице, чтобы прокомментировать его. Нажмите Escape для отмены.",
- "comment.label": "Прокомментировать этот элемент",
"comment.placeholder": "Добавьте комментарий (необязательно)...",
- "comment.cancel": "Отменить комментарий к элементу",
- "comment.submit": "Добавить комментарий к элементу",
- "comment.attach": "Добавить элемент",
"comment.annotation": "Аннотация браузера",
"home.title": "Откройте страницу",
"home.description": "Просматривайте своё приложение, читайте документацию или открывайте сайты.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Защищённое подключение",
"site.insecure": "Подключение не защищено",
"site.insecure.description": "Не вводите на этой странице пароли и другую личную информацию.",
- "site.local": "Локальный сервер",
- "site.local.description": "Локальные адреса открываются на компьютере, где запущен сервер OpenCode.",
"site.file": "Файл рабочего пространства",
"site.file.description": "Здесь можно открывать только файлы из рабочего пространства этой сессии.",
- "site.network": "Страницы загружаются через сеть {{server}}.",
"site.cookies": "Файлы cookie и данные сайтов",
"site.cookies.count.one": "Используется {{count}} файл cookie",
"site.cookies.count.few": "Используется {{count}} файла cookie",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Очистить",
"site.permissions": "Разрешения заблокированы",
"site.permissions.description": "Камера, микрофон, геолокация и уведомления в этом браузере не работают.",
- "site.agent": "Агент может использовать эту страницу",
- "site.agent.description": "Он может читать страницу, запускать скрипты и заполнять формы.",
"page.add": "Добавить страницу в сессию",
- "page.placeholder": "Добавьте контекст об этой странице",
- "external.open": "Открыть в системном браузере",
- "external.menu": "Открыть в браузере",
- "external.unavailable": "Этот адрес работает только на компьютере с сервером.",
options: "Параметры браузера",
"zoom.in": "Увеличить",
"zoom.out": "Уменьшить",
diff --git a/packages/gui-plugins/src/browser/i18n/si.ts b/packages/gui-plugins/src/browser/i18n/si.ts
index 21a4701df84b..23ef4f4c833c 100644
--- a/packages/gui-plugins/src/browser/i18n/si.ts
+++ b/packages/gui-plugins/src/browser/i18n/si.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "බ්රවුසරය",
"address.label": "බ්රවුසර ලිපිනය",
"action.stop": "නවත්වන්න",
- replaced: "බ්රවුසර පාලනය වෙනත් ඩෙස්ක්ටොප් කවුළුවකට ගෙන ගියේය.",
unsupported: "මෙම ඩෙස්ක්ටොප් යෙදුම බ්රවුසර කවුළුව සඳහා සහය නොදක්වයි.",
- suspended: "බ්රව්සරය අත්හිටුවා ඇත. නැවත සම්බන්ධ වීමට මෙම සැසිය සමඟ අන්තර් ක්රියා කරන්න.",
- "failed.title": "URL වෙත ළඟා විය නොහැක",
- "failed.description": "URL එක සහ ඔබේ සම්බන්ධතාව පරීක්ෂා කර නැවත උත්සාහ කරන්න.",
"action.reload": "නැවත පූරණය කරන්න",
"model.timedOut": "බ්රවුසරය පූරණය වීමට වැඩි කාලයක් ගත්තේය",
- "command.inspect": "බ්රවුසර පිටුවේ මූලද්රව්යයක් තෝරන්න",
- "command.address": "බ්රවුසර ලිපිනයට අවධානය යොමු කරන්න",
"command.close": "බ්රවුසර ටැබය වසන්න",
"command.newTab": "නව බ්රවුසර ටැබය",
"tab.new": "නව ටැබය",
- "address.search": "සොයන්න හෝ URL එකක් ඇතුළත් කරන්න",
"address.suggestions": "යෝජනා",
"refused.web": "මෙහි විවෘත කළ හැක්කේ වෙබ් පිටු පමණි.",
"refused.workspace": "මෙහි විවෘත කළ හැක්කේ වෙබ් පිටු සහ මෙම සැසියේ වැඩබිම තුළ ඇති ගොනු පමණි.",
"refused.credentials": "පරිශීලක නාමයක් හෝ මුරපදයක් සහිත ලිපින මෙහි විවෘත කළ නොහැක.",
- inspect: "අදහස් දැක්වීමට මූලද්රව්යයක් තෝරන්න",
- "inspect.active": "අදහස් දැක්වීමට පිටුවේ මූලද්රව්යයක් ක්ලික් කරන්න. අවලංගු කිරීමට Escape ඔබන්න.",
- "comment.label": "මෙම මූලද්රව්යය ගැන අදහස් දක්වන්න",
"comment.placeholder": "විකල්ප අදහසක් එක් කරන්න...",
- "comment.cancel": "මූලද්රව්ය අදහස අවලංගු කරන්න",
- "comment.submit": "මූලද්රව්ය අදහස එක් කරන්න",
- "comment.attach": "මූලද්රව්යය එක් කරන්න",
"comment.annotation": "බ්රවුසර විවරණය",
"home.title": "පිටුවක් විවෘත කරන්න",
"home.description": "ඔබගේ යෙදුම පෙරදසුන් කරන්න, ලේඛන කියවන්න, හෝ වෙබය පිරික්සන්න.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "සම්බන්ධතාවය ආරක්ෂිතයි",
"site.insecure": "සම්බන්ධතාවය ආරක්ෂිත නොවේ",
"site.insecure.description": "මෙම පිටුවේ මුරපද හෝ වෙනත් පුද්ගලික තොරතුරු ඇතුළත් නොකරන්න.",
- "site.local": "දේශීය සේවාදායකය",
- "site.local.description": "දේශීය ලිපින විවෘත වන්නේ OpenCode සේවාදායකය ධාවනය වන යන්ත්රයේය.",
"site.file": "වැඩබිම් ගොනුව",
"site.file.description": "මෙහි විවෘත කළ හැක්කේ මෙම සැසියේ වැඩබිම තුළ ඇති ගොනු පමණි.",
- "site.network": "පිටු {{server}} හි ජාලය හරහා පූරණය වේ.",
"site.cookies": "කුකී සහ අඩවි දත්ත",
"site.cookies.count.one": "කුකී {{count}} ක් භාවිතයේ ඇත",
"site.cookies.count.other": "කුකී {{count}} ක් භාවිතයේ ඇත",
"site.cookies.clear": "ඉවත් කරන්න",
"site.permissions": "අවසර අවහිර කර ඇත",
"site.permissions.description": "කැමරාව, මයික්රෆෝනය, ස්ථානය සහ දැනුම්දීම් මෙම බ්රවුසරයේ ක්රියා නොකරයි.",
- "site.agent": "නියෝජිතයාට මෙම පිටුව භාවිතා කළ හැක",
- "site.agent.description": "එයට පිටුව කියවීමට, ස්ක්රිප්ට් ධාවනය කිරීමට සහ පෝරම පිරවීමට හැක.",
"page.add": "සැසියට පිටුව එක් කරන්න",
- "page.placeholder": "මෙම පිටුව ගැන සන්දර්භය එක් කරන්න",
- "external.open": "පද්ධති බ්රවුසරයේ විවෘත කරන්න",
- "external.menu": "බ්රවුසරයේ විවෘත කරන්න",
- "external.unavailable": "මෙම ලිපිනය ක්රියා කරන්නේ සේවාදායකයේ යන්ත්රයේ පමණි.",
options: "බ්රවුසර විකල්ප",
"zoom.in": "විශාලනය කරන්න",
"zoom.out": "කුඩා කරන්න",
diff --git a/packages/gui-plugins/src/browser/i18n/sk.ts b/packages/gui-plugins/src/browser/i18n/sk.ts
index e9034caf2e54..7e2af0a8680e 100644
--- a/packages/gui-plugins/src/browser/i18n/sk.ts
+++ b/packages/gui-plugins/src/browser/i18n/sk.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Webový prehliadač",
"address.label": "Adresa prehliadača",
"action.stop": "Zastaviť",
- replaced: "Ovládanie prehliadača presunuté do iného okna desktopu.",
unsupported: "Táto desktopová aplikácia nepodporuje panel prehliadača.",
- suspended: "Prehliadač bol pozastavený. Interagujte s reláciou pre obnovenie pripojenia.",
- "failed.title": "URL nie je dostupná",
- "failed.description": "Skontrolujte URL a pripojenie a skúste to znova.",
"action.reload": "Znova načítať",
"model.timedOut": "Prehliadač sa načítaval príliš dlho",
- "command.inspect": "Vybrať prvok na stránke prehliadača",
- "command.address": "Prejsť na panel s adresou prehliadača",
"command.close": "Zavrieť kartu prehliadača",
"command.newTab": "Nová karta prehliadača",
"tab.new": "Nová karta",
- "address.search": "Hľadajte alebo zadajte URL",
"address.suggestions": "Návrhy",
"refused.web": "Otvárať sa tu dajú iba webové stránky.",
"refused.workspace": "Otvárať sa tu dajú iba webové stránky a súbory v pracovnom priestore tejto relácie.",
"refused.credentials": "Adresy s používateľským menom alebo heslom sa tu nedajú otvoriť.",
- inspect: "Vyberte prvok na okomentovanie",
- "inspect.active": "Kliknutím na prvok na stránke ho okomentujete. Stlačením Escape zrušíte.",
- "comment.label": "Komentovať tento prvok",
"comment.placeholder": "Pridajte voliteľný komentár...",
- "comment.cancel": "Zrušiť komentár prvku",
- "comment.submit": "Pridať komentár prvku",
- "comment.attach": "Pridať prvok",
"comment.annotation": "Poznámka z prehliadača",
"home.title": "Otvorte stránku",
"home.description": "Pozrite si náhľad aplikácie, čítajte dokumentáciu alebo prehliadajte web.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Pripojenie je zabezpečené",
"site.insecure": "Pripojenie nie je zabezpečené",
"site.insecure.description": "Na tejto stránke nezadávajte heslá ani iné súkromné údaje.",
- "site.local": "Lokálny server",
- "site.local.description": "Lokálne adresy sa otvárajú na počítači, na ktorom beží server OpenCode.",
"site.file": "Súbor pracovného priestoru",
"site.file.description": "Otvárať sa tu dajú iba súbory v pracovnom priestore tejto relácie.",
- "site.network": "Stránky sa načítavajú cez sieť {{server}}.",
"site.cookies": "Cookies a údaje stránok",
"site.cookies.count.one": "Používa sa {{count}} cookie",
"site.cookies.count.few": "Používajú sa {{count}} cookies",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Vymazať",
"site.permissions": "Povolenia sú blokované",
"site.permissions.description": "Kamera, mikrofón, poloha a upozornenia v tomto prehliadači nefungujú.",
- "site.agent": "Agent môže používať túto stránku",
- "site.agent.description": "Môže čítať stránku, spúšťať skripty a vypĺňať formuláre.",
"page.add": "Pridať stránku do relácie",
- "page.placeholder": "Pridajte kontext k tejto stránke",
- "external.open": "Otvoriť v systémovom prehliadači",
- "external.menu": "Otvoriť v prehliadači",
- "external.unavailable": "Táto adresa funguje iba na počítači so serverom.",
options: "Možnosti prehliadača",
"zoom.in": "Priblížiť",
"zoom.out": "Oddialiť",
diff --git a/packages/gui-plugins/src/browser/i18n/sl.ts b/packages/gui-plugins/src/browser/i18n/sl.ts
index 9b09ed62ccdf..1f63ac135af4 100644
--- a/packages/gui-plugins/src/browser/i18n/sl.ts
+++ b/packages/gui-plugins/src/browser/i18n/sl.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Spletni brskalnik",
"address.label": "Naslov v brskalniku",
"action.stop": "Ustavi",
- replaced: "Nadzor brskalnika je premaknjen v drugo namizno okno.",
unsupported: "Ta namizna aplikacija ne podpira podokna brskalnika.",
- suspended: "Brskalnik je začasno ustavljen. Interakcija s sejo za ponovno povezavo.",
- "failed.title": "URL ni dosegljiv",
- "failed.description": "Preverite URL in povezavo ter poskusite znova.",
"action.reload": "Znova naloži",
"model.timedOut": "Nalaganje brskalnika je trajalo predolgo",
- "command.inspect": "Izberite element na strani v brskalniku",
- "command.address": "Fokus na naslovno vrstico brskalnika",
"command.close": "Zapri zavihek brskalnika",
"command.newTab": "Nov zavihek brskalnika",
"tab.new": "Nov zavihek",
- "address.search": "Iščite ali vnesite URL",
"address.suggestions": "Predlogi",
"refused.web": "Tukaj se lahko odprejo samo spletne strani.",
"refused.workspace": "Tukaj se lahko odprejo samo spletne strani in datoteke v delovnem prostoru te seje.",
"refused.credentials": "Naslovov z uporabniškim imenom ali geslom tukaj ni mogoče odpreti.",
- inspect: "Izberite element za komentiranje",
- "inspect.active": "Kliknite element na strani, da ga komentirate. Za preklic pritisnite Escape.",
- "comment.label": "Komentiraj ta element",
"comment.placeholder": "Dodajte neobvezen komentar …",
- "comment.cancel": "Prekliči komentar elementa",
- "comment.submit": "Dodaj komentar elementa",
- "comment.attach": "Dodaj element",
"comment.annotation": "Opomba brskalnika",
"home.title": "Odprite stran",
"home.description": "Predoglejte svojo aplikacijo, berite dokumentacijo ali brskajte po spletu.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Povezava je varna",
"site.insecure": "Povezava ni varna",
"site.insecure.description": "Na tej strani ne vnašajte gesel ali drugih zasebnih podatkov.",
- "site.local": "Lokalni strežnik",
- "site.local.description": "Lokalni naslovi se odprejo na računalniku, na katerem teče strežnik OpenCode.",
"site.file": "Datoteka delovnega prostora",
"site.file.description": "Tukaj se lahko odprejo samo datoteke v delovnem prostoru te seje.",
- "site.network": "Strani se nalagajo prek omrežja strežnika {{server}}.",
"site.cookies": "Piškotki in podatki spletnega mesta",
"site.cookies.count.one": "V uporabi je {{count}} piškotek",
"site.cookies.count.two": "V uporabi sta {{count}} piškotka",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Počisti",
"site.permissions": "Dovoljenja so blokirana",
"site.permissions.description": "Kamera, mikrofon, lokacija in obvestila v tem brskalniku ne delujejo.",
- "site.agent": "Agent lahko uporablja to stran",
- "site.agent.description": "Lahko bere stran, izvaja skripte in izpolnjuje obrazce.",
"page.add": "Dodaj stran v sejo",
- "page.placeholder": "Dodajte kontekst o tej strani",
- "external.open": "Odpri v sistemskem brskalniku",
- "external.menu": "Odpri v brskalniku",
- "external.unavailable": "Ta naslov deluje samo na računalniku strežnika.",
options: "Možnosti brskalnika",
"zoom.in": "Povečaj",
"zoom.out": "Pomanjšaj",
diff --git a/packages/gui-plugins/src/browser/i18n/sq.ts b/packages/gui-plugins/src/browser/i18n/sq.ts
index da53302206bf..17b36eca30fb 100644
--- a/packages/gui-plugins/src/browser/i18n/sq.ts
+++ b/packages/gui-plugins/src/browser/i18n/sq.ts
@@ -4,31 +4,18 @@ export default {
"tab.title": "Shfletuesi",
"address.label": "Adresa e shfletuesit",
"action.stop": "Ndalo",
- replaced: "Kontrolli i shfletuesit u zhvendos në një dritare tjetër të desktopit.",
unsupported: "Ky aplikacion desktopi nuk e mbështet panelin e shfletuesit.",
- suspended: "Shfletuesi është pezulluar. Ndërveproni me këtë seancë për t'u rilidhur.",
- "failed.title": "URL-ja nuk mund të arrihet",
- "failed.description": "Kontrollo URL-në dhe lidhjen, pastaj provo përsëri.",
"action.reload": "Ringarko",
"model.timedOut": "Shfletuesi vonoi shumë të ngarkohej",
- "command.inspect": "Zgjidhni një element në faqen e shfletuesit",
- "command.address": "Fokuso adresën e shfletuesit",
"command.close": "Mbyll skedën e shfletuesit",
"command.newTab": "Skedë e re shfletuesi",
"tab.new": "Skedë e re",
- "address.search": "Kërkoni ose futni një URL",
"address.suggestions": "Sugjerime",
"refused.web": "Këtu mund të hapen vetëm faqe interneti.",
"refused.workspace":
"Këtu mund të hapen vetëm faqe interneti dhe skedarë brenda hapësirës së punës së këtij sesioni.",
"refused.credentials": "Adresat me emër përdoruesi ose fjalëkalim nuk mund të hapen këtu.",
- inspect: "Zgjidhni një element për të komentuar",
- "inspect.active": "Klikoni një element në faqe për ta komentuar. Shtypni Escape për të anuluar.",
- "comment.label": "Komento këtë element",
"comment.placeholder": "Shtoni një koment opsional...",
- "comment.cancel": "Anulo komentin e elementit",
- "comment.submit": "Shto komentin e elementit",
- "comment.attach": "Shto elementin",
"comment.annotation": "Shënim i shfletuesit",
"home.title": "Hap një faqe",
"home.description": "Shikoni paraprakisht aplikacionin tuaj, lexoni dokumentacionin ose shfletoni internetin.",
@@ -37,24 +24,15 @@ export default {
"site.secure": "Lidhja është e sigurt",
"site.insecure": "Lidhja nuk është e sigurt",
"site.insecure.description": "Mos futni fjalëkalime ose informacione të tjera private në këtë faqe.",
- "site.local": "Server lokal",
- "site.local.description": "Adresat lokale hapen në makinën ku ekzekutohet serveri OpenCode.",
"site.file": "Skedar i hapësirës së punës",
"site.file.description": "Këtu mund të hapen vetëm skedarë brenda hapësirës së punës së këtij sesioni.",
- "site.network": "Faqet ngarkohen përmes rrjetit të {{server}}.",
"site.cookies": "Cookies dhe të dhënat e faqes",
"site.cookies.count.one": "{{count}} cookie në përdorim",
"site.cookies.count.other": "{{count}} cookies në përdorim",
"site.cookies.clear": "Pastro",
"site.permissions": "Lejet janë bllokuar",
"site.permissions.description": "Kamera, mikrofoni, vendndodhja dhe njoftimet nuk funksionojnë në këtë shfletues.",
- "site.agent": "Agjenti mund ta përdorë këtë faqe",
- "site.agent.description": "Mund ta lexojë faqen, të ekzekutojë skripte dhe të plotësojë formularë.",
"page.add": "Shto faqen në sesion",
- "page.placeholder": "Shtoni kontekst për këtë faqe",
- "external.open": "Hap në shfletuesin e sistemit",
- "external.menu": "Hap në shfletues",
- "external.unavailable": "Kjo adresë funksionon vetëm në makinën e serverit.",
options: "Opsionet e shfletuesit",
"zoom.in": "Zmadho",
"zoom.out": "Zvogëlo",
diff --git a/packages/gui-plugins/src/browser/i18n/sr.ts b/packages/gui-plugins/src/browser/i18n/sr.ts
index 6e8b7ca6cc80..2b46e4fdad0e 100644
--- a/packages/gui-plugins/src/browser/i18n/sr.ts
+++ b/packages/gui-plugins/src/browser/i18n/sr.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Прегледник",
"address.label": "Адреса прегледника",
"action.stop": "Стоп",
- replaced: "Контрола прегледника пребачена је у други прозор радне површине.",
unsupported: "Ова десктоп апликација не подржава панел прегледника.",
- suspended: "Прегледник је суспендован. Интерагујте са овом сесијом да бисте се поново повезали.",
- "failed.title": "URL није доступан",
- "failed.description": "Проверите URL и везу, па покушајте поново.",
"action.reload": "Поново учитај",
"model.timedOut": "Прегледач се предуго учитавао",
- "command.inspect": "Изаберите елемент на страници прегледача",
- "command.address": "Фокусирај адресу прегледача",
"command.close": "Затвори картицу прегледача",
"command.newTab": "Нова картица прегледача",
"tab.new": "Нова картица",
- "address.search": "Претражите или унесите URL",
"address.suggestions": "Предлози",
"refused.web": "Овде се могу отварати само веб странице.",
"refused.workspace": "Овде се могу отварати само веб странице и датотеке из радног простора ове сесије.",
"refused.credentials": "Адресе са корисничким именом или лозинком не могу се овде отварати.",
- inspect: "Изаберите елемент за коментарисање",
- "inspect.active": "Кликните на елемент на страници да бисте га коментарисали. Притисните Escape за отказивање.",
- "comment.label": "Коментариши овај елемент",
"comment.placeholder": "Додајте коментар (опционо)...",
- "comment.cancel": "Откажи коментар на елемент",
- "comment.submit": "Додај коментар на елемент",
- "comment.attach": "Додај елемент",
"comment.annotation": "Белешка из прегледача",
"home.title": "Отворите страницу",
"home.description": "Прегледајте своју апликацију, читајте документацију или претражујте веб.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "Веза је безбедна",
"site.insecure": "Веза није безбедна",
"site.insecure.description": "Не уносите лозинке ни друге приватне податке на овој страници.",
- "site.local": "Локални сервер",
- "site.local.description": "Локалне адресе се отварају на рачунару на коме ради OpenCode сервер.",
"site.file": "Датотека радног простора",
"site.file.description": "Овде се могу отварати само датотеке из радног простора ове сесије.",
- "site.network": "Странице се учитавају преко мреже сервера {{server}}.",
"site.cookies": "Колачићи и подаци сајта",
"site.cookies.count.one": "{{count}} колачић се користи",
"site.cookies.count.few": "{{count}} колачића се користе",
@@ -48,13 +32,7 @@ export default {
"site.cookies.clear": "Обриши",
"site.permissions": "Дозволе су блокиране",
"site.permissions.description": "Камера, микрофон, локација и обавештења не раде у овом прегледачу.",
- "site.agent": "Агент може да користи ову страницу",
- "site.agent.description": "Може да чита страницу, покреће скрипте и попуњава обрасце.",
"page.add": "Додај страницу у сесију",
- "page.placeholder": "Додајте контекст о овој страници",
- "external.open": "Отвори у системском прегледачу",
- "external.menu": "Отвори у прегледачу",
- "external.unavailable": "Ова адреса ради само на рачунару сервера.",
options: "Опције прегледача",
"zoom.in": "Увећај",
"zoom.out": "Умањи",
diff --git a/packages/gui-plugins/src/browser/i18n/sv.ts b/packages/gui-plugins/src/browser/i18n/sv.ts
index c4656fb443dd..bc6192bc7c6f 100644
--- a/packages/gui-plugins/src/browser/i18n/sv.ts
+++ b/packages/gui-plugins/src/browser/i18n/sv.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Webbläsare",
"address.label": "Webbläsarens adress",
"action.stop": "Stoppa",
- replaced: "Webbläsarkontrollen har flyttats till ett annat skrivbordsfönster.",
unsupported: "Den här skrivbordsappen stöder inte webbläsarpanelen.",
- suspended: "Webbläsaren avstängd. Interagera med den här sessionen för att återansluta.",
- "failed.title": "URL:en kan inte nås",
- "failed.description": "Kontrollera URL:en och anslutningen och försök igen.",
"action.reload": "Läs in igen",
"model.timedOut": "Webbläsaren tog för lång tid att läsa in",
- "command.inspect": "Välj ett element på webbsidan",
- "command.address": "Fokusera webbläsarens adressfält",
"command.close": "Stäng webbläsarflik",
"command.newTab": "Ny webbläsarflik",
"tab.new": "Ny flik",
- "address.search": "Sök eller ange en URL",
"address.suggestions": "Förslag",
"refused.web": "Endast webbsidor kan öppnas här.",
"refused.workspace": "Endast webbsidor och filer i den här sessionens arbetsyta kan öppnas här.",
"refused.credentials": "Adresser med användarnamn eller lösenord kan inte öppnas här.",
- inspect: "Välj ett element att kommentera",
- "inspect.active": "Klicka på ett element på sidan för att kommentera det. Tryck på Escape för att avbryta.",
- "comment.label": "Kommentera det här elementet",
"comment.placeholder": "Lägg till en valfri kommentar...",
- "comment.cancel": "Avbryt elementkommentar",
- "comment.submit": "Lägg till elementkommentar",
- "comment.attach": "Lägg till element",
"comment.annotation": "Webbläsaranteckning",
"home.title": "Öppna en sida",
"home.description": "Förhandsgranska din app, läs dokumentation eller surfa på webben.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Anslutningen är säker",
"site.insecure": "Anslutningen är inte säker",
"site.insecure.description": "Ange inte lösenord eller annan privat information på den här sidan.",
- "site.local": "Lokal server",
- "site.local.description": "Lokala adresser öppnas på datorn som kör OpenCode-servern.",
"site.file": "Fil i arbetsytan",
"site.file.description": "Endast filer i den här sessionens arbetsyta kan öppnas här.",
- "site.network": "Sidor läses in via nätverket för {{server}}.",
"site.cookies": "Cookies och webbplatsdata",
"site.cookies.count.one": "{{count}} cookie används",
"site.cookies.count.other": "{{count}} cookies används",
"site.cookies.clear": "Rensa",
"site.permissions": "Behörigheter är blockerade",
"site.permissions.description": "Kamera, mikrofon, plats och aviseringar fungerar inte i den här webbläsaren.",
- "site.agent": "Agenten kan använda den här sidan",
- "site.agent.description": "Den kan läsa sidan, köra skript och fylla i formulär.",
"page.add": "Lägg till sidan i sessionen",
- "page.placeholder": "Lägg till kontext om den här sidan",
- "external.open": "Öppna i systemets webbläsare",
- "external.menu": "Öppna i webbläsaren",
- "external.unavailable": "Den här adressen fungerar bara på serverns dator.",
options: "Webbläsaralternativ",
"zoom.in": "Zooma in",
"zoom.out": "Zooma ut",
diff --git a/packages/gui-plugins/src/browser/i18n/tg.ts b/packages/gui-plugins/src/browser/i18n/tg.ts
index f0d80942feff..b71401f658a3 100644
--- a/packages/gui-plugins/src/browser/i18n/tg.ts
+++ b/packages/gui-plugins/src/browser/i18n/tg.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Браузер",
"address.label": "Суроғаи браузер",
"action.stop": "Ист",
- replaced: "Назорати браузер ба равзанаи дигари мизи корӣ кӯчонида шуд.",
unsupported: "Ин барномаи мизи корӣ панели браузерро дастгирӣ намекунад.",
- suspended: "Браузер боздошта шуд. Барои аз нав пайваст шудан бо ин сессия муошират кунед.",
- "failed.title": "URL дастнорас аст",
- "failed.description": "URL ва пайвастшавиро санҷед ва аз нав кӯшиш кунед.",
"action.reload": "Аз нав бор кардан",
"model.timedOut": "Браузер хеле дер бор шуд",
- "command.inspect": "Интихоби унсур дар саҳифаи браузер",
- "command.address": "Фокус ба суроғаи браузер",
"command.close": "Пӯшидани варақаи браузер",
"command.newTab": "Варақаи нави браузер",
"tab.new": "Варақаи нав",
- "address.search": "Ҷустуҷӯ кунед ё URL ворид кунед",
"address.suggestions": "Пешниҳодҳо",
"refused.web": "Дар ин ҷо танҳо саҳифаҳои веб кушода мешаванд.",
"refused.workspace": "Дар ин ҷо танҳо саҳифаҳои веб ва файлҳои дохили фазои кории ин сессия кушода мешаванд.",
"refused.credentials": "Суроғаҳои дорои номи корбар ё парол дар ин ҷо кушода намешаванд.",
- inspect: "Барои шарҳ додан унсуреро интихоб кунед",
- "inspect.active": "Барои шарҳ додан ба унсуре дар саҳифа клик кунед. Барои бекор кардан Escape-ро пахш кунед.",
- "comment.label": "Шарҳ ба ин унсур",
"comment.placeholder": "Шарҳи ихтиёрӣ илова кунед...",
- "comment.cancel": "Бекор кардани шарҳи унсур",
- "comment.submit": "Илова кардани шарҳи унсур",
- "comment.attach": "Илова кардани унсур",
"comment.annotation": "Эзоҳи браузер",
"home.title": "Кушодани саҳифа",
"home.description": "Барномаи худро пешнамоиш кунед, ҳуҷҷатҳоро хонед ё вебро тамошо кунед.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Пайваст бехатар аст",
"site.insecure": "Пайваст бехатар нест",
"site.insecure.description": "Дар ин саҳифа парол ё дигар маълумоти шахсӣ ворид накунед.",
- "site.local": "Сервери маҳаллӣ",
- "site.local.description": "Суроғаҳои маҳаллӣ дар мошине кушода мешаванд, ки сервери OpenCode-ро иҷро мекунад.",
"site.file": "Файли фазои корӣ",
"site.file.description": "Дар ин ҷо танҳо файлҳои дохили фазои кории ин сессия кушода мешаванд.",
- "site.network": "Саҳифаҳо тавассути шабакаи {{server}} бор мешаванд.",
"site.cookies": "Cookie-ҳо ва маълумоти сайт",
"site.cookies.count.one": "{{count}} cookie истифода мешавад",
"site.cookies.count.other": "{{count}} cookie истифода мешавад",
"site.cookies.clear": "Тоза кардан",
"site.permissions": "Иҷозатҳо баста шудаанд",
"site.permissions.description": "Камера, микрофон, ҷойгиршавӣ ва огоҳиҳо дар ин браузер кор намекунанд.",
- "site.agent": "Агент метавонад ин саҳифаро истифода барад",
- "site.agent.description": "Он метавонад саҳифаро хонад, скриптҳо иҷро кунад ва шаклҳоро пур кунад.",
"page.add": "Илова кардани саҳифа ба сессия",
- "page.placeholder": "Дар бораи ин саҳифа контекст илова кунед",
- "external.open": "Кушодан дар браузери система",
- "external.menu": "Кушодан дар браузер",
- "external.unavailable": "Ин суроға танҳо дар мошини сервер кор мекунад.",
options: "Имконоти браузер",
"zoom.in": "Калон кардан",
"zoom.out": "Хурд кардан",
diff --git a/packages/gui-plugins/src/browser/i18n/th.ts b/packages/gui-plugins/src/browser/i18n/th.ts
index 716f4ff9dffe..416723281b9b 100644
--- a/packages/gui-plugins/src/browser/i18n/th.ts
+++ b/packages/gui-plugins/src/browser/i18n/th.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "เบราว์เซอร์",
"address.label": "ที่อยู่เบราว์เซอร์",
"action.stop": "หยุด",
- replaced: "การควบคุมเบราว์เซอร์ถูกย้ายไปยังหน้าต่างเดสก์ท็อปอื่น",
unsupported: "แอปเดสก์ท็อปนี้ไม่รองรับแผงเบราว์เซอร์",
- suspended: "เบราว์เซอร์ถูกพักการทำงาน โต้ตอบกับเซสชันนี้เพื่อเชื่อมต่อใหม่",
- "failed.title": "เข้าถึง URL ไม่ได้",
- "failed.description": "ตรวจสอบ URL และการเชื่อมต่อ แล้วลองอีกครั้ง",
"action.reload": "โหลดใหม่",
"model.timedOut": "เบราว์เซอร์ใช้เวลาโหลดนานเกินไป",
- "command.inspect": "เลือกองค์ประกอบในหน้าเบราว์เซอร์",
- "command.address": "โฟกัสแถบที่อยู่ของเบราว์เซอร์",
"command.close": "ปิดแท็บเบราว์เซอร์",
"command.newTab": "แท็บเบราว์เซอร์ใหม่",
"tab.new": "แท็บใหม่",
- "address.search": "ค้นหาหรือป้อน URL",
"address.suggestions": "คำแนะนำ",
"refused.web": "เปิดได้เฉพาะหน้าเว็บที่นี่",
"refused.workspace": "เปิดได้เฉพาะหน้าเว็บและไฟล์ภายในพื้นที่ทำงานของเซสชันนี้ที่นี่",
"refused.credentials": "ที่อยู่ที่มีชื่อผู้ใช้หรือรหัสผ่านไม่สามารถเปิดที่นี่ได้",
- inspect: "เลือกองค์ประกอบเพื่อแสดงความคิดเห็น",
- "inspect.active": "คลิกองค์ประกอบในหน้าเพื่อแสดงความคิดเห็น กด Escape เพื่อยกเลิก",
- "comment.label": "แสดงความคิดเห็นเกี่ยวกับองค์ประกอบนี้",
"comment.placeholder": "เพิ่มความคิดเห็น (ไม่บังคับ)...",
- "comment.cancel": "ยกเลิกความคิดเห็นองค์ประกอบ",
- "comment.submit": "เพิ่มความคิดเห็นองค์ประกอบ",
- "comment.attach": "เพิ่มองค์ประกอบ",
"comment.annotation": "คำอธิบายประกอบจากเบราว์เซอร์",
"home.title": "เปิดหน้า",
"home.description": "ดูตัวอย่างแอปของคุณ อ่านเอกสาร หรือท่องเว็บ",
@@ -36,24 +23,15 @@ export default {
"site.secure": "การเชื่อมต่อปลอดภัย",
"site.insecure": "การเชื่อมต่อไม่ปลอดภัย",
"site.insecure.description": "อย่าป้อนรหัสผ่านหรือข้อมูลส่วนตัวอื่น ๆ ในหน้านี้",
- "site.local": "เซิร์ฟเวอร์ในเครื่อง",
- "site.local.description": "ที่อยู่ในเครื่องจะเปิดบนเครื่องที่รันเซิร์ฟเวอร์ OpenCode",
"site.file": "ไฟล์ในพื้นที่ทำงาน",
"site.file.description": "เปิดได้เฉพาะไฟล์ภายในพื้นที่ทำงานของเซสชันนี้ที่นี่",
- "site.network": "หน้าเว็บโหลดผ่านเครือข่ายของ {{server}}",
"site.cookies": "คุกกี้และข้อมูลเว็บไซต์",
"site.cookies.count.one": "ใช้คุกกี้ {{count}} รายการ",
"site.cookies.count.other": "ใช้คุกกี้ {{count}} รายการ",
"site.cookies.clear": "ล้าง",
"site.permissions": "สิทธิ์ถูกบล็อก",
"site.permissions.description": "กล้อง ไมโครโฟน ตำแหน่ง และการแจ้งเตือนไม่ทำงานในเบราว์เซอร์นี้",
- "site.agent": "เอเจนต์ใช้หน้านี้ได้",
- "site.agent.description": "เอเจนต์สามารถอ่านหน้า เรียกใช้สคริปต์ และกรอกฟอร์มได้",
"page.add": "เพิ่มหน้าไปยังเซสชัน",
- "page.placeholder": "เพิ่มบริบทเกี่ยวกับหน้านี้",
- "external.open": "เปิดในเบราว์เซอร์ของระบบ",
- "external.menu": "เปิดในเบราว์เซอร์",
- "external.unavailable": "ที่อยู่นี้ใช้ได้เฉพาะบนเครื่องของเซิร์ฟเวอร์",
options: "ตัวเลือกเบราว์เซอร์",
"zoom.in": "ขยาย",
"zoom.out": "ย่อ",
diff --git a/packages/gui-plugins/src/browser/i18n/tk.ts b/packages/gui-plugins/src/browser/i18n/tk.ts
index f9f6cfb9f86e..794b17c351de 100644
--- a/packages/gui-plugins/src/browser/i18n/tk.ts
+++ b/packages/gui-plugins/src/browser/i18n/tk.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Brauzer",
"address.label": "Brauzeriň salgysy",
"action.stop": "Dur",
- replaced: "Brauzer dolandyryşy başga bir iş stolunyň penjiresine geçirildi.",
unsupported: "Bu iş stoly programmasy brauzer panelini goldamaýar.",
- suspended: "Brauzer togtadyldy Birikdirmek üçin bu sessiýa bilen täsirleşiň.",
- "failed.title": "URL elýeterli däl",
- "failed.description": "URL-i we birikmäňizi barlaň, soňra gaýtadan synanyşyň.",
"action.reload": "Täzeden ýükle",
"model.timedOut": "Brauzer ýüklenmek üçin gaty köp wagt aldy",
- "command.inspect": "Brauzer sahypasynda element saýlaň",
- "command.address": "Brauzer salgy setirine geçiň",
"command.close": "Brauzer goýmasyny ýapyň",
"command.newTab": "Täze brauzer goýmasy",
"tab.new": "Täze goýma",
- "address.search": "Gözläň ýa-da URL giriziň",
"address.suggestions": "Teklipler",
"refused.web": "Bu ýerde diňe web sahypalary açylyp bilýär.",
"refused.workspace": "Bu ýerde diňe web sahypalary we bu sessiýanyň workspace-indäki faýllar açylyp bilýär.",
"refused.credentials": "Ulanyjy ady ýa-da paroly bolan salgylar bu ýerde açylyp bilmeýär.",
- inspect: "Teswir ýazmak üçin element saýlaň",
- "inspect.active": "Teswir ýazmak üçin sahypadaky elemente basyň. Ýatyrmak üçin Escape düwmesini basyň.",
- "comment.label": "Bu element barada teswir ýazyň",
"comment.placeholder": "Islege görä teswir goşuň...",
- "comment.cancel": "Element teswirini ýatyryň",
- "comment.submit": "Element teswirini goşuň",
- "comment.attach": "Element goşuň",
"comment.annotation": "Brauzer belligi",
"home.title": "Sahypa açyň",
"home.description": "Programmaňyzy öňünden görüň, resminamalary okaň ýa-da webe göz aýlaň.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Birikme howpsuz",
"site.insecure": "Birikme howpsuz däl",
"site.insecure.description": "Bu sahypada parollary ýa-da beýleki şahsy maglumatlary girizmäň.",
- "site.local": "Ýerli serwer",
- "site.local.description": "Ýerli salgylar OpenCode serweri işleýän kompýuterde açylýar.",
"site.file": "Workspace faýly",
"site.file.description": "Bu ýerde diňe bu sessiýanyň workspace-indäki faýllar açylyp bilýär.",
- "site.network": "Sahypalar {{server}} serweriniň tory arkaly ýüklenýär.",
"site.cookies": "Cookie-ler we saýt maglumatlary",
"site.cookies.count.one": "{{count}} cookie ulanylýar",
"site.cookies.count.other": "{{count}} cookie ulanylýar",
"site.cookies.clear": "Arassala",
"site.permissions": "Rugsatlar petiklenen",
"site.permissions.description": "Kamera, mikrofon, ýerleşiş we habarnamalar bu brauzerde işlemeýär.",
- "site.agent": "Agent bu sahypany ulanyp biler",
- "site.agent.description": "Ol sahypany okap, skriptleri işledip we formalary doldurup biler.",
"page.add": "Sahypany sessiýa goşuň",
- "page.placeholder": "Bu sahypa barada kontekst goşuň",
- "external.open": "Ulgam brauzerinde açyň",
- "external.menu": "Brauzerde açyň",
- "external.unavailable": "Bu salgy diňe serweriň kompýuterinde işleýär.",
options: "Brauzer sazlamalary",
"zoom.in": "Ulalt",
"zoom.out": "Kiçelt",
diff --git a/packages/gui-plugins/src/browser/i18n/tr.ts b/packages/gui-plugins/src/browser/i18n/tr.ts
index d390654cb30f..1a6733ceab1e 100644
--- a/packages/gui-plugins/src/browser/i18n/tr.ts
+++ b/packages/gui-plugins/src/browser/i18n/tr.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Tarayıcı",
"address.label": "Tarayıcı adresi",
"action.stop": "Durdur",
- replaced: "Tarayıcı kontrolü başka bir masaüstü penceresine taşındı.",
unsupported: "Bu masaüstü uygulaması tarayıcı bölmesini desteklemiyor.",
- suspended: "Tarayıcı askıya alındı. Yeniden bağlanmak için bu oturumla etkileşim kurun.",
- "failed.title": "URL’ye erişilemiyor",
- "failed.description": "URL’yi ve bağlantınızı kontrol edip yeniden deneyin.",
"action.reload": "Yeniden yükle",
"model.timedOut": "Tarayıcının yüklenmesi çok uzun sürdü",
- "command.inspect": "Tarayıcı sayfasında bir öğe seç",
- "command.address": "Tarayıcı adres çubuğuna odaklan",
"command.close": "Tarayıcı sekmesini kapat",
"command.newTab": "Yeni tarayıcı sekmesi",
"tab.new": "Yeni sekme",
- "address.search": "Arayın veya bir URL girin",
"address.suggestions": "Öneriler",
"refused.web": "Burada yalnızca web sayfaları açılabilir.",
"refused.workspace": "Burada yalnızca web sayfaları ve bu oturumun çalışma alanındaki dosyalar açılabilir.",
"refused.credentials": "Kullanıcı adı veya parola içeren adresler burada açılamaz.",
- inspect: "Yorum yapmak için bir öğe seçin",
- "inspect.active": "Yorum yapmak için sayfadaki bir öğeye tıklayın. İptal etmek için Escape tuşuna basın.",
- "comment.label": "Bu öğeye yorum yap",
"comment.placeholder": "İsteğe bağlı bir yorum ekleyin...",
- "comment.cancel": "Öğe yorumunu iptal et",
- "comment.submit": "Öğe yorumu ekle",
- "comment.attach": "Öğe ekle",
"comment.annotation": "Tarayıcı notu",
"home.title": "Bir sayfa açın",
"home.description": "Uygulamanızı önizleyin, belgeleri okuyun veya web'de gezinin.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Bağlantı güvenli",
"site.insecure": "Bağlantı güvenli değil",
"site.insecure.description": "Bu sayfaya parola veya diğer özel bilgileri girmeyin.",
- "site.local": "Yerel sunucu",
- "site.local.description": "Yerel adresler, OpenCode sunucusunu çalıştıran makinede açılır.",
"site.file": "Çalışma alanı dosyası",
"site.file.description": "Burada yalnızca bu oturumun çalışma alanındaki dosyalar açılabilir.",
- "site.network": "Sayfalar {{server}} ağı üzerinden yüklenir.",
"site.cookies": "Çerezler ve site verileri",
"site.cookies.count.one": "{{count}} çerez kullanılıyor",
"site.cookies.count.other": "{{count}} çerez kullanılıyor",
"site.cookies.clear": "Temizle",
"site.permissions": "İzinler engellendi",
"site.permissions.description": "Kamera, mikrofon, konum ve bildirimler bu tarayıcıda çalışmaz.",
- "site.agent": "Ajan bu sayfayı kullanabilir",
- "site.agent.description": "Sayfayı okuyabilir, betik çalıştırabilir ve formları doldurabilir.",
"page.add": "Sayfayı oturuma ekle",
- "page.placeholder": "Bu sayfa hakkında bağlam ekleyin",
- "external.open": "Sistem tarayıcısında aç",
- "external.menu": "Tarayıcıda aç",
- "external.unavailable": "Bu adres yalnızca sunucunun makinesinde çalışır.",
options: "Tarayıcı seçenekleri",
"zoom.in": "Yakınlaştır",
"zoom.out": "Uzaklaştır",
diff --git a/packages/gui-plugins/src/browser/i18n/uk.ts b/packages/gui-plugins/src/browser/i18n/uk.ts
index 3f005294fd3a..2d4573b744fd 100644
--- a/packages/gui-plugins/src/browser/i18n/uk.ts
+++ b/packages/gui-plugins/src/browser/i18n/uk.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Веббраузер",
"address.label": "Адреса веббраузера",
"action.stop": "Зупинити",
- replaced: "Керування веббраузером переміщено в інше вікно робочого столу.",
unsupported: "Цей додаток для робочого столу не підтримує панель веббраузера.",
- suspended: "Веббраузер призупинено. Взаємодійте із цією сесією, щоб перепідключитися.",
- "failed.title": "Не вдається відкрити URL",
- "failed.description": "Перевірте URL і з’єднання, а потім повторіть спробу.",
"action.reload": "Перезавантажити",
"model.timedOut": "Браузер завантажувався занадто довго",
- "command.inspect": "Вибрати елемент на сторінці браузера",
- "command.address": "Фокус на адресному рядку браузера",
"command.close": "Закрити вкладку браузера",
"command.newTab": "Нова вкладка браузера",
"tab.new": "Нова вкладка",
- "address.search": "Шукайте або введіть URL",
"address.suggestions": "Пропозиції",
"refused.web": "Тут можна відкривати лише вебсторінки.",
"refused.workspace": "Тут можна відкривати лише вебсторінки та файли з робочого простору цієї сесії.",
"refused.credentials": "Адреси з іменем користувача або паролем тут не відкриваються.",
- inspect: "Виберіть елемент, щоб прокоментувати",
- "inspect.active": "Клацніть елемент на сторінці, щоб прокоментувати його. Натисніть Escape, щоб скасувати.",
- "comment.label": "Прокоментувати цей елемент",
"comment.placeholder": "Додайте коментар (необов’язково)...",
- "comment.cancel": "Скасувати коментар до елемента",
- "comment.submit": "Додати коментар до елемента",
- "comment.attach": "Додати елемент",
"comment.annotation": "Примітка браузера",
"home.title": "Відкрийте сторінку",
"home.description": "Перегляньте свій застосунок, читайте документацію або переглядайте інтернет.",
@@ -36,11 +23,8 @@ export default {
"site.secure": "З’єднання захищене",
"site.insecure": "З’єднання не захищене",
"site.insecure.description": "Не вводьте паролі чи іншу особисту інформацію на цій сторінці.",
- "site.local": "Локальний сервер",
- "site.local.description": "Локальні адреси відкриваються на машині, де працює сервер OpenCode.",
"site.file": "Файл робочого простору",
"site.file.description": "Тут можна відкривати лише файли з робочого простору цієї сесії.",
- "site.network": "Сторінки завантажуються через мережу {{server}}.",
"site.cookies": "Файли cookie та дані сайтів",
"site.cookies.count.one": "Використовується {{count}} файл cookie",
"site.cookies.count.few": "Використовуються {{count}} файли cookie",
@@ -49,13 +33,7 @@ export default {
"site.cookies.clear": "Очистити",
"site.permissions": "Дозволи заблоковано",
"site.permissions.description": "Камера, мікрофон, геолокація та сповіщення не працюють у цьому браузері.",
- "site.agent": "Агент може використовувати цю сторінку",
- "site.agent.description": "Він може читати сторінку, запускати скрипти й заповнювати форми.",
"page.add": "Додати сторінку до сесії",
- "page.placeholder": "Додайте контекст про цю сторінку",
- "external.open": "Відкрити в системному браузері",
- "external.menu": "Відкрити в браузері",
- "external.unavailable": "Ця адреса працює лише на машині сервера.",
options: "Параметри браузера",
"zoom.in": "Збільшити",
"zoom.out": "Зменшити",
diff --git a/packages/gui-plugins/src/browser/i18n/ur.ts b/packages/gui-plugins/src/browser/i18n/ur.ts
index b8ff28134810..133a7ae262bf 100644
--- a/packages/gui-plugins/src/browser/i18n/ur.ts
+++ b/packages/gui-plugins/src/browser/i18n/ur.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "براؤزر",
"address.label": "براؤزر کا پتہ",
"action.stop": "روکیں",
- replaced: "براؤزر کنٹرول کو دوسری ڈیسک ٹاپ ونڈو میں منتقل کر دیا گیا۔",
unsupported: "یہ ڈیسک ٹاپ ایپ براؤزر پین کو سپورٹ نہیں کرتی ہے۔",
- suspended: "براؤزر معطل۔ دوبارہ منسلک ہونے کے لیے اس سیشن کے ساتھ تعامل کریں۔",
- "failed.title": "URL تک رسائی نہیں ہو سکی",
- "failed.description": "URL اور اپنا کنکشن چیک کریں، پھر دوبارہ کوشش کریں۔",
"action.reload": "دوبارہ لوڈ کریں",
"model.timedOut": "براؤزر نے لوڈ ہونے میں بہت زیادہ وقت لیا",
- "command.inspect": "براؤزر کے صفحے میں کوئی عنصر منتخب کریں",
- "command.address": "براؤزر کے پتے پر فوکس کریں",
"command.close": "براؤزر ٹیب بند کریں",
"command.newTab": "نیا براؤزر ٹیب",
"tab.new": "نیا ٹیب",
- "address.search": "تلاش کریں یا URL درج کریں",
"address.suggestions": "تجاویز",
"refused.web": "یہاں صرف ویب صفحات کھل سکتے ہیں۔",
"refused.workspace": "یہاں صرف ویب صفحات اور اس سیشن کی ورک اسپیس کے اندر موجود فائلیں کھل سکتی ہیں۔",
"refused.credentials": "صارف نام یا پاس ورڈ والے پتے یہاں نہیں کھل سکتے۔",
- inspect: "تبصرہ کرنے کے لیے کوئی عنصر منتخب کریں",
- "inspect.active": "صفحے میں کسی عنصر پر تبصرہ کرنے کے لیے اس پر کلک کریں۔ منسوخ کرنے کے لیے Escape دبائیں۔",
- "comment.label": "اس عنصر پر تبصرہ کریں",
"comment.placeholder": "اختیاری تبصرہ شامل کریں...",
- "comment.cancel": "عنصر پر تبصرہ منسوخ کریں",
- "comment.submit": "عنصر پر تبصرہ شامل کریں",
- "comment.attach": "عنصر شامل کریں",
"comment.annotation": "براؤزر نوٹ",
"home.title": "کوئی صفحہ کھولیں",
"home.description": "اپنی ایپ کا پیش منظر دیکھیں، دستاویزات پڑھیں یا ویب براؤز کریں۔",
@@ -36,24 +23,15 @@ export default {
"site.secure": "کنکشن محفوظ ہے",
"site.insecure": "کنکشن محفوظ نہیں ہے",
"site.insecure.description": "اس صفحے پر پاس ورڈ یا دوسری نجی معلومات درج نہ کریں۔",
- "site.local": "مقامی سرور",
- "site.local.description": "مقامی پتے اس مشین پر کھلتے ہیں جو OpenCode سرور چلاتی ہے۔",
"site.file": "ورک اسپیس فائل",
"site.file.description": "یہاں صرف اس سیشن کی ورک اسپیس کے اندر موجود فائلیں کھل سکتی ہیں۔",
- "site.network": "صفحات {{server}} کے نیٹ ورک کے ذریعے لوڈ ہوتے ہیں۔",
"site.cookies": "کوکیز اور سائٹ ڈیٹا",
"site.cookies.count.one": "{{count}} کوکی استعمال میں",
"site.cookies.count.other": "{{count}} کوکیز استعمال میں",
"site.cookies.clear": "صاف کریں",
"site.permissions": "اجازتیں مسدود ہیں",
"site.permissions.description": "اس براؤزر میں کیمرہ، مائیکروفون، مقام اور اطلاعات کام نہیں کرتے۔",
- "site.agent": "ایجنٹ یہ صفحہ استعمال کر سکتا ہے",
- "site.agent.description": "یہ صفحہ پڑھ سکتا ہے، اسکرپٹس چلا سکتا ہے اور فارم بھر سکتا ہے۔",
"page.add": "صفحہ سیشن میں شامل کریں",
- "page.placeholder": "اس صفحے کے بارے میں سیاق و سباق شامل کریں",
- "external.open": "سسٹم براؤزر میں کھولیں",
- "external.menu": "براؤزر میں کھولیں",
- "external.unavailable": "یہ پتہ صرف سرور والی مشین پر کام کرتا ہے۔",
options: "براؤزر کے اختیارات",
"zoom.in": "بڑا کریں",
"zoom.out": "چھوٹا کریں",
diff --git a/packages/gui-plugins/src/browser/i18n/uz.ts b/packages/gui-plugins/src/browser/i18n/uz.ts
index 95437eac6600..19e5f1273f2e 100644
--- a/packages/gui-plugins/src/browser/i18n/uz.ts
+++ b/packages/gui-plugins/src/browser/i18n/uz.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Brauzer",
"address.label": "Brauzer manzili",
"action.stop": "To'xtang",
- replaced: "Brauzer boshqaruvi boshqa ish stoli oynasiga ko'chirildi.",
unsupported: "Bu ish stoli ilovasi brauzer panelini qoʻllab-quvvatlamaydi.",
- suspended: "Brauzer to'xtatildi. Qayta ulanish uchun ushbu seans bilan oʻzaro aloqada boʻling.",
- "failed.title": "URL manziliga kirib bo‘lmadi",
- "failed.description": "URL va ulanishingizni tekshiring, so‘ng qayta urinib ko‘ring.",
"action.reload": "Qayta yuklash",
"model.timedOut": "Brauzer juda uzoq yuklandi",
- "command.inspect": "Brauzer sahifasida elementni tanlash",
- "command.address": "Brauzer manzil satriga o‘tish",
"command.close": "Brauzer varag‘ini yopish",
"command.newTab": "Yangi brauzer varag‘i",
"tab.new": "Yangi varaq",
- "address.search": "Qidiring yoki URL kiriting",
"address.suggestions": "Takliflar",
"refused.web": "Bu yerda faqat veb-sahifalarni ochish mumkin.",
"refused.workspace": "Bu yerda faqat veb-sahifalar va ushbu sessiya ish maydonidagi fayllarni ochish mumkin.",
"refused.credentials": "Foydalanuvchi nomi yoki parol bo‘lgan manzillarni bu yerda ochib bo‘lmaydi.",
- inspect: "Izoh berish uchun elementni tanlang",
- "inspect.active": "Izoh berish uchun sahifadagi elementni bosing. Bekor qilish uchun Escape tugmasini bosing.",
- "comment.label": "Bu elementga izoh berish",
"comment.placeholder": "Ixtiyoriy izoh qo‘shing...",
- "comment.cancel": "Element izohini bekor qilish",
- "comment.submit": "Element izohini qo‘shish",
- "comment.attach": "Elementni qo‘shish",
"comment.annotation": "Brauzer izohi",
"home.title": "Sahifani ochish",
"home.description": "Ilovangizni oldindan ko‘ring, hujjatlarni o‘qing yoki vebni ko‘zdan kechiring.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Ulanish xavfsiz",
"site.insecure": "Ulanish xavfsiz emas",
"site.insecure.description": "Bu sahifada parollar yoki boshqa shaxsiy ma’lumotlarni kiritmang.",
- "site.local": "Mahalliy server",
- "site.local.description": "Mahalliy manzillar OpenCode serveri ishlayotgan kompyuterda ochiladi.",
"site.file": "Ish maydoni fayli",
"site.file.description": "Bu yerda faqat ushbu sessiya ish maydonidagi fayllarni ochish mumkin.",
- "site.network": "Sahifalar {{server}} tarmog‘i orqali yuklanadi.",
"site.cookies": "Kuki va sayt ma’lumotlari",
"site.cookies.count.one": "{{count}} ta kuki ishlatilmoqda",
"site.cookies.count.other": "{{count}} ta kuki ishlatilmoqda",
"site.cookies.clear": "Tozalash",
"site.permissions": "Ruxsatlar bloklangan",
"site.permissions.description": "Bu brauzerda kamera, mikrofon, joylashuv va bildirishnomalar ishlamaydi.",
- "site.agent": "Agent bu sahifadan foydalanishi mumkin",
- "site.agent.description": "U sahifani o‘qishi, skriptlarni ishga tushirishi va shakllarni to‘ldirishi mumkin.",
"page.add": "Sahifani sessiyaga qo‘shish",
- "page.placeholder": "Bu sahifa haqida kontekst qo‘shing",
- "external.open": "Tizim brauzerida ochish",
- "external.menu": "Brauzerda ochish",
- "external.unavailable": "Bu manzil faqat server kompyuterida ishlaydi.",
options: "Brauzer parametrlari",
"zoom.in": "Kattalashtirish",
"zoom.out": "Kichraytirish",
diff --git a/packages/gui-plugins/src/browser/i18n/vi.ts b/packages/gui-plugins/src/browser/i18n/vi.ts
index 47f50db3b66f..b5248f7a7d5e 100644
--- a/packages/gui-plugins/src/browser/i18n/vi.ts
+++ b/packages/gui-plugins/src/browser/i18n/vi.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "Trình duyệt",
"address.label": "Địa chỉ trình duyệt",
"action.stop": "Dừng",
- replaced: "Điều khiển trình duyệt đã được chuyển sang cửa sổ máy tính để bàn khác.",
unsupported: "Ứng dụng máy tính để bàn này không hỗ trợ ngăn trình duyệt.",
- suspended: "Trình duyệt bị tạm dừng. Tương tác với phiên này để kết nối lại.",
- "failed.title": "Không thể truy cập URL",
- "failed.description": "Kiểm tra URL và kết nối, rồi thử lại.",
"action.reload": "Tải lại",
"model.timedOut": "Trình duyệt tải quá lâu",
- "command.inspect": "Chọn một phần tử trên trang trình duyệt",
- "command.address": "Tập trung vào thanh địa chỉ trình duyệt",
"command.close": "Đóng tab trình duyệt",
"command.newTab": "Tab trình duyệt mới",
"tab.new": "Tab mới",
- "address.search": "Tìm kiếm hoặc nhập URL",
"address.suggestions": "Gợi ý",
"refused.web": "Chỉ có thể mở trang web ở đây.",
"refused.workspace": "Chỉ có thể mở trang web và các tệp trong không gian làm việc của phiên này ở đây.",
"refused.credentials": "Không thể mở địa chỉ có tên người dùng hoặc mật khẩu ở đây.",
- inspect: "Chọn một phần tử để bình luận",
- "inspect.active": "Nhấp vào một phần tử trên trang để bình luận. Nhấn Escape để hủy.",
- "comment.label": "Bình luận về phần tử này",
"comment.placeholder": "Thêm bình luận (tùy chọn)...",
- "comment.cancel": "Hủy bình luận phần tử",
- "comment.submit": "Thêm bình luận phần tử",
- "comment.attach": "Thêm phần tử",
"comment.annotation": "Chú thích trình duyệt",
"home.title": "Mở một trang",
"home.description": "Xem trước ứng dụng, đọc tài liệu hoặc duyệt web.",
@@ -36,24 +23,15 @@ export default {
"site.secure": "Kết nối an toàn",
"site.insecure": "Kết nối không an toàn",
"site.insecure.description": "Không nhập mật khẩu hoặc thông tin riêng tư khác trên trang này.",
- "site.local": "Máy chủ cục bộ",
- "site.local.description": "Địa chỉ cục bộ được mở trên máy đang chạy máy chủ OpenCode.",
"site.file": "Tệp trong không gian làm việc",
"site.file.description": "Chỉ có thể mở các tệp trong không gian làm việc của phiên này ở đây.",
- "site.network": "Các trang được tải qua mạng của {{server}}.",
"site.cookies": "Cookie và dữ liệu trang web",
"site.cookies.count.one": "Đang dùng {{count}} cookie",
"site.cookies.count.other": "Đang dùng {{count}} cookie",
"site.cookies.clear": "Xóa",
"site.permissions": "Các quyền bị chặn",
"site.permissions.description": "Camera, micrô, vị trí và thông báo không hoạt động trong trình duyệt này.",
- "site.agent": "Tác nhân có thể dùng trang này",
- "site.agent.description": "Tác nhân có thể đọc trang, chạy script và điền biểu mẫu.",
"page.add": "Thêm trang vào phiên",
- "page.placeholder": "Thêm ngữ cảnh về trang này",
- "external.open": "Mở trong trình duyệt hệ thống",
- "external.menu": "Mở trong trình duyệt",
- "external.unavailable": "Địa chỉ này chỉ hoạt động trên máy chạy máy chủ.",
options: "Tùy chọn trình duyệt",
"zoom.in": "Phóng to",
"zoom.out": "Thu nhỏ",
diff --git a/packages/gui-plugins/src/browser/i18n/zh.ts b/packages/gui-plugins/src/browser/i18n/zh.ts
index 4d5c8f55f9d3..1ed0166ee444 100644
--- a/packages/gui-plugins/src/browser/i18n/zh.ts
+++ b/packages/gui-plugins/src/browser/i18n/zh.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "浏览器",
"address.label": "浏览器地址",
"action.stop": "停止",
- replaced: "浏览器控件已移动到另一个桌面窗口。",
unsupported: "此桌面应用程序不支持浏览器面板。",
- suspended: "浏览器已挂起。请与此会话交互以重新连接。",
- "failed.title": "无法访问 URL",
- "failed.description": "请检查 URL 和网络连接,然后重试。",
"action.reload": "重新加载",
"model.timedOut": "浏览器加载超时",
- "command.inspect": "在浏览器页面中选择元素",
- "command.address": "聚焦浏览器地址栏",
"command.close": "关闭浏览器标签页",
"command.newTab": "新建浏览器标签页",
"tab.new": "新建标签页",
- "address.search": "搜索或输入 URL",
"address.suggestions": "建议",
"refused.web": "此处只能打开网页。",
"refused.workspace": "此处只能打开网页和此会话工作区内的文件。",
"refused.credentials": "此处无法打开包含用户名或密码的地址。",
- inspect: "选择要评论的元素",
- "inspect.active": "点击页面中的元素以进行评论。按 Escape 取消。",
- "comment.label": "评论此元素",
"comment.placeholder": "添加评论(可选)…",
- "comment.cancel": "取消元素评论",
- "comment.submit": "添加元素评论",
- "comment.attach": "添加元素",
"comment.annotation": "浏览器批注",
"home.title": "打开页面",
"home.description": "预览你的应用、阅读文档或浏览网页。",
@@ -36,24 +23,15 @@ export default {
"site.secure": "连接是安全的",
"site.insecure": "连接不安全",
"site.insecure.description": "请勿在此页面上输入密码或其他私人信息。",
- "site.local": "本地服务器",
- "site.local.description": "本地地址会在运行 OpenCode 服务器的机器上打开。",
"site.file": "工作区文件",
"site.file.description": "此处只能打开此会话工作区内的文件。",
- "site.network": "页面通过 {{server}} 的网络加载。",
"site.cookies": "Cookie 和网站数据",
"site.cookies.count.one": "正在使用 {{count}} 个 Cookie",
"site.cookies.count.other": "正在使用 {{count}} 个 Cookie",
"site.cookies.clear": "清除",
"site.permissions": "权限已被阻止",
"site.permissions.description": "摄像头、麦克风、位置和通知在此浏览器中不可用。",
- "site.agent": "智能体可以使用此页面",
- "site.agent.description": "它可以读取页面、运行脚本和填写表单。",
"page.add": "将页面添加到会话",
- "page.placeholder": "添加关于此页面的上下文",
- "external.open": "在系统浏览器中打开",
- "external.menu": "在浏览器中打开",
- "external.unavailable": "此地址仅在服务器所在机器上有效。",
options: "浏览器选项",
"zoom.in": "放大",
"zoom.out": "缩小",
diff --git a/packages/gui-plugins/src/browser/i18n/zht.ts b/packages/gui-plugins/src/browser/i18n/zht.ts
index 5d51f9c9fed9..30ee3ddfe505 100644
--- a/packages/gui-plugins/src/browser/i18n/zht.ts
+++ b/packages/gui-plugins/src/browser/i18n/zht.ts
@@ -4,30 +4,17 @@ export default {
"tab.title": "瀏覽器",
"address.label": "瀏覽器位址",
"action.stop": "停止",
- replaced: "瀏覽器控制已移至另一個桌面視窗。",
unsupported: "此桌面應用程式不支援瀏覽器面板。",
- suspended: "瀏覽器已暫停。與此工作階段互動以重新連線。",
- "failed.title": "無法連上 URL",
- "failed.description": "請檢查 URL 和網路連線,然後再試一次。",
"action.reload": "重新載入",
"model.timedOut": "瀏覽器載入時間過長",
- "command.inspect": "選取瀏覽器頁面中的元素",
- "command.address": "聚焦瀏覽器網址列",
"command.close": "關閉瀏覽器分頁",
"command.newTab": "新增瀏覽器分頁",
"tab.new": "新增分頁",
- "address.search": "搜尋或輸入網址",
"address.suggestions": "建議",
"refused.web": "這裡只能開啟網頁。",
"refused.workspace": "這裡只能開啟網頁和此工作階段工作區內的檔案。",
"refused.credentials": "這裡無法開啟包含使用者名稱或密碼的位址。",
- inspect: "選取要留言的元素",
- "inspect.active": "按一下頁面中的元素以留言。按 Escape 取消。",
- "comment.label": "對此元素留言",
"comment.placeholder": "新增選填留言...",
- "comment.cancel": "取消元素留言",
- "comment.submit": "新增元素留言",
- "comment.attach": "新增元素",
"comment.annotation": "瀏覽器註解",
"home.title": "開啟頁面",
"home.description": "預覽你的應用程式、閱讀文件或瀏覽網頁。",
@@ -36,24 +23,15 @@ export default {
"site.secure": "連線安全",
"site.insecure": "連線不安全",
"site.insecure.description": "請勿在此頁面輸入密碼或其他私人資訊。",
- "site.local": "本機伺服器",
- "site.local.description": "本機位址會在執行 OpenCode 伺服器的電腦上開啟。",
"site.file": "工作區檔案",
"site.file.description": "這裡只能開啟此工作階段工作區內的檔案。",
- "site.network": "頁面透過 {{server}} 的網路載入。",
"site.cookies": "Cookie 和網站資料",
"site.cookies.count.one": "使用中的 Cookie:{{count}} 個",
"site.cookies.count.other": "使用中的 Cookie:{{count}} 個",
"site.cookies.clear": "清除",
"site.permissions": "權限已封鎖",
"site.permissions.description": "攝影機、麥克風、位置和通知在此瀏覽器中無法使用。",
- "site.agent": "代理程式可以使用此頁面",
- "site.agent.description": "它可以讀取頁面、執行指令碼和填寫表單。",
"page.add": "將頁面加入工作階段",
- "page.placeholder": "新增此頁面的相關上下文",
- "external.open": "在系統瀏覽器中開啟",
- "external.menu": "在瀏覽器中開啟",
- "external.unavailable": "此位址只能在伺服器的電腦上使用。",
options: "瀏覽器選項",
"zoom.in": "放大",
"zoom.out": "縮小",
diff --git a/packages/gui-plugins/src/browser/import-prompt.tsx b/packages/gui-plugins/src/browser/import-prompt.tsx
new file mode 100644
index 000000000000..9a89f3b0680f
--- /dev/null
+++ b/packages/gui-plugins/src/browser/import-prompt.tsx
@@ -0,0 +1,258 @@
+import { Icon } from "@opencode/ui/icon"
+import { IconButton } from "@opencode/ui/icon-button"
+import { Menu } from "@opencode/ui/menu"
+import { Tooltip } from "@opencode/ui/tooltip"
+import { createMemo, For, getOwner, onCleanup, runWithOwner, Show, type Accessor } from "solid-js"
+import { usePlugin } from "@opencode/plugin/gui"
+import { choiceLabel, Glyph, profileChoices, type Choice } from "./choices"
+import type definition from "./index"
+import { createProfileJobs } from "./jobs"
+import { importedCookies, importLoss } from "./jobs-machine"
+import { SiteChooser } from "./site-chooser"
+
+/**
+ * The pane's offer to bring sign-ins from the browser the user already uses, until they import or decline once. A
+ * `bar` sits above a page, where a signed-out site is the reason to import; a `card` sits on the new tab page.
+ * Nothing shows where no other browser is installed, or while main's profile is away.
+ *
+ * Once cookies came in it says so, in place of the offer, until the user closes it: a page that loads again signed in is
+ * the proof, and this names where the sign-ins came from.
+ *
+ * `imported` runs once cookies came in, for the pane to load its page again with them, and `closed` when the user
+ * closes the confirmation.
+ */
+export function SignInOffer(props: { variant: "bar" | "card"; imported: () => void; closed: () => void }) {
+ const ctx = usePlugin()
+ const ui = ctx.ui
+ const preferences = ctx.stores.preferences
+
+ const jobs = createProfileJobs({
+ finished(finished) {
+ if (importedCookies(finished.outcome) > 0) props.imported()
+ },
+ })
+
+ const choices = createMemo(() => profileChoices(jobs.sources()))
+ // Sign-ins that cannot be saved are not offered; what the Keychain prompt asks shows while it is open.
+ const blocked = () => !jobs.available() || jobs.running() !== undefined || jobs.unsaved() !== undefined
+ const message = () => jobs.unsaved() ?? jobs.notice() ?? jobs.describe(jobs.last())
+
+ // The import that brought cookies, with the browser's name, while its confirmation shows.
+ const confirmed = createMemo(() => {
+ const last = jobs.last()
+ const count = last ? importedCookies(last.outcome) : 0
+
+ if (!last || count === 0 || last.job.type !== "import-browser") return undefined
+ const job = last.job
+ const choice = choices().find((item) => item.source.id === job.source && item.profile.id === job.profile)
+ const outcome = last.outcome
+ const partial = outcome.type === "imported" && outcome.result.type === "imported" && importLoss(outcome.result)
+
+ return {
+ choice,
+ text: partial
+ ? (jobs.describe(last)?.text ?? "")
+ : ctx.plural("signins.imported.from", count, { browser: choice?.source.name ?? "" }),
+ }
+ })
+
+ // The pane shows the bar over a page and the card on the new tab page, each its own offer: one that goes while it
+ // confirms an import, as when the user opens a page instead of closing it, ends the confirmation, so the pane does
+ // not keep waiting for a close that can no longer come.
+ onCleanup(() => {
+ if (confirmed()) props.closed()
+ })
+
+ const decline = () => preferences.set({ ...preferences.value, welcomed: true })
+ const settings = () => ctx.layout.settings("browser")
+
+ const run = (choice: Choice) =>
+ jobs.start({ type: "import-browser", source: choice.source.id, profile: choice.profile.id })
+
+ // The dialog's import is one of this offer's jobs, which says how it ended, so the dialog goes with the offer.
+ const owner = getOwner()
+
+ const chooseSites = (choice: Choice) =>
+ runWithOwner(owner, () =>
+ ctx.dialogs.open((dialog) => dialog.close()} />),
+ )
+
+ return (
+ {(first) => offer(first)}
+ }
+ >
+ {(done) => (
+
+
+
+
+
+ {done().text}
+
+
+ }
+ aria-label={ctx.t("common.close")}
+ onClick={() => {
+ jobs.dismiss()
+ props.closed()
+ }}
+ />
+
+
+
+ )}
+
+ )
+
+ function offer(first: Accessor) {
+ return (
+
+
+
+ {ctx.t("signins.title")}
+
+
+ {ctx.t("signins.description")}
+
+
+
+
+ {(choice) => (
+
+
+
+ {choiceLabel(choice)}
+
+ run(choice)}>
+ {ctx.t("signins.action")}
+
+
+ )}
+
+
+
+ {(current) => (
+
+ {current().text}
+
+ )}
+
+
+ chooseSites(first())}>
+ {ctx.t("signins.choose")}
+
+
+ {ctx.t("signins.dismiss")}
+
+
+ {ctx.t("signins.more")}
+
+
+
+ }
+ >
+
+
+
+ {ctx.t("signins.bar")}
+
+ }
+ >
+ {(current) => (
+
+ {current().text}
+
+ )}
+
+
+ run(first())}
+ >
+ {ctx.t("signins.import", { browser: choiceLabel(first()) })}
+
+