Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions packages/gui-extensions/src/browser/pane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export function createBrowserPane(input: {
]),
),
focusedTabID: previous.focusedTabID,
partition: `opencode-browser-${crypto.randomUUID()}`,
partition: "persist:opencode-browser",
storageKey,
fileRoots: [],
}
Expand All @@ -123,16 +123,10 @@ export function createBrowserPane(input: {
let attached = false
const stop = () => close(entry, reason)

const navigate = (event: Electron.Event<{ isMainFrame: boolean; isSameDocument: boolean }>) => {
if (event.isMainFrame && !event.isSameDocument) stop()
}

win.webContents.once("destroyed", stop)
win.webContents.on("did-start-navigation", navigate)
entry.cleanup = () => {
if (win.isDestroyed()) return
win.webContents.off("destroyed", stop)
win.webContents.off("did-start-navigation", navigate)
}

entries.set(binding, entry)
Expand Down
5 changes: 3 additions & 2 deletions packages/plugin-browser/src/tunnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export function make() {
open: Effect.fn("BrowserTunnel.open")(function* (target: Browser.TunnelTarget) {
const { createConnection } = yield* Effect.promise(() => import("node:net"))
if (disposed) return yield* Effect.fail(new Error("Browser attachment is closed."))
if (sockets.size >= 64)
return yield* Effect.fail(new Error("Browser attachment has reached its 64-connection limit."))
const MAX_CONNECTIONS = 512
if (sockets.size >= MAX_CONNECTIONS)
return yield* Effect.fail(new Error(`Browser attachment has reached its ${MAX_CONNECTIONS}-connection limit.`))
const socket = yield* Effect.try({
try: () => createConnection({ ...target, allowHalfOpen: true }),
catch: (cause) => (cause instanceof Error ? cause : new Error(String(cause))),
Expand Down
Loading