@raysonmeng/agentbridge 0.1.8 → 0.1.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.
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
{
|
|
13
13
|
"name": "agentbridge",
|
|
14
14
|
"description": "Bridge Claude Code and Codex through a shared daemon, push channel delivery, and reply/get_messages tools.",
|
|
15
|
-
"version": "0.1.
|
|
15
|
+
"version": "0.1.9",
|
|
16
16
|
"author": {
|
|
17
17
|
"name": "AgentBridge Contributors",
|
|
18
18
|
"email": "raysonmeng@qq.com"
|
package/dist/cli.js
CHANGED
|
@@ -120,7 +120,7 @@ function parsePositiveIntEnv(name, fallback, log = () => {}, env = process.env)
|
|
|
120
120
|
var require_package = __commonJS((exports, module) => {
|
|
121
121
|
module.exports = {
|
|
122
122
|
name: "@raysonmeng/agentbridge",
|
|
123
|
-
version: "0.1.
|
|
123
|
+
version: "0.1.9",
|
|
124
124
|
description: "Bridge between Claude Code and Codex \u2014 bidirectional agent communication via MCP Channel + JSON-RPC",
|
|
125
125
|
type: "module",
|
|
126
126
|
packageManager: "bun@1.3.11",
|
|
@@ -1165,8 +1165,8 @@ function formatBuildInfo(build) {
|
|
|
1165
1165
|
var BUILD_INFO;
|
|
1166
1166
|
var init_build_info = __esm(() => {
|
|
1167
1167
|
BUILD_INFO = Object.freeze({
|
|
1168
|
-
version: defineString("0.1.
|
|
1169
|
-
commit: defineString("
|
|
1168
|
+
version: defineString("0.1.9", "0.0.0-source"),
|
|
1169
|
+
commit: defineString("10dfd58", "source"),
|
|
1170
1170
|
bundle: defineBundle("dist"),
|
|
1171
1171
|
contractVersion: defineNumber(1, CONTRACT_VERSION)
|
|
1172
1172
|
});
|
package/dist/daemon.js
CHANGED
|
@@ -17,8 +17,8 @@ function defineNumber(value, fallback) {
|
|
|
17
17
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
18
18
|
}
|
|
19
19
|
var BUILD_INFO = Object.freeze({
|
|
20
|
-
version: defineString("0.1.
|
|
21
|
-
commit: defineString("
|
|
20
|
+
version: defineString("0.1.9", "0.0.0-source"),
|
|
21
|
+
commit: defineString("10dfd58", "source"),
|
|
22
22
|
bundle: defineBundle("dist"),
|
|
23
23
|
contractVersion: defineNumber(1, CONTRACT_VERSION)
|
|
24
24
|
});
|
|
@@ -811,10 +811,19 @@ class CodexAdapter extends EventEmitter {
|
|
|
811
811
|
this.log("Cannot steer: no turn in progress (use injectMessage)");
|
|
812
812
|
return false;
|
|
813
813
|
}
|
|
814
|
-
|
|
814
|
+
const expectedTurnId = this.currentSteerableTurnId();
|
|
815
|
+
if (!expectedTurnId) {
|
|
816
|
+
this.log("Cannot steer: no addressable active turn id (turn/started carried no id)");
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
this.log(`Steering message into active Codex turn ${expectedTurnId} (${text.length} chars)`);
|
|
815
820
|
const requestId = this.nextInjectionId--;
|
|
816
821
|
this.trackBridgeRequestId(requestId, "steer");
|
|
817
|
-
const params = {
|
|
822
|
+
const params = {
|
|
823
|
+
threadId: this.threadId,
|
|
824
|
+
expectedTurnId,
|
|
825
|
+
input: [{ type: "text", text }]
|
|
826
|
+
};
|
|
818
827
|
try {
|
|
819
828
|
this.appServerWs.send(JSON.stringify({
|
|
820
829
|
method: "turn/steer",
|
|
@@ -1758,6 +1767,14 @@ class CodexAdapter extends EventEmitter {
|
|
|
1758
1767
|
this.log(`Thread detected: ${threadId} (${reason})`);
|
|
1759
1768
|
this.emit("ready", threadId);
|
|
1760
1769
|
}
|
|
1770
|
+
currentSteerableTurnId() {
|
|
1771
|
+
let newest = null;
|
|
1772
|
+
for (const id of this.activeTurnIds) {
|
|
1773
|
+
if (!id.startsWith("unknown:"))
|
|
1774
|
+
newest = id;
|
|
1775
|
+
}
|
|
1776
|
+
return newest;
|
|
1777
|
+
}
|
|
1761
1778
|
get turnPhase() {
|
|
1762
1779
|
if (this.activeTurnIds.size > 0) {
|
|
1763
1780
|
const allStalled = [...this.activeTurnIds].every((id) => this.currentlyStalledTurnIds.has(id));
|
|
@@ -1776,6 +1793,7 @@ class CodexAdapter extends EventEmitter {
|
|
|
1776
1793
|
markTurnStarted(turnId) {
|
|
1777
1794
|
const wasInProgress = this.turnInProgress;
|
|
1778
1795
|
const turnKey = typeof turnId === "string" && turnId.length > 0 ? turnId : `unknown:${Date.now()}`;
|
|
1796
|
+
this.activeTurnIds.delete(turnKey);
|
|
1779
1797
|
this.activeTurnIds.add(turnKey);
|
|
1780
1798
|
this.stalledTurnIds.delete(turnKey);
|
|
1781
1799
|
this.currentlyStalledTurnIds.delete(turnKey);
|
|
@@ -3994,7 +4012,8 @@ codex.on("turnPhaseChanged", ({ phase, previous }) => {
|
|
|
3994
4012
|
});
|
|
3995
4013
|
codex.on("steerFailed", (reason) => {
|
|
3996
4014
|
log(`Steer rejected by app-server: ${reason}`);
|
|
3997
|
-
|
|
4015
|
+
const advice = codex.turnInProgress ? "wait for it to finish (\u2705), then send normally" : "the turn has ended \u2014 resend as a normal reply";
|
|
4016
|
+
emitToClaude(systemMessage("system_steer_failed", `\u26A0\uFE0F Your steer message did NOT reach Codex (${reason}). The original turn continues unaffected \u2014 ${advice}.`));
|
|
3998
4017
|
});
|
|
3999
4018
|
codex.on("steerAccepted", () => {
|
|
4000
4019
|
log("Steer accepted by app-server");
|
|
@@ -4255,11 +4274,12 @@ function handleControlMessage(ws, raw) {
|
|
|
4255
4274
|
if (steered) {
|
|
4256
4275
|
clearAttentionWindow();
|
|
4257
4276
|
}
|
|
4277
|
+
const steerFailureAdvice = codex.turnInProgress ? "Steer failed: the running turn cannot be steered right now \u2014 wait for it to finish (\u2705), then send normally." : "Steer failed: the turn may have just ended or the connection dropped \u2014 retry as a normal reply.";
|
|
4258
4278
|
sendProtocolMessage(ws, {
|
|
4259
4279
|
type: "claude_to_codex_result",
|
|
4260
4280
|
requestId: message.requestId,
|
|
4261
4281
|
success: steered,
|
|
4262
|
-
error: steered ? undefined :
|
|
4282
|
+
error: steered ? undefined : steerFailureAdvice
|
|
4263
4283
|
});
|
|
4264
4284
|
return;
|
|
4265
4285
|
}
|
package/package.json
CHANGED
|
@@ -14227,8 +14227,8 @@ function defineNumber(value, fallback) {
|
|
|
14227
14227
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
14228
14228
|
}
|
|
14229
14229
|
var BUILD_INFO = Object.freeze({
|
|
14230
|
-
version: defineString("0.1.
|
|
14231
|
-
commit: defineString("
|
|
14230
|
+
version: defineString("0.1.9", "0.0.0-source"),
|
|
14231
|
+
commit: defineString("10dfd58", "source"),
|
|
14232
14232
|
bundle: defineBundle("plugin"),
|
|
14233
14233
|
contractVersion: defineNumber(1, CONTRACT_VERSION)
|
|
14234
14234
|
});
|
|
@@ -17,8 +17,8 @@ function defineNumber(value, fallback) {
|
|
|
17
17
|
return typeof value === "number" && Number.isFinite(value) ? value : fallback;
|
|
18
18
|
}
|
|
19
19
|
var BUILD_INFO = Object.freeze({
|
|
20
|
-
version: defineString("0.1.
|
|
21
|
-
commit: defineString("
|
|
20
|
+
version: defineString("0.1.9", "0.0.0-source"),
|
|
21
|
+
commit: defineString("10dfd58", "source"),
|
|
22
22
|
bundle: defineBundle("plugin"),
|
|
23
23
|
contractVersion: defineNumber(1, CONTRACT_VERSION)
|
|
24
24
|
});
|
|
@@ -811,10 +811,19 @@ class CodexAdapter extends EventEmitter {
|
|
|
811
811
|
this.log("Cannot steer: no turn in progress (use injectMessage)");
|
|
812
812
|
return false;
|
|
813
813
|
}
|
|
814
|
-
|
|
814
|
+
const expectedTurnId = this.currentSteerableTurnId();
|
|
815
|
+
if (!expectedTurnId) {
|
|
816
|
+
this.log("Cannot steer: no addressable active turn id (turn/started carried no id)");
|
|
817
|
+
return false;
|
|
818
|
+
}
|
|
819
|
+
this.log(`Steering message into active Codex turn ${expectedTurnId} (${text.length} chars)`);
|
|
815
820
|
const requestId = this.nextInjectionId--;
|
|
816
821
|
this.trackBridgeRequestId(requestId, "steer");
|
|
817
|
-
const params = {
|
|
822
|
+
const params = {
|
|
823
|
+
threadId: this.threadId,
|
|
824
|
+
expectedTurnId,
|
|
825
|
+
input: [{ type: "text", text }]
|
|
826
|
+
};
|
|
818
827
|
try {
|
|
819
828
|
this.appServerWs.send(JSON.stringify({
|
|
820
829
|
method: "turn/steer",
|
|
@@ -1758,6 +1767,14 @@ class CodexAdapter extends EventEmitter {
|
|
|
1758
1767
|
this.log(`Thread detected: ${threadId} (${reason})`);
|
|
1759
1768
|
this.emit("ready", threadId);
|
|
1760
1769
|
}
|
|
1770
|
+
currentSteerableTurnId() {
|
|
1771
|
+
let newest = null;
|
|
1772
|
+
for (const id of this.activeTurnIds) {
|
|
1773
|
+
if (!id.startsWith("unknown:"))
|
|
1774
|
+
newest = id;
|
|
1775
|
+
}
|
|
1776
|
+
return newest;
|
|
1777
|
+
}
|
|
1761
1778
|
get turnPhase() {
|
|
1762
1779
|
if (this.activeTurnIds.size > 0) {
|
|
1763
1780
|
const allStalled = [...this.activeTurnIds].every((id) => this.currentlyStalledTurnIds.has(id));
|
|
@@ -1776,6 +1793,7 @@ class CodexAdapter extends EventEmitter {
|
|
|
1776
1793
|
markTurnStarted(turnId) {
|
|
1777
1794
|
const wasInProgress = this.turnInProgress;
|
|
1778
1795
|
const turnKey = typeof turnId === "string" && turnId.length > 0 ? turnId : `unknown:${Date.now()}`;
|
|
1796
|
+
this.activeTurnIds.delete(turnKey);
|
|
1779
1797
|
this.activeTurnIds.add(turnKey);
|
|
1780
1798
|
this.stalledTurnIds.delete(turnKey);
|
|
1781
1799
|
this.currentlyStalledTurnIds.delete(turnKey);
|
|
@@ -3994,7 +4012,8 @@ codex.on("turnPhaseChanged", ({ phase, previous }) => {
|
|
|
3994
4012
|
});
|
|
3995
4013
|
codex.on("steerFailed", (reason) => {
|
|
3996
4014
|
log(`Steer rejected by app-server: ${reason}`);
|
|
3997
|
-
|
|
4015
|
+
const advice = codex.turnInProgress ? "wait for it to finish (\u2705), then send normally" : "the turn has ended \u2014 resend as a normal reply";
|
|
4016
|
+
emitToClaude(systemMessage("system_steer_failed", `\u26A0\uFE0F Your steer message did NOT reach Codex (${reason}). The original turn continues unaffected \u2014 ${advice}.`));
|
|
3998
4017
|
});
|
|
3999
4018
|
codex.on("steerAccepted", () => {
|
|
4000
4019
|
log("Steer accepted by app-server");
|
|
@@ -4255,11 +4274,12 @@ function handleControlMessage(ws, raw) {
|
|
|
4255
4274
|
if (steered) {
|
|
4256
4275
|
clearAttentionWindow();
|
|
4257
4276
|
}
|
|
4277
|
+
const steerFailureAdvice = codex.turnInProgress ? "Steer failed: the running turn cannot be steered right now \u2014 wait for it to finish (\u2705), then send normally." : "Steer failed: the turn may have just ended or the connection dropped \u2014 retry as a normal reply.";
|
|
4258
4278
|
sendProtocolMessage(ws, {
|
|
4259
4279
|
type: "claude_to_codex_result",
|
|
4260
4280
|
requestId: message.requestId,
|
|
4261
4281
|
success: steered,
|
|
4262
|
-
error: steered ? undefined :
|
|
4282
|
+
error: steered ? undefined : steerFailureAdvice
|
|
4263
4283
|
});
|
|
4264
4284
|
return;
|
|
4265
4285
|
}
|