feat: add control panel

This commit is contained in:
thanhnv
2026-07-08 19:07:35 +09:00
parent a07b15e489
commit 3be9970c15
104 changed files with 3639 additions and 461 deletions
+12 -12
View File
@@ -1,6 +1,6 @@
# CASAN — Phân công team 3 người (Task Allocation & Dependency Map)
> Cập nhật: 2026-07-07. File này **chia toàn bộ việc còn lại** (từ `CASAN_BACKLOG_STATUS.md`
> Cập nhật: 2026-07-08. File này **chia toàn bộ việc còn lại** (từ `CASAN_BACKLOG_STATUS.md`
> + các plan) cho **3 dev**, với **task nhỏ có ID**, **mức liên quan (dependency)** giữa
> các task, và **link tới từng plan**. Đây là file điều phối — "còn gì phải làm" vẫn lấy
> chuẩn từ [`CASAN_BACKLOG_STATUS.md`](CASAN_BACKLOG_STATUS.md); mục lục plan ở
@@ -64,7 +64,7 @@ approval JWT thật ([16 SEC-07](CASAN_PLAN_16_SECURITY_AUDIT_REMEDIATION.md)),
| B3 | ✅ **done** — **Per-iteration Verify Contract** `loop-gate.py` (bọc H4 security-check + H3 success-criteria; injection → DENY; unmet → FAIL; correction bounded by `max_corrections_per_step` → ESCALATE; no self-declared DONE; artifact/gate error fail-closed). `phase-loop-gate` 20/0, nối CI | [17 T3 (17.9–17.12)](CASAN_PLAN_17_LOOP_ENGINEERING.md) | M | 🟦 | — |
| B4 | 🟡 **offline done** — **Loop Trace/Replay** `loop-trace.py` (append-only hash-linked per-run trace · `record`/`show`/`replay`/`verify-chain`; edited record → chain BREAK · tampered artifact → replay DRIFT · corrupt trace fail-closed). `phase-loop-trace` 16/0, nối CI. **Còn 17.16 KMS-anchor head** (🔌 Vault, dep A7) | [17 T4 (17.13–17.16)](CASAN_PLAN_17_LOOP_ENGINEERING.md) | M | 🟦 offline (KMS 🔌) | A7 (chỉ KMS-anchor) |
| B5 | ✅ **done (offline)** — **Meta-loop** `loop-metaloop.py` (propose≠apply dry-run; **SoD** proposer≠approver; loosen>`org_ceiling` refused 17.19; apply qua governed CP store → versioned+audit+rollback + **đổi thật ceiling governor**). `phase-loop-metaloop` 15/0, nối CI | [17 T5 (17.17–17.19)](CASAN_PLAN_17_LOOP_ENGINEERING.md) · [04](CASAN_PLAN_04_SELFIMPROVE.md) | M | 🟦 (SEC-07 ✅) | B1, A(SEC-07) ✅ |
| B6 | 🟡 **offline done** — **Orchestrator** `loop-run.sh` (mỗi turn: gate→governor→convergence→trace; DONE/HALT/ESCALATE; secure-by-default prod opt-out bị từ chối nếu thiếu lý do; nén giữa vòng qua `context-compress.py` 17.21). `phase-loop-run` 16/0, nối CI. **Còn widget Command Center (17.22 = B12, dep C5)** | [17 T6 (17.20–17.21)](CASAN_PLAN_17_LOOP_ENGINEERING.md) | M | 🟦 | B1,B2,B3,B7 (B7 opt) |
| B6 | 🟡 **offline done** — **Orchestrator** `loop-run.sh` (mỗi turn: gate→governor→convergence→trace; DONE/HALT/ESCALATE; secure-by-default prod opt-out bị từ chối nếu thiếu lý do; nén giữa vòng qua `context-compress.py` 17.21). `phase-loop-run` 16/0, nối CI. **Còn widget Loop/Chat chuyên sâu (17.22 = B12, dep C5 ✅ baseline)** | [17 T6 (17.20–17.21)](CASAN_PLAN_17_LOOP_ENGINEERING.md) | M | 🟦 | B1,B2,B3,B7 (B7 opt) |
### 3.2 Context compression ([Plan-08](CASAN_PLAN_08_CONTEXT_COMPRESSION.md))
| ID | Task nhỏ | Plan | Effort | Cờ | Dep |
@@ -78,7 +78,7 @@ approval JWT thật ([16 SEC-07](CASAN_PLAN_16_SECURITY_AUDIT_REMEDIATION.md)),
| B9 | **MVP-0** Prompt Router (Track 0) + Read-only Ask CASAN (Track 1) + session/audit (Track 2) + model-provider tối thiểu (Track M) | [18 §1b, Track 0/1/2/M](CASAN_PLAN_18_CHAT_CONSOLE.md) | L | 🟦 | — |
| B10 | **MVP-1** Operator mode registered actions (Track 3, qua `action-gate`) | [18 Track 3](CASAN_PLAN_18_CHAT_CONSOLE.md) | M | 🔗 | B9 |
| B11 | **MVP-2** Chat-as-loop (Track 5) + Agent/Skill selection (Track 4) + streaming draft-hold (Track 6) | [18 Track 4/5/6](CASAN_PLAN_18_CHAT_CONSOLE.md) | L | 🔗 | B6, C7(RBAC), B10 |
| B12 | **Widget Loop/Chat** trên Command Center (loop ticker/budget/replay drawer) | [17 (17.22)](CASAN_PLAN_17_LOOP_ENGINEERING.md) · [18 Track 8](CASAN_PLAN_18_CHAT_CONSOLE.md) | M | 🔗 | C5(Command Center) |
| B12 | **Widget Loop/Chat** trên Command Center (loop ticker/budget/replay drawer) | [17 (17.22)](CASAN_PLAN_17_LOOP_ENGINEERING.md) · [18 Track 8](CASAN_PLAN_18_CHAT_CONSOLE.md) | M | 🔗 | C5 ✅ baseline |
| B13 | **MVP-3** multi-tenant chat hardening (Track 9) | [18 Track 9](CASAN_PLAN_18_CHAT_CONSOLE.md) | M | 🔗 | A3(SEC-23) |
---
@@ -88,16 +88,16 @@ approval JWT thật ([16 SEC-07](CASAN_PLAN_16_SECURITY_AUDIT_REMEDIATION.md)),
### 4.1 Control Plane web app ([Plan-13](CASAN_PLAN_13_CONTROL_PLANE.md))
| ID | Task nhỏ | Plan | Effort | Cờ | Dep |
|---|---|---|:--:|:--:|---|
| C1 | **Track 1 read-only monitoring API (NestJS)** đọc telemetry/audit/traceability | [13 §4 Track 1 (13.1–13.3)](CASAN_PLAN_13_CONTROL_PLANE.md) | M | 🟦 | — |
| C2 | **Ops Console (React)** verdicts/cost/drift/incident + stale-aware | [13 §4 Track 1](CASAN_PLAN_13_CONTROL_PLANE.md) | M | 🟦 | C1 |
| C3 | **Track 2 settings store versioned + H5 audit + rollback** (13.4–13.6) | [13 §4 Track 2](CASAN_PLAN_13_CONTROL_PLANE.md) | M | 🔗 | A7(KMS) |
| C4 | **HITL surface**: approvals inbox + delegation L0–L5 + oversight log (13H.1–13H.3) | [13 §3.4](CASAN_PLAN_13_CONTROL_PLANE.md) | L | 🔗 | C7, A(SEC-07) |
| C5 | **Command Center §8.6** data-contract envelope (provenance) — nền cho widget của B | [13 §8.6](CASAN_PLAN_13_CONTROL_PLANE.md) | M | 🟦 | C1 |
| C1 | ✅ **done** — Track 1 read-only monitoring API (NestJS) đọc telemetry/audit/traceability | [13 §4 Track 1 (13.1–13.3)](CASAN_PLAN_13_CONTROL_PLANE.md) | M | ✅ | done |
| C2 | ✅ **done** — Ops Console (React) verdicts/cost/drift/incident + stale-aware | [13 §4 Track 1](CASAN_PLAN_13_CONTROL_PLANE.md) | M | ✅ | done |
| C3 | ✅ **Track 2 settings API/UI + H5 audit + rollback** (13.4–13.6) | [13 §4 Track 2](CASAN_PLAN_13_CONTROL_PLANE.md) | M | ✅ | done |
| C4 | ✅ **HITL surface**: approvals inbox + delegation L0–L5 + oversight log (13H.1–13H.3) | [13 §3.4](CASAN_PLAN_13_CONTROL_PLANE.md) | L | ✅ | done; local OIDC claim→role smoke pass |
| C5 | ✅ **done** — Command Center §8.6 baseline: `GET /command`, provenance envelope, executive briefing, live ticker, evidence drawer; nền cho widget của B | [13 §8.6](CASAN_PLAN_13_CONTROL_PLANE.md) | M | ✅ | done |
### 4.2 RBAC + RAI ([Plan-14](CASAN_PLAN_14_RBAC.md) / [Plan-15](CASAN_PLAN_15_RESPONSIBLE_AI_DATA_GOV.md))
| ID | Task nhỏ | Plan | Effort | Cờ | Dep |
|---|---|---|:--:|:--:|---|
| C6 | **IdP claim → role mapping** (07-C4) + enforcement trong web app | [14](CASAN_PLAN_14_RBAC.md) · [07 C4](CASAN_PLAN_07_PRODUCTION_HARDENING.md) | M | 🔌 (IdP) | — |
| C6 | 🟡 **local done** — IdP claim → role mapping + enforcement trong web app; còn enterprise IdP thật | [14](CASAN_PLAN_14_RBAC.md) · [07 C4](CASAN_PLAN_07_PRODUCTION_HARDENING.md) | M | ✅ local / 🔌 prod | — |
| C7 | **RBAC enforcement API** (expose `rbac-check.py` cho B/chat) + audit quyết định vào H5 | [14](CASAN_PLAN_14_RBAC.md) | M | 🟦 | — |
| C8 | **RAI view** trên Control Plane (retention/model-card/PII report) | [15](CASAN_PLAN_15_RESPONSIBLE_AI_DATA_GOV.md) | M | 🔗 | C2 |
@@ -107,7 +107,7 @@ approval JWT thật ([16 SEC-07](CASAN_PLAN_16_SECURITY_AUDIT_REMEDIATION.md)),
| C9 | **Plan-01 restructure** Phase 0→6 (nhánh riêng, giữ 218/0) → `packages/casan-harness` | [01](CASAN_PLAN_01_RESTRUCTURE.md) | L | 🟦🔗 | (freeze window) |
| C10 | **Plan-06 onboard dự án 2** qua `verify-harness-reuse.sh` (không sửa gate) | [06](CASAN_PLAN_06_ONBOARD.md) | M | 🔗 | C9 |
| C11 | **Plan-12 Domain Pack SDK** (golden/corpus/policy theo domain khai báo) | [12](CASAN_PLAN_12_DOMAIN_PACK.md) | L | 🔗 | C9, C10 |
| C12 | **TIER-2 infra**: dashboard TLS/OIDC + alert managed (Slack/PagerDuty) + billing API thật | [07 T2.3/2.4/2.5](CASAN_PLAN_07_PRODUCTION_HARDENING.md) | M | 🔌 | C2 |
| C12 | **TIER-2 infra**: promote local-prod Control Panel TLS/OIDC to managed host/cert/enterprise IdP + alert managed (Slack/PagerDuty) + billing API thật | [07 T2.3/2.4/2.5](CASAN_PLAN_07_PRODUCTION_HARDENING.md) | M | 🔌 | C2 ✅ |
---
@@ -172,7 +172,7 @@ C phụ thuộc A ở **KMS (A7→C3)** và **approval (SEC-07→C4)**.
| S2 | **Audit-chain / tamper-evidence** | A→B,C | A định dạng head + verify-chain; B dùng cho `loop-trace`; C dùng cho control-plane audit — **một serializer, một verifier** |
| S3 | **Approval contract (JWT+SoD)** | A→B,C | 1 đường `approval-verify.sh`; B (meta-loop) + C (settings/approvals inbox) gọi lại, không tự chế |
| S4 | **RBAC contract** | C→A,B | `rbac-check.py` là nguồn; B (chat chọn agent) gọi; A đảm bảo trong CI |
| S5 | **Command Center data-contract §8.6** | C→B | envelope `{source,artifact_path,commit,run_at,verified}` — widget Loop/Chat của B tuân theo |
| S5 | **Command Center data-contract §8.6** | C→B | ✅ baseline envelope `{source,artifact_path,commit,run_at,verified,status}` đã có; widget Loop/Chat của B mở rộng theo contract này |
| S6 | **Restructure freeze** (Plan-01) | C→A,B | C9 chạy trên nhánh riêng; A/B **đóng băng path** trong cửa sổ merge để giữ 218/0 |
---
@@ -183,7 +183,7 @@ C phụ thuộc A ở **KMS (A7→C3)** và **approval (SEC-07→C4)**.
| Sóng | Dev A | Dev B | Dev C |
|---|---|---|---|
| **Wave 1** (offline, không cần infra) | A1 SEC-26 · A2 SEC-22 · A3 SEC-23 · A6 H3 eval | B1 Governor · B2 Convergence · B3 Verify · B7 nén T1/T2 | C1 monitoring API · C2 console · C5 Command Center · C7 RBAC API |
| **Wave 1** (offline, không cần infra) | A1 SEC-26 · A2 SEC-22 · A3 SEC-23 · A6 H3 eval | B1 Governor · B2 Convergence · B3 Verify · B7 nén T1/T2 | C1 monitoring API ✅ · C2 console ✅ · C5 Command Center ✅ · C7 RBAC API |
| **Wave 2** | A7 KMS · A9 CI runner · A11 nối suite mới | B4 Loop-trace · B6 Orchestrator · B9 **Chat MVP-0** · B8 nén T4 | C3 settings store · C6 IdP→role · C4 approvals inbox · C9 restructure |
| **Wave 3** | A4 SEC-24 · A5 SEC-25 · A8 WORM · A10 release | B5 Meta-loop · B10 **MVP-1** · B11 **MVP-2** · B12 widget · B13 MVP-3 | C8 RAI view · C10 onboard · C11 domain pack · C12 TIER-2 infra |