ai-project-manage-cli 6.0.23 → 6.0.24

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1219,7 +1219,8 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
1219
1219
  let lastRunAt = 0;
1220
1220
  let timer;
1221
1221
  let latestSession;
1222
- const syncDirtyEvents = async (session) => {
1222
+ let syncChain = Promise.resolve();
1223
+ const syncDirtyEventsOnce = async (session) => {
1223
1224
  const events = session.getDirtyEvents();
1224
1225
  if (events.length === 0) {
1225
1226
  return;
@@ -1232,6 +1233,14 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
1232
1233
  onError(err);
1233
1234
  }
1234
1235
  };
1236
+ const drainDirtyEvents = async (session) => {
1237
+ while (session.getDirtyEvents().length > 0) {
1238
+ await syncDirtyEventsOnce(session);
1239
+ }
1240
+ };
1241
+ const enqueueSync = (session) => {
1242
+ syncChain = syncChain.then(() => drainDirtyEvents(session));
1243
+ };
1235
1244
  return {
1236
1245
  schedule(session) {
1237
1246
  latestSession = session;
@@ -1242,7 +1251,7 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
1242
1251
  clearTimeout(timer);
1243
1252
  timer = void 0;
1244
1253
  }
1245
- void syncDirtyEvents(session);
1254
+ enqueueSync(session);
1246
1255
  return;
1247
1256
  }
1248
1257
  if (timer) {
@@ -1250,7 +1259,7 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
1250
1259
  }
1251
1260
  timer = setTimeout(() => {
1252
1261
  timer = void 0;
1253
- void syncDirtyEvents(latestSession);
1262
+ enqueueSync(latestSession);
1254
1263
  }, CURSOR_MESSAGE_LOG_SYNC_INTERVAL_MS - elapsed);
1255
1264
  },
1256
1265
  async flush(session) {
@@ -1259,7 +1268,8 @@ function createThrottledCursorMessageLogSync(cfg, ctx, onError) {
1259
1268
  clearTimeout(timer);
1260
1269
  timer = void 0;
1261
1270
  }
1262
- await syncDirtyEvents(session);
1271
+ await syncChain;
1272
+ await drainDirtyEvents(session);
1263
1273
  }
1264
1274
  };
1265
1275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "6.0.23",
3
+ "version": "6.0.24",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,