papersearch 0.4.8 → 0.4.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.
@@ -1,4 +1,4 @@
1
- """The download progress capsule: a small always-on-top pill in a screen corner.
1
+ """The download progress capsule: a small always-on-top floating pill.
2
2
 
3
3
  Collapsed it shows how far the task is ("12/40 正文 · Wiley"). Hovering opens
4
4
  a card with the paper, the counts and every action of the classic window
@@ -16,7 +16,6 @@ Spawned automatically by ``progress_reporter.ensure_progress_bar`` when a downlo
16
16
 
17
17
  from __future__ import annotations
18
18
 
19
- import json
20
19
  import os
21
20
  import subprocess
22
21
  import sys
@@ -26,6 +25,7 @@ from pathlib import Path
26
25
  from typing import Any
27
26
 
28
27
  from . import download_directory, progress_view, user_settings
28
+ from .capsule_placement import Placement, Rect, ScreenArea
29
29
  from .progress_reporter import progress_path, read_state
30
30
 
31
31
  ASSETS = Path(__file__).with_name("assets")
@@ -35,56 +35,12 @@ ICON, TASKBAR_ICON = ASSETS / "icon-512.png", ASSETS / "icon-64.png"
35
35
  # The first, collapsed frame; the page then reports the size it needs.
36
36
  START_SIZE = (260, 56)
37
37
  MIN_SIZE = (60, 30)
38
- EDGE = 20 # distance from the screen's right edge
39
- # macOS: top-right under the menu bar (the Dock owns the bottom edge).
40
- # Windows/Linux: bottom-right above the taskbar, clear of the browser's window buttons.
41
- TOP_GAP, BOTTOM_GAP = 44, 56
42
38
 
43
39
 
44
40
  def _corner() -> str:
45
41
  return "top" if sys.platform == "darwin" else "bottom"
46
42
 
47
43
 
48
- class Placement:
49
- """Where the capsule sits: its right edge and its top (macOS) or bottom
50
- edge stay put while it grows and shrinks; dragging it moves them, and the
51
- spot is remembered for the next window."""
52
-
53
- def __init__(self, path: Path, corner: str) -> None:
54
- self.path = path
55
- self.corner = corner
56
- self.right: float | None = None
57
- self.edge: float | None = None
58
- try:
59
- data = json.loads(path.read_text(encoding="utf-8"))
60
- if data.get("corner") == corner:
61
- self.right, self.edge = float(data["right"]), float(data["edge"])
62
- except Exception:
63
- pass
64
-
65
- def start(self, screen_w: float, screen_h: float, size: tuple[int, int]) -> tuple[int, int]:
66
- """Top-left corner for the first frame; the default spot when none is
67
- remembered or the remembered one is off this screen."""
68
- w, h = size
69
- right, edge = self.right, self.edge
70
- if right is None or edge is None or not (w <= right <= screen_w + 1) or not (0 <= edge <= screen_h + 1):
71
- right = screen_w - EDGE
72
- edge = TOP_GAP if self.corner == "top" else screen_h - BOTTOM_GAP
73
- self.right, self.edge = right, edge
74
- return int(right - w), int(edge if self.corner == "top" else edge - h)
75
-
76
- def moved(self, x: float, y: float, w: float, h: float, *, persist: bool = True) -> None:
77
- self.right = x + w
78
- self.edge = y if self.corner == "top" else y + h
79
- if not persist:
80
- return
81
- try:
82
- self.path.write_text(json.dumps({"corner": self.corner, "right": self.right, "edge": self.edge}),
83
- encoding="utf-8")
84
- except Exception:
85
- pass
86
-
87
-
88
44
  def notify(title: str, body: str, state: dict[str, Any] | None = None) -> None:
89
45
  """One system notification, bound to the current task on macOS."""
90
46
  if not user_settings.notify_enabled():
@@ -159,12 +115,13 @@ class Api:
159
115
  self._placement = placement
