Skip to content

Web Interface (#11) - #12

Merged
ableinc merged 1 commit into
mainfrom
agent/issue-11-web-interface
Aug 25, 2026
Merged

Web Interface (#11)#12
ableinc merged 1 commit into
mainfrom
agent/issue-11-web-interface

Conversation

@ableinc

@ableinc ableinc commented Aug 25, 2026

Copy link
Copy Markdown
Owner

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.goNew now takes an Options struct; added GET /config (webhook redacted), GET /models (registry + cooldown state), POST /poll; /ui static mount with //ui/ redirect gated by server.ui; same-origin middleware on mutating routes (rejects a non-loopback Origin/Referer, passes through requests with neither header, e.g. curl).
  • internal/server/server_test.go — updated testServer helper, added tests for the UI mount, server.ui=false, the origin guard, /config redaction, and /poll.
  • internal/orchestrator/loop.go — buffered poll channel + Poll() bool for an on-demand discovery pass (the "Run discovery now" button), wired into Run's select loop.
  • cmd/agent.go — updated the one server.New call site.
  • internal/config/config.go, config.example.jsonserver.ui (default true).
  • README.md — Control API table rows, new "Web interface" section + TOC entry, internal/web in Layout, server.ui in the config reference.

Verification: go build, go vet, gofmt -l all 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) or internal/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 no Origin) 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)
go test -race ./...
go: downloading go1.26.5 (linux/arm64)
go: download go1.26.5: golang.org/toolchain@v0.0.1-go1.26.5.linux-arm64: verifying module: golang.org/toolchain@v0.0.1-go1.26.5.linux-arm64: open /home/node1/go/pkg/sumdb/sum.golang.org/latest: read-only file system
make: *** [Makefile:115: test] Error 1

Changes

README.md                      |  35 +-
 cmd/agent.go                   |   5 +-
 config.example.json            |   3 +-
 internal/config/config.go      |   6 +-
 internal/orchestrator/loop.go  |  20 +
 internal/server/server.go      | 165 ++++++++-
 internal/server/server_test.go | 159 +++++++-
 internal/web/assets/app.css    | 548 +++++++++++++++++++++++++++
 internal/web/assets/app.js     | 820 +++++++++++++++++++++++++++++++++++++++++
 internal/web/assets/index.html |  46 +++
 internal/web/web.go            |  27 ++
 internal/web/web_test.go       |  32 ++
 12 files changed, 1842 insertions(+), 24 deletions(-)

Opened automatically by coding-agent-loop (run 771a2bac-6db6-4aeb-b91c-194e00450b78, attempt 2, model claude-sonnet-5, cost $5.1745, session 090ddb22-8aef-4d46-a372-8a42079600b4). Nothing here has been reviewed by a human yet.

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>
@ableinc ableinc mentioned this pull request Aug 25, 2026
@ableinc
ableinc marked this pull request as ready for review August 25, 2026 23:51
@ableinc
ableinc merged commit 3ba2ebc into main Aug 25, 2026
7 checks passed
@ableinc
ableinc deleted the agent/issue-11-web-interface branch August 25, 2026 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web Interface

1 participant