@triedotdev/mcp 1.0.164 → 1.0.165

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 (62) hide show
  1. package/README.md +16 -2
  2. package/dist/{chunk-62JD7MIS.js → chunk-5LRDF2WB.js} +15 -35
  3. package/dist/chunk-5LRDF2WB.js.map +1 -0
  4. package/dist/{chunk-D6E4Q4I6.js → chunk-CDG2GVBP.js} +279 -57
  5. package/dist/chunk-CDG2GVBP.js.map +1 -0
  6. package/dist/{chunk-5BYSJ7XT.js → chunk-GTKYBOXL.js} +13 -2
  7. package/dist/{chunk-5BYSJ7XT.js.map → chunk-GTKYBOXL.js.map} +1 -1
  8. package/dist/{chunk-ACU3IXZG.js → chunk-HC5P6FZD.js} +7 -7
  9. package/dist/{chunk-HFVPHQL3.js → chunk-IPNPHPNN.js} +9 -9
  10. package/dist/{chunk-OKK4QNK3.js → chunk-IS5UBN2R.js} +86 -12
  11. package/dist/chunk-IS5UBN2R.js.map +1 -0
  12. package/dist/{chunk-LLDZDU2Y.js → chunk-LR5M4RTN.js} +79 -1
  13. package/dist/chunk-LR5M4RTN.js.map +1 -0
  14. package/dist/{chunk-ERMLZJTK.js → chunk-M7HMBZ3R.js} +13 -13
  15. package/dist/chunk-OBQ74FOU.js +27 -0
  16. package/dist/chunk-OBQ74FOU.js.map +1 -0
  17. package/dist/{chunk-5TRCQAOE.js → chunk-RQ6QZBIN.js} +16 -5
  18. package/dist/chunk-RQ6QZBIN.js.map +1 -0
  19. package/dist/{chunk-IRZXBQVQ.js → chunk-SS2O3MTC.js} +134 -101
  20. package/dist/chunk-SS2O3MTC.js.map +1 -0
  21. package/dist/{chunk-LR46VMIE.js → chunk-WRYQHVPD.js} +5 -5
  22. package/dist/{chunk-Y4B3VEL7.js → chunk-YAL3SUBG.js} +435 -202
  23. package/dist/chunk-YAL3SUBG.js.map +1 -0
  24. package/dist/cli/main.js +215 -57
  25. package/dist/cli/main.js.map +1 -1
  26. package/dist/cli/yolo-daemon.js +15 -14
  27. package/dist/cli/yolo-daemon.js.map +1 -1
  28. package/dist/{fast-analyzer-LLZ6FLP5.js → fast-analyzer-54AHLVO5.js} +3 -3
  29. package/dist/{goal-manager-D6XKE3FY.js → goal-manager-563BNILQ.js} +5 -5
  30. package/dist/{goal-validator-4DDL7NBP.js → goal-validator-FJEDIYU7.js} +5 -5
  31. package/dist/{hypothesis-RI3Q33JB.js → hypothesis-4KC7XRBZ.js} +5 -5
  32. package/dist/index.js +16 -15
  33. package/dist/index.js.map +1 -1
  34. package/dist/{issue-store-DUR5UTYK.js → issue-store-FOS4T736.js} +3 -3
  35. package/dist/{ledger-ZTR63P3L.js → ledger-EDLPF6SB.js} +8 -2
  36. package/dist/project-state-AHPA77SM.js +28 -0
  37. package/dist/server/mcp-server.js +16 -15
  38. package/dist/sync-M2FSWPBC.js +12 -0
  39. package/dist/{tiered-storage-FHHAJR4P.js → tiered-storage-OP74NPJY.js} +2 -2
  40. package/dist/tiered-storage-OP74NPJY.js.map +1 -0
  41. package/dist/{trie-agent-NYSPGZYS.js → trie-agent-TM6ATSNR.js} +12 -12
  42. package/dist/trie-agent-TM6ATSNR.js.map +1 -0
  43. package/package.json +1 -1
  44. package/dist/chunk-5TRCQAOE.js.map +0 -1
  45. package/dist/chunk-62JD7MIS.js.map +0 -1
  46. package/dist/chunk-D6E4Q4I6.js.map +0 -1
  47. package/dist/chunk-IRZXBQVQ.js.map +0 -1
  48. package/dist/chunk-LLDZDU2Y.js.map +0 -1
  49. package/dist/chunk-OKK4QNK3.js.map +0 -1
  50. package/dist/chunk-Y4B3VEL7.js.map +0 -1
  51. /package/dist/{chunk-ACU3IXZG.js.map → chunk-HC5P6FZD.js.map} +0 -0
  52. /package/dist/{chunk-HFVPHQL3.js.map → chunk-IPNPHPNN.js.map} +0 -0
  53. /package/dist/{chunk-ERMLZJTK.js.map → chunk-M7HMBZ3R.js.map} +0 -0
  54. /package/dist/{chunk-LR46VMIE.js.map → chunk-WRYQHVPD.js.map} +0 -0
  55. /package/dist/{fast-analyzer-LLZ6FLP5.js.map → fast-analyzer-54AHLVO5.js.map} +0 -0
  56. /package/dist/{goal-manager-D6XKE3FY.js.map → goal-manager-563BNILQ.js.map} +0 -0
  57. /package/dist/{goal-validator-4DDL7NBP.js.map → goal-validator-FJEDIYU7.js.map} +0 -0
  58. /package/dist/{hypothesis-RI3Q33JB.js.map → hypothesis-4KC7XRBZ.js.map} +0 -0
  59. /package/dist/{issue-store-DUR5UTYK.js.map → issue-store-FOS4T736.js.map} +0 -0
  60. /package/dist/{ledger-ZTR63P3L.js.map → ledger-EDLPF6SB.js.map} +0 -0
  61. /package/dist/{tiered-storage-FHHAJR4P.js.map → project-state-AHPA77SM.js.map} +0 -0
  62. /package/dist/{trie-agent-NYSPGZYS.js.map → sync-M2FSWPBC.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JVMBCWKS.js";
4
4
  import {
5
5
  getTrieAgent
6
- } from "./chunk-ERMLZJTK.js";
6
+ } from "./chunk-M7HMBZ3R.js";
7
7
  import {
8
8
  parseGoalViolation
9
9
  } from "./chunk-WCN7S3EI.js";
@@ -18,7 +18,6 @@ import {
18
18
  } from "./chunk-T63OHG4Q.js";
