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.
- package/dist/{batch-IPALJR2D.js → batch-D6K2KHJK.js} +2 -2
- package/dist/{chat-index-2I7ZHRE5.js → chat-index-JXTYDRCY.js} +1 -1
- package/dist/{chat-index-BE4TPLFH.js → chat-index-WDMVP7BN.js} +1 -1
- package/dist/{chunk-MM3F43H6.js → chunk-4UZE4ADL.js} +54 -23
- package/dist/{chunk-V7NTQ6UB.js → chunk-DFQSQQEU.js} +1 -1
- package/dist/{chunk-RADH6ECW.js → chunk-IQ7JE43O.js} +1442 -1318
- package/dist/{chunk-JBTVDYJM.js → chunk-J3XSJCO5.js} +4 -4
- package/dist/{chunk-T5VKNPLD.js → chunk-KIGVJVX4.js} +52 -23
- package/dist/{chunk-ZLWYP3RB.js → chunk-MUQZOUV5.js} +1 -1
- package/dist/{chunk-2CLMIRKL.js → chunk-NRSAAMIF.js} +1 -1
- package/dist/{chunk-7HMX2MTY.js → chunk-ODAAPNSL.js} +1 -1
- package/dist/{chunk-KNGDSMMF.js → chunk-Q7SB3R25.js} +1 -1
- package/dist/{chunk-MIXN7VBY.js → chunk-UK6E2563.js} +1 -1
- package/dist/{chunk-OFP5BE7H.js → chunk-VPTRE7IW.js} +2 -2
- package/dist/{ci-FYXVC5MX.js → ci-42ZBP2SY.js} +3 -3
- package/dist/{constants-RB5H7L34.js → constants-NCWVAAI7.js} +1 -1
- package/dist/{doctor-cli-ZWLHBS43.js → doctor-cli-R3SWTL5Z.js} +5 -5
- package/dist/electron-server.js +1341 -1131
- package/dist/{hub-X4OBH5A3.js → hub-3ZGIM2FN.js} +1 -1
- package/dist/index.js +480 -584
- package/dist/{run-tests-625NA546.js → run-tests-IJYP6BMT.js} +1 -1
- package/dist/{run-tests-CRVIUT4O.js → run-tests-NS3SPH6S.js} +2 -2
- package/dist/{server-Q3A737OP.js → server-SVTSJ3PK.js} +5 -5
- package/dist/{server-O6ZMNWNS.js → server-TZRMRT3O.js} +208 -260
- package/dist/{task-orchestrator-TLUGDQMO.js → task-orchestrator-GMJ5PLVV.js} +5 -5
- package/dist/{usage-B4OU5CDJ.js → usage-IYMFSHDX.js} +2 -2
- 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-
|
|
8
|
+
} from "./chunk-NRSAAMIF.js";
|
|
9
9
|
import {
|
|
10
10
|
runTool
|
|
11
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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 (!
|
|
255
|
+
if (!fs2.existsSync(p)) return null;
|
|
224
256
|
let buf;
|
|
225
257
|
try {
|
|
226
|
-
buf =
|
|
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
|
-
|
|
246
|
-
|
|
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 (!
|
|
282
|
+
if (!fs2.existsSync(p)) return null;
|
|
254
283
|
try {
|
|
255
|
-
const raw =
|
|
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 (
|
|
301
|
+
if (fs2.existsSync(chunksPath())) fs2.unlinkSync(chunksPath());
|
|
273
302
|
} catch {
|
|
274
303
|
}
|
|
275
304
|
try {
|
|
276
|
-
if (
|
|
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 (!
|
|
311
|
+
if (!fs2.existsSync(dir)) return [];
|
|
283
312
|
const out = [];
|
|
284
|
-
for (const name of
|
|
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 =
|
|
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(
|
|
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 (
|
|
442
|
-
if (
|
|
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();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
truncateForPersist
|
|
4
|
-
} from "./chunk-
|
|
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-
|
|
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-
|
|
9
|
+
} from "./chunk-IQ7JE43O.js";
|
|
10
10
|
import "./chunk-HIU2SH4V.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-Q7SB3R25.js";
|
|
14
14
|
import "./chunk-TZQHYZKT.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-UK6E2563.js";
|
|
18
18
|
import "./chunk-PDX44BCA.js";
|
|
19
19
|
|
|
20
20
|
// src/cli/ci.ts
|
|
@@ -2,26 +2,26 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MUQZOUV5.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IQ7JE43O.js";
|
|
9
9
|
import {
|
|
10
10
|
getStatsSnapshot,
|
|
11
11
|
getTopFailingTools,
|
|
12
12
|
getTopUsedTools,
|
|
13
13
|
resetStats
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DFQSQQEU.js";
|
|
15
15
|
import "./chunk-HIU2SH4V.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
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-
|
|
24
|
+
} from "./chunk-UK6E2563.js";
|
|
25
25
|
import "./chunk-PDX44BCA.js";
|
|
26
26
|
|
|
27
27
|
// src/diagnostics/doctor-cli.ts
|