jinzd-ai-cli 0.4.232 → 0.4.234

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 (37) hide show
  1. package/dist/{batch-D6XYKHHA.js → batch-T3FRX4B6.js} +2 -2
  2. package/dist/{chat-index-O56HDGFI.js → chat-index-7HXBWQFH.js} +2 -2
  3. package/dist/{chat-index-WSI7ULRQ.js → chat-index-WYXYD7YP.js} +1 -1
  4. package/dist/{chunk-4KM53GLG.js → chunk-2QQKS56X.js} +1 -1
  5. package/dist/{chunk-EPDW73H7.js → chunk-3KTSJ2EL.js} +1 -1
  6. package/dist/{chunk-KIQ2ICMV.js → chunk-5DTEEWYC.js} +4 -4
  7. package/dist/{chunk-NVUCDUXE.js → chunk-5MYPIQ3Y.js} +11 -5
  8. package/dist/{chunk-YDGKT6RI.js → chunk-5VPRZMZB.js} +2 -2
  9. package/dist/{chunk-RRMLRCPW.js → chunk-6MJMHHRK.js} +4 -4
  10. package/dist/{chunk-2FZACYUE.js → chunk-AFT6VFMI.js} +1 -1
  11. package/dist/{chunk-TJVM535A.js → chunk-E5RLXMSU.js} +6 -6
  12. package/dist/{chunk-XVR4YKRC.js → chunk-ETJ5X6V7.js} +1 -1
  13. package/dist/{chunk-6VSAKQTN.js → chunk-II6RZRTF.js} +1 -1
  14. package/dist/{chunk-ZWU7FWHO.js → chunk-JMP3LJC2.js} +38 -91
  15. package/dist/chunk-KCEO2XJ4.js +420 -0
  16. package/dist/{chunk-LKTYTDEJ.js → chunk-L5PNAQ6O.js} +1 -1
  17. package/dist/{chunk-ODYTXQ26.js → chunk-O3XSFPYH.js} +35 -3
  18. package/dist/{chunk-62R7CACG.js → chunk-QYQI7ZWK.js} +1 -1
  19. package/dist/{chunk-2HWL45PG.js → chunk-TAXIG7HH.js} +1 -1
  20. package/dist/{chunk-LF3OUJHK.js → chunk-UO3XWZFE.js} +302 -4
  21. package/dist/{ci-OR57Z7QF.js → ci-GJ53GPLA.js} +6 -6
  22. package/dist/{ci-format-DMMS2ZFK.js → ci-format-AXE4QCI6.js} +2 -2
  23. package/dist/{constants-7GZKINR5.js → constants-DC4EXFSB.js} +1 -1
  24. package/dist/{doctor-cli-ZD37GAZD.js → doctor-cli-HKREND6Q.js} +6 -6
  25. package/dist/electron-server.js +78 -99
  26. package/dist/{hub-VFYFUSM6.js → hub-LTTKRGZC.js} +2 -2
  27. package/dist/index.js +24 -24
  28. package/dist/{persist-I3JI27OK.js → persist-AMH5SQ4W.js} +3 -3
  29. package/dist/{pr-YF6TXJYE.js → pr-4VODJVRV.js} +6 -6
  30. package/dist/{run-tests-HEDDC6DJ.js → run-tests-G5BNTMWQ.js} +2 -2
  31. package/dist/{run-tests-BNZZDCTU.js → run-tests-QR2PYR2P.js} +1 -1
  32. package/dist/{server-HCDI2EID.js → server-64WZVZZN.js} +17 -17
  33. package/dist/{server-C52P6IDO.js → server-EO6VQHKL.js} +7 -7
  34. package/dist/{task-orchestrator-QIEHYRGK.js → task-orchestrator-4INCZMLT.js} +7 -7
  35. package/dist/{usage-4AAMJBBM.js → usage-T3HFMNNV.js} +2 -2
  36. package/package.json +1 -1
  37. package/dist/chunk-B5TYJO7V.js +0 -123
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ConfigManager
4
- } from "./chunk-LKTYTDEJ.js";
4
+ } from "./chunk-L5PNAQ6O.js";
5
5
  import "./chunk-5ULLIOVC.js";
