@triedotdev/mcp 1.0.115 → 1.0.116

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.
Files changed (65) hide show
  1. package/dist/{autonomy-config-JXB7WCZ2.js → autonomy-config-QA6ATWLJ.js} +3 -3
  2. package/dist/{chunk-ZYKEILVK.js → chunk-2764RZVV.js} +305 -86
  3. package/dist/chunk-2764RZVV.js.map +1 -0
  4. package/dist/{chunk-R4AAPFXC.js → chunk-45Y5TLQZ.js} +2 -2
  5. package/dist/{chunk-R4AAPFXC.js.map → chunk-45Y5TLQZ.js.map} +1 -1
  6. package/dist/{chunk-KRH642MT.js → chunk-4BGAVEO6.js} +2 -2
  7. package/dist/{chunk-NS2MSZMB.js → chunk-55CBWOEZ.js} +2 -2
  8. package/dist/{chunk-YR4BMGYO.js → chunk-7Q6I2CB4.js} +2 -2
  9. package/dist/{chunk-TKMV7JKN.js → chunk-DFHMB44X.js} +2 -2
  10. package/dist/{chunk-D3EXBJE2.js → chunk-FNW7Z7ZS.js} +5 -5
  11. package/dist/{chunk-DZREHOGW.js → chunk-I7XKF5XD.js} +5 -5
  12. package/dist/{chunk-2SIFK7OW.js → chunk-IQBHPTV7.js} +4 -4
  13. package/dist/{chunk-AOFYU6T3.js → chunk-OMCEUJ5I.js} +12 -12
  14. package/dist/{chunk-55DOQNHJ.js → chunk-PRFHN2X6.js} +4 -4
  15. package/dist/{chunk-MVNJPJBK.js → chunk-SRQ4DNOP.js} +5 -5
  16. package/dist/{chunk-2GIAROBF.js → chunk-WHIQAGB7.js} +2 -2
  17. package/dist/{chunk-SWSK7ANT.js → chunk-WRGSH5RT.js} +2 -2
  18. package/dist/{chunk-6LXSA2OZ.js → chunk-Y52SNUW5.js} +3 -3
  19. package/dist/{chunk-I2GFI3AM.js → chunk-ZEXMMTIQ.js} +2 -2
  20. package/dist/cli/create-agent.js +1 -1
  21. package/dist/cli/main.js +66 -32
  22. package/dist/cli/main.js.map +1 -1
  23. package/dist/cli/yolo-daemon.js +14 -14
  24. package/dist/{client-7XZHCMD3.js → client-PMKE26IV.js} +3 -3
  25. package/dist/{goal-manager-LMS6ZJB7.js → goal-manager-JKTNFJQE.js} +7 -7
  26. package/dist/goal-validator-YSNN23D4.js +62 -0
  27. package/dist/goal-validator-YSNN23D4.js.map +1 -0
  28. package/dist/{graph-U5JWSAB5.js → graph-PAUZ5EMP.js} +3 -3
  29. package/dist/guardian-agent-UY2G56FT.js +25 -0
  30. package/dist/{hypothesis-KGC3P54C.js → hypothesis-RUCJ74X7.js} +7 -7
  31. package/dist/{incident-index-PNIVT47T.js → incident-index-ZCDSJ42L.js} +3 -3
  32. package/dist/index.js +65 -128
  33. package/dist/index.js.map +1 -1
  34. package/dist/{ledger-SR6OEBLO.js → ledger-JMPGJGLB.js} +3 -3
  35. package/package.json +1 -1
  36. package/dist/auto-fix-apply-PCAHWLXF.js +0 -10
  37. package/dist/chunk-DJ2YAGHK.js +0 -50
  38. package/dist/chunk-DJ2YAGHK.js.map +0 -1
  39. package/dist/chunk-ZYKEILVK.js.map +0 -1
  40. package/dist/goal-validator-T5HEYBC5.js +0 -186
  41. package/dist/goal-validator-T5HEYBC5.js.map +0 -1
  42. package/dist/guardian-agent-EXP7APLC.js +0 -25
  43. package/dist/ledger-SR6OEBLO.js.map +0 -1
  44. /package/dist/{auto-fix-apply-PCAHWLXF.js.map → autonomy-config-QA6ATWLJ.js.map} +0 -0
  45. /package/dist/{chunk-KRH642MT.js.map → chunk-4BGAVEO6.js.map} +0 -0
  46. /package/dist/{chunk-NS2MSZMB.js.map → chunk-55CBWOEZ.js.map} +0 -0
  47. /package/dist/{chunk-YR4BMGYO.js.map → chunk-7Q6I2CB4.js.map} +0 -0
  48. /package/dist/{chunk-TKMV7JKN.js.map → chunk-DFHMB44X.js.map} +0 -0
  49. /package/dist/{chunk-D3EXBJE2.js.map → chunk-FNW7Z7ZS.js.map} +0 -0
  50. /package/dist/{chunk-DZREHOGW.js.map → chunk-I7XKF5XD.js.map} +0 -0
  51. /package/dist/{chunk-2SIFK7OW.js.map → chunk-IQBHPTV7.js.map} +0 -0
  52. /package/dist/{chunk-AOFYU6T3.js.map → chunk-OMCEUJ5I.js.map} +0 -0
  53. /package/dist/{chunk-55DOQNHJ.js.map → chunk-PRFHN2X6.js.map} +0 -0
  54. /package/dist/{chunk-MVNJPJBK.js.map → chunk-SRQ4DNOP.js.map} +0 -0
  55. /package/dist/{chunk-2GIAROBF.js.map → chunk-WHIQAGB7.js.map} +0 -0
  56. /package/dist/{chunk-SWSK7ANT.js.map → chunk-WRGSH5RT.js.map} +0 -0
  57. /package/dist/{chunk-6LXSA2OZ.js.map → chunk-Y52SNUW5.js.map} +0 -0
  58. /package/dist/{chunk-I2GFI3AM.js.map → chunk-ZEXMMTIQ.js.map} +0 -0
  59. /package/dist/{autonomy-config-JXB7WCZ2.js.map → client-PMKE26IV.js.map} +0 -0
  60. /package/dist/{client-7XZHCMD3.js.map → goal-manager-JKTNFJQE.js.map} +0 -0
  61. /package/dist/{goal-manager-LMS6ZJB7.js.map → graph-PAUZ5EMP.js.map} +0 -0
  62. /package/dist/{graph-U5JWSAB5.js.map → guardian-agent-UY2G56FT.js.map} +0 -0
  63. /package/dist/{guardian-agent-EXP7APLC.js.map → hypothesis-RUCJ74X7.js.map} +0 -0
  64. /package/dist/{hypothesis-KGC3P54C.js.map → incident-index-ZCDSJ42L.js.map} +0 -0
  65. /package/dist/{incident-index-PNIVT47T.js.map → ledger-JMPGJGLB.js.map} +0 -0
