diff --git a/src/hooks/anthropic-auto-compact/pruning-deduplication.ts b/src/hooks/anthropic-auto-compact/pruning-deduplication.ts index f2f1851..b3e8b52 100644 --- a/src/hooks/anthropic-auto-compact/pruning-deduplication.ts +++ b/src/hooks/anthropic-auto-compact/pruning-deduplication.ts @@ -3,19 +3,13 @@ import { join } from "node:path" import type { PruningState, ToolCallSignature } from "./pruning-types" import { estimateTokens } from "./pruning-types" import { log } from "../../shared/logger" +import { MESSAGE_STORAGE } from "../../features/hook-message-injector" export interface DeduplicationConfig { enabled: boolean protectedTools?: string[] } -const MESSAGE_STORAGE = join( - process.env.HOME || process.env.USERPROFILE || "", - ".config", - "opencode", - "sessions" -) - interface ToolPart { type: string callID?: string diff --git a/src/hooks/anthropic-auto-compact/pruning-purge-errors.ts b/src/hooks/anthropic-auto-compact/pruning-purge-errors.ts index 89f9444..0cb36d1 100644 --- a/src/hooks/anthropic-auto-compact/pruning-purge-errors.ts +++ b/src/hooks/anthropic-auto-compact/pruning-purge-errors.ts @@ -3,6 +3,7 @@ import { join } from "node:path" import type { PruningState, ErroredToolCall } from "./pruning-types" import { estimateTokens } from "./pruning-types" import { log } from "../../shared/logger" +import { MESSAGE_STORAGE } from "../../features/hook-message-injector" export interface PurgeErrorsConfig { enabled: boolean @@ -10,13 +11,6 @@ export interface PurgeErrorsConfig { protectedTools?: string[] } -const MESSAGE_STORAGE = join( - process.env.HOME || process.env.USERPROFILE || "", - ".config", - "opencode", - "sessions" -) - interface ToolPart { type: string callID?: string diff --git a/src/hooks/anthropic-auto-compact/pruning-storage.ts b/src/hooks/anthropic-auto-compact/pruning-storage.ts index 76bb500..462e1d5 100644 --- a/src/hooks/anthropic-auto-compact/pruning-storage.ts +++ b/src/hooks/anthropic-auto-compact/pruning-storage.ts @@ -3,13 +3,7 @@ import { join } from "node:path" import type { PruningState } from "./pruning-types" import { estimateTokens } from "./pruning-types" import { log } from "../../shared/logger" - -const MESSAGE_STORAGE = join( - process.env.HOME || process.env.USERPROFILE || "", - ".config", - "opencode", - "sessions" -) +import { MESSAGE_STORAGE } from "../../features/hook-message-injector" function getMessageDir(sessionID: string): string | null { if (!existsSync(MESSAGE_STORAGE)) return null diff --git a/src/hooks/anthropic-auto-compact/pruning-supersede.ts b/src/hooks/anthropic-auto-compact/pruning-supersede.ts index c2b2015..0a75d80 100644 --- a/src/hooks/anthropic-auto-compact/pruning-supersede.ts +++ b/src/hooks/anthropic-auto-compact/pruning-supersede.ts @@ -3,19 +3,13 @@ import { join } from "node:path" import type { PruningState, FileOperation } from "./pruning-types" import { estimateTokens } from "./pruning-types" import { log } from "../../shared/logger" +import { MESSAGE_STORAGE } from "../../features/hook-message-injector" export interface SupersedeWritesConfig { enabled: boolean aggressive: boolean } -const MESSAGE_STORAGE = join( - process.env.HOME || process.env.USERPROFILE || "", - ".config", - "opencode", - "sessions" -) - interface ToolPart { type: string callID?: string