Expand description
v0.6.0.0 — webhook subscriptions.
Subscribers register a URL + shared secret + event/namespace/agent
filters. When a matching event fires (e.g. memory_store), a
fire-and-forget thread POSTs an HMAC-SHA256-signed JSON payload.
SSRF hardening:
http://only to127.0.0.0/8orlocalhosthosts; everywhere else requireshttps://- RFC1918 / RFC4193 / link-local hosts are rejected unless
allow_private_networks = truein the daemon config
Signature:
- Header
X-Ai-Memory-Signature: sha256=<hex>over the raw JSON body - The secret stored in the DB is a SHA-256 of the plaintext shared secret; the plaintext is returned once at subscription time and never leaves the DB after.
Structs§
- Consolidated
Event Details memory_consolidatedevent — fires afterdb::consolidatecommits. The outermemory_idcarries the new consolidated memory’s id;source_idsis the array of memories that were merged (and deleted by the consolidate op).- Delete
Event Details memory_deleteevent — fires after the row is removed frommemories.titleandtiercome from the pre-delete snapshot so subscribers can write meaningful audit entries without a roundtrip.- Link
Created Event Details memory_link_createdevent — fires afterdb::create_linkcommits. The outermemory_idcarries the source id (the link-author side);target_idis the destination of the directed link.- NewSubscription
- Parameters for creating a subscription.
- Promote
Event Details memory_promoteevent — fires after a tier or vertical promotion commits.to_namespaceisSomefor vertical (memory_promotewith ato_namespaceargument); for the default tier promotion it isNoneandtieris set to the new tier ("long").- Subscription
- Public-facing subscription record (no secret plaintext).
Constants§
- WEBHOOK_
EVENT_ TYPES - Canonical list of webhook lifecycle events surfaced to subscribers
and to
memory_capabilities(capabilities v2webhook_events). Keep stable: integrators pin against these strings.
Functions§
- delete
- Delete a subscription by id. Returns true if a row was removed.
- dispatch_
event - Fire an event to all matching subscribers. Each dispatch runs in
its own OS thread and does NOT block the caller. Errors are logged
and counted in the DB via
failure_count. - dispatch_
event_ with_ details - P5 (G9): full lifecycle dispatch with optional event-specific
details. The details JSON is FLATTENED into the dispatch payload —
keys must not collide with the outer envelope (
event,memory_id,namespace,agent_id,delivered_at). The four new event types (memory_promote,memory_delete,memory_link_created,memory_consolidated) supply their*EventDetailsstruct serialised viaserde_json::to_value. - insert
- Insert a subscription, hashing any secret before persisting.
- list
- List all active subscriptions.
- list_
by_ event - P5 (G9): list subscriptions matching a specific event type. Returns rows where either:
- validate_
url - SSRF guard. Rejects URLs that would cause the daemon to connect to private-range addresses, link-local, loopback (except explicitly), or non-HTTPS remote hosts.
- validate_
url_ dns - SSRF guard with DNS resolution (#301 item 2). Resolves the host
via the stdlib resolver and rejects if ANY returned
SocketAddr’s IP is private / loopback / link-local. Guards against DNS-rebind attacks where an attacker-controlled hostname resolves to an internal IP at connect time.