import type { PluginOptions } from "@opencode-ai/plugin"; export interface TokenOptimizerConfig { /** * Base directory under which the `token-optimizer/` data folder is created. * Unset means "resolve the platform-global location" (see resolveDataDir). * Set it via PluginOptions.dataDir or TOKEN_OPTIMIZER_DATA_DIR. */ dataDir?: string; qualityWindow: number; toolCallWarnThreshold: number | null; toolCallCriticalThreshold: number | null; checkpointMaxFiles: number; checkpointTtlSeconds: number; checkpointRetentionDays: number; checkpointRetentionMax: number; relevanceThreshold: number; checkpointCooldownSeconds: number; checkpointMaxChars: number; freshNudgeQualityThreshold: number; freshNudgeMinFillPct: number; features: { qualityNudges: boolean; loopDetection: boolean; smartCompaction: boolean; continuity: boolean; activityTracking: boolean; trends: boolean; }; } /** * The host facts this module branches on. * * Injected rather than read inline so every platform branch is reachable from a * test on any one machine. Reading `platform()` directly inside the resolver * meant the Windows and Linux paths shipped without ever executing. */ export interface HostContext { platform: string; home: string; env: Record; /** Separator used when rejoining a split path. */ sep: string; } /** * The platform-global base directory, with no config or env override applied. * Split out from resolveDataDir purely so each branch is directly testable. */ export declare function platformDataDir(host?: HostContext): string; /** * Resolve the data ROOT: the exact directory that holds trends.db and the * sessions/ tree. Callers use it as-is and never append a folder name. * * Precedence: * 1. explicit config.dataDir / TOKEN_OPTIMIZER_DATA_DIR -> used VERBATIM. * 2. nothing set -> platform-global location + `token-optimizer/`. * * Verbatim is the whole point: what you type is where data goes, leaf * name and all. Set `.opencode/token-optimizer` and that is the folder; set * `.token-optimizer` and you get a hidden folder with that exact name. The old * behaviour force-appended `token-optimizer`, so the dotted name the user asked * for was literally unreachable (it produced `.token-optimizer/token-optimizer/`). * * Unset still defaults OUT of the repo, so a folder only lands in a project when * the user explicitly points it there. */ export declare function resolveDataDir(config?: Pick, host?: HostContext): string; /** * Encode a project path into a single filesystem-safe directory name, matching * Claude Code's `~/.claude/projects/` convention so the same project resolves to * the same slug across both tools. * * /Users/alex/my project -> -Users-alex-my-project * D:\Code\my app -> D--Code-my-app * * Returns "unknown-project" for empty input rather than "", which would collapse * the scoped path back onto the unscoped parent directory. */ export declare function hashProjectDir(worktree: string): string; export declare function resolveConfig(options?: PluginOptions): TokenOptimizerConfig; //# sourceMappingURL=env.d.ts.map