The ekb-mcp -> hose-use rename migration (LEGACY_* constants, syncLegacyEnterprisesDir/syncLegacyGlobalConfig with 7-day grace cleanup, dual-source enterprises resolution) has completed its job: legacy data self-deleted on active machines years of grace ago. Config resolution now returns the single primary ~/.config/hose-use source; startup no longer scans the legacy dir. - core/config/loader.ts: drop legacy constants, sync functions, and LEGACY path from diagnostics candidates; loader.test.ts drops the three legacy-migration cases - domains/approval/db.ts deleted: pure pass-through over core/db whose consumers (repository.ts) already call core/db directly; the four test files now import getDatabase/closeDatabase from core/db - scripts/dev-hygiene.ts: drop the config.legacy finding and legacyConfig snapshot field - docs/daily/* removed: Python-era (ekb-cli/ekb-mcp) notes describing commands and architecture that no longer exist (preserved in git history) No behavior change on machines without legacy data: tsc clean, 313 tests pass (316 minus the 3 removed legacy cases).
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卡点。 - 规则严格度分四级:
硬性/弹性/建议/特殊。