fix: enable built-in browser by default
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
电脑控制包含 GoodBuddy 对浏览器和客户端桌面能力的产品实现与平台适配状态。
|
电脑控制包含 GoodBuddy 对浏览器和客户端桌面能力的产品实现与平台适配状态。
|
||||||
|
|
||||||
|
内置浏览器 MCP 默认开启,用户可在设置中关闭。已保存的开关选择在重启和升级后保留。
|
||||||
|
|
||||||
## 文档导航
|
## 文档导航
|
||||||
|
|
||||||
| 文档 | 权威职责 |
|
| 文档 | 权威职责 |
|
||||||
|
|||||||
@@ -261,29 +261,29 @@ describe('CapabilityService', () => {
|
|||||||
).rejects.toThrow('Injected profile load failure')
|
).rejects.toThrow('Injected profile load failure')
|
||||||
await expect(
|
await expect(
|
||||||
retrying.getComputerCapabilityStatus('host-browser-control')
|
retrying.getComputerCapabilityStatus('host-browser-control')
|
||||||
).resolves.toEqual({ enabled: false, supported: true })
|
).resolves.toEqual({ enabled: true, supported: true })
|
||||||
expect(profileLoads).toBe(2)
|
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()
|
const { service } = await createService()
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
service.getComputerCapabilityStatus('host-browser-control')
|
service.getComputerCapabilityStatus('host-browser-control')
|
||||||
).resolves.toEqual({ enabled: false, supported: true })
|
).resolves.toEqual({ enabled: true, supported: true })
|
||||||
|
|
||||||
await service.setComputerCapabilityEnabled(
|
await service.setComputerCapabilityEnabled(
|
||||||
'host-browser-control',
|
'host-browser-control',
|
||||||
true
|
false
|
||||||
)
|
)
|
||||||
await expect(
|
await expect(
|
||||||
service.getComputerCapabilityStatus('host-browser-control')
|
service.getComputerCapabilityStatus('host-browser-control')
|
||||||
).resolves.toEqual({ enabled: true, supported: true })
|
).resolves.toEqual({ enabled: false, supported: true })
|
||||||
await expect(service.getSnapshot()).resolves.toMatchObject({
|
await expect(service.getSnapshot()).resolves.toMatchObject({
|
||||||
builtinMcpServers: expect.arrayContaining([
|
builtinMcpServers: expect.arrayContaining([
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: 'builtin-browser',
|
id: 'builtin-browser',
|
||||||
enabled: true
|
enabled: false
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
@@ -341,7 +341,7 @@ describe('CapabilityService', () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'builtin-browser',
|
id: 'builtin-browser',
|
||||||
enabled: false,
|
enabled: true,
|
||||||
assignments: ['model', 'opencode', 'continue']
|
assignments: ['model', 'opencode', 'continue']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -385,6 +385,7 @@ describe('CapabilityService', () => {
|
|||||||
|
|
||||||
await service.setBuiltinMcpServerAssignments('story-graph', ['deepseek-harness'])
|
await service.setBuiltinMcpServerAssignments('story-graph', ['deepseek-harness'])
|
||||||
await expect(service.getEnabledBuiltinMcpServerIds('model')).resolves.not.toContain('story-graph')
|
await expect(service.getEnabledBuiltinMcpServerIds('model')).resolves.not.toContain('story-graph')
|
||||||
|
await service.setBuiltinMcpServerEnabled('builtin-browser', false)
|
||||||
|
|
||||||
const reloaded = new CapabilityService(
|
const reloaded = new CapabilityService(
|
||||||
filePath,
|
filePath,
|
||||||
@@ -405,7 +406,7 @@ describe('CapabilityService', () => {
|
|||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: 'builtin-browser',
|
id: 'builtin-browser',
|
||||||
enabled: true,
|
enabled: false,
|
||||||
assignments: ['continue']
|
assignments: ['continue']
|
||||||
})
|
})
|
||||||
])
|
])
|
||||||
@@ -1014,7 +1015,7 @@ describe('CapabilityService', () => {
|
|||||||
computerCapabilities: [
|
computerCapabilities: [
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: 'host-browser-control',
|
id: 'host-browser-control',
|
||||||
enabled: false
|
enabled: true
|
||||||
}),
|
}),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
id: 'linux-desktop-control',
|
id: 'linux-desktop-control',
|
||||||
@@ -1158,7 +1159,7 @@ describe('CapabilityService', () => {
|
|||||||
expect(await readFile(filePath, 'utf8')).toContain('"version": 6')
|
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()
|
const { filePath, builtinRoot, importedRoot } = await createService()
|
||||||
await writeFile(
|
await writeFile(
|
||||||
filePath,
|
filePath,
|
||||||
@@ -1183,7 +1184,7 @@ describe('CapabilityService', () => {
|
|||||||
webSearch: { enabled: true },
|
webSearch: { enabled: true },
|
||||||
computerCapabilities: {
|
computerCapabilities: {
|
||||||
'host-browser-control': {
|
'host-browser-control': {
|
||||||
enabled: true,
|
enabled,
|
||||||
browserProfileId: null
|
browserProfileId: null
|
||||||
},
|
},
|
||||||
'linux-desktop-control': {
|
'linux-desktop-control': {
|
||||||
@@ -1205,7 +1206,7 @@ describe('CapabilityService', () => {
|
|||||||
builtinMcpServers: expect.arrayContaining([
|
builtinMcpServers: expect.arrayContaining([
|
||||||
{
|
{
|
||||||
id: 'builtin-browser',
|
id: 'builtin-browser',
|
||||||
enabled: true,
|
enabled,
|
||||||
assignments: ['model', 'opencode', 'continue']
|
assignments: ['model', 'opencode', 'continue']
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
@@ -1520,6 +1521,7 @@ describe('CapabilityService', () => {
|
|||||||
),
|
),
|
||||||
diagnostics
|
diagnostics
|
||||||
})
|
})
|
||||||
|
await outsideElectron.service.setComputerCapabilityEnabled('host-browser-control', false)
|
||||||
await expect(
|
await expect(
|
||||||
outsideElectron.service.setComputerCapabilityEnabled(
|
outsideElectron.service.setComputerCapabilityEnabled(
|
||||||
'host-browser-control',
|
'host-browser-control',
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ export type CapabilityServiceOptions = Readonly<{
|
|||||||
function defaultComputerCapabilityStates(): StoredCapabilities['computerCapabilities'] {
|
function defaultComputerCapabilityStates(): StoredCapabilities['computerCapabilities'] {
|
||||||
return {
|
return {
|
||||||
'host-browser-control': {
|
'host-browser-control': {
|
||||||
enabled: false,
|
enabled: true,
|
||||||
browserProfileId: null
|
browserProfileId: null
|
||||||
},
|
},
|
||||||
'linux-desktop-control': {
|
'linux-desktop-control': {
|
||||||
@@ -310,7 +310,7 @@ function defaultComputerCapabilityStates(): StoredCapabilities['computerCapabili
|
|||||||
}
|
}
|
||||||
|
|
||||||
function defaultBuiltinMcpServerStates(
|
function defaultBuiltinMcpServerStates(
|
||||||
browserEnabled = false
|
browserEnabled = true
|
||||||
): StoredCapabilities['builtinMcpServers'] {
|
): StoredCapabilities['builtinMcpServers'] {
|
||||||
const defaultState = (): z.infer<typeof builtinMcpServerStateSchema> => ({
|
const defaultState = (): z.infer<typeof builtinMcpServerStateSchema> => ({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ export function McpSettingsSection({
|
|||||||
const panelId = `mcp-server-tools-${server.id}`
|
const panelId = `mcp-server-tools-${server.id}`
|
||||||
const state = builtinMcpStates.get(server.id) ?? {
|
const state = builtinMcpStates.get(server.id) ?? {
|
||||||
id: server.id,
|
id: server.id,
|
||||||
enabled: server.id !== 'builtin-browser' && server.id !== 'obsidian',
|
enabled: server.id !== 'obsidian',
|
||||||
assignments:
|
assignments:
|
||||||
[...server.supportedAssignments] as CapabilityAssignments
|
[...server.supportedAssignments] as CapabilityAssignments
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user