jinzd-ai-cli 0.4.103 → 0.4.105

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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/{agent-client-6GX6QQDU.js → agent-client-25TIQ6AP.js} +1 -0
  4. package/dist/{auth-MSUWO6SE.js → auth-SC6KHHI3.js} +1 -0
  5. package/dist/{batch-LNTG2IRQ.js → batch-NPK4USGH.js} +3 -2
  6. package/dist/{chat-index-W2UZ34ZI.js → chat-index-7OHUKJY5.js} +1 -0
  7. package/dist/{chat-index-QKFH7ZP6.js → chat-index-ADG2GPCC.js} +1 -0
  8. package/dist/chunk-3RG5ZIWI.js +10 -0
  9. package/dist/{chunk-SN56X6RE.js → chunk-B6NUQVYK.js} +1 -1
  10. package/dist/{chunk-VOWVIR2U.js → chunk-F7XJ67XB.js} +30 -112
  11. package/dist/chunk-HOSJZMQS.js +97 -0
  12. package/dist/{chunk-OVYOYUP7.js → chunk-LVX667WL.js} +89 -36
  13. package/dist/{chunk-JHPSWYO3.js → chunk-LX5FXZVP.js} +7 -4
  14. package/dist/chunk-PDX44BCA.js +11 -0
  15. package/dist/{chunk-RZWWODW7.js → chunk-RFKT3T5S.js} +199 -74
  16. package/dist/{chunk-DGXUO7D4.js → chunk-VOF6OTZB.js} +89 -39
  17. package/dist/constants-HK5BB5EZ.js +78 -0
  18. package/dist/electron-server.js +289 -129
  19. package/dist/{file-checkpoint-CGH6OJVI.js → file-checkpoint-UHSMHCRU.js} +1 -0
  20. package/dist/{file-checkpoint-NKBHGC7L.js → file-checkpoint-ZN7KE3TN.js} +1 -0
  21. package/dist/git-context-7KIP4X2V.js +12 -0
  22. package/dist/{hub-4YGZ4XHN.js → hub-5VFGLTHY.js} +3 -2
  23. package/dist/{hub-server-BYXNQGDY.js → hub-server-AUMVPNU6.js} +1 -0
  24. package/dist/index.js +98 -47
  25. package/dist/{indexer-C7QYYHSZ.js → indexer-XGY7XGJM.js} +1 -0
  26. package/dist/{indexer-O5FCGFBJ.js → indexer-Z6AQTGBK.js} +1 -0
  27. package/dist/project-trust-EBGHD7LE.js +67 -0
  28. package/dist/project-trust-IFM7FXEV.js +68 -0
  29. package/dist/{run-tests-SN74WT4Z.js → run-tests-IMVI43CZ.js} +2 -1
  30. package/dist/{run-tests-3YOJEN2Q.js → run-tests-VQ3YZB75.js} +3 -2
  31. package/dist/{semantic-3KJPAUW6.js → semantic-FR2ZSQLY.js} +1 -0
  32. package/dist/{semantic-YDRPPVWK.js → semantic-UFKVYKFE.js} +3 -2
  33. package/dist/{server-BG4WR6RF.js → server-XDBIWNRW.js} +9 -8
  34. package/dist/{server-TNPDHGQT.js → server-ZVY3CKTJ.js} +65 -28
  35. package/dist/{store-S24SPPDZ.js → store-JDEW743P.js} +1 -0
  36. package/dist/{store-247B3TAU.js → store-Q7NMUCPP.js} +1 -0
  37. package/dist/{task-orchestrator-MUIH3XBY.js → task-orchestrator-UEZOFXQX.js} +9 -8
  38. package/dist/{vector-store-NDUFLNGN.js → vector-store-AK6J3RIA.js} +1 -0
  39. package/dist/{vector-store-QARQ2P6D.js → vector-store-MCQ77OOJ.js} +1 -0
  40. package/package.json +1 -1
  41. package/dist/{chunk-KJLJPUY2.js → chunk-3BICTI5M.js} +3 -3
