lody 0.76.0 → 0.77.0
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/chunks/{diff-line-counts-Du5QanrM.js → diff-line-counts-bmGB_T-n.js} +1 -2
- package/dist/chunks/diff-worker-task-8tVIjLTu.js +60 -0
- package/dist/chunks/{directory-handle-B50CtQcb.js → directory-handle-BBQKxZ5F.js} +2 -2
- package/dist/chunks/{index-VHXDv9iy.js → index-gHAU1HiK.js} +365 -146
- package/dist/chunks/loro_wasm_bg-BuoLmEH-.js +5398 -0
- package/dist/chunks/{package-C-zjBee4.js → package-qnDHmQq4.js} +2 -2
- package/dist/chunks/review-viewer-DchNTv12.js +154 -0
- package/dist/chunks/{schemas-DAtmu1t9.js → schemas-Du3qLZPS.js} +47 -24
- package/dist/claude-acp.js +582 -100
- package/dist/codex-acp.js +1 -1
- package/dist/diff-worker.js +6 -3
- package/dist/file-index-scan-worker.js +3 -3
- package/dist/index.js +88295 -86755
- package/dist/turn-diff-store-worker.js +1552 -0
- package/package.json +59 -61
- package/dist/chunks/loro_wasm_bg-DLsklGR5.js +0 -5197
- package/dist/chunks/review-viewer-DRumOFSW.js +0 -80
- package/dist/chunks/turn-diff-replay-BUdzlx5r.js +0 -311
- package/dist/turn-diff-replay-worker.js +0 -16
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { open, stat } from "node:fs/promises";
|
|
3
|
+
import { c as computeLineCounts } from "./diff-line-counts-bmGB_T-n.js";
|
|
4
|
+
async function runDiffWorkerTask(input) {
|
|
5
|
+
const lineCounts = computeLineCounts(input.oldText, input.newText);
|
|
6
|
+
if (input.kind === "line-count") return { kind: input.kind, lineCounts };
|
|
7
|
+
return {
|
|
8
|
+
kind: input.kind,
|
|
9
|
+
lineCounts,
|
|
10
|
+
newIsCurrent: await newSnapshotMatchesFile(input.absolutePath, input.newText)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
async function newSnapshotMatchesFile(absolutePath, newText) {
|
|
14
|
+
let file;
|
|
15
|
+
try {
|
|
16
|
+
file = await open(absolutePath, "r");
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if (nodeErrorCode(error) === "ENOENT") return newText === null;
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
if (newText === null) return false;
|
|
23
|
+
const expectedBytes = Buffer.byteLength(newText, "utf8");
|
|
24
|
+
const before = await file.stat({ bigint: true });
|
|
25
|
+
if (before.size !== BigInt(expectedBytes)) return false;
|
|
26
|
+
const diskHash = createHash("sha256");
|
|
27
|
+
const buffer = Buffer.allocUnsafe(Math.min(Math.max(expectedBytes, 1), 64 * 1024));
|
|
28
|
+
let offset = 0;
|
|
29
|
+
while (offset < expectedBytes) {
|
|
30
|
+
const length = Math.min(buffer.byteLength, expectedBytes - offset);
|
|
31
|
+
const { bytesRead } = await file.read(buffer, 0, length, offset);
|
|
32
|
+
if (bytesRead === 0) return false;
|
|
33
|
+
diskHash.update(buffer.subarray(0, bytesRead));
|
|
34
|
+
offset += bytesRead;
|
|
35
|
+
}
|
|
36
|
+
const [after, pathAfter] = await Promise.all([
|
|
37
|
+
file.stat({ bigint: true }),
|
|
38
|
+
stat(absolutePath, { bigint: true }).catch((error) => {
|
|
39
|
+
if (nodeErrorCode(error) === "ENOENT") return null;
|
|
40
|
+
throw error;
|
|
41
|
+
})
|
|
42
|
+
]);
|
|
43
|
+
if (!pathAfter || !sameFileState(before, after) || !sameFileState(after, pathAfter)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const snapshotHash = createHash("sha256").update(newText, "utf8").digest();
|
|
47
|
+
return diskHash.digest().equals(snapshotHash);
|
|
48
|
+
} finally {
|
|
49
|
+
await file.close();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function sameFileState(left, right) {
|
|
53
|
+
return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeNs === right.mtimeNs && left.ctimeNs === right.ctimeNs;
|
|
54
|
+
}
|
|
55
|
+
function nodeErrorCode(error) {
|
|
56
|
+
return error && typeof error === "object" && "code" in error ? String(error.code) : void 0;
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
runDiffWorkerTask as r
|
|
60
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { o as object, s as string, l as literal, b as boolean, a as _enum,
|
|
1
|
+
import { o as object, s as string, l as literal, b as boolean, a as _enum, f as union, n as number, d as discriminatedUnion, c as array, r as record, J as tuple, u as unknown } from "./schemas-Du3qLZPS.js";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import path__default from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
|
-
import { a as countTextLines } from "./diff-line-counts-
|
|
6
|
+
import { a as countTextLines } from "./diff-line-counts-bmGB_T-n.js";
|
|
7
7
|
_enum(["host", "write", "read"]);
|
|
8
8
|
_enum([
|
|
9
9
|
"not-started",
|