@remnic/bench 9.6.11 → 9.6.12
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 +26 -4
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7148,7 +7148,9 @@ var ClaudeCliProvider = class {
|
|
|
7148
7148
|
try {
|
|
7149
7149
|
const request = this.buildRunRequest(prompt, opts, tempDir);
|
|
7150
7150
|
const result = await this.runClaudeCli(request);
|
|
7151
|
-
|
|
7151
|
+
const payload = parseClaudeCliJsonResult(result.stdout);
|
|
7152
|
+
const salvageableDespiteExit = !result.stderr.includes("Claude CLI timed out") && !result.stderr.includes("Claude CLI aborted by benchmark timeout") && result.signal === null && !isClaudeCliErrorFlagSet(payload.is_error) && typeof payload.result === "string" && payload.result.trim().length > 0;
|
|
7153
|
+
if (result.status !== 0 && !salvageableDespiteExit) {
|
|
7152
7154
|
if (isClaudeUsageLimitSignal(`${result.stderr}
|
|
7153
7155
|
${result.stdout}`)) {
|
|
7154
7156
|
await sleepBeforeUsageLimitRetry({
|
|
@@ -7162,8 +7164,9 @@ ${result.stdout}`)) {
|
|
|
7162
7164
|
continue;
|
|
7163
7165
|
}
|
|
7164
7166
|
const exitLabel = result.signal ? `signal ${result.signal}` : `exit ${result.status ?? "unknown"}`;
|
|
7167
|
+
const stdoutHead = result.stdout.trim().slice(0, 300);
|
|
7165
7168
|
const error = new Error(
|
|
7166
|
-
`Claude CLI completion failed (${exitLabel}): ${summarizeProcessOutput(result.stderr, result.stdout)}`
|
|
7169
|
+
`Claude CLI completion failed (${exitLabel}): ${stdoutHead.length > 0 ? `head=${JSON.stringify(stdoutHead)} tail=` : ""}${summarizeProcessOutput(result.stderr, result.stdout)}`
|
|
7167
7170
|
);
|
|
7168
7171
|
if (transientAttempt < maxAttempts && isRetryableClaudeCliResult(result)) {
|
|
7169
7172
|
await sleepBeforeClaudeCliRetry({
|
|
@@ -7178,7 +7181,11 @@ ${result.stdout}`)) {
|
|
|
7178
7181
|
}
|
|
7179
7182
|
throw error;
|
|
7180
7183
|
}
|
|
7181
|
-
|
|
7184
|
+
if (result.stderr.includes("Claude CLI timed out") || result.stderr.includes("Claude CLI aborted by benchmark timeout")) {
|
|
7185
|
+
throw new Error(
|
|
7186
|
+
`Claude CLI completion was killed (timeout/abort): ${summarizeProcessOutput(result.stderr, result.stdout)}`
|
|
7187
|
+
);
|
|
7188
|
+
}
|
|
7182
7189
|
if (isClaudeCliErrorFlagSet(payload.is_error)) {
|
|
7183
7190
|
if (isClaudeUsageLimitSignal(
|
|
7184
7191
|
`${result.stderr}
|
|
@@ -7315,6 +7322,7 @@ function buildClaudeCompletionPrompt(userPrompt) {
|
|
|
7315
7322
|
].join("\n");
|
|
7316
7323
|
}
|
|
7317
7324
|
var CLAUDE_CLI_MAX_OUTPUT_TOKENS_ENV = "CLAUDE_CODE_MAX_OUTPUT_TOKENS";
|
|
7325
|
+
var CLAUDE_CLI_OUTPUT_TOKENS_ENV_FLOOR = 4096;
|
|
7318
7326
|
function buildIsolatedClaudeEnv(config, maxTokens) {
|
|
7319
7327
|
const env = {};
|
|
7320
7328
|
for (const [key, value] of Object.entries(process.env)) {
|
|
@@ -7329,7 +7337,9 @@ function buildIsolatedClaudeEnv(config, maxTokens) {
|
|
|
7329
7337
|
env.ANTHROPIC_BASE_URL = config.baseUrl.trim();
|
|
7330
7338
|
}
|
|
7331
7339
|
if (typeof maxTokens === "number" && Number.isFinite(maxTokens) && maxTokens > 0) {
|
|
7332
|
-
env[CLAUDE_CLI_MAX_OUTPUT_TOKENS_ENV] = String(
|
|
7340
|
+
env[CLAUDE_CLI_MAX_OUTPUT_TOKENS_ENV] = String(
|
|
7341
|
+
Math.max(Math.floor(maxTokens), CLAUDE_CLI_OUTPUT_TOKENS_ENV_FLOOR)
|
|
7342
|
+
);
|
|
7333
7343
|
}
|
|
7334
7344
|
return env;
|
|
7335
7345
|
}
|
|
@@ -7369,6 +7379,18 @@ function parseClaudeCliJsonResult(stdout) {
|
|
|
7369
7379
|
}
|
|
7370
7380
|
return parsed;
|
|
7371
7381
|
} catch {
|
|
7382
|
+
const lines = trimmed.split(/\r?\n/);
|
|
7383
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
7384
|
+
const line = lines[index].trim();
|
|
7385
|
+
if (!line.startsWith("{") || !line.endsWith("}")) continue;
|
|
7386
|
+
try {
|
|
7387
|
+
const parsed = JSON.parse(line);
|
|
7388
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
7389
|
+
return parsed;
|
|
7390
|
+
}
|
|
7391
|
+
} catch {
|
|
7392
|
+
}
|
|
7393
|
+
}
|
|
7372
7394
|
return { is_error: true, error: trimmed.slice(-1e3) };
|
|
7373
7395
|
}
|
|
7374
7396
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remnic/bench",
|
|
3
|
-
"version": "9.6.
|
|
3
|
+
"version": "9.6.12",
|
|
4
4
|
"description": "Retrieval latency ladder benchmarks + CI regression gates for @remnic/core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"hyparquet": "^1.25.7",
|
|
38
38
|
"yaml": "^2.4.2",
|
|
39
|
-
"@remnic/coding-graph": "^9.6.
|
|
40
|
-
"@remnic/core": "^9.6.
|
|
39
|
+
"@remnic/coding-graph": "^9.6.12",
|
|
40
|
+
"@remnic/core": "^9.6.12"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"tsup": "^8.5.1",
|