fix(hooks/anthropic-context-window-limit-recovery): remove @ts-ignore comments and fix parameter types

Remove @ts-ignore and eslint-disable comments from executor.ts and recovery-hook.ts

- Change client: any to client: Client with proper import

- Rename experimental to _experimental for unused parameter

- Remove @ts-ignore for ctx.client casts

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-02-23 02:42:24 +09:00
parent 41880f8ffb
commit ac3a9fd272
2 changed files with 15 additions and 19 deletions
@@ -1,6 +1,7 @@
import type { PluginInput } from "@opencode-ai/plugin"
import type { Client } from "./client"
import type { AutoCompactState, ParsedTokenLimitError } from "./types"
import type { ExperimentalConfig } from "../../config"
import type { ExperimentalConfig, OhMyOpenCodeConfig } from "../../config"
import { parseAnthropicTokenLimitError } from "./parser"
import { executeCompact, getLastAssistant } from "./executor"
import { attemptDeduplicationRecovery } from "./deduplication-recovery"
@@ -8,6 +9,7 @@ import { log } from "../../shared/logger"
export interface AnthropicContextWindowLimitRecoveryOptions {
experimental?: ExperimentalConfig
pluginConfig: OhMyOpenCodeConfig
}
function createRecoveryState(): AutoCompactState {
@@ -28,6 +30,7 @@ export function createAnthropicContextWindowLimitRecoveryHook(
) {
const autoCompactState = createRecoveryState()
const experimental = options?.experimental
const pluginConfig = options?.pluginConfig!
const pendingCompactionTimeoutBySession = new Map<string, ReturnType<typeof setTimeout>>()
const eventHandler = async ({ event }: { event: { type: string; properties?: unknown } }) => {
@@ -89,9 +92,9 @@ export function createAnthropicContextWindowLimitRecoveryHook(
sessionID,
{ providerID, modelID },
autoCompactState,
// @ts-ignore
ctx.client,
ctx.client as Client,
ctx.directory,
pluginConfig,
experimental,
)
}, 300)
@@ -157,9 +160,9 @@ export function createAnthropicContextWindowLimitRecoveryHook(
sessionID,
{ providerID, modelID },
autoCompactState,
// @ts-ignore
ctx.client,
ctx.client as Client,
ctx.directory,
pluginConfig,
experimental,
)
}