INNER CODE UNIT · Python
activate
bunkeriot/BunkerM · backend/app/agent-api/main.py:204
async def activate(body: ActivateRequest, x_api_key: str = Header(...)):
global _activated
_auth(x_api_key)
payload = _verify_key(body.key.strip(), _instance_id)
if not payload:
raise HTTPException(status_code=400, detail="Invalid or mismatched license key.")
_store_activation(body.key.strip())
_activated = True
logger.info(f"Instance {_instance_id} manually activated.")
return {"activated": True, "tier": payload.get("tier"), "max_agents": payload.get("max_agents")}
# ─── Watcher fire callback ────────────────────────────────────────────────────
async def _on_watcher_fire(watcher_id: str, rendered_message: str, _created_by: str):
with _lock:
data = _load_agents()
watcher_desc = ""