160
116
  self._notifier = notifier
161
117
  self._auto_close = auto_close
162
- self._size = START_SIZE
163
118
  self._geometry_lock = threading.RLock()
164
119
  self._dragging = False
165
120
  self._native_geometry = False
166
121
  self._drag_origin: tuple[float, float, float, float] | None = None
122
+ self._drag_pointer: tuple[float, float] | None = None
167
123
  self._hovering = False
124
+ self._layout: tuple[int, bool, Rect, Rect] | None = None
168
125
  self._closed = False
169
126
  self._close_requested: float | None = None
170
127
 
@@ -316,17 +273,44 @@ class Api:
316
273
  return str(selected[0]) if selected else None
317
274
 
318
275
  # --- the window -------------------------------------------------------
319
- def set_dragging(self, active: bool, screen_x: float = 0, screen_y: float = 0) -> None:
320
- """Freeze resizing while held, then remember the actual drop position."""
276
+ def _drag_point(self, x: float, y: float) -> tuple[float, float]:
277
+ if sys.platform == "darwin" and self._native_geometry:
278
+ return _mac_pointer()
279
+ if sys.platform == "win32":
280
+ return _windows_pointer()
281
+ return x, y
282
+
283
+ def set_dragging(self, active: bool, screen_x: float | None = None,
284
+ screen_y: float | None = None) -> None:
285
+ """Freeze resizing while held, then place the window on its drop screen."""
321
286
  with self._geometry_lock:
322
- self._dragging = bool(active)
323
- if self._dragging:
324
- self._hovering = True
287
+ if active:
325
288
  x, y, _, _ = _window_geometry(self._window, self._native_geometry)
326
- self._drag_origin = (screen_x, screen_y, x, y)
327
- elif self._window is not None:
289
+ scale = _window_scale(self._window)
290
+ point = self._drag_point(screen_x or 0, screen_y or 0)
291
+ self._drag_origin = (*point, x * scale, y * scale)
292
+ self._drag_pointer = point
293
+ self._dragging = self._hovering = True
294
+ self._placement.rescale(scale)
295
+ self._layout = None
296
+ elif self._dragging:
297
+ try:
298
+ if screen_x is not None and screen_y is not None:
299
+ self.move_drag(screen_x, screen_y)
300
+ finally:
301
+ self._dragging = False
302
+ origin, point = self._drag_origin, self._drag_pointer
328
303
  self._drag_origin = None
329
- self._placement.moved(*_window_geometry(self._window, self._native_geometry))
304
+ self._drag_pointer = None
305
+ if self._window is None or origin is None or point is None or point == origin[:2]:
306
+ return
307
+ actual = Rect(*_window_geometry(self._window, self._native_geometry))
308
+ scale = _window_scale(self._window)
309
+ self._placement.rescale(scale)
310
+ target = self._placement.dragged(actual, _screen_areas(self._window),
311
+ (point[0] / scale, point[1] / scale))
312
+ if target != actual:
313
+ _set_window_frame(self._window, target)
330
314
 
331
315
  def move_drag(self, screen_x: float, screen_y: float) -> None:
332
316
  """Use pointer deltas, independent of the web engine's screen origin."""
@@ -334,6 +318,12 @@ class Api:
334
318
  if not self._dragging or self._drag_origin is None:
335
319
  return
336
320
  sx, sy, x, y = self._drag_origin
321
+ # WebView coordinates can rebase across monitors. Native pointer
322
+ # deltas stay global; on Windows they are physical until the move.
323
+ screen_x, screen_y = self._drag_point(screen_x, screen_y)
324
+ if self._drag_pointer == (screen_x, screen_y):
325
+ return
326
+ self._drag_pointer = (screen_x, screen_y)
337
327
  x, y = round(x + screen_x - sx), round(y + screen_y - sy)
338
328
  if sys.platform == "darwin" and self._native_geometry:
339
329
  import AppKit
