jinzd-ai-cli 0.4.117 → 0.4.118

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.
@@ -372,7 +372,7 @@ Important rules:
372
372
  }
373
373
  updateCwdFromCommand(command, effectiveCwd);
374
374
  pushBashUndoEntries(beforeSnapshot, parsedTargetsBefore, effectiveCwd);
375
- const result = Buffer.isBuffer(stdout) ? stdout.toString("utf-8") : String(stdout ?? "");
375
+ const result = Buffer.isBuffer(stdout) ? IS_WINDOWS ? decodeWindowsBuffer(stdout) : stdout.toString("utf-8") : String(stdout ?? "");
376
376
  return result || "(command completed with no output)";
377
377
  } catch (err) {
378
378
  pushBashUndoEntries(beforeSnapshot, parsedTargetsBefore, effectiveCwd);
@@ -397,8 +397,8 @@ How to recover (pick ONE \u2014 do NOT retry the same command):
397
397
  );
398
398
  }
399
399
  if ("status" in execErr && execErr.status !== void 0) {
400
- const stderr = IS_WINDOWS && Buffer.isBuffer(execErr.stderr) ? execErr.stderr.toString("utf-8").trim() : execErr.stderr?.toString().trim() ?? "";
401
- const stdout = IS_WINDOWS && Buffer.isBuffer(execErr.stdout) ? execErr.stdout.toString("utf-8").trim() : execErr.stdout?.toString().trim() ?? "";
400
+ const stderr = IS_WINDOWS && Buffer.isBuffer(execErr.stderr) ? decodeWindowsBuffer(execErr.stderr).trim() : execErr.stderr?.toString().trim() ?? "";
401
+ const stdout = IS_WINDOWS && Buffer.isBuffer(execErr.stdout) ? decodeWindowsBuffer(execErr.stdout).trim() : execErr.stdout?.toString().trim() ?? "";
402
402
  const combined = [stdout, stderr].filter(Boolean).join("\n");
403
403
  const hint = buildErrorHint(command, combined);
404
404
  throw new ToolError(
@@ -432,6 +432,15 @@ function fixWindowsDeleteCommand(command) {
432
432
  }
433
433
  );
434
434
  }
435
+ function decodeWindowsBuffer(buf) {
436
+ const utf8 = buf.toString("utf-8");
437
+ if (!utf8.includes("\uFFFD")) return utf8;
438
+ try {
439
+ return new TextDecoder("gbk").decode(buf);
440
+ } catch {
441
+ return utf8;
442
+ }
443
+ }
435
444
  function buildErrorHint(command, stderr) {
436
445
  const hints = [];
437
446
  if (IS_WINDOWS && /\|\|/.test(command) && /(\|\||is not a valid argument|不是此版本中的有效|ParserError|Unexpected token)/i.test(stderr)) {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  schemaToJsonSchema,
4
4
  truncateForPersist
5
- } from "./chunk-AACUEN4B.js";
5
+ } from "./chunk-7QZOLJ2R.js";
6
6
  import {
7
7
  AuthError,
8
8
  ProviderError,
@@ -3936,7 +3936,7 @@ Important rules:
3936
3936
  }
3937
3937
  updateCwdFromCommand(command, effectiveCwd);
3938
3938
  pushBashUndoEntries(beforeSnapshot, parsedTargetsBefore, effectiveCwd);
3939
- const result = Buffer.isBuffer(stdout) ? stdout.toString("utf-8") : String(stdout ?? "");
3939
+ const result = Buffer.isBuffer(stdout) ? IS_WINDOWS ? decodeWindowsBuffer(stdout) : stdout.toString("utf-8") : String(stdout ?? "");
3940
3940
  return result || "(command completed with no output)";
3941
3941
  } catch (err) {
3942
3942
  pushBashUndoEntries(beforeSnapshot, parsedTargetsBefore, effectiveCwd);
@@ -3961,8 +3961,8 @@ How to recover (pick ONE \u2014 do NOT retry the same command):
3961
3961
  );
3962
3962
  }
3963
3963
  if ("status" in execErr && execErr.status !== void 0) {
3964
- const stderr = IS_WINDOWS && Buffer.isBuffer(execErr.stderr) ? execErr.stderr.toString("utf-8").trim() : execErr.stderr?.toString().trim() ?? "";
3965
- const stdout = IS_WINDOWS && Buffer.isBuffer(execErr.stdout) ? execErr.stdout.toString("utf-8").trim() : execErr.stdout?.toString().trim() ?? "";
3964
+ const stderr = IS_WINDOWS && Buffer.isBuffer(execErr.stderr) ? decodeWindowsBuffer(execErr.stderr).trim() : execErr.stderr?.toString().trim() ?? "";
3965
+ const stdout = IS_WINDOWS && Buffer.isBuffer(execErr.stdout) ? decodeWindowsBuffer(execErr.stdout).trim() : execErr.stdout?.toString().trim() ?? "";
3966
3966
  const combined = [stdout, stderr].filter(Boolean).join("\n");
3967
3967
  const hint = buildErrorHint(command, combined);
3968
3968
  throw new ToolError(
@@ -3996,6 +3996,15 @@ function fixWindowsDeleteCommand(command) {
3996
3996
  }
3997
3997
  );
3998
3998
  }
