fix: allow closing browser tabs during active requests

Allow users to close leased browser tabs without cancelling the AI request or revoking its other tools. Closed-page operations report a recoverable error; explicit navigation creates a dedicated replacement tab for direct-model and MCP calls.

Add regression coverage and real Electron lifecycle checks, and update browser behavior documentation.

Release note: 浏览器标签页被 AI 请求占用时也可关闭,其他任务继续运行;再次导航会打开独立新页。
This commit is contained in:
mesalogo
2026-09-13 11:21:37 +08:00
parent 032ebc313f
commit b84250f62a
14 changed files with 534 additions and 72 deletions
+2 -10
View File
@@ -552,7 +552,6 @@ async function grantScopedDataCapability(input: {
signal: AbortSignal
) => Promise<boolean>
signal: AbortSignal
abort?: (reason: unknown) => void
}): Promise<ScopedDataCapability> {
const enabledServers = new Set(input.enabledServers)
const libraryIds = enabledServers.has('knowledge-base')
@@ -590,11 +589,6 @@ async function grantScopedDataCapability(input: {
})
: undefined
const browserTabId = browserUsageLease?.tabId
browserUsageLease?.signal.addEventListener(
'abort',
() => input.abort?.(browserUsageLease.signal.reason),
{ once: true }
)
const config =
configAccess !== 'none' && input.workspacePath
? {
@@ -2485,8 +2479,7 @@ export function registerIpcHandlers(
? runtimeConversationId
: undefined,
ownerWindowId: window.webContents.id,
signal: controller.signal,
abort: (reason) => controller.abort(reason)
signal: controller.signal
})
knowledgeCapabilityToken = notesCapability.token
const noteTools = [
@@ -4060,8 +4053,7 @@ export function registerIpcHandlers(
? enrichedRequest.conversationId
: undefined,
ownerWindowId: event.sender.id,
signal: controller.signal,
abort: (reason) => controller.abort(reason)
signal: controller.signal
})
const knowledgeCapabilityToken = scopedCapability.token
const availableTools = [