@@ -3,30 +3,30 @@ import {
3
3
  InteractiveDashboard,
4
4
  StreamingManager,
5
5
  TrieScanTool
6
- } from "../chunk-ZYKEILVK.js";
7
- import "../chunk-AOFYU6T3.js";
8
- import "../chunk-2SIFK7OW.js";
9
- import "../chunk-DZREHOGW.js";
10
- import "../chunk-6LXSA2OZ.js";
6
+ } from "../chunk-2764RZVV.js";
7
+ import "../chunk-OMCEUJ5I.js";
8
+ import "../chunk-IQBHPTV7.js";
9
+ import "../chunk-I7XKF5XD.js";
10
+ import "../chunk-Y52SNUW5.js";
11
11
  import {
12
12
  isTrieInitialized
13
- } from "../chunk-MVNJPJBK.js";
14
- import "../chunk-D3EXBJE2.js";
15
- import "../chunk-SWSK7ANT.js";
16
- import "../chunk-55DOQNHJ.js";
17
- import "../chunk-KRH642MT.js";
13
+ } from "../chunk-SRQ4DNOP.js";
14
+ import "../chunk-FNW7Z7ZS.js";
15
+ import "../chunk-WRGSH5RT.js";
16
+ import "../chunk-PRFHN2X6.js";
17
+ import "../chunk-4BGAVEO6.js";
18
18
  import "../chunk-F4NJ4CBP.js";
19
19
  import "../chunk-IXO4G4D3.js";
20
- import "../chunk-NS2MSZMB.js";
21
- import "../chunk-2GIAROBF.js";
20
+ import "../chunk-55CBWOEZ.js";
21
+ import "../chunk-WHIQAGB7.js";
22
22
  import "../chunk-6NLHFIYA.js";
23
23
  import "../chunk-ZV2K6M7T.js";
24
24
  import "../chunk-VRLMTOB6.js";
25
- import "../chunk-YR4BMGYO.js";
25
+ import "../chunk-7Q6I2CB4.js";
26
26
  import "../chunk-43X6JBEM.js";
27
27
  import {
28
28
  getWorkingDirectory
29
- } from "../chunk-R4AAPFXC.js";
29
+ } from "../chunk-45Y5TLQZ.js";
30
30
  import {
31
31
  isInteractiveMode,
32
32
  setInteractiveMode
@@ -9,8 +9,8 @@ import {
9
9
  saveKeyToKeychain,
10
10
  setAPIKey,
11
11
  tryGetClient
12
- } from "./chunk-SWSK7ANT.js";
13
- import "./chunk-R4AAPFXC.js";
12
+ } from "./chunk-WRGSH5RT.js";
13
+ import "./chunk-45Y5TLQZ.js";
14
14
  import "./chunk-APMV77PU.js";
15
15
  import "./chunk-DGUM43GV.js";
16
16
  export {
@@ -25,4 +25,4 @@ export {
25
25
  setAPIKey,
26
26
  tryGetClient
27
27
  };
28
- //# sourceMappingURL=client-7XZHCMD3.js.map
28
+ //# sourceMappingURL=client-PMKE26IV.js.map
@@ -4,13 +4,13 @@ import {
4
4
  calculateAdaptiveScanFrequency,
5
5
  clearGoalManagers,
6
6
  getGoalManager
7
- } from "./chunk-2SIFK7OW.js";
8
- import "./chunk-6LXSA2OZ.js";
9
- import "./chunk-55DOQNHJ.js";
10
- import "./chunk-KRH642MT.js";
11
- import "./chunk-YR4BMGYO.js";
7
+ } from "./chunk-IQBHPTV7.js";
8
+ import "./chunk-Y52SNUW5.js";
9
+ import "./chunk-PRFHN2X6.js";
10
+ import "./chunk-4BGAVEO6.js";
11
+ import "./chunk-7Q6I2CB4.js";
12
12
  import "./chunk-43X6JBEM.js";
