/** * OpenClaw lifecycle hooks for the Shroud privacy plugin. * * Privacy architecture — two directions, one fetch intercept: * Outbound (obfuscation): globalThis.fetch intercept replaces real PII * with deterministic fakes before ANY LLM API call. * Inbound (deobfuscation): Same fetch intercept buffers the LLM's SSE * response per content block, deobfuscates fakes * back to real values, and returns clean events. * OpenClaw never sees fakes — all channels, sessions, * and delivery paths receive real text automatically. * * Hooks: * 1. before_prompt_build (async) -- pre-seed mapping store for the fetch intercept * 2. before_message_write (SYNC) -- deobfuscate assistant messages for transcript * 3. before_tool_call (async) -- deobfuscate tool params (+ depth tracking) * 4. tool_result_persist (SYNC) -- obfuscate tool result message * 5. message_sending (async) -- deobfuscate outbound message content (backup) * 6. globalThis.__shroudStreamDeobfuscate -- streaming event deobfuscation hook * 7. globalThis.__shroudDeobfuscate -- channel delivery deobfuscation hook * 8. globalThis.fetch intercept -- obfuscates requests, deobfuscates responses */ import { Obfuscator } from "./obfuscator.js"; export interface PluginApi { on(event: string, handler: (...args: any[]) => any): void; registerTool(tool: { name: string; description: string; inputSchema: object; handler: (input: any) => Promise; }): void; pluginConfig?: unknown; logger?: { info(...args: any[]): void; warn(...args: any[]): void; error(...args: any[]): void; }; } export declare function registerHooks(api: PluginApi, obfuscator: Obfuscator): void;