Compare commits

..

12 Commits

Author SHA1 Message Date
a9e1e677b0 feat: merge SPRINT-016 isometric office dashboard 2026-04-07 13:36:58 +09:00
658d5e7af7 docs: restore code-reviewer in sprint 016 spec 2026-04-07 13:01:44 +09:00
3bdd24a3a5 fix: restore 17 subagents in office dashboard 2026-04-07 12:57:43 +09:00
f920318138 fix: align office dashboard subagent count 2026-04-07 12:51:55 +09:00
a731ecee4b fix: stabilize office dashboard demo states and motion 2026-04-07 12:12:11 +09:00
6e0583efeb feat: implement SPRINT-016 isometric office dashboard
Build the 4자매 office dashboard with SVG scene, agent state
visualization, context panel, direct chat workspace, pipeline panel,
and server health panel.

- frontend/app/office/page.tsx: Main office page (sisters + ops data,
  WS live + polling fallback, selected agent state, chat toggle)
- frontend/components/office/OfficeScene.tsx: SVG 2D office floor plan
  with 4 fixed sister desks, 17 subagent nodes, handoff connector lines,
  conference room, and per-state animations (idle/thinking/tool_calling/
  speaking/error)
- frontend/components/office/ContextPanel.tsx: Right context panel
  showing selected sister or subagent detail, current task, subagent
  list, chat/detail links
- frontend/components/office/ChatWorkspace.tsx: Direct chat workspace
  with sister tabs, message timeline, streaming-ready layout; Gateway
  connection pending notice (honest fallback labeling)
- frontend/components/office/PipelinePanel.tsx: Bottom pipeline panel
  with sprint/workflow nodes and flow animations
- frontend/components/office/ServerHealthPanel.tsx: Server health grid
  for 4 sisters + Dev + Docker with live/snapshot/fallback labels
- frontend/components/common/Sidebar.tsx: Add /office nav item

Data labeling: sisters live via WS (snapshot fallback),
subagent states derived/fallback, pipeline snapshot, chat gateway-pending.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 11:49:23 +09:00
3ba765b430 docs: plan sprint-016 office dashboard 2026-04-07 11:29:59 +09:00
68c69f6dfa merge: hotfix-006 dashboard copy and live fidelity 2026-04-06 20:47:24 +09:00
441f590989 fix: correct dashboard freshness wiring 2026-04-06 20:45:41 +09:00
6596090677 fix: tighten dashboard copy and freshness labels 2026-04-06 20:40:59 +09:00
b47248b2be docs: plan hotfix-006 dashboard copy and live fidelity 2026-04-06 20:37:04 +09:00
768f9fdc20 merge: sprint-015 dashboard v3 redesign 2026-04-06 20:25:39 +09:00
19 changed files with 3321 additions and 84 deletions

View File

@@ -16,14 +16,14 @@
- 장기 문서: `docs/` - 장기 문서: `docs/`
## 활성 작업 ## 활성 작업
- **SPRINT-015**: Master Dashboard v3 정보 구조 리디자인 - **SPRINT-016**: 4자매 Isometric Office Dashboard 재기획
## 이번 Sprint 핵심 요구사항 ## 이번 Sprint 핵심 요구사항
1. 메인 대시보드를 4자매 운영 관제의 대표 화면으로 재정의 1. 4자매와 17개 서브에이전트, 총 21개 에이전트를 오피스 은유로 재설계
2. 현행 미니멀 터미널 UI를 유지한 채 레퍼런스의 강한 정보 구조를 흡수 2. 4자매 독립 Gateway WebSocket 기준 실시간 상태 모델 정리
3. 상단 global status bar / 4자매 상태 카드 / `ACTIVE PIPELINE` 중심 구조 도입 3. 고정 좌석 4자매 + 동적 이동 서브에이전트 + 회의실/연결선 구조 정의
4. `ACTIVITY FEED`, `SPRINT METRICS`, `INFRASTRUCTURE OVERVIEW`, `MISTAKE LOG & HARNESS`를 운영 문맥으로 재배치 4. direct chat / workflow panel / server health를 오피스 화면과 통합
5. 데스크톱 우선 설계 후 모바일 세로 흐름까지 함께 정리 5. PRD와 `.plans/` 구조를 새 제품 방향 기준으로 정리
## 이행 전략 ## 이행 전략
- 코드에서는 구 구조와 신 구조를 일정 기간 동시 지원 - 코드에서는 구 구조와 신 구조를 일정 기간 동시 지원
@@ -34,6 +34,6 @@
## 문서 맵 ## 문서 맵
- 구조 기준: `../ARCHITECTURE.md` - 구조 기준: `../ARCHITECTURE.md`
- 디자인 인덱스: `./design/index.md` - 디자인 인덱스: `./design/index.md`
- Sprint 계획: `./sprints/SPRINT-015.md` - Sprint 계획: `./sprints/SPRINT-016.md`
- 나랑 handoff: `./sprints/SPRINT-015-NARANG-HANDOFF.md` - PRD: `../docs/product-specs/openclaw-office-dashboard-prd.md`
- 배포 플로우: `./deploy/main-release-flow.md` - 배포 플로우: `./deploy/main-release-flow.md`

View File

@@ -8,6 +8,8 @@
## 페이지별 UI ## 페이지별 UI
- `ui/dashboard-design.md` - `ui/dashboard-design.md`
- `ui/office-dashboard-design.md`
- `ui/office-chat-design.md`
- `ui/projects-page-design.md` - `ui/projects-page-design.md`
- `ui/project-detail-design.md` - `ui/project-detail-design.md`
- `ui/sister-detail-design.md` - `ui/sister-detail-design.md`
@@ -19,8 +21,8 @@
## 레퍼런스 ## 레퍼런스
- `references/07-master-dashboard-v3-reference.md` - `references/07-master-dashboard-v3-reference.md`
## Sprint 015에서 반드시 반영할 화면 ## Sprint 016에서 반드시 반영할 화면
- 대시보드 메인: Master Dashboard v3 구조 반영 - 오피스 메인: 4자매 고정 좌석 + 서브에이전트 동적 이동
- 핵심 섹션: Global Status Bar / 4자매 상태 카드 / `ACTIVE PIPELINE` - 오피스 채팅: 자매 선택 direct chat + 현재 상태 결합
- 운영 패널: `ACTIVITY FEED`, `SPRINT METRICS`, `INFRASTRUCTURE OVERVIEW`, `MISTAKE LOG & HARNESS` - 운영 패널: active workflow / sprint / review loop / deploy gate / server health
- 모바일: 데스크톱 구조를 억지로 축소하지 말고 세로 읽기 흐름으로 재배 - 모바일: 오피스 씬 단순화 + 세로 흐름 재배

View File

@@ -204,6 +204,20 @@ User → Harang → Narang → Darang → Irang 흐름과, maker-checker loop, e
- mock 텍스트/숫자로 고정하지 말고 실제 데이터가 들어올 자리를 먼저 설계할 것 - mock 텍스트/숫자로 고정하지 말고 실제 데이터가 들어올 자리를 먼저 설계할 것
- 값이 없을 때는 `No recent activity`, `No active deployment`, `No harness rules yet`처럼 조용한 empty state 제공 - 값이 없을 때는 `No recent activity`, `No active deployment`, `No harness rules yet`처럼 조용한 empty state 제공
- offline / missing / unavailable 상태는 숨기지 말고 명확히 드러낼 것 - offline / missing / unavailable 상태는 숨기지 말고 명확히 드러낼 것
- websocket 연결 상태와 데이터 freshness를 같은 의미로 쓰지 말 것
- 각 섹션은 가능하면 아래 source 중 하나로 구분할 것
- `runtime live`
- `event mirrored`
- `polling snapshot`
- `doc derived`
- `empty / unavailable`
- 추정/합성값이면 사실처럼 단정하지 말고 neutral wording 사용
## 카피 원칙
- 설명문보다 라벨형 문구 우선
- 첫 화면 문구는 짧고 건조해야 함
- `~만들었어`, `~정리했어`, `~읽히게` 같은 메타 설명 금지
- 보드/패널 body는 원문 요약 또는 상태 문구 위주로 짧게 유지
## 인터랙션 원칙 ## 인터랙션 원칙
- hover 없어도 핵심 정보가 읽혀야 함 - hover 없어도 핵심 정보가 읽혀야 함

View File

@@ -0,0 +1,30 @@
# 오피스 채팅 워크스페이스 — Sprint 016
## 목적
자기야가 4자매 중 한 명을 선택해 직접 대화하고, 현재 작업 맥락과 tool 상태를 함께 보는 운영 채팅 인터페이스.
## 구조
### 좌측
- 자매 선택 탭
- 최근 대화 상대
- unread / active 상태
### 중앙
- 메시지 타임라인
- streaming 응답
- tool call 상태 삽입
- retry / stop / resend 액션
### 우측
- 선택 자매 상태
- current workflow
- 최근 handoff
- 관련 서브에이전트
## UX 규칙
- 채팅은 메신저가 아니라 운영 명령 패널처럼 보여야 함
- 현재 자매 상태와 대화가 분리되지 않아야 함
- tool calling / speaking 상태는 대화 흐름 안에서 보여야 함
## 모바일
- 자매 탭 → 메시지 → 상태 패널 순으로 세로 전환

View File

@@ -0,0 +1,63 @@
# 오피스 대시보드 메인 (`/office` 또는 `/`) — Sprint 016
## 목적
4자매와 서브에이전트 협업을 `고정 좌석 + 동적 이동 + 운영 패널` 구조로 보여주는 대표 화면.
## 핵심 은유
- 메인 자매 = 고정 좌석
- 서브에이전트 = 이동 가능한 팀원
- 회의실 = 협업/리뷰/핸드오프 문맥
- 인프라 존 = 배포/서버/헬스
- 연결선 = handoff / workflow transition
## 전체 레이아웃
### 1. Office Scene
화면 중심. 가장 큰 영역.
#### 고정 좌석
- 하랑이: 좌상단 또는 상단 중앙
- 나랑이: 좌하단 또는 좌측 작업 구역
- 다랑이: 우상단 또는 리뷰 구역
- 이랑이: 우하단 또는 인프라 구역
#### 서브에이전트 배치
- 기본은 자기 자매 주변 대기
- active workflow 시 작업석/회의실/인프라 존으로 이동
- 상태에 따라 아이콘/색/테두리/말풍선 변화
### 2. Right Context Panel
- 선택 에이전트 detail
- 현재 세션/상태
- 최근 이벤트
- direct chat 진입
### 3. Bottom Ops Panel
- current sprint
- active workflow
- review loop
- deploy gate
- server health summary
## 상태 표현
- `idle`: 조용한 점등
- `thinking`: 약한 pulse
- `tool_calling`: 도구 아이콘/점멸
- `speaking`: 말풍선 또는 stream 표시
- `error`: 적색 경고
## 연결 규칙
- 자매 간 핸드오프는 굵은 주 연결선
- 서브에이전트 내부 협업은 얇은 보조선
- review loop는 다랑이 회의실 중심으로 표시
- deploy path는 이랑이 인프라 존으로 흐름 표시
## UX 규칙
- 중심은 언제나 4자매
- 21개 에이전트를 다 보여도 난잡하면 안 됨
- 선택 전에도 전체 상태는 읽혀야 함
- 선택 후에만 상세 정보 밀도 증가
## 모바일
- 오피스 씬 단순화
- 자매별 클러스터 카드 + 축소 맵 우선
- 상세는 하단 시트 또는 탭으로 분리

View File

@@ -0,0 +1,44 @@
# HOTFIX-006 Narang Handoff
## repo / branch
- repo: `https://git.nabomhalang.co.kr/hanarang/hanarang-dashboard`
- branch: `feature/hotfix-006-dashboard-copy-live-fidelity`
## 읽을 문서
1. `.plans/hotfix/HOTFIX-006.md`
2. `.plans/design/ui/dashboard-design.md`
## 이번 수정 핵심
자기야 피드백은 명확해.
1. 문구가 너무 길고 쓸데없는 말이 많아
2. 실시간처럼 보이는데 실제론 아닌 부분이 있어
이 두 개를 바로 고쳐.
## 꼭 손볼 것
- 상단 headline / summary
- current focus 설명문
- operator meta
- pipeline node detail / fallback
- infra/meta card detail
- board 카드 body 문구
- `socket live`, `LIVE ON` 같은 라벨의 의미
## 절대 기준
- 설명문 쓰지 마
- UI 자기소개하지 마
- 실시간 아닌 걸 실시간처럼 포장하지 마
- source-of-truth 애매하면 neutral wording으로 낮춰
- 문구는 짧고 건조하게
## 구현 목표
- `ACTIVE PIPELINE`은 진짜 이벤트 기반이면 그렇게 보이고
- 아니면 `SNAPSHOT`, `DOC-DERIVED`, `NO ACTIVE HANDOFF`처럼 정직하게 보여
- `MISTAKE LOG & HARNESS`도 원문/출처/시각 중심으로 짧게 정리
- freshness 메타를 넣어서 stale 여부를 읽을 수 있게 해
## QA 전 체크
- 자기야가 봤을 때 `주구절절하다`는 느낌이 없어야 해
- `실시간인가? 아닌가?`가 헷갈리면 실패야
- build 통과는 기본

142
.plans/hotfix/HOTFIX-006.md Normal file
View File