13
- import "./chunk-R4AAPFXC.js";
13
+ import "./chunk-45Y5TLQZ.js";
14
14
  import "./chunk-APMV77PU.js";
15
15
  import "./chunk-DGUM43GV.js";
16
16
  export {
@@ -20,4 +20,4 @@ export {
20
20
  clearGoalManagers,
21
21
  getGoalManager
22
22
  };
23
- //# sourceMappingURL=goal-manager-LMS6ZJB7.js.map
23
+ //# sourceMappingURL=goal-manager-JKTNFJQE.js.map
@@ -0,0 +1,62 @@
1
+ import {
2
+ getGuardianState
3
+ } from "./chunk-4BGAVEO6.js";
4
+ import "./chunk-43X6JBEM.js";
5
+ import "./chunk-45Y5TLQZ.js";
6
+ import "./chunk-APMV77PU.js";
7
+ import "./chunk-DGUM43GV.js";
8
+
9
+ // src/guardian/goal-validator.ts
10
+ async function getActiveGoals(projectPath) {
11
+ const guardianState = getGuardianState(projectPath);
12
+ await guardianState.load();
13
+ return guardianState.getAllGoals().filter((g) => g.status === "active");
14
+ }
15
+ async function recordGoalViolationCaught(goal, file, projectPath) {
16
+ const guardianState = getGuardianState(projectPath);
17
+ await guardianState.load();
18
+ const metadata = goal.metadata || {};
19
+ const caughtCount = (metadata.caughtCount || 0) + 1;
20
+ await guardianState.updateGoal(goal.id, {
21
+ metadata: {
22
+ ...metadata,
23
+ caughtCount,
24
+ lastCaught: (/* @__PURE__ */ new Date()).toISOString(),
25
+ lastCaughtFile: file
26
+ }
27
+ });
28
+ }
29
+ async function recordGoalViolationFixed(goal, file, projectPath) {
30
+ const guardianState = getGuardianState(projectPath);
31
+ await guardianState.load();
32
+ const metadata = goal.metadata || {};
33
+ const caughtCount = (metadata.caughtCount || 0) + 1;
34
+ const fixedCount = (metadata.fixedCount || 0) + 1;
35
+ await guardianState.updateGoal(goal.id, {
36
+ metadata: {
37
+ ...metadata,
38
+ caughtCount,
39
+ fixedCount,
40
+ lastFixed: (/* @__PURE__ */ new Date()).toISOString(),
41
+ lastFixedFile: file
42
+ }
43
+ });
44
+ if (goal.type === "reduction") {
45
+ const newValue = Math.max(0, goal.currentValue - 1);
46
+ await guardianState.updateGoal(goal.id, {
47
+ currentValue: newValue
48
+ });
49
+ if (newValue <= goal.target) {
50
+ await guardianState.updateGoal(goal.id, {
51
+ status: "achieved",
52
+ achievedAt: (/* @__PURE__ */ new Date()).toISOString()
53
+ });
54
+ }
55
+ }
56
+ }
57
+ export {
58
+ getActiveGoals,
59
+ recordGoalViolationCaught,
60
+ recordGoalViolationFixed
61
+ };
62
+ //# sourceMappingURL=goal-validator-YSNN23D4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/guardian/goal-validator.ts"],"sourcesContent":["/**\n * Goal Validator - Helpers for goal tracking\n * \n * Goal detection is handled entirely by the AI watcher in watch.ts.\n * The AI (Anthropic) checks every changed file against user-defined goals,\n * using the Trie's priority scoring for cost control.\n * \n * This module provides:\n * - getActiveGoals: loads active goals for the AI prompt\n * - recordGoalViolationCaught: tracks when a violation is detected\n * - recordGoalViolationFixed: tracks when a violation is auto-fixed\n */\n\nimport type { Goal } from './guardian-state.js';\nimport { getGuardianState } from './guardian-state.js';\n\n/**\n * Get active goals for a project (used by the AI watcher)\n */\nexport async function getActiveGoals(projectPath: string): Promise<Goal[]> {\n const guardianState = getGuardianState(projectPath);\n await guardianState.load();\n return guardianState.getAllGoals().filter(g => g.status === 'active');\n}\n\nexport async function recordGoalViolationCaught(\n goal: Goal,\n file: string,\n projectPath: string\n): Promise<void> {\n const guardianState = getGuardianState(projectPath);\n await guardianState.load();\n \n const metadata = goal.metadata || {};\n const caughtCount = (metadata.caughtCount || 0) + 1;\n \n await guardianState.updateGoal(goal.id, {\n metadata: {\n ...metadata,\n caughtCount,\n lastCaught: new Date().toISOString(),\n lastCaughtFile: file,\n },\n });\n}\n\nexport async function recordGoalViolationFixed(\n goal: Goal,\n file: string,\n projectPath: string\n): Promise<void> {\n const guardianState = getGuardianState(projectPath);\n await guardianState.load();\n \n const metadata = goal.metadata || {};\n const caughtCount = (metadata.caughtCount || 0) + 1;\n const fixedCount = (metadata.fixedCount || 0) + 1;\n \n await guardianState.updateGoal(goal.id, {\n metadata: {\n ...metadata,\n caughtCount,\n fixedCount,\n lastFixed: new Date().toISOString(),\n lastFixedFile: file,\n },\n });\n \n if (goal.type === 'reduction') {\n const newValue = Math.max(0, goal.currentValue - 1);\n await guardianState.updateGoal(goal.id, {\n currentValue: newValue,\n });\n \n if (newValue <= goal.target) {\n await guardianState.updateGoal(goal.id, {\n status: 'achieved',\n achievedAt: new Date().toISOString(),\n });\n }\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,eAAsB,eAAe,aAAsC;AACzE,QAAM,gBAAgB,iBAAiB,WAAW;AAClD,QAAM,cAAc,KAAK;AACzB,SAAO,cAAc,YAAY,EAAE,OAAO,OAAK,EAAE,WAAW,QAAQ;AACtE;AAEA,eAAsB,0BACpB,MACA,MACA,aACe;AACf,QAAM,gBAAgB,iBAAiB,WAAW;AAClD,QAAM,cAAc,KAAK;AAEzB,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,eAAe,SAAS,eAAe,KAAK;AAElD,QAAM,cAAc,WAAW,KAAK,IAAI;AAAA,IACtC,UAAU;AAAA,MACR,GAAG;AAAA,MACH;AAAA,MACA,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACnC,gBAAgB;AAAA,IAClB;AAAA,EACF,CAAC;AACH;AAEA,eAAsB,yBACpB,MACA,MACA,aACe;AACf,QAAM,gBAAgB,iBAAiB,WAAW;AAClD,QAAM,cAAc,KAAK;AAEzB,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,eAAe,SAAS,eAAe,KAAK;AAClD,QAAM,cAAc,SAAS,cAAc,KAAK;AAEhD,QAAM,cAAc,WAAW,KAAK,IAAI;AAAA,IACtC,UAAU;AAAA,MACR,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,MAClC,eAAe;AAAA,IACjB;AAAA,EACF,CAAC;AAED,MAAI,KAAK,SAAS,aAAa;AAC7B,UAAM,WAAW,KAAK,IAAI,GAAG,KAAK,eAAe,CAAC;AAClD,UAAM,cAAc,WAAW,KAAK,IAAI;AAAA,MACtC,cAAc;AAAA,IAChB,CAAC;AAED,QAAI,YAAY,KAAK,QAAQ;AAC3B,YAAM,cAAc,WAAW,KAAK,IAAI;AAAA,QACtC,QAAQ;AAAA,QACR,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACrC,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ContextGraph
3
- } from "./chunk-NS2MSZMB.js";
4
- import "./chunk-R4AAPFXC.js";
3
+ } from "./chunk-55CBWOEZ.js";
4
+ import "./chunk-45Y5TLQZ.js";
5
5
  import "./chunk-APMV77PU.js";
