@triedotdev/mcp 1.0.116 → 1.0.117
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/{chunk-2764RZVV.js → chunk-EWVU7QUG.js} +161 -4
- package/dist/chunk-EWVU7QUG.js.map +1 -0
- package/dist/{chunk-SRQ4DNOP.js → chunk-PPZYVTUO.js} +67 -1
- package/dist/{chunk-SRQ4DNOP.js.map → chunk-PPZYVTUO.js.map} +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/cli/yolo-daemon.js +2 -2
- package/dist/index.js +152 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2764RZVV.js.map +0 -1
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
perceiveCurrentChanges,
|
|
11
11
|
reasonAboutChangesHumanReadable,
|
|
12
12
|
saveCheckpoint
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-PPZYVTUO.js";
|
|
14
14
|
import {
|
|
15
15
|
TieredStorage,
|
|
16
16
|
findCrossProjectPatterns,
|
|
@@ -1132,11 +1132,13 @@ function ConfigDialog({ onClose }) {
|
|
|
1132
1132
|
const workDir = getWorkingDirectory(void 0, true);
|
|
1133
1133
|
const trieDir = getTrieDirectory(workDir);
|
|
1134
1134
|
const filesToDelete = [
|
|
1135
|
-
join(trieDir, "context
|
|
1135
|
+
join(trieDir, "context.db"),
|
|
1136
|
+
join(trieDir, "context.json"),
|
|
1136
1137
|
join(trieDir, "incident-trie.json"),
|
|
1137
1138
|
join(trieDir, "memory", "ledger.json"),
|
|
1138
1139
|
join(trieDir, "memory", "issue-store.db"),
|
|
1139
|
-
join(trieDir, "memory", "insights.json")
|
|
1140
|
+
join(trieDir, "memory", "insights.json"),
|
|
1141
|
+
join(trieDir, "memory", "issues.json")
|
|
1140
1142
|
];
|
|
1141
1143
|
for (const file of filesToDelete) {
|
|
1142
1144
|
if (existsSync(file)) {
|
|
@@ -4480,6 +4482,98 @@ ${checkpoint.files.length > 0 ? `**Files:** ${checkpoint.files.join(", ")}` : ""
|
|
|
4480
4482
|
|
|
4481
4483
|
// src/cli/dashboard/chat-tools.ts
|
|
4482
4484
|
import { createHash } from "crypto";
|
|
4485
|
+
|
|
4486
|
+
// src/utils/terminal-spawn.ts
|
|
4487
|
+
import { exec } from "child_process";
|
|
4488
|
+
import { promisify } from "util";
|
|
4489
|
+
import { platform } from "os";
|
|
4490
|
+
var execAsync = promisify(exec);
|
|
4491
|
+
async function spawnTerminal(options) {
|
|
4492
|
+
const { command, cwd, title, keepOpen = true } = options;
|
|
4493
|
+
const os = platform();
|
|
4494
|
+
if (os === "darwin") {
|
|
4495
|
+
await spawnMacOSTerminal(command, cwd, title, keepOpen);
|
|
4496
|
+
} else if (os === "linux") {
|
|
4497
|
+
await spawnLinuxTerminal(command, cwd, title, keepOpen);
|
|
4498
|
+
} else {
|
|
4499
|
+
throw new Error(`Terminal spawning not supported on ${os}`);
|
|
4500
|
+
}
|
|
4501
|
+
}
|
|
4502
|
+
async function spawnMacOSTerminal(command, cwd, title, keepOpen) {
|
|
4503
|
+
const escapedCommand = command.replace(/'/g, `'"'"'`);
|
|
4504
|
+
const escapedCwd = cwd?.replace(/'/g, `'"'"'`) || process.cwd();
|
|
4505
|
+
const escapedTitle = title?.replace(/'/g, `'"'"'`) || "Trie Agent";
|
|
4506
|
+
const fullCommand = cwd ? `cd '${escapedCwd}' && ${command}` : command;
|
|
4507
|
+
const escapedFullCommand = fullCommand.replace(/'/g, `'"'"'`);
|
|
4508
|
+
const script = `
|
|
4509
|
+
tell application "Terminal"
|
|
4510
|
+
activate
|
|
4511
|
+
set newTab to do script "${escapedFullCommand}"
|
|
4512
|
+
set custom title of newTab to "${escapedTitle}"
|
|
4513
|
+
end tell
|
|
4514
|
+
`.trim();
|
|
4515
|
+
try {
|
|
4516
|
+
await execAsync(`osascript -e '${script.replace(/'/g, `'"'"'`)}'`);
|
|
4517
|
+
} catch (error) {
|
|
4518
|
+
console.error("Terminal.app spawn failed, trying fallback...");
|
|
4519
|
+
const shellCmd = keepOpen ? `${fullCommand}; exec bash` : fullCommand;
|
|
4520
|
+
await execAsync(`open -a Terminal "${escapedCwd}" --args -e "${shellCmd}"`);
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
async function spawnLinuxTerminal(command, cwd, title, keepOpen) {
|
|
4524
|
+
const workDir = cwd || process.cwd();
|
|
4525
|
+
const termTitle = title || "Trie Agent";
|
|
4526
|
+
const shellCmd = keepOpen ? `${command}; exec bash` : command;
|
|
4527
|
+
const terminals = [
|
|
4528
|
+
// GNOME Terminal
|
|
4529
|
+
{
|
|
4530
|
+
command: "gnome-terminal",
|
|
4531
|
+
args: `--working-directory="${workDir}" --title="${termTitle}" -- bash -c "${shellCmd}"`
|
|
4532
|
+
},
|
|
4533
|
+
// Konsole (KDE)
|
|
4534
|
+
{
|
|
4535
|
+
command: "konsole",
|
|
4536
|
+
args: `--workdir "${workDir}" --title "${termTitle}" -e bash -c "${shellCmd}"`
|
|
4537
|
+
},
|
|
4538
|
+
// xterm (fallback)
|
|
4539
|
+
{
|
|
4540
|
+
command: "xterm",
|
|
4541
|
+
args: `-T "${termTitle}" -e "cd '${workDir}' && ${shellCmd}"`
|
|
4542
|
+
}
|
|
4543
|
+
];
|
|
4544
|
+
for (const term of terminals) {
|
|
4545
|
+
try {
|
|
4546
|
+
await execAsync(`which ${term.command}`);
|
|
4547
|
+
await execAsync(`${term.command} ${term.args} &`);
|
|
4548
|
+
return;
|
|
4549
|
+
} catch {
|
|
4550
|
+
continue;
|
|
4551
|
+
}
|
|
4552
|
+
}
|
|
4553
|
+
throw new Error("No supported terminal emulator found (tried: gnome-terminal, konsole, xterm)");
|
|
4554
|
+
}
|
|
4555
|
+
async function spawnClaudeCodeFix(options) {
|
|
4556
|
+
const { file, goal, violation, suggestedFix, cwd } = options;
|
|
4557
|
+
const prompt = `Fix this goal violation:
|
|
4558
|
+
|
|
4559
|
+
Goal: ${goal}
|
|
4560
|
+
File: ${file}
|
|
4561
|
+
Violation: ${violation}
|
|
4562
|
+
${suggestedFix ? `Suggested fix: ${suggestedFix}` : ""}
|
|
4563
|
+
|
|
4564
|
+
Please review the file and fix the violation while preserving functionality.`;
|
|
4565
|
+
const escapedPrompt = prompt.replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
4566
|
+
const escapedFile = file.replace(/"/g, '\\"');
|
|
4567
|
+
const command = `echo "${escapedPrompt}" | claude --file="${escapedFile}"`;
|
|
4568
|
+
await spawnTerminal({
|
|
4569
|
+
command,
|
|
4570
|
+
cwd,
|
|
4571
|
+
title: `Fixing: ${file}`,
|
|
4572
|
+
keepOpen: true
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4575
|
+
|
|
4576
|
+
// src/cli/dashboard/chat-tools.ts
|
|
4483
4577
|
function textFromResult(result) {
|
|
4484
4578
|
return result.content.map((c) => c.text).join("\n");
|
|
4485
4579
|
}
|
|
@@ -4629,6 +4723,20 @@ var CHAT_TOOLS = [
|
|
|
4629
4723
|
},
|
|
4630
4724
|
required: ["decision", "context"]
|
|
4631
4725
|
}
|
|
4726
|
+
},
|
|
4727
|
+
{
|
|
4728
|
+
name: "trie_fix_goal_violation",
|
|
4729
|
+
description: "Spawn Claude Code in a new terminal to fix a goal violation. Use when the user wants to auto-fix a goal violation detected by the watcher.",
|
|
4730
|
+
input_schema: {
|
|
4731
|
+
type: "object",
|
|
4732
|
+
properties: {
|
|
4733
|
+
file: { type: "string", description: "File path with the goal violation" },
|
|
4734
|
+
goal: { type: "string", description: "The goal that was violated" },
|
|
4735
|
+
violation: { type: "string", description: "Description of the violation" },
|
|
4736
|
+
suggestedFix: { type: "string", description: "Suggested fix for the violation (optional)" }
|
|
4737
|
+
},
|
|
4738
|
+
required: ["file", "goal", "violation"]
|
|
4739
|
+
}
|
|
4632
4740
|
}
|
|
4633
4741
|
];
|
|
4634
4742
|
async function executeTool(name, input) {
|
|
@@ -4778,6 +4886,35 @@ async function executeTool(name, input) {
|
|
|
4778
4886
|
});
|
|
4779
4887
|
return `Decision recorded [${hash}]: "${dec}"`;
|
|
4780
4888
|
}
|
|
4889
|
+
case "trie_fix_goal_violation": {
|
|
4890
|
+
const file = String(input.file || "").trim();
|
|
4891
|
+
const goal = String(input.goal || "").trim();
|
|
4892
|
+
const violation = String(input.violation || "").trim();
|
|
4893
|
+
const suggestedFix = input.suggestedFix ? String(input.suggestedFix) : void 0;
|
|
4894
|
+
if (!file) return "File path is required.";
|
|
4895
|
+
if (!goal) return "Goal description is required.";
|
|
4896
|
+
if (!violation) return "Violation description is required.";
|
|
4897
|
+
try {
|
|
4898
|
+
await spawnClaudeCodeFix({
|
|
4899
|
+
file,
|
|
4900
|
+
goal,
|
|
4901
|
+
violation,
|
|
4902
|
+
suggestedFix,
|
|
4903
|
+
cwd: directory
|
|
4904
|
+
});
|
|
4905
|
+
return `\u2713 Spawned Claude Code in a new terminal to fix "${file}".
|
|
4906
|
+
|
|
4907
|
+
Claude Code will:
|
|
4908
|
+
1. Review the file
|
|
4909
|
+
2. Understand the goal: "${goal}"
|
|
4910
|
+
3. Fix the violation: "${violation}"
|
|
4911
|
+
4. Preserve all functionality
|
|
4912
|
+
|
|
4913
|
+
Check the new terminal window to see the fix in progress.`;
|
|
4914
|
+
} catch (error) {
|
|
4915
|
+
return `Failed to spawn Claude Code: ${error instanceof Error ? error.message : "unknown error"}`;
|
|
4916
|
+
}
|
|
4917
|
+
}
|
|
4781
4918
|
default:
|
|
4782
4919
|
return `Unknown tool: ${name}`;
|
|
4783
4920
|
}
|
|
@@ -4787,6 +4924,20 @@ async function executeTool(name, input) {
|
|
|
4787
4924
|
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4788
4925
|
async function buildContext(workDir) {
|
|
4789
4926
|
const parts = [];
|
|
4927
|
+
try {
|
|
4928
|
+
const guardianState = getGuardianState(workDir);
|
|
4929
|
+
await guardianState.load();
|
|
4930
|
+
const activeGoals = guardianState.getAllGoals().filter((g) => g.status === "active");
|
|
4931
|
+
if (activeGoals.length > 0) {
|
|
4932
|
+
parts.push("Active goals:\n" + activeGoals.map((g) => {
|
|
4933
|
+
const metadata = g.metadata || {};
|
|
4934
|
+
const caughtCount = metadata.caughtCount || 0;
|
|
4935
|
+
const lastCaught = metadata.lastCaught ? ` (last violation: ${metadata.lastCaughtFile || "unknown"})` : "";
|
|
4936
|
+
return `- "${g.description}" [${g.category || "general"}]${caughtCount > 0 ? ` - ${caughtCount} violation(s)${lastCaught}` : ""}`;
|
|
4937
|
+
}).join("\n"));
|
|
4938
|
+
}
|
|
4939
|
+
} catch {
|
|
4940
|
+
}
|
|
4790
4941
|
try {
|
|
4791
4942
|
const storage = new TieredStorage(workDir);
|
|
4792
4943
|
try {
|
|
@@ -4851,6 +5002,12 @@ function chatHistoryToMessages(history) {
|
|
|
4851
5002
|
}
|
|
4852
5003
|
var SYSTEM_PROMPT = `You are Trie, a code guardian assistant embedded in a terminal TUI.
|
|
4853
5004
|
You have tools to take actions on the user's codebase \u2014 use them when the user asks you to check files, record incidents, give feedback, query decisions, or save checkpoints.
|
|
5005
|
+
|
|
5006
|
+
When the user mentions a goal violation or asks you to fix something detected by the watcher:
|
|
5007
|
+
1. Extract the file path, goal description, and violation details from context
|
|
5008
|
+
2. Use trie_fix_goal_violation to spawn Claude Code in a new terminal
|
|
5009
|
+
3. Claude Code will automatically fix the violation
|
|
5010
|
+
|
|
4854
5011
|
Answer concisely. Reference specific files, decisions, and patterns when relevant.
|
|
4855
5012
|
When you use a tool, briefly summarize what you did and what the result was.`;
|
|
4856
5013
|
function ChatView() {
|
|
@@ -5358,4 +5515,4 @@ export {
|
|
|
5358
5515
|
handleCheckpointTool,
|
|
5359
5516
|
InteractiveDashboard
|
|
5360
5517
|
};
|
|
5361
|
-
//# sourceMappingURL=chunk-
|
|
5518
|
+
//# sourceMappingURL=chunk-EWVU7QUG.js.map
|