@triedotdev/mcp 1.0.136 → 1.0.138
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/README.md +6 -6
- package/dist/{autonomy-config-QA6ATWLJ.js → autonomy-config-TZ6HF4FA.js} +3 -3
- package/dist/{chat-store-HFOOWZYN.js → chat-store-OJLJCJFI.js} +3 -3
- package/dist/{chunk-DFPVUMVE.js → chunk-23RJT5WT.js} +5 -4
- package/dist/chunk-23RJT5WT.js.map +1 -0
- package/dist/{chunk-4YJ6KLGI.js → chunk-3MUCUZ46.js} +8 -8
- package/dist/chunk-3MUCUZ46.js.map +1 -0
- package/dist/{chunk-6VIMBFUZ.js → chunk-3RRXWX3V.js} +21 -17
- package/dist/chunk-3RRXWX3V.js.map +1 -0
- package/dist/{chunk-WHIQAGB7.js → chunk-4C67GV3O.js} +2 -2
- package/dist/{chunk-WS6OA7H6.js → chunk-4MJ52WBH.js} +2 -3
- package/dist/chunk-4MJ52WBH.js.map +1 -0
- package/dist/{chunk-AJ34GCMD.js → chunk-67GSG2ST.js} +41 -38
- package/dist/chunk-67GSG2ST.js.map +1 -0
- package/dist/{chunk-UHX4462X.js → chunk-6LLH3TBZ.js} +24 -25
- package/dist/chunk-6LLH3TBZ.js.map +1 -0
- package/dist/{chunk-DFHMB44X.js → chunk-D3AS5LY7.js} +6 -10
- package/dist/chunk-D3AS5LY7.js.map +1 -0
- package/dist/{chunk-6OUWNVLX.js → chunk-EDDT4ZIH.js} +8 -8
- package/dist/chunk-EDDT4ZIH.js.map +1 -0
- package/dist/{chunk-Z4DN527J.js → chunk-FG467PDD.js} +156 -39
- package/dist/chunk-FG467PDD.js.map +1 -0
- package/dist/{chunk-T4THB2OR.js → chunk-FOCXXIXY.js} +49 -28
- package/dist/chunk-FOCXXIXY.js.map +1 -0
- package/dist/{goal-validator-PDKYZSNP.js → chunk-GFFUDJMK.js} +97 -40
- package/dist/chunk-GFFUDJMK.js.map +1 -0
- package/dist/{chunk-ZEXMMTIQ.js → chunk-J5EMP4XW.js} +2 -2
- package/dist/{chunk-UHMMANC2.js → chunk-LT6VUZG2.js} +21 -18
- package/dist/chunk-LT6VUZG2.js.map +1 -0
- package/dist/{chunk-55CBWOEZ.js → chunk-QSWUPSLK.js} +2 -2
- package/dist/{chunk-45Y5TLQZ.js → chunk-SH7H3WRU.js} +3 -6
- package/dist/chunk-SH7H3WRU.js.map +1 -0
- package/dist/{chunk-VRLMTOB6.js → chunk-TIMIKBY2.js} +1 -1
- package/dist/chunk-TIMIKBY2.js.map +1 -0
- package/dist/{chunk-POHBQUG7.js → chunk-X3F5QDER.js} +1224 -448
- package/dist/chunk-X3F5QDER.js.map +1 -0
- package/dist/{chunk-O6OTJI3W.js → chunk-Y32FM3MR.js} +2 -2
- package/dist/{chunk-G5PRBQIQ.js → chunk-YOKQ25IW.js} +102 -82
- package/dist/chunk-YOKQ25IW.js.map +1 -0
- package/dist/{chunk-JAKMZI5S.js → chunk-Z2P4WST6.js} +291 -180
- package/dist/chunk-Z2P4WST6.js.map +1 -0
- package/dist/cli/create-agent.js +1 -1
- package/dist/cli/main.js +113 -86
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +19 -19
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{client-BZHI675W.js → client-JTU5TRLB.js} +3 -3
- package/dist/{codebase-index-CR6Q2HEI.js → codebase-index-FNJ4GCBE.js} +3 -3
- package/dist/{goal-manager-FAK7H4RR.js → goal-manager-6BJQ36AH.js} +7 -8
- package/dist/goal-validator-GISXYANK.js +22 -0
- package/dist/{graph-PAUZ5EMP.js → graph-X2FMRQLG.js} +3 -3
- package/dist/{hypothesis-L5446W36.js → hypothesis-K3KQJOXJ.js} +7 -8
- package/dist/{incident-index-ZCDSJ42L.js → incident-index-BWW2UEY7.js} +3 -3
- package/dist/index.js +343 -288
- package/dist/index.js.map +1 -1
- package/dist/{insight-store-F5KDBY5Y.js → insight-store-A5XXMFD6.js} +6 -6
- package/dist/issue-store-BO5OWLJW.js +32 -0
- package/dist/{output-manager-BOTMXSND.js → output-manager-DZO5LGSG.js} +2 -2
- package/dist/{tiered-storage-QW2G7GSG.js → tiered-storage-VZL7KK64.js} +3 -3
- package/dist/trie-agent-XMSGMD7E.js +26 -0
- package/dist/trie-agent-XMSGMD7E.js.map +1 -0
- package/dist/ui/chat.html +260 -67
- package/dist/ui/goals.html +246 -3
- package/dist/ui/hypotheses.html +248 -5
- package/dist/ui/ledger.html +252 -9
- package/dist/ui/nudges.html +244 -1
- package/package.json +1 -1
- package/dist/chunk-45Y5TLQZ.js.map +0 -1
- package/dist/chunk-4YJ6KLGI.js.map +0 -1
- package/dist/chunk-6OUWNVLX.js.map +0 -1
- package/dist/chunk-6VIMBFUZ.js.map +0 -1
- package/dist/chunk-AJ34GCMD.js.map +0 -1
- package/dist/chunk-DFHMB44X.js.map +0 -1
- package/dist/chunk-DFPVUMVE.js.map +0 -1
- package/dist/chunk-G5PRBQIQ.js.map +0 -1
- package/dist/chunk-JAKMZI5S.js.map +0 -1
- package/dist/chunk-PEJEYWVR.js +0 -135
- package/dist/chunk-PEJEYWVR.js.map +0 -1
- package/dist/chunk-POHBQUG7.js.map +0 -1
- package/dist/chunk-T4THB2OR.js.map +0 -1
- package/dist/chunk-UHMMANC2.js.map +0 -1
- package/dist/chunk-UHX4462X.js.map +0 -1
- package/dist/chunk-VRLMTOB6.js.map +0 -1
- package/dist/chunk-WS6OA7H6.js.map +0 -1
- package/dist/chunk-Z4DN527J.js.map +0 -1
- package/dist/goal-validator-PDKYZSNP.js.map +0 -1
- package/dist/guardian-agent-4RHGIXUD.js +0 -27
- package/dist/ledger-WKVJWHBX.js +0 -17
- /package/dist/{autonomy-config-QA6ATWLJ.js.map → autonomy-config-TZ6HF4FA.js.map} +0 -0
- /package/dist/{chat-store-HFOOWZYN.js.map → chat-store-OJLJCJFI.js.map} +0 -0
- /package/dist/{chunk-WHIQAGB7.js.map → chunk-4C67GV3O.js.map} +0 -0
- /package/dist/{chunk-ZEXMMTIQ.js.map → chunk-J5EMP4XW.js.map} +0 -0
- /package/dist/{chunk-55CBWOEZ.js.map → chunk-QSWUPSLK.js.map} +0 -0
- /package/dist/{chunk-O6OTJI3W.js.map → chunk-Y32FM3MR.js.map} +0 -0
- /package/dist/{client-BZHI675W.js.map → client-JTU5TRLB.js.map} +0 -0
- /package/dist/{codebase-index-CR6Q2HEI.js.map → codebase-index-FNJ4GCBE.js.map} +0 -0
- /package/dist/{goal-manager-FAK7H4RR.js.map → goal-manager-6BJQ36AH.js.map} +0 -0
- /package/dist/{graph-PAUZ5EMP.js.map → goal-validator-GISXYANK.js.map} +0 -0
- /package/dist/{guardian-agent-4RHGIXUD.js.map → graph-X2FMRQLG.js.map} +0 -0
- /package/dist/{hypothesis-L5446W36.js.map → hypothesis-K3KQJOXJ.js.map} +0 -0
- /package/dist/{incident-index-ZCDSJ42L.js.map → incident-index-BWW2UEY7.js.map} +0 -0
- /package/dist/{insight-store-F5KDBY5Y.js.map → insight-store-A5XXMFD6.js.map} +0 -0
- /package/dist/{ledger-WKVJWHBX.js.map → issue-store-BO5OWLJW.js.map} +0 -0
- /package/dist/{output-manager-BOTMXSND.js.map → output-manager-DZO5LGSG.js.map} +0 -0
- /package/dist/{tiered-storage-QW2G7GSG.js.map → tiered-storage-VZL7KK64.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTrieDirectory,
|
|
3
3
|
getWorkingDirectory
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SH7H3WRU.js";
|
|
5
5
|
|
|
6
6
|
// src/ai/client.ts
|
|
7
7
|
import Anthropic from "@anthropic-ai/sdk";
|
|
@@ -352,4 +352,4 @@ export {
|
|
|
352
352
|
getAIStatusMessage,
|
|
353
353
|
runAIWithTools
|
|
354
354
|
};
|
|
355
|
-
//# sourceMappingURL=chunk-
|
|
355
|
+
//# sourceMappingURL=chunk-Y32FM3MR.js.map
|
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGoalManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FOCXXIXY.js";
|
|
4
4
|
import {
|
|
5
5
|
getHypothesisEngine
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-67GSG2ST.js";
|
|
7
7
|
import {
|
|
8
8
|
getInsightStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3MUCUZ46.js";
|
|
10
10
|
import {
|
|
11
11
|
GotchaPredictor,
|
|
12
12
|
findCrossProjectPatterns,
|
|
13
13
|
recordToGlobalMemory
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6LLH3TBZ.js";
|
|
15
15
|
import {
|
|
16
16
|
isAIAvailable,
|
|
17
17
|
runAIAnalysis
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-Y32FM3MR.js";
|
|
19
|
+
import {
|
|
20
|
+
getProjectState
|
|
21
|
+
} from "./chunk-LT6VUZG2.js";
|
|
22
|
+
import {
|
|
23
|
+
getStorage
|
|
24
|
+
} from "./chunk-FG467PDD.js";
|
|
25
|
+
import {
|
|
26
|
+
ContextGraph
|
|
27
|
+
} from "./chunk-QSWUPSLK.js";
|
|
19
28
|
import {
|
|
20
29
|
autoResolveIssues,
|
|
21
30
|
getHistoricalInsights,
|
|
22
31
|
getIssueHash,
|
|
23
32
|
searchIssues,
|
|
24
33
|
storeIssues
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import {
|
|
27
|
-
getGuardianState
|
|
28
|
-
} from "./chunk-UHMMANC2.js";
|
|
29
|
-
import {
|
|
30
|
-
ContextGraph
|
|
31
|
-
} from "./chunk-55CBWOEZ.js";
|
|
34
|
+
} from "./chunk-Z2P4WST6.js";
|
|
32
35
|
|
|
33
|
-
// src/
|
|
36
|
+
// src/agent/trie-agent.ts
|
|
34
37
|
import { basename as basename2 } from "path";
|
|
35
38
|
|
|
36
|
-
// src/
|
|
39
|
+
// src/agent/risk-predictor.ts
|
|
37
40
|
import { basename, dirname } from "path";
|
|
38
41
|
var DEFAULT_CONFIG = {
|
|
39
42
|
historyDays: 30,
|
|
@@ -706,7 +709,7 @@ ${overdueAssignments.length} issues are overdue and require attention.`
|
|
|
706
709
|
}
|
|
707
710
|
};
|
|
708
711
|
|
|
709
|
-
// src/
|
|
712
|
+
// src/agent/escalation.ts
|
|
710
713
|
var DEFAULT_CONFIG2 = {
|
|
711
714
|
enabled: true,
|
|
712
715
|
targets: [],
|
|
@@ -719,14 +722,14 @@ var DEFAULT_CONFIG2 = {
|
|
|
719
722
|
var EscalationManager = class {
|
|
720
723
|
projectPath;
|
|
721
724
|
config;
|
|
722
|
-
|
|
725
|
+
projectState;
|
|
723
726
|
insightStore;
|
|
724
727
|
escalationHistory = [];
|
|
725
728
|
slackClient;
|
|
726
729
|
constructor(projectPath, config = {}) {
|
|
727
730
|
this.projectPath = projectPath;
|
|
728
731
|
this.config = { ...DEFAULT_CONFIG2, ...config };
|
|
729
|
-
this.
|
|
732
|
+
this.projectState = getProjectState(projectPath);
|
|
730
733
|
this.insightStore = getInsightStore(projectPath);
|
|
731
734
|
const slackTarget = this.config.targets.find((t) => t.type === "slack" && t.enabled);
|
|
732
735
|
if (slackTarget?.config.webhookUrl) {
|
|
@@ -751,7 +754,7 @@ var EscalationManager = class {
|
|
|
751
754
|
if (!isSecurityIssue) {
|
|
752
755
|
return false;
|
|
753
756
|
}
|
|
754
|
-
if (this.
|
|
757
|
+
if (this.projectState.isQuietHours()) {
|
|
755
758
|
if (!this.config.criticalBypassQuietHours) {
|
|
756
759
|
return false;
|
|
757
760
|
}
|
|
@@ -787,7 +790,7 @@ var EscalationManager = class {
|
|
|
787
790
|
async autoEscalateIfCritical(issue) {
|
|
788
791
|
if (!this.shouldAutoEscalate(issue)) {
|
|
789
792
|
if (issue.severity === "critical" && this.config.draftFallbackEnabled) {
|
|
790
|
-
if (this.
|
|
793
|
+
if (this.projectState.isQuietHours()) {
|
|
791
794
|
return this.createDraftEscalation([issue], "Blocked by quiet hours");
|
|
792
795
|
}
|
|
793
796
|
}
|
|
@@ -802,7 +805,7 @@ var EscalationManager = class {
|
|
|
802
805
|
this.escalationHistory.push(message);
|
|
803
806
|
await this.insightStore.markInsightCreated("auto-escalation");
|
|
804
807
|
await this.createEscalationInsight(message);
|
|
805
|
-
await this.
|
|
808
|
+
await this.projectState.useRiskBudget(1);
|
|
806
809
|
return {
|
|
807
810
|
action: "auto_escalated",
|
|
808
811
|
reason: "Critical security issue auto-escalated",
|
|
@@ -833,7 +836,7 @@ var EscalationManager = class {
|
|
|
833
836
|
reason: "No critical security issues to escalate"
|
|
834
837
|
};
|
|
835
838
|
}
|
|
836
|
-
if (this.
|
|
839
|
+
if (this.projectState.isQuietHours() && !this.config.criticalBypassQuietHours) {
|
|
837
840
|
return this.createDraftEscalation(criticalSecurityIssues, "Blocked by quiet hours");
|
|
838
841
|
}
|
|
839
842
|
const message = this.createEscalationMessage(criticalSecurityIssues);
|
|
@@ -942,7 +945,7 @@ var EscalationManager = class {
|
|
|
942
945
|
const slack = new SlackIntegration({
|
|
943
946
|
webhookUrl: target.config.webhookUrl,
|
|
944
947
|
channel: target.config.channel,
|
|
945
|
-
username: target.config.username || "Trie
|
|
948
|
+
username: target.config.username || "Trie Agent"
|
|
946
949
|
});
|
|
947
950
|
await slack.sendCriticalAlert(message.issues, this.projectPath.split("/").pop() || "Unknown");
|
|
948
951
|
}
|
|
@@ -1098,14 +1101,14 @@ function getEscalationManager(projectPath) {
|
|
|
1098
1101
|
return manager;
|
|
1099
1102
|
}
|
|
1100
1103
|
|
|
1101
|
-
// src/
|
|
1104
|
+
// src/agent/meta-learning.ts
|
|
1102
1105
|
var MetaLearner = class {
|
|
1103
|
-
|
|
1106
|
+
projectState;
|
|
1104
1107
|
insightStore;
|
|
1105
1108
|
feedbackHistory = [];
|
|
1106
1109
|
weights;
|
|
1107
1110
|
constructor(projectPath) {
|
|
1108
|
-
this.
|
|
1111
|
+
this.projectState = getProjectState(projectPath);
|
|
1109
1112
|
this.insightStore = getInsightStore(projectPath);
|
|
1110
1113
|
this.weights = {
|
|
1111
1114
|
security: 1,
|
|
@@ -1137,7 +1140,7 @@ var MetaLearner = class {
|
|
|
1137
1140
|
record.latencyMs = context.latencyMs;
|
|
1138
1141
|
}
|
|
1139
1142
|
this.feedbackHistory.push(record);
|
|
1140
|
-
await this.
|
|
1143
|
+
await this.projectState.recordInsightFeedback(
|
|
1141
1144
|
feedback === "dismissed" ? "dismissed" : feedback === "acted" ? "acted" : "helpful"
|
|
1142
1145
|
);
|
|
1143
1146
|
await this.adjustWeights(record);
|
|
@@ -1217,14 +1220,14 @@ var MetaLearner = class {
|
|
|
1217
1220
|
* Get agent effectiveness metrics
|
|
1218
1221
|
*/
|
|
1219
1222
|
getEffectiveness() {
|
|
1220
|
-
return this.
|
|
1223
|
+
return this.projectState.getMetrics();
|
|
1221
1224
|
}
|
|
1222
1225
|
/**
|
|
1223
1226
|
* Generate a comprehensive effectiveness report
|
|
1224
1227
|
*/
|
|
1225
1228
|
async generateEffectivenessReport() {
|
|
1226
|
-
await this.
|
|
1227
|
-
const metrics = this.
|
|
1229
|
+
await this.projectState.load();
|
|
1230
|
+
const metrics = this.projectState.getMetrics();
|
|
1228
1231
|
const categoryBreakdown = this.calculateCategoryEffectiveness();
|
|
1229
1232
|
const overallScore = metrics.userSatisfaction * 0.4 + metrics.predictiveAccuracy * 0.3 + (1 - metrics.falsePositiveRate) * 0.3;
|
|
1230
1233
|
const recommendations = this.generateRecommendations(metrics, categoryBreakdown);
|
|
@@ -1382,7 +1385,7 @@ function getMetaLearner(projectPath) {
|
|
|
1382
1385
|
return learner;
|
|
1383
1386
|
}
|
|
1384
1387
|
|
|
1385
|
-
// src/
|
|
1388
|
+
// src/agent/trie-agent.ts
|
|
1386
1389
|
var PERSONALITY = {
|
|
1387
1390
|
greetings: [
|
|
1388
1391
|
"Hey, quick heads up...",
|
|
@@ -1419,15 +1422,15 @@ var PERSONALITY = {
|
|
|
1419
1422
|
"Quick question:"
|
|
1420
1423
|
]
|
|
1421
1424
|
};
|
|
1422
|
-
var
|
|
1425
|
+
var TrieAgent = class {
|
|
1423
1426
|
projectPath;
|
|
1424
1427
|
projectName;
|
|
1425
1428
|
lastIssueHashes = /* @__PURE__ */ new Set();
|
|
1426
1429
|
initialized = false;
|
|
1427
|
-
// Persistent stores
|
|
1430
|
+
// Persistent stores
|
|
1428
1431
|
insightStore;
|
|
1429
|
-
|
|
1430
|
-
// Agency modules
|
|
1432
|
+
projectState;
|
|
1433
|
+
// Agency modules
|
|
1431
1434
|
goalManager;
|
|
1432
1435
|
riskPredictor;
|
|
1433
1436
|
hypothesisEngine;
|
|
@@ -1438,7 +1441,7 @@ var GuardianAgent = class {
|
|
|
1438
1441
|
this.projectPath = projectPath;
|
|
1439
1442
|
this.projectName = basename2(projectPath);
|
|
1440
1443
|
this.insightStore = getInsightStore(projectPath);
|
|
1441
|
-
this.
|
|
1444
|
+
this.projectState = getProjectState(projectPath);
|
|
1442
1445
|
this.goalManager = getGoalManager(projectPath);
|
|
1443
1446
|
this.riskPredictor = getRiskPredictor(projectPath);
|
|
1444
1447
|
this.hypothesisEngine = getHypothesisEngine(projectPath);
|
|
@@ -1447,14 +1450,14 @@ var GuardianAgent = class {
|
|
|
1447
1450
|
this.gotchaPredictor = new GotchaPredictor(projectPath, new ContextGraph(projectPath));
|
|
1448
1451
|
}
|
|
1449
1452
|
/**
|
|
1450
|
-
* Initialize the
|
|
1453
|
+
* Initialize the agent - loads persistent state and historical data
|
|
1451
1454
|
*/
|
|
1452
1455
|
async initialize() {
|
|
1453
1456
|
if (this.initialized) return;
|
|
1454
1457
|
try {
|
|
1455
1458
|
await this.insightStore.load();
|
|
1456
|
-
await this.
|
|
1457
|
-
await this.
|
|
1459
|
+
await this.projectState.load();
|
|
1460
|
+
await this.projectState.touchActive();
|
|
1458
1461
|
const historical = await getHistoricalInsights(this.projectPath);
|
|
1459
1462
|
if (historical && historical.totalHistoricalIssues > 0) {
|
|
1460
1463
|
const trend = historical.improvementTrend;
|
|
@@ -1489,22 +1492,22 @@ var GuardianAgent = class {
|
|
|
1489
1492
|
return this.insightStore.addInsight(insight);
|
|
1490
1493
|
}
|
|
1491
1494
|
/**
|
|
1492
|
-
* Restart the
|
|
1495
|
+
* Restart the agent (reload state from disk)
|
|
1493
1496
|
*/
|
|
1494
1497
|
async restart() {
|
|
1495
1498
|
this.initialized = false;
|
|
1496
1499
|
await this.insightStore.reload();
|
|
1497
|
-
await this.
|
|
1500
|
+
await this.projectState.reload();
|
|
1498
1501
|
await this.initialize();
|
|
1499
1502
|
}
|
|
1500
1503
|
/**
|
|
1501
1504
|
* Load state from disk (for testing)
|
|
1502
1505
|
*/
|
|
1503
1506
|
async loadState() {
|
|
1504
|
-
await this.
|
|
1507
|
+
await this.projectState.load();
|
|
1505
1508
|
return {
|
|
1506
|
-
goals: this.
|
|
1507
|
-
riskBudget: this.
|
|
1509
|
+
goals: this.projectState.getAllGoals(),
|
|
1510
|
+
riskBudget: this.projectState.getRiskBudget()
|
|
1508
1511
|
};
|
|
1509
1512
|
}
|
|
1510
1513
|
/**
|
|
@@ -1672,9 +1675,9 @@ var GuardianAgent = class {
|
|
|
1672
1675
|
}
|
|
1673
1676
|
if (issues.length >= 5 && this.canCreateInsight("pattern-discovery")) {
|
|
1674
1677
|
try {
|
|
1675
|
-
const { IncidentIndex } = await import("./incident-index-
|
|
1678
|
+
const { IncidentIndex } = await import("./incident-index-BWW2UEY7.js");
|
|
1676
1679
|
const { TriePatternDiscovery } = await import("./pattern-discovery-F7LU5K6E.js");
|
|
1677
|
-
const { ContextGraph: ContextGraph2 } = await import("./graph-
|
|
1680
|
+
const { ContextGraph: ContextGraph2 } = await import("./graph-X2FMRQLG.js");
|
|
1678
1681
|
const graph = new ContextGraph2(this.projectPath);
|
|
1679
1682
|
const incidentIndex = await IncidentIndex.build(graph, this.projectPath);
|
|
1680
1683
|
const discovery = new TriePatternDiscovery(graph, incidentIndex);
|
|
@@ -1725,7 +1728,7 @@ var GuardianAgent = class {
|
|
|
1725
1728
|
if (crossProjectPattern) {
|
|
1726
1729
|
const insight = this.createInsight({
|
|
1727
1730
|
type: "suggestion",
|
|
1728
|
-
message: `"${crossProjectPattern.description
|
|
1731
|
+
message: `"${crossProjectPattern.description}" appears in ${crossProjectPattern.projects.length} projects. Consider a shared lint rule.`,
|
|
1729
1732
|
priority: 4,
|
|
1730
1733
|
category: "pattern"
|
|
1731
1734
|
});
|
|
@@ -1782,7 +1785,7 @@ var GuardianAgent = class {
|
|
|
1782
1785
|
await this.goalManager.autoGenerateGoals();
|
|
1783
1786
|
}
|
|
1784
1787
|
await this.goalManager.updateGoalProgress();
|
|
1785
|
-
const goals = this.
|
|
1788
|
+
const goals = this.projectState.getAllGoals();
|
|
1786
1789
|
for (const goal of goals.filter((g) => g.status === "active")) {
|
|
1787
1790
|
const startVal = goal.startValue ?? goal.currentValue;
|
|
1788
1791
|
if (startVal > 0 && goal.currentValue <= startVal) {
|
|
@@ -1831,7 +1834,13 @@ var GuardianAgent = class {
|
|
|
1831
1834
|
await this.markInsightCreated("risk-prediction");
|
|
1832
1835
|
}
|
|
1833
1836
|
}
|
|
1837
|
+
} catch {
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
if (context.filesChanged && context.filesChanged.length > 0) {
|
|
1841
|
+
try {
|
|
1834
1842
|
const gotchas = await this.gotchaPredictor.predictGotchas(context.filesChanged);
|
|
1843
|
+
const storage = getStorage(this.projectPath);
|
|
1835
1844
|
for (const gotcha of gotchas) {
|
|
1836
1845
|
if (this.canCreateInsight(`gotcha-${gotcha.id}`)) {
|
|
1837
1846
|
const explanation = await this.gotchaPredictor.synthesizeGotchaExplanation(gotcha);
|
|
@@ -1851,13 +1860,28 @@ var GuardianAgent = class {
|
|
|
1851
1860
|
await this.addInsight(insight);
|
|
1852
1861
|
await this.markInsightCreated(`gotcha-${gotcha.id}`);
|
|
1853
1862
|
}
|
|
1863
|
+
const primaryFile = context.filesChanged?.[0];
|
|
1864
|
+
const ledgerGotcha = {
|
|
1865
|
+
id: gotcha.id,
|
|
1866
|
+
message: gotcha.message,
|
|
1867
|
+
confidence: gotcha.confidence,
|
|
1868
|
+
riskLevel: gotcha.riskLevel,
|
|
1869
|
+
recommendation: gotcha.recommendation,
|
|
1870
|
+
...primaryFile && { file: primaryFile },
|
|
1871
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1872
|
+
...gotcha.precedentId && { precedentId: gotcha.precedentId },
|
|
1873
|
+
tags: gotcha.evidence.matchingPatterns,
|
|
1874
|
+
evidence: gotcha.evidence,
|
|
1875
|
+
resolved: false
|
|
1876
|
+
};
|
|
1877
|
+
await storage.storeGotcha(ledgerGotcha);
|
|
1854
1878
|
}
|
|
1855
1879
|
} catch {
|
|
1856
1880
|
}
|
|
1857
1881
|
}
|
|
1858
1882
|
if (this.canCreateInsight("hypothesis-update")) {
|
|
1859
1883
|
try {
|
|
1860
|
-
const hypotheses = this.
|
|
1884
|
+
const hypotheses = this.projectState.getAllHypotheses();
|
|
1861
1885
|
const testingHypotheses = hypotheses.filter((h) => h.status === "testing");
|
|
1862
1886
|
if (testingHypotheses.length < 3) {
|
|
1863
1887
|
await this.hypothesisEngine.autoGenerateHypotheses();
|
|
@@ -1907,12 +1931,12 @@ var GuardianAgent = class {
|
|
|
1907
1931
|
}
|
|
1908
1932
|
}
|
|
1909
1933
|
this.lastIssueHashes = currentHashes;
|
|
1910
|
-
await this.
|
|
1934
|
+
await this.projectState.recordScan();
|
|
1911
1935
|
try {
|
|
1912
1936
|
const riskLevel = issues.filter((i) => i.severity === "critical").length > 0 ? "critical" : issues.filter((i) => i.severity === "serious").length >= 3 ? "high" : issues.length > 10 ? "medium" : "low";
|
|
1913
|
-
const { calculateAdaptiveScanFrequency } = await import("./goal-manager-
|
|
1937
|
+
const { calculateAdaptiveScanFrequency } = await import("./goal-manager-6BJQ36AH.js");
|
|
1914
1938
|
const result = await calculateAdaptiveScanFrequency(riskLevel);
|
|
1915
|
-
await this.
|
|
1939
|
+
await this.projectState.setScanFrequency(result.frequencyMs);
|
|
1916
1940
|
} catch {
|
|
1917
1941
|
}
|
|
1918
1942
|
return newInsights;
|
|
@@ -1931,7 +1955,7 @@ var GuardianAgent = class {
|
|
|
1931
1955
|
agent: i.agent
|
|
1932
1956
|
}));
|
|
1933
1957
|
const result = await runAIAnalysis({
|
|
1934
|
-
systemPrompt: `You are a helpful code
|
|
1958
|
+
systemPrompt: `You are a helpful code reviewer. Analyze these issues and provide ONE brief, conversational insight.
|
|
1935
1959
|
Be specific and actionable. Speak like a helpful colleague, not a system.
|
|
1936
1960
|
Keep your response under 100 words. Focus on the most important pattern or concern.`,
|
|
1937
1961
|
userPrompt: `New issues found:
|
|
@@ -1957,19 +1981,17 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
1957
1981
|
}
|
|
1958
1982
|
/**
|
|
1959
1983
|
* Get active insights (not dismissed, still relevant)
|
|
1960
|
-
* Now uses persistent storage (Phase 1 Guardian Agency)
|
|
1961
1984
|
*/
|
|
1962
1985
|
getActiveInsights() {
|
|
1963
1986
|
return this.insightStore.getActiveInsights();
|
|
1964
1987
|
}
|
|
1965
1988
|
/**
|
|
1966
1989
|
* Dismiss an insight
|
|
1967
|
-
* Now persists to disk (Phase 1 Guardian Agency)
|
|
1968
1990
|
*/
|
|
1969
1991
|
async dismissInsight(insightId) {
|
|
1970
1992
|
const result = await this.insightStore.dismissInsight(insightId);
|
|
1971
1993
|
if (result) {
|
|
1972
|
-
await this.
|
|
1994
|
+
await this.projectState.recordInsightFeedback("dismissed");
|
|
1973
1995
|
}
|
|
1974
1996
|
return result;
|
|
1975
1997
|
}
|
|
@@ -1977,13 +1999,13 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
1977
1999
|
* Record that a user found an insight helpful
|
|
1978
2000
|
*/
|
|
1979
2001
|
async markInsightHelpful(_insightId) {
|
|
1980
|
-
await this.
|
|
2002
|
+
await this.projectState.recordInsightFeedback("helpful");
|
|
1981
2003
|
}
|
|
1982
2004
|
/**
|
|
1983
2005
|
* Record that a user acted on an insight
|
|
1984
2006
|
*/
|
|
1985
2007
|
async markInsightActedOn(_insightId) {
|
|
1986
|
-
await this.
|
|
2008
|
+
await this.projectState.recordInsightFeedback("acted");
|
|
1987
2009
|
}
|
|
1988
2010
|
/**
|
|
1989
2011
|
* Get insight statistics
|
|
@@ -1995,19 +2017,19 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
1995
2017
|
* Get agent metrics (for dashboard display)
|
|
1996
2018
|
*/
|
|
1997
2019
|
getAgentMetrics() {
|
|
1998
|
-
return this.
|
|
2020
|
+
return this.projectState.getMetrics();
|
|
1999
2021
|
}
|
|
2000
2022
|
/**
|
|
2001
2023
|
* Check if in quiet hours
|
|
2002
2024
|
*/
|
|
2003
2025
|
isQuietHours() {
|
|
2004
|
-
return this.
|
|
2026
|
+
return this.projectState.isQuietHours();
|
|
2005
2027
|
}
|
|
2006
2028
|
/**
|
|
2007
2029
|
* Check if in crunch mode
|
|
2008
2030
|
*/
|
|
2009
2031
|
isInCrunchMode() {
|
|
2010
|
-
return this.
|
|
2032
|
+
return this.projectState.isInCrunchMode();
|
|
2011
2033
|
}
|
|
2012
2034
|
/**
|
|
2013
2035
|
* Get the insight store (for advanced operations)
|
|
@@ -2016,10 +2038,10 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
2016
2038
|
return this.insightStore;
|
|
2017
2039
|
}
|
|
2018
2040
|
/**
|
|
2019
|
-
* Get the
|
|
2041
|
+
* Get the project state (for advanced operations)
|
|
2020
2042
|
*/
|
|
2021
|
-
|
|
2022
|
-
return this.
|
|
2043
|
+
getProjectState() {
|
|
2044
|
+
return this.projectState;
|
|
2023
2045
|
}
|
|
2024
2046
|
/**
|
|
2025
2047
|
* Get agency modules (for watch mode integration)
|
|
@@ -2043,14 +2065,14 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
2043
2065
|
* Get a rich agency status for display in watch mode
|
|
2044
2066
|
*/
|
|
2045
2067
|
async getAgencyStatus() {
|
|
2046
|
-
const goals = this.
|
|
2068
|
+
const goals = this.projectState.getAllGoals();
|
|
2047
2069
|
const activeGoals = goals.filter((g) => g.status === "active");
|
|
2048
2070
|
const completedGoals = goals.filter((g) => g.status === "achieved");
|
|
2049
|
-
const hypotheses = this.
|
|
2071
|
+
const hypotheses = this.projectState.getAllHypotheses();
|
|
2050
2072
|
const testingHypotheses = hypotheses.filter((h) => h.status === "testing");
|
|
2051
2073
|
const validatedHypotheses = hypotheses.filter((h) => h.status === "validated");
|
|
2052
|
-
const metrics = this.
|
|
2053
|
-
const budget = this.
|
|
2074
|
+
const metrics = this.projectState.getMetrics();
|
|
2075
|
+
const budget = this.projectState.getRiskBudget();
|
|
2054
2076
|
const dailyActionsRemaining = budget.daily - budget.usedToday;
|
|
2055
2077
|
let riskLevel = "low";
|
|
2056
2078
|
if (dailyActionsRemaining <= 1) riskLevel = "critical";
|
|
@@ -2070,9 +2092,9 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
2070
2092
|
validated: validatedHypotheses.length
|
|
2071
2093
|
},
|
|
2072
2094
|
riskLevel,
|
|
2073
|
-
scanFrequency: this.
|
|
2095
|
+
scanFrequency: this.projectState.getScanFrequencyMs(),
|
|
2074
2096
|
effectiveness,
|
|
2075
|
-
isQuietHours: this.
|
|
2097
|
+
isQuietHours: this.projectState.isQuietHours()
|
|
2076
2098
|
};
|
|
2077
2099
|
if (topGoal) result.goals.topGoal = topGoal;
|
|
2078
2100
|
if (topHypothesis) result.hypotheses.topHypothesis = topHypothesis;
|
|
@@ -2104,14 +2126,12 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
2104
2126
|
}
|
|
2105
2127
|
/**
|
|
2106
2128
|
* Check if we should create an insight of this type (cooldown not expired)
|
|
2107
|
-
* Now uses persistent storage (Phase 1 Guardian Agency)
|
|
2108
2129
|
*/
|
|
2109
2130
|
canCreateInsight(insightKey) {
|
|
2110
2131
|
return this.insightStore.canCreateInsight(insightKey);
|
|
2111
2132
|
}
|
|
2112
2133
|
/**
|
|
2113
2134
|
* Mark that we created an insight of this type
|
|
2114
|
-
* Now persists to disk (Phase 1 Guardian Agency)
|
|
2115
2135
|
*/
|
|
2116
2136
|
async markInsightCreated(insightKey) {
|
|
2117
2137
|
await this.insightStore.markInsightCreated(insightKey);
|
|
@@ -2129,18 +2149,18 @@ What's the most important thing the developer should know? Provide a brief, conv
|
|
|
2129
2149
|
return arr[Math.floor(Math.random() * arr.length)];
|
|
2130
2150
|
}
|
|
2131
2151
|
};
|
|
2132
|
-
var
|
|
2133
|
-
function
|
|
2134
|
-
let
|
|
2135
|
-
if (!
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
}
|
|
2139
|
-
return
|
|
2152
|
+
var agentInstances = /* @__PURE__ */ new Map();
|
|
2153
|
+
function getTrieAgent(projectPath) {
|
|
2154
|
+
let agent = agentInstances.get(projectPath);
|
|
2155
|
+
if (!agent) {
|
|
2156
|
+
agent = new TrieAgent(projectPath);
|
|
2157
|
+
agentInstances.set(projectPath, agent);
|
|
2158
|
+
}
|
|
2159
|
+
return agent;
|
|
2140
2160
|
}
|
|
2141
2161
|
|
|
2142
2162
|
export {
|
|
2143
|
-
|
|
2144
|
-
|
|
2163
|
+
TrieAgent,
|
|
2164
|
+
getTrieAgent
|
|
2145
2165
|
};
|
|
2146
|
-
//# sourceMappingURL=chunk-
|
|
2166
|
+
//# sourceMappingURL=chunk-YOKQ25IW.js.map
|