6
6
  import "./chunk-DGUM43GV.js";
7
7
  export {
8
8
  ContextGraph
9
9
  };
10
- //# sourceMappingURL=graph-U5JWSAB5.js.map
10
+ //# sourceMappingURL=graph-PAUZ5EMP.js.map
@@ -0,0 +1,25 @@
1
+ import {
2
+ GuardianAgent,
3
+ getGuardian
4
+ } from "./chunk-OMCEUJ5I.js";
5
+ import "./chunk-IQBHPTV7.js";
6
+ import "./chunk-I7XKF5XD.js";
7
+ import "./chunk-Y52SNUW5.js";
8
+ import "./chunk-FNW7Z7ZS.js";
9
+ import "./chunk-WRGSH5RT.js";
10
+ import "./chunk-PRFHN2X6.js";
11
+ import "./chunk-4BGAVEO6.js";
12
+ import "./chunk-F4NJ4CBP.js";
13
+ import "./chunk-IXO4G4D3.js";
14
+ import "./chunk-55CBWOEZ.js";
15
+ import "./chunk-6NLHFIYA.js";
16
+ import "./chunk-7Q6I2CB4.js";
17
+ import "./chunk-43X6JBEM.js";
18
+ import "./chunk-45Y5TLQZ.js";
19
+ import "./chunk-APMV77PU.js";
20
+ import "./chunk-DGUM43GV.js";
21
+ export {
22
+ GuardianAgent,
23
+ getGuardian
24
+ };
25
+ //# sourceMappingURL=guardian-agent-UY2G56FT.js.map
@@ -2,13 +2,13 @@ import {
2
2
  HypothesisEngine,
3
3
  clearHypothesisEngines,
4
4
  getHypothesisEngine
5
- } from "./chunk-DZREHOGW.js";
6
- import "./chunk-6LXSA2OZ.js";
7
- import "./chunk-55DOQNHJ.js";
8
- import "./chunk-KRH642MT.js";
9
- import "./chunk-YR4BMGYO.js";
5
+ } from "./chunk-I7XKF5XD.js";
6
+ import "./chunk-Y52SNUW5.js";
7
+ import "./chunk-PRFHN2X6.js";
8
+ import "./chunk-4BGAVEO6.js";
9
+ import "./chunk-7Q6I2CB4.js";
10
10
  import "./chunk-43X6JBEM.js";
