jinzd-ai-cli 0.4.205 → 0.4.207
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 -1
- package/dist/{batch-RBPABHS7.js → batch-6PORMJWT.js} +2 -2
- package/dist/{chunk-XIYSFN4U.js → chunk-2WV6AGHM.js} +1 -1
- package/dist/{chunk-43H3D2PK.js → chunk-BQIV4ZQT.js} +1 -1
- package/dist/{chunk-JVYH66N2.js → chunk-KJHMRAJU.js} +1 -1
- package/dist/{chunk-ZSC4YLEJ.js → chunk-KOU4KX7J.js} +2 -2
- package/dist/{chunk-UZISJ3KZ.js → chunk-QMXC327F.js} +3 -3
- package/dist/{chunk-3RET7PL7.js → chunk-QNUVZO5X.js} +1 -1
- package/dist/{chunk-43MWRT2C.js → chunk-QQYSZMET.js} +20 -17
- package/dist/{chunk-VOV2PWZU.js → chunk-SFCNFX42.js} +1 -1
- package/dist/{chunk-TZ7SNVSG.js → chunk-TW47X5AO.js} +1 -1
- package/dist/{chunk-SMFRJCXB.js → chunk-XPBEJB27.js} +8 -1
- package/dist/{ci-ABE74AXH.js → ci-AYMV66P3.js} +9 -9
- package/dist/{constants-GMQMJRIO.js → constants-NHGTSHKT.js} +1 -1
- package/dist/{doctor-cli-M5PPO3L3.js → doctor-cli-WKH7T4AW.js} +6 -6
- package/dist/electron-server.js +46 -41
- package/dist/{hub-NCU5JNCK.js → hub-6R3M3NTC.js} +1 -1
- package/dist/index.js +102 -98
- package/dist/{run-tests-ZFAEFEYK.js → run-tests-5F2OBWIK.js} +2 -2
- package/dist/{run-tests-FGRWBNVF.js → run-tests-NBCA4KEG.js} +1 -1
- package/dist/{server-RKP7JRRE.js → server-37EXC4EB.js} +5 -5
- package/dist/{server-ML6ZL3J5.js → server-L2MXWYF7.js} +26 -26
- package/dist/{task-orchestrator-LJP5XZSC.js → task-orchestrator-2DTDVCMR.js} +5 -5
- package/dist/{usage-YX2235W5.js → usage-SZWZFX3T.js} +2 -2
- package/dist/web/client/actions.js +84 -0
- package/dist/web/client/app.js +23 -205
- package/dist/web/client/index.html +27 -42
- package/dist/web/client/sw.js +1 -1
- package/dist/web/client/templates.js +188 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ Use `@filepath` to reference files or images directly in your prompt.
|
|
|
100
100
|
### Web UI
|
|
101
101
|
|
|
102
102
|
```bash
|
|
103
|
-
aicli web # Start on localhost:
|
|
103
|
+
aicli web # Start on localhost:3000
|
|
104
104
|
aicli web --port 8080 # Custom port
|
|
105
105
|
aicli web --host 0.0.0.0 # LAN access (shows QR-friendly URL)
|
|
106
106
|
```
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TW47X5AO.js";
|
|
5
5
|
import "./chunk-TZQHYZKT.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-QNUVZO5X.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-QQYSZMET.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-QNUVZO5X.js";
|
|
15
15
|
|
|
16
16
|
// src/mcp/client.ts
|
|
17
17
|
import { spawn } from "child_process";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
detectsHallucinatedFileOp,
|
|
4
4
|
repairToolCallArguments,
|
|
5
5
|
schemaToJsonSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XPBEJB27.js";
|
|
7
7
|
import {
|
|
8
8
|
AuthError,
|
|
9
9
|
ProviderError,
|
|
@@ -31,8 +31,8 @@ var BaseProvider = class {
|
|
|
31
31
|
* 将 Message[] 转换为 OpenAI API 格式的消息数组。
|
|
32
32
|
* content 为 string 时直接传递;为 MessageContentPart[] 时保留数组格式(vision 请求)。
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* 基类只提供降级格式:跳过 role='tool' 和带 toolCalls 的 assistant 消息。
|
|
35
|
+
* 需要完整工具历史 roundtrip 的 provider 应覆盖消息构造逻辑,例如 OpenAI-compatible provider。
|
|
36
36
|
*/
|
|
37
37
|
normalizeMessages(messages) {
|
|
38
38
|
return messages.filter((m) => m.role !== "tool" && !m.toolCalls).map((m) => ({ role: m.role, content: m.content }));
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
} from "./chunk-T2NL5ZIA.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SFCNFX42.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2WV6AGHM.js";
|
|
12
12
|
import {
|
|
13
13
|
getDangerLevel,
|
|
14
14
|
isFileWriteTool,
|
|
15
15
|
runLeanAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XPBEJB27.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-QNUVZO5X.js";
|
|
30
30
|
import {
|
|
31
31
|
fileCheckpoints
|
|
32
32
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -40,6 +40,9 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
loadIndex
|
|
42
42
|
} from "./chunk-CKH4KQ4E.js";
|
|
43
|
+
import {
|
|
44
|
+
atomicWriteFileSync
|
|
45
|
+
} from "./chunk-IW3Q7AE5.js";
|
|
43
46
|
|
|
44
47
|
// src/tools/builtin/bash.ts
|
|
45
48
|
import { spawn } from "child_process";
|
|
@@ -1047,7 +1050,7 @@ ${content}`;
|
|
|
1047
1050
|
};
|
|
1048
1051
|
|
|
1049
1052
|
// src/tools/builtin/write-file.ts
|
|
1050
|
-
import {
|
|
1053
|
+
import { appendFileSync, mkdirSync } from "fs";
|
|
1051
1054
|
import { dirname as dirname2 } from "path";
|
|
1052
1055
|
|
|
1053
1056
|
// src/tools/executor.ts
|
|
@@ -1522,8 +1525,8 @@ var ToolExecutor = class {
|
|
|
1522
1525
|
/** confirm() 的取消回调,由 SIGINT handler 调用 */
|
|
1523
1526
|
cancelConfirmFn = null;
|
|
1524
1527
|
/**
|
|
1525
|
-
* 会话级 auto-approve
|
|
1526
|
-
*
|
|
1528
|
+
* 会话级 auto-approve:跳过 write 确认(仅当前会话有效)。
|
|
1529
|
+
* destructive 操作仍然必须逐次确认。
|
|
1527
1530
|
*/
|
|
1528
1531
|
sessionAutoApprove = false;
|
|
1529
1532
|
/**
|
|
@@ -1607,7 +1610,7 @@ var ToolExecutor = class {
|
|
|
1607
1610
|
}
|
|
1608
1611
|
}
|
|
1609
1612
|
}
|
|
1610
|
-
if (this.sessionAutoApprove && dangerLevel
|
|
1613
|
+
if (this.sessionAutoApprove && dangerLevel === "write") {
|
|
1611
1614
|
this.printToolCall(call);
|
|
1612
1615
|
if (dangerLevel === "write") this.printDiffPreview(call);
|
|
1613
1616
|
console.log(theme.warning(" \u26A1 Auto-approved (session /yolo mode)"));
|
|
@@ -2136,7 +2139,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
2136
2139
|
if (appendMode) {
|
|
2137
2140
|
appendFileSync(filePath, content, encoding);
|
|
2138
2141
|
} else {
|
|
2139
|
-
|
|
2142
|
+
atomicWriteFileSync(filePath, content);
|
|
2140
2143
|
}
|
|
2141
2144
|
const lines = content.split("\n").length;
|
|
2142
2145
|
const mode = appendMode ? "appended" : "written";
|
|
@@ -2152,7 +2155,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
2152
2155
|
};
|
|
2153
2156
|
|
|
2154
2157
|
// src/tools/builtin/edit-file.ts
|
|
2155
|
-
import { readFileSync as readFileSync4,
|
|
2158
|
+
import { readFileSync as readFileSync4, existsSync as existsSync5 } from "fs";
|
|
2156
2159
|
|
|
2157
2160
|
// src/tools/builtin/patch-apply.ts
|
|
2158
2161
|
function parseUnifiedDiff(patch) {
|
|
@@ -2551,7 +2554,7 @@ Note: Path can be absolute or relative to cwd.`,
|
|
|
2551
2554
|
if (res.ok && res.appliedCount > 0 && res.content !== void 0) {
|
|
2552
2555
|
undoStack.push(filePath, `edit_file (patch ${res.appliedCount}/${hunks.length}): ${filePath}`);
|
|
2553
2556
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
2554
|
-
|
|
2557
|
+
atomicWriteFileSync(filePath, res.content);
|
|
2555
2558
|
}
|
|
2556
2559
|
return lines.join("\n");
|
|
2557
2560
|
}
|
|
@@ -2585,7 +2588,7 @@ Note: Path can be absolute or relative to cwd.`,
|
|
|
2585
2588
|
if (writeChanges) {
|
|
2586
2589
|
undoStack.push(filePath, `edit_file (batch ${appliedCount}/${edits.length}): ${filePath}`);
|
|
2587
2590
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
2588
|
-
|
|
2591
|
+
atomicWriteFileSync(filePath, working);
|
|
2589
2592
|
}
|
|
2590
2593
|
const lines = [];
|
|
2591
2594
|
if (anyFailed && stopOnError) {
|
|
@@ -2623,7 +2626,7 @@ Please read the file first and use exact text.`;
|
|
|
2623
2626
|
const label = res.info?.mode === "ignore_whitespace" ? "edit_file (ws-replace)" : res.info?.mode === "replace_all" ? "edit_file (replace_all)" : "edit_file (replace)";
|
|
2624
2627
|
undoStack.push(filePath, `${label}: ${filePath}`);
|
|
2625
2628
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
2626
|
-
|
|
2629
|
+
atomicWriteFileSync(filePath, res.content);
|
|
2627
2630
|
if (res.info?.mode === "replace_all") {
|
|
2628
2631
|
return `Successfully edited ${filePath}${modeLabel}
|
|
2629
2632
|
Replaced: ${res.info.replacedCount} occurrence(s) of ${truncatePreview(oldStr)}
|
|
@@ -2647,7 +2650,7 @@ Please read the file first and use exact text.`;
|
|
|
2647
2650
|
undoStack.push(filePath, `edit_file (insert): ${filePath}`);
|
|
2648
2651
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
2649
2652
|
lines.splice(afterLine, 0, content);
|
|
2650
|
-
|
|
2653
|
+
atomicWriteFileSync(filePath, lines.join("\n"));
|
|
2651
2654
|
return `Successfully inserted ${content.split("\n").length} line(s) after line ${afterLine} in ${filePath}`;
|
|
2652
2655
|
}
|
|
2653
2656
|
if (args["delete_from_line"] !== void 0) {
|
|
@@ -2663,7 +2666,7 @@ Please read the file first and use exact text.`;
|
|
|
2663
2666
|
undoStack.push(filePath, `edit_file (delete): ${filePath}`);
|
|
2664
2667
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
2665
2668
|
const deleted = lines.splice(fromLine - 1, toLine - fromLine + 1);
|
|
2666
|
-
|
|
2669
|
+
atomicWriteFileSync(filePath, lines.join("\n"));
|
|
2667
2670
|
return `Successfully deleted lines ${fromLine}-${toLine} (${deleted.length} lines) from ${filePath}`;
|
|
2668
2671
|
}
|
|
2669
2672
|
throw new ToolError(
|
|
@@ -3868,7 +3871,7 @@ ${preamble}`;
|
|
|
3868
3871
|
}
|
|
3869
3872
|
|
|
3870
3873
|
// src/tools/builtin/save-last-response.ts
|
|
3871
|
-
import {
|
|
3874
|
+
import { mkdirSync as mkdirSync2, unlinkSync as unlinkSync2, rmdirSync as rmdirSync2 } from "fs";
|
|
3872
3875
|
import { dirname as dirname3 } from "path";
|
|
3873
3876
|
var lastResponseStore = { content: "" };
|
|
3874
3877
|
function cleanupRejectedTeeFile(filePath) {
|
|
@@ -3919,7 +3922,7 @@ Any of these triggers means use save_last_response, NOT write_file:
|
|
|
3919
3922
|
}
|
|
3920
3923
|
undoStack.push(filePath, `save_last_response: ${filePath}`);
|
|
3921
3924
|
mkdirSync2(dirname3(filePath), { recursive: true });
|
|
3922
|
-
|
|
3925
|
+
atomicWriteFileSync(filePath, content);
|
|
3923
3926
|
const lines = content.split("\n").length;
|
|
3924
3927
|
return `File saved: ${filePath} (${lines} lines, ${content.length} bytes)`;
|
|
3925
3928
|
}
|
|
@@ -5,7 +5,14 @@ function isFileWriteTool(name) {
|
|
|
5
5
|
return name === "write_file" || name === "edit_file" || name === "notebook_edit";
|
|
6
6
|
}
|
|
7
7
|
function getDangerLevel(toolName, args) {
|
|
8
|
-
if (toolName.startsWith("mcp__"))
|
|
8
|
+
if (toolName.startsWith("mcp__")) {
|
|
9
|
+
const rawName = toolName.split("__").pop() ?? "";
|
|
10
|
+
const normalized = rawName.toLowerCase().replace(/[^a-z0-9]+/g, "_");
|
|
11
|
+
if (/^(read|get|list|search|find|query|fetch|status|describe|inspect|show|lookup)(?:_|$)/.test(normalized)) {
|
|
12
|
+
return "safe";
|
|
13
|
+
}
|
|
14
|
+
return "write";
|
|
15
|
+
}
|
|
9
16
|
if (toolName === "bash") {
|
|
10
17
|
const cmd = String(args["command"] ?? "");
|
|
11
18
|
if (/\brm\s+[^\n]*(?:-\w*[rRfF]\w*|--recursive|--force)\b/.test(cmd)) return "destructive";
|
|
@@ -6,18 +6,18 @@ import {
|
|
|
6
6
|
} from "./chunk-HLWUDRBO.js";
|
|
7
7
|
import {
|
|
8
8
|
ProviderRegistry
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-QMXC327F.js";
|
|
10
|
+
import "./chunk-XPBEJB27.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-TW47X5AO.js";
|
|
14
14
|
import "./chunk-TZQHYZKT.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-QNUVZO5X.js";
|
|
18
18
|
|
|
19
19
|
// src/cli/ci.ts
|
|
20
|
-
import { execFileSync
|
|
20
|
+
import { execFileSync } from "child_process";
|
|
21
21
|
var CI_COMMENT_MARKER = "<!-- aicli-ci-review -->";
|
|
22
22
|
function fetchDiff(opts) {
|
|
23
23
|
if (opts.diffOverride != null) return opts.diffOverride;
|
|
@@ -34,7 +34,8 @@ function fetchDiff(opts) {
|
|
|
34
34
|
}
|
|
35
35
|
if (opts.base) {
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
validateGitRef(opts.base);
|
|
38
|
+
return execFileSync("git", ["diff", `${opts.base}...HEAD`], {
|
|
38
39
|
encoding: "utf-8",
|
|
39
40
|
maxBuffer: 50 * 1024 * 1024,
|
|
40
41
|
timeout: 3e4
|
|
@@ -45,18 +46,17 @@ function fetchDiff(opts) {
|
|
|
45
46
|
}
|
|
46
47
|
throw new Error("aicli ci: must supply --pr <num> or --base <ref> to determine the diff source");
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function validateGitRef(ref) {
|
|
49
50
|
if (!/^[A-Za-z0-9._/\-]+$/.test(ref)) {
|
|
50
51
|
throw new Error(`unsafe ref: ${ref}`);
|
|
51
52
|
}
|
|
52
|
-
return ref;
|
|
53
53
|
}
|
|
54
54
|
function buildGitContextStr(opts) {
|
|
55
55
|
const parts = [];
|
|
56
56
|
if (opts.pr != null) parts.push(`PR: #${opts.pr}`);
|
|
57
57
|
if (opts.base) parts.push(`Base: ${opts.base}`);
|
|
58
58
|
try {
|
|
59
|
-
const branch =
|
|
59
|
+
const branch = execFileSync("git", ["rev-parse", "--abbrev-ref", "HEAD"], { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
60
60
|
if (branch) parts.push(`Branch: ${branch}`);
|
|
61
61
|
} catch {
|
|
62
62
|
}
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KJHMRAJU.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QMXC327F.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-2WV6AGHM.js";
|
|
15
|
+
import "./chunk-XPBEJB27.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-TW47X5AO.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-QNUVZO5X.js";
|
|
25
25
|
import "./chunk-IW3Q7AE5.js";
|
|
26
26
|
|
|
27
27
|
// src/diagnostics/doctor-cli.ts
|