@triedotdev/mcp 1.0.44 → 1.0.46

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.
@@ -1,11 +1,15 @@
1
1
  import {
2
- CustomAgent,
2
+ CustomSkill,
3
3
  getAgentRegistry
4
- } from "./chunk-GBGONSOR.js";
4
+ } from "./chunk-R5HWHP5N.js";
5
5
  import {
6
+ getGlobalMemoryStats,
7
+ getHistoricalInsights,
8
+ getMemoryStats,
9
+ getRecentIssues,
6
10
  loadContextState,
7
11
  updateContextAfterScan
8
- } from "./chunk-52SSNKXS.js";
12
+ } from "./chunk-PZDQIFKO.js";
9
13
  import {
10
14
  ProgressReporter
11
15
  } from "./chunk-OB45V2QC.js";
@@ -658,8 +662,9 @@ var RiskAssessor = class {
658
662
  var Triager = class {
659
663
  agentRegistry = getAgentRegistry();
660
664
  config;
661
- customAgentsLoaded = false;
665
+ customSkillsLoaded = false;
662
666
  contextState = null;
667
+ memoryInsights = null;
663
668
  constructor(config) {
664
669
  this.config = {
665
670
  minConfidence: 0.15,
@@ -683,17 +688,67 @@ var Triager = class {
683
688
  }
684
689
  }
685
690
  /**
686
- * Ensure custom agents are loaded before triaging
691
+ * Load memory insights for memory-influenced triaging
687
692
  */
688
- async ensureCustomAgentsLoaded() {
689
- if (!this.customAgentsLoaded) {
690
- await this.agentRegistry.loadCustomAgents();
691
- this.customAgentsLoaded = true;
693
+ async loadMemoryInsights() {
694
+ if (this.memoryInsights !== null) return;
695
+ try {
696
+ const [stats, recent, historical, global] = await Promise.all([
697
+ getMemoryStats().catch(() => null),
698
+ getRecentIssues(20).catch(() => []),
699
+ getHistoricalInsights(process.cwd()).catch(() => null),
700
+ getGlobalMemoryStats().catch(() => null)
701
+ ]);
702
+ const recentAgents = /* @__PURE__ */ new Set();
703
+ for (const issue of recent) {
704
+ recentAgents.add(issue.agent);
705
+ }
706
+ const recurringPatternAgents = /* @__PURE__ */ new Set();
707
+ if (historical?.recurringPatterns) {
708
+ for (const pattern of historical.recurringPatterns) {
709
+ recurringPatternAgents.add(pattern.agent);
710
+ }
711
+ }
712
+ const crossProjectAgents = /* @__PURE__ */ new Set();
713
+ if (global?.patternsByAgent) {
714
+ for (const [agent, count] of Object.entries(global.patternsByAgent)) {
715
+ if (count >= 2) {
716
+ crossProjectAgents.add(agent);
717
+ }
718
+ }
719
+ }
720
+ this.memoryInsights = {
721
+ issuesByAgent: stats?.issuesByAgent || {},
722
+ recentAgents,
723
+ recurringPatternAgents,
724
+ trend: historical?.improvementTrend || "unknown",
725
+ crossProjectAgents
726
+ };
727
+ } catch {
728
+ this.memoryInsights = {
729
+ issuesByAgent: {},
730
+ recentAgents: /* @__PURE__ */ new Set(),
731
+ recurringPatternAgents: /* @__PURE__ */ new Set(),
732
+ trend: "unknown",
733
+ crossProjectAgents: /* @__PURE__ */ new Set()
734
+ };
735
+ }
736
+ }
737
+ /**
738
+ * Ensure custom skills are loaded before triaging
739
+ */
740
+ async ensureCustomSkillsLoaded() {
741
+ if (!this.customSkillsLoaded) {
742
+ await this.agentRegistry.loadCustomSkills();
743
+ this.customSkillsLoaded = true;
692
744
  }
693
745
  }
694
746
  async selectAgents(context, riskLevel) {
695
- await this.ensureCustomAgentsLoaded();
696
- await this.loadPreviousContext();
747
+ await this.ensureCustomSkillsLoaded();
748
+ await Promise.all([
749
+ this.loadPreviousContext(),
750
+ this.loadMemoryInsights()
751
+ ]);
697
752
  let effectiveRiskLevel = riskLevel;
698
753
  if (this.contextState?.healthScore !== void 0 && this.contextState.healthScore < 50) {
699
754
  if (riskLevel === "low" || riskLevel === "medium") {
@@ -707,6 +762,7 @@ var Triager = class {
707
762
  }
708
763
  const scores = this.scoreAgents(context, effectiveRiskLevel);
709
764
  this.boostAgentsWithHistory(scores);
765
+ this.boostAgentsWithMemory(scores);
710
766
  this.logAgentScoring(scores);
711
767
  const qualified = scores.filter((s) => s.confidence >= this.config.minConfidence);
712
768
  qualified.sort((a, b) => {
@@ -732,6 +788,40 @@ var Triager = class {
732
788
  }
733
789
  }
734
790
  }
791
+ /**
792
+ * Boost confidence for agents based on memory patterns
793
+ */
794
+ boostAgentsWithMemory(scores) {
795
+ if (!this.memoryInsights) return;
796
+ for (const score of scores) {
797
+ const agentName = score.agent.name;
798
+ const historicalCount = this.memoryInsights.issuesByAgent[agentName] || 0;
799
+ if (historicalCount >= 10) {
800
+ const boost = Math.min(0.2, historicalCount * 0.01);
801
+ score.confidence = Math.min(1, score.confidence + boost);
802
+ score.reasons.push(`${historicalCount} historical issues`);
803
+ }
804
+ if (this.memoryInsights.recentAgents.has(agentName)) {
805
+ score.confidence = Math.min(1, score.confidence + 0.1);
806
+ score.reasons.push("recent activity");
807
+ }
808
+ if (this.memoryInsights.recurringPatternAgents.has(agentName)) {
809
+ score.confidence = Math.min(1, score.confidence + 0.15);
810
+ score.reasons.push("recurring patterns");
811
+ }
812
+ if (this.memoryInsights.crossProjectAgents.has(agentName)) {
813
+ score.confidence = Math.min(1, score.confidence + 0.1);
814
+ score.reasons.push("cross-project pattern");
815
+ }
816
+ }
817
+ if (this.memoryInsights.trend === "declining") {
818
+ for (const score of scores) {
819
+ if (score.confidence > 0) {
820
+ score.confidence = Math.min(1, score.confidence + 0.05);
821
+ }
822
+ }
823
+ }
824
+ }
735
825
  scoreAgents(context, riskLevel) {
736
826
  const allAgents = this.getAllAgents();
737
827
  const scores = [];
@@ -742,19 +832,19 @@ var Triager = class {
742
832
  return scores;
743
833
  }
744
834
  scoreAgent(agent, context, riskLevel) {
745
- if (agent instanceof CustomAgent) {
746
- return this.scoreCustomAgent(agent, context, riskLevel);
835
+ if (agent instanceof CustomSkill) {
836
+ return this.scoreCustomSkill(agent, context, riskLevel);
747
837
  }
748
838
  return this.scoreBuiltinAgent(agent, context, riskLevel);
749
839
  }
750
840
  /**
751
- * Score custom agents using their activation rules
841
+ * Score custom skills using their activation rules
752
842
  */
753
- scoreCustomAgent(agent, context, riskLevel) {
843
+ scoreCustomSkill(agent, context, riskLevel) {
754
844
  const reasons = [];
755
845
  let confidence = agent.getActivationConfidence(context);
756
846
  if (confidence > 0) {
757
- reasons.push(`custom agent: ${agent.getMetadata().category}`);
847
+ reasons.push(`custom skill: ${agent.getMetadata().category}`);
758
848
  const meta = agent.getMetadata();
759
849
  if (meta.patternCount > 0) {
760
850
  reasons.push(`${meta.patternCount} detection patterns`);
@@ -1169,13 +1259,13 @@ var Triager = class {
1169
1259
  return `${riskLevel} risk: ${reasons.join(", ")}`;
1170
1260
  }
1171
1261
  async getSkippedAgents(context, riskLevel) {
1172
- await this.ensureCustomAgentsLoaded();
1262
+ await this.ensureCustomSkillsLoaded();
1173
1263
  if (riskLevel === "critical") return [];
1174
1264
  const scores = this.scoreAgents(context, riskLevel);
1175
1265
  return scores.filter((s) => s.confidence < this.config.minConfidence).map((s) => s.agent.name);
1176
1266
  }
1177
1267
  async getTriagingConfidence(context, riskLevel) {
1178
- await this.ensureCustomAgentsLoaded();
1268
+ await this.ensureCustomSkillsLoaded();
1179
1269
  const scores = this.scoreAgents(context, riskLevel);
1180
1270
  const qualified = scores.filter((s) => s.confidence >= this.config.minConfidence);
1181
1271
  if (qualified.length === 0) return 0.5;
@@ -1207,16 +1297,24 @@ var Triager = class {
1207
1297
  return this.agentRegistry.getAllAgents();
1208
1298
  }
1209
1299
  /**
1210
- * Get custom agents count
1300
+ * Get custom skills count
1211
1301
  */
1302
+ getCustomSkillCount() {
1303
+ return this.agentRegistry.getCustomSkills().length;
1304
+ }
1305
+ // Backward compatibility alias
1212
1306
  getCustomAgentCount() {
1213
- return this.agentRegistry.getCustomAgents().length;
1307
+ return this.getCustomSkillCount();
1214
1308
  }
1215
1309
  /**
1216
- * Reload custom agents
1310
+ * Reload custom skills
1217
1311
  */
1312
+ async reloadCustomSkills() {
1313
+ await this.agentRegistry.reloadCustomSkills();
1314
+ }
1315
+ // Backward compatibility alias
1218
1316
  async reloadCustomAgents() {
1219
- await this.agentRegistry.reloadCustomAgents();
1317
+ return this.reloadCustomSkills();
1220
1318
  }
1221
1319
  };
1222
1320
 
@@ -5840,14 +5938,14 @@ var TrieScanTool = class {
5840
5938
  agentRegistry = getAgentRegistry();
5841
5939
  incrementalScanner = null;
5842
5940
  progress = new ProgressReporter();
5843
- customAgentsLoaded = false;
5941
+ customSkillsLoaded = false;
5844
5942
  /**
5845
- * Ensure custom agents are loaded before using the registry
5943
+ * Ensure custom skills are loaded before using the registry
5846
5944
  */
5847
- async ensureCustomAgentsLoaded() {
5848
- if (!this.customAgentsLoaded) {
5849
- await this.agentRegistry.loadCustomAgents();
5850
- this.customAgentsLoaded = true;
5945
+ async ensureCustomSkillsLoaded() {
5946
+ if (!this.customSkillsLoaded) {
5947
+ await this.agentRegistry.loadCustomSkills();
5948
+ this.customSkillsLoaded = true;
5851
5949
  }
5852
5950
  }
5853
5951
  async execute(args) {
@@ -5948,7 +6046,7 @@ var TrieScanTool = class {
5948
6046
  const riskLevel = this.riskAssessor.assessRisk(context);
5949
6047
  this.logRiskAssessment(context, riskLevel);
5950
6048
  this.progress.startPhase("ai-review", "Selecting AI agents...");
5951
- await this.ensureCustomAgentsLoaded();
6049
+ await this.ensureCustomSkillsLoaded();
5952
6050
  let selectedAgents = forceAgents ? this.agentRegistry.getAgentsByNames(forceAgents) : await this.triager.selectAgents(context, riskLevel);
5953
6051
  if (excludeAgents.size > 0) {
5954
6052
  const before = selectedAgents.length;
@@ -6560,4 +6658,4 @@ export {
6560
6658
  loadConfig,
6561
6659
  TrieScanTool
6562
6660
  };
6563
- //# sourceMappingURL=chunk-2I6CFJTR.js.map
6661
+ //# sourceMappingURL=chunk-5AS3BWAZ.js.map