nexrall-code 0.5.104 → 0.5.106
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/index.js +37 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -103400,7 +103400,9 @@ var require_loop = __commonJS({
|
|
|
103400
103400
|
};
|
|
103401
103401
|
}();
|
|
103402
103402
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
103403
|
-
exports2.VERIFY_CMD_RE = exports2.WRITE_TOOL_NAMES = exports2.ToolNotAllowedError = exports2.AGENT_MEMORY_TOOL_SCHEMA = exports2.AGENT_MEMORY_TOOL = exports2._stallLimits = exports2.bashNeedsRepoLock = void 0;
|
|
103403
|
+
exports2.VERIFY_CMD_RE = exports2.WRITE_TOOL_NAMES = exports2.ToolNotAllowedError = exports2.AGENT_MEMORY_TOOL_SCHEMA = exports2.AGENT_MEMORY_TOOL = exports2._stallLimits = exports2._emptyTurnRetry = exports2.bashNeedsRepoLock = void 0;
|
|
103404
|
+
exports2.emptyTurnBackoffMs = emptyTurnBackoffMs;
|
|
103405
|
+
exports2.shouldRetryEmptyTurn = shouldRetryEmptyTurn;
|
|
103404
103406
|
exports2.errorRoundSignature = errorRoundSignature;
|
|
103405
103407
|
exports2.executeAgentMemoryWrite = executeAgentMemoryWrite;
|
|
103406
103408
|
exports2.stopReasonNotice = stopReasonNotice;
|
|
@@ -103557,6 +103559,17 @@ var require_loop = __commonJS({
|
|
|
103557
103559
|
var HARD_ITERATIONS_CAP = Infinity;
|
|
103558
103560
|
var STALL_LIMIT = 8;
|
|
103559
103561
|
var REPEAT_STALL_LIMIT = 12;
|
|
103562
|
+
var EMPTY_TURN_RETRY_LIMIT = 3;
|
|
103563
|
+
var EMPTY_TURN_RETRY_BASE_MS = 1e3;
|
|
103564
|
+
function emptyTurnBackoffMs(attempt) {
|
|
103565
|
+
return EMPTY_TURN_RETRY_BASE_MS * Math.pow(2, Math.max(0, attempt));
|
|
103566
|
+
}
|
|
103567
|
+
function shouldRetryEmptyTurn(stopReason, attemptsSoFar) {
|
|
103568
|
+
if (stopReason === "max_tokens")
|
|
103569
|
+
return false;
|
|
103570
|
+
return attemptsSoFar < EMPTY_TURN_RETRY_LIMIT;
|
|
103571
|
+
}
|
|
103572
|
+
exports2._emptyTurnRetry = { EMPTY_TURN_RETRY_LIMIT, EMPTY_TURN_RETRY_BASE_MS };
|
|
103560
103573
|
function errorRoundSignature(errored) {
|
|
103561
103574
|
return errored.map(({ name, error }) => `${name}:${String(error).slice(0, 200)}`).sort().join("|");
|
|
103562
103575
|
}
|
|
@@ -103600,7 +103613,7 @@ var require_loop = __commonJS({
|
|
|
103600
103613
|
return null;
|
|
103601
103614
|
case "empty-response":
|
|
103602
103615
|
return `
|
|
103603
|
-
\u26A0\uFE0F The model returned an empty response, so nothing was done. This is usually a transient upstream hiccup
|
|
103616
|
+
\u26A0\uFE0F The model returned an empty response ${EMPTY_TURN_RETRY_LIMIT} times in a row, so nothing was done. This is usually a transient upstream hiccup that the agent retries by itself; it did not clear this time. Send "continue" to try again, or switch model with /model if it persists.
|
|
103604
103617
|
`;
|
|
103605
103618
|
case "output-limit":
|
|
103606
103619
|
return `
|
|
@@ -104300,8 +104313,7 @@ ${partial}` : "",
|
|
|
104300
104313
|
// modelRegistry.js's own TODO(unverified-by-400): DeepSeek accepts an
|
|
104301
104314
|
// oversized max_completion_tokens without rejecting it, so there was no 400
|
|
104302
104315
|
// to measure the ceiling from the way the OpenAI rows above were).
|
|
104303
|
-
"deepseek-
|
|
104304
|
-
"deepseek-v4-flash": 1048576,
|
|
104316
|
+
"deepseek-flash": 1048576,
|
|
104305
104317
|
// Qwen (DashScope), by real model id (documented max input, same caveat).
|
|
104306
104318
|
"qwen3.7-max": 991800,
|
|
104307
104319
|
// Z.ai (GLM), by real model id. contextWindow is documented (Z.ai/
|
|
@@ -104763,6 +104775,7 @@ ${options.nexrallMd}` : "") : options.nexrallMd;
|
|
|
104763
104775
|
let stalledRepeatError = null;
|
|
104764
104776
|
let budget = maxIterations;
|
|
104765
104777
|
let iteration = 0;
|
|
104778
|
+
let emptyTurnRetries = 0;
|
|
104766
104779
|
let filesMutatedSinceVerify = false;
|
|
104767
104780
|
let ranVerificationCmd = false;
|
|
104768
104781
|
let verificationNudgeSent = false;
|
|
@@ -104954,10 +104967,24 @@ ${options.nexrallMd}` : "") : options.nexrallMd;
|
|
|
104954
104967
|
messages.push({ role: "user", content: [{ type: "text", text }] });
|
|
104955
104968
|
continue;
|
|
104956
104969
|
}
|
|
104970
|
+
if (shouldRetryEmptyTurn(assistantMessage.stopReason, emptyTurnRetries)) {
|
|
104971
|
+
const waitMs = emptyTurnBackoffMs(emptyTurnRetries);
|
|
104972
|
+
emptyTurnRetries++;
|
|
104973
|
+
options.onRetry?.(emptyTurnRetries, EMPTY_TURN_RETRY_LIMIT, "The model returned an empty response \u2014 retrying automatically");
|
|
104974
|
+
await new Promise((r2) => setTimeout(r2, waitMs));
|
|
104975
|
+
if (options.abortSignal?.aborted) {
|
|
104976
|
+
stopReason = "aborted";
|
|
104977
|
+
break;
|
|
104978
|
+
}
|
|
104979
|
+
options.onRetryResolved?.();
|
|
104980
|
+
iteration--;
|
|
104981
|
+
continue;
|
|
104982
|
+
}
|
|
104957
104983
|
runSimpleHooks(hooks.PostMessageComplete, options.workDir);
|
|
104958
104984
|
stopReason = assistantMessage.stopReason === "max_tokens" ? "output-limit" : "empty-response";
|
|
104959
104985
|
break;
|
|
104960
104986
|
}
|
|
104987
|
+
emptyTurnRetries = 0;
|
|
104961
104988
|
const { stopReason: _stopReason, ...historyMessage } = assistantMessage;
|
|
104962
104989
|
messages.push(historyMessage);
|
|
104963
104990
|
const serverSideResultIds = new Set(assistantMessage.content.filter((b) => b.type === "tool_result").map((b) => b.tool_use_id).filter((id) => !!id));
|
|
@@ -153272,8 +153299,7 @@ var MODEL_LABELS = {
|
|
|
153272
153299
|
"gpt-5.4": "GPT-5.4",
|
|
153273
153300
|
"gpt-5.4-mini": "GPT-5.4 Mini",
|
|
153274
153301
|
"gpt-4.1": "GPT-4.1",
|
|
153275
|
-
"deepseek-
|
|
153276
|
-
"deepseek-v4-flash": "DeepSeek V4 Flash",
|
|
153302
|
+
"deepseek-flash": "DeepSeek Flash",
|
|
153277
153303
|
"qwen3.7-max": "Qwen3.7 Max",
|
|
153278
153304
|
"glm-5.3": "GLM 5.3"
|
|
153279
153305
|
};
|
|
@@ -153295,8 +153321,7 @@ var SELECTABLE_MODELS = [
|
|
|
153295
153321
|
"gpt-5.4",
|
|
153296
153322
|
"gpt-5.4-mini",
|
|
153297
153323
|
"gpt-4.1",
|
|
153298
|
-
"deepseek-
|
|
153299
|
-
"deepseek-v4-flash",
|
|
153324
|
+
"deepseek-flash",
|
|
153300
153325
|
"qwen3.7-max",
|
|
153301
153326
|
"glm-5.3"
|
|
153302
153327
|
];
|
|
@@ -153314,8 +153339,7 @@ var MODEL_COST_MULTIPLIER = {
|
|
|
153314
153339
|
"gpt-5.4": 2,
|
|
153315
153340
|
"gpt-5.4-mini": 0.5,
|
|
153316
153341
|
"gpt-4.1": 1,
|
|
153317
|
-
"deepseek-
|
|
153318
|
-
"deepseek-v4-flash": 0.05,
|
|
153342
|
+
"deepseek-flash": 0.1,
|
|
153319
153343
|
"qwen3.7-max": 1,
|
|
153320
153344
|
// $1.40/$4.40 per 1M in/out (docs.z.ai, 2026-08-30) vs gpt-4.1's $2.00/$8.00
|
|
153321
153345
|
// (migration 113) — roughly 0.6x on a blended 75/25 in/out turn. Rounded to
|
|
@@ -153327,7 +153351,7 @@ function modelWithCostHint(id) {
|
|
|
153327
153351
|
const mult = (0, import_code_core4.liveCostMultiplierFor)(id, MODEL_COST_MULTIPLIER[id]);
|
|
153328
153352
|
return mult === void 0 ? id : `${id} (${mult}x)`;
|
|
153329
153353
|
}
|
|
153330
|
-
var NO_VISION_MODELS = /* @__PURE__ */ new Set(["
|
|
153354
|
+
var NO_VISION_MODELS = /* @__PURE__ */ new Set(["qwen3.7-max", "glm-5.3"]);
|
|
153331
153355
|
var NO_PDF_MODELS = /* @__PURE__ */ new Set([
|
|
153332
153356
|
"gpt-5.6-sol",
|
|
153333
153357
|
"gpt-5.6-terra",
|
|
@@ -153336,6 +153360,7 @@ var NO_PDF_MODELS = /* @__PURE__ */ new Set([
|
|
|
153336
153360
|
"gpt-5.4-mini",
|
|
153337
153361
|
"gpt-4.1",
|
|
153338
153362
|
"gpt-4o-mini",
|
|
153363
|
+
"deepseek-flash",
|
|
153339
153364
|
...NO_VISION_MODELS
|
|
153340
153365
|
]);
|
|
153341
153366
|
function needsVisionSidecar(model) {
|
|
@@ -153366,8 +153391,7 @@ var MODEL_EFFORT_STYLE = {
|
|
|
153366
153391
|
"gpt-5.4-mini": "openai_gated",
|
|
153367
153392
|
"gpt-4.1": "none",
|
|
153368
153393
|
"gpt-4o-mini": "none",
|
|
153369
|
-
"deepseek-
|
|
153370
|
-
"deepseek-v4-flash": "deepseek",
|
|
153394
|
+
"deepseek-flash": "deepseek",
|
|
153371
153395
|
"qwen3.7-max": "qwen",
|
|
153372
153396
|
"glm-5.3": "glm"
|
|
153373
153397
|
// Everything else (all claude-* ids) falls through to 'anthropic' below.
|