@dommaker/harness 1.1.1 → 1.2.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 +17 -0
- package/README.md +2 -4
- package/bin/harness.js +12 -37
- package/dist/cli/commands/check.d.ts +2 -2
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +8 -33
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/constraints-report.js +1 -1
- package/dist/cli/commands/constraints-report.js.map +1 -1
- package/dist/cli/commands/constraints-retire.d.ts +6 -3
- package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
- package/dist/cli/commands/constraints-retire.js +34 -25
- package/dist/cli/commands/constraints-retire.js.map +1 -1
- package/dist/cli/commands/definitions.d.ts +2 -0
- package/dist/cli/commands/definitions.d.ts.map +1 -1
- package/dist/cli/commands/definitions.js.map +1 -1
- package/dist/cli/commands/init.d.ts +21 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +118 -40
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/knowledge.d.ts.map +1 -1
- package/dist/cli/commands/knowledge.js +1 -12
- package/dist/cli/commands/knowledge.js.map +1 -1
- package/dist/cli/commands/report.d.ts.map +1 -1
- package/dist/cli/commands/report.js +0 -2
- package/dist/cli/commands/report.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/context/index.d.ts +9 -6
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +18 -20
- package/dist/context/index.js.map +1 -1
- package/dist/core/constraints/capabilities-parser.d.ts +3 -2
- package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
- package/dist/core/constraints/capabilities-parser.js +25 -47
- package/dist/core/constraints/capabilities-parser.js.map +1 -1
- package/dist/core/constraints/checker.d.ts +29 -32
- package/dist/core/constraints/checker.d.ts.map +1 -1
- package/dist/core/constraints/checker.js +34 -126
- package/dist/core/constraints/checker.js.map +1 -1
- package/dist/core/constraints/checkers/governance-presence.d.ts +20 -0
- package/dist/core/constraints/checkers/governance-presence.d.ts.map +1 -0
- package/dist/core/constraints/checkers/governance-presence.js +76 -0
- package/dist/core/constraints/checkers/governance-presence.js.map +1 -0
- package/dist/core/constraints/checkers/index.d.ts +2 -1
- package/dist/core/constraints/checkers/index.d.ts.map +1 -1
- package/dist/core/constraints/checkers/index.js +5 -0
- package/dist/core/constraints/checkers/index.js.map +1 -1
- package/dist/core/constraints/checkers/types.d.ts +25 -0
- package/dist/core/constraints/checkers/types.d.ts.map +1 -1
- package/dist/core/constraints/checkers/types.js +24 -0
- package/dist/core/constraints/checkers/types.js.map +1 -1
- package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
- package/dist/core/constraints/definitions/guidelines.js +21 -2
- package/dist/core/constraints/definitions/guidelines.js.map +1 -1
- package/dist/core/constraints/definitions/prompts.d.ts.map +1 -1
- package/dist/core/constraints/definitions/prompts.js +0 -5
- package/dist/core/constraints/definitions/prompts.js.map +1 -1
- package/dist/core/constraints/index.d.ts +1 -2
- package/dist/core/constraints/index.d.ts.map +1 -1
- package/dist/core/constraints/index.js +1 -7
- package/dist/core/constraints/index.js.map +1 -1
- package/dist/core/constraints/injection-drift.d.ts +29 -4
- package/dist/core/constraints/injection-drift.d.ts.map +1 -1
- package/dist/core/constraints/injection-drift.js +52 -20
- package/dist/core/constraints/injection-drift.js.map +1 -1
- package/dist/core/constraints/usage-report.d.ts +1 -2
- package/dist/core/constraints/usage-report.d.ts.map +1 -1
- package/dist/core/constraints/usage-report.js +2 -5
- package/dist/core/constraints/usage-report.js.map +1 -1
- package/dist/core/effective-constraints.d.ts +24 -4
- package/dist/core/effective-constraints.d.ts.map +1 -1
- package/dist/core/effective-constraints.js +28 -7
- package/dist/core/effective-constraints.js.map +1 -1
- package/dist/core/effective-set.d.ts +30 -0
- package/dist/core/effective-set.d.ts.map +1 -0
- package/dist/core/effective-set.js +35 -0
- package/dist/core/effective-set.js.map +1 -0
- package/dist/core/index.d.ts +13 -6
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +44 -21
- package/dist/core/index.js.map +1 -1
- package/dist/core/project-config-loader.d.ts +3 -6
- package/dist/core/project-config-loader.d.ts.map +1 -1
- package/dist/core/project-config-loader.js +47 -61
- package/dist/core/project-config-loader.js.map +1 -1
- package/dist/failure/constraint-handler.d.ts +1 -1
- package/dist/failure/constraint-handler.js +1 -1
- package/dist/gates/checker-gate.d.ts +1 -4
- package/dist/gates/checker-gate.d.ts.map +1 -1
- package/dist/gates/checker-gate.js +3 -11
- package/dist/gates/checker-gate.js.map +1 -1
- package/dist/gates/definitions.d.ts +9 -38
- package/dist/gates/definitions.d.ts.map +1 -1
- package/dist/gates/definitions.js +24 -13
- package/dist/gates/definitions.js.map +1 -1
- package/dist/gates/effective-gates.d.ts.map +1 -1
- package/dist/gates/effective-gates.js +14 -18
- package/dist/gates/effective-gates.js.map +1 -1
- package/dist/gates/index.d.ts +1 -1
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js.map +1 -1
- package/dist/hooks/bootstrap.d.ts.map +1 -1
- package/dist/hooks/bootstrap.js +0 -3
- package/dist/hooks/bootstrap.js.map +1 -1
- package/dist/index.d.ts +43 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +180 -143
- package/dist/index.js.map +1 -1
- package/dist/knowledge/query.d.ts +15 -0
- package/dist/knowledge/query.d.ts.map +1 -1
- package/dist/knowledge/query.js +23 -0
- package/dist/knowledge/query.js.map +1 -1
- package/dist/monitoring/analyzer-base.d.ts +0 -4
- package/dist/monitoring/analyzer-base.d.ts.map +1 -1
- package/dist/monitoring/analyzer-base.js +0 -21
- package/dist/monitoring/analyzer-base.js.map +1 -1
- package/dist/monitoring/index.d.ts +6 -12
- package/dist/monitoring/index.d.ts.map +1 -1
- package/dist/monitoring/index.js +13 -29
- package/dist/monitoring/index.js.map +1 -1
- package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
- package/dist/monitoring/trace-analyzer.js +2 -68
- package/dist/monitoring/trace-analyzer.js.map +1 -1
- package/dist/monitoring/traces.d.ts +0 -4
- package/dist/monitoring/traces.d.ts.map +1 -1
- package/dist/monitoring/traces.js +0 -14
- package/dist/monitoring/traces.js.map +1 -1
- package/dist/presets/index.d.ts +2 -2
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +3 -4
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/standard.d.ts +10 -22
- package/dist/presets/standard.d.ts.map +1 -1
- package/dist/presets/standard.js +15 -75
- package/dist/presets/standard.js.map +1 -1
- package/dist/types/constraint.d.ts +1 -29
- package/dist/types/constraint.d.ts.map +1 -1
- package/dist/types/constraint.js +1 -1
- package/dist/types/constraint.js.map +1 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +1 -1
- package/dist/types/project-config.d.ts +4 -8
- package/dist/types/project-config.d.ts.map +1 -1
- package/dist/types/trace.d.ts +5 -18
- package/dist/types/trace.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/CONTEXT.md +4 -5
- package/src/__tests__/checker-extra.test.ts +33 -139
- package/src/__tests__/checker.test.ts +0 -376
- package/src/__tests__/governance-presence.test.ts +129 -0
- package/src/__tests__/iron-laws.test.ts +7 -7
- package/src/__tests__/project-config-loader-extra.test.ts +42 -29
- package/src/__tests__/public-exports.test.ts +138 -0
- package/src/__tests__/trace-analyzer-extra.test.ts +6 -86
- package/src/__tests__/trace-analyzer.test.ts +4 -5
- package/src/__tests__/trace-collector.test.ts +0 -11
- package/src/__tests__/traces.test.ts +3 -22
- package/src/cli/commands/CONTEXT.md +6 -3
- package/src/cli/commands/__tests__/check-skip-output.test.ts +10 -7
- package/src/cli/commands/__tests__/check.test.ts +29 -69
- package/src/cli/commands/__tests__/constraints-report.test.ts +3 -3
- package/src/cli/commands/__tests__/constraints-retire.test.ts +45 -4
- package/src/cli/commands/__tests__/init-injection.test.ts +202 -0
- package/src/cli/commands/__tests__/knowledge.test.ts +90 -1
- package/src/cli/commands/__tests__/registry.test.ts +8 -6
- package/src/cli/commands/__tests__/status-extra.test.ts +6 -6
- package/src/cli/commands/__tests__/status.test.ts +6 -6
- package/src/cli/commands/__tests__/sync-docs-agents.test.ts +28 -0
- package/src/cli/commands/check.ts +9 -35
- package/src/cli/commands/constraints-report.ts +1 -1
- package/src/cli/commands/constraints-retire.ts +38 -27
- package/src/cli/commands/definitions.ts +2 -0
- package/src/cli/commands/init.ts +129 -40
- package/src/cli/commands/knowledge.ts +1 -16
- package/src/cli/commands/report.ts +0 -2
- package/src/cli/commands/status.ts +2 -2
- package/src/context/index.ts +29 -6
- package/src/core/CONTEXT.md +4 -3
- package/src/core/__tests__/effective-set.test.ts +80 -0
- package/src/core/constraints/__tests__/injection-drift.test.ts +90 -0
- package/src/core/constraints/capabilities-parser.ts +43 -49
- package/src/core/constraints/checker.ts +51 -145
- package/src/core/constraints/checkers/governance-presence.ts +74 -0
- package/src/core/constraints/checkers/index.ts +4 -1
- package/src/core/constraints/checkers/types.ts +42 -0
- package/src/core/constraints/definitions/guidelines.ts +22 -2
- package/src/core/constraints/definitions/prompts.ts +0 -5
- package/src/core/constraints/index.ts +2 -17
- package/src/core/constraints/injection-drift.ts +60 -21
- package/src/core/constraints/usage-report.ts +5 -8
- package/src/core/effective-constraints.ts +35 -7
- package/src/core/effective-set.ts +56 -0
- package/src/core/index.ts +80 -6
- package/src/core/project-config-loader.ts +53 -68
- package/src/failure/CONTEXT.md +1 -1
- package/src/failure/constraint-handler.ts +1 -1
- package/src/gates/CONTEXT.md +3 -3
- package/src/gates/checker-gate.ts +4 -12
- package/src/gates/definitions.ts +27 -50
- package/src/gates/effective-gates.ts +14 -21
- package/src/gates/index.ts +1 -1
- package/src/hooks/bootstrap.ts +0 -3
- package/src/index.ts +384 -148
- package/src/knowledge/CONTEXT.md +2 -2
- package/src/knowledge/__tests__/query.test.ts +64 -0
- package/src/knowledge/query.ts +28 -0
- package/src/monitoring/CONTEXT.md +7 -13
- package/src/monitoring/__tests__/traces.test.ts +0 -10
- package/src/monitoring/analyzer-base.ts +0 -22
- package/src/monitoring/index.ts +6 -12
- package/src/monitoring/trace-analyzer.ts +2 -73
- package/src/monitoring/traces.ts +0 -20
- package/src/presets/__tests__/standard.test.ts +48 -69
- package/src/presets/index.ts +3 -5
- package/src/presets/standard.ts +14 -79
- package/src/spec/CONTEXT.md +5 -13
- package/src/types/constraint.ts +1 -51
- package/src/types/index.ts +0 -12
- package/src/types/project-config.ts +4 -10
- package/src/types/trace.ts +5 -30
- package/dist/core/constraints/interceptor.d.ts +0 -39
- package/dist/core/constraints/interceptor.d.ts.map +0 -1
- package/dist/core/constraints/interceptor.js +0 -166
- package/dist/core/constraints/interceptor.js.map +0 -1
- package/dist/dashboard/data.d.ts +0 -31
- package/dist/dashboard/data.d.ts.map +0 -1
- package/dist/dashboard/data.js +0 -81
- package/dist/dashboard/data.js.map +0 -1
- package/dist/dashboard/index.d.ts +0 -4
- package/dist/dashboard/index.d.ts.map +0 -1
- package/dist/dashboard/index.js +0 -20
- package/dist/dashboard/index.js.map +0 -1
- package/dist/dashboard/stats.d.ts +0 -20
- package/dist/dashboard/stats.d.ts.map +0 -1
- package/dist/dashboard/stats.js +0 -115
- package/dist/dashboard/stats.js.map +0 -1
- package/dist/dashboard/types.d.ts +0 -110
- package/dist/dashboard/types.d.ts.map +0 -1
- package/dist/dashboard/types.js +0 -8
- package/dist/dashboard/types.js.map +0 -1
- package/dist/monitoring/constraint-doctor.d.ts +0 -76
- package/dist/monitoring/constraint-doctor.d.ts.map +0 -1
- package/dist/monitoring/constraint-doctor.js +0 -189
- package/dist/monitoring/constraint-doctor.js.map +0 -1
- package/dist/monitoring/diagnosis-rules.d.ts +0 -18
- package/dist/monitoring/diagnosis-rules.d.ts.map +0 -1
- package/dist/monitoring/diagnosis-rules.js +0 -119
- package/dist/monitoring/diagnosis-rules.js.map +0 -1
- package/dist/monitoring/knowledge-doctor.d.ts +0 -78
- package/dist/monitoring/knowledge-doctor.d.ts.map +0 -1
- package/dist/monitoring/knowledge-doctor.js +0 -266
- package/dist/monitoring/knowledge-doctor.js.map +0 -1
- package/dist/monitoring/knowledge-evolver.d.ts +0 -72
- package/dist/monitoring/knowledge-evolver.d.ts.map +0 -1
- package/dist/monitoring/knowledge-evolver.js +0 -205
- package/dist/monitoring/knowledge-evolver.js.map +0 -1
- package/dist/monitoring/performance-analyzer.d.ts +0 -92
- package/dist/monitoring/performance-analyzer.d.ts.map +0 -1
- package/dist/monitoring/performance-analyzer.js +0 -343
- package/dist/monitoring/performance-analyzer.js.map +0 -1
- package/dist/monitoring/performance-collector.d.ts +0 -103
- package/dist/monitoring/performance-collector.d.ts.map +0 -1
- package/dist/monitoring/performance-collector.js +0 -298
- package/dist/monitoring/performance-collector.js.map +0 -1
- package/dist/safety/index.d.ts +0 -6
- package/dist/safety/index.d.ts.map +0 -1
- package/dist/safety/index.js +0 -22
- package/dist/safety/index.js.map +0 -1
- package/dist/safety/input-guardrail.d.ts +0 -36
- package/dist/safety/input-guardrail.d.ts.map +0 -1
- package/dist/safety/input-guardrail.js +0 -118
- package/dist/safety/input-guardrail.js.map +0 -1
- package/dist/safety/output-guardrail.d.ts +0 -39
- package/dist/safety/output-guardrail.d.ts.map +0 -1
- package/dist/safety/output-guardrail.js +0 -147
- package/dist/safety/output-guardrail.js.map +0 -1
- package/dist/safety/sandbox.d.ts +0 -45
- package/dist/safety/sandbox.d.ts.map +0 -1
- package/dist/safety/sandbox.js +0 -134
- package/dist/safety/sandbox.js.map +0 -1
- package/dist/safety/tool-guardrail.d.ts +0 -51
- package/dist/safety/tool-guardrail.d.ts.map +0 -1
- package/dist/safety/tool-guardrail.js +0 -147
- package/dist/safety/tool-guardrail.js.map +0 -1
- package/dist/safety/types.d.ts +0 -104
- package/dist/safety/types.d.ts.map +0 -1
- package/dist/safety/types.js +0 -6
- package/dist/safety/types.js.map +0 -1
- package/dist/spec/annotation-checker.d.ts +0 -47
- package/dist/spec/annotation-checker.d.ts.map +0 -1
- package/dist/spec/annotation-checker.js +0 -279
- package/dist/spec/annotation-checker.js.map +0 -1
- package/dist/types/enforcement.d.ts +0 -42
- package/dist/types/enforcement.d.ts.map +0 -1
- package/dist/types/enforcement.js +0 -6
- package/dist/types/enforcement.js.map +0 -1
- package/dist/types/monitoring-types.d.ts +0 -53
- package/dist/types/monitoring-types.d.ts.map +0 -1
- package/dist/types/monitoring-types.js +0 -10
- package/dist/types/monitoring-types.js.map +0 -1
- package/dist/types/performance.d.ts +0 -204
- package/dist/types/performance.d.ts.map +0 -1
- package/dist/types/performance.js +0 -12
- package/dist/types/performance.js.map +0 -1
- package/dist/verification/index.d.ts +0 -4
- package/dist/verification/index.d.ts.map +0 -1
- package/dist/verification/index.js +0 -20
- package/dist/verification/index.js.map +0 -1
- package/dist/verification/loop.d.ts +0 -30
- package/dist/verification/loop.d.ts.map +0 -1
- package/dist/verification/loop.js +0 -114
- package/dist/verification/loop.js.map +0 -1
- package/dist/verification/rules-based.d.ts +0 -40
- package/dist/verification/rules-based.d.ts.map +0 -1
- package/dist/verification/rules-based.js +0 -130
- package/dist/verification/rules-based.js.map +0 -1
- package/dist/verification/types.d.ts +0 -69
- package/dist/verification/types.d.ts.map +0 -1
- package/dist/verification/types.js +0 -6
- package/dist/verification/types.js.map +0 -1
- package/src/__tests__/annotation-checker.test.ts +0 -183
- package/src/__tests__/constraint-doctor.test.ts +0 -271
- package/src/__tests__/doctor-extra.test.ts +0 -155
- package/src/__tests__/extend-exceptions.test.ts +0 -149
- package/src/__tests__/interceptor.test.ts +0 -89
- package/src/__tests__/performance-analyzer.test.ts +0 -499
- package/src/__tests__/performance-collector.test.ts +0 -276
- package/src/__tests__/presets.test.ts +0 -65
- package/src/core/constraints/__tests__/interceptor.test.ts +0 -267
- package/src/core/constraints/interceptor.ts +0 -217
- package/src/dashboard/CONTEXT.md +0 -21
- package/src/dashboard/__tests__/data.test.ts +0 -111
- package/src/dashboard/__tests__/stats.test.ts +0 -159
- package/src/dashboard/data.ts +0 -103
- package/src/dashboard/index.ts +0 -3
- package/src/dashboard/stats.ts +0 -127
- package/src/dashboard/types.ts +0 -130
- package/src/monitoring/__tests__/knowledge-doctor.test.ts +0 -278
- package/src/monitoring/__tests__/knowledge-evolver.test.ts +0 -368
- package/src/monitoring/__tests__/performance-analyzer.test.ts +0 -137
- package/src/monitoring/__tests__/performance-collector.test.ts +0 -331
- package/src/monitoring/constraint-doctor.ts +0 -228
- package/src/monitoring/diagnosis-rules.ts +0 -132
- package/src/monitoring/knowledge-doctor.ts +0 -322
- package/src/monitoring/knowledge-evolver.ts +0 -289
- package/src/monitoring/performance-analyzer.ts +0 -400
- package/src/monitoring/performance-collector.ts +0 -326
- package/src/safety/CONTEXT.md +0 -23
- package/src/safety/__tests__/input-guardrail.test.ts +0 -105
- package/src/safety/__tests__/output-guardrail.test.ts +0 -108
- package/src/safety/__tests__/sandbox.test.ts +0 -158
- package/src/safety/__tests__/tool-guardrail.test.ts +0 -127
- package/src/safety/index.ts +0 -5
- package/src/safety/input-guardrail.ts +0 -133
- package/src/safety/output-guardrail.ts +0 -170
- package/src/safety/sandbox.ts +0 -148
- package/src/safety/tool-guardrail.ts +0 -176
- package/src/safety/types.ts +0 -124
- package/src/spec/__tests__/annotation-checker.test.ts +0 -294
- package/src/spec/annotation-checker.ts +0 -320
- package/src/types/enforcement.ts +0 -48
- package/src/types/monitoring-types.ts +0 -68
- package/src/types/performance.ts +0 -295
- package/src/verification/CONTEXT.md +0 -23
- package/src/verification/__tests__/loop.test.ts +0 -303
- package/src/verification/__tests__/rules-based.test.ts +0 -240
- package/src/verification/index.ts +0 -3
- package/src/verification/loop.ts +0 -137
- package/src/verification/rules-based.ts +0 -152
- package/src/verification/types.ts +0 -81
package/src/types/constraint.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* kind 二元模型(ADR-0001):
|
|
5
5
|
* - check:必须带真实 checker,参与运行时检查与 trace 统计
|
|
6
6
|
* - iron_law:绝对禁止,无例外,违背即阻止执行
|
|
7
|
-
* - guideline
|
|
7
|
+
* - guideline:优先建议,违背发警告但不阻止
|
|
8
8
|
* - prompt:纯文本提示,仅参与 prompt 注入,不占检查位、不产生 trace
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -74,9 +74,6 @@ export interface Constraint {
|
|
|
74
74
|
/** 是否启用 */
|
|
75
75
|
enabled?: boolean;
|
|
76
76
|
|
|
77
|
-
/** 例外条件(仅 Guidelines 有效) */
|
|
78
|
-
exceptions?: string[];
|
|
79
|
-
|
|
80
77
|
/**
|
|
81
78
|
* 适用场景标签(prompt 类专用,如 'agent-skill'、'llm-app')。
|
|
82
79
|
* 未标注表示通用场景。消费端(init 注入 / studio 路由)可按标签过滤。
|
|
@@ -210,54 +207,7 @@ export interface ConstraintContext {
|
|
|
210
207
|
|
|
211
208
|
/** 是否完成两阶段审查(对应约束已移出内置,字段保留兼容) */
|
|
212
209
|
hasTwoStageReview?: boolean;
|
|
213
|
-
|
|
214
|
-
// ========================================
|
|
215
|
-
// 例外条件(用于 Guidelines)
|
|
216
|
-
// ========================================
|
|
217
|
-
|
|
218
|
-
// simplest_solution_first 例外
|
|
219
|
-
scalabilityRequired?: boolean;
|
|
220
|
-
securityRequired?: boolean;
|
|
221
|
-
performanceRequired?: boolean;
|
|
222
|
-
reliabilityRequired?: boolean;
|
|
223
|
-
|
|
224
|
-
// no_fix_without_root_cause 例外
|
|
225
|
-
isSimpleTypo?: boolean;
|
|
226
|
-
isConfigValueError?: boolean;
|
|
227
|
-
isMissingConfig?: boolean;
|
|
228
|
-
|
|
229
|
-
// no_code_without_test 例外
|
|
230
|
-
isConfigFile?: boolean;
|
|
231
|
-
isTypeDefinition?: boolean;
|
|
232
|
-
isSimpleAccessor?: boolean;
|
|
233
|
-
isPureDisplayComponent?: boolean;
|
|
234
|
-
|
|
235
|
-
// any 类型相关例外(对应约束已退役,字段保留兼容)
|
|
236
|
-
isJsonParseResult?: boolean;
|
|
237
|
-
isThirdPartyNoTypes?: boolean;
|
|
238
|
-
isLegacyMigration?: boolean;
|
|
239
|
-
|
|
240
|
-
// capability_sync 例外
|
|
241
|
-
isInternalRefactor?: boolean;
|
|
242
|
-
isBugFixOnly?: boolean;
|
|
243
|
-
isPerformanceOptimization?: boolean;
|
|
244
|
-
|
|
245
|
-
// no_simplification_without_approval 例外
|
|
246
|
-
isRedundantCodeCleanup?: boolean;
|
|
247
|
-
isSameEffectRefactor?: boolean;
|
|
248
|
-
isUnusedCodeRemoval?: boolean;
|
|
249
210
|
|
|
250
|
-
// 设计决策例外
|
|
251
|
-
isExplicitInstruction?: boolean;
|
|
252
|
-
isEmergencyFix?: boolean;
|
|
253
|
-
isExistingDesign?: boolean;
|
|
254
|
-
|
|
255
|
-
// 外部依赖相关
|
|
256
|
-
isExternalDependency?: boolean;
|
|
257
|
-
|
|
258
|
-
/** 例外理由说明 */
|
|
259
|
-
exceptionReason?: string;
|
|
260
|
-
|
|
261
211
|
/** 执行上下文 */
|
|
262
212
|
executionContext?: any;
|
|
263
213
|
}
|
package/src/types/index.ts
CHANGED
|
@@ -12,15 +12,6 @@ export * from './cso';
|
|
|
12
12
|
// Trace 类型(Execution Trace 系统)
|
|
13
13
|
export * from './trace';
|
|
14
14
|
|
|
15
|
-
// Performance 类型(Performance Trace 系统)
|
|
16
|
-
export * from './performance';
|
|
17
|
-
|
|
18
|
-
// 诊断类型(定义已归位 types/monitoring-types.ts,monitoring 改从 types 导入)
|
|
19
|
-
// 显式再导出(不用 export *):根入口同时星导出 ./monitoring,星-星歧义会静默丢符号
|
|
20
|
-
export type {
|
|
21
|
-
Diagnosis,
|
|
22
|
-
} from './monitoring-types';
|
|
23
|
-
|
|
24
15
|
// Session 类型(排除与 passes-gate 冲突的类型)
|
|
25
16
|
export {
|
|
26
17
|
StartupCheckpoints,
|
|
@@ -40,9 +31,6 @@ export { DynamicTask as ExtendedDynamicTask, TaskTestResult as ExtendedTaskTestR
|
|
|
40
31
|
// 项目配置类型
|
|
41
32
|
export * from './project-config';
|
|
42
33
|
|
|
43
|
-
// Enforcement 类型
|
|
44
|
-
export * from './enforcement';
|
|
45
|
-
|
|
46
34
|
// Spec 验证类型
|
|
47
35
|
export * from './spec';
|
|
48
36
|
|
|
@@ -13,24 +13,18 @@ export interface CustomConstraintDefinition {
|
|
|
13
13
|
/** 约束 ID */
|
|
14
14
|
id: string;
|
|
15
15
|
|
|
16
|
-
/**
|
|
16
|
+
/** 约束层级(可选,缺省 guideline) */
|
|
17
17
|
level?: ConstraintLevel;
|
|
18
18
|
|
|
19
|
-
/**
|
|
19
|
+
/** 约束规则(可选) */
|
|
20
20
|
rule?: string;
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/** 约束消息(可选) */
|
|
23
23
|
message?: string;
|
|
24
24
|
|
|
25
|
-
/**
|
|
25
|
+
/** 触发条件(可选) */
|
|
26
26
|
trigger?: string | string[];
|
|
27
27
|
|
|
28
|
-
/** 例外条件(可选,完全覆盖内置例外) */
|
|
29
|
-
exceptions?: string[];
|
|
30
|
-
|
|
31
|
-
/** 扩展例外(可选,追加到内置例外) */
|
|
32
|
-
extend_exceptions?: string[];
|
|
33
|
-
|
|
34
28
|
/** 描述(可选) */
|
|
35
29
|
description?: string;
|
|
36
30
|
|
package/src/types/trace.ts
CHANGED
|
@@ -35,7 +35,7 @@ export interface ExecutionTrace {
|
|
|
35
35
|
timestamp: number;
|
|
36
36
|
|
|
37
37
|
/** 检查结果(skip = 约定未采用/证据未接线,未评估;不计 pass/fail 分母) */
|
|
38
|
-
result: 'pass' | 'fail' | '
|
|
38
|
+
result: 'pass' | 'fail' | 'skip';
|
|
39
39
|
|
|
40
40
|
// ========================================
|
|
41
41
|
// 轻量上下文(可选)
|
|
@@ -47,9 +47,6 @@ export interface ExecutionTrace {
|
|
|
47
47
|
/** 严重性(从约束定义继承) */
|
|
48
48
|
severity?: 'error' | 'warning' | 'info';
|
|
49
49
|
|
|
50
|
-
/** 例外类型(如果适用了例外) */
|
|
51
|
-
exceptionApplied?: string;
|
|
52
|
-
|
|
53
50
|
/** 项目路径(用于区分多项目) */
|
|
54
51
|
projectPath?: string;
|
|
55
52
|
|
|
@@ -98,10 +95,7 @@ export interface TraceSummary {
|
|
|
98
95
|
/** 失败次数 */
|
|
99
96
|
failCount: number;
|
|
100
97
|
|
|
101
|
-
/**
|
|
102
|
-
bypassCount: number;
|
|
103
|
-
|
|
104
|
-
/** 跳过次数(ADR-0001:约定未采用/证据未接线;不计入 pass/fail/bypass 率分母) */
|
|
98
|
+
/** 跳过次数(ADR-0001:约定未采用/证据未接线;不计入 pass/fail 率分母) */
|
|
105
99
|
skipCount?: number;
|
|
106
100
|
|
|
107
101
|
/** 用户忽略次数 */
|
|
@@ -117,9 +111,6 @@ export interface TraceSummary {
|
|
|
117
111
|
/** 失败率 (0-1) */
|
|
118
112
|
failRate: number;
|
|
119
113
|
|
|
120
|
-
/** 绕过率 (0-1) */
|
|
121
|
-
bypassRate: number;
|
|
122
|
-
|
|
123
114
|
// ========================================
|
|
124
115
|
// 趋势分析
|
|
125
116
|
// ========================================
|
|
@@ -131,18 +122,7 @@ export interface TraceSummary {
|
|
|
131
122
|
changeFromLastPeriod?: {
|
|
132
123
|
passRateDelta: number;
|
|
133
124
|
failRateDelta: number;
|
|
134
|
-
bypassRateDelta: number;
|
|
135
125
|
};
|
|
136
|
-
|
|
137
|
-
// ========================================
|
|
138
|
-
// 例外统计
|
|
139
|
-
// ========================================
|
|
140
|
-
|
|
141
|
-
/** 例外应用次数 */
|
|
142
|
-
exceptionCount: number;
|
|
143
|
-
|
|
144
|
-
/** 最常见例外 */
|
|
145
|
-
mostCommonException?: string;
|
|
146
126
|
}
|
|
147
127
|
|
|
148
128
|
/**
|
|
@@ -151,11 +131,8 @@ export interface TraceSummary {
|
|
|
151
131
|
export interface TraceAnomaly {
|
|
152
132
|
/** 异常类型 */
|
|
153
133
|
type:
|
|
154
|
-
| 'high_bypass_rate' // 绕过率过高
|
|
155
134
|
| 'rising_fail_rate' // 失败率上升
|
|
156
|
-
| '
|
|
157
|
-
| 'low_pass_rate' // 通过率过低
|
|
158
|
-
| 'exception_overuse'; // 例外滥用
|
|
135
|
+
| 'low_pass_rate'; // 通过率过低
|
|
159
136
|
|
|
160
137
|
/** 约束 ID */
|
|
161
138
|
constraintId: string;
|
|
@@ -177,7 +154,7 @@ export interface TraceAnomaly {
|
|
|
177
154
|
detectedAt: number;
|
|
178
155
|
|
|
179
156
|
/** 建议的下一步 */
|
|
180
|
-
suggestedAction?: 'diagnose' | 'adjust_threshold' | '
|
|
157
|
+
suggestedAction?: 'diagnose' | 'adjust_threshold' | 'notify_user';
|
|
181
158
|
}
|
|
182
159
|
|
|
183
160
|
/**
|
|
@@ -191,7 +168,7 @@ export interface TraceFilter {
|
|
|
191
168
|
level?: 'iron_law' | 'guideline' | 'prompt';
|
|
192
169
|
|
|
193
170
|
/** 结果类型(可选) */
|
|
194
|
-
result?: 'pass' | 'fail' | '
|
|
171
|
+
result?: 'pass' | 'fail' | 'skip';
|
|
195
172
|
|
|
196
173
|
/** 时间范围(可选) */
|
|
197
174
|
timeRange?: {
|
|
@@ -232,8 +209,6 @@ export interface TraceAnalyzerConfig {
|
|
|
232
209
|
|
|
233
210
|
/** 异常阈值 */
|
|
234
211
|
thresholds?: {
|
|
235
|
-
bypassRate?: number; // 绕过率阈值,默认 0.3
|
|
236
212
|
failRate?: number; // 失败率阈值,默认 0.5
|
|
237
|
-
exceptionRate?: number; // 例外率阈值,默认 0.4
|
|
238
213
|
};
|
|
239
214
|
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ConstraintInterceptor - 约束拦截器
|
|
3
|
-
*/
|
|
4
|
-
import type { ConstraintTrigger, ConstraintContext } from '../../types/constraint';
|
|
5
|
-
import type { EnforcementId, EnforcementExecutor, InterceptionResult } from '../../types/enforcement';
|
|
6
|
-
import type { MergedConstraintsConfig } from '../../types/project-config';
|
|
7
|
-
export declare class ConstraintInterceptor {
|
|
8
|
-
private static instance;
|
|
9
|
-
private executors;
|
|
10
|
-
private executorSources;
|
|
11
|
-
private enabled;
|
|
12
|
-
private skipEnforcements;
|
|
13
|
-
private constructor();
|
|
14
|
-
static getInstance(): ConstraintInterceptor;
|
|
15
|
-
setEnabled(enabled: boolean): void;
|
|
16
|
-
register(enforcementId: EnforcementId, executor: EnforcementExecutor, source?: string): void;
|
|
17
|
-
registerBatch(registrations: Array<{
|
|
18
|
-
enforcementId: EnforcementId;
|
|
19
|
-
executor: EnforcementExecutor;
|
|
20
|
-
}>): void;
|
|
21
|
-
unregister(enforcementId: EnforcementId): boolean;
|
|
22
|
-
hasExecutor(enforcementId: EnforcementId): boolean;
|
|
23
|
-
getExecutor(enforcementId: EnforcementId): EnforcementExecutor | undefined;
|
|
24
|
-
getRegistrations(): {
|
|
25
|
-
id: EnforcementId;
|
|
26
|
-
executor: EnforcementExecutor;
|
|
27
|
-
registeredAt: Date;
|
|
28
|
-
source?: string;
|
|
29
|
-
}[];
|
|
30
|
-
skip(enforcementIds: EnforcementId[]): void;
|
|
31
|
-
clearSkips(): void;
|
|
32
|
-
intercept(trigger: ConstraintTrigger, context: ConstraintContext, customConfig?: MergedConstraintsConfig | null): Promise<InterceptionResult>;
|
|
33
|
-
claim(trigger: ConstraintTrigger, context: ConstraintContext): Promise<void>;
|
|
34
|
-
canProceed(trigger: ConstraintTrigger, context: ConstraintContext): Promise<boolean>;
|
|
35
|
-
}
|
|
36
|
-
export declare const constraintInterceptor: ConstraintInterceptor;
|
|
37
|
-
export declare function interceptOperation(trigger: ConstraintTrigger, context: ConstraintContext, customConfig?: MergedConstraintsConfig | null): Promise<InterceptionResult>;
|
|
38
|
-
export declare function claimOperation(trigger: ConstraintTrigger, context: ConstraintContext): Promise<void>;
|
|
39
|
-
//# sourceMappingURL=interceptor.d.ts.map
|
|
@@ -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EAAE,GAAG,IAAI;IAM3C,UAAU,IAAI,IAAI;IAIZ,SAAS,CACb,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,EAC1B,YAAY,CAAC,EAAE,uBAAuB,GAAG,IAAI,GAC5C,OAAO,CAAC,kBAAkB,CAAC;IAmFxB,KAAK,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa5E,UAAU,CAAC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAO3F;AAED,eAAO,MAAM,qBAAqB,uBAAsC,CAAC;AAEzE,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,EAC1B,YAAY,CAAC,EAAE,uBAAuB,GAAG,IAAI,GAC5C,OAAO,CAAC,kBAAkB,CAAC,CAE7B;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* ConstraintInterceptor - 约束拦截器
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.constraintInterceptor = exports.ConstraintInterceptor = void 0;
|
|
7
|
-
exports.interceptOperation = interceptOperation;
|
|
8
|
-
exports.claimOperation = claimOperation;
|
|
9
|
-
const constraint_1 = require("../../types/constraint");
|
|
10
|
-
const exec_1 = require("../../utils/exec");
|
|
11
|
-
const checker_1 = require("./checker");
|
|
12
|
-
class ConstraintInterceptor {
|
|
13
|
-
static instance;
|
|
14
|
-
executors = new Map();
|
|
15
|
-
executorSources = new Map();
|
|
16
|
-
enabled = true;
|
|
17
|
-
skipEnforcements = new Set();
|
|
18
|
-
constructor() { }
|
|
19
|
-
static getInstance() {
|
|
20
|
-
if (!ConstraintInterceptor.instance) {
|
|
21
|
-
ConstraintInterceptor.instance = new ConstraintInterceptor();
|
|
22
|
-
}
|
|
23
|
-
return ConstraintInterceptor.instance;
|
|
24
|
-
}
|
|
25
|
-
setEnabled(enabled) {
|
|
26
|
-
this.enabled = enabled;
|
|
27
|
-
}
|
|
28
|
-
register(enforcementId, executor, source) {
|
|
29
|
-
this.executors.set(enforcementId, executor);
|
|
30
|
-
if (source)
|
|
31
|
-
this.executorSources.set(enforcementId, source);
|
|
32
|
-
}
|
|
33
|
-
registerBatch(registrations) {
|
|
34
|
-
for (const { enforcementId, executor } of registrations) {
|
|
35
|
-
this.register(enforcementId, executor);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
unregister(enforcementId) {
|
|
39
|
-
return this.executors.delete(enforcementId);
|
|
40
|
-
}
|
|
41
|
-
hasExecutor(enforcementId) {
|
|
42
|
-
return this.executors.has(enforcementId);
|
|
43
|
-
}
|
|
44
|
-
getExecutor(enforcementId) {
|
|
45
|
-
return this.executors.get(enforcementId);
|
|
46
|
-
}
|
|
47
|
-
getRegistrations() {
|
|
48
|
-
return Array.from(this.executors.entries()).map(([id, executor]) => ({
|
|
49
|
-
id,
|
|
50
|
-
executor,
|
|
51
|
-
registeredAt: new Date(),
|
|
52
|
-
source: this.executorSources.get(id),
|
|
53
|
-
}));
|
|
54
|
-
}
|
|
55
|
-
skip(enforcementIds) {
|
|
56
|
-
for (const id of enforcementIds) {
|
|
57
|
-
this.skipEnforcements.add(id);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
clearSkips() {
|
|
61
|
-
this.skipEnforcements.clear();
|
|
62
|
-
}
|
|
63
|
-
async intercept(trigger, context, customConfig) {
|
|
64
|
-
if (!this.enabled) {
|
|
65
|
-
return {
|
|
66
|
-
passed: true,
|
|
67
|
-
constraints: [],
|
|
68
|
-
violations: [],
|
|
69
|
-
message: '拦截器已禁用',
|
|
70
|
-
interceptedAt: new Date(),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
const result = {
|
|
74
|
-
passed: true,
|
|
75
|
-
constraints: [],
|
|
76
|
-
violations: [],
|
|
77
|
-
interceptedAt: new Date(),
|
|
78
|
-
};
|
|
79
|
-
const constraints = checker_1.constraintChecker.getConstraints(customConfig);
|
|
80
|
-
// prompt 类约束不参与拦截执行(ADR-0001:仅参与注入)
|
|
81
|
-
const allConstraints = [
|
|
82
|
-
...Object.values(constraints.ironLaws),
|
|
83
|
-
...Object.values(constraints.guidelines),
|
|
84
|
-
].filter(c => c.kind !== 'prompt');
|
|
85
|
-
const applicableConstraints = allConstraints.filter((c) => (0, exec_1.normalizeTriggers)(c.trigger).includes(trigger));
|
|
86
|
-
const order = { iron_law: 0, guideline: 1, prompt: 2 };
|
|
87
|
-
const ordered = applicableConstraints.sort((a, b) => order[a.level] - order[b.level]);
|
|
88
|
-
for (const constraint of ordered) {
|
|
89
|
-
if (this.skipEnforcements.has(constraint.enforcement)) {
|
|
90
|
-
result.constraints.push({ constraint, skipped: true, skipReason: 'configured to skip' });
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
// Custom executor overrides built-in check
|
|
94
|
-
const executor = this.executors.get(constraint.enforcement);
|
|
95
|
-
let checkResult;
|
|
96
|
-
if (executor) {
|
|
97
|
-
const enforcementContext = { ...context, enforcementId: constraint.enforcement, constraint };
|
|
98
|
-
const start = Date.now();
|
|
99
|
-
try {
|
|
100
|
-
const enforcementResult = await executor.execute(enforcementContext);
|
|
101
|
-
enforcementResult.duration = Date.now() - start;
|
|
102
|
-
result.constraints.push({ constraint, enforcementResult });
|
|
103
|
-
checkResult = {
|
|
104
|
-
id: constraint.id, level: constraint.level,
|
|
105
|
-
satisfied: enforcementResult.passed,
|
|
106
|
-
message: enforcementResult.message,
|
|
107
|
-
checkedAt: new Date(),
|
|
108
|
-
constraint,
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
if (error instanceof constraint_1.ConstraintViolationError)
|
|
113
|
-
throw error;
|
|
114
|
-
result.constraints.push({ constraint, enforcementResult: { passed: false, error: error.message, duration: Date.now() - start } });
|
|
115
|
-
checkResult = { id: constraint.id, level: constraint.level, satisfied: false, message: error.message, checkedAt: new Date(), constraint };
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
// Unified: constraint.check(context) delegates to checker
|
|
120
|
-
checkResult = await constraint.check(context);
|
|
121
|
-
result.constraints.push({ constraint, enforcementResult: { passed: checkResult.satisfied, message: checkResult.message } });
|
|
122
|
-
}
|
|
123
|
-
if (!checkResult.satisfied) {
|
|
124
|
-
if (constraint.level === 'iron_law') {
|
|
125
|
-
result.passed = false;
|
|
126
|
-
result.violations.push(constraint);
|
|
127
|
-
throw new constraint_1.ConstraintViolationError(checkResult);
|
|
128
|
-
}
|
|
129
|
-
if (constraint.level === 'guideline') {
|
|
130
|
-
result.violations.push(constraint);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
result.message = result.violations.length === 0 ? '✅ 拦截通过' : `❌ ${result.violations.length} 个约束违规`;
|
|
135
|
-
return result;
|
|
136
|
-
}
|
|
137
|
-
async claim(trigger, context) {
|
|
138
|
-
const result = await this.intercept(trigger, context);
|
|
139
|
-
if (!result.passed) {
|
|
140
|
-
throw new constraint_1.ConstraintViolationError({
|
|
141
|
-
id: result.violations[0]?.id || 'unknown',
|
|
142
|
-
level: 'iron_law',
|
|
143
|
-
satisfied: false,
|
|
144
|
-
message: result.message,
|
|
145
|
-
checkedAt: new Date(),
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
async canProceed(trigger, context) {
|
|
150
|
-
try {
|
|
151
|
-
return (await this.intercept(trigger, context)).passed;
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
exports.ConstraintInterceptor = ConstraintInterceptor;
|
|
159
|
-
exports.constraintInterceptor = ConstraintInterceptor.getInstance();
|
|
160
|
-
async function interceptOperation(trigger, context, customConfig) {
|
|
161
|
-
return exports.constraintInterceptor.intercept(trigger, context, customConfig);
|
|
162
|
-
}
|
|
163
|
-
async function claimOperation(trigger, context) {
|
|
164
|
-
return exports.constraintInterceptor.claim(trigger, context);
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=interceptor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interceptor.js","sourceRoot":"","sources":["../../../src/core/constraints/interceptor.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAyMH,gDAMC;AAED,wCAKC;AA9MD,uDAAkE;AAClE,2CAAqD;AAQrD,uCAA8C;AAE9C,MAAa,qBAAqB;IACxB,MAAM,CAAC,QAAQ,CAAwB;IACvC,SAAS,GAA4C,IAAI,GAAG,EAAE,CAAC;IAC/D,eAAe,GAA+B,IAAI,GAAG,EAAE,CAAC;IACxD,OAAO,GAAY,IAAI,CAAC;IACxB,gBAAgB,GAAuB,IAAI,GAAG,EAAE,CAAC;IAEzD,gBAAuB,CAAC;IAExB,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAE,CAAC;YACpC,qBAAqB,CAAC,QAAQ,GAAG,IAAI,qBAAqB,EAAE,CAAC;QAC/D,CAAC;QACD,OAAO,qBAAqB,CAAC,QAAQ,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,OAAgB;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,QAAQ,CACN,aAA4B,EAC5B,QAA6B,EAC7B,MAAe;QAEf,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAC5C,IAAI,MAAM;YAAE,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CA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AM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,qCAAwB,CAAC;gBACjC,EAAE,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,SAAS;gBACzC,KAAK,EAAE,UAAU;gBACjB,SAAS,EAAE,KAAK;gBAChB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,SAAS,EAAE,IAAI,IAAI,EAAE;aACtB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,OAA0B,EAAE,OAA0B;QACrE,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAlLD,sDAkLC;AAEY,QAAA,qBAAqB,GAAG,qBAAqB,CAAC,WAAW,EAAE,CAAC;AAElE,KAAK,UAAU,kBAAkB,CACtC,OAA0B,EAC1B,OAA0B,EAC1B,YAA6C;IAE7C,OAAO,6BAAqB,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AACzE,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,OAA0B,EAC1B,OAA0B;IAE1B,OAAO,6BAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/dashboard/data.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard 数据聚合
|
|
3
|
-
*
|
|
4
|
-
* 从各模块收集数据,生成 HarnessDashboardData
|
|
5
|
-
* 纯文件读取,零 token 开销
|
|
6
|
-
*/
|
|
7
|
-
import type { HarnessDashboardData, KnowledgeOverview, ConstraintHeatmap, KnowledgeFlow, FeedbackLoopStatus, ConstraintStats } from './types';
|
|
8
|
-
import type { KnowledgeEntry } from '../knowledge/types';
|
|
9
|
-
export declare class DashboardDataProvider {
|
|
10
|
-
/**
|
|
11
|
-
* 生成完整 Dashboard 数据
|
|
12
|
-
*/
|
|
13
|
-
generate(entries: KnowledgeEntry[], constraintStats?: ConstraintStats[], referenceCounts?: Map<string, number>): HarnessDashboardData;
|
|
14
|
-
/**
|
|
15
|
-
* 知识库全景
|
|
16
|
-
*/
|
|
17
|
-
getKnowledgeOverview(entries: KnowledgeEntry[]): KnowledgeOverview;
|
|
18
|
-
/**
|
|
19
|
-
* 约束执行热力图
|
|
20
|
-
*/
|
|
21
|
-
getConstraintHeatmap(stats: ConstraintStats[]): ConstraintHeatmap;
|
|
22
|
-
/**
|
|
23
|
-
* 知识流转路径
|
|
24
|
-
*/
|
|
25
|
-
getKnowledgeFlow(entries: KnowledgeEntry[], referenceCounts: Map<string, number>): KnowledgeFlow;
|
|
26
|
-
/**
|
|
27
|
-
* 反馈环状态(基础实现,需要外部数据源补充)
|
|
28
|
-
*/
|
|
29
|
-
getFeedbackLoop(): FeedbackLoopStatus;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/dashboard/data.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,eAAe,EAEhB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIzD,qBAAa,qBAAqB;IAChC;;OAEG;IACH,QAAQ,CACN,OAAO,EAAE,cAAc,EAAE,EACzB,eAAe,GAAE,eAAe,EAAO,EACvC,eAAe,GAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAa,GAC/C,oBAAoB;IAUvB;;OAEG;IACH,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,iBAAiB;IAIlE;;OAEG;IACH,oBAAoB,CAAC,KAAK,EAAE,eAAe,EAAE,GAAG,iBAAiB;IAiCjE;;OAEG;IACH,gBAAgB,CACd,OAAO,EAAE,cAAc,EAAE,EACzB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,aAAa;IAIhB;;OAEG;IACH,eAAe,IAAI,kBAAkB;CAQtC"}
|
package/dist/dashboard/data.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Dashboard 数据聚合
|
|
4
|
-
*
|
|
5
|
-
* 从各模块收集数据,生成 HarnessDashboardData
|
|
6
|
-
* 纯文件读取,零 token 开销
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.DashboardDataProvider = void 0;
|
|
10
|
-
const stats_1 = require("./stats");
|
|
11
|
-
const definitions_1 = require("../core/constraints/definitions");
|
|
12
|
-
class DashboardDataProvider {
|
|
13
|
-
/**
|
|
14
|
-
* 生成完整 Dashboard 数据
|
|
15
|
-
*/
|
|
16
|
-
generate(entries, constraintStats = [], referenceCounts = new Map()) {
|
|
17
|
-
return {
|
|
18
|
-
timestamp: new Date().toISOString(),
|
|
19
|
-
knowledgeOverview: this.getKnowledgeOverview(entries),
|
|
20
|
-
constraintHeatmap: this.getConstraintHeatmap(constraintStats),
|
|
21
|
-
knowledgeFlow: this.getKnowledgeFlow(entries, referenceCounts),
|
|
22
|
-
feedbackLoop: this.getFeedbackLoop(),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* 知识库全景
|
|
27
|
-
*/
|
|
28
|
-
getKnowledgeOverview(entries) {
|
|
29
|
-
return (0, stats_1.computeKnowledgeOverview)(entries);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* 约束执行热力图
|
|
33
|
-
*/
|
|
34
|
-
getConstraintHeatmap(stats) {
|
|
35
|
-
// P1:直接读 definitions;prompt 类不产生 trace 统计,热力图只含 check 层
|
|
36
|
-
const allConstraints = (0, definitions_1.getAllConstraints)().filter(c => c.kind === 'check');
|
|
37
|
-
const constraints = allConstraints.map(c => {
|
|
38
|
-
const stat = stats.find(s => s.constraintId === c.id);
|
|
39
|
-
const layer = c.level === 'iron_law' ? 'safety' : 'quality';
|
|
40
|
-
return {
|
|
41
|
-
id: c.id,
|
|
42
|
-
layer,
|
|
43
|
-
trigger: stat?.triggerCount ?? 0,
|
|
44
|
-
pass: stat?.passCount ?? 0,
|
|
45
|
-
intercept: stat?.interceptCount ?? 0,
|
|
46
|
-
interceptRate: stat ? (0, stats_1.computeInterceptRate)(stat.triggerCount, stat.interceptCount) : 0,
|
|
47
|
-
deprecationStatus: 'active',
|
|
48
|
-
permanent: false,
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
const neverTriggered = constraints.filter(c => c.trigger === 0).map(c => c.id);
|
|
52
|
-
const decliningInterceptRate = constraints
|
|
53
|
-
.filter(c => c.interceptRate > 0 && c.interceptRate < 15)
|
|
54
|
-
.map(c => ({ id: c.id, from: c.interceptRate, to: c.interceptRate }));
|
|
55
|
-
return {
|
|
56
|
-
period: '近 30 天',
|
|
57
|
-
constraints,
|
|
58
|
-
neverTriggered,
|
|
59
|
-
decliningInterceptRate,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* 知识流转路径
|
|
64
|
-
*/
|
|
65
|
-
getKnowledgeFlow(entries, referenceCounts) {
|
|
66
|
-
return (0, stats_1.computeKnowledgeFlow)(entries, referenceCounts);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 反馈环状态(基础实现,需要外部数据源补充)
|
|
70
|
-
*/
|
|
71
|
-
getFeedbackLoop() {
|
|
72
|
-
return {
|
|
73
|
-
local: { active: 0 },
|
|
74
|
-
push: { active: 0 },
|
|
75
|
-
external: { active: 0 },
|
|
76
|
-
feedbackToKnowledge: { total: 0, pending: 0 },
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.DashboardDataProvider = DashboardDataProvider;
|
|
81
|
-
//# sourceMappingURL=data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/dashboard/data.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAYH,mCAA+F;AAC/F,iEAAoE;AAEpE,MAAa,qBAAqB;IAChC;;OAEG;IACH,QAAQ,CACN,OAAyB,EACzB,kBAAqC,EAAE,EACvC,kBAAuC,IAAI,GAAG,EAAE;QAEhD,OAAO;YACL,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,iBAAiB,EAAE,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;YACrD,iBAAiB,EAAE,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;YAC7D,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC;YAC9D,YAAY,EAAE,IAAI,CAAC,eAAe,EAAE;SACrC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,OAAyB;QAC5C,OAAO,IAAA,gCAAwB,EAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,KAAwB;QAC3C,wDAAwD;QACxD,MAAM,cAAc,GAAG,IAAA,+BAAiB,GAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;QAE3E,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACzC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,E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,gBAAgB,CACd,OAAyB,EACzB,eAAoC;QAEpC,OAAO,IAAA,4BAAoB,EAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO;YACL,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;YACpB,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;YACnB,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE;YACvB,mBAAmB,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;SAC9C,CAAC;IACJ,CAAC;CACF;AAlFD,sDAkFC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
package/dist/dashboard/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./types"), exports);
|
|
18
|
-
__exportStar(require("./stats"), exports);
|
|
19
|
-
__exportStar(require("./data"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,yCAAuB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dashboard 统计计算
|
|
3
|
-
*
|
|
4
|
-
* 纯函数,从原始数据计算统计指标
|
|
5
|
-
*/
|
|
6
|
-
import type { KnowledgeEntry } from '../knowledge/types';
|
|
7
|
-
import type { KnowledgeOverview, KnowledgeFlow } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* 计算知识库概览
|
|
10
|
-
*/
|
|
11
|
-
export declare function computeKnowledgeOverview(entries: KnowledgeEntry[]): KnowledgeOverview;
|
|
12
|
-
/**
|
|
13
|
-
* 计算知识流转统计
|
|
14
|
-
*/
|
|
15
|
-
export declare function computeKnowledgeFlow(entries: KnowledgeEntry[], referenceCounts: Map<string, number>, topN?: number): KnowledgeFlow;
|
|
16
|
-
/**
|
|
17
|
-
* 计算约束拦截率
|
|
18
|
-
*/
|
|
19
|
-
export declare function computeInterceptRate(triggerCount: number, interceptCount: number): number;
|
|
20
|
-
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/dashboard/stats.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEhE;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAoBrF;AA+CD;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,EAAE,EACzB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,IAAI,GAAE,MAAU,GACf,aAAa,CAgCf;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAGzF"}
|