@essentialai/cogent-bridge-bundled 3.21.7 → 3.21.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.
- package/cogent-bridge.mjs +37 -12
- 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.21.
|
|
26393
|
-
return "3.21.
|
|
26392
|
+
if ("3.21.9") {
|
|
26393
|
+
return "3.21.9";
|
|
26394
26394
|
}
|
|
26395
26395
|
try {
|
|
26396
26396
|
const require2 = createRequire(import.meta.url);
|
|
@@ -26499,8 +26499,26 @@ function isNewer(current, latest) {
|
|
|
26499
26499
|
return false;
|
|
26500
26500
|
}
|
|
26501
26501
|
function setLastNudge(nudge) {
|
|
26502
|
+
if (nudge !== lastNudge) shownNudge = null;
|
|
26502
26503
|
lastNudge = nudge;
|
|
26503
26504
|
}
|
|
26505
|
+
function consumeNudgeOnce() {
|
|
26506
|
+
if (!lastNudge || lastNudge === shownNudge) return null;
|
|
26507
|
+
shownNudge = lastNudge;
|
|
26508
|
+
return lastNudge;
|
|
26509
|
+
}
|
|
26510
|
+
function startUpdateCheckLoop(current, opts = {}) {
|
|
26511
|
+
const { intervalMs = 6 * 60 * 60 * 1e3, ...checkOpts } = opts;
|
|
26512
|
+
const run = () => {
|
|
26513
|
+
void checkForUpdate(current, checkOpts).then((nudge) => {
|
|
26514
|
+
if (nudge) setLastNudge(nudge);
|
|
26515
|
+
});
|
|
26516
|
+
};
|
|
26517
|
+
run();
|
|
26518
|
+
const timer = setInterval(run, intervalMs);
|
|
26519
|
+
timer.unref?.();
|
|
26520
|
+
return () => clearInterval(timer);
|
|
26521
|
+
}
|
|
26504
26522
|
function getLastNudge() {
|
|
26505
26523
|
return lastNudge;
|
|
26506
26524
|
}
|
|
@@ -26524,13 +26542,14 @@ async function checkForUpdate(current, opts = {}) {
|
|
|
26524
26542
|
clearTimeout(timer);
|
|
26525
26543
|
}
|
|
26526
26544
|
}
|
|
26527
|
-
var NPM_LATEST_URL, lastNudge;
|
|
26545
|
+
var NPM_LATEST_URL, lastNudge, shownNudge;
|
|
26528
26546
|
var init_npm_update_check = __esm({
|
|
26529
26547
|
"src/backend/npm-update-check.ts"() {
|
|
26530
26548
|
"use strict";
|
|
26531
26549
|
init_logger();
|
|
26532
26550
|
NPM_LATEST_URL = "https://registry.npmjs.org/@essentialai/cogent-bridge/latest";
|
|
26533
26551
|
lastNudge = null;
|
|
26552
|
+
shownNudge = null;
|
|
26534
26553
|
}
|
|
26535
26554
|
});
|
|
26536
26555
|
|
|
@@ -27393,13 +27412,14 @@ async function execClaude(sessionId, message, cwd, timeoutMs) {
|
|
|
27393
27412
|
function parseClaudeJsonReply(raw) {
|
|
27394
27413
|
const trimmed = raw.trim();
|
|
27395
27414
|
if (!trimmed) return null;
|
|
27396
|
-
let
|
|
27415
|
+
let parsed;
|
|
27397
27416
|
try {
|
|
27398
|
-
|
|
27417
|
+
parsed = JSON.parse(trimmed);
|
|
27399
27418
|
} catch {
|
|
27400
27419
|
return null;
|
|
27401
27420
|
}
|
|
27402
|
-
|
|
27421
|
+
const env = Array.isArray(parsed) ? [...parsed].reverse().find((e) => e?.type === "result") : parsed;
|
|
27422
|
+
if (!env || env.type !== "result") return null;
|
|
27403
27423
|
const result = typeof env.result === "string" ? env.result : null;
|
|
27404
27424
|
return { result, isError: env.is_error === true || env.subtype !== "success" };
|
|
27405
27425
|
}
|
|
@@ -33237,7 +33257,15 @@ function formatRelayMessage(fromLabel, fromPeerId, message, attachments) {
|
|
|
33237
33257
|
${message}${formatAttachmentsBlock(attachments)}
|
|
33238
33258
|
|
|
33239
33259
|
---
|
|
33240
|
-
Respond directly to the message above. Your entire response is delivered automatically to whoever should receive it \u2014 a broadcast question (to the whole channel) is answered to everyone; a direct message, to the sender. You do NOT need to \u2014 and should NOT \u2014 call cogent_send_message or any bridge tool to deliver it; just answer normally
|
|
33260
|
+
Respond directly to the message above. Your entire response is delivered automatically to whoever should receive it \u2014 a broadcast question (to the whole channel) is answered to everyone; a direct message, to the sender. You do NOT need to \u2014 and should NOT \u2014 call cogent_send_message or any bridge tool to deliver it; just answer normally.` + updateNoticeFooter();
|
|
33261
|
+
}
|
|
33262
|
+
function updateNoticeFooter() {
|
|
33263
|
+
const nudge = consumeNudgeOnce();
|
|
33264
|
+
if (!nudge) return "";
|
|
33265
|
+
return `
|
|
33266
|
+
|
|
33267
|
+
---
|
|
33268
|
+
[Cogent FYI \u2014 not part of the message above, and not a task for you] ${nudge} You cannot apply this yourself; mention it to your operator when convenient, then carry on. Do not reply about it and do not call any cogent_* tool for it.`;
|
|
33241
33269
|
}
|
|
33242
33270
|
function formatInjectOnlyMessage(fromLabel, fromPeerId, message, attachments) {
|
|
33243
33271
|
return `[Cogent Bridge: Response from ${fromLabel} (${fromPeerId})]
|
|
@@ -33333,6 +33361,7 @@ var init_auto_relay = __esm({
|
|
|
33333
33361
|
init_codex_cli();
|
|
33334
33362
|
init_wake_inflight();
|
|
33335
33363
|
init_logger();
|
|
33364
|
+
init_npm_update_check();
|
|
33336
33365
|
RELAY_STATUS = {
|
|
33337
33366
|
QUEUED: "queued",
|
|
33338
33367
|
PROCESSING: "processing",
|
|
@@ -37022,11 +37051,7 @@ async function main() {
|
|
|
37022
37051
|
`Preflight error (non-fatal): ${err instanceof Error ? err.message : String(err)}`
|
|
37023
37052
|
);
|
|
37024
37053
|
});
|
|
37025
|
-
|
|
37026
|
-
setLastNudge(nudge);
|
|
37027
|
-
if (nudge) process.stderr.write(`${nudge}
|
|
37028
|
-
`);
|
|
37029
|
-
});
|
|
37054
|
+
startUpdateCheckLoop(SERVER_VERSION);
|
|
37030
37055
|
logger.info(
|
|
37031
37056
|
"Server ready. Tools: cogent_register_peer, cogent_deregister_peer, cogent_send_message, cogent_list_peers, cogent_get_history, cogent_health_check, cogent_create_session, cogent_join_session"
|
|
37032
37057
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@essentialai/cogent-bridge-bundled",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.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": {
|