chore(repo): consolidate spec artifacts into specs/ and complete README coverage
- Move generated OpenAPI bundles out of dist/ into committed specs/ (specs/openapi.json, specs/openapi.raw.json); source YAML tree moves openapi/ -> specs/openapi/; schemas/workflow-schema.json joins as specs/workflow-schema.json - Update all generators/consumers: bundle-openapi, generate-raw-openapi, check-version-sync, bump-version, export-workflow-schema, packaging/embedded-openapi - Rewrite stale .env.example with current HOSE_* environment variables - Archive stale repo-local enterprise configs (superseded by ~/.config/hose-use/enterprises) out of the repo; root enterprises/ keeps only the tracked example.json plus an explanatory README - Add missing directory READMEs: approval/contact/message/task/events domains, cli/, http/, packaging/ - Fix stale domain doc links in README.domains.md and docs/modules/platform.md
This commit is contained in:
1 parent
6d532fc719
commit
a3b64d8c8d
29 files changed
+177
-28
No files matched your search
@@ -0,0 +1,17 @@
|
||||
# Approval 智能审批引擎域说明
|
||||
|
||||
本域是 AI PRO 的智能审批引擎:DSL 规则解析、确定性安全网关仲裁、要点核验与基于 `core/db` 的会话持久化。采用六件套微架构,导出形状统一经 `index.ts` barrel 暴露。
|
||||
|
||||
## 架构
|
||||
|
||||
- `parser.ts`:DSL 解析层,`parseRuleBody` 将自然语言/结构化规则文本解析为 `ParsedRule`,`validateRuleBody` / `validatePreferenceText` 提供语法校验。
|
||||
- `gateway.ts`:确定性仲裁门禁。`analyzeFindings` 汇总要点核验结论,`validateGatewayAction` 校验决策动作合法性,`evaluateGatewayPolicy` / `ApprovalGatewayPolicy` 实现策略仲裁(默认策略 `defaultGatewayPolicy`)。
|
||||
- `repository.ts`:数据访问层,`ApprovalRepository` 基于 `core/db` 管理审批规则、偏好、运行记录(run)、要点(finding)与 AI PRO 日志的持久化。
|
||||
- `service.ts`:业务编排层,`ApprovalService.injectAuditPoints`(要点核验注入)与 `decideAudit`(确定性审批决策)。
|
||||
- `db.ts`:SQLite schema 初始化与连接管理(`getApprovalDatabase`,路径可经 `HOSE_APPROVAL_DB` 覆盖),迁移统一收敛至 `core/db/migrations.ts`。
|
||||
- `types.ts`:`StrictnessTier`、`ParsedRule`、`ApprovalDecision`、`ApprovalRunRecord` 等模型定义。
|
||||
|
||||
## 关键约束
|
||||
|
||||
- 决策必须经 gateway 仲裁:`ApprovalDecision` 为封闭枚举(`APPROVE` / `REJECT` / `PASS_WITH_NOTE` / `REVIEW` / `PENDING` / `ERROR`),写动作由 `validateGatewayAction` 卡点。
|
||||
- 规则严格度分四级:`硬性` / `弹性` / `建议` / `特殊`。
|
||||
Reference in new issue
Block a user