feat(server,frontend): real-time sync architecture with message accumulator

- 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
This commit is contained in:
2026-03-08 14:05:59 +09:00
parent e7521433cb
commit 1060476113
16 changed files with 940 additions and 209 deletions

View File

@@ -13,10 +13,41 @@ description: Gravity Web 프로젝트 연동 서비스 URL, API 키, 프로젝
|------|-----|
| **Node.js** | 시스템 설치 (`node`, `npm`) |
| **Python (helper)** | `C:\ProgramData\miniforge3\envs\gravity_web\python.exe` |
| **프로젝트 루트** | `c:\Users\Certes\Desktop\gravity_web` |
| **프로젝트 루트** | `c:\Users\Cafe-Variet-E495\Desktop\gravity_web\gravity_web` |
| **Shell** | PowerShell (`curl` = `Invoke-WebRequest` 별칭이므로 반드시 **`curl.exe`** 사용) |
| **서버 실행** | `cd server && cmd /c node index.js` (port 3300) |
### Python 실행 규칙
```powershell
# ✅ 항상 전체 경로 사용 (python은 Windows Store 리다이렉트됨)
$PYTHON = "C:\ProgramData\miniforge3\envs\gravity_web\python.exe"
& $PYTHON .agents\workflows\helpers\vikunja_helper.py list todo
```
```powershell
# ❌ 금지: bare python / inline one-liner
python script.py # PATH 문제
python -c "import json; ..." # PowerShell 이스케이핑 깨짐
curl.exe ... | python -c "..." # 파이프 + 인라인 = 100% 실패
```
> [!WARNING]
> PowerShell에서 **inline Python one-liner는 절대 사용 금지**. 따옴표/특수문자가 깨집니다.
> 반드시 `.py` 파일을 `/tmp/` 에 만들어서 실행하세요.
### 서버 시작/종료 패턴
```powershell
# 서버 시작 전 기존 프로세스 정리 (EADDRINUSE 방지)
$existing = Get-NetTCPConnection -LocalPort 3300 -ErrorAction SilentlyContinue
if ($existing) {
Stop-Process -Id (Get-Process -Id $existing.OwningProcess).Id -Force
Start-Sleep -Seconds 1
}
cmd /c "cd server && node index.js"
```
## Gitea (Git Repository)
| 항목 | 값 |
@@ -43,7 +74,7 @@ description: Gravity Web 프로젝트 연동 서비스 URL, API 키, 프로젝
> 태스크 목록은 항상 라이브 조회를 사용합니다. 하드코딩된 매핑은 유지하지 않습니다.
```powershell
python .agents\workflows\helpers\vikunja_helper.py list todo
C:\ProgramData\miniforge3\envs\gravity_web\python.exe .agents\workflows\helpers\vikunja_helper.py list todo
```
## 기타 서비스