@gonzih/cc-tg 0.9.20 → 0.9.21
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/bot.js +4 -25
- package/package.json +1 -1
package/dist/bot.js
CHANGED
|
@@ -966,22 +966,13 @@ export class CcTgBot {
|
|
|
966
966
|
return pids;
|
|
967
967
|
}
|
|
968
968
|
async handleReloadMcp(chatId) {
|
|
969
|
-
await this.bot.sendMessage(chatId, "
|
|
970
|
-
try {
|
|
971
|
-
const home = process.env.HOME ?? "~";
|
|
972
|
-
const npmBase = process.env.npm_config_cache ? join(process.env.npm_config_cache, "..") : `${home}/.npm`;
|
|
973
|
-
execSync(`rm -rf "${npmBase}/_npx/"`, { encoding: "utf8", shell: "/bin/sh" });
|
|
974
|
-
console.log(`[mcp] cleared ${npmBase}/_npx/`);
|
|
975
|
-
}
|
|
976
|
-
catch (err) {
|
|
977
|
-
await this.bot.sendMessage(chatId, `Warning: failed to clear npx cache: ${err.message}`);
|
|
978
|
-
}
|
|
969
|
+
await this.bot.sendMessage(chatId, "Reloading MCP...");
|
|
979
970
|
const pids = this.killCcAgent();
|
|
980
971
|
if (pids.length === 0) {
|
|
981
|
-
await this.bot.sendMessage(chatId, "
|
|
972
|
+
await this.bot.sendMessage(chatId, "No cc-agent process found — MCP will start fresh on the next agent call.");
|
|
982
973
|
return;
|
|
983
974
|
}
|
|
984
|
-
await this.bot.sendMessage(chatId, `
|
|
975
|
+
await this.bot.sendMessage(chatId, `Sent SIGTERM to cc-agent (pid${pids.length > 1 ? "s" : ""}: ${pids.join(", ")}).\nMCP restarted. New process will load on next agent call.`);
|
|
985
976
|
}
|
|
986
977
|
async handleMcpStatus(chatId) {
|
|
987
978
|
try {
|
|
@@ -1041,20 +1032,8 @@ export class CcTgBot {
|
|
|
1041
1032
|
await this.bot.sendMessage(chatId, `${clearNote}${pidNote} Next call picks up latest npm version.`);
|
|
1042
1033
|
}
|
|
1043
1034
|
async handleRestart(chatId) {
|
|
1044
|
-
await this.bot.sendMessage(chatId, "
|
|
1035
|
+
await this.bot.sendMessage(chatId, "Restarting... brb.");
|
|
1045
1036
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
1046
|
-
// Clear npm caches before restart so launchd brings up fresh version
|
|
1047
|
-
// Use isolated npm_config_cache path from plist, not hardcoded ~/.npm
|
|
1048
|
-
const home = process.env.HOME ?? "/tmp";
|
|
1049
|
-
const npmBase = process.env.npm_config_cache
|
|
1050
|
-
? join(process.env.npm_config_cache, "..")
|
|
1051
|
-
: `${home}/.npm`;
|
|
1052
|
-
for (const dir of [`${npmBase}/_npx`, `${npmBase}/cache`]) {
|
|
1053
|
-
try {
|
|
1054
|
-
execSync(`rm -rf "${dir}"`, { shell: "/bin/sh" });
|
|
1055
|
-
}
|
|
1056
|
-
catch { }
|
|
1057
|
-
}
|
|
1058
1037
|
// Kill all active Claude sessions cleanly
|
|
1059
1038
|
for (const [cid] of this.sessions) {
|
|
1060
1039
|
this.killSession(cid);
|