@plune-ai/cli 0.39.6 → 0.39.8
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/README.md +63 -0
- package/dist/cli.cjs +703 -378
- package/dist/execute-CR3Ixbxj.d.cts +944 -0
- package/dist/execute-CR3Ixbxj.d.ts +944 -0
- package/dist/index.cjs +331 -159
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +331 -159
- package/dist/mcp-http.cjs +1293 -0
- package/dist/mcp-http.d.cts +25 -0
- package/dist/mcp-http.d.ts +25 -0
- package/dist/mcp-http.js +1268 -0
- package/dist/mcp-tools.cjs +173 -9
- package/dist/mcp-tools.d.cts +3 -938
- package/dist/mcp-tools.d.ts +3 -938
- package/dist/mcp-tools.js +173 -9
- package/dist/reporter-core.cjs +51 -4
- package/dist/reporter-core.d.cts +10 -0
- package/dist/reporter-core.d.ts +10 -0
- package/dist/reporter-core.js +51 -4
- package/package.json +7 -1
- package/skills/plune/SKILL.md +23 -0
package/dist/cli.cjs
CHANGED
|
@@ -395,192 +395,25 @@ var init_errors = __esm({
|
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
|
|
398
|
-
// src/config/env-overrides.ts
|
|
399
|
-
function applyEnvOverrides(config, env) {
|
|
400
|
-
const result2 = structuredClone(config);
|
|
401
|
-
const all = result2.providers ?? [result2.provider];
|
|
402
|
-
if (result2.providers !== void 0) {
|
|
403
|
-
for (const name of ["PLUNE_PROVIDER", "PLUNE_MODEL"])
|
|
404
|
-
if (env[name] !== void 0)
|
|
405
|
-
throw new ConfigValidationError("Config validation failed", [
|
|
406
|
-
`${name} sets one model, but the config lists ${result2.providers.length}: remove it or list a single model`
|
|
407
|
-
]);
|
|
408
|
-
}
|
|
409
|
-
if (env["PLUNE_PROVIDER"] !== void 0) {
|
|
410
|
-
result2.provider.type = env["PLUNE_PROVIDER"];
|
|
411
|
-
}
|
|
412
|
-
if (env["PLUNE_MODEL"] !== void 0) {
|
|
413
|
-
result2.provider.model = env["PLUNE_MODEL"];
|
|
414
|
-
}
|
|
415
|
-
if (env["PLUNE_TIMEOUT"] !== void 0) {
|
|
416
|
-
const n = Number(env["PLUNE_TIMEOUT"]);
|
|
417
|
-
if (!isNaN(n)) for (const p of all) p.timeout = n;
|
|
418
|
-
}
|
|
419
|
-
if (env["PLUNE_MAX_RETRIES"] !== void 0) {
|
|
420
|
-
const n = Number(env["PLUNE_MAX_RETRIES"]);
|
|
421
|
-
if (!isNaN(n)) for (const p of all) p.max_retries = n;
|
|
422
|
-
}
|
|
423
|
-
return result2;
|
|
424
|
-
}
|
|
425
|
-
var init_env_overrides = __esm({
|
|
426
|
-
"src/config/env-overrides.ts"() {
|
|
427
|
-
"use strict";
|
|
428
|
-
init_cjs_shims();
|
|
429
|
-
init_errors();
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
|
|
433
|
-
// src/config/discover.ts
|
|
434
|
-
function discoverConfigPath(cwd, override) {
|
|
435
|
-
if (override !== void 0) {
|
|
436
|
-
if (fs.existsSync(override)) {
|
|
437
|
-
return override;
|
|
438
|
-
}
|
|
439
|
-
throw new ConfigNotFoundError(`Config file not found: ${override}`);
|
|
440
|
-
}
|
|
441
|
-
let dir = cwd;
|
|
442
|
-
let steps = 0;
|
|
443
|
-
while (steps < MAX_STEPS) {
|
|
444
|
-
const candidate = path2.join(dir, FILENAME);
|
|
445
|
-
if (fs.existsSync(candidate)) {
|
|
446
|
-
return candidate;
|
|
447
|
-
}
|
|
448
|
-
const parent = path2.dirname(dir);
|
|
449
|
-
if (parent === dir) {
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
dir = parent;
|
|
453
|
-
steps++;
|
|
454
|
-
}
|
|
455
|
-
throw new ConfigNotFoundError(
|
|
456
|
-
`No ${FILENAME} found. Run "plune init" to create one.`
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
var fs, path2, FILENAME, MAX_STEPS;
|
|
460
|
-
var init_discover = __esm({
|
|
461
|
-
"src/config/discover.ts"() {
|
|
462
|
-
"use strict";
|
|
463
|
-
init_cjs_shims();
|
|
464
|
-
fs = __toESM(require("fs"), 1);
|
|
465
|
-
path2 = __toESM(require("path"), 1);
|
|
466
|
-
init_errors();
|
|
467
|
-
FILENAME = "plune.yaml";
|
|
468
|
-
MAX_STEPS = 50;
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
// src/config/mcp.ts
|
|
473
|
-
function mcpLimits(config, evalConfig) {
|
|
474
|
-
return { ...MCP_LIMIT_DEFAULTS, ...config.mcp?.limits, ...evalConfig.mcp?.limits };
|
|
475
|
-
}
|
|
476
|
-
function expandVars(value2, env) {
|
|
477
|
-
const literal = (text6) => {
|
|
478
|
-
if (text6.includes("${")) throw new Error('has a "${" that is not ${NAME} or ${NAME:-default}');
|
|
479
|
-
return text6;
|
|
480
|
-
};
|
|
481
|
-
let out = "";
|
|
482
|
-
let last = 0;
|
|
483
|
-
for (const match of value2.matchAll(REFERENCE)) {
|
|
484
|
-
const [whole, name, fallback] = match;
|
|
485
|
-
out += literal(value2.slice(last, match.index));
|
|
486
|
-
const set = env[name];
|
|
487
|
-
if (set !== void 0 && set !== "") out += set;
|
|
488
|
-
else if (fallback !== void 0) out += fallback;
|
|
489
|
-
else
|
|
490
|
-
throw new Error(
|
|
491
|
-
`\${${name}} is not set or is empty, and has no default (\${${name}:-default})`
|
|
492
|
-
);
|
|
493
|
-
last = match.index + whole.length;
|
|
494
|
-
}
|
|
495
|
-
return out + literal(value2.slice(last));
|
|
496
|
-
}
|
|
497
|
-
function serverValues(server2) {
|
|
498
|
-
const out = [];
|
|
499
|
-
if (server2.command !== void 0) out.push(["command", server2.command]);
|
|
500
|
-
(server2.args ?? []).forEach((arg, i) => out.push([`args.${i}`, arg]));
|
|
501
|
-
for (const [key, value2] of Object.entries(server2.env ?? {})) out.push([`env.${key}`, value2]);
|
|
502
|
-
if (server2.cwd !== void 0) out.push(["cwd", server2.cwd]);
|
|
503
|
-
if (server2.url !== void 0) out.push(["url", server2.url]);
|
|
504
|
-
for (const [key, value2] of Object.entries(server2.headers ?? {}))
|
|
505
|
-
out.push([`headers.${key}`, value2]);
|
|
506
|
-
return out;
|
|
507
|
-
}
|
|
508
|
-
function mcpVariableIssues(config, env) {
|
|
509
|
-
const issues = [];
|
|
510
|
-
for (const [name, server2] of Object.entries(config.mcp?.servers ?? {})) {
|
|
511
|
-
for (const [field, value2] of serverValues(server2)) {
|
|
512
|
-
try {
|
|
513
|
-
expandVars(value2, env);
|
|
514
|
-
} catch (err) {
|
|
515
|
-
issues.push(`mcp.servers.${name}.${field}: ${err.message}`);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
return issues;
|
|
520
|
-
}
|
|
521
|
-
function resolveMcpServer(server2, env = process.env, baseDir = process.cwd()) {
|
|
522
|
-
const fill = (value2) => expandVars(value2, env);
|
|
523
|
-
const fillAll = (entries2 = {}) => Object.fromEntries(Object.entries(entries2).map(([key, value2]) => [key, fill(value2)]));
|
|
524
|
-
if (server2.url !== void 0)
|
|
525
|
-
return { kind: "http", url: fill(server2.url), headers: fillAll(server2.headers) };
|
|
526
|
-
return {
|
|
527
|
-
kind: "stdio",
|
|
528
|
-
command: fill(server2.command),
|
|
529
|
-
args: (server2.args ?? []).map(fill),
|
|
530
|
-
env: fillAll(server2.env),
|
|
531
|
-
...server2.cwd !== void 0 ? { cwd: path3.resolve(baseDir, fill(server2.cwd)) } : {}
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
function mcpSecretWarnings(config) {
|
|
535
|
-
const warnings = [];
|
|
536
|
-
for (const [name, server2] of Object.entries(config.mcp?.servers ?? {})) {
|
|
537
|
-
for (const [field, entries2] of [
|
|
538
|
-
["env", server2.env],
|
|
539
|
-
["headers", server2.headers]
|
|
540
|
-
]) {
|
|
541
|
-
for (const [key, value2] of Object.entries(entries2 ?? {})) {
|
|
542
|
-
if (SECRET_KEY.test(key) && !value2.includes("${")) {
|
|
543
|
-
warnings.push(
|
|
544
|
-
`mcp.servers.${name}.${field}.${key} looks like a secret written into plune.yaml; use \${VAR} so it comes from the environment.`
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return warnings;
|
|
551
|
-
}
|
|
552
|
-
var path3, MCP_LIMIT_DEFAULTS, REFERENCE, SECRET_KEY;
|
|
553
|
-
var init_mcp = __esm({
|
|
554
|
-
"src/config/mcp.ts"() {
|
|
555
|
-
"use strict";
|
|
556
|
-
init_cjs_shims();
|
|
557
|
-
path3 = __toESM(require("path"), 1);
|
|
558
|
-
MCP_LIMIT_DEFAULTS = {
|
|
559
|
-
max_steps: 10,
|
|
560
|
-
max_tool_calls: 20,
|
|
561
|
-
max_total_tokens: 1e5,
|
|
562
|
-
timeout_ms: 12e4,
|
|
563
|
-
tool_timeout_ms: 3e4
|
|
564
|
-
};
|
|
565
|
-
REFERENCE = /\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g;
|
|
566
|
-
SECRET_KEY = /authorization|token|key|secret|password/i;
|
|
567
|
-
}
|
|
568
|
-
});
|
|
569
|
-
|
|
570
398
|
// src/config/schema.ts
|
|
571
|
-
var import_zod, providerConfigSchema, providerListSchema, providerField, modelPriceSchema, pricingSchema, datasetRowSchema, datasetRefSchema, exactMatchAssertionSchema, containsAssertionSchema, containsAnyAssertionSchema, containsAllAssertionSchema, jsonSchemaAssertionSchema, llmJudgeAssertionSchema, semanticSimilarityAssertionSchema, faithfulnessAssertionSchema, answerRelevanceAssertionSchema, contextPrecisionAssertionSchema, toolName, count, toolCallAssertionSchemas, TOOL_CALL_TYPES, assertionConfigSchema, MAX_RUNS, SHARE_MESSAGE, evalRepeatsShape,
|
|
399
|
+
var import_zod, providerTimeoutSchema, providerConfigSchema, providerListSchema, providerField, modelPriceSchema, pricingSchema, datasetRowSchema, datasetRefSchema, exactMatchAssertionSchema, containsAssertionSchema, containsAnyAssertionSchema, containsAllAssertionSchema, jsonSchemaAssertionSchema, llmJudgeAssertionSchema, semanticSimilarityAssertionSchema, faithfulnessAssertionSchema, answerRelevanceAssertionSchema, contextPrecisionAssertionSchema, toolName, count, toolCallAssertionSchemas, TOOL_CALL_TYPES, assertionConfigSchema, MAX_RUNS, SHARE_MESSAGE, evalRepeatsShape, limit, mcpLimitsSchema, mcpServerSchema, mcpServersSchema, mcpRootSchema, evalMcpSchema, evalConfigSchema, pluneConfigSchema;
|
|
572
400
|
var init_schema = __esm({
|
|
573
401
|
"src/config/schema.ts"() {
|
|
574
402
|
"use strict";
|
|
575
403
|
init_cjs_shims();
|
|
576
404
|
import_zod = require("zod");
|
|
405
|
+
init_duration();
|
|
406
|
+
providerTimeoutSchema = import_zod.z.number().int().positive().max(
|
|
407
|
+
MAX_TIMER_MS,
|
|
408
|
+
`must be at most ${MAX_TIMER_MS} ms (about 24.8 days), the longest a timer can wait: a longer timeout ends every model call at once`
|
|
409
|
+
);
|
|
577
410
|
providerConfigSchema = import_zod.z.object({
|
|
578
411
|
type: import_zod.z.enum(["anthropic", "openai", "openrouter"]),
|
|
579
412
|
model: import_zod.z.string().min(1),
|
|
580
413
|
temperature: import_zod.z.number().min(0).max(2).optional(),
|
|
581
414
|
max_tokens: import_zod.z.number().int().positive().optional(),
|
|
582
415
|
concurrency: import_zod.z.number().int().positive().optional(),
|
|
583
|
-
timeout:
|
|
416
|
+
timeout: providerTimeoutSchema.optional(),
|
|
584
417
|
max_retries: import_zod.z.number().int().min(0).optional(),
|
|
585
418
|
// The values the OpenAI SDK's Chat Completions `reasoning_effort` accepts; only `openai` sends it.
|
|
586
419
|
reasoning_effort: import_zod.z.enum(["none", "minimal", "low", "medium", "high", "xhigh"]).optional()
|
|
@@ -726,14 +559,13 @@ var init_schema = __esm({
|
|
|
726
559
|
runs: import_zod.z.number().int().min(1).max(MAX_RUNS).optional(),
|
|
727
560
|
pass_threshold: import_zod.z.number().gt(0, SHARE_MESSAGE).max(1, SHARE_MESSAGE).optional()
|
|
728
561
|
};
|
|
729
|
-
MAX_TIMER_MS2 = 2147483647;
|
|
730
562
|
limit = import_zod.z.number().int().positive();
|
|
731
563
|
mcpLimitsSchema = import_zod.z.object({
|
|
732
564
|
max_steps: limit.optional(),
|
|
733
565
|
max_tool_calls: limit.optional(),
|
|
734
566
|
max_total_tokens: limit.optional(),
|
|
735
|
-
timeout_ms: limit.max(
|
|
736
|
-
tool_timeout_ms: limit.max(
|
|
567
|
+
timeout_ms: limit.max(MAX_TIMER_MS).optional(),
|
|
568
|
+
tool_timeout_ms: limit.max(MAX_TIMER_MS).optional()
|
|
737
569
|
}).strict();
|
|
738
570
|
mcpServerSchema = import_zod.z.object({
|
|
739
571
|
command: import_zod.z.string().min(1).optional(),
|
|
@@ -848,6 +680,187 @@ var init_schema = __esm({
|
|
|
848
680
|
}
|
|
849
681
|
});
|
|
850
682
|
|
|
683
|
+
// src/config/env-overrides.ts
|
|
684
|
+
function applyEnvOverrides(config, env) {
|
|
685
|
+
const result2 = structuredClone(config);
|
|
686
|
+
const all = result2.providers ?? [result2.provider];
|
|
687
|
+
if (result2.providers !== void 0) {
|
|
688
|
+
for (const name of ["PLUNE_PROVIDER", "PLUNE_MODEL"])
|
|
689
|
+
if (env[name] !== void 0)
|
|
690
|
+
throw new ConfigValidationError("Config validation failed", [
|
|
691
|
+
`${name} sets one model, but the config lists ${result2.providers.length}: remove it or list a single model`
|
|
692
|
+
]);
|
|
693
|
+
}
|
|
694
|
+
if (env["PLUNE_PROVIDER"] !== void 0) {
|
|
695
|
+
result2.provider.type = env["PLUNE_PROVIDER"];
|
|
696
|
+
}
|
|
697
|
+
if (env["PLUNE_MODEL"] !== void 0) {
|
|
698
|
+
result2.provider.model = env["PLUNE_MODEL"];
|
|
699
|
+
}
|
|
700
|
+
if (env["PLUNE_TIMEOUT"] !== void 0) {
|
|
701
|
+
const n = Number(env["PLUNE_TIMEOUT"]);
|
|
702
|
+
if (Number.isFinite(n)) {
|
|
703
|
+
const r = providerTimeoutSchema.safeParse(n);
|
|
704
|
+
if (!r.success)
|
|
705
|
+
throw new ConfigValidationError(
|
|
706
|
+
"Config validation failed",
|
|
707
|
+
r.error.issues.map((issue) => `PLUNE_TIMEOUT=${env["PLUNE_TIMEOUT"]}: ${issue.message}`)
|
|
708
|
+
);
|
|
709
|
+
for (const p of all) p.timeout = n;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (env["PLUNE_MAX_RETRIES"] !== void 0) {
|
|
713
|
+
const n = Number(env["PLUNE_MAX_RETRIES"]);
|
|
714
|
+
if (!isNaN(n)) for (const p of all) p.max_retries = Number.isFinite(n) ? n : 0;
|
|
715
|
+
}
|
|
716
|
+
return result2;
|
|
717
|
+
}
|
|
718
|
+
var init_env_overrides = __esm({
|
|
719
|
+
"src/config/env-overrides.ts"() {
|
|
720
|
+
"use strict";
|
|
721
|
+
init_cjs_shims();
|
|
722
|
+
init_errors();
|
|
723
|
+
init_schema();
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// src/config/discover.ts
|
|
728
|
+
function discoverConfigPath(cwd, override) {
|
|
729
|
+
if (override !== void 0) {
|
|
730
|
+
if (fs.existsSync(override)) {
|
|
731
|
+
return override;
|
|
732
|
+
}
|
|
733
|
+
throw new ConfigNotFoundError(`Config file not found: ${override}`);
|
|
734
|
+
}
|
|
735
|
+
let dir = cwd;
|
|
736
|
+
let steps = 0;
|
|
737
|
+
while (steps < MAX_STEPS) {
|
|
738
|
+
const candidate = path2.join(dir, FILENAME);
|
|
739
|
+
if (fs.existsSync(candidate)) {
|
|
740
|
+
return candidate;
|
|
741
|
+
}
|
|
742
|
+
const parent = path2.dirname(dir);
|
|
743
|
+
if (parent === dir) {
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
dir = parent;
|
|
747
|
+
steps++;
|
|
748
|
+
}
|
|
749
|
+
throw new ConfigNotFoundError(
|
|
750
|
+
`No ${FILENAME} found. Run "plune init" to create one.`
|
|
751
|
+
);
|
|
752
|
+
}
|
|
753
|
+
var fs, path2, FILENAME, MAX_STEPS;
|
|
754
|
+
var init_discover = __esm({
|
|
755
|
+
"src/config/discover.ts"() {
|
|
756
|
+
"use strict";
|
|
757
|
+
init_cjs_shims();
|
|
758
|
+
fs = __toESM(require("fs"), 1);
|
|
759
|
+
path2 = __toESM(require("path"), 1);
|
|
760
|
+
init_errors();
|
|
761
|
+
FILENAME = "plune.yaml";
|
|
762
|
+
MAX_STEPS = 50;
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
// src/config/mcp.ts
|
|
767
|
+
function mcpLimits(config, evalConfig) {
|
|
768
|
+
return { ...MCP_LIMIT_DEFAULTS, ...config.mcp?.limits, ...evalConfig.mcp?.limits };
|
|
769
|
+
}
|
|
770
|
+
function expandVars(value2, env) {
|
|
771
|
+
const literal = (text6) => {
|
|
772
|
+
if (text6.includes("${")) throw new Error('has a "${" that is not ${NAME} or ${NAME:-default}');
|
|
773
|
+
return text6;
|
|
774
|
+
};
|
|
775
|
+
let out = "";
|
|
776
|
+
let last = 0;
|
|
777
|
+
for (const match of value2.matchAll(REFERENCE)) {
|
|
778
|
+
const [whole, name, fallback] = match;
|
|
779
|
+
out += literal(value2.slice(last, match.index));
|
|
780
|
+
const set = env[name];
|
|
781
|
+
if (set !== void 0 && set !== "") out += set;
|
|
782
|
+
else if (fallback !== void 0) out += fallback;
|
|
783
|
+
else
|
|
784
|
+
throw new Error(
|
|
785
|
+
`\${${name}} is not set or is empty, and has no default (\${${name}:-default})`
|
|
786
|
+
);
|
|
787
|
+
last = match.index + whole.length;
|
|
788
|
+
}
|
|
789
|
+
return out + literal(value2.slice(last));
|
|
790
|
+
}
|
|
791
|
+
function serverValues(server2) {
|
|
792
|
+
const out = [];
|
|
793
|
+
if (server2.command !== void 0) out.push(["command", server2.command]);
|
|
794
|
+
(server2.args ?? []).forEach((arg, i) => out.push([`args.${i}`, arg]));
|
|
795
|
+
for (const [key, value2] of Object.entries(server2.env ?? {})) out.push([`env.${key}`, value2]);
|
|
796
|
+
if (server2.cwd !== void 0) out.push(["cwd", server2.cwd]);
|
|
797
|
+
if (server2.url !== void 0) out.push(["url", server2.url]);
|
|
798
|
+
for (const [key, value2] of Object.entries(server2.headers ?? {}))
|
|
799
|
+
out.push([`headers.${key}`, value2]);
|
|
800
|
+
return out;
|
|
801
|
+
}
|
|
802
|
+
function mcpVariableIssues(config, env) {
|
|
803
|
+
const issues = [];
|
|
804
|
+
for (const [name, server2] of Object.entries(config.mcp?.servers ?? {})) {
|
|
805
|
+
for (const [field, value2] of serverValues(server2)) {
|
|
806
|
+
try {
|
|
807
|
+
expandVars(value2, env);
|
|
808
|
+
} catch (err) {
|
|
809
|
+
issues.push(`mcp.servers.${name}.${field}: ${err.message}`);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return issues;
|
|
814
|
+
}
|
|
815
|
+
function resolveMcpServer(server2, env = process.env, baseDir = process.cwd()) {
|
|
816
|
+
const fill = (value2) => expandVars(value2, env);
|
|
817
|
+
const fillAll = (entries2 = {}) => Object.fromEntries(Object.entries(entries2).map(([key, value2]) => [key, fill(value2)]));
|
|
818
|
+
if (server2.url !== void 0)
|
|
819
|
+
return { kind: "http", url: fill(server2.url), headers: fillAll(server2.headers) };
|
|
820
|
+
return {
|
|
821
|
+
kind: "stdio",
|
|
822
|
+
command: fill(server2.command),
|
|
823
|
+
args: (server2.args ?? []).map(fill),
|
|
824
|
+
env: fillAll(server2.env),
|
|
825
|
+
...server2.cwd !== void 0 ? { cwd: path3.resolve(baseDir, fill(server2.cwd)) } : {}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function mcpSecretWarnings(config) {
|
|
829
|
+
const warnings = [];
|
|
830
|
+
for (const [name, server2] of Object.entries(config.mcp?.servers ?? {})) {
|
|
831
|
+
for (const [field, entries2] of [
|
|
832
|
+
["env", server2.env],
|
|
833
|
+
["headers", server2.headers]
|
|
834
|
+
]) {
|
|
835
|
+
for (const [key, value2] of Object.entries(entries2 ?? {})) {
|
|
836
|
+
if (SECRET_KEY.test(key) && !value2.includes("${")) {
|
|
837
|
+
warnings.push(
|
|
838
|
+
`mcp.servers.${name}.${field}.${key} looks like a secret written into plune.yaml; use \${VAR} so it comes from the environment.`
|
|
839
|
+
);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
return warnings;
|
|
845
|
+
}
|
|
846
|
+
var path3, MCP_LIMIT_DEFAULTS, REFERENCE, SECRET_KEY;
|
|
847
|
+
var init_mcp = __esm({
|
|
848
|
+
"src/config/mcp.ts"() {
|
|
849
|
+
"use strict";
|
|
850
|
+
init_cjs_shims();
|
|
851
|
+
path3 = __toESM(require("path"), 1);
|
|
852
|
+
MCP_LIMIT_DEFAULTS = {
|
|
853
|
+
max_steps: 10,
|
|
854
|
+
max_tool_calls: 20,
|
|
855
|
+
max_total_tokens: 1e5,
|
|
856
|
+
timeout_ms: 12e4,
|
|
857
|
+
tool_timeout_ms: 3e4
|
|
858
|
+
};
|
|
859
|
+
REFERENCE = /\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g;
|
|
860
|
+
SECRET_KEY = /authorization|token|key|secret|password/i;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
|
|
851
864
|
// src/config/loader.ts
|
|
852
865
|
async function loadConfig(opts = {}) {
|
|
853
866
|
const { configPath, cwd = process.cwd(), env = process.env } = opts;
|
|
@@ -1039,7 +1052,7 @@ function readHeader(headers, name) {
|
|
|
1039
1052
|
}
|
|
1040
1053
|
async function withRetry(fn, options) {
|
|
1041
1054
|
const { base_delay_ms = 500, sleep: sleep4 = defaultSleep, random = Math.random } = options;
|
|
1042
|
-
const maxRetries = Math.max(0, Math.floor(options.max_retries));
|
|
1055
|
+
const maxRetries = Number.isFinite(options.max_retries) ? Math.max(0, Math.floor(options.max_retries)) : 0;
|
|
1043
1056
|
let attempt = 0;
|
|
1044
1057
|
for (; ; ) {
|
|
1045
1058
|
try {
|
|
@@ -2930,14 +2943,17 @@ var init_classes = __esm({
|
|
|
2930
2943
|
function buildJudge(provider, cfg, onUsage) {
|
|
2931
2944
|
return {
|
|
2932
2945
|
async ask(prompt5) {
|
|
2946
|
+
const maxTokens = cfg.max_tokens ?? DEFAULT_MAX_TOKENS;
|
|
2933
2947
|
const res = await provider.complete({
|
|
2934
2948
|
provider: cfg.type,
|
|
2935
2949
|
model: cfg.model,
|
|
2936
2950
|
...cfg.temperature !== void 0 ? { temperature: cfg.temperature } : {},
|
|
2937
|
-
max_tokens:
|
|
2951
|
+
max_tokens: maxTokens,
|
|
2938
2952
|
prompt_resolved: prompt5
|
|
2939
2953
|
});
|
|
2940
2954
|
onUsage(res.usage);
|
|
2955
|
+
if (res.finish_reason === "length")
|
|
2956
|
+
throw new Error(`judge reply was cut off at max_tokens (${maxTokens}); raise max_tokens for the judge model`);
|
|
2941
2957
|
return res.output;
|
|
2942
2958
|
}
|
|
2943
2959
|
};
|
|
@@ -3137,6 +3153,54 @@ function scanIds(result2) {
|
|
|
3137
3153
|
values: [...found.values].map(([hash, at2]) => ({ hash, paths: [...at2].sort() }))
|
|
3138
3154
|
};
|
|
3139
3155
|
}
|
|
3156
|
+
function strip(value2, depth, st) {
|
|
3157
|
+
if (typeof value2 === "string") return redactUuids(value2);
|
|
3158
|
+
if (depth > SCAN_DEPTH) {
|
|
3159
|
+
if (typeof value2 === "object" && value2 !== null) st.whole = false;
|
|
3160
|
+
return value2;
|
|
3161
|
+
}
|
|
3162
|
+
if (Array.isArray(value2)) {
|
|
3163
|
+
if (value2.length > SCAN_ITEMS) st.whole = false;
|
|
3164
|
+
return value2.map((v, i) => i < SCAN_ITEMS ? strip(v, depth + 1, st) : v);
|
|
3165
|
+
}
|
|
3166
|
+
if (!isRecord3(value2)) return value2;
|
|
3167
|
+
const out = {};
|
|
3168
|
+
for (const [key, v] of Object.entries(value2)) {
|
|
3169
|
+
let name = redactUuids(key);
|
|
3170
|
+
for (let n = 2; name !== key && Object.hasOwn(out, name); n++) name = `${ID_MARK}#${n}`;
|
|
3171
|
+
out[name] = isIdKey(key) && (isScalar(v) || Array.isArray(v) && v.length > 0 && v.every(isScalar)) ? Array.isArray(v) ? v.map(() => ID_MARK) : ID_MARK : strip(v, depth + 1, st);
|
|
3172
|
+
}
|
|
3173
|
+
return out;
|
|
3174
|
+
}
|
|
3175
|
+
function redactIds(value2) {
|
|
3176
|
+
const st = { whole: true };
|
|
3177
|
+
return { value: strip(value2, 0, st), whole: st.whole };
|
|
3178
|
+
}
|
|
3179
|
+
function redactAnswer(result2) {
|
|
3180
|
+
let unread;
|
|
3181
|
+
const ids = (v) => {
|
|
3182
|
+
const r = redactIds(v);
|
|
3183
|
+
if (!r.whole)
|
|
3184
|
+
unread ??= `the answer is deeper than ${SCAN_DEPTH} levels or has more than ${SCAN_ITEMS} items in a list`;
|
|
3185
|
+
return r.value;
|
|
3186
|
+
};
|
|
3187
|
+
if (!isRecord3(result2))
|
|
3188
|
+
return { result: ids(result2), ...unread !== void 0 ? { unread } : {} };
|
|
3189
|
+
const out = { ...result2 };
|
|
3190
|
+
if (result2.structuredContent !== void 0) out.structuredContent = ids(result2.structuredContent);
|
|
3191
|
+
if (Array.isArray(result2.content))
|
|
3192
|
+
out.content = result2.content.map((block2) => {
|
|
3193
|
+
if (!isRecord3(block2) || block2.type !== "text" || typeof block2.text !== "string")
|
|
3194
|
+
return ids(block2);
|
|
3195
|
+
try {
|
|
3196
|
+
return { ...block2, text: JSON.stringify(ids(JSON.parse(block2.text))) };
|
|
3197
|
+
} catch {
|
|
3198
|
+
unread ??= "the answer is not JSON";
|
|
3199
|
+
return { ...block2, text: redactUuids(block2.text) };
|
|
3200
|
+
}
|
|
3201
|
+
});
|
|
3202
|
+
return { result: out, ...unread !== void 0 ? { unread } : {} };
|
|
3203
|
+
}
|
|
3140
3204
|
function frictionAdvice(calls) {
|
|
3141
3205
|
const acc = /* @__PURE__ */ new Map();
|
|
3142
3206
|
const add = (type, tool2, steps, paths = [], note2) => {
|
|
@@ -3214,7 +3278,7 @@ function frictionAdvice(calls) {
|
|
|
3214
3278
|
};
|
|
3215
3279
|
});
|
|
3216
3280
|
}
|
|
3217
|
-
var SCAN_DEPTH, SCAN_ITEMS, MAX_PATHS, MAX_PATH, MIN_VALUE, WORDS, WHOLE, SNAKE, CAMEL, UUID, isIdKey, isRecord3, isScalar, EMAIL, cap, hashOf, list;
|
|
3281
|
+
var SCAN_DEPTH, SCAN_ITEMS, MAX_PATHS, MAX_PATH, MIN_VALUE, WORDS, WHOLE, SNAKE, CAMEL, UUID, isIdKey, isRecord3, isScalar, EMAIL, cap, hashOf, ID_MARK, UUID_IN_TEXT, redactUuids, STR, NUM, VAL, PAIR, redactReason, list;
|
|
3218
3282
|
var init_friction = __esm({
|
|
3219
3283
|
"src/orchestrator/friction.ts"() {
|
|
3220
3284
|
"use strict";
|
|
@@ -3237,6 +3301,22 @@ var init_friction = __esm({
|
|
|
3237
3301
|
EMAIL = /@/;
|
|
3238
3302
|
cap = (path25) => path25.length > MAX_PATH ? path25.slice(0, MAX_PATH) : path25;
|
|
3239
3303
|
hashOf = (v) => sha256(v).slice(0, 16);
|
|
3304
|
+
ID_MARK = "<id>";
|
|
3305
|
+
UUID_IN_TEXT = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
|
|
3306
|
+
redactUuids = (text6) => text6.replace(UUID_IN_TEXT, ID_MARK);
|
|
3307
|
+
STR = String.raw`"(?:[^"\\]|\\.)*?(?:"|(?= \(cut\)))`;
|
|
3308
|
+
NUM = String.raw`-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?`;
|
|
3309
|
+
VAL = `(?:${STR}|${NUM})`;
|
|
3310
|
+
PAIR = new RegExp(
|
|
3311
|
+
String.raw`"((?:[^"\\]|\\.)*)":(${VAL}|\[(?:${VAL}(?:,${VAL})*)?(?:\]|(?= \(cut\))))`,
|
|
3312
|
+
"g"
|
|
3313
|
+
);
|
|
3314
|
+
redactReason = (text6) => redactUuids(
|
|
3315
|
+
text6.replace(
|
|
3316
|
+
PAIR,
|
|
3317
|
+
(whole, key) => isIdKey(key) ? `"${key}":${JSON.stringify(ID_MARK)}` : whole
|
|
3318
|
+
)
|
|
3319
|
+
);
|
|
3240
3320
|
list = (steps) => steps.join(", ");
|
|
3241
3321
|
}
|
|
3242
3322
|
});
|
|
@@ -3261,7 +3341,7 @@ function excerpts() {
|
|
|
3261
3341
|
left -= keep;
|
|
3262
3342
|
const truncated = keep < whole.length;
|
|
3263
3343
|
if (truncated) state2.any = true;
|
|
3264
|
-
const kept = truncated ? whole
|
|
3344
|
+
const kept = truncated ? firstBytes(whole, keep) : text6;
|
|
3265
3345
|
return { text: kept, bytes: whole.length, truncated };
|
|
3266
3346
|
}
|
|
3267
3347
|
};
|
|
@@ -3315,6 +3395,7 @@ async function runAgentRow(p) {
|
|
|
3315
3395
|
let error;
|
|
3316
3396
|
let session2;
|
|
3317
3397
|
const scanned = /* @__PURE__ */ new Map();
|
|
3398
|
+
const cleaned = /* @__PURE__ */ new Map();
|
|
3318
3399
|
const overrides = p.toolDescriptions ?? {};
|
|
3319
3400
|
const replaced = /* @__PURE__ */ new Set();
|
|
3320
3401
|
try {
|
|
@@ -3460,6 +3541,17 @@ async function runAgentRow(p) {
|
|
|
3460
3541
|
succeeded ||= !rec.is_error;
|
|
3461
3542
|
if (got2.kind === "result" && !rec.is_error) scanned.set(rec, scanIds(got2.result));
|
|
3462
3543
|
rec.result = kept.cut(text6);
|
|
3544
|
+
if (got2.kind === "result") {
|
|
3545
|
+
const r = redactAnswer(got2.result);
|
|
3546
|
+
cleaned.set(rec, {
|
|
3547
|
+
text: resultText(r.result),
|
|
3548
|
+
...r.unread !== void 0 ? { unread: r.unread } : {}
|
|
3549
|
+
});
|
|
3550
|
+
} else
|
|
3551
|
+
cleaned.set(rec, {
|
|
3552
|
+
text: redactUuids(text6),
|
|
3553
|
+
unread: "the answer is an error message, not JSON"
|
|
3554
|
+
});
|
|
3463
3555
|
answer(rec, c, text6);
|
|
3464
3556
|
}
|
|
3465
3557
|
messages.push(
|
|
@@ -3500,8 +3592,44 @@ async function runAgentRow(p) {
|
|
|
3500
3592
|
tool: tool2,
|
|
3501
3593
|
sha256: sha256(overrides[tool2])
|
|
3502
3594
|
}));
|
|
3595
|
+
const storeWithoutIds = (said3 = [], err) => {
|
|
3596
|
+
for (const r of said3) if (r.reason !== void 0) r.reason = redactReason(r.reason);
|
|
3597
|
+
if (err !== void 0) err.message = redactReason(err.message);
|
|
3598
|
+
const unread = /* @__PURE__ */ new Map();
|
|
3599
|
+
transcript.steps.forEach(
|
|
3600
|
+
(s, si) => s.calls.forEach((c, ci) => {
|
|
3601
|
+
const out = agent.steps[si].calls[ci];
|
|
3602
|
+
out.args = redactIds(out.args).value;
|
|
3603
|
+
const clean3 = cleaned.get(c);
|
|
3604
|
+
if (out.result === void 0 || clean3 === void 0) return;
|
|
3605
|
+
const whole = Buffer.from(mask?.text(clean3.text) ?? clean3.text, "utf8");
|
|
3606
|
+
const keep = Buffer.byteLength(out.result.text, "utf8");
|
|
3607
|
+
out.result = {
|
|
3608
|
+
...out.result,
|
|
3609
|
+
text: out.result.truncated && keep < whole.length ? firstBytes(whole, keep) : whole.toString("utf8")
|
|
3610
|
+
};
|
|
3611
|
+
if (clean3.unread === void 0) return;
|
|
3612
|
+
const u = unread.get(c.name) ?? { steps: /* @__PURE__ */ new Set(), count: 0, why: clean3.unread };
|
|
3613
|
+
u.steps.add(s.index);
|
|
3614
|
+
u.count++;
|
|
3615
|
+
unread.set(c.name, u);
|
|
3616
|
+
})
|
|
3617
|
+
);
|
|
3618
|
+
return [...unread].map(([tool2, u]) => {
|
|
3619
|
+
const steps = [...u.steps].sort((x, y) => x - y);
|
|
3620
|
+
return {
|
|
3621
|
+
type: "ids-not-redacted",
|
|
3622
|
+
tool: tool2,
|
|
3623
|
+
steps,
|
|
3624
|
+
count: u.count,
|
|
3625
|
+
reason: `${tool2}: ${u.why}, so only UUID-shaped values were replaced in its stored answer; other identifiers may remain (steps ${steps.join(", ")})`
|
|
3626
|
+
};
|
|
3627
|
+
});
|
|
3628
|
+
};
|
|
3503
3629
|
const spent = usages.length > 0 ? { usage: sumUsage(usages) } : {};
|
|
3504
3630
|
if (error !== void 0) {
|
|
3631
|
+
const notes = storeWithoutIds();
|
|
3632
|
+
if (notes.length > 0) agent.advice = notes;
|
|
3505
3633
|
return {
|
|
3506
3634
|
vars: p.row.vars,
|
|
3507
3635
|
output: null,
|
|
@@ -3522,7 +3650,11 @@ async function runAgentRow(p) {
|
|
|
3522
3650
|
const signals = (mask?.value(friction) ?? friction).filter(
|
|
3523
3651
|
(f) => !(f.type === "identical-retry" && covered.some((c) => c.tool === void 0 || c.tool === f.tool))
|
|
3524
3652
|
);
|
|
3525
|
-
const findings = [
|
|
3653
|
+
const findings = [
|
|
3654
|
+
...advice,
|
|
3655
|
+
...signals,
|
|
3656
|
+
...storeWithoutIds([...records, ...advice], assertionError)
|
|
3657
|
+
];
|
|
3526
3658
|
if (findings.length > 0) agent.advice = findings;
|
|
3527
3659
|
const usage3 = sumUsage(usages);
|
|
3528
3660
|
return {
|
|
@@ -3540,7 +3672,7 @@ async function runAgentRow(p) {
|
|
|
3540
3672
|
agent
|
|
3541
3673
|
};
|
|
3542
3674
|
}
|
|
3543
|
-
var EXCERPT_BYTES, TRANSCRIPT_BYTES, DEFAULT_MAX_TOKENS2, LimitStop, AgentError, isRecord4;
|
|
3675
|
+
var EXCERPT_BYTES, TRANSCRIPT_BYTES, DEFAULT_MAX_TOKENS2, LimitStop, AgentError, isRecord4, firstBytes;
|
|
3544
3676
|
var init_agent = __esm({
|
|
3545
3677
|
"src/orchestrator/agent.ts"() {
|
|
3546
3678
|
"use strict";
|
|
@@ -3567,6 +3699,7 @@ var init_agent = __esm({
|
|
|
3567
3699
|
code;
|
|
3568
3700
|
};
|
|
3569
3701
|
isRecord4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3702
|
+
firstBytes = (whole, keep) => whole.subarray(0, keep).toString("utf8").replace(/�$/, "");
|
|
3570
3703
|
}
|
|
3571
3704
|
});
|
|
3572
3705
|
|
|
@@ -7982,9 +8115,13 @@ function repeatsText(row) {
|
|
|
7982
8115
|
const a = row.attempts;
|
|
7983
8116
|
if (a === void 0) return void 0;
|
|
7984
8117
|
if (a.results.length === 0) return `dry run: estimate \xD7 ${a.runs} runs`;
|
|
7985
|
-
return `${a.passed}/${a.runs} passed (pass_threshold ${a.pass_threshold}): ${rowStatus(row)}`;
|
|
8118
|
+
return `${a.passed}/${a.runs} passed (pass_threshold ${a.pass_threshold}): ${rowStatus(row)}${flakyText(a)}`;
|
|
8119
|
+
}
|
|
8120
|
+
function flakyText(a) {
|
|
8121
|
+
if (a.passed <= 0 || a.passed >= a.runs) return "";
|
|
8122
|
+
return ` \xB7 flaky ${Number((a.passed / a.runs).toFixed(2))}`;
|
|
7986
8123
|
}
|
|
7987
|
-
var safeLine, mdCell;
|
|
8124
|
+
var safeLine, mdCell, NOT_MEASURED_STABILITY, noRepeats;
|
|
7988
8125
|
var init_helpers = __esm({
|
|
7989
8126
|
"src/reporters/helpers.ts"() {
|
|
7990
8127
|
"use strict";
|
|
@@ -7993,6 +8130,8 @@ var init_helpers = __esm({
|
|
|
7993
8130
|
init_human();
|
|
7994
8131
|
safeLine = (t) => noCommands(t.replace(/\s*[\r\n]+\s*/g, " ").trim());
|
|
7995
8132
|
mdCell = (t) => safeLine(t).replace(/\|/g, "\\|");
|
|
8133
|
+
NOT_MEASURED_STABILITY = "stability: not measured (runs: 1)";
|
|
8134
|
+
noRepeats = (result2) => result2.evals.every((ev) => ev.rows.every((row) => row.attempts === void 0));
|
|
7996
8135
|
}
|
|
7997
8136
|
});
|
|
7998
8137
|
|
|
@@ -8484,6 +8623,7 @@ function renderConsole(result2, opts = {}) {
|
|
|
8484
8623
|
lines.push(
|
|
8485
8624
|
`${passedTxt} \xB7 ${failedTxt} \xB7 ${erroredTxt}${blockedTxt}${skippedTxt} \xB7 ${summary.total} total \xB7 $${summary.cost_usd.toFixed(4)} \xB7 ${summary.duration_ms}ms`
|
|
8486
8625
|
);
|
|
8626
|
+
if (noRepeats(result2)) lines.push(s.dim(NOT_MEASURED_STABILITY));
|
|
8487
8627
|
const c = summary.cache;
|
|
8488
8628
|
if (c !== void 0 && c.from_cache + c.from_model + c.missed > 0) {
|
|
8489
8629
|
const missedTxt = c.missed > 0 ? ` \xB7 ${s.yellow(`${c.missed} missed`)}` : "";
|
|
@@ -8609,6 +8749,7 @@ function renderMarkdown(result2, opts = {}) {
|
|
|
8609
8749
|
out.push(`| Cost (USD) | ${summary.cost_usd.toFixed(4)} |`);
|
|
8610
8750
|
out.push(`| Duration (ms) | ${summary.duration_ms} |`);
|
|
8611
8751
|
out.push("");
|
|
8752
|
+
if (noRepeats(result2)) out.push(NOT_MEASURED_STABILITY, "");
|
|
8612
8753
|
const matrix = buildMatrix(result2);
|
|
8613
8754
|
if (matrix !== void 0) out.push("## Model matrix", "", ...matrixMarkdown2(matrix), "");
|
|
8614
8755
|
const repeated = result2.evals.flatMap(
|
|
@@ -8623,8 +8764,12 @@ function renderMarkdown(result2, opts = {}) {
|
|
|
8623
8764
|
out.push("| --- | --- | --- | --- | --- |");
|
|
8624
8765
|
for (const { id: id2, row, a } of repeated) {
|
|
8625
8766
|
const vars = JSON.stringify(row.vars).replace(/\|/g, "\\|");
|
|
8626
|
-
const
|
|
8627
|
-
|
|
8767
|
+
const dry = a.results.length === 0;
|
|
8768
|
+
const passed2 = dry ? `dry run \xD7 ${a.runs}` : `${a.passed}/${a.runs}`;
|
|
8769
|
+
const flaky = dry ? "" : flakyText(a);
|
|
8770
|
+
out.push(
|
|
8771
|
+
`| ${mdCell(id2)} | ${vars} | ${passed2} | ${a.pass_threshold} | ${rowStatus(row)}${flaky} |`
|
|
8772
|
+
);
|
|
8628
8773
|
}
|
|
8629
8774
|
out.push("");
|
|
8630
8775
|
}
|
|
@@ -9086,6 +9231,7 @@ function readEnv(env = process.env) {
|
|
|
9086
9231
|
...shardError !== void 0 ? { shardError } : {},
|
|
9087
9232
|
...configurationError !== void 0 ? { configurationError } : {},
|
|
9088
9233
|
...importTimeout !== void 0 ? { importTimeout } : {},
|
|
9234
|
+
secretCheck: !["0", "false", "no", "off"].includes(value(env, "PLUNE_SECRET_CHECK")?.toLowerCase() ?? ""),
|
|
9089
9235
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0),
|
|
9090
9236
|
warnings
|
|
9091
9237
|
};
|
|
@@ -9287,6 +9433,30 @@ function maskCredentials(text6) {
|
|
|
9287
9433
|
"$1$2\u2039credential\u203A"
|
|
9288
9434
|
).replace(/\b(PLUNE_[A-Z0-9_]*=)(?!‹)[^\s'"\x60;,)]+/g, "$1\u2039env-secret\u203A").replace(QUERY_PARAM, "$1\u2039credential\u203A").replace(/\b([a-z][\w+.-]*:\/\/)[^\s/@'"\x60]+@/gi, "$1\u2039credential\u203A@");
|
|
9289
9435
|
}
|
|
9436
|
+
function credentialsIn(text6) {
|
|
9437
|
+
const masked = maskCredentials(text6);
|
|
9438
|
+
if (masked === text6) return [];
|
|
9439
|
+
const found = [];
|
|
9440
|
+
let from = 0;
|
|
9441
|
+
let at2 = 0;
|
|
9442
|
+
for (let open2 = masked.indexOf("\u2039", at2); open2 >= 0; open2 = masked.indexOf("\u2039", at2)) {
|
|
9443
|
+
const start2 = from + (open2 - at2);
|
|
9444
|
+
let close = masked.indexOf("\u203A", open2);
|
|
9445
|
+
while (close >= 0 && masked[close + 1] === "\u2039") close = masked.indexOf("\u203A", close + 1);
|
|
9446
|
+
if (close < 0) break;
|
|
9447
|
+
const next = masked.indexOf("\u2039", close + 1);
|
|
9448
|
+
const tail = masked.slice(close + 1, next < 0 ? void 0 : next);
|
|
9449
|
+
const end2 = next < 0 ? text6.length - tail.length : text6.indexOf(tail, start2);
|
|
9450
|
+
if (end2 < start2) break;
|
|
9451
|
+
const marker = masked.slice(open2, close + 1);
|
|
9452
|
+
if (!(end2 - start2 === marker.length && text6.startsWith(marker, start2))) {
|
|
9453
|
+
found.push({ line: text6.slice(0, start2).split("\n").length, length: end2 - start2 });
|
|
9454
|
+
}
|
|
9455
|
+
from = end2 + tail.length;
|
|
9456
|
+
at2 = close + 1 + tail.length;
|
|
9457
|
+
}
|
|
9458
|
+
return found;
|
|
9459
|
+
}
|
|
9290
9460
|
function snapshotAt(at2, files) {
|
|
9291
9461
|
let source = files.get(at2.file);
|
|
9292
9462
|
if (source === void 0) {
|
|
@@ -9400,8 +9570,8 @@ function textRefusal(bytes) {
|
|
|
9400
9570
|
return void 0;
|
|
9401
9571
|
}
|
|
9402
9572
|
function withoutTargets(result2) {
|
|
9403
|
-
if (result2.targets === void 0) return result2;
|
|
9404
|
-
const { targets: _targets, ...rest } = result2;
|
|
9573
|
+
if (result2.targets === void 0 && result2.traceUrl === void 0) return result2;
|
|
9574
|
+
const { targets: _targets, traceUrl: _traceUrl, ...rest } = result2;
|
|
9405
9575
|
return rest;
|
|
9406
9576
|
}
|
|
9407
9577
|
function onDisk(deferred) {
|
|
@@ -10236,8 +10406,8 @@ async function startRun(passed2, declared2) {
|
|
|
10236
10406
|
{ results: results4, ...configuration !== void 0 ? { configuration } : {} }
|
|
10237
10407
|
);
|
|
10238
10408
|
let out = await post(part);
|
|
10239
|
-
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0)) {
|
|
10240
|
-
if (!targetsRefused) log("plune: the platform does not take targets on a result yet \u2014 the results are sent without them.");
|
|
10409
|
+
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0 || r.traceUrl !== void 0)) {
|
|
10410
|
+
if (!targetsRefused) log("plune: the platform does not take targets or a trace link on a result yet \u2014 the results are sent without them.");
|
|
10241
10411
|
targetsRefused = true;
|
|
10242
10412
|
part = part.map(withoutTargets);
|
|
10243
10413
|
out = await post(part);
|
|
@@ -10309,6 +10479,27 @@ async function startRun(passed2, declared2) {
|
|
|
10309
10479
|
log(`::warning::${stats.deferred} result(s) were not delivered to Plune \u2014 see the reporting step's log.`);
|
|
10310
10480
|
}
|
|
10311
10481
|
}
|
|
10482
|
+
async function warnOfSecrets(result2) {
|
|
10483
|
+
const of = printable(result2.title ?? result2.resultKey);
|
|
10484
|
+
const say = (what, text6) => {
|
|
10485
|
+
for (const { line, length } of credentialsIn(text6)) {
|
|
10486
|
+
log(
|
|
10487
|
+
`plune: ${what} of "${of}" holds what looks like a secret on line ${line} (${length} characters) \u2014 sent as it is; mask it in the test, or set PLUNE_SECRET_CHECK=0 to turn this check off.`
|
|
10488
|
+
);
|
|
10489
|
+
}
|
|
10490
|
+
};
|
|
10491
|
+
const error = result2.errorContext ?? result2.failure?.headline;
|
|
10492
|
+
if (error !== void 0) say("the error text", error);
|
|
10493
|
+
for (const file of result2.files ?? []) {
|
|
10494
|
+
if (!isTextType(file.contentType)) continue;
|
|
10495
|
+
let bytes = file.body;
|
|
10496
|
+
if (bytes === void 0 && file.path !== void 0) {
|
|
10497
|
+
const size = await import_node_fs9.promises.stat(file.path).then((s) => s.size, () => Infinity);
|
|
10498
|
+
if (size <= TEXT_BYTES) bytes = await import_node_fs9.promises.readFile(file.path).catch(() => void 0);
|
|
10499
|
+
}
|
|
10500
|
+
if (bytes !== void 0 && bytes.length <= TEXT_BYTES) say(`the attachment "${printable(file.name)}"`, bytes.toString("utf8"));
|
|
10501
|
+
}
|
|
10502
|
+
}
|
|
10312
10503
|
const shardLines = [];
|
|
10313
10504
|
return {
|
|
10314
10505
|
get runId() {
|
|
@@ -10322,6 +10513,7 @@ async function startRun(passed2, declared2) {
|
|
|
10322
10513
|
},
|
|
10323
10514
|
async add(result2) {
|
|
10324
10515
|
const { codeAt, ...rest } = result2;
|
|
10516
|
+
if (env.secretCheck) await warnOfSecrets(result2);
|
|
10325
10517
|
const text6 = codeAt === void 0 ? void 0 : snapshotAt(codeAt, specFiles);
|
|
10326
10518
|
if (text6 !== void 0) snapshotByKey.set(result2.resultKey, text6);
|
|
10327
10519
|
buffer.push({ ...rest, keys: bound(result2.keys) });
|
|
@@ -10707,10 +10899,25 @@ var init_run_lifecycle = __esm({
|
|
|
10707
10899
|
});
|
|
10708
10900
|
|
|
10709
10901
|
// src/types/run-result-schema.ts
|
|
10902
|
+
function traceUrlProblem(value2) {
|
|
10903
|
+
if (typeof value2 !== "string") return "not a string";
|
|
10904
|
+
const url = value2.trim();
|
|
10905
|
+
if (url.length > TRACE_URL_MAX) return `longer than ${TRACE_URL_MAX} characters`;
|
|
10906
|
+
if (!/^[^\s\p{Cc}\p{Cf}]+$/u.test(url)) return "must not contain spaces or control characters";
|
|
10907
|
+
let parsed4;
|
|
10908
|
+
try {
|
|
10909
|
+
parsed4 = new URL(url);
|
|
10910
|
+
} catch {
|
|
10911
|
+
return "must be an https address";
|
|
10912
|
+
}
|
|
10913
|
+
if (parsed4.protocol !== "https:" || parsed4.hostname === "") return "must be an https address";
|
|
10914
|
+
if (parsed4.username !== "" || parsed4.password !== "") return "must carry no user name or password";
|
|
10915
|
+
return void 0;
|
|
10916
|
+
}
|
|
10710
10917
|
function parseRunResult(value2) {
|
|
10711
10918
|
return runResultSchema.parse(value2);
|
|
10712
10919
|
}
|
|
10713
|
-
var import_zod3, RUN_RESULT_SCHEMA_VERSION, binaryVerdictSchema, assertionResultRecordSchema2, usageSchema, runErrorSchema, savedSchema, rowResultSchema, summarySchema, evalResultSchema, runResultSchema;
|
|
10920
|
+
var import_zod3, RUN_RESULT_SCHEMA_VERSION, binaryVerdictSchema, assertionResultRecordSchema2, usageSchema, runErrorSchema, savedSchema, rowResultSchema, summarySchema, evalResultSchema, TRACE_URL_MAX, runResultSchema;
|
|
10714
10921
|
var init_run_result_schema = __esm({
|
|
10715
10922
|
"src/types/run-result-schema.ts"() {
|
|
10716
10923
|
"use strict";
|
|
@@ -10858,8 +11065,11 @@ var init_run_result_schema = __esm({
|
|
|
10858
11065
|
model: import_zod3.z.string().optional()
|
|
10859
11066
|
}).optional(),
|
|
10860
11067
|
/** The type and model of a cell of a multi-model run. Optional and additive. */
|
|
10861
|
-
provider: import_zod3.z.object({ type: import_zod3.z.string(), model: import_zod3.z.string() }).optional()
|
|
11068
|
+
provider: import_zod3.z.object({ type: import_zod3.z.string(), model: import_zod3.z.string() }).optional(),
|
|
11069
|
+
/** The link to the eval's trace in your own observability (Langfuse, OTel). Optional and additive; `plune sync` drops one `traceUrlProblem` refuses. */
|
|
11070
|
+
traceUrl: import_zod3.z.string().optional()
|
|
10862
11071
|
});
|
|
11072
|
+
TRACE_URL_MAX = 2048;
|
|
10863
11073
|
runResultSchema = import_zod3.z.object({
|
|
10864
11074
|
schemaVersion: import_zod3.z.literal(RUN_RESULT_SCHEMA_VERSION),
|
|
10865
11075
|
plune_version: import_zod3.z.string(),
|
|
@@ -10964,7 +11174,7 @@ __export(sync_exports, {
|
|
|
10964
11174
|
handleSync: () => handleSync,
|
|
10965
11175
|
reportSyncFailure: () => reportSyncFailure
|
|
10966
11176
|
});
|
|
10967
|
-
function readRun(cwd, file) {
|
|
11177
|
+
function readRun(cwd, file, warn) {
|
|
10968
11178
|
const target4 = file !== void 0 ? path10.resolve(cwd, file) : path10.join(cwd, ".plune", "last-run.json");
|
|
10969
11179
|
let raw;
|
|
10970
11180
|
try {
|
|
@@ -10980,12 +11190,29 @@ function readRun(cwd, file) {
|
|
|
10980
11190
|
} catch {
|
|
10981
11191
|
throw new SyncFileError(`Run file is not valid JSON: ${target4}`);
|
|
10982
11192
|
}
|
|
11193
|
+
dropBadTraceLinks(json2, warn);
|
|
10983
11194
|
try {
|
|
10984
11195
|
return parseRunResult(json2);
|
|
10985
11196
|
} catch {
|
|
10986
11197
|
throw new SyncFileError(`Run file does not match the RunResult schema: ${target4}`);
|
|
10987
11198
|
}
|
|
10988
11199
|
}
|
|
11200
|
+
function dropBadTraceLinks(json2, warn) {
|
|
11201
|
+
const evals = json2?.evals;
|
|
11202
|
+
if (!Array.isArray(evals)) return;
|
|
11203
|
+
for (const e of evals) {
|
|
11204
|
+
if (typeof e !== "object" || e === null || !("traceUrl" in e)) continue;
|
|
11205
|
+
const entry2 = e;
|
|
11206
|
+
const problem = traceUrlProblem(entry2.traceUrl);
|
|
11207
|
+
if (problem === void 0) {
|
|
11208
|
+
entry2.traceUrl = entry2.traceUrl.trim();
|
|
11209
|
+
continue;
|
|
11210
|
+
}
|
|
11211
|
+
delete entry2.traceUrl;
|
|
11212
|
+
warn(`plune: eval "${String(entry2.id)}": trace link not sent (${problem}) \u2014 the eval is synced without it.
|
|
11213
|
+
`);
|
|
11214
|
+
}
|
|
11215
|
+
}
|
|
10989
11216
|
async function safeErrorDetail(res) {
|
|
10990
11217
|
try {
|
|
10991
11218
|
const body = await res.json();
|
|
@@ -10999,7 +11226,7 @@ async function handleSync(deps = {}) {
|
|
|
10999
11226
|
const apiUrl = resolveApiUrl(deps.apiUrl);
|
|
11000
11227
|
const token2 = (deps.loadToken ?? loadToken)();
|
|
11001
11228
|
if (token2 === null) throw new NotLoggedInError();
|
|
11002
|
-
const run = readRun(cwd, deps.file);
|
|
11229
|
+
const run = readRun(cwd, deps.file, deps.warn ?? ((line) => process.stderr.write(line)));
|
|
11003
11230
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
11004
11231
|
const endpoint = `${apiUrl}/v1/runs`;
|
|
11005
11232
|
const payload2 = JSON.stringify(run);
|
|
@@ -11749,6 +11976,23 @@ var init_allure = __esm({
|
|
|
11749
11976
|
}
|
|
11750
11977
|
});
|
|
11751
11978
|
|
|
11979
|
+
// src/importers/trace-url.ts
|
|
11980
|
+
function traceUrlOf(value2, title, notes) {
|
|
11981
|
+
if (value2 === void 0 || typeof value2 === "string" && value2.trim() === "") return void 0;
|
|
11982
|
+
const problem = traceUrlProblem(value2);
|
|
11983
|
+
if (problem === void 0) return value2.trim();
|
|
11984
|
+
notes.push(`plune: ${JSON.stringify(printable(title))}: trace link not sent (${problem}) \u2014 the result is imported without it.`);
|
|
11985
|
+
return void 0;
|
|
11986
|
+
}
|
|
11987
|
+
var init_trace_url = __esm({
|
|
11988
|
+
"src/importers/trace-url.ts"() {
|
|
11989
|
+
"use strict";
|
|
11990
|
+
init_cjs_shims();
|
|
11991
|
+
init_failure_detail();
|
|
11992
|
+
init_run_result_schema();
|
|
11993
|
+
}
|
|
11994
|
+
});
|
|
11995
|
+
|
|
11752
11996
|
// src/importers/xml.ts
|
|
11753
11997
|
function decode(raw) {
|
|
11754
11998
|
if (!raw.includes("&")) return raw;
|
|
@@ -11901,6 +12145,9 @@ var init_xml = __esm({
|
|
|
11901
12145
|
});
|
|
11902
12146
|
|
|
11903
12147
|
// src/importers/junit.ts
|
|
12148
|
+
function propertyOf(test, name) {
|
|
12149
|
+
return test.children.filter((c) => c.name === "properties").flatMap((p) => p.children).find((p) => p.name === "property" && p.attrs["name"] === name)?.attrs["value"];
|
|
12150
|
+
}
|
|
11904
12151
|
function targetsOf(test) {
|
|
11905
12152
|
const values = test.children.filter((c) => c.name === "properties").flatMap((p) => p.children).filter((p) => p.name === "property" && p.attrs["name"] === TARGET_PROPERTY).map((p) => (p.attrs["value"] ?? "").trim()).filter((v) => v !== "" && v.length <= TARGETS.length && !CONTROL.test(v));
|
|
11906
12153
|
return [...new Set(values)].slice(0, TARGETS.max);
|
|
@@ -11984,6 +12231,7 @@ function readJUnit(source, file, missing = [], notes = [], now = /* @__PURE__ */
|
|
|
11984
12231
|
const rkey = resultKey(key.value, 0);
|
|
11985
12232
|
const files = filesOfTest(test, folder, title, missing, { lexical, resultKey: rkey, notes });
|
|
11986
12233
|
const targets = targetsOf(test);
|
|
12234
|
+
const traceUrl = traceUrlOf(propertyOf(test, TRACE_PROPERTY) ?? propertyOf(test, PLAYWRIGHT_TRACE_PROPERTY), title, notes);
|
|
11987
12235
|
return {
|
|
11988
12236
|
resultKey: rkey,
|
|
11989
12237
|
...stated !== void 0 ? { testCaseId: stated } : {},
|
|
@@ -11995,31 +12243,44 @@ function readJUnit(source, file, missing = [], notes = [], now = /* @__PURE__ */
|
|
|
11995
12243
|
...execution !== void 0 ? { execution } : {},
|
|
11996
12244
|
...errorContext !== "" ? { errorContext } : {},
|
|
11997
12245
|
...files.length > 0 ? { files } : {},
|
|
11998
|
-
...targets.length > 0 ? { targets } : {}
|
|
12246
|
+
...targets.length > 0 ? { targets } : {},
|
|
12247
|
+
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
11999
12248
|
};
|
|
12000
12249
|
});
|
|
12001
12250
|
}
|
|
12002
12251
|
function looksLikeJUnit(source) {
|
|
12003
12252
|
return /<\s*testsuites?\b/.test(source.slice(0, 4096));
|
|
12004
12253
|
}
|
|
12005
|
-
var SOURCE2, TOKEN2, SPEC_FILE, TARGET_PROPERTY, TARGETS, CONTROL;
|
|
12254
|
+
var SOURCE2, TOKEN2, SPEC_FILE, TARGET_PROPERTY, TRACE_PROPERTY, PLAYWRIGHT_TRACE_PROPERTY, TARGETS, CONTROL;
|
|
12006
12255
|
var init_junit = __esm({
|
|
12007
12256
|
"src/importers/junit.ts"() {
|
|
12008
12257
|
"use strict";
|
|
12009
12258
|
init_cjs_shims();
|
|
12010
12259
|
init_result_key();
|
|
12011
12260
|
init_attachments();
|
|
12261
|
+
init_trace_url();
|
|
12012
12262
|
init_xml();
|
|
12013
12263
|
SOURCE2 = "junit";
|
|
12014
12264
|
TOKEN2 = /@P([A-Za-z0-9_-]+)/;
|
|
12015
12265
|
SPEC_FILE = /\.(?:spec|test)\.[cm]?[jt]sx?$/;
|
|
12016
12266
|
TARGET_PROPERTY = "plune.mcp.tool";
|
|
12267
|
+
TRACE_PROPERTY = "plune.trace.url";
|
|
12268
|
+
PLAYWRIGHT_TRACE_PROPERTY = "PluneTrace";
|
|
12017
12269
|
TARGETS = { max: 50, length: 200 };
|
|
12018
12270
|
CONTROL = /[\u0000-\u001f\u007f-\u009f]/;
|
|
12019
12271
|
}
|
|
12020
12272
|
});
|
|
12021
12273
|
|
|
12022
12274
|
// src/importers/playwright-json.ts
|
|
12275
|
+
function isFailuresOnly(report, results4) {
|
|
12276
|
+
const reporters = Array.isArray(report.config?.reporter) ? report.config.reporter : [];
|
|
12277
|
+
const declared2 = reporters.some(
|
|
12278
|
+
(r) => Array.isArray(r) && r[0] === "json" && r[1]?.onlyFailures === true
|
|
12279
|
+
);
|
|
12280
|
+
const stats = report.stats;
|
|
12281
|
+
const counted = stats !== void 0 && stats.expected === 0 && stats.skipped === 0;
|
|
12282
|
+
return (declared2 || counted) && (results4 > 0 || (report.errors ?? []).length === 0);
|
|
12283
|
+
}
|
|
12023
12284
|
function statedIdOf(test, title) {
|
|
12024
12285
|
const annotation = test.annotations?.find((a) => a.type === "PluneId")?.description;
|
|
12025
12286
|
if (annotation !== void 0 && annotation !== "") return annotation;
|
|
@@ -12052,6 +12313,8 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
12052
12313
|
const pathTitle = [file, ...titles].join("#");
|
|
12053
12314
|
const seed = test.id ?? pathTitle;
|
|
12054
12315
|
const stated = statedIdOf(test, spec.title ?? "");
|
|
12316
|
+
const traced = (result2.annotations ?? test.annotations)?.find((a) => a.type === "PluneTrace")?.description;
|
|
12317
|
+
const traceUrl = traceUrlOf(traced, titles.join(" \u203A "), ctx.notes);
|
|
12055
12318
|
const expected = test.expectedStatus;
|
|
12056
12319
|
const attempt = attemptOf(result2, file, ctx);
|
|
12057
12320
|
const errorContext = errorContextFields(attempt);
|
|
@@ -12088,7 +12351,8 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
12088
12351
|
} : {},
|
|
12089
12352
|
...errorContext,
|
|
12090
12353
|
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
12091
|
-
...files.length > 0 ? { files } : {}
|
|
12354
|
+
...files.length > 0 ? { files } : {},
|
|
12355
|
+
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
12092
12356
|
};
|
|
12093
12357
|
}
|
|
12094
12358
|
function walk2(suite, describes, depth, ctx, out) {
|
|
@@ -12102,7 +12366,7 @@ function walk2(suite, describes, depth, ctx, out) {
|
|
|
12102
12366
|
}
|
|
12103
12367
|
for (const child of suite.suites ?? []) walk2(child, here, depth + 1, ctx, out);
|
|
12104
12368
|
}
|
|
12105
|
-
function readPlaywrightJson(source, file) {
|
|
12369
|
+
function readPlaywrightJson(source, file, notes = []) {
|
|
12106
12370
|
let parsed4;
|
|
12107
12371
|
try {
|
|
12108
12372
|
parsed4 = JSON.parse(source);
|
|
@@ -12112,11 +12376,13 @@ function readPlaywrightJson(source, file) {
|
|
|
12112
12376
|
if (typeof parsed4 !== "object" || parsed4 === null || !Array.isArray(parsed4.suites)) {
|
|
12113
12377
|
throw new JsonReportError(file, 'no "suites" array \u2014 is this a Playwright JSON report?');
|
|
12114
12378
|
}
|
|
12115
|
-
const
|
|
12379
|
+
const report = parsed4;
|
|
12380
|
+
const { config, suites } = report;
|
|
12116
12381
|
const rootDir = typeof config?.rootDir === "string" ? config.rootDir : void 0;
|
|
12117
12382
|
const buildHref = config?.metadata?.ci?.buildHref;
|
|
12118
12383
|
const repoRoot = rootDir !== void 0 && (0, import_node_fs10.existsSync)(rootDir) ? repoRootOf(rootDir) : void 0;
|
|
12119
12384
|
const ctx = {
|
|
12385
|
+
notes,
|
|
12120
12386
|
...rootDir !== void 0 ? { rootDir } : {},
|
|
12121
12387
|
...repoRoot !== void 0 ? { repoRoot } : {},
|
|
12122
12388
|
...typeof buildHref === "string" ? { buildHref } : {}
|
|
@@ -12128,7 +12394,8 @@ function readPlaywrightJson(source, file) {
|
|
|
12128
12394
|
return {
|
|
12129
12395
|
results: out,
|
|
12130
12396
|
...ciUrl !== void 0 ? { ciUrl } : {},
|
|
12131
|
-
...ci !== void 0 ? { ci } : {}
|
|
12397
|
+
...ci !== void 0 ? { ci } : {},
|
|
12398
|
+
...isFailuresOnly(report, out.length) ? { failuresOnly: true } : {}
|
|
12132
12399
|
};
|
|
12133
12400
|
}
|
|
12134
12401
|
function looksLikePlaywrightJson(source) {
|
|
@@ -12142,6 +12409,7 @@ var init_playwright_json = __esm({
|
|
|
12142
12409
|
import_node_fs10 = require("fs");
|
|
12143
12410
|
init_failure_detail();
|
|
12144
12411
|
init_result_key();
|
|
12412
|
+
init_trace_url();
|
|
12145
12413
|
SOURCE3 = "playwright";
|
|
12146
12414
|
TOKEN3 = /@P([A-Za-z0-9_-]+)/;
|
|
12147
12415
|
NOT_FAILED = /* @__PURE__ */ new Set(["passed", "skipped"]);
|
|
@@ -12437,7 +12705,7 @@ function readReport(source, file, format, options = {}) {
|
|
|
12437
12705
|
if (chosen2 === "lighthouse") {
|
|
12438
12706
|
return { format: chosen2, results: readLighthouse(source, file, options.minScores), missing, notes };
|
|
12439
12707
|
}
|
|
12440
|
-
return { format: chosen2, ...readPlaywrightJson(source, file), missing, notes };
|
|
12708
|
+
return { format: chosen2, ...readPlaywrightJson(source, file, notes), missing, notes };
|
|
12441
12709
|
}
|
|
12442
12710
|
var path16, IMPORT_FORMATS, UnknownFormatError;
|
|
12443
12711
|
var init_importers = __esm({
|
|
@@ -12488,6 +12756,31 @@ async function timeoutMessage(limit3, runId, ours, options) {
|
|
|
12488
12756
|
const done = await Promise.race([closed, gaveUp]).finally(() => clearTimeout(timer)) === true;
|
|
12489
12757
|
return done ? `${head}; run ${runId} was terminated - import the report again.` : `${head}; run ${runId} could not be terminated from here - run "plune run finish ${runId} --terminate" (the platform also closes a silent run after 30 minutes), then import again.`;
|
|
12490
12758
|
}
|
|
12759
|
+
function emptyImport(format) {
|
|
12760
|
+
const none = { uploaded: 0, skipped: 0, failed: 0 };
|
|
12761
|
+
return {
|
|
12762
|
+
runId: null,
|
|
12763
|
+
format,
|
|
12764
|
+
parsed: 0,
|
|
12765
|
+
accepted: 0,
|
|
12766
|
+
duplicate: 0,
|
|
12767
|
+
conflict: 0,
|
|
12768
|
+
rejected: 0,
|
|
12769
|
+
unresolved: 0,
|
|
12770
|
+
offered: 0,
|
|
12771
|
+
created: 0,
|
|
12772
|
+
unoffered: 0,
|
|
12773
|
+
deferred: 0,
|
|
12774
|
+
screenshots: none,
|
|
12775
|
+
textFiles: { ...none },
|
|
12776
|
+
unlocatable: 0,
|
|
12777
|
+
missingAttachments: [],
|
|
12778
|
+
filesUploaded: 0,
|
|
12779
|
+
filesNotSent: 0,
|
|
12780
|
+
announced: false,
|
|
12781
|
+
offering: false
|
|
12782
|
+
};
|
|
12783
|
+
}
|
|
12491
12784
|
async function handleRunImport(options) {
|
|
12492
12785
|
const write = options.write ?? ((line) => void process.stdout.write(`${line}
|
|
12493
12786
|
`));
|
|
@@ -12507,14 +12800,21 @@ async function handleRunImport(options) {
|
|
|
12507
12800
|
...options.minScores !== void 0 ? { minScores: options.minScores } : {}
|
|
12508
12801
|
});
|
|
12509
12802
|
}
|
|
12510
|
-
const { format, results: results4, missing, notes, ciUrl, ci } = read;
|
|
12803
|
+
const { format, results: results4, missing, notes, ciUrl, ci, failuresOnly } = read;
|
|
12511
12804
|
if (results4.length === 0) {
|
|
12805
|
+
if (failuresOnly === true) {
|
|
12806
|
+
write(`plune: ${printable(options.file)} is a failures-only report and nothing failed \u2014 nothing to import.`);
|
|
12807
|
+
return emptyImport(format);
|
|
12808
|
+
}
|
|
12512
12809
|
throw new RunCommandError(`No test cases in ${options.file} \u2014 it parsed, but there is nothing in it.`);
|
|
12513
12810
|
}
|
|
12514
12811
|
for (const m of missing) write(`plune: attachment not found \u2014 ${JSON.stringify(printable(m.title))}: ${printable(m.path)}`);
|
|
12515
12812
|
for (const note2 of notes) write(note2);
|
|
12516
12813
|
const announced = (format === "junit" || format === "allure") && (missing.length > 0 || results4.some((r) => (r.files?.length ?? 0) > 0));
|
|
12517
12814
|
const env = readEnv();
|
|
12815
|
+
if (failuresOnly === true && env.config.full === true) {
|
|
12816
|
+
write("plune: a failures-only report is not the list of what ran \u2014 PLUNE_FULL_RUN is ignored for it, so no case is detached.");
|
|
12817
|
+
}
|
|
12518
12818
|
const apiUrl = resolveApiUrl(options.apiUrl ?? env.config.apiUrl);
|
|
12519
12819
|
const token2 = options.token ?? env.config.token ?? loadToken() ?? "";
|
|
12520
12820
|
if (token2 === "") throw new NoTokenError();
|
|
@@ -12528,6 +12828,7 @@ async function handleRunImport(options) {
|
|
|
12528
12828
|
...options.key !== void 0 ? { externalKey: options.key } : {},
|
|
12529
12829
|
...options.name !== void 0 ? { title: options.name } : {},
|
|
12530
12830
|
...options.create === true ? { offerDiscovered: true } : {},
|
|
12831
|
+
...failuresOnly === true ? { full: false } : {},
|
|
12531
12832
|
...options.uploadConcurrency !== void 0 ? { uploadConcurrency: options.uploadConcurrency } : {},
|
|
12532
12833
|
kind: "automated",
|
|
12533
12834
|
// The CI run the report names, never this machine's: whoever imports may be another job.
|
|
@@ -13827,6 +14128,174 @@ var init_schemas = __esm({
|
|
|
13827
14128
|
}
|
|
13828
14129
|
});
|
|
13829
14130
|
|
|
14131
|
+
// src/mcp-testing/lint/thresholds.ts
|
|
14132
|
+
var PLUNE_ANSWER_MEASURES, HEADROOM, limitOf, PLUNE_BUDGET, LINT_THRESHOLDS;
|
|
14133
|
+
var init_thresholds = __esm({
|
|
14134
|
+
"src/mcp-testing/lint/thresholds.ts"() {
|
|
14135
|
+
"use strict";
|
|
14136
|
+
init_cjs_shims();
|
|
14137
|
+
PLUNE_ANSWER_MEASURES = {
|
|
14138
|
+
plune_project_context: { tokens: 387, of: "3 projects and 3 suites" },
|
|
14139
|
+
plune_cases_search: { tokens: 7678, of: "a project of 48 cases" },
|
|
14140
|
+
plune_review_list: { tokens: 695, of: "7 pending entries" },
|
|
14141
|
+
plune_mission_get: { tokens: 455, of: "a mission with 5 sources" }
|
|
14142
|
+
};
|
|
14143
|
+
HEADROOM = 0.1;
|
|
14144
|
+
limitOf = (measure3) => Math.ceil(measure3 * (1 + HEADROOM));
|
|
14145
|
+
PLUNE_BUDGET = {
|
|
14146
|
+
/** A limit is the measure times (1 + headroom), rounded up. */
|
|
14147
|
+
headroom: HEADROOM,
|
|
14148
|
+
/** A measure below this share of its limit means the limit is too loose: with 10% headroom a list may shrink ~12%. */
|
|
14149
|
+
tooLooseShare: 0.8,
|
|
14150
|
+
/** Whole tool lists, outputSchema and annotations included. */
|
|
14151
|
+
lists: {
|
|
14152
|
+
/** 2025 era, write scope, as listed first: 17 tools, measured 8927 on 2026-11-20 (8853 before the measured-answer lines of #2988). */
|
|
14153
|
+
writeFirst: 9272,
|
|
14154
|
+
/** 2025 era, write scope, after plune_discover_tools: 22 tools, measured 11403 on 2026-11-20 (11329 before the measured-answer lines). */
|
|
14155
|
+
writeAll: 11926,
|
|
14156
|
+
/** Read scope, either era: 7 tools, measured 2296 on 2026-11-20 (2222 before the measured-answer lines; a read token is not offered plune_discover_tools). */
|
|
14157
|
+
read: 2445,
|
|
14158
|
+
/** 2026-07-28 era, write scope: 17 tools, the list does not change after discover; measured 8927 on 2026-11-20 (8853 before the measured-answer lines). */
|
|
14159
|
+
modernWrite: 9272
|
|
14160
|
+
},
|
|
14161
|
+
/** The biggest single tool, plune_strategy_propose, measured 2177. */
|
|
14162
|
+
largestTool: 2395,
|
|
14163
|
+
/**
|
|
14164
|
+
* The text content of an answer, on live answers recorded in plune-budget.fixtures.ts, measured 2026-11-14 with the
|
|
14165
|
+
* text unindented (before, with a two-space indent): the beta demo project of 2026-11-10 (cases in Ukrainian) gives
|
|
14166
|
+
* plune_project_context with 3 projects, 3 suites, no missions 387 (548); plune_cases_search 7678 (10509) for the
|
|
14167
|
+
* whole project of 48 cases (a page of 100 is not reached); plune_review_list of 7 pending entries 695 (895). The demo
|
|
14168
|
+
* has no missions, so plune_mission_get reads a mission with 5 sources captured live on a beta test project on
|
|
14169
|
+
* 2026-11-14: 455 (585; the synthetic mission it replaced measured 476 indented, under its limit of 524).
|
|
14170
|
+
*/
|
|
14171
|
+
answers: {
|
|
14172
|
+
plune_project_context: limitOf(PLUNE_ANSWER_MEASURES.plune_project_context.tokens),
|
|
14173
|
+
plune_cases_search: limitOf(PLUNE_ANSWER_MEASURES.plune_cases_search.tokens),
|
|
14174
|
+
plune_review_list: limitOf(PLUNE_ANSWER_MEASURES.plune_review_list.tokens),
|
|
14175
|
+
plune_mission_get: limitOf(PLUNE_ANSWER_MEASURES.plune_mission_get.tokens)
|
|
14176
|
+
}
|
|
14177
|
+
};
|
|
14178
|
+
LINT_THRESHOLDS = {
|
|
14179
|
+
description: {
|
|
14180
|
+
/** Shorter than this many characters says too little for a model to choose the tool. */
|
|
14181
|
+
minLength: 40,
|
|
14182
|
+
/** Longer than this many characters costs every request and buries the point. */
|
|
14183
|
+
maxLength: 1e3
|
|
14184
|
+
},
|
|
14185
|
+
names: {
|
|
14186
|
+
/** The specification's length bound for a tool name. */
|
|
14187
|
+
maxLength: 128,
|
|
14188
|
+
/** A naming style is the server's convention when more than this share of its tools use it. */
|
|
14189
|
+
majorityShare: 0.5
|
|
14190
|
+
},
|
|
14191
|
+
similarity: {
|
|
14192
|
+
/** Word-set overlap (Jaccard) of two names, the shared server prefix left out, above which they are confusable. */
|
|
14193
|
+
names: 0.75,
|
|
14194
|
+
/** Word-set overlap of two descriptions above which a model cannot tell the tools apart. */
|
|
14195
|
+
descriptions: 0.6,
|
|
14196
|
+
/** Overlap of two descriptions above which the tools are related enough that "when not to use" matters more. */
|
|
14197
|
+
related: 0.35,
|
|
14198
|
+
/** Words shorter than this are left out of a description's word set. */
|
|
14199
|
+
minWordLength: 3,
|
|
14200
|
+
/** Decimals an overlap is reported with. */
|
|
14201
|
+
decimals: 2,
|
|
14202
|
+
/**
|
|
14203
|
+
* Tools above which the rules that compare every pair (`tools-similar`, `desc-no-when-not`) do not run and say
|
|
14204
|
+
* `could-not-run`: the work grows with the square of a count the server chooses. Measured 2026-11-10 on one
|
|
14205
|
+
* desktop core, with no two tools alike (the slowest case: no early stop): at 1000 tools the two rules take 0.25 s
|
|
14206
|
+
* with 60-character descriptions and 2.3 s with 1000-character ones (`description.maxLength`); at 4000 short ones,
|
|
14207
|
+
* 4.5 s. Well above the tool lists of real servers, which hold tens to hundreds.
|
|
14208
|
+
*/
|
|
14209
|
+
maxTools: 1e3
|
|
14210
|
+
},
|
|
14211
|
+
schema: {
|
|
14212
|
+
/**
|
|
14213
|
+
* Levels an input schema may nest (a named property, or an array's items, is one level below the node it is in)
|
|
14214
|
+
* for the rules that read every node of it (`required-unknown-property`, `param-example-missing`); deeper, they
|
|
14215
|
+
* say `could-not-run` for the tool. The server chooses the depth, and a node's path is as long as its depth.
|
|
14216
|
+
* Hand-written and generated schemas nest to about 10-20 levels; 64 leaves three times that, and is the number
|
|
14217
|
+
* the `--call` path stops copying an output schema at (counted there in JSON levels, two to a property).
|
|
14218
|
+
* Measured 2026-11-10 on one desktop core: the two rules take 0.03 ms on a chain exactly 64 levels deep (0.09 ms
|
|
14219
|
+
* with two siblings and an array at every level), and stop within 0.2 ms on a chain of 100 000 levels. The
|
|
14220
|
+
* recursive walk this replaced overflowed the call stack at 10 000 levels.
|
|
14221
|
+
*/
|
|
14222
|
+
maxDepth: 64
|
|
14223
|
+
},
|
|
14224
|
+
size: {
|
|
14225
|
+
/**
|
|
14226
|
+
* Estimated tokens of the whole visible tool list above which the list is reported: the limit of our own biggest
|
|
14227
|
+
* list (`budget.lists.writeAll`), so a server that costs more than all of ours is told so.
|
|
14228
|
+
*/
|
|
14229
|
+
maxListTokens: PLUNE_BUDGET.lists.writeAll,
|
|
14230
|
+
/**
|
|
14231
|
+
* The estimate: characters of a tool's JSON divided by this, rounded up, summed over the tools. No tokenizer, no
|
|
14232
|
+
* network, the same number in CI on every run; a limit is a measure plus headroom, never an exact token count.
|
|
14233
|
+
* Calibrated 2026-11-10 against a provider's token-counting endpoint on two current models (both gave the same
|
|
14234
|
+
* counts): the estimate is low. On the same JSON (name, description, input schema: the fields a model API takes) a
|
|
14235
|
+
* tool list costs 1.57-1.72 times the estimate, the tool-use preamble of ~320 tokens left out; the largest live
|
|
14236
|
+
* answer (JSON with Ukrainian text) 1.84 times. The limits stay in estimated tokens; for real tokens multiply by
|
|
14237
|
+
* ~1.7 (English JSON) to ~1.85 (Cyrillic). Table: docs/features/mcp-context-budget/budget.md.
|
|
14238
|
+
*/
|
|
14239
|
+
charsPerToken: 4,
|
|
14240
|
+
budget: PLUNE_BUDGET
|
|
14241
|
+
},
|
|
14242
|
+
call: {
|
|
14243
|
+
/**
|
|
14244
|
+
* Estimated tokens of one `tools/call` result (its JSON, as the client receives it) above which the answer is
|
|
14245
|
+
* reported: the limit of our own biggest answer (`budget.answers.plune_cases_search`), as `maxListTokens` is for
|
|
14246
|
+
* the list.
|
|
14247
|
+
*/
|
|
14248
|
+
maxResultTokens: PLUNE_BUDGET.answers.plune_cases_search
|
|
14249
|
+
},
|
|
14250
|
+
language: {
|
|
14251
|
+
/**
|
|
14252
|
+
* A text is taken to be in a listed language when at least this many of its stop words occur; two, so a lone
|
|
14253
|
+
* "a" or "in" of another Latin-script language does not pass for English.
|
|
14254
|
+
*/
|
|
14255
|
+
minStopwords: 2
|
|
14256
|
+
},
|
|
14257
|
+
/** Name words that say a tool returns a list, so it should take a page size or cursor. */
|
|
14258
|
+
listVerbs: ["list", "search", "find", "query", "browse"],
|
|
14259
|
+
/** Parameter names that page a list. */
|
|
14260
|
+
pagingParams: ["limit", "cursor", "page", "offset", "pagesize", "perpage", "per_page", "page_size", "pagetoken", "page_token"],
|
|
14261
|
+
/** Name words of a tool that changes something; a read-only hint on such a tool contradicts its name. */
|
|
14262
|
+
writeVerbs: ["create", "add", "update", "edit", "delete", "remove", "set", "write", "put", "patch", "insert", "replace", "send"],
|
|
14263
|
+
/** Name words of a tool that overwrites or removes, which is not an "additive only" update. */
|
|
14264
|
+
overwriteVerbs: ["update", "edit", "set", "replace", "delete", "remove", "overwrite", "patch", "clear", "reset", "rename", "move"],
|
|
14265
|
+
/** Parameter name words that say the value is not free text. Booleans only by the first word (`isActive`). */
|
|
14266
|
+
typedParamWords: {
|
|
14267
|
+
number: ["count", "limit", "max", "min", "size", "offset", "total", "amount", "number", "port", "timeout", "retries", "quantity", "index"],
|
|
14268
|
+
boolean: ["is", "has", "can", "should", "allow", "enable", "enabled"],
|
|
14269
|
+
date: ["date", "time", "timestamp", "since", "until", "deadline"],
|
|
14270
|
+
url: ["url", "uri", "href", "link", "endpoint", "website"]
|
|
14271
|
+
},
|
|
14272
|
+
/**
|
|
14273
|
+
* Words by language. `script` is the alphabet the language is written in; `letters`, when given, are letters the
|
|
14274
|
+
* language has and its neighbours in the same alphabet do not, so a Russian text is not read as Ukrainian.
|
|
14275
|
+
* Phrases match at the start of a word, so a stem (`не використов`) covers its inflected forms.
|
|
14276
|
+
*/
|
|
14277
|
+
languages: {
|
|
14278
|
+
en: {
|
|
14279
|
+
script: "Latin",
|
|
14280
|
+
letters: "",
|
|
14281
|
+
stopwords: ["the", "a", "an", "to", "of", "and", "or", "is", "are", "in", "for", "with", "it", "its", "as", "at", "be", "not", "can", "you", "your", "this", "that", "them", "by", "on", "from", "if", "when", "each"],
|
|
14282
|
+
whenNot: ["do not", "don't", "instead", "rather than", "only", "not for", "avoid", "never"],
|
|
14283
|
+
example: ["e.g.", "for example", "for instance", "such as", "example"],
|
|
14284
|
+
closedSet: ["one of", "either"]
|
|
14285
|
+
},
|
|
14286
|
+
uk: {
|
|
14287
|
+
script: "Cyrillic",
|
|
14288
|
+
letters: "\u0456\u0457\u0454\u0491",
|
|
14289
|
+
stopwords: ["\u0456", "\u0439", "\u0442\u0430", "\u0432", "\u0443", "\u043D\u0430", "\u0437", "\u0456\u0437", "\u0449\u043E", "\u0446\u0435", "\u0434\u043E", "\u043D\u0435", "\u0434\u043B\u044F", "\u044F\u043A", "\u0430\u0431\u043E", "\u043A\u043E\u043B\u0438", "\u0439\u043E\u0433\u043E", "\u0457\u0457", "\u0432\u0456\u0434"],
|
|
14290
|
+
whenNot: ["\u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432", "\u043D\u0435 \u0432\u0438\u043A\u043B\u0438\u043A", "\u043D\u0435 \u0437\u0430\u0441\u0442\u043E\u0441\u043E\u0432", "\u0437\u0430\u043C\u0456\u0441\u0442\u044C", "\u043B\u0438\u0448\u0435", "\u0442\u0456\u043B\u044C\u043A\u0438", "\u043D\u0435 \u0434\u043B\u044F", "\u043D\u0456\u043A\u043E\u043B\u0438"],
|
|
14291
|
+
example: ["\u043D\u0430\u043F\u0440\u0438\u043A\u043B\u0430\u0434", "\u043D\u0430\u043F\u0440.", "\u043F\u0440\u0438\u043A\u043B\u0430\u0434", "\u0437\u043E\u043A\u0440\u0435\u043C\u0430"],
|
|
14292
|
+
closedSet: ["\u043E\u0434\u043D\u0435 \u0437", "\u043E\u0434\u0438\u043D \u0437", "\u043E\u0434\u043D\u0430 \u0437", "\u043E\u0434\u043D\u0435 \u0456\u0437", "\u043E\u0434\u0438\u043D \u0456\u0437", "\u043E\u0434\u043D\u0430 \u0456\u0437"]
|
|
14293
|
+
}
|
|
14294
|
+
}
|
|
14295
|
+
};
|
|
14296
|
+
}
|
|
14297
|
+
});
|
|
14298
|
+
|
|
13830
14299
|
// src/mcp-tools/contract.ts
|
|
13831
14300
|
function pluneTool(name) {
|
|
13832
14301
|
const tool2 = BY_NAME.get(name);
|
|
@@ -13844,15 +14313,17 @@ function offeredTo(tool2, scope) {
|
|
|
13844
14313
|
function defaultVisibleTools(scope) {
|
|
13845
14314
|
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
13846
14315
|
}
|
|
13847
|
-
var import_zod5, MAX_VISIBLE_TOOLS, define, listPage, missionId, projectId, PLUNE_TOOLS, PLUNE_TOOL_NAMES, BY_NAME;
|
|
14316
|
+
var import_zod5, MAX_VISIBLE_TOOLS, define, measuredCost, listPage, missionId, projectId, PLUNE_TOOLS, PLUNE_TOOL_NAMES, BY_NAME;
|
|
13848
14317
|
var init_contract = __esm({
|
|
13849
14318
|
"src/mcp-tools/contract.ts"() {
|
|
13850
14319
|
"use strict";
|
|
13851
14320
|
init_cjs_shims();
|
|
13852
14321
|
import_zod5 = require("zod");
|
|
13853
14322
|
init_schemas();
|
|
14323
|
+
init_thresholds();
|
|
13854
14324
|
MAX_VISIBLE_TOOLS = 20;
|
|
13855
14325
|
define = (tool2) => tool2;
|
|
14326
|
+
measuredCost = (tool2) => ` Measured answer: ~${PLUNE_ANSWER_MEASURES[tool2].tokens} tokens (characters / 4) for ${PLUNE_ANSWER_MEASURES[tool2].of}.`;
|
|
13856
14327
|
listPage = {
|
|
13857
14328
|
limit: import_zod5.z.number().int().min(1).max(BATCH_MAX2).optional(),
|
|
13858
14329
|
cursor: import_zod5.z.string().min(1).optional().describe("nextCursor of the previous page")
|
|
@@ -13863,7 +14334,7 @@ var init_contract = __esm({
|
|
|
13863
14334
|
define({
|
|
13864
14335
|
name: "plune_project_context",
|
|
13865
14336
|
title: "Project context",
|
|
13866
|
-
description: "Start here: learn the project you are working in with one call \u2014 its projects, the suite tree, how many test cases it has, its testing missions, how much waits in the review queue, and the rules of its memory: what a person accepted for this project, to follow without asking again.",
|
|
14337
|
+
description: "Start here: learn the project you are working in with one call \u2014 its projects, the suite tree, how many test cases it has, its testing missions, how much waits in the review queue, and the rules of its memory: what a person accepted for this project, to follow without asking again." + measuredCost("plune_project_context"),
|
|
13867
14338
|
input: import_zod5.z.strictObject({}),
|
|
13868
14339
|
output: import_zod5.z.object({
|
|
13869
14340
|
projectId: import_zod5.z.string().nullable(),
|
|
@@ -13891,7 +14362,7 @@ var init_contract = __esm({
|
|
|
13891
14362
|
define({
|
|
13892
14363
|
name: "plune_cases_search",
|
|
13893
14364
|
title: "Find test cases",
|
|
13894
|
-
description: "Find test cases of the project by filter \u2014 free text in q, suite, state, tag, priority and the other filters of the case list \u2014 one page at a time, with the total and how many match.",
|
|
14365
|
+
description: "Find test cases of the project by filter \u2014 free text in q, suite, state, tag, priority and the other filters of the case list \u2014 one page at a time, with the total and how many match." + measuredCost("plune_cases_search"),
|
|
13895
14366
|
input: import_zod5.z.strictObject({
|
|
13896
14367
|
filters: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.union([import_zod5.z.string(), import_zod5.z.array(import_zod5.z.string())])).optional().describe('Query filters of GET /v1/test-cases: free text is the key q, and a key the list does not know is ignored, so all cases come back; a list is OR inside one key, keys are AND-ed (e.g. {"q": "card", "tag": ["smoke"]})'),
|
|
13897
14368
|
...listPage
|
|
@@ -13909,7 +14380,7 @@ var init_contract = __esm({
|
|
|
13909
14380
|
define({
|
|
13910
14381
|
name: "plune_review_list",
|
|
13911
14382
|
title: "Read the review queue",
|
|
13912
|
-
description: "See what waits for a decision in the review queue \u2014 proposed cases, discovered tests, endpoints, strategies, reports \u2014 narrowed by state, kind and mission, newest first, one page at a time. The mission filter needs a platform that supports it; an older one returns the whole queue.",
|
|
14383
|
+
description: "See what waits for a decision in the review queue \u2014 proposed cases, discovered tests, endpoints, strategies, reports \u2014 narrowed by state, kind and mission, newest first, one page at a time. The mission filter needs a platform that supports it; an older one returns the whole queue." + measuredCost("plune_review_list"),
|
|
13913
14384
|
input: import_zod5.z.strictObject({
|
|
13914
14385
|
state: import_zod5.z.enum(REVIEW_STATES).optional(),
|
|
13915
14386
|
kinds: import_zod5.z.array(import_zod5.z.enum(REVIEW_KINDS)).min(1).optional().describe("Questions are read with the question tool"),
|
|
@@ -13990,7 +14461,7 @@ var init_contract = __esm({
|
|
|
13990
14461
|
define({
|
|
13991
14462
|
name: "plune_mission_get",
|
|
13992
14463
|
title: "Read a mission",
|
|
13993
|
-
description: "Read a testing mission with everything it holds \u2014 its brief, state, documentation answer and every source attached to it \u2014 before planning or continuing the work on it.",
|
|
14464
|
+
description: "Read a testing mission with everything it holds \u2014 its brief, state, documentation answer and every source attached to it \u2014 before planning or continuing the work on it." + measuredCost("plune_mission_get"),
|
|
13994
14465
|
input: import_zod5.z.strictObject({ missionId }),
|
|
13995
14466
|
output: import_zod5.z.object({ mission: entity }),
|
|
13996
14467
|
write: false,
|
|
@@ -14288,8 +14759,10 @@ function errorOf(err) {
|
|
|
14288
14759
|
return { status: 401, code: "token_rejected", message: `Plune rejected the token (401): ${err.message}. Run \`plune login\` or set PLUNE_TOKEN to a live token.` };
|
|
14289
14760
|
if (err.status === 403 && err.message === READ_ONLY_REFUSAL)
|
|
14290
14761
|
return { status: 403, code: "read_only_token", message: `Plune refused (403): ${readScopeMessage("it cannot write")}` };
|
|
14291
|
-
const
|
|
14292
|
-
|
|
14762
|
+
const quota = err.status === 429 && asRecord(err.body)["quota"] !== void 0;
|
|
14763
|
+
const code = err.code ?? (quota ? "quota_exceeded" : `http_${err.status}`);
|
|
14764
|
+
const why = quota ? "a plan limit is reached, not a missing permission \u2014 " : err.status === 403 ? "the token or its user lacks the permission, not a plan limit \u2014 " : "";
|
|
14765
|
+
return { status: err.status, code, message: `Plune refused (${err.status} ${code}): ${why}${err.message}${detailLines(err.body)}`, details: err.body };
|
|
14293
14766
|
}
|
|
14294
14767
|
if (err instanceof PluneNetworkError) return { code: "network", message: `${err.message}. Check PLUNE_API_URL and the network.` };
|
|
14295
14768
|
throw err;
|
|
@@ -14313,7 +14786,6 @@ function createPluneToolExecutor(opts) {
|
|
|
14313
14786
|
let scope = opts.scope;
|
|
14314
14787
|
const revealed = /* @__PURE__ */ new Set();
|
|
14315
14788
|
const confirms = /* @__PURE__ */ new Map();
|
|
14316
|
-
let proposals = 0;
|
|
14317
14789
|
const visibleTools = () => {
|
|
14318
14790
|
const core = defaultVisibleTools(scope);
|
|
14319
14791
|
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
@@ -14432,13 +14904,12 @@ function createPluneToolExecutor(opts) {
|
|
|
14432
14904
|
const stableId = (0, import_node_crypto6.createHash)("sha256").update([c["title"], ...steps, c["expected"]].join("\n")).digest("hex").slice(0, 32);
|
|
14433
14905
|
return withoutUndefined({ stableId, execution: "manual", ...c });
|
|
14434
14906
|
});
|
|
14435
|
-
proposals += 1;
|
|
14436
14907
|
const req = {
|
|
14437
14908
|
method: "POST",
|
|
14438
14909
|
path: "/v1/ingest/cairn",
|
|
14439
14910
|
body: {
|
|
14440
14911
|
schemaVersion: 1,
|
|
14441
|
-
run: withoutUndefined({ runId: `mcp-${sessionId}-${
|
|
14912
|
+
run: withoutUndefined({ runId: `mcp-${sessionId}-${(0, import_node_crypto6.randomUUID)().slice(0, 8)}`, mode: "design", target: str2(i["target"]), missionId: i["missionId"] }),
|
|
14442
14913
|
cases
|
|
14443
14914
|
}
|
|
14444
14915
|
};
|
|
@@ -14573,6 +15044,8 @@ function createPluneToolExecutor(opts) {
|
|
|
14573
15044
|
if (isDeletion(req)) {
|
|
14574
15045
|
const t = now();
|
|
14575
15046
|
for (const [k, v] of confirms) if (v.expires <= t) confirms.delete(k);
|
|
15047
|
+
if (confirm2 === void 0 && opts.oneRequest === true)
|
|
15048
|
+
return fail2("agent_cannot_delete", "Nothing was sent, and it will not be: the platform refuses an agent any deletion. A person deletes in the app.");
|
|
14576
15049
|
if (confirm2 === void 0) {
|
|
14577
15050
|
const value2 = (0, import_node_crypto6.randomBytes)(24).toString("base64url");
|
|
14578
15051
|
confirms.set(value2, { fingerprint: fingerprint(req), expires: t + CONFIRM_TTL_MS });
|
|
@@ -14682,15 +15155,17 @@ function toResult(outcome) {
|
|
|
14682
15155
|
structuredContent: { error: outcome.error }
|
|
14683
15156
|
};
|
|
14684
15157
|
}
|
|
14685
|
-
function createPluneMcpServer(opts, era) {
|
|
15158
|
+
function createPluneMcpServer(opts, era, traits = {}) {
|
|
14686
15159
|
const { version: version2, ...executorOptions } = opts;
|
|
14687
|
-
const
|
|
15160
|
+
const listChanged = traits.listChanged ?? true;
|
|
15161
|
+
const fixed = era === "modern" || !listChanged;
|
|
14688
15162
|
const executor = createPluneToolExecutor({
|
|
14689
15163
|
...executorOptions,
|
|
14690
15164
|
userAgent: executorOptions.userAgent ?? `plune-cli/${version2} mcp`,
|
|
14691
|
-
fixedToolList: fixed
|
|
15165
|
+
fixedToolList: fixed,
|
|
15166
|
+
oneRequest: !listChanged
|
|
14692
15167
|
});
|
|
14693
|
-
const server2 = new import_server.McpServer({ name: "plune", version: version2 }, { capabilities: { tools: { listChanged
|
|
15168
|
+
const server2 = new import_server.McpServer({ name: "plune", version: version2 }, { capabilities: { tools: { listChanged } } });
|
|
14694
15169
|
const registered = /* @__PURE__ */ new Map();
|
|
14695
15170
|
const sync = () => {
|
|
14696
15171
|
const visible2 = new Set(executor.visibleTools());
|
|
@@ -14800,7 +15275,9 @@ var init_server = __esm({
|
|
|
14800
15275
|
annotationsOf = (tool2) => ({
|
|
14801
15276
|
title: tool2.title,
|
|
14802
15277
|
readOnlyHint: !tool2.write,
|
|
14803
|
-
|
|
15278
|
+
// plune_mission_update overwrites fields and can remove the address, plune_cases_update replaces a case's title, tags
|
|
15279
|
+
// and steps whole; the other writers only add.
|
|
15280
|
+
destructiveHint: tool2.name === "plune_api_request" || tool2.name === "plune_mission_update" || tool2.name === "plune_cases_update",
|
|
14804
15281
|
openWorldHint: false
|
|
14805
15282
|
});
|
|
14806
15283
|
listed = (tool2) => ({
|
|
@@ -15101,161 +15578,6 @@ var init_model = __esm({
|
|
|
15101
15578
|
}
|
|
15102
15579
|
});
|
|
15103
15580
|
|
|
15104
|
-
// src/mcp-testing/lint/thresholds.ts
|
|
15105
|
-
var PLUNE_BUDGET, LINT_THRESHOLDS;
|
|
15106
|
-
var init_thresholds = __esm({
|
|
15107
|
-
"src/mcp-testing/lint/thresholds.ts"() {
|
|
15108
|
-
"use strict";
|
|
15109
|
-
init_cjs_shims();
|
|
15110
|
-
PLUNE_BUDGET = {
|
|
15111
|
-
/** A limit is the measure times (1 + headroom), rounded up. */
|
|
15112
|
-
headroom: 0.1,
|
|
15113
|
-
/** A measure below this share of its limit means the limit is too loose: with 10% headroom a list may shrink ~12%. */
|
|
15114
|
-
tooLooseShare: 0.8,
|
|
15115
|
-
/** Whole tool lists, outputSchema and annotations included. */
|
|
15116
|
-
lists: {
|
|
15117
|
-
/** 2025 era, write scope, as listed first: 17 tools, measured 8429 (8327 before the memory rules of plune_project_context). */
|
|
15118
|
-
writeFirst: 9272,
|
|
15119
|
-
/** 2025 era, write scope, after plune_discover_tools: 22 tools, measured 10841 (10739 before the memory rules). */
|
|
15120
|
-
writeAll: 11926,
|
|
15121
|
-
/** Read scope, either era: 7 tools, measured 2222 (2482 with plune_discover_tools, which a read token is not offered). */
|
|
15122
|
-
read: 2445,
|
|
15123
|
-
/** 2026-07-28 era, write scope: 17 tools, the list does not change after discover; measured 8429 (8327 before the memory rules). */
|
|
15124
|
-
modernWrite: 9272
|
|
15125
|
-
},
|
|
15126
|
-
/** The biggest single tool, plune_strategy_propose, measured 2177. */
|
|
15127
|
-
largestTool: 2395,
|
|
15128
|
-
/**
|
|
15129
|
-
* The text content of an answer, on live answers recorded in plune-budget.fixtures.ts, measured 2026-11-14 with the
|
|
15130
|
-
* text unindented (before, with a two-space indent): the beta demo project of 2026-11-10 (cases in Ukrainian) gives
|
|
15131
|
-
* plune_project_context with 3 projects, 3 suites, no missions 387 (548); plune_cases_search 7678 (10509) for the
|
|
15132
|
-
* whole project of 48 cases (a page of 100 is not reached); plune_review_list of 7 pending entries 695 (895). The demo
|
|
15133
|
-
* has no missions, so plune_mission_get reads a mission with 5 sources captured live on a beta test project on
|
|
15134
|
-
* 2026-11-14: 455 (585; the synthetic mission it replaced measured 476 indented, under its limit of 524).
|
|
15135
|
-
*/
|
|
15136
|
-
answers: { plune_project_context: 426, plune_cases_search: 8446, plune_review_list: 765, plune_mission_get: 501 }
|
|
15137
|
-
};
|
|
15138
|
-
LINT_THRESHOLDS = {
|
|
15139
|
-
description: {
|
|
15140
|
-
/** Shorter than this many characters says too little for a model to choose the tool. */
|
|
15141
|
-
minLength: 40,
|
|
15142
|
-
/** Longer than this many characters costs every request and buries the point. */
|
|
15143
|
-
maxLength: 1e3
|
|
15144
|
-
},
|
|
15145
|
-
names: {
|
|
15146
|
-
/** The specification's length bound for a tool name. */
|
|
15147
|
-
maxLength: 128,
|
|
15148
|
-
/** A naming style is the server's convention when more than this share of its tools use it. */
|
|
15149
|
-
majorityShare: 0.5
|
|
15150
|
-
},
|
|
15151
|
-
similarity: {
|
|
15152
|
-
/** Word-set overlap (Jaccard) of two names, the shared server prefix left out, above which they are confusable. */
|
|
15153
|
-
names: 0.75,
|
|
15154
|
-
/** Word-set overlap of two descriptions above which a model cannot tell the tools apart. */
|
|
15155
|
-
descriptions: 0.6,
|
|
15156
|
-
/** Overlap of two descriptions above which the tools are related enough that "when not to use" matters more. */
|
|
15157
|
-
related: 0.35,
|
|
15158
|
-
/** Words shorter than this are left out of a description's word set. */
|
|
15159
|
-
minWordLength: 3,
|
|
15160
|
-
/** Decimals an overlap is reported with. */
|
|
15161
|
-
decimals: 2,
|
|
15162
|
-
/**
|
|
15163
|
-
* Tools above which the rules that compare every pair (`tools-similar`, `desc-no-when-not`) do not run and say
|
|
15164
|
-
* `could-not-run`: the work grows with the square of a count the server chooses. Measured 2026-11-10 on one
|
|
15165
|
-
* desktop core, with no two tools alike (the slowest case: no early stop): at 1000 tools the two rules take 0.25 s
|
|
15166
|
-
* with 60-character descriptions and 2.3 s with 1000-character ones (`description.maxLength`); at 4000 short ones,
|
|
15167
|
-
* 4.5 s. Well above the tool lists of real servers, which hold tens to hundreds.
|
|
15168
|
-
*/
|
|
15169
|
-
maxTools: 1e3
|
|
15170
|
-
},
|
|
15171
|
-
schema: {
|
|
15172
|
-
/**
|
|
15173
|
-
* Levels an input schema may nest (a named property, or an array's items, is one level below the node it is in)
|
|
15174
|
-
* for the rules that read every node of it (`required-unknown-property`, `param-example-missing`); deeper, they
|
|
15175
|
-
* say `could-not-run` for the tool. The server chooses the depth, and a node's path is as long as its depth.
|
|
15176
|
-
* Hand-written and generated schemas nest to about 10-20 levels; 64 leaves three times that, and is the number
|
|
15177
|
-
* the `--call` path stops copying an output schema at (counted there in JSON levels, two to a property).
|
|
15178
|
-
* Measured 2026-11-10 on one desktop core: the two rules take 0.03 ms on a chain exactly 64 levels deep (0.09 ms
|
|
15179
|
-
* with two siblings and an array at every level), and stop within 0.2 ms on a chain of 100 000 levels. The
|
|
15180
|
-
* recursive walk this replaced overflowed the call stack at 10 000 levels.
|
|
15181
|
-
*/
|
|
15182
|
-
maxDepth: 64
|
|
15183
|
-
},
|
|
15184
|
-
size: {
|
|
15185
|
-
/**
|
|
15186
|
-
* Estimated tokens of the whole visible tool list above which the list is reported: the limit of our own biggest
|
|
15187
|
-
* list (`budget.lists.writeAll`), so a server that costs more than all of ours is told so.
|
|
15188
|
-
*/
|
|
15189
|
-
maxListTokens: PLUNE_BUDGET.lists.writeAll,
|
|
15190
|
-
/**
|
|
15191
|
-
* The estimate: characters of a tool's JSON divided by this, rounded up, summed over the tools. No tokenizer, no
|
|
15192
|
-
* network, the same number in CI on every run; a limit is a measure plus headroom, never an exact token count.
|
|
15193
|
-
* Calibrated 2026-11-10 against a provider's token-counting endpoint on two current models (both gave the same
|
|
15194
|
-
* counts): the estimate is low. On the same JSON (name, description, input schema: the fields a model API takes) a
|
|
15195
|
-
* tool list costs 1.57-1.72 times the estimate, the tool-use preamble of ~320 tokens left out; the largest live
|
|
15196
|
-
* answer (JSON with Ukrainian text) 1.84 times. The limits stay in estimated tokens; for real tokens multiply by
|
|
15197
|
-
* ~1.7 (English JSON) to ~1.85 (Cyrillic). Table: docs/features/mcp-context-budget/budget.md.
|
|
15198
|
-
*/
|
|
15199
|
-
charsPerToken: 4,
|
|
15200
|
-
budget: PLUNE_BUDGET
|
|
15201
|
-
},
|
|
15202
|
-
call: {
|
|
15203
|
-
/**
|
|
15204
|
-
* Estimated tokens of one `tools/call` result (its JSON, as the client receives it) above which the answer is
|
|
15205
|
-
* reported: the limit of our own biggest answer (`budget.answers.plune_cases_search`), as `maxListTokens` is for
|
|
15206
|
-
* the list.
|
|
15207
|
-
*/
|
|
15208
|
-
maxResultTokens: PLUNE_BUDGET.answers.plune_cases_search
|
|
15209
|
-
},
|
|
15210
|
-
language: {
|
|
15211
|
-
/**
|
|
15212
|
-
* A text is taken to be in a listed language when at least this many of its stop words occur; two, so a lone
|
|
15213
|
-
* "a" or "in" of another Latin-script language does not pass for English.
|
|
15214
|
-
*/
|
|
15215
|
-
minStopwords: 2
|
|
15216
|
-
},
|
|
15217
|
-
/** Name words that say a tool returns a list, so it should take a page size or cursor. */
|
|
15218
|
-
listVerbs: ["list", "search", "find", "query", "browse"],
|
|
15219
|
-
/** Parameter names that page a list. */
|
|
15220
|
-
pagingParams: ["limit", "cursor", "page", "offset", "pagesize", "perpage", "per_page", "page_size", "pagetoken", "page_token"],
|
|
15221
|
-
/** Name words of a tool that changes something; a read-only hint on such a tool contradicts its name. */
|
|
15222
|
-
writeVerbs: ["create", "add", "update", "edit", "delete", "remove", "set", "write", "put", "patch", "insert", "replace", "send"],
|
|
15223
|
-
/** Name words of a tool that overwrites or removes, which is not an "additive only" update. */
|
|
15224
|
-
overwriteVerbs: ["update", "edit", "set", "replace", "delete", "remove", "overwrite", "patch", "clear", "reset", "rename", "move"],
|
|
15225
|
-
/** Parameter name words that say the value is not free text. Booleans only by the first word (`isActive`). */
|
|
15226
|
-
typedParamWords: {
|
|
15227
|
-
number: ["count", "limit", "max", "min", "size", "offset", "total", "amount", "number", "port", "timeout", "retries", "quantity", "index"],
|
|
15228
|
-
boolean: ["is", "has", "can", "should", "allow", "enable", "enabled"],
|
|
15229
|
-
date: ["date", "time", "timestamp", "since", "until", "deadline"],
|
|
15230
|
-
url: ["url", "uri", "href", "link", "endpoint", "website"]
|
|
15231
|
-
},
|
|
15232
|
-
/**
|
|
15233
|
-
* Words by language. `script` is the alphabet the language is written in; `letters`, when given, are letters the
|
|
15234
|
-
* language has and its neighbours in the same alphabet do not, so a Russian text is not read as Ukrainian.
|
|
15235
|
-
* Phrases match at the start of a word, so a stem (`не використов`) covers its inflected forms.
|
|
15236
|
-
*/
|
|
15237
|
-
languages: {
|
|
15238
|
-
en: {
|
|
15239
|
-
script: "Latin",
|
|
15240
|
-
letters: "",
|
|
15241
|
-
stopwords: ["the", "a", "an", "to", "of", "and", "or", "is", "are", "in", "for", "with", "it", "its", "as", "at", "be", "not", "can", "you", "your", "this", "that", "them", "by", "on", "from", "if", "when", "each"],
|
|
15242
|
-
whenNot: ["do not", "don't", "instead", "rather than", "only", "not for", "avoid", "never"],
|
|
15243
|
-
example: ["e.g.", "for example", "for instance", "such as", "example"],
|
|
15244
|
-
closedSet: ["one of", "either"]
|
|
15245
|
-
},
|
|
15246
|
-
uk: {
|
|
15247
|
-
script: "Cyrillic",
|
|
15248
|
-
letters: "\u0456\u0457\u0454\u0491",
|
|
15249
|
-
stopwords: ["\u0456", "\u0439", "\u0442\u0430", "\u0432", "\u0443", "\u043D\u0430", "\u0437", "\u0456\u0437", "\u0449\u043E", "\u0446\u0435", "\u0434\u043E", "\u043D\u0435", "\u0434\u043B\u044F", "\u044F\u043A", "\u0430\u0431\u043E", "\u043A\u043E\u043B\u0438", "\u0439\u043E\u0433\u043E", "\u0457\u0457", "\u0432\u0456\u0434"],
|
|
15250
|
-
whenNot: ["\u043D\u0435 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432", "\u043D\u0435 \u0432\u0438\u043A\u043B\u0438\u043A", "\u043D\u0435 \u0437\u0430\u0441\u0442\u043E\u0441\u043E\u0432", "\u0437\u0430\u043C\u0456\u0441\u0442\u044C", "\u043B\u0438\u0448\u0435", "\u0442\u0456\u043B\u044C\u043A\u0438", "\u043D\u0435 \u0434\u043B\u044F", "\u043D\u0456\u043A\u043E\u043B\u0438"],
|
|
15251
|
-
example: ["\u043D\u0430\u043F\u0440\u0438\u043A\u043B\u0430\u0434", "\u043D\u0430\u043F\u0440.", "\u043F\u0440\u0438\u043A\u043B\u0430\u0434", "\u0437\u043E\u043A\u0440\u0435\u043C\u0430"],
|
|
15252
|
-
closedSet: ["\u043E\u0434\u043D\u0435 \u0437", "\u043E\u0434\u0438\u043D \u0437", "\u043E\u0434\u043D\u0430 \u0437", "\u043E\u0434\u043D\u0435 \u0456\u0437", "\u043E\u0434\u0438\u043D \u0456\u0437", "\u043E\u0434\u043D\u0430 \u0456\u0437"]
|
|
15253
|
-
}
|
|
15254
|
-
}
|
|
15255
|
-
};
|
|
15256
|
-
}
|
|
15257
|
-
});
|
|
15258
|
-
|
|
15259
15581
|
// src/mcp-testing/lint/size.ts
|
|
15260
15582
|
function jsonText(value2) {
|
|
15261
15583
|
if (typeof value2 !== "object" || value2 === null) return JSON.stringify(value2);
|
|
@@ -18338,7 +18660,7 @@ function parseLock(raw) {
|
|
|
18338
18660
|
return parsed4;
|
|
18339
18661
|
}
|
|
18340
18662
|
function asSnapshot(transport, s) {
|
|
18341
|
-
const
|
|
18663
|
+
const strip2 = (list3) => list3 === null ? null : list3.map(contentOf);
|
|
18342
18664
|
return {
|
|
18343
18665
|
kind: SNAPSHOT_KIND,
|
|
18344
18666
|
schemaVersion: SNAPSHOT_SCHEMA_VERSION,
|
|
@@ -18346,10 +18668,10 @@ function asSnapshot(transport, s) {
|
|
|
18346
18668
|
server: null,
|
|
18347
18669
|
instructions: null,
|
|
18348
18670
|
capabilities: null,
|
|
18349
|
-
tools:
|
|
18671
|
+
tools: strip2(s.tools),
|
|
18350
18672
|
resources: null,
|
|
18351
|
-
resourceTemplates:
|
|
18352
|
-
prompts:
|
|
18673
|
+
resourceTemplates: strip2(s.resourceTemplates),
|
|
18674
|
+
prompts: strip2(s.prompts)
|
|
18353
18675
|
};
|
|
18354
18676
|
}
|
|
18355
18677
|
function modelTexts(section, entries2) {
|
|
@@ -35767,7 +36089,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
35767
36089
|
if (!/^\d+$/.test(v) || Number(v) > 86400) throw new import_commander.InvalidArgumentError("a whole number of seconds from 0 to 86400.");
|
|
35768
36090
|
return Number(v);
|
|
35769
36091
|
}
|
|
35770
|
-
).option("--fail-on-failures", FAIL_ON_FAILURES, false).
|
|
36092
|
+
).option("--fail-on-failures", FAIL_ON_FAILURES, false).addHelpText(
|
|
36093
|
+
"after",
|
|
36094
|
+
"\nA failures-only Playwright JSON report (onlyFailures, or PLAYWRIGHT_JSON_ONLY_FAILURES=1) holds only the tests that failed or were flaky: it is imported as usual, PLUNE_FULL_RUN is ignored for it (no case is detached), and an empty one means nothing failed - the import says so and exits 0 without a run."
|
|
36095
|
+
).action(
|
|
35771
36096
|
async (file, options, command) => {
|
|
35772
36097
|
const [
|
|
35773
36098
|
{ handleRunImport: handleRunImport2 },
|