@plune-ai/cli 0.39.9 → 0.39.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +58 -11
- package/dist/index.cjs +13 -3
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -3
- 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/cli.cjs
CHANGED
|
@@ -4276,7 +4276,7 @@ function failureOf(attempt, home = (0, import_node_os.homedir)()) {
|
|
|
4276
4276
|
const headline2 = line !== void 0 && jsonBytes(line) <= HEADLINE_LIMIT ? line : void 0;
|
|
4277
4277
|
const steps = chainOf(attempt.steps);
|
|
4278
4278
|
const location = error === void 0 ? void 0 : fromRoot(placeOf(error, attempt.testFile), attempt.repoRoot);
|
|
4279
|
-
const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && a.contentType
|
|
4279
|
+
const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && !READ_NOT_KEPT.has(a.contentType ?? "")).map(({ name, contentType: contentType2 }) => ({ name: fileNameOf(name), ...contentType2 ? { contentType: contentType2 } : {} })).filter((a) => a.name !== "");
|
|
4280
4280
|
const ciUrl = webLink(attempt.buildHref);
|
|
4281
4281
|
const failure2 = {
|
|
4282
4282
|
...headline2 !== void 0 ? { headline: headline2 } : {},
|
|
@@ -4387,7 +4387,7 @@ function fromRoot(place, root) {
|
|
|
4387
4387
|
function webLink(href) {
|
|
4388
4388
|
return href !== void 0 && /^https?:\/\//i.test(href) && URL.canParse(href) ? href : void 0;
|
|
4389
4389
|
}
|
|
4390
|
-
var import_node_fs2, import_node_os, import_node_path3, import_node_util, printable, mediaTypeOf, TEXT_TYPES, isTextType, PATH_START, TEXT_LIMIT, HEADLINE_LIMIT, jsonBytes, ANY_HOME, fileNameOf, omitted,
|
|
4390
|
+
var import_node_fs2, import_node_os, import_node_path3, import_node_util, printable, mediaTypeOf, TEXT_TYPES, isTextType, PATH_START, TEXT_LIMIT, HEADLINE_LIMIT, jsonBytes, ANY_HOME, fileNameOf, omitted, READ_NOT_KEPT, REPO_RELATIVE, FRAME, FRAME_MAX, firstLine, normal;
|
|
4391
4391
|
var init_failure_detail = __esm({
|
|
4392
4392
|
"src/reporter-core/failure-detail.ts"() {
|
|
4393
4393
|
"use strict";
|
|
@@ -4407,7 +4407,7 @@ var init_failure_detail = __esm({
|
|
|
4407
4407
|
ANY_HOME = /(?<=^|[\s'"`(=,[])(?:(?:file|webpack|webpack-internal):(?:\\*\/){2,3})?(?:\\*\/home\\*\/|\\*\/Users\\*\/|[A-Za-z]:[\\/]+Users[\\/]+)[^\\/\s'"`:*?<>|]+/g;
|
|
4408
4408
|
fileNameOf = (name) => /^(?:file:\/\/|[\\/]|~[\\/]|[A-Za-z]:[\\/])/.test(name) ? name.split(/[\\/]/).pop() ?? "" : name;
|
|
4409
4409
|
omitted = (lines) => `\u2026[omitted ${lines} lines]\u2026`;
|
|
4410
|
-
|
|
4410
|
+
READ_NOT_KEPT = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
4411
4411
|
REPO_RELATIVE = /^(?![A-Za-z][A-Za-z0-9+.-]*:)(?![\\/~])(?!(?:.*[\\/])?\.\.(?:[\\/]|$)).+$/;
|
|
4412
4412
|
FRAME = /^\s+at (?:.*? \()?(.+?):(\d+):(\d+)\)?$/;
|
|
4413
4413
|
FRAME_MAX = 8192;
|
|
@@ -9574,8 +9574,13 @@ function withoutTargets(result2) {
|
|
|
9574
9574
|
const { targets: _targets, traceUrl: _traceUrl, ...rest } = result2;
|
|
9575
9575
|
return rest;
|
|
9576
9576
|
}
|
|
9577
|
+
function withoutFindings(result2) {
|
|
9578
|
+
if (result2.findings === void 0) return result2;
|
|
9579
|
+
const { findings: _findings, ...rest } = result2;
|
|
9580
|
+
return rest;
|
|
9581
|
+
}
|
|
9577
9582
|
function onDisk(deferred) {
|
|
9578
|
-
const result2 = withoutTargets(deferred);
|
|
9583
|
+
const result2 = withoutFindings(withoutTargets(deferred));
|
|
9579
9584
|
if (!("files" in result2) || result2.files === void 0) return result2;
|
|
9580
9585
|
const { files, ...rest } = result2;
|
|
9581
9586
|
const kept = files.filter((f) => f.path !== void 0).map(({ body: _body, ...file }) => file);
|
|
@@ -10022,7 +10027,7 @@ function fileSender(options) {
|
|
|
10022
10027
|
if (item?.status !== "accepted" || typeof item.id !== "string" || typeof item.resultKey !== "string") continue;
|
|
10023
10028
|
for (const file of filesByKey.get(item.resultKey) ?? []) {
|
|
10024
10029
|
const type = mediaTypeOf(file.contentType) ?? (file.path === void 0 ? void 0 : TYPE_BY_EXTENSION[(0, import_node_path5.extname)(file.path).toLowerCase()]);
|
|
10025
|
-
if (type === void 0 || type
|
|
10030
|
+
if (type === void 0 || READ_NOT_KEPT2.has(type)) continue;
|
|
10026
10031
|
const kind2 = kindOf3(type);
|
|
10027
10032
|
if (kind2 !== "text" && file.path === void 0) continue;
|
|
10028
10033
|
const name = nameOf(file);
|
|
@@ -10125,6 +10130,7 @@ async function startRun(passed2, declared2) {
|
|
|
10125
10130
|
let joined = false;
|
|
10126
10131
|
let offline = token2 === "";
|
|
10127
10132
|
let targetsRefused = false;
|
|
10133
|
+
let findingsRefused = false;
|
|
10128
10134
|
let done = false;
|
|
10129
10135
|
const shortened = /* @__PURE__ */ new Set();
|
|
10130
10136
|
const specFiles = /* @__PURE__ */ new Map();
|
|
@@ -10396,6 +10402,7 @@ async function startRun(passed2, declared2) {
|
|
|
10396
10402
|
async function send3(submissions, filesByKey) {
|
|
10397
10403
|
for (const packedPart of packed(submissions)) {
|
|
10398
10404
|
let part = targetsRefused ? packedPart.map(withoutTargets) : packedPart;
|
|
10405
|
+
if (findingsRefused) part = part.map(withoutFindings);
|
|
10399
10406
|
if (offline) {
|
|
10400
10407
|
defer(part);
|
|
10401
10408
|
continue;
|
|
@@ -10406,12 +10413,22 @@ async function startRun(passed2, declared2) {
|
|
|
10406
10413
|
{ results: results4, ...configuration !== void 0 ? { configuration } : {} }
|
|
10407
10414
|
);
|
|
10408
10415
|
let out = await post(part);
|
|
10416
|
+
let withoutItsFindings = false;
|
|
10417
|
+
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.findings !== void 0)) {
|
|
10418
|
+
withoutItsFindings = true;
|
|
10419
|
+
part = part.map(withoutFindings);
|
|
10420
|
+
out = await post(part);
|
|
10421
|
+
}
|
|
10409
10422
|
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0 || r.traceUrl !== void 0)) {
|
|
10410
10423
|
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.");
|
|
10411
10424
|
targetsRefused = true;
|
|
10412
10425
|
part = part.map(withoutTargets);
|
|
10413
10426
|
out = await post(part);
|
|
10414
10427
|
}
|
|
10428
|
+
if (withoutItsFindings && out.ok) {
|
|
10429
|
+
if (!findingsRefused) log("plune: the platform does not take findings on a result yet \u2014 the results are sent without them.");
|
|
10430
|
+
findingsRefused = true;
|
|
10431
|
+
}
|
|
10415
10432
|
const counts3 = out.ok ? out.body?.counts : void 0;
|
|
10416
10433
|
const told = COUNTED.filter((k) => typeof counts3?.[k] === "number");
|
|
10417
10434
|
if (told.length > 0) {
|
|
@@ -10584,7 +10601,7 @@ async function startRun(passed2, declared2) {
|
|
|
10584
10601
|
}
|
|
10585
10602
|
};
|
|
10586
10603
|
}
|
|
10587
|
-
var import_node_crypto4, import_node_fs9, import_node_path5, import_node_util2, RESOLVE_CHUNK, BATCH_MAX, DISCOVER_MAX, BATCH_DEFAULT, SNAPSHOT_UPDATES_MAX, SEND_CONCURRENCY, EXPECTED_MAX, KEY_MAX, TITLE_MAX, COUNTED, SCREENSHOT_TYPES, SCREENSHOT_BYTES, SCREENSHOTS_PER_RESULT, TEXT_BYTES, TEXTS_PER_RESULT, UTF8, TYPE_BY_EXTENSION,
|
|
10604
|
+
var import_node_crypto4, import_node_fs9, import_node_path5, import_node_util2, RESOLVE_CHUNK, BATCH_MAX, DISCOVER_MAX, BATCH_DEFAULT, SNAPSHOT_UPDATES_MAX, SEND_CONCURRENCY, EXPECTED_MAX, KEY_MAX, TITLE_MAX, COUNTED, SCREENSHOT_TYPES, SCREENSHOT_BYTES, SCREENSHOTS_PER_RESULT, TEXT_BYTES, TEXTS_PER_RESULT, UTF8, TYPE_BY_EXTENSION, READ_NOT_KEPT2, NAME_MAX, SKIPPED, BUCKET_FOUND, KINDS, codeOf2, keyId, BATCH_BYTES, ENVELOPE_BYTES;
|
|
10588
10605
|
var init_session2 = __esm({
|
|
10589
10606
|
"src/reporter-core/session.ts"() {
|
|
10590
10607
|
"use strict";
|
|
@@ -10623,7 +10640,7 @@ var init_session2 = __esm({
|
|
|
10623
10640
|
".jpeg": "image/jpeg",
|
|
10624
10641
|
".webp": "image/webp"
|
|
10625
10642
|
};
|
|
10626
|
-
|
|
10643
|
+
READ_NOT_KEPT2 = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
10627
10644
|
NAME_MAX = 200;
|
|
10628
10645
|
SKIPPED = {
|
|
10629
10646
|
hidden: "its name starts with an underscore, which hides an attachment in Playwright's own reports too",
|
|
@@ -15174,8 +15191,15 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
15174
15191
|
else if (!visible2.has(name) && tool2.enabled) tool2.disable();
|
|
15175
15192
|
}
|
|
15176
15193
|
};
|
|
15194
|
+
let refusesWriters = false;
|
|
15177
15195
|
for (const tool2 of PLUNE_TOOLS) {
|
|
15178
|
-
if (!offeredTo(tool2, opts.scope))
|
|
15196
|
+
if (!offeredTo(tool2, opts.scope)) {
|
|
15197
|
+
if (tool2.write) {
|
|
15198
|
+
server2.registerTool(tool2.name, { description: tool2.description }, () => toResult(readOnlyRefusal(tool2.name)));
|
|
15199
|
+
refusesWriters = true;
|
|
15200
|
+
}
|
|
15201
|
+
continue;
|
|
15202
|
+
}
|
|
15179
15203
|
const handle = server2.registerTool(
|
|
15180
15204
|
tool2.name,
|
|
15181
15205
|
{
|
|
@@ -15196,7 +15220,13 @@ function createPluneMcpServer(opts, era, traits = {}) {
|
|
|
15196
15220
|
if (fixed) {
|
|
15197
15221
|
const tools2 = PLUNE_TOOLS.filter((t) => defaultVisibleTools(opts.scope).includes(t.name)).map(listed);
|
|
15198
15222
|
server2.server.setRequestHandler("tools/list", () => ({ tools: tools2 }));
|
|
15199
|
-
} else
|
|
15223
|
+
} else {
|
|
15224
|
+
sync();
|
|
15225
|
+
if (refusesWriters)
|
|
15226
|
+
server2.server.setRequestHandler("tools/list", () => ({
|
|
15227
|
+
tools: PLUNE_TOOLS.filter((t) => registered.get(t.name)?.enabled === true).map(listed)
|
|
15228
|
+
}));
|
|
15229
|
+
}
|
|
15200
15230
|
return server2;
|
|
15201
15231
|
}
|
|
15202
15232
|
function answeringParseErrors(answer) {
|
|
@@ -15261,7 +15291,7 @@ function unsupportedClaim(message2) {
|
|
|
15261
15291
|
const error = new import_server.UnsupportedProtocolVersionError({ supported: [...MODERN_REVISIONS], requested });
|
|
15262
15292
|
return { jsonrpc: "2.0", id: message2.id, error: { code: error.code, message: error.message, data: error.data } };
|
|
15263
15293
|
}
|
|
15264
|
-
var import_node_stream2, import_node_string_decoder2, import_server, import_zod7, import_stdio2, annotationsOf, listed, PARSE_ERROR_LINE, MODERN_REVISIONS;
|
|
15294
|
+
var import_node_stream2, import_node_string_decoder2, import_server, import_zod7, import_stdio2, annotationsOf, listed, readOnlyRefusal, PARSE_ERROR_LINE, MODERN_REVISIONS;
|
|
15265
15295
|
var init_server = __esm({
|
|
15266
15296
|
"src/mcp/server.ts"() {
|
|
15267
15297
|
"use strict";
|
|
@@ -15288,6 +15318,13 @@ var init_server = __esm({
|
|
|
15288
15318
|
outputSchema: import_zod7.z.toJSONSchema(tool2.output, { target: "draft-2020-12", io: "output" }),
|
|
15289
15319
|
annotations: annotationsOf(tool2)
|
|
15290
15320
|
});
|
|
15321
|
+
readOnlyRefusal = (name) => ({
|
|
15322
|
+
ok: false,
|
|
15323
|
+
error: {
|
|
15324
|
+
code: "read_only_token",
|
|
15325
|
+
message: `This connection has read-only access: ${name} writes. Ask the person to reconnect with read and write access.`
|
|
15326
|
+
}
|
|
15327
|
+
});
|
|
15291
15328
|
PARSE_ERROR_LINE = '{"jsonrpc":"2.0","id":null,"error":{"code":-32700,"message":"Parse error"}}\n';
|
|
15292
15329
|
MODERN_REVISIONS = ["2026-07-28"];
|
|
15293
15330
|
}
|
|
@@ -34598,6 +34635,7 @@ async function handleIngest(deps) {
|
|
|
34598
34635
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
34599
34636
|
);
|
|
34600
34637
|
if (files.length > 0) result2.files = files;
|
|
34638
|
+
if (sent.repeat) result2.repeat = true;
|
|
34601
34639
|
await job.finish({ ok: true });
|
|
34602
34640
|
if (job.problem !== void 0) result2.jobProblem = job.problem;
|
|
34603
34641
|
return result2;
|
|
@@ -34645,12 +34683,21 @@ function reportIngestFailure(err, write) {
|
|
|
34645
34683
|
return null;
|
|
34646
34684
|
}
|
|
34647
34685
|
function formatIngestResult(r) {
|
|
34686
|
+
const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
|
|
34687
|
+
if (r.repeat === true) {
|
|
34688
|
+
return `${[
|
|
34689
|
+
`This Cairn run was already ingested \u2192 ${r.runId}`,
|
|
34690
|
+
" nothing new was proposed or attached; a run with a new run id is ingested as new",
|
|
34691
|
+
...files
|
|
34692
|
+
].join("\n")}
|
|
34693
|
+
`;
|
|
34694
|
+
}
|
|
34648
34695
|
const lines = [
|
|
34649
34696
|
`Ingested Cairn run \u2192 ${r.runId}`,
|
|
34650
34697
|
` ${r.linked} result(s) attached to existing cases`,
|
|
34651
34698
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
34652
34699
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
34653
|
-
...
|
|
34700
|
+
...files
|
|
34654
34701
|
];
|
|
34655
34702
|
return `${lines.join("\n")}
|
|
34656
34703
|
`;
|
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);
|
|
@@ -8144,6 +8144,7 @@ async function handleIngest(deps) {
|
|
|
8144
8144
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
8145
8145
|
);
|
|
8146
8146
|
if (files.length > 0) result.files = files;
|
|
8147
|
+
if (sent.repeat) result.repeat = true;
|
|
8147
8148
|
await job.finish({ ok: true });
|
|
8148
8149
|
if (job.problem !== void 0) result.jobProblem = job.problem;
|
|
8149
8150
|
return result;
|
|
@@ -8191,12 +8192,21 @@ function reportIngestFailure(err, write) {
|
|
|
8191
8192
|
return null;
|
|
8192
8193
|
}
|
|
8193
8194
|
function formatIngestResult(r) {
|
|
8195
|
+
const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
|
|
8196
|
+
if (r.repeat === true) {
|
|
8197
|
+
return `${[
|
|
8198
|
+
`This Cairn run was already ingested \u2192 ${r.runId}`,
|
|
8199
|
+
" nothing new was proposed or attached; a run with a new run id is ingested as new",
|
|
8200
|
+
...files
|
|
8201
|
+
].join("\n")}
|
|
8202
|
+
`;
|
|
8203
|
+
}
|
|
8194
8204
|
const lines = [
|
|
8195
8205
|
`Ingested Cairn run \u2192 ${r.runId}`,
|
|
8196
8206
|
` ${r.linked} result(s) attached to existing cases`,
|
|
8197
8207
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
8198
8208
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
8199
|
-
...
|
|
8209
|
+
...files
|
|
8200
8210
|
];
|
|
8201
8211
|
return `${lines.join("\n")}
|
|
8202
8212
|
`;
|
package/dist/index.d.cts
CHANGED
|
@@ -1230,6 +1230,8 @@ 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;
|
|
1233
1235
|
}
|
|
1234
1236
|
declare function handleIngest(deps: IngestDeps): Promise<IngestResult>;
|
|
1235
1237
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1230,6 +1230,8 @@ 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;
|
|
1233
1235
|
}
|
|
1234
1236
|
declare function handleIngest(deps: IngestDeps): Promise<IngestResult>;
|
|
1235
1237
|
/**
|
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);
|
|
@@ -8106,6 +8106,7 @@ async function handleIngest(deps) {
|
|
|
8106
8106
|
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
8107
8107
|
);
|
|
8108
8108
|
if (files.length > 0) result.files = files;
|
|
8109
|
+
if (sent.repeat) result.repeat = true;
|
|
8109
8110
|
await job.finish({ ok: true });
|
|
8110
8111
|
if (job.problem !== void 0) result.jobProblem = job.problem;
|
|
8111
8112
|
return result;
|
|
@@ -8153,12 +8154,21 @@ function reportIngestFailure(err, write) {
|
|
|
8153
8154
|
return null;
|
|
8154
8155
|
}
|
|
8155
8156
|
function formatIngestResult(r) {
|
|
8157
|
+
const files = (r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`);
|
|
8158
|
+
if (r.repeat === true) {
|
|
8159
|
+
return `${[
|
|
8160
|
+
`This Cairn run was already ingested \u2192 ${r.runId}`,
|
|
8161
|
+
" nothing new was proposed or attached; a run with a new run id is ingested as new",
|
|
8162
|
+
...files
|
|
8163
|
+
].join("\n")}
|
|
8164
|
+
`;
|
|
8165
|
+
}
|
|
8156
8166
|
const lines = [
|
|
8157
8167
|
`Ingested Cairn run \u2192 ${r.runId}`,
|
|
8158
8168
|
` ${r.linked} result(s) attached to existing cases`,
|
|
8159
8169
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
8160
8170
|
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
8161
|
-
...
|
|
8171
|
+
...files
|
|
8162
8172
|
];
|
|
8163
8173
|
return `${lines.join("\n")}
|
|
8164
8174
|
`;
|
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 };
|
package/dist/reporter-core.js
CHANGED
|
@@ -406,7 +406,7 @@ function failureOf(attempt, home = homedir2()) {
|
|
|
406
406
|
const headline = line !== void 0 && jsonBytes(line) <= HEADLINE_LIMIT ? line : void 0;
|
|
407
407
|
const steps = chainOf(attempt.steps);
|
|
408
408
|
const location = error === void 0 ? void 0 : fromRoot(placeOf(error, attempt.testFile), attempt.repoRoot);
|
|
409
|
-
const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && a.contentType
|
|
409
|
+
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 !== "");
|
|
410
410
|
const ciUrl = webLink(attempt.buildHref);
|
|
411
411
|
const failure = {
|
|
412
412
|
...headline !== void 0 ? { headline } : {},
|
|
@@ -482,7 +482,7 @@ function cut(text) {
|
|
|
482
482
|
return { text: [...lines.slice(0, head), omitted(tail - head), ...lines.slice(tail)].join("\n"), omitted: text.length - kept.length };
|
|
483
483
|
}
|
|
484
484
|
var omitted = (lines) => `\u2026[omitted ${lines} lines]\u2026`;
|
|
485
|
-
var
|
|
485
|
+
var READ_NOT_KEPT = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
486
486
|
var REPO_RELATIVE = /^(?![A-Za-z][A-Za-z0-9+.-]*:)(?![\\/~])(?!(?:.*[\\/])?\.\.(?:[\\/]|$)).+$/;
|
|
487
487
|
var FRAME = /^\s+at (?:.*? \()?(.+?):(\d+):(\d+)\)?$/;
|
|
488
488
|
var FRAME_MAX = 8192;
|
|
@@ -792,7 +792,7 @@ var TYPE_BY_EXTENSION = {
|
|
|
792
792
|
".jpeg": "image/jpeg",
|
|
793
793
|
".webp": "image/webp"
|
|
794
794
|
};
|
|
795
|
-
var
|
|
795
|
+
var READ_NOT_KEPT2 = /* @__PURE__ */ new Set(["application/plune.metadata+json", "application/plune.findings+json"]);
|
|
796
796
|
var NAME_MAX = 200;
|
|
797
797
|
function nameOf(file) {
|
|
798
798
|
const own = file.name.split(/[\\/]/).pop()?.trim() || (file.path === void 0 ? "" : basename2(file.path));
|
|
@@ -858,8 +858,13 @@ function withoutTargets(result) {
|
|
|
858
858
|
const { targets: _targets, traceUrl: _traceUrl, ...rest } = result;
|
|
859
859
|
return rest;
|
|
860
860
|
}
|
|
861
|
+
function withoutFindings(result) {
|
|
862
|
+
if (result.findings === void 0) return result;
|
|
863
|
+
const { findings: _findings, ...rest } = result;
|
|
864
|
+
return rest;
|
|
865
|
+
}
|
|
861
866
|
function onDisk(deferred) {
|
|
862
|
-
const result = withoutTargets(deferred);
|
|
867
|
+
const result = withoutFindings(withoutTargets(deferred));
|
|
863
868
|
if (!("files" in result) || result.files === void 0) return result;
|
|
864
869
|
const { files, ...rest } = result;
|
|
865
870
|
const kept = files.filter((f) => f.path !== void 0).map(({ body: _body, ...file }) => file);
|
|
@@ -1309,7 +1314,7 @@ function fileSender(options) {
|
|
|
1309
1314
|
if (item?.status !== "accepted" || typeof item.id !== "string" || typeof item.resultKey !== "string") continue;
|
|
1310
1315
|
for (const file of filesByKey.get(item.resultKey) ?? []) {
|
|
1311
1316
|
const type = mediaTypeOf(file.contentType) ?? (file.path === void 0 ? void 0 : TYPE_BY_EXTENSION[extname(file.path).toLowerCase()]);
|
|
1312
|
-
if (type === void 0 || type
|
|
1317
|
+
if (type === void 0 || READ_NOT_KEPT2.has(type)) continue;
|
|
1313
1318
|
const kind = kindOf(type);
|
|
1314
1319
|
if (kind !== "text" && file.path === void 0) continue;
|
|
1315
1320
|
const name = nameOf(file);
|
|
@@ -1412,6 +1417,7 @@ async function startRun(passed, declared) {
|
|
|
1412
1417
|
let joined = false;
|
|
1413
1418
|
let offline = token === "";
|
|
1414
1419
|
let targetsRefused = false;
|
|
1420
|
+
let findingsRefused = false;
|
|
1415
1421
|
let done = false;
|
|
1416
1422
|
const shortened = /* @__PURE__ */ new Set();
|
|
1417
1423
|
const specFiles = /* @__PURE__ */ new Map();
|
|
@@ -1683,6 +1689,7 @@ async function startRun(passed, declared) {
|
|
|
1683
1689
|
async function send(submissions, filesByKey) {
|
|
1684
1690
|
for (const packedPart of packed(submissions)) {
|
|
1685
1691
|
let part = targetsRefused ? packedPart.map(withoutTargets) : packedPart;
|
|
1692
|
+
if (findingsRefused) part = part.map(withoutFindings);
|
|
1686
1693
|
if (offline) {
|
|
1687
1694
|
defer(part);
|
|
1688
1695
|
continue;
|
|
@@ -1693,12 +1700,22 @@ async function startRun(passed, declared) {
|
|
|
1693
1700
|
{ results, ...configuration !== void 0 ? { configuration } : {} }
|
|
1694
1701
|
);
|
|
1695
1702
|
let out = await post(part);
|
|
1703
|
+
let withoutItsFindings = false;
|
|
1704
|
+
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.findings !== void 0)) {
|
|
1705
|
+
withoutItsFindings = true;
|
|
1706
|
+
part = part.map(withoutFindings);
|
|
1707
|
+
out = await post(part);
|
|
1708
|
+
}
|
|
1696
1709
|
if (!out.ok && out.kind === "invalid" && out.status === 400 && part.some((r) => r.targets !== void 0 || r.traceUrl !== void 0)) {
|
|
1697
1710
|
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.");
|
|
1698
1711
|
targetsRefused = true;
|
|
1699
1712
|
part = part.map(withoutTargets);
|
|
1700
1713
|
out = await post(part);
|
|
1701
1714
|
}
|
|
1715
|
+
if (withoutItsFindings && out.ok) {
|
|
1716
|
+
if (!findingsRefused) log("plune: the platform does not take findings on a result yet \u2014 the results are sent without them.");
|
|
1717
|
+
findingsRefused = true;
|
|
1718
|
+
}
|
|
1702
1719
|
const counts = out.ok ? out.body?.counts : void 0;
|
|
1703
1720
|
const told = COUNTED.filter((k) => typeof counts?.[k] === "number");
|
|
1704
1721
|
if (told.length > 0) {
|
|
@@ -1896,6 +1913,7 @@ export {
|
|
|
1896
1913
|
errorContextOf,
|
|
1897
1914
|
failureOf,
|
|
1898
1915
|
filesOf,
|
|
1916
|
+
maskCredentials,
|
|
1899
1917
|
readEnv,
|
|
1900
1918
|
repoRootOf,
|
|
1901
1919
|
resultKey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plune-ai/cli",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.10",
|
|
4
4
|
"mcpName": "ai.plune/cli",
|
|
5
5
|
"description": "AI-powered assertion testing for LLM apps — write assertions, run them against any provider, get a pass/fail report (local, CI, or diff).",
|
|
6
6
|
"keywords": [
|