基于新方法论(§1.6 Fail-Closed / §3.2 规则 8-11 / §3.3 Monotonic Guard /
§3.4 Session Log 不变量)对 DGAgent 进行工程化升级:
P0 — Fail-closed:消除 7 处空 catch {} 静默降级,改 console.warn 记录错误
P1 — Session Log 扩展:
· 新增 SessionLogEntry 统一日志模型(含 tool_io / risk_process / user_confirmation)
· appendSessionLog() 统一写入路径,logToolIo() 便捷工厂
· writeAuditLog() 向后兼容双写(旧 audit.log + 新 session.log JSONL)
P2 — 规则 11:timeout_ms 从 dg_ssh_exec / dg_workflow_safe_exec schema 移除,
改为 环境变量读取(resolveSshTimeoutMs)
P3 — Monotonic Guard 框架:
· GuardChain + PatternGuard 接口,单调性取最严格等级
· 现有 assessRisk 保持 API 兼容,内部迁移至 GuardChain
P4 — 规则 10:freezeResult() 冻结工具结果,防篡改
测试:sdb-gate.test.ts 新增 7 个 GuardChain + freezeResult 用例(20→27)
23 lines
639 B
JSON
23 lines
639 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"module": "ESNext",
|
|
"moduleResolution": "bundler",
|
|
"strict": true,
|
|
"noEmit": true,
|
|
"esModuleInterop": true,
|
|
"skipLibCheck": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
"resolveJsonModule": true,
|
|
"isolatedModules": true,
|
|
"noUncheckedIndexedAccess": true,
|
|
"noImplicitOverride": true,
|
|
"noFallthroughCasesInSwitch": true,
|
|
"verbatimModuleSyntax": false,
|
|
"allowImportingTsExtensions": true,
|
|
"types": ["vitest/globals", "node"],
|
|
"lib": ["ES2022", "DOM"]
|
|
},
|
|
"include": ["extensions/**/*.ts", "tests/**/*.ts", "lib/**/*.ts"]
|
|
}
|