Skip to content

app

app

Bridge clearance-hub events to desktop popups.

Runs as terok-clearance-notifier.service — a systemd user unit paired with the hub's own. Splitting the roles means headless hosts (CI, servers) run the hub without pulling in a desktop stack, and notifier crashes never take the firewall or the hub with them.

Previously lived in the terok package; moved here because nothing in the notifier is orchestration-specific — any clearance-capable deployment (with or without terok) benefits from the desktop bridge, and the task-name enrichment is fed through the ai.terok.task_meta_path annotation data contract (see terok_clearance.client.identity_resolver).

run_notifier() async

Run the notifier until SIGINT/SIGTERM.

Source code in src/terok_clearance/notifier/app.py
async def run_notifier() -> None:
    """Run the notifier until SIGINT/SIGTERM."""
    configure_logging()
    notifier = await create_notifier("terok-clearance")
    inspector = _pick_inspector()
    subscriber = EventSubscriber(notifier, identity_resolver=IdentityResolver(inspector))
    try:
        await subscriber.start()
    except Exception:
        _log.exception("clearance subscriber failed to connect to hub — exiting")
        with contextlib.suppress(Exception):
            await notifier.disconnect()
        raise SystemExit(1) from None

    _log.info("terok-clearance-notifier online")
    try:
        await wait_for_shutdown_signal()
    finally:
        await _teardown(subscriber, notifier)

main()

Systemd-unit ExecStart target — launches run_notifier on an event loop.

Source code in src/terok_clearance/notifier/app.py
def main() -> None:  # pragma: no cover — CLI entry point
    """Systemd-unit ``ExecStart`` target — launches [`run_notifier`][terok_clearance.notifier.app.run_notifier] on an event loop."""
    asyncio.run(run_notifier())