feat(lastmile): daemon 把 broker 房间事件注入活 Claude 会话 (§11.1 接线)#196
Open
raysonmeng wants to merge 1 commit into
Open
feat(lastmile): daemon 把 broker 房间事件注入活 Claude 会话 (§11.1 接线)#196raysonmeng wants to merge 1 commit into
raysonmeng wants to merge 1 commit into
Conversation
v3 §11.1 的集成 capstone(「最后一公里」):让活的 Claude 会话真正看到房间
事件。daemon 启动时连 broker、按 cwd→room 订阅,把 task_completed / presence
渲染成一行中文注入对话。这一步之前,v3 是「地基 + CLI + broker(有测试/Docker
实测)」,但还没接进真实会话;此 PR 把它接通。
The v3 §11.1 integration capstone ("last mile"): a live Claude session now
actually sees room events. At boot the daemon connects to the broker, subscribes
to the cwd-resolved room, and injects each task_completed / presence event into
the conversation as a one-line notice.
- src/room-bridge.ts: renderRoomEvent(Envelope→一行中文,未知 kind→null,绝不
dump 原始 payload) + startRoomBridge(连 broker + 订阅 + onEvent→render→emit,
按 idempotencyKey 去重 bounded Set)。FAIL-INERT:未登录(无 auth-token)或 cwd
无房间 → INERT,绝不连 broker、不开 collab.db、零影响 v1 单机流。
- src/daemon.ts: 4 处最小接线 —— import / 模块级 roomBridge / bootCodex 后
void startRoomBridge(emit = emitToClaude(systemMessage("system_room_event",…)))
/ shutdown 停。注入用 source:"codex" → 渲染且结构上不可能触发 Claude→Codex
reply 回环;broker 身份级 from-skip 保证不自回显。
- src/collab-store.ts: 抽出 resolveDbPath/resolveBrokerUrl/readAuthToken/openStore
(publish.ts 与 room-bridge.ts 共用,0700 目录锁不变),消除既有重复。
Tests: room-bridge-render (6: 各 kind + label 回退 + 未知 kind→null 防泄漏) +
room-bridge 集成 (3: 未登录 inert / cwd 无房间 inert / 实时注入 peer 的
task_completed 并按 idempotencyKey 去重)。bun run check 全绿:1795 pass。
Cross-review: 2 轮 4 reviewer(前台+后台并行)连续两轮 0 真实 issue;深度实证
fail-inert(碰 store 前返回)、shutdown 竞争守卫无泄漏、无回环/无自回显、
collab-store 抽取无残留死 import、多 pair 身份级语义正确。
Backlog: auth.ts/room.ts/broker.ts 的本地路径助手可一并收敛到 collab-store;
无感重连后 presence 重复 member_joined 抑制(PR11)。
🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要 / Summary
v3 §11.1 集成 capstone(「最后一公里」,stacked base =
feat/v3-pr8-presence/ #195)。让活的 Claude 会话真正看到房间事件:daemon 启动时连 broker、按 cwd→room 订阅,把 task_completed / presence 渲染成一行中文注入对话。此前 v3 是「地基 + CLI + broker(有测试/Docker 实测)」但没接进真实会话;此 PR 接通。改动
src/room-bridge.ts:renderRoomEvent(Envelope→一行中文,未知 kind→null) + startRoomBridge(连 broker + 订阅 + onEvent→render→emit,按 idempotencyKey 去重)。FAIL-INERT:未登录 / cwd 无房间 → INERT,绝不连 broker、不开 collab.db、零影响 v1 单机流。src/daemon.ts:4 处最小接线(import / roomBridge / bootCodex 后 startRoomBridge / shutdown 停)。注入用source:"codex"→ 渲染且结构上不可能触发 Claude→Codex reply 回环;broker 身份级 from-skip 保证不自回显。src/collab-store.ts:抽出 resolveDbPath/resolveBrokerUrl/readAuthToken/openStore(publish.ts + room-bridge.ts 共用),消除既有重复。测试 / Cross-review
room-bridge-render(6) + room-bridge 集成(3:inert 两态/实时注入/去重)。2 轮 4 reviewer 连续两轮 0 真实 issue:实证 fail-inert、shutdown 竞争无泄漏、无回环/无自回显、collab-store 无残留死 import、多 pair 语义正确。check 1795 pass。
🤖 Generated with Claude Code