feat: HTTP status endpoint (Bun.serve) replaces file-based status - #108
Merged
Merged
Conversation
…tus #107 - Server: Bun.serve on dynamic port, writes port to discovery file - TUI: reads port file once, polls http://127.0.0.1:<port>/status every 200ms - Removed getBrainStatusFile + all status file I/O - stopStatusServer on dispose hook - port:0 guarantees OS-assigned free port (no collision risk)
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.
Closes #107
Pattern
Same as limits-sidebar: TUI polls a local HTTP endpoint for status data.
Architecture
Bun.serve({ port: 0 })— dynamic port, no collision risk~/.cache/opencode/brain/status-port-<hash>.json(session-scoped)http://127.0.0.1:<port>/statusevery 200msstopStatusServer()called on plugin disposeFiles
src/status.ts— startStatusServer/stopStatusServer + Bun.servesrc/tui.tsx— HTTP fetch pollingsrc/four-opencode-brain.ts— dispose hooksrc/shared.ts— emptied (getBrainStatusFile removed)Summary by cubic
Replaces file-based brain status with a local HTTP endpoint via
Bun.serveon a dynamic port. Implements #107 by having the TUI resolve the port once and poll/statusfor in-memory JSON; removes status file I/O and shuts down the server on dispose.http://127.0.0.1:<port>/statusviaBun.serve({ port: 0 })(OS-assigned free port).~/.cache/opencode/brain/status-port-<hash>.json(session-scoped).getBrainStatusFile; addedstopStatusServer()and a dispose hook.Written for commit 837ecd0. Summary will update on new commits.