@triedotdev/mcp 1.0.114 → 1.0.115

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.
@@ -278,10 +278,10 @@ var StreamingManager = class {
278
278
 
279
279
  // src/cli/dashboard/index.ts
280
280
  import { render } from "ink";
281
- import React10 from "react";
281
+ import React9 from "react";
282
282
 
283
283
  // src/cli/dashboard/App.tsx
284
- import { useState as useState3, useEffect as useEffect4, useCallback as useCallback6, useRef as useRef2 } from "react";
284
+ import { useState as useState2, useEffect as useEffect3, useCallback as useCallback6, useRef as useRef2 } from "react";
285
285
  import { Box as Box12, useInput as useInput8, useApp } from "ink";
286
286
 
287
287
  // src/cli/dashboard/state.tsx
@@ -447,6 +447,7 @@ function applyAgentConfigPatch(current, patch) {
447
447
  }
448
448
  if (patch.performance) config.performance = { ...config.performance, ...patch.performance };
449
449
  if (patch.riskThresholds) config.riskThresholds = { ...config.riskThresholds, ...patch.riskThresholds };
450
+ if (patch.aiWatcher) config.aiWatcher = { ...config.aiWatcher, ...patch.aiWatcher };
450
451
  return config;
451
452
  }
452
453
  function dashboardReducer(state, action) {
@@ -738,7 +739,8 @@ function createInitialState() {
738
739
  memoryRetentionDays: 30
739
740
  },
740
741
  performance: { parallel: true, cache: true, maxConcurrency: 4, timeoutMs: 12e4, workers: true, streaming: true },
741
- riskThresholds: { critical: 70, high: 40, medium: 20 }
742
+ riskThresholds: { critical: 70, high: 40, medium: 20 },
743
+ aiWatcher: { enabled: true, hourlyTokenLimit: 5e4, scanCooldownSec: 30, cleanFileCooldownSec: 300, maxFilesPerScan: 5, maxCharsPerFile: 4e3 }
742
744
  },
743
745
  goalsPanel: { goals: [], selectedIndex: 0, selectedAchievedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0 },
744
746
  hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0 },
@@ -765,48 +767,39 @@ import { readFile as readFile2, writeFile, mkdir } from "fs/promises";
765
767
  import { join as join2 } from "path";
766
768
 
767
769
  // src/cli/dashboard/components/Header.tsx
768
- import { useState, useEffect } from "react";
769
770
  import { Box, Text } from "ink";
770
771
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
771
- var WATCH_FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
772
772
  function Header() {
773
773
  const { state } = useDashboard();
774
774
  const { signalExtraction, watch, alerts } = state;
775
775
  const totalExtracted = signalExtraction.decisionsExtracted + signalExtraction.factsExtracted + signalExtraction.blockersExtracted + signalExtraction.questionsExtracted;
776
- const [frame, setFrame] = useState(0);
777
- useEffect(() => {
778
- if (!watch.watching) return;
779
- const id = setInterval(() => setFrame((f) => (f + 1) % WATCH_FRAMES.length), 150);
780
- return () => clearInterval(id);
781
- }, [watch.watching]);
782
- let statusLabel;
776
+ let status;
783
777
  if (watch.watching) {
784
- statusLabel = totalExtracted > 0 ? /* @__PURE__ */ jsxs(Text, { children: [
785
- /* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25C9" }),
778
+ status = totalExtracted > 0 ? /* @__PURE__ */ jsxs(Text, { children: [
779
+ /* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25CF" }),
780
+ " ",
781
+ /* @__PURE__ */ jsx2(Text, { color: "green", children: "Learning" }),
786
782
  " ",
787
- /* @__PURE__ */ jsx2(Text, { color: "green", bold: true, children: "Learning" }),
788
- " ",
789
783
  /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
790
784
  totalExtracted,
791
785
  " signals"
792
786
  ] })
793
787
  ] }) : /* @__PURE__ */ jsxs(Text, { children: [
794
- /* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25C9" }),
795
- " ",
796
- /* @__PURE__ */ jsx2(Text, { bold: true, children: "Watching" })
788
+ /* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25CF" }),
789
+ " Watching"
797
790
  ] });
798
791
  } else {
799
- statusLabel = /* @__PURE__ */ jsxs(Text, { children: [
792
+ status = /* @__PURE__ */ jsxs(Text, { children: [
800
793
  /* @__PURE__ */ jsx2(Text, { dimColor: true, children: "\u25CB" }),
801
794
  " ",
802
795
  /* @__PURE__ */ jsx2(Text, { dimColor: true, children: "Idle" })
803
796
  ] });
804
797
  }
805
798
  return /* @__PURE__ */ jsxs(Box, { paddingX: 1, justifyContent: "space-between", children: [
806
- /* @__PURE__ */ jsx2(Text, { color: "green", bold: true, children: "\u2B21 Trie" }),
799
+ /* @__PURE__ */ jsx2(Text, { bold: true, children: "Trie" }),
807
800
  /* @__PURE__ */ jsxs(Box, { gap: 2, children: [
808
- statusLabel,
809
- alerts.hasCritical && /* @__PURE__ */ jsx2(Text, { color: "red", bold: true, children: "\u2B22 Alert" })
801
+ status,
802
+ alerts.hasCritical && /* @__PURE__ */ jsx2(Text, { color: "red", bold: true, children: "\u25CF Alert" })
810
803
  ] })
811
804
  ] });
812
805
  }
@@ -824,35 +817,26 @@ var VIEW_LABELS = {
824
817
  chat: "Chat"
825
818
  };
826
819
  var TAB_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
820
+ var CONTEXT_HINTS = {
821
+ goals: "j/k nav \xB7 a add \xB7 enter complete \xB7 d delete",
822
+ hypotheses: "j/k nav \xB7 a add \xB7 v validate \xB7 x invalidate",
823
+ agent: "j/k nav \xB7 enter expand \xB7 d dismiss",
824
+ memory: "j/k nav \xB7 enter expand",
825
+ chat: "type to ask \xB7 enter send \xB7 esc clear",
826
+ rawlog: "n/p pages \xB7 b back"
827
+ };
827
828
  function Footer() {
828
829
  const { state } = useDashboard();
829
- const { view } = state;
830
- let contextHints;
831
- if (view === "goals" && state.goalsPanel.inputMode === "add") {
832
- contextHints = "enter save \xB7 esc cancel";
833
- } else if (view === "hypotheses" && state.hypothesesPanel.inputMode === "add") {
834
- contextHints = "enter save \xB7 esc cancel";
835
- } else if (view === "goals") {
836
- contextHints = "tab views \xB7 j/k nav \xB7 a add \xB7 enter complete \xB7 d delete";
837
- } else if (view === "hypotheses") {
838
- contextHints = "tab views \xB7 j/k nav \xB7 a add \xB7 v validate \xB7 x invalidate";
839
- } else if (view === "agent") {
840
- contextHints = "tab views \xB7 j/k nav \xB7 enter expand \xB7 d dismiss";
841
- } else if (view === "memory") {
842
- contextHints = "tab views \xB7 j/k nav \xB7 enter expand";
843
- } else if (view === "chat") {
844
- contextHints = "tab views \xB7 type to ask \xB7 enter send \xB7 esc clear";
845
- } else if (view === "rawlog") {
846
- contextHints = "tab views \xB7 n/p pages \xB7 b back";
847
- } else {
848
- contextHints = "tab views \xB7 n/p pages \xB7 s settings";
849
- }
850
- return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 1, children: [
851
- /* @__PURE__ */ jsxs2(Box2, { justifyContent: "space-between", children: [
852
- /* @__PURE__ */ jsx3(Box2, { gap: 1, children: TAB_VIEWS.map((v) => v === view ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children: VIEW_LABELS[v] }, v) : /* @__PURE__ */ jsx3(Text2, { children: VIEW_LABELS[v] }, v)) }),
853
- /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: "q quit" })
854
- ] }),
855
- /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: contextHints })
830
+ const { view, goalsPanel, hypothesesPanel } = state;
831
+ let hints = CONTEXT_HINTS[view] || "n/p pages \xB7 s settings";
832
+ if (view === "goals" && goalsPanel.inputMode === "add") hints = "enter save \xB7 esc cancel";
833
+ if (view === "hypotheses" && hypothesesPanel.inputMode === "add") hints = "enter save \xB7 esc cancel";
834
+ return /* @__PURE__ */ jsxs2(Box2, { paddingX: 1, justifyContent: "space-between", children: [
835
+ /* @__PURE__ */ jsx3(Box2, { gap: 1, children: TAB_VIEWS.map((v) => v === view ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children: VIEW_LABELS[v] }, v) : /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: VIEW_LABELS[v] }, v)) }),
836
+ /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
837
+ hints,
838
+ " \xB7 q quit"
839
+ ] })
856
840
  ] });
857
841
  }
858
842
 
@@ -864,46 +848,46 @@ function Notification() {
864
848
  const { notification } = state;
865
849
  if (!notification || !notification.active) return null;
866
850
  if (notification.autoHideAt && Date.now() > notification.autoHideAt) return null;
867
- const bgColor = notification.severity === "critical" ? "red" : notification.severity === "warning" ? "yellow" : "blue";
868
- const icon = notification.severity === "critical" ? "[!]" : notification.severity === "warning" ? "[!]" : "[>]";
851
+ const color = notification.severity === "critical" ? "red" : notification.severity === "warning" ? "yellow" : "blue";
869
852
  return /* @__PURE__ */ jsxs3(Box3, { paddingX: 1, children: [
870
- /* @__PURE__ */ jsx4(Text3, { backgroundColor: bgColor, color: "white", bold: true, children: ` ${icon} ${notification.message} ` }),
853
+ /* @__PURE__ */ jsx4(Text3, { color, bold: true, children: "\u25CF " }),
854
+ /* @__PURE__ */ jsx4(Text3, { children: notification.message }),
871
855
  notification.file && /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
872
- " (",
873
- notification.file,
874
- ")"
856
+ " ",
857
+ notification.file
875
858
  ] })
876
859
  ] });
