Repository navigation
Add stub-agent example for pub/sub change notifications - #1
Merged
Merged
Conversation
A runnable stand-in for a production agent: reads its prompts by address,
subscribes to change pushes, and acts on the semantic diff verdict that
rides along with each notification — hot-reloading a minor edit or
localized tweak, holding a structural change until a human reviews it.
Uses the existing PromptClient.subscribe(); no new dependencies.
Subscribes per URI rather than by wildcard because the notification body
carries {version, classification} but not the URI, so a wildcard
subscriber cannot tell which prompt changed.
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.
Adds
stub-agent.js, a runnable stand-in for a production agent that reads its prompts from priompt by address and reacts to change pushes.It demonstrates what the pub/sub layer exists for: the semantic diff verdict rides along with the notification, so the reload decision needs no extra round trip.
minor edit/localized tweak/new→ hot-reloadstructural→ hold, keep serving the old version, flag for reviewUses the existing
PromptClient.subscribe(). No new dependencies.Usage
A heartbeat renders the prompt every few seconds so a version flip is visible in the stream rather than being one line you have to go looking for.
Verified against a live server
Hot-reload on a safe edit:
Hold on a structural one:
Note for reviewers
It subscribes once per URI rather than using a wildcard subject.
pubsub.Eventis{version, classification}with no URI, so a wildcard subscriber (priompt.acme.>, which the subject mapping otherwise supports for free) cannot tell which prompt moved. The closure supplies the URI instead. Addingurito the Event struct would make wildcard subscription viable for an agent watching many prompts.Two deliberate limits: held versions live in memory only, and there is no approve path to un-hold.