@agimon-ai/doompi-git 0.0.1-alpha.61 → 0.0.1-alpha.63

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.
@@ -896,6 +896,7 @@ var route_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)
896
896
  const homeDir = context.homeDirectory ?? node_os.default.homedir();
897
897
  const gitAuth = createGitAuthStore(homeDir);
898
898
  const branchDiff = createBranchDiff();
899
+ const pendingReviews = /* @__PURE__ */ new Map();
899
900
  /**
900
901
  * A workspace's remote auth. Workspace mounts only, so the step-up gate on
901
902
  * `PUT /api/workspaces/<id>/plugins/git/auth` is the one way to write it.
@@ -924,7 +925,7 @@ var route_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)
924
925
  /**
925
926
  * The session's change against its base. Session mounts only, rooted at the
926
927
  * session's own checkout; a file is served only when it is in the change set
927
- * computed for the same request.
928
+ * computed for the request. Overlapping requests share an in-flight snapshot.
928
929
  */
929
930
  const review = async (request, url) => {
930
931
  if (url.pathname !== "/review" && url.pathname !== "/review/file") return void 0;
@@ -937,7 +938,13 @@ var route_server_default = (0, _agimon_ai_doompi_core_extensionFile.defineRoute)
937
938
  } catch {
938
939
  recordedBaseRef = void 0;
939
940
  }
940
- const result = await branchDiff.review(cwd, recordedBaseRef === void 0 ? {} : { recordedBaseRef });
941
+ const key = JSON.stringify([cwd, recordedBaseRef ?? null]);
942
+ let pending = pendingReviews.get(key);
943
+ if (pending === void 0) {
944
+ pending = branchDiff.review(cwd, recordedBaseRef === void 0 ? {} : { recordedBaseRef }).finally(() => pendingReviews.delete(key));
945
+ pendingReviews.set(key, pending);
946
+ }
947
+ const result = await pending;
941
948
  if (url.pathname === "/review") return Response.json(result?.summary ?? {
942
949
  repository: false,
943
950
  files: []