877
860
  }
878
861
 
879
862
  // src/cli/dashboard/components/ConfigDialog.tsx
880
- import { useState as useState2 } from "react";
863
+ import { useState } from "react";
881
864
  import { Box as Box4, Text as Text4, useInput } from "ink";
882
865
  import { existsSync } from "fs";
883
866
  import { rm } from "fs/promises";
884
867
  import { join } from "path";
885
- import { Fragment, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
868
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
886
869
  function maskKey(key) {
887
870
  if (!key || key.length < 12) return "Not set";
888
871
  return key.slice(0, 7) + "..." + key.slice(-4);
889
872
  }
890
873
  function ConfigDialog({ onClose }) {
891
874
  const { state, dispatch } = useDashboard();
892
- const [section, setSection] = useState2("main");
893
- const [selectedIndex, setSelectedIndex] = useState2(0);
894
- const [editing, setEditing] = useState2(false);
895
- const [editBuffer, setEditBuffer] = useState2("");
896
- const [editIsText, setEditIsText] = useState2(false);
897
- const [showConfirmClear, setShowConfirmClear] = useState2(false);
898
- const [clearingMemory, setClearingMemory] = useState2(false);
875
+ const [section, setSection] = useState("main");
876
+ const [selectedIndex, setSelectedIndex] = useState(0);
877
+ const [editing, setEditing] = useState(false);
878
+ const [editBuffer, setEditBuffer] = useState("");
879
+ const [editIsText, setEditIsText] = useState(false);
880
+ const [showConfirmClear, setShowConfirmClear] = useState(false);
881
+ const [clearingMemory, setClearingMemory] = useState(false);
899
882
  const config = state.agentConfig;
900
883
  const currentKeyDisplay = isAIAvailable() ? maskKey(getKeyFromKeychain() || process.env.ANTHROPIC_API_KEY || null) : "Not set";
901
884
  const keyActive = isAIAvailable();
902
885
  const mainMenu = [
903
886
  { label: "API Keys", key: "apiKeys", value: keyActive ? "Active" : "Not set", section: "main" },
904
- { label: "Performance Settings", key: "performance", value: `${config.performance.maxConcurrency} concurrent`, section: "main" },
887
+ { label: "AI Watcher", key: "aiWatcher", value: config.aiWatcher.enabled ? `${(config.aiWatcher.hourlyTokenLimit / 1e3).toFixed(0)}k/hr` : "Off", section: "main" },
888
+ { label: "Performance", key: "performance", value: `${config.performance.maxConcurrency} concurrent`, section: "main" },
905
889
  { label: "Risk Thresholds", key: "riskThresholds", value: `critical: ${config.riskThresholds.critical}%`, section: "main" },
906
- { label: "Memory Management", key: "memory", value: "Clear & Reset", section: "main" }
890
+ { label: "Memory", key: "memory", value: "Clear & Reset", section: "main" }
907
891
  ];
908
892
  const apiKeysItems = [
909
893
  { label: "Anthropic", key: "anthropic", value: currentKeyDisplay, section: "apiKeys" }
@@ -916,14 +900,22 @@ function ConfigDialog({ onClose }) {
916
900
  { label: "Workers", key: "workers", value: config.performance.workers ? "on" : "off", section: "performance" }
917
901
  ];
918
902
  const riskItems = [
919
- { label: "Critical Threshold", key: "critical", value: String(config.riskThresholds.critical), section: "riskThresholds" },
920
- { label: "High Threshold", key: "high", value: String(config.riskThresholds.high), section: "riskThresholds" },
921
- { label: "Medium Threshold", key: "medium", value: String(config.riskThresholds.medium), section: "riskThresholds" }
903
+ { label: "Critical", key: "critical", value: String(config.riskThresholds.critical), section: "riskThresholds" },
904
+ { label: "High", key: "high", value: String(config.riskThresholds.high), section: "riskThresholds" },
905
+ { label: "Medium", key: "medium", value: String(config.riskThresholds.medium), section: "riskThresholds" }
906
+ ];
907
+ const aiWatcherItems = [
908
+ { label: "Enabled", key: "enabled", value: config.aiWatcher.enabled ? "on" : "off", section: "aiWatcher" },
909
+ { label: "Token Budget /hr", key: "hourlyTokenLimit", value: String(config.aiWatcher.hourlyTokenLimit), section: "aiWatcher" },
910
+ { label: "Scan Cooldown (s)", key: "scanCooldownSec", value: String(config.aiWatcher.scanCooldownSec), section: "aiWatcher" },
911
+ { label: "Clean Cooldown (s)", key: "cleanFileCooldownSec", value: String(config.aiWatcher.cleanFileCooldownSec), section: "aiWatcher" },
912
+ { label: "Max Files/Scan", key: "maxFilesPerScan", value: String(config.aiWatcher.maxFilesPerScan), section: "aiWatcher" },
913
+ { label: "Max Chars/File", key: "maxCharsPerFile", value: String(config.aiWatcher.maxCharsPerFile), section: "aiWatcher" }
922
914
  ];
923
915
  const memoryItems = [
924
916
  { label: "Clear All Memory", key: "clearAll", value: "Reset ledger, context graph", section: "memory" }
925
917
  ];
926
- const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "memory" ? memoryItems : mainMenu;
918
+ const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "aiWatcher" ? aiWatcherItems : section === "memory" ? memoryItems : mainMenu;
927
919
  useInput((_input, key) => {
928
920
  if (showConfirmClear) {
929
921
  if (_input === "y" || _input === "Y") {
@@ -966,10 +958,12 @@ function ConfigDialog({ onClose }) {
966
958
  }
967
959
  } else if (section === "riskThresholds") {
968
960
  patch.riskThresholds = { ...config.riskThresholds, [item.key]: val };
961
+ } else if (section === "aiWatcher") {
962
+ patch.aiWatcher = { ...config.aiWatcher, [item.key]: val };
969
963
  }
970
964
  if (Object.keys(patch).length > 0) {
971
965
  dispatch({ type: "SET_AGENT_CONFIG", config: patch });
972
- dispatch({ type: "ADD_ACTIVITY", message: `Config: ${item.label} set to ${val}` });
966
+ dispatch({ type: "ADD_ACTIVITY", message: `${item.label} set to ${val}` });
973
967
  }
974
968
  }
975
969
  }
@@ -1017,7 +1011,13 @@ function ConfigDialog({ onClose }) {
1017
1011
  } else {
1018
1012
  const item = items[selectedIndex];
1019
1013
  if (item) {
1020
- if (["parallel", "cache", "workers"].includes(item.key)) {
1014
+ if (section === "aiWatcher" && item.key === "enabled") {
1015
+ const patch = {
1016
+ aiWatcher: { ...config.aiWatcher, enabled: !config.aiWatcher.enabled }
1017
+ };
1018
+ dispatch({ type: "SET_AGENT_CONFIG", config: patch });
1019
+ dispatch({ type: "ADD_ACTIVITY", message: `AI Watcher ${!config.aiWatcher.enabled ? "enabled" : "disabled"}` });
1020
+ } else if (["parallel", "cache", "workers"].includes(item.key)) {
1021
1021
  const patch = {
1022
1022
  performance: { ...config.performance, [item.key]: !config.performance[item.key] }
1023
1023
  };
@@ -1030,7 +1030,7 @@ function ConfigDialog({ onClose }) {
1030
1030
  }
1031
1031
  }
1032
1032
  });
1033
- const sectionTitle = section === "main" ? "TRIE CONFIGURATION" : section === "apiKeys" ? "API KEYS" : section === "performance" ? "PERFORMANCE SETTINGS" : section === "riskThresholds" ? "RISK THRESHOLDS" : section === "memory" ? "MEMORY MANAGEMENT" : "CONFIGURATION";
1033
+ const sectionTitle = section === "main" ? "Settings" : section === "apiKeys" ? "API Keys" : section === "aiWatcher" ? "AI Watcher" : section === "performance" ? "Performance" : section === "riskThresholds" ? "Risk Thresholds" : section === "memory" ? "Memory" : "Settings";
1034
1034
  async function clearMemory() {
1035
1035
  const workDir = getWorkingDirectory(void 0, true);
1036
1036
  const trieDir = getTrieDirectory(workDir);
@@ -1047,85 +1047,59 @@ function ConfigDialog({ onClose }) {
1047
1047
  }
1048
1048
  }
1049
1049
  }
1050
- return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 1, paddingY: 0, children: [
1050
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 1, children: [
1051
1051
  /* @__PURE__ */ jsx5(Text4, { bold: true, children: sectionTitle }),
1052
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1053
- showConfirmClear && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", borderStyle: "round", borderColor: "red", paddingX: 1, paddingY: 0, children: [
1054
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1055
- /* @__PURE__ */ jsx5(Text4, { bold: true, color: "red", children: "\u2B22 CONFIRM MEMORY CLEAR" }),
1056
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1057
- /* @__PURE__ */ jsx5(Text4, { children: "This will permanently delete:" }),
1058
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Risk Hotspots (context graph)" }),
1059
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Decisions ledger" }),
1060
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Incidents" }),
1061
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Issue store" }),
1062
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Guardian insights" }),
1063
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1064
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "Preserved: Goals, hypotheses, and config" }),
1065
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1066
- clearingMemory ? /* @__PURE__ */ jsx5(Text4, { color: "yellow", children: "\u25C9 Clearing memory..." }) : /* @__PURE__ */ jsx5(Text4, { children: /* @__PURE__ */ jsx5(Text4, { bold: true, children: "Type 'y' to confirm, 'n' to cancel" }) }),
1067
- /* @__PURE__ */ jsx5(Text4, { children: " " })
1068
- ] }),
1069
- !showConfirmClear && section === "memory" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
1070
- /* @__PURE__ */ jsxs4(Text4, { children: [
1052
+ showConfirmClear && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1053
+ /* @__PURE__ */ jsx5(Text4, { color: "red", bold: true, children: "Clear all memory?" }),
1054
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Risk hotspots, decisions, incidents, insights" }),
1055
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Goals, hypotheses, and config are preserved" }),
1056
+ clearingMemory ? /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Clearing..." }) : /* @__PURE__ */ jsxs4(Text4, { children: [
1071
1057
  " ",
1072
- /* @__PURE__ */ jsx5(Text4, { bold: true, children: "Clear All Memory" })
1073
- ] }),
1074
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1075
- /* @__PURE__ */ jsx5(Text4, { children: "Reset your Trie memory to start fresh:" }),
1076
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Risk hotspots" }),
1077
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Decisions ledger" }),
1078
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Incidents" }),
1079
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Issue database" }),
1080
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Insights" }),
1081
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1082
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "Preserves: Goals, hypotheses, config, API keys" }),
1083
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1084
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter clear memory esc back" })
1058
+ /* @__PURE__ */ jsx5(Text4, { bold: true, children: "y" }),
1059
+ " confirm ",
1060
+ /* @__PURE__ */ jsx5(Text4, { bold: true, children: "n" }),
1061
+ " cancel"
1062
+ ] })
1085
1063
  ] }),
