jinzd-ai-cli 0.4.280 → 0.4.282

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 (34) hide show
  1. package/dist/{batch-F27NOTWC.js → batch-SBP6H7IK.js} +2 -2
  2. package/dist/{chunk-NHJ4GHL4.js → chunk-6IRG727F.js} +1 -1
  3. package/dist/{chunk-CP5LAA52.js → chunk-7XKIDSJT.js} +4 -4
  4. package/dist/{chunk-EOP775JU.js → chunk-EVD6CCO2.js} +1 -1
  5. package/dist/{chunk-B3FHA6IN.js → chunk-GSGJABL6.js} +3 -3
  6. package/dist/{chunk-VQCFEA4Z.js → chunk-HJDJAI7T.js} +1 -1
  7. package/dist/{chunk-CGDYO52A.js → chunk-IUVDZVZ4.js} +19 -0
  8. package/dist/{chunk-UBPRUSAF.js → chunk-JQU4GYET.js} +1 -1
  9. package/dist/{chunk-IIO2SMEJ.js → chunk-KDXA7RXA.js} +74 -4
  10. package/dist/{chunk-UMWDNNPS.js → chunk-LNUWIY6M.js} +1 -1
  11. package/dist/{chunk-MX75TNE5.js → chunk-NUJTNH76.js} +1 -1
  12. package/dist/{chunk-PUC277TH.js → chunk-RHSCROLG.js} +1 -1
  13. package/dist/{chunk-V7EZ4SDC.js → chunk-SGUPIQYT.js} +1 -1
  14. package/dist/{chunk-PN42JO74.js → chunk-TNIMHTKG.js} +1 -1
  15. package/dist/{chunk-TAIZZY3N.js → chunk-WMHLWCZQ.js} +3 -3
  16. package/dist/{chunk-LPZNOYRJ.js → chunk-YRPL7A3S.js} +1 -1
  17. package/dist/{ci-HJ4OVHCM.js → ci-VAAMX44S.js} +4 -4
  18. package/dist/{ci-format-NKJRZ3QI.js → ci-format-RMULFSB5.js} +2 -2
  19. package/dist/{constants-6LCZOBJC.js → constants-PXLMEBJY.js} +1 -1
  20. package/dist/{doctor-cli-7JGPC5G4.js → doctor-cli-C2DFYU2M.js} +4 -4
  21. package/dist/electron-server.js +147 -59
  22. package/dist/{hub-NX7HYN7V.js → hub-XIU3YTOE.js} +2 -2
  23. package/dist/index.js +81 -86
  24. package/dist/{persist-PQM4BRI4.js → persist-S77WRVLD.js} +2 -2
  25. package/dist/{persistent-memory-MHHX7F25.js → persistent-memory-ACXKU6RV.js} +2 -2
  26. package/dist/{persistent-memory-E6WECUTW.js → persistent-memory-TA224ZFQ.js} +2 -2
  27. package/dist/{pr-GLUFBQLI.js → pr-J74HW44E.js} +4 -4
  28. package/dist/{run-tests-YPJDOEJA.js → run-tests-4KTX5YMO.js} +2 -2
  29. package/dist/{run-tests-LWAFPVS3.js → run-tests-JLZ2KIGV.js} +2 -2
  30. package/dist/{server-CXXYIPMU.js → server-226R6675.js} +77 -66
  31. package/dist/{server-P6DI27CY.js → server-4CZXYGJN.js} +5 -5
  32. package/dist/{task-orchestrator-FW4LBPTS.js → task-orchestrator-6C3R7KSK.js} +5 -5
  33. package/dist/{usage-CJUHQDT2.js → usage-FY3TEJJS.js} +2 -2
  34. package/package.json +1 -1
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-EOP775JU.js";
4
+ } from "./chunk-EVD6CCO2.js";
5
5
  import "./chunk-TU3L3PW7.js";
6
6
  import {
7
7
  atomicWriteFileSync
8
8
  } from "./chunk-IW3Q7AE5.js";
9
- import "./chunk-UBPRUSAF.js";
9
+ import "./chunk-JQU4GYET.js";
10
10
 
11
11
  // src/cli/batch.ts
12
12
  import Anthropic from "@anthropic-ai/sdk";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TEST_TIMEOUT
3
- } from "./chunk-PN42JO74.js";
3
+ } from "./chunk-TNIMHTKG.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -11,7 +11,7 @@ import {
11
11
  searchPersistentMemories,
12
12
  touchMemoryReferences,
13
13
  updateMemoryEntry
14
- } from "./chunk-V7EZ4SDC.js";
14
+ } from "./chunk-SGUPIQYT.js";
15
15
  import {
16
16
  indexProject
17
17
  } from "./chunk-4DEMGCK4.js";
