@triedotdev/mcp 1.0.111 → 1.0.113
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.
|
@@ -2499,11 +2499,6 @@ function MemoryTreeView() {
|
|
|
2499
2499
|
n.data.changeCount,
|
|
2500
2500
|
" changes"
|
|
2501
2501
|
] }),
|
|
2502
|
-
n.data.incidentCount > 0 && /* @__PURE__ */ jsxs9(Text9, { color: "red", children: [
|
|
2503
|
-
" ",
|
|
2504
|
-
n.data.incidentCount,
|
|
2505
|
-
" incidents"
|
|
2506
|
-
] }),
|
|
2507
2502
|
n.data.whyRisky && /* @__PURE__ */ jsxs9(Text9, { dimColor: true, children: [
|
|
2508
2503
|
" ",
|
|
2509
2504
|
n.data.whyRisky
|
|
@@ -4925,13 +4920,14 @@ ${checkpoint.files.length > 0 ? `**Files:** ${checkpoint.files.join(", ")}` : ""
|
|
|
4925
4920
|
}
|
|
4926
4921
|
|
|
4927
4922
|
// src/cli/dashboard/chat-tools.ts
|
|
4923
|
+
import { createHash } from "crypto";
|
|
4928
4924
|
function textFromResult(result) {
|
|
4929
4925
|
return result.content.map((c) => c.text).join("\n");
|
|
4930
4926
|
}
|
|
4931
4927
|
var CHAT_TOOLS = [
|
|
4932
4928
|
{
|
|
4933
4929
|
name: "trie_tell",
|
|
4934
|
-
description: "Record an incident
|
|
4930
|
+
description: "Record an incident about the codebase. Use when the user reports a bug, crash, outage, or notable problem. This is the incident tracker \u2014 NOT for goals or hypotheses.",
|
|
4935
4931
|
input_schema: {
|
|
4936
4932
|
type: "object",
|
|
4937
4933
|
properties: {
|
|
@@ -5023,6 +5019,57 @@ var CHAT_TOOLS = [
|
|
|
5023
5019
|
},
|
|
5024
5020
|
required: ["action"]
|
|
5025
5021
|
}
|
|
5022
|
+
},
|
|
5023
|
+
{
|
|
5024
|
+
name: "trie_add_goal",
|
|
5025
|
+
description: "Create a new goal for the user to track. Use when the user asks to set, add, or create a goal.",
|
|
5026
|
+
input_schema: {
|
|
5027
|
+
type: "object",
|
|
5028
|
+
properties: {
|
|
5029
|
+
description: { type: "string", description: "What the user wants to achieve" },
|
|
5030
|
+
category: { type: "string", enum: ["security", "quality", "performance", "coverage", "general"], description: "Goal category (default general)" }
|
|
5031
|
+
},
|
|
5032
|
+
required: ["description"]
|
|
5033
|
+
}
|
|
5034
|
+
},
|
|
5035
|
+
{
|
|
5036
|
+
name: "trie_add_hypothesis",
|
|
5037
|
+
description: "Create a hypothesis to test. Use when the user has a theory they want to track and validate over time.",
|
|
5038
|
+
input_schema: {
|
|
5039
|
+
type: "object",
|
|
5040
|
+
properties: {
|
|
5041
|
+
statement: { type: "string", description: "The hypothesis statement to test" },
|
|
5042
|
+
category: { type: "string", enum: ["timing", "pattern", "team", "code", "general"], description: "Hypothesis category (default general)" },
|
|
5043
|
+
test_criteria: { type: "string", description: "How to validate or invalidate this hypothesis" }
|
|
5044
|
+
},
|
|
5045
|
+
required: ["statement"]
|
|
5046
|
+
}
|
|
5047
|
+
},
|
|
5048
|
+
{
|
|
5049
|
+
name: "trie_delete_incident",
|
|
5050
|
+
description: "Delete an incident from the ledger. Use when the user says an incident was logged by mistake, is misclassified, or should be removed.",
|
|
5051
|
+
input_schema: {
|
|
5052
|
+
type: "object",
|
|
5053
|
+
properties: {
|
|
5054
|
+
search: { type: "string", description: "Text to match against incident descriptions to find the one to delete" }
|
|
5055
|
+
},
|
|
5056
|
+
required: ["search"]
|
|
5057
|
+
}
|
|
5058
|
+
},
|
|
5059
|
+
{
|
|
5060
|
+
name: "trie_add_decision",
|
|
5061
|
+
description: "Record an architectural or coding decision. Use when the user makes, announces, or wants to log a decision about the codebase.",
|
|
5062
|
+
input_schema: {
|
|
5063
|
+
type: "object",
|
|
5064
|
+
properties: {
|
|
5065
|
+
decision: { type: "string", description: "What was decided" },
|
|
5066
|
+
context: { type: "string", description: "Why this decision was made \u2014 the situation or problem" },
|
|
5067
|
+
reasoning: { type: "string", description: "The reasoning behind the choice" },
|
|
5068
|
+
files: { type: "array", items: { type: "string" }, description: "Files affected by this decision" },
|
|
5069
|
+
tags: { type: "array", items: { type: "string" }, description: "Tags for categorization" }
|
|
5070
|
+
},
|
|
5071
|
+
required: ["decision", "context"]
|
|
5072
|
+
}
|
|
5026
5073
|
}
|
|
5027
5074
|
];
|
|
5028
5075
|
async function executeTool(name, input) {
|
|
@@ -5068,6 +5115,110 @@ async function executeTool(name, input) {
|
|
|
5068
5115
|
const result = await handleCheckpointTool(input);
|
|
5069
5116
|
return result;
|
|
5070
5117
|
}
|
|
5118
|
+
case "trie_add_goal": {
|
|
5119
|
+
const desc = String(input.description || "").trim();
|
|
5120
|
+
if (!desc) return "Goal description is required.";
|
|
5121
|
+
const category = input.category || "general";
|
|
5122
|
+
const agentState = getGuardianState(directory);
|
|
5123
|
+
await agentState.load();
|
|
5124
|
+
const goal = {
|
|
5125
|
+
id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5126
|
+
description: desc,
|
|
5127
|
+
type: "custom",
|
|
5128
|
+
metric: "progress",
|
|
5129
|
+
target: 100,
|
|
5130
|
+
currentValue: 0,
|
|
5131
|
+
startValue: 0,
|
|
5132
|
+
status: "active",
|
|
5133
|
+
autoGenerated: false,
|
|
5134
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5135
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5136
|
+
deadline: new Date(Date.now() + 14 * 864e5).toISOString(),
|
|
5137
|
+
category
|
|
5138
|
+
};
|
|
5139
|
+
await agentState.addGoal(goal);
|
|
5140
|
+
return `Goal created: "${desc}" [${category}]`;
|
|
5141
|
+
}
|
|
5142
|
+
case "trie_add_hypothesis": {
|
|
5143
|
+
const stmt = String(input.statement || "").trim();
|
|
5144
|
+
if (!stmt) return "Hypothesis statement is required.";
|
|
5145
|
+
const category = input.category || "general";
|
|
5146
|
+
const agentState = getGuardianState(directory);
|
|
5147
|
+
await agentState.load();
|
|
5148
|
+
const hypothesis = {
|
|
5149
|
+
id: `hyp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
5150
|
+
statement: stmt,
|
|
5151
|
+
confidence: 0.5,
|
|
5152
|
+
status: "proposed",
|
|
5153
|
+
evidence: [],
|
|
5154
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5155
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5156
|
+
testCriteria: String(input.test_criteria || "Collect evidence from scans"),
|
|
5157
|
+
category
|
|
5158
|
+
};
|
|
5159
|
+
await agentState.addHypothesis(hypothesis);
|
|
5160
|
+
return `Hypothesis created: "${stmt}" [${category}]`;
|
|
5161
|
+
}
|
|
5162
|
+
case "trie_delete_incident": {
|
|
5163
|
+
const search = String(input.search || "").trim().toLowerCase();
|
|
5164
|
+
if (!search) return "Search text is required to find the incident.";
|
|
5165
|
+
const graph = new ContextGraph(directory);
|
|
5166
|
+
const nodes = await graph.listNodes();
|
|
5167
|
+
const incidents = nodes.filter(
|
|
5168
|
+
(n) => n.type === "incident" && n.data.description?.toLowerCase().includes(search)
|
|
5169
|
+
);
|
|
5170
|
+
if (incidents.length === 0) return `No incidents found matching "${search}".`;
|
|
5171
|
+
for (const inc of incidents) {
|
|
5172
|
+
await graph.deleteNode("incident", inc.id);
|
|
5173
|
+
}
|
|
5174
|
+
await exportToJson(graph);
|
|
5175
|
+
const descs = incidents.map((i) => `"${i.data.description.slice(0, 60)}"`);
|
|
5176
|
+
return `Deleted ${incidents.length} incident(s): ${descs.join(", ")}`;
|
|
5177
|
+
}
|
|
5178
|
+
case "trie_add_decision": {
|
|
5179
|
+
const dec = String(input.decision || "").trim();
|
|
5180
|
+
const ctx = String(input.context || "").trim();
|
|
5181
|
+
if (!dec) return "Decision text is required.";
|
|
5182
|
+
if (!ctx) return "Decision context is required.";
|
|
5183
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5184
|
+
const id = `dec-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
5185
|
+
const hash = createHash("sha256").update(`${dec}|${ctx}|${now}`).digest("hex").slice(0, 16);
|
|
5186
|
+
const files = Array.isArray(input.files) ? input.files.map(String) : [];
|
|
5187
|
+
const tags = Array.isArray(input.tags) ? input.tags.map(String) : [];
|
|
5188
|
+
const reasoningStr = input.reasoning ? String(input.reasoning) : null;
|
|
5189
|
+
const decisionObj = {
|
|
5190
|
+
id,
|
|
5191
|
+
decision: dec,
|
|
5192
|
+
context: ctx,
|
|
5193
|
+
when: now,
|
|
5194
|
+
who: "user",
|
|
5195
|
+
files,
|
|
5196
|
+
tags,
|
|
5197
|
+
status: "active",
|
|
5198
|
+
hash,
|
|
5199
|
+
...reasoningStr ? { reasoning: reasoningStr } : {}
|
|
5200
|
+
};
|
|
5201
|
+
const storage = new TieredStorage(directory);
|
|
5202
|
+
await storage.storeSignal({
|
|
5203
|
+
decisions: [decisionObj],
|
|
5204
|
+
facts: [],
|
|
5205
|
+
blockers: [],
|
|
5206
|
+
questions: [],
|
|
5207
|
+
metadata: {
|
|
5208
|
+
extractedAt: now,
|
|
5209
|
+
sourceType: "conversation"
|
|
5210
|
+
}
|
|
5211
|
+
});
|
|
5212
|
+
const graph = new ContextGraph(directory);
|
|
5213
|
+
await graph.addNode("decision", {
|
|
5214
|
+
context: ctx,
|
|
5215
|
+
decision: dec,
|
|
5216
|
+
reasoning: reasoningStr,
|
|
5217
|
+
outcome: "unknown",
|
|
5218
|
+
timestamp: now
|
|
5219
|
+
});
|
|
5220
|
+
return `Decision recorded [${hash}]: "${dec}"`;
|
|
5221
|
+
}
|
|
5071
5222
|
default:
|
|
5072
5223
|
return `Unknown tool: ${name}`;
|
|
5073
5224
|
}
|
|
@@ -5179,7 +5330,37 @@ ${contextBlock}`;
|
|
|
5179
5330
|
role: "assistant",
|
|
5180
5331
|
content: result.content
|
|
5181
5332
|
};
|
|
5182
|
-
if (result.toolCalls && result.toolCalls.length > 0)
|
|
5333
|
+
if (result.toolCalls && result.toolCalls.length > 0) {
|
|
5334
|
+
action.toolCalls = result.toolCalls;
|
|
5335
|
+
const toolNames = new Set(result.toolCalls.map((tc) => tc.name));
|
|
5336
|
+
if (toolNames.has("trie_add_goal") || toolNames.has("trie_add_hypothesis")) {
|
|
5337
|
+
try {
|
|
5338
|
+
const agentState = getGuardianState(workDir);
|
|
5339
|
+
await agentState.load();
|
|
5340
|
+
if (toolNames.has("trie_add_goal")) {
|
|
5341
|
+
const goals = agentState.getAllGoals();
|
|
5342
|
+
dispatch({
|
|
5343
|
+
type: "SET_GOALS",
|
|
5344
|
+
goals: goals.map((g) => {
|
|
5345
|
+
const base = { id: g.id, description: g.description, type: g.type, target: g.target, currentValue: g.currentValue, status: g.status, autoGenerated: g.autoGenerated, updatedAt: g.updatedAt };
|
|
5346
|
+
return g.category ? { ...base, category: g.category } : base;
|
|
5347
|
+
})
|
|
5348
|
+
});
|
|
5349
|
+
}
|
|
5350
|
+
if (toolNames.has("trie_add_hypothesis")) {
|
|
5351
|
+
const hypotheses = agentState.getAllHypotheses();
|
|
5352
|
+
dispatch({
|
|
5353
|
+
type: "SET_HYPOTHESES",
|
|
5354
|
+
hypotheses: hypotheses.map((h) => {
|
|
5355
|
+
const base = { id: h.id, statement: h.statement, confidence: h.confidence, status: h.status, evidenceCount: h.evidence.length, updatedAt: h.updatedAt };
|
|
5356
|
+
return h.category ? { ...base, category: h.category } : base;
|
|
5357
|
+
})
|
|
5358
|
+
});
|
|
5359
|
+
}
|
|
5360
|
+
} catch {
|
|
5361
|
+
}
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5183
5364
|
dispatch(action);
|
|
5184
5365
|
} else {
|
|
5185
5366
|
dispatch({
|
|
@@ -5576,4 +5757,4 @@ export {
|
|
|
5576
5757
|
handleCheckpointTool,
|
|
5577
5758
|
InteractiveDashboard
|
|
5578
5759
|
};
|
|
5579
|
-
//# sourceMappingURL=chunk-
|
|
5760
|
+
//# sourceMappingURL=chunk-2764KZZQ.js.map
|