lody 0.110.0 → 0.110.1
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/{acp-interaction-owner-CdfQZsA1.js → acp-interaction-owner-CcAOYmEj.js} +4 -4
- package/dist/{agent-execution-BDaiNzV1.js → agent-execution-DbMHu2MY.js} +73 -3
- package/dist/chunks/{vendor-diff-1FyGa8Sd.js → vendor-diff-CPHd5agL.js} +251 -1
- package/dist/{client-CdDGKDiJ.js → client-CBW0Grpt.js} +4 -4
- package/dist/{code-collab-Q9UJxF5f.js → code-collab-COUEig0Z.js} +238 -155
- package/dist/{daemon-session-tools-B2o_Rn8o.js → daemon-session-tools-DgWu5_Fi.js} +4 -4
- package/dist/{diff-line-counts-Cfd7ywAS.js → diff-line-counts-C4QnbxuZ.js} +2 -2
- package/dist/{diff-worker-task-D7Ri1Pxx.js → diff-worker-task-CRv8CGSL.js} +2 -2
- package/dist/diff-worker.js +3 -3
- package/dist/{directory-handle-D3jV-baK.js → directory-handle-DT-Xm7WB.js} +5 -5
- package/dist/{dsh-plugins-bpB7jsn7.js → dsh-plugins-D2C2tzW9.js} +10 -10
- package/dist/file-index-scan-worker.js +4 -4
- package/dist/{file-lock-De7Gp7uV.js → file-lock-Ct7V9_V7.js} +5 -5
- package/dist/{index-DCvrDzQ4.js → index-C4-tIIH9.js} +5 -5
- package/dist/{index-Ct3cdpLb.js → index-Drq2NUA9.js} +95 -93
- package/dist/{index-CCkzRWUs.js → index-FDl9UATC.js} +7 -7
- package/dist/{index-Dr_w9T6F.js → index-R0ifto56.js} +5 -5
- package/dist/index.js +4 -4
- package/dist/{register-D7pWlArd.js → register-DDeKCzbJ.js} +1012 -83
- package/dist/{remote-pairing-1sJYblth.js → remote-pairing-CcEqyvpe.js} +5 -5
- package/dist/{reset-identity-DdzOplMy.js → reset-identity-E0bQ4nDX.js} +6 -6
- package/dist/{review-viewer-Be1SFRPK.js → review-viewer-CuYdljPk.js} +2 -2
- package/dist/{schedule-command-client--Bl9vjMS.js → schedule-command-client-SjsG4n0y.js} +4 -4
- package/dist/{telemetry-CHUhwRVv.js → telemetry-CztoQabb.js} +1155 -751
- package/dist/turn-diff-store-worker.js +92 -4
- package/dist/{workspace-legacy-CAbHfoet.js → workspace-legacy-Cu3kw51y.js} +246 -113
- package/package.json +1 -1
|
@@ -400,12 +400,22 @@ class SqliteTurnDiffStore {
|
|
|
400
400
|
db;
|
|
401
401
|
options;
|
|
402
402
|
closed = false;
|
|
403
|
+
readOnly;
|
|
403
404
|
constructor(options) {
|
|
404
405
|
this.options = normalizeOptions(options);
|
|
405
|
-
|
|
406
|
-
this.
|
|
406
|
+
this.readOnly = options.readOnly === true;
|
|
407
|
+
if (!this.readOnly) mkdirSync(path__default.dirname(this.options.dbPath), { recursive: true });
|
|
408
|
+
this.db = new Database(this.options.dbPath, {
|
|
409
|
+
timeout: 5e3,
|
|
410
|
+
readonly: this.readOnly,
|
|
411
|
+
fileMustExist: this.readOnly
|
|
412
|
+
});
|
|
407
413
|
try {
|
|
408
|
-
this.
|
|
414
|
+
if (this.readOnly) {
|
|
415
|
+
if (this.db.pragma("application_id", { simple: true }) !== TURN_DIFF_APPLICATION_ID || this.db.pragma("user_version", { simple: true }) !== SCHEMA_VERSION || schemaFingerprint(readSchemaObjects(this.db)) !== expectedSchemaFingerprint(CURRENT_SCHEMA_SQL)) {
|
|
416
|
+
throw this.unknownSchemaError();
|
|
417
|
+
}
|
|
418
|
+
} else this.initializeSchema();
|
|
409
419
|
} catch (error) {
|
|
410
420
|
this.db.close();
|
|
411
421
|
throw error;
|
|
@@ -417,6 +427,7 @@ class SqliteTurnDiffStore {
|
|
|
417
427
|
this.db.close();
|
|
418
428
|
}
|
|
419
429
|
allocateHeadProof() {
|
|
430
|
+
this.assertWritable();
|
|
420
431
|
this.assertOpen();
|
|
421
432
|
const allocate = this.db.transaction(() => {
|
|
422
433
|
const row = this.db.prepare(
|
|
@@ -435,6 +446,7 @@ class SqliteTurnDiffStore {
|
|
|
435
446
|
return allocate.immediate();
|
|
436
447
|
}
|
|
437
448
|
recordTurn(input) {
|
|
449
|
+
this.assertWritable();
|
|
438
450
|
this.assertOpen();
|
|
439
451
|
validateRecordInput(input);
|
|
440
452
|
const startedAt = performance.now();
|
|
@@ -579,6 +591,58 @@ class SqliteTurnDiffStore {
|
|
|
579
591
|
).all(input.ownerId, input.nowMs);
|
|
580
592
|
return rows.map((row) => row.path);
|
|
581
593
|
}
|
|
594
|
+
getSnapshotDescriptor(input) {
|
|
595
|
+
this.assertOpen();
|
|
596
|
+
assertSnapshotReadLimit(input.maxRawBytes);
|
|
597
|
+
return this.db.transaction(() => {
|
|
598
|
+
const row = this.selectSnapshot(input);
|
|
599
|
+
if (!row) return { status: "unavailable" };
|
|
600
|
+
if (exceedsSnapshotReadLimit(row.raw_size, input.maxRawBytes)) {
|
|
601
|
+
return { status: "too_large", rawBytes: row.raw_size };
|
|
602
|
+
}
|
|
603
|
+
return {
|
|
604
|
+
status: "ready",
|
|
605
|
+
snapshot: row.snapshot_id === null ? null : {
|
|
606
|
+
hash: row.content_hash.toString("hex"),
|
|
607
|
+
rawBytes: row.raw_size
|
|
608
|
+
}
|
|
609
|
+
};
|
|
610
|
+
})();
|
|
611
|
+
}
|
|
612
|
+
getSnapshotBytes(input) {
|
|
613
|
+
this.assertOpen();
|
|
614
|
+
assertSnapshotReadLimit(input.maxRawBytes);
|
|
615
|
+
if (!/^[0-9a-f]{64}$/u.test(input.hash)) return { status: "unavailable" };
|
|
616
|
+
return this.db.transaction(() => {
|
|
617
|
+
const row = this.selectSnapshot(input);
|
|
618
|
+
if (!row || row.snapshot_id === null || row.content_hash.toString("hex") !== input.hash) {
|
|
619
|
+
return { status: "unavailable" };
|
|
620
|
+
}
|
|
621
|
+
if (exceedsSnapshotReadLimit(row.raw_size, input.maxRawBytes)) {
|
|
622
|
+
return { status: "too_large", rawBytes: row.raw_size };
|
|
623
|
+
}
|
|
624
|
+
return { status: "ready", bytes: this.readSnapshotBytes(row.snapshot_id) };
|
|
625
|
+
})();
|
|
626
|
+
}
|
|
627
|
+
selectSnapshot(input) {
|
|
628
|
+
const side = input.turnId !== void 0 && input.side === "new" ? "new_snapshot_id" : "old_snapshot_id";
|
|
629
|
+
return this.db.prepare(`
|
|
630
|
+
SELECT tf.${side} AS snapshot_id, COALESCE(s.raw_size, 0) AS raw_size,
|
|
631
|
+
s.content_hash
|
|
632
|
+
FROM turn_files AS tf JOIN turns AS t ON t.id = tf.turn_id
|
|
633
|
+
LEFT JOIN snapshots AS s ON s.id = tf.${side}
|
|
634
|
+
WHERE t.owner_id = ? AND tf.path = ? AND t.evicted = 0 AND t.expires_at_ms > ?
|
|
635
|
+
${input.turnId === void 0 ? "" : "AND t.turn_key = ?"}
|
|
636
|
+
ORDER BY t.order_key ASC, t.id ASC LIMIT 1
|
|
637
|
+
`).get(
|
|
638
|
+
...[
|
|
639
|
+
input.ownerId,
|
|
640
|
+
input.path,
|
|
641
|
+
input.nowMs,
|
|
642
|
+
...input.turnId === void 0 ? [] : [input.turnId]
|
|
643
|
+
]
|
|
644
|
+
);
|
|
645
|
+
}
|
|
582
646
|
getEarliestOldSnapshot(input) {
|
|
583
647
|
this.assertOpen();
|
|
584
648
|
assertSnapshotReadLimit(input.maxRawBytes);
|
|
@@ -672,6 +736,7 @@ class SqliteTurnDiffStore {
|
|
|
672
736
|
return rows.map((row) => ({ path: row.path, add: row.add_count, del: row.del_count }));
|
|
673
737
|
}
|
|
674
738
|
shouldRunGc(nowMs) {
|
|
739
|
+
if (this.readOnly) return false;
|
|
675
740
|
this.assertOpen();
|
|
676
741
|
const expired = this.db.prepare("SELECT 1 AS id FROM turns WHERE expires_at_ms <= ? LIMIT 1").get(nowMs);
|
|
677
742
|
return expired !== void 0 || this.storageBytes().total > this.options.maxStorageBytes;
|
|
@@ -684,6 +749,7 @@ class SqliteTurnDiffStore {
|
|
|
684
749
|
}
|
|
685
750
|
}
|
|
686
751
|
beginGc(nowMs) {
|
|
752
|
+
this.assertWritable();
|
|
687
753
|
this.assertOpen();
|
|
688
754
|
const before = this.storageBytes(true);
|
|
689
755
|
return {
|
|
@@ -1091,6 +1157,9 @@ class SqliteTurnDiffStore {
|
|
|
1091
1157
|
}
|
|
1092
1158
|
readSnapshotText(snapshotId) {
|
|
1093
1159
|
if (snapshotId === null) return null;
|
|
1160
|
+
return this.readSnapshotBytes(snapshotId).toString("utf8");
|
|
1161
|
+
}
|
|
1162
|
+
readSnapshotBytes(snapshotId) {
|
|
1094
1163
|
const snapshot = this.db.prepare("SELECT id, content_hash, raw_size FROM snapshots WHERE id = ?").get(snapshotId);
|
|
1095
1164
|
if (!snapshot) throw new Error(`Missing turn-diff snapshot ${snapshotId}.`);
|
|
1096
1165
|
const output = Buffer.allocUnsafe(snapshot.raw_size);
|
|
@@ -1119,7 +1188,7 @@ class SqliteTurnDiffStore {
|
|
|
1119
1188
|
if (!contentHash.equals(snapshot.content_hash)) {
|
|
1120
1189
|
throw new Error(`Turn-diff snapshot ${snapshotId} hash mismatch.`);
|
|
1121
1190
|
}
|
|
1122
|
-
return output
|
|
1191
|
+
return output;
|
|
1123
1192
|
}
|
|
1124
1193
|
deleteTurns(turnIds) {
|
|
1125
1194
|
if (turnIds.length === 0) return { snapshots: 0, chunks: 0 };
|
|
@@ -1252,6 +1321,9 @@ class SqliteTurnDiffStore {
|
|
|
1252
1321
|
const shm = fileSize(`${this.options.dbPath}-shm`);
|
|
1253
1322
|
return { database, wal, shm, total: database + wal + shm };
|
|
1254
1323
|
}
|
|
1324
|
+
assertWritable() {
|
|
1325
|
+
if (this.readOnly) throw new Error("Turn-diff store is read-only.");
|
|
1326
|
+
}
|
|
1255
1327
|
assertOpen() {
|
|
1256
1328
|
if (this.closed) throw new Error("Turn-diff store is closed.");
|
|
1257
1329
|
}
|
|
@@ -1473,6 +1545,22 @@ function runTurnDiffStoreWorker() {
|
|
|
1473
1545
|
});
|
|
1474
1546
|
return;
|
|
1475
1547
|
}
|
|
1548
|
+
if (request.kind === "snapshot-descriptor") {
|
|
1549
|
+
port.postMessage({
|
|
1550
|
+
id: request.id,
|
|
1551
|
+
kind: request.kind,
|
|
1552
|
+
result: store.getSnapshotDescriptor(request.input)
|
|
1553
|
+
});
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
if (request.kind === "snapshot-bytes") {
|
|
1557
|
+
port.postMessage({
|
|
1558
|
+
id: request.id,
|
|
1559
|
+
kind: request.kind,
|
|
1560
|
+
result: store.getSnapshotBytes(request.input)
|
|
1561
|
+
});
|
|
1562
|
+
return;
|
|
1563
|
+
}
|
|
1476
1564
|
if (request.kind === "earliest-old") {
|
|
1477
1565
|
port.postMessage({
|
|
1478
1566
|
id: request.id,
|