3999
+ function decodeWindowsBuffer(buf) {
4000
+ const utf8 = buf.toString("utf-8");
4001
+ if (!utf8.includes("\uFFFD")) return utf8;
4002
+ try {
4003
+ return new TextDecoder("gbk").decode(buf);
4004
+ } catch {
4005
+ return utf8;
4006
+ }
4007
+ }
3999
4008
  function buildErrorHint(command, stderr) {
4000
4009
  const hints = [];
4001
4010
  if (IS_WINDOWS && /\|\|/.test(command) && /(\|\||is not a valid argument|不是此版本中的有效|ParserError|Unexpected token)/i.test(stderr)) {
@@ -386,7 +386,7 @@ ${content}`);
386
386
  }
387
387
  }
388
388
  async function runTaskMode(config, providers, configManager, topic) {
389
- const { TaskOrchestrator } = await import("./task-orchestrator-WH2J6Z56.js");
389
+ const { TaskOrchestrator } = await import("./task-orchestrator-BZS2GA2Q.js");
390
390
  const orchestrator = new TaskOrchestrator(config, providers, configManager);
391
391
  let interrupted = false;
392
392
  const onSigint = () => {
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  setupProxy,
33
33
  stripPseudoToolCalls,
34
34
  stripToolCallReminder
35
- } from "./chunk-5D4ZMOGZ.js";
35
+ } from "./chunk-Z6BSKKF6.js";
36
36
  import {
37
37
  ConfigManager
38
38
  } from "./chunk-267DHNV2.js";
@@ -54,7 +54,7 @@ import {
54
54
  spawnAgentContext,
55
55
  theme,
56
56
  undoStack
57
- } from "./chunk-AACUEN4B.js";
57
+ } from "./chunk-7QZOLJ2R.js";
58
58
  import "./chunk-3BICTI5M.js";
59
59
  import "./chunk-2DXY7UGF.js";
60
60
  import "./chunk-W622HYR2.js";
@@ -7002,7 +7002,7 @@ program.command("web").description("Start Web UI server with browser-based chat
7002
7002
  console.error("Error: Invalid port number. Must be between 1 and 65535.");
7003
7003
  process.exit(1);
7004
7004
  }
7005
- const { startWebServer } = await import("./server-LK4KEPL3.js");
7005
+ const { startWebServer } = await import("./server-KLAINAR5.js");
7006
7006
  await startWebServer({ port, host: options.host });
7007
7007
  });
7008
7008
  program.command("user [action] [username]").description("Manage Web UI users (list | create <name> | delete <name> | reset-password <name> | logout-all <name> | migrate <name>)").action(async (action, username) => {
@@ -7181,7 +7181,7 @@ program.command("batch <action> [arg] [arg2]").description("Anthropic Message Ba
7181
7181
  }
7182
7182
  });
7183
7183
  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) => {
7184
- const { startMcpServer } = await import("./server-QTBPRYAS.js");
7184
+ const { startMcpServer } = await import("./server-7NVVJSNQ.js");
7185
7185
  await startMcpServer({
7186
7186
  allowDestructive: !!options.allowDestructive,
7187
7187
  allowOutsideCwd: !!options.allowOutsideCwd,
@@ -7308,7 +7308,7 @@ program.command("hub [topic]").description("Start multi-agent hub (discuss / bra
7308
7308
  }),
7309
7309
  config.get("customProviders")
7310
7310
  );
7311
- const { startHub } = await import("./hub-LABTSDKX.js");
7311
+ const { startHub } = await import("./hub-TGZYNCE6.js");
7312
7312
  await startHub(
7313
7313
  {
7314
7314
  topic: topic ?? "",
@@ -3,7 +3,7 @@ import {
3
3
  ToolRegistry,
4
4
  getDangerLevel,
5
5
  schemaToJsonSchema
6
- } from "./chunk-AACUEN4B.js";
6
+ } from "./chunk-7QZOLJ2R.js";
7
7
  import "./chunk-3BICTI5M.js";
8
8
  import "./chunk-2DXY7UGF.js";
9
9
  import "./chunk-W622HYR2.js";
@@ -26,7 +26,7 @@ import {
26
26
  setupProxy,
27
27
  stripPseudoToolCalls,
28
28
  stripToolCallReminder
29
- } from "./chunk-5D4ZMOGZ.js";
29
+ } from "./chunk-Z6BSKKF6.js";
30
30
  import {
31
31
  ConfigManager
32
32
  } from "./chunk-267DHNV2.js";
@@ -47,7 +47,7 @@ import {
47
47
  spawnAgentContext,
48
48
  truncateOutput,
49
49
  undoStack
50
- } from "./chunk-AACUEN4B.js";
50
+ } from "./chunk-7QZOLJ2R.js";
51
51
  import "./chunk-3BICTI5M.js";
52
52
  import "./chunk-2DXY7UGF.js";
53
53
  import "./chunk-W622HYR2.js";
@@ -4,7 +4,7 @@ import {
4
4
  getDangerLevel,
5
5
  googleSearchContext,
6
6
  truncateOutput
7
- } from "./chunk-AACUEN4B.js";
7
+ } from "./chunk-7QZOLJ2R.js";
8
8
  import "./chunk-3BICTI5M.js";
9
9
  import "./chunk-2DXY7UGF.js";
10
10
  import "./chunk-W622HYR2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.117",
3
+ "version": "0.4.118",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",