jinzd-ai-cli 0.4.103 → 0.4.104

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.
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-SN56X6RE.js";
4
+ } from "./chunk-2S6R4DZB.js";
5
5
  import "./chunk-2ZD3YTVM.js";
6
- import "./chunk-JHPSWYO3.js";
6
+ import "./chunk-Y4NV6ILS.js";
7
7
 
8
8
  // src/cli/batch.ts
9
9
  import Anthropic from "@anthropic-ai/sdk";
@@ -8,7 +8,7 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-JHPSWYO3.js";
11
+ } from "./chunk-Y4NV6ILS.js";
12
12
 
13
13
  // src/config/config-manager.ts
14
14
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
@@ -6,7 +6,7 @@ import { platform } from "os";
6
6
  import chalk from "chalk";
7
7
 
8
8
  // src/core/constants.ts
9
- var VERSION = "0.4.103";
9
+ var VERSION = "0.4.104";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-JHPSWYO3.js";
4
+ } from "./chunk-Y4NV6ILS.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync } from "child_process";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  schemaToJsonSchema,
4
4
  truncateForPersist
5
- } from "./chunk-RZWWODW7.js";
5
+ } from "./chunk-TF5IT4FT.js";
6
6
  import {
7
7
  AuthError,
8
8
  ProviderError,
@@ -21,7 +21,7 @@ import {
21
21
  MCP_PROTOCOL_VERSION,
22
22
  MCP_TOOL_PREFIX,
23
23
  VERSION
24
- } from "./chunk-JHPSWYO3.js";
24
+ } from "./chunk-Y4NV6ILS.js";
25
25
 
26
26
  // src/providers/claude.ts
27
27
  import Anthropic from "@anthropic-ai/sdk";
@@ -1686,7 +1686,18 @@ function extractClaimedFilePaths(content) {
1686
1686
  const enRe = /(?:saved|written|created)\s+(?:to|as|at)\s+[`'”]?([^\s`'”\n,]+?\.\w{1,6})/gi;
1687
1687
  while ((m = enRe.exec(content)) !== null) add(m[1]);
1688
1688
  const checkRe = /✅[^\n`]*?[`'”]?([^\s`'”\n,,。]+?\.\w{1,6})/g;
1689
- while ((m = checkRe.exec(content)) !== null) add(m[1]);
1689
+ while ((m = checkRe.exec(content)) !== null) {
1690
+ let pos = m.index;
1691
+ let linesBack = 0;
1692
+ while (linesBack < 9 && pos > 0) {
1693
+ pos--;
1694
+ if (content[pos] === "\n") linesBack++;
1695
+ }
1696
+ const windowStart = pos === 0 ? 0 : pos + 1;
1697
+ const lineEndIdx = content.indexOf("\n", m.index + m[0].length);
1698
+ const window = content.slice(windowStart, lineEndIdx === -1 ? void 0 : lineEndIdx);
1699
+ if (actionLineRe.test(window)) add(m[1]);
1700
+ }
1690
1701
  return Array.from(paths);
1691
1702
  }
1692
1703
  function extractWrittenFilePaths(extraMessages) {
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-6VRJGH25.js";
24
24
  import {
25
25
  runTestsTool
26
- } from "./chunk-OVYOYUP7.js";
26
+ } from "./chunk-II5Y52MS.js";
27
27
  import {
28
28
  CONFIG_DIR_NAME,
29
29
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
@@ -31,7 +31,7 @@ import {
31
31
  SUBAGENT_ALLOWED_TOOLS,
32
32
  SUBAGENT_DEFAULT_MAX_ROUNDS,
33
33
  SUBAGENT_MAX_ROUNDS_LIMIT
34
- } from "./chunk-JHPSWYO3.js";
34
+ } from "./chunk-Y4NV6ILS.js";
35
35
 
36
36
  // src/tools/types.ts
37
37
  function isFileWriteTool(name) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.103";