1086
- !showConfirmClear && section === "apiKeys" && !editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
1064
+ !showConfirmClear && section === "memory" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1065
+ /* @__PURE__ */ jsx5(Text4, { children: " Clear All Memory" }),
1066
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Reset ledger, context graph, issue store" }),
1067
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to clear \xB7 esc back" })
1068
+ ] }),
1069
+ !showConfirmClear && section === "apiKeys" && !editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1087
1070
  /* @__PURE__ */ jsxs4(Text4, { children: [
1088
1071
  " ",
1089
- /* @__PURE__ */ jsx5(Text4, { bold: true, children: "Anthropic:" }),
1090
- " ",
1091
- /* @__PURE__ */ jsx5(Text4, { children: currentKeyDisplay }),
1072
+ "Anthropic: ",
1073
+ currentKeyDisplay,
1092
1074
  " ",
1093
1075
  keyActive ? /* @__PURE__ */ jsx5(Text4, { color: "green", children: "\u25CF Active" }) : /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "\u25CB Not set" })
1094
1076
  ] }),
1095
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1096
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to update esc back" })
1077
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to update \xB7 esc back" })
1097
1078
  ] }),
1098
- !showConfirmClear && section === "apiKeys" && editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
1099
- /* @__PURE__ */ jsx5(Box4, { borderStyle: "round", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs4(Text4, { children: [
1079
+ !showConfirmClear && section === "apiKeys" && editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1080
+ /* @__PURE__ */ jsx5(Box4, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs4(Text4, { children: [
1100
1081
  editBuffer || /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "sk-ant-..." }),
1101
1082
  /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "|" })
1102
1083
  ] }) }),
1084
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter save \xB7 esc cancel" })
1085
+ ] }),
1086
+ !showConfirmClear && section !== "apiKeys" && section !== "memory" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
1087
+ items.map((item, idx) => {
1088
+ const isSelected = selectedIndex === idx;
1089
+ return /* @__PURE__ */ jsxs4(Text4, { children: [
1090
+ isSelected ? /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "> " }) : " ",
1091
+ /* @__PURE__ */ jsx5(Text4, { bold: isSelected, children: item.label }),
1092
+ /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " " }),
1093
+ editing && isSelected ? /* @__PURE__ */ jsxs4(Text4, { children: [
1094
+ editBuffer,
1095
+ /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "|" })
1096
+ ] }) : /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: item.value })
1097
+ ] }, item.key);
1098
+ }),
1103
1099
  /* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
1104
- " enter save (",
1105
- process.platform === "darwin" ? "keychain" : "config",
1106
- ") esc cancel"
1100
+ " ",
1101
+ section === "main" ? "enter select \xB7 esc close" : "enter edit \xB7 esc back"
1107
1102
  ] })
1108
- ] }),
1109
- !showConfirmClear && section !== "apiKeys" && section !== "memory" && items.map((item, idx) => {
1110
- const isSelected = selectedIndex === idx;
1111
- return /* @__PURE__ */ jsxs4(Text4, { children: [
1112
- isSelected ? /* @__PURE__ */ jsxs4(Text4, { bold: true, color: "green", children: [
1113
- ">",
1114
- " "
1115
- ] }) : /* @__PURE__ */ jsx5(Text4, { children: " " }),
1116
- /* @__PURE__ */ jsxs4(Text4, { bold: isSelected, children: [
1117
- item.label,
1118
- ": "
1119
- ] }),
1120
- editing && isSelected ? /* @__PURE__ */ jsxs4(Text4, { children: [
1121
- editBuffer,
1122
- /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "|" })
1123
- ] }) : /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: item.value })
1124
- ] }, item.key);
1125
- }),
1126
- !showConfirmClear && section !== "apiKeys" && section !== "memory" && /* @__PURE__ */ jsxs4(Fragment, { children: [
1127
- /* @__PURE__ */ jsx5(Text4, { children: " " }),
1128
- /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: section === "main" ? "enter select \xB7 esc close" : "enter edit \xB7 esc/b back" })
1129
1103
  ] })
1130
1104
  ] });
1131
1105
  }
@@ -1144,76 +1118,58 @@ function OverviewView() {
1144
1118
  const startIdx = activityPage * activityRows;
1145
1119
  const pageActivities = activityLog.slice(startIdx, startIdx + activityRows);
1146
1120
  return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 1, children: [
1147
- /* @__PURE__ */ jsxs5(Text5, { children: [
1148
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "\u25CF" }),
1149
- " Scanned ",
1150
- /* @__PURE__ */ jsx6(Text5, { bold: true, children: watch.filesScannedSession }),
1151
- " files this session ",
1152
- /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1153
- elapsed,
1154
- "s"
1155
- ] })
1121
+ /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1122
+ "Scanned ",
1123
+ watch.filesScannedSession,
1124
+ " files ",
1125
+ elapsed,
1126
+ "s"
1156
1127
  ] }),
1157
- watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
1158
- /* @__PURE__ */ jsxs5(Text5, { children: [
1159
- /* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
1160
- " Signal extraction ",
1161
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "enabled" })
1162
- ] }),
1163
- (signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs5(Text5, { children: [
1128
+ watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs5(Text5, { children: [
1129
+ /* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
1130
+ " Signal extraction",
1131
+ (signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1164
1132
  " ",
1165
- /* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CB" }),
1166
- " ",
1167
- /* @__PURE__ */ jsx6(Text5, { bold: true, children: signalExtraction.decisionsExtracted }),
1168
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " decisions" }),
1169
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " \xB7 " }),
1170
- /* @__PURE__ */ jsx6(Text5, { bold: true, children: signalExtraction.factsExtracted }),
1171
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " facts" }),
1172
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " \xB7 " }),
1173
- /* @__PURE__ */ jsx6(Text5, { bold: true, children: signalExtraction.blockersExtracted }),
1174
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " blockers" })
1133
+ signalExtraction.decisionsExtracted,
1134
+ " decisions \xB7 ",
1135
+ signalExtraction.factsExtracted,
1136
+ " facts \xB7 ",
1137
+ signalExtraction.blockersExtracted,
1138
+ " blockers"
1175
1139
  ] })
1176
1140
  ] }),
