import { type PluginConfig } from "./config.js"; import { type HintCacheState, type HintEnvelopeState } from "./hint-envelope.js"; import type { LastInjectedRegistry } from "./last-injected.js"; /** * Per-plugin-instance analyze state: the set of repos that currently have a * background analyze in flight. Each call to createAnalyzeState() returns its * own isolated state, so two plugin instances do not share dedupe. */ export interface AnalyzeState { /** Returns false if a refresh is already in flight for this repo. */ schedule(repoPath: string, config: PluginConfig, scanRoot: string, hintState: HintEnvelopeState): boolean; /** Test helper: clear the in-flight set. */ reset(): void; } export declare function createAnalyzeState(): AnalyzeState; /** * Dependencies needed by the tool hooks. All per-plugin-instance state is * passed in explicitly; hooks.ts never touches module-level mutable state. */ export interface ToolHooksDeps { cwd: string; config: PluginConfig; disabled: () => boolean; analyzeState: AnalyzeState; hintState: HintEnvelopeState; } export declare function createToolHooks(deps: ToolHooksDeps): { onToolExecuteAfter(input: { tool: string; args: any; }, output: { output: string; }): void; }; /** * Best-effort extractor for the `git -C ` target. Returns null when * the command does not use `-C`, when the path cannot be parsed, or when the * extracted path is not itself an indexed/discoverable git repo. * * Handles: `git -C path commit`, `git -C /abs/path merge`, `GIT_DIR=x git -C path reset`. * Relative paths are resolved against `cwd`. Quoted paths ("path with spaces") * are accepted. */ export declare function extractGitDashCPath(cmd: string, cwd: string): string | null; /** * Pure factory for the experimental.chat.messages.transform hook body. Kept * out of index.ts so it can be unit-tested in isolation. deps.isMain and * deps.getCache are required — there are no module-level defaults anymore. */ export interface MessagesTransformDeps { isMain: (sessionID: string) => boolean; getCache: () => HintCacheState; /** * Optional per-session dedup registry. When supplied, the handler skips * injection on turns whose cache.envelope is byte-identical to the last * value already injected into this session. Omit to fall back to the * pre-dedup behavior (inject on every eligible turn). */ lastInjected?: LastInjectedRegistry; log?: (message: string, level?: "debug" | "info" | "warn" | "error") => void; } type MessageEntry = { info: { role: string; sessionID?: string; }; parts: Array<{ type: string; }>; }; export declare function createMessagesTransformHandler(deps: MessagesTransformDeps): (_input: Record, output: { messages: MessageEntry[]; }) => Promise; export interface SystemTransformDeps { disabled: () => boolean; isMain: (sessionID: string) => boolean; log?: (message: string, level?: "debug" | "info" | "warn" | "error") => void; } export declare function createSystemTransformHandler(deps: SystemTransformDeps): (input: { sessionID?: string; model?: unknown; }, output: { system: string[]; }) => Promise; export {};