mirror of
https://github.com/SikongJueluo/pi-extensions.git
synced 2026-10-05 11:52:55 +08:00
feat(ai-judge): add advisory model catalog and strict corpus replay
- add versioned advisory model catalog shipped with the package and a fail-closed loader - annotate the enforce session notice for untested, deprecated, and revoked models - add --strict to corpus-replay with 0/1/2 exit codes and reject strict subset runs - extract replay qualification into a pure module that recomputes matches and validates latencies - remove the documented-but-unimplemented --thinking flag and stamp reports with a corpus version - qualify gpt-5.6-sol as the first recommended entry and archive three real replay reports - revise the corpus to 2026-08-21.2 changing unclear-forward expected defer to deny
This commit is contained in:
@@ -36,7 +36,7 @@ pi install github.com/SikongJueluo/pi-extensions
|
||||
- `model`(可选,仅 v2):固定判官模型,不随会话模型切换。配置的模型不存在、无认证或 API 不支持时,该次询问记为基础设施失败并交人类,**绝不静默改用会话模型**;未配置时跟随当前会话模型
|
||||
- `timeoutMs`:5000–30000,默认 15000
|
||||
|
||||
强制模式每次会话启动时弹一次非阻塞通知,显示实际判官模型与风险契约;不逐次重复。
|
||||
强制模式每次会话启动时弹一次非阻塞通知,显示实际判官模型与风险契约;不逐次重复。若判官模型不在推荐目录里,通知会附带"未经项目测试,自担风险"提示(仅提示,不阻断——见下)。
|
||||
|
||||
## 强制模式 = 风险契约(不是安全认证)
|
||||
|
||||
@@ -46,13 +46,19 @@ pi install github.com/SikongJueluo/pi-extensions
|
||||
- **内置高风险 override**(窄范围代码级规则,不是 sandbox):明确的数据丢失/历史重写(`git clean -xfd`、`git reset --hard`、`git push --force`、`rm -rf ~` 等)、发布/部署/基础设施销毁(`npm publish`、`terraform destroy` 等)、提权/系统修改(`sudo`、`mkfs`、`dd of=/dev/*`、`shutdown` 等)、直接凭据读取/输出/删除(`cat ~/.ssh/id_*`、`~/.aws/credentials`、`~/.gnupg` 等)。Enforce 命中时不调模型、立即交人类;Shadow 命中时仍调模型(保留质量观测)并记录 override,最终照常人类决策。不解析别名/脚本内容/变量展开,没有 `alwaysPrompt` 配置
|
||||
- 回滚 = 配置切回 `shadow`
|
||||
|
||||
## 推荐模型目录(咨询性,不是认证)
|
||||
|
||||
包内 `src/models-catalog.json` 维护一份**版本化推荐模型清单**:每个条目记录 owner 用 corpus replay 实测某 provider/model 的结果——测试时间、prompt/corpus 版本、逐例匹配数、基础设施失败数、延迟摘要(p50/p95/max),以及包内完整报告路径(`reports/`)。条目可标 `deprecated`/`revoked`。
|
||||
|
||||
**推荐 ≠ 安全认证**:owner 测试只说明结构化输出/质量/延迟的**兼容性**,不构成任何安全承诺。目录外的模型**仍可用于 Enforce,风险自担**——运行时不设资格门(ADR 0008),目录只影响每会话通知与文档:列表外/已弃用模型在 Enforce 通知中附注状态,仅此而已。
|
||||
|
||||
历史治理(v4 及更早的 promotion cohort、三重记录门)已被 ADR 0008 取代,运行时不再读取 `promotion-records.jsonl`;旧记录与 cohort 报告原样保留作审计资料,见 `docs/testing/`。
|
||||
|
||||
## 日志与工具
|
||||
|
||||
- **判官审计日志**:`~/.pi/agent/extensions/pi-permission-ai-judge/logs/audit.jsonl`(逐条落盘;写入失败则标记不健康并拒绝强制授权)
|
||||
- **离线分析**:`npx tsx src/analyzer/cli.ts <review-log> --audit <audit-log> --after <t> --before <t>`
|
||||
- **语料重放**(质量环):`tools/corpus-replay.ts`,21 例对照集,需真实模型端点
|
||||
- **语料重放**(质量环):`tools/corpus-replay.ts`,21 例对照集,需真实模型端点。加 `--strict` 时按轻量资格标准严格退出:全部匹配、零基础设施失败、延迟在预算内 → exit 0,否则 exit 2(仅 setup 失败才是 exit 1);不加则保持观测语义 exit 0(保留不利结果,不过滤)
|
||||
- **测试**:`pnpm check && pnpm test`
|
||||
|
||||
## 文档
|
||||
|
||||
Reference in New Issue
Block a user