1177
- criticalIssues.length > 0 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
1178
- /* @__PURE__ */ jsx6(Text5, { children: " " }),
1179
- criticalIssues.map((issue, i) => {
1180
- const filename = issue.file.split("/").pop() || issue.file;
1181
- const lineNum = issue.line ? `:${issue.line}` : "";
1182
- const desc = issue.issue.slice(0, 50) + (issue.issue.length > 50 ? "..." : "");
1183
- return /* @__PURE__ */ jsxs5(Text5, { children: [
1184
- /* @__PURE__ */ jsx6(Text5, { color: "red", children: "\u25CF" }),
1185
- " ",
1186
- /* @__PURE__ */ jsx6(Text5, { color: "red", children: desc }),
1187
- /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1188
- " ",
1189
- filename,
1190
- lineNum
1191
- ] })
1192
- ] }, i);
1193
- })
1194
- ] }),
1141
+ criticalIssues.length > 0 && criticalIssues.map((issue, i) => {
1142
+ const filename = issue.file.split("/").pop() || issue.file;
1143
+ const lineNum = issue.line ? `:${issue.line}` : "";
1144
+ return /* @__PURE__ */ jsxs5(Text5, { children: [
1145
+ /* @__PURE__ */ jsx6(Text5, { color: "red", children: "\u25CF" }),
1146
+ " ",
1147
+ /* @__PURE__ */ jsx6(Text5, { color: "red", children: issue.issue.slice(0, 55) }),
1148
+ /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
1149
+ " ",
1150
+ filename,
1151
+ lineNum
1152
+ ] })
1153
+ ] }, i);
1154
+ }),
1195
1155
  totalIssues === 0 && criticalIssues.length === 0 && /* @__PURE__ */ jsxs5(Text5, { children: [
1196
1156
  /* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
1197
- " No issues found"
1157
+ " No issues"
1198
1158
  ] }),
1199
1159
  /* @__PURE__ */ jsx6(Text5, { children: " " }),
1200
- /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
1201
- /* @__PURE__ */ jsx6(Text5, { bold: true, children: "Activity" }),
1202
- pageActivities.map((entry, i) => /* @__PURE__ */ jsxs5(Text5, { children: [
1203
- " ",
1204
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "\u25CF" }),
1205
- " ",
1206
- entry.message,
1207
- " ",
1208
- /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: entry.time })
1209
- ] }, i)),
1210
- pageActivities.length === 0 && /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " No activity yet." })
1211
- ] })
1160
+ /* @__PURE__ */ jsx6(Text5, { bold: true, children: "Activity" }),
1161
+ pageActivities.map((entry, i) => /* @__PURE__ */ jsxs5(Text5, { children: [
1162
+ " ",
1163
+ /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: entry.time }),
1164
+ " ",
1165
+ entry.message
1166
+ ] }, i)),
1167
+ pageActivities.length === 0 && /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " No activity yet" })
1212
1168
  ] });
1213
1169
  }
1214
1170
 
1215
1171
  // src/cli/dashboard/views/AgentView.tsx
1216
- import { useEffect as useEffect2, useCallback } from "react";
1172
+ import { useEffect, useCallback } from "react";
1217
1173
  import { Box as Box6, Text as Text6, useInput as useInput2 } from "ink";
1218
1174
 
1219
1175
  // src/cli/dashboard/theme.ts
@@ -1283,26 +1239,21 @@ function AgentView() {
1283
1239
  dispatch({ type: "ADD_ACTIVITY", message: "Agent brain load error" });
1284
1240
  }
1285
1241
  }, [dispatch]);
1286
- useEffect2(() => {
1242
+ useEffect(() => {
1287
1243
  if (!loaded) {
1288
1244
  void loadBrain();
1289
1245
  }
1290
1246
  }, [loaded, loadBrain]);
1291
1247
  useInput2((input, key) => {
1292
- if (key.upArrow || input === "k") {
1293
- dispatch({ type: "NAVIGATE_UP" });
1294
- } else if (key.downArrow || input === "j") {
1295
- dispatch({ type: "NAVIGATE_DOWN" });
1296
- } else if (key.return) {
1297
- dispatch({ type: "TOGGLE_INSIGHT", index: selectedInsight });
1298
- } else if (input === "d") {
1299
- dispatch({ type: "DISMISS_INSIGHT", index: selectedInsight });
1300
- }
1248
+ if (key.upArrow || input === "k") dispatch({ type: "NAVIGATE_UP" });
1249
+ else if (key.downArrow || input === "j") dispatch({ type: "NAVIGATE_DOWN" });
1250
+ else if (key.return) dispatch({ type: "TOGGLE_INSIGHT", index: selectedInsight });
1251
+ else if (input === "d") dispatch({ type: "DISMISS_INSIGHT", index: selectedInsight });
1301
1252
  });
1302
1253
  const alertCount = alerts.length;
1303
1254
  const decCount = decisions.length;
1304
1255
  const patCount = patterns.length;
1305
- if (alertCount === 0 && decCount === 0 && patCount === 0 && !loaded) {
1256
+ if (!loaded) {
1306
1257
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
1307
1258
  /* @__PURE__ */ jsx7(Text6, { bold: true, children: "Nudges" }),
1308
1259
  /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Loading..." })
@@ -1311,108 +1262,80 @@ function AgentView() {
1311
1262
  if (alertCount === 0 && decCount === 0 && patCount === 0) {
1312
1263
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
1313
1264
  /* @__PURE__ */ jsx7(Text6, { bold: true, children: "Nudges" }),
1314
- /* @__PURE__ */ jsx7(Text6, { children: " " }),
1315
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " No nudges yet." }),
1316
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Trie will alert you here when it spots issues in your code." })
1265
+ /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " No nudges yet. Trie will alert you here when it spots issues." })
1317
1266
  ] });
1318
1267
  }
1319
- const confidentPatterns = patterns.filter((p) => p.confidence > 0.7).length;
1320
- const learningPatterns = patterns.filter((p) => p.confidence <= 0.7).length;
1321
1268
  return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
1322
1269
  /* @__PURE__ */ jsxs6(Text6, { children: [
1323
1270
  /* @__PURE__ */ jsx7(Text6, { bold: true, children: "Nudges" }),
1324
- " ",
1325
1271
  /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1326
- alertCount,
1327
- " alert",
1328
- alertCount !== 1 ? "s" : "",
1329
1272
  " ",
1273
+ alertCount,
1274
+ " alerts \xB7 ",
1330
1275
  decCount,
1331
- " decision",
1332
- decCount !== 1 ? "s" : "",
1333
- " ",
1276
+ " decisions \xB7 ",
1334
1277
  patCount,
1335
- " pattern",
1336
- patCount !== 1 ? "s" : ""
1278
+ " patterns"
1337
1279
  ] })
1338
1280
  ] }),
1339
- /* @__PURE__ */ jsx7(Text6, { children: " " }),
1340
- alertCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1341
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: " Alerts" }),
1342
- alerts.map((insight, idx) => {
1343
- const isSelected = idx === selectedInsight;
1344
- const isExpanded = idx === expandedInsight;
1345
- const ago = formatTimeAgo(insight.timestamp);
1346
- const msg = insight.message.slice(0, 60) + (insight.message.length > 60 ? "..." : "");
1347
- const riskColor = insight.priority >= 8 ? "red" : insight.priority >= 5 ? "yellow" : void 0;
1348
- return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1349
- /* @__PURE__ */ jsxs6(Text6, { children: [
1350
- isSelected ? /* @__PURE__ */ jsxs6(Text6, { bold: true, color: "green", children: [
1351
- ">",
1352
- " "
1353
- ] }) : /* @__PURE__ */ jsx7(Text6, { children: " " }),
1354
- riskColor ? /* @__PURE__ */ jsx7(Text6, { color: riskColor, children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
1355
- " ",
1356
- isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, children: msg }) : /* @__PURE__ */ jsx7(Text6, { children: msg }),
1281
+ alertCount > 0 && /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", marginTop: 1, children: alerts.map((insight, idx) => {
1282
+ const isSelected = idx === selectedInsight;
1283
+ const isExpanded = idx === expandedInsight;
1284
+ const ago = formatTimeAgo(insight.timestamp);
1285
+ const msg = insight.message.slice(0, 60) + (insight.message.length > 60 ? "..." : "");
1286
+ const riskColor = insight.priority >= 8 ? "red" : insight.priority >= 5 ? "yellow" : void 0;
1287
+ return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1288
+ /* @__PURE__ */ jsxs6(Text6, { children: [
1289
+ isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, color: "green", children: "> " }) : " ",
1290
+ riskColor ? /* @__PURE__ */ jsx7(Text6, { color: riskColor, children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
1291
+ " ",
1292
+ isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, children: msg }) : /* @__PURE__ */ jsx7(Text6, { children: msg }),
1293
+ /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1357
1294
  " ",
1358
- /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1359
- insight.category,
1360
- " \xB7 ",
1361
- ago
1362
- ] })
1363
- ] }),
1364
- (isExpanded || isSelected) && insight.suggestedAction && /* @__PURE__ */ jsxs6(Text6, { children: [
1365
- " ",
1366
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u2192" }),
1367
- " ",
1368
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: insight.suggestedAction })
1295
+ insight.category,
1296
+ " \xB7 ",
1297
+ ago
1369
1298
  ] })
1370
- ] }, insight.id);
1371
- }),
1372
- /* @__PURE__ */ jsx7(Text6, { children: " " })
1373
- ] }),
1374
- decCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1375
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: " Decisions" }),
1299
+ ] }),
1300
+ (isExpanded || isSelected) && insight.suggestedAction && /* @__PURE__ */ jsxs6(Text6, { children: [
1301
+ " ",
1302
+ /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1303
+ "->",
1304
+ " "
1305
+ ] }),
1306
+ /* @__PURE__ */ jsx7(Text6, { children: insight.suggestedAction })
1307
+ ] })
1308
+ ] }, insight.id);
1309
+ }) }),
1310
+ decCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
1311
+ /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Decisions" }),
1376
1312
  decisions.slice(0, 10).map((dec) => {
1377
1313
  const ago = timeAgo(dec.when);
1378
- const hash = dec.hash ? dec.hash.slice(0, 6) : "";
1379
1314
  const active = dec.status === "active";
1380
1315
  return /* @__PURE__ */ jsxs6(Text6, { children: [
1381
1316
  " ",
1382
1317
  active ? /* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
1383
1318
  " ",
1384
- /* @__PURE__ */ jsxs6(Text6, { children: [
1385
- dec.decision.slice(0, 45),
1386
- dec.decision.length > 45 ? "..." : ""
1387
- ] }),
1388
- " ",
1389
- /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: ago }),
1390
- hash && /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1319
+ dec.decision.slice(0, 50),
1320
+ dec.decision.length > 50 ? "..." : "",
1321
+ /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1391
1322
  " ",
1392
- hash
1323
+ ago
1393
1324
  ] })
