fix: allow execute runtime tools by default
This commit is contained in:
@@ -994,7 +994,7 @@ describe('ContinueHostAdapter', () => {
|
||||
expect(killed).toBe(true)
|
||||
})
|
||||
|
||||
it('returns audit metadata for auto-approved agent tools', async () => {
|
||||
it('uses auto mode and returns audit metadata for agent tools', async () => {
|
||||
const distribution = await createDistribution()
|
||||
let launchArgs: string[] = []
|
||||
const permissionBodies: unknown[] = []
|
||||
@@ -1115,6 +1115,7 @@ describe('ContinueHostAdapter', () => {
|
||||
new AbortController().signal,
|
||||
authorize,
|
||||
{
|
||||
workMode: 'execute',
|
||||
onEvent: (event) => {
|
||||
streamEvents.push(event)
|
||||
}
|
||||
@@ -1159,6 +1160,7 @@ describe('ContinueHostAdapter', () => {
|
||||
},
|
||||
{ type: 'text', delta: 'TOOLS_OK' }
|
||||
])
|
||||
expect(launchArgs).toContain('--auto')
|
||||
expect(launchArgs).not.toContain('--readonly')
|
||||
expect(authorize).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ toolName: 'Bash' })
|
||||
|
||||
@@ -1061,6 +1061,8 @@ export class ContinueHostAdapter {
|
||||
'--exclude',
|
||||
'*'
|
||||
)
|
||||
} else if (runOptions.workMode === 'execute') {
|
||||
args.push('--auto')
|
||||
} else if (this.options.mode === 'chat') {
|
||||
args.push('--readonly')
|
||||
}
|
||||
|
||||
@@ -1697,7 +1697,7 @@ describe('OpenCodeRuntime embedded permission mediation', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('subscribes before prompting and auto-allows a tool request', async () => {
|
||||
it('configures Execute tools as allowed before prompting', async () => {
|
||||
const {
|
||||
client,
|
||||
callOrder,
|
||||
@@ -1759,8 +1759,7 @@ describe('OpenCodeRuntime embedded permission mediation', () => {
|
||||
title: 'GoodBuddy 对话',
|
||||
directory: process.cwd(),
|
||||
permission: [
|
||||
{ permission: '*', pattern: '*', action: 'ask' },
|
||||
{ permission: 'task', pattern: '*', action: 'deny' }
|
||||
{ permission: '*', pattern: '*', action: 'allow' }
|
||||
]
|
||||
})
|
||||
expect(permissionReply).toHaveBeenCalledOnce()
|
||||
@@ -1830,7 +1829,7 @@ describe('OpenCodeRuntime embedded permission mediation', () => {
|
||||
await runtime.dispose()
|
||||
})
|
||||
|
||||
it('auto-allows each bounded tool request without GoodBuddy approval', async () => {
|
||||
it('auto-allows bounded fallback permission requests without GoodBuddy approval', async () => {
|
||||
const { client, permissionReply } = runClient([
|
||||
permissionEvent(),
|
||||
permissionEvent({
|
||||
@@ -2080,7 +2079,7 @@ describe('OpenCodeRuntime embedded permission mediation', () => {
|
||||
await runtime.dispose()
|
||||
})
|
||||
|
||||
it('leaves trusted external sessions unmodified and skips whole-run approval', async () => {
|
||||
it('configures external Execute sessions without whole-run approval', async () => {
|
||||
const { client, session, permissionReply } = runClient([
|
||||
permissionEvent(),
|
||||
{
|
||||
@@ -2105,7 +2104,10 @@ describe('OpenCodeRuntime embedded permission mediation', () => {
|
||||
expect(runtime.requiresToolApproval).toBe(false)
|
||||
expect(session.create).toHaveBeenCalledWith({
|
||||
title: 'GoodBuddy 对话',
|
||||
directory: process.cwd()
|
||||
directory: process.cwd(),
|
||||
permission: [
|
||||
{ permission: '*', pattern: '*', action: 'allow' }
|
||||
]
|
||||
})
|
||||
expect(permissionReply).not.toHaveBeenCalled()
|
||||
await runtime.dispose()
|
||||
|
||||
@@ -113,8 +113,7 @@ type OpenCodeSkillRegistration = {
|
||||
}
|
||||
|
||||
const executePermissionRules: PermissionRuleset = [
|
||||
{ permission: '*', pattern: '*', action: 'ask' },
|
||||
{ permission: 'task', pattern: '*', action: 'deny' }
|
||||
{ permission: '*', pattern: '*', action: 'allow' }
|
||||
]
|
||||
|
||||
const readOnlyPermissionRules: PermissionRuleset = [
|
||||
@@ -1100,8 +1099,8 @@ export class OpenCodeRuntime implements AgentRuntime {
|
||||
.getAvailableToolNames(request.knowledgeCapabilityToken)
|
||||
.map((toolName) => `${knowledgeMcpName}_${toolName}`)
|
||||
}
|
||||
const permission = this.usesEmbeddedPermissionMediation()
|
||||
? request.workMode === 'execute'
|
||||
const permission =
|
||||
request.workMode === 'execute'
|
||||
? [
|
||||
...executePermissionRules,
|
||||
...nativeSkillPermissionRules,
|
||||
@@ -1125,7 +1124,6 @@ export class OpenCodeRuntime implements AgentRuntime {
|
||||
...readOnlyPermissionRules,
|
||||
...nativeSkillPermissionRules
|
||||
]
|
||||
: undefined
|
||||
let disabledTools: Record<string, boolean> | undefined
|
||||
if (request.workMode !== 'execute') {
|
||||
const tools = await client.tool.ids({
|
||||
@@ -1151,7 +1149,7 @@ export class OpenCodeRuntime implements AgentRuntime {
|
||||
permission
|
||||
)
|
||||
const sessionId = session.id
|
||||
if (!session.created && permission) {
|
||||
if (!session.created) {
|
||||
const update = await client.session.update({
|
||||
sessionID: sessionId,
|
||||
directory,
|
||||
|
||||
Reference in New Issue
Block a user