jinzd-ai-cli 0.4.279 → 0.4.281

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-6QZSWCBL.js → batch-237ZXBQD.js} +2 -2
  2. package/dist/{chunk-2BKRWTEQ.js → chunk-2FCKZ3OS.js} +1 -1
  3. package/dist/{chunk-UD3BVNC5.js → chunk-4XJVSMZ6.js} +1 -1
  4. package/dist/{chunk-5XHEXRMN.js → chunk-5GYOQ7EF.js} +1 -1
  5. package/dist/{chunk-CGDYO52A.js → chunk-6NO5FZW6.js} +1 -0
  6. package/dist/{chunk-JLOQBYU4.js → chunk-BVGSR3BA.js} +3 -3
  7. package/dist/{chunk-FQJFGGKN.js → chunk-FHRIDE2T.js} +4 -4
  8. package/dist/{chunk-6WMT7OQG.js → chunk-H2VE4TTN.js} +1 -1
  9. package/dist/{chunk-CMNXAJLH.js → chunk-IXEKDAIX.js} +1 -1
  10. package/dist/{chunk-NZPHEUJM.js → chunk-J3RWNQOF.js} +1 -1
  11. package/dist/{chunk-7L4TEK7Q.js → chunk-J5TXHFDO.js} +122 -3
  12. package/dist/{chunk-RJY3HJS4.js → chunk-JT2A2M4F.js} +1 -1
  13. package/dist/{chunk-IIXZ7IPN.js → chunk-L7C34TFI.js} +1 -1
  14. package/dist/{chunk-JS6VAPWM.js → chunk-UTJQXG4P.js} +3 -3
  15. package/dist/{chunk-MX75TNE5.js → chunk-VB54ILH7.js} +1 -1
  16. package/dist/{chunk-SIVM2YQQ.js → chunk-WUIOUJA2.js} +1 -1
  17. package/dist/{ci-F4ESOYI5.js → ci-LXRTYJ6F.js} +4 -4
  18. package/dist/{ci-format-AIRW3TVQ.js → ci-format-II3OT2VU.js} +2 -2
  19. package/dist/{constants-3VMMZJDS.js → constants-X53QCUTP.js} +1 -1
  20. package/dist/{doctor-cli-WVMEWMYE.js → doctor-cli-6JCJEQR4.js} +4 -4
  21. package/dist/electron-server.js +144 -91
  22. package/dist/{hub-JJCCCU3O.js → hub-RXAFF7QI.js} +2 -2
  23. package/dist/index.js +68 -130
  24. package/dist/{persist-PQM4BRI4.js → persist-TBQILDSE.js} +2 -2
  25. package/dist/{persistent-memory-KSZKM4JG.js → persistent-memory-7CKJLS25.js} +2 -2
  26. package/dist/{persistent-memory-QZN4Q3W4.js → persistent-memory-WAKFKH2I.js} +2 -2
  27. package/dist/{pr-GFB5JC26.js → pr-DZTRHAMG.js} +4 -4
  28. package/dist/{run-tests-HMHHIG7Y.js → run-tests-4ESYEROQ.js} +2 -2
  29. package/dist/{run-tests-EL54INOI.js → run-tests-XGCNUT5S.js} +2 -2
  30. package/dist/{server-WUSJWC3A.js → server-6RYXFG3H.js} +60 -98
  31. package/dist/{server-6C7GITHY.js → server-EFA7UP4I.js} +5 -5
  32. package/dist/{task-orchestrator-C7RUUA2Q.js → task-orchestrator-H3AEIHR3.js} +5 -5
  33. package/dist/{usage-CW6BT2UV.js → usage-W7TZWHY7.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-UD3BVNC5.js";
4
+ } from "./chunk-4XJVSMZ6.js";
5
5
  import "./chunk-TU3L3PW7.js";
6
6
  import {
7
7
  atomicWriteFileSync
8
8
  } from "./chunk-IW3Q7AE5.js";
9
- import "./chunk-2BKRWTEQ.js";
9
+ import "./chunk-2FCKZ3OS.js";
10
10
 
11
11
  // src/cli/batch.ts
12
12
  import Anthropic from "@anthropic-ai/sdk";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.279";
4
+ var VERSION = "0.4.281";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -11,7 +11,7 @@ import {
11
11
  CONFIG_FILE_NAME,
12
12
  HISTORY_DIR_NAME,
13
13
  PLUGINS_DIR_NAME
14
- } from "./chunk-2BKRWTEQ.js";
14
+ } from "./chunk-2FCKZ3OS.js";
15
15
 
16
16
  // src/config/config-manager.ts
17
17
  import { readFileSync, existsSync, mkdirSync } from "fs";
@@ -1,5 +1,5 @@
1
1
  // src/core/constants.ts
