refactor: remove dcp_for_compaction and preemptive_compaction features

- Delete src/hooks/preemptive-compaction/ entirely
- Remove dcp_for_compaction from schema and executor
- Clean up related imports, options, and test code
- Update READMEs to remove experimental options docs
This commit is contained in:
justsisyphus
2026-01-16 10:51:59 +09:00
parent bf28b3e711
commit b933992e36
14 changed files with 32 additions and 418 deletions
@@ -7,7 +7,6 @@ import { log } from "../../shared/logger"
export interface AnthropicContextWindowLimitRecoveryOptions {
experimental?: ExperimentalConfig
dcpForCompaction?: boolean
}
function createRecoveryState(): AutoCompactState {
@@ -16,7 +15,6 @@ function createRecoveryState(): AutoCompactState {
errorDataBySession: new Map<string, ParsedTokenLimitError>(),
retryStateBySession: new Map(),
truncateStateBySession: new Map(),
dcpStateBySession: new Map(),
emptyContentAttemptBySession: new Map(),
compactionInProgress: new Set<string>(),
}
@@ -25,7 +23,6 @@ function createRecoveryState(): AutoCompactState {
export function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput, options?: AnthropicContextWindowLimitRecoveryOptions) {
const autoCompactState = createRecoveryState()
const experimental = options?.experimental
const dcpForCompaction = options?.dcpForCompaction
const eventHandler = async ({ event }: { event: { type: string; properties?: unknown } }) => {
const props = event.properties as Record<string, unknown> | undefined
@@ -37,7 +34,6 @@ export function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput,
autoCompactState.errorDataBySession.delete(sessionInfo.id)
autoCompactState.retryStateBySession.delete(sessionInfo.id)
autoCompactState.truncateStateBySession.delete(sessionInfo.id)
autoCompactState.dcpStateBySession.delete(sessionInfo.id)
autoCompactState.emptyContentAttemptBySession.delete(sessionInfo.id)
autoCompactState.compactionInProgress.delete(sessionInfo.id)
}
@@ -81,8 +77,7 @@ export function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput,
autoCompactState,
ctx.client,
ctx.directory,
experimental,
dcpForCompaction
experimental
)
}, 300)
}
@@ -141,8 +136,7 @@ export function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput,
autoCompactState,
ctx.client,
ctx.directory,
experimental,
dcpForCompaction
experimental
)
}
}
@@ -152,6 +146,6 @@ export function createAnthropicContextWindowLimitRecoveryHook(ctx: PluginInput,
}
}
export type { AutoCompactState, DcpState, ParsedTokenLimitError, TruncateState } from "./types"
export type { AutoCompactState, ParsedTokenLimitError, TruncateState } from "./types"
export { parseAnthropicTokenLimitError } from "./parser"
export { executeCompact, getLastAssistant } from "./executor"