jinzd-ai-cli 0.1.52 → 0.1.53

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.
@@ -8,7 +8,7 @@ import { platform } from "os";
8
8
  import chalk from "chalk";
9
9
 
10
10
  // src/core/constants.ts
11
- var VERSION = "0.1.52";
11
+ var VERSION = "0.1.53";
12
12
  var APP_NAME = "ai-cli";
13
13
  var CONFIG_DIR_NAME = ".aicli";
14
14
  var CONFIG_FILE_NAME = "config.json";
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  SUBAGENT_MAX_ROUNDS_LIMIT,
30
30
  VERSION,
31
31
  runTestsTool
32
- } from "./chunk-KRYABIB4.js";
32
+ } from "./chunk-E23DQUHQ.js";
33
33
 
34
34
  // src/index.ts
35
35
  import { program } from "commander";
@@ -1206,6 +1206,23 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1206
1206
  detectsHallucinatedFileOp(content) {
1207
1207
  return HALLUCINATION_PATTERNS.some((pattern) => pattern.test(content));
1208
1208
  }
1209
+ /**
1210
+ * 检查 _extraMessages 中是否已存在 write_file / edit_file 的成功调用记录。
1211
+ * 若前面的 agentic 轮次已实际调用了写文件工具,则最终文本总结中提到「已保存」
1212
+ * 是合理的事实陈述,不应被判定为虚假声明。
1213
+ * 用于避免误报(false positive)。
1214
+ */
1215
+ hadPreviousWriteToolCalls(request) {
1216
+ const extraMessages = request._extraMessages ?? [];
1217
+ return extraMessages.some((msg) => {
1218
+ if (msg.role !== "assistant" || !Array.isArray(msg.tool_calls)) return false;
1219
+ return msg.tool_calls.some((tc) => {
1220
+ const fn = tc.function;
1221
+ const name = fn?.name ?? "";
1222
+ return name === "write_file" || name === "edit_file";
1223
+ });
1224
+ });
1225
+ }
1209
1226
  /**
1210
1227
  * 合并两次 API 调用的 token 用量(虚假声明重试时使用)
1211
1228
  */
@@ -1279,7 +1296,8 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
1279
1296
  const result = await super.chatWithTools(enhancedRequest, tools);
1280
1297
  if ("content" in result && result.content) {
1281
1298
  const hasWriteTools = tools.some((t) => t.name === "write_file" || t.name === "edit_file");
1282
- if (hasWriteTools && this.detectsHallucinatedFileOp(result.content)) {
1299
+ const alreadyWrote = this.hadPreviousWriteToolCalls(enhancedRequest);
1300
+ if (hasWriteTools && !alreadyWrote && this.detectsHallucinatedFileOp(result.content)) {
1283
1301
  process.stderr.write(
1284
1302
  `[deepseek] \u26A0 \u68C0\u6D4B\u5230\u865A\u5047\u5B8C\u6210\u58F0\u660E\uFF08AI \u58F0\u79F0\u5DF2\u5199\u5165\u6587\u4EF6\u4F46\u672A\u8C03\u7528\u5DE5\u5177\uFF09\uFF0C\u6B63\u5728\u5F3A\u5236\u91CD\u65B0\u8BF7\u6C42...
1285
1303
  `
@@ -1487,7 +1505,8 @@ var KimiProvider = class extends OpenAICompatibleProvider {
1487
1505
  return { toolCalls: xmlToolCalls, usage: result.usage };
1488
1506
  }
1489
1507
  const hasWriteTools = tools.some((t) => t.name === "write_file" || t.name === "edit_file");
1490
- if (hasWriteTools && this.detectsHallucinatedFileOp(result.content)) {
1508
+ const alreadyWrote = this.hadPreviousWriteToolCalls(enhancedRequest);
1509
+ if (hasWriteTools && !alreadyWrote && this.detectsHallucinatedFileOp(result.content)) {
1491
1510
  process.stderr.write(
1492
1511
  `[kimi] \u26A0 \u68C0\u6D4B\u5230\u865A\u5047\u5B8C\u6210\u58F0\u660E\uFF08AI \u58F0\u79F0\u5DF2\u5199\u5165\u6587\u4EF6\u4F46\u672A\u8C03\u7528\u5DE5\u5177\uFF09\uFF0C\u6B63\u5728\u5F3A\u5236\u91CD\u65B0\u8BF7\u6C42...
1493
1512
  `
@@ -4344,7 +4363,7 @@ ${hint}` : "")
4344
4363
  description: "Run project tests and show structured report",
4345
4364
  usage: "/test [command|filter]",
4346
4365
  async execute(args, _ctx) {
4347
- const { executeTests } = await import("./run-tests-MTYDLLII.js");
4366
+ const { executeTests } = await import("./run-tests-VV7FXC5Z.js");
4348
4367
  const argStr = args.join(" ").trim();
4349
4368
  let testArgs = {};
4350
4369
  if (argStr) {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-KRYABIB4.js";
5
+ } from "./chunk-E23DQUHQ.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",