ProcessEvent
def ProcessEvent(
*args, **kwargs
):A recorded process start or stop event.
class ProcessEvent:
"A recorded process start or stop event."
session_id: str # Monitoring session containing the event
pid: int # Operating-system process identifier
app: str # Process or application name
event_type: str # Event type: `start` or `stop`
timestamp: str # ISO-formatted event timestamp
id: int | None = None # Database-generated primary keyclass Session:
"A single continuous monitoring session."
session_id: str # Unique session identifier
start_time: str # ISO-formatted session start time
end_time: str | None # ISO-formatted end time; `None` while open
status: str # Session state: `open` or `closed`
end_reason: str | None # Reason the session endedAn interval during which an application or idle state was in the foreground.
class ForegroundEvent:
"An interval during which an application or idle state was in the foreground."
session_id: str # Monitoring session containing the interval
app: str # Foreground application name
pid: int # Foreground process identifier
window_title: str # Foreground window title
start_time: str # ISO-formatted interval start time
end_time: str # ISO-formatted interval end time
hwnd: int # Windows window handle
is_idle: bool # Whether the interval represents user idle time
id: int | None = None # Database-generated primary keyOpen the database connection and create tables. Uses DATABASE_PATH if path is None.
Record a process start or stop event.
Return paired process start/stop intervals for a session.
Create and return a new open monitoring session.
Close a monitoring session and record why it ended.
Return the most recently completed session, or an empty dictionary.
Close sessions left open before startup and return their identifiers.
Return a session by ID, using the current time for an open session’s end.
def log_fg_app_events(
session_id:str, # Session receiving the interval
app:str, # Foreground application name
pid:int, # Foreground process identifier
window_title:str, # Foreground window title
start_time:str, # ISO-formatted interval start time
end_time:str, # ISO-formatted interval end time
hwnd:int, # Windows window handle
is_idle:bool, # Whether this was an idle interval
):Record a completed foreground-window or idle interval.
Return a session’s foreground intervals in chronological order.
Delete data belonging to closed sessions older than the retention period.