dual-brain 7.1.8 → 7.1.9
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/package.json +1 -1
- package/src/decide.mjs +2 -2
- package/src/detect.mjs +9 -0
package/package.json
CHANGED
package/src/decide.mjs
CHANGED
|
@@ -213,7 +213,7 @@ function getHealthScores(tier, cwd) {
|
|
|
213
213
|
* @returns {boolean}
|
|
214
214
|
*/
|
|
215
215
|
export function shouldDualBrain(detection, profile) {
|
|
216
|
-
const { intent = '', risk = 'low', complexity = 'simple' } = detection;
|
|
216
|
+
const { intent = '', risk = 'low', complexity = 'simple', designImpact = false } = detection;
|
|
217
217
|
const dualEnabled = profile?.dual_brain_enabled !== false;
|
|
218
218
|
const hasBothProviders = !!(
|
|
219
219
|
profile?.providers?.claude?.enabled &&
|
|
@@ -227,7 +227,7 @@ export function shouldDualBrain(detection, profile) {
|
|
|
227
227
|
const archOrSecurity = ['architecture', 'security'].includes(intent);
|
|
228
228
|
const complexHighRisk = complexity === 'complex' && risk === 'high';
|
|
229
229
|
|
|
230
|
-
return criticalRisk || archOrSecurity || complexHighRisk;
|
|
230
|
+
return criticalRisk || archOrSecurity || complexHighRisk || designImpact;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// ─── Internal: select model for provider ─────────────────────────────────────
|
package/src/detect.mjs
CHANGED
|
@@ -43,6 +43,13 @@ const RISK_KEYWORDS = [
|
|
|
43
43
|
{ level: 'low', regex: /\b(readme|docs?|comment|format|lint|changelog|typo|whitespace)\b/i },
|
|
44
44
|
];
|
|
45
45
|
|
|
46
|
+
const DESIGN_IMPACT_PATTERNS = [
|
|
47
|
+
/\bbin\/dual-brain\.mjs\b/,
|
|
48
|
+
/\bsrc\/(?:tui|profile|detect|decide|dispatch|session|health|index)\.mjs\b/,
|
|
49
|
+
/\bhooks\/(?:head-guard|enforce-tier|budget-balancer|dual-brain-think|dual-brain-review|wave-orchestrator)\.mjs\b/,
|
|
50
|
+
/\bVISION\.md\b/,
|
|
51
|
+
];
|
|
52
|
+
|
|
46
53
|
const LEVEL_ORDER = { critical: 3, high: 2, medium: 1, low: 0 };
|
|
47
54
|
|
|
48
55
|
// ─── Helpers / Exported functions ─────────────────────────────────────────────
|
|
@@ -152,6 +159,7 @@ function detectTask(input) {
|
|
|
152
159
|
const extractedPaths = extractPaths(prompt);
|
|
153
160
|
const allPaths = [...files, ...extractedPaths];
|
|
154
161
|
const { level: pathRiskLevel, riskyFiles } = classifyRisk(allPaths);
|
|
162
|
+
const designImpact = allPaths.some(p => DESIGN_IMPACT_PATTERNS.some(re => re.test(p)));
|
|
155
163
|
|
|
156
164
|
// 3. Keyword risk from description
|
|
157
165
|
let keywordRisk = 'low';
|
|
@@ -199,6 +207,7 @@ function detectTask(input) {
|
|
|
199
207
|
tier,
|
|
200
208
|
fileCount,
|
|
201
209
|
riskyFiles,
|
|
210
|
+
designImpact,
|
|
202
211
|
requiresWrite: requiresWrite(intent),
|
|
203
212
|
explanation,
|
|
204
213
|
};
|