jinzd-ai-cli 0.1.80 → 0.1.82

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.
@@ -16,7 +16,7 @@ import {
16
16
  SUBAGENT_MAX_ROUNDS_LIMIT,
17
17
  VERSION,
18
18
  runTestsTool
19
- } from "./chunk-ON52FK63.js";
19
+ } from "./chunk-FT3ADEOO.js";
20
20
 
21
21
  // src/config/config-manager.ts
22
22
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
@@ -1438,6 +1438,14 @@ var OpenAICompatibleProvider = class extends BaseProvider {
1438
1438
  };
1439
1439
 
1440
1440
  // src/providers/deepseek.ts
1441
+ var CODE_BLOCK_PATTERNS = [
1442
+ /```(?:sql|bash|shell|powershell|sh)\s*\n/i,
1443
+ /```\s*\n\s*(?:SELECT|INSERT|UPDATE|DELETE|psql)\b/i
1444
+ ];
1445
+ function detectsCodeBlockPseudoCall(content) {
1446
+ return CODE_BLOCK_PATTERNS.some((pattern) => pattern.test(content));
1447
+ }
1448
+ var DEEPSEEK_CODE_BLOCK_CORRECTION = "You wrote a code block in your response text, but you did NOT actually execute it. Code blocks in text are NOT executed by the system. You MUST use the function calling API to invoke the appropriate tool (e.g., mcp__postgres__query for SQL queries, bash for shell commands). Please call the correct tool NOW to execute the query/command.";
1441
1449
  var DeepSeekProvider = class extends OpenAICompatibleProvider {
1442
1450
  defaultBaseUrl = "https://api.deepseek.com/v1";
1443
1451
  info = {
@@ -1462,6 +1470,39 @@ var DeepSeekProvider = class extends OpenAICompatibleProvider {
1462
1470
  }
1463
1471
  ]
1464
1472
  };
1473
+ /**
1474
+ * 覆写 chatWithTools — 检测代码块伪工具调用并自动重试。
1475
+ *
1476
+ * DeepSeek 有时在 system prompt 较长(如技能注入)时,
1477
+ * 退化为输出 ```sql/```bash 代码块而不调用工具。
1478
+ * 检测到后注入纠正消息强制重试一次。
1479
+ */
1480
+ async chatWithTools(request, tools) {
1481
+ const result = await super.chatWithTools(request, tools);
1482
+ if ("content" in result && result.content && detectsCodeBlockPseudoCall(result.content)) {
1483
+ process.stderr.write(
1484
+ `[deepseek] \u26A0 Detected code block pseudo-tool-call (DeepSeek wrote code in text instead of calling a tool). Forcing retry...
1485
+ `
1486
+ );
1487
+ const retryRequest = {
1488
+ ...request,
1489
+ _extraMessages: [
1490
+ ...request._extraMessages ?? [],
1491
+ { role: "assistant", content: result.content },
1492
+ { role: "user", content: DEEPSEEK_CODE_BLOCK_CORRECTION }
1493
+ ]
1494
+ };
1495
+ const retryResult = await super.chatWithTools(retryRequest, tools);
1496
+ if (result.usage && "usage" in retryResult && retryResult.usage) {
1497
+ retryResult.usage = {
1498
+ inputTokens: result.usage.inputTokens + retryResult.usage.inputTokens,
1499
+ outputTokens: result.usage.outputTokens + retryResult.usage.outputTokens
1500
+ };
1501
+ }
1502
+ return retryResult;
1503
+ }
1504
+ return result;
1505
+ }
1465
1506
  };
1466
1507
 
1467
1508
  // src/providers/zhipu.ts
