@triedotdev/mcp 1.0.113 → 1.0.114
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/auto-fix-apply-PCAHWLXF.js +10 -0
- package/dist/autonomy-config-O4H3Z7YV.js +30 -0
- package/dist/chunk-2GIAROBF.js +173 -0
- package/dist/chunk-2GIAROBF.js.map +1 -0
- package/dist/{chunk-33WL3D7A.js → chunk-2SIFK7OW.js} +7 -419
- package/dist/chunk-2SIFK7OW.js.map +1 -0
- package/dist/chunk-43X6JBEM.js +36 -0
- package/dist/chunk-43X6JBEM.js.map +1 -0
- package/dist/{chunk-2764KZZQ.js → chunk-4SBZXIMG.js} +133 -595
- package/dist/chunk-4SBZXIMG.js.map +1 -0
- package/dist/chunk-55DOQNHJ.js +772 -0
- package/dist/chunk-55DOQNHJ.js.map +1 -0
- package/dist/chunk-6LXSA2OZ.js +425 -0
- package/dist/chunk-6LXSA2OZ.js.map +1 -0
- package/dist/{chunk-SDS3UVFY.js → chunk-AOFYU6T3.js} +113 -559
- package/dist/chunk-AOFYU6T3.js.map +1 -0
- package/dist/{chunk-6QR6QZIX.js → chunk-D3EXBJE2.js} +25 -658
- package/dist/chunk-D3EXBJE2.js.map +1 -0
- package/dist/chunk-DJ2YAGHK.js +50 -0
- package/dist/chunk-DJ2YAGHK.js.map +1 -0
- package/dist/chunk-DRDEEF6G.js +328 -0
- package/dist/chunk-DRDEEF6G.js.map +1 -0
- package/dist/chunk-DZREHOGW.js +706 -0
- package/dist/chunk-DZREHOGW.js.map +1 -0
- package/dist/chunk-KRH642MT.js +947 -0
- package/dist/chunk-KRH642MT.js.map +1 -0
- package/dist/{chunk-QYOACM2C.js → chunk-MVNJPJBK.js} +22 -252
- package/dist/chunk-MVNJPJBK.js.map +1 -0
- package/dist/chunk-NS2MSZMB.js +394 -0
- package/dist/chunk-NS2MSZMB.js.map +1 -0
- package/dist/chunk-SWSK7ANT.js +340 -0
- package/dist/chunk-SWSK7ANT.js.map +1 -0
- package/dist/chunk-VRLMTOB6.js +566 -0
- package/dist/chunk-VRLMTOB6.js.map +1 -0
- package/dist/chunk-YR4BMGYO.js +130 -0
- package/dist/chunk-YR4BMGYO.js.map +1 -0
- package/dist/chunk-ZV2K6M7T.js +74 -0
- package/dist/chunk-ZV2K6M7T.js.map +1 -0
- package/dist/cli/main.js +107 -375
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +18 -8
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/client-7XZHCMD3.js +28 -0
- package/dist/client-7XZHCMD3.js.map +1 -0
- package/dist/{goal-manager-AP4LTE6U.js → goal-manager-LMS6ZJB7.js} +7 -3
- package/dist/goal-manager-LMS6ZJB7.js.map +1 -0
- package/dist/goal-validator-7UPLOVAZ.js +184 -0
- package/dist/goal-validator-7UPLOVAZ.js.map +1 -0
- package/dist/graph-U5JWSAB5.js +10 -0
- package/dist/graph-U5JWSAB5.js.map +1 -0
- package/dist/guardian-agent-EXP7APLC.js +25 -0
- package/dist/guardian-agent-EXP7APLC.js.map +1 -0
- package/dist/hypothesis-KGC3P54C.js +19 -0
- package/dist/hypothesis-KGC3P54C.js.map +1 -0
- package/dist/incident-index-PNIVT47T.js +11 -0
- package/dist/incident-index-PNIVT47T.js.map +1 -0
- package/dist/index.js +285 -16
- package/dist/index.js.map +1 -1
- package/dist/ledger-SR6OEBLO.js +15 -0
- package/dist/ledger-SR6OEBLO.js.map +1 -0
- package/dist/output-manager-BOTMXSND.js +13 -0
- package/dist/output-manager-BOTMXSND.js.map +1 -0
- package/dist/pattern-discovery-F7LU5K6E.js +8 -0
- package/dist/pattern-discovery-F7LU5K6E.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-2764KZZQ.js.map +0 -1
- package/dist/chunk-33WL3D7A.js.map +0 -1
- package/dist/chunk-6JPPYG7F.js +0 -1813
- package/dist/chunk-6JPPYG7F.js.map +0 -1
- package/dist/chunk-6QR6QZIX.js.map +0 -1
- package/dist/chunk-QYOACM2C.js.map +0 -1
- package/dist/chunk-SDS3UVFY.js.map +0 -1
- package/dist/guardian-agent-XEYNG7RH.js +0 -18
- /package/dist/{goal-manager-AP4LTE6U.js.map → auto-fix-apply-PCAHWLXF.js.map} +0 -0
- /package/dist/{guardian-agent-XEYNG7RH.js.map → autonomy-config-O4H3Z7YV.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -32,33 +32,31 @@ import {
|
|
|
32
32
|
TrieQueryContextTool,
|
|
33
33
|
TrieScanTool,
|
|
34
34
|
TrieTellTool,
|
|
35
|
-
getOutputManager,
|
|
36
35
|
getPrompt,
|
|
37
36
|
getSystemPrompt,
|
|
38
37
|
handleCheckpointTool
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
38
|
+
} from "./chunk-4SBZXIMG.js";
|
|
39
|
+
import "./chunk-AOFYU6T3.js";
|
|
40
|
+
import "./chunk-2SIFK7OW.js";
|
|
41
|
+
import "./chunk-DZREHOGW.js";
|
|
42
|
+
import "./chunk-6LXSA2OZ.js";
|
|
41
43
|
import {
|
|
42
44
|
exportToJson,
|
|
43
45
|
formatFriendlyError,
|
|
44
46
|
importFromJson,
|
|
45
47
|
isTrieInitialized,
|
|
46
48
|
runShellCommandSync
|
|
47
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-MVNJPJBK.js";
|
|
48
50
|
import {
|
|
49
|
-
ContextGraph,
|
|
50
51
|
findCrossProjectPatterns,
|
|
51
52
|
getGlobalMemoryStats,
|
|
52
|
-
isAIAvailable,
|
|
53
53
|
listTrackedProjects,
|
|
54
|
-
runAIAnalysis,
|
|
55
54
|
searchGlobalPatterns
|
|
56
|
-
} from "./chunk-
|
|
57
|
-
import "./chunk-IXO4G4D3.js";
|
|
55
|
+
} from "./chunk-D3EXBJE2.js";
|
|
58
56
|
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
isAIAvailable,
|
|
58
|
+
runAIAnalysis
|
|
59
|
+
} from "./chunk-SWSK7ANT.js";
|
|
62
60
|
import {
|
|
63
61
|
findSimilarIssues,
|
|
64
62
|
getMemoryStats,
|
|
@@ -66,13 +64,28 @@ import {
|
|
|
66
64
|
markIssueResolved,
|
|
67
65
|
purgeIssues,
|
|
68
66
|
searchIssues
|
|
69
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-55DOQNHJ.js";
|
|
68
|
+
import "./chunk-KRH642MT.js";
|
|
69
|
+
import "./chunk-F4NJ4CBP.js";
|
|
70
|
+
import "./chunk-IXO4G4D3.js";
|
|
71
|
+
import {
|
|
72
|
+
ContextGraph
|
|
73
|
+
} from "./chunk-NS2MSZMB.js";
|
|
74
|
+
import "./chunk-2GIAROBF.js";
|
|
75
|
+
import "./chunk-6NLHFIYA.js";
|
|
76
|
+
import "./chunk-ZV2K6M7T.js";
|
|
77
|
+
import {
|
|
78
|
+
getSkillRegistry
|
|
79
|
+
} from "./chunk-G76DYVGX.js";
|
|
80
|
+
import {
|
|
81
|
+
getOutputManager
|
|
82
|
+
} from "./chunk-VRLMTOB6.js";
|
|
83
|
+
import "./chunk-YR4BMGYO.js";
|
|
84
|
+
import "./chunk-43X6JBEM.js";
|
|
70
85
|
import {
|
|
71
86
|
getTrieDirectory,
|
|
72
87
|
getWorkingDirectory
|
|
73
88
|
} from "./chunk-R4AAPFXC.js";
|
|
74
|
-
import "./chunk-F4NJ4CBP.js";
|
|
75
|
-
import "./chunk-6NLHFIYA.js";
|
|
76
89
|
import {
|
|
77
90
|
isInteractiveMode
|
|
78
91
|
} from "./chunk-APMV77PU.js";
|
|
@@ -1144,6 +1157,9 @@ var TrieWatchTool = class _TrieWatchTool {
|
|
|
1144
1157
|
watchers = /* @__PURE__ */ new Map();
|
|
1145
1158
|
streamingManager = void 0;
|
|
1146
1159
|
dashboard = void 0;
|
|
1160
|
+
lastHypothesisCheck = 0;
|
|
1161
|
+
static HYPOTHESIS_CHECK_INTERVAL_MS = 3e5;
|
|
1162
|
+
// Check every 5 minutes
|
|
1147
1163
|
async execute(args) {
|
|
1148
1164
|
const { action, directory, debounceMs = 1e3 } = args;
|
|
1149
1165
|
switch (action) {
|
|
@@ -1309,6 +1325,8 @@ Detected changes in ${files.length} file(s):`);
|
|
|
1309
1325
|
console.error("");
|
|
1310
1326
|
}
|
|
1311
1327
|
try {
|
|
1328
|
+
const projectPath = getWorkingDirectory(void 0, true);
|
|
1329
|
+
await this.checkGoalViolations(files, projectPath);
|
|
1312
1330
|
if (this.extractionPipeline) {
|
|
1313
1331
|
try {
|
|
1314
1332
|
const fileContents = await Promise.all(
|
|
@@ -1358,6 +1376,12 @@ ${f.content.slice(0, 1e3)}`
|
|
|
1358
1376
|
if (!this.isQuiet()) {
|
|
1359
1377
|
this.autoScanFiles(files);
|
|
1360
1378
|
}
|
|
1379
|
+
await this.discoverPatternsFromIssues(projectPath);
|
|
1380
|
+
const now = Date.now();
|
|
1381
|
+
if (now - this.lastHypothesisCheck > _TrieWatchTool.HYPOTHESIS_CHECK_INTERVAL_MS) {
|
|
1382
|
+
this.checkAndGenerateHypotheses(projectPath);
|
|
1383
|
+
this.lastHypothesisCheck = now;
|
|
1384
|
+
}
|
|
1361
1385
|
if (this.streamingManager) {
|
|
1362
1386
|
for (const file of files) {
|
|
1363
1387
|
this.streamingManager.reportWatchChange(file);
|
|
@@ -1385,6 +1409,251 @@ ${f.content.slice(0, 1e3)}`
|
|
|
1385
1409
|
return false;
|
|
1386
1410
|
}
|
|
1387
1411
|
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Check file changes against active user goals
|
|
1414
|
+
* If violations found: record to ledger, nudge user, auto-fix if enabled
|
|
1415
|
+
*/
|
|
1416
|
+
async checkGoalViolations(files, projectPath) {
|
|
1417
|
+
try {
|
|
1418
|
+
const { validateAgainstGoals, recordGoalViolationCaught, recordGoalViolationFixed } = await import("./goal-validator-7UPLOVAZ.js");
|
|
1419
|
+
const { appendIssuesToLedger } = await import("./ledger-SR6OEBLO.js");
|
|
1420
|
+
const { getAutonomyConfig } = await import("./autonomy-config-O4H3Z7YV.js");
|
|
1421
|
+
const { applyAutoFix } = await import("./auto-fix-apply-PCAHWLXF.js");
|
|
1422
|
+
const { getOutputManager: getOutputManager2 } = await import("./output-manager-BOTMXSND.js");
|
|
1423
|
+
const config = await getAutonomyConfig(projectPath);
|
|
1424
|
+
for (const file of files) {
|
|
1425
|
+
try {
|
|
1426
|
+
const content = await readFile3(file, "utf-8");
|
|
1427
|
+
const result = await validateAgainstGoals(file, content, projectPath);
|
|
1428
|
+
if (result.violations.length === 0) {
|
|
1429
|
+
continue;
|
|
1430
|
+
}
|
|
1431
|
+
for (const violation of result.violations) {
|
|
1432
|
+
const relativePath = file.replace(projectPath + "/", "");
|
|
1433
|
+
const issue = {
|
|
1434
|
+
id: `goal-violation-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1435
|
+
hash: "",
|
|
1436
|
+
file: relativePath,
|
|
1437
|
+
line: violation.line,
|
|
1438
|
+
agent: "goal-validator",
|
|
1439
|
+
severity: violation.severity,
|
|
1440
|
+
issue: violation.description,
|
|
1441
|
+
fix: violation.autoFixable ? "Auto-fixable" : "Manual fix required",
|
|
1442
|
+
category: "goal-violation",
|
|
1443
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1444
|
+
project: basename2(projectPath),
|
|
1445
|
+
resolved: false,
|
|
1446
|
+
resolvedAt: void 0
|
|
1447
|
+
};
|
|
1448
|
+
await appendIssuesToLedger([issue], projectPath);
|
|
1449
|
+
await recordGoalViolationCaught(violation.goal, relativePath, projectPath);
|
|
1450
|
+
const nudgeMessage = `[Goal Violation] ${violation.goal.description}: ${violation.violation} in ${basename2(file)}`;
|
|
1451
|
+
getOutputManager2().nudge(
|
|
1452
|
+
nudgeMessage,
|
|
1453
|
+
violation.severity === "critical" ? "critical" : "warning",
|
|
1454
|
+
relativePath,
|
|
1455
|
+
violation.severity === "critical" ? void 0 : 1e4
|
|
1456
|
+
);
|
|
1457
|
+
this.state.nudges.push({
|
|
1458
|
+
file: basename2(file),
|
|
1459
|
+
message: `Goal "${violation.goal.description}" violated: ${violation.violation}`,
|
|
1460
|
+
severity: violation.severity === "critical" ? "critical" : "high",
|
|
1461
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false })
|
|
1462
|
+
});
|
|
1463
|
+
if (!isInteractiveMode()) {
|
|
1464
|
+
console.error(` [!] Goal violation: ${violation.description}`);
|
|
1465
|
+
}
|
|
1466
|
+
if (config.autoFix.enabled && violation.autoFixable && violation.fixAction) {
|
|
1467
|
+
if (!isInteractiveMode()) {
|
|
1468
|
+
console.error(` [*] Auto-fixing...`);
|
|
1469
|
+
}
|
|
1470
|
+
const fixed = await applyAutoFix(violation.fixAction);
|
|
1471
|
+
if (fixed) {
|
|
1472
|
+
await recordGoalViolationFixed(violation.goal, relativePath, projectPath);
|
|
1473
|
+
const fixMessage = `[Auto-Fixed] ${violation.goal.description} violation in ${basename2(file)}`;
|
|
1474
|
+
getOutputManager2().nudge(
|
|
1475
|
+
fixMessage,
|
|
1476
|
+
"info",
|
|
1477
|
+
relativePath,
|
|
1478
|
+
5e3
|
|
1479
|
+
);
|
|
1480
|
+
if (!isInteractiveMode()) {
|
|
1481
|
+
console.error(` [+] Fixed automatically`);
|
|
1482
|
+
}
|
|
1483
|
+
const goalMeta = violation.goal.metadata || {};
|
|
1484
|
+
if (!isInteractiveMode()) {
|
|
1485
|
+
console.error(` [+] Goal progress: ${goalMeta.fixedCount || 1} violations caught and fixed`);
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
} else if (violation.autoFixable) {
|
|
1489
|
+
if (!isInteractiveMode()) {
|
|
1490
|
+
console.error(` [i] Auto-fix available. Enable with: trie config set autoFix.enabled true`);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
if (this.streamingManager && result.violations.length > 0) {
|
|
1495
|
+
this.streamingManager.reportSignalExtraction({
|
|
1496
|
+
decisions: 0,
|
|
1497
|
+
facts: 0,
|
|
1498
|
+
blockers: result.violations.length,
|
|
1499
|
+
questions: 0
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
} catch (error) {
|
|
1503
|
+
if (!isInteractiveMode()) {
|
|
1504
|
+
console.error(` [!] Could not validate ${basename2(file)}: ${error}`);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
} catch (error) {
|
|
1509
|
+
if (!isInteractiveMode()) {
|
|
1510
|
+
console.error(` [!] Goal validation failed: ${error}`);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
/**
|
|
1515
|
+
* Check and generate hypotheses autonomously
|
|
1516
|
+
* Claude observes patterns and creates new hypotheses to test
|
|
1517
|
+
*/
|
|
1518
|
+
async checkAndGenerateHypotheses(projectPath) {
|
|
1519
|
+
if (!isAIAvailable()) return;
|
|
1520
|
+
try {
|
|
1521
|
+
const { getHypothesisEngine } = await import("./hypothesis-KGC3P54C.js");
|
|
1522
|
+
const { getOutputManager: getOutputManager2 } = await import("./output-manager-BOTMXSND.js");
|
|
1523
|
+
const hypothesisEngine = getHypothesisEngine(projectPath);
|
|
1524
|
+
const recentIssues = Array.from(this.state.issueCache.values()).flat();
|
|
1525
|
+
const patterns = [];
|
|
1526
|
+
const observations = [];
|
|
1527
|
+
if (this.state.nudges.length > 0) {
|
|
1528
|
+
const nudgesByFile = {};
|
|
1529
|
+
for (const nudge of this.state.nudges) {
|
|
1530
|
+
nudgesByFile[nudge.file] = (nudgesByFile[nudge.file] || 0) + 1;
|
|
1531
|
+
}
|
|
1532
|
+
const topFiles = Object.entries(nudgesByFile).sort(([, a], [, b]) => b - a).slice(0, 3);
|
|
1533
|
+
if (topFiles[0] && topFiles[0][1] > 2) {
|
|
1534
|
+
observations.push(`File ${topFiles[0][0]} has ${topFiles[0][1]} repeated issues this session`);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
if (this.state.nudges.length > 5) {
|
|
1538
|
+
observations.push(`High issue detection rate: ${this.state.nudges.length} violations detected in watch session`);
|
|
1539
|
+
}
|
|
1540
|
+
let generated = await hypothesisEngine.generateHypothesesWithAI({
|
|
1541
|
+
recentIssues,
|
|
1542
|
+
patterns,
|
|
1543
|
+
observations
|
|
1544
|
+
});
|
|
1545
|
+
if (generated.length === 0) {
|
|
1546
|
+
generated = await hypothesisEngine.autoGenerateHypotheses();
|
|
1547
|
+
}
|
|
1548
|
+
for (const hypothesis of generated) {
|
|
1549
|
+
const message = `[New Hypothesis] "${hypothesis.statement}" (${Math.round(hypothesis.confidence * 100)}% confidence)`;
|
|
1550
|
+
getOutputManager2().nudge(
|
|
1551
|
+
message,
|
|
1552
|
+
"info",
|
|
1553
|
+
void 0,
|
|
1554
|
+
1e4
|
|
1555
|
+
);
|
|
1556
|
+
if (!isInteractiveMode()) {
|
|
1557
|
+
console.error(`
|
|
1558
|
+
[?] ${message}`);
|
|
1559
|
+
console.error(` Test: ${hypothesis.testCriteria || "Collecting evidence..."}`);
|
|
1560
|
+
}
|
|
1561
|
+
if (this.streamingManager) {
|
|
1562
|
+
this.streamingManager.reportSignalExtraction({
|
|
1563
|
+
decisions: 0,
|
|
1564
|
+
facts: 0,
|
|
1565
|
+
blockers: 0,
|
|
1566
|
+
questions: 1
|
|
1567
|
+
// Hypotheses are questions to answer
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
if (recentIssues.length > 10) {
|
|
1572
|
+
await hypothesisEngine.updateConfidenceFromOutcomes();
|
|
1573
|
+
}
|
|
1574
|
+
} catch (error) {
|
|
1575
|
+
if (!isInteractiveMode()) {
|
|
1576
|
+
console.error(` [!] Hypothesis check failed: ${error}`);
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Discover patterns from accumulated issues
|
|
1582
|
+
* Patterns emerge naturally from your coding workflow
|
|
1583
|
+
*/
|
|
1584
|
+
async discoverPatternsFromIssues(projectPath) {
|
|
1585
|
+
const totalIssues = Array.from(this.state.issueCache.values()).flat().length;
|
|
1586
|
+
if (totalIssues < 5) return;
|
|
1587
|
+
try {
|
|
1588
|
+
const { ContextGraph: ContextGraph2 } = await import("./graph-U5JWSAB5.js");
|
|
1589
|
+
const { IncidentIndex } = await import("./incident-index-PNIVT47T.js");
|
|
1590
|
+
const { TriePatternDiscovery } = await import("./pattern-discovery-F7LU5K6E.js");
|
|
1591
|
+
const graph = new ContextGraph2(projectPath);
|
|
1592
|
+
const incidentIndex = await IncidentIndex.build(graph, projectPath);
|
|
1593
|
+
const discovery = new TriePatternDiscovery(graph, incidentIndex);
|
|
1594
|
+
const hotPatterns = discovery.discoverHotPatterns(2);
|
|
1595
|
+
for (const hot of hotPatterns) {
|
|
1596
|
+
const existingPatterns = await graph.listNodes();
|
|
1597
|
+
const alreadyExists = existingPatterns.some(
|
|
1598
|
+
(n) => n.type === "pattern" && n.data.description?.includes(hot.path)
|
|
1599
|
+
);
|
|
1600
|
+
if (!alreadyExists) {
|
|
1601
|
+
await graph.addNode("pattern", {
|
|
1602
|
+
description: `${hot.type === "directory" ? "Directory" : "File"} hot zone: ${hot.path}`,
|
|
1603
|
+
appliesTo: [hot.path],
|
|
1604
|
+
confidence: Math.min(0.95, hot.confidence),
|
|
1605
|
+
occurrences: hot.incidentCount,
|
|
1606
|
+
firstSeen: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1607
|
+
lastSeen: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1608
|
+
isAntiPattern: hot.incidentCount >= 3,
|
|
1609
|
+
// 3+ incidents = anti-pattern
|
|
1610
|
+
source: "local"
|
|
1611
|
+
});
|
|
1612
|
+
if (!isInteractiveMode()) {
|
|
1613
|
+
console.error(` [+] Pattern discovered: ${hot.path} (${hot.incidentCount} issues)`);
|
|
1614
|
+
}
|
|
1615
|
+
if (this.streamingManager) {
|
|
1616
|
+
this.streamingManager.reportSignalExtraction({
|
|
1617
|
+
decisions: 0,
|
|
1618
|
+
facts: 1,
|
|
1619
|
+
// Patterns are facts about the codebase
|
|
1620
|
+
blockers: 0,
|
|
1621
|
+
questions: 0
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
if (totalIssues >= 10) {
|
|
1627
|
+
const coOccurrences = await discovery.discoverCoOccurrences(2);
|
|
1628
|
+
for (const coOcc of coOccurrences.slice(0, 3)) {
|
|
1629
|
+
const desc = `Files break together: ${coOcc.files[0]} + ${coOcc.files[1]}`;
|
|
1630
|
+
const existingPatterns = await graph.listNodes();
|
|
1631
|
+
const alreadyExists = existingPatterns.some(
|
|
1632
|
+
(n) => n.type === "pattern" && n.data.description === desc
|
|
1633
|
+
);
|
|
1634
|
+
if (!alreadyExists) {
|
|
1635
|
+
await graph.addNode("pattern", {
|
|
1636
|
+
description: desc,
|
|
1637
|
+
appliesTo: [...coOcc.files],
|
|
1638
|
+
confidence: Math.min(0.95, coOcc.confidence),
|
|
1639
|
+
occurrences: coOcc.coOccurrences,
|
|
1640
|
+
firstSeen: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1641
|
+
lastSeen: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1642
|
+
isAntiPattern: coOcc.confidence > 0.7,
|
|
1643
|
+
source: "local"
|
|
1644
|
+
});
|
|
1645
|
+
if (!isInteractiveMode()) {
|
|
1646
|
+
console.error(` [+] Co-occurrence pattern: ${coOcc.files[0]} + ${coOcc.files[1]}`);
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
} catch (error) {
|
|
1652
|
+
if (!isInteractiveMode()) {
|
|
1653
|
+
console.error(` [!] Pattern discovery failed: ${error}`);
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1388
1657
|
static AUTO_SCAN_COOLDOWN_MS = 3e4;
|
|
1389
1658
|
static CLEAN_FILE_COOLDOWN_MS = 3e5;
|
|
1390
1659
|
// skip files clean-scanned in last 5 min
|
|
@@ -1632,7 +1901,7 @@ Use \`trie_watch start\` to begin autonomous scanning.`
|
|
|
1632
1901
|
).join("\n");
|
|
1633
1902
|
let agencyStatus = "";
|
|
1634
1903
|
try {
|
|
1635
|
-
const { getGuardian } = await import("./guardian-agent-
|
|
1904
|
+
const { getGuardian } = await import("./guardian-agent-EXP7APLC.js");
|
|
1636
1905
|
const trieAgent = getGuardian(getWorkingDirectory(void 0, true));
|
|
1637
1906
|
await trieAgent.initialize();
|
|
1638
1907
|
const status = await trieAgent.getAgencyStatus();
|