房间会话(Session)服务(Service)
A persistent SessionService backed by a Room/SQLite database in the consumer app's private storage.
Sessions, events, and app/user state survive process death and device reboot. Use this in place of InMemorySessionService when constructing a Runner in an Android consumer app.
Default usage — one instance per Application:
val sessionService = RoomSessionService.fromContext(applicationContext)Pass a distinct databaseName to give an agent its own SQLite file (e.g. when two agents in the same app should not see each other's sessions even within the same appName):
val agentASessions = RoomSessionService.fromContext(context, "agent_a.db")
val agentBSessions = RoomSessionService.fromContext(context, "agent_b.db")Dispatching is handled by Room — suspend fun DAO calls run on Room's internal transaction executor, so this class does not need to wrap calls in withContext.
函数
关闭会话。
使用指定的参数创建一个新的会话。
删除特定的会话。
检索特定的会话(session),并可选择性地过滤其中包含的事件(events)。
列出特定会话中的所有事件。
列出与特定应用程序和用户关联的会话(session)。