11
- import "./chunk-R4AAPFXC.js";
11
+ import "./chunk-45Y5TLQZ.js";
12
12
  import "./chunk-APMV77PU.js";
13
13
  import "./chunk-DGUM43GV.js";
14
14
  export {
@@ -16,4 +16,4 @@ export {
16
16
  clearHypothesisEngines,
17
17
  getHypothesisEngine
18
18
  };
19
- //# sourceMappingURL=hypothesis-KGC3P54C.js.map
19
+ //# sourceMappingURL=hypothesis-RUCJ74X7.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  IncidentIndex
3
- } from "./chunk-2GIAROBF.js";
3
+ } from "./chunk-WHIQAGB7.js";
4
4
  import "./chunk-6NLHFIYA.js";
5
- import "./chunk-R4AAPFXC.js";
5
+ import "./chunk-45Y5TLQZ.js";
6
6
  import "./chunk-APMV77PU.js";
7
7
  import "./chunk-DGUM43GV.js";
8
8
  export {
9
9
  IncidentIndex
10
10
  };
11
- //# sourceMappingURL=incident-index-PNIVT47T.js.map
11
+ //# sourceMappingURL=incident-index-ZCDSJ42L.js.map
package/dist/index.js CHANGED
@@ -18,10 +18,10 @@ import {
18
18
  needsBootstrap,
19
19
  projectInfoExists,
20
20
  updateProjectSection
21
- } from "./chunk-TKMV7JKN.js";
21
+ } from "./chunk-DFHMB44X.js";
22
22
  import {
23
23
  getAutonomyConfig
24
- } from "./chunk-I2GFI3AM.js";
24
+ } from "./chunk-ZEXMMTIQ.js";
25
25
  import {
26
26
  ExtractionPipeline,
27
27
  InteractiveDashboard,
@@ -38,28 +38,28 @@ import {
38
38
  getPrompt,
39
39
  getSystemPrompt,
40
40
  handleCheckpointTool
41
- } from "./chunk-ZYKEILVK.js";
42
- import "./chunk-AOFYU6T3.js";
43
- import "./chunk-2SIFK7OW.js";
44
- import "./chunk-DZREHOGW.js";
45
- import "./chunk-6LXSA2OZ.js";
41
+ } from "./chunk-2764RZVV.js";
42
+ import "./chunk-OMCEUJ5I.js";
43
+ import "./chunk-IQBHPTV7.js";
44
+ import "./chunk-I7XKF5XD.js";
45
+ import "./chunk-Y52SNUW5.js";
46
46
  import {
47
47
  exportToJson,
48
48
  formatFriendlyError,
49
49
  importFromJson,
50
50
  isTrieInitialized,
51
51
  runShellCommandSync
52
- } from "./chunk-MVNJPJBK.js";
52
+ } from "./chunk-SRQ4DNOP.js";
53
53
  import {
54
54
  findCrossProjectPatterns,
55
55
  getGlobalMemoryStats,
56
56
  listTrackedProjects,
57
57
  searchGlobalPatterns
58
- } from "./chunk-D3EXBJE2.js";
58
+ } from "./chunk-FNW7Z7ZS.js";
59
59
  import {
60
60
  isAIAvailable,
61
61
  runAIAnalysis
62
- } from "./chunk-SWSK7ANT.js";
62
+ } from "./chunk-WRGSH5RT.js";
63
63
  import {
64
64
  findSimilarIssues,
65
65
  getMemoryStats,
@@ -67,14 +67,14 @@ import {
67
67
  markIssueResolved,
68
68
  purgeIssues,
69
69
  searchIssues
70
- } from "./chunk-55DOQNHJ.js";
71
- import "./chunk-KRH642MT.js";
70
+ } from "./chunk-PRFHN2X6.js";
71
+ import "./chunk-4BGAVEO6.js";
72
72
  import "./chunk-F4NJ4CBP.js";
73
73
  import "./chunk-IXO4G4D3.js";
74
74
  import {
75
75
  ContextGraph
76
- } from "./chunk-NS2MSZMB.js";
77
- import "./chunk-2GIAROBF.js";
76
+ } from "./chunk-55CBWOEZ.js";
77
+ import "./chunk-WHIQAGB7.js";
78
78
  import "./chunk-6NLHFIYA.js";
79
79
  import "./chunk-ZV2K6M7T.js";
80
80
  import {
@@ -83,12 +83,12 @@ import {
83
83
  import {
84
84
  getOutputManager
85
85
  } from "./chunk-VRLMTOB6.js";
86
- import "./chunk-YR4BMGYO.js";
86
+ import "./chunk-7Q6I2CB4.js";
87
87
  import "./chunk-43X6JBEM.js";
88
88
  import {
89
89
  getTrieDirectory,
90
90
  getWorkingDirectory
91
- } from "./chunk-R4AAPFXC.js";
91
+ } from "./chunk-45Y5TLQZ.js";
92
92
  import {
93
93
  isInteractiveMode
94
94
  } from "./chunk-APMV77PU.js";
@@ -1136,6 +1136,7 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
1136
1136
  ]);