@@ -343,27 +333,58 @@ class Api:
343
333
  self._window.native.setFrameTopLeftPoint_(AppKit.NSPoint(x, top - y))
344
334
  _cocoa_call(move)
345
335
  else:
346
- self._window.move(x, y)
336
+ scale = _window_scale(self._window)
337
+ self._window.move(round(x / scale), round(y / scale))
347
338
 
348
- def resize(self, width: float, height: float) -> None:
349
- """The page's new size; the capsule's anchored corner stays put."""
350
- size = (max(MIN_SIZE[0], int(width)), max(MIN_SIZE[1], int(height)))
351
- with self._geometry_lock:
352
- if self._dragging or size == self._size or self._window is None:
353
- return
354
- try:
355
- from webview.window import FixPoint
339
+ def hover_state(self) -> dict[str, Any]:
340
+ """Read the real pointer/frame together; native enter/exit events may be stale."""
341
+ import AppKit
356
342
 
357
- vertical = FixPoint.NORTH if self._placement.corner == "top" else FixPoint.SOUTH
358
- self._window.resize(size[0], size[1], fix_point=vertical | FixPoint.EAST)
359
- self._size = size
360
- except Exception:
361
- pass
343
+ def read():
344
+ point = AppKit.NSEvent.mouseLocation()
345
+ frame = self._window.native.frame()
346
+ return {"x": point.x, "y": point.y,
347
+ "inside": frame.origin.x + 10 <= point.x < frame.origin.x + frame.size.width - 10
348
+ and frame.origin.y + 10 <= point.y < frame.origin.y + frame.size.height - 10}
349
+ return _cocoa_call(read)
362
350
 
363
- def moved(self, x: float, y: float) -> None:
364
- if self._native_geometry:
365
- x, y, _, _ = _window_geometry(self._window, self._native_geometry)
366
- self._placement.moved(x, y, *self._size, persist=not self._dragging)
351
+ def begin_layout(self, expanded: bool, width: float, height: float, generation: int) -> dict[str, Any]:
352
+ """Choose a corner once per expansion and plan one atomic frame animation."""
353
+ with self._geometry_lock:
354
+ if self._dragging or self._window is None:
355
+ return {}
356
+ actual = Rect(*_window_geometry(self._window, self._native_geometry))
357
+ self._placement.rescale(_window_scale(self._window))
358
+ self._placement.begin(expanded, actual, _screen_areas(self._window))
359
+ target = self._placement.target(max(MIN_SIZE[0], int(width)), max(MIN_SIZE[1], int(height)), expanded)
360
+ self._layout = (generation, expanded, actual, target)
361
+ vertical, horizontal = self._placement.direction
362
+ return {"vertical": vertical, "horizontal": horizontal,
363
+ "width": target.width, "height": target.height,
364
+ "from_width": actual.width, "from_height": actual.height}
365
+
366
+ def resize(self, width: float, height: float, fraction: float = 1, generation: int = 0) -> None:
367
+ """Position and size change together; obsolete animation frames are ignored."""
368
+ with self._geometry_lock:
369
+ if self._dragging or self._window is None or self._layout is None:
370
+ return
371
+ current, _, start, target = self._layout
372
+ if generation != current:
373
+ return
374
+ t = max(0, min(1, fraction))
375
+ frame = Rect(round(start.x + (target.x - start.x) * t),
376
+ round(start.y + (target.y - start.y) * t),
377
+ round(start.width + (target.width - start.width) * t),
378
+ round(start.height + (target.height - start.height) * t))
379
+ _set_window_frame(self._window, frame)
380
+
381
+ def finish_layout(self, generation: int) -> None:
382
+ with self._geometry_lock:
383
+ if self._layout is None or self._layout[0] != generation or self._dragging:
384
+ return
385
+ _, expanded, _, target = self._layout
386
+ self._placement.finish(expanded, target)
387
+ self._layout = None
367
388
 
368
389
  def request_close(self) -> None:
