@essentialai/cogent-bridge-bundled 3.21.5 → 3.21.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/cogent-bridge.mjs +48 -7
- 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.7") {
|
|
26393
|
+
return "3.21.7";
|
|
26394
26394
|
}
|
|
26395
26395
|
try {
|
|
26396
26396
|
const require2 = createRequire(import.meta.url);
|
|
@@ -32626,11 +32626,19 @@ var init_codex_cli = __esm({
|
|
|
32626
32626
|
|
|
32627
32627
|
// src/services/codex-app-server.ts
|
|
32628
32628
|
import path13 from "node:path";
|
|
32629
|
+
import { statSync } from "node:fs";
|
|
32629
32630
|
import fs12 from "node:fs/promises";
|
|
32630
32631
|
import { spawn as spawn3, spawnSync } from "node:child_process";
|
|
32631
32632
|
function appServerSocketPath(codexHome = codexHomeDir()) {
|
|
32632
32633
|
return path13.join(codexHome, "app-server-control", "app-server-control.sock");
|
|
32633
32634
|
}
|
|
32635
|
+
function appServerDaemonRunning(codexHome = codexHomeDir()) {
|
|
32636
|
+
try {
|
|
32637
|
+
return statSync(appServerSocketPath(codexHome)).isSocket();
|
|
32638
|
+
} catch {
|
|
32639
|
+
return false;
|
|
32640
|
+
}
|
|
32641
|
+
}
|
|
32634
32642
|
function rpcUrl(sock) {
|
|
32635
32643
|
return `ws+unix://${sock}:/rpc`;
|
|
32636
32644
|
}
|
|
@@ -32959,7 +32967,7 @@ var init_codex_app_server = __esm({
|
|
|
32959
32967
|
// src/services/exec-remote.ts
|
|
32960
32968
|
async function execCodexWake(sessionId, message, cwd, timeoutMs, idempotencyKey) {
|
|
32961
32969
|
const wake = getConfig().COGENT_CODEX_WAKE;
|
|
32962
|
-
const useAppServer = wake === "app-server" || wake === "auto" && runningUnderAppServerDaemon();
|
|
32970
|
+
const useAppServer = wake === "app-server" || wake === "auto" && (runningUnderAppServerDaemon() || appServerDaemonRunning());
|
|
32963
32971
|
if (useAppServer) {
|
|
32964
32972
|
try {
|
|
32965
32973
|
const sock = await ensureDaemon();
|
|
@@ -33248,9 +33256,9 @@ ${message}${formatAttachmentsBlock(attachments)}
|
|
|
33248
33256
|
---
|
|
33249
33257
|
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
33258
|
}
|
|
33251
|
-
function describeWakeFailure(exitCode, stderr) {
|
|
33259
|
+
function describeWakeFailure(exitCode, stderr, stdout) {
|
|
33252
33260
|
const raw = (stderr ?? "").trim();
|
|
33253
|
-
if (!raw && exitCode !== 0) return "";
|
|
33261
|
+
if (!raw && exitCode !== 0 && !stdout) return "";
|
|
33254
33262
|
const firstLine = raw.split("\n").map((l) => l.trim()).find(Boolean) ?? "";
|
|
33255
33263
|
const missing = /No conversation found with session ID:?\s*(\S+)/i.exec(raw);
|
|
33256
33264
|
if (missing) {
|
|
@@ -33269,6 +33277,25 @@ function describeWakeFailure(exitCode, stderr) {
|
|
|
33269
33277
|
`the resume timed out after ${timedOut[1]}ms (COGENT_TIMEOUT_MS) \u2014 the agent was still working, not idle.`
|
|
33270
33278
|
);
|
|
33271
33279
|
}
|
|
33280
|
+
const childStderr = /\. stderr:\s*([\s\S]*)$/.exec(raw)?.[1]?.trim() ?? raw;
|
|
33281
|
+
if (!childStderr) {
|
|
33282
|
+
const code = exitCode === null || exitCode === void 0 ? "?" : exitCode;
|
|
33283
|
+
const env = parseResultEnvelope(stdout);
|
|
33284
|
+
if (env) {
|
|
33285
|
+
const bits = [];
|
|
33286
|
+
if (env.terminalReason) {
|
|
33287
|
+
bits.push(
|
|
33288
|
+
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}"`
|
|
33289
|
+
);
|
|
33290
|
+
}
|
|
33291
|
+
if (env.result) bits.push(env.result);
|
|
33292
|
+
if (!bits.length && env.isError) bits.push("the run reported is_error with no detail");
|
|
33293
|
+
if (bits.length) return truncate(`claude exited ${code}: ${bits.join(" \u2014 ")}`);
|
|
33294
|
+
}
|
|
33295
|
+
return truncate(
|
|
33296
|
+
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`
|
|
33297
|
+
);
|
|
33298
|
+
}
|
|
33272
33299
|
if (firstLine) {
|
|
33273
33300
|
const code = exitCode === null || exitCode === void 0 ? "?" : exitCode;
|
|
33274
33301
|
return truncate(`claude exited ${code}: ${firstLine}`);
|
|
@@ -33278,6 +33305,19 @@ function describeWakeFailure(exitCode, stderr) {
|
|
|
33278
33305
|
}
|
|
33279
33306
|
return "";
|
|
33280
33307
|
}
|
|
33308
|
+
function parseResultEnvelope(stdout) {
|
|
33309
|
+
const text = (stdout ?? "").trim();
|
|
33310
|
+
if (!text.startsWith("{")) return null;
|
|
33311
|
+
try {
|
|
33312
|
+
const o = JSON.parse(text);
|
|
33313
|
+
const result = typeof o.result === "string" && o.result.trim() ? o.result.trim() : null;
|
|
33314
|
+
const terminalReason = typeof o.terminal_reason === "string" && o.terminal_reason.trim() ? o.terminal_reason.trim() : null;
|
|
33315
|
+
if (o.is_error === void 0 && !terminalReason && !result) return null;
|
|
33316
|
+
return { isError: o.is_error === true, terminalReason, result };
|
|
33317
|
+
} catch {
|
|
33318
|
+
return null;
|
|
33319
|
+
}
|
|
33320
|
+
}
|
|
33281
33321
|
function truncate(s) {
|
|
33282
33322
|
const flat = s.replace(/\s+/g, " ").trim();
|
|
33283
33323
|
return flat.length > DIAGNOSTIC_MAX ? `${flat.slice(0, DIAGNOSTIC_MAX - 1)}\u2026` : flat;
|
|
@@ -33942,7 +33982,8 @@ var init_auto_relay = __esm({
|
|
|
33942
33982
|
await this._recordNoReplyFailure(msg, traceId, Date.now() - startMs, {
|
|
33943
33983
|
codexLiveSession: result.codexLiveSession === true,
|
|
33944
33984
|
exitCode: result.exitCode,
|
|
33945
|
-
stderr: result.stderr
|
|
33985
|
+
stderr: result.stderr,
|
|
33986
|
+
stdout: result.stdout
|
|
33946
33987
|
});
|
|
33947
33988
|
}
|
|
33948
33989
|
} catch (err) {
|
|
@@ -33968,7 +34009,7 @@ var init_auto_relay = __esm({
|
|
|
33968
34009
|
*/
|
|
33969
34010
|
async _recordNoReplyFailure(msg, traceId, durationMs, opts) {
|
|
33970
34011
|
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})`;
|
|
34012
|
+
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
34013
|
try {
|
|
33973
34014
|
await getBackend().recordMessage({
|
|
33974
34015
|
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.7",
|
|
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": {
|