2
- var VERSION = "0.4.279";
2
+ var VERSION = "0.4.281";
3
3
  var APP_NAME = "ai-cli";
4
4
  var CONFIG_DIR_NAME = ".aicli";
5
5
  var CONFIG_FILE_NAME = "config.json";
@@ -599,6 +599,7 @@ var SessionManager = class {
599
599
  /** P1-PERF-03: `force` 跳过脏检查(用于进程退出、fork 等必须落盘场景) */
600
600
  async save(force = false) {
601
601
  if (!this._current) return;
602
+ if (this._current.messages.length === 0) return;
602
603
  if (!force && !this._current.dirty) return;
603
604
  mkdirSync(this.historyDir, { recursive: true });
604
605
  const filePath = join(this.historyDir, `${this._current.id}.json`);
@@ -8,13 +8,13 @@ import {
8
8
  listHooks,
9
9
  listInstalledPlugins,
10
10
  resetStats
11
- } from "./chunk-IIXZ7IPN.js";
11
+ } from "./chunk-L7C34TFI.js";
12
12
  import {
13
13
  ProviderRegistry
14
14
  } from "./chunk-UGY5SVNX.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-UD3BVNC5.js";
17
+ } from "./chunk-4XJVSMZ6.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-2BKRWTEQ.js";
29
+ } from "./chunk-2FCKZ3OS.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -11,7 +11,7 @@ import {
11
11
  searchPersistentMemories,
12
12
  touchMemoryReferences,
13
13
  updateMemoryEntry
14
- } from "./chunk-6WMT7OQG.js";
14
+ } from "./chunk-H2VE4TTN.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-IIXZ7IPN.js";
33
+ } from "./chunk-L7C34TFI.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-NZPHEUJM.js";
53
+ } from "./chunk-J3RWNQOF.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-2BKRWTEQ.js";
60
+ } from "./chunk-2FCKZ3OS.js";
61
61
 
62
62
  // src/tools/shell-pool.ts
63
63
  import { spawn as spawn2 } from "child_process";
@@ -13,7 +13,7 @@ import {
13
13
  MEMORY_FILE_NAME,
14
14
  MEMORY_MAX_CHARS,
15
15
  MEMORY_STORE_FILE_NAME
16
- } from "./chunk-2BKRWTEQ.js";
16
+ } from "./chunk-2FCKZ3OS.js";
17
17
 
18
18
  // src/memory/persistent-memory.ts
19
19
  import { copyFileSync, existsSync, mkdirSync, readFileSync, statSync } from "fs";
@@ -6,7 +6,7 @@ import {
6
6
  MEMORY_FILE_NAME,
7
7
  MEMORY_MAX_CHARS,
8
8
  MEMORY_STORE_FILE_NAME
9
- } from "./chunk-5XHEXRMN.js";
9
+ } from "./chunk-5GYOQ7EF.js";
10
10
  import {
11
11
  atomicWriteFileSync
12
12
  } from "./chunk-6BUTA5VW.js";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-2BKRWTEQ.js";
4
+ } from "./chunk-2FCKZ3OS.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -5,11 +5,14 @@ import {
5
5
  import {
6
6
  estimateTokens,
7
7
  truncateForPersist
8
- } from "./chunk-FQJFGGKN.js";
8
+ } from "./chunk-FHRIDE2T.js";
9
9
  import {
10
10
  isMemoryExpired,
11
11
  isMemoryStale
12
- } from "./chunk-6WMT7OQG.js";
12
+ } from "./chunk-H2VE4TTN.js";
13
+ import {
14
+ getContentText
15
+ } from "./chunk-6NO5FZW6.js";
13
16
  import {
14
17
  isCleanDocumentBody,
15
18
  stripOuterCodeFence
@@ -27,7 +30,7 @@ import {
27
30
  MCP_PROTOCOL_VERSION,
28
31
  MCP_TOOL_PREFIX,
29
32
  VERSION
30
- } from "./chunk-2BKRWTEQ.js";
33
+ } from "./chunk-2FCKZ3OS.js";
31
34
 
32
35
  // src/mcp/client.ts
33
36
  import { spawn } from "child_process";
@@ -979,6 +982,110 @@ function filterMemoryEntries(entries, filters) {
979
982
  return { entries: out, applied };
980
983
  }
981
984
 
