/**
 * Hooks adapter — shared types.
 *
 * The hooks adapter gives in-process hosts (Claude Code SDK, Codex runner,
 * internal CLI glue) a direct, typed surface over `kernel.run.*` and a small
 * set of engine services. Unlike the MCP adapter, it does not serialise to
 * JSON-RPC and never crosses a process boundary.
 *
 * Layering rule: files in `src/adapters/hooks/**` may import from
 * `src/kernel/**` and `src/engines/**` only. They MUST NOT import from
 * `src/agents/adapters/mcp/**` or `src/dashboard/**`. Enforced by
 * `test/adapter-boundary.test.ts`.
 */
/** Helper to wrap a thunk into a HookResult. */
export async function asHookResult(fn) {
    try {
        const value = await fn();
        return { ok: true, value };
    }
    catch (err) {
        return { ok: false, error: err instanceof Error ? err.message : String(err) };
    }
}