1394
1325
  ] }, dec.id);
1395
- }),
1396
- /* @__PURE__ */ jsx7(Text6, { children: " " })
1326
+ })
1397
1327
  ] }),
1398
- patCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
1399
- /* @__PURE__ */ jsx7(Text6, { bold: true, children: " Patterns" }),
1400
- confidentPatterns > 0 && /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1401
- " ",
1402
- confidentPatterns,
1403
- " confident ",
1404
- learningPatterns,
1405
- " learning"
1406
- ] }),
1328
+ patCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
1329
+ /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Patterns" }),
1407
1330
  patterns.slice(0, 8).map((pat, idx) => {
1408
1331
  const conf = Math.round(pat.confidence * 100);
1409
1332
  const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
1410
- const desc = pat.description.slice(0, 45) + (pat.description.length > 45 ? "..." : "");
1411
1333
  return /* @__PURE__ */ jsxs6(Text6, { children: [
1412
1334
  " ",
1413
1335
  pat.isAntiPattern ? /* @__PURE__ */ jsx7(Text6, { color: "red", children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
1414
1336
  " ",
1415
- /* @__PURE__ */ jsx7(Text6, { children: desc }),
1337
+ pat.description.slice(0, 48),
1338
+ pat.description.length > 48 ? "..." : "",
1416
1339
  " ",
1417
1340
  confColor ? /* @__PURE__ */ jsxs6(Text6, { color: confColor, children: [
1418
1341
  conf,
@@ -1420,18 +1343,16 @@ function AgentView() {
1420
1343
  ] }) : /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
1421
1344
  conf,
1422
1345
  "%"
1423
- ] }),
1424
- pat.isAntiPattern && /* @__PURE__ */ jsx7(Text6, { color: "red", children: " anti-pattern" })
1346
+ ] })
1425
1347
  ] }, idx);
1426
1348
  })
1427
1349
  ] }),
1428
- /* @__PURE__ */ jsx7(Text6, { children: " " }),
1429
- /* @__PURE__ */ jsxs6(Box6, { gap: 2, children: [
1350
+ /* @__PURE__ */ jsxs6(Box6, { marginTop: 1, gap: 2, children: [
1430
1351
  isAIAvailable() ? /* @__PURE__ */ jsxs6(Text6, { children: [
1431
1352
  /* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }),
1432
1353
  " ",
1433
1354
  /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "AI" })
1434
- ] }) : /* @__PURE__ */ jsx7(Text6, { children: /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB AI off" }) }),
1355
+ ] }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB AI off" }),
1435
1356
  agentInsights.filter((i) => i.type === "celebration").length > 0 && /* @__PURE__ */ jsxs6(Text6, { children: [
1436
1357
  /* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }),
1437
1358
  " ",
@@ -1447,7 +1368,7 @@ function AgentView() {
1447
1368
  // src/cli/dashboard/views/GoalsView.tsx
1448
1369
  import { useCallback as useCallback2 } from "react";
1449
1370
  import { Box as Box7, Text as Text7, useInput as useInput3 } from "ink";
1450
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1371
+ import { Fragment, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1451
1372
  function calculateGoalProgress(goal) {
1452
1373
  if (goal.target <= 0) return 0;
1453
1374
  const startValue = goal.startValue ?? goal.currentValue;
@@ -1575,50 +1496,35 @@ function GoalsView() {
1575
1496
  }
1576
1497
  });
1577
1498
  return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
1578
- /* @__PURE__ */ jsxs7(Text7, { children: [
1579
- /* @__PURE__ */ jsx8(Text7, { bold: true, children: "Goals" }),
1580
- " ",
1581
- /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "Track progress, achieve targets" })
1582
- ] }),
1583
- /* @__PURE__ */ jsx8(Text7, { children: " " }),
1584
- goalsPanel.inputMode === "add" ? /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1585
- /* @__PURE__ */ jsx8(Box7, { borderStyle: "round", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs7(Text7, { children: [
1499
+ /* @__PURE__ */ jsx8(Text7, { bold: true, children: "Goals" }),
1500
+ goalsPanel.inputMode === "add" ? /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
1501
+ /* @__PURE__ */ jsx8(Box7, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs7(Text7, { children: [
1586
1502
  goalsPanel.inputBuffer,
1587
1503
  /* @__PURE__ */ jsx8(Text7, { bold: true, color: "green", children: "|" })
1588
1504
  ] }) }),
1589
1505
  /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " enter save \xB7 esc cancel" })
1590
- ] }) : /* @__PURE__ */ jsx8(Fragment2, { children: goalsPanel.goals.length === 0 ? /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1591
- /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " No goals yet." }),
1592
- /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Press a to add your first goal." })
1593
- ] }) : /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1594
- activeGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1595
- activeGoals.map((goal, idx) => {
1596
- const isSelected = goalsPanel.selectedIndex === idx;
1597
- const progress = calculateGoalProgress(goal);
1598
- const bar = progressBar(progress, 100, 8);
1599
- const source = goal.autoGenerated ? "auto" : "manual";
1600
- return /* @__PURE__ */ jsxs7(Text7, { children: [
1601
- isSelected ? /* @__PURE__ */ jsxs7(Text7, { bold: true, color: "green", children: [
1602
- ">",
1603
- " "
1604
- ] }) : /* @__PURE__ */ jsx8(Text7, { children: " " }),
1605
- /* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CB" }),
1506
+ ] }) : /* @__PURE__ */ jsx8(Fragment, { children: goalsPanel.goals.length === 0 ? /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " No goals yet. Press a to add one." }) : /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1507
+ activeGoals.map((goal, idx) => {
1508
+ const isSelected = goalsPanel.selectedIndex === idx;
1509
+ const progress = calculateGoalProgress(goal);
1510
+ const bar = progressBar(progress, 100, 8);
1511
+ const source = goal.autoGenerated ? "auto" : "";
1512
+ return /* @__PURE__ */ jsxs7(Text7, { children: [
1513
+ isSelected ? /* @__PURE__ */ jsx8(Text7, { bold: true, color: "green", children: "> " }) : " ",
1514
+ /* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CB" }),
1515
+ " ",
1516
+ goal.description.slice(0, 45),
1517
+ /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
1518
+ " ",
1519
+ bar,
1606
1520
  " ",
1607
- goal.description.slice(0, 45),
1608
- /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
1609
- " ",
1610
- source,
1611
- " ",
1612
- bar,
1613
- " ",
1614
- progress,
1615
- "%"
1616
- ] })
1617
- ] }, goal.id);
1618
- }),
1619
- /* @__PURE__ */ jsx8(Text7, { children: " " })
1620
- ] }),
1621
- achievedGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1521
+ progress,
1522
+ "%",
1523
+ source ? ` ${source}` : ""
1524
+ ] })
1525
+ ] }, goal.id);
1526
+ }),
1527
+ achievedGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
1622
1528
  /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Achieved" }),
1623
1529
  achievedGoals.slice(0, 5).map((g) => /* @__PURE__ */ jsxs7(Text7, { children: [
1624
1530
  " ",
@@ -1630,20 +1536,17 @@ function GoalsView() {
1630
1536
  " +",
1631
1537
  achievedGoals.length - 5,
1632
1538
  " more"
1633
- ] }),
1634
- /* @__PURE__ */ jsx8(Text7, { children: " " })
1539
+ ] })
1635
1540
  ] }),
1636
- otherGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
1541
+ otherGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
1637
1542
  /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Other" }),
1638
1543
  otherGoals.slice(0, 2).map((g) => /* @__PURE__ */ jsxs7(Text7, { children: [
1639
1544
  " ",
1640
1545
  /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
1641
1546
  " ",
1642
1547
  g.description.slice(0, 50),
1643
- /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
1644
- " ",
1645
- g.status
1646
- ] })
1548
+ " ",
1549
+ /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: g.status })
1647
1550
  ] }, g.id))
1648
1551
  ] })
1649
1552
  ] }) })
@@ -1653,7 +1556,7 @@ function GoalsView() {
1653
1556
  // src/cli/dashboard/views/HypothesesView.tsx
1654
1557
  import { useCallback as useCallback3 } from "react";
1655
1558
  import { Box as Box8, Text as Text8, useInput as useInput4 } from "ink";
1656
- import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1559
+ import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1657
1560
  function HypothesesView() {
1658
1561
  const { state, dispatch } = useDashboard();
1659
1562
  const { hypothesesPanel } = state;
@@ -1757,46 +1660,32 @@ function HypothesesView() {
1757
1660
  }
1758
1661
  });
