@triedotdev/mcp 1.0.120 → 1.0.122
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/chat-store-R46BCMBW.js +15 -0
- package/dist/{chunk-GPLRFTMB.js → chunk-3BVNB3GY.js} +4 -4
- package/dist/{chunk-PPZYVTUO.js → chunk-6LD7OPJL.js} +5 -5
- package/dist/{chunk-5TQ7J7UI.js → chunk-7A5RLKZY.js} +8 -8
- package/dist/{chunk-XNAVAA52.js → chunk-ANQPXOT2.js} +772 -293
- package/dist/chunk-ANQPXOT2.js.map +1 -0
- package/dist/{chunk-IQBHPTV7.js → chunk-EOLHWFDG.js} +4 -4
- package/dist/{chunk-FNW7Z7ZS.js → chunk-F4ZIAHTZ.js} +3 -3
- package/dist/chunk-HWXZ3E7B.js +347 -0
- package/dist/chunk-HWXZ3E7B.js.map +1 -0
- package/dist/{chunk-Y52SNUW5.js → chunk-JG7XVS53.js} +11 -3
- package/dist/{chunk-Y52SNUW5.js.map → chunk-JG7XVS53.js.map} +1 -1
- package/dist/{chunk-PRFHN2X6.js → chunk-K5EXATBF.js} +2 -2
- package/dist/{chunk-4BGAVEO6.js → chunk-UHMMANC2.js} +77 -338
- package/dist/chunk-UHMMANC2.js.map +1 -0
- package/dist/chunk-WS6OA7H6.js +266 -0
- package/dist/chunk-WS6OA7H6.js.map +1 -0
- package/dist/cli/main.js +6 -5
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +12 -10
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{goal-manager-JKTNFJQE.js → goal-manager-O446DRJI.js} +6 -5
- package/dist/{goal-validator-RD6QBQJB.js → goal-validator-XYA364W3.js} +3 -2
- package/dist/{goal-validator-RD6QBQJB.js.map → goal-validator-XYA364W3.js.map} +1 -1
- package/dist/{guardian-agent-ITZIDNQD.js → guardian-agent-KVLNECZ5.js} +9 -8
- package/dist/{hypothesis-PEVD2IJR.js → hypothesis-QFGZ5ITT.js} +6 -5
- package/dist/hypothesis-QFGZ5ITT.js.map +1 -0
- package/dist/index.js +16 -14
- package/dist/index.js.map +1 -1
- package/dist/insight-store-DZ5C3RFM.js +22 -0
- package/dist/insight-store-DZ5C3RFM.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-4BGAVEO6.js.map +0 -1
- package/dist/chunk-XNAVAA52.js.map +0 -1
- /package/dist/{goal-manager-JKTNFJQE.js.map → chat-store-R46BCMBW.js.map} +0 -0
- /package/dist/{chunk-GPLRFTMB.js.map → chunk-3BVNB3GY.js.map} +0 -0
- /package/dist/{chunk-PPZYVTUO.js.map → chunk-6LD7OPJL.js.map} +0 -0
- /package/dist/{chunk-5TQ7J7UI.js.map → chunk-7A5RLKZY.js.map} +0 -0
- /package/dist/{chunk-IQBHPTV7.js.map → chunk-EOLHWFDG.js.map} +0 -0
- /package/dist/{chunk-FNW7Z7ZS.js.map → chunk-F4ZIAHTZ.js.map} +0 -0
- /package/dist/{chunk-PRFHN2X6.js.map → chunk-K5EXATBF.js.map} +0 -0
- /package/dist/{guardian-agent-ITZIDNQD.js.map → goal-manager-O446DRJI.js.map} +0 -0
- /package/dist/{hypothesis-PEVD2IJR.js.map → guardian-agent-KVLNECZ5.js.map} +0 -0
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGuardian
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7A5RLKZY.js";
|
|
4
|
+
import {
|
|
5
|
+
getChatStore
|
|
6
|
+
} from "./chunk-HWXZ3E7B.js";
|
|
4
7
|
import {
|
|
5
8
|
LearningEngine,
|
|
6
9
|
exportToJson,
|
|
@@ -10,12 +13,12 @@ import {
|
|
|
10
13
|
perceiveCurrentChanges,
|
|
11
14
|
reasonAboutChangesHumanReadable,
|
|
12
15
|
saveCheckpoint
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6LD7OPJL.js";
|
|
14
17
|
import {
|
|
15
18
|
TieredStorage,
|
|
16
19
|
findCrossProjectPatterns,
|
|
17
20
|
getStorage
|
|
18
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-F4ZIAHTZ.js";
|
|
19
22
|
import {
|
|
20
23
|
getKeyFromKeychain,
|
|
21
24
|
isAIAvailable,
|
|
@@ -24,7 +27,7 @@ import {
|
|
|
24
27
|
} from "./chunk-WRGSH5RT.js";
|
|
25
28
|
import {
|
|
26
29
|
getGuardianState
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-UHMMANC2.js";
|
|
28
31
|
import {
|
|
29
32
|
ContextGraph
|
|
30
33
|
} from "./chunk-55CBWOEZ.js";
|
|
@@ -288,11 +291,11 @@ var StreamingManager = class {
|
|
|
288
291
|
|
|
289
292
|
// src/cli/dashboard/index.ts
|
|
290
293
|
import { render } from "ink";
|
|
291
|
-
import
|
|
294
|
+
import React11 from "react";
|
|
292
295
|
|
|
293
296
|
// src/cli/dashboard/App.tsx
|
|
294
|
-
import { useState as useState2, useEffect as
|
|
295
|
-
import { Box as
|
|
297
|
+
import { useState as useState2, useEffect as useEffect5, useCallback as useCallback7, useRef as useRef2 } from "react";
|
|
298
|
+
import { Box as Box14, useInput as useInput10, useApp } from "ink";
|
|
296
299
|
|
|
297
300
|
// src/cli/dashboard/state.tsx
|
|
298
301
|
import React, { createContext, useContext, useReducer } from "react";
|
|
@@ -661,6 +664,27 @@ function dashboardReducer(state, action) {
|
|
|
661
664
|
}
|
|
662
665
|
case "SET_CHAT_LOADING":
|
|
663
666
|
return { ...state, chatState: { ...state.chatState, loading: action.loading } };
|
|
667
|
+
case "SET_CHAT_SESSION":
|
|
668
|
+
return { ...state, chatState: { ...state.chatState, currentSessionId: action.sessionId, currentSessionTitle: action.title } };
|
|
669
|
+
case "LOAD_CHAT_MESSAGES":
|
|
670
|
+
return { ...state, chatState: { ...state.chatState, messages: action.messages } };
|
|
671
|
+
case "CLEAR_CHAT":
|
|
672
|
+
return { ...state, chatState: { messages: [], inputBuffer: "", loading: false, currentSessionId: null, currentSessionTitle: null } };
|
|
673
|
+
case "SET_CHAT_ARCHIVE_SESSIONS":
|
|
674
|
+
return { ...state, chatArchivePanel: { ...state.chatArchivePanel, sessions: action.sessions } };
|
|
675
|
+
case "SELECT_CHAT_SESSION": {
|
|
676
|
+
const sessions = state.chatArchivePanel.sessions;
|
|
677
|
+
const newIndex = Math.max(0, Math.min(action.index, sessions.length - 1));
|
|
678
|
+
return { ...state, chatArchivePanel: { ...state.chatArchivePanel, selectedIndex: newIndex } };
|
|
679
|
+
}
|
|
680
|
+
case "SET_CHAT_ARCHIVE_INPUT_MODE":
|
|
681
|
+
return { ...state, chatArchivePanel: { ...state.chatArchivePanel, inputMode: action.mode, inputBuffer: action.mode === "rename" ? state.chatArchivePanel.sessions[state.chatArchivePanel.selectedIndex]?.title || "" : "" } };
|
|
682
|
+
case "SET_CHAT_ARCHIVE_INPUT_BUFFER":
|
|
683
|
+
return { ...state, chatArchivePanel: { ...state.chatArchivePanel, inputBuffer: action.buffer } };
|
|
684
|
+
case "SET_CHAT_ARCHIVE_LOADING":
|
|
685
|
+
return { ...state, chatArchivePanel: { ...state.chatArchivePanel, loading: action.loading } };
|
|
686
|
+
case "TOGGLE_ARCHIVED_CHATS":
|
|
687
|
+
return { ...state, chatArchivePanel: { ...state.chatArchivePanel, showArchived: !state.chatArchivePanel.showArchived } };
|
|
664
688
|
case "SET_AGENT_CONFIG":
|
|
665
689
|
return { ...state, agentConfig: applyAgentConfigPatch(state.agentConfig, action.config) };
|
|
666
690
|
case "NAVIGATE_UP": {
|
|
@@ -813,7 +837,8 @@ function createInitialState() {
|
|
|
813
837
|
hypothesesPanel: { hypotheses: [], selectedIndex: 0, selectedCompletedIndex: 0, inputMode: "browse", inputBuffer: "", lastRefresh: 0 },
|
|
814
838
|
memoryTree: { loaded: false, snapshot: null, globalPatterns: [], expandedNodes: /* @__PURE__ */ new Set(["decisions"]), selectedNode: "decisions", scrollPosition: 0, lastRefresh: 0 },
|
|
815
839
|
agentBrain: { loaded: false, decisions: [], patterns: [], ledgerHash: null, selectedIndex: 0, expandedIndex: null },
|
|
816
|
-
chatState: { messages: [], inputBuffer: "", loading: false },
|
|
840
|
+
chatState: { messages: [], inputBuffer: "", loading: false, currentSessionId: null, currentSessionTitle: null },
|
|
841
|
+
chatArchivePanel: { sessions: [], selectedIndex: 0, showArchived: false, loading: false, inputMode: "browse", inputBuffer: "" },
|
|
817
842
|
pendingFixes: [],
|
|
818
843
|
selectedFixIndex: 0
|
|
819
844
|
};
|
|
@@ -879,6 +904,7 @@ function Header() {
|
|
|
879
904
|
}
|
|
880
905
|
|
|
881
906
|
// src/cli/dashboard/components/Footer.tsx
|
|
907
|
+
import React2 from "react";
|
|
882
908
|
import { Box as Box2, Text as Text2, useStdout as useStdout2 } from "ink";
|
|
883
909
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
884
910
|
var VIEW_LABELS = {
|
|
@@ -888,7 +914,8 @@ var VIEW_LABELS = {
|
|
|
888
914
|
goals: "Goals",
|
|
889
915
|
hypotheses: "Hypotheses",
|
|
890
916
|
memory: "Ledger",
|
|
891
|
-
chat: "Chat"
|
|
917
|
+
chat: "Chat",
|
|
918
|
+
"chat-archive": "History"
|
|
892
919
|
};
|
|
893
920
|
var VIEW_SHORT = {
|
|
894
921
|
overview: "Ovr",
|
|
@@ -897,24 +924,27 @@ var VIEW_SHORT = {
|
|
|
897
924
|
goals: "Gls",
|
|
898
925
|
hypotheses: "Hyp",
|
|
899
926
|
memory: "Ldg",
|
|
900
|
-
chat: "Cht"
|
|
927
|
+
chat: "Cht",
|
|
928
|
+
"chat-archive": "Hst"
|
|
901
929
|
};
|
|
902
930
|
var TAB_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
903
931
|
var CONTEXT_HINTS = {
|
|
904
|
-
goals: "
|
|
905
|
-
hypotheses: "
|
|
906
|
-
agent: "
|
|
907
|
-
memory: "
|
|
908
|
-
chat: "
|
|
909
|
-
|
|
932
|
+
goals: "/ help",
|
|
933
|
+
hypotheses: "/ help",
|
|
934
|
+
agent: "/ help",
|
|
935
|
+
memory: "/ help",
|
|
936
|
+
chat: "/ help",
|
|
937
|
+
"chat-archive": "/ help",
|
|
938
|
+
rawlog: "/ help"
|
|
910
939
|
};
|
|
911
940
|
var CONTEXT_HINTS_SHORT = {
|
|
912
|
-
goals: "
|
|
913
|
-
hypotheses: "
|
|
914
|
-
agent: "
|
|
915
|
-
memory: "
|
|
916
|
-
chat: "
|
|
917
|
-
|
|
941
|
+
goals: "/",
|
|
942
|
+
hypotheses: "/",
|
|
943
|
+
agent: "/",
|
|
944
|
+
memory: "/",
|
|
945
|
+
chat: "/",
|
|
946
|
+
"chat-archive": "/",
|
|
947
|
+
rawlog: "/"
|
|
918
948
|
};
|
|
919
949
|
function Footer() {
|
|
920
950
|
const { state } = useDashboard();
|
|
@@ -932,25 +962,23 @@ function Footer() {
|
|
|
932
962
|
hints = narrow ? "enter esc" : "enter save \xB7 esc cancel";
|
|
933
963
|
} else {
|
|
934
964
|
const hintMap = narrow ? CONTEXT_HINTS_SHORT : CONTEXT_HINTS;
|
|
935
|
-
hints = hintMap[view] || (narrow ? "
|
|
965
|
+
hints = hintMap[view] || (narrow ? "/" : "/ help");
|
|
936
966
|
}
|
|
937
967
|
if (veryNarrow) {
|
|
938
968
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 1, children: [
|
|
939
|
-
/* @__PURE__ */ jsx3(Box2, { gap:
|
|
969
|
+
/* @__PURE__ */ jsx3(Box2, { gap: 0, children: TAB_VIEWS.map((v, idx) => {
|
|
940
970
|
const isAgent = v === "agent";
|
|
941
971
|
const isCurrent = v === view;
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
return /* @__PURE__ */ jsxs2(Text2, { color: "yellow", bold: true, children: [
|
|
972
|
+
const isLast = idx === TAB_VIEWS.length - 1;
|
|
973
|
+
return /* @__PURE__ */ jsxs2(React2.Fragment, { children: [
|
|
974
|
+
isCurrent ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children: labels[v] }) : isAgent && hasUnreadNudges ? /* @__PURE__ */ jsxs2(Text2, { color: "yellow", bold: true, children: [
|
|
946
975
|
labels[v],
|
|
947
976
|
" (",
|
|
948
977
|
unreadNudgesCount,
|
|
949
978
|
")"
|
|
950
|
-
] }, v)
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
}
|
|
979
|
+
] }) : /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: labels[v] }),
|
|
980
|
+
!isLast && /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: " \xB7 " })
|
|
981
|
+
] }, v);
|
|
954
982
|
}) }),
|
|
955
983
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
956
984
|
hints,
|
|
@@ -959,21 +987,19 @@ function Footer() {
|
|
|
959
987
|
] });
|
|
960
988
|
}
|
|
961
989
|
return /* @__PURE__ */ jsxs2(Box2, { paddingX: 1, justifyContent: "space-between", children: [
|
|
962
|
-
/* @__PURE__ */ jsx3(Box2, { gap:
|
|
990
|
+
/* @__PURE__ */ jsx3(Box2, { gap: 0, children: TAB_VIEWS.map((v, idx) => {
|
|
963
991
|
const isAgent = v === "agent";
|
|
964
992
|
const isCurrent = v === view;
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
return /* @__PURE__ */ jsxs2(Text2, { color: "yellow", bold: true, children: [
|
|
993
|
+
const isLast = idx === TAB_VIEWS.length - 1;
|
|
994
|
+
return /* @__PURE__ */ jsxs2(React2.Fragment, { children: [
|
|
995
|
+
isCurrent ? /* @__PURE__ */ jsx3(Text2, { color: "green", bold: true, children: labels[v] }) : isAgent && hasUnreadNudges ? /* @__PURE__ */ jsxs2(Text2, { color: "yellow", bold: true, children: [
|
|
969
996
|
labels[v],
|
|
970
997
|
" (",
|
|
971
998
|
unreadNudgesCount,
|
|
972
999
|
")"
|
|
973
|
-
] }, v)
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}
|
|
1000
|
+
] }) : /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: labels[v] }),
|
|
1001
|
+
!isLast && /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: " \xB7 " })
|
|
1002
|
+
] }, v);
|
|
977
1003
|
}) }),
|
|
978
1004
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
979
1005
|
hints,
|
|
@@ -1248,9 +1274,124 @@ function ConfigDialog({ onClose }) {
|
|
|
1248
1274
|
] });
|
|
1249
1275
|
}
|
|
1250
1276
|
|
|
1277
|
+
// src/cli/dashboard/components/HelpDialog.tsx
|
|
1278
|
+
import { Box as Box5, Text as Text5 } from "ink";
|
|
1279
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1280
|
+
var VIEW_HELP = {
|
|
1281
|
+
overview: [
|
|
1282
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1283
|
+
{ key: "g", description: "Go to Nudges" },
|
|
1284
|
+
{ key: "o", description: "Go to Goals" },
|
|
1285
|
+
{ key: "y", description: "Go to Hypotheses" },
|
|
1286
|
+
{ key: "t", description: "Go to Ledger" },
|
|
1287
|
+
{ key: "c", description: "Go to Chat" },
|
|
1288
|
+
{ key: "l", description: "Go to Raw Log" },
|
|
1289
|
+
{ key: "s", description: "Open Settings" },
|
|
1290
|
+
{ key: "q / esc", description: "Quit" }
|
|
1291
|
+
],
|
|
1292
|
+
agent: [
|
|
1293
|
+
{ key: "j / \u2193", description: "Move down" },
|
|
1294
|
+
{ key: "k / \u2191", description: "Move up" },
|
|
1295
|
+
{ key: "enter", description: "Expand selected nudge" },
|
|
1296
|
+
{ key: "d", description: "Dismiss selected nudge" },
|
|
1297
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1298
|
+
{ key: "s", description: "Open Settings" },
|
|
1299
|
+
{ key: "q / esc", description: "Quit" }
|
|
1300
|
+
],
|
|
1301
|
+
goals: [
|
|
1302
|
+
{ key: "j / \u2193", description: "Move down" },
|
|
1303
|
+
{ key: "k / \u2191", description: "Move up" },
|
|
1304
|
+
{ key: "a", description: "Add new goal" },
|
|
1305
|
+
{ key: "r", description: "Run check on selected goal" },
|
|
1306
|
+
{ key: "enter", description: "Mark goal as complete" },
|
|
1307
|
+
{ key: "d", description: "Delete selected goal" },
|
|
1308
|
+
{ key: "x", description: "Clear all achieved goals" },
|
|
1309
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1310
|
+
{ key: "s", description: "Open Settings" },
|
|
1311
|
+
{ key: "q / esc", description: "Quit" }
|
|
1312
|
+
],
|
|
1313
|
+
hypotheses: [
|
|
1314
|
+
{ key: "j / \u2193", description: "Move down" },
|
|
1315
|
+
{ key: "k / \u2191", description: "Move up" },
|
|
1316
|
+
{ key: "a", description: "Add new hypothesis" },
|
|
1317
|
+
{ key: "r", description: "Run check on selected hypothesis" },
|
|
1318
|
+
{ key: "v", description: "Mark hypothesis as validated" },
|
|
1319
|
+
{ key: "x", description: "Mark hypothesis as invalidated" },
|
|
1320
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1321
|
+
{ key: "s", description: "Open Settings" },
|
|
1322
|
+
{ key: "q / esc", description: "Quit" }
|
|
1323
|
+
],
|
|
1324
|
+
memory: [
|
|
1325
|
+
{ key: "j / \u2193", description: "Move down" },
|
|
1326
|
+
{ key: "k / \u2191", description: "Move up" },
|
|
1327
|
+
{ key: "enter", description: "Expand selected item" },
|
|
1328
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1329
|
+
{ key: "s", description: "Open Settings" },
|
|
1330
|
+
{ key: "q / esc", description: "Quit" }
|
|
1331
|
+
],
|
|
1332
|
+
chat: [
|
|
1333
|
+
{ key: "type", description: "Enter message" },
|
|
1334
|
+
{ key: "enter", description: "Send message" },
|
|
1335
|
+
{ key: "esc", description: "Clear input" },
|
|
1336
|
+
{ key: "h", description: "Open chat history" },
|
|
1337
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1338
|
+
{ key: "q", description: "Quit (press twice if input active)" }
|
|
1339
|
+
],
|
|
1340
|
+
"chat-archive": [
|
|
1341
|
+
{ key: "j / \u2193", description: "Move down" },
|
|
1342
|
+
{ key: "k / \u2191", description: "Move up" },
|
|
1343
|
+
{ key: "enter", description: "Load selected chat" },
|
|
1344
|
+
{ key: "n", description: "Start new chat" },
|
|
1345
|
+
{ key: "d", description: "Delete selected chat" },
|
|
1346
|
+
{ key: "a", description: "Archive selected chat" },
|
|
1347
|
+
{ key: "r", description: "Rename selected chat" },
|
|
1348
|
+
{ key: "e", description: "Export selected chat" },
|
|
1349
|
+
{ key: "t", description: "Toggle archived chats" },
|
|
1350
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1351
|
+
{ key: "s", description: "Open Settings" },
|
|
1352
|
+
{ key: "q / esc", description: "Quit" }
|
|
1353
|
+
],
|
|
1354
|
+
rawlog: [
|
|
1355
|
+
{ key: "n", description: "Next page" },
|
|
1356
|
+
{ key: "p", description: "Previous page" },
|
|
1357
|
+
{ key: "b", description: "Back to previous view" },
|
|
1358
|
+
{ key: "tab", description: "Navigate between views" },
|
|
1359
|
+
{ key: "s", description: "Open Settings" },
|
|
1360
|
+
{ key: "q / esc", description: "Quit" }
|
|
1361
|
+
]
|
|
1362
|
+
};
|
|
1363
|
+
function HelpDialog({ view, onClose }) {
|
|
1364
|
+
const shortcuts = VIEW_HELP[view] || VIEW_HELP.overview;
|
|
1365
|
+
const viewName = view.charAt(0).toUpperCase() + view.slice(1);
|
|
1366
|
+
return /* @__PURE__ */ jsxs5(
|
|
1367
|
+
Box5,
|
|
1368
|
+
{
|
|
1369
|
+
flexDirection: "column",
|
|
1370
|
+
borderStyle: "round",
|
|
1371
|
+
borderColor: "cyan",
|
|
1372
|
+
paddingX: 2,
|
|
1373
|
+
paddingY: 1,
|
|
1374
|
+
width: "80%",
|
|
1375
|
+
alignSelf: "center",
|
|
1376
|
+
marginTop: 2,
|
|
1377
|
+
children: [
|
|
1378
|
+
/* @__PURE__ */ jsxs5(Text5, { bold: true, color: "cyan", children: [
|
|
1379
|
+
viewName,
|
|
1380
|
+
" View - Keyboard Shortcuts"
|
|
1381
|
+
] }),
|
|
1382
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, flexDirection: "column", gap: 0, children: shortcuts.map(({ key, description }, idx) => /* @__PURE__ */ jsxs5(Box5, { gap: 2, children: [
|
|
1383
|
+
/* @__PURE__ */ jsx6(Box5, { width: 12, children: /* @__PURE__ */ jsx6(Text5, { color: "yellow", children: key }) }),
|
|
1384
|
+
/* @__PURE__ */ jsx6(Text5, { children: description })
|
|
1385
|
+
] }, idx)) }),
|
|
1386
|
+
/* @__PURE__ */ jsx6(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx6(Text5, { dimColor: true, children: "Press / or ? again to close" }) })
|
|
1387
|
+
]
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1251
1392
|
// src/cli/dashboard/views/OverviewView.tsx
|
|
1252
|
-
import { Box as
|
|
1253
|
-
import { Fragment, jsx as
|
|
1393
|
+
import { Box as Box6, Text as Text6, useInput as useInput2, useStdout as useStdout4 } from "ink";
|
|
1394
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1254
1395
|
function truncate(str, max) {
|
|
1255
1396
|
return str.length > max ? str.slice(0, max - 1) + "..." : str;
|
|
1256
1397
|
}
|
|
@@ -1284,18 +1425,18 @@ function OverviewView() {
|
|
|
1284
1425
|
dispatch({ type: "DISMISS_FIX", id: activeFixes[selectedFixIndex].id });
|
|
1285
1426
|
}
|
|
1286
1427
|
});
|
|
1287
|
-
return /* @__PURE__ */
|
|
1288
|
-
/* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", paddingX: 1, children: [
|
|
1429
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1289
1430
|
"Scanned ",
|
|
1290
1431
|
watch.filesScannedSession,
|
|
1291
1432
|
" files ",
|
|
1292
1433
|
elapsed,
|
|
1293
1434
|
"s"
|
|
1294
1435
|
] }),
|
|
1295
|
-
watch.watching && signalExtraction.enabled && /* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1436
|
+
watch.watching && signalExtraction.enabled && /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1437
|
+
/* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }),
|
|
1297
1438
|
" Signal extraction",
|
|
1298
|
-
!narrow && (signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */
|
|
1439
|
+
!narrow && (signalExtraction.decisionsExtracted > 0 || signalExtraction.factsExtracted > 0 || signalExtraction.blockersExtracted > 0) && /* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1299
1440
|
" ",
|
|
1300
1441
|
signalExtraction.decisionsExtracted,
|
|
1301
1442
|
"d \xB7 ",
|
|
@@ -1309,73 +1450,73 @@ function OverviewView() {
|
|
|
1309
1450
|
const filename = issue.file.split("/").pop() || issue.file;
|
|
1310
1451
|
const lineNum = issue.line ? `:${issue.line}` : "";
|
|
1311
1452
|
const issueLen = Math.max(15, contentWidth - filename.length - 6);
|
|
1312
|
-
return /* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1453
|
+
return /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1454
|
+
/* @__PURE__ */ jsx7(Text6, { color: "red", children: "\u25CF" }),
|
|
1314
1455
|
" ",
|
|
1315
|
-
/* @__PURE__ */
|
|
1316
|
-
/* @__PURE__ */
|
|
1456
|
+
/* @__PURE__ */ jsx7(Text6, { color: "red", children: truncate(issue.issue, issueLen) }),
|
|
1457
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1317
1458
|
" ",
|
|
1318
1459
|
filename,
|
|
1319
1460
|
lineNum
|
|
1320
1461
|
] })
|
|
1321
1462
|
] }, i);
|
|
1322
1463
|
}),
|
|
1323
|
-
totalIssues === 0 && criticalIssues.length === 0 && activeFixes.length === 0 && /* @__PURE__ */
|
|
1324
|
-
/* @__PURE__ */
|
|
1464
|
+
totalIssues === 0 && criticalIssues.length === 0 && activeFixes.length === 0 && /* @__PURE__ */ jsxs6(Text6, { children: [
|
|
1465
|
+
/* @__PURE__ */ jsx7(Text6, { color: "green", children: "\u25CF" }),
|
|
1325
1466
|
" No issues"
|
|
1326
1467
|
] }),
|
|
1327
|
-
activeFixes.length > 0 && /* @__PURE__ */
|
|
1328
|
-
/* @__PURE__ */
|
|
1468
|
+
activeFixes.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
|
|
1469
|
+
/* @__PURE__ */ jsx7(Text6, { bold: true, children: "Goal Violations" }),
|
|
1329
1470
|
activeFixes.map((fix, i) => {
|
|
1330
1471
|
const isSelected = i === selectedFixIndex;
|
|
1331
1472
|
const confidenceColor = fix.confidence >= 90 ? "green" : fix.confidence >= 70 ? "yellow" : "red";
|
|
1332
1473
|
const shortFile = fix.file.split("/").pop() || fix.file;
|
|
1333
1474
|
const descLen = Math.max(15, contentWidth - shortFile.length - 10);
|
|
1334
|
-
return /* @__PURE__ */
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
isSelected ? /* @__PURE__ */
|
|
1337
|
-
/* @__PURE__ */
|
|
1475
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
1476
|
+
/* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1477
|
+
isSelected ? /* @__PURE__ */ jsx7(Text6, { bold: true, color: "yellow", children: "> " }) : " ",
|
|
1478
|
+
/* @__PURE__ */ jsx7(Text6, { color: "yellow", children: "\u25CF" }),
|
|
1338
1479
|
" ",
|
|
1339
|
-
/* @__PURE__ */
|
|
1340
|
-
/* @__PURE__ */
|
|
1480
|
+
/* @__PURE__ */ jsx7(Text6, { children: truncate(fix.description, descLen) }),
|
|
1481
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1341
1482
|
" ",
|
|
1342
1483
|
shortFile
|
|
1343
1484
|
] })
|
|
1344
1485
|
] }),
|
|
1345
|
-
/* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1346
1487
|
" ",
|
|
1347
|
-
/* @__PURE__ */
|
|
1488
|
+
/* @__PURE__ */ jsxs6(Text6, { color: confidenceColor, bold: true, children: [
|
|
1348
1489
|
fix.confidence,
|
|
1349
1490
|
"%"
|
|
1350
1491
|
] }),
|
|
1351
|
-
narrow ? fix.status === "applying" && /* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1492
|
+
narrow ? fix.status === "applying" && /* @__PURE__ */ jsx7(Text6, { color: "cyan", children: " applying..." }) : /* @__PURE__ */ jsxs6(Fragment, { children: [
|
|
1493
|
+
/* @__PURE__ */ jsxs6(Text6, { dimColor: true, children: [
|
|
1353
1494
|
" confidence fix: ",
|
|
1354
1495
|
truncate(fix.suggestedFix, contentWidth - 25)
|
|
1355
1496
|
] }),
|
|
1356
|
-
fix.status === "applying" && /* @__PURE__ */
|
|
1497
|
+
fix.status === "applying" && /* @__PURE__ */ jsx7(Text6, { color: "cyan", children: " applying..." })
|
|
1357
1498
|
] })
|
|
1358
1499
|
] })
|
|
1359
1500
|
] }, fix.id);
|
|
1360
1501
|
}),
|
|
1361
|
-
/* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " f fix \xB7 x dismiss" })
|
|
1362
1503
|
] }),
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1365
|
-
pageActivities.map((entry, i) => /* @__PURE__ */
|
|
1504
|
+
/* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginTop: 1, children: [
|
|
1505
|
+
/* @__PURE__ */ jsx7(Text6, { bold: true, children: "Activity" }),
|
|
1506
|
+
pageActivities.map((entry, i) => /* @__PURE__ */ jsxs6(Text6, { wrap: "truncate", children: [
|
|
1366
1507
|
" ",
|
|
1367
|
-
/* @__PURE__ */
|
|
1508
|
+
/* @__PURE__ */ jsx7(Text6, { dimColor: true, children: entry.time }),
|
|
1368
1509
|
" ",
|
|
1369
1510
|
truncate(entry.message, contentWidth - 14)
|
|
1370
1511
|
] }, i)),
|
|
1371
|
-
pageActivities.length === 0 && /* @__PURE__ */
|
|
1512
|
+
pageActivities.length === 0 && /* @__PURE__ */ jsx7(Text6, { dimColor: true, children: " No activity yet" })
|
|
1372
1513
|
] })
|
|
1373
1514
|
] });
|
|
1374
1515
|
}
|
|
1375
1516
|
|
|
1376
1517
|
// src/cli/dashboard/views/AgentView.tsx
|
|
1377
1518
|
import { useEffect, useCallback } from "react";
|
|
1378
|
-
import { Box as
|
|
1519
|
+
import { Box as Box7, Text as Text7, useInput as useInput3, useStdout as useStdout5 } from "ink";
|
|
1379
1520
|
|
|
1380
1521
|
// src/cli/dashboard/theme.ts
|
|
1381
1522
|
import pc from "picocolors";
|
|
@@ -1414,7 +1555,7 @@ function progressBar(current, total, width = 10) {
|
|
|
1414
1555
|
}
|
|
1415
1556
|
|
|
1416
1557
|
// src/cli/dashboard/views/AgentView.tsx
|
|
1417
|
-
import { jsx as
|
|
1558
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1418
1559
|
function timeAgo(iso) {
|
|
1419
1560
|
const ms = Date.now() - new Date(iso).getTime();
|
|
1420
1561
|
const mins = Math.floor(ms / 6e4);
|
|
@@ -1468,31 +1609,45 @@ function AgentView() {
|
|
|
1468
1609
|
dispatch({ type: "MARK_NUDGES_READ" });
|
|
1469
1610
|
}
|
|
1470
1611
|
}, [dispatch, state.unreadNudgesCount]);
|
|
1612
|
+
const dismissInsight = useCallback(async () => {
|
|
1613
|
+
const visible = getVisibleInsights(state);
|
|
1614
|
+
const insight = visible[selectedInsight];
|
|
1615
|
+
if (!insight) return;
|
|
1616
|
+
try {
|
|
1617
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
1618
|
+
const { getInsightStore } = await import("./insight-store-DZ5C3RFM.js");
|
|
1619
|
+
const store = getInsightStore(workDir);
|
|
1620
|
+
await store.dismissInsight(insight.id);
|
|
1621
|
+
} catch (error) {
|
|
1622
|
+
console.error("Failed to persist insight dismissal:", error);
|
|
1623
|
+
}
|
|
1624
|
+
dispatch({ type: "DISMISS_INSIGHT", index: selectedInsight });
|
|
1625
|
+
}, [selectedInsight, state, dispatch]);
|
|
1471
1626
|
useInput3((input, key) => {
|
|
1472
1627
|
if (key.upArrow || input === "k") dispatch({ type: "NAVIGATE_UP" });
|
|
1473
1628
|
else if (key.downArrow || input === "j") dispatch({ type: "NAVIGATE_DOWN" });
|
|
1474
1629
|
else if (key.return) dispatch({ type: "TOGGLE_INSIGHT", index: selectedInsight });
|
|
1475
|
-
else if (input === "d")
|
|
1630
|
+
else if (input === "d") void dismissInsight();
|
|
1476
1631
|
});
|
|
1477
1632
|
const alertCount = alerts.length;
|
|
1478
1633
|
const decCount = decisions.length;
|
|
1479
1634
|
const patCount = patterns.length;
|
|
1480
1635
|
if (!loaded) {
|
|
1481
|
-
return /* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1636
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
1637
|
+
/* @__PURE__ */ jsx8(Text7, { bold: true, children: "Nudges" }),
|
|
1638
|
+
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Loading..." })
|
|
1484
1639
|
] });
|
|
1485
1640
|
}
|
|
1486
1641
|
if (alertCount === 0 && decCount === 0 && patCount === 0) {
|
|
1487
|
-
return /* @__PURE__ */
|
|
1488
|
-
/* @__PURE__ */
|
|
1489
|
-
/* @__PURE__ */
|
|
1642
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
1643
|
+
/* @__PURE__ */ jsx8(Text7, { bold: true, children: "Nudges" }),
|
|
1644
|
+
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " No nudges yet. Trie will alert you here when it spots issues." })
|
|
1490
1645
|
] });
|
|
1491
1646
|
}
|
|
1492
|
-
return /* @__PURE__ */
|
|
1493
|
-
/* @__PURE__ */
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
1647
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", paddingX: 1, children: [
|
|
1648
|
+
/* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1649
|
+
/* @__PURE__ */ jsx8(Text7, { bold: true, children: "Nudges" }),
|
|
1650
|
+
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1496
1651
|
" ",
|
|
1497
1652
|
alertCount,
|
|
1498
1653
|
" alerts \xB7 ",
|
|
@@ -1502,85 +1657,85 @@ function AgentView() {
|
|
|
1502
1657
|
" patterns"
|
|
1503
1658
|
] })
|
|
1504
1659
|
] }),
|
|
1505
|
-
alertCount > 0 && /* @__PURE__ */
|
|
1660
|
+
alertCount > 0 && /* @__PURE__ */ jsx8(Box7, { flexDirection: "column", marginTop: 1, children: alerts.map((insight, idx) => {
|
|
1506
1661
|
const isSelected = idx === selectedInsight;
|
|
1507
1662
|
const isExpanded = idx === expandedInsight;
|
|
1508
1663
|
const ago = formatTimeAgo(insight.timestamp);
|
|
1509
1664
|
const msg = insight.message.slice(0, msgLen) + (insight.message.length > msgLen ? "..." : "");
|
|
1510
1665
|
const riskColor = insight.priority >= 8 ? "red" : insight.priority >= 5 ? "yellow" : void 0;
|
|
1511
|
-
return /* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
isSelected ? /* @__PURE__ */
|
|
1514
|
-
riskColor ? /* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
1667
|
+
/* @__PURE__ */ jsxs7(Text7, { wrap: "truncate", children: [
|
|
1668
|
+
isSelected ? /* @__PURE__ */ jsx8(Text7, { bold: true, color: "green", children: "> " }) : " ",
|
|
1669
|
+
riskColor ? /* @__PURE__ */ jsx8(Text7, { color: riskColor, children: "\u25CF" }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1515
1670
|
" ",
|
|
1516
|
-
isSelected ? /* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1671
|
+
isSelected ? /* @__PURE__ */ jsx8(Text7, { bold: true, children: msg }) : /* @__PURE__ */ jsx8(Text7, { children: msg }),
|
|
1672
|
+
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1518
1673
|
" ",
|
|
1519
1674
|
insight.category,
|
|
1520
1675
|
" \xB7 ",
|
|
1521
1676
|
ago
|
|
1522
1677
|
] })
|
|
1523
1678
|
] }),
|
|
1524
|
-
(isExpanded || isSelected) && insight.suggestedAction && /* @__PURE__ */
|
|
1679
|
+
(isExpanded || isSelected) && insight.suggestedAction && /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1525
1680
|
" ",
|
|
1526
|
-
/* @__PURE__ */
|
|
1681
|
+
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1527
1682
|
"->",
|
|
1528
1683
|
" "
|
|
1529
1684
|
] }),
|
|
1530
|
-
/* @__PURE__ */
|
|
1685
|
+
/* @__PURE__ */ jsx8(Text7, { children: insight.suggestedAction })
|
|
1531
1686
|
] })
|
|
1532
1687
|
] }, insight.id);
|
|
1533
1688
|
}) }),
|
|
1534
|
-
decCount > 0 && /* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1689
|
+
decCount > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
|
|
1690
|
+
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Decisions" }),
|
|
1536
1691
|
decisions.slice(0, 10).map((dec) => {
|
|
1537
1692
|
const ago = timeAgo(dec.when);
|
|
1538
1693
|
const active = dec.status === "active";
|
|
1539
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1540
1695
|
" ",
|
|
1541
|
-
active ? /* @__PURE__ */
|
|
1696
|
+
active ? /* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1542
1697
|
" ",
|
|
1543
1698
|
dec.decision.slice(0, msgLen),
|
|
1544
1699
|
dec.decision.length > msgLen ? "..." : "",
|
|
1545
|
-
/* @__PURE__ */
|
|
1700
|
+
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1546
1701
|
" ",
|
|
1547
1702
|
ago
|
|
1548
1703
|
] })
|
|
1549
1704
|
] }, dec.id);
|
|
1550
1705
|
})
|
|
1551
1706
|
] }),
|
|
1552
|
-
patCount > 0 && /* @__PURE__ */
|
|
1553
|
-
/* @__PURE__ */
|
|
1707
|
+
patCount > 0 && /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", marginTop: 1, children: [
|
|
1708
|
+
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: " Patterns" }),
|
|
1554
1709
|
patterns.slice(0, 8).map((pat, idx) => {
|
|
1555
1710
|
const conf = Math.round(pat.confidence * 100);
|
|
1556
1711
|
const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
|
|
1557
|
-
return /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1558
1713
|
" ",
|
|
1559
|
-
pat.isAntiPattern ? /* @__PURE__ */
|
|
1714
|
+
pat.isAntiPattern ? /* @__PURE__ */ jsx8(Text7, { color: "red", children: "\u25CF" }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB" }),
|
|
1560
1715
|
" ",
|
|
1561
1716
|
pat.description.slice(0, msgLen),
|
|
1562
1717
|
pat.description.length > msgLen ? "..." : "",
|
|
1563
1718
|
" ",
|
|
1564
|
-
confColor ? /* @__PURE__ */
|
|
1719
|
+
confColor ? /* @__PURE__ */ jsxs7(Text7, { color: confColor, children: [
|
|
1565
1720
|
conf,
|
|
1566
1721
|
"%"
|
|
1567
|
-
] }) : /* @__PURE__ */
|
|
1722
|
+
] }) : /* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1568
1723
|
conf,
|
|
1569
1724
|
"%"
|
|
1570
1725
|
] })
|
|
1571
1726
|
] }, idx);
|
|
1572
1727
|
})
|
|
1573
1728
|
] }),
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
isAIAvailable() ? /* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1729
|
+
/* @__PURE__ */ jsxs7(Box7, { marginTop: 1, gap: 2, children: [
|
|
1730
|
+
isAIAvailable() ? /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1731
|
+
/* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CF" }),
|
|
1577
1732
|
" ",
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
] }) : /* @__PURE__ */
|
|
1580
|
-
agentInsights.filter((i) => i.type === "celebration").length > 0 && /* @__PURE__ */
|
|
1581
|
-
/* @__PURE__ */
|
|
1733
|
+
/* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "AI" })
|
|
1734
|
+
] }) : /* @__PURE__ */ jsx8(Text7, { dimColor: true, children: "\u25CB AI off" }),
|
|
1735
|
+
agentInsights.filter((i) => i.type === "celebration").length > 0 && /* @__PURE__ */ jsxs7(Text7, { children: [
|
|
1736
|
+
/* @__PURE__ */ jsx8(Text7, { color: "green", children: "\u25CF" }),
|
|
1582
1737
|
" ",
|
|
1583
|
-
/* @__PURE__ */
|
|
1738
|
+
/* @__PURE__ */ jsxs7(Text7, { dimColor: true, children: [
|
|
1584
1739
|
agentInsights.filter((i) => i.type === "celebration").length,
|
|
1585
1740
|
" wins"
|
|
1586
1741
|
] })
|
|
@@ -1591,8 +1746,8 @@ function AgentView() {
|
|
|
1591
1746
|
|
|
1592
1747
|
// src/cli/dashboard/views/GoalsView.tsx
|
|
1593
1748
|
import { useCallback as useCallback2 } from "react";
|
|
1594
|
-
import { Box as
|
|
1595
|
-
import { Fragment as Fragment2, jsx as
|
|
1749
|
+
import { Box as Box8, Text as Text8, useInput as useInput4 } from "ink";
|
|
1750
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1596
1751
|
function calculateGoalProgress(goal) {
|
|
1597
1752
|
if (goal.target <= 0) return 0;
|
|
1598
1753
|
const startValue = goal.startValue ?? goal.currentValue;
|
|
@@ -1695,15 +1850,19 @@ function GoalsView() {
|
|
|
1695
1850
|
await agentState.load();
|
|
1696
1851
|
const achieved = goalsPanel.goals.filter((g) => g.status === "achieved");
|
|
1697
1852
|
if (achieved.length === 0) {
|
|
1853
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: "No achieved goals to clear", severity: "info", autoHideMs: 3e3 });
|
|
1698
1854
|
dispatch({ type: "ADD_ACTIVITY", message: "No achieved goals to clear" });
|
|
1699
1855
|
return;
|
|
1700
1856
|
}
|
|
1701
1857
|
for (const goal of achieved) {
|
|
1702
1858
|
await agentState.deleteGoal(goal.id);
|
|
1703
1859
|
}
|
|
1860
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Cleared ${achieved.length} achieved goal${achieved.length > 1 ? "s" : ""}`, severity: "info", autoHideMs: 3e3 });
|
|
1704
1861
|
dispatch({ type: "ADD_ACTIVITY", message: `Cleared ${achieved.length} achieved goal${achieved.length > 1 ? "s" : ""}` });
|
|
1705
1862
|
await refreshGoals();
|
|
1706
|
-
} catch {
|
|
1863
|
+
} catch (error) {
|
|
1864
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to clear goals: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 5e3 });
|
|
1865
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Clear failed: ${error instanceof Error ? error.message : "unknown"}` });
|
|
1707
1866
|
}
|
|
1708
1867
|
}, [dispatch, refreshGoals, goalsPanel.goals]);
|
|
1709
1868
|
const checkGoalNow = useCallback2(async (goalId) => {
|
|
@@ -1713,7 +1872,7 @@ function GoalsView() {
|
|
|
1713
1872
|
if (!goal) return;
|
|
1714
1873
|
dispatch({ type: "ADD_ACTIVITY", message: `Checking goal: ${goal.description.slice(0, 30)}...` });
|
|
1715
1874
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Scanning files for violations...`, severity: "info", autoHideMs: 3e3 });
|
|
1716
|
-
const { checkFilesForGoalViolations } = await import("./goal-validator-
|
|
1875
|
+
const { checkFilesForGoalViolations } = await import("./goal-validator-XYA364W3.js");
|
|
1717
1876
|
const violations = await checkFilesForGoalViolations([goal], workDir);
|
|
1718
1877
|
if (violations.length === 0) {
|
|
1719
1878
|
dispatch({ type: "SHOW_NOTIFICATION", message: `\u2713 No violations found for: ${goal.description.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -1775,26 +1934,26 @@ function GoalsView() {
|
|
|
1775
1934
|
if (recent[0]) void reactivateGoal(recent[0].id);
|
|
1776
1935
|
}
|
|
1777
1936
|
});
|
|
1778
|
-
return /* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
goalsPanel.inputMode === "add" ? /* @__PURE__ */
|
|
1781
|
-
/* @__PURE__ */
|
|
1937
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, children: [
|
|
1938
|
+
/* @__PURE__ */ jsx9(Text8, { bold: true, children: "Goals" }),
|
|
1939
|
+
goalsPanel.inputMode === "add" ? /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
1940
|
+
/* @__PURE__ */ jsx9(Box8, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1782
1941
|
goalsPanel.inputBuffer,
|
|
1783
|
-
/* @__PURE__ */
|
|
1942
|
+
/* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "|" })
|
|
1784
1943
|
] }) }),
|
|
1785
|
-
/* @__PURE__ */
|
|
1786
|
-
] }) : /* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
1945
|
+
] }) : /* @__PURE__ */ jsx9(Fragment2, { children: goalsPanel.goals.length === 0 ? /* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " No goals yet. Press a to add one." }) : /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", children: [
|
|
1787
1946
|
activeGoals.map((goal, idx) => {
|
|
1788
1947
|
const isSelected = goalsPanel.selectedIndex === idx;
|
|
1789
1948
|
const progress = calculateGoalProgress(goal);
|
|
1790
1949
|
const bar = progressBar(progress, 100, 8);
|
|
1791
1950
|
const source = goal.autoGenerated ? "auto" : "";
|
|
1792
|
-
return /* @__PURE__ */
|
|
1793
|
-
isSelected ? /* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1951
|
+
return /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1952
|
+
isSelected ? /* @__PURE__ */ jsx9(Text8, { bold: true, color: "green", children: "> " }) : " ",
|
|
1953
|
+
/* @__PURE__ */ jsx9(Text8, { color: "green", children: "\u25CB" }),
|
|
1795
1954
|
" ",
|
|
1796
1955
|
goal.description.slice(0, 45),
|
|
1797
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
|
|
1798
1957
|
" ",
|
|
1799
1958
|
bar,
|
|
1800
1959
|
" ",
|
|
@@ -1804,29 +1963,29 @@ function GoalsView() {
|
|
|
1804
1963
|
] })
|
|
1805
1964
|
] }, goal.id);
|
|
1806
1965
|
}),
|
|
1807
|
-
achievedGoals.length > 0 && /* @__PURE__ */
|
|
1808
|
-
/* @__PURE__ */
|
|
1809
|
-
achievedGoals.slice(0, 5).map((g) => /* @__PURE__ */
|
|
1966
|
+
achievedGoals.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
1967
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Achieved" }),
|
|
1968
|
+
achievedGoals.slice(0, 5).map((g) => /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1810
1969
|
" ",
|
|
1811
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ jsx9(Text8, { color: "green", children: "\u25CF" }),
|
|
1812
1971
|
" ",
|
|
1813
1972
|
g.description.slice(0, 50)
|
|
1814
1973
|
] }, g.id)),
|
|
1815
|
-
achievedGoals.length > 5 && /* @__PURE__ */
|
|
1974
|
+
achievedGoals.length > 5 && /* @__PURE__ */ jsxs8(Text8, { dimColor: true, children: [
|
|
1816
1975
|
" +",
|
|
1817
1976
|
achievedGoals.length - 5,
|
|
1818
1977
|
" more"
|
|
1819
1978
|
] })
|
|
1820
1979
|
] }),
|
|
1821
|
-
otherGoals.length > 0 && /* @__PURE__ */
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
otherGoals.slice(0, 2).map((g) => /* @__PURE__ */
|
|
1980
|
+
otherGoals.length > 0 && /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", marginTop: 1, children: [
|
|
1981
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: " Other" }),
|
|
1982
|
+
otherGoals.slice(0, 2).map((g) => /* @__PURE__ */ jsxs8(Text8, { children: [
|
|
1824
1983
|
" ",
|
|
1825
|
-
/* @__PURE__ */
|
|
1984
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: "\u25CB" }),
|
|
1826
1985
|
" ",
|
|
1827
1986
|
g.description.slice(0, 50),
|
|
1828
1987
|
" ",
|
|
1829
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ jsx9(Text8, { dimColor: true, children: g.status })
|
|
1830
1989
|
] }, g.id))
|
|
1831
1990
|
] })
|
|
1832
1991
|
] }) })
|
|
@@ -1835,8 +1994,8 @@ function GoalsView() {
|
|
|
1835
1994
|
|
|
1836
1995
|
// src/cli/dashboard/views/HypothesesView.tsx
|
|
1837
1996
|
import { useCallback as useCallback3 } from "react";
|
|
1838
|
-
import { Box as
|
|
1839
|
-
import { Fragment as Fragment3, jsx as
|
|
1997
|
+
import { Box as Box9, Text as Text9, useInput as useInput5 } from "ink";
|
|
1998
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1840
1999
|
function HypothesesView() {
|
|
1841
2000
|
const { state, dispatch } = useDashboard();
|
|
1842
2001
|
const { hypothesesPanel } = state;
|
|
@@ -1912,7 +2071,7 @@ function HypothesesView() {
|
|
|
1912
2071
|
if (!hypo) return;
|
|
1913
2072
|
dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement.slice(0, 30)}...` });
|
|
1914
2073
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
|
|
1915
|
-
const { gatherEvidenceForHypothesis } = await import("./hypothesis-
|
|
2074
|
+
const { gatherEvidenceForHypothesis } = await import("./hypothesis-QFGZ5ITT.js");
|
|
1916
2075
|
const evidence = await gatherEvidenceForHypothesis(hypoId, workDir);
|
|
1917
2076
|
if (evidence.length === 0) {
|
|
1918
2077
|
dispatch({ type: "SHOW_NOTIFICATION", message: `No evidence found for: ${hypo.statement.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -1965,24 +2124,24 @@ function HypothesesView() {
|
|
|
1965
2124
|
if (recent[0]) void reactivateHypothesis(recent[0].id);
|
|
1966
2125
|
}
|
|
1967
2126
|
});
|
|
1968
|
-
return /* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
hypothesesPanel.inputMode === "add" ? /* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
2127
|
+
return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 1, children: [
|
|
2128
|
+
/* @__PURE__ */ jsx10(Text9, { bold: true, children: "Hypotheses" }),
|
|
2129
|
+
hypothesesPanel.inputMode === "add" ? /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
2130
|
+
/* @__PURE__ */ jsx10(Box9, { borderStyle: "single", borderColor: "green", paddingX: 1, children: /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1972
2131
|
hypothesesPanel.inputBuffer,
|
|
1973
|
-
/* @__PURE__ */
|
|
2132
|
+
/* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "|" })
|
|
1974
2133
|
] }) }),
|
|
1975
|
-
/* @__PURE__ */
|
|
1976
|
-
] }) : /* @__PURE__ */
|
|
2134
|
+
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " enter save \xB7 esc cancel" })
|
|
2135
|
+
] }) : /* @__PURE__ */ jsx10(Fragment3, { children: hypothesesPanel.hypotheses.length === 0 ? /* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " No hypotheses yet. Press a to add one." }) : /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", children: [
|
|
1977
2136
|
testing.map((hypo, idx) => {
|
|
1978
2137
|
const isSelected = hypothesesPanel.selectedIndex === idx;
|
|
1979
2138
|
const conf = Math.round(hypo.confidence * 100);
|
|
1980
|
-
return /* @__PURE__ */
|
|
1981
|
-
isSelected ? /* @__PURE__ */
|
|
1982
|
-
/* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
2140
|
+
isSelected ? /* @__PURE__ */ jsx10(Text9, { bold: true, color: "green", children: "> " }) : " ",
|
|
2141
|
+
/* @__PURE__ */ jsx10(Text9, { color: "yellow", children: "\u25CB" }),
|
|
1983
2142
|
" ",
|
|
1984
2143
|
hypo.statement.slice(0, 50),
|
|
1985
|
-
/* @__PURE__ */
|
|
2144
|
+
/* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
1986
2145
|
" ",
|
|
1987
2146
|
conf,
|
|
1988
2147
|
"% \xB7 ",
|
|
@@ -1991,29 +2150,29 @@ function HypothesesView() {
|
|
|
1991
2150
|
] })
|
|
1992
2151
|
] }, hypo.id);
|
|
1993
2152
|
}),
|
|
1994
|
-
validated.length > 0 && /* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
validated.slice(0, 3).map((h) => /* @__PURE__ */
|
|
2153
|
+
validated.length > 0 && /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
2154
|
+
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " Validated" }),
|
|
2155
|
+
validated.slice(0, 3).map((h) => /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
1997
2156
|
" ",
|
|
1998
|
-
/* @__PURE__ */
|
|
2157
|
+
/* @__PURE__ */ jsx10(Text9, { color: "green", children: "\u25CF" }),
|
|
1999
2158
|
" ",
|
|
2000
2159
|
h.statement.slice(0, 50)
|
|
2001
2160
|
] }, h.id)),
|
|
2002
|
-
validated.length > 3 && /* @__PURE__ */
|
|
2161
|
+
validated.length > 3 && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2003
2162
|
" +",
|
|
2004
2163
|
validated.length - 3,
|
|
2005
2164
|
" more"
|
|
2006
2165
|
] })
|
|
2007
2166
|
] }),
|
|
2008
|
-
invalidated.length > 0 && /* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2010
|
-
invalidated.slice(0, 2).map((h) => /* @__PURE__ */
|
|
2167
|
+
invalidated.length > 0 && /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", marginTop: 1, children: [
|
|
2168
|
+
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: " Invalidated" }),
|
|
2169
|
+
invalidated.slice(0, 2).map((h) => /* @__PURE__ */ jsxs9(Text9, { children: [
|
|
2011
2170
|
" ",
|
|
2012
|
-
/* @__PURE__ */
|
|
2171
|
+
/* @__PURE__ */ jsx10(Text9, { color: "red", children: "\u25CF" }),
|
|
2013
2172
|
" ",
|
|
2014
|
-
/* @__PURE__ */
|
|
2173
|
+
/* @__PURE__ */ jsx10(Text9, { dimColor: true, children: h.statement.slice(0, 50) })
|
|
2015
2174
|
] }, h.id)),
|
|
2016
|
-
invalidated.length > 2 && /* @__PURE__ */
|
|
2175
|
+
invalidated.length > 2 && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2017
2176
|
" +",
|
|
2018
2177
|
invalidated.length - 2,
|
|
2019
2178
|
" more"
|
|
@@ -2025,8 +2184,8 @@ function HypothesesView() {
|
|
|
2025
2184
|
|
|
2026
2185
|
// src/cli/dashboard/views/MemoryTreeView.tsx
|
|
2027
2186
|
import { useEffect as useEffect2, useCallback as useCallback4 } from "react";
|
|
2028
|
-
import { Box as
|
|
2029
|
-
import { Fragment as Fragment4, jsx as
|
|
2187
|
+
import { Box as Box10, Text as Text10, useInput as useInput6 } from "ink";
|
|
2188
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2030
2189
|
function timeAgo2(iso) {
|
|
2031
2190
|
const ms = Date.now() - new Date(iso).getTime();
|
|
2032
2191
|
const mins = Math.floor(ms / 6e4);
|
|
@@ -2064,15 +2223,15 @@ function MemoryTreeView() {
|
|
|
2064
2223
|
});
|
|
2065
2224
|
const sel = (nodeId) => selectedNode === nodeId;
|
|
2066
2225
|
if (!loaded) {
|
|
2067
|
-
return /* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
2069
|
-
/* @__PURE__ */
|
|
2226
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 1, children: [
|
|
2227
|
+
/* @__PURE__ */ jsx11(Text10, { bold: true, children: "Ledger" }),
|
|
2228
|
+
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " Loading..." })
|
|
2070
2229
|
] });
|
|
2071
2230
|
}
|
|
2072
2231
|
if (!snapshot || snapshot.nodes.length === 0 && globalPatterns.length === 0) {
|
|
2073
|
-
return /* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2232
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 1, children: [
|
|
2233
|
+
/* @__PURE__ */ jsx11(Text10, { bold: true, children: "Ledger" }),
|
|
2234
|
+
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: " No entries yet. Use trie tell or trie watch to build memory." })
|
|
2076
2235
|
] });
|
|
2077
2236
|
}
|
|
2078
2237
|
const decisionNodes = snapshot.nodes.filter((n) => n.type === "decision") ?? [];
|
|
@@ -2087,47 +2246,47 @@ function MemoryTreeView() {
|
|
|
2087
2246
|
function renderHeader(id, label, count, emptyHint) {
|
|
2088
2247
|
const expanded = expandedNodes.has(id);
|
|
2089
2248
|
const isEmpty = count === 0;
|
|
2090
|
-
return /* @__PURE__ */
|
|
2091
|
-
sel(id) ? /* @__PURE__ */
|
|
2092
|
-
expanded && !isEmpty ? /* @__PURE__ */
|
|
2249
|
+
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2250
|
+
sel(id) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2251
|
+
expanded && !isEmpty ? /* @__PURE__ */ jsx11(Text10, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2093
2252
|
" ",
|
|
2094
|
-
sel(id) ? /* @__PURE__ */
|
|
2095
|
-
count > 0 ? /* @__PURE__ */
|
|
2253
|
+
sel(id) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: label }) : /* @__PURE__ */ jsx11(Text10, { bold: true, children: label }),
|
|
2254
|
+
count > 0 ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2096
2255
|
" (",
|
|
2097
2256
|
count,
|
|
2098
2257
|
")"
|
|
2099
|
-
] }) : isEmpty && emptyHint ? /* @__PURE__ */
|
|
2258
|
+
] }) : isEmpty && emptyHint ? /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2100
2259
|
" ",
|
|
2101
2260
|
emptyHint
|
|
2102
2261
|
] }) : null
|
|
2103
2262
|
] });
|
|
2104
2263
|
}
|
|
2105
|
-
return /* @__PURE__ */
|
|
2106
|
-
/* @__PURE__ */
|
|
2107
|
-
/* @__PURE__ */
|
|
2108
|
-
/* @__PURE__ */
|
|
2264
|
+
return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 1, children: [
|
|
2265
|
+
/* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2266
|
+
/* @__PURE__ */ jsx11(Text10, { bold: true, children: "Ledger" }),
|
|
2267
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2109
2268
|
" ",
|
|
2110
2269
|
totalEntries,
|
|
2111
2270
|
" entries"
|
|
2112
2271
|
] })
|
|
2113
2272
|
] }),
|
|
2114
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", marginTop: 1, children: [
|
|
2115
2274
|
renderHeader("decisions", "Decisions", decisionNodes.length, "-- use trie tell or chat"),
|
|
2116
2275
|
expandedNodes.has("decisions") && decisionNodes.slice(0, 10).map((n) => {
|
|
2117
2276
|
const nodeId = `decision-${n.id}`;
|
|
2118
2277
|
const dec = n.data.decision.length > 55 ? n.data.decision.slice(0, 52) + "..." : n.data.decision;
|
|
2119
2278
|
const outcomeColor = n.data.outcome === "good" ? "green" : n.data.outcome === "bad" ? "red" : void 0;
|
|
2120
|
-
return /* @__PURE__ */
|
|
2121
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2279
|
+
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2280
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2122
2281
|
" ",
|
|
2123
|
-
outcomeColor ? /* @__PURE__ */
|
|
2282
|
+
outcomeColor ? /* @__PURE__ */ jsx11(Text10, { color: outcomeColor, children: "\u25CF" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2124
2283
|
" ",
|
|
2125
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2126
|
-
/* @__PURE__ */
|
|
2284
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: dec }) : /* @__PURE__ */ jsx11(Text10, { children: dec }),
|
|
2285
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2127
2286
|
" ",
|
|
2128
2287
|
timeAgo2(n.data.timestamp)
|
|
2129
2288
|
] }),
|
|
2130
|
-
outcomeColor ? /* @__PURE__ */
|
|
2289
|
+
outcomeColor ? /* @__PURE__ */ jsxs10(Text10, { color: outcomeColor, children: [
|
|
2131
2290
|
" ",
|
|
2132
2291
|
n.data.outcome
|
|
2133
2292
|
] }) : null
|
|
@@ -2139,18 +2298,18 @@ function MemoryTreeView() {
|
|
|
2139
2298
|
const nodeId = `incident-${n.id}`;
|
|
2140
2299
|
const sevColor = n.data.severity === "critical" ? "red" : n.data.severity === "major" ? "yellow" : void 0;
|
|
2141
2300
|
const desc = n.data.description.length > 55 ? n.data.description.slice(0, 52) + "..." : n.data.description;
|
|
2142
|
-
return /* @__PURE__ */
|
|
2143
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2301
|
+
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2302
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2144
2303
|
" ",
|
|
2145
|
-
sevColor ? /* @__PURE__ */
|
|
2304
|
+
sevColor ? /* @__PURE__ */ jsx11(Text10, { color: sevColor, children: "\u25CF" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2146
2305
|
" ",
|
|
2147
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */
|
|
2306
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
|
|
2307
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2149
2308
|
" ",
|
|
2150
2309
|
timeAgo2(n.data.timestamp)
|
|
2151
2310
|
] }),
|
|
2152
2311
|
" ",
|
|
2153
|
-
n.data.resolved ? /* @__PURE__ */
|
|
2312
|
+
n.data.resolved ? /* @__PURE__ */ jsx11(Text10, { color: "green", children: "resolved" }) : /* @__PURE__ */ jsx11(Text10, { color: "yellow", children: "open" })
|
|
2154
2313
|
] }, n.id);
|
|
2155
2314
|
}),
|
|
2156
2315
|
renderHeader("patterns", "Learned Patterns", patternNodes.length, "-- Trie learns as you work"),
|
|
@@ -2159,17 +2318,17 @@ function MemoryTreeView() {
|
|
|
2159
2318
|
const conf = Math.round(n.data.confidence * 100);
|
|
2160
2319
|
const confColor = conf > 70 ? "green" : conf > 40 ? "yellow" : void 0;
|
|
2161
2320
|
const desc = n.data.description.length > 50 ? n.data.description.slice(0, 47) + "..." : n.data.description;
|
|
2162
|
-
return /* @__PURE__ */
|
|
2163
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2321
|
+
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2322
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2164
2323
|
" ",
|
|
2165
|
-
n.data.isAntiPattern ? /* @__PURE__ */
|
|
2324
|
+
n.data.isAntiPattern ? /* @__PURE__ */ jsx11(Text10, { color: "red", children: "!" }) : /* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2166
2325
|
" ",
|
|
2167
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2326
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
|
|
2168
2327
|
" ",
|
|
2169
|
-
confColor ? /* @__PURE__ */
|
|
2328
|
+
confColor ? /* @__PURE__ */ jsxs10(Text10, { color: confColor, children: [
|
|
2170
2329
|
conf,
|
|
2171
2330
|
"%"
|
|
2172
|
-
] }) : /* @__PURE__ */
|
|
2331
|
+
] }) : /* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2173
2332
|
conf,
|
|
2174
2333
|
"%"
|
|
2175
2334
|
] })
|
|
@@ -2179,13 +2338,13 @@ function MemoryTreeView() {
|
|
|
2179
2338
|
expandedNodes.has("cross-project") && globalPatterns.slice(0, 8).map((pattern) => {
|
|
2180
2339
|
const patternId = `global-${pattern.id}`;
|
|
2181
2340
|
const desc = pattern.pattern.length > 45 ? pattern.pattern.slice(0, 42) + "..." : pattern.pattern;
|
|
2182
|
-
return /* @__PURE__ */
|
|
2183
|
-
sel(patternId) ? /* @__PURE__ */
|
|
2341
|
+
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2342
|
+
sel(patternId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2184
2343
|
" ",
|
|
2185
|
-
/* @__PURE__ */
|
|
2344
|
+
/* @__PURE__ */ jsx11(Text10, { dimColor: true, children: "\u25CB" }),
|
|
2186
2345
|
" ",
|
|
2187
|
-
sel(patternId) ? /* @__PURE__ */
|
|
2188
|
-
/* @__PURE__ */
|
|
2346
|
+
sel(patternId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: desc }) : /* @__PURE__ */ jsx11(Text10, { children: desc }),
|
|
2347
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2189
2348
|
" ",
|
|
2190
2349
|
pattern.projects.length,
|
|
2191
2350
|
" projects \xB7 ",
|
|
@@ -2194,21 +2353,21 @@ function MemoryTreeView() {
|
|
|
2194
2353
|
] })
|
|
2195
2354
|
] }, pattern.id);
|
|
2196
2355
|
}),
|
|
2197
|
-
hotspots.length > 0 && /* @__PURE__ */
|
|
2356
|
+
hotspots.length > 0 && /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
2198
2357
|
renderHeader("hotspots", "Risk Hotspots", hotspots.length),
|
|
2199
2358
|
expandedNodes.has("hotspots") && hotspots.slice(0, 10).map((n) => {
|
|
2200
2359
|
const nodeId = `file-${n.id}`;
|
|
2201
2360
|
const path2 = n.data.path.split("/").slice(-2).join("/");
|
|
2202
2361
|
const isCritical = n.data.riskLevel === "critical";
|
|
2203
|
-
return /* @__PURE__ */
|
|
2204
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2362
|
+
return /* @__PURE__ */ jsxs10(Text10, { children: [
|
|
2363
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: "> " }) : " ",
|
|
2205
2364
|
" ",
|
|
2206
|
-
/* @__PURE__ */
|
|
2365
|
+
/* @__PURE__ */ jsx11(Text10, { color: isCritical ? "red" : "yellow", children: "\u25CF" }),
|
|
2207
2366
|
" ",
|
|
2208
|
-
sel(nodeId) ? /* @__PURE__ */
|
|
2367
|
+
sel(nodeId) ? /* @__PURE__ */ jsx11(Text10, { bold: true, color: "green", children: path2 }) : /* @__PURE__ */ jsx11(Text10, { children: path2 }),
|
|
2209
2368
|
" ",
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2369
|
+
/* @__PURE__ */ jsx11(Text10, { color: isCritical ? "red" : "yellow", children: n.data.riskLevel }),
|
|
2370
|
+
/* @__PURE__ */ jsxs10(Text10, { dimColor: true, children: [
|
|
2212
2371
|
" ",
|
|
2213
2372
|
n.data.changeCount,
|
|
2214
2373
|
" changes"
|
|
@@ -2220,8 +2379,8 @@ function MemoryTreeView() {
|
|
|
2220
2379
|
}
|
|
2221
2380
|
|
|
2222
2381
|
// src/cli/dashboard/views/RawLogView.tsx
|
|
2223
|
-
import { Box as
|
|
2224
|
-
import { jsx as
|
|
2382
|
+
import { Box as Box11, Text as Text11, useInput as useInput7 } from "ink";
|
|
2383
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2225
2384
|
function RawLogView() {
|
|
2226
2385
|
const { state, dispatch } = useDashboard();
|
|
2227
2386
|
const { rawLog, rawLogPage } = state;
|
|
@@ -2233,10 +2392,10 @@ function RawLogView() {
|
|
|
2233
2392
|
});
|
|
2234
2393
|
const startIdx = rawLogPage * pageSize;
|
|
2235
2394
|
const logs = rawLog.slice(startIdx, startIdx + pageSize);
|
|
2236
|
-
return /* @__PURE__ */
|
|
2237
|
-
/* @__PURE__ */
|
|
2238
|
-
/* @__PURE__ */
|
|
2239
|
-
/* @__PURE__ */
|
|
2395
|
+
return /* @__PURE__ */ jsxs11(Box11, { flexDirection: "column", paddingX: 1, children: [
|
|
2396
|
+
/* @__PURE__ */ jsxs11(Text11, { children: [
|
|
2397
|
+
/* @__PURE__ */ jsx12(Text11, { bold: true, children: "Log" }),
|
|
2398
|
+
/* @__PURE__ */ jsxs11(Text11, { dimColor: true, children: [
|
|
2240
2399
|
" ",
|
|
2241
2400
|
rawLog.length,
|
|
2242
2401
|
" entries \xB7 page ",
|
|
@@ -2245,11 +2404,11 @@ function RawLogView() {
|
|
|
2245
2404
|
totalPages
|
|
2246
2405
|
] })
|
|
2247
2406
|
] }),
|
|
2248
|
-
rawLog.length === 0 ? /* @__PURE__ */
|
|
2249
|
-
const dot = entry.level === "error" ? /* @__PURE__ */
|
|
2250
|
-
return /* @__PURE__ */
|
|
2407
|
+
rawLog.length === 0 ? /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: " No log entries yet" }) : logs.map((entry, i) => {
|
|
2408
|
+
const dot = entry.level === "error" ? /* @__PURE__ */ jsx12(Text11, { color: "red", children: "\u25CF" }) : entry.level === "warn" ? /* @__PURE__ */ jsx12(Text11, { color: "yellow", children: "\u25CF" }) : entry.level === "info" ? /* @__PURE__ */ jsx12(Text11, { color: "green", children: "\u25CF" }) : /* @__PURE__ */ jsx12(Text11, { dimColor: true, children: "\u25CB" });
|
|
2409
|
+
return /* @__PURE__ */ jsxs11(Text11, { children: [
|
|
2251
2410
|
" ",
|
|
2252
|
-
/* @__PURE__ */
|
|
2411
|
+
/* @__PURE__ */ jsx12(Text11, { dimColor: true, children: entry.time }),
|
|
2253
2412
|
" ",
|
|
2254
2413
|
dot,
|
|
2255
2414
|
" ",
|
|
@@ -2260,8 +2419,8 @@ function RawLogView() {
|
|
|
2260
2419
|
}
|
|
2261
2420
|
|
|
2262
2421
|
// src/cli/dashboard/views/ChatView.tsx
|
|
2263
|
-
import { useCallback as useCallback5, useRef } from "react";
|
|
2264
|
-
import { Box as
|
|
2422
|
+
import { useCallback as useCallback5, useRef, useEffect as useEffect3 } from "react";
|
|
2423
|
+
import { Box as Box12, Text as Text12, useInput as useInput8 } from "ink";
|
|
2265
2424
|
|
|
2266
2425
|
// src/tools/tell.ts
|
|
2267
2426
|
import path from "path";
|
|
@@ -4791,7 +4950,7 @@ var CHAT_TOOLS = [
|
|
|
4791
4950
|
},
|
|
4792
4951
|
{
|
|
4793
4952
|
name: "trie_search_files",
|
|
4794
|
-
description: "Search source code files for text patterns
|
|
4953
|
+
description: "Search source code files for text patterns using ripgrep. Note: Requires ripgrep to be installed. For emoji detection, use trie_scan_for_goal_violations instead.",
|
|
4795
4954
|
input_schema: {
|
|
4796
4955
|
type: "object",
|
|
4797
4956
|
properties: {
|
|
@@ -4810,6 +4969,19 @@ var CHAT_TOOLS = [
|
|
|
4810
4969
|
},
|
|
4811
4970
|
required: ["pattern"]
|
|
4812
4971
|
}
|
|
4972
|
+
},
|
|
4973
|
+
{
|
|
4974
|
+
name: "trie_scan_for_goal_violations",
|
|
4975
|
+
description: "Run an AI-powered scan to check for goal violations across the codebase. This is the most reliable way to detect issues like emojis, as it uses AI analysis rather than pattern matching.",
|
|
4976
|
+
input_schema: {
|
|
4977
|
+
type: "object",
|
|
4978
|
+
properties: {
|
|
4979
|
+
goalId: {
|
|
4980
|
+
type: "string",
|
|
4981
|
+
description: "Optional: Specific goal ID to check. If omitted, checks all active goals."
|
|
4982
|
+
}
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
4813
4985
|
}
|
|
4814
4986
|
];
|
|
4815
4987
|
async function executeTool(name, input) {
|
|
@@ -5031,7 +5203,7 @@ Type "yes" to proceed, or "no" to cancel.
|
|
|
5031
5203
|
return `Error: ripgrep (rg) not found. Please install it:
|
|
5032
5204
|
brew install ripgrep (macOS)
|
|
5033
5205
|
apt install ripgrep (Ubuntu)
|
|
5034
|
-
Or
|
|
5206
|
+
Or use trie_scan_for_goal_violations for AI-powered analysis instead.`;
|
|
5035
5207
|
}
|
|
5036
5208
|
return `Search failed: ${result.error.message}`;
|
|
5037
5209
|
}
|
|
@@ -5054,13 +5226,63 @@ ${truncated}`;
|
|
|
5054
5226
|
return `Search failed: ${error.message}`;
|
|
5055
5227
|
}
|
|
5056
5228
|
}
|
|
5229
|
+
case "trie_scan_for_goal_violations": {
|
|
5230
|
+
const goalId = input.goalId ? String(input.goalId).trim() : void 0;
|
|
5231
|
+
try {
|
|
5232
|
+
const { checkFilesForGoalViolations, getActiveGoals } = await import("./goal-validator-XYA364W3.js");
|
|
5233
|
+
const agentState = getGuardianState(directory);
|
|
5234
|
+
await agentState.load();
|
|
5235
|
+
const allGoals = await getActiveGoals(directory);
|
|
5236
|
+
const goalsToCheck = goalId ? allGoals.filter((g) => g.id === goalId) : allGoals;
|
|
5237
|
+
if (goalsToCheck.length === 0) {
|
|
5238
|
+
return goalId ? `No active goal found with ID: ${goalId}` : "No active goals to check. Add goals in the Goals view first.";
|
|
5239
|
+
}
|
|
5240
|
+
const violations = await checkFilesForGoalViolations(directory);
|
|
5241
|
+
if (violations.length === 0) {
|
|
5242
|
+
return `\u2713 Scan complete! No violations found for ${goalsToCheck.length} goal(s).`;
|
|
5243
|
+
}
|
|
5244
|
+
const violationsByGoal = /* @__PURE__ */ new Map();
|
|
5245
|
+
for (const v of violations) {
|
|
5246
|
+
const existing = violationsByGoal.get(v.goalId) || [];
|
|
5247
|
+
existing.push(v);
|
|
5248
|
+
violationsByGoal.set(v.goalId, existing);
|
|
5249
|
+
}
|
|
5250
|
+
let result = `Found ${violations.length} violation(s) across ${violationsByGoal.size} goal(s):
|
|
5251
|
+
|
|
5252
|
+
`;
|
|
5253
|
+
for (const [goalId2, goalViolations] of violationsByGoal.entries()) {
|
|
5254
|
+
const goal = goalsToCheck.find((g) => g.id === goalId2);
|
|
5255
|
+
result += `\u{1F3AF} Goal: ${goal?.description || goalId2}
|
|
5256
|
+
`;
|
|
5257
|
+
result += ` ${goalViolations.length} violation(s):
|
|
5258
|
+
`;
|
|
5259
|
+
for (const v of goalViolations.slice(0, 10)) {
|
|
5260
|
+
result += ` - ${v.file}
|
|
5261
|
+
`;
|
|
5262
|
+
if (v.description) {
|
|
5263
|
+
result += ` ${v.description}
|
|
5264
|
+
`;
|
|
5265
|
+
}
|
|
5266
|
+
}
|
|
5267
|
+
if (goalViolations.length > 10) {
|
|
5268
|
+
result += ` ... and ${goalViolations.length - 10} more
|
|
5269
|
+
`;
|
|
5270
|
+
}
|
|
5271
|
+
result += "\n";
|
|
5272
|
+
}
|
|
5273
|
+
result += "These violations have been recorded and will appear in the Goals view.";
|
|
5274
|
+
return result;
|
|
5275
|
+
} catch (error) {
|
|
5276
|
+
return `Scan failed: ${error.message}`;
|
|
5277
|
+
}
|
|
5278
|
+
}
|
|
5057
5279
|
default:
|
|
5058
5280
|
return `Unknown tool: ${name}`;
|
|
5059
5281
|
}
|
|
5060
5282
|
}
|
|
5061
5283
|
|
|
5062
5284
|
// src/cli/dashboard/views/ChatView.tsx
|
|
5063
|
-
import { jsx as
|
|
5285
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5064
5286
|
async function buildContext(workDir, dashboardState) {
|
|
5065
5287
|
const parts = [];
|
|
5066
5288
|
if (dashboardState?.agentInsights) {
|
|
@@ -5161,20 +5383,20 @@ var SYSTEM_PROMPT = `You are Trie, a code guardian assistant embedded in a termi
|
|
|
5161
5383
|
- Query stored decisions, blockers, facts, and questions from the decision ledger
|
|
5162
5384
|
- Create and manage goals and hypotheses
|
|
5163
5385
|
- Propose fixes for goal violations (requires user confirmation before spawning Claude Code)
|
|
5386
|
+
- Run AI-powered scans to detect goal violations across the entire codebase
|
|
5164
5387
|
- Save work checkpoints
|
|
5165
5388
|
|
|
5166
|
-
**IMPORTANT -
|
|
5167
|
-
- You have a
|
|
5168
|
-
-
|
|
5169
|
-
-
|
|
5170
|
-
-
|
|
5171
|
-
- Instead, suggest the user press 'r' in Goals view to run an AI-powered scan
|
|
5389
|
+
**IMPORTANT - Finding Code Issues:**
|
|
5390
|
+
- You have a trie_scan_for_goal_violations tool - use this to scan the codebase for goal violations
|
|
5391
|
+
- This is the BEST way to find emojis, TODOs, or other patterns that violate goals
|
|
5392
|
+
- It uses AI analysis and is much more reliable than regex pattern matching
|
|
5393
|
+
- You also have trie_search_files but it requires ripgrep (often not installed)
|
|
5172
5394
|
|
|
5173
|
-
**When user asks about code content:**
|
|
5395
|
+
**When user asks about code content (emojis, TODOs, etc.):**
|
|
5174
5396
|
1. First check the "Recent goal violations (nudges)" section in project context
|
|
5175
5397
|
2. If found, report what you see
|
|
5176
|
-
3. If not found
|
|
5177
|
-
4.
|
|
5398
|
+
3. If not found or user wants a full scan: Call trie_scan_for_goal_violations
|
|
5399
|
+
4. The scan will find all violations and update the Goals view automatically
|
|
5178
5400
|
|
|
5179
5401
|
**When user asks to fix violations:**
|
|
5180
5402
|
1. Look in "Recent goal violations (nudges)" section of project context
|
|
@@ -5183,16 +5405,39 @@ var SYSTEM_PROMPT = `You are Trie, a code guardian assistant embedded in a termi
|
|
|
5183
5405
|
4. Do NOT assume the user wants to proceed - always get confirmation first
|
|
5184
5406
|
|
|
5185
5407
|
Examples:
|
|
5186
|
-
- User: "do we have emojis?" \u2192 Check nudges first. If none
|
|
5408
|
+
- User: "do we have emojis?" \u2192 Check nudges first. If none or unclear: Call trie_scan_for_goal_violations to scan the codebase.
|
|
5409
|
+
- User: "run a full scan for emojis" \u2192 Call trie_scan_for_goal_violations directly.
|
|
5187
5410
|
- User: "fix the emoji violation" \u2192 Find emoji violation in nudges, call trie_propose_fix (will ask user to confirm)
|
|
5188
|
-
- User: "search for TODO comments" \u2192
|
|
5411
|
+
- User: "search for TODO comments" \u2192 If there's a goal about TODOs, use trie_scan_for_goal_violations. Otherwise explain no such goal exists.
|
|
5189
5412
|
|
|
5190
5413
|
Answer concisely. Reference specific files, decisions, and patterns when relevant.`;
|
|
5191
5414
|
function ChatView() {
|
|
5192
5415
|
const { state, dispatch } = useDashboard();
|
|
5193
5416
|
const { chatState } = state;
|
|
5194
|
-
const { messages, inputBuffer, loading } = chatState;
|
|
5417
|
+
const { messages, inputBuffer, loading, currentSessionId, currentSessionTitle } = chatState;
|
|
5195
5418
|
const loadingRef = useRef(false);
|
|
5419
|
+
useEffect3(() => {
|
|
5420
|
+
if (messages.length === 0) return;
|
|
5421
|
+
const saveChat = async () => {
|
|
5422
|
+
try {
|
|
5423
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5424
|
+
const { getChatStore: getChatStore2 } = await import("./chat-store-R46BCMBW.js");
|
|
5425
|
+
const store = getChatStore2(workDir);
|
|
5426
|
+
const sessionId = await store.saveSession(
|
|
5427
|
+
messages,
|
|
5428
|
+
currentSessionId || void 0,
|
|
5429
|
+
currentSessionTitle || void 0
|
|
5430
|
+
);
|
|
5431
|
+
if (!currentSessionId) {
|
|
5432
|
+
dispatch({ type: "SET_CHAT_SESSION", sessionId, title: null });
|
|
5433
|
+
}
|
|
5434
|
+
} catch (error) {
|
|
5435
|
+
console.error("Failed to auto-save chat:", error);
|
|
5436
|
+
}
|
|
5437
|
+
};
|
|
5438
|
+
const timeout = setTimeout(() => void saveChat(), 2e3);
|
|
5439
|
+
return () => clearTimeout(timeout);
|
|
5440
|
+
}, [messages, currentSessionId, currentSessionTitle, dispatch]);
|
|
5196
5441
|
const sendMessage = useCallback5(async (question) => {
|
|
5197
5442
|
if (loadingRef.current) return;
|
|
5198
5443
|
loadingRef.current = true;
|
|
@@ -5201,22 +5446,22 @@ function ChatView() {
|
|
|
5201
5446
|
dispatch({ type: "SET_CHAT_LOADING", loading: true });
|
|
5202
5447
|
try {
|
|
5203
5448
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5204
|
-
const
|
|
5205
|
-
if (
|
|
5449
|
+
const lastAssistantMessage = messages.filter((m) => m.role === "assistant").pop();
|
|
5450
|
+
if (lastAssistantMessage?.pendingFix) {
|
|
5206
5451
|
const response = question.trim().toLowerCase();
|
|
5207
5452
|
if (response === "yes" || response === "y") {
|
|
5208
5453
|
const { spawnClaudeCodeFix } = await import("./terminal-spawn-2GU5KLPS.js");
|
|
5209
5454
|
try {
|
|
5210
|
-
await spawnClaudeCodeFix(
|
|
5455
|
+
await spawnClaudeCodeFix(lastAssistantMessage.pendingFix);
|
|
5211
5456
|
dispatch({
|
|
5212
5457
|
type: "ADD_CHAT_MESSAGE",
|
|
5213
5458
|
role: "assistant",
|
|
5214
|
-
content: `\u2713 Spawned Claude Code in a new terminal to fix "${
|
|
5459
|
+
content: `\u2713 Spawned Claude Code in a new terminal to fix "${lastAssistantMessage.pendingFix.file}".
|
|
5215
5460
|
|
|
5216
5461
|
Claude Code will:
|
|
5217
5462
|
1. Review the file
|
|
5218
|
-
2. Understand the goal: "${
|
|
5219
|
-
3. Fix the violation: "${
|
|
5463
|
+
2. Understand the goal: "${lastAssistantMessage.pendingFix.goal}"
|
|
5464
|
+
3. Fix the violation: "${lastAssistantMessage.pendingFix.violation}"
|
|
5220
5465
|
4. Preserve all functionality
|
|
5221
5466
|
|
|
5222
5467
|
Check the new terminal window to see the fix in progress.`
|
|
@@ -5340,24 +5585,31 @@ ${contextBlock}`;
|
|
|
5340
5585
|
}
|
|
5341
5586
|
});
|
|
5342
5587
|
if (!isAIAvailable()) {
|
|
5343
|
-
return /* @__PURE__ */
|
|
5344
|
-
/* @__PURE__ */
|
|
5345
|
-
/* @__PURE__ */
|
|
5588
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 1, children: [
|
|
5589
|
+
/* @__PURE__ */ jsx13(Text12, { bold: true, children: "Chat" }),
|
|
5590
|
+
/* @__PURE__ */ jsx13(Text12, { dimColor: true, children: " AI is not available. Press s to open settings and add your Anthropic API key." })
|
|
5346
5591
|
] });
|
|
5347
5592
|
}
|
|
5348
|
-
return /* @__PURE__ */
|
|
5349
|
-
/* @__PURE__ */
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5593
|
+
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 1, flexGrow: 1, children: [
|
|
5594
|
+
/* @__PURE__ */ jsxs12(Text12, { children: [
|
|
5595
|
+
/* @__PURE__ */ jsx13(Text12, { bold: true, children: "Chat" }),
|
|
5596
|
+
currentSessionTitle && /* @__PURE__ */ jsxs12(Text12, { dimColor: true, children: [
|
|
5597
|
+
" ",
|
|
5598
|
+
currentSessionTitle
|
|
5599
|
+
] }),
|
|
5600
|
+
/* @__PURE__ */ jsx13(Text12, { dimColor: true, children: " (h for history)" })
|
|
5601
|
+
] }),
|
|
5602
|
+
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", flexGrow: 1, overflow: "hidden", marginTop: 1, children: [
|
|
5603
|
+
messages.length === 0 && !loading && /* @__PURE__ */ jsx13(Text12, { dimColor: true, children: " Ask about your codebase, decisions, patterns, or risks." }),
|
|
5604
|
+
messages.map((msg, idx) => /* @__PURE__ */ jsx13(Box12, { flexDirection: "column", marginTop: idx === 0 ? 0 : 1, marginBottom: 1, children: msg.role === "user" ? /* @__PURE__ */ jsxs12(Text12, { children: [
|
|
5353
5605
|
" ",
|
|
5354
|
-
/* @__PURE__ */
|
|
5606
|
+
/* @__PURE__ */ jsx13(Text12, { bold: true, color: "green", children: "You:" }),
|
|
5355
5607
|
" ",
|
|
5356
5608
|
msg.content
|
|
5357
|
-
] }) : /* @__PURE__ */
|
|
5358
|
-
msg.toolCalls && msg.toolCalls.length > 0 && msg.toolCalls.map((tc, ti) => /* @__PURE__ */
|
|
5609
|
+
] }) : /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", children: [
|
|
5610
|
+
msg.toolCalls && msg.toolCalls.length > 0 && msg.toolCalls.map((tc, ti) => /* @__PURE__ */ jsxs12(Text12, { dimColor: true, children: [
|
|
5359
5611
|
" ",
|
|
5360
|
-
/* @__PURE__ */
|
|
5612
|
+
/* @__PURE__ */ jsxs12(Text12, { color: "yellow", children: [
|
|
5361
5613
|
"[",
|
|
5362
5614
|
tc.name,
|
|
5363
5615
|
"]"
|
|
@@ -5365,16 +5617,16 @@ ${contextBlock}`;
|
|
|
5365
5617
|
" ",
|
|
5366
5618
|
formatToolInput(tc.input)
|
|
5367
5619
|
] }, ti)),
|
|
5368
|
-
msg.content.split("\n").map((line, li) => /* @__PURE__ */
|
|
5620
|
+
msg.content.split("\n").map((line, li) => /* @__PURE__ */ jsxs12(Text12, { children: [
|
|
5369
5621
|
li === 0 ? " Trie: " : " ",
|
|
5370
5622
|
line
|
|
5371
5623
|
] }, li))
|
|
5372
5624
|
] }) }, idx)),
|
|
5373
|
-
loading && /* @__PURE__ */
|
|
5625
|
+
loading && /* @__PURE__ */ jsx13(Text12, { dimColor: true, children: " Thinking..." })
|
|
5374
5626
|
] }),
|
|
5375
|
-
/* @__PURE__ */
|
|
5376
|
-
inputBuffer || /* @__PURE__ */
|
|
5377
|
-
/* @__PURE__ */
|
|
5627
|
+
/* @__PURE__ */ jsx13(Box12, { borderStyle: "single", borderColor: "green", paddingX: 1, flexShrink: 0, children: /* @__PURE__ */ jsxs12(Text12, { children: [
|
|
5628
|
+
inputBuffer || /* @__PURE__ */ jsx13(Text12, { dimColor: true, children: "Ask a question..." }),
|
|
5629
|
+
/* @__PURE__ */ jsx13(Text12, { bold: true, color: "green", children: "|" })
|
|
5378
5630
|
] }) })
|
|
5379
5631
|
] });
|
|
5380
5632
|
}
|
|
@@ -5388,8 +5640,219 @@ function formatToolInput(input) {
|
|
|
5388
5640
|
return parts.length > 0 ? parts.join(", ") : "";
|
|
5389
5641
|
}
|
|
5390
5642
|
|
|
5643
|
+
// src/cli/dashboard/views/ChatArchiveView.tsx
|
|
5644
|
+
import { useEffect as useEffect4, useCallback as useCallback6 } from "react";
|
|
5645
|
+
import { Box as Box13, Text as Text13, useInput as useInput9 } from "ink";
|
|
5646
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5647
|
+
function formatTimeAgo2(timestamp) {
|
|
5648
|
+
const seconds = Math.floor((Date.now() - timestamp) / 1e3);
|
|
5649
|
+
if (seconds < 60) return `${seconds}s ago`;
|
|
5650
|
+
const minutes = Math.floor(seconds / 60);
|
|
5651
|
+
if (minutes < 60) return `${minutes}m ago`;
|
|
5652
|
+
const hours = Math.floor(minutes / 60);
|
|
5653
|
+
if (hours < 24) return `${hours}h ago`;
|
|
5654
|
+
const days = Math.floor(hours / 24);
|
|
5655
|
+
if (days < 30) return `${days}d ago`;
|
|
5656
|
+
const months = Math.floor(days / 30);
|
|
5657
|
+
if (months < 12) return `${months}mo ago`;
|
|
5658
|
+
return `${Math.floor(months / 12)}y ago`;
|
|
5659
|
+
}
|
|
5660
|
+
function ChatArchiveView() {
|
|
5661
|
+
const { state, dispatch } = useDashboard();
|
|
5662
|
+
const { chatArchivePanel } = state;
|
|
5663
|
+
const { sessions, selectedIndex, showArchived, loading, inputMode, inputBuffer } = chatArchivePanel;
|
|
5664
|
+
const loadSessions = useCallback6(async () => {
|
|
5665
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_LOADING", loading: true });
|
|
5666
|
+
try {
|
|
5667
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5668
|
+
const store = getChatStore(workDir);
|
|
5669
|
+
const sessionsList = await store.listSessions(showArchived);
|
|
5670
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_SESSIONS", sessions: sessionsList });
|
|
5671
|
+
} catch (error) {
|
|
5672
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Failed to load chat sessions: ${error instanceof Error ? error.message : "unknown"}` });
|
|
5673
|
+
}
|
|
5674
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_LOADING", loading: false });
|
|
5675
|
+
}, [showArchived, dispatch]);
|
|
5676
|
+
useEffect4(() => {
|
|
5677
|
+
void loadSessions();
|
|
5678
|
+
}, [loadSessions]);
|
|
5679
|
+
const loadChatSession = useCallback6(async (sessionId) => {
|
|
5680
|
+
try {
|
|
5681
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5682
|
+
const store = getChatStore(workDir);
|
|
5683
|
+
const session = await store.loadSession(sessionId);
|
|
5684
|
+
if (session) {
|
|
5685
|
+
dispatch({ type: "LOAD_CHAT_MESSAGES", messages: session.messages });
|
|
5686
|
+
dispatch({ type: "SET_CHAT_SESSION", sessionId: session.id, title: session.title });
|
|
5687
|
+
dispatch({ type: "SET_VIEW", view: "chat" });
|
|
5688
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Loaded chat: ${session.title}` });
|
|
5689
|
+
} else {
|
|
5690
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: "Chat session not found", severity: "warning", autoHideMs: 3e3 });
|
|
5691
|
+
}
|
|
5692
|
+
} catch (error) {
|
|
5693
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to load chat: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 3e3 });
|
|
5694
|
+
}
|
|
5695
|
+
}, [dispatch]);
|
|
5696
|
+
const deleteSession = useCallback6(async () => {
|
|
5697
|
+
if (sessions.length === 0) return;
|
|
5698
|
+
const session = sessions[selectedIndex];
|
|
5699
|
+
if (!session) return;
|
|
5700
|
+
try {
|
|
5701
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5702
|
+
const store = getChatStore(workDir);
|
|
5703
|
+
await store.deleteSession(session.id);
|
|
5704
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Deleted chat: ${session.title}` });
|
|
5705
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: "Chat deleted", severity: "info", autoHideMs: 2e3 });
|
|
5706
|
+
await loadSessions();
|
|
5707
|
+
} catch (error) {
|
|
5708
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to delete: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 3e3 });
|
|
5709
|
+
}
|
|
5710
|
+
}, [sessions, selectedIndex, dispatch, loadSessions]);
|
|
5711
|
+
const archiveSession = useCallback6(async () => {
|
|
5712
|
+
if (sessions.length === 0) return;
|
|
5713
|
+
const session = sessions[selectedIndex];
|
|
5714
|
+
if (!session) return;
|
|
5715
|
+
try {
|
|
5716
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5717
|
+
const store = getChatStore(workDir);
|
|
5718
|
+
await store.archiveSession(session.id);
|
|
5719
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Archived chat: ${session.title}` });
|
|
5720
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: "Chat archived", severity: "info", autoHideMs: 2e3 });
|
|
5721
|
+
await loadSessions();
|
|
5722
|
+
} catch (error) {
|
|
5723
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to archive: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 3e3 });
|
|
5724
|
+
}
|
|
5725
|
+
}, [sessions, selectedIndex, dispatch, loadSessions]);
|
|
5726
|
+
const renameSession = useCallback6(async (newTitle) => {
|
|
5727
|
+
if (sessions.length === 0 || !newTitle.trim()) return;
|
|
5728
|
+
const session = sessions[selectedIndex];
|
|
5729
|
+
if (!session) return;
|
|
5730
|
+
try {
|
|
5731
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5732
|
+
const store = getChatStore(workDir);
|
|
5733
|
+
await store.renameSession(session.id, newTitle.trim());
|
|
5734
|
+
dispatch({ type: "ADD_ACTIVITY", message: `Renamed chat to: ${newTitle}` });
|
|
5735
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: "Chat renamed", severity: "info", autoHideMs: 2e3 });
|
|
5736
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_INPUT_MODE", mode: "browse" });
|
|
5737
|
+
await loadSessions();
|
|
5738
|
+
} catch (error) {
|
|
5739
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to rename: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 3e3 });
|
|
5740
|
+
}
|
|
5741
|
+
}, [sessions, selectedIndex, dispatch, loadSessions]);
|
|
5742
|
+
const exportSession = useCallback6(async () => {
|
|
5743
|
+
if (sessions.length === 0) return;
|
|
5744
|
+
const session = sessions[selectedIndex];
|
|
5745
|
+
if (!session) return;
|
|
5746
|
+
try {
|
|
5747
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
5748
|
+
const store = getChatStore(workDir);
|
|
5749
|
+
const exported = await store.exportSession(session.id);
|
|
5750
|
+
if (exported) {
|
|
5751
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: "Chat exported (check logs for JSON)", severity: "info", autoHideMs: 3e3 });
|
|
5752
|
+
console.log("=== EXPORTED CHAT ===");
|
|
5753
|
+
console.log(exported);
|
|
5754
|
+
console.log("=== END EXPORT ===");
|
|
5755
|
+
}
|
|
5756
|
+
} catch (error) {
|
|
5757
|
+
dispatch({ type: "SHOW_NOTIFICATION", message: `Failed to export: ${error instanceof Error ? error.message : "unknown"}`, severity: "warning", autoHideMs: 3e3 });
|
|
5758
|
+
}
|
|
5759
|
+
}, [sessions, selectedIndex, dispatch]);
|
|
5760
|
+
useInput9((input, key) => {
|
|
5761
|
+
if (inputMode === "rename") {
|
|
5762
|
+
if (key.return) {
|
|
5763
|
+
void renameSession(inputBuffer);
|
|
5764
|
+
} else if (key.escape) {
|
|
5765
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_INPUT_MODE", mode: "browse" });
|
|
5766
|
+
} else if (key.backspace || key.delete) {
|
|
5767
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_INPUT_BUFFER", buffer: inputBuffer.slice(0, -1) });
|
|
5768
|
+
} else if (input && !key.ctrl && !key.meta) {
|
|
5769
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_INPUT_BUFFER", buffer: inputBuffer + input });
|
|
5770
|
+
}
|
|
5771
|
+
return;
|
|
5772
|
+
}
|
|
5773
|
+
if (key.upArrow || input === "k") {
|
|
5774
|
+
const newIndex = Math.max(0, selectedIndex - 1);
|
|
5775
|
+
dispatch({ type: "SELECT_CHAT_SESSION", index: newIndex });
|
|
5776
|
+
} else if (key.downArrow || input === "j") {
|
|
5777
|
+
const newIndex = Math.min(sessions.length - 1, selectedIndex + 1);
|
|
5778
|
+
dispatch({ type: "SELECT_CHAT_SESSION", index: newIndex });
|
|
5779
|
+
} else if (key.return) {
|
|
5780
|
+
if (sessions[selectedIndex]) {
|
|
5781
|
+
void loadChatSession(sessions[selectedIndex].id);
|
|
5782
|
+
}
|
|
5783
|
+
} else if (input === "d") {
|
|
5784
|
+
void deleteSession();
|
|
5785
|
+
} else if (input === "a") {
|
|
5786
|
+
void archiveSession();
|
|
5787
|
+
} else if (input === "r") {
|
|
5788
|
+
dispatch({ type: "SET_CHAT_ARCHIVE_INPUT_MODE", mode: "rename" });
|
|
5789
|
+
} else if (input === "e") {
|
|
5790
|
+
void exportSession();
|
|
5791
|
+
} else if (input === "t") {
|
|
5792
|
+
dispatch({ type: "TOGGLE_ARCHIVED_CHATS" });
|
|
5793
|
+
} else if (input === "n") {
|
|
5794
|
+
dispatch({ type: "CLEAR_CHAT" });
|
|
5795
|
+
dispatch({ type: "SET_VIEW", view: "chat" });
|
|
5796
|
+
}
|
|
5797
|
+
});
|
|
5798
|
+
if (loading) {
|
|
5799
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 1, children: [
|
|
5800
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "Chat Archive" }),
|
|
5801
|
+
/* @__PURE__ */ jsx14(Text13, { dimColor: true, children: " Loading..." })
|
|
5802
|
+
] });
|
|
5803
|
+
}
|
|
5804
|
+
if (sessions.length === 0) {
|
|
5805
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 1, children: [
|
|
5806
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "Chat Archive" }),
|
|
5807
|
+
/* @__PURE__ */ jsxs13(Text13, { dimColor: true, children: [
|
|
5808
|
+
" ",
|
|
5809
|
+
showArchived ? "No archived chats" : "No chat history yet"
|
|
5810
|
+
] }),
|
|
5811
|
+
/* @__PURE__ */ jsx14(Text13, { dimColor: true, children: " Press n to start a new chat" })
|
|
5812
|
+
] });
|
|
5813
|
+
}
|
|
5814
|
+
if (inputMode === "rename") {
|
|
5815
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 1, children: [
|
|
5816
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "Rename Chat" }),
|
|
5817
|
+
/* @__PURE__ */ jsxs13(Box13, { marginTop: 1, children: [
|
|
5818
|
+
/* @__PURE__ */ jsx14(Text13, { children: "Title: " }),
|
|
5819
|
+
/* @__PURE__ */ jsx14(Text13, { children: inputBuffer }),
|
|
5820
|
+
/* @__PURE__ */ jsx14(Text13, { children: "\u2502" })
|
|
5821
|
+
] }),
|
|
5822
|
+
/* @__PURE__ */ jsx14(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text13, { dimColor: true, children: "enter save \xB7 esc cancel" }) })
|
|
5823
|
+
] });
|
|
5824
|
+
}
|
|
5825
|
+
return /* @__PURE__ */ jsxs13(Box13, { flexDirection: "column", paddingX: 1, children: [
|
|
5826
|
+
/* @__PURE__ */ jsxs13(Text13, { children: [
|
|
5827
|
+
/* @__PURE__ */ jsx14(Text13, { bold: true, children: "Chat Archive" }),
|
|
5828
|
+
/* @__PURE__ */ jsxs13(Text13, { dimColor: true, children: [
|
|
5829
|
+
" ",
|
|
5830
|
+
sessions.length,
|
|
5831
|
+
" chat",
|
|
5832
|
+
sessions.length !== 1 ? "s" : ""
|
|
5833
|
+
] }),
|
|
5834
|
+
showArchived && /* @__PURE__ */ jsx14(Text13, { color: "yellow", children: " (showing archived)" })
|
|
5835
|
+
] }),
|
|
5836
|
+
/* @__PURE__ */ jsx14(Box13, { flexDirection: "column", marginTop: 1, children: sessions.map((session, idx) => {
|
|
5837
|
+
const isSelected = idx === selectedIndex;
|
|
5838
|
+
const ago = formatTimeAgo2(session.updatedAt);
|
|
5839
|
+
const titleDisplay = session.title.length > 60 ? session.title.slice(0, 60) + "..." : session.title;
|
|
5840
|
+
return /* @__PURE__ */ jsx14(Box13, { flexDirection: "column", children: /* @__PURE__ */ jsxs13(Text13, { children: [
|
|
5841
|
+
isSelected ? /* @__PURE__ */ jsx14(Text13, { bold: true, color: "green", children: "> " }) : " ",
|
|
5842
|
+
isSelected ? /* @__PURE__ */ jsx14(Text13, { bold: true, children: titleDisplay }) : /* @__PURE__ */ jsx14(Text13, { children: titleDisplay }),
|
|
5843
|
+
/* @__PURE__ */ jsxs13(Text13, { dimColor: true, children: [
|
|
5844
|
+
" ",
|
|
5845
|
+
session.messageCount,
|
|
5846
|
+
" msgs \xB7 ",
|
|
5847
|
+
ago
|
|
5848
|
+
] })
|
|
5849
|
+
] }) }, session.id);
|
|
5850
|
+
}) })
|
|
5851
|
+
] });
|
|
5852
|
+
}
|
|
5853
|
+
|
|
5391
5854
|
// src/cli/dashboard/App.tsx
|
|
5392
|
-
import { jsx as
|
|
5855
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5393
5856
|
var MAIN_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
5394
5857
|
async function applyGoalFix(fix, dispatch) {
|
|
5395
5858
|
try {
|
|
@@ -5428,7 +5891,7 @@ ${content}
|
|
|
5428
5891
|
fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
|
|
5429
5892
|
}
|
|
5430
5893
|
await writeFile(fullPath, fixedContent, "utf-8");
|
|
5431
|
-
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-
|
|
5894
|
+
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-XYA364W3.js");
|
|
5432
5895
|
const goals = await getActiveGoals(projectPath);
|
|
5433
5896
|
const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
|
|
5434
5897
|
if (matchedGoal) {
|
|
@@ -5445,12 +5908,13 @@ function DashboardApp({ onReady }) {
|
|
|
5445
5908
|
const { state, dispatch } = useDashboard();
|
|
5446
5909
|
const { exit } = useApp();
|
|
5447
5910
|
const [showConfig, setShowConfig] = useState2(false);
|
|
5911
|
+
const [showHelp, setShowHelp] = useState2(false);
|
|
5448
5912
|
const dispatchRef = useRef2(dispatch);
|
|
5449
5913
|
dispatchRef.current = dispatch;
|
|
5450
5914
|
const stateRef = useRef2(state);
|
|
5451
5915
|
stateRef.current = state;
|
|
5452
5916
|
const configPath = join2(getTrieDirectory(getWorkingDirectory(void 0, true)), "agent.json");
|
|
5453
|
-
const loadConfig =
|
|
5917
|
+
const loadConfig = useCallback7(async () => {
|
|
5454
5918
|
if (!existsSync3(configPath)) return;
|
|
5455
5919
|
try {
|
|
5456
5920
|
const raw = await readFile2(configPath, "utf-8");
|
|
@@ -5459,7 +5923,7 @@ function DashboardApp({ onReady }) {
|
|
|
5459
5923
|
} catch {
|
|
5460
5924
|
}
|
|
5461
5925
|
}, [configPath]);
|
|
5462
|
-
const persistConfig =
|
|
5926
|
+
const persistConfig = useCallback7(async () => {
|
|
5463
5927
|
try {
|
|
5464
5928
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5465
5929
|
await mkdir(getTrieDirectory(workDir), { recursive: true });
|
|
@@ -5471,7 +5935,7 @@ function DashboardApp({ onReady }) {
|
|
|
5471
5935
|
} catch {
|
|
5472
5936
|
}
|
|
5473
5937
|
}, [configPath]);
|
|
5474
|
-
const processInsights =
|
|
5938
|
+
const processInsights = useCallback7(async (issues) => {
|
|
5475
5939
|
try {
|
|
5476
5940
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5477
5941
|
const trieAgent = getGuardian(workDir);
|
|
@@ -5497,7 +5961,7 @@ function DashboardApp({ onReady }) {
|
|
|
5497
5961
|
dispatchRef.current({ type: "ADD_ACTIVITY", message: `Trie Agent error: ${error instanceof Error ? error.message : "unknown"}` });
|
|
5498
5962
|
}
|
|
5499
5963
|
}, []);
|
|
5500
|
-
const refreshGoals =
|
|
5964
|
+
const refreshGoals = useCallback7(async () => {
|
|
5501
5965
|
try {
|
|
5502
5966
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5503
5967
|
const agentState = getGuardianState(workDir);
|
|
@@ -5513,7 +5977,7 @@ function DashboardApp({ onReady }) {
|
|
|
5513
5977
|
} catch {
|
|
5514
5978
|
}
|
|
5515
5979
|
}, []);
|
|
5516
|
-
const refreshHypotheses =
|
|
5980
|
+
const refreshHypotheses = useCallback7(async () => {
|
|
5517
5981
|
try {
|
|
5518
5982
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5519
5983
|
const agentState = getGuardianState(workDir);
|
|
@@ -5529,7 +5993,7 @@ function DashboardApp({ onReady }) {
|
|
|
5529
5993
|
} catch {
|
|
5530
5994
|
}
|
|
5531
5995
|
}, []);
|
|
5532
|
-
|
|
5996
|
+
useEffect5(() => {
|
|
5533
5997
|
void loadConfig();
|
|
5534
5998
|
void refreshGoals();
|
|
5535
5999
|
void refreshHypotheses();
|
|
@@ -5586,24 +6050,32 @@ function DashboardApp({ onReady }) {
|
|
|
5586
6050
|
outputManager.setMode("console");
|
|
5587
6051
|
};
|
|
5588
6052
|
}, [loadConfig, onReady, processInsights, refreshGoals, refreshHypotheses]);
|
|
5589
|
-
|
|
6053
|
+
useEffect5(() => {
|
|
5590
6054
|
const interval = setInterval(() => {
|
|
5591
6055
|
dispatchRef.current({ type: "AUTO_DISMISS_NOTIFICATIONS" });
|
|
5592
6056
|
}, 5e3);
|
|
5593
6057
|
return () => clearInterval(interval);
|
|
5594
6058
|
}, []);
|
|
5595
6059
|
const applyingFixIds = useRef2(/* @__PURE__ */ new Set());
|
|
5596
|
-
|
|
6060
|
+
useEffect5(() => {
|
|
5597
6061
|
const toApply = state.pendingFixes.filter((f) => f.status === "applying" && !applyingFixIds.current.has(f.id));
|
|
5598
6062
|
for (const fix of toApply) {
|
|
5599
6063
|
applyingFixIds.current.add(fix.id);
|
|
5600
6064
|
void applyGoalFix(fix, dispatchRef.current);
|
|
5601
6065
|
}
|
|
5602
6066
|
}, [state.pendingFixes]);
|
|
5603
|
-
|
|
6067
|
+
useInput10((input, key) => {
|
|
5604
6068
|
if (showConfig) return;
|
|
5605
6069
|
if (state.view === "goals" && state.goalsPanel.inputMode === "add") return;
|
|
5606
6070
|
if (state.view === "hypotheses" && state.hypothesesPanel.inputMode === "add") return;
|
|
6071
|
+
if ((input === "/" || input === "?") && state.view !== "chat") {
|
|
6072
|
+
setShowHelp(!showHelp);
|
|
6073
|
+
return;
|
|
6074
|
+
}
|
|
6075
|
+
if (showHelp) {
|
|
6076
|
+
setShowHelp(false);
|
|
6077
|
+
return;
|
|
6078
|
+
}
|
|
5607
6079
|
if (state.view === "chat") {
|
|
5608
6080
|
if (key.tab) {
|
|
5609
6081
|
const currentIndex = MAIN_VIEWS.indexOf(state.view);
|
|
@@ -5622,7 +6094,7 @@ function DashboardApp({ onReady }) {
|
|
|
5622
6094
|
dispatch({ type: "SET_VIEW", view: MAIN_VIEWS[nextIndex] || "overview" });
|
|
5623
6095
|
return;
|
|
5624
6096
|
}
|
|
5625
|
-
if (state.view === "goals" || state.view === "hypotheses") {
|
|
6097
|
+
if (state.view === "goals" || state.view === "hypotheses" || state.view === "chat-archive") {
|
|
5626
6098
|
return;
|
|
5627
6099
|
}
|
|
5628
6100
|
if (input === "s") {
|
|
@@ -5655,6 +6127,10 @@ function DashboardApp({ onReady }) {
|
|
|
5655
6127
|
dispatch({ type: "SET_VIEW", view: "chat" });
|
|
5656
6128
|
return;
|
|
5657
6129
|
}
|
|
6130
|
+
if (input === "h") {
|
|
6131
|
+
dispatch({ type: "SET_VIEW", view: "chat-archive" });
|
|
6132
|
+
return;
|
|
6133
|
+
}
|
|
5658
6134
|
if (state.view === "agent" || state.view === "memory") return;
|
|
5659
6135
|
if (input === "b") dispatch({ type: "GO_BACK" });
|
|
5660
6136
|
if (input === "n") dispatch({ type: "NEXT_PAGE" });
|
|
@@ -5663,41 +6139,44 @@ function DashboardApp({ onReady }) {
|
|
|
5663
6139
|
let viewComponent;
|
|
5664
6140
|
switch (state.view) {
|
|
5665
6141
|
case "overview":
|
|
5666
|
-
viewComponent = /* @__PURE__ */
|
|
6142
|
+
viewComponent = /* @__PURE__ */ jsx15(OverviewView, {});
|
|
5667
6143
|
break;
|
|
5668
6144
|
case "agent":
|
|
5669
|
-
viewComponent = /* @__PURE__ */
|
|
6145
|
+
viewComponent = /* @__PURE__ */ jsx15(AgentView, {});
|
|
5670
6146
|
break;
|
|
5671
6147
|
case "goals":
|
|
5672
|
-
viewComponent = /* @__PURE__ */
|
|
6148
|
+
viewComponent = /* @__PURE__ */ jsx15(GoalsView, {});
|
|
5673
6149
|
break;
|
|
5674
6150
|
case "hypotheses":
|
|
5675
|
-
viewComponent = /* @__PURE__ */
|
|
6151
|
+
viewComponent = /* @__PURE__ */ jsx15(HypothesesView, {});
|
|
5676
6152
|
break;
|
|
5677
6153
|
case "memory":
|
|
5678
|
-
viewComponent = /* @__PURE__ */
|
|
6154
|
+
viewComponent = /* @__PURE__ */ jsx15(MemoryTreeView, {});
|
|
5679
6155
|
break;
|
|
5680
6156
|
case "rawlog":
|
|
5681
|
-
viewComponent = /* @__PURE__ */
|
|
6157
|
+
viewComponent = /* @__PURE__ */ jsx15(RawLogView, {});
|
|
5682
6158
|
break;
|
|
5683
6159
|
case "chat":
|
|
5684
|
-
viewComponent = /* @__PURE__ */
|
|
6160
|
+
viewComponent = /* @__PURE__ */ jsx15(ChatView, {});
|
|
6161
|
+
break;
|
|
6162
|
+
case "chat-archive":
|
|
6163
|
+
viewComponent = /* @__PURE__ */ jsx15(ChatArchiveView, {});
|
|
5685
6164
|
break;
|
|
5686
6165
|
default:
|
|
5687
|
-
viewComponent = /* @__PURE__ */
|
|
6166
|
+
viewComponent = /* @__PURE__ */ jsx15(OverviewView, {});
|
|
5688
6167
|
}
|
|
5689
|
-
return /* @__PURE__ */
|
|
5690
|
-
/* @__PURE__ */
|
|
5691
|
-
!showConfig && /* @__PURE__ */
|
|
5692
|
-
/* @__PURE__ */
|
|
6168
|
+
return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "column", height: process.stdout.rows || 40, children: [
|
|
6169
|
+
/* @__PURE__ */ jsx15(Header, {}),
|
|
6170
|
+
!showConfig && !showHelp && /* @__PURE__ */ jsx15(Notification, {}),
|
|
6171
|
+
/* @__PURE__ */ jsx15(Box14, { flexGrow: 1, flexDirection: "column", overflow: "hidden", children: showConfig ? /* @__PURE__ */ jsx15(ConfigDialog, { onClose: () => {
|
|
5693
6172
|
setShowConfig(false);
|
|
5694
6173
|
void persistConfig();
|
|
5695
|
-
} }) : viewComponent }),
|
|
5696
|
-
/* @__PURE__ */
|
|
6174
|
+
} }) : showHelp ? /* @__PURE__ */ jsx15(HelpDialog, { view: state.view, onClose: () => setShowHelp(false) }) : viewComponent }),
|
|
6175
|
+
/* @__PURE__ */ jsx15(Footer, {})
|
|
5697
6176
|
] });
|
|
5698
6177
|
}
|
|
5699
6178
|
function App({ onReady }) {
|
|
5700
|
-
return /* @__PURE__ */
|
|
6179
|
+
return /* @__PURE__ */ jsx15(DashboardProvider, { children: /* @__PURE__ */ jsx15(DashboardApp, { onReady }) });
|
|
5701
6180
|
}
|
|
5702
6181
|
|
|
5703
6182
|
// src/cli/dashboard/index.ts
|
|
@@ -5707,7 +6186,7 @@ var InteractiveDashboard = class {
|
|
|
5707
6186
|
getConfigFn = null;
|
|
5708
6187
|
async start() {
|
|
5709
6188
|
this.app = render(
|
|
5710
|
-
|
|
6189
|
+
React11.createElement(App, {
|
|
5711
6190
|
onReady: (handler, getConfig) => {
|
|
5712
6191
|
this.updateHandler = handler;
|
|
5713
6192
|
this.getConfigFn = getConfig;
|
|
@@ -5752,4 +6231,4 @@ export {
|
|
|
5752
6231
|
handleCheckpointTool,
|
|
5753
6232
|
InteractiveDashboard
|
|
5754
6233
|
};
|
|
5755
|
-
//# sourceMappingURL=chunk-
|
|
6234
|
+
//# sourceMappingURL=chunk-ANQPXOT2.js.map
|