@@ -5298,7 +5339,7 @@ import { basename as basename4 } from "path";
5298
5339
  function parseSimpleYaml(yaml) {
5299
5340
  const result = {};
5300
5341
  for (const line of yaml.split("\n")) {
5301
- const match = line.match(/^(\w+)\s*:\s*(.+)$/);
5342
+ const match = line.replace(/\r$/, "").match(/^(\w+)\s*:\s*(.+)$/);
5302
5343
  if (match) {
5303
5344
  result[match[1]] = match[2].trim().replace(/^['"]|['"]$/g, "");
5304
5345
  }
@@ -5391,6 +5432,9 @@ var SkillManager = class {
5391
5432
  }
5392
5433
  const skill = parseSkillFile(filePath);
5393
5434
  if (skill) {
5435
+ if (skill.meta.name === "SKILL" && !entry.endsWith(".md")) {
5436
+ skill.meta.name = entry;
5437
+ }
5394
5438
  this.skills.set(skill.meta.name, skill);
5395
5439
  if (skill.content.length > SKILL_CONTENT_WARN_CHARS) {
5396
5440
  process.stderr.write(
@@ -14,7 +14,7 @@ import { platform } from "os";
14
14
  import chalk from "chalk";
15
15
 
16
16
  // src/core/constants.ts
17
- var VERSION = "0.1.80";
17
+ var VERSION = "0.1.82";
18
18
  var APP_NAME = "ai-cli";
19
19
  var CONFIG_DIR_NAME = ".aicli";
20
20
  var CONFIG_FILE_NAME = "config.json";
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  theme,
36
36
  truncateOutput,
37
37
  undoStack
38
- } from "./chunk-63NADY7W.js";
38
+ } from "./chunk-53QOLO5G.js";
39
39
  import {
40
40
  AGENTIC_BEHAVIOR_GUIDELINE,
41
41
  AUTHOR,
@@ -55,7 +55,7 @@ import {
55
55
  REPO_URL,
56
56
  SKILLS_DIR_NAME,
57
57
  VERSION
58
- } from "./chunk-ON52FK63.js";
58
+ } from "./chunk-FT3ADEOO.js";
59
59
 
60
60
  // src/index.ts
61
61
  import { program } from "commander";
@@ -1904,7 +1904,7 @@ ${hint}` : "")
1904
1904
  description: "Run project tests and show structured report",
1905
1905
  usage: "/test [command|filter]",
1906
1906
  async execute(args, _ctx) {
1907
- const { executeTests } = await import("./run-tests-EFJNN6OG.js");
1907
+ const { executeTests } = await import("./run-tests-UZ7FHZMQ.js");
1908
1908
  const argStr = args.join(" ").trim();
1909
1909
  let testArgs = {};
1910
1910
  if (argStr) {
@@ -5291,7 +5291,7 @@ program.command("web").description("Start Web UI server with browser-based chat
5291
5291
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
5292
5292
  process.exit(1);
5293
5293
  }
5294
- const { startWebServer } = await import("./server-U5IBDMU5.js");
5294
+ const { startWebServer } = await import("./server-XNXTXMUH.js");
5295
5295
  await startWebServer({ port, host: options.host });
5296
5296
  });
5297
5297
  program.command("sessions").description("List recent conversation sessions").action(async () => {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  executeTests,
4
4
  runTestsTool
5
- } from "./chunk-ON52FK63.js";
5
+ } from "./chunk-FT3ADEOO.js";
6
6
  export {
7
7
  executeTests,
8
8
  runTestsTool
@@ -23,7 +23,7 @@ import {
23
23
  setupProxy,
24
24
  spawnAgentContext,
25
25
  truncateOutput
26
- } from "./chunk-63NADY7W.js";
26
+ } from "./chunk-53QOLO5G.js";
27
27
  import {
28
28
  AGENTIC_BEHAVIOR_GUIDELINE,
29
29
  CONTEXT_FILE_CANDIDATES,
@@ -36,7 +36,7 @@ import {
36
36
  SKILLS_DIR_NAME,
37
37
  VERSION,
38
38
  __require
39
- } from "./chunk-ON52FK63.js";
39
+ } from "./chunk-FT3ADEOO.js";
40
40
 
41
41
  // src/web/server.ts
42
42
  import express from "express";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.1.80",
3
+ "version": "0.1.82",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",