@@ -13,18 +13,15 @@ import {
13
13
  computeCost,
14
14
  detectsHallucinatedFileOp,
15
15
  formatCost,
16
- formatGitContextForPrompt,
17
16
  getContentText,
18
- getGitContext,
19
- getGitRoot,
20
17
  hadPreviousWriteToolCalls,
21
18
  loadDevState,
22
19
  persistToolRound,
23
20
  setupProxy
24
- } from "./chunk-VOWVIR2U.js";
21
+ } from "./chunk-F7XJ67XB.js";
25
22
  import {
26
23
  ConfigManager
27
- } from "./chunk-SN56X6RE.js";
24
+ } from "./chunk-B6NUQVYK.js";
28
25
  import {
29
26
  ToolExecutor,
30
27
  ToolRegistry,
@@ -42,16 +39,11 @@ import {
42
39
  spawnAgentContext,
43
40
  truncateOutput,
44
41
  undoStack
45
- } from "./chunk-RZWWODW7.js";
46
- import "./chunk-2ZD3YTVM.js";
47
- import "./chunk-4BKXL7SM.js";
48
- import "./chunk-ANYYM4CF.js";
49
- import "./chunk-NHNWUBXB.js";
50
- import "./chunk-KJLJPUY2.js";
51
- import "./chunk-6VRJGH25.js";
42
+ } from "./chunk-RFKT3T5S.js";
43
+ import "./chunk-3BICTI5M.js";
52
44
  import "./chunk-2DXY7UGF.js";
53
- import "./chunk-KHYD3WXE.js";
54
- import "./chunk-OVYOYUP7.js";
45
+ import "./chunk-LVX667WL.js";
46
+ import "./chunk-2ZD3YTVM.js";
55
47
  import {
56
48
  AGENTIC_BEHAVIOR_GUIDELINE,
57
49
  AUTHOR,
@@ -70,7 +62,18 @@ import {
70
62
  SKILLS_DIR_NAME,
71
63
  VERSION,
72
64
  buildUserIdentityPrompt
73
- } from "./chunk-JHPSWYO3.js";
65
+ } from "./chunk-LX5FXZVP.js";
66
+ import {
67
+ formatGitContextForPrompt,
68
+ getGitContext,
69
+ getGitRoot
70
+ } from "./chunk-HOSJZMQS.js";
71
+ import "./chunk-4BKXL7SM.js";
72
+ import "./chunk-ANYYM4CF.js";
73
+ import "./chunk-KHYD3WXE.js";
74
+ import "./chunk-NHNWUBXB.js";
75
+ import "./chunk-6VRJGH25.js";
76
+ import "./chunk-PDX44BCA.js";
74
77
 
75
78
  // src/web/server.ts
76
79
  import express from "express";
@@ -1033,8 +1036,9 @@ Details: ${errMsg.split("\n")[0]}
1033
1036
  const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
