@essentialai/cogent-bridge-bundled 3.21.5 → 3.21.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/cogent-bridge.mjs +39 -6
- 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.6") {
|
|
26393
|
+
return "3.21.6";
|
|
26394
26394
|
}
|
|
26395
26395
|
try {
|
|
26396
26396
|
const require2 = createRequire(import.meta.url);
|
|
@@ -33248,9 +33248,9 @@ ${message}${formatAttachmentsBlock(attachments)}
|
|
|
33248
33248
|
---
|
|
33249
33249
|
FYI ONLY \u2014 another agent addressed the whole channel. Take note for context, but do NOT reply and do NOT call any cogent_* tool in response. A human will drive any reply.`;
|
|
33250
33250
|
}
|
|
33251
|
-
function describeWakeFailure(exitCode, stderr) {
|
|
33251
|
+
function describeWakeFailure(exitCode, stderr, stdout) {
|
|
33252
33252
|
const raw = (stderr ?? "").trim();
|
|
33253
|
-
if (!raw && exitCode !== 0) return "";
|
|
33253
|
+
if (!raw && exitCode !== 0 && !stdout) return "";
|
|
33254
33254
|
const firstLine = raw.split("\n").map((l) => l.trim()).find(Boolean) ?? "";
|
|
33255
33255
|
const missing = /No conversation found with session ID:?\s*(\S+)/i.exec(raw);
|
|
33256
33256
|
if (missing) {
|
|
@@ -33269,6 +33269,25 @@ function describeWakeFailure(exitCode, stderr) {
|
|
|
33269
33269
|
`the resume timed out after ${timedOut[1]}ms (COGENT_TIMEOUT_MS) \u2014 the agent was still working, not idle.`
|
|
33270
33270
|
);
|
|
33271
33271
|
}
|
|
33272
|
+
const childStderr = /\. stderr:\s*([\s\S]*)$/.exec(raw)?.[1]?.trim() ?? raw;
|
|
33273
|
+
if (!childStderr) {
|
|
33274
|
+
const code = exitCode === null || exitCode === void 0 ? "?" : exitCode;
|
|
33275
|
+
const env = parseResultEnvelope(stdout);
|
|
33276
|
+
if (env) {
|
|
33277
|
+
const bits = [];
|
|
33278
|
+
if (env.terminalReason) {
|
|
33279
|
+
bits.push(
|
|
33280
|
+
env.terminalReason === "api_error" ? `the CLI could not complete an API call (terminal_reason "api_error") \u2014 check that agent's Claude credentials / API access` : `terminal_reason "${env.terminalReason}"`
|
|
33281
|
+
);
|
|
33282
|
+
}
|
|
33283
|
+
if (env.result) bits.push(env.result);
|
|
33284
|
+
if (!bits.length && env.isError) bits.push("the run reported is_error with no detail");
|
|
33285
|
+
if (bits.length) return truncate(`claude exited ${code}: ${bits.join(" \u2014 ")}`);
|
|
33286
|
+
}
|
|
33287
|
+
return truncate(
|
|
33288
|
+
stdout?.trim() ? `claude exited ${code} with nothing on stderr; its stdout was not a readable result envelope` : `claude exited ${code} with no output at all on stdout or stderr`
|
|
33289
|
+
);
|
|
33290
|
+
}
|
|
33272
33291
|
if (firstLine) {
|
|
33273
33292
|
const code = exitCode === null || exitCode === void 0 ? "?" : exitCode;
|
|
33274
33293
|
return truncate(`claude exited ${code}: ${firstLine}`);
|
|
@@ -33278,6 +33297,19 @@ function describeWakeFailure(exitCode, stderr) {
|
|
|
33278
33297
|
}
|
|
33279
33298
|
return "";
|
|
33280
33299
|
}
|
|
33300
|
+
function parseResultEnvelope(stdout) {
|
|
33301
|
+
const text = (stdout ?? "").trim();
|
|
33302
|
+
if (!text.startsWith("{")) return null;
|
|
33303
|
+
try {
|
|
33304
|
+
const o = JSON.parse(text);
|
|
33305
|
+
const result = typeof o.result === "string" && o.result.trim() ? o.result.trim() : null;
|
|
33306
|
+
const terminalReason = typeof o.terminal_reason === "string" && o.terminal_reason.trim() ? o.terminal_reason.trim() : null;
|
|
33307
|
+
if (o.is_error === void 0 && !terminalReason && !result) return null;
|
|
33308
|
+
return { isError: o.is_error === true, terminalReason, result };
|
|
33309
|
+
} catch {
|
|
33310
|
+
return null;
|
|
33311
|
+
}
|
|
33312
|
+
}
|
|
33281
33313
|
function truncate(s) {
|
|
33282
33314
|
const flat = s.replace(/\s+/g, " ").trim();
|
|
33283
33315
|
return flat.length > DIAGNOSTIC_MAX ? `${flat.slice(0, DIAGNOSTIC_MAX - 1)}\u2026` : flat;
|
|
@@ -33942,7 +33974,8 @@ var init_auto_relay = __esm({
|
|
|
33942
33974
|
await this._recordNoReplyFailure(msg, traceId, Date.now() - startMs, {
|
|
33943
33975
|
codexLiveSession: result.codexLiveSession === true,
|
|
33944
33976
|
exitCode: result.exitCode,
|
|
33945
|
-
stderr: result.stderr
|
|
33977
|
+
stderr: result.stderr,
|
|
33978
|
+
stdout: result.stdout
|
|
33946
33979
|
});
|
|
33947
33980
|
}
|
|
33948
33981
|
} catch (err) {
|
|
@@ -33968,7 +34001,7 @@ var init_auto_relay = __esm({
|
|
|
33968
34001
|
*/
|
|
33969
34002
|
async _recordNoReplyFailure(msg, traceId, durationMs, opts) {
|
|
33970
34003
|
const codexLive = opts?.codexLiveSession === true;
|
|
33971
|
-
const message = codexLive ? `\u{1F4E8} Queued for "${this.localPeerId}": it's live in an interactive Codex session, so Cogent can't resume it in real time \u2014 it will see this at its next turn. For real-time replies, launch it via \`cogent-codex\` (COGENT_CODEX_WAKE=app-server). (trace ${traceId})` : `\u26A0\uFE0F Cogent could not capture a reply from "${this.localPeerId}". ${describeWakeFailure(opts?.exitCode, opts?.stderr) || "It may have been busy, or the resume produced no output."} Manual response required \u2014 the target agent must reply in its own session. (trace ${traceId})`;
|
|
34004
|
+
const message = codexLive ? `\u{1F4E8} Queued for "${this.localPeerId}": it's live in an interactive Codex session, so Cogent can't resume it in real time \u2014 it will see this at its next turn. For real-time replies, launch it via \`cogent-codex\` (COGENT_CODEX_WAKE=app-server). (trace ${traceId})` : `\u26A0\uFE0F Cogent could not capture a reply from "${this.localPeerId}". ${describeWakeFailure(opts?.exitCode, opts?.stderr, opts?.stdout) || "It may have been busy, or the resume produced no output."} Manual response required \u2014 the target agent must reply in its own session. (trace ${traceId})`;
|
|
33972
34005
|
try {
|
|
33973
34006
|
await getBackend().recordMessage({
|
|
33974
34007
|
fromPeerId: this.localPeerId,
|
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.6",
|
|
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": {
|