@yawlabs/mcph 0.47.5 → 0.47.7
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 +25 -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.7" : "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.7" : "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.7" : "dev" },
|
|
5326
5327
|
{
|
|
5327
5328
|
capabilities: {
|
|
5328
5329
|
tools: { listChanged: true },
|
|
@@ -5340,6 +5341,14 @@ var ConnectServer = class _ConnectServer {
|
|
|
5340
5341
|
config = null;
|
|
5341
5342
|
configVersion = null;
|
|
5342
5343
|
pollTimer = null;
|
|
5344
|
+
// Captures the AI client's Implementation block once the first MCP
|
|
5345
|
+
// `initialize` lands (see this.server.oninitialized). Non-null means a
|
|
5346
|
+
// client is attached. The per-poll heartbeat refresh reuses these
|
|
5347
|
+
// exact values so its upsert always targets the same
|
|
5348
|
+
// (accountId, clientName) key the attach beacon created; re-reading
|
|
5349
|
+
// getClientVersion() per poll risked a transient undefined becoming a
|
|
5350
|
+
// split-brain 'unknown' row on the backend.
|
|
5351
|
+
attachedClient = null;
|
|
5343
5352
|
toolRoutes = /* @__PURE__ */ new Map();
|
|
5344
5353
|
resourceRoutes = /* @__PURE__ */ new Map();
|
|
5345
5354
|
promptRoutes = /* @__PURE__ */ new Map();
|
|
@@ -5591,6 +5600,7 @@ var ConnectServer = class _ConnectServer {
|
|
|
5591
5600
|
}
|
|
5592
5601
|
this.server.oninitialized = () => {
|
|
5593
5602
|
const info = this.server.getClientVersion();
|
|
5603
|
+
this.attachedClient = { name: info?.name, version: info?.version };
|
|
5594
5604
|
reportHeartbeat(info?.name, info?.version).catch(
|
|
5595
5605
|
(err) => log("warn", "reportHeartbeat failed", { error: err?.message })
|
|
5596
5606
|
);
|
|
@@ -6758,6 +6768,11 @@ ${activeCount} loaded in this session, ${totalTools} tools in context${tokenSumm
|
|
|
6758
6768
|
} catch (err) {
|
|
6759
6769
|
log("warn", "Config poll failed", { error: err.message });
|
|
6760
6770
|
}
|
|
6771
|
+
if (this.attachedClient) {
|
|
6772
|
+
reportHeartbeat(this.attachedClient.name, this.attachedClient.version, true).catch(
|
|
6773
|
+
(err) => log("warn", "reportHeartbeat refresh failed", { error: err?.message })
|
|
6774
|
+
);
|
|
6775
|
+
}
|
|
6761
6776
|
this.pollTimer = setTimeout(poll, intervalMs);
|
|
6762
6777
|
if (this.pollTimer.unref) this.pollTimer.unref();
|
|
6763
6778
|
};
|
|
@@ -7690,7 +7705,7 @@ Or re-run with --run to upgrade in place.`);
|
|
|
7690
7705
|
return { exitCode: 3, lines };
|
|
7691
7706
|
}
|
|
7692
7707
|
function readCurrentVersion() {
|
|
7693
|
-
return true ? "0.47.
|
|
7708
|
+
return true ? "0.47.7" : "dev";
|
|
7694
7709
|
}
|
|
7695
7710
|
|
|
7696
7711
|
// src/index.ts
|
|
@@ -7858,7 +7873,7 @@ if (subcommand === "compliance") {
|
|
|
7858
7873
|
`);
|
|
7859
7874
|
process.exit(0);
|
|
7860
7875
|
} else if (subcommand === "--version" || subcommand === "-V") {
|
|
7861
|
-
process.stdout.write(`mcph ${true ? "0.47.
|
|
7876
|
+
process.stdout.write(`mcph ${true ? "0.47.7" : "dev"}
|
|
7862
7877
|
`);
|
|
7863
7878
|
process.exit(0);
|
|
7864
7879
|
} else if (subcommand && !subcommand.startsWith("-")) {
|
package/package.json
CHANGED