@dommaker/harness 0.16.9 → 0.17.1
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 +39 -0
- package/README.md +33 -32
- package/bin/harness.js +33 -20
- package/dist/cli/commands/check.d.ts +3 -2
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +69 -36
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/constraints-report.d.ts +42 -0
- package/dist/cli/commands/constraints-report.d.ts.map +1 -0
- package/dist/cli/commands/constraints-report.js +233 -0
- package/dist/cli/commands/constraints-report.js.map +1 -0
- package/dist/cli/commands/constraints-retire.d.ts +71 -0
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -0
- package/dist/cli/commands/constraints-retire.js +384 -0
- package/dist/cli/commands/constraints-retire.js.map +1 -0
- package/dist/cli/commands/constraints.d.ts +1 -1
- package/dist/cli/commands/constraints.d.ts.map +1 -1
- package/dist/cli/commands/constraints.js +4 -4
- package/dist/cli/commands/constraints.js.map +1 -1
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +10 -4
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/init.d.ts +20 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +81 -59
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/report.js +4 -4
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +3 -4
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +5 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -1
- package/dist/cli/commands/sync-docs/capabilities-syncer.js +2 -10
- package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
- package/dist/cli/commands/validate.d.ts.map +1 -1
- package/dist/cli/commands/validate.js +1 -5
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +7 -0
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
- package/dist/core/constraints/capabilities-parser.js +13 -0
- package/dist/core/constraints/capabilities-parser.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +13 -5
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +62 -25
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.d.ts +9 -2
- package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/capability-sync.js +55 -22
- package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.d.ts +3 -0
- package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -1
- package/dist/core/constraints/checkers/context-doc-sync.js +8 -2
- package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.d.ts +1 -0
- package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -1
- package/dist/core/constraints/checkers/docs-freshness.js +39 -0
- package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
- package/dist/core/constraints/checkers/index.d.ts +8 -4
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +29 -46
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/iron-flags.d.ts +6 -7
- package/dist/core/constraints/checkers/iron-flags.d.ts.map +1 -1
- package/dist/core/constraints/checkers/iron-flags.js +10 -17
- package/dist/core/constraints/checkers/iron-flags.js.map +1 -1
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +13 -0
- package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -0
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js +91 -0
- package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -0
- package/dist/core/constraints/checkers/types.d.ts +15 -4
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +16 -4
- package/dist/core/constraints/checkers/types.js.map +1 -1
- package/dist/core/constraints/context-builder.d.ts +6 -3
- package/dist/core/constraints/context-builder.d.ts.map +1 -1
- package/dist/core/constraints/context-builder.js +29 -20
- package/dist/core/constraints/context-builder.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.d.ts +6 -2
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +29 -572
- package/dist/core/constraints/definitions/guidelines.js.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.d.ts +6 -2
- package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -1
- package/dist/core/constraints/definitions/iron-laws.js +48 -231
- package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
- package/dist/core/constraints/definitions/prompts.d.ts +12 -0
- package/dist/core/constraints/definitions/prompts.d.ts.map +1 -0
- package/dist/core/constraints/definitions/prompts.js +405 -0
- package/dist/core/constraints/definitions/prompts.js.map +1 -0
- package/dist/core/constraints/definitions.d.ts +15 -9
- package/dist/core/constraints/definitions.d.ts.map +1 -1
- package/dist/core/constraints/definitions.js +18 -12
- package/dist/core/constraints/definitions.js.map +1 -1
- package/dist/core/constraints/index.d.ts +3 -2
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +8 -2
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/injection-drift.d.ts +48 -0
- package/dist/core/constraints/injection-drift.d.ts.map +1 -0
- package/dist/core/constraints/injection-drift.js +140 -0
- package/dist/core/constraints/injection-drift.js.map +1 -0
- package/dist/core/constraints/injection-renderer.d.ts +23 -0
- package/dist/core/constraints/injection-renderer.d.ts.map +1 -0
- package/dist/core/constraints/injection-renderer.js +44 -0
- package/dist/core/constraints/injection-renderer.js.map +1 -0
- package/dist/core/constraints/interceptor.d.ts.map +1 -1
- package/dist/core/constraints/interceptor.js +3 -2
- package/dist/core/constraints/interceptor.js.map +1 -1
- package/dist/core/constraints/usage-report.d.ts +95 -0
- package/dist/core/constraints/usage-report.d.ts.map +1 -0
- package/dist/core/constraints/usage-report.js +206 -0
- package/dist/core/constraints/usage-report.js.map +1 -0
- package/dist/core/effective-constraints.d.ts +47 -0
- package/dist/core/effective-constraints.d.ts.map +1 -0
- package/dist/core/effective-constraints.js +60 -0
- package/dist/core/effective-constraints.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +17 -2
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +55 -8
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/dashboard/data.d.ts +1 -9
- package/dist/dashboard/data.d.ts.map +1 -1
- package/dist/dashboard/data.js +7 -15
- package/dist/dashboard/data.js.map +1 -1
- package/dist/dashboard/types.d.ts +13 -1
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -13
- package/dist/index.js.map +1 -1
- package/dist/monitoring/index.d.ts +0 -2
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/index.js +0 -2
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/knowledge-evolver.d.ts +1 -1
- package/dist/monitoring/knowledge-evolver.js +1 -1
- package/dist/monitoring/trace-analyzer.d.ts +1 -1
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +16 -10
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +2 -1
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +5 -3
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/presets/standard.d.ts +3 -1
- package/dist/presets/standard.d.ts.map +1 -1
- package/dist/presets/standard.js +18 -8
- package/dist/presets/standard.js.map +1 -1
- package/dist/types/constraint.d.ts +51 -11
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +8 -4
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/monitoring-types.d.ts +2 -63
- package/dist/types/monitoring-types.d.ts.map +1 -1
- package/dist/types/monitoring-types.js +2 -2
- package/dist/types/project-config.d.ts +26 -1
- package/dist/types/project-config.d.ts.map +1 -1
- package/dist/types/trace.d.ts +16 -7
- package/dist/types/trace.d.ts.map +1 -1
- package/dist/types/trace.js +8 -0
- package/dist/types/trace.js.map +1 -1
- package/package.json +1 -1
- package/src/CONTEXT.md +2 -2
- package/src/__tests__/checker-extra.test.ts +228 -333
- package/src/__tests__/checker.test.ts +87 -724
- package/src/__tests__/constraint-doctor.test.ts +5 -5
- package/src/__tests__/doctor-extra.test.ts +164 -0
- package/src/__tests__/effective-constraints.test.ts +147 -0
- package/src/__tests__/extend-exceptions.test.ts +3 -3
- package/src/__tests__/iron-laws.test.ts +115 -91
- package/src/__tests__/no-hardcoded-credentials.test.ts +90 -0
- package/src/__tests__/presets.test.ts +7 -7
- package/src/__tests__/project-config-loader-extra.test.ts +41 -4
- package/src/__tests__/skip-semantics.test.ts +322 -0
- package/src/cli/commands/CONTEXT.md +5 -3
- package/src/cli/commands/__tests__/check-drift.test.ts +127 -0
- package/src/cli/commands/__tests__/check-skip-output.test.ts +128 -0
- package/src/cli/commands/__tests__/check.test.ts +14 -25
- package/src/cli/commands/__tests__/constraints-report.test.ts +327 -0
- package/src/cli/commands/__tests__/constraints-retire.test.ts +283 -0
- package/src/cli/commands/__tests__/init-injection.test.ts +234 -0
- package/src/cli/commands/__tests__/status-extra.test.ts +11 -11
- package/src/cli/commands/__tests__/status.test.ts +1 -1
- package/src/cli/commands/check.ts +72 -38
- package/src/cli/commands/constraints-report.ts +234 -0
- package/src/cli/commands/constraints-retire.ts +443 -0
- package/src/cli/commands/constraints.ts +5 -5
- package/src/cli/commands/index.ts +2 -1
- package/src/cli/commands/init.ts +94 -66
- package/src/cli/commands/report.ts +6 -6
- package/src/cli/commands/status.ts +3 -4
- package/src/cli/commands/sync-docs/capabilities-syncer.ts +5 -7
- package/src/cli/commands/validate.ts +1 -5
- package/src/core/CONTEXT.md +7 -4
- package/src/core/constraints/__tests__/injection-drift.test.ts +164 -0
- package/src/core/constraints/__tests__/interceptor.test.ts +4 -0
- package/src/core/constraints/capabilities-parser.ts +13 -0
- package/src/core/constraints/checker.ts +73 -28
- package/src/core/constraints/checkers/capability-sync.ts +72 -29
- package/src/core/constraints/checkers/context-doc-sync.ts +9 -2
- package/src/core/constraints/checkers/docs-freshness.ts +43 -0
- package/src/core/constraints/checkers/index.ts +38 -71
- package/src/core/constraints/checkers/iron-flags.ts +13 -49
- package/src/core/constraints/checkers/no-hardcoded-credentials.ts +93 -0
- package/src/core/constraints/checkers/types.ts +27 -5
- package/src/core/constraints/context-builder.ts +28 -19
- package/src/core/constraints/definitions/guidelines.ts +29 -597
- package/src/core/constraints/definitions/iron-laws.ts +48 -239
- package/src/core/constraints/definitions/prompts.ts +419 -0
- package/src/core/constraints/definitions.ts +18 -11
- package/src/core/constraints/index.ts +10 -1
- package/src/core/constraints/injection-drift.ts +139 -0
- package/src/core/constraints/injection-renderer.ts +44 -0
- package/src/core/constraints/interceptor.ts +3 -2
- package/src/core/constraints/usage-report.ts +254 -0
- package/src/core/effective-constraints.ts +85 -0
- package/src/core/index.ts +4 -1
- package/src/core/project-config-loader.ts +59 -9
- package/src/dashboard/__tests__/data.test.ts +5 -12
- package/src/dashboard/data.ts +9 -19
- package/src/dashboard/types.ts +18 -1
- package/src/index.ts +0 -12
- package/src/knowledge/CONTEXT.md +2 -2
- package/src/monitoring/CONTEXT.md +3 -4
- package/src/monitoring/index.ts +0 -2
- package/src/monitoring/knowledge-evolver.ts +1 -1
- package/src/monitoring/trace-analyzer.ts +15 -10
- package/src/monitoring/traces.ts +10 -6
- package/src/presets/__tests__/standard.test.ts +11 -9
- package/src/presets/standard.ts +24 -15
- package/src/types/constraint.ts +59 -14
- package/src/types/index.ts +1 -3
- package/src/types/monitoring-types.ts +2 -84
- package/src/types/project-config.ts +30 -1
- package/src/types/trace.ts +18 -7
- package/src/verification/CONTEXT.md +1 -1
- package/dist/cli/commands/flow.d.ts +0 -22
- package/dist/cli/commands/flow.d.ts.map +0 -1
- package/dist/cli/commands/flow.js +0 -275
- package/dist/cli/commands/flow.js.map +0 -1
- package/dist/constraints/lifecycle-runner.d.ts +0 -52
- package/dist/constraints/lifecycle-runner.d.ts.map +0 -1
- package/dist/constraints/lifecycle-runner.js +0 -151
- package/dist/constraints/lifecycle-runner.js.map +0 -1
- package/dist/constraints/registry.d.ts +0 -27
- package/dist/constraints/registry.d.ts.map +0 -1
- package/dist/constraints/registry.js +0 -128
- package/dist/constraints/registry.js.map +0 -1
- package/dist/constraints/types.d.ts +0 -53
- package/dist/constraints/types.d.ts.map +0 -1
- package/dist/constraints/types.js +0 -8
- package/dist/constraints/types.js.map +0 -1
- package/dist/core/constraints/checkers/always-pass.d.ts +0 -17
- package/dist/core/constraints/checkers/always-pass.d.ts.map +0 -1
- package/dist/core/constraints/checkers/always-pass.js +0 -23
- package/dist/core/constraints/checkers/always-pass.js.map +0 -1
- package/dist/core/constraints/checkers/guideline-flags.d.ts +0 -9
- package/dist/core/constraints/checkers/guideline-flags.d.ts.map +0 -1
- package/dist/core/constraints/checkers/guideline-flags.js +0 -13
- package/dist/core/constraints/checkers/guideline-flags.js.map +0 -1
- package/dist/core/constraints/checkers/no-any-type.d.ts +0 -6
- package/dist/core/constraints/checkers/no-any-type.d.ts.map +0 -1
- package/dist/core/constraints/checkers/no-any-type.js +0 -42
- package/dist/core/constraints/checkers/no-any-type.js.map +0 -1
- package/dist/core/constraints/checkers/no-excuse-patterns.d.ts +0 -6
- package/dist/core/constraints/checkers/no-excuse-patterns.d.ts.map +0 -1
- package/dist/core/constraints/checkers/no-excuse-patterns.js +0 -25
- package/dist/core/constraints/checkers/no-excuse-patterns.js.map +0 -1
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts +0 -6
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts.map +0 -1
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js +0 -34
- package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js.map +0 -1
- package/dist/core/constraints/checkers/no-performative-agreement.d.ts +0 -8
- package/dist/core/constraints/checkers/no-performative-agreement.d.ts.map +0 -1
- package/dist/core/constraints/checkers/no-performative-agreement.js +0 -23
- package/dist/core/constraints/checkers/no-performative-agreement.js.map +0 -1
- package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts +0 -6
- package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts.map +0 -1
- package/dist/core/constraints/checkers/no-simplification-without-approval.js +0 -30
- package/dist/core/constraints/checkers/no-simplification-without-approval.js.map +0 -1
- package/dist/core/constraints/checkers/test-coverage.d.ts +0 -6
- package/dist/core/constraints/checkers/test-coverage.d.ts.map +0 -1
- package/dist/core/constraints/checkers/test-coverage.js +0 -33
- package/dist/core/constraints/checkers/test-coverage.js.map +0 -1
- package/dist/core/constraints/checkers/yagni.d.ts +0 -8
- package/dist/core/constraints/checkers/yagni.d.ts.map +0 -1
- package/dist/core/constraints/checkers/yagni.js +0 -96
- package/dist/core/constraints/checkers/yagni.js.map +0 -1
- package/dist/core/constraints/definitions/tips.d.ts +0 -7
- package/dist/core/constraints/definitions/tips.d.ts.map +0 -1
- package/dist/core/constraints/definitions/tips.js +0 -62
- package/dist/core/constraints/definitions/tips.js.map +0 -1
- package/dist/evolution/auto-evolve.d.ts +0 -35
- package/dist/evolution/auto-evolve.d.ts.map +0 -1
- package/dist/evolution/auto-evolve.js +0 -64
- package/dist/evolution/auto-evolve.js.map +0 -1
- package/dist/evolution/index.d.ts +0 -2
- package/dist/evolution/index.d.ts.map +0 -1
- package/dist/evolution/index.js +0 -18
- package/dist/evolution/index.js.map +0 -1
- package/dist/monitoring/constraint-evolver.d.ts +0 -120
- package/dist/monitoring/constraint-evolver.d.ts.map +0 -1
- package/dist/monitoring/constraint-evolver.js +0 -410
- package/dist/monitoring/constraint-evolver.js.map +0 -1
- package/src/__tests__/constraint-evolver.test.ts +0 -405
- package/src/__tests__/doctor-evolver.test.ts +0 -381
- package/src/cli/commands/__tests__/flow.test.ts +0 -343
- package/src/cli/commands/flow.ts +0 -277
- package/src/constraints/__tests__/lifecycle-runner.test.ts +0 -246
- package/src/constraints/__tests__/registry.test.ts +0 -196
- package/src/constraints/lifecycle-runner.ts +0 -184
- package/src/constraints/registry.ts +0 -134
- package/src/constraints/types.ts +0 -59
- package/src/core/constraints/checkers/always-pass.ts +0 -22
- package/src/core/constraints/checkers/guideline-flags.ts +0 -30
- package/src/core/constraints/checkers/no-any-type.ts +0 -42
- package/src/core/constraints/checkers/no-excuse-patterns.ts +0 -24
- package/src/core/constraints/checkers/no-fuzzy-completion-claim.ts +0 -33
- package/src/core/constraints/checkers/no-performative-agreement.ts +0 -22
- package/src/core/constraints/checkers/no-simplification-without-approval.ts +0 -29
- package/src/core/constraints/checkers/test-coverage.ts +0 -35
- package/src/core/constraints/checkers/yagni.ts +0 -65
- package/src/core/constraints/definitions/tips.ts +0 -63
- package/src/evolution/CONTEXT.md +0 -22
- package/src/evolution/__tests__/auto-evolve.test.ts +0 -319
- package/src/evolution/auto-evolve.ts +0 -98
- package/src/evolution/index.ts +0 -1
- package/src/monitoring/constraint-evolver.ts +0 -501
package/src/dashboard/types.ts
CHANGED
|
@@ -5,7 +5,24 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { KnowledgeType } from '../knowledge/types';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// ── 约束分层(原 src/constraints/types,约束分层子系统删除后归位 dashboard)──
|
|
10
|
+
|
|
11
|
+
/** 约束分层 */
|
|
12
|
+
export type ConstraintLayer = 'safety' | 'quality';
|
|
13
|
+
|
|
14
|
+
/** 退化状态(生命周期机制已删除,保留字段供消费方兼容,恒为 active) */
|
|
15
|
+
export type DeprecationStatus = 'active' | 'scheduled' | 'deprecated' | 'removed';
|
|
16
|
+
|
|
17
|
+
/** 约束拦截统计(generate/getConstraintHeatmap 的输入) */
|
|
18
|
+
export interface ConstraintStats {
|
|
19
|
+
constraintId: string;
|
|
20
|
+
triggerCount: number;
|
|
21
|
+
passCount: number;
|
|
22
|
+
interceptCount: number;
|
|
23
|
+
interceptRate: number;
|
|
24
|
+
lastTriggered?: string;
|
|
25
|
+
}
|
|
9
26
|
|
|
10
27
|
// ── 知识库全景 ───────────────────────────────────────────
|
|
11
28
|
|
package/src/index.ts
CHANGED
|
@@ -73,13 +73,6 @@ export * from './safety';
|
|
|
73
73
|
// ========================================
|
|
74
74
|
export * from './verification';
|
|
75
75
|
|
|
76
|
-
// ========================================
|
|
77
|
-
// 约束分层导出
|
|
78
|
-
// ========================================
|
|
79
|
-
export * from './constraints/types';
|
|
80
|
-
export { ConstraintRegistry } from './constraints/registry';
|
|
81
|
-
export { ConstraintLifecycleRunner } from './constraints/lifecycle-runner';
|
|
82
|
-
|
|
83
76
|
// ========================================
|
|
84
77
|
// Dashboard 数据导出
|
|
85
78
|
// ========================================
|
|
@@ -114,11 +107,6 @@ export * from './agents';
|
|
|
114
107
|
// ========================================
|
|
115
108
|
export * from './presets';
|
|
116
109
|
|
|
117
|
-
// ========================================
|
|
118
|
-
// 约束进化导出
|
|
119
|
-
// ========================================
|
|
120
|
-
export * from './evolution';
|
|
121
|
-
|
|
122
110
|
// ========================================
|
|
123
111
|
// 便捷 API
|
|
124
112
|
// ========================================
|
package/src/knowledge/CONTEXT.md
CHANGED
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
## 约定
|
|
39
39
|
- 知识条目有明确的生命周期状态(按 consumptionMode 分化)
|
|
40
|
-
-
|
|
40
|
+
- 约束退役(`harness constraints retire`,人确认)时写入 KnowledgeStore:规则原文 + 退役原因 + 历史统计
|
|
41
41
|
- Linter 检查完整性/一致性/时效性三个维度
|
|
42
42
|
- Audit 6 维度评分:D1结构 D2内容 D3去重 D4成熟度 D5新鲜度 D6飞轮
|
|
43
43
|
- Ingest gate: ingestEntry() 先经 audit.validate() 检查,reject 不入库
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
|
|
47
47
|
## 注意事项
|
|
48
48
|
- Phase 1+4 实现的知识引擎核心
|
|
49
|
-
- 约束"
|
|
49
|
+
- 约束"退役不删除"——retire 落盘 config.yml `enabled: false` + retired 元数据,保留规则原文 + 退役原因 + 历史统计(可回滚)
|
|
50
50
|
- `MaturityLevel` 包含 6 个值: draft/verified/proven/archived/active/deprecated
|
|
51
51
|
- `excludeArchived` 同时排除 archived 和 deprecated
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# monitoring/
|
|
2
2
|
|
|
3
3
|
## 职责
|
|
4
|
-
运行时监控:Execution Trace(收集/分析/诊断)、Performance Trace(收集/分析)
|
|
4
|
+
运行时监控:Execution Trace(收集/分析/诊断)、Performance Trace(收集/分析)、知识进化、上下文追踪。
|
|
5
5
|
|
|
6
6
|
## 核心导出
|
|
7
|
-
- `TraceCollector` — 执行追踪收集(append-only JSONL)
|
|
7
|
+
- `TraceCollector` — 执行追踪收集(append-only JSONL,`.harness/logs/traces.log`)
|
|
8
8
|
- `TraceAnalyzer` — 追踪统计分析 + 异常检测
|
|
9
9
|
- `ConstraintDoctor` — 约束诊断接口(Agent 消费)
|
|
10
|
-
- `ConstraintEvolver` — 约束进化提案流程
|
|
11
10
|
- `PerformanceCollector` — 性能日志收集
|
|
12
11
|
- `PerformanceAnalyzer` — 性能统计分析
|
|
13
12
|
- `ContextTracker` — 上下文追踪
|
|
@@ -25,5 +24,5 @@
|
|
|
25
24
|
- 零 Token 成本:不调用 LLM
|
|
26
25
|
|
|
27
26
|
## 注意事项
|
|
28
|
-
-
|
|
27
|
+
- 追踪数据供 `harness constraints report` 统计与退役候选诊断消费(观测用途,不做自动降级)
|
|
29
28
|
- PerformanceCollector 和 TraceCollector 独立运作
|
package/src/monitoring/index.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* - TraceCollector:轻量收集,零 Token
|
|
6
6
|
* - TraceAnalyzer:统计汇总,异常检测
|
|
7
7
|
* - ConstraintDoctor:Agent 诊断接口
|
|
8
|
-
* - ConstraintEvolver:约束提案流程
|
|
9
8
|
*
|
|
10
9
|
* Performance Trace 系统:
|
|
11
10
|
* - PerformanceCollector:性能日志收集,零 Token
|
|
@@ -15,7 +14,6 @@
|
|
|
15
14
|
export * from './traces';
|
|
16
15
|
export * from './trace-analyzer';
|
|
17
16
|
export * from './constraint-doctor';
|
|
18
|
-
export * from './constraint-evolver';
|
|
19
17
|
export * from './performance-collector';
|
|
20
18
|
export * from './performance-analyzer';
|
|
21
19
|
export * from './context-tracker';
|
|
@@ -76,20 +76,22 @@ export class TraceAnalyzer {
|
|
|
76
76
|
// 计算时间范围
|
|
77
77
|
const timeRange = timeRangeOf(group.map(t => t.timestamp));
|
|
78
78
|
|
|
79
|
-
//
|
|
79
|
+
// 单次遍历计算核心统计(skip 单独计数,不计入 pass/fail/bypass 率分母,ADR-0001)
|
|
80
80
|
const totalChecks = group.length;
|
|
81
|
-
let passCount = 0, failCount = 0, bypassCount = 0, ignoreCount = 0;
|
|
81
|
+
let passCount = 0, failCount = 0, bypassCount = 0, ignoreCount = 0, skipCount = 0;
|
|
82
82
|
for (const t of group) {
|
|
83
83
|
if (t.result === 'pass') passCount++;
|
|
84
84
|
else if (t.result === 'fail') failCount++;
|
|
85
85
|
else if (t.result === 'bypassed') bypassCount++;
|
|
86
|
+
else if (t.result === 'skip') skipCount++;
|
|
86
87
|
if (t.userAction === 'ignore') ignoreCount++;
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
//
|
|
90
|
-
const
|
|
91
|
-
const
|
|
92
|
-
const
|
|
90
|
+
// 计算比率(分母 = 实际评估次数,skip 未评估不计入)
|
|
91
|
+
const evaluatedChecks = totalChecks - skipCount;
|
|
92
|
+
const passRate = evaluatedChecks > 0 ? passCount / evaluatedChecks : 0;
|
|
93
|
+
const failRate = evaluatedChecks > 0 ? failCount / evaluatedChecks : 0;
|
|
94
|
+
const bypassRate = evaluatedChecks > 0 ? bypassCount / evaluatedChecks : 0;
|
|
93
95
|
|
|
94
96
|
// 计算例外统计
|
|
95
97
|
const exceptionTraces = group.filter(t => t.exceptionApplied);
|
|
@@ -108,6 +110,7 @@ export class TraceAnalyzer {
|
|
|
108
110
|
passCount,
|
|
109
111
|
failCount,
|
|
110
112
|
bypassCount,
|
|
113
|
+
skipCount,
|
|
111
114
|
ignoreCount,
|
|
112
115
|
passRate,
|
|
113
116
|
failRate,
|
|
@@ -298,12 +301,13 @@ export class TraceAnalyzer {
|
|
|
298
301
|
}
|
|
299
302
|
|
|
300
303
|
/**
|
|
301
|
-
*
|
|
304
|
+
* 计算通过率(skip 未评估,不计入分母)
|
|
302
305
|
*/
|
|
303
306
|
private calcPassRate(traces: ExecutionTrace[]): number {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
const evaluated = traces.filter(t => t.result !== 'skip');
|
|
308
|
+
if (evaluated.length === 0) return 0;
|
|
309
|
+
const passCount = evaluated.filter(t => t.result === 'pass').length;
|
|
310
|
+
return passCount / evaluated.length;
|
|
307
311
|
}
|
|
308
312
|
|
|
309
313
|
/**
|
|
@@ -374,6 +378,7 @@ export class TraceAnalyzer {
|
|
|
374
378
|
const levelEmoji = {
|
|
375
379
|
iron_law: '🔴',
|
|
376
380
|
guideline: '🟡',
|
|
381
|
+
prompt: '🟣',
|
|
377
382
|
tip: '🔵',
|
|
378
383
|
}[summary.level];
|
|
379
384
|
|
package/src/monitoring/traces.ts
CHANGED
|
@@ -11,17 +11,21 @@
|
|
|
11
11
|
|
|
12
12
|
import * as fs from 'fs';
|
|
13
13
|
import * as path from 'path';
|
|
14
|
-
import
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_TRACE_FILE,
|
|
16
|
+
type ExecutionTrace,
|
|
17
|
+
type TraceFilter,
|
|
18
|
+
type TraceCollectorConfig,
|
|
18
19
|
} from '../types/trace';
|
|
19
20
|
|
|
21
|
+
// 路径常量再导出,保持既有从 monitoring/traces 导入的用法不破
|
|
22
|
+
export { DEFAULT_TRACE_FILE };
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* 默认配置
|
|
22
26
|
*/
|
|
23
27
|
const DEFAULT_CONFIG: TraceCollectorConfig = {
|
|
24
|
-
traceFile:
|
|
28
|
+
traceFile: DEFAULT_TRACE_FILE,
|
|
25
29
|
maxFileSize: 10 * 1024 * 1024, // 10MB
|
|
26
30
|
enabled: true,
|
|
27
31
|
};
|
|
@@ -260,7 +264,7 @@ export class TraceCollector {
|
|
|
260
264
|
}
|
|
261
265
|
|
|
262
266
|
const files = fs.readdirSync(dir);
|
|
263
|
-
const backupFiles = files.filter(f => f.endsWith('.log') && f !==
|
|
267
|
+
const backupFiles = files.filter(f => f.endsWith('.log') && f !== path.basename(this.traceFile));
|
|
264
268
|
|
|
265
269
|
const cutoffTime = Date.now() - maxAgeDays * 24 * 3600 * 1000;
|
|
266
270
|
let deletedCount = 0;
|
|
@@ -12,7 +12,7 @@ describe('getPreset', () => {
|
|
|
12
12
|
expect(preset.name).toBe('strict');
|
|
13
13
|
expect(preset.ironLaws).toBeNull();
|
|
14
14
|
expect(preset.guidelines).toBeNull();
|
|
15
|
-
expect(preset.
|
|
15
|
+
expect(preset.prompts).toBeNull();
|
|
16
16
|
});
|
|
17
17
|
|
|
18
18
|
it('returns standard preset', () => {
|
|
@@ -25,7 +25,7 @@ describe('getPreset', () => {
|
|
|
25
25
|
expect(preset.name).toBe('relaxed');
|
|
26
26
|
expect(preset.ironLaws).toHaveLength(3);
|
|
27
27
|
expect(preset.guidelines).toHaveLength(2);
|
|
28
|
-
expect(preset.
|
|
28
|
+
expect(preset.prompts).toEqual([]);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
it('defaults to standard for unknown preset name', () => {
|
|
@@ -47,8 +47,9 @@ describe('applyPreset with string preset names', () => {
|
|
|
47
47
|
it('relaxed enables only specific constraints', () => {
|
|
48
48
|
const config = applyPreset('relaxed');
|
|
49
49
|
expect(config.ironLaws).toBeDefined();
|
|
50
|
-
expect(config.ironLaws.
|
|
50
|
+
expect(config.ironLaws.no_completion_without_verification).toBeDefined();
|
|
51
51
|
expect(Object.keys(config.tips).length).toBe(0);
|
|
52
|
+
expect(Object.keys(config.prompts ?? {}).length).toBe(0);
|
|
52
53
|
expect(config.disabled.length).toBeGreaterThan(0);
|
|
53
54
|
});
|
|
54
55
|
});
|
|
@@ -57,13 +58,13 @@ describe('applyPreset with PresetConfig object', () => {
|
|
|
57
58
|
it('filters iron laws when ids are provided', () => {
|
|
58
59
|
const config = applyPreset({
|
|
59
60
|
name: 'custom',
|
|
60
|
-
ironLaws: ['
|
|
61
|
+
ironLaws: ['no_completion_without_verification', 'incremental_progress'],
|
|
61
62
|
guidelines: null,
|
|
62
|
-
|
|
63
|
+
prompts: null,
|
|
63
64
|
});
|
|
64
65
|
expect(Object.keys(config.ironLaws)).toHaveLength(2);
|
|
65
|
-
expect(config.ironLaws.
|
|
66
|
-
expect(config.ironLaws.
|
|
66
|
+
expect(config.ironLaws.no_completion_without_verification).toBeDefined();
|
|
67
|
+
expect(config.ironLaws.no_implementation_without_requirement).toBeUndefined();
|
|
67
68
|
});
|
|
68
69
|
|
|
69
70
|
it('includes all guidelines when null', () => {
|
|
@@ -71,10 +72,11 @@ describe('applyPreset with PresetConfig object', () => {
|
|
|
71
72
|
name: 'custom',
|
|
72
73
|
ironLaws: null,
|
|
73
74
|
guidelines: null,
|
|
74
|
-
|
|
75
|
+
prompts: [],
|
|
75
76
|
});
|
|
76
77
|
expect(Object.keys(config.guidelines).length).toBeGreaterThan(0);
|
|
77
78
|
expect(Object.keys(config.tips).length).toBe(0);
|
|
79
|
+
expect(Object.keys(config.prompts ?? {}).length).toBe(0);
|
|
78
80
|
});
|
|
79
81
|
|
|
80
82
|
it('creates disabled list for omitted constraints', () => {
|
|
@@ -82,7 +84,7 @@ describe('applyPreset with PresetConfig object', () => {
|
|
|
82
84
|
name: 'custom',
|
|
83
85
|
ironLaws: [],
|
|
84
86
|
guidelines: [],
|
|
85
|
-
|
|
87
|
+
prompts: [],
|
|
86
88
|
});
|
|
87
89
|
expect(config.disabled.length).toBeGreaterThan(0);
|
|
88
90
|
});
|
package/src/presets/standard.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 约束预设
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* 预设定义哪些约束被启用
|
|
5
|
+
*
|
|
6
|
+
* ADR-0001:tips 维度退役,替换为 prompts(纯注入层)。
|
|
5
7
|
*/
|
|
6
8
|
|
|
7
9
|
import type { Constraint } from '../types/constraint';
|
|
8
10
|
import type { MergedConstraintsConfig } from '../types/project-config';
|
|
9
|
-
import { IRON_LAWS, GUIDELINES,
|
|
11
|
+
import { IRON_LAWS, GUIDELINES, PROMPTS } from '../core/constraints/definitions';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* 预设配置
|
|
@@ -22,7 +24,7 @@ export interface PresetConfig {
|
|
|
22
24
|
guidelines: string[] | null;
|
|
23
25
|
|
|
24
26
|
/** 启用的提示 ID 列表(null 表示全部启用) */
|
|
25
|
-
|
|
27
|
+
prompts: string[] | null;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
/**
|
|
@@ -68,57 +70,64 @@ export function applyPreset(
|
|
|
68
70
|
if (!cfg.guidelines.includes(id)) disabled.push(id);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
73
|
+
if (cfg.prompts !== null) {
|
|
74
|
+
for (const id of Object.keys(PROMPTS)) {
|
|
75
|
+
if (!cfg.prompts.includes(id)) disabled.push(id);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
71
78
|
|
|
72
79
|
return {
|
|
73
80
|
ironLaws: filterByIds(IRON_LAWS, cfg.ironLaws),
|
|
74
81
|
guidelines: filterByIds(GUIDELINES, cfg.guidelines),
|
|
75
|
-
tips:
|
|
82
|
+
tips: {},
|
|
83
|
+
prompts: filterByIds(PROMPTS, cfg.prompts),
|
|
76
84
|
disabled,
|
|
77
85
|
custom: [],
|
|
86
|
+
unknownIds: [],
|
|
78
87
|
};
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
/**
|
|
82
91
|
* 严格预设
|
|
83
|
-
*
|
|
92
|
+
*
|
|
84
93
|
* 所有约束全部启用
|
|
85
94
|
*/
|
|
86
95
|
export const STRICT_PRESET: PresetConfig = {
|
|
87
96
|
name: 'strict',
|
|
88
97
|
ironLaws: null, // 全部启用
|
|
89
98
|
guidelines: null, // 全部启用
|
|
90
|
-
|
|
99
|
+
prompts: null, // 全部启用
|
|
91
100
|
};
|
|
92
101
|
|
|
93
102
|
/**
|
|
94
103
|
* 标准预设
|
|
95
|
-
*
|
|
104
|
+
*
|
|
96
105
|
* 铁律全部启用,指导原则和提示选择性启用
|
|
97
106
|
*/
|
|
98
107
|
export const STANDARD_PRESET: PresetConfig = {
|
|
99
108
|
name: 'standard',
|
|
100
109
|
ironLaws: null, // 全部启用
|
|
101
110
|
guidelines: null, // 全部启用
|
|
102
|
-
|
|
111
|
+
prompts: null, // 全部启用
|
|
103
112
|
};
|
|
104
113
|
|
|
105
114
|
/**
|
|
106
115
|
* 宽松预设
|
|
107
|
-
*
|
|
116
|
+
*
|
|
108
117
|
* 仅启用核心铁律,禁用提示
|
|
109
118
|
*/
|
|
110
119
|
export const RELAXED_PRESET: PresetConfig = {
|
|
111
120
|
name: 'relaxed',
|
|
112
121
|
ironLaws: [
|
|
113
|
-
'no_bypass_checkpoint',
|
|
114
|
-
'no_self_approval',
|
|
115
122
|
'no_completion_without_verification',
|
|
123
|
+
'incremental_progress',
|
|
124
|
+
'no_implementation_without_requirement',
|
|
116
125
|
],
|
|
117
126
|
guidelines: [
|
|
118
|
-
'
|
|
119
|
-
'
|
|
127
|
+
'no_bypass_checkpoint',
|
|
128
|
+
'no_hardcoded_credentials',
|
|
120
129
|
],
|
|
121
|
-
|
|
130
|
+
prompts: [], // 禁用提示
|
|
122
131
|
};
|
|
123
132
|
|
|
124
133
|
/**
|
|
@@ -135,4 +144,4 @@ export function getPreset(name: string): PresetConfig {
|
|
|
135
144
|
default:
|
|
136
145
|
return STANDARD_PRESET;
|
|
137
146
|
}
|
|
138
|
-
}
|
|
147
|
+
}
|
package/src/types/constraint.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 约束类型定义
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* kind 二元模型(ADR-0001):
|
|
5
|
+
* - check:必须带真实 checker,参与运行时检查与 trace 统计
|
|
6
|
+
* - iron_law:绝对禁止,无例外,违背即阻止执行
|
|
7
|
+
* - guideline:优先建议,有例外,违背发警告但不阻止
|
|
8
|
+
* - prompt:纯文本提示,仅参与 prompt 注入,不占检查位、不产生 trace
|
|
9
|
+
*
|
|
10
|
+
* 'tip' 层级已随 TIPS 退役(ADR-0001),仅保留在类型上以兼容
|
|
11
|
+
* ConstraintCheckResult.tips 等历史结果形态,不再有新定义使用。
|
|
8
12
|
*/
|
|
9
13
|
|
|
10
14
|
/**
|
|
@@ -12,10 +16,18 @@
|
|
|
12
16
|
*/
|
|
13
17
|
export type ConstraintId = string;
|
|
14
18
|
|
|
19
|
+
/**
|
|
20
|
+
* 约束类别:check = 可执行检查;prompt = 纯文本注入
|
|
21
|
+
*/
|
|
22
|
+
export type ConstraintKind = 'check' | 'prompt';
|
|
23
|
+
|
|
15
24
|
/**
|
|
16
25
|
* 约束层级
|
|
26
|
+
*
|
|
27
|
+
* check 层只使用 'iron_law' | 'guideline';prompt 类统一为 'prompt'。
|
|
28
|
+
* 'tip' 已退役,仅为历史结果结构兼容保留。
|
|
17
29
|
*/
|
|
18
|
-
export type ConstraintLevel = 'iron_law' | 'guideline' | 'tip';
|
|
30
|
+
export type ConstraintLevel = 'iron_law' | 'guideline' | 'prompt' | 'tip';
|
|
19
31
|
|
|
20
32
|
/**
|
|
21
33
|
* 约束触发条件(开放扩展)
|
|
@@ -31,7 +43,14 @@ export type ConstraintTrigger = string;
|
|
|
31
43
|
export interface Constraint {
|
|
32
44
|
/** 约束 ID */
|
|
33
45
|
id: ConstraintId;
|
|
34
|
-
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 约束类别(ADR-0001):
|
|
49
|
+
* - check:必须带真实 checker,参与运行时检查
|
|
50
|
+
* - prompt:纯文本提示,仅参与注入,不执行 checker
|
|
51
|
+
*/
|
|
52
|
+
kind: ConstraintKind;
|
|
53
|
+
|
|
35
54
|
/** 约束规则(英文) */
|
|
36
55
|
rule: string;
|
|
37
56
|
|
|
@@ -61,6 +80,12 @@ export interface Constraint {
|
|
|
61
80
|
|
|
62
81
|
/** 例外条件(仅 Guidelines 有效) */
|
|
63
82
|
exceptions?: string[];
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 适用场景标签(prompt 类专用,如 'agent-skill'、'llm-app')。
|
|
86
|
+
* 未标注表示通用场景。消费端(init 注入 / studio 路由)可按标签过滤。
|
|
87
|
+
*/
|
|
88
|
+
appliesTo?: string[];
|
|
64
89
|
}
|
|
65
90
|
|
|
66
91
|
/**
|
|
@@ -75,6 +100,15 @@ export interface ConstraintResult {
|
|
|
75
100
|
|
|
76
101
|
/** 是否满足 */
|
|
77
102
|
satisfied: boolean;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* 是否跳过评估(ADR-0001 三态语义)
|
|
106
|
+
*
|
|
107
|
+
* skip = 约定未采用(存在性探测未命中)或证据 flag 未接线(undefined)。
|
|
108
|
+
* skip 时 satisfied 恒为 true(fail-open,不阻断、不计警告),
|
|
109
|
+
* 但不计入 pass/fail 统计;trace 记录为 result: 'skip'。
|
|
110
|
+
*/
|
|
111
|
+
skipped?: boolean;
|
|
78
112
|
|
|
79
113
|
/** 约束定义 */
|
|
80
114
|
constraint?: Constraint;
|
|
@@ -95,6 +129,14 @@ export interface ConstraintResult {
|
|
|
95
129
|
export interface ConstraintContext {
|
|
96
130
|
/** 当前操作类型 */
|
|
97
131
|
operation: ConstraintTrigger;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 附加触发条件(ADR-0001:detectTrigger 的次级推断)
|
|
135
|
+
*
|
|
136
|
+
* pre-commit 变更包含代码文件时,operation 保持主推断(如 module_modification),
|
|
137
|
+
* code_implementation 记录在此;匹配约束时 operation 与 extraTriggers 一并参与。
|
|
138
|
+
*/
|
|
139
|
+
extraTriggers?: ConstraintTrigger[];
|
|
98
140
|
|
|
99
141
|
/** 工作流 ID */
|
|
100
142
|
workflowId?: string;
|
|
@@ -152,25 +194,25 @@ export interface ConstraintContext {
|
|
|
152
194
|
/** 是否只处理单个任务(用于 incremental_progress) */
|
|
153
195
|
hasSingleTask?: boolean;
|
|
154
196
|
|
|
155
|
-
/**
|
|
197
|
+
/** 是否已验证外部能力(对应约束已降级为 prompt,字段保留兼容) */
|
|
156
198
|
hasExternalCapabilityVerification?: boolean;
|
|
157
199
|
|
|
158
|
-
/**
|
|
200
|
+
/** 是否已对比需求验证(review 变体已并入主约束,字段保留兼容) */
|
|
159
201
|
hasRequirementReview?: boolean;
|
|
160
202
|
|
|
161
203
|
/** 是否有需求文档(用于 no_implementation_without_requirement) */
|
|
162
204
|
hasRequirement?: boolean;
|
|
163
205
|
|
|
164
|
-
/** 是否在 worktree
|
|
206
|
+
/** 是否在 worktree 中执行(对应约束已移出内置,字段保留兼容) */
|
|
165
207
|
hasWorktree?: boolean;
|
|
166
208
|
|
|
167
209
|
/** worktree 路径(用于 worktree 相关检查) */
|
|
168
210
|
worktreePath?: string;
|
|
169
211
|
|
|
170
|
-
/**
|
|
212
|
+
/** 完成声明文本(对应检查已并入 prompt 层,字段保留兼容) */
|
|
171
213
|
completionClaimText?: string;
|
|
172
214
|
|
|
173
|
-
/**
|
|
215
|
+
/** 是否完成两阶段审查(对应约束已移出内置,字段保留兼容) */
|
|
174
216
|
hasTwoStageReview?: boolean;
|
|
175
217
|
|
|
176
218
|
// ========================================
|
|
@@ -194,7 +236,7 @@ export interface ConstraintContext {
|
|
|
194
236
|
isSimpleAccessor?: boolean;
|
|
195
237
|
isPureDisplayComponent?: boolean;
|
|
196
238
|
|
|
197
|
-
//
|
|
239
|
+
// any 类型相关例外(对应约束已退役,字段保留兼容)
|
|
198
240
|
isJsonParseResult?: boolean;
|
|
199
241
|
isThirdPartyNoTypes?: boolean;
|
|
200
242
|
isLegacyMigration?: boolean;
|
|
@@ -238,7 +280,10 @@ export class ConstraintViolationError extends Error {
|
|
|
238
280
|
}
|
|
239
281
|
|
|
240
282
|
/**
|
|
241
|
-
*
|
|
283
|
+
* 约束检查结果(check 层)
|
|
284
|
+
*
|
|
285
|
+
* tips/tipCount 已随 TIPS 退役(ADR-0001),保留字段以兼容历史调用方,
|
|
286
|
+
* 内置约束下恒为空数组 / 0。
|
|
242
287
|
*/
|
|
243
288
|
export interface ConstraintCheckResult {
|
|
244
289
|
/** 铁律检查结果(必须全部通过) */
|
package/src/types/index.ts
CHANGED
|
@@ -15,12 +15,10 @@ export * from './trace';
|
|
|
15
15
|
// Performance 类型(Performance Trace 系统)
|
|
16
16
|
export * from './performance';
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// 诊断类型(定义已归位 types/monitoring-types.ts,monitoring 改从 types 导入)
|
|
19
19
|
// 显式再导出(不用 export *):根入口同时星导出 ./monitoring,星-星歧义会静默丢符号
|
|
20
20
|
export type {
|
|
21
21
|
Diagnosis,
|
|
22
|
-
ConstraintProposal,
|
|
23
|
-
ProposalReviewResult,
|
|
24
22
|
} from './monitoring-types';
|
|
25
23
|
|
|
26
24
|
// Session 类型(排除与 passes-gate 冲突的类型)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 监控域类型(诊断)
|
|
3
3
|
*
|
|
4
|
-
* 原定义位于 monitoring/constraint-doctor.ts
|
|
4
|
+
* 原定义位于 monitoring/constraint-doctor.ts,
|
|
5
5
|
* 但被 types/index.ts 反向再导出(类型层依赖业务模块,分层倒挂)。
|
|
6
6
|
* 工单 14 将类型定义归位到 types 层,monitoring 改从 types 导入。
|
|
7
7
|
*/
|
|
@@ -66,85 +66,3 @@ export interface Diagnosis {
|
|
|
66
66
|
/** 紧急程度 */
|
|
67
67
|
urgency: 'low' | 'medium' | 'high';
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* 约束提案
|
|
72
|
-
*/
|
|
73
|
-
export interface ConstraintProposal {
|
|
74
|
-
/** 提案 ID */
|
|
75
|
-
id: string;
|
|
76
|
-
|
|
77
|
-
/** 提案时间 */
|
|
78
|
-
proposedAt: number;
|
|
79
|
-
|
|
80
|
-
/** 来源诊断 */
|
|
81
|
-
diagnosisId: string;
|
|
82
|
-
|
|
83
|
-
/** 约束 ID */
|
|
84
|
-
constraintId: string;
|
|
85
|
-
|
|
86
|
-
/** 提案类型 */
|
|
87
|
-
type: 'add_exception' | 'remove_exception' | 'adjust_trigger' | 'change_level' | 'modify_message' | 'new_constraint';
|
|
88
|
-
|
|
89
|
-
/** 提案内容 */
|
|
90
|
-
content: {
|
|
91
|
-
/** 当前值(如果有) */
|
|
92
|
-
current?: any;
|
|
93
|
-
|
|
94
|
-
/** 建议值 */
|
|
95
|
-
proposed: any;
|
|
96
|
-
|
|
97
|
-
/** 变更描述 */
|
|
98
|
-
description: string;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
/** 理由 */
|
|
102
|
-
reasoning: string;
|
|
103
|
-
|
|
104
|
-
/** 预期效果 */
|
|
105
|
-
expectedOutcome: string;
|
|
106
|
-
|
|
107
|
-
/** 风险评估 */
|
|
108
|
-
risk: {
|
|
109
|
-
/** 风险等级 */
|
|
110
|
-
level: 'low' | 'medium' | 'high';
|
|
111
|
-
|
|
112
|
-
/** 风险描述 */
|
|
113
|
-
description: string;
|
|
114
|
-
|
|
115
|
-
/** 回滚方案 */
|
|
116
|
-
rollbackPlan?: string;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
/** 实施信息 */
|
|
120
|
-
implementation: {
|
|
121
|
-
/** 改动文件 */
|
|
122
|
-
files: string[];
|
|
123
|
-
|
|
124
|
-
/** 改动量估计 */
|
|
125
|
-
linesChanged: number;
|
|
126
|
-
|
|
127
|
-
/** 测试要求 */
|
|
128
|
-
testsRequired: boolean;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
/** 状态 */
|
|
132
|
-
status: 'proposed' | 'reviewing' | 'accepted' | 'rejected' | 'implemented';
|
|
133
|
-
|
|
134
|
-
/** 审核意见 */
|
|
135
|
-
reviewComment?: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* 提案审核结果
|
|
140
|
-
*/
|
|
141
|
-
export interface ProposalReviewResult {
|
|
142
|
-
/** 是否接受 */
|
|
143
|
-
accepted: boolean;
|
|
144
|
-
|
|
145
|
-
/** 审核意见 */
|
|
146
|
-
comment: string;
|
|
147
|
-
|
|
148
|
-
/** 修改建议(如果拒绝) */
|
|
149
|
-
modifications?: Partial<ConstraintProposal>;
|
|
150
|
-
}
|