1034
1037
  if (hasWriteTools && !alreadyWrote && detectsHallucinatedFileOp(result.content) && round < maxToolRounds - 1) {
1035
1038
  this.send({ type: "info", message: "\u26A0 Hallucinated completion detected, forcing retry..." });
1039
+ const reasoningField = result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
1036
1040
  extraMessages.push(
1037
- { role: "assistant", content: result.content },
1041
+ { role: "assistant", content: result.content, ...reasoningField },
1038
1042
  { role: "user", content: HALLUCINATION_CORRECTION_MESSAGE }
1039
1043
  );
1040
1044
  continue;
@@ -2141,9 +2145,9 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2141
2145
  case "index": {
2142
2146
  const sub = (args[0] ?? "status").toLowerCase();
2143
2147
  const root = process.cwd();
2144
- const { loadIndex, clearIndex } = await import("./store-S24SPPDZ.js");
2145
- const { indexProject } = await import("./indexer-C7QYYHSZ.js");
2146
- const { loadVectorStore, clearVectorStore } = await import("./vector-store-QARQ2P6D.js");
2148
+ const { loadIndex, clearIndex } = await import("./store-JDEW743P.js");
2149
+ const { indexProject } = await import("./indexer-XGY7XGJM.js");
2150
+ const { loadVectorStore, clearVectorStore } = await import("./vector-store-MCQ77OOJ.js");
2147
2151
  if (sub === "status") {
2148
2152
  const idx = loadIndex(root);
2149
2153
  const vec = loadVectorStore(root);
@@ -2192,7 +2196,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2192
2196
  message: `Building semantic index for ${idx.symbolCount} symbols\u2026 (first run downloads ~117 MB model)`
2193
2197
  });
2194
2198
  try {
2195
- const { rebuildSemanticIndex } = await import("./semantic-YDRPPVWK.js");
2199
+ const { rebuildSemanticIndex } = await import("./semantic-UFKVYKFE.js");
2196
2200
  const stats = await rebuildSemanticIndex(root);
2197
2201
  const first = stats.modelFirstLoadMs ? ` (model load+first batch ${stats.modelFirstLoadMs}ms)` : "";
2198
2202
  this.send({
@@ -2340,7 +2344,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2340
2344
  if (rewindSub === "list" || !rewindSub) {
2341
2345
  const lines = [`Conversation messages (${session.messages.length} total):
2342
2346
  `];
2343
- const cpIndices = (await import("./file-checkpoint-NKBHGC7L.js")).fileCheckpoints.getMessageIndices();
2347
+ const cpIndices = (await import("./file-checkpoint-ZN7KE3TN.js")).fileCheckpoints.getMessageIndices();
2344
2348
  for (let i = 0; i < session.messages.length; i++) {
2345
2349
  const m = session.messages[i];
2346
2350
  const text = getContentText(m.content).replace(/\n/g, " ").slice(0, 60);
@@ -2356,7 +2360,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2356
2360
  this.send({ type: "error", message: `Invalid message number: ${rewindSub}. Range: 1-${session.messages.length}` });
2357
2361
  break;
2358
2362
  }
2359
- const { fileCheckpoints: fc } = await import("./file-checkpoint-NKBHGC7L.js");
2363
+ const { fileCheckpoints: fc } = await import("./file-checkpoint-ZN7KE3TN.js");
2360
2364
  const rewindRemoved = session.messages.length - rewindN;
2361
2365
  const rewindResult = fc.restoreToMessageIndex(rewindN);
2362
2366
  session.messages = session.messages.slice(0, rewindN);
@@ -2379,7 +2383,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2379
2383
  case "test": {
2380
2384
  this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
2381
2385
  try {
2382
- const { executeTests } = await import("./run-tests-3YOJEN2Q.js");
2386
+ const { executeTests } = await import("./run-tests-VQ3YZB75.js");
2383
2387
  const argStr = args.join(" ").trim();
2384
2388
  let testArgs = {};
2385
2389
  if (argStr) {
@@ -2903,7 +2907,7 @@ Add .md files to create commands.` });
2903
2907
  return;
2904
2908
  }
2905
2909
  try {
2906
- const { searchChatMemory, loadChatIndex } = await import("./chat-index-W2UZ34ZI.js");
2910
+ const { searchChatMemory, loadChatIndex } = await import("./chat-index-7OHUKJY5.js");
2907
2911
  const loaded = loadChatIndex();
2908
2912
  if (!loaded || loaded.idx.chunks.length === 0) {
2909
2913
  this.send({ type: "memory_hits", query: q, hits: [], indexMissing: true });
@@ -2939,7 +2943,7 @@ Add .md files to create commands.` });
2939
2943
  }
2940
2944
  async handleMemoryStatus() {
2941
2945
  try {
2942
- const { getChatIndexStatus } = await import("./chat-index-W2UZ34ZI.js");
2946
+ const { getChatIndexStatus } = await import("./chat-index-7OHUKJY5.js");
2943
2947
  const s = getChatIndexStatus();
2944
2948
  this.send({
2945
2949
  type: "memory_status",
@@ -2964,7 +2968,7 @@ Add .md files to create commands.` });
2964
2968
  type: "info",
2965
2969
  message: full ? "\u{1F9E0} Rebuilding chat memory index (this may take a while on first run \u2014 ~117 MB embedder)." : "\u{1F9E0} Refreshing chat memory index (incremental)\u2026"
2966
2970
  });
2967
- const { buildChatIndex } = await import("./chat-index-W2UZ34ZI.js");
2971
+ const { buildChatIndex } = await import("./chat-index-7OHUKJY5.js");
2968
2972
  const stats = await buildChatIndex({
2969
2973
  full,
2970
2974
  onProgress: (p) => {
@@ -3390,7 +3394,18 @@ async function startWebServer(options = {}) {
3390
3394
  console.log(` Providers: ${availableProviders.map((p) => p.info.id).join(", ")}`);
3391
3395
  let mcpManager = null;
3392
3396
  const globalMcpServers = config.get("mcpServers") ?? {};
3393
- const projectMcpServers = loadProjectMcpConfig() ?? {};
3397
+ const projectMcpResolved = resolveProjectMcpPath();
3398
+ let projectMcpServers = {};
3399
+ if (projectMcpResolved) {
3400
+ const { checkTrust } = await import("./project-trust-IFM7FXEV.js");
3401
+ const verdict = checkTrust(config.getConfigDir(), projectMcpResolved);
3402
+ if (verdict.trusted) {
3403
+ projectMcpServers = loadProjectMcpConfig() ?? {};
3404
+ } else {
3405
+ console.log(` \u26A0 Project .mcp.json found at ${projectMcpResolved} but not trusted (${verdict.reason}).`);
3406
+ console.log(` Skipped to prevent unintended RCE. Run "aicli" then "/mcp trust-project" to approve.`);
3407
+ }
3408
+ }
3394
3409
  const mergedMcpServers = { ...globalMcpServers, ...projectMcpServers };
3395
3410
  if (Object.keys(mergedMcpServers).length > 0) {
3396
3411
  mcpManager = new McpManager();
@@ -3485,6 +3500,17 @@ async function startWebServer(options = {}) {
3485
3500
  });
3486
3501
  app.use(express.json());
3487
3502
  app.post("/api/auth/register", (req, res) => {
3503
+ const firstRun = !authManager.hasUsers();
3504
+ if (!firstRun) {
3505
+ const authHeader = req.headers.authorization;
3506
+ const token2 = authHeader?.startsWith("Bearer ") ? authHeader.slice(7) : null;
3507
+ const cookieToken = parseCookie(req.headers.cookie ?? "")["aicli_token"];
3508
+ const effectiveToken = token2 ?? cookieToken;
3509
+ if (!effectiveToken || !authManager.verifyToken(effectiveToken)) {
3510
+ res.status(403).json({ error: "Registration is closed. Use `aicli user create` on the host to add users." });
3511
+ return;
3512
+ }
3513
+ }
3488
3514
  const { username, password } = req.body ?? {};
3489
3515
  if (!username || !password) {
3490
3516
  res.status(400).json({ error: "Username and password required" });
@@ -3496,7 +3522,7 @@ async function startWebServer(options = {}) {
3496
3522
  return;
3497
3523
  }
3498
3524
  const token = authManager.login(username, password);
3499
- console.log(` \u2713 User registered via API: ${username}`);
3525
+ console.log(` \u2713 User registered via API: ${username}${firstRun ? " (first-run)" : ""}`);
3500
3526
  res.cookie("aicli_token", token, { httpOnly: true, sameSite: "strict", maxAge: 7 * 24 * 3600 * 1e3 });
3501
3527
  res.json({ success: true, token, username });
3502
3528
  });
@@ -3723,6 +3749,10 @@ async function startWebServer(options = {}) {
3723
3749
  if (parsed.type === "auth") {
3724
3750
  const { action, username, password } = parsed;
3725
3751
  if (action === "register") {
3752
+ if (authManager.hasUsers() && !authenticatedUser) {
3753
+ ws.send(JSON.stringify({ type: "auth_result", success: false, error: "Registration is closed. Use `aicli user create` on the host to add users." }));
3754
+ return;
3755
+ }
3726
3756
  const err = authManager.register(username, password);
3727
3757
  if (err) {
3728
3758
  ws.send(JSON.stringify({ type: "auth_result", success: false, error: err }));
@@ -3849,6 +3879,13 @@ async function startWebServer(options = {}) {
3849
3879
  });
3850
3880
  return result;
3851
3881
  }
3882
+ function resolveProjectMcpPath() {
3883
+ const cwd = process.cwd();
3884
+ const gitRoot = getGitRoot(cwd);
3885
+ const projectRoot = gitRoot ?? cwd;
3886
+ const configPath = join3(projectRoot, MCP_PROJECT_CONFIG_NAME);
3887
+ return existsSync4(configPath) ? configPath : null;
3888
+ }
3852
3889
  function loadProjectMcpConfig() {
3853
3890
  const cwd = process.cwd();
3854
3891
  const gitRoot = getGitRoot(cwd);
@@ -7,6 +7,7 @@ import {
7
7
  saveIndex,
8
8
  upsertFileSymbols
9
9
  } from "./chunk-6VRJGH25.js";
10
+ import "./chunk-PDX44BCA.js";
10
11
  export {
11
12
  clearIndex,
12
13
  emptyIndex,
@@ -6,6 +6,7 @@ import {
6
6
  saveIndex,
7
7
  upsertFileSymbols
8
8
  } from "./chunk-BJAT4GNC.js";
9
+ import "./chunk-3RG5ZIWI.js";
9
10
  export {
10
11
  clearIndex,
11
12
  emptyIndex,
@@ -4,19 +4,20 @@ import {
4
4
  getDangerLevel,
5
5
  googleSearchContext,
6
6
  truncateOutput
7
- } from "./chunk-RZWWODW7.js";
7
+ } from "./chunk-RFKT3T5S.js";
8
+ import "./chunk-3BICTI5M.js";
9
+ import "./chunk-2DXY7UGF.js";
10
+ import "./chunk-LVX667WL.js";
8
11
  import "./chunk-2ZD3YTVM.js";
12
+ import {
13
+ SUBAGENT_ALLOWED_TOOLS
14
+ } from "./chunk-LX5FXZVP.js";
9
15
  import "./chunk-4BKXL7SM.js";
10
16
  import "./chunk-ANYYM4CF.js";
17
+ import "./chunk-KHYD3WXE.js";
11
18
  import "./chunk-NHNWUBXB.js";
12
- import "./chunk-KJLJPUY2.js";
13
19
  import "./chunk-6VRJGH25.js";
14
- import "./chunk-2DXY7UGF.js";
15
- import "./chunk-KHYD3WXE.js";
16
- import "./chunk-OVYOYUP7.js";
17
- import {
18
- SUBAGENT_ALLOWED_TOOLS
19
- } from "./chunk-JHPSWYO3.js";
20
+ import "./chunk-PDX44BCA.js";
20
21
 
21
22
  // src/hub/task-orchestrator.ts
22
23
  import { createInterface } from "readline";
@@ -6,6 +6,7 @@ import {
6
6
  searchVectorStore
7
7
  } from "./chunk-PASCDYMH.js";
8
8
  import "./chunk-JV5N65KN.js";
9
+ import "./chunk-3RG5ZIWI.js";
9
10
  export {
10
11
  clearVectorStore,
11
12
  emptyVectorStore,
@@ -7,6 +7,7 @@ import {
7
7
  searchVectorStore
8
8
  } from "./chunk-2DXY7UGF.js";
9
9
  import "./chunk-KHYD3WXE.js";
10
+ import "./chunk-PDX44BCA.js";
10
11
  export {
11
12
  clearVectorStore,
12
13
  emptyVectorStore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.103",
3
+ "version": "0.4.105",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,7 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- loadIndex
4
- } from "./chunk-6VRJGH25.js";
5
2
  import {
6
3
  loadVectorStore,
7
4
  saveVectorStore,
@@ -12,6 +9,9 @@ import {
12
9
  embed,
13
10
  embedOne
14
11
  } from "./chunk-KHYD3WXE.js";
12
+ import {
13
+ loadIndex
14
+ } from "./chunk-6VRJGH25.js";
15
15
 
16
16
  // src/symbols/semantic.ts
17
17
  function pathTokens(absFile, root) {