unforgit 0.11.7 → 0.11.9

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.
@@ -3392,7 +3392,7 @@ var LocalStore = class {
3392
3392
  ).all(orgId, repoId, since.toISOString());
3393
3393
  return rows.map(rowToMemory);
3394
3394
  }
3395
- upsertFromRemote(memory) {
3395
+ upsertFromRemote(memory, conflictResolution = "last_write_wins") {
3396
3396
  const existing = this.getById(memory.id);
3397
3397
  const now = (/* @__PURE__ */ new Date()).toISOString();
3398
3398
  const normalizedOrgId = memory.orgId.toLowerCase();
@@ -3437,6 +3437,10 @@ var LocalStore = class {
3437
3437
  }
3438
3438
  }
3439
3439
  const hasConflict = localVersion !== remoteVersion && existing.updatedAt > memory.updatedAt;
3440
+ const preserveLocal = hasConflict && (conflictResolution === "manual" || conflictResolution === "local_wins" || conflictResolution === "last_write_wins" && existing.updatedAt >= memory.updatedAt);
3441
+ if (preserveLocal) {
3442
+ return { action: "skipped", conflict: true };
3443
+ }
3440
3444
  this.db.prepare(
3441
3445
  `UPDATE memories SET
3442
3446
  memory_type = ?, visibility = ?, status = ?, text = ?, summary = ?, tags = ?,
@@ -4424,4 +4428,4 @@ export {
4424
4428
  RemoteClient,
4425
4429
  LocalStore
4426
4430
  };
4427
- //# sourceMappingURL=chunk-23T3TBYJ.js.map
4431
+ //# sourceMappingURL=chunk-ZAM372VB.js.map