Web Interface (#11) - #12
Merged
Merged
Conversation
Adds a dependency-free browser console (internal/web, go:embed'd, no build step) mounted at /ui by the existing Fiber control API, with / redirecting to it. Adds GET /config, GET /models, and POST /poll to the API, an Orchestrator.Poll() for on-demand discovery passes, and an Origin/Referer check on mutating routes so a page loaded from another site can't drive the API from a visitor's browser. server.New now takes an Options struct to carry the extra config/registry dependencies the UI needs. server.ui (default true) toggles the mount. Closes #11. Co-Authored-By: Claude Sonnet 5 <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.
Closes #11
What the agent did
Summary
Implemented issue #11 following the approved plan: an embedded, dependency-free web console for the control API.
New:
internal/web/—web.go(go:embed assets),assets/index.html,assets/app.css,assets/app.js(vanilla JS, hash-routed, no build step),web_test.go.Modified:
internal/server/server.go—Newnow takes anOptionsstruct; addedGET /config(webhook redacted),GET /models(registry + cooldown state),POST /poll;/uistatic mount with/→/ui/redirect gated byserver.ui; same-origin middleware on mutating routes (rejects a non-loopbackOrigin/Referer, passes through requests with neither header, e.g.curl).internal/server/server_test.go— updatedtestServerhelper, added tests for the UI mount,server.ui=false, the origin guard,/configredaction, and/poll.internal/orchestrator/loop.go— buffered poll channel +Poll() boolfor an on-demand discovery pass (the "Run discovery now" button), wired intoRun's select loop.cmd/agent.go— updated the oneserver.Newcall site.internal/config/config.go,config.example.json—server.ui(defaulttrue).README.md— Control API table rows, new "Web interface" section + TOC entry,internal/webin Layout,server.uiin the config reference.Verification:
go build,go vet,gofmt -lall clean;go test ./...passes for every package I touched (server, web, orchestrator, config) — the toolchain here can't run-race(ARM64 kernel doesn't support the sanitizer) orinternal/git's tests (pre-existing, environment git-identity mismatch, unrelated to this change and unmodified by it). I also built the actual binary and ran it against a live config: confirmed/,/ui/,/ui/app.js,/ui/nope.js(404),/status,/config,/models,POST /poll, and the origin guard (403 cross-origin, 200 with noOrigin) all behave as specified.One caveat: there's no browser or JS runtime in this sandbox, so I could not screenshot the console or execute
app.js. I did a careful manual read-through instead and fixed two real bugs found that way: silent poll ticks were re-rendering the dashboard twice per interval, and a silent tick on the run-detail view would have wiped a manually-loaded transcript every few seconds. A reviewer should still open it in an actual browser before considering this done — that's the one piece of the plan's own risk list I couldn't close out myself.Verification
Tests failed (
make test). This PR is a draft — the failure is reported rather than hidden, so you can judge whether the change is salvageable.Test output (tail)
Changes
Opened automatically by coding-agent-loop (run
771a2bac-6db6-4aeb-b91c-194e00450b78, attempt 2, modelclaude-sonnet-5, cost $5.1745, session090ddb22-8aef-4d46-a372-8a42079600b4). Nothing here has been reviewed by a human yet.