@triedotdev/mcp 1.0.114 → 1.0.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{autonomy-config-O4H3Z7YV.js → autonomy-config-QA6ATWLJ.js} +3 -3
- package/dist/{chunk-4SBZXIMG.js → chunk-2764RZVV.js} +617 -554
- package/dist/chunk-2764RZVV.js.map +1 -0
- package/dist/{chunk-R4AAPFXC.js → chunk-45Y5TLQZ.js} +2 -2
- package/dist/{chunk-R4AAPFXC.js.map → chunk-45Y5TLQZ.js.map} +1 -1
- package/dist/{chunk-KRH642MT.js → chunk-4BGAVEO6.js} +2 -2
- package/dist/{chunk-NS2MSZMB.js → chunk-55CBWOEZ.js} +2 -2
- package/dist/{chunk-YR4BMGYO.js → chunk-7Q6I2CB4.js} +2 -2
- package/dist/{chunk-TKMV7JKN.js → chunk-DFHMB44X.js} +2 -2
- package/dist/{chunk-D3EXBJE2.js → chunk-FNW7Z7ZS.js} +5 -5
- package/dist/{chunk-DZREHOGW.js → chunk-I7XKF5XD.js} +5 -5
- package/dist/{chunk-2SIFK7OW.js → chunk-IQBHPTV7.js} +4 -4
- package/dist/{chunk-AOFYU6T3.js → chunk-OMCEUJ5I.js} +12 -12
- package/dist/{chunk-55DOQNHJ.js → chunk-PRFHN2X6.js} +4 -4
- package/dist/{chunk-MVNJPJBK.js → chunk-SRQ4DNOP.js} +5 -5
- package/dist/{chunk-2GIAROBF.js → chunk-WHIQAGB7.js} +2 -2
- package/dist/{chunk-SWSK7ANT.js → chunk-WRGSH5RT.js} +2 -2
- package/dist/{chunk-6LXSA2OZ.js → chunk-Y52SNUW5.js} +3 -3
- package/dist/{chunk-DRDEEF6G.js → chunk-ZEXMMTIQ.js} +14 -2
- package/dist/chunk-ZEXMMTIQ.js.map +1 -0
- package/dist/cli/create-agent.js +1 -1
- package/dist/cli/main.js +72 -38
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +14 -14
- package/dist/{client-7XZHCMD3.js → client-PMKE26IV.js} +3 -3
- package/dist/{goal-manager-LMS6ZJB7.js → goal-manager-JKTNFJQE.js} +7 -7
- package/dist/goal-validator-YSNN23D4.js +62 -0
- package/dist/goal-validator-YSNN23D4.js.map +1 -0
- package/dist/{graph-U5JWSAB5.js → graph-PAUZ5EMP.js} +3 -3
- package/dist/guardian-agent-UY2G56FT.js +25 -0
- package/dist/{hypothesis-KGC3P54C.js → hypothesis-RUCJ74X7.js} +7 -7
- package/dist/{incident-index-PNIVT47T.js → incident-index-ZCDSJ42L.js} +3 -3
- package/dist/index.js +157 -163
- package/dist/index.js.map +1 -1
- package/dist/{ledger-SR6OEBLO.js → ledger-JMPGJGLB.js} +3 -3
- package/package.json +1 -1
- package/dist/auto-fix-apply-PCAHWLXF.js +0 -10
- package/dist/chunk-4SBZXIMG.js.map +0 -1
- package/dist/chunk-DJ2YAGHK.js +0 -50
- package/dist/chunk-DJ2YAGHK.js.map +0 -1
- package/dist/chunk-DRDEEF6G.js.map +0 -1
- package/dist/goal-validator-7UPLOVAZ.js +0 -184
- package/dist/goal-validator-7UPLOVAZ.js.map +0 -1
- package/dist/guardian-agent-EXP7APLC.js +0 -25
- package/dist/ledger-SR6OEBLO.js.map +0 -1
- /package/dist/{auto-fix-apply-PCAHWLXF.js.map → autonomy-config-QA6ATWLJ.js.map} +0 -0
- /package/dist/{chunk-KRH642MT.js.map → chunk-4BGAVEO6.js.map} +0 -0
- /package/dist/{chunk-NS2MSZMB.js.map → chunk-55CBWOEZ.js.map} +0 -0
- /package/dist/{chunk-YR4BMGYO.js.map → chunk-7Q6I2CB4.js.map} +0 -0
- /package/dist/{chunk-TKMV7JKN.js.map → chunk-DFHMB44X.js.map} +0 -0
- /package/dist/{chunk-D3EXBJE2.js.map → chunk-FNW7Z7ZS.js.map} +0 -0
- /package/dist/{chunk-DZREHOGW.js.map → chunk-I7XKF5XD.js.map} +0 -0
- /package/dist/{chunk-2SIFK7OW.js.map → chunk-IQBHPTV7.js.map} +0 -0
- /package/dist/{chunk-AOFYU6T3.js.map → chunk-OMCEUJ5I.js.map} +0 -0
- /package/dist/{chunk-55DOQNHJ.js.map → chunk-PRFHN2X6.js.map} +0 -0
- /package/dist/{chunk-MVNJPJBK.js.map → chunk-SRQ4DNOP.js.map} +0 -0
- /package/dist/{chunk-2GIAROBF.js.map → chunk-WHIQAGB7.js.map} +0 -0
- /package/dist/{chunk-SWSK7ANT.js.map → chunk-WRGSH5RT.js.map} +0 -0
- /package/dist/{chunk-6LXSA2OZ.js.map → chunk-Y52SNUW5.js.map} +0 -0
- /package/dist/{autonomy-config-O4H3Z7YV.js.map → client-PMKE26IV.js.map} +0 -0
- /package/dist/{client-7XZHCMD3.js.map → goal-manager-JKTNFJQE.js.map} +0 -0
- /package/dist/{goal-manager-LMS6ZJB7.js.map → graph-PAUZ5EMP.js.map} +0 -0
- /package/dist/{graph-U5JWSAB5.js.map → guardian-agent-UY2G56FT.js.map} +0 -0
- /package/dist/{guardian-agent-EXP7APLC.js.map → hypothesis-RUCJ74X7.js.map} +0 -0
- /package/dist/{hypothesis-KGC3P54C.js.map → incident-index-ZCDSJ42L.js.map} +0 -0
- /package/dist/{incident-index-PNIVT47T.js.map → ledger-JMPGJGLB.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGuardian
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OMCEUJ5I.js";
|
|
4
4
|
import {
|
|
5
5
|
LearningEngine,
|
|
6
6
|
exportToJson,
|
|
@@ -10,34 +10,34 @@ import {
|
|
|
10
10
|
perceiveCurrentChanges,
|
|
11
11
|
reasonAboutChangesHumanReadable,
|
|
12
12
|
saveCheckpoint
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-SRQ4DNOP.js";
|
|
14
14
|
import {
|
|
15
15
|
TieredStorage,
|
|
16
16
|
findCrossProjectPatterns,
|
|
17
17
|
getStorage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-FNW7Z7ZS.js";
|
|
19
19
|
import {
|
|
20
20
|
getKeyFromKeychain,
|
|
21
21
|
isAIAvailable,
|
|
22
22
|
runAIWithTools,
|
|
23
23
|
setAPIKey
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-WRGSH5RT.js";
|
|
25
25
|
import {
|
|
26
26
|
getGuardianState
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-4BGAVEO6.js";
|
|
28
28
|
import {
|
|
29
29
|
ContextGraph
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-55CBWOEZ.js";
|
|
31
31
|
import {
|
|
32
32
|
IncidentIndex
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-WHIQAGB7.js";
|
|
34
34
|
import {
|
|
35
35
|
getOutputManager
|
|
36
36
|
} from "./chunk-VRLMTOB6.js";
|
|
37
37
|
import {
|
|
38
38
|
getTrieDirectory,
|
|
39
39
|
getWorkingDirectory
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-45Y5TLQZ.js";
|
|
41
41
|
import {
|
|
42
42
|
isInteractiveMode
|
|
43
43
|
} from "./chunk-APMV77PU.js";
|
|
@@ -45,10 +45,14 @@ import {
|
|
|
45
45
|
// src/tools/scan.ts
|
|
46
46
|
var TrieScanTool = class {
|
|
47
47
|
async execute(_input) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
if (!isInteractiveMode()) {
|
|
49
|
+
console.error("Trie scan has been refocused on decision ledger");
|
|
50
|
+
console.error(" trie tell - report incidents");
|
|
51
|
+
console.error(" trie gotcha - predict risks");
|
|
52
|
+
console.error(" trie learn - learn from history");
|
|
53
|
+
} else {
|
|
54
|
+
getOutputManager().log("info", "Scan refocused on decision ledger");
|
|
55
|
+
}
|
|
52
56
|
return {
|
|
53
57
|
content: [{
|
|
54
58
|
type: "text",
|
|
@@ -217,6 +221,12 @@ var StreamingManager = class {
|
|
|
217
221
|
reportWatchChange(file) {
|
|
218
222
|
this.emit("watch_change", { file });
|
|
219
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Report a pending fix for user approval
|
|
226
|
+
*/
|
|
227
|
+
reportPendingFix(fix) {
|
|
228
|
+
this.emit("pending_fix", fix);
|
|
229
|
+
}
|
|
220
230
|
/**
|
|
221
231
|
* Report memory operations (saving context, learning patterns)
|
|
222
232
|
*/
|
|
@@ -278,11 +288,11 @@ var StreamingManager = class {
|
|
|
278
288
|
|
|
279
289
|
// src/cli/dashboard/index.ts
|
|
280
290
|
import { render } from "ink";
|
|
281
|
-
import
|
|
291
|
+
import React9 from "react";
|
|
282
292
|
|
|
283
293
|
// src/cli/dashboard/App.tsx
|
|
284
|
-
import { useState as
|
|
285
|
-
import { Box as Box12, useInput as
|
|
294
|
+
import { useState as useState2, useEffect as useEffect3, useCallback as useCallback6, useRef as useRef2 } from "react";
|
|
295
|
+
import { Box as Box12, useInput as useInput9, useApp } from "ink";
|
|
286
296
|
|
|
287
297
|
// src/cli/dashboard/state.tsx
|
|
288
298
|
import React, { createContext, useContext, useReducer } from "react";
|
|
@@ -402,7 +412,8 @@ function handleStreamUpdate(state, update) {
|
|
|
402
412
|
lastChange: entry.time,
|
|
403
413
|
filesScannedSession: s.watch.filesScannedSession + 1
|
|
404
414
|
};
|
|
405
|
-
|
|
415
|
+
const shortFile = update.data.file.split("/").slice(-2).join("/");
|
|
416
|
+
s = addActivity(s, `Change: ${shortFile}`);
|
|
406
417
|
break;
|
|
407
418
|
}
|
|
408
419
|
case "signal_extracted": {
|
|
@@ -430,6 +441,20 @@ function handleStreamUpdate(state, update) {
|
|
|
430
441
|
message: update.data.message
|
|
431
442
|
}, ...s.rawLog].slice(0, 500);
|
|
432
443
|
break;
|
|
444
|
+
case "pending_fix":
|
|
445
|
+
s.pendingFixes = [{
|
|
446
|
+
id: update.data.id,
|
|
447
|
+
file: update.data.file,
|
|
448
|
+
description: update.data.description,
|
|
449
|
+
goalDescription: update.data.goalDescription,
|
|
450
|
+
confidence: update.data.confidence,
|
|
451
|
+
severity: update.data.severity,
|
|
452
|
+
suggestedFix: update.data.suggestedFix,
|
|
453
|
+
timestamp: update.timestamp,
|
|
454
|
+
status: "pending"
|
|
455
|
+
}, ...s.pendingFixes].slice(0, 20);
|
|
456
|
+
s = addActivity(s, `Goal violation: ${update.data.description} [${update.data.confidence}%]`);
|
|
457
|
+
break;
|
|
433
458
|
}
|
|
434
459
|
return s;
|
|
435
460
|
}
|
|
@@ -447,6 +472,7 @@ function applyAgentConfigPatch(current, patch) {
|
|
|
447
472
|
}
|
|
448
473
|
if (patch.performance) config.performance = { ...config.performance, ...patch.performance };
|
|
449
474
|
if (patch.riskThresholds) config.riskThresholds = { ...config.riskThresholds, ...patch.riskThresholds };
|
|
475
|
+
if (patch.aiWatcher) config.aiWatcher = { ...config.aiWatcher, ...patch.aiWatcher };
|
|
450
476
|
return config;
|
|
451
477
|
}
|
|
452
478
|
function dashboardReducer(state, action) {
|
|
@@ -686,6 +712,34 @@ function dashboardReducer(state, action) {
|
|
|
686
712
|
if (!changed) return state;
|
|
687
713
|
return { ...state, notificationHistory: history };
|
|
688
714
|
}
|
|
715
|
+
case "ADD_PENDING_FIX":
|
|
716
|
+
return {
|
|
717
|
+
...state,
|
|
718
|
+
pendingFixes: [action.fix, ...state.pendingFixes].slice(0, 20)
|
|
719
|
+
};
|
|
720
|
+
case "APPROVE_FIX":
|
|
721
|
+
return {
|
|
722
|
+
...state,
|
|
723
|
+
pendingFixes: state.pendingFixes.map(
|
|
724
|
+
(f) => f.id === action.id ? { ...f, status: "applying" } : f
|
|
725
|
+
)
|
|
726
|
+
};
|
|
727
|
+
case "DISMISS_FIX":
|
|
728
|
+
return {
|
|
729
|
+
...state,
|
|
730
|
+
pendingFixes: state.pendingFixes.map(
|
|
731
|
+
(f) => f.id === action.id ? { ...f, status: "dismissed" } : f
|
|
732
|
+
)
|
|
733
|
+
};
|
|
734
|
+
case "FIX_APPLIED":
|
|
735
|
+
return {
|
|
736
|
+
...state,
|
|
737
|
+
pendingFixes: state.pendingFixes.map(
|
|
738
|
+
(f) => f.id === action.id ? { ...f, status: "applied" } : f
|
|
739
|
+
)
|
|
740
|
+
};
|
|
741
|
+
case "SELECT_FIX":
|
|
742
|
+
return { ...state, selectedFixIndex: action.index };
|
|
689
743
|
default:
|
|
690
744
|
return state;
|
|
691
745
|
}
|
|
@@ -738,13 +792,16 @@ function createInitialState() {
|
|
|
738
792
|
memoryRetentionDays: 30
|
|
739
793
|
},
|
|
740
794
|
performance: { parallel: true, cache: true, maxConcurrency: 4, timeoutMs: 12e4, workers: true, streaming: true },
|
|
741
|
-
riskThresholds: { critical: 70, high: 40, medium: 20 }
|
|
795
|
+
riskThresholds: { critical: 70, high: 40, medium: 20 },
|
|
796
|
+
aiWatcher: { enabled: true, hourlyTokenLimit: 5e4, scanCooldownSec: 30, cleanFileCooldownSec: 300, maxFilesPerScan: 5, maxCharsPerFile: 4e3 }
|
|
742
797
|
},
|
|
743
798
|
goalsPanel: { goals: [], selectedIndex: 0, selectedAchievedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0 },
|
|
744
799
|
hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0 },
|
|
745
800
|
memoryTree: { loaded: false, snapshot: null, globalPatterns: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
|
|
746
801
|
agentBrain: { loaded: false, decisions: [], patterns: [], ledgerHash: null, selectedIndex: 0, expandedIndex: null },
|
|
747
|
-
chatState: { messages: [], inputBuffer: "", loading: false }
|
|
802
|
+
chatState: { messages: [], inputBuffer: "", loading: false },
|
|
803
|
+
pendingFixes: [],
|
|
804
|
+
selectedFixIndex: 0
|
|
748
805
|
};
|
|
749
806
|
}
|
|
750
807
|
var DashboardContext = createContext(null);
|
|
@@ -765,54 +822,50 @@ import { readFile as readFile2, writeFile, mkdir } from "fs/promises";
|
|
|
765
822
|
import { join as join2 } from "path";
|
|
766
823
|
|
|
767
824
|
// src/cli/dashboard/components/Header.tsx
|
|
768
|
-
import {
|
|
769
|
-
import { Box, Text } from "ink";
|
|
825
|
+
import { Box, Text, useStdout } from "ink";
|
|
770
826
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
771
|
-
var WATCH_FRAMES = ["\u25D0", "\u25D3", "\u25D1", "\u25D2"];
|
|
772
827
|
function Header() {
|
|
773
828
|
const { state } = useDashboard();
|
|
774
829
|
const { signalExtraction, watch, alerts } = state;
|
|
830
|
+
const { stdout } = useStdout();
|
|
831
|
+
const cols = stdout?.columns || 80;
|
|
832
|
+
const narrow = cols < 50;
|
|
775
833
|
const totalExtracted = signalExtraction.decisionsExtracted + signalExtraction.factsExtracted + signalExtraction.blockersExtracted + signalExtraction.questionsExtracted;
|
|
776
|
-
|
|
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;
|
|
834
|
+
let status;
|
|
783
835
|
if (watch.watching) {
|
|
784
|
-
|
|
785
|
-
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\
|
|
786
|
-
" ",
|
|
787
|
-
/* @__PURE__ */ jsx2(Text, { color: "green",
|
|
788
|
-
|
|
789
|
-
|
|
836
|
+
status = totalExtracted > 0 ? /* @__PURE__ */ jsxs(Text, { children: [
|
|
837
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25CF" }),
|
|
838
|
+
narrow ? "" : " ",
|
|
839
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", children: narrow ? "" : "Learning" }),
|
|
840
|
+
!narrow && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
841
|
+
" ",
|
|
790
842
|
totalExtracted,
|
|
791
843
|
" signals"
|
|
792
844
|
] })
|
|
793
845
|
] }) : /* @__PURE__ */ jsxs(Text, { children: [
|
|
794
|
-
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\
|
|
795
|
-
" "
|
|
796
|
-
/* @__PURE__ */ jsx2(Text, { bold: true, children: "Watching" })
|
|
846
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25CF" }),
|
|
847
|
+
!narrow && " Watching"
|
|
797
848
|
] });
|
|
798
849
|
} else {
|
|
799
|
-
|
|
850
|
+
status = /* @__PURE__ */ jsxs(Text, { children: [
|
|
800
851
|
/* @__PURE__ */ jsx2(Text, { dimColor: true, children: "\u25CB" }),
|
|
801
|
-
" "
|
|
802
|
-
/* @__PURE__ */ jsx2(Text, { dimColor: true, children: "Idle" })
|
|
852
|
+
!narrow && /* @__PURE__ */ jsx2(Text, { dimColor: true, children: " Idle" })
|
|
803
853
|
] });
|
|
804
854
|
}
|
|
805
855
|
return /* @__PURE__ */ jsxs(Box, { paddingX: 1, justifyContent: "space-between", children: [
|
|
806
|
-
/* @__PURE__ */ jsx2(Text, {
|
|
807
|
-
/* @__PURE__ */ jsxs(Box, { gap: 2, children: [
|
|
808
|
-
|
|
809
|
-
alerts.hasCritical && /* @__PURE__ */
|
|
856
|
+
/* @__PURE__ */ jsx2(Text, { bold: true, color: "magenta", children: "Trie" }),
|
|
857
|
+
/* @__PURE__ */ jsxs(Box, { gap: narrow ? 1 : 2, children: [
|
|
858
|
+
status,
|
|
859
|
+
alerts.hasCritical && /* @__PURE__ */ jsxs(Text, { color: "red", bold: true, children: [
|
|
860
|
+
"\u25CF",
|
|
861
|
+
!narrow && " Alert"
|
|
862
|
+
] })
|
|
810
863
|
] })
|
|
811
864
|
] });
|
|
812
865
|
}
|
|
813
866
|
|
|
814
867
|
// src/cli/dashboard/components/Footer.tsx
|
|
815
|
-
import { Box as Box2, Text as Text2 } from "ink";
|
|
868
|
+
import { Box as Box2, Text as Text2, useStdout as useStdout2 } from "ink";
|
|
816
869
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
817
870
|
var VIEW_LABELS = {
|
|
818
871
|
overview: "Overview",
|
|
@@ -823,87 +876,115 @@ var VIEW_LABELS = {
|
|
|
823
876
|
memory: "Ledger",
|
|
824
877
|
chat: "Chat"
|
|
825
878
|
};
|
|
879
|
+
var VIEW_SHORT = {
|
|
880
|
+
overview: "Ovr",
|
|
881
|
+
rawlog: "Log",
|
|
882
|
+
agent: "Ndg",
|
|
883
|
+
goals: "Gls",
|
|
884
|
+
hypotheses: "Hyp",
|
|
885
|
+
memory: "Ldg",
|
|
886
|
+
chat: "Cht"
|
|
887
|
+
};
|
|
826
888
|
var TAB_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
889
|
+
var CONTEXT_HINTS = {
|
|
890
|
+
goals: "j/k nav \xB7 a add \xB7 enter complete \xB7 d delete",
|
|
891
|
+
hypotheses: "j/k nav \xB7 a add \xB7 v validate \xB7 x invalidate",
|
|
892
|
+
agent: "j/k nav \xB7 enter expand \xB7 d dismiss",
|
|
893
|
+
memory: "j/k nav \xB7 enter expand",
|
|
894
|
+
chat: "type to ask \xB7 enter send \xB7 esc clear",
|
|
895
|
+
rawlog: "n/p pages \xB7 b back"
|
|
896
|
+
};
|
|
897
|
+
var CONTEXT_HINTS_SHORT = {
|
|
898
|
+
goals: "j/k a d",
|
|
899
|
+
hypotheses: "j/k a v x",
|
|
900
|
+
agent: "j/k enter d",
|
|
901
|
+
memory: "j/k enter",
|
|
902
|
+
chat: "enter esc",
|
|
903
|
+
rawlog: "n/p b"
|
|
904
|
+
};
|
|
827
905
|
function Footer() {
|
|
828
906
|
const { state } = useDashboard();
|
|
829
|
-
const { view } = state;
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
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";
|
|
907
|
+
const { view, goalsPanel, hypothesesPanel } = state;
|
|
908
|
+
const { stdout } = useStdout2();
|
|
909
|
+
const cols = stdout?.columns || 80;
|
|
910
|
+
const narrow = cols < 60;
|
|
911
|
+
const veryNarrow = cols < 40;
|
|
912
|
+
const labels = narrow ? VIEW_SHORT : VIEW_LABELS;
|
|
913
|
+
let hints;
|
|
914
|
+
if (view === "goals" && goalsPanel.inputMode === "add") {
|
|
915
|
+
hints = narrow ? "enter esc" : "enter save \xB7 esc cancel";
|
|
916
|
+
} else if (view === "hypotheses" && hypothesesPanel.inputMode === "add") {
|
|
917
|
+
hints = narrow ? "enter esc" : "enter save \xB7 esc cancel";
|
|
847
918
|
} else {
|
|
848
|
-
|
|
919
|
+
const hintMap = narrow ? CONTEXT_HINTS_SHORT : CONTEXT_HINTS;
|
|
920
|
+
hints = hintMap[view] || (narrow ? "s n/p" : "n/p pages \xB7 s settings");
|
|
849
921
|
}
|
|
850
|
-
|
|
851
|
-
/* @__PURE__ */ jsxs2(Box2, {
|
|
852
|
-
/* @__PURE__ */ jsx3(Box2, { gap: 1, children: TAB_VIEWS.map((v) => v === view ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children:
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
|
|
855
|
-
|
|
922
|
+
if (veryNarrow) {
|
|
923
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 1, children: [
|
|
924
|
+
/* @__PURE__ */ jsx3(Box2, { gap: 1, children: TAB_VIEWS.map((v) => v === view ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children: labels[v] }, v) : /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: labels[v] }, v)) }),
|
|
925
|
+
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
926
|
+
hints,
|
|
927
|
+
" \xB7 q quit"
|
|
928
|
+
] })
|
|
929
|
+
] });
|
|
930
|
+
}
|
|
931
|
+
return /* @__PURE__ */ jsxs2(Box2, { paddingX: 1, justifyContent: "space-between", children: [
|
|
932
|
+
/* @__PURE__ */ jsx3(Box2, { gap: 1, children: TAB_VIEWS.map((v) => v === view ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children: labels[v] }, v) : /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: labels[v] }, v)) }),
|
|
933
|
+
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
934
|
+
hints,
|
|
935
|
+
" \xB7 q quit"
|
|
936
|
+
] })
|
|
856
937
|
] });
|
|
857
938
|
}
|
|
858
939
|
|
|
859
940
|
// src/cli/dashboard/components/Notification.tsx
|
|
860
|
-
import { Box as Box3, Text as Text3 } from "ink";
|
|
941
|
+
import { Box as Box3, Text as Text3, useStdout as useStdout3 } from "ink";
|
|
861
942
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
862
943
|
function Notification() {
|
|
863
944
|
const { state } = useDashboard();
|
|
864
945
|
const { notification } = state;
|
|
946
|
+
const { stdout } = useStdout3();
|
|
947
|
+
const cols = stdout?.columns || 80;
|
|
865
948
|
if (!notification || !notification.active) return null;
|
|
866
949
|
if (notification.autoHideAt && Date.now() > notification.autoHideAt) return null;
|
|
867
|
-
const
|
|
868
|
-
const
|
|
950
|
+
const color = notification.severity === "critical" ? "red" : notification.severity === "warning" ? "yellow" : "blue";
|
|
951
|
+
const maxMsgLen = Math.max(20, cols - 8);
|
|
952
|
+
const msg = notification.message.length > maxMsgLen ? notification.message.slice(0, maxMsgLen - 1) + "..." : notification.message;
|
|
869
953
|
return /* @__PURE__ */ jsxs3(Box3, { paddingX: 1, children: [
|
|
870
|
-
/* @__PURE__ */ jsx4(Text3, {
|
|
871
|
-
|
|
872
|
-
" (",
|
|
873
|
-
notification.file,
|
|
874
|
-
")"
|
|
875
|
-
] })
|
|
954
|
+
/* @__PURE__ */ jsx4(Text3, { color, bold: true, children: "\u25CF " }),
|
|
955
|
+
/* @__PURE__ */ jsx4(Text3, { wrap: "truncate", children: msg })
|
|
876
956
|
] });
|
|
877
957
|
}
|
|
878
958
|
|
|
879
959
|
// src/cli/dashboard/components/ConfigDialog.tsx
|
|
880
|
-
import { useState
|
|
960
|
+
import { useState } from "react";
|
|
881
961
|
import { Box as Box4, Text as Text4, useInput } from "ink";
|
|
882
962
|
import { existsSync } from "fs";
|
|
883
963
|
import { rm } from "fs/promises";
|
|
884
964
|
import { join } from "path";
|
|
885
|
-
import {
|
|
965
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
886
966
|
function maskKey(key) {
|
|
887
967
|
if (!key || key.length < 12) return "Not set";
|
|
888
968
|
return key.slice(0, 7) + "..." + key.slice(-4);
|
|
889
969
|
}
|
|
890
970
|
function ConfigDialog({ onClose }) {
|
|
891
971
|
const { state, dispatch } = useDashboard();
|
|
892
|
-
const [section, setSection] =
|
|
893
|
-
const [selectedIndex, setSelectedIndex] =
|
|
894
|
-
const [editing, setEditing] =
|
|
895
|
-
const [editBuffer, setEditBuffer] =
|
|
896
|
-
const [editIsText, setEditIsText] =
|
|
897
|
-
const [showConfirmClear, setShowConfirmClear] =
|
|
898
|
-
const [clearingMemory, setClearingMemory] =
|
|
972
|
+
const [section, setSection] = useState("main");
|
|
973
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
974
|
+
const [editing, setEditing] = useState(false);
|
|
975
|
+
const [editBuffer, setEditBuffer] = useState("");
|
|
976
|
+
const [editIsText, setEditIsText] = useState(false);
|
|
977
|
+
const [showConfirmClear, setShowConfirmClear] = useState(false);
|
|
978
|
+
const [clearingMemory, setClearingMemory] = useState(false);
|
|
899
979
|
const config = state.agentConfig;
|
|
900
980
|
const currentKeyDisplay = isAIAvailable() ? maskKey(getKeyFromKeychain() || process.env.ANTHROPIC_API_KEY || null) : "Not set";
|
|
901
981
|
const keyActive = isAIAvailable();
|
|
902
982
|
const mainMenu = [
|
|
903
983
|
{ label: "API Keys", key: "apiKeys", value: keyActive ? "Active" : "Not set", section: "main" },
|
|
904
|
-
{ label: "
|
|
984
|
+
{ label: "AI Watcher", key: "aiWatcher", value: config.aiWatcher.enabled ? `${(config.aiWatcher.hourlyTokenLimit / 1e3).toFixed(0)}k/hr` : "Off", section: "main" },
|
|
985
|
+
{ label: "Performance", key: "performance", value: `${config.performance.maxConcurrency} concurrent`, section: "main" },
|
|
905
986
|
{ label: "Risk Thresholds", key: "riskThresholds", value: `critical: ${config.riskThresholds.critical}%`, section: "main" },
|
|
906
|
-
{ label: "Memory
|
|
987
|
+
{ label: "Memory", key: "memory", value: "Clear & Reset", section: "main" }
|
|
907
988
|
];
|
|
908
989
|
const apiKeysItems = [
|
|
909
990
|
{ label: "Anthropic", key: "anthropic", value: currentKeyDisplay, section: "apiKeys" }
|
|
@@ -916,14 +997,22 @@ function ConfigDialog({ onClose }) {
|
|
|
916
997
|
{ label: "Workers", key: "workers", value: config.performance.workers ? "on" : "off", section: "performance" }
|
|
917
998
|
];
|
|
918
999
|
const riskItems = [
|
|
919
|
-
{ label: "Critical
|
|
920
|
-
{ label: "High
|
|
921
|
-
{ label: "Medium
|
|
1000
|
+
{ label: "Critical", key: "critical", value: String(config.riskThresholds.critical), section: "riskThresholds" },
|
|
1001
|
+
{ label: "High", key: "high", value: String(config.riskThresholds.high), section: "riskThresholds" },
|
|
1002
|
+
{ label: "Medium", key: "medium", value: String(config.riskThresholds.medium), section: "riskThresholds" }
|
|
1003
|
+
];
|
|
1004
|
+
const aiWatcherItems = [
|
|
1005
|
+
{ label: "Enabled", key: "enabled", value: config.aiWatcher.enabled ? "on" : "off", section: "aiWatcher" },
|
|
1006
|
+
{ label: "Token Budget /hr", key: "hourlyTokenLimit", value: String(config.aiWatcher.hourlyTokenLimit), section: "aiWatcher" },
|
|
1007
|
+
{ label: "Scan Cooldown (s)", key: "scanCooldownSec", value: String(config.aiWatcher.scanCooldownSec), section: "aiWatcher" },
|
|
1008
|
+
{ label: "Clean Cooldown (s)", key: "cleanFileCooldownSec", value: String(config.aiWatcher.cleanFileCooldownSec), section: "aiWatcher" },
|
|
1009
|
+
{ label: "Max Files/Scan", key: "maxFilesPerScan", value: String(config.aiWatcher.maxFilesPerScan), section: "aiWatcher" },
|
|
1010
|
+
{ label: "Max Chars/File", key: "maxCharsPerFile", value: String(config.aiWatcher.maxCharsPerFile), section: "aiWatcher" }
|
|
922
1011
|
];
|
|
923
1012
|
const memoryItems = [
|
|
924
1013
|
{ label: "Clear All Memory", key: "clearAll", value: "Reset ledger, context graph", section: "memory" }
|
|
925
1014
|
];
|
|
926
|
-
const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "memory" ? memoryItems : mainMenu;
|
|
1015
|
+
const items = section === "main" ? mainMenu : section === "apiKeys" ? apiKeysItems : section === "performance" ? performanceItems : section === "riskThresholds" ? riskItems : section === "aiWatcher" ? aiWatcherItems : section === "memory" ? memoryItems : mainMenu;
|
|
927
1016
|
useInput((_input, key) => {
|
|
928
1017
|
if (showConfirmClear) {
|
|
929
1018
|
if (_input === "y" || _input === "Y") {
|
|
@@ -966,10 +1055,12 @@ function ConfigDialog({ onClose }) {
|
|
|
966
1055
|
}
|
|
967
1056
|
} else if (section === "riskThresholds") {
|
|
968
1057
|
patch.riskThresholds = { ...config.riskThresholds, [item.key]: val };
|
|
1058
|
+
} else if (section === "aiWatcher") {
|
|
1059
|
+
patch.aiWatcher = { ...config.aiWatcher, [item.key]: val };
|
|
969
1060
|
}
|
|
970
1061
|
if (Object.keys(patch).length > 0) {
|
|
971
1062
|
dispatch({ type: "SET_AGENT_CONFIG", config: patch });
|
|
972
|
-
dispatch({ type: "ADD_ACTIVITY", message:
|
|
1063
|
+
dispatch({ type: "ADD_ACTIVITY", message: `${item.label} set to ${val}` });
|
|
973
1064
|
}
|
|
974
1065
|
}
|
|
975
1066
|
}
|
|
@@ -1017,7 +1108,13 @@ function ConfigDialog({ onClose }) {
|
|
|
1017
1108
|
} else {
|
|
1018
1109
|
const item = items[selectedIndex];
|
|
1019
1110
|
if (item) {
|
|
1020
|
-
if (
|
|
1111
|
+
if (section === "aiWatcher" && item.key === "enabled") {
|
|
1112
|
+
const patch = {
|
|
1113
|
+
aiWatcher: { ...config.aiWatcher, enabled: !config.aiWatcher.enabled }
|
|
1114
|
+
};
|
|
1115
|
+
dispatch({ type: "SET_AGENT_CONFIG", config: patch });
|
|
1116
|
+
dispatch({ type: "ADD_ACTIVITY", message: `AI Watcher ${!config.aiWatcher.enabled ? "enabled" : "disabled"}` });
|
|
1117
|
+
} else if (["parallel", "cache", "workers"].includes(item.key)) {
|
|
1021
1118
|
const patch = {
|
|
1022
1119
|
performance: { ...config.performance, [item.key]: !config.performance[item.key] }
|
|
1023
1120
|
};
|
|
@@ -1030,7 +1127,7 @@ function ConfigDialog({ onClose }) {
|
|
|
1030
1127
|
}
|
|
1031
1128
|
}
|
|
1032
1129
|
});
|
|
1033
|
-
const sectionTitle = section === "main" ? "
|
|
1130
|
+
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
1131
|
async function clearMemory() {
|
|
1035
1132
|
const workDir = getWorkingDirectory(void 0, true);
|
|
1036
1133
|
const trieDir = getTrieDirectory(workDir);
|
|
@@ -1047,174 +1144,191 @@ function ConfigDialog({ onClose }) {
|
|
|
1047
1144
|
}
|
|
1048
1145
|
}
|
|
1049
1146
|
}
|
|
1050
|
-
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column",
|
|
1147
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", paddingX: 1, children: [
|
|
1051
1148
|
/* @__PURE__ */ jsx5(Text4, { bold: true, children: sectionTitle }),
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
|
|
1054
|
-
/* @__PURE__ */ jsx5(Text4, { children: " " }),
|
|
1055
|
-
/* @__PURE__ */ jsx5(Text4, {
|
|
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: [
|
|
1149
|
+
showConfirmClear && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
1150
|
+
/* @__PURE__ */ jsx5(Text4, { color: "red", bold: true, children: "Clear all memory?" }),
|
|
1151
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Risk hotspots, decisions, incidents, insights" }),
|
|
1152
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Goals, hypotheses, and config are preserved" }),
|
|
1153
|
+
clearingMemory ? /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Clearing..." }) : /* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1071
1154
|
" ",
|
|
1072
|
-
/* @__PURE__ */ jsx5(Text4, { bold: true, children: "
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
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" })
|
|
1155
|
+
/* @__PURE__ */ jsx5(Text4, { bold: true, children: "y" }),
|
|
1156
|
+
" confirm ",
|
|
1157
|
+
/* @__PURE__ */ jsx5(Text4, { bold: true, children: "n" }),
|
|
1158
|
+
" cancel"
|
|
1159
|
+
] })
|
|
1085
1160
|
] }),
|
|
1086
|
-
!showConfirmClear && section === "
|
|
1161
|
+
!showConfirmClear && section === "memory" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
1162
|
+
/* @__PURE__ */ jsx5(Text4, { children: " Clear All Memory" }),
|
|
1163
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " Reset ledger, context graph, issue store" }),
|
|
1164
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to clear \xB7 esc back" })
|
|
1165
|
+
] }),
|
|
1166
|
+
!showConfirmClear && section === "apiKeys" && !editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
1087
1167
|
/* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1088
1168
|
" ",
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
/* @__PURE__ */ jsx5(Text4, { children: currentKeyDisplay }),
|
|
1169
|
+
"Anthropic: ",
|
|
1170
|
+
currentKeyDisplay,
|
|
1092
1171
|
" ",
|
|
1093
1172
|
keyActive ? /* @__PURE__ */ jsx5(Text4, { color: "green", children: "\u25CF Active" }) : /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "\u25CB Not set" })
|
|
1094
1173
|
] }),
|
|
1095
|
-
/* @__PURE__ */ jsx5(Text4, { children: " " })
|
|
1096
|
-
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to update esc back" })
|
|
1174
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter to update \xB7 esc back" })
|
|
1097
1175
|
] }),
|
|
1098
|
-
!showConfirmClear && section === "apiKeys" && editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
1099
|
-
/* @__PURE__ */ jsx5(Box4, { borderStyle: "
|
|
1176
|
+
!showConfirmClear && section === "apiKeys" && editing && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
1177
|
+
/* @__PURE__ */ jsx5(Box4, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1100
1178
|
editBuffer || /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: "sk-ant-..." }),
|
|
1101
1179
|
/* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "|" })
|
|
1102
1180
|
] }) }),
|
|
1181
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
1182
|
+
] }),
|
|
1183
|
+
!showConfirmClear && section !== "apiKeys" && section !== "memory" && /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", marginTop: 1, children: [
|
|
1184
|
+
items.map((item, idx) => {
|
|
1185
|
+
const isSelected = selectedIndex === idx;
|
|
1186
|
+
return /* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1187
|
+
isSelected ? /* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "> " }) : " ",
|
|
1188
|
+
/* @__PURE__ */ jsx5(Text4, { bold: isSelected, children: item.label }),
|
|
1189
|
+
/* @__PURE__ */ jsx5(Text4, { dimColor: true, children: " " }),
|
|
1190
|
+
editing && isSelected ? /* @__PURE__ */ jsxs4(Text4, { children: [
|
|
1191
|
+
editBuffer,
|
|
1192
|
+
/* @__PURE__ */ jsx5(Text4, { bold: true, color: "green", children: "|" })
|
|
1193
|
+
] }) : /* @__PURE__ */ jsx5(Text4, { dimColor: true, children: item.value })
|
|
1194
|
+
] }, item.key);
|
|
1195
|
+
}),
|
|
1103
1196
|
/* @__PURE__ */ jsxs4(Text4, { dimColor: true, children: [
|
|
1104
|
-
"
|
|
1105
|
-
|
|
1106
|
-
") esc cancel"
|
|
1197
|
+
" ",
|
|
1198
|
+
section === "main" ? "enter select \xB7 esc close" : "enter edit \xB7 esc back"
|
|
1107
1199
|
] })
|
|
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
1200
|
] })
|
|
1130
1201
|
] });
|
|
1131
1202
|
}
|
|
1132
1203
|
|
|
1133
1204
|
// src/cli/dashboard/views/OverviewView.tsx
|
|
1134
|
-
import { Box as Box5, Text as Text5 } from "ink";
|
|
1135
|
-
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1205
|
+
import { Box as Box5, Text as Text5, useInput as useInput2, useStdout as useStdout4 } from "ink";
|
|
1206
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1207
|
+
function truncate(str, max) {
|
|
1208
|
+
return str.length > max ? str.slice(0, max - 1) + "..." : str;
|
|
1209
|
+
}
|
|
1136
1210
|
function OverviewView() {
|
|
1137
|
-
const { state } = useDashboard();
|
|
1138
|
-
const { progress, signalExtraction, watch, issues, activityLog, activityPage } = state;
|
|
1211
|
+
const { state, dispatch } = useDashboard();
|
|
1212
|
+
const { progress, signalExtraction, watch, issues, activityLog, activityPage, pendingFixes, selectedFixIndex } = state;
|
|
1139
1213
|
const { totalIssues } = progress;
|
|
1214
|
+
const { stdout } = useStdout4();
|
|
1215
|
+
const cols = stdout?.columns || 80;
|
|
1216
|
+
const narrow = cols < 60;
|
|
1217
|
+
const contentWidth = Math.max(20, cols - 4);
|
|
1140
1218
|
const endTime = state.scanComplete && state.scanEndTime ? state.scanEndTime : Date.now();
|
|
1141
1219
|
const elapsed = ((endTime - state.scanStartTime) / 1e3).toFixed(1);
|
|
1142
1220
|
const criticalIssues = issues.filter((i) => i.severity === "critical").slice(0, 3);
|
|
1143
|
-
const
|
|
1221
|
+
const activeFixes = pendingFixes.filter((f) => f.status === "pending" || f.status === "applying");
|
|
1222
|
+
const activityRows = activeFixes.length > 0 ? 5 : 8;
|
|
1144
1223
|
const startIdx = activityPage * activityRows;
|
|
1145
1224
|
const pageActivities = activityLog.slice(startIdx, startIdx + activityRows);
|
|
1225
|
+
useInput2((input, key) => {
|
|
1226
|
+
if (state.view !== "overview" || activeFixes.length === 0) return;
|
|
1227
|
+
if (key.upArrow && activeFixes.length > 0) {
|
|
1228
|
+
dispatch({ type: "SELECT_FIX", index: Math.max(0, selectedFixIndex - 1) });
|
|
1229
|
+
}
|
|
1230
|
+
if (key.downArrow && activeFixes.length > 0) {
|
|
1231
|
+
dispatch({ type: "SELECT_FIX", index: Math.min(activeFixes.length - 1, selectedFixIndex + 1) });
|
|
1232
|
+
}
|
|
1233
|
+
if (input === "f" && activeFixes[selectedFixIndex]) {
|
|
1234
|
+
dispatch({ type: "APPROVE_FIX", id: activeFixes[selectedFixIndex].id });
|
|
1235
|
+
}
|
|
1236
|
+
if (input === "x" && activeFixes[selectedFixIndex]) {
|
|
1237
|
+
dispatch({ type: "DISMISS_FIX", id: activeFixes[selectedFixIndex].id });
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1146
1240
|
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 1, children: [
|
|
1147
|
-
/* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
elapsed,
|
|
1154
|
-
"s"
|
|
1155
|
-
] })
|
|
1241
|
+
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1242
|
+
"Scanned ",
|
|
1243
|
+
watch.filesScannedSession,
|
|
1244
|
+
" files ",
|
|
1245
|
+
elapsed,
|
|
1246
|
+
"s"
|
|
1156
1247
|
] }),
|
|
1157
|
-
watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs5(
|
|
1158
|
-
/* @__PURE__ */
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
/* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "enabled" })
|
|
1162
|
-
] }),
|
|
1163
|
-
(signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1248
|
+
watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1249
|
+
/* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
|
|
1250
|
+
" Signal extraction",
|
|
1251
|
+
!narrow && (signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1164
1252
|
" ",
|
|
1165
|
-
|
|
1166
|
-
" ",
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
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" })
|
|
1253
|
+
signalExtraction.decisionsExtracted,
|
|
1254
|
+
"d \xB7 ",
|
|
1255
|
+
signalExtraction.factsExtracted,
|
|
1256
|
+
"f \xB7 ",
|
|
1257
|
+
signalExtraction.blockersExtracted,
|
|
1258
|
+
"b"
|
|
1175
1259
|
] })
|
|
1176
1260
|
] }),
|
|
1177
|
-
criticalIssues.length > 0 &&
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
})
|
|
1194
|
-
] }),
|
|
1195
|
-
totalIssues === 0 && criticalIssues.length === 0 && /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1261
|
+
criticalIssues.length > 0 && criticalIssues.map((issue, i) => {
|
|
1262
|
+
const filename = issue.file.split("/").pop() || issue.file;
|
|
1263
|
+
const lineNum = issue.line ? `:${issue.line}` : "";
|
|
1264
|
+
const issueLen = Math.max(15, contentWidth - filename.length - 6);
|
|
1265
|
+
return /* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1266
|
+
/* @__PURE__ */ jsx6(Text5, { color: "red", children: "\u25CF" }),
|
|
1267
|
+
" ",
|
|
1268
|
+
/* @__PURE__ */ jsx6(Text5, { color: "red", children: truncate(issue.issue, issueLen) }),
|
|
1269
|
+
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1270
|
+
" ",
|
|
1271
|
+
filename,
|
|
1272
|
+
lineNum
|
|
1273
|
+
] })
|
|
1274
|
+
] }, i);
|
|
1275
|
+
}),
|
|
1276
|
+
totalIssues === 0 && criticalIssues.length === 0 && activeFixes.length === 0 && /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1196
1277
|
/* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
|
|
1197
|
-
" No issues
|
|
1278
|
+
" No issues"
|
|
1198
1279
|
] }),
|
|
1199
|
-
/* @__PURE__ */
|
|
1200
|
-
|
|
1280
|
+
activeFixes.length > 0 && /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, children: [
|
|
1281
|
+
/* @__PURE__ */ jsx6(Text5, { bold: true, children: "Goal Violations" }),
|
|
1282
|
+
activeFixes.map((fix, i) => {
|
|
1283
|
+
const isSelected = i === selectedFixIndex;
|
|
1284
|
+
const confidenceColor = fix.confidence >= 90 ? "green" : fix.confidence >= 70 ? "yellow" : "red";
|
|
1285
|
+
const shortFile = fix.file.split("/").pop() || fix.file;
|
|
1286
|
+
const descLen = Math.max(15, contentWidth - shortFile.length - 10);
|
|
1287
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
1288
|
+
/* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1289
|
+
isSelected ? /* @__PURE__ */ jsx6(Text5, { bold: true, color: "yellow", children: "> " }) : " ",
|
|
1290
|
+
/* @__PURE__ */ jsx6(Text5, { color: "yellow", children: "\u25CF" }),
|
|
1291
|
+
" ",
|
|
1292
|
+
/* @__PURE__ */ jsx6(Text5, { children: truncate(fix.description, descLen) }),
|
|
1293
|
+
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1294
|
+
" ",
|
|
1295
|
+
shortFile
|
|
1296
|
+
] })
|
|
1297
|
+
] }),
|
|
1298
|
+
/* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1299
|
+
" ",
|
|
1300
|
+
/* @__PURE__ */ jsxs5(Text5, { color: confidenceColor, bold: true, children: [
|
|
1301
|
+
fix.confidence,
|
|
1302
|
+
"%"
|
|
1303
|
+
] }),
|
|
1304
|
+
narrow ? fix.status === "applying" && /* @__PURE__ */ jsx6(Text5, { color: "cyan", children: " applying..." }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1305
|
+
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1306
|
+
" confidence fix: ",
|
|
1307
|
+
truncate(fix.suggestedFix, contentWidth - 25)
|
|
1308
|
+
] }),
|
|
1309
|
+
fix.status === "applying" && /* @__PURE__ */ jsx6(Text5, { color: "cyan", children: " applying..." })
|
|
1310
|
+
] })
|
|
1311
|
+
] })
|
|
1312
|
+
] }, fix.id);
|
|
1313
|
+
}),
|
|
1314
|
+
/* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " f fix \xB7 x dismiss" })
|
|
1315
|
+
] }),
|
|
1316
|
+
/* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", marginTop: 1, children: [
|
|
1201
1317
|
/* @__PURE__ */ jsx6(Text5, { bold: true, children: "Activity" }),
|
|
1202
|
-
pageActivities.map((entry, i) => /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1318
|
+
pageActivities.map((entry, i) => /* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1203
1319
|
" ",
|
|
1204
|
-
/* @__PURE__ */ jsx6(Text5, { dimColor: true, children:
|
|
1205
|
-
" ",
|
|
1206
|
-
entry.message,
|
|
1320
|
+
/* @__PURE__ */ jsx6(Text5, { dimColor: true, children: entry.time }),
|
|
1207
1321
|
" ",
|
|
1208
|
-
|
|
1322
|
+
truncate(entry.message, contentWidth - 14)
|
|
1209
1323
|
] }, i)),
|
|
1210
|
-
pageActivities.length === 0 && /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " No activity yet
|
|
1324
|
+
pageActivities.length === 0 && /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " No activity yet" })
|
|
1211
1325
|
] })
|
|
1212
1326
|
] });
|
|
1213
1327
|
}
|
|
1214
1328
|
|
|
1215
1329
|
// src/cli/dashboard/views/AgentView.tsx
|
|
1216
|
-
import { useEffect
|
|
1217
|
-
import { Box as Box6, Text as Text6, useInput as
|
|
1330
|
+
import { useEffect, useCallback } from "react";
|
|
1331
|
+
import { Box as Box6, Text as Text6, useInput as useInput3, useStdout as useStdout5 } from "ink";
|
|
1218
1332
|
|
|
1219
1333
|
// src/cli/dashboard/theme.ts
|
|
1220
1334
|
import pc from "picocolors";
|
|
@@ -1265,6 +1379,9 @@ function timeAgo(iso) {
|
|
|
1265
1379
|
function AgentView() {
|
|
1266
1380
|
const { state, dispatch } = useDashboard();
|
|
1267
1381
|
const { agentInsights, agentBrain, selectedInsight, expandedInsight } = state;
|
|
1382
|
+
const { stdout } = useStdout5();
|
|
1383
|
+
const cols = stdout?.columns || 80;
|
|
1384
|
+
const msgLen = Math.max(20, cols - 25);
|
|
1268
1385
|
const visibleInsights = getVisibleInsights(state);
|
|
1269
1386
|
const alerts = visibleInsights.filter((i) => i.type === "warning");
|
|
1270
1387
|
const { decisions, patterns, loaded } = agentBrain;
|
|
@@ -1283,26 +1400,21 @@ function AgentView() {
|
|
|
1283
1400
|
dispatch({ type: "ADD_ACTIVITY", message: "Agent brain load error" });
|
|
1284
1401
|
}
|
|
1285
1402
|
}, [dispatch]);
|
|
1286
|
-
|
|
1403
|
+
useEffect(() => {
|
|
1287
1404
|
if (!loaded) {
|
|
1288
1405
|
void loadBrain();
|
|
1289
1406
|
}
|
|
1290
1407
|
}, [loaded, loadBrain]);
|
|
1291
|
-
|
|
1292
|
-
if (key.upArrow || input === "k") {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
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
|
-
}
|
|
1408
|
+
useInput3((input, key) => {
|
|
1409
|
+
if (key.upArrow || input === "k") dispatch({ type: "NAVIGATE_UP" });
|
|
1410
|
+
else if (key.downArrow || input === "j") dispatch({ type: "NAVIGATE_DOWN" });
|
|
1411
|
+
else if (key.return) dispatch({ type: "TOGGLE_INSIGHT", index: selectedInsight });
|
|
1412
|
+
else if (input === "d") dispatch({ type: "DISMISS_INSIGHT", index: selectedInsight });
|
|
1301
1413
|
});
|
|
1302
1414
|
const alertCount = alerts.length;
|
|
1303
1415
|
const decCount = decisions.length;
|
|
1304
1416
|
const patCount = patterns.length;
|
|
1305
|
-
if (
|
|
1417
|
+
if (!loaded) {
|
|
1306
1418
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
|
|
1307
1419
|
/* @__PURE__ */ jsx7(Text6, { bold: true, children: "Nudges" }),
|
|
1308
1420
|
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Loading..." })
|
|
@@ -1311,108 +1423,80 @@ function AgentView() {
|
|
|
1311
1423
|
if (alertCount === 0 && decCount === 0 && patCount === 0) {
|
|
1312
1424
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
|
|
1313
1425
|
/* @__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." })
|
|
1426
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " No nudges yet. Trie will alert you here when it spots issues." })
|
|
1317
1427
|
] });
|
|
1318
1428
|
}
|
|
1319
|
-
const confidentPatterns = patterns.filter((p) => p.confidence > 0.7).length;
|
|
1320
|
-
const learningPatterns = patterns.filter((p) => p.confidence <= 0.7).length;
|
|
1321
1429
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
|
|
1322
1430
|
/* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1323
1431
|
/* @__PURE__ */ jsx7(Text6, { bold: true, children: "Nudges" }),
|
|
1324
|
-
" ",
|
|
1325
1432
|
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1326
|
-
alertCount,
|
|
1327
|
-
" alert",
|
|
1328
|
-
alertCount !== 1 ? "s" : "",
|
|
1329
1433
|
" ",
|
|
1434
|
+
alertCount,
|
|
1435
|
+
" alerts \xB7 ",
|
|
1330
1436
|
decCount,
|
|
1331
|
-
"
|
|
1332
|
-
decCount !== 1 ? "s" : "",
|
|
1333
|
-
" ",
|
|
1437
|
+
" decisions \xB7 ",
|
|
1334
1438
|
patCount,
|
|
1335
|
-
"
|
|
1336
|
-
patCount !== 1 ? "s" : ""
|
|
1439
|
+
" patterns"
|
|
1337
1440
|
] })
|
|
1338
1441
|
] }),
|
|
1339
|
-
/* @__PURE__ */ jsx7(
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
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 }),
|
|
1442
|
+
alertCount > 0 && /* @__PURE__ */ jsx7(Box6, { flexDirection: "column", marginTop: 1, children: alerts.map((insight, idx) => {
|
|
1443
|
+
const isSelected = idx === selectedInsight;
|
|
1444
|
+
const isExpanded = idx === expandedInsight;
|
|
1445
|
+
const ago = formatTimeAgo(insight.timestamp);
|
|
1446
|
+
const msg = insight.message.slice(0, msgLen) + (insight.message.length > msgLen ? "..." : "");
|
|
1447
|
+
const riskColor = insight.priority >= 8 ? "red" : insight.priority >= 5 ? "yellow" : void 0;
|
|
1448
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1449
|
+
/* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1450
|
+
isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, color: "green", children: "> " }) : " ",
|
|
1451
|
+
riskColor ? /* @__PURE__ */ jsx7(Text6, { color: riskColor, children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
|
|
1452
|
+
" ",
|
|
1453
|
+
isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, children: msg }) : /* @__PURE__ */ jsx7(Text6, { children: msg }),
|
|
1454
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1357
1455
|
" ",
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
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 })
|
|
1456
|
+
insight.category,
|
|
1457
|
+
" \xB7 ",
|
|
1458
|
+
ago
|
|
1369
1459
|
] })
|
|
1370
|
-
] },
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1460
|
+
] }),
|
|
1461
|
+
(isExpanded || isSelected) && insight.suggestedAction && /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1462
|
+
" ",
|
|
1463
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1464
|
+
"->",
|
|
1465
|
+
" "
|
|
1466
|
+
] }),
|
|
1467
|
+
/* @__PURE__ */ jsx7(Text6, { children: insight.suggestedAction })
|
|
1468
|
+
] })
|
|
1469
|
+
] }, insight.id);
|
|
1470
|
+
}) }),
|
|
1471
|
+
decCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
|
|
1472
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Decisions" }),
|
|
1376
1473
|
decisions.slice(0, 10).map((dec) => {
|
|
1377
1474
|
const ago = timeAgo(dec.when);
|
|
1378
|
-
const hash = dec.hash ? dec.hash.slice(0, 6) : "";
|
|
1379
1475
|
const active = dec.status === "active";
|
|
1380
1476
|
return /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1381
1477
|
" ",
|
|
1382
1478
|
active ? /* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
|
|
1383
1479
|
" ",
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
] }),
|
|
1388
|
-
" ",
|
|
1389
|
-
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: ago }),
|
|
1390
|
-
hash && /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1480
|
+
dec.decision.slice(0, msgLen),
|
|
1481
|
+
dec.decision.length > msgLen ? "..." : "",
|
|
1482
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1391
1483
|
" ",
|
|
1392
|
-
|
|
1484
|
+
ago
|
|
1393
1485
|
] })
|
|
1394
1486
|
] }, dec.id);
|
|
1395
|
-
})
|
|
1396
|
-
/* @__PURE__ */ jsx7(Text6, { children: " " })
|
|
1487
|
+
})
|
|
1397
1488
|
] }),
|
|
1398
|
-
patCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1399
|
-
/* @__PURE__ */ jsx7(Text6, {
|
|
1400
|
-
confidentPatterns > 0 && /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1401
|
-
" ",
|
|
1402
|
-
confidentPatterns,
|
|
1403
|
-
" confident ",
|
|
1404
|
-
learningPatterns,
|
|
1405
|
-
" learning"
|
|
1406
|
-
] }),
|
|
1489
|
+
patCount > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
|
|
1490
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " Patterns" }),
|
|
1407
1491
|
patterns.slice(0, 8).map((pat, idx) => {
|
|
1408
1492
|
const conf = Math.round(pat.confidence * 100);
|
|
1409
1493
|
const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
|
|
1410
|
-
const desc = pat.description.slice(0, 45) + (pat.description.length > 45 ? "..." : "");
|
|
1411
1494
|
return /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1412
1495
|
" ",
|
|
1413
1496
|
pat.isAntiPattern ? /* @__PURE__ */ jsx7(Text6, { color: "red", children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
|
|
1414
1497
|
" ",
|
|
1415
|
-
|
|
1498
|
+
pat.description.slice(0, msgLen),
|
|
1499
|
+
pat.description.length > msgLen ? "..." : "",
|
|
1416
1500
|
" ",
|
|
1417
1501
|
confColor ? /* @__PURE__ */ jsxs6(Text6, { color: confColor, children: [
|
|
1418
1502
|
conf,
|
|
@@ -1420,18 +1504,16 @@ function AgentView() {
|
|
|
1420
1504
|
] }) : /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1421
1505
|
conf,
|
|
1422
1506
|
"%"
|
|
1423
|
-
] })
|
|
1424
|
-
pat.isAntiPattern && /* @__PURE__ */ jsx7(Text6, { color: "red", children: " anti-pattern" })
|
|
1507
|
+
] })
|
|
1425
1508
|
] }, idx);
|
|
1426
1509
|
})
|
|
1427
1510
|
] }),
|
|
1428
|
-
/* @__PURE__ */
|
|
1429
|
-
/* @__PURE__ */ jsxs6(Box6, { gap: 2, children: [
|
|
1511
|
+
/* @__PURE__ */ jsxs6(Box6, { marginTop: 1, gap: 2, children: [
|
|
1430
1512
|
isAIAvailable() ? /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1431
1513
|
/* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }),
|
|
1432
1514
|
" ",
|
|
1433
1515
|
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "AI" })
|
|
1434
|
-
] }) : /* @__PURE__ */ jsx7(Text6, {
|
|
1516
|
+
] }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB AI off" }),
|
|
1435
1517
|
agentInsights.filter((i) => i.type === "celebration").length > 0 && /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1436
1518
|
/* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }),
|
|
1437
1519
|
" ",
|
|
@@ -1446,7 +1528,7 @@ function AgentView() {
|
|
|
1446
1528
|
|
|
1447
1529
|
// src/cli/dashboard/views/GoalsView.tsx
|
|
1448
1530
|
import { useCallback as useCallback2 } from "react";
|
|
1449
|
-
import { Box as Box7, Text as Text7, useInput as
|
|
1531
|
+
import { Box as Box7, Text as Text7, useInput as useInput4 } from "ink";
|
|
1450
1532
|
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1451
1533
|
function calculateGoalProgress(goal) {
|
|
1452
1534
|
if (goal.target <= 0) return 0;
|
|
@@ -1543,7 +1625,7 @@ function GoalsView() {
|
|
|
1543
1625
|
} catch {
|
|
1544
1626
|
}
|
|
1545
1627
|
}, [dispatch, refreshGoals]);
|
|
1546
|
-
|
|
1628
|
+
useInput4((_input, key) => {
|
|
1547
1629
|
if (goalsPanel.inputMode === "add") {
|
|
1548
1630
|
if (key.escape) {
|
|
1549
1631
|
dispatch({ type: "SET_GOALS_INPUT_MODE", mode: "browse" });
|
|
@@ -1575,50 +1657,35 @@ function GoalsView() {
|
|
|
1575
1657
|
}
|
|
1576
1658
|
});
|
|
1577
1659
|
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
|
|
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: [
|
|
1660
|
+
/* @__PURE__ */ jsx8(Text7, { bold: true, children: "Goals" }),
|
|
1661
|
+
goalsPanel.inputMode === "add" ? /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
|
|
1662
|
+
/* @__PURE__ */ jsx8(Box7, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1586
1663
|
goalsPanel.inputBuffer,
|
|
1587
1664
|
/* @__PURE__ */ jsx8(Text7, { bold: true, color: "green", children: "|" })
|
|
1588
1665
|
] }) }),
|
|
1589
1666
|
/* @__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
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
] }) : /* @__PURE__ */ jsx8(Text7, { children: " " }),
|
|
1605
|
-
/* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CB" }),
|
|
1667
|
+
] }) : /* @__PURE__ */ jsx8(Fragment2, { 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: [
|
|
1668
|
+
activeGoals.map((goal, idx) => {
|
|
1669
|
+
const isSelected = goalsPanel.selectedIndex === idx;
|
|
1670
|
+
const progress = calculateGoalProgress(goal);
|
|
1671
|
+
const bar = progressBar(progress, 100, 8);
|
|
1672
|
+
const source = goal.autoGenerated ? "auto" : "";
|
|
1673
|
+
return /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1674
|
+
isSelected ? /* @__PURE__ */ jsx8(Text7, { bold: true, color: "green", children: "> " }) : " ",
|
|
1675
|
+
/* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CB" }),
|
|
1676
|
+
" ",
|
|
1677
|
+
goal.description.slice(0, 45),
|
|
1678
|
+
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1679
|
+
" ",
|
|
1680
|
+
bar,
|
|
1606
1681
|
" ",
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
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: [
|
|
1682
|
+
progress,
|
|
1683
|
+
"%",
|
|
1684
|
+
source ? ` ${source}` : ""
|
|
1685
|
+
] })
|
|
1686
|
+
] }, goal.id);
|
|
1687
|
+
}),
|
|
1688
|
+
achievedGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
|
|
1622
1689
|
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Achieved" }),
|
|
1623
1690
|
achievedGoals.slice(0, 5).map((g) => /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1624
1691
|
" ",
|
|
@@ -1630,20 +1697,17 @@ function GoalsView() {
|
|
|
1630
1697
|
" +",
|
|
1631
1698
|
achievedGoals.length - 5,
|
|
1632
1699
|
" more"
|
|
1633
|
-
] })
|
|
1634
|
-
/* @__PURE__ */ jsx8(Text7, { children: " " })
|
|
1700
|
+
] })
|
|
1635
1701
|
] }),
|
|
1636
|
-
otherGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
1702
|
+
otherGoals.length > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
|
|
1637
1703
|
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Other" }),
|
|
1638
1704
|
otherGoals.slice(0, 2).map((g) => /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1639
1705
|
" ",
|
|
1640
1706
|
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1641
1707
|
" ",
|
|
1642
1708
|
g.description.slice(0, 50),
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
g.status
|
|
1646
|
-
] })
|
|
1709
|
+
" ",
|
|
1710
|
+
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: g.status })
|
|
1647
1711
|
] }, g.id))
|
|
1648
1712
|
] })
|
|
1649
1713
|
] }) })
|
|
@@ -1652,7 +1716,7 @@ function GoalsView() {
|
|
|
1652
1716
|
|
|
1653
1717
|
// src/cli/dashboard/views/HypothesesView.tsx
|
|
1654
1718
|
import { useCallback as useCallback3 } from "react";
|
|
1655
|
-
import { Box as Box8, Text as Text8, useInput as
|
|
1719
|
+
import { Box as Box8, Text as Text8, useInput as useInput5 } from "ink";
|
|
1656
1720
|
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1657
1721
|
function HypothesesView() {
|
|
1658
1722
|
const { state, dispatch } = useDashboard();
|
|
@@ -1722,7 +1786,7 @@ function HypothesesView() {
|
|
|
1722
1786
|
} catch {
|
|
1723
1787
|
}
|
|
1724
1788
|
}, [dispatch, refreshHypotheses]);
|
|
1725
|
-
|
|
1789
|
+
useInput5((_input, key) => {
|
|
1726
1790
|
if (hypothesesPanel.inputMode === "add") {
|
|
1727
1791
|
if (key.escape) {
|
|
1728
1792
|
dispatch({ type: "SET_HYPOTHESES_INPUT_MODE", mode: "browse" });
|
|
@@ -1757,46 +1821,32 @@ function HypothesesView() {
|
|
|
1757
1821
|
}
|
|
1758
1822
|
});
|
|
1759
1823
|
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, children: [
|
|
1760
|
-
/* @__PURE__ */
|
|
1761
|
-
|
|
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: [
|
|
1824
|
+
/* @__PURE__ */ jsx9(Text8, { bold: true, children: "Hypotheses" }),
|
|
1825
|
+
hypothesesPanel.inputMode === "add" ? /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
1826
|
+
/* @__PURE__ */ jsx9(Box8, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1768
1827
|
hypothesesPanel.inputBuffer,
|
|
1769
1828
|
/* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "|" })
|
|
1770
1829
|
] }) }),
|
|
1771
1830
|
/* @__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
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
" "
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
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: [
|
|
1831
|
+
] }) : /* @__PURE__ */ jsx9(Fragment3, { 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: [
|
|
1832
|
+
testing.map((hypo, idx) => {
|
|
1833
|
+
const isSelected = hypothesesPanel.selectedIndex === idx;
|
|
1834
|
+
const conf = Math.round(hypo.confidence * 100);
|
|
1835
|
+
return /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1836
|
+
isSelected ? /* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "> " }) : " ",
|
|
1837
|
+
/* @__PURE__ */ jsx9(Text8, { color: "yellow", children: "\u25CB" }),
|
|
1838
|
+
" ",
|
|
1839
|
+
hypo.statement.slice(0, 50),
|
|
1840
|
+
/* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
|
|
1841
|
+
" ",
|
|
1842
|
+
conf,
|
|
1843
|
+
"% \xB7 ",
|
|
1844
|
+
hypo.evidenceCount,
|
|
1845
|
+
" evidence"
|
|
1846
|
+
] })
|
|
1847
|
+
] }, hypo.id);
|
|
1848
|
+
}),
|
|
1849
|
+
validated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
1800
1850
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Validated" }),
|
|
1801
1851
|
validated.slice(0, 3).map((h) => /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1802
1852
|
" ",
|
|
@@ -1808,10 +1858,9 @@ function HypothesesView() {
|
|
|
1808
1858
|
" +",
|
|
1809
1859
|
validated.length - 3,
|
|
1810
1860
|
" more"
|
|
1811
|
-
] })
|
|
1812
|
-
/* @__PURE__ */ jsx9(Text8, { children: " " })
|
|
1861
|
+
] })
|
|
1813
1862
|
] }),
|
|
1814
|
-
invalidated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
1863
|
+
invalidated.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
1815
1864
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Invalidated" }),
|
|
1816
1865
|
invalidated.slice(0, 2).map((h) => /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1817
1866
|
" ",
|
|
@@ -1830,8 +1879,8 @@ function HypothesesView() {
|
|
|
1830
1879
|
}
|
|
1831
1880
|
|
|
1832
1881
|
// src/cli/dashboard/views/MemoryTreeView.tsx
|
|
1833
|
-
import { useEffect as
|
|
1834
|
-
import { Box as Box9, Text as Text9, useInput as
|
|
1882
|
+
import { useEffect as useEffect2, useCallback as useCallback4 } from "react";
|
|
1883
|
+
import { Box as Box9, Text as Text9, useInput as useInput6 } from "ink";
|
|
1835
1884
|
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1836
1885
|
function timeAgo2(iso) {
|
|
1837
1886
|
const ms = Date.now() - new Date(iso).getTime();
|
|
@@ -1858,12 +1907,12 @@ function MemoryTreeView() {
|
|
|
1858
1907
|
dispatch({ type: "ADD_ACTIVITY", message: "Context graph load error" });
|
|
1859
1908
|
}
|
|
1860
1909
|
}, [dispatch]);
|
|
1861
|
-
|
|
1910
|
+
useEffect2(() => {
|
|
1862
1911
|
if (!loaded) {
|
|
1863
1912
|
void loadData();
|
|
1864
1913
|
}
|
|
1865
1914
|
}, [loaded, loadData]);
|
|
1866
|
-
|
|
1915
|
+
useInput6((_input, key) => {
|
|
1867
1916
|
if (key.upArrow || _input === "k") dispatch({ type: "NAVIGATE_UP" });
|
|
1868
1917
|
else if (key.downArrow || _input === "j") dispatch({ type: "NAVIGATE_DOWN" });
|
|
1869
1918
|
else if (key.return) dispatch({ type: "TOGGLE_MEMORY_NODE", nodeId: selectedNode });
|
|
@@ -1878,9 +1927,7 @@ function MemoryTreeView() {
|
|
|
1878
1927
|
if (!snapshot || snapshot.nodes.length === 0 && globalPatterns.length === 0) {
|
|
1879
1928
|
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 1, children: [
|
|
1880
1929
|
/* @__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." })
|
|
1930
|
+
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " No entries yet. Use trie tell or trie watch to build memory." })
|
|
1884
1931
|
] });
|
|
1885
1932
|
}
|
|
1886
1933
|
const decisionNodes = snapshot.nodes.filter((n) => n.type === "decision") ?? [];
|
|
@@ -1895,91 +1942,81 @@ function MemoryTreeView() {
|
|
|
1895
1942
|
function renderHeader(id, label, count, emptyHint) {
|
|
1896
1943
|
const expanded = expandedNodes.has(id);
|
|
1897
1944
|
const isEmpty = count === 0;
|
|
1898
|
-
return /* @__PURE__ */ jsxs9(
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1945
|
+
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1946
|
+
sel(id) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
1947
|
+
expanded && !isEmpty ? /* @__PURE__ */ jsx10(Text9, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
|
|
1948
|
+
" ",
|
|
1949
|
+
sel(id) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: label }) : /* @__PURE__ */ jsx10(Text9, { bold: true, children: label }),
|
|
1950
|
+
count > 0 ? /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
1951
|
+
" (",
|
|
1952
|
+
count,
|
|
1953
|
+
")"
|
|
1954
|
+
] }) : isEmpty && emptyHint ? /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
1905
1955
|
" ",
|
|
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
1956
|
emptyHint
|
|
1916
|
-
] })
|
|
1957
|
+
] }) : null
|
|
1917
1958
|
] });
|
|
1918
1959
|
}
|
|
1919
1960
|
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 1, children: [
|
|
1920
1961
|
/* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1921
1962
|
/* @__PURE__ */ jsx10(Text9, { bold: true, children: "Ledger" }),
|
|
1922
|
-
" ",
|
|
1923
1963
|
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
1964
|
+
" ",
|
|
1924
1965
|
totalEntries,
|
|
1925
1966
|
" entries"
|
|
1926
1967
|
] })
|
|
1927
1968
|
] }),
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
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: [
|
|
1969
|
+
/* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
1970
|
+
renderHeader("decisions", "Decisions", decisionNodes.length, "-- use trie tell or chat"),
|
|
1971
|
+
expandedNodes.has("decisions") && decisionNodes.slice(0, 10).map((n) => {
|
|
1972
|
+
const nodeId = `decision-${n.id}`;
|
|
1973
|
+
const dec = n.data.decision.length > 55 ? n.data.decision.slice(0, 52) + "..." : n.data.decision;
|
|
1974
|
+
const outcomeColor = n.data.outcome === "good" ? "green" : n.data.outcome === "bad" ? "red" : void 0;
|
|
1975
|
+
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1976
|
+
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
1977
|
+
" ",
|
|
1978
|
+
outcomeColor ? /* @__PURE__ */ jsx10(Text9, { color: outcomeColor, children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
|
|
1946
1979
|
" ",
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1980
|
+
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: dec }) : /* @__PURE__ */ jsx10(Text9, { children: dec }),
|
|
1981
|
+
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
1982
|
+
" ",
|
|
1983
|
+
timeAgo2(n.data.timestamp)
|
|
1984
|
+
] }),
|
|
1985
|
+
outcomeColor ? /* @__PURE__ */ jsxs9(Text9, { color: outcomeColor, children: [
|
|
1986
|
+
" ",
|
|
1987
|
+
n.data.outcome
|
|
1988
|
+
] }) : null
|
|
1989
|
+
] }, n.id);
|
|
1990
|
+
})
|
|
1991
|
+
] }),
|
|
1992
|
+
renderHeader("incidents", "Incidents", incidentNodes.length, "-- use trie tell"),
|
|
1952
1993
|
expandedNodes.has("incidents") && incidentNodes.slice(0, 10).map((n) => {
|
|
1953
1994
|
const nodeId = `incident-${n.id}`;
|
|
1954
1995
|
const sevColor = n.data.severity === "critical" ? "red" : n.data.severity === "major" ? "yellow" : void 0;
|
|
1955
1996
|
const desc = n.data.description.length > 55 ? n.data.description.slice(0, 52) + "..." : n.data.description;
|
|
1956
1997
|
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1957
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
1958
|
-
|
|
1959
|
-
" "
|
|
1960
|
-
] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
|
|
1961
|
-
" ",
|
|
1998
|
+
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
1999
|
+
" ",
|
|
1962
2000
|
sevColor ? /* @__PURE__ */ jsx10(Text9, { color: sevColor, children: "\u25CF" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
|
|
1963
2001
|
" ",
|
|
1964
2002
|
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx10(Text9, { children: desc }),
|
|
1965
|
-
|
|
1966
|
-
|
|
2003
|
+
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2004
|
+
" ",
|
|
2005
|
+
timeAgo2(n.data.timestamp)
|
|
2006
|
+
] }),
|
|
1967
2007
|
" ",
|
|
1968
2008
|
n.data.resolved ? /* @__PURE__ */ jsx10(Text9, { color: "green", children: "resolved" }) : /* @__PURE__ */ jsx10(Text9, { color: "yellow", children: "open" })
|
|
1969
2009
|
] }, n.id);
|
|
1970
2010
|
}),
|
|
1971
|
-
renderHeader("patterns", "Learned Patterns", patternNodes.length, "
|
|
2011
|
+
renderHeader("patterns", "Learned Patterns", patternNodes.length, "-- Trie learns as you work"),
|
|
1972
2012
|
expandedNodes.has("patterns") && patternNodes.slice(0, 10).map((n) => {
|
|
1973
2013
|
const nodeId = `pattern-${n.id}`;
|
|
1974
2014
|
const conf = Math.round(n.data.confidence * 100);
|
|
1975
2015
|
const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
|
|
1976
2016
|
const desc = n.data.description.length > 50 ? n.data.description.slice(0, 47) + "..." : n.data.description;
|
|
1977
2017
|
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1978
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
1979
|
-
|
|
1980
|
-
" "
|
|
1981
|
-
] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
|
|
1982
|
-
" ",
|
|
2018
|
+
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
2019
|
+
" ",
|
|
1983
2020
|
n.data.isAntiPattern ? /* @__PURE__ */ jsx10(Text9, { color: "red", children: "!" }) : /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
|
|
1984
2021
|
" ",
|
|
1985
2022
|
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx10(Text9, { children: desc }),
|
|
@@ -1990,8 +2027,7 @@ function MemoryTreeView() {
|
|
|
1990
2027
|
] }) : /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
1991
2028
|
conf,
|
|
1992
2029
|
"%"
|
|
1993
|
-
] })
|
|
1994
|
-
n.data.isAntiPattern && /* @__PURE__ */ jsx10(Text9, { color: "red", children: " anti-pattern" })
|
|
2030
|
+
] })
|
|
1995
2031
|
] }, n.id);
|
|
1996
2032
|
}),
|
|
1997
2033
|
renderHeader("cross-project", "Cross-Project", globalPatterns.length),
|
|
@@ -1999,16 +2035,13 @@ function MemoryTreeView() {
|
|
|
1999
2035
|
const patternId = `global-${pattern.id}`;
|
|
2000
2036
|
const desc = pattern.pattern.length > 45 ? pattern.pattern.slice(0, 42) + "..." : pattern.pattern;
|
|
2001
2037
|
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
2002
|
-
sel(patternId) ? /* @__PURE__ */
|
|
2003
|
-
|
|
2004
|
-
" "
|
|
2005
|
-
] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
|
|
2006
|
-
" ",
|
|
2038
|
+
sel(patternId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
2039
|
+
" ",
|
|
2007
2040
|
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: "\u25CB" }),
|
|
2008
2041
|
" ",
|
|
2009
2042
|
sel(patternId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx10(Text9, { children: desc }),
|
|
2010
|
-
" ",
|
|
2011
2043
|
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2044
|
+
" ",
|
|
2012
2045
|
pattern.projects.length,
|
|
2013
2046
|
" projects \xB7 ",
|
|
2014
2047
|
pattern.occurrences,
|
|
@@ -2023,24 +2056,17 @@ function MemoryTreeView() {
|
|
|
2023
2056
|
const path2 = n.data.path.split("/").slice(-2).join("/");
|
|
2024
2057
|
const isCritical = n.data.riskLevel === "critical";
|
|
2025
2058
|
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
2026
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2027
|
-
|
|
2028
|
-
" "
|
|
2029
|
-
] }) : /* @__PURE__ */ jsx10(Text9, { children: " " }),
|
|
2030
|
-
" ",
|
|
2059
|
+
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
2060
|
+
" ",
|
|
2031
2061
|
/* @__PURE__ */ jsx10(Text9, { color: isCritical ? "red" : "yellow", children: "\u25CF" }),
|
|
2032
2062
|
" ",
|
|
2033
2063
|
sel(nodeId) ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: path2 }) : /* @__PURE__ */ jsx10(Text9, { children: path2 }),
|
|
2034
2064
|
" ",
|
|
2035
2065
|
/* @__PURE__ */ jsx10(Text9, { color: isCritical ? "red" : "yellow", children: n.data.riskLevel }),
|
|
2036
|
-
" ",
|
|
2037
2066
|
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2067
|
+
" ",
|
|
2038
2068
|
n.data.changeCount,
|
|
2039
2069
|
" changes"
|
|
2040
|
-
] }),
|
|
2041
|
-
n.data.whyRisky && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2042
|
-
" ",
|
|
2043
|
-
n.data.whyRisky
|
|
2044
2070
|
] })
|
|
2045
2071
|
] }, n.id);
|
|
2046
2072
|
})
|
|
@@ -2049,54 +2075,48 @@ function MemoryTreeView() {
|
|
|
2049
2075
|
}
|
|
2050
2076
|
|
|
2051
2077
|
// src/cli/dashboard/views/RawLogView.tsx
|
|
2052
|
-
import { Box as Box10, Text as Text10, useInput as
|
|
2078
|
+
import { Box as Box10, Text as Text10, useInput as useInput7 } from "ink";
|
|
2053
2079
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2054
2080
|
function RawLogView() {
|
|
2055
2081
|
const { state, dispatch } = useDashboard();
|
|
2056
2082
|
const { rawLog, rawLogPage } = state;
|
|
2057
|
-
const pageSize = Math.max(10, (process.stdout.rows || 40) -
|
|
2083
|
+
const pageSize = Math.max(10, (process.stdout.rows || 40) - 10);
|
|
2058
2084
|
const totalPages = Math.max(1, Math.ceil(rawLog.length / pageSize));
|
|
2059
|
-
|
|
2060
|
-
if (input === "n") {
|
|
2061
|
-
|
|
2062
|
-
} else if (input === "p") {
|
|
2063
|
-
dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.max(0, rawLogPage - 1) });
|
|
2064
|
-
}
|
|
2085
|
+
useInput7((input, _key) => {
|
|
2086
|
+
if (input === "n") dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.min(totalPages - 1, rawLogPage + 1) });
|
|
2087
|
+
else if (input === "p") dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.max(0, rawLogPage - 1) });
|
|
2065
2088
|
});
|
|
2066
2089
|
const startIdx = rawLogPage * pageSize;
|
|
2067
2090
|
const logs = rawLog.slice(startIdx, startIdx + pageSize);
|
|
2068
2091
|
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 1, children: [
|
|
2069
2092
|
/* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2070
2093
|
/* @__PURE__ */ jsx11(Text10, { bold: true, children: "Log" }),
|
|
2071
|
-
" ",
|
|
2072
2094
|
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2073
|
-
"
|
|
2095
|
+
" ",
|
|
2096
|
+
rawLog.length,
|
|
2097
|
+
" entries \xB7 page ",
|
|
2074
2098
|
rawLogPage + 1,
|
|
2075
2099
|
"/",
|
|
2076
2100
|
totalPages
|
|
2077
|
-
] })
|
|
2078
|
-
" ",
|
|
2079
|
-
/* @__PURE__ */ jsx11(Text10, { bold: true, children: rawLog.length }),
|
|
2080
|
-
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " entries" })
|
|
2101
|
+
] })
|
|
2081
2102
|
] }),
|
|
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) => {
|
|
2103
|
+
rawLog.length === 0 ? /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " No log entries yet" }) : logs.map((entry, i) => {
|
|
2084
2104
|
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
2105
|
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2106
|
+
" ",
|
|
2107
|
+
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: entry.time }),
|
|
2086
2108
|
" ",
|
|
2087
2109
|
dot,
|
|
2088
2110
|
" ",
|
|
2089
|
-
entry.message.slice(0, 70)
|
|
2090
|
-
" ",
|
|
2091
|
-
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: entry.time })
|
|
2111
|
+
entry.message.slice(0, 70)
|
|
2092
2112
|
] }, i);
|
|
2093
|
-
})
|
|
2113
|
+
})
|
|
2094
2114
|
] });
|
|
2095
2115
|
}
|
|
2096
2116
|
|
|
2097
2117
|
// src/cli/dashboard/views/ChatView.tsx
|
|
2098
2118
|
import { useCallback as useCallback5, useRef } from "react";
|
|
2099
|
-
import { Box as Box11, Text as Text11, useInput as
|
|
2119
|
+
import { Box as Box11, Text as Text11, useInput as useInput8 } from "ink";
|
|
2100
2120
|
|
|
2101
2121
|
// src/tools/tell.ts
|
|
2102
2122
|
import path from "path";
|
|
@@ -4919,7 +4939,7 @@ ${contextBlock}`;
|
|
|
4919
4939
|
loadingRef.current = false;
|
|
4920
4940
|
}
|
|
4921
4941
|
}, [dispatch, messages]);
|
|
4922
|
-
|
|
4942
|
+
useInput8((input, key) => {
|
|
4923
4943
|
if (loading) return;
|
|
4924
4944
|
if (key.return && inputBuffer.trim().length > 0) {
|
|
4925
4945
|
void sendMessage(inputBuffer.trim());
|
|
@@ -4933,74 +4953,40 @@ ${contextBlock}`;
|
|
|
4933
4953
|
});
|
|
4934
4954
|
if (!isAIAvailable()) {
|
|
4935
4955
|
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, children: [
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
|
|
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
|
-
] })
|
|
4956
|
+
/* @__PURE__ */ jsx12(Text11, { bold: true, children: "Chat" }),
|
|
4957
|
+
/* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " AI is not available. Press s to open settings and add your Anthropic API key." })
|
|
4959
4958
|
] });
|
|
4960
4959
|
}
|
|
4961
4960
|
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, children: [
|
|
4962
|
-
/* @__PURE__ */
|
|
4963
|
-
|
|
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: [
|
|
4961
|
+
/* @__PURE__ */ jsx12(Text11, { bold: true, children: "Chat" }),
|
|
4962
|
+
messages.length === 0 && !loading && /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " Ask about your codebase, decisions, patterns, or risks." }),
|
|
4963
|
+
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
4964
|
" ",
|
|
4975
4965
|
/* @__PURE__ */ jsx12(Text11, { bold: true, color: "green", children: "You:" }),
|
|
4976
4966
|
" ",
|
|
4977
4967
|
msg.content
|
|
4978
4968
|
] }) : /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", children: [
|
|
4979
|
-
msg.toolCalls && msg.toolCalls.length > 0 &&
|
|
4969
|
+
msg.toolCalls && msg.toolCalls.length > 0 && msg.toolCalls.map((tc, ti) => /* @__PURE__ */ jsxs11(Text11, { dimColor: true, children: [
|
|
4980
4970
|
" ",
|
|
4981
4971
|
/* @__PURE__ */ jsxs11(Text11, { color: "yellow", children: [
|
|
4982
|
-
"[
|
|
4972
|
+
"[",
|
|
4983
4973
|
tc.name,
|
|
4984
4974
|
"]"
|
|
4985
4975
|
] }),
|
|
4986
4976
|
" ",
|
|
4987
4977
|
formatToolInput(tc.input)
|
|
4988
|
-
] }, ti))
|
|
4978
|
+
] }, ti)),
|
|
4989
4979
|
msg.content.split("\n").map((line, li) => /* @__PURE__ */ jsxs11(Text11, { children: [
|
|
4990
|
-
li === 0 ?
|
|
4980
|
+
li === 0 ? " Trie: " : " ",
|
|
4991
4981
|
line
|
|
4992
4982
|
] }, li))
|
|
4993
4983
|
] }) }, idx)),
|
|
4994
|
-
loading && /* @__PURE__ */
|
|
4995
|
-
" ",
|
|
4996
|
-
/* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Thinking..." })
|
|
4997
|
-
] }),
|
|
4984
|
+
loading && /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " Thinking..." }),
|
|
4998
4985
|
/* @__PURE__ */ jsx12(Box11, { flexGrow: 1 }),
|
|
4999
|
-
/* @__PURE__ */ jsx12(Box11, { borderStyle: "
|
|
4986
|
+
/* @__PURE__ */ jsx12(Box11, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs11(Text11, { children: [
|
|
5000
4987
|
inputBuffer || /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "Ask a question..." }),
|
|
5001
4988
|
/* @__PURE__ */ jsx12(Text11, { bold: true, color: "green", children: "|" })
|
|
5002
|
-
] }) })
|
|
5003
|
-
/* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " enter send esc clear" })
|
|
4989
|
+
] }) })
|
|
5004
4990
|
] });
|
|
5005
4991
|
}
|
|
5006
4992
|
function formatToolInput(input) {
|
|
@@ -5016,10 +5002,60 @@ function formatToolInput(input) {
|
|
|
5016
5002
|
// src/cli/dashboard/App.tsx
|
|
5017
5003
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5018
5004
|
var MAIN_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
5005
|
+
async function applyGoalFix(fix, dispatch) {
|
|
5006
|
+
try {
|
|
5007
|
+
const { runAIAnalysis, isAIAvailable: isAIAvailable2 } = await import("./client-PMKE26IV.js");
|
|
5008
|
+
if (!isAIAvailable2()) {
|
|
5009
|
+
dispatch({ type: "DISMISS_FIX", id: fix.id });
|
|
5010
|
+
getOutputManager().nudge("AI not available for fix", "warning");
|
|
5011
|
+
return;
|
|
5012
|
+
}
|
|
5013
|
+
const projectPath = getWorkingDirectory(void 0, true);
|
|
5014
|
+
const fullPath = join2(projectPath, fix.file);
|
|
5015
|
+
const content = await readFile2(fullPath, "utf-8");
|
|
5016
|
+
const result = await runAIAnalysis({
|
|
5017
|
+
systemPrompt: `You are a precise code fixer. The user has a quality goal: "${fix.goalDescription}".
|
|
5018
|
+
A violation was detected: "${fix.description}"
|
|
5019
|
+
Suggested fix: "${fix.suggestedFix}"
|
|
5020
|
+
|
|
5021
|
+
Return the COMPLETE fixed file content. Make the minimal change needed to resolve the violation.
|
|
5022
|
+
Do NOT add comments explaining the fix. Do NOT change anything else.
|
|
5023
|
+
Output ONLY the file content, no markdown fences, no explanation.`,
|
|
5024
|
+
userPrompt: `Fix this file:
|
|
5025
|
+
|
|
5026
|
+
\`\`\`
|
|
5027
|
+
${content}
|
|
5028
|
+
\`\`\``,
|
|
5029
|
+
maxTokens: 4096,
|
|
5030
|
+
temperature: 0
|
|
5031
|
+
});
|
|
5032
|
+
if (!result.success || !result.content.trim()) {
|
|
5033
|
+
dispatch({ type: "DISMISS_FIX", id: fix.id });
|
|
5034
|
+
getOutputManager().nudge("Fix generation failed", "warning");
|
|
5035
|
+
return;
|
|
5036
|
+
}
|
|
5037
|
+
let fixedContent = result.content.trim();
|
|
5038
|
+
if (fixedContent.startsWith("```")) {
|
|
5039
|
+
fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
|
|
5040
|
+
}
|
|
5041
|
+
await writeFile(fullPath, fixedContent, "utf-8");
|
|
5042
|
+
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-YSNN23D4.js");
|
|
5043
|
+
const goals = await getActiveGoals(projectPath);
|
|
5044
|
+
const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
|
|
5045
|
+
if (matchedGoal) {
|
|
5046
|
+
await recordGoalViolationFixed(matchedGoal, fix.file, projectPath);
|
|
5047
|
+
}
|
|
5048
|
+
dispatch({ type: "FIX_APPLIED", id: fix.id });
|
|
5049
|
+
getOutputManager().nudge(`Fixed: ${fix.description} in ${fix.file.split("/").pop()}`, "info", fix.file, 8e3);
|
|
5050
|
+
} catch (error) {
|
|
5051
|
+
dispatch({ type: "DISMISS_FIX", id: fix.id });
|
|
5052
|
+
getOutputManager().nudge(`Fix failed: ${error}`, "warning");
|
|
5053
|
+
}
|
|
5054
|
+
}
|
|
5019
5055
|
function DashboardApp({ onReady }) {
|
|
5020
5056
|
const { state, dispatch } = useDashboard();
|
|
5021
5057
|
const { exit } = useApp();
|
|
5022
|
-
const [showConfig, setShowConfig] =
|
|
5058
|
+
const [showConfig, setShowConfig] = useState2(false);
|
|
5023
5059
|
const dispatchRef = useRef2(dispatch);
|
|
5024
5060
|
dispatchRef.current = dispatch;
|
|
5025
5061
|
const stateRef = useRef2(state);
|
|
@@ -5036,8 +5072,13 @@ function DashboardApp({ onReady }) {
|
|
|
5036
5072
|
}, [configPath]);
|
|
5037
5073
|
const persistConfig = useCallback6(async () => {
|
|
5038
5074
|
try {
|
|
5039
|
-
|
|
5075
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5076
|
+
await mkdir(getTrieDirectory(workDir), { recursive: true });
|
|
5040
5077
|
await writeFile(configPath, JSON.stringify(stateRef.current.agentConfig, null, 2), "utf-8");
|
|
5078
|
+
const { saveAutonomyConfig, loadAutonomyConfig } = await import("./autonomy-config-QA6ATWLJ.js");
|
|
5079
|
+
const autonomy = await loadAutonomyConfig(workDir);
|
|
5080
|
+
autonomy.aiWatcher = stateRef.current.agentConfig.aiWatcher;
|
|
5081
|
+
await saveAutonomyConfig(workDir, autonomy);
|
|
5041
5082
|
} catch {
|
|
5042
5083
|
}
|
|
5043
5084
|
}, [configPath]);
|
|
@@ -5099,7 +5140,7 @@ function DashboardApp({ onReady }) {
|
|
|
5099
5140
|
} catch {
|
|
5100
5141
|
}
|
|
5101
5142
|
}, []);
|
|
5102
|
-
|
|
5143
|
+
useEffect3(() => {
|
|
5103
5144
|
void loadConfig();
|
|
5104
5145
|
void refreshGoals();
|
|
5105
5146
|
void refreshHypotheses();
|
|
@@ -5118,6 +5159,20 @@ function DashboardApp({ onReady }) {
|
|
|
5118
5159
|
if (nudge.file !== void 0) action.file = nudge.file;
|
|
5119
5160
|
if (nudge.autoHideMs !== void 0) action.autoHideMs = nudge.autoHideMs;
|
|
5120
5161
|
dispatchRef.current(action);
|
|
5162
|
+
if (nudge.severity === "critical" || nudge.severity === "warning") {
|
|
5163
|
+
const insight = {
|
|
5164
|
+
id: `nudge-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
5165
|
+
type: "warning",
|
|
5166
|
+
category: "quality",
|
|
5167
|
+
message: nudge.message,
|
|
5168
|
+
priority: nudge.severity === "critical" ? 9 : 6,
|
|
5169
|
+
timestamp: Date.now(),
|
|
5170
|
+
suggestedAction: nudge.file ? `Review ${nudge.file}` : void 0,
|
|
5171
|
+
relatedIssues: [],
|
|
5172
|
+
dismissed: false
|
|
5173
|
+
};
|
|
5174
|
+
dispatchRef.current({ type: "ADD_INSIGHTS", insights: [insight] });
|
|
5175
|
+
}
|
|
5121
5176
|
}
|
|
5122
5177
|
});
|
|
5123
5178
|
const handleUpdate = (update) => {
|
|
@@ -5140,13 +5195,21 @@ function DashboardApp({ onReady }) {
|
|
|
5140
5195
|
outputManager.setMode("console");
|
|
5141
5196
|
};
|
|
5142
5197
|
}, [loadConfig, onReady, processInsights, refreshGoals, refreshHypotheses]);
|
|
5143
|
-
|
|
5198
|
+
useEffect3(() => {
|
|
5144
5199
|
const interval = setInterval(() => {
|
|
5145
5200
|
dispatchRef.current({ type: "AUTO_DISMISS_NOTIFICATIONS" });
|
|
5146
5201
|
}, 5e3);
|
|
5147
5202
|
return () => clearInterval(interval);
|
|
5148
5203
|
}, []);
|
|
5149
|
-
|
|
5204
|
+
const applyingFixIds = useRef2(/* @__PURE__ */ new Set());
|
|
5205
|
+
useEffect3(() => {
|
|
5206
|
+
const toApply = state.pendingFixes.filter((f) => f.status === "applying" && !applyingFixIds.current.has(f.id));
|
|
5207
|
+
for (const fix of toApply) {
|
|
5208
|
+
applyingFixIds.current.add(fix.id);
|
|
5209
|
+
void applyGoalFix(fix, dispatchRef.current);
|
|
5210
|
+
}
|
|
5211
|
+
}, [state.pendingFixes]);
|
|
5212
|
+
useInput9((input, key) => {
|
|
5150
5213
|
if (showConfig) return;
|
|
5151
5214
|
if (state.view === "goals" && state.goalsPanel.inputMode === "add") return;
|
|
5152
5215
|
if (state.view === "hypotheses" && state.hypothesesPanel.inputMode === "add") return;
|
|
@@ -5250,7 +5313,7 @@ var InteractiveDashboard = class {
|
|
|
5250
5313
|
getConfigFn = null;
|
|
5251
5314
|
async start() {
|
|
5252
5315
|
this.app = render(
|
|
5253
|
-
|
|
5316
|
+
React9.createElement(App, {
|
|
5254
5317
|
onReady: (handler, getConfig) => {
|
|
5255
5318
|
this.updateHandler = handler;
|
|
5256
5319
|
this.getConfigFn = getConfig;
|
|
@@ -5295,4 +5358,4 @@ export {
|
|
|
5295
5358
|
handleCheckpointTool,
|
|
5296
5359
|
InteractiveDashboard
|
|
5297
5360
|
};
|
|
5298
|
-
//# sourceMappingURL=chunk-
|
|
5361
|
+
//# sourceMappingURL=chunk-2764RZVV.js.map
|