1137
1137
  var TrieWatchTool = class _TrieWatchTool {
1138
1138
  extractionPipeline = null;
1139
+ watchedDirectory = "";
1139
1140
  state = {
1140
1141
  isRunning: false,
1141
1142
  lastScan: /* @__PURE__ */ new Map(),
@@ -1210,6 +1211,7 @@ var TrieWatchTool = class _TrieWatchTool {
1210
1211
  await this.extractionPipeline.initialize();
1211
1212
  }
1212
1213
  this.state.isRunning = true;
1214
+ this.watchedDirectory = directory;
1213
1215
  this.state.issueCache.clear();
1214
1216
  this.state.totalIssuesFound = 0;
1215
1217
  this.state.filesScanned = 0;
@@ -1254,14 +1256,14 @@ Your Trie agent is now autonomously watching and learning from your codebase.
1254
1256
 
1255
1257
  **Watching:** \`${directory}\`
1256
1258
  **Debounce:** ${debounceMs}ms (waits for you to stop typing)
1257
- **Signal Extraction:** ${process.env.ANTHROPIC_API_KEY ? "\u2713 ENABLED" : "\u26A0\uFE0F LIMITED (set ANTHROPIC_API_KEY for full extraction)"}
1259
+ **Signal Extraction:** ${process.env.ANTHROPIC_API_KEY ? "ENABLED" : "LIMITED (set ANTHROPIC_API_KEY for full extraction)"}
1258
1260
 
1259
1261
  ### How the agent works:
1260
- 1. [*] You write/edit code
1261
- 2. [#] Agent detects the change
1262
- 3. [\u{1F9E0}] Extracts decisions, facts, blockers \u2192 stores in ledger
1263
- 4. [?] Predicts risks based on historical patterns
1264
- 5. [>] Nudges you in plain English if something looks risky
1262
+ 1. You write/edit code
1263
+ 2. Agent detects the change
1264
+ 3. Extracts decisions, facts, blockers -> stores in ledger
1265
+ 4. Predicts risks based on historical patterns
1266
+ 5. Nudges you if something looks risky
1265
1267
 
1266
1268
  ### The agent learns:
1267
1269
  - Every commit builds the decision ledger
@@ -1327,8 +1329,7 @@ Detected changes in ${files.length} file(s):`);
1327
1329
  console.error("");
1328
1330
  }
