@cyning/harness 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +4 -3
- package/docs/USER_GUIDE_v1.0_zh.md +56 -6
- package/docs/methodology/ROADMAP_v1_zh.md +3 -3
- package/docs/methodology/graph/DECISIONS_hgm_g1_maintainer_v1_zh.md +196 -0
- package/docs/methodology/graph/HGM_UPGRADE_OUTLINE_v1_zh.md +20 -12
- package/docs/methodology/graph/schemas/hgm_event_v1.schema.json +301 -0
- package/examples/compliance_bench/README.md +7 -7
- package/examples/compliance_bench/S5_rejected_draft/task.md +33 -0
- package/lib/cli.js +141 -11
- package/lib/graph-hgm.js +648 -0
- package/ontology.yaml +1 -1
- package/package.json +1 -1
- package/wizard/compliance-bench.sh +51 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# SDD-Compliance micro-bench · v1 · S1–
|
|
2
|
+
# SDD-Compliance micro-bench · v1 · S1–S5
|
|
3
3
|
# 输出合规率 %;不测 LLM 解题,只测 Orchestrate/Verify 可机械部分。
|
|
4
4
|
set -euo pipefail
|
|
5
5
|
|
|
@@ -12,14 +12,14 @@ QUIET=0
|
|
|
12
12
|
|
|
13
13
|
usage() {
|
|
14
14
|
cat <<'EOF'
|
|
15
|
-
用法:compliance-bench.sh [--all | S1 S2 S3 S4] [--quiet]
|
|
15
|
+
用法:compliance-bench.sh [--all | S1 S2 S3 S4 S5] [--quiet]
|
|
16
16
|
|
|
17
|
-
--all 运行 S1–
|
|
17
|
+
--all 运行 S1–S5(默认输出含公理解释与摘要表)
|
|
18
18
|
--quiet CI/脚本模式:stdout 仅打印合规率数字;摘要说明走 stderr
|
|
19
19
|
|
|
20
20
|
说明:
|
|
21
21
|
合规率 = PASS 场景数 ÷ 总场景数 × 100。
|
|
22
|
-
100 表示 S1–
|
|
22
|
+
100 表示 S1–S5 全部通过,即 gate-check / sync 行为符合 SDD 公理;
|
|
23
23
|
不是 LLM 解题正确率,也不是业务项目胜率。
|
|
24
24
|
|
|
25
25
|
示例:
|
|
@@ -30,9 +30,9 @@ EOF
|
|
|
30
30
|
|
|
31
31
|
while [[ $# -gt 0 ]]; do
|
|
32
32
|
case "$1" in
|
|
33
|
-
--all) SCENARIOS=(S1 S2 S3 S4); shift ;;
|
|
33
|
+
--all) SCENARIOS=(S1 S2 S3 S4 S5); shift ;;
|
|
34
34
|
--quiet) QUIET=1; shift ;;
|
|
35
|
-
S1|S2|S3|S4) SCENARIOS+=("$1"); shift ;;
|
|
35
|
+
S1|S2|S3|S4|S5) SCENARIOS+=("$1"); shift ;;
|
|
36
36
|
-h|--help) usage; exit 0 ;;
|
|
37
37
|
*) echo "未知参数: $1" >&2; usage; exit 1 ;;
|
|
38
38
|
esac
|
|
@@ -53,14 +53,26 @@ log_scenario() {
|
|
|
53
53
|
[[ "$QUIET" == "1" ]] || echo "$@"
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
gate_status() {
|
|
57
|
+
local file="$1" gate="$2"
|
|
58
|
+
awk -F'|' -v g="$gate" '
|
|
59
|
+
$0 ~ /^[[:space:]]*\|/ && index($0, g) > 0 {
|
|
60
|
+
gsub(/^[[:space:]]+|[[:space:]]+$/, "", $3)
|
|
61
|
+
gsub(/\*/, "", $3)
|
|
62
|
+
print $3
|
|
63
|
+
exit
|
|
64
|
+
}
|
|
65
|
+
' "$file"
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
print_banner() {
|
|
57
69
|
[[ "$QUIET" == "1" ]] && return 0
|
|
58
70
|
log_scenario "╔══════════════════════════════════════════════════════════════╗"
|
|
59
|
-
log_scenario "║ SDD-Compliance micro-bench · v1 · S1–
|
|
71
|
+
log_scenario "║ SDD-Compliance micro-bench · v1 · S1–S5 ║"
|
|
60
72
|
log_scenario "╚══════════════════════════════════════════════════════════════╝"
|
|
61
73
|
log_scenario ""
|
|
62
74
|
log_scenario "性质 机械合规测试 · 合成夹具 · 不调用 LLM"
|
|
63
|
-
log_scenario "公理 D2 HumanGate · D3 30 前置闸 · S2 sync
|
|
75
|
+
log_scenario "公理 D2 HumanGate · D3 30 前置闸 · S2 sync 域 · rejected→draft"
|
|
64
76
|
log_scenario "夹具 $BENCH_DIR/"
|
|
65
77
|
log_scenario "场景 ${SCENARIOS[*]}"
|
|
66
78
|
log_scenario ""
|
|
@@ -199,6 +211,36 @@ scenario_S4() {
|
|
|
199
211
|
fi
|
|
200
212
|
}
|
|
201
213
|
|
|
214
|
+
task_status() {
|
|
215
|
+
local file="$1"
|
|
216
|
+
sed -n 's/.*\*\*状态\*\*[^`]*`\([^`]*\)`.*/\1/p' "$file" | head -1
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
scenario_S5() {
|
|
220
|
+
local dir="$BENCH_DIR/S5_rejected_draft"
|
|
221
|
+
local tf="$dir/task.md"
|
|
222
|
+
scenario_header "S5" "rejected→draft · task 须回 draft" \
|
|
223
|
+
"rejected→draft(与 HGM axioms 同语义)" \
|
|
224
|
+
"examples/compliance_bench/S5_rejected_draft/" \
|
|
225
|
+
"HG-AUDIT-R1=rejected 且 task status=draft → 合规"
|
|
226
|
+
|
|
227
|
+
local audit status
|
|
228
|
+
audit="$(gate_status "$tf" HG-AUDIT-R1)"
|
|
229
|
+
status="$(task_status "$tf")"
|
|
230
|
+
|
|
231
|
+
if [[ "$audit" == "rejected" && "$status" == "draft" ]]; then
|
|
232
|
+
scenario_footer "S5" "PASS" "gate rejected · task draft" \
|
|
233
|
+
"否决后 task 已回 draft · 符合 rejected→draft 公理(bench 静态态 · axioms 为事件流真值)"
|
|
234
|
+
PASS=$((PASS+1))
|
|
235
|
+
RESULTS+=("S5|PASS|rejected gate + draft status")
|
|
236
|
+
else
|
|
237
|
+
scenario_footer "S5" "FAIL" "audit=$audit status=$status" \
|
|
238
|
+
"rejected 后 task 须 draft · 检查夹具或 gate-check 行为"
|
|
239
|
+
FAIL=$((FAIL+1))
|
|
240
|
+
RESULTS+=("S5|FAIL|audit=$audit status=$status")
|
|
241
|
+
fi
|
|
242
|
+
}
|
|
243
|
+
|
|
202
244
|
print_summary() {
|
|
203
245
|
local total=$((PASS+FAIL))
|
|
204
246
|
local rate=0
|
|
@@ -243,6 +285,7 @@ for s in "${SCENARIOS[@]}"; do
|
|
|
243
285
|
S2) scenario_S2 ;;
|
|
244
286
|
S3) scenario_S3 ;;
|
|
245
287
|
S4) scenario_S4 ;;
|
|
288
|
+
S5) scenario_S5 ;;
|
|
246
289
|
esac
|
|
247
290
|
done
|
|
248
291
|
|