Skip to content

feat(room): overhaul multi-agent Room architecture, AX tools, and workbench UX - #7127

Merged
M4n5ter merged 10 commits into
rust-previewfrom
feat/room-overhaul
Nov 22, 2026
Merged

M4n5ter merged 10 commits into
rust-previewfrom
feat/room-overhaul

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Nov 21, 2026 •

Copy link
Copy Markdown
Member
English

Summary

End-to-end multi-agent Room implementation across SQLite storage, Host dispatch and Agent tools, and the Workbench desktop UI.

Storage & Delivery State

  • Schema & Store (0052_room_overhaul.sql, plugins/agent/state/src/room.rs):
    • Adds Room topic, per-room revision, agent_room_members (explicit batch add/remove plus automatic enrollment on post and mention), agent_room_reactions (insertion-ordered), agent_room_pins, message edited_at / deleted_at (soft delete preserving reply_to foreign keys), and agent_room_search_docs + FTS5 trigram index agent_room_search keyed by integer rowid (with substring query support for 1–2 character CJK terms).
    • Supports centered RoomPosition::Around paging and batch participants resolution (deleted sessions resolve with unavailable: true).
    • Derives per-message delivery_states (queued, working, waiting, replied, reacted, silent, failed, stopped, rejected) directly from agent_queue_items, agent_catalog_runs, agent_interaction_pending, agent_room_reactions, and explicit reply_to replies.
    • Scopes watch_room to a per-room 53-bit fingerprint covering that Room's revision and its members' live, blocked, pending, terminal, title, and archive state.