369
390
  # Let the JS bridge deliver this call's reply before disposing WebView2.
@@ -398,7 +419,7 @@ def _enable_inactive_hover(window: Any) -> None:
398
419
  # evaluate_js waits for WebKit: never block Cocoa's event thread.
399
420
  def send():
400
421
  try:
401
- window.evaluate_js("setHover(" + ("true" if inside else "false") + ")")
422
+ window.evaluate_js("observeHover()")
402
423
  except Exception:
403
424
  pass # The window can close while a tracking event is queued.
404
425
  threading.Thread(target=send, daemon=True).start()
@@ -451,27 +472,129 @@ def _window_geometry(window: Any, native: bool = False) -> tuple[float, float, f
451
472
  top = AppKit.NSScreen.screens()[0].frame().size.height
452
473
  return frame.origin.x, top - frame.origin.y - frame.size.height, frame.size.width, frame.size.height
453
474
  return _cocoa_call(read)
475
+ if sys.platform == "win32":
476
+ n = window.native
477
+ scale = _window_scale(window)
478
+ return n.Location.X / scale, n.Location.Y / scale, n.Width / scale, n.Height / scale
454
479
  return window.x, window.y, window.width, window.height
455
480
 
456
481
 
457
- def _serialize_native_resize(window: Any) -> None:
458
- """Await actual Cocoa frame changes so queued resizes cannot race a grab."""
459
- if sys.platform != "darwin":
460
- return
461
- from webview.window import FixPoint
482
+ def _mac_pointer() -> tuple[float, float]:
483
+ import AppKit
484
+
485
+ def read():
486
+ point = AppKit.NSEvent.mouseLocation()
487
+ top = AppKit.NSScreen.screens()[0].frame().size.height
488
+ return point.x, top - point.y
489
+ return _cocoa_call(read)
490
+
491
+
492
+ def _windows_pointer() -> tuple[float, float]:
493
+ import ctypes
494
+ from ctypes import wintypes
495
+
496
+ point = wintypes.POINT()
497
+ if not ctypes.windll.user32.GetCursorPos(ctypes.byref(point)):
498
+ raise OSError("Cannot read capsule pointer position")
499
+ return point.x, point.y
500
+
501
+
502
+ def _window_scale(window: Any = None) -> float:
503
+ if sys.platform != "win32":
504
+ return 1.0
505
+ if window is not None:
506
+ return float(window.native._scale)
507
+ import ctypes
508
+
509
+ return ctypes.windll.user32.GetDpiForSystem() / 96
510
+
511
+
512
+ def _screen_areas(window: Any = None) -> list[ScreenArea]:
513
+ """Use native work areas in the same logical coordinate space as the window."""
514
+ if sys.platform == "darwin":
515
+ import AppKit
516
+
517
+ def read():
518
+ screens = AppKit.NSScreen.screens()
519
+ top = screens[0].frame().origin.y + screens[0].frame().size.height
520
+
521
+ def rect(frame):
522
+ return Rect(frame.origin.x, top - frame.origin.y - frame.size.height,
523
+ frame.size.width, frame.size.height)
524
+
525
+ return [ScreenArea(str(s.deviceDescription()["NSScreenNumber"]),
526
+ rect(s.frame()), rect(s.visibleFrame())) for s in screens]
527
+ return _cocoa_call(read) if window is not None else read()
528
+ if sys.platform == "win32":
529
+ return _windows_screen_areas(window)
530
+ import webview
531
+
532
+ return [ScreenArea(str(i), Rect(s.x, s.y, s.width, s.height), Rect(s.x, s.y, s.width, s.height))
533
+ for i, s in enumerate(webview.screens)]
534
+
535
+
536
+ def _windows_screen_areas(window: Any = None) -> list[ScreenArea]:
537
+ import ctypes
538
+ from ctypes import wintypes
539
+
540
+ class MonitorInfo(ctypes.Structure):
541
+ _fields_ = [("cbSize", wintypes.DWORD), ("rcMonitor", wintypes.RECT),
542
+ ("rcWork", wintypes.RECT), ("dwFlags", wintypes.DWORD),
543
+ ("szDevice", wintypes.WCHAR * 32)]
544
+
545
+ user = ctypes.windll.user32
546
+ user.GetMonitorInfoW.argtypes = [wintypes.HANDLE, ctypes.POINTER(MonitorInfo)]
547
+ user.GetMonitorInfoW.restype = wintypes.BOOL
548
+ user.MonitorFromWindow.argtypes = [wintypes.HWND, wintypes.DWORD]
549
+ user.MonitorFromWindow.restype = wintypes.HANDLE
550
+ scale = _window_scale(window)
551
+ if scale <= 0:
552
+ raise RuntimeError("Invalid capsule monitor DPI")
553
+ current = user.MonitorFromWindow(window.native.Handle.ToInt64(), 2) if window is not None else None
554
+ areas = []
555
+ failures = []
556
+
557
+ def collect(handle, _dc, _rect, _data):
558
+ info = MonitorInfo()
559
+ info.cbSize = ctypes.sizeof(info)
560
+ if not user.GetMonitorInfoW(handle, ctypes.byref(info)):
561
+ failures.append(handle)
562
+ return False
563
+
564
+ def rect(r):
565
+ return Rect(r.left / scale, r.top / scale, (r.right - r.left) / scale,
566
+ (r.bottom - r.top) / scale)
567
+
568
+ areas.append((handle == current if current is not None else bool(info.dwFlags & 1),
569
+ ScreenArea(info.szDevice, rect(info.rcMonitor), rect(info.rcWork))))
570
+ return True
571
+
572
+ callback_type = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HANDLE, wintypes.HDC,
573
+ ctypes.POINTER(wintypes.RECT), wintypes.LPARAM)
574
+ user.EnumDisplayMonitors.argtypes = [wintypes.HDC, ctypes.POINTER(wintypes.RECT), callback_type, wintypes.LPARAM]
575
+ user.EnumDisplayMonitors.restype = wintypes.BOOL
576
+ if not user.EnumDisplayMonitors(None, None, callback_type(collect), 0) or failures or not areas:
577
+ raise OSError("Cannot read capsule monitor work areas")
578
+ return [s for _, s in sorted(areas, key=lambda item: not item[0])]
579
+
580
+
581
+ def _set_window_frame(window: Any, frame: Rect) -> None:
582
+ """Move and resize in one native operation, without activating the window."""
583
+ if sys.platform == "darwin":
584
+ import AppKit
462
585
 