1759
1662
  return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, children: [
1760
- /* @__PURE__ */ jsxs8(Text8, { children: [
1761
- /* @__PURE__ */ jsx9(Text8, { bold: true, children: "Hypotheses" }),
1762
- " ",
1763
- /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "Test theories about your codebase" })
1764
- ] }),
1765
- /* @__PURE__ */ jsx9(Text8, { children: " " }),
1766
- hypothesesPanel.inputMode === "add" ? /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1767
- /* @__PURE__ */ jsx9(Box8, { borderStyle: "round", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs8(Text8, { children: [
1663
+ /* @__PURE__ */ jsx9(Text8, { bold: true, children: "Hypotheses" }),
1664
+ hypothesesPanel.inputMode === "add" ? /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
1665
+ /* @__PURE__ */ jsx9(Box8, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs8(Text8, { children: [
1768
1666
  hypothesesPanel.inputBuffer,
1769
1667
  /* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "|" })
1770
1668
  ] }) }),
1771
1669
  /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " enter save \xB7 esc cancel" })
1772
- ] }) : /* @__PURE__ */ jsx9(Fragment3, { children: hypothesesPanel.hypotheses.length === 0 ? /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1773
- /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " No hypotheses yet." }),
1774
- /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Press a to add your first hypothesis." })
1775
- ] }) : /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1776
- testing.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1777
- testing.map((hypo, idx) => {
1778
- const isSelected = hypothesesPanel.selectedIndex === idx;
1779
- const conf = Math.round(hypo.confidence * 100);
1780
- return /* @__PURE__ */ jsx9(Box8, { flexDirection: "column", children: /* @__PURE__ */ jsxs8(Text8, { children: [
1781
- isSelected ? /* @__PURE__ */ jsxs8(Text8, { bold: true, color: "green", children: [
1782
- ">",
1783
- " "
1784
- ] }) : /* @__PURE__ */ jsx9(Text8, { children: " " }),
1785
- /* @__PURE__ */ jsx9(Text8, { color: "yellow", children: "\u25CB" }),
1786
- " ",
1787
- hypo.statement.slice(0, 50),
1788
- /* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
1789
- " ",
1790
- conf,
1791
- "% \xB7 ",
1792
- hypo.evidenceCount,
1793
- " evidence"
1794
- ] })
1795
- ] }) }, hypo.id);
1796
- }),
1797
- /* @__PURE__ */ jsx9(Text8, { children: " " })
1798
- ] }),
1799
- validated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1670
+ ] }) : /* @__PURE__ */ jsx9(Fragment2, { children: hypothesesPanel.hypotheses.length === 0 ? /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " No hypotheses yet. Press a to add one." }) : /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1671
+ testing.map((hypo, idx) => {
1672
+ const isSelected = hypothesesPanel.selectedIndex === idx;
1673
+ const conf = Math.round(hypo.confidence * 100);
1674
+ return /* @__PURE__ */ jsxs8(Text8, { children: [
1675
+ isSelected ? /* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "> " }) : " ",
1676
+ /* @__PURE__ */ jsx9(Text8, { color: "yellow", children: "\u25CB" }),
1677
+ " ",
1678
+ hypo.statement.slice(0, 50),
1679
+ /* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
1680
+ " ",
1681
+ conf,
1682
+ "% \xB7 ",
1683
+ hypo.evidenceCount,
1684
+ " evidence"
1685
+ ] })
1686
+ ] }, hypo.id);
1687
+ }),
1688
+ validated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
1800
1689
  /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Validated" }),
1801
1690
  validated.slice(0, 3).map((h) => /* @__PURE__ */ jsxs8(Text8, { children: [
1802
1691
  " ",
@@ -1808,10 +1697,9 @@ function HypothesesView() {
1808
1697
  " +",
1809
1698
  validated.length - 3,
1810
1699
  " more"
1811
- ] }),
1812
- /* @__PURE__ */ jsx9(Text8, { children: " " })
1700
+ ] })
1813
1701
  ] }),
1814
- invalidated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
1702
+ invalidated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
1815
1703
  /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Invalidated" }),
1816
1704
  invalidated.slice(0, 2).map((h) => /* @__PURE__ */ jsxs8(Text8, { children: [
1817
1705
  " ",
@@ -1830,9 +1718,9 @@ function HypothesesView() {
1830
1718
  }
1831
1719
 
1832
1720
  // src/cli/dashboard/views/MemoryTreeView.tsx
1833
- import { useEffect as useEffect3, useCallback as useCallback4 } from "react";
1721
+ import { useEffect as useEffect2, useCallback as useCallback4 } from "react";
1834
1722
  import { Box as Box9, Text as Text9, useInput as useInput5 } from "ink";
1835
- import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1723
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1836
1724
  function timeAgo2(iso) {
1837
1725
  const ms = Date.now() - new Date(iso).getTime();
1838
1726
  const mins = Math.floor(ms / 6e4);
@@ -1858,7 +1746,7 @@ function MemoryTreeView() {
1858
1746
  dispatch({ type: "ADD_ACTIVITY", message: "Context graph load error" });
1859
1747
  }
1860
1748
  }, [dispatch]);
1861
- useEffect3(() => {
1749
+ useEffect2(() => {
1862
1750
  if (!loaded) {
1863
1751
  void loadData();
1864
1752
  }
@@ -1878,9 +1766,7 @@ function MemoryTreeView() {
1878
1766
  if (!snapshot || snapshot.nodes.length === 0 && globalPatterns.length === 0) {
1879
1767
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 1, children: [
1880
1768
  /* @__PURE__ */ jsx10(Text9, { bold: true, children: "Ledger" }),
1881
- /* @__PURE__ */ jsx10(Text9, { children: " " }),
1882
- /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " No entries yet." }),
1883
- /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " Use trie tell, trie ok/bad, or trie watch to build memory." })
1769
+ /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " No entries yet. Use trie tell or trie watch to build memory." })
1884
1770
  ] });
1885
1771
  }
1886
1772
  const decisionNodes = snapshot.nodes.filter((n) => n.type === "decision") ?? [];
@@ -1895,91 +1781,81 @@ function MemoryTreeView() {
1895
1781
  function renderHeader(id, label, count, emptyHint) {
1896
1782
  const expanded = expandedNodes.has(id);
1897
1783
  const isEmpty = count === 0;
1898
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
1899
- /* @__PURE__ */ jsxs9(Text9, { children: [
1900
- sel(id) ? /* @__PURE__ */ jsxs9(Text9, { bold: true, color: "green", children: [
1901
- ">",
1902
- " "
1903
- ] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
1904
- expanded && !isEmpty ? /* @__PURE__ */ jsx10(Text9, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
1784
+ return /* @__PURE__ */ jsxs9(Text9, { children: [
1785
+ sel(id) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
1786
+ expanded && !isEmpty ? /* @__PURE__ */ jsx10(Text9, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
1787
+ " ",
1788
+ sel(id) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: label }) : /* @__PURE__ */ jsx10(Text9, { bold: true, children: label }),
1789
+ count > 0 ? /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1790
+ " (",
1791
+ count,
1792
+ ")"
1793
+ ] }) : isEmpty && emptyHint ? /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1905
1794
  " ",
1906
- sel(id) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: label }) : /* @__PURE__ */ jsx10(Text9, { bold: true, children: label }),
1907
- count > 0 ? /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1908
- " (",
1909
- count,
1910
- ")"
1911
- ] }) : null
1912
- ] }),
1913
- isEmpty && emptyHint && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1914
- " ",
1915
1795
  emptyHint
1916
- ] })
1796
+ ] }) : null
1917
1797
  ] });
1918
1798
  }
1919
1799
  return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 1, children: [
1920
1800
  /* @__PURE__ */ jsxs9(Text9, { children: [
1921
1801
  /* @__PURE__ */ jsx10(Text9, { bold: true, children: "Ledger" }),
1922
- " ",
1923
1802
  /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1803
+ " ",
1924
1804
  totalEntries,
1925
1805
  " entries"
1926
1806
  ] })
1927
1807
  ] }),
1928
- /* @__PURE__ */ jsx10(Text9, { children: " " }),
1929
- renderHeader("decisions", "Decisions", decisionNodes.length, "No decisions recorded \u2014 use trie tell or chat"),
1930
- expandedNodes.has("decisions") && decisionNodes.slice(0, 10).map((n) => {
1931
- const nodeId = `decision-${n.id}`;
1932
- const dec = n.data.decision.length > 55 ? n.data.decision.slice(0, 52) + "..." : n.data.decision;
1933
- const outcomeColor = n.data.outcome === "good" ? "green" : n.data.outcome === "bad" ? "red" : void 0;
1934
- return /* @__PURE__ */ jsxs9(Text9, { children: [
1935
- sel(nodeId) ? /* @__PURE__ */ jsxs9(Text9, { bold: true, color: "green", children: [
1936
- ">",
1937
- " "
1938
- ] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
1939
- " ",
1940
- outcomeColor ? /* @__PURE__ */ jsx10(Text9, { color: outcomeColor, children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
1941
- " ",
1942
- sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: dec }) : /* @__PURE__ */ jsx10(Text9, { children: dec }),
1943
- " ",
1944
- /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: timeAgo2(n.data.timestamp) }),
1945
- outcomeColor ? /* @__PURE__ */ jsxs9(Text9, { color: outcomeColor, children: [
1808
+ /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
1809
+ renderHeader("decisions", "Decisions", decisionNodes.length, "-- use trie tell or chat"),
1810
+ expandedNodes.has("decisions") && decisionNodes.slice(0, 10).map((n) => {
1811
+ const nodeId = `decision-${n.id}`;
1812
+ const dec = n.data.decision.length > 55 ? n.data.decision.slice(0, 52) + "..." : n.data.decision;
1813
+ const outcomeColor = n.data.outcome === "good" ? "green" : n.data.outcome === "bad" ? "red" : void 0;
1814
+ return /* @__PURE__ */ jsxs9(Text9, { children: [
1815
+ sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
1816
+ " ",
1817
+ outcomeColor ? /* @__PURE__ */ jsx10(Text9, { color: outcomeColor, children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
1946
1818
  " ",
1947
- n.data.outcome
1948
- ] }) : null
1949
- ] }, n.id);
1950
- }),
1951
- renderHeader("incidents", "Incidents", incidentNodes.length, "No incidents \u2014 use trie tell to report problems"),
1819
+ sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: dec }) : /* @__PURE__ */ jsx10(Text9, { children: dec }),
1820
+ /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1821
+ " ",
1822
+ timeAgo2(n.data.timestamp)
1823
+ ] }),
1824
+ outcomeColor ? /* @__PURE__ */ jsxs9(Text9, { color: outcomeColor, children: [
1825
+ " ",
1826
+ n.data.outcome
1827
+ ] }) : null
1828
+ ] }, n.id);
1829
+ })
1830
+ ] }),
1831
+ renderHeader("incidents", "Incidents", incidentNodes.length, "-- use trie tell"),
1952
1832
  expandedNodes.has("incidents") && incidentNodes.slice(0, 10).map((n) => {
1953
1833
  const nodeId = `incident-${n.id}`;
1954
1834
  const sevColor = n.data.severity === "critical" ? "red" : n.data.severity === "major" ? "yellow" : void 0;
1955
1835
  const desc = n.data.description.length > 55 ? n.data.description.slice(0, 52) + "..." : n.data.description;
1956
1836
  return /* @__PURE__ */ jsxs9(Text9, { children: [
1957
- sel(nodeId) ? /* @__PURE__ */ jsxs9(Text9, { bold: true, color: "green", children: [
1958
- ">",
1959
- " "
1960
- ] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
1961
- " ",
1837
+ sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
1838
+ " ",
1962
1839
  sevColor ? /* @__PURE__ */ jsx10(Text9, { color: sevColor, children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
1963
1840
  " ",
1964
1841
  sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx10(Text9, { children: desc }),
1965
- " ",
1966
- /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: timeAgo2(n.data.timestamp) }),
1842
+ /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1843
+ " ",
1844
+ timeAgo2(n.data.timestamp)
1845
+ ] }),
1967
1846
  " ",
1968
1847
  n.data.resolved ? /* @__PURE__ */ jsx10(Text9, { color: "green", children: "resolved" }) : /* @__PURE__ */ jsx10(Text9, { color: "yellow", children: "open" })
1969
1848
  ] }, n.id);
1970
1849
  }),
