feat: add governed chat console

This commit is contained in:
thanhnv
2026-07-08 21:14:40 +09:00
parent 3be9970c15
commit 5561bcf864
28 changed files with 2023 additions and 43 deletions
@@ -0,0 +1,34 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "CASAN ChatTurn MVP-0",
"type": "object",
"required": [
"seq",
"timestamp",
"chat_id",
"turn_id",
"tenant_id",
"actor",
"mode",
"decision",
"user_msg_ref",
"answer_ref",
"prev_hash",
"record_hash"
],
"properties": {
"seq": { "type": "integer", "minimum": 1 },
"timestamp": { "type": "string" },
"chat_id": { "type": "string" },
"turn_id": { "type": "string" },
"tenant_id": { "type": "string" },
"actor": { "type": "string" },
"mode": { "enum": ["READ_ONLY", "BLOCK", "NOT_SUPPORTED"] },
"decision": { "enum": ["ANSWERED", "DENIED", "NOT_SUPPORTED"] },
"user_msg_ref": { "type": "string" },
"answer_ref": { "type": "string" },
"sources": { "type": "array" },
"prev_hash": { "type": "string" },
"record_hash": { "type": "string" }
}
}
@@ -0,0 +1,32 @@
{
"version": 1,
"actions": [
{
"id": "run-chat-tests",
"label": "Run Chat MVP Tests",
"description": "Run the deterministic Plan-18 prompt-router smoke suite.",
"triggers": ["run tests", "run chat tests"],
"command": ["bash", "packages/casan-harness/tests/phase-chat-prompt-router-tests.sh"],
"writes": [],
"timeout_s": 30
},
{
"id": "build-evidence-pack",
"label": "Build Evidence Pack",
"description": "Build an evidence pack under the chat operator state directory.",
"triggers": ["build pack", "build evidence pack"],
"command": ["bash", "packages/casan-harness/scripts/bash/evidence-pack.sh", "pack", "chat-operator", "--out", "${CASAN_STATE_ROOT}/operator/evidence-pack"],
"writes": ["${CASAN_STATE_ROOT}/operator/evidence-pack"],
"timeout_s": 60
},
{
"id": "verify-evidence-pack",
"label": "Verify Evidence Pack",
"description": "Verify the chat operator evidence pack manifest and signature state.",
"triggers": ["verify pack", "verify evidence pack"],
"command": ["bash", "packages/casan-harness/scripts/bash/evidence-pack.sh", "verify-pack", "chat-operator", "--dir", "${CASAN_STATE_ROOT}/operator/evidence-pack"],
"writes": [],
"timeout_s": 30
}
]
}
@@ -0,0 +1,66 @@
{
"version": 1,
"mvp_modes": ["READ_ONLY", "OPERATOR", "BLOCK", "NOT_SUPPORTED"],
"read_only": {
"risk": "low",
"gates": ["H4_INPUT", "H4_OUTPUT", "H5_CHAT_AUDIT", "H6_TOKEN"],
"needs_approval": false
},
"not_supported": {
"risk": "medium",
"gates": ["H4_INPUT", "ACTION_GATE"],
"needs_approval": true
},
"operator": {
"risk": "medium",
"gates": ["H4_INPUT", "ACTION_GATE", "H4_OUTPUT", "H5_CHAT_AUDIT", "H6_TOKEN"],
"needs_approval": false
},
"block": {
"risk": "high",
"gates": ["H4_INPUT", "H5_CHAT_AUDIT"],
"needs_approval": false
},
"read_only_terms": [
"what", "why", "how", "explain", "summarize", "summary", "status", "show",
"list", "where", "when", "plan", "evidence", "source", "docs", "report",
"audit", "governance", "security", "finops", "traceability", "casan"
],
"block_patterns": [
"ignore previous instructions",
"bypass guard",
"reveal system prompt",
"show hidden instruction",
"rm -rf",
"drop table",
"export secrets",
"dump database",
"private key",
"api key"
],
"not_supported_patterns": [
"deploy",
"run command",
"execute",
"write a file",
"write file",
"edit a file",
"edit file",
"modify code",
"create a file",
"create file",
"delete a file",
"delete file",
"chmod",
"curl http",
"/etc/passwd"
],
"operator_terms": [
"run tests",
"run chat tests",
"build pack",
"build evidence pack",
"verify pack",
"verify evidence pack"
]
}