feat(events): emit trigger.fired + memory.changed, event-drive those stores (closes #93, #101)#118
Merged
Merged
Conversation
…stores Completes the SSE migration (#93) and the polling-unification half of #101 by extending the event surface beyond tasks. Backend (server.py): - trigger.fired — published from _fire_webhook (webhook received) and handle_cron_fire (k8s CronJob pod fires). - memory.changed — published from the memory upsert / delete / link handlers ({op, namespace, key}). SPA: - api/events.ts: add trigger.fired / memory.changed to the subscribed event types. - store/triggers.ts + store/memory.ts: subscribe to the stream and refresh (coalesced) on their event; the existing interval becomes a safety-net — it polls normally when the stream is down and slows to a ~45s heartbeat when it's up. The memory poll deliberately keeps the heartbeat because MCP-authored writes happen in a separate process and so don't emit here; the safety poll still catches them. Behavior is unchanged when SSE is unavailable (pure addition). Tests: events.test.ts gains a new-event-types dispatch case (7 total); full SPA suite 119 passing; Python suite 466 passing; build OK. Closes #93 Closes #101 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Finishes the SSE migration — extends the event surface beyond tasks so the Triggers and Memory views are also real-time. Closes #93 (SSE event stream) and the polling-unification half of #101.
Backend (
server.py)trigger.fired— published from_fire_webhook(webhook received) andhandle_cron_fire(k8s CronJob pod fires),{trigger_type, trigger_id, task_id}.memory.changed— published from the memoryupsert/delete/linkhandlers,{op, namespace, key}.SPA
api/events.ts—trigger.fired/memory.changedadded to the subscribed event types.store/triggers.ts+store/memory.ts— subscribe to the stream; a coalesced refresh fires on their event. The interval becomes a safety net: normal cadence when the stream is down, ~45s heartbeat when it's up.Pure addition — behavior is unchanged when SSE is unavailable.
Verification
tscclean;events.test.tsgains atrigger.fired/memory.changeddispatch case (7 tests); full SPA suite 119 passing.yarn buildOK.Net result
All three live views (Build, Triggers, Memory) now update via push in <1s, with graceful poll fallbacks. The steady background polling is suppressed while the stream is healthy.
Closes #93
Closes #101
🤖 Generated with Claude Code