1971
- renderHeader("patterns", "Learned Patterns", patternNodes.length, "No patterns yet \u2014 Trie learns as you work"),
1850
+ renderHeader("patterns", "Learned Patterns", patternNodes.length, "-- Trie learns as you work"),
1972
1851
  expandedNodes.has("patterns") && patternNodes.slice(0, 10).map((n) => {
1973
1852
  const nodeId = `pattern-${n.id}`;
1974
1853
  const conf = Math.round(n.data.confidence * 100);
1975
1854
  const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
1976
1855
  const desc = n.data.description.length > 50 ? n.data.description.slice(0, 47) + "..." : n.data.description;
1977
1856
  return /* @__PURE__ */ jsxs9(Text9, { children: [
1978
- sel(nodeId) ? /* @__PURE__ */ jsxs9(Text9, { bold: true, color: "green", children: [
1979
- ">",
1980
- " "
1981
- ] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
1982
- " ",
1857
+ sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
1858
+ " ",
1983
1859
  n.data.isAntiPattern ? /* @__PURE__ */ jsx10(Text9, { color: "red", children: "!" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
1984
1860
  " ",
1985
1861
  sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx10(Text9, { children: desc }),
@@ -1990,8 +1866,7 @@ function MemoryTreeView() {
1990
1866
  ] }) : /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1991
1867
  conf,
1992
1868
  "%"
1993
- ] }),
1994
- n.data.isAntiPattern && /* @__PURE__ */ jsx10(Text9, { color: "red", children: " anti-pattern" })
1869
+ ] })
1995
1870
  ] }, n.id);
1996
1871
  }),
1997
1872
  renderHeader("cross-project", "Cross-Project", globalPatterns.length),
@@ -1999,16 +1874,13 @@ function MemoryTreeView() {
1999
1874
  const patternId = `global-${pattern.id}`;
2000
1875
  const desc = pattern.pattern.length > 45 ? pattern.pattern.slice(0, 42) + "..." : pattern.pattern;
2001
1876
  return /* @__PURE__ */ jsxs9(Text9, { children: [
2002
- sel(patternId) ? /* @__PURE__ */ jsxs9(Text9, { bold: true, color: "green", children: [
2003
- ">",
2004
- " "
2005
- ] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
2006
- " ",
1877
+ sel(patternId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
1878
+ " ",
2007
1879
  /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
2008
1880
  " ",
2009
1881
  sel(patternId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx10(Text9, { children: desc }),
2010
- " ",
2011
1882
  /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1883
+ " ",
2012
1884
  pattern.projects.length,
2013
1885
  " projects \xB7 ",
2014
1886
  pattern.occurrences,
@@ -2016,31 +1888,24 @@ function MemoryTreeView() {
2016
1888
  ] })
2017
1889
  ] }, pattern.id);
2018
1890
  }),
2019
- hotspots.length > 0 && /* @__PURE__ */ jsxs9(Fragment4, { children: [
1891
+ hotspots.length > 0 && /* @__PURE__ */ jsxs9(Fragment3, { children: [
2020
1892
  renderHeader("hotspots", "Risk Hotspots", hotspots.length),
2021
1893
  expandedNodes.has("hotspots") && hotspots.slice(0, 10).map((n) => {
2022
1894
  const nodeId = `file-${n.id}`;
2023
1895
  const path2 = n.data.path.split("/").slice(-2).join("/");
2024
1896
  const isCritical = n.data.riskLevel === "critical";
2025
1897
  return /* @__PURE__ */ jsxs9(Text9, { children: [
2026
- sel(nodeId) ? /* @__PURE__ */ jsxs9(Text9, { bold: true, color: "green", children: [
2027
- ">",
2028
- " "
2029
- ] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
2030
- " ",
1898
+ sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
1899
+ " ",
2031
1900
  /* @__PURE__ */ jsx10(Text9, { color: isCritical ? "red" : "yellow", children: "\u25CF" }),
2032
1901
  " ",
2033
1902
  sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: path2 }) : /* @__PURE__ */ jsx10(Text9, { children: path2 }),
2034
1903
  " ",
2035
1904
  /* @__PURE__ */ jsx10(Text9, { color: isCritical ? "red" : "yellow", children: n.data.riskLevel }),
2036
- " ",
2037
1905
  /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
1906
+ " ",
2038
1907
  n.data.changeCount,
2039
1908
  " changes"
2040
- ] }),
2041
- n.data.whyRisky && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
2042
- " ",
2043
- n.data.whyRisky
2044
1909
  ] })
2045
1910
  ] }, n.id);
2046
1911
  })
@@ -2054,43 +1919,37 @@ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2054
1919
  function RawLogView() {
2055
1920
  const { state, dispatch } = useDashboard();
2056
1921
  const { rawLog, rawLogPage } = state;
2057
- const pageSize = Math.max(10, (process.stdout.rows || 40) - 15);
1922
+ const pageSize = Math.max(10, (process.stdout.rows || 40) - 10);
2058
1923
  const totalPages = Math.max(1, Math.ceil(rawLog.length / pageSize));
2059
1924
  useInput6((input, _key) => {
2060
- if (input === "n") {
2061
- dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.min(totalPages - 1, rawLogPage + 1) });
2062
- } else if (input === "p") {
2063
- dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.max(0, rawLogPage - 1) });
2064
- }
1925
+ if (input === "n") dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.min(totalPages - 1, rawLogPage + 1) });
1926
+ else if (input === "p") dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.max(0, rawLogPage - 1) });
2065
1927
  });
2066
1928
  const startIdx = rawLogPage * pageSize;
2067
1929
  const logs = rawLog.slice(startIdx, startIdx + pageSize);
2068
1930
  return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 1, children: [
2069
1931
  /* @__PURE__ */ jsxs10(Text10, { children: [
2070
1932
  /* @__PURE__ */ jsx11(Text10, { bold: true, children: "Log" }),
2071
- " ",
2072
1933
  /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
2073
- "Page ",
1934
+ " ",
1935
+ rawLog.length,
1936
+ " entries \xB7 page ",
2074
1937
  rawLogPage + 1,
2075
1938
  "/",
2076
1939
  totalPages
2077
- ] }),
2078
- " ",
2079
- /* @__PURE__ */ jsx11(Text10, { bold: true, children: rawLog.length }),
2080
- /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " entries" })
1940
+ ] })
2081
1941
  ] }),
2082
- /* @__PURE__ */ jsx11(Text10, { children: " " }),
2083
- rawLog.length === 0 ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " No log entries yet." }) : /* @__PURE__ */ jsx11(Box10, { flexDirection: "column", children: logs.map((entry, i) => {
1942
+ rawLog.length === 0 ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " No log entries yet" }) : logs.map((entry, i) => {
2084
1943
  const dot = entry.level === "error" ? /* @__PURE__ */ jsx11(Text10, { color: "red", children: "\u25CF" }) : entry.level === "warn" ? /* @__PURE__ */ jsx11(Text10, { color: "yellow", children: "\u25CF" }) : entry.level === "info" ? /* @__PURE__ */ jsx11(Text10, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" });
2085
1944
  return /* @__PURE__ */ jsxs10(Text10, { children: [
1945
+ " ",
1946
+ /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: entry.time }),
2086
1947
  " ",
2087
1948
  dot,
2088
1949
  " ",
2089
- entry.message.slice(0, 70),
2090
- " ",
2091
- /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: entry.time })
1950
+ entry.message.slice(0, 70)
2092
1951
  ] }, i);
2093
- }) })
1952
+ })
2094
1953
  ] });
2095
1954
  }
2096
1955
 
@@ -4933,74 +4792,40 @@ ${contextBlock}`;
4933
4792
  });
4934
4793
  if (!isAIAvailable()) {
4935
4794
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, children: [
4936
- /* @__PURE__ */ jsxs11(Text11, { children: [
4937
- /* @__PURE__ */ jsx12(Text11, { bold: true, children: "Chat" }),
4938
- " ",
4939
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Ask Trie anything" })
4940
- ] }),
4941
- /* @__PURE__ */ jsx12(Text11, { children: " " }),
4942
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " AI is not available." }),
4943
- /* @__PURE__ */ jsxs11(Text11, { children: [
4944
- " ",
4945
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Press" }),
4946
- " ",
4947
- /* @__PURE__ */ jsx12(Text11, { bold: true, children: "s" }),
4948
- " ",
4949
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "to open settings and add your Anthropic API key," })
4950
- ] }),
4951
- /* @__PURE__ */ jsxs11(Text11, { children: [
4952
- " ",
4953
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "or set" }),
4954
- " ",
4955
- /* @__PURE__ */ jsx12(Text11, { bold: true, children: "ANTHROPIC_API_KEY" }),
4956
- " ",
4957
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "in your environment." })
4958
- ] })
4795
+ /* @__PURE__ */ jsx12(Text11, { bold: true, children: "Chat" }),
4796
+ /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " AI is not available. Press s to open settings and add your Anthropic API key." })
4959
4797
  ] });
4960
4798
  }
4961
4799
  return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, children: [
4962
- /* @__PURE__ */ jsxs11(Text11, { children: [
4963
- /* @__PURE__ */ jsx12(Text11, { bold: true, children: "Chat" }),
4964
- " ",
4965
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Ask Trie anything" })
4966
- ] }),
4967
- /* @__PURE__ */ jsx12(Text11, { children: " " }),
4968
- messages.length === 0 && !loading && /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
4969
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " Ask about your codebase, decisions, patterns, or risks." }),
4970
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: ' Trie can also take actions \u2014 try "check src/auth" or "record an incident".' }),
4971
- /* @__PURE__ */ jsx12(Text11, { children: " " })
4972
- ] }),
4973
- messages.map((msg, idx) => /* @__PURE__ */ jsx12(Box11, { flexDirection: "column", marginBottom: 1, children: msg.role === "user" ? /* @__PURE__ */ jsxs11(Text11, { children: [
4800
+ /* @__PURE__ */ jsx12(Text11, { bold: true, children: "Chat" }),
4801
+ messages.length === 0 && !loading && /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " Ask about your codebase, decisions, patterns, or risks." }),
4802
+ messages.map((msg, idx) => /* @__PURE__ */ jsx12(Box11, { flexDirection: "column", marginTop: idx === 0 ? 1 : 0, marginBottom: 1, children: msg.role === "user" ? /* @__PURE__ */ jsxs11(Text11, { children: [
4974
4803
  " ",
4975
4804
  /* @__PURE__ */ jsx12(Text11, { bold: true, color: "green", children: "You:" }),
4976
4805
  " ",
4977
4806
  msg.content
4978
4807
  ] }) : /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
4979
- msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx12(Box11, { flexDirection: "column", marginBottom: 0, children: msg.toolCalls.map((tc, ti) => /* @__PURE__ */ jsxs11(Text11, { dimColor: true, children: [
4808
+ msg.toolCalls && msg.toolCalls.length > 0 && msg.toolCalls.map((tc, ti) => /* @__PURE__ */ jsxs11(Text11, { dimColor: true, children: [
4980
4809
  " ",
4981
4810
  /* @__PURE__ */ jsxs11(Text11, { color: "yellow", children: [
4982
- "[ran ",
4811
+ "[",
4983
4812
  tc.name,
4984
4813
  "]"
4985
4814
  ] }),
4986
4815
  " ",
4987
4816
  formatToolInput(tc.input)
4988
- ] }, ti)) }),
4817
+ ] }, ti)),
4989
4818
  msg.content.split("\n").map((line, li) => /* @__PURE__ */ jsxs11(Text11, { children: [
4990
- li === 0 ? /* @__PURE__ */ jsx12(Text11, { bold: true, children: " Trie: " }) : /* @__PURE__ */ jsx12(Text11, { children: " " }),
4819
+ li === 0 ? " Trie: " : " ",
4991
4820
  line
4992
4821
  ] }, li))
4993
4822
  ] }) }, idx)),
4994
- loading && /* @__PURE__ */ jsxs11(Text11, { children: [
4995
- " ",
4996
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Thinking..." })
4997
- ] }),
4823
+ loading && /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " Thinking..." }),
4998
4824
  /* @__PURE__ */ jsx12(Box11, { flexGrow: 1 }),
4999
- /* @__PURE__ */ jsx12(Box11, { borderStyle: "round", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs11(Text11, { children: [
4825
+ /* @__PURE__ */ jsx12(Box11, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs11(Text11, { children: [
5000
4826
  inputBuffer || /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Ask a question..." }),
5001
4827
  /* @__PURE__ */ jsx12(Text11, { bold: true, color: "green", children: "|" })
5002
- ] }) }),
5003
- /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " enter send esc clear" })
4828
+ ] }) })
5004
4829
  ] });
5005
4830
  }
5006
4831
  function formatToolInput(input) {
@@ -5019,7 +4844,7 @@ var MAIN_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
5019
4844
  function DashboardApp({ onReady }) {
5020
4845
  const { state, dispatch } = useDashboard();
5021
4846
  const { exit } = useApp();
5022
- const [showConfig, setShowConfig] = useState3(false);
4847
+ const [showConfig, setShowConfig] = useState2(false);
5023
4848
  const dispatchRef = useRef2(dispatch);
5024
4849
  dispatchRef.current = dispatch;
5025
4850
  const stateRef = useRef2(state);
@@ -5036,8 +4861,13 @@ function DashboardApp({ onReady }) {
5036
4861
  }, [configPath]);
5037
4862
  const persistConfig = useCallback6(async () => {
5038
4863
  try {
5039
- await mkdir(getTrieDirectory(getWorkingDirectory(void 0, true)), { recursive: true });
4864
+ const workDir = getWorkingDirectory(void 0, true);
4865
+ await mkdir(getTrieDirectory(workDir), { recursive: true });
5040
4866
  await writeFile(configPath, JSON.stringify(stateRef.current.agentConfig, null, 2), "utf-8");
4867
+ const { saveAutonomyConfig, loadAutonomyConfig } = await import("./autonomy-config-JXB7WCZ2.js");
4868
+ const autonomy = await loadAutonomyConfig(workDir);
4869
+ autonomy.aiWatcher = stateRef.current.agentConfig.aiWatcher;
4870
+ await saveAutonomyConfig(workDir, autonomy);
5041
4871
  } catch {
5042
4872
  }
5043
4873
  }, [configPath]);
@@ -5099,7 +4929,7 @@ function DashboardApp({ onReady }) {
5099
4929
  } catch {
5100
4930
  }
5101
4931
  }, []);
5102
- useEffect4(() => {
4932
+ useEffect3(() => {
5103
4933
  void loadConfig();
5104
4934
  void refreshGoals();
5105
4935
  void refreshHypotheses();
@@ -5118,6 +4948,20 @@ function DashboardApp({ onReady }) {
5118
4948
  if (nudge.file !== void 0) action.file = nudge.file;
5119
4949
  if (nudge.autoHideMs !== void 0) action.autoHideMs = nudge.autoHideMs;
5120
4950
  dispatchRef.current(action);
4951
+ if (nudge.severity === "critical" || nudge.severity === "warning") {
4952
+ const insight = {
4953
+ id: `nudge-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
4954
+ type: "warning",
4955
+ category: "quality",
4956
+ message: nudge.message,
4957
+ priority: nudge.severity === "critical" ? 9 : 6,
4958
+ timestamp: Date.now(),
4959
+ suggestedAction: nudge.file ? `Review ${nudge.file}` : void 0,
4960
+ relatedIssues: [],
4961
+ dismissed: false
4962
+ };
4963
+ dispatchRef.current({ type: "ADD_INSIGHTS", insights: [insight] });
4964
+ }
5121
4965
  }
5122
4966
  });
5123
4967
  const handleUpdate = (update) => {
@@ -5140,7 +4984,7 @@ function DashboardApp({ onReady }) {
5140
4984
  outputManager.setMode("console");
5141
4985
  };
5142
4986
  }, [loadConfig, onReady, processInsights, refreshGoals, refreshHypotheses]);
5143
- useEffect4(() => {
4987
+ useEffect3(() => {
5144
4988
  const interval = setInterval(() => {
5145
4989
  dispatchRef.current({ type: "AUTO_DISMISS_NOTIFICATIONS" });
5146
4990
  }, 5e3);
@@ -5250,7 +5094,7 @@ var InteractiveDashboard = class {
5250
5094
  getConfigFn = null;
5251
5095
  async start() {
5252
5096
  this.app = render(
5253
- React10.createElement(App, {
5097
+ React9.createElement(App, {
5254
5098
  onReady: (handler, getConfig) => {
5255
5099
  this.updateHandler = handler;
5256
5100
  this.getConfigFn = getConfig;
@@ -5295,4 +5139,4 @@ export {
5295
5139
  handleCheckpointTool,
5296
5140
  InteractiveDashboard
5297
5141
  };
5298
- //# sourceMappingURL=chunk-4SBZXIMG.js.map
5142
+ //# sourceMappingURL=chunk-ZYKEILVK.js.map