@triedotdev/mcp 1.0.145 → 1.0.147

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.
@@ -3,7 +3,7 @@ import {
3
3
  InteractiveDashboard,
4
4
  StreamingManager,
5
5
  TrieScanTool
6
- } from "../chunk-JTGKHPDR.js";
6
+ } from "../chunk-2354SRJM.js";
7
7
  import "../chunk-23RJT5WT.js";
8
8
  import "../chunk-N2EDZTKG.js";
9
9
  import "../chunk-TIMIKBY2.js";
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  getPrompt,
49
49
  getSystemPrompt,
50
50
  handleCheckpointTool
51
- } from "./chunk-JTGKHPDR.js";
51
+ } from "./chunk-2354SRJM.js";
52
52
  import "./chunk-23RJT5WT.js";
53
53
  import "./chunk-N2EDZTKG.js";
54
54
  import {
@@ -940,6 +940,49 @@ var TrieWatchTool = class _TrieWatchTool {
940
940
  } catch (error) {
941
941
  console.error("[Watch] Failed to load nudges from storage:", error);
942
942
  }
943
+ try {
944
+ const graph = new ContextGraph(directory);
945
+ const allNodes = await graph.listNodes();
946
+ const unresolvedIncidents = allNodes.filter(
947
+ (n) => n.type === "incident" && !n.data.resolved
948
+ );
949
+ console.debug(`[Watch] Found ${unresolvedIncidents.length} unresolved incidents in context graph`);
950
+ for (const incident of unresolvedIncidents) {
951
+ const incidentData = incident.data;
952
+ let mappedSeverity = "high";
953
+ if (incidentData.severity === "critical") {
954
+ mappedSeverity = "critical";
955
+ } else if (incidentData.severity === "major") {
956
+ mappedSeverity = "critical";
957
+ } else if (incidentData.severity === "minor") {
958
+ mappedSeverity = "high";
959
+ }
960
+ const edges = await graph.getEdges(incident.id);
961
+ const linkedFiles = edges.filter((e) => e.type === "causedBy" || e.type === "affects").map((e) => {
962
+ const node = allNodes.find((n) => n.id === e.to_id || n.id === e.from_id);
963
+ if (node?.type === "file") {
964
+ return node.data.path;
965
+ }
966
+ return null;
967
+ }).filter((f) => f !== null);
968
+ const file = linkedFiles[0] || "unknown";
969
+ const message = `INCIDENT: ${incidentData.description}`;
970
+ this.state.nudges.push({
971
+ file,
972
+ message,
973
+ severity: mappedSeverity,
974
+ timestamp: new Date(incidentData.timestamp).toLocaleTimeString("en-US", { hour12: false })
975
+ });
976
+ console.debug(`[Watch] Loaded incident: ${incidentData.description.slice(0, 60)}... (${incidentData.severity} -> ${mappedSeverity})`);
977
+ }
978
+ if (unresolvedIncidents.length > 0) {
979
+ console.log(`[Watch] \u2713 Loaded ${unresolvedIncidents.length} unresolved incidents from context graph`);
980
+ } else {
981
+ console.debug(`[Watch] No unresolved incidents found in context graph`);
982
+ }
983
+ } catch (error) {
984
+ console.error("[Watch] Failed to load incidents from context graph:", error);
985
+ }
943
986
  if (!isInteractiveMode()) {
944
987
  console.error("\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
945
988
  console.error("TRIE AGENT - NOW WATCHING");
@@ -963,6 +1006,7 @@ var TrieWatchTool = class _TrieWatchTool {
963
1006
  getOutputManager().setMode("console");
964
1007
  }
965
1008
  await this.watchDirectory(directory, debounceMs);
1009
+ await this.watchContextGraph(directory);
966
1010
  if (this.streamingManager) {
967
1011
  this.streamingManager.reportWatchStatus({
968
1012
  watching: true,
@@ -1052,6 +1096,73 @@ Your Trie agent is now autonomously watching and learning from your codebase.
1052
1096
  } catch {
1053
1097
  }
1054
1098
  }
1099
+ /**
1100
+ * Watch .trie/context.json for incident changes
1101
+ */
1102
+ async watchContextGraph(directory) {
1103
+ const contextPath = join2(getTrieDirectory(directory), "context.json");
1104
+ if (!existsSync2(contextPath)) {
1105
+ console.debug("[Watch] No context.json found, skipping incident watcher");
1106
+ return;
1107
+ }
1108
+ try {
1109
+ const watcher = watch(contextPath, { persistent: true }, async (_eventType, _filename) => {
1110
+ console.debug("[Watch] context.json changed, reloading incidents...");
1111
+ await this.reloadIncidents(directory);
1112
+ });
1113
+ watcher.on("error", (err) => {
1114
+ console.error(`[Watch] Context watcher error: ${err.message}`);
1115
+ watcher.close();
1116
+ });
1117
+ this.watchers.set("context.json", watcher);
1118
+ console.debug("[Watch] \u2713 Watching context.json for incident changes");
1119
+ } catch (error) {
1120
+ console.error("[Watch] Failed to set up context.json watcher:", error);
1121
+ }
1122
+ }
1123
+ /**
1124
+ * Reload incidents from context graph
1125
+ */
1126
+ async reloadIncidents(directory) {
1127
+ try {
1128
+ const graph = new ContextGraph(directory);
1129
+ const allNodes = await graph.listNodes();
1130
+ const unresolvedIncidents = allNodes.filter(
1131
+ (n) => n.type === "incident" && !n.data.resolved
1132
+ );
1133
+ this.state.nudges = this.state.nudges.filter((n) => !n.message.startsWith("INCIDENT:"));
1134
+ for (const incident of unresolvedIncidents) {
1135
+ const incidentData = incident.data;
1136
+ let mappedSeverity = "high";
1137
+ if (incidentData.severity === "critical") {
1138
+ mappedSeverity = "critical";
1139
+ } else if (incidentData.severity === "major") {
1140
+ mappedSeverity = "critical";
1141
+ } else if (incidentData.severity === "minor") {
1142
+ mappedSeverity = "high";
1143
+ }
1144
+ const edges = await graph.getEdges(incident.id);
1145
+ const linkedFiles = edges.filter((e) => e.type === "causedBy" || e.type === "affects").map((e) => {
1146
+ const node = allNodes.find((n) => n.id === e.to_id || n.id === e.from_id);
1147
+ if (node?.type === "file") {
1148
+ return node.data.path;
1149
+ }
1150
+ return null;
1151
+ }).filter((f) => f !== null);
1152
+ const file = linkedFiles[0] || "unknown";
1153
+ const message = `INCIDENT: ${incidentData.description}`;
1154
+ this.state.nudges.push({
1155
+ file,
1156
+ message,
1157
+ severity: mappedSeverity,
1158
+ timestamp: new Date(incidentData.timestamp).toLocaleTimeString("en-US", { hour12: false })
1159
+ });
1160
+ }
1161
+ console.log(`[Watch] \u2713 Reloaded ${unresolvedIncidents.length} unresolved incidents`);
1162
+ } catch (error) {
1163
+ console.error("[Watch] Failed to reload incidents:", error);
1164
+ }
1165
+ }
1055
1166
  async processPendingFiles() {
1056
1167
  if (this.state.pendingFiles.size === 0) return;
1057
1168
  const files = Array.from(this.state.pendingFiles);
@@ -3586,7 +3697,7 @@ var ToolRegistry = class {
3586
3697
  },
3587
3698
  {
3588
3699
  name: "trie_cloud_fix",
3589
- description: "Dispatch issues to Cursor cloud agents for verified, test-passing fixes. The cloud agent runs in an isolated VM, applies the fix, runs tests, screenshots the result, and opens a PR. Use trie_fix action:route first to see which issues qualify.",
3700
+ description: "Dispatch issues to Cursor cloud agents for verified, test-passing fixes. The cloud agent runs in an isolated VM, applies the fix, runs tests, screenshots the result, and opens a PR. CRITICAL: Ad-hoc mode (file+issue+fix) dispatches ONLY that single issue. Use trie_fix action:route first to see which issues qualify.",
3590
3701
  inputSchema: {
3591
3702
  type: "object",
3592
3703
  properties: {
@@ -3598,23 +3709,23 @@ var ToolRegistry = class {
3598
3709
  issueIds: {
3599
3710
  type: "array",
3600
3711
  items: { type: "string" },
3601
- description: "Issue IDs to dispatch (from trie_scan). If omitted, dispatches all cloud-eligible pending issues."
3712
+ description: "Issue IDs to dispatch (from trie_scan). If omitted, dispatches all cloud-eligible pending issues. IGNORED if file+issue+fix are provided (ad-hoc mode)."
3602
3713
  },
3603
3714
  forceCloud: {
3604
3715
  type: "boolean",
3605
- description: "When true, bypass triage and dispatch ALL resolved issues to cloud agents. Use when user explicitly requests cloud fix."
3716
+ description: "When true, bypass triage and dispatch ALL resolved issues to cloud agents. Use when user explicitly requests cloud fix. In ad-hoc mode, this is implied."
3606
3717
  },
3607
3718
  file: {
3608
3719
  type: "string",
3609
- description: "For ad-hoc dispatch: file path (use with issue and fix when no scan issues exist)"
3720
+ description: "For ad-hoc single-incident dispatch: file path. When provided with issue+fix, ONLY this single issue is dispatched (memory issues are ignored)."
3610
3721
  },
3611
3722
  issue: {
3612
3723
  type: "string",
3613
- description: "For ad-hoc dispatch: issue description"
3724
+ description: "For ad-hoc dispatch: issue description (use with file and fix)"
3614
3725
  },
3615
3726
  fix: {
3616
3727
  type: "string",
3617
- description: "For ad-hoc dispatch: suggested fix"
3728
+ description: "For ad-hoc dispatch: suggested fix (use with file and issue)"
3618
3729
  },
3619
3730
  line: { type: "number", description: "For ad-hoc dispatch: line number" },
3620
3731
  severity: { type: "string", description: "For ad-hoc dispatch: severity (critical, serious, moderate, low)" },