lattice-pns avatar

lattice

1 subscriber
TypeScriptJavaScriptDockerfile

Push notification service for AI agents

Created Mar 2026

Apache-2.0 license

Live activities

We've refactored the push notification server by removing topic-based subscriptions and the associated broadcast functionality. This change streamlines the system to focus exclusively on direct agent-to-agent messaging and one-to-one push notifications, significantly reducing code complexity and removing unused infrastructure like Redis topic sets and bearer authentication. It's always satisfying to delete over 200 lines of dead code to make the codebase cleaner and easier to maintain. Code Deletion

We've replaced the single-topic /push/topic endpoint with /push/topics, which now supports broadcasting to multiple topics in a single request. This update uses a Redis SUNION operation to automatically deduplicate subscribers across the provided topics, ensuring that agents only receive a notification exactly once even if they are subscribed to several of the target topics. This reduces both network overhead and improves the developer experience for handling multi-topic notifications. No duplicates here

This update modifies the SSE notification event format to include the topic name when messages are broadcast via /push/topic. By adding the topic to the notification data, subscribers can now easily identify which channel triggered a specific push event. I've also updated the tests to verify that the topic field is correctly propagated to recipients.

We've transitioned the /push endpoint from utilizing a query parameter (?pubkey=) to a cleaner path parameter structure (/push/:pubkey). This change aligns the API with standard REST practices, allows for stricter schema validation, and maps missing keys to a more appropriate 404 status code. It's a small change that significantly improves the clarity and resource-oriented design of our endpoint architecture. Refactor progress

This update introduces a streamlined deployment workflow for Dokku, including a setup-dokku.sh script to automate app creation, port mapping, Redis integration, and HTTPS via Let's Encrypt. A custom nginx.conf.sigil was added to handle HTTPS redirects and proxy configurations, ensuring secure and scalable deployments for production environments. This lowers the barrier to entry for hosting by codifying the infrastructure setup.

Updated the docker-compose setup to expose the Nginx service on port 80. This enables standard HTTP access for the deployment, simplifying integration with load balancers and existing network infrastructures. Netcat listening at Port 80

This update introduces architectural support for scaling SSE servers horizontally by adding an Nginx configuration and simplifying the messaging API. The /push/token endpoint has been replaced with a cleaner POST /push?pubkey=<pubkey> interface to streamline interaction, and example scripts have been updated to reflect these changes. This setup now allows running multiple instances behind a load balancer to increase capacity.

Updated the /send endpoint to now buffer messages for recipients who are currently offline, returning a 202 Accepted status instead of a 404 Not Found. This change ensures that messages are persisted and delivered to the recipient upon reconnection. Updated documentation and test suites to reflect this new delivery behavior.

Simplified the conditional logic within the push request handlers in index.ts to reduce noise and improve readability. Additionally, fixed a discrepancy where one of the agents' push calls was incorrectly returning a 404 instead of handling buffered delivery, ensuring consistent response behavior across the API. The codebase remains cleaner and more maintainable.

Moved the client registration step before the event replay logic in the SSE subscription flow to resolve a race condition. By ensuring the registry is fully aware of the client connection prior to attempting to retrieve missed events, we prevent potential delivery gaps for newly connected agents. Race condition fix

We've implemented a robust event buffering mechanism that allows clients to recover missed messages after a disconnection. By storing events in a Redis sorted set keyed by pubkey and utilizing monotonic ULIDs, the system can efficiently replay events based on the Last-Event-ID header. This update also updates status codes to 202 Accepted when events are successfully buffered for offline agents, ensuring a better experience for connected clients. Reconnection handled

This update improves webhook compatibility by migrating the public key authentication from the 'Authorization: Bearer' header to a '?pubkey=' query parameter on the /push endpoint. Additionally, the codebase now utilizes TypeBox for schema definitions, allowing for unified TypeBox schemas and inferred TypeScript types, which replaces several redundant manual interfaces. These changes streamline both endpoint integration and internal type safety. Webhook API refactor

This update introduces a new /push endpoint that enables direct push notifications, improving compatibility with various webhook providers. It includes a custom content-type parser to handle diverse payload formats and ensures secure access via Bearer token authentication.

Updated the test suite in index.test.ts to ensure more robust coverage and stability when testing the push notification and messaging endpoints. These adjustments primarily address minor inconsistencies in test setup and verification logic, leading to more reliable CI results.

To simplify local testing and debugging of the authentication flow, timestamp validation has been removed from verifyEd25519. While this allows for easier request generation, please be aware that requests are currently not being checked for freshness or expiration. Don't test my feature

Updated the /push/token endpoint to no longer require bearer authentication. This simplifies integration for services sending notifications directly to specific agent public keys, while topic-based broadcasts and agent-to-agent messaging remain secured. Open API

Implemented a new /send endpoint that allows authenticated agents to securely send messages directly to other agents by their public Ed25519 key. The server handles verification of the signature and automatically injects the sender's identity into the relayed notification. This update enables decentralized communication between agents connected to the lattice infrastructure. Message delivery

This update introduces essential developer tooling to the repository, including ESLint, Prettier, and a robust CI pipeline using GitHub Actions to enforce code quality and test compliance. A comprehensive test suite using bun:test has been added, covering core SSE functionality and API routes, significantly improving the project's reliability and development velocity. šŸš€

We've cleaned up the project configuration by removing the ngrok service from the docker-compose setup and associated env files. This reduces complexity for local environments that don't require external tunneling. It's a nice minor cleanup to keep our default setup lean. Cleanup

Resolved an issue where the ngrok authentication token was not being properly utilized in the docker-compose environment. This ensures that the ngrok tunnel can successfully authenticate, preventing connection failures during local development. Now, you should be able to expose your local environment seamlessly as expected. Ngrok tunnel troubleshooting