Skip to content

feat(daemon): serve per-project artifacts over the AG-UI binding - #1416

Merged
edenreich merged 1 commit into
mainfrom
fix/issue-1414
Sep 29, 2026
Merged

edenreich merged 1 commit into
mainfrom
fix/issue-1414

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1414

Summary

The infer daemon now serves GET /artifacts/<project-slug>/<relative-path> read-only from ~/.infer/projects/<project-slug>/artifacts/, so the opentask extension can render the images the agent generated through the binding it already connects to. The route rides the binding's loopback listener, is unauthenticated like the old infer chat route (an <img> tag cannot send the token), and rejects any slug or relative path that does not stay inside the per-project artifacts subtree (filepath.IsLocal). docs/browser-extension-protocol.md documents the route again instead of the 404 note.

Changes

  • internal/protocols/agui: BindingConfig.Routes registers optional non-WebSocket HTTP handlers next to /ws under the same loopback listener, and the agui README records the extension point with its closed-import list unchanged.
  • cmd/daemon: a new artifactsHandler serves files from ~/.infer/projects/<slug>/artifacts/ for GET and HEAD; other methods answer 405, and a slug that is not a single local path segment, a climb out of the artifacts subtree, a missing file or a directory answers 404 without reading anything.
  • cmd/daemon: startBinding registers the /artifacts/ route on the binding, so the daemon hosts it for every project it serves.
  • Tests cmd/daemon/artifacts_test.go: serving a file from a project's artifacts dir (bytes and content type) and rejecting traversal attempts, with decoy files proving nothing outside the subtree leaks, plus no-slug, missing-file, directory and method cases.
  • Tests internal/protocols/agui/binding_test.go: a registered route is served by a real binding on a random port and unregistered paths still 404.
  • docs/browser-extension-protocol.md: the Artifacts section documents GET /artifacts/<project-slug>/<relative-path>, its bounds and its unauthenticated-loopback posture, replacing the note that it answers 404.

Cross-repo

Verification

  • task precommit:run (go mod tidy, go fmt + golangci-lint fmt, import-alias check, golangci-lint run --build-tags purego, markdownlint): clean, 0 issues.
  • go test ./cmd/daemon ./internal/protocols/agui: pass.

The daemon answered the extension's /artifacts/ requests with a 404, so panel images the agent generated never rendered. The binding's mux now serves optional extra routes and hosts a read-only /artifacts/<project-slug>/<relative-path> handler that resolves into that project's artifacts dir, rejecting non-local slugs and paths with filepath.IsLocal.

Resolves #1414
@inference-gateway-maintainer
inference-gateway-maintainer Bot marked this pull request as ready for review September 29, 2026 23:29
@inference-gateway-maintainer
inference-gateway-maintainer Bot requested a review from a team as a code owner September 29, 2026 23:29
@edenreich
edenreich merged commit 7f48116 into main Sep 29, 2026
12 checks passed
@edenreich
edenreich deleted the fix/issue-1414 branch September 29, 2026 23:40
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.219.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Serve generated artifacts per project from the infer daemon's AG-UI binding

1 participant