6
- import "./chunk-EPDW73H7.js";
6
+ import "./chunk-3KTSJ2EL.js";
7
7
  import {
8
8
  atomicWriteFileSync
9
9
  } from "./chunk-IW3Q7AE5.js";
@@ -6,9 +6,9 @@ import {
6
6
  getChatIndexStatus,
7
7
  loadChatIndex,
8
8
  searchChatMemory
9
- } from "./chunk-NVUCDUXE.js";
9
+ } from "./chunk-5MYPIQ3Y.js";
10
10
  import "./chunk-KHYD3WXE.js";
11
- import "./chunk-B5TYJO7V.js";
11
+ import "./chunk-KCEO2XJ4.js";
12
12
  import "./chunk-IW3Q7AE5.js";
13
13
  export {
14
14
  buildChatIndex,
@@ -5,7 +5,7 @@ import {
5
5
  getChatIndexStatus,
6
6
  loadChatIndex,
7
7
  searchChatMemory
8
- } from "./chunk-LF3OUJHK.js";
8
+ } from "./chunk-UO3XWZFE.js";
9
9
  import "./chunk-JV5N65KN.js";
10
10
  import "./chunk-6BUTA5VW.js";
11
11
  export {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  SessionManager
4
- } from "./chunk-ZWU7FWHO.js";
4
+ } from "./chunk-JMP3LJC2.js";
5
5
 
6
6
  // src/hub/persist.ts
7
7
  import { join } from "path";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.232";
4
+ var VERSION = "0.4.234";
5
5
  var APP_NAME = "ai-cli";
6
6
  var CONFIG_DIR_NAME = ".aicli";
7
7
  var CONFIG_FILE_NAME = "config.json";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  ProviderRegistry
4
- } from "./chunk-62R7CACG.js";
4
+ } from "./chunk-QYQI7ZWK.js";
5
5
  import {
6
6
  getActivePluginAssets,
7
7
  getPendingHookTrust,
@@ -11,10 +11,10 @@ import {
11
11
  listHooks,
12
12
  listInstalledPlugins,
13
13
  resetStats
14
- } from "./chunk-6VSAKQTN.js";
14
+ } from "./chunk-II6RZRTF.js";
15
15
  import {
16
16
  ConfigManager
17
- } from "./chunk-LKTYTDEJ.js";
17
+ } from "./chunk-L5PNAQ6O.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-EPDW73H7.js";
29
+ } from "./chunk-3KTSJ2EL.js";
30
30
 
31
31
  // src/diagnostics/doctor-report.ts
32
32
  import { existsSync as existsSync3, statSync as statSync2 } from "fs";
@@ -5,8 +5,9 @@ import {
5
5
  embedOne
6
6
  } from "./chunk-KHYD3WXE.js";
7
7
  import {
8
+ getIndexMtimeMap,
8
9
  redactString
9
- } from "./chunk-B5TYJO7V.js";
10
+ } from "./chunk-KCEO2XJ4.js";
10
11
  import {
11
12
  atomicWriteFileSync
12
13
  } from "./chunk-IW3Q7AE5.js";
@@ -172,14 +173,19 @@ function listSessionFiles() {
172
173
  const dir = historyDir();
173
174
  if (!fs.existsSync(dir)) return [];
174
175
  const out = [];
176
+ const indexMtimes = getIndexMtimeMap(dir);
175
177
  for (const name of fs.readdirSync(dir)) {
176
178
  if (!name.endsWith(".json")) continue;
177
179
  const id = name.replace(/\.json$/, "");
178
180
  const p = path.join(dir, name);
179
- try {
180
- const st = fs.statSync(p);
181
- out.push({ id, path: p, mtime: st.mtimeMs });
182
- } catch {
181
+ if (indexMtimes && indexMtimes[id] !== void 0) {
182
+ out.push({ id, path: p, mtime: indexMtimes[id] });
183
+ } else {
184
+ try {
185
+ const st = fs.statSync(p);
186
+ out.push({ id, path: p, mtime: st.mtimeMs });
187
+ } catch {
188
+ }
183
189
  }
184
190
  }
185
191
  return out;
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  truncateForPersist
4
- } from "./chunk-TJVM535A.js";
4
+ } from "./chunk-E5RLXMSU.js";
5
5
  import {
6
6
  APP_NAME,
7
7
  CONFIG_DIR_NAME,
@@ -11,7 +11,7 @@ import {
11
11
  MCP_PROTOCOL_VERSION,
12
12
  MCP_TOOL_PREFIX,
13
13
  VERSION
14
- } from "./chunk-EPDW73H7.js";
14
+ } from "./chunk-3KTSJ2EL.js";
15
15
  import {
16
16
  atomicWriteFileSync
17
17
  } from "./chunk-IW3Q7AE5.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  evaluateCiGate,
