@essentialai/cogent-bridge-bundled 3.23.8 → 3.23.9

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.
Files changed (2) hide show
  1. package/cogent-bridge.mjs +44 -6
  2. package/package.json +1 -1
package/cogent-bridge.mjs CHANGED
@@ -26389,8 +26389,8 @@ var init_stdio2 = __esm({
26389
26389
  // src/constants.ts
26390
26390
  import { createRequire } from "node:module";
26391
26391
  function resolveVersion() {
26392
- if ("3.23.8") {
26393
- return "3.23.8";
26392
+ if ("3.23.9") {
26393
+ return "3.23.9";
26394
26394
  }
26395
26395
  try {
26396
26396
  const require2 = createRequire(import.meta.url);
@@ -32141,6 +32141,15 @@ var init_ws_client = __esm({
32141
32141
  backoff;
32142
32142
  reconnectTimer = null;
32143
32143
  pollTimer = null;
32144
+ /**
32145
+ * DELIVERY-PATH EVIDENCE. Before 3.23.9 a poll failure was caught and only logger.warn'd, so the
32146
+ * bridge had no idea whether its FALLBACK delivery path worked — and `healthy` could not be
32147
+ * computed honestly because the data did not exist. Captured evidence that nothing reads is the
32148
+ * defect shape this codebase keeps hitting.
32149
+ */
32150
+ lastPollOkAt = null;
32151
+ lastPollError = null;
32152
+ lastWsErrorSticky = null;
32144
32153
  pingTimer = null;
32145
32154
  lastMessageId = null;
32146
32155
  /**
@@ -32219,6 +32228,7 @@ var init_ws_client = __esm({
32219
32228
  this.ws = ws;
32220
32229
  ws.on("open", () => {
32221
32230
  if (generation !== this.connectionGeneration || this.ws !== ws) return;
32231
+ this.lastWsErrorSticky = null;
32222
32232
  this.setState("connected");
32223
32233
  this.backoff.reset();
32224
32234
  this.stopPolling();
@@ -32275,6 +32285,7 @@ var init_ws_client = __esm({
32275
32285
  ws.on("error", (err) => {
32276
32286
  if (generation !== this.connectionGeneration || this.ws !== ws) return;
32277
32287
  this.lastWsError = err.message;
32288
+ this.lastWsErrorSticky = err.message;
32278
32289
  logger.error(`CloudWsClient: WebSocket error: ${err.message}`);
32279
32290
  });
32280
32291
  }
@@ -32338,6 +32349,18 @@ var init_ws_client = __esm({
32338
32349
  * ISO string. Survives reconnects, same as `getLastFrameAt()`.
32339
32350
  * Audit L2.
32340
32351
  */
32352
+ /**
32353
+ * What this bridge's DELIVERY situation actually is — the input `healthy` needs in order to
32354
+ * describe THIS BRIDGE rather than the relay's uptime.
32355
+ */
32356
+ getDeliveryDiagnostics() {
32357
+ return {
32358
+ pollActive: this.pollTimer !== null,
32359
+ lastPollOkAt: this.lastPollOkAt,
32360
+ lastPollError: this.lastPollError,
32361
+ lastWsError: this.lastWsErrorSticky
32362
+ };
32363
+ }
32341
32364
  getLastFrameAtMs() {
32342
32365
  return this.lastFrameAt;
32343
32366
  }
@@ -32474,10 +32497,11 @@ var init_ws_client = __esm({
32474
32497
  this.opts.onMessages(result.messages);
32475
32498
  this.advanceCursor(result.messages[result.messages.length - 1].id);
32476
32499
  }
32500
+ this.lastPollOkAt = Date.now();
32501
+ this.lastPollError = null;
32477
32502
  } catch (err) {
32478
- logger.warn(
32479
- `CloudWsClient: Poll failed: ${err instanceof Error ? err.message : String(err)}`
32480
- );
32503
+ this.lastPollError = err instanceof Error ? err.message : String(err);
32504
+ logger.warn(`CloudWsClient: Poll failed: ${this.lastPollError}`);
32481
32505
  }
32482
32506
  };
32483
32507
  void poll();
@@ -37134,12 +37158,14 @@ function registerHealthCheckTool(server) {
37134
37158
  const backend = getBackend();
37135
37159
  const result = await backend.checkHealth();
37136
37160
  let wsConnected = false;
37161
+ let delivery = null;
37137
37162
  let wsLastFrameAt = null;
37138
37163
  let wsLastFrameAtMs = null;
37139
37164
  try {
37140
37165
  const startup = await Promise.resolve().then(() => (init_startup(), startup_exports));
37141
37166
  if (startup.cloudWsClient) {
37142
37167
  wsConnected = startup.cloudWsClient.isConnected();
37168
+ delivery = startup.cloudWsClient.getDeliveryDiagnostics?.() ?? null;
37143
37169
  wsLastFrameAt = startup.cloudWsClient.getLastFrameAt();
37144
37170
  wsLastFrameAtMs = startup.cloudWsClient.getLastFrameAtMs();
37145
37171
  }
@@ -37177,8 +37203,20 @@ function registerHealthCheckTool(server) {
37177
37203
  }
37178
37204
  }
37179
37205
  const updateAvailable = getLastNudge();
37206
+ const relayHealthy = result.healthy !== false;
37207
+ let deliveryPath = "unknown";
37208
+ if (cloud && delivery) {
37209
+ deliveryPath = wsConnected ? "websocket" : delivery.pollActive && !delivery.lastPollError ? "poll" : "none";
37210
+ } else if (cloud && wsConnected) {
37211
+ deliveryPath = "websocket";
37212
+ }
37213
+ const registered = autoRelay.getDiagnostics().registered;
37214
+ const deliveryBroken = cloud && registered && deliveryPath === "none";
37215
+ const unhealthyReason = deliveryBroken ? `registered as a cloud peer but NO delivery path is working (websocket down${delivery?.lastWsError ? `: ${delivery.lastWsError}` : ""}; poll ${delivery?.lastPollError ? `failing: ${delivery.lastPollError}` : "inactive"}) \u2014 messages addressed to this peer cannot reach it` : null;
37180
37216
  const enriched = {
37181
37217
  ...JSON.parse(JSON.stringify(result)),
37218
+ healthy: relayHealthy && !deliveryBroken,
37219
+ ...unhealthyReason ? { unhealthyReason } : {},
37182
37220
  clientVersion: SERVER_VERSION,
37183
37221
  ...updateAvailable ? { updateAvailable } : {},
37184
37222
  runtimeMode: cloud ? "cloud" : "local",
@@ -37198,7 +37236,7 @@ function registerHealthCheckTool(server) {
37198
37236
  // on HttpBackend; null when the /api/health fetch fails. Keep the
37199
37237
  // key cloud-gated for shape consistency with wsHealth (local mode
37200
37238
  // never has an upstream relay version to report).
37201
- ...cloud ? { wsHealth, relayVersion } : {}
37239
+ ...cloud ? { wsHealth, relayVersion, deliveryPath, lastWsError: delivery?.lastWsError ?? null } : {}
37202
37240
  },
37203
37241
  autoRelay: autoRelay.getDiagnostics()
37204
37242
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@essentialai/cogent-bridge-bundled",
3
- "version": "3.23.8",
3
+ "version": "3.23.9",
4
4
  "description": "Zero-dependency, pre-bundled Cogent MCP bridge — a single self-contained file for fast cold `npx` startup (used by the Codex plugin, whose MCP startup window is short). Functionally identical to @essentialai/cogent-bridge; carries no npm dependencies so `npx` skips dependency install.",
5
5
  "type": "module",
6
6
  "bin": {