ai-project-manage-cli 7.1.7 → 7.1.8

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/index.js CHANGED
@@ -6469,6 +6469,22 @@ var EventSession = class {
6469
6469
  this.dirtyIndices.delete(index);
6470
6470
  }
6471
6471
  }
6472
+ /**
6473
+ * 仅清除仍与上传快照一致的 dirty index。
6474
+ * 异步同步期间若事件内容又变了,保留 dirty,由下一轮 drain 继续覆盖写入。
6475
+ */
6476
+ clearDirtyIfUnchanged(synced) {
6477
+ for (const { index, data } of synced) {
6478
+ const event = this.events[index];
6479
+ if (!event) {
6480
+ this.dirtyIndices.delete(index);
6481
+ continue;
6482
+ }
6483
+ if (JSON.stringify(event) === data) {
6484
+ this.dirtyIndices.delete(index);
6485
+ }
6486
+ }
6487
+ }
6472
6488
  getEventCount() {
6473
6489
  return this.events.length;
6474
6490
  }
@@ -6621,7 +6637,7 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
6621
6637
  lastRunAt = Date.now();
6622
6638
  try {
6623
6639
  await syncCursorMessageLog(cfg, ctx, events);
6624
- session.clearDirty(events.map((event) => event.index));
6640
+ session.clearDirtyIfUnchanged(events);
6625
6641
  } catch (err) {
6626
6642
  onError(err);
6627
6643
  }
@@ -1113,6 +1113,22 @@ var EventSession = class {
1113
1113
  this.dirtyIndices.delete(index);
1114
1114
  }
1115
1115
  }
1116
+ /**
1117
+ * 仅清除仍与上传快照一致的 dirty index。
1118
+ * 异步同步期间若事件内容又变了,保留 dirty,由下一轮 drain 继续覆盖写入。
1119
+ */
1120
+ clearDirtyIfUnchanged(synced) {
1121
+ for (const { index, data } of synced) {
1122
+ const event = this.events[index];
1123
+ if (!event) {
1124
+ this.dirtyIndices.delete(index);
1125
+ continue;
1126
+ }
1127
+ if (JSON.stringify(event) === data) {
1128
+ this.dirtyIndices.delete(index);
1129
+ }
1130
+ }
1131
+ }
1116
1132
  getEventCount() {
1117
1133
  return this.events.length;
1118
1134
  }
@@ -1265,7 +1281,7 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
1265
1281
  lastRunAt = Date.now();
1266
1282
  try {
1267
1283
  await syncCursorMessageLog(cfg, ctx, events);
1268
- session.clearDirty(events.map((event) => event.index));
1284
+ session.clearDirtyIfUnchanged(events);
1269
1285
  } catch (err) {
1270
1286
  onError(err);
1271
1287
  }
@@ -2200,7 +2216,7 @@ function createThrottledWebIdeMessageLogSync(cfg, ctx, onError) {
2200
2216
  await upsertLogHeader(cfg, ctx, {
2201
2217
  eventCount: session.getEventCount()
2202
2218
  });
2203
- session.clearDirty(events.map((e) => e.index));
2219
+ session.clearDirtyIfUnchanged(events);
2204
2220
  } catch (err) {
2205
2221
  onError(err);
2206
2222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "7.1.7",
3
+ "version": "7.1.8",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,