core: add configurable compaction settings to allow users to disable auto-compaction and pruning via config instead of flags

This commit is contained in:
Dax Raad
2025-12-26 19:31:42 -05:00
parent 52b99622ad
commit ed06de5e30
3 changed files with 21 additions and 5 deletions

View File

@@ -141,6 +141,14 @@ export namespace Config {
if (!result.keybinds) result.keybinds = Info.shape.keybinds.parse({})
// Apply flag overrides for compaction settings
if (Flag.OPENCODE_DISABLE_AUTOCOMPACT) {
result.compaction = { ...result.compaction, auto: false }
}
if (Flag.OPENCODE_DISABLE_PRUNE) {
result.compaction = { ...result.compaction, prune: false }
}
return {
config: result,
directories,
@@ -791,6 +799,12 @@ export namespace Config {
url: z.string().optional().describe("Enterprise URL"),
})
.optional(),
compaction: z
.object({
auto: z.boolean().optional().describe("Enable automatic compaction when context is full (default: true)"),
prune: z.boolean().optional().describe("Enable pruning of old tool outputs (default: true)"),
})
.optional(),
experimental: z
.object({
hook: z