mirror of
https://github.com/stablyai/orca.git
synced 2026-10-03 16:02:11 +00:00
fix(agents): preserve manual mode for newly added defaults
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { migrateAgentYoloDefaults } from './terminal-settings-migrations'
|
||||
|
||||
describe('migrateAgentYoloDefaults', () => {
|
||||
it('keeps newly added agent defaults manual for already migrated profiles', () => {
|
||||
const migrated = migrateAgentYoloDefaults({
|
||||
agentYoloDefaultsMigrated: true,
|
||||
agentDefaultArgs: { claude: '--dangerously-skip-permissions' },
|
||||
agentDefaultEnv: {}
|
||||
} as never)
|
||||
|
||||
expect(migrated.agentDefaultArgs.droid).toBe('')
|
||||
expect(migrated.agentDefaultEnv.goose).toEqual({})
|
||||
})
|
||||
})
|
||||
@@ -124,6 +124,18 @@ export function migrateAgentYoloDefaults(
|
||||
const existingArgs = normalizeTuiAgentArgsRecord(settings?.agentDefaultArgs)
|
||||
const existingEnv = normalizeTuiAgentEnvRecord(settings?.agentDefaultEnv)
|
||||
if (settings?.agentYoloDefaultsMigrated === true) {
|
||||
// Keep newly added agents manual for profiles migrated by an older build.
|
||||
// Missing keys otherwise fall through to the current (possibly yolo) defaults.
|
||||
for (const agent of Object.keys(DEFAULT_TUI_AGENT_ARGS)) {
|
||||
if (!(agent in existingArgs)) {
|
||||
existingArgs[agent as keyof typeof DEFAULT_TUI_AGENT_ARGS] = ''
|
||||
}
|
||||
}
|
||||
for (const agent of Object.keys(DEFAULT_TUI_AGENT_ENV)) {
|
||||
if (!(agent in existingEnv)) {
|
||||
existingEnv[agent as keyof typeof DEFAULT_TUI_AGENT_ENV] = {}
|
||||
}
|
||||
}
|
||||
return {
|
||||
agentDefaultArgs: existingArgs,
|
||||
agentDefaultEnv: existingEnv,
|
||||
|
||||
@@ -28,7 +28,8 @@ export const YOLO_TUI_AGENT_ARGS: Partial<Record<TuiAgent, string>> = {
|
||||
grok: '--permission-mode bypassPermissions',
|
||||
devin: '--permission-mode bypass',
|
||||
ante: '--yolo',
|
||||
trae: '--yolo'
|
||||
trae: '--yolo',
|
||||
droid: '--auto high'
|
||||
}
|
||||
|
||||
export const YOLO_TUI_AGENT_ENV: Partial<Record<TuiAgent, Record<string, string>>> = {
|
||||
|
||||
Reference in New Issue
Block a user