papersearch 0.6.8 → 0.6.9

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.
@@ -27,7 +27,7 @@ export const SCHOOL_CLEANUP_TIMEOUT_MS = 5_000;
27
27
  export const SCHOOL_BACKEND_UTF8_ENV = { PYTHONIOENCODING: "utf-8" };
28
28
  const SCHOOL_BACKEND_SOURCE = "school";
29
29
  // MCP clientInfo is informational only; keep in step with package.json on release.
30
- const PAPER_SEARCH_MCP_CLIENT_VERSION = "0.6.8";
30
+ const PAPER_SEARCH_MCP_CLIENT_VERSION = "0.6.9";
31
31
  const NO_BATCH_SUPPORT = {
32
32
  downloadFields: false,
33
33
  supplementsField: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "papersearch",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "PaperSearch: an agent-friendly command for searching and downloading academic papers from multiple sources.",
5
5
  "main": "dist/cli.js",
6
6
  "type": "module",
@@ -670,6 +670,8 @@ class Api:
670
670
 
671
671
 
672
672
  def main() -> None:
673
+ if not progress_view.claim_window():
674
+ return # another progress window is open: it shows this download too
673
675
  try:
674
676
  import webview
675
677
  except ImportError as exc:
@@ -448,6 +448,50 @@ def _lock_path():
448
448
  return progress_path().parent / "bar.pid"
449
449
 
450
450
 
451
+ _WINDOW_CLAIM: Any = None
452
+
453
+
454
+ def claim_window() -> bool:
455
+ """Hold the progress window's lock file for this process's life; False when another
456
+ window holds it. Two downloads asking for a window at the same moment each started
457
+ one (``bar.pid`` is written only once a window is up): three windows showed the same
458
+ batch (Windows, 2026-11-16). A window that cannot claim it closes at once."""
459
+ global _WINDOW_CLAIM
460
+ if _WINDOW_CLAIM is not None:
461
+ return True
462
+ try:
463
+ path = _lock_path().with_name("bar.lock")
464
+ path.parent.mkdir(parents=True, exist_ok=True)
465
+ handle = open(path, "a+b")
466
+ except OSError:
467
+ return True # no lock file to hold: as before, the pid file alone guards
468
+ try:
469
+ if os.name == "nt":
470
+ import msvcrt
471
+
472
+ handle.seek(0)
473
+ msvcrt.locking(handle.fileno(), msvcrt.LK_NBLCK, 1)
474
+ else:
475
+ import fcntl
476
+
477
+ fcntl.flock(handle.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
478
+ except OSError:
479
+ handle.close()
480
+ return False
481
+ _WINDOW_CLAIM = handle
482
+ return True
483
+
484
+
485
+ def release_window_claim() -> None:
486
+ global _WINDOW_CLAIM
487
+ if _WINDOW_CLAIM is not None:
488
+ try:
489
+ _WINDOW_CLAIM.close()
490
+ except OSError:
491
+ pass
492
+ _WINDOW_CLAIM = None
493
+
494
+
451
495
  def write_window_lock() -> None:
452
496
  """Mark this process as the open progress window (ensure_progress_bar reads it)."""
453
497
  try:
@@ -4,7 +4,7 @@ description: |
4
4
  用本机 paper-search 命令做文献工作:检索论文、核对 DOI/PMID、搜正文片段(找方法和结果的原文)、查期刊影响因子与分区、查施引和参考文献、下载全文和补充材料。
5
5
  用户要找文献、查期刊、下载论文,或说“请开始配置”时使用;英文请求(literature search、journal metrics、paper download、start setup)同样适用。
6
6
  metadata:
7
- version: "0.6.8"
7
+ version: "0.6.9"
8
8
  ---
9
9
 
10
10
  # 文献检索与下载(paper-search)