feat: plan 18
This commit is contained in:
@@ -1,5 +1,33 @@
|
||||
# KẾ HOẠCH 18 — Governed Chat Console (Chat-as-Loop qua Control Plane)
|
||||
|
||||
> Status 2026-07-09b: **✅ Chat capability uplift (items 1–5) done+test.**
|
||||
> **(1) ANALYSIS mode**: router phân loại ý định suy luận/so sánh (`analyze/compare/
|
||||
> evaluate/trade-off…`) → `ANALYSIS` (read-only, no side-effect), synthesis dùng
|
||||
> prompt lập luận `role=analysis`. **(2) Multi-turn memory**: `chat-readonly.load_history`
|
||||
> dựng lại lịch sử **per-chat/per-tenant** từ H5 audit (chỉ preview đã H4-scan, không
|
||||
> raw msg), nén qua Plan-08 `context-compress`, nạp vào prompt; cross-chat/cross-tenant
|
||||
> không rò. **(3) Streaming**: `ask --stream` phát NDJSON 2 pha — draft `UNCERTIFIED`
|
||||
> (deterministic, whitelist-only, no side-effect) rồi final certified; injection → deny
|
||||
> trước khi có draft. Control Panel: `POST /api/v1/chat/ask/stream` (spawn NDJSON) + UI
|
||||
> toggle Stream + draft banner. **(4) CODEGEN full model-router**: `chat-turn._model_codegen_body`
|
||||
> sinh code qua `model-router.sh` (offline-first, fallback scaffold), vẫn artifact-scan +
|
||||
> loop-cert, draft-only; injection trong code sinh → artifact-scan BLOCK. **(5) Cloud
|
||||
> live-smoke**: `chat-cloud-smoke.sh` chạy synthesis cloud thật khi có key, SKIP khi
|
||||
> không (không nằm trong unit gate). Test: `phase-chat-advanced` **8/0** + `phase-chat-model-synthesis`
|
||||
> **7/0**; toàn bộ chat suites **74/0 (WSL)**, nối `ci-harness-gate.sh`; Control Panel TS sạch.
|
||||
>
|
||||
> Status 2026-07-09: **✅ Track M (Model Provider Binding) — model-optional grounded synthesis done+test.**
|
||||
> Read-only Ask CASAN giờ tổng hợp câu trả lời tự nhiên **có trích dẫn** khi
|
||||
> `CASAN_CHAT_MODEL_MODE=model` (RAG: whitelist sources → `model-router.sh --role
|
||||
> generate`), giữ **offline-first**: mặc định/CI vẫn deterministic (không phụ thuộc
|
||||
> model). Fail-SAFE: model lỗi/không sẵn sàng → fallback deterministic, không crash,
|
||||
> không bịa. Cloud provider → ép `CASAN_PREFLIGHT=1` (PII→cloud guard). Model output
|
||||
> vẫn qua H4 output scan (secret → DENY fail-closed). H6 ghi real token + provider
|
||||
> cost_source. Config: `packages/casan-harness/config/model-providers.yaml`. Test
|
||||
> `phase-chat-model-synthesis` **7/0 (WSL)**, nối `ci-harness-gate.sh`; UI `/chat`
|
||||
> hiện badge `model:<provider>`/`deterministic`. **Còn:** ANALYSIS synthesis + multi-turn
|
||||
> memory + streaming read-only + CODEGEN full model-router path + cloud live-smoke (key thật).
|
||||
>
|
||||
> Status 2026-07-08: **✅ MVP-0 + MVP-1 + MVP-2 + MVP-3 done+test.**
|
||||
> Đã implement **Ask CASAN — Read-only Evidence Assistant** qua harness + Control
|
||||
> Panel (`/api/v1/chat/ask`, `/chat` UI): Prompt Router deterministic
|
||||
@@ -246,10 +274,10 @@ flowchart TD
|
||||
### Track M — Model Provider Binding `[MVP-0 tối thiểu → lớn dần]`
|
||||
| Task | Việc | File | Verify (WSL) |
|
||||
|---|---|---|---|
|
||||
| 18.M.1 | `provider_id` per agent + `model_role` per skill; routing theo mode (nối Plan-03/02) | mới `config/model-providers.yaml` | mode → provider đúng |
|
||||
| 18.M.2 | Data policy `local/internal/cloud`: **PII/secret → cloud phải qua C3 guard** | nối `data-exfil-guard.sh` (C3) | PII→cloud không guard → BLOCK |
|
||||
| 18.M.3 | Credential ngoài repo (env/secret store), không commit | nối `secrets-scan.sh` | key trong repo → scan FAIL |
|
||||
| 18.M.4 | Provider-call audit + token/cost telemetry → H6 | nối H6 | mỗi call → có bản ghi cost |
|
||||
| 18.M.1 | ✅ `provider_id`/`model_role` binding + routing theo role; synthesis gọi `model-router.sh --role generate` | `config/model-providers.yaml` + `chat-readonly.py synthesize_answer` | `phase-chat-model-synthesis`: model mode → provider `local`, answer có citations |
|
||||
| 18.M.2 | 🟡 Data policy `local/internal/cloud`: cloud → ép `CASAN_PREFLIGHT=1` (harness-preflight PII→cloud C3). Live cloud test cần key thật | nối `harness-preflight.sh` | offline: model output secret → H4 output scan DENY fail-closed (test 5) |
|
||||
| 18.M.3 | ✅ Credential ngoài repo: chỉ `key_env` name trong config, key đọc từ env qua `model-call.py`; cloud key unset → fallback deterministic (không bịa) | `model-providers.yaml` + `model-call.py` | key unset → `reason=cloud_key_unset` |
|
||||
| 18.M.4 | ✅ Provider token/cost telemetry → H6: real `input/output_tokens` + `cost_source` per backend + `synthesis_mode` | `chat-readonly.py record_metrics` | test: H6 metric `ollama_local_real_tokens`, tokens 42/17 |
|
||||
|
||||
### Track 3 — Operator mode (registered actions) `[MVP-1]`
|
||||
| Task | Việc | File | Verify (WSL) |
|
||||
|
||||
Reference in New Issue
Block a user