feat: bridge_self bot commands — status, thresholds, reset, health
Adds bot commands for the bridge_self provider so operators can inspect and manage bridge health from chat: /status, /thresholds, /reset, /health. Includes Jinja2 templates for both locales, seed data, capability slots, and a handler that exposes pending deferred backlog plus per-counter reset. Also adds .claude/skills/ for project-scoped graph-aware skills.
This commit is contained in:
@@ -542,8 +542,32 @@ BRIDGE_SELF_CAPABILITIES = ProviderCapabilities(
|
||||
{"name": "bridge_self_deferred_backlog", "description": "Deferred backlog high"},
|
||||
{"name": "bridge_self_target_failures", "description": "Target send failures"},
|
||||
],
|
||||
command_slots=[],
|
||||
commands=[],
|
||||
command_slots=[
|
||||
# Response templates
|
||||
{"name": "start", "description": "/start greeting message"},
|
||||
{"name": "help", "description": "/help command listing"},
|
||||
{"name": "status", "description": "/status full counter snapshot"},
|
||||
{"name": "thresholds", "description": "/thresholds configured alert thresholds"},
|
||||
{"name": "reset", "description": "/reset manual counter reset"},
|
||||
{"name": "health", "description": "/health terse one-line summary"},
|
||||
{"name": "rate_limited", "description": "Rate limit warning message"},
|
||||
{"name": "no_results", "description": "Empty results fallback"},
|
||||
# Description slots
|
||||
{"name": "desc_help", "description": "Menu description for /help"},
|
||||
{"name": "desc_status", "description": "Menu description for /status"},
|
||||
{"name": "desc_thresholds", "description": "Menu description for /thresholds"},
|
||||
{"name": "desc_reset", "description": "Menu description for /reset"},
|
||||
{"name": "desc_health", "description": "Menu description for /health"},
|
||||
# Usage examples
|
||||
{"name": "usage_reset", "description": "Usage example for /reset"},
|
||||
],
|
||||
commands=[
|
||||
{"name": "status", "description": "Show current bridge health counters"},
|
||||
{"name": "thresholds", "description": "Show configured alert thresholds"},
|
||||
{"name": "reset", "description": "Manually reset a failure counter"},
|
||||
{"name": "health", "description": "Terse one-line health summary"},
|
||||
{"name": "help", "description": "Show commands"},
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
Terse one-line health summary
|
||||
+1
@@ -0,0 +1 @@
|
||||
Show available commands
|
||||
+1
@@ -0,0 +1 @@
|
||||
Reset a failure counter (tracker:<id>, target:<id>, or all)
|
||||
+1
@@ -0,0 +1 @@
|
||||
Show current bridge health counters
|
||||
+1
@@ -0,0 +1 @@
|
||||
Show configured alert thresholds
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{%- if healthy -%}
|
||||
✅ {{ summary }}
|
||||
{%- else -%}
|
||||
🚨 {{ summary }}
|
||||
{%- endif %}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
🩺 <b>Available commands:</b>
|
||||
{%- for cmd in commands %}
|
||||
/{{ cmd.name }} — {{ cmd.description }}
|
||||
{%- if cmd.usage %} ↳ {{ cmd.usage }}{% endif %}
|
||||
{%- endfor %}
|
||||
+1
@@ -0,0 +1 @@
|
||||
No results.
|
||||
+1
@@ -0,0 +1 @@
|
||||
⏳ Too many requests. Please wait {{ wait }}s before trying again.
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{%- if success %}
|
||||
✅ <b>Counter reset</b>
|
||||
{%- if subject_type == 'all' %}
|
||||
Cleared {{ previous_count }} of your failure counters (trackers + targets).
|
||||
{%- else %}
|
||||
{{ subject_type|capitalize }} <b>{{ subject_name }}</b>{% if subject_id %} (id <code>{{ subject_id }}</code>){% endif %}
|
||||
Previous count: <b>{{ previous_count }}</b> → 0
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
❌ <b>Reset failed</b>
|
||||
{%- if error_message %}
|
||||
<i>{{ error_message }}</i>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
👋 Hi! I'm your Notify Bridge bot for <b>Bridge Self-Monitoring</b>.
|
||||
Use /help to see available commands.
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
🩺 <b>Bridge Status</b>
|
||||
{%- if poll_failures %}
|
||||
|
||||
🚨 <b>Tracker poll failures</b>
|
||||
{%- for f in poll_failures %}
|
||||
• <b>{{ f.tracker_name }}</b> (id <code>{{ f.tracker_id }}</code>) — {{ f.count }} consecutive
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- if deferred_pending is none %}
|
||||
|
||||
⏳ <b>Deferred backlog</b>
|
||||
Pending: <b>unknown</b> (DB unavailable) · Threshold: {{ deferred_threshold }}
|
||||
{%- elif deferred_pending %}
|
||||
|
||||
⏳ <b>Deferred backlog</b>
|
||||
Pending: <b>{{ deferred_pending }}</b> · Threshold: {{ deferred_threshold }}
|
||||
{%- endif %}
|
||||
{%- if target_failures %}
|
||||
|
||||
📡 <b>Target send failures</b>
|
||||
{%- for f in target_failures %}
|
||||
• <b>{{ f.target_name }}</b> (id <code>{{ f.target_id }}</code>) — {{ f.count }} consecutive
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- if not poll_failures and not target_failures and deferred_pending == 0 %}
|
||||
|
||||
✅ All counters at zero. Nothing to report.
|
||||
{%- endif %}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
⚙️ <b>Bridge Thresholds</b>
|
||||
Tracker poll failures: <b>{{ poll_failure_threshold }}</b>
|
||||
Deferred backlog: <b>{{ deferred_backlog_threshold }}</b>
|
||||
Target send failures: <b>{{ target_failure_threshold }}</b>
|
||||
+1
@@ -0,0 +1 @@
|
||||
/reset tracker:42 (or target:<id>, or all)
|
||||
@@ -73,6 +73,15 @@ PROVIDER_COMMAND_SLOTS: dict[str, list[str]] = {
|
||||
# Usage examples
|
||||
"usage_entities", "usage_state",
|
||||
],
|
||||
"bridge_self": [
|
||||
# Response templates
|
||||
"start", "help", "status", "thresholds", "reset", "health",
|
||||
"rate_limited", "no_results",
|
||||
# Description slots
|
||||
"desc_help", "desc_status", "desc_thresholds", "desc_reset", "desc_health",
|
||||
# Usage examples
|
||||
"usage_reset",
|
||||
],
|
||||
}
|
||||
|
||||
# Backward-compatible aliases
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
Краткая однострочная сводка состояния
|
||||
+1
@@ -0,0 +1 @@
|
||||
Показать доступные команды
|
||||
+1
@@ -0,0 +1 @@
|
||||
Сбросить счётчик сбоев (tracker:<id>, target:<id> или all)
|
||||
+1
@@ -0,0 +1 @@
|
||||
Показать счётчики состояния моста
|
||||
+1
@@ -0,0 +1 @@
|
||||
Показать настроенные пороги оповещений
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{%- if healthy -%}
|
||||
✅ {{ summary }}
|
||||
{%- else -%}
|
||||
🚨 {{ summary }}
|
||||
{%- endif %}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
🩺 <b>Доступные команды:</b>
|
||||
{%- for cmd in commands %}
|
||||
/{{ cmd.name }} — {{ cmd.description }}
|
||||
{%- if cmd.usage %} ↳ {{ cmd.usage }}{% endif %}
|
||||
{%- endfor %}
|
||||
+1
@@ -0,0 +1 @@
|
||||
Нет результатов.
|
||||
+1
@@ -0,0 +1 @@
|
||||
⏳ Слишком много запросов. Подождите {{ wait }}с и попробуйте снова.
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{%- if success %}
|
||||
✅ <b>Счётчик сброшен</b>
|
||||
{%- if subject_type == 'all' %}
|
||||
Очищено {{ previous_count }} ваших счётчиков (трекеры + цели).
|
||||
{%- else %}
|
||||
{{ subject_type|capitalize }} <b>{{ subject_name }}</b>{% if subject_id %} (id <code>{{ subject_id }}</code>){% endif %}
|
||||
Было: <b>{{ previous_count }}</b> → 0
|
||||
{%- endif %}
|
||||
{%- else %}
|
||||
❌ <b>Не удалось сбросить</b>
|
||||
{%- if error_message %}
|
||||
<i>{{ error_message }}</i>
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
👋 Привет! Я бот Notify Bridge для <b>Самомониторинга моста</b>.
|
||||
Используйте /help, чтобы посмотреть доступные команды.
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
🩺 <b>Состояние моста</b>
|
||||
{%- if poll_failures %}
|
||||
|
||||
🚨 <b>Сбои опроса трекеров</b>
|
||||
{%- for f in poll_failures %}
|
||||
• <b>{{ f.tracker_name }}</b> (id <code>{{ f.tracker_id }}</code>) — {{ f.count }} подряд
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- if deferred_pending is none %}
|
||||
|
||||
⏳ <b>Очередь отложенной отправки</b>
|
||||
В ожидании: <b>неизвестно</b> (БД недоступна) · Порог: {{ deferred_threshold }}
|
||||
{%- elif deferred_pending %}
|
||||
|
||||
⏳ <b>Очередь отложенной отправки</b>
|
||||
В ожидании: <b>{{ deferred_pending }}</b> · Порог: {{ deferred_threshold }}
|
||||
{%- endif %}
|
||||
{%- if target_failures %}
|
||||
|
||||
📡 <b>Сбои отправки в адресаты</b>
|
||||
{%- for f in target_failures %}
|
||||
• <b>{{ f.target_name }}</b> (id <code>{{ f.target_id }}</code>) — {{ f.count }} подряд
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
{%- if not poll_failures and not target_failures and deferred_pending == 0 %}
|
||||
|
||||
✅ Все счётчики в нуле. Всё хорошо.
|
||||
{%- endif %}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
⚙️ <b>Пороги моста</b>
|
||||
Сбои опроса трекеров: <b>{{ poll_failure_threshold }}</b>
|
||||
Очередь отложенной отправки: <b>{{ deferred_backlog_threshold }}</b>
|
||||
Сбои отправки в адресаты: <b>{{ target_failure_threshold }}</b>
|
||||
+1
@@ -0,0 +1 @@
|
||||
/reset tracker:42 (или target:<id>, или all)
|
||||
Reference in New Issue
Block a user