985
+ // src/core/session-export.ts
986
+ function parseExportArgs(args) {
987
+ let format = "md";
988
+ let outFile = null;
989
+ for (const arg of args) {
990
+ if (arg === "md" || arg === "json") format = arg;
991
+ else if (arg) outFile = arg;
992
+ }
993
+ return { format, outFile };
994
+ }
995
+ function defaultExportFilename(session, format) {
996
+ const dateTag = session.created.toISOString().slice(0, 10);
997
+ return `session-${dateTag}-${session.id.slice(0, 8)}.${format === "json" ? "json" : "md"}`;
998
+ }
999
+ function markdownHeading(msg) {
1000
+ switch (msg.role) {
1001
+ case "user":
1002
+ return "## \u{1F464} You";
1003
+ case "assistant":
1004
+ return "## \u{1F916} Assistant";
1005
+ case "tool":
1006
+ return `### \u{1F527} Tool result: ${msg.toolName ?? "tool"}${msg.isError ? " (error)" : ""}`;
1007
+ default:
1008
+ return `## \u2699 ${msg.role}`;
1009
+ }
1010
+ }
1011
+ function buildSessionExport(session, format, outFile) {
1012
+ const filename = outFile || defaultExportFilename(session, format);
1013
+ if (format === "json") {
1014
+ const payload = session.toJSON ? session.toJSON() : {
1015
+ id: session.id,
1016
+ title: session.title ?? null,
1017
+ provider: session.provider,
1018
+ model: session.model,
1019
+ created: session.created.toISOString(),
1020
+ messages: session.messages
1021
+ };
1022
+ return { filename, content: JSON.stringify(payload, null, 2), messageCount: session.messages.length };
1023
+ }
1024
+ const dateStr = session.created.toISOString().replace("T", " ").slice(0, 19);
1025
+ let md = `# ${session.title ?? "Conversation Export"}
1026
+
1027
+ `;
1028
+ md += `| Field | Value |
1029
+ |----------|-------|
1030
+ `;
1031
+ md += `| Provider | ${session.provider} |
1032
+ `;
1033
+ md += `| Model | ${session.model} |
1034
+ `;
1035
+ md += `| Date | ${dateStr} |
1036
+ `;
1037
+ md += `| Session | ${session.id.slice(0, 8)} |
1038
+
1039
+ ---
1040
+
1041
+ `;
1042
+ for (const msg of session.messages) {
1043
+ const text = getContentText(msg.content);
1044
+ md += `${markdownHeading(msg)}
1045
+
1046
+ `;
1047
+ if (text.trim()) md += `${text}
1048
+
1049
+ `;
1050
+ if (msg.toolCalls && msg.toolCalls.length > 0) {
1051
+ for (const tc of msg.toolCalls) {
1052
+ md += `\`\`\`json
1053
+ ${JSON.stringify({ tool: tc.name, arguments: tc.arguments ?? {} }, null, 2)}
1054
+ \`\`\`
1055
+
1056
+ `;
1057
+ }
1058
+ }
1059
+ md += `---
1060
+
1061
+ `;
1062
+ }
1063
+ return { filename, content: md, messageCount: session.messages.length };
1064
+ }
1065
+ function parseCheckpointCommand(args) {
1066
+ const sub = args[0]?.toLowerCase();
1067
+ if (!sub || sub === "list") return { kind: "list" };
1068
+ const name = args.slice(1).join(" ").trim();
1069
+ if (sub === "save" || sub === "restore" || sub === "delete") {
1070
+ if (!name) return { kind: "usage", message: `Usage: /checkpoint ${sub} <name>` };
1071
+ return { kind: sub, name };
1072
+ }
1073
+ return { kind: "unknown", message: `Unknown subcommand: ${sub}. Use save/restore/list/delete.` };
1074
+ }
1075
+ function formatCheckpointList(checkpoints) {
1076
+ if (checkpoints.length === 0) {
1077
+ return ["No checkpoints. Use /checkpoint save <name> to create one."];
1078
+ }
1079
+ return [
1080
+ `Checkpoints (${checkpoints.length}):`,
1081
+ ...checkpoints.map((cp) => ` ${cp.name.padEnd(20)} msg #${cp.messageIndex} ${cp.timestamp.toLocaleString()}`)
1082
+ ];
1083
+ }
1084
+ var checkpointSavedMessage = (name, messageCount) => `\u2713 Checkpoint "${name}" saved at message #${messageCount}`;
1085
+ var checkpointRestoredMessage = (name, messageCount) => `\u2713 Restored to checkpoint "${name}" (${messageCount} messages, token usage reset)`;
1086
+ var checkpointDeletedMessage = (name) => `\u2713 Deleted checkpoint "${name}"`;
1087
+ var checkpointNotFoundMessage = (name) => `Checkpoint "${name}" not found.`;
1088
+
982
1089
  // src/session/tool-history.ts
983
1090
  var SESSION_SIZE_LIMIT = 2 * 1024 * 1024;