4
+ var VERSION = "0.4.104";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -36,7 +36,7 @@ import {
36
36
  VERSION,
37
37
  buildUserIdentityPrompt,
38
38
  runTestsTool
39
- } from "./chunk-DGXUO7D4.js";
39
+ } from "./chunk-DUVW7UBQ.js";
40
40
  import {
41
41
  hasSemanticIndex,
42
42
  semanticSearch
@@ -10281,8 +10281,9 @@ Details: ${errMsg.split("\n")[0]}
10281
10281
  const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
10282
10282
  if (hasWriteTools && !alreadyWrote && detectsHallucinatedFileOp(result.content) && round < maxToolRounds - 1) {
10283
10283
  this.send({ type: "info", message: "\u26A0 Hallucinated completion detected, forcing retry..." });
10284
+ const reasoningField = result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
10284
10285
  extraMessages.push(
10285
- { role: "assistant", content: result.content },
10286
+ { role: "assistant", content: result.content, ...reasoningField },
10286
10287
  { role: "user", content: HALLUCINATION_CORRECTION_MESSAGE }
10287
10288
  );
10288
10289
  continue;
@@ -11627,7 +11628,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
11627
11628
  case "test": {
11628
11629
  this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
11629
11630
  try {
11630
- const { executeTests } = await import("./run-tests-SN74WT4Z.js");
11631
+ const { executeTests } = await import("./run-tests-PLD7RU2L.js");
11631
11632
  const argStr = args.join(" ").trim();
11632
11633
  let testArgs = {};
11633
11634
  if (argStr) {
@@ -385,7 +385,7 @@ ${content}`);
385
385
  }
386
386
  }
387
387
  async function runTaskMode(config, providers, configManager, topic) {
388
- const { TaskOrchestrator } = await import("./task-orchestrator-MUIH3XBY.js");
388
+ const { TaskOrchestrator } = await import("./task-orchestrator-3OP527C6.js");
389
389
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
390
390
  let interrupted = false;
391
391
  const onSigint = () => {
package/dist/index.js CHANGED
@@ -28,10 +28,10 @@ import {
28
28
  saveDevState,
29
29
  sessionHasMeaningfulContent,
30
30
  setupProxy
31
- } from "./chunk-VOWVIR2U.js";
31
+ } from "./chunk-QZNVN5KY.js";
32
32
  import {
33
33
  ConfigManager
34
- } from "./chunk-SN56X6RE.js";
34
+ } from "./chunk-2S6R4DZB.js";
35
35
  import {
36
36
  ToolExecutor,
37
37
  ToolRegistry,
@@ -50,7 +50,7 @@ import {
50
50
  spawnAgentContext,
51
51
  theme,
52
52
  undoStack
53
- } from "./chunk-RZWWODW7.js";
53
+ } from "./chunk-TF5IT4FT.js";
54
54
  import "./chunk-2ZD3YTVM.js";
55
55
  import {
56
56
  fileCheckpoints
@@ -68,7 +68,7 @@ import "./chunk-KJLJPUY2.js";
68
68
  import "./chunk-6VRJGH25.js";
69
69
  import "./chunk-2DXY7UGF.js";
70
70
  import "./chunk-KHYD3WXE.js";
71
- import "./chunk-OVYOYUP7.js";
71
+ import "./chunk-II5Y52MS.js";
72
72
  import {
73
73
  AGENTIC_BEHAVIOR_GUIDELINE,
74
74
  AUTHOR,
@@ -90,7 +90,7 @@ import {
90
90
  SKILLS_DIR_NAME,
91
91
  VERSION,
92
92
  buildUserIdentityPrompt
93
- } from "./chunk-JHPSWYO3.js";
93
+ } from "./chunk-Y4NV6ILS.js";
94
94
 
95
95
  // src/index.ts
96
96
  import { program } from "commander";
@@ -264,12 +264,12 @@ var Renderer = class {
264
264
  console.log(tool("search_code", 'Semantic (meaning-based) code search via local embeddings \u2014 "grep by meaning", bilingual'));
265
265
  console.log(tool("recall_memory", 'Semantic recall over past chat sessions \u2014 "remember when we discussed X" across history (v0.4.89+)'));
266
266
  console.log(HR);
267
- console.log(theme.dim(" REPL Commands (43):"));
268
- console.log(theme.dim(" /help /about /provider /model /clear /compact /plan /session"));
269
- console.log(theme.dim(" /system /context /status /search /undo /export /copy /paste"));
270
- console.log(theme.dim(" /cost /init /skill /tools /plugins /mcp /config /checkpoint"));
271
- console.log(theme.dim(" /review /security-review /security /rewind /commands /test"));
272
- console.log(theme.dim(" /scaffold /add-dir /memory /profile /doctor /bug /think"));
267
+ console.log(theme.dim(" REPL Commands (44):"));
268
+ console.log(theme.dim(" /help /about /provider /model /route /clear /compact /plan"));
269
+ console.log(theme.dim(" /session /system /context /status /search /undo /export /copy"));
270
+ console.log(theme.dim(" /paste /cost /init /skill /tools /plugins /mcp /config"));
271
+ console.log(theme.dim(" /checkpoint /review /security-review /security /rewind /commands"));
272
+ console.log(theme.dim(" /test /scaffold /add-dir /memory /profile /doctor /bug /think"));
273
273
  console.log(theme.dim(" /diff /fork /branch /index /yolo /exit"));
274
274
  console.log(HR);
275
275
  console.log(theme.dim(" Key Features:"));
@@ -346,6 +346,14 @@ var Renderer = class {
346
346
  console.log(feat("Session sensitive-data redaction (v0.4.88+): unified redactor scrubs passwords/tokens/keys from every message before it hits disk; /security status and scan to audit"));
347
347
  console.log(feat('Chat memory recall (B4, v0.4.89+): "human-like long-term memory" \u2014 semantic index over all past sessions + recall_memory AI tool + /memory rebuild|refresh|status|recall, AI auto-recalls on "last time"/"\u4E0A\u6B21"'));
348
348
  console.log(feat("Web UI Memory panel (B4, v0.4.90+): \u{1F9E0} Memory sidebar tab \u2014 cross-session semantic search with \u2795 Inject-to-input (quotes hit into chat box for user-reviewed recall) and \u2197 jump-to-session"));
349
+ console.log(feat("Ctrl+C tool interrupt (v0.4.92+): pressing Ctrl+C during a long-running tool call (bash/run_tests/etc.) actually aborts the child process and returns control to the REPL"));
350
+ console.log(feat("Skill size warning threshold (v0.4.93+): config.skills.maxSize (default 10000 chars) \u2014 warn when a loaded skill pack exceeds budget, configurable per project"));
351
+ console.log(feat("DeepSeek V4 family (v0.4.94+): deepseek-pro / deepseek-flash with reasoning_content thinking mode \u2014 full roundtrip persisted across multi-turn (v0.4.95\u20130.4.97)"));
352
+ console.log(feat("Smart model routing (/route, config.routing): per-message model override by tag/keyword/length rules \u2014 e.g. route short msgs to Haiku, code-heavy to Opus; /route test <msg> previews decision"));
353
+ console.log(feat("Write-task auto-test suppression (v0.4.98+): AI no longer chains run_tests after write_file/edit_file unless explicitly asked \u2014 keeps single-file edits from ballooning into test runs"));
354
+ console.log(feat("Tool history ordering (v0.4.100+): preserve original tool-call order across multi-turn rounds \u2014 fixes reasoning drift on long agentic loops"));
355
+ console.log(feat("save_last_response Web mode (v0.4.101\u20130.4.102+): hidden from CLI-only contexts and tee-streams chunks to disk in Web UI as the response arrives"));
356
+ console.log(feat("write_file long-content guidance (v0.4.103+): tool description no longer encourages AI to chunk long files \u2014 single-shot writes prevented from being split into truncated parts"));
349
357
  console.log();
350
358
  }
351
359
  printPrompt(provider, _model) {
@@ -959,6 +967,7 @@ function createDefaultCommands() {
959
967
  " /about - About ai-cli & author info",
960
968
  " /provider <name> - Switch AI provider",
961
969
  " /model <name> - Switch model",
970
+ " /route [on|off|show|test <msg>] - Smart model routing rules (per-message model override)",
962
971
  " /clear - Clear conversation history",
963
972
  " /compact [instruction] - Summarize & compress history (keep last 4 messages)",
964
973
  " /plan [execute|exit|status] - Enter/manage Plan Mode (read-only planning)",
@@ -2610,7 +2619,7 @@ ${hint}` : "")
2610
2619
  usage: "/test [command|filter]",
2611
2620
  async execute(args, ctx) {
2612
2621
  try {
2613
- const { executeTests } = await import("./run-tests-3YOJEN2Q.js");
2622
+ const { executeTests } = await import("./run-tests-7YWSIVSF.js");
2614
2623
  const argStr = args.join(" ").trim();
2615
2624
  let testArgs = {};
2616
2625
  if (argStr) {
@@ -6090,8 +6099,9 @@ ${mcpBudgetNote}` : "");
6090
6099
  process.stdout.write("\n");
6091
6100
  }
6092
6101
  const correctionMsg = phantomPaths.length > 0 ? buildPhantomCorrectionMessage(phantomPaths) : HALLUCINATION_CORRECTION_MESSAGE;
6102
+ const reasoningField = "reasoningContent" in result && result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
6093
6103
  extraMessages.push(
6094
- { role: "assistant", content: result.content },
6104
+ { role: "assistant", content: result.content, ...reasoningField },
6095
6105
  { role: "user", content: correctionMsg }
6096
6106
  );
6097
6107
  spinner.start(`Retrying... (round ${round + 2}/${maxToolRounds})`);
@@ -6749,7 +6759,7 @@ program.command("web").description("Start Web UI server with browser-based chat
6749
6759
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
6750
6760
  process.exit(1);
6751
6761
  }
6752
- const { startWebServer } = await import("./server-TNPDHGQT.js");
6762
+ const { startWebServer } = await import("./server-Q3DAXDHR.js");
6753
6763
  await startWebServer({ port, host: options.host });
6754
6764
  });
6755
6765
  program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | migrate <name>)").action(async (action, username) => {
@@ -6872,7 +6882,7 @@ program.command("sessions").description("List recent conversation sessions").act
6872
6882
  });
6873
6883
  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) => {
6874
6884
  try {
6875
- const batch = await import("./batch-LNTG2IRQ.js");
6885
+ const batch = await import("./batch-24TAKT2R.js");
6876
6886
  switch (action) {
6877
6887
  case "submit":
6878
6888
  if (!arg) {
@@ -6915,7 +6925,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
6915
6925
  }
6916
6926
  });
6917
6927
  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) => {
6918
- const { startMcpServer } = await import("./server-BG4WR6RF.js");
6928
+ const { startMcpServer } = await import("./server-KKHDTZLJ.js");
6919
6929
  await startMcpServer({
6920
6930
  allowDestructive: !!options.allowDestructive,
6921
6931
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -7042,7 +7052,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
7042
7052
  }),
7043
7053
  config.get("customProviders")
7044
7054
  );
7045
- const { startHub } = await import("./hub-4YGZ4XHN.js");
7055
+ const { startHub } = await import("./hub-QRMCEVDF.js");
7046
7056
  await startHub(
7047
7057
  {
7048
7058
  topic: topic ?? "",
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-OVYOYUP7.js";
6
- import "./chunk-JHPSWYO3.js";
5
+ } from "./chunk-II5Y52MS.js";
6
+ import "./chunk-Y4NV6ILS.js";
7
7
  export {
8
8
  executeTests,
9
9
  runTestsTool
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeTests,
3
3
  runTestsTool
4
- } from "./chunk-DGXUO7D4.js";
4
+ } from "./chunk-DUVW7UBQ.js";
5
5
  export {
6
6
  executeTests,
7
7
  runTestsTool
@@ -3,7 +3,7 @@ import {
3
3
  ToolRegistry,
4
4
  getDangerLevel,
5
5
  schemaToJsonSchema
6
- } from "./chunk-RZWWODW7.js";
6
+ } from "./chunk-TF5IT4FT.js";
7
7
  import "./chunk-2ZD3YTVM.js";
8
8
  import "./chunk-4BKXL7SM.js";
9
9
  import "./chunk-ANYYM4CF.js";
@@ -12,10 +12,10 @@ import "./chunk-KJLJPUY2.js";
12
12
  import "./chunk-6VRJGH25.js";
13
13
  import "./chunk-2DXY7UGF.js";
14
14
  import "./chunk-KHYD3WXE.js";
15
- import "./chunk-OVYOYUP7.js";
15
+ import "./chunk-II5Y52MS.js";
16
16
  import {
17
17
  VERSION
18
- } from "./chunk-JHPSWYO3.js";
18
+ } from "./chunk-Y4NV6ILS.js";
19
19
 
20
20
  // src/mcp/server.ts
21
21
  import { createInterface } from "readline";
@@ -21,10 +21,10 @@ import {
21
21
  loadDevState,
22
22
  persistToolRound,
23
23
  setupProxy
24
- } from "./chunk-VOWVIR2U.js";
24
+ } from "./chunk-QZNVN5KY.js";
25
25
  import {
26
26
  ConfigManager
27
- } from "./chunk-SN56X6RE.js";
27
+ } from "./chunk-2S6R4DZB.js";
28
28
  import {
29
29
  ToolExecutor,
30
30
  ToolRegistry,
@@ -42,7 +42,7 @@ import {
42
42
  spawnAgentContext,
43
43
  truncateOutput,
44
44
  undoStack
45
- } from "./chunk-RZWWODW7.js";
45
+ } from "./chunk-TF5IT4FT.js";
46
46
  import "./chunk-2ZD3YTVM.js";
47
47
  import "./chunk-4BKXL7SM.js";
48
48
  import "./chunk-ANYYM4CF.js";
@@ -51,7 +51,7 @@ import "./chunk-KJLJPUY2.js";
51
51
  import "./chunk-6VRJGH25.js";
52
52
  import "./chunk-2DXY7UGF.js";
53
53
  import "./chunk-KHYD3WXE.js";
54
- import "./chunk-OVYOYUP7.js";
54
+ import "./chunk-II5Y52MS.js";
55
55
  import {
56
56
  AGENTIC_BEHAVIOR_GUIDELINE,
57
57
  AUTHOR,
@@ -70,7 +70,7 @@ import {
70
70
  SKILLS_DIR_NAME,
71
71
  VERSION,
72
72
  buildUserIdentityPrompt
73
- } from "./chunk-JHPSWYO3.js";
73
+ } from "./chunk-Y4NV6ILS.js";
74
74
 
75
75
  // src/web/server.ts
76
76
  import express from "express";
@@ -1033,8 +1033,9 @@ Details: ${errMsg.split("\n")[0]}
1033
1033
  const alreadyWrote = hadPreviousWriteToolCalls(extraMessages);
1034
1034
  if (hasWriteTools && !alreadyWrote && detectsHallucinatedFileOp(result.content) && round < maxToolRounds - 1) {
1035
1035
  this.send({ type: "info", message: "\u26A0 Hallucinated completion detected, forcing retry..." });
1036
+ const reasoningField = result.reasoningContent ? { reasoning_content: result.reasoningContent } : this.currentProvider === "deepseek" ? { reasoning_content: "" } : {};
1036
1037
  extraMessages.push(
1037
- { role: "assistant", content: result.content },
1038
+ { role: "assistant", content: result.content, ...reasoningField },
1038
1039
  { role: "user", content: HALLUCINATION_CORRECTION_MESSAGE }
1039
1040
  );
1040
1041
  continue;
@@ -2379,7 +2380,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
2379
2380
  case "test": {
2380
2381
  this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
2381
2382
  try {
2382
- const { executeTests } = await import("./run-tests-3YOJEN2Q.js");
2383
+ const { executeTests } = await import("./run-tests-7YWSIVSF.js");
2383
2384
  const argStr = args.join(" ").trim();
2384
2385
  let testArgs = {};
2385
2386
  if (argStr) {
@@ -4,7 +4,7 @@ import {
4
4
  getDangerLevel,
5
5
  googleSearchContext,
6
6
  truncateOutput
7
- } from "./chunk-RZWWODW7.js";
7
+ } from "./chunk-TF5IT4FT.js";
8
8
  import "./chunk-2ZD3YTVM.js";
9
9
  import "./chunk-4BKXL7SM.js";
10
10
  import "./chunk-ANYYM4CF.js";
@@ -13,10 +13,10 @@ import "./chunk-KJLJPUY2.js";
13
13
  import "./chunk-6VRJGH25.js";
14
14
  import "./chunk-2DXY7UGF.js";
15
15
  import "./chunk-KHYD3WXE.js";
16
- import "./chunk-OVYOYUP7.js";
16
+ import "./chunk-II5Y52MS.js";
17
17
  import {
18
18
  SUBAGENT_ALLOWED_TOOLS
19
- } from "./chunk-JHPSWYO3.js";
19
+ } from "./chunk-Y4NV6ILS.js";
20
20
 
21
21
  // src/hub/task-orchestrator.ts
22
22
  import { createInterface } from "readline";