463
- def resize(width, height, fix_point=None):
464
586
  def apply():
465
- frame = window.native.frame()
466
- if fix_point and fix_point & FixPoint.EAST:
467
- frame.origin.x += frame.size.width - width
468
- if fix_point and fix_point & FixPoint.NORTH:
469
- frame.origin.y += frame.size.height - height
470
- frame.size.width, frame.size.height = width, height
471
- window.native.setFrame_display_(frame, True)
587
+ top = AppKit.NSScreen.screens()[0].frame().size.height
588
+ window.native.setFrame_display_(AppKit.NSMakeRect(
589
+ frame.x, top - frame.y - frame.height, frame.width, frame.height), True)
472
590
  _cocoa_call(apply)
591
+ elif sys.platform == "win32":
592
+ window._capsule_set_frame(frame)
593
+ else:
594
+ from webview.window import FixPoint
473
595
 
474
- window.resize = resize
596
+ window.resize(frame.width, frame.height, fix_point=FixPoint.NORTH | FixPoint.WEST)
597
+ window.move(frame.x, frame.y)
475
598
 
476
599
 
477
600
  def _windows_taskbar_icon(window: Any) -> None:
@@ -578,6 +701,15 @@ def _prepare_nonactivating_start(window: Any) -> None:
578
701
  0, 0, 0x0055) # NOSIZE | NOZORDER | NOACTIVATE | SHOWWINDOW
