fix: enable built-in browser by default

This commit is contained in:
mesalogo
2026-10-02 10:27:58 +08:00
parent f4d8fe7f06
commit 2e5c348dce
4 changed files with 19 additions and 15 deletions
+2
View File
@@ -2,6 +2,8 @@
电脑控制包含 GoodBuddy 对浏览器和客户端桌面能力的产品实现与平台适配状态。
内置浏览器 MCP 默认开启,用户可在设置中关闭。已保存的开关选择在重启和升级后保留。
## 文档导航
| 文档 | 权威职责 |
@@ -261,29 +261,29 @@ describe('CapabilityService', () => {
).rejects.toThrow('Injected profile load failure')
await expect(
retrying.getComputerCapabilityStatus('host-browser-control')
).resolves.toEqual({ enabled: false, supported: true })
).resolves.toEqual({ enabled: true, supported: true })
expect(profileLoads).toBe(2)
})
it('reports safe enabled and supported capability status', async () => {
it('enables the browser by default and synchronizes its switch', async () => {
const { service } = await createService()
await expect(
service.getComputerCapabilityStatus('host-browser-control')
).resolves.toEqual({ enabled: false, supported: true })
).resolves.toEqual({ enabled: true, supported: true })
await service.setComputerCapabilityEnabled(
'host-browser-control',
true
false
)
await expect(
service.getComputerCapabilityStatus('host-browser-control')
).resolves.toEqual({ enabled: true, supported: true })
).resolves.toEqual({ enabled: false, supported: true })
await expect(service.getSnapshot()).resolves.toMatchObject({
builtinMcpServers: expect.arrayContaining([
expect.objectContaining({
id: 'builtin-browser',
enabled: true
enabled: false
})
])
})
@@ -341,7 +341,7 @@ describe('CapabilityService', () => {
},
{
id: 'builtin-browser',
enabled: false,
enabled: true,
assignments: ['model', 'opencode', 'continue']
},
{
@@ -385,6 +385,7 @@ describe('CapabilityService', () => {
await service.setBuiltinMcpServerAssignments('story-graph', ['deepseek-harness'])
await expect(service.getEnabledBuiltinMcpServerIds('model')).resolves.not.toContain('story-graph')
await service.setBuiltinMcpServerEnabled('builtin-browser', false)
const reloaded = new CapabilityService(
filePath,
@@ -405,7 +406,7 @@ describe('CapabilityService', () => {
}),
expect.objectContaining({
id: 'builtin-browser',
enabled: true,
enabled: false,
assignments: ['continue']
})
])
@@ -1014,7 +1015,7 @@ describe('CapabilityService', () => {
computerCapabilities: [
expect.objectContaining({
id: 'host-browser-control',
enabled: false
enabled: true
}),
expect.objectContaining({
id: 'linux-desktop-control',
@@ -1158,7 +1159,7 @@ describe('CapabilityService', () => {
expect(await readFile(filePath, 'utf8')).toContain('"version": 6')
})
it('migrates the legacy browser switch into the built-in browser assignment', async () => {
it.each([true, false])('preserves the legacy browser switch (%s) during migration', async (enabled) => {
const { filePath, builtinRoot, importedRoot } = await createService()
await writeFile(
filePath,
@@ -1183,7 +1184,7 @@ describe('CapabilityService', () => {
webSearch: { enabled: true },
computerCapabilities: {
'host-browser-control': {
enabled: true,
enabled,
browserProfileId: null
},
'linux-desktop-control': {
@@ -1205,7 +1206,7 @@ describe('CapabilityService', () => {
builtinMcpServers: expect.arrayContaining([
{
id: 'builtin-browser',
enabled: true,
enabled,
assignments: ['model', 'opencode', 'continue']
}
])
@@ -1520,6 +1521,7 @@ describe('CapabilityService', () => {
),
diagnostics
})
await outsideElectron.service.setComputerCapabilityEnabled('host-browser-control', false)
await expect(
outsideElectron.service.setComputerCapabilityEnabled(
'host-browser-control',
+2 -2
View File
@@ -299,7 +299,7 @@ export type CapabilityServiceOptions = Readonly<{
function defaultComputerCapabilityStates(): StoredCapabilities['computerCapabilities'] {
return {
'host-browser-control': {
enabled: false,
enabled: true,
browserProfileId: null
},
'linux-desktop-control': {
@@ -310,7 +310,7 @@ function defaultComputerCapabilityStates(): StoredCapabilities['computerCapabili
}
function defaultBuiltinMcpServerStates(
browserEnabled = false
browserEnabled = true
): StoredCapabilities['builtinMcpServers'] {
const defaultState = (): z.infer<typeof builtinMcpServerStateSchema> => ({
enabled: true,
+1 -1
View File
@@ -718,7 +718,7 @@ export function McpSettingsSection({
const panelId = `mcp-server-tools-${server.id}`
const state = builtinMcpStates.get(server.id) ?? {
id: server.id,
enabled: server.id !== 'builtin-browser' && server.id !== 'obsidian',
enabled: server.id !== 'obsidian',
assignments:
[...server.supportedAssignments] as CapabilityAssignments
}