@triedotdev/mcp 1.0.122 → 1.0.123
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-7A5RLKZY.js → chunk-B46FDUKR.js} +5 -5
- package/dist/{chunk-3BVNB3GY.js → chunk-CKT2A33R.js} +3 -4
- package/dist/chunk-CKT2A33R.js.map +1 -0
- package/dist/{chunk-HWXZ3E7B.js → chunk-DFPVUMVE.js} +1 -1
- package/dist/chunk-DFPVUMVE.js.map +1 -0
- package/dist/{chunk-ANQPXOT2.js → chunk-QIS2VDJL.js} +289 -297
- package/dist/chunk-QIS2VDJL.js.map +1 -0
- package/dist/{chunk-EOLHWFDG.js → chunk-TRIJC5MW.js} +2 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +6 -6
- package/dist/{goal-manager-O446DRJI.js → goal-manager-RREOIX6U.js} +3 -3
- package/dist/{guardian-agent-KVLNECZ5.js → guardian-agent-PTC6G37Q.js} +5 -5
- package/dist/{hypothesis-QFGZ5ITT.js → hypothesis-WWDONGPU.js} +3 -3
- package/dist/index.js +8 -8
- 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/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/{chat-store-R46BCMBW.js.map → chat-store-HFOOWZYN.js.map} +0 -0
- /package/dist/{chunk-7A5RLKZY.js.map → chunk-B46FDUKR.js.map} +0 -0
- /package/dist/{chunk-EOLHWFDG.js.map → chunk-TRIJC5MW.js.map} +0 -0
- /package/dist/{goal-manager-O446DRJI.js.map → goal-manager-RREOIX6U.js.map} +0 -0
- /package/dist/{guardian-agent-KVLNECZ5.js.map → guardian-agent-PTC6G37Q.js.map} +0 -0
- /package/dist/{hypothesis-QFGZ5ITT.js.map → hypothesis-WWDONGPU.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-B46FDUKR.js";
|
|
4
4
|
import {
|
|
5
5
|
getChatStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DFPVUMVE.js";
|
|
7
7
|
import {
|
|
8
8
|
LearningEngine,
|
|
9
9
|
exportToJson,
|
|
@@ -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,
|
|
@@ -813,7 +813,7 @@ function createInitialState() {
|
|
|
813
813
|
watch: { watching: false, directories: 0, recentChanges: [], filesScannedSession: 0 },
|
|
814
814
|
rawLog: [],
|
|
815
815
|
rawLogPage: 0,
|
|
816
|
-
scrollPositions: { overview: 0, rawlog: 0, agent: 0, goals: 0, hypotheses: 0, memory: 0, chat: 0 },
|
|
816
|
+
scrollPositions: { overview: 0, rawlog: 0, agent: 0, goals: 0, hypotheses: 0, memory: 0, chat: 0, "chat-archive": 0 },
|
|
817
817
|
notification: null,
|
|
818
818
|
notificationHistory: [],
|
|
819
819
|
agentInsights: [],
|
|
@@ -976,7 +976,7 @@ function Footer() {
|
|
|
976
976
|
" (",
|
|
977
977
|
unreadNudgesCount,
|
|
978
978
|
")"
|
|
979
|
-
] }) : /* @__PURE__ */ jsx3(Text2, {
|
|
979
|
+
] }) : /* @__PURE__ */ jsx3(Text2, { color: "green", children: labels[v] }),
|
|
980
980
|
!isLast && /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: " \xB7 " })
|
|
981
981
|
] }, v);
|
|
982
982
|
}) }),
|
|
@@ -997,7 +997,7 @@ function Footer() {
|
|
|
997
997
|
" (",
|
|
998
998
|
unreadNudgesCount,
|
|
999
999
|
")"
|
|
1000
|
-
] }) : /* @__PURE__ */ jsx3(Text2, {
|
|
1000
|
+
] }) : /* @__PURE__ */ jsx3(Text2, { color: "green", children: labels[v] }),
|
|
1001
1001
|
!isLast && /* @__PURE__ */ jsx3(Text2, { dimColor: true, children: " \xB7 " })
|
|
1002
1002
|
] }, v);
|
|
1003
1003
|
}) }),
|
|
@@ -1360,7 +1360,7 @@ var VIEW_HELP = {
|
|
|
1360
1360
|
{ key: "q / esc", description: "Quit" }
|
|
1361
1361
|
]
|
|
1362
1362
|
};
|
|
1363
|
-
function HelpDialog({ view
|
|
1363
|
+
function HelpDialog({ view }) {
|
|
1364
1364
|
const shortcuts = VIEW_HELP[view] || VIEW_HELP.overview;
|
|
1365
1365
|
const viewName = view.charAt(0).toUpperCase() + view.slice(1);
|
|
1366
1366
|
return /* @__PURE__ */ jsxs5(
|
|
@@ -1575,7 +1575,7 @@ function AgentView() {
|
|
|
1575
1575
|
const { decisions, patterns, loaded } = agentBrain;
|
|
1576
1576
|
useEffect(() => {
|
|
1577
1577
|
if (agentInsights.length > 0 || visibleInsights.length > 0) {
|
|
1578
|
-
console.
|
|
1578
|
+
console.debug("[AgentView Debug]", {
|
|
1579
1579
|
totalInsights: agentInsights.length,
|
|
1580
1580
|
visibleInsights: visibleInsights.length,
|
|
1581
1581
|
alerts: alerts.length,
|
|
@@ -1615,7 +1615,7 @@ function AgentView() {
|
|
|
1615
1615
|
if (!insight) return;
|
|
1616
1616
|
try {
|
|
1617
1617
|
const workDir = getWorkingDirectory(void 0, true);
|
|
1618
|
-
const { getInsightStore } = await import("./insight-store-
|
|
1618
|
+
const { getInsightStore } = await import("./insight-store-F5KDBY5Y.js");
|
|
1619
1619
|
const store = getInsightStore(workDir);
|
|
1620
1620
|
await store.dismissInsight(insight.id);
|
|
1621
1621
|
} catch (error) {
|
|
@@ -1855,7 +1855,7 @@ function GoalsView() {
|
|
|
1855
1855
|
return;
|
|
1856
1856
|
}
|
|
1857
1857
|
for (const goal of achieved) {
|
|
1858
|
-
await agentState.
|
|
1858
|
+
await agentState.updateGoal(goal.id, { status: "rejected" });
|
|
1859
1859
|
}
|
|
1860
1860
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Cleared ${achieved.length} achieved goal${achieved.length > 1 ? "s" : ""}`, severity: "info", autoHideMs: 3e3 });
|
|
1861
1861
|
dispatch({ type: "ADD_ACTIVITY", message: `Cleared ${achieved.length} achieved goal${achieved.length > 1 ? "s" : ""}` });
|
|
@@ -1884,13 +1884,11 @@ function GoalsView() {
|
|
|
1884
1884
|
dispatch({ type: "ADD_INSIGHTS", insights: [{
|
|
1885
1885
|
id: `scan-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
1886
1886
|
message: violation.message,
|
|
1887
|
-
severity: violation.severity,
|
|
1888
1887
|
timestamp: Date.now(),
|
|
1889
|
-
category: "
|
|
1888
|
+
category: "quality",
|
|
1890
1889
|
type: "warning",
|
|
1891
1890
|
dismissed: false,
|
|
1892
1891
|
priority: violation.severity === "critical" ? 9 : 6,
|
|
1893
|
-
file: violation.file,
|
|
1894
1892
|
relatedIssues: []
|
|
1895
1893
|
}] });
|
|
1896
1894
|
}
|
|
@@ -2071,7 +2069,7 @@ function HypothesesView() {
|
|
|
2071
2069
|
if (!hypo) return;
|
|
2072
2070
|
dispatch({ type: "ADD_ACTIVITY", message: `Testing hypothesis: ${hypo.statement.slice(0, 30)}...` });
|
|
2073
2071
|
dispatch({ type: "SHOW_NOTIFICATION", message: `Gathering evidence for hypothesis...`, severity: "info", autoHideMs: 3e3 });
|
|
2074
|
-
const { gatherEvidenceForHypothesis } = await import("./hypothesis-
|
|
2072
|
+
const { gatherEvidenceForHypothesis } = await import("./hypothesis-WWDONGPU.js");
|
|
2075
2073
|
const evidence = await gatherEvidenceForHypothesis(hypoId, workDir);
|
|
2076
2074
|
if (evidence.length === 0) {
|
|
2077
2075
|
dispatch({ type: "SHOW_NOTIFICATION", message: `No evidence found for: ${hypo.statement.slice(0, 40)}`, severity: "info", autoHideMs: 5e3 });
|
|
@@ -2891,34 +2889,35 @@ var ExtractionPipeline = class {
|
|
|
2891
2889
|
* Process raw content through the entire pipeline
|
|
2892
2890
|
*/
|
|
2893
2891
|
async process(content, context) {
|
|
2894
|
-
|
|
2892
|
+
const outputManager = getOutputManager();
|
|
2893
|
+
outputManager.debug("Extracting signals from content...");
|
|
2895
2894
|
let extractedSignal = await this.extractor.extract(content, context.sourceType, context.sourceId);
|
|
2896
2895
|
extractedSignal = this.addIds(extractedSignal, context);
|
|
2897
|
-
|
|
2898
|
-
|
|
2896
|
+
outputManager.debug(`Extracted ${extractedSignal.decisions.length} decisions, ${extractedSignal.facts.length} facts, ${extractedSignal.blockers.length} blockers, ${extractedSignal.questions.length} questions`);
|
|
2897
|
+
outputManager.debug("Enriching with metadata...");
|
|
2899
2898
|
const { metadata: enrichedMeta } = await this.enricher.enrichSignal(extractedSignal, {
|
|
2900
2899
|
workingDirectory: this.workDir
|
|
2901
2900
|
});
|
|
2902
2901
|
if (enrichedMeta.expandedTags.length > 0) {
|
|
2903
|
-
|
|
2902
|
+
outputManager.debug(`Expanded tags: ${enrichedMeta.expandedTags.slice(0, 5).join(", ")}${enrichedMeta.expandedTags.length > 5 ? "..." : ""}`);
|
|
2904
2903
|
}
|
|
2905
2904
|
if (enrichedMeta.dependencies.length > 0) {
|
|
2906
|
-
|
|
2905
|
+
outputManager.debug(`Dependencies: ${enrichedMeta.dependencies.join(", ")}`);
|
|
2907
2906
|
}
|
|
2908
2907
|
if (enrichedMeta.codebaseArea.length > 0) {
|
|
2909
|
-
|
|
2908
|
+
outputManager.debug(`Codebase areas: ${enrichedMeta.codebaseArea.join(", ")}`);
|
|
2910
2909
|
}
|
|
2911
2910
|
if (enrichedMeta.domain.length > 0) {
|
|
2912
|
-
|
|
2911
|
+
outputManager.debug(`Domains: ${enrichedMeta.domain.join(", ")}`);
|
|
2913
2912
|
}
|
|
2914
|
-
|
|
2913
|
+
outputManager.debug("Storing in decision ledger...");
|
|
2915
2914
|
await this.storage.storeSignal(extractedSignal, {
|
|
2916
2915
|
expandedTags: enrichedMeta.expandedTags,
|
|
2917
2916
|
dependencies: enrichedMeta.dependencies,
|
|
2918
2917
|
codebaseArea: enrichedMeta.codebaseArea,
|
|
2919
2918
|
domain: enrichedMeta.domain
|
|
2920
2919
|
});
|
|
2921
|
-
|
|
2920
|
+
outputManager.debug("Successfully stored in decision ledger");
|
|
2922
2921
|
return extractedSignal;
|
|
2923
2922
|
}
|
|
2924
2923
|
/**
|
|
@@ -4987,166 +4986,167 @@ var CHAT_TOOLS = [
|
|
|
4987
4986
|
async function executeTool(name, input) {
|
|
4988
4987
|
const directory = getWorkingDirectory(void 0, true);
|
|
4989
4988
|
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);
|
|
4989
|
+
try {
|
|
4990
|
+
switch (name) {
|
|
4991
|
+
case "trie_tell": {
|
|
4992
|
+
const tool = new TrieTellTool();
|
|
4993
|
+
const result = await tool.execute(withDir);
|
|
4994
|
+
return textFromResult(result);
|
|
5085
4995
|
}
|
|
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
|
-
|
|
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(withDir);
|
|
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);
|
|
5122
5085
|
}
|
|
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
|
-
|
|
5086
|
+
await exportToJson(graph);
|
|
5087
|
+
const descs = incidents.map((i) => `"${i.data.description.slice(0, 60)}"`);
|
|
5088
|
+
return `Deleted ${incidents.length} incident(s): ${descs.join(", ")}`;
|
|
5089
|
+
}
|
|
5090
|
+
case "trie_add_decision": {
|
|
5091
|
+
const dec = String(input.decision || "").trim();
|
|
5092
|
+
const ctx = String(input.context || "").trim();
|
|
5093
|
+
if (!dec) return "Decision text is required.";
|
|
5094
|
+
if (!ctx) return "Decision context is required.";
|
|
5095
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5096
|
+
const id = `dec-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
5097
|
+
const hash = createHash("sha256").update(`${dec}|${ctx}|${now}`).digest("hex").slice(0, 16);
|
|
5098
|
+
const files = Array.isArray(input.files) ? input.files.map(String) : [];
|
|
5099
|
+
const tags = Array.isArray(input.tags) ? input.tags.map(String) : [];
|
|
5100
|
+
const reasoningStr = input.reasoning ? String(input.reasoning) : null;
|
|
5101
|
+
const decisionObj = {
|
|
5102
|
+
id,
|
|
5103
|
+
decision: dec,
|
|
5104
|
+
context: ctx,
|
|
5105
|
+
when: now,
|
|
5106
|
+
who: "user",
|
|
5107
|
+
files,
|
|
5108
|
+
tags,
|
|
5109
|
+
status: "active",
|
|
5110
|
+
hash,
|
|
5111
|
+
...reasoningStr ? { reasoning: reasoningStr } : {}
|
|
5112
|
+
};
|
|
5113
|
+
const storage = new TieredStorage(directory);
|
|
5114
|
+
await storage.storeSignal({
|
|
5115
|
+
decisions: [decisionObj],
|
|
5116
|
+
facts: [],
|
|
5117
|
+
blockers: [],
|
|
5118
|
+
questions: [],
|
|
5119
|
+
metadata: {
|
|
5120
|
+
extractedAt: now,
|
|
5121
|
+
sourceType: "conversation"
|
|
5122
|
+
}
|
|
5123
|
+
});
|
|
5124
|
+
const graph = new ContextGraph(directory);
|
|
5125
|
+
await graph.addNode("decision", {
|
|
5126
|
+
context: ctx,
|
|
5127
|
+
decision: dec,
|
|
5128
|
+
reasoning: reasoningStr,
|
|
5129
|
+
outcome: "unknown",
|
|
5130
|
+
timestamp: now
|
|
5131
|
+
});
|
|
5132
|
+
return `Decision recorded [${hash}]: "${dec}"`;
|
|
5133
|
+
}
|
|
5134
|
+
case "trie_propose_fix": {
|
|
5135
|
+
const file = String(input.file || "").trim();
|
|
5136
|
+
const goal = String(input.goal || "").trim();
|
|
5137
|
+
const violation = String(input.violation || "").trim();
|
|
5138
|
+
const suggestedFix = input.suggestedFix ? String(input.suggestedFix) : void 0;
|
|
5139
|
+
if (!file) return "File path is required.";
|
|
5140
|
+
if (!goal) return "Goal description is required.";
|
|
5141
|
+
if (!violation) return "Violation description is required.";
|
|
5142
|
+
const fixProposal = {
|
|
5143
|
+
file,
|
|
5144
|
+
goal,
|
|
5145
|
+
violation,
|
|
5146
|
+
suggestedFix,
|
|
5147
|
+
directory
|
|
5148
|
+
};
|
|
5149
|
+
return `I found a violation to fix:
|
|
5150
5150
|
|
|
5151
5151
|
\u{1F4C1} File: ${file}
|
|
5152
5152
|
\u{1F3AF} Goal: ${goal}
|
|
@@ -5158,126 +5158,111 @@ Would you like me to spawn Claude Code to fix this?
|
|
|
5158
5158
|
Type "yes" to proceed, or "no" to cancel.
|
|
5159
5159
|
|
|
5160
5160
|
[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
|
-
|
|
5161
|
+
}
|
|
5162
|
+
case "trie_search_files": {
|
|
5163
|
+
const pattern = String(input.pattern || "").trim();
|
|
5164
|
+
const filePattern = input.filePattern ? String(input.filePattern).trim() : void 0;
|
|
5165
|
+
const contextLines = typeof input.contextLines === "number" ? input.contextLines : 2;
|
|
5166
|
+
if (!pattern) return "Search pattern is required.";
|
|
5167
|
+
const { spawnSync } = await import("child_process");
|
|
5168
|
+
try {
|
|
5169
|
+
const rgArgs = [
|
|
5170
|
+
"--context",
|
|
5171
|
+
String(contextLines),
|
|
5172
|
+
"--heading",
|
|
5173
|
+
"--line-number",
|
|
5174
|
+
"--color=never",
|
|
5175
|
+
"--max-count",
|
|
5176
|
+
"50"
|
|
5177
|
+
// Limit matches per file
|
|
5178
|
+
];
|
|
5179
|
+
if (filePattern) {
|
|
5180
|
+
rgArgs.push("--glob", filePattern);
|
|
5181
|
+
}
|
|
5182
|
+
rgArgs.push(
|
|
5183
|
+
"--glob",
|
|
5184
|
+
"!node_modules/**",
|
|
5185
|
+
"--glob",
|
|
5186
|
+
"!.git/**",
|
|
5187
|
+
"--glob",
|
|
5188
|
+
"!dist/**",
|
|
5189
|
+
"--glob",
|
|
5190
|
+
"!build/**",
|
|
5191
|
+
"--glob",
|
|
5192
|
+
"!coverage/**"
|
|
5193
|
+
);
|
|
5194
|
+
rgArgs.push(pattern, directory);
|
|
5195
|
+
const result = spawnSync("rg", rgArgs, {
|
|
5196
|
+
encoding: "utf-8",
|
|
5197
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
5198
|
+
// 10MB
|
|
5199
|
+
cwd: directory
|
|
5200
|
+
});
|
|
5201
|
+
if (result.error) {
|
|
5202
|
+
if (result.error.code === "ENOENT") {
|
|
5203
|
+
return `Error: ripgrep (rg) not found. Please install it:
|
|
5204
5204
|
brew install ripgrep (macOS)
|
|
5205
5205
|
apt install ripgrep (Ubuntu)
|
|
5206
5206
|
Or use trie_scan_for_goal_violations for AI-powered analysis instead.`;
|
|
5207
|
+
}
|
|
5208
|
+
return `Search failed: ${result.error.message}`;
|
|
5207
5209
|
}
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
const output = result.stdout;
|
|
5218
|
-
const truncated = output.length > maxLength ? output.slice(0, maxLength) + `
|
|
5210
|
+
if (result.status === 1 || !result.stdout || !result.stdout.trim()) {
|
|
5211
|
+
return `No matches found for pattern: ${pattern}`;
|
|
5212
|
+
}
|
|
5213
|
+
if (result.status === 2) {
|
|
5214
|
+
return `Search error: ${result.stderr || "Unknown error"}`;
|
|
5215
|
+
}
|
|
5216
|
+
const maxLength = 5e3;
|
|
5217
|
+
const output = result.stdout;
|
|
5218
|
+
const truncated = output.length > maxLength ? output.slice(0, maxLength) + `
|
|
5219
5219
|
|
|
5220
5220
|
... (truncated, ${output.length - maxLength} more characters)` : output;
|
|
5221
|
-
|
|
5222
|
-
|
|
5221
|
+
const matchCount = (output.match(/^\d+:/gm) || []).length;
|
|
5222
|
+
return `Found ${matchCount} match(es) for "${pattern}":
|
|
5223
5223
|
|
|
5224
5224
|
${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.";
|
|
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).`;
|
|
5225
|
+
} catch (error) {
|
|
5226
|
+
return `Search failed: ${error.message}`;
|
|
5243
5227
|
}
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
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(goalsToCheck, directory);
|
|
5241
|
+
if (violations.length === 0) {
|
|
5242
|
+
return `\u2713 Scan complete! No violations found for ${goalsToCheck.length} goal(s).`;
|
|
5243
|
+
}
|
|
5244
|
+
let result = `Found ${violations.length} violation(s):
|
|
5251
5245
|
|
|
5252
5246
|
`;
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
result += `\u{1F3AF} Goal: ${goal?.description || goalId2}
|
|
5256
|
-
`;
|
|
5257
|
-
result += ` ${goalViolations.length} violation(s):
|
|
5247
|
+
for (const v of violations) {
|
|
5248
|
+
result += `\u26A0\uFE0F ${v.file}
|
|
5258
5249
|
`;
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
`;
|
|
5262
|
-
if (v.description) {
|
|
5263
|
-
result += ` ${v.description}
|
|
5264
|
-
`;
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
|
-
if (goalViolations.length > 10) {
|
|
5268
|
-
result += ` ... and ${goalViolations.length - 10} more
|
|
5250
|
+
result += ` ${v.message}
|
|
5251
|
+
|
|
5269
5252
|
`;
|
|
5270
5253
|
}
|
|
5271
|
-
result += "
|
|
5254
|
+
result += "These violations have been recorded and will appear in the Goals view.";
|
|
5255
|
+
return result;
|
|
5256
|
+
} catch (error) {
|
|
5257
|
+
return `Scan failed: ${error.message}`;
|
|
5272
5258
|
}
|
|
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
5259
|
}
|
|
5260
|
+
default:
|
|
5261
|
+
return `Unknown tool: ${name}`;
|
|
5278
5262
|
}
|
|
5279
|
-
|
|
5280
|
-
|
|
5263
|
+
} catch (error) {
|
|
5264
|
+
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
5265
|
+
return `Tool execution failed: ${errorMsg}`;
|
|
5281
5266
|
}
|
|
5282
5267
|
}
|
|
5283
5268
|
|
|
@@ -5311,7 +5296,8 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5311
5296
|
return `- "${g.description}" [${g.category || "general"}]${caughtCount > 0 ? ` - ${caughtCount} violation(s)${lastCaught}` : ""}`;
|
|
5312
5297
|
}).join("\n"));
|
|
5313
5298
|
}
|
|
5314
|
-
} catch {
|
|
5299
|
+
} catch (error) {
|
|
5300
|
+
console.error("Failed to load guardian state:", error);
|
|
5315
5301
|
}
|
|
5316
5302
|
try {
|
|
5317
5303
|
const storage = new TieredStorage(workDir);
|
|
@@ -5322,7 +5308,8 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5322
5308
|
(d) => `- ${d.decision} (${d.when}${d.hash ? `, hash: ${d.hash.slice(0, 8)}` : ""})`
|
|
5323
5309
|
).join("\n"));
|
|
5324
5310
|
}
|
|
5325
|
-
} catch {
|
|
5311
|
+
} catch (error) {
|
|
5312
|
+
console.error("Failed to query decisions:", error);
|
|
5326
5313
|
}
|
|
5327
5314
|
try {
|
|
5328
5315
|
const blockers = await storage.queryBlockers({ limit: 5 });
|
|
@@ -5331,9 +5318,11 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5331
5318
|
(b) => `- ${b.blocker} [${b.impact}]`
|
|
5332
5319
|
).join("\n"));
|
|
5333
5320
|
}
|
|
5334
|
-
} catch {
|
|
5321
|
+
} catch (error) {
|
|
5322
|
+
console.error("Failed to query blockers:", error);
|
|
5335
5323
|
}
|
|
5336
|
-
} catch {
|
|
5324
|
+
} catch (error) {
|
|
5325
|
+
console.error("Storage unavailable:", error);
|
|
5337
5326
|
}
|
|
5338
5327
|
try {
|
|
5339
5328
|
const graph = new ContextGraph(workDir);
|
|
@@ -5365,7 +5354,8 @@ async function buildContext(workDir, dashboardState) {
|
|
|
5365
5354
|
return `- ${d.description} (${Math.round(d.confidence * 100)}%${d.isAntiPattern ? ", anti-pattern" : ""})`;
|
|
5366
5355
|
}).join("\n"));
|
|
5367
5356
|
}
|
|
5368
|
-
} catch {
|
|
5357
|
+
} catch (error) {
|
|
5358
|
+
console.error("Context graph unavailable:", error);
|
|
5369
5359
|
}
|
|
5370
5360
|
return parts.length > 0 ? parts.join("\n\n") : "No context data available yet.";
|
|
5371
5361
|
}
|
|
@@ -5421,7 +5411,7 @@ function ChatView() {
|
|
|
5421
5411
|
const saveChat = async () => {
|
|
5422
5412
|
try {
|
|
5423
5413
|
const workDir = getWorkingDirectory(void 0, true);
|
|
5424
|
-
const { getChatStore: getChatStore2 } = await import("./chat-store-
|
|
5414
|
+
const { getChatStore: getChatStore2 } = await import("./chat-store-HFOOWZYN.js");
|
|
5425
5415
|
const store = getChatStore2(workDir);
|
|
5426
5416
|
const sessionId = await store.saveSession(
|
|
5427
5417
|
messages,
|
|
@@ -5450,9 +5440,12 @@ function ChatView() {
|
|
|
5450
5440
|
if (lastAssistantMessage?.pendingFix) {
|
|
5451
5441
|
const response = question.trim().toLowerCase();
|
|
5452
5442
|
if (response === "yes" || response === "y") {
|
|
5453
|
-
const { spawnClaudeCodeFix } = await import("./terminal-spawn-
|
|
5443
|
+
const { spawnClaudeCodeFix } = await import("./terminal-spawn-P5M5PHAV.js");
|
|
5454
5444
|
try {
|
|
5455
|
-
await spawnClaudeCodeFix(
|
|
5445
|
+
await spawnClaudeCodeFix({
|
|
5446
|
+
...lastAssistantMessage.pendingFix,
|
|
5447
|
+
cwd: lastAssistantMessage.pendingFix.directory
|
|
5448
|
+
});
|
|
5456
5449
|
dispatch({
|
|
5457
5450
|
type: "ADD_CHAT_MESSAGE",
|
|
5458
5451
|
role: "assistant",
|
|
@@ -5549,7 +5542,8 @@ ${contextBlock}`;
|
|
|
5549
5542
|
})
|
|
5550
5543
|
});
|
|
5551
5544
|
}
|
|
5552
|
-
} catch {
|
|
5545
|
+
} catch (error) {
|
|
5546
|
+
console.error("Failed to update state after tool calls:", error);
|
|
5553
5547
|
}
|
|
5554
5548
|
}
|
|
5555
5549
|
}
|
|
@@ -6008,7 +6002,6 @@ function DashboardApp({ onReady }) {
|
|
|
6008
6002
|
dispatchRef.current({ type: "STREAM_UPDATE", update: { type: "raw_log", data: { time, level, message }, timestamp: Date.now() } });
|
|
6009
6003
|
},
|
|
6010
6004
|
onNudge: (nudge) => {
|
|
6011
|
-
console.error("[Dashboard] onNudge called:", { message: nudge.message, severity: nudge.severity, file: nudge.file });
|
|
6012
6005
|
const action = { type: "SHOW_NOTIFICATION", message: nudge.message, severity: nudge.severity };
|
|
6013
6006
|
if (nudge.file !== void 0) action.file = nudge.file;
|
|
6014
6007
|
if (nudge.autoHideMs !== void 0) action.autoHideMs = nudge.autoHideMs;
|
|
@@ -6025,7 +6018,6 @@ function DashboardApp({ onReady }) {
|
|
|
6025
6018
|
relatedIssues: [],
|
|
6026
6019
|
dismissed: false
|
|
6027
6020
|
};
|
|
6028
|
-
console.error("[Dashboard] Adding insight:", { id: insight.id, type: insight.type, category: insight.category, priority: insight.priority });
|
|
6029
6021
|
dispatchRef.current({ type: "ADD_INSIGHTS", insights: [insight] });
|
|
6030
6022
|
}
|
|
6031
6023
|
}
|
|
@@ -6086,7 +6078,7 @@ function DashboardApp({ onReady }) {
|
|
|
6086
6078
|
}
|
|
6087
6079
|
if (input === "q" || key.escape) {
|
|
6088
6080
|
exit();
|
|
6089
|
-
|
|
6081
|
+
return;
|
|
6090
6082
|
}
|
|
6091
6083
|
if (key.tab) {
|
|
6092
6084
|
const currentIndex = MAIN_VIEWS.indexOf(state.view);
|
|
@@ -6231,4 +6223,4 @@ export {
|
|
|
6231
6223
|
handleCheckpointTool,
|
|
6232
6224
|
InteractiveDashboard
|
|
6233
6225
|
};
|
|
6234
|
-
//# sourceMappingURL=chunk-
|
|
6226
|
+
//# sourceMappingURL=chunk-QIS2VDJL.js.map
|