1329
1331
  try {
1330
- const projectPath = getWorkingDirectory(void 0, true);
1331
- await this.checkGoalViolations(files, projectPath);
1332
+ const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
1332
1333
  if (this.extractionPipeline) {
1333
1334
  try {
1334
1335
  const fileContents = await Promise.all(
@@ -1383,8 +1384,12 @@ ${f.content.slice(0, 1e3)}`
1383
1384
  this.lastHypothesisCheck = now;
1384
1385
  }
1385
1386
  if (this.streamingManager) {
1387
+ const now2 = Date.now();
1386
1388
  for (const file of files) {
1387
- this.streamingManager.reportWatchChange(file);
1389
+ const lastReport = this.state.lastScan.get(file) || 0;
1390
+ if (now2 - lastReport > 2e3) {
1391
+ this.streamingManager.reportWatchChange(file);
1392
+ }
1388
1393
  }
1389
1394
  }
1390
1395
  this.state.filesScanned += files.length;
@@ -1398,7 +1403,7 @@ ${f.content.slice(0, 1e3)}`
1398
1403
  }
1399
1404
  }
1400
1405
  isQuiet() {
1401
- const projectPath = getWorkingDirectory(void 0, true);
1406
+ const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
1402
1407
  const quietPath = join2(getTrieDirectory(projectPath), "quiet.json");
1403
1408
  try {
1404
1409
  const raw = readFileSync(quietPath, "utf-8");
@@ -1409,90 +1414,6 @@ ${f.content.slice(0, 1e3)}`
1409
1414
  return false;
1410
1415
  }
1411
1416
  }
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-T5HEYBC5.js");
1419
- const { appendIssuesToLedger } = await import("./ledger-SR6OEBLO.js");
1420
- const { getAutonomyConfig: getAutonomyConfig2 } = await import("./autonomy-config-JXB7WCZ2.js");
1421
- const { applyAutoFix } = await import("./auto-fix-apply-PCAHWLXF.js");
1422
- const config = await getAutonomyConfig2(projectPath);
1423
- const outputMgr = getOutputManager();
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.goal.description}" violated: ${violation.violation} in ${basename2(file)}:${violation.line || "?"}`;
1451
- outputMgr.nudge(
1452
- nudgeMessage,
1453
- violation.severity === "critical" ? "critical" : "warning",
1454
- relativePath
1455
- );
1456
- this.state.nudges.push({
1457
- file: basename2(file),
1458
- message: nudgeMessage,
1459
- severity: violation.severity === "critical" ? "critical" : "high",
1460
- timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false })
1461
- });
1462
- if (!isInteractiveMode()) {
1463
- console.error(` [!] Goal violation: ${violation.description}`);
1464
- }
1465
- if (config.autoFix.enabled && violation.autoFixable && violation.fixAction) {
1466
- if (!isInteractiveMode()) {
1467
- console.error(` [*] Auto-fixing...`);
1468
- }
1469
- const fixed = await applyAutoFix(violation.fixAction);
1470
- if (fixed) {
1471
- await recordGoalViolationFixed(violation.goal, relativePath, projectPath);
1472
- const fixMessage = `Auto-fixed: ${violation.goal.description} violation in ${basename2(file)}`;
1473
- outputMgr.nudge(fixMessage, "info", relativePath, 5e3);
1474
- if (!isInteractiveMode()) {
1475
- console.error(` [+] Fixed automatically`);
1476
- }
1477
- }
1478
- }
1479
- }
1480
- if (this.streamingManager && result.violations.length > 0) {
1481
- this.streamingManager.reportSignalExtraction({
1482
- decisions: 0,
1483
- facts: 0,
1484
- blockers: result.violations.length,
1485
- questions: 0
1486
- });
1487
- }
1488
- } catch (error) {
1489
- outputMgr.log("warn", `Could not validate ${basename2(file)}: ${error}`);
1490
- }
1491
- }
1492
- } catch (error) {
1493
- getOutputManager().log("warn", `Goal validation error: ${error}`);
1494
- }
1495
- }
1496
1417
  /**
1497
1418
  * Check and generate hypotheses autonomously
1498
1419
  * Claude observes patterns and creates new hypotheses to test
@@ -1500,7 +1421,7 @@ ${f.content.slice(0, 1e3)}`
1500
1421
  async checkAndGenerateHypotheses(projectPath) {
1501
1422
  if (!isAIAvailable()) return;
1502
1423
  try {
1503
- const { getHypothesisEngine } = await import("./hypothesis-KGC3P54C.js");
1424
+ const { getHypothesisEngine } = await import("./hypothesis-RUCJ74X7.js");
1504
1425
  const { getOutputManager: getOutputManager2 } = await import("./output-manager-BOTMXSND.js");
1505
1426
  const hypothesisEngine = getHypothesisEngine(projectPath);
1506
1427
  const recentIssues = Array.from(this.state.issueCache.values()).flat();
@@ -1567,8 +1488,8 @@ ${f.content.slice(0, 1e3)}`
1567
1488
  const totalIssues = Array.from(this.state.issueCache.values()).flat().length;
1568
1489
  if (totalIssues < 5) return;
1569
1490
  try {
1570
- const { ContextGraph: ContextGraph2 } = await import("./graph-U5JWSAB5.js");
1571
- const { IncidentIndex } = await import("./incident-index-PNIVT47T.js");
1491
+ const { ContextGraph: ContextGraph2 } = await import("./graph-PAUZ5EMP.js");
1492
+ const { IncidentIndex } = await import("./incident-index-ZCDSJ42L.js");
1572
1493
  const { TriePatternDiscovery } = await import("./pattern-discovery-F7LU5K6E.js");
1573
1494
  const graph = new ContextGraph2(projectPath);
1574
1495
  const incidentIndex = await IncidentIndex.build(graph, projectPath);
@@ -1691,8 +1612,8 @@ ${f.content.slice(0, 1e3)}`
1691
1612
  if (this.state.autoScanInProgress) return;
1692
1613
  const now = Date.now();
1693
1614
  if (now - this.state.lastAutoScan < this.aiWatcherCooldownMs) return;
1615
+ const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
1694
1616
  try {
1695
- const projectPath = getWorkingDirectory(void 0, true);
1696
1617
  const config = await getAutonomyConfig(projectPath);
1697
1618
  const wc = config.aiWatcher;
1698
1619
  if (!wc.enabled) return;
@@ -1708,10 +1629,9 @@ ${f.content.slice(0, 1e3)}`
1708
1629
  this.state.autoScanInProgress = true;
1709
1630
  this.state.lastAutoScan = now;
1710
1631
  try {
1711
- const projectPath = getWorkingDirectory(void 0, true);
1712
1632
  const graph = new ContextGraph(projectPath);
1713
- const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-T5HEYBC5.js");
1714
- const { appendIssuesToLedger } = await import("./ledger-SR6OEBLO.js");
1633
+ const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-YSNN23D4.js");
1634
+ const { appendIssuesToLedger } = await import("./ledger-JMPGJGLB.js");
1715
1635
  const activeGoals = await getActiveGoals(projectPath);
1716
1636
  const hasGoals = activeGoals.length > 0;
1717
1637
  if (this.isQuiet() && !hasGoals) return;
@@ -1719,8 +1639,8 @@ ${f.content.slice(0, 1e3)}`
1719
1639
  for (const file of files) {
1720
1640
  const relativePath = file.replace(projectPath + "/", "");
1721
1641
  const score = await this.scoreScanPriority(relativePath, graph, projectPath);
1722
- if (score > 0) {
1723
- scored.push({ file, relativePath, score });
1642
+ if (hasGoals || score > 0) {
1643
+ scored.push({ file, relativePath, score: Math.max(score, hasGoals ? 1 : 0) });
1724
1644
  } else {
1725
1645
  this.state.tokenBudget.scansSaved++;
1726
1646
  }
@@ -1767,11 +1687,13 @@ ${goalsSection}
1767
1687
  Reply ONLY with a JSON array. Each element must have:
1768
1688
  - "file": relative file path
1769
1689
  - "severity": "critical" | "major" | "minor"
1770
- - "description": 1-sentence description
1690
+ - "description": 1-sentence description of what you found
1691
+ - "confidence": number 0-100, how confident you are this is a real issue
1692
+ - "suggestedFix": 1-sentence description of what should change to fix it
1771
1693
  - "isGoalViolation": true if this violates a user goal, false otherwise
1772
1694
  - "goalIndex": 0-based index of the violated goal (only if isGoalViolation is true)
1773
1695
 
1774
- Be thorough with goal checking. If a goal says "no emojis" and you see an emoji anywhere in the file, report it. If a goal says "no inline styles" and you see a style attribute, report it.
1696
+ Be thorough with goal checking. If a goal says "no emojis" and you see an emoji anywhere in the file, report it with the exact location. If a goal says "no inline styles" and you see a style attribute, report it.
1775
1697
 
1776
1698
  If no issues or violations found, reply with: []
1777
1699
  Output ONLY the JSON array, no markdown fences, no commentary.`,
@@ -1804,16 +1726,17 @@ ${filesBlock}`,
1804
1726
  const severity = issue.severity === "critical" ? "critical" : issue.severity === "major" ? "major" : "minor";
1805
1727
  if (issue.isGoalViolation && issue.goalIndex != null && issue.goalIndex >= 0 && issue.goalIndex < activeGoals.length) {
1806
1728
  const goal = activeGoals[issue.goalIndex];
1807
- const nudgeMsg = `Goal "${goal.description}" violated in ${issue.file}: ${issue.description}`;
1729
+ const confidence = Math.min(100, Math.max(0, issue.confidence ?? 80));
1730
+ const fixId = `fix-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
1808
1731
  const ledgerIssue = {
1809
- id: `goal-ai-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
1732
+ id: fixId,
1810
1733
  hash: "",
1811
1734
  file: issue.file,
1812
1735
  line: void 0,
1813
1736
  agent: "ai-watcher",
1814
1737
  severity: severity === "critical" ? "critical" : severity === "major" ? "high" : "medium",
1815
- issue: nudgeMsg,
1816
- fix: "Review and fix",
1738
+ issue: `Goal "${goal.description}" violated: ${issue.description}`,
1739
+ fix: issue.suggestedFix || "Review and fix",
1817
1740
  category: "goal-violation",
1818
1741
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
1819
1742
  project: basename2(projectPath),
@@ -1822,6 +1745,8 @@ ${filesBlock}`,
1822
1745
  };
1823
1746
  await appendIssuesToLedger([ledgerIssue], projectPath);
1824
1747
  await recordGoalViolationCaught(goal, issue.file, projectPath);
1748
+ const confidenceStr = `${confidence}%`;
1749
+ const nudgeMsg = `Goal "${goal.description}" violated in ${issue.file}: ${issue.description} [${confidenceStr} confidence]`;
1825
1750
  getOutputManager().nudge(nudgeMsg, "warning", issue.file);
1826
1751
  this.state.nudges.push({
1827
1752
  file: basename2(issue.file),
@@ -1829,8 +1754,20 @@ ${filesBlock}`,
1829
1754
  severity: "high",
1830
1755
  timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false })
1831
1756
  });
1757
+ if (this.streamingManager) {
1758
+ this.streamingManager.reportPendingFix({
1759
+ id: fixId,
1760
+ file: issue.file,
1761
+ description: issue.description,
1762
+ goalDescription: goal.description,
1763
+ confidence,
1764
+ severity: issue.severity,
1765
+ suggestedFix: issue.suggestedFix || "Remove the violating code"
1766
+ });
1767
+ }
1832
1768
  if (!isInteractiveMode()) {
1833
- console.error(` [!] Goal violation: ${nudgeMsg}`);
1769
+ console.error(` [!] Goal violation (${confidenceStr}): ${issue.description}`);
1770
+ console.error(` Fix: ${issue.suggestedFix || "Review and fix manually"}`);
1834
1771
  }
1835
1772
  continue;
1836
1773
  }
@@ -1958,8 +1895,8 @@ Use \`trie_watch start\` to begin autonomous scanning.`
1958
1895
  ).join("\n");
1959
1896
  let agencyStatus = "";
1960
1897
  try {
1961
- const { getGuardian } = await import("./guardian-agent-EXP7APLC.js");
1962
- const trieAgent = getGuardian(getWorkingDirectory(void 0, true));
1898
+ const { getGuardian } = await import("./guardian-agent-UY2G56FT.js");
1899
+ const trieAgent = getGuardian(this.watchedDirectory || getWorkingDirectory(void 0, true));
1963
1900
  await trieAgent.initialize();
1964
1901
  const status = await trieAgent.getAgencyStatus();
1965
1902
  agencyStatus = `