- Add message-accumulator.js: cascades diff-based message accumulation - Add 3-second cascade polling with broadcastToAll (was undefined!) - Add /api/bridge/approve endpoint: tries accept/reject Step→Command→Terminal - Add persistent approve/reject buttons in chat header toolbar - Frontend: loadSessionMessages (trajectory + accumulated), applyNewMessages (WS push) - Status change detection: _prevStatusKey tracking prevents unnecessary re-renders - actionInProgress flag prevents DOM replacement during button fetch - Known issues: Trajectory 341 hard limit, Cascade no command-approval state
1.4 KiB
1.4 KiB
실시간 동기화 아키텍처 구현
- 시간: 2026-03-08 08:42~13:58
- Commit:
pending - Vikunja: #251 → done
결정 사항
Trajectory API 한계 → Message Accumulator 패턴
- Trajectory API가 341개로 하드캡, 페이지네이션 파라미터 무시됨
- Cascades API가 최신 task/notify만 제공 (1개씩)
- 해결: 서버사이드
message-accumulator.js로 cascade 스냅샷을 3초마다 diff하여 새 메시지 누적 저장 - 초기 로드: trajectory(341) + accumulated messages 합산
실시간 Push vs Polling
- Bridge WS 이벤트(step_changed)에 의존만으로는 누락 발생 가능
- 3초 interval polling을 백업으로 추가하여 안정성 보장
- WS 이벤트 + polling 이중 구조
승인 버튼: 자동 감지 vs 수동
- Cascade API에 command approval 대기 필드 없음 (status는 항상 RUNNING)
- stepCount 정체 감지(6초)로 추정 시도 → 불안정
- 최종 결정: 헤더에 영구적 ✅ 승인 / ❌ 거절 버튼 추가 (always accessible)
미완료
- 승인 버튼 자동 감지 안정화 (isWaiting 정확도 개선)
- inline 승인 버튼(chat 내부)과 헤더 버튼 간 상태 동기화
- 대화 중간 메시지 누락 문제 (서버 재시작 시 accumulator 초기화)
- isWaiting→isRunning 전환 시 DOM 리렌더링으로 인한 스크롤 점프 미세 조정