@@ -30,7 +30,7 @@ import {
30
30
  runHook,
31
31
  runLifecycleHooks,
32
32
  runTool
33
- } from "./chunk-UMWDNNPS.js";
33
+ } from "./chunk-LNUWIY6M.js";
34
34
  import {
35
35
  buildTruncatedArgumentsError,
36
36
  getDangerLevel,
@@ -50,14 +50,14 @@ import {
50
50
  } from "./chunk-4BKXL7SM.js";
51
51
  import {
52
52
  runTestsTool
53
- } from "./chunk-VQCFEA4Z.js";
53
+ } from "./chunk-HJDJAI7T.js";
54
54
  import {
55
55
  CONFIG_DIR_NAME,
56
56
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
57
57
  SUBAGENT_ALLOWED_TOOLS,
58
58
  SUBAGENT_DEFAULT_MAX_ROUNDS,
59
59
  SUBAGENT_MAX_ROUNDS_LIMIT
60
- } from "./chunk-UBPRUSAF.js";
60
+ } from "./chunk-JQU4GYET.js";
61
61
 
62
62
  // src/tools/shell-pool.ts
63
63
  import { spawn as spawn2 } from "child_process";
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-UBPRUSAF.js";
14
+ } from "./chunk-JQU4GYET.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-UMWDNNPS.js";
11
+ } from "./chunk-LNUWIY6M.js";
12
12
  import {
13
13
  ProviderRegistry
14
14
  } from "./chunk-UGY5SVNX.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-EOP775JU.js";
17
+ } from "./chunk-EVD6CCO2.js";
18
18
  import {
19
19
  getGitRoot
20
20
  } from "./chunk-HOSJZMQS.js";
@@ -26,7 +26,7 @@ import {
26
26
  MCP_PROJECT_CONFIG_NAME,
27
27
  MEMORY_FILE_NAME,
28
28
  VERSION
29
- } from "./chunk-UBPRUSAF.js";
29
+ } from "./chunk-JQU4GYET.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-UBPRUSAF.js";
4
+ } from "./chunk-JQU4GYET.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -97,6 +97,24 @@ var Session = class _Session {
97
97
  this.updated = /* @__PURE__ */ new Date();
98
98
  this.dirty = true;
99
99
  }
100
+ /**
101
+ * 把对话截断到前 `count` 条(`/rewind` 用)。
102
+ *
103
+ * 存在的理由是 `dirty`:`messages` 是个普通公开字段,两端此前都直接
104
+ * `session.messages = session.messages.slice(0, n)`,**不会置脏**——于是 REPL 压根不存,
105
+ * Web 存了也被 `save()` 的 `if (!force && !dirty) return` 跳过。结果 `/rewind` 只改内存,
106
+ * 而它同时真的回退了磁盘上的文件:重启后文件是回退后的、对话是回退前的,
107
+ * 恰恰制造出 rewind 本身要消除的那种不一致(P2-02 第 6 批)。
108
+ *
109
+ * 落在截断点之后的检查点一并丢弃(它们指向已经不存在的消息)。
110
+ */
111
+ truncateTo(count) {
112
+ const target = Math.max(0, Math.min(count, this.messages.length));
113
+ this.messages = this.messages.slice(0, target);
114
+ this.checkpoints = this.checkpoints.filter((c) => c.messageIndex <= target);
115
+ this.updated = /* @__PURE__ */ new Date();
116
+ this.dirty = true;
117
+ }
100
118
  addMessage(message) {
101
119
  this.messages.push(message);
102
120
  this.updated = /* @__PURE__ */ new Date();
@@ -599,6 +617,7 @@ var SessionManager = class {
599
617
  /** P1-PERF-03: `force` 跳过脏检查(用于进程退出、fork 等必须落盘场景) */
600
618
  async save(force = false) {
601
619
  if (!this._current) return;
620
+ if (this._current.messages.length === 0) return;
602
621
  if (!force && !this._current.dirty) return;
603
622
  mkdirSync(this.historyDir, { recursive: true });
604
623
  const filePath = join(this.historyDir, `${this._current.id}.json`);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.280";
4
+ var VERSION = "0.4.282";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -5,14 +5,14 @@ import {
5
5
  import {
6
6
  estimateTokens,
7
7
  truncateForPersist
8
- } from "./chunk-CP5LAA52.js";
8
+ } from "./chunk-7XKIDSJT.js";
9
9
  import {
10
10
  isMemoryExpired,
11
11
  isMemoryStale
12
- } from "./chunk-V7EZ4SDC.js";
12
+ } from "./chunk-SGUPIQYT.js";
13
13
  import {
14
14
  getContentText
15
- } from "./chunk-CGDYO52A.js";
15
+ } from "./chunk-IUVDZVZ4.js";
16
16
  import {
17
17
  isCleanDocumentBody,
18
18
  stripOuterCodeFence
@@ -30,7 +30,7 @@ import {
30
30
  MCP_PROTOCOL_VERSION,
31
31
  MCP_TOOL_PREFIX,
32
32
  VERSION
33
- } from "./chunk-UBPRUSAF.js";
33
+ } from "./chunk-JQU4GYET.js";
34
34
 
35
35
  // src/mcp/client.ts
36
36
  import { spawn } from "child_process";
@@ -1886,6 +1886,9 @@ function selectStaleSessions(sessions, staleDays, now = Date.now()) {
1886
1886
  const cutoff = now - staleDays * 24 * 60 * 60 * 1e3;
1887
1887
  return sessions.filter((s) => s.updated.getTime() < cutoff);
1888
1888
  }
1889
+ function clearedSessionMessage(priorSessionId, priorMessageCount = 0) {
1890
+ return priorSessionId && priorMessageCount > 0 ? `Started a new session. Previous conversation saved as ${priorSessionId.slice(0, 8)} (${priorMessageCount} messages) \u2014 reload it with /session load ${priorSessionId.slice(0, 8)}.` : "Started a new session.";
1891
+ }
1889
1892
 
1890
1893
  // src/core/profile-command.ts
1891
1894
  var PROFILE_FIELDS = ["name", "nickname", "role", "bio", "interests", "locale", "extra"];
@@ -2011,6 +2014,67 @@ function readGitDiff(options = {}) {
2011
2014
  }).trim();
