fix: tune detection patterns and add state transition logging
- Added "Resume" and "Continue" to approval keywords - Added state transition logging to daemon for observability - Guarded signal handler against duplicate SIGTERM delivery - Verified end-to-end: daemon detects approval prompt, transitions to waiting_for_user, overlays 1 window, plays sound Made-with: Cursor
This commit is contained in:
@@ -67,14 +67,20 @@ class FlasherDaemon:
|
||||
):
|
||||
elapsed = time.monotonic() - self._waiting_since
|
||||
if elapsed > self.config.auto_dismiss:
|
||||
logger.info("Auto-dismissing after timeout")
|
||||
self.state_machine.dismiss()
|
||||
self.overlay.hide()
|
||||
self._waiting_since = None
|
||||
return
|
||||
|
||||
logger.info("State → %s", self.state_machine.state.value)
|
||||
|
||||
match self.state_machine.state:
|
||||
case FlasherState.WAITING_FOR_USER:
|
||||
if result.active_windows:
|
||||
logger.info(
|
||||
"Showing overlay on %d window(s)", len(result.active_windows)
|
||||
)
|
||||
self.overlay.show(result.active_windows)
|
||||
play_alert(self.config)
|
||||
self._waiting_since = time.monotonic()
|
||||
@@ -83,7 +89,9 @@ class FlasherDaemon:
|
||||
self._waiting_since = None
|
||||
|
||||
def _handle_signal(self, signum, frame):
|
||||
logger.info(f"Received signal {signum}, shutting down")
|
||||
if not self._running:
|
||||
return
|
||||
logger.info("Received signal %d, shutting down", signum)
|
||||
self.stop()
|
||||
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ CURSOR_BUNDLE_ID = "com.todesktop.230313mzl4w4u92"
|
||||
AGENT_WORKING_EXACT = {"Stop", "Cancel generating"}
|
||||
AGENT_WORKING_PATTERNS = [re.compile(r"^Generating\b", re.IGNORECASE)]
|
||||
|
||||
APPROVAL_EXACT = {"Accept", "Reject", "Accept All", "Deny"}
|
||||
APPROVAL_EXACT = {"Accept", "Reject", "Accept All", "Deny", "Resume", "Continue"}
|
||||
APPROVAL_PATTERNS = [
|
||||
re.compile(r"^Run\b", re.IGNORECASE),
|
||||
re.compile(r"^Allow\b", re.IGNORECASE),
|
||||
|
||||
Reference in New Issue
Block a user