@plune-ai/cli 0.39.1 → 0.39.3
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 +3 -2
- package/dist/cli.cjs +406 -104
- package/dist/index.cjs +62 -6
- package/dist/index.js +57 -1
- package/dist/mcp-tools.cjs +11 -2
- package/dist/mcp-tools.d.cts +7 -2
- package/dist/mcp-tools.d.ts +7 -2
- package/dist/mcp-tools.js +10 -2
- package/dist/reporter-core.cjs +227 -6
- package/dist/reporter-core.d.cts +13 -1
- package/dist/reporter-core.d.ts +13 -1
- package/dist/reporter-core.js +222 -1
- package/package.json +1 -1
- package/skills/qa-mission/SKILL.md +28 -5
- package/skills/qa-mission/references/llm-evals.md +126 -0
- package/skills/qa-mission/references/tool-calls.md +11 -6
package/dist/index.cjs
CHANGED
|
@@ -1753,7 +1753,29 @@ var PRICE_TABLE = {
|
|
|
1753
1753
|
// OpenRouter has hundreds of models and dynamic routing, so most still need a `pricing` entry
|
|
1754
1754
|
// in plune.yaml (or report cost_usd=0). Verify against OpenRouter's current rates.
|
|
1755
1755
|
"openai/gpt-4o": { input_per_1k_usd: 25e-4, output_per_1k_usd: 0.01 },
|
|
1756
|
-
"openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 }
|
|
1756
|
+
"openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
|
|
1757
|
+
// Via OpenRouter, the models the agent scenarios workflow can be run on. Source:
|
|
1758
|
+
// https://openrouter.ai/api/v1/models (`pricing`, USD per token), read on 2026-11-18, kept here
|
|
1759
|
+
// per thousand. A real OpenRouter call reports its own cost, which wins over these; they price a
|
|
1760
|
+
// dry run and any call that reports none. Long prompts may cost more on some of them.
|
|
1761
|
+
// The cheap set:
|
|
1762
|
+
"deepseek/deepseek-v4-flash": { input_per_1k_usd: 9e-5, output_per_1k_usd: 18e-5 },
|
|
1763
|
+
"qwen/qwen3.7-flash": { input_per_1k_usd: 3e-5, output_per_1k_usd: 13e-5 },
|
|
1764
|
+
"google/gemini-2.5-flash-lite": { input_per_1k_usd: 1e-4, output_per_1k_usd: 4e-4 },
|
|
1765
|
+
"mistralai/mistral-small-3.2-24b-instruct": {
|
|
1766
|
+
input_per_1k_usd: 75e-6,
|
|
1767
|
+
output_per_1k_usd: 2e-4
|
|
1768
|
+
},
|
|
1769
|
+
"openai/gpt-oss-120b": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
|
|
1770
|
+
"anthropic/claude-haiku-5.5": { input_per_1k_usd: 1e-4, output_per_1k_usd: 5e-4 },
|
|
1771
|
+
"z-ai/glm-5.3-flash": { input_per_1k_usd: 399e-7, output_per_1k_usd: 784e-7 },
|
|
1772
|
+
// The middle set:
|
|
1773
|
+
"moonshotai/kimi-k2.6": { input_per_1k_usd: 65e-5, output_per_1k_usd: 341e-5 },
|
|
1774
|
+
"minimax/minimax-m3": { input_per_1k_usd: 3e-4, output_per_1k_usd: 12e-4 },
|
|
1775
|
+
"qwen/qwen3.7-plus": { input_per_1k_usd: 32e-5, output_per_1k_usd: 128e-5 },
|
|
1776
|
+
"google/gemini-3.8-flash": { input_per_1k_usd: 825e-6, output_per_1k_usd: 4125e-6 },
|
|
1777
|
+
"deepseek/deepseek-v4-pro": { input_per_1k_usd: 9e-4, output_per_1k_usd: 15e-4 },
|
|
1778
|
+
"openai/gpt-6.1-terra": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 }
|
|
1757
1779
|
};
|
|
1758
1780
|
|
|
1759
1781
|
// src/providers/cost.ts
|
|
@@ -5172,6 +5194,7 @@ function createClient(opts) {
|
|
|
5172
5194
|
upload: (path11, bytes, contentType) => send("POST", path11, { body: bytes, type: contentType }, uploadRetries ?? DEFAULT_RETRIES),
|
|
5173
5195
|
del: (path11) => send("DELETE", path11),
|
|
5174
5196
|
get: (path11) => send("GET", path11),
|
|
5197
|
+
patch: (path11, body) => send("PATCH", path11, { body: JSON.stringify(body), type: "application/json" }),
|
|
5175
5198
|
async put(url, headers, source) {
|
|
5176
5199
|
const putRetries = uploadRetries ?? 3;
|
|
5177
5200
|
let last = { ok: false, status: null, code: "network" };
|
|
@@ -5215,7 +5238,7 @@ var UPLOAD_RETRIES = { min: 0, max: 20, default: 6 };
|
|
|
5215
5238
|
// src/reporter-core/session.ts
|
|
5216
5239
|
init_cjs_shims();
|
|
5217
5240
|
var import_node_crypto4 = require("crypto");
|
|
5218
|
-
var
|
|
5241
|
+
var import_node_fs8 = require("fs");
|
|
5219
5242
|
var import_node_path3 = require("path");
|
|
5220
5243
|
var import_node_util2 = require("util");
|
|
5221
5244
|
init_failure_detail();
|
|
@@ -5248,6 +5271,39 @@ var fs7 = __toESM(require("fs"), 1);
|
|
|
5248
5271
|
var path8 = __toESM(require("path"), 1);
|
|
5249
5272
|
var DEFAULT_FALLBACK_PATH = path8.join(".plune", "pending-results.jsonl");
|
|
5250
5273
|
|
|
5274
|
+
// src/reporter-core/code-snapshot.ts
|
|
5275
|
+
init_cjs_shims();
|
|
5276
|
+
var import_node_fs7 = require("fs");
|
|
5277
|
+
var BEFORE_REGEX = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^"]);
|
|
5278
|
+
var CREDENTIAL = "password|passphrase|passwd|pass|pwd|token|secret|api[-_]?key|private[-_]?key|credential|auth|session|cookie";
|
|
5279
|
+
var LITERAL = String.raw`(?<q>['"\x60])(?:\\.|(?!\k<q>)[^\\\n])*\k<q>`;
|
|
5280
|
+
var TYPING = "(?:fill|type|pressSequentially)";
|
|
5281
|
+
var PLACES = [
|
|
5282
|
+
// `password = '…'`, `apiKey: "…"`, `'x-api-key': '…'`
|
|
5283
|
+
new RegExp(
|
|
5284
|
+
String.raw`(?<lead>\b(?<role>[\w$-]*(?:${CREDENTIAL})[\w$-]*)['"]?\s*[:=]\s*)${LITERAL}`,
|
|
5285
|
+
"gi"
|
|
5286
|
+
),
|
|
5287
|
+
// `setToken('…')`: the call is named for a credential
|
|
5288
|
+
new RegExp(String.raw`(?<lead>\b(?<role>[\w$]*(?:${CREDENTIAL})[\w$]*)\s*\(\s*)${LITERAL}`, "gi"),
|
|
5289
|
+
// `.fill('#password', '…')`, `.type('#pwd', '…')`: the field is named in the same call
|
|
5290
|
+
new RegExp(
|
|
5291
|
+
String.raw`(?<lead>\.${TYPING}\(\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*)${LITERAL}`,
|
|
5292
|
+
"gi"
|
|
5293
|
+
),
|
|
5294
|
+
// `getByLabel('Password').fill('…')`, `getByRole('textbox', { name: 'Password' }).type('…')`: … or
|
|
5295
|
+
// anywhere in the call the typing is chained off
|
|
5296
|
+
new RegExp(
|
|
5297
|
+
String.raw`(?<lead>\([^()\n]*?(?<role>${CREDENTIAL})[^()\n]*\)\s*\.${TYPING}\(\s*)${LITERAL}`,
|
|
5298
|
+
"gi"
|
|
5299
|
+
),
|
|
5300
|
+
// `{ name: 'session', value: '…' }`: a cookie (or any name/value pair) named for a credential
|
|
5301
|
+
new RegExp(
|
|
5302
|
+
String.raw`(?<lead>\bname\s*:\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*value\s*:\s*)${LITERAL}`,
|
|
5303
|
+
"gi"
|
|
5304
|
+
)
|
|
5305
|
+
];
|
|
5306
|
+
|
|
5251
5307
|
// src/reporter-core/session.ts
|
|
5252
5308
|
var SCREENSHOT_TYPES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp"]);
|
|
5253
5309
|
var SCREENSHOT_BYTES = 2 * 1024 * 1024;
|
|
@@ -5391,7 +5447,7 @@ function fileSender(options) {
|
|
|
5391
5447
|
if (job.body !== void 0) bytes = job.body;
|
|
5392
5448
|
else {
|
|
5393
5449
|
try {
|
|
5394
|
-
bytes = await
|
|
5450
|
+
bytes = await import_node_fs8.promises.readFile(job.path);
|
|
5395
5451
|
} catch {
|
|
5396
5452
|
return skip(kind, job.name, "missing");
|
|
5397
5453
|
}
|
|
@@ -5446,7 +5502,7 @@ function fileSender(options) {
|
|
|
5446
5502
|
else if (job.path === void 0) return void skip(kind, job.name, "missing");
|
|
5447
5503
|
else {
|
|
5448
5504
|
try {
|
|
5449
|
-
size = (await
|
|
5505
|
+
size = (await import_node_fs8.promises.stat(job.path)).size;
|
|
5450
5506
|
} catch {
|
|
5451
5507
|
return void skip(kind, job.name, "missing");
|
|
5452
5508
|
}
|
|
@@ -5502,7 +5558,7 @@ function fileSender(options) {
|
|
|
5502
5558
|
else if (job.path === void 0) return void skip(job.kind, job.name, "missing");
|
|
5503
5559
|
else {
|
|
5504
5560
|
try {
|
|
5505
|
-
size = (await
|
|
5561
|
+
size = (await import_node_fs8.promises.stat(job.path)).size;
|
|
5506
5562
|
} catch {
|
|
5507
5563
|
return void skip(job.kind, job.name, "missing");
|
|
5508
5564
|
}
|
|
@@ -5676,7 +5732,7 @@ function fileSender(options) {
|
|
|
5676
5732
|
}
|
|
5677
5733
|
let data;
|
|
5678
5734
|
try {
|
|
5679
|
-
data = job.body ?? await
|
|
5735
|
+
data = job.body ?? await import_node_fs8.promises.readFile(job.path);
|
|
5680
5736
|
} catch {
|
|
5681
5737
|
skip(kind, job.name, "missing");
|
|
5682
5738
|
continue;
|
package/dist/index.js
CHANGED
|
@@ -1715,7 +1715,29 @@ var PRICE_TABLE = {
|
|
|
1715
1715
|
// OpenRouter has hundreds of models and dynamic routing, so most still need a `pricing` entry
|
|
1716
1716
|
// in plune.yaml (or report cost_usd=0). Verify against OpenRouter's current rates.
|
|
1717
1717
|
"openai/gpt-4o": { input_per_1k_usd: 25e-4, output_per_1k_usd: 0.01 },
|
|
1718
|
-
"openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 }
|
|
1718
|
+
"openai/gpt-4o-mini": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
|
|
1719
|
+
// Via OpenRouter, the models the agent scenarios workflow can be run on. Source:
|
|
1720
|
+
// https://openrouter.ai/api/v1/models (`pricing`, USD per token), read on 2026-11-18, kept here
|
|
1721
|
+
// per thousand. A real OpenRouter call reports its own cost, which wins over these; they price a
|
|
1722
|
+
// dry run and any call that reports none. Long prompts may cost more on some of them.
|
|
1723
|
+
// The cheap set:
|
|
1724
|
+
"deepseek/deepseek-v4-flash": { input_per_1k_usd: 9e-5, output_per_1k_usd: 18e-5 },
|
|
1725
|
+
"qwen/qwen3.7-flash": { input_per_1k_usd: 3e-5, output_per_1k_usd: 13e-5 },
|
|
1726
|
+
"google/gemini-2.5-flash-lite": { input_per_1k_usd: 1e-4, output_per_1k_usd: 4e-4 },
|
|
1727
|
+
"mistralai/mistral-small-3.2-24b-instruct": {
|
|
1728
|
+
input_per_1k_usd: 75e-6,
|
|
1729
|
+
output_per_1k_usd: 2e-4
|
|
1730
|
+
},
|
|
1731
|
+
"openai/gpt-oss-120b": { input_per_1k_usd: 15e-5, output_per_1k_usd: 6e-4 },
|
|
1732
|
+
"anthropic/claude-haiku-5.5": { input_per_1k_usd: 1e-4, output_per_1k_usd: 5e-4 },
|
|
1733
|
+
"z-ai/glm-5.3-flash": { input_per_1k_usd: 399e-7, output_per_1k_usd: 784e-7 },
|
|
1734
|
+
// The middle set:
|
|
1735
|
+
"moonshotai/kimi-k2.6": { input_per_1k_usd: 65e-5, output_per_1k_usd: 341e-5 },
|
|
1736
|
+
"minimax/minimax-m3": { input_per_1k_usd: 3e-4, output_per_1k_usd: 12e-4 },
|
|
1737
|
+
"qwen/qwen3.7-plus": { input_per_1k_usd: 32e-5, output_per_1k_usd: 128e-5 },
|
|
1738
|
+
"google/gemini-3.8-flash": { input_per_1k_usd: 825e-6, output_per_1k_usd: 4125e-6 },
|
|
1739
|
+
"deepseek/deepseek-v4-pro": { input_per_1k_usd: 9e-4, output_per_1k_usd: 15e-4 },
|
|
1740
|
+
"openai/gpt-6.1-terra": { input_per_1k_usd: 1e-3, output_per_1k_usd: 5e-3 }
|
|
1719
1741
|
};
|
|
1720
1742
|
|
|
1721
1743
|
// src/providers/cost.ts
|
|
@@ -5134,6 +5156,7 @@ function createClient(opts) {
|
|
|
5134
5156
|
upload: (path12, bytes, contentType) => send("POST", path12, { body: bytes, type: contentType }, uploadRetries ?? DEFAULT_RETRIES),
|
|
5135
5157
|
del: (path12) => send("DELETE", path12),
|
|
5136
5158
|
get: (path12) => send("GET", path12),
|
|
5159
|
+
patch: (path12, body) => send("PATCH", path12, { body: JSON.stringify(body), type: "application/json" }),
|
|
5137
5160
|
async put(url, headers, source) {
|
|
5138
5161
|
const putRetries = uploadRetries ?? 3;
|
|
5139
5162
|
let last = { ok: false, status: null, code: "network" };
|
|
@@ -5210,6 +5233,39 @@ import * as fs7 from "fs";
|
|
|
5210
5233
|
import * as path9 from "path";
|
|
5211
5234
|
var DEFAULT_FALLBACK_PATH = path9.join(".plune", "pending-results.jsonl");
|
|
5212
5235
|
|
|
5236
|
+
// src/reporter-core/code-snapshot.ts
|
|
5237
|
+
init_esm_shims();
|
|
5238
|
+
import { readFileSync as readFileSync7 } from "fs";
|
|
5239
|
+
var BEFORE_REGEX = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^"]);
|
|
5240
|
+
var CREDENTIAL = "password|passphrase|passwd|pass|pwd|token|secret|api[-_]?key|private[-_]?key|credential|auth|session|cookie";
|
|
5241
|
+
var LITERAL = String.raw`(?<q>['"\x60])(?:\\.|(?!\k<q>)[^\\\n])*\k<q>`;
|
|
5242
|
+
var TYPING = "(?:fill|type|pressSequentially)";
|
|
5243
|
+
var PLACES = [
|
|
5244
|
+
// `password = '…'`, `apiKey: "…"`, `'x-api-key': '…'`
|
|
5245
|
+
new RegExp(
|
|
5246
|
+
String.raw`(?<lead>\b(?<role>[\w$-]*(?:${CREDENTIAL})[\w$-]*)['"]?\s*[:=]\s*)${LITERAL}`,
|
|
5247
|
+
"gi"
|
|
5248
|
+
),
|
|
5249
|
+
// `setToken('…')`: the call is named for a credential
|
|
5250
|
+
new RegExp(String.raw`(?<lead>\b(?<role>[\w$]*(?:${CREDENTIAL})[\w$]*)\s*\(\s*)${LITERAL}`, "gi"),
|
|
5251
|
+
// `.fill('#password', '…')`, `.type('#pwd', '…')`: the field is named in the same call
|
|
5252
|
+
new RegExp(
|
|
5253
|
+
String.raw`(?<lead>\.${TYPING}\(\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*)${LITERAL}`,
|
|
5254
|
+
"gi"
|
|
5255
|
+
),
|
|
5256
|
+
// `getByLabel('Password').fill('…')`, `getByRole('textbox', { name: 'Password' }).type('…')`: … or
|
|
5257
|
+
// anywhere in the call the typing is chained off
|
|
5258
|
+
new RegExp(
|
|
5259
|
+
String.raw`(?<lead>\([^()\n]*?(?<role>${CREDENTIAL})[^()\n]*\)\s*\.${TYPING}\(\s*)${LITERAL}`,
|
|
5260
|
+
"gi"
|
|
5261
|
+
),
|
|
5262
|
+
// `{ name: 'session', value: '…' }`: a cookie (or any name/value pair) named for a credential
|
|
5263
|
+
new RegExp(
|
|
5264
|
+
String.raw`(?<lead>\bname\s*:\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*value\s*:\s*)${LITERAL}`,
|
|
5265
|
+
"gi"
|
|
5266
|
+
)
|
|
5267
|
+
];
|
|
5268
|
+
|
|
5213
5269
|
// src/reporter-core/session.ts
|
|
5214
5270
|
var SCREENSHOT_TYPES = /* @__PURE__ */ new Set(["image/png", "image/jpeg", "image/webp"]);
|
|
5215
5271
|
var SCREENSHOT_BYTES = 2 * 1024 * 1024;
|
package/dist/mcp-tools.cjs
CHANGED
|
@@ -30,6 +30,7 @@ __export(mcp_tools_exports, {
|
|
|
30
30
|
createPluneToolExecutor: () => createPluneToolExecutor,
|
|
31
31
|
defaultVisibleTools: () => defaultVisibleTools,
|
|
32
32
|
isPluneToolName: () => isPluneToolName,
|
|
33
|
+
offeredTo: () => offeredTo,
|
|
33
34
|
pluneTool: () => pluneTool
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(mcp_tools_exports);
|
|
@@ -569,8 +570,13 @@ function pluneTool(name) {
|
|
|
569
570
|
function isPluneToolName(name) {
|
|
570
571
|
return BY_NAME.has(name);
|
|
571
572
|
}
|
|
573
|
+
function offeredTo(tool, scope) {
|
|
574
|
+
if (scope !== "read") return true;
|
|
575
|
+
if (tool.write) return false;
|
|
576
|
+
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
|
|
577
|
+
}
|
|
572
578
|
function defaultVisibleTools(scope) {
|
|
573
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" &&
|
|
579
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
574
580
|
}
|
|
575
581
|
|
|
576
582
|
// src/mcp-tools/execute.ts
|
|
@@ -788,7 +794,9 @@ function createPluneToolExecutor(opts) {
|
|
|
788
794
|
async plune_cases_search(i) {
|
|
789
795
|
const query = withoutUndefined({
|
|
790
796
|
...i["filters"],
|
|
791
|
-
|
|
797
|
+
// A full case weighs ~160 estimated tokens, so the platform's own page of up to 200 filled a model's context
|
|
798
|
+
// in one answer; 20 a page, the rest a cursor away, unless the caller asks for more.
|
|
799
|
+
limit: String(i["limit"] ?? 20),
|
|
792
800
|
cursor: i["cursor"],
|
|
793
801
|
stability: "0"
|
|
794
802
|
});
|
|
@@ -1031,5 +1039,6 @@ function createPluneToolExecutor(opts) {
|
|
|
1031
1039
|
createPluneToolExecutor,
|
|
1032
1040
|
defaultVisibleTools,
|
|
1033
1041
|
isPluneToolName,
|
|
1042
|
+
offeredTo,
|
|
1034
1043
|
pluneTool
|
|
1035
1044
|
});
|
package/dist/mcp-tools.d.cts
CHANGED
|
@@ -880,7 +880,12 @@ declare const PLUNE_TOOL_NAMES: readonly PluneToolName[];
|
|
|
880
880
|
/** The definition of one tool; throws on a name the contract does not have. */
|
|
881
881
|
declare function pluneTool(name: string): PluneToolDefinition;
|
|
882
882
|
declare function isPluneToolName(name: string): name is PluneToolName;
|
|
883
|
-
/**
|
|
883
|
+
/**
|
|
884
|
+
* Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
|
|
885
|
+
* hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
|
|
886
|
+
*/
|
|
887
|
+
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
|
|
888
|
+
/** The tools a client is shown before it asks for more; for a `read` token, only those it is offered. */
|
|
884
889
|
declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
|
|
885
890
|
|
|
886
891
|
/**
|
|
@@ -953,4 +958,4 @@ declare class PluneNetworkError extends Error {
|
|
|
953
958
|
/** Objects one call takes. */
|
|
954
959
|
declare const BATCH_MAX = 100;
|
|
955
960
|
|
|
956
|
-
export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, pluneTool };
|
|
961
|
+
export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, offeredTo, pluneTool };
|
package/dist/mcp-tools.d.ts
CHANGED
|
@@ -880,7 +880,12 @@ declare const PLUNE_TOOL_NAMES: readonly PluneToolName[];
|
|
|
880
880
|
/** The definition of one tool; throws on a name the contract does not have. */
|
|
881
881
|
declare function pluneTool(name: string): PluneToolDefinition;
|
|
882
882
|
declare function isPluneToolName(name: string): name is PluneToolName;
|
|
883
|
-
/**
|
|
883
|
+
/**
|
|
884
|
+
* Whether a token of this scope is offered the tool at all. A `read` token gets no writer, and no discovery while every
|
|
885
|
+
* hidden tool writes: there it could only answer with a refusal, which a model reads as a way to write.
|
|
886
|
+
*/
|
|
887
|
+
declare function offeredTo(tool: PluneToolDefinition, scope?: 'read' | 'write'): boolean;
|
|
888
|
+
/** The tools a client is shown before it asks for more; for a `read` token, only those it is offered. */
|
|
884
889
|
declare function defaultVisibleTools(scope?: 'read' | 'write'): PluneToolName[];
|
|
885
890
|
|
|
886
891
|
/**
|
|
@@ -953,4 +958,4 @@ declare class PluneNetworkError extends Error {
|
|
|
953
958
|
/** Objects one call takes. */
|
|
954
959
|
declare const BATCH_MAX = 100;
|
|
955
960
|
|
|
956
|
-
export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, pluneTool };
|
|
961
|
+
export { BATCH_MAX, CONFIRM_TTL_MS, MAX_VISIBLE_TOOLS, PLUNE_TOOLS, PLUNE_TOOL_NAMES, PluneApiError, PluneNetworkError, type PluneToolDefinition, type PluneToolExecutor, type PluneToolExecutorOptions, type PluneToolName, type TokenScope, type ToolError, type ToolOutcome, type ToolVisibility, createPluneToolExecutor, defaultVisibleTools, isPluneToolName, offeredTo, pluneTool };
|
package/dist/mcp-tools.js
CHANGED
|
@@ -533,8 +533,13 @@ function pluneTool(name) {
|
|
|
533
533
|
function isPluneToolName(name) {
|
|
534
534
|
return BY_NAME.has(name);
|
|
535
535
|
}
|
|
536
|
+
function offeredTo(tool, scope) {
|
|
537
|
+
if (scope !== "read") return true;
|
|
538
|
+
if (tool.write) return false;
|
|
539
|
+
return tool.name !== "plune_discover_tools" || PLUNE_TOOLS.some((t) => t.visibility !== "core" && !t.write);
|
|
540
|
+
}
|
|
536
541
|
function defaultVisibleTools(scope) {
|
|
537
|
-
return PLUNE_TOOLS.filter((t) => t.visibility === "core" &&
|
|
542
|
+
return PLUNE_TOOLS.filter((t) => t.visibility === "core" && offeredTo(t, scope)).map((t) => t.name);
|
|
538
543
|
}
|
|
539
544
|
|
|
540
545
|
// src/mcp-tools/execute.ts
|
|
@@ -752,7 +757,9 @@ function createPluneToolExecutor(opts) {
|
|
|
752
757
|
async plune_cases_search(i) {
|
|
753
758
|
const query = withoutUndefined({
|
|
754
759
|
...i["filters"],
|
|
755
|
-
|
|
760
|
+
// A full case weighs ~160 estimated tokens, so the platform's own page of up to 200 filled a model's context
|
|
761
|
+
// in one answer; 20 a page, the rest a cursor away, unless the caller asks for more.
|
|
762
|
+
limit: String(i["limit"] ?? 20),
|
|
756
763
|
cursor: i["cursor"],
|
|
757
764
|
stability: "0"
|
|
758
765
|
});
|
|
@@ -994,5 +1001,6 @@ export {
|
|
|
994
1001
|
createPluneToolExecutor,
|
|
995
1002
|
defaultVisibleTools,
|
|
996
1003
|
isPluneToolName,
|
|
1004
|
+
offeredTo,
|
|
997
1005
|
pluneTool
|
|
998
1006
|
};
|
package/dist/reporter-core.cjs
CHANGED
|
@@ -50,7 +50,7 @@ module.exports = __toCommonJS(reporter_core_exports);
|
|
|
50
50
|
|
|
51
51
|
// src/reporter-core/session.ts
|
|
52
52
|
var import_node_crypto2 = require("crypto");
|
|
53
|
-
var
|
|
53
|
+
var import_node_fs6 = require("fs");
|
|
54
54
|
var import_node_path3 = require("path");
|
|
55
55
|
var import_node_util2 = require("util");
|
|
56
56
|
|
|
@@ -266,6 +266,7 @@ function createClient(opts) {
|
|
|
266
266
|
upload: (path3, bytes, contentType) => send("POST", path3, { body: bytes, type: contentType }, uploadRetries ?? DEFAULT_RETRIES),
|
|
267
267
|
del: (path3) => send("DELETE", path3),
|
|
268
268
|
get: (path3) => send("GET", path3),
|
|
269
|
+
patch: (path3, body) => send("PATCH", path3, { body: JSON.stringify(body), type: "application/json" }),
|
|
269
270
|
async put(url, headers, source) {
|
|
270
271
|
const putRetries = uploadRetries ?? 3;
|
|
271
272
|
let last = { ok: false, status: null, code: "network" };
|
|
@@ -626,11 +627,179 @@ function appendBatch(file, batch) {
|
|
|
626
627
|
`, "utf8");
|
|
627
628
|
}
|
|
628
629
|
|
|
630
|
+
// src/reporter-core/code-snapshot.ts
|
|
631
|
+
var import_node_fs5 = require("fs");
|
|
632
|
+
var SNAPSHOT_MAX_BYTES = 16384;
|
|
633
|
+
var CALL = /\b(?:test|it)(?:\.(?:skip|fixme|only|fail|slow))?\s*\(/g;
|
|
634
|
+
var BEFORE_REGEX = /* @__PURE__ */ new Set([..."(,=:[!&|?{};+-*%<>~^"]);
|
|
635
|
+
function skipString(src, i, quote) {
|
|
636
|
+
for (let j = i + 1; j < src.length; j += 1) {
|
|
637
|
+
const c = src[j];
|
|
638
|
+
if (c === "\\") j += 1;
|
|
639
|
+
else if (c === quote) return j + 1;
|
|
640
|
+
else if (c === "\n") return -1;
|
|
641
|
+
}
|
|
642
|
+
return -1;
|
|
643
|
+
}
|
|
644
|
+
function skipTemplate(src, i) {
|
|
645
|
+
for (let j = i + 1; j < src.length; j += 1) {
|
|
646
|
+
const c = src[j];
|
|
647
|
+
if (c === "\\") j += 1;
|
|
648
|
+
else if (c === "`") return j + 1;
|
|
649
|
+
else if (c === "$" && src[j + 1] === "{") {
|
|
650
|
+
const end = matching(src, j + 2, "}");
|
|
651
|
+
if (end < 0) return -1;
|
|
652
|
+
j = end;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return -1;
|
|
656
|
+
}
|
|
657
|
+
function skipRegex(src, i) {
|
|
658
|
+
let inClass = false;
|
|
659
|
+
for (let j = i + 1; j < src.length; j += 1) {
|
|
660
|
+
const c = src[j];
|
|
661
|
+
if (c === "\\") j += 1;
|
|
662
|
+
else if (c === "\n") return -1;
|
|
663
|
+
else if (c === "[") inClass = true;
|
|
664
|
+
else if (c === "]") inClass = false;
|
|
665
|
+
else if (c === "/" && !inClass) {
|
|
666
|
+
let k = j + 1;
|
|
667
|
+
while (k < src.length && /[a-z]/i.test(src[k])) k += 1;
|
|
668
|
+
return k;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
return -1;
|
|
672
|
+
}
|
|
673
|
+
function matching(src, i, close) {
|
|
674
|
+
const stack = [close];
|
|
675
|
+
let prev = "(";
|
|
676
|
+
while (i < src.length) {
|
|
677
|
+
const c = src[i];
|
|
678
|
+
const next = src[i + 1];
|
|
679
|
+
let to = -2;
|
|
680
|
+
if (c === "/" && next === "/") to = src.indexOf("\n", i);
|
|
681
|
+
else if (c === "/" && next === "*")
|
|
682
|
+
to = src.indexOf("*/", i + 2) < 0 ? -1 : src.indexOf("*/", i + 2) + 2;
|
|
683
|
+
else if (c === "'" || c === '"') to = skipString(src, i, c);
|
|
684
|
+
else if (c === "`") to = skipTemplate(src, i);
|
|
685
|
+
else if (c === "/" && BEFORE_REGEX.has(prev)) to = skipRegex(src, i);
|
|
686
|
+
if (to === -1) return -1;
|
|
687
|
+
if (to !== -2) {
|
|
688
|
+
if (c !== "/" || next !== "/" && next !== "*") prev = "a";
|
|
689
|
+
i = to;
|
|
690
|
+
continue;
|
|
691
|
+
}
|
|
692
|
+
if (c === "(") stack.push(")");
|
|
693
|
+
else if (c === "[") stack.push("]");
|
|
694
|
+
else if (c === "{") stack.push("}");
|
|
695
|
+
else if (c === ")" || c === "]" || c === "}") {
|
|
696
|
+
if (stack.pop() !== c) return -1;
|
|
697
|
+
if (stack.length === 0) return i;
|
|
698
|
+
}
|
|
699
|
+
if (!/\s/.test(c)) prev = c;
|
|
700
|
+
i += 1;
|
|
701
|
+
}
|
|
702
|
+
return -1;
|
|
703
|
+
}
|
|
704
|
+
function callTextAt(source, line, column) {
|
|
705
|
+
const lines = source.split("\n");
|
|
706
|
+
if (line < 1 || line > lines.length) return void 0;
|
|
707
|
+
const lineStart = lines.slice(0, line - 1).reduce((n, l) => n + l.length + 1, 0);
|
|
708
|
+
const lineEnd = lineStart + lines[line - 1].length;
|
|
709
|
+
const heads = [];
|
|
710
|
+
CALL.lastIndex = lineStart;
|
|
711
|
+
for (let h = CALL.exec(source); h !== null && h.index < lineEnd; h = CALL.exec(source))
|
|
712
|
+
heads.push(h);
|
|
713
|
+
const at = column === void 0 ? -1 : lineStart + column - 1;
|
|
714
|
+
const head = heads.find((h) => h.index <= at && at < h.index + h[0].length) ?? (heads.length === 1 ? heads[0] : void 0);
|
|
715
|
+
if (head === void 0) return void 0;
|
|
716
|
+
const end = matching(source, head.index + head[0].length, ")");
|
|
717
|
+
if (end < 0) return void 0;
|
|
718
|
+
const text = source.slice(head.index, end + 1).replace(/\r\n/g, "\n");
|
|
719
|
+
return Buffer.byteLength(text, "utf8") <= SNAPSHOT_MAX_BYTES ? text : void 0;
|
|
720
|
+
}
|
|
721
|
+
var CREDENTIAL = "password|passphrase|passwd|pass|pwd|token|secret|api[-_]?key|private[-_]?key|credential|auth|session|cookie";
|
|
722
|
+
var LITERAL = String.raw`(?<q>['"\x60])(?:\\.|(?!\k<q>)[^\\\n])*\k<q>`;
|
|
723
|
+
var TYPING = "(?:fill|type|pressSequentially)";
|
|
724
|
+
var SHAPES = [
|
|
725
|
+
{ kind: "github-token", re: /\b(?:ghp|gho|ghs|ghu)_[A-Za-z0-9]{36}\b|\bgithub_pat_\w{20,}/g },
|
|
726
|
+
{ kind: "api-key", re: /\bsk-[\w-]{20,}/g },
|
|
727
|
+
{ kind: "api-key", re: /\b[sr]k_(?:live|test)_[A-Za-z0-9]{10,}/g },
|
|
728
|
+
{ kind: "npm-token", re: /\bnpm_[A-Za-z0-9]{20,}/g },
|
|
729
|
+
{ kind: "google-key", re: /\bAIza[\w-]{30,}/g },
|
|
730
|
+
{ kind: "plune-token", re: /\bplune_[A-Za-z0-9_]{16,}/g },
|
|
731
|
+
{ kind: "aws-key", re: /\bAKIA[0-9A-Z]{16}\b/g },
|
|
732
|
+
{ kind: "slack-token", re: /\bxox[abprs]-[A-Za-z0-9-]{10,}/g },
|
|
733
|
+
{
|
|
734
|
+
kind: "private-key",
|
|
735
|
+
re: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g
|
|
736
|
+
},
|
|
737
|
+
{ kind: "jwt", re: /\beyJ[\w-]{10,}\.[\w-]{10,}\.[\w-]{10,}/g }
|
|
738
|
+
];
|
|
739
|
+
var PLACES = [
|
|
740
|
+
// `password = '…'`, `apiKey: "…"`, `'x-api-key': '…'`
|
|
741
|
+
new RegExp(
|
|
742
|
+
String.raw`(?<lead>\b(?<role>[\w$-]*(?:${CREDENTIAL})[\w$-]*)['"]?\s*[:=]\s*)${LITERAL}`,
|
|
743
|
+
"gi"
|
|
744
|
+
),
|
|
745
|
+
// `setToken('…')`: the call is named for a credential
|
|
746
|
+
new RegExp(String.raw`(?<lead>\b(?<role>[\w$]*(?:${CREDENTIAL})[\w$]*)\s*\(\s*)${LITERAL}`, "gi"),
|
|
747
|
+
// `.fill('#password', '…')`, `.type('#pwd', '…')`: the field is named in the same call
|
|
748
|
+
new RegExp(
|
|
749
|
+
String.raw`(?<lead>\.${TYPING}\(\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*)${LITERAL}`,
|
|
750
|
+
"gi"
|
|
751
|
+
),
|
|
752
|
+
// `getByLabel('Password').fill('…')`, `getByRole('textbox', { name: 'Password' }).type('…')`: … or
|
|
753
|
+
// anywhere in the call the typing is chained off
|
|
754
|
+
new RegExp(
|
|
755
|
+
String.raw`(?<lead>\([^()\n]*?(?<role>${CREDENTIAL})[^()\n]*\)\s*\.${TYPING}\(\s*)${LITERAL}`,
|
|
756
|
+
"gi"
|
|
757
|
+
),
|
|
758
|
+
// `{ name: 'session', value: '…' }`: a cookie (or any name/value pair) named for a credential
|
|
759
|
+
new RegExp(
|
|
760
|
+
String.raw`(?<lead>\bname\s*:\s*['"][^'"\n]*?(?<role>${CREDENTIAL})[^'"\n]*['"]\s*,\s*value\s*:\s*)${LITERAL}`,
|
|
761
|
+
"gi"
|
|
762
|
+
)
|
|
763
|
+
];
|
|
764
|
+
var HEADER_LINE = /((?:^|\\[nr]|\x60)[ \t>*<+-]*['"]?)((?:proxy-)?authorization|(?:set-)?cookie|[\w-]*session[\w-]*)(['"]?[ \t]*:[ \t]*)(?![\w$.]+(?:\([^()\n]*\))?[ \t]*[,;)}\]])[^\s'"\x60\\][^\r\n'"\x60\\]*/gim;
|
|
765
|
+
var QUERY_PARAM = /([?&][\w.-]*(?:token|key|secret|password|passwd|pass|pwd|auth|signature|sig|credential|session)[\w.-]*=)(?!‹)[^&#\s'"\x60]+/gi;
|
|
766
|
+
function maskCredentials(text) {
|
|
767
|
+
let out = text;
|
|
768
|
+
for (const { kind, re } of SHAPES) out = out.replace(re, `\u2039${kind}\u203A`);
|
|
769
|
+
for (const re of PLACES) {
|
|
770
|
+
out = out.replace(re, (...args) => {
|
|
771
|
+
const groups = args.at(-1);
|
|
772
|
+
return `${groups.lead}${groups.q}\u2039${groups.role.toLowerCase().replace(/^[^a-z]+/, "")}\u203A${groups.q}`;
|
|
773
|
+
});
|
|
774
|
+
}
|
|
775
|
+
return out.replace(HEADER_LINE, "$1$2$3\u2039header\u203A").replace(/\b(Bearer)([ \t]+)(?!‹)[\w.~+/=-]{8,}/g, "$1$2\u2039credential\u203A").replace(
|
|
776
|
+
/\b(Basic|Token)([ \t]+)(?!‹)(?=[\w.~+/=-]*[\d=+/]|[\w.~+/=-]*[a-z][\w.~+/=-]*[A-Z])[\w.~+/=-]{8,}/g,
|
|
777
|
+
"$1$2\u2039credential\u203A"
|
|
778
|
+
).replace(/\b(PLUNE_[A-Z0-9_]*=)(?!‹)[^\s'"\x60;,)]+/g, "$1\u2039env-secret\u203A").replace(QUERY_PARAM, "$1\u2039credential\u203A").replace(/\b([a-z][\w+.-]*:\/\/)[^\s/@'"\x60]+@/gi, "$1\u2039credential\u203A@");
|
|
779
|
+
}
|
|
780
|
+
function snapshotAt(at, files) {
|
|
781
|
+
let source = files.get(at.file);
|
|
782
|
+
if (source === void 0) {
|
|
783
|
+
try {
|
|
784
|
+
source = (0, import_node_fs5.readFileSync)(at.file, "utf8");
|
|
785
|
+
} catch {
|
|
786
|
+
source = null;
|
|
787
|
+
}
|
|
788
|
+
files.set(at.file, source);
|
|
789
|
+
}
|
|
790
|
+
if (source === null) return void 0;
|
|
791
|
+
const text = callTextAt(source, at.line, at.column);
|
|
792
|
+
if (text === void 0) return void 0;
|
|
793
|
+
const masked = maskCredentials(text);
|
|
794
|
+
return Buffer.byteLength(masked, "utf8") <= SNAPSHOT_MAX_BYTES ? masked : void 0;
|
|
795
|
+
}
|
|
796
|
+
|
|
629
797
|
// src/reporter-core/session.ts
|
|
630
798
|
var RESOLVE_CHUNK = 500;
|
|
631
799
|
var BATCH_MAX = 500;
|
|
632
800
|
var DISCOVER_MAX = 500;
|
|
633
801
|
var BATCH_DEFAULT = 500;
|
|
802
|
+
var SNAPSHOT_UPDATES_MAX = 100;
|
|
634
803
|
var SEND_CONCURRENCY = 4;
|
|
635
804
|
var EXPECTED_MAX = 1e4;
|
|
636
805
|
var KEY_MAX = 1024;
|
|
@@ -822,7 +991,7 @@ function fileSender(options) {
|
|
|
822
991
|
if (job.body !== void 0) bytes = job.body;
|
|
823
992
|
else {
|
|
824
993
|
try {
|
|
825
|
-
bytes = await
|
|
994
|
+
bytes = await import_node_fs6.promises.readFile(job.path);
|
|
826
995
|
} catch {
|
|
827
996
|
return skip(kind, job.name, "missing");
|
|
828
997
|
}
|
|
@@ -877,7 +1046,7 @@ function fileSender(options) {
|
|
|
877
1046
|
else if (job.path === void 0) return void skip(kind, job.name, "missing");
|
|
878
1047
|
else {
|
|
879
1048
|
try {
|
|
880
|
-
size = (await
|
|
1049
|
+
size = (await import_node_fs6.promises.stat(job.path)).size;
|
|
881
1050
|
} catch {
|
|
882
1051
|
return void skip(kind, job.name, "missing");
|
|
883
1052
|
}
|
|
@@ -933,7 +1102,7 @@ function fileSender(options) {
|
|
|
933
1102
|
else if (job.path === void 0) return void skip(job.kind, job.name, "missing");
|
|
934
1103
|
else {
|
|
935
1104
|
try {
|
|
936
|
-
size = (await
|
|
1105
|
+
size = (await import_node_fs6.promises.stat(job.path)).size;
|
|
937
1106
|
} catch {
|
|
938
1107
|
return void skip(job.kind, job.name, "missing");
|
|
939
1108
|
}
|
|
@@ -1107,7 +1276,7 @@ function fileSender(options) {
|
|
|
1107
1276
|
}
|
|
1108
1277
|
let data;
|
|
1109
1278
|
try {
|
|
1110
|
-
data = job.body ?? await
|
|
1279
|
+
data = job.body ?? await import_node_fs6.promises.readFile(job.path);
|
|
1111
1280
|
} catch {
|
|
1112
1281
|
skip(kind, job.name, "missing");
|
|
1113
1282
|
continue;
|
|
@@ -1263,6 +1432,9 @@ async function startRun(passed, declared) {
|
|
|
1263
1432
|
let offline = token === "";
|
|
1264
1433
|
let done = false;
|
|
1265
1434
|
const shortened = /* @__PURE__ */ new Set();
|
|
1435
|
+
const specFiles = /* @__PURE__ */ new Map();
|
|
1436
|
+
const snapshotByKey = /* @__PURE__ */ new Map();
|
|
1437
|
+
const snapshots = /* @__PURE__ */ new Map();
|
|
1266
1438
|
function bound(keys) {
|
|
1267
1439
|
return keys.map((key) => {
|
|
1268
1440
|
const fit = boundKey(key);
|
|
@@ -1416,6 +1588,8 @@ async function startRun(passed, declared) {
|
|
|
1416
1588
|
const { keys: _keys, files: files2, ...rest } = pending;
|
|
1417
1589
|
submissions.push({ ...rest, testCaseId: r.id });
|
|
1418
1590
|
if (files2 !== void 0) filesByKey.set(pending.resultKey, files2);
|
|
1591
|
+
const text = snapshotByKey.get(pending.resultKey);
|
|
1592
|
+
if (text !== void 0) snapshots.set(r.id, text);
|
|
1419
1593
|
}
|
|
1420
1594
|
if (submissions.length > 0) {
|
|
1421
1595
|
const before = stats.deferred;
|
|
@@ -1425,6 +1599,46 @@ async function startRun(passed, declared) {
|
|
|
1425
1599
|
}
|
|
1426
1600
|
}
|
|
1427
1601
|
}
|
|
1602
|
+
async function syncSnapshots() {
|
|
1603
|
+
if (snapshots.size === 0 || offline) return;
|
|
1604
|
+
const stored = /* @__PURE__ */ new Map();
|
|
1605
|
+
let cursor = null;
|
|
1606
|
+
do {
|
|
1607
|
+
const query = `type=automated&stability=0&limit=200${cursor === null ? "" : `&cursor=${encodeURIComponent(cursor)}`}`;
|
|
1608
|
+
const out = await client.get(`/v1/test-cases?${query}`);
|
|
1609
|
+
if (!out.ok || !Array.isArray(out.body?.testCases)) {
|
|
1610
|
+
log(`plune: could not update the code snapshots (${out.ok ? "the case list had no cases" : out.detail || out.kind}).`);
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
for (const row of out.body.testCases) {
|
|
1614
|
+
if (typeof row?.id === "string" && snapshots.has(row.id)) stored.set(row.id, row.codeSnapshotHash ?? null);
|
|
1615
|
+
}
|
|
1616
|
+
cursor = typeof out.body.nextCursor === "string" ? out.body.nextCursor : null;
|
|
1617
|
+
} while (cursor !== null && stored.size < snapshots.size);
|
|
1618
|
+
const sha = (text) => (0, import_node_crypto2.createHash)("sha256").update(text).digest("hex");
|
|
1619
|
+
const due = [...snapshots].filter(([id, text]) => stored.has(id) && stored.get(id) !== sha(text)).sort(([a], [b]) => sha(`${runId}:${a}`).localeCompare(sha(`${runId}:${b}`)));
|
|
1620
|
+
let updated = 0;
|
|
1621
|
+
let refused = 0;
|
|
1622
|
+
let tried = 0;
|
|
1623
|
+
for (const [id, text] of due.slice(0, SNAPSHOT_UPDATES_MAX)) {
|
|
1624
|
+
tried += 1;
|
|
1625
|
+
const out = await client.patch(`/v1/test-cases/${encodeURIComponent(id)}`, { codeSnapshot: text });
|
|
1626
|
+
if (out.ok) {
|
|
1627
|
+
updated += 1;
|
|
1628
|
+
continue;
|
|
1629
|
+
}
|
|
1630
|
+
if (out.kind === "auth" || out.kind === "unavailable" || out.status === 429) {
|
|
1631
|
+
log(`plune: could not update the code snapshot of test case ${id} (${out.detail || out.kind}); the rest are left as they are.`);
|
|
1632
|
+
break;
|
|
1633
|
+
}
|
|
1634
|
+
refused += 1;
|
|
1635
|
+
}
|
|
1636
|
+
const left = due.length - tried;
|
|
1637
|
+
const parts = [`${updated} code snapshot(s) updated`];
|
|
1638
|
+
if (refused > 0) parts.push(`${refused} not updated`);
|
|
1639
|
+
if (left > 0 && tried === Math.min(due.length, SNAPSHOT_UPDATES_MAX)) parts.push(`${left} left for the next run`);
|
|
1640
|
+
if (updated + refused > 0) log(`plune: ${parts.join(", ")}`);
|
|
1641
|
+
}
|
|
1428
1642
|
const sending = /* @__PURE__ */ new Set();
|
|
1429
1643
|
let sendError;
|
|
1430
1644
|
let answered = false;
|
|
@@ -1467,6 +1681,8 @@ async function startRun(passed, declared) {
|
|
|
1467
1681
|
if (match.kind === "found") {
|
|
1468
1682
|
const { keys: _keys, files: files2, ...rest } = result;
|
|
1469
1683
|
submissions.push({ ...rest, testCaseId: match.testCaseId });
|
|
1684
|
+
const text = snapshotByKey.get(result.resultKey);
|
|
1685
|
+
if (text !== void 0) snapshots.set(match.testCaseId, text);
|
|
1470
1686
|
if (files2 !== void 0) filesByKey.set(result.resultKey, files2);
|
|
1471
1687
|
} else if (match.kind === "unmatched") {
|
|
1472
1688
|
stats.unresolved += 1;
|
|
@@ -1572,7 +1788,10 @@ async function startRun(passed, declared) {
|
|
|
1572
1788
|
return stats;
|
|
1573
1789
|
},
|
|
1574
1790
|
async add(result) {
|
|
1575
|
-
|
|
1791
|
+
const { codeAt, ...rest } = result;
|
|
1792
|
+
const text = codeAt === void 0 ? void 0 : snapshotAt(codeAt, specFiles);
|
|
1793
|
+
if (text !== void 0) snapshotByKey.set(result.resultKey, text);
|
|
1794
|
+
buffer.push({ ...rest, keys: bound(result.keys) });
|
|
1576
1795
|
if (buffer.length >= batchSize) await flushBuffer();
|
|
1577
1796
|
},
|
|
1578
1797
|
flush,
|
|
@@ -1581,6 +1800,7 @@ async function startRun(passed, declared) {
|
|
|
1581
1800
|
done = true;
|
|
1582
1801
|
await flush();
|
|
1583
1802
|
await offer();
|
|
1803
|
+
await syncSnapshots();
|
|
1584
1804
|
let frozen;
|
|
1585
1805
|
if (runId !== null && !offline) {
|
|
1586
1806
|
const out = await client.post(`/v1/runs/${runId}/events`, {
|
|
@@ -1604,6 +1824,7 @@ async function startRun(passed, declared) {
|
|
|
1604
1824
|
done = true;
|
|
1605
1825
|
await flush();
|
|
1606
1826
|
await offer();
|
|
1827
|
+
await syncSnapshots();
|
|
1607
1828
|
let frozen;
|
|
1608
1829
|
const after = [];
|
|
1609
1830
|
const shard = env.shard;
|