claude-codex-wechat 0.1.50 → 0.1.52
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/dist/server/cli.js
CHANGED
|
@@ -3251,6 +3251,8 @@ var ClaudeStreamingRunner = class {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
session.turnCount += 1;
|
|
3253
3253
|
yield { type: "message_done" };
|
|
3254
|
+
const resultError = extractResultError(record);
|
|
3255
|
+
if (resultError) yield { type: "error", error: resultError };
|
|
3254
3256
|
if (session.pendingFollowUps > 0) {
|
|
3255
3257
|
session.pendingFollowUps -= 1;
|
|
3256
3258
|
continue;
|
|
@@ -3329,6 +3331,17 @@ function userEnvelope(text) {
|
|
|
3329
3331
|
return `${JSON.stringify({ type: "user", message: { role: "user", content: text }, parent_tool_use_id: null })}
|
|
3330
3332
|
`;
|
|
3331
3333
|
}
|
|
3334
|
+
function extractResultError(record) {
|
|
3335
|
+
if (record.is_error !== true) return void 0;
|
|
3336
|
+
const errors = record.errors;
|
|
3337
|
+
if (Array.isArray(errors)) {
|
|
3338
|
+
const joined = errors.filter((item) => typeof item === "string" && item).join("; ");
|
|
3339
|
+
if (joined) return joined;
|
|
3340
|
+
}
|
|
3341
|
+
if (typeof record.result === "string" && record.result) return record.result;
|
|
3342
|
+
if (typeof record.subtype === "string" && record.subtype) return record.subtype;
|
|
3343
|
+
return JSON.stringify(record);
|
|
3344
|
+
}
|
|
3332
3345
|
function extractError(record) {
|
|
3333
3346
|
if (typeof record.message === "string") return record.message;
|
|
3334
3347
|
if (record.error && typeof record.error === "object") {
|
|
@@ -3665,6 +3678,23 @@ function readTurnId(value) {
|
|
|
3665
3678
|
if (typeof record.turnId === "string" && record.turnId) return record.turnId;
|
|
3666
3679
|
return void 0;
|
|
3667
3680
|
}
|
|
3681
|
+
function readTurnError(value) {
|
|
3682
|
+
if (!value || typeof value !== "object") return void 0;
|
|
3683
|
+
const record = value;
|
|
3684
|
+
const turn = record.turn && typeof record.turn === "object" ? record.turn : void 0;
|
|
3685
|
+
const raw = turn?.error ?? record.error;
|
|
3686
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
3687
|
+
if (typeof raw === "string") return raw || void 0;
|
|
3688
|
+
if (typeof raw === "object") {
|
|
3689
|
+
const message = raw.message;
|
|
3690
|
+
if (typeof message === "string" && message) return message;
|
|
3691
|
+
}
|
|
3692
|
+
try {
|
|
3693
|
+
return JSON.stringify(raw);
|
|
3694
|
+
} catch {
|
|
3695
|
+
return String(raw);
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3668
3698
|
var CodexInteractiveRunner = class {
|
|
3669
3699
|
sessions = /* @__PURE__ */ new Map();
|
|
3670
3700
|
command;
|
|
@@ -3846,8 +3876,10 @@ var CodexInteractiveRunner = class {
|
|
|
3846
3876
|
const turnId = readTurnId(params);
|
|
3847
3877
|
if (turnId) session.activeTurnId = turnId;
|
|
3848
3878
|
});
|
|
3849
|
-
client.onNotification("turn/completed", () => {
|
|
3879
|
+
client.onNotification("turn/completed", (params) => {
|
|
3850
3880
|
this.flushActiveMessage(session);
|
|
3881
|
+
const turnError = readTurnError(params);
|
|
3882
|
+
if (turnError) this.enqueueEvent(session, { type: "error", error: turnError });
|
|
3851
3883
|
session.turnClosed = true;
|
|
3852
3884
|
session.eventResolver?.();
|
|
3853
3885
|
session.eventResolver = void 0;
|