@@ -0,0 +1,142 @@
# HOTFIX-006: 대시보드 문구 절제 + 실시간성 정합성 보정
## 목표
Master Dashboard v3에서 주구절절한 설명형 문구를 운영 대시보드다운 짧은 문장으로 정리하고, `실시간처럼 보이지만 실제로는 폴링/요약/문서 기반인 정보`를 정확한 source-of-truth 기준으로 다시 맞춘다.
## 왜 이걸 고치나
현재 메인 대시보드는 레이아웃은 좋아졌는데 두 가지 문제가 남아 있어.
1. **문구가 길다**
- 상단 Headline / Summary
- OperatorMeta
- pipeline/detail/fallback 문장
- harness/qa 보드 설명
이런 부분이 대시보드보다 설명문처럼 읽혀.
2. **실시간성 표현이 과하다**
- `socket live`는 웹소켓 연결 상태일 뿐, 모든 카드/보드가 실시간 원본 반영이라는 뜻은 아니야.
- `ACTIVE PIPELINE`, `MISTAKE LOG & HARNESS`, 일부 infra/meta는 최근 activity / QA 문서 / polling snapshot을 조합해 만든 값이 섞여 있어.
- 따라서 `실시간 반영`처럼 보이는 문구와 라벨은 정정해야 해.
## 범위
- 대시보드 메인(`/`) 문구 전반 절제
- source-of-truth 명시 정리
- 실시간 / 폴링 / 문서기반 / 추정치 상태 구분
- 필요 시 백엔드 dashboard ops 응답에 freshness/source 메타 추가
- 프론트에서 misleading wording 제거
## 태스크
### TASK-078: 대시보드 카피를 운영형 짧은 문구로 전면 정리
- **담당:** 나랑이
- **상태:** pending
- **주요 파일:**
- `frontend/app/page.tsx`
- `frontend/components/dashboard/ActivePipeline.tsx`
- **설명:**
- 문장형 설명을 줄이고 짧은 운영 문구로 교체
- 섹션 제목/보조 문구/fallback/empty state를 모두 다시 본다
- **문구 기준:**
- 길게 설명하지 말 것
- 1문장보다 라벨형/상태형 표현 우선
- `~읽히게 만들었어`, `~정리했어` 같은 메타 설명 금지
- **완료 기준:**
- 첫 화면 문구가 대시보드 UI 문장처럼 짧고 건조함
- 자기소개/설계 설명 문장이 제거됨
### TASK-079: source-of-truth 기준표 정리
- **담당:** 나랑이
- **상태:** pending
- **주요 파일:**
- `backend/src/dashboard/dashboard.service.ts`
- 필요 시 dashboard DTO/타입 정의
- `.plans/design/ui/dashboard-design.md`
- **설명:** 각 섹션 값이 어디서 왔는지 명확히 구분한다.
- **최소 구분:**
- runtime live
- websocket event mirrored
- polling snapshot
- repo/qa doc derived
- fallback/empty
- **완료 기준:**
- 주요 카드/보드/파이프라인 값에 원본 기준을 설명할 수 있음
- 합성값을 실시간 원본처럼 표시하지 않음
### TASK-080: `LIVE` 표현 정합성 보정
- **담당:** 나랑이
- **상태:** pending
- **주요 파일:**
- `frontend/app/page.tsx`
- `frontend/lib/useSocket.ts`
- **설명:**
- 현재 `socket live`는 websocket 연결 상태만 뜻하므로 표현을 더 정확히 바꾼다.
- 예: `SOCKET ON`, `EVENT STREAM ON`, `SNAPSHOT`, `STALE`, `SYNCED 12s AGO` 같은 운영형 라벨로 정리
- **완료 기준:**
- websocket 연결 여부와 데이터 최신성이 혼동되지 않음
- LIVE ON/OFF 하나만 보고 전체가 실시간이라고 오해되지 않음
### TASK-081: `ACTIVE PIPELINE` 실데이터/추정치 경계 보정
- **담당:** 나랑이
- **상태:** pending
- **주요 파일:**
- `backend/src/dashboard/dashboard.service.ts`
- `frontend/components/dashboard/ActivePipeline.tsx`
- **설명:**
- 노드 상태/active task/focus가 최근 activity 기반 추론이면 그 사실을 숨기지 말 것
- 명시적 handoff/event가 없으면 억지 문장 대신 짧은 neutral fallback 사용
- **완료 기준:**
- `ACTIVE PIPELINE`이 추정치를 확정 사실처럼 말하지 않음
- 이벤트 없음/불충분 상태가 자연스럽게 보임
### TASK-082: `MISTAKE LOG & HARNESS` / 보드 카드 원문성 보강
- **담당:** 나랑이
- **상태:** pending
- **주요 파일:**
- `backend/src/dashboard/dashboard.service.ts`
- `frontend/app/page.tsx`
- **설명:**
- `관리자 harness 편집 로그에서 직접 가져온 기록이야.` 같은 설명형 body 제거
- 가능하면 원문 제목/원문 요약/출처/시각만 짧게 노출
- **완료 기준:**
- 보드 카드 문구가 덜 소설 같고 더 기록물처럼 읽힘
- source 라벨/시각이 더 명확함
### TASK-083: freshness 메타 추가 및 노출
- **담당:** 나랑이
- **상태:** pending
- **주요 파일:**
- `backend/src/dashboard/dashboard.controller.ts`
- `backend/src/dashboard/dashboard.service.ts`
- `frontend/app/page.tsx`
- **설명:** dashboard ops 응답에 최소 freshness 메타를 추가한다.
- **예시:**
- generatedAt
- activityLatestAt
- sistersLatestAt
- qaDocLatestAt
- **완료 기준:**
- UI에서 `last sync`, `activity lag`, `runtime lag` 같은 판단이 가능함
- stale 상태를 눈치채기 쉬움
## 문구 톤 기준 예시
### 금지
- "지금 어디가 움직이고 있는지, 첫 화면에서 바로 읽히게 만들었어."
- "장식보다 handoff 판단이 먼저 읽히게 정리했어."
- "현재 오너 기준은 ... 최근 handoff와 phase를 같이 보고 있어."
- "관리자 harness 편집 로그에서 직접 가져온 기록이야."
### 권장
- `MASTER DASHBOARD`
- `CURRENT FOCUS`
- `SOCKET ON`
- `SNAPSHOT`
- `NO ACTIVE HANDOFF`
- `NO RECENT QA`
- `LAST EVENT 2m AGO`
- `DOC-DERIVED`
## 완료 기준
- 문구가 짧고 운영 대시보드답게 바뀜
- 실시간/폴링/문서유도 값이 구분됨
- misleading `live` 표현이 제거됨
- 자기야가 봤을 때 `실시간 아닌데 실시간처럼 보인다`는 느낌이 사라짐

View File

@@ -0,0 +1,218 @@
# SPRINT-016: 4자매 Isometric Office Dashboard 재기획
## 목표
기존 하나랑 대시보드를 `운영 패널 중심 UI`에서 한 단계 확장해, 4자매 메인 에이전트와 17개 서브에이전트가 실제로 협업하는 흐름을 **2D 등축 투영 오피스**로 시각화하는 차세대 관제 화면으로 재기획한다.
핵심은 이거야.
- 4자매의 고정 좌석과 역할이 한눈에 보여야 해
- 서브에이전트가 어떤 워크플로우 안에서 움직이는지 보여야 해
- 단순 예쁜 씬이 아니라 실시간 상태/협업/채팅/서버 헬스를 같이 판단할 수 있어야 해
- OpenClaw Gateway WebSocket을 기준으로 실제 상태를 반영해야 해
## 참고 레퍼런스
- 참고 프로젝트: `https://github.com/WW-AI-Lab/openclaw-office`
- 채택 포인트:
- 2D 등축 투영 오피스
- 고정 좌석 + 동적 이동
- 상태 애니메이션 / 연결선 / 회의실 은유
- Chat 작업공간과 관리 패널 결합
- 그대로 복제하지 않고, 하나랑 4자매 구조와 Lobster/Discord handoff 흐름에 맞게 번역한다.
## 운영 구조
### 메인 에이전트 (고정 데스크 / 독립 OpenClaw 인스턴스)
- 하랑이 (Planning)
- 나랑이 (Dev)
- 다랑이 (QA)
- 이랑이 (Infra)
### 서브에이전트
- 하랑이: `planner`, `task-tracker`, `prd-writer`
- 나랑이: `worker`, `db-designer`, `test-writer`, `refactorer`
- 다랑이: `reviewer`, `code-reviewer`, `qa-tester`, `security-auditor`, `ux-reviewer`
- 이랑이: `deploy-manager`, `db-manager`, `nginx-manager`, `monitoring`, `dns-manager`
총 21개 에이전트 (main 4 + sub 17)
## 파이프라인 모델
### 자매 내부
- Lobster 워크플로우 기반 순차 실행
- 예:
- `plan-sprint.lobster`
- `implement-sprint.lobster`
- `review-sprint.lobster`
- `deploy-check.lobster`
### 자매 간
- Discord 멘션 기반 자연어 핸드오프
- `자기야 → 하랑이 → 나랑이 → 다랑이 → 이랑이`
- 실패 시 `다랑이 → 나랑이` 되돌림 루프 지원
## 제품 목표
1. 4자매와 서브에이전트 협업 구조를 직관적으로 보여준다
2. OpenClaw Gateway WebSocket 기반 실시간 상태 모니터링을 제공한다
3. 자매 선택 직접 채팅과 운영 관제를 한 제품 안에 통합한다
4. Lobster 워크플로우 / 스프린트 / QA / 배포 흐름을 하나의 모델로 묶는다
5. 서버 헬스와 에이전트 헬스를 같은 맥락에서 본다
## 범위
- 메인 오피스 대시보드 (`/` 또는 신규 workspace landing)
- 에이전트 상태 시각화
- 회의실/협업 연결선/동적 이동 규칙
- 자매 선택 직접 채팅 인터페이스
- 파이프라인 현황 패널
- 서버 상태 패널
- 모바일/태블릿 대응 전략
- 데이터 소스 / WebSocket 이벤트 / 폴링 보정 전략 문서화
## 제외 범위
- 이번 Sprint에서 실제 Gateway 프로토콜을 새로 정의하지 않음
- 3D 전환 안 함
- 음성/영상 통화 기능 없음
- 에이전트 생성/삭제 전체 관리 콘솔을 이번 Sprint 핵심으로 두지 않음
## 정보 구조
### 1. Office Scene
- 4자매 고정 좌석
- 각 자매 주변에 자기 서브에이전트 풀 배치
- 상태에 따라 idle / thinking / tool_calling / speaking / error 시각화
- 회의실 / 작업대 / 대기 구역 / 인프라 구역 구분
### 2. Agent Detail Layer
- 선택한 자매/서브에이전트 상세
- 현재 세션 / 최근 메시지 / tool call / 리소스 지표
- 최근 handoff / 현재 워크플로우 단계
### 3. Chat Workspace
- 자매 선택 direct chat
- 최근 대화 히스토리
- 작업 지시 / 응답 / 툴 호출 상태 확인
### 4. Pipeline Panel
- 현재 Sprint
- active Lobster workflow
- cycle / retry / review loop
- handoff 상태
- deploy gate / approval 상태
### 5. Server Health Panel
- 4자매 서버 헬스
- Dev 서버
- Docker/infra 상태
- heartbeat / websocket / reconnect 상태
## 디자인 원칙
1. **은유는 강하게, 판단은 더 강하게**
- 오피스는 분위기용이 아니라 상태 판단용이야.
2. **실시간 우선, 추정은 정직하게**
- live / snapshot / doc-derived / fallback 구분 유지
3. **고정 좌석 + 동적 이동**
- 메인 자매는 늘 같은 자리에 있어야 함
- 서브에이전트만 워크플로우에 따라 이동/연결
4. **4자매 중심성 유지**
- 21개 전체를 보여도 중심은 언제나 하랑/나랑/다랑/이랑이야
5. **운영 패널과 오피스 뷰 결합**
- 보기 좋은 씬만 있고 운영 판단이 안 되면 실패
## 기술 방향
- Frontend: 기존 Next.js + styled-components 유지
- Backend: 기존 Nest.js + Prisma 유지
- 실시간: OpenClaw Gateway WebSocket 중심
- 보조 동기화: low-frequency polling snapshot 허용
- 렌더링: SVG + CSS animation 또는 canvas-lite 검토 가능
- 상태 저장: 기존 구조 유지하되 office scene 전용 store 계층 검토
## 데이터 소스 기준
| 대상 | 우선 소스 |
|---|---|
| 메인 에이전트 상태 | 4자매 Gateway WebSocket |
| 서브에이전트 상태 | 각 자매 runtime/agent event + workflow 상태 |
| 협업 연결선 | handoff / workflow transition / event stream |
| 채팅 인터페이스 | session/chat API |
| 파이프라인 현황 | Lobster workflow state + activity log |
| 서버 헬스 | admin/system/health 계열 API |
## 태스크
### TASK-091: 제품 PRD 및 IA 재정의
- **담당:** 하랑이
- **상태:** pending
- **산출물:**
- `docs/product-specs/openclaw-office-dashboard-prd.md`
- `.plans/OVERVIEW.md` 갱신
- **완료 기준:**
- 오피스 대시보드 비전/핵심 사용자/핵심 흐름/핵심 화면이 문서화됨
### TASK-092: 오피스 씬 레이아웃 설계
- **담당:** 하랑이 → 나랑이
- **상태:** pending
- **산출물:**
- `.plans/design/ui/office-dashboard-design.md`
- **완료 기준:**
- 4자매 좌석 / 서브에이전트 위치 / 회의실 / 인프라 구역 구조가 정의됨
### TASK-093: 채팅 워크스페이스 설계
- **담당:** 하랑이 → 나랑이
- **상태:** pending
- **산출물:**
- `.plans/design/ui/office-chat-design.md`
- **완료 기준:**
- 자매 선택 direct chat 구조와 패널 관계가 정의됨
### TASK-094: Gateway/WebSocket 실시간 모델 정의
- **담당:** 나랑이
- **상태:** pending
- **주요 범위:**
- 4개 Gateway 연결 전략
- presence / health / workflow / agent event 정리
- reconnect / reconciliation 규칙
- **완료 기준:**
- live / snapshot / fallback 구분이 문서와 코드 양쪽에서 유지됨
### TASK-095: 메인 오피스 씬 구현
- **담당:** 나랑이
- **상태:** pending
- **완료 기준:**
- 4자매 고정 좌석과 서브에이전트 동적 이동이 구현됨
- 상태별 시각 표현이 동작함
### TASK-096: 협업 시각화 + 회의실 이동 구현
- **담당:** 나랑이
- **상태:** pending
- **완료 기준:**
- handoff 연결선
- 회의실 이동 상태
- review/deploy loop 표현이 동작함
### TASK-097: 직접 채팅 인터페이스 구현
- **담당:** 나랑이
- **상태:** pending
- **완료 기준:**
- 자매 선택 direct chat 가능
- 최근 대화/응답/상태가 확인됨
### TASK-098: 서버 헬스 패널 구현
- **담당:** 나랑이
- **상태:** pending
- **완료 기준:**
- 4자매 + Dev + Docker 서버 상태가 함께 보임
### TASK-099: QA / 모바일 / 실브라우저 검증
- **담당:** 다랑이
- **상태:** pending
- **완료 기준:**
- Desktop / Tablet / Mobile 실브라우저 기준 확인
- live/snapshot 구분 검증
- 성능/가독성/blocker 확인
## 권장 구현 순서
1. PRD / IA / 오피스 씬 문서화
2. Gateway 실시간 모델 정리
3. 메인 오피스 씬 구현
4. 연결선 / 회의실 / 채팅 / 패널 구현
5. QA + 모바일 검증
## 완료 기준
- 4자매와 서브에이전트 구조가 오피스 화면에서 한눈에 보임
- 실시간 상태와 파이프라인이 실제 운영 흐름과 맞음
- 채팅/헬스/파이프라인이 오피스 뷰와 분리되지 않고 자연스럽게 이어짐
- 문서, 설계, 구현 기준이 `.plans/`에 정리됨

View File

