jinzd-ai-cli 0.4.307 → 0.4.308
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 +1 -0
- package/THIRD_PARTY_NOTICES.md +3 -0
- package/dist/{agent-client-6GX6QQDU.js → agent-client-TIEAYZXV.js} +4 -1
- package/dist/{auth-PE3Z5OHS.js → auth-QTQNZ6IX.js} +2 -2
- package/dist/{batch-HMADXNOD.js → batch-S7XLEEOH.js} +3 -3
- package/dist/{chat-index-2D5GK2DB.js → chat-index-7CLR4CBG.js} +4 -3
- package/dist/{chat-index-DGUOUUQW.js → chat-index-RLVLQRRC.js} +3 -2
- package/dist/{chunk-SJFZPS65.js → chunk-2DYQDLLF.js} +1 -1
- package/dist/{chunk-VAV2IJ3R.js → chunk-2MNUMLN4.js} +1 -1
- package/dist/chunk-2XMUCC42.js +67 -0
- package/dist/{chunk-5GQL4TSZ.js → chunk-3537CQ5M.js} +2 -2
- package/dist/{chunk-OAXLMF3U.js → chunk-3YVNDYOY.js} +1 -1
- package/dist/{chunk-RYQBBEMM.js → chunk-4PR5AVJ5.js} +115 -19
- package/dist/{chunk-GHWZVPUV.js → chunk-6JHACXB3.js} +7 -5
- package/dist/{chunk-CIM2PV2F.js → chunk-7OHXFTZO.js} +2 -2
- package/dist/{chunk-IUVDZVZ4.js → chunk-AXTLYOA7.js} +24 -17
- package/dist/{chunk-XJOK5353.js → chunk-B3MPYI4E.js} +2 -2
- package/dist/{chunk-3CKJOTVM.js → chunk-BGZN4K7Q.js} +4 -4
- package/dist/chunk-BMLQPSHP.js +69 -0
- package/dist/{chunk-NRSYBKWA.js → chunk-C7CKDFJS.js} +1 -1
- package/dist/{chunk-NQJSPMY2.js → chunk-E2PNXNKI.js} +4 -4
- package/dist/chunk-FVXNEZEW.js +161 -0
- package/dist/{chunk-YKJO3SI4.js → chunk-G6DVGQ4I.js} +1 -1
- package/dist/{chunk-YFDQIUQ3.js → chunk-HC33C4U3.js} +18 -18
- package/dist/chunk-JJFJWD35.js +162 -0
- package/dist/{chunk-KRCYR46A.js → chunk-JJNUASMJ.js} +264 -55
- package/dist/{chunk-NYNSYLFY.js → chunk-JL44HGZC.js} +1 -1
- package/dist/{chunk-NUJTNH76.js → chunk-LBWKMTT3.js} +1 -1
- package/dist/{chunk-AHL6KOGM.js → chunk-LR3TGZWQ.js} +2 -2
- package/dist/{chunk-WQ3OMEC4.js → chunk-M6HLYG33.js} +1 -1
- package/dist/{chunk-I4GQRMFV.js → chunk-M6YV5KSS.js} +6 -4
- package/dist/{chunk-3TBXHLSC.js → chunk-NLK45GUS.js} +1 -1
- package/dist/{chunk-KBDKKHXB.js → chunk-O6CGOVD4.js} +2 -2
- package/dist/chunk-QMFMST2T.js +39 -0
- package/dist/{chunk-MI4SFZGX.js → chunk-RMEJR3AW.js} +5 -2
- package/dist/{chunk-UFW4S3RU.js → chunk-RVMCY6DP.js} +1 -1
- package/dist/{chunk-LF67HWWR.js → chunk-RWRZVQCB.js} +1 -1
- package/dist/chunk-SXIJLSVF.js +41 -0
- package/dist/chunk-TDQW2YHK.js +65 -0
- package/dist/{chunk-L2RJPVHV.js → chunk-TPTFV3Y6.js} +266 -512
- package/dist/{chunk-45UVJXFQ.js → chunk-W2UOVGRC.js} +1 -1
- package/dist/{chunk-VXEF2SWG.js → chunk-WT252ZDV.js} +2 -2
- package/dist/{chunk-4W6VDVQU.js → chunk-WVEIUSXE.js} +246 -56
- package/dist/{chunk-AQF6IXSR.js → chunk-YBZM7PHI.js} +4 -4
- package/dist/{ci-QD2Q7NWY.js → ci-5HONSUAS.js} +7 -7
- package/dist/{ci-format-42XIZO5P.js → ci-format-URUH3ZZ5.js} +2 -2
- package/dist/{constants-NMASHFDL.js → constants-BLDBI7IG.js} +1 -1
- package/dist/{constants-5CMEFZQB.js → constants-FG27DQMS.js} +1 -1
- package/dist/doctor-cli-QQLMNJN7.js +18 -0
- package/dist/electron-server.js +886 -828
- package/dist/file-checkpoint-64A2AXHE.js +7 -0
- package/dist/{file-checkpoint-NKBHGC7L.js → file-checkpoint-VVPUJNCI.js} +2 -1
- package/dist/{hub-ZLF6GMQD.js → hub-GGFW3DCC.js} +3 -3
- package/dist/{hub-server-CBKCP5VD.js → hub-server-JLC7CNP7.js} +55 -17
- package/dist/index.js +42 -40
- package/dist/{indexer-P3FPRTPJ.js → indexer-GKIWSSRP.js} +3 -3
- package/dist/indexer-VRXDZ74A.js +10 -0
- package/dist/{persist-S77WRVLD.js → persist-ZZXRWFBX.js} +4 -4
- package/dist/{persistent-memory-GJE7HKVK.js → persistent-memory-UNLCXUWH.js} +3 -3
- package/dist/{persistent-memory-MBSBTBGY.js → persistent-memory-YYWIN6BG.js} +3 -3
- package/dist/{pr-SXRW24JG.js → pr-YCFGPFI7.js} +7 -7
- package/dist/{project-trust-MUG325AW.js → project-trust-6CJB5ZMX.js} +1 -1
- package/dist/{project-trust-NKYHL3VZ.js → project-trust-KGG2BWKC.js} +1 -1
- package/dist/run-tests-GHY4BYDE.js +13 -0
- package/dist/run-tests-KRNMFXAN.js +12 -0
- package/dist/{semantic-7GM5M4MU.js → semantic-N227CLSC.js} +4 -4
- package/dist/{semantic-QOBAXEQ4.js → semantic-TRQAZSRY.js} +4 -4
- package/dist/{server-MO3EU2XD.js → server-73UBHSFV.js} +16 -14
- package/dist/{server-GGEO7SA2.js → server-QRAWSG4Z.js} +231 -103
- package/dist/{store-SIKHCUYJ.js → store-2N6PPPBP.js} +2 -2
- package/dist/{store-CMSSWZF7.js → store-76VVFDXM.js} +2 -2
- package/dist/{task-orchestrator-JGEEQ2OE.js → task-orchestrator-GI3RGLZI.js} +15 -14
- package/dist/{usage-B7RIAPPT.js → usage-GWTIGZF5.js} +4 -4
- package/dist/{vector-store-JAXWDZYW.js → vector-store-T2DVUMY4.js} +2 -2
- package/dist/{vector-store-PWIOQFTP.js → vector-store-V6UGEYWK.js} +2 -2
- package/dist/web/client/app.js +7 -0
- package/dist/web/client/app.js.br +0 -0
- package/dist/web/client/app.js.gz +0 -0
- package/dist/web/client/util.js +14 -23
- package/dist/web/client/util.js.br +0 -0
- package/dist/web/client/util.js.gz +0 -0
- package/dist/web/client/vendor/DOMPurify-LICENSE.txt +202 -0
- package/dist/web/client/vendor/purify.es.mjs +2722 -0
- package/dist/web/client/vendor/purify.es.mjs.br +0 -0
- package/dist/web/client/vendor/purify.es.mjs.gz +0 -0
- package/package.json +4 -2
- package/dist/chunk-4BKXL7SM.js +0 -98
- package/dist/chunk-6BUTA5VW.js +0 -38
- package/dist/chunk-IW3Q7AE5.js +0 -40
- package/dist/chunk-SKET65WZ.js +0 -96
- package/dist/doctor-cli-IOVSHBDI.js +0 -18
- package/dist/file-checkpoint-CGH6OJVI.js +0 -6
- package/dist/indexer-FPKY7LCT.js +0 -10
- package/dist/run-tests-EQCAMFQE.js +0 -10
- package/dist/run-tests-V3N7YV3P.js +0 -9
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
detectsHallucinatedFileOp,
|
|
4
4
|
parseToolCallArguments,
|
|
5
5
|
schemaToJsonSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RMEJR3AW.js";
|
|
7
7
|
import {
|
|
8
8
|
AuthError,
|
|
9
9
|
ProviderError,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-TU3L3PW7.js";
|
|
13
13
|
import {
|
|
14
14
|
atomicWriteFileSync
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BMLQPSHP.js";
|
|
16
16
|
|
|
17
17
|
// src/providers/claude.ts
|
|
18
18
|
import Anthropic from "@anthropic-ai/sdk";
|
|
@@ -1,16 +1,180 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
getExecutionConfigDir,
|
|
3
|
+
getExecutionSignal
|
|
4
|
+
} from "./chunk-QMFMST2T.js";
|
|
2
5
|
import {
|
|
3
6
|
TEST_TIMEOUT
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2DYQDLLF.js";
|
|
8
|
+
|
|
9
|
+
// src/tools/builtin/run-tests.ts
|
|
10
|
+
import { spawn as spawn2 } from "child_process";
|
|
11
|
+
|
|
12
|
+
// src/core/interrupt.ts
|
|
13
|
+
var controller = new AbortController();
|
|
14
|
+
function currentAbortSignal() {
|
|
15
|
+
return getExecutionSignal() ?? controller.signal;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/tools/win-shell.ts
|
|
19
|
+
import { platform } from "os";
|
|
20
|
+
import { spawn } from "child_process";
|
|
21
|
+
var IS_WINDOWS = platform() === "win32";
|
|
22
|
+
var WIN_UTF8_PREAMBLE = "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; $OutputEncoding = [System.Text.Encoding]::UTF8; ";
|
|
23
|
+
function shellInvocation(command) {
|
|
24
|
+
if (IS_WINDOWS) {
|
|
25
|
+
return {
|
|
26
|
+
shell: "powershell.exe",
|
|
27
|
+
args: ["-NoProfile", "-NonInteractive", "-Command", WIN_UTF8_PREAMBLE + command]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return { shell: process.env["SHELL"] ?? "/bin/bash", args: ["-c", command] };
|
|
31
|
+
}
|
|
32
|
+
function decodeWindowsBuffer(buf) {
|
|
33
|
+
const utf8 = buf.toString("utf-8");
|
|
34
|
+
if (!utf8.includes("\uFFFD")) return utf8;
|
|
35
|
+
try {
|
|
36
|
+
return new TextDecoder("gbk").decode(buf);
|
|
37
|
+
} catch {
|
|
38
|
+
return utf8;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
var GBK_MOJIBAKE_FINGERPRINTS = [
|
|
42
|
+
"\uFFFD",
|
|
43
|
+
"\u9215",
|
|
44
|
+
"\u951B",
|
|
45
|
+
"\u9983",
|
|
46
|
+
"\u9241",
|
|
47
|
+
"\u6D93",
|
|
48
|
+
"\u935B",
|
|
49
|
+
"\u9428",
|
|
50
|
+
"\u7EFE",
|
|
51
|
+
"\u95AB",
|
|
52
|
+
"\u9593",
|
|
53
|
+
"\u95BF",
|
|
54
|
+
"\u68E3",
|
|
55
|
+
"\u95B4",
|
|
56
|
+
"\u5A11",
|
|
57
|
+
"\u95B8",
|
|
58
|
+
"\u95BB",
|
|
59
|
+
"\u7F01",
|
|
60
|
+
"\u95C1"
|
|
61
|
+
];
|
|
62
|
+
var gbkReverse = null;
|
|
63
|
+
function gbkReverseMap() {
|
|
64
|
+
if (gbkReverse) return gbkReverse;
|
|
65
|
+
const map = /* @__PURE__ */ new Map();
|
|
66
|
+
try {
|
|
67
|
+
const dec = new TextDecoder("gbk");
|
|
68
|
+
for (let hi = 129; hi <= 254; hi++) {
|
|
69
|
+
for (let lo = 64; lo <= 254; lo++) {
|
|
70
|
+
if (lo === 127) continue;
|
|
71
|
+
const ch = dec.decode(new Uint8Array([hi, lo]));
|
|
72
|
+
if (ch.length === 1 && ch !== "\uFFFD" && !map.has(ch)) map.set(ch, [hi, lo]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch {
|
|
76
|
+
}
|
|
77
|
+
gbkReverse = map;
|
|
78
|
+
return map;
|
|
79
|
+
}
|
|
80
|
+
function decodeRunAsChinese(bytes) {
|
|
81
|
+
for (let start = 0; start <= 2 && start < bytes.length; start++) {
|
|
82
|
+
for (let end = 0; end <= 2 && bytes.length - end > start; end++) {
|
|
83
|
+
const slice = bytes.slice(start, bytes.length - end);
|
|
84
|
+
if (slice.length < 6) continue;
|
|
85
|
+
try {
|
|
86
|
+
const out = new TextDecoder("utf-8", { fatal: true }).decode(new Uint8Array(slice));
|
|
87
|
+
if (/[一-鿿]/.test(out)) return out;
|
|
88
|
+
} catch {
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
function recoverGbkMojibake(text) {
|
|
95
|
+
if (!text) return null;
|
|
96
|
+
const map = gbkReverseMap();
|
|
97
|
+
if (map.size === 0) return null;
|
|
98
|
+
let run = [];
|
|
99
|
+
let best = null;
|
|
100
|
+
const flush = () => {
|
|
101
|
+
if (run.length >= 4) {
|
|
102
|
+
const bytes = [];
|
|
103
|
+
for (const p of run) bytes.push(p[0], p[1]);
|
|
104
|
+
const out = decodeRunAsChinese(bytes);
|
|
105
|
+
if (out && (!best || out.length > best.length)) best = out;
|
|
106
|
+
}
|
|
107
|
+
run = [];
|
|
108
|
+
};
|
|
109
|
+
for (const ch of text) {
|
|
110
|
+
const pair = ch.codePointAt(0) < 128 ? void 0 : map.get(ch);
|
|
111
|
+
if (pair) run.push(pair);
|
|
112
|
+
else flush();
|
|
113
|
+
}
|
|
114
|
+
flush();
|
|
115
|
+
return best;
|
|
116
|
+
}
|
|
117
|
+
function looksLikeGbkMojibake(text) {
|
|
118
|
+
if (recoverGbkMojibake(text) !== null) return true;
|
|
119
|
+
let hits = 0;
|
|
120
|
+
for (const ch of GBK_MOJIBAKE_FINGERPRINTS) {
|
|
121
|
+
if (text.includes(ch) && ++hits >= 2) return true;
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
function killProcessTree(proc, processGroup = false) {
|
|
126
|
+
if (proc.killed || proc.exitCode !== null) return;
|
|
127
|
+
if (IS_WINDOWS && proc.pid) {
|
|
128
|
+
try {
|
|
129
|
+
const tk = spawn("taskkill", ["/PID", String(proc.pid), "/T", "/F"], {
|
|
130
|
+
windowsHide: true,
|
|
131
|
+
stdio: "ignore"
|
|
132
|
+
});
|
|
133
|
+
tk.on("exit", () => {
|
|
134
|
+
try {
|
|
135
|
+
proc.kill();
|
|
136
|
+
} catch {
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
tk.on("error", () => {
|
|
140
|
+
try {
|
|
141
|
+
proc.kill();
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
} catch {
|
|
146
|
+
try {
|
|
147
|
+
proc.kill();
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const signal = (value) => {
|
|
154
|
+
if (processGroup && proc.pid) process.kill(-proc.pid, value);
|
|
155
|
+
else proc.kill(value);
|
|
156
|
+
};
|
|
157
|
+
try {
|
|
158
|
+
signal("SIGTERM");
|
|
159
|
+
} catch {
|
|
160
|
+
}
|
|
161
|
+
setTimeout(() => {
|
|
162
|
+
if (processGroup || proc.exitCode === null) {
|
|
163
|
+
try {
|
|
164
|
+
signal("SIGKILL");
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, 500).unref();
|
|
169
|
+
}
|
|
5
170
|
|
|
6
171
|
// src/tools/builtin/run-tests.ts
|
|
7
|
-
import { execSync, spawnSync } from "child_process";
|
|
8
172
|
import { existsSync, readFileSync, readdirSync } from "fs";
|
|
9
173
|
import { join } from "path";
|
|
10
|
-
import { platform } from "os";
|
|
174
|
+
import { platform as platform2 } from "os";
|
|
11
175
|
import chalk from "chalk";
|
|
12
|
-
var FILTER_WHITELIST = /^[\w
|
|
13
|
-
var
|
|
176
|
+
var FILTER_WHITELIST = /^[\w.\-/:# *?\[\]@+]{1,200}$/;
|
|
177
|
+
var IS_WINDOWS2 = platform2() === "win32";
|
|
14
178
|
function detectNodeTestFramework(cwd, pkg) {
|
|
15
179
|
const devDeps = pkg.devDependencies ?? {};
|
|
16
180
|
const deps = pkg.dependencies ?? {};
|
|
@@ -80,11 +244,11 @@ function safeReadPackageJson(cwd) {
|
|
|
80
244
|
}
|
|
81
245
|
function detectProject(cwd) {
|
|
82
246
|
if (existsSync(join(cwd, "pom.xml"))) {
|
|
83
|
-
return { type: "java", framework: "Maven (JUnit)", command:
|
|
247
|
+
return { type: "java", framework: "Maven (JUnit)", command: IS_WINDOWS2 ? "mvn.cmd test" : "mvn test" };
|
|
84
248
|
}
|
|
85
249
|
if (existsSync(join(cwd, "build.gradle")) || existsSync(join(cwd, "build.gradle.kts"))) {
|
|
86
|
-
const wrapper =
|
|
87
|
-
const cmd = existsSync(join(cwd,
|
|
250
|
+
const wrapper = IS_WINDOWS2 ? "gradlew.bat" : "./gradlew";
|
|
251
|
+
const cmd = existsSync(join(cwd, IS_WINDOWS2 ? "gradlew.bat" : "gradlew")) ? `${wrapper} test` : "gradle test";
|
|
88
252
|
return { type: "java", framework: "Gradle (JUnit)", command: cmd };
|
|
89
253
|
}
|
|
90
254
|
if (existsSync(join(cwd, "package.json"))) {
|
|
@@ -240,7 +404,7 @@ function renderColorReport(summary, framework) {
|
|
|
240
404
|
console.log();
|
|
241
405
|
}
|
|
242
406
|
function needsWindowsShell(file) {
|
|
243
|
-
if (!
|
|
407
|
+
if (!IS_WINDOWS2) return false;
|
|
244
408
|
const lower = file.toLowerCase();
|
|
245
409
|
return lower.endsWith(".cmd") || lower.endsWith(".bat") || lower === "mvn" || lower === "gradle" || lower === "npm" || lower === "npx";
|
|
246
410
|
}
|
|
@@ -307,51 +471,9 @@ Got: ${filter.slice(0, 60)}${filter.length > 60 ? "..." : ""}`;
|
|
|
307
471
|
framework = detected.framework;
|
|
308
472
|
argv = buildArgv(detected, filter);
|
|
309
473
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
const r = spawnSync(argv.file, argv.args, {
|
|
314
|
-
cwd,
|
|
315
|
-
timeout: TEST_TIMEOUT,
|
|
316
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
317
|
-
// shell:false is the default for spawnSync; on Windows .cmd/.bat
|
|
318
|
-
// requires shell:true, so we opt-in only for known wrapper names.
|
|
319
|
-
shell: needsWindowsShell(argv.file),
|
|
320
|
-
env: {
|
|
321
|
-
...process.env,
|
|
322
|
-
...IS_WINDOWS ? {} : { FORCE_COLOR: "0" }
|
|
323
|
-
},
|
|
324
|
-
encoding: "utf-8",
|
|
325
|
-
maxBuffer: 64 * 1024 * 1024
|
|
326
|
-
});
|
|
327
|
-
if (r.error) {
|
|
328
|
-
output = `Failed to launch test runner: ${r.error.message}`;
|
|
329
|
-
exitCode = 1;
|
|
330
|
-
} else {
|
|
331
|
-
exitCode = r.status ?? 1;
|
|
332
|
-
output = (r.stdout ?? "") + (r.stderr ? "\n" + r.stderr : "");
|
|
333
|
-
}
|
|
334
|
-
} else {
|
|
335
|
-
try {
|
|
336
|
-
const buf = execSync(command, {
|
|
337
|
-
cwd,
|
|
338
|
-
timeout: TEST_TIMEOUT,
|
|
339
|
-
encoding: "buffer",
|
|
340
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
341
|
-
env: {
|
|
342
|
-
...process.env,
|
|
343
|
-
...IS_WINDOWS ? {} : { FORCE_COLOR: "0" }
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
output = buf.toString("utf-8");
|
|
347
|
-
} catch (err) {
|
|
348
|
-
const e = err;
|
|
349
|
-
exitCode = e.status ?? 1;
|
|
350
|
-
const stdout = e.stdout?.toString("utf-8") ?? "";
|
|
351
|
-
const stderr = e.stderr?.toString("utf-8") ?? "";
|
|
352
|
-
output = stdout + (stderr ? "\n" + stderr : "");
|
|
353
|
-
}
|
|
354
|
-
}
|
|
474
|
+
const result = await runTestProcess(argv, command, cwd, currentAbortSignal());
|
|
475
|
+
const output = result.output;
|
|
476
|
+
const exitCode = result.exitCode;
|
|
355
477
|
let summary = {
|
|
356
478
|
tests: 0,
|
|
357
479
|
passed: 0,
|
|
@@ -390,6 +512,7 @@ Got: ${filter.slice(0, 60)}${filter.length > 60 ? "..." : ""}`;
|
|
|
390
512
|
}
|
|
391
513
|
}
|
|
392
514
|
}
|
|
515
|
+
if (exitCode !== 0 && summary.failures + summary.errors === 0) summary.errors = 1;
|
|
393
516
|
renderColorReport(summary, framework);
|
|
394
517
|
return formatReport(summary, framework, output, exitCode);
|
|
395
518
|
}
|
|
@@ -414,8 +537,75 @@ var runTestsTool = {
|
|
|
414
537
|
return executeTests(args);
|
|
415
538
|
}
|
|
416
539
|
};
|
|
540
|
+
var MAX_TEST_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
541
|
+
var activeTestProcesses = 0;
|
|
542
|
+
var activeTestsByOwner = /* @__PURE__ */ new Map();
|
|
543
|
+
async function runTestProcess(argv, command, cwd, signal) {
|
|
544
|
+
if (signal.aborted) throw new Error("Test run cancelled");
|
|
545
|
+
const owner = getExecutionConfigDir();
|
|
546
|
+
if ((activeTestsByOwner.get(owner) ?? 0) >= 2) throw new Error("Test runner capacity reached (2 per user).");
|
|
547
|
+
if (activeTestProcesses >= 4) throw new Error("Test runner capacity reached (4). Try again after a run finishes.");
|
|
548
|
+
activeTestProcesses++;
|
|
549
|
+
activeTestsByOwner.set(owner, (activeTestsByOwner.get(owner) ?? 0) + 1);
|
|
550
|
+
try {
|
|
551
|
+
return await new Promise((resolve, reject) => {
|
|
552
|
+
const child = argv ? spawn2(argv.file, argv.args, { cwd, shell: needsWindowsShell(argv.file), windowsHide: true, detached: !IS_WINDOWS2, stdio: ["ignore", "pipe", "pipe"] }) : spawn2(command, { cwd, shell: true, windowsHide: true, detached: !IS_WINDOWS2, stdio: ["ignore", "pipe", "pipe"] });
|
|
553
|
+
const chunks = [];
|
|
554
|
+
let bytes = 0;
|
|
555
|
+
let stopped = "";
|
|
556
|
+
let settled = false;
|
|
557
|
+
const stop = (reason) => {
|
|
558
|
+
if (stopped) return;
|
|
559
|
+
stopped = reason;
|
|
560
|
+
killProcessTree(child, true);
|
|
561
|
+
};
|
|
562
|
+
const onAbort = () => stop("Test run cancelled");
|
|
563
|
+
const timer = setTimeout(() => stop("Test run timed out"), TEST_TIMEOUT);
|
|
564
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
565
|
+
if (signal.aborted) onAbort();
|
|
566
|
+
const append = (chunk) => {
|
|
567
|
+
const take = Math.min(chunk.length, MAX_TEST_OUTPUT_BYTES - bytes);
|
|
568
|
+
if (take > 0) chunks.push(chunk.subarray(0, take));
|
|
569
|
+
bytes += take;
|
|
570
|
+
if (bytes >= MAX_TEST_OUTPUT_BYTES) stop("Test output exceeded 4 MiB limit");
|
|
571
|
+
};
|
|
572
|
+
child.stdout?.on("data", append);
|
|
573
|
+
child.stderr?.on("data", append);
|
|
574
|
+
const clean = () => {
|
|
575
|
+
clearTimeout(timer);
|
|
576
|
+
signal.removeEventListener("abort", onAbort);
|
|
577
|
+
};
|
|
578
|
+
child.once("error", (error) => {
|
|
579
|
+
if (settled) return;
|
|
580
|
+
settled = true;
|
|
581
|
+
clean();
|
|
582
|
+
reject(error);
|
|
583
|
+
});
|
|
584
|
+
child.once("close", (code) => {
|
|
585
|
+
if (settled) return;
|
|
586
|
+
settled = true;
|
|
587
|
+
clean();
|
|
588
|
+
resolve({ output: Buffer.concat(chunks).toString("utf8") + (stopped ? "\n" + stopped : ""), exitCode: stopped ? 1 : code ?? 1 });
|
|
589
|
+
});
|
|
590
|
+
});
|
|
591
|
+
} finally {
|
|
592
|
+
activeTestProcesses--;
|
|
593
|
+
const remaining = (activeTestsByOwner.get(owner) ?? 1) - 1;
|
|
594
|
+
if (remaining) activeTestsByOwner.set(owner, remaining);
|
|
595
|
+
else activeTestsByOwner.delete(owner);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
417
598
|
|
|
418
599
|
export {
|
|
600
|
+
currentAbortSignal,
|
|
601
|
+
IS_WINDOWS,
|
|
602
|
+
WIN_UTF8_PREAMBLE,
|
|
603
|
+
shellInvocation,
|
|
604
|
+
decodeWindowsBuffer,
|
|
605
|
+
recoverGbkMojibake,
|
|
606
|
+
looksLikeGbkMojibake,
|
|
607
|
+
killProcessTree,
|
|
419
608
|
executeTests,
|
|
420
|
-
runTestsTool
|
|
609
|
+
runTestsTool,
|
|
610
|
+
runTestProcess
|
|
421
611
|
};
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
} from "./chunk-TU3L3PW7.js";
|
|
6
6
|
import {
|
|
7
7
|
atomicWriteFileSync
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-BMLQPSHP.js";
|
|
9
9
|
import {
|
|
10
10
|
CONFIG_DIR_NAME,
|
|
11
11
|
CONFIG_FILE_NAME,
|
|
12
12
|
HISTORY_DIR_NAME,
|
|
13
13
|
PLUGINS_DIR_NAME
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2MNUMLN4.js";
|
|
15
15
|
|
|
16
16
|
// src/config/config-manager.ts
|
|
17
17
|
import { readFileSync, existsSync, mkdirSync } from "fs";
|
|
@@ -427,8 +427,8 @@ ${err}`
|
|
|
427
427
|
return changed;
|
|
428
428
|
}
|
|
429
429
|
save() {
|
|
430
|
-
mkdirSync(this.configDir, { recursive: true });
|
|
431
|
-
atomicWriteFileSync(this.configPath, JSON.stringify(this.config, null, 2));
|
|
430
|
+
mkdirSync(this.configDir, { recursive: true, mode: 448 });
|
|
431
|
+
atomicWriteFileSync(this.configPath, JSON.stringify(this.config, null, 2), { mode: 384 });
|
|
432
432
|
}
|
|
433
433
|
getApiKey(providerId) {
|
|
434
434
|
const envKey = EnvLoader.getApiKey(providerId);
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
CI_COMMENT_MARKER,
|
|
4
4
|
countSeverity,
|
|
5
5
|
runCi
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-BGZN4K7Q.js";
|
|
7
|
+
import "./chunk-NLK45GUS.js";
|
|
8
8
|
import "./chunk-HLWUDRBO.js";
|
|
9
9
|
import "./chunk-6YZEZFX5.js";
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-WT252ZDV.js";
|
|
11
|
+
import "./chunk-YBZM7PHI.js";
|
|
12
|
+
import "./chunk-RMEJR3AW.js";
|
|
13
13
|
import "./chunk-TU3L3PW7.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-BMLQPSHP.js";
|
|
15
|
+
import "./chunk-2MNUMLN4.js";
|
|
16
16
|
export {
|
|
17
17
|
CI_COMMENT_MARKER,
|
|
18
18
|
countSeverity,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
formatDoctorReport,
|
|
4
|
+
runDoctorCli
|
|
5
|
+
} from "./chunk-E2PNXNKI.js";
|
|
6
|
+
import "./chunk-3537CQ5M.js";
|
|
7
|
+
import "./chunk-RS7SKYTS.js";
|
|
8
|
+
import "./chunk-WT252ZDV.js";
|
|
9
|
+
import "./chunk-YBZM7PHI.js";
|
|
10
|
+
import "./chunk-RMEJR3AW.js";
|
|
11
|
+
import "./chunk-TU3L3PW7.js";
|
|
12
|
+
import "./chunk-HOSJZMQS.js";
|
|
13
|
+
import "./chunk-BMLQPSHP.js";
|
|
14
|
+
import "./chunk-2MNUMLN4.js";
|
|
15
|
+
export {
|
|
16
|
+
formatDoctorReport,
|
|
17
|
+
runDoctorCli
|
|
18
|
+
};
|