/** * Hook factory that wires the forge harness into the opencode plugin surface. * * Produces `before` / `after` callbacks for `tool.execute.*` plus an event * handler that feeds todo updates into the pending-todo tracker and emits a * doom-loop reminder through the TUI when the detector fires. * * The compactor is exposed separately because the plugin entrypoint owns the * `experimental.session.compacting` hook and needs to call the renderer * directly. */ import type { HarnessConfig, Logger } from '../types'; interface HarnessHookDeps { logger: Logger; projectId: string; directory: string; dataDir: string; config?: HarnessConfig; /** * Optional callback used to surface doom-loop reminders in the TUI. When * omitted the reminder is only logged — the plugin entrypoint supplies a * real implementation that calls `client.tui.appendPrompt()`. */ appendPrompt?: (sessionId: string, text: string) => Promise | void; } export interface HarnessHooks { toolBefore: (input: { sessionID: string; tool: string; args: unknown; }) => Promise; toolAfter: (input: { sessionID: string; tool: string; }, output: { output: string; }) => Promise; onEvent: (input: { event: { type: string; properties?: Record; }; }) => Promise; compact: (input: { sessionID: string; }, output: { context: string[]; prompt?: string; }) => Promise; /** * Called by the plugin entrypoint whenever it has fresh `experimental.chat.messages.transform` * output — feeds the latest message list into the compactor's message cache * so compaction can see them without an extra round-trip. */ rememberMessages: (sessionId: string, messages: unknown[]) => void; } export declare function createHarnessHooks(deps: HarnessHookDeps): HarnessHooks; /** Stable hash for request-args used in metrics/logs (unused by runtime). */ export declare function hashArgs(args: unknown): string; export {}; //# sourceMappingURL=harness.d.ts.map