@@ -23,6 +23,13 @@ interface OpsBoardItem {
source: string; source: string;
} }
interface FreshnessMeta {
generatedAt: string;
activityLatestAt: string | null;
sistersLatestAt: string | null;
qaDocLatestAt: string | null;
}
const QA_PATH_CANDIDATES = ['.plans/qa/', '.qa/']; const QA_PATH_CANDIDATES = ['.plans/qa/', '.qa/'];
const SISTER_ROLES: Record<string, string> = { const SISTER_ROLES: Record<string, string> = {
harang: 'Plan & Assign', harang: 'Plan & Assign',
@@ -64,7 +71,7 @@ function nodeStateFromEvidence(params: {
function summarizeActivity( function summarizeActivity(
activity?: ActivityRecord | null, activity?: ActivityRecord | null,
fallback = '최근 이벤트 없음', fallback = 'NO EVENT',
) { ) {
return ( return (
activity?.detail?.trim() || activity?.action?.replace(/_/g, ' ') || fallback activity?.detail?.trim() || activity?.action?.replace(/_/g, ' ') || fallback
@@ -149,8 +156,8 @@ export class DashboardService {
activity: latestProjectActivity, activity: latestProjectActivity,
}), }),
detail: latestProjectActivity detail: latestProjectActivity
? `${latestProjectActivity.project?.name ?? 'project'} · ${summarizeActivity(latestProjectActivity, '최근 프로젝트 이벤트 없음')}` ? `${latestProjectActivity.project?.name ?? 'project'} · ${summarizeActivity(latestProjectActivity, 'NO EVENT')}`
: '명시적으로 기록된 handoff / request 로그가 아직 없어.', : 'NO ACTIVE HANDOFF',
}, },
...sisters.map((sister) => { ...sisters.map((sister) => {
const activity = latestBySister.get(sister.name) ?? null; const activity = latestBySister.get(sister.name) ?? null;
@@ -169,10 +176,10 @@ export class DashboardService {
detail: activity detail: activity
? summarizeActivity(activity) ? summarizeActivity(activity)
: sister.status === 'offline' : sister.status === 'offline'
? '최근 런타임 응답이 없어서 offline 상태야.' ? 'RUNTIME OFFLINE'
: sister.lastSeen : sister.lastSeen
? `최근 활동 기록은 ${new Date(sister.lastSeen).toISOString()} 체크 기준이야.` ? 'SNAPSHOT ONLY'
: '최근 활동 로그가 아직 없어.', : 'NO EVENT',
}; };
}), }),
]; ];
@@ -184,8 +191,8 @@ export class DashboardService {
(item) => (item) =>
({ ({
id: `harness-${item.id}`, id: `harness-${item.id}`,
title: item.detail ?? 'Harness updated', title: item.detail ?? 'HARNESS UPDATED',
body: '관리자 harness 편집 로그에서 직접 가져온 기록이야.', body: item.detail ?? 'HARNESS UPDATED',
tone: toneFromText(`${item.action} ${item.detail ?? ''}`), tone: toneFromText(`${item.action} ${item.detail ?? ''}`),
author: item.sister?.name author: item.sister?.name
? this.toDisplayName(item.sister.name) ? this.toDisplayName(item.sister.name)
@@ -208,6 +215,23 @@ export class DashboardService {
.sort((a, b) => new Date(b.time).getTime() - new Date(a.time).getTime()) .sort((a, b) => new Date(b.time).getTime() - new Date(a.time).getTime())
.slice(0, 6); .slice(0, 6);
const freshness: FreshnessMeta = {
generatedAt: new Date().toISOString(),
activityLatestAt: activities[0]?.createdAt?.toISOString() ?? null,
sistersLatestAt:
sisters
.map((sister) => sister.lastSeen)
.filter((value): value is Date => value instanceof Date)
.sort((a, b) => b.getTime() - a.getTime())[0]
?.toISOString() ?? null,
qaDocLatestAt:
board
.filter((item) => item.category === 'DOC-DERIVED')
.map((item) => item.time)
.sort((a, b) => new Date(b).getTime() - new Date(a).getTime())[0] ??
null,
};
return { return {
focusProject: focusProject focusProject: focusProject
? { ? {
@@ -222,19 +246,17 @@ export class DashboardService {
pipeline: { pipeline: {
activeTask: focusProject activeTask: focusProject
? `${focusProject.name} · ${focusProject.currentSprint ?? focusProject.phase}` ? `${focusProject.name} · ${focusProject.currentSprint ?? focusProject.phase}`
: 'No active pipeline', : 'NO ACTIVE PIPELINE',
focus: latestProjectActivity focus: latestProjectActivity
? summarizeActivity( ? summarizeActivity(latestProjectActivity, 'NO EVENT')
latestProjectActivity, : 'SNAPSHOT / NO ACTIVE HANDOFF',
'최근 프로젝트 이벤트 없음',
)
: '최근 프로젝트 activity 기준으로 확정된 handoff가 아직 없어.',
reviewLoopCount, reviewLoopCount,
escalationCount, escalationCount,
deployState: focusProject?.deployStatus ?? 'standby', deployState: focusProject?.deployStatus ?? 'STANDBY',
nodes, nodes,
}, },
board, board,
freshness,
}; };
} }
@@ -283,7 +305,7 @@ export class DashboardService {
tone, tone,
author: inferQaAuthor(latestPath, content), author: inferQaAuthor(latestPath, content),
time: project.updatedAt, time: project.updatedAt,
category: 'qa-log', category: 'DOC-DERIVED',
source: `${project.repoName}:${latestPath}`, source: `${project.repoName}:${latestPath}`,
} satisfies OpsBoardItem, } satisfies OpsBoardItem,
]; ];

View File

@@ -0,0 +1,115 @@
# 하나랑 오피스 대시보드 PRD
## 제품명
하나랑 오피스 대시보드
## 한 줄 정의
OpenClaw 4자매와 서브에이전트 협업을 2D 등축 투영 오피스로 시각화하고, 채팅/파이프라인/서버 헬스를 함께 운영하는 멀티에이전트 관제 프론트엔드.
## 배경
기존 하나랑 대시보드는 운영 정보는 잘 보여주지만, 4자매와 서브에이전트가 실제로 어떻게 협업하는지 한눈에 느끼기엔 한계가 있어.
자기야가 원하는 건 단순 상태 카드가 아니라:
- 누가 자기 자리에서 대기 중인지
- 누가 회의실로 이동했는지
- 어떤 서브에이전트가 어떤 워크플로우에서 일하고 있는지
- 지금 QA 루프인지 배포 직전인지
`오피스`라는 직관적인 은유로 읽는 화면이야.
## 제품 목표
1. 4자매 메인 에이전트와 17개 서브에이전트, 총 21개 에이전트를 하나의 세계관 안에서 시각화한다.
2. 4자매 독립 Gateway WebSocket을 통해 실시간 상태를 반영한다.
3. Lobster 워크플로우와 Discord handoff를 자연스럽게 한 화면에 묶는다.
4. 직접 채팅, 파이프라인 현황, 서버 헬스까지 운영 도구를 통합한다.
## 핵심 사용자
- 자기야: 전체 파이프라인 운영 책임자
- 하랑이: Planning / handoff orchestration
- 나랑이: 구현 상태 추적
- 다랑이: QA 루프 / blocker 판단
- 이랑이: 배포 / 인프라 점검
## 핵심 시나리오
### 시나리오 1: 현재 누가 일하고 있는지 한눈에 보기
자기야가 메인 화면에 들어오면, 하랑/나랑/다랑/이랑 좌석과 주변 서브에이전트 상태를 보고 즉시 현재 국면을 판단한다.
### 시나리오 2: 구현 → QA → 배포 흐름 확인
나랑이 쪽 서브에이전트가 활발히 움직이다가, 다랑이 회의실로 연결선이 넘어가고, 승인되면 이랑이 인프라 영역으로 흐름이 넘어가는 걸 본다.
### 시나리오 3: 특정 자매와 직접 대화
자기야가 하랑이나 나랑이를 선택해서 direct chat을 열고 작업을 지시한다.
### 시나리오 4: 서버/헬스 이상 감지
대시보드 한쪽 패널에서 Gateway 연결, Dev 서버, Docker 상태 이상을 바로 감지한다.
## 기능 요구사항
### 필수
1. 4자매 Gateway WebSocket 연결
2. 2D 등축 투영 오피스 메인 화면
3. 메인 에이전트 4명 고정 좌석
4. 서브에이전트 동적 이동/상태 표시
5. 상태: `idle`, `thinking`, `tool_calling`, `speaking`, `error`
6. 협업 연결선 / 회의실 이동 시각화
7. 자매 선택 직접 채팅 인터페이스
8. Lobster 워크플로우 / 스프린트 / 사이클 패널
9. 서버 상태 패널 (4자매 + Dev + Docker)
### 중요
10. live / snapshot / fallback 구분
11. 실브라우저/모바일 대응
12. 기존 하나랑 대시보드 운영 패널과의 연속성 유지
## 정보 구조
### 메인 오피스 화면
- 좌측 또는 중앙: 오피스 씬
- 우측: 선택 에이전트 detail / chat / workflow
- 하단 또는 보조 패널: 서버 헬스 / 최근 handoff / sprint state
### 오피스 씬 요소
- 하랑이 데스크
- 나랑이 데스크
- 다랑이 데스크
- 이랑이 데스크
- 회의실
- 임시 작업석
- 인프라/서버 존
- 서브에이전트 이동 경로
### 채팅
- 자매 선택 탭
- 메시지 히스토리
- 입력창
- tool call 상태 / streaming 표시
### 운영 패널
- active workflow
- current sprint
- review loop
- deploy gate
- server health
## 데이터 소스
- 4자매 Gateway WebSocket
- activity log
- workflow state
- session/chat API
- admin/system/health API
## 기술 원칙
- 기존 Next.js + styled-components 유지
- Backend는 기존 Nest.js + Prisma 유지
- WebSocket은 OpenClaw Gateway 기준
- 필요 시 polling reconciliation 허용
- fake 데이터 하드코딩 금지
## 비기능 요구사항
- 첫 화면에서 현재 협업 구조 이해 가능
- 과한 애니메이션 금지
- 모바일에서도 핵심 흐름 유지
- 데이터 소스 구분이 명확해야 함
## 성공 기준
- 자기야가 메인 화면만 보고 현재 상태를 설명할 수 있음
- 4자매/서브에이전트 구조가 카드보다 더 직관적으로 읽힘
- 채팅/워크플로우/서버 패널이 따로 놀지 않음
- live / snapshot / fallback 구분이 사용자에게 정직하게 보임

View File

@@ -0,0 +1,486 @@
'use client';
import React, { useCallback, useEffect, useState } from 'react';
import styled from 'styled-components';
import { API_URL, POLL_INTERVAL_MS } from '@/lib/config';
import { useSocket } from '@/lib/useSocket';
import OfficeScene, {
type AgentState,
type SisterName,
type SisterNode,
type SubAgent,
type SelectedAgent,
} from '@/components/office/OfficeScene';
import ContextPanel from '@/components/office/ContextPanel';
import ChatWorkspace from '@/components/office/ChatWorkspace';
import PipelinePanel from '@/components/office/PipelinePanel';
import ServerHealthPanel, { type ServerEntry } from '@/components/office/ServerHealthPanel';
import type { PipelineNode } from '@/components/dashboard/ActivePipeline';
// ─── Types ───────────────────────────────────────────────────────────────────
interface SisterApiItem {
id?: number;
name: string;
status: 'online' | 'offline' | 'working' | 'unknown';
role?: string;
currentTask?: string | null;
lastSeen?: string | null;
cpu?: number;
memory?: { used?: number; total?: number };
}
interface DashboardOpsData {
focusProject: {
name: string;
phase: string;
progress: number;
deployStatus: string;
currentSprint?: string | null;
ownerSister?: string | null;
} | null;
pipeline: {
activeTask: string;
focus: string;
reviewLoopCount: number;
escalationCount: number;
deployState: string;
nodes: PipelineNode[];
};
freshness: {
generatedAt: string;
activityLatestAt: string | null;
sistersLatestAt: string | null;
qaDocLatestAt: string | null;
};
}
// ─── Static subagent definitions ─────────────────────────────────────────────
const SUBAGENT_DEFS: Record<SisterName, { id: string; name: string; label: string }[]> = {
harang: [
{ id: 'harang-planner', name: 'planner', label: 'planner' },
{ id: 'harang-task-tracker', name: 'task-tracker', label: 'task-tracker' },
{ id: 'harang-prd-writer', name: 'prd-writer', label: 'prd-writer' },
],
narang: [
{ id: 'narang-worker', name: 'worker', label: 'worker' },
{ id: 'narang-db-designer', name: 'db-designer', label: 'db-designer' },
{ id: 'narang-test-writer', name: 'test-writer', label: 'test-writer' },
{ id: 'narang-refactorer', name: 'refactorer', label: 'refactorer' },
],
darang: [
{ id: 'darang-reviewer', name: 'reviewer', label: 'reviewer' },
{ id: 'darang-code-reviewer', name: 'code-reviewer', label: 'code-rvw' },
{ id: 'darang-qa-tester', name: 'qa-tester', label: 'qa-tester' },
{ id: 'darang-security-auditor', name: 'security-auditor', label: 'security' },
{ id: 'darang-ux-reviewer', name: 'ux-reviewer', label: 'ux-reviewer' },
],
erang: [
{ id: 'erang-deploy-manager', name: 'deploy-manager', label: 'deploy' },
{ id: 'erang-db-manager', name: 'db-manager', label: 'db-mgr' },
{ id: 'erang-nginx-manager', name: 'nginx-manager', label: 'nginx' },
{ id: 'erang-monitoring', name: 'monitoring', label: 'monitor' },
{ id: 'erang-dns-manager', name: 'dns-manager', label: 'dns' },
],
};
const SISTER_DISPLAY: Record<SisterName, string> = {
harang: '하랑이',
narang: '나랑이',
darang: '다랑이',
erang: '이랑이',
};
const SISTER_ROLES: Record<SisterName, string> = {
harang: 'Planning & Orchestration',
narang: 'Development',
darang: 'QA & Review',
erang: 'Infra & Deploy',
};
const SISTER_ORDER: SisterName[] = ['harang', 'narang', 'darang', 'erang'];
const SUBAGENT_COUNT = Object.values(SUBAGENT_DEFS).reduce((total, defs) => total + defs.length, 0);
const FALLBACK_SISTERS: SisterApiItem[] = [
{
name: 'harang',
status: 'working',
role: SISTER_ROLES.harang,
currentTask: 'SPRINT-016 scope lock',
},
{
name: 'narang',
status: 'working',
role: SISTER_ROLES.narang,
currentTask: 'Office scene dynamic movement',
},
{
name: 'darang',
status: 'online',
role: SISTER_ROLES.darang,
currentTask: 'Review loop standby',
},
{
name: 'erang',
status: 'online',
role: SISTER_ROLES.erang,
currentTask: 'Gateway health watch',
},
];
// ─── Helpers ──────────────────────────────────────────────────────────────────
function statusToAgentState(status: SisterApiItem['status'], hasTask: boolean): AgentState {
if (status === 'offline') return 'error';
if (status === 'working') return hasTask ? 'tool_calling' : 'thinking';
if (status === 'online') return hasTask ? 'speaking' : 'idle';
return 'idle';
}
function derivedSubagentState(parentState: AgentState, index: number): AgentState {
// Derive subagent state from parent with some variety
if (parentState === 'error') return 'idle'; // subagents idle when parent is offline
if (parentState === 'tool_calling' && index === 0) return 'thinking';
if (parentState === 'speaking' && index <= 1) return 'thinking';
return 'idle';
}
function buildSisterNodes(sisters: SisterApiItem[]): SisterNode[] {
return SISTER_ORDER.map((name) => {
const apiItem = sisters.find((s) => s.name === name);
const status = apiItem?.status ?? 'unknown';
const hasTask = Boolean(apiItem?.currentTask);
const parentState = statusToAgentState(status, hasTask);
const subDefs = SUBAGENT_DEFS[name];
const subagents: SubAgent[] = subDefs.map((def, i) => ({
...def,
sister: name,
state: derivedSubagentState(parentState, i),
}));
return {
name,
displayName: SISTER_DISPLAY[name],
role: apiItem?.role ?? SISTER_ROLES[name],
emoji: name === 'harang' || name === 'narang' ? '🦊' : name === 'darang' ? '🐱' : '🐺',
state: parentState,
currentTask: apiItem?.currentTask ?? null,
subagents,
};
});
}
function buildServerEntries(sisters: SisterApiItem[], sisterSource: 'live' | 'snapshot' | 'fallback'): ServerEntry[] {
const sisterEntries: ServerEntry[] = SISTER_ORDER.map((name) => {
const s = sisters.find((x) => x.name === name);
return {
id: `server-${name}`,
label: SISTER_DISPLAY[name],
type: 'sister' as const,
status: s?.status ?? 'unknown',
detail: s?.currentTask ?? null,
source: s ? sisterSource : 'fallback',
};
});
// Dev server and Docker are fallback (no direct API yet)
const extraEntries: ServerEntry[] = [
{
id: 'server-dev',
label: 'Dev Server',
type: 'dev',
status: 'unknown',
detail: null,
source: 'fallback',
},
{
id: 'server-docker',
label: 'Docker / Infra',
type: 'docker',
status: 'unknown',
detail: null,
source: 'fallback',
},
];
return [...sisterEntries, ...extraEntries];
}
function formatGeneratedAt(ts: string): string {
try {
return new Date(ts).toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
} catch {
return ts;
}
}
// ─── Styled Components ────────────────────────────────────────────────────────
const Shell = styled.div`
display: flex;
flex-direction: column;
gap: var(--space-lg);
min-height: 0;
`;
const PageHeader = styled.div`
display: flex;
align-items: baseline;
gap: var(--space-lg);
flex-wrap: wrap;
`;
const PageTitle = styled.h1`
font-size: 20px;
font-weight: 600;
color: var(--text-primary);
letter-spacing: -0.01em;
`;
const PageMeta = styled.div`
font-family: var(--font-mono);
font-size: 11px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const FreshnessBar = styled.div`
display: flex;
gap: var(--space-md);
flex-wrap: wrap;
margin-left: auto;
`;
const FreshnessBadge = styled.span<{ $type: 'live' | 'snapshot' | 'fallback' }>`
font-family: var(--font-mono);
font-size: 10px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: ${({ $type }) =>
$type === 'live' ? '#00BFA5'
: $type === 'snapshot' ? '#FF9800'
: '#555'};
border: 1px solid currentColor;
padding: 2px 6px;
opacity: 0.8;
`;
const MainArea = styled.div`
display: flex;
gap: 0;
min-height: 0;
flex: 1;
@media (max-width: 767px) {
flex-direction: column;
}
`;
const SceneColumn = styled.div`
flex: 1;
display: flex;
flex-direction: column;
gap: var(--space-lg);
min-width: 0;
`;
const ChatArea = styled.div`
height: 520px;
flex-shrink: 0;
@media (max-width: 767px) {
height: 460px;
}
`;
const BottomPanels = styled.div`
display: flex;
flex-direction: column;
gap: var(--space-lg);
`;
const LoadingOverlay = styled.div`
display: flex;
align-items: center;
justify-content: center;
min-height: 400px;
font-family: var(--font-mono);
font-size: 12px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
`;
// ─── Main Component ───────────────────────────────────────────────────────────
export default function OfficePage() {
const [sisters, setSisters] = useState<SisterApiItem[]>([]);
const [opsData, setOpsData] = useState<DashboardOpsData | null>(null);
const [loading, setLoading] = useState(true);
const [selected, setSelected] = useState<SelectedAgent | null>(null);
const [chatSister, setChatSister] = useState<SisterName | null>(null);
// Live WebSocket connection
const { connected } = useSocket<SisterApiItem>({
onSistersUpdate: (updatedSisters) => {
setSisters(updatedSisters);
},
});
// Initial data fetch
useEffect(() => {
const fetchAll = async () => {
try {
const [sistersRes, opsRes] = await Promise.allSettled([
fetch(`${API_URL}/api/sisters`).then((r) => r.json()),
fetch(`${API_URL}/api/dashboard/ops`).then((r) => r.json()),
]);
if (sistersRes.status === 'fulfilled') {
setSisters(Array.isArray(sistersRes.value) ? sistersRes.value : []);
}
if (opsRes.status === 'fulfilled') {
setOpsData(opsRes.value);
}
} finally {
setLoading(false);
}
};
void fetchAll();
// Polling fallback
const interval = setInterval(() => {
fetch(`${API_URL}/api/sisters`)
.then((r) => r.json())
.then((data: SisterApiItem[]) => {
if (Array.isArray(data)) setSisters(data);
})
.catch(() => {/* ignore polling errors */});
}, POLL_INTERVAL_MS);
return () => clearInterval(interval);
}, []);
const hasSisterSnapshot = sisters.length > 0;
const sisterDataMode: 'live' | 'snapshot' | 'fallback' = connected
? 'live'
: hasSisterSnapshot
? 'snapshot'
: 'fallback';
const effectiveSisters = hasSisterSnapshot ? sisters : FALLBACK_SISTERS;
const sisterNodes = buildSisterNodes(effectiveSisters);
const serverEntries = buildServerEntries(effectiveSisters, sisterDataMode);
const handleSelectSister = useCallback((name: SisterName) => {
setSelected({ type: 'sister', name });
setChatSister(null);
}, []);
const handleSelectSubagent = useCallback((id: string, sister: SisterName) => {
setSelected({ type: 'subagent', id, sister });
setChatSister(null);
}, []);
const handleOpenChat = useCallback((sisterName: SisterName) => {
setChatSister(sisterName);
}, []);
const handleCloseChat = useCallback(() => {
setChatSister(null);
}, []);
const handleClearSelection = useCallback(() => {
setSelected(null);
}, []);
const pipeline = opsData?.pipeline ?? {
activeTask: 'SPRINT-016',
focus: 'Isometric Office Dashboard',
reviewLoopCount: 0,
escalationCount: 0,
deployState: '—',
nodes: [],
};
const freshness = opsData?.freshness ?? {
generatedAt: new Date().toISOString(),
activityLatestAt: null,
sistersLatestAt: null,
qaDocLatestAt: null,
};
if (loading) {
return <LoadingOverlay> ...</LoadingOverlay>;
}
return (
<Shell>
<PageHeader>
<PageTitle>🏢 </PageTitle>
<PageMeta>4 · {SUBAGENT_COUNT} · </PageMeta>
<FreshnessBar>
<FreshnessBadge $type={sisterDataMode}>
: {sisterDataMode === 'live' ? 'live · ws' : sisterDataMode === 'snapshot' ? 'snapshot · poll' : 'fallback · doc'}
</FreshnessBadge>
<FreshnessBadge $type="fallback">
서브에이전트: fallback
</FreshnessBadge>
<FreshnessBadge $type="snapshot">
pipeline: snapshot
</FreshnessBadge>
</FreshnessBar>
</PageHeader>
<MainArea>
<SceneColumn>
<OfficeScene
sisters={sisterNodes}
selected={selected}
onSelectSister={handleSelectSister}
onSelectSubagent={handleSelectSubagent}
dataMode={sisterDataMode}
/>
{chatSister && (
<ChatArea>
<ChatWorkspace
initialSister={chatSister}
onClose={handleCloseChat}
/>
</ChatArea>
)}
</SceneColumn>
<ContextPanel
selected={selected}
sisters={sisterNodes}
onOpenChat={handleOpenChat}
onClear={handleClearSelection}
/>
</MainArea>
<BottomPanels>
<PipelinePanel
activeTask={pipeline.activeTask}
focus={pipeline.focus}
reviewLoopCount={pipeline.reviewLoopCount}
escalationCount={pipeline.escalationCount}
deployState={pipeline.deployState}
nodes={pipeline.nodes}
freshness={`generated ${formatGeneratedAt(freshness.generatedAt)}`}
/>
<ServerHealthPanel
servers={serverEntries}
dataMode={sisterDataMode}
generatedAt={freshness.generatedAt}
/>
</BottomPanels>
</Shell>
);
}

View File

@@ -79,6 +79,12 @@ interface DashboardOpsData {
nodes: PipelineNode[]; nodes: PipelineNode[];
}; };
board: BoardItem[]; board: BoardItem[];
freshness: {
generatedAt: string;
activityLatestAt: string | null;
sistersLatestAt: string | null;
qaDocLatestAt: string | null;
};
} }
const pulse = keyframes`0%{opacity:.35}50%{opacity:.7}100%{opacity:.35}`; const pulse = keyframes`0%{opacity:.35}50%{opacity:.7}100%{opacity:.35}`;
@@ -724,6 +730,18 @@ function formatTime(iso?: string | null): string {
return date.toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit', hour12: false }); return date.toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit', hour12: false });
} }
function formatSyncLabel(iso?: string | null): string {
if (!iso) return 'NO SYNC';
const diff = Date.now() - new Date(iso).getTime();
if (!Number.isFinite(diff) || diff < 0) return 'SYNC UNKNOWN';
const sec = Math.floor(diff / 1000);
if (sec < 60) return `SYNC ${sec}s AGO`;
const min = Math.floor(sec / 60);
if (min < 60) return `SYNC ${min}m AGO`;
const hr = Math.floor(min / 60);
return `SYNC ${hr}h AGO`;
}
function normalizePercent(value?: number | null): number { function normalizePercent(value?: number | null): number {
if (typeof value !== 'number' || Number.isNaN(value)) return 0; if (typeof value !== 'number' || Number.isNaN(value)) return 0;
return Math.max(0, Math.min(100, value)); return Math.max(0, Math.min(100, value));
@@ -749,10 +767,10 @@ function buildSisterSummary(sister: SisterItem, activityItems: ActivityItem[], p
if (latestActivity?.detail) return latestActivity.detail; if (latestActivity?.detail) return latestActivity.detail;
const ownerProject = projects.find((project) => project.ownerSister === sister.name && project.phase !== 'DEPLOYED'); const ownerProject = projects.find((project) => project.ownerSister === sister.name && project.phase !== 'DEPLOYED');
if (ownerProject) return `${ownerProject.name} · ${ownerProject.phase}`; if (ownerProject) return `${ownerProject.name} · ${ownerProject.phase}`;
if (sister.status === 'offline') return '최근 런타임 응답 없음'; if (sister.status === 'offline') return 'RUNTIME OFFLINE';
if (sister.status === 'working') return 'active pipeline 처리 중'; if (sister.status === 'working') return 'ACTIVE SNAPSHOT';
if (sister.status === 'online') return '새 handoff 대기 중'; if (sister.status === 'online') return 'RUNTIME READY';
return '운영 상태 확인 중'; return 'SNAPSHOT ONLY';
} }
function actionTone(action?: string, detail?: string | null): 'default' | 'warn' | 'ok' | 'active' { function actionTone(action?: string, detail?: string | null): 'default' | 'warn' | 'ok' | 'active' {
@@ -837,6 +855,12 @@ export default function DashboardPage() {
}, []); }, []);
const derived = useMemo(() => { const derived = useMemo(() => {
const freshness = opsData?.freshness ?? {
generatedAt: null,
activityLatestAt: null,
sistersLatestAt: null,
qaDocLatestAt: null,
};
const onlineCount = sisters.filter((item) => item.status === 'online' || item.status === 'working').length; const onlineCount = sisters.filter((item) => item.status === 'online' || item.status === 'working').length;
const offlineCount = sisters.filter((item) => item.status === 'offline').length; const offlineCount = sisters.filter((item) => item.status === 'offline').length;
const activeProject = opsData?.focusProject const activeProject = opsData?.focusProject
@@ -878,24 +902,24 @@ export default function DashboardPage() {
const infraCards = [ const infraCards = [
{ {
title: 'Gateway / Runtime', title: 'Runtime',
meta: connected ? 'Socket live · runtime heartbeat 수신 중' : 'Polling mode · websocket 연결 재시도 중', meta: connected ? 'SOCKET / EVENT MIRRORED' : 'POLLING SNAPSHOT',
detail: `${onlineCount}/${Math.max(sisters.length, 4)} sisters active`, detail: `${onlineCount}/${Math.max(sisters.length, 4)} ACTIVE · ${formatSyncLabel(freshness.sistersLatestAt)}`,
}, },
{ {
title: 'Project Surface', title: 'Projects',
meta: `${projects.length} projects tracked · ${totalSprints} sprints indexed`, meta: `SNAPSHOT · ${projects.length} PROJECTS`,
detail: readyDeploy > 0 ? `${readyDeploy} ready for deploy` : 'deploy-ready backlog 없음', detail: readyDeploy > 0 ? `${readyDeploy} READY FOR DEPLOY` : 'NO DEPLOY QUEUE',
}, },
{ {
title: 'Review Loop', title: 'QA',
meta: `${reviewProjects} QA queue · first-pass ${firstPassRate}%`, meta: `DOC-DERIVED · ${firstPassRate}%`,
detail: escalationCount > 0 ? `blocker project ${escalationCount}` : 'escalation 없음', detail: escalationCount > 0 ? `${escalationCount} BLOCKER PROJECT` : 'NO BLOCKER',
}, },
{ {
title: 'Activity Feed', title: 'Events',
meta: `${activityItems.length} recent events mirrored`, meta: `EVENTS ${activityItems.length}`,
detail: activityItems[0]?.detail ?? activityItems[0]?.action ?? '최근 이벤트 없음', detail: formatSyncLabel(freshness.activityLatestAt),
}, },
]; ];
@@ -916,8 +940,9 @@ export default function DashboardPage() {
pipelineNodes, pipelineNodes,
infraCards, infraCards,
board: opsData?.board ?? [], board: opsData?.board ?? [],
activeTask: opsData?.pipeline.activeTask ?? (activeProject ? `${activeProject.name} · ${activeProject.currentSprint ?? activeProject.phase}` : 'No active pipeline'), activeTask: opsData?.pipeline.activeTask ?? (activeProject ? `${activeProject.name} · ${activeProject.currentSprint ?? activeProject.phase}` : 'NO ACTIVE PIPELINE'),
deployState: opsData?.pipeline.deployState ?? (activeProject?.deployStatus ?? 'standby'), deployState: opsData?.pipeline.deployState ?? (activeProject?.deployStatus ?? 'STANDBY'),
freshness,
}; };
}, [activityItems, connected, opsData, projects, sisters]); }, [activityItems, connected, opsData, projects, sisters]);
@@ -928,24 +953,22 @@ export default function DashboardPage() {
<TopBar> <TopBar>
<TopBlock> <TopBlock>
<div> <div>
<Eyebrow>Hanarang / master dashboard v3</Eyebrow> <Eyebrow>Master dashboard</Eyebrow>
<Headline> , .</Headline> <Headline>MASTER PIPELINE BOARD</Headline>
</div> </div>
<Summary> <Summary>RUNTIME / EVENTS / DOCS</Summary>
4 , active pipeline, activity, metrics, infra, . handoff .
</Summary>
<InlineStats> <InlineStats>
<Chip $tone={connected ? 'active' : 'muted'}>{connected ? 'socket live' : 'polling mode'}</Chip> <Chip $tone={connected ? 'active' : 'muted'}>{connected ? 'socket on' : 'socket off'}</Chip>
<Chip $tone="default">projects {String(projects.length).padStart(2, '0')}</Chip> <Chip $tone="default">snapshot {formatSyncLabel(derived.freshness.generatedAt)}</Chip>
<Chip $tone={derived.reviewProjects > 0 ? 'warning' : 'default'}>qa queue {String(derived.reviewProjects).padStart(2, '0')}</Chip> <Chip $tone={derived.reviewProjects > 0 ? 'warning' : 'default'}>qa {String(derived.reviewProjects).padStart(2, '0')}</Chip>
<Chip $tone={derived.readyDeploy > 0 ? 'active' : 'muted'}>ready deploy {String(derived.readyDeploy).padStart(2, '0')}</Chip> <Chip $tone={derived.readyDeploy > 0 ? 'active' : 'muted'}>deploy {String(derived.readyDeploy).padStart(2, '0')}</Chip>
</InlineStats> </InlineStats>
</TopBlock> </TopBlock>
<FocusPanel> <FocusPanel>
<div> <div>
<Eyebrow>Current operating focus</Eyebrow> <Eyebrow>Current focus</Eyebrow>
<FocusTitle>{derived.activeProject?.name ?? 'No active sprint'}</FocusTitle> <FocusTitle>{derived.activeProject?.name ?? 'NO ACTIVE SPRINT'}</FocusTitle>
</div> </div>
<FocusBody>{derived.focusSummary}</FocusBody> <FocusBody>{derived.focusSummary}</FocusBody>
<TechBar> <TechBar>
@@ -954,11 +977,11 @@ export default function DashboardPage() {
<FocusMetaGrid> <FocusMetaGrid>
<MetaCard> <MetaCard>
<MetaLabel>current sprint</MetaLabel> <MetaLabel>current sprint</MetaLabel>
<MetaValue>{derived.activeProject?.currentSprint ?? 'backlog watch'}</MetaValue> <MetaValue>{derived.activeProject?.currentSprint ?? 'SNAPSHOT'}</MetaValue>
</MetaCard> </MetaCard>
<MetaCard> <MetaCard>
<MetaLabel>phase</MetaLabel> <MetaLabel>phase</MetaLabel>
<MetaValue>{derived.activeProject?.phase ?? 'monitoring'}</MetaValue> <MetaValue>{derived.activeProject?.phase ?? 'SNAPSHOT'}</MetaValue>
</MetaCard> </MetaCard>
<MetaCard> <MetaCard>
<MetaLabel>sprint progress</MetaLabel> <MetaLabel>sprint progress</MetaLabel>
@@ -966,7 +989,7 @@ export default function DashboardPage() {
</MetaCard> </MetaCard>
<MetaCard> <MetaCard>
<MetaLabel>deploy state</MetaLabel> <MetaLabel>deploy state</MetaLabel>
<MetaValue>{derived.activeProject?.deployStatus ?? 'no deploy signal'}</MetaValue> <MetaValue>{derived.activeProject?.deployStatus ?? 'NO SIGNAL'}</MetaValue>
</MetaCard> </MetaCard>
</FocusMetaGrid> </FocusMetaGrid>
</FocusPanel> </FocusPanel>
@@ -976,11 +999,11 @@ export default function DashboardPage() {
<div style={{ display: 'flex', alignItems: 'center', gap: 10, minWidth: 0 }}> <div style={{ display: 'flex', alignItems: 'center', gap: 10, minWidth: 0 }}>
<ConnectionDot $connected={connected} /> <ConnectionDot $connected={connected} />
<div> <div>
<Eyebrow>Runtime link</Eyebrow> <Eyebrow>Event stream</Eyebrow>
<div style={{ fontSize: 14, color: 'var(--text-primary)', marginTop: 4 }}>{connected ? 'Discord / runtime connected' : 'Polling fallback active'}</div> <div style={{ fontSize: 14, color: 'var(--text-primary)', marginTop: 4 }}>{connected ? 'SOCKET ON / EVENT MIRRORED' : 'SOCKET OFF / POLLING'}</div>
</div> </div>
</div> </div>
<LabelMeta><span>LIVE:</span>{connected ? 'ON' : 'OFF'}</LabelMeta> <LabelMeta><span>SYNC:</span>{formatSyncLabel(derived.freshness.activityLatestAt)}</LabelMeta>
</ConnectionCard> </ConnectionCard>
<OperatorRow> <OperatorRow>
@@ -988,7 +1011,7 @@ export default function DashboardPage() {
<OperatorText> <OperatorText>
<OperatorName>{SISTER_META[derived.activeProject?.ownerSister ?? 'narang']?.label ?? '나랑이'}</OperatorName> <OperatorName>{SISTER_META[derived.activeProject?.ownerSister ?? 'narang']?.label ?? '나랑이'}</OperatorName>
<OperatorMeta> <OperatorMeta>
{SISTER_META[derived.activeProject?.ownerSister ?? 'narang']?.role ?? 'Implementation'}. handoff와 phase를 . {SISTER_META[derived.activeProject?.ownerSister ?? 'narang']?.role ?? 'Implementation'} / SNAPSHOT OWNER
</OperatorMeta> </OperatorMeta>
</OperatorText> </OperatorText>
</OperatorRow> </OperatorRow>
@@ -1018,7 +1041,7 @@ export default function DashboardPage() {
{loading {loading
? Array.from({ length: 4 }).map((_, index) => <SkeletonCard key={index} />) ? Array.from({ length: 4 }).map((_, index) => <SkeletonCard key={index} />)
: sisters.length === 0 : sisters.length === 0
? <EmptyState> .</EmptyState> ? <EmptyState>NO RUNTIME DATA.</EmptyState>
: sisters.map((sister) => { : sisters.map((sister) => {
const sisterMeta = SISTER_META[sister.name] ?? { label: sister.name, role: sister.role ?? 'unknown', accent: '#888888' }; const sisterMeta = SISTER_META[sister.name] ?? { label: sister.name, role: sister.role ?? 'unknown', accent: '#888888' };
return ( return (
@@ -1080,8 +1103,8 @@ export default function DashboardPage() {
<PanelHeader> <PanelHeader>
<PanelTitleBlock> <PanelTitleBlock>
<Eyebrow>Activity feed</Eyebrow> <Eyebrow>Activity feed</Eyebrow>
<PanelTitle> handoff / review / deploy </PanelTitle> <PanelTitle>EVENT MIRROR</PanelTitle>
<PanelDesc> , , .</PanelDesc> <PanelDesc>WEBSOCKET + POLLING SNAPSHOT</PanelDesc>
</PanelTitleBlock> </PanelTitleBlock>
<LabelMeta><span>EVENT:</span>{String(activityItems.length).padStart(2, '0')}</LabelMeta> <LabelMeta><span>EVENT:</span>{String(activityItems.length).padStart(2, '0')}</LabelMeta>
</PanelHeader> </PanelHeader>
@@ -1089,7 +1112,7 @@ export default function DashboardPage() {
{loading ? ( {loading ? (
<SkeletonCard /> <SkeletonCard />
) : activityItems.length === 0 ? ( ) : activityItems.length === 0 ? (
<EmptyState>No recent activity.</EmptyState> <EmptyState>NO RECENT EVENT.</EmptyState>
) : ( ) : (
<ActivityList> <ActivityList>
{activityItems.slice(0, 6).map((item) => ( {activityItems.slice(0, 6).map((item) => (
@@ -1117,8 +1140,8 @@ export default function DashboardPage() {
<PanelHeader> <PanelHeader>
<PanelTitleBlock> <PanelTitleBlock>
<Eyebrow>Sprint metrics</Eyebrow> <Eyebrow>Sprint metrics</Eyebrow>
<PanelTitle> </PanelTitle> <PanelTitle>SPRINT METRICS</PanelTitle>
<PanelDesc>fake /QA/activity에서 .</PanelDesc> <PanelDesc>POLLING SNAPSHOT</PanelDesc>
</PanelTitleBlock> </PanelTitleBlock>
<LabelMeta><span>SPRINT:</span>{String(derived.totalSprints).padStart(2, '0')}</LabelMeta> <LabelMeta><span>SPRINT:</span>{String(derived.totalSprints).padStart(2, '0')}</LabelMeta>
</PanelHeader> </PanelHeader>
@@ -1127,22 +1150,22 @@ export default function DashboardPage() {
<MetricCard> <MetricCard>
<MetaLabel>total tasks view</MetaLabel> <MetaLabel>total tasks view</MetaLabel>
<MetricValue>{derived.totalSprints}</MetricValue> <MetricValue>{derived.totalSprints}</MetricValue>
<MetricHelp> sprint .</MetricHelp> <MetricHelp>INDEXED SPRINT COUNT</MetricHelp>
</MetricCard> </MetricCard>
<MetricCard> <MetricCard>
<MetaLabel>done sprint</MetaLabel> <MetaLabel>done sprint</MetaLabel>
<MetricValue>{derived.doneSprints}</MetricValue> <MetricValue>{derived.doneSprints}</MetricValue>
<MetricHelp> sprint .</MetricHelp> <MetricHelp>DONE SPRINTS</MetricHelp>
</MetricCard> </MetricCard>
<MetricCard> <MetricCard>
<MetaLabel>first-pass rate</MetaLabel> <MetaLabel>first-pass rate</MetaLabel>
<MetricValue>{derived.firstPassRate}%</MetricValue> <MetricValue>{derived.firstPassRate}%</MetricValue>
<MetricHelp> QA blocker .</MetricHelp> <MetricHelp>QA DOC DERIVED</MetricHelp>
</MetricCard> </MetricCard>
<MetricCard> <MetricCard>
<MetaLabel>escalations</MetaLabel> <MetaLabel>escalations</MetaLabel>
<MetricValue>{derived.escalationCount}</MetricValue> <MetricValue>{derived.escalationCount}</MetricValue>
<MetricHelp>blocker escalation .</MetricHelp> <MetricHelp>BLOCKER PROJECTS</MetricHelp>
</MetricCard> </MetricCard>
</MetricsGrid> </MetricsGrid>
@@ -1163,8 +1186,8 @@ export default function DashboardPage() {
<PanelHeader> <PanelHeader>
<PanelTitleBlock> <PanelTitleBlock>
<Eyebrow>Infrastructure overview</Eyebrow> <Eyebrow>Infrastructure overview</Eyebrow>
<PanelTitle>gateway / sisters / deploy surface</PanelTitle> <PanelTitle>RUNTIME SURFACE</PanelTitle>
<PanelDesc> .</PanelDesc> <PanelDesc>LIVE / SNAPSHOT / DOC-DERIVED</PanelDesc>
</PanelTitleBlock> </PanelTitleBlock>
<LabelMeta><span>NODE:</span>{String(sisters.length).padStart(2, '0')}</LabelMeta> <LabelMeta><span>NODE:</span>{String(sisters.length).padStart(2, '0')}</LabelMeta>
</PanelHeader> </PanelHeader>
@@ -1174,7 +1197,7 @@ export default function DashboardPage() {
<InfraCard key={card.title}> <InfraCard key={card.title}>
<InfraTitle>{card.title}</InfraTitle> <InfraTitle>{card.title}</InfraTitle>
<InfraMeta>{card.meta}</InfraMeta> <InfraMeta>{card.meta}</InfraMeta>
<EventTag $tone={card.title === 'Gateway / Runtime' && connected ? 'ok' : card.detail.includes('없음') ? 'default' : 'active'}>{card.detail}</EventTag> <EventTag $tone={card.title === 'Runtime' && connected ? 'ok' : card.detail.startsWith('NO ') ? 'default' : 'active'}>{card.detail}</EventTag>
</InfraCard> </InfraCard>
))} ))}
</InfraMap> </InfraMap>
@@ -1184,14 +1207,14 @@ export default function DashboardPage() {
<PanelHeader> <PanelHeader>
<PanelTitleBlock> <PanelTitleBlock>
<Eyebrow>Mistake log & harness</Eyebrow> <Eyebrow>Mistake log & harness</Eyebrow>
<PanelTitle> </PanelTitle> <PanelTitle>RULE / LOG BOARD</PanelTitle>
<PanelDesc> QA harness .</PanelDesc> <PanelDesc>DOC-DERIVED / ACTIVITY</PanelDesc>
</PanelTitleBlock> </PanelTitleBlock>
<LabelMeta><span>RULE:</span>{String(derived.board.length).padStart(2, '0')}</LabelMeta> <LabelMeta><span>RULE:</span>{String(derived.board.length).padStart(2, '0')}</LabelMeta>
</PanelHeader> </PanelHeader>
{derived.board.length === 0 ? ( {derived.board.length === 0 ? (
<EmptyState> QA / harness .</EmptyState> <EmptyState>NO RULE LOG.</EmptyState>
) : ( ) : (
<LessonList> <LessonList>
{derived.board.map((item) => ( {derived.board.map((item) => (
@@ -1203,7 +1226,11 @@ export default function DashboardPage() {
<EventTag>{formatRelativeTime(item.time)}</EventTag> <EventTag>{formatRelativeTime(item.time)}</EventTag>
</LessonMeta> </LessonMeta>
<LessonBody>{item.body}</LessonBody> <LessonBody>{item.body}</LessonBody>
<LessonBody>Source · {item.source}</LessonBody> <LessonMeta>
<EventTag>SRC</EventTag>
<EventTag>{item.source}</EventTag>
<EventTag>{formatTime(item.time)}</EventTag>
</LessonMeta>
</LessonCard> </LessonCard>
))} ))}
</LessonList> </LessonList>

View File

@@ -8,6 +8,7 @@ import { useAuth } from '@/lib/AuthContext';
const NAV_ITEMS = [ const NAV_ITEMS = [
{ href: '/', label: '대시' }, { href: '/', label: '대시' },
{ href: '/office', label: '오피스' },
{ href: '/projects', label: '프로' }, { href: '/projects', label: '프로' },
{ href: '/activities', label: '활동' }, { href: '/activities', label: '활동' },
{ href: '/sisters', label: '자매' }, { href: '/sisters', label: '자매' },

View File

@@ -64,6 +64,7 @@ const Summary = styled.p`
color: var(--text-secondary); color: var(--text-secondary);
line-height: 1.6; line-height: 1.6;
max-width: 780px; max-width: 780px;
text-transform: uppercase;
`; `;
const HeaderStats = styled.div` const HeaderStats = styled.div`
@@ -248,7 +249,7 @@ export default function ActivePipeline({
<PipelineCard> <PipelineCard>
<Header> <Header>
<div> <div>
<Eyebrow>Master flow / active pipeline</Eyebrow> <Eyebrow>Active pipeline / snapshot</Eyebrow>
<Title>{activeTask}</Title> <Title>{activeTask}</Title>
<Summary>{focus}</Summary> <Summary>{focus}</Summary>
</div> </div>
@@ -282,7 +283,7 @@ export default function ActivePipeline({
<StateBadge $state={node.state}>{stateText[node.state]}</StateBadge> <StateBadge $state={node.state}>{stateText[node.state]}</StateBadge>
</NodeTop> </NodeTop>
<NodeDetail>{node.detail}</NodeDetail> <NodeDetail>{node.detail}</NodeDetail>
<NodeHint>stage {String(index + 1).padStart(2, '0')}</NodeHint> <NodeHint>snapshot {String(index + 1).padStart(2, '0')}</NodeHint>
</NodeCard> </NodeCard>
{index < nodes.length - 1 && <Connector $active={connectorActive} />} {index < nodes.length - 1 && <Connector $active={connectorActive} />}
</NodeWrap> </NodeWrap>

View File

@@ -0,0 +1,605 @@
'use client';
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
import styled, { keyframes } from 'styled-components';
import type { SisterName } from './OfficeScene';
// ─── Types ───────────────────────────────────────────────────────────────────
interface ChatMessage {
id: string;
role: 'user' | 'assistant' | 'tool';
content: string;
toolName?: string;
ts: string;
}
interface ChatWorkspaceProps {
initialSister: SisterName;
onClose: () => void;
}
// ─── Static data ──────────────────────────────────────────────────────────────
const SISTER_DISPLAY: Record<SisterName, string> = {
harang: '하랑이',
narang: '나랑이',
darang: '다랑이',
erang: '이랑이',
};
const SISTER_EMOJIS: Record<SisterName, string> = {
harang: '🦊',
narang: '🦊',
darang: '🐱',
erang: '🐺',
};
const SISTER_ROLES: Record<SisterName, string> = {
harang: 'Planning & Orchestration',
narang: 'Development & Implementation',
darang: 'QA & Review',
erang: 'Infra & Deploy',
};
const SISTER_ORDER: SisterName[] = ['harang', 'narang', 'darang', 'erang'];
// ─── Animations ──────────────────────────────────────────────────────────────
const fadeIn = keyframes`
from { opacity: 0; transform: translateY(4px); }
to { opacity: 1; transform: translateY(0); }
`;
// ─── Styled Components ────────────────────────────────────────────────────────
const Workspace = styled.div`
display: flex;
height: 100%;
border: 1px solid var(--border-color);
background: var(--bg-surface);
overflow: hidden;
@media (max-width: 767px) {
flex-direction: column;
}
`;
// Left sidebar - sister tabs
const SisterTabs = styled.nav`
width: 200px;
flex-shrink: 0;
border-right: 1px solid var(--border-color);
display: flex;
flex-direction: column;
padding: var(--space-md) 0;
@media (max-width: 767px) {
width: 100%;
flex-direction: row;
padding: 0;
overflow-x: auto;
border-right: none;
border-bottom: 1px solid var(--border-color);
}
`;
const SisterTabHeader = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
padding: 0 var(--space-md) var(--space-md);
@media (max-width: 767px) {
display: none;
}
`;
const SisterTab = styled.button<{ $active: boolean }>`
display: flex;
align-items: center;
gap: var(--space-sm);
padding: var(--space-sm) var(--space-md);
background: ${({ $active }) => ($active ? 'rgba(255,255,255,0.04)' : 'transparent')};
border: none;
border-left: 2px solid ${({ $active }) => ($active ? 'var(--text-primary)' : 'transparent')};
color: ${({ $active }) => ($active ? 'var(--text-primary)' : 'var(--text-secondary)')};
cursor: pointer;
text-align: left;
width: 100%;
transition: all 0.15s;
font-family: inherit;
&:hover {
color: var(--text-primary);
background: rgba(255,255,255,0.03);
}
@media (max-width: 767px) {
border-left: none;
border-bottom: 2px solid ${({ $active }) => ($active ? 'var(--text-primary)' : 'transparent')};
white-space: nowrap;
flex-shrink: 0;
}
`;
const TabEmoji = styled.span`
font-size: 16px;
line-height: 1;
`;
const TabMeta = styled.div`
display: flex;
flex-direction: column;
gap: 2px;
`;
const TabName = styled.div`
font-size: 13px;
font-weight: 600;
`;
const TabRole = styled.div`
font-size: 10px;
color: var(--text-secondary);
@media (max-width: 767px) {
display: none;
}
`;
// Center - message timeline
const MessageArea = styled.div`
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
`;
const MessageHeader = styled.div`
padding: var(--space-md) var(--space-lg);
border-bottom: 1px solid var(--border-color);
display: flex;
align-items: center;
gap: var(--space-md);
flex-shrink: 0;
`;
const HeaderEmoji = styled.span`
font-size: 20px;
`;
const HeaderMeta = styled.div`
flex: 1;
`;
const HeaderName = styled.div`
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
`;
const HeaderRole = styled.div`
font-size: 11px;
color: var(--text-secondary);
`;
const HeaderBadge = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
border: 1px solid var(--border-color);
padding: 2px var(--space-sm);
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const Timeline = styled.div`
flex: 1;
overflow-y: auto;
padding: var(--space-lg);
display: flex;
flex-direction: column;
gap: var(--space-md);
`;
const MessageBubble = styled.div<{ $role: ChatMessage['role'] }>`
display: flex;
flex-direction: column;
gap: 4px;
align-items: ${({ $role }) => $role === 'user' ? 'flex-end' : 'flex-start'};
animation: ${fadeIn} 0.2s ease;
`;
const BubbleContent = styled.div<{ $role: ChatMessage['role'] }>`
max-width: 75%;
padding: var(--space-sm) var(--space-md);
font-size: 13px;
line-height: 1.6;
color: var(--text-primary);
background: ${({ $role }) =>
$role === 'user'
? 'rgba(255,255,255,0.06)'
: $role === 'tool'
? 'rgba(255, 152, 0, 0.06)'
: 'rgba(255,255,255,0.02)'};
border: 1px solid ${({ $role }) =>
$role === 'user'
? 'rgba(255,255,255,0.12)'
: $role === 'tool'
? 'rgba(255,152,0,0.2)'
: 'rgba(255,255,255,0.06)'};
font-family: ${({ $role }) => $role === 'tool' ? 'var(--font-mono)' : 'inherit'};
`;
const BubbleMeta = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
opacity: 0.6;
`;
const ToolCallBadge = styled.div`
display: flex;
align-items: center;
gap: 4px;
font-family: var(--font-mono);
font-size: 10px;
color: #FF9800;
margin-bottom: 2px;
`;
const EmptyTimeline = styled.div`
flex: 1;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
gap: var(--space-md);
color: var(--text-secondary);
font-size: 13px;
text-align: center;
`;
const GatewayNotice = styled.div`
border: 1px solid var(--border-color);
padding: var(--space-md);
font-family: var(--font-mono);
font-size: 11px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.06em;
line-height: 1.7;
max-width: 280px;
text-align: center;
`;
// Input area
const InputArea = styled.div`
padding: var(--space-md) var(--space-lg);
border-top: 1px solid var(--border-color);
display: flex;
gap: var(--space-sm);
align-items: flex-end;
flex-shrink: 0;
`;
const MessageInput = styled.textarea`
flex: 1;
background: var(--bg-input, #1a1a1a);
border: 1px solid var(--border-color);
color: var(--text-primary);
font-family: inherit;
font-size: 13px;
padding: var(--space-sm) var(--space-md);
resize: none;
min-height: 40px;
max-height: 120px;
line-height: 1.5;
transition: border-color 0.15s;
&:focus {
outline: none;
border-color: var(--border-hover);
}
&::placeholder {
color: var(--text-secondary);
opacity: 0.5;
}
`;
const SendBtn = styled.button`
border: 1px solid var(--border-color);
background: transparent;
color: var(--text-secondary);
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: var(--space-sm) var(--space-md);
cursor: pointer;
font-family: var(--font-mono);
transition: all 0.15s;
white-space: nowrap;
align-self: flex-end;
&:hover:not(:disabled) {
border-color: var(--border-hover);
color: var(--text-primary);
}
&:disabled {
opacity: 0.3;
cursor: not-allowed;
}
`;
const InputMeta = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
opacity: 0.5;
text-transform: uppercase;
letter-spacing: 0.06em;
text-align: center;
`;
// Right - sister context
const SisterContext = styled.aside`
width: 220px;
flex-shrink: 0;
border-left: 1px solid var(--border-color);
padding: var(--space-lg);
display: flex;
flex-direction: column;
gap: var(--space-lg);
overflow-y: auto;
@media (max-width: 1199px) {
display: none;
}
`;
const ContextSection = styled.div`
display: flex;
flex-direction: column;
gap: var(--space-sm);
`;
const CtxLabel = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
border-bottom: 1px solid var(--border-color);
padding-bottom: 4px;
`;
const CtxValue = styled.div`
font-size: 12px;
color: var(--text-primary);
line-height: 1.5;
`;
const CtxMono = styled.div`
font-family: var(--font-mono);
font-size: 11px;
color: var(--text-secondary);
`;
// Close button
const CloseBtn = styled.button`
border: 1px solid var(--border-color);
background: transparent;
color: var(--text-secondary);
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: var(--space-xs) var(--space-sm);
cursor: pointer;
font-family: var(--font-mono);
transition: all 0.15s;
&:hover {
border-color: var(--border-hover);
color: var(--text-primary);
}
`;
// ─── Helpers ──────────────────────────────────────────────────────────────────
function formatTs(ts: string): string {
const date = new Date(ts);
const diff = Date.now() - date.getTime();
const min = Math.floor(diff / 60000);
if (min < 1) return '방금';
if (min < 60) return `${min}분 전`;
const hr = Math.floor(min / 60);
if (hr < 24) return `${hr}시간 전`;
return `${Math.floor(hr / 24)}일 전`;
}
// ─── Component ────────────────────────────────────────────────────────────────
export default function ChatWorkspace({ initialSister, onClose }: ChatWorkspaceProps) {
const [activeSister, setActiveSister] = useState<SisterName>(initialSister);
// Per-sister message maps avoid setState-in-effect for clearing on switch
const [allMessages, setAllMessages] = useState<Partial<Record<SisterName, ChatMessage[]>>>({});
const [input, setInput] = useState('');
const timelineRef = useRef<HTMLDivElement>(null);
const messages = useMemo(() => allMessages[activeSister] ?? [], [allMessages, activeSister]);
const setMessages = useCallback(
(updater: (prev: ChatMessage[]) => ChatMessage[]) => {
setAllMessages((prev) => ({
...prev,
[activeSister]: updater(prev[activeSister] ?? []),
}));
},
[activeSister],
);
// Scroll to bottom on new messages
useEffect(() => {
if (timelineRef.current) {
timelineRef.current.scrollTop = timelineRef.current.scrollHeight;
}
}, [messages]);
// Mock send — in production this would go via OpenClaw Gateway
const handleSend = useCallback(() => {
const text = input.trim();
if (!text) return;
const userMsg: ChatMessage = {
id: `msg-${Date.now()}`,
role: 'user',
content: text,
ts: new Date().toISOString(),
};
setMessages((prev) => [...prev, userMsg]);
setInput('');
// Gateway connection pending — show system notice
setTimeout(() => {
const sysMsg: ChatMessage = {
id: `msg-${Date.now() + 1}`,
role: 'assistant',
content: `[Gateway 연결 대기] ${SISTER_DISPLAY[activeSister]} OpenClaw Gateway가 아직 연결되지 않았습니다. 직접 채팅 기능은 Gateway WebSocket 연결 후 활성화됩니다.`,
ts: new Date().toISOString(),
};
setMessages((prev) => [...prev, sysMsg]);
}, 400);
}, [activeSister, input, setMessages]);
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
handleSend();
}
};
return (
<Workspace>
{/* Left: sister tabs */}
<SisterTabs>
<SisterTabHeader>direct chat</SisterTabHeader>
{SISTER_ORDER.map((name) => (
<SisterTab
key={name}
$active={activeSister === name}
onClick={() => setActiveSister(name)}
>
<TabEmoji>{SISTER_EMOJIS[name]}</TabEmoji>
<TabMeta>
<TabName>{SISTER_DISPLAY[name]}</TabName>
<TabRole>{SISTER_ROLES[name].split(' ')[0]}</TabRole>
</TabMeta>
</SisterTab>
))}
</SisterTabs>
{/* Center: message timeline */}
<MessageArea>
<MessageHeader>
<HeaderEmoji>{SISTER_EMOJIS[activeSister]}</HeaderEmoji>
<HeaderMeta>
<HeaderName>{SISTER_DISPLAY[activeSister]}</HeaderName>
<HeaderRole>{SISTER_ROLES[activeSister]}</HeaderRole>
</HeaderMeta>
<HeaderBadge>Gateway </HeaderBadge>
<CloseBtn onClick={onClose}> </CloseBtn>
</MessageHeader>
<Timeline ref={timelineRef}>
{messages.length === 0 ? (
<EmptyTimeline>
<div>{SISTER_EMOJIS[activeSister]}</div>
<div>{SISTER_DISPLAY[activeSister]} .</div>
<GatewayNotice>
openclaw gateway <br />
<br />
gateway
</GatewayNotice>
</EmptyTimeline>
) : (
messages.map((msg) => (
<MessageBubble key={msg.id} $role={msg.role}>
{msg.role === 'tool' && (
<ToolCallBadge>🔧 tool · {msg.toolName}</ToolCallBadge>
)}
<BubbleContent $role={msg.role}>{msg.content}</BubbleContent>
<BubbleMeta>{formatTs(msg.ts)}</BubbleMeta>
</MessageBubble>
))
)}
</Timeline>
<InputMeta>
shift+enter = · enter = · gateway: 연결
</InputMeta>
<InputArea>
<MessageInput
placeholder={`${SISTER_DISPLAY[activeSister]}에게 지시하세요...`}
value={input}
onChange={(e) => setInput(e.target.value)}
onKeyDown={handleKeyDown}
rows={1}
/>
<SendBtn onClick={handleSend} disabled={!input.trim()}>
</SendBtn>
</InputArea>
</MessageArea>
{/* Right: sister context */}
<SisterContext>
<ContextSection>
<CtxLabel>agent</CtxLabel>
<CtxValue>
{SISTER_EMOJIS[activeSister]} {SISTER_DISPLAY[activeSister]}
</CtxValue>
<CtxMono>{SISTER_ROLES[activeSister]}</CtxMono>
</ContextSection>
<ContextSection>
<CtxLabel> </CtxLabel>
<CtxValue>Gateway </CtxValue>
<CtxMono>openclaw websocket</CtxMono>
</ContextSection>
<ContextSection>
<CtxLabel>data source</CtxLabel>
<CtxMono>
live: ws (pending)<br />
fallback: ui-only
</CtxMono>
</ContextSection>
<ContextSection>
<CtxLabel></CtxLabel>
<CtxValue>
<a
href={`/sisters/${activeSister}`}
style={{
color: 'var(--text-secondary)',
textDecoration: 'none',
fontSize: '12px',
}}
>
</a>
</CtxValue>
</ContextSection>
</SisterContext>
</Workspace>
);
}

View File

@@ -0,0 +1,455 @@
'use client';
import React from 'react';
import styled from 'styled-components';
import Link from 'next/link';
import type { SisterNode, SubAgent, SisterName, AgentState, SelectedAgent } from './OfficeScene';
// ─── Types ───────────────────────────────────────────────────────────────────
interface ContextPanelProps {
selected: SelectedAgent | null;
sisters: SisterNode[];
onOpenChat: (sisterName: SisterName) => void;
onClear: () => void;
}
// ─── Styled Components ────────────────────────────────────────────────────────
const Panel = styled.aside`
width: 300px;
flex-shrink: 0;
border-left: 1px solid var(--border-color);
background: var(--bg-surface);
display: flex;
flex-direction: column;
overflow-y: auto;
@media (max-width: 1199px) {
width: 260px;
}
@media (max-width: 767px) {
width: 100%;
border-left: none;
border-top: 1px solid var(--border-color);
max-height: 220px;
}
`;
const PanelHeader = styled.div`
padding: var(--space-md) var(--space-lg);
border-bottom: 1px solid var(--border-color);
display: flex;
align-items: center;
justify-content: space-between;
flex-shrink: 0;
`;
const PanelTitle = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
`;
const ClearBtn = styled.button`
background: none;
border: none;
color: var(--text-secondary);
font-size: 12px;
cursor: pointer;
padding: 0;
line-height: 1;
&:hover {
color: var(--text-primary);
}
`;
const PanelBody = styled.div`
flex: 1;
overflow-y: auto;
padding: var(--space-lg);
display: flex;
flex-direction: column;
gap: var(--space-lg);
`;
const EmptyState = styled.div`
color: var(--text-secondary);
font-size: 13px;
line-height: 1.6;
text-align: center;
padding: var(--space-xl) 0;
`;
const AgentHeader = styled.div`
display: flex;
align-items: flex-start;
gap: var(--space-md);
`;
const AgentEmoji = styled.div`
font-size: 28px;
line-height: 1;
flex-shrink: 0;
`;
const AgentMeta = styled.div`
display: flex;
flex-direction: column;
gap: 4px;
`;
const AgentName = styled.div`
font-size: 16px;
font-weight: 600;
color: var(--text-primary);
`;
const AgentRole = styled.div`
font-size: 12px;
color: var(--text-secondary);
`;
const AgentType = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const StateRow = styled.div`
display: flex;
align-items: center;
gap: var(--space-sm);
`;
const StateDot = styled.span<{ $state: AgentState }>`
width: 8px;
height: 8px;
border-radius: 50%;
flex-shrink: 0;
background: ${({ $state }) => {
const colors: Record<AgentState, string> = {
idle: '#444',
thinking: '#2979FF',
tool_calling: '#FF9800',
speaking: '#00BFA5',
error: '#FF1744',
};
return colors[$state];
}};
`;
const StateLabel = styled.span<{ $state: AgentState }>`
font-family: var(--font-mono);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.06em;
color: ${({ $state }) => {
const colors: Record<AgentState, string> = {
idle: 'var(--text-secondary)',
thinking: '#2979FF',
tool_calling: '#FF9800',
speaking: '#00BFA5',
error: '#FF1744',
};
return colors[$state];
}};
`;
const Section = styled.div`
display: flex;
flex-direction: column;
gap: var(--space-sm);
`;
const SectionLabel = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
border-bottom: 1px solid var(--border-color);
padding-bottom: 4px;
`;
const SectionValue = styled.div`
font-size: 12px;
color: var(--text-primary);
line-height: 1.5;
`;
const CurrentTaskBox = styled.div`
font-size: 12px;
color: #58A6FF;
padding: var(--space-sm) var(--space-md);
background: rgba(88, 166, 255, 0.06);
border-left: 2px solid #58A6FF;
line-height: 1.5;
`;
const SubagentGrid = styled.div`
display: flex;
flex-direction: column;
gap: 4px;
`;
const SubagentRow = styled.div`
display: flex;
align-items: center;
gap: var(--space-sm);
font-size: 12px;
color: var(--text-primary);
`;
const SubDot = styled.span<{ $state: AgentState }>`
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
background: ${({ $state }) => {
const colors: Record<AgentState, string> = {
idle: '#444',
thinking: '#2979FF',
tool_calling: '#FF9800',
speaking: '#00BFA5',
error: '#FF1744',
};
return colors[$state];
}};
`;
const SubName = styled.span`
color: var(--text-secondary);
font-size: 11px;
font-family: var(--font-mono);
`;
const ActionRow = styled.div`
display: flex;
gap: var(--space-sm);
flex-wrap: wrap;
`;
const ActionBtn = styled.button`
border: 1px solid var(--border-color);
background: transparent;
color: var(--text-secondary);
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: var(--space-xs) var(--space-sm);
cursor: pointer;
font-family: var(--font-mono);
transition: all 0.15s;
&:hover {
border-color: var(--border-hover);
color: var(--text-primary);
}
`;
const ActionLink = styled(Link)`
border: 1px solid var(--border-color);
background: transparent;
color: var(--text-secondary);
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: var(--space-xs) var(--space-sm);
text-decoration: none;
font-family: var(--font-mono);
transition: all 0.15s;
display: inline-block;
&:hover {
border-color: var(--border-hover);
color: var(--text-primary);
}
`;
const FallbackNote = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
opacity: 0.5;
text-transform: uppercase;
letter-spacing: 0.06em;
`;
// ─── Sister display data ──────────────────────────────────────────────────────
const SISTER_EMOJIS: Record<SisterName, string> = {
harang: '🦊',
narang: '🦊',
darang: '🐱',
erang: '🐺',
};
const SISTER_DISPLAY: Record<SisterName, string> = {
harang: '하랑이',
narang: '나랑이',
darang: '다랑이',
erang: '이랑이',
};
// ─── Component ────────────────────────────────────────────────────────────────
function SisterDetail({
sister,
onOpenChat,
}: {
sister: SisterNode;
onOpenChat: (name: SisterName) => void;
}) {
return (
<>
<AgentHeader>
<AgentEmoji>{SISTER_EMOJIS[sister.name]}</AgentEmoji>
<AgentMeta>
<AgentName>{SISTER_DISPLAY[sister.name]}</AgentName>
<AgentRole>{sister.role}</AgentRole>
<AgentType>main agent</AgentType>
</AgentMeta>
</AgentHeader>
<StateRow>
<StateDot $state={sister.state} />
<StateLabel $state={sister.state}>{sister.state}</StateLabel>
</StateRow>
{sister.currentTask && (
<Section>
<SectionLabel>current task</SectionLabel>
<CurrentTaskBox>{sister.currentTask}</CurrentTaskBox>
</Section>
)}
<Section>
<SectionLabel>subagents ({sister.subagents.length})</SectionLabel>
<SubagentGrid>
{sister.subagents.map((sub) => (
<SubagentRow key={sub.id}>
<SubDot $state={sub.state} />
<span>{sub.label}</span>
<SubName>· {sub.state}</SubName>
</SubagentRow>
))}
</SubagentGrid>
<FallbackNote>subagent state: fallback</FallbackNote>
</Section>
<ActionRow>
<ActionBtn onClick={() => onOpenChat(sister.name)}>
</ActionBtn>
<ActionLink href={`/sisters/${sister.name}`}>
</ActionLink>
</ActionRow>
</>
);
}
function SubagentDetail({
sub,
sister,
onOpenChat,
}: {
sub: SubAgent;
sister: SisterNode;
onOpenChat: (name: SisterName) => void;
}) {
return (
<>
<AgentHeader>
<AgentEmoji>🤖</AgentEmoji>
<AgentMeta>
<AgentName>{sub.label}</AgentName>
<AgentRole>{sub.name}</AgentRole>
<AgentType>subagent · {SISTER_DISPLAY[sister.name]} </AgentType>
</AgentMeta>
</AgentHeader>
<StateRow>
<StateDot $state={sub.state} />
<StateLabel $state={sub.state}>{sub.state}</StateLabel>
</StateRow>
<Section>
<SectionLabel>parent</SectionLabel>
<SectionValue>
{SISTER_EMOJIS[sister.name]} {SISTER_DISPLAY[sister.name]} · {sister.role}
</SectionValue>
</Section>
<FallbackNote>subagent state: fallback · no direct api</FallbackNote>
<ActionRow>
<ActionBtn onClick={() => onOpenChat(sister.name)}>
{SISTER_DISPLAY[sister.name]}
</ActionBtn>
<ActionLink href={`/sisters/${sister.name}`}>
</ActionLink>
</ActionRow>
</>
);
}
export default function ContextPanel({
selected,
sisters,
onOpenChat,
onClear,
}: ContextPanelProps) {
const getSister = (name: SisterName) => sisters.find((s) => s.name === name);
let content: React.ReactNode = (
<EmptyState>
<br />
.
</EmptyState>
);
if (selected?.type === 'sister') {
const sisterData = getSister(selected.name);
if (sisterData) {
content = (
<SisterDetail
sister={sisterData}
onOpenChat={onOpenChat}
/>
);
}
} else if (selected?.type === 'subagent') {
const sisterData = getSister(selected.sister);
const subData = sisterData?.subagents.find((s) => s.id === selected.id);
if (sisterData && subData) {
content = (
<SubagentDetail
sub={subData}
sister={sisterData}
onOpenChat={onOpenChat}
/>
);
}
}
return (
<Panel>
<PanelHeader>
<PanelTitle>context panel</PanelTitle>
{selected && <ClearBtn onClick={onClear}></ClearBtn>}
</PanelHeader>
<PanelBody>{content}</PanelBody>
</Panel>
);
}

View File

@@ -0,0 +1,573 @@
'use client';
import React, { useCallback } from 'react';
import styled from 'styled-components';
// ─── Types ───────────────────────────────────────────────────────────────────
export type AgentState = 'idle' | 'thinking' | 'tool_calling' | 'speaking' | 'error';
export type SisterName = 'harang' | 'narang' | 'darang' | 'erang';
export interface SubAgent {
id: string;
name: string;
label: string;
sister: SisterName;
state: AgentState;
}
export interface SisterNode {
name: SisterName;
displayName: string;
role: string;
emoji: string;
state: AgentState;
currentTask: string | null;
subagents: SubAgent[];
}
export type SelectedAgent =
| { type: 'sister'; name: SisterName }
| { type: 'subagent'; id: string; sister: SisterName };
interface OfficeSceneProps {
sisters: SisterNode[];
selected: SelectedAgent | null;
onSelectSister: (name: SisterName) => void;
onSelectSubagent: (id: string, sister: SisterName) => void;
dataMode: 'live' | 'snapshot' | 'fallback';
}
// ─── Styled wrappers ──────────────────────────────────────────────────────────
const SceneWrapper = styled.div`
position: relative;
width: 100%;
aspect-ratio: 800 / 460;
max-height: 60vh;
border: 1px solid var(--border-color);
background: var(--bg-surface);
overflow: hidden;
user-select: none;
`;
const FreshnessLabel = styled.div`
position: absolute;
top: 8px;
right: 12px;
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.06em;
pointer-events: none;
`;
const WsDot = styled.span<{ $connected: boolean }>`
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: ${({ $connected }) => ($connected ? '#00FF00' : '#666')};
margin-right: 5px;
vertical-align: middle;
`;
// ─── SVG constants ────────────────────────────────────────────────────────────
const VB_W = 800;
const VB_H = 460;
type Point = [number, number];
// Zone rects [x, y, w, h]
const ZONES = {
harang: [5, 5, 345, 200] as const,
darang: [450, 5, 345, 200] as const,
narang: [5, 260, 345, 195] as const,
erang: [450, 260, 345, 195] as const,
};
// Sister desk center positions
const SISTER_POS: Record<SisterName, [number, number]> = {
harang: [75, 105],
darang: [725, 105],
narang: [75, 358],
erang: [725, 358],
};
// Conference room
const CONF = { cx: 400, cy: 232, rx: 55, ry: 30 };
// Subagent grid positions (cx, cy) per sister
const SUBAGENT_POSITIONS: Record<SisterName, Point[]> = {
harang: [[175, 65], [270, 65], [220, 160]],
darang: [[460, 65], [560, 65], [660, 65], [460, 160], [560, 160]],
narang: [[175, 295], [270, 295], [175, 395], [270, 395]],
erang: [[460, 295], [555, 295], [650, 295], [460, 395], [555, 395]],
};
const SUBAGENT_TARGETS: Record<SisterName, Point[]> = {
harang: [[295, 112], [338, 148], [365, 190]],
darang: [[505, 94], [560, 112], [462, 148], [438, 188], [520, 196]],
narang: [[292, 332], [330, 302], [362, 276], [344, 374]],
erang: [[618, 322], [664, 298], [702, 286], [610, 388], [664, 380]],
};
// Zone accent colors
const ZONE_COLORS: Record<SisterName, string> = {
harang: 'rgba(41, 121, 255, 0.06)',
narang: 'rgba(0, 191, 165, 0.06)',
darang: 'rgba(255, 64, 129, 0.06)',
erang: 'rgba(255, 109, 0, 0.06)',
};
const ZONE_BORDER: Record<SisterName, string> = {
harang: 'rgba(41, 121, 255, 0.25)',
narang: 'rgba(0, 191, 165, 0.25)',
darang: 'rgba(255, 64, 129, 0.25)',
erang: 'rgba(255, 109, 0, 0.25)',
};
// State ring colors
const STATE_COLORS: Record<AgentState, string> = {
idle: '#444444',
thinking: '#2979FF',
tool_calling:'#FF9800',
speaking: '#00BFA5',
error: '#FF1744',
};
const STATE_PROGRESS: Record<AgentState, number> = {
idle: 0,
error: 0,
thinking: 0.48,
tool_calling: 0.88,
speaking: 0.66,
};
function lerpPoint(from: Point, to: Point, progress: number): Point {
return [
from[0] + (to[0] - from[0]) * progress,
from[1] + (to[1] - from[1]) * progress,
];
}
function getSubagentPosition(sister: SisterName, index: number, state: AgentState): Point {
const from = SUBAGENT_POSITIONS[sister][index] ?? SUBAGENT_POSITIONS[sister][0];
const to = SUBAGENT_TARGETS[sister][index] ?? from;
return lerpPoint(from, to, STATE_PROGRESS[state]);
}
function getSubagentMotion(state: AgentState, index: number): { dx: number; dy: number; dur: string } | null {
const phase = index % 2 === 0 ? 1 : -1;
if (state === 'thinking') {
return { dx: 5 * phase, dy: -6, dur: '3.6s' };
}
if (state === 'tool_calling') {
return { dx: 10 * phase, dy: -14, dur: '2s' };
}
if (state === 'speaking') {
return { dx: 6 * phase, dy: -4, dur: '2.8s' };
}
return null;
}
// ─── Helper: AgentCircle (rendered as SVG group) ──────────────────────────────
function SisterCircle({
cx, cy, r, state, emoji, selected, onClick,
}: {
cx: number; cy: number; r: number;
state: AgentState; emoji: string; selected: boolean;
onClick: () => void;
}) {
const color = STATE_COLORS[state];
return (
<g onClick={onClick} style={{ cursor: 'pointer' }}>
{/* Outer selection ring */}
{selected && (
<circle
cx={cx} cy={cy} r={r + 8}
fill="none"
stroke="var(--text-primary)"
strokeWidth={1}
strokeDasharray="4 3"
opacity={0.6}
/>
)}
{/* State ring */}
<circle
cx={cx} cy={cy} r={r + 4}
fill="none"
stroke={color}
strokeWidth={state === 'error' ? 2.5 : 1.5}
opacity={state === 'idle' ? 0.4 : 1}
>
{state === 'thinking' && (
<animate
attributeName="opacity"
values="0.45;1;0.45"
dur="1.8s"
repeatCount="indefinite"
/>
)}
{state === 'tool_calling' && (
<animate
attributeName="stroke-opacity"
values="1;0.2;1"
dur="0.9s"
repeatCount="indefinite"
/>
)}
</circle>
{/* Body */}
<circle cx={cx} cy={cy} r={r} fill="#1e1e1e" stroke={color} strokeWidth={1} />
{/* Emoji */}
<text
x={cx} y={cy + 7}
textAnchor="middle"
fontSize={r * 0.9}
style={{ userSelect: 'none', pointerEvents: 'none' }}
>
{emoji}
</text>
{/* State label below */}
<text
x={cx} y={cy + r + 16}
textAnchor="middle"
fontSize={9}
fontFamily="var(--font-mono)"
fill={color}
style={{ textTransform: 'uppercase', letterSpacing: '0.06em', userSelect: 'none', pointerEvents: 'none' }}
>
{state}
</text>
</g>
);
}
function SubagentCircle({
cx, cy, r, state, label, selected, motion, motionBegin, onClick,
}: {
cx: number; cy: number; r: number;
state: AgentState; label: string; selected: boolean;
motion: { dx: number; dy: number; dur: string } | null;
motionBegin: string;
onClick: () => void;
}) {
const color = STATE_COLORS[state];
return (
<g onClick={onClick} style={{ cursor: 'pointer' }}>
{motion && (
<animateTransform
attributeName="transform"
type="translate"
values={`0 0; ${motion.dx} ${motion.dy}; 0 0`}
dur={motion.dur}
begin={motionBegin}
repeatCount="indefinite"
/>
)}
{selected && (
<circle cx={cx} cy={cy} r={r + 5} fill="none" stroke="var(--text-primary)" strokeWidth={1} opacity={0.5} />
)}
<circle
cx={cx} cy={cy} r={r + 2}
fill="none" stroke={color} strokeWidth={1}
opacity={state === 'idle' ? 0.3 : 0.8}
>
{state === 'thinking' && (
<animate
attributeName="opacity"
values="0.35;0.95;0.35"
dur="2s"
repeatCount="indefinite"
/>
)}
</circle>
<circle cx={cx} cy={cy} r={r} fill="#1a1a1a" stroke={color} strokeWidth={0.8} />
<text
x={cx} y={cy + 4}
textAnchor="middle"
fontSize={8}
fontFamily="var(--font-mono)"
fill={color}
opacity={0.9}
style={{ userSelect: 'none', pointerEvents: 'none' }}
>
{label.length > 8 ? label.slice(0, 7) + '…' : label}
</text>
</g>
);
}
function ConnectorLine({
x1, y1, x2, y2, active,
}: {
x1: number; y1: number; x2: number; y2: number; active: boolean;
}) {
return (
<line
x1={x1} y1={y1} x2={x2} y2={y2}
stroke={active ? 'rgba(245,245,245,0.35)' : 'rgba(255,255,255,0.08)'}
strokeWidth={active ? 1.5 : 1}
strokeDasharray={active ? '6 4' : '3 4'}
strokeDashoffset={active ? 40 : 0}
>
{active && (
<animate
attributeName="stroke-dashoffset"
values="40;0"
dur="1.4s"
repeatCount="indefinite"
/>
)}
</line>
);
}
function PathConnector({
d, active,
}: {
d: string; active: boolean;
}) {
return (
<path
d={d}
fill="none"
stroke={active ? 'rgba(245,245,245,0.3)' : 'rgba(255,255,255,0.06)'}
strokeWidth={active ? 1.5 : 1}
strokeDasharray={active ? '6 4' : '3 4'}
strokeDashoffset={active ? 40 : 0}
>
{active && (
<animate
attributeName="stroke-dashoffset"
values="40;0"
dur="1.8s"
repeatCount="indefinite"
/>
)}
</path>
);
}
// ─── Main Component ───────────────────────────────────────────────────────────
const SISTER_EMOJIS: Record<SisterName, string> = {
harang: '🦊',
narang: '🦊',
darang: '🐱',
erang: '🐺',
};
const SISTER_ORDER: SisterName[] = ['harang', 'narang', 'darang', 'erang'];
export default function OfficeScene({
sisters,
selected,
onSelectSister,
onSelectSubagent,
dataMode,
}: OfficeSceneProps) {
const getSister = useCallback(
(name: SisterName) => sisters.find((s) => s.name === name),
[sisters],
);
const isActive = useCallback(
(name: SisterName) => {
const s = getSister(name);
return s?.state === 'thinking' || s?.state === 'tool_calling' || s?.state === 'speaking';
},
[getSister],
);
const isSisterSelected = (name: SisterName) =>
selected?.type === 'sister' && selected.name === name;
const isSubSelected = (id: string) =>
selected?.type === 'subagent' && selected.id === id;
// Derive active handoff lines from sister states
const harangActive = isActive('harang');
const narangActive = isActive('narang');
const darangActive = isActive('darang');
const erangActive = isActive('erang');
return (
<SceneWrapper>
<FreshnessLabel>
<WsDot $connected={dataMode === 'live'} />
{dataMode === 'live' ? 'live · ws' : dataMode === 'snapshot' ? 'snapshot · poll' : 'fallback · doc-derived'}
{' · subagents: fallback'}
</FreshnessLabel>
<svg
viewBox={`0 0 ${VB_W} ${VB_H}`}
width="100%"
height="100%"
style={{ display: 'block' }}
>
{/* ── Zone backgrounds ── */}
{SISTER_ORDER.map((name) => {
const [zx, zy, zw, zh] = ZONES[name];
return (
<g key={`zone-${name}`}>
<rect
x={zx} y={zy} width={zw} height={zh}
rx={4}
fill={ZONE_COLORS[name]}
stroke={ZONE_BORDER[name]}
strokeWidth={1}
/>
</g>
);
})}
{/* ── Center corridor (vertical) ── */}
<rect x={358} y={5} width={84} height={450} rx={2} fill="#111111" stroke="rgba(255,255,255,0.04)" strokeWidth={1} />
{/* ── Center corridor (horizontal) ── */}
<rect x={5} y={205} width={790} height={50} rx={2} fill="#111111" stroke="rgba(255,255,255,0.04)" strokeWidth={1} />
{/* ── Conference room ── */}
<ellipse
cx={CONF.cx} cy={CONF.cy} rx={CONF.rx} ry={CONF.ry}
fill="#1a1a1a"
stroke="rgba(255,255,255,0.15)"
strokeWidth={1}
/>
<text
x={CONF.cx} y={CONF.cy + 4}
textAnchor="middle"
fontSize={9}
fontFamily="var(--font-mono)"
fill="rgba(255,255,255,0.4)"
style={{ textTransform: 'uppercase', letterSpacing: '0.08em' }}
>
</text>
{/* ── Connectors ── */}
{/* harang ↔ narang (left vertical through corridor) */}
<ConnectorLine
x1={SISTER_POS.harang[0]} y1={SISTER_POS.harang[1] + 30}
x2={SISTER_POS.narang[0]} y2={SISTER_POS.narang[1] - 30}
active={harangActive || narangActive}
/>
{/* darang ↔ erang (right vertical through corridor) */}
<ConnectorLine
x1={SISTER_POS.darang[0]} y1={SISTER_POS.darang[1] + 30}
x2={SISTER_POS.erang[0]} y2={SISTER_POS.erang[1] - 30}
active={darangActive || erangActive}
/>
{/* harang ↔ darang (through conference, horizontal top) */}
<ConnectorLine
x1={SISTER_POS.harang[0] + 30} y1={SISTER_POS.harang[1]}
x2={SISTER_POS.darang[0] - 30} y2={SISTER_POS.darang[1]}
active={harangActive || darangActive}
/>
{/* narang ↔ erang (horizontal bottom) */}
<ConnectorLine
x1={SISTER_POS.narang[0] + 30} y1={SISTER_POS.narang[1]}
x2={SISTER_POS.erang[0] - 30} y2={SISTER_POS.erang[1]}
active={narangActive || erangActive}
/>
{/* narang → darang (review path through conference, curved) */}
<PathConnector
d={`M${SISTER_POS.narang[0] + 20},${SISTER_POS.narang[1] - 20} Q${CONF.cx},${CONF.cy} ${SISTER_POS.darang[0] - 20},${SISTER_POS.darang[1] + 20}`}
active={narangActive && darangActive}
/>
{/* ── Zone labels ── */}
{([
['harang', 18, 22, '하랑이 · Planning'] as const,
['darang', 463, 22, '다랑이 · QA'] as const,
['narang', 18, 272, '나랑이 · Dev'] as const,
['erang', 463, 272, '이랑이 · Infra'] as const,
] as const).map(([name, lx, ly, text]) => (
<text
key={`label-${name}`}
x={lx} y={ly}
fontSize={10}
fontFamily="var(--font-mono)"
fill={ZONE_BORDER[name]}
style={{ textTransform: 'uppercase', letterSpacing: '0.08em' }}
>
{text}
</text>
))}
{/* ── Sister nodes ── */}
{SISTER_ORDER.map((name) => {
const sisterData = getSister(name);
const state: AgentState = sisterData?.state ?? 'idle';
const [cx, cy] = SISTER_POS[name];
return (
<SisterCircle
key={`sister-${name}`}
cx={cx} cy={cy} r={28}
state={state}
emoji={SISTER_EMOJIS[name]}
selected={isSisterSelected(name)}
onClick={() => onSelectSister(name)}
/>
);
})}
{/* ── Subagent nodes ── */}
{SISTER_ORDER.map((sisterName) => {
const sisterData = getSister(sisterName);
const subagents = sisterData?.subagents ?? [];
return subagents.map((sub, i) => {
const pos = getSubagentPosition(sisterName, i, sub.state);
const motion = getSubagentMotion(sub.state, i);
return (
<SubagentCircle
key={sub.id}
cx={pos[0]} cy={pos[1]} r={14}
state={sub.state}
label={sub.name}
selected={isSubSelected(sub.id)}
motion={motion}
motionBegin={`${i * 0.22}s`}
onClick={() => onSelectSubagent(sub.id, sisterName)}
/>
);
});
})}
{/* ── Subagent → Sister connector lines (thin) ── */}
{SISTER_ORDER.map((sisterName) => {
const sisterData = getSister(sisterName);
const subagents = sisterData?.subagents ?? [];
const [sx, sy] = SISTER_POS[sisterName];
return subagents.map((sub, i) => {
const pos = getSubagentPosition(sisterName, i, sub.state);
const active = sub.state !== 'idle' && sub.state !== 'error';
return (
<line
key={`conn-${sub.id}`}
x1={sx} y1={sy}
x2={pos[0]} y2={pos[1]}
stroke={active ? ZONE_BORDER[sisterName] : 'rgba(255,255,255,0.05)'}
strokeWidth={active ? 0.8 : 0.5}
strokeDasharray="2 3"
/>
);
});
})}
</svg>
</SceneWrapper>
);
}

View File

@@ -0,0 +1,254 @@
'use client';
import React from 'react';
import styled, { keyframes } from 'styled-components';
import type { PipelineNode } from '@/components/dashboard/ActivePipeline';
// ─── Types ───────────────────────────────────────────────────────────────────
interface PipelinePanelProps {
activeTask: string;
focus: string;
reviewLoopCount: number;
escalationCount: number;
deployState: string;
nodes: PipelineNode[];
freshness: string;
}
// ─── Animations ──────────────────────────────────────────────────────────────
const flowAnim = keyframes`
0% { transform: translateX(-100%); opacity: 0; }
40% { opacity: 0.8; }
100% { transform: translateX(100%); opacity: 0; }
`;
// ─── Styled Components ────────────────────────────────────────────────────────
const Panel = styled.section`
border: 1px solid var(--border-color);
background: var(--bg-surface);
display: flex;
flex-direction: column;
gap: var(--space-md);
padding: var(--space-lg);
`;
const PanelHeader = styled.div`
display: flex;
align-items: baseline;
gap: var(--space-lg);
justify-content: space-between;
flex-wrap: wrap;
`;
const TitleGroup = styled.div`
display: flex;
flex-direction: column;
gap: 4px;
`;
const Eyebrow = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
`;
const Title = styled.h3`
font-size: 15px;
font-weight: 600;
color: var(--text-primary);
letter-spacing: -0.01em;
margin: 0;
`;
const Focus = styled.div`
font-size: 11px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.04em;
max-width: 500px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`;
const Stats = styled.div`
display: flex;
gap: var(--space-md);
flex-wrap: wrap;
`;
const Stat = styled.div`
display: flex;
flex-direction: column;
gap: 2px;
min-width: 80px;
`;
const StatLabel = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const StatValue = styled.div`
font-size: 14px;
font-weight: 600;
color: var(--text-primary);
`;
const NodeRow = styled.div`
display: flex;
gap: var(--space-sm);
align-items: stretch;
overflow-x: auto;
scrollbar-width: thin;
scrollbar-color: var(--border-color) transparent;
`;
const stateColors: Record<PipelineNode['state'], string> = {
idle: 'var(--border-color)',
active: '#6fc3ff',
review: '#ff7ac6',
blocked: '#ff8d7a',
ready: '#8dffb2',
};
const NodeCard = styled.div<{ $state: PipelineNode['state'] }>`
border: 1px solid ${({ $state }) => stateColors[$state]};
padding: var(--space-sm) var(--space-md);
min-width: 140px;
flex-shrink: 0;
display: flex;
flex-direction: column;
gap: 4px;
`;
const NodeName = styled.div`
font-size: 13px;
font-weight: 600;
color: var(--text-primary);
`;
const NodeRole = styled.div`
font-size: 10px;
color: var(--text-secondary);
`;
const NodeState = styled.div<{ $state: PipelineNode['state'] }>`
font-family: var(--font-mono);
font-size: 10px;
color: ${({ $state }) => stateColors[$state]};
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const NodeDetail = styled.div`
font-size: 11px;
color: var(--text-secondary);
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
`;
const Connector = styled.div<{ $active: boolean }>`
width: 24px;
flex-shrink: 0;
height: 1px;
background: ${({ $active }) => $active ? 'rgba(245,245,245,0.4)' : 'var(--border-color)'};
position: relative;
overflow: hidden;
align-self: center;
&::after {
content: '';
position: absolute;
top: -2px;
left: 0;
width: 100%;
height: 5px;
background: ${({ $active }) => $active ? 'rgba(245,245,245,0.8)' : 'transparent'};
animation: ${({ $active }) => $active ? `${flowAnim} 1.6s linear infinite` : 'none'};
}
`;
const FreshnessNote = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
opacity: 0.6;
text-transform: uppercase;
letter-spacing: 0.06em;
`;
// ─── Component ────────────────────────────────────────────────────────────────
export default function PipelinePanel({
activeTask,
focus,
reviewLoopCount,
escalationCount,
deployState,
nodes,
freshness,
}: PipelinePanelProps) {
return (
<Panel>
<PanelHeader>
<TitleGroup>
<Eyebrow>pipeline panel · snapshot</Eyebrow>
<Title>{activeTask}</Title>
<Focus>{focus}</Focus>
</TitleGroup>
<Stats>
<Stat>
<StatLabel>review loop</StatLabel>
<StatValue>{reviewLoopCount}x</StatValue>
</Stat>
<Stat>
<StatLabel>escalations</StatLabel>
<StatValue>{escalationCount}</StatValue>
</Stat>
<Stat>
<StatLabel>deploy state</StatLabel>
<StatValue>{deployState}</StatValue>
</Stat>
</Stats>
</PanelHeader>
{nodes.length > 0 ? (
<NodeRow>
{nodes.map((node, i) => {
const active = node.state === 'active' || node.state === 'review' || node.state === 'ready';
return (
<React.Fragment key={node.id}>
<NodeCard $state={node.state}>
<NodeName>{node.label}</NodeName>
<NodeRole>{node.role}</NodeRole>
<NodeState $state={node.state}>{node.state}</NodeState>
<NodeDetail>{node.detail}</NodeDetail>
</NodeCard>
{i < nodes.length - 1 && <Connector $active={active} />}
</React.Fragment>
);
})}
</NodeRow>
) : (
<NodeRole style={{ color: 'var(--text-secondary)', fontSize: '12px' }}>
</NodeRole>
)}
<FreshnessNote>snapshot · {freshness}</FreshnessNote>
</Panel>
);
}

View File

@@ -0,0 +1,185 @@
'use client';
import React from 'react';
import styled from 'styled-components';
// ─── Types ───────────────────────────────────────────────────────────────────
export interface ServerEntry {
id: string;
label: string;
type: 'sister' | 'dev' | 'docker';
status: 'online' | 'offline' | 'working' | 'unknown';
detail?: string | null;
source: 'live' | 'snapshot' | 'fallback';
}
interface ServerHealthPanelProps {
servers: ServerEntry[];
dataMode: 'live' | 'snapshot' | 'fallback';
generatedAt: string;
}
// ─── Styled Components ────────────────────────────────────────────────────────
const Panel = styled.section`
border: 1px solid var(--border-color);
background: var(--bg-surface);
padding: var(--space-lg);
display: flex;
flex-direction: column;
gap: var(--space-md);
`;
const PanelHeader = styled.div`
display: flex;
align-items: center;
gap: var(--space-md);
justify-content: space-between;
`;
const Eyebrow = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.08em;
`;
const WsDot = styled.span<{ $connected: boolean }>`
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
background: ${({ $connected }) => ($connected ? '#00FF00' : '#555')};
margin-right: 4px;
vertical-align: middle;
`;
const FreshnessNote = styled.div`
font-family: var(--font-mono);
font-size: 10px;
color: var(--text-secondary);
opacity: 0.5;
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const Grid = styled.div`
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: var(--space-sm);
@media (max-width: 767px) {
grid-template-columns: repeat(2, 1fr);
}
`;
const statusColors: Record<ServerEntry['status'], string> = {
online: '#00FF00',
offline: '#FF1744',
working: '#2979FF',
unknown: '#555555',
};
const ServerCard = styled.div<{ $status: ServerEntry['status'] }>`
border: 1px solid var(--border-color);
border-left: 2px solid ${({ $status }) => statusColors[$status]};
padding: var(--space-sm) var(--space-md);
display: flex;
flex-direction: column;
gap: 4px;
`;
const CardLabel = styled.div`
font-size: 12px;
font-weight: 600;
color: var(--text-primary);
display: flex;
align-items: center;
gap: 6px;
`;
const StatusDot = styled.span<{ $status: ServerEntry['status'] }>`
width: 6px;
height: 6px;
border-radius: 50%;
flex-shrink: 0;
background: ${({ $status }) => statusColors[$status]};
`;
const CardStatus = styled.div<{ $status: ServerEntry['status'] }>`
font-family: var(--font-mono);
font-size: 10px;
color: ${({ $status }) => statusColors[$status]};
text-transform: uppercase;
letter-spacing: 0.06em;
`;
const CardDetail = styled.div`
font-size: 11px;
color: var(--text-secondary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`;
const SourceBadge = styled.span`
font-family: var(--font-mono);
font-size: 9px;
color: var(--text-secondary);
opacity: 0.5;
text-transform: uppercase;
letter-spacing: 0.06em;
`;
// ─── Component ────────────────────────────────────────────────────────────────
function formatGeneratedAt(ts: string): string {
try {
const date = new Date(ts);
const diff = Date.now() - date.getTime();
const sec = Math.floor(diff / 1000);
if (sec < 60) return `${sec}s ago`;
const min = Math.floor(sec / 60);
if (min < 60) return `${min}m ago`;
return `${Math.floor(min / 60)}h ago`;
} catch {
return ts;
}
}
export default function ServerHealthPanel({
servers,
dataMode,
generatedAt,
}: ServerHealthPanelProps) {
const onlineCount = servers.filter((s) => s.status === 'online' || s.status === 'working').length;
return (
<Panel>
<PanelHeader>
<Eyebrow>
<WsDot $connected={dataMode === 'live'} />
server health · {dataMode}
{' · '}{onlineCount}/{servers.length} online
</Eyebrow>
<FreshnessNote>refreshed {formatGeneratedAt(generatedAt)}</FreshnessNote>
</PanelHeader>
<Grid>
{servers.map((server) => (
<ServerCard key={server.id} $status={server.status}>
<CardLabel>
<StatusDot $status={server.status} />
{server.label}
</CardLabel>
<CardStatus $status={server.status}>{server.status}</CardStatus>
{server.detail && <CardDetail>{server.detail}</CardDetail>}
<SourceBadge>{server.source}</SourceBadge>
</ServerCard>
))}
</Grid>
</Panel>
);
}