Add daemon WebSocket event hub#744
Open
backnotprop wants to merge 8 commits into
Open
Conversation
Single daemon process per machine manages session lifecycle, serves browser UIs at /s/<sessionId>, and exposes control APIs. CLI commands auto-start the daemon and create sessions via HTTP. Includes session store, auth tokens, lock files, event broadcasting, and goal-setup daemon integration.
Debug frontend (apps/debug-frontend) served by the daemon as the session browser shell. Agent simulator TUI (apps/debug-tui) exercises all agent protocols with concurrent session support. Includes reactive session dashboard, event log, prominent session action buttons, and goal-setup scenarios.
Replace persistent SSE streams with a single WebSocket connection per frontend instance. Daemon multiplexes session-scoped events (annotations, agent jobs, lifecycle) through /daemon/ws with subscribe/unsubscribe messaging. Includes session actions over WebSocket, reconnect/resync, auth enforcement, and polling fallback.
The goal-setup daemon integration from layers 734/738 was lost during re-squash cascades. This commit restores all missing pieces: - PluginGoalSetupRequest type and goal-setup action in plugin protocol - goal-setup case in daemon session factory - setup-goal CLI subcommand routed through runDaemonSessionRequest - goal-setup-submit/goal-setup-exit debug frontend actions - TUI scenarios for interview and facts with fixture bundles - TUI completion for goal-setup sessions - Fix getRepoInfo to use session cwd in createGoalSetupSession - Standardize naming: "goal-setup" everywhere (was "setup-goal" in daemon protocol and debug frontend)
The source shim resolves workspace imports through package exports. Without these entries, `bun apps/hook/server/index.ts` fails to find daemon modules even though the files exist on disk.
- Add PluginGoalSetupResult to PluginActionResult union - Add goal-setup to PLANNOTATOR_PLUGIN_FEATURES - Use typed result in CLI instead of cast - Add session factory tests: interview submit and facts exit
- Resolve relative bundle paths against getInvocationCwd() so hook/wrapper invocations find the file in the project directory - Remove goal-setup from PLANNOTATOR_PLUGIN_FEATURES since it is a direct CLI command invoked by agent skills, not a plugin action dispatched through the plugin protocol
This was referenced May 19, 2026
The onerror and onclose socket handlers both called scheduleReconnect(), but the handleMessage error branch tore down the socket without scheduling a reconnect — leaving the client permanently dead.
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.
Summary
/daemon/wsTest plan
bun run typecheckpassesbun run test— 1,399 tests passbun run dev:debug-stack— sessions stream events over WebSocket