579
702
 
580
703
  native.resize, native.move = resize, move
704
+
705
+ def set_frame(frame):
706
+ scale = native._scale
707
+ # NOZORDER | NOACTIVATE; preserve hidden/minimized state as well.
708
+ if not user32.SetWindowPos(hwnd, None, round(frame.x * scale), round(frame.y * scale),
709
+ round(frame.width * scale), round(frame.height * scale), 0x0014):
710
+ raise OSError("Cannot update capsule window frame")
711
+
712
+ window._capsule_set_frame = set_frame
581
713
  # pywebview's Shown handler calls WebView2.Focus() after raising
582
714
  # events.shown. That explicit focus defeats the initial native
583
715
  # style, even if we restore the style later. Suppress just this
@@ -612,13 +744,14 @@ def main() -> None:
612
744
  return
613
745
  try:
614
746
  page = PAGE.read_text(encoding="utf-8")
615
- screen = webview.screens[0]
747
+ screens = _screen_areas()
616
748
  placement = Placement(progress_path().parent / "capsule.json", _corner())
617
- x, y = placement.start(screen.width, screen.height, START_SIZE)
749
+ x, y = placement.start(screens, START_SIZE, _window_scale())
750
+ size = (round(placement.home.width), round(placement.home.height))
618
751
  api = Api(placement, Notifier(), progress_view.AutoClose.from_env())
619
752
  dark = progress_view.dark_mode()
