@yawlabs/mcph 0.47.5 → 0.47.6
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 +22 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1650,7 +1650,7 @@ function selectFlakyNamespaces(entries, limit) {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
|
|
1652
1652
|
// src/doctor-cmd.ts
|
|
1653
|
-
var VERSION = true ? "0.47.
|
|
1653
|
+
var VERSION = true ? "0.47.6" : "dev";
|
|
1654
1654
|
async function runDoctor(opts = {}) {
|
|
1655
1655
|
if (opts.json) return runDoctorJson(opts);
|
|
1656
1656
|
const lines = [];
|
|
@@ -3345,7 +3345,7 @@ function initHeartbeat(url, tok) {
|
|
|
3345
3345
|
apiUrl3 = url;
|
|
3346
3346
|
token3 = tok;
|
|
3347
3347
|
}
|
|
3348
|
-
async function reportHeartbeat(clientName, clientVersion) {
|
|
3348
|
+
async function reportHeartbeat(clientName, clientVersion, isRefresh = false) {
|
|
3349
3349
|
if (!apiUrl3 || !token3) return;
|
|
3350
3350
|
try {
|
|
3351
3351
|
const res = await request5(`${apiUrl3.replace(/\/$/, "")}${HEARTBEAT_PATH}`, {
|
|
@@ -3359,7 +3359,8 @@ async function reportHeartbeat(clientName, clientVersion) {
|
|
|
3359
3359
|
// normalizes (fallback to 'unknown', length caps) — keep this
|
|
3360
3360
|
// side dumb so a backend tightening doesn't need a CLI roll.
|
|
3361
3361
|
clientName: clientName ?? null,
|
|
3362
|
-
clientVersion: clientVersion ?? null
|
|
3362
|
+
clientVersion: clientVersion ?? null,
|
|
3363
|
+
isRefresh
|
|
3363
3364
|
}),
|
|
3364
3365
|
headersTimeout: 1e4,
|
|
3365
3366
|
bodyTimeout: 1e4
|
|
@@ -3367,15 +3368,15 @@ async function reportHeartbeat(clientName, clientVersion) {
|
|
|
3367
3368
|
await res.body.text().catch(() => {
|
|
3368
3369
|
});
|
|
3369
3370
|
if (res.statusCode >= 400 && res.statusCode !== 404) {
|
|
3370
|
-
log("warn", "Heartbeat failed", { status: res.statusCode });
|
|
3371
|
-
} else {
|
|
3371
|
+
log("warn", "Heartbeat failed", { status: res.statusCode, isRefresh });
|
|
3372
|
+
} else if (!isRefresh) {
|
|
3372
3373
|
log("info", "Reported AI client connect to mcp.hosting", {
|
|
3373
3374
|
clientName: clientName ?? null,
|
|
3374
3375
|
clientVersion: clientVersion ?? null
|
|
3375
3376
|
});
|
|
3376
3377
|
}
|
|
3377
3378
|
} catch (err) {
|
|
3378
|
-
log("warn", "Heartbeat error", { error: err?.message });
|
|
3379
|
+
log("warn", "Heartbeat error", { error: err?.message, isRefresh });
|
|
3379
3380
|
}
|
|
3380
3381
|
}
|
|
3381
3382
|
|
|
@@ -5014,7 +5015,7 @@ function categorizeSpawnError(err) {
|
|
|
5014
5015
|
}
|
|
5015
5016
|
async function connectToUpstream(config, onDisconnect, onListChanged) {
|
|
5016
5017
|
const client = new Client(
|
|
5017
|
-
{ name: "mcph", version: true ? "0.47.
|
|
5018
|
+
{ name: "mcph", version: true ? "0.47.6" : "dev" },
|
|
5018
5019
|
{ capabilities: {} }
|
|
5019
5020
|
);
|
|
5020
5021
|
let transport;
|
|
@@ -5322,7 +5323,7 @@ var ConnectServer = class _ConnectServer {
|
|
|
5322
5323
|
this.apiUrl = apiUrl6;
|
|
5323
5324
|
this.token = token6;
|
|
5324
5325
|
this.server = new Server(
|
|
5325
|
-
{ name: "mcph", version: true ? "0.47.
|
|
5326
|
+
{ name: "mcph", version: true ? "0.47.6" : "dev" },
|
|
5326
5327
|
{
|
|
5327
5328
|
capabilities: {
|
|
5328
5329
|
tools: { listChanged: true },
|
|
@@ -5340,6 +5341,10 @@ var ConnectServer = class _ConnectServer {
|
|
|
5340
5341
|
config = null;
|
|
5341
5342
|
configVersion = null;
|
|
5342
5343
|
pollTimer = null;
|
|
5344
|
+
// Flipped true once the first MCP `initialize` lands (see
|
|
5345
|
+
// this.server.oninitialized). Gates the per-poll heartbeat refresh so
|
|
5346
|
+
// we only ping liveness while a client is actually attached.
|
|
5347
|
+
aiClientAttached = false;
|
|
5343
5348
|
toolRoutes = /* @__PURE__ */ new Map();
|
|
5344
5349
|
resourceRoutes = /* @__PURE__ */ new Map();
|
|
5345
5350
|
promptRoutes = /* @__PURE__ */ new Map();
|
|
@@ -5590,6 +5595,7 @@ var ConnectServer = class _ConnectServer {
|
|
|
5590
5595
|
ensureUv().catch((err) => log("warn", "uv prewarm failed", { error: err?.message }));
|
|
5591
5596
|
}
|
|
5592
5597
|
this.server.oninitialized = () => {
|
|
5598
|
+
this.aiClientAttached = true;
|
|
5593
5599
|
const info = this.server.getClientVersion();
|
|
5594
5600
|
reportHeartbeat(info?.name, info?.version).catch(
|
|
5595
5601
|
(err) => log("warn", "reportHeartbeat failed", { error: err?.message })
|
|
@@ -6758,6 +6764,12 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
6758
6764
|
} catch (err) {
|
|
6759
6765
|
log("warn", "Config poll failed", { error: err.message });
|
|
6760
6766
|
}
|
|
6767
|
+
if (this.aiClientAttached) {
|
|
6768
|
+
const info = this.server.getClientVersion();
|
|
6769
|
+
reportHeartbeat(info?.name, info?.version, true).catch(
|
|
6770
|
+
(err) => log("warn", "reportHeartbeat refresh failed", { error: err?.message })
|
|
6771
|
+
);
|
|
6772
|
+
}
|
|
6761
6773
|
this.pollTimer = setTimeout(poll, intervalMs);
|
|
6762
6774
|
if (this.pollTimer.unref) this.pollTimer.unref();
|
|
6763
6775
|
};
|
|
@@ -7690,7 +7702,7 @@ Or re-run with --run to upgrade in place.`);
|
|
|
7690
7702
|
return { exitCode: 3, lines };
|
|
7691
7703
|
}
|
|
7692
7704
|
function readCurrentVersion() {
|
|
7693
|
-
return true ? "0.47.
|
|
7705
|
+
return true ? "0.47.6" : "dev";
|
|
7694
7706
|
}
|
|
7695
7707
|
|
|
7696
7708
|
// src/index.ts
|
|
@@ -7858,7 +7870,7 @@ if (subcommand === "compliance") {
|
|
|
7858
7870
|
`);
|
|
7859
7871
|
process.exit(0);
|
|
7860
7872
|
} else if (subcommand === "--version" || subcommand === "-V") {
|
|
7861
|
-
process.stdout.write(`mcph ${true ? "0.47.
|
|
7873
|
+
process.stdout.write(`mcph ${true ? "0.47.6" : "dev"}
|
|
7862
7874
|
`);
|
|
7863
7875
|
process.exit(0);
|
|
7864
7876
|
} else if (subcommand && !subcommand.startsWith("-")) {
|
package/package.json
CHANGED