Host Dispatch & Agent Tools

  • Dispatch & Guardrails (plugins/agent/native/src/owner/rooms.rs, plugins/agent/native/src/owner/session_tools.rs, plugins/agent/facts/src/input/references.rs, plugins/workspace/workspace-files/native/src/lib.rs):
    • Delivers a structured <room_context> envelope to mentioned Agents (Room title, workspace, topic, co-mentions, roster with (you), top 5 pinned messages, and the 6 most recent posts with readable author names and attachment URIs) while keeping private chat display text concise.
    • Distinguishes explicit [@Name](maka://session/<id>) mentions from plain [Name](maka://session/<id>) session links so only explicit @ mentions wake Agents; enforces self-mention rejection, SessionSend tool-allowlist pre-flight checks, and a 6-hop Agent-to-Agent circuit breaker reset on human input.
    • Uses Steer as the default Room delivery mode (with optional Queue mode), atomically refreshing target queue and run state inside the RoomPost transaction and falling back to Followup if the target run completes concurrently.
    • Exposes roomState, roomSearch, roomManage RPCs, SessionRead (searchQuery, around, room overview), Read("maka://session/<room>"), cross-session attachment forwarding via maka://session/<id>/attachments/<attachment_id>, and SessionManage Room actions (room_topic, room_members, room_react, room_pin, room_edit, room_delete). Human users retain edit and retract control over Room messages.

Workbench UI, Reactions & Motion

  • Layout & Navigation (RoomWorkspace.tsx, RoomPanels.tsx, RoomMessageRow.tsx, RoomComposer.tsx, RoomView.tsx):
    • Single-line 32px Room header with title, optional topic subtitle, overlapping 20px member avatar stack (with live working/waiting indicators and synced side-pane highlight ring), overlay <Popover> panels for Pins and full-text Search, and a ⋯ room menu.
    • Dual-voice timeline: human posts right-aligned in C.card bubbles without redundant self-avatar/nametag; Agent posts left-aligned with avatar, name, and full-width Markdown; 5-minute same-author grouping with hover timestamps.
    • Quiet composer chrome with true inline [@Title](maka://session/<id>) mentions, waiting-agent approval pill above the composer, actionable-only per-message delivery chips (waiting, failed, rejected), and a <ShimmerText> working footer.
    • Wide-desktop live side-pane split when clicking any Agent mention, avatar, or delivery pill while keeping the Room mounted alongside it.
  • Reactions & Native Motion (RoomReactions.tsx, roomMotion.ts):
    • Native nsh/base <EmojiPicker> popover with 8-column grid, category jump bar, skin-tone switcher, Storage-persisted recents, and Chinese search annotations.
    • Customizable double-click default reaction (right-click any quick-bar emoji to set default; double-click message frame outside selectable prose), borderless soft reaction pills showing overlapping 14px mini avatars for 1–2 reactors and an animated digit counter for ≥3, <HoverCard> reactor roster with click-to-inspect Agent split, and an ephemeral UI-thread <Canvas> ring-and-spark burst on toggle-on.
    • UI-thread animations gated by !reduceMotion() && platform.idiom !== 'terminal': live incoming message rise, breathing active/waiting indicators, spring pill bounce/tilt, 150ms popup transitions, and 1.65s breathing jump highlight.

Screenshots

Dual-voice Room timeline with Telegram-style reactions & native <EmojiPicker> popover

Room EmojiPicker

Live Agent side-pane split alongside Room

Room Agent Side Split

Source Room opened beside an Agent conversation

Room Source Split

Local Database Migration (Existing Pre-PR runtime-rust.sqlite)

Migration 0052_room_overhaul.sql contains schema DDL only, with no runtime compatibility branches or in-migration data backfills. For existing local databases containing Rooms created prior to this PR, run the standalone Python migration script (targets untouched revision = 0 rooms with an empty roster, plus idempotent FTS5 backfill; pass --fts-only to re-index FTS independently) after Maka applies migration 0052 once (stops safely if schema 0052 is not present, creates a timestamped backup by default, and checks foreign keys before committing):

Verification

  • cargo test --locked -p maka-agent-facts (42/42 passed)
  • cargo test --locked -p maka-agent-state --lib store::removal::tests (4/4 passed)
  • cargo test --locked -p maka-agent-state --lib migration_tests (1/1 passed)
  • cargo test --locked -p maka-agent-state --lib room::tests (3/3 passed)
  • cargo test --locked -p maka-agent-native --lib preset_acceptance::rooms (4/4 passed)
  • node --test products/maka/workbench/tests/room-message.test.mjs (6/6 passed)
  • node scripts/ci.mjs run contracts (passed)
  • cargo test --locked -p maka-cli --no-default-features --features desktop-tests --test native-desktop -- room (3/3 passed)
  • cargo clippy (-D warnings), rustfmt --edition 2024 --check, biome format, and node scripts/ci.mjs check licenses passed
简体中文

概要

端到端实现 Maka 的多 Agent Room 协作能力,覆盖 SQLite 状态存储、Host 调度与 Agent 工具接口、以及桌面工作台 UI。

存储与投递状态

  • Schema 与 Store(0052_room_overhaul.sql、plugins/agent/state/src/room.rs):
    • 提供 Room topic、按房间递增的 revision、agent_room_members(显式批量增删 + 发言/提及自动入群)、按首次出现保序的 agent_room_reactions、agent_room_pins、消息 edited_at / deleted_at(软删保留 reply_to 外键),以及以整型 rowid 映射的 agent_room_search_docs + FTS5 trigram 索引 agent_room_search(同时支持 1–2 字 CJK 子串搜索)。
    • 支持 RoomPosition::Around 居中窗口翻页与批量 participants 解析(已删会话以 unavailable: true 呈现)。
    • 直接从 agent_queue_items、agent_catalog_runs、agent_interaction_pending、agent_room_reactions 与显式 reply_to 回复实时派生每条消息的 delivery_states(queued / working / waiting / replied / reacted / silent / failed / stopped / rejected)。
    • watch_room 水位为按房间计算的 53-bit 指纹,仅追踪本房 revision 及本房成员的在线、等待、终态、标题与归档状态。

Host 调度与 Agent 工具

  • 调度与护栏(plugins/agent/native/src/owner/rooms.rs、plugins/agent/native/src/owner/session_tools.rs、plugins/agent/facts/src/input/references.rs、plugins/workspace/workspace-files/native/src/lib.rs):
    • 被提及的 Agent 接收紧凑的 <room_context> 唤醒上下文(房间标题、工作区、Topic、同批 co-mentions、带 (you) 标识的成员名册、Top 5 置顶消息以及最近 6 条带可读人名与附件 URI 的历史),同时保持私聊展示文案干净。
    • 区分显式 [@Name](maka://session/<id>) 提及与普通 [Name](maka://session/<id>) 会话链接,仅显式 @ 唤醒 Agent;内置自提及拦截、目标 SessionSend 工具白名单预检与连续 Agent 互 @ 6 跳熔断(人工发言重置)。
    • Room 提及默认使用 Steer 实时插话模式(支持按需切换 Queue),在 RoomPost 同事务内原子更新目标队列与 Run 状态,若目标 Run 并发结束则回落为 Followup。
    • 提供 roomState、roomSearch、roomManage RPC,以及 SessionRead(searchQuery、around、room 概览)、Read("maka://session/<room>")、跨会话附件转发(maka://session/<id>/attachments/<attachment_id>)与 SessionManage 6 项 Room 管理动作(room_topic、room_members、room_react、room_pin、room_edit、room_delete)。人工用户保留编辑和撤回群内消息的权限。

桌面工作台 UI、Reaction 与动效

  • 布局与交互(RoomWorkspace.tsx、RoomPanels.tsx、RoomMessageRow.tsx、RoomComposer.tsx、RoomView.tsx):
    • 32px 单行 Room 顶栏:标题、可选 Topic 副标题、20px 重叠成员头像栈(带工作/等待呼吸指示与右侧分屏同步高亮环)、浮层 <Popover> 置顶列表与全文搜索、以及 ⋯ 菜单。
    • 双声道时间线:人工消息右对齐置于 C.card 气泡内(不重复展示自身头像与姓名);Agent 消息左对齐展示头像、姓名与全宽 Markdown;同一作者 5 分钟内连续发言折叠头部,hover 左侧显露时间。
    • 简洁输入区:支持真行内 [@Title](maka://session/<id>) 提及、输入框上方单枚等待确认胶囊、每条消息下仅展示需操作的投递状态(waiting / failed / rejected)以及底部 <ShimmerText> 工作提示。
    • 宽屏点击任意 Agent 提及、头像或状态胶囊时在右侧实时分屏打开对应会话,同时保持 Room 挂载。
  • Telegram 风格 Reaction 与原生动效(RoomReactions.tsx、roomMotion.ts):
    • 基于 nsh/base 原生 <EmojiPicker> 的完整 8 列表情浮层(分类跳转、肤色切换、Storage 持久化最近使用、中文搜索词注解)。
    • 支持自定义双击默认表情(右键快捷栏任意表情可设默认,双击消息空白框触发且不干扰正文划词)、无硬边框柔和胶囊(1–2 人展示 14px 重叠迷你头像,≥3 人展示滑动数字计数)、<HoverCard> 表态名单(可直达对应 Agent 分屏)以及新增时的 UI 线程 <Canvas> 单环 6 星粒轻爆裂。
    • 全部 UI 线程动效受 !reduceMotion() && platform.idiom !== 'terminal' 统一门控:实时新消息上浮、工作/等待呼吸点、胶囊弹簧回弹与微倾、150ms 浮层进出、以及引用/置顶/搜索跳转的 1.65s 呼吸高亮。

截图预览

双声道 Room 时间线、Telegram 风格 Reaction 与原生 <EmojiPicker> 浮层

Room EmojiPicker

Room 右侧实时分屏查看 Agent

Room Agent Side Split

在 Agent 私聊中侧边并排查看来源 Room

Room Source Split

本地历史数据库迁移(已有 runtime-rust.sqlite)

迁移 0052_room_overhaul.sql 仅包含纯 Schema DDL,代码中不含运行时兼容分支或历史数据回填。若本地已有此前创建的 Room,在启动 Maka 完成 0052 建表并停止 Host 后,运行独立 Python 脚本回填历史成员名册(仅对未改动过的 revision = 0 且成员表为空的旧 Room 执行回填,可用 --fts-only 单独补 FTS5)与 FTS5 索引(默认自动备份并在提交前校验外键):

验证

  • cargo test --locked -p maka-agent-facts(42/42 通过)
  • cargo test --locked -p maka-agent-state --lib store::removal::tests(4/4 通过)
  • cargo test --locked -p maka-agent-state --lib migration_tests(1/1 通过)
  • cargo test --locked -p maka-agent-state --lib room::tests(3/3 通过)
  • cargo test --locked -p maka-agent-native --lib preset_acceptance::rooms(4/4 通过)
  • node --test products/maka/workbench/tests/room-message.test.mjs(6/6 通过)
  • node scripts/ci.mjs run contracts(通过)
  • cargo test --locked -p maka-cli --no-default-features --features desktop-tests --test native-desktop -- room(3/3 通过)
  • cargo clippy(-D warnings)、rustfmt --edition 2024 --check、biome format、node scripts/ci.mjs check licenses 全部通过

@github-actions github-actions Bot added the effort/XXL Over 2500 readable lines label Nov 22, 2026
@M4n5ter
M4n5ter merged commit 3c6f544 into rust-preview Nov 22, 2026
1 check passed
@M4n5ter
M4n5ter deleted the feat/room-overhaul branch November 22, 2026 05:41
M4n5ter added a commit that referenced this pull request Nov 22, 2026
#7127 merged onto rust-preview right before #7152, adding
plugins/agent/state/migrations/0052_room_overhaul.sql without the new
Migration::data field or migrations.lock.json entry introduced in #7152.

- Initialize data: None on migration 52 in plugins/agent/state/src/lib.rs.
- Seal 0052_room_overhaul.sql into scripts/rust/migrations.lock.json.

Generated-by: Maka (Gemini)
M4n5ter added a commit that referenced this pull request Nov 22, 2026
#7127 merged onto rust-preview right before #7152, adding
plugins/agent/state/migrations/0052_room_overhaul.sql without the new
Migration::data field or migrations.lock.json entry introduced in #7152.

- Initialize data: None on migration 52 in plugins/agent/state/src/lib.rs.
- Seal 0052_room_overhaul.sql into scripts/rust/migrations.lock.json.

Generated-by: Maka (Gemini)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XXL Over 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant