jinzd-ai-cli 0.4.189 → 0.4.190
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/{agent-client-25TIQ6AP.js → agent-client-6GX6QQDU.js} +0 -1
- package/dist/{auth-OI4YRVRG.js → auth-FSTAKSYF.js} +2 -2
- package/dist/{batch-FPPAYC6L.js → batch-HF5RWUBL.js} +7 -15
- package/dist/{chat-index-JXTYDRCY.js → chat-index-FDSGKWQV.js} +2 -2
- package/dist/{chat-index-WDMVP7BN.js → chat-index-UBCWHBLR.js} +2 -2
- package/dist/{chunk-RFXZQBU4.js → chunk-4KMDKDAK.js} +1 -1
- package/dist/{chunk-SH73ZVHY.js → chunk-5CLH6XAW.js} +8 -8
- package/dist/chunk-6BUTA5VW.js +38 -0
- package/dist/{chunk-VRCBXH2W.js → chunk-A4GUGWEY.js} +1 -1
- package/dist/{chunk-YKVFZLSI.js → chunk-AEAYUKSY.js} +2 -2
- package/dist/{chunk-ZWVIDFGY.js → chunk-BXP6YZ2P.js} +4 -3
- package/dist/{chunk-OVWE4E46.js → chunk-CKH4KQ4E.js} +4 -3
- package/dist/{chunk-D6U75FHP.js → chunk-IEQAE3QG.js} +4 -3
- package/dist/chunk-IW3Q7AE5.js +40 -0
- package/dist/{chunk-TEJ4HYLM.js → chunk-JATZIZJV.js} +2 -2
- package/dist/{chunk-GXB7YKF2.js → chunk-JVKAL5Q3.js} +5 -12
- package/dist/{chunk-3SZ7SREY.js → chunk-KHS7RSGR.js} +6 -5
- package/dist/{chunk-RIVZNS3K.js → chunk-MC34ISJU.js} +5 -4
- package/dist/{chunk-5FV2V3TB.js → chunk-NV6W7TZW.js} +1 -1
- package/dist/{chunk-VNNYHW6N.js → chunk-O6UFCEUZ.js} +1 -1
- package/dist/{chunk-DQ2OHJNF.js → chunk-RWM2GFRC.js} +5 -3
- package/dist/{chunk-SEFOKYYP.js → chunk-SQB66GP6.js} +1 -1
- package/dist/{chunk-HDSKW7Q3.js → chunk-T2NL5ZIA.js} +2 -2
- package/dist/{chunk-4UZE4ADL.js → chunk-TB4W4Y4T.js} +18 -52
- package/dist/{chunk-MH3AFJGV.js → chunk-UVW3WLSV.js} +1 -1
- package/dist/{chunk-KIGVJVX4.js → chunk-W7UKO3PS.js} +18 -50
- package/dist/{chunk-NBZ443LN.js → chunk-X4J2DZB5.js} +1 -1
- package/dist/{chunk-A3I5WP5L.js → chunk-YUBD7T2R.js} +5 -4
- package/dist/{chunk-UTO2YO3K.js → chunk-ZN5IEPSS.js} +1 -1
- package/dist/{ci-CGNVIV6U.js → ci-X24WFUDF.js} +2 -3
- package/dist/{constants-EJF3DOM5.js → constants-4QBBHLU4.js} +1 -2
- package/dist/{doctor-cli-WFH6DYVL.js → doctor-cli-EUOCY7VN.js} +5 -5
- package/dist/electron-server.js +46 -58
- package/dist/{file-checkpoint-UHSMHCRU.js → file-checkpoint-CGH6OJVI.js} +0 -1
- package/dist/{file-checkpoint-ZN7KE3TN.js → file-checkpoint-NKBHGC7L.js} +0 -1
- package/dist/{git-context-7KIP4X2V.js → git-context-EXOEHQSF.js} +0 -1
- package/dist/{hub-LCB3RGVQ.js → hub-YW3KLBZM.js} +3 -4
- package/dist/{hub-server-GSTG5MNE.js → hub-server-LJ2JSKZ2.js} +0 -1
- package/dist/index.js +36 -36
- package/dist/{indexer-S6UMGQKA.js → indexer-AKWMYNJI.js} +3 -3
- package/dist/indexer-BMYUUDLH.js +10 -0
- package/dist/{persist-A3R2IAYU.js → persist-L54DPLI7.js} +3 -3
- package/dist/{project-trust-EBGHD7LE.js → project-trust-MUG325AW.js} +4 -11
- package/dist/{project-trust-IFM7FXEV.js → project-trust-NKYHL3VZ.js} +4 -11
- package/dist/{run-tests-R7QATG6O.js → run-tests-7ZUNEUEX.js} +2 -3
- package/dist/{run-tests-XANJLGXT.js → run-tests-OTZE5CEN.js} +1 -2
- package/dist/{semantic-GJJWTI3A.js → semantic-FF6DDJI6.js} +4 -4
- package/dist/{semantic-FKOEXY75.js → semantic-PK7AUOJT.js} +4 -4
- package/dist/{server-ULMPX3CS.js → server-WMLZOLD5.js} +26 -26
- package/dist/{server-HYLAZODW.js → server-YMCGJOXV.js} +10 -10
- package/dist/{store-VMK543OQ.js → store-MWNHVGJT.js} +2 -2
- package/dist/{store-A3TZM6PS.js → store-VO37H6LS.js} +2 -2
- package/dist/{task-orchestrator-UKU2O6IE.js → task-orchestrator-DEWKVJGQ.js} +14 -14
- package/dist/{usage-4R36JZFP.js → usage-5LMWDGZ4.js} +4 -4
- package/dist/{vector-store-Z5OF4WWJ.js → vector-store-BBDXB5IQ.js} +2 -2
- package/dist/{vector-store-PLDSXF3V.js → vector-store-JBAE6PS4.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3RG5ZIWI.js +0 -10
- package/dist/chunk-PDX44BCA.js +0 -11
- package/dist/indexer-ISSNIFQY.js +0 -10
|
@@ -3,9 +3,12 @@ import {
|
|
|
3
3
|
embed,
|
|
4
4
|
embedOne
|
|
5
5
|
} from "./chunk-JV5N65KN.js";
|
|
6
|
+
import {
|
|
7
|
+
atomicWriteFileSync
|
|
8
|
+
} from "./chunk-6BUTA5VW.js";
|
|
6
9
|
|
|
7
10
|
// src/memory/chat-index.ts
|
|
8
|
-
import
|
|
11
|
+
import fs from "fs";
|
|
9
12
|
import path from "path";
|
|
10
13
|
import os from "os";
|
|
11
14
|
import crypto from "crypto";
|
|
@@ -118,41 +121,6 @@ function redactJson(value, options) {
|
|
|
118
121
|
return { value: redacted, hits: allHits };
|
|
119
122
|
}
|
|
120
123
|
|
|
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
|
-
|
|
156
124
|
// src/memory/chat-index.ts
|
|
157
125
|
var MEMORY_DIR_NAME = "memory-index";
|
|
158
126
|
var CHUNKS_FILE = "chunks.json";
|
|
@@ -240,7 +208,7 @@ function writeVectorsFile(chunks, vectors) {
|
|
|
240
208
|
);
|
|
241
209
|
}
|
|
242
210
|
const dir = memoryIndexDir();
|
|
243
|
-
|
|
211
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
244
212
|
const totalBytes = VEC_HEADER_BYTES + vectors.byteLength;
|
|
245
213
|
const buf = Buffer.alloc(totalBytes);
|
|
246
214
|
buf.writeUInt32LE(VEC_MAGIC, 0);
|
|
@@ -252,10 +220,10 @@ function writeVectorsFile(chunks, vectors) {
|
|
|
252
220
|
}
|
|
253
221
|
function readVectorsFile(expectedCount) {
|
|
254
222
|
const p = vectorsPath();
|
|
255
|
-
if (!
|
|
223
|
+
if (!fs.existsSync(p)) return null;
|
|
256
224
|
let buf;
|
|
257
225
|
try {
|
|
258
|
-
buf =
|
|
226
|
+
buf = fs.readFileSync(p);
|
|
259
227
|
} catch {
|
|
260
228
|
return null;
|
|
261
229
|
}
|
|
@@ -274,14 +242,14 @@ function readVectorsFile(expectedCount) {
|
|
|
274
242
|
}
|
|
275
243
|
function writeIndexFile(idx) {
|
|
276
244
|
const dir = memoryIndexDir();
|
|
277
|
-
|
|
245
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
278
246
|
atomicWriteFileSync(chunksPath(), JSON.stringify(idx, null, 2));
|
|
279
247
|
}
|
|
280
248
|
function readIndexFile() {
|
|
281
249
|
const p = chunksPath();
|
|
282
|
-
if (!
|
|
250
|
+
if (!fs.existsSync(p)) return null;
|
|
283
251
|
try {
|
|
284
|
-
const raw =
|
|
252
|
+
const raw = fs.readFileSync(p, "utf-8");
|
|
285
253
|
const data = JSON.parse(raw);
|
|
286
254
|
if (data.version !== 1) return null;
|
|
287
255
|
return data;
|
|
@@ -298,24 +266,24 @@ function loadChatIndex() {
|
|
|
298
266
|
}
|
|
299
267
|
function clearChatIndex() {
|
|
300
268
|
try {
|
|
301
|
-
if (
|
|
269
|
+
if (fs.existsSync(chunksPath())) fs.unlinkSync(chunksPath());
|
|
302
270
|
} catch {
|
|
303
271
|
}
|
|
304
272
|
try {
|
|
305
|
-
if (
|
|
273
|
+
if (fs.existsSync(vectorsPath())) fs.unlinkSync(vectorsPath());
|
|
306
274
|
} catch {
|
|
307
275
|
}
|
|
308
276
|
}
|
|
309
277
|
function listSessionFiles() {
|
|
310
278
|
const dir = historyDir();
|
|
311
|
-
if (!
|
|
279
|
+
if (!fs.existsSync(dir)) return [];
|
|
312
280
|
const out = [];
|
|
313
|
-
for (const name of
|
|
281
|
+
for (const name of fs.readdirSync(dir)) {
|
|
314
282
|
if (!name.endsWith(".json")) continue;
|
|
315
283
|
const id = name.replace(/\.json$/, "");
|
|
316
284
|
const p = path.join(dir, name);
|
|
317
285
|
try {
|
|
318
|
-
const st =
|
|
286
|
+
const st = fs.statSync(p);
|
|
319
287
|
out.push({ id, path: p, mtime: st.mtimeMs });
|
|
320
288
|
} catch {
|
|
321
289
|
}
|
|
@@ -324,7 +292,7 @@ function listSessionFiles() {
|
|
|
324
292
|
}
|
|
325
293
|
function readSession(p) {
|
|
326
294
|
try {
|
|
327
|
-
const data = JSON.parse(
|
|
295
|
+
const data = JSON.parse(fs.readFileSync(p, "utf-8"));
|
|
328
296
|
if (!data.id || !Array.isArray(data.messages)) return null;
|
|
329
297
|
return data;
|
|
330
298
|
} catch {
|
|
@@ -467,8 +435,8 @@ function getChatIndexStatus() {
|
|
|
467
435
|
chunksFileSizeBytes: 0
|
|
468
436
|
};
|
|
469
437
|
try {
|
|
470
|
-
if (
|
|
471
|
-
if (
|
|
438
|
+
if (fs.existsSync(vectorsPath())) status.vecFileSizeBytes = fs.statSync(vectorsPath()).size;
|
|
439
|
+
if (fs.existsSync(chunksPath())) status.chunksFileSizeBytes = fs.statSync(chunksPath()).size;
|
|
472
440
|
} catch {
|
|
473
441
|
}
|
|
474
442
|
const idx = readIndexFile();
|
|
@@ -3,9 +3,12 @@ import {
|
|
|
3
3
|
computeCost,
|
|
4
4
|
formatCost
|
|
5
5
|
} from "./chunk-V37XOYOE.js";
|
|
6
|
+
import {
|
|
7
|
+
atomicWriteFileSync
|
|
8
|
+
} from "./chunk-IW3Q7AE5.js";
|
|
6
9
|
|
|
7
10
|
// src/core/cost-tracker.ts
|
|
8
|
-
import { existsSync, readFileSync
|
|
11
|
+
import { existsSync, readFileSync } from "fs";
|
|
9
12
|
import { join } from "path";
|
|
10
13
|
var CostTracker = class {
|
|
11
14
|
filePath;
|
|
@@ -45,9 +48,7 @@ var CostTracker = class {
|
|
|
45
48
|
// shallow copy — records are plain data
|
|
46
49
|
};
|
|
47
50
|
try {
|
|
48
|
-
|
|
49
|
-
writeFileSync(tmp, JSON.stringify(snapshot, null, 2), "utf-8");
|
|
50
|
-
renameSync(tmp, this.filePath);
|
|
51
|
+
atomicWriteFileSync(this.filePath, JSON.stringify(snapshot, null, 2));
|
|
51
52
|
this.dirty = false;
|
|
52
53
|
} catch (err) {
|
|
53
54
|
console.error("[cost-tracker] Failed to persist cost history:", err);
|
|
@@ -10,12 +10,11 @@ import {
|
|
|
10
10
|
import "./chunk-HIU2SH4V.js";
|
|
11
11
|
import {
|
|
12
12
|
ConfigManager
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-X4J2DZB5.js";
|
|
14
14
|
import "./chunk-TZQHYZKT.js";
|
|
15
15
|
import {
|
|
16
16
|
VERSION
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-PDX44BCA.js";
|
|
17
|
+
} from "./chunk-4KMDKDAK.js";
|
|
19
18
|
|
|
20
19
|
// src/cli/ci.ts
|
|
21
20
|
import { execFileSync, execSync } from "child_process";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
getConfigDirUsage,
|
|
4
4
|
listRecentCrashes
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UVW3WLSV.js";
|
|
6
6
|
import {
|
|
7
7
|
ProviderRegistry
|
|
8
8
|
} from "./chunk-IQ7JE43O.js";
|
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
getTopFailingTools,
|
|
12
12
|
getTopUsedTools,
|
|
13
13
|
resetStats
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-KHS7RSGR.js";
|
|
15
15
|
import "./chunk-HIU2SH4V.js";
|
|
16
16
|
import {
|
|
17
17
|
ConfigManager
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-X4J2DZB5.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-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
} from "./chunk-4KMDKDAK.js";
|
|
25
|
+
import "./chunk-IW3Q7AE5.js";
|
|
26
26
|
|
|
27
27
|
// src/diagnostics/doctor-cli.ts
|
|
28
28
|
import { existsSync, statSync } from "fs";
|
package/dist/electron-server.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-SKET65WZ.js";
|
|
4
4
|
import {
|
|
5
5
|
indexProject
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SQB66GP6.js";
|
|
7
7
|
import {
|
|
8
8
|
AGENTIC_BEHAVIOR_GUIDELINE,
|
|
9
9
|
APP_NAME,
|
|
@@ -36,22 +36,24 @@ import {
|
|
|
36
36
|
VERSION,
|
|
37
37
|
buildUserIdentityPrompt,
|
|
38
38
|
runTestsTool
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-ZN5IEPSS.js";
|
|
40
40
|
import {
|
|
41
41
|
hasSemanticIndex,
|
|
42
42
|
semanticSearch
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-AEAYUKSY.js";
|
|
44
44
|
import {
|
|
45
45
|
loadIndex
|
|
46
|
-
} from "./chunk-
|
|
47
|
-
import "./chunk-
|
|
46
|
+
} from "./chunk-RWM2GFRC.js";
|
|
47
|
+
import "./chunk-IEQAE3QG.js";
|
|
48
48
|
import {
|
|
49
49
|
loadChatIndex,
|
|
50
50
|
redactJson,
|
|
51
51
|
searchChatMemory
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-W7UKO3PS.js";
|
|
53
53
|
import "./chunk-JV5N65KN.js";
|
|
54
|
-
import
|
|
54
|
+
import {
|
|
55
|
+
atomicWriteFileSync
|
|
56
|
+
} from "./chunk-6BUTA5VW.js";
|
|
55
57
|
|
|
56
58
|
// src/web/server.ts
|
|
57
59
|
import express from "express";
|
|
@@ -3765,7 +3767,7 @@ var ProviderRegistry = class {
|
|
|
3765
3767
|
};
|
|
3766
3768
|
|
|
3767
3769
|
// src/session/session-manager.ts
|
|
3768
|
-
import { readFileSync as readFileSync2,
|
|
3770
|
+
import { readFileSync as readFileSync2, existsSync as existsSync2, mkdirSync as mkdirSync2, readdirSync, unlinkSync, openSync, readSync, closeSync } from "fs";
|
|
3769
3771
|
import { join as join2 } from "path";
|
|
3770
3772
|
import { v4 as uuidv4 } from "uuid";
|
|
3771
3773
|
|
|
@@ -4351,9 +4353,7 @@ var SessionManager = class {
|
|
|
4351
4353
|
const opts = this.redactOptionsForSave();
|
|
4352
4354
|
const { value: payload, hits } = redactJson(raw, opts);
|
|
4353
4355
|
this.lastRedactionHits = hits.length;
|
|
4354
|
-
|
|
4355
|
-
writeFileSync2(tmpPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
4356
|
-
renameSync(tmpPath, filePath);
|
|
4356
|
+
atomicWriteFileSync(filePath, JSON.stringify(payload, null, 2));
|
|
4357
4357
|
}
|
|
4358
4358
|
loadSession(id) {
|
|
4359
4359
|
const filePath = join2(this.historyDir, `${id}.json`);
|
|
@@ -4541,7 +4541,7 @@ import { platform } from "os";
|
|
|
4541
4541
|
import { resolve } from "path";
|
|
4542
4542
|
|
|
4543
4543
|
// src/tools/undo-stack.ts
|
|
4544
|
-
import { readFileSync as readFileSync3, writeFileSync as
|
|
4544
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, unlinkSync as unlinkSync2, rmdirSync, existsSync as existsSync3 } from "fs";
|
|
4545
4545
|
var MAX_UNDO_DEPTH = 20;
|
|
4546
4546
|
var UndoStack = class {
|
|
4547
4547
|
stack = [];
|
|
@@ -4624,7 +4624,7 @@ var UndoStack = class {
|
|
|
4624
4624
|
return { entry, result: `Deleted newly created file: ${entry.filePath}` };
|
|
4625
4625
|
}
|
|
4626
4626
|
} else {
|
|
4627
|
-
|
|
4627
|
+
writeFileSync2(entry.filePath, entry.previousContent, "utf-8");
|
|
4628
4628
|
const lines = entry.previousContent.split("\n").length;
|
|
4629
4629
|
return {
|
|
4630
4630
|
entry,
|
|
@@ -5474,7 +5474,7 @@ ${content}`;
|
|
|
5474
5474
|
};
|
|
5475
5475
|
|
|
5476
5476
|
// src/tools/builtin/write-file.ts
|
|
5477
|
-
import { writeFileSync as
|
|
5477
|
+
import { writeFileSync as writeFileSync3, appendFileSync, mkdirSync as mkdirSync4 } from "fs";
|
|
5478
5478
|
import { dirname as dirname3 } from "path";
|
|
5479
5479
|
|
|
5480
5480
|
// src/tools/executor.ts
|
|
@@ -5876,7 +5876,7 @@ var theme = new Proxy(DARK_THEME, {
|
|
|
5876
5876
|
});
|
|
5877
5877
|
|
|
5878
5878
|
// src/diagnostics/tool-stats.ts
|
|
5879
|
-
import { existsSync as existsSync6, readFileSync as readFileSync5,
|
|
5879
|
+
import { existsSync as existsSync6, readFileSync as readFileSync5, mkdirSync as mkdirSync3 } from "fs";
|
|
5880
5880
|
import { join as join3, dirname as dirname2 } from "path";
|
|
5881
5881
|
import { homedir as homedir3 } from "os";
|
|
5882
5882
|
var STATS_FILE_NAME = "tool-stats.json";
|
|
@@ -5955,9 +5955,7 @@ function flush() {
|
|
|
5955
5955
|
const path3 = statsFilePath();
|
|
5956
5956
|
try {
|
|
5957
5957
|
mkdirSync3(dirname2(path3), { recursive: true });
|
|
5958
|
-
|
|
5959
|
-
writeFileSync4(tmp, JSON.stringify(state, null, 2), "utf-8");
|
|
5960
|
-
renameSync2(tmp, path3);
|
|
5958
|
+
atomicWriteFileSync(path3, JSON.stringify(state, null, 2));
|
|
5961
5959
|
dirty = false;
|
|
5962
5960
|
pendingWrites = 0;
|
|
5963
5961
|
} catch {
|
|
@@ -6613,13 +6611,13 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
6613
6611
|
if (appendMode) {
|
|
6614
6612
|
appendFileSync(filePath, content, encoding);
|
|
6615
6613
|
} else {
|
|
6616
|
-
|
|
6614
|
+
writeFileSync3(filePath, content, encoding);
|
|
6617
6615
|
}
|
|
6618
6616
|
const lines = content.split("\n").length;
|
|
6619
6617
|
const mode = appendMode ? "appended" : "written";
|
|
6620
6618
|
void (async () => {
|
|
6621
6619
|
try {
|
|
6622
|
-
const { updateFile } = await import("./indexer-
|
|
6620
|
+
const { updateFile } = await import("./indexer-BMYUUDLH.js");
|
|
6623
6621
|
await updateFile(process.cwd(), filePath);
|
|
6624
6622
|
} catch {
|
|
6625
6623
|
}
|
|
@@ -6629,7 +6627,7 @@ Do NOT split a long document into many write_file(append=true) calls. That patte
|
|
|
6629
6627
|
};
|
|
6630
6628
|
|
|
6631
6629
|
// src/tools/builtin/edit-file.ts
|
|
6632
|
-
import { readFileSync as readFileSync7, writeFileSync as
|
|
6630
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync8 } from "fs";
|
|
6633
6631
|
|
|
6634
6632
|
// src/tools/builtin/patch-apply.ts
|
|
6635
6633
|
function parseUnifiedDiff(patch) {
|
|
@@ -7028,7 +7026,7 @@ Note: Path can be absolute or relative to cwd.`,
|
|
|
7028
7026
|
if (res.ok && res.appliedCount > 0 && res.content !== void 0) {
|
|
7029
7027
|
undoStack.push(filePath, `edit_file (patch ${res.appliedCount}/${hunks.length}): ${filePath}`);
|
|
7030
7028
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7031
|
-
|
|
7029
|
+
writeFileSync4(filePath, res.content, encoding);
|
|
7032
7030
|
}
|
|
7033
7031
|
return lines.join("\n");
|
|
7034
7032
|
}
|
|
@@ -7062,7 +7060,7 @@ Note: Path can be absolute or relative to cwd.`,
|
|
|
7062
7060
|
if (writeChanges) {
|
|
7063
7061
|
undoStack.push(filePath, `edit_file (batch ${appliedCount}/${edits.length}): ${filePath}`);
|
|
7064
7062
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7065
|
-
|
|
7063
|
+
writeFileSync4(filePath, working, encoding);
|
|
7066
7064
|
}
|
|
7067
7065
|
const lines = [];
|
|
7068
7066
|
if (anyFailed && stopOnError) {
|
|
@@ -7100,7 +7098,7 @@ Please read the file first and use exact text.`;
|
|
|
7100
7098
|
const label = res.info?.mode === "ignore_whitespace" ? "edit_file (ws-replace)" : res.info?.mode === "replace_all" ? "edit_file (replace_all)" : "edit_file (replace)";
|
|
7101
7099
|
undoStack.push(filePath, `${label}: ${filePath}`);
|
|
7102
7100
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7103
|
-
|
|
7101
|
+
writeFileSync4(filePath, res.content, encoding);
|
|
7104
7102
|
if (res.info?.mode === "replace_all") {
|
|
7105
7103
|
return `Successfully edited ${filePath}${modeLabel}
|
|
7106
7104
|
Replaced: ${res.info.replacedCount} occurrence(s) of ${truncatePreview(oldStr)}
|
|
@@ -7124,7 +7122,7 @@ Please read the file first and use exact text.`;
|
|
|
7124
7122
|
undoStack.push(filePath, `edit_file (insert): ${filePath}`);
|
|
7125
7123
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7126
7124
|
lines.splice(afterLine, 0, content);
|
|
7127
|
-
|
|
7125
|
+
writeFileSync4(filePath, lines.join("\n"), encoding);
|
|
7128
7126
|
return `Successfully inserted ${content.split("\n").length} line(s) after line ${afterLine} in ${filePath}`;
|
|
7129
7127
|
}
|
|
7130
7128
|
if (args["delete_from_line"] !== void 0) {
|
|
@@ -7140,7 +7138,7 @@ Please read the file first and use exact text.`;
|
|
|
7140
7138
|
undoStack.push(filePath, `edit_file (delete): ${filePath}`);
|
|
7141
7139
|
fileCheckpoints.snapshot(filePath, ToolExecutor.currentMessageIndex);
|
|
7142
7140
|
const deleted = lines.splice(fromLine - 1, toLine - fromLine + 1);
|
|
7143
|
-
|
|
7141
|
+
writeFileSync4(filePath, lines.join("\n"), encoding);
|
|
7144
7142
|
return `Successfully deleted lines ${fromLine}-${toLine} (${deleted.length} lines) from ${filePath}`;
|
|
7145
7143
|
}
|
|
7146
7144
|
throw new ToolError(
|
|
@@ -8331,7 +8329,7 @@ ${preamble}`;
|
|
|
8331
8329
|
}
|
|
8332
8330
|
|
|
8333
8331
|
// src/tools/builtin/save-last-response.ts
|
|
8334
|
-
import { writeFileSync as
|
|
8332
|
+
import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "fs";
|
|
8335
8333
|
import { dirname as dirname4 } from "path";
|
|
8336
8334
|
var lastResponseStore = { content: "" };
|
|
8337
8335
|
var saveLastResponseTool = {
|
|
@@ -8372,7 +8370,7 @@ Any of these triggers means use save_last_response, NOT write_file:
|
|
|
8372
8370
|
}
|
|
8373
8371
|
undoStack.push(filePath, `save_last_response: ${filePath}`);
|
|
8374
8372
|
mkdirSync5(dirname4(filePath), { recursive: true });
|
|
8375
|
-
|
|
8373
|
+
writeFileSync5(filePath, content, "utf-8");
|
|
8376
8374
|
const lines = content.split("\n").length;
|
|
8377
8375
|
return `File saved: ${filePath} (${lines} lines, ${content.length} bytes)`;
|
|
8378
8376
|
}
|
|
@@ -11176,7 +11174,7 @@ import { existsSync as existsSync19, readFileSync as readFileSync13 } from "fs";
|
|
|
11176
11174
|
import { join as join12 } from "path";
|
|
11177
11175
|
|
|
11178
11176
|
// src/repl/dev-state.ts
|
|
11179
|
-
import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as
|
|
11177
|
+
import { existsSync as existsSync18, readFileSync as readFileSync12, writeFileSync as writeFileSync6, unlinkSync as unlinkSync3, mkdirSync as mkdirSync9 } from "fs";
|
|
11180
11178
|
import { join as join11 } from "path";
|
|
11181
11179
|
import { homedir as homedir6 } from "os";
|
|
11182
11180
|
function getDevStatePath() {
|
|
@@ -11450,7 +11448,7 @@ function autoTrimSessionIfNeeded(session, sizeLimit = SESSION_SIZE_LIMIT) {
|
|
|
11450
11448
|
}
|
|
11451
11449
|
|
|
11452
11450
|
// src/web/session-handler.ts
|
|
11453
|
-
import { existsSync as existsSync21, readFileSync as readFileSync14, appendFileSync as appendFileSync3, writeFileSync as
|
|
11451
|
+
import { existsSync as existsSync21, readFileSync as readFileSync14, appendFileSync as appendFileSync3, writeFileSync as writeFileSync7, mkdirSync as mkdirSync10, readdirSync as readdirSync9, statSync as statSync8, createWriteStream, unlinkSync as unlinkSync4 } from "fs";
|
|
11454
11452
|
import { join as join15, resolve as resolve5, dirname as dirname5 } from "path";
|
|
11455
11453
|
import { execSync as execSync3 } from "child_process";
|
|
11456
11454
|
|
|
@@ -12996,7 +12994,7 @@ This fresh stream has NO tools. Produce ONLY the document body: start with a mar
|
|
|
12996
12994
|
if (pseudoMatch) {
|
|
12997
12995
|
const cleaned = stripPseudoToolCalls(fullContent);
|
|
12998
12996
|
if (looksLikeDocumentBody(cleaned)) {
|
|
12999
|
-
|
|
12997
|
+
writeFileSync7(saveToFile, cleaned, "utf-8");
|
|
13000
12998
|
fullContent = cleaned;
|
|
13001
12999
|
const lines = cleaned.split("\n").length;
|
|
13002
13000
|
const bytes = Buffer.byteLength(cleaned, "utf-8");
|
|
@@ -13840,9 +13838,9 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
13840
13838
|
case "index": {
|
|
13841
13839
|
const sub = (args[0] ?? "status").toLowerCase();
|
|
13842
13840
|
const root = process.cwd();
|
|
13843
|
-
const { loadIndex: loadIndex2, clearIndex } = await import("./store-
|
|
13844
|
-
const { indexProject: indexProject2 } = await import("./indexer-
|
|
13845
|
-
const { loadVectorStore, clearVectorStore } = await import("./vector-store-
|
|
13841
|
+
const { loadIndex: loadIndex2, clearIndex } = await import("./store-VO37H6LS.js");
|
|
13842
|
+
const { indexProject: indexProject2 } = await import("./indexer-BMYUUDLH.js");
|
|
13843
|
+
const { loadVectorStore, clearVectorStore } = await import("./vector-store-JBAE6PS4.js");
|
|
13846
13844
|
if (sub === "status") {
|
|
13847
13845
|
const idx = loadIndex2(root);
|
|
13848
13846
|
const vec = loadVectorStore(root);
|
|
@@ -13891,7 +13889,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
13891
13889
|
message: `Building semantic index for ${idx.symbolCount} symbols\u2026 (first run downloads ~117 MB model)`
|
|
13892
13890
|
});
|
|
13893
13891
|
try {
|
|
13894
|
-
const { rebuildSemanticIndex } = await import("./semantic-
|
|
13892
|
+
const { rebuildSemanticIndex } = await import("./semantic-FF6DDJI6.js");
|
|
13895
13893
|
const stats = await rebuildSemanticIndex(root);
|
|
13896
13894
|
const first = stats.modelFirstLoadMs ? ` (model load+first batch ${stats.modelFirstLoadMs}ms)` : "";
|
|
13897
13895
|
this.send({
|
|
@@ -14039,7 +14037,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
14039
14037
|
if (rewindSub === "list" || !rewindSub) {
|
|
14040
14038
|
const lines = [`Conversation messages (${session.messages.length} total):
|
|
14041
14039
|
`];
|
|
14042
|
-
const cpIndices = (await import("./file-checkpoint-
|
|
14040
|
+
const cpIndices = (await import("./file-checkpoint-CGH6OJVI.js")).fileCheckpoints.getMessageIndices();
|
|
14043
14041
|
for (let i = 0; i < session.messages.length; i++) {
|
|
14044
14042
|
const m = session.messages[i];
|
|
14045
14043
|
const text = getContentText(m.content).replace(/\n/g, " ").slice(0, 60);
|
|
@@ -14055,7 +14053,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
14055
14053
|
this.send({ type: "error", message: `Invalid message number: ${rewindSub}. Range: 1-${session.messages.length}` });
|
|
14056
14054
|
break;
|
|
14057
14055
|
}
|
|
14058
|
-
const { fileCheckpoints: fc } = await import("./file-checkpoint-
|
|
14056
|
+
const { fileCheckpoints: fc } = await import("./file-checkpoint-CGH6OJVI.js");
|
|
14059
14057
|
const rewindRemoved = session.messages.length - rewindN;
|
|
14060
14058
|
const rewindResult = fc.restoreToMessageIndex(rewindN);
|
|
14061
14059
|
session.messages = session.messages.slice(0, rewindN);
|
|
@@ -14078,7 +14076,7 @@ ${undoResults.map((r) => ` \u2022 ${r}`).join("\n")}` });
|
|
|
14078
14076
|
case "test": {
|
|
14079
14077
|
this.send({ type: "info", message: "\u{1F9EA} Running tests..." });
|
|
14080
14078
|
try {
|
|
14081
|
-
const { executeTests } = await import("./run-tests-
|
|
14079
|
+
const { executeTests } = await import("./run-tests-OTZE5CEN.js");
|
|
14082
14080
|
const argStr = args.join(" ").trim();
|
|
14083
14081
|
let testArgs = {};
|
|
14084
14082
|
if (argStr) {
|
|
@@ -14107,7 +14105,7 @@ Use /init --force to overwrite.` });
|
|
|
14107
14105
|
const projectInfo = this.scanProject(cwd);
|
|
14108
14106
|
const prompt = this.buildInitPrompt(projectInfo, cwd);
|
|
14109
14107
|
const content = await this.chatOnce(prompt, { temperature: 0.3, maxTokens: 4096 });
|
|
14110
|
-
|
|
14108
|
+
writeFileSync7(targetPath, content, "utf-8");
|
|
14111
14109
|
this.send({ type: "info", message: `\u2713 Generated: ${targetPath} (${content.length} chars)
|
|
14112
14110
|
Use /context reload to load it.` });
|
|
14113
14111
|
} catch (err) {
|
|
@@ -14586,7 +14584,7 @@ Add .md files to create commands.` });
|
|
|
14586
14584
|
const configDir = this.config.getConfigDir();
|
|
14587
14585
|
const memPath = join15(configDir, MEMORY_FILE_NAME);
|
|
14588
14586
|
try {
|
|
14589
|
-
|
|
14587
|
+
writeFileSync7(memPath, "", "utf-8");
|
|
14590
14588
|
this.send({ type: "info", message: "\u{1F5D1}\uFE0F Persistent memory cleared." });
|
|
14591
14589
|
} catch (err) {
|
|
14592
14590
|
this.send({ type: "error", message: `Failed to clear memory: ${err.message}` });
|
|
@@ -14602,7 +14600,7 @@ Add .md files to create commands.` });
|
|
|
14602
14600
|
return;
|
|
14603
14601
|
}
|
|
14604
14602
|
try {
|
|
14605
|
-
const { searchChatMemory: searchChatMemory2, loadChatIndex: loadChatIndex2 } = await import("./chat-index-
|
|
14603
|
+
const { searchChatMemory: searchChatMemory2, loadChatIndex: loadChatIndex2 } = await import("./chat-index-UBCWHBLR.js");
|
|
14606
14604
|
const loaded = loadChatIndex2();
|
|
14607
14605
|
if (!loaded || loaded.idx.chunks.length === 0) {
|
|
14608
14606
|
this.send({ type: "memory_hits", query: q, hits: [], indexMissing: true });
|
|
@@ -14638,7 +14636,7 @@ Add .md files to create commands.` });
|
|
|
14638
14636
|
}
|
|
14639
14637
|
async handleMemoryStatus() {
|
|
14640
14638
|
try {
|
|
14641
|
-
const { getChatIndexStatus } = await import("./chat-index-
|
|
14639
|
+
const { getChatIndexStatus } = await import("./chat-index-UBCWHBLR.js");
|
|
14642
14640
|
const s = getChatIndexStatus();
|
|
14643
14641
|
this.send({
|
|
14644
14642
|
type: "memory_status",
|
|
@@ -14663,7 +14661,7 @@ Add .md files to create commands.` });
|
|
|
14663
14661
|
type: "info",
|
|
14664
14662
|
message: full ? "\u{1F9E0} Rebuilding chat memory index (this may take a while on first run \u2014 ~117 MB embedder)." : "\u{1F9E0} Refreshing chat memory index (incremental)\u2026"
|
|
14665
14663
|
});
|
|
14666
|
-
const { buildChatIndex } = await import("./chat-index-
|
|
14664
|
+
const { buildChatIndex } = await import("./chat-index-UBCWHBLR.js");
|
|
14667
14665
|
const stats = await buildChatIndex({
|
|
14668
14666
|
full,
|
|
14669
14667
|
onProgress: (p) => {
|
|
@@ -15062,7 +15060,7 @@ async function setupProxy(configProxy) {
|
|
|
15062
15060
|
}
|
|
15063
15061
|
|
|
15064
15062
|
// src/web/auth.ts
|
|
15065
|
-
import { existsSync as existsSync22, readFileSync as readFileSync15, writeFileSync as
|
|
15063
|
+
import { existsSync as existsSync22, readFileSync as readFileSync15, writeFileSync as writeFileSync8, mkdirSync as mkdirSync11, readdirSync as readdirSync10, copyFileSync } from "fs";
|
|
15066
15064
|
import { join as join16 } from "path";
|
|
15067
15065
|
import { createHmac, randomBytes, timingSafeEqual, pbkdf2Sync } from "crypto";
|
|
15068
15066
|
var USERS_FILE = "users.json";
|
|
@@ -15264,7 +15262,7 @@ var AuthManager = class {
|
|
|
15264
15262
|
if (existsSync22(globalConfig)) {
|
|
15265
15263
|
try {
|
|
15266
15264
|
const content = readFileSync15(globalConfig, "utf-8");
|
|
15267
|
-
|
|
15265
|
+
writeFileSync8(join16(userDir, "config.json"), content, "utf-8");
|
|
15268
15266
|
} catch {
|
|
15269
15267
|
}
|
|
15270
15268
|
}
|
|
@@ -15272,7 +15270,7 @@ var AuthManager = class {
|
|
|
15272
15270
|
if (existsSync22(globalMemory)) {
|
|
15273
15271
|
try {
|
|
15274
15272
|
const content = readFileSync15(globalMemory, "utf-8");
|
|
15275
|
-
|
|
15273
|
+
writeFileSync8(join16(userDir, "memory.md"), content, "utf-8");
|
|
15276
15274
|
} catch {
|
|
15277
15275
|
}
|
|
15278
15276
|
}
|
|
@@ -15313,17 +15311,7 @@ var AuthManager = class {
|
|
|
15313
15311
|
}
|
|
15314
15312
|
saveDB(db) {
|
|
15315
15313
|
mkdirSync11(this.baseDir, { recursive: true });
|
|
15316
|
-
|
|
15317
|
-
try {
|
|
15318
|
-
writeFileSync10(tmp, JSON.stringify(db, null, 2), "utf-8");
|
|
15319
|
-
renameSync3(tmp, this.usersFile);
|
|
15320
|
-
} catch (err) {
|
|
15321
|
-
try {
|
|
15322
|
-
unlinkSync5(tmp);
|
|
15323
|
-
} catch {
|
|
15324
|
-
}
|
|
15325
|
-
throw err;
|
|
15326
|
-
}
|
|
15314
|
+
atomicWriteFileSync(this.usersFile, JSON.stringify(db, null, 2));
|
|
15327
15315
|
}
|
|
15328
15316
|
/** Legacy hash — kept only for migrating old users (v0.2.x) */
|
|
15329
15317
|
hashPasswordLegacy(password, salt) {
|
|
@@ -15396,7 +15384,7 @@ async function startWebServer(options = {}) {
|
|
|
15396
15384
|
const projectMcpResolved = mcpEnabled ? resolveProjectMcpPath() : null;
|
|
15397
15385
|
let projectMcpServers = {};
|
|
15398
15386
|
if (projectMcpResolved) {
|
|
15399
|
-
const { checkTrust } = await import("./project-trust-
|
|
15387
|
+
const { checkTrust } = await import("./project-trust-MUG325AW.js");
|
|
15400
15388
|
const verdict = checkTrust(config.getConfigDir(), projectMcpResolved);
|
|
15401
15389
|
if (verdict.trusted) {
|
|
15402
15390
|
projectMcpServers = loadProjectMcpConfig() ?? {};
|