@plune-ai/cli 0.39.7 → 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 +32 -0
- package/dist/cli.cjs +234 -191
- package/dist/index.cjs +171 -156
- package/dist/index.js +171 -156
- package/dist/mcp-http.cjs +3 -1
- package/dist/mcp-http.js +3 -1
- package/dist/reporter-core.cjs +4 -4
- package/dist/reporter-core.d.cts +5 -0
- package/dist/reporter-core.d.ts +5 -0
- package/dist/reporter-core.js +4 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -343,6 +343,38 @@ elsewhere, a link that points outside) is refused with the same line, and the fi
|
|
|
343
343
|
Console output kept per suite rather than per test (`jest-junit`) names no test, so nothing is read from it.
|
|
344
344
|
For Jest, use Allure below.
|
|
345
345
|
|
|
346
|
+
### A trace link per result
|
|
347
|
+
|
|
348
|
+
A result can carry the link to its trace in your own observability (a Langfuse or OTel trace): Plune keeps
|
|
349
|
+
the link with the result, never the trace itself. A JUnit report gives it as a property of
|
|
350
|
+
the test case, and a Playwright JSON report as a `PluneTrace` annotation, named as `PluneId` is:
|
|
351
|
+
|
|
352
|
+
```xml
|
|
353
|
+
<testcase classname="shop.Checkout" name="pays by card">
|
|
354
|
+
<properties>
|
|
355
|
+
<property name="plune.trace.url" value="https://langfuse.example.com/project/shop/traces/7f3c2a"/>
|
|
356
|
+
</properties>
|
|
357
|
+
</testcase>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
test('pays by card', async () => {
|
|
362
|
+
// a static link can also go in the test's details: { annotation: { type: 'PluneTrace', description: url } }
|
|
363
|
+
test.info().annotations.push({ type: 'PluneTrace', description: traceUrl });
|
|
364
|
+
});
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
In Playwright JSON each attempt's own annotation wins, so a retry keeps its own trace. Playwright's
|
|
368
|
+
`junit` reporter writes an annotation as a property of the same name, `<property name="PluneTrace" …/>`,
|
|
369
|
+
and a JUnit import reads that too, so the same `PluneTrace` annotation works through either reporter.
|
|
370
|
+
A test case that carries both properties sends `plune.trace.url`. The link is trimmed; one the platform would refuse
|
|
371
|
+
(not `https://`, no host, a user name or password, a space or control character, over 2048
|
|
372
|
+
characters) is not sent, the result is sent without it, and the import says so:
|
|
373
|
+
|
|
374
|
+
```text
|
|
375
|
+
plune: "checkout › refuses an expired card": trace link not sent (must be an https address) — the result is imported without it.
|
|
376
|
+
```
|
|
377
|
+
|
|
346
378
|
### An `allure-results` folder
|
|
347
379
|
|
|
348
380
|
Every Allure adapter (pytest, JUnit 5, TestNG, Playwright, Cypress, Jest, Vitest, WebdriverIO, .NET) writes
|
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;
|
|
@@ -3590,13 +3603,11 @@ async function runAgentRow(p) {
|
|
|
3590
3603
|
const clean3 = cleaned.get(c);
|
|
3591
3604
|
if (out.result === void 0 || clean3 === void 0) return;
|
|
3592
3605
|
const whole = Buffer.from(mask?.text(clean3.text) ?? clean3.text, "utf8");
|
|
3593
|
-
const keep =
|
|
3606
|
+
const keep = Buffer.byteLength(out.result.text, "utf8");
|
|
3594
3607
|
out.result = {
|
|
3595
3608
|
...out.result,
|
|
3596
|
-
text: keep < whole.length ? firstBytes(whole, keep) : whole.toString("utf8")
|
|
3597
|
-
truncated: out.result.truncated || keep < whole.length
|
|
3609
|
+
text: out.result.truncated && keep < whole.length ? firstBytes(whole, keep) : whole.toString("utf8")
|
|
3598
3610
|
};
|
|
3599
|
-
if (out.result.truncated) agent.collection = "partial";
|
|
3600
3611
|
if (clean3.unread === void 0) return;
|
|
3601
3612
|
const u = unread.get(c.name) ?? { steps: /* @__PURE__ */ new Set(), count: 0, why: clean3.unread };
|
|
3602
3613
|
u.steps.add(s.index);
|
|
@@ -9559,8 +9570,8 @@ function textRefusal(bytes) {
|
|
|
9559
9570
|
return void 0;
|
|
9560
9571
|
}
|
|
9561
9572
|
function withoutTargets(result2) {
|
|
9562
|
-
if (result2.targets === void 0) return result2;
|
|
9563
|
-
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;
|
|
9564
9575
|
return rest;
|
|
9565
9576
|
}
|
|
9566
9577
|
function onDisk(deferred) {
|
|
@@ -10395,8 +10406,8 @@ async function startRun(passed2, declared2) {
|
|
|
10395
10406
|
{ results: results4, ...configuration !== void 0 ? { configuration } : {} }
|
|
10396
10407
|
);
|
|
10397
10408
|
let out = await post(part);
|
|
10398
|
-
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0)) {
|
|
10399
|
-
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.");
|
|
10400
10411
|
targetsRefused = true;
|
|
10401
10412
|
part = part.map(withoutTargets);
|
|
10402
10413
|
out = await post(part);
|
|
@@ -11965,6 +11976,23 @@ var init_allure = __esm({
|
|
|
11965
11976
|
}
|
|
11966
11977
|
});
|
|
11967
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
|
+
|
|
11968
11996
|
// src/importers/xml.ts
|
|
11969
11997
|
function decode(raw) {
|
|
11970
11998
|
if (!raw.includes("&")) return raw;
|
|
@@ -12117,6 +12145,9 @@ var init_xml = __esm({
|
|
|
12117
12145
|
});
|
|
12118
12146
|
|
|
12119
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
|
+
}
|
|
12120
12151
|
function targetsOf(test) {
|
|
12121
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));
|
|
12122
12153
|
return [...new Set(values)].slice(0, TARGETS.max);
|
|
@@ -12200,6 +12231,7 @@ function readJUnit(source, file, missing = [], notes = [], now = /* @__PURE__ */
|
|
|
12200
12231
|
const rkey = resultKey(key.value, 0);
|
|
12201
12232
|
const files = filesOfTest(test, folder, title, missing, { lexical, resultKey: rkey, notes });
|
|
12202
12233
|
const targets = targetsOf(test);
|
|
12234
|
+
const traceUrl = traceUrlOf(propertyOf(test, TRACE_PROPERTY) ?? propertyOf(test, PLAYWRIGHT_TRACE_PROPERTY), title, notes);
|
|
12203
12235
|
return {
|
|
12204
12236
|
resultKey: rkey,
|
|
12205
12237
|
...stated !== void 0 ? { testCaseId: stated } : {},
|
|
@@ -12211,25 +12243,29 @@ function readJUnit(source, file, missing = [], notes = [], now = /* @__PURE__ */
|
|
|
12211
12243
|
...execution !== void 0 ? { execution } : {},
|
|
12212
12244
|
...errorContext !== "" ? { errorContext } : {},
|
|
12213
12245
|
...files.length > 0 ? { files } : {},
|
|
12214
|
-
...targets.length > 0 ? { targets } : {}
|
|
12246
|
+
...targets.length > 0 ? { targets } : {},
|
|
12247
|
+
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
12215
12248
|
};
|
|
12216
12249
|
});
|
|
12217
12250
|
}
|
|
12218
12251
|
function looksLikeJUnit(source) {
|
|
12219
12252
|
return /<\s*testsuites?\b/.test(source.slice(0, 4096));
|
|
12220
12253
|
}
|
|
12221
|
-
var SOURCE2, TOKEN2, SPEC_FILE, TARGET_PROPERTY, TARGETS, CONTROL;
|
|
12254
|
+
var SOURCE2, TOKEN2, SPEC_FILE, TARGET_PROPERTY, TRACE_PROPERTY, PLAYWRIGHT_TRACE_PROPERTY, TARGETS, CONTROL;
|
|
12222
12255
|
var init_junit = __esm({
|
|
12223
12256
|
"src/importers/junit.ts"() {
|
|
12224
12257
|
"use strict";
|
|
12225
12258
|
init_cjs_shims();
|
|
12226
12259
|
init_result_key();
|
|
12227
12260
|
init_attachments();
|
|
12261
|
+
init_trace_url();
|
|
12228
12262
|
init_xml();
|
|
12229
12263
|
SOURCE2 = "junit";
|
|
12230
12264
|
TOKEN2 = /@P([A-Za-z0-9_-]+)/;
|
|
12231
12265
|
SPEC_FILE = /\.(?:spec|test)\.[cm]?[jt]sx?$/;
|
|
12232
12266
|
TARGET_PROPERTY = "plune.mcp.tool";
|
|
12267
|
+
TRACE_PROPERTY = "plune.trace.url";
|
|
12268
|
+
PLAYWRIGHT_TRACE_PROPERTY = "PluneTrace";
|
|
12233
12269
|
TARGETS = { max: 50, length: 200 };
|
|
12234
12270
|
CONTROL = /[\u0000-\u001f\u007f-\u009f]/;
|
|
12235
12271
|
}
|
|
@@ -12277,6 +12313,8 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
12277
12313
|
const pathTitle = [file, ...titles].join("#");
|
|
12278
12314
|
const seed = test.id ?? pathTitle;
|
|
12279
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);
|
|
12280
12318
|
const expected = test.expectedStatus;
|
|
12281
12319
|
const attempt = attemptOf(result2, file, ctx);
|
|
12282
12320
|
const errorContext = errorContextFields(attempt);
|
|
@@ -12313,7 +12351,8 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
12313
12351
|
} : {},
|
|
12314
12352
|
...errorContext,
|
|
12315
12353
|
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
12316
|
-
...files.length > 0 ? { files } : {}
|
|
12354
|
+
...files.length > 0 ? { files } : {},
|
|
12355
|
+
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
12317
12356
|
};
|
|
12318
12357
|
}
|
|
12319
12358
|
function walk2(suite, describes, depth, ctx, out) {
|
|
@@ -12327,7 +12366,7 @@ function walk2(suite, describes, depth, ctx, out) {
|
|
|
12327
12366
|
}
|
|
12328
12367
|
for (const child of suite.suites ?? []) walk2(child, here, depth + 1, ctx, out);
|
|
12329
12368
|
}
|
|
12330
|
-
function readPlaywrightJson(source, file) {
|
|
12369
|
+
function readPlaywrightJson(source, file, notes = []) {
|
|
12331
12370
|
let parsed4;
|
|
12332
12371
|
try {
|
|
12333
12372
|
parsed4 = JSON.parse(source);
|
|
@@ -12343,6 +12382,7 @@ function readPlaywrightJson(source, file) {
|
|
|
12343
12382
|
const buildHref = config?.metadata?.ci?.buildHref;
|
|
12344
12383
|
const repoRoot = rootDir !== void 0 && (0, import_node_fs10.existsSync)(rootDir) ? repoRootOf(rootDir) : void 0;
|
|
12345
12384
|
const ctx = {
|
|
12385
|
+
notes,
|
|
12346
12386
|
...rootDir !== void 0 ? { rootDir } : {},
|
|
12347
12387
|
...repoRoot !== void 0 ? { repoRoot } : {},
|
|
12348
12388
|
...typeof buildHref === "string" ? { buildHref } : {}
|
|
@@ -12369,6 +12409,7 @@ var init_playwright_json = __esm({
|
|
|
12369
12409
|
import_node_fs10 = require("fs");
|
|
12370
12410
|
init_failure_detail();
|
|
12371
12411
|
init_result_key();
|
|
12412
|
+
init_trace_url();
|
|
12372
12413
|
SOURCE3 = "playwright";
|
|
12373
12414
|
TOKEN3 = /@P([A-Za-z0-9_-]+)/;
|
|
12374
12415
|
NOT_FAILED = /* @__PURE__ */ new Set(["passed", "skipped"]);
|
|
@@ -12664,7 +12705,7 @@ function readReport(source, file, format, options = {}) {
|
|
|
12664
12705
|
if (chosen2 === "lighthouse") {
|
|
12665
12706
|
return { format: chosen2, results: readLighthouse(source, file, options.minScores), missing, notes };
|
|
12666
12707
|
}
|
|
12667
|
-
return { format: chosen2, ...readPlaywrightJson(source, file), missing, notes };
|
|
12708
|
+
return { format: chosen2, ...readPlaywrightJson(source, file, notes), missing, notes };
|
|
12668
12709
|
}
|
|
12669
12710
|
var path16, IMPORT_FORMATS, UnknownFormatError;
|
|
12670
12711
|
var init_importers = __esm({
|
|
@@ -15234,7 +15275,9 @@ var init_server = __esm({
|
|
|
15234
15275
|
annotationsOf = (tool2) => ({
|
|
15235
15276
|
title: tool2.title,
|
|
15236
15277
|
readOnlyHint: !tool2.write,
|
|
15237
|
-
|
|
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",
|
|
15238
15281
|
openWorldHint: false
|
|
15239
15282
|
});
|
|
15240
15283
|
listed = (tool2) => ({
|