19
19
  import {
20
20
  LearningEngine,
21
- exportToJson,
22
21
  formatFriendlyError,
23
22
  getLastCheckpoint,
24
23
  isTrieInitialized,
@@ -26,10 +25,13 @@ import {
26
25
  perceiveCurrentChanges,
27
26
  reasonAboutChangesHumanReadable,
28
27
  saveCheckpoint
29
- } from "./chunk-62JD7MIS.js";
28
+ } from "./chunk-5LRDF2WB.js";
30
29
  import {
31
30
  measureInitialGoalValue
32
- } from "./chunk-ACU3IXZG.js";
31
+ } from "./chunk-HC5P6FZD.js";
32
+ import {
33
+ exportToJson
34
+ } from "./chunk-OBQ74FOU.js";
33
35
  import {
34
36
  loadConfig,
35
37
  saveConfig
@@ -39,14 +41,14 @@ import {
39
41
  } from "./chunk-TN5WEKWI.js";
40
42
  import {
41
43
  findCrossProjectPatterns
42
- } from "./chunk-HFVPHQL3.js";
43
- import {
44
- TieredStorage,
45
- getStorage
46
- } from "./chunk-LLDZDU2Y.js";
44
+ } from "./chunk-IPNPHPNN.js";
47
45
  import {
48
46
  ContextGraph
49
47
  } from "./chunk-VUL52BQL.js";
48
+ import {
49
+ TieredStorage,
50
+ getStorage
51
+ } from "./chunk-LR5M4RTN.js";
50
52
  import {
51
53
  getKeyFromKeychain,
52
54
  isAIAvailable,
@@ -54,22 +56,26 @@ import {
54
56
  runAIWithTools,
55
57
  setAPIKey
56
58
  } from "./chunk-FQ45QP5A.js";
57
- import {
58
- getProjectState
59
- } from "./chunk-5BYSJ7XT.js";
60
59
  import {
61
60
  storeIssues
62
- } from "./chunk-IRZXBQVQ.js";
61
+ } from "./chunk-SS2O3MTC.js";
62
+ import {
63
+ getProjectState
64
+ } from "./chunk-GTKYBOXL.js";
63
65
  import {
64
66
  getAutonomyConfig,
65
67
  loadAutonomyConfig,
66
68
  saveAutonomyConfig
67
69
  } from "./chunk-ME2OERF5.js";
68
70
  import {
71
+ generateKeyPair,
69
72
  getChangedFilesSinceTimestamp,
70
73
  getGitChangedFiles,
71
- getLedgerBlocks
72
- } from "./chunk-Y4B3VEL7.js";
74
+ getLedgerBlocks,
75
+ getPublicKey,
76
+ hasSigningKey,
77
+ saveKeyPair
78
+ } from "./chunk-YAL3SUBG.js";
73
79
  import {
74
80
  getTrieDirectory,
75
81
  getWorkingDirectory
@@ -728,6 +734,8 @@ function dashboardReducer(state, action) {
728
734
  return { ...state, memoryTree: { ...state.memoryTree, selectedNode: action.nodeId } };
729
735
  case "SET_MEMORY_EXPANDED_ITEM":
730
736
  return { ...state, memoryTree: { ...state.memoryTree, expandedItemId: action.itemId } };
737
+ case "TOGGLE_SIGNALS_VIEW_ALL":
738
+ return { ...state, memoryTree: { ...state.memoryTree, signalsViewAll: !state.memoryTree.signalsViewAll } };
731
739
  case "TOGGLE_MEMORY_NODE": {
732
740
  const expandable = ["decisions", "incidents", "patterns", "cross-project", "hotspots", "ledger-chain"];
733
741
  if (expandable.includes(action.nodeId)) {
@@ -981,7 +989,7 @@ function createInitialState() {
981
989
  },
982
990
  goalsPanel: { goals: [], selectedIndex: 0, selectedAchievedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0, scanningGoalId: null, scanningProgress: "" },
983
991
  hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0, scanningHypothesisId: null, scanningProgress: "" },
984
- memoryTree: { loaded: false, snapshot: null, globalPatterns: [], storageGovernance: [], storageFacts: [], storageGotchas: [], storageNudges: [], storageInsights: [], ledgerBlocks: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), expandedItemId: null, selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
992
+ memoryTree: { loaded: false, snapshot: null, globalPatterns: [], storageGovernance: [], storageFacts: [], storageGotchas: [], storageNudges: [], storageInsights: [], ledgerBlocks: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), expandedItemId: null, selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0, signalsViewAll: false },
985
993
  agentBrain: { loaded: false, governance: [], patterns: [], ledgerHash: null, selectedIndex: 0, expandedIndex: null },
986
994
  chatState: { messages: [], inputBuffer: "", loading: false, progress: null, messageQueue: [], currentSessionId: null, currentSessionTitle: null },
987
995
  chatArchivePanel: { sessions: [], selectedIndex: 0, showArchived: false, loading: false, inputMode: "browse", inputBuffer: "" },
@@ -1120,6 +1128,8 @@ function Footer() {
1120
1128
  hints = narrow ? "d r" : "d delete \xB7 r resolve";
1121
1129
  } else if (ledgerBlockSelected) {
1122
1130
  hints = narrow ? "enter" : "Enter details \xB7 Esc close";
1131
+ } else if (view === "memory" && memoryTree.expandedNodes.has("patterns")) {
1132
+ hints = memoryTree.signalsViewAll ? narrow ? "a" : "a collapse" : narrow ? "a" : "a view all";
1123
1133
  } else if (view === "goals" && goalsPanel.goals.filter((g) => g.status === "achieved").length > 0 && goalsPanel.goals.filter((g) => g.status === "active").length === 0) {
1124
1134
  hints = narrow ? "U" : "U reactivate all achieved";
1125
1135
  } else {
@@ -1221,6 +1231,8 @@ function ConfigDialog({ onClose }) {
1221
1231
  const [cursorKeyDisplay, setCursorKeyDisplay] = useState("Not set");
1222
1232
  const [linearKeyDisplay, setLinearKeyDisplay] = useState("Not set");
1223
1233
  const [githubKeyDisplay, setGithubKeyDisplay] = useState("Not set");
1234
+ const [signingKeyStatus, setSigningKeyStatus] = useState({ hasKey: false, pubKey: null });
1235
+ const [generatingKey, setGeneratingKey] = useState(false);
1224
1236
  const config = state.agentConfig;
1225
1237
  React3.useEffect(() => {
1226
1238
  const loadApiKeys = async () => {
@@ -1242,6 +1254,14 @@ function ConfigDialog({ onClose }) {
1242
1254
  setLinearKeyDisplay("Not set");
1243
1255
  setGithubKeyDisplay("Not set");
1244
1256
  }
1257
+ try {
1258
+ const workDir = getWorkingDirectory(void 0, true);
1259
+ const hasKey = hasSigningKey(workDir);
1260
+ const pubKey = hasKey ? getPublicKey(workDir) : null;
1261
+ setSigningKeyStatus({ hasKey, pubKey });
1262
+ } catch {
1263
+ setSigningKeyStatus({ hasKey: false, pubKey: null });
1264
+ }
1245
1265
  };
1246
1266
  void loadApiKeys();
1247
1267
  }, []);
@@ -1282,6 +1302,7 @@ function ConfigDialog({ onClose }) {
1282
1302
  const keyActive = isAIAvailable();
1283
1303
  const mainMenu = [
1284
1304
  { label: "API Keys", key: "apiKeys", value: keyActive ? "Active" : "Not set", section: "main" },
1305
+ { label: "Signing Keys", key: "signingKeys", value: signingKeyStatus.hasKey ? "Active (Ed25519)" : "Not set", section: "main" },
1285
1306
  { label: "Codebase Index", key: "codebaseIndex", value: "Stats & Re-index", section: "main" },
1286
1307
  { label: "AI Watcher", key: "aiWatcher", value: config.aiWatcher.enabled ? `${(config.aiWatcher.hourlyTokenLimit / 1e3).toFixed(0)}k/hr` : "Off", section: "main" },
1287
1308
  { label: "Performance", key: "performance", value: `${config.performance.maxConcurrency} concurrent`, section: "main" },
@@ -1321,7 +1342,8 @@ function ConfigDialog({ onClose }) {
1321
1342
  { label: "Re-index Codebase", key: "reindex", value: "Rebuild full index", section: "codebaseIndex" },
1322
1343
  { label: "Clear Index", key: "clearIndex", value: "Delete index cache", section: "codebaseIndex" }
1323
1344
  ];
1324
- const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "aiWatcher" ? aiWatcherItems : section === "memory" ? memoryItems : section === "codebaseIndex" ? codebaseIndexItems : mainMenu;
1345
+ const signingKeysItems = signingKeyStatus.hasKey ? [{ label: "Regenerate Key", key: "regenerate", value: "WARNING: invalidates signatures", section: "signingKeys" }] : [{ label: "Generate Key", key: "generate", value: "Create Ed25519 signing key", section: "signingKeys" }];
1346
+ const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "aiWatcher" ? aiWatcherItems : section === "memory" ? memoryItems : section === "codebaseIndex" ? codebaseIndexItems : section === "signingKeys" ? signingKeysItems : mainMenu;
1325
1347
  useInput((_input, key) => {
1326
1348
  if (showConfirmClear) {
1327
1349
  if (_input === "y" || _input === "Y") {
@@ -1467,6 +1489,19 @@ function ConfigDialog({ onClose }) {
1467
1489
  dispatch({ type: "ADD_ACTIVITY", message: "Failed to clear index" });
1468
1490
  });
1469
1491
  }
1492
+ } else if (section === "signingKeys") {
1493
+ const item = items[selectedIndex];
1494
+ if (item && (item.key === "generate" || item.key === "regenerate")) {
1495
+ setGeneratingKey(true);
1496
+ generateSigningKey().then((pubKey) => {
1497
+ setSigningKeyStatus({ hasKey: true, pubKey });
1498
+ dispatch({ type: "ADD_ACTIVITY", message: "Ed25519 signing key generated" });
1499
+ setGeneratingKey(false);
1500
+ }).catch(() => {
1501
+ dispatch({ type: "ADD_ACTIVITY", message: "Failed to generate signing key" });
1502
+ setGeneratingKey(false);
1503
+ });
1504
+ }
1470
1505
  } else {
1471
1506
  const item = items[selectedIndex];
1472
1507
  if (item) {
@@ -1489,7 +1524,7 @@ function ConfigDialog({ onClose }) {
1489
1524
  }
1490
1525
  }
1491
1526
  });
1492
- const sectionTitle = section === "main" ? "Settings" : section === "apiKeys" ? "API Keys" : section === "aiWatcher" ? "AI Watcher" : section === "performance" ? "Performance" : section === "riskThresholds" ? "Risk Thresholds" : section === "memory" ? "Memory" : section === "codebaseIndex" ? "Codebase Index" : "Settings";
1527
+ const sectionTitle = section === "main" ? "Settings" : section === "apiKeys" ? "API Keys" : section === "aiWatcher" ? "AI Watcher" : section === "performance" ? "Performance" : section === "riskThresholds" ? "Risk Thresholds" : section === "memory" ? "Memory" : section === "codebaseIndex" ? "Codebase Index" : section === "signingKeys" ? "Ed25519 Signing Keys" : "Settings";
1493
1528
  async function clearMemory() {
1494
1529
  const workDir = getWorkingDirectory(void 0, true);
1495
1530
  const trieDir = getTrieDirectory(workDir);
@@ -1516,6 +1551,12 @@ function ConfigDialog({ onClose }) {
1516
1551
  await rm(indexFile, { force: true });
1517
1552
  }
1518
1553
  }
1554
+ async function generateSigningKey() {
1555
+ const workDir = getWorkingDirectory(void 0, true);
1556
+ const keyPair = await generateKeyPair();
1557
+ saveKeyPair(keyPair, workDir);
1558
+ return keyPair.publicKey;
1559
+ }
1519
1560
  async function reindexCodebase() {
1520
1561
  const workDir = getWorkingDirectory(void 0, true);
1521
1562
  const { CodebaseIndex: CodebaseIndex2 } = await import("./codebase-index-VAPF32XX.js");
@@ -1590,6 +1631,40 @@ function ConfigDialog({ onClose }) {
1590
1631
  }),
1591
1632
  indexing ? /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Re-indexing codebase..." }) }) : /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to execute \xB7 esc back" }) })
1592
1633
  ] }),
1634
+ !showConfirmClear && section === "signingKeys" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1635
+ /* @__PURE__ */ jsx5(Text4, { bold: true, children: "Ed25519 Signing for Governance Ledger" }),
1636
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: signingKeyStatus.hasKey ? /* @__PURE__ */ jsx5(Fragment, { children: /* @__PURE__ */ jsxs4(Text4, { children: [
1637
+ " Status: ",
1638
+ /* @__PURE__ */ jsx5(Text4, { color: "green", children: "\u2713 Active" })
1639
+ ] }) }) : /* @__PURE__ */ jsxs4(Text4, { children: [
1640
+ " Status: ",
1641
+ /* @__PURE__ */ jsx5(Text4, { color: "yellow", children: "\u25CB Not configured" })
1642
+ ] }) }),
1643
+ signingKeyStatus.hasKey && signingKeyStatus.pubKey && /* @__PURE__ */ jsxs4(Text4, { children: [
1644
+ " Public key: ",
1645
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1646
+ signingKeyStatus.pubKey.slice(0, 16),
1647
+ "...",
1648
+ signingKeyStatus.pubKey.slice(-8)
1649
+ ] })
1650
+ ] }),
1651
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Signing provides:" }) }),
1652
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " \u2022 Authenticity - prove who created each entry" }),
1653
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " \u2022 Tamper-evidence - detect if entries are modified" }),
1654
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " \u2022 Accountability - track decisions to humans/agents" }),
1655
+ /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: signingKeysItems.map((item, idx) => {
1656
+ const isSelected = selectedIndex === idx;
1657
+ return /* @__PURE__ */ jsxs4(Text4, { children: [
1658
+ isSelected ? /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "> " }) : " ",
1659
+ item.key === "regenerate" ? /* @__PURE__ */ jsx5(Text4, { bold: isSelected, color: "yellow", children: item.label }) : /* @__PURE__ */ jsx5(Text4, { bold: isSelected, children: item.label }),
1660
+ /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1661
+ " ",
1662
+ item.value
1663
+ ] })
1664
+ ] }, item.key);
1665
+ }) }),
1666
+ generatingKey ? /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Generating key..." }) }) : /* @__PURE__ */ jsx5(Box4, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to execute \xB7 esc back" }) })
1667
+ ] }),
1593
1668
  !showConfirmClear && section === "apiKeys" && !editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1594
