jinzd-ai-cli 0.4.199 → 0.4.201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{batch-VD6MSQCP.js → batch-SWBDLVZO.js} +2 -2
- package/dist/{chunk-SKHHK4EY.js → chunk-3UWMMYCQ.js} +2 -2
- package/dist/{chunk-YZH2QQXJ.js → chunk-5UR6ZOF4.js} +8 -4
- package/dist/{chunk-CNGZTFXL.js → chunk-C46JMUDC.js} +1 -1
- package/dist/{chunk-W5QWK6H5.js → chunk-HLOHSMTT.js} +56 -15
- package/dist/{chunk-6F6S547D.js → chunk-IAWXC2SO.js} +1 -1
- package/dist/{chunk-KAHTB7MB.js → chunk-JP6ESDV7.js} +1 -1
- package/dist/{chunk-I34KXFKX.js → chunk-QT5SGLTM.js} +1 -1
- package/dist/{chunk-JCEFAPZ3.js → chunk-SDT4DCNX.js} +1 -1
- package/dist/{chunk-GXW3LDZR.js → chunk-WFGCP2GF.js} +1 -1
- package/dist/{chunk-WLWT3AHI.js → chunk-YUA2KL7W.js} +1 -1
- package/dist/{ci-JEIDJY4I.js → ci-O3JM5YAA.js} +4 -4
- package/dist/{constants-4UOEJAWA.js → constants-QUKKMYWZ.js} +1 -1
- package/dist/{doctor-cli-W567ITCQ.js → doctor-cli-6XY3PJM5.js} +6 -6
- package/dist/electron-server.js +62 -17
- package/dist/{hub-PSMACSAI.js → hub-HJTJM2RT.js} +1 -1
- package/dist/index.js +24 -26
- package/dist/{run-tests-T6JLEQEM.js → run-tests-OEPVJDXJ.js} +2 -2
- package/dist/{run-tests-6KONIXP2.js → run-tests-T4NPP36U.js} +1 -1
- package/dist/{server-PS63FMEU.js → server-NBPF74CY.js} +9 -9
- package/dist/{server-TZ7SISKB.js → server-TZDUN5V3.js} +5 -5
- package/dist/{task-orchestrator-QZT5WACU.js → task-orchestrator-BS2FKLGM.js} +5 -5
- package/dist/{usage-GGTJUJHR.js → usage-DPM6T4ZZ.js} +2 -2
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QT5SGLTM.js";
|
|
5
5
|
import "./chunk-TZQHYZKT.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-SDT4DCNX.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HLOHSMTT.js";
|
|
5
5
|
import {
|
|
6
6
|
APP_NAME,
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
MCP_PROTOCOL_VERSION,
|
|
12
12
|
MCP_TOOL_PREFIX,
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SDT4DCNX.js";
|
|
15
15
|
|
|
16
16
|
// src/mcp/client.ts
|
|
17
17
|
import { spawn } from "child_process";
|
|
@@ -83,10 +83,14 @@ var HALLUCINATION_PATTERNS = [
|
|
|
83
83
|
// 已成功保存 / 已成功写入 / 已成功创建
|
|
84
84
|
/保存[到至]了?\s*[`'"]/,
|
|
85
85
|
// 保存到了 `path` / 保存至 'path'
|
|
86
|
-
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
//
|
|
86
|
+
// 「教案/文件…内容如下:」后跟正文 dump。要求紧邻一个**文档类名词**——否则
|
|
87
|
+
// “这张图片的内容如下:”这类纯描述会被误判成虚假写入声明,在加载了写文件工具的
|
|
88
|
+
// 普通对话/视觉问答里白触发一轮重试(v0.4.200 实战:GLM-5V-Turbo 描述图片时命中
|
|
89
|
+
// 裸 `内容如下:`)。文档名词覆盖本应用实际生成的产物(教案/试卷/讲义…)。
|
|
90
|
+
/(?:文件|教案|试卷|讲义|课件|课程|文档|脚本|配置|程序|报告|表格|清单|笔记)[^\n。.!!??]{0,8}内容如下[::]/,
|
|
91
|
+
// 以下是xx教案[内容]:(Kimi 常见 dump 模式)。同样要求文档类名词,排除
|
|
92
|
+
// “以下是图片的内容:”“以下是修改后的内容:”这类描述/对话。
|
|
93
|
+
/以下是[^\n。.!!??]*?(?:教案|试卷|讲义|课件|课程|文件|文档|脚本|配置|程序|报告|表格|清单)[^\n。.!!??]{0,8}(?:内容)?[::]/
|
|
90
94
|
];
|
|
91
95
|
function detectsHallucinatedFileOp(content) {
|
|
92
96
|
return HALLUCINATION_PATTERNS.some((pattern) => pattern.test(content));
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
} from "./chunk-T2NL5ZIA.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C46JMUDC.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YUA2KL7W.js";
|
|
12
12
|
import {
|
|
13
13
|
getDangerLevel,
|
|
14
14
|
isFileWriteTool,
|
|
15
15
|
runLeanAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5UR6ZOF4.js";
|
|
17
17
|
import {
|
|
18
18
|
EnvLoader,
|
|
19
19
|
NetworkError,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
SUBAGENT_ALLOWED_TOOLS,
|
|
27
27
|
SUBAGENT_DEFAULT_MAX_ROUNDS,
|
|
28
28
|
SUBAGENT_MAX_ROUNDS_LIMIT
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SDT4DCNX.js";
|
|
30
30
|
import {
|
|
31
31
|
fileCheckpoints
|
|
32
32
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -222,12 +222,12 @@ Important rules:
|
|
|
222
222
|
3. Multiple commands can be combined with semicolons in a single call to reduce rounds.
|
|
223
223
|
4. To delete directories, use Remove-Item -Recurse (the system will automatically optimize to a more reliable method).
|
|
224
224
|
5. IMPORTANT: On Windows, "curl" is an alias for Invoke-WebRequest and does NOT support curl flags like -s, -X, -H. Use Invoke-RestMethod instead for HTTP requests. Example: Invoke-RestMethod -Uri "http://localhost:3000/api/health" -Method Get
|
|
225
|
-
6.
|
|
225
|
+
6. NEVER run long-running / never-exiting commands through bash \u2014 they block until timeout. This includes starting an Android emulator (emulator -avd X), streaming logs (adb logcat), and dev servers (node server.js, npm run dev, metro / react-native start). Use the 'task_create' tool to run these in the background, then poll status with short bash calls (e.g. adb shell getprop sys.boot_completed).` : `Execute commands in ${SHELL}.
|
|
226
226
|
Important rules:
|
|
227
227
|
1. Each bash call runs in an independent subprocess; cd commands do not persist. To run in a specific directory, use the cwd parameter, or combine commands: e.g. "cd mydir && ls" or "mkdir -p mydir && touch mydir/file.txt".
|
|
228
228
|
2. If a command fails (returns an error or non-zero exit code), stop immediately, report the error to the user, and do not retry the same or similar commands.
|
|
229
229
|
3. Multiple commands can be combined with && in a single call to reduce rounds.
|
|
230
|
-
4.
|
|
230
|
+
4. NEVER run long-running / never-exiting commands through bash \u2014 they block until timeout. This includes starting an Android emulator (emulator -avd X), streaming logs (adb logcat), and dev servers (node server.js, npm run dev, metro / react-native start). Use the 'task_create' tool to run these in the background, then poll status with short bash calls (e.g. adb shell getprop sys.boot_completed).`,
|
|
231
231
|
parameters: {
|
|
232
232
|
command: {
|
|
233
233
|
type: "string",
|
|
@@ -256,6 +256,10 @@ Important rules:
|
|
|
256
256
|
if (!command.trim()) {
|
|
257
257
|
throw new ToolError("bash", "command is required");
|
|
258
258
|
}
|
|
259
|
+
const blockingHint = detectBlockingCommand(command);
|
|
260
|
+
if (blockingHint) {
|
|
261
|
+
throw new ToolError("bash", blockingHint);
|
|
262
|
+
}
|
|
259
263
|
let currentCwd = getCwd();
|
|
260
264
|
if (!existsSync2(currentCwd)) {
|
|
261
265
|
const fallback = process.cwd();
|
|
@@ -442,6 +446,28 @@ function buildErrorHint(command, stderr) {
|
|
|
442
446
|
}
|
|
443
447
|
return hints.length > 0 ? hints.map((h) => `\u{1F4A1} ${h}`).join("\n\n") : null;
|
|
444
448
|
}
|
|
449
|
+
function detectBlockingCommand(command) {
|
|
450
|
+
if (/\bemulator(?:\.exe)?\b/i.test(command) && /(?:^|\s)(?:-avd\b|@[\w.-]+)/.test(command)) {
|
|
451
|
+
return blockingMessage("emulator -avd <name>", "launch an Android emulator");
|
|
452
|
+
}
|
|
453
|
+
const logcat = command.match(/\badb\b[^|;&\n]*\blogcat\b([^|;&\n]*)/i);
|
|
454
|
+
if (logcat && !/(?:^|\s)-(?:d|t|c|g)\b/.test(logcat[1] ?? "")) {
|
|
455
|
+
return blockingMessage("adb logcat", "stream device logs");
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
function blockingMessage(example, what) {
|
|
460
|
+
return `This command (${example}) is used to ${what}, which runs forever and never exits on its own. Running it through 'bash' will BLOCK until the tool times out, and the timeout cleanup (taskkill /T) then kills the very emulator/process you just started \u2014 so it can never stay up.
|
|
461
|
+
|
|
462
|
+
Use the 'task_create' tool to run it in the background instead, e.g.:
|
|
463
|
+
task_create(command: "${example} ...", description: "${what}")
|
|
464
|
+
|
|
465
|
+
Then poll readiness with SHORT bash calls (these DO exit), e.g.:
|
|
466
|
+
adb devices # is the device/emulator listed?
|
|
467
|
+
adb shell getprop sys.boot_completed # prints "1" once the emulator is fully booted
|
|
468
|
+
|
|
469
|
+
[Do NOT run this long-running command through bash \u2014 it will hang.]`;
|
|
470
|
+
}
|
|
445
471
|
function snapshotDir(dir) {
|
|
446
472
|
try {
|
|
447
473
|
return new Set(readdirSync(dir).map((name) => resolve(dir, name)));
|
|
@@ -4544,15 +4570,30 @@ function stopTask(id) {
|
|
|
4544
4570
|
const task = tasks.get(id);
|
|
4545
4571
|
if (!task || task.status !== "running") return false;
|
|
4546
4572
|
try {
|
|
4547
|
-
task.process
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
}
|
|
4573
|
+
const proc = task.process;
|
|
4574
|
+
if (platform3() === "win32" && proc.pid) {
|
|
4575
|
+
try {
|
|
4576
|
+
spawn3("taskkill", ["/PID", String(proc.pid), "/T", "/F"], {
|
|
4577
|
+
windowsHide: true,
|
|
4578
|
+
stdio: "ignore"
|
|
4579
|
+
});
|
|
4580
|
+
} catch {
|
|
4554
4581
|
}
|
|
4555
|
-
|
|
4582
|
+
try {
|
|
4583
|
+
proc.kill();
|
|
4584
|
+
} catch {
|
|
4585
|
+
}
|
|
4586
|
+
} else {
|
|
4587
|
+
proc.kill("SIGTERM");
|
|
4588
|
+
setTimeout(() => {
|
|
4589
|
+
if (proc.exitCode === null && proc.signalCode === null) {
|
|
4590
|
+
try {
|
|
4591
|
+
proc.kill("SIGKILL");
|
|
4592
|
+
} catch {
|
|
4593
|
+
}
|
|
4594
|
+
}
|
|
4595
|
+
}, 3e3).unref();
|
|
4596
|
+
}
|
|
4556
4597
|
task.status = "stopped";
|
|
4557
4598
|
task.endTime = Date.now();
|
|
4558
4599
|
return true;
|
|
@@ -4565,7 +4606,7 @@ function stopTask(id) {
|
|
|
4565
4606
|
var taskCreateTool = {
|
|
4566
4607
|
definition: {
|
|
4567
4608
|
name: "task_create",
|
|
4568
|
-
description: `Start a command running in the background
|
|
4609
|
+
description: `Start a command running in the background and return immediately with a task ID (monitor via task_list, stop via task_stop). Use this for ANY long-running or never-exiting command, including: dev servers (npm run dev, metro / react-native start), Android emulator launch (emulator -avd X), device log streaming (adb logcat), file watchers, and builds you want to monitor while continuing other work. Running such commands via 'bash' instead would block until timeout.`,
|
|
4569
4610
|
parameters: {
|
|
4570
4611
|
command: {
|
|
4571
4612
|
type: "string",
|
|
@@ -6,15 +6,15 @@ import {
|
|
|
6
6
|
} from "./chunk-HLWUDRBO.js";
|
|
7
7
|
import {
|
|
8
8
|
ProviderRegistry
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-JP6ESDV7.js";
|
|
10
|
+
import "./chunk-5UR6ZOF4.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QT5SGLTM.js";
|
|
14
14
|
import "./chunk-TZQHYZKT.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-SDT4DCNX.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/ci.ts
|
|
20
20
|
import { execFileSync, execSync } from "child_process";
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IAWXC2SO.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-JP6ESDV7.js";
|
|
9
9
|
import {
|
|
10
10
|
getStatsSnapshot,
|
|
11
11
|
getTopFailingTools,
|
|
12
12
|
getTopUsedTools,
|
|
13
13
|
resetStats
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-YUA2KL7W.js";
|
|
15
|
+
import "./chunk-5UR6ZOF4.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QT5SGLTM.js";
|
|
19
19
|
import "./chunk-TZQHYZKT.js";
|
|
20
20
|
import {
|
|
21
21
|
DEV_STATE_FILE_NAME,
|
|
22
22
|
MEMORY_FILE_NAME,
|
|
23
23
|
VERSION
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-SDT4DCNX.js";
|
|
25
25
|
import "./chunk-IW3Q7AE5.js";
|
|
26
26
|
|
|
27
27
|
// src/diagnostics/doctor-cli.ts
|
package/dist/electron-server.js
CHANGED
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
VERSION,
|
|
37
37
|
buildUserIdentityPrompt,
|
|
38
38
|
runTestsTool
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-WFGCP2GF.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
@@ -1591,10 +1591,14 @@ var HALLUCINATION_PATTERNS = [
|
|
|
1591
1591
|
// 已成功保存 / 已成功写入 / 已成功创建
|
|
1592
1592
|
/保存[到至]了?\s*[`'"]/,
|
|
1593
1593
|
// 保存到了 `path` / 保存至 'path'
|
|
1594
|
-
|
|
1595
|
-
//
|
|
1596
|
-
|
|
1597
|
-
//
|
|
1594
|
+
// 「教案/文件…内容如下:」后跟正文 dump。要求紧邻一个**文档类名词**——否则
|
|
1595
|
+
// “这张图片的内容如下:”这类纯描述会被误判成虚假写入声明,在加载了写文件工具的
|
|
1596
|
+
// 普通对话/视觉问答里白触发一轮重试(v0.4.200 实战:GLM-5V-Turbo 描述图片时命中
|
|
1597
|
+
// 裸 `内容如下:`)。文档名词覆盖本应用实际生成的产物(教案/试卷/讲义…)。
|
|
1598
|
+
/(?:文件|教案|试卷|讲义|课件|课程|文档|脚本|配置|程序|报告|表格|清单|笔记)[^\n。.!!??]{0,8}内容如下[::]/,
|
|
1599
|
+
// 以下是xx教案[内容]:(Kimi 常见 dump 模式)。同样要求文档类名词,排除
|
|
1600
|
+
// “以下是图片的内容:”“以下是修改后的内容:”这类描述/对话。
|
|
1601
|
+
/以下是[^\n。.!!??]*?(?:教案|试卷|讲义|课件|课程|文件|文档|脚本|配置|程序|报告|表格|清单)[^\n。.!!??]{0,8}(?:内容)?[::]/
|
|
1598
1602
|
];
|
|
1599
1603
|
function detectsHallucinatedFileOp(content) {
|
|
1600
1604
|
return HALLUCINATION_PATTERNS.some((pattern) => pattern.test(content));
|
|
@@ -4867,12 +4871,12 @@ Important rules:
|
|
|
4867
4871
|
3. Multiple commands can be combined with semicolons in a single call to reduce rounds.
|
|
4868
4872
|
4. To delete directories, use Remove-Item -Recurse (the system will automatically optimize to a more reliable method).
|
|
4869
4873
|
5. IMPORTANT: On Windows, "curl" is an alias for Invoke-WebRequest and does NOT support curl flags like -s, -X, -H. Use Invoke-RestMethod instead for HTTP requests. Example: Invoke-RestMethod -Uri "http://localhost:3000/api/health" -Method Get
|
|
4870
|
-
6.
|
|
4874
|
+
6. NEVER run long-running / never-exiting commands through bash \u2014 they block until timeout. This includes starting an Android emulator (emulator -avd X), streaming logs (adb logcat), and dev servers (node server.js, npm run dev, metro / react-native start). Use the 'task_create' tool to run these in the background, then poll status with short bash calls (e.g. adb shell getprop sys.boot_completed).` : `Execute commands in ${SHELL}.
|
|
4871
4875
|
Important rules:
|
|
4872
4876
|
1. Each bash call runs in an independent subprocess; cd commands do not persist. To run in a specific directory, use the cwd parameter, or combine commands: e.g. "cd mydir && ls" or "mkdir -p mydir && touch mydir/file.txt".
|
|
4873
4877
|
2. If a command fails (returns an error or non-zero exit code), stop immediately, report the error to the user, and do not retry the same or similar commands.
|
|
4874
4878
|
3. Multiple commands can be combined with && in a single call to reduce rounds.
|
|
4875
|
-
4.
|
|
4879
|
+
4. NEVER run long-running / never-exiting commands through bash \u2014 they block until timeout. This includes starting an Android emulator (emulator -avd X), streaming logs (adb logcat), and dev servers (node server.js, npm run dev, metro / react-native start). Use the 'task_create' tool to run these in the background, then poll status with short bash calls (e.g. adb shell getprop sys.boot_completed).`,
|
|
4876
4880
|
parameters: {
|
|
4877
4881
|
command: {
|
|
4878
4882
|
type: "string",
|
|
@@ -4901,6 +4905,10 @@ Important rules:
|
|
|
4901
4905
|
if (!command.trim()) {
|
|
4902
4906
|
throw new ToolError("bash", "command is required");
|
|
4903
4907
|
}
|
|
4908
|
+
const blockingHint = detectBlockingCommand(command);
|
|
4909
|
+
if (blockingHint) {
|
|
4910
|
+
throw new ToolError("bash", blockingHint);
|
|
4911
|
+
}
|
|
4904
4912
|
let currentCwd = getCwd();
|
|
4905
4913
|
if (!existsSync4(currentCwd)) {
|
|
4906
4914
|
const fallback = process.cwd();
|
|
@@ -5087,6 +5095,28 @@ function buildErrorHint(command, stderr) {
|
|
|
5087
5095
|
}
|
|
5088
5096
|
return hints.length > 0 ? hints.map((h) => `\u{1F4A1} ${h}`).join("\n\n") : null;
|
|
5089
5097
|
}
|
|
5098
|
+
function detectBlockingCommand(command) {
|
|
5099
|
+
if (/\bemulator(?:\.exe)?\b/i.test(command) && /(?:^|\s)(?:-avd\b|@[\w.-]+)/.test(command)) {
|
|
5100
|
+
return blockingMessage("emulator -avd <name>", "launch an Android emulator");
|
|
5101
|
+
}
|
|
5102
|
+
const logcat = command.match(/\badb\b[^|;&\n]*\blogcat\b([^|;&\n]*)/i);
|
|
5103
|
+
if (logcat && !/(?:^|\s)-(?:d|t|c|g)\b/.test(logcat[1] ?? "")) {
|
|
5104
|
+
return blockingMessage("adb logcat", "stream device logs");
|
|
5105
|
+
}
|
|
5106
|
+
return null;
|
|
5107
|
+
}
|
|
5108
|
+
function blockingMessage(example, what) {
|
|
5109
|
+
return `This command (${example}) is used to ${what}, which runs forever and never exits on its own. Running it through 'bash' will BLOCK until the tool times out, and the timeout cleanup (taskkill /T) then kills the very emulator/process you just started \u2014 so it can never stay up.
|
|
5110
|
+
|
|
5111
|
+
Use the 'task_create' tool to run it in the background instead, e.g.:
|
|
5112
|
+
task_create(command: "${example} ...", description: "${what}")
|
|
5113
|
+
|
|
5114
|
+
Then poll readiness with SHORT bash calls (these DO exit), e.g.:
|
|
5115
|
+
adb devices # is the device/emulator listed?
|
|
5116
|
+
adb shell getprop sys.boot_completed # prints "1" once the emulator is fully booted
|
|
5117
|
+
|
|
5118
|
+
[Do NOT run this long-running command through bash \u2014 it will hang.]`;
|
|
5119
|
+
}
|
|
5090
5120
|
function snapshotDir(dir) {
|
|
5091
5121
|
try {
|
|
5092
5122
|
return new Set(readdirSync2(dir).map((name) => resolve(dir, name)));
|
|
@@ -9237,15 +9267,30 @@ function stopTask(id) {
|
|
|
9237
9267
|
const task = tasks.get(id);
|
|
9238
9268
|
if (!task || task.status !== "running") return false;
|
|
9239
9269
|
try {
|
|
9240
|
-
task.process
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
}
|
|
9270
|
+
const proc = task.process;
|
|
9271
|
+
if (platform3() === "win32" && proc.pid) {
|
|
9272
|
+
try {
|
|
9273
|
+
spawn3("taskkill", ["/PID", String(proc.pid), "/T", "/F"], {
|
|
9274
|
+
windowsHide: true,
|
|
9275
|
+
stdio: "ignore"
|
|
9276
|
+
});
|
|
9277
|
+
} catch {
|
|
9278
|
+
}
|
|
9279
|
+
try {
|
|
9280
|
+
proc.kill();
|
|
9281
|
+
} catch {
|
|
9247
9282
|
}
|
|
9248
|
-
}
|
|
9283
|
+
} else {
|
|
9284
|
+
proc.kill("SIGTERM");
|
|
9285
|
+
setTimeout(() => {
|
|
9286
|
+
if (proc.exitCode === null && proc.signalCode === null) {
|
|
9287
|
+
try {
|
|
9288
|
+
proc.kill("SIGKILL");
|
|
9289
|
+
} catch {
|
|
9290
|
+
}
|
|
9291
|
+
}
|
|
9292
|
+
}, 3e3).unref();
|
|
9293
|
+
}
|
|
9249
9294
|
task.status = "stopped";
|
|
9250
9295
|
task.endTime = Date.now();
|
|
9251
9296
|
return true;
|
|
@@ -9258,7 +9303,7 @@ function stopTask(id) {
|
|
|
9258
9303
|
var taskCreateTool = {
|
|
9259
9304
|
definition: {
|
|
9260
9305
|
name: "task_create",
|
|
9261
|
-
description: `Start a command running in the background
|
|
9306
|
+
description: `Start a command running in the background and return immediately with a task ID (monitor via task_list, stop via task_stop). Use this for ANY long-running or never-exiting command, including: dev servers (npm run dev, metro / react-native start), Android emulator launch (emulator -avd X), device log streaming (adb logcat), file watchers, and builds you want to monitor while continuing other work. Running such commands via 'bash' instead would block until timeout.`,
|
|
9262
9307
|
parameters: {
|
|
9263
9308
|
command: {
|
|
9264
9309
|
type: "string",
|
|
@@ -14247,7 +14292,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
14247
14292
|
case "test": {
|
|
14248
14293
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
14249
14294
|
try {
|
|
14250
|
-
const { executeTests } = await import("./run-tests-
|
|
14295
|
+
const { executeTests } = await import("./run-tests-T4NPP36U.js");
|
|
14251
14296
|
const argStr = args.join(" ").trim();
|
|
14252
14297
|
let testArgs = {};
|
|
14253
14298
|
if (argStr) {
|
|
@@ -154,7 +154,7 @@ ${content}`);
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
async function runTaskMode(config, providers, configManager, topic) {
|
|
157
|
-
const { TaskOrchestrator } = await import("./task-orchestrator-
|
|
157
|
+
const { TaskOrchestrator } = await import("./task-orchestrator-BS2FKLGM.js");
|
|
158
158
|
const orchestrator = new TaskOrchestrator(config, providers, configManager);
|
|
159
159
|
let interrupted = false;
|
|
160
160
|
const onSigint = () => {
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
saveDevState,
|
|
16
16
|
sessionHasMeaningfulContent,
|
|
17
17
|
setupProxy
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3UWMMYCQ.js";
|
|
19
19
|
import {
|
|
20
20
|
ToolExecutor,
|
|
21
21
|
ToolRegistry,
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
spawnAgentContext,
|
|
36
36
|
theme,
|
|
37
37
|
undoStack
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-HLOHSMTT.js";
|
|
39
39
|
import "./chunk-T2NL5ZIA.js";
|
|
40
40
|
import "./chunk-BXP6YZ2P.js";
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-C46JMUDC.js";
|
|
42
42
|
import {
|
|
43
43
|
SessionManager,
|
|
44
44
|
getContentText
|
|
@@ -55,16 +55,16 @@ import {
|
|
|
55
55
|
getConfigDirUsage,
|
|
56
56
|
listRecentCrashes,
|
|
57
57
|
writeCrashLog
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-IAWXC2SO.js";
|
|
59
59
|
import {
|
|
60
60
|
ProviderRegistry
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-JP6ESDV7.js";
|
|
62
62
|
import {
|
|
63
63
|
getStatsSnapshot,
|
|
64
64
|
getTopFailingTools,
|
|
65
65
|
getTopUsedTools,
|
|
66
66
|
installFlushOnExit
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-YUA2KL7W.js";
|
|
68
68
|
import {
|
|
69
69
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
70
70
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -82,10 +82,10 @@ import {
|
|
|
82
82
|
runAgentLoop,
|
|
83
83
|
stripToolCallReminder,
|
|
84
84
|
teeStreamErrorSummary
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-5UR6ZOF4.js";
|
|
86
86
|
import {
|
|
87
87
|
ConfigManager
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-QT5SGLTM.js";
|
|
89
89
|
import {
|
|
90
90
|
AuthError,
|
|
91
91
|
ProviderError,
|
|
@@ -112,7 +112,7 @@ import {
|
|
|
112
112
|
SKILLS_DIR_NAME,
|
|
113
113
|
VERSION,
|
|
114
114
|
buildUserIdentityPrompt
|
|
115
|
-
} from "./chunk-
|
|
115
|
+
} from "./chunk-SDT4DCNX.js";
|
|
116
116
|
import {
|
|
117
117
|
formatGitContextForPrompt,
|
|
118
118
|
getGitContext,
|
|
@@ -1827,7 +1827,7 @@ No tools match "${filter}".
|
|
|
1827
1827
|
const { join: join5 } = await import("path");
|
|
1828
1828
|
const { existsSync: existsSync5 } = await import("fs");
|
|
1829
1829
|
const { getGitRoot: getGitRoot2 } = await import("./git-context-EXOEHQSF.js");
|
|
1830
|
-
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-
|
|
1830
|
+
const { MCP_PROJECT_CONFIG_NAME: MCP_PROJECT_CONFIG_NAME2 } = await import("./constants-QUKKMYWZ.js");
|
|
1831
1831
|
const { approveProject, hashMcpFile } = await import("./project-trust-NKYHL3VZ.js");
|
|
1832
1832
|
const cwd = process.cwd();
|
|
1833
1833
|
const projectRoot = getGitRoot2(cwd) ?? cwd;
|
|
@@ -2888,7 +2888,7 @@ ${hint}` : "")
|
|
|
2888
2888
|
usage: "/test [command|filter]",
|
|
2889
2889
|
async execute(args, ctx) {
|
|
2890
2890
|
try {
|
|
2891
|
-
const { executeTests } = await import("./run-tests-
|
|
2891
|
+
const { executeTests } = await import("./run-tests-OEPVJDXJ.js");
|
|
2892
2892
|
const argStr = args.join(" ").trim();
|
|
2893
2893
|
let testArgs = {};
|
|
2894
2894
|
if (argStr) {
|
|
@@ -6322,14 +6322,12 @@ Session '${this.resumeSessionId}' not found.
|
|
|
6322
6322
|
stopSpinner();
|
|
6323
6323
|
process.stdout.write(visible);
|
|
6324
6324
|
},
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
//
|
|
6330
|
-
|
|
6331
|
-
process.stdout.write(theme.dim("</think>"));
|
|
6332
|
-
},
|
|
6325
|
+
// think 块彻底静默折叠(东叔偏好,v0.4.169):thinking_start/end 不打印任何
|
|
6326
|
+
// 标记。此前这两个钩子写 dim('<think>')/dim('</think>'),当 provider 经 thinking_*
|
|
6327
|
+
// 事件传 reasoning(delta 已折叠)时,终端就漏出空壳 `<think></think>`——thinking
|
|
6328
|
+
// 模型(GLM-5.2 / GLM-5V-Turbo / DeepSeek thinking…)一律中招,且与 renderStream
|
|
6329
|
+
// 路径(ThinkTagFilter 静默吞)不一致(v0.4.200)。spinner 不在此停,思考期间继续
|
|
6330
|
+
// 转动作活动反馈,首个可见 content / 工具调用到达时由 onText / onToolCallStart 停。
|
|
6333
6331
|
onToolCallStart: (_index, _id, name) => {
|
|
6334
6332
|
stopSpinner();
|
|
6335
6333
|
process.stdout.write(
|
|
@@ -7267,7 +7265,7 @@ program.command("web").description("Start Web UI server with browser-based chat
|
|
|
7267
7265
|
console.error("Error: Invalid port number. Must be between 1 and 65535.");
|
|
7268
7266
|
process.exit(1);
|
|
7269
7267
|
}
|
|
7270
|
-
const { startWebServer } = await import("./server-
|
|
7268
|
+
const { startWebServer } = await import("./server-NBPF74CY.js");
|
|
7271
7269
|
await startWebServer({ port, host: options.host });
|
|
7272
7270
|
});
|
|
7273
7271
|
program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | logout-all <name> | migrate <name>)").action(async (action, username) => {
|
|
@@ -7434,16 +7432,16 @@ program.command("sessions").description("List recent conversation sessions").opt
|
|
|
7434
7432
|
console.log(footer + "\n");
|
|
7435
7433
|
});
|
|
7436
7434
|
program.command("usage").description("Show token + cost usage grouped by provider/model (cross-session)").option("--days <n>", "Only the last N days (inclusive of today)").option("--month <ym>", "Only a specific month, format YYYY-MM (e.g. 2026-06)").option("--json", "Output as JSON (for scripting)").action(async (options) => {
|
|
7437
|
-
const { runUsageCli } = await import("./usage-
|
|
7435
|
+
const { runUsageCli } = await import("./usage-DPM6T4ZZ.js");
|
|
7438
7436
|
await runUsageCli(options);
|
|
7439
7437
|
});
|
|
7440
7438
|
program.command("doctor").description("Health check: API keys, config, MCP, recent crashes, tool usage, disk usage").option("--json", "Output as JSON (for scripting)").option("--reset-stats", "Reset accumulated tool usage statistics").action(async (options) => {
|
|
7441
|
-
const { runDoctorCli } = await import("./doctor-cli-
|
|
7439
|
+
const { runDoctorCli } = await import("./doctor-cli-6XY3PJM5.js");
|
|
7442
7440
|
await runDoctorCli({ json: !!options.json, resetStats: !!options.resetStats });
|
|
7443
7441
|
});
|
|
7444
7442
|
program.command("batch <action> [arg] [arg2]").description("Anthropic Message Batches: submit | list | status <id> | results <id> [out] | cancel <id>").option("--dry-run", "Parse and validate input without submitting (submit only)").action(async (action, arg, arg2, options) => {
|
|
7445
7443
|
try {
|
|
7446
|
-
const batch = await import("./batch-
|
|
7444
|
+
const batch = await import("./batch-SWBDLVZO.js");
|
|
7447
7445
|
switch (action) {
|
|
7448
7446
|
case "submit":
|
|
7449
7447
|
if (!arg) {
|
|
@@ -7486,7 +7484,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
|
|
|
7486
7484
|
}
|
|
7487
7485
|
});
|
|
7488
7486
|
program.command("mcp-serve").description("Start an MCP server over STDIO, exposing aicli's built-in tools to Claude Desktop / Cursor / other MCP clients").option("--allow-destructive", "Allow bash / run_interactive / task_create (always destructive in MCP mode)").option("--allow-outside-cwd", "Allow tool path arguments to escape the sandbox root \u2014 disabled by default").option("--tools <list>", "Comma-separated whitelist of tools to expose (default: all eligible tools)").option("--cwd <path>", "Working directory AND sandbox root (default: current directory)").action(async (options) => {
|
|
7489
|
-
const { startMcpServer } = await import("./server-
|
|
7487
|
+
const { startMcpServer } = await import("./server-TZDUN5V3.js");
|
|
7490
7488
|
await startMcpServer({
|
|
7491
7489
|
allowDestructive: !!options.allowDestructive,
|
|
7492
7490
|
allowOutsideCwd: !!options.allowOutsideCwd,
|
|
@@ -7495,7 +7493,7 @@ program.command("mcp-serve").description("Start an MCP server over STDIO, exposi
|
|
|
7495
7493
|
});
|
|
7496
7494
|
});
|
|
7497
7495
|
program.command("ci").description("Headless PR review (code + security) \u2014 reads git/gh diff, optionally posts to PR. Designed for GitHub Actions.").option("--pr <num>", "PR number; diff fetched via `gh pr diff <num>`", (v) => parseInt(v, 10)).option("--base <ref>", "Base ref for `git diff <ref>...HEAD` (ignored when --pr set)").option("--post", "Post review as a PR comment (requires gh CLI + GH_TOKEN, needs --pr)").option("--no-update", "Always create a new comment instead of updating the previous aicli review").option("--skip-code", "Skip the code review section").option("--skip-security", "Skip the security review section").option("--detailed", "Use the detailed code-review prompt").option("--max-diff <n>", "Max diff chars sent to the model (default 30000)", (v) => parseInt(v, 10)).option("--provider <id>", "Override provider (default: config.defaultProvider)").option("--model <id>", "Override model").option("--dry-run", "Print result to stdout instead of posting (overrides --post)").action(async (options) => {
|
|
7498
|
-
const { runCi } = await import("./ci-
|
|
7496
|
+
const { runCi } = await import("./ci-O3JM5YAA.js");
|
|
7499
7497
|
const result = await runCi({
|
|
7500
7498
|
pr: options.pr,
|
|
7501
7499
|
base: options.base,
|
|
@@ -7641,7 +7639,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
|
|
|
7641
7639
|
}),
|
|
7642
7640
|
config.get("customProviders")
|
|
7643
7641
|
);
|
|
7644
|
-
const { startHub } = await import("./hub-
|
|
7642
|
+
const { startHub } = await import("./hub-HJTJM2RT.js");
|
|
7645
7643
|
await startHub(
|
|
7646
7644
|
{
|
|
7647
7645
|
topic: topic ?? "",
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
loadDevState,
|
|
20
20
|
persistToolRound,
|
|
21
21
|
setupProxy
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3UWMMYCQ.js";
|
|
23
23
|
import {
|
|
24
24
|
ToolExecutor,
|
|
25
25
|
ToolRegistry,
|
|
@@ -38,10 +38,10 @@ import {
|
|
|
38
38
|
spawnAgentContext,
|
|
39
39
|
truncateOutput,
|
|
40
40
|
undoStack
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-HLOHSMTT.js";
|
|
42
42
|
import "./chunk-T2NL5ZIA.js";
|
|
43
43
|
import "./chunk-BXP6YZ2P.js";
|
|
44
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-C46JMUDC.js";
|
|
45
45
|
import {
|
|
46
46
|
SessionManager,
|
|
47
47
|
getContentText
|
|
@@ -52,10 +52,10 @@ import {
|
|
|
52
52
|
} from "./chunk-E44DTERW.js";
|
|
53
53
|
import {
|
|
54
54
|
ProviderRegistry
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-JP6ESDV7.js";
|
|
56
56
|
import {
|
|
57
57
|
runTool
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-YUA2KL7W.js";
|
|
59
59
|
import {
|
|
60
60
|
CONTENT_ONLY_STREAM_REMINDER,
|
|
61
61
|
TEE_FINAL_USER_NUDGE,
|
|
@@ -70,10 +70,10 @@ import {
|
|
|
70
70
|
runAgentLoop,
|
|
71
71
|
stripToolCallReminder,
|
|
72
72
|
teeStreamErrorSummary
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-5UR6ZOF4.js";
|
|
74
74
|
import {
|
|
75
75
|
ConfigManager
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-QT5SGLTM.js";
|
|
77
77
|
import "./chunk-TZQHYZKT.js";
|
|
78
78
|
import {
|
|
79
79
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
@@ -93,7 +93,7 @@ import {
|
|
|
93
93
|
SKILLS_DIR_NAME,
|
|
94
94
|
VERSION,
|
|
95
95
|
buildUserIdentityPrompt
|
|
96
|
-
} from "./chunk-
|
|
96
|
+
} from "./chunk-SDT4DCNX.js";
|
|
97
97
|
import {
|
|
98
98
|
formatGitContextForPrompt,
|
|
99
99
|
getGitContext,
|
|
@@ -2454,7 +2454,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
2454
2454
|
case "test": {
|
|
2455
2455
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
2456
2456
|
try {
|
|
2457
|
-
const { executeTests } = await import("./run-tests-
|
|
2457
|
+
const { executeTests } = await import("./run-tests-OEPVJDXJ.js");
|
|
2458
2458
|
const argStr = args.join(" ").trim();
|
|
2459
2459
|
let testArgs = {};
|
|
2460
2460
|
if (argStr) {
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ToolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-HLOHSMTT.js";
|
|
5
5
|
import "./chunk-T2NL5ZIA.js";
|
|
6
6
|
import "./chunk-BXP6YZ2P.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-C46JMUDC.js";
|
|
8
8
|
import {
|
|
9
9
|
runTool
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YUA2KL7W.js";
|
|
11
11
|
import {
|
|
12
12
|
getDangerLevel,
|
|
13
13
|
schemaToJsonSchema
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-5UR6ZOF4.js";
|
|
15
15
|
import "./chunk-TZQHYZKT.js";
|
|
16
16
|
import {
|
|
17
17
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SDT4DCNX.js";
|
|
19
19
|
import "./chunk-4BKXL7SM.js";
|
|
20
20
|
import "./chunk-TB4W4Y4T.js";
|
|
21
21
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
ToolRegistry,
|
|
4
4
|
googleSearchContext,
|
|
5
5
|
truncateOutput
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HLOHSMTT.js";
|
|
7
7
|
import "./chunk-T2NL5ZIA.js";
|
|
8
8
|
import "./chunk-BXP6YZ2P.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-C46JMUDC.js";
|
|
10
10
|
import {
|
|
11
11
|
runTool
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-YUA2KL7W.js";
|
|
13
13
|
import {
|
|
14
14
|
getDangerLevel,
|
|
15
15
|
runLeanAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5UR6ZOF4.js";
|
|
17
17
|
import "./chunk-TZQHYZKT.js";
|
|
18
18
|
import {
|
|
19
19
|
SUBAGENT_ALLOWED_TOOLS
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-SDT4DCNX.js";
|
|
21
21
|
import "./chunk-4BKXL7SM.js";
|
|
22
22
|
import "./chunk-TB4W4Y4T.js";
|
|
23
23
|
import "./chunk-KHYD3WXE.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
} from "./chunk-E44DTERW.js";
|
|
9
9
|
import {
|
|
10
10
|
ConfigManager
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QT5SGLTM.js";
|
|
12
12
|
import "./chunk-TZQHYZKT.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-SDT4DCNX.js";
|
|
14
14
|
import "./chunk-IW3Q7AE5.js";
|
|
15
15
|
|
|
16
16
|
// src/cli/usage.ts
|