自動化

Webhook

觸發有限範圍 Hermes 工作的外部事件。

Webhook

這是什麼

觸發有限範圍 Hermes 工作的外部事件。

白話解釋

想像一棟公寓大樓,每個商家都有自己的專屬郵件投遞口,而不是共用一個前台。Webhook 就是那個投遞口:一個外部服務——GitHub、表單工具、監控警報——在事情發生的當下就投入一封簽名封緘的通知,而 Hermes 的前台會在郵件送達信箱並觸發工作之前檢查遞送員的證件。

為什麼重要

外部事件落在 Hermes 的 API 表面上,這正是觸發事件驅動工作的方式——一個 webhook——而且它刻意被限定範圍,緊密地設定了範圍,以便一個意外或格式錯誤的 payload 不會連鎖導致不相關的 agent 行為。這種邊界性是一個經過深思熟慮的設計選擇,而非事後補救:由 webhook 觸發的工作旨在執行一件特定的事情,而不是開啟一個無限制的對話。Webhook 在儀表板 API 上與 cron 和訊息功能一起顯示為自己的路由群組。

How it works

Each route is defined either statically in config.yaml, or dynamically in ~/.hermes/webhook_subscriptions.json — created through the CLI, the dashboard, or the agent itself — with its own event-type filter, a required HMAC secret, an optional prompt template, and a delivery target (gateway/platforms/webhook.py). An incoming POST to /webhooks/{route_name} is checked against a content-length cap, then its signature is validated against the raw body — GitHub’s X-Hub-Signature-256, GitLab’s token header, or a generic HMAC — before the JSON is even parsed. A delivery-ID header lets Hermes recognize and skip duplicate retries for up to an hour. Once the event type matches the route’s filter, the payload and matched event type are assembled into a job prompt and dispatched through the same scheduler that runs cron jobs, which means webhook-triggered work respects the same iteration budgets, model selection, and timeout policies as any other automated task.