@triedotdev/mcp 1.0.115 → 1.0.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{autonomy-config-JXB7WCZ2.js → autonomy-config-QA6ATWLJ.js} +3 -3
- package/dist/{chunk-ZYKEILVK.js → chunk-2764RZVV.js} +305 -86
- 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-I2GFI3AM.js → chunk-ZEXMMTIQ.js} +2 -2
- package/dist/cli/create-agent.js +1 -1
- package/dist/cli/main.js +66 -32
- 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 +65 -128
- 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-DJ2YAGHK.js +0 -50
- package/dist/chunk-DJ2YAGHK.js.map +0 -1
- package/dist/chunk-ZYKEILVK.js.map +0 -1
- package/dist/goal-validator-T5HEYBC5.js +0 -186
- package/dist/goal-validator-T5HEYBC5.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/{chunk-I2GFI3AM.js.map → chunk-ZEXMMTIQ.js.map} +0 -0
- /package/dist/{autonomy-config-JXB7WCZ2.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
|
*/
|
|
@@ -282,7 +292,7 @@ import React9 from "react";
|
|
|
282
292
|
|
|
283
293
|
// src/cli/dashboard/App.tsx
|
|
284
294
|
import { useState as useState2, useEffect as useEffect3, useCallback as useCallback6, useRef as useRef2 } from "react";
|
|
285
|
-
import { Box as Box12, useInput as
|
|
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
|
}
|
|
@@ -687,6 +712,34 @@ function dashboardReducer(state, action) {
|
|
|
687
712
|
if (!changed) return state;
|
|
688
713
|
return { ...state, notificationHistory: history };
|
|
689
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 };
|
|
690
743
|
default:
|
|
691
744
|
return state;
|
|
692
745
|
}
|
|
@@ -746,7 +799,9 @@ function createInitialState() {
|
|
|
746
799
|
hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0 },
|
|
747
800
|
memoryTree: { loaded: false, snapshot: null, globalPatterns: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
|
|
748
801
|
agentBrain: { loaded: false, decisions: [], patterns: [], ledgerHash: null, selectedIndex: 0, expandedIndex: null },
|
|
749
|
-
chatState: { messages: [], inputBuffer: "", loading: false }
|
|
802
|
+
chatState: { messages: [], inputBuffer: "", loading: false },
|
|
803
|
+
pendingFixes: [],
|
|
804
|
+
selectedFixIndex: 0
|
|
750
805
|
};
|
|
751
806
|
}
|
|
752
807
|
var DashboardContext = createContext(null);
|
|
@@ -767,45 +822,50 @@ import { readFile as readFile2, writeFile, mkdir } from "fs/promises";
|
|
|
767
822
|
import { join as join2 } from "path";
|
|
768
823
|
|
|
769
824
|
// src/cli/dashboard/components/Header.tsx
|
|
770
|
-
import { Box, Text } from "ink";
|
|
825
|
+
import { Box, Text, useStdout } from "ink";
|
|
771
826
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
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
834
|
let status;
|
|
777
835
|
if (watch.watching) {
|
|
778
836
|
status = totalExtracted > 0 ? /* @__PURE__ */ jsxs(Text, { children: [
|
|
779
837
|
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25CF" }),
|
|
780
|
-
" ",
|
|
781
|
-
/* @__PURE__ */ jsx2(Text, { color: "green", children: "Learning" }),
|
|
782
|
-
|
|
783
|
-
|
|
838
|
+
narrow ? "" : " ",
|
|
839
|
+
/* @__PURE__ */ jsx2(Text, { color: "green", children: narrow ? "" : "Learning" }),
|
|
840
|
+
!narrow && /* @__PURE__ */ jsxs(Text, { dimColor: true, children: [
|
|
841
|
+
" ",
|
|
784
842
|
totalExtracted,
|
|
785
843
|
" signals"
|
|
786
844
|
] })
|
|
787
845
|
] }) : /* @__PURE__ */ jsxs(Text, { children: [
|
|
788
846
|
/* @__PURE__ */ jsx2(Text, { color: "green", children: "\u25CF" }),
|
|
789
|
-
" Watching"
|
|
847
|
+
!narrow && " Watching"
|
|
790
848
|
] });
|
|
791
849
|
} else {
|
|
792
850
|
status = /* @__PURE__ */ jsxs(Text, { children: [
|
|
793
851
|
/* @__PURE__ */ jsx2(Text, { dimColor: true, children: "\u25CB" }),
|
|
794
|
-
" "
|
|
795
|
-
/* @__PURE__ */ jsx2(Text, { dimColor: true, children: "Idle" })
|
|
852
|
+
!narrow && /* @__PURE__ */ jsx2(Text, { dimColor: true, children: " Idle" })
|
|
796
853
|
] });
|
|
797
854
|
}
|
|
798
855
|
return /* @__PURE__ */ jsxs(Box, { paddingX: 1, justifyContent: "space-between", children: [
|
|
799
|
-
/* @__PURE__ */ jsx2(Text, { bold: true, children: "Trie" }),
|
|
800
|
-
/* @__PURE__ */ jsxs(Box, { gap: 2, children: [
|
|
856
|
+
/* @__PURE__ */ jsx2(Text, { bold: true, color: "magenta", children: "Trie" }),
|
|
857
|
+
/* @__PURE__ */ jsxs(Box, { gap: narrow ? 1 : 2, children: [
|
|
801
858
|
status,
|
|
802
|
-
alerts.hasCritical && /* @__PURE__ */
|
|
859
|
+
alerts.hasCritical && /* @__PURE__ */ jsxs(Text, { color: "red", bold: true, children: [
|
|
860
|
+
"\u25CF",
|
|
861
|
+
!narrow && " Alert"
|
|
862
|
+
] })
|
|
803
863
|
] })
|
|
804
864
|
] });
|
|
805
865
|
}
|
|
806
866
|
|
|
807
867
|
// src/cli/dashboard/components/Footer.tsx
|
|
808
|
-
import { Box as Box2, Text as Text2 } from "ink";
|
|
868
|
+
import { Box as Box2, Text as Text2, useStdout as useStdout2 } from "ink";
|
|
809
869
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
810
870
|
var VIEW_LABELS = {
|
|
811
871
|
overview: "Overview",
|
|
@@ -816,6 +876,15 @@ var VIEW_LABELS = {
|
|
|
816
876
|
memory: "Ledger",
|
|
817
877
|
chat: "Chat"
|
|
818
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
|
+
};
|
|
819
888
|
var TAB_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
820
889
|
var CONTEXT_HINTS = {
|
|
821
890
|
goals: "j/k nav \xB7 a add \xB7 enter complete \xB7 d delete",
|
|
@@ -825,14 +894,42 @@ var CONTEXT_HINTS = {
|
|
|
825
894
|
chat: "type to ask \xB7 enter send \xB7 esc clear",
|
|
826
895
|
rawlog: "n/p pages \xB7 b back"
|
|
827
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
|
+
};
|
|
828
905
|
function Footer() {
|
|
829
906
|
const { state } = useDashboard();
|
|
830
907
|
const { view, goalsPanel, hypothesesPanel } = state;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
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";
|
|
918
|
+
} else {
|
|
919
|
+
const hintMap = narrow ? CONTEXT_HINTS_SHORT : CONTEXT_HINTS;
|
|
920
|
+
hints = hintMap[view] || (narrow ? "s n/p" : "n/p pages \xB7 s settings");
|
|
921
|
+
}
|
|
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
|
+
}
|
|
834
931
|
return /* @__PURE__ */ jsxs2(Box2, { paddingX: 1, justifyContent: "space-between", children: [
|
|
835
|
-
/* @__PURE__ */ jsx3(Box2, { gap: 1, children: TAB_VIEWS.map((v) => v === view ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children:
|
|
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)) }),
|
|
836
933
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
837
934
|
hints,
|
|
838
935
|
" \xB7 q quit"
|
|
@@ -841,21 +938,21 @@ function Footer() {
|
|
|
841
938
|
}
|
|
842
939
|
|
|
843
940
|
// src/cli/dashboard/components/Notification.tsx
|
|
844
|
-
import { Box as Box3, Text as Text3 } from "ink";
|
|
941
|
+
import { Box as Box3, Text as Text3, useStdout as useStdout3 } from "ink";
|
|
845
942
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
846
943
|
function Notification() {
|
|
847
944
|
const { state } = useDashboard();
|
|
848
945
|
const { notification } = state;
|
|
946
|
+
const { stdout } = useStdout3();
|
|
947
|
+
const cols = stdout?.columns || 80;
|
|
849
948
|
if (!notification || !notification.active) return null;
|
|
850
949
|
if (notification.autoHideAt && Date.now() > notification.autoHideAt) return null;
|
|
851
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;
|
|
852
953
|
return /* @__PURE__ */ jsxs3(Box3, { paddingX: 1, children: [
|
|
853
954
|
/* @__PURE__ */ jsx4(Text3, { color, bold: true, children: "\u25CF " }),
|
|
854
|
-
/* @__PURE__ */ jsx4(Text3, { children:
|
|
855
|
-
notification.file && /* @__PURE__ */ jsxs3(Text3, { dimColor: true, children: [
|
|
856
|
-
" ",
|
|
857
|
-
notification.file
|
|
858
|
-
] })
|
|
955
|
+
/* @__PURE__ */ jsx4(Text3, { wrap: "truncate", children: msg })
|
|
859
956
|
] });
|
|
860
957
|
}
|
|
861
958
|
|
|
@@ -1105,18 +1202,41 @@ function ConfigDialog({ onClose }) {
|
|
|
1105
1202
|
}
|
|
1106
1203
|
|
|
1107
1204
|
// src/cli/dashboard/views/OverviewView.tsx
|
|
1108
|
-
import { Box as Box5, Text as Text5 } from "ink";
|
|
1109
|
-
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
|
+
}
|
|
1110
1210
|
function OverviewView() {
|
|
1111
|
-
const { state } = useDashboard();
|
|
1112
|
-
const { progress, signalExtraction, watch, issues, activityLog, activityPage } = state;
|
|
1211
|
+
const { state, dispatch } = useDashboard();
|
|
1212
|
+
const { progress, signalExtraction, watch, issues, activityLog, activityPage, pendingFixes, selectedFixIndex } = state;
|
|
1113
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);
|
|
1114
1218
|
const endTime = state.scanComplete && state.scanEndTime ? state.scanEndTime : Date.now();
|
|
1115
1219
|
const elapsed = ((endTime - state.scanStartTime) / 1e3).toFixed(1);
|
|
1116
1220
|
const criticalIssues = issues.filter((i) => i.severity === "critical").slice(0, 3);
|
|
1117
|
-
const
|
|
1221
|
+
const activeFixes = pendingFixes.filter((f) => f.status === "pending" || f.status === "applying");
|
|
1222
|
+
const activityRows = activeFixes.length > 0 ? 5 : 8;
|
|
1118
1223
|
const startIdx = activityPage * activityRows;
|
|
1119
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
|
+
});
|
|
1120
1240
|
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", paddingX: 1, children: [
|
|
1121
1241
|
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1122
1242
|
"Scanned ",
|
|
@@ -1125,26 +1245,27 @@ function OverviewView() {
|
|
|
1125
1245
|
elapsed,
|
|
1126
1246
|
"s"
|
|
1127
1247
|
] }),
|
|
1128
|
-
watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1248
|
+
watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1129
1249
|
/* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
|
|
1130
1250
|
" Signal extraction",
|
|
1131
|
-
(signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1251
|
+
!narrow && (signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1132
1252
|
" ",
|
|
1133
1253
|
signalExtraction.decisionsExtracted,
|
|
1134
|
-
"
|
|
1254
|
+
"d \xB7 ",
|
|
1135
1255
|
signalExtraction.factsExtracted,
|
|
1136
|
-
"
|
|
1256
|
+
"f \xB7 ",
|
|
1137
1257
|
signalExtraction.blockersExtracted,
|
|
1138
|
-
"
|
|
1258
|
+
"b"
|
|
1139
1259
|
] })
|
|
1140
1260
|
] }),
|
|
1141
1261
|
criticalIssues.length > 0 && criticalIssues.map((issue, i) => {
|
|
1142
1262
|
const filename = issue.file.split("/").pop() || issue.file;
|
|
1143
1263
|
const lineNum = issue.line ? `:${issue.line}` : "";
|
|
1144
|
-
|
|
1264
|
+
const issueLen = Math.max(15, contentWidth - filename.length - 6);
|
|
1265
|
+
return /* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1145
1266
|
/* @__PURE__ */ jsx6(Text5, { color: "red", children: "\u25CF" }),
|
|
1146
1267
|
" ",
|
|
1147
|
-
/* @__PURE__ */ jsx6(Text5, { color: "red", children: issue.issue
|
|
1268
|
+
/* @__PURE__ */ jsx6(Text5, { color: "red", children: truncate(issue.issue, issueLen) }),
|
|
1148
1269
|
/* @__PURE__ */ jsxs5(Text5, { dimColor: true, children: [
|
|
1149
1270
|
" ",
|
|
1150
1271
|
filename,
|
|
@@ -1152,25 +1273,62 @@ function OverviewView() {
|
|
|
1152
1273
|
] })
|
|
1153
1274
|
] }, i);
|
|
1154
1275
|
}),
|
|
1155
|
-
totalIssues === 0 && criticalIssues.length === 0 && /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1276
|
+
totalIssues === 0 && criticalIssues.length === 0 && activeFixes.length === 0 && /* @__PURE__ */ jsxs5(Text5, { children: [
|
|
1156
1277
|
/* @__PURE__ */ jsx6(Text5, { color: "green", children: "\u25CF" }),
|
|
1157
1278
|
" No issues"
|
|
1158
1279
|
] }),
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
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: [
|
|
1317
|
+
/* @__PURE__ */ jsx6(Text5, { bold: true, children: "Activity" }),
|
|
1318
|
+
pageActivities.map((entry, i) => /* @__PURE__ */ jsxs5(Text5, { wrap: "truncate", children: [
|
|
1319
|
+
" ",
|
|
1320
|
+
/* @__PURE__ */ jsx6(Text5, { dimColor: true, children: entry.time }),
|
|
1321
|
+
" ",
|
|
1322
|
+
truncate(entry.message, contentWidth - 14)
|
|
1323
|
+
] }, i)),
|
|
1324
|
+
pageActivities.length === 0 && /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: " No activity yet" })
|
|
1325
|
+
] })
|
|
1168
1326
|
] });
|
|
1169
1327
|
}
|
|
1170
1328
|
|
|
1171
1329
|
// src/cli/dashboard/views/AgentView.tsx
|
|
1172
1330
|
import { useEffect, useCallback } from "react";
|
|
1173
|
-
import { Box as Box6, Text as Text6, useInput as
|
|
1331
|
+
import { Box as Box6, Text as Text6, useInput as useInput3, useStdout as useStdout5 } from "ink";
|
|
1174
1332
|
|
|
1175
1333
|
// src/cli/dashboard/theme.ts
|
|
1176
1334
|
import pc from "picocolors";
|
|
@@ -1221,6 +1379,9 @@ function timeAgo(iso) {
|
|
|
1221
1379
|
function AgentView() {
|
|
1222
1380
|
const { state, dispatch } = useDashboard();
|
|
1223
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);
|
|
1224
1385
|
const visibleInsights = getVisibleInsights(state);
|
|
1225
1386
|
const alerts = visibleInsights.filter((i) => i.type === "warning");
|
|
1226
1387
|
const { decisions, patterns, loaded } = agentBrain;
|
|
@@ -1244,7 +1405,7 @@ function AgentView() {
|
|
|
1244
1405
|
void loadBrain();
|
|
1245
1406
|
}
|
|
1246
1407
|
}, [loaded, loadBrain]);
|
|
1247
|
-
|
|
1408
|
+
useInput3((input, key) => {
|
|
1248
1409
|
if (key.upArrow || input === "k") dispatch({ type: "NAVIGATE_UP" });
|
|
1249
1410
|
else if (key.downArrow || input === "j") dispatch({ type: "NAVIGATE_DOWN" });
|
|
1250
1411
|
else if (key.return) dispatch({ type: "TOGGLE_INSIGHT", index: selectedInsight });
|
|
@@ -1282,10 +1443,10 @@ function AgentView() {
|
|
|
1282
1443
|
const isSelected = idx === selectedInsight;
|
|
1283
1444
|
const isExpanded = idx === expandedInsight;
|
|
1284
1445
|
const ago = formatTimeAgo(insight.timestamp);
|
|
1285
|
-
const msg = insight.message.slice(0,
|
|
1446
|
+
const msg = insight.message.slice(0, msgLen) + (insight.message.length > msgLen ? "..." : "");
|
|
1286
1447
|
const riskColor = insight.priority >= 8 ? "red" : insight.priority >= 5 ? "yellow" : void 0;
|
|
1287
1448
|
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1288
|
-
/* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1449
|
+
/* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1289
1450
|
isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, color: "green", children: "> " }) : " ",
|
|
1290
1451
|
riskColor ? /* @__PURE__ */ jsx7(Text6, { color: riskColor, children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
|
|
1291
1452
|
" ",
|
|
@@ -1316,8 +1477,8 @@ function AgentView() {
|
|
|
1316
1477
|
" ",
|
|
1317
1478
|
active ? /* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
|
|
1318
1479
|
" ",
|
|
1319
|
-
dec.decision.slice(0,
|
|
1320
|
-
dec.decision.length >
|
|
1480
|
+
dec.decision.slice(0, msgLen),
|
|
1481
|
+
dec.decision.length > msgLen ? "..." : "",
|
|
1321
1482
|
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1322
1483
|
" ",
|
|
1323
1484
|
ago
|
|
@@ -1334,8 +1495,8 @@ function AgentView() {
|
|
|
1334
1495
|
" ",
|
|
1335
1496
|
pat.isAntiPattern ? /* @__PURE__ */ jsx7(Text6, { color: "red", children: "\u25CF" }) : /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: "\u25CB" }),
|
|
1336
1497
|
" ",
|
|
1337
|
-
pat.description.slice(0,
|
|
1338
|
-
pat.description.length >
|
|
1498
|
+
pat.description.slice(0, msgLen),
|
|
1499
|
+
pat.description.length > msgLen ? "..." : "",
|
|
1339
1500
|
" ",
|
|
1340
1501
|
confColor ? /* @__PURE__ */ jsxs6(Text6, { color: confColor, children: [
|
|
1341
1502
|
conf,
|
|
@@ -1367,8 +1528,8 @@ function AgentView() {
|
|
|
1367
1528
|
|
|
1368
1529
|
// src/cli/dashboard/views/GoalsView.tsx
|
|
1369
1530
|
import { useCallback as useCallback2 } from "react";
|
|
1370
|
-
import { Box as Box7, Text as Text7, useInput as
|
|
1371
|
-
import { Fragment, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1531
|
+
import { Box as Box7, Text as Text7, useInput as useInput4 } from "ink";
|
|
1532
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1372
1533
|
function calculateGoalProgress(goal) {
|
|
1373
1534
|
if (goal.target <= 0) return 0;
|
|
1374
1535
|
const startValue = goal.startValue ?? goal.currentValue;
|
|
@@ -1464,7 +1625,7 @@ function GoalsView() {
|
|
|
1464
1625
|
} catch {
|
|
1465
1626
|
}
|
|
1466
1627
|
}, [dispatch, refreshGoals]);
|
|
1467
|
-
|
|
1628
|
+
useInput4((_input, key) => {
|
|
1468
1629
|
if (goalsPanel.inputMode === "add") {
|
|
1469
1630
|
if (key.escape) {
|
|
1470
1631
|
dispatch({ type: "SET_GOALS_INPUT_MODE", mode: "browse" });
|
|
@@ -1503,7 +1664,7 @@ function GoalsView() {
|
|
|
1503
1664
|
/* @__PURE__ */ jsx8(Text7, { bold: true, color: "green", children: "|" })
|
|
1504
1665
|
] }) }),
|
|
1505
1666
|
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
1506
|
-
] }) : /* @__PURE__ */ jsx8(
|
|
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: [
|
|
1507
1668
|
activeGoals.map((goal, idx) => {
|
|
1508
1669
|
const isSelected = goalsPanel.selectedIndex === idx;
|
|
1509
1670
|
const progress = calculateGoalProgress(goal);
|
|
@@ -1555,8 +1716,8 @@ function GoalsView() {
|
|
|
1555
1716
|
|
|
1556
1717
|
// src/cli/dashboard/views/HypothesesView.tsx
|
|
1557
1718
|
import { useCallback as useCallback3 } from "react";
|
|
1558
|
-
import { Box as Box8, Text as Text8, useInput as
|
|
1559
|
-
import { Fragment as
|
|
1719
|
+
import { Box as Box8, Text as Text8, useInput as useInput5 } from "ink";
|
|
1720
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1560
1721
|
function HypothesesView() {
|
|
1561
1722
|
const { state, dispatch } = useDashboard();
|
|
1562
1723
|
const { hypothesesPanel } = state;
|
|
@@ -1625,7 +1786,7 @@ function HypothesesView() {
|
|
|
1625
1786
|
} catch {
|
|
1626
1787
|
}
|
|
1627
1788
|
}, [dispatch, refreshHypotheses]);
|
|
1628
|
-
|
|
1789
|
+
useInput5((_input, key) => {
|
|
1629
1790
|
if (hypothesesPanel.inputMode === "add") {
|
|
1630
1791
|
if (key.escape) {
|
|
1631
1792
|
dispatch({ type: "SET_HYPOTHESES_INPUT_MODE", mode: "browse" });
|
|
@@ -1667,7 +1828,7 @@ function HypothesesView() {
|
|
|
1667
1828
|
/* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "|" })
|
|
1668
1829
|
] }) }),
|
|
1669
1830
|
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
1670
|
-
] }) : /* @__PURE__ */ jsx9(
|
|
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: [
|
|
1671
1832
|
testing.map((hypo, idx) => {
|
|
1672
1833
|
const isSelected = hypothesesPanel.selectedIndex === idx;
|
|
1673
1834
|
const conf = Math.round(hypo.confidence * 100);
|
|
@@ -1719,8 +1880,8 @@ function HypothesesView() {
|
|
|
1719
1880
|
|
|
1720
1881
|
// src/cli/dashboard/views/MemoryTreeView.tsx
|
|
1721
1882
|
import { useEffect as useEffect2, useCallback as useCallback4 } from "react";
|
|
1722
|
-
import { Box as Box9, Text as Text9, useInput as
|
|
1723
|
-
import { Fragment as
|
|
1883
|
+
import { Box as Box9, Text as Text9, useInput as useInput6 } from "ink";
|
|
1884
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1724
1885
|
function timeAgo2(iso) {
|
|
1725
1886
|
const ms = Date.now() - new Date(iso).getTime();
|
|
1726
1887
|
const mins = Math.floor(ms / 6e4);
|
|
@@ -1751,7 +1912,7 @@ function MemoryTreeView() {
|
|
|
1751
1912
|
void loadData();
|
|
1752
1913
|
}
|
|
1753
1914
|
}, [loaded, loadData]);
|
|
1754
|
-
|
|
1915
|
+
useInput6((_input, key) => {
|
|
1755
1916
|
if (key.upArrow || _input === "k") dispatch({ type: "NAVIGATE_UP" });
|
|
1756
1917
|
else if (key.downArrow || _input === "j") dispatch({ type: "NAVIGATE_DOWN" });
|
|
1757
1918
|
else if (key.return) dispatch({ type: "TOGGLE_MEMORY_NODE", nodeId: selectedNode });
|
|
@@ -1888,7 +2049,7 @@ function MemoryTreeView() {
|
|
|
1888
2049
|
] })
|
|
1889
2050
|
] }, pattern.id);
|
|
1890
2051
|
}),
|
|
1891
|
-
hotspots.length > 0 && /* @__PURE__ */ jsxs9(
|
|
2052
|
+
hotspots.length > 0 && /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1892
2053
|
renderHeader("hotspots", "Risk Hotspots", hotspots.length),
|
|
1893
2054
|
expandedNodes.has("hotspots") && hotspots.slice(0, 10).map((n) => {
|
|
1894
2055
|
const nodeId = `file-${n.id}`;
|
|
@@ -1914,14 +2075,14 @@ function MemoryTreeView() {
|
|
|
1914
2075
|
}
|
|
1915
2076
|
|
|
1916
2077
|
// src/cli/dashboard/views/RawLogView.tsx
|
|
1917
|
-
import { Box as Box10, Text as Text10, useInput as
|
|
2078
|
+
import { Box as Box10, Text as Text10, useInput as useInput7 } from "ink";
|
|
1918
2079
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1919
2080
|
function RawLogView() {
|
|
1920
2081
|
const { state, dispatch } = useDashboard();
|
|
1921
2082
|
const { rawLog, rawLogPage } = state;
|
|
1922
2083
|
const pageSize = Math.max(10, (process.stdout.rows || 40) - 10);
|
|
1923
2084
|
const totalPages = Math.max(1, Math.ceil(rawLog.length / pageSize));
|
|
1924
|
-
|
|
2085
|
+
useInput7((input, _key) => {
|
|
1925
2086
|
if (input === "n") dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.min(totalPages - 1, rawLogPage + 1) });
|
|
1926
2087
|
else if (input === "p") dispatch({ type: "SET_RAW_LOG_PAGE", page: Math.max(0, rawLogPage - 1) });
|
|
1927
2088
|
});
|
|
@@ -1955,7 +2116,7 @@ function RawLogView() {
|
|
|
1955
2116
|
|
|
1956
2117
|
// src/cli/dashboard/views/ChatView.tsx
|
|
1957
2118
|
import { useCallback as useCallback5, useRef } from "react";
|
|
1958
|
-
import { Box as Box11, Text as Text11, useInput as
|
|
2119
|
+
import { Box as Box11, Text as Text11, useInput as useInput8 } from "ink";
|
|
1959
2120
|
|
|
1960
2121
|
// src/tools/tell.ts
|
|
1961
2122
|
import path from "path";
|
|
@@ -4778,7 +4939,7 @@ ${contextBlock}`;
|
|
|
4778
4939
|
loadingRef.current = false;
|
|
4779
4940
|
}
|
|
4780
4941
|
}, [dispatch, messages]);
|
|
4781
|
-
|
|
4942
|
+
useInput8((input, key) => {
|
|
4782
4943
|
if (loading) return;
|
|
4783
4944
|
if (key.return && inputBuffer.trim().length > 0) {
|
|
4784
4945
|
void sendMessage(inputBuffer.trim());
|
|
@@ -4841,6 +5002,56 @@ function formatToolInput(input) {
|
|
|
4841
5002
|
// src/cli/dashboard/App.tsx
|
|
4842
5003
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4843
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
|
+
}
|
|
4844
5055
|
function DashboardApp({ onReady }) {
|
|
4845
5056
|
const { state, dispatch } = useDashboard();
|
|
4846
5057
|
const { exit } = useApp();
|
|
@@ -4864,7 +5075,7 @@ function DashboardApp({ onReady }) {
|
|
|
4864
5075
|
const workDir = getWorkingDirectory(void 0, true);
|
|
4865
5076
|
await mkdir(getTrieDirectory(workDir), { recursive: true });
|
|
4866
5077
|
await writeFile(configPath, JSON.stringify(stateRef.current.agentConfig, null, 2), "utf-8");
|
|
4867
|
-
const { saveAutonomyConfig, loadAutonomyConfig } = await import("./autonomy-config-
|
|
5078
|
+
const { saveAutonomyConfig, loadAutonomyConfig } = await import("./autonomy-config-QA6ATWLJ.js");
|
|
4868
5079
|
const autonomy = await loadAutonomyConfig(workDir);
|
|
4869
5080
|
autonomy.aiWatcher = stateRef.current.agentConfig.aiWatcher;
|
|
4870
5081
|
await saveAutonomyConfig(workDir, autonomy);
|
|
@@ -4990,7 +5201,15 @@ function DashboardApp({ onReady }) {
|
|
|
4990
5201
|
}, 5e3);
|
|
4991
5202
|
return () => clearInterval(interval);
|
|
4992
5203
|
}, []);
|
|
4993
|
-
|
|
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) => {
|
|
4994
5213
|
if (showConfig) return;
|
|
4995
5214
|
if (state.view === "goals" && state.goalsPanel.inputMode === "add") return;
|
|
4996
5215
|
if (state.view === "hypotheses" && state.hypothesesPanel.inputMode === "add") return;
|
|
@@ -5139,4 +5358,4 @@ export {
|
|
|
5139
5358
|
handleCheckpointTool,
|
|
5140
5359
|
InteractiveDashboard
|
|
5141
5360
|
};
|
|
5142
|
-
//# sourceMappingURL=chunk-
|
|
5361
|
+
//# sourceMappingURL=chunk-2764RZVV.js.map
|