@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.
@@ -889,6 +889,7 @@ var route_server_default = defineRoute({
889
889
  const homeDir = context.homeDirectory ?? os.homedir();
890
890
  const gitAuth = createGitAuthStore(homeDir);
891
891
  const branchDiff = createBranchDiff();
892
+ const pendingReviews = /* @__PURE__ */ new Map();
892
893
  /**
893
894
  * A workspace's remote auth. Workspace mounts only, so the step-up gate on
894
895
  * `PUT /api/workspaces/<id>/plugins/git/auth` is the one way to write it.
@@ -917,7 +918,7 @@ var route_server_default = defineRoute({
917
918
  /**
918
919
  * The session's change against its base. Session mounts only, rooted at the
919
920
  * session's own checkout; a file is served only when it is in the change set
920
- * computed for the same request.
921
+ * computed for the request. Overlapping requests share an in-flight snapshot.
921
922
  */
922
923
  const review = async (request, url) => {
923
924
  if (url.pathname !== "/review" && url.pathname !== "/review/file") return void 0;
@@ -930,7 +931,13 @@ var route_server_default = defineRoute({
930
931
  } catch {
931
932
  recordedBaseRef = void 0;
932
933
  }
933
- const result = await branchDiff.review(cwd, recordedBaseRef === void 0 ? {} : { recordedBaseRef });
934
+ const key = JSON.stringify([cwd, recordedBaseRef ?? null]);
935
+ let pending = pendingReviews.get(key);
936
+ if (pending === void 0) {
937
+ pending = branchDiff.review(cwd, recordedBaseRef === void 0 ? {} : { recordedBaseRef }).finally(() => pendingReviews.delete(key));
938
+ pendingReviews.set(key, pending);
939
+ }
940
+ const result = await pending;
934
941
  if (url.pathname === "/review") return Response.json(result?.summary ?? {
935
942
  repository: false,
936
943
  files: []