@plune-ai/cli 0.38.0 → 0.39.0
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 +10 -10
- package/dist/cli.cjs +858 -362
- package/dist/index.cjs +1030 -59
- package/dist/index.d.cts +10 -8
- package/dist/index.d.ts +10 -8
- package/dist/index.js +1030 -59
- package/dist/mcp-tools.cjs +10 -10
- package/dist/mcp-tools.d.cts +7 -7
- package/dist/mcp-tools.d.ts +7 -7
- package/dist/mcp-tools.js +10 -10
- package/dist/reporter-core.cjs +264 -236
- package/dist/reporter-core.d.cts +111 -112
- package/dist/reporter-core.d.ts +111 -112
- package/dist/reporter-core.js +264 -236
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1065,7 +1065,7 @@ var init_retry = __esm({
|
|
|
1065
1065
|
"use strict";
|
|
1066
1066
|
init_cjs_shims();
|
|
1067
1067
|
init_errors2();
|
|
1068
|
-
defaultSleep = (ms) => new Promise((
|
|
1068
|
+
defaultSleep = (ms) => new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
1069
1069
|
}
|
|
1070
1070
|
});
|
|
1071
1071
|
|
|
@@ -1543,6 +1543,13 @@ var init_estimate = __esm({
|
|
|
1543
1543
|
});
|
|
1544
1544
|
|
|
1545
1545
|
// src/providers/mock.ts
|
|
1546
|
+
function picked(pick2, tools2) {
|
|
1547
|
+
const words = pick2.toLowerCase().split(/\s+/).filter(Boolean);
|
|
1548
|
+
const hits = tools2.filter(
|
|
1549
|
+
(t) => words.every((w) => (t.description ?? "").toLowerCase().includes(w))
|
|
1550
|
+
);
|
|
1551
|
+
return hits.length === 1 ? hits[0].name : void 0;
|
|
1552
|
+
}
|
|
1546
1553
|
function parseMockScript(text6) {
|
|
1547
1554
|
let parsed4;
|
|
1548
1555
|
try {
|
|
@@ -1556,7 +1563,7 @@ function parseMockScript(text6) {
|
|
|
1556
1563
|
if (t !== void 0 && typeof t !== "string") return false;
|
|
1557
1564
|
if (calls === void 0) return true;
|
|
1558
1565
|
return Array.isArray(calls) && calls.every(
|
|
1559
|
-
(c) => typeof c === "object" && c !== null && typeof c.name === "string"
|
|
1566
|
+
(c) => typeof c === "object" && c !== null && (typeof c.name === "string" || typeof c.pick === "string")
|
|
1560
1567
|
);
|
|
1561
1568
|
};
|
|
1562
1569
|
if (!Array.isArray(parsed4) || parsed4.length === 0 || !parsed4.every(isStep))
|
|
@@ -1575,14 +1582,13 @@ function makeMockProvider(script) {
|
|
|
1575
1582
|
respond: (req) => {
|
|
1576
1583
|
const step = req.messages.filter((m) => m.role === "assistant").length;
|
|
1577
1584
|
const entry2 = script[Math.min(step, script.length - 1)];
|
|
1578
|
-
const calls = entry2.tool_calls ?? []
|
|
1585
|
+
const calls = (entry2.tool_calls ?? []).flatMap((c) => {
|
|
1586
|
+
const name = "name" in c ? c.name : picked(c.pick, req.tools);
|
|
1587
|
+
return name === void 0 ? [] : [{ name, args: c.args ?? {} }];
|
|
1588
|
+
});
|
|
1579
1589
|
return Promise.resolve({
|
|
1580
1590
|
text: entry2.text ?? "",
|
|
1581
|
-
tool_calls: calls.map((c, i) => ({
|
|
1582
|
-
id: `call_${step}_${i}`,
|
|
1583
|
-
name: c.name,
|
|
1584
|
-
args: c.args ?? {}
|
|
1585
|
-
})),
|
|
1591
|
+
tool_calls: calls.map((c, i) => ({ id: `call_${step}_${i}`, ...c })),
|
|
1586
1592
|
usage: USAGE,
|
|
1587
1593
|
finish_reason: calls.length > 0 ? "tool_calls" : "stop"
|
|
1588
1594
|
});
|
|
@@ -2987,9 +2993,9 @@ var init_test_case_schema = __esm({
|
|
|
2987
2993
|
schemaVersion: import_zod2.z.literal(TEST_CASE_SCHEMA_VERSION),
|
|
2988
2994
|
id: import_zod2.z.string().min(1),
|
|
2989
2995
|
externalKeys: import_zod2.z.array(externalKeySchema).optional(),
|
|
2990
|
-
/**
|
|
2996
|
+
/** Optional, purely additive; schemaVersion stays 2. */
|
|
2991
2997
|
is_flaky: import_zod2.z.boolean().optional(),
|
|
2992
|
-
/**
|
|
2998
|
+
/** Optional, purely additive; schemaVersion stays 2. */
|
|
2993
2999
|
is_muted: import_zod2.z.boolean().optional()
|
|
2994
3000
|
});
|
|
2995
3001
|
testCaseSchema = import_zod2.z.discriminatedUnion("type", [
|
|
@@ -4117,14 +4123,14 @@ function failureOf(attempt, home = (0, import_node_os.homedir)()) {
|
|
|
4117
4123
|
const location = error === void 0 ? void 0 : fromRoot(placeOf(error, attempt.testFile), attempt.repoRoot);
|
|
4118
4124
|
const artifacts = attempt.attachments.filter((a) => a.path !== void 0 && !a.name.startsWith("_") && a.contentType !== METADATA_TYPE).map(({ name, contentType: contentType2 }) => ({ name: fileNameOf(name), ...contentType2 ? { contentType: contentType2 } : {} })).filter((a) => a.name !== "");
|
|
4119
4125
|
const ciUrl = webLink(attempt.buildHref);
|
|
4120
|
-
const
|
|
4126
|
+
const failure2 = {
|
|
4121
4127
|
...headline2 !== void 0 ? { headline: headline2 } : {},
|
|
4122
4128
|
...steps.length > 0 ? { steps } : {},
|
|
4123
4129
|
...location !== void 0 ? { location } : {},
|
|
4124
4130
|
...artifacts.length > 0 ? { artifacts } : {},
|
|
4125
4131
|
...ciUrl !== void 0 ? { ciUrl } : {}
|
|
4126
4132
|
};
|
|
4127
|
-
return Object.keys(
|
|
4133
|
+
return Object.keys(failure2).length === 0 ? void 0 : failure2;
|
|
4128
4134
|
}
|
|
4129
4135
|
function repoRootOf(dir, stopAt) {
|
|
4130
4136
|
for (let here = (0, import_node_path3.resolve)(dir); ; here = (0, import_node_path3.dirname)(here)) {
|
|
@@ -4218,10 +4224,10 @@ function fromRoot(place, root) {
|
|
|
4218
4224
|
const base = normal(root).replace(/\/+$/, "");
|
|
4219
4225
|
const file = normal(place.file);
|
|
4220
4226
|
if (!file.startsWith(`${base}/`)) return void 0;
|
|
4221
|
-
const
|
|
4222
|
-
if (!REPO_RELATIVE.test(
|
|
4227
|
+
const relative5 = file.slice(base.length + 1);
|
|
4228
|
+
if (!REPO_RELATIVE.test(relative5)) return void 0;
|
|
4223
4229
|
const column = place.column !== void 0 && Number.isInteger(place.column) && place.column >= 1 ? place.column : void 0;
|
|
4224
|
-
return column === void 0 ? { file:
|
|
4230
|
+
return column === void 0 ? { file: relative5, line: place.line } : { file: relative5, line: place.line, column };
|
|
4225
4231
|
}
|
|
4226
4232
|
function webLink(href) {
|
|
4227
4233
|
return href !== void 0 && /^https?:\/\//i.test(href) && URL.canParse(href) ? href : void 0;
|
|
@@ -4610,14 +4616,14 @@ function readLines(stream, onLine, stats) {
|
|
|
4610
4616
|
if (stats !== void 0 && rest.length > stats.high) stats.high = rest.length;
|
|
4611
4617
|
partial = rest.slice(0, STDERR_LINE_LIMIT);
|
|
4612
4618
|
};
|
|
4613
|
-
return new Promise((
|
|
4619
|
+
return new Promise((resolve23) => {
|
|
4614
4620
|
let done = false;
|
|
4615
4621
|
const finish = () => {
|
|
4616
4622
|
if (done) return;
|
|
4617
4623
|
done = true;
|
|
4618
4624
|
feed(decoder.end());
|
|
4619
4625
|
if (partial !== "") onLine(partial.endsWith("\r") ? partial.slice(0, -1) : partial);
|
|
4620
|
-
|
|
4626
|
+
resolve23();
|
|
4621
4627
|
};
|
|
4622
4628
|
stream.on(
|
|
4623
4629
|
"data",
|
|
@@ -4915,7 +4921,7 @@ async function openSession(config, options = {}) {
|
|
|
4915
4921
|
const stdin = transport._process?.stdin;
|
|
4916
4922
|
if (stdin === null || stdin === void 0 || stdin.writableEnded)
|
|
4917
4923
|
throw spawnError !== void 0 ? await toConnectError(spawnError) : new ConnectError("exited-early", `${LEAD["exited-early"][0]}.`, [...tail]);
|
|
4918
|
-
return new Promise((
|
|
4924
|
+
return new Promise((resolve23, reject) => {
|
|
4919
4925
|
const done = () => {
|
|
4920
4926
|
clearTimeout(timer2);
|
|
4921
4927
|
listeners.delete(listener);
|
|
@@ -4929,7 +4935,7 @@ async function openSession(config, options = {}) {
|
|
|
4929
4935
|
const frame2 = parsed(line);
|
|
4930
4936
|
if (!answers(frame2, id2)) return;
|
|
4931
4937
|
done();
|
|
4932
|
-
|
|
4938
|
+
resolve23({ frame: frame2, text: clean3(line).slice(0, RAW_TEXT) });
|
|
4933
4939
|
};
|
|
4934
4940
|
const stop = () => {
|
|
4935
4941
|
done();
|
|
@@ -5009,10 +5015,10 @@ async function openSession(config, options = {}) {
|
|
|
5009
5015
|
const proc = transport._process;
|
|
5010
5016
|
if (proc === void 0) return true;
|
|
5011
5017
|
if (proc.exitCode !== null || proc.signalCode !== null) return true;
|
|
5012
|
-
const exited = new Promise((
|
|
5018
|
+
const exited = new Promise((resolve23) => proc.once("exit", () => resolve23(true)));
|
|
5013
5019
|
proc.stdin?.end();
|
|
5014
5020
|
let timer2;
|
|
5015
|
-
const late = new Promise((
|
|
5021
|
+
const late = new Promise((resolve23) => timer2 = setTimeout(() => resolve23(false), waitMs));
|
|
5016
5022
|
const result2 = await Promise.race([exited, late]);
|
|
5017
5023
|
clearTimeout(timer2);
|
|
5018
5024
|
return result2;
|
|
@@ -6122,13 +6128,21 @@ var init_catalog = __esm({
|
|
|
6122
6128
|
check2({
|
|
6123
6129
|
id: "base-jsonrpc-parse-error",
|
|
6124
6130
|
title: "Invalid JSON is a parse error",
|
|
6125
|
-
description: "A message that is not valid JSON gets the error -32700 with id: null.",
|
|
6131
|
+
description: "A message that is not valid JSON gets the error -32700 with id: null. Over HTTP only: on stdio the client may not send such a line at all, and stdio-parse-error-advice reads the answer there. Over HTTP the endpoint is open to any POST, not only to what an MCP client writes, so the JSON-RPC 2.0 rule stands there: an input it cannot accept gets an error (https://modelcontextprotocol.io/specification/2025-11-25/basic/transports, Sending Messages to the Server).",
|
|
6126
6132
|
level: "MUST",
|
|
6127
6133
|
derived: true,
|
|
6128
6134
|
derivation: "basic/index, Messages: MCP messages MUST follow JSON-RPC 2.0; JSON-RPC 2.0 section 5 gives -32700 and a null id to a parse error.",
|
|
6129
6135
|
specRefs: [ref4(L2, "basic/index", "Messages")],
|
|
6130
6136
|
eras: BOTH3,
|
|
6131
|
-
transports:
|
|
6137
|
+
transports: HTTP
|
|
6138
|
+
}),
|
|
6139
|
+
unscored("advice", {
|
|
6140
|
+
id: "stdio-parse-error-advice",
|
|
6141
|
+
title: "Invalid JSON on stdio is answered with a parse error (advice)",
|
|
6142
|
+
description: `A line that is not valid JSON gets the error -32700 with id: null. Advice, not a requirement: the client "MUST NOT write anything to the server's stdin that is not a valid MCP message", so what a server does with one is not specified.`,
|
|
6143
|
+
specRefs: [ref4(L2, LT, "stdio")],
|
|
6144
|
+
eras: BOTH3,
|
|
6145
|
+
transports: ["stdio"]
|
|
6132
6146
|
}),
|
|
6133
6147
|
check2({
|
|
6134
6148
|
id: "base-unknown-method-error",
|
|
@@ -6526,7 +6540,7 @@ var init_catalog = __esm({
|
|
|
6526
6540
|
check2({
|
|
6527
6541
|
id: "http-modern-get-delete-405",
|
|
6528
6542
|
title: "A modern-only server answers GET and DELETE with 405",
|
|
6529
|
-
description: "A server of the 2026-07-28 revision only answers GET and DELETE on its endpoint with 405 Method Not Allowed. A server that also
|
|
6543
|
+
description: "A server of the 2026-07-28 revision only answers GET and DELETE on its endpoint with 405 Method Not Allowed. A server that also serves 2025-11-25 (dual-era) is not-applicable: its server/discover names an earlier revision, or it answers an initialize sent as a 2025-11-25 client sends it.",
|
|
6530
6544
|
level: "SHOULD",
|
|
6531
6545
|
specRefs: [ref4(M2, MT, "Earlier Streamable HTTP Revisions")],
|
|
6532
6546
|
eras: ["modern"],
|
|
@@ -6702,7 +6716,7 @@ var init_catalog = __esm({
|
|
|
6702
6716
|
check2({
|
|
6703
6717
|
id: "mod-no-session-id",
|
|
6704
6718
|
title: "A modern-only server neither mints nor echoes a session id",
|
|
6705
|
-
description: "server/discover sent with an Mcp-Session-Id gets an answer without Mcp-Session-Id. A dual-era server (supportedVersions names a revision before 2026-07-28) is not-applicable.",
|
|
6719
|
+
description: "server/discover sent with an Mcp-Session-Id gets an answer without Mcp-Session-Id. A dual-era server (supportedVersions names a revision before 2026-07-28, or it answers an initialize sent as a 2025-11-25 client sends it) is not-applicable.",
|
|
6706
6720
|
level: "SHOULD",
|
|
6707
6721
|
specRefs: [ref4(M2, MT, "Earlier Streamable HTTP Revisions")],
|
|
6708
6722
|
eras: MODERN3,
|
|
@@ -6850,7 +6864,7 @@ var init_profile = __esm({
|
|
|
6850
6864
|
import_node_crypto2 = require("crypto");
|
|
6851
6865
|
PROFILE = {
|
|
6852
6866
|
id: "plune-mcp-conformance",
|
|
6853
|
-
version: "2026-11.
|
|
6867
|
+
version: "2026-11.2",
|
|
6854
6868
|
checks: [
|
|
6855
6869
|
"life-initialize-result",
|
|
6856
6870
|
"life-version-negotiation",
|
|
@@ -8293,7 +8307,7 @@ function parseRetryAfter(raw, now = Date.now()) {
|
|
|
8293
8307
|
return Math.min(Math.max(seconds, 0) * 1e3, RETRY_AFTER_CAP_MS);
|
|
8294
8308
|
}
|
|
8295
8309
|
function nodeTransport(url, init, idleMs = IDLE_MS) {
|
|
8296
|
-
return new Promise((
|
|
8310
|
+
return new Promise((resolve23, reject) => {
|
|
8297
8311
|
const target4 = new URL(url);
|
|
8298
8312
|
const send3 = target4.protocol === "https:" ? import_node_https.request : import_node_http.request;
|
|
8299
8313
|
const agent = POOLS[target4.protocol === "https:" ? "https:" : "http:"];
|
|
@@ -8304,7 +8318,7 @@ function nodeTransport(url, init, idleMs = IDLE_MS) {
|
|
|
8304
8318
|
res.on("end", () => {
|
|
8305
8319
|
const status2 = res.statusCode ?? 0;
|
|
8306
8320
|
const text6 = Buffer.concat(chunks).toString("utf8");
|
|
8307
|
-
|
|
8321
|
+
resolve23({
|
|
8308
8322
|
ok: status2 >= 200 && status2 <= 299,
|
|
8309
8323
|
status: status2,
|
|
8310
8324
|
headers: {
|
|
@@ -8323,12 +8337,12 @@ function nodeTransport(url, init, idleMs = IDLE_MS) {
|
|
|
8323
8337
|
});
|
|
8324
8338
|
}
|
|
8325
8339
|
function nodePut(url, headers, source, idleMs) {
|
|
8326
|
-
return new Promise((
|
|
8340
|
+
return new Promise((resolve23, reject) => {
|
|
8327
8341
|
const target4 = new URL(url);
|
|
8328
8342
|
const send3 = target4.protocol === "https:" ? import_node_https.request : import_node_http.request;
|
|
8329
8343
|
const length = "body" in source ? source.body.length : source.size;
|
|
8330
8344
|
let answered;
|
|
8331
|
-
const settle = (err) => answered !== void 0 ?
|
|
8345
|
+
const settle = (err) => answered !== void 0 ? resolve23(answered) : reject(err);
|
|
8332
8346
|
const req = send3(
|
|
8333
8347
|
target4,
|
|
8334
8348
|
{ method: "PUT", headers: { ...withoutLength(headers), "content-length": String(length) } },
|
|
@@ -8337,7 +8351,7 @@ function nodePut(url, headers, source, idleMs) {
|
|
|
8337
8351
|
answered = { status: res.statusCode ?? 0, retryAfter: Array.isArray(retry) ? retry[0] ?? null : retry ?? null };
|
|
8338
8352
|
res.on("error", settle);
|
|
8339
8353
|
res.on("close", () => {
|
|
8340
|
-
|
|
8354
|
+
resolve23(answered);
|
|
8341
8355
|
req.destroy();
|
|
8342
8356
|
});
|
|
8343
8357
|
res.resume();
|
|
@@ -8802,68 +8816,14 @@ function chunk(items2, size) {
|
|
|
8802
8816
|
for (let i = 0; i < items2.length; i += size) out.push(items2.slice(i, i + size));
|
|
8803
8817
|
return out;
|
|
8804
8818
|
}
|
|
8805
|
-
function
|
|
8806
|
-
const
|
|
8807
|
-
|
|
8808
|
-
if (names.some((name) => run[name] != null)) return;
|
|
8809
|
-
log(
|
|
8810
|
-
`plune: this deployment stored none of ${names.join(", ")} \u2014 it is older than the fields. The run is otherwise reported in full.`
|
|
8811
|
-
);
|
|
8812
|
-
}
|
|
8813
|
-
async function startRun(passed2, declared2) {
|
|
8814
|
-
const env = readEnv();
|
|
8815
|
-
if (env.shardError !== void 0) throw new Error(env.shardError);
|
|
8816
|
-
if (env.configurationError !== void 0 && passed2.configuration === void 0) throw new Error(env.configurationError);
|
|
8817
|
-
const stated = Object.fromEntries(Object.entries(passed2).filter(([, v]) => v !== void 0));
|
|
8818
|
-
const cfg = { ...env.config, ...stated };
|
|
8819
|
-
const configuration = cfg.configuration !== void 0 && Object.keys(cfg.configuration).length > 0 ? cfg.configuration : void 0;
|
|
8820
|
-
const log = cfg.log ?? ((line) => void process.stderr.write(`${line}
|
|
8821
|
-
`));
|
|
8822
|
-
const fallbackPath = cfg.fallbackPath ?? DEFAULT_FALLBACK_PATH;
|
|
8823
|
-
const externalKey = cfg.externalKey ?? null;
|
|
8824
|
-
const sessionMarker = (0, import_node_crypto4.randomUUID)();
|
|
8825
|
-
const batchSize = Math.min(cfg.batchSize ?? BATCH_DEFAULT, BATCH_MAX);
|
|
8826
|
-
const offerDiscovered = cfg.offerDiscovered ?? false;
|
|
8827
|
-
const token2 = cfg.token ?? loadToken() ?? "";
|
|
8828
|
-
const uploadsAtOnce = Math.min(Math.max(Math.floor(cfg.uploadConcurrency ?? UPLOAD_CONCURRENCY.default), UPLOAD_CONCURRENCY.min), UPLOAD_CONCURRENCY.max);
|
|
8829
|
-
const uploadRetries = Math.min(Math.max(Math.floor(cfg.uploadRetries ?? UPLOAD_RETRIES.default), UPLOAD_RETRIES.min), UPLOAD_RETRIES.max);
|
|
8819
|
+
function fileSender(options) {
|
|
8820
|
+
const { client, log, stats, uploadsAtOnce, uploadRetries } = options;
|
|
8821
|
+
const without = options.without ?? "its result is reported without it";
|
|
8830
8822
|
let retried = 0;
|
|
8831
8823
|
let uploadMs = 0;
|
|
8832
8824
|
let requests = 0;
|
|
8833
8825
|
let existed = 0;
|
|
8834
8826
|
let batchMissing = false;
|
|
8835
|
-
const client = createClient({
|
|
8836
|
-
apiUrl: resolveApiUrl(cfg.apiUrl),
|
|
8837
|
-
token: token2,
|
|
8838
|
-
uploadRetries,
|
|
8839
|
-
onRetry: () => void (retried += 1),
|
|
8840
|
-
...cfg.fetchImpl !== void 0 ? { fetchImpl: cfg.fetchImpl } : {}
|
|
8841
|
-
});
|
|
8842
|
-
const stats = {
|
|
8843
|
-
accepted: 0,
|
|
8844
|
-
duplicate: 0,
|
|
8845
|
-
conflict: 0,
|
|
8846
|
-
rejected: 0,
|
|
8847
|
-
unresolved: 0,
|
|
8848
|
-
offered: 0,
|
|
8849
|
-
created: 0,
|
|
8850
|
-
unoffered: 0,
|
|
8851
|
-
deferred: 0,
|
|
8852
|
-
screenshots: { uploaded: 0, skipped: 0, failed: 0 },
|
|
8853
|
-
textFiles: { uploaded: 0, skipped: 0, failed: 0 },
|
|
8854
|
-
otherFiles: { uploaded: 0, skipped: 0, failed: 0 }
|
|
8855
|
-
};
|
|
8856
|
-
const resolved = /* @__PURE__ */ new Map();
|
|
8857
|
-
let buffer = [];
|
|
8858
|
-
const discoveries = /* @__PURE__ */ new Map();
|
|
8859
|
-
const held = /* @__PURE__ */ new Map();
|
|
8860
|
-
let createdWithResult = 0;
|
|
8861
|
-
let createdUndelivered = 0;
|
|
8862
|
-
let runId = null;
|
|
8863
|
-
let joined = false;
|
|
8864
|
-
let offline = token2 === "";
|
|
8865
|
-
let done = false;
|
|
8866
|
-
const shortened = /* @__PURE__ */ new Set();
|
|
8867
8827
|
const skipsSaid = /* @__PURE__ */ new Set();
|
|
8868
8828
|
const countsOf = (kind2) => kind2 === "text" ? stats.textFiles : kind2 === "file" ? stats.otherFiles : stats.screenshots;
|
|
8869
8829
|
let bucketSeen = false;
|
|
@@ -8872,168 +8832,6 @@ async function startRun(passed2, declared2) {
|
|
|
8872
8832
|
const failedSaid = /* @__PURE__ */ new Set();
|
|
8873
8833
|
const codesSaid = /* @__PURE__ */ new Set();
|
|
8874
8834
|
const rooms = /* @__PURE__ */ new Map();
|
|
8875
|
-
function bound(keys) {
|
|
8876
|
-
return keys.map((key) => {
|
|
8877
|
-
const fit = boundKey(key);
|
|
8878
|
-
if (fit !== key && !shortened.has(key.value)) {
|
|
8879
|
-
shortened.add(key.value);
|
|
8880
|
-
if (shortened.size === 1) {
|
|
8881
|
-
log(
|
|
8882
|
-
`plune: a test name longer than ${KEY_MAX} characters was shortened to fit its key \u2014 ${JSON.stringify(printable(key.value.slice(0, 80)))}\u2026 Give the test a shorter name; until then this is its identity.`
|
|
8883
|
-
);
|
|
8884
|
-
}
|
|
8885
|
-
}
|
|
8886
|
-
return fit;
|
|
8887
|
-
});
|
|
8888
|
-
}
|
|
8889
|
-
const expected = declared2?.map(bound);
|
|
8890
|
-
if (offline) {
|
|
8891
|
-
log('plune: no API token \u2014 run "plune login" first. Results will be written to the fallback file.');
|
|
8892
|
-
}
|
|
8893
|
-
for (const warning of env.warnings) log(`plune: ${warning}`);
|
|
8894
|
-
if (env.ignored.length > 0) {
|
|
8895
|
-
log(`plune: ignoring ${env.ignored.join(", ")} \u2014 a run has nowhere to store them yet.`);
|
|
8896
|
-
}
|
|
8897
|
-
function defer(results4) {
|
|
8898
|
-
appendBatch(fallbackPath, {
|
|
8899
|
-
runId,
|
|
8900
|
-
externalKey,
|
|
8901
|
-
session: sessionMarker,
|
|
8902
|
-
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
8903
|
-
...configuration !== void 0 ? { configuration } : {},
|
|
8904
|
-
results: results4.map(onDisk)
|
|
8905
|
-
});
|
|
8906
|
-
stats.deferred += results4.length;
|
|
8907
|
-
}
|
|
8908
|
-
async function resolveKeys(values) {
|
|
8909
|
-
const unknown = values.filter((k) => !resolved.has(keyId(k)));
|
|
8910
|
-
if (unknown.length === 0 || offline) return;
|
|
8911
|
-
for (const part of chunk(unknown, RESOLVE_CHUNK)) {
|
|
8912
|
-
const out = await client.post(
|
|
8913
|
-
"/v1/test-cases/resolve",
|
|
8914
|
-
{ keys: part }
|
|
8915
|
-
);
|
|
8916
|
-
if (!out.ok || !Array.isArray(out.body?.results)) {
|
|
8917
|
-
log(`plune: could not look up test cases (${out.ok ? "the answer had no results" : out.detail || out.kind}).`);
|
|
8918
|
-
return;
|
|
8919
|
-
}
|
|
8920
|
-
for (const row of out.body.results) {
|
|
8921
|
-
if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
|
|
8922
|
-
}
|
|
8923
|
-
}
|
|
8924
|
-
}
|
|
8925
|
-
if (!offline) {
|
|
8926
|
-
if (expected !== void 0) await resolveKeys(expected.flat());
|
|
8927
|
-
const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
|
|
8928
|
-
const configuration2 = stated2.length === 0 ? void 0 : {
|
|
8929
|
-
expected: stated2.flatMap((keys) => {
|
|
8930
|
-
const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
|
|
8931
|
-
if (typeof hit === "string") return [{ testCaseId: hit }];
|
|
8932
|
-
return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
|
|
8933
|
-
}),
|
|
8934
|
-
// The claim travels with the list it is about (D20). A runner that could not enumerate
|
|
8935
|
-
// its tests has no list, and a claim without one is nothing the platform can check —
|
|
8936
|
-
// so it is not sent, rather than sent and silently meaningless.
|
|
8937
|
-
...cfg.full === true ? { full: true } : {}
|
|
8938
|
-
};
|
|
8939
|
-
if (expected !== void 0 && expected.length > EXPECTED_MAX) {
|
|
8940
|
-
log(`plune: ${expected.length} tests is more than the run configuration holds \u2014 reporting the first ${EXPECTED_MAX}.`);
|
|
8941
|
-
}
|
|
8942
|
-
const described = {
|
|
8943
|
-
...cfg.title !== void 0 ? { title: cfg.title } : {},
|
|
8944
|
-
...cfg.environment !== void 0 ? { environment: cfg.environment } : {},
|
|
8945
|
-
...cfg.labels !== void 0 ? { labels: cfg.labels } : {}
|
|
8946
|
-
};
|
|
8947
|
-
const request = {
|
|
8948
|
-
schemaVersion: 2,
|
|
8949
|
-
kind: cfg.kind ?? "automated",
|
|
8950
|
-
...externalKey !== null ? { externalKey } : {},
|
|
8951
|
-
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
8952
|
-
...configuration2 !== void 0 ? { configuration: configuration2 } : {},
|
|
8953
|
-
// Named even when nobody named it — the list has to read without opening a row. Only what
|
|
8954
|
-
// the caller DESCRIBED goes to `warnIfDropped` below: a title this side invented is not one
|
|
8955
|
-
// a person will miss, and a deployment older than the field must not be nagged on every run.
|
|
8956
|
-
title: defaultRunTitle(),
|
|
8957
|
-
...described
|
|
8958
|
-
};
|
|
8959
|
-
let start2 = await client.post("/v1/runs", request);
|
|
8960
|
-
if (!start2.ok && start2.status === 413 && configuration2 !== void 0) {
|
|
8961
|
-
log(
|
|
8962
|
-
`plune: the platform refused the run's list of expected tests as too large (${start2.detail || start2.kind}) \u2014 starting without it: the results still land, but this run counts no tests that did not run, and claims no full run.`
|
|
8963
|
-
);
|
|
8964
|
-
start2 = await client.post("/v1/runs", { ...request, configuration: void 0 });
|
|
8965
|
-
}
|
|
8966
|
-
if (start2.ok && typeof start2.body?.run?.id === "string") {
|
|
8967
|
-
runId = start2.body.run.id;
|
|
8968
|
-
joined = start2.status === 200;
|
|
8969
|
-
warnIfDropped(described, start2.body.run, log);
|
|
8970
|
-
} else {
|
|
8971
|
-
const why = start2.ok ? "the answer had no run" : start2.detail || start2.kind;
|
|
8972
|
-
log(`plune: could not start the run (${why}). Results will be written to ${fallbackPath}.`);
|
|
8973
|
-
}
|
|
8974
|
-
}
|
|
8975
|
-
function matchFor(result2) {
|
|
8976
|
-
if (result2.testCaseId !== void 0) return { kind: "found", testCaseId: result2.testCaseId };
|
|
8977
|
-
let unanswered2 = false;
|
|
8978
|
-
for (const key of result2.keys) {
|
|
8979
|
-
const hit = resolved.get(keyId(key));
|
|
8980
|
-
if (typeof hit === "string") return { kind: "found", testCaseId: hit };
|
|
8981
|
-
if (hit === void 0) unanswered2 = true;
|
|
8982
|
-
}
|
|
8983
|
-
return unanswered2 ? { kind: "unanswered" } : { kind: "unmatched" };
|
|
8984
|
-
}
|
|
8985
|
-
function remember(result2) {
|
|
8986
|
-
if (!offerDiscovered) return;
|
|
8987
|
-
if (result2.title === void 0 || result2.specRef === void 0) return;
|
|
8988
|
-
if (result2.keys.length === 0) return;
|
|
8989
|
-
const title = boundTitle(result2.title);
|
|
8990
|
-
if (title !== result2.title) shortened.add(result2.title);
|
|
8991
|
-
discoveries.set(keyId(result2.keys[0]), {
|
|
8992
|
-
keys: result2.keys,
|
|
8993
|
-
title,
|
|
8994
|
-
source: result2.source,
|
|
8995
|
-
specRef: result2.specRef,
|
|
8996
|
-
rawStatus: result2.rawStatus
|
|
8997
|
-
});
|
|
8998
|
-
for (const key of result2.keys) held.set(keyId(key), result2);
|
|
8999
|
-
}
|
|
9000
|
-
async function offer() {
|
|
9001
|
-
if (discoveries.size === 0 || offline || runId === null) return;
|
|
9002
|
-
const batches = chunk([...discoveries.values()], DISCOVER_MAX);
|
|
9003
|
-
for (const [index, batch] of batches.entries()) {
|
|
9004
|
-
const out = await client.post("/v1/review-items/discovered", {
|
|
9005
|
-
discovered: batch,
|
|
9006
|
-
runId
|
|
9007
|
-
});
|
|
9008
|
-
if (!out.ok || !Array.isArray(out.body?.results)) {
|
|
9009
|
-
stats.unoffered = batches.slice(index).reduce((n, rest) => n + rest.length, 0);
|
|
9010
|
-
stats.unofferedWhy = whyUnoffered(out);
|
|
9011
|
-
log(
|
|
9012
|
-
`plune: could not offer ${stats.unoffered} unknown test(s) for review (${out.ok ? "the answer had no results" : out.detail || out.kind}).`
|
|
9013
|
-
);
|
|
9014
|
-
return;
|
|
9015
|
-
}
|
|
9016
|
-
stats.offered += out.body.results.filter((r) => r?.outcome === "queued").length;
|
|
9017
|
-
const made = out.body.results.filter((r) => r?.outcome === "created");
|
|
9018
|
-
stats.created += made.length;
|
|
9019
|
-
const submissions = [];
|
|
9020
|
-
const filesByKey = /* @__PURE__ */ new Map();
|
|
9021
|
-
for (const r of made) {
|
|
9022
|
-
const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
|
|
9023
|
-
if (pending === void 0) continue;
|
|
9024
|
-
for (const key of pending.keys) held.delete(keyId(key));
|
|
9025
|
-
const { keys: _keys, files, ...rest } = pending;
|
|
9026
|
-
submissions.push({ ...rest, testCaseId: r.id });
|
|
9027
|
-
if (files !== void 0) filesByKey.set(pending.resultKey, files);
|
|
9028
|
-
}
|
|
9029
|
-
if (submissions.length > 0) {
|
|
9030
|
-
const before = stats.deferred;
|
|
9031
|
-
await send3(submissions, filesByKey);
|
|
9032
|
-
createdWithResult += submissions.length;
|
|
9033
|
-
createdUndelivered += stats.deferred - before;
|
|
9034
|
-
}
|
|
9035
|
-
}
|
|
9036
|
-
}
|
|
9037
8835
|
function skip(kind2, name, why) {
|
|
9038
8836
|
countsOf(kind2).skipped += 1;
|
|
9039
8837
|
if (why === "noStorage") noStorage += 1;
|
|
@@ -9043,9 +8841,10 @@ async function startRun(passed2, declared2) {
|
|
|
9043
8841
|
if (why === "noStorage") log(`plune: "${name}" not stored \u2014 ${SKIPPED[why]}.`);
|
|
9044
8842
|
else log(`plune: ${KINDS[kind2].label} "${name}" not uploaded \u2014 ${SKIPPED[why]}.`);
|
|
9045
8843
|
}
|
|
8844
|
+
const filesOf2 = (job) => `/v1/${job.owner ?? "results"}/${encodeURIComponent(job.id)}/files`;
|
|
9046
8845
|
function ask3(job, size) {
|
|
9047
8846
|
requests += 1;
|
|
9048
|
-
return client.post(
|
|
8847
|
+
return client.post(`${filesOf2(job)}/uploads`, {
|
|
9049
8848
|
files: [{ name: job.name, contentType: job.type, size }]
|
|
9050
8849
|
}, uploadRetries);
|
|
9051
8850
|
}
|
|
@@ -9053,14 +8852,14 @@ async function startRun(passed2, declared2) {
|
|
|
9053
8852
|
countsOf(job.kind).failed += 1;
|
|
9054
8853
|
if (!failedSaid.has(job.kind)) {
|
|
9055
8854
|
failedSaid.add(job.kind);
|
|
9056
|
-
log(`plune: could not upload a ${KINDS[job.kind].label} (${why}) \u2014
|
|
8855
|
+
log(`plune: could not upload a ${KINDS[job.kind].label} (${why}) \u2014 ${without}.`);
|
|
9057
8856
|
}
|
|
9058
8857
|
}
|
|
9059
8858
|
function failedToBucket(job, code) {
|
|
9060
8859
|
countsOf(job.kind).failed += 1;
|
|
9061
8860
|
if (codesSaid.has(code)) return;
|
|
9062
8861
|
codesSaid.add(code);
|
|
9063
|
-
log(`plune: "${job.name}" not uploaded to your bucket (${code}) \u2014
|
|
8862
|
+
log(`plune: "${job.name}" not uploaded to your bucket (${code}) \u2014 ${without}.`);
|
|
9064
8863
|
}
|
|
9065
8864
|
function refusedHere(job, size) {
|
|
9066
8865
|
if (job.kind === "screenshot") {
|
|
@@ -9088,7 +8887,7 @@ async function startRun(passed2, declared2) {
|
|
|
9088
8887
|
if (refusal2 !== void 0) return skip(kind2, job.name, refusal2);
|
|
9089
8888
|
requests += 1;
|
|
9090
8889
|
const out = await client.upload(
|
|
9091
|
-
|
|
8890
|
+
`${filesOf2(job)}?name=${encodeURIComponent(job.name)}`,
|
|
9092
8891
|
bytes,
|
|
9093
8892
|
job.type
|
|
9094
8893
|
);
|
|
@@ -9110,14 +8909,14 @@ async function startRun(passed2, declared2) {
|
|
|
9110
8909
|
link = fresh2;
|
|
9111
8910
|
}
|
|
9112
8911
|
requests += 1;
|
|
9113
|
-
const
|
|
9114
|
-
if (!
|
|
8912
|
+
const done = await client.post(`/v1/files/${encodeURIComponent(link.id)}/complete`, {}, uploadRetries);
|
|
8913
|
+
if (!done.ok) return failedToBucket(job, codeOf2(done));
|
|
9115
8914
|
countsOf(job.kind).uploaded += 1;
|
|
9116
8915
|
}
|
|
9117
8916
|
let free = uploadsAtOnce;
|
|
9118
8917
|
const waiting = [];
|
|
9119
8918
|
async function gated(work) {
|
|
9120
|
-
if (free === 0) await new Promise((
|
|
8919
|
+
if (free === 0) await new Promise((resolve23) => waiting.push(resolve23));
|
|
9121
8920
|
else free -= 1;
|
|
9122
8921
|
try {
|
|
9123
8922
|
return await work();
|
|
@@ -9438,6 +9237,250 @@ async function startRun(passed2, declared2) {
|
|
|
9438
9237
|
else await uploadBatched(jobs);
|
|
9439
9238
|
uploadMs += Date.now() - started;
|
|
9440
9239
|
}
|
|
9240
|
+
return {
|
|
9241
|
+
upload,
|
|
9242
|
+
uploadEach,
|
|
9243
|
+
onRetry: () => void (retried += 1),
|
|
9244
|
+
get bucketSeen() {
|
|
9245
|
+
return bucketSeen;
|
|
9246
|
+
},
|
|
9247
|
+
get noStorage() {
|
|
9248
|
+
return noStorage;
|
|
9249
|
+
},
|
|
9250
|
+
get existed() {
|
|
9251
|
+
return existed;
|
|
9252
|
+
},
|
|
9253
|
+
get retried() {
|
|
9254
|
+
return retried;
|
|
9255
|
+
},
|
|
9256
|
+
get uploadMs() {
|
|
9257
|
+
return uploadMs;
|
|
9258
|
+
},
|
|
9259
|
+
get requests() {
|
|
9260
|
+
return requests;
|
|
9261
|
+
}
|
|
9262
|
+
};
|
|
9263
|
+
}
|
|
9264
|
+
function warnIfDropped(sent, run, log) {
|
|
9265
|
+
const names = Object.keys(sent);
|
|
9266
|
+
if (names.length === 0) return;
|
|
9267
|
+
if (names.some((name) => run[name] != null)) return;
|
|
9268
|
+
log(
|
|
9269
|
+
`plune: this deployment stored none of ${names.join(", ")} \u2014 it is older than the fields. The run is otherwise reported in full.`
|
|
9270
|
+
);
|
|
9271
|
+
}
|
|
9272
|
+
async function startRun(passed2, declared2) {
|
|
9273
|
+
const env = readEnv();
|
|
9274
|
+
if (env.shardError !== void 0) throw new Error(env.shardError);
|
|
9275
|
+
if (env.configurationError !== void 0 && passed2.configuration === void 0) throw new Error(env.configurationError);
|
|
9276
|
+
const stated = Object.fromEntries(Object.entries(passed2).filter(([, v]) => v !== void 0));
|
|
9277
|
+
const cfg = { ...env.config, ...stated };
|
|
9278
|
+
const configuration = cfg.configuration !== void 0 && Object.keys(cfg.configuration).length > 0 ? cfg.configuration : void 0;
|
|
9279
|
+
const log = cfg.log ?? ((line) => void process.stderr.write(`${line}
|
|
9280
|
+
`));
|
|
9281
|
+
const fallbackPath = cfg.fallbackPath ?? DEFAULT_FALLBACK_PATH;
|
|
9282
|
+
const externalKey = cfg.externalKey ?? null;
|
|
9283
|
+
const sessionMarker = (0, import_node_crypto4.randomUUID)();
|
|
9284
|
+
const batchSize = Math.min(cfg.batchSize ?? BATCH_DEFAULT, BATCH_MAX);
|
|
9285
|
+
const offerDiscovered = cfg.offerDiscovered ?? false;
|
|
9286
|
+
const token2 = cfg.token ?? loadToken() ?? "";
|
|
9287
|
+
const uploadsAtOnce = Math.min(Math.max(Math.floor(cfg.uploadConcurrency ?? UPLOAD_CONCURRENCY.default), UPLOAD_CONCURRENCY.min), UPLOAD_CONCURRENCY.max);
|
|
9288
|
+
const uploadRetries = Math.min(Math.max(Math.floor(cfg.uploadRetries ?? UPLOAD_RETRIES.default), UPLOAD_RETRIES.min), UPLOAD_RETRIES.max);
|
|
9289
|
+
const client = createClient({
|
|
9290
|
+
apiUrl: resolveApiUrl(cfg.apiUrl),
|
|
9291
|
+
token: token2,
|
|
9292
|
+
uploadRetries,
|
|
9293
|
+
onRetry: () => files.onRetry(),
|
|
9294
|
+
...cfg.fetchImpl !== void 0 ? { fetchImpl: cfg.fetchImpl } : {}
|
|
9295
|
+
});
|
|
9296
|
+
const stats = {
|
|
9297
|
+
accepted: 0,
|
|
9298
|
+
duplicate: 0,
|
|
9299
|
+
conflict: 0,
|
|
9300
|
+
rejected: 0,
|
|
9301
|
+
unresolved: 0,
|
|
9302
|
+
offered: 0,
|
|
9303
|
+
created: 0,
|
|
9304
|
+
unoffered: 0,
|
|
9305
|
+
deferred: 0,
|
|
9306
|
+
screenshots: { uploaded: 0, skipped: 0, failed: 0 },
|
|
9307
|
+
textFiles: { uploaded: 0, skipped: 0, failed: 0 },
|
|
9308
|
+
otherFiles: { uploaded: 0, skipped: 0, failed: 0 }
|
|
9309
|
+
};
|
|
9310
|
+
const files = fileSender({ client, log, stats, uploadsAtOnce, uploadRetries });
|
|
9311
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
9312
|
+
let buffer = [];
|
|
9313
|
+
const discoveries = /* @__PURE__ */ new Map();
|
|
9314
|
+
const held = /* @__PURE__ */ new Map();
|
|
9315
|
+
let createdWithResult = 0;
|
|
9316
|
+
let createdUndelivered = 0;
|
|
9317
|
+
let runId = null;
|
|
9318
|
+
let joined = false;
|
|
9319
|
+
let offline = token2 === "";
|
|
9320
|
+
let done = false;
|
|
9321
|
+
const shortened = /* @__PURE__ */ new Set();
|
|
9322
|
+
function bound(keys) {
|
|
9323
|
+
return keys.map((key) => {
|
|
9324
|
+
const fit = boundKey(key);
|
|
9325
|
+
if (fit !== key && !shortened.has(key.value)) {
|
|
9326
|
+
shortened.add(key.value);
|
|
9327
|
+
if (shortened.size === 1) {
|
|
9328
|
+
log(
|
|
9329
|
+
`plune: a test name longer than ${KEY_MAX} characters was shortened to fit its key \u2014 ${JSON.stringify(printable(key.value.slice(0, 80)))}\u2026 Give the test a shorter name; until then this is its identity.`
|
|
9330
|
+
);
|
|
9331
|
+
}
|
|
9332
|
+
}
|
|
9333
|
+
return fit;
|
|
9334
|
+
});
|
|
9335
|
+
}
|
|
9336
|
+
const expected = declared2?.map(bound);
|
|
9337
|
+
if (offline) {
|
|
9338
|
+
log('plune: no API token \u2014 run "plune login" first. Results will be written to the fallback file.');
|
|
9339
|
+
}
|
|
9340
|
+
for (const warning of env.warnings) log(`plune: ${warning}`);
|
|
9341
|
+
if (env.ignored.length > 0) {
|
|
9342
|
+
log(`plune: ignoring ${env.ignored.join(", ")} \u2014 a run has nowhere to store them yet.`);
|
|
9343
|
+
}
|
|
9344
|
+
function defer(results4) {
|
|
9345
|
+
appendBatch(fallbackPath, {
|
|
9346
|
+
runId,
|
|
9347
|
+
externalKey,
|
|
9348
|
+
session: sessionMarker,
|
|
9349
|
+
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
9350
|
+
...configuration !== void 0 ? { configuration } : {},
|
|
9351
|
+
results: results4.map(onDisk)
|
|
9352
|
+
});
|
|
9353
|
+
stats.deferred += results4.length;
|
|
9354
|
+
}
|
|
9355
|
+
async function resolveKeys(values) {
|
|
9356
|
+
const unknown = values.filter((k) => !resolved.has(keyId(k)));
|
|
9357
|
+
if (unknown.length === 0 || offline) return;
|
|
9358
|
+
for (const part of chunk(unknown, RESOLVE_CHUNK)) {
|
|
9359
|
+
const out = await client.post(
|
|
9360
|
+
"/v1/test-cases/resolve",
|
|
9361
|
+
{ keys: part }
|
|
9362
|
+
);
|
|
9363
|
+
if (!out.ok || !Array.isArray(out.body?.results)) {
|
|
9364
|
+
log(`plune: could not look up test cases (${out.ok ? "the answer had no results" : out.detail || out.kind}).`);
|
|
9365
|
+
return;
|
|
9366
|
+
}
|
|
9367
|
+
for (const row of out.body.results) {
|
|
9368
|
+
if (typeof row?.key?.value === "string") resolved.set(keyId(row.key), row.testCaseId);
|
|
9369
|
+
}
|
|
9370
|
+
}
|
|
9371
|
+
}
|
|
9372
|
+
if (!offline) {
|
|
9373
|
+
if (expected !== void 0) await resolveKeys(expected.flat());
|
|
9374
|
+
const stated2 = expected?.slice(0, EXPECTED_MAX) ?? [];
|
|
9375
|
+
const configuration2 = stated2.length === 0 ? void 0 : {
|
|
9376
|
+
expected: stated2.flatMap((keys) => {
|
|
9377
|
+
const hit = keys.map((k) => resolved.get(keyId(k))).find((v) => typeof v === "string");
|
|
9378
|
+
if (typeof hit === "string") return [{ testCaseId: hit }];
|
|
9379
|
+
return keys[0] === void 0 ? [] : [{ externalKey: keys[0] }];
|
|
9380
|
+
}),
|
|
9381
|
+
// The claim travels with the list it is about. A runner that could not enumerate
|
|
9382
|
+
// its tests has no list, and a claim without one is nothing the platform can check —
|
|
9383
|
+
// so it is not sent, rather than sent and silently meaningless.
|
|
9384
|
+
...cfg.full === true ? { full: true } : {}
|
|
9385
|
+
};
|
|
9386
|
+
if (expected !== void 0 && expected.length > EXPECTED_MAX) {
|
|
9387
|
+
log(`plune: ${expected.length} tests is more than the run configuration holds \u2014 reporting the first ${EXPECTED_MAX}.`);
|
|
9388
|
+
}
|
|
9389
|
+
const described = {
|
|
9390
|
+
...cfg.title !== void 0 ? { title: cfg.title } : {},
|
|
9391
|
+
...cfg.environment !== void 0 ? { environment: cfg.environment } : {},
|
|
9392
|
+
...cfg.labels !== void 0 ? { labels: cfg.labels } : {}
|
|
9393
|
+
};
|
|
9394
|
+
const request = {
|
|
9395
|
+
schemaVersion: 2,
|
|
9396
|
+
kind: cfg.kind ?? "automated",
|
|
9397
|
+
...externalKey !== null ? { externalKey } : {},
|
|
9398
|
+
...cfg.meta !== void 0 ? { meta: cfg.meta } : {},
|
|
9399
|
+
...configuration2 !== void 0 ? { configuration: configuration2 } : {},
|
|
9400
|
+
// Named even when nobody named it — the list has to read without opening a row. Only what
|
|
9401
|
+
// the caller DESCRIBED goes to `warnIfDropped` below: a title this side invented is not one
|
|
9402
|
+
// a person will miss, and a deployment older than the field must not be nagged on every run.
|
|
9403
|
+
title: defaultRunTitle(),
|
|
9404
|
+
...described
|
|
9405
|
+
};
|
|
9406
|
+
let start2 = await client.post("/v1/runs", request);
|
|
9407
|
+
if (!start2.ok && start2.status === 413 && configuration2 !== void 0) {
|
|
9408
|
+
log(
|
|
9409
|
+
`plune: the platform refused the run's list of expected tests as too large (${start2.detail || start2.kind}) \u2014 starting without it: the results still land, but this run counts no tests that did not run, and claims no full run.`
|
|
9410
|
+
);
|
|
9411
|
+
start2 = await client.post("/v1/runs", { ...request, configuration: void 0 });
|
|
9412
|
+
}
|
|
9413
|
+
if (start2.ok && typeof start2.body?.run?.id === "string") {
|
|
9414
|
+
runId = start2.body.run.id;
|
|
9415
|
+
joined = start2.status === 200;
|
|
9416
|
+
warnIfDropped(described, start2.body.run, log);
|
|
9417
|
+
} else {
|
|
9418
|
+
const why = start2.ok ? "the answer had no run" : start2.detail || start2.kind;
|
|
9419
|
+
log(`plune: could not start the run (${why}). Results will be written to ${fallbackPath}.`);
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
function matchFor(result2) {
|
|
9423
|
+
if (result2.testCaseId !== void 0) return { kind: "found", testCaseId: result2.testCaseId };
|
|
9424
|
+
let unanswered2 = false;
|
|
9425
|
+
for (const key of result2.keys) {
|
|
9426
|
+
const hit = resolved.get(keyId(key));
|
|
9427
|
+
if (typeof hit === "string") return { kind: "found", testCaseId: hit };
|
|
9428
|
+
if (hit === void 0) unanswered2 = true;
|
|
9429
|
+
}
|
|
9430
|
+
return unanswered2 ? { kind: "unanswered" } : { kind: "unmatched" };
|
|
9431
|
+
}
|
|
9432
|
+
function remember(result2) {
|
|
9433
|
+
if (!offerDiscovered) return;
|
|
9434
|
+
if (result2.title === void 0 || result2.specRef === void 0) return;
|
|
9435
|
+
if (result2.keys.length === 0) return;
|
|
9436
|
+
const title = boundTitle(result2.title);
|
|
9437
|
+
if (title !== result2.title) shortened.add(result2.title);
|
|
9438
|
+
discoveries.set(keyId(result2.keys[0]), {
|
|
9439
|
+
keys: result2.keys,
|
|
9440
|
+
title,
|
|
9441
|
+
source: result2.source,
|
|
9442
|
+
specRef: result2.specRef,
|
|
9443
|
+
rawStatus: result2.rawStatus
|
|
9444
|
+
});
|
|
9445
|
+
for (const key of result2.keys) held.set(keyId(key), result2);
|
|
9446
|
+
}
|
|
9447
|
+
async function offer() {
|
|
9448
|
+
if (discoveries.size === 0 || offline || runId === null) return;
|
|
9449
|
+
const batches = chunk([...discoveries.values()], DISCOVER_MAX);
|
|
9450
|
+
for (const [index, batch] of batches.entries()) {
|
|
9451
|
+
const out = await client.post("/v1/review-items/discovered", {
|
|
9452
|
+
discovered: batch,
|
|
9453
|
+
runId
|
|
9454
|
+
});
|
|
9455
|
+
if (!out.ok || !Array.isArray(out.body?.results)) {
|
|
9456
|
+
stats.unoffered = batches.slice(index).reduce((n, rest) => n + rest.length, 0);
|
|
9457
|
+
stats.unofferedWhy = whyUnoffered(out);
|
|
9458
|
+
log(
|
|
9459
|
+
`plune: could not offer ${stats.unoffered} unknown test(s) for review (${out.ok ? "the answer had no results" : out.detail || out.kind}).`
|
|
9460
|
+
);
|
|
9461
|
+
return;
|
|
9462
|
+
}
|
|
9463
|
+
stats.offered += out.body.results.filter((r) => r?.outcome === "queued").length;
|
|
9464
|
+
const made = out.body.results.filter((r) => r?.outcome === "created");
|
|
9465
|
+
stats.created += made.length;
|
|
9466
|
+
const submissions = [];
|
|
9467
|
+
const filesByKey = /* @__PURE__ */ new Map();
|
|
9468
|
+
for (const r of made) {
|
|
9469
|
+
const pending = typeof r.id === "string" && r.id !== "" && typeof r.key?.value === "string" ? held.get(keyId(r.key)) : void 0;
|
|
9470
|
+
if (pending === void 0) continue;
|
|
9471
|
+
for (const key of pending.keys) held.delete(keyId(key));
|
|
9472
|
+
const { keys: _keys, files: files2, ...rest } = pending;
|
|
9473
|
+
submissions.push({ ...rest, testCaseId: r.id });
|
|
9474
|
+
if (files2 !== void 0) filesByKey.set(pending.resultKey, files2);
|
|
9475
|
+
}
|
|
9476
|
+
if (submissions.length > 0) {
|
|
9477
|
+
const before = stats.deferred;
|
|
9478
|
+
await send3(submissions, filesByKey);
|
|
9479
|
+
createdWithResult += submissions.length;
|
|
9480
|
+
createdUndelivered += stats.deferred - before;
|
|
9481
|
+
}
|
|
9482
|
+
}
|
|
9483
|
+
}
|
|
9441
9484
|
const sending = /* @__PURE__ */ new Set();
|
|
9442
9485
|
let sendError;
|
|
9443
9486
|
let answered = false;
|
|
@@ -9478,9 +9521,9 @@ async function startRun(passed2, declared2) {
|
|
|
9478
9521
|
for (const result2 of pending) {
|
|
9479
9522
|
const match = matchFor(result2);
|
|
9480
9523
|
if (match.kind === "found") {
|
|
9481
|
-
const { keys: _keys, files, ...rest } = result2;
|
|
9524
|
+
const { keys: _keys, files: files2, ...rest } = result2;
|
|
9482
9525
|
submissions.push({ ...rest, testCaseId: match.testCaseId });
|
|
9483
|
-
if (
|
|
9526
|
+
if (files2 !== void 0) filesByKey.set(result2.resultKey, files2);
|
|
9484
9527
|
} else if (match.kind === "unmatched") {
|
|
9485
9528
|
stats.unresolved += 1;
|
|
9486
9529
|
remember(result2);
|
|
@@ -9503,7 +9546,7 @@ async function startRun(passed2, declared2) {
|
|
|
9503
9546
|
}
|
|
9504
9547
|
const out = await client.post(
|
|
9505
9548
|
`/v1/runs/${runId}/results`,
|
|
9506
|
-
// The job's combination on every batch
|
|
9549
|
+
// The job's combination on every batch; a refusal of it is a 422 said below as it came.
|
|
9507
9550
|
{ results: part, ...configuration !== void 0 ? { configuration } : {} }
|
|
9508
9551
|
);
|
|
9509
9552
|
const counts3 = out.ok ? out.body?.counts : void 0;
|
|
@@ -9511,7 +9554,7 @@ async function startRun(passed2, declared2) {
|
|
|
9511
9554
|
if (told.length > 0) {
|
|
9512
9555
|
for (const k of told) stats[k] += counts3[k];
|
|
9513
9556
|
progress();
|
|
9514
|
-
await upload(out.ok ? out.body?.items : void 0, filesByKey);
|
|
9557
|
+
await files.upload(out.ok ? out.body?.items : void 0, filesByKey);
|
|
9515
9558
|
answered = true;
|
|
9516
9559
|
continue;
|
|
9517
9560
|
}
|
|
@@ -9547,10 +9590,10 @@ async function startRun(passed2, declared2) {
|
|
|
9547
9590
|
}
|
|
9548
9591
|
const kinds = [stats.screenshots, stats.textFiles, stats.otherFiles];
|
|
9549
9592
|
const sum = (what) => kinds.reduce((n, counts3) => n + counts3[what], 0);
|
|
9550
|
-
if (bucketSeen) {
|
|
9551
|
-
const other = sum("skipped") - noStorage;
|
|
9593
|
+
if (files.bucketSeen) {
|
|
9594
|
+
const other = sum("skipped") - files.noStorage;
|
|
9552
9595
|
parts.push(
|
|
9553
|
-
`${sum("uploaded")} file(s) uploaded to your bucket` + (noStorage > 0 ? `, ${noStorage} skipped (no bucket connected)` : "") + (other > 0 ? `, ${other} skipped` : "") + (sum("failed") > 0 ? `, ${sum("failed")} failed to upload` : "")
|
|
9596
|
+
`${sum("uploaded")} file(s) uploaded to your bucket` + (files.noStorage > 0 ? `, ${files.noStorage} skipped (no bucket connected)` : "") + (other > 0 ? `, ${other} skipped` : "") + (sum("failed") > 0 ? `, ${sum("failed")} failed to upload` : "")
|
|
9554
9597
|
);
|
|
9555
9598
|
} else {
|
|
9556
9599
|
for (const said3 of [tally(stats.screenshots, "screenshot"), tally(stats.textFiles, "text file")]) {
|
|
@@ -9562,11 +9605,10 @@ async function startRun(passed2, declared2) {
|
|
|
9562
9605
|
}
|
|
9563
9606
|
if (stats.deferred > 0) parts.push(`${stats.deferred} not delivered \u2014 written to ${fallbackPath}`);
|
|
9564
9607
|
if (shortened.size > 0) parts.push(`${shortened.size} test name(s) shortened to fit a key`);
|
|
9565
|
-
const
|
|
9566
|
-
|
|
9567
|
-
if (total("uploaded") + total("skipped") + total("failed") + existed > 0) {
|
|
9608
|
+
const total = (what) => kinds.reduce((n, counts3) => n + counts3[what], 0);
|
|
9609
|
+
if (total("uploaded") + total("skipped") + total("failed") + files.existed > 0) {
|
|
9568
9610
|
log(
|
|
9569
|
-
`plune: files \u2014 ${total("uploaded")} uploaded, ${total("skipped")} skipped, ${existed} already there (skipped), ${retried} retried, ${total("failed")} dropped, in ${(uploadMs / 1e3).toFixed(1)} s (${uploadsAtOnce} at once, ${requests} request(s) to Plune)`
|
|
9611
|
+
`plune: files \u2014 ${total("uploaded")} uploaded, ${total("skipped")} skipped, ${files.existed} already there (skipped), ${files.retried} retried, ${total("failed")} dropped, in ${(files.uploadMs / 1e3).toFixed(1)} s (${uploadsAtOnce} at once, ${files.requests} request(s) to Plune)`
|
|
9570
9612
|
);
|
|
9571
9613
|
}
|
|
9572
9614
|
log(`plune: ${parts.join(" \xB7 ")}`);
|
|
@@ -9837,14 +9879,14 @@ async function handleRunExec(options) {
|
|
|
9837
9879
|
if (command === void 0) throw new RunCommandError("Nothing to run \u2014 pass a command after `--`.");
|
|
9838
9880
|
const run = await handleRunStart(options);
|
|
9839
9881
|
const spawnImpl = options.spawnImpl ?? import_node_child_process2.spawn;
|
|
9840
|
-
const code = await new Promise((
|
|
9882
|
+
const code = await new Promise((resolve23) => {
|
|
9841
9883
|
const child = spawnImpl(command, args, {
|
|
9842
9884
|
stdio: "inherit",
|
|
9843
9885
|
shell: process.platform === "win32",
|
|
9844
9886
|
env: { ...process.env, PLUNE_RUN: run.externalKey, PLUNE_PROCEED: "1" }
|
|
9845
9887
|
});
|
|
9846
|
-
child.on("close", (exitCode2) =>
|
|
9847
|
-
child.on("error", () =>
|
|
9888
|
+
child.on("close", (exitCode2) => resolve23(exitCode2 ?? 1));
|
|
9889
|
+
child.on("error", () => resolve23(1));
|
|
9848
9890
|
});
|
|
9849
9891
|
return handleRunFinish(run.id, options, code);
|
|
9850
9892
|
}
|
|
@@ -9899,9 +9941,9 @@ async function handleRunReport(options = {}) {
|
|
|
9899
9941
|
...options.token !== void 0 ? { token: options.token } : {},
|
|
9900
9942
|
...options.fetchImpl !== void 0 ? { fetchImpl: options.fetchImpl } : {},
|
|
9901
9943
|
...first.externalKey !== null ? { externalKey: first.externalKey } : {},
|
|
9902
|
-
// Where the run came from, as the reporter recorded it
|
|
9944
|
+
// Where the run came from, as the reporter recorded it — never this machine's own.
|
|
9903
9945
|
...first.meta !== void 0 ? { meta: first.meta } : {},
|
|
9904
|
-
// The combination the line recorded, or none (`{}`) — never this machine's `PLUNE_CONFIGURATION
|
|
9946
|
+
// The combination the line recorded, or none (`{}`) — never this machine's `PLUNE_CONFIGURATION`.
|
|
9905
9947
|
configuration: first.configuration ?? {},
|
|
9906
9948
|
// The replay does not know whether the run is complete, so it must not say that it is.
|
|
9907
9949
|
log: write
|
|
@@ -10012,7 +10054,7 @@ var init_run_result_schema = __esm({
|
|
|
10012
10054
|
error: runErrorSchema.optional(),
|
|
10013
10055
|
assertions: import_zod3.z.array(assertionResultRecordSchema2),
|
|
10014
10056
|
cache_saved: savedSchema.optional(),
|
|
10015
|
-
/**
|
|
10057
|
+
/** Optional and additive — the same enum the platform validates on `POST /v1/runs`. */
|
|
10016
10058
|
inconclusive: import_zod3.z.enum(ROW_INCONCLUSIVE).optional(),
|
|
10017
10059
|
/** Repeats (`runs` above 1). Optional and additive — a RunResult without it validates unchanged. */
|
|
10018
10060
|
attempts: import_zod3.z.object({
|
|
@@ -10089,7 +10131,7 @@ var init_run_result_schema = __esm({
|
|
|
10089
10131
|
passed: import_zod3.z.number(),
|
|
10090
10132
|
failed: import_zod3.z.number(),
|
|
10091
10133
|
errored: import_zod3.z.number(),
|
|
10092
|
-
/**
|
|
10134
|
+
/** Optional and additive — a RunResult written before them validates unchanged. */
|
|
10093
10135
|
blocked: import_zod3.z.number().optional(),
|
|
10094
10136
|
skipped: import_zod3.z.number().optional(),
|
|
10095
10137
|
cost_usd: import_zod3.z.number(),
|
|
@@ -10186,7 +10228,7 @@ var init_job_reporter = __esm({
|
|
|
10186
10228
|
}
|
|
10187
10229
|
/**
|
|
10188
10230
|
* The upload is in: every row is on the platform. `subjectId` is what the job works on, learnt from the upload's
|
|
10189
|
-
* answer (the run an ingest landed in): the platform takes it while the job names none
|
|
10231
|
+
* answer (the run an ingest landed in): the platform takes it while the job names none.
|
|
10190
10232
|
*/
|
|
10191
10233
|
async uploaded(at2) {
|
|
10192
10234
|
if (this.id === void 0) return;
|
|
@@ -10944,7 +10986,7 @@ function pendingOf(r, retry, ctx) {
|
|
|
10944
10986
|
testFile: ""
|
|
10945
10987
|
};
|
|
10946
10988
|
const errorContext = errorContextFields(attempt);
|
|
10947
|
-
const
|
|
10989
|
+
const failure2 = FAILED.has(status2) ? failureOf(attempt) : void 0;
|
|
10948
10990
|
const pkg2 = labelOf(r, "package");
|
|
10949
10991
|
const where3 = (key.includes("#") ? key.split("#")[0] : pkg2)?.replace(/^[A-Za-z][A-Za-z0-9_-]+:(?![\\/])/, "");
|
|
10950
10992
|
const stated = TOKEN.exec(name)?.[1];
|
|
@@ -10968,7 +11010,7 @@ function pendingOf(r, retry, ctx) {
|
|
|
10968
11010
|
}
|
|
10969
11011
|
} : {},
|
|
10970
11012
|
...errorContext,
|
|
10971
|
-
...
|
|
11013
|
+
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
10972
11014
|
...files.length > 0 ? { files } : {}
|
|
10973
11015
|
};
|
|
10974
11016
|
}
|
|
@@ -11287,7 +11329,7 @@ function attemptOf(result2, file, ctx) {
|
|
|
11287
11329
|
name: name ?? "",
|
|
11288
11330
|
...contentType2 !== void 0 ? { contentType: contentType2 } : {},
|
|
11289
11331
|
...path25 !== void 0 ? { path: path25 } : {},
|
|
11290
|
-
// Decoded only where the platform would take it
|
|
11332
|
+
// Decoded only where the platform would take it: a report of screenshots kept as
|
|
11291
11333
|
// bodies is megabytes of base64 that nothing here will read.
|
|
11292
11334
|
...typeof body === "string" && isTextType(contentType2) ? { body: Buffer.from(body, "base64") } : {}
|
|
11293
11335
|
})),
|
|
@@ -11304,7 +11346,7 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
11304
11346
|
const expected = test.expectedStatus;
|
|
11305
11347
|
const attempt = attemptOf(result2, file, ctx);
|
|
11306
11348
|
const errorContext = errorContextFields(attempt);
|
|
11307
|
-
const
|
|
11349
|
+
const failure2 = NOT_FAILED.has(attempt.status) ? void 0 : failureOf(attempt);
|
|
11308
11350
|
const files = filesOf(attempt);
|
|
11309
11351
|
const keys = [
|
|
11310
11352
|
...test.id !== void 0 ? [{ kind: "playwright-id", value: test.id }] : [],
|
|
@@ -11334,7 +11376,7 @@ function pendingFrom(spec, test, result2, file, titles, ctx) {
|
|
|
11334
11376
|
}
|
|
11335
11377
|
} : {},
|
|
11336
11378
|
...errorContext,
|
|
11337
|
-
...
|
|
11379
|
+
...failure2 !== void 0 ? { failure: failure2 } : {},
|
|
11338
11380
|
...files.length > 0 ? { files } : {}
|
|
11339
11381
|
};
|
|
11340
11382
|
}
|
|
@@ -11726,7 +11768,7 @@ async function timeoutMessage(limit3, runId, ours, options) {
|
|
|
11726
11768
|
if (!ours) return `${head}; run ${runId} is shared with other jobs and was left open - close it with "plune run finish ${runId}" once they are done, then import this report again.`;
|
|
11727
11769
|
const wait = options.terminateWaitMs ?? 15e3;
|
|
11728
11770
|
let timer;
|
|
11729
|
-
const gaveUp = new Promise((
|
|
11771
|
+
const gaveUp = new Promise((resolve23) => timer = setTimeout(() => resolve23("gaveup"), wait));
|
|
11730
11772
|
const quiet = () => void 0;
|
|
11731
11773
|
const closed = handleRunFinish(runId, { ...options, write: quiet, terminate: true, reason: `import timed out after ${limit3} s` }).then(
|
|
11732
11774
|
() => true,
|
|
@@ -11777,10 +11819,10 @@ async function handleRunImport(options) {
|
|
|
11777
11819
|
...options.create === true ? { offerDiscovered: true } : {},
|
|
11778
11820
|
...options.uploadConcurrency !== void 0 ? { uploadConcurrency: options.uploadConcurrency } : {},
|
|
11779
11821
|
kind: "automated",
|
|
11780
|
-
// The CI run the report names, never this machine's: whoever imports may be another job
|
|
11822
|
+
// The CI run the report names, never this machine's: whoever imports may be another job.
|
|
11781
11823
|
// The commit and branch likewise, where the report names a commit; a report that names none —
|
|
11782
11824
|
// JUnit's never does — takes this job's own, which is where the tests ran when import follows
|
|
11783
|
-
// them in one job
|
|
11825
|
+
// them in one job.
|
|
11784
11826
|
meta: { runner: format, ...ciUrl !== void 0 ? { ciUrl } : {}, ...ciCommit(ci) },
|
|
11785
11827
|
log: write
|
|
11786
11828
|
},
|
|
@@ -11799,7 +11841,7 @@ async function handleRunImport(options) {
|
|
|
11799
11841
|
else {
|
|
11800
11842
|
sent.catch(() => void 0);
|
|
11801
11843
|
let timer;
|
|
11802
|
-
const late = new Promise((
|
|
11844
|
+
const late = new Promise((resolve23) => timer = setTimeout(() => resolve23("late"), limit3 * 1e3));
|
|
11803
11845
|
const first = await Promise.race([sent, late]).finally(() => clearTimeout(timer));
|
|
11804
11846
|
if (first === "late") {
|
|
11805
11847
|
throw new ImportTimeoutError(await timeoutMessage(limit3, session2?.runId ?? null, !env.keepOpen, { ...options, apiUrl, token: token2 }));
|
|
@@ -11855,8 +11897,8 @@ function describe(result2, apiUrl) {
|
|
|
11855
11897
|
// `Read`, not `Imported`: the verb describes the FILE, which was read whatever happened next.
|
|
11856
11898
|
// «Imported 555 result(s): 0 accepted, 0 already there, 0 unmatched» was a sentence whose two
|
|
11857
11899
|
// halves disagreed, and readers stop at the verb — a run that reached nobody read as one that
|
|
11858
|
-
// worked
|
|
11859
|
-
// `not delivered` always, zero included
|
|
11900
|
+
// worked.
|
|
11901
|
+
// `not delivered` always, zero included: a number that only appears when it is bad is one
|
|
11860
11902
|
// nobody learns to look for. The `[0-9]+ unmatched` the workflows read stays whole.
|
|
11861
11903
|
`Read ${result2.parsed} result(s) from ${result2.format === "allure" ? "an" : "a"} ${result2.format} report: ${result2.accepted} accepted, ${result2.duplicate} already there, ${result2.unresolved} unmatched, ${result2.deferred} not delivered.`
|
|
11862
11904
|
];
|
|
@@ -13459,7 +13501,7 @@ var init_contract = __esm({
|
|
|
13459
13501
|
define({
|
|
13460
13502
|
name: "plune_get",
|
|
13461
13503
|
title: "Read one object",
|
|
13462
|
-
description: "Read one test case, run or review queue entry in full when you already hold its id \u2014 steps, state, history fields and everything the platform keeps on it.",
|
|
13504
|
+
description: "Read one test case, run or review queue entry in full when you already hold its id \u2014 steps, state, history fields and everything the platform keeps on it. Writing results or proposing cases needs no read first; an edit that replaces a list or a text (tags, steps, a mission summary) needs the current value read first.",
|
|
13463
13505
|
input: import_zod5.z.strictObject({ kind: import_zod5.z.enum(["test-case", "run", "review-item"]), id: id("Its id") }),
|
|
13464
13506
|
output: import_zod5.z.object({ kind: import_zod5.z.string(), item: entity }),
|
|
13465
13507
|
write: false,
|
|
@@ -13469,9 +13511,9 @@ var init_contract = __esm({
|
|
|
13469
13511
|
define({
|
|
13470
13512
|
name: "plune_cases_search",
|
|
13471
13513
|
title: "Find test cases",
|
|
13472
|
-
description: "Find test cases of the project by filter \u2014 suite, state, tag, priority
|
|
13514
|
+
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.",
|
|
13473
13515
|
input: import_zod5.z.strictObject({
|
|
13474
|
-
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: a list is OR inside one key, keys are AND-ed (e.g. {"
|
|
13516
|
+
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"]})'),
|
|
13475
13517
|
...listPage
|
|
13476
13518
|
}),
|
|
13477
13519
|
output: import_zod5.z.object({
|
|
@@ -13558,7 +13600,7 @@ var init_contract = __esm({
|
|
|
13558
13600
|
define({
|
|
13559
13601
|
name: "plune_mission_create",
|
|
13560
13602
|
title: "Create a mission",
|
|
13561
|
-
description: "Create a testing mission for a product: its name, a short description of what the product is, where it runs, and whether documentation exists. It starts as a draft
|
|
13603
|
+
description: "Create a testing mission for a product the user has named: its name, a short description of what the product is, where it runs, and whether documentation exists. It starts as a draft. Do not guess a mission from an unclear request, not even as a placeholder draft: when the user has not said which product, ask with plune_question_ask first.",
|
|
13562
13604
|
input: import_zod5.z.strictObject({ ...missionFields, dry_run: dryRun }),
|
|
13563
13605
|
output: writeOutput,
|
|
13564
13606
|
write: true,
|
|
@@ -13621,7 +13663,7 @@ var init_contract = __esm({
|
|
|
13621
13663
|
define({
|
|
13622
13664
|
name: "plune_question_ask",
|
|
13623
13665
|
title: "Ask a person",
|
|
13624
|
-
description: "Ask a person what you do not know instead of guessing:
|
|
13666
|
+
description: "Ask a person what you do not know instead of guessing. When the request leaves the target or scope unclear (which product, which cases), call this first, before any write, rather than only asking in your reply: it needs no mission, waits in the review queue, and its answer is read with plune_question_list. A plain question takes up to three options; an access question asks for an API description, the code, staging or a HAR file.",
|
|
13625
13667
|
input: questionInput.superRefine((b, ctx) => {
|
|
13626
13668
|
if (b.template === "plain" && b.access !== void 0) ctx.addIssue({ code: "custom", message: "access belongs to an access question" });
|
|
13627
13669
|
if (b.template === "access" && b.options !== void 0) ctx.addIssue({ code: "custom", message: "options belong to a plain question" });
|
|
@@ -13665,9 +13707,9 @@ var init_contract = __esm({
|
|
|
13665
13707
|
define({
|
|
13666
13708
|
name: "plune_discover_tools",
|
|
13667
13709
|
title: "Find more tools",
|
|
13668
|
-
description: "Look for a capability that is not in your tool list \u2014 editing cases, writing results, starting runs, cataloguing API endpoints, a raw API call \u2014 and switch the ones you need on for this session.",
|
|
13710
|
+
description: "Look for a capability that is not in your tool list \u2014 editing cases (plune_cases_update), writing results into a run (plune_results_write), starting runs (plune_run_create), cataloguing API endpoints (plune_endpoint_propose), a raw API call (plune_api_request) \u2014 and switch the ones you need on for this session by name, in one call. A tool switched on can be called from the next step, and its description in this answer says what it needs. Writing results needs no read of the run first; editing a case replaces its title, tags and steps whole, so read the case before changing them.",
|
|
13669
13711
|
input: import_zod5.z.strictObject({
|
|
13670
|
-
query: import_zod5.z.string().trim().min(1).max(200).optional().describe('
|
|
13712
|
+
query: import_zod5.z.string().trim().min(1).max(200).optional().describe('Two or three words of the task, e.g. "write results": a tool is listed only when every word is in its name, title or description'),
|
|
13671
13713
|
names: import_zod5.z.array(import_zod5.z.string().min(1)).min(1).max(MAX_VISIBLE_TOOLS).optional().describe("Tools to switch on")
|
|
13672
13714
|
}),
|
|
13673
13715
|
output: import_zod5.z.object({
|
|
@@ -13713,10 +13755,10 @@ var init_contract = __esm({
|
|
|
13713
13755
|
define({
|
|
13714
13756
|
name: "plune_results_write",
|
|
13715
13757
|
title: "Write results into a run",
|
|
13716
|
-
description: "Record up to 100 test results into an open run in one request \u2014 passed, failed, skipped, with their keys and evidence \u2014 and learn how many the platform accepted.",
|
|
13758
|
+
description: "Record up to 100 test results into an open run in one request \u2014 passed, failed, skipped, with their keys and evidence \u2014 and learn how many the platform accepted. The run id is enough: the run need not be read first. Each result names its case by testCaseId, found with plune_cases_search; when no case matches a name, ask the person instead of searching on.",
|
|
13717
13759
|
input: import_zod5.z.strictObject({
|
|
13718
13760
|
runId: id("The run id"),
|
|
13719
|
-
results: import_zod5.z.array(import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown())).min(1).max(BATCH_MAX2).describe("Results as POST /v1/runs/:id/results takes them"),
|
|
13761
|
+
results: import_zod5.z.array(import_zod5.z.record(import_zod5.z.string(), import_zod5.z.unknown())).min(1).max(BATCH_MAX2).describe("Results as POST /v1/runs/:id/results takes them: each with testCaseId, a resultKey of your own and a status"),
|
|
13720
13762
|
combination: import_zod5.z.number().int().min(0).optional(),
|
|
13721
13763
|
configuration: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.string()).optional(),
|
|
13722
13764
|
dry_run: dryRun
|
|
@@ -13798,7 +13840,7 @@ function createPluneApi(opts) {
|
|
|
13798
13840
|
method: req.method,
|
|
13799
13841
|
headers: req.body === void 0 ? headers : { ...headers, "content-type": "application/json" },
|
|
13800
13842
|
...req.body === void 0 ? {} : { body: JSON.stringify(req.body) },
|
|
13801
|
-
// Host pinning
|
|
13843
|
+
// Host pinning: a redirect elsewhere would carry the token there.
|
|
13802
13844
|
redirect: "manual"
|
|
13803
13845
|
});
|
|
13804
13846
|
} catch {
|
|
@@ -14250,7 +14292,7 @@ __export(server_exports, {
|
|
|
14250
14292
|
});
|
|
14251
14293
|
function toResult(outcome) {
|
|
14252
14294
|
if (outcome.ok) {
|
|
14253
|
-
return { content: [{ type: "text", text: JSON.stringify(outcome.data
|
|
14295
|
+
return { content: [{ type: "text", text: JSON.stringify(outcome.data) }], structuredContent: outcome.data };
|
|
14254
14296
|
}
|
|
14255
14297
|
return {
|
|
14256
14298
|
isError: true,
|
|
@@ -14332,7 +14374,7 @@ function answeringParseErrors(answer) {
|
|
|
14332
14374
|
async function serveMcpStdio(opts) {
|
|
14333
14375
|
const input = process.stdin.pipe(answeringParseErrors((line) => process.stdout.write(line)));
|
|
14334
14376
|
const transport = new import_stdio2.StdioServerTransport(input, process.stdout);
|
|
14335
|
-
await new Promise((
|
|
14377
|
+
await new Promise((resolve23) => {
|
|
14336
14378
|
(0, import_stdio2.serveStdio)((ctx) => createPluneMcpServer(opts, ctx.era), {
|
|
14337
14379
|
transport,
|
|
14338
14380
|
onerror: (error) => {
|
|
@@ -14350,7 +14392,7 @@ async function serveMcpStdio(opts) {
|
|
|
14350
14392
|
const owned = transport.onclose;
|
|
14351
14393
|
transport.onclose = () => {
|
|
14352
14394
|
owned?.();
|
|
14353
|
-
|
|
14395
|
+
resolve23();
|
|
14354
14396
|
};
|
|
14355
14397
|
});
|
|
14356
14398
|
}
|
|
@@ -14474,7 +14516,7 @@ var init_run3 = __esm({
|
|
|
14474
14516
|
now: () => import_node_perf_hooks2.performance.now(),
|
|
14475
14517
|
after(ms) {
|
|
14476
14518
|
let timer;
|
|
14477
|
-
const done = new Promise((
|
|
14519
|
+
const done = new Promise((resolve23) => timer = setTimeout(resolve23, ms));
|
|
14478
14520
|
return { done, cancel: () => clearTimeout(timer) };
|
|
14479
14521
|
}
|
|
14480
14522
|
};
|
|
@@ -14702,13 +14744,14 @@ var init_thresholds = __esm({
|
|
|
14702
14744
|
/** The biggest single tool, plune_strategy_propose, measured 2177. */
|
|
14703
14745
|
largestTool: 2395,
|
|
14704
14746
|
/**
|
|
14705
|
-
* The text content of an answer,
|
|
14706
|
-
*
|
|
14707
|
-
*
|
|
14708
|
-
*
|
|
14709
|
-
*
|
|
14747
|
+
* The text content of an answer, on live answers recorded in plune-budget.fixtures.ts, measured 2026-11-14 with the
|
|
14748
|
+
* text unindented (before, with a two-space indent): the beta demo project of 2026-11-10 (cases in Ukrainian) gives
|
|
14749
|
+
* plune_project_context with 3 projects, 3 suites, no missions 387 (548); plune_cases_search 7678 (10509) for the
|
|
14750
|
+
* whole project of 48 cases (a page of 100 is not reached); plune_review_list of 7 pending entries 695 (895). The demo
|
|
14751
|
+
* has no missions, so plune_mission_get reads a mission with 5 sources captured live on a beta test project on
|
|
14752
|
+
* 2026-11-14: 455 (585; the synthetic mission it replaced measured 476 indented, under its limit of 524).
|
|
14710
14753
|
*/
|
|
14711
|
-
answers: { plune_project_context:
|
|
14754
|
+
answers: { plune_project_context: 426, plune_cases_search: 8446, plune_review_list: 765, plune_mission_get: 501 }
|
|
14712
14755
|
};
|
|
14713
14756
|
LINT_THRESHOLDS = {
|
|
14714
14757
|
description: {
|
|
@@ -16028,7 +16071,7 @@ function render(run, format) {
|
|
|
16028
16071
|
}
|
|
16029
16072
|
}
|
|
16030
16073
|
function outcomeOf2(checks) {
|
|
16031
|
-
const
|
|
16074
|
+
const pick2 = (kind2, type, prefix, hit) => {
|
|
16032
16075
|
const first = hit[0];
|
|
16033
16076
|
const target4 = first.target === "" ? "" : `${first.target}: `;
|
|
16034
16077
|
const more = hit.length > 1 ? ` (and ${hit.length - 1} more)` : "";
|
|
@@ -16036,15 +16079,15 @@ function outcomeOf2(checks) {
|
|
|
16036
16079
|
};
|
|
16037
16080
|
const by = (f) => checks.filter(f);
|
|
16038
16081
|
const cnr = by((c) => c.state === "could-not-run");
|
|
16039
|
-
if (cnr.length > 0) return
|
|
16082
|
+
if (cnr.length > 0) return pick2("error", "could-not-run", "could-not-run: ", cnr);
|
|
16040
16083
|
const failed2 = by((c) => c.state === "failed" && c.advisory !== true);
|
|
16041
|
-
if (failed2.length > 0) return
|
|
16084
|
+
if (failed2.length > 0) return pick2("failure", failed2[0]?.class ?? "deterministic", "", failed2);
|
|
16042
16085
|
const advice = by((c) => c.state === "failed");
|
|
16043
|
-
if (advice.length > 0) return
|
|
16086
|
+
if (advice.length > 0) return pick2("skipped", "advisory", "advisory: ", advice);
|
|
16044
16087
|
const pending = by((c) => c.state === "pending");
|
|
16045
|
-
if (pending.length > 0) return
|
|
16088
|
+
if (pending.length > 0) return pick2("skipped", "pending", "pending: ", pending);
|
|
16046
16089
|
const na = by((c) => c.state === "not-applicable");
|
|
16047
|
-
if (na.length > 0) return
|
|
16090
|
+
if (na.length > 0) return pick2("skipped", "not-applicable", "not-applicable: ", na);
|
|
16048
16091
|
return { kind: "pass" };
|
|
16049
16092
|
}
|
|
16050
16093
|
function casesOf(run) {
|
|
@@ -16879,6 +16922,205 @@ var init_mcp_lint = __esm({
|
|
|
16879
16922
|
}
|
|
16880
16923
|
});
|
|
16881
16924
|
|
|
16925
|
+
// src/cli/commands/mcp-snapshot-push.ts
|
|
16926
|
+
function snapshotBody(snapshot, environment) {
|
|
16927
|
+
return {
|
|
16928
|
+
kind: snapshot.kind,
|
|
16929
|
+
schemaVersion: snapshot.schemaVersion,
|
|
16930
|
+
transport: snapshot.transport,
|
|
16931
|
+
...environment !== void 0 ? { environment } : {},
|
|
16932
|
+
server: snapshot.server === null ? null : pick(snapshot.server, SERVER_FIELDS),
|
|
16933
|
+
instructions: snapshot.instructions,
|
|
16934
|
+
capabilities: snapshot.capabilities,
|
|
16935
|
+
tools: entities(snapshot.tools, ENTITY_FIELDS.tools),
|
|
16936
|
+
resources: entities(snapshot.resources, ENTITY_FIELDS.resources),
|
|
16937
|
+
resourceTemplates: entities(snapshot.resourceTemplates, ENTITY_FIELDS.resourceTemplates),
|
|
16938
|
+
prompts: entities(snapshot.prompts, ENTITY_FIELDS.prompts)
|
|
16939
|
+
};
|
|
16940
|
+
}
|
|
16941
|
+
function checkPushFlags(flags2) {
|
|
16942
|
+
if (flags2.push !== true) {
|
|
16943
|
+
const stray = ["server", "serverName", "environment"].find(
|
|
16944
|
+
(k) => flags2[k] !== void 0
|
|
16945
|
+
);
|
|
16946
|
+
if (stray === void 0) return void 0;
|
|
16947
|
+
return `--${stray === "serverName" ? "server-name" : stray} only means something with --push.`;
|
|
16948
|
+
}
|
|
16949
|
+
const hasId = flags2.server !== void 0;
|
|
16950
|
+
const hasName = flags2.serverName !== void 0;
|
|
16951
|
+
if (hasId === hasName)
|
|
16952
|
+
return "--push needs exactly one of --server <id> and --server-name <name>.";
|
|
16953
|
+
if (flags2.server !== void 0 && flags2.server.trim() === "")
|
|
16954
|
+
return "--server must not be empty.";
|
|
16955
|
+
if (flags2.serverName !== void 0) {
|
|
16956
|
+
const n = flags2.serverName.trim();
|
|
16957
|
+
if (n === "" || n.length > MAX_SERVER_NAME)
|
|
16958
|
+
return `--server-name must be 1 to ${MAX_SERVER_NAME} characters.`;
|
|
16959
|
+
}
|
|
16960
|
+
if (flags2.environment !== void 0) {
|
|
16961
|
+
const e = flags2.environment.trim();
|
|
16962
|
+
if (e === "" || e.length > MAX_ENVIRONMENT)
|
|
16963
|
+
return `--environment must be 1 to ${MAX_ENVIRONMENT} characters.`;
|
|
16964
|
+
}
|
|
16965
|
+
return void 0;
|
|
16966
|
+
}
|
|
16967
|
+
function pushToken(deps) {
|
|
16968
|
+
const token2 = (deps.loadToken ?? loadToken)();
|
|
16969
|
+
if (token2 === null || token2 === "") {
|
|
16970
|
+
throw new SnapshotPushError(
|
|
16971
|
+
"not-logged-in",
|
|
16972
|
+
'Not logged in. Run "plune login" first, or set PLUNE_TOKEN. Nothing was sent.'
|
|
16973
|
+
);
|
|
16974
|
+
}
|
|
16975
|
+
return token2;
|
|
16976
|
+
}
|
|
16977
|
+
function failure(out, what) {
|
|
16978
|
+
const said3 = out.detail === "" ? "" : `: ${out.detail.replace(/\.$/, "")}`;
|
|
16979
|
+
switch (out.kind) {
|
|
16980
|
+
case "auth":
|
|
16981
|
+
return new SnapshotPushError(
|
|
16982
|
+
"auth",
|
|
16983
|
+
out.status === 401 ? 'Your API token was rejected (401). Run "plune login" again with a fresh token.' : `The platform refused ${what} (${out.status})${said3}. Writing the MCP catalog needs a token that may write.`
|
|
16984
|
+
);
|
|
16985
|
+
case "invalid":
|
|
16986
|
+
return new SnapshotPushError(
|
|
16987
|
+
"invalid",
|
|
16988
|
+
`The platform refused ${what} (${out.status ?? 400})${said3}.`
|
|
16989
|
+
);
|
|
16990
|
+
case "conflict":
|
|
16991
|
+
return new SnapshotPushError("conflict", `The platform refused ${what} (409)${said3}.`);
|
|
16992
|
+
case "unavailable":
|
|
16993
|
+
return new SnapshotPushError(
|
|
16994
|
+
"unavailable",
|
|
16995
|
+
out.status === null ? "Could not reach the Plune API. Check your connection, then try again." : `The Plune API answered ${out.status}${said3}. Try again later.`
|
|
16996
|
+
);
|
|
16997
|
+
default:
|
|
16998
|
+
return out.status === 404 ? new SnapshotPushError("not-found", `The platform has no ${what}${said3}.`) : new SnapshotPushError(
|
|
16999
|
+
"other",
|
|
17000
|
+
`The platform answered ${out.status ?? "with something unreadable"} to ${what}${said3}.`
|
|
17001
|
+
);
|
|
17002
|
+
}
|
|
17003
|
+
}
|
|
17004
|
+
async function pushSnapshot(snapshot, target4, token2, deps = {}) {
|
|
17005
|
+
const client = createClient({
|
|
17006
|
+
apiUrl: resolveApiUrl(deps.apiUrl),
|
|
17007
|
+
token: token2,
|
|
17008
|
+
...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {},
|
|
17009
|
+
...deps.wait !== void 0 ? { wait: deps.wait } : {}
|
|
17010
|
+
});
|
|
17011
|
+
let serverId = target4.serverId;
|
|
17012
|
+
let serverCreated = false;
|
|
17013
|
+
if (serverId === void 0) {
|
|
17014
|
+
const name = (target4.serverName ?? "").trim();
|
|
17015
|
+
const find = async () => {
|
|
17016
|
+
const listed3 = await client.get("/v1/mcp-servers");
|
|
17017
|
+
if (!listed3.ok) throw failure(listed3, "the list of MCP servers");
|
|
17018
|
+
const rows = Array.isArray(listed3.body.servers) ? listed3.body.servers.filter(isServerRow) : [];
|
|
17019
|
+
const key = name.toLowerCase();
|
|
17020
|
+
return rows.find((s) => s.name.toLowerCase() === key)?.id;
|
|
17021
|
+
};
|
|
17022
|
+
serverId = await find();
|
|
17023
|
+
if (serverId === void 0) {
|
|
17024
|
+
const made = await client.post(
|
|
17025
|
+
"/v1/mcp-servers",
|
|
17026
|
+
{ name, transport: snapshot.transport === "stdio" ? "stdio" : "http" },
|
|
17027
|
+
0
|
|
17028
|
+
);
|
|
17029
|
+
if (made.ok && typeof made.body.id === "string") {
|
|
17030
|
+
serverId = made.body.id;
|
|
17031
|
+
serverCreated = true;
|
|
17032
|
+
} else if (!made.ok && made.kind === "conflict") {
|
|
17033
|
+
serverId = await find();
|
|
17034
|
+
} else if (!made.ok) throw failure(made, "to add the MCP server");
|
|
17035
|
+
if (serverId === void 0)
|
|
17036
|
+
throw new SnapshotPushError("other", "The platform did not name the MCP server it made.");
|
|
17037
|
+
}
|
|
17038
|
+
}
|
|
17039
|
+
const sent = await client.post(
|
|
17040
|
+
`/v1/mcp-servers/${encodeURIComponent(serverId)}/snapshots`,
|
|
17041
|
+
snapshotBody(snapshot, target4.environment?.trim())
|
|
17042
|
+
);
|
|
17043
|
+
if (!sent.ok)
|
|
17044
|
+
throw failure(
|
|
17045
|
+
sent,
|
|
17046
|
+
target4.serverId !== void 0 ? `MCP server '${serverId}'` : "the snapshot"
|
|
17047
|
+
);
|
|
17048
|
+
const { number, hash, tools: tools2 } = sent.body;
|
|
17049
|
+
if (typeof number !== "number" || !Number.isInteger(number) || typeof hash !== "string") {
|
|
17050
|
+
throw new SnapshotPushError(
|
|
17051
|
+
"other",
|
|
17052
|
+
"The platform answered, but not with a snapshot (no number or hash)."
|
|
17053
|
+
);
|
|
17054
|
+
}
|
|
17055
|
+
return {
|
|
17056
|
+
serverId,
|
|
17057
|
+
...target4.serverName !== void 0 ? { serverName: target4.serverName.trim() } : {},
|
|
17058
|
+
number,
|
|
17059
|
+
hash,
|
|
17060
|
+
tools: typeof tools2 === "number" ? tools2 : null,
|
|
17061
|
+
created: sent.status === 201,
|
|
17062
|
+
serverCreated
|
|
17063
|
+
};
|
|
17064
|
+
}
|
|
17065
|
+
function describePush(r) {
|
|
17066
|
+
const where3 = r.serverName !== void 0 ? `server "${r.serverName}"` : `server ${r.serverId}`;
|
|
17067
|
+
const made = r.serverCreated ? `Added ${where3} to the platform.
|
|
17068
|
+
` : "";
|
|
17069
|
+
const what = r.created ? `Pushed snapshot ${r.number} of ${where3}: a new contract (${r.hash.slice(0, 12)}).` : `Snapshot ${r.number} of ${where3} already holds this contract (${r.hash.slice(0, 12)}); nothing new was recorded.`;
|
|
17070
|
+
return `${made}${what}
|
|
17071
|
+
`;
|
|
17072
|
+
}
|
|
17073
|
+
var MAX_SERVER_NAME, MAX_ENVIRONMENT, SnapshotPushError, pick, ENTITY_FIELDS, ARGUMENT_FIELDS2, SERVER_FIELDS, entities, isServerRow;
|
|
17074
|
+
var init_mcp_snapshot_push = __esm({
|
|
17075
|
+
"src/cli/commands/mcp-snapshot-push.ts"() {
|
|
17076
|
+
"use strict";
|
|
17077
|
+
init_cjs_shims();
|
|
17078
|
+
init_api_url();
|
|
17079
|
+
init_credentials();
|
|
17080
|
+
init_client();
|
|
17081
|
+
MAX_SERVER_NAME = 100;
|
|
17082
|
+
MAX_ENVIRONMENT = 100;
|
|
17083
|
+
SnapshotPushError = class extends Error {
|
|
17084
|
+
constructor(kind2, message2) {
|
|
17085
|
+
super(message2);
|
|
17086
|
+
this.kind = kind2;
|
|
17087
|
+
this.name = "SnapshotPushError";
|
|
17088
|
+
}
|
|
17089
|
+
kind;
|
|
17090
|
+
};
|
|
17091
|
+
pick = (from, keys) => Object.fromEntries(
|
|
17092
|
+
keys.filter((k) => Object.hasOwn(from, k) && from[k] !== void 0).map((k) => [k, from[k]])
|
|
17093
|
+
);
|
|
17094
|
+
ENTITY_FIELDS = {
|
|
17095
|
+
tools: [
|
|
17096
|
+
"name",
|
|
17097
|
+
"title",
|
|
17098
|
+
"description",
|
|
17099
|
+
"inputSchema",
|
|
17100
|
+
"outputSchema",
|
|
17101
|
+
"annotations",
|
|
17102
|
+
"execution",
|
|
17103
|
+
"x-plune"
|
|
17104
|
+
],
|
|
17105
|
+
resources: ["uri", "name", "title", "description", "mimeType"],
|
|
17106
|
+
resourceTemplates: ["uriTemplate", "name", "title", "description", "mimeType"],
|
|
17107
|
+
prompts: ["name", "title", "description", "arguments"]
|
|
17108
|
+
};
|
|
17109
|
+
ARGUMENT_FIELDS2 = ["name", "title", "description", "required"];
|
|
17110
|
+
SERVER_FIELDS = ["name", "version", "title"];
|
|
17111
|
+
entities = (list3, fields) => list3 === null ? null : list3.map((e) => {
|
|
17112
|
+
const entry2 = pick(e, fields);
|
|
17113
|
+
if (Array.isArray(entry2["arguments"])) {
|
|
17114
|
+
entry2["arguments"] = entry2["arguments"].map(
|
|
17115
|
+
(a) => pick(a, ARGUMENT_FIELDS2)
|
|
17116
|
+
);
|
|
17117
|
+
}
|
|
17118
|
+
return entry2;
|
|
17119
|
+
});
|
|
17120
|
+
isServerRow = (v) => typeof v === "object" && v !== null && typeof v.id === "string" && typeof v.name === "string";
|
|
17121
|
+
}
|
|
17122
|
+
});
|
|
17123
|
+
|
|
16882
17124
|
// src/cli/commands/mcp-snapshot.ts
|
|
16883
17125
|
var mcp_snapshot_exports = {};
|
|
16884
17126
|
__export(mcp_snapshot_exports, {
|
|
@@ -16895,6 +17137,9 @@ async function handleMcpSnapshot(flags2, server2, raw) {
|
|
|
16895
17137
|
err: (text6) => raw.err(noCommands(text6))
|
|
16896
17138
|
};
|
|
16897
17139
|
try {
|
|
17140
|
+
const flagProblem = checkPushFlags(flags2);
|
|
17141
|
+
if (flagProblem !== void 0) throw new UsageError(flagProblem);
|
|
17142
|
+
const token2 = flags2.push === true ? pushToken(io.push ?? {}) : void 0;
|
|
16898
17143
|
const config = connectionConfig(flags2, server2, io.env);
|
|
16899
17144
|
if (io.clientVersion !== void 0) config.clientVersion = io.clientVersion;
|
|
16900
17145
|
const snapshot = await takeSnapshot(config);
|
|
@@ -16905,14 +17150,42 @@ async function handleMcpSnapshot(flags2, server2, raw) {
|
|
|
16905
17150
|
return MCP_EXIT.unmeasured;
|
|
16906
17151
|
}
|
|
16907
17152
|
const text6 = serializeSnapshot(snapshot);
|
|
16908
|
-
if (flags2.out
|
|
16909
|
-
else {
|
|
17153
|
+
if (flags2.out !== void 0) {
|
|
16910
17154
|
writeAtomically((0, import_node_path8.resolve)(io.cwd, flags2.out), text6, flags2.out);
|
|
16911
17155
|
io.err(`Wrote ${flags2.out}: ${counts2(snapshot)}.
|
|
16912
17156
|
`);
|
|
17157
|
+
} else if (token2 === void 0) io.out(text6);
|
|
17158
|
+
if (token2 === void 0) return MCP_EXIT.ok;
|
|
17159
|
+
try {
|
|
17160
|
+
const pushed = await pushSnapshot(
|
|
17161
|
+
snapshot,
|
|
17162
|
+
{
|
|
17163
|
+
...flags2.server !== void 0 ? { serverId: flags2.server.trim() } : {},
|
|
17164
|
+
...flags2.serverName !== void 0 ? { serverName: flags2.serverName } : {},
|
|
17165
|
+
...flags2.environment !== void 0 ? { environment: flags2.environment } : {}
|
|
17166
|
+
},
|
|
17167
|
+
token2,
|
|
17168
|
+
io.push ?? {}
|
|
17169
|
+
);
|
|
17170
|
+
raw.out(noCommands(describePush(pushed)));
|
|
17171
|
+
return MCP_EXIT.ok;
|
|
17172
|
+
} catch (err) {
|
|
17173
|
+
if (!(err instanceof SnapshotPushError)) throw err;
|
|
17174
|
+
io.err(`plune mcp snapshot: ${err.message}
|
|
17175
|
+
`);
|
|
17176
|
+
if (err.kind !== "unavailable") return MCP_EXIT.usage;
|
|
17177
|
+
const kept = flags2.out ?? KEPT_FILE;
|
|
17178
|
+
if (flags2.out === void 0) writeAtomically((0, import_node_path8.resolve)(io.cwd, kept), text6, kept, "--push");
|
|
17179
|
+
io.err(`The snapshot is kept in ${kept}.
|
|
17180
|
+
`);
|
|
17181
|
+
return 1;
|
|
16913
17182
|
}
|
|
16914
|
-
return MCP_EXIT.ok;
|
|
16915
17183
|
} catch (err) {
|
|
17184
|
+
if (err instanceof SnapshotPushError) {
|
|
17185
|
+
io.err(`plune mcp snapshot: ${err.message}
|
|
17186
|
+
`);
|
|
17187
|
+
return MCP_EXIT.usage;
|
|
17188
|
+
}
|
|
16916
17189
|
return reportFailure("snapshot", err, io);
|
|
16917
17190
|
}
|
|
16918
17191
|
}
|
|
@@ -17041,7 +17314,7 @@ function writeAtomically(path25, text6, shown4, flag2 = "--out") {
|
|
|
17041
17314
|
throw new UsageError(`${flag2}: could not write ${shown4} (${code}).`);
|
|
17042
17315
|
}
|
|
17043
17316
|
}
|
|
17044
|
-
var import_node_crypto7, import_node_fs12, import_node_os4, import_node_path8, isRecord11, plural5, counts2, MASK_DEPTH, MIN_ARGUMENT_LENGTH, METHOD_NOT_FOUND2;
|
|
17317
|
+
var import_node_crypto7, import_node_fs12, import_node_os4, import_node_path8, KEPT_FILE, isRecord11, plural5, counts2, MASK_DEPTH, MIN_ARGUMENT_LENGTH, METHOD_NOT_FOUND2;
|
|
17045
17318
|
var init_mcp_snapshot = __esm({
|
|
17046
17319
|
"src/cli/commands/mcp-snapshot.ts"() {
|
|
17047
17320
|
"use strict";
|
|
@@ -17056,7 +17329,9 @@ var init_mcp_snapshot = __esm({
|
|
|
17056
17329
|
init_tools();
|
|
17057
17330
|
init_exit_codes();
|
|
17058
17331
|
init_human();
|
|
17332
|
+
init_mcp_snapshot_push();
|
|
17059
17333
|
init_snapshot2();
|
|
17334
|
+
KEPT_FILE = "mcp-snapshot.unsent.json";
|
|
17060
17335
|
isRecord11 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
17061
17336
|
plural5 = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
17062
17337
|
counts2 = (s) => [
|
|
@@ -18254,12 +18529,12 @@ function hostFetch(target4, req, signal) {
|
|
|
18254
18529
|
for (const [n, v] of Object.entries(target4.headers)) if (!given.has(n.toLowerCase())) headers.push(n, v);
|
|
18255
18530
|
for (const [n, v] of req.headers) headers.push(n, v);
|
|
18256
18531
|
const send3 = url.protocol === "https:" ? import_node_https2.request : import_node_http2.request;
|
|
18257
|
-
return new Promise((
|
|
18532
|
+
return new Promise((resolve23, reject) => {
|
|
18258
18533
|
const r = send3(url, { method: req.method, headers, signal }, (res) => {
|
|
18259
18534
|
const pairs2 = [];
|
|
18260
18535
|
for (let i = 0; i + 1 < res.rawHeaders.length; i += 2) pairs2.push([res.rawHeaders[i], res.rawHeaders[i + 1]]);
|
|
18261
18536
|
const nobody = res.statusCode === 204 || res.statusCode === 304;
|
|
18262
|
-
|
|
18537
|
+
resolve23(
|
|
18263
18538
|
new Response(nobody ? null : import_node_stream3.Readable.toWeb(res), {
|
|
18264
18539
|
status: res.statusCode ?? 0,
|
|
18265
18540
|
headers: pairs2
|
|
@@ -18545,7 +18820,7 @@ async function entries(ctx, capability, method, field) {
|
|
|
18545
18820
|
if (w.badPage !== void 0) return failed(`${w.badPage}.`, `Answer ${method} with a result that holds a ${field} array.`);
|
|
18546
18821
|
return w.items;
|
|
18547
18822
|
}
|
|
18548
|
-
var isObject5, counter, nextId,
|
|
18823
|
+
var isObject5, counter, nextId, declares, passed, failed, notDeclared, notOffered, prerequisite, some, PAGE_LIMIT, isOutcome, label;
|
|
18549
18824
|
var init_wire = __esm({
|
|
18550
18825
|
"src/mcp-testing/conformance/checks/wire.ts"() {
|
|
18551
18826
|
"use strict";
|
|
@@ -18554,7 +18829,6 @@ var init_wire = __esm({
|
|
|
18554
18829
|
isObject5 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
18555
18830
|
counter = 0;
|
|
18556
18831
|
nextId = () => `plune-conformance-${++counter}`;
|
|
18557
|
-
dualEra = (ctx) => supportedVersions(ctx).some((v) => v < "2026-07-28");
|
|
18558
18832
|
declares = (ctx, name) => {
|
|
18559
18833
|
const value2 = capabilities(ctx)[name];
|
|
18560
18834
|
return value2 !== void 0 && value2 !== null;
|
|
@@ -20979,6 +21253,8 @@ var init_base = __esm({
|
|
|
20979
21253
|
};
|
|
20980
21254
|
BASE = {
|
|
20981
21255
|
"base-jsonrpc-parse-error": parseError,
|
|
21256
|
+
// The same probe on stdio, as advice: a client may not write invalid JSON there (basic/transports, stdio).
|
|
21257
|
+
"stdio-parse-error-advice": parseError,
|
|
20982
21258
|
"base-unknown-method-error": unknownMethod,
|
|
20983
21259
|
"base-response-id-matches": responseId,
|
|
20984
21260
|
"base-invalid-params-error": invalidParams
|
|
@@ -21183,11 +21459,11 @@ var init_schema2 = __esm({
|
|
|
21183
21459
|
});
|
|
21184
21460
|
|
|
21185
21461
|
// src/mcp-testing/conformance/checks/tools.ts
|
|
21186
|
-
function schemas(list3,
|
|
21462
|
+
function schemas(list3, pick2, root) {
|
|
21187
21463
|
const out = { judged: 0, bad: [], unsupported: [] };
|
|
21188
21464
|
list3.forEach((t, i) => {
|
|
21189
21465
|
if (!isObject5(t)) return;
|
|
21190
|
-
const schema =
|
|
21466
|
+
const schema = pick2(t);
|
|
21191
21467
|
if (schema === void 0) return;
|
|
21192
21468
|
const name = label(t, i);
|
|
21193
21469
|
out.judged++;
|
|
@@ -21507,7 +21783,7 @@ var init_core = __esm({
|
|
|
21507
21783
|
const wrong2 = [];
|
|
21508
21784
|
const got2 = [];
|
|
21509
21785
|
for (const [what, meta, codes] of probes) {
|
|
21510
|
-
const a = await
|
|
21786
|
+
const a = await fresh(ctx, (other) => callAsIs(other, "server/discover", { _meta: meta }));
|
|
21511
21787
|
got2.push(`${what}: ${said(a)}${status(a)}`);
|
|
21512
21788
|
const code = a.kind === "error" && typeof a.code === "number" && codes.includes(a.code);
|
|
21513
21789
|
if (!code || http(ctx) && a.status !== 400) wrong2.push(`${what} answered ${said(a)}${status(a)}`);
|
|
@@ -21520,7 +21796,10 @@ var init_core = __esm({
|
|
|
21520
21796
|
return passed(`server/discover ${got2.join("; ")}.`);
|
|
21521
21797
|
};
|
|
21522
21798
|
unsupportedVersion = async (ctx) => {
|
|
21523
|
-
const a = await
|
|
21799
|
+
const a = await fresh(
|
|
21800
|
+
ctx,
|
|
21801
|
+
(other) => callAsIs(other, "server/discover", { _meta: { ...modernMeta(version(ctx)), [META.version]: "1900-01-01" } })
|
|
21802
|
+
);
|
|
21524
21803
|
const data = a.kind === "error" && isObject5(a.frame["error"]) ? a.frame["error"]["data"] : void 0;
|
|
21525
21804
|
const supported = isObject5(data) ? data["supported"] : void 0;
|
|
21526
21805
|
const problems = [];
|
|
@@ -21874,6 +22153,50 @@ async function bare2(ctx, s, method) {
|
|
|
21874
22153
|
const res = await rawRequest(t, req, { headersOnly: true });
|
|
21875
22154
|
return { req, res, frame: void 0, detail: exchange(t, req, res) };
|
|
21876
22155
|
}
|
|
22156
|
+
function servesLegacy(ctx) {
|
|
22157
|
+
return ctx.memo("serves legacy", async () => {
|
|
22158
|
+
const named2 = supportedVersions(ctx).filter((v) => v < "2026-07-28");
|
|
22159
|
+
if (named2.length > 0) return { legacy: `server/discover names ${some(supportedVersions(ctx))}`, details: [] };
|
|
22160
|
+
const t = target3(ctx);
|
|
22161
|
+
const id2 = nextId();
|
|
22162
|
+
const params = { protocolVersion: "2025-11-25", capabilities: {}, clientInfo: CLIENT };
|
|
22163
|
+
const req = {
|
|
22164
|
+
method: "POST",
|
|
22165
|
+
headers: [
|
|
22166
|
+
["Content-Type", "application/json"],
|
|
22167
|
+
["Accept", ACCEPT]
|
|
22168
|
+
],
|
|
22169
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: id2, method: "initialize", params })
|
|
22170
|
+
};
|
|
22171
|
+
let res;
|
|
22172
|
+
try {
|
|
22173
|
+
res = await rawRequest(t, req, { stopWhen: (e) => answers2(e.data, id2) !== void 0 });
|
|
22174
|
+
} catch (err) {
|
|
22175
|
+
const details2 = [exchange(t, req)];
|
|
22176
|
+
const timeout = err instanceof ConnectError && err.kind === "timeout";
|
|
22177
|
+
return {
|
|
22178
|
+
details: details2,
|
|
22179
|
+
unknown: {
|
|
22180
|
+
state: "could-not-run",
|
|
22181
|
+
reason: timeout ? "timeout" : "transport-error",
|
|
22182
|
+
actual: `Whether the server serves 2025-11-25 as well could not be told: an initialize sent as a 2025-11-25 client sends it got ${timeout ? "no answer in time" : "no answer"} (${err instanceof Error ? err.message : String(err)}).`,
|
|
22183
|
+
details: details2
|
|
22184
|
+
}
|
|
22185
|
+
};
|
|
22186
|
+
}
|
|
22187
|
+
const details = [exchange(t, req, res)];
|
|
22188
|
+
const stop = unjudged(res, details);
|
|
22189
|
+
if (stop !== void 0) return { details, unknown: stop };
|
|
22190
|
+
const sid = header2(res.headers, "mcp-session-id");
|
|
22191
|
+
if (sid !== void 0) {
|
|
22192
|
+
const end2 = { method: "DELETE", headers: [["Mcp-Session-Id", sid], ["MCP-Protocol-Version", "2025-11-25"]] };
|
|
22193
|
+
const ended = await rawRequest(t, end2, { headersOnly: true }).catch(() => void 0);
|
|
22194
|
+
details.push(exchange(t, end2, ended));
|
|
22195
|
+
}
|
|
22196
|
+
const result2 = frameOf(res, id2)?.["result"];
|
|
22197
|
+
return isObject5(result2) && typeof result2["protocolVersion"] === "string" ? { legacy: `initialize sent as a 2025-11-25 client answered protocolVersion ${result2["protocolVersion"]}`, details } : { details };
|
|
22198
|
+
});
|
|
22199
|
+
}
|
|
21877
22200
|
async function streams(ctx) {
|
|
21878
22201
|
const got2 = await probed(ctx);
|
|
21879
22202
|
if (isOutcome3(got2)) return got2;
|
|
@@ -21994,11 +22317,14 @@ var init_transport = __esm({
|
|
|
21994
22317
|
};
|
|
21995
22318
|
};
|
|
21996
22319
|
modernGetDelete405 = async (ctx) => {
|
|
21997
|
-
|
|
22320
|
+
const era = await servesLegacy(ctx);
|
|
22321
|
+
if (era.unknown !== void 0) return era.unknown;
|
|
22322
|
+
if (era.legacy !== void 0)
|
|
21998
22323
|
return {
|
|
21999
22324
|
state: "not-applicable",
|
|
22000
22325
|
reason: "era",
|
|
22001
|
-
actual:
|
|
22326
|
+
actual: `${era.legacy}: the server serves the legacy era as well (dual-era).`,
|
|
22327
|
+
details: era.details
|
|
22002
22328
|
};
|
|
22003
22329
|
const s = await session(ctx);
|
|
22004
22330
|
if (isOutcome3(s)) return s;
|
|
@@ -22222,7 +22548,7 @@ var init_transport = __esm({
|
|
|
22222
22548
|
const open2 = () => {
|
|
22223
22549
|
let opened2 = () => {
|
|
22224
22550
|
};
|
|
22225
|
-
const ready2 = new Promise((
|
|
22551
|
+
const ready2 = new Promise((resolve23) => opened2 = resolve23);
|
|
22226
22552
|
const req = {
|
|
22227
22553
|
method: "GET",
|
|
22228
22554
|
headers: [
|
|
@@ -22464,8 +22790,10 @@ var init_headers = __esm({
|
|
|
22464
22790
|
return passed(`${marked.length} tool${marked.length === 1 ? "" : "s"} with x-mcp-header: every declaration is valid.`);
|
|
22465
22791
|
};
|
|
22466
22792
|
noSessionId = async (ctx) => {
|
|
22467
|
-
|
|
22468
|
-
|
|
22793
|
+
const era = await servesLegacy(ctx);
|
|
22794
|
+
if (era.unknown !== void 0) return era.unknown;
|
|
22795
|
+
if (era.legacy !== void 0)
|
|
22796
|
+
return { state: "not-applicable", reason: "era", actual: `${era.legacy}: a dual-era server may use sessions.`, details: era.details };
|
|
22469
22797
|
const a = await ask(ctx, own(ctx), "server/discover", { set: [["Mcp-Session-Id", "plune-conformance-session"]] });
|
|
22470
22798
|
const sid = header2(a.res.headers, "mcp-session-id");
|
|
22471
22799
|
if (sid === void 0) return { ...passed("server/discover sent with Mcp-Session-Id got an answer without one."), details: [a.detail] };
|
|
@@ -27007,11 +27335,11 @@ var init_security = __esm({
|
|
|
27007
27335
|
details
|
|
27008
27336
|
};
|
|
27009
27337
|
};
|
|
27010
|
-
reach = (host, p) => new Promise((
|
|
27338
|
+
reach = (host, p) => new Promise((resolve23) => {
|
|
27011
27339
|
const socket = (0, import_node_net.connect)({ host, port: p });
|
|
27012
27340
|
const done = (got2) => {
|
|
27013
27341
|
socket.destroy();
|
|
27014
|
-
|
|
27342
|
+
resolve23(got2);
|
|
27015
27343
|
};
|
|
27016
27344
|
socket.setTimeout(CONNECT_MS, () => done(`no answer in ${CONNECT_MS} ms`));
|
|
27017
27345
|
socket.once("connect", () => done("open"));
|
|
@@ -27892,7 +28220,7 @@ var init_tasks = __esm({
|
|
|
27892
28220
|
reason: "needs-input",
|
|
27893
28221
|
actual
|
|
27894
28222
|
});
|
|
27895
|
-
sleep3 = (ms) => new Promise((
|
|
28223
|
+
sleep3 = (ms) => new Promise((resolve23) => setTimeout(resolve23, ms));
|
|
27896
28224
|
results3 = (answers3) => answers3.flatMap((a) => a.kind === "result" ? [a.result] : []);
|
|
27897
28225
|
resultType2 = async (ctx) => {
|
|
27898
28226
|
const s = await ready(ctx);
|
|
@@ -30911,9 +31239,9 @@ async function startPage() {
|
|
|
30911
31239
|
server2.headersTimeout = 5e3;
|
|
30912
31240
|
server2.requestTimeout = 5e3;
|
|
30913
31241
|
server2.keepAliveTimeout = 1e3;
|
|
30914
|
-
await new Promise((
|
|
31242
|
+
await new Promise((resolve23, reject) => {
|
|
30915
31243
|
server2.once("error", reject);
|
|
30916
|
-
server2.listen(0, "127.0.0.1",
|
|
31244
|
+
server2.listen(0, "127.0.0.1", resolve23);
|
|
30917
31245
|
});
|
|
30918
31246
|
const { address, port: port2 } = server2.address();
|
|
30919
31247
|
return {
|
|
@@ -30926,9 +31254,9 @@ async function startPage() {
|
|
|
30926
31254
|
requestTimeout: server2.requestTimeout,
|
|
30927
31255
|
keepAliveTimeout: server2.keepAliveTimeout
|
|
30928
31256
|
},
|
|
30929
|
-
close: () => new Promise((
|
|
31257
|
+
close: () => new Promise((resolve23) => {
|
|
30930
31258
|
server2.closeAllConnections();
|
|
30931
|
-
server2.close(() =>
|
|
31259
|
+
server2.close(() => resolve23());
|
|
30932
31260
|
})
|
|
30933
31261
|
};
|
|
30934
31262
|
}
|
|
@@ -33221,6 +33549,39 @@ async function readCairnRun(dir, deps = {}) {
|
|
|
33221
33549
|
cases
|
|
33222
33550
|
};
|
|
33223
33551
|
}
|
|
33552
|
+
async function readCairnSessionFiles(dir) {
|
|
33553
|
+
const raw = await readJson(path22.join(dir, "screencasts", "screencasts.json"));
|
|
33554
|
+
if (!Array.isArray(raw)) return void 0;
|
|
33555
|
+
const root = await fs18.realpath(dir).catch(() => path22.resolve(dir));
|
|
33556
|
+
const within2 = (p) => {
|
|
33557
|
+
const rel = path22.relative(root, p);
|
|
33558
|
+
return rel !== "" && !rel.startsWith("..") && !path22.isAbsolute(rel);
|
|
33559
|
+
};
|
|
33560
|
+
let outside = 0;
|
|
33561
|
+
const inside = async (p) => {
|
|
33562
|
+
if (typeof p !== "string" || p === "") return void 0;
|
|
33563
|
+
const abs = path22.resolve(root, p);
|
|
33564
|
+
const real = await fs18.realpath(abs).catch(() => void 0);
|
|
33565
|
+
if (within2(abs) && (real === void 0 || within2(real))) return real ?? abs;
|
|
33566
|
+
outside += 1;
|
|
33567
|
+
return void 0;
|
|
33568
|
+
};
|
|
33569
|
+
const byCase = /* @__PURE__ */ new Map();
|
|
33570
|
+
let unmapped = 0;
|
|
33571
|
+
for (const entry2 of raw) {
|
|
33572
|
+
const rec = asRecord2(entry2);
|
|
33573
|
+
const files = [];
|
|
33574
|
+
for (const p of [own2(rec, "video"), own2(rec, "trace")]) {
|
|
33575
|
+
const file = await inside(p);
|
|
33576
|
+
if (file !== void 0) files.push(file);
|
|
33577
|
+
}
|
|
33578
|
+
if (files.length === 0) continue;
|
|
33579
|
+
const stableId = own2(rec, "stableId");
|
|
33580
|
+
if (typeof stableId !== "string" || stableId === "") unmapped += 1;
|
|
33581
|
+
else byCase.set(stableId, [...byCase.get(stableId) ?? [], ...files]);
|
|
33582
|
+
}
|
|
33583
|
+
return { byCase, unmapped, outside };
|
|
33584
|
+
}
|
|
33224
33585
|
var fs18, path22, SUPPORTED_ARTIFACT_VERSION, INGEST_SCHEMA_VERSION, NoCairnRunsError, CairnRunNotFoundError, CairnRunVersionError, CairnRunPartialError, CairnArtifactShapeError, CairnEvidenceAmbiguousError, asRecord2, str, own2, MAX_ARTIFACT_BYTES, MAX_MCP_CASES, ARGS_CHARS2, SECRET_NAME, maskNamed, MCP_STATES;
|
|
33225
33586
|
var init_cairn_artifact = __esm({
|
|
33226
33587
|
"src/cli/commands/cairn-artifact.ts"() {
|
|
@@ -33316,6 +33677,125 @@ __export(ingest_exports, {
|
|
|
33316
33677
|
handleIngest: () => handleIngest,
|
|
33317
33678
|
reportIngestFailure: () => reportIngestFailure
|
|
33318
33679
|
});
|
|
33680
|
+
function itemsOf(body) {
|
|
33681
|
+
const items2 = body?.items;
|
|
33682
|
+
if (!Array.isArray(items2)) return void 0;
|
|
33683
|
+
return items2.flatMap((raw) => {
|
|
33684
|
+
const i = raw ?? {};
|
|
33685
|
+
if (typeof i["stableId"] !== "string") return [];
|
|
33686
|
+
const reviewItemId = typeof i["reviewItemId"] === "string" && i["reviewItemId"] !== "" ? i["reviewItemId"] : void 0;
|
|
33687
|
+
const resultId = typeof i["resultId"] === "string" && i["resultId"] !== "" ? i["resultId"] : void 0;
|
|
33688
|
+
if (reviewItemId === void 0 && resultId === void 0) return [];
|
|
33689
|
+
return [{ stableId: i["stableId"], ...reviewItemId !== void 0 ? { reviewItemId } : {}, ...resultId !== void 0 ? { resultId } : {} }];
|
|
33690
|
+
});
|
|
33691
|
+
}
|
|
33692
|
+
async function heldBy(client, runId, jobs) {
|
|
33693
|
+
const held = /* @__PURE__ */ new Map();
|
|
33694
|
+
for (const job of jobs) {
|
|
33695
|
+
const key = targetOf3(job);
|
|
33696
|
+
if (held.has(key) || job.owner !== "review-items") continue;
|
|
33697
|
+
const out = await client.get(`/v1/review-items/${encodeURIComponent(job.id)}`);
|
|
33698
|
+
held.set(key, out.ok ? namesOf(out.body?.files) : void 0);
|
|
33699
|
+
}
|
|
33700
|
+
const results4 = jobs.filter((j) => j.owner === void 0);
|
|
33701
|
+
if (results4.length === 0) return held;
|
|
33702
|
+
let byResult = /* @__PURE__ */ new Map();
|
|
33703
|
+
let before;
|
|
33704
|
+
for (let page = 0; ; page += 1) {
|
|
33705
|
+
if (runId === "" || page >= RESULT_PAGES_MAX) {
|
|
33706
|
+
byResult = void 0;
|
|
33707
|
+
break;
|
|
33708
|
+
}
|
|
33709
|
+
const query = before === void 0 ? "" : `?before=${encodeURIComponent(before)}`;
|
|
33710
|
+
const out = await client.get(`/v1/runs/${encodeURIComponent(runId)}/results${query}`);
|
|
33711
|
+
if (!out.ok || !Array.isArray(out.body?.results)) {
|
|
33712
|
+
byResult = void 0;
|
|
33713
|
+
break;
|
|
33714
|
+
}
|
|
33715
|
+
for (const r of out.body.results) {
|
|
33716
|
+
if (typeof r?.id === "string") byResult.set(r.id, namesOf(r.files));
|
|
33717
|
+
}
|
|
33718
|
+
if (typeof out.body.next !== "string" || out.body.next === "") break;
|
|
33719
|
+
before = out.body.next;
|
|
33720
|
+
}
|
|
33721
|
+
for (const job of results4) held.set(targetOf3(job), byResult === void 0 ? void 0 : byResult.get(job.id) ?? /* @__PURE__ */ new Set());
|
|
33722
|
+
return held;
|
|
33723
|
+
}
|
|
33724
|
+
async function sendSessionFiles(dir, sent, platform) {
|
|
33725
|
+
const session2 = await readCairnSessionFiles(dir);
|
|
33726
|
+
if (session2 === void 0 || session2.byCase.size === 0 && session2.unmapped === 0 && session2.outside === 0) return [];
|
|
33727
|
+
if (sent.items === void 0) {
|
|
33728
|
+
return ["session files not uploaded \u2014 this Plune is older than the routes that take them"];
|
|
33729
|
+
}
|
|
33730
|
+
const lines = [];
|
|
33731
|
+
if (session2.outside > 0) lines.push(`${session2.outside} file(s) not uploaded \u2014 the path leaves the run directory`);
|
|
33732
|
+
if (session2.unmapped > 0) lines.push(`${session2.unmapped} recording(s) name no case \u2014 not uploaded`);
|
|
33733
|
+
let jobs = [];
|
|
33734
|
+
let tooBig = 0;
|
|
33735
|
+
const placed = /* @__PURE__ */ new Set();
|
|
33736
|
+
for (const item of sent.items) {
|
|
33737
|
+
const paths = session2.byCase.get(item.stableId);
|
|
33738
|
+
if (paths === void 0 || placed.has(item.stableId)) continue;
|
|
33739
|
+
placed.add(item.stableId);
|
|
33740
|
+
for (const file of paths) {
|
|
33741
|
+
const name = path23.basename(file);
|
|
33742
|
+
const size = await import_node_fs19.promises.stat(file).then((s) => s.size, () => void 0);
|
|
33743
|
+
if (size !== void 0 && size > SESSION_FILE_MAX) {
|
|
33744
|
+
tooBig += 1;
|
|
33745
|
+
lines.push(`"${name}" skipped \u2014 larger than the ${SESSION_FILE_MAX / (1024 * 1024)} MiB a session file may be`);
|
|
33746
|
+
continue;
|
|
33747
|
+
}
|
|
33748
|
+
const type = TYPE_BY_EXTENSION2[path23.extname(file).toLowerCase()] ?? "application/octet-stream";
|
|
33749
|
+
jobs.push({
|
|
33750
|
+
id: item.reviewItemId ?? item.resultId,
|
|
33751
|
+
...item.reviewItemId !== void 0 ? { owner: "review-items" } : {},
|
|
33752
|
+
kind: "file",
|
|
33753
|
+
name,
|
|
33754
|
+
type,
|
|
33755
|
+
path: file
|
|
33756
|
+
});
|
|
33757
|
+
}
|
|
33758
|
+
}
|
|
33759
|
+
const unplaced = [...session2.byCase.keys()].filter((stableId) => !placed.has(stableId)).length;
|
|
33760
|
+
if (unplaced > 0) lines.push(`${unplaced} case(s) with recordings got no proposal or result in this run \u2014 not uploaded`);
|
|
33761
|
+
const client = createClient({
|
|
33762
|
+
apiUrl: platform.apiUrl,
|
|
33763
|
+
token: platform.token,
|
|
33764
|
+
uploadRetries: UPLOAD_RETRIES.default,
|
|
33765
|
+
...platform.fetchImpl !== void 0 ? { fetchImpl: platform.fetchImpl } : {}
|
|
33766
|
+
});
|
|
33767
|
+
if (sent.repeat && jobs.length > 0) {
|
|
33768
|
+
const held = await heldBy(client, sent.runId, jobs);
|
|
33769
|
+
let already = 0;
|
|
33770
|
+
let unknown = 0;
|
|
33771
|
+
jobs = jobs.filter((job) => {
|
|
33772
|
+
const names = held.get(targetOf3(job));
|
|
33773
|
+
if (names === void 0) unknown += 1;
|
|
33774
|
+
else if (names.has(job.name)) already += 1;
|
|
33775
|
+
else return true;
|
|
33776
|
+
return false;
|
|
33777
|
+
});
|
|
33778
|
+
if (unknown > 0) lines.push(`${unknown} file(s) not sent again \u2014 what the platform holds could not be read`);
|
|
33779
|
+
lines.push(`${already} file(s) already on the platform, ${jobs.length} sent`);
|
|
33780
|
+
}
|
|
33781
|
+
const counts3 = { screenshots: { uploaded: 0, skipped: 0, failed: 0 }, textFiles: { uploaded: 0, skipped: 0, failed: 0 }, otherFiles: { uploaded: 0, skipped: 0, failed: 0 } };
|
|
33782
|
+
if (jobs.length > 0) {
|
|
33783
|
+
const notes = [];
|
|
33784
|
+
const files = fileSender({
|
|
33785
|
+
client,
|
|
33786
|
+
log: (line) => notes.push(line.replace(/^plune: /, "")),
|
|
33787
|
+
stats: counts3,
|
|
33788
|
+
uploadsAtOnce: SESSION_UPLOADS_AT_ONCE,
|
|
33789
|
+
uploadRetries: UPLOAD_RETRIES.default,
|
|
33790
|
+
without: "the run is recorded without it"
|
|
33791
|
+
});
|
|
33792
|
+
await files.uploadEach(jobs);
|
|
33793
|
+
lines.push(...notes.filter((n) => !n.startsWith("storage bucket found")));
|
|
33794
|
+
}
|
|
33795
|
+
const { uploaded, skipped: skipped2, failed: failed2 } = counts3.otherFiles;
|
|
33796
|
+
const total = `${uploaded} session file(s) uploaded` + (skipped2 + tooBig > 0 ? `, ${skipped2 + tooBig} skipped` : "") + (failed2 > 0 ? `, ${failed2} failed to upload` : "");
|
|
33797
|
+
return [total, ...lines];
|
|
33798
|
+
}
|
|
33319
33799
|
async function safeErrorDetail4(res) {
|
|
33320
33800
|
try {
|
|
33321
33801
|
const body = await res.json();
|
|
@@ -33335,8 +33815,12 @@ async function handleIngest(deps) {
|
|
|
33335
33815
|
const job = new JobReporter(doFetch, apiUrl, token2, "ingest");
|
|
33336
33816
|
await job.open(path23.basename(path23.resolve(dir)), payload2.cases.length);
|
|
33337
33817
|
try {
|
|
33338
|
-
const result2 = await upload();
|
|
33818
|
+
const { result: result2, ...sent } = await upload();
|
|
33339
33819
|
await job.uploaded({ subjectId: result2.runId || void 0 });
|
|
33820
|
+
const files = await sendSessionFiles(dir, { ...sent, runId: result2.runId }, { apiUrl, token: token2, ...deps.fetchImpl !== void 0 ? { fetchImpl: deps.fetchImpl } : {} }).catch(
|
|
33821
|
+
() => ["session files not uploaded (an unexpected error) \u2014 the run is recorded"]
|
|
33822
|
+
);
|
|
33823
|
+
if (files.length > 0) result2.files = files;
|
|
33340
33824
|
await job.finish({ ok: true });
|
|
33341
33825
|
if (job.problem !== void 0) result2.jobProblem = job.problem;
|
|
33342
33826
|
return result2;
|
|
@@ -33361,12 +33845,13 @@ async function handleIngest(deps) {
|
|
|
33361
33845
|
throw new IngestHttpError(res.status, detail);
|
|
33362
33846
|
}
|
|
33363
33847
|
const body = await res.json().catch(() => ({}));
|
|
33364
|
-
|
|
33848
|
+
const result2 = {
|
|
33365
33849
|
runId: typeof body.runId === "string" ? body.runId : "",
|
|
33366
33850
|
linked: typeof body.linked === "number" ? body.linked : 0,
|
|
33367
33851
|
proposed: typeof body.proposed === "number" ? body.proposed : 0,
|
|
33368
33852
|
skipped: typeof body.skipped === "number" ? body.skipped : 0
|
|
33369
33853
|
};
|
|
33854
|
+
return { result: result2, items: itemsOf(body), repeat: res.status === 200 };
|
|
33370
33855
|
}
|
|
33371
33856
|
}
|
|
33372
33857
|
function reportIngestFailure(err, write) {
|
|
@@ -33387,17 +33872,22 @@ function formatIngestResult(r) {
|
|
|
33387
33872
|
`Ingested Cairn run \u2192 ${r.runId}`,
|
|
33388
33873
|
` ${r.linked} result(s) attached to existing cases`,
|
|
33389
33874
|
` ${r.proposed} case(s) proposed \u2014 review them in Plune to accept`,
|
|
33390
|
-
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)
|
|
33875
|
+
` ${r.skipped} skipped (already queued, already rejected, repeated, or never executed)`,
|
|
33876
|
+
...(r.files ?? []).map((line, i) => i === 0 ? ` ${line}` : ` ${line}`)
|
|
33391
33877
|
];
|
|
33392
33878
|
return `${lines.join("\n")}
|
|
33393
33879
|
`;
|
|
33394
33880
|
}
|
|
33395
|
-
var path23, IngestNotLoggedInError, IngestTokenRejectedError, IngestNetworkError, IngestHttpError;
|
|
33881
|
+
var import_node_fs19, path23, IngestNotLoggedInError, IngestTokenRejectedError, IngestNetworkError, IngestHttpError, SESSION_FILE_MAX, SESSION_UPLOADS_AT_ONCE, TYPE_BY_EXTENSION2, RESULT_PAGES_MAX, namesOf, targetOf3;
|
|
33396
33882
|
var init_ingest = __esm({
|
|
33397
33883
|
"src/cli/commands/ingest.ts"() {
|
|
33398
33884
|
"use strict";
|
|
33399
33885
|
init_cjs_shims();
|
|
33886
|
+
import_node_fs19 = require("fs");
|
|
33400
33887
|
path23 = __toESM(require("path"), 1);
|
|
33888
|
+
init_client();
|
|
33889
|
+
init_env2();
|
|
33890
|
+
init_session2();
|
|
33401
33891
|
init_api_url();
|
|
33402
33892
|
init_credentials();
|
|
33403
33893
|
init_cairn_artifact();
|
|
@@ -33428,6 +33918,12 @@ var init_ingest = __esm({
|
|
|
33428
33918
|
}
|
|
33429
33919
|
status;
|
|
33430
33920
|
};
|
|
33921
|
+
SESSION_FILE_MAX = 100 * 1024 * 1024;
|
|
33922
|
+
SESSION_UPLOADS_AT_ONCE = 4;
|
|
33923
|
+
TYPE_BY_EXTENSION2 = { ".webm": "video/webm", ".zip": "application/zip" };
|
|
33924
|
+
RESULT_PAGES_MAX = 100;
|
|
33925
|
+
namesOf = (files) => new Set(Array.isArray(files) ? files.flatMap((f) => typeof f?.name === "string" ? [f.name] : []) : []);
|
|
33926
|
+
targetOf3 = (job) => `${job.owner ?? "results"}/${job.id}`;
|
|
33431
33927
|
}
|
|
33432
33928
|
});
|
|
33433
33929
|
|
|
@@ -33539,7 +34035,7 @@ function readMarkdown(cwd, file) {
|
|
|
33539
34035
|
const target4 = (0, import_node_path13.resolve)(cwd, file);
|
|
33540
34036
|
let size;
|
|
33541
34037
|
try {
|
|
33542
|
-
const st = (0,
|
|
34038
|
+
const st = (0, import_node_fs20.statSync)(target4);
|
|
33543
34039
|
if (!st.isFile()) return usage(`${target4} is not a file.`);
|
|
33544
34040
|
size = st.size;
|
|
33545
34041
|
} catch {
|
|
@@ -33550,7 +34046,7 @@ function readMarkdown(cwd, file) {
|
|
|
33550
34046
|
}
|
|
33551
34047
|
let text6;
|
|
33552
34048
|
try {
|
|
33553
|
-
text6 = new TextDecoder("utf-8", { fatal: true }).decode((0,
|
|
34049
|
+
text6 = new TextDecoder("utf-8", { fatal: true }).decode((0, import_node_fs20.readFileSync)(target4));
|
|
33554
34050
|
} catch {
|
|
33555
34051
|
return usage(`${target4} is not valid UTF-8. Save it as UTF-8 and try again.`);
|
|
33556
34052
|
}
|
|
@@ -33674,12 +34170,12 @@ function reportRequirementsImportFailure(err, write) {
|
|
|
33674
34170
|
write(err.message + "\n");
|
|
33675
34171
|
return err.exitCode;
|
|
33676
34172
|
}
|
|
33677
|
-
var
|
|
34173
|
+
var import_node_fs20, import_node_path13, MAX_MARKDOWN_BYTES, RequirementsImportError, usage, COLUMN_FLAGS, SECTION_FLAGS, oneOf5, TABLE_SPEC_KEYS, SPEC_HELP, SUPPORT, SHOWN4, flat2, cut4, plural8;
|
|
33678
34174
|
var init_requirements_import = __esm({
|
|
33679
34175
|
"src/cli/commands/requirements-import.ts"() {
|
|
33680
34176
|
"use strict";
|
|
33681
34177
|
init_cjs_shims();
|
|
33682
|
-
|
|
34178
|
+
import_node_fs20 = require("fs");
|
|
33683
34179
|
import_node_path13 = require("path");
|
|
33684
34180
|
init_client();
|
|
33685
34181
|
init_api_url();
|
|
@@ -33880,7 +34376,7 @@ async function loadSources(deps) {
|
|
|
33880
34376
|
let raw;
|
|
33881
34377
|
if (deps.from !== void 0) {
|
|
33882
34378
|
try {
|
|
33883
|
-
raw = (0,
|
|
34379
|
+
raw = (0, import_node_fs21.readFileSync)(deps.from, "utf8");
|
|
33884
34380
|
} catch {
|
|
33885
34381
|
throw new SyncFileError(`cannot read ${deps.from}`);
|
|
33886
34382
|
}
|
|
@@ -33932,13 +34428,13 @@ function formatVerify(r) {
|
|
|
33932
34428
|
);
|
|
33933
34429
|
return lines.join("\n") + "\n";
|
|
33934
34430
|
}
|
|
33935
|
-
var import_node_child_process4,
|
|
34431
|
+
var import_node_child_process4, import_node_fs21, TOKEN5;
|
|
33936
34432
|
var init_verify = __esm({
|
|
33937
34433
|
"src/cli/commands/verify.ts"() {
|
|
33938
34434
|
"use strict";
|
|
33939
34435
|
init_cjs_shims();
|
|
33940
34436
|
import_node_child_process4 = require("child_process");
|
|
33941
|
-
|
|
34437
|
+
import_node_fs21 = require("fs");
|
|
33942
34438
|
init_plan();
|
|
33943
34439
|
init_sync();
|
|
33944
34440
|
TOKEN5 = /@P([A-Za-z0-9_-]+)/;
|
|
@@ -34075,13 +34571,13 @@ async function handleAutomate(deps) {
|
|
|
34075
34571
|
const viaShell = process.platform === "win32" && /\.(cmd|bat)$/i.test(executable);
|
|
34076
34572
|
const quoted = (s) => `"${s.replace(/"/g, '""')}"`;
|
|
34077
34573
|
const spawnImpl = deps.spawnImpl ?? import_node_child_process5.spawn;
|
|
34078
|
-
const runCairn = (args, capture) => new Promise((
|
|
34574
|
+
const runCairn = (args, capture) => new Promise((resolve23) => {
|
|
34079
34575
|
const opts = { cwd: repo, env: childEnv, stdio: ["ignore", capture ? "pipe" : 2, 2] };
|
|
34080
34576
|
const child = isScript ? spawnImpl(process.execPath, [executable, ...args], opts) : viaShell ? spawnImpl([executable, ...args].map(quoted).join(" "), { ...opts, shell: true }) : spawnImpl(executable, args, opts);
|
|
34081
34577
|
let out = "";
|
|
34082
34578
|
child.stdout?.on("data", (chunk2) => void (out += chunk2.toString("utf8")));
|
|
34083
|
-
child.on("close", (exitCode2) =>
|
|
34084
|
-
child.on("error", () =>
|
|
34579
|
+
child.on("close", (exitCode2) => resolve23({ code: exitCode2 ?? 1, out }));
|
|
34580
|
+
child.on("error", () => resolve23({ code: -1, out }));
|
|
34085
34581
|
});
|
|
34086
34582
|
const { code } = await runCairn(["automate", "--run", runDir, ...deps.cairnArgs ?? []], false);
|
|
34087
34583
|
if (code === -1) throw new CairnMissingError(command);
|
|
@@ -34353,10 +34849,10 @@ __export(ids_exports, {
|
|
|
34353
34849
|
serializeMap: () => serializeMap
|
|
34354
34850
|
});
|
|
34355
34851
|
function readMap(file) {
|
|
34356
|
-
if (!(0,
|
|
34852
|
+
if (!(0, import_node_fs22.existsSync)(file)) return {};
|
|
34357
34853
|
let parsed4;
|
|
34358
34854
|
try {
|
|
34359
|
-
parsed4 = JSON.parse((0,
|
|
34855
|
+
parsed4 = JSON.parse((0, import_node_fs22.readFileSync)(file, "utf8"));
|
|
34360
34856
|
} catch {
|
|
34361
34857
|
throw new SyncFileError(`${file} is not valid JSON; fix or remove it, nothing was written`);
|
|
34362
34858
|
}
|
|
@@ -34404,8 +34900,8 @@ async function handleIds(deps) {
|
|
|
34404
34900
|
let written = false;
|
|
34405
34901
|
if (deps.write === true && Object.keys(plan.added).length > 0) {
|
|
34406
34902
|
try {
|
|
34407
|
-
(0,
|
|
34408
|
-
(0,
|
|
34903
|
+
(0, import_node_fs22.mkdirSync)((0, import_node_path14.dirname)(file), { recursive: true });
|
|
34904
|
+
(0, import_node_fs22.writeFileSync)(file, serializeMap({ ...current, ...plan.added }));
|
|
34409
34905
|
} catch {
|
|
34410
34906
|
throw new SyncFileError(`cannot write ${file}`);
|
|
34411
34907
|
}
|
|
@@ -34433,12 +34929,12 @@ function formatIds(r, write) {
|
|
|
34433
34929
|
);
|
|
34434
34930
|
return lines.join("\n") + "\n";
|
|
34435
34931
|
}
|
|
34436
|
-
var
|
|
34932
|
+
var import_node_fs22, import_node_path14, DEFAULT_IDS_FILE, compareKeys;
|
|
34437
34933
|
var init_ids = __esm({
|
|
34438
34934
|
"src/cli/commands/ids.ts"() {
|
|
34439
34935
|
"use strict";
|
|
34440
34936
|
init_cjs_shims();
|
|
34441
|
-
|
|
34937
|
+
import_node_fs22 = require("fs");
|
|
34442
34938
|
import_node_path14 = require("path");
|
|
34443
34939
|
init_verify();
|
|
34444
34940
|
init_sync();
|
|
@@ -34457,7 +34953,7 @@ module.exports = __toCommonJS(cli_exports);
|
|
|
34457
34953
|
init_cjs_shims();
|
|
34458
34954
|
init_api_url();
|
|
34459
34955
|
var import_commander = require("commander");
|
|
34460
|
-
var
|
|
34956
|
+
var import_node_fs23 = require("fs");
|
|
34461
34957
|
var import_node_path15 = require("path");
|
|
34462
34958
|
var import_node_url = require("url");
|
|
34463
34959
|
init_duration();
|
|
@@ -34494,7 +34990,7 @@ var rawArgsOf = (program) => program.rawArgs ?? [];
|
|
|
34494
34990
|
|
|
34495
34991
|
// src/cli.ts
|
|
34496
34992
|
var __dirname = (0, import_node_path15.dirname)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
34497
|
-
var pkg = JSON.parse((0,
|
|
34993
|
+
var pkg = JSON.parse((0, import_node_fs23.readFileSync)((0, import_node_path15.join)(__dirname, "..", "package.json"), "utf-8"));
|
|
34498
34994
|
function toFormat(s) {
|
|
34499
34995
|
return s === "json" || s === "markdown" ? s : "console";
|
|
34500
34996
|
}
|
|
@@ -34503,7 +34999,7 @@ function shouldColor(outputPath) {
|
|
|
34503
34999
|
}
|
|
34504
35000
|
function writeReport2(text6, outputPath) {
|
|
34505
35001
|
if (outputPath !== void 0) {
|
|
34506
|
-
(0,
|
|
35002
|
+
(0, import_node_fs23.writeFileSync)(outputPath, text6);
|
|
34507
35003
|
} else {
|
|
34508
35004
|
process.stdout.write(text6 + "\n");
|
|
34509
35005
|
}
|
|
@@ -35032,7 +35528,7 @@ ${missed.map((m) => ` - ${m}`).join("\n")}
|
|
|
35032
35528
|
mcp.command("snapshot").description(
|
|
35033
35529
|
"Write the contract of any MCP server (tools, resources, resource templates, prompts, capabilities) as stable JSON: exit 2 when a declared list cannot be read, 3 when the server lists nothing"
|
|
35034
35530
|
)
|
|
35035
|
-
).option("--out <path>", "Write the snapshot to this file, whole or not at all (default: stdout)").action(async (server2, options, command) => {
|
|
35531
|
+
).option("--out <path>", "Write the snapshot to this file, whole or not at all (default: stdout)").option("--push", "Send the snapshot to the platform (nothing is sent without this flag); needs --server or --server-name").option("--server <id>", "--push: the id of the platform's MCP server").option("--server-name <name>", "--push: the platform's MCP server by name; added on the first push").option("--environment <text>", "--push: where the server was running (ci, staging); kept with the snapshot, not part of the contract").action(async (server2, options, command) => {
|
|
35036
35532
|
const verbose = command.optsWithGlobals().verbose === true;
|
|
35037
35533
|
const { handleMcpSnapshot: handleMcpSnapshot2 } = await Promise.resolve().then(() => (init_mcp_snapshot(), mcp_snapshot_exports));
|
|
35038
35534
|
try {
|
|
@@ -35427,7 +35923,7 @@ function isMainModule() {
|
|
|
35427
35923
|
const entry2 = process.argv[1];
|
|
35428
35924
|
if (entry2 === void 0) return false;
|
|
35429
35925
|
try {
|
|
35430
|
-
return (0,
|
|
35926
|
+
return (0, import_node_fs23.realpathSync)(entry2) === (0, import_node_fs23.realpathSync)((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
35431
35927
|
} catch {
|
|
35432
35928
|
return false;
|
|
35433
35929
|
}
|