1669
  apiKeysItems.map((item, idx) => {
1595
1670
  const isSelected = selectedIndex === idx;
@@ -1619,7 +1694,7 @@ function ConfigDialog({ onClose }) {
1619
1694
  ] }) }),
1620
1695
  /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter save \xB7 esc cancel" })
1621
1696
  ] }),
1622
- !showConfirmClear && section !== "apiKeys" && section !== "memory" && section !== "codebaseIndex" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1697
+ !showConfirmClear && section !== "apiKeys" && section !== "memory" && section !== "codebaseIndex" && section !== "signingKeys" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1623
1698
  items.map((item, idx) => {
1624
1699
  const isSelected = selectedIndex === idx;
1625
1700
  return /* @__PURE__ */ jsxs4(Text4, { children: [
@@ -1985,7 +2060,7 @@ function AgentView() {
1985
2060
  const { getInsightStore: getInsightStore2 } = await import("./insight-store-EC4PLSAW.js");
1986
2061
  const store = getInsightStore2(workDir);
1987
2062
  await store.dismissInsight(insight.id);
1988
- const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
2063
+ const { getStorage: getStorage2 } = await import("./tiered-storage-OP74NPJY.js");
1989
2064
  const storage = getStorage2(workDir);
1990
2065
  await storage.dismissNudge(insight.id).catch(() => {
1991
2066
  });
@@ -1997,7 +2072,7 @@ function AgentView() {
1997
2072
  const clearAllNudges = useCallback(async () => {
1998
2073
  try {
1999
2074
  const workDir = getWorkingDirectory(void 0, true);
2000
- const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
2075
+ const { getStorage: getStorage2 } = await import("./tiered-storage-OP74NPJY.js");
2001
2076
  const storage = getStorage2(workDir);
2002
2077
  await storage.clearAllNudges();
2003
2078
  dispatch({ type: "CLEAR_ALL_INSIGHTS" });
@@ -2033,8 +2108,8 @@ function AgentView() {
2033
2108
  }
2034
2109
  await spawnClaudeCodeFixIssue({
2035
2110
  message: insight.message,
2036
- file,
2037
- suggestedAction: insight.suggestedAction,
2111
+ ...file !== void 0 && { file },
2112
+ ...insight.suggestedAction !== void 0 && { suggestedAction: insight.suggestedAction },
2038
2113
  cwd: workDir
2039
2114
  });
2040
2115
  const fileDisplay = file ? ` for ${file.split("/").pop()}` : "";
@@ -2371,7 +2446,7 @@ function GoalsView() {
2371
2446
  dispatch({ type: "SET_GOAL_SCANNING", goalId, progress: "Starting scan..." });
2372
2447
  dispatch({ type: "ADD_ACTIVITY", message: `Scanning goal: ${goalSummary.description}...` });
2373
2448
  dispatch({ type: "SET_GOAL_SCANNING", goalId, progress: "Loading goal configuration..." });
2374
- const { checkFilesForGoalViolations } = await import("./goal-validator-4DDL7NBP.js");
2449
+ const { checkFilesForGoalViolations } = await import("./goal-validator-FJEDIYU7.js");
2375
2450
  const agentState = getProjectState(workDir);
2376
2451
  await agentState.load();
2377
2452
  const fullGoal = agentState.getAllGoals().find((g) => g.id === goalId);
@@ -2646,7 +2721,7 @@ function HypothesesView() {
2646
2721
  dispatch({ type: "SET_HYPOTHESIS_SCANNING", hypothesisId: hypoId, progress: "Gathering evidence..." });
2647
2722
  dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement}` });
2648
2723
  dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
2649
- const { gatherEvidenceForHypothesis } = await import("./hypothesis-RI3Q33JB.js");
2724
+ const { gatherEvidenceForHypothesis } = await import("./hypothesis-4KC7XRBZ.js");
2650
2725
  const evidence = await gatherEvidenceForHypothesis(hypoId, workDir, signal);
2651
2726
  scanAbortRef.current = null;
2652
2727
  dispatch({ type: "SET_HYPOTHESIS_SCANNING", hypothesisId: null, progress: "" });
@@ -2818,7 +2893,7 @@ function timeAgo2(iso) {
2818
2893
  function MemoryTreeView() {
2819
2894
  const { state, dispatch } = useDashboard();
2820
2895
  const { memoryTree } = state;
2821
- const { snapshot, globalPatterns, storageGovernance, storageFacts, storageGotchas, storageNudges, storageInsights, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded } = memoryTree;
2896
+ const { snapshot, globalPatterns, storageGovernance, storageFacts, storageGotchas, storageNudges, storageInsights, ledgerBlocks, expandedNodes, expandedItemId, selectedNode, loaded, signalsViewAll } = memoryTree;
2822
2897
  const { stdout } = useStdout8();
2823
2898
  const cols = stdout?.columns || 80;
2824
2899
  const narrow = cols < 60;
@@ -2884,6 +2959,10 @@ function MemoryTreeView() {
2884
2959
  dispatch({ type: "INVALIDATE_MEMORY_TREE" });
2885
2960
  return;
2886
2961
  }
2962
+ if (expandedNodes.has("patterns") && (_input === "a" || _input === "A")) {
2963
+ dispatch({ type: "TOGGLE_SIGNALS_VIEW_ALL" });
2964
+ return;
2965
+ }
2887
2966
  if (key.upArrow || _input === "k") dispatch({ type: "NAVIGATE_UP" });
2888
2967
  else if (key.downArrow || _input === "j") dispatch({ type: "NAVIGATE_DOWN" });
2889
2968
  else if (key.return) dispatch({ type: "TOGGLE_MEMORY_NODE", nodeId: selectedNode });
@@ -2925,7 +3004,7 @@ function MemoryTreeView() {
2925
3004
  const blockIndex = parseInt(expandedItemId.replace("ledger-block-", ""), 10);
2926
3005
  return ledgerBlocks[blockIndex] || null;
2927
3006
  })() : null;
2928
- function renderHeader(id, label, count, emptyHint) {
3007
+ function renderHeader(id, label, count, emptyHint, viewHint) {
2929
3008
  const expanded = expandedNodes.has(id);
2930
3009
  const isEmpty = count === 0;
2931
3010
  return /* @__PURE__ */ jsxs10(Text10, { children: [
@@ -2940,6 +3019,10 @@ function MemoryTreeView() {
2940
3019
  ] }) : isEmpty && emptyHint ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
2941
3020
  " ",
2942
3021
  emptyHint
3022
+ ] }) : null,
3023
+ count > 0 && viewHint ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3024
+ " ",
3025
+ viewHint
2943
3026
  ] }) : null
2944
3027
  ] });
2945
3028
  }
@@ -3038,7 +3121,40 @@ function MemoryTreeView() {
3038
3121
  ] }) })
3039
3122
  ] }),
3040
3123
  expandedLedgerBlock && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, borderStyle: "single", borderColor: "magenta", paddingX: 1, paddingY: 1, children: [
3041
- /* @__PURE__ */ jsx11(Text10, { bold: true, color: "magenta", children: "Ledger Block Details \xB7 d delete \xB7 Esc close" }),
3124
+ /* @__PURE__ */ jsx11(Text10, { bold: true, color: "magenta", children: "Ledger Block Details \xB7 Esc close" }),
3125
+ (() => {
3126
+ const syncBlock = expandedLedgerBlock;
3127
+ const blockAuthor = syncBlock.author;
3128
+ const gitCommit = syncBlock.gitCommit;
3129
+ const signedCount = expandedLedgerBlock.entries.filter((e) => e.signature).length;
3130
+ const totalEntries2 = expandedLedgerBlock.entries.length;
3131
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
3132
+ blockAuthor ? /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3133
+ /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Block author:" }),
3134
+ " ",
3135
+ /* @__PURE__ */ jsx11(Text10, { color: "cyan", children: blockAuthor }),
3136
+ " ",
3137
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "(person or agent who created block)" })
3138
+ ] }) }) : null,
3139
+ gitCommit ? /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3140
+ /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Git commit:" }),
3141
+ " ",
3142
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: gitCommit.slice(0, 8) })
3143
+ ] }) }) : null,
3144
+ /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3145
+ /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Ed25519 signatures:" }),
3146
+ " ",
3147
+ /* @__PURE__ */ jsxs10(Text10, { color: signedCount === totalEntries2 ? "green" : signedCount > 0 ? "yellow" : "dim", children: [
3148
+ signedCount,
3149
+ "/",
3150
+ totalEntries2,
3151
+ " signed"
3152
+ ] }),
3153
+ " ",
3154
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "(\u2713 = signed, \u25CB = unsigned)" })
3155
+ ] }) })
3156
+ ] });
3157
+ })(),
3042
3158
  (() => {
3043
3159
  const aiAgents = /* @__PURE__ */ new Set(["goal-violation", "claude", "agent", "ai"]);
3044
3160
  const hasAIAgents = expandedLedgerBlock.entries.some((e) => aiAgents.has(e.agent));
@@ -3105,6 +3221,35 @@ function MemoryTreeView() {
3105
3221
  ] }) })
3106
3222
  ] });
3107
3223
  })(),
3224
+ /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Entries (who made/changed what):" }) }),
3225
+ expandedLedgerBlock.entries.slice(0, 15).map((entry, idx) => {
3226
+ const sigIcon = entry.signature ? "\u2713" : "\u25CB";
3227
+ const sigColor = entry.signature ? "green" : "dim";
3228
+ const fileShort = entry.file.split("/").pop() || entry.file;
3229
+ const corrected = entry.status === "corrected" || entry.correctedBy;
3230
+ return /* @__PURE__ */ jsx11(Box10, { marginTop: 0, children: /* @__PURE__ */ jsxs10(Text10, { children: [
3231
+ /* @__PURE__ */ jsx11(Text10, { color: sigColor, children: sigIcon }),
3232
+ " ",
3233
+ /* @__PURE__ */ jsx11(Text10, { ...entry.severity === "critical" ? { color: "red" } : entry.severity === "high" ? { color: "yellow" } : {}, children: entry.severity }),
3234
+ " ",
3235
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: fileShort }),
3236
+ " ",
3237
+ /* @__PURE__ */ jsxs10(Text10, { color: "cyan", children: [
3238
+ "by ",
3239
+ entry.agent
3240
+ ] }),
3241
+ entry.signedAt ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3242
+ " \xB7 signed ",
3243
+ timeAgo2(entry.signedAt)
3244
+ ] }) : null,
3245
+ corrected ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " \xB7 corrected" }) : null
3246
+ ] }) }, entry.id || idx);
3247
+ }),
3248
+ expandedLedgerBlock.entries.length > 15 && /* @__PURE__ */ jsx11(Box10, { marginTop: 0, children: /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3249
+ " \u2026 and ",
3250
+ expandedLedgerBlock.entries.length - 15,
3251
+ " more"
3252
+ ] }) }),
3108
3253
  /* @__PURE__ */ jsx11(Box10, { marginTop: 1, children: /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3109
3254
  "Created: ",
3110
3255
  expandedLedgerBlock.createdAt
@@ -3183,15 +3328,20 @@ function MemoryTreeView() {
3183
3328
  ] })
3184
3329
  ] }, g.id);
3185
3330
  }),
3186
- renderHeader("patterns", "Learned Signals", (storageInsights?.length ?? 0) + learnedSignals.length + (storageFacts?.length ?? 0) + (storageNudges?.length ?? 0) + patternNodes.length, (storageInsights?.length ?? 0) === 0 && learnedSignals.length === 0 && (storageFacts?.length ?? 0) === 0 && (storageNudges?.length ?? 0) === 0 && patternNodes.length === 0 ? "-- Trie learns as you work" : void 0),
3331
+ renderHeader("patterns", "Learned Signals", (storageInsights?.length ?? 0) + learnedSignals.length + (storageFacts?.length ?? 0) + (storageNudges?.length ?? 0) + patternNodes.length, (storageInsights?.length ?? 0) === 0 && learnedSignals.length === 0 && (storageFacts?.length ?? 0) === 0 && (storageNudges?.length ?? 0) === 0 && patternNodes.length === 0 ? "-- Trie learns as you work" : void 0, (storageInsights?.length ?? 0) + learnedSignals.length + (storageFacts?.length ?? 0) + (storageNudges?.length ?? 0) + patternNodes.length > 5 ? signalsViewAll ? "\xB7 a collapse" : "\xB7 a view all" : void 0),
3187
3332
  expandedNodes.has("patterns") && /* @__PURE__ */ jsxs10(Fragment6, { children: [
3333
+ signalsViewAll && /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3334
+ " ",
3335
+ " ",
3336
+ "Showing all \xB7 a to collapse"
3337
+ ] }),
3188
3338
  (storageInsights?.length ?? 0) > 0 && /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", children: [
3189
3339
  /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3190
3340
  " ",
3191
3341
  " ",
3192
3342
  "Learnings"
3193
3343
  ] }),
3194
- storageInsights.slice(0, 5).map((insight) => {
3344
+ (signalsViewAll ? storageInsights : storageInsights.slice(0, 5)).map((insight) => {
3195
3345
  const descWidth = Math.max(30, contentWidth - 15);
3196
3346
  const desc = insight.message.length > descWidth ? insight.message.slice(0, descWidth - 3) + "..." : insight.message;
3197
3347
  const categoryLabel = insight.category === "security" ? "[sec]" : insight.category === "performance" ? "[perf]" : insight.category === "quality" ? "[qual]" : "[learn]";
@@ -3215,7 +3365,7 @@ function MemoryTreeView() {
3215
3365
  " ",
3216
3366
  (storageInsights?.length ?? 0) > 0 ? "Raw Detections" : "AI Detections"
3217
3367
  ] }),
3218
- storageNudges.slice(0, (storageInsights?.length ?? 0) > 0 ? 3 : 5).map((n) => {
3368
+ (signalsViewAll ? storageNudges : storageNudges.slice(0, (storageInsights?.length ?? 0) > 0 ? 3 : 5)).map((n) => {
3219
3369
  const descWidth = Math.max(30, contentWidth - 15);
3220
3370
  const desc = n.message.length > descWidth ? n.message.slice(0, descWidth - 3) + "..." : n.message;
3221
3371
  const severityColor = n.severity === "critical" ? "red" : n.severity === "high" ? "yellow" : "cyan";
@@ -3237,7 +3387,7 @@ function MemoryTreeView() {
3237
3387
  " ",
3238
3388
  "Governance"
3239
3389
  ] }),
3240
- learnedSignals.slice(0, 5).map((g) => {
3390
+ (signalsViewAll ? learnedSignals : learnedSignals.slice(0, 5)).map((g) => {
3241
3391
  const descWidth = Math.max(30, contentWidth - 15);
3242
3392
  const desc = g.decision.length > descWidth ? g.decision.slice(0, descWidth - 3) + "..." : g.decision;
3243
3393
  return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
@@ -3258,7 +3408,7 @@ function MemoryTreeView() {
3258
3408
  " ",
3259
3409
  "Facts"
3260
3410
  ] }),
3261
- storageFacts.slice(0, 5).map((f) => {
3411
+ (signalsViewAll ? storageFacts : storageFacts.slice(0, 5)).map((f) => {
3262
3412
  const descWidth = Math.max(30, contentWidth - 15);
3263
3413
  const desc = f.fact.length > descWidth ? f.fact.slice(0, descWidth - 3) + "..." : f.fact;
3264
3414
  return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
@@ -3279,7 +3429,7 @@ function MemoryTreeView() {
3279
3429
  " ",
3280
3430
  "Patterns"
3281
3431
  ] }),
3282
- patternNodes.slice(0, 10).map((n) => {
3432
+ (signalsViewAll ? patternNodes : patternNodes.slice(0, 10)).map((n) => {
3283
3433
  const nodeId = `pattern-${n.id}`;
3284
3434
  const conf = Math.round(n.data.confidence * 100);
3285
3435
  const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
@@ -3380,6 +3530,9 @@ function MemoryTreeView() {
3380
3530
  const topAgent = Object.keys(agentCounts).sort((a, b) => (agentCounts[b] ?? 0) - (agentCounts[a] ?? 0))[0];
3381
3531
  const blkShort = block.blockHash?.slice(0, 6) || "\u2014";
3382
3532
  const mkShort = block.merkleRoot?.slice(0, 6) || "\u2014";
3533
+ const signedCount = block.entries.filter((e) => e.signature).length;
3534
+ const allSigned = signedCount === block.entries.length && block.entries.length > 0;
3535
+ const blockAuthor = block.author;
3383
3536
  return /* @__PURE__ */ jsxs10(Text10, { wrap: "truncate", children: [
3384
3537
  sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
3385
3538
  " ",
@@ -3438,7 +3591,24 @@ function MemoryTreeView() {
3438
3591
  topAgent
3439
3592
  ] })
3440
3593
  ] }) : null,
3441
- sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " [Enter: details, d: delete]" }) : null
3594
+ !narrow && blockAuthor ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
3595
+ " ",
3596
+ /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3597
+ "\xB7 author: ",
3598
+ blockAuthor
3599
+ ] })
3600
+ ] }) : null,
3601
+ !narrow && block.entries.length > 0 ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
3602
+ " ",
3603
+ allSigned ? /* @__PURE__ */ jsx11(Text10, { color: "green", children: "\u2713 Ed25519" }) : signedCount > 0 ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
3604
+ "(",
3605
+ signedCount,
3606
+ "/",
3607
+ block.entries.length,
3608
+ " signed)"
3609
+ ] }) : null
3610
+ ] }) : null,
3611
+ sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " [Enter: details]" }) : null
3442
3612
  ] }, nodeId);
3443
3613
  })
3444
3614
  ] })
@@ -6432,7 +6602,7 @@ function getPendingFixes() {
6432
6602
  }
6433
6603
  async function loadPendingFixesFromMemory() {
6434
6604
  try {
6435
- const { getRecentIssues } = await import("./issue-store-DUR5UTYK.js");
6605
+ const { getRecentIssues } = await import("./issue-store-FOS4T736.js");
6436
6606
  pendingFixes.clear();
6437
6607
  const recentIssues = await getRecentIssues({ limit: 50, includeResolved: false });
6438
6608
  for (const storedIssue of recentIssues) {
@@ -6735,7 +6905,7 @@ var TrieCloudFixTool = class {
6735
6905
  if (pending.length === 0) {
6736
6906
  try {
6737
6907
  console.log("Loading issues from memory...");
6738
- const { getRecentIssues } = await import("./issue-store-DUR5UTYK.js");
6908
+ const { getRecentIssues } = await import("./issue-store-FOS4T736.js");
6739
6909
  const recentIssues = await getRecentIssues({ limit: 50, includeResolved: false });
6740
6910
  console.log(`Found ${recentIssues.length} recent issues in memory`);
6741
6911
  const memoryIssues = recentIssues.map((storedIssue) => ({
@@ -7033,8 +7203,8 @@ var TrieGetNudgesTool = class {
7033
7203
  const limit = input.limit ?? 20;
7034
7204
  const nudges = await storage.queryNudges({
7035
7205
  resolved: false,
7036
- severity: input.severity,
7037
- file: input.file,
7206
+ ...input.severity !== void 0 && { severity: input.severity },
7207
+ ...input.file !== void 0 && { file: input.file },
7038
7208
  limit
7039
7209
  });
7040
7210
  if (nudges.length === 0) {
@@ -7281,8 +7451,12 @@ var TrieQueryLedgerBlocksTool = class {
7281
7451
  output += "**Block summary:**\n";
7282
7452
  for (let i = 0; i < limited.length; i++) {
7283
7453
  const b = limited[i];
7454
+ const syncB = b;
7284
7455
  const critical = b.entries.filter((e) => e.severity === "critical").length;
7285
- output += ` Block ${blocks.length - limited.length + i + 1}: ${b.date} \u2014 ${b.entries.length} entries (${critical} critical)
7456
+ const signed = b.entries.filter((e) => e.signature).length;
7457
+ const authorPart = syncB.author ? ` \xB7 author: ${syncB.author}` : "";
7458
+ const sigPart = b.entries.length > 0 ? ` \xB7 ${signed}/${b.entries.length} Ed25519 signed` : "";
7459
+ output += ` Block ${blocks.length - limited.length + i + 1}: ${b.date} \u2014 ${b.entries.length} entries (${critical} critical)${authorPart}${sigPart}
7286
7460
  `;
7287
7461
  }
7288
7462
  output += "\n";
@@ -8586,7 +8760,7 @@ ${truncated}`;
8586
8760
  const goalId = input.goalId ? String(input.goalId).trim() : void 0;
8587
8761
  try {
8588
8762
  onProgress?.("Loading goals...");
8589
- const { getActiveGoals } = await import("./goal-validator-4DDL7NBP.js");
8763
+ const { getActiveGoals } = await import("./goal-validator-FJEDIYU7.js");
8590
8764
  const agentState = getProjectState(directory);
8591
8765
  await agentState.load();
8592
8766
  const allGoals = await getActiveGoals(directory);
@@ -8595,7 +8769,7 @@ ${truncated}`;
8595
8769
  return goalId ? `No active goal found with ID: ${goalId}` : "No active goals to check. Add goals in the Goals view first.";
8596
8770
  }
8597
8771
  onProgress?.("Scanning codebase for violations...");
8598
- const { analyzeFilesRapidly } = await import("./fast-analyzer-LLZ6FLP5.js");
8772
+ const { analyzeFilesRapidly } = await import("./fast-analyzer-54AHLVO5.js");
8599
8773
  const analysisOptions = {
8600
8774
  maxFiles: 50,
8601
8775
  enableSmartBatching: true
@@ -8609,7 +8783,7 @@ ${truncated}`;
8609
8783
  const cacheInfo2 = analysisResult.cacheHitRatio > 0 ? ` (${Math.round(analysisResult.cacheHitRatio * 100)}% cache hit, ${analysisResult.timeMs}ms)` : ` (${analysisResult.timeMs}ms)`;
8610
8784
  return `\u2713 Scan complete! No violations found for ${goalsToCheck.length} goal(s).${cacheInfo2}`;
8611
8785
  }
8612
- const { storeIssues: storeIssues2 } = await import("./issue-store-DUR5UTYK.js");
8786
+ const { storeIssues: storeIssues2 } = await import("./issue-store-FOS4T736.js");
8613
8787
  const { basename: basename2 } = await import("path");
8614
8788
  const issuesToStore = violations.map((v, i) => ({
8615
8789
  id: `goal-violation-${Date.now()}-${i}`,
@@ -8688,7 +8862,7 @@ ${truncated}`;
8688
8862
  }
8689
8863
  try {
8690
8864
  onProgress?.("Gathering evidence for hypothesis...");
8691
- const { gatherEvidenceForHypothesis } = await import("./hypothesis-RI3Q33JB.js");
8865
+ const { gatherEvidenceForHypothesis } = await import("./hypothesis-4KC7XRBZ.js");
8692
8866
  const evidence = await gatherEvidenceForHypothesis(hypothesisId, directory);
8693
8867
  if (evidence.length === 0) {
8694
8868
  return `No evidence found for this hypothesis yet. The codebase may not have enough data to validate it \u2014 try running trie_scan_for_goal_violations first to populate issues, or add more context.`;
@@ -9627,7 +9801,7 @@ ${content}
9627
9801
  fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
9628
9802
  }
9629
9803
  await writeFile2(fullPath, fixedContent, "utf-8");
9630
- const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-4DDL7NBP.js");
9804
+ const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-FJEDIYU7.js");
9631
9805
  const goals = await getActiveGoals(projectPath);
9632
9806
  const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
9633
9807
  if (matchedGoal) {
@@ -9743,7 +9917,7 @@ function DashboardApp({ onReady }) {
9743
9917
  const loadPersistedNudges = useCallback7(async () => {
9744
9918
  try {
9745
9919
  const workDir = getWorkingDirectory(void 0, true);
9746
- const { getStorage: getStorage2 } = await import("./tiered-storage-FHHAJR4P.js");
9920
+ const { getStorage: getStorage2 } = await import("./tiered-storage-OP74NPJY.js");
9747
9921
  const storage = getStorage2(workDir);
9748
9922
  await storage.initialize();
9749
9923
  const nudges = await storage.queryNudges({ resolved: false, limit: 50 });
@@ -10372,6 +10546,7 @@ var TrieWatchTool = class _TrieWatchTool {
10372
10546
  try {
10373
10547
  const storage = getStorage(directory);
10374
10548
  await storage.initialize();
10549
+ await this.validateAndCleanNudges(storage, directory);
10375
10550
  const unresolvedNudges = await storage.queryNudges({ resolved: false });
10376
10551
  console.debug(`[Watch] Found ${unresolvedNudges.length} unresolved nudges in storage`);
10377
10552
  for (const nudge of unresolvedNudges) {
@@ -10739,7 +10914,7 @@ ${f.content.slice(0, 1e3)}`
10739
10914
  async checkAndGenerateHypotheses(projectPath) {
10740
10915
  if (!isAIAvailable()) return;
10741
10916
  try {
10742
- const { getHypothesisEngine } = await import("./hypothesis-RI3Q33JB.js");
10917
+ const { getHypothesisEngine } = await import("./hypothesis-4KC7XRBZ.js");
10743
10918
  const { getOutputManager: getOutputManager2 } = await import("./output-manager-JNMEAXFO.js");
10744
10919
  const hypothesisEngine = getHypothesisEngine(projectPath);
10745
10920
  const recentIssues = Array.from(this.state.issueCache.values()).flat();
@@ -10804,7 +10979,7 @@ ${f.content.slice(0, 1e3)}`
10804
10979
  */
10805
10980
  async discoverPatternsFromIssues(projectPath) {
10806
10981
  try {
10807
- const { searchIssues } = await import("./issue-store-DUR5UTYK.js");
10982
+ const { searchIssues } = await import("./issue-store-FOS4T736.js");
10808
10983
  const allIssues = await searchIssues("", {
10809
10984
  workDir: projectPath,
10810
10985
  limit: 1e3,
@@ -10879,7 +11054,7 @@ ${f.content.slice(0, 1e3)}`
10879
11054
  }
10880
11055
  }
10881
11056
  if (patternsAdded > 0) {
10882
- const { exportToJson: exportToJson2 } = await import("./graph-B3NA4S7I.js");
11057
+ const { exportToJson: exportToJson2 } = await import("./sync-M2FSWPBC.js");
10883
11058
  await exportToJson2(graph);
10884
11059
  if (!isInteractiveMode()) {
10885
11060
  console.error(` [\u2713] Discovered ${patternsAdded} pattern(s) from ${allIssues.length} issues`);
@@ -10965,7 +11140,7 @@ ${f.content.slice(0, 1e3)}`
10965
11140
  if (remaining < 500) return;
10966
11141
  try {
10967
11142
  const graph = new ContextGraph(projectPath);
10968
- const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-4DDL7NBP.js");
11143
+ const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-FJEDIYU7.js");
10969
11144
  console.debug("[AI Watcher] Loading active goals...");
10970
11145
  const activeGoals = await getActiveGoals(projectPath);
10971
11146
  const hasGoals = activeGoals.length > 0;
@@ -11220,7 +11395,7 @@ ${filesBlock}`,
11220
11395
  const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
11221
11396
  console.debug("[Initial Hypothesis] Starting initial hypothesis generation", { projectPath });
11222
11397
  try {
11223
- const { getHypothesisEngine } = await import("./hypothesis-RI3Q33JB.js");
11398
+ const { getHypothesisEngine } = await import("./hypothesis-4KC7XRBZ.js");
11224
11399
  const hypothesisEngine = getHypothesisEngine(projectPath);
11225
11400
  console.debug("[Initial Hypothesis] Running AI-powered hypothesis generation...");
11226
11401
  const generated = await hypothesisEngine.generateHypothesesWithAI({
@@ -11278,7 +11453,7 @@ ${filesBlock}`,
11278
11453
  const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
11279
11454
  console.debug("[Initial Scan] Starting initial goal compliance scan", { projectPath });
11280
11455
  try {
11281
- const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-4DDL7NBP.js");
11456
+ const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-FJEDIYU7.js");
11282
11457
  const activeGoals = await getActiveGoals(projectPath);
11283
11458
  console.debug("[Initial Scan] Loaded goals for initial scan:", {
11284
11459
  goalCount: activeGoals.length,
@@ -11421,9 +11596,9 @@ ${filesBlock}`,
11421
11596
  this.streamingManager.reportLedgerUpdate(issuesToStore.length, "goal-violation");
11422
11597
  }
11423
11598
  }
11424
- const { resolveGoalViolation } = await import("./issue-store-DUR5UTYK.js");
11425
- const { recordGoalViolationFixed } = await import("./goal-validator-4DDL7NBP.js");
11426
- const scannedFiles = new Set(issues.map((i) => i.file));
11599
+ const { resolveGoalViolation } = await import("./issue-store-FOS4T736.js");
11600
+ const { recordGoalViolationFixed } = await import("./goal-validator-FJEDIYU7.js");
11601
+ const scannedFiles = new Set(valid.map((f) => f.path));
11427
11602
  const filesWithViolations = new Set(issuesToStore.map((i) => i.file));
11428
11603
  for (const scannedFile of scannedFiles) {
11429
11604
  if (!filesWithViolations.has(scannedFile)) {
@@ -11575,7 +11750,7 @@ Use \`trie_watch start\` to begin autonomous scanning.`
11575
11750
  ).join("\n");
11576
11751
  let agencyStatus = "";
11577
11752
  try {
11578
- const { getTrieAgent: getTrieAgent2 } = await import("./trie-agent-NYSPGZYS.js");
11753
+ const { getTrieAgent: getTrieAgent2 } = await import("./trie-agent-TM6ATSNR.js");
11579
11754
  const trieAgent = getTrieAgent2(this.watchedDirectory || getWorkingDirectory(void 0, true));
11580
11755
  await trieAgent.initialize();
11581
11756
  const status = await trieAgent.getAgencyStatus();
@@ -11724,6 +11899,53 @@ To get a full report, run \`trie watch\` on your codebase.`
11724
11899
  }]
11725
11900
  };
11726
11901
  }
11902
+ /**
11903
+ * Validate existing nudges and resolve ones that are no longer valid.
11904
+ * This runs at watch startup to clean up stale nudges.
11905
+ *
11906
+ * Type-agnostic auto-resolution strategy:
11907
+ * 1. Files that no longer exist -> resolve immediately
11908
+ * 2. Goals that are achieved/deleted -> resolve immediately
11909
+ * 3. All other nudges -> kept until next scan shows the file is clean
11910
+ *
11911
+ * The actual goal validation happens during scans - when a file is scanned
11912
+ * and no violations are found, existing nudges for that file are auto-resolved.
11913
+ */
11914
+ async validateAndCleanNudges(storage, directory) {
11915
+ let totalResolved = 0;
11916
+ try {
11917
+ const missingResolved = await storage.resolveNudgesForMissingFiles();
11918
+ if (missingResolved > 0) {
11919
+ totalResolved += missingResolved;
11920
+ console.log(`[Watch] Resolved ${missingResolved} nudge(s) for deleted files`);
11921
+ }
11922
+ } catch (e) {
11923
+ console.debug("[Watch] resolveNudgesForMissingFiles failed:", e);
11924
+ }
11925
+ try {
11926
+ const { getActiveGoals } = await import("./goal-validator-FJEDIYU7.js");
11927
+ const { getProjectState: getProjectState2 } = await import("./project-state-AHPA77SM.js");
11928
+ const projectState = getProjectState2(directory);
11929
+ await projectState.load();
11930
+ const allGoals = projectState.getAllGoals();
11931
+ const activeGoals = await getActiveGoals(directory);
11932
+ const activeGoalIds = new Set(activeGoals.map((g) => g.id));
11933
+ for (const goal of allGoals) {
11934
+ if (goal.status === "achieved" || !activeGoalIds.has(goal.id)) {
11935
+ const goalResolved = await storage.resolveNudgesForGoal(goal.description);
11936
+ if (goalResolved > 0) {
11937
+ totalResolved += goalResolved;
11938
+ console.log(`[Watch] Resolved ${goalResolved} nudge(s) for ${goal.status === "achieved" ? "achieved" : "inactive"} goal: "${goal.description.slice(0, 40)}..."`);
11939
+ }
11940
+ }
11941
+ }
11942
+ } catch (e) {
11943
+ console.debug("[Watch] Goal validation check failed:", e);
11944
+ }
11945
+ if (totalResolved > 0) {
11946
+ console.log(`[Watch] \u2713 Cleaned up ${totalResolved} stale nudge(s)`);
11947
+ }
11948
+ }
11727
11949
  };
11728
11950
 
11729
11951
  export {
@@ -11750,4 +11972,4 @@ export {
11750
11972
  InteractiveDashboard,
11751
11973
  TrieWatchTool
11752
11974
  };
11753
- //# sourceMappingURL=chunk-D6E4Q4I6.js.map
11975
+ //# sourceMappingURL=chunk-CDG2GVBP.js.map