forked from Rockachopa/Timmy-time-dashboard
feat: code quality audit + autoresearch integration + infra hardening (#150)
This commit is contained in:
committed by
GitHub
parent
fd0ede0d51
commit
ae3bb1cc21
@@ -9,8 +9,8 @@ No cloud push services — everything stays local.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import subprocess
|
||||
import platform
|
||||
import subprocess
|
||||
from collections import deque
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
@@ -25,9 +25,7 @@ class Notification:
|
||||
title: str
|
||||
message: str
|
||||
category: str # swarm | task | agent | system | payment
|
||||
timestamp: str = field(
|
||||
default_factory=lambda: datetime.now(timezone.utc).isoformat()
|
||||
)
|
||||
timestamp: str = field(default_factory=lambda: datetime.now(timezone.utc).isoformat())
|
||||
read: bool = False
|
||||
|
||||
|
||||
@@ -74,9 +72,11 @@ class PushNotifier:
|
||||
def _native_notify(self, title: str, message: str) -> None:
|
||||
"""Send a native macOS notification via osascript."""
|
||||
try:
|
||||
safe_message = message.replace("\\", "\\\\").replace('"', '\\"')
|
||||
safe_title = title.replace("\\", "\\\\").replace('"', '\\"')
|
||||
script = (
|
||||
f'display notification "{message}" '
|
||||
f'with title "Agent Dashboard" subtitle "{title}"'
|
||||
f'display notification "{safe_message}" '
|
||||
f'with title "Agent Dashboard" subtitle "{safe_title}"'
|
||||
)
|
||||
subprocess.Popen(
|
||||
["osascript", "-e", script],
|
||||
@@ -114,7 +114,7 @@ class PushNotifier:
|
||||
def clear(self) -> None:
|
||||
self._notifications.clear()
|
||||
|
||||
def add_listener(self, callback) -> None:
|
||||
def add_listener(self, callback: "Callable[[Notification], None]") -> None:
|
||||
"""Register a callback for real-time notification delivery."""
|
||||
self._listeners.append(callback)
|
||||
|
||||
@@ -139,10 +139,7 @@ async def notify_briefing_ready(briefing) -> None:
|
||||
logger.info("Briefing ready but no pending approvals — skipping native notification")
|
||||
return
|
||||
|
||||
message = (
|
||||
f"Your morning briefing is ready. "
|
||||
f"{n_approvals} item(s) await your approval."
|
||||
)
|
||||
message = f"Your morning briefing is ready. " f"{n_approvals} item(s) await your approval."
|
||||
notifier.notify(
|
||||
title="Morning Briefing Ready",
|
||||
message=message,
|
||||
|
||||
Reference in New Issue
Block a user