/** * v5.7.7 Session Lifecycle — 接 openclaw 4.22 的 session_start / session_end / * before_reset / subagent_spawned / subagent_ended 五个 hook,闭环 session * 生命周期。 * * 调研依据:openclaw plugin-sdk hook-types.d.ts 暴露 29 个 hook,enhance 之前 * 只用了 4 个(before_prompt_build / before_tool_call / after_tool_call / * before_agent_reply)。Claude Code 官方 hook 体系(SessionStart / Stop / * SubagentStart / SubagentStop)在 openclaw 这边都有对应。 * * 红线遵守: * - 完全是非侵入式增强 — 只读 enhance 自己的 SQLite,不动 openclaw 任何状态 * - 不复制龙虾原生功能 — openclaw 自己有 hook 框架,enhance 只挂回调 * - 写入用 enhance 自有表(chapters/memories),不污染龙虾原生 memory * - 高频 hook(如 session_start 在多 agent 场景每分钟可能多次触发)严格控 * 写入:单 hook 最多写 1-2 条记录,并带 dedup tag */ import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import type { SessionLifecycleConfig, NotificationQueue } from "../types.js"; export declare function registerSessionLifecycle(api: OpenClawPluginApi, config: SessionLifecycleConfig | undefined, notifyQueue: NotificationQueue): void;