jinzd-ai-cli 0.4.207 → 0.4.209
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 +5 -3
- package/dist/{batch-6PORMJWT.js → batch-45WLJUVP.js} +4 -4
- package/dist/{chunk-KOU4KX7J.js → chunk-ATNYI6JL.js} +19 -4
- package/dist/{chunk-SQB66GP6.js → chunk-BNERFXVO.js} +12 -9
- package/dist/{chunk-KJHMRAJU.js → chunk-D6M4E7SH.js} +1 -1
- package/dist/{chunk-TW47X5AO.js → chunk-DUZRQXIP.js} +6 -3
- package/dist/{chunk-SFCNFX42.js → chunk-EN63JA7N.js} +1 -1
- package/dist/{chunk-BQIV4ZQT.js → chunk-EYID2AIR.js} +1 -1
- package/dist/{chunk-QQYSZMET.js → chunk-JVLRMIHA.js} +10 -9
- package/dist/{chunk-O6UFCEUZ.js → chunk-K3CF65QH.js} +12 -9
- package/dist/{chunk-2WV6AGHM.js → chunk-STIEOOOL.js} +1 -1
- package/dist/{chunk-QNUVZO5X.js → chunk-UPMBIS4T.js} +1 -1
- package/dist/{ci-AYMV66P3.js → ci-PUE3MQ7J.js} +3 -2
- package/dist/{constants-NHGTSHKT.js → constants-VTZLKDAG.js} +1 -1
- package/dist/{doctor-cli-WKH7T4AW.js → doctor-cli-IU6FSVLF.js} +4 -4
- package/dist/electron-server.js +82 -49
- package/dist/{hub-6R3M3NTC.js → hub-4ETK4R2J.js} +1 -1
- package/dist/index.js +27 -28
- package/dist/{indexer-AKWMYNJI.js → indexer-2AG4G6B5.js} +1 -1
- package/dist/{indexer-BMYUUDLH.js → indexer-4WWS3VIL.js} +1 -1
- package/dist/{run-tests-5F2OBWIK.js → run-tests-NDS2IEMK.js} +2 -2
- package/dist/{run-tests-NBCA4KEG.js → run-tests-UAS5NJBM.js} +1 -1
- package/dist/{server-L2MXWYF7.js → server-4URLNC7P.js} +44 -22
- package/dist/{server-37EXC4EB.js → server-72SAPLPS.js} +5 -5
- package/dist/{task-orchestrator-2DTDVCMR.js → task-orchestrator-6PZTB35T.js} +5 -5
- package/dist/{usage-SZWZFX3T.js → usage-ZNCKGF6U.js} +2 -2
- package/dist/web/client/actions.js +78 -78
- package/dist/web/client/app.js +5 -5
- package/dist/web/client/index.html +1 -1
- package/dist/web/client/templates.js +188 -188
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/jinzd-ai-cli)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](https://nodejs.org)
|
|
10
|
-
[]()
|
|
11
11
|
[](https://github.com/jinzhengdong/ai-cli/releases)
|
|
12
12
|
[](https://github.com/jinzhengdong/ai-cli/actions/workflows/ci.yml)
|
|
13
13
|
|
|
@@ -414,11 +414,13 @@ The Web UI (`aicli web`) provides a full-featured browser interface:
|
|
|
414
414
|
## Testing
|
|
415
415
|
|
|
416
416
|
```bash
|
|
417
|
-
npm test #
|
|
417
|
+
npm test # Offline regression suite: 79 files, 1393 passed, 1 skipped
|
|
418
|
+
npm run test:providers # Real-provider smoke tests (network/API-key dependent)
|
|
419
|
+
npm run test:e2e-web # Playwright browser smoke; may need browser-process permission in sandboxes
|
|
418
420
|
npm run test:watch # Watch mode
|
|
419
421
|
```
|
|
420
422
|
|
|
421
|
-
|
|
423
|
+
79 offline test files covering: authentication, sessions, tool types & danger levels, permissions, output truncation, diff rendering, edit-file similarity, error hierarchy, config management, env loading, provider registry, web-fetch, grep-files, hub renderer, hub discussion, hub presets, dev-state, token estimator, tool registry budget, parallel tool execution, cost tracker, session tool history.
|
|
422
424
|
|
|
423
425
|
## Documentation
|
|
424
426
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
ConfigManager
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DUZRQXIP.js";
|
|
5
5
|
import "./chunk-TZQHYZKT.js";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-UPMBIS4T.js";
|
|
7
7
|
import {
|
|
8
8
|
atomicWriteFileSync
|
|
9
9
|
} from "./chunk-IW3Q7AE5.js";
|
|
10
10
|
|
|
11
11
|
// src/cli/batch.ts
|
|
12
12
|
import Anthropic from "@anthropic-ai/sdk";
|
|
13
|
-
import { readFileSync,
|
|
13
|
+
import { readFileSync, existsSync, mkdirSync } from "fs";
|
|
14
14
|
import { join } from "path";
|
|
15
15
|
function parseBatchInput(jsonl) {
|
|
16
16
|
const lines = jsonl.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
@@ -195,7 +195,7 @@ async function cmdResults(batchId, outPath) {
|
|
|
195
195
|
}
|
|
196
196
|
const body = lines.join("\n") + "\n";
|
|
197
197
|
if (outPath) {
|
|
198
|
-
|
|
198
|
+
atomicWriteFileSync(outPath, body);
|
|
199
199
|
console.log(`Saved ${lines.length} result(s) to ${outPath} (${ok} succeeded, ${err} failed/errored).`);
|
|
200
200
|
} else {
|
|
201
201
|
process.stdout.write(body);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-JVLRMIHA.js";
|
|
5
5
|
import {
|
|
6
6
|
APP_NAME,
|
|
7
7
|
CONFIG_DIR_NAME,
|
|
@@ -11,7 +11,10 @@ import {
|
|
|
11
11
|
MCP_PROTOCOL_VERSION,
|
|
12
12
|
MCP_TOOL_PREFIX,
|
|
13
13
|
VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UPMBIS4T.js";
|
|
15
|
+
import {
|
|
16
|
+
atomicWriteFileSync
|
|
17
|
+
} from "./chunk-IW3Q7AE5.js";
|
|
15
18
|
|
|
16
19
|
// src/mcp/client.ts
|
|
17
20
|
import { spawn } from "child_process";
|
|
@@ -696,6 +699,17 @@ async function setupProxy(configProxy) {
|
|
|
696
699
|
}
|
|
697
700
|
}
|
|
698
701
|
|
|
702
|
+
// src/core/git-diff.ts
|
|
703
|
+
import { execFileSync } from "child_process";
|
|
704
|
+
function readGitDiff(options = {}) {
|
|
705
|
+
const args = ["diff"];
|
|
706
|
+
if (options.staged) args.push("--staged");
|
|
707
|
+
return execFileSync("git", args, {
|
|
708
|
+
encoding: "utf-8",
|
|
709
|
+
timeout: options.timeoutMs ?? 1e4
|
|
710
|
+
}).trim();
|
|
711
|
+
}
|
|
712
|
+
|
|
699
713
|
// src/session/tool-history.ts
|
|
700
714
|
var SESSION_SIZE_LIMIT = 2 * 1024 * 1024;
|
|
701
715
|
function persistToolRound(session, toolCalls, toolResults, opts) {
|
|
@@ -784,7 +798,7 @@ function autoTrimSessionIfNeeded(session, sizeLimit = SESSION_SIZE_LIMIT) {
|
|
|
784
798
|
}
|
|
785
799
|
|
|
786
800
|
// src/repl/dev-state.ts
|
|
787
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2,
|
|
801
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, unlinkSync, mkdirSync as mkdirSync2 } from "fs";
|
|
788
802
|
import { join as join2 } from "path";
|
|
789
803
|
import { homedir } from "os";
|
|
790
804
|
var DEV_STATE_MAX_CHARS = 6e3;
|
|
@@ -855,7 +869,7 @@ function saveDevState(content) {
|
|
|
855
869
|
}
|
|
856
870
|
trimmed += "\n\n[...truncated]";
|
|
857
871
|
}
|
|
858
|
-
|
|
872
|
+
atomicWriteFileSync(getDevStatePath(), trimmed);
|
|
859
873
|
}
|
|
860
874
|
function loadDevState() {
|
|
861
875
|
const path = getDevStatePath();
|
|
@@ -874,6 +888,7 @@ function clearDevState() {
|
|
|
874
888
|
}
|
|
875
889
|
|
|
876
890
|
export {
|
|
891
|
+
readGitDiff,
|
|
877
892
|
parseSimpleYaml,
|
|
878
893
|
persistToolRound,
|
|
879
894
|
autoTrimSessionIfNeeded,
|
|
@@ -19,12 +19,13 @@ import { Parser, Language } from "web-tree-sitter";
|
|
|
19
19
|
import { createRequire } from "module";
|
|
20
20
|
import path from "path";
|
|
21
21
|
import fs from "fs";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
22
|
+
var entryCandidates = [
|
|
23
|
+
process.pkg?.entrypoint,
|
|
24
|
+
process.argv[1],
|
|
25
|
+
process.execPath
|
|
26
|
+
].filter((p) => !!p);
|
|
27
|
+
var bundleDirs = [...new Set(entryCandidates.map((p) => path.dirname(path.resolve(p))))];
|
|
28
|
+
var require_ = createRequire(path.join(process.cwd(), "package.json"));
|
|
28
29
|
var GRAMMAR_FILE = {
|
|
29
30
|
typescript: "tree-sitter-typescript.wasm",
|
|
30
31
|
tsx: "tree-sitter-tsx.wasm",
|
|
@@ -41,9 +42,11 @@ var languageCache = /* @__PURE__ */ new Map();
|
|
|
41
42
|
var parserCache = /* @__PURE__ */ new Map();
|
|
42
43
|
function resolveWasmPath(filename) {
|
|
43
44
|
const candidates = [];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
for (const dir of bundleDirs) {
|
|
46
|
+
candidates.push(path.join(dir, "wasm", filename));
|
|
47
|
+
candidates.push(path.join(dir, "..", "wasm", filename));
|
|
48
|
+
candidates.push(path.join(dir, "..", "dist", "wasm", filename));
|
|
49
|
+
}
|
|
47
50
|
if (process.pkg) {
|
|
48
51
|
candidates.push(path.join(path.dirname(process.execPath), "dist", "wasm", filename));
|
|
49
52
|
candidates.push(path.join("/snapshot", "ai-cli", "dist", "wasm", filename));
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
CONFIG_FILE_NAME,
|
|
9
9
|
HISTORY_DIR_NAME,
|
|
10
10
|
PLUGINS_DIR_NAME
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UPMBIS4T.js";
|
|
12
|
+
import {
|
|
13
|
+
atomicWriteFileSync
|
|
14
|
+
} from "./chunk-IW3Q7AE5.js";
|
|
12
15
|
|
|
13
16
|
// src/config/config-manager.ts
|
|
14
|
-
import { readFileSync,
|
|
17
|
+
import { readFileSync, existsSync, mkdirSync } from "fs";
|
|
15
18
|
import { join } from "path";
|
|
16
19
|
import { homedir } from "os";
|
|
17
20
|
|
|
@@ -347,7 +350,7 @@ ${err}`
|
|
|
347
350
|
}
|
|
348
351
|
save() {
|
|
349
352
|
mkdirSync(this.configDir, { recursive: true });
|
|
350
|
-
|
|
353
|
+
atomicWriteFileSync(this.configPath, JSON.stringify(this.config, null, 2));
|
|
351
354
|
}
|
|
352
355
|
getApiKey(providerId) {
|
|
353
356
|
const envKey = EnvLoader.getApiKey(providerId);
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./chunk-T2NL5ZIA.js";
|
|
6
6
|
import {
|
|
7
7
|
runTestsTool
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EN63JA7N.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-STIEOOOL.js";
|
|
12
12
|
import {
|
|
13
13
|
getDangerLevel,
|
|
14
14
|
isFileWriteTool,
|
|
@@ -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-UPMBIS4T.js";
|
|
30
30
|
import {
|
|
31
31
|
fileCheckpoints
|
|
32
32
|
} from "./chunk-4BKXL7SM.js";
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./chunk-TB4W4Y4T.js";
|
|
37
37
|
import {
|
|
38
38
|
indexProject
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-K3CF65QH.js";
|
|
40
40
|
import {
|
|
41
41
|
loadIndex
|
|
42
42
|
} from "./chunk-CKH4KQ4E.js";
|
|
@@ -2145,7 +2145,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
2145
2145
|
const mode = appendMode ? "appended" : "written";
|
|
2146
2146
|
void (async () => {
|
|
2147
2147
|
try {
|
|
2148
|
-
const { updateFile } = await import("./indexer-
|
|
2148
|
+
const { updateFile } = await import("./indexer-2AG4G6B5.js");
|
|
2149
2149
|
await updateFile(process.cwd(), filePath);
|
|
2150
2150
|
} catch {
|
|
2151
2151
|
}
|
|
@@ -3929,7 +3929,7 @@ Any of these triggers means use save_last_response, NOT write_file:
|
|
|
3929
3929
|
};
|
|
3930
3930
|
|
|
3931
3931
|
// src/tools/builtin/save-memory.ts
|
|
3932
|
-
import { existsSync as existsSync9,
|
|
3932
|
+
import { existsSync as existsSync9, readFileSync as readFileSync6, statSync as statSync6, mkdirSync as mkdirSync3 } from "fs";
|
|
3933
3933
|
import { join as join4 } from "path";
|
|
3934
3934
|
import { homedir as homedir3 } from "os";
|
|
3935
3935
|
function getMemoryFilePath() {
|
|
@@ -3966,7 +3966,8 @@ var saveMemoryTool = {
|
|
|
3966
3966
|
## ${timestamp}
|
|
3967
3967
|
${content}
|
|
3968
3968
|
`;
|
|
3969
|
-
|
|
3969
|
+
const previous = existsSync9(memoryPath) ? readFileSync6(memoryPath, "utf-8") : "";
|
|
3970
|
+
atomicWriteFileSync(memoryPath, previous + entry);
|
|
3970
3971
|
const byteSize = statSync6(memoryPath).size;
|
|
3971
3972
|
return `Memory saved successfully. File size: ${byteSize} bytes in ${MEMORY_FILE_NAME}`;
|
|
3972
3973
|
}
|
|
@@ -5031,7 +5032,7 @@ ${commitOutput.trim()}`;
|
|
|
5031
5032
|
};
|
|
5032
5033
|
|
|
5033
5034
|
// src/tools/builtin/notebook-edit.ts
|
|
5034
|
-
import { readFileSync as
|
|
5035
|
+
import { readFileSync as readFileSync7, existsSync as existsSync11 } from "fs";
|
|
5035
5036
|
import { writeFile } from "fs/promises";
|
|
5036
5037
|
import { resolve as resolve4, extname as extname2 } from "path";
|
|
5037
5038
|
var notebookEditTool = {
|
|
@@ -5089,7 +5090,7 @@ var notebookEditTool = {
|
|
|
5089
5090
|
if (!existsSync11(absPath)) {
|
|
5090
5091
|
throw new ToolError("notebook_edit", `Notebook not found: ${filePath}`);
|
|
5091
5092
|
}
|
|
5092
|
-
const raw =
|
|
5093
|
+
const raw = readFileSync7(absPath, "utf-8");
|
|
5093
5094
|
const nb = parseNotebook(raw);
|
|
5094
5095
|
const cellIdx0 = cellIndexRaw - 1;
|
|
5095
5096
|
undoStack.push(absPath, `notebook_edit (${action}): ${filePath}`);
|
|
@@ -20,12 +20,13 @@ import { Parser, Language } from "web-tree-sitter";
|
|
|
20
20
|
import { createRequire } from "module";
|
|
21
21
|
import path from "path";
|
|
22
22
|
import fs from "fs";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
23
|
+
var entryCandidates = [
|
|
24
|
+
process.pkg?.entrypoint,
|
|
25
|
+
process.argv[1],
|
|
26
|
+
process.execPath
|
|
27
|
+
].filter((p) => !!p);
|
|
28
|
+
var bundleDirs = [...new Set(entryCandidates.map((p) => path.dirname(path.resolve(p))))];
|
|
29
|
+
var require_ = createRequire(path.join(process.cwd(), "package.json"));
|
|
29
30
|
var GRAMMAR_FILE = {
|
|
30
31
|
typescript: "tree-sitter-typescript.wasm",
|
|
31
32
|
tsx: "tree-sitter-tsx.wasm",
|
|
@@ -42,9 +43,11 @@ var languageCache = /* @__PURE__ */ new Map();
|
|
|
42
43
|
var parserCache = /* @__PURE__ */ new Map();
|
|
43
44
|
function resolveWasmPath(filename) {
|
|
44
45
|
const candidates = [];
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
for (const dir of bundleDirs) {
|
|
47
|
+
candidates.push(path.join(dir, "wasm", filename));
|
|
48
|
+
candidates.push(path.join(dir, "..", "wasm", filename));
|
|
49
|
+
candidates.push(path.join(dir, "..", "dist", "wasm", filename));
|
|
50
|
+
}
|
|
48
51
|
if (process.pkg) {
|
|
49
52
|
candidates.push(path.join(path.dirname(process.execPath), "dist", "wasm", filename));
|
|
50
53
|
candidates.push(path.join("/snapshot", "ai-cli", "dist", "wasm", filename));
|
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
import "./chunk-XPBEJB27.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-DUZRQXIP.js";
|
|
14
14
|
import "./chunk-TZQHYZKT.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UPMBIS4T.js";
|
|
18
|
+
import "./chunk-IW3Q7AE5.js";
|
|
18
19
|
|
|
19
20
|
// src/cli/ci.ts
|
|
20
21
|
import { execFileSync } from "child_process";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-D6M4E7SH.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
8
|
} from "./chunk-QMXC327F.js";
|
|
@@ -11,17 +11,17 @@ import {
|
|
|
11
11
|
getTopFailingTools,
|
|
12
12
|
getTopUsedTools,
|
|
13
13
|
resetStats
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-STIEOOOL.js";
|
|
15
15
|
import "./chunk-XPBEJB27.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DUZRQXIP.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-UPMBIS4T.js";
|
|
25
25
|
import "./chunk-IW3Q7AE5.js";
|
|
26
26
|
|
|
27
27
|
// src/diagnostics/doctor-cli.ts
|