pm-orchestrator-runner 1.0.22 → 1.0.23
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/dist/review-loop/goal-drift-evaluator.d.ts +178 -0
- package/dist/review-loop/goal-drift-evaluator.d.ts.map +1 -0
- package/dist/review-loop/goal-drift-evaluator.js +487 -0
- package/dist/review-loop/goal-drift-evaluator.js.map +1 -0
- package/dist/review-loop/goal-drift-integration.d.ts +81 -0
- package/dist/review-loop/goal-drift-integration.d.ts.map +1 -0
- package/dist/review-loop/goal-drift-integration.js +183 -0
- package/dist/review-loop/goal-drift-integration.js.map +1 -0
- package/dist/review-loop/index.d.ts +4 -0
- package/dist/review-loop/index.d.ts.map +1 -1
- package/dist/review-loop/index.js +30 -1
- package/dist/review-loop/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal Drift Guard Evaluator
|
|
3
|
+
*
|
|
4
|
+
* Per spec 32_TEMPLATE_INJECTION.md Section 2.4 and enforcement requirements
|
|
5
|
+
*
|
|
6
|
+
* This evaluator runs ONLY when activeTemplateId === 'goal_drift_guard'
|
|
7
|
+
* and maps Goal Drift violations to existing Q1-Q6 style judgments.
|
|
8
|
+
*
|
|
9
|
+
* GD1: No Escape Phrases (maps to Q2-style)
|
|
10
|
+
* GD2: No Premature Completion (maps to Q5-style)
|
|
11
|
+
* GD3: Requirement Checklist Present (maps to Q5-style)
|
|
12
|
+
* GD4: Completion Statement Valid (maps to Q5-style)
|
|
13
|
+
* GD5: No Scope Reduction (maps to Q3-style)
|
|
14
|
+
*
|
|
15
|
+
* Design Principle:
|
|
16
|
+
* - Fail-Closed: Evaluator errors result in REJECT
|
|
17
|
+
* - Deterministic: No LLM calls, pattern-based detection
|
|
18
|
+
* - Zero overhead when template not selected
|
|
19
|
+
*/
|
|
20
|
+
import type { ExecutorResult } from '../executor/claude-code-executor';
|
|
21
|
+
/**
|
|
22
|
+
* Goal Drift Criteria IDs
|
|
23
|
+
*/
|
|
24
|
+
export type GoalDriftCriteriaId = 'GD1' | 'GD2' | 'GD3' | 'GD4' | 'GD5';
|
|
25
|
+
/**
|
|
26
|
+
* Escape phrase violation detail
|
|
27
|
+
*/
|
|
28
|
+
export interface EscapePhraseViolation {
|
|
29
|
+
phrase: string;
|
|
30
|
+
context: string;
|
|
31
|
+
lineNumber?: number;
|
|
32
|
+
line?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Premature completion violation detail
|
|
36
|
+
*/
|
|
37
|
+
export interface PrematureCompletionViolation {
|
|
38
|
+
pattern: string;
|
|
39
|
+
context: string;
|
|
40
|
+
lineNumber?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Scope reduction violation detail
|
|
44
|
+
*/
|
|
45
|
+
export interface ScopeReductionViolation {
|
|
46
|
+
pattern: string;
|
|
47
|
+
context: string;
|
|
48
|
+
lineNumber?: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Generic violation for backward compat with tests
|
|
52
|
+
*/
|
|
53
|
+
export interface GenericViolation {
|
|
54
|
+
phrase?: string;
|
|
55
|
+
pattern?: string;
|
|
56
|
+
context?: string;
|
|
57
|
+
lineNumber?: number;
|
|
58
|
+
line?: number;
|
|
59
|
+
criteria_id?: GoalDriftCriteriaId;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Individual criteria check result
|
|
63
|
+
*/
|
|
64
|
+
export interface GoalDriftCriteriaResult {
|
|
65
|
+
criteria_id: GoalDriftCriteriaId;
|
|
66
|
+
passed: boolean;
|
|
67
|
+
details?: string;
|
|
68
|
+
violations: GenericViolation[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Structured reason for machine-readable output
|
|
72
|
+
*/
|
|
73
|
+
export interface StructuredReason {
|
|
74
|
+
criteria_id: GoalDriftCriteriaId;
|
|
75
|
+
violation_type: 'escape_phrase' | 'premature_completion' | 'missing_checklist' | 'invalid_completion_statement' | 'scope_reduction';
|
|
76
|
+
description: string;
|
|
77
|
+
evidence: string[];
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Goal Drift Evaluator result
|
|
81
|
+
*/
|
|
82
|
+
export interface GoalDriftEvaluatorResult {
|
|
83
|
+
passed: boolean;
|
|
84
|
+
criteriaResults: GoalDriftCriteriaResult[];
|
|
85
|
+
criteria_results: GoalDriftCriteriaResult[];
|
|
86
|
+
failed_criteria: GoalDriftCriteriaId[];
|
|
87
|
+
structured_reasons: StructuredReason[];
|
|
88
|
+
violations: GenericViolation[];
|
|
89
|
+
summary: string;
|
|
90
|
+
error?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Goal Drift Guard template ID
|
|
94
|
+
*/
|
|
95
|
+
export declare const GOAL_DRIFT_GUARD_TEMPLATE_ID = "goal_drift_guard";
|
|
96
|
+
/**
|
|
97
|
+
* Escape phrases to detect (per spec 32_TEMPLATE_INJECTION.md Section 2.4)
|
|
98
|
+
* Case-insensitive matching
|
|
99
|
+
*/
|
|
100
|
+
export declare const ESCAPE_PHRASES: readonly string[];
|
|
101
|
+
/**
|
|
102
|
+
* Premature completion patterns (per spec 32_TEMPLATE_INJECTION.md Section 2.4)
|
|
103
|
+
* Case-insensitive matching
|
|
104
|
+
*/
|
|
105
|
+
export declare const PREMATURE_COMPLETION_PATTERNS: readonly string[];
|
|
106
|
+
/**
|
|
107
|
+
* Scope reduction patterns
|
|
108
|
+
* Case-insensitive matching
|
|
109
|
+
*/
|
|
110
|
+
export declare const SCOPE_REDUCTION_PATTERNS: readonly string[];
|
|
111
|
+
/**
|
|
112
|
+
* Valid completion statement patterns
|
|
113
|
+
* Must contain one of these to be valid
|
|
114
|
+
*/
|
|
115
|
+
export declare const VALID_COMPLETION_PATTERNS: readonly RegExp[];
|
|
116
|
+
/**
|
|
117
|
+
* Requirement checklist patterns
|
|
118
|
+
* Must contain checkbox-style items
|
|
119
|
+
*/
|
|
120
|
+
export declare const CHECKLIST_PATTERNS: readonly RegExp[];
|
|
121
|
+
/**
|
|
122
|
+
* GD1: Check for escape phrases in output
|
|
123
|
+
*
|
|
124
|
+
* @param output - Executor output to check
|
|
125
|
+
* @returns Criteria result with violations
|
|
126
|
+
*/
|
|
127
|
+
export declare function checkGD1NoEscapePhrases(output: string): GoalDriftCriteriaResult;
|
|
128
|
+
/**
|
|
129
|
+
* GD2: Check for premature completion language
|
|
130
|
+
*
|
|
131
|
+
* @param output - Executor output to check
|
|
132
|
+
* @returns Criteria result with violations
|
|
133
|
+
*/
|
|
134
|
+
export declare function checkGD2NoPrematureCompletion(output: string): GoalDriftCriteriaResult;
|
|
135
|
+
/**
|
|
136
|
+
* GD3: Check for requirement checklist presence
|
|
137
|
+
*
|
|
138
|
+
* @param output - Executor output to check
|
|
139
|
+
* @returns Criteria result
|
|
140
|
+
*/
|
|
141
|
+
export declare function checkGD3RequirementChecklistPresent(output: string): GoalDriftCriteriaResult;
|
|
142
|
+
/**
|
|
143
|
+
* GD4: Check for valid completion statement
|
|
144
|
+
*
|
|
145
|
+
* @param output - Executor output to check
|
|
146
|
+
* @returns Criteria result
|
|
147
|
+
*/
|
|
148
|
+
export declare function checkGD4CompletionStatementValid(output: string): GoalDriftCriteriaResult;
|
|
149
|
+
/**
|
|
150
|
+
* GD5: Check for scope reduction language
|
|
151
|
+
*
|
|
152
|
+
* @param output - Executor output to check
|
|
153
|
+
* @returns Criteria result with violations
|
|
154
|
+
*/
|
|
155
|
+
export declare function checkGD5NoScopeReduction(output: string): GoalDriftCriteriaResult;
|
|
156
|
+
/**
|
|
157
|
+
* Evaluate Goal Drift Guard criteria on output
|
|
158
|
+
*
|
|
159
|
+
* @param input - Output string or ExecutorResult to evaluate
|
|
160
|
+
* @returns Goal Drift evaluation result
|
|
161
|
+
*/
|
|
162
|
+
export declare function evaluateGoalDrift(input: string | ExecutorResult): GoalDriftEvaluatorResult;
|
|
163
|
+
/**
|
|
164
|
+
* Check if Goal Drift Guard evaluator should run
|
|
165
|
+
*
|
|
166
|
+
* @param activeTemplateId - Currently active template ID
|
|
167
|
+
* @returns true if evaluator should run
|
|
168
|
+
*/
|
|
169
|
+
export declare function shouldRunGoalDriftEvaluator(activeTemplateId: string | null | undefined): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Fail-closed wrapper for Goal Drift evaluation
|
|
172
|
+
*
|
|
173
|
+
* @param input - Executor result or output string to evaluate
|
|
174
|
+
* @returns Goal Drift evaluation result
|
|
175
|
+
* @throws Never - Returns REJECT-equivalent on error (fail-closed)
|
|
176
|
+
*/
|
|
177
|
+
export declare function safeEvaluateGoalDrift(input: ExecutorResult | string | null | undefined): GoalDriftEvaluatorResult;
|
|
178
|
+
//# sourceMappingURL=goal-drift-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-drift-evaluator.d.ts","sourceRoot":"","sources":["../../src/review-loop/goal-drift-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAMvE;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,M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EAAE,SAAS,MAAM,EAe1D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAcrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAKtD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,MAAM,EAK/C,CAAC;AAMF;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CA0C/E;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CA0CrF;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAsB3F;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CA8CxF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CA0ChF;AAMD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,wBAAwB,CAuF1F;AAMD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAEhG;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAChD,wBAAwB,CAyB1B"}
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Goal Drift Guard Evaluator
|
|
4
|
+
*
|
|
5
|
+
* Per spec 32_TEMPLATE_INJECTION.md Section 2.4 and enforcement requirements
|
|
6
|
+
*
|
|
7
|
+
* This evaluator runs ONLY when activeTemplateId === 'goal_drift_guard'
|
|
8
|
+
* and maps Goal Drift violations to existing Q1-Q6 style judgments.
|
|
9
|
+
*
|
|
10
|
+
* GD1: No Escape Phrases (maps to Q2-style)
|
|
11
|
+
* GD2: No Premature Completion (maps to Q5-style)
|
|
12
|
+
* GD3: Requirement Checklist Present (maps to Q5-style)
|
|
13
|
+
* GD4: Completion Statement Valid (maps to Q5-style)
|
|
14
|
+
* GD5: No Scope Reduction (maps to Q3-style)
|
|
15
|
+
*
|
|
16
|
+
* Design Principle:
|
|
17
|
+
* - Fail-Closed: Evaluator errors result in REJECT
|
|
18
|
+
* - Deterministic: No LLM calls, pattern-based detection
|
|
19
|
+
* - Zero overhead when template not selected
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.CHECKLIST_PATTERNS = exports.VALID_COMPLETION_PATTERNS = exports.SCOPE_REDUCTION_PATTERNS = exports.PREMATURE_COMPLETION_PATTERNS = exports.ESCAPE_PHRASES = exports.GOAL_DRIFT_GUARD_TEMPLATE_ID = void 0;
|
|
23
|
+
exports.checkGD1NoEscapePhrases = checkGD1NoEscapePhrases;
|
|
24
|
+
exports.checkGD2NoPrematureCompletion = checkGD2NoPrematureCompletion;
|
|
25
|
+
exports.checkGD3RequirementChecklistPresent = checkGD3RequirementChecklistPresent;
|
|
26
|
+
exports.checkGD4CompletionStatementValid = checkGD4CompletionStatementValid;
|
|
27
|
+
exports.checkGD5NoScopeReduction = checkGD5NoScopeReduction;
|
|
28
|
+
exports.evaluateGoalDrift = evaluateGoalDrift;
|
|
29
|
+
exports.shouldRunGoalDriftEvaluator = shouldRunGoalDriftEvaluator;
|
|
30
|
+
exports.safeEvaluateGoalDrift = safeEvaluateGoalDrift;
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// Constants
|
|
33
|
+
// ============================================================================
|
|
34
|
+
/**
|
|
35
|
+
* Goal Drift Guard template ID
|
|
36
|
+
*/
|
|
37
|
+
exports.GOAL_DRIFT_GUARD_TEMPLATE_ID = 'goal_drift_guard';
|
|
38
|
+
/**
|
|
39
|
+
* Escape phrases to detect (per spec 32_TEMPLATE_INJECTION.md Section 2.4)
|
|
40
|
+
* Case-insensitive matching
|
|
41
|
+
*/
|
|
42
|
+
exports.ESCAPE_PHRASES = [
|
|
43
|
+
'if needed',
|
|
44
|
+
'if required',
|
|
45
|
+
'optional',
|
|
46
|
+
'as needed',
|
|
47
|
+
'when necessary',
|
|
48
|
+
'could be added later',
|
|
49
|
+
'might need',
|
|
50
|
+
'consider adding',
|
|
51
|
+
'you may want to',
|
|
52
|
+
'left as an exercise',
|
|
53
|
+
'beyond the scope',
|
|
54
|
+
'out of scope',
|
|
55
|
+
'future enhancement',
|
|
56
|
+
'future work',
|
|
57
|
+
'not implemented yet',
|
|
58
|
+
'to be determined',
|
|
59
|
+
'tbd',
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* Premature completion patterns (per spec 32_TEMPLATE_INJECTION.md Section 2.4)
|
|
63
|
+
* Case-insensitive matching
|
|
64
|
+
*/
|
|
65
|
+
exports.PREMATURE_COMPLETION_PATTERNS = [
|
|
66
|
+
'basic implementation complete',
|
|
67
|
+
'basic implementation',
|
|
68
|
+
'skeleton',
|
|
69
|
+
'scaffold',
|
|
70
|
+
'starter',
|
|
71
|
+
'please verify',
|
|
72
|
+
'please check',
|
|
73
|
+
'you should verify',
|
|
74
|
+
'you should check',
|
|
75
|
+
'verify yourself',
|
|
76
|
+
'check yourself',
|
|
77
|
+
'left for you to',
|
|
78
|
+
'up to you to',
|
|
79
|
+
'i\'ll leave it to you',
|
|
80
|
+
];
|
|
81
|
+
/**
|
|
82
|
+
* Scope reduction patterns
|
|
83
|
+
* Case-insensitive matching
|
|
84
|
+
*/
|
|
85
|
+
exports.SCOPE_REDUCTION_PATTERNS = [
|
|
86
|
+
'simplified version',
|
|
87
|
+
'reduced scope',
|
|
88
|
+
'minimal implementation',
|
|
89
|
+
'basic version',
|
|
90
|
+
'for now',
|
|
91
|
+
'for the time being',
|
|
92
|
+
'temporarily',
|
|
93
|
+
'as a first step',
|
|
94
|
+
'initial version',
|
|
95
|
+
'partial implementation',
|
|
96
|
+
'subset of',
|
|
97
|
+
'instead of',
|
|
98
|
+
'rather than',
|
|
99
|
+
];
|
|
100
|
+
/**
|
|
101
|
+
* Valid completion statement patterns
|
|
102
|
+
* Must contain one of these to be valid
|
|
103
|
+
*/
|
|
104
|
+
exports.VALID_COMPLETION_PATTERNS = [
|
|
105
|
+
/COMPLETE:\s*All\s+\d+\s+requirements?\s+fulfilled/i,
|
|
106
|
+
/COMPLETE:\s*all\s+requirements?\s+met/i,
|
|
107
|
+
/INCOMPLETE:\s*Requirements?\s+[\w,\s]+\s+remain/i,
|
|
108
|
+
/INCOMPLETE:\s*\d+\s+requirements?\s+remain/i,
|
|
109
|
+
];
|
|
110
|
+
/**
|
|
111
|
+
* Requirement checklist patterns
|
|
112
|
+
* Must contain checkbox-style items
|
|
113
|
+
*/
|
|
114
|
+
exports.CHECKLIST_PATTERNS = [
|
|
115
|
+
/^[-*]\s*\[\s*[xX✓✔ ]\s*\]/m, // - [ ] or - [x] style
|
|
116
|
+
/^[-*]\s*Requirement\s+\d+:/mi, // - Requirement 1: style
|
|
117
|
+
/###\s*Requirement\s+Checklist/i, // Section header
|
|
118
|
+
/^\d+\.\s+.+:\s*(done|complete|implemented|finished)/mi, // 1. Feature: done style
|
|
119
|
+
];
|
|
120
|
+
// ============================================================================
|
|
121
|
+
// Checker Functions
|
|
122
|
+
// ============================================================================
|
|
123
|
+
/**
|
|
124
|
+
* GD1: Check for escape phrases in output
|
|
125
|
+
*
|
|
126
|
+
* @param output - Executor output to check
|
|
127
|
+
* @returns Criteria result with violations
|
|
128
|
+
*/
|
|
129
|
+
function checkGD1NoEscapePhrases(output) {
|
|
130
|
+
const violations = [];
|
|
131
|
+
const lines = output.split('\n');
|
|
132
|
+
for (let i = 0; i < lines.length; i++) {
|
|
133
|
+
const line = lines[i];
|
|
134
|
+
const lowerLine = line.toLowerCase();
|
|
135
|
+
for (const phrase of exports.ESCAPE_PHRASES) {
|
|
136
|
+
if (lowerLine.includes(phrase.toLowerCase())) {
|
|
137
|
+
// Get context (surrounding text)
|
|
138
|
+
const phraseIndex = lowerLine.indexOf(phrase.toLowerCase());
|
|
139
|
+
const contextStart = Math.max(0, phraseIndex - 20);
|
|
140
|
+
const contextEnd = Math.min(line.length, phraseIndex + phrase.length + 20);
|
|
141
|
+
const context = line.substring(contextStart, contextEnd);
|
|
142
|
+
violations.push({
|
|
143
|
+
phrase,
|
|
144
|
+
context: context.trim(),
|
|
145
|
+
lineNumber: i + 1,
|
|
146
|
+
line: i + 1,
|
|
147
|
+
criteria_id: 'GD1',
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (violations.length > 0) {
|
|
153
|
+
return {
|
|
154
|
+
criteria_id: 'GD1',
|
|
155
|
+
passed: false,
|
|
156
|
+
details: 'Found ' + violations.length + ' escape phrase(s): ' + violations.slice(0, 3).map(v => '"' + v.phrase + '"').join(', ') + (violations.length > 3 ? '...' : ''),
|
|
157
|
+
violations,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
criteria_id: 'GD1',
|
|
162
|
+
passed: true,
|
|
163
|
+
details: 'No escape phrases detected',
|
|
164
|
+
violations: [],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* GD2: Check for premature completion language
|
|
169
|
+
*
|
|
170
|
+
* @param output - Executor output to check
|
|
171
|
+
* @returns Criteria result with violations
|
|
172
|
+
*/
|
|
173
|
+
function checkGD2NoPrematureCompletion(output) {
|
|
174
|
+
const violations = [];
|
|
175
|
+
const lines = output.split('\n');
|
|
176
|
+
for (let i = 0; i < lines.length; i++) {
|
|
177
|
+
const line = lines[i];
|
|
178
|
+
const lowerLine = line.toLowerCase();
|
|
179
|
+
for (const pattern of exports.PREMATURE_COMPLETION_PATTERNS) {
|
|
180
|
+
if (lowerLine.includes(pattern.toLowerCase())) {
|
|
181
|
+
const patternIndex = lowerLine.indexOf(pattern.toLowerCase());
|
|
182
|
+
const contextStart = Math.max(0, patternIndex - 20);
|
|
183
|
+
const contextEnd = Math.min(line.length, patternIndex + pattern.length + 20);
|
|
184
|
+
const context = line.substring(contextStart, contextEnd);
|
|
185
|
+
violations.push({
|
|
186
|
+
phrase: pattern,
|
|
187
|
+
pattern,
|
|
188
|
+
context: context.trim(),
|
|
189
|
+
lineNumber: i + 1,
|
|
190
|
+
line: i + 1,
|
|
191
|
+
criteria_id: 'GD2',
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (violations.length > 0) {
|
|
197
|
+
return {
|
|
198
|
+
criteria_id: 'GD2',
|
|
199
|
+
passed: false,
|
|
200
|
+
details: 'Found ' + violations.length + ' premature completion pattern(s): ' + violations.slice(0, 3).map(v => '"' + v.pattern + '"').join(', ') + (violations.length > 3 ? '...' : ''),
|
|
201
|
+
violations,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
criteria_id: 'GD2',
|
|
206
|
+
passed: true,
|
|
207
|
+
details: 'No premature completion patterns detected',
|
|
208
|
+
violations: [],
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* GD3: Check for requirement checklist presence
|
|
213
|
+
*
|
|
214
|
+
* @param output - Executor output to check
|
|
215
|
+
* @returns Criteria result
|
|
216
|
+
*/
|
|
217
|
+
function checkGD3RequirementChecklistPresent(output) {
|
|
218
|
+
// Check for checklist patterns
|
|
219
|
+
for (const pattern of exports.CHECKLIST_PATTERNS) {
|
|
220
|
+
if (pattern.test(output)) {
|
|
221
|
+
return {
|
|
222
|
+
criteria_id: 'GD3',
|
|
223
|
+
passed: true,
|
|
224
|
+
details: 'Requirement checklist detected',
|
|
225
|
+
violations: [],
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
criteria_id: 'GD3',
|
|
231
|
+
passed: false,
|
|
232
|
+
details: 'No requirement checklist found - Goal Drift Guard requires explicit requirement tracking',
|
|
233
|
+
violations: [{
|
|
234
|
+
phrase: 'missing checklist',
|
|
235
|
+
criteria_id: 'GD3',
|
|
236
|
+
}],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* GD4: Check for valid completion statement
|
|
241
|
+
*
|
|
242
|
+
* @param output - Executor output to check
|
|
243
|
+
* @returns Criteria result
|
|
244
|
+
*/
|
|
245
|
+
function checkGD4CompletionStatementValid(output) {
|
|
246
|
+
// Check for valid completion statement
|
|
247
|
+
for (const pattern of exports.VALID_COMPLETION_PATTERNS) {
|
|
248
|
+
if (pattern.test(output)) {
|
|
249
|
+
const match = output.match(pattern);
|
|
250
|
+
return {
|
|
251
|
+
criteria_id: 'GD4',
|
|
252
|
+
passed: true,
|
|
253
|
+
details: 'Valid completion statement found: "' + (match?.[0] || '') + '"',
|
|
254
|
+
violations: [],
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Check for ambiguous completion language (should be flagged)
|
|
259
|
+
const ambiguousPatterns = [
|
|
260
|
+
/done\.?$/im,
|
|
261
|
+
/that's all/i,
|
|
262
|
+
/finished/i,
|
|
263
|
+
/completed\.?$/im,
|
|
264
|
+
/all set/i,
|
|
265
|
+
];
|
|
266
|
+
for (const pattern of ambiguousPatterns) {
|
|
267
|
+
if (pattern.test(output)) {
|
|
268
|
+
return {
|
|
269
|
+
criteria_id: 'GD4',
|
|
270
|
+
passed: false,
|
|
271
|
+
details: 'Ambiguous completion statement found - use "COMPLETE: All N requirements fulfilled" or "INCOMPLETE: Requirements X, Y, Z remain"',
|
|
272
|
+
violations: [{
|
|
273
|
+
phrase: 'invalid completion statement',
|
|
274
|
+
criteria_id: 'GD4',
|
|
275
|
+
}],
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
criteria_id: 'GD4',
|
|
281
|
+
passed: false,
|
|
282
|
+
details: 'No valid completion statement found - Goal Drift Guard requires explicit "COMPLETE" or "INCOMPLETE" statement',
|
|
283
|
+
violations: [{
|
|
284
|
+
phrase: 'missing completion statement',
|
|
285
|
+
criteria_id: 'GD4',
|
|
286
|
+
}],
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* GD5: Check for scope reduction language
|
|
291
|
+
*
|
|
292
|
+
* @param output - Executor output to check
|
|
293
|
+
* @returns Criteria result with violations
|
|
294
|
+
*/
|
|
295
|
+
function checkGD5NoScopeReduction(output) {
|
|
296
|
+
const violations = [];
|
|
297
|
+
const lines = output.split('\n');
|
|
298
|
+
for (let i = 0; i < lines.length; i++) {
|
|
299
|
+
const line = lines[i];
|
|
300
|
+
const lowerLine = line.toLowerCase();
|
|
301
|
+
for (const pattern of exports.SCOPE_REDUCTION_PATTERNS) {
|
|
302
|
+
if (lowerLine.includes(pattern.toLowerCase())) {
|
|
303
|
+
const patternIndex = lowerLine.indexOf(pattern.toLowerCase());
|
|
304
|
+
const contextStart = Math.max(0, patternIndex - 20);
|
|
305
|
+
const contextEnd = Math.min(line.length, patternIndex + pattern.length + 20);
|
|
306
|
+
const context = line.substring(contextStart, contextEnd);
|
|
307
|
+
violations.push({
|
|
308
|
+
phrase: pattern,
|
|
309
|
+
pattern,
|
|
310
|
+
context: context.trim(),
|
|
311
|
+
lineNumber: i + 1,
|
|
312
|
+
line: i + 1,
|
|
313
|
+
criteria_id: 'GD5',
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
if (violations.length > 0) {
|
|
319
|
+
return {
|
|
320
|
+
criteria_id: 'GD5',
|
|
321
|
+
passed: false,
|
|
322
|
+
details: 'Found ' + violations.length + ' scope reduction pattern(s): ' + violations.slice(0, 3).map(v => '"' + v.pattern + '"').join(', ') + (violations.length > 3 ? '...' : ''),
|
|
323
|
+
violations,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
criteria_id: 'GD5',
|
|
328
|
+
passed: true,
|
|
329
|
+
details: 'No scope reduction patterns detected',
|
|
330
|
+
violations: [],
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
// ============================================================================
|
|
334
|
+
// Main Evaluator
|
|
335
|
+
// ============================================================================
|
|
336
|
+
/**
|
|
337
|
+
* Evaluate Goal Drift Guard criteria on output
|
|
338
|
+
*
|
|
339
|
+
* @param input - Output string or ExecutorResult to evaluate
|
|
340
|
+
* @returns Goal Drift evaluation result
|
|
341
|
+
*/
|
|
342
|
+
function evaluateGoalDrift(input) {
|
|
343
|
+
const output = typeof input === 'string' ? input : input.output;
|
|
344
|
+
const criteriaResults = [];
|
|
345
|
+
const failed_criteria = [];
|
|
346
|
+
const structured_reasons = [];
|
|
347
|
+
const allViolations = [];
|
|
348
|
+
// Run all GD checks
|
|
349
|
+
const gd1 = checkGD1NoEscapePhrases(output);
|
|
350
|
+
criteriaResults.push(gd1);
|
|
351
|
+
allViolations.push(...gd1.violations);
|
|
352
|
+
if (!gd1.passed) {
|
|
353
|
+
failed_criteria.push('GD1');
|
|
354
|
+
structured_reasons.push({
|
|
355
|
+
criteria_id: 'GD1',
|
|
356
|
+
violation_type: 'escape_phrase',
|
|
357
|
+
description: gd1.details || 'Escape phrases detected',
|
|
358
|
+
evidence: gd1.violations.map(v => 'Line ' + v.lineNumber + ': "' + v.phrase + '" in "' + v.context + '"'),
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
const gd2 = checkGD2NoPrematureCompletion(output);
|
|
362
|
+
criteriaResults.push(gd2);
|
|
363
|
+
allViolations.push(...gd2.violations);
|
|
364
|
+
if (!gd2.passed) {
|
|
365
|
+
failed_criteria.push('GD2');
|
|
366
|
+
structured_reasons.push({
|
|
367
|
+
criteria_id: 'GD2',
|
|
368
|
+
violation_type: 'premature_completion',
|
|
369
|
+
description: gd2.details || 'Premature completion language detected',
|
|
370
|
+
evidence: gd2.violations.map(v => 'Line ' + v.lineNumber + ': "' + v.pattern + '" in "' + v.context + '"'),
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
const gd3 = checkGD3RequirementChecklistPresent(output);
|
|
374
|
+
criteriaResults.push(gd3);
|
|
375
|
+
allViolations.push(...gd3.violations);
|
|
376
|
+
if (!gd3.passed) {
|
|
377
|
+
failed_criteria.push('GD3');
|
|
378
|
+
structured_reasons.push({
|
|
379
|
+
criteria_id: 'GD3',
|
|
380
|
+
violation_type: 'missing_checklist',
|
|
381
|
+
description: gd3.details || 'Requirement checklist missing',
|
|
382
|
+
evidence: ['No checkbox-style requirement tracking found'],
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
const gd4 = checkGD4CompletionStatementValid(output);
|
|
386
|
+
criteriaResults.push(gd4);
|
|
387
|
+
allViolations.push(...gd4.violations);
|
|
388
|
+
if (!gd4.passed) {
|
|
389
|
+
failed_criteria.push('GD4');
|
|
390
|
+
structured_reasons.push({
|
|
391
|
+
criteria_id: 'GD4',
|
|
392
|
+
violation_type: 'invalid_completion_statement',
|
|
393
|
+
description: gd4.details || 'Invalid or missing completion statement',
|
|
394
|
+
evidence: ['Expected: "COMPLETE: All N requirements fulfilled" or "INCOMPLETE: Requirements X, Y, Z remain"'],
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
const gd5 = checkGD5NoScopeReduction(output);
|
|
398
|
+
criteriaResults.push(gd5);
|
|
399
|
+
allViolations.push(...gd5.violations);
|
|
400
|
+
if (!gd5.passed) {
|
|
401
|
+
failed_criteria.push('GD5');
|
|
402
|
+
structured_reasons.push({
|
|
403
|
+
criteria_id: 'GD5',
|
|
404
|
+
violation_type: 'scope_reduction',
|
|
405
|
+
description: gd5.details || 'Scope reduction language detected',
|
|
406
|
+
evidence: gd5.violations.map(v => 'Line ' + v.lineNumber + ': "' + v.pattern + '" in "' + v.context + '"'),
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
const passed = failed_criteria.length === 0;
|
|
410
|
+
const summary = passed
|
|
411
|
+
? 'All Goal Drift Guard criteria passed'
|
|
412
|
+
: 'Goal Drift Guard: ' + failed_criteria.length + ' criteria failed (' + failed_criteria.join(', ') + ')';
|
|
413
|
+
return {
|
|
414
|
+
passed,
|
|
415
|
+
criteriaResults,
|
|
416
|
+
criteria_results: criteriaResults,
|
|
417
|
+
failed_criteria,
|
|
418
|
+
structured_reasons,
|
|
419
|
+
violations: allViolations,
|
|
420
|
+
summary,
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
// ============================================================================
|
|
424
|
+
// Helper Functions
|
|
425
|
+
// ============================================================================
|
|
426
|
+
/**
|
|
427
|
+
* Check if Goal Drift Guard evaluator should run
|
|
428
|
+
*
|
|
429
|
+
* @param activeTemplateId - Currently active template ID
|
|
430
|
+
* @returns true if evaluator should run
|
|
431
|
+
*/
|
|
432
|
+
function shouldRunGoalDriftEvaluator(activeTemplateId) {
|
|
433
|
+
return activeTemplateId === exports.GOAL_DRIFT_GUARD_TEMPLATE_ID;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Fail-closed wrapper for Goal Drift evaluation
|
|
437
|
+
*
|
|
438
|
+
* @param input - Executor result or output string to evaluate
|
|
439
|
+
* @returns Goal Drift evaluation result
|
|
440
|
+
* @throws Never - Returns REJECT-equivalent on error (fail-closed)
|
|
441
|
+
*/
|
|
442
|
+
function safeEvaluateGoalDrift(input) {
|
|
443
|
+
try {
|
|
444
|
+
if (input === null || input === undefined) {
|
|
445
|
+
return createFailedResult('Input is null or undefined');
|
|
446
|
+
}
|
|
447
|
+
let output;
|
|
448
|
+
if (typeof input === 'string') {
|
|
449
|
+
output = input;
|
|
450
|
+
}
|
|
451
|
+
else if (typeof input === 'object' && 'output' in input) {
|
|
452
|
+
output = input.output;
|
|
453
|
+
if (output === null || output === undefined) {
|
|
454
|
+
return createFailedResult('ExecutorResult.output is null or undefined');
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
return createFailedResult('Invalid input type');
|
|
459
|
+
}
|
|
460
|
+
return evaluateGoalDrift(output);
|
|
461
|
+
}
|
|
462
|
+
catch (error) {
|
|
463
|
+
// Fail-closed: evaluator errors result in REJECT
|
|
464
|
+
return createFailedResult('Goal Drift Guard evaluator error (fail-closed): ' + (error instanceof Error ? error.message : 'Unknown error'));
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Create a failed result for fail-closed scenarios
|
|
469
|
+
*/
|
|
470
|
+
function createFailedResult(errorMessage) {
|
|
471
|
+
return {
|
|
472
|
+
passed: false,
|
|
473
|
+
criteriaResults: [],
|
|
474
|
+
criteria_results: [],
|
|
475
|
+
failed_criteria: ['GD1', 'GD2', 'GD3', 'GD4', 'GD5'],
|
|
476
|
+
structured_reasons: [{
|
|
477
|
+
criteria_id: 'GD1',
|
|
478
|
+
violation_type: 'escape_phrase',
|
|
479
|
+
description: errorMessage,
|
|
480
|
+
evidence: ['Evaluator failed - treating as REJECT per fail-closed principle'],
|
|
481
|
+
}],
|
|
482
|
+
violations: [],
|
|
483
|
+
summary: errorMessage,
|
|
484
|
+
error: errorMessage,
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
//# sourceMappingURL=goal-drift-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-drift-evaluator.js","sourceRoot":"","sources":["../../src/review-loop/goal-drift-evaluator.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAiMH,0DA0CC;AAQD,sEA0CC;AAQD,kFAsBC;AAQD,4EA8CC;AAQD,4DA0CC;AAYD,8CAuFC;AAYD,kEAEC;AASD,sDA2BC;AAjeD,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;GAEG;AACU,QAAA,4BAA4B,GAAG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,CAAC;QAClD,CAAC;QAED,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iDAAiD;QACjD,OAAO,kBAAkB,CACvB,kDAAkD,GAAG,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAChH,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,YAAoB;IAC9C,OAAO;QACL,MAAM,EAAE,KAAK;QACb,eAAe,EAAE,EAAE;QACnB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;QACpD,kBAAkB,EAAE,CAAC;gBACnB,WAAW,EAAE,KAAK;gBAClB,cAAc,EAAE,eAAe;gBAC/B,WAAW,EAAE,YAAY;gBACzB,QAAQ,EAAE,CAAC,iEAAiE,CAAC;aAC9E,CAAC;QACF,UAAU,EAAE,EAAE;QACd,OAAO,EAAE,YAAY;QACrB,KAAK,EAAE,YAAY;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Goal Drift Guard Integration with Review Loop
|
|
3
|
+
*
|
|
4
|
+
* Per spec 32_TEMPLATE_INJECTION.md Section 2.4
|
|
5
|
+
*
|
|
6
|
+
* This module provides integration between the Goal Drift Guard evaluator
|
|
7
|
+
* and the existing Review Loop quality judgment system.
|
|
8
|
+
*
|
|
9
|
+
* Key principle: Only run Goal Drift Guard when activeTemplateId === 'goal_drift_guard'
|
|
10
|
+
* Zero overhead when template not selected.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExecutorResult } from '../executor/claude-code-executor';
|
|
13
|
+
import type { CriteriaResult, IssueDetail, QualityCriteriaId } from './review-loop';
|
|
14
|
+
import { type GoalDriftEvaluatorResult, type GoalDriftCriteriaId } from './goal-drift-evaluator';
|
|
15
|
+
/**
|
|
16
|
+
* Extended issue types for Goal Drift Guard
|
|
17
|
+
*/
|
|
18
|
+
export type ExtendedIssueType = IssueDetail['type'] | 'escape_phrase' | 'premature_completion' | 'missing_checklist' | 'invalid_completion_statement' | 'scope_reduction';
|
|
19
|
+
/**
|
|
20
|
+
* Extended issue detail including Goal Drift Guard violations
|
|
21
|
+
*/
|
|
22
|
+
export interface ExtendedIssueDetail {
|
|
23
|
+
type: ExtendedIssueType;
|
|
24
|
+
location?: string;
|
|
25
|
+
description: string;
|
|
26
|
+
suggestion?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Goal Drift Guard integration result
|
|
30
|
+
*/
|
|
31
|
+
export interface GoalDriftIntegrationResult {
|
|
32
|
+
/** Whether Goal Drift Guard was run */
|
|
33
|
+
ran: boolean;
|
|
34
|
+
/** Whether Goal Drift Guard passed (true if not run) */
|
|
35
|
+
passed: boolean;
|
|
36
|
+
/** Goal Drift Guard specific results (null if not run) */
|
|
37
|
+
goalDriftResult: GoalDriftEvaluatorResult | null;
|
|
38
|
+
/** Criteria results mapped to Q-style format */
|
|
39
|
+
mappedCriteriaResults: CriteriaResult[];
|
|
40
|
+
/** Issues mapped to extended format */
|
|
41
|
+
mappedIssues: ExtendedIssueDetail[];
|
|
42
|
+
/** Human-readable summary */
|
|
43
|
+
summary: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Map Goal Drift criteria ID to Q-style criteria ID
|
|
47
|
+
*
|
|
48
|
+
* GD1 (escape phrases) -> Q2 (No TODO/FIXME style - problematic language)
|
|
49
|
+
* GD2 (premature completion) -> Q5 (Evidence Present style - incomplete work)
|
|
50
|
+
* GD3 (missing checklist) -> Q5 (Evidence Present style - no verification)
|
|
51
|
+
* GD4 (invalid completion) -> Q5 (Evidence Present style - false claims)
|
|
52
|
+
* GD5 (scope reduction) -> Q3 (Omission Markers style - hidden reduction)
|
|
53
|
+
*/
|
|
54
|
+
export declare function mapGoalDriftToQCriteria(gdId: GoalDriftCriteriaId): QualityCriteriaId;
|
|
55
|
+
/**
|
|
56
|
+
* Get human-readable name for Goal Drift criteria
|
|
57
|
+
*/
|
|
58
|
+
export declare function getGoalDriftCriteriaName(gdId: GoalDriftCriteriaId): string;
|
|
59
|
+
/**
|
|
60
|
+
* Map Goal Drift evaluator result to Review Loop compatible format
|
|
61
|
+
*/
|
|
62
|
+
export declare function mapGoalDriftResultToReviewLoop(gdResult: GoalDriftEvaluatorResult): {
|
|
63
|
+
criteria: CriteriaResult[];
|
|
64
|
+
issues: ExtendedIssueDetail[];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Run Goal Drift Guard integration if applicable
|
|
68
|
+
*
|
|
69
|
+
* @param result - Executor result to evaluate
|
|
70
|
+
* @param activeTemplateId - Currently active template ID
|
|
71
|
+
* @returns Integration result with mapped criteria and issues
|
|
72
|
+
*/
|
|
73
|
+
export declare function runGoalDriftIntegration(result: ExecutorResult, activeTemplateId: string | null | undefined): GoalDriftIntegrationResult;
|
|
74
|
+
/**
|
|
75
|
+
* Generate modification prompt section for Goal Drift Guard failures
|
|
76
|
+
*
|
|
77
|
+
* @param gdResult - Goal Drift Guard evaluation result
|
|
78
|
+
* @returns Modification prompt section
|
|
79
|
+
*/
|
|
80
|
+
export declare function generateGoalDriftModificationSection(gdResult: GoalDriftEvaluatorResult): string;
|
|
81
|
+
//# sourceMappingURL=goal-drift-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-drift-integration.d.ts","sourceRoot":"","sources":["../../src/review-loop/goal-drift-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAGL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B,oCAAoC,CAClD,QAAQ,EAAE,wBAAwB,GACjC,MAAM,CAoCR"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Goal Drift Guard Integration with Review Loop
|
|
4
|
+
*
|
|
5
|
+
* Per spec 32_TEMPLATE_INJECTION.md Section 2.4
|
|
6
|
+
*
|
|
7
|
+
* This module provides integration between the Goal Drift Guard evaluator
|
|
8
|
+
* and the existing Review Loop quality judgment system.
|
|
9
|
+
*
|
|
10
|
+
* Key principle: Only run Goal Drift Guard when activeTemplateId === 'goal_drift_guard'
|
|
11
|
+
* Zero overhead when template not selected.
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.mapGoalDriftToQCriteria = mapGoalDriftToQCriteria;
|
|
15
|
+
exports.getGoalDriftCriteriaName = getGoalDriftCriteriaName;
|
|
16
|
+
exports.mapGoalDriftResultToReviewLoop = mapGoalDriftResultToReviewLoop;
|
|
17
|
+
exports.runGoalDriftIntegration = runGoalDriftIntegration;
|
|
18
|
+
exports.generateGoalDriftModificationSection = generateGoalDriftModificationSection;
|
|
19
|
+
const goal_drift_evaluator_1 = require("./goal-drift-evaluator");
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Mapping Functions
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Map Goal Drift criteria ID to Q-style criteria ID
|
|
25
|
+
*
|
|
26
|
+
* GD1 (escape phrases) -> Q2 (No TODO/FIXME style - problematic language)
|
|
27
|
+
* GD2 (premature completion) -> Q5 (Evidence Present style - incomplete work)
|
|
28
|
+
* GD3 (missing checklist) -> Q5 (Evidence Present style - no verification)
|
|
29
|
+
* GD4 (invalid completion) -> Q5 (Evidence Present style - false claims)
|
|
30
|
+
* GD5 (scope reduction) -> Q3 (Omission Markers style - hidden reduction)
|
|
31
|
+
*/
|
|
32
|
+
function mapGoalDriftToQCriteria(gdId) {
|
|
33
|
+
switch (gdId) {
|
|
34
|
+
case 'GD1': return 'Q2'; // Escape phrases -> problematic language
|
|
35
|
+
case 'GD2': return 'Q5'; // Premature completion -> incomplete work
|
|
36
|
+
case 'GD3': return 'Q5'; // Missing checklist -> no verification
|
|
37
|
+
case 'GD4': return 'Q5'; // Invalid completion -> false claims
|
|
38
|
+
case 'GD5': return 'Q3'; // Scope reduction -> hidden omission
|
|
39
|
+
default: return 'Q5'; // Default to evidence check
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get human-readable name for Goal Drift criteria
|
|
44
|
+
*/
|
|
45
|
+
function getGoalDriftCriteriaName(gdId) {
|
|
46
|
+
switch (gdId) {
|
|
47
|
+
case 'GD1': return 'No Escape Phrases';
|
|
48
|
+
case 'GD2': return 'No Premature Completion';
|
|
49
|
+
case 'GD3': return 'Requirement Checklist Present';
|
|
50
|
+
case 'GD4': return 'Valid Completion Statement';
|
|
51
|
+
case 'GD5': return 'No Scope Reduction';
|
|
52
|
+
default: return 'Goal Drift ' + gdId;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Map Goal Drift evaluator result to Review Loop compatible format
|
|
57
|
+
*/
|
|
58
|
+
function mapGoalDriftResultToReviewLoop(gdResult) {
|
|
59
|
+
const criteria = [];
|
|
60
|
+
const issues = [];
|
|
61
|
+
for (const cr of gdResult.criteria_results) {
|
|
62
|
+
// Map to Q-style criteria
|
|
63
|
+
criteria.push({
|
|
64
|
+
criteria_id: mapGoalDriftToQCriteria(cr.criteria_id),
|
|
65
|
+
passed: cr.passed,
|
|
66
|
+
details: '[' + cr.criteria_id + '] ' + (cr.details || ''),
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// Map structured reasons to issues
|
|
70
|
+
for (const reason of gdResult.structured_reasons) {
|
|
71
|
+
issues.push({
|
|
72
|
+
type: reason.violation_type,
|
|
73
|
+
description: reason.description,
|
|
74
|
+
suggestion: getSuggestionForViolation(reason.violation_type),
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return { criteria, issues };
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get suggestion for fixing a Goal Drift violation
|
|
81
|
+
*/
|
|
82
|
+
function getSuggestionForViolation(violationType) {
|
|
83
|
+
switch (violationType) {
|
|
84
|
+
case 'escape_phrase':
|
|
85
|
+
return 'Remove escape phrases like "if needed", "optional", "consider adding". Be definitive about what was done.';
|
|
86
|
+
case 'premature_completion':
|
|
87
|
+
return 'Do not claim "basic implementation" or ask user to verify. Complete all requirements yourself.';
|
|
88
|
+
case 'missing_checklist':
|
|
89
|
+
return 'Add a requirement checklist with checkbox items: "- [ ] Requirement 1: [status]"';
|
|
90
|
+
case 'invalid_completion_statement':
|
|
91
|
+
return 'Use "COMPLETE: All N requirements fulfilled" or "INCOMPLETE: Requirements X, Y, Z remain"';
|
|
92
|
+
case 'scope_reduction':
|
|
93
|
+
return 'Do not reduce scope with phrases like "simplified version" or "for now". Complete the full requirement.';
|
|
94
|
+
default:
|
|
95
|
+
return 'Review Goal Drift Guard rules and ensure all requirements are fully addressed.';
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// ============================================================================
|
|
99
|
+
// Main Integration Function
|
|
100
|
+
// ============================================================================
|
|
101
|
+
/**
|
|
102
|
+
* Run Goal Drift Guard integration if applicable
|
|
103
|
+
*
|
|
104
|
+
* @param result - Executor result to evaluate
|
|
105
|
+
* @param activeTemplateId - Currently active template ID
|
|
106
|
+
* @returns Integration result with mapped criteria and issues
|
|
107
|
+
*/
|
|
108
|
+
function runGoalDriftIntegration(result, activeTemplateId) {
|
|
109
|
+
// Check if Goal Drift Guard should run
|
|
110
|
+
if (activeTemplateId !== goal_drift_evaluator_1.GOAL_DRIFT_GUARD_TEMPLATE_ID) {
|
|
111
|
+
return {
|
|
112
|
+
ran: false,
|
|
113
|
+
passed: true,
|
|
114
|
+
goalDriftResult: null,
|
|
115
|
+
mappedCriteriaResults: [],
|
|
116
|
+
mappedIssues: [],
|
|
117
|
+
summary: 'Goal Drift Guard not active',
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// Run Goal Drift Guard evaluation
|
|
121
|
+
const gdResult = (0, goal_drift_evaluator_1.safeEvaluateGoalDrift)(result);
|
|
122
|
+
if (!gdResult) {
|
|
123
|
+
// This should not happen since we checked activeTemplateId above
|
|
124
|
+
return {
|
|
125
|
+
ran: false,
|
|
126
|
+
passed: true,
|
|
127
|
+
goalDriftResult: null,
|
|
128
|
+
mappedCriteriaResults: [],
|
|
129
|
+
mappedIssues: [],
|
|
130
|
+
summary: 'Goal Drift Guard not applicable',
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
// Map results to Review Loop format
|
|
134
|
+
const { criteria, issues } = mapGoalDriftResultToReviewLoop(gdResult);
|
|
135
|
+
return {
|
|
136
|
+
ran: true,
|
|
137
|
+
passed: gdResult.passed,
|
|
138
|
+
goalDriftResult: gdResult,
|
|
139
|
+
mappedCriteriaResults: criteria,
|
|
140
|
+
mappedIssues: issues,
|
|
141
|
+
summary: gdResult.summary,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Generate modification prompt section for Goal Drift Guard failures
|
|
146
|
+
*
|
|
147
|
+
* @param gdResult - Goal Drift Guard evaluation result
|
|
148
|
+
* @returns Modification prompt section
|
|
149
|
+
*/
|
|
150
|
+
function generateGoalDriftModificationSection(gdResult) {
|
|
151
|
+
if (gdResult.passed) {
|
|
152
|
+
return '';
|
|
153
|
+
}
|
|
154
|
+
let section = '\n### Goal Drift Guard Violations\n\n';
|
|
155
|
+
section += 'The following Goal Drift Guard criteria failed:\n\n';
|
|
156
|
+
for (const reason of gdResult.structured_reasons) {
|
|
157
|
+
section += '**' + reason.criteria_id + ' - ' + getGoalDriftCriteriaName(reason.criteria_id) + '**\n';
|
|
158
|
+
section += '- ' + reason.description + '\n';
|
|
159
|
+
if (reason.evidence.length > 0) {
|
|
160
|
+
section += '- Evidence:\n';
|
|
161
|
+
for (const e of reason.evidence.slice(0, 3)) {
|
|
162
|
+
section += ' - ' + e + '\n';
|
|
163
|
+
}
|
|
164
|
+
if (reason.evidence.length > 3) {
|
|
165
|
+
section += ' - ... and ' + (reason.evidence.length - 3) + ' more\n';
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
section += '- Fix: ' + getSuggestionForViolation(reason.violation_type) + '\n\n';
|
|
169
|
+
}
|
|
170
|
+
section += '\n**Required Output Format (Goal Drift Guard):**\n';
|
|
171
|
+
section += '```\n';
|
|
172
|
+
section += '### Requirement Checklist\n';
|
|
173
|
+
section += '- [ ] Requirement 1: [status]\n';
|
|
174
|
+
section += '- [ ] Requirement 2: [status]\n';
|
|
175
|
+
section += '\n';
|
|
176
|
+
section += '### Completion Statement\n';
|
|
177
|
+
section += 'COMPLETE: All N requirements fulfilled\n';
|
|
178
|
+
section += 'OR\n';
|
|
179
|
+
section += 'INCOMPLETE: Requirements X, Y, Z remain\n';
|
|
180
|
+
section += '```\n';
|
|
181
|
+
return section;
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=goal-drift-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"goal-drift-integration.js","sourceRoot":"","sources":["../../src/review-loop/goal-drift-integration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAwEH,0DASC;AAKD,4DASC;AAKD,wEAyBC;AAiCD,0DA0CC;AAQD,oFAsCC;AAlPD,iEAKgC;AAkDhC,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CAAC,IAAyB;IAC/D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAE,yCAAyC;QACnE,KAAK,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAE,0CAA0C;QACpE,KAAK,K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AS,CAAC;YACvE,CAAC;QACH,CAAC;QACD,OAAO,IAAI,SAAS,GAAG,yBAAyB,CAAC,MAAM,CAAC,cAA6C,CAAC,GAAG,MAAM,CAAC;IAClH,CAAC;IAED,OAAO,IAAI,oDAAoD,CAAC;IAChE,OAAO,IAAI,OAAO,CAAC;IACnB,OAAO,IAAI,6BAA6B,CAAC;IACzC,OAAO,IAAI,iCAAiC,CAAC;IAC7C,OAAO,IAAI,iCAAiC,CAAC;IAC7C,OAAO,IAAI,IAAI,CAAC;IAChB,OAAO,IAAI,4BAA4B,CAAC;IACxC,OAAO,IAAI,0CAA0C,CAAC;IACtD,OAAO,IAAI,MAAM,CAAC;IAClB,OAAO,IAAI,2CAA2C,CAAC;IACvD,OAAO,IAAI,OAAO,CAAC;IAEnB,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
* Exports:
|
|
7
7
|
* - ReviewLoopExecutorWrapper: Main class for wrapping IExecutor
|
|
8
8
|
* - Quality criteria checkers (Q1-Q6)
|
|
9
|
+
* - Goal Drift Guard evaluator (GD1-GD5)
|
|
10
|
+
* - Goal Drift Guard integration with Review Loop
|
|
9
11
|
* - Types and interfaces
|
|
10
12
|
* - Default configuration
|
|
11
13
|
*/
|
|
12
14
|
export { ReviewLoopExecutorWrapper, checkQ1FilesVerified, checkQ2NoTodoLeft, checkQ3NoOmissionMarkers, checkQ4NoIncompleteSyntax, checkQ5EvidencePresent, checkQ6NoEarlyTermination, performQualityJudgment, generateModificationPrompt, generateIssuesFromCriteria, DEFAULT_REVIEW_LOOP_CONFIG, type QualityCriteriaId, type ReviewLoopConfig, type JudgmentResult, type CriteriaResult, type IssueDetail, type RejectionDetails, type IterationRecord, type ReviewLoopResult, type ReviewLoopEventCallback, } from './review-loop';
|
|
15
|
+
export { checkGD1NoEscapePhrases, checkGD2NoPrematureCompletion, checkGD3RequirementChecklistPresent, checkGD4CompletionStatementValid, checkGD5NoScopeReduction, evaluateGoalDrift, shouldRunGoalDriftEvaluator, safeEvaluateGoalDrift, GOAL_DRIFT_GUARD_TEMPLATE_ID, ESCAPE_PHRASES, PREMATURE_COMPLETION_PATTERNS, SCOPE_REDUCTION_PATTERNS, VALID_COMPLETION_PATTERNS, CHECKLIST_PATTERNS, type GoalDriftCriteriaId, type EscapePhraseViolation, type PrematureCompletionViolation, type ScopeReductionViolation, type GoalDriftCriteriaResult, type StructuredReason, type GoalDriftEvaluatorResult, } from './goal-drift-evaluator';
|
|
16
|
+
export { runGoalDriftIntegration, generateGoalDriftModificationSection, mapGoalDriftToQCriteria, mapGoalDriftResultToReviewLoop, getGoalDriftCriteriaName, type ExtendedIssueType, type ExtendedIssueDetail, type GoalDriftIntegrationResult, } from './goal-drift-integration';
|
|
13
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/review-loop/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/review-loop/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAEL,yBAAyB,EAGzB,oBAAoB,EACpB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EAGzB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,EAG1B,0BAA0B,EAG1B,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC;AAGvB,OAAO,EAEL,uBAAuB,EACvB,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,EAChC,wBAAwB,EAGxB,iBAAiB,EACjB,2BAA2B,EAC3B,qBAAqB,EAGrB,4BAA4B,EAC5B,cAAc,EACd,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,EACzB,kBAAkB,EAGlB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAEL,uBAAuB,EACvB,oCAAoC,EACpC,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EAGxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,0BAA0B,GAChC,MAAM,0BAA0B,CAAC"}
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
* Exports:
|
|
8
8
|
* - ReviewLoopExecutorWrapper: Main class for wrapping IExecutor
|
|
9
9
|
* - Quality criteria checkers (Q1-Q6)
|
|
10
|
+
* - Goal Drift Guard evaluator (GD1-GD5)
|
|
11
|
+
* - Goal Drift Guard integration with Review Loop
|
|
10
12
|
* - Types and interfaces
|
|
11
13
|
* - Default configuration
|
|
12
14
|
*/
|
|
13
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.DEFAULT_REVIEW_LOOP_CONFIG = exports.generateIssuesFromCriteria = exports.generateModificationPrompt = exports.performQualityJudgment = exports.checkQ6NoEarlyTermination = exports.checkQ5EvidencePresent = exports.checkQ4NoIncompleteSyntax = exports.checkQ3NoOmissionMarkers = exports.checkQ2NoTodoLeft = exports.checkQ1FilesVerified = exports.ReviewLoopExecutorWrapper = void 0;
|
|
16
|
+
exports.getGoalDriftCriteriaName = exports.mapGoalDriftResultToReviewLoop = exports.mapGoalDriftToQCriteria = exports.generateGoalDriftModificationSection = exports.runGoalDriftIntegration = exports.CHECKLIST_PATTERNS = exports.VALID_COMPLETION_PATTERNS = exports.SCOPE_REDUCTION_PATTERNS = exports.PREMATURE_COMPLETION_PATTERNS = exports.ESCAPE_PHRASES = exports.GOAL_DRIFT_GUARD_TEMPLATE_ID = exports.safeEvaluateGoalDrift = exports.shouldRunGoalDriftEvaluator = exports.evaluateGoalDrift = exports.checkGD5NoScopeReduction = exports.checkGD4CompletionStatementValid = exports.checkGD3RequirementChecklistPresent = exports.checkGD2NoPrematureCompletion = exports.checkGD1NoEscapePhrases = exports.DEFAULT_REVIEW_LOOP_CONFIG = exports.generateIssuesFromCriteria = exports.generateModificationPrompt = exports.performQualityJudgment = exports.checkQ6NoEarlyTermination = exports.checkQ5EvidencePresent = exports.checkQ4NoIncompleteSyntax = exports.checkQ3NoOmissionMarkers = exports.checkQ2NoTodoLeft = exports.checkQ1FilesVerified = exports.ReviewLoopExecutorWrapper = void 0;
|
|
15
17
|
var review_loop_1 = require("./review-loop");
|
|
16
18
|
// Main class
|
|
17
19
|
Object.defineProperty(exports, "ReviewLoopExecutorWrapper", { enumerable: true, get: function () { return review_loop_1.ReviewLoopExecutorWrapper; } });
|
|
@@ -28,4 +30,31 @@ Object.defineProperty(exports, "generateModificationPrompt", { enumerable: true,
|
|
|
28
30
|
Object.defineProperty(exports, "generateIssuesFromCriteria", { enumerable: true, get: function () { return review_loop_1.generateIssuesFromCriteria; } });
|
|
29
31
|
// Configuration
|
|
30
32
|
Object.defineProperty(exports, "DEFAULT_REVIEW_LOOP_CONFIG", { enumerable: true, get: function () { return review_loop_1.DEFAULT_REVIEW_LOOP_CONFIG; } });
|
|
33
|
+
// Goal Drift Guard Evaluator (per spec 32_TEMPLATE_INJECTION.md)
|
|
34
|
+
var goal_drift_evaluator_1 = require("./goal-drift-evaluator");
|
|
35
|
+
// Checker functions
|
|
36
|
+
Object.defineProperty(exports, "checkGD1NoEscapePhrases", { enumerable: true, get: function () { return goal_drift_evaluator_1.checkGD1NoEscapePhrases; } });
|
|
37
|
+
Object.defineProperty(exports, "checkGD2NoPrematureCompletion", { enumerable: true, get: function () { return goal_drift_evaluator_1.checkGD2NoPrematureCompletion; } });
|
|
38
|
+
Object.defineProperty(exports, "checkGD3RequirementChecklistPresent", { enumerable: true, get: function () { return goal_drift_evaluator_1.checkGD3RequirementChecklistPresent; } });
|
|
39
|
+
Object.defineProperty(exports, "checkGD4CompletionStatementValid", { enumerable: true, get: function () { return goal_drift_evaluator_1.checkGD4CompletionStatementValid; } });
|
|
40
|
+
Object.defineProperty(exports, "checkGD5NoScopeReduction", { enumerable: true, get: function () { return goal_drift_evaluator_1.checkGD5NoScopeReduction; } });
|
|
41
|
+
// Main evaluator
|
|
42
|
+
Object.defineProperty(exports, "evaluateGoalDrift", { enumerable: true, get: function () { return goal_drift_evaluator_1.evaluateGoalDrift; } });
|
|
43
|
+
Object.defineProperty(exports, "shouldRunGoalDriftEvaluator", { enumerable: true, get: function () { return goal_drift_evaluator_1.shouldRunGoalDriftEvaluator; } });
|
|
44
|
+
Object.defineProperty(exports, "safeEvaluateGoalDrift", { enumerable: true, get: function () { return goal_drift_evaluator_1.safeEvaluateGoalDrift; } });
|
|
45
|
+
// Constants
|
|
46
|
+
Object.defineProperty(exports, "GOAL_DRIFT_GUARD_TEMPLATE_ID", { enumerable: true, get: function () { return goal_drift_evaluator_1.GOAL_DRIFT_GUARD_TEMPLATE_ID; } });
|
|
47
|
+
Object.defineProperty(exports, "ESCAPE_PHRASES", { enumerable: true, get: function () { return goal_drift_evaluator_1.ESCAPE_PHRASES; } });
|
|
48
|
+
Object.defineProperty(exports, "PREMATURE_COMPLETION_PATTERNS", { enumerable: true, get: function () { return goal_drift_evaluator_1.PREMATURE_COMPLETION_PATTERNS; } });
|
|
49
|
+
Object.defineProperty(exports, "SCOPE_REDUCTION_PATTERNS", { enumerable: true, get: function () { return goal_drift_evaluator_1.SCOPE_REDUCTION_PATTERNS; } });
|
|
50
|
+
Object.defineProperty(exports, "VALID_COMPLETION_PATTERNS", { enumerable: true, get: function () { return goal_drift_evaluator_1.VALID_COMPLETION_PATTERNS; } });
|
|
51
|
+
Object.defineProperty(exports, "CHECKLIST_PATTERNS", { enumerable: true, get: function () { return goal_drift_evaluator_1.CHECKLIST_PATTERNS; } });
|
|
52
|
+
// Goal Drift Guard Integration (connects evaluator to Review Loop)
|
|
53
|
+
var goal_drift_integration_1 = require("./goal-drift-integration");
|
|
54
|
+
// Integration functions
|
|
55
|
+
Object.defineProperty(exports, "runGoalDriftIntegration", { enumerable: true, get: function () { return goal_drift_integration_1.runGoalDriftIntegration; } });
|
|
56
|
+
Object.defineProperty(exports, "generateGoalDriftModificationSection", { enumerable: true, get: function () { return goal_drift_integration_1.generateGoalDriftModificationSection; } });
|
|
57
|
+
Object.defineProperty(exports, "mapGoalDriftToQCriteria", { enumerable: true, get: function () { return goal_drift_integration_1.mapGoalDriftToQCriteria; } });
|
|
58
|
+
Object.defineProperty(exports, "mapGoalDriftResultToReviewLoop", { enumerable: true, get: function () { return goal_drift_integration_1.mapGoalDriftResultToReviewLoop; } });
|
|
59
|
+
Object.defineProperty(exports, "getGoalDriftCriteriaName", { enumerable: true, get: function () { return goal_drift_integration_1.getGoalDriftCriteriaName; } });
|
|
31
60
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/review-loop/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/review-loop/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,6CA8BuB;AA7BrB,aAAa;AACb,wHAAA,yBAAyB,OAAA;AAEzB,4BAA4B;AAC5B,mHAAA,oBAAoB,OAAA;AACpB,gHAAA,iBAAiB,OAAA;AACjB,uHAAA,wBAAwB,OAAA;AACxB,wHAAA,yBAAyB,OAAA;AACzB,qHAAA,sBAAsB,OAAA;AACtB,wHAAA,yBAAyB,OAAA;AAEzB,iBAAiB;AACjB,qHAAA,sBAAsB,OAAA;AACtB,yHAAA,0BAA0B,OAAA;AAC1B,yHAAA,0BAA0B,OAAA;AAE1B,gBAAgB;AAChB,yHAAA,0BAA0B,OAAA;AAc5B,iEAAiE;AACjE,+DA6BgC;AA5B9B,oBAAoB;AACpB,+HAAA,uBAAuB,OAAA;AACvB,qIAAA,6BAA6B,OAAA;AAC7B,2IAAA,mCAAmC,OAAA;AACnC,wIAAA,gCAAgC,OAAA;AAChC,gIAAA,wBAAwB,OAAA;AAExB,iBAAiB;AACjB,yHAAA,iBAAiB,OAAA;AACjB,mIAAA,2BAA2B,OAAA;AAC3B,6HAAA,qBAAqB,OAAA;AAErB,YAAY;AACZ,oIAAA,4BAA4B,OAAA;AAC5B,sHAAA,cAAc,OAAA;AACd,qIAAA,6BAA6B,OAAA;AAC7B,gIAAA,wBAAwB,OAAA;AACxB,iIAAA,yBAAyB,OAAA;AACzB,0HAAA,kBAAkB,OAAA;AAYpB,mEAAmE;AACnE,mEAYkC;AAXhC,wBAAwB;AACxB,iIAAA,uBAAuB,OAAA;AACvB,8IAAA,oCAAoC,OAAA;AACpC,iIAAA,uBAAuB,OAAA;AACvB,wIAAA,8BAA8B,OAAA;AAC9B,kIAAA,wBAAwB,OAAA"}
|