@triedotdev/mcp 1.0.121 → 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-7BY2KVIN.js → chunk-ANQPXOT2.js} +440 -71
- 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-7BY2KVIN.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
|
};
|
|
@@ -889,7 +914,8 @@ var VIEW_LABELS = {
|
|
|
889
914
|
goals: "Goals",
|
|
890
915
|
hypotheses: "Hypotheses",
|
|
891
916
|
memory: "Ledger",
|
|
892
|
-
chat: "Chat"
|
|
917
|
+
chat: "Chat",
|
|
918
|
+
"chat-archive": "History"
|
|
893
919
|
};
|
|
894
920
|
var VIEW_SHORT = {
|
|
895
921
|
overview: "Ovr",
|
|
@@ -898,24 +924,27 @@ var VIEW_SHORT = {
|
|
|
898
924
|
goals: "Gls",
|
|
899
925
|
hypotheses: "Hyp",
|
|
900
926
|
memory: "Ldg",
|
|
901
|
-
chat: "Cht"
|
|
927
|
+
chat: "Cht",
|
|
928
|
+
"chat-archive": "Hst"
|
|
902
929
|
};
|
|
903
930
|
var TAB_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
904
931
|
var CONTEXT_HINTS = {
|
|
905
|
-
goals: "
|
|
906
|
-
hypotheses: "
|
|
907
|
-
agent: "
|
|
908
|
-
memory: "
|
|
909
|
-
chat: "
|
|
910
|
-
|
|
932
|
+
goals: "/ help",
|
|
933
|
+
hypotheses: "/ help",
|
|
934
|
+
agent: "/ help",
|
|
935
|
+
memory: "/ help",
|
|
936
|
+
chat: "/ help",
|
|
937
|
+
"chat-archive": "/ help",
|
|
938
|
+
rawlog: "/ help"
|
|
911
939
|
};
|
|
912
940
|
var CONTEXT_HINTS_SHORT = {
|
|
913
|
-
goals: "
|
|
914
|
-
hypotheses: "
|
|
915
|
-
agent: "
|
|
916
|
-
memory: "
|
|
917
|
-
chat: "
|
|
918
|
-
|
|
941
|
+
goals: "/",
|
|
942
|
+
hypotheses: "/",
|
|
943
|
+
agent: "/",
|
|
944
|
+
memory: "/",
|
|
945
|
+
chat: "/",
|
|
946
|
+
"chat-archive": "/",
|
|
947
|
+
rawlog: "/"
|
|
919
948
|
};
|
|
920
949
|
function Footer() {
|
|
921
950
|
const { state } = useDashboard();
|
|
@@ -933,7 +962,7 @@ function Footer() {
|
|
|
933
962
|
hints = narrow ? "enter esc" : "enter save \xB7 esc cancel";
|
|
934
963
|
} else {
|
|
935
964
|
const hintMap = narrow ? CONTEXT_HINTS_SHORT : CONTEXT_HINTS;
|
|
936
|
-
hints = hintMap[view] || (narrow ? "
|
|
965
|
+
hints = hintMap[view] || (narrow ? "/" : "/ help");
|
|
937
966
|
}
|
|
938
967
|
if (veryNarrow) {
|
|
939
968
|
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", paddingX: 1, children: [
|
|
@@ -1304,9 +1333,24 @@ var VIEW_HELP = {
|
|
|
1304
1333
|
{ key: "type", description: "Enter message" },
|
|
1305
1334
|
{ key: "enter", description: "Send message" },
|
|
1306
1335
|
{ key: "esc", description: "Clear input" },
|
|
1336
|
+
{ key: "h", description: "Open chat history" },
|
|
1307
1337
|
{ key: "tab", description: "Navigate between views" },
|
|
1308
1338
|
{ key: "q", description: "Quit (press twice if input active)" }
|
|
1309
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
|
+
],
|
|
1310
1354
|
rawlog: [
|
|
1311
1355
|
{ key: "n", description: "Next page" },
|
|
1312
1356
|
{ key: "p", description: "Previous page" },
|
|
@@ -1565,11 +1609,25 @@ function AgentView() {
|
|
|
1565
1609
|
dispatch({ type: "MARK_NUDGES_READ" });
|
|
1566
1610
|
}
|
|
1567
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]);
|
|
1568
1626
|
useInput3((input, key) => {
|
|
1569
1627
|
if (key.upArrow || input === "k") dispatch({ type: "NAVIGATE_UP" });
|
|
1570
1628
|
else if (key.downArrow || input === "j") dispatch({ type: "NAVIGATE_DOWN" });
|
|
1571
1629
|
else if (key.return) dispatch({ type: "TOGGLE_INSIGHT", index: selectedInsight });
|
|
1572
|
-
else if (input === "d")
|
|
1630
|
+
else if (input === "d") void dismissInsight();
|
|
1573
1631
|
});
|
|
1574
1632
|
const alertCount = alerts.length;
|
|
1575
1633
|
const decCount = decisions.length;
|
|
@@ -1814,7 +1872,7 @@ function GoalsView() {
|
|
|
1814
1872
|
if (!goal) return;
|
|
1815
1873
|
dispatch({ type: "ADD_ACTIVITY", message: `Checking goal: ${goal.description.slice(0, 30)}...` });
|
|
1816
1874
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Scanning files for violations...`, severity: "info", autoHideMs: 3e3 });
|
|
1817
|
-
const { checkFilesForGoalViolations } = await import("./goal-validator-
|
|
1875
|
+
const { checkFilesForGoalViolations } = await import("./goal-validator-XYA364W3.js");
|
|
1818
1876
|
const violations = await checkFilesForGoalViolations([goal], workDir);
|
|
1819
1877
|
if (violations.length === 0) {
|
|
1820
1878
|
dispatch({ type: "SHOW_NOTIFICATION", message: `\u2713 No violations found for: ${goal.description.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -2013,7 +2071,7 @@ function HypothesesView() {
|
|
|
2013
2071
|
if (!hypo) return;
|
|
2014
2072
|
dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement.slice(0, 30)}...` });
|
|
2015
2073
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
|
|
2016
|
-
const { gatherEvidenceForHypothesis } = await import("./hypothesis-
|
|
2074
|
+
const { gatherEvidenceForHypothesis } = await import("./hypothesis-QFGZ5ITT.js");
|
|
2017
2075
|
const evidence = await gatherEvidenceForHypothesis(hypoId, workDir);
|
|
2018
2076
|
if (evidence.length === 0) {
|
|
2019
2077
|
dispatch({ type: "SHOW_NOTIFICATION", message: `No evidence found for: ${hypo.statement.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -2361,7 +2419,7 @@ function RawLogView() {
|
|
|
2361
2419
|
}
|
|
2362
2420
|
|
|
2363
2421
|
// src/cli/dashboard/views/ChatView.tsx
|
|
2364
|
-
import { useCallback as useCallback5, useRef } from "react";
|
|
2422
|
+
import { useCallback as useCallback5, useRef, useEffect as useEffect3 } from "react";
|
|
2365
2423
|
import { Box as Box12, Text as Text12, useInput as useInput8 } from "ink";
|
|
2366
2424
|
|
|
2367
2425
|
// src/tools/tell.ts
|
|
@@ -4892,7 +4950,7 @@ var CHAT_TOOLS = [
|
|
|
4892
4950
|
},
|
|
4893
4951
|
{
|
|
4894
4952
|
name: "trie_search_files",
|
|
4895
|
-
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.",
|
|
4896
4954
|
input_schema: {
|
|
4897
4955
|
type: "object",
|
|
4898
4956
|
properties: {
|
|
@@ -4911,6 +4969,19 @@ var CHAT_TOOLS = [
|
|
|
4911
4969
|
},
|
|
4912
4970
|
required: ["pattern"]
|
|
4913
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
|
+
}
|
|
4914
4985
|
}
|
|
4915
4986
|
];
|
|
4916
4987
|
async function executeTool(name, input) {
|
|
@@ -5132,7 +5203,7 @@ Type "yes" to proceed, or "no" to cancel.
|
|
|
5132
5203
|
return `Error: ripgrep (rg) not found. Please install it:
|
|
5133
5204
|
brew install ripgrep (macOS)
|
|
5134
5205
|
apt install ripgrep (Ubuntu)
|
|
5135
|
-
Or
|
|
5206
|
+
Or use trie_scan_for_goal_violations for AI-powered analysis instead.`;
|
|
5136
5207
|
}
|
|
5137
5208
|
return `Search failed: ${result.error.message}`;
|
|
5138
5209
|
}
|
|
@@ -5155,6 +5226,56 @@ ${truncated}`;
|
|
|
5155
5226
|
return `Search failed: ${error.message}`;
|
|
5156
5227
|
}
|
|
5157
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
|
+
}
|
|
5158
5279
|
default:
|
|
5159
5280
|
return `Unknown tool: ${name}`;
|
|
5160
5281
|
}
|
|
@@ -5262,20 +5383,20 @@ var SYSTEM_PROMPT = `You are Trie, a code guardian assistant embedded in a termi
|
|
|
5262
5383
|
- Query stored decisions, blockers, facts, and questions from the decision ledger
|
|
5263
5384
|
- Create and manage goals and hypotheses
|
|
5264
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
|
|
5265
5387
|
- Save work checkpoints
|
|
5266
5388
|
|
|
5267
|
-
**IMPORTANT -
|
|
5268
|
-
- You have a
|
|
5269
|
-
-
|
|
5270
|
-
-
|
|
5271
|
-
-
|
|
5272
|
-
- 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)
|
|
5273
5394
|
|
|
5274
|
-
**When user asks about code content:**
|
|
5395
|
+
**When user asks about code content (emojis, TODOs, etc.):**
|
|
5275
5396
|
1. First check the "Recent goal violations (nudges)" section in project context
|
|
5276
5397
|
2. If found, report what you see
|
|
5277
|
-
3. If not found
|
|
5278
|
-
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
|
|
5279
5400
|
|
|
5280
5401
|
**When user asks to fix violations:**
|
|
5281
5402
|
1. Look in "Recent goal violations (nudges)" section of project context
|
|
@@ -5284,16 +5405,39 @@ var SYSTEM_PROMPT = `You are Trie, a code guardian assistant embedded in a termi
|
|
|
5284
5405
|
4. Do NOT assume the user wants to proceed - always get confirmation first
|
|
5285
5406
|
|
|
5286
5407
|
Examples:
|
|
5287
|
-
- 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.
|
|
5288
5410
|
- User: "fix the emoji violation" \u2192 Find emoji violation in nudges, call trie_propose_fix (will ask user to confirm)
|
|
5289
|
-
- 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.
|
|
5290
5412
|
|
|
5291
5413
|
Answer concisely. Reference specific files, decisions, and patterns when relevant.`;
|
|
5292
5414
|
function ChatView() {
|
|
5293
5415
|
const { state, dispatch } = useDashboard();
|
|
5294
5416
|
const { chatState } = state;
|
|
5295
|
-
const { messages, inputBuffer, loading } = chatState;
|
|
5417
|
+
const { messages, inputBuffer, loading, currentSessionId, currentSessionTitle } = chatState;
|
|
5296
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]);
|
|
5297
5441
|
const sendMessage = useCallback5(async (question) => {
|
|
5298
5442
|
if (loadingRef.current) return;
|
|
5299
5443
|
loadingRef.current = true;
|
|
@@ -5447,7 +5591,14 @@ ${contextBlock}`;
|
|
|
5447
5591
|
] });
|
|
5448
5592
|
}
|
|
5449
5593
|
return /* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", paddingX: 1, flexGrow: 1, children: [
|
|
5450
|
-
/* @__PURE__ */
|
|
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
|
+
] }),
|
|
5451
5602
|
/* @__PURE__ */ jsxs12(Box12, { flexDirection: "column", flexGrow: 1, overflow: "hidden", marginTop: 1, children: [
|
|
5452
5603
|
messages.length === 0 && !loading && /* @__PURE__ */ jsx13(Text12, { dimColor: true, children: " Ask about your codebase, decisions, patterns, or risks." }),
|
|
5453
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: [
|
|
@@ -5489,8 +5640,219 @@ function formatToolInput(input) {
|
|
|
5489
5640
|
return parts.length > 0 ? parts.join(", ") : "";
|
|
5490
5641
|
}
|
|
5491
5642
|
|
|
5492
|
-
// src/cli/dashboard/
|
|
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";
|
|
5493
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
|
+
|
|
5854
|
+
// src/cli/dashboard/App.tsx
|
|
5855
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5494
5856
|
var MAIN_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
5495
5857
|
async function applyGoalFix(fix, dispatch) {
|
|
5496
5858
|
try {
|
|
@@ -5529,7 +5891,7 @@ ${content}
|
|
|
5529
5891
|
fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
|
|
5530
5892
|
}
|
|
5531
5893
|
await writeFile(fullPath, fixedContent, "utf-8");
|
|
5532
|
-
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-
|
|
5894
|
+
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-XYA364W3.js");
|
|
5533
5895
|
const goals = await getActiveGoals(projectPath);
|
|
5534
5896
|
const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
|
|
5535
5897
|
if (matchedGoal) {
|
|
@@ -5552,7 +5914,7 @@ function DashboardApp({ onReady }) {
|
|
|
5552
5914
|
const stateRef = useRef2(state);
|
|
5553
5915
|
stateRef.current = state;
|
|
5554
5916
|
const configPath = join2(getTrieDirectory(getWorkingDirectory(void 0, true)), "agent.json");
|
|
5555
|
-
const loadConfig =
|
|
5917
|
+
const loadConfig = useCallback7(async () => {
|
|
5556
5918
|
if (!existsSync3(configPath)) return;
|
|
5557
5919
|
try {
|
|
5558
5920
|
const raw = await readFile2(configPath, "utf-8");
|
|
@@ -5561,7 +5923,7 @@ function DashboardApp({ onReady }) {
|
|
|
5561
5923
|
} catch {
|
|
5562
5924
|
}
|
|
5563
5925
|
}, [configPath]);
|
|
5564
|
-
const persistConfig =
|
|
5926
|
+
const persistConfig = useCallback7(async () => {
|
|
5565
5927
|
try {
|
|
5566
5928
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5567
5929
|
await mkdir(getTrieDirectory(workDir), { recursive: true });
|
|
@@ -5573,7 +5935,7 @@ function DashboardApp({ onReady }) {
|
|
|
5573
5935
|
} catch {
|
|
5574
5936
|
}
|
|
5575
5937
|
}, [configPath]);
|
|
5576
|
-
const processInsights =
|
|
5938
|
+
const processInsights = useCallback7(async (issues) => {
|
|
5577
5939
|
try {
|
|
5578
5940
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5579
5941
|
const trieAgent = getGuardian(workDir);
|
|
@@ -5599,7 +5961,7 @@ function DashboardApp({ onReady }) {
|
|
|
5599
5961
|
dispatchRef.current({ type: "ADD_ACTIVITY", message: `Trie Agent error: ${error instanceof Error ? error.message : "unknown"}` });
|
|
5600
5962
|
}
|
|
5601
5963
|
}, []);
|
|
5602
|
-
const refreshGoals =
|
|
5964
|
+
const refreshGoals = useCallback7(async () => {
|
|
5603
5965
|
try {
|
|
5604
5966
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5605
5967
|
const agentState = getGuardianState(workDir);
|
|
@@ -5615,7 +5977,7 @@ function DashboardApp({ onReady }) {
|
|
|
5615
5977
|
} catch {
|
|
5616
5978
|
}
|
|
5617
5979
|
}, []);
|
|
5618
|
-
const refreshHypotheses =
|
|
5980
|
+
const refreshHypotheses = useCallback7(async () => {
|
|
5619
5981
|
try {
|
|
5620
5982
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5621
5983
|
const agentState = getGuardianState(workDir);
|
|
@@ -5631,7 +5993,7 @@ function DashboardApp({ onReady }) {
|
|
|
5631
5993
|
} catch {
|
|
5632
5994
|
}
|
|
5633
5995
|
}, []);
|
|
5634
|
-
|
|
5996
|
+
useEffect5(() => {
|
|
5635
5997
|
void loadConfig();
|
|
5636
5998
|
void refreshGoals();
|
|
5637
5999
|
void refreshHypotheses();
|
|
@@ -5688,21 +6050,21 @@ function DashboardApp({ onReady }) {
|
|
|
5688
6050
|
outputManager.setMode("console");
|
|
5689
6051
|
};
|
|
5690
6052
|
}, [loadConfig, onReady, processInsights, refreshGoals, refreshHypotheses]);
|
|
5691
|
-
|
|
6053
|
+
useEffect5(() => {
|
|
5692
6054
|
const interval = setInterval(() => {
|
|
5693
6055
|
dispatchRef.current({ type: "AUTO_DISMISS_NOTIFICATIONS" });
|
|
5694
6056
|
}, 5e3);
|
|
5695
6057
|
return () => clearInterval(interval);
|
|
5696
6058
|
}, []);
|
|
5697
6059
|
const applyingFixIds = useRef2(/* @__PURE__ */ new Set());
|
|
5698
|
-
|
|
6060
|
+
useEffect5(() => {
|
|
5699
6061
|
const toApply = state.pendingFixes.filter((f) => f.status === "applying" && !applyingFixIds.current.has(f.id));
|
|
5700
6062
|
for (const fix of toApply) {
|
|
5701
6063
|
applyingFixIds.current.add(fix.id);
|
|
5702
6064
|
void applyGoalFix(fix, dispatchRef.current);
|
|
5703
6065
|
}
|
|
5704
6066
|
}, [state.pendingFixes]);
|
|
5705
|
-
|
|
6067
|
+
useInput10((input, key) => {
|
|
5706
6068
|
if (showConfig) return;
|
|
5707
6069
|
if (state.view === "goals" && state.goalsPanel.inputMode === "add") return;
|
|
5708
6070
|
if (state.view === "hypotheses" && state.hypothesesPanel.inputMode === "add") return;
|
|
@@ -5732,7 +6094,7 @@ function DashboardApp({ onReady }) {
|
|
|
5732
6094
|
dispatch({ type: "SET_VIEW", view: MAIN_VIEWS[nextIndex] || "overview" });
|
|
5733
6095
|
return;
|
|
5734
6096
|
}
|
|
5735
|
-
if (state.view === "goals" || state.view === "hypotheses") {
|
|
6097
|
+
if (state.view === "goals" || state.view === "hypotheses" || state.view === "chat-archive") {
|
|
5736
6098
|
return;
|
|
5737
6099
|
}
|
|
5738
6100
|
if (input === "s") {
|
|
@@ -5765,6 +6127,10 @@ function DashboardApp({ onReady }) {
|
|
|
5765
6127
|
dispatch({ type: "SET_VIEW", view: "chat" });
|
|
5766
6128
|
return;
|
|
5767
6129
|
}
|
|
6130
|
+
if (input === "h") {
|
|
6131
|
+
dispatch({ type: "SET_VIEW", view: "chat-archive" });
|
|
6132
|
+
return;
|
|
6133
|
+
}
|
|
5768
6134
|
if (state.view === "agent" || state.view === "memory") return;
|
|
5769
6135
|
if (input === "b") dispatch({ type: "GO_BACK" });
|
|
5770
6136
|
if (input === "n") dispatch({ type: "NEXT_PAGE" });
|
|
@@ -5773,41 +6139,44 @@ function DashboardApp({ onReady }) {
|
|
|
5773
6139
|
let viewComponent;
|
|
5774
6140
|
switch (state.view) {
|
|
5775
6141
|
case "overview":
|
|
5776
|
-
viewComponent = /* @__PURE__ */
|
|
6142
|
+
viewComponent = /* @__PURE__ */ jsx15(OverviewView, {});
|
|
5777
6143
|
break;
|
|
5778
6144
|
case "agent":
|
|
5779
|
-
viewComponent = /* @__PURE__ */
|
|
6145
|
+
viewComponent = /* @__PURE__ */ jsx15(AgentView, {});
|
|
5780
6146
|
break;
|
|
5781
6147
|
case "goals":
|
|
5782
|
-
viewComponent = /* @__PURE__ */
|
|
6148
|
+
viewComponent = /* @__PURE__ */ jsx15(GoalsView, {});
|
|
5783
6149
|
break;
|
|
5784
6150
|
case "hypotheses":
|
|
5785
|
-
viewComponent = /* @__PURE__ */
|
|
6151
|
+
viewComponent = /* @__PURE__ */ jsx15(HypothesesView, {});
|
|
5786
6152
|
break;
|
|
5787
6153
|
case "memory":
|
|
5788
|
-
viewComponent = /* @__PURE__ */
|
|
6154
|
+
viewComponent = /* @__PURE__ */ jsx15(MemoryTreeView, {});
|
|
5789
6155
|
break;
|
|
5790
6156
|
case "rawlog":
|
|
5791
|
-
viewComponent = /* @__PURE__ */
|
|
6157
|
+
viewComponent = /* @__PURE__ */ jsx15(RawLogView, {});
|
|
5792
6158
|
break;
|
|
5793
6159
|
case "chat":
|
|
5794
|
-
viewComponent = /* @__PURE__ */
|
|
6160
|
+
viewComponent = /* @__PURE__ */ jsx15(ChatView, {});
|
|
6161
|
+
break;
|
|
6162
|
+
case "chat-archive":
|
|
6163
|
+
viewComponent = /* @__PURE__ */ jsx15(ChatArchiveView, {});
|
|
5795
6164
|
break;
|
|
5796
6165
|
default:
|
|
5797
|
-
viewComponent = /* @__PURE__ */
|
|
6166
|
+
viewComponent = /* @__PURE__ */ jsx15(OverviewView, {});
|
|
5798
6167
|
}
|
|
5799
|
-
return /* @__PURE__ */
|
|
5800
|
-
/* @__PURE__ */
|
|
5801
|
-
!showConfig && !showHelp && /* @__PURE__ */
|
|
5802
|
-
/* @__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: () => {
|
|
5803
6172
|
setShowConfig(false);
|
|
5804
6173
|
void persistConfig();
|
|
5805
|
-
} }) : showHelp ? /* @__PURE__ */
|
|
5806
|
-
/* @__PURE__ */
|
|
6174
|
+
} }) : showHelp ? /* @__PURE__ */ jsx15(HelpDialog, { view: state.view, onClose: () => setShowHelp(false) }) : viewComponent }),
|
|
6175
|
+
/* @__PURE__ */ jsx15(Footer, {})
|
|
5807
6176
|
] });
|
|
5808
6177
|
}
|
|
5809
6178
|
function App({ onReady }) {
|
|
5810
|
-
return /* @__PURE__ */
|
|
6179
|
+
return /* @__PURE__ */ jsx15(DashboardProvider, { children: /* @__PURE__ */ jsx15(DashboardApp, { onReady }) });
|
|
5811
6180
|
}
|
|
5812
6181
|
|
|
5813
6182
|
// src/cli/dashboard/index.ts
|
|
@@ -5817,7 +6186,7 @@ var InteractiveDashboard = class {
|
|
|
5817
6186
|
getConfigFn = null;
|
|
5818
6187
|
async start() {
|
|
5819
6188
|
this.app = render(
|
|
5820
|
-
|
|
6189
|
+
React11.createElement(App, {
|
|
5821
6190
|
onReady: (handler, getConfig) => {
|
|
5822
6191
|
this.updateHandler = handler;
|
|
5823
6192
|
this.getConfigFn = getConfig;
|
|
@@ -5862,4 +6231,4 @@ export {
|
|
|
5862
6231
|
handleCheckpointTool,
|
|
5863
6232
|
InteractiveDashboard
|
|
5864
6233
|
};
|
|
5865
|
-
//# sourceMappingURL=chunk-
|
|
6234
|
+
//# sourceMappingURL=chunk-ANQPXOT2.js.map
|