@dommaker/harness 1.12.0 → 1.14.0
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 +19 -0
- package/dist/cli/commands/check.js +3 -3
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/security.d.ts +19 -0
- package/dist/cli/commands/security.d.ts.map +1 -1
- package/dist/cli/commands/security.js +105 -0
- package/dist/cli/commands/security.js.map +1 -1
- package/dist/core/app-constraints-loader.d.ts +5 -3
- package/dist/core/app-constraints-loader.d.ts.map +1 -1
- package/dist/core/app-constraints-loader.js +20 -7
- package/dist/core/app-constraints-loader.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +5 -3
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +31 -10
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +21 -8
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.js +7 -1
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js +41 -26
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.d.ts +3 -0
- package/dist/core/constraints/checkers/governance-presence.d.ts.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.js +7 -10
- package/dist/core/constraints/checkers/governance-presence.js.map +1 -1
- package/dist/core/constraints/checkers/index.d.ts +6 -6
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +14 -9
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/iron-flags.js +1 -1
- package/dist/core/constraints/checkers/iron-flags.js.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +11 -4
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +117 -30
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -1
- package/dist/core/constraints/checkers/no-test-simplification.d.ts +16 -2
- package/dist/core/constraints/checkers/no-test-simplification.d.ts.map +1 -1
- package/dist/core/constraints/checkers/no-test-simplification.js +115 -15
- package/dist/core/constraints/checkers/no-test-simplification.js.map +1 -1
- package/dist/core/constraints/checkers/templated/exec.d.ts +19 -0
- package/dist/core/constraints/checkers/templated/exec.d.ts.map +1 -0
- package/dist/core/constraints/checkers/templated/exec.js +124 -0
- package/dist/core/constraints/checkers/templated/exec.js.map +1 -0
- package/dist/core/constraints/checkers/templated/index.d.ts +1 -0
- package/dist/core/constraints/checkers/templated/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templated/index.js +3 -1
- package/dist/core/constraints/checkers/templated/index.js.map +1 -1
- package/dist/core/constraints/checkers/templates-registry.d.ts +2 -1
- package/dist/core/constraints/checkers/templates-registry.d.ts.map +1 -1
- package/dist/core/constraints/checkers/templates-registry.js +3 -1
- package/dist/core/constraints/checkers/templates-registry.js.map +1 -1
- package/dist/core/constraints/checkers/types.d.ts +67 -6
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +51 -6
- package/dist/core/constraints/checkers/types.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.d.ts +1 -0
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +4 -0
- package/dist/core/constraints/definitions/guidelines.js.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.d.ts +1 -0
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.js +6 -1
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
- package/dist/core/constraints/definitions.d.ts +7 -0
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +10 -0
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/core/constraints/git-evidence.d.ts +10 -0
- package/dist/core/constraints/git-evidence.d.ts.map +1 -1
- package/dist/core/constraints/git-evidence.js +2 -0
- package/dist/core/constraints/git-evidence.js.map +1 -1
- package/dist/core/constraints/index.d.ts +3 -1
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +8 -1
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -1
- package/dist/core/index.js.map +1 -1
- package/dist/gates/checker-gate.d.ts +5 -1
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +10 -3
- package/dist/gates/checker-gate.js.map +1 -1
- package/dist/gates/command.d.ts +5 -1
- package/dist/gates/command.d.ts.map +1 -1
- package/dist/gates/command.js +6 -2
- package/dist/gates/command.js.map +1 -1
- package/dist/gates/definitions.d.ts.map +1 -1
- package/dist/gates/definitions.js +6 -1
- package/dist/gates/definitions.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/pretool-use-hook.d.ts +13 -4
- package/dist/pretool-use-hook.d.ts.map +1 -1
- package/dist/pretool-use-hook.js +89 -8
- package/dist/pretool-use-hook.js.map +1 -1
- package/dist/types/constraint.d.ts +32 -3
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +6 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/trace.d.ts +7 -0
- package/dist/types/trace.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/CONTEXT.md +2 -2
- package/src/__tests__/app-constraints-loader.test.ts +86 -3
- package/src/__tests__/checker-extra.test.ts +80 -4
- package/src/__tests__/checker-primitives-sdk.test.ts +70 -0
- package/src/__tests__/exec-checker-full-chain.test.ts +118 -0
- package/src/__tests__/layering.test.ts +3 -1
- package/src/__tests__/pretool-use-hook.test.ts +211 -4
- package/src/__tests__/public-exports.test.ts +5 -0
- package/src/__tests__/public-type-surface.test.ts +22 -0
- package/src/__tests__/public-value-surface.test.ts +5 -0
- package/src/cli/commands/CONTEXT.md +1 -1
- package/src/cli/commands/__tests__/check-skip-output.test.ts +4 -4
- package/src/cli/commands/__tests__/check.test.ts +2 -0
- package/src/cli/commands/__tests__/security.test.ts +89 -1
- package/src/cli/commands/check.ts +3 -3
- package/src/cli/commands/security.ts +99 -0
- package/src/core/CONTEXT.md +6 -6
- package/src/core/app-constraints-loader.ts +23 -8
- package/src/core/constraints/__tests__/git-evidence.test.ts +20 -0
- package/src/core/constraints/__tests__/run-env.test.ts +2 -0
- package/src/core/constraints/checker.ts +35 -12
- package/src/core/constraints/checkers/__tests__/capability-sync.test.ts +21 -3
- package/src/core/constraints/checkers/__tests__/context-doc-sync.test.ts +20 -12
- package/src/core/constraints/checkers/__tests__/docs-freshness-degraded.test.ts +89 -0
- package/src/core/constraints/checkers/__tests__/docs-freshness.test.ts +4 -2
- package/src/core/constraints/checkers/__tests__/exec-checker.test.ts +99 -0
- package/src/core/constraints/checkers/__tests__/fixtures/public-repo-sanitization.mjs +40 -0
- package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +23 -2
- package/src/core/constraints/checkers/__tests__/input-contract.test.ts +135 -0
- package/src/core/constraints/checkers/__tests__/iron-flags.test.ts +15 -2
- package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +110 -5
- package/src/core/constraints/checkers/__tests__/no-test-simplification.test.ts +144 -21
- package/src/core/constraints/checkers/__tests__/three-state-consistency.test.ts +6 -2
- package/src/core/constraints/checkers/capability-sync.ts +24 -10
- package/src/core/constraints/checkers/context-doc-sync.ts +8 -1
- package/src/core/constraints/checkers/docs-freshness.ts +44 -26
- package/src/core/constraints/checkers/governance-presence.ts +7 -8
- package/src/core/constraints/checkers/index.ts +22 -10
- package/src/core/constraints/checkers/iron-flags.ts +1 -1
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +135 -29
- package/src/core/constraints/checkers/no-test-simplification.ts +128 -17
- package/src/core/constraints/checkers/templated/exec.ts +138 -0
- package/src/core/constraints/checkers/templated/index.ts +1 -0
- package/src/core/constraints/checkers/templates-registry.ts +4 -2
- package/src/core/constraints/checkers/types.ts +106 -9
- package/src/core/constraints/definitions/guidelines.ts +4 -0
- package/src/core/constraints/definitions/iron-laws.ts +6 -1
- package/src/core/constraints/definitions.ts +10 -0
- package/src/core/constraints/git-evidence.ts +13 -0
- package/src/core/constraints/index.ts +22 -0
- package/src/core/index.ts +16 -0
- package/src/gates/CONTEXT.md +3 -3
- package/src/gates/__tests__/checker-gate.test.ts +19 -2
- package/src/gates/checker-gate.ts +11 -4
- package/src/gates/command.ts +6 -2
- package/src/gates/definitions.ts +6 -1
- package/src/index.ts +26 -0
- package/src/pretool-use-hook.ts +104 -10
- package/src/types/constraint.ts +35 -3
- package/src/types/trace.ts +8 -0
package/src/core/index.ts
CHANGED
|
@@ -18,6 +18,11 @@ export {
|
|
|
18
18
|
constraintChecker,
|
|
19
19
|
CheckCache,
|
|
20
20
|
ConstraintViolationError,
|
|
21
|
+
buildCheckEnv,
|
|
22
|
+
normalizeCheckOutcome,
|
|
23
|
+
formatEvidence,
|
|
24
|
+
contextFlag,
|
|
25
|
+
contextEvidenceFlag,
|
|
21
26
|
} from './constraints';
|
|
22
27
|
export type {
|
|
23
28
|
CheckConstraintsOptions,
|
|
@@ -25,6 +30,7 @@ export type {
|
|
|
25
30
|
CheckSamplingConfig,
|
|
26
31
|
ConstraintId,
|
|
27
32
|
ConstraintKind,
|
|
33
|
+
ConstraintChannel,
|
|
28
34
|
ConstraintSeverity,
|
|
29
35
|
ConstraintTrigger,
|
|
30
36
|
Constraint,
|
|
@@ -32,6 +38,16 @@ export type {
|
|
|
32
38
|
ConstraintContext,
|
|
33
39
|
ConstraintCheckResult,
|
|
34
40
|
IronLawContext,
|
|
41
|
+
ConstraintCheck,
|
|
42
|
+
CheckEnv,
|
|
43
|
+
CheckOutcome,
|
|
44
|
+
CheckDetail,
|
|
45
|
+
CheckSkip,
|
|
46
|
+
NormalizedOutcome,
|
|
47
|
+
EvidenceProviders,
|
|
48
|
+
CheckInputNeeds,
|
|
49
|
+
CheckEvidenceInput,
|
|
50
|
+
ContextEvidenceFlag,
|
|
35
51
|
} from './constraints';
|
|
36
52
|
|
|
37
53
|
// 验证器(检查点 / PassesGate / CSO)
|
package/src/gates/CONTEXT.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- 定义表:`GATE_DEFINITIONS`(`definitions.ts`)——id/description/默认 order/CLI 元数据;CLI 元数据形状即 `CommandDefinition`(ADR-0007:门禁与非门禁共用同一命令定义形状,bin 单引擎单循环;门禁特有语义 = `subcommandStrict:false` 未知子命令落回默认 action + `bareRunsAction:true` 裸跑执行 action);bin/harness.js 注册表驱动生成 6 门禁命令(纯数据模块,禁 import 实现,保 --help 懒加载;CLI 实现引用为 module+export,per-command 懒加载,H5)
|
|
10
10
|
- 执行器:`runGates`(`runner.ts`)——按 order 升序;deny 单调(下游 abstain 不得改回 allow)+ ask 枚举预留 fail-closed = deny;决策浅冻结
|
|
11
11
|
- 生效集(已删除):原 `getEffectiveGates` + config.yml `gates.order` / `gates.<id>.enabled` 三重空——无调用方、无任何项目配置过该段、README 无示例且加载器对顶层键名拼错静默通过。`order` 字段与 `runGates` 保留(链内默认序 + 复开点),裁决理由记在 ADR-0002 文末「后续变更」
|
|
12
|
-
- checker-as-guard 接线点:`createCheckerGate(check)`(`checker-gate.ts`)——ConstraintCheck → Gate(studio #129 随动);判定经唯一归一点 `normalizeCheckOutcome`(harness#119/ADR-0016):`false` 或 `CheckDetail.pass=false` → deny(证据行随理由带出),`true`(含 pass+提示)/
|
|
12
|
+
- checker-as-guard 接线点:`createCheckerGate(check)`(`checker-gate.ts`)——ConstraintCheck → Gate(studio #129 随动);判定经唯一归一点 `normalizeCheckOutcome`(harness#119/ADR-0016):`false` 或 `CheckDetail.pass=false` → deny(证据行随理由带出),`true`(含 pass+提示)/skip → abstain(理由带出 skip 原因);env 经 `buildCheckEnv(..., 'none')` 构造(显式不接证据,语义见 core/constraints/checkers/types.ts 工厂 doc)——输入契约(harness#182):声明了 git 证据需求的 checker 在此输入必缺,经 `findMissingInputs` 走与编排层同一降级路径(带原因 skip → abstain,不对空证据假评估);`ctx.runEnv` 传入即整条守卫链共用一枚运行级观察面——项目配置文件整链至多读一次,不传则每道门禁自造一枚一次性观察面(判定不变,ADR-0023)
|
|
13
13
|
- 门禁类:`ReviewGate` / `SecurityGate` / `PerformanceGate` / `ContractGate` / `SpecAcceptanceGate` / `CommandGate`(各自执行细节私有,保留 `check()`/`scan()` 报告方法);SpecAcceptanceGate 的 runner 输出解读与 e2e 判负都从 `core/validators/test-output.ts` 的 `judgeTestRun` 取(解析收口 ADR-0012、判定依据 ADR-0014,本层既不自带正则也不自写判定 `if`)
|
|
14
14
|
- 命令黑名单的模块级出口(`command.ts`):规则表正本 `DEFAULT_COMMAND_BLACKLIST`(每台 `CommandGate` 实例构造时拷它作基线,运行时扩展点是 `addRule()`)、默认实例单例出口 `getCommandGate()`、快捷判定 `isCommandAllowed(command)` → boolean 与 `getCommandRiskLevel(command)` → `'high' | 'medium' | 'low'`(后三者都经包根对下游公开,ADR-0003 显式清单)。仓内不靠它们做判定:CLI `command` 用带配置的那台实例(#135/ADR-0024,`command-gate-dead-options.test.ts` 钉住 CLI 源码零引用 `getCommandGate(`/`getCommandRiskLevel`),hook 恒裸构造(见「约定」);`DEFAULT_COMMAND_BLACKLIST` 的仓内消费者是 `harness command --list` 的展示
|
|
15
15
|
- `types.ts` — GateResult(报告结构,保留)/ GateContext / GateDecision 等公共类型 + 报告构造器 `pass` / `fail` / `fromError`(动态 passed 走 `gateResult`):timestamp 与 duration 口径唯一落点,门禁实现禁止手写 GateResult 字面量(duration 是可选字段,漏写无编译期报错)。**`GateContext` 只带运行信息(在哪跑 / 跑什么),配置一律走构造器**——曾有 6 个与构造器平行的配置型字段(`projectId` 等),填了不生效,已删(架构评审候选1)
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
## 约定
|
|
23
23
|
- 新门禁必须:① 在 `definitions.ts` 补 GateDefinition(含 CLI 元数据)② 在 `registry.ts` IMPLEMENTATIONS 注册实现(缺一 → 加载期抛错)③ 实现统一 Gate 接口(evaluate 产三态决策,报告由 `types.ts` 的 `pass`/`fail`/`fromError`/`gateResult` 构造,不手写字面量)④ 配 CLI 命令(命令实现文件 + CLI 元数据的 module+export 引用,bin 由定义表驱动生成,不再手写块)+ 测试文件
|
|
24
24
|
- deny 单调是接口契约:决策浅冻结,下游不得改写上游决策
|
|
25
|
-
- **统一接口 `evaluate()` 的生产消费者 = 6 个门禁 CLI 命令**(架构评审候选1 步骤 2):命令一律穿过 `evaluate()`,`GateDecision → CommandResult` 的映射与失败措辞收在 `src/cli/gate-command.ts` 一处,不再各写一遍(此前是 6 份 `<id> gate denied` + 4 份 `<id> gate error`)。报告面 `check()`/`scan()` 仍是各门禁私有实现,只展示不判断的子命令(`security audit`
|
|
25
|
+
- **统一接口 `evaluate()` 的生产消费者 = 6 个门禁 CLI 命令**(架构评审候选1 步骤 2):命令一律穿过 `evaluate()`,`GateDecision → CommandResult` 的映射与失败措辞收在 `src/cli/gate-command.ts` 一处,不再各写一遍(此前是 6 份 `<id> gate denied` + 4 份 `<id> gate error`)。报告面 `check()`/`scan()` 仍是各门禁私有实现,只展示不判断的子命令(`security audit` 等)直读它;例外:`security secrets`(P1-8)不经 SecurityGate,直跑 gitleaks(命令包外部二进制、缺失 skip 的口径与门禁 evaluate 语义不同,见 cli/commands/CONTEXT.md)
|
|
26
26
|
- `runGates` 是 Gate **链**语义的参考实现(deny 单调 / ask fail-closed / 全决策浅冻结):链级无生产调用方——6 个命令各跑一项(CLI 文件驱动逐命令执行),studio `runCompletionGuards` 是自己的三个 checker、不 import 本层,故消费方只有测试。「deny 后短路跳过剩余门禁」类优化在出现真实链消费者前不做——它与「按执行顺序的全部决策」报告契约直接冲突,短路等于改 GateResult 语义(harness#115 裁决,防后续评审重复提议);`order` 字段与本执行器即为该复开点保留(config.yml 的声明式顺序/开关面按 ADR-0022 口径收缩,理由记在 ADR-0002 文末「后续变更」)
|
|
27
27
|
- ask 枚举预留:暂无实现,runGates fail-closed 按 deny 计
|
|
28
28
|
- **收到的根要传到自己每个 IO/执行点(harness#95)**:门禁只认 `context.projectPath`,内部相对子路径一律锚到它(`SpecAcceptanceGate` 的 tasksPath、`ContractGate` 的 contractPath、e2e/scan 的 `cwd`),禁止「根已传入却又取 cwd」、禁止 `xxxPath: './…'` 相对默认值——否则 `-p` 半失效且表现为假绿(acceptance 的「无 tasks.yml 即跳过」= passed:true)。本层唯一保留的 cwd 站点是 `checker-gate` 对 `ctx.projectPath` 的缺省兜底(豁免理由见守护表)。适用域自 #139 起覆盖到 monitoring 侧的落点默认值:约定正本是「相对片段(`DEFAULT_TRACE_FILE`)必须由消费点锚根」,闸 3 的键名后缀由 `Path` 扩到 `Path|File|Log` 并新增 `xxxFile: SOME_CONSTANT` 常量引用臂(本层曾漏检的形状正是它)。约定正本与四道机器可检的闸见 `src/cli/commands/CONTEXT.md`
|
|
29
|
-
- **CommandGate 的匹配语义只有一个落点(#135/ADR-0024)**:谓词 `
|
|
29
|
+
- **CommandGate 的匹配语义只有一个落点(#135/ADR-0024)**:谓词 `match`(规则表遍历 + 类别忽略 + 模式测试)与折裁点 `judge`(级别 → 三桶 + `allowed` + `riskLevel`),`check()` / `isAllowed()` / `getRiskLevel()` 是这份裁决的三个投影——禁止在投影里再写匹配循环。`match` 原为私有,P1-7(ADR-0031,wayfinder 票08)起提为公共同步只读面:pretool-use-hook 需要命中明细(rule id/level)写审计 trace,`isAllowed` 的布尔投影丢掉了 hits;谓词语义不变,调用方不得改返回数组。等级取命中集合里的最高档而非首条命中,不变式「存在阻断级命中 ⟺ `check` 不通过 ⟺ `isAllowed` false ⟺ 等级 high」由 `__tests__/command-single-predicate.test.ts` 的源形状闸(`pattern.test(` / `ignoreCategories.includes(` / 遍历规则表的循环体各恰好一处)+ 三投影一致性闸钉住
|
|
30
30
|
- **hook 只用出厂规则(#135 裁决,不是疏漏)**:`src/pretool-use-hook.ts` 恒裸构造 `new CommandGate()`,不装项目配置——hook 是 fail-open 的纵深防御一道,阻断级之外的命中同样放行(`isAllowed` 只看阻断级);配置装载只属于 CLI 侧(`harness command`,判定与 `--level` 共用它创建的那台实例)。两条入口是同一决策模块的两个 adapter,不得在 hook 路径另起一套判定
|
|
31
31
|
- **本入口的值面(24 项运行时导出)逐字冻结在 `src/__tests__/public-value-surface.test.ts`**(ADR-0022 追记第 5 条收口):删掉或新增任一值导出——含上面 6 个 `create*Gate` 工厂(其中 5 个是本入口内联声明)——即红且指名 `./gates` 与符号,「这个函数不在公开面上、删它非 breaking」不再靠人 grep。本入口的值导出恰好全数是包根 `.` 的子集,删除会连带撞 `public-exports.test.ts`,但那个套件报的是 `.`、分不清入口归属;类型面另归 `public-type-surface.test.ts`。增删属公共面 breaking,须走发布级别裁决(ADR-0003/0022)
|
|
32
32
|
|
|
@@ -28,13 +28,30 @@ describe('createCheckerGate', () => {
|
|
|
28
28
|
expect(decision.result.message).toContain('判定违规');
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
it('证据未接线(skip)→ abstain
|
|
31
|
+
it('证据未接线(skip)→ abstain(不阻断),理由带出 skip 原因(harness#182)', async () => {
|
|
32
32
|
const gate = createCheckerGate(
|
|
33
|
-
contextEvidenceFlag('flag-skip',
|
|
33
|
+
contextEvidenceFlag('flag-skip', 'hasVerificationEvidence')
|
|
34
34
|
);
|
|
35
35
|
const decision = await gate.evaluate(ctx);
|
|
36
36
|
expect(decision.status).toBe('abstain');
|
|
37
37
|
expect(decision.result.message).toContain('跳过');
|
|
38
|
+
expect(decision.result.message).toContain('hasVerificationEvidence 未接线');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('git 证据需求在 gate 环境必缺(env 不接证据)→ abstain,不假评估(harness#182 输入契约)', async () => {
|
|
42
|
+
let evaluated = false;
|
|
43
|
+
const gate = createCheckerGate({
|
|
44
|
+
id: 'needs-git',
|
|
45
|
+
needs: { evidence: ['stagedDiff'] },
|
|
46
|
+
evaluate: () => {
|
|
47
|
+
evaluated = true;
|
|
48
|
+
return true;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const decision = await gate.evaluate(ctx);
|
|
52
|
+
expect(evaluated).toBe(false);
|
|
53
|
+
expect(decision.status).toBe('abstain');
|
|
54
|
+
expect(decision.result.message).toContain('staged diff 不可得');
|
|
38
55
|
});
|
|
39
56
|
|
|
40
57
|
// harness#119:CheckDetail 形状接入后,映射必须经 normalizeCheckOutcome——
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { ConstraintCheck } from '../core/constraints/checkers';
|
|
12
|
-
import { buildCheckEnv, normalizeCheckOutcome } from '../core/constraints/checkers';
|
|
12
|
+
import { buildCheckEnv, normalizeCheckOutcome, degradeForMissingInputs } from '../core/constraints/checkers';
|
|
13
13
|
import type { Gate, GateContext, GateDecision } from './types';
|
|
14
14
|
import { gateResult } from './types';
|
|
15
15
|
import { decisionFromResult } from './decision';
|
|
@@ -18,7 +18,11 @@ import { decisionFromResult } from './decision';
|
|
|
18
18
|
* 将已注册 checker 适配为统一 Gate(checker-as-guard 接线点)
|
|
19
19
|
*
|
|
20
20
|
* 判定映射:violated(false 或 CheckDetail.pass=false)→ deny;
|
|
21
|
-
* 满足 /
|
|
21
|
+
* 满足 / skip(未评估)→ abstain。违规证据随理由带出。
|
|
22
|
+
*
|
|
23
|
+
* 输入契约(harness#182):env 显式不接证据('none'),声明了 git 证据需求的
|
|
24
|
+
* checker 在此输入必缺——与编排层同一降级路径(带原因的 skipped → abstain),
|
|
25
|
+
* 不再让 checker 对空证据假评估。
|
|
22
26
|
*
|
|
23
27
|
* @param check 已注册的 ConstraintCheck(经 checkers 注册表取回)
|
|
24
28
|
* @param order 门禁顺序(供 guard 链排序)
|
|
@@ -31,10 +35,13 @@ export function createCheckerGate(check: ConstraintCheck, order = 0): Gate {
|
|
|
31
35
|
const startTime = Date.now();
|
|
32
36
|
const projectPath = ctx.projectPath || process.cwd();
|
|
33
37
|
const env = buildCheckEnv({ operation: 'manual', projectPath }, 'none', ctx.runEnv);
|
|
34
|
-
const
|
|
38
|
+
const degraded = degradeForMissingInputs(check, env);
|
|
39
|
+
const outcome = degraded
|
|
40
|
+
? normalizeCheckOutcome(degraded)
|
|
41
|
+
: normalizeCheckOutcome(await check.evaluate(env));
|
|
35
42
|
const evidence = outcome.evidence.map((e) => `\n - ${e}`).join('');
|
|
36
43
|
const reason = outcome.skipped
|
|
37
|
-
? `checker "${check.id}"
|
|
44
|
+
? `checker "${check.id}" 跳过(${outcome.skipReason ?? '证据未接线'})`
|
|
38
45
|
: outcome.satisfied
|
|
39
46
|
? `checker "${check.id}" 通过`
|
|
40
47
|
: `checker "${check.id}" 判定违规${evidence}`;
|
package/src/gates/command.ts
CHANGED
|
@@ -308,8 +308,12 @@ export class CommandGate implements Gate {
|
|
|
308
308
|
/**
|
|
309
309
|
* 唯一匹配谓词(#135):类别忽略与规则模式测试只在此处发生。
|
|
310
310
|
* 三个入口一律经 judge() 取它的投影,不再各写一遍匹配循环。
|
|
311
|
+
*
|
|
312
|
+
* P1-7(ADR-0031,wayfinder 票08)起由私有提为公共同步只读面:
|
|
313
|
+
* pretool-use-hook 需要命中明细(rule id/level)写审计 trace,
|
|
314
|
+
* isAllowed 的布尔投影丢掉了 hits。谓词语义不变,调用方不得改返回数组。
|
|
311
315
|
*/
|
|
312
|
-
|
|
316
|
+
match(command: string): CommandBlacklistRule[] {
|
|
313
317
|
const hits: CommandBlacklistRule[] = [];
|
|
314
318
|
|
|
315
319
|
for (const rule of this.blacklist) {
|
|
@@ -331,7 +335,7 @@ export class CommandGate implements Gate {
|
|
|
331
335
|
* 三投影因此对同一输入不可能互相矛盾。
|
|
332
336
|
*/
|
|
333
337
|
private judge(command: string): CommandVerdict {
|
|
334
|
-
const hits = this.
|
|
338
|
+
const hits = this.match(command);
|
|
335
339
|
const blocked = hits.filter(rule => rule.level === 'block');
|
|
336
340
|
const warnings = hits.filter(rule => rule.level === 'warn');
|
|
337
341
|
const audits = hits.filter(rule => rule.level === 'audit');
|
package/src/gates/definitions.ts
CHANGED
|
@@ -171,7 +171,12 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
|
|
|
171
171
|
{ flags: '--ignore-dev-deps', description: '忽略开发依赖', defaultValue: false },
|
|
172
172
|
{ flags: '--scan-command <cmd>', description: '自定义扫描命令' },
|
|
173
173
|
],
|
|
174
|
-
subcommands: {
|
|
174
|
+
subcommands: {
|
|
175
|
+
audit: { impl: { module: 'security', export: 'auditDetails' } },
|
|
176
|
+
// P1-8(ADR-0031,wayfinder 票08):gitleaks 全历史机密扫描;
|
|
177
|
+
// 二进制缺失 skip 不 fail,CI 安装后才是真门
|
|
178
|
+
secrets: { impl: { module: 'security', export: 'secretsScan' } },
|
|
179
|
+
},
|
|
175
180
|
subcommandStrict: false,
|
|
176
181
|
bareRunsAction: true,
|
|
177
182
|
action: { module: 'security', export: 'security' },
|
package/src/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type {
|
|
|
31
31
|
Constraint,
|
|
32
32
|
ConstraintId,
|
|
33
33
|
ConstraintKind,
|
|
34
|
+
ConstraintChannel,
|
|
34
35
|
ConstraintSeverity,
|
|
35
36
|
ConstraintTrigger,
|
|
36
37
|
ConstraintContext,
|
|
@@ -84,6 +85,31 @@ export {
|
|
|
84
85
|
} from './core/constraints/checker';
|
|
85
86
|
export type { CheckConstraintsOptions } from './core/constraints/checker';
|
|
86
87
|
|
|
88
|
+
// ========================================
|
|
89
|
+
// 检查器原语 SDK(harness#181,ADR-0035 决策 3 第二半)
|
|
90
|
+
// 业务检查器脚本 import 原语组装,瘦身成「事实 ↔ 期望」的绑定。
|
|
91
|
+
// 导出纪律 = 只导出存量(现有 checker 真实在用的件),不为想象中的需求新增抽象。
|
|
92
|
+
// ========================================
|
|
93
|
+
export {
|
|
94
|
+
buildCheckEnv,
|
|
95
|
+
normalizeCheckOutcome,
|
|
96
|
+
formatEvidence,
|
|
97
|
+
contextFlag,
|
|
98
|
+
contextEvidenceFlag,
|
|
99
|
+
} from './core/constraints/checkers';
|
|
100
|
+
export type {
|
|
101
|
+
ConstraintCheck,
|
|
102
|
+
CheckEnv,
|
|
103
|
+
CheckOutcome,
|
|
104
|
+
CheckDetail,
|
|
105
|
+
CheckSkip,
|
|
106
|
+
NormalizedOutcome,
|
|
107
|
+
EvidenceProviders,
|
|
108
|
+
CheckInputNeeds,
|
|
109
|
+
CheckEvidenceInput,
|
|
110
|
+
ContextEvidenceFlag,
|
|
111
|
+
} from './core/constraints/checkers';
|
|
112
|
+
|
|
87
113
|
// ========================================
|
|
88
114
|
// 约束缓存
|
|
89
115
|
// ========================================
|
package/src/pretool-use-hook.ts
CHANGED
|
@@ -9,39 +9,132 @@
|
|
|
9
9
|
*
|
|
10
10
|
* 语义(与生成版一致):
|
|
11
11
|
* - stdin 收 provider PreToolUse JSON(tool_input.command);
|
|
12
|
-
* - CommandGate
|
|
12
|
+
* - CommandGate 判定 block 级黑名单,命中 → stderr 写原因 + exit 2
|
|
13
13
|
* (codex/kimi 阻断语义:exit 2 + stderr 阻断,其余 exit code fail-open);
|
|
14
14
|
* - fail-open:stdin 非 JSON / 缺字段 / CommandGate 异常一律放行——宁可漏拦
|
|
15
15
|
* 也不全体 Bash 秒断,拦截层只是纵深防御的一道;
|
|
16
|
-
* - warn/audit
|
|
16
|
+
* - warn/audit 级命中同样放行(只拦 block 级),与生成版行为一致。
|
|
17
|
+
*
|
|
18
|
+
* P1-7(ADR-0031,wayfinder 票08):判定后对命中写审计 trace(只记账不加新拦截
|
|
19
|
+
* 能力)——此前拦下/放行的危险命令只写 stderr 不落盘,traces.log 里只有约束检查
|
|
20
|
+
* 在写。留痕失败经 try/catch 吞掉,fail-open 口径与 shim 主路径一致。
|
|
21
|
+
*
|
|
22
|
+
* P1-5 harness 半边(ADR-0031,wayfinder 票08):识别 tool_name 非 Bash 的事件
|
|
23
|
+
* (Edit/Write/apply_patch/MCP 工具,studio 侧补全 codex hooks matcher 后会到达),
|
|
24
|
+
* 只留痕不拦截——这些事件的 tool_input 没有 command 字段,旧形状会因缺字段
|
|
25
|
+
* fail-open 空转;拦截归 codex 沙箱,本 shim 对它们只记账。
|
|
17
26
|
*/
|
|
18
27
|
import { CommandGate } from './gates/command';
|
|
28
|
+
import type { CommandBlacklistRule } from './gates/types';
|
|
29
|
+
import { TraceCollector } from './monitoring/traces';
|
|
19
30
|
|
|
20
31
|
/** hook 标识:与 studio-agent 生成版同一 marker(配置幂等检测共用口径) */
|
|
21
32
|
export const HOOK_MARKER = 'harness-command-gate';
|
|
22
33
|
|
|
23
34
|
interface PreToolUseInput {
|
|
24
|
-
|
|
35
|
+
tool_name?: string;
|
|
36
|
+
tool_input?: { command?: string; file_path?: string };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** 一次 PreToolUse 的判定结果:放行结论 + 命中明细(hits 供审计留痕) */
|
|
40
|
+
export interface PreToolUseDecision {
|
|
41
|
+
allowed: boolean;
|
|
42
|
+
command: string;
|
|
43
|
+
hits: CommandBlacklistRule[];
|
|
44
|
+
/** provider 工具名(缺省按 Bash 兼容旧事件形状) */
|
|
45
|
+
toolName: string;
|
|
46
|
+
/** 非 Bash 事件的目标路径类字段(file_path;不记内容正文) */
|
|
47
|
+
targetPath?: string;
|
|
25
48
|
}
|
|
26
49
|
|
|
27
50
|
/**
|
|
28
51
|
* 判定一次 PreToolUse 是否放行。
|
|
29
52
|
* block 级命中 → allowed=false;warn/audit/干净命令/坏输入一律 allowed=true。
|
|
53
|
+
* 非 Bash 工具事件(Edit/Write/apply_patch/MCP)恒放行(P1-5:拦截归 codex 沙箱)。
|
|
30
54
|
*/
|
|
31
|
-
export function decidePreToolUse(rawStdin: string):
|
|
55
|
+
export function decidePreToolUse(rawStdin: string): PreToolUseDecision {
|
|
32
56
|
let input: PreToolUseInput = {};
|
|
33
57
|
try {
|
|
34
58
|
input = JSON.parse(rawStdin || '{}') as PreToolUseInput;
|
|
35
59
|
} catch {
|
|
36
60
|
// 非 JSON stdin:放行
|
|
37
61
|
}
|
|
38
|
-
const
|
|
62
|
+
const toolName = input.tool_name || 'Bash';
|
|
63
|
+
const toolInput = input.tool_input || {};
|
|
64
|
+
if (toolName !== 'Bash') {
|
|
65
|
+
return { allowed: true, command: '', hits: [], toolName, targetPath: toolInput.file_path };
|
|
66
|
+
}
|
|
67
|
+
const command = toolInput.command || '';
|
|
39
68
|
try {
|
|
40
69
|
const gate = new CommandGate();
|
|
41
|
-
|
|
70
|
+
// 与 isAllowed 同一谓词(match):allowed = 无 block 级命中
|
|
71
|
+
const hits = gate.match(command);
|
|
72
|
+
return { allowed: !hits.some((r) => r.level === 'block'), command, hits, toolName };
|
|
42
73
|
} catch {
|
|
43
74
|
// CommandGate 加载/判定异常:fail-open
|
|
44
|
-
return { allowed: true, command };
|
|
75
|
+
return { allowed: true, command, hits: [], toolName };
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** 黑名单级别 → trace severity 映射(词表不动 types/trace.ts) */
|
|
80
|
+
const SEVERITY_BY_LEVEL = {
|
|
81
|
+
block: 'error',
|
|
82
|
+
warn: 'warning',
|
|
83
|
+
audit: 'info',
|
|
84
|
+
} as const;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 判定留痕:非 Bash 工具事件一条 `tool-event:<tool>`(P1-5),Bash 命中一条
|
|
88
|
+
* 汇总 trace(P1-7)。
|
|
89
|
+
*
|
|
90
|
+
* 口径选择记理由:
|
|
91
|
+
* - constraintId 用汇总的 'command-gate' 而非每规则 'command-gate:<ruleId>'——
|
|
92
|
+
* usage-report 按 constraintId 聚合,逐规则会碎成几十个近零样本 id,
|
|
93
|
+
* 污染退役候选诊断;规则明细进 evidence。
|
|
94
|
+
* - evidence 只记规则 id + 命令首 token,不记完整命令文本——命令可能含敏感参数
|
|
95
|
+
* (token/路径),首 token 足以定位命令类别。
|
|
96
|
+
* - 隐式依赖:TraceCollector 缺省按 cwd 解析 projectPath,hook 进程 cwd 通常是
|
|
97
|
+
* 项目根(provider 在项目根起会话),可接受;写错地方也不拦主路径。
|
|
98
|
+
*/
|
|
99
|
+
function recordHookTrace(decision: PreToolUseDecision): void {
|
|
100
|
+
try {
|
|
101
|
+
// P1-5:非 Bash 工具事件只留痕不拦截(拦截归 codex 沙箱)——constraintId
|
|
102
|
+
// 按工具名分(tool-event:<tool>),工具集合有界、不会碎片化聚合;evidence
|
|
103
|
+
// 记工具名 + 目标路径类字段(file_path),不记内容正文。
|
|
104
|
+
if (decision.toolName !== 'Bash') {
|
|
105
|
+
new TraceCollector().record({
|
|
106
|
+
constraintId: `tool-event:${decision.toolName}`,
|
|
107
|
+
severity: 'info',
|
|
108
|
+
timestamp: Date.now(),
|
|
109
|
+
result: 'pass',
|
|
110
|
+
operation: 'pretool-use-hook',
|
|
111
|
+
evidence: [
|
|
112
|
+
`tool:${decision.toolName}`,
|
|
113
|
+
...(decision.targetPath ? [`path:${decision.targetPath}`] : []),
|
|
114
|
+
],
|
|
115
|
+
});
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (decision.hits.length === 0) return;
|
|
119
|
+
const maxLevel = decision.hits.some((r) => r.level === 'block')
|
|
120
|
+
? 'block'
|
|
121
|
+
: decision.hits.some((r) => r.level === 'warn')
|
|
122
|
+
? 'warn'
|
|
123
|
+
: 'audit';
|
|
124
|
+
const firstToken = decision.command.trim().split(/\s+/)[0] || '';
|
|
125
|
+
new TraceCollector().record({
|
|
126
|
+
constraintId: 'command-gate',
|
|
127
|
+
severity: SEVERITY_BY_LEVEL[maxLevel],
|
|
128
|
+
timestamp: Date.now(),
|
|
129
|
+
result: decision.allowed ? 'pass' : 'fail',
|
|
130
|
+
operation: 'pretool-use-hook',
|
|
131
|
+
evidence: [
|
|
132
|
+
...decision.hits.map((r) => `rule:${r.id}`),
|
|
133
|
+
...(firstToken ? [`cmd:${firstToken}`] : []),
|
|
134
|
+
],
|
|
135
|
+
});
|
|
136
|
+
} catch {
|
|
137
|
+
// 留痕失败不影响拦截主路径(fail-open 口径与 shim 一致)
|
|
45
138
|
}
|
|
46
139
|
}
|
|
47
140
|
|
|
@@ -50,9 +143,10 @@ export function decidePreToolUse(rawStdin: string): { allowed: boolean; command:
|
|
|
50
143
|
* 阻断时原因写 stderr(provider 把 stderr 作为阻断原因回填模型)。
|
|
51
144
|
*/
|
|
52
145
|
export function runPreToolUseHook(rawStdin: string): number {
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
146
|
+
const decision = decidePreToolUse(rawStdin);
|
|
147
|
+
recordHookTrace(decision);
|
|
148
|
+
if (!decision.allowed) {
|
|
149
|
+
console.error(`[${HOOK_MARKER}] blocked: ${decision.command}`);
|
|
56
150
|
return 2;
|
|
57
151
|
}
|
|
58
152
|
return 0;
|
package/src/types/constraint.ts
CHANGED
|
@@ -2,11 +2,16 @@
|
|
|
2
2
|
* 约束类型定义
|
|
3
3
|
*
|
|
4
4
|
* severity 显式模型(ADR-0029,取代 ADR-0001 的三层命名与 kind 二元模型):
|
|
5
|
-
* - 全部约束 kind='check':必须带真实 checker,参与运行时检查与 trace 统计
|
|
6
5
|
* - severity 直接写死在定义上:error = 违规即阻断;warning = 违规告警不阻断;
|
|
7
6
|
* info = 仅记录
|
|
8
7
|
* - 纯文本提示层(kind='prompt' / promptInjection / 注入段渲染)已整体关停,
|
|
9
8
|
* 文本规则由消费方手写治理段承接
|
|
9
|
+
*
|
|
10
|
+
* channel 通道模型(ADR-0035,两轴:channel=后果轴、checker 来源=判定轴):
|
|
11
|
+
* - gate(缺省):硬门禁,必须带真实 checker,参与运行时检查与 trace 统计
|
|
12
|
+
* - workflow:流程机制承载,无 checker,不进检查分发
|
|
13
|
+
* - discipline:拦不住但数得出的登记记录,无 checker,harness 不渲染、不注入、
|
|
14
|
+
* 不执行,供消费方做信号计数;晋升毕业后原地翻 channel 回 gate
|
|
10
15
|
*/
|
|
11
16
|
|
|
12
17
|
/**
|
|
@@ -24,6 +29,17 @@ export type ConstraintKind = 'check';
|
|
|
24
29
|
*/
|
|
25
30
|
export type ConstraintSeverity = 'error' | 'warning' | 'info';
|
|
26
31
|
|
|
32
|
+
/**
|
|
33
|
+
* 约束通道(ADR-0035,后果轴;与探测器来源的判定轴正交)
|
|
34
|
+
*
|
|
35
|
+
* - gate:硬门禁——带 checker、违规按 severity 阻断/告警(缺省通道,现有行为)
|
|
36
|
+
* - workflow:流程机制承载——无 checker,由 CI/拆票等流程结构兜住,不进检查分发
|
|
37
|
+
* - discipline:拦不住但数得出——无 checker 的登记记录,harness 永不渲染、
|
|
38
|
+
* 永不注入、永不执行,仅供消费方(如 studio)做代理信号计数;
|
|
39
|
+
* 超阈值晋升毕业后原地翻回 gate(补上 checker)
|
|
40
|
+
*/
|
|
41
|
+
export type ConstraintChannel = 'gate' | 'workflow' | 'discipline';
|
|
42
|
+
|
|
27
43
|
/**
|
|
28
44
|
* 约束触发条件(开放扩展)
|
|
29
45
|
*
|
|
@@ -49,11 +65,19 @@ export interface Constraint {
|
|
|
49
65
|
id: ConstraintId;
|
|
50
66
|
|
|
51
67
|
/**
|
|
52
|
-
* 约束类别(ADR-0029):恒为 'check'
|
|
68
|
+
* 约束类别(ADR-0029):恒为 'check';
|
|
53
69
|
* 纯文本提示(kind='prompt')已随文本注入层一并关停
|
|
54
70
|
*/
|
|
55
71
|
kind: ConstraintKind;
|
|
56
72
|
|
|
73
|
+
/**
|
|
74
|
+
* 约束通道(ADR-0035):缺省 'gate'
|
|
75
|
+
*
|
|
76
|
+
* gate 通道必须带 checker(注册表闭环收窄后的口径);workflow/discipline
|
|
77
|
+
* 通道允许无 checker——不进入检查分发、不触发闭环抛错、harness 不渲染不注入
|
|
78
|
+
*/
|
|
79
|
+
channel?: ConstraintChannel;
|
|
80
|
+
|
|
57
81
|
/** 约束规则(英文) */
|
|
58
82
|
rule: string;
|
|
59
83
|
|
|
@@ -84,7 +108,7 @@ export interface Constraint {
|
|
|
84
108
|
source?: ConstraintSource;
|
|
85
109
|
|
|
86
110
|
/**
|
|
87
|
-
* 填空式 checker 模板 id(仅 source='app'
|
|
111
|
+
* 填空式 checker 模板 id(仅 source='app' 使用;仅 channel='gate' 必填)
|
|
88
112
|
*
|
|
89
113
|
* 内置约束省略 = checker 按约束 id 在内置注册表查找;应用层约束按模板 id
|
|
90
114
|
* 在模板注册表(checkers/index.ts TEMPLATES)查找并带 params 实例化
|
|
@@ -116,6 +140,14 @@ export interface ConstraintResult {
|
|
|
116
140
|
* 但不计入 pass/fail 统计;trace 记录为 result: 'skip'。
|
|
117
141
|
*/
|
|
118
142
|
skipped?: boolean;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 跳过原因(harness#182:「检查器失效 ≠ 对象合规」必须显式、可统计)
|
|
146
|
+
*
|
|
147
|
+
* 仅 skipped=true 时可能携带(旧路径的裸 'skip' 无原因);
|
|
148
|
+
* 进 CLI 跳过清单与 ExecutionTrace.skipReason。
|
|
149
|
+
*/
|
|
150
|
+
skipReason?: string;
|
|
119
151
|
|
|
120
152
|
/** 约束定义 */
|
|
121
153
|
constraint?: Constraint;
|
package/src/types/trace.ts
CHANGED
|
@@ -61,6 +61,14 @@ export interface ExecutionTrace {
|
|
|
61
61
|
*/
|
|
62
62
|
evidence?: string[];
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* 跳过原因(harness#182;仅 result='skip' 时可能携带)
|
|
66
|
+
*
|
|
67
|
+
* 「未评估」必须可统计:降级跳过(输入不可得/检查器失效)与约定未采用
|
|
68
|
+
* 在结果面上靠本字段区分,失效计数由此可聚合成代理信号。
|
|
69
|
+
*/
|
|
70
|
+
skipReason?: string;
|
|
71
|
+
|
|
64
72
|
// ========================================
|
|
65
73
|
// 用户响应(可选,用于诊断)
|
|
66
74
|
// ========================================
|