4
4
  normalizeCiThresholds
5
- } from "./chunk-2HWL45PG.js";
5
+ } from "./chunk-TAXIG7HH.js";
6
6
  import {
7
7
  buildReviewPrompt,
8
8
  buildSecurityReviewPrompt,
@@ -10,13 +10,13 @@ import {
10
10
  } from "./chunk-HLWUDRBO.js";
11
11
  import {
12
12
  ProviderRegistry
13
- } from "./chunk-62R7CACG.js";
13
+ } from "./chunk-QYQI7ZWK.js";
14
14
  import {
15
15
  ConfigManager
16
- } from "./chunk-LKTYTDEJ.js";
16
+ } from "./chunk-L5PNAQ6O.js";
17
17
  import {
18
18
  VERSION
19
- } from "./chunk-EPDW73H7.js";
19
+ } from "./chunk-3KTSJ2EL.js";
20
20
 
21
21
  // src/cli/ci.ts
22
22
  import { execFileSync } from "child_process";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-EPDW73H7.js";
4
+ } from "./chunk-3KTSJ2EL.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -14,12 +14,12 @@ import {
14
14
  runHook,
15
15
  runLifecycleHooks,
16
16
  runTool
17
- } from "./chunk-6VSAKQTN.js";
17
+ } from "./chunk-II6RZRTF.js";
18
18
  import {
19
19
  getDangerLevel,
20
20
  isFileWriteTool,
21
21
  runLeanAgentLoop
22
- } from "./chunk-ODYTXQ26.js";
22
+ } from "./chunk-O3XSFPYH.js";
23
23
  import {
24
24
  EnvLoader,
25
25
  NetworkError,
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-4BKXL7SM.js";
34
34
  import {
35
35
  runTestsTool
36
- } from "./chunk-2FZACYUE.js";
36
+ } from "./chunk-AFT6VFMI.js";
37
37
  import {
38
38
  CONFIG_DIR_NAME,
39
39
  DEFAULT_MAX_TOOL_OUTPUT_CHARS_CAP,
@@ -43,15 +43,15 @@ import {
43
43
  SUBAGENT_ALLOWED_TOOLS,
44
44
  SUBAGENT_DEFAULT_MAX_ROUNDS,
45
45
  SUBAGENT_MAX_ROUNDS_LIMIT
46
- } from "./chunk-EPDW73H7.js";
46
+ } from "./chunk-3KTSJ2EL.js";
47
47
  import {
48
48
  loadChatIndex,
49
49
  searchChatMemory
50
- } from "./chunk-NVUCDUXE.js";
50
+ } from "./chunk-5MYPIQ3Y.js";
51
51
  import {
52
52
  DEFAULT_PATTERNS,
53
53
  redactString
54
- } from "./chunk-B5TYJO7V.js";
54
+ } from "./chunk-KCEO2XJ4.js";
55
55
  import {
56
56
  atomicWriteFileSync
57
57
  } from "./chunk-IW3Q7AE5.js";
@@ -6,7 +6,7 @@ import { platform } from "os";
6
6
  import chalk from "chalk";
7
7
 
8
8
  // src/core/constants.ts
9
- var VERSION = "0.4.232";
9
+ var VERSION = "0.4.234";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONFIG_DIR_NAME,
4
4
  PLUGINS_DIR_NAME
5
- } from "./chunk-EPDW73H7.js";
5
+ } from "./chunk-3KTSJ2EL.js";
6
6
  import {
7
7
  atomicWriteFileSync
8
8
  } from "./chunk-IW3Q7AE5.js";
@@ -1,13 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- redactJson
4
- } from "./chunk-B5TYJO7V.js";
3
+ listFromIndex,
4
+ readSessionMeta,
5
+ redactJson,
6
+ removeSessionFromIndex,
7
+ safeDate,
8
+ searchCandidates,
9
+ updateSessionInIndex
10
+ } from "./chunk-KCEO2XJ4.js";
5
11
  import {
6
12
  atomicWriteFileSync
7
13
  } from "./chunk-IW3Q7AE5.js";
8
14
 
9
15
  // src/session/session-manager.ts
10
- import { readFileSync, existsSync, mkdirSync, readdirSync, unlinkSync, openSync, readSync, closeSync, statSync } from "fs";
16
+ import { readFileSync, existsSync, mkdirSync, readdirSync, unlinkSync, statSync } from "fs";
11
17
  import { join } from "path";
12
18
  import { v4 as uuidv4 } from "uuid";
13
19
 
@@ -543,19 +549,6 @@ var Session = class _Session {
543
549
  };
544
550
 
545
551
  // src/session/session-manager.ts
546
- function safeDate(value) {
547
- const d = new Date(value);
548
- return isNaN(d.getTime()) ? /* @__PURE__ */ new Date(0) : d;
549
- }
550
- function extractJsonField(header, field) {
551
- const re = new RegExp(`"${field}"\\s*:\\s*"([^"]*)"`, "i");
552
- const m = header.match(re);
553
- return m ? m[1] : void 0;
554
- }
555
- function extractJsonNumberField(header, field) {
556
- const m = header.match(new RegExp(`"${field}"\\s*:\\s*(\\d+)`));
557
- return m ? Number(m[1]) : void 0;
558
- }
559
552
  var SessionManager = class {
560
553
  _current = null;
561
554
  historyDir;
@@ -613,6 +606,18 @@ var SessionManager = class {
613
606
  this.lastRedactionHits = hits.length;
614
607
  atomicWriteFileSync(filePath, JSON.stringify(payload, null, 2));
615
608
  this._current.dirty = false;
609
+ try {
610
+ updateSessionInIndex(this.historyDir, {
611
+ id: this._current.id,
612
+ provider: this._current.provider,
613
+ model: this._current.model,
614
+ title: this._current.title,
615
+ messageCount: this._current.messages.length,
616
+ created: this._current.created,
617
+ updated: this._current.updated
618
+ }, filePath);
619
+ } catch {
620
+ }
616
621
  }
617
622
  loadSession(id) {
618
623
  const filePath = join(this.historyDir, `${id}.json`);
@@ -631,12 +636,16 @@ var SessionManager = class {
631
636
  }
632
637
  listSessions(opts) {
633
638
  if (!existsSync(this.historyDir)) return [];
639
+ try {
640
+ return listFromIndex(this.historyDir, opts);
641
+ } catch {
642
+ }
634
643
  const files = readdirSync(this.historyDir).filter((f) => f.endsWith(".json"));
635
644
  const metas = [];
636
645
  for (const file of files) {
637
646
  try {
638
647
  const filePath = join(this.historyDir, file);
639
- const meta = this.readSessionMeta(filePath);
648
+ const meta = readSessionMeta(filePath);
640
649
  if (!meta) continue;
641
650
  if (opts?.includeFileSize) {
642
651
  try {
@@ -654,78 +663,6 @@ var SessionManager = class {
654
663
  }
655
664
  return metas.sort((a, b) => b.updated.getTime() - a.updated.getTime());
656
665
  }
657
- /**
658
- * P1-B: Read only the first ~1KB of a session file to extract metadata fields.
659
- * Session JSON format puts id/provider/model/created/updated/title before the
660
- * large "messages" array, so a small header read suffices for metadata extraction.
661
- * Falls back to full file read if header parsing fails.
662
- */
663
- readSessionMeta(filePath) {
664
- const HEADER_SIZE = 1024;
665
- let header;
666
- try {
667
- const fd = openSync(filePath, "r");
668
- const buf = Buffer.alloc(HEADER_SIZE);
669
- const bytesRead = readSync(fd, buf, 0, HEADER_SIZE, 0);
670
- closeSync(fd);
671
- header = buf.toString("utf-8", 0, bytesRead);
672
- } catch {
673
- return null;
674
- }
675
- const id = extractJsonField(header, "id");
676
- const provider = extractJsonField(header, "provider");
677
- const model = extractJsonField(header, "model");
678
- const created = extractJsonField(header, "created");
679
- const updated = extractJsonField(header, "updated");
680
- const title = extractJsonField(header, "title");
681
- if (id && provider && model) {
682
- let messageCount = extractJsonNumberField(header, "messageCount");
683
- if (messageCount === void 0) {
684
- messageCount = 0;
685
- try {
686
- const full = readFileSync(filePath, "utf-8");
687
- const matches = full.match(/"role"\s*:/g);
688
- messageCount = matches ? matches.length : 0;
689
- } catch {
690
- }
691
- }
692
- let branchCount;
693
- let activeBranch;
694
- try {
695
- const brMatch = header.match(/"branches"\s*:\s*\[/);
696
- if (brMatch) {
697
- const brIds = header.match(/"id"\s*:\s*"[^"]*"/g);
698
- const parentMatches = header.match(/"parentBranchId"/g);
699
- branchCount = parentMatches ? parentMatches.length + 1 : 1;
700
- }
701
- activeBranch = extractJsonField(header, "activeBranchId");
702
- } catch {
703
- }
704
- return {
705
- id,
706
- provider,
707
- model,
708
- messageCount,
709
- created: safeDate(created),
710
- updated: safeDate(updated),
711
- title: title || void 0,
712
- branchCount,
713
- activeBranch
714
- };
715
- }
716
- const data = JSON.parse(readFileSync(filePath, "utf-8"));
717
- return {
718
- id: data.id,
719
- provider: data.provider,
720
- model: data.model,
721
- messageCount: data.messages?.length ?? 0,
722
- created: safeDate(data.created),
723
- updated: safeDate(data.updated),
724
- title: data.title,
725
- branchCount: data.branches?.length ?? 1,
726
- activeBranch: data.activeBranchId
727
- };
728
- }
729
666
  deleteSession(id) {
730
667
  const filePath = join(this.historyDir, `${id}.json`);
731
668
  if (!existsSync(filePath)) return false;
@@ -734,6 +671,10 @@ var SessionManager = class {
734
671
  if (this._current && this._current.id === id) {
735
672
  this._current = null;
736
673
  }
674
+ try {
675
+ removeSessionFromIndex(this.historyDir, id);
676
+ } catch {
677
+ }
737
678
  return true;
738
679
  } catch {
739
680
  return false;
@@ -767,9 +708,15 @@ var SessionManager = class {
767
708
  searchMessages(query, maxResults = 20) {
768
709
  if (!existsSync(this.historyDir)) return [];
769
710
  const q = query.toLowerCase();
770
- const files = readdirSync(this.historyDir).filter((f) => f.endsWith(".json")).map((f) => join(this.historyDir, f));
711
+ const candidateIds = searchCandidates(this.historyDir, q);
712
+ let filesToSearch;
713
+ if (candidateIds !== null) {
714
+ filesToSearch = candidateIds.map((id) => join(this.historyDir, `${id}.json`)).filter((fp) => existsSync(fp));
715
+ } else {
716
+ filesToSearch = readdirSync(this.historyDir).filter((f) => f.endsWith(".json")).map((f) => join(this.historyDir, f));
717
+ }
771
718
  const results = [];
772
- for (const filePath of files) {
719
+ for (const filePath of filesToSearch) {
773
720
  if (results.length >= maxResults) break;
774
721
  try {
775
722
  const data = JSON.parse(readFileSync(filePath, "utf-8"));