import { AutodevSettings } from './core/settingsLoader'; export interface PeriodicActionDef { /** Unique stable ID. Used as HTML element id prefix and counter key. */ id: string; /** Sidebar label shown to the user. */ label: string; /** Key in AutodevSettings that holds the interval (0 = disabled). */ settingKey: keyof AutodevSettings; /** Log icon (emoji) used in the extension host log. */ icon: string; /** * How the action is executed when due: * - 'prompt' — send `prompt` text to the AI via sendToAi (default) * - 'compact' — run provider-specific /compact tool (no AI prompt sent) * - 'pruneTodo' — move completed [x] tasks from TODO.md into DONE.md */ type?: 'prompt' | 'compact' | 'pruneTodo'; /** Prompt text sent to the agent (only used when type === 'prompt'). */ prompt: string; /** * Optional deterministic pre-pass run by the EXTENSION (not the model) just * before a `type:'prompt'` action is dispatched. It may: * - maintain files deterministically (dedupe an index, etc.), and/or * - return a compact digest string that is PREPENDED to `prompt`. * Returning '' changes nothing — the prompt is sent exactly as before. This is * how we lift the mechanical file-scan/index work off the model without * altering the model-facing distillation instructions. Must never throw * (callers still guard), and must be a no-op when there's nothing to do so * low-activity agents keep byte-identical behavior. */ preprocess?: (root: string) => string; } /** * Deterministically de-duplicate the .autodev/MEMORY.md index. Removes repeated * index lines (same target path) while preserving order and any header/prose. * Returns a short note if it changed anything, else '' (no prompt change). */ export declare function dedupeMemoryIndex(root: string): string; export declare const PERIODIC_ACTIONS: PeriodicActionDef[]; interface ActionState { /** Tasks completed since this action was last triggered (or since loop start). */ counter: number; /** Loop iteration number when this action was last triggered (0 = never). */ lastTriggeredAt: number; /** Wall-clock ISO string when last triggered. */ lastTriggeredTime: string | null; } export declare class PeriodicActionManager { private readonly _state; private _ensureState; /** Reset all counters (call at loop start). */ reset(): void; /** * Reset all counters and persist the cleared state to .autodev/loop-state.json. * Call at loop start. */ resetAndPersist(workspaceRoot?: string): void; /** * Increment all action counters by 1. * @param iteration Current loop iteration number (used for debug state). * @param workspaceRoot If provided, persists loop-state.json to .autodev/. */ increment(iteration: number, workspaceRoot?: string): void; /** Returns the actions whose counter has reached or exceeded the configured interval. */ getDue(settings: AutodevSettings): PeriodicActionDef[]; /** * Reset the counter for a specific action after it has been handled. * Records the iteration + timestamp it was triggered at. */ markHandled(id: string, iteration: number, workspaceRoot?: string): void; /** Returns the current counter value for an action (for debug / display). */ getCount(id: string): number; /** Snapshot of all action states — used for debug persistence. */ snapshot(): Record; /** * Write .autodev/loop-state.json with current iteration + per-action counters. * Safe — silently ignores write errors. */ private _persist; } export {};