File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export namespace Flag {
88 export const OPENCODE_DISABLE_DEFAULT_PLUGINS = truthy ( "OPENCODE_DISABLE_DEFAULT_PLUGINS" )
99 export const OPENCODE_DISABLE_LSP_DOWNLOAD = truthy ( "OPENCODE_DISABLE_LSP_DOWNLOAD" )
1010 export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy ( "OPENCODE_ENABLE_EXPERIMENTAL_MODELS" )
11+ export const OPENCODE_DISABLE_AUTOCOMPACT = truthy ( "OPENCODE_DISABLE_AUTOCOMPACT" )
1112
1213 function truthy ( key : string ) {
1314 const value = process . env [ key ] ?. toLowerCase ( )
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { Bus } from "../bus"
1010import z from "zod"
1111import type { ModelsDev } from "../provider/models"
1212import { SessionPrompt } from "./prompt"
13+ import { Flag } from "../flag/flag"
1314
1415export namespace SessionCompaction {
1516 export const Event = {
@@ -22,6 +23,7 @@ export namespace SessionCompaction {
2223 }
2324
2425 export function isOverflow ( input : { tokens : MessageV2 . Assistant [ "tokens" ] ; model : ModelsDev . Model } ) {
26+ if ( Flag . OPENCODE_DISABLE_AUTOCOMPACT ) return false
2527 const count = input . tokens . input + input . tokens . cache . read + input . tokens . output
2628 const output = Math . min ( input . model . limit . output , SessionPrompt . OUTPUT_TOKEN_MAX ) || SessionPrompt . OUTPUT_TOKEN_MAX
2729 const usable = input . model . limit . context - output
You can’t perform that action at this time.
0 commit comments