@plune-ai/cli 0.39.5 → 0.39.7
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 +31 -0
- package/dist/cli.cjs +478 -193
- package/dist/execute-CR3Ixbxj.d.cts +944 -0
- package/dist/execute-CR3Ixbxj.d.ts +944 -0
- package/dist/index.cjs +165 -8
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +165 -8
- package/dist/mcp-http.cjs +1291 -0
- package/dist/mcp-http.d.cts +25 -0
- package/dist/mcp-http.d.ts +25 -0
- package/dist/mcp-http.js +1266 -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 +47 -0
- package/dist/reporter-core.d.cts +5 -0
- package/dist/reporter-core.d.ts +5 -0
- package/dist/reporter-core.js +47 -0
- package/package.json +7 -1
- package/skills/plune/SKILL.md +23 -0
package/dist/cli.cjs
CHANGED
|
@@ -1039,7 +1039,7 @@ function readHeader(headers, name) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
async function withRetry(fn, options) {
|
|
1041
1041
|
const { base_delay_ms = 500, sleep: sleep4 = defaultSleep, random = Math.random } = options;
|
|
1042
|
-
const maxRetries = Math.max(0, Math.floor(options.max_retries));
|
|
1042
|
+
const maxRetries = Number.isFinite(options.max_retries) ? Math.max(0, Math.floor(options.max_retries)) : 0;
|
|
1043
1043
|
let attempt = 0;
|
|
1044
1044
|
for (; ; ) {
|
|
1045
1045
|
try {
|
|
@@ -2930,14 +2930,17 @@ var init_classes = __esm({
|
|
|
2930
2930
|
function buildJudge(provider, cfg, onUsage) {
|
|
2931
2931
|
return {
|
|
2932
2932
|
async ask(prompt5) {
|
|
2933
|
+
const maxTokens = cfg.max_tokens ?? DEFAULT_MAX_TOKENS;
|
|
2933
2934
|
const res = await provider.complete({
|
|
2934
2935
|
provider: cfg.type,
|
|
2935
2936
|
model: cfg.model,
|
|
2936
2937
|
...cfg.temperature !== void 0 ? { temperature: cfg.temperature } : {},
|
|
2937
|
-
max_tokens:
|
|
2938
|
+
max_tokens: maxTokens,
|
|
2938
2939
|
prompt_resolved: prompt5
|
|
2939
2940
|
});
|
|
2940
2941
|
onUsage(res.usage);
|
|
2942
|
+
if (res.finish_reason === "length")
|
|
2943
|
+
throw new Error(`judge reply was cut off at max_tokens (${maxTokens}); raise max_tokens for the judge model`);
|
|
2941
2944
|
return res.output;
|
|
2942
2945
|
}
|
|
2943
2946
|
};
|
|
@@ -3137,6 +3140,54 @@ function scanIds(result2) {
|
|
|
3137
3140
|
values: [...found.values].map(([hash, at2]) => ({ hash, paths: [...at2].sort() }))
|
|
3138
3141
|
};
|
|
3139
3142
|
}
|
|
3143
|
+
function strip(value2, depth, st) {
|
|
3144
|
+
if (typeof value2 === "string") return redactUuids(value2);
|
|
3145
|
+
if (depth > SCAN_DEPTH) {
|
|
3146
|
+
if (typeof value2 === "object" && value2 !== null) st.whole = false;
|
|
3147
|
+
return value2;
|
|
3148
|
+
}
|
|
3149
|
+
if (Array.isArray(value2)) {
|
|
3150
|
+
if (value2.length > SCAN_ITEMS) st.whole = false;
|
|
3151
|
+
return value2.map((v, i) => i < SCAN_ITEMS ? strip(v, depth + 1, st) : v);
|
|
3152
|
+
}
|
|
3153
|
+
if (!isRecord3(value2)) return value2;
|
|
3154
|
+
const out = {};
|
|
3155
|
+
for (const [key, v] of Object.entries(value2)) {
|
|
3156
|
+
let name = redactUuids(key);
|
|
3157
|
+
for (let n = 2; name !== key && Object.hasOwn(out, name); n++) name = `${ID_MARK}#${n}`;
|
|
3158
|
+
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);
|
|
3159
|
+
}
|
|
3160
|
+
return out;
|
|
3161
|
+
}
|
|
3162
|
+
function redactIds(value2) {
|
|
3163
|
+
const st = { whole: true };
|
|
3164
|
+
return { value: strip(value2, 0, st), whole: st.whole };
|
|
3165
|
+
}
|
|
3166
|
+
function redactAnswer(result2) {
|
|
3167
|
+
let unread;
|
|
3168
|
+
const ids = (v) => {
|
|
3169
|
+
const r = redactIds(v);
|
|
3170
|
+
if (!r.whole)
|
|
3171
|
+
unread ??= `the answer is deeper than ${SCAN_DEPTH} levels or has more than ${SCAN_ITEMS} items in a list`;
|
|
3172
|
+
return r.value;
|
|
3173
|
+
};
|
|
3174
|
+
if (!isRecord3(result2))
|
|
3175
|
+
return { result: ids(result2), ...unread !== void 0 ? { unread } : {} };
|
|
3176
|
+
const out = { ...result2 };
|
|
3177
|
+
if (result2.structuredContent !== void 0) out.structuredContent = ids(result2.structuredContent);
|
|
3178
|
+
if (Array.isArray(result2.content))
|
|
3179
|
+
out.content = result2.content.map((block2) => {
|
|
3180
|
+
if (!isRecord3(block2) || block2.type !== "text" || typeof block2.text !== "string")
|
|
3181
|
+
return ids(block2);
|
|
3182
|
+
try {
|
|
3183
|
+
return { ...block2, text: JSON.stringify(ids(JSON.parse(block2.text))) };
|
|
3184
|
+
} catch {
|
|
3185
|
+
unread ??= "the answer is not JSON";
|
|
3186
|
+
return { ...block2, text: redactUuids(block2.text) };
|
|
3187
|
+
}
|
|
3188
|
+
});
|
|
3189
|
+
return { result: out, ...unread !== void 0 ? { unread } : {} };
|
|
3190
|
+
}
|
|
3140
3191
|
function frictionAdvice(calls) {
|
|
3141
3192
|
const acc = /* @__PURE__ */ new Map();
|
|
3142
3193
|
const add = (type, tool2, steps, paths = [], note2) => {
|
|
@@ -3214,7 +3265,7 @@ function frictionAdvice(calls) {
|
|
|
3214
3265
|
};
|
|
3215
3266
|
});
|
|
3216
3267
|
}
|
|
3217
|
-
var SCAN_DEPTH, SCAN_ITEMS, MAX_PATHS, MAX_PATH, MIN_VALUE, WORDS, WHOLE, SNAKE, CAMEL, UUID, isIdKey, isRecord3, isScalar, EMAIL, cap, hashOf, list;
|
|
3268
|
+
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
3269
|
var init_friction = __esm({
|
|
3219
3270
|
"src/orchestrator/friction.ts"() {
|
|
3220
3271
|
"use strict";
|
|
@@ -3237,6 +3288,22 @@ var init_friction = __esm({
|
|
|
3237
3288
|
EMAIL = /@/;
|
|
3238
3289
|
cap = (path25) => path25.length > MAX_PATH ? path25.slice(0, MAX_PATH) : path25;
|
|
3239
3290
|
hashOf = (v) => sha256(v).slice(0, 16);
|
|
3291
|
+
ID_MARK = "<id>";
|
|
3292
|
+
UUID_IN_TEXT = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
|
|
3293
|
+
redactUuids = (text6) => text6.replace(UUID_IN_TEXT, ID_MARK);
|
|
3294
|
+
STR = String.raw`"(?:[^"\\]|\\.)*?(?:"|(?= \(cut\)))`;
|
|
3295
|
+
NUM = String.raw`-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?`;
|
|
3296
|
+
VAL = `(?:${STR}|${NUM})`;
|
|
3297
|
+
PAIR = new RegExp(
|
|
3298
|
+
String.raw`"((?:[^"\\]|\\.)*)":(${VAL}|\[(?:${VAL}(?:,${VAL})*)?(?:\]|(?= \(cut\))))`,
|
|
3299
|
+
"g"
|
|
3300
|
+
);
|
|
3301
|
+
redactReason = (text6) => redactUuids(
|
|
3302
|
+
text6.replace(
|
|
3303
|
+
PAIR,
|
|
3304
|
+
(whole, key) => isIdKey(key) ? `"${key}":${JSON.stringify(ID_MARK)}` : whole
|
|
3305
|
+
)
|
|
3306
|
+
);
|
|
3240
3307
|
list = (steps) => steps.join(", ");
|
|
3241
3308
|
}
|
|
3242
3309
|
});
|
|
@@ -3261,7 +3328,7 @@ function excerpts() {
|
|
|
3261
3328
|
left -= keep;
|
|
3262
3329
|
const truncated = keep < whole.length;
|
|
3263
3330
|
if (truncated) state2.any = true;
|
|
3264
|
-
const kept = truncated ? whole
|
|
3331
|
+
const kept = truncated ? firstBytes(whole, keep) : text6;
|
|
3265
3332
|
return { text: kept, bytes: whole.length, truncated };
|
|
3266
3333
|
}
|
|
3267
3334
|
};
|
|
@@ -3315,6 +3382,7 @@ async function runAgentRow(p) {
|
|
|
3315
3382
|
let error;
|
|
3316
3383
|
let session2;
|
|
3317
3384
|
const scanned = /* @__PURE__ */ new Map();
|
|
3385
|
+
const cleaned = /* @__PURE__ */ new Map();
|
|
3318
3386
|
const overrides = p.toolDescriptions ?? {};
|
|
3319
3387
|
const replaced = /* @__PURE__ */ new Set();
|
|
3320
3388
|
try {
|
|
@@ -3460,6 +3528,17 @@ async function runAgentRow(p) {
|
|
|
3460
3528
|
succeeded ||= !rec.is_error;
|
|
3461
3529
|
if (got2.kind === "result" && !rec.is_error) scanned.set(rec, scanIds(got2.result));
|
|
3462
3530
|
rec.result = kept.cut(text6);
|
|
3531
|
+
if (got2.kind === "result") {
|
|
3532
|
+
const r = redactAnswer(got2.result);
|
|
3533
|
+
cleaned.set(rec, {
|
|
3534
|
+
text: resultText(r.result),
|
|
3535
|
+
...r.unread !== void 0 ? { unread: r.unread } : {}
|
|
3536
|
+
});
|
|
3537
|
+
} else
|
|
3538
|
+
cleaned.set(rec, {
|
|
3539
|
+
text: redactUuids(text6),
|
|
3540
|
+
unread: "the answer is an error message, not JSON"
|
|
3541
|
+
});
|
|
3463
3542
|
answer(rec, c, text6);
|
|
3464
3543
|
}
|
|
3465
3544
|
messages.push(
|
|
@@ -3500,8 +3579,46 @@ async function runAgentRow(p) {
|
|
|
3500
3579
|
tool: tool2,
|
|
3501
3580
|
sha256: sha256(overrides[tool2])
|
|
3502
3581
|
}));
|
|
3582
|
+
const storeWithoutIds = (said3 = [], err) => {
|
|
3583
|
+
for (const r of said3) if (r.reason !== void 0) r.reason = redactReason(r.reason);
|
|
3584
|
+
if (err !== void 0) err.message = redactReason(err.message);
|
|
3585
|
+
const unread = /* @__PURE__ */ new Map();
|
|
3586
|
+
transcript.steps.forEach(
|
|
3587
|
+
(s, si) => s.calls.forEach((c, ci) => {
|
|
3588
|
+
const out = agent.steps[si].calls[ci];
|
|
3589
|
+
out.args = redactIds(out.args).value;
|
|
3590
|
+
const clean3 = cleaned.get(c);
|
|
3591
|
+
if (out.result === void 0 || clean3 === void 0) return;
|
|
3592
|
+
const whole = Buffer.from(mask?.text(clean3.text) ?? clean3.text, "utf8");
|
|
3593
|
+
const keep = Math.min(Buffer.byteLength(out.result.text, "utf8"), whole.length);
|
|
3594
|
+
out.result = {
|
|
3595
|
+
...out.result,
|
|
3596
|
+
text: keep < whole.length ? firstBytes(whole, keep) : whole.toString("utf8"),
|
|
3597
|
+
truncated: out.result.truncated || keep < whole.length
|
|
3598
|
+
};
|
|
3599
|
+
if (out.result.truncated) agent.collection = "partial";
|
|
3600
|
+
if (clean3.unread === void 0) return;
|
|
3601
|
+
const u = unread.get(c.name) ?? { steps: /* @__PURE__ */ new Set(), count: 0, why: clean3.unread };
|
|
3602
|
+
u.steps.add(s.index);
|
|
3603
|
+
u.count++;
|
|
3604
|
+
unread.set(c.name, u);
|
|
3605
|
+
})
|
|
3606
|
+
);
|
|
3607
|
+
return [...unread].map(([tool2, u]) => {
|
|
3608
|
+
const steps = [...u.steps].sort((x, y) => x - y);
|
|
3609
|
+
return {
|
|
3610
|
+
type: "ids-not-redacted",
|
|
3611
|
+
tool: tool2,
|
|
3612
|
+
steps,
|
|
3613
|
+
count: u.count,
|
|
3614
|
+
reason: `${tool2}: ${u.why}, so only UUID-shaped values were replaced in its stored answer; other identifiers may remain (steps ${steps.join(", ")})`
|
|
3615
|
+
};
|
|
3616
|
+
});
|
|
3617
|
+
};
|
|
3503
3618
|
const spent = usages.length > 0 ? { usage: sumUsage(usages) } : {};
|
|
3504
3619
|
if (error !== void 0) {
|
|
3620
|
+
const notes = storeWithoutIds();
|
|
3621
|
+
if (notes.length > 0) agent.advice = notes;
|
|
3505
3622
|
return {
|
|
3506
3623
|
vars: p.row.vars,
|
|
3507
3624
|
output: null,
|
|
@@ -3522,7 +3639,11 @@ async function runAgentRow(p) {
|
|
|
3522
3639
|
const signals = (mask?.value(friction) ?? friction).filter(
|
|
3523
3640
|
(f) => !(f.type === "identical-retry" && covered.some((c) => c.tool === void 0 || c.tool === f.tool))
|
|
3524
3641
|
);
|
|
3525
|
-
const findings = [
|
|
3642
|
+
const findings = [
|
|
3643
|
+
...advice,
|
|
3644
|
+
...signals,
|
|
3645
|
+
...storeWithoutIds([...records, ...advice], assertionError)
|
|
3646
|
+
];
|
|
3526
3647
|
if (findings.length > 0) agent.advice = findings;
|
|
3527
3648
|
const usage3 = sumUsage(usages);
|
|
3528
3649
|
return {
|
|
@@ -3540,7 +3661,7 @@ async function runAgentRow(p) {
|
|
|
3540
3661
|
agent
|
|
3541
3662
|
};
|
|
3542
3663
|
}
|
|
3543
|
-
var EXCERPT_BYTES, TRANSCRIPT_BYTES, DEFAULT_MAX_TOKENS2, LimitStop, AgentError, isRecord4;
|
|
3664
|
+
var EXCERPT_BYTES, TRANSCRIPT_BYTES, DEFAULT_MAX_TOKENS2, LimitStop, AgentError, isRecord4, firstBytes;
|
|
3544
3665
|
var init_agent = __esm({
|
|
3545
3666
|
"src/orchestrator/agent.ts"() {
|
|
3546
3667
|
"use strict";
|
|
@@ -3567,6 +3688,7 @@ var init_agent = __esm({
|
|
|
3567
3688
|
code;
|
|
3568
3689
|
};
|
|
3569
3690
|
isRecord4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3691
|
+
firstBytes = (whole, keep) => whole.subarray(0, keep).toString("utf8").replace(/�$/, "");
|
|
3570
3692
|
}
|
|
3571
3693
|
});
|
|
3572
3694
|
|
|
@@ -7982,9 +8104,13 @@ function repeatsText(row) {
|
|
|
7982
8104
|
const a = row.attempts;
|
|
7983
8105
|
if (a === void 0) return void 0;
|
|
7984
8106
|
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)}`;
|
|
8107
|
+
return `${a.passed}/${a.runs} passed (pass_threshold ${a.pass_threshold}): ${rowStatus(row)}${flakyText(a)}`;
|
|
8108
|
+
}
|
|
8109
|
+
function flakyText(a) {
|
|
8110
|
+
if (a.passed <= 0 || a.passed >= a.runs) return "";
|
|
8111
|
+
return ` \xB7 flaky ${Number((a.passed / a.runs).toFixed(2))}`;
|
|
7986
8112
|
}
|
|
7987
|
-
var safeLine, mdCell;
|
|
8113
|
+
var safeLine, mdCell, NOT_MEASURED_STABILITY, noRepeats;
|
|
7988
8114
|
var init_helpers = __esm({
|
|
7989
8115
|
"src/reporters/helpers.ts"() {
|
|
7990
8116
|
"use strict";
|
|
@@ -7993,6 +8119,8 @@ var init_helpers = __esm({
|
|
|
7993
8119
|
init_human();
|
|
7994
8120
|
safeLine = (t) => noCommands(t.replace(/\s*[\r\n]+\s*/g, " ").trim());
|
|
7995
8121
|
mdCell = (t) => safeLine(t).replace(/\|/g, "\\|");
|
|
8122
|
+
NOT_MEASURED_STABILITY = "stability: not measured (runs: 1)";
|
|
8123
|
+
noRepeats = (result2) => result2.evals.every((ev) => ev.rows.every((row) => row.attempts === void 0));
|
|
7996
8124
|
}
|
|
7997
8125
|
});
|
|
7998
8126
|
|
|
@@ -8484,6 +8612,7 @@ function renderConsole(result2, opts = {}) {
|
|
|
8484
8612
|
lines.push(
|
|
8485
8613
|
`${passedTxt} \xB7 ${failedTxt} \xB7 ${erroredTxt}${blockedTxt}${skippedTxt} \xB7 ${summary.total} total \xB7 $${summary.cost_usd.toFixed(4)} \xB7 ${summary.duration_ms}ms`
|
|
8486
8614
|
);
|
|
8615
|
+
if (noRepeats(result2)) lines.push(s.dim(NOT_MEASURED_STABILITY));
|
|
8487
8616
|
const c = summary.cache;
|
|
8488
8617
|
if (c !== void 0 && c.from_cache + c.from_model + c.missed > 0) {
|
|
8489
8618
|
const missedTxt = c.missed > 0 ? ` \xB7 ${s.yellow(`${c.missed} missed`)}` : "";
|
|
@@ -8609,6 +8738,7 @@ function renderMarkdown(result2, opts = {}) {
|
|
|
8609
8738
|
out.push(`| Cost (USD) | ${summary.cost_usd.toFixed(4)} |`);
|
|
8610
8739
|
out.push(`| Duration (ms) | ${summary.duration_ms} |`);
|
|
8611
8740
|
out.push("");
|
|
8741
|
+
if (noRepeats(result2)) out.push(NOT_MEASURED_STABILITY, "");
|
|
8612
8742
|
const matrix = buildMatrix(result2);
|
|
8613
8743
|
if (matrix !== void 0) out.push("## Model matrix", "", ...matrixMarkdown2(matrix), "");
|
|
8614
8744
|
const repeated = result2.evals.flatMap(
|
|
@@ -8623,8 +8753,12 @@ function renderMarkdown(result2, opts = {}) {
|
|
|
8623
8753
|
out.push("| --- | --- | --- | --- | --- |");
|
|
8624
8754
|
for (const { id: id2, row, a } of repeated) {
|
|
8625
8755
|
const vars = JSON.stringify(row.vars).replace(/\|/g, "\\|");
|
|
8626
|
-
const
|
|
8627
|
-
|
|
8756
|
+
const dry = a.results.length === 0;
|
|
8757
|
+
const passed2 = dry ? `dry run \xD7 ${a.runs}` : `${a.passed}/${a.runs}`;
|
|
8758
|
+
const flaky = dry ? "" : flakyText(a);
|
|
8759
|
+
out.push(
|
|
8760
|
+
`| ${mdCell(id2)} | ${vars} | ${passed2} | ${a.pass_threshold} | ${rowStatus(row)}${flaky} |`
|
|
8761
|
+
);
|
|
8628
8762
|
}
|
|
8629
8763
|
out.push("");
|
|
8630
8764
|
}
|
|
@@ -9086,6 +9220,7 @@ function readEnv(env = process.env) {
|
|
|
9086
9220
|
...shardError !== void 0 ? { shardError } : {},
|
|
9087
9221
|
...configurationError !== void 0 ? { configurationError } : {},
|
|
9088
9222
|
...importTimeout !== void 0 ? { importTimeout } : {},
|
|
9223
|
+
secretCheck: !["0", "false", "no", "off"].includes(value(env, "PLUNE_SECRET_CHECK")?.toLowerCase() ?? ""),
|
|
9089
9224
|
ignored: UNSUPPORTED_VARS.filter((name) => value(env, name) !== void 0),
|
|
9090
9225
|
warnings
|
|
9091
9226
|
};
|
|
@@ -9287,6 +9422,30 @@ function maskCredentials(text6) {
|
|
|
9287
9422
|
"$1$2\u2039credential\u203A"
|
|
9288
9423
|
).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
9424
|
}
|
|
9425
|
+
function credentialsIn(text6) {
|
|
9426
|
+
const masked = maskCredentials(text6);
|
|
9427
|
+
if (masked === text6) return [];
|
|
9428
|
+
const found = [];
|
|
9429
|
+
let from = 0;
|
|
9430
|
+
let at2 = 0;
|
|
9431
|
+
for (let open2 = masked.indexOf("\u2039", at2); open2 >= 0; open2 = masked.indexOf("\u2039", at2)) {
|
|
9432
|
+
const start2 = from + (open2 - at2);
|
|
9433
|
+
let close = masked.indexOf("\u203A", open2);
|
|
9434
|
+
while (close >= 0 && masked[close + 1] === "\u2039") close = masked.indexOf("\u203A", close + 1);
|
|
9435
|
+
if (close < 0) break;
|
|
9436
|
+
const next = masked.indexOf("\u2039", close + 1);
|
|
9437
|
+
const tail = masked.slice(close + 1, next < 0 ? void 0 : next);
|
|
9438
|
+
const end2 = next < 0 ? text6.length - tail.length : text6.indexOf(tail, start2);
|
|
9439
|
+
if (end2 < start2) break;
|
|
9440
|
+
const marker = masked.slice(open2, close + 1);
|
|
9441
|
+
if (!(end2 - start2 === marker.length && text6.startsWith(marker, start2))) {
|
|
9442
|
+
found.push({ line: text6.slice(0, start2).split("\n").length, length: end2 - start2 });
|
|
9443
|
+
}
|
|
9444
|
+
from = end2 + tail.length;
|
|
9445
|
+
at2 = close + 1 + tail.length;
|
|
9446
|
+
}
|
|
9447
|
+
return found;
|
|
9448
|
+
}
|
|
9290
9449
|
function snapshotAt(at2, files) {
|
|
9291
9450
|
let source = files.get(at2.file);
|
|
9292
9451
|
if (source === void 0) {
|
|
@@ -10309,6 +10468,27 @@ async function startRun(passed2, declared2) {
|
|
|
10309
10468
|
log(`::warning::${stats.deferred} result(s) were not delivered to Plune \u2014 see the reporting step's log.`);
|
|
10310
10469
|
}
|
|
10311
10470
|
}
|
|
10471
|
+
async function warnOfSecrets(result2) {
|
|
10472
|
+
const of = printable(result2.title ?? result2.resultKey);
|
|
10473
|
+
const say = (what, text6) => {
|
|
10474
|
+
for (const { line, length } of credentialsIn(text6)) {
|
|
10475
|
+
log(
|
|
10476
|
+
`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.`
|
|
10477
|
+
);
|
|
10478
|
+
}
|
|
10479
|
+
};
|
|
10480
|
+
const error = result2.errorContext ?? result2.failure?.headline;
|
|
10481
|
+
if (error !== void 0) say("the error text", error);
|
|
10482
|
+
for (const file of result2.files ?? []) {
|
|
10483
|
+
if (!isTextType(file.contentType)) continue;
|
|
10484
|
+
let bytes = file.body;
|
|
10485
|
+
if (bytes === void 0 && file.path !== void 0) {
|
|
10486
|
+
const size = await import_node_fs9.promises.stat(file.path).then((s) => s.size, () => Infinity);
|
|
10487
|
+
if (size <= TEXT_BYTES) bytes = await import_node_fs9.promises.readFile(file.path).catch(() => void 0);
|
|
10488
|
+
}
|
|
10489
|
+
if (bytes !== void 0 && bytes.length <= TEXT_BYTES) say(`the attachment "${printable(file.name)}"`, bytes.toString("utf8"));
|
|
10490
|
+
}
|
|
10491
|
+
}
|
|
10312
10492
|
const shardLines = [];
|
|
10313
10493
|
return {
|
|
10314
10494
|
get runId() {
|
|
@@ -10322,6 +10502,7 @@ async function startRun(passed2, declared2) {
|
|
|
10322
10502
|
},
|
|
10323
10503
|
async add(result2) {
|
|
10324
10504
|
const { codeAt, ...rest } = result2;
|
|
10505
|
+
if (env.secretCheck) await warnOfSecrets(result2);
|
|
10325
10506
|
const text6 = codeAt === void 0 ? void 0 : snapshotAt(codeAt, specFiles);
|
|
10326
10507
|
if (text6 !== void 0) snapshotByKey.set(result2.resultKey, text6);
|
|
10327
10508
|
buffer.push({ ...rest, keys: bound(result2.keys) });
|
|
@@ -10707,10 +10888,25 @@ var init_run_lifecycle = __esm({
|
|
|
10707
10888
|
});
|
|
10708
10889
|
|
|
10709
10890
|
// src/types/run-result-schema.ts
|
|
10891
|
+
function traceUrlProblem(value2) {
|
|
10892
|
+
if (typeof value2 !== "string") return "not a string";
|
|
10893
|
+
const url = value2.trim();
|
|
10894
|
+
if (url.length > TRACE_URL_MAX) return `longer than ${TRACE_URL_MAX} characters`;
|
|
10895
|
+
if (!/^[^\s\p{Cc}\p{Cf}]+$/u.test(url)) return "must not contain spaces or control characters";
|
|
10896
|
+
let parsed4;
|
|
10897
|
+
try {
|
|
10898
|
+
parsed4 = new URL(url);
|
|
10899
|
+
} catch {
|
|
10900
|
+
return "must be an https address";
|
|
10901
|
+
}
|
|
10902
|
+
if (parsed4.protocol !== "https:" || parsed4.hostname === "") return "must be an https address";
|
|
10903
|
+
if (parsed4.username !== "" || parsed4.password !== "") return "must carry no user name or password";
|
|
10904
|
+
return void 0;
|
|
10905
|
+
}
|
|
10710
10906
|
function parseRunResult(value2) {
|
|
10711
10907
|
return runResultSchema.parse(value2);
|
|
10712
10908
|
}
|
|
10713
|
-
var import_zod3, RUN_RESULT_SCHEMA_VERSION, binaryVerdictSchema, assertionResultRecordSchema2, usageSchema, runErrorSchema, savedSchema, rowResultSchema, summarySchema, evalResultSchema, runResultSchema;
|
|
10909
|
+
var import_zod3, RUN_RESULT_SCHEMA_VERSION, binaryVerdictSchema, assertionResultRecordSchema2, usageSchema, runErrorSchema, savedSchema, rowResultSchema, summarySchema, evalResultSchema, TRACE_URL_MAX, runResultSchema;
|
|
10714
10910
|
var init_run_result_schema = __esm({
|
|
10715
10911
|
"src/types/run-result-schema.ts"() {
|
|
10716
10912
|
"use strict";
|
|
@@ -10858,8 +11054,11 @@ var init_run_result_schema = __esm({
|
|
|
10858
11054
|
model: import_zod3.z.string().optional()
|
|
10859
11055
|
}).optional(),
|
|
10860
11056
|
/** 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()
|
|
11057
|
+
provider: import_zod3.z.object({ type: import_zod3.z.string(), model: import_zod3.z.string() }).optional(),
|
|
11058
|
+
/** The link to the eval's trace in your own observability (Langfuse, OTel). Optional and additive; `plune sync` drops one `traceUrlProblem` refuses. */
|
|
11059
|
+
traceUrl: import_zod3.z.string().optional()
|
|
10862
11060
|
});
|
|
11061
|
+
TRACE_URL_MAX = 2048;
|
|
10863
11062
|
runResultSchema = import_zod3.z.object({
|
|
10864
11063
|
schemaVersion: import_zod3.z.literal(RUN_RESULT_SCHEMA_VERSION),
|
|
10865
11064
|
plune_version: import_zod3.z.string(),
|
|
@@ -10964,7 +11163,7 @@ __export(sync_exports, {
|
|
|
10964
11163
|
handleSync: () => handleSync,
|
|
10965
11164
|
reportSyncFailure: () => reportSyncFailure
|
|
10966
11165
|
});
|
|
10967
|
-
function readRun(cwd, file) {
|
|
11166
|
+
function readRun(cwd, file, warn) {
|
|
10968
11167
|
const target4 = file !== void 0 ? path10.resolve(cwd, file) : path10.join(cwd, ".plune", "last-run.json");
|
|
10969
11168
|
let raw;
|
|
10970
11169
|
try {
|
|
@@ -10980,12 +11179,29 @@ function readRun(cwd, file) {
|
|
|
10980
11179
|
} catch {
|
|
10981
11180
|
throw new SyncFileError(`Run file is not valid JSON: ${target4}`);
|
|
10982
11181
|
}
|
|
11182
|
+
dropBadTraceLinks(json2, warn);
|
|
10983
11183
|
try {
|
|
10984
11184
|
return parseRunResult(json2);
|
|
10985
11185
|
} catch {
|
|
10986
11186
|
throw new SyncFileError(`Run file does not match the RunResult schema: ${target4}`);
|
|
10987
11187
|
}
|
|
10988
11188
|
}
|
|
11189
|
+
function dropBadTraceLinks(json2, warn) {
|
|
11190
|
+
const evals = json2?.evals;
|
|
11191
|
+
if (!Array.isArray(evals)) return;
|
|
11192
|
+
for (const e of evals) {
|
|
11193
|
+
if (typeof e !== "object" || e === null || !("traceUrl" in e)) continue;
|
|
11194
|
+
const entry2 = e;
|
|
11195
|
+
const problem = traceUrlProblem(entry2.traceUrl);
|
|
11196
|
+
if (problem === void 0) {
|
|
11197
|
+
entry2.traceUrl = entry2.traceUrl.trim();
|
|
11198
|
+
continue;
|
|
11199
|
+
}
|
|
11200
|
+
delete entry2.traceUrl;
|
|
11201
|
+
warn(`plune: eval "${String(entry2.id)}": trace link not sent (${problem}) \u2014 the eval is synced without it.
|
|
11202
|
+
`);
|
|
11203
|
+
}
|
|
11204
|
+
}
|
|
10989
11205
|
async function safeErrorDetail(res) {
|
|
10990
11206
|
try {
|
|
10991
11207
|
const body = await res.json();
|
|
@@ -10999,7 +11215,7 @@ async function handleSync(deps = {}) {
|
|
|
10999
11215
|
const apiUrl = resolveApiUrl(deps.apiUrl);
|
|
11000
11216
|
const token2 = (deps.loadToken ?? loadToken)();
|
|
11001
11217
|
if (token2 === null) throw new NotLoggedInError();
|
|
11002
|
-
const run = readRun(cwd, deps.file);
|
|
11218
|
+
const run = readRun(cwd, deps.file, deps.warn ?? ((line) => process.stderr.write(line)));
|
|
11003
11219
|
const doFetch = deps.fetchImpl ?? fetch;
|
|
11004
11220
|
const endpoint = `${apiUrl}/v1/runs`;
|
|
11005
11221
|
const payload2 = JSON.stringify(run);
|
|
@@ -12020,6 +12236,15 @@ var init_junit = __esm({
|
|
|
12020
12236
|
});
|
|
12021
12237
|
|
|
12022
12238
|
// src/importers/playwright-json.ts
|
|
12239
|
+
function isFailuresOnly(report, results4) {
|
|
12240
|
+
const reporters = Array.isArray(report.config?.reporter) ? report.config.reporter : [];
|
|
12241
|
+
const declared2 = reporters.some(
|
|
12242
|
+
(r) => Array.isArray(r) && r[0] === "json" && r[1]?.onlyFailures === true
|
|
12243
|
+
);
|
|
12244
|
+
const stats = report.stats;
|
|
12245
|
+
const counted = stats !== void 0 && stats.expected === 0 && stats.skipped === 0;
|
|
12246
|
+
return (declared2 || counted) && (results4 > 0 || (report.errors ?? []).length === 0);
|
|
12247
|
+
}
|
|
12023
12248
|
function statedIdOf(test, title) {
|
|
12024
12249
|
const annotation = test.annotations?.find((a) => a.type === "PluneId")?.description;
|
|
12025
12250
|
if (annotation !== void 0 && annotation !== "") return annotation;
|
|
@@ -12112,7 +12337,8 @@ function readPlaywrightJson(source, file) {
|
|
|
12112
12337
|
if (typeof parsed4 !== "object" || parsed4 === null || !Array.isArray(parsed4.suites)) {
|
|
12113
12338
|
throw new JsonReportError(file, 'no "suites" array \u2014 is this a Playwright JSON report?');
|
|
12114
12339
|
}
|
|
12115
|
-
const
|
|
12340
|
+
const report = parsed4;
|
|
12341
|
+
const { config, suites } = report;
|
|
12116
12342
|
const rootDir = typeof config?.rootDir === "string" ? config.rootDir : void 0;
|
|
12117
12343
|
const buildHref = config?.metadata?.ci?.buildHref;
|
|
12118
12344
|
const repoRoot = rootDir !== void 0 && (0, import_node_fs10.existsSync)(rootDir) ? repoRootOf(rootDir) : void 0;
|
|
@@ -12128,7 +12354,8 @@ function readPlaywrightJson(source, file) {
|
|
|
12128
12354
|
return {
|
|
12129
12355
|
results: out,
|
|
12130
12356
|
...ciUrl !== void 0 ? { ciUrl } : {},
|
|
12131
|
-
...ci !== void 0 ? { ci } : {}
|
|
12357
|
+
...ci !== void 0 ? { ci } : {},
|
|
12358
|
+
...isFailuresOnly(report, out.length) ? { failuresOnly: true } : {}
|
|
12132
12359
|
};
|
|
12133
12360
|
}
|
|
12134
12361
|
function looksLikePlaywrightJson(source) {
|
|
@@ -12488,6 +12715,31 @@ async function timeoutMessage(limit3, runId, ours, options) {
|
|
|
12488
12715
|
const done = await Promise.race([closed, gaveUp]).finally(() => clearTimeout(timer)) === true;
|
|
12489
12716
|
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
12717
|
}
|
|
12718
|
+
function emptyImport(format) {
|
|
12719
|
+
const none = { uploaded: 0, skipped: 0, failed: 0 };
|
|
12720
|
+
return {
|
|
12721
|
+
runId: null,
|
|
12722
|
+
format,
|
|
12723
|
+
parsed: 0,
|
|
12724
|
+
accepted: 0,
|
|
12725
|
+
duplicate: 0,
|
|
12726
|
+
conflict: 0,
|
|
12727
|
+
rejected: 0,
|
|
12728
|
+
unresolved: 0,
|
|
12729
|
+
offered: 0,
|
|
12730
|
+
created: 0,
|
|
12731
|
+
unoffered: 0,
|
|
12732
|
+
deferred: 0,
|
|
12733
|
+
screenshots: none,
|
|
12734
|
+
textFiles: { ...none },
|
|
12735
|
+
unlocatable: 0,
|
|
12736
|
+
missingAttachments: [],
|
|
12737
|
+
filesUploaded: 0,
|
|
12738
|
+
filesNotSent: 0,
|
|
12739
|
+
announced: false,
|
|
12740
|
+
offering: false
|
|
12741
|
+
};
|
|
12742
|
+
}
|
|
12491
12743
|
async function handleRunImport(options) {
|
|
12492
12744
|
const write = options.write ?? ((line) => void process.stdout.write(`${line}
|
|
12493
12745
|
`));
|
|
@@ -12507,14 +12759,21 @@ async function handleRunImport(options) {
|
|
|
12507
12759
|
...options.minScores !== void 0 ? { minScores: options.minScores } : {}
|
|
12508
12760
|
});
|
|
12509
12761
|
}
|
|
12510
|
-
const { format, results: results4, missing, notes, ciUrl, ci } = read;
|
|
12762
|
+
const { format, results: results4, missing, notes, ciUrl, ci, failuresOnly } = read;
|
|
12511
12763
|
if (results4.length === 0) {
|
|
12764
|
+
if (failuresOnly === true) {
|
|
12765
|
+
write(`plune: ${printable(options.file)} is a failures-only report and nothing failed \u2014 nothing to import.`);
|
|
12766
|
+
return emptyImport(format);
|
|
12767
|
+
}
|
|
12512
12768
|
throw new RunCommandError(`No test cases in ${options.file} \u2014 it parsed, but there is nothing in it.`);
|
|
12513
12769
|
}
|
|
12514
12770
|
for (const m of missing) write(`plune: attachment not found \u2014 ${JSON.stringify(printable(m.title))}: ${printable(m.path)}`);
|
|
12515
12771
|
for (const note2 of notes) write(note2);
|
|
12516
12772
|
const announced = (format === "junit" || format === "allure") && (missing.length > 0 || results4.some((r) => (r.files?.length ?? 0) > 0));
|
|
12517
12773
|
const env = readEnv();
|
|
12774
|
+
if (failuresOnly === true && env.config.full === true) {
|
|
12775
|
+
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.");
|
|
12776
|
+
}
|
|
12518
12777
|
const apiUrl = resolveApiUrl(options.apiUrl ?? env.config.apiUrl);
|
|
12519
12778
|
const token2 = options.token ?? env.config.token ?? loadToken() ?? "";
|
|
12520
12779
|
if (token2 === "") throw new NoTokenError();
|
|
@@ -12528,6 +12787,7 @@ async function handleRunImport(options) {
|
|
|
12528
12787
|
...options.key !== void 0 ? { externalKey: options.key } : {},
|
|
12529
12788
|
...options.name !== void 0 ? { title: options.name } : {},
|
|
12530
12789
|
...options.create === true ? { offerDiscovered: true } : {},
|
|
12790
|
+
...failuresOnly === true ? { full: false } : {},
|
|
12531
12791
|
...options.uploadConcurrency !== void 0 ? { uploadConcurrency: options.uploadConcurrency } : {},
|
|
12532
12792
|
kind: "automated",
|
|
12533
12793
|
// The CI run the report names, never this machine's: whoever imports may be another job.
|
|
@@ -13827,6 +14087,174 @@ var init_schemas = __esm({
|
|
|
13827
14087
|
}
|
|
13828
14088
|
});
|
|
13829
14089
|
|
|
14090
|
+
// src/mcp-testing/lint/thresholds.ts
|
|
14091
|
+
var PLUNE_ANSWER_MEASURES, HEADROOM, limitOf, PLUNE_BUDGET, LINT_THRESHOLDS;
|
|
14092
|
+
var init_thresholds = __esm({
|
|
14093
|
+
"src/mcp-testing/lint/thresholds.ts"() {
|
|
14094
|
+
"use strict";
|
|
14095
|
+
init_cjs_shims();
|
|
14096
|
+
PLUNE_ANSWER_MEASURES = {
|
|
14097
|
+
plune_project_context: { tokens: 387, of: "3 projects and 3 suites" },
|
|
14098
|
+
plune_cases_search: { tokens: 7678, of: "a project of 48 cases" },
|
|
14099
|
+
plune_review_list: { tokens: 695, of: "7 pending entries" },
|
|
14100
|
+
plune_mission_get: { tokens: 455, of: "a mission with 5 sources" }
|
|
14101
|
+
};
|
|
14102
|
+
HEADROOM = 0.1;
|
|
14103
|
+
limitOf = (measure3) => Math.ceil(measure3 * (1 + HEADROOM));
|
|
14104
|
+
PLUNE_BUDGET = {
|
|
14105
|
+
/** A limit is the measure times (1 + headroom), rounded up. */
|
|
14106
|
+
headroom: HEADROOM,
|
|
14107
|
+
/** A measure below this share of its limit means the limit is too loose: with 10% headroom a list may shrink ~12%. */
|
|
14108
|
+
tooLooseShare: 0.8,
|
|
14109
|
+
/** Whole tool lists, outputSchema and annotations included. */
|
|
14110
|
+
lists: {
|
|
14111
|
+
/** 2025 era, write scope, as listed first: 17 tools, measured 8927 on 2026-11-20 (8853 before the measured-answer lines of #2988). */
|
|
14112
|
+
writeFirst: 9272,
|
|
14113
|
+
/** 2025 era, write scope, after plune_discover_tools: 22 tools, measured 11403 on 2026-11-20 (11329 before the measured-answer lines). */
|
|
14114
|
+
writeAll: 11926,
|
|
14115
|
+
/** 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). */
|
|
14116
|
+
read: 2445,
|
|
14117
|
+
/** 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). */
|
|
14118
|
+
modernWrite: 9272
|
|
14119
|
+
},
|
|
14120
|
+
/** The biggest single tool, plune_strategy_propose, measured 2177. */
|
|
14121
|
+
largestTool: 2395,
|
|
14122
|
+
/**
|
|
14123
|
+
* The text content of an answer, on live answers recorded in plune-budget.fixtures.ts, measured 2026-11-14 with the
|
|
14124
|
+
* text unindented (before, with a two-space indent): the beta demo project of 2026-11-10 (cases in Ukrainian) gives
|
|
14125
|
+
* plune_project_context with 3 projects, 3 suites, no missions 387 (548); plune_cases_search 7678 (10509) for the
|
|
14126
|
+
* whole project of 48 cases (a page of 100 is not reached); plune_review_list of 7 pending entries 695 (895). The demo
|
|
14127
|
+
* has no missions, so plune_mission_get reads a mission with 5 sources captured live on a beta test project on
|
|
14128
|
+
* 2026-11-14: 455 (585; the synthetic mission it replaced measured 476 indented, under its limit of 524).
|
|
14129
|
+
*/
|
|
14130
|
+
answers: {
|
|
14131
|
+
plune_project_context: limitOf(PLUNE_ANSWER_MEASURES.plune_project_context.tokens),
|
|
14132
|
+
plune_cases_search: limitOf(PLUNE_ANSWER_MEASURES.plune_cases_search.tokens),
|
|
14133
|
+
plune_review_list: limitOf(PLUNE_ANSWER_MEASURES.plune_review_list.tokens),
|
|
14134
|
+
plune_mission_get: limitOf(PLUNE_ANSWER_MEASURES.plune_mission_get.tokens)
|
|
14135
|
+
}
|
|
14136
|
+
};
|
|
14137
|
+
LINT_THRESHOLDS = {
|
|
14138
|
+
description: {
|
|
14139
|
+
/** Shorter than this many characters says too little for a model to choose the tool. */
|
|
14140
|
+
minLength: 40,
|
|
14141
|
+
/** Longer than this many characters costs every request and buries the point. */
|
|
14142
|
+
maxLength: 1e3
|
|
14143
|
+
},
|
|
14144
|
+
names: {
|
|
14145
|
+
/** The specification's length bound for a tool name. */
|
|
14146
|
+
maxLength: 128,
|
|
14147
|
+
/** A naming style is the server's convention when more than this share of its tools use it. */
|
|
14148
|
+
majorityShare: 0.5
|
|
14149
|
+
},
|
|
14150
|
+
similarity: {
|
|
14151
|
+
/** Word-set overlap (Jaccard) of two names, the shared server prefix left out, above which they are confusable. */
|
|
14152
|
+
names: 0.75,
|
|
14153
|
+
/** Word-set overlap of two descriptions above which a model cannot tell the tools apart. */
|
|
14154
|
+
descriptions: 0.6,
|
|
14155
|
+
/** Overlap of two descriptions above which the tools are related enough that "when not to use" matters more. */
|
|
14156
|
+
related: 0.35,
|
|
14157
|
+
/** Words shorter than this are left out of a description's word set. */
|
|
14158
|
+
minWordLength: 3,
|
|
14159
|
+
/** Decimals an overlap is reported with. */
|
|
14160
|
+
decimals: 2,
|
|
14161
|
+
/**
|
|
14162
|
+
* Tools above which the rules that compare every pair (`tools-similar`, `desc-no-when-not`) do not run and say
|
|
14163
|
+
* `could-not-run`: the work grows with the square of a count the server chooses. Measured 2026-11-10 on one
|
|
14164
|
+
* desktop core, with no two tools alike (the slowest case: no early stop): at 1000 tools the two rules take 0.25 s
|
|
14165
|
+
* with 60-character descriptions and 2.3 s with 1000-character ones (`description.maxLength`); at 4000 short ones,
|
|
14166
|
+
* 4.5 s. Well above the tool lists of real servers, which hold tens to hundreds.
|
|
14167
|
+
*/
|
|
14168
|
+
maxTools: 1e3
|
|
14169
|
+
},
|
|
14170
|
+
schema: {
|
|
14171
|
+
/**
|
|
14172
|
+
* Levels an input schema may nest (a named property, or an array's items, is one level below the node it is in)
|
|
14173
|
+
* for the rules that read every node of it (`required-unknown-property`, `param-example-missing`); deeper, they
|
|
14174
|
+
* say `could-not-run` for the tool. The server chooses the depth, and a node's path is as long as its depth.
|
|
14175
|
+
* Hand-written and generated schemas nest to about 10-20 levels; 64 leaves three times that, and is the number
|
|
14176
|
+
* the `--call` path stops copying an output schema at (counted there in JSON levels, two to a property).
|
|
14177
|
+
* 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
|
|
14178
|
+
* with two siblings and an array at every level), and stop within 0.2 ms on a chain of 100 000 levels. The
|
|
14179
|
+
* recursive walk this replaced overflowed the call stack at 10 000 levels.
|
|
14180
|
+
*/
|
|
14181
|
+
maxDepth: 64
|
|
14182
|
+
},
|
|
14183
|
+
size: {
|
|
14184
|
+
/**
|
|
14185
|
+
* Estimated tokens of the whole visible tool list above which the list is reported: the limit of our own biggest
|
|
14186
|
+
* list (`budget.lists.writeAll`), so a server that costs more than all of ours is told so.
|
|
14187
|
+
*/
|
|
14188
|
+
maxListTokens: PLUNE_BUDGET.lists.writeAll,
|
|
14189
|
+
/**
|
|
14190
|
+
* The estimate: characters of a tool's JSON divided by this, rounded up, summed over the tools. No tokenizer, no
|
|
14191
|
+
* network, the same number in CI on every run; a limit is a measure plus headroom, never an exact token count.
|
|
14192
|
+
* Calibrated 2026-11-10 against a provider's token-counting endpoint on two current models (both gave the same
|
|
14193
|
+
* counts): the estimate is low. On the same JSON (name, description, input schema: the fields a model API takes) a
|
|
14194
|
+
* tool list costs 1.57-1.72 times the estimate, the tool-use preamble of ~320 tokens left out; the largest live
|
|
14195
|
+
* answer (JSON with Ukrainian text) 1.84 times. The limits stay in estimated tokens; for real tokens multiply by
|
|
14196
|
+
* ~1.7 (English JSON) to ~1.85 (Cyrillic). Table: docs/features/mcp-context-budget/budget.md.
|
|
14197
|
+
*/
|
|
14198
|
+
charsPerToken: 4,
|
|
14199
|
+
budget: PLUNE_BUDGET
|
|
14200
|
+
},
|
|
14201
|
+
call: {
|
|
14202
|
+
/**
|
|
14203
|
+
* Estimated tokens of one `tools/call` result (its JSON, as the client receives it) above which the answer is
|
|
14204
|
+
* reported: the limit of our own biggest answer (`budget.answers.plune_cases_search`), as `maxListTokens` is for
|
|
14205
|
+
* the list.
|
|
14206
|
+
*/
|
|
14207
|
+
maxResultTokens: PLUNE_BUDGET.answers.plune_cases_search
|
|
14208
|
+
},
|
|
14209
|
+
language: {
|
|
14210
|
+
/**
|
|
14211
|
+
* A text is taken to be in a listed language when at least this many of its stop words occur; two, so a lone
|
|
14212
|
+
* "a" or "in" of another Latin-script language does not pass for English.
|
|
14213
|
+
*/
|
|
14214
|
+
minStopwords: 2
|
|
14215
|
+
},
|
|
14216
|
+
/** Name words that say a tool returns a list, so it should take a page size or cursor. */
|
|
14217
|
+
listVerbs: ["list", "search", "find", "query", "browse"],
|
|
14218
|
+
/** Parameter names that page a list. */
|
|
14219
|
+
pagingParams: ["limit", "cursor", "page", "offset", "pagesize", "perpage", "per_page", "page_size", "pagetoken", "page_token"],
|
|
14220
|
+
/** Name words of a tool that changes something; a read-only hint on such a tool contradicts its name. */
|
|
14221
|
+
writeVerbs: ["create", "add", "update", "edit", "delete", "remove", "set", "write", "put", "patch", "insert", "replace", "send"],
|
|
14222
|
+
/** Name words of a tool that overwrites or removes, which is not an "additive only" update. */
|
|
14223
|
+
overwriteVerbs: ["update", "edit", "set", "replace", "delete", "remove", "overwrite", "patch", "clear", "reset", "rename", "move"],
|
|
14224
|
+
/** Parameter name words that say the value is not free text. Booleans only by the first word (`isActive`). */
|
|
14225
|
+
typedParamWords: {
|
|
14226
|
+
number: ["count", "limit", "max", "min", "size", "offset", "total", "amount", "number", "port", "timeout", "retries", "quantity", "index"],
|
|
14227
|
+
boolean: ["is", "has", "can", "should", "allow", "enable", "enabled"],
|
|
14228
|
+
date: ["date", "time", "timestamp", "since", "until", "deadline"],
|
|
14229
|
+
url: ["url", "uri", "href", "link", "endpoint", "website"]
|
|
14230
|
+
},
|
|
14231
|
+
/**
|
|
14232
|
+
* Words by language. `script` is the alphabet the language is written in; `letters`, when given, are letters the
|
|
14233
|
+
* language has and its neighbours in the same alphabet do not, so a Russian text is not read as Ukrainian.
|
|
14234
|
+
* Phrases match at the start of a word, so a stem (`не використов`) covers its inflected forms.
|
|
14235
|
+
*/
|
|
14236
|
+
languages: {
|
|
14237
|
+
en: {
|
|
14238
|
+
script: "Latin",
|
|
14239
|
+
letters: "",
|
|
14240
|
+
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"],
|
|
14241
|
+
whenNot: ["do not", "don't", "instead", "rather than", "only", "not for", "avoid", "never"],
|
|
14242
|
+
example: ["e.g.", "for example", "for instance", "such as", "example"],
|
|
14243
|
+
closedSet: ["one of", "either"]
|
|
14244
|
+
},
|
|
14245
|
+
uk: {
|
|
14246
|
+
script: "Cyrillic",
|
|
14247
|
+
letters: "\u0456\u0457\u0454\u0491",
|
|
14248
|
+
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"],
|
|
14249
|
+
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"],
|
|
14250
|
+
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"],
|
|
14251
|
+
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"]
|
|
14252
|
+
}
|
|
14253
|
+
}
|
|
14254
|
+
};
|
|
14255
|
+
}
|
|
14256
|
+
});
|
|
14257
|
+
|
|
13830
14258
|
// src/mcp-tools/contract.ts
|
|
13831
14259
|
function pluneTool(name) {
|
|
13832
14260
|
const tool2 = BY_NAME.get(name);
|
|
@@ -13844,15 +14272,17 @@ function offeredTo(tool2, scope) {
|
|
|
13844
14272
|
function defaultVisibleTools(scope) {
|
|
13845
14273
|
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
13846
14274
|
}
|
|
13847
|
-
var import_zod5, MAX_VISIBLE_TOOLS, define, listPage, missionId, projectId, PLUNE_TOOLS, PLUNE_TOOL_NAMES, BY_NAME;
|
|
14275
|
+
var import_zod5, MAX_VISIBLE_TOOLS, define, measuredCost, listPage, missionId, projectId, PLUNE_TOOLS, PLUNE_TOOL_NAMES, BY_NAME;
|
|
13848
14276
|
var init_contract = __esm({
|
|
13849
14277
|
"src/mcp-tools/contract.ts"() {
|
|
13850
14278
|
"use strict";
|
|
13851
14279
|
init_cjs_shims();
|
|
13852
14280
|
import_zod5 = require("zod");
|
|
13853
14281
|
init_schemas();
|
|
14282
|
+
init_thresholds();
|
|
13854
14283
|
MAX_VISIBLE_TOOLS = 20;
|
|
13855
14284
|
define = (tool2) => tool2;
|
|
14285
|
+
measuredCost = (tool2) => ` Measured answer: ~${PLUNE_ANSWER_MEASURES[tool2].tokens} tokens (characters / 4) for ${PLUNE_ANSWER_MEASURES[tool2].of}.`;
|
|
13856
14286
|
listPage = {
|
|
13857
14287
|
limit: import_zod5.z.number().int().min(1).max(BATCH_MAX2).optional(),
|
|
13858
14288
|
cursor: import_zod5.z.string().min(1).optional().describe("nextCursor of the previous page")
|
|
@@ -13863,7 +14293,7 @@ var init_contract = __esm({
|
|
|
13863
14293
|
define({
|
|
13864
14294
|
name: "plune_project_context",
|
|
13865
14295
|
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.",
|
|
14296
|
+
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
14297
|
input: import_zod5.z.strictObject({}),
|
|
13868
14298
|
output: import_zod5.z.object({
|
|
13869
14299
|
projectId: import_zod5.z.string().nullable(),
|
|
@@ -13891,7 +14321,7 @@ var init_contract = __esm({
|
|
|
13891
14321
|
define({
|
|
13892
14322
|
name: "plune_cases_search",
|
|
13893
14323
|
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.",
|
|
14324
|
+
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
14325
|
input: import_zod5.z.strictObject({
|
|
13896
14326
|
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
14327
|
...listPage
|
|
@@ -13909,7 +14339,7 @@ var init_contract = __esm({
|
|
|
13909
14339
|
define({
|
|
13910
14340
|
name: "plune_review_list",
|
|
13911
14341
|
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.",
|
|
14342
|
+
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
14343
|
input: import_zod5.z.strictObject({
|
|
13914
14344
|
state: import_zod5.z.enum(REVIEW_STATES).optional(),
|
|
13915
14345
|
kinds: import_zod5.z.array(import_zod5.z.enum(REVIEW_KINDS)).min(1).optional().describe("Questions are read with the question tool"),
|
|
@@ -13990,7 +14420,7 @@ var init_contract = __esm({
|
|
|
13990
14420
|
define({
|
|
13991
14421
|
name: "plune_mission_get",
|
|
13992
14422
|
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.",
|
|
14423
|
+
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
14424
|
input: import_zod5.z.strictObject({ missionId }),
|
|
13995
14425
|
output: import_zod5.z.object({ mission: entity }),
|
|
13996
14426
|
write: false,
|
|
@@ -14288,8 +14718,10 @@ function errorOf(err) {
|
|
|
14288
14718
|
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
14719
|
if (err.status === 403 && err.message === READ_ONLY_REFUSAL)
|
|
14290
14720
|
return { status: 403, code: "read_only_token", message: `Plune refused (403): ${readScopeMessage("it cannot write")}` };
|
|
14291
|
-
const
|
|
14292
|
-
|
|
14721
|
+
const quota = err.status === 429 && asRecord(err.body)["quota"] !== void 0;
|
|
14722
|
+
const code = err.code ?? (quota ? "quota_exceeded" : `http_${err.status}`);
|
|
14723
|
+
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 " : "";
|
|
14724
|
+
return { status: err.status, code, message: `Plune refused (${err.status} ${code}): ${why}${err.message}${detailLines(err.body)}`, details: err.body };
|
|
14293
14725
|
}
|
|
14294
14726
|
if (err instanceof PluneNetworkError) return { code: "network", message: `${err.message}. Check PLUNE_API_URL and the network.` };
|
|
14295
14727
|
throw err;
|
|
@@ -14313,7 +14745,6 @@ function createPluneToolExecutor(opts) {
|
|
|
14313
14745
|
let scope = opts.scope;
|
|
14314
14746
|
const revealed = /* @__PURE__ */ new Set();
|
|
14315
14747
|
const confirms = /* @__PURE__ */ new Map();
|
|
14316
|
-
let proposals = 0;
|
|
14317
14748
|
const visibleTools = () => {
|
|
14318
14749
|
const core = defaultVisibleTools(scope);
|
|
14319
14750
|
const extra = [...revealed].filter((n) => !(scope === "read" && pluneTool(n).write) && !core.includes(n));
|
|
@@ -14432,13 +14863,12 @@ function createPluneToolExecutor(opts) {
|
|
|
14432
14863
|
const stableId = (0, import_node_crypto6.createHash)("sha256").update([c["title"], ...steps, c["expected"]].join("\n")).digest("hex").slice(0, 32);
|
|
14433
14864
|
return withoutUndefined({ stableId, execution: "manual", ...c });
|
|
14434
14865
|
});
|
|
14435
|
-
proposals += 1;
|
|
14436
14866
|
const req = {
|
|
14437
14867
|
method: "POST",
|
|
14438
14868
|
path: "/v1/ingest/cairn",
|
|
14439
14869
|
body: {
|
|
14440
14870
|
schemaVersion: 1,
|
|
14441
|
-
run: withoutUndefined({ runId: `mcp-${sessionId}-${
|
|
14871
|
+
run: withoutUndefined({ runId: `mcp-${sessionId}-${(0, import_node_crypto6.randomUUID)().slice(0, 8)}`, mode: "design", target: str2(i["target"]), missionId: i["missionId"] }),
|
|
14442
14872
|
cases
|
|
14443
14873
|
}
|
|
14444
14874
|
};
|
|
@@ -14573,6 +15003,8 @@ function createPluneToolExecutor(opts) {
|
|
|
14573
15003
|
if (isDeletion(req)) {
|
|
14574
15004
|
const t = now();
|
|
14575
15005
|
for (const [k, v] of confirms) if (v.expires <= t) confirms.delete(k);
|
|
15006
|
+
if (confirm2 === void 0 && opts.oneRequest === true)
|
|
15007
|
+
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
15008
|
if (confirm2 === void 0) {
|
|
14577
15009
|
const value2 = (0, import_node_crypto6.randomBytes)(24).toString("base64url");
|
|
14578
15010
|
confirms.set(value2, { fingerprint: fingerprint(req), expires: t + CONFIRM_TTL_MS });
|
|
@@ -14682,15 +15114,17 @@ function toResult(outcome) {
|
|
|
14682
15114
|
structuredContent: { error: outcome.error }
|
|
14683
15115
|
};
|
|
14684
15116
|
}
|
|
14685
|
-
function createPluneMcpServer(opts, era) {
|
|
15117
|
+
function createPluneMcpServer(opts, era, traits = {}) {
|
|
14686
15118
|
const { version: version2, ...executorOptions } = opts;
|
|
14687
|
-
const
|
|
15119
|
+
const listChanged = traits.listChanged ?? true;
|
|
15120
|
+
const fixed = era === "modern" || !listChanged;
|
|
14688
15121
|
const executor = createPluneToolExecutor({
|
|
14689
15122
|
...executorOptions,
|
|
14690
15123
|
userAgent: executorOptions.userAgent ?? `plune-cli/${version2} mcp`,
|
|
14691
|
-
fixedToolList: fixed
|
|
15124
|
+
fixedToolList: fixed,
|
|
15125
|
+
oneRequest: !listChanged
|
|
14692
15126
|
});
|
|
14693
|
-
const server2 = new import_server.McpServer({ name: "plune", version: version2 }, { capabilities: { tools: { listChanged
|
|
15127
|
+
const server2 = new import_server.McpServer({ name: "plune", version: version2 }, { capabilities: { tools: { listChanged } } });
|
|
14694
15128
|
const registered = /* @__PURE__ */ new Map();
|
|
14695
15129
|
const sync = () => {
|
|
14696
15130
|
const visible2 = new Set(executor.visibleTools());
|
|
@@ -15101,161 +15535,6 @@ var init_model = __esm({
|
|
|
15101
15535
|
}
|
|
15102
15536
|
});
|
|
15103
15537
|
|
|
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
15538
|
// src/mcp-testing/lint/size.ts
|
|
15260
15539
|
function jsonText(value2) {
|
|
15261
15540
|
if (typeof value2 !== "object" || value2 === null) return JSON.stringify(value2);
|
|
@@ -18338,7 +18617,7 @@ function parseLock(raw) {
|
|
|
18338
18617
|
return parsed4;
|
|
18339
18618
|
}
|
|
18340
18619
|
function asSnapshot(transport, s) {
|
|
18341
|
-
const
|
|
18620
|
+
const strip2 = (list3) => list3 === null ? null : list3.map(contentOf);
|
|
18342
18621
|
return {
|
|
18343
18622
|
kind: SNAPSHOT_KIND,
|
|
18344
18623
|
schemaVersion: SNAPSHOT_SCHEMA_VERSION,
|
|
@@ -18346,10 +18625,10 @@ function asSnapshot(transport, s) {
|
|
|
18346
18625
|
server: null,
|
|
18347
18626
|
instructions: null,
|
|
18348
18627
|
capabilities: null,
|
|
18349
|
-
tools:
|
|
18628
|
+
tools: strip2(s.tools),
|
|
18350
18629
|
resources: null,
|
|
18351
|
-
resourceTemplates:
|
|
18352
|
-
prompts:
|
|
18630
|
+
resourceTemplates: strip2(s.resourceTemplates),
|
|
18631
|
+
prompts: strip2(s.prompts)
|
|
18353
18632
|
};
|
|
18354
18633
|
}
|
|
18355
18634
|
function modelTexts(section, entries2) {
|
|
@@ -32463,6 +32742,7 @@ function sarif(r, rules, version2) {
|
|
|
32463
32742
|
id: id2,
|
|
32464
32743
|
name: id2,
|
|
32465
32744
|
shortDescription: { text: def2 === void 0 ? id2 : `${id2}: ${def2.fix}` },
|
|
32745
|
+
helpUri: ruleHelpUri(id2),
|
|
32466
32746
|
defaultConfiguration: {
|
|
32467
32747
|
level: def2 === void 0 ? "note" : SARIF_LEVEL[def2.severity]
|
|
32468
32748
|
},
|
|
@@ -32650,7 +32930,7 @@ function renderScan(r, format, rules, version2) {
|
|
|
32650
32930
|
throw new Error(`plune mcp scan does not write ${format}`);
|
|
32651
32931
|
}
|
|
32652
32932
|
}
|
|
32653
|
-
var import_node_crypto15, GROUPS, DISCLAIMER, fingerprintOf, where2, IMPORT_WORDS, plural7, probeResult, probeControl, ANNOTATIONS, escapeData2, escapeProperty2, noLegacy2, SARIF_MAX_RESULTS, SARIF_LEVEL, importance, NOT_XML2, xmlText2, xmlAttr2;
|
|
32933
|
+
var import_node_crypto15, GROUPS, DISCLAIMER, fingerprintOf, where2, IMPORT_WORDS, plural7, probeResult, probeControl, ANNOTATIONS, escapeData2, escapeProperty2, noLegacy2, SARIF_MAX_RESULTS, SARIF_LEVEL, importance, RULE_DOCS, ruleHelpUri, NOT_XML2, xmlText2, xmlAttr2;
|
|
32654
32934
|
var init_report3 = __esm({
|
|
32655
32935
|
"src/mcp-testing/scan/report.ts"() {
|
|
32656
32936
|
"use strict";
|
|
@@ -32682,6 +32962,8 @@ ${nth}`, "utf8").digest("hex").slice(0, 32);
|
|
|
32682
32962
|
SARIF_MAX_RESULTS = 25e3;
|
|
32683
32963
|
SARIF_LEVEL = { error: "error", warn: "warning", info: "note", advice: "note" };
|
|
32684
32964
|
importance = (f) => (f.counted ? 0 : 4) + { error: 0, warn: 1, info: 2, advice: 3 }[f.severity];
|
|
32965
|
+
RULE_DOCS = "https://docs.plune.ai/cli/guides/mcp-security/";
|
|
32966
|
+
ruleHelpUri = (id2) => `${RULE_DOCS}#${id2.replace(/\//g, "-")}`;
|
|
32685
32967
|
NOT_XML2 = /[\u0000-\u0008\u000b\u000c\u000e-\u001f]|[\ud800-\udbff](?![\udc00-\udfff])|(?<![\ud800-\udbff])[\udc00-\udfff]/g;
|
|
32686
32968
|
xmlText2 = (s) => s.replace(NOT_XML2, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
32687
32969
|
xmlAttr2 = (s) => xmlText2(s).replace(/"/g, """).replace(/\t/g, "	").replace(/\n/g, " ").replace(/\r/g, " ");
|
|
@@ -33946,7 +34228,7 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
33946
34228
|
}
|
|
33947
34229
|
cases = casesFromApi(report, verdicts);
|
|
33948
34230
|
} else if (mode === "mcp") {
|
|
33949
|
-
cases = await casesFromMcp(dir, report);
|
|
34231
|
+
cases = own2(report, "cases") === void 0 && Array.isArray(own2(report, "testCases")) ? casesFromDesign(report) : await casesFromMcp(dir, report);
|
|
33950
34232
|
} else {
|
|
33951
34233
|
cases = casesFromDesign(report);
|
|
33952
34234
|
}
|
|
@@ -35764,7 +36046,10 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
35764
36046
|
if (!/^\d+$/.test(v) || Number(v) > 86400) throw new import_commander.InvalidArgumentError("a whole number of seconds from 0 to 86400.");
|
|
35765
36047
|
return Number(v);
|
|
35766
36048
|
}
|
|
35767
|
-
).option("--fail-on-failures", FAIL_ON_FAILURES, false).
|
|
36049
|
+
).option("--fail-on-failures", FAIL_ON_FAILURES, false).addHelpText(
|
|
36050
|
+
"after",
|
|
36051
|
+
"\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."
|
|
36052
|
+
).action(
|
|
35768
36053
|
async (file, options, command) => {
|
|
35769
36054
|
const [
|
|
35770
36055
|
{ handleRunImport: handleRunImport2 },
|