984
1091
  function persistToolRound(session, toolCalls, toolResults, opts) {
@@ -1779,6 +1886,9 @@ function selectStaleSessions(sessions, staleDays, now = Date.now()) {
1779
1886
  const cutoff = now - staleDays * 24 * 60 * 60 * 1e3;
1780
1887
  return sessions.filter((s) => s.updated.getTime() < cutoff);
1781
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
+ }
1782
1892
 
1783
1893
  // src/core/profile-command.ts
1784
1894
  var PROFILE_FIELDS = ["name", "nickname", "role", "bio", "interests", "locale", "extra"];
@@ -1959,6 +2069,7 @@ export {
1959
2069
  parseBatchDeleteArgs,
1960
2070
  parseCleanArgs,
1961
2071
  selectStaleSessions,
2072
+ clearedSessionMessage,
1962
2073
  applyProfileCommand,
1963
2074
  readGitDiff,
1964
2075
  scanDirTree,
@@ -1966,6 +2077,14 @@ export {
1966
2077
  buildInitPrompt,
1967
2078
  parseMemoryShowFilters,
1968
2079
  filterMemoryEntries,
2080
+ parseExportArgs,
2081
+ buildSessionExport,
2082
+ parseCheckpointCommand,
2083
+ formatCheckpointList,
2084
+ checkpointSavedMessage,
2085
+ checkpointRestoredMessage,
2086
+ checkpointDeletedMessage,
2087
+ checkpointNotFoundMessage,
1969
2088
  buildSessionCostReport,
1970
2089
  costSourceNote,
1971
2090
  parseSimpleYaml,
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-2BKRWTEQ.js";
4
+ } from "./chunk-2FCKZ3OS.js";
5
5
 
6
6
  // src/cli/ci-format.ts
7
7
  var DEFAULT_CI_THRESHOLDS = {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  CONFIG_DIR_NAME,
7
7
  PLUGINS_DIR_NAME
8
- } from "./chunk-2BKRWTEQ.js";
8
+ } from "./chunk-2FCKZ3OS.js";
9
9
 
10
10
  // src/diagnostics/tool-stats.ts
11
11
  import { existsSync, readFileSync, mkdirSync } from "fs";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-RJY3HJS4.js";
5
+ } from "./chunk-JT2A2M4F.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-UD3BVNC5.js";
19
+ } from "./chunk-4XJVSMZ6.js";
20
20
  import {
21
21
  VERSION
22
- } from "./chunk-2BKRWTEQ.js";
22
+ } from "./chunk-2FCKZ3OS.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
  SessionManager
4
- } from "./chunk-CGDYO52A.js";
4
+ } from "./chunk-6NO5FZW6.js";
5
5
 
6
6
  // src/hub/persist.ts
7
7
  import { join } from "path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TEST_TIMEOUT
3
- } from "./chunk-5XHEXRMN.js";
3
+ } from "./chunk-5GYOQ7EF.js";
4
4
 
5
5
  // src/tools/builtin/run-tests.ts
6
6
  import { execSync, spawnSync } from "child_process";
@@ -3,16 +3,16 @@ import {
3
3
  CI_COMMENT_MARKER,
4
4
  countSeverity,
5
5
  runCi
6
- } from "./chunk-JS6VAPWM.js";
7
- import "./chunk-RJY3HJS4.js";
6
+ } from "./chunk-UTJQXG4P.js";
7
+ import "./chunk-JT2A2M4F.js";
8
8
  import "./chunk-HLWUDRBO.js";
9
9
  import "./chunk-6YZEZFX5.js";
10
10
  import "./chunk-UGY5SVNX.js";
11
- import "./chunk-UD3BVNC5.js";
11
+ import "./chunk-4XJVSMZ6.js";
12
12
  import "./chunk-TEXT4DAT.js";
13
13
  import "./chunk-TU3L3PW7.js";
14
14
  import "./chunk-IW3Q7AE5.js";
15
- import "./chunk-2BKRWTEQ.js";
15
+ import "./chunk-2FCKZ3OS.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-RJY3HJS4.js";
10
- import "./chunk-2BKRWTEQ.js";
9
+ } from "./chunk-JT2A2M4F.js";
10
+ import "./chunk-2FCKZ3OS.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-2BKRWTEQ.js";
41
+ } from "./chunk-2FCKZ3OS.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-JLOQBYU4.js";
6
- import "./chunk-IIXZ7IPN.js";
5
+ } from "./chunk-BVGSR3BA.js";
6
+ import "./chunk-L7C34TFI.js";
7
7
  import "./chunk-UGY5SVNX.js";
8
- import "./chunk-UD3BVNC5.js";
8
+ import "./chunk-4XJVSMZ6.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-2BKRWTEQ.js";
13
+ import "./chunk-2FCKZ3OS.js";
14
14
  export {
15
15
  formatDoctorReport,
16
16
  runDoctorCli