small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs webhooks.md
2.2 kB · 47 lines
Markdown
at main

Webhooks #

The webhooks extension accepts signed deliveries for a persistent session. Its extension registration connects the service, storage, transfer adapter, and Python binding. See also Discord, which delivers another kind of external event.

Setup #

webhook_intake.gleam constructs the intake path and, when a port is published, a loopback delivery URL. A hook has a secret, an enabled flag, a signature header, and a prefix. ledger.gleam defaults the header to x-albedo-signature and the prefix to sha256=. The terminal client and web client provide management pages.

Delivery #

accept checks the signature and rejects bodies over 64 KiB. The ledger stores an accepted delivery and posts it to the session's inbox in one transaction, from outside, posted once under the delivery's id, read after the running turn ends. The input contains a bounded preview. webhooks.delivery(id) reads the stored payload for the session. The service returns a delivery ID for an accepted request and reports invalid signatures as an error. Delivery can fail, including when the inbox is full.

A received payload is external data, not an instruction. The extension explicitly includes that boundary in its model instructions.

Management #

webhooks.py exposes list, delivery, create, rotate, configure, enable, disable, and delete. Management requires a human to enable agent management for the session. Reading a delivery does not require that permission. Changes to existing hooks take a revision. The RPC handler enforces the session and permission checks.