@testver/testver 1.4.1 → 1.4.2
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 -1
- package/bin/testver.js +1 -1
- package/dist/index.js +770 -391
- package/package.json +2 -1
- package/src/ui/static/assets/{AIPanel-D09Ni3a4.js → AIPanel-B_R-CbrF.js} +2 -2
- package/src/ui/static/assets/{AIRecordPanel-DZtUZnRe.js → AIRecordPanel-BRQWIU5h.js} +3 -3
- package/src/ui/static/assets/{AIStreamUI-BsxKziYG.js → AIStreamUI-C3D989_6.js} +3 -3
- package/src/ui/static/assets/{AITestGenPage-Cg21-P1W.js → AITestGenPage-D3t2gPAA.js} +5 -5
- package/src/ui/static/assets/{APITestingPage-Cdc8EZz2.js → APITestingPage-Cmwkiiys.js} +1 -1
- package/src/ui/static/assets/{AboutPage-yJLCr2_q.js → AboutPage-CjEqKB-q.js} +1 -1
- package/src/ui/static/assets/AdvancedPage-4kAcpE8Y.js +3 -0
- package/src/ui/static/assets/{AnalyticsPage-gTPFsiLZ.js → AnalyticsPage-64mYNK2v.js} +1 -1
- package/src/ui/static/assets/{AuditLogPage-DE45E_PV.js → AuditLogPage-BQjOzQje.js} +1 -1
- package/src/ui/static/assets/{ChangesSummary-C-7oi_sx.js → ChangesSummary-CY_Vb27i.js} +2 -2
- package/src/ui/static/assets/{CodeMapPage-DgU6ZYBO.js → CodeMapPage-B1ezmnlE.js} +3 -3
- package/src/ui/static/assets/{ConfirmDialog-DNU3qoAP.js → ConfirmDialog-t7mpeeSN.js} +1 -1
- package/src/ui/static/assets/{CoveragePage-BpTjgcdV.js → CoveragePage-YMmCbiBk.js} +2 -2
- package/src/ui/static/assets/{CronBuilder-DsnX-vRr.js → CronBuilder-Nk-K-_8I.js} +1 -1
- package/src/ui/static/assets/Dashboard-BDVxO2V4.js +1 -0
- package/src/ui/static/assets/{DefectsPage-BtMNbq6Z.js → DefectsPage-l8yGeCyR.js} +1 -1
- package/src/ui/static/assets/{DiffViewer-DPglzjPH.js → DiffViewer-BIU09a_i.js} +1 -1
- package/src/ui/static/assets/{EmptyState-BH_aDO0P.js → EmptyState-D1T3JWUr.js} +1 -1
- package/src/ui/static/assets/{ExportButton-Ce_MxnM1.js → ExportButton-Dt5RhL-h.js} +1 -1
- package/src/ui/static/assets/{FileViewer-iYL0lxyY.js → FileViewer-CrKgh_cB.js} +5 -5
- package/src/ui/static/assets/{GitPage-CQqV8JBC.js → GitPage-_4nCEzkJ.js} +5 -5
- package/src/ui/static/assets/{ImportExportPage-DXk7Koaq.js → ImportExportPage-BcR7IQi9.js} +1 -1
- package/src/ui/static/assets/{JiraPushDialog-CqftoLh8.js → JiraPushDialog-C2sP4_4h.js} +1 -1
- package/src/ui/static/assets/KpiTile-inmeEsy3.js +1 -0
- package/src/ui/static/assets/{LiveExecutionView-BD0wE8sz.js → LiveExecutionView-D5BRe9jq.js} +1 -1
- package/src/ui/static/assets/{MediaModal-DiSINwmh.js → MediaModal-C5n6sHYi.js} +1 -1
- package/src/ui/static/assets/{MobileRunPicker-BNs2lZFf.js → MobileRunPicker-0h-N2c6d.js} +1 -1
- package/src/ui/static/assets/{MobileRunTarget-D2Nqcj10.js → MobileRunTarget-Bo_xekig.js} +1 -1
- package/src/ui/static/assets/{ModuleExplorer-BmkoQrHb.js → ModuleExplorer-VGcmK167.js} +1 -1
- package/src/ui/static/assets/{OutputPage-Dcsr7cmr.js → OutputPage-B_1nPPxE.js} +1 -1
- package/src/ui/static/assets/PipelinesPanel-PmmPu8pj.js +1 -0
- package/src/ui/static/assets/{ProfilePage-ByshrcwC.js → ProfilePage-y7tJNNFd.js} +1 -1
- package/src/ui/static/assets/{ProjectExplorer-B9B___ij.js → ProjectExplorer-DbfGhRq0.js} +1 -1
- package/src/ui/static/assets/{RemoteFileStrip-DbPnaZ-v.js → RemoteFileStrip-WuRKtx_h.js} +1 -1
- package/src/ui/static/assets/ReportCard-G52Q6-2i.js +2 -0
- package/src/ui/static/assets/ReportFullView-Bt8UFP2J.js +1 -0
- package/src/ui/static/assets/ReportsPage-DMtDi73Q.js +48 -0
- package/src/ui/static/assets/ResultsPage-BI9jpK2N.js +115 -0
- package/src/ui/static/assets/RunState-ifC4zi6M.js +1 -0
- package/src/ui/static/assets/{RunTargets-C7Vqd4TU.js → RunTargets-C7vpCbck.js} +1 -1
- package/src/ui/static/assets/{ScriptMappingPage-BrANeHv0.js → ScriptMappingPage-7vHuvhQw.js} +1 -1
- package/src/ui/static/assets/{SearchableDevicePicker-CFJ_DUAA.js → SearchableDevicePicker-BYxYJNWl.js} +1 -1
- package/src/ui/static/assets/{SettingsPage-BwOiebKG.js → SettingsPage-DSISg7r7.js} +1 -1
- package/src/ui/static/assets/SharedReportView-BOqKGJmR.js +1 -0
- package/src/ui/static/assets/{SourcesPage-C_QVQwiA.js → SourcesPage-CgqtYGBi.js} +1 -1
- package/src/ui/static/assets/TestExplorerPage-gYLhCD4d.js +7 -0
- package/src/ui/static/assets/{TestManagementPage-Ch4PthuU.js → TestManagementPage-wqYTKP7W.js} +2 -2
- package/src/ui/static/assets/TestPlansPage-DOKX9p6z.js +5 -0
- package/src/ui/static/assets/{TestverCreditsRing-CUsMGEe3.js → TestverCreditsRing-DpMzl3h7.js} +1 -1
- package/src/ui/static/assets/{UncommittedDiffViewer-B5HSURk8.js → UncommittedDiffViewer-BxS0zi-p.js} +1 -1
- package/src/ui/static/assets/{UserManagementPage-BjY3ftxf.js → UserManagementPage-B5d0uDU_.js} +2 -2
- package/src/ui/static/assets/{WorkflowsPage-BUu-LjZ8.js → WorkflowsPage-Bk0DFnFS.js} +17 -17
- package/src/ui/static/assets/{hiddenLlmProviders-setxgY_B.js → hiddenLlmProviders-CdhhNa5G.js} +1 -1
- package/src/ui/static/assets/index-BYVxKLrT.js +47 -0
- package/src/ui/static/assets/index-C2KJt7SI.css +1 -0
- package/src/ui/static/assets/reportMeta-AKcU_qwq.js +1 -0
- package/src/ui/static/assets/{useFeatureFlags-DqhngqgG.js → useFeatureFlags-DNkIctil.js} +1 -1
- package/src/ui/static/assets/{useJiraConnector-TM1Rfj1s.js → useJiraConnector-D5ysBBvz.js} +1 -1
- package/src/ui/static/assets/{useOwnership-eW6Egd7X.js → useOwnership-U0AfKBRo.js} +1 -1
- package/src/ui/static/assets/{useSuites-CvtMGakZ.js → useSuites-DyfN9HVv.js} +1 -1
- package/src/ui/static/assets/{useTestExplorer-HqvURJAc.js → useTestExplorer-DT8frjCK.js} +1 -1
- package/src/ui/static/assets/{useTestLifecycle-CL7-zz0Q.js → useTestLifecycle-OcwQaB1s.js} +1 -1
- package/src/ui/static/assets/{useTestManagement-ZTA1_VUm.js → useTestManagement-Xm4Bcx3u.js} +2 -2
- package/src/ui/static/assets/useTestResults-D5EwGIX9.js +1 -0
- package/src/ui/static/assets/{vendor-icons-B0wLOBoh.js → vendor-icons-BKPiFyYV.js} +1 -1
- package/src/ui/static/index.html +3 -3
- package/src/ui/static/assets/AdvancedPage-DB-6sJ6s.js +0 -3
- package/src/ui/static/assets/Dashboard-DRWbVyTb.js +0 -1
- package/src/ui/static/assets/PipelinesPanel-CMMXCSda.js +0 -1
- package/src/ui/static/assets/ReportCard-BbNfk85h.js +0 -2
- package/src/ui/static/assets/ReportFullView-Cg1rggho.js +0 -1
- package/src/ui/static/assets/ReportsPage-CFv3OAhe.js +0 -48
- package/src/ui/static/assets/ResultsPage-B4LwZH-R.js +0 -115
- package/src/ui/static/assets/SharedReportView-BAbW1WOs.js +0 -1
- package/src/ui/static/assets/TestExplorerPage-BRRWtwde.js +0 -7
- package/src/ui/static/assets/TestPlansPage-Bno2vpGd.js +0 -5
- package/src/ui/static/assets/index-B0klHYbO.css +0 -1
- package/src/ui/static/assets/index-DtBWNlVD.js +0 -47
- package/src/ui/static/assets/useTestResults-Bm-JyMhB.js +0 -1
package/dist/index.js
CHANGED
|
@@ -437,10 +437,10 @@ function decodeHtmlEntities(str2) {
|
|
|
437
437
|
function deepClone(obj) {
|
|
438
438
|
return structuredClone(obj);
|
|
439
439
|
}
|
|
440
|
-
function deepMerge(target2,
|
|
440
|
+
function deepMerge(target2, source2) {
|
|
441
441
|
const result = { ...target2 };
|
|
442
|
-
for (const key2 of Object.keys(
|
|
443
|
-
const sourceVal =
|
|
442
|
+
for (const key2 of Object.keys(source2)) {
|
|
443
|
+
const sourceVal = source2[key2];
|
|
444
444
|
const targetVal = result[key2];
|
|
445
445
|
if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal && typeof targetVal === "object" && !Array.isArray(targetVal)) {
|
|
446
446
|
result[key2] = deepMerge(
|
|
@@ -7556,7 +7556,7 @@ function run(cmd, args2, opts = {}) {
|
|
|
7556
7556
|
const child2 = spawn(cmd, args2, { env: opts.env ?? process.env, shell: opts.shell ?? false, windowsHide: true });
|
|
7557
7557
|
let stdout = "";
|
|
7558
7558
|
let stderr = "";
|
|
7559
|
-
const
|
|
7559
|
+
const timer2 = setTimeout(() => {
|
|
7560
7560
|
try {
|
|
7561
7561
|
child2.kill("SIGKILL");
|
|
7562
7562
|
} catch {
|
|
@@ -7570,11 +7570,11 @@ function run(cmd, args2, opts = {}) {
|
|
|
7570
7570
|
stderr += b.toString("utf-8");
|
|
7571
7571
|
});
|
|
7572
7572
|
child2.on("error", (err5) => {
|
|
7573
|
-
clearTimeout(
|
|
7573
|
+
clearTimeout(timer2);
|
|
7574
7574
|
resolve36({ ok: false, stdout, stderr, code: null, signal: null, error: err5.message });
|
|
7575
7575
|
});
|
|
7576
7576
|
child2.on("close", (code2, signal) => {
|
|
7577
|
-
clearTimeout(
|
|
7577
|
+
clearTimeout(timer2);
|
|
7578
7578
|
resolve36({ ok: code2 === 0, stdout, stderr, code: code2, signal });
|
|
7579
7579
|
});
|
|
7580
7580
|
} catch (err5) {
|
|
@@ -7641,7 +7641,7 @@ function parseAdbVersion(stdout) {
|
|
|
7641
7641
|
}
|
|
7642
7642
|
function parseAdbDevices(stdout) {
|
|
7643
7643
|
const lines = stdout.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
7644
|
-
const
|
|
7644
|
+
const probes2 = [];
|
|
7645
7645
|
for (const line of lines) {
|
|
7646
7646
|
if (line.toLowerCase().startsWith("list of devices")) continue;
|
|
7647
7647
|
if (line.startsWith("*")) continue;
|
|
@@ -7659,9 +7659,9 @@ function parseAdbDevices(stdout) {
|
|
|
7659
7659
|
if (modelMatch?.[1]) name2 = modelMatch[1].replace(/_/g, " ");
|
|
7660
7660
|
const probe = { serial, state, name: name2 };
|
|
7661
7661
|
if (/^emulator-\d+$/.test(serial)) probe.kind = "emulator";
|
|
7662
|
-
|
|
7662
|
+
probes2.push(probe);
|
|
7663
7663
|
}
|
|
7664
|
-
return
|
|
7664
|
+
return probes2;
|
|
7665
7665
|
}
|
|
7666
7666
|
async function enrichAndroidProbe(adbPath, probe) {
|
|
7667
7667
|
if (probe.state !== "connected") return probe;
|
|
@@ -7875,7 +7875,7 @@ async function captureAndroidScreenshotViaAdb(serial, explicitAdbPath, opts = {}
|
|
|
7875
7875
|
const child2 = spawn(adbPath, ["-s", serial, "exec-out", "screencap", "-p"], { shell: false });
|
|
7876
7876
|
const chunks = [];
|
|
7877
7877
|
let err5 = "";
|
|
7878
|
-
const
|
|
7878
|
+
const timer2 = setTimeout(() => {
|
|
7879
7879
|
try {
|
|
7880
7880
|
child2.kill("SIGKILL");
|
|
7881
7881
|
} catch {
|
|
@@ -7887,11 +7887,11 @@ async function captureAndroidScreenshotViaAdb(serial, explicitAdbPath, opts = {}
|
|
|
7887
7887
|
err5 += b.toString("utf-8");
|
|
7888
7888
|
});
|
|
7889
7889
|
child2.on("error", () => {
|
|
7890
|
-
clearTimeout(
|
|
7890
|
+
clearTimeout(timer2);
|
|
7891
7891
|
resolve36(null);
|
|
7892
7892
|
});
|
|
7893
7893
|
child2.on("close", (code2) => {
|
|
7894
|
-
clearTimeout(
|
|
7894
|
+
clearTimeout(timer2);
|
|
7895
7895
|
const buf = Buffer.concat(chunks);
|
|
7896
7896
|
if (code2 === 0 && buf.length > 8 && buf[0] === 137 && buf[1] === 80) {
|
|
7897
7897
|
resolve36(buf.toString("base64"));
|
|
@@ -7953,12 +7953,12 @@ async function getForegroundPackageViaAdb(serial, explicitAdbPath) {
|
|
|
7953
7953
|
const adbPath = await findAdb(explicitAdbPath);
|
|
7954
7954
|
if (!adbPath) return void 0;
|
|
7955
7955
|
const pkgRe = /([a-zA-Z][a-zA-Z0-9_]*(?:\.[a-zA-Z][a-zA-Z0-9_]*)+)\//;
|
|
7956
|
-
const
|
|
7956
|
+
const probes2 = [
|
|
7957
7957
|
["-s", serial, "shell", "dumpsys", "activity", "activities"],
|
|
7958
7958
|
["-s", serial, "shell", "dumpsys", "window", "windows"]
|
|
7959
7959
|
];
|
|
7960
7960
|
const home = await homeLauncherPackage(adbPath, serial);
|
|
7961
|
-
for (const args2 of
|
|
7961
|
+
for (const args2 of probes2) {
|
|
7962
7962
|
const res = await run(adbPath, args2, { timeoutMs: 5e3 });
|
|
7963
7963
|
if (!res.ok) continue;
|
|
7964
7964
|
const lines = res.stdout.split("\n").filter(
|
|
@@ -8274,12 +8274,12 @@ async function detectAppiumStatus(url, opts = {}) {
|
|
|
8274
8274
|
const local = isLocalAppiumHost(normalized);
|
|
8275
8275
|
try {
|
|
8276
8276
|
const ctrl = new AbortController();
|
|
8277
|
-
const
|
|
8277
|
+
const timer2 = setTimeout(() => ctrl.abort(), 2500);
|
|
8278
8278
|
let res;
|
|
8279
8279
|
try {
|
|
8280
8280
|
res = await fetch(statusUrl, { signal: ctrl.signal });
|
|
8281
8281
|
} finally {
|
|
8282
|
-
clearTimeout(
|
|
8282
|
+
clearTimeout(timer2);
|
|
8283
8283
|
}
|
|
8284
8284
|
if (!res.ok) {
|
|
8285
8285
|
return { url: normalized, reachable: false, local, error: `Appium returned HTTP ${res.status}` };
|
|
@@ -11769,8 +11769,8 @@ function kotlinSourceDeclaring(projectPath2, moduleRel, fqn) {
|
|
|
11769
11769
|
}
|
|
11770
11770
|
return void 0;
|
|
11771
11771
|
}
|
|
11772
|
-
function isKotestSpec(
|
|
11773
|
-
const masked = maskCFamily(
|
|
11772
|
+
function isKotestSpec(source2, simple) {
|
|
11773
|
+
const masked = maskCFamily(source2);
|
|
11774
11774
|
const m = new RegExp(`(?<![:\\w])class\\s+${simple}\\b[^{\\n]*?:\\s*([A-Za-z_][\\w.]*)`).exec(masked);
|
|
11775
11775
|
return !!m && KOTEST_SPEC_RE.test(m[1].split(".").pop());
|
|
11776
11776
|
}
|
|
@@ -11786,36 +11786,36 @@ function gradleCommand(dirAbs) {
|
|
|
11786
11786
|
function gradleProjectPath(moduleRel) {
|
|
11787
11787
|
return moduleRel ? `:${moduleRel.split("/").join(":")}` : "";
|
|
11788
11788
|
}
|
|
11789
|
-
function maskCFamily(
|
|
11790
|
-
const out =
|
|
11791
|
-
const n =
|
|
11789
|
+
function maskCFamily(source2) {
|
|
11790
|
+
const out = source2.split("");
|
|
11791
|
+
const n = source2.length;
|
|
11792
11792
|
const blank = (from, to) => {
|
|
11793
11793
|
for (let k = from; k < to && k < n; k++) if (out[k] !== "\n" && out[k] !== "\r") out[k] = " ";
|
|
11794
11794
|
};
|
|
11795
11795
|
let i = 0;
|
|
11796
11796
|
while (i < n) {
|
|
11797
|
-
const ch =
|
|
11798
|
-
const nx =
|
|
11797
|
+
const ch = source2[i];
|
|
11798
|
+
const nx = source2[i + 1];
|
|
11799
11799
|
if (ch === "/" && nx === "/") {
|
|
11800
|
-
let e =
|
|
11800
|
+
let e = source2.indexOf("\n", i);
|
|
11801
11801
|
if (e < 0) e = n;
|
|
11802
11802
|
blank(i, e);
|
|
11803
11803
|
i = e;
|
|
11804
11804
|
} else if (ch === "/" && nx === "*") {
|
|
11805
|
-
let e =
|
|
11805
|
+
let e = source2.indexOf("*/", i + 2);
|
|
11806
11806
|
e = e < 0 ? n : e + 2;
|
|
11807
11807
|
blank(i, e);
|
|
11808
11808
|
i = e;
|
|
11809
|
-
} else if (ch === '"' &&
|
|
11810
|
-
let e =
|
|
11809
|
+
} else if (ch === '"' && source2.startsWith('"""', i)) {
|
|
11810
|
+
let e = source2.indexOf('"""', i + 3);
|
|
11811
11811
|
e = e < 0 ? n : e + 3;
|
|
11812
11812
|
blank(i + 3, e - 3);
|
|
11813
11813
|
i = e;
|
|
11814
11814
|
} else if (ch === "@" && nx === '"') {
|
|
11815
11815
|
let k = i + 2;
|
|
11816
11816
|
for (; k < n; k++) {
|
|
11817
|
-
if (
|
|
11818
|
-
if (
|
|
11817
|
+
if (source2[k] === '"') {
|
|
11818
|
+
if (source2[k + 1] === '"') {
|
|
11819
11819
|
k++;
|
|
11820
11820
|
continue;
|
|
11821
11821
|
}
|
|
@@ -11826,12 +11826,12 @@ function maskCFamily(source) {
|
|
|
11826
11826
|
i = k + 1;
|
|
11827
11827
|
} else if (ch === '"' || ch === "'") {
|
|
11828
11828
|
let k = i + 1;
|
|
11829
|
-
for (; k < n &&
|
|
11830
|
-
if (
|
|
11829
|
+
for (; k < n && source2[k] !== "\n"; k++) {
|
|
11830
|
+
if (source2[k] === "\\") {
|
|
11831
11831
|
k++;
|
|
11832
11832
|
continue;
|
|
11833
11833
|
}
|
|
11834
|
-
if (
|
|
11834
|
+
if (source2[k] === ch) break;
|
|
11835
11835
|
}
|
|
11836
11836
|
blank(i + 1, k);
|
|
11837
11837
|
i = k + 1;
|
|
@@ -11841,8 +11841,8 @@ function maskCFamily(source) {
|
|
|
11841
11841
|
}
|
|
11842
11842
|
return out.join("");
|
|
11843
11843
|
}
|
|
11844
|
-
function javaClassesIn(
|
|
11845
|
-
const lines = maskCFamily(
|
|
11844
|
+
function javaClassesIn(source2, kotlin = false) {
|
|
11845
|
+
const lines = maskCFamily(source2).split("\n");
|
|
11846
11846
|
let pkg;
|
|
11847
11847
|
const classes = [];
|
|
11848
11848
|
const stack = [];
|
|
@@ -11906,12 +11906,12 @@ function buildJavaSingleTestCommand(opts) {
|
|
|
11906
11906
|
const r = javaRun(opts.projectPath, opts.file, opts.toolHint);
|
|
11907
11907
|
const simple = (opts.classPath ?? opts.className).split(".").pop();
|
|
11908
11908
|
if (opts.file.endsWith(".kt") && !simple.includes("$")) {
|
|
11909
|
-
let
|
|
11909
|
+
let source2 = "";
|
|
11910
11910
|
try {
|
|
11911
|
-
|
|
11911
|
+
source2 = readFileSync12(join17(opts.projectPath, opts.file), "utf-8");
|
|
11912
11912
|
} catch {
|
|
11913
11913
|
}
|
|
11914
|
-
if (isKotestSpec(
|
|
11914
|
+
if (isKotestSpec(source2, simple)) {
|
|
11915
11915
|
const contexts = (opts.suite ?? "").split(" > ").slice(1);
|
|
11916
11916
|
const root = contexts[0] ?? opts.method;
|
|
11917
11917
|
if (r.tool === "gradle") {
|
|
@@ -11932,12 +11932,12 @@ function buildJavaSingleTestCommand(opts) {
|
|
|
11932
11932
|
return `${r.prefix}${r.cmd} test${flags.before} -Dtest=${shellArg(`${simple}#${opts.method}`)}${flags.after}${suiteParams}`;
|
|
11933
11933
|
}
|
|
11934
11934
|
function topClassesOf(projectPath2, fileRel) {
|
|
11935
|
-
let
|
|
11935
|
+
let source2 = "";
|
|
11936
11936
|
try {
|
|
11937
|
-
|
|
11937
|
+
source2 = readFileSync12(join17(projectPath2, fileRel), "utf-8");
|
|
11938
11938
|
} catch {
|
|
11939
11939
|
}
|
|
11940
|
-
const { pkg, classes } = javaClassesIn(
|
|
11940
|
+
const { pkg, classes } = javaClassesIn(source2, fileRel.endsWith(".kt"));
|
|
11941
11941
|
const top = classes.filter((c2) => !c2.binary.includes("$"));
|
|
11942
11942
|
if (top.length === 0) return [`${pkg ? `${pkg}.` : ""}${fileRel.split("/").pop().replace(/\.\w+$/, "")}`];
|
|
11943
11943
|
return top.map((c2) => `${pkg ? `${pkg}.` : ""}${c2.binary}`);
|
|
@@ -12099,8 +12099,8 @@ function usesNUnit(csprojAbs) {
|
|
|
12099
12099
|
return false;
|
|
12100
12100
|
}
|
|
12101
12101
|
}
|
|
12102
|
-
function csharpClassPathsIn(
|
|
12103
|
-
const masked = maskCFamily(
|
|
12102
|
+
function csharpClassPathsIn(source2) {
|
|
12103
|
+
const masked = maskCFamily(source2);
|
|
12104
12104
|
const fileNs = /\bnamespace\s+([\w.]+)\s*;/.exec(masked)?.[1];
|
|
12105
12105
|
const out = [];
|
|
12106
12106
|
let depth = 0;
|
|
@@ -12135,12 +12135,12 @@ function buildDotnetFilesCommand(projectPath2, files, extraArgs = "") {
|
|
|
12135
12135
|
const args2 = extraArgs.trim() ? ` ${extraArgs.trim()}` : "";
|
|
12136
12136
|
if (list.length === 0) return `dotnet test${target(dotnetRunTarget(projectPath2))}${args2}`;
|
|
12137
12137
|
const classes = list.flatMap((f) => {
|
|
12138
|
-
let
|
|
12138
|
+
let source2 = "";
|
|
12139
12139
|
try {
|
|
12140
|
-
if (statSync9(join18(projectPath2, f)).isFile())
|
|
12140
|
+
if (statSync9(join18(projectPath2, f)).isFile()) source2 = readFileSync13(join18(projectPath2, f), "utf-8");
|
|
12141
12141
|
} catch {
|
|
12142
12142
|
}
|
|
12143
|
-
const found = csharpClassPathsIn(
|
|
12143
|
+
const found = csharpClassPathsIn(source2);
|
|
12144
12144
|
return found.length ? found : [f.split("/").pop().replace(/\.cs$/i, "")];
|
|
12145
12145
|
});
|
|
12146
12146
|
const filter = classes.map((c2) => `FullyQualifiedName~${dotnetFilterValue(`${c2}.`)}`).join("|");
|
|
@@ -12177,9 +12177,9 @@ function usesPytest(projectPath2, fileRel) {
|
|
|
12177
12177
|
} catch {
|
|
12178
12178
|
}
|
|
12179
12179
|
if (/\bpytest\b/i.test(manifests)) return true;
|
|
12180
|
-
const
|
|
12181
|
-
if (/^\s*(import|from)\s+pytest\b/m.test(
|
|
12182
|
-
if (/^\s*(import|from)\s+unittest\b/m.test(
|
|
12180
|
+
const source2 = fileRel ? read2(join19(projectPath2, fileRel)) : "";
|
|
12181
|
+
if (/^\s*(import|from)\s+pytest\b/m.test(source2)) return true;
|
|
12182
|
+
if (/^\s*(import|from)\s+unittest\b/m.test(source2)) return false;
|
|
12183
12183
|
return true;
|
|
12184
12184
|
}
|
|
12185
12185
|
function pytestNodeId(fileRel, test, classPath) {
|
|
@@ -13327,9 +13327,9 @@ function pytestBddIndex(projectPath2) {
|
|
|
13327
13327
|
const out = [];
|
|
13328
13328
|
const iniBase = pytestBddBaseDir(projectPath2);
|
|
13329
13329
|
for (const module of walk(projectPath2, (n) => n.endsWith(".py"), 8)) {
|
|
13330
|
-
const
|
|
13331
|
-
if (!
|
|
13332
|
-
const text3 =
|
|
13330
|
+
const source2 = read3(join21(projectPath2, module));
|
|
13331
|
+
if (!source2.includes("pytest_bdd")) continue;
|
|
13332
|
+
const text3 = source2.replace(/^\s*#.*$/gm, "");
|
|
13333
13333
|
const base = iniBase ? resolve5(projectPath2, iniBase) : dirname13(resolve5(projectPath2, module));
|
|
13334
13334
|
for (const m of text3.matchAll(/\b(?:pytest_bdd\.)?scenarios\s*\(/g)) {
|
|
13335
13335
|
const args2 = callArgs(text3, m.index + m[0].length);
|
|
@@ -16302,15 +16302,15 @@ function walkSuites(children, tests, projectPath2, outputDir) {
|
|
|
16302
16302
|
for (const c2 of children) {
|
|
16303
16303
|
if (c2.tag !== "suite") continue;
|
|
16304
16304
|
const suiteName = attr(c2.attrs, "name");
|
|
16305
|
-
const
|
|
16305
|
+
const source2 = attr(c2.attrs, "source");
|
|
16306
16306
|
const sub = topLevelChildren(c2.inner);
|
|
16307
16307
|
for (const e of sub) {
|
|
16308
|
-
if (e.tag === "test") buildTest(e, suiteName,
|
|
16308
|
+
if (e.tag === "test") buildTest(e, suiteName, source2, projectPath2, tests, outputDir);
|
|
16309
16309
|
}
|
|
16310
16310
|
walkSuites(sub, tests, projectPath2, outputDir);
|
|
16311
16311
|
}
|
|
16312
16312
|
}
|
|
16313
|
-
function buildTest(testEl, suiteName,
|
|
16313
|
+
function buildTest(testEl, suiteName, source2, projectPath2, tests, outputDir) {
|
|
16314
16314
|
const name2 = attr(testEl.attrs, "name") || "Unknown Test";
|
|
16315
16315
|
const children = topLevelChildren(testEl.inner);
|
|
16316
16316
|
const statusChild = children.find((c2) => c2.tag === "status");
|
|
@@ -16340,7 +16340,7 @@ function buildTest(testEl, suiteName, source, projectPath2, tests, outputDir) {
|
|
|
16340
16340
|
tests.push({
|
|
16341
16341
|
name: name2,
|
|
16342
16342
|
suite: suiteName || void 0,
|
|
16343
|
-
file: relativize(
|
|
16343
|
+
file: relativize(source2, projectPath2),
|
|
16344
16344
|
status: info.status,
|
|
16345
16345
|
duration: info.duration,
|
|
16346
16346
|
errorMessage: info.status === "failed" ? info.error : void 0,
|
|
@@ -16457,9 +16457,9 @@ function safeCodePoint2(n) {
|
|
|
16457
16457
|
return "";
|
|
16458
16458
|
}
|
|
16459
16459
|
}
|
|
16460
|
-
function relativize(
|
|
16461
|
-
if (!
|
|
16462
|
-
const s =
|
|
16460
|
+
function relativize(source2, projectPath2) {
|
|
16461
|
+
if (!source2) return void 0;
|
|
16462
|
+
const s = source2.replace(/\\/g, "/");
|
|
16463
16463
|
if (projectPath2) {
|
|
16464
16464
|
const p2 = projectPath2.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
16465
16465
|
if (s.toLowerCase().startsWith(p2.toLowerCase() + "/")) return s.slice(p2.length + 1);
|
|
@@ -17675,11 +17675,11 @@ var step_generator_exports = {};
|
|
|
17675
17675
|
__export(step_generator_exports, {
|
|
17676
17676
|
generateHumanSteps: () => generateHumanSteps
|
|
17677
17677
|
});
|
|
17678
|
-
function generateHumanSteps(
|
|
17679
|
-
return rawHumanSteps(
|
|
17678
|
+
function generateHumanSteps(source2, framework, startLine) {
|
|
17679
|
+
return rawHumanSteps(source2, framework, startLine).map((step2) => ({ ...step2, name: maskStepCredentials(step2.name) }));
|
|
17680
17680
|
}
|
|
17681
|
-
function rawHumanSteps(
|
|
17682
|
-
const lines =
|
|
17681
|
+
function rawHumanSteps(source2, framework, startLine) {
|
|
17682
|
+
const lines = source2.split("\n");
|
|
17683
17683
|
const fw = framework.toLowerCase();
|
|
17684
17684
|
if (fw === "playwright") return extractPlaywrightSteps(lines, startLine);
|
|
17685
17685
|
if (fw === "cypress") return extractCypressSteps(lines, startLine);
|
|
@@ -21386,9 +21386,9 @@ function resolveHumanSteps(test, projectPath2, framework, getScanResult) {
|
|
|
21386
21386
|
}
|
|
21387
21387
|
const endLine = matchedTest?.endLine || allLines.length;
|
|
21388
21388
|
const actualEnd = Math.min(endLine, allLines.length);
|
|
21389
|
-
const
|
|
21389
|
+
const source2 = allLines.slice(startLine - 1, actualEnd).join("\n");
|
|
21390
21390
|
if (!fw) return [];
|
|
21391
|
-
return generateHumanSteps(
|
|
21391
|
+
return generateHumanSteps(source2, fw, startLine);
|
|
21392
21392
|
}
|
|
21393
21393
|
function extractFailureLineFromStack(stackTrace, testFile, _projectPath) {
|
|
21394
21394
|
if (!stackTrace || !testFile) return null;
|
|
@@ -21839,6 +21839,75 @@ var init_audit_helper = __esm({
|
|
|
21839
21839
|
}
|
|
21840
21840
|
});
|
|
21841
21841
|
|
|
21842
|
+
// src/ui/services/run-activity.ts
|
|
21843
|
+
function registerRunProbe(name2, probe) {
|
|
21844
|
+
probes.set(name2, probe);
|
|
21845
|
+
}
|
|
21846
|
+
function setRunActivityBroadcaster(fn) {
|
|
21847
|
+
broadcaster = fn;
|
|
21848
|
+
}
|
|
21849
|
+
function activeRunCount() {
|
|
21850
|
+
let total = 0;
|
|
21851
|
+
for (const probe of probes.values()) {
|
|
21852
|
+
try {
|
|
21853
|
+
const n = probe();
|
|
21854
|
+
if (Number.isFinite(n) && n > 0) total += n;
|
|
21855
|
+
} catch {
|
|
21856
|
+
}
|
|
21857
|
+
}
|
|
21858
|
+
return total;
|
|
21859
|
+
}
|
|
21860
|
+
function runActivityChanged() {
|
|
21861
|
+
if (timer) return;
|
|
21862
|
+
timer = setTimeout(() => {
|
|
21863
|
+
timer = null;
|
|
21864
|
+
const count = activeRunCount();
|
|
21865
|
+
if (count === lastSent || !broadcaster) return;
|
|
21866
|
+
lastSent = count;
|
|
21867
|
+
try {
|
|
21868
|
+
broadcaster({ type: "runs-active", count });
|
|
21869
|
+
} catch {
|
|
21870
|
+
}
|
|
21871
|
+
}, 150);
|
|
21872
|
+
timer.unref?.();
|
|
21873
|
+
}
|
|
21874
|
+
var probes, broadcaster, lastSent, timer;
|
|
21875
|
+
var init_run_activity = __esm({
|
|
21876
|
+
"src/ui/services/run-activity.ts"() {
|
|
21877
|
+
"use strict";
|
|
21878
|
+
probes = /* @__PURE__ */ new Map();
|
|
21879
|
+
broadcaster = null;
|
|
21880
|
+
lastSent = -1;
|
|
21881
|
+
timer = null;
|
|
21882
|
+
}
|
|
21883
|
+
});
|
|
21884
|
+
|
|
21885
|
+
// src/ui/services/live-runs.ts
|
|
21886
|
+
function setLiveRunSource(s) {
|
|
21887
|
+
source = s;
|
|
21888
|
+
}
|
|
21889
|
+
function listLiveRuns() {
|
|
21890
|
+
try {
|
|
21891
|
+
return source?.list() ?? [];
|
|
21892
|
+
} catch {
|
|
21893
|
+
return [];
|
|
21894
|
+
}
|
|
21895
|
+
}
|
|
21896
|
+
function getLiveRun(runId) {
|
|
21897
|
+
try {
|
|
21898
|
+
return source?.get(runId);
|
|
21899
|
+
} catch {
|
|
21900
|
+
return void 0;
|
|
21901
|
+
}
|
|
21902
|
+
}
|
|
21903
|
+
var source;
|
|
21904
|
+
var init_live_runs = __esm({
|
|
21905
|
+
"src/ui/services/live-runs.ts"() {
|
|
21906
|
+
"use strict";
|
|
21907
|
+
source = null;
|
|
21908
|
+
}
|
|
21909
|
+
});
|
|
21910
|
+
|
|
21842
21911
|
// src/ui/store/runner-commands-store.ts
|
|
21843
21912
|
import { readFileSync as readFileSync32, existsSync as existsSync36, mkdirSync as mkdirSync9 } from "fs";
|
|
21844
21913
|
import { join as join38, dirname as dirname19 } from "path";
|
|
@@ -22167,9 +22236,9 @@ function elementsFromNativeXml(xml) {
|
|
|
22167
22236
|
}
|
|
22168
22237
|
return out;
|
|
22169
22238
|
}
|
|
22170
|
-
function elementsFromSource(
|
|
22171
|
-
const k = kind ?? (/^\s*(<\?xml|<hierarchy|<AppiumAUT|<XCUIElementType)/.test(
|
|
22172
|
-
return k === "xml" ? elementsFromNativeXml(
|
|
22239
|
+
function elementsFromSource(source2, kind) {
|
|
22240
|
+
const k = kind ?? (/^\s*(<\?xml|<hierarchy|<AppiumAUT|<XCUIElementType)/.test(source2) ? "xml" : "html");
|
|
22241
|
+
return k === "xml" ? elementsFromNativeXml(source2) : elementsFromHtml(source2);
|
|
22173
22242
|
}
|
|
22174
22243
|
function harvestDomElements(tracePath) {
|
|
22175
22244
|
const out = [];
|
|
@@ -23588,14 +23657,14 @@ function redactUrl(u) {
|
|
|
23588
23657
|
async function captureSession(endpoint, sessionId, auth, failure) {
|
|
23589
23658
|
const html = await wdGetString(`${endpoint}/session/${sessionId}/source`, auth);
|
|
23590
23659
|
if (!html) return null;
|
|
23591
|
-
let
|
|
23592
|
-
const kind = /^\s*(<\?xml|<hierarchy|<AppiumAUT|<XCUIElementType)/.test(
|
|
23593
|
-
if (kind === "html" && /<iframe\b|<[a-z][a-z0-9]*-[a-z0-9-]+[\s>]/i.test(
|
|
23660
|
+
let source2 = html.slice(0, MAX_SOURCE_BYTES);
|
|
23661
|
+
const kind = /^\s*(<\?xml|<hierarchy|<AppiumAUT|<XCUIElementType)/.test(source2) ? "xml" : "html";
|
|
23662
|
+
if (kind === "html" && /<iframe\b|<[a-z][a-z0-9]*-[a-z0-9-]+[\s>]/i.test(source2)) {
|
|
23594
23663
|
const composed = await wdExecuteString(`${endpoint}/session/${sessionId}/execute/sync`, `return ${COMPOSED_DOM_SCRIPT};`, auth);
|
|
23595
|
-
if (composed && composed.length > 50)
|
|
23664
|
+
if (composed && composed.length > 50) source2 = composed.slice(0, MAX_SOURCE_BYTES);
|
|
23596
23665
|
}
|
|
23597
23666
|
const url = kind === "html" ? await wdGetString(`${endpoint}/session/${sessionId}/url`, auth) || "" : "";
|
|
23598
|
-
return { html:
|
|
23667
|
+
return { html: source2, url, at: Date.now(), sessionId, failure, kind, hash: sha1(source2) };
|
|
23599
23668
|
}
|
|
23600
23669
|
async function wdExecuteString(url, script, auth) {
|
|
23601
23670
|
try {
|
|
@@ -23631,8 +23700,8 @@ async function captureCdp(port, failure) {
|
|
|
23631
23700
|
try {
|
|
23632
23701
|
const { url, html } = JSON.parse(raw);
|
|
23633
23702
|
if (!html) return null;
|
|
23634
|
-
const
|
|
23635
|
-
return { html:
|
|
23703
|
+
const source2 = html.slice(0, MAX_SOURCE_BYTES);
|
|
23704
|
+
return { html: source2, url: url || "", at: Date.now(), sessionId: `cdp:${port}`, failure, kind: "html", hash: sha1(source2) };
|
|
23636
23705
|
} catch {
|
|
23637
23706
|
return null;
|
|
23638
23707
|
}
|
|
@@ -23651,20 +23720,20 @@ async function cdpEvaluate(wsUrl, expression) {
|
|
|
23651
23720
|
resolve36(v);
|
|
23652
23721
|
};
|
|
23653
23722
|
const ws = new WebSocket3(wsUrl);
|
|
23654
|
-
const
|
|
23723
|
+
const timer2 = setTimeout(() => finish(null), HTTP_TIMEOUT_MS);
|
|
23655
23724
|
ws.on("open", () => ws.send(JSON.stringify({ id: 1, method: "Runtime.evaluate", params: { expression, returnByValue: true } })));
|
|
23656
23725
|
ws.on("message", (data) => {
|
|
23657
23726
|
try {
|
|
23658
23727
|
const msg = JSON.parse(String(data));
|
|
23659
23728
|
if (msg.id !== 1) return;
|
|
23660
|
-
clearTimeout(
|
|
23729
|
+
clearTimeout(timer2);
|
|
23661
23730
|
const v = msg.result?.result?.value;
|
|
23662
23731
|
finish(typeof v === "string" ? v : null);
|
|
23663
23732
|
} catch {
|
|
23664
23733
|
}
|
|
23665
23734
|
});
|
|
23666
23735
|
ws.on("error", () => {
|
|
23667
|
-
clearTimeout(
|
|
23736
|
+
clearTimeout(timer2);
|
|
23668
23737
|
finish(null);
|
|
23669
23738
|
});
|
|
23670
23739
|
});
|
|
@@ -23840,7 +23909,7 @@ function execCapture(cmd, args2) {
|
|
|
23840
23909
|
try {
|
|
23841
23910
|
const proc = spawn2(cmd, args2, { stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
23842
23911
|
let out = "";
|
|
23843
|
-
const
|
|
23912
|
+
const timer2 = setTimeout(() => {
|
|
23844
23913
|
try {
|
|
23845
23914
|
proc.kill();
|
|
23846
23915
|
} catch {
|
|
@@ -23851,11 +23920,11 @@ function execCapture(cmd, args2) {
|
|
|
23851
23920
|
out += String(d);
|
|
23852
23921
|
});
|
|
23853
23922
|
proc.on("close", () => {
|
|
23854
|
-
clearTimeout(
|
|
23923
|
+
clearTimeout(timer2);
|
|
23855
23924
|
resolve36(out || null);
|
|
23856
23925
|
});
|
|
23857
23926
|
proc.on("error", () => {
|
|
23858
|
-
clearTimeout(
|
|
23927
|
+
clearTimeout(timer2);
|
|
23859
23928
|
resolve36(null);
|
|
23860
23929
|
});
|
|
23861
23930
|
} catch {
|
|
@@ -23976,7 +24045,7 @@ async function ensureBrowserStackJavaSdk(projectPath2) {
|
|
|
23976
24045
|
[],
|
|
23977
24046
|
{ cwd: projectPath2, shell: true, stdio: ["ignore", "pipe", "pipe"], windowsHide: true }
|
|
23978
24047
|
);
|
|
23979
|
-
const
|
|
24048
|
+
const timer2 = setTimeout(() => {
|
|
23980
24049
|
try {
|
|
23981
24050
|
proc.kill();
|
|
23982
24051
|
} catch {
|
|
@@ -23984,11 +24053,11 @@ async function ensureBrowserStackJavaSdk(projectPath2) {
|
|
|
23984
24053
|
resolve36(false);
|
|
23985
24054
|
}, FETCH_TIMEOUT_MS);
|
|
23986
24055
|
proc.on("close", (code2) => {
|
|
23987
|
-
clearTimeout(
|
|
24056
|
+
clearTimeout(timer2);
|
|
23988
24057
|
resolve36(code2 === 0);
|
|
23989
24058
|
});
|
|
23990
24059
|
proc.on("error", () => {
|
|
23991
|
-
clearTimeout(
|
|
24060
|
+
clearTimeout(timer2);
|
|
23992
24061
|
resolve36(false);
|
|
23993
24062
|
});
|
|
23994
24063
|
});
|
|
@@ -24065,7 +24134,7 @@ function injectJavaAgent(runEnv, jarPath) {
|
|
|
24065
24134
|
function runsOk(cmd, cwd, timeoutMs) {
|
|
24066
24135
|
return new Promise((resolve36) => {
|
|
24067
24136
|
const proc = spawn3(cmd, [], { cwd, shell: true, stdio: ["ignore", "ignore", "ignore"], windowsHide: true });
|
|
24068
|
-
const
|
|
24137
|
+
const timer2 = setTimeout(() => {
|
|
24069
24138
|
try {
|
|
24070
24139
|
proc.kill();
|
|
24071
24140
|
} catch {
|
|
@@ -24073,11 +24142,11 @@ function runsOk(cmd, cwd, timeoutMs) {
|
|
|
24073
24142
|
resolve36(false);
|
|
24074
24143
|
}, timeoutMs);
|
|
24075
24144
|
proc.on("close", (code2) => {
|
|
24076
|
-
clearTimeout(
|
|
24145
|
+
clearTimeout(timer2);
|
|
24077
24146
|
resolve36(code2 === 0);
|
|
24078
24147
|
});
|
|
24079
24148
|
proc.on("error", () => {
|
|
24080
|
-
clearTimeout(
|
|
24149
|
+
clearTimeout(timer2);
|
|
24081
24150
|
resolve36(false);
|
|
24082
24151
|
});
|
|
24083
24152
|
});
|
|
@@ -24312,7 +24381,7 @@ function watchSdkSessions(projectPath2, hubAuth, runId) {
|
|
|
24312
24381
|
const seen = /* @__PURE__ */ new Set();
|
|
24313
24382
|
const carry = /* @__PURE__ */ new Map();
|
|
24314
24383
|
let lastHub = "hub.browserstack.com";
|
|
24315
|
-
const
|
|
24384
|
+
const timer2 = setInterval(() => {
|
|
24316
24385
|
for (const f of files) {
|
|
24317
24386
|
let size;
|
|
24318
24387
|
try {
|
|
@@ -24358,7 +24427,7 @@ function watchSdkSessions(projectPath2, hubAuth, runId) {
|
|
|
24358
24427
|
}
|
|
24359
24428
|
}
|
|
24360
24429
|
}, SDK_LOG_POLL_MS);
|
|
24361
|
-
return () => clearInterval(
|
|
24430
|
+
return () => clearInterval(timer2);
|
|
24362
24431
|
}
|
|
24363
24432
|
var SDK_ARTIFACT, SDK_JAR_NAME, FETCH_TIMEOUT_MS, fetchInFlight, PY_RUNNER_SEGMENT, PY_RUNNER_TOKEN, pyEnsureInFlight, OFFICIAL_PY_SDK_URL, pyEnvEnsureInFlight, dotnetEnsureInFlight, SDK_SESSION_RE, SDK_HUB_RE, SDK_LOG_FILES, SDK_LOG_POLL_MS, SDK_LOG_CHUNK_MAX;
|
|
24364
24433
|
var init_cloud_sdk_agent = __esm({
|
|
@@ -26043,8 +26112,8 @@ function assignedNameTokens(codeLine, oldValue) {
|
|
|
26043
26112
|
for (const noise of NOISE_TOKENS) tokens2.delete(noise);
|
|
26044
26113
|
return tokens2;
|
|
26045
26114
|
}
|
|
26046
|
-
function tagFor(
|
|
26047
|
-
return
|
|
26115
|
+
function tagFor(source2) {
|
|
26116
|
+
return source2;
|
|
26048
26117
|
}
|
|
26049
26118
|
function tierTestIdMatch(broken, ids, codeLine) {
|
|
26050
26119
|
const oldId = broken.hint;
|
|
@@ -29055,9 +29124,9 @@ var init_auto_heal_apply = __esm({
|
|
|
29055
29124
|
|
|
29056
29125
|
// src/ui/auth/internal-token.ts
|
|
29057
29126
|
import { randomBytes as randomBytes3, timingSafeEqual } from "crypto";
|
|
29058
|
-
function internalHeaders(
|
|
29127
|
+
function internalHeaders(source2) {
|
|
29059
29128
|
const h = { "X-Testver-Internal": TOKEN };
|
|
29060
|
-
if (
|
|
29129
|
+
if (source2) h["X-Testver-Source"] = source2;
|
|
29061
29130
|
return h;
|
|
29062
29131
|
}
|
|
29063
29132
|
function isInternalRequest(req) {
|
|
@@ -33351,6 +33420,27 @@ function cancelActiveRun(runId) {
|
|
|
33351
33420
|
stopProcessTree(entry2.process, entry2.gradleProject);
|
|
33352
33421
|
return true;
|
|
33353
33422
|
}
|
|
33423
|
+
function noteLiveProgress(message) {
|
|
33424
|
+
const m = message;
|
|
33425
|
+
if (!m.runId || typeof m.testName !== "string" || !activeRuns.has(m.runId)) return;
|
|
33426
|
+
if (m.type !== "test-progress" && m.type !== "test-passed" && m.type !== "test-failed") return;
|
|
33427
|
+
const name2 = m.testName.trim();
|
|
33428
|
+
if (!name2 || /^\d+ steps \(\d+ failed\)$/.test(name2)) return;
|
|
33429
|
+
const status = m.type === "test-passed" ? "passed" : m.type === "test-failed" ? "failed" : m.status === "passed" || m.status === "failed" || m.status === "skipped" || m.status === "running" ? m.status : void 0;
|
|
33430
|
+
if (!status) return;
|
|
33431
|
+
let tests = liveTests.get(m.runId);
|
|
33432
|
+
if (!tests) {
|
|
33433
|
+
tests = /* @__PURE__ */ new Map();
|
|
33434
|
+
liveTests.set(m.runId, tests);
|
|
33435
|
+
}
|
|
33436
|
+
if (status === "running") {
|
|
33437
|
+
for (const t of tests.values()) if (t.status === "running") t.status = "done";
|
|
33438
|
+
}
|
|
33439
|
+
const prev = tests.get(name2);
|
|
33440
|
+
const duration = typeof m.duration === "number" && m.duration > 0 ? m.duration : prev?.duration;
|
|
33441
|
+
if (prev && status === "running" && prev.status !== "running") return;
|
|
33442
|
+
tests.set(name2, { name: name2, status, ...duration ? { duration } : {} });
|
|
33443
|
+
}
|
|
33354
33444
|
function recordHistory(result) {
|
|
33355
33445
|
runHistory.unshift(result);
|
|
33356
33446
|
if (runHistory.length > MAX_HISTORY2) runHistory.pop();
|
|
@@ -33380,6 +33470,51 @@ function appendCapped(buf, text3) {
|
|
|
33380
33470
|
return nl >= 0 && nl < 8192 ? sliced.slice(nl + 1) : sliced;
|
|
33381
33471
|
}
|
|
33382
33472
|
function mountRunnerRoutes(app, wss, scanner, options, resultsStore4, cloudConfigStore, localMobileConfigStore, artifactFetcher, pushActivity, gitService, systemConfigStore) {
|
|
33473
|
+
setRunActivityBroadcaster((message) => broadcast(wss, message));
|
|
33474
|
+
registerRunProbe("runner", () => {
|
|
33475
|
+
let n = 0;
|
|
33476
|
+
for (const entry2 of activeRuns.values()) {
|
|
33477
|
+
if (entry2.plainCommand || runnerResults.has(entry2.result)) continue;
|
|
33478
|
+
n++;
|
|
33479
|
+
}
|
|
33480
|
+
return n;
|
|
33481
|
+
});
|
|
33482
|
+
const liveRun = (runId) => {
|
|
33483
|
+
const entry2 = activeRuns.get(runId);
|
|
33484
|
+
if (!entry2?.live || entry2.plainCommand || runnerResults.has(entry2.result) || entry2.live.parentRunId) return void 0;
|
|
33485
|
+
if (resultsStore4.getRun(runId)) return void 0;
|
|
33486
|
+
const tests = [...liveTests.get(runId)?.values() ?? []];
|
|
33487
|
+
const passed = tests.filter((t) => t.status === "passed").length;
|
|
33488
|
+
const failed = tests.filter((t) => t.status === "failed").length;
|
|
33489
|
+
const skipped = tests.filter((t) => t.status === "skipped").length;
|
|
33490
|
+
const executed = passed + failed;
|
|
33491
|
+
const startMs2 = Date.parse(entry2.result.startTime);
|
|
33492
|
+
return {
|
|
33493
|
+
runId,
|
|
33494
|
+
framework: entry2.framework,
|
|
33495
|
+
command: entry2.live.command,
|
|
33496
|
+
projectPath: options.projectPath,
|
|
33497
|
+
startTime: entry2.result.startTime,
|
|
33498
|
+
status: "running",
|
|
33499
|
+
duration: Number.isFinite(startMs2) ? Math.max(0, Date.now() - startMs2) : void 0,
|
|
33500
|
+
summary: { total: tests.length, passed, failed, skipped, passRate: executed ? Math.round(passed / executed * 1e3) / 10 : 0 },
|
|
33501
|
+
tests: [],
|
|
33502
|
+
source: entry2.live.source,
|
|
33503
|
+
...entry2.cloudProvider && entry2.cloudProvider !== "local" ? { cloudProvider: entry2.cloudProvider } : {},
|
|
33504
|
+
...entry2.gridBrowser ? { gridBrowser: entry2.gridBrowser } : {},
|
|
33505
|
+
...entry2.live.label ? { label: entry2.live.label } : {},
|
|
33506
|
+
origin: entry2.live.origin,
|
|
33507
|
+
...entry2.live.targetBrowser ? { targetBrowser: entry2.live.targetBrowser } : {},
|
|
33508
|
+
...entry2.live.targetEnvironment ? { targetEnvironment: entry2.live.targetEnvironment } : {},
|
|
33509
|
+
...entry2.live.targetDevice ? { targetDevice: entry2.live.targetDevice } : {},
|
|
33510
|
+
live: true,
|
|
33511
|
+
liveTests: tests
|
|
33512
|
+
};
|
|
33513
|
+
};
|
|
33514
|
+
setLiveRunSource({
|
|
33515
|
+
list: () => [...activeRuns.keys()].map(liveRun).filter((r) => !!r).sort((a, b) => (Date.parse(b.startTime) || 0) - (Date.parse(a.startTime) || 0)),
|
|
33516
|
+
get: liveRun
|
|
33517
|
+
});
|
|
33383
33518
|
try {
|
|
33384
33519
|
const r = recoverVendorFiles(options.projectPath);
|
|
33385
33520
|
if (r.restored.length || r.removed.length) console.log(`[testver] Put back vendor config files a stopped cloud run left: ${[...r.restored, ...r.removed].join(", ")}`);
|
|
@@ -34538,12 +34673,23 @@ function mountRunnerRoutes(app, wss, scanner, options, resultsStore4, cloudConfi
|
|
|
34538
34673
|
gridBrowser: runCloudProvider === "testver-grid" ? gridBrowser : void 0,
|
|
34539
34674
|
source: runSourceType,
|
|
34540
34675
|
...plainCommand ? { plainCommand: true } : {},
|
|
34676
|
+
live: {
|
|
34677
|
+
command: commandShown,
|
|
34678
|
+
label: runLabel2,
|
|
34679
|
+
origin: reqOrigin || (reqSource === "scheduler" ? "scheduler" : reqSource === "cli" ? "cli" : "manual"),
|
|
34680
|
+
parentRunId: reqParentRunId || void 0,
|
|
34681
|
+
source: runSource,
|
|
34682
|
+
targetBrowser,
|
|
34683
|
+
targetEnvironment,
|
|
34684
|
+
targetDevice: runTargetDevice
|
|
34685
|
+
},
|
|
34541
34686
|
// Stash clientId so the register-external handler can route
|
|
34542
34687
|
// any mobile-session reportbacks from this subprocess back to
|
|
34543
34688
|
// this specific run (multiple runs may be in flight per tab).
|
|
34544
34689
|
clientId: req.header("X-Client-Id") || void 0,
|
|
34545
34690
|
mobileSessions: []
|
|
34546
34691
|
});
|
|
34692
|
+
runActivityChanged();
|
|
34547
34693
|
startingRuns.delete(runId);
|
|
34548
34694
|
if (cancelBeforeStart.delete(runId)) {
|
|
34549
34695
|
stopProcessTree(proc, gradleProject);
|
|
@@ -35072,6 +35218,8 @@ ${closing.stderr}`, mobileAppRef)) {
|
|
|
35072
35218
|
broadcast(wss, { type: "complete", runId, exitCode: code2 ?? 1, duration, passed: parsedPassed, failed: parsedFailed, user: triggeredBy, ...plainCommand ? { plainCommand: true } : {} });
|
|
35073
35219
|
if (!plainCommand) pushActivity?.({ type: "complete", runId, exitCode: code2 ?? 1, duration, passed: parsedPassed, failed: parsedFailed, user: triggeredBy, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
35074
35220
|
activeRuns.delete(runId);
|
|
35221
|
+
liveTests.delete(runId);
|
|
35222
|
+
runActivityChanged();
|
|
35075
35223
|
localDeviceRuns.delete(runId);
|
|
35076
35224
|
releaseDeviceHold?.();
|
|
35077
35225
|
gridAccepted.delete(runId);
|
|
@@ -35096,6 +35244,8 @@ ${closing.stderr}`, mobileAppRef)) {
|
|
|
35096
35244
|
cancelledRunIds.delete(runId);
|
|
35097
35245
|
cancelledSessions.delete(runId);
|
|
35098
35246
|
activeRuns.delete(runId);
|
|
35247
|
+
liveTests.delete(runId);
|
|
35248
|
+
runActivityChanged();
|
|
35099
35249
|
localDeviceRuns.delete(runId);
|
|
35100
35250
|
releaseDeviceHold?.();
|
|
35101
35251
|
gridAccepted.delete(runId);
|
|
@@ -35117,6 +35267,9 @@ ${closing.stderr}`, mobileAppRef)) {
|
|
|
35117
35267
|
}
|
|
35118
35268
|
}
|
|
35119
35269
|
});
|
|
35270
|
+
app.get("/api/runner/activity", (_req, res) => {
|
|
35271
|
+
res.json({ count: activeRunCount() });
|
|
35272
|
+
});
|
|
35120
35273
|
app.get("/api/runner/active", (_req, res) => {
|
|
35121
35274
|
const active = Array.from(activeRuns.entries()).map(([id, entry2]) => ({
|
|
35122
35275
|
runId: id,
|
|
@@ -35236,6 +35389,8 @@ ${closing.stderr}`, mobileAppRef)) {
|
|
|
35236
35389
|
active.result.status = "cancelled";
|
|
35237
35390
|
active.result.endTime = (/* @__PURE__ */ new Date()).toISOString();
|
|
35238
35391
|
activeRuns.delete(runId);
|
|
35392
|
+
liveTests.delete(runId);
|
|
35393
|
+
runActivityChanged();
|
|
35239
35394
|
localDeviceRuns.delete(runId);
|
|
35240
35395
|
recordHistory(active.result);
|
|
35241
35396
|
audit(req, "run.cancel", { resourceType: "test-run", resourceId: runId });
|
|
@@ -35567,7 +35722,7 @@ async function runHookStreaming(cmd, cwd, env, phase, runId, wss, clean2 = (t) =
|
|
|
35567
35722
|
`);
|
|
35568
35723
|
return;
|
|
35569
35724
|
}
|
|
35570
|
-
const
|
|
35725
|
+
const timer2 = setTimeout(() => {
|
|
35571
35726
|
try {
|
|
35572
35727
|
proc.kill();
|
|
35573
35728
|
} catch {
|
|
@@ -35589,14 +35744,14 @@ async function runHookStreaming(cmd, cwd, env, phase, runId, wss, clean2 = (t) =
|
|
|
35589
35744
|
broadcast(wss, { type: "output", runId, data: text3, stream: "stderr" });
|
|
35590
35745
|
});
|
|
35591
35746
|
proc.on("close", (code2) => {
|
|
35592
|
-
clearTimeout(
|
|
35747
|
+
clearTimeout(timer2);
|
|
35593
35748
|
const exitColor = code2 === 0 ? "\x1B[32m" : "\x1B[31m";
|
|
35594
35749
|
finish(`${exitColor}\u2190 exited ${code2 ?? 1}\x1B[0m
|
|
35595
35750
|
|
|
35596
35751
|
`);
|
|
35597
35752
|
});
|
|
35598
35753
|
proc.on("error", (err5) => {
|
|
35599
|
-
clearTimeout(
|
|
35754
|
+
clearTimeout(timer2);
|
|
35600
35755
|
finish(`\x1B[31m\u2190 error: ${err5.message}\x1B[0m
|
|
35601
35756
|
|
|
35602
35757
|
`);
|
|
@@ -36104,6 +36259,7 @@ function wrapCommandForCloud(provider, command, cwd) {
|
|
|
36104
36259
|
}
|
|
36105
36260
|
}
|
|
36106
36261
|
function broadcast(wss, message) {
|
|
36262
|
+
noteLiveProgress(message);
|
|
36107
36263
|
const data = JSON.stringify(message);
|
|
36108
36264
|
for (const client of wss.clients) {
|
|
36109
36265
|
if (client.readyState === 1) {
|
|
@@ -36111,7 +36267,7 @@ function broadcast(wss, message) {
|
|
|
36111
36267
|
}
|
|
36112
36268
|
}
|
|
36113
36269
|
}
|
|
36114
|
-
var GRID_SECRET_PATTERNS, GRID_CEILING_RE, gridAccepted, gridPreflightChain, gridRefusals, activeRuns, localDeviceRuns, startingRuns, cancelBeforeStart, cancelledRunIds, cancelledSessions, STARTING_TTL_MS, WAITING_FOR_VENDOR_TURN, WAITING_FOR_REPORT_TURN, waitingRuns, headlessNoted, runHistory, MAX_HISTORY2, runnerResults, runnerHistory, MAX_RUN_BUFFER_CHARS, cypressProgress, robotProgress, ReportTurnCancelled, reportTurns, PW_RUN_DIR_MAX_AGE_MS, PLAYWRIGHT_SWITCHES, PROVIDER_LABELS, BROWSERSTACK_NODE_SDK_VERSION, BROWSERSTACK_CYPRESS_CLI_VERSION, LAMBDATEST_CYPRESS_CLI_VERSION;
|
|
36270
|
+
var GRID_SECRET_PATTERNS, GRID_CEILING_RE, gridAccepted, gridPreflightChain, gridRefusals, activeRuns, localDeviceRuns, startingRuns, cancelBeforeStart, cancelledRunIds, cancelledSessions, STARTING_TTL_MS, WAITING_FOR_VENDOR_TURN, WAITING_FOR_REPORT_TURN, waitingRuns, headlessNoted, runHistory, liveTests, MAX_HISTORY2, runnerResults, runnerHistory, MAX_RUN_BUFFER_CHARS, cypressProgress, robotProgress, ReportTurnCancelled, reportTurns, PW_RUN_DIR_MAX_AGE_MS, PLAYWRIGHT_SWITCHES, PROVIDER_LABELS, BROWSERSTACK_NODE_SDK_VERSION, BROWSERSTACK_CYPRESS_CLI_VERSION, LAMBDATEST_CYPRESS_CLI_VERSION;
|
|
36115
36271
|
var init_api_runner = __esm({
|
|
36116
36272
|
"src/ui/routes/api-runner.ts"() {
|
|
36117
36273
|
"use strict";
|
|
@@ -36137,6 +36293,8 @@ var init_api_runner = __esm({
|
|
|
36137
36293
|
init_appium_project();
|
|
36138
36294
|
init_cloud_vendor_options();
|
|
36139
36295
|
init_audit_helper();
|
|
36296
|
+
init_run_activity();
|
|
36297
|
+
init_live_runs();
|
|
36140
36298
|
init_runner_commands_store();
|
|
36141
36299
|
init_artifact_archiver();
|
|
36142
36300
|
init_playwright_traces();
|
|
@@ -36169,6 +36327,7 @@ var init_api_runner = __esm({
|
|
|
36169
36327
|
waitingRuns = /* @__PURE__ */ new Map();
|
|
36170
36328
|
headlessNoted = /* @__PURE__ */ new Set();
|
|
36171
36329
|
runHistory = [];
|
|
36330
|
+
liveTests = /* @__PURE__ */ new Map();
|
|
36172
36331
|
MAX_HISTORY2 = 50;
|
|
36173
36332
|
runnerResults = /* @__PURE__ */ new WeakSet();
|
|
36174
36333
|
runnerHistory = [];
|
|
@@ -38868,7 +39027,7 @@ function runCmd(command, cwd, timeout, extraEnv = {}, onCloseHook, meta) {
|
|
|
38868
39027
|
shell: true
|
|
38869
39028
|
});
|
|
38870
39029
|
let timedOut = false;
|
|
38871
|
-
const
|
|
39030
|
+
const timer2 = setTimeout(() => {
|
|
38872
39031
|
timedOut = true;
|
|
38873
39032
|
void (async () => {
|
|
38874
39033
|
try {
|
|
@@ -38900,11 +39059,11 @@ function runCmd(command, cwd, timeout, extraEnv = {}, onCloseHook, meta) {
|
|
|
38900
39059
|
stderr += data.toString();
|
|
38901
39060
|
});
|
|
38902
39061
|
proc.on("error", (err5) => {
|
|
38903
|
-
clearTimeout(
|
|
39062
|
+
clearTimeout(timer2);
|
|
38904
39063
|
reject(err5);
|
|
38905
39064
|
});
|
|
38906
39065
|
proc.on("close", async (code2) => {
|
|
38907
|
-
clearTimeout(
|
|
39066
|
+
clearTimeout(timer2);
|
|
38908
39067
|
if (meta?.track) {
|
|
38909
39068
|
try {
|
|
38910
39069
|
runClosed(runId);
|
|
@@ -42770,8 +42929,8 @@ function checkRequest(ctx, op, req) {
|
|
|
42770
42929
|
const headers = Object.fromEntries(Object.entries(req.headers).map(([k, v]) => [k.toLowerCase(), v]));
|
|
42771
42930
|
for (const p2 of op.parameters) {
|
|
42772
42931
|
if (p2.in === "cookie" || p2.in === "formData") continue;
|
|
42773
|
-
const
|
|
42774
|
-
const value = p2.in === "header" ?
|
|
42932
|
+
const source2 = p2.in === "query" ? req.query : p2.in === "path" ? req.pathParams : headers;
|
|
42933
|
+
const value = p2.in === "header" ? source2[p2.name.toLowerCase()] : source2[p2.name];
|
|
42775
42934
|
if (value === void 0 || value === "") {
|
|
42776
42935
|
if (p2.required) issues.push({ severity: "error", where: `${p2.in} "${p2.name}"`, message: "required parameter is missing" });
|
|
42777
42936
|
continue;
|
|
@@ -43501,7 +43660,7 @@ async function executeOnce(request, vars, opts) {
|
|
|
43501
43660
|
let responseBody = "";
|
|
43502
43661
|
let size = 0;
|
|
43503
43662
|
let redirectedTo;
|
|
43504
|
-
let
|
|
43663
|
+
let timer2;
|
|
43505
43664
|
try {
|
|
43506
43665
|
const doFetch = await fetchFor(opts.connection, vars, opts.baseDir ?? process.cwd());
|
|
43507
43666
|
const { url, init } = await buildFetchOptions(request, vars, opts.baseDir ?? process.cwd());
|
|
@@ -43514,7 +43673,7 @@ async function executeOnce(request, vars, opts) {
|
|
|
43514
43673
|
if (!Object.keys(h).some((k) => k.toLowerCase() === opts.correlation.header.toLowerCase())) h[opts.correlation.header] = opts.correlation.value;
|
|
43515
43674
|
}
|
|
43516
43675
|
const controller = new AbortController();
|
|
43517
|
-
|
|
43676
|
+
timer2 = setTimeout(() => controller.abort(), timeout);
|
|
43518
43677
|
init.signal = controller.signal;
|
|
43519
43678
|
const resp = await doFetch(url, init);
|
|
43520
43679
|
if (resp.redirected && resp.url && resp.url !== url) redirectedTo = resp.url;
|
|
@@ -43536,7 +43695,7 @@ async function executeOnce(request, vars, opts) {
|
|
|
43536
43695
|
responseBody = errorText(error);
|
|
43537
43696
|
}
|
|
43538
43697
|
} finally {
|
|
43539
|
-
if (
|
|
43698
|
+
if (timer2) clearTimeout(timer2);
|
|
43540
43699
|
}
|
|
43541
43700
|
const apiResponse = {
|
|
43542
43701
|
requestId: request.id,
|
|
@@ -43892,7 +44051,7 @@ async function websocketSession(opts) {
|
|
|
43892
44051
|
const finish = (closedBy, extra = {}) => {
|
|
43893
44052
|
if (finished) return;
|
|
43894
44053
|
finished = true;
|
|
43895
|
-
clearTimeout(
|
|
44054
|
+
clearTimeout(timer2);
|
|
43896
44055
|
try {
|
|
43897
44056
|
ws.close();
|
|
43898
44057
|
} catch {
|
|
@@ -43907,7 +44066,7 @@ async function websocketSession(opts) {
|
|
|
43907
44066
|
...extra
|
|
43908
44067
|
});
|
|
43909
44068
|
};
|
|
43910
|
-
const
|
|
44069
|
+
const timer2 = setTimeout(() => finish("timeout"), timeoutMs);
|
|
43911
44070
|
ws.on("open", async () => {
|
|
43912
44071
|
connected = true;
|
|
43913
44072
|
for (const m of opts.send ?? []) {
|
|
@@ -43931,7 +44090,7 @@ async function sseSession(opts) {
|
|
|
43931
44090
|
const timeoutMs = Math.min(opts.timeoutMs ?? 1e4, 3e5);
|
|
43932
44091
|
const max = Math.min(opts.maxMessages ?? 200, 5e3);
|
|
43933
44092
|
const controller = new AbortController();
|
|
43934
|
-
const
|
|
44093
|
+
const timer2 = setTimeout(() => controller.abort(), timeoutMs);
|
|
43935
44094
|
const messages = [];
|
|
43936
44095
|
let closedBy = "server";
|
|
43937
44096
|
let status;
|
|
@@ -43944,7 +44103,7 @@ async function sseSession(opts) {
|
|
|
43944
44103
|
});
|
|
43945
44104
|
status = res.status;
|
|
43946
44105
|
if (!res.ok || !res.body) {
|
|
43947
|
-
clearTimeout(
|
|
44106
|
+
clearTimeout(timer2);
|
|
43948
44107
|
return { connected: false, messages, closedBy: "error", error: `HTTP ${res.status} ${res.statusText}`, durationMs: Date.now() - start, status };
|
|
43949
44108
|
}
|
|
43950
44109
|
const reader = res.body.getReader();
|
|
@@ -43987,11 +44146,11 @@ async function sseSession(opts) {
|
|
|
43987
44146
|
} catch (err5) {
|
|
43988
44147
|
closedBy = err5?.name === "AbortError" ? closedBy === "server" ? "timeout" : closedBy : "error";
|
|
43989
44148
|
if (closedBy === "error") {
|
|
43990
|
-
clearTimeout(
|
|
44149
|
+
clearTimeout(timer2);
|
|
43991
44150
|
return { connected: status !== void 0, messages, closedBy, error: err5.message, durationMs: Date.now() - start, status };
|
|
43992
44151
|
}
|
|
43993
44152
|
} finally {
|
|
43994
|
-
clearTimeout(
|
|
44153
|
+
clearTimeout(timer2);
|
|
43995
44154
|
}
|
|
43996
44155
|
const d = done(opts.expect, messages);
|
|
43997
44156
|
return {
|
|
@@ -51028,11 +51187,11 @@ var init_dist = __esm({
|
|
|
51028
51187
|
}
|
|
51029
51188
|
function _objectSpread(target2) {
|
|
51030
51189
|
for (var i = 1; i < arguments.length; i++) {
|
|
51031
|
-
var
|
|
51032
|
-
i % 2 ? ownKeys2(Object(
|
|
51033
|
-
_defineProperty2(target2, key2,
|
|
51034
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target2, Object.getOwnPropertyDescriptors(
|
|
51035
|
-
Object.defineProperty(target2, key2, Object.getOwnPropertyDescriptor(
|
|
51190
|
+
var source2 = null != arguments[i] ? arguments[i] : {};
|
|
51191
|
+
i % 2 ? ownKeys2(Object(source2), true).forEach(function(key2) {
|
|
51192
|
+
_defineProperty2(target2, key2, source2[key2]);
|
|
51193
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target2, Object.getOwnPropertyDescriptors(source2)) : ownKeys2(Object(source2)).forEach(function(key2) {
|
|
51194
|
+
Object.defineProperty(target2, key2, Object.getOwnPropertyDescriptor(source2, key2));
|
|
51036
51195
|
});
|
|
51037
51196
|
}
|
|
51038
51197
|
return target2;
|
|
@@ -53320,20 +53479,20 @@ var init_dist = __esm({
|
|
|
53320
53479
|
EE.call(this);
|
|
53321
53480
|
}
|
|
53322
53481
|
Stream.prototype.pipe = function(dest, options) {
|
|
53323
|
-
var
|
|
53482
|
+
var source2 = this;
|
|
53324
53483
|
function ondata(chunk) {
|
|
53325
53484
|
if (dest.writable) {
|
|
53326
|
-
if (false === dest.write(chunk) &&
|
|
53485
|
+
if (false === dest.write(chunk) && source2.pause) source2.pause();
|
|
53327
53486
|
}
|
|
53328
53487
|
}
|
|
53329
|
-
|
|
53488
|
+
source2.on("data", ondata);
|
|
53330
53489
|
function ondrain() {
|
|
53331
|
-
if (
|
|
53490
|
+
if (source2.readable && source2.resume) source2.resume();
|
|
53332
53491
|
}
|
|
53333
53492
|
dest.on("drain", ondrain);
|
|
53334
53493
|
if (!dest._isStdio && (!options || options.end !== false)) {
|
|
53335
|
-
|
|
53336
|
-
|
|
53494
|
+
source2.on("end", onend);
|
|
53495
|
+
source2.on("close", onclose);
|
|
53337
53496
|
}
|
|
53338
53497
|
var didOnEnd = false;
|
|
53339
53498
|
function onend() {
|
|
@@ -53350,23 +53509,23 @@ var init_dist = __esm({
|
|
|
53350
53509
|
cleanup();
|
|
53351
53510
|
if (EE.listenerCount(this, "error") === 0) throw er;
|
|
53352
53511
|
}
|
|
53353
|
-
|
|
53512
|
+
source2.on("error", onerror);
|
|
53354
53513
|
dest.on("error", onerror);
|
|
53355
53514
|
function cleanup() {
|
|
53356
|
-
|
|
53515
|
+
source2.removeListener("data", ondata);
|
|
53357
53516
|
dest.removeListener("drain", ondrain);
|
|
53358
|
-
|
|
53359
|
-
|
|
53360
|
-
|
|
53517
|
+
source2.removeListener("end", onend);
|
|
53518
|
+
source2.removeListener("close", onclose);
|
|
53519
|
+
source2.removeListener("error", onerror);
|
|
53361
53520
|
dest.removeListener("error", onerror);
|
|
53362
|
-
|
|
53363
|
-
|
|
53521
|
+
source2.removeListener("end", cleanup);
|
|
53522
|
+
source2.removeListener("close", cleanup);
|
|
53364
53523
|
dest.removeListener("close", cleanup);
|
|
53365
53524
|
}
|
|
53366
|
-
|
|
53367
|
-
|
|
53525
|
+
source2.on("end", cleanup);
|
|
53526
|
+
source2.on("close", cleanup);
|
|
53368
53527
|
dest.on("close", cleanup);
|
|
53369
|
-
dest.emit("pipe",
|
|
53528
|
+
dest.emit("pipe", source2);
|
|
53370
53529
|
return dest;
|
|
53371
53530
|
};
|
|
53372
53531
|
}));
|
|
@@ -72429,18 +72588,18 @@ async function repairSourceFileText(store4) {
|
|
|
72429
72588
|
let updated = 0;
|
|
72430
72589
|
for (const row of store4.listSourceSummaries()) {
|
|
72431
72590
|
if (!row.hasFile || !isExtractableFile(row.fileName, row.fileType) || extractionDone(row.metadata)) continue;
|
|
72432
|
-
const
|
|
72433
|
-
if (!
|
|
72591
|
+
const source2 = store4.getSource(row.id);
|
|
72592
|
+
if (!source2?.fileData) continue;
|
|
72434
72593
|
checked++;
|
|
72435
72594
|
let text3 = "";
|
|
72436
72595
|
try {
|
|
72437
|
-
text3 = isPlainTextFile(
|
|
72596
|
+
text3 = isPlainTextFile(source2.fileName, source2.fileType) ? decodeTextBytes(Buffer.from(source2.fileData, "base64")).trim() : await extractTextFromFile(source2.fileData, source2.fileName, source2.fileType);
|
|
72438
72597
|
} catch {
|
|
72439
72598
|
text3 = "";
|
|
72440
72599
|
}
|
|
72441
|
-
const next = text3 ? combineWithExtracted(
|
|
72442
|
-
const content = next !== void 0 && norm2(next) !== norm2(
|
|
72443
|
-
store4.repairSourceText(
|
|
72600
|
+
const next = text3 ? combineWithExtracted(source2.content, source2.fileName, text3) : void 0;
|
|
72601
|
+
const content = next !== void 0 && norm2(next) !== norm2(source2.content || "") ? next : void 0;
|
|
72602
|
+
store4.repairSourceText(source2.id, content, markExtracted(source2.metadata));
|
|
72444
72603
|
if (content !== void 0) updated++;
|
|
72445
72604
|
await new Promise((r) => setImmediate(r));
|
|
72446
72605
|
}
|
|
@@ -72469,10 +72628,10 @@ __export(knowledge_retrieval_exports, {
|
|
|
72469
72628
|
});
|
|
72470
72629
|
import { existsSync as existsSync59, readFileSync as readFileSync51, statSync as statSync28 } from "fs";
|
|
72471
72630
|
import { extname as extname8, isAbsolute as isAbsolute17, relative as relative26, resolve as resolve16 } from "path";
|
|
72472
|
-
function getRepoPath(
|
|
72473
|
-
if (!
|
|
72631
|
+
function getRepoPath(source2) {
|
|
72632
|
+
if (!source2.metadata) return void 0;
|
|
72474
72633
|
try {
|
|
72475
|
-
const meta = JSON.parse(
|
|
72634
|
+
const meta = JSON.parse(source2.metadata);
|
|
72476
72635
|
return typeof meta.repoPath === "string" && meta.repoPath.trim() ? meta.repoPath.trim() : void 0;
|
|
72477
72636
|
} catch {
|
|
72478
72637
|
return void 0;
|
|
@@ -72485,10 +72644,10 @@ function resolveRepoFile(projectPath2, repoPath2) {
|
|
|
72485
72644
|
if (!rel || rel.startsWith("..") || isAbsolute17(rel)) return null;
|
|
72486
72645
|
return abs;
|
|
72487
72646
|
}
|
|
72488
|
-
async function getSourceChunks(
|
|
72489
|
-
const repoPath2 = getRepoPath(
|
|
72647
|
+
async function getSourceChunks(source2, projectPath2) {
|
|
72648
|
+
const repoPath2 = getRepoPath(source2);
|
|
72490
72649
|
const origin = repoPath2 ? "repo-file" : "stored";
|
|
72491
|
-
const key2 = `${resolve16(projectPath2)}::${
|
|
72650
|
+
const key2 = `${resolve16(projectPath2)}::${source2.id}`;
|
|
72492
72651
|
let fingerprint;
|
|
72493
72652
|
if (repoPath2) {
|
|
72494
72653
|
const abs = resolveRepoFile(projectPath2, repoPath2);
|
|
@@ -72506,21 +72665,21 @@ async function getSourceChunks(source, projectPath2) {
|
|
|
72506
72665
|
} else {
|
|
72507
72666
|
let extracted = "";
|
|
72508
72667
|
try {
|
|
72509
|
-
extracted = String(JSON.parse(
|
|
72668
|
+
extracted = String(JSON.parse(source2.metadata || "{}").textExtracted ?? "");
|
|
72510
72669
|
} catch {
|
|
72511
72670
|
}
|
|
72512
|
-
fingerprint = `db:${
|
|
72671
|
+
fingerprint = `db:${source2.updatedAt ?? ""}:${(source2.content || "").length}:${(source2.fileData || "").length}:${extracted}`;
|
|
72513
72672
|
}
|
|
72514
72673
|
const cached2 = chunkCache.get(key2);
|
|
72515
72674
|
if (cached2 && cached2.fingerprint === fingerprint) return { chunks: cached2.chunks, origin, repoPath: repoPath2 };
|
|
72516
|
-
const { text: text3, error } = await getSourceText(
|
|
72675
|
+
const { text: text3, error } = await getSourceText(source2, projectPath2);
|
|
72517
72676
|
if (!text3) return { chunks: [], origin, repoPath: repoPath2, error: error ?? "source has no readable text" };
|
|
72518
72677
|
const chunks = chunkText(text3, { maxCharsPerChunk: CHUNK_MAX, targetCharsPerChunk: CHUNK_TARGET });
|
|
72519
72678
|
chunkCache.set(key2, { fingerprint, chunks });
|
|
72520
72679
|
return { chunks, origin, repoPath: repoPath2 };
|
|
72521
72680
|
}
|
|
72522
|
-
async function getSourceText(
|
|
72523
|
-
const repoPath2 = getRepoPath(
|
|
72681
|
+
async function getSourceText(source2, projectPath2) {
|
|
72682
|
+
const repoPath2 = getRepoPath(source2);
|
|
72524
72683
|
if (repoPath2) {
|
|
72525
72684
|
const abs = resolveRepoFile(projectPath2, repoPath2);
|
|
72526
72685
|
if (!abs) return { text: "", repoPath: repoPath2, error: `path is outside the project: ${repoPath2}` };
|
|
@@ -72540,21 +72699,21 @@ async function getSourceText(source, projectPath2) {
|
|
|
72540
72699
|
return { text: "", repoPath: repoPath2, error: e.message };
|
|
72541
72700
|
}
|
|
72542
72701
|
}
|
|
72543
|
-
if (!(
|
|
72702
|
+
if (!(source2.content || "").trim() && source2.fileData) {
|
|
72544
72703
|
try {
|
|
72545
|
-
const text3 = (await extractTextFromFile(
|
|
72704
|
+
const text3 = (await extractTextFromFile(source2.fileData, source2.fileName || "", source2.fileType || "")).trim();
|
|
72546
72705
|
return text3 ? { text: text3 } : { text: "", error: "no extractable text \u2014 an image or a scanned file" };
|
|
72547
72706
|
} catch (e) {
|
|
72548
72707
|
return { text: "", error: `attachment could not be read: ${e.message}` };
|
|
72549
72708
|
}
|
|
72550
72709
|
}
|
|
72551
|
-
const content = (
|
|
72552
|
-
if (content &&
|
|
72710
|
+
const content = (source2.content || "").trim();
|
|
72711
|
+
if (content && source2.fileData) {
|
|
72553
72712
|
const { extractionDone: extractionDone2, hasExtractedText: hasExtractedText2, combineWithExtracted: combineWithExtracted2 } = await Promise.resolve().then(() => (init_source_text(), source_text_exports));
|
|
72554
|
-
if (!extractionDone2(
|
|
72713
|
+
if (!extractionDone2(source2.metadata) && !/--- File Content \(/.test(content)) {
|
|
72555
72714
|
try {
|
|
72556
|
-
const text3 = (await extractTextFromFile(
|
|
72557
|
-
if (text3 && !hasExtractedText2(content, text3)) return { text: combineWithExtracted2(content,
|
|
72715
|
+
const text3 = (await extractTextFromFile(source2.fileData, source2.fileName || "", source2.fileType || "")).trim();
|
|
72716
|
+
if (text3 && !hasExtractedText2(content, text3)) return { text: combineWithExtracted2(content, source2.fileName || "", text3) };
|
|
72558
72717
|
} catch {
|
|
72559
72718
|
}
|
|
72560
72719
|
}
|
|
@@ -72572,10 +72731,10 @@ async function searchKnowledge(options) {
|
|
|
72572
72731
|
return { hits: [], problems, searched: 0 };
|
|
72573
72732
|
}
|
|
72574
72733
|
const floor = Math.min(2, queryTokens.size);
|
|
72575
|
-
for (const
|
|
72576
|
-
const { chunks, origin, repoPath: repoPath2, error } = await getSourceChunks(
|
|
72734
|
+
for (const source2 of sources) {
|
|
72735
|
+
const { chunks, origin, repoPath: repoPath2, error } = await getSourceChunks(source2, projectPath2);
|
|
72577
72736
|
if (error && chunks.length === 0) {
|
|
72578
|
-
problems.push({ sourceId:
|
|
72737
|
+
problems.push({ sourceId: source2.id, sourceTitle: source2.title, error });
|
|
72579
72738
|
continue;
|
|
72580
72739
|
}
|
|
72581
72740
|
if (chunks.length === 0) continue;
|
|
@@ -72585,8 +72744,8 @@ async function searchKnowledge(options) {
|
|
|
72585
72744
|
const s = scoreOverlap(queryTokens, tokenize2(text3), floor);
|
|
72586
72745
|
if (s > 0) {
|
|
72587
72746
|
hits.push({
|
|
72588
|
-
sourceId:
|
|
72589
|
-
sourceTitle:
|
|
72747
|
+
sourceId: source2.id,
|
|
72748
|
+
sourceTitle: source2.title,
|
|
72590
72749
|
part: i + 1,
|
|
72591
72750
|
totalParts: chunks.length,
|
|
72592
72751
|
text: text3,
|
|
@@ -72718,12 +72877,12 @@ function applyTraceability(store4, testCaseId, args2, projectPath2) {
|
|
|
72718
72877
|
const sourceId = typeof args2.sourceId === "string" ? args2.sourceId.trim() : "";
|
|
72719
72878
|
if (sourceId) {
|
|
72720
72879
|
try {
|
|
72721
|
-
const
|
|
72722
|
-
if (!
|
|
72880
|
+
const source2 = store4.getSource(sourceId);
|
|
72881
|
+
if (!source2) {
|
|
72723
72882
|
notes.push(`source link FAILED: no source "${sourceId}"`);
|
|
72724
72883
|
} else {
|
|
72725
|
-
store4.linkTestCasesToSource(
|
|
72726
|
-
notes.push(`linked to source ${
|
|
72884
|
+
store4.linkTestCasesToSource(source2.id, [testCaseId], "ai_generated", "AI Assistant");
|
|
72885
|
+
notes.push(`linked to source ${source2.id}`);
|
|
72727
72886
|
}
|
|
72728
72887
|
} catch (e) {
|
|
72729
72888
|
notes.push(`source link FAILED: ${e.message}`);
|
|
@@ -73027,18 +73186,18 @@ ${sources.map(
|
|
|
73027
73186
|
case "get_source_content": {
|
|
73028
73187
|
const id = String(args2.id || args2.sourceId || "");
|
|
73029
73188
|
if (!id) return "Error: id is required";
|
|
73030
|
-
const
|
|
73031
|
-
if (!
|
|
73189
|
+
const source2 = tmStore.getSource(id);
|
|
73190
|
+
if (!source2) return `Source "${id}" not found.`;
|
|
73032
73191
|
const { getRepoPath: getRepoPath2, getSourceChunks: getSourceChunks2 } = await Promise.resolve().then(() => (init_knowledge_retrieval(), knowledge_retrieval_exports));
|
|
73033
|
-
const repoPath2 = getRepoPath2(
|
|
73192
|
+
const repoPath2 = getRepoPath2(source2);
|
|
73034
73193
|
if (repoPath2) {
|
|
73035
|
-
const { chunks, error } = await getSourceChunks2(
|
|
73194
|
+
const { chunks, error } = await getSourceChunks2(source2, projectPath2);
|
|
73036
73195
|
const text3 = chunks.join("\n\n");
|
|
73037
73196
|
if (!text3) return `Source "${id}" points at ${repoPath2} but no text could be read${error ? ` (${error})` : ""}.`;
|
|
73038
73197
|
return JSON.stringify({
|
|
73039
|
-
id:
|
|
73040
|
-
title:
|
|
73041
|
-
type:
|
|
73198
|
+
id: source2.id,
|
|
73199
|
+
title: source2.title,
|
|
73200
|
+
type: source2.type,
|
|
73042
73201
|
repoPath: repoPath2,
|
|
73043
73202
|
parts: chunks.length,
|
|
73044
73203
|
content: text3.substring(0, 5e3),
|
|
@@ -73046,13 +73205,13 @@ ${sources.map(
|
|
|
73046
73205
|
note: text3.length > 5e3 ? 'Truncated. Use action "search_knowledge" to pull only the passages you need \u2014 a whole document rarely belongs in context.' : void 0
|
|
73047
73206
|
}, null, 2);
|
|
73048
73207
|
}
|
|
73049
|
-
const full =
|
|
73208
|
+
const full = source2.content || "";
|
|
73050
73209
|
return JSON.stringify({
|
|
73051
|
-
id:
|
|
73052
|
-
title:
|
|
73053
|
-
type:
|
|
73210
|
+
id: source2.id,
|
|
73211
|
+
title: source2.title,
|
|
73212
|
+
type: source2.type,
|
|
73054
73213
|
content: full.substring(0, 5e3),
|
|
73055
|
-
fileName:
|
|
73214
|
+
fileName: source2.fileName,
|
|
73056
73215
|
truncated: full.length > 5e3,
|
|
73057
73216
|
note: full.length > 5e3 ? 'Truncated. Use action "search_knowledge" to pull only the passages you need.' : void 0
|
|
73058
73217
|
}, null, 2);
|
|
@@ -73069,7 +73228,7 @@ ${sources.map(
|
|
|
73069
73228
|
}
|
|
73070
73229
|
const rawType = String(args2.type || "document").toLowerCase();
|
|
73071
73230
|
const sourceType = ["requirement", "nlp", "jira", "document"].includes(rawType) ? rawType : "document";
|
|
73072
|
-
const
|
|
73231
|
+
const source2 = tmStore.createSource({
|
|
73073
73232
|
title,
|
|
73074
73233
|
type: sourceType,
|
|
73075
73234
|
content: filePath3 ? "" : content,
|
|
@@ -73079,13 +73238,13 @@ ${sources.map(
|
|
|
73079
73238
|
});
|
|
73080
73239
|
if (filePath3) {
|
|
73081
73240
|
const { getSourceChunks: getSourceChunks2 } = await Promise.resolve().then(() => (init_knowledge_retrieval(), knowledge_retrieval_exports));
|
|
73082
|
-
const { chunks, error } = await getSourceChunks2(
|
|
73241
|
+
const { chunks, error } = await getSourceChunks2(source2, projectPath2);
|
|
73083
73242
|
if (chunks.length === 0) {
|
|
73084
|
-
return `Registered [${
|
|
73243
|
+
return `Registered [${source2.id}] ${title} \u2192 ${filePath3}, but NO text could be extracted${error ? ` (${error})` : ""}. A scanned PDF or unsupported format will not be searchable.`;
|
|
73085
73244
|
}
|
|
73086
|
-
return `Registered [${
|
|
73245
|
+
return `Registered [${source2.id}] ${title} \u2192 ${filePath3} (${chunks.length} searchable part(s), re-read from disk on every query so edits are picked up).`;
|
|
73087
73246
|
}
|
|
73088
|
-
return `Registered [${
|
|
73247
|
+
return `Registered [${source2.id}] ${title} (${content.length} chars stored).`;
|
|
73089
73248
|
}
|
|
73090
73249
|
case "search_knowledge": {
|
|
73091
73250
|
const query = String(args2.query || args2.search || "").trim();
|
|
@@ -73948,11 +74107,12 @@ var init_generate_chart = __esm({
|
|
|
73948
74107
|
init_documents_dir();
|
|
73949
74108
|
projectPath = "";
|
|
73950
74109
|
COLORS = {
|
|
73951
|
-
|
|
74110
|
+
// Soft (pastel) colours by default — report charts read calmer; text stays grey.
|
|
74111
|
+
vibrant: ["#8AB4F8", "#F4A0A0", "#7DD3AE", "#F6C66E", "#B3A1EE", "#F2A5C7", "#7CCFC6", "#F7B489", "#A2ACF2", "#8BCFE6"],
|
|
73952
74112
|
pastel: ["#93C5FD", "#FCA5A5", "#6EE7B7", "#FCD34D", "#C4B5FD", "#F9A8D4", "#5EEAD4", "#FDBA74", "#A5B4FC", "#67E8F9"],
|
|
73953
|
-
status: { passed: "#
|
|
73954
|
-
priority: { critical: "#
|
|
73955
|
-
severity: { blocker: "#
|
|
74113
|
+
status: { passed: "#7DD3AE", failed: "#F4A0A0", skipped: "#F6C66E", blocked: "#F7B489", not_run: "#C3C9D2", in_progress: "#8AB4F8" },
|
|
74114
|
+
priority: { critical: "#F4A0A0", high: "#F7B489", medium: "#F6C66E", low: "#8AB4F8" },
|
|
74115
|
+
severity: { blocker: "#EE8F8F", critical: "#F4A0A0", major: "#F6C66E", minor: "#8AB4F8", trivial: "#C3C9D2" }
|
|
73956
74116
|
};
|
|
73957
74117
|
THEMES = {
|
|
73958
74118
|
dark: { bg: "#1a1a2e", text: "#E5E7EB", muted: "#9CA3AF", grid: "rgba(255,255,255,0.08)", stroke: "#1a1a2e" },
|
|
@@ -75083,7 +75243,9 @@ function normalizeDashboardCells(raw) {
|
|
|
75083
75243
|
...dir ? { deltaDirection: dir } : {},
|
|
75084
75244
|
...cell5.deltaGood === "up" || cell5.deltaGood === "down" ? { deltaGood: cell5.deltaGood } : {},
|
|
75085
75245
|
...optStr(cell5.hint, 300) ? { hint: optStr(cell5.hint, 300) } : {},
|
|
75086
|
-
...s ? { span: s } : {}
|
|
75246
|
+
...s ? { span: s } : {},
|
|
75247
|
+
...TONES2.has(String(cell5.status)) ? { status: cell5.status } : {},
|
|
75248
|
+
...Array.isArray(cell5.trend) && cell5.trend.length >= 2 ? { trend: cell5.trend.slice(-TREND_POINTS).map((x) => finite(x) ?? 0) } : {}
|
|
75087
75249
|
});
|
|
75088
75250
|
return;
|
|
75089
75251
|
}
|
|
@@ -75117,7 +75279,12 @@ function normalizeDashboardCells(raw) {
|
|
|
75117
75279
|
...COLOR_SCHEMES.has(String(cell5.colorScheme)) ? { colorScheme: cell5.colorScheme } : {},
|
|
75118
75280
|
...colors ? { colors } : {},
|
|
75119
75281
|
...s ? { span: s } : {},
|
|
75120
|
-
...optStr(cell5.hint, 300) ? { hint: optStr(cell5.hint, 300) } : {}
|
|
75282
|
+
...optStr(cell5.hint, 300) ? { hint: optStr(cell5.hint, 300) } : {},
|
|
75283
|
+
...(() => {
|
|
75284
|
+
if (!Array.isArray(cell5.runIds)) return {};
|
|
75285
|
+
const ids = cell5.runIds.slice(0, labels.length).map((x) => typeof x === "string" && RUN_ID.test(x) ? x : "");
|
|
75286
|
+
return ids.some(Boolean) ? { runIds: ids } : {};
|
|
75287
|
+
})()
|
|
75121
75288
|
});
|
|
75122
75289
|
return;
|
|
75123
75290
|
}
|
|
@@ -75135,13 +75302,20 @@ function normalizeDashboardCells(raw) {
|
|
|
75135
75302
|
headers = Array.from({ length: width }, (_, k) => `Column ${k + 1}`);
|
|
75136
75303
|
warnings.push(`${at2} (table "${str(cell5.title, 60)}"): no headers \u2014 numbered columns used`);
|
|
75137
75304
|
}
|
|
75305
|
+
const links = {};
|
|
75306
|
+
if (cell5.columnLinks && typeof cell5.columnLinks === "object" && !Array.isArray(cell5.columnLinks)) {
|
|
75307
|
+
for (const [h, kind] of Object.entries(cell5.columnLinks)) {
|
|
75308
|
+
if (headers.includes(h) && LINK_KINDS.has(String(kind))) links[h] = kind;
|
|
75309
|
+
}
|
|
75310
|
+
}
|
|
75138
75311
|
cells.push({
|
|
75139
75312
|
type: "table",
|
|
75140
75313
|
title: str(cell5.title, 200),
|
|
75141
75314
|
headers,
|
|
75142
75315
|
rows,
|
|
75143
75316
|
...s ? { span: s } : {},
|
|
75144
|
-
...optStr(cell5.hint, 300) ? { hint: optStr(cell5.hint, 300) } : {}
|
|
75317
|
+
...optStr(cell5.hint, 300) ? { hint: optStr(cell5.hint, 300) } : {},
|
|
75318
|
+
...Object.keys(links).length > 0 ? { columnLinks: links } : {}
|
|
75145
75319
|
});
|
|
75146
75320
|
return;
|
|
75147
75321
|
}
|
|
@@ -75160,12 +75334,40 @@ function normalizeDashboardCells(raw) {
|
|
|
75160
75334
|
});
|
|
75161
75335
|
return { cells, warnings };
|
|
75162
75336
|
}
|
|
75337
|
+
function normalizeDashboardSummary(raw) {
|
|
75338
|
+
let v = raw;
|
|
75339
|
+
if (typeof v === "string") {
|
|
75340
|
+
const t = v.trim();
|
|
75341
|
+
if (!t) return void 0;
|
|
75342
|
+
try {
|
|
75343
|
+
v = JSON.parse(t);
|
|
75344
|
+
} catch {
|
|
75345
|
+
v = { verdict: t };
|
|
75346
|
+
}
|
|
75347
|
+
}
|
|
75348
|
+
if (!v || typeof v !== "object" || Array.isArray(v)) return void 0;
|
|
75349
|
+
const o = v;
|
|
75350
|
+
const findings = (Array.isArray(o.findings) ? o.findings : []).filter((f) => !!f && typeof f === "object" && !Array.isArray(f)).map((f) => ({
|
|
75351
|
+
tone: TONES2.has(String(f.tone)) ? f.tone : "info",
|
|
75352
|
+
title: str(f.title ?? f.text, 200).trim(),
|
|
75353
|
+
...optStr(f.detail, 500) ? { detail: optStr(f.detail, 500) } : {}
|
|
75354
|
+
})).filter((f) => f.title).slice(0, SUMMARY_FINDINGS);
|
|
75355
|
+
const verdict = str(o.verdict, 300).trim();
|
|
75356
|
+
if (!verdict && findings.length === 0) return void 0;
|
|
75357
|
+
return {
|
|
75358
|
+
verdict,
|
|
75359
|
+
...TONES2.has(String(o.status)) ? { status: o.status } : {},
|
|
75360
|
+
...findings.length > 0 ? { findings } : {}
|
|
75361
|
+
};
|
|
75362
|
+
}
|
|
75163
75363
|
function normalizeDashboardSpec(raw) {
|
|
75164
75364
|
if (!raw || typeof raw !== "object") return null;
|
|
75165
75365
|
const r = raw;
|
|
75166
75366
|
const { cells, warnings } = normalizeDashboardCells(r.cells);
|
|
75167
75367
|
if (cells.length === 0) return null;
|
|
75168
75368
|
const generatedAt = typeof r.generatedAt === "string" && !Number.isNaN(Date.parse(r.generatedAt)) ? r.generatedAt : (/* @__PURE__ */ new Date()).toISOString();
|
|
75369
|
+
const summary2 = normalizeDashboardSummary(r.summary);
|
|
75370
|
+
const method = optStr(r.method, 1500);
|
|
75169
75371
|
return {
|
|
75170
75372
|
spec: {
|
|
75171
75373
|
id: str(r.id, 120),
|
|
@@ -75173,11 +75375,40 @@ function normalizeDashboardSpec(raw) {
|
|
|
75173
75375
|
title: str(r.title, 300) || "Dashboard",
|
|
75174
75376
|
...optStr(r.subtitle, 300) ? { subtitle: optStr(r.subtitle, 300) } : {},
|
|
75175
75377
|
generatedAt,
|
|
75378
|
+
...summary2 ? { summary: summary2 } : {},
|
|
75379
|
+
...method ? { method } : {},
|
|
75176
75380
|
cells
|
|
75177
75381
|
},
|
|
75178
75382
|
warnings
|
|
75179
75383
|
};
|
|
75180
75384
|
}
|
|
75385
|
+
function dashboardPreview(spec) {
|
|
75386
|
+
const cells = Array.isArray(spec.cells) ? spec.cells : [];
|
|
75387
|
+
const kpiCells = cells.filter((c2) => c2?.type === "kpi");
|
|
75388
|
+
const kpis = kpiCells.slice(0, 3).map((k) => {
|
|
75389
|
+
const delta = formatKpiDelta(k);
|
|
75390
|
+
return {
|
|
75391
|
+
title: String(k.title ?? ""),
|
|
75392
|
+
value: `${fmtValue(k.value)}${k.unit && k.unit !== "%" ? ` ${k.unit}` : k.unit ?? ""}`,
|
|
75393
|
+
...delta ? { delta } : {},
|
|
75394
|
+
tone: deltaTone(k),
|
|
75395
|
+
...k.status ? { status: k.status } : {}
|
|
75396
|
+
};
|
|
75397
|
+
});
|
|
75398
|
+
let trend = kpiCells.find((k) => Array.isArray(k.trend) && k.trend.length >= 2)?.trend;
|
|
75399
|
+
if (!trend) {
|
|
75400
|
+
const line = cells.find((c2) => c2?.type === "chart" && c2.chartType === "line");
|
|
75401
|
+
const series = line?.data ?? line?.datasets?.[0]?.data;
|
|
75402
|
+
if (series && series.length >= 2) trend = series;
|
|
75403
|
+
}
|
|
75404
|
+
return {
|
|
75405
|
+
generatedAt: spec.generatedAt,
|
|
75406
|
+
...spec.summary?.verdict ? { verdict: spec.summary.verdict } : {},
|
|
75407
|
+
...spec.summary?.status ? { status: spec.summary.status } : {},
|
|
75408
|
+
kpis,
|
|
75409
|
+
...trend ? { trend: trend.slice(-30) } : {}
|
|
75410
|
+
};
|
|
75411
|
+
}
|
|
75181
75412
|
function formatKpiDelta(cell5) {
|
|
75182
75413
|
if (cell5.delta == null || !Number.isFinite(cell5.delta)) return null;
|
|
75183
75414
|
const n = cell5.delta.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
@@ -75193,6 +75424,20 @@ function deltaArrow(dir, color) {
|
|
|
75193
75424
|
const path2 = dir === "up" ? "M5 1 L9 8 L1 8 Z" : dir === "down" ? "M1 2 L9 2 L5 9 Z" : "M1 4.5 H9 V5.5 H1 Z";
|
|
75194
75425
|
return `<svg class="arrow" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><path d="${path2}" fill="${color}"/></svg>`;
|
|
75195
75426
|
}
|
|
75427
|
+
function sparklinePoints(values, w, h, pad2 = 3) {
|
|
75428
|
+
const v = values.filter((x) => Number.isFinite(x));
|
|
75429
|
+
if (v.length < 2) return "";
|
|
75430
|
+
const mn = Math.min(...v), mx = Math.max(...v), r = mx - mn || 1;
|
|
75431
|
+
return v.map((x, i) => `${(i * w / (v.length - 1)).toFixed(1)},${(h - pad2 - (x - mn) / r * (h - 2 * pad2)).toFixed(1)}`).join(" ");
|
|
75432
|
+
}
|
|
75433
|
+
function renderSummaryHtml(summary2) {
|
|
75434
|
+
const status = summary2.status ? `<span class="pill ${PILL_CLASS[summary2.status]}">${escapeHtml3(TONE_LABEL[summary2.status])}</span>` : "";
|
|
75435
|
+
const findings = (summary2.findings ?? []).map((f) => `<li><span class="mark ${PILL_CLASS[f.tone]}" aria-hidden="true">${FINDING_MARK[f.tone]}</span><span><strong>${escapeHtml3(f.title)}</strong>${f.detail ? ` ${escapeHtml3(f.detail)}` : ""}</span></li>`).join("");
|
|
75436
|
+
return `<div class="summary${findings ? "" : " one"}">
|
|
75437
|
+
<div class="verdict-col">${status}${summary2.verdict ? `<div class="verdict">${escapeHtml3(summary2.verdict)}</div>` : ""}<div class="by">Summary written by the AI Assistant</div></div>
|
|
75438
|
+
${findings ? `<ul class="findings">${findings}</ul>` : ""}
|
|
75439
|
+
</div>`;
|
|
75440
|
+
}
|
|
75196
75441
|
function renderCellHtml(cell5, span2) {
|
|
75197
75442
|
const style = `grid-column: span ${span2};`;
|
|
75198
75443
|
if (cell5.type === "kpi") {
|
|
@@ -75201,10 +75446,14 @@ function renderCellHtml(cell5, span2) {
|
|
|
75201
75446
|
const dir = cell5.deltaDirection ?? (cell5.delta == null ? "flat" : cell5.delta > 0 ? "up" : cell5.delta < 0 ? "down" : "flat");
|
|
75202
75447
|
const deltaText = formatKpiDelta(cell5);
|
|
75203
75448
|
const delta = deltaText != null ? `<div class="kpi-delta" style="color:${color}">${deltaArrow(dir, color)}<span>${escapeHtml3(deltaText)}</span>${cell5.hint ? `<span class="kpi-hint-inline">${escapeHtml3(cell5.hint)}</span>` : ""}</div>` : cell5.hint ? `<div class="kpi-hint">${escapeHtml3(cell5.hint)}</div>` : "";
|
|
75449
|
+
const statusPillHtml = cell5.status ? `<span class="pill ${PILL_CLASS[cell5.status]}">${escapeHtml3(TONE_LABEL[cell5.status])}</span>` : "";
|
|
75450
|
+
const spark = cell5.trend ? sparklinePoints(cell5.trend, 200, 30) : "";
|
|
75451
|
+
const sparkColor = cell5.status === "bad" ? T_BAD : cell5.status === "warn" ? T_WARN : tone === "bad" ? T_BAD : T_GOOD;
|
|
75204
75452
|
return `<div class="cell kpi" style="${style}">
|
|
75205
|
-
<div class="kpi-title">${escapeHtml3(cell5.title)}</div>
|
|
75453
|
+
<div class="kpi-head"><div class="kpi-title">${escapeHtml3(cell5.title)}</div>${statusPillHtml}</div>
|
|
75206
75454
|
<div class="kpi-value">${escapeHtml3(fmtValue(cell5.value))}${cell5.unit ? `<span class="kpi-unit">${escapeHtml3(cell5.unit)}</span>` : ""}</div>
|
|
75207
75455
|
${delta}
|
|
75456
|
+
${spark ? `<svg class="spark" viewBox="0 0 200 30" preserveAspectRatio="none" aria-hidden="true"><polyline points="${spark}" fill="none" stroke="${sparkColor}" stroke-width="2"/></svg>` : ""}
|
|
75208
75457
|
</div>`;
|
|
75209
75458
|
}
|
|
75210
75459
|
if (cell5.type === "chart") {
|
|
@@ -75260,6 +75509,8 @@ function renderCellHtml(cell5, span2) {
|
|
|
75260
75509
|
}
|
|
75261
75510
|
function renderDashboardHtml(spec) {
|
|
75262
75511
|
const cells = gridRows(normalizeDashboardCells(spec.cells).cells).flatMap((row) => row.map(({ cell: cell5, span: span2 }) => renderCellHtml(cell5, span2))).join("\n");
|
|
75512
|
+
const summary2 = normalizeDashboardSummary(spec.summary);
|
|
75513
|
+
const method = typeof spec.method === "string" && spec.method.trim() ? spec.method.trim().slice(0, 1500) : "";
|
|
75263
75514
|
const T = REPORT_THEME;
|
|
75264
75515
|
return `<!doctype html>
|
|
75265
75516
|
<html lang="en">
|
|
@@ -75287,6 +75538,23 @@ function renderDashboardHtml(spec) {
|
|
|
75287
75538
|
.kpi-delta .arrow { flex: none; }
|
|
75288
75539
|
.kpi-hint-inline { margin-left: 4px; font-weight: 400; color: ${T.muted}; }
|
|
75289
75540
|
.kpi-hint { margin-top: 9px; font-size: 12px; color: ${T.muted}; }
|
|
75541
|
+
.kpi-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
|
75542
|
+
.spark { margin-top: 10px; width: 100%; height: 30px; display: block; }
|
|
75543
|
+
.summary { background: ${T.card}; border: 1px solid ${T.border}; border-radius: 12px; padding: 18px 20px; margin-bottom: 12px; display: grid; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); gap: 22px; }
|
|
75544
|
+
.summary.one { grid-template-columns: 1fr; }
|
|
75545
|
+
.verdict-col { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
|
|
75546
|
+
.verdict { font-size: 18px; line-height: 1.35; font-weight: 700; color: ${T.heading}; }
|
|
75547
|
+
.by { font-size: 11.5px; color: ${T.muted}; }
|
|
75548
|
+
.findings { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
|
|
75549
|
+
.findings li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: ${T.text}; }
|
|
75550
|
+
.findings strong { color: ${T.heading}; }
|
|
75551
|
+
.mark { flex: none; margin-top: 2px; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
|
|
75552
|
+
.mark.ok { color: ${T.pill.ok.fg}; background: ${T.pill.ok.bg}; }
|
|
75553
|
+
.mark.bad { color: ${T.pill.bad.fg}; background: ${T.pill.bad.bg}; }
|
|
75554
|
+
.mark.warn { color: ${T.pill.warn.fg}; background: ${T.pill.warn.bg}; }
|
|
75555
|
+
.mark.neutral { color: ${T.pill.neutral.fg}; background: ${T.pill.neutral.bg}; }
|
|
75556
|
+
.method { margin-top: 14px; background: ${T.card}; border: 1px solid ${T.border}; border-radius: 12px; padding: 14px 18px; font-size: 12.5px; line-height: 1.6; color: ${T.text}; }
|
|
75557
|
+
.method strong { color: ${T.heading}; }
|
|
75290
75558
|
.cell-title { font-size: 14px; font-weight: 600; color: ${T.strong}; margin-bottom: 10px; }
|
|
75291
75559
|
.chart-body svg { border-radius: 8px; }
|
|
75292
75560
|
.hint { margin-top: 8px; font-size: 11.5px; color: ${T.muted}; }
|
|
@@ -75319,6 +75587,7 @@ function renderDashboardHtml(spec) {
|
|
|
75319
75587
|
@media (max-width: 760px) {
|
|
75320
75588
|
.wrap { padding: 14px 12px 24px; }
|
|
75321
75589
|
.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
75590
|
+
.summary { grid-template-columns: 1fr; }
|
|
75322
75591
|
.cell { grid-column: span 2 !important; }
|
|
75323
75592
|
.cell.kpi { grid-column: span 1 !important; }
|
|
75324
75593
|
}
|
|
@@ -75335,11 +75604,13 @@ function renderDashboardHtml(spec) {
|
|
|
75335
75604
|
<div class="brand">Testver \xB7 Report</div>
|
|
75336
75605
|
<h1>${escapeHtml3(spec.title)}</h1>
|
|
75337
75606
|
${spec.subtitle ? `<div class="sub">${escapeHtml3(spec.subtitle)}</div>` : ""}
|
|
75338
|
-
<div class="meta">
|
|
75607
|
+
<div class="meta">Data as of ${escapeHtml3(generatedLabel(spec.generatedAt))}</div>
|
|
75339
75608
|
</div>
|
|
75609
|
+
${summary2 ? renderSummaryHtml(summary2) : ""}
|
|
75340
75610
|
<div class="grid">
|
|
75341
75611
|
${cells}
|
|
75342
75612
|
</div>
|
|
75613
|
+
${method ? `<div class="method"><strong>How this was calculated.</strong> ${escapeHtml3(method)}</div>` : ""}
|
|
75343
75614
|
<div class="footer">Generated by Testver</div>
|
|
75344
75615
|
</div>
|
|
75345
75616
|
</body>
|
|
@@ -75367,6 +75638,8 @@ async function handleGenerateDashboard(args2) {
|
|
|
75367
75638
|
if (cells.length === 0) {
|
|
75368
75639
|
return JSON.stringify({ error: `No cell could be drawn: ${warnings.join("; ")}. Fix the cells and call generate_dashboard again.` });
|
|
75369
75640
|
}
|
|
75641
|
+
const summary2 = normalizeDashboardSummary(args2.summary);
|
|
75642
|
+
const method = args2.method ? String(args2.method).trim().slice(0, 1500) : "";
|
|
75370
75643
|
const id = `dash_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
75371
75644
|
const spec = {
|
|
75372
75645
|
id,
|
|
@@ -75374,6 +75647,8 @@ async function handleGenerateDashboard(args2) {
|
|
|
75374
75647
|
title,
|
|
75375
75648
|
subtitle,
|
|
75376
75649
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
75650
|
+
...summary2 ? { summary: summary2 } : {},
|
|
75651
|
+
...method ? { method } : {},
|
|
75377
75652
|
cells
|
|
75378
75653
|
};
|
|
75379
75654
|
const outputDir = documentsDir(projectPathRef2);
|
|
@@ -75400,7 +75675,7 @@ async function handleGenerateDashboard(args2) {
|
|
|
75400
75675
|
return JSON.stringify({ error: `generate_dashboard failed: ${msg}` });
|
|
75401
75676
|
}
|
|
75402
75677
|
}
|
|
75403
|
-
var projectPathRef2, DASHBOARD_LIMITS, CHART_TYPES, COLOR_SCHEMES, str, optStr, finite, span, numbers, cellValue, HTML_CHART_FONT, generateDashboardTool, generateDashboardTools;
|
|
75678
|
+
var projectPathRef2, DASHBOARD_LIMITS, TONES2, LINK_KINDS, RUN_ID, TREND_POINTS, CHART_TYPES, COLOR_SCHEMES, str, optStr, finite, span, numbers, cellValue, SUMMARY_FINDINGS, HTML_CHART_FONT, T_GOOD, T_BAD, T_WARN, TONE_LABEL, PILL_CLASS, FINDING_MARK, generateDashboardTool, generateDashboardTools;
|
|
75404
75679
|
var init_generate_dashboard = __esm({
|
|
75405
75680
|
"src/core/tools/generate-dashboard.ts"() {
|
|
75406
75681
|
"use strict";
|
|
@@ -75409,6 +75684,10 @@ var init_generate_dashboard = __esm({
|
|
|
75409
75684
|
init_documents_dir();
|
|
75410
75685
|
projectPathRef2 = "";
|
|
75411
75686
|
DASHBOARD_LIMITS = { cells: 40, labels: 200, rows: 500, columns: 30, text: 4e3 };
|
|
75687
|
+
TONES2 = /* @__PURE__ */ new Set(["good", "warn", "bad"]);
|
|
75688
|
+
LINK_KINDS = /* @__PURE__ */ new Set(["run", "test", "file"]);
|
|
75689
|
+
RUN_ID = /^[A-Za-z0-9._-]{1,120}$/;
|
|
75690
|
+
TREND_POINTS = 60;
|
|
75412
75691
|
CHART_TYPES = /* @__PURE__ */ new Set(["line", "bar", "stacked_bar", "pie", "doughnut", "horizontal_bar"]);
|
|
75413
75692
|
COLOR_SCHEMES = /* @__PURE__ */ new Set(["vibrant", "pastel", "status", "priority", "severity"]);
|
|
75414
75693
|
str = (v, max = DASHBOARD_LIMITS.text) => String(v ?? "").slice(0, max);
|
|
@@ -75428,7 +75707,14 @@ var init_generate_dashboard = __esm({
|
|
|
75428
75707
|
if (v == null) return "";
|
|
75429
75708
|
return typeof v === "object" ? str(JSON.stringify(v), 500) : str(v, 1e3);
|
|
75430
75709
|
};
|
|
75710
|
+
SUMMARY_FINDINGS = 6;
|
|
75431
75711
|
HTML_CHART_FONT = 12.5;
|
|
75712
|
+
T_GOOD = REPORT_THEME.good;
|
|
75713
|
+
T_BAD = REPORT_THEME.bad;
|
|
75714
|
+
T_WARN = "#D97706";
|
|
75715
|
+
TONE_LABEL = { good: "On target", warn: "Watch", bad: "Needs action" };
|
|
75716
|
+
PILL_CLASS = { good: "ok", warn: "warn", bad: "bad", info: "neutral" };
|
|
75717
|
+
FINDING_MARK = { good: "\u2713", warn: "~", bad: "!", info: "i" };
|
|
75432
75718
|
generateDashboardTool = {
|
|
75433
75719
|
category: "reporting",
|
|
75434
75720
|
definition: {
|
|
@@ -75437,18 +75723,28 @@ var init_generate_dashboard = __esm({
|
|
|
75437
75723
|
parameters: {
|
|
75438
75724
|
type: "object",
|
|
75439
75725
|
properties: {
|
|
75440
|
-
title: { type: "string", description:
|
|
75441
|
-
subtitle: { type: "string", description: '
|
|
75726
|
+
title: { type: "string", description: 'Dashboard title (shown at top), e.g. "QA Daily \u2014 18 Nov 2026".' },
|
|
75727
|
+
subtitle: { type: "string", description: 'One short context line: the data window and scope, e.g. "Last 24 hours \xB7 12 runs on main". Not the method \u2014 that goes in `method`.' },
|
|
75728
|
+
summary: {
|
|
75729
|
+
type: "string",
|
|
75730
|
+
description: `JSON object shown ABOVE everything else \u2014 the answer first:
|
|
75731
|
+
{ "verdict": "Healthy overall \u2014 3 new checkout failures need a look.", "status": "good|warn|bad",
|
|
75732
|
+
"findings": [ { "tone": "bad|warn|good|info", "title": "3 new failures in Checkout.", "detail": "All time out on the payment step since build 4.2.0-rc3." } ] }
|
|
75733
|
+
verdict = one plain sentence a manager can act on; status = good (on target), warn (watch), bad (needs action); 3\u20135 findings, most important first, each a short bold title plus one sentence of detail, every number from a tool result. Up to ${SUMMARY_FINDINGS} findings.`
|
|
75734
|
+
},
|
|
75735
|
+
method: { type: "string", description: 'How the numbers were worked out, shown in a "How this was calculated" footer: the tools and window used, what was left out (unfinished runs, verification re-runs), how a rate is defined, what changes compare with.' },
|
|
75442
75736
|
cells: {
|
|
75443
75737
|
type: "string",
|
|
75444
75738
|
description: `JSON array of cell specs. Each cell is one of:
|
|
75445
|
-
- { "type": "kpi", "title": "Pass
|
|
75446
|
-
- { "type": "chart", "title": "
|
|
75447
|
-
- { "type": "table", "title": "
|
|
75448
|
-
- { "type": "markdown", "content": "##
|
|
75739
|
+
- { "type": "kpi", "title": "Pass rate", "value": 94.2, "unit": "%", "delta": 1.8, "deltaGood": "up", "hint": "vs previous 24 h", "status": "good|warn|bad", "trend": [89.6, 90.8, 91.2, 94.2], "span": 3 }
|
|
75740
|
+
- { "type": "chart", "title": "Results per run", "chartType": "line|bar|stacked_bar|pie|doughnut|horizontal_bar", "labels": [...], "data": [...] // or datasets: [{label, data}], "colorScheme": "vibrant|pastel|status|priority|severity", "runIds": ["<runId per label>"], "span": 6 }
|
|
75741
|
+
- { "type": "table", "title": "New failures", "headers": ["Test", "File", "Error", "Run"], "rows": [["pays with saved card", "checkout/payment.spec.ts", "Timeout 30000ms", "a91f2c 06:00"]], "columnLinks": { "Test": "test", "File": "file", "Run": "run" }, "span": 12 }
|
|
75742
|
+
- { "type": "markdown", "content": "## Notes\\n- Bullet", "span": 12 }
|
|
75449
75743
|
|
|
75450
|
-
Typical layout: 4 KPIs (span 3 each) on row 1, 2 charts (span 6) on row 2, 1 full-width table (span 12).
|
|
75451
|
-
|
|
75744
|
+
Typical layout: 4 KPIs (span 3 each) on row 1, 2 charts (span 6) on row 2, 1 full-width table (span 12). Put the verdict and findings in \`summary\`, not in a markdown cell.
|
|
75745
|
+
KPI extras: \`status\` = how the value stands against its target (good/warn/bad; leave out when there is no target); \`trend\` = the same measure for recent periods, oldest first, ending with this value (from the tools \u2014 omit if you have no series).
|
|
75746
|
+
Links: a chart whose labels are runs passes \`runIds\` (one id per label, from the tools) so a click opens the run; a table names link columns in \`columnLinks\` \u2014 "run" (the value starts with the run id), "test" (needs a "file" column in the same table), "file".
|
|
75747
|
+
Rules: every number must come from a tool result in this conversation (copy it exactly; say which tool/filter/window in \`method\`). A KPI needs a value; \`delta\` uses the KPI's own unit (omit unit for counts); direction is taken from the sign when not given. A chart needs labels plus data (or datasets \u2014 a pie/doughnut takes one series; use a bar chart instead of a pie with one slice). A table needs headers. Limits: ${DASHBOARD_LIMITS.cells} cells, ${DASHBOARD_LIMITS.rows} rows per table, ${DASHBOARD_LIMITS.labels} labels per chart. Cells that break these rules are dropped and reported back.`
|
|
75452
75748
|
}
|
|
75453
75749
|
},
|
|
75454
75750
|
required: ["title", "cells"]
|
|
@@ -76113,7 +76409,8 @@ __export(dashboard_export_exports, {
|
|
|
76113
76409
|
EXPORT_CONTENT_TYPES: () => EXPORT_CONTENT_TYPES,
|
|
76114
76410
|
dashboardToSheets: () => dashboardToSheets,
|
|
76115
76411
|
exportDashboard: () => exportDashboard,
|
|
76116
|
-
exportFileBase: () => exportFileBase
|
|
76412
|
+
exportFileBase: () => exportFileBase,
|
|
76413
|
+
withSummarySections: () => withSummarySections
|
|
76117
76414
|
});
|
|
76118
76415
|
import { writeFile as writeFile5, unlink as unlink3, mkdir as mkdir5 } from "fs/promises";
|
|
76119
76416
|
import { existsSync as existsSync63 } from "fs";
|
|
@@ -76176,15 +76473,30 @@ function dashboardToSheets(spec) {
|
|
|
76176
76473
|
function exportFileBase(title) {
|
|
76177
76474
|
return (title || "report").replace(/[^a-zA-Z0-9._ -]/g, "_").replace(/\s+/g, " ").trim().slice(0, 80) || "report";
|
|
76178
76475
|
}
|
|
76179
|
-
|
|
76476
|
+
function withSummarySections(spec) {
|
|
76477
|
+
const summary2 = normalizeDashboardSummary(spec.summary);
|
|
76478
|
+
const method = typeof spec.method === "string" ? spec.method.trim() : "";
|
|
76479
|
+
if (!summary2 && !method) return spec;
|
|
76480
|
+
const lead = [];
|
|
76481
|
+
if (summary2) {
|
|
76482
|
+
const verdict = summary2.verdict ? `**${summary2.status ? `${TONE_LABEL[summary2.status]}: ` : ""}${summary2.verdict}**` : "";
|
|
76483
|
+
const findings = (summary2.findings ?? []).map((f) => `- **${f.title}**${f.detail ? ` ${f.detail}` : ""}`);
|
|
76484
|
+
lead.push({ type: "markdown", content: ["## Summary", verdict, ...findings].filter(Boolean).join("\n"), span: 12 });
|
|
76485
|
+
}
|
|
76486
|
+
const tail = method ? [{ type: "markdown", content: `## How this was calculated
|
|
76487
|
+
${method}`, span: 12 }] : [];
|
|
76488
|
+
return { ...spec, cells: [...lead, ...spec.cells, ...tail] };
|
|
76489
|
+
}
|
|
76490
|
+
async function exportDashboard(rawSpec, format2, projectPath2, opts) {
|
|
76180
76491
|
const dir = documentsDir(projectPath2);
|
|
76181
76492
|
if (!existsSync63(dir)) await mkdir5(dir, { recursive: true });
|
|
76493
|
+
const spec = format2 === "html" ? rawSpec : withSummarySections(rawSpec);
|
|
76182
76494
|
const base = exportFileBase(opts?.fileBase || spec.title);
|
|
76183
76495
|
const fileName = `${base}.${format2}`;
|
|
76184
76496
|
const stamp2 = Date.now();
|
|
76185
76497
|
if (format2 === "html") {
|
|
76186
76498
|
const path2 = join64(dir, `${stamp2}-${base.replace(/ /g, "_")}.html`);
|
|
76187
|
-
await writeFile5(path2, renderDashboardHtml(
|
|
76499
|
+
await writeFile5(path2, renderDashboardHtml(rawSpec), "utf-8");
|
|
76188
76500
|
return { path: path2, fileName, contentType: EXPORT_CONTENT_TYPES.html, cleanup: () => unlink3(path2).catch(() => {
|
|
76189
76501
|
}) };
|
|
76190
76502
|
}
|
|
@@ -76668,6 +76980,13 @@ __export(report_store_exports, {
|
|
|
76668
76980
|
import { readFileSync as readFileSync54, mkdirSync as mkdirSync21, existsSync as existsSync64 } from "fs";
|
|
76669
76981
|
import { randomBytes as randomBytes7 } from "crypto";
|
|
76670
76982
|
import { join as join65 } from "path";
|
|
76983
|
+
function listItem({ spec, ...meta }) {
|
|
76984
|
+
try {
|
|
76985
|
+
return { ...meta, preview: dashboardPreview(spec) };
|
|
76986
|
+
} catch {
|
|
76987
|
+
return meta;
|
|
76988
|
+
}
|
|
76989
|
+
}
|
|
76671
76990
|
function canAccessRecord(record, user) {
|
|
76672
76991
|
if (record.ownerEmail === user.id) return true;
|
|
76673
76992
|
return record.ownerEmail === UNOWNED && user.role === "admin";
|
|
@@ -76684,6 +77003,7 @@ var init_report_store = __esm({
|
|
|
76684
77003
|
"src/ui/store/report-store.ts"() {
|
|
76685
77004
|
"use strict";
|
|
76686
77005
|
init_utils();
|
|
77006
|
+
init_generate_dashboard();
|
|
76687
77007
|
init_atomic_write();
|
|
76688
77008
|
UNOWNED = "anonymous";
|
|
76689
77009
|
SCHEDULE_FORMATS = ["pdf", "html", "xlsx", "docx"];
|
|
@@ -76708,7 +77028,7 @@ var init_report_store = __esm({
|
|
|
76708
77028
|
return this.data.reports.filter((r) => canAccessRecord(r, user)).sort((a, b) => {
|
|
76709
77029
|
if (a.pinned !== b.pinned) return a.pinned ? -1 : 1;
|
|
76710
77030
|
return (b.updatedAt || "").localeCompare(a.updatedAt || "");
|
|
76711
|
-
}).map(
|
|
77031
|
+
}).map(listItem);
|
|
76712
77032
|
}
|
|
76713
77033
|
/**
|
|
76714
77034
|
* Every report with a live public link (not revoked, not expired), whoever
|
|
@@ -76716,7 +77036,7 @@ var init_report_store = __esm({
|
|
|
76716
77036
|
* Newest share first. Metadata only (spec stripped).
|
|
76717
77037
|
*/
|
|
76718
77038
|
listShared() {
|
|
76719
|
-
return this.data.reports.filter((r) => isLiveShared(r)).sort((a, b) => (b.shareCreatedAt || b.updatedAt || "").localeCompare(a.shareCreatedAt || a.updatedAt || "")).map(
|
|
77039
|
+
return this.data.reports.filter((r) => isLiveShared(r)).sort((a, b) => (b.shareCreatedAt || b.updatedAt || "").localeCompare(a.shareCreatedAt || a.updatedAt || "")).map(listItem);
|
|
76720
77040
|
}
|
|
76721
77041
|
/** Admin/debug path: return every saved report regardless of owner. */
|
|
76722
77042
|
listAll() {
|
|
@@ -77109,9 +77429,9 @@ function createSchedule(store4, user, input) {
|
|
|
77109
77429
|
if (!isScheduleFormat(format2)) return { error: `format must be one of ${SCHEDULE_FORMATS.join(", ")}`, status: 400 };
|
|
77110
77430
|
const recErr = recipientsProblem(input.recipients);
|
|
77111
77431
|
if (recErr) return { error: recErr, status: 400 };
|
|
77112
|
-
const
|
|
77113
|
-
if (!
|
|
77114
|
-
if (!canAccessRecord(
|
|
77432
|
+
const source2 = store4.get(input.sourceReportId);
|
|
77433
|
+
if (!source2) return { error: "sourceReportId does not exist", status: 400 };
|
|
77434
|
+
if (!canAccessRecord(source2, user)) return { error: "Cannot schedule another user's report", status: 403 };
|
|
77115
77435
|
const cron = String(input.cron).trim();
|
|
77116
77436
|
const schedule = store4.createSchedule({
|
|
77117
77437
|
id: `sched_${Date.now().toString(36)}_${randomBytes8(3).toString("hex")}`,
|
|
@@ -77446,8 +77766,8 @@ function directNavigations(projectPath2, specPath) {
|
|
|
77446
77766
|
try {
|
|
77447
77767
|
const full = isAbsolute19(specPath) ? specPath : join66(projectPath2, specPath);
|
|
77448
77768
|
if (!existsSync65(full)) return null;
|
|
77449
|
-
const
|
|
77450
|
-
return (
|
|
77769
|
+
const source2 = readFileSync56(full, "utf-8").replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1").replace(/^\s*#.*$/gm, "");
|
|
77770
|
+
return (source2.match(NAV_CALL) ?? []).length;
|
|
77451
77771
|
} catch {
|
|
77452
77772
|
return null;
|
|
77453
77773
|
}
|
|
@@ -78260,22 +78580,22 @@ function sourceKind(type) {
|
|
|
78260
78580
|
return void 0;
|
|
78261
78581
|
}
|
|
78262
78582
|
}
|
|
78263
|
-
async function indexSource(
|
|
78583
|
+
async function indexSource(source2, projectPath2, problems) {
|
|
78264
78584
|
const { getSourceChunks: getSourceChunks2 } = await Promise.resolve().then(() => (init_knowledge_retrieval(), knowledge_retrieval_exports));
|
|
78265
|
-
const { chunks, repoPath: repoPath2, error } = await getSourceChunks2(
|
|
78585
|
+
const { chunks, repoPath: repoPath2, error } = await getSourceChunks2(source2, projectPath2);
|
|
78266
78586
|
if (chunks.length === 0) {
|
|
78267
|
-
problems.push(`document "${
|
|
78587
|
+
problems.push(`document "${source2.title}" (${source2.id}): ${error ?? "no readable text"}`);
|
|
78268
78588
|
return [];
|
|
78269
78589
|
}
|
|
78270
78590
|
return chunks.map((text3, i) => entry({
|
|
78271
78591
|
tier: "stated",
|
|
78272
78592
|
text: text3,
|
|
78273
78593
|
score: 0,
|
|
78274
|
-
citation: `${
|
|
78275
|
-
provenance: repoPath2 ||
|
|
78276
|
-
capturedAt:
|
|
78277
|
-
kind: sourceKind(
|
|
78278
|
-
},
|
|
78594
|
+
citation: `${source2.id} \xB7 part ${i + 1}/${chunks.length}`,
|
|
78595
|
+
provenance: repoPath2 || source2.title,
|
|
78596
|
+
capturedAt: source2.updatedAt,
|
|
78597
|
+
kind: sourceKind(source2.type)
|
|
78598
|
+
}, source2.id));
|
|
78279
78599
|
}
|
|
78280
78600
|
function indexRequirements(store4) {
|
|
78281
78601
|
const out = [];
|
|
@@ -79630,8 +79950,8 @@ __export(test_library_exports, {
|
|
|
79630
79950
|
testLibraryTool: () => testLibraryTool,
|
|
79631
79951
|
testLibraryTools: () => testLibraryTools
|
|
79632
79952
|
});
|
|
79633
|
-
function setTestOwnershipSource(
|
|
79634
|
-
ownershipSource =
|
|
79953
|
+
function setTestOwnershipSource(source2) {
|
|
79954
|
+
ownershipSource = source2;
|
|
79635
79955
|
}
|
|
79636
79956
|
function cell3(text3, max = 90) {
|
|
79637
79957
|
const one = String(text3 ?? "").replace(/\|/g, "/").replace(/\s+/g, " ").trim();
|
|
@@ -82322,13 +82642,13 @@ var init_permissions = __esm({
|
|
|
82322
82642
|
});
|
|
82323
82643
|
|
|
82324
82644
|
// src/core/skills/skill-parser.ts
|
|
82325
|
-
function parseSkillContent(content, slug,
|
|
82645
|
+
function parseSkillContent(content, slug, source2 = "builtin") {
|
|
82326
82646
|
const trimmed = content.trim();
|
|
82327
82647
|
if (!trimmed.startsWith("---")) {
|
|
82328
82648
|
return {
|
|
82329
82649
|
metadata: { name: slug, slug, description: "" },
|
|
82330
82650
|
body: trimmed,
|
|
82331
|
-
source
|
|
82651
|
+
source: source2
|
|
82332
82652
|
};
|
|
82333
82653
|
}
|
|
82334
82654
|
const secondDelimiter = trimmed.indexOf("---", 3);
|
|
@@ -82336,13 +82656,13 @@ function parseSkillContent(content, slug, source = "builtin") {
|
|
|
82336
82656
|
return {
|
|
82337
82657
|
metadata: { name: slug, slug, description: "" },
|
|
82338
82658
|
body: trimmed,
|
|
82339
|
-
source
|
|
82659
|
+
source: source2
|
|
82340
82660
|
};
|
|
82341
82661
|
}
|
|
82342
82662
|
const yamlBlock = trimmed.slice(3, secondDelimiter).trim();
|
|
82343
82663
|
const body = trimmed.slice(secondDelimiter + 3).trim();
|
|
82344
82664
|
const metadata = parseSimpleYaml(yamlBlock, slug);
|
|
82345
|
-
return { metadata, body, source };
|
|
82665
|
+
return { metadata, body, source: source2 };
|
|
82346
82666
|
}
|
|
82347
82667
|
function parseSimpleYaml(yaml, defaultSlug) {
|
|
82348
82668
|
const meta = {};
|
|
@@ -83412,10 +83732,10 @@ var init_skill_registry = __esm({
|
|
|
83412
83732
|
logger19.info(`Loaded ${this.skills.size} builtin skills`);
|
|
83413
83733
|
}
|
|
83414
83734
|
/** Register a skill from raw content (for user-added skills). */
|
|
83415
|
-
registerFromContent(slug, content,
|
|
83416
|
-
const skill = parseSkillContent(content, slug,
|
|
83735
|
+
registerFromContent(slug, content, source2 = "user") {
|
|
83736
|
+
const skill = parseSkillContent(content, slug, source2);
|
|
83417
83737
|
this.skills.set(slug, skill);
|
|
83418
|
-
logger19.info(`Registered skill: ${slug} (${
|
|
83738
|
+
logger19.info(`Registered skill: ${slug} (${source2})`);
|
|
83419
83739
|
return skill;
|
|
83420
83740
|
}
|
|
83421
83741
|
/** Remove a custom skill (builtin skills cannot be removed). */
|
|
@@ -92653,7 +92973,7 @@ var init_git_service = __esm({
|
|
|
92653
92973
|
const child2 = spawn8("git", args2, { cwd: this.projectPath, env: { ...process.env, GIT_OPTIONAL_LOCKS: "0", ...env }, windowsHide: true });
|
|
92654
92974
|
let stdout = "";
|
|
92655
92975
|
let stderr = "";
|
|
92656
|
-
const
|
|
92976
|
+
const timer2 = setTimeout(() => child2.kill(), timeoutMs);
|
|
92657
92977
|
child2.stdout.on("data", (c2) => {
|
|
92658
92978
|
if (stdout.length < 8 * 1024 * 1024) stdout += c2.toString("utf8");
|
|
92659
92979
|
});
|
|
@@ -92661,11 +92981,11 @@ var init_git_service = __esm({
|
|
|
92661
92981
|
if (stderr.length < 16e3) stderr += c2.toString("utf8");
|
|
92662
92982
|
});
|
|
92663
92983
|
child2.on("error", (e) => {
|
|
92664
|
-
clearTimeout(
|
|
92984
|
+
clearTimeout(timer2);
|
|
92665
92985
|
reject(e);
|
|
92666
92986
|
});
|
|
92667
92987
|
child2.on("close", (code2) => {
|
|
92668
|
-
clearTimeout(
|
|
92988
|
+
clearTimeout(timer2);
|
|
92669
92989
|
resolve36({ code: code2 ?? 1, stdout, stderr });
|
|
92670
92990
|
});
|
|
92671
92991
|
});
|
|
@@ -93108,7 +93428,7 @@ var init_git_service = __esm({
|
|
|
93108
93428
|
let size = 0;
|
|
93109
93429
|
let truncated = false;
|
|
93110
93430
|
let stderr = "";
|
|
93111
|
-
const
|
|
93431
|
+
const timer2 = setTimeout(() => child2.kill(), READ_BLOCK_MS);
|
|
93112
93432
|
child2.stdout.on("data", (c2) => {
|
|
93113
93433
|
if (truncated) return;
|
|
93114
93434
|
if (size + c2.length > maxBytes) {
|
|
@@ -93125,11 +93445,11 @@ var init_git_service = __esm({
|
|
|
93125
93445
|
if (stderr.length < 4e3) stderr += c2.toString("utf8");
|
|
93126
93446
|
});
|
|
93127
93447
|
child2.on("error", (err5) => {
|
|
93128
|
-
clearTimeout(
|
|
93448
|
+
clearTimeout(timer2);
|
|
93129
93449
|
reject(err5);
|
|
93130
93450
|
});
|
|
93131
93451
|
child2.on("close", (code2) => {
|
|
93132
|
-
clearTimeout(
|
|
93452
|
+
clearTimeout(timer2);
|
|
93133
93453
|
if (code2 !== 0 && !truncated) {
|
|
93134
93454
|
reject(new Error(stderr.trim() || `git ${args2[0]} exited with code ${code2}`));
|
|
93135
93455
|
return;
|
|
@@ -99347,14 +99667,14 @@ URL: ${url}
|
|
|
99347
99667
|
* Called by: browser 'disconnected' event, heartbeat poll, last-page-close detection.
|
|
99348
99668
|
* Only executes ONCE per session thanks to `disconnectNotified` flag.
|
|
99349
99669
|
*/
|
|
99350
|
-
handleDisconnect(
|
|
99670
|
+
handleDisconnect(source2) {
|
|
99351
99671
|
if (this.disconnectNotified) {
|
|
99352
|
-
logger24.info(`Disconnect already handled (ignoring duplicate from ${
|
|
99672
|
+
logger24.info(`Disconnect already handled (ignoring duplicate from ${source2})`);
|
|
99353
99673
|
return;
|
|
99354
99674
|
}
|
|
99355
99675
|
this.disconnectNotified = true;
|
|
99356
99676
|
this.stopDisconnectPoll();
|
|
99357
|
-
logger24.info(`Browser disconnect detected via ${
|
|
99677
|
+
logger24.info(`Browser disconnect detected via ${source2} \u2014 cleaning up`);
|
|
99358
99678
|
this.pages = [];
|
|
99359
99679
|
this.activePageIndex = 0;
|
|
99360
99680
|
this.activeFrame = null;
|
|
@@ -100606,10 +100926,10 @@ var init_appium_client = __esm({
|
|
|
100606
100926
|
async createCloudSession(caps, wantedMs) {
|
|
100607
100927
|
const { softMs, hardMs } = cloudSessionWaits(wantedMs, this.createSessionGraceMs);
|
|
100608
100928
|
const pending = this.request("POST", "/session", caps, { noSessionPrefix: true, timeoutMs: hardMs });
|
|
100609
|
-
let
|
|
100929
|
+
let timer2;
|
|
100610
100930
|
let timedOut = false;
|
|
100611
100931
|
const soft = new Promise((_, reject) => {
|
|
100612
|
-
|
|
100932
|
+
timer2 = setTimeout(() => {
|
|
100613
100933
|
timedOut = true;
|
|
100614
100934
|
reject(new AppiumApiError(
|
|
100615
100935
|
0,
|
|
@@ -100617,12 +100937,12 @@ var init_appium_client = __esm({
|
|
|
100617
100937
|
`The provider did not start the device session within ${Math.round(softMs / 1e3)} s (device queue or app install). Try again, or pick another device.`
|
|
100618
100938
|
));
|
|
100619
100939
|
}, softMs);
|
|
100620
|
-
|
|
100940
|
+
timer2.unref?.();
|
|
100621
100941
|
});
|
|
100622
100942
|
try {
|
|
100623
100943
|
return await Promise.race([pending, soft]);
|
|
100624
100944
|
} finally {
|
|
100625
|
-
if (
|
|
100945
|
+
if (timer2) clearTimeout(timer2);
|
|
100626
100946
|
if (timedOut) {
|
|
100627
100947
|
void pending.then((late) => {
|
|
100628
100948
|
const lateId = sessionIdOf(late);
|
|
@@ -100884,8 +101204,8 @@ function detectSystemDialog(xml, platform4) {
|
|
|
100884
101204
|
if (!markers.some((m) => m.test(xml))) return null;
|
|
100885
101205
|
return '\u26A0 SYSTEM DIALOG/ALERT DETECTED (permission prompt, alert, or crash dialog) \u2014 it blocks the app underneath. Handle it FIRST: mobile_alert action="accept" (or "dismiss"), or tap its button directly from the tree below.';
|
|
100886
101206
|
}
|
|
100887
|
-
function looksLikeHtmlSource(
|
|
100888
|
-
const head =
|
|
101207
|
+
function looksLikeHtmlSource(source2) {
|
|
101208
|
+
const head = source2.slice(0, 600);
|
|
100889
101209
|
return /<!DOCTYPE\s+html/i.test(head) || /<html[\s>]/i.test(head);
|
|
100890
101210
|
}
|
|
100891
101211
|
function decodeHtmlEntities2(s) {
|
|
@@ -101294,8 +101614,8 @@ var init_remote_appium_adapter = __esm({
|
|
|
101294
101614
|
}
|
|
101295
101615
|
// ── Inspection ──────────────────────────────────────────────────────────
|
|
101296
101616
|
async snapshot(includeScreenshot = false, query) {
|
|
101297
|
-
const
|
|
101298
|
-
return this.buildSnapshotFromSource(
|
|
101617
|
+
const source2 = await this.readGuarded(() => this.client.getPageSource());
|
|
101618
|
+
return this.buildSnapshotFromSource(source2, includeScreenshot, query);
|
|
101299
101619
|
}
|
|
101300
101620
|
/**
|
|
101301
101621
|
* Settle-then-snapshot: wait until two consecutive page sources match
|
|
@@ -101307,17 +101627,17 @@ var init_remote_appium_adapter = __esm({
|
|
|
101307
101627
|
async settleAndSnapshot(maxMs = 2500, query) {
|
|
101308
101628
|
await new Promise((r) => setTimeout(r, 350));
|
|
101309
101629
|
const deadline = Date.now() + maxMs;
|
|
101310
|
-
let
|
|
101630
|
+
let source2 = await this.readGuarded(() => this.client.getPageSource());
|
|
101311
101631
|
while (Date.now() < deadline) {
|
|
101312
101632
|
await new Promise((r) => setTimeout(r, 300));
|
|
101313
101633
|
const next = await this.client.getPageSource().catch(() => null);
|
|
101314
101634
|
if (next === null) break;
|
|
101315
|
-
if (next ===
|
|
101316
|
-
|
|
101635
|
+
if (next === source2) break;
|
|
101636
|
+
source2 = next;
|
|
101317
101637
|
}
|
|
101318
|
-
return this.buildSnapshotFromSource(
|
|
101638
|
+
return this.buildSnapshotFromSource(source2, false, query);
|
|
101319
101639
|
}
|
|
101320
|
-
async buildSnapshotFromSource(
|
|
101640
|
+
async buildSnapshotFromSource(source2, includeScreenshot, query) {
|
|
101321
101641
|
let screenshot;
|
|
101322
101642
|
if (includeScreenshot) {
|
|
101323
101643
|
try {
|
|
@@ -101334,8 +101654,8 @@ var init_remote_appium_adapter = __esm({
|
|
|
101334
101654
|
foregroundChanged = { from: this.lastForeground, to: foreground };
|
|
101335
101655
|
}
|
|
101336
101656
|
if (foreground) this.lastForeground = foreground;
|
|
101337
|
-
const dialogBanner = detectSystemDialog(
|
|
101338
|
-
let tree = simplifyAccessibilityTree(
|
|
101657
|
+
const dialogBanner = detectSystemDialog(source2, this.session?.platform ?? "android");
|
|
101658
|
+
let tree = simplifyAccessibilityTree(source2, query);
|
|
101339
101659
|
if (dialogBanner) tree = `${dialogBanner}
|
|
101340
101660
|
${tree}`;
|
|
101341
101661
|
return {
|
|
@@ -102028,15 +102348,15 @@ var init_session_pool = __esm({
|
|
|
102028
102348
|
}
|
|
102029
102349
|
const entries = [...this.pool.values()].filter((e) => !opts.cloudOnly || isCloudSession(e.manager));
|
|
102030
102350
|
this.pool.clear();
|
|
102031
|
-
let
|
|
102351
|
+
let timer2;
|
|
102032
102352
|
await Promise.race([
|
|
102033
102353
|
Promise.allSettled(entries.map((e) => e.manager.stop())),
|
|
102034
102354
|
new Promise((resolve36) => {
|
|
102035
|
-
|
|
102036
|
-
|
|
102355
|
+
timer2 = setTimeout(resolve36, maxWaitMs);
|
|
102356
|
+
timer2.unref?.();
|
|
102037
102357
|
})
|
|
102038
102358
|
]);
|
|
102039
|
-
if (
|
|
102359
|
+
if (timer2) clearTimeout(timer2);
|
|
102040
102360
|
}
|
|
102041
102361
|
// ── Internals ───────────────────────────────────────────────────────────
|
|
102042
102362
|
buildAdapter(desired) {
|
|
@@ -102466,13 +102786,13 @@ var init_local_browser_adapter = __esm({
|
|
|
102466
102786
|
));
|
|
102467
102787
|
}
|
|
102468
102788
|
return new Promise((resolve36, reject) => {
|
|
102469
|
-
const
|
|
102789
|
+
const timer2 = setTimeout(() => {
|
|
102470
102790
|
unsubscribe();
|
|
102471
102791
|
reject(new Error(`Connector command "${command.type}" timed out after ${timeoutMs}ms.`));
|
|
102472
102792
|
}, timeoutMs);
|
|
102473
102793
|
const unsubscribe = this.transport.onResponse((response) => {
|
|
102474
102794
|
if (response.id !== command.id) return;
|
|
102475
|
-
clearTimeout(
|
|
102795
|
+
clearTimeout(timer2);
|
|
102476
102796
|
unsubscribe();
|
|
102477
102797
|
if (!response.success) {
|
|
102478
102798
|
const msg = response.error?.message || `Connector command "${command.type}" failed`;
|
|
@@ -102795,7 +103115,7 @@ var init_askpass_service = __esm({
|
|
|
102795
103115
|
const requestId = randomBytes12(12).toString("hex");
|
|
102796
103116
|
return new Promise((resolve36) => {
|
|
102797
103117
|
const closeDialog = () => this.broadcast(ctx.clientId, ctx.userId, { type: "askpass-closed", requestId });
|
|
102798
|
-
const
|
|
103118
|
+
const timer2 = setTimeout(() => {
|
|
102799
103119
|
ctx.pending.delete(requestId);
|
|
102800
103120
|
closeDialog();
|
|
102801
103121
|
resolve36({ cancelled: true });
|
|
@@ -102804,17 +103124,17 @@ var init_askpass_service = __esm({
|
|
|
102804
103124
|
requestId,
|
|
102805
103125
|
prompt,
|
|
102806
103126
|
resolve: (value) => {
|
|
102807
|
-
clearTimeout(
|
|
103127
|
+
clearTimeout(timer2);
|
|
102808
103128
|
ctx.pending.delete(requestId);
|
|
102809
103129
|
resolve36({ value, cancelled: false });
|
|
102810
103130
|
},
|
|
102811
103131
|
cancel: () => {
|
|
102812
|
-
clearTimeout(
|
|
103132
|
+
clearTimeout(timer2);
|
|
102813
103133
|
ctx.pending.delete(requestId);
|
|
102814
103134
|
closeDialog();
|
|
102815
103135
|
resolve36({ cancelled: true });
|
|
102816
103136
|
},
|
|
102817
|
-
timer
|
|
103137
|
+
timer: timer2
|
|
102818
103138
|
});
|
|
102819
103139
|
this.broadcast(ctx.clientId, ctx.userId, {
|
|
102820
103140
|
type: "askpass-request",
|
|
@@ -106703,9 +107023,9 @@ var init_test_management_store = __esm({
|
|
|
106703
107023
|
* again. Returns what changed and how many cases were flagged.
|
|
106704
107024
|
*/
|
|
106705
107025
|
applySourceChange(sourceId, oldContent) {
|
|
106706
|
-
const
|
|
106707
|
-
if (!
|
|
106708
|
-
const newContent =
|
|
107026
|
+
const source2 = this.getSource(sourceId);
|
|
107027
|
+
if (!source2) return { changes: [], flagged: 0 };
|
|
107028
|
+
const newContent = source2.content ?? "";
|
|
106709
107029
|
if ((oldContent ?? "") === newContent) return { changes: [], flagged: 0 };
|
|
106710
107030
|
const reqs = this.listSourceRequirements(sourceId);
|
|
106711
107031
|
const changes = changedRequirements(reqs.filter((r) => r.status !== "deprecated"), oldContent ?? "", newContent);
|
|
@@ -106719,7 +107039,7 @@ var init_test_management_store = __esm({
|
|
|
106719
107039
|
const caseIds = this.db.prepare(
|
|
106720
107040
|
"SELECT test_case_id AS id FROM tm_requirement_test_cases WHERE requirement_id = ?"
|
|
106721
107041
|
).all(c2.requirementId);
|
|
106722
|
-
const note2 = staleNote(
|
|
107042
|
+
const note2 = staleNote(source2.title, c2);
|
|
106723
107043
|
for (const { id } of caseIds) {
|
|
106724
107044
|
const r = this.db.prepare(`
|
|
106725
107045
|
UPDATE tm_test_cases SET stale_reason = ?, stale_at = ?,
|
|
@@ -108629,8 +108949,8 @@ Execution Notes: ${exec2.comments}` : "");
|
|
|
108629
108949
|
repairSourceText(id, content, metadata) {
|
|
108630
108950
|
if (content !== void 0) {
|
|
108631
108951
|
this.db.prepare("UPDATE tm_sources SET content = ?, metadata = ? WHERE id = ?").run(content.trim(), metadata, id);
|
|
108632
|
-
const
|
|
108633
|
-
if (
|
|
108952
|
+
const source2 = this.getSource(id);
|
|
108953
|
+
if (source2 && source2.type === "requirement") this.syncSourceToRequirement(id, source2.title, source2.content, "medium");
|
|
108634
108954
|
} else {
|
|
108635
108955
|
this.db.prepare("UPDATE tm_sources SET metadata = ? WHERE id = ?").run(metadata, id);
|
|
108636
108956
|
}
|
|
@@ -108680,9 +109000,9 @@ Execution Notes: ${exec2.comments}` : "");
|
|
|
108680
109000
|
vals.push(id);
|
|
108681
109001
|
const result = this.db.prepare(`UPDATE tm_sources SET ${sets.join(", ")} WHERE id = ?`).run(...vals);
|
|
108682
109002
|
if (result.changes > 0 && (data.title !== void 0 || data.content !== void 0)) {
|
|
108683
|
-
const
|
|
108684
|
-
if (
|
|
108685
|
-
this.syncSourceToRequirement(id,
|
|
109003
|
+
const source2 = this.getSource(id);
|
|
109004
|
+
if (source2 && source2.type === "requirement") {
|
|
109005
|
+
this.syncSourceToRequirement(id, source2.title, source2.content, "medium");
|
|
108686
109006
|
}
|
|
108687
109007
|
}
|
|
108688
109008
|
return result.changes > 0;
|
|
@@ -111338,7 +111658,7 @@ ${configExcerpt}` : ""
|
|
|
111338
111658
|
const proc = spawn10(commandProbe2(command, projectPath2), [], { cwd: projectPath2, stdio: ["ignore", "pipe", "pipe"], shell: true });
|
|
111339
111659
|
let output = "";
|
|
111340
111660
|
let timedOut = false;
|
|
111341
|
-
const
|
|
111661
|
+
const timer2 = setTimeout(() => {
|
|
111342
111662
|
timedOut = true;
|
|
111343
111663
|
proc.kill();
|
|
111344
111664
|
}, 2e4);
|
|
@@ -111352,7 +111672,7 @@ ${configExcerpt}` : ""
|
|
|
111352
111672
|
const answer = (body) => {
|
|
111353
111673
|
if (answered) return;
|
|
111354
111674
|
answered = true;
|
|
111355
|
-
clearTimeout(
|
|
111675
|
+
clearTimeout(timer2);
|
|
111356
111676
|
res.json(body);
|
|
111357
111677
|
};
|
|
111358
111678
|
proc.on("close", (code2) => answer(judgeCommandCheck2(code2, output, timedOut)));
|
|
@@ -111544,10 +111864,10 @@ __export(chat_sources_exports, {
|
|
|
111544
111864
|
parseSourceIds: () => parseSourceIds,
|
|
111545
111865
|
resolveSourceText: () => resolveSourceText
|
|
111546
111866
|
});
|
|
111547
|
-
function jiraKeyOf(
|
|
111548
|
-
const fromUrl = /\/browse\/([A-Z][A-Z0-9_]*-\d+)/i.exec(
|
|
111867
|
+
function jiraKeyOf(source2) {
|
|
111868
|
+
const fromUrl = /\/browse\/([A-Z][A-Z0-9_]*-\d+)/i.exec(source2.externalUrl || "");
|
|
111549
111869
|
if (fromUrl?.[1]) return fromUrl[1].toUpperCase();
|
|
111550
|
-
const fromTitle = /^([A-Z][A-Z0-9_]*-\d+)\b/i.exec(
|
|
111870
|
+
const fromTitle = /^([A-Z][A-Z0-9_]*-\d+)\b/i.exec(source2.title || "");
|
|
111551
111871
|
return fromTitle?.[1] ? fromTitle[1].toUpperCase() : null;
|
|
111552
111872
|
}
|
|
111553
111873
|
function extractHeadings(text3, max = MAX_HEADINGS) {
|
|
@@ -111571,9 +111891,9 @@ function extractHeadings(text3, max = MAX_HEADINGS) {
|
|
|
111571
111891
|
}
|
|
111572
111892
|
return out;
|
|
111573
111893
|
}
|
|
111574
|
-
async function resolveSourceText(
|
|
111894
|
+
async function resolveSourceText(source2, projectPath2) {
|
|
111575
111895
|
const { getSourceText: getSourceText2 } = await Promise.resolve().then(() => (init_knowledge_retrieval(), knowledge_retrieval_exports));
|
|
111576
|
-
return getSourceText2(
|
|
111896
|
+
return getSourceText2(source2, projectPath2);
|
|
111577
111897
|
}
|
|
111578
111898
|
async function buildAttachedSourcesBlock(sources, projectPath2, mode) {
|
|
111579
111899
|
if (sources.length === 0) return { block: "", attached: [] };
|
|
@@ -114245,6 +114565,7 @@ Read-only file tools (\`read_file\`, \`grep\`, \`list_directory\`, \`glob_search
|
|
|
114245
114565
|
|
|
114246
114566
|
## Report Composition
|
|
114247
114567
|
- **Interactive dashboard (preferred in chat):** \`generate_dashboard\` renders a ReportCard inline. Use a 12-column grid \u2014 e.g. 4 KPIs (span 3) on row 1, 2 charts (span 6) on row 2, a full-width table (span 12) on row 3. The card's Download menu gives the user that same dashboard as PDF, Word or Excel \u2014 offer it when they want "a PDF of this" rather than building a different report.
|
|
114568
|
+
- **Answer first:** every dashboard gets a \`summary\` \u2014 a one-sentence verdict with a status (good / warn / bad) and 3\u20135 findings, most important first \u2014 so readers see the conclusion before the numbers. Keep \`subtitle\` to the data window ("Last 24 hours \xB7 12 runs on main") and put the source, window, exclusions and definitions in \`method\`. Give KPIs a \`status\` when there is a target and a \`trend\` when the tools return a series; give charts of runs their \`runIds\` and tables their \`columnLinks\`, so readers can click through to Results and Test Explorer. When the window has no data, say so in the verdict instead of showing tiles of zeros.
|
|
114248
114569
|
- **Persist/recall:** \`save_report({ dashboardId })\` with the id generate_dashboard returned (saving again updates it), \`list_reports\`, \`get_report({ id })\` (shows the card). Share links are buttons on the card.
|
|
114249
114570
|
- **Recurring email:** \`schedule_report\` (list / create / update / delete) emails a SAVED report on a cron schedule, refreshed with current data each time. Confirm the report, recipients, cadence and format with the user before creating it.
|
|
114250
114571
|
- **Finished document:** \`build_report\` orchestrates analytics + charts + composition into a PDF/DOCX/XLSX. Templates: \`executive\`, \`qa_daily\`, \`release\`, \`trend_analysis\`.
|
|
@@ -115374,8 +115695,11 @@ function mountResultsRoutes(app, resultsStore4, artifactFetcher, projectRoot = p
|
|
|
115374
115695
|
const offset = parseInt(req.query.offset) || 0;
|
|
115375
115696
|
const status = typeof req.query.status === "string" ? req.query.status : void 0;
|
|
115376
115697
|
const sourceRaw = typeof req.query.source === "string" ? req.query.source : void 0;
|
|
115377
|
-
const
|
|
115378
|
-
const { runs:
|
|
115698
|
+
const source2 = sourceRaw === "cloud" || sourceRaw === "local" ? sourceRaw : void 0;
|
|
115699
|
+
const { runs: stored, total: storedTotal } = resultsStore4.getRunHistory(limit, offset, { status, source: source2 });
|
|
115700
|
+
const live = offset === 0 && (!status || status === "all" || status === "running") ? listLiveRuns().filter((r) => !source2 || source2 === "cloud" === ranOnCloud(r)) : [];
|
|
115701
|
+
const runs3 = [...live, ...stored];
|
|
115702
|
+
const total = storedTotal + live.length;
|
|
115379
115703
|
const summary2 = runs3.map((r) => ({
|
|
115380
115704
|
runId: r.runId,
|
|
115381
115705
|
framework: r.framework,
|
|
@@ -115420,7 +115744,7 @@ function mountResultsRoutes(app, resultsStore4, artifactFetcher, projectRoot = p
|
|
|
115420
115744
|
const { runs: allRuns } = resultsStore4.getRunHistory(Number.MAX_SAFE_INTEGER, 0);
|
|
115421
115745
|
const scoped = sourceFilter ? allRuns.filter((r) => sourceFilter === "cloud" === ranOnCloud(r)) : allRuns;
|
|
115422
115746
|
const status = { all: scoped.length, completed: 0, failed: 0, running: 0, cancelled: 0 };
|
|
115423
|
-
const
|
|
115747
|
+
const source2 = { all: allRuns.length, local: 0, cloud: 0 };
|
|
115424
115748
|
let totalPassRate = 0;
|
|
115425
115749
|
let passRateCount = 0;
|
|
115426
115750
|
let totalDuration = 0;
|
|
@@ -115439,12 +115763,22 @@ function mountResultsRoutes(app, resultsStore4, artifactFetcher, projectRoot = p
|
|
|
115439
115763
|
}
|
|
115440
115764
|
}
|
|
115441
115765
|
for (const r of allRuns) {
|
|
115442
|
-
if (ranOnCloud(r))
|
|
115443
|
-
else
|
|
115766
|
+
if (ranOnCloud(r)) source2.cloud++;
|
|
115767
|
+
else source2.local++;
|
|
115768
|
+
}
|
|
115769
|
+
for (const r of listLiveRuns()) {
|
|
115770
|
+
const cloud = ranOnCloud(r);
|
|
115771
|
+
source2.all++;
|
|
115772
|
+
if (cloud) source2.cloud++;
|
|
115773
|
+
else source2.local++;
|
|
115774
|
+
if (!sourceFilter || sourceFilter === "cloud" === cloud) {
|
|
115775
|
+
status.all++;
|
|
115776
|
+
status.running = (status.running ?? 0) + 1;
|
|
115777
|
+
}
|
|
115444
115778
|
}
|
|
115445
115779
|
res.json({
|
|
115446
115780
|
status,
|
|
115447
|
-
source,
|
|
115781
|
+
source: source2,
|
|
115448
115782
|
// Aggregates surface in the Results page's stats strip so the
|
|
115449
115783
|
// pills (Total Runs / Avg Pass Rate / Failed / Avg Duration)
|
|
115450
115784
|
// reflect the WHOLE history, not just the current page.
|
|
@@ -115461,6 +115795,11 @@ function mountResultsRoutes(app, resultsStore4, artifactFetcher, projectRoot = p
|
|
|
115461
115795
|
app.get("/api/results/runs/:id", (req, res) => {
|
|
115462
115796
|
const run2 = resultsStore4.getRun(req.params.id);
|
|
115463
115797
|
if (!run2) {
|
|
115798
|
+
const live = getLiveRun(req.params.id);
|
|
115799
|
+
if (live) {
|
|
115800
|
+
res.json(live);
|
|
115801
|
+
return;
|
|
115802
|
+
}
|
|
115464
115803
|
res.status(404).json({ error: "Run not found" });
|
|
115465
115804
|
return;
|
|
115466
115805
|
}
|
|
@@ -115633,8 +115972,8 @@ function mountResultsRoutes(app, resultsStore4, artifactFetcher, projectRoot = p
|
|
|
115633
115972
|
const content = readFileSync102(fullPath, "utf-8");
|
|
115634
115973
|
const allLines = content.split("\n");
|
|
115635
115974
|
const endLine = Math.min(matchedTest.endLine || matchedTest.line + 50, allLines.length);
|
|
115636
|
-
const
|
|
115637
|
-
const steps2 = generateHumanSteps2(
|
|
115975
|
+
const source2 = allLines.slice(matchedTest.line - 1, endLine).join("\n");
|
|
115976
|
+
const steps2 = generateHumanSteps2(source2, matchedTest.framework, matchedTest.line);
|
|
115638
115977
|
if (steps2.length > 0) {
|
|
115639
115978
|
humanStepsMap.set(t.name, steps2);
|
|
115640
115979
|
}
|
|
@@ -115998,6 +116337,7 @@ var init_api_results = __esm({
|
|
|
115998
116337
|
init_test_results_store();
|
|
115999
116338
|
init_export_service();
|
|
116000
116339
|
init_cloud_secrets();
|
|
116340
|
+
init_live_runs();
|
|
116001
116341
|
}
|
|
116002
116342
|
});
|
|
116003
116343
|
|
|
@@ -116250,7 +116590,7 @@ function resolveStepDefinition(projectPath2, stepText2, _stepKeyword) {
|
|
|
116250
116590
|
const lines = content.split("\n");
|
|
116251
116591
|
for (const def of definitions) {
|
|
116252
116592
|
if (matchStep2(normalizedStep, def.pattern)) {
|
|
116253
|
-
const { source, endLine } = extractFunctionSource(lines, def.line - 1, ext);
|
|
116593
|
+
const { source: source2, endLine } = extractFunctionSource(lines, def.line - 1, ext);
|
|
116254
116594
|
return {
|
|
116255
116595
|
file,
|
|
116256
116596
|
line: def.line,
|
|
@@ -116258,7 +116598,7 @@ function resolveStepDefinition(projectPath2, stepText2, _stepKeyword) {
|
|
|
116258
116598
|
pattern: def.pattern,
|
|
116259
116599
|
keyword: def.keyword,
|
|
116260
116600
|
method: def.method,
|
|
116261
|
-
source,
|
|
116601
|
+
source: source2,
|
|
116262
116602
|
language: EXT_LANGUAGE_MAP[ext] || "plaintext"
|
|
116263
116603
|
};
|
|
116264
116604
|
}
|
|
@@ -116293,7 +116633,7 @@ function resolveStepDefinitions(projectPath2, steps2) {
|
|
|
116293
116633
|
let found = false;
|
|
116294
116634
|
for (const def of defs) {
|
|
116295
116635
|
if (matchStep2(normalizedStep, def.pattern)) {
|
|
116296
|
-
const { source, endLine } = extractFunctionSource(lines, def.line - 1, ext);
|
|
116636
|
+
const { source: source2, endLine } = extractFunctionSource(lines, def.line - 1, ext);
|
|
116297
116637
|
results.set(key2, {
|
|
116298
116638
|
file,
|
|
116299
116639
|
line: def.line,
|
|
@@ -116301,7 +116641,7 @@ function resolveStepDefinitions(projectPath2, steps2) {
|
|
|
116301
116641
|
pattern: def.pattern,
|
|
116302
116642
|
keyword: def.keyword,
|
|
116303
116643
|
method: def.method,
|
|
116304
|
-
source,
|
|
116644
|
+
source: source2,
|
|
116305
116645
|
language: EXT_LANGUAGE_MAP[ext] || "plaintext"
|
|
116306
116646
|
});
|
|
116307
116647
|
found = true;
|
|
@@ -116611,15 +116951,15 @@ function mountExplorerRoutes(app, _scanner, options, resultsStore4) {
|
|
|
116611
116951
|
const allLines = content.split("\n");
|
|
116612
116952
|
const actualEnd = Math.min(endLine, allLines.length);
|
|
116613
116953
|
const slicedLines = allLines.slice(startLine - 1, actualEnd);
|
|
116614
|
-
const
|
|
116954
|
+
const source2 = slicedLines.join("\n");
|
|
116615
116955
|
const language = detectLanguage(fullPath) || "plaintext";
|
|
116616
|
-
const humanSteps = framework ? generateHumanSteps(
|
|
116956
|
+
const humanSteps = framework ? generateHumanSteps(source2, framework, startLine) : [];
|
|
116617
116957
|
res.json({
|
|
116618
116958
|
file,
|
|
116619
116959
|
startLine,
|
|
116620
116960
|
endLine: actualEnd,
|
|
116621
116961
|
language,
|
|
116622
|
-
source,
|
|
116962
|
+
source: source2,
|
|
116623
116963
|
humanSteps
|
|
116624
116964
|
});
|
|
116625
116965
|
} catch (error) {
|
|
@@ -119384,9 +119724,9 @@ async function bindPage(page, name2, handler) {
|
|
|
119384
119724
|
}
|
|
119385
119725
|
if (bound.has(name2)) return true;
|
|
119386
119726
|
try {
|
|
119387
|
-
await page.exposeBinding(name2, (
|
|
119727
|
+
await page.exposeBinding(name2, (source2, ...args2) => {
|
|
119388
119728
|
const h = bindingHandlers.get(page)?.get(name2);
|
|
119389
|
-
return h ? h(
|
|
119729
|
+
return h ? h(source2, ...args2) : void 0;
|
|
119390
119730
|
});
|
|
119391
119731
|
bound.add(name2);
|
|
119392
119732
|
return true;
|
|
@@ -123338,14 +123678,14 @@ var init_recorder = __esm({
|
|
|
123338
123678
|
* token (the page under test calling the binding itself), answers the
|
|
123339
123679
|
* scripts' "is recording on?" question, and turns the rest into steps.
|
|
123340
123680
|
*/
|
|
123341
|
-
recordBinding = (
|
|
123681
|
+
recordBinding = (source2, jsonStr) => {
|
|
123342
123682
|
let data;
|
|
123343
123683
|
try {
|
|
123344
123684
|
data = JSON.parse(jsonStr);
|
|
123345
123685
|
} catch {
|
|
123346
123686
|
return void 0;
|
|
123347
123687
|
}
|
|
123348
|
-
const page =
|
|
123688
|
+
const page = source2?.page;
|
|
123349
123689
|
if (!page || !data || typeof data !== "object" || data.__tvToken !== pageTokens.get(page)) {
|
|
123350
123690
|
logger34.debug("Ignored a recorder event without a valid token (not sent by Testver's scripts)");
|
|
123351
123691
|
return void 0;
|
|
@@ -123356,7 +123696,7 @@ var init_recorder = __esm({
|
|
|
123356
123696
|
const action = this.buildAction(data);
|
|
123357
123697
|
if (!action) return void 0;
|
|
123358
123698
|
action.tabIndex = this.tabIndexOf(page);
|
|
123359
|
-
this.applyFrameInfo(action,
|
|
123699
|
+
this.applyFrameInfo(action, source2.frame, page, data.frameName);
|
|
123360
123700
|
this.addAction(action);
|
|
123361
123701
|
} catch (err5) {
|
|
123362
123702
|
logger34.debug(`Failed to record action: ${err5}`);
|
|
@@ -132868,9 +133208,9 @@ function mountCodeMapRoutes(app, options) {
|
|
|
132868
133208
|
const m = await map();
|
|
132869
133209
|
const s = m.symbols.find((x) => x.id === id);
|
|
132870
133210
|
if (!s) return null;
|
|
132871
|
-
const
|
|
133211
|
+
const source2 = readRange(projectPath2, s.file, s.startLine, s.endLine);
|
|
132872
133212
|
const framework = m.tests.find((t) => t.framework)?.framework || s.language;
|
|
132873
|
-
return { m, s, source, framework };
|
|
133213
|
+
return { m, s, source: source2, framework };
|
|
132874
133214
|
}
|
|
132875
133215
|
app.post("/api/codemap/ai/explain", async (req, res) => {
|
|
132876
133216
|
try {
|
|
@@ -133195,14 +133535,14 @@ function mountDataMapRoutes(app, options) {
|
|
|
133195
133535
|
try {
|
|
133196
133536
|
const id = String(req.query.id || "");
|
|
133197
133537
|
const m = await map();
|
|
133198
|
-
const
|
|
133199
|
-
if (!
|
|
133538
|
+
const source2 = m.sources.find((s) => s.id === id);
|
|
133539
|
+
if (!source2) {
|
|
133200
133540
|
res.status(404).json({ error: "Source not found" });
|
|
133201
133541
|
return;
|
|
133202
133542
|
}
|
|
133203
133543
|
const testIds = new Set(m.sourceToTests[id] || []);
|
|
133204
133544
|
const tests = m.tests.filter((t) => testIds.has(t.id));
|
|
133205
|
-
res.json({ source, tests });
|
|
133545
|
+
res.json({ source: source2, tests });
|
|
133206
133546
|
} catch (error) {
|
|
133207
133547
|
res.status(500).json({ error: String(error) });
|
|
133208
133548
|
}
|
|
@@ -133217,25 +133557,25 @@ function mountDataMapRoutes(app, options) {
|
|
|
133217
133557
|
return;
|
|
133218
133558
|
}
|
|
133219
133559
|
const m = await map();
|
|
133220
|
-
const
|
|
133221
|
-
if (!
|
|
133560
|
+
const source2 = m.sources.find((s) => s.id === id);
|
|
133561
|
+
if (!source2) {
|
|
133222
133562
|
res.status(404).json({ error: "Source not found" });
|
|
133223
133563
|
return;
|
|
133224
133564
|
}
|
|
133225
133565
|
const testIds = new Set(m.sourceToTests[id] || []);
|
|
133226
133566
|
const tests = m.tests.filter((t) => testIds.has(t.id));
|
|
133227
133567
|
let preview = null;
|
|
133228
|
-
if ((
|
|
133568
|
+
if ((source2.kind === "file" || source2.kind === "fixture") && source2.format) {
|
|
133229
133569
|
const { previewDataSource: previewDataSource2, annotateFieldUsage: annotateFieldUsage2 } = await Promise.resolve().then(() => (init_preview(), preview_exports));
|
|
133230
|
-
preview = await previewDataSource2(projectPath2,
|
|
133570
|
+
preview = await previewDataSource2(projectPath2, source2.file, source2.format);
|
|
133231
133571
|
if (preview) await annotateFieldUsage2(projectPath2, preview, tests);
|
|
133232
133572
|
if (preview && !reveal) {
|
|
133233
133573
|
const { maskPreview: maskPreview2 } = await Promise.resolve().then(() => (init_mask(), mask_exports));
|
|
133234
133574
|
preview = maskPreview2(preview);
|
|
133235
133575
|
}
|
|
133236
133576
|
}
|
|
133237
|
-
if (reveal) audit(req, "data.secret_reveal", { resourceType: "test-data", resourceId:
|
|
133238
|
-
res.json({ source, tests, preview });
|
|
133577
|
+
if (reveal) audit(req, "data.secret_reveal", { resourceType: "test-data", resourceId: source2.file });
|
|
133578
|
+
res.json({ source: source2, tests, preview });
|
|
133239
133579
|
} catch (error) {
|
|
133240
133580
|
res.status(500).json({ error: String(error) });
|
|
133241
133581
|
}
|
|
@@ -133987,7 +134327,7 @@ function runOnce(adb, args2, timeoutMs = 6e3) {
|
|
|
133987
134327
|
} catch {
|
|
133988
134328
|
return resolve36("");
|
|
133989
134329
|
}
|
|
133990
|
-
const
|
|
134330
|
+
const timer2 = setTimeout(() => {
|
|
133991
134331
|
if (!done2) {
|
|
133992
134332
|
done2 = true;
|
|
133993
134333
|
try {
|
|
@@ -134003,14 +134343,14 @@ function runOnce(adb, args2, timeoutMs = 6e3) {
|
|
|
134003
134343
|
child2.on("error", () => {
|
|
134004
134344
|
if (!done2) {
|
|
134005
134345
|
done2 = true;
|
|
134006
|
-
clearTimeout(
|
|
134346
|
+
clearTimeout(timer2);
|
|
134007
134347
|
resolve36(out);
|
|
134008
134348
|
}
|
|
134009
134349
|
});
|
|
134010
134350
|
child2.on("close", () => {
|
|
134011
134351
|
if (!done2) {
|
|
134012
134352
|
done2 = true;
|
|
134013
|
-
clearTimeout(
|
|
134353
|
+
clearTimeout(timer2);
|
|
134014
134354
|
resolve36(out);
|
|
134015
134355
|
}
|
|
134016
134356
|
});
|
|
@@ -134824,30 +135164,30 @@ return { locator: loc, tag: tag, text: text };
|
|
|
134824
135164
|
const info = adapter.getSessionInfo();
|
|
134825
135165
|
this.sessionSnapshot = info;
|
|
134826
135166
|
const platform4 = info.platform;
|
|
134827
|
-
let
|
|
135167
|
+
let source2 = null;
|
|
134828
135168
|
const cache9 = this.cachedSource;
|
|
134829
135169
|
if (cache9 && Date.now() - cache9.at < _MobileRecorder.SOURCE_CACHE_TTL_MS) {
|
|
134830
|
-
|
|
135170
|
+
source2 = cache9.xml;
|
|
134831
135171
|
} else {
|
|
134832
135172
|
try {
|
|
134833
|
-
|
|
135173
|
+
source2 = await adapter.getPageSource();
|
|
134834
135174
|
} catch (err5) {
|
|
134835
135175
|
logger38.debug(`getPageSource pre-tap failed: ${err5.message}`);
|
|
134836
135176
|
}
|
|
134837
135177
|
}
|
|
134838
135178
|
this.cachedSource = null;
|
|
134839
135179
|
let locators = null;
|
|
134840
|
-
const hit =
|
|
135180
|
+
const hit = source2 ? findTapTargetAt(source2, x, y, platform4) : null;
|
|
134841
135181
|
const node = hit?.target ?? null;
|
|
134842
|
-
if (node &&
|
|
134843
|
-
locators = generateLocators(node,
|
|
135182
|
+
if (node && source2) {
|
|
135183
|
+
locators = generateLocators(node, source2, platform4);
|
|
134844
135184
|
if (hit && hit.inner !== hit.target && !locators.label.startsWith('"')) {
|
|
134845
|
-
const innerLabel = generateLocators(hit.inner,
|
|
135185
|
+
const innerLabel = generateLocators(hit.inner, source2, platform4).label;
|
|
134846
135186
|
if (innerLabel.startsWith('"')) locators = { ...locators, label: innerLabel };
|
|
134847
135187
|
}
|
|
134848
135188
|
}
|
|
134849
|
-
const axContext = node &&
|
|
134850
|
-
const webviewNode =
|
|
135189
|
+
const axContext = node && source2 ? getAccessibilityContext(source2, node, 2) : null;
|
|
135190
|
+
const webviewNode = source2 ? findWebviewAt(source2, x, y) : null;
|
|
134851
135191
|
let webCapture = null;
|
|
134852
135192
|
if (webviewNode?.bounds) {
|
|
134853
135193
|
webCapture = await this.captureWebviewLocator(adapter, webviewNode.bounds, x, y, webviewNode.attrs?.package);
|
|
@@ -137344,11 +137684,11 @@ async function captureAxContextForLocator(manager, locator) {
|
|
|
137344
137684
|
try {
|
|
137345
137685
|
const adapter = manager.getAdapter();
|
|
137346
137686
|
if (!adapter || !adapter.isActive()) return null;
|
|
137347
|
-
const
|
|
137348
|
-
const all = listAllElements(
|
|
137687
|
+
const source2 = await adapter.getPageSource();
|
|
137688
|
+
const all = listAllElements(source2);
|
|
137349
137689
|
const target2 = findNodeMatchingLocator(all, locator);
|
|
137350
137690
|
if (!target2) return null;
|
|
137351
|
-
return getAccessibilityContext(
|
|
137691
|
+
return getAccessibilityContext(source2, target2, 2);
|
|
137352
137692
|
} catch {
|
|
137353
137693
|
return null;
|
|
137354
137694
|
}
|
|
@@ -138219,8 +138559,8 @@ function mountMobileRoutes(app, options, wss) {
|
|
|
138219
138559
|
if (!adapter || !adapter.isActive()) return res.status(404).json({ error: "No active session." });
|
|
138220
138560
|
const platform4 = adapter.getSessionInfo().platform;
|
|
138221
138561
|
try {
|
|
138222
|
-
const
|
|
138223
|
-
const nodes = listAllElements(
|
|
138562
|
+
const source2 = await adapter.getPageSource();
|
|
138563
|
+
const nodes = listAllElements(source2).filter((n) => n.bounds && n.bounds.x2 > n.bounds.x1 && n.bounds.y2 > n.bounds.y1).map((n) => ({
|
|
138224
138564
|
tag: n.tag,
|
|
138225
138565
|
attrs: n.attrs,
|
|
138226
138566
|
bounds: n.bounds,
|
|
@@ -143180,16 +143520,16 @@ function mountWorkflowRoutes(app, wss, orchestrator, mcpClientManager, _schedule
|
|
|
143180
143520
|
app.post("/api/workflows/:id/duplicate", (req, res) => {
|
|
143181
143521
|
try {
|
|
143182
143522
|
const sourceId = req.params.id;
|
|
143183
|
-
const
|
|
143184
|
-
if (!
|
|
143523
|
+
const source2 = workflowStore.get(sourceId);
|
|
143524
|
+
if (!source2) return res.status(404).json({ error: "Workflow not found" });
|
|
143185
143525
|
const { id: newId } = req.body;
|
|
143186
143526
|
let targetId = newId || `${sourceId}-copy`;
|
|
143187
143527
|
let suffix = 2;
|
|
143188
143528
|
while (workflowStore.exists(targetId)) {
|
|
143189
143529
|
targetId = `${sourceId}-copy-${suffix++}`;
|
|
143190
143530
|
}
|
|
143191
|
-
const { definition, warnings } = parseWorkflow(
|
|
143192
|
-
const workflow = workflowStore.save(targetId, definition,
|
|
143531
|
+
const { definition, warnings } = parseWorkflow(source2.yaml);
|
|
143532
|
+
const workflow = workflowStore.save(targetId, definition, source2.yaml);
|
|
143193
143533
|
res.status(201).json({ workflow, warnings });
|
|
143194
143534
|
} catch (err5) {
|
|
143195
143535
|
res.status(400).json({ error: String(err5 instanceof Error ? err5.message : err5) });
|
|
@@ -144525,8 +144865,8 @@ function mountTestManagementRoutes(app, tmStore5, projectPath2) {
|
|
|
144525
144865
|
res.status(400).json({ error: "sourceId is required" });
|
|
144526
144866
|
return;
|
|
144527
144867
|
}
|
|
144528
|
-
const
|
|
144529
|
-
if (!
|
|
144868
|
+
const source2 = tmStore5.getSource(sourceId);
|
|
144869
|
+
if (!source2) {
|
|
144530
144870
|
res.status(404).json({ error: "Source not found" });
|
|
144531
144871
|
return;
|
|
144532
144872
|
}
|
|
@@ -144540,12 +144880,12 @@ function mountTestManagementRoutes(app, tmStore5, projectPath2) {
|
|
|
144540
144880
|
res.status(400).json({ error: "No test cases generated from this source. Generate test cases first." });
|
|
144541
144881
|
return;
|
|
144542
144882
|
}
|
|
144543
|
-
const planName = `${
|
|
144883
|
+
const planName = `${source2.title} \u2014 Test Plan`;
|
|
144544
144884
|
const plan = tmStore5.createTestPlan({
|
|
144545
144885
|
name: planName,
|
|
144546
|
-
description: `Auto-created from source: ${
|
|
144547
|
-
Type: ${
|
|
144548
|
-
sprint:
|
|
144886
|
+
description: `Auto-created from source: ${source2.title}
|
|
144887
|
+
Type: ${source2.type}${source2.externalUrl ? "\nURL: " + source2.externalUrl : ""}`,
|
|
144888
|
+
sprint: source2.type === "jira" ? (source2.title.split(":")[0] || "").trim() : void 0,
|
|
144549
144889
|
status: "active",
|
|
144550
144890
|
createdBy: createdBy || "Testver"
|
|
144551
144891
|
});
|
|
@@ -144565,9 +144905,9 @@ Type: ${source.type}${source.externalUrl ? "\nURL: " + source.externalUrl : ""}`
|
|
|
144565
144905
|
cycle: cycle ? { id: cycle.id, name: cycle.name } : null,
|
|
144566
144906
|
testCaseCount: testCaseIds.length,
|
|
144567
144907
|
sourceId,
|
|
144568
|
-
sourceType:
|
|
144569
|
-
sourceTitle:
|
|
144570
|
-
externalUrl:
|
|
144908
|
+
sourceType: source2.type,
|
|
144909
|
+
sourceTitle: source2.title,
|
|
144910
|
+
externalUrl: source2.externalUrl
|
|
144571
144911
|
});
|
|
144572
144912
|
} catch (error) {
|
|
144573
144913
|
res.status(500).json({ error: String(error) });
|
|
@@ -145419,6 +145759,7 @@ Type: ${source.type}${source.externalUrl ? "\nURL: " + source.externalUrl : ""}`
|
|
|
145419
145759
|
deviceName: settings.deviceName || void 0
|
|
145420
145760
|
};
|
|
145421
145761
|
activeCycleRuns.set(aggRunId, state);
|
|
145762
|
+
runActivityChanged();
|
|
145422
145763
|
syncCycleAggregate(aggRunId);
|
|
145423
145764
|
res.json({ totalMapped: mapped.length, totalUnmapped: unmapped.length, status: "running", aggregateRunId: aggRunId });
|
|
145424
145765
|
(async () => {
|
|
@@ -145490,6 +145831,7 @@ Type: ${source.type}${source.externalUrl ? "\nURL: " + source.externalUrl : ""}`
|
|
|
145490
145831
|
teardownRow.message = "Cancelled";
|
|
145491
145832
|
}
|
|
145492
145833
|
state.finishedAt = Date.now();
|
|
145834
|
+
runActivityChanged();
|
|
145493
145835
|
syncCycleAggregate(aggRunId);
|
|
145494
145836
|
{
|
|
145495
145837
|
const agg = buildCycleAggregate(aggRunId, state);
|
|
@@ -145511,7 +145853,13 @@ Type: ${source.type}${source.externalUrl ? "\nURL: " + source.externalUrl : ""}`
|
|
|
145511
145853
|
setTimeout(() => syncCycleAggregate(aggRunId), 2500);
|
|
145512
145854
|
setTimeout(() => syncCycleAggregate(aggRunId), 7e3);
|
|
145513
145855
|
setTimeout(() => activeCycleRuns.delete(aggRunId), 3e4);
|
|
145514
|
-
})().catch((err5) =>
|
|
145856
|
+
})().catch((err5) => {
|
|
145857
|
+
console.error("[automation] Run all batch error:", err5);
|
|
145858
|
+
if (!state.finishedAt) {
|
|
145859
|
+
state.finishedAt = Date.now();
|
|
145860
|
+
runActivityChanged();
|
|
145861
|
+
}
|
|
145862
|
+
});
|
|
145515
145863
|
} catch (error) {
|
|
145516
145864
|
res.status(500).json({ error: String(error) });
|
|
145517
145865
|
}
|
|
@@ -145531,7 +145879,7 @@ Type: ${source.type}${source.externalUrl ? "\nURL: " + source.externalUrl : ""}`
|
|
|
145531
145879
|
id: req.params.runId,
|
|
145532
145880
|
target: "local",
|
|
145533
145881
|
concurrency: 1,
|
|
145534
|
-
results: state.results.map((r) => ({ file: r.file, name: r.name, framework: r.framework, status: r.status, runId: r.runId, durationMs: r.durationMs, message: r.message, isHook: r.isHook })),
|
|
145882
|
+
results: state.results.map((r) => ({ executionId: r.executionId, file: r.file, name: r.name, framework: r.framework, status: r.status, runId: r.runId, durationMs: r.durationMs, message: r.message, isHook: r.isHook })),
|
|
145535
145883
|
summary: { total: testRows.length, passed, failed, skipped: 0 }
|
|
145536
145884
|
}
|
|
145537
145885
|
});
|
|
@@ -145617,7 +145965,13 @@ var init_api_test_management = __esm({
|
|
|
145617
145965
|
init_cycle_run_settings_store();
|
|
145618
145966
|
init_internal_token();
|
|
145619
145967
|
init_vendor_file_guard();
|
|
145968
|
+
init_run_activity();
|
|
145620
145969
|
activeCycleRuns = /* @__PURE__ */ new Map();
|
|
145970
|
+
registerRunProbe("cycles", () => {
|
|
145971
|
+
let n = 0;
|
|
145972
|
+
for (const s of activeCycleRuns.values()) if (!s.finishedAt) n++;
|
|
145973
|
+
return n;
|
|
145974
|
+
});
|
|
145621
145975
|
automationRuns = /* @__PURE__ */ new Map();
|
|
145622
145976
|
}
|
|
145623
145977
|
});
|
|
@@ -145865,6 +146219,7 @@ function mountSuiteRoutes(app, projectPath2) {
|
|
|
145865
146219
|
async function runSuite(suite, options, origin = "manual", clientId, presetRunId) {
|
|
145866
146220
|
const ctrl = { cancel: false, activeRunIds: /* @__PURE__ */ new Set() };
|
|
145867
146221
|
activeSuiteRuns.set(suite.id, ctrl);
|
|
146222
|
+
runActivityChanged();
|
|
145868
146223
|
const target2 = options.target || suite.runDefaults?.target || "local";
|
|
145869
146224
|
let concurrency = Math.max(1, Math.min(options.concurrency ?? suite.runDefaults?.concurrency ?? 1, MAX_CONCURRENCY));
|
|
145870
146225
|
const fromDefaults = !options.target && target2 === "cloud" ? suite.runDefaults : void 0;
|
|
@@ -145997,6 +146352,7 @@ function mountSuiteRoutes(app, projectPath2) {
|
|
|
145997
146352
|
setTimeout(() => syncAggregate(suite.id, run2), 2500);
|
|
145998
146353
|
setTimeout(() => syncAggregate(suite.id, run2), 7e3);
|
|
145999
146354
|
activeSuiteRuns.delete(suite.id);
|
|
146355
|
+
runActivityChanged();
|
|
146000
146356
|
}
|
|
146001
146357
|
function startSuiteRun(suiteId, options, origin = "manual", clientId) {
|
|
146002
146358
|
const suite = store4().get(suiteId);
|
|
@@ -146005,7 +146361,11 @@ function mountSuiteRoutes(app, projectPath2) {
|
|
|
146005
146361
|
const tests = suite.tests;
|
|
146006
146362
|
if (tests.length === 0) return { ok: false, error: "Suite has no tests" };
|
|
146007
146363
|
const runId = generateId("srun");
|
|
146008
|
-
runSuite(suite, options, origin, clientId, runId).catch((err5) =>
|
|
146364
|
+
runSuite(suite, options, origin, clientId, runId).catch((err5) => {
|
|
146365
|
+
console.error("[suite] run error:", err5);
|
|
146366
|
+
activeSuiteRuns.delete(suiteId);
|
|
146367
|
+
runActivityChanged();
|
|
146368
|
+
});
|
|
146009
146369
|
return { ok: true, total: tests.length, runId };
|
|
146010
146370
|
}
|
|
146011
146371
|
function maybeNotify(suite, run2, origin, prevRun) {
|
|
@@ -146235,8 +146595,8 @@ function mountSuiteRoutes(app, projectPath2) {
|
|
|
146235
146595
|
}
|
|
146236
146596
|
}
|
|
146237
146597
|
};
|
|
146238
|
-
const
|
|
146239
|
-
|
|
146598
|
+
const timer2 = setInterval(tick, 6e4);
|
|
146599
|
+
timer2.unref?.();
|
|
146240
146600
|
}
|
|
146241
146601
|
var activeSuiteRuns, PER_TEST_TIMEOUT_MS, POLL_INTERVAL_MS2, MAX_CONCURRENCY, MAX_RETRIES;
|
|
146242
146602
|
var init_api_suites = __esm({
|
|
@@ -146248,7 +146608,9 @@ var init_api_suites = __esm({
|
|
|
146248
146608
|
init_public_url();
|
|
146249
146609
|
init_internal_token();
|
|
146250
146610
|
init_vendor_file_guard();
|
|
146611
|
+
init_run_activity();
|
|
146251
146612
|
activeSuiteRuns = /* @__PURE__ */ new Map();
|
|
146613
|
+
registerRunProbe("suites", () => activeSuiteRuns.size);
|
|
146252
146614
|
PER_TEST_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
146253
146615
|
POLL_INTERVAL_MS2 = 1e3;
|
|
146254
146616
|
MAX_CONCURRENCY = 8;
|
|
@@ -148717,14 +149079,14 @@ function sseSend(res, event, data) {
|
|
|
148717
149079
|
}
|
|
148718
149080
|
function withTimeout(promise, ms, label4) {
|
|
148719
149081
|
return new Promise((resolve36, reject) => {
|
|
148720
|
-
const
|
|
149082
|
+
const timer2 = setTimeout(() => reject(new Error(`TIMEOUT:${label4}`)), ms);
|
|
148721
149083
|
promise.then(
|
|
148722
149084
|
(v) => {
|
|
148723
|
-
clearTimeout(
|
|
149085
|
+
clearTimeout(timer2);
|
|
148724
149086
|
resolve36(v);
|
|
148725
149087
|
},
|
|
148726
149088
|
(e) => {
|
|
148727
|
-
clearTimeout(
|
|
149089
|
+
clearTimeout(timer2);
|
|
148728
149090
|
reject(e);
|
|
148729
149091
|
}
|
|
148730
149092
|
);
|
|
@@ -150706,12 +151068,12 @@ async function extractFileText(fileData, fileName, fileType) {
|
|
|
150706
151068
|
function mountTMCoverageRoutes(app, tmStore5, aiService, projectFramework) {
|
|
150707
151069
|
app.post("/api/tm/requirements", (req, res) => {
|
|
150708
151070
|
try {
|
|
150709
|
-
const { externalId, title, description, priority, source, status } = req.body;
|
|
151071
|
+
const { externalId, title, description, priority, source: source2, status } = req.body;
|
|
150710
151072
|
if (!title) {
|
|
150711
151073
|
res.status(400).json({ error: "title is required" });
|
|
150712
151074
|
return;
|
|
150713
151075
|
}
|
|
150714
|
-
const req_ = tmStore5.createRequirement({ externalId, title, description, priority, source, status });
|
|
151076
|
+
const req_ = tmStore5.createRequirement({ externalId, title, description, priority, source: source2, status });
|
|
150715
151077
|
res.status(201).json(req_);
|
|
150716
151078
|
} catch (error) {
|
|
150717
151079
|
res.status(500).json({ error: String(error) });
|
|
@@ -152054,8 +152416,8 @@ function mountTMSourceRoutes(app, tmStore5) {
|
|
|
152054
152416
|
res.status(400).json({ error: "title and type are required" });
|
|
152055
152417
|
return;
|
|
152056
152418
|
}
|
|
152057
|
-
const
|
|
152058
|
-
res.status(201).json(
|
|
152419
|
+
const source2 = tmStore5.createSource({ title, type, content, metadata, fileData, fileName, fileType, fileSize, externalUrl, status, createdBy });
|
|
152420
|
+
res.status(201).json(source2);
|
|
152059
152421
|
} catch (error) {
|
|
152060
152422
|
res.status(500).json({ error: String(error) });
|
|
152061
152423
|
}
|
|
@@ -152115,12 +152477,12 @@ function mountTMSourceRoutes(app, tmStore5) {
|
|
|
152115
152477
|
});
|
|
152116
152478
|
app.get("/api/tm/sources/:id", (req, res) => {
|
|
152117
152479
|
try {
|
|
152118
|
-
const
|
|
152119
|
-
if (!
|
|
152480
|
+
const source2 = tmStore5.getSource(req.params.id);
|
|
152481
|
+
if (!source2) {
|
|
152120
152482
|
res.status(404).json({ error: "Source not found" });
|
|
152121
152483
|
return;
|
|
152122
152484
|
}
|
|
152123
|
-
res.json(
|
|
152485
|
+
res.json(source2);
|
|
152124
152486
|
} catch (error) {
|
|
152125
152487
|
res.status(500).json({ error: String(error) });
|
|
152126
152488
|
}
|
|
@@ -152151,20 +152513,20 @@ function mountTMSourceRoutes(app, tmStore5) {
|
|
|
152151
152513
|
return;
|
|
152152
152514
|
}
|
|
152153
152515
|
const change = tmStore5.applySourceChange(req.params.id, before);
|
|
152154
|
-
const
|
|
152155
|
-
res.json({ ...
|
|
152516
|
+
const source2 = tmStore5.getSource(req.params.id);
|
|
152517
|
+
res.json({ ...source2, change: { changedRequirements: change.changes.length, flaggedCases: change.flagged } });
|
|
152156
152518
|
} catch (error) {
|
|
152157
152519
|
res.status(500).json({ error: String(error) });
|
|
152158
152520
|
}
|
|
152159
152521
|
});
|
|
152160
152522
|
app.post("/api/tm/sources/:id/refresh", async (req, res) => {
|
|
152161
152523
|
try {
|
|
152162
|
-
const
|
|
152163
|
-
if (!
|
|
152524
|
+
const source2 = tmStore5.getSource(req.params.id);
|
|
152525
|
+
if (!source2) {
|
|
152164
152526
|
res.status(404).json({ error: "Source not found" });
|
|
152165
152527
|
return;
|
|
152166
152528
|
}
|
|
152167
|
-
const key2 =
|
|
152529
|
+
const key2 = source2.type === "jira" ? jiraKeyOf(source2) : null;
|
|
152168
152530
|
if (!key2) {
|
|
152169
152531
|
res.status(400).json({ code: "NOT_JIRA", error: "Only Jira sources can be refreshed." });
|
|
152170
152532
|
return;
|
|
@@ -152178,14 +152540,14 @@ function mountTMSourceRoutes(app, tmStore5) {
|
|
|
152178
152540
|
const fields = issue?.fields ?? {};
|
|
152179
152541
|
const content = jiraIssueText(fields) || String(fields.summary ?? "");
|
|
152180
152542
|
const title = `${key2}: ${fields.summary || "Untitled"}`;
|
|
152181
|
-
const before =
|
|
152182
|
-
if (content.trim() === before.trim() && title ===
|
|
152183
|
-
res.json({ ...
|
|
152543
|
+
const before = source2.content ?? "";
|
|
152544
|
+
if (content.trim() === before.trim() && title === source2.title) {
|
|
152545
|
+
res.json({ ...source2, refreshed: false, change: { changedRequirements: 0, flaggedCases: 0 } });
|
|
152184
152546
|
return;
|
|
152185
152547
|
}
|
|
152186
|
-
tmStore5.updateSource(
|
|
152187
|
-
const change = tmStore5.applySourceChange(
|
|
152188
|
-
res.json({ ...tmStore5.getSource(
|
|
152548
|
+
tmStore5.updateSource(source2.id, { content, title });
|
|
152549
|
+
const change = tmStore5.applySourceChange(source2.id, before);
|
|
152550
|
+
res.json({ ...tmStore5.getSource(source2.id), refreshed: true, change: { changedRequirements: change.changes.length, flaggedCases: change.flagged } });
|
|
152189
152551
|
} catch (error) {
|
|
152190
152552
|
res.status(500).json({ error: error instanceof Error ? error.message : String(error) });
|
|
152191
152553
|
}
|
|
@@ -155018,6 +155380,16 @@ function emailDataTable(t, maxRows = 8) {
|
|
|
155018
155380
|
const more = t.rows.length > maxRows ? `<p style="margin:6px 0 0;font-family:${EMAIL_FONT};font-size:12px;color:${REPORT_THEME.faint};">\u2026and ${t.rows.length - maxRows} more row${t.rows.length - maxRows === 1 ? "" : "s"} in the attached report.</p>` : "";
|
|
155019
155381
|
return `<table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="border-collapse:separate;border-spacing:0;border:1px solid ${REPORT_THEME.border};border-radius:10px;overflow:hidden;"><tr>${th}</tr>${rows}${empty}</table>${more}${t.hint ? `<p style="margin:6px 0 0;font-family:${EMAIL_FONT};font-size:12px;color:${REPORT_THEME.muted};">${escapeHtml(t.hint)}</p>` : ""}`;
|
|
155020
155382
|
}
|
|
155383
|
+
function emailSummary(summary2) {
|
|
155384
|
+
const tone = (t) => t === "good" ? REPORT_THEME.pill.ok : t === "bad" ? REPORT_THEME.pill.bad : t === "warn" ? REPORT_THEME.pill.warn : REPORT_THEME.pill.neutral;
|
|
155385
|
+
const status = summary2.status ? `<span style="display:inline-block;padding:2px 9px;border-radius:999px;background:${tone(summary2.status).bg};color:${tone(summary2.status).fg};font-family:${EMAIL_FONT};font-size:11.5px;font-weight:600;">${escapeHtml(TONE_LABEL[summary2.status])}</span>` : "";
|
|
155386
|
+
const findings = (summary2.findings ?? []).map((f) => `<li style="margin:0 0 6px;"><strong style="color:${tone(f.tone).fg};">${escapeHtml(f.title)}</strong>${f.detail ? ` ${escapeHtml(f.detail)}` : ""}</li>`).join("");
|
|
155387
|
+
return `<div style="margin:0 0 16px;padding:14px 16px;background:${REPORT_THEME.card};border:1px solid ${REPORT_THEME.border};border-radius:10px;">
|
|
155388
|
+
${status}
|
|
155389
|
+
${summary2.verdict ? `<p style="margin:${status ? "8px" : "0"} 0 0;font-family:${EMAIL_FONT};font-size:16px;line-height:1.4;font-weight:700;color:${REPORT_THEME.heading};">${escapeHtml(summary2.verdict)}</p>` : ""}
|
|
155390
|
+
${findings ? `<ul style="margin:10px 0 0;padding-left:20px;font-family:${EMAIL_FONT};font-size:13.5px;line-height:1.55;color:${REPORT_THEME.text};">${findings}</ul>` : ""}
|
|
155391
|
+
</div>`;
|
|
155392
|
+
}
|
|
155021
155393
|
function emailNarrative(content) {
|
|
155022
155394
|
const inline = (s) => inlineRuns(s).map((r) => r.bold ? `<strong style="color:${REPORT_THEME.heading};">${escapeHtml(r.text)}</strong>` : r.code ? `<code style="background:${REPORT_THEME.code};border-radius:4px;padding:1px 5px;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px;">${escapeHtml(r.text)}</code>` : escapeHtml(r.text)).join("");
|
|
155023
155395
|
return markdownBlocks(content).map((b) => {
|
|
@@ -155042,7 +155414,8 @@ function buildScheduledReportEmail(input) {
|
|
|
155042
155414
|
const charts = cells.filter((c2) => c2.type === "chart").map((c2) => c2.title).filter(Boolean);
|
|
155043
155415
|
const narrative = cells.find((c2) => c2.type === "markdown");
|
|
155044
155416
|
const fmt = input.format.toUpperCase();
|
|
155045
|
-
const
|
|
155417
|
+
const summary2 = normalizeDashboardSummary(spec.summary);
|
|
155418
|
+
const body = paragraph(`Your <strong>${escapeHtml(input.scheduleTitle)}</strong> report ran on schedule against current Testver data. The full report is attached as <strong>${escapeHtml(fmt)}</strong>.`) + (input.regenerateError ? callout(`<strong>Data refresh skipped.</strong> The latest values could not be pulled from the live workspace this run, so this email and the attachment show the most recent saved snapshot.<br><span style="font-family:ui-monospace,Menlo,Consolas,monospace;font-size:11px;">${escapeHtml(input.regenerateError)}</span>`, "warning") : "") + (summary2 ? emailSummary(summary2) : "") + (kpis.length ? sectionTitle("Key metrics") + emailKpiTiles(kpis) : "") + tables.slice(0, 2).map((t) => sectionTitle(t.title || "Table") + emailDataTable(t)).join("") + // A narrative that opens with its own heading needs no section title.
|
|
155046
155419
|
(narrative ? (/^\s*#/.test(narrative.content) ? "" : sectionTitle("Summary")) + emailNarrative(narrative.content) : "") + (charts.length ? paragraph(`<span style="color:${REPORT_THEME.muted};">Charts in the attachment:</span> ${charts.map((c2) => escapeHtml(c2)).join(" \xB7 ")}${tables.length > 2 ? ` <span style="color:${REPORT_THEME.muted};">\xB7 and ${tables.length - 2} more table${tables.length - 2 === 1 ? "" : "s"}</span>` : ""}`, { small: true }) : "") + sectionTitle("Details") + kvTable([
|
|
155047
155420
|
!!spec.subtitle && ["Report", escapeHtml(spec.subtitle)],
|
|
155048
155421
|
["Schedule", `${escapeHtml(humanSchedule)} <span style="color:#94a3b8;">\xB7</span> <span style="font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px;color:#64748b;">${escapeHtml(input.cron)}</span>`],
|
|
@@ -155054,7 +155427,7 @@ function buildScheduledReportEmail(input) {
|
|
|
155054
155427
|
eyebrow: "Scheduled report",
|
|
155055
155428
|
title: `\u{1F4CA} ${spec.title}`,
|
|
155056
155429
|
subtitle: `${humanSchedule} \xB7 ${generatedAt}`,
|
|
155057
|
-
preheader: kpis.length ? kpis.slice(0, 4).map((k) => `${k.title} ${fmtValue(k.value)}${k.unit ?? ""}`).join(" \xB7 ") : `Scheduled report: ${spec.title}`,
|
|
155430
|
+
preheader: summary2?.verdict ? summary2.verdict : kpis.length ? kpis.slice(0, 4).map((k) => `${k.title} ${fmtValue(k.value)}${k.unit ?? ""}`).join(" \xB7 ") : `Scheduled report: ${spec.title}`,
|
|
155058
155431
|
body
|
|
155059
155432
|
});
|
|
155060
155433
|
return { subject: `${spec.title} \u2014 Testver report (${humanSchedule})`, html };
|
|
@@ -155269,20 +155642,26 @@ function describeDashboardStructure(spec) {
|
|
|
155269
155642
|
const span2 = c2.span ? `, span ${c2.span}` : "";
|
|
155270
155643
|
switch (c2.type) {
|
|
155271
155644
|
case "kpi":
|
|
155272
|
-
return `${i + 1}. KPI "${clip5(c2.title)}"${c2.unit ? ` (unit ${c2.unit})` : ""}${c2.delta != null ? ", with a change vs the previous period" : ""}${span2}`;
|
|
155645
|
+
return `${i + 1}. KPI "${clip5(c2.title)}"${c2.unit ? ` (unit ${c2.unit})` : ""}${c2.delta != null ? ", with a change vs the previous period" : ""}${c2.status ? ", with a status against its target" : ""}${c2.trend ? `, with a trend of ${c2.trend.length} periods` : ""}${span2}`;
|
|
155273
155646
|
case "chart": {
|
|
155274
155647
|
const series = c2.datasets?.length ? `series: ${c2.datasets.map((d) => `"${clip5(d.label, 40)}"`).join(", ")}` : "one series";
|
|
155275
|
-
return `${i + 1}. ${c2.chartType} chart "${clip5(c2.title)}" \u2014 ${c2.labels.length} labels, ${series}${span2}`;
|
|
155648
|
+
return `${i + 1}. ${c2.chartType} chart "${clip5(c2.title)}" \u2014 ${c2.labels.length} labels, ${series}${c2.runIds ? ", one runId per label" : ""}${span2}`;
|
|
155649
|
+
}
|
|
155650
|
+
case "table": {
|
|
155651
|
+
const links = c2.columnLinks ? `; link columns ${Object.entries(c2.columnLinks).map(([h, k]) => `"${clip5(h, 40)}" \u2192 ${k}`).join(", ")}` : "";
|
|
155652
|
+
return `${i + 1}. Table "${clip5(c2.title)}" \u2014 columns: ${c2.headers.map((h) => `"${clip5(h, 40)}"`).join(", ")} (${c2.rows.length} rows last time)${links}${span2}`;
|
|
155276
155653
|
}
|
|
155277
|
-
case "table":
|
|
155278
|
-
return `${i + 1}. Table "${clip5(c2.title)}" \u2014 columns: ${c2.headers.map((h) => `"${clip5(h, 40)}"`).join(", ")} (${c2.rows.length} rows last time)${span2}`;
|
|
155279
155654
|
case "markdown":
|
|
155280
155655
|
return `${i + 1}. Narrative text (rewrite it for the new numbers)${span2}`;
|
|
155281
155656
|
default:
|
|
155282
155657
|
return `${i + 1}. (unknown cell)`;
|
|
155283
155658
|
}
|
|
155284
155659
|
});
|
|
155285
|
-
|
|
155660
|
+
const head = [`Title: "${clip5(spec.title, 200)}"`];
|
|
155661
|
+
if (spec.subtitle) head.push(`Subtitle: "${clip5(spec.subtitle, 200)}" (update the window and counts)`);
|
|
155662
|
+
if (spec.summary) head.push(`Summary: a verdict with a status and ${spec.summary.findings?.length ?? 0} findings \u2014 write them again from the new numbers`);
|
|
155663
|
+
if (spec.method) head.push('Method: a "How this was calculated" note \u2014 keep it, updated for the new window');
|
|
155664
|
+
return [...head, "Cells, in order:", ...lines].join("\n");
|
|
155286
155665
|
}
|
|
155287
155666
|
function createReportRegenerator(deps2) {
|
|
155288
155667
|
return async (saved) => {
|
|
@@ -155315,17 +155694,17 @@ function createReportRegenerator(deps2) {
|
|
|
155315
155694
|
});
|
|
155316
155695
|
const prompt = `Regenerate the saved dashboard below against the CURRENT data in this Testver workspace.
|
|
155317
155696
|
|
|
155318
|
-
Query the data each cell needs with the analytics tools (automation_report, api_report, suites_report, testver), then call \`generate_dashboard\` exactly ONCE with the same title, the same cells in the same order \u2014 the same KPI titles and units, chart types and table columns \u2014 and only the values updated. Use only numbers the tools return. Do not save, share, schedule or email anything; the server stores the result.
|
|
155697
|
+
Query the data each cell needs with the analytics tools (automation_report, api_report, suites_report, testver), then call \`generate_dashboard\` exactly ONCE with the same title, the same cells in the same order \u2014 the same KPI titles and units, chart types and table columns \u2014 and only the values updated. Keep the same extras: a summary (verdict, status, findings) rewritten for the new numbers, the method note, KPI statuses and trends, chart runIds and table columnLinks. Use only numbers the tools return. Do not save, share, schedule or email anything; the server stores the result.
|
|
155319
155698
|
|
|
155320
155699
|
Saved layout (structure only):
|
|
155321
155700
|
${describeDashboardStructure(saved.spec)}`;
|
|
155322
|
-
const
|
|
155701
|
+
const timer2 = setTimeout(() => orch.abort(), REGENERATE_TIMEOUT_MS);
|
|
155323
155702
|
try {
|
|
155324
155703
|
for await (const chunk of orch.processStream(prompt)) {
|
|
155325
155704
|
if (chunk.type === "error") throw new Error(chunk.error);
|
|
155326
155705
|
}
|
|
155327
155706
|
} finally {
|
|
155328
|
-
clearTimeout(
|
|
155707
|
+
clearTimeout(timer2);
|
|
155329
155708
|
}
|
|
155330
155709
|
if (!producedId) throw new Error("AI did not produce a new dashboard \u2014 try again, or regenerate it from a Reporting chat.");
|
|
155331
155710
|
const file = resolveDocumentPath(`${producedId}.json`, deps2.projectPath);
|
|
@@ -155719,12 +156098,12 @@ function compareVersions(a, b) {
|
|
|
155719
156098
|
if (y.pre === null) return -1;
|
|
155720
156099
|
return x.pre < y.pre ? -1 : 1;
|
|
155721
156100
|
}
|
|
155722
|
-
function fromPackageRoot(root,
|
|
156101
|
+
function fromPackageRoot(root, source2) {
|
|
155723
156102
|
const dir = join121(root, "lib", "vite", "traceViewer");
|
|
155724
156103
|
if (!existsSync122(join121(dir, "index.html"))) return void 0;
|
|
155725
156104
|
try {
|
|
155726
156105
|
const version = String(JSON.parse(readFileSync99(join121(root, "package.json"), "utf-8")).version || "");
|
|
155727
|
-
return version ? { dir, version, source } : void 0;
|
|
156106
|
+
return version ? { dir, version, source: source2 } : void 0;
|
|
155728
156107
|
} catch {
|
|
155729
156108
|
return void 0;
|
|
155730
156109
|
}
|
|
@@ -157112,7 +157491,7 @@ function createBootProgress(opts = {}) {
|
|
|
157112
157491
|
const t0 = processStartMs();
|
|
157113
157492
|
let label4 = "Starting Testver";
|
|
157114
157493
|
let frame = 0;
|
|
157115
|
-
let
|
|
157494
|
+
let timer2 = null;
|
|
157116
157495
|
let stopped = false;
|
|
157117
157496
|
const elapsed = () => ((Date.now() - t0) / 1e3).toFixed(1);
|
|
157118
157497
|
const render = () => {
|
|
@@ -157132,17 +157511,17 @@ function createBootProgress(opts = {}) {
|
|
|
157132
157511
|
render();
|
|
157133
157512
|
};
|
|
157134
157513
|
});
|
|
157135
|
-
|
|
157514
|
+
timer2 = setInterval(() => {
|
|
157136
157515
|
frame++;
|
|
157137
157516
|
render();
|
|
157138
157517
|
}, 80);
|
|
157139
|
-
|
|
157518
|
+
timer2.unref?.();
|
|
157140
157519
|
render();
|
|
157141
157520
|
}
|
|
157142
157521
|
const restore = () => {
|
|
157143
|
-
if (
|
|
157144
|
-
clearInterval(
|
|
157145
|
-
|
|
157522
|
+
if (timer2) {
|
|
157523
|
+
clearInterval(timer2);
|
|
157524
|
+
timer2 = null;
|
|
157146
157525
|
}
|
|
157147
157526
|
if (tty) methods.forEach((m, i) => {
|
|
157148
157527
|
console[m] = originals[i];
|
|
@@ -157436,28 +157815,28 @@ function createFramePump(ws, opts = {}) {
|
|
|
157436
157815
|
const minInterval = opts.minIntervalMs ?? MIN_FRAME_INTERVAL_MS;
|
|
157437
157816
|
const now = opts.now ?? Date.now;
|
|
157438
157817
|
let pending = null;
|
|
157439
|
-
let
|
|
157440
|
-
let
|
|
157818
|
+
let timer2 = null;
|
|
157819
|
+
let lastSent2 = 0;
|
|
157441
157820
|
let sent = 0;
|
|
157442
157821
|
let skipped = 0;
|
|
157443
157822
|
const pump = () => {
|
|
157444
|
-
|
|
157823
|
+
timer2 = null;
|
|
157445
157824
|
if (!pending) return;
|
|
157446
157825
|
if (ws.readyState !== 1) {
|
|
157447
157826
|
pending = null;
|
|
157448
157827
|
return;
|
|
157449
157828
|
}
|
|
157450
|
-
const wait = Math.max(0,
|
|
157829
|
+
const wait = Math.max(0, lastSent2 + minInterval - now());
|
|
157451
157830
|
if (wait > 0 || ws.bufferedAmount > bufferLimit) {
|
|
157452
|
-
|
|
157831
|
+
timer2 = setTimeout(pump, wait > 0 ? wait : 25);
|
|
157453
157832
|
return;
|
|
157454
157833
|
}
|
|
157455
157834
|
const frame = pending;
|
|
157456
157835
|
pending = null;
|
|
157457
|
-
|
|
157836
|
+
lastSent2 = now();
|
|
157458
157837
|
sent++;
|
|
157459
157838
|
try {
|
|
157460
|
-
ws.send(JSON.stringify({ type: "screencast-frame", data: frame.data, metadata: frame.metadata, t:
|
|
157839
|
+
ws.send(JSON.stringify({ type: "screencast-frame", data: frame.data, metadata: frame.metadata, t: lastSent2 }));
|
|
157461
157840
|
} catch {
|
|
157462
157841
|
}
|
|
157463
157842
|
};
|
|
@@ -157465,11 +157844,11 @@ function createFramePump(ws, opts = {}) {
|
|
|
157465
157844
|
offer(frame) {
|
|
157466
157845
|
if (pending) skipped++;
|
|
157467
157846
|
pending = frame;
|
|
157468
|
-
if (!
|
|
157847
|
+
if (!timer2) pump();
|
|
157469
157848
|
},
|
|
157470
157849
|
clear() {
|
|
157471
|
-
if (
|
|
157472
|
-
|
|
157850
|
+
if (timer2) clearTimeout(timer2);
|
|
157851
|
+
timer2 = null;
|
|
157473
157852
|
pending = null;
|
|
157474
157853
|
},
|
|
157475
157854
|
stats: () => ({ sent, skipped })
|