threadnote 1.7.1 → 1.7.2

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.
@@ -37023,7 +37023,12 @@ async function loadPendingReindexes(config2, state) {
37023
37023
  }
37024
37024
  const entry = item;
37025
37025
  if (typeof entry.path === "string" && typeof entry.relativePath === "string" && (entry.status === "added" || entry.status === "removed" || entry.status === "modified")) {
37026
- changes.push({ path: entry.path, relativePath: entry.relativePath, status: entry.status });
37026
+ changes.push({
37027
+ path: entry.path,
37028
+ previousContent: typeof entry.previousContent === "string" ? entry.previousContent : void 0,
37029
+ relativePath: entry.relativePath,
37030
+ status: entry.status
37031
+ });
37027
37032
  }
37028
37033
  }
37029
37034
  if (changes.length > 0) {
@@ -39092,7 +39097,7 @@ async function applyChangesToOpenViking(config2, team, changes, options = {}) {
39092
39097
  const currentContent = await readExistingMemoryContent(config2, ov, uri);
39093
39098
  if (currentContent !== void 0) {
39094
39099
  if (change.status === "added") {
39095
- if (currentContent === content) {
39100
+ if (sharedMemoryContentsEquivalent(currentContent, content)) {
39096
39101
  continue;
39097
39102
  }
39098
39103
  throw new Error(
@@ -39131,12 +39136,18 @@ function assertInboundPreviousContentMatches(change, uri, currentContent) {
39131
39136
  );
39132
39137
  }
39133
39138
  const expectedContent = prepareSharedInboundContent(uri, change.previousContent);
39134
- if (currentContent !== expectedContent) {
39139
+ if (!sharedMemoryContentsEquivalent(currentContent, expectedContent)) {
39135
39140
  throw new Error(
39136
39141
  `Refusing to apply inbound shared change for ${uri}: local OpenViking content differs from the previous shared version. Inspect and resolve the local edit first.`
39137
39142
  );
39138
39143
  }
39139
39144
  }
39145
+ function sharedMemoryContentsEquivalent(left, right) {
39146
+ return normalizeSharedMemoryComparisonContent(left) === normalizeSharedMemoryComparisonContent(right);
39147
+ }
39148
+ function normalizeSharedMemoryComparisonContent(content) {
39149
+ return content.replace(/\r\n?/g, "\n").replace(/\n$/, "");
39150
+ }
39140
39151
  function mergeChanges(...lists) {
39141
39152
  const map2 = /* @__PURE__ */ new Map();
39142
39153
  for (const list of lists) {
@@ -8808,7 +8808,12 @@ async function loadPendingReindexes(config, state) {
8808
8808
  }
8809
8809
  const entry = item;
8810
8810
  if (typeof entry.path === "string" && typeof entry.relativePath === "string" && (entry.status === "added" || entry.status === "removed" || entry.status === "modified")) {
8811
- changes.push({ path: entry.path, relativePath: entry.relativePath, status: entry.status });
8811
+ changes.push({
8812
+ path: entry.path,
8813
+ previousContent: typeof entry.previousContent === "string" ? entry.previousContent : void 0,
8814
+ relativePath: entry.relativePath,
8815
+ status: entry.status
8816
+ });
8812
8817
  }
8813
8818
  }
8814
8819
  if (changes.length > 0) {
@@ -11395,7 +11400,7 @@ async function applyChangesToOpenViking(config, team, changes, options = {}) {
11395
11400
  const currentContent = await readExistingMemoryContent(config, ov, uri);
11396
11401
  if (currentContent !== void 0) {
11397
11402
  if (change.status === "added") {
11398
- if (currentContent === content) {
11403
+ if (sharedMemoryContentsEquivalent(currentContent, content)) {
11399
11404
  continue;
11400
11405
  }
11401
11406
  throw new Error(
@@ -11434,12 +11439,18 @@ function assertInboundPreviousContentMatches(change, uri, currentContent) {
11434
11439
  );
11435
11440
  }
11436
11441
  const expectedContent = prepareSharedInboundContent(uri, change.previousContent);
11437
- if (currentContent !== expectedContent) {
11442
+ if (!sharedMemoryContentsEquivalent(currentContent, expectedContent)) {
11438
11443
  throw new Error(
11439
11444
  `Refusing to apply inbound shared change for ${uri}: local OpenViking content differs from the previous shared version. Inspect and resolve the local edit first.`
11440
11445
  );
11441
11446
  }
11442
11447
  }
11448
+ function sharedMemoryContentsEquivalent(left, right) {
11449
+ return normalizeSharedMemoryComparisonContent(left) === normalizeSharedMemoryComparisonContent(right);
11450
+ }
11451
+ function normalizeSharedMemoryComparisonContent(content) {
11452
+ return content.replace(/\r\n?/g, "\n").replace(/\n$/, "");
11453
+ }
11443
11454
  function mergeChanges(...lists) {
11444
11455
  const map = /* @__PURE__ */ new Map();
11445
11456
  for (const list of lists) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "threadnote",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "type": "commonjs",
5
5
  "main": "dist/threadnote.cjs",
6
6
  "description": "Shared local context and handoffs for development agents",