/** * OpenCode TypeScript plugin entry point for context-mode. * * Provides three hooks: * - tool.execute.before — Routing enforcement (deny/modify/passthrough) * - tool.execute.after — Session event capture * - experimental.session.compacting — Compaction snapshot generation * * Loaded by OpenCode via: import("context-mode/plugin").ContextModePlugin(ctx) * * Constraints: * - No SessionStart hook (OpenCode doesn't support it — #14808, #5409) * - No context injection (canInjectSessionContext: false) * - No routing file auto-write (avoid dirtying project trees) * - Session cleanup happens at plugin init (no SessionStart) */ /** OpenCode plugin context passed to the factory function. */ interface PluginContext { directory: string; } /** OpenCode tool.execute.before — first parameter */ interface BeforeHookInput { tool: string; sessionID: string; callID: string; } /** OpenCode tool.execute.before — second parameter */ interface BeforeHookOutput { args: any; } /** OpenCode tool.execute.after — first parameter */ interface AfterHookInput { tool: string; sessionID: string; callID: string; args: any; } /** OpenCode tool.execute.after — second parameter */ interface AfterHookOutput { title: string; output: string; metadata: any; } /** OpenCode experimental.session.compacting — first parameter */ interface CompactingHookInput { sessionID: string; } /** OpenCode experimental.session.compacting — second parameter */ interface CompactingHookOutput { context: string[]; prompt?: string; } /** * OpenCode plugin factory. Called once when OpenCode loads the plugin. * Returns an object mapping hook event names to async handler functions. */ export declare const ContextModePlugin: (ctx: PluginContext) => Promise<{ "tool.execute.before": (input: BeforeHookInput, output: BeforeHookOutput) => Promise; "tool.execute.after": (input: AfterHookInput, output: AfterHookOutput) => Promise; "experimental.session.compacting": (input: CompactingHookInput, output: CompactingHookOutput) => Promise; }>; export {};