36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""
|
|
adapters/notify/openclaw.py
|
|
OpenClaw notification adapter — Phase 2 stub.
|
|
|
|
TODO (Phase 2):
|
|
- Implement send() to dispatch notifications via the OpenClaw API.
|
|
- Support context keys: channel, severity, run_id, brief_id.
|
|
- Read endpoint and credentials from environment (OPENCLAW_API_KEY, OPENCLAW_URL).
|
|
- Handle rate limiting and delivery retries.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from adapters.base.notify import NotifyAdapter
|
|
|
|
|
|
class OpenClawNotifyAdapter(NotifyAdapter):
|
|
"""
|
|
Notification adapter that sends messages via OpenClaw.
|
|
|
|
Expects environment variables:
|
|
OPENCLAW_API_KEY — authentication token
|
|
OPENCLAW_URL — base URL for the OpenClaw API (optional, defaults to hosted)
|
|
"""
|
|
|
|
def __init__(self, config: dict) -> None:
|
|
# TODO (Phase 2): Accept loaded team.yaml config dict.
|
|
# Extract OPENCLAW_API_KEY and OPENCLAW_URL from environment.
|
|
# Initialise an HTTP client (e.g. httpx or requests).
|
|
raise NotImplementedError("OpenClawNotifyAdapter.__init__ is not yet implemented.")
|
|
|
|
def send(self, message: str, context: dict) -> None:
|
|
# TODO (Phase 2): POST notification payload to OpenClaw API.
|
|
# Include message, context (channel, severity, run_id, brief_id).
|
|
# Log delivery confirmation or raise on failure.
|
|
raise NotImplementedError("OpenClawNotifyAdapter.send is not yet implemented.")
|