Appearance
sdk.alert_service
Typed-event/live-snapshot alert service. Native notification is optional; history and callbacks work identically in tests and headless environments.
lua
local M = require("sdk.alert_service")Constants
Lua 5.4 has no enums — these are integer (or string) fields on the module.
| Name | Value | Summary |
|---|---|---|
Service | Service | Alert service class. |
new
function · new(opts)
Construct an alert service from DEFAULTS plus a config overlay. Unknown keys are ignored so typos do not become live settings. Common: autostart unless tests pass autostart=false.
get
function · get(opts)
Return the process singleton, creating it on first call. Subsequent get() ignores new opts; reset_singleton() to rebuild. Common: one shared history so multiple UIs do not split alerts.
Get
alias · Get = get
Same as get.
Alias
Same as get.
start
function · start(...) return default_call("start", ...)
Start the shared alert singleton. First call constructs it via M.get(). Common: facade through default_call.
stop
function · stop(...) return default_call("stop", ...)
Stop the shared alert singleton without destroying it. reset_singleton() is the test-only teardown. Common: facade through default_call.
configure
function · configure(...) return default_call("configure", ...)
Patch the shared singleton config and friends. Same clamp rules as Service:configure. Common: facade through default_call.
watch
function · watch(...) return default_call("watch", ...)
Register a callback on the shared singleton. Returns the token Service:watch issued. Common: facade through default_call.
unwatch
function · unwatch(...) return default_call("unwatch", ...)
Drop a watch token on the shared singleton. Unknown tokens remain false. Common: facade through default_call.
handle
function · handle(...) return default_call("handle", ...)
Push one event through the shared singleton immediately. Live Engine.on still goes through the pending queue. Common: facade through default_call.
tick
function · tick(...) return default_call("tick", ...)
Pump the shared singleton queue, vitals, and detections. Tests call this without an Engine tick. Common: facade through default_call.
history
function · history(...) return default_call("history", ...)
Copied history rows from the shared singleton. Same isolation as Service:history. Common: facade through default_call.
snapshot
function · snapshot(...) return default_call("snapshot", ...)
Public snapshot of the shared alert singleton. Includes pending/dropped counters for queue health. Common: facade through default_call.