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
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-RYQBBEMM.js";
12
12
  import {
13
13
  persistDiscussion
14
- } from "./chunk-MX75TNE5.js";
14
+ } from "./chunk-NUJTNH76.js";
15
15
  import {
16
16
  AUTO_COMPACT_INSTRUCTION,
17
17
  McpManager,
@@ -22,12 +22,14 @@ import {
22
22
  armDeferredSave,
23
23
  autoTrimSessionIfNeeded,
24
24
  buildInitPrompt,
25
+ buildRewindList,
25
26
  buildSessionCostReport,
26
27
  buildSessionExport,
27
28
  checkpointDeletedMessage,
28
29
  checkpointNotFoundMessage,
29
30
  checkpointRestoredMessage,
30
31
  checkpointSavedMessage,
32
+ clearedSessionMessage,
31
33
  costSourceNote,
32
34
  decideDeferredSave,
33
35
  decideModel,
@@ -36,6 +38,8 @@ import {
36
38
  evaluateContextPressure,
37
39
  filterMemoryEntries,
38
40
  formatCheckpointList,
41
+ formatForkReport,
42
+ formatRewindReport,
39
43
  formatSessionSummaryLine,
40
44
  loadDevState,
41
45
  parseBatchDeleteArgs,
@@ -43,10 +47,12 @@ import {
43
47
  parseCleanArgs,
44
48
  parseMemoryShowFilters,
45
49
  parseModelCommand,
50
+ parseRewindArgs,
46
51
  parseRouteCommand,
47
52
  parseSessionListArgs,
48
53
  persistToolRound,
49
54
  readGitDiff,
55
+ resolveForkPoint,
50
56
  resolveModelSwitch,
51
57
  resolveProviderSwitch,
52
58
  resolveSessionRef,
@@ -62,7 +68,7 @@ import {
62
68
  setupProxy,
63
69
  snapshotFile,
64
70
  stripRoutingTags
65
- } from "./chunk-IIO2SMEJ.js";
71
+ } from "./chunk-KDXA7RXA.js";
66
72
  import {
67
73
  CNY_PER_USD,
68
74
  CostTracker,
@@ -104,7 +110,7 @@ import {
104
110
  spawnAgentContext,
105
111
  truncateOutput,
106
112
  undoStack
107
- } from "./chunk-CP5LAA52.js";
113
+ } from "./chunk-7XKIDSJT.js";
108
114
  import {
109
115
  buildReviewPrompt,
110
116
  buildSecurityReviewPrompt
@@ -131,7 +137,7 @@ import {
131
137
  restoreMemoryEntries,
132
138
  updateMemoryApproval,
133
139
  updateMemoryEntry
134
- } from "./chunk-V7EZ4SDC.js";
140
+ } from "./chunk-SGUPIQYT.js";
135
141
  import "./chunk-4DEMGCK4.js";
136
142
  import "./chunk-UUSRWSSX.js";
137
143
  import "./chunk-CKH4KQ4E.js";
@@ -141,7 +147,7 @@ import "./chunk-5C76XDDF.js";
141
147
  import {
142
148
  SessionManager,
143
149
  getContentText
144
- } from "./chunk-CGDYO52A.js";
150
+ } from "./chunk-IUVDZVZ4.js";
145
151
  import "./chunk-NYNSYLFY.js";
146
152
  import {
147
153
  scanString
@@ -150,7 +156,7 @@ import {
150
156
  buildDoctorReport,
151
157
  formatDoctorReport,
152
158
  loadContextFiles
153
- } from "./chunk-B3FHA6IN.js";
159
+ } from "./chunk-GSGJABL6.js";
154
160
  import {
155
161
  describePlugin,
156
162
  getActivePluginAssets,
@@ -165,13 +171,13 @@ import {
165
171
  runTool,
166
172
  setPluginEnabled,
167
173
  trustPlugin
168
- } from "./chunk-UMWDNNPS.js";
174
+ } from "./chunk-LNUWIY6M.js";
169
175
  import {
170
176
  ProviderRegistry
171
177
  } from "./chunk-UGY5SVNX.js";
172
178
  import {
173
179
  ConfigManager
174
- } from "./chunk-EOP775JU.js";
180
+ } from "./chunk-EVD6CCO2.js";
175
181
  import {
176
182
  CONTENT_ONLY_STREAM_REMINDER,
177
183
  TEE_FINAL_USER_NUDGE,
@@ -201,7 +207,7 @@ import {
201
207
  maskConfigSecrets
202
208
  } from "./chunk-XNFIYS7G.js";
203
209
  import "./chunk-4BKXL7SM.js";
204
- import "./chunk-VQCFEA4Z.js";
210
+ import "./chunk-HJDJAI7T.js";
205
211
  import {
206
212
  AGENTIC_BEHAVIOR_GUIDELINE,
207
213
  AUTHOR,
@@ -217,7 +223,7 @@ import {
217
223
  SKILLS_DIR_NAME,
218
224
  VERSION,
219
225
  buildUserIdentityPrompt
220
- } from "./chunk-UBPRUSAF.js";
226
+ } from "./chunk-JQU4GYET.js";
221
227
 
222
228
  // src/web/server.ts
223
229
  import express from "express";
@@ -950,10 +956,14 @@ function lastAssistantText(messages) {
950
956
 
951
957
  // src/web/commands/session-commands.ts
952
958
  async function handleClear(_args, ctx) {
959
+ const prior = ctx.sessions.current;
960
+ const priorId = prior?.id ?? null;
961
+ const priorCount = prior?.messages.length ?? 0;
953
962
  ctx.saveIfNeeded();
954
- ctx.sessions.createSession(ctx.currentProvider, ctx.currentModel);
963
+ const created = ctx.sessions.createSession(ctx.currentProvider, ctx.currentModel);
964
+ ctx.unsavedSessions.set(created.id, created);
955
965
  ctx.resetWebSessionUsage();
956
- ctx.send({ type: "info", message: "Conversation cleared." });
966
+ ctx.send({ type: "info", message: clearedSessionMessage(priorId, priorCount) });
957
967
  ctx.sendStatus();
958
968
  ctx.sendSessionList();
959
969
  }
@@ -971,7 +981,7 @@ Cache: write=${cacheCreate} read=${cacheRead}` : "";
971
981
  Cost: ${formatCost(cost)}` : "";
972
982
  let memoryLine = "";
973
983
  try {
974
- const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-MHHX7F25.js");
984
+ const { countPendingMemories: countPendingMemories2 } = await import("./persistent-memory-ACXKU6RV.js");
975
985
  const pending = countPendingMemories2(ctx.config.getConfigDir());
976
986
  if (pending > 0) memoryLine = `
977
987
  Memory: \u26A0 ${pending} pending approval \u2014 see the Memory panel or /memory`;
@@ -1550,27 +1560,27 @@ async function handleFork(args, ctx) {
1550
1560
  ctx.send({ type: "info", message: "No active session to fork." });
1551
1561
  return;
1552
1562
  }
1553
- const sub = args.join(" ").trim();
1554
- let messageCount = session.messages.length;
1555
- let fromLabel = "current position";
1556
- if (sub) {
1557
- const cp = session.checkpoints.find((c) => c.name === sub);
1558
- if (!cp) {
1559
- const available = session.checkpoints.map((c) => c.name);
1560
- ctx.send({ type: "error", message: available.length > 0 ? `Checkpoint "${sub}" not found. Available: ${available.join(", ")}` : `Checkpoint "${sub}" not found. No checkpoints saved.` });
1561
- return;
1562
- }
1563
- messageCount = cp.messageIndex;
1564
- fromLabel = `checkpoint "${cp.name}" (${cp.messageIndex} messages)`;
1563
+ const point = resolveForkPoint(session, args.join(" ").trim());
1564
+ if (!point.ok) {
1565
+ ctx.send({ type: "error", message: point.message });
1566
+ return;
1565
1567
  }
1566
1568
  try {
1567
- const originalId = session.id.slice(0, 8);
1568
- const forked = await ctx.sessions.forkSession(messageCount);
1569
- ctx.send({ type: "info", message: `\u{1F500} Session Forked
1570
- Original: ${originalId}
1571
- Forked: ${forked.id.slice(0, 8)} "${forked.title ?? "(untitled)"}"
1572
- From: ${fromLabel}
1573
- Messages: ${forked.messages.length} copied` });
1569
+ const originalId = session.id;
1570
+ const originalTitle = session.title ?? "(untitled)";
1571
+ const forked = await ctx.sessions.forkSession(point.messageCount);
1572
+ ctx.send({
1573
+ type: "info",
1574
+ message: formatForkReport({
1575
+ originalId,
1576
+ originalTitle,
1577
+ forkedId: forked.id,
1578
+ forkedTitle: forked.title ?? "(untitled)",
1579
+ fromLabel: point.fromLabel,
1580
+ messageCount: forked.messages.length,
1581
+ checkpointCount: forked.checkpoints.length
1582
+ }).join("\n")
1583
+ });
1574
1584
  ctx.sendSessionMessages();
1575
1585
  ctx.sendStatus();
1576
1586
  ctx.sendSessionList();
@@ -1584,41 +1594,42 @@ async function handleRewind(args, ctx) {
1584
1594
  ctx.send({ type: "info", message: "No messages to rewind." });
1585
1595
  return;
1586
1596
  }
1587
- const rewindSub = args[0];
1588
- if (rewindSub === "list" || !rewindSub) {
1589
- const lines = [`Conversation messages (${session.messages.length} total):
1590
- `];
1591
- const cpIndices = (await import("./file-checkpoint-NKBHGC7L.js")).fileCheckpoints.getMessageIndices();
1592
- for (let i = 0; i < session.messages.length; i++) {
1593
- const m = session.messages[i];
1594
- const text = getContentText(m.content).replace(/\n/g, " ").slice(0, 60);
1595
- const pin = cpIndices.includes(i) ? " \u{1F4CC}" : "";
1596
- lines.push(` [${i + 1}] ${m.role.padEnd(10)} ${text}${pin}`);
1597
- }
1598
- lines.push("", "Usage: /rewind <n> \u2014 rewind to message N", "\u{1F4CC} = file checkpoint");
1599
- ctx.send({ type: "info", message: lines.join("\n") });
1597
+ const intent = parseRewindArgs(args, session.messages.length);
1598
+ if (intent.kind === "invalid") {
1599
+ ctx.send({ type: "error", message: intent.message });
1600
1600
  return;
1601
1601
  }
1602
- const rewindN = parseInt(rewindSub, 10);
1603
- if (isNaN(rewindN) || rewindN < 1 || rewindN > session.messages.length) {
1604
- ctx.send({ type: "error", message: `Invalid message number: ${rewindSub}. Range: 1-${session.messages.length}` });
1602
+ const { fileCheckpoints } = await import("./file-checkpoint-NKBHGC7L.js");
1603
+ if (intent.kind === "list") {
1604
+ const rows = buildRewindList(session.messages, fileCheckpoints.getMessageIndices());
1605
+ ctx.send({
1606
+ type: "info",
1607
+ message: [
1608
+ `Conversation messages (${rows.length} total):`,
1609
+ "",
1610
+ ...rows.map((r) => ` [${r.index}] ${r.role.padEnd(10)} ${r.preview}${r.hasCheckpoint ? " \u{1F4CC}" : ""}`),
1611
+ "",
1612
+ "Usage: /rewind <n> \u2014 rewind to message N (1-based)",
1613
+ "\u{1F4CC} = file checkpoint exists at this point"
1614
+ ].join("\n")
1615
+ });
1605
1616
  return;
1606
1617
  }
1607
- const { fileCheckpoints: fc } = await import("./file-checkpoint-NKBHGC7L.js");
1608
- const rewindRemoved = session.messages.length - rewindN;
1609
- const rewindResult = fc.restoreToMessageIndex(rewindN);
1610
- session.messages = session.messages.slice(0, rewindN);
1611
- session.checkpoints = session.checkpoints.filter((c) => c.messageIndex <= rewindN);
1612
- session.updated = /* @__PURE__ */ new Date();
1613
- ctx.sessions.save();
1614
- const rewindLines = [`\u2713 Rewound to message ${rewindN}`, ` Messages removed: ${rewindRemoved}`];
1615
- if (rewindResult.restored > 0 || rewindResult.deleted > 0) {
1616
- rewindLines.push(` Files restored: ${rewindResult.restored}, deleted: ${rewindResult.deleted}`);
1617
- for (const f of rewindResult.files) rewindLines.push(` ${f}`);
1618
- } else {
1619
- rewindLines.push(" No file changes to revert.");
1620
- }
1621
- ctx.send({ type: "info", message: rewindLines.join("\n") });
1618
+ const messagesRemoved = session.messages.length - intent.target;
1619
+ const result = fileCheckpoints.restoreToMessageIndex(intent.target);
1620
+ session.truncateTo(intent.target);
1621
+ await ctx.sessions.save();
1622
+ ctx.resetWebSessionUsage();
1623
+ ctx.send({
1624
+ type: "info",
1625
+ message: formatRewindReport({
1626
+ target: intent.target,
1627
+ messagesRemoved,
1628
+ filesRestored: result.restored,
1629
+ filesDeleted: result.deleted,
1630
+ files: result.files
1631
+ }).join("\n")
1632
+ });
1622
1633
  ctx.sendSessionMessages();
1623
1634
  ctx.sendStatus();
1624
1635
  }
@@ -1878,7 +1889,7 @@ async function handleTest(args, ctx) {
1878
1889
  const isCommand = argStr.includes(" ") || /^(mvn|gradle|npm|pytest|cargo|go)\b/.test(argStr);
1879
1890
  testArgs = isCommand ? { command: argStr } : { filter: argStr };
1880
1891
  }
1881
- const runTests = ctx.runTests ?? (await import("./run-tests-YPJDOEJA.js")).executeTests;
1892
+ const runTests = ctx.runTests ?? (await import("./run-tests-4KTX5YMO.js")).executeTests;
1882
1893
  const report = await runTests(testArgs);
1883
1894
  ctx.send({ type: "info", message: report });
1884
1895
  } catch (err) {
@@ -2214,7 +2225,7 @@ async function handleMemory(args, ctx) {
2214
2225
  ctx.handleMemoryManage(sub, args[1], sub === "expire" ? args[2] : void 0);
2215
2226
  } else if (sub === "export") {
2216
2227
  if (args[1] === "md") {
2217
- const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-MHHX7F25.js");
2228
+ const { exportMemoryEntries: exportMemoryEntries2 } = await import("./persistent-memory-ACXKU6RV.js");
2218
2229
  ctx.send({
2219
2230
  type: "export_data",
2220
2231
  format: "md",
@@ -2465,7 +2476,7 @@ async function handleHelp(_args, ctx) {
2465
2476
  " /about \u2014 Version & author info",
2466
2477
  " /provider <id> \u2014 Switch AI provider",
2467
2478
  " /model <id> \u2014 Switch model",
2468
- " /clear \u2014 Clear conversation & start new session",
2479
+ " /clear \u2014 Start a new session (previous conversation is kept)",
2469
2480
  " /compact [hint] \u2014 Compress conversation history",
2470
2481
  " /think [on|off] \u2014 Toggle extended thinking mode",
2471
2482
  " /plan [execute|exit|status] \u2014 Read-only planning mode (bare /plan enters it)",
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ToolRegistry
4
- } from "./chunk-CP5LAA52.js";
4
+ } from "./chunk-7XKIDSJT.js";
5
5
  import "./chunk-GHWZVPUV.js";
6
- import "./chunk-V7EZ4SDC.js";
6
+ import "./chunk-SGUPIQYT.js";
7
7
  import "./chunk-4DEMGCK4.js";
8
8
  import "./chunk-UUSRWSSX.js";
9
9
  import "./chunk-CKH4KQ4E.js";
@@ -14,7 +14,7 @@ import "./chunk-NYNSYLFY.js";
14
14
  import "./chunk-3FEZSLGI.js";
15
15
  import {
16
16
  runTool
17
- } from "./chunk-UMWDNNPS.js";
17
+ } from "./chunk-LNUWIY6M.js";
18
18
  import {
19
19
  getDangerLevel,
20
20
  schemaToJsonSchema
@@ -23,10 +23,10 @@ import "./chunk-TU3L3PW7.js";
23
23
  import "./chunk-HOSJZMQS.js";
24
24
  import "./chunk-IW3Q7AE5.js";
25
25
  import "./chunk-4BKXL7SM.js";
26
- import "./chunk-VQCFEA4Z.js";
26
+ import "./chunk-HJDJAI7T.js";
27
27
  import {
28
28
  VERSION
29
- } from "./chunk-UBPRUSAF.js";
29
+ } from "./chunk-JQU4GYET.js";
30
30
 
31
31
  // src/mcp/server.ts
32
32
  import { createInterface } from "readline";
@@ -4,9 +4,9 @@ import {
4
4
  googleSearchContext,
5
5
  isToolCapableProvider,
6
6
  truncateOutput
7
- } from "./chunk-CP5LAA52.js";
7
+ } from "./chunk-7XKIDSJT.js";
8
8
  import "./chunk-GHWZVPUV.js";
9
- import "./chunk-V7EZ4SDC.js";
9
+ import "./chunk-SGUPIQYT.js";
10
10
  import "./chunk-4DEMGCK4.js";
11
11
  import "./chunk-UUSRWSSX.js";
12
12
  import "./chunk-CKH4KQ4E.js";
@@ -17,7 +17,7 @@ import "./chunk-NYNSYLFY.js";
17
17
  import "./chunk-3FEZSLGI.js";
18
18
  import {
19
19
  runTool
20
- } from "./chunk-UMWDNNPS.js";
20
+ } from "./chunk-LNUWIY6M.js";
21
21
  import {
22
22
  getDangerLevel,
23
23
  runLeanAgentLoop
@@ -28,10 +28,10 @@ import {
28
28
  atomicWriteFileSync
29
29
  } from "./chunk-IW3Q7AE5.js";
30
30
  import "./chunk-4BKXL7SM.js";
31
- import "./chunk-VQCFEA4Z.js";
31
+ import "./chunk-HJDJAI7T.js";
32
32
  import {
33
33
  SUBAGENT_ALLOWED_TOOLS
34
- } from "./chunk-UBPRUSAF.js";
34
+ } from "./chunk-JQU4GYET.js";
35
35
 
36
36
  // src/hub/task-orchestrator.ts
37
37
  import { createInterface } from "readline";
@@ -8,10 +8,10 @@ import {
8
8
  } from "./chunk-DPTEC6AQ.js";
9
9
  import {
10
10
  ConfigManager
11
- } from "./chunk-EOP775JU.js";
11
+ } from "./chunk-EVD6CCO2.js";
12
12
  import "./chunk-TU3L3PW7.js";
13
13
  import "./chunk-IW3Q7AE5.js";
14
- import "./chunk-UBPRUSAF.js";
14
+ import "./chunk-JQU4GYET.js";
15
15
 
16
16
  // src/cli/usage.ts
17
17
  function classifyRowCost(row) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jinzd-ai-cli",
3
- "version": "0.4.280",
3
+ "version": "0.4.282",
4
4
  "description": "Cross-platform REPL-style AI CLI with multi-provider support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",