/** before_agent_start: pi hands us the assembled system prompt; returning a new * `systemPrompt` replaces it for this agent run (pi rebuilds it each run, so * splicing fresh every time is idempotent — never cumulative). */ interface BeforeAgentStartEventLike { systemPrompt: string; } interface BeforeAgentStartResultLike { systemPrompt: string; } /** tool_result: fired after a tool returns. `content` is the tool's output * blocks; returning a new `content` replaces what the model sees. */ interface ContentBlockLike { type: string; text?: string; } interface ToolResultEventLike { toolName: string; isError?: boolean; /** The tool's resolved input. For `read` it carries the file path under * `path` (or the legacy `file_path`). Typed loosely; narrowed at use. */ input?: unknown; content: ContentBlockLike[]; } interface ToolResultCtxLike { /** The session cwd — used to resolve a relative read path. */ cwd?: string; } type ToolResultResultLike = { content: ContentBlockLike[]; } | void; interface PiLike { on(event: 'before_agent_start', handler: (event: BeforeAgentStartEventLike) => BeforeAgentStartResultLike | void | Promise): void; on(event: 'session_start', handler: (event: unknown, ctx: unknown) => void): void; on(event: 'tool_result', handler: (event: ToolResultEventLike, ctx: ToolResultCtxLike) => ToolResultResultLike | Promise): void; } /** * Register the document substrate's pi hooks on `pi`. * * Returns immediately (inert) when CRTR_NODE_ID is absent — a non-canvas pi * session gets no hooks. Each handler is independently wrapped so a failure * degrades to a no-op (boot proceeds, the read returns) rather than bricking. */ export declare function registerCanvasDocSubstrate(pi: PiLike): void; export default registerCanvasDocSubstrate;