Skip to content

feat(v3): chat rooms primitive — daemon RPCs + CLI + client wrappers#33

Open
Codename-11 wants to merge 1 commit into
feature/v3-foundationfrom
feature/chat-rooms-daemon
Open

feat(v3): chat rooms primitive — daemon RPCs + CLI + client wrappers#33
Codename-11 wants to merge 1 commit into
feature/v3-foundationfrom
feature/chat-rooms-daemon

Conversation

@Codename-11
Copy link
Copy Markdown
Owner

Summary

Ships the v3 chat-rooms primitive across the stack:

  • Protocol v1 additions (all optional, forward-compatible): chat.create, chat.list, chat.post, chat.read, chat.wait — schemas in packages/client/src/protocol-chat.ts.
  • Daemon RPC handlers (packages/daemon/src/rpc/chat.ts) — backed by the existing chat_rooms + chat_messages SQLite tables. Messages auto-extract @mentions on post; replies validate reply_to stays in-room; post fans out to chat:<roomId> topic via the Hub.
  • Hub (packages/daemon/src/hub.ts) — adds subscribeRaw/unsubscribeRaw so in-process handlers (like chat.wait) can await topic events without going through the WebSocket encoder. External WS subscribers unchanged.
  • Client SDK (packages/client/src/client.ts) — adds typed client.chat.{create, list, post, read, wait} wrappers.
  • CLI — extends arc chat with rooms create/list, post, read (--since, --mentions-only, --mentioning, --limit, --json), and wait (--mentioning, --timeout). The existing arc chat REPL is untouched.

Test plan

  • npx tsc --noEmit — passes
  • npx vitest run tests/chat-rooms.test.ts — 10/10 pass (mention extraction, room CRUD, threading, sinceMs, mentions-only, mentioning filter, wait-with-bg-post, wait-timeout, cross-room reply_to rejection, unknown-room)
  • npx vitest run packages/daemon/tests/daemon.test.ts — still passes (4/4)
  • End-to-end smoke (daemon start → chat rooms create standupchat post standup "hello @agent-1"chat read standupchat wait --mentioning me resolves when a bg shell posts "yo @me")

Notes

  • agent.ts hook for ARC_AGENT_ID env injection is intentionally not touched to avoid conflicting with the parallel Unit 2 (agent-lifecycle) PR. The chat RPCs ship independently; agent-id plumbing can land alongside Unit 2.
  • arc chat remains backwards-compatible: top-level REPL action still works; subcommands are additive.

🤖 Generated with Claude Code

Ships `arc chat rooms create/list`, `arc chat post`, `arc chat read`, and
`arc chat wait` on top of the v3 daemon's `chat_rooms` + `chat_messages`
tables. Messages auto-extract `@mentions` on post, support threading via
`--reply-to`, and `chat.wait` blocks on room subscribers until a matching
message arrives or the timeout elapses.

Protocol v1 additions (all new fields optional):
  - chat.create, chat.list, chat.post, chat.read, chat.wait
  - Schemas in packages/client/src/protocol-chat.ts

Hub gains a `subscribeRaw` API for in-process RPC handlers to await
topic events without going through the WebSocket encoder — used by
chat.wait. External WebSocket subscribers continue to work unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant