jinzd-ai-cli 0.4.186 → 0.4.188

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 (27) hide show
  1. package/dist/{batch-IPALJR2D.js → batch-D6K2KHJK.js} +2 -2
  2. package/dist/{chat-index-2I7ZHRE5.js → chat-index-JXTYDRCY.js} +1 -1
  3. package/dist/{chat-index-BE4TPLFH.js → chat-index-WDMVP7BN.js} +1 -1
  4. package/dist/{chunk-MM3F43H6.js → chunk-4UZE4ADL.js} +54 -23
  5. package/dist/{chunk-V7NTQ6UB.js → chunk-DFQSQQEU.js} +1 -1
  6. package/dist/{chunk-RADH6ECW.js → chunk-IQ7JE43O.js} +1442 -1318
  7. package/dist/{chunk-JBTVDYJM.js → chunk-J3XSJCO5.js} +4 -4
  8. package/dist/{chunk-T5VKNPLD.js → chunk-KIGVJVX4.js} +52 -23
  9. package/dist/{chunk-ZLWYP3RB.js → chunk-MUQZOUV5.js} +1 -1
  10. package/dist/{chunk-2CLMIRKL.js → chunk-NRSAAMIF.js} +1 -1
  11. package/dist/{chunk-7HMX2MTY.js → chunk-ODAAPNSL.js} +1 -1
  12. package/dist/{chunk-KNGDSMMF.js → chunk-Q7SB3R25.js} +1 -1
  13. package/dist/{chunk-MIXN7VBY.js → chunk-UK6E2563.js} +1 -1
  14. package/dist/{chunk-OFP5BE7H.js → chunk-VPTRE7IW.js} +2 -2
  15. package/dist/{ci-FYXVC5MX.js → ci-42ZBP2SY.js} +3 -3
  16. package/dist/{constants-RB5H7L34.js → constants-NCWVAAI7.js} +1 -1
  17. package/dist/{doctor-cli-ZWLHBS43.js → doctor-cli-R3SWTL5Z.js} +5 -5
  18. package/dist/electron-server.js +1341 -1131
  19. package/dist/{hub-X4OBH5A3.js → hub-3ZGIM2FN.js} +1 -1
  20. package/dist/index.js +480 -584
  21. package/dist/{run-tests-625NA546.js → run-tests-IJYP6BMT.js} +1 -1
  22. package/dist/{run-tests-CRVIUT4O.js → run-tests-NS3SPH6S.js} +2 -2
  23. package/dist/{server-Q3A737OP.js → server-SVTSJ3PK.js} +5 -5
  24. package/dist/{server-O6ZMNWNS.js → server-TZRMRT3O.js} +208 -260
  25. package/dist/{task-orchestrator-TLUGDQMO.js → task-orchestrator-GMJ5PLVV.js} +5 -5
  26. package/dist/{usage-B4OU5CDJ.js → usage-IYMFSHDX.js} +2 -2
  27. package/package.json +1 -1
@@ -5,10 +5,10 @@ import {
5
5
  } from "./chunk-HDSKW7Q3.js";
6
6
  import {
7
7
  runTestsTool
8
- } from "./chunk-2CLMIRKL.js";
8
+ } from "./chunk-NRSAAMIF.js";
9
9
  import {
10
10
  runTool
11
- } from "./chunk-V7NTQ6UB.js";
11
+ } from "./chunk-DFQSQQEU.js";
12
12
  import {
13
13
  getDangerLevel,
14
14
  isFileWriteTool
@@ -25,14 +25,14 @@ import {
25
25
  SUBAGENT_ALLOWED_TOOLS,
26
26
  SUBAGENT_DEFAULT_MAX_ROUNDS,
27
27
  SUBAGENT_MAX_ROUNDS_LIMIT
28
- } from "./chunk-MIXN7VBY.js";
28
+ } from "./chunk-UK6E2563.js";
29
29
  import {
30
30
  fileCheckpoints
31
31
  } from "./chunk-4BKXL7SM.js";
32
32
  import {
33
33
  loadChatIndex,
34
34
  searchChatMemory
35
- } from "./chunk-MM3F43H6.js";
35
+ } from "./chunk-4UZE4ADL.js";
36
36
  import {
37
37
  indexProject
38
38
  } from "./chunk-VNNYHW6N.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-JV5N65KN.js";
6
6
 
7
7
  // src/memory/chat-index.ts
8
- import fs from "fs";
8
+ import fs2 from "fs";
9
9
  import path from "path";
10
10
  import os from "os";
11
11
  import crypto from "crypto";
@@ -118,6 +118,41 @@ function redactJson(value, options) {
118
118
  return { value: redacted, hits: allHits };
119
119
  }
120
120
 
121
+ // src/core/atomic-write.ts
122
+ import fs from "fs";
123
+ var RETRYABLE_CODES = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
124
+ var MAX_RENAME_RETRIES = 10;
125
+ function sleepSync(ms) {
126
+ const sab = new Int32Array(new SharedArrayBuffer(4));
127
+ Atomics.wait(sab, 0, 0, ms);
128
+ }
129
+ function atomicWriteFileSync(target, data) {
130
+ const tmp = `${target}.tmp`;
131
+ fs.writeFileSync(tmp, data);
132
+ for (let attempt = 0; ; attempt++) {
133
+ try {
134
+ fs.renameSync(tmp, target);
135
+ return;
136
+ } catch (err) {
137
+ const code = err.code;
138
+ if (attempt < MAX_RENAME_RETRIES && code && RETRYABLE_CODES.has(code)) {
139
+ sleepSync(5 * (attempt + 1));
140
+ continue;
141
+ }
142
+ try {
143
+ fs.writeFileSync(target, data);
144
+ try {
145
+ fs.unlinkSync(tmp);
146
+ } catch {
147
+ }
148
+ return;
149
+ } catch {
150
+ throw err;
151
+ }
152
+ }
153
+ }
154
+ }
155
+
121
156
  // src/memory/chat-index.ts
122
157
  var MEMORY_DIR_NAME = "memory-index";
123
158
  var CHUNKS_FILE = "chunks.json";
@@ -205,7 +240,7 @@ function writeVectorsFile(chunks, vectors) {
205
240
  );
206
241
  }
207
242
  const dir = memoryIndexDir();
208
- fs.mkdirSync(dir, { recursive: true });
243
+ fs2.mkdirSync(dir, { recursive: true });
209
244
  const totalBytes = VEC_HEADER_BYTES + vectors.byteLength;
210
245
  const buf = Buffer.alloc(totalBytes);
211
246
  buf.writeUInt32LE(VEC_MAGIC, 0);
@@ -213,17 +248,14 @@ function writeVectorsFile(chunks, vectors) {
213
248
  buf.writeUInt32LE(chunks.length, 8);
214
249
  buf.writeUInt32LE(EMBEDDING_DIM, 12);
215
250
  Buffer.from(vectors.buffer, vectors.byteOffset, vectors.byteLength).copy(buf, VEC_HEADER_BYTES);
216
- const target = vectorsPath();
217
- const tmp = `${target}.tmp`;
218
- fs.writeFileSync(tmp, buf);
219
- fs.renameSync(tmp, target);
251
+ atomicWriteFileSync(vectorsPath(), buf);
220
252
  }
221
253
  function readVectorsFile(expectedCount) {
222
254
  const p = vectorsPath();
223
- if (!fs.existsSync(p)) return null;
255
+ if (!fs2.existsSync(p)) return null;
224
256
  let buf;
225
257
  try {
226
- buf = fs.readFileSync(p);
258
+ buf = fs2.readFileSync(p);
227
259
  } catch {
228
260
  return null;
229
261
  }
@@ -242,17 +274,14 @@ function readVectorsFile(expectedCount) {
242
274
  }
243
275
  function writeIndexFile(idx) {
244
276
  const dir = memoryIndexDir();
245
- fs.mkdirSync(dir, { recursive: true });
246
- const target = chunksPath();
247
- const tmp = `${target}.tmp`;
248
- fs.writeFileSync(tmp, JSON.stringify(idx, null, 2), "utf-8");
249
- fs.renameSync(tmp, target);
277
+ fs2.mkdirSync(dir, { recursive: true });
278
+ atomicWriteFileSync(chunksPath(), JSON.stringify(idx, null, 2));
250
279
  }
251
280
  function readIndexFile() {
252
281
  const p = chunksPath();
253
- if (!fs.existsSync(p)) return null;
282
+ if (!fs2.existsSync(p)) return null;
254
283
  try {
255
- const raw = fs.readFileSync(p, "utf-8");
284
+ const raw = fs2.readFileSync(p, "utf-8");
256
285
  const data = JSON.parse(raw);
257
286
  if (data.version !== 1) return null;
258
287
  return data;
@@ -269,24 +298,24 @@ function loadChatIndex() {
269
298
  }
270
299
  function clearChatIndex() {
271
300
  try {
272
- if (fs.existsSync(chunksPath())) fs.unlinkSync(chunksPath());
301
+ if (fs2.existsSync(chunksPath())) fs2.unlinkSync(chunksPath());
273
302
  } catch {
274
303
  }
275
304
  try {
276
- if (fs.existsSync(vectorsPath())) fs.unlinkSync(vectorsPath());
305
+ if (fs2.existsSync(vectorsPath())) fs2.unlinkSync(vectorsPath());
277
306
  } catch {
278
307
  }
279
308
  }
280
309
  function listSessionFiles() {
281
310
  const dir = historyDir();
282
- if (!fs.existsSync(dir)) return [];
311
+ if (!fs2.existsSync(dir)) return [];
283
312
  const out = [];
284
- for (const name of fs.readdirSync(dir)) {
313
+ for (const name of fs2.readdirSync(dir)) {
285
314
  if (!name.endsWith(".json")) continue;
286
315
  const id = name.replace(/\.json$/, "");
287
316
  const p = path.join(dir, name);
288
317
  try {
289
- const st = fs.statSync(p);
318
+ const st = fs2.statSync(p);
290
319
  out.push({ id, path: p, mtime: st.mtimeMs });
291
320
  } catch {
292
321
  }
@@ -295,7 +324,7 @@ function listSessionFiles() {
295
324
  }
296
325
  function readSession(p) {
297
326
  try {
298
- const data = JSON.parse(fs.readFileSync(p, "utf-8"));
327
+ const data = JSON.parse(fs2.readFileSync(p, "utf-8"));
299
328
  if (!data.id || !Array.isArray(data.messages)) return null;
300
329
  return data;
301
330
  } catch {
@@ -438,8 +467,8 @@ function getChatIndexStatus() {
438
467
  chunksFileSizeBytes: 0
439
468
  };
440
469
  try {
441
- if (fs.existsSync(vectorsPath())) status.vecFileSizeBytes = fs.statSync(vectorsPath()).size;
442
- if (fs.existsSync(chunksPath())) status.chunksFileSizeBytes = fs.statSync(chunksPath()).size;
470
+ if (fs2.existsSync(vectorsPath())) status.vecFileSizeBytes = fs2.statSync(vectorsPath()).size;
471
+ if (fs2.existsSync(chunksPath())) status.chunksFileSizeBytes = fs2.statSync(chunksPath()).size;
443
472
  } catch {
444
473
  }
445
474
  const idx = readIndexFile();
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  CONFIG_DIR_NAME,
4
4
  VERSION
5
- } from "./chunk-MIXN7VBY.js";
5
+ } from "./chunk-UK6E2563.js";
6
6
 
7
7
  // src/diagnostics/crash-log.ts
8
8
  import {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  TEST_TIMEOUT
4
- } from "./chunk-MIXN7VBY.js";
4
+ } from "./chunk-UK6E2563.js";
5
5
 
6
6
  // src/tools/builtin/run-tests.ts
7
7
  import { execSync, spawnSync } from "child_process";
@@ -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.186";
9
+ var VERSION = "0.4.188";
10
10
  var APP_NAME = "ai-cli";
11
11
  var CONFIG_DIR_NAME = ".aicli";
12
12
  var CONFIG_FILE_NAME = "config.json";
@@ -8,7 +8,7 @@ import {
8
8
  CONFIG_FILE_NAME,
9
9
  HISTORY_DIR_NAME,
10
10
  PLUGINS_DIR_NAME
11
- } from "./chunk-MIXN7VBY.js";
11
+ } from "./chunk-UK6E2563.js";
12
12
 
13
13
  // src/config/config-manager.ts
14
14
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/core/constants.ts
4
- var VERSION = "0.4.186";
4
+ var VERSION = "0.4.188";
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
  truncateForPersist
4
- } from "./chunk-JBTVDYJM.js";
4
+ } from "./chunk-J3XSJCO5.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-MIXN7VBY.js";
14
+ } from "./chunk-UK6E2563.js";
15
15
 
16
16
  // src/mcp/client.ts
17
17
  import { spawn } from "child_process";
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-HLWUDRBO.js";
7
7
  import {
8
8
  ProviderRegistry
9
- } from "./chunk-RADH6ECW.js";
9
+ } from "./chunk-IQ7JE43O.js";
10
10
  import "./chunk-HIU2SH4V.js";
11
11
  import {
12
12
  ConfigManager
13
- } from "./chunk-KNGDSMMF.js";
13
+ } from "./chunk-Q7SB3R25.js";
14
14
  import "./chunk-TZQHYZKT.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-MIXN7VBY.js";
17
+ } from "./chunk-UK6E2563.js";
18
18
  import "./chunk-PDX44BCA.js";
19
19
 
20
20
  // src/cli/ci.ts
@@ -36,7 +36,7 @@ import {
36
36
  TEST_TIMEOUT,
37
37
  VERSION,
38
38
  buildUserIdentityPrompt
39
- } from "./chunk-MIXN7VBY.js";
39
+ } from "./chunk-UK6E2563.js";
40
40
  import "./chunk-PDX44BCA.js";
41
41
  export {
42
42
  AGENTIC_BEHAVIOR_GUIDELINE,
@@ -2,26 +2,26 @@
2
2
  import {
3
3
  getConfigDirUsage,
4
4
  listRecentCrashes
5
- } from "./chunk-ZLWYP3RB.js";
5
+ } from "./chunk-MUQZOUV5.js";
6
6
  import {
7
7
  ProviderRegistry
8
- } from "./chunk-RADH6ECW.js";
8
+ } from "./chunk-IQ7JE43O.js";
9
9
  import {
10
10
  getStatsSnapshot,
11
11
  getTopFailingTools,
12
12
  getTopUsedTools,
13
13
  resetStats
14
- } from "./chunk-V7NTQ6UB.js";
14
+ } from "./chunk-DFQSQQEU.js";
15
15
  import "./chunk-HIU2SH4V.js";
16
16
  import {
17
17
  ConfigManager
18
- } from "./chunk-KNGDSMMF.js";
18
+ } from "./chunk-Q7SB3R25.js";
19
19
  import "./chunk-TZQHYZKT.js";
20
20
  import {
21
21
  DEV_STATE_FILE_NAME,
22
22
  MEMORY_FILE_NAME,
23
23
  VERSION
24
- } from "./chunk-MIXN7VBY.js";
24
+ } from "./chunk-UK6E2563.js";
25
25
  import "./chunk-PDX44BCA.js";
26
26
 
27
27
  // src/diagnostics/doctor-cli.ts