import type { PluginInput } from "@opencode-ai/plugin"; export type TypedPluginInput = PluginInput; import type { PluginConfig } from "./config.js"; import { DEFAULT_CONFIG, validateConfig } from "./config.js"; import type { SessionState } from "./session-state.js"; import { createSession } from "./session-state.js"; export type { PluginConfig, SessionState }; export { DEFAULT_CONFIG, validateConfig, createSession }; export declare function getModelContextLimit(opencodeConfigPath: string): number | null; export declare function invalidateModelLimitCache(): void; export declare function getCompactionThreshold(config: PluginConfig): number; export declare const PLAN_PATTERNS: RegExp[]; export declare function isPlanContent(text: string): boolean; export declare function estimateTokens(text: string, multiplier?: number): number; export declare function formatDuration(ms: number): string; /** * Parse token counts from error messages. * OpenCode includes exact token counts in token limit error messages. * * Examples: * - "You requested a total of 264230 tokens: 232230 tokens from the input messages and 32000 tokens for the completion." * - "This model's maximum context length is 128000 tokens. You requested 150000 tokens." * * Returns: { total: number, input: number, output: number } or null if not found */ export declare function parseTokensFromError(error: any): { total: number; input: number; output: number; } | null; export declare function updateProgress(s: SessionState): void; export declare function formatMessage(template: string, vars: Record): string; export declare function getMessageText(message: any): string; export declare function clearMessagesCache(): void; export declare function shouldBlockPrompt(sessionId: string, promptText: string, input: TypedPluginInput, log?: (...args: unknown[]) => void): Promise; export declare function safeHook(name: string, fn: () => Promise, log?: (...args: unknown[]) => void): Promise; /** * Unified scheduleRecovery with generation counter. * Prevents stale timers from firing after being overwritten. * * Usage: Call this from any module that needs to schedule recovery. * The generation counter ensures only the most recent timer fires. */ export declare function scheduleRecoveryWithGeneration(sessions: Map, sessionId: string, delayMs: number, recover: (sessionId: string) => void, log?: (...args: unknown[]) => void): void; //# sourceMappingURL=shared.d.ts.map