@plune-ai/cli 0.39.9 → 0.39.11
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 +2 -2
- package/dist/cli.cjs +574 -103
- package/dist/index.cjs +51 -10
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +51 -10
- package/dist/mcp-http.cjs +22 -2
- package/dist/mcp-http.js +22 -2
- package/dist/reporter-core.cjs +24 -5
- package/dist/reporter-core.d.cts +38 -1
- package/dist/reporter-core.d.ts +38 -1
- package/dist/reporter-core.js +23 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5489,7 +5489,7 @@ var TYPE_BY_EXTENSION = {
|
|
|
5489
5489
|
".jpeg": "image/jpeg",
|
|
5490
5490
|
".webp": "image/webp"
|
|
5491
5491
|
};
|
|
5492
|
-
var
|
|
5492
|
+
var READ_NOT_KEPT = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
5493
5493
|
var NAME_MAX = 200;
|
|
5494
5494
|
function nameOf(file) {
|
|
5495
5495
|
const own2 = file.name.split(/[\\/]/).pop()?.trim() || (file.path === void 0 ? "" : (0, import_node_path3.basename)(file.path));
|
|
@@ -5956,7 +5956,7 @@ function fileSender(options) {
|
|
|
5956
5956
|
if (item?.status !== "accepted" || typeof item.id !== "string" || typeof item.resultKey !== "string") continue;
|
|
5957
5957
|
for (const file of filesByKey.get(item.resultKey) ?? []) {
|
|
5958
5958
|
const type = mediaTypeOf(file.contentType) ?? (file.path === void 0 ? void 0 : TYPE_BY_EXTENSION[(0, import_node_path3.extname)(file.path).toLowerCase()]);
|
|
5959
|
-
if (type === void 0 || type
|
|
5959
|
+
if (type === void 0 || READ_NOT_KEPT.has(type)) continue;
|
|
5960
5960
|
const kind = kindOf2(type);
|
|
5961
5961
|
if (kind !== "text" && file.path === void 0) continue;
|
|
5962
5962
|
const name = nameOf(file);
|
|
@@ -6008,6 +6008,17 @@ init_cjs_shims();
|
|
|
6008
6008
|
var fs8 = __toESM(require("fs/promises"), 1);
|
|
6009
6009
|
var path9 = __toESM(require("path"), 1);
|
|
6010
6010
|
|
|
6011
|
+
// src/importers/trace-url.ts
|
|
6012
|
+
init_cjs_shims();
|
|
6013
|
+
init_failure_detail();
|
|
6014
|
+
function traceUrlOf(value, title, notes) {
|
|
6015
|
+
if (value === void 0 || typeof value === "string" && value.trim() === "") return void 0;
|
|
6016
|
+
const problem = traceUrlProblem(value);
|
|
6017
|
+
if (problem === void 0) return value.trim();
|
|
6018
|
+
notes.push(`plune: ${JSON.stringify(printable(title))}: trace link not sent (${problem}) \u2014 the result is imported without it.`);
|
|
6019
|
+
return void 0;
|
|
6020
|
+
}
|
|
6021
|
+
|
|
6011
6022
|
// src/mcp-testing/scan/config/config.ts
|
|
6012
6023
|
init_cjs_shims();
|
|
6013
6024
|
|
|
@@ -7817,21 +7828,37 @@ async function defaultReadEvidence(dir) {
|
|
|
7817
7828
|
return { name: str(rec["name"]), passed: rec["passed"] === true, ...error !== "" ? { error } : {} };
|
|
7818
7829
|
});
|
|
7819
7830
|
}
|
|
7820
|
-
function casesFromDesign(report) {
|
|
7831
|
+
function casesFromDesign(report, notes) {
|
|
7821
7832
|
const list2 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
|
|
7822
|
-
|
|
7833
|
+
const refused = /* @__PURE__ */ new Map();
|
|
7834
|
+
const cases = list2.map((raw) => {
|
|
7823
7835
|
const c = asRecord(raw);
|
|
7824
7836
|
const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
|
|
7837
|
+
const title = str(c["title"], "untitled case");
|
|
7838
|
+
const link = own(c, "traceUrl") ?? void 0;
|
|
7839
|
+
const said = [];
|
|
7840
|
+
const traceUrl = traceUrlOf(link, title, said);
|
|
7841
|
+
if (said.length > 0) {
|
|
7842
|
+
const key = typeof link === "string" ? link.trim() : typeof link;
|
|
7843
|
+
const before = refused.get(key) ?? 0;
|
|
7844
|
+
if (before === 0) notes.push(...said);
|
|
7845
|
+
refused.set(key, before + 1);
|
|
7846
|
+
}
|
|
7825
7847
|
return {
|
|
7826
7848
|
stableId: str(c["stableId"]),
|
|
7827
|
-
title
|
|
7849
|
+
title,
|
|
7828
7850
|
execution: c["execution"] === "manual" ? "manual" : "auto",
|
|
7829
7851
|
steps: steps.length > 0 ? steps : ["(no steps recorded)"],
|
|
7830
7852
|
expected: str(c["expected"], "(no expected result recorded)"),
|
|
7831
7853
|
...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
|
|
7832
|
-
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {}
|
|
7854
|
+
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
|
|
7855
|
+
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
7833
7856
|
};
|
|
7834
7857
|
});
|
|
7858
|
+
for (const times of refused.values()) {
|
|
7859
|
+
if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
|
|
7860
|
+
}
|
|
7861
|
+
return cases;
|
|
7835
7862
|
}
|
|
7836
7863
|
function casesFromApi(report, verdicts) {
|
|
7837
7864
|
const list2 = Array.isArray(report["cases"]) ? report["cases"] : [];
|
|
@@ -7878,9 +7905,9 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
7878
7905
|
}
|
|
7879
7906
|
cases = casesFromApi(report, verdicts);
|
|
7880
7907
|
} else if (mode === "mcp") {
|
|
7881
|
-
cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report) : await casesFromMcp(dir, report);
|
|
7908
|
+
cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report, deps.notes ?? []) : await casesFromMcp(dir, report);
|
|
7882
7909
|
} else {
|
|
7883
|
-
cases = casesFromDesign(report);
|
|
7910
|
+
cases = casesFromDesign(report, deps.notes ?? []);
|
|
7884
7911
|
}
|
|
7885
7912
|
const tokens = own(asRecord(own(report, "cost")), "totalTokens");
|
|
7886
7913
|
return {
|
|
@@ -8127,7 +8154,8 @@ async function handleIngest(deps) {
|
|
|
8127
8154
|
const token = (deps.loadToken ?? loadToken)();
|
|
8128
8155
|
if (token === null) throw new IngestNotLoggedInError();
|
|
8129
8156
|
const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
|
|
8130
|
-
const
|
|
8157
|
+
const notes = [];
|
|
8158
|
+
const payload = await readCairnRun(dir, { notes });
|
|
8131
8159
|
const session = await readCairnSessionFiles(dir).catch(() => void 0);
|
|
8132
8160
|
for (const c of payload.cases) {
|
|
8133
8161
|
const screencasts = session?.screencasts.get(c.stableId);
|
|
@@ -8144,6 +8172,8 @@ async function handleIngest(deps) {
|
|
|
8144
8172
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
8145
8173
|
);
|
|
8146
8174
|
if (files.length > 0) result.files = files;
|
|
8175
|
+
if (sent.repeat) result.repeat = true;
|
|
8176
|
+
if (notes.length > 0) result.notes = notes;
|
|
8147
8177
|
await job.finish({ ok: true });
|
|
8148
8178
|
if (job.problem !== void 0) result.jobProblem = job.problem;
|
|
8149
8179
|
return result;
|
|
@@ -8191,12 +8221,23 @@ function reportIngestFailure(err, write) {
|
|
|
8191
8221
|
return null;
|
|
8192
8222
|
}
|
|
8193
8223
|
function formatIngestResult(r) {
|
|
8224
|
+
const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
|
|
8225
|
+
if (r.repeat === true) {
|
|
8226
|
+
return `${[
|
|
8227
|
+
...r.notes ?? [],
|
|
8228
|
+
`This Cairn run was already ingested \u2192 ${r.runId}`,
|
|
8229
|
+
" nothing new was proposed or attached; a run with a new run id is ingested as new",
|
|
8230
|
+
...files
|
|
8231
|
+
].join("\n")}
|
|
8232
|
+
`;
|
|
8233
|
+
}
|
|
8194
8234
|
const lines = [
|
|
8235
|
+
...r.notes ?? [],
|
|
8195
8236
|
`Ingested Cairn run \u2192 ${r.runId}`,
|
|
8196
8237
|
` ${r.linked} result(s) attached to existing cases`,
|
|
8197
8238
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
8198
8239
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
8199
|
-
...
|
|
8240
|
+
...files
|
|
8200
8241
|
];
|
|
8201
8242
|
return `${lines.join("\n")}
|
|
8202
8243
|
`;
|
package/dist/index.d.cts
CHANGED
|
@@ -1230,6 +1230,10 @@ interface IngestResult {
|
|
|
1230
1230
|
jobProblem?: string;
|
|
1231
1231
|
/** What became of the run's recordings (videos, traces): a count, then a line per reason a file stayed behind. */
|
|
1232
1232
|
files?: string[];
|
|
1233
|
+
/** The platform already held a run for this report's run id (answered 200): the counters are the first ingest's, nothing new was written. */
|
|
1234
|
+
repeat?: true;
|
|
1235
|
+
/** What the reader left out of the payload and why (a trace link the platform would refuse): whole lines, printed first. */
|
|
1236
|
+
notes?: string[];
|
|
1233
1237
|
}
|
|
1234
1238
|
declare function handleIngest(deps: IngestDeps): Promise<IngestResult>;
|
|
1235
1239
|
/**
|
|
@@ -1262,6 +1266,8 @@ interface CairnIngestCase {
|
|
|
1262
1266
|
verdict?: CairnVerdict;
|
|
1263
1267
|
technique?: string;
|
|
1264
1268
|
priority?: string;
|
|
1269
|
+
/** The https address of the run's trace, as the report gives it to the case. Absent when it gives none or the link is refused. */
|
|
1270
|
+
traceUrl?: string;
|
|
1265
1271
|
/** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
|
|
1266
1272
|
screencasts?: CairnScreencast[];
|
|
1267
1273
|
}
|
|
@@ -1305,6 +1311,8 @@ interface EvidenceRecord {
|
|
|
1305
1311
|
interface ReadCairnRunDeps {
|
|
1306
1312
|
/** Injected for tests; returns `undefined` when the run executed nothing and wrote no evidence. */
|
|
1307
1313
|
readEvidence?: (dir: string) => Promise<EvidenceRecord[] | undefined>;
|
|
1314
|
+
/** Lines for the person, filled while reading: what was left out of the payload and why. */
|
|
1315
|
+
notes?: string[];
|
|
1308
1316
|
}
|
|
1309
1317
|
/**
|
|
1310
1318
|
* Read a Cairn run directory into an upload payload, or throw a typed error explaining why not.
|
package/dist/index.d.ts
CHANGED
|
@@ -1230,6 +1230,10 @@ interface IngestResult {
|
|
|
1230
1230
|
jobProblem?: string;
|
|
1231
1231
|
/** What became of the run's recordings (videos, traces): a count, then a line per reason a file stayed behind. */
|
|
1232
1232
|
files?: string[];
|
|
1233
|
+
/** The platform already held a run for this report's run id (answered 200): the counters are the first ingest's, nothing new was written. */
|
|
1234
|
+
repeat?: true;
|
|
1235
|
+
/** What the reader left out of the payload and why (a trace link the platform would refuse): whole lines, printed first. */
|
|
1236
|
+
notes?: string[];
|
|
1233
1237
|
}
|
|
1234
1238
|
declare function handleIngest(deps: IngestDeps): Promise<IngestResult>;
|
|
1235
1239
|
/**
|
|
@@ -1262,6 +1266,8 @@ interface CairnIngestCase {
|
|
|
1262
1266
|
verdict?: CairnVerdict;
|
|
1263
1267
|
technique?: string;
|
|
1264
1268
|
priority?: string;
|
|
1269
|
+
/** The https address of the run's trace, as the report gives it to the case. Absent when it gives none or the link is refused. */
|
|
1270
|
+
traceUrl?: string;
|
|
1265
1271
|
/** The case's recordings, from `screencasts/screencasts.json`. Absent when the run recorded none for it. */
|
|
1266
1272
|
screencasts?: CairnScreencast[];
|
|
1267
1273
|
}
|
|
@@ -1305,6 +1311,8 @@ interface EvidenceRecord {
|
|
|
1305
1311
|
interface ReadCairnRunDeps {
|
|
1306
1312
|
/** Injected for tests; returns `undefined` when the run executed nothing and wrote no evidence. */
|
|
1307
1313
|
readEvidence?: (dir: string) => Promise<EvidenceRecord[] | undefined>;
|
|
1314
|
+
/** Lines for the person, filled while reading: what was left out of the payload and why. */
|
|
1315
|
+
notes?: string[];
|
|
1308
1316
|
}
|
|
1309
1317
|
/**
|
|
1310
1318
|
* Read a Cairn run directory into an upload payload, or throw a typed error explaining why not.
|
package/dist/index.js
CHANGED
|
@@ -5451,7 +5451,7 @@ var TYPE_BY_EXTENSION = {
|
|
|
5451
5451
|
".jpeg": "image/jpeg",
|
|
5452
5452
|
".webp": "image/webp"
|
|
5453
5453
|
};
|
|
5454
|
-
var
|
|
5454
|
+
var READ_NOT_KEPT = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
5455
5455
|
var NAME_MAX = 200;
|
|
5456
5456
|
function nameOf(file) {
|
|
5457
5457
|
const own2 = file.name.split(/[\\/]/).pop()?.trim() || (file.path === void 0 ? "" : basename3(file.path));
|
|
@@ -5918,7 +5918,7 @@ function fileSender(options) {
|
|
|
5918
5918
|
if (item?.status !== "accepted" || typeof item.id !== "string" || typeof item.resultKey !== "string") continue;
|
|
5919
5919
|
for (const file of filesByKey.get(item.resultKey) ?? []) {
|
|
5920
5920
|
const type = mediaTypeOf(file.contentType) ?? (file.path === void 0 ? void 0 : TYPE_BY_EXTENSION[extname(file.path).toLowerCase()]);
|
|
5921
|
-
if (type === void 0 || type
|
|
5921
|
+
if (type === void 0 || READ_NOT_KEPT.has(type)) continue;
|
|
5922
5922
|
const kind = kindOf2(type);
|
|
5923
5923
|
if (kind !== "text" && file.path === void 0) continue;
|
|
5924
5924
|
const name = nameOf(file);
|
|
@@ -5970,6 +5970,17 @@ init_esm_shims();
|
|
|
5970
5970
|
import * as fs8 from "fs/promises";
|
|
5971
5971
|
import * as path10 from "path";
|
|
5972
5972
|
|
|
5973
|
+
// src/importers/trace-url.ts
|
|
5974
|
+
init_esm_shims();
|
|
5975
|
+
init_failure_detail();
|
|
5976
|
+
function traceUrlOf(value, title, notes) {
|
|
5977
|
+
if (value === void 0 || typeof value === "string" && value.trim() === "") return void 0;
|
|
5978
|
+
const problem = traceUrlProblem(value);
|
|
5979
|
+
if (problem === void 0) return value.trim();
|
|
5980
|
+
notes.push(`plune: ${JSON.stringify(printable(title))}: trace link not sent (${problem}) \u2014 the result is imported without it.`);
|
|
5981
|
+
return void 0;
|
|
5982
|
+
}
|
|
5983
|
+
|
|
5973
5984
|
// src/mcp-testing/scan/config/config.ts
|
|
5974
5985
|
init_esm_shims();
|
|
5975
5986
|
|
|
@@ -7779,21 +7790,37 @@ async function defaultReadEvidence(dir) {
|
|
|
7779
7790
|
return { name: str(rec["name"]), passed: rec["passed"] === true, ...error !== "" ? { error } : {} };
|
|
7780
7791
|
});
|
|
7781
7792
|
}
|
|
7782
|
-
function casesFromDesign(report) {
|
|
7793
|
+
function casesFromDesign(report, notes) {
|
|
7783
7794
|
const list2 = Array.isArray(report["testCases"]) ? report["testCases"] : [];
|
|
7784
|
-
|
|
7795
|
+
const refused = /* @__PURE__ */ new Map();
|
|
7796
|
+
const cases = list2.map((raw) => {
|
|
7785
7797
|
const c = asRecord(raw);
|
|
7786
7798
|
const steps = (Array.isArray(c["steps"]) ? c["steps"] : []).map((s) => str(s)).filter((s) => s !== "");
|
|
7799
|
+
const title = str(c["title"], "untitled case");
|
|
7800
|
+
const link = own(c, "traceUrl") ?? void 0;
|
|
7801
|
+
const said = [];
|
|
7802
|
+
const traceUrl = traceUrlOf(link, title, said);
|
|
7803
|
+
if (said.length > 0) {
|
|
7804
|
+
const key = typeof link === "string" ? link.trim() : typeof link;
|
|
7805
|
+
const before = refused.get(key) ?? 0;
|
|
7806
|
+
if (before === 0) notes.push(...said);
|
|
7807
|
+
refused.set(key, before + 1);
|
|
7808
|
+
}
|
|
7787
7809
|
return {
|
|
7788
7810
|
stableId: str(c["stableId"]),
|
|
7789
|
-
title
|
|
7811
|
+
title,
|
|
7790
7812
|
execution: c["execution"] === "manual" ? "manual" : "auto",
|
|
7791
7813
|
steps: steps.length > 0 ? steps : ["(no steps recorded)"],
|
|
7792
7814
|
expected: str(c["expected"], "(no expected result recorded)"),
|
|
7793
7815
|
...typeof c["technique"] === "string" ? { technique: c["technique"] } : {},
|
|
7794
|
-
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {}
|
|
7816
|
+
...typeof c["priority"] === "string" ? { priority: c["priority"] } : {},
|
|
7817
|
+
...traceUrl !== void 0 ? { traceUrl } : {}
|
|
7795
7818
|
};
|
|
7796
7819
|
});
|
|
7820
|
+
for (const times of refused.values()) {
|
|
7821
|
+
if (times > 1) notes.push(`plune: ${times - 1} more case(s) carry the same trace link \u2014 sent without it.`);
|
|
7822
|
+
}
|
|
7823
|
+
return cases;
|
|
7797
7824
|
}
|
|
7798
7825
|
function casesFromApi(report, verdicts) {
|
|
7799
7826
|
const list2 = Array.isArray(report["cases"]) ? report["cases"] : [];
|
|
@@ -7840,9 +7867,9 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
7840
7867
|
}
|
|
7841
7868
|
cases = casesFromApi(report, verdicts);
|
|
7842
7869
|
} else if (mode === "mcp") {
|
|
7843
|
-
cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report) : await casesFromMcp(dir, report);
|
|
7870
|
+
cases = own(report, "cases") === void 0 && Array.isArray(own(report, "testCases")) ? casesFromDesign(report, deps.notes ?? []) : await casesFromMcp(dir, report);
|
|
7844
7871
|
} else {
|
|
7845
|
-
cases = casesFromDesign(report);
|
|
7872
|
+
cases = casesFromDesign(report, deps.notes ?? []);
|
|
7846
7873
|
}
|
|
7847
7874
|
const tokens = own(asRecord(own(report, "cost")), "totalTokens");
|
|
7848
7875
|
return {
|
|
@@ -8089,7 +8116,8 @@ async function handleIngest(deps) {
|
|
|
8089
8116
|
const token = (deps.loadToken ?? loadToken)();
|
|
8090
8117
|
if (token === null) throw new IngestNotLoggedInError();
|
|
8091
8118
|
const dir = deps.dir ?? await findLatestCairnRun(deps.runsDir);
|
|
8092
|
-
const
|
|
8119
|
+
const notes = [];
|
|
8120
|
+
const payload = await readCairnRun(dir, { notes });
|
|
8093
8121
|
const session = await readCairnSessionFiles(dir).catch(() => void 0);
|
|
8094
8122
|
for (const c of payload.cases) {
|
|
8095
8123
|
const screencasts = session?.screencasts.get(c.stableId);
|
|
@@ -8106,6 +8134,8 @@ async function handleIngest(deps) {
|
|
|
8106
8134
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
8107
8135
|
);
|
|
8108
8136
|
if (files.length > 0) result.files = files;
|
|
8137
|
+
if (sent.repeat) result.repeat = true;
|
|
8138
|
+
if (notes.length > 0) result.notes = notes;
|
|
8109
8139
|
await job.finish({ ok: true });
|
|
8110
8140
|
if (job.problem !== void 0) result.jobProblem = job.problem;
|
|
8111
8141
|
return result;
|
|
@@ -8153,12 +8183,23 @@ function reportIngestFailure(err, write) {
|
|
|
8153
8183
|
return null;
|
|
8154
8184
|
}
|
|
8155
8185
|
function formatIngestResult(r) {
|
|
8186
|
+
const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
|
|
8187
|
+
if (r.repeat === true) {
|
|
8188
|
+
return `${[
|
|
8189
|
+
...r.notes ?? [],
|
|
8190
|
+
`This Cairn run was already ingested \u2192 ${r.runId}`,
|
|
8191
|
+
" nothing new was proposed or attached; a run with a new run id is ingested as new",
|
|
8192
|
+
...files
|
|
8193
|
+
].join("\n")}
|
|
8194
|
+
`;
|
|
8195
|
+
}
|
|
8156
8196
|
const lines = [
|
|
8197
|
+
...r.notes ?? [],
|
|
8157
8198
|
`Ingested Cairn run \u2192 ${r.runId}`,
|
|
8158
8199
|
` ${r.linked} result(s) attached to existing cases`,
|
|
8159
8200
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
8160
8201
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
8161
|
-
...
|
|
8202
|
+
...files
|
|
8162
8203
|
];
|
|
8163
8204
|
return `${lines.join("\n")}
|
|
8164
8205
|
`;
|
package/dist/mcp-http.cjs
CHANGED
|
@@ -1217,6 +1217,13 @@ function toResult(outcome) {
|
|
|
1217
1217
|
structuredContent: { error: outcome.error }
|
|
1218
1218
|
};
|
|
1219
1219
|
}
|
|
1220
|
+
var readOnlyRefusal = (name) => ({
|
|
1221
|
+
ok: false,
|
|
1222
|
+
error: {
|
|
1223
|
+
code: "read_only_token",
|
|
1224
|
+
message: `This connection has read-only access: ${name} writes. Ask the person to reconnect with read and write access.`
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1220
1227
|
function createPluneMcpServer(opts, era, traits = {}) {
|
|
1221
1228
|
const { version, ...executorOptions } = opts;
|
|
1222
1229
|
const listChanged = traits.listChanged ?? true;
|
|
@@ -1236,8 +1243,15 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1236
1243
|
else if (!visible.has(name) && tool.enabled) tool.disable();
|
|
1237
1244
|
}
|
|
1238
1245
|
};
|
|
1246
|
+
let refusesWriters = false;
|
|
1239
1247
|
for (const tool of PLUNE_TOOLS) {
|
|
1240
|
-
if (!offeredTo(tool, opts.scope))
|
|
1248
|
+
if (!offeredTo(tool, opts.scope)) {
|
|
1249
|
+
if (tool.write) {
|
|
1250
|
+
server.registerTool(tool.name, { description: tool.description }, () => toResult(readOnlyRefusal(tool.name)));
|
|
1251
|
+
refusesWriters = true;
|
|
1252
|
+
}
|
|
1253
|
+
continue;
|
|
1254
|
+
}
|
|
1241
1255
|
const handle = server.registerTool(
|
|
1242
1256
|
tool.name,
|
|
1243
1257
|
{
|
|
@@ -1258,7 +1272,13 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1258
1272
|
if (fixed) {
|
|
1259
1273
|
const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
|
|
1260
1274
|
server.server.setRequestHandler("tools/list", () => ({ tools }));
|
|
1261
|
-
} else
|
|
1275
|
+
} else {
|
|
1276
|
+
sync();
|
|
1277
|
+
if (refusesWriters)
|
|
1278
|
+
server.server.setRequestHandler("tools/list", () => ({
|
|
1279
|
+
tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
|
|
1280
|
+
}));
|
|
1281
|
+
}
|
|
1262
1282
|
return server;
|
|
1263
1283
|
}
|
|
1264
1284
|
|
package/dist/mcp-http.js
CHANGED
|
@@ -1193,6 +1193,13 @@ function toResult(outcome) {
|
|
|
1193
1193
|
structuredContent: { error: outcome.error }
|
|
1194
1194
|
};
|
|
1195
1195
|
}
|
|
1196
|
+
var readOnlyRefusal = (name) => ({
|
|
1197
|
+
ok: false,
|
|
1198
|
+
error: {
|
|
1199
|
+
code: "read_only_token",
|
|
1200
|
+
message: `This connection has read-only access: ${name} writes. Ask the person to reconnect with read and write access.`
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1196
1203
|
function createPluneMcpServer(opts, era, traits = {}) {
|
|
1197
1204
|
const { version, ...executorOptions } = opts;
|
|
1198
1205
|
const listChanged = traits.listChanged ?? true;
|
|
@@ -1212,8 +1219,15 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1212
1219
|
else if (!visible.has(name) && tool.enabled) tool.disable();
|
|
1213
1220
|
}
|
|
1214
1221
|
};
|
|
1222
|
+
let refusesWriters = false;
|
|
1215
1223
|
for (const tool of PLUNE_TOOLS) {
|
|
1216
|
-
if (!offeredTo(tool, opts.scope))
|
|
1224
|
+
if (!offeredTo(tool, opts.scope)) {
|
|
1225
|
+
if (tool.write) {
|
|
1226
|
+
server.registerTool(tool.name, { description: tool.description }, () => toResult(readOnlyRefusal(tool.name)));
|
|
1227
|
+
refusesWriters = true;
|
|
1228
|
+
}
|
|
1229
|
+
continue;
|
|
1230
|
+
}
|
|
1217
1231
|
const handle = server.registerTool(
|
|
1218
1232
|
tool.name,
|
|
1219
1233
|
{
|
|
@@ -1234,7 +1248,13 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
1234
1248
|
if (fixed) {
|
|
1235
1249
|
const tools = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
|
|
1236
1250
|
server.server.setRequestHandler("tools/list", () => ({ tools }));
|
|
1237
|
-
} else
|
|
1251
|
+
} else {
|
|
1252
|
+
sync();
|
|
1253
|
+
if (refusesWriters)
|
|
1254
|
+
server.server.setRequestHandler("tools/list", () => ({
|
|
1255
|
+
tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
|
|
1256
|
+
}));
|
|
1257
|
+
}
|
|
1238
1258
|
return server;
|
|
1239
1259
|
}
|
|
1240
1260
|
|
package/dist/reporter-core.cjs
CHANGED
|
@@ -40,6 +40,7 @@ __export(reporter_core_exports, {
|
|
|
40
40
|
errorContextOf: () => errorContextOf,
|
|
41
41
|
failureOf: () => failureOf,
|
|
42
42
|
filesOf: () => filesOf,
|
|
43
|
+
maskCredentials: () => maskCredentials,
|
|
43
44
|
readEnv: () => readEnv,
|
|
44
45
|
repoRootOf: () => repoRootOf,
|
|
45
46
|
resultKey: () => resultKey,
|
|
@@ -456,7 +457,7 @@ function failureOf(attempt, home = (0, import_node_os2.homedir)()) {
|
|
|
456
457
|
const headline = line !== void 0 && jsonBytes(line) <= HEADLINE_LIMIT ? line : void 0;
|
|
457
458
|
const steps = chainOf(attempt.steps);
|
|
458
459
|
const location = error === void 0 ? void 0 : fromRoot(placeOf(error, attempt.testFile), attempt.repoRoot);
|
|
459
|
-
const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && a.contentType
|
|
460
|
+
const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && !READ_NOT_KEPT.has(a.contentType ?? "")).map(({ name, contentType }) => ({ name: fileNameOf(name), ...contentType ? { contentType } : {} })).filter((a) => a.name !== "");
|
|
460
461
|
const ciUrl = webLink(attempt.buildHref);
|
|
461
462
|
const failure = {
|
|
462
463
|
...headline !== void 0 ? { headline } : {},
|
|
@@ -532,7 +533,7 @@ function cut(text) {
|
|
|
532
533
|
return { text: [...lines.slice(0, head), omitted(tail - head), ...lines.slice(tail)].join("\n"), omitted: text.length - kept.length };
|
|
533
534
|
}
|
|
534
535
|
var omitted = (lines) => `\u2026[omitted ${lines} lines]\u2026`;
|
|
535
|
-
var
|
|
536
|
+
var READ_NOT_KEPT = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
536
537
|
var REPO_RELATIVE = /^(?![A-Za-z][A-Za-z0-9+.-]*:)(?![\\/~])(?!(?:.*[\\/])?\.\.(?:[\\/]|$)).+$/;
|
|
537
538
|
var FRAME = /^\s+at (?:.*? \()?(.+?):(\d+):(\d+)\)?$/;
|
|
538
539
|
var FRAME_MAX = 8192;
|
|
@@ -842,7 +843,7 @@ var TYPE_BY_EXTENSION = {
|
|
|
842
843
|
".jpeg": "image/jpeg",
|
|
843
844
|
".webp": "image/webp"
|
|
844
845
|
};
|
|
845
|
-
var
|
|
846
|
+
var READ_NOT_KEPT2 = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
846
847
|
var NAME_MAX = 200;
|
|
847
848
|
function nameOf(file) {
|
|
848
849
|
const own = file.name.split(/[\\/]/).pop()?.trim() || (file.path === void 0 ? "" : (0, import_node_path3.basename)(file.path));
|
|
@@ -908,8 +909,13 @@ function withoutTargets(result) {
|
|
|
908
909
|
const { targets: _targets, traceUrl: _traceUrl, ...rest } = result;
|
|
909
910
|
return rest;
|
|
910
911
|
}
|
|
912
|
+
function withoutFindings(result) {
|
|
913
|
+
if (result.findings === void 0) return result;
|
|
914
|
+
const { findings: _findings, ...rest } = result;
|
|
915
|
+
return rest;
|
|
916
|
+
}
|
|
911
917
|
function onDisk(deferred) {
|
|
912
|
-
const result = withoutTargets(deferred);
|
|
918
|
+
const result = withoutFindings(withoutTargets(deferred));
|
|
913
919
|
if (!("files" in result) || result.files === void 0) return result;
|
|
914
920
|
const { files, ...rest } = result;
|
|
915
921
|
const kept = files.filter((f) => f.path !== void 0).map(({ body: _body, ...file }) => file);
|
|
@@ -1359,7 +1365,7 @@ function fileSender(options) {
|
|
|
1359
1365
|
if (item?.status !== "accepted" || typeof item.id !== "string" || typeof item.resultKey !== "string") continue;
|
|
1360
1366
|
for (const file of filesByKey.get(item.resultKey) ?? []) {
|
|
1361
1367
|
const type = mediaTypeOf(file.contentType) ?? (file.path === void 0 ? void 0 : TYPE_BY_EXTENSION[(0, import_node_path3.extname)(file.path).toLowerCase()]);
|
|
1362
|
-
if (type === void 0 || type
|
|
1368
|
+
if (type === void 0 || READ_NOT_KEPT2.has(type)) continue;
|
|
1363
1369
|
const kind = kindOf(type);
|
|
1364
1370
|
if (kind !== "text" && file.path === void 0) continue;
|
|
1365
1371
|
const name = nameOf(file);
|
|
@@ -1462,6 +1468,7 @@ async function startRun(passed, declared) {
|
|
|
1462
1468
|
let joined = false;
|
|
1463
1469
|
let offline = token === "";
|
|
1464
1470
|
let targetsRefused = false;
|
|
1471
|
+
let findingsRefused = false;
|
|
1465
1472
|
let done = false;
|
|
1466
1473
|
const shortened = /* @__PURE__ */ new Set();
|
|
1467
1474
|
const specFiles = /* @__PURE__ */ new Map();
|
|
@@ -1733,6 +1740,7 @@ async function startRun(passed, declared) {
|
|
|
1733
1740
|
async function send(submissions, filesByKey) {
|
|
1734
1741
|
for (const packedPart of packed(submissions)) {
|
|
1735
1742
|
let part = targetsRefused ? packedPart.map(withoutTargets) : packedPart;
|
|
1743
|
+
if (findingsRefused) part = part.map(withoutFindings);
|
|
1736
1744
|
if (offline) {
|
|
1737
1745
|
defer(part);
|
|
1738
1746
|
continue;
|
|
@@ -1743,12 +1751,22 @@ async function startRun(passed, declared) {
|
|
|
1743
1751
|
{ results, ...configuration !== void 0 ? { configuration } : {} }
|
|
1744
1752
|
);
|
|
1745
1753
|
let out = await post(part);
|
|
1754
|
+
let withoutItsFindings = false;
|
|
1755
|
+
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.findings !== void 0)) {
|
|
1756
|
+
withoutItsFindings = true;
|
|
1757
|
+
part = part.map(withoutFindings);
|
|
1758
|
+
out = await post(part);
|
|
1759
|
+
}
|
|
1746
1760
|
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0 || r.traceUrl !== void 0)) {
|
|
1747
1761
|
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.");
|
|
1748
1762
|
targetsRefused = true;
|
|
1749
1763
|
part = part.map(withoutTargets);
|
|
1750
1764
|
out = await post(part);
|
|
1751
1765
|
}
|
|
1766
|
+
if (withoutItsFindings && out.ok) {
|
|
1767
|
+
if (!findingsRefused) log("plune: the platform does not take findings on a result yet \u2014 the results are sent without them.");
|
|
1768
|
+
findingsRefused = true;
|
|
1769
|
+
}
|
|
1752
1770
|
const counts = out.ok ? out.body?.counts : void 0;
|
|
1753
1771
|
const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
|
|
1754
1772
|
if (told.length > 0) {
|
|
@@ -1947,6 +1965,7 @@ function resultKey(testId, retry) {
|
|
|
1947
1965
|
errorContextOf,
|
|
1948
1966
|
failureOf,
|
|
1949
1967
|
filesOf,
|
|
1968
|
+
maskCredentials,
|
|
1950
1969
|
readEnv,
|
|
1951
1970
|
repoRootOf,
|
|
1952
1971
|
resultKey,
|
package/dist/reporter-core.d.cts
CHANGED
|
@@ -233,6 +233,34 @@ interface PendingResult {
|
|
|
233
233
|
* `traceUrlProblem`. Absent rather than empty; a platform older than the field is handled as for `targets`.
|
|
234
234
|
*/
|
|
235
235
|
traceUrl?: string;
|
|
236
|
+
/**
|
|
237
|
+
* What the browser reported during the attempt. Absent means not collected; an empty list means collected and
|
|
238
|
+
* nothing found. A platform older than the field is handled as for `targets`.
|
|
239
|
+
*/
|
|
240
|
+
findings?: ResultFindings;
|
|
241
|
+
}
|
|
242
|
+
/** Where in the test a finding belongs: a declared step, by its position from 1 and its title. */
|
|
243
|
+
interface FindingStep {
|
|
244
|
+
index: number;
|
|
245
|
+
title: string;
|
|
246
|
+
}
|
|
247
|
+
/** One thing the browser reported. The platform's objects are strict: no key beyond these. */
|
|
248
|
+
type Finding = {
|
|
249
|
+
kind: 'console' | 'page_error';
|
|
250
|
+
text: string;
|
|
251
|
+
step?: FindingStep;
|
|
252
|
+
} | {
|
|
253
|
+
kind: 'request_failed' | 'request_slow';
|
|
254
|
+
method: string;
|
|
255
|
+
path: string;
|
|
256
|
+
status?: number;
|
|
257
|
+
durationMs?: number;
|
|
258
|
+
step?: FindingStep;
|
|
259
|
+
};
|
|
260
|
+
/** At most 20 findings, and how many more were seen and not sent. */
|
|
261
|
+
interface ResultFindings {
|
|
262
|
+
items: Finding[];
|
|
263
|
+
omitted: number;
|
|
236
264
|
}
|
|
237
265
|
/**
|
|
238
266
|
* What a failed attempt says about itself on the run page: every field
|
|
@@ -692,4 +720,13 @@ declare function filesOf(attempt: FailedAttempt): ResultFile[];
|
|
|
692
720
|
*/
|
|
693
721
|
declare function webLink(href: string | undefined): string | undefined;
|
|
694
722
|
|
|
695
|
-
|
|
723
|
+
/**
|
|
724
|
+
* The text with every credential replaced by a `‹role›` marker, the shape the platform's own masking
|
|
725
|
+
* uses: by its form (a key, a token, a private key block, the value of an `Authorization` scheme), by
|
|
726
|
+
* its place (a value given to something named for a credential, typed into a field that is, a header
|
|
727
|
+
* line, a URL parameter, a `PLUNE_` variable), and the user:password of a URL. The platform masks
|
|
728
|
+
* again before a draft; this is so that the secret never leaves the machine.
|
|
729
|
+
*/
|
|
730
|
+
declare function maskCredentials(text: string): string;
|
|
731
|
+
|
|
732
|
+
export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type Finding, type FindingStep, type FrozenSummary, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultFindings, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextFields, errorContextOf, failureOf, filesOf, maskCredentials, readEnv, repoRootOf, resultKey, startRun, webLink };
|
package/dist/reporter-core.d.ts
CHANGED
|
@@ -233,6 +233,34 @@ interface PendingResult {
|
|
|
233
233
|
* `traceUrlProblem`. Absent rather than empty; a platform older than the field is handled as for `targets`.
|
|
234
234
|
*/
|
|
235
235
|
traceUrl?: string;
|
|
236
|
+
/**
|
|
237
|
+
* What the browser reported during the attempt. Absent means not collected; an empty list means collected and
|
|
238
|
+
* nothing found. A platform older than the field is handled as for `targets`.
|
|
239
|
+
*/
|
|
240
|
+
findings?: ResultFindings;
|
|
241
|
+
}
|
|
242
|
+
/** Where in the test a finding belongs: a declared step, by its position from 1 and its title. */
|
|
243
|
+
interface FindingStep {
|
|
244
|
+
index: number;
|
|
245
|
+
title: string;
|
|
246
|
+
}
|
|
247
|
+
/** One thing the browser reported. The platform's objects are strict: no key beyond these. */
|
|
248
|
+
type Finding = {
|
|
249
|
+
kind: 'console' | 'page_error';
|
|
250
|
+
text: string;
|
|
251
|
+
step?: FindingStep;
|
|
252
|
+
} | {
|
|
253
|
+
kind: 'request_failed' | 'request_slow';
|
|
254
|
+
method: string;
|
|
255
|
+
path: string;
|
|
256
|
+
status?: number;
|
|
257
|
+
durationMs?: number;
|
|
258
|
+
step?: FindingStep;
|
|
259
|
+
};
|
|
260
|
+
/** At most 20 findings, and how many more were seen and not sent. */
|
|
261
|
+
interface ResultFindings {
|
|
262
|
+
items: Finding[];
|
|
263
|
+
omitted: number;
|
|
236
264
|
}
|
|
237
265
|
/**
|
|
238
266
|
* What a failed attempt says about itself on the run page: every field
|
|
@@ -692,4 +720,13 @@ declare function filesOf(attempt: FailedAttempt): ResultFile[];
|
|
|
692
720
|
*/
|
|
693
721
|
declare function webLink(href: string | undefined): string | undefined;
|
|
694
722
|
|
|
695
|
-
|
|
723
|
+
/**
|
|
724
|
+
* The text with every credential replaced by a `‹role›` marker, the shape the platform's own masking
|
|
725
|
+
* uses: by its form (a key, a token, a private key block, the value of an `Authorization` scheme), by
|
|
726
|
+
* its place (a value given to something named for a credential, typed into a field that is, a header
|
|
727
|
+
* line, a URL parameter, a `PLUNE_` variable), and the user:password of a URL. The platform masks
|
|
728
|
+
* again before a draft; this is so that the secret never leaves the machine.
|
|
729
|
+
*/
|
|
730
|
+
declare function maskCredentials(text: string): string;
|
|
731
|
+
|
|
732
|
+
export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type Finding, type FindingStep, type FrozenSummary, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultFindings, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextFields, errorContextOf, failureOf, filesOf, maskCredentials, readEnv, repoRootOf, resultKey, startRun, webLink };
|