620
753
  window = webview.create_window(
621
- "PaperSearch", html=page, js_api=api, width=START_SIZE[0], height=START_SIZE[1], x=x, y=y,
754
+ "PaperSearch", html=page, js_api=api, width=size[0], height=size[1], x=x, y=y,
622
755
  min_size=MIN_SIZE, resizable=False, frameless=True, easy_drag=False, on_top=True, focus=True,
623
756
  transparent=sys.platform == "darwin", shadow=True,
624
757
  background_color="#202124" if dark else "#FFFFFF",
@@ -634,11 +767,18 @@ def main() -> None:
634
767
 
635
768
  logging.getLogger(__name__).warning("notification host unavailable: %s", type(exc).__name__)
636
769
  api._native_geometry = sys.platform == "darwin"
637
- _serialize_native_resize(window)
638
770
  _prepare_nonactivating_start(window)
639
- window.events.moved += api.moved
771
+ # Do not persist native moved events: animated resizing emits them too.
772
+ # Only the user's completed drag updates the collapsed home.
640
773
  window.events.loaded += lambda: _enable_inactive_hover(window)
641
774
  if os.name == "nt":
775
+ def restore_after_dpi_setup():
776
+ # pywebview enables DPI awareness while creating the native form.
777
+ # Re-read work areas before showing it, in that form's actual scale.
778
+ placement.start(_screen_areas(window), START_SIZE, _window_scale(window))
779
+ _set_window_frame(window, placement.home)
780
+
781
+ window.events.before_show += restore_after_dpi_setup
642
782
  window.events.shown += lambda: (_round_windows_corners(window), _windows_taskbar_icon(window))
643
783
  progress_view.write_window_lock()
644
784
  # icon: the Dock icon on macOS, instead of a blank one; watch: notifications and closing.
@@ -22,7 +22,7 @@ class Field:
22
22
  FIELDS = (
23
23
  Field("login", "学校登录页最多等", "browser_login_timeout", 180, 30, 1800, "秒"),
24
24
  Field("page", "其他页面最多等", "browser_page_wait_timeout", 60, 10, 600, "秒"),
25
- Field("stalled", "页面持续无进展", "browser_stall_notify_after", 30, 1, 600, "秒"),
25
+ Field("stalled", "验证提醒前最多等", "browser_stall_notify_after", 30, 1, 600, "秒"),
26
26
  Field("hourly", "每家出版社每小时最多", "publisher_hourly_limit", 100, 0, 1000, "篇"),
27
27
  )
28
28
 
@@ -17,7 +17,7 @@ export const CARSI_DOWNLOAD_TIMEOUT_MS = 1_200_000;
17
17
  export const CARSI_CLEANUP_TIMEOUT_MS = 5_000;
18
18
  const CARSI_BACKEND_SOURCE = "carsi";
19
19
  // MCP clientInfo is informational only; keep in step with package.json on release.
20
- const PAPER_SEARCH_MCP_CLIENT_VERSION = "0.4.8";
20
+ const PAPER_SEARCH_MCP_CLIENT_VERSION = "0.4.9";
21
21
  const NO_BATCH_SUPPORT = {
22
22
  downloadFields: false,
23
23
  supplementsField: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "papersearch",
3
- "version": "0.4.8",
3
+ "version": "0.4.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",
@@ -21,7 +21,7 @@
21
21
  - 出版社网站拦截了当前网络(`access_blocked`,如 Cloudflare 拦截页)时这一篇结束;同一期刊 30 分钟内的其他文章直接跳过(`journal_blocked_earlier`),其他期刊照常继续。告诉用户可能是当前网络被网站防护拦截,也可能是下载过多被暂停:可换网络或稍后再试,后者请联系学校图书馆。
22
22
  - 后端会先短暂等待自动验证,每次验证等待对可识别的 Turnstile 复选框最多尝试点击 3 次,两次至少间隔 3 秒;程序提示人工处理时,再提醒用户到下载浏览器接管,不因 `checking_access` 就要求用户操作。学校登录、二次验证和复杂验证码由用户完成;不索取账号、密码或验证码,agent 不另开浏览器代操作。
23
23
  - 在专用人工登录页输入、选择或点击控件,或点击胶囊接管登录后,暂停剩余学校登录预算;输入间停顿不算离开,离开该人工步骤后恢复计时。无人操作仍按原限时结束。不要询问账号密码、监听系统输入或将用户暂时未输入视为离开。
24
- - 学校账号登录仍立即提醒;验证、机构跳转等其他页面连续无实际进展达到设定时间后,才提示人工查看。胶囊齿轮的“页面持续无进展”默认 30 秒,可保存为 1–600 秒;后端配置为 `browser_stall_notify_after`。页面跳转、流程推进和接收文件字节会重新计时;重复日志和倒计时不算进展。主页面导航请求尚未结束时,在原页面等待上限内暂不提醒;广告、子框架和后台轮询不能延后提醒。设置只改变提醒时间,不延长页面等待上限。不要仅因可见 reCAPTCHA、已勾选或存在继续按钮就要求用户操作;自动放行不提醒,持续卡住才查看当前页面。点击胶囊提醒可切到当前下载标签页。
24
+ - 自 0.4.9 起,学校登录提醒依赖当前可见的账号、密码、二次验证码、二维码或同意步骤;学校域名和空闲时间不作为人工操作证据。胶囊“验证提醒前最多等”仍保存到 `browser_stall_notify_after`(默认 30 秒,1–600);可见验证控件无法自动操作时,按该值与剩余预算一半的较早者交接。控件仍在加载、已勾选处理中或尚未出现时继续自动观察。未派发点击不消耗最多 3 次输入额度;失败原因见 `challenge_observation`。明确网站封禁和预算耗尽仍结束当前路径,不保证所有验证码自动通过。
25
25
  - 通用 Human Verification 图片验证页会等待 Begin 之后的后续步骤。用户在专用验证页操作或通过胶囊接管后,人工阶段暂停剩余验证及文章等待预算;成功离开验证后继续自动流程。未操作时仍按原时限结束,外层任务资源限制不变。
26
26
  - 阶段以本次调用的结构化通知为准(命令写在 stderr,stdout 只有最终 JSON);不凭等待时间猜阶段。
27
27
  - PDF 在新标签页打开不等于已保存;以命令的最终结果为准,网页地址不是本地文件。