2012
2015
  }
2013
2016
 
2017
+ // src/core/session-history.ts
2018
+ function parseRewindArgs(args, messageCount) {
2019
+ const sub = args[0];
2020
+ if (!sub || sub.toLowerCase() === "list") return { kind: "list" };
2021
+ const n = Number.parseInt(sub, 10);
2022
+ if (Number.isNaN(n) || n < 1 || n > messageCount) {
2023
+ return { kind: "invalid", message: `Invalid message number: ${sub}. Range: 1-${messageCount}` };
2024
+ }
2025
+ return { kind: "rewind", target: n };
2026
+ }
2027
+ function buildRewindList(messages, checkpointIndices, previewWidth = 70) {
2028
+ return messages.map((m, i) => ({
2029
+ index: i + 1,
2030
+ role: m.role,
2031
+ preview: getContentText(m.content).replace(/\s+/g, " ").trim().slice(0, previewWidth),
2032
+ hasCheckpoint: checkpointIndices.includes(i)
2033
+ }));
2034
+ }
2035
+ function formatRewindReport(report) {
2036
+ const lines = [
2037
+ `\u2713 Rewound to message ${report.target}`,
2038
+ ` Messages removed: ${report.messagesRemoved}`
2039
+ ];
2040
+ if (report.filesRestored > 0 || report.filesDeleted > 0) {
2041
+ lines.push(` Files restored: ${report.filesRestored}, files deleted: ${report.filesDeleted}`);
2042
+ for (const f of report.files) lines.push(` ${f}`);
2043
+ } else {
2044
+ lines.push(" No file changes to revert.");
2045
+ }
2046
+ return lines;
2047
+ }
2048
+ function resolveForkPoint(session, checkpointName) {
2049
+ const name = checkpointName?.trim();
2050
+ if (!name) {
2051
+ return { ok: true, messageCount: session.messages.length, fromLabel: "current position" };
2052
+ }
2053
+ const cp = session.checkpoints.find((c) => c.name === name);
2054
+ if (!cp) {
2055
+ const available = session.checkpoints.map((c) => c.name);
2056
+ return {
2057
+ ok: false,
2058
+ message: available.length > 0 ? `Checkpoint "${name}" not found. Available: ${available.join(", ")}` : `Checkpoint "${name}" not found. No checkpoints saved. Use /checkpoint save <name> first.`
2059
+ };
2060
+ }
2061
+ return {
2062
+ ok: true,
2063
+ messageCount: cp.messageIndex,
2064
+ fromLabel: `checkpoint "${cp.name}" (${cp.messageIndex} messages)`
2065
+ };
2066
+ }
2067
+ function formatForkReport(report) {
2068
+ return [
2069
+ "Session Forked",
2070
+ ` Original: ${report.originalId.slice(0, 8)} "${report.originalTitle}"`,
2071
+ ` Forked: ${report.forkedId.slice(0, 8)} "${report.forkedTitle}"`,
2072
+ ` From: ${report.fromLabel}`,
2073
+ ` Messages: ${report.messageCount} copied, ${report.checkpointCount} checkpoint(s) preserved`,
2074
+ ` Use /session load ${report.originalId.slice(0, 8)} to switch back to the original.`
2075
+ ];
2076
+ }
2077
+
2014
2078
  // src/core/session-cost.ts
