feat: group chat session lifecycle, typing recovery, mention highlighting (#186)

* feat: restore group chat system with Socket.IO and SQLite persistence

- GroupChatServer: Socket.IO server with room management, message history, typing indicators
- SQLite storage for rooms, messages, and agent configuration
- AgentClients: manages AI agent connections via socket.io-client, forwards @mentions to Hermes gateway
- REST API: room CRUD, agent management, invite codes
- Agent auto-restoration on server restart
- Tests for all REST endpoints

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add context-engine design document for group chat compression

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: handle special-character session search

* fix: keep unicode dotted session search on quoted FTS path

* feat: add context engine and group chat frontend UI

- Context engine: three-zone compression (head/tail/summary) with LLM
  summarization, incremental updates, TTL cache, and graceful degradation
- Frontend: group chat page with Socket.IO client, room sidebar, message
  list, agent/member display, create/join-by-code modals
- Integration: wire context engine into agent-clients before /v1/runs
- Refactor ChatStorage to use global DB (getDb/ensureTable) with gc_ prefix
- Add i18n keys for group chat to all 8 locales
- Add sidebar nav entry and router for group chat page

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove leftover main branch code from merge conflict resolution

The `isNumericQuery`, `hasUnsafeChars`, and `runLikeContentSearch` functions
no longer exist — they were replaced by HEAD's `shouldUseLiteralContentSearch`
and `runLiteralContentSearch`. This dead code block caused a TypeScript
compile error after the merge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: install missing socket.io dep and type ack params

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: enable WebSocket proxy and fix socket.io transport for group chat

- Add ws: true to Vite proxy config so WebSocket upgrade requests
  are forwarded to the backend
- Allow both polling and websocket transports on server and client
  (polling as fallback when WebSocket upgrade fails through proxy)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: separate socket.io path from REST routes for group chat

socket.io was mounted at /api/hermes/group-chat which intercepted all
REST requests to /api/hermes/group-chat/rooms etc, returning
"Transport unknown". Changed socket.io path to /api/hermes/group-chat/ws
to avoid conflicts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: improve group chat UI, agent management, and socket.io reliability

- Redesign GroupChatPanel with Naive UI, stacked agent avatars, and popover management
- Match GroupChatInput style with single chat input, add IME composition handling
- Add agent add/remove per room with profile selection and duplicate prevention
- Use @multiavatar for SVG avatar generation with caching
- Decouple joinRoom from socket.io, use REST API for data loading
- Switch socket.io to default path with /group-chat namespace to avoid proxy conflicts
- Restore agent connections after server is listening
- Add getRoomDetail REST endpoint and duplicate agent prevention (409)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: server-side @mention routing with context compression status and queue

- Move @mention detection from agent socket listeners to server-side processMentions()
- Add per-room processing lock to block mention dispatch during compression
- Queue mentions during processing, drain only the latest when ready
- Emit context_status events (compressing/replying/ready) to room via Socket.IO
- Frontend displays compression status indicator above input
- Token-based compression trigger (100k threshold) with CJK-aware estimation
- Fix compressor type errors (countTokens parameter type)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: improve group chat profile handling and session sync

Refine group chat room/session behavior with per-room compression controls, sidebar updates, and better stale session cleanup so multi-profile group chat state stays consistent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat: group chat improvements — session lifecycle, typing recovery, mention highlighting

- Fix cross-profile session deletion with deferred delete queue
- Move saveSessionProfile to after gateway response confirmation
- Replace all console.log with logger in group-chat modules
- Add server-side typing/context_status state tracking for room rejoin
- Fix @ mention popup position to follow cursor
- Add @ mention highlighting (blue) in chat message content
- Fix mention regex to match all occurrences after HTML tags
- Enable esbuild minify and treeShaking
- Move @multiavatar/multiavatar to devDependencies
- Add i18n keys for group chat features
- Update tests for new functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: bump version to 0.4.5 and move @multiavatar to devDependencies

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Zhicheng Han <zhicheng.han@mathematik.uni-goettingen.de>
This commit is contained in:
ekko
2026-04-24 20:41:14 +08:00
committed by GitHub
parent 82965ae6e2
commit ba72264542
47 changed files with 7590 additions and 141 deletions
+52
View File
@@ -48,6 +48,7 @@ export default {
update: '업데이트',
create: '생성',
saveFailed: '저장 실패',
deleteFailed: '삭제 실패',
ok: '확인',
copied: '복사됨',
copy: '복사',
@@ -76,6 +77,8 @@ export default {
channels: '채널',
terminal: '터미널',
files: '파일',
groupChat: '그룹 채팅',
groupConversation: '대화',
settings: '설정',
connected: '연결됨',
disconnected: '연결 끊김',
@@ -579,6 +582,55 @@ export default {
saveFile: '저장',
},
// 그룹 채팅
groupChat: {
title: '그룹 채팅',
createRoom: '방 만들기',
joinByCode: '코드로 참여',
roomName: '방 이름',
roomNamePlaceholder: '방 이름을 입력하세요',
inviteCode: '초대 코드',
autoGenerate: '자동 생성',
noRooms: '아직 방이 없습니다',
selectOrCreate: '방을 선택하거나 만들어 채팅을 시작하세요',
agents: '에이전트',
addAgent: '에이전트 추가',
selectProfile: '프로필 선택',
agentAdded: '에이전트가 추가되었습니다',
agentAlreadyInRoom: '해당 에이전트가 이미 방에 있습니다',
noAgents: '이 방에 에이전트가 없습니다',
members: '멤버',
roomCreated: '방이 생성되었습니다',
roomDeleted: '방이 삭제되었습니다',
deleteRoomConfirm: '이 방을 삭제하시겠습니까?',
you: '나',
joined: '방에 참여했습니다',
joinFailed: '방 참여에 실패했습니다',
inputPlaceholder: '메시지를 입력하세요... (Enter로 전송)',
enterCode: '초대 코드를 입력하세요',
yourName: '이름',
yourNamePlaceholder: '표시 이름을 입력하세요',
yourDescription: '설명 (선택)',
yourDescriptionPlaceholder: '자신을 소개해 주세요...',
agentName: '에이전트 이름',
agentNamePlaceholder: '사용자 지정 이름 (빈칸=프로필 이름)',
agentDesc: '에이전트 설명',
agentDescPlaceholder: '이 에이전트가 하는 일을 설명...',
agentReplying: '이(가) 응답 중...',
agentCompressing: '이(가) 컨텍스트 압축 중...',
compressionSettings: '압축 설정',
triggerTokens: '압축 트리거 토큰',
triggerTokensDesc: '이 토큰 수를 초과하면 컨텍스트 압축이 시작됩니다',
maxHistoryTokens: '최대 기록 토큰',
maxHistoryTokensDesc: '압축된 컨텍스트의 최대 토큰 수',
tailMessageCount: '최근 메시지 수',
tailMessageCountDesc: '압축 후 그대로 유지할 최근 메시지 수',
compressionConfig: '압축 설정',
compressNow: '지금 압축',
compressingInProgress: '압축 진행 중',
compressionSaved: '압축 설정이 저장되었습니다',
},
// 다운로드
download: {
downloading: '다운로드 중...',