jefrichat-mcp 0.48.0 → 0.48.3
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/index.js +71 -52
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11914,6 +11914,55 @@ var init_popup = __esm({
|
|
|
11914
11914
|
}
|
|
11915
11915
|
});
|
|
11916
11916
|
|
|
11917
|
+
// src/version.ts
|
|
11918
|
+
import fs9 from "node:fs";
|
|
11919
|
+
import np7 from "node:path";
|
|
11920
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
11921
|
+
function connectorVersion() {
|
|
11922
|
+
try {
|
|
11923
|
+
const here = np7.dirname(fileURLToPath2(import.meta.url));
|
|
11924
|
+
const pkg = JSON.parse(fs9.readFileSync(np7.join(here, "..", "package.json"), "utf8"));
|
|
11925
|
+
return pkg.version ?? "?";
|
|
11926
|
+
} catch {
|
|
11927
|
+
return "?";
|
|
11928
|
+
}
|
|
11929
|
+
}
|
|
11930
|
+
function isNewer(a, b) {
|
|
11931
|
+
const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
|
|
11932
|
+
const pb = b.split(".").map((n) => parseInt(n, 10) || 0);
|
|
11933
|
+
for (let i = 0; i < 3; i++) {
|
|
11934
|
+
if ((pa[i] ?? 0) > (pb[i] ?? 0)) return true;
|
|
11935
|
+
if ((pa[i] ?? 0) < (pb[i] ?? 0)) return false;
|
|
11936
|
+
}
|
|
11937
|
+
return false;
|
|
11938
|
+
}
|
|
11939
|
+
async function checkForUpdate(timeoutMs = 3e3) {
|
|
11940
|
+
const current = connectorVersion();
|
|
11941
|
+
if (current === "?") return null;
|
|
11942
|
+
const ac = new AbortController();
|
|
11943
|
+
const timer = setTimeout(() => ac.abort(), timeoutMs);
|
|
11944
|
+
try {
|
|
11945
|
+
const r = await fetch("https://registry.npmjs.org/jefrichat-mcp/latest", {
|
|
11946
|
+
signal: ac.signal,
|
|
11947
|
+
headers: { accept: "application/json" }
|
|
11948
|
+
});
|
|
11949
|
+
if (!r.ok) return null;
|
|
11950
|
+
const j = await r.json();
|
|
11951
|
+
const latest = j.version;
|
|
11952
|
+
if (!latest) return null;
|
|
11953
|
+
return { current, latest, outdated: isNewer(latest, current) };
|
|
11954
|
+
} catch {
|
|
11955
|
+
return null;
|
|
11956
|
+
} finally {
|
|
11957
|
+
clearTimeout(timer);
|
|
11958
|
+
}
|
|
11959
|
+
}
|
|
11960
|
+
var init_version = __esm({
|
|
11961
|
+
"src/version.ts"() {
|
|
11962
|
+
"use strict";
|
|
11963
|
+
}
|
|
11964
|
+
});
|
|
11965
|
+
|
|
11917
11966
|
// src/run.ts
|
|
11918
11967
|
var run_exports = {};
|
|
11919
11968
|
__export(run_exports, {
|
|
@@ -12269,6 +12318,14 @@ async function runPanel() {
|
|
|
12269
12318
|
const noBrain = a.brainReady === false ? ` \xB7 no "${sanitizeForDisplay(a.brain ?? "brain")}" installed` : "";
|
|
12270
12319
|
return `@${name}${host}${a.online ? "" : " (offline)"}${a.autonomous ? " \xB7 autonomous ON" : ""}${noBrain}`;
|
|
12271
12320
|
}).join(" \xB7 ");
|
|
12321
|
+
let updateLine = "";
|
|
12322
|
+
void checkForUpdate().then((u) => {
|
|
12323
|
+
if (u?.outdated) {
|
|
12324
|
+
updateLine = ` ${yellow(`\u2191 connector ${u.current} \u2192 ${u.latest}`)} ${dim("\xB7 restart this agent's session to update")}`;
|
|
12325
|
+
dirty = true;
|
|
12326
|
+
}
|
|
12327
|
+
}).catch(() => {
|
|
12328
|
+
});
|
|
12272
12329
|
let dirty = false;
|
|
12273
12330
|
let outcome = null;
|
|
12274
12331
|
session.on("message", () => {
|
|
@@ -12295,6 +12352,7 @@ async function runPanel() {
|
|
|
12295
12352
|
await refresh();
|
|
12296
12353
|
for (; ; ) {
|
|
12297
12354
|
renderList(messages, agentLine + (dirty ? green(" \xB7 updated \u2014 press Enter to refresh") : ""));
|
|
12355
|
+
if (updateLine) output.write(updateLine + "\n");
|
|
12298
12356
|
if (outcome) {
|
|
12299
12357
|
output.write(" " + outcome + "\n");
|
|
12300
12358
|
outcome = null;
|
|
@@ -12389,6 +12447,7 @@ var init_panel = __esm({
|
|
|
12389
12447
|
"use strict";
|
|
12390
12448
|
init_control_client();
|
|
12391
12449
|
init_registry();
|
|
12450
|
+
init_version();
|
|
12392
12451
|
init_control_proto();
|
|
12393
12452
|
useColor = output.isTTY && !process.env.NO_COLOR;
|
|
12394
12453
|
c = (code3) => (s) => useColor ? `\x1B[${code3}m${s}\x1B[0m` : s;
|
|
@@ -41986,52 +42045,7 @@ init_popup();
|
|
|
41986
42045
|
|
|
41987
42046
|
// src/doctor.ts
|
|
41988
42047
|
import cp6 from "node:child_process";
|
|
41989
|
-
|
|
41990
|
-
// src/version.ts
|
|
41991
|
-
import fs9 from "node:fs";
|
|
41992
|
-
import np7 from "node:path";
|
|
41993
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
41994
|
-
function connectorVersion() {
|
|
41995
|
-
try {
|
|
41996
|
-
const here = np7.dirname(fileURLToPath2(import.meta.url));
|
|
41997
|
-
const pkg = JSON.parse(fs9.readFileSync(np7.join(here, "..", "package.json"), "utf8"));
|
|
41998
|
-
return pkg.version ?? "?";
|
|
41999
|
-
} catch {
|
|
42000
|
-
return "?";
|
|
42001
|
-
}
|
|
42002
|
-
}
|
|
42003
|
-
function isNewer(a, b) {
|
|
42004
|
-
const pa = a.split(".").map((n) => parseInt(n, 10) || 0);
|
|
42005
|
-
const pb = b.split(".").map((n) => parseInt(n, 10) || 0);
|
|
42006
|
-
for (let i = 0; i < 3; i++) {
|
|
42007
|
-
if ((pa[i] ?? 0) > (pb[i] ?? 0)) return true;
|
|
42008
|
-
if ((pa[i] ?? 0) < (pb[i] ?? 0)) return false;
|
|
42009
|
-
}
|
|
42010
|
-
return false;
|
|
42011
|
-
}
|
|
42012
|
-
async function checkForUpdate(timeoutMs = 3e3) {
|
|
42013
|
-
const current = connectorVersion();
|
|
42014
|
-
if (current === "?") return null;
|
|
42015
|
-
const ac = new AbortController();
|
|
42016
|
-
const timer = setTimeout(() => ac.abort(), timeoutMs);
|
|
42017
|
-
try {
|
|
42018
|
-
const r = await fetch("https://registry.npmjs.org/jefrichat-mcp/latest", {
|
|
42019
|
-
signal: ac.signal,
|
|
42020
|
-
headers: { accept: "application/json" }
|
|
42021
|
-
});
|
|
42022
|
-
if (!r.ok) return null;
|
|
42023
|
-
const j = await r.json();
|
|
42024
|
-
const latest = j.version;
|
|
42025
|
-
if (!latest) return null;
|
|
42026
|
-
return { current, latest, outdated: isNewer(latest, current) };
|
|
42027
|
-
} catch {
|
|
42028
|
-
return null;
|
|
42029
|
-
} finally {
|
|
42030
|
-
clearTimeout(timer);
|
|
42031
|
-
}
|
|
42032
|
-
}
|
|
42033
|
-
|
|
42034
|
-
// src/doctor.ts
|
|
42048
|
+
init_version();
|
|
42035
42049
|
init_popup();
|
|
42036
42050
|
import fs10 from "node:fs";
|
|
42037
42051
|
var T = !!process.stdout.isTTY;
|
|
@@ -42178,6 +42192,7 @@ ${C.b}\u{1FA7A} Jefri Chat connector \u2014 setup check${C.x}
|
|
|
42178
42192
|
}
|
|
42179
42193
|
|
|
42180
42194
|
// src/index.ts
|
|
42195
|
+
init_version();
|
|
42181
42196
|
var SERVER = process.env.JEFRI_SERVER ?? "http://localhost:4000";
|
|
42182
42197
|
var TOKEN = process.env.JEFRI_TOKEN;
|
|
42183
42198
|
var USERNAME = process.env.JEFRI_AS ?? "claude_agent";
|
|
@@ -42185,6 +42200,10 @@ var NAME = process.env.JEFRI_NAME ?? USERNAME;
|
|
|
42185
42200
|
var TAGS = (process.env.JEFRI_TAGS ?? "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
42186
42201
|
var CAPS = (process.env.JEFRI_CAPABILITIES ?? "coding").split(",").map((s) => s.trim()).filter(Boolean);
|
|
42187
42202
|
var log = (...a) => console.error("[jefrichat-mcp]", ...a);
|
|
42203
|
+
var VERBOSE = process.env.JEFRI_DEBUG === "1" || process.env.JEFRI_VERBOSE === "1";
|
|
42204
|
+
var note = (...a) => {
|
|
42205
|
+
if (VERBOSE) log(...a);
|
|
42206
|
+
};
|
|
42188
42207
|
var TOKEN_CACHE = path3.join(os7.homedir(), ".jefri", "tokens.json");
|
|
42189
42208
|
var LEGACY_TOKEN_CACHE = path3.join(os7.homedir(), ".acp", "tokens.json");
|
|
42190
42209
|
var cacheKey = `${SERVER}::${USERNAME}`;
|
|
@@ -42317,9 +42336,9 @@ function ensureClient() {
|
|
|
42317
42336
|
log("control socket unavailable (panel disabled):", e?.message ?? e);
|
|
42318
42337
|
}
|
|
42319
42338
|
if (macNeedsTerminalNotifier)
|
|
42320
|
-
|
|
42339
|
+
note("tip: for reliable desktop notifications on macOS, run: brew install terminal-notifier");
|
|
42321
42340
|
if (getAuto().enabled)
|
|
42322
|
-
|
|
42341
|
+
note(`autonomous mode is ON \u2014 incoming messages will be handled by "${getAuto().brain}" in ${getAuto().workdir}`);
|
|
42323
42342
|
const handleIncoming = (m) => {
|
|
42324
42343
|
const preview = m.kind === "file" ? `\u{1F4CE} ${m.fileName ?? "file"}` : m.content ?? "";
|
|
42325
42344
|
const isGroup = !!m.groupId;
|
|
@@ -42414,7 +42433,7 @@ function ensureClient() {
|
|
|
42414
42433
|
);
|
|
42415
42434
|
});
|
|
42416
42435
|
c2.on("debate_cancel", (ev) => cancelDebate(String(ev?.debateId ?? ""), Number(ev?.turnSeq ?? -999)));
|
|
42417
|
-
|
|
42436
|
+
note(`connected to ${SERVER} as ${self}`);
|
|
42418
42437
|
return c2;
|
|
42419
42438
|
})().catch((e) => {
|
|
42420
42439
|
clientPromise = null;
|
|
@@ -42467,19 +42486,19 @@ async function main() {
|
|
|
42467
42486
|
}
|
|
42468
42487
|
};
|
|
42469
42488
|
await server.connect(transport);
|
|
42470
|
-
|
|
42489
|
+
note(`MCP server ready \u2014 identity @${USERNAME}, Jefri Chat server ${SERVER}`);
|
|
42471
42490
|
let shuttingDown = false;
|
|
42472
42491
|
const shutdownOnHostClose = () => {
|
|
42473
42492
|
if (shuttingDown) return;
|
|
42474
42493
|
shuttingDown = true;
|
|
42475
|
-
|
|
42494
|
+
note("host closed the connection (stdin EOF) \u2014 shutting connector down");
|
|
42476
42495
|
process.exit(0);
|
|
42477
42496
|
};
|
|
42478
42497
|
process.stdin.once("end", shutdownOnHostClose);
|
|
42479
42498
|
process.stdin.once("close", shutdownOnHostClose);
|
|
42480
42499
|
void checkForUpdate().then((u) => {
|
|
42481
42500
|
if (u?.outdated)
|
|
42482
|
-
|
|
42501
|
+
note(
|
|
42483
42502
|
`\u2191 update available: jefrichat-mcp ${u.current} \u2192 ${u.latest}. Reconnect this agent (npx jefrichat-mcp@latest, or 'npm update -g jefrichat-mcp@latest' if globally installed) to get it.`
|
|
42484
42503
|
);
|
|
42485
42504
|
}).catch(() => {
|
package/package.json
CHANGED