2015
2079
  function buildSessionCostReport(input) {
2016
2080
  const { usage } = input;
@@ -2066,8 +2130,14 @@ export {
2066
2130
  parseBatchDeleteArgs,
2067
2131
  parseCleanArgs,
2068
2132
  selectStaleSessions,
2133
+ clearedSessionMessage,
2069
2134
  applyProfileCommand,
2070
2135
  readGitDiff,
2136
+ parseRewindArgs,
2137
+ buildRewindList,
2138
+ formatRewindReport,
2139
+ resolveForkPoint,
2140
+ formatForkReport,
2071
2141
  scanDirTree,
2072
2142
  scanProject,
2073
2143
  buildInitPrompt,
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  CONFIG_DIR_NAME,
7
7
  PLUGINS_DIR_NAME
8
- } from "./chunk-UBPRUSAF.js";
8
+ } from "./chunk-JQU4GYET.js";
9
9
 
10
10
  // src/diagnostics/tool-stats.ts
11
11
  import { existsSync, readFileSync, mkdirSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  SessionManager
4
- } from "./chunk-CGDYO52A.js";
4
+ } from "./chunk-IUVDZVZ4.js";
5
5
 
6
6
  // src/hub/persist.ts
7
7
  import { join } from "path";
@@ -6,7 +6,7 @@ import {
6
6
  MEMORY_FILE_NAME,
7
7
  MEMORY_MAX_CHARS,
8
8
  MEMORY_STORE_FILE_NAME
9
- } from "./chunk-PN42JO74.js";
9
+ } from "./chunk-TNIMHTKG.js";
10
10
  import {
11
11
  atomicWriteFileSync
12
12
  } from "./chunk-6BUTA5VW.js";
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-UBPRUSAF.js";
16
+ } from "./chunk-JQU4GYET.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.280";
2
+ var VERSION = "0.4.282";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-LPZNOYRJ.js";
5
+ } from "./chunk-YRPL7A3S.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -16,10 +16,10 @@ import {
16
16
  } from "./chunk-UGY5SVNX.js";
17
17
  import {
18
18
  ConfigManager
19
- } from "./chunk-EOP775JU.js";
19
+ } from "./chunk-EVD6CCO2.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-UBPRUSAF.js";
22
+ } from "./chunk-JQU4GYET.js";
23
23
 
24
24
  // src/cli/ci.ts
25
25
  import { execFileSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-UBPRUSAF.js";
4
+ } from "./chunk-JQU4GYET.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -3,16 +3,16 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-TAIZZY3N.js";
7
- import "./chunk-LPZNOYRJ.js";
6
+ } from "./chunk-WMHLWCZQ.js";
7
+ import "./chunk-YRPL7A3S.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
10
  import "./chunk-UGY5SVNX.js";
11
- import "./chunk-EOP775JU.js";
11
+ import "./chunk-EVD6CCO2.js";
12
12
  import "./chunk-TEXT4DAT.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-UBPRUSAF.js";
15
+ import "./chunk-JQU4GYET.js";
16
16
  export {
17
17
  CI_COMMENT_MARKER,
18
18
  countSeverity,
@@ -6,8 +6,8 @@ import {
6
6
  formatCiResult,
7
7
  formatCiSarif,
8
8
  normalizeCiThresholds
9
- } from "./chunk-LPZNOYRJ.js";
10
- import "./chunk-UBPRUSAF.js";
9
+ } from "./chunk-YRPL7A3S.js";
10
+ import "./chunk-JQU4GYET.js";
11
11
  export {
12
12
  DEFAULT_CI_THRESHOLDS,
13
13
  detectCiGateSignals,
@@ -38,7 +38,7 @@ import {
38
38
  TEST_TIMEOUT,
39
39
  VERSION,
40
40
  buildUserIdentityPrompt
41
- } from "./chunk-UBPRUSAF.js";
41
+ } from "./chunk-JQU4GYET.js";
42
42
  export {
43
43
  AGENTIC_BEHAVIOR_GUIDELINE,
44
44
  APP_NAME,
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  formatDoctorReport,
4
4
  runDoctorCli
5
- } from "./chunk-B3FHA6IN.js";
6
- import "./chunk-UMWDNNPS.js";
5
+ } from "./chunk-GSGJABL6.js";
6
+ import "./chunk-LNUWIY6M.js";
7
7
  import "./chunk-UGY5SVNX.js";
8
- import "./chunk-EOP775JU.js";
8
+ import "./chunk-EVD6CCO2.js";
9
9
  import "./chunk-TEXT4DAT.js";
10
10
  import "./chunk-TU3L3PW7.js";
11
11
  import "./chunk-HOSJZMQS.js";
12
12
  import "./chunk-IW3Q7AE5.js";
13
- import "./chunk-UBPRUSAF.js";
13
+ import "./chunk-JQU4GYET.js";
14
14
  export {
15
15
  formatDoctorReport,
16
16
  runDoctorCli