@triedotdev/mcp 1.0.122 → 1.0.124
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 → chat-store-HFOOWZYN.js} +2 -2
- package/dist/{chunk-JG7XVS53.js → chunk-4YJ6KLGI.js} +9 -2
- package/dist/{chunk-JG7XVS53.js.map → chunk-4YJ6KLGI.js.map} +1 -1
- package/dist/{chunk-ANQPXOT2.js → chunk-7J4ZOOAD.js} +333 -304
- package/dist/chunk-7J4ZOOAD.js.map +1 -0
- package/dist/{chunk-F4ZIAHTZ.js → chunk-A4EDTN6R.js} +2 -2
- package/dist/{chunk-7A5RLKZY.js → chunk-D2CGMX7K.js} +7 -7
- package/dist/{chunk-HWXZ3E7B.js → chunk-DFPVUMVE.js} +1 -1
- package/dist/chunk-DFPVUMVE.js.map +1 -0
- package/dist/{chunk-EOLHWFDG.js → chunk-TRIJC5MW.js} +2 -2
- package/dist/{chunk-3BVNB3GY.js → chunk-W2DEBKZ2.js} +4 -5
- package/dist/chunk-W2DEBKZ2.js.map +1 -0
- package/dist/{chunk-WRGSH5RT.js → chunk-WMI44VIC.js} +2 -2
- package/dist/{chunk-WRGSH5RT.js.map → chunk-WMI44VIC.js.map} +1 -1
- package/dist/cli/main.js +2 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +8 -8
- package/dist/{client-PMKE26IV.js → client-EWP4SIG3.js} +2 -2
- package/dist/{goal-manager-O446DRJI.js → goal-manager-RREOIX6U.js} +3 -3
- package/dist/{goal-validator-XYA364W3.js → goal-validator-CKFKJ46J.js} +2 -2
- package/dist/{guardian-agent-KVLNECZ5.js → guardian-agent-5QVLDPKB.js} +7 -7
- package/dist/{hypothesis-QFGZ5ITT.js → hypothesis-HFYZNIMZ.js} +3 -3
- package/dist/index.js +150 -30
- package/dist/index.js.map +1 -1
- package/dist/{insight-store-DZ5C3RFM.js → insight-store-F5KDBY5Y.js} +2 -2
- package/dist/{terminal-spawn-2GU5KLPS.js → terminal-spawn-P5M5PHAV.js} +28 -6
- package/dist/terminal-spawn-P5M5PHAV.js.map +1 -0
- package/dist/ui/chat.html +821 -0
- package/dist/ui/goals.html +724 -0
- package/dist/ui/hypotheses.html +768 -0
- package/dist/ui/ledger.html +711 -0
- package/dist/ui/nudges.html +752 -0
- package/package.json +1 -1
- package/dist/chunk-3BVNB3GY.js.map +0 -1
- package/dist/chunk-ANQPXOT2.js.map +0 -1
- package/dist/chunk-HWXZ3E7B.js.map +0 -1
- package/dist/terminal-spawn-2GU5KLPS.js.map +0 -1
- package/dist/ui/memory-viewer.html +0 -773
- package/dist/ui/pr-review.html +0 -742
- package/dist/ui/scan-dashboard.html +0 -741
- package/dist/ui/visual-qa.html +0 -762
- /package/dist/{chat-store-R46BCMBW.js.map → chat-store-HFOOWZYN.js.map} +0 -0
- /package/dist/{chunk-F4ZIAHTZ.js.map → chunk-A4EDTN6R.js.map} +0 -0
- /package/dist/{chunk-7A5RLKZY.js.map → chunk-D2CGMX7K.js.map} +0 -0
- /package/dist/{chunk-EOLHWFDG.js.map → chunk-TRIJC5MW.js.map} +0 -0
- /package/dist/{client-PMKE26IV.js.map → client-EWP4SIG3.js.map} +0 -0
- /package/dist/{goal-manager-O446DRJI.js.map → goal-manager-RREOIX6U.js.map} +0 -0
- /package/dist/{goal-validator-XYA364W3.js.map → goal-validator-CKFKJ46J.js.map} +0 -0
- /package/dist/{guardian-agent-KVLNECZ5.js.map → guardian-agent-5QVLDPKB.js.map} +0 -0
- /package/dist/{hypothesis-QFGZ5ITT.js.map → hypothesis-HFYZNIMZ.js.map} +0 -0
- /package/dist/{insight-store-DZ5C3RFM.js.map → insight-store-F5KDBY5Y.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getGuardian
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D2CGMX7K.js";
|
|
4
4
|
import {
|
|
5
5
|
getChatStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DFPVUMVE.js";
|
|
7
7
|
import {
|
|
8
8
|
LearningEngine,
|
|
9
9
|
exportToJson,
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
TieredStorage,
|
|
19
19
|
findCrossProjectPatterns,
|
|
20
20
|
getStorage
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-A4EDTN6R.js";
|
|
22
22
|
import {
|
|
23
23
|
getKeyFromKeychain,
|
|
24
24
|
isAIAvailable,
|
|
25
25
|
runAIWithTools,
|
|
26
26
|
setAPIKey
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-WMI44VIC.js";
|
|
28
28
|
import {
|
|
29
29
|
getGuardianState
|
|
30
30
|
} from "./chunk-UHMMANC2.js";
|
|
@@ -529,7 +529,7 @@ function dashboardReducer(state, action) {
|
|
|
529
529
|
(ni) => !existing.some((ei) => ei.message === ni.message && !ei.dismissed)
|
|
530
530
|
);
|
|
531
531
|
const merged = [...newOnes, ...existing].slice(0, 50);
|
|
532
|
-
console.
|
|
532
|
+
console.debug("[State] ADD_INSIGHTS:", {
|
|
533
533
|
newCount: newOnes.length,
|
|
534
534
|
existingCount: existing.length,
|
|
535
535
|
mergedCount: merged.length,
|
|
@@ -537,8 +537,21 @@ function dashboardReducer(state, action) {
|
|
|
537
537
|
});
|
|
538
538
|
let s = { ...state, agentInsights: merged };
|
|
539
539
|
const newAlerts = newOnes.filter((i) => i.type === "warning" && !i.dismissed).length;
|
|
540
|
+
console.debug("[State] ADD_INSIGHTS nudge count logic:", {
|
|
541
|
+
newOnesCount: newOnes.length,
|
|
542
|
+
newWarnings: newOnes.filter((i) => i.type === "warning").length,
|
|
543
|
+
newAlertsFiltered: newAlerts,
|
|
544
|
+
currentUnreadCount: state.unreadNudgesCount,
|
|
545
|
+
willIncrement: newAlerts > 0,
|
|
546
|
+
newInsightTypes: newOnes.map((i) => ({ type: i.type, dismissed: i.dismissed }))
|
|
547
|
+
});
|
|
540
548
|
if (newAlerts > 0) {
|
|
541
549
|
s.unreadNudgesCount = state.unreadNudgesCount + newAlerts;
|
|
550
|
+
console.debug("[State] Incremented unread nudges:", {
|
|
551
|
+
from: state.unreadNudgesCount,
|
|
552
|
+
to: s.unreadNudgesCount,
|
|
553
|
+
increment: newAlerts
|
|
554
|
+
});
|
|
542
555
|
}
|
|
543
556
|
if (newOnes.length > 0) {
|
|
544
557
|
s = addActivity(s, `Trie Agent: ${newOnes.length} new insight${newOnes.length > 1 ? "s" : ""}`);
|
|
@@ -813,7 +826,7 @@ function createInitialState() {
|
|
|
813
826
|
watch: { watching: false, directories: 0, recentChanges: [], filesScannedSession: 0 },
|
|
814
827
|
rawLog: [],
|
|
815
828
|
rawLogPage: 0,
|
|
816
|
-
scrollPositions: { overview: 0, rawlog: 0, agent: 0, goals: 0, hypotheses: 0, memory: 0, chat: 0 },
|
|
829
|
+
scrollPositions: { overview: 0, rawlog: 0, agent: 0, goals: 0, hypotheses: 0, memory: 0, chat: 0, "chat-archive": 0 },
|
|
817
830
|
notification: null,
|
|
818
831
|
notificationHistory: [],
|
|
819
832
|
agentInsights: [],
|
|
@@ -976,7 +989,7 @@ function Footer() {
|
|
|
976
989
|
" (",
|
|
977
990
|
unreadNudgesCount,
|
|
978
991
|
")"
|
|
979
|
-
] }) : /* @__PURE__ */ jsx3(Text2, {
|
|
992
|
+
] }) : /* @__PURE__ */ jsx3(Text2, { color: "green", children: labels[v] }),
|
|
980
993
|
!isLast && /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: " \xB7 " })
|
|
981
994
|
] }, v);
|
|
982
995
|
}) }),
|
|
@@ -992,7 +1005,7 @@ function Footer() {
|
|
|
992
1005
|
const isCurrent = v === view;
|
|
993
1006
|
const isLast = idx === TAB_VIEWS.length - 1;
|
|
994
1007
|
return /* @__PURE__ */ jsxs2(React2.Fragment, { children: [
|
|
995
|
-
isCurrent ? /* @__PURE__ */ jsx3(Text2, { color: "
|
|
1008
|
+
isCurrent ? /* @__PURE__ */ jsx3(Text2, { color: "white", bold: true, children: labels[v] }) : isAgent && hasUnreadNudges ? /* @__PURE__ */ jsxs2(Text2, { color: "yellow", bold: true, children: [
|
|
996
1009
|
labels[v],
|
|
997
1010
|
" (",
|
|
998
1011
|
unreadNudgesCount,
|
|
@@ -1360,7 +1373,7 @@ var VIEW_HELP = {
|
|
|
1360
1373
|
{ key: "q / esc", description: "Quit" }
|
|
1361
1374
|
]
|
|
1362
1375
|
};
|
|
1363
|
-
function HelpDialog({ view
|
|
1376
|
+
function HelpDialog({ view }) {
|
|
1364
1377
|
const shortcuts = VIEW_HELP[view] || VIEW_HELP.overview;
|
|
1365
1378
|
const viewName = view.charAt(0).toUpperCase() + view.slice(1);
|
|
1366
1379
|
return /* @__PURE__ */ jsxs5(
|
|
@@ -1575,7 +1588,7 @@ function AgentView() {
|
|
|
1575
1588
|
const { decisions, patterns, loaded } = agentBrain;
|
|
1576
1589
|
useEffect(() => {
|
|
1577
1590
|
if (agentInsights.length > 0 || visibleInsights.length > 0) {
|
|
1578
|
-
console.
|
|
1591
|
+
console.debug("[AgentView Debug]", {
|
|
1579
1592
|
totalInsights: agentInsights.length,
|
|
1580
1593
|
visibleInsights: visibleInsights.length,
|
|
1581
1594
|
alerts: alerts.length,
|
|
@@ -1615,7 +1628,7 @@ function AgentView() {
|
|
|
1615
1628
|
if (!insight) return;
|
|
1616
1629
|
try {
|
|
1617
1630
|
const workDir = getWorkingDirectory(void 0, true);
|
|
1618
|
-
const { getInsightStore } = await import("./insight-store-
|
|
1631
|
+
const { getInsightStore } = await import("./insight-store-F5KDBY5Y.js");
|
|
1619
1632
|
const store = getInsightStore(workDir);
|
|
1620
1633
|
await store.dismissInsight(insight.id);
|
|
1621
1634
|
} catch (error) {
|
|
@@ -1855,7 +1868,7 @@ function GoalsView() {
|
|
|
1855
1868
|
return;
|
|
1856
1869
|
}
|
|
1857
1870
|
for (const goal of achieved) {
|
|
1858
|
-
await agentState.
|
|
1871
|
+
await agentState.updateGoal(goal.id, { status: "rejected" });
|
|
1859
1872
|
}
|
|
1860
1873
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Cleared ${achieved.length} achieved goal${achieved.length > 1 ? "s" : ""}`, severity: "info", autoHideMs: 3e3 });
|
|
1861
1874
|
dispatch({ type: "ADD_ACTIVITY", message: `Cleared ${achieved.length} achieved goal${achieved.length > 1 ? "s" : ""}` });
|
|
@@ -1872,7 +1885,7 @@ function GoalsView() {
|
|
|
1872
1885
|
if (!goal) return;
|
|
1873
1886
|
dispatch({ type: "ADD_ACTIVITY", message: `Checking goal: ${goal.description.slice(0, 30)}...` });
|
|
1874
1887
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Scanning files for violations...`, severity: "info", autoHideMs: 3e3 });
|
|
1875
|
-
const { checkFilesForGoalViolations } = await import("./goal-validator-
|
|
1888
|
+
const { checkFilesForGoalViolations } = await import("./goal-validator-CKFKJ46J.js");
|
|
1876
1889
|
const violations = await checkFilesForGoalViolations([goal], workDir);
|
|
1877
1890
|
if (violations.length === 0) {
|
|
1878
1891
|
dispatch({ type: "SHOW_NOTIFICATION", message: `\u2713 No violations found for: ${goal.description.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -1884,13 +1897,11 @@ function GoalsView() {
|
|
|
1884
1897
|
dispatch({ type: "ADD_INSIGHTS", insights: [{
|
|
1885
1898
|
id: `scan-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
1886
1899
|
message: violation.message,
|
|
1887
|
-
severity: violation.severity,
|
|
1888
1900
|
timestamp: Date.now(),
|
|
1889
|
-
category: "
|
|
1901
|
+
category: "quality",
|
|
1890
1902
|
type: "warning",
|
|
1891
1903
|
dismissed: false,
|
|
1892
1904
|
priority: violation.severity === "critical" ? 9 : 6,
|
|
1893
|
-
file: violation.file,
|
|
1894
1905
|
relatedIssues: []
|
|
1895
1906
|
}] });
|
|
1896
1907
|
}
|
|
@@ -2071,7 +2082,7 @@ function HypothesesView() {
|
|
|
2071
2082
|
if (!hypo) return;
|
|
2072
2083
|
dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement.slice(0, 30)}...` });
|
|
2073
2084
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
|
|
2074
|
-
const { gatherEvidenceForHypothesis } = await import("./hypothesis-
|
|
2085
|
+
const { gatherEvidenceForHypothesis } = await import("./hypothesis-HFYZNIMZ.js");
|
|
2075
2086
|
const evidence = await gatherEvidenceForHypothesis(hypoId, workDir);
|
|
2076
2087
|
if (evidence.length === 0) {
|
|
2077
2088
|
dispatch({ type: "SHOW_NOTIFICATION", message: `No evidence found for: ${hypo.statement.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -2891,34 +2902,35 @@ var ExtractionPipeline = class {
|
|
|
2891
2902
|
* Process raw content through the entire pipeline
|
|
2892
2903
|
*/
|
|
2893
2904
|
async process(content, context) {
|
|
2894
|
-
|
|
2905
|
+
const outputManager = getOutputManager();
|
|
2906
|
+
outputManager.debug("Extracting signals from content...");
|
|
2895
2907
|
let extractedSignal = await this.extractor.extract(content, context.sourceType, context.sourceId);
|
|
2896
2908
|
extractedSignal = this.addIds(extractedSignal, context);
|
|
2897
|
-
|
|
2898
|
-
|
|
2909
|
+
outputManager.debug(`Extracted ${extractedSignal.decisions.length} decisions, ${extractedSignal.facts.length} facts, ${extractedSignal.blockers.length} blockers, ${extractedSignal.questions.length} questions`);
|
|
2910
|
+
outputManager.debug("Enriching with metadata...");
|
|
2899
2911
|
const { metadata: enrichedMeta } = await this.enricher.enrichSignal(extractedSignal, {
|
|
2900
2912
|
workingDirectory: this.workDir
|
|
2901
2913
|
});
|
|
2902
2914
|
if (enrichedMeta.expandedTags.length > 0) {
|
|
2903
|
-
|
|
2915
|
+
outputManager.debug(`Expanded tags: ${enrichedMeta.expandedTags.slice(0, 5).join(", ")}${enrichedMeta.expandedTags.length > 5 ? "..." : ""}`);
|
|
2904
2916
|
}
|
|
2905
2917
|
if (enrichedMeta.dependencies.length > 0) {
|
|
2906
|
-
|
|
2918
|
+
outputManager.debug(`Dependencies: ${enrichedMeta.dependencies.join(", ")}`);
|
|
2907
2919
|
}
|
|
2908
2920
|
if (enrichedMeta.codebaseArea.length > 0) {
|
|
2909
|
-
|
|
2921
|
+
outputManager.debug(`Codebase areas: ${enrichedMeta.codebaseArea.join(", ")}`);
|
|
2910
2922
|
}
|
|
2911
2923
|
if (enrichedMeta.domain.length > 0) {
|
|
2912
|
-
|
|
2924
|
+
outputManager.debug(`Domains: ${enrichedMeta.domain.join(", ")}`);
|
|
2913
2925
|
}
|
|
2914
|
-
|
|
2926
|
+
outputManager.debug("Storing in decision ledger...");
|
|
2915
2927
|
await this.storage.storeSignal(extractedSignal, {
|
|
2916
2928
|
expandedTags: enrichedMeta.expandedTags,
|
|
2917
2929
|
dependencies: enrichedMeta.dependencies,
|
|
2918
2930
|
codebaseArea: enrichedMeta.codebaseArea,
|
|
2919
2931
|
domain: enrichedMeta.domain
|
|
2920
2932
|
});
|
|
2921
|
-
|
|
2933
|
+
outputManager.debug("Successfully stored in decision ledger");
|
|
2922
2934
|
return extractedSignal;
|
|
2923
2935
|
}
|
|
2924
2936
|
/**
|
|
@@ -4987,166 +4999,167 @@ var CHAT_TOOLS = [
|
|
|
4987
4999
|
async function executeTool(name, input) {
|
|
4988
5000
|
const directory = getWorkingDirectory(void 0, true);
|
|
4989
5001
|
const withDir = { ...input, directory };
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
case "trie_feedback": {
|
|
4997
|
-
const tool = new TrieFeedbackTool();
|
|
4998
|
-
const result = await tool.execute(withDir);
|
|
4999
|
-
return textFromResult(result);
|
|
5000
|
-
}
|
|
5001
|
-
case "trie_check": {
|
|
5002
|
-
const tool = new TrieCheckTool();
|
|
5003
|
-
const result = await tool.execute(withDir);
|
|
5004
|
-
return textFromResult(result);
|
|
5005
|
-
}
|
|
5006
|
-
case "trie_explain": {
|
|
5007
|
-
const tool = new TrieExplainTool();
|
|
5008
|
-
const result = await tool.execute(input);
|
|
5009
|
-
return textFromResult(result);
|
|
5010
|
-
}
|
|
5011
|
-
case "trie_get_decisions": {
|
|
5012
|
-
const tool = new TrieGetDecisionsTool();
|
|
5013
|
-
const result = await tool.execute(withDir);
|
|
5014
|
-
return textFromResult(result);
|
|
5015
|
-
}
|
|
5016
|
-
case "trie_get_blockers": {
|
|
5017
|
-
const tool = new TrieGetBlockersTool();
|
|
5018
|
-
const result = await tool.execute(withDir);
|
|
5019
|
-
return textFromResult(result);
|
|
5020
|
-
}
|
|
5021
|
-
case "trie_query_context": {
|
|
5022
|
-
const tool = new TrieQueryContextTool();
|
|
5023
|
-
const result = await tool.execute(withDir);
|
|
5024
|
-
return textFromResult(result);
|
|
5025
|
-
}
|
|
5026
|
-
case "trie_checkpoint": {
|
|
5027
|
-
const result = await handleCheckpointTool(input);
|
|
5028
|
-
return result;
|
|
5029
|
-
}
|
|
5030
|
-
case "trie_add_goal": {
|
|
5031
|
-
const desc = String(input.description || "").trim();
|
|
5032
|
-
if (!desc) return "Goal description is required.";
|
|
5033
|
-
const category = input.category || "general";
|
|
5034
|
-
const agentState = getGuardianState(directory);
|
|
5035
|
-
await agentState.load();
|
|
5036
|
-
const goal = {
|
|
5037
|
-
id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5038
|
-
description: desc,
|
|
5039
|
-
type: "custom",
|
|
5040
|
-
metric: "progress",
|
|
5041
|
-
target: 100,
|
|
5042
|
-
currentValue: 0,
|
|
5043
|
-
startValue: 0,
|
|
5044
|
-
status: "active",
|
|
5045
|
-
autoGenerated: false,
|
|
5046
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5047
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5048
|
-
deadline: new Date(Date.now() + 14 * 864e5).toISOString(),
|
|
5049
|
-
category
|
|
5050
|
-
};
|
|
5051
|
-
await agentState.addGoal(goal);
|
|
5052
|
-
return `Goal created: "${desc}" [${category}]`;
|
|
5053
|
-
}
|
|
5054
|
-
case "trie_add_hypothesis": {
|
|
5055
|
-
const stmt = String(input.statement || "").trim();
|
|
5056
|
-
if (!stmt) return "Hypothesis statement is required.";
|
|
5057
|
-
const category = input.category || "general";
|
|
5058
|
-
const agentState = getGuardianState(directory);
|
|
5059
|
-
await agentState.load();
|
|
5060
|
-
const hypothesis = {
|
|
5061
|
-
id: `hyp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5062
|
-
statement: stmt,
|
|
5063
|
-
confidence: 0.5,
|
|
5064
|
-
status: "proposed",
|
|
5065
|
-
evidence: [],
|
|
5066
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5067
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5068
|
-
testCriteria: String(input.test_criteria || "Collect evidence from scans"),
|
|
5069
|
-
category
|
|
5070
|
-
};
|
|
5071
|
-
await agentState.addHypothesis(hypothesis);
|
|
5072
|
-
return `Hypothesis created: "${stmt}" [${category}]`;
|
|
5073
|
-
}
|
|
5074
|
-
case "trie_delete_incident": {
|
|
5075
|
-
const search = String(input.search || "").trim().toLowerCase();
|
|
5076
|
-
if (!search) return "Search text is required to find the incident.";
|
|
5077
|
-
const graph = new ContextGraph(directory);
|
|
5078
|
-
const nodes = await graph.listNodes();
|
|
5079
|
-
const incidents = nodes.filter(
|
|
5080
|
-
(n) => n.type === "incident" && n.data.description?.toLowerCase().includes(search)
|
|
5081
|
-
);
|
|
5082
|
-
if (incidents.length === 0) return `No incidents found matching "${search}".`;
|
|
5083
|
-
for (const inc of incidents) {
|
|
5084
|
-
await graph.deleteNode("incident", inc.id);
|
|
5002
|
+
try {
|
|
5003
|
+
switch (name) {
|
|
5004
|
+
case "trie_tell": {
|
|
5005
|
+
const tool = new TrieTellTool();
|
|
5006
|
+
const result = await tool.execute(withDir);
|
|
5007
|
+
return textFromResult(result);
|
|
5085
5008
|
}
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5009
|
+
case "trie_feedback": {
|
|
5010
|
+
const tool = new TrieFeedbackTool();
|
|
5011
|
+
const result = await tool.execute(withDir);
|
|
5012
|
+
return textFromResult(result);
|
|
5013
|
+
}
|
|
5014
|
+
case "trie_check": {
|
|
5015
|
+
const tool = new TrieCheckTool();
|
|
5016
|
+
const result = await tool.execute(withDir);
|
|
5017
|
+
return textFromResult(result);
|
|
5018
|
+
}
|
|
5019
|
+
case "trie_explain": {
|
|
5020
|
+
const tool = new TrieExplainTool();
|
|
5021
|
+
const result = await tool.execute(withDir);
|
|
5022
|
+
return textFromResult(result);
|
|
5023
|
+
}
|
|
5024
|
+
case "trie_get_decisions": {
|
|
5025
|
+
const tool = new TrieGetDecisionsTool();
|
|
5026
|
+
const result = await tool.execute(withDir);
|
|
5027
|
+
return textFromResult(result);
|
|
5028
|
+
}
|
|
5029
|
+
case "trie_get_blockers": {
|
|
5030
|
+
const tool = new TrieGetBlockersTool();
|
|
5031
|
+
const result = await tool.execute(withDir);
|
|
5032
|
+
return textFromResult(result);
|
|
5033
|
+
}
|
|
5034
|
+
case "trie_query_context": {
|
|
5035
|
+
const tool = new TrieQueryContextTool();
|
|
5036
|
+
const result = await tool.execute(withDir);
|
|
5037
|
+
return textFromResult(result);
|
|
5038
|
+
}
|
|
5039
|
+
case "trie_checkpoint": {
|
|
5040
|
+
const result = await handleCheckpointTool(input);
|
|
5041
|
+
return result;
|
|
5042
|
+
}
|
|
5043
|
+
case "trie_add_goal": {
|
|
5044
|
+
const desc = String(input.description || "").trim();
|
|
5045
|
+
if (!desc) return "Goal description is required.";
|
|
5046
|
+
const category = input.category || "general";
|
|
5047
|
+
const agentState = getGuardianState(directory);
|
|
5048
|
+
await agentState.load();
|
|
5049
|
+
const goal = {
|
|
5050
|
+
id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5051
|
+
description: desc,
|
|
5052
|
+
type: "custom",
|
|
5053
|
+
metric: "progress",
|
|
5054
|
+
target: 100,
|
|
5055
|
+
currentValue: 0,
|
|
5056
|
+
startValue: 0,
|
|
5057
|
+
status: "active",
|
|
5058
|
+
autoGenerated: false,
|
|
5059
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5060
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5061
|
+
deadline: new Date(Date.now() + 14 * 864e5).toISOString(),
|
|
5062
|
+
category
|
|
5063
|
+
};
|
|
5064
|
+
await agentState.addGoal(goal);
|
|
5065
|
+
return `Goal created: "${desc}" [${category}]`;
|
|
5066
|
+
}
|
|
5067
|
+
case "trie_add_hypothesis": {
|
|
5068
|
+
const stmt = String(input.statement || "").trim();
|
|
5069
|
+
if (!stmt) return "Hypothesis statement is required.";
|
|
5070
|
+
const category = input.category || "general";
|
|
5071
|
+
const agentState = getGuardianState(directory);
|
|
5072
|
+
await agentState.load();
|
|
5073
|
+
const hypothesis = {
|
|
5074
|
+
id: `hyp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5075
|
+
statement: stmt,
|
|
5076
|
+
confidence: 0.5,
|
|
5077
|
+
status: "proposed",
|
|
5078
|
+
evidence: [],
|
|
5079
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5080
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5081
|
+
testCriteria: String(input.test_criteria || "Collect evidence from scans"),
|
|
5082
|
+
category
|
|
5083
|
+
};
|
|
5084
|
+
await agentState.addHypothesis(hypothesis);
|
|
5085
|
+
return `Hypothesis created: "${stmt}" [${category}]`;
|
|
5086
|
+
}
|
|
5087
|
+
case "trie_delete_incident": {
|
|
5088
|
+
const search = String(input.search || "").trim().toLowerCase();
|
|
5089
|
+
if (!search) return "Search text is required to find the incident.";
|
|
5090
|
+
const graph = new ContextGraph(directory);
|
|
5091
|
+
const nodes = await graph.listNodes();
|
|
5092
|
+
const incidents = nodes.filter(
|
|
5093
|
+
(n) => n.type === "incident" && n.data.description?.toLowerCase().includes(search)
|
|
5094
|
+
);
|
|
5095
|
+
if (incidents.length === 0) return `No incidents found matching "${search}".`;
|
|
5096
|
+
for (const inc of incidents) {
|
|
5097
|
+
await graph.deleteNode("incident", inc.id);
|
|
5122
5098
|
}
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5099
|
+
await exportToJson(graph);
|
|
5100
|
+
const descs = incidents.map((i) => `"${i.data.description.slice(0, 60)}"`);
|
|
5101
|
+
return `Deleted ${incidents.length} incident(s): ${descs.join(", ")}`;
|
|
5102
|
+
}
|
|
5103
|
+
case "trie_add_decision": {
|
|
5104
|
+
const dec = String(input.decision || "").trim();
|
|
5105
|
+
const ctx = String(input.context || "").trim();
|
|
5106
|
+
if (!dec) return "Decision text is required.";
|
|
5107
|
+
if (!ctx) return "Decision context is required.";
|
|
5108
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5109
|
+
const id = `dec-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
5110
|
+
const hash = createHash("sha256").update(`${dec}|${ctx}|${now}`).digest("hex").slice(0, 16);
|
|
5111
|
+
const files = Array.isArray(input.files) ? input.files.map(String) : [];
|
|
5112
|
+
const tags = Array.isArray(input.tags) ? input.tags.map(String) : [];
|
|
5113
|
+
const reasoningStr = input.reasoning ? String(input.reasoning) : null;
|
|
5114
|
+
const decisionObj = {
|
|
5115
|
+
id,
|
|
5116
|
+
decision: dec,
|
|
5117
|
+
context: ctx,
|
|
5118
|
+
when: now,
|
|
5119
|
+
who: "user",
|
|
5120
|
+
files,
|
|
5121
|
+
tags,
|
|
5122
|
+
status: "active",
|
|
5123
|
+
hash,
|
|
5124
|
+
...reasoningStr ? { reasoning: reasoningStr } : {}
|
|
5125
|
+
};
|
|
5126
|
+
const storage = new TieredStorage(directory);
|
|
5127
|
+
await storage.storeSignal({
|
|
5128
|
+
decisions: [decisionObj],
|
|
5129
|
+
facts: [],
|
|
5130
|
+
blockers: [],
|
|
5131
|
+
questions: [],
|
|
5132
|
+
metadata: {
|
|
5133
|
+
extractedAt: now,
|
|
5134
|
+
sourceType: "conversation"
|
|
5135
|
+
}
|
|
5136
|
+
});
|
|
5137
|
+
const graph = new ContextGraph(directory);
|
|
5138
|
+
await graph.addNode("decision", {
|
|
5139
|
+
context: ctx,
|
|
5140
|
+
decision: dec,
|
|
5141
|
+
reasoning: reasoningStr,
|
|
5142
|
+
outcome: "unknown",
|
|
5143
|
+
timestamp: now
|
|
5144
|
+
});
|
|
5145
|
+
return `Decision recorded [${hash}]: "${dec}"`;
|
|
5146
|
+
}
|
|
5147
|
+
case "trie_propose_fix": {
|
|
5148
|
+
const file = String(input.file || "").trim();
|
|
5149
|
+
const goal = String(input.goal || "").trim();
|
|
5150
|
+
const violation = String(input.violation || "").trim();
|
|
5151
|
+
const suggestedFix = input.suggestedFix ? String(input.suggestedFix) : void 0;
|
|
5152
|
+
if (!file) return "File path is required.";
|
|
5153
|
+
if (!goal) return "Goal description is required.";
|
|
5154
|
+
if (!violation) return "Violation description is required.";
|
|
5155
|
+
const fixProposal = {
|
|
5156
|
+
file,
|
|
5157
|
+
goal,
|
|
5158
|
+
violation,
|
|
5159
|
+
suggestedFix,
|
|
5160
|
+
directory
|
|
5161
|
+
};
|
|
5162
|
+
return `I found a violation to fix:
|
|
5150
5163
|
|
|
5151
5164
|
\u{1F4C1} File: ${file}
|
|
5152
5165
|
\u{1F3AF} Goal: ${goal}
|
|
@@ -5158,126 +5171,111 @@ Would you like me to spawn Claude Code to fix this?
|
|
|
5158
5171
|
Type "yes" to proceed, or "no" to cancel.
|
|
5159
5172
|
|
|
5160
5173
|
[PENDING_FIX:${JSON.stringify(fixProposal)}]`;
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5174
|
+
}
|
|
5175
|
+
case "trie_search_files": {
|
|
5176
|
+
const pattern = String(input.pattern || "").trim();
|
|
5177
|
+
const filePattern = input.filePattern ? String(input.filePattern).trim() : void 0;
|
|
5178
|
+
const contextLines = typeof input.contextLines === "number" ? input.contextLines : 2;
|
|
5179
|
+
if (!pattern) return "Search pattern is required.";
|
|
5180
|
+
const { spawnSync } = await import("child_process");
|
|
5181
|
+
try {
|
|
5182
|
+
const rgArgs = [
|
|
5183
|
+
"--context",
|
|
5184
|
+
String(contextLines),
|
|
5185
|
+
"--heading",
|
|
5186
|
+
"--line-number",
|
|
5187
|
+
"--color=never",
|
|
5188
|
+
"--max-count",
|
|
5189
|
+
"50"
|
|
5190
|
+
// Limit matches per file
|
|
5191
|
+
];
|
|
5192
|
+
if (filePattern) {
|
|
5193
|
+
rgArgs.push("--glob", filePattern);
|
|
5194
|
+
}
|
|
5195
|
+
rgArgs.push(
|
|
5196
|
+
"--glob",
|
|
5197
|
+
"!node_modules/**",
|
|
5198
|
+
"--glob",
|
|
5199
|
+
"!.git/**",
|
|
5200
|
+
"--glob",
|
|
5201
|
+
"!dist/**",
|
|
5202
|
+
"--glob",
|
|
5203
|
+
"!build/**",
|
|
5204
|
+
"--glob",
|
|
5205
|
+
"!coverage/**"
|
|
5206
|
+
);
|
|
5207
|
+
rgArgs.push(pattern, directory);
|
|
5208
|
+
const result = spawnSync("rg", rgArgs, {
|
|
5209
|
+
encoding: "utf-8",
|
|
5210
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
5211
|
+
// 10MB
|
|
5212
|
+
cwd: directory
|
|
5213
|
+
});
|
|
5214
|
+
if (result.error) {
|
|
5215
|
+
if (result.error.code === "ENOENT") {
|
|
5216
|
+
return `Error: ripgrep (rg) not found. Please install it:
|
|
5204
5217
|
brew install ripgrep (macOS)
|
|
5205
5218
|
apt install ripgrep (Ubuntu)
|
|
5206
5219
|
Or use trie_scan_for_goal_violations for AI-powered analysis instead.`;
|
|
5220
|
+
}
|
|
5221
|
+
return `Search failed: ${result.error.message}`;
|
|
5207
5222
|
}
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
const output = result.stdout;
|
|
5218
|
-
const truncated = output.length > maxLength ? output.slice(0, maxLength) + `
|
|
5223
|
+
if (result.status === 1 || !result.stdout || !result.stdout.trim()) {
|
|
5224
|
+
return `No matches found for pattern: ${pattern}`;
|
|
5225
|
+
}
|
|
5226
|
+
if (result.status === 2) {
|
|
5227
|
+
return `Search error: ${result.stderr || "Unknown error"}`;
|
|
5228
|
+
}
|
|
5229
|
+
const maxLength = 5e3;
|
|
5230
|
+
const output = result.stdout;
|
|
5231
|
+
const truncated = output.length > maxLength ? output.slice(0, maxLength) + `
|
|
5219
5232
|
|
|
5220
5233
|
... (truncated, ${output.length - maxLength} more characters)` : output;
|
|
5221
|
-
|
|
5222
|
-
|
|
5234
|
+
const matchCount = (output.match(/^\d+:/gm) || []).length;
|
|
5235
|
+
return `Found ${matchCount} match(es) for "${pattern}":
|
|
5223
5236
|
|
|
5224
5237
|
${truncated}`;
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
}
|
|
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.";
|
|
5238
|
+
} catch (error) {
|
|
5239
|
+
return `Search failed: ${error.message}`;
|
|
5239
5240
|
}
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5241
|
+
}
|
|
5242
|
+
case "trie_scan_for_goal_violations": {
|
|
5243
|
+
const goalId = input.goalId ? String(input.goalId).trim() : void 0;
|
|
5244
|
+
try {
|
|
5245
|
+
const { checkFilesForGoalViolations, getActiveGoals } = await import("./goal-validator-CKFKJ46J.js");
|
|
5246
|
+
const agentState = getGuardianState(directory);
|
|
5247
|
+
await agentState.load();
|
|
5248
|
+
const allGoals = await getActiveGoals(directory);
|
|
5249
|
+
const goalsToCheck = goalId ? allGoals.filter((g) => g.id === goalId) : allGoals;
|
|
5250
|
+
if (goalsToCheck.length === 0) {
|
|
5251
|
+
return goalId ? `No active goal found with ID: ${goalId}` : "No active goals to check. Add goals in the Goals view first.";
|
|
5252
|
+
}
|
|
5253
|
+
const violations = await checkFilesForGoalViolations(goalsToCheck, directory);
|
|
5254
|
+
if (violations.length === 0) {
|
|
5255
|
+
return `\u2713 Scan complete! No violations found for ${goalsToCheck.length} goal(s).`;
|
|
5256
|
+
}
|
|
5257
|
+
let result = `Found ${violations.length} violation(s):
|
|
5251
5258
|
|
|
5252
5259
|
`;
|
|
5253
|
-
|
|
5254
|
-
|
|
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}
|
|
5260
|
+
for (const v of violations) {
|
|
5261
|
+
result += `\u26A0\uFE0F ${v.file}
|
|
5261
5262
|
`;
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
`;
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
|
-
if (goalViolations.length > 10) {
|
|
5268
|
-
result += ` ... and ${goalViolations.length - 10} more
|
|
5263
|
+
result += ` ${v.message}
|
|
5264
|
+
|
|
5269
5265
|
`;
|
|
5270
5266
|
}
|
|
5271
|
-
result += "
|
|
5267
|
+
result += "These violations have been recorded and will appear in the Goals view.";
|
|
5268
|
+
return result;
|
|
5269
|
+
} catch (error) {
|
|
5270
|
+
return `Scan failed: ${error.message}`;
|
|
5272
5271
|
}
|
|
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
5272
|
}
|
|
5273
|
+
default:
|
|
5274
|
+
return `Unknown tool: ${name}`;
|
|
5278
5275
|
}
|
|
5279
|
-
|
|
5280
|
-
|
|
5276
|
+
} catch (error) {
|
|
5277
|
+
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
5278
|
+
return `Tool execution failed: ${errorMsg}`;
|
|
5281
5279
|
}
|
|
5282
5280
|
}
|
|
5283
5281
|
|
|
@@ -5311,7 +5309,8 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5311
5309
|
return `- "${g.description}" [${g.category || "general"}]${caughtCount > 0 ? ` - ${caughtCount} violation(s)${lastCaught}` : ""}`;
|
|
5312
5310
|
}).join("\n"));
|
|
5313
5311
|
}
|
|
5314
|
-
} catch {
|
|
5312
|
+
} catch (error) {
|
|
5313
|
+
console.error("Failed to load guardian state:", error);
|
|
5315
5314
|
}
|
|
5316
5315
|
try {
|
|
5317
5316
|
const storage = new TieredStorage(workDir);
|
|
@@ -5322,7 +5321,8 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5322
5321
|
(d) => `- ${d.decision} (${d.when}${d.hash ? `, hash: ${d.hash.slice(0, 8)}` : ""})`
|
|
5323
5322
|
).join("\n"));
|
|
5324
5323
|
}
|
|
5325
|
-
} catch {
|
|
5324
|
+
} catch (error) {
|
|
5325
|
+
console.error("Failed to query decisions:", error);
|
|
5326
5326
|
}
|
|
5327
5327
|
try {
|
|
5328
5328
|
const blockers = await storage.queryBlockers({ limit: 5 });
|
|
@@ -5331,9 +5331,11 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5331
5331
|
(b) => `- ${b.blocker} [${b.impact}]`
|
|
5332
5332
|
).join("\n"));
|
|
5333
5333
|
}
|
|
5334
|
-
} catch {
|
|
5334
|
+
} catch (error) {
|
|
5335
|
+
console.error("Failed to query blockers:", error);
|
|
5335
5336
|
}
|
|
5336
|
-
} catch {
|
|
5337
|
+
} catch (error) {
|
|
5338
|
+
console.error("Storage unavailable:", error);
|
|
5337
5339
|
}
|
|
5338
5340
|
try {
|
|
5339
5341
|
const graph = new ContextGraph(workDir);
|
|
@@ -5365,7 +5367,8 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5365
5367
|
return `- ${d.description} (${Math.round(d.confidence * 100)}%${d.isAntiPattern ? ", anti-pattern" : ""})`;
|
|
5366
5368
|
}).join("\n"));
|
|
5367
5369
|
}
|
|
5368
|
-
} catch {
|
|
5370
|
+
} catch (error) {
|
|
5371
|
+
console.error("Context graph unavailable:", error);
|
|
5369
5372
|
}
|
|
5370
5373
|
return parts.length > 0 ? parts.join("\n\n") : "No context data available yet.";
|
|
5371
5374
|
}
|
|
@@ -5421,7 +5424,7 @@ function ChatView() {
|
|
|
5421
5424
|
const saveChat = async () => {
|
|
5422
5425
|
try {
|
|
5423
5426
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5424
|
-
const { getChatStore: getChatStore2 } = await import("./chat-store-
|
|
5427
|
+
const { getChatStore: getChatStore2 } = await import("./chat-store-HFOOWZYN.js");
|
|
5425
5428
|
const store = getChatStore2(workDir);
|
|
5426
5429
|
const sessionId = await store.saveSession(
|
|
5427
5430
|
messages,
|
|
@@ -5450,9 +5453,12 @@ function ChatView() {
|
|
|
5450
5453
|
if (lastAssistantMessage?.pendingFix) {
|
|
5451
5454
|
const response = question.trim().toLowerCase();
|
|
5452
5455
|
if (response === "yes" || response === "y") {
|
|
5453
|
-
const { spawnClaudeCodeFix } = await import("./terminal-spawn-
|
|
5456
|
+
const { spawnClaudeCodeFix } = await import("./terminal-spawn-P5M5PHAV.js");
|
|
5454
5457
|
try {
|
|
5455
|
-
await spawnClaudeCodeFix(
|
|
5458
|
+
await spawnClaudeCodeFix({
|
|
5459
|
+
...lastAssistantMessage.pendingFix,
|
|
5460
|
+
cwd: lastAssistantMessage.pendingFix.directory
|
|
5461
|
+
});
|
|
5456
5462
|
dispatch({
|
|
5457
5463
|
type: "ADD_CHAT_MESSAGE",
|
|
5458
5464
|
role: "assistant",
|
|
@@ -5549,7 +5555,8 @@ ${contextBlock}`;
|
|
|
5549
5555
|
})
|
|
5550
5556
|
});
|
|
5551
5557
|
}
|
|
5552
|
-
} catch {
|
|
5558
|
+
} catch (error) {
|
|
5559
|
+
console.error("Failed to update state after tool calls:", error);
|
|
5553
5560
|
}
|
|
5554
5561
|
}
|
|
5555
5562
|
}
|
|
@@ -5856,7 +5863,7 @@ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
|
5856
5863
|
var MAIN_VIEWS = ["overview", "memory", "goals", "hypotheses", "agent", "chat"];
|
|
5857
5864
|
async function applyGoalFix(fix, dispatch) {
|
|
5858
5865
|
try {
|
|
5859
|
-
const { runAIAnalysis, isAIAvailable: isAIAvailable2 } = await import("./client-
|
|
5866
|
+
const { runAIAnalysis, isAIAvailable: isAIAvailable2 } = await import("./client-EWP4SIG3.js");
|
|
5860
5867
|
if (!isAIAvailable2()) {
|
|
5861
5868
|
dispatch({ type: "DISMISS_FIX", id: fix.id });
|
|
5862
5869
|
getOutputManager().nudge("AI not available for fix", "warning");
|
|
@@ -5891,7 +5898,7 @@ ${content}
|
|
|
5891
5898
|
fixedContent = fixedContent.replace(/^```\w*\n?/, "").replace(/\n?```$/, "");
|
|
5892
5899
|
}
|
|
5893
5900
|
await writeFile(fullPath, fixedContent, "utf-8");
|
|
5894
|
-
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-
|
|
5901
|
+
const { recordGoalViolationFixed, getActiveGoals } = await import("./goal-validator-CKFKJ46J.js");
|
|
5895
5902
|
const goals = await getActiveGoals(projectPath);
|
|
5896
5903
|
const matchedGoal = goals.find((g) => g.description === fix.goalDescription);
|
|
5897
5904
|
if (matchedGoal) {
|
|
@@ -6008,25 +6015,47 @@ function DashboardApp({ onReady }) {
|
|
|
6008
6015
|
dispatchRef.current({ type: "STREAM_UPDATE", update: { type: "raw_log", data: { time, level, message }, timestamp: Date.now() } });
|
|
6009
6016
|
},
|
|
6010
6017
|
onNudge: (nudge) => {
|
|
6011
|
-
console.
|
|
6018
|
+
console.debug("[Dashboard] Nudge received:", {
|
|
6019
|
+
message: nudge.message.slice(0, 50) + "...",
|
|
6020
|
+
severity: nudge.severity,
|
|
6021
|
+
file: nudge.file,
|
|
6022
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
6023
|
+
});
|
|
6012
6024
|
const action = { type: "SHOW_NOTIFICATION", message: nudge.message, severity: nudge.severity };
|
|
6013
6025
|
if (nudge.file !== void 0) action.file = nudge.file;
|
|
6014
6026
|
if (nudge.autoHideMs !== void 0) action.autoHideMs = nudge.autoHideMs;
|
|
6015
6027
|
dispatchRef.current(action);
|
|
6016
6028
|
if (nudge.severity === "critical" || nudge.severity === "warning") {
|
|
6029
|
+
const isGoalViolation = nudge.message.includes('Goal "') || nudge.message.includes("violated");
|
|
6017
6030
|
const insight = {
|
|
6018
6031
|
id: `nudge-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
6019
6032
|
type: "warning",
|
|
6020
|
-
category: "quality",
|
|
6033
|
+
category: isGoalViolation ? "quality" : "general",
|
|
6021
6034
|
message: nudge.message,
|
|
6022
|
-
priority: nudge.severity === "critical" ? 9 : 6,
|
|
6035
|
+
priority: isGoalViolation ? 8 : nudge.severity === "critical" ? 9 : 6,
|
|
6036
|
+
// Goal violations get priority 8
|
|
6023
6037
|
timestamp: Date.now(),
|
|
6024
6038
|
suggestedAction: nudge.file ? `Review ${nudge.file}` : void 0,
|
|
6025
6039
|
relatedIssues: [],
|
|
6026
6040
|
dismissed: false
|
|
6027
6041
|
};
|
|
6028
|
-
console.
|
|
6042
|
+
console.debug("[Dashboard] Creating insight from nudge:", {
|
|
6043
|
+
id: insight.id,
|
|
6044
|
+
type: insight.type,
|
|
6045
|
+
priority: insight.priority,
|
|
6046
|
+
category: insight.category,
|
|
6047
|
+
isGoalViolation,
|
|
6048
|
+
severity: nudge.severity
|
|
6049
|
+
});
|
|
6029
6050
|
dispatchRef.current({ type: "ADD_INSIGHTS", insights: [insight] });
|
|
6051
|
+
if (isGoalViolation) {
|
|
6052
|
+
console.debug("[Dashboard] Goal violation - extending notification display");
|
|
6053
|
+
const extendedAction = { ...action };
|
|
6054
|
+
if (!extendedAction.autoHideMs || extendedAction.autoHideMs < 15e3) {
|
|
6055
|
+
extendedAction.autoHideMs = 15e3;
|
|
6056
|
+
}
|
|
6057
|
+
dispatchRef.current(extendedAction);
|
|
6058
|
+
}
|
|
6030
6059
|
}
|
|
6031
6060
|
}
|
|
6032
6061
|
});
|
|
@@ -6086,7 +6115,7 @@ function DashboardApp({ onReady }) {
|
|
|
6086
6115
|
}
|
|
6087
6116
|
if (input === "q" || key.escape) {
|
|
6088
6117
|
exit();
|
|
6089
|
-
|
|
6118
|
+
return;
|
|
6090
6119
|
}
|
|
6091
6120
|
if (key.tab) {
|
|
6092
6121
|
const currentIndex = MAIN_VIEWS.indexOf(state.view);
|
|
@@ -6231,4 +6260,4 @@ export {
|
|
|
6231
6260
|
handleCheckpointTool,
|
|
6232
6261
|
InteractiveDashboard
|
|
6233
6262
|
};
|
|
6234
|
-
//# sourceMappingURL=chunk-
|
|
6263
|
+
//